From: Andrea Bianco Date: Thu, 9 Apr 2020 17:29:48 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.4.13 X-Git-Tag: 2.4.14~1 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=22a4d3ef7c80c3b16c7ecf36b8b309a6acda4f4c;p=motion2.git Built motion from commit (unavailable).|2.4.13 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 33300db..0fd461f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.4.13", "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-04-09T16:58:42.936Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); +define({ "name": "xCALLY Motion API", "version": "2.4.13", "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-04-09T17:17:33.275Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index acb0109..a5b8067 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.4.13", "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-04-09T16:58:42.936Z", "url": "http://apidocjs.com", "version": "0.17.7" } } +{ "name": "xCALLY Motion API", "version": "2.4.13", "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-04-09T17:17:33.275Z", "url": "http://apidocjs.com", "version": "0.17.7" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 806b023..b0e2317 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 _0xc778=['jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar'];(function(_0x2efb96,_0x40a4ce){var _0x50d38d=function(_0x22eaa9){while(--_0x22eaa9){_0x2efb96['push'](_0x2efb96['shift']());}};_0x50d38d(++_0x40a4ce);}(_0xc778,0xbd));var _0x8c77=function(_0x20dc0d,_0x445fbf){_0x20dc0d=_0x20dc0d-0x0;var _0x539be6=_0xc778[_0x20dc0d];return _0x539be6;};'use strict';var Sequelize=require(_0x8c77('0x0'));module[_0x8c77('0x1')]={'name':{'type':Sequelize[_0x8c77('0x2')],'get':function(_0x2b966e){return this[_0x8c77('0x3')](_0x8c77('0x4'));}},'action':{'type':Sequelize[_0x8c77('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8c77('0x6'),_0x8c77('0x7'),_0x8c77('0x8'),_0x8c77('0x9'),_0x8c77('0xa'),_0x8c77('0xb'),_0x8c77('0xc'),_0x8c77('0xd')]],'msg':_0x8c77('0xe')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x8c77('0x5')](0x1000),'comment':_0x8c77('0xf')},'data2':{'type':Sequelize[_0x8c77('0x5')](0x1000),'comment':_0x8c77('0x10')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x8c77('0x11')},'data4':{'type':Sequelize[_0x8c77('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x8c77('0x5')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc29d=['contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x4d5672,_0x4517e7){var _0x4a7aec=function(_0x29cd05){while(--_0x29cd05){_0x4d5672['push'](_0x4d5672['shift']());}};_0x4a7aec(++_0x4517e7);}(_0xc29d,0xdb));var _0xdc29=function(_0x1467c3,_0x56949e){_0x1467c3=_0x1467c3-0x0;var _0x2e4afa=_0xc29d[_0x1467c3];return _0x2e4afa;};'use strict';var Sequelize=require(_0xdc29('0x0'));module[_0xdc29('0x1')]={'name':{'type':Sequelize[_0xdc29('0x2')],'get':function(_0x5763fe){return this[_0xdc29('0x3')](_0xdc29('0x4'));}},'action':{'type':Sequelize[_0xdc29('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xdc29('0x6'),_0xdc29('0x7'),_0xdc29('0x8'),_0xdc29('0x9'),_0xdc29('0xa'),_0xdc29('0xb'),_0xdc29('0xc'),_0xdc29('0xd')]],'msg':_0xdc29('0xe')}},'comment':_0xdc29('0xe')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xdc29('0xf')},'data2':{'type':Sequelize[_0xdc29('0x5')](0x1000),'comment':_0xdc29('0x10')},'data3':{'type':Sequelize[_0xdc29('0x5')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xdc29('0x5')](0x1000)},'data5':{'type':Sequelize[_0xdc29('0x5')](0x1000)},'data6':{'type':Sequelize[_0xdc29('0x5')]},'data7':{'type':Sequelize[_0xdc29('0x11')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1159406..92bed02 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 _0x57ef=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','error','stack','name','send','body','find','params','destroy','Action','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x3c3556,_0x2c5dc8){var _0x39b4d8=function(_0x110f18){while(--_0x110f18){_0x3c3556['push'](_0x3c3556['shift']());}};_0x39b4d8(++_0x2c5dc8);}(_0x57ef,0xdb));var _0xf57e=function(_0x199b36,_0x16294d){_0x199b36=_0x199b36-0x0;var _0x32a8f3=_0x57ef[_0x199b36];return _0x32a8f3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf57e('0x0'));var rimraf=require(_0xf57e('0x1'));var zipdir=require(_0xf57e('0x2'));var jsonpatch=require(_0xf57e('0x3'));var rp=require(_0xf57e('0x4'));var moment=require(_0xf57e('0x5'));var BPromise=require(_0xf57e('0x6'));var Mustache=require('mustache');var util=require(_0xf57e('0x7'));var path=require(_0xf57e('0x8'));var sox=require(_0xf57e('0x9'));var csv=require(_0xf57e('0xa'));var ejs=require(_0xf57e('0xb'));var fs=require('fs');var _=require(_0xf57e('0xc'));var squel=require(_0xf57e('0xd'));var crypto=require(_0xf57e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf57e('0xf'));var toCsv=require(_0xf57e('0xa'));var querystring=require(_0xf57e('0x10'));var Papa=require(_0xf57e('0x11'));var Redis=require(_0xf57e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf57e('0x13'));var hardwareService=require(_0xf57e('0x14'));var logger=require('../../config/logger')(_0xf57e('0x15'));var utils=require(_0xf57e('0x16'));var config=require(_0xf57e('0x17'));var db=require(_0xf57e('0x18'))['db'];function respondWithStatusCode(_0x1885e2,_0x2daec1){_0x2daec1=_0x2daec1||0xcc;return function(_0x4e3b57){if(_0x4e3b57){return _0x1885e2[_0xf57e('0x19')](_0x2daec1);}return _0x1885e2[_0xf57e('0x1a')](_0x2daec1)[_0xf57e('0x1b')]();};}function respondWithResult(_0x2c9c4c,_0x3f7b1f){_0x3f7b1f=_0x3f7b1f||0xc8;return function(_0x3ffeee){if(_0x3ffeee){return _0x2c9c4c[_0xf57e('0x1a')](_0x3f7b1f)[_0xf57e('0x1c')](_0x3ffeee);}};}function respondWithFilteredResult(_0x122be7,_0x419b4a){return function(_0x150b80){if(_0x150b80){var _0x2a6ff7=_0x150b80[_0xf57e('0x1d')],_0x3bf629=_0x419b4a[_0xf57e('0x1e')],_0x302c46=_0x419b4a[_0xf57e('0x1e')]+_0x419b4a[_0xf57e('0x1f')],_0x37e548;if(_0x302c46>=_0x2a6ff7){_0x302c46=_0x2a6ff7;_0x37e548=0xc8;}else{_0x37e548=0xce;}_0x122be7[_0xf57e('0x1a')](_0x37e548);return _0x122be7[_0xf57e('0x20')](_0xf57e('0x21'),_0x3bf629+'-'+_0x302c46+'/'+_0x2a6ff7)['json'](_0x150b80);}return null;};}function patchUpdates(_0x5ab063){return function(_0x1b440f){try{jsonpatch['apply'](_0x1b440f,_0x5ab063,!![]);}catch(_0x3100ce){return BPromise['reject'](_0x3100ce);}return _0x1b440f[_0xf57e('0x22')]();};}function saveUpdates(_0x254ef0,_0x17afb0){return function(_0xa8476e){if(_0xa8476e){return _0xa8476e['update'](_0x254ef0)[_0xf57e('0x23')](function(_0x582ca5){return _0x582ca5;});}return null;};}function removeEntity(_0x3dd540,_0x24aed0){return function(_0x4eac1f){if(_0x4eac1f){return _0x4eac1f['destroy']()[_0xf57e('0x23')](function(){_0x3dd540[_0xf57e('0x1a')](0xcc)[_0xf57e('0x1b')]();});}};}function handleEntityNotFound(_0x297b2f,_0x5d0f7f){return function(_0x134557){if(!_0x134557){_0x297b2f[_0xf57e('0x19')](0x194);}return _0x134557;};}function handleError(_0x4b0a0c,_0x45843b){_0x45843b=_0x45843b||0x1f4;return function(_0x2d5893){logger[_0xf57e('0x24')](_0x2d5893[_0xf57e('0x25')]);if(_0x2d5893[_0xf57e('0x26')]){delete _0x2d5893[_0xf57e('0x26')];}_0x4b0a0c['status'](_0x45843b)[_0xf57e('0x27')](_0x2d5893);};}exports['update']=function(_0x342c9d,_0x36f1d4){if(_0x342c9d[_0xf57e('0x28')]['id']){delete _0x342c9d['body']['id'];}return db['Action'][_0xf57e('0x29')]({'where':{'id':_0x342c9d[_0xf57e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x36f1d4,null))[_0xf57e('0x23')](saveUpdates(_0x342c9d[_0xf57e('0x28')],null))['then'](respondWithResult(_0x36f1d4,null))['catch'](handleError(_0x36f1d4,null));};exports[_0xf57e('0x2b')]=function(_0x53f294,_0x98b84e){return db[_0xf57e('0x2c')][_0xf57e('0x29')]({'where':{'id':_0x53f294[_0xf57e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x98b84e,null))['then'](removeEntity(_0x98b84e,null))[_0xf57e('0x2d')](handleError(_0x98b84e,null));}; \ No newline at end of file +var _0xb515=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','send','body','find','params','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb515,0x1b8));var _0x5b51=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0xb515[_0x364a36];return _0x5cd6fa;};'use strict';var pdf=require(_0x5b51('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b51('0x1'));var zipdir=require(_0x5b51('0x2'));var jsonpatch=require(_0x5b51('0x3'));var rp=require(_0x5b51('0x4'));var moment=require(_0x5b51('0x5'));var BPromise=require(_0x5b51('0x6'));var Mustache=require(_0x5b51('0x7'));var util=require(_0x5b51('0x8'));var path=require('path');var sox=require(_0x5b51('0x9'));var csv=require(_0x5b51('0xa'));var ejs=require(_0x5b51('0xb'));var fs=require('fs');var _=require(_0x5b51('0xc'));var squel=require(_0x5b51('0xd'));var crypto=require(_0x5b51('0xe'));var jsforce=require(_0x5b51('0xf'));var deskjs=require(_0x5b51('0x10'));var toCsv=require(_0x5b51('0xa'));var querystring=require(_0x5b51('0x11'));var Papa=require(_0x5b51('0x12'));var Redis=require(_0x5b51('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5b51('0x14'));var hardwareService=require(_0x5b51('0x15'));var logger=require(_0x5b51('0x16'))(_0x5b51('0x17'));var utils=require(_0x5b51('0x18'));var config=require(_0x5b51('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52e25a,_0x585a8e){_0x585a8e=_0x585a8e||0xcc;return function(_0x3112a6){if(_0x3112a6){return _0x52e25a[_0x5b51('0x1a')](_0x585a8e);}return _0x52e25a[_0x5b51('0x1b')](_0x585a8e)[_0x5b51('0x1c')]();};}function respondWithResult(_0x5f0d8d,_0x11f3bf){_0x11f3bf=_0x11f3bf||0xc8;return function(_0x3fe81c){if(_0x3fe81c){return _0x5f0d8d[_0x5b51('0x1b')](_0x11f3bf)[_0x5b51('0x1d')](_0x3fe81c);}};}function respondWithFilteredResult(_0x303abd,_0x1b45f6){return function(_0x13adfc){if(_0x13adfc){var _0x107f86=_0x13adfc[_0x5b51('0x1e')],_0x33a3c4=_0x1b45f6['offset'],_0x1c69fc=_0x1b45f6[_0x5b51('0x1f')]+_0x1b45f6['limit'],_0x4216aa;if(_0x1c69fc>=_0x107f86){_0x1c69fc=_0x107f86;_0x4216aa=0xc8;}else{_0x4216aa=0xce;}_0x303abd['status'](_0x4216aa);return _0x303abd[_0x5b51('0x20')](_0x5b51('0x21'),_0x33a3c4+'-'+_0x1c69fc+'/'+_0x107f86)['json'](_0x13adfc);}return null;};}function patchUpdates(_0xb030d5){return function(_0x1bd7dc){try{jsonpatch['apply'](_0x1bd7dc,_0xb030d5,!![]);}catch(_0x5da4c9){return BPromise['reject'](_0x5da4c9);}return _0x1bd7dc[_0x5b51('0x22')]();};}function saveUpdates(_0x207f68,_0x190ca4){return function(_0x1435f4){if(_0x1435f4){return _0x1435f4[_0x5b51('0x23')](_0x207f68)[_0x5b51('0x24')](function(_0x50a114){return _0x50a114;});}return null;};}function removeEntity(_0x2c0aa1,_0x552aac){return function(_0x399254){if(_0x399254){return _0x399254[_0x5b51('0x25')]()[_0x5b51('0x24')](function(){_0x2c0aa1[_0x5b51('0x1b')](0xcc)[_0x5b51('0x1c')]();});}};}function handleEntityNotFound(_0x24259c,_0x58f169){return function(_0x59e842){if(!_0x59e842){_0x24259c[_0x5b51('0x1a')](0x194);}return _0x59e842;};}function handleError(_0x41c9b6,_0x516178){_0x516178=_0x516178||0x1f4;return function(_0x3ea804){logger[_0x5b51('0x26')](_0x3ea804[_0x5b51('0x27')]);if(_0x3ea804[_0x5b51('0x28')]){delete _0x3ea804['name'];}_0x41c9b6[_0x5b51('0x1b')](_0x516178)[_0x5b51('0x29')](_0x3ea804);};}exports[_0x5b51('0x23')]=function(_0x399d2a,_0x21f0ca){if(_0x399d2a['body']['id']){delete _0x399d2a[_0x5b51('0x2a')]['id'];}return db['Action'][_0x5b51('0x2b')]({'where':{'id':_0x399d2a[_0x5b51('0x2c')]['id']}})[_0x5b51('0x24')](handleEntityNotFound(_0x21f0ca,null))[_0x5b51('0x24')](saveUpdates(_0x399d2a[_0x5b51('0x2a')],null))[_0x5b51('0x24')](respondWithResult(_0x21f0ca,null))[_0x5b51('0x2d')](handleError(_0x21f0ca,null));};exports[_0x5b51('0x25')]=function(_0x185904,_0x253977){return db['Action'][_0x5b51('0x2b')]({'where':{'id':_0x185904[_0x5b51('0x2c')]['id']}})[_0x5b51('0x24')](handleEntityNotFound(_0x253977,null))[_0x5b51('0x24')](removeEntity(_0x253977,null))[_0x5b51('0x2d')](handleError(_0x253977,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index b5b1241..31d5945 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 _0xdae8=['tools_actions','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./action.attributes','exports','define','Action'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0xdae8,0xb5));var _0x8dae=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0xdae8[_0x3d1996];return _0x550afd;};'use strict';var _=require(_0x8dae('0x0'));var util=require('util');var logger=require(_0x8dae('0x1'))(_0x8dae('0x2'));var moment=require(_0x8dae('0x3'));var BPromise=require('bluebird');var rp=require(_0x8dae('0x4'));var fs=require('fs');var path=require(_0x8dae('0x5'));var rimraf=require(_0x8dae('0x6'));var config=require('../../config/environment');var attributes=require(_0x8dae('0x7'));module[_0x8dae('0x8')]=function(_0x4bf2f0,_0x401e83){return _0x4bf2f0[_0x8dae('0x9')](_0x8dae('0xa'),attributes,{'tableName':_0x8dae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb55a=['./action.attributes','define','Action','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x1d9393,_0x3d1aaf){var _0x337720=function(_0x193863){while(--_0x193863){_0x1d9393['push'](_0x1d9393['shift']());}};_0x337720(++_0x3d1aaf);}(_0xb55a,0x111));var _0xab55=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xb55a[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require(_0xab55('0x0'));var logger=require(_0xab55('0x1'))(_0xab55('0x2'));var moment=require(_0xab55('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab55('0x4'));var rimraf=require(_0xab55('0x5'));var config=require(_0xab55('0x6'));var attributes=require(_0xab55('0x7'));module['exports']=function(_0x33887b,_0x58916c){return _0x33887b[_0xab55('0x8')](_0xab55('0x9'),attributes,{'tableName':'tools_actions','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 a901cb7..571561d 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 _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1eee3f,_0x367fe1){var _0x3a88fd=function(_0x7f36da){while(--_0x7f36da){_0x1eee3f['push'](_0x1eee3f['shift']());}};_0x3a88fd(++_0x367fe1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1bf718,_0x8d9005){var _0xc10627=function(_0x4f5a05){while(--_0x4f5a05){_0x1bf718['push'](_0x1bf718['shift']());}};_0xc10627(++_0x8d9005);}(_0xe706,0xa3));var _0x6e70=function(_0x1ea729,_0x3552bb){_0x1ea729=_0x1ea729-0x0;var _0x3576c4=_0xe706[_0x1ea729];return _0x3576c4;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b42607f..0fa8e9e 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 _0x9a22=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x594847,_0x47b321){var _0xd05d17=function(_0x1e8ece){while(--_0x1e8ece){_0x594847['push'](_0x594847['shift']());}};_0xd05d17(++_0x47b321);}(_0x9a22,0x7c));var _0x29a2=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x9a22[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x29a2('0x0'));var util=require(_0x29a2('0x1'));var path=require(_0x29a2('0x2'));var timeout=require(_0x29a2('0x3'));var express=require(_0x29a2('0x4'));var router=express[_0x29a2('0x5')]();var auth=require(_0x29a2('0x6'));var interaction=require(_0x29a2('0x7'));var config=require(_0x29a2('0x8'));var controller=require(_0x29a2('0x9'));router[_0x29a2('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x29a2('0xb')]);router[_0x29a2('0xc')](_0x29a2('0xd'),auth['isAuthenticated'](),controller[_0x29a2('0xe')]);module[_0x29a2('0xf')]=router; \ No newline at end of file +var _0x185e=['../../config/environment','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0x185e,0xb0));var _0xe185=function(_0x442e39,_0x2ccfb1){_0x442e39=_0x442e39-0x0;var _0x3dfb30=_0x185e[_0x442e39];return _0x3dfb30;};'use strict';var multer=require(_0xe185('0x0'));var util=require(_0xe185('0x1'));var path=require(_0xe185('0x2'));var timeout=require('connect-timeout');var express=require(_0xe185('0x3'));var router=express['Router']();var auth=require(_0xe185('0x4'));var interaction=require(_0xe185('0x5'));var config=require(_0xe185('0x6'));var controller=require('./action.controller');router['put'](_0xe185('0x7'),auth[_0xe185('0x8')](),controller[_0xe185('0x9')]);router[_0xe185('0xa')](_0xe185('0x7'),auth[_0xe185('0x8')](),controller[_0xe185('0xb')]);module[_0xe185('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index bd6fd18..4a00037 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 _0xb28a=['STRING','TEXT','sequelize'];(function(_0x19aca8,_0xfb56df){var _0x27a339=function(_0x2bbed9){while(--_0x2bbed9){_0x19aca8['push'](_0x19aca8['shift']());}};_0x27a339(++_0xfb56df);}(_0xb28a,0xcb));var _0xab28=function(_0x394a90,_0x1ceb57){_0x394a90=_0x394a90-0x0;var _0x2ba497=_0xb28a[_0x394a90];return _0x2ba497;};'use strict';var Sequelize=require(_0xab28('0x0'));module['exports']={'name':{'type':Sequelize[_0xab28('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xab28('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xab28('0x2')]},'joins':{'type':Sequelize[_0xab28('0x2')]}}; \ No newline at end of file +var _0x1afb=['sequelize','exports','STRING','TEXT'];(function(_0x1229de,_0x5be60c){var _0x47bb3c=function(_0x50381b){while(--_0x50381b){_0x1229de['push'](_0x1229de['shift']());}};_0x47bb3c(++_0x5be60c);}(_0x1afb,0x74));var _0xb1af=function(_0x5d87f3,_0x12d764){_0x5d87f3=_0x5d87f3-0x0;var _0x3ff174=_0x1afb[_0x5d87f3];return _0x3ff174;};'use strict';var Sequelize=require(_0xb1af('0x0'));module[_0xb1af('0x1')]={'name':{'type':Sequelize[_0xb1af('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb1af('0x2')]},'parent':{'type':Sequelize[_0xb1af('0x2')]},'table':{'type':Sequelize[_0xb1af('0x2')]},'conditions':{'type':Sequelize[_0xb1af('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2d71d71..b5ccdd1 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 _0xa9e0=['../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','key','VIRTUAL','field','options','includeAll','include','AnalyticCustomReport','rows','catch','show','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','preview','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','from','table','MetricId','metric','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','operator','AnalyticMetric','keyBy','select','output','web','fullPath','%s-%s.%s','custom','AnalyticExtractedReport','startDate','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','COUNT(*)','run','runReport','AVG(%s)','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){var _0x432e56=_0x5a09ef[_0x0a9e('0x20')]({'plain':!![]});var _0x30bae6='CustomReports';return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'type':_0x30bae6,'resourceId':_0x432e56['id']}})[_0x0a9e('0x1f')](function(){return _0x5a09ef;});})[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x13')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x23')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x24')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x25')](_0x33161b);};}exports[_0x0a9e('0x26')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=db['AnalyticCustomReport'][_0x0a9e('0x27')];_0x1538a4[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](_0x14de77);_0x1538a4[_0x0a9e('0x2a')]=_['keys'](_0x25fba9[_0x0a9e('0x2a')]);_0x1538a4[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],_0x1538a4[_0x0a9e('0x2a')]);_0x140511[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],qs[_0x0a9e('0x2e')](_0x25fba9['query'][_0x0a9e('0x2e')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x140511[_0x0a9e('0x2d')]:_0x1538a4[_0x0a9e('0x28')];if(!_0x25fba9[_0x0a9e('0x2a')]['hasOwnProperty'](_0x0a9e('0x30'))){_0x140511[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x19')]);_0x140511[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x25fba9[_0x0a9e('0x2a')]['offset']);}_0x140511[_0x0a9e('0x31')]=qs['sort'](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x140511[_0x0a9e('0x33')]=qs[_0x0a9e('0x2b')](_['pick'](_0x25fba9[_0x0a9e('0x2a')],_0x1538a4[_0x0a9e('0x2b')]));if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]){_0x140511['where']=_['merge'](_0x140511[_0x0a9e('0x33')],{'$or':_['map'](_0x14de77,function(_0x24936a){if(_0x24936a[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4f41ae={};_0x4f41ae[_0x24936a[_0x0a9e('0x38')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]+'%'};return _0x4f41ae;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x39')]);var _0x1a180b={'where':_0x140511[_0x0a9e('0x33')]};return db['AnalyticCustomReport']['count'](_0x1a180b)[_0x0a9e('0x1f')](function(_0x40d766){_0x11c3b6['count']=_0x40d766;if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x140511[_0x0a9e('0x3b')]=[{'all':!![]}];}return db[_0x0a9e('0x3c')]['findAll'](_0x140511);})['then'](function(_0x15e37d){_0x11c3b6[_0x0a9e('0x3d')]=_0x15e37d;return _0x11c3b6;})['then'](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x3e')](handleError(_0x14433c,null));};exports[_0x0a9e('0x3f')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':![],'where':{'id':_0x1459bb[_0x0a9e('0x40')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](db[_0x0a9e('0x3c')][_0x0a9e('0x27')]);_0x2cfea9[_0x0a9e('0x2a')]=_[_0x0a9e('0x29')](_0x1459bb[_0x0a9e('0x2a')]);_0x2cfea9[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x2cfea9[_0x0a9e('0x28')],_0x2cfea9[_0x0a9e('0x2a')]);_0x316c8f[_0x0a9e('0x2d')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x2e')](_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x316c8f[_0x0a9e('0x2d')]=_0x316c8f[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x316c8f[_0x0a9e('0x2d')]:_0x2cfea9[_0x0a9e('0x28')];if(_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x316c8f[_0x0a9e('0x3b')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x41')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x316c8f)[_0x0a9e('0x1f')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x1f')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x3e')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x43')]=function(_0x21eb86,_0x44dd99){return db['AnalyticCustomReport'][_0x0a9e('0x43')](_0x21eb86['body'],{})[_0x0a9e('0x1f')](function(_0x476688){var _0x8d6dd1=_0x21eb86['user'][_0x0a9e('0x20')]({'plain':!![]});if(!_0x8d6dd1)throw new Error(_0x0a9e('0x44'));if(_0x8d6dd1[_0x0a9e('0x45')]===_0x0a9e('0x46')){var _0x45c845=_0x476688[_0x0a9e('0x20')]({'plain':!![]});var _0x45bf7f='Reports';return db[_0x0a9e('0x47')][_0x0a9e('0x42')]({'where':{'name':_0x45bf7f,'userProfileId':_0x8d6dd1[_0x0a9e('0x48')]},'raw':!![]})[_0x0a9e('0x1f')](function(_0x409789){if(_0x409789&&_0x409789[_0x0a9e('0x49')]===0x0){return db[_0x0a9e('0x21')][_0x0a9e('0x43')]({'name':_0x45c845[_0x0a9e('0x24')],'resourceId':_0x45c845['id'],'type':'CustomReports','sectionId':_0x409789['id']},{})[_0x0a9e('0x1f')](function(){return _0x476688;});}else{return _0x476688;}})[_0x0a9e('0x3e')](function(_0x4f7240){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7240);throw _0x4f7240;});}return _0x476688;})[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x3e')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x11545a,_0x61bb17){if(_0x11545a[_0x0a9e('0x4b')]['id']){delete _0x11545a[_0x0a9e('0x4b')]['id'];}return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x11545a['params']['id']}})['then'](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x1f')](saveUpdates(_0x11545a[_0x0a9e('0x4b')],null))[_0x0a9e('0x1f')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};exports[_0x0a9e('0x22')]=function(_0x161aa7,_0x53d113){return db['AnalyticCustomReport'][_0x0a9e('0x42')]({'where':{'id':_0x161aa7['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x53d113,null))['then'](removeEntity(_0x53d113,null))[_0x0a9e('0x3e')](handleError(_0x53d113,null));};exports[_0x0a9e('0x4c')]=function(_0x439340,_0x53613a){var _0x2f82da=0xa;var _0x1bf38a=['join','left_join',_0x0a9e('0x4d'),_0x0a9e('0x4e')];var _0x49c095={'SUM':_0x0a9e('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0a9e('0x50'),'MAX':'MAX(%s)','MIN':_0x0a9e('0x51'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0a9e('0x52')};var _0x47de4c={'SEC_TO_TIME':_0x0a9e('0x53'),'DATE':_0x0a9e('0x54'),'HOUR':_0x0a9e('0x55'),'ROUND':_0x0a9e('0x56'),'UNIX_TIMESTAMP':_0x0a9e('0x57')};var _0x272738=function(_0xd10662){return!_[_0x0a9e('0x58')](['IS\x20NULL',_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')],_0xd10662);};var _0x30c491=function(_0xb83dfd){if(!_0xb83dfd||!_0xb83dfd[_0x0a9e('0x5c')]['length']){return'';}for(var _0x956fbe='(',_0x26bc80=0x0;_0x26bc80<_0xb83dfd['rules'][_0x0a9e('0x2f')];_0x26bc80+=0x1){_0x26bc80>0x0&&(_0x956fbe+='\x20'+_0xb83dfd['operator']+'\x20');_0x956fbe+=_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80]['group']?_0x30c491(_0xb83dfd['rules'][_0x26bc80]['group']):_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80]['field']+'\x20'+_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80][_0x0a9e('0x5d')]+(_0x272738(_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80][_0x0a9e('0x5d')])?'\x20'+_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80][_0x0a9e('0x5e')]:'');}return _0x956fbe+')';};var _0x49eed0={'where':{'id':_0x439340['params']['id']}},_0x1627a7,_0x5854cc,_0xca4ade,_0x1f07cb,_0x51aaf7;_0x49eed0=_[_0x0a9e('0x41')]({},_0x49eed0,_0x439340[_0x0a9e('0x39')]);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x49eed0)['then'](function(_0x1d0dc8){if(_0x1d0dc8){_0x1627a7=_0x1d0dc8;return _0x1d0dc8[_0x0a9e('0x5f')]();}return null;})['then'](function(_0x797b45){if(_0x797b45){if(!_0x797b45[_0x0a9e('0x2f')]){throw new db[(_0x0a9e('0x60'))][(_0x0a9e('0x61'))](_0x0a9e('0x62'),0x193);}_0x5854cc=_0x797b45;return db['AnalyticMetric'][_0x0a9e('0x63')]({'raw':!![]});}return null;})[_0x0a9e('0x1f')](function(_0x281c7d){if(_0x281c7d){_0xca4ade=_['keyBy'](_0x281c7d,'id');var _0x3528b7;var _0x4f1e60=squel['select']();_0x4f1e60[_0x0a9e('0x64')](_0x1627a7[_0x0a9e('0x65')]);for(var _0x9375fb=0x0;_0x9375fb<_0x5854cc[_0x0a9e('0x2f')];_0x9375fb+=0x1){_0x3528b7=_0x5854cc[_0x9375fb][_0x0a9e('0x66')]?_0xca4ade[_0x5854cc[_0x9375fb][_0x0a9e('0x66')]][_0x0a9e('0x67')]:_0x5854cc[_0x9375fb][_0x0a9e('0x38')];_0x3528b7=_0x5854cc[_0x9375fb][_0x0a9e('0x68')]?_[_0x0a9e('0x69')](_0x49c095[_0x5854cc[_0x9375fb][_0x0a9e('0x68')]],'%s',_0x3528b7):_0x3528b7;_0x3528b7=_0x5854cc[_0x9375fb][_0x0a9e('0x6a')]?_[_0x0a9e('0x69')](_0x47de4c[_0x5854cc[_0x9375fb][_0x0a9e('0x6a')]],'%s',_0x3528b7):_0x3528b7;if(_0x5854cc[_0x9375fb][_0x0a9e('0x6b')]){_0x4f1e60[_0x0a9e('0x6c')](_0x3528b7);}_0x5854cc[_0x9375fb][_0x0a9e('0x6d')]&&_0x4f1e60[_0x0a9e('0x31')](_0x3528b7,_0x5854cc[_0x9375fb]['orderBy']===_0x0a9e('0x6e')?![]:!![]);_0x4f1e60[_0x0a9e('0x38')](_0x3528b7,_0x5854cc[_0x9375fb][_0x0a9e('0x6f')]||_0x3528b7);}if(_0x1627a7['joins']){_0x1627a7[_0x0a9e('0x70')]=JSON[_0x0a9e('0x71')](_0x1627a7['joins']);for(var _0x83f0b2=0x0;_0x83f0b2<_0x1627a7[_0x0a9e('0x70')][_0x0a9e('0x2f')];_0x83f0b2+=0x1){if(_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x35')]&&_['includes'](_0x1bf38a,_0x1627a7['joins'][_0x83f0b2]['type'])&&_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x72')]&&_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x73')]&&_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x74')]){_0x4f1e60[_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x35')]](_0x1627a7['joins'][_0x83f0b2][_0x0a9e('0x73')],null,util[_0x0a9e('0x6a')](_0x0a9e('0x75'),_0x1627a7['table'],_0x1627a7[_0x0a9e('0x70')][_0x83f0b2]['parentKey'],_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x73')],_0x1627a7['joins'][_0x83f0b2][_0x0a9e('0x74')]));}}}if(_0x1627a7[_0x0a9e('0x76')]){_0x1627a7[_0x0a9e('0x76')]=JSON[_0x0a9e('0x71')](_0x1627a7['conditions']);_0x4f1e60[_0x0a9e('0x33')](_0x30c491(_0x1627a7[_0x0a9e('0x76')][_0x0a9e('0x6c')]));}_0x51aaf7=_0x4f1e60[_0x0a9e('0x77')]();_0x4f1e60['limit'](_0x2f82da);_0x4f1e60[_0x0a9e('0x18')](0x0);logger[_0x0a9e('0x78')](_0x0a9e('0x79'),_0x4f1e60[_0x0a9e('0x7a')]());return db['sequelize'][_0x0a9e('0x2a')](_0x4f1e60[_0x0a9e('0x7a')](),{'type':db[_0x0a9e('0x7b')][_0x0a9e('0x7c')][_0x0a9e('0x7d')]});}})[_0x0a9e('0x1f')](respondWithResult(_0x53613a,null))[_0x0a9e('0x3e')](handleError(_0x53613a,null));};function runReport(_0x3df0e3,_0x1a7b03,_0x336dc3){var _0xc4c230=_0x1a7b03[_0x0a9e('0x24')];var _0x25744a=0xa;var _0xe0749e=['join',_0x0a9e('0x7e'),_0x0a9e('0x4d'),_0x0a9e('0x4e')];var _0x563627={'SUM':_0x0a9e('0x4f'),'COUNT':_0x0a9e('0x7f'),'COUNT DISTINCT':_0x0a9e('0x50'),'MAX':_0x0a9e('0x80'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x0a9e('0x81'),'GROUP_CONCAT ASC':_0x0a9e('0x82'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x45108c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a9e('0x54'),'HOUR':_0x0a9e('0x55'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a9e('0x57')};var _0x41cf12=function(_0x2d2286){return!_[_0x0a9e('0x58')]([_0x0a9e('0x83'),_0x0a9e('0x59'),_0x0a9e('0x5a'),'IS\x20NOT\x20EMPTY'],_0x2d2286);};var _0x2973d3=function(_0x3ca9b9){if(!_0x3ca9b9||!_0x3ca9b9[_0x0a9e('0x5c')][_0x0a9e('0x2f')]){return'';}for(var _0x492543='(',_0xf51744=0x0;_0xf51744<_0x3ca9b9[_0x0a9e('0x5c')]['length'];_0xf51744+=0x1){_0xf51744>0x0&&(_0x492543+='\x20'+_0x3ca9b9[_0x0a9e('0x84')]+'\x20');_0x492543+=_0x3ca9b9['rules'][_0xf51744][_0x0a9e('0x6c')]?_0x2973d3(_0x3ca9b9[_0x0a9e('0x5c')][_0xf51744][_0x0a9e('0x6c')]):_0x3ca9b9[_0x0a9e('0x5c')][_0xf51744]['field']+'\x20'+_0x3ca9b9['rules'][_0xf51744][_0x0a9e('0x5d')]+(_0x41cf12(_0x3ca9b9[_0x0a9e('0x5c')][_0xf51744][_0x0a9e('0x5d')])?'\x20'+_0x3ca9b9['rules'][_0xf51744][_0x0a9e('0x5e')]:'');}return _0x492543+')';};var _0x36e975={'where':{'id':_0x3df0e3['id']}},_0x524e38,_0x4e46b2,_0xf0a802,_0x56acca,_0x5ea541;_0x36e975=_['merge']({},_0x36e975,_0x336dc3);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x36e975)[_0x0a9e('0x1f')](function(_0x3bfadf){if(_0x3bfadf){_0x524e38=_0x3bfadf;return _0x3bfadf[_0x0a9e('0x5f')]();}return null;})[_0x0a9e('0x1f')](function(_0x5a8854){if(_0x5a8854){if(!_0x5a8854[_0x0a9e('0x2f')]){throw new db['Sequelize'][(_0x0a9e('0x61'))](_0x0a9e('0x62'),0x193);}_0x4e46b2=_0x5a8854;return db[_0x0a9e('0x85')][_0x0a9e('0x63')]({'raw':!![]});}return null;})['then'](function(_0x46c9ac){if(_0x46c9ac){_0xf0a802=_[_0x0a9e('0x86')](_0x46c9ac,'id');var _0x1d4877;var _0x5b74c3=squel[_0x0a9e('0x87')]();_0x5b74c3[_0x0a9e('0x64')](_0x524e38[_0x0a9e('0x65')]);for(var _0x22063c=0x0;_0x22063c<_0x4e46b2[_0x0a9e('0x2f')];_0x22063c+=0x1){_0x1d4877=_0x4e46b2[_0x22063c][_0x0a9e('0x66')]?_0xf0a802[_0x4e46b2[_0x22063c][_0x0a9e('0x66')]][_0x0a9e('0x67')]:_0x4e46b2[_0x22063c]['field'];_0x1d4877=_0x4e46b2[_0x22063c][_0x0a9e('0x68')]?_[_0x0a9e('0x69')](_0x563627[_0x4e46b2[_0x22063c]['function']],'%s',_0x1d4877):_0x1d4877;_0x1d4877=_0x4e46b2[_0x22063c][_0x0a9e('0x6a')]?_[_0x0a9e('0x69')](_0x45108c[_0x4e46b2[_0x22063c][_0x0a9e('0x6a')]],'%s',_0x1d4877):_0x1d4877;if(_0x4e46b2[_0x22063c]['groupBy']){_0x5b74c3[_0x0a9e('0x6c')](_0x1d4877);}_0x4e46b2[_0x22063c]['orderBy']&&_0x5b74c3[_0x0a9e('0x31')](_0x1d4877,_0x4e46b2[_0x22063c][_0x0a9e('0x6d')]===_0x0a9e('0x6e')?![]:!![]);_0x5b74c3[_0x0a9e('0x38')](_0x1d4877,_0x4e46b2[_0x22063c][_0x0a9e('0x6f')]||_0x1d4877);}if(_0x524e38[_0x0a9e('0x70')]){_0x524e38[_0x0a9e('0x70')]=JSON[_0x0a9e('0x71')](_0x524e38['joins']);for(var _0x329d88=0x0;_0x329d88<_0x524e38[_0x0a9e('0x70')][_0x0a9e('0x2f')];_0x329d88+=0x1){if(_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x35')]&&_[_0x0a9e('0x58')](_0xe0749e,_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x35')])&&_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x72')]&&_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x73')]&&_0x524e38[_0x0a9e('0x70')][_0x329d88]['foreignKey']){_0x5b74c3[_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x35')]](_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x73')],null,util[_0x0a9e('0x6a')]('%s.%s\x20=\x20%s.%s',_0x524e38[_0x0a9e('0x65')],_0x524e38[_0x0a9e('0x70')][_0x329d88]['parentKey'],_0x524e38[_0x0a9e('0x70')][_0x329d88]['foreignTable'],_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x74')]));}}}if(_0x524e38[_0x0a9e('0x76')]){_0x524e38[_0x0a9e('0x76')]=JSON['parse'](_0x524e38[_0x0a9e('0x76')]);_0x5b74c3['where'](_0x2973d3(_0x524e38[_0x0a9e('0x76')][_0x0a9e('0x6c')]));}_0x5ea541=_0x5b74c3['clone']();_0x5b74c3[_0x0a9e('0x19')](_0x25744a);_0x5b74c3[_0x0a9e('0x18')](0x0);logger[_0x0a9e('0x78')]('Limited\x20Query:',_0x5b74c3['toString']());return db[_0x0a9e('0x7b')][_0x0a9e('0x2a')](_0x5b74c3[_0x0a9e('0x7a')](),{'type':db[_0x0a9e('0x7b')][_0x0a9e('0x7c')][_0x0a9e('0x7d')]});}})[_0x0a9e('0x1f')](function(_0x3c75b9){if(!_0x3c75b9[_0x0a9e('0x2f')]){throw new db['Sequelize'][(_0x0a9e('0x61'))]('No\x20available\x20data',0xcc);}if(_0x1a7b03[_0x0a9e('0x88')]===_0x0a9e('0x89')){return null;}var _0x34e745=_[_0x0a9e('0x41')](_0x1a7b03,{'name':_0x1a7b03[_0x0a9e('0x8a')]||_0x1a7b03['name']||_0x524e38[_0x0a9e('0x24')],'basename':_0xc4c230,'savename':util[_0x0a9e('0x6a')](_0x0a9e('0x8b'),_0x1a7b03[_0x0a9e('0x24')]||_0x524e38[_0x0a9e('0x24')],require('randomstring')['generate'](0x4),_0x1a7b03[_0x0a9e('0x88')]||'csv'),'reportId':_0x524e38['id'],'reportType':_0x0a9e('0x8c')});return db[_0x0a9e('0x8d')][_0x0a9e('0x43')](_0x34e745,{'raw':!![]});})[_0x0a9e('0x1f')](function(_0x2ad54b){if(_0x524e38[_0x0a9e('0x65')]==='cdr'){_0x5ea541['where'](_0x524e38[_0x0a9e('0x65')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1a7b03[_0x0a9e('0x8e')],_0x1a7b03['endDate']);}else{_0x5ea541[_0x0a9e('0x33')](_0x524e38['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a7b03[_0x0a9e('0x8e')],_0x1a7b03[_0x0a9e('0x8f')]);}if(_0x2ad54b){logger['info'](_0x0a9e('0x90'),_0x5ea541[_0x0a9e('0x7a')]());require(_0x0a9e('0x91'))[_0x0a9e('0x92')](path[_0x0a9e('0x93')](__dirname,'../../components/export/',_0x2ad54b['output']),[_0x2ad54b['id'],_0x5ea541[_0x0a9e('0x7a')](),path[_0x0a9e('0x93')](__dirname,_0x0a9e('0x94'),_0x2ad54b[_0x0a9e('0x95')]),_0xc4c230]);return _0x2ad54b;}else{var _0x59303b=squel['select']();_0x59303b[_0x0a9e('0x64')]('('+_0x5ea541[_0x0a9e('0x7a')]()+')','countTable');_0x59303b[_0x0a9e('0x38')](_0x0a9e('0x96'),_0x0a9e('0x17'));_0x5ea541[_0x0a9e('0x19')](_0x1a7b03[_0x0a9e('0x19')]||_0x25744a);_0x5ea541[_0x0a9e('0x18')](_0x1a7b03[_0x0a9e('0x18')]||0x0);return db[_0x0a9e('0x7b')][_0x0a9e('0x2a')](_0x59303b[_0x0a9e('0x7a')](),{'type':db['sequelize'][_0x0a9e('0x7c')][_0x0a9e('0x7d')]})[_0x0a9e('0x1f')](function(_0x1c4232){if(!_0x1c4232[_0x0a9e('0x2f')]){_0x56acca=0x0;}else{_0x56acca=_0x1c4232[0x0]['count']||0x0;}return db['sequelize'][_0x0a9e('0x2a')](_0x5ea541[_0x0a9e('0x7a')](),{'type':db[_0x0a9e('0x7b')][_0x0a9e('0x7c')][_0x0a9e('0x7d')]});})['then'](function(_0x1339d0){return{'rows':_0x1339d0||[],'count':_0x56acca};});}});}exports[_0x0a9e('0x97')]=function(_0x3450ae,_0x52b661){return runReport(_0x3450ae[_0x0a9e('0x40')],_0x3450ae['query'],_0x3450ae[_0x0a9e('0x39')])['then'](respondWithResult(_0x52b661,null))[_0x0a9e('0x3e')](handleError(_0x52b661,null));};exports[_0x0a9e('0x98')]=runReport;exports[_0x0a9e('0x2a')]=function(_0x5c500c,_0xc9529d){var _0x5ed560=0xa;var _0x4383da=[_0x0a9e('0x93'),_0x0a9e('0x7e'),_0x0a9e('0x4d'),_0x0a9e('0x4e')];var _0x1bee04={'SUM':_0x0a9e('0x4f'),'COUNT':_0x0a9e('0x7f'),'COUNT DISTINCT':_0x0a9e('0x50'),'MAX':_0x0a9e('0x80'),'MIN':_0x0a9e('0x51'),'AVG':_0x0a9e('0x99'),'GROUP_CONCAT':_0x0a9e('0x81'),'GROUP_CONCAT ASC':_0x0a9e('0x82'),'GROUP_CONCAT DESC':_0x0a9e('0x52')};var _0x248368={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x0a9e('0x55'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a9e('0x57')};var _0x3428c9=function(_0x5d6b69){return!_[_0x0a9e('0x58')]([_0x0a9e('0x83'),_0x0a9e('0x59'),_0x0a9e('0x5a'),'IS\x20NOT\x20EMPTY'],_0x5d6b69);};var _0x148fd9=function(_0x26cb76){if(!_0x26cb76||!_0x26cb76[_0x0a9e('0x5c')][_0x0a9e('0x2f')]){return'';}for(var _0x5d0e1f='(',_0x19e9ed=0x0;_0x19e9ed<_0x26cb76[_0x0a9e('0x5c')][_0x0a9e('0x2f')];_0x19e9ed+=0x1){_0x19e9ed>0x0&&(_0x5d0e1f+='\x20'+_0x26cb76['operator']+'\x20');_0x5d0e1f+=_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed][_0x0a9e('0x6c')]?_0x148fd9(_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed]['group']):_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed][_0x0a9e('0x38')]+'\x20'+_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed][_0x0a9e('0x5d')]+(_0x3428c9(_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed]['condition'])?'\x20'+_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed][_0x0a9e('0x5e')]:'');}return _0x5d0e1f+')';};var _0x4795ae={'where':{'id':_0x5c500c['params']['id']}},_0x3bab3e,_0x1fcfe6,_0x1f6f1c,_0x5822a7,_0x5c3b6f;_0x4795ae=_[_0x0a9e('0x41')]({},_0x4795ae,_0x5c500c[_0x0a9e('0x39')]);return db['AnalyticCustomReport'][_0x0a9e('0x42')](_0x4795ae)[_0x0a9e('0x1f')](function(_0x2a8d55){if(_0x2a8d55){_0x3bab3e=_0x2a8d55;return _0x2a8d55['getFields']();}return null;})[_0x0a9e('0x1f')](function(_0x30e037){if(_0x30e037){if(!_0x30e037[_0x0a9e('0x2f')]){throw new db[(_0x0a9e('0x60'))][(_0x0a9e('0x61'))](_0x0a9e('0x62'),0x193);}_0x1fcfe6=_0x30e037;return db[_0x0a9e('0x85')][_0x0a9e('0x63')]({'raw':!![]});}return null;})[_0x0a9e('0x1f')](function(_0x5a1848){if(_0x5a1848){_0x1f6f1c=_[_0x0a9e('0x86')](_0x5a1848,'id');var _0x5526a7;var _0x138cf5=squel[_0x0a9e('0x87')]();_0x138cf5[_0x0a9e('0x64')](_0x3bab3e[_0x0a9e('0x65')]);for(var _0x407e9d=0x0;_0x407e9d<_0x1fcfe6[_0x0a9e('0x2f')];_0x407e9d+=0x1){_0x5526a7=_0x1fcfe6[_0x407e9d]['MetricId']?_0x1f6f1c[_0x1fcfe6[_0x407e9d][_0x0a9e('0x66')]][_0x0a9e('0x67')]:_0x1fcfe6[_0x407e9d][_0x0a9e('0x38')];_0x5526a7=_0x1fcfe6[_0x407e9d][_0x0a9e('0x68')]?_['replace'](_0x1bee04[_0x1fcfe6[_0x407e9d][_0x0a9e('0x68')]],'%s',_0x5526a7):_0x5526a7;_0x5526a7=_0x1fcfe6[_0x407e9d][_0x0a9e('0x6a')]?_[_0x0a9e('0x69')](_0x248368[_0x1fcfe6[_0x407e9d][_0x0a9e('0x6a')]],'%s',_0x5526a7):_0x5526a7;if(_0x1fcfe6[_0x407e9d][_0x0a9e('0x6b')]){_0x138cf5[_0x0a9e('0x6c')](_0x5526a7);}_0x1fcfe6[_0x407e9d][_0x0a9e('0x6d')]&&_0x138cf5[_0x0a9e('0x31')](_0x5526a7,_0x1fcfe6[_0x407e9d][_0x0a9e('0x6d')]===_0x0a9e('0x6e')?![]:!![]);_0x138cf5['field'](_0x5526a7,_0x1fcfe6[_0x407e9d][_0x0a9e('0x6f')]||_0x5526a7);}if(_0x3bab3e[_0x0a9e('0x70')]){_0x3bab3e[_0x0a9e('0x70')]=JSON[_0x0a9e('0x71')](_0x3bab3e[_0x0a9e('0x70')]);for(var _0x253f74=0x0;_0x253f74<_0x3bab3e[_0x0a9e('0x70')][_0x0a9e('0x2f')];_0x253f74+=0x1){if(_0x3bab3e['joins'][_0x253f74][_0x0a9e('0x35')]&&_[_0x0a9e('0x58')](_0x4383da,_0x3bab3e[_0x0a9e('0x70')][_0x253f74]['type'])&&_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x72')]&&_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x73')]&&_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x74')]){_0x138cf5[_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x35')]](_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x73')],null,util['format'](_0x0a9e('0x75'),_0x3bab3e[_0x0a9e('0x65')],_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x72')],_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x73')],_0x3bab3e['joins'][_0x253f74][_0x0a9e('0x74')]));}}}if(_0x3bab3e['conditions']){_0x3bab3e['conditions']=JSON['parse'](_0x3bab3e[_0x0a9e('0x76')]);_0x138cf5[_0x0a9e('0x33')](_0x148fd9(_0x3bab3e[_0x0a9e('0x76')][_0x0a9e('0x6c')]));}_0x5c3b6f=_0x138cf5['clone']();_0x138cf5[_0x0a9e('0x19')](_0x5ed560);_0x138cf5[_0x0a9e('0x18')](0x0);logger[_0x0a9e('0x78')](_0x0a9e('0x79'),_0x138cf5[_0x0a9e('0x7a')]());return db['sequelize']['query'](_0x138cf5[_0x0a9e('0x7a')](),{'type':db[_0x0a9e('0x7b')][_0x0a9e('0x7c')]['SELECT']});}})[_0x0a9e('0x1f')](function(){return{'sql':_0x5c3b6f[_0x0a9e('0x7a')]()};})[_0x0a9e('0x1f')](respondWithResult(_0xc9529d,null))['catch'](handleError(_0xc9529d,null));}; \ No newline at end of file +var _0xa9e0=['../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','key','VIRTUAL','field','options','includeAll','include','AnalyticCustomReport','rows','catch','show','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','preview','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','from','table','MetricId','metric','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','operator','AnalyticMetric','keyBy','select','output','web','fullPath','%s-%s.%s','custom','AnalyticExtractedReport','startDate','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','COUNT(*)','run','runReport','AVG(%s)','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){var _0x432e56=_0x5a09ef[_0x0a9e('0x20')]({'plain':!![]});var _0x30bae6='CustomReports';return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'type':_0x30bae6,'resourceId':_0x432e56['id']}})[_0x0a9e('0x1f')](function(){return _0x5a09ef;});})[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x13')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x23')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x24')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x25')](_0x33161b);};}exports[_0x0a9e('0x26')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=db['AnalyticCustomReport'][_0x0a9e('0x27')];_0x1538a4[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](_0x14de77);_0x1538a4[_0x0a9e('0x2a')]=_['keys'](_0x25fba9[_0x0a9e('0x2a')]);_0x1538a4[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],_0x1538a4[_0x0a9e('0x2a')]);_0x140511[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],qs[_0x0a9e('0x2e')](_0x25fba9['query'][_0x0a9e('0x2e')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x140511[_0x0a9e('0x2d')]:_0x1538a4[_0x0a9e('0x28')];if(!_0x25fba9[_0x0a9e('0x2a')]['hasOwnProperty'](_0x0a9e('0x30'))){_0x140511[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x19')]);_0x140511[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x25fba9[_0x0a9e('0x2a')]['offset']);}_0x140511[_0x0a9e('0x31')]=qs['sort'](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x140511[_0x0a9e('0x33')]=qs[_0x0a9e('0x2b')](_['pick'](_0x25fba9[_0x0a9e('0x2a')],_0x1538a4[_0x0a9e('0x2b')]));if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]){_0x140511['where']=_['merge'](_0x140511[_0x0a9e('0x33')],{'$or':_['map'](_0x14de77,function(_0x24936a){if(_0x24936a[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4f41ae={};_0x4f41ae[_0x24936a[_0x0a9e('0x38')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]+'%'};return _0x4f41ae;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x39')]);var _0x1a180b={'where':_0x140511[_0x0a9e('0x33')]};return db['AnalyticCustomReport']['count'](_0x1a180b)[_0x0a9e('0x1f')](function(_0x40d766){_0x11c3b6['count']=_0x40d766;if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x140511[_0x0a9e('0x3b')]=[{'all':!![]}];}return db[_0x0a9e('0x3c')]['findAll'](_0x140511);})['then'](function(_0x15e37d){_0x11c3b6[_0x0a9e('0x3d')]=_0x15e37d;return _0x11c3b6;})['then'](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x3e')](handleError(_0x14433c,null));};exports[_0x0a9e('0x3f')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':![],'where':{'id':_0x1459bb[_0x0a9e('0x40')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](db[_0x0a9e('0x3c')][_0x0a9e('0x27')]);_0x2cfea9[_0x0a9e('0x2a')]=_[_0x0a9e('0x29')](_0x1459bb[_0x0a9e('0x2a')]);_0x2cfea9[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x2cfea9[_0x0a9e('0x28')],_0x2cfea9[_0x0a9e('0x2a')]);_0x316c8f[_0x0a9e('0x2d')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x2e')](_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x316c8f[_0x0a9e('0x2d')]=_0x316c8f[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x316c8f[_0x0a9e('0x2d')]:_0x2cfea9[_0x0a9e('0x28')];if(_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x316c8f[_0x0a9e('0x3b')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x41')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x316c8f)[_0x0a9e('0x1f')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x1f')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x3e')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x43')]=function(_0x21eb86,_0x44dd99){return db['AnalyticCustomReport'][_0x0a9e('0x43')](_0x21eb86['body'],{})[_0x0a9e('0x1f')](function(_0x476688){var _0x8d6dd1=_0x21eb86['user'][_0x0a9e('0x20')]({'plain':!![]});if(!_0x8d6dd1)throw new Error(_0x0a9e('0x44'));if(_0x8d6dd1[_0x0a9e('0x45')]===_0x0a9e('0x46')){var _0x45c845=_0x476688[_0x0a9e('0x20')]({'plain':!![]});var _0x45bf7f='Reports';return db[_0x0a9e('0x47')][_0x0a9e('0x42')]({'where':{'name':_0x45bf7f,'userProfileId':_0x8d6dd1[_0x0a9e('0x48')]},'raw':!![]})[_0x0a9e('0x1f')](function(_0x409789){if(_0x409789&&_0x409789[_0x0a9e('0x49')]===0x0){return db[_0x0a9e('0x21')][_0x0a9e('0x43')]({'name':_0x45c845[_0x0a9e('0x24')],'resourceId':_0x45c845['id'],'type':'CustomReports','sectionId':_0x409789['id']},{})[_0x0a9e('0x1f')](function(){return _0x476688;});}else{return _0x476688;}})[_0x0a9e('0x3e')](function(_0x4f7240){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7240);throw _0x4f7240;});}return _0x476688;})[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x3e')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x11545a,_0x61bb17){if(_0x11545a[_0x0a9e('0x4b')]['id']){delete _0x11545a[_0x0a9e('0x4b')]['id'];}return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x11545a['params']['id']}})['then'](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x1f')](saveUpdates(_0x11545a[_0x0a9e('0x4b')],null))[_0x0a9e('0x1f')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};exports[_0x0a9e('0x22')]=function(_0x161aa7,_0x53d113){return db['AnalyticCustomReport'][_0x0a9e('0x42')]({'where':{'id':_0x161aa7['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x53d113,null))['then'](removeEntity(_0x53d113,null))[_0x0a9e('0x3e')](handleError(_0x53d113,null));};exports[_0x0a9e('0x4c')]=function(_0x439340,_0x53613a){var _0x2f82da=0xa;var _0x1bf38a=['join','left_join',_0x0a9e('0x4d'),_0x0a9e('0x4e')];var _0x49c095={'SUM':_0x0a9e('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0a9e('0x50'),'MAX':'MAX(%s)','MIN':_0x0a9e('0x51'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0a9e('0x52')};var _0x47de4c={'SEC_TO_TIME':_0x0a9e('0x53'),'DATE':_0x0a9e('0x54'),'HOUR':_0x0a9e('0x55'),'ROUND':_0x0a9e('0x56'),'UNIX_TIMESTAMP':_0x0a9e('0x57')};var _0x272738=function(_0xd10662){return!_[_0x0a9e('0x58')](['IS\x20NULL',_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')],_0xd10662);};var _0x30c491=function(_0xb83dfd){if(!_0xb83dfd||!_0xb83dfd[_0x0a9e('0x5c')]['length']){return'';}for(var _0x956fbe='(',_0x26bc80=0x0;_0x26bc80<_0xb83dfd['rules'][_0x0a9e('0x2f')];_0x26bc80+=0x1){_0x26bc80>0x0&&(_0x956fbe+='\x20'+_0xb83dfd['operator']+'\x20');_0x956fbe+=_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80]['group']?_0x30c491(_0xb83dfd['rules'][_0x26bc80]['group']):_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80]['field']+'\x20'+_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80][_0x0a9e('0x5d')]+(_0x272738(_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80][_0x0a9e('0x5d')])?'\x20'+_0xb83dfd[_0x0a9e('0x5c')][_0x26bc80][_0x0a9e('0x5e')]:'');}return _0x956fbe+')';};var _0x49eed0={'where':{'id':_0x439340['params']['id']}},_0x1627a7,_0x5854cc,_0xca4ade,_0x1f07cb,_0x51aaf7;_0x49eed0=_[_0x0a9e('0x41')]({},_0x49eed0,_0x439340[_0x0a9e('0x39')]);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x49eed0)['then'](function(_0x1d0dc8){if(_0x1d0dc8){_0x1627a7=_0x1d0dc8;return _0x1d0dc8[_0x0a9e('0x5f')]();}return null;})['then'](function(_0x797b45){if(_0x797b45){if(!_0x797b45[_0x0a9e('0x2f')]){throw new db[(_0x0a9e('0x60'))][(_0x0a9e('0x61'))](_0x0a9e('0x62'),0x193);}_0x5854cc=_0x797b45;return db['AnalyticMetric'][_0x0a9e('0x63')]({'raw':!![]});}return null;})[_0x0a9e('0x1f')](function(_0x281c7d){if(_0x281c7d){_0xca4ade=_['keyBy'](_0x281c7d,'id');var _0x3528b7;var _0x4f1e60=squel['select']();_0x4f1e60[_0x0a9e('0x64')](_0x1627a7[_0x0a9e('0x65')]);for(var _0x9375fb=0x0;_0x9375fb<_0x5854cc[_0x0a9e('0x2f')];_0x9375fb+=0x1){_0x3528b7=_0x5854cc[_0x9375fb][_0x0a9e('0x66')]?_0xca4ade[_0x5854cc[_0x9375fb][_0x0a9e('0x66')]][_0x0a9e('0x67')]:_0x5854cc[_0x9375fb][_0x0a9e('0x38')];_0x3528b7=_0x5854cc[_0x9375fb][_0x0a9e('0x68')]?_[_0x0a9e('0x69')](_0x49c095[_0x5854cc[_0x9375fb][_0x0a9e('0x68')]],'%s',_0x3528b7):_0x3528b7;_0x3528b7=_0x5854cc[_0x9375fb][_0x0a9e('0x6a')]?_[_0x0a9e('0x69')](_0x47de4c[_0x5854cc[_0x9375fb][_0x0a9e('0x6a')]],'%s',_0x3528b7):_0x3528b7;if(_0x5854cc[_0x9375fb][_0x0a9e('0x6b')]){_0x4f1e60[_0x0a9e('0x6c')](_0x3528b7);}_0x5854cc[_0x9375fb][_0x0a9e('0x6d')]&&_0x4f1e60[_0x0a9e('0x31')](_0x3528b7,_0x5854cc[_0x9375fb]['orderBy']===_0x0a9e('0x6e')?![]:!![]);_0x4f1e60[_0x0a9e('0x38')](_0x3528b7,_0x5854cc[_0x9375fb][_0x0a9e('0x6f')]||_0x3528b7);}if(_0x1627a7['joins']){_0x1627a7[_0x0a9e('0x70')]=JSON[_0x0a9e('0x71')](_0x1627a7['joins']);for(var _0x83f0b2=0x0;_0x83f0b2<_0x1627a7[_0x0a9e('0x70')][_0x0a9e('0x2f')];_0x83f0b2+=0x1){if(_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x35')]&&_['includes'](_0x1bf38a,_0x1627a7['joins'][_0x83f0b2]['type'])&&_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x72')]&&_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x73')]&&_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x74')]){_0x4f1e60[_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x35')]](_0x1627a7['joins'][_0x83f0b2][_0x0a9e('0x73')],null,util[_0x0a9e('0x6a')](_0x0a9e('0x75'),_0x1627a7['table'],_0x1627a7[_0x0a9e('0x70')][_0x83f0b2]['parentKey'],_0x1627a7[_0x0a9e('0x70')][_0x83f0b2][_0x0a9e('0x73')],_0x1627a7['joins'][_0x83f0b2][_0x0a9e('0x74')]));}}}if(_0x1627a7[_0x0a9e('0x76')]){_0x1627a7[_0x0a9e('0x76')]=JSON[_0x0a9e('0x71')](_0x1627a7['conditions']);_0x4f1e60[_0x0a9e('0x33')](_0x30c491(_0x1627a7[_0x0a9e('0x76')][_0x0a9e('0x6c')]));}_0x51aaf7=_0x4f1e60[_0x0a9e('0x77')]();_0x4f1e60['limit'](_0x2f82da);_0x4f1e60[_0x0a9e('0x18')](0x0);logger[_0x0a9e('0x78')](_0x0a9e('0x79'),_0x4f1e60[_0x0a9e('0x7a')]());return db['sequelize'][_0x0a9e('0x2a')](_0x4f1e60[_0x0a9e('0x7a')](),{'type':db[_0x0a9e('0x7b')][_0x0a9e('0x7c')][_0x0a9e('0x7d')]});}})[_0x0a9e('0x1f')](respondWithResult(_0x53613a,null))[_0x0a9e('0x3e')](handleError(_0x53613a,null));};function runReport(_0x3df0e3,_0x1a7b03,_0x336dc3){var _0xc4c230=_0x1a7b03[_0x0a9e('0x24')];var _0x25744a=0xa;var _0xe0749e=['join',_0x0a9e('0x7e'),_0x0a9e('0x4d'),_0x0a9e('0x4e')];var _0x563627={'SUM':_0x0a9e('0x4f'),'COUNT':_0x0a9e('0x7f'),'COUNT DISTINCT':_0x0a9e('0x50'),'MAX':_0x0a9e('0x80'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x0a9e('0x81'),'GROUP_CONCAT ASC':_0x0a9e('0x82'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x45108c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a9e('0x54'),'HOUR':_0x0a9e('0x55'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a9e('0x57')};var _0x41cf12=function(_0x2d2286){return!_[_0x0a9e('0x58')]([_0x0a9e('0x83'),_0x0a9e('0x59'),_0x0a9e('0x5a'),'IS\x20NOT\x20EMPTY'],_0x2d2286);};var _0x2973d3=function(_0x3ca9b9){if(!_0x3ca9b9||!_0x3ca9b9[_0x0a9e('0x5c')][_0x0a9e('0x2f')]){return'';}for(var _0x492543='(',_0xf51744=0x0;_0xf51744<_0x3ca9b9[_0x0a9e('0x5c')]['length'];_0xf51744+=0x1){_0xf51744>0x0&&(_0x492543+='\x20'+_0x3ca9b9[_0x0a9e('0x84')]+'\x20');_0x492543+=_0x3ca9b9['rules'][_0xf51744][_0x0a9e('0x6c')]?_0x2973d3(_0x3ca9b9[_0x0a9e('0x5c')][_0xf51744][_0x0a9e('0x6c')]):_0x3ca9b9[_0x0a9e('0x5c')][_0xf51744]['field']+'\x20'+_0x3ca9b9['rules'][_0xf51744][_0x0a9e('0x5d')]+(_0x41cf12(_0x3ca9b9[_0x0a9e('0x5c')][_0xf51744][_0x0a9e('0x5d')])?'\x20'+_0x3ca9b9['rules'][_0xf51744][_0x0a9e('0x5e')]:'');}return _0x492543+')';};var _0x36e975={'where':{'id':_0x3df0e3['id']}},_0x524e38,_0x4e46b2,_0xf0a802,_0x56acca,_0x5ea541;_0x36e975=_['merge']({},_0x36e975,_0x336dc3);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x36e975)[_0x0a9e('0x1f')](function(_0x3bfadf){if(_0x3bfadf){_0x524e38=_0x3bfadf;return _0x3bfadf[_0x0a9e('0x5f')]();}return null;})[_0x0a9e('0x1f')](function(_0x5a8854){if(_0x5a8854){if(!_0x5a8854[_0x0a9e('0x2f')]){throw new db['Sequelize'][(_0x0a9e('0x61'))](_0x0a9e('0x62'),0x193);}_0x4e46b2=_0x5a8854;return db[_0x0a9e('0x85')][_0x0a9e('0x63')]({'raw':!![]});}return null;})['then'](function(_0x46c9ac){if(_0x46c9ac){_0xf0a802=_[_0x0a9e('0x86')](_0x46c9ac,'id');var _0x1d4877;var _0x5b74c3=squel[_0x0a9e('0x87')]();_0x5b74c3[_0x0a9e('0x64')](_0x524e38[_0x0a9e('0x65')]);for(var _0x22063c=0x0;_0x22063c<_0x4e46b2[_0x0a9e('0x2f')];_0x22063c+=0x1){_0x1d4877=_0x4e46b2[_0x22063c][_0x0a9e('0x66')]?_0xf0a802[_0x4e46b2[_0x22063c][_0x0a9e('0x66')]][_0x0a9e('0x67')]:_0x4e46b2[_0x22063c]['field'];_0x1d4877=_0x4e46b2[_0x22063c][_0x0a9e('0x68')]?_[_0x0a9e('0x69')](_0x563627[_0x4e46b2[_0x22063c]['function']],'%s',_0x1d4877):_0x1d4877;_0x1d4877=_0x4e46b2[_0x22063c][_0x0a9e('0x6a')]?_[_0x0a9e('0x69')](_0x45108c[_0x4e46b2[_0x22063c][_0x0a9e('0x6a')]],'%s',_0x1d4877):_0x1d4877;if(_0x4e46b2[_0x22063c]['groupBy']){_0x5b74c3[_0x0a9e('0x6c')](_0x1d4877);}_0x4e46b2[_0x22063c]['orderBy']&&_0x5b74c3[_0x0a9e('0x31')](_0x1d4877,_0x4e46b2[_0x22063c][_0x0a9e('0x6d')]===_0x0a9e('0x6e')?![]:!![]);_0x5b74c3[_0x0a9e('0x38')](_0x1d4877,_0x4e46b2[_0x22063c][_0x0a9e('0x6f')]||_0x1d4877);}if(_0x524e38[_0x0a9e('0x70')]){_0x524e38[_0x0a9e('0x70')]=JSON[_0x0a9e('0x71')](_0x524e38['joins']);for(var _0x329d88=0x0;_0x329d88<_0x524e38[_0x0a9e('0x70')][_0x0a9e('0x2f')];_0x329d88+=0x1){if(_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x35')]&&_[_0x0a9e('0x58')](_0xe0749e,_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x35')])&&_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x72')]&&_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x73')]&&_0x524e38[_0x0a9e('0x70')][_0x329d88]['foreignKey']){_0x5b74c3[_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x35')]](_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x73')],null,util[_0x0a9e('0x6a')]('%s.%s\x20=\x20%s.%s',_0x524e38[_0x0a9e('0x65')],_0x524e38[_0x0a9e('0x70')][_0x329d88]['parentKey'],_0x524e38[_0x0a9e('0x70')][_0x329d88]['foreignTable'],_0x524e38[_0x0a9e('0x70')][_0x329d88][_0x0a9e('0x74')]));}}}if(_0x524e38[_0x0a9e('0x76')]){_0x524e38[_0x0a9e('0x76')]=JSON['parse'](_0x524e38[_0x0a9e('0x76')]);_0x5b74c3['where'](_0x2973d3(_0x524e38[_0x0a9e('0x76')][_0x0a9e('0x6c')]));}_0x5ea541=_0x5b74c3['clone']();_0x5b74c3[_0x0a9e('0x19')](_0x25744a);_0x5b74c3[_0x0a9e('0x18')](0x0);logger[_0x0a9e('0x78')]('Limited\x20Query:',_0x5b74c3['toString']());return db[_0x0a9e('0x7b')][_0x0a9e('0x2a')](_0x5b74c3[_0x0a9e('0x7a')](),{'type':db[_0x0a9e('0x7b')][_0x0a9e('0x7c')][_0x0a9e('0x7d')]});}})[_0x0a9e('0x1f')](function(_0x3c75b9){if(!_0x3c75b9[_0x0a9e('0x2f')]){throw new db['Sequelize'][(_0x0a9e('0x61'))]('No\x20available\x20data',0xcc);}if(_0x1a7b03[_0x0a9e('0x88')]===_0x0a9e('0x89')){return null;}var _0x34e745=_[_0x0a9e('0x41')](_0x1a7b03,{'name':_0x1a7b03[_0x0a9e('0x8a')]||_0x1a7b03['name']||_0x524e38[_0x0a9e('0x24')],'basename':_0xc4c230,'savename':util[_0x0a9e('0x6a')](_0x0a9e('0x8b'),_0x1a7b03[_0x0a9e('0x24')]||_0x524e38[_0x0a9e('0x24')],require('randomstring')['generate'](0x4),_0x1a7b03[_0x0a9e('0x88')]||'csv'),'reportId':_0x524e38['id'],'reportType':_0x0a9e('0x8c')});return db[_0x0a9e('0x8d')][_0x0a9e('0x43')](_0x34e745,{'raw':!![]});})[_0x0a9e('0x1f')](function(_0x2ad54b){if(_0x524e38[_0x0a9e('0x65')]==='cdr'){_0x5ea541['where'](_0x524e38[_0x0a9e('0x65')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1a7b03[_0x0a9e('0x8e')],_0x1a7b03['endDate']);}else{_0x5ea541[_0x0a9e('0x33')](_0x524e38['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a7b03[_0x0a9e('0x8e')],_0x1a7b03[_0x0a9e('0x8f')]);}if(_0x2ad54b){logger['info'](_0x0a9e('0x90'),_0x5ea541[_0x0a9e('0x7a')]());require(_0x0a9e('0x91'))[_0x0a9e('0x92')](path[_0x0a9e('0x93')](__dirname,'../../components/export/',_0x2ad54b['output']),[_0x2ad54b['id'],_0x5ea541[_0x0a9e('0x7a')](),path[_0x0a9e('0x93')](__dirname,_0x0a9e('0x94'),_0x2ad54b[_0x0a9e('0x95')]),_0xc4c230]);return _0x2ad54b;}else{var _0x59303b=squel['select']();_0x59303b[_0x0a9e('0x64')]('('+_0x5ea541[_0x0a9e('0x7a')]()+')','countTable');_0x59303b[_0x0a9e('0x38')](_0x0a9e('0x96'),_0x0a9e('0x17'));_0x5ea541[_0x0a9e('0x19')](_0x1a7b03[_0x0a9e('0x19')]||_0x25744a);_0x5ea541[_0x0a9e('0x18')](_0x1a7b03[_0x0a9e('0x18')]||0x0);return db[_0x0a9e('0x7b')][_0x0a9e('0x2a')](_0x59303b[_0x0a9e('0x7a')](),{'type':db['sequelize'][_0x0a9e('0x7c')][_0x0a9e('0x7d')]})[_0x0a9e('0x1f')](function(_0x1c4232){if(!_0x1c4232[_0x0a9e('0x2f')]){_0x56acca=0x0;}else{_0x56acca=_0x1c4232[0x0]['count']||0x0;}return db['sequelize'][_0x0a9e('0x2a')](_0x5ea541[_0x0a9e('0x7a')](),{'type':db[_0x0a9e('0x7b')][_0x0a9e('0x7c')][_0x0a9e('0x7d')]});})['then'](function(_0x1339d0){return{'rows':_0x1339d0||[],'count':_0x56acca};});}});}exports[_0x0a9e('0x97')]=function(_0x3450ae,_0x52b661){return runReport(_0x3450ae[_0x0a9e('0x40')],_0x3450ae['query'],_0x3450ae[_0x0a9e('0x39')])['then'](respondWithResult(_0x52b661,null))[_0x0a9e('0x3e')](handleError(_0x52b661,null));};exports[_0x0a9e('0x98')]=runReport;exports[_0x0a9e('0x2a')]=function(_0x5c500c,_0xc9529d){var _0x5ed560=0xa;var _0x4383da=[_0x0a9e('0x93'),_0x0a9e('0x7e'),_0x0a9e('0x4d'),_0x0a9e('0x4e')];var _0x1bee04={'SUM':_0x0a9e('0x4f'),'COUNT':_0x0a9e('0x7f'),'COUNT DISTINCT':_0x0a9e('0x50'),'MAX':_0x0a9e('0x80'),'MIN':_0x0a9e('0x51'),'AVG':_0x0a9e('0x99'),'GROUP_CONCAT':_0x0a9e('0x81'),'GROUP_CONCAT ASC':_0x0a9e('0x82'),'GROUP_CONCAT DESC':_0x0a9e('0x52')};var _0x248368={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x0a9e('0x55'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a9e('0x57')};var _0x3428c9=function(_0x5d6b69){return!_[_0x0a9e('0x58')]([_0x0a9e('0x83'),_0x0a9e('0x59'),_0x0a9e('0x5a'),'IS\x20NOT\x20EMPTY'],_0x5d6b69);};var _0x148fd9=function(_0x26cb76){if(!_0x26cb76||!_0x26cb76[_0x0a9e('0x5c')][_0x0a9e('0x2f')]){return'';}for(var _0x5d0e1f='(',_0x19e9ed=0x0;_0x19e9ed<_0x26cb76[_0x0a9e('0x5c')][_0x0a9e('0x2f')];_0x19e9ed+=0x1){_0x19e9ed>0x0&&(_0x5d0e1f+='\x20'+_0x26cb76['operator']+'\x20');_0x5d0e1f+=_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed][_0x0a9e('0x6c')]?_0x148fd9(_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed]['group']):_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed][_0x0a9e('0x38')]+'\x20'+_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed][_0x0a9e('0x5d')]+(_0x3428c9(_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed]['condition'])?'\x20'+_0x26cb76[_0x0a9e('0x5c')][_0x19e9ed][_0x0a9e('0x5e')]:'');}return _0x5d0e1f+')';};var _0x4795ae={'where':{'id':_0x5c500c['params']['id']}},_0x3bab3e,_0x1fcfe6,_0x1f6f1c,_0x5822a7,_0x5c3b6f;_0x4795ae=_[_0x0a9e('0x41')]({},_0x4795ae,_0x5c500c[_0x0a9e('0x39')]);return db['AnalyticCustomReport'][_0x0a9e('0x42')](_0x4795ae)[_0x0a9e('0x1f')](function(_0x2a8d55){if(_0x2a8d55){_0x3bab3e=_0x2a8d55;return _0x2a8d55['getFields']();}return null;})[_0x0a9e('0x1f')](function(_0x30e037){if(_0x30e037){if(!_0x30e037[_0x0a9e('0x2f')]){throw new db[(_0x0a9e('0x60'))][(_0x0a9e('0x61'))](_0x0a9e('0x62'),0x193);}_0x1fcfe6=_0x30e037;return db[_0x0a9e('0x85')][_0x0a9e('0x63')]({'raw':!![]});}return null;})[_0x0a9e('0x1f')](function(_0x5a1848){if(_0x5a1848){_0x1f6f1c=_[_0x0a9e('0x86')](_0x5a1848,'id');var _0x5526a7;var _0x138cf5=squel[_0x0a9e('0x87')]();_0x138cf5[_0x0a9e('0x64')](_0x3bab3e[_0x0a9e('0x65')]);for(var _0x407e9d=0x0;_0x407e9d<_0x1fcfe6[_0x0a9e('0x2f')];_0x407e9d+=0x1){_0x5526a7=_0x1fcfe6[_0x407e9d]['MetricId']?_0x1f6f1c[_0x1fcfe6[_0x407e9d][_0x0a9e('0x66')]][_0x0a9e('0x67')]:_0x1fcfe6[_0x407e9d][_0x0a9e('0x38')];_0x5526a7=_0x1fcfe6[_0x407e9d][_0x0a9e('0x68')]?_['replace'](_0x1bee04[_0x1fcfe6[_0x407e9d][_0x0a9e('0x68')]],'%s',_0x5526a7):_0x5526a7;_0x5526a7=_0x1fcfe6[_0x407e9d][_0x0a9e('0x6a')]?_[_0x0a9e('0x69')](_0x248368[_0x1fcfe6[_0x407e9d][_0x0a9e('0x6a')]],'%s',_0x5526a7):_0x5526a7;if(_0x1fcfe6[_0x407e9d][_0x0a9e('0x6b')]){_0x138cf5[_0x0a9e('0x6c')](_0x5526a7);}_0x1fcfe6[_0x407e9d][_0x0a9e('0x6d')]&&_0x138cf5[_0x0a9e('0x31')](_0x5526a7,_0x1fcfe6[_0x407e9d][_0x0a9e('0x6d')]===_0x0a9e('0x6e')?![]:!![]);_0x138cf5['field'](_0x5526a7,_0x1fcfe6[_0x407e9d][_0x0a9e('0x6f')]||_0x5526a7);}if(_0x3bab3e[_0x0a9e('0x70')]){_0x3bab3e[_0x0a9e('0x70')]=JSON[_0x0a9e('0x71')](_0x3bab3e[_0x0a9e('0x70')]);for(var _0x253f74=0x0;_0x253f74<_0x3bab3e[_0x0a9e('0x70')][_0x0a9e('0x2f')];_0x253f74+=0x1){if(_0x3bab3e['joins'][_0x253f74][_0x0a9e('0x35')]&&_[_0x0a9e('0x58')](_0x4383da,_0x3bab3e[_0x0a9e('0x70')][_0x253f74]['type'])&&_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x72')]&&_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x73')]&&_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x74')]){_0x138cf5[_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x35')]](_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x73')],null,util['format'](_0x0a9e('0x75'),_0x3bab3e[_0x0a9e('0x65')],_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x72')],_0x3bab3e[_0x0a9e('0x70')][_0x253f74][_0x0a9e('0x73')],_0x3bab3e['joins'][_0x253f74][_0x0a9e('0x74')]));}}}if(_0x3bab3e['conditions']){_0x3bab3e['conditions']=JSON['parse'](_0x3bab3e[_0x0a9e('0x76')]);_0x138cf5[_0x0a9e('0x33')](_0x148fd9(_0x3bab3e[_0x0a9e('0x76')][_0x0a9e('0x6c')]));}_0x5c3b6f=_0x138cf5['clone']();_0x138cf5[_0x0a9e('0x19')](_0x5ed560);_0x138cf5[_0x0a9e('0x18')](0x0);logger[_0x0a9e('0x78')](_0x0a9e('0x79'),_0x138cf5[_0x0a9e('0x7a')]());return db['sequelize']['query'](_0x138cf5[_0x0a9e('0x7a')](),{'type':db[_0x0a9e('0x7b')][_0x0a9e('0x7c')]['SELECT']});}})[_0x0a9e('0x1f')](function(){return{'sql':_0x5c3b6f[_0x0a9e('0x7a')]()};})[_0x0a9e('0x1f')](respondWithResult(_0xc9529d,null))['catch'](handleError(_0xc9529d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5ec0208..54af553 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 _0x8a2a=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','util'];(function(_0x1d0256,_0x14dc86){var _0x598d0c=function(_0x4889eb){while(--_0x4889eb){_0x1d0256['push'](_0x1d0256['shift']());}};_0x598d0c(++_0x14dc86);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x8a2a[_0x245afe];return _0x4eefde;};'use strict';var _=require('lodash');var util=require(_0xa8a2('0x0'));var logger=require(_0xa8a2('0x1'))(_0xa8a2('0x2'));var moment=require(_0xa8a2('0x3'));var BPromise=require(_0xa8a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8a2('0x5'));var rimraf=require(_0xa8a2('0x6'));var config=require(_0xa8a2('0x7'));var attributes=require(_0xa8a2('0x8'));module[_0xa8a2('0x9')]=function(_0x366d0e,_0x3d2be3){return _0x366d0e[_0xa8a2('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xa8a2('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12da=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','request-promise','./analyticCustomReport.attributes'];(function(_0xd0baae,_0x3020f4){var _0x538549=function(_0x57a0e3){while(--_0x57a0e3){_0xd0baae['push'](_0xd0baae['shift']());}};_0x538549(++_0x3020f4);}(_0x12da,0x187));var _0xa12d=function(_0x178b4e,_0x3810c2){_0x178b4e=_0x178b4e-0x0;var _0x176a81=_0x12da[_0x178b4e];return _0x176a81;};'use strict';var _=require(_0xa12d('0x0'));var util=require(_0xa12d('0x1'));var logger=require('../../config/logger')(_0xa12d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa12d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa12d('0x4'));module[_0xa12d('0x5')]=function(_0x514f0e,_0x1cf225){return _0x514f0e[_0xa12d('0x6')](_0xa12d('0x7'),attributes,{'tableName':_0xa12d('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 3bc1373..5305a66 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 _0x3981=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x6c6123,_0x1a9cbb){var _0x42dbd0=function(_0x544e66){while(--_0x544e66){_0x6c6123['push'](_0x6c6123['shift']());}};_0x42dbd0(++_0x1a9cbb);}(_0x3981,0x144));var _0x1398=function(_0x1a63fb,_0x597fe7){_0x1a63fb=_0x1a63fb-0x0;var _0x5f1c6b=_0x3981[_0x1a63fb];return _0x5f1c6b;};'use strict';var _=require(_0x1398('0x0'));var util=require('util');var moment=require(_0x1398('0x1'));var BPromise=require(_0x1398('0x2'));var rs=require(_0x1398('0x3'));var fs=require('fs');var Redis=require(_0x1398('0x4'));var db=require(_0x1398('0x5'))['db'];var utils=require(_0x1398('0x6'));var logger=require(_0x1398('0x7'))(_0x1398('0x8'));var config=require(_0x1398('0x9'));var jayson=require(_0x1398('0xa'));var client=jayson[_0x1398('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x216064,_0xdc7d88,_0x40e860){return new BPromise(function(_0x51dd7f,_0x3bb7c7){return client[_0x1398('0xc')](_0x216064,_0x40e860)[_0x1398('0xd')](function(_0x2c1da9){logger[_0x1398('0xe')](_0x1398('0xf'),_0xdc7d88,'request\x20sent');logger[_0x1398('0x10')](_0x1398('0x11'),_0xdc7d88,_0x1398('0x12'),JSON[_0x1398('0x13')](_0x2c1da9));if(_0x2c1da9[_0x1398('0x14')]){if(_0x2c1da9[_0x1398('0x14')][_0x1398('0x15')]===0x1f4){logger[_0x1398('0x14')](_0x1398('0xf'),_0xdc7d88,_0x2c1da9[_0x1398('0x14')]['message']);return _0x3bb7c7(_0x2c1da9[_0x1398('0x14')][_0x1398('0x16')]);}logger[_0x1398('0x14')](_0x1398('0xf'),_0xdc7d88,_0x2c1da9['error']['message']);return _0x51dd7f(_0x2c1da9['error'][_0x1398('0x16')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0xdc7d88,'request\x20sent');_0x51dd7f(_0x2c1da9[_0x1398('0x17')]['message']);}})[_0x1398('0x18')](function(_0x255a40){logger[_0x1398('0x14')](_0x1398('0xf'),_0xdc7d88,_0x255a40);_0x3bb7c7(_0x255a40);});});} \ No newline at end of file +var _0x9447=['client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticCustomReport,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x202e50,_0x3d275e){var _0x1a498b=function(_0x2da458){while(--_0x2da458){_0x202e50['push'](_0x202e50['shift']());}};_0x1a498b(++_0x3d275e);}(_0x9447,0x91));var _0x7944=function(_0x4f7e62,_0x290458){_0x4f7e62=_0x4f7e62-0x0;var _0x20bc94=_0x9447[_0x4f7e62];return _0x20bc94;};'use strict';var _=require(_0x7944('0x0'));var util=require(_0x7944('0x1'));var moment=require(_0x7944('0x2'));var BPromise=require('bluebird');var rs=require(_0x7944('0x3'));var fs=require('fs');var Redis=require(_0x7944('0x4'));var db=require(_0x7944('0x5'))['db'];var utils=require(_0x7944('0x6'));var logger=require(_0x7944('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7944('0x8'));var client=jayson[_0x7944('0x9')][_0x7944('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54af1c,_0x11da07,_0x5dfed9){return new BPromise(function(_0x51f907,_0x55fdec){return client[_0x7944('0xb')](_0x54af1c,_0x5dfed9)[_0x7944('0xc')](function(_0x17aaa4){logger[_0x7944('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x11da07,_0x7944('0xe'));logger[_0x7944('0xf')](_0x7944('0x10'),_0x11da07,_0x7944('0xe'),JSON[_0x7944('0x11')](_0x17aaa4));if(_0x17aaa4[_0x7944('0x12')]){if(_0x17aaa4['error']['code']===0x1f4){logger[_0x7944('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x11da07,_0x17aaa4[_0x7944('0x12')][_0x7944('0x13')]);return _0x55fdec(_0x17aaa4[_0x7944('0x12')]['message']);}logger[_0x7944('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x11da07,_0x17aaa4[_0x7944('0x12')][_0x7944('0x13')]);return _0x51f907(_0x17aaa4[_0x7944('0x12')]['message']);}else{logger['info'](_0x7944('0x14'),_0x11da07,_0x7944('0xe'));_0x51f907(_0x17aaa4[_0x7944('0x15')][_0x7944('0x13')]);}})['catch'](function(_0x5353e8){logger[_0x7944('0x12')](_0x7944('0x14'),_0x11da07,_0x5353e8);_0x55fdec(_0x5353e8);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d65a97d..b220f9c 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 _0x152b=['post','create','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x152b,0x101));var _0xb152=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x152b[_0x576e2b];return _0x46461a;};'use strict';var multer=require(_0xb152('0x0'));var util=require('util');var path=require(_0xb152('0x1'));var timeout=require(_0xb152('0x2'));var express=require(_0xb152('0x3'));var router=express[_0xb152('0x4')]();var auth=require(_0xb152('0x5'));var interaction=require(_0xb152('0x6'));var config=require(_0xb152('0x7'));var controller=require(_0xb152('0x8'));router[_0xb152('0x9')]('/',auth[_0xb152('0xa')](),controller['index']);router[_0xb152('0x9')](_0xb152('0xb'),auth[_0xb152('0xa')](),controller[_0xb152('0xc')]);router[_0xb152('0x9')](_0xb152('0xd'),auth[_0xb152('0xa')](),controller[_0xb152('0xe')]);router[_0xb152('0x9')](_0xb152('0xf'),auth[_0xb152('0xa')](),controller[_0xb152('0x10')]);router[_0xb152('0x9')](_0xb152('0x11'),auth[_0xb152('0xa')](),controller[_0xb152('0x12')]);router[_0xb152('0x13')]('/',auth[_0xb152('0xa')](),controller[_0xb152('0x14')]);router['put'](_0xb152('0xb'),auth[_0xb152('0xa')](),controller[_0xb152('0x15')]);router[_0xb152('0x16')]('/:id',auth[_0xb152('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe8d7=['/:id/run','run','/:id/query','query','post','create','put','update','destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','show','/:id/preview'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xe8d7,0x1ec));var _0x7e8d=function(_0x113cc2,_0x51f854){_0x113cc2=_0x113cc2-0x0;var _0x1db391=_0xe8d7[_0x113cc2];return _0x1db391;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7e8d('0x0'));var timeout=require(_0x7e8d('0x1'));var express=require(_0x7e8d('0x2'));var router=express['Router']();var auth=require(_0x7e8d('0x3'));var interaction=require(_0x7e8d('0x4'));var config=require(_0x7e8d('0x5'));var controller=require(_0x7e8d('0x6'));router['get']('/',auth[_0x7e8d('0x7')](),controller['index']);router[_0x7e8d('0x8')](_0x7e8d('0x9'),auth['isAuthenticated'](),controller[_0x7e8d('0xa')]);router['get'](_0x7e8d('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x7e8d('0x8')](_0x7e8d('0xc'),auth['isAuthenticated'](),controller[_0x7e8d('0xd')]);router[_0x7e8d('0x8')](_0x7e8d('0xe'),auth[_0x7e8d('0x7')](),controller[_0x7e8d('0xf')]);router[_0x7e8d('0x10')]('/',auth[_0x7e8d('0x7')](),controller[_0x7e8d('0x11')]);router[_0x7e8d('0x12')](_0x7e8d('0x9'),auth['isAuthenticated'](),controller[_0x7e8d('0x13')]);router['delete'](_0x7e8d('0x9'),auth[_0x7e8d('0x7')](),controller[_0x7e8d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7e5606f..245c603 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 _0x7a0b=['exports','STRING','TEXT'];(function(_0x27e811,_0x1fad22){var _0x1bfe61=function(_0x2d8d02){while(--_0x2d8d02){_0x27e811['push'](_0x27e811['shift']());}};_0x1bfe61(++_0x1fad22);}(_0x7a0b,0x18c));var _0xb7a0=function(_0x14fc87,_0x266f58){_0x14fc87=_0x14fc87-0x0;var _0x131ae9=_0x7a0b[_0x14fc87];return _0x131ae9;};'use strict';var Sequelize=require('sequelize');module[_0xb7a0('0x0')]={'name':{'type':Sequelize[_0xb7a0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb7a0('0x1')]},'parent':{'type':Sequelize[_0xb7a0('0x1')]},'table':{'type':Sequelize[_0xb7a0('0x1')]},'conditions':{'type':Sequelize[_0xb7a0('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3d92=['STRING','TEXT','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3d92,0x134));var _0x23d9=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0x3d92[_0x86c6cb];return _0x1b1592;};'use strict';var Sequelize=require('sequelize');module[_0x23d9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x23d9('0x1')]},'parent':{'type':Sequelize[_0x23d9('0x1')]},'table':{'type':Sequelize[_0x23d9('0x1')]},'conditions':{'type':Sequelize[_0x23d9('0x2')]},'joins':{'type':Sequelize[_0x23d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6f18757..39f9070 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 _0xde2c=['UserProfileResource','error','name','status','send','index','AnalyticDefaultReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','findAll','rows','catch','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Reports','UserProfileSection','userProfileId','DefaultReports','find','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','keyBy','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','MAX(%s)','SEC_TO_TIME(%s)','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','alias','No\x20available\x20data','web','%s-%s.%s','randomstring','generate','output','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','DATE(%s)','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','apply','save','update','destroy','then'];(function(_0x3d5ad8,_0x338d1c){var _0x40bf6a=function(_0x4be312){while(--_0x4be312){_0x3d5ad8['push'](_0x3d5ad8['shift']());}};_0x40bf6a(++_0x338d1c);}(_0xde2c,0x7f));var _0xcde2=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0xde2c[_0x3da612];return _0x1a9d1d;};'use strict';var pdf=require(_0xcde2('0x0'));var emlformat=require(_0xcde2('0x1'));var rimraf=require(_0xcde2('0x2'));var zipdir=require(_0xcde2('0x3'));var jsonpatch=require(_0xcde2('0x4'));var rp=require(_0xcde2('0x5'));var moment=require(_0xcde2('0x6'));var BPromise=require(_0xcde2('0x7'));var Mustache=require('mustache');var util=require(_0xcde2('0x8'));var path=require(_0xcde2('0x9'));var sox=require(_0xcde2('0xa'));var csv=require(_0xcde2('0xb'));var ejs=require(_0xcde2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var hardwareService=require(_0xcde2('0x14'));var logger=require(_0xcde2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcde2('0x16'));var db=require(_0xcde2('0x17'))['db'];function respondWithStatusCode(_0x3b1333,_0x39a973){_0x39a973=_0x39a973||0xcc;return function(_0x932b90){if(_0x932b90){return _0x3b1333[_0xcde2('0x18')](_0x39a973);}return _0x3b1333['status'](_0x39a973)[_0xcde2('0x19')]();};}function respondWithResult(_0x577062,_0x31c3ba){_0x31c3ba=_0x31c3ba||0xc8;return function(_0x4f0ac9){if(_0x4f0ac9){return _0x577062['status'](_0x31c3ba)[_0xcde2('0x1a')](_0x4f0ac9);}};}function respondWithFilteredResult(_0x1c7103,_0x417505){return function(_0x19b54b){if(_0x19b54b){var _0x11665c=_0x19b54b[_0xcde2('0x1b')],_0x5312c7=_0x417505[_0xcde2('0x1c')],_0x39b023=_0x417505[_0xcde2('0x1c')]+_0x417505[_0xcde2('0x1d')],_0x4c558b;if(_0x39b023>=_0x11665c){_0x39b023=_0x11665c;_0x4c558b=0xc8;}else{_0x4c558b=0xce;}_0x1c7103['status'](_0x4c558b);return _0x1c7103['set']('Content-Range',_0x5312c7+'-'+_0x39b023+'/'+_0x11665c)[_0xcde2('0x1a')](_0x19b54b);}return null;};}function patchUpdates(_0x582e84){return function(_0x285ac7){try{jsonpatch[_0xcde2('0x1e')](_0x285ac7,_0x582e84,!![]);}catch(_0x252372){return BPromise['reject'](_0x252372);}return _0x285ac7[_0xcde2('0x1f')]();};}function saveUpdates(_0x24d76f,_0x208368){return function(_0x3c1d7e){if(_0x3c1d7e){return _0x3c1d7e[_0xcde2('0x20')](_0x24d76f)['then'](function(_0x4bce90){return _0x4bce90;});}return null;};}function removeEntity(_0x5a92b9,_0xb96dc0){return function(_0x3e5170){if(_0x3e5170){return _0x3e5170[_0xcde2('0x21')]()[_0xcde2('0x22')](function(){var _0xc86374=_0x3e5170['get']({'plain':!![]});var _0x1104b8='DefaultReports';return db[_0xcde2('0x23')][_0xcde2('0x21')]({'where':{'type':_0x1104b8,'resourceId':_0xc86374['id']}})[_0xcde2('0x22')](function(){return _0x3e5170;});})['then'](function(){_0x5a92b9['status'](0xcc)[_0xcde2('0x19')]();});}};}function handleEntityNotFound(_0x207a12,_0x3e8aaf){return function(_0x217ec9){if(!_0x217ec9){_0x207a12[_0xcde2('0x18')](0x194);}return _0x217ec9;};}function handleError(_0x5a5b92,_0x2d1d17){_0x2d1d17=_0x2d1d17||0x1f4;return function(_0x45275a){logger[_0xcde2('0x24')](_0x45275a['stack']);if(_0x45275a[_0xcde2('0x25')]){delete _0x45275a[_0xcde2('0x25')];}_0x5a5b92[_0xcde2('0x26')](_0x2d1d17)[_0xcde2('0x27')](_0x45275a);};}exports[_0xcde2('0x28')]=function(_0x5b2b7,_0x40b12c){var _0x3e492f={},_0x5bf1e6={},_0x3c3c01={'count':0x0,'rows':[]};var _0x4a0826=db[_0xcde2('0x29')][_0xcde2('0x2a')];_0x5bf1e6[_0xcde2('0x2b')]=_['keys'](_0x4a0826);_0x5bf1e6[_0xcde2('0x2c')]=_[_0xcde2('0x2d')](_0x5b2b7['query']);_0x5bf1e6[_0xcde2('0x2e')]=_[_0xcde2('0x2f')](_0x5bf1e6[_0xcde2('0x2b')],_0x5bf1e6[_0xcde2('0x2c')]);_0x3e492f[_0xcde2('0x30')]=_[_0xcde2('0x2f')](_0x5bf1e6[_0xcde2('0x2b')],qs[_0xcde2('0x31')](_0x5b2b7['query'][_0xcde2('0x31')]));_0x3e492f[_0xcde2('0x30')]=_0x3e492f[_0xcde2('0x30')][_0xcde2('0x32')]?_0x3e492f['attributes']:_0x5bf1e6[_0xcde2('0x2b')];if(!_0x5b2b7[_0xcde2('0x2c')][_0xcde2('0x33')](_0xcde2('0x34'))){_0x3e492f['limit']=qs[_0xcde2('0x1d')](_0x5b2b7[_0xcde2('0x2c')][_0xcde2('0x1d')]);_0x3e492f[_0xcde2('0x1c')]=qs['offset'](_0x5b2b7[_0xcde2('0x2c')][_0xcde2('0x1c')]);}_0x3e492f[_0xcde2('0x35')]=qs[_0xcde2('0x36')](_0x5b2b7[_0xcde2('0x2c')]['sort']);_0x3e492f[_0xcde2('0x37')]=qs[_0xcde2('0x2e')](_[_0xcde2('0x38')](_0x5b2b7[_0xcde2('0x2c')],_0x5bf1e6['filters']));if(_0x5b2b7['query'][_0xcde2('0x39')]){_0x3e492f[_0xcde2('0x37')]=_[_0xcde2('0x3a')](_0x3e492f[_0xcde2('0x37')],{'$or':_[_0xcde2('0x3b')](_0x4a0826,function(_0x45af6e){if(_0x45af6e[_0xcde2('0x3c')][_0xcde2('0x3d')]!==_0xcde2('0x3e')){var _0x5d02b3={};_0x5d02b3[_0x45af6e[_0xcde2('0x3f')]]={'$like':'%'+_0x5b2b7[_0xcde2('0x2c')][_0xcde2('0x39')]+'%'};return _0x5d02b3;}})});}_0x3e492f=_[_0xcde2('0x3a')]({},_0x3e492f,_0x5b2b7[_0xcde2('0x40')]);var _0x47b6ee={'where':_0x3e492f['where']};return db[_0xcde2('0x29')][_0xcde2('0x1b')](_0x47b6ee)[_0xcde2('0x22')](function(_0x383899){_0x3c3c01[_0xcde2('0x1b')]=_0x383899;if(_0x5b2b7[_0xcde2('0x2c')]['includeAll']){_0x3e492f['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xcde2('0x41')](_0x3e492f);})[_0xcde2('0x22')](function(_0x1cfe20){_0x3c3c01[_0xcde2('0x42')]=_0x1cfe20;return _0x3c3c01;})[_0xcde2('0x22')](respondWithFilteredResult(_0x40b12c,_0x3e492f))[_0xcde2('0x43')](handleError(_0x40b12c,null));};exports[_0xcde2('0x44')]=function(_0x49b862,_0x48580a){var _0x6f60d5={'raw':!![],'where':{'id':_0x49b862[_0xcde2('0x45')]['id']}},_0x578bf1={};_0x578bf1['model']=_[_0xcde2('0x2d')](db[_0xcde2('0x29')][_0xcde2('0x2a')]);_0x578bf1['query']=_[_0xcde2('0x2d')](_0x49b862['query']);_0x578bf1[_0xcde2('0x2e')]=_[_0xcde2('0x2f')](_0x578bf1[_0xcde2('0x2b')],_0x578bf1[_0xcde2('0x2c')]);_0x6f60d5[_0xcde2('0x30')]=_[_0xcde2('0x2f')](_0x578bf1['model'],qs['fields'](_0x49b862[_0xcde2('0x2c')]['fields']));_0x6f60d5['attributes']=_0x6f60d5[_0xcde2('0x30')]['length']?_0x6f60d5[_0xcde2('0x30')]:_0x578bf1[_0xcde2('0x2b')];if(_0x49b862['query'][_0xcde2('0x46')]){_0x6f60d5['include']=[{'all':!![]}];}_0x6f60d5=_['merge']({},_0x6f60d5,_0x49b862[_0xcde2('0x40')]);return db[_0xcde2('0x29')]['find'](_0x6f60d5)[_0xcde2('0x22')](handleEntityNotFound(_0x48580a,null))['then'](respondWithResult(_0x48580a,null))[_0xcde2('0x43')](handleError(_0x48580a,null));};exports[_0xcde2('0x47')]=function(_0x2d7b55,_0x411103){return db[_0xcde2('0x29')]['create'](_0x2d7b55[_0xcde2('0x48')],{})[_0xcde2('0x22')](function(_0x40d14b){var _0x2c78a5=_0x2d7b55['user']['get']({'plain':!![]});if(!_0x2c78a5)throw new Error(_0xcde2('0x49'));if(_0x2c78a5['role']===_0xcde2('0x4a')){var _0x3e9e79=_0x40d14b[_0xcde2('0x4b')]({'plain':!![]});var _0x16675f=_0xcde2('0x4c');return db[_0xcde2('0x4d')]['find']({'where':{'name':_0x16675f,'userProfileId':_0x2c78a5[_0xcde2('0x4e')]},'raw':!![]})['then'](function(_0x1a76a5){if(_0x1a76a5&&_0x1a76a5['autoAssociation']===0x0){return db[_0xcde2('0x23')][_0xcde2('0x47')]({'name':_0x3e9e79[_0xcde2('0x25')],'resourceId':_0x3e9e79['id'],'type':_0xcde2('0x4f'),'sectionId':_0x1a76a5['id']},{})[_0xcde2('0x22')](function(){return _0x40d14b;});}else{return _0x40d14b;}})[_0xcde2('0x43')](function(_0x52fbc4){logger[_0xcde2('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52fbc4);throw _0x52fbc4;});}return _0x40d14b;})[_0xcde2('0x22')](respondWithResult(_0x411103,0xc9))[_0xcde2('0x43')](handleError(_0x411103,null));};exports[_0xcde2('0x20')]=function(_0x428a55,_0x1e1c9e){if(_0x428a55[_0xcde2('0x48')]['id']){delete _0x428a55[_0xcde2('0x48')]['id'];}return db[_0xcde2('0x29')][_0xcde2('0x50')]({'where':{'id':_0x428a55[_0xcde2('0x45')]['id']}})[_0xcde2('0x22')](handleEntityNotFound(_0x1e1c9e,null))[_0xcde2('0x22')](saveUpdates(_0x428a55['body'],null))['then'](respondWithResult(_0x1e1c9e,null))['catch'](handleError(_0x1e1c9e,null));};exports[_0xcde2('0x21')]=function(_0x59a64d,_0x1751dd){return db[_0xcde2('0x29')][_0xcde2('0x50')]({'where':{'id':_0x59a64d['params']['id']}})[_0xcde2('0x22')](handleEntityNotFound(_0x1751dd,null))['then'](removeEntity(_0x1751dd,null))[_0xcde2('0x43')](handleError(_0x1751dd,null));};exports['preview']=function(_0x1085d2,_0x10d6ab){var _0x50d2bf=0xa;var _0x418dd1=['join','left_join',_0xcde2('0x51'),_0xcde2('0x52')];var _0x8eddd4={'SUM':_0xcde2('0x53'),'COUNT':_0xcde2('0x54'),'COUNT DISTINCT':_0xcde2('0x55'),'MAX':'MAX(%s)','MIN':_0xcde2('0x56'),'AVG':_0xcde2('0x57'),'GROUP_CONCAT':_0xcde2('0x58'),'GROUP_CONCAT ASC':_0xcde2('0x59'),'GROUP_CONCAT DESC':_0xcde2('0x5a')};var _0x541a70={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xcde2('0x5b'),'ROUND':_0xcde2('0x5c'),'UNIX_TIMESTAMP':_0xcde2('0x5d')};var _0x109472=function(_0x4c298b){return!_[_0xcde2('0x5e')]([_0xcde2('0x5f'),_0xcde2('0x60'),_0xcde2('0x61'),_0xcde2('0x62')],_0x4c298b);};var _0x35453a=function(_0x50a1db){if(!_0x50a1db||!_0x50a1db[_0xcde2('0x63')][_0xcde2('0x32')]){return'';}for(var _0x585165='(',_0x124335=0x0;_0x124335<_0x50a1db[_0xcde2('0x63')][_0xcde2('0x32')];_0x124335+=0x1){_0x124335>0x0&&(_0x585165+='\x20'+_0x50a1db[_0xcde2('0x64')]+'\x20');_0x585165+=_0x50a1db[_0xcde2('0x63')][_0x124335][_0xcde2('0x65')]?_0x35453a(_0x50a1db[_0xcde2('0x63')][_0x124335][_0xcde2('0x65')]):_0x50a1db[_0xcde2('0x63')][_0x124335][_0xcde2('0x3f')]+'\x20'+_0x50a1db['rules'][_0x124335][_0xcde2('0x66')]+(_0x109472(_0x50a1db[_0xcde2('0x63')][_0x124335]['condition'])?'\x20'+_0x50a1db[_0xcde2('0x63')][_0x124335][_0xcde2('0x67')]:'');}return _0x585165+')';};var _0x2bc67c={'where':{'id':_0x1085d2[_0xcde2('0x45')]['id']}},_0x5aaa3f,_0x1efcbd,_0x1253c6,_0x2ce985,_0x3b1ca7;_0x2bc67c=_[_0xcde2('0x3a')]({},_0x2bc67c,_0x1085d2[_0xcde2('0x40')]);return db[_0xcde2('0x29')][_0xcde2('0x50')](_0x2bc67c)[_0xcde2('0x22')](function(_0x3b0961){if(_0x3b0961){_0x5aaa3f=_0x3b0961;return _0x3b0961['getFields']();}return null;})['then'](function(_0x39c723){if(_0x39c723){if(!_0x39c723[_0xcde2('0x32')]){throw new db[(_0xcde2('0x68'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1efcbd=_0x39c723;return db['AnalyticMetric'][_0xcde2('0x41')]({'raw':!![]});}return null;})[_0xcde2('0x22')](function(_0x161a8b){if(_0x161a8b){_0x1253c6=_[_0xcde2('0x69')](_0x161a8b,'id');var _0x325b51;var _0x333cbb=squel['select']();_0x333cbb['from'](_0x5aaa3f[_0xcde2('0x6a')]);for(var _0xa66188=0x0;_0xa66188<_0x1efcbd[_0xcde2('0x32')];_0xa66188+=0x1){_0x325b51=_0x1efcbd[_0xa66188][_0xcde2('0x6b')]?_0x1253c6[_0x1efcbd[_0xa66188][_0xcde2('0x6b')]][_0xcde2('0x6c')]:_0x1efcbd[_0xa66188][_0xcde2('0x3f')];_0x325b51=_0x1efcbd[_0xa66188][_0xcde2('0x6d')]?_[_0xcde2('0x6e')](_0x8eddd4[_0x1efcbd[_0xa66188][_0xcde2('0x6d')]],'%s',_0x325b51):_0x325b51;_0x325b51=_0x1efcbd[_0xa66188][_0xcde2('0x6f')]?_[_0xcde2('0x6e')](_0x541a70[_0x1efcbd[_0xa66188][_0xcde2('0x6f')]],'%s',_0x325b51):_0x325b51;if(_0x1efcbd[_0xa66188][_0xcde2('0x70')]){_0x333cbb[_0xcde2('0x65')](_0x325b51);}_0x1efcbd[_0xa66188][_0xcde2('0x71')]&&_0x333cbb[_0xcde2('0x35')](_0x325b51,_0x1efcbd[_0xa66188][_0xcde2('0x71')]===_0xcde2('0x72')?![]:!![]);_0x333cbb[_0xcde2('0x3f')](_0x325b51,_0x1efcbd[_0xa66188]['alias']||_0x325b51);}if(_0x5aaa3f[_0xcde2('0x73')]){_0x5aaa3f[_0xcde2('0x73')]=JSON[_0xcde2('0x74')](_0x5aaa3f[_0xcde2('0x73')]);for(var _0x912306=0x0;_0x912306<_0x5aaa3f['joins'][_0xcde2('0x32')];_0x912306+=0x1){if(_0x5aaa3f['joins'][_0x912306][_0xcde2('0x3c')]&&_[_0xcde2('0x5e')](_0x418dd1,_0x5aaa3f[_0xcde2('0x73')][_0x912306][_0xcde2('0x3c')])&&_0x5aaa3f[_0xcde2('0x73')][_0x912306][_0xcde2('0x75')]&&_0x5aaa3f[_0xcde2('0x73')][_0x912306]['foreignTable']&&_0x5aaa3f['joins'][_0x912306][_0xcde2('0x76')]){_0x333cbb[_0x5aaa3f['joins'][_0x912306][_0xcde2('0x3c')]](_0x5aaa3f[_0xcde2('0x73')][_0x912306][_0xcde2('0x77')],null,util[_0xcde2('0x6f')](_0xcde2('0x78'),_0x5aaa3f[_0xcde2('0x6a')],_0x5aaa3f[_0xcde2('0x73')][_0x912306]['parentKey'],_0x5aaa3f[_0xcde2('0x73')][_0x912306][_0xcde2('0x77')],_0x5aaa3f[_0xcde2('0x73')][_0x912306][_0xcde2('0x76')]));}}}if(_0x5aaa3f['conditions']){_0x5aaa3f[_0xcde2('0x79')]=JSON[_0xcde2('0x74')](_0x5aaa3f[_0xcde2('0x79')]);_0x333cbb[_0xcde2('0x37')](_0x35453a(_0x5aaa3f[_0xcde2('0x79')][_0xcde2('0x65')]));}_0x3b1ca7=_0x333cbb[_0xcde2('0x7a')]();_0x333cbb[_0xcde2('0x1d')](_0x50d2bf);_0x333cbb[_0xcde2('0x1c')](0x0);logger[_0xcde2('0x7b')](_0xcde2('0x7c'),_0x333cbb[_0xcde2('0x7d')]());return db[_0xcde2('0x7e')]['query'](_0x333cbb[_0xcde2('0x7d')](),{'type':db[_0xcde2('0x7e')][_0xcde2('0x7f')][_0xcde2('0x80')]});}})[_0xcde2('0x22')](respondWithResult(_0x10d6ab,null))[_0xcde2('0x43')](handleError(_0x10d6ab,null));};function runReport(_0x42493d,_0x9ed7e6,_0x422fec){var _0x27ffe1=_0x9ed7e6[_0xcde2('0x25')];var _0x18b0a1=0xa;var _0x2ac055=[_0xcde2('0x81'),_0xcde2('0x82'),_0xcde2('0x51'),'cross_join'];var _0x598fdd={'SUM':_0xcde2('0x53'),'COUNT':_0xcde2('0x54'),'COUNT DISTINCT':_0xcde2('0x55'),'MAX':_0xcde2('0x83'),'MIN':'MIN(%s)','AVG':_0xcde2('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xcde2('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x476e2f={'SEC_TO_TIME':_0xcde2('0x84'),'DATE':'DATE(%s)','HOUR':_0xcde2('0x5b'),'ROUND':_0xcde2('0x5c'),'UNIX_TIMESTAMP':_0xcde2('0x5d')};var _0x59d195=function(_0x1bbc7e){return!_[_0xcde2('0x5e')]([_0xcde2('0x5f'),_0xcde2('0x60'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1bbc7e);};var _0xc70ceb=function(_0x3fa065){if(!_0x3fa065||!_0x3fa065[_0xcde2('0x63')][_0xcde2('0x32')]){return'';}for(var _0x335a54='(',_0xddfade=0x0;_0xddfade<_0x3fa065['rules'][_0xcde2('0x32')];_0xddfade+=0x1){_0xddfade>0x0&&(_0x335a54+='\x20'+_0x3fa065[_0xcde2('0x64')]+'\x20');_0x335a54+=_0x3fa065[_0xcde2('0x63')][_0xddfade][_0xcde2('0x65')]?_0xc70ceb(_0x3fa065[_0xcde2('0x63')][_0xddfade][_0xcde2('0x65')]):_0x3fa065[_0xcde2('0x63')][_0xddfade]['field']+'\x20'+_0x3fa065[_0xcde2('0x63')][_0xddfade][_0xcde2('0x66')]+(_0x59d195(_0x3fa065['rules'][_0xddfade][_0xcde2('0x66')])?'\x20'+_0x3fa065[_0xcde2('0x63')][_0xddfade][_0xcde2('0x67')]:'');}return _0x335a54+')';};var _0x55c35f={'where':{'id':_0x42493d['id']}},_0x2e0684,_0x27e039,_0x482093,_0x4a8e17,_0x4b44c1;_0x55c35f=_[_0xcde2('0x3a')]({},_0x55c35f,_0x422fec);return db[_0xcde2('0x29')]['find'](_0x55c35f)[_0xcde2('0x22')](function(_0x5e5437){if(_0x5e5437){_0x2e0684=_0x5e5437;return _0x5e5437['getFields']();}return null;})[_0xcde2('0x22')](function(_0x243504){if(_0x243504){if(!_0x243504[_0xcde2('0x32')]){throw new db['Sequelize'][(_0xcde2('0x85'))](_0xcde2('0x86'),0x193);}_0x27e039=_0x243504;return db[_0xcde2('0x87')][_0xcde2('0x41')]({'raw':!![]});}return null;})[_0xcde2('0x22')](function(_0x191ee9){if(_0x191ee9){_0x482093=_[_0xcde2('0x69')](_0x191ee9,'id');var _0x540673;var _0x59d539=squel[_0xcde2('0x88')]();_0x59d539[_0xcde2('0x89')](_0x2e0684[_0xcde2('0x6a')]);for(var _0xc61e4=0x0;_0xc61e4<_0x27e039[_0xcde2('0x32')];_0xc61e4+=0x1){_0x540673=_0x27e039[_0xc61e4]['MetricId']?_0x482093[_0x27e039[_0xc61e4][_0xcde2('0x6b')]]['metric']:_0x27e039[_0xc61e4]['field'];_0x540673=_0x27e039[_0xc61e4][_0xcde2('0x6d')]?_['replace'](_0x598fdd[_0x27e039[_0xc61e4]['function']],'%s',_0x540673):_0x540673;_0x540673=_0x27e039[_0xc61e4][_0xcde2('0x6f')]?_[_0xcde2('0x6e')](_0x476e2f[_0x27e039[_0xc61e4][_0xcde2('0x6f')]],'%s',_0x540673):_0x540673;if(_0x27e039[_0xc61e4][_0xcde2('0x70')]){_0x59d539[_0xcde2('0x65')](_0x540673);}_0x27e039[_0xc61e4]['orderBy']&&_0x59d539[_0xcde2('0x35')](_0x540673,_0x27e039[_0xc61e4]['orderBy']===_0xcde2('0x72')?![]:!![]);_0x59d539[_0xcde2('0x3f')](_0x540673,_0x27e039[_0xc61e4][_0xcde2('0x8a')]||_0x540673);}if(_0x2e0684[_0xcde2('0x73')]){_0x2e0684['joins']=JSON['parse'](_0x2e0684['joins']);for(var _0x472f71=0x0;_0x472f71<_0x2e0684['joins']['length'];_0x472f71+=0x1){if(_0x2e0684[_0xcde2('0x73')][_0x472f71][_0xcde2('0x3c')]&&_[_0xcde2('0x5e')](_0x2ac055,_0x2e0684[_0xcde2('0x73')][_0x472f71][_0xcde2('0x3c')])&&_0x2e0684[_0xcde2('0x73')][_0x472f71][_0xcde2('0x75')]&&_0x2e0684['joins'][_0x472f71][_0xcde2('0x77')]&&_0x2e0684[_0xcde2('0x73')][_0x472f71][_0xcde2('0x76')]){_0x59d539[_0x2e0684[_0xcde2('0x73')][_0x472f71][_0xcde2('0x3c')]](_0x2e0684[_0xcde2('0x73')][_0x472f71][_0xcde2('0x77')],null,util['format'](_0xcde2('0x78'),_0x2e0684['table'],_0x2e0684['joins'][_0x472f71][_0xcde2('0x75')],_0x2e0684[_0xcde2('0x73')][_0x472f71][_0xcde2('0x77')],_0x2e0684[_0xcde2('0x73')][_0x472f71][_0xcde2('0x76')]));}}}if(_0x2e0684[_0xcde2('0x79')]){_0x2e0684[_0xcde2('0x79')]=JSON['parse'](_0x2e0684[_0xcde2('0x79')]);_0x59d539[_0xcde2('0x37')](_0xc70ceb(_0x2e0684[_0xcde2('0x79')]['group']));}_0x4b44c1=_0x59d539[_0xcde2('0x7a')]();_0x59d539[_0xcde2('0x1d')](_0x18b0a1);_0x59d539['offset'](0x0);logger['debug'](_0xcde2('0x7c'),_0x59d539[_0xcde2('0x7d')]());return db[_0xcde2('0x7e')][_0xcde2('0x2c')](_0x59d539[_0xcde2('0x7d')](),{'type':db['sequelize']['QueryTypes'][_0xcde2('0x80')]});}})['then'](function(_0x26a4dd){if(!_0x26a4dd[_0xcde2('0x32')]){throw new db[(_0xcde2('0x68'))][(_0xcde2('0x85'))](_0xcde2('0x8b'),0xcc);}if(_0x9ed7e6['output']===_0xcde2('0x8c')){return null;}var _0x3e3fec=_[_0xcde2('0x3a')](_0x9ed7e6,{'name':_0x9ed7e6['fullPath']||_0x9ed7e6['name']||_0x2e0684[_0xcde2('0x25')],'basename':_0x27ffe1,'savename':util['format'](_0xcde2('0x8d'),_0x9ed7e6[_0xcde2('0x25')]||_0x2e0684[_0xcde2('0x25')],require(_0xcde2('0x8e'))[_0xcde2('0x8f')](0x4),_0x9ed7e6[_0xcde2('0x90')]||_0xcde2('0x91')),'reportId':_0x2e0684['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0xcde2('0x47')](_0x3e3fec,{'raw':!![]});})[_0xcde2('0x22')](function(_0x417795){if(_0x2e0684['table']==='cdr'){_0x4b44c1[_0xcde2('0x37')](_0x2e0684[_0xcde2('0x6a')]+_0xcde2('0x92'),_0x9ed7e6['startDate'],_0x9ed7e6[_0xcde2('0x93')]);}else{_0x4b44c1[_0xcde2('0x37')](_0x2e0684['table']+_0xcde2('0x94'),_0x9ed7e6[_0xcde2('0x95')],_0x9ed7e6[_0xcde2('0x93')]);}if(_0x417795){logger[_0xcde2('0x96')](_0xcde2('0x97'),_0x4b44c1[_0xcde2('0x7d')]());require(_0xcde2('0x98'))[_0xcde2('0x99')](path['join'](__dirname,_0xcde2('0x9a'),_0x417795[_0xcde2('0x90')]),[_0x417795['id'],_0x4b44c1[_0xcde2('0x7d')](),path['join'](__dirname,_0xcde2('0x9b'),_0x417795[_0xcde2('0x9c')]),_0x27ffe1]);return _0x417795;}else{var _0x168f5c=squel[_0xcde2('0x88')]();_0x168f5c['from']('('+_0x4b44c1[_0xcde2('0x7d')]()+')',_0xcde2('0x9d'));_0x168f5c[_0xcde2('0x3f')](_0xcde2('0x9e'),_0xcde2('0x1b'));_0x4b44c1['limit'](_0x9ed7e6['limit']||_0x18b0a1);_0x4b44c1['offset'](_0x9ed7e6[_0xcde2('0x1c')]||0x0);return db[_0xcde2('0x7e')]['query'](_0x168f5c[_0xcde2('0x7d')](),{'type':db[_0xcde2('0x7e')][_0xcde2('0x7f')]['SELECT']})[_0xcde2('0x22')](function(_0xd33254){if(!_0xd33254[_0xcde2('0x32')]){_0x4a8e17=0x0;}else{_0x4a8e17=_0xd33254[0x0]['count']||0x0;}return db[_0xcde2('0x7e')][_0xcde2('0x2c')](_0x4b44c1[_0xcde2('0x7d')](),{'type':db[_0xcde2('0x7e')][_0xcde2('0x7f')][_0xcde2('0x80')]});})[_0xcde2('0x22')](function(_0xe2855f){return{'rows':_0xe2855f||[],'count':_0x4a8e17};});}});}exports[_0xcde2('0x9f')]=function(_0x406b1a,_0x2e70f8){return runReport(_0x406b1a[_0xcde2('0x45')],_0x406b1a['query'],_0x406b1a[_0xcde2('0x40')])['then'](respondWithResult(_0x2e70f8,null))[_0xcde2('0x43')](handleError(_0x2e70f8,null));};exports['runReport']=runReport;exports[_0xcde2('0x2c')]=function(_0x555b3e,_0x5c5c33){var _0x18e913=0xa;var _0x1b1c10=[_0xcde2('0x81'),_0xcde2('0x82'),_0xcde2('0x51'),_0xcde2('0x52')];var _0x532842={'SUM':_0xcde2('0x53'),'COUNT':_0xcde2('0x54'),'COUNT DISTINCT':_0xcde2('0x55'),'MAX':_0xcde2('0x83'),'MIN':_0xcde2('0x56'),'AVG':_0xcde2('0x57'),'GROUP_CONCAT':_0xcde2('0x58'),'GROUP_CONCAT ASC':_0xcde2('0x59'),'GROUP_CONCAT DESC':_0xcde2('0x5a')};var _0x231ea8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcde2('0xa0'),'HOUR':_0xcde2('0x5b'),'ROUND':_0xcde2('0x5c'),'UNIX_TIMESTAMP':_0xcde2('0x5d')};var _0x27a6f4=function(_0x15d947){return!_['includes']([_0xcde2('0x5f'),_0xcde2('0x60'),_0xcde2('0x61'),_0xcde2('0x62')],_0x15d947);};var _0x33ac3a=function(_0x27ab58){if(!_0x27ab58||!_0x27ab58[_0xcde2('0x63')][_0xcde2('0x32')]){return'';}for(var _0x4ee3d6='(',_0x5785bf=0x0;_0x5785bf<_0x27ab58[_0xcde2('0x63')][_0xcde2('0x32')];_0x5785bf+=0x1){_0x5785bf>0x0&&(_0x4ee3d6+='\x20'+_0x27ab58[_0xcde2('0x64')]+'\x20');_0x4ee3d6+=_0x27ab58[_0xcde2('0x63')][_0x5785bf][_0xcde2('0x65')]?_0x33ac3a(_0x27ab58[_0xcde2('0x63')][_0x5785bf][_0xcde2('0x65')]):_0x27ab58[_0xcde2('0x63')][_0x5785bf][_0xcde2('0x3f')]+'\x20'+_0x27ab58[_0xcde2('0x63')][_0x5785bf]['condition']+(_0x27a6f4(_0x27ab58[_0xcde2('0x63')][_0x5785bf][_0xcde2('0x66')])?'\x20'+_0x27ab58[_0xcde2('0x63')][_0x5785bf][_0xcde2('0x67')]:'');}return _0x4ee3d6+')';};var _0x150020={'where':{'id':_0x555b3e[_0xcde2('0x45')]['id']}},_0xb4e2e3,_0x5b3823,_0x2cbb7e,_0x49db7b,_0xbb9148;_0x150020=_[_0xcde2('0x3a')]({},_0x150020,_0x555b3e[_0xcde2('0x40')]);return db['AnalyticDefaultReport'][_0xcde2('0x50')](_0x150020)[_0xcde2('0x22')](function(_0x3ab370){if(_0x3ab370){_0xb4e2e3=_0x3ab370;return _0x3ab370[_0xcde2('0xa1')]();}return null;})[_0xcde2('0x22')](function(_0x50d99e){if(_0x50d99e){if(!_0x50d99e[_0xcde2('0x32')]){throw new db[(_0xcde2('0x68'))][(_0xcde2('0x85'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5b3823=_0x50d99e;return db[_0xcde2('0x87')][_0xcde2('0x41')]({'raw':!![]});}return null;})[_0xcde2('0x22')](function(_0x5ae43c){if(_0x5ae43c){_0x2cbb7e=_['keyBy'](_0x5ae43c,'id');var _0x30ebc6;var _0x28e5c1=squel[_0xcde2('0x88')]();_0x28e5c1[_0xcde2('0x89')](_0xb4e2e3['table']);for(var _0x2cd4f2=0x0;_0x2cd4f2<_0x5b3823['length'];_0x2cd4f2+=0x1){_0x30ebc6=_0x5b3823[_0x2cd4f2][_0xcde2('0x6b')]?_0x2cbb7e[_0x5b3823[_0x2cd4f2][_0xcde2('0x6b')]]['metric']:_0x5b3823[_0x2cd4f2][_0xcde2('0x3f')];_0x30ebc6=_0x5b3823[_0x2cd4f2][_0xcde2('0x6d')]?_['replace'](_0x532842[_0x5b3823[_0x2cd4f2][_0xcde2('0x6d')]],'%s',_0x30ebc6):_0x30ebc6;_0x30ebc6=_0x5b3823[_0x2cd4f2][_0xcde2('0x6f')]?_['replace'](_0x231ea8[_0x5b3823[_0x2cd4f2]['format']],'%s',_0x30ebc6):_0x30ebc6;if(_0x5b3823[_0x2cd4f2]['groupBy']){_0x28e5c1['group'](_0x30ebc6);}_0x5b3823[_0x2cd4f2][_0xcde2('0x71')]&&_0x28e5c1[_0xcde2('0x35')](_0x30ebc6,_0x5b3823[_0x2cd4f2][_0xcde2('0x71')]==='DESC'?![]:!![]);_0x28e5c1[_0xcde2('0x3f')](_0x30ebc6,_0x5b3823[_0x2cd4f2][_0xcde2('0x8a')]||_0x30ebc6);}if(_0xb4e2e3[_0xcde2('0x73')]){_0xb4e2e3[_0xcde2('0x73')]=JSON[_0xcde2('0x74')](_0xb4e2e3[_0xcde2('0x73')]);for(var _0x133d71=0x0;_0x133d71<_0xb4e2e3[_0xcde2('0x73')][_0xcde2('0x32')];_0x133d71+=0x1){if(_0xb4e2e3[_0xcde2('0x73')][_0x133d71][_0xcde2('0x3c')]&&_[_0xcde2('0x5e')](_0x1b1c10,_0xb4e2e3[_0xcde2('0x73')][_0x133d71][_0xcde2('0x3c')])&&_0xb4e2e3[_0xcde2('0x73')][_0x133d71][_0xcde2('0x75')]&&_0xb4e2e3['joins'][_0x133d71]['foreignTable']&&_0xb4e2e3[_0xcde2('0x73')][_0x133d71][_0xcde2('0x76')]){_0x28e5c1[_0xb4e2e3[_0xcde2('0x73')][_0x133d71]['type']](_0xb4e2e3['joins'][_0x133d71]['foreignTable'],null,util[_0xcde2('0x6f')](_0xcde2('0x78'),_0xb4e2e3[_0xcde2('0x6a')],_0xb4e2e3[_0xcde2('0x73')][_0x133d71][_0xcde2('0x75')],_0xb4e2e3['joins'][_0x133d71][_0xcde2('0x77')],_0xb4e2e3[_0xcde2('0x73')][_0x133d71][_0xcde2('0x76')]));}}}if(_0xb4e2e3[_0xcde2('0x79')]){_0xb4e2e3[_0xcde2('0x79')]=JSON[_0xcde2('0x74')](_0xb4e2e3['conditions']);_0x28e5c1[_0xcde2('0x37')](_0x33ac3a(_0xb4e2e3['conditions'][_0xcde2('0x65')]));}_0xbb9148=_0x28e5c1['clone']();_0x28e5c1['limit'](_0x18e913);_0x28e5c1['offset'](0x0);logger[_0xcde2('0x7b')]('Limited\x20Query:',_0x28e5c1['toString']());return db[_0xcde2('0x7e')]['query'](_0x28e5c1[_0xcde2('0x7d')](),{'type':db[_0xcde2('0x7e')][_0xcde2('0x7f')][_0xcde2('0x80')]});}})[_0xcde2('0x22')](function(){return{'sql':_0xbb9148[_0xcde2('0x7d')]()};})[_0xcde2('0x22')](respondWithResult(_0x5c5c33,null))[_0xcde2('0x43')](handleError(_0x5c5c33,null));}; \ No newline at end of file +var _0x9354=['ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','get','DefaultReports','error','stack','name','AnalyticDefaultReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','map','type','key','VIRTUAL','filter','include','findAll','rows','catch','params','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%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','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','right_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','table','QueryTypes','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','countTable','run','COUNT(%s)','ROUND(%s)','operator','clone','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x109c6d,_0xc7eac){var _0x375801=function(_0x6129f9){while(--_0x6129f9){_0x109c6d['push'](_0x109c6d['shift']());}};_0x375801(++_0xc7eac);}(_0x9354,0x96));var _0x4935=function(_0x35825e,_0x657421){_0x35825e=_0x35825e-0x0;var _0x4f4d90=_0x9354[_0x35825e];return _0x4f4d90;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4935('0x0'));var rimraf=require(_0x4935('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4935('0x2'));var rp=require(_0x4935('0x3'));var moment=require(_0x4935('0x4'));var BPromise=require(_0x4935('0x5'));var Mustache=require('mustache');var util=require(_0x4935('0x6'));var path=require(_0x4935('0x7'));var sox=require(_0x4935('0x8'));var csv=require(_0x4935('0x9'));var ejs=require(_0x4935('0xa'));var fs=require('fs');var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x9'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var hardwareService=require(_0x4935('0x13'));var logger=require(_0x4935('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4935('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4823d0,_0x3f6eef){_0x3f6eef=_0x3f6eef||0xcc;return function(_0x32916f){if(_0x32916f){return _0x4823d0[_0x4935('0x16')](_0x3f6eef);}return _0x4823d0[_0x4935('0x17')](_0x3f6eef)[_0x4935('0x18')]();};}function respondWithResult(_0x2bf1b3,_0x102c63){_0x102c63=_0x102c63||0xc8;return function(_0x3a7c30){if(_0x3a7c30){return _0x2bf1b3[_0x4935('0x17')](_0x102c63)[_0x4935('0x19')](_0x3a7c30);}};}function respondWithFilteredResult(_0x1ce1ba,_0x1799e4){return function(_0xa41961){if(_0xa41961){var _0x3652c4=_0xa41961[_0x4935('0x1a')],_0x24cc99=_0x1799e4[_0x4935('0x1b')],_0x395a43=_0x1799e4[_0x4935('0x1b')]+_0x1799e4[_0x4935('0x1c')],_0x57d7ed;if(_0x395a43>=_0x3652c4){_0x395a43=_0x3652c4;_0x57d7ed=0xc8;}else{_0x57d7ed=0xce;}_0x1ce1ba[_0x4935('0x17')](_0x57d7ed);return _0x1ce1ba[_0x4935('0x1d')]('Content-Range',_0x24cc99+'-'+_0x395a43+'/'+_0x3652c4)[_0x4935('0x19')](_0xa41961);}return null;};}function patchUpdates(_0x145277){return function(_0x4fe356){try{jsonpatch[_0x4935('0x1e')](_0x4fe356,_0x145277,!![]);}catch(_0x10407f){return BPromise[_0x4935('0x1f')](_0x10407f);}return _0x4fe356['save']();};}function saveUpdates(_0x4d58aa,_0x125688){return function(_0x6b849f){if(_0x6b849f){return _0x6b849f[_0x4935('0x20')](_0x4d58aa)[_0x4935('0x21')](function(_0x41d76e){return _0x41d76e;});}return null;};}function removeEntity(_0x16ab7c,_0x7a50ab){return function(_0xe482a5){if(_0xe482a5){return _0xe482a5['destroy']()[_0x4935('0x21')](function(){var _0x320d81=_0xe482a5[_0x4935('0x22')]({'plain':!![]});var _0x2c701f=_0x4935('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2c701f,'resourceId':_0x320d81['id']}})[_0x4935('0x21')](function(){return _0xe482a5;});})[_0x4935('0x21')](function(){_0x16ab7c[_0x4935('0x17')](0xcc)[_0x4935('0x18')]();});}};}function handleEntityNotFound(_0x344e51,_0x1c37ba){return function(_0x3784f9){if(!_0x3784f9){_0x344e51[_0x4935('0x16')](0x194);}return _0x3784f9;};}function handleError(_0x2e1583,_0xf4abb2){_0xf4abb2=_0xf4abb2||0x1f4;return function(_0x1d08b5){logger[_0x4935('0x24')](_0x1d08b5[_0x4935('0x25')]);if(_0x1d08b5[_0x4935('0x26')]){delete _0x1d08b5[_0x4935('0x26')];}_0x2e1583['status'](_0xf4abb2)['send'](_0x1d08b5);};}exports['index']=function(_0x1fc218,_0x76ea7d){var _0x4f1163={},_0x3f0707={},_0x20755a={'count':0x0,'rows':[]};var _0x24a3b6=db[_0x4935('0x27')][_0x4935('0x28')];_0x3f0707[_0x4935('0x29')]=_[_0x4935('0x2a')](_0x24a3b6);_0x3f0707[_0x4935('0x2b')]=_['keys'](_0x1fc218[_0x4935('0x2b')]);_0x3f0707[_0x4935('0x2c')]=_['intersection'](_0x3f0707['model'],_0x3f0707[_0x4935('0x2b')]);_0x4f1163['attributes']=_[_0x4935('0x2d')](_0x3f0707[_0x4935('0x29')],qs[_0x4935('0x2e')](_0x1fc218['query']['fields']));_0x4f1163[_0x4935('0x2f')]=_0x4f1163[_0x4935('0x2f')]['length']?_0x4f1163[_0x4935('0x2f')]:_0x3f0707[_0x4935('0x29')];if(!_0x1fc218[_0x4935('0x2b')][_0x4935('0x30')](_0x4935('0x31'))){_0x4f1163['limit']=qs['limit'](_0x1fc218[_0x4935('0x2b')][_0x4935('0x1c')]);_0x4f1163['offset']=qs['offset'](_0x1fc218[_0x4935('0x2b')]['offset']);}_0x4f1163[_0x4935('0x32')]=qs[_0x4935('0x33')](_0x1fc218[_0x4935('0x2b')][_0x4935('0x33')]);_0x4f1163[_0x4935('0x34')]=qs[_0x4935('0x2c')](_['pick'](_0x1fc218[_0x4935('0x2b')],_0x3f0707['filters']));if(_0x1fc218[_0x4935('0x2b')]['filter']){_0x4f1163[_0x4935('0x34')]=_['merge'](_0x4f1163[_0x4935('0x34')],{'$or':_[_0x4935('0x35')](_0x24a3b6,function(_0x352679){if(_0x352679[_0x4935('0x36')][_0x4935('0x37')]!==_0x4935('0x38')){var _0x441332={};_0x441332[_0x352679['field']]={'$like':'%'+_0x1fc218['query'][_0x4935('0x39')]+'%'};return _0x441332;}})});}_0x4f1163=_['merge']({},_0x4f1163,_0x1fc218['options']);var _0x1552b2={'where':_0x4f1163['where']};return db[_0x4935('0x27')][_0x4935('0x1a')](_0x1552b2)[_0x4935('0x21')](function(_0x99b7c5){_0x20755a[_0x4935('0x1a')]=_0x99b7c5;if(_0x1fc218['query']['includeAll']){_0x4f1163[_0x4935('0x3a')]=[{'all':!![]}];}return db[_0x4935('0x27')][_0x4935('0x3b')](_0x4f1163);})[_0x4935('0x21')](function(_0x4d9436){_0x20755a[_0x4935('0x3c')]=_0x4d9436;return _0x20755a;})[_0x4935('0x21')](respondWithFilteredResult(_0x76ea7d,_0x4f1163))[_0x4935('0x3d')](handleError(_0x76ea7d,null));};exports['show']=function(_0x4e94f6,_0x213230){var _0xe7f002={'raw':!![],'where':{'id':_0x4e94f6[_0x4935('0x3e')]['id']}},_0x493588={};_0x493588[_0x4935('0x29')]=_[_0x4935('0x2a')](db[_0x4935('0x27')]['rawAttributes']);_0x493588['query']=_[_0x4935('0x2a')](_0x4e94f6[_0x4935('0x2b')]);_0x493588['filters']=_[_0x4935('0x2d')](_0x493588[_0x4935('0x29')],_0x493588[_0x4935('0x2b')]);_0xe7f002['attributes']=_[_0x4935('0x2d')](_0x493588[_0x4935('0x29')],qs[_0x4935('0x2e')](_0x4e94f6[_0x4935('0x2b')][_0x4935('0x2e')]));_0xe7f002[_0x4935('0x2f')]=_0xe7f002[_0x4935('0x2f')][_0x4935('0x3f')]?_0xe7f002[_0x4935('0x2f')]:_0x493588[_0x4935('0x29')];if(_0x4e94f6[_0x4935('0x2b')][_0x4935('0x40')]){_0xe7f002[_0x4935('0x3a')]=[{'all':!![]}];}_0xe7f002=_[_0x4935('0x41')]({},_0xe7f002,_0x4e94f6[_0x4935('0x42')]);return db[_0x4935('0x27')][_0x4935('0x43')](_0xe7f002)[_0x4935('0x21')](handleEntityNotFound(_0x213230,null))['then'](respondWithResult(_0x213230,null))[_0x4935('0x3d')](handleError(_0x213230,null));};exports['create']=function(_0x13d78c,_0x144ac5){return db[_0x4935('0x27')][_0x4935('0x44')](_0x13d78c['body'],{})[_0x4935('0x21')](function(_0x9c8bad){var _0x2b34d5=_0x13d78c[_0x4935('0x45')][_0x4935('0x22')]({'plain':!![]});if(!_0x2b34d5)throw new Error(_0x4935('0x46'));if(_0x2b34d5[_0x4935('0x47')]===_0x4935('0x45')){var _0x29b932=_0x9c8bad[_0x4935('0x22')]({'plain':!![]});var _0x5d48dd=_0x4935('0x48');return db[_0x4935('0x49')]['find']({'where':{'name':_0x5d48dd,'userProfileId':_0x2b34d5[_0x4935('0x4a')]},'raw':!![]})[_0x4935('0x21')](function(_0x697a3c){if(_0x697a3c&&_0x697a3c[_0x4935('0x4b')]===0x0){return db[_0x4935('0x4c')][_0x4935('0x44')]({'name':_0x29b932[_0x4935('0x26')],'resourceId':_0x29b932['id'],'type':_0x4935('0x23'),'sectionId':_0x697a3c['id']},{})['then'](function(){return _0x9c8bad;});}else{return _0x9c8bad;}})[_0x4935('0x3d')](function(_0x5609b6){logger['error'](_0x4935('0x4d'),_0x5609b6);throw _0x5609b6;});}return _0x9c8bad;})[_0x4935('0x21')](respondWithResult(_0x144ac5,0xc9))[_0x4935('0x3d')](handleError(_0x144ac5,null));};exports[_0x4935('0x20')]=function(_0x2dd30f,_0x487cf3){if(_0x2dd30f[_0x4935('0x4e')]['id']){delete _0x2dd30f[_0x4935('0x4e')]['id'];}return db[_0x4935('0x27')][_0x4935('0x43')]({'where':{'id':_0x2dd30f[_0x4935('0x3e')]['id']}})[_0x4935('0x21')](handleEntityNotFound(_0x487cf3,null))[_0x4935('0x21')](saveUpdates(_0x2dd30f[_0x4935('0x4e')],null))[_0x4935('0x21')](respondWithResult(_0x487cf3,null))[_0x4935('0x3d')](handleError(_0x487cf3,null));};exports['destroy']=function(_0x24b83b,_0x4e99bb){return db[_0x4935('0x27')][_0x4935('0x43')]({'where':{'id':_0x24b83b['params']['id']}})[_0x4935('0x21')](handleEntityNotFound(_0x4e99bb,null))['then'](removeEntity(_0x4e99bb,null))['catch'](handleError(_0x4e99bb,null));};exports['preview']=function(_0x126f53,_0x2e66e4){var _0x2f946d=0xa;var _0x311af0=[_0x4935('0x4f'),'left_join','right_join',_0x4935('0x50')];var _0x3020e5={'SUM':_0x4935('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4935('0x52'),'MAX':_0x4935('0x53'),'MIN':_0x4935('0x54'),'AVG':_0x4935('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4935('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5093a5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4935('0x57'),'HOUR':_0x4935('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4935('0x59')};var _0x395eba=function(_0x57b448){return!_[_0x4935('0x5a')]([_0x4935('0x5b'),_0x4935('0x5c'),_0x4935('0x5d'),_0x4935('0x5e')],_0x57b448);};var _0x2d21f0=function(_0x1aba4f){if(!_0x1aba4f||!_0x1aba4f['rules'][_0x4935('0x3f')]){return'';}for(var _0x518788='(',_0x4800c7=0x0;_0x4800c7<_0x1aba4f[_0x4935('0x5f')][_0x4935('0x3f')];_0x4800c7+=0x1){_0x4800c7>0x0&&(_0x518788+='\x20'+_0x1aba4f['operator']+'\x20');_0x518788+=_0x1aba4f['rules'][_0x4800c7][_0x4935('0x60')]?_0x2d21f0(_0x1aba4f[_0x4935('0x5f')][_0x4800c7][_0x4935('0x60')]):_0x1aba4f['rules'][_0x4800c7][_0x4935('0x61')]+'\x20'+_0x1aba4f['rules'][_0x4800c7][_0x4935('0x62')]+(_0x395eba(_0x1aba4f[_0x4935('0x5f')][_0x4800c7][_0x4935('0x62')])?'\x20'+_0x1aba4f[_0x4935('0x5f')][_0x4800c7][_0x4935('0x63')]:'');}return _0x518788+')';};var _0x4e97b0={'where':{'id':_0x126f53[_0x4935('0x3e')]['id']}},_0x1eb15d,_0x33d527,_0x5aef06,_0x103539,_0x2ae5ee;_0x4e97b0=_[_0x4935('0x41')]({},_0x4e97b0,_0x126f53[_0x4935('0x42')]);return db[_0x4935('0x27')][_0x4935('0x43')](_0x4e97b0)[_0x4935('0x21')](function(_0x15ebcc){if(_0x15ebcc){_0x1eb15d=_0x15ebcc;return _0x15ebcc[_0x4935('0x64')]();}return null;})[_0x4935('0x21')](function(_0x5d4435){if(_0x5d4435){if(!_0x5d4435[_0x4935('0x3f')]){throw new db[(_0x4935('0x65'))][(_0x4935('0x66'))](_0x4935('0x67'),0x193);}_0x33d527=_0x5d4435;return db[_0x4935('0x68')][_0x4935('0x3b')]({'raw':!![]});}return null;})[_0x4935('0x21')](function(_0x9023e){if(_0x9023e){_0x5aef06=_[_0x4935('0x69')](_0x9023e,'id');var _0x19d5d0;var _0x11502f=squel[_0x4935('0x6a')]();_0x11502f[_0x4935('0x6b')](_0x1eb15d['table']);for(var _0x5862ab=0x0;_0x5862ab<_0x33d527[_0x4935('0x3f')];_0x5862ab+=0x1){_0x19d5d0=_0x33d527[_0x5862ab][_0x4935('0x6c')]?_0x5aef06[_0x33d527[_0x5862ab]['MetricId']][_0x4935('0x6d')]:_0x33d527[_0x5862ab][_0x4935('0x61')];_0x19d5d0=_0x33d527[_0x5862ab]['function']?_['replace'](_0x3020e5[_0x33d527[_0x5862ab][_0x4935('0x6e')]],'%s',_0x19d5d0):_0x19d5d0;_0x19d5d0=_0x33d527[_0x5862ab][_0x4935('0x6f')]?_[_0x4935('0x70')](_0x5093a5[_0x33d527[_0x5862ab][_0x4935('0x6f')]],'%s',_0x19d5d0):_0x19d5d0;if(_0x33d527[_0x5862ab][_0x4935('0x71')]){_0x11502f['group'](_0x19d5d0);}_0x33d527[_0x5862ab][_0x4935('0x72')]&&_0x11502f[_0x4935('0x32')](_0x19d5d0,_0x33d527[_0x5862ab][_0x4935('0x72')]===_0x4935('0x73')?![]:!![]);_0x11502f['field'](_0x19d5d0,_0x33d527[_0x5862ab][_0x4935('0x74')]||_0x19d5d0);}if(_0x1eb15d['joins']){_0x1eb15d['joins']=JSON[_0x4935('0x75')](_0x1eb15d[_0x4935('0x76')]);for(var _0x531575=0x0;_0x531575<_0x1eb15d[_0x4935('0x76')][_0x4935('0x3f')];_0x531575+=0x1){if(_0x1eb15d[_0x4935('0x76')][_0x531575]['type']&&_[_0x4935('0x5a')](_0x311af0,_0x1eb15d['joins'][_0x531575]['type'])&&_0x1eb15d[_0x4935('0x76')][_0x531575][_0x4935('0x77')]&&_0x1eb15d[_0x4935('0x76')][_0x531575][_0x4935('0x78')]&&_0x1eb15d[_0x4935('0x76')][_0x531575][_0x4935('0x79')]){_0x11502f[_0x1eb15d[_0x4935('0x76')][_0x531575][_0x4935('0x36')]](_0x1eb15d['joins'][_0x531575][_0x4935('0x78')],null,util[_0x4935('0x6f')](_0x4935('0x7a'),_0x1eb15d['table'],_0x1eb15d['joins'][_0x531575][_0x4935('0x77')],_0x1eb15d[_0x4935('0x76')][_0x531575]['foreignTable'],_0x1eb15d[_0x4935('0x76')][_0x531575]['foreignKey']));}}}if(_0x1eb15d['conditions']){_0x1eb15d[_0x4935('0x7b')]=JSON[_0x4935('0x75')](_0x1eb15d[_0x4935('0x7b')]);_0x11502f['where'](_0x2d21f0(_0x1eb15d['conditions'][_0x4935('0x60')]));}_0x2ae5ee=_0x11502f['clone']();_0x11502f[_0x4935('0x1c')](_0x2f946d);_0x11502f['offset'](0x0);logger[_0x4935('0x7c')](_0x4935('0x7d'),_0x11502f[_0x4935('0x7e')]());return db[_0x4935('0x7f')][_0x4935('0x2b')](_0x11502f[_0x4935('0x7e')](),{'type':db[_0x4935('0x7f')]['QueryTypes'][_0x4935('0x80')]});}})['then'](respondWithResult(_0x2e66e4,null))[_0x4935('0x3d')](handleError(_0x2e66e4,null));};function runReport(_0x10e5ba,_0x5b6ee3,_0x3583ba){var _0x4fbed4=_0x5b6ee3[_0x4935('0x26')];var _0x402963=0xa;var _0x5345ff=['join','left_join',_0x4935('0x81'),'cross_join'];var _0x5c28f6={'SUM':_0x4935('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4935('0x52'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x4935('0x82'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4935('0x83')};var _0x29dfcf={'SEC_TO_TIME':_0x4935('0x84'),'DATE':_0x4935('0x57'),'HOUR':_0x4935('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4935('0x59')};var _0x1700e2=function(_0x539155){return!_[_0x4935('0x5a')]([_0x4935('0x5b'),'IS\x20NOT\x20NULL',_0x4935('0x5d'),_0x4935('0x5e')],_0x539155);};var _0x495114=function(_0x390767){if(!_0x390767||!_0x390767['rules'][_0x4935('0x3f')]){return'';}for(var _0x453bb1='(',_0x5435b0=0x0;_0x5435b0<_0x390767[_0x4935('0x5f')][_0x4935('0x3f')];_0x5435b0+=0x1){_0x5435b0>0x0&&(_0x453bb1+='\x20'+_0x390767['operator']+'\x20');_0x453bb1+=_0x390767['rules'][_0x5435b0][_0x4935('0x60')]?_0x495114(_0x390767[_0x4935('0x5f')][_0x5435b0]['group']):_0x390767[_0x4935('0x5f')][_0x5435b0][_0x4935('0x61')]+'\x20'+_0x390767[_0x4935('0x5f')][_0x5435b0][_0x4935('0x62')]+(_0x1700e2(_0x390767['rules'][_0x5435b0][_0x4935('0x62')])?'\x20'+_0x390767[_0x4935('0x5f')][_0x5435b0]['value']:'');}return _0x453bb1+')';};var _0x2f7897={'where':{'id':_0x10e5ba['id']}},_0x45f4b8,_0x30a109,_0x9429db,_0xc081fd,_0x1e3fc5;_0x2f7897=_[_0x4935('0x41')]({},_0x2f7897,_0x3583ba);return db[_0x4935('0x27')][_0x4935('0x43')](_0x2f7897)[_0x4935('0x21')](function(_0x34f3d4){if(_0x34f3d4){_0x45f4b8=_0x34f3d4;return _0x34f3d4['getFields']();}return null;})[_0x4935('0x21')](function(_0x3e8e54){if(_0x3e8e54){if(!_0x3e8e54[_0x4935('0x3f')]){throw new db[(_0x4935('0x65'))][(_0x4935('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x30a109=_0x3e8e54;return db[_0x4935('0x68')][_0x4935('0x3b')]({'raw':!![]});}return null;})['then'](function(_0xa08e30){if(_0xa08e30){_0x9429db=_[_0x4935('0x69')](_0xa08e30,'id');var _0x5474ea;var _0xdab2a0=squel[_0x4935('0x6a')]();_0xdab2a0[_0x4935('0x6b')](_0x45f4b8['table']);for(var _0x15d6d2=0x0;_0x15d6d2<_0x30a109[_0x4935('0x3f')];_0x15d6d2+=0x1){_0x5474ea=_0x30a109[_0x15d6d2][_0x4935('0x6c')]?_0x9429db[_0x30a109[_0x15d6d2][_0x4935('0x6c')]][_0x4935('0x6d')]:_0x30a109[_0x15d6d2]['field'];_0x5474ea=_0x30a109[_0x15d6d2][_0x4935('0x6e')]?_[_0x4935('0x70')](_0x5c28f6[_0x30a109[_0x15d6d2][_0x4935('0x6e')]],'%s',_0x5474ea):_0x5474ea;_0x5474ea=_0x30a109[_0x15d6d2][_0x4935('0x6f')]?_[_0x4935('0x70')](_0x29dfcf[_0x30a109[_0x15d6d2][_0x4935('0x6f')]],'%s',_0x5474ea):_0x5474ea;if(_0x30a109[_0x15d6d2]['groupBy']){_0xdab2a0[_0x4935('0x60')](_0x5474ea);}_0x30a109[_0x15d6d2][_0x4935('0x72')]&&_0xdab2a0[_0x4935('0x32')](_0x5474ea,_0x30a109[_0x15d6d2][_0x4935('0x72')]===_0x4935('0x73')?![]:!![]);_0xdab2a0[_0x4935('0x61')](_0x5474ea,_0x30a109[_0x15d6d2][_0x4935('0x74')]||_0x5474ea);}if(_0x45f4b8['joins']){_0x45f4b8[_0x4935('0x76')]=JSON[_0x4935('0x75')](_0x45f4b8[_0x4935('0x76')]);for(var _0xf12731=0x0;_0xf12731<_0x45f4b8[_0x4935('0x76')]['length'];_0xf12731+=0x1){if(_0x45f4b8['joins'][_0xf12731][_0x4935('0x36')]&&_[_0x4935('0x5a')](_0x5345ff,_0x45f4b8[_0x4935('0x76')][_0xf12731][_0x4935('0x36')])&&_0x45f4b8[_0x4935('0x76')][_0xf12731]['parentKey']&&_0x45f4b8[_0x4935('0x76')][_0xf12731][_0x4935('0x78')]&&_0x45f4b8[_0x4935('0x76')][_0xf12731]['foreignKey']){_0xdab2a0[_0x45f4b8[_0x4935('0x76')][_0xf12731][_0x4935('0x36')]](_0x45f4b8[_0x4935('0x76')][_0xf12731][_0x4935('0x78')],null,util[_0x4935('0x6f')](_0x4935('0x7a'),_0x45f4b8[_0x4935('0x85')],_0x45f4b8['joins'][_0xf12731][_0x4935('0x77')],_0x45f4b8['joins'][_0xf12731][_0x4935('0x78')],_0x45f4b8['joins'][_0xf12731]['foreignKey']));}}}if(_0x45f4b8[_0x4935('0x7b')]){_0x45f4b8['conditions']=JSON['parse'](_0x45f4b8[_0x4935('0x7b')]);_0xdab2a0[_0x4935('0x34')](_0x495114(_0x45f4b8['conditions'][_0x4935('0x60')]));}_0x1e3fc5=_0xdab2a0['clone']();_0xdab2a0[_0x4935('0x1c')](_0x402963);_0xdab2a0[_0x4935('0x1b')](0x0);logger[_0x4935('0x7c')](_0x4935('0x7d'),_0xdab2a0[_0x4935('0x7e')]());return db[_0x4935('0x7f')]['query'](_0xdab2a0[_0x4935('0x7e')](),{'type':db[_0x4935('0x7f')][_0x4935('0x86')]['SELECT']});}})[_0x4935('0x21')](function(_0xea6cf6){if(!_0xea6cf6[_0x4935('0x3f')]){throw new db['Sequelize'][(_0x4935('0x66'))](_0x4935('0x87'),0xcc);}if(_0x5b6ee3[_0x4935('0x88')]===_0x4935('0x89')){return null;}var _0x268999=_['merge'](_0x5b6ee3,{'name':_0x5b6ee3[_0x4935('0x8a')]||_0x5b6ee3['name']||_0x45f4b8[_0x4935('0x26')],'basename':_0x4fbed4,'savename':util['format'](_0x4935('0x8b'),_0x5b6ee3['name']||_0x45f4b8[_0x4935('0x26')],require(_0x4935('0x8c'))[_0x4935('0x8d')](0x4),_0x5b6ee3['output']||_0x4935('0x8e')),'reportId':_0x45f4b8['id'],'reportType':_0x4935('0x8f')});return db[_0x4935('0x90')][_0x4935('0x44')](_0x268999,{'raw':!![]});})[_0x4935('0x21')](function(_0x3bc361){if(_0x45f4b8[_0x4935('0x85')]===_0x4935('0x91')){_0x1e3fc5[_0x4935('0x34')](_0x45f4b8['table']+_0x4935('0x92'),_0x5b6ee3[_0x4935('0x93')],_0x5b6ee3[_0x4935('0x94')]);}else{_0x1e3fc5[_0x4935('0x34')](_0x45f4b8[_0x4935('0x85')]+_0x4935('0x95'),_0x5b6ee3[_0x4935('0x93')],_0x5b6ee3['endDate']);}if(_0x3bc361){logger['info'](_0x4935('0x96'),_0x1e3fc5['toString']());require('child_process')[_0x4935('0x97')](path[_0x4935('0x4f')](__dirname,_0x4935('0x98'),_0x3bc361[_0x4935('0x88')]),[_0x3bc361['id'],_0x1e3fc5['toString'](),path[_0x4935('0x4f')](__dirname,_0x4935('0x99'),_0x3bc361['savename']),_0x4fbed4]);return _0x3bc361;}else{var _0x55eae6=squel['select']();_0x55eae6['from']('('+_0x1e3fc5['toString']()+')',_0x4935('0x9a'));_0x55eae6[_0x4935('0x61')]('COUNT(*)','count');_0x1e3fc5['limit'](_0x5b6ee3[_0x4935('0x1c')]||_0x402963);_0x1e3fc5[_0x4935('0x1b')](_0x5b6ee3[_0x4935('0x1b')]||0x0);return db['sequelize']['query'](_0x55eae6['toString'](),{'type':db[_0x4935('0x7f')][_0x4935('0x86')][_0x4935('0x80')]})[_0x4935('0x21')](function(_0x4fc9fb){if(!_0x4fc9fb[_0x4935('0x3f')]){_0xc081fd=0x0;}else{_0xc081fd=_0x4fc9fb[0x0][_0x4935('0x1a')]||0x0;}return db[_0x4935('0x7f')]['query'](_0x1e3fc5['toString'](),{'type':db[_0x4935('0x7f')][_0x4935('0x86')][_0x4935('0x80')]});})[_0x4935('0x21')](function(_0x415fc2){return{'rows':_0x415fc2||[],'count':_0xc081fd};});}});}exports[_0x4935('0x9b')]=function(_0xf39d39,_0x12cb5f){return runReport(_0xf39d39[_0x4935('0x3e')],_0xf39d39['query'],_0xf39d39[_0x4935('0x42')])[_0x4935('0x21')](respondWithResult(_0x12cb5f,null))['catch'](handleError(_0x12cb5f,null));};exports['runReport']=runReport;exports[_0x4935('0x2b')]=function(_0x5eeb57,_0x46a85a){var _0x46b58e=0xa;var _0x4a7372=[_0x4935('0x4f'),'left_join',_0x4935('0x81'),_0x4935('0x50')];var _0x493f4c={'SUM':'SUM(%s)','COUNT':_0x4935('0x9c'),'COUNT DISTINCT':_0x4935('0x52'),'MAX':_0x4935('0x53'),'MIN':_0x4935('0x54'),'AVG':_0x4935('0x55'),'GROUP_CONCAT':_0x4935('0x82'),'GROUP_CONCAT ASC':_0x4935('0x56'),'GROUP_CONCAT DESC':_0x4935('0x83')};var _0x5e230e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4935('0x57'),'HOUR':_0x4935('0x58'),'ROUND':_0x4935('0x9d'),'UNIX_TIMESTAMP':_0x4935('0x59')};var _0x41485b=function(_0x2a18f0){return!_[_0x4935('0x5a')]([_0x4935('0x5b'),'IS\x20NOT\x20NULL',_0x4935('0x5d'),'IS\x20NOT\x20EMPTY'],_0x2a18f0);};var _0x222c90=function(_0x52a661){if(!_0x52a661||!_0x52a661[_0x4935('0x5f')][_0x4935('0x3f')]){return'';}for(var _0x31eaee='(',_0x409d86=0x0;_0x409d86<_0x52a661[_0x4935('0x5f')]['length'];_0x409d86+=0x1){_0x409d86>0x0&&(_0x31eaee+='\x20'+_0x52a661[_0x4935('0x9e')]+'\x20');_0x31eaee+=_0x52a661[_0x4935('0x5f')][_0x409d86][_0x4935('0x60')]?_0x222c90(_0x52a661['rules'][_0x409d86]['group']):_0x52a661[_0x4935('0x5f')][_0x409d86]['field']+'\x20'+_0x52a661[_0x4935('0x5f')][_0x409d86][_0x4935('0x62')]+(_0x41485b(_0x52a661[_0x4935('0x5f')][_0x409d86][_0x4935('0x62')])?'\x20'+_0x52a661[_0x4935('0x5f')][_0x409d86]['value']:'');}return _0x31eaee+')';};var _0x145125={'where':{'id':_0x5eeb57[_0x4935('0x3e')]['id']}},_0x247898,_0x3c277e,_0x2c951b,_0x46eebd,_0x5702f6;_0x145125=_[_0x4935('0x41')]({},_0x145125,_0x5eeb57[_0x4935('0x42')]);return db[_0x4935('0x27')]['find'](_0x145125)['then'](function(_0x5b303b){if(_0x5b303b){_0x247898=_0x5b303b;return _0x5b303b['getFields']();}return null;})[_0x4935('0x21')](function(_0x3fc079){if(_0x3fc079){if(!_0x3fc079[_0x4935('0x3f')]){throw new db[(_0x4935('0x65'))][(_0x4935('0x66'))](_0x4935('0x67'),0x193);}_0x3c277e=_0x3fc079;return db[_0x4935('0x68')][_0x4935('0x3b')]({'raw':!![]});}return null;})[_0x4935('0x21')](function(_0x320aa9){if(_0x320aa9){_0x2c951b=_['keyBy'](_0x320aa9,'id');var _0x7f709e;var _0x3508ac=squel[_0x4935('0x6a')]();_0x3508ac[_0x4935('0x6b')](_0x247898[_0x4935('0x85')]);for(var _0x8ef56f=0x0;_0x8ef56f<_0x3c277e[_0x4935('0x3f')];_0x8ef56f+=0x1){_0x7f709e=_0x3c277e[_0x8ef56f][_0x4935('0x6c')]?_0x2c951b[_0x3c277e[_0x8ef56f][_0x4935('0x6c')]]['metric']:_0x3c277e[_0x8ef56f]['field'];_0x7f709e=_0x3c277e[_0x8ef56f][_0x4935('0x6e')]?_[_0x4935('0x70')](_0x493f4c[_0x3c277e[_0x8ef56f][_0x4935('0x6e')]],'%s',_0x7f709e):_0x7f709e;_0x7f709e=_0x3c277e[_0x8ef56f][_0x4935('0x6f')]?_[_0x4935('0x70')](_0x5e230e[_0x3c277e[_0x8ef56f][_0x4935('0x6f')]],'%s',_0x7f709e):_0x7f709e;if(_0x3c277e[_0x8ef56f][_0x4935('0x71')]){_0x3508ac[_0x4935('0x60')](_0x7f709e);}_0x3c277e[_0x8ef56f]['orderBy']&&_0x3508ac[_0x4935('0x32')](_0x7f709e,_0x3c277e[_0x8ef56f][_0x4935('0x72')]==='DESC'?![]:!![]);_0x3508ac[_0x4935('0x61')](_0x7f709e,_0x3c277e[_0x8ef56f]['alias']||_0x7f709e);}if(_0x247898[_0x4935('0x76')]){_0x247898[_0x4935('0x76')]=JSON[_0x4935('0x75')](_0x247898[_0x4935('0x76')]);for(var _0x6b6036=0x0;_0x6b6036<_0x247898[_0x4935('0x76')][_0x4935('0x3f')];_0x6b6036+=0x1){if(_0x247898[_0x4935('0x76')][_0x6b6036][_0x4935('0x36')]&&_[_0x4935('0x5a')](_0x4a7372,_0x247898['joins'][_0x6b6036][_0x4935('0x36')])&&_0x247898['joins'][_0x6b6036][_0x4935('0x77')]&&_0x247898[_0x4935('0x76')][_0x6b6036][_0x4935('0x78')]&&_0x247898[_0x4935('0x76')][_0x6b6036][_0x4935('0x79')]){_0x3508ac[_0x247898['joins'][_0x6b6036][_0x4935('0x36')]](_0x247898[_0x4935('0x76')][_0x6b6036][_0x4935('0x78')],null,util[_0x4935('0x6f')](_0x4935('0x7a'),_0x247898[_0x4935('0x85')],_0x247898[_0x4935('0x76')][_0x6b6036][_0x4935('0x77')],_0x247898[_0x4935('0x76')][_0x6b6036][_0x4935('0x78')],_0x247898[_0x4935('0x76')][_0x6b6036][_0x4935('0x79')]));}}}if(_0x247898['conditions']){_0x247898[_0x4935('0x7b')]=JSON[_0x4935('0x75')](_0x247898[_0x4935('0x7b')]);_0x3508ac['where'](_0x222c90(_0x247898[_0x4935('0x7b')]['group']));}_0x5702f6=_0x3508ac[_0x4935('0x9f')]();_0x3508ac[_0x4935('0x1c')](_0x46b58e);_0x3508ac[_0x4935('0x1b')](0x0);logger[_0x4935('0x7c')](_0x4935('0x7d'),_0x3508ac['toString']());return db[_0x4935('0x7f')][_0x4935('0x2b')](_0x3508ac[_0x4935('0x7e')](),{'type':db[_0x4935('0x7f')]['QueryTypes'][_0x4935('0x80')]});}})[_0x4935('0x21')](function(){return{'sql':_0x5702f6[_0x4935('0x7e')]()};})[_0x4935('0x21')](respondWithResult(_0x46a85a,null))[_0x4935('0x3d')](handleError(_0x46a85a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b0d5bd4..4563d39 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 _0x4e0a=['analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0xc2e46e,_0x3b979c){var _0x1a355d=function(_0x2cd000){while(--_0x2cd000){_0xc2e46e['push'](_0xc2e46e['shift']());}};_0x1a355d(++_0x3b979c);}(_0x4e0a,0x127));var _0xa4e0=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x4e0a[_0x2e3545];return _0xcf18f;};'use strict';var _=require(_0xa4e0('0x0'));var util=require(_0xa4e0('0x1'));var logger=require(_0xa4e0('0x2'))(_0xa4e0('0x3'));var moment=require(_0xa4e0('0x4'));var BPromise=require(_0xa4e0('0x5'));var rp=require(_0xa4e0('0x6'));var fs=require('fs');var path=require(_0xa4e0('0x7'));var rimraf=require('rimraf');var config=require(_0xa4e0('0x8'));var attributes=require(_0xa4e0('0x9'));module[_0xa4e0('0xa')]=function(_0xb1d155,_0x3b9e71){return _0xb1d155[_0xa4e0('0xb')](_0xa4e0('0xc'),attributes,{'tableName':_0xa4e0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e6a=['moment','bluebird','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api'];(function(_0x29a4a7,_0x56af1d){var _0x16ecfd=function(_0x1ba227){while(--_0x1ba227){_0x29a4a7['push'](_0x29a4a7['shift']());}};_0x16ecfd(++_0x56af1d);}(_0x8e6a,0x105));var _0xa8e6=function(_0x2c293c,_0x194049){_0x2c293c=_0x2c293c-0x0;var _0x2d308a=_0x8e6a[_0x2c293c];return _0x2d308a;};'use strict';var _=require(_0xa8e6('0x0'));var util=require(_0xa8e6('0x1'));var logger=require('../../config/logger')(_0xa8e6('0x2'));var moment=require(_0xa8e6('0x3'));var BPromise=require(_0xa8e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8e6('0x5'));var rimraf=require(_0xa8e6('0x6'));var config=require('../../config/environment');var attributes=require(_0xa8e6('0x7'));module[_0xa8e6('0x8')]=function(_0x274f52,_0xa36536){return _0x274f52[_0xa8e6('0x9')](_0xa8e6('0xa'),attributes,{'tableName':_0xa8e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 93b06ae..392597d 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 _0xe9e8=['info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2ad407,_0x17c61f){var _0x470db1=function(_0x2a955a){while(--_0x2a955a){_0x2ad407['push'](_0x2ad407['shift']());}};_0x470db1(++_0x17c61f);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x3ee735,_0x5290b8){_0x3ee735=_0x3ee735-0x0;var _0x1a1c25=_0xe9e8[_0x3ee735];return _0x1a1c25;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204f5c,_0x1fb8d3,_0x58f822){return new BPromise(function(_0x3b5d21,_0x2ae896){return client[_0x8e9e('0xc')](_0x204f5c,_0x58f822)['then'](function(_0x39f5e5){logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');logger[_0x8e9e('0xf')](_0x8e9e('0x10'),_0x1fb8d3,_0x8e9e('0x11'),JSON[_0x8e9e('0x12')](_0x39f5e5));if(_0x39f5e5[_0x8e9e('0x13')]){if(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x14')]===0x1f4){logger['error'](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5['error'][_0x8e9e('0x15')]);return _0x2ae896(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);}logger[_0x8e9e('0x13')](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);return _0x3b5d21(_0x39f5e5['error']['message']);}else{logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');_0x3b5d21(_0x39f5e5[_0x8e9e('0x16')][_0x8e9e('0x15')]);}})[_0x8e9e('0x17')](function(_0x22b2c7){logger[_0x8e9e('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1fb8d3,_0x22b2c7);_0x2ae896(_0x22b2c7);});});} \ No newline at end of file +var _0x57f8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x120864,_0x370fe0){var _0x421f28=function(_0x2e8dab){while(--_0x2e8dab){_0x120864['push'](_0x120864['shift']());}};_0x421f28(++_0x370fe0);}(_0x57f8,0x198));var _0x857f=function(_0x111165,_0x4f9303){_0x111165=_0x111165-0x0;var _0x64f7b6=_0x57f8[_0x111165];return _0x64f7b6;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var BPromise=require(_0x857f('0x2'));var rs=require(_0x857f('0x3'));var fs=require('fs');var Redis=require(_0x857f('0x4'));var db=require(_0x857f('0x5'))['db'];var utils=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var config=require(_0x857f('0x9'));var jayson=require(_0x857f('0xa'));var client=jayson[_0x857f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8380e8,_0x197098,_0x1aaeea){return new BPromise(function(_0x577fc3,_0x5f6a66){return client[_0x857f('0xc')](_0x8380e8,_0x1aaeea)[_0x857f('0xd')](function(_0x4f2b09){logger[_0x857f('0xe')](_0x857f('0xf'),_0x197098,_0x857f('0x10'));logger['debug'](_0x857f('0x11'),_0x197098,_0x857f('0x10'),JSON[_0x857f('0x12')](_0x4f2b09));if(_0x4f2b09[_0x857f('0x13')]){if(_0x4f2b09[_0x857f('0x13')][_0x857f('0x14')]===0x1f4){logger[_0x857f('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x197098,_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);return _0x5f6a66(_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);}logger[_0x857f('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x197098,_0x4f2b09['error'][_0x857f('0x15')]);return _0x577fc3(_0x4f2b09['error'][_0x857f('0x15')]);}else{logger['info'](_0x857f('0xf'),_0x197098,_0x857f('0x10'));_0x577fc3(_0x4f2b09['result'][_0x857f('0x15')]);}})[_0x857f('0x16')](function(_0xdf14fe){logger[_0x857f('0x13')](_0x857f('0xf'),_0x197098,_0xdf14fe);_0x5f6a66(_0xdf14fe);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index cbb2932..23d0a65 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 _0x7f04=['preview','/:id/run','run','/:id/query','query','post','put','delete','destroy','exports','path','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x23931f,_0x44a59c){var _0x2575ce=function(_0xea6dec){while(--_0xea6dec){_0x23931f['push'](_0x23931f['shift']());}};_0x2575ce(++_0x44a59c);}(_0x7f04,0x1c2));var _0x47f0=function(_0xbeb3fb,_0x289ba7){_0xbeb3fb=_0xbeb3fb-0x0;var _0x4b45d5=_0x7f04[_0xbeb3fb];return _0x4b45d5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x47f0('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x47f0('0x1'));var interaction=require(_0x47f0('0x2'));var config=require('../../config/environment');var controller=require(_0x47f0('0x3'));router[_0x47f0('0x4')]('/',auth[_0x47f0('0x5')](),controller[_0x47f0('0x6')]);router[_0x47f0('0x4')](_0x47f0('0x7'),auth[_0x47f0('0x5')](),controller[_0x47f0('0x8')]);router['get'](_0x47f0('0x9'),auth[_0x47f0('0x5')](),controller[_0x47f0('0xa')]);router[_0x47f0('0x4')](_0x47f0('0xb'),auth['isAuthenticated'](),controller[_0x47f0('0xc')]);router[_0x47f0('0x4')](_0x47f0('0xd'),auth[_0x47f0('0x5')](),controller[_0x47f0('0xe')]);router[_0x47f0('0xf')]('/',auth[_0x47f0('0x5')](),controller['create']);router[_0x47f0('0x10')](_0x47f0('0x7'),auth[_0x47f0('0x5')](),controller['update']);router[_0x47f0('0x11')]('/:id',auth[_0x47f0('0x5')](),controller[_0x47f0('0x12')]);module[_0x47f0('0x13')]=router; \ No newline at end of file +var _0x589a=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','run','post','create','put'];(function(_0x46e328,_0x17feb1){var _0x1460fa=function(_0x32ef70){while(--_0x32ef70){_0x46e328['push'](_0x46e328['shift']());}};_0x1460fa(++_0x17feb1);}(_0x589a,0x19c));var _0xa589=function(_0x3a17a3,_0xa82d9){_0x3a17a3=_0x3a17a3-0x0;var _0x11bab3=_0x589a[_0x3a17a3];return _0x11bab3;};'use strict';var multer=require('multer');var util=require(_0xa589('0x0'));var path=require(_0xa589('0x1'));var timeout=require(_0xa589('0x2'));var express=require(_0xa589('0x3'));var router=express[_0xa589('0x4')]();var auth=require(_0xa589('0x5'));var interaction=require(_0xa589('0x6'));var config=require(_0xa589('0x7'));var controller=require(_0xa589('0x8'));router['get']('/',auth[_0xa589('0x9')](),controller[_0xa589('0xa')]);router[_0xa589('0xb')](_0xa589('0xc'),auth[_0xa589('0x9')](),controller[_0xa589('0xd')]);router[_0xa589('0xb')](_0xa589('0xe'),auth[_0xa589('0x9')](),controller[_0xa589('0xf')]);router[_0xa589('0xb')]('/:id/run',auth[_0xa589('0x9')](),controller[_0xa589('0x10')]);router[_0xa589('0xb')]('/:id/query',auth[_0xa589('0x9')](),controller['query']);router[_0xa589('0x11')]('/',auth[_0xa589('0x9')](),controller[_0xa589('0x12')]);router[_0xa589('0x13')](_0xa589('0xc'),auth[_0xa589('0x9')](),controller[_0xa589('0x14')]);router[_0xa589('0x15')](_0xa589('0xc'),auth[_0xa589('0x9')](),controller[_0xa589('0x16')]);module[_0xa589('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 39b1df2..7b4e508 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 _0x10e9=['ENUM','xlsx','csv','DATE','manual','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x26ad11,_0x5d5e06){var _0xd7b647=function(_0x4028f0){while(--_0x4028f0){_0x26ad11['push'](_0x26ad11['shift']());}};_0xd7b647(++_0x5d5e06);}(_0x10e9,0x1aa));var _0x910e=function(_0x25a787,_0x6926e7){_0x25a787=_0x25a787-0x0;var _0x37712a=_0x10e9[_0x25a787];return _0x37712a;};'use strict';var Sequelize=require(_0x910e('0x0'));var moment=require(_0x910e('0x1'));module[_0x910e('0x2')]={'name':{'type':Sequelize[_0x910e('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x910e('0x4')]('csv','pdf',_0x910e('0x5')),'allowNull':![],'defaultValue':_0x910e('0x6')},'savename':{'type':Sequelize[_0x910e('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x910e('0x7')]},'endDate':{'type':Sequelize[_0x910e('0x7')]},'status':{'type':Sequelize[_0x910e('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x910e('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x910e('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x910e('0x9')]},'reportType':{'type':Sequelize[_0x910e('0x3')]}}; \ No newline at end of file +var _0x4e42=['UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','manual'];(function(_0x3147ad,_0xf3f715){var _0x3f05c7=function(_0xb1f093){while(--_0xb1f093){_0x3147ad['push'](_0x3147ad['shift']());}};_0x3f05c7(++_0xf3f715);}(_0x4e42,0x15f));var _0x24e4=function(_0x1e3923,_0x477ce9){_0x1e3923=_0x1e3923-0x0;var _0x36cd0f=_0x4e42[_0x1e3923];return _0x36cd0f;};'use strict';var Sequelize=require(_0x24e4('0x0'));var moment=require(_0x24e4('0x1'));module[_0x24e4('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x24e4('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x24e4('0x4')](_0x24e4('0x5'),_0x24e4('0x6'),_0x24e4('0x7')),'allowNull':![],'defaultValue':_0x24e4('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x24e4('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x24e4('0x4')](_0x24e4('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x24e4('0x9')]},'reportType':{'type':Sequelize[_0x24e4('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index ce8bc4c..68e8708 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 _0x7217=['model','attributes','fields','length','nolimit','order','sort','filter','where','merge','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','server/files/reports','exists','join','format','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','end','stack','send','index','AnalyticExtractedReport','rawAttributes','query','keys','filters','intersection'];(function(_0x117c41,_0x1da583){var _0x1ab090=function(_0x198aea){while(--_0x198aea){_0x117c41['push'](_0x117c41['shift']());}};_0x1ab090(++_0x1da583);}(_0x7217,0x19e));var _0x7721=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7217[_0x2a6809];return _0x11c371;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x7721('0x14'));var logger=require(_0x7721('0x15'))(_0x7721('0x16'));var utils=require(_0x7721('0x17'));var config=require(_0x7721('0x18'));var db=require(_0x7721('0x19'))['db'];function respondWithStatusCode(_0x1e7fd7,_0x27b36b){_0x27b36b=_0x27b36b||0xcc;return function(_0x55b4ca){if(_0x55b4ca){return _0x1e7fd7[_0x7721('0x1a')](_0x27b36b);}return _0x1e7fd7[_0x7721('0x1b')](_0x27b36b)['end']();};}function respondWithResult(_0x109900,_0x30da54){_0x30da54=_0x30da54||0xc8;return function(_0x3f01c5){if(_0x3f01c5){return _0x109900[_0x7721('0x1b')](_0x30da54)['json'](_0x3f01c5);}};}function respondWithFilteredResult(_0x3cbce8,_0x25b1c0){return function(_0x534f1b){if(_0x534f1b){var _0x4e199a=_0x534f1b[_0x7721('0x1c')],_0x4b183e=_0x25b1c0[_0x7721('0x1d')],_0x5ed54=_0x25b1c0['offset']+_0x25b1c0[_0x7721('0x1e')],_0x25a628;if(_0x5ed54>=_0x4e199a){_0x5ed54=_0x4e199a;_0x25a628=0xc8;}else{_0x25a628=0xce;}_0x3cbce8['status'](_0x25a628);return _0x3cbce8[_0x7721('0x1f')]('Content-Range',_0x4b183e+'-'+_0x5ed54+'/'+_0x4e199a)[_0x7721('0x20')](_0x534f1b);}return null;};}function patchUpdates(_0x4e96fb){return function(_0x3ab5a5){try{jsonpatch[_0x7721('0x21')](_0x3ab5a5,_0x4e96fb,!![]);}catch(_0x2286e5){return BPromise[_0x7721('0x22')](_0x2286e5);}return _0x3ab5a5[_0x7721('0x23')]();};}function saveUpdates(_0x413263,_0x3b29ac){return function(_0xaeccc4){if(_0xaeccc4){return _0xaeccc4['update'](_0x413263)[_0x7721('0x24')](function(_0x2c1583){return _0x2c1583;});}return null;};}function removeEntity(_0x3a053f,_0xd8ad3c){return function(_0x57140c){if(_0x57140c){return _0x57140c[_0x7721('0x25')]()['then'](function(){var _0xb9e9dd=_0x57140c[_0x7721('0x26')]({'plain':!![]});var _0x3e8a4e=_0x7721('0x27');return db[_0x7721('0x28')][_0x7721('0x25')]({'where':{'type':_0x3e8a4e,'resourceId':_0xb9e9dd['id']}})[_0x7721('0x24')](function(){return _0x57140c;});})['then'](function(){_0x3a053f[_0x7721('0x1b')](0xcc)[_0x7721('0x29')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x1a')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2a')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1b')](_0xf753f1)[_0x7721('0x2b')](_0x40f367);};}exports[_0x7721('0x2c')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=db[_0x7721('0x2d')][_0x7721('0x2e')];_0xd7d703['model']=_['keys'](_0x5c54f0);_0xd7d703[_0x7721('0x2f')]=_[_0x7721('0x30')](_0x158d98['query']);_0xd7d703[_0x7721('0x31')]=_[_0x7721('0x32')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x34')]=_[_0x7721('0x32')](_0xd7d703[_0x7721('0x33')],qs[_0x7721('0x35')](_0x158d98[_0x7721('0x2f')]['fields']));_0x37b9f0[_0x7721('0x34')]=_0x37b9f0[_0x7721('0x34')][_0x7721('0x36')]?_0x37b9f0['attributes']:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x2f')]['hasOwnProperty'](_0x7721('0x37'))){_0x37b9f0['limit']=qs[_0x7721('0x1e')](_0x158d98[_0x7721('0x2f')][_0x7721('0x1e')]);_0x37b9f0[_0x7721('0x1d')]=qs[_0x7721('0x1d')](_0x158d98[_0x7721('0x2f')][_0x7721('0x1d')]);}_0x37b9f0[_0x7721('0x38')]=qs[_0x7721('0x39')](_0x158d98[_0x7721('0x2f')][_0x7721('0x39')]);_0x37b9f0['where']=qs[_0x7721('0x31')](_['pick'](_0x158d98[_0x7721('0x2f')],_0xd7d703[_0x7721('0x31')]));if(_0x158d98[_0x7721('0x2f')][_0x7721('0x3a')]){_0x37b9f0[_0x7721('0x3b')]=_[_0x7721('0x3c')](_0x37b9f0['where'],{'$or':_['map'](_0x5c54f0,function(_0x4cadef){if(_0x4cadef['type'][_0x7721('0x3d')]!==_0x7721('0x3e')){var _0x1acc72={};_0x1acc72[_0x4cadef[_0x7721('0x3f')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x3a')]+'%'};return _0x1acc72;}})});}_0x37b9f0=_['merge']({},_0x37b9f0,_0x158d98[_0x7721('0x40')]);var _0x11f356={'where':_0x37b9f0['where']};return db[_0x7721('0x2d')][_0x7721('0x1c')](_0x11f356)['then'](function(_0x4d0111){_0x1da2d8[_0x7721('0x1c')]=_0x4d0111;if(_0x158d98[_0x7721('0x2f')][_0x7721('0x41')]){_0x37b9f0[_0x7721('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7721('0x43')](_0x37b9f0);})[_0x7721('0x24')](function(_0x40ce8c){_0x1da2d8[_0x7721('0x44')]=_0x40ce8c;return _0x1da2d8;})[_0x7721('0x24')](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))['catch'](handleError(_0x1ea4d,null));};exports[_0x7721('0x45')]=function(_0x4a2c28,_0xaa3216){var _0x4a5b59={'raw':!![],'where':{'id':_0x4a2c28[_0x7721('0x46')]['id']}},_0x2333b8={};_0x2333b8[_0x7721('0x33')]=_['keys'](db[_0x7721('0x2d')][_0x7721('0x2e')]);_0x2333b8[_0x7721('0x2f')]=_['keys'](_0x4a2c28[_0x7721('0x2f')]);_0x2333b8[_0x7721('0x31')]=_[_0x7721('0x32')](_0x2333b8[_0x7721('0x33')],_0x2333b8[_0x7721('0x2f')]);_0x4a5b59[_0x7721('0x34')]=_[_0x7721('0x32')](_0x2333b8['model'],qs['fields'](_0x4a2c28[_0x7721('0x2f')][_0x7721('0x35')]));_0x4a5b59[_0x7721('0x34')]=_0x4a5b59[_0x7721('0x34')][_0x7721('0x36')]?_0x4a5b59[_0x7721('0x34')]:_0x2333b8[_0x7721('0x33')];if(_0x4a2c28[_0x7721('0x2f')][_0x7721('0x41')]){_0x4a5b59[_0x7721('0x42')]=[{'all':!![]}];}_0x4a5b59=_['merge']({},_0x4a5b59,_0x4a2c28['options']);return db[_0x7721('0x2d')][_0x7721('0x47')](_0x4a5b59)[_0x7721('0x24')](handleEntityNotFound(_0xaa3216,null))[_0x7721('0x24')](respondWithResult(_0xaa3216,null))['catch'](handleError(_0xaa3216,null));};exports[_0x7721('0x48')]=function(_0x2d5a88,_0x56c3d9){return db[_0x7721('0x2d')]['create'](_0x2d5a88[_0x7721('0x49')],{})['then'](function(_0x334f23){var _0x196be4=_0x2d5a88[_0x7721('0x4a')]['get']({'plain':!![]});if(!_0x196be4)throw new Error(_0x7721('0x4b'));if(_0x196be4[_0x7721('0x4c')]==='user'){var _0x223d93=_0x334f23[_0x7721('0x26')]({'plain':!![]});var _0xf88e8c='ExtractedReports';return db[_0x7721('0x4d')]['find']({'where':{'name':_0xf88e8c,'userProfileId':_0x196be4[_0x7721('0x4e')]},'raw':!![]})[_0x7721('0x24')](function(_0x4738ef){if(_0x4738ef&&_0x4738ef[_0x7721('0x4f')]===0x0){return db[_0x7721('0x28')][_0x7721('0x48')]({'name':_0x223d93[_0x7721('0x50')],'resourceId':_0x223d93['id'],'type':_0x4738ef[_0x7721('0x50')],'sectionId':_0x4738ef['id']},{})[_0x7721('0x24')](function(){return _0x334f23;});}else{return _0x334f23;}})[_0x7721('0x51')](function(_0x31770e){logger[_0x7721('0x52')](_0x7721('0x53'),_0x31770e);throw _0x31770e;});}return _0x334f23;})[_0x7721('0x24')](respondWithResult(_0x56c3d9,0xc9))[_0x7721('0x51')](handleError(_0x56c3d9,null));};exports['update']=function(_0x474f32,_0x2f6f30){if(_0x474f32[_0x7721('0x49')]['id']){delete _0x474f32[_0x7721('0x49')]['id'];}return db[_0x7721('0x2d')][_0x7721('0x47')]({'where':{'id':_0x474f32[_0x7721('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f6f30,null))[_0x7721('0x24')](saveUpdates(_0x474f32[_0x7721('0x49')],null))[_0x7721('0x24')](respondWithResult(_0x2f6f30,null))[_0x7721('0x51')](handleError(_0x2f6f30,null));};exports[_0x7721('0x25')]=function(_0x9c0d4,_0x7fbd6c){return db[_0x7721('0x2d')][_0x7721('0x47')]({'where':{'id':_0x9c0d4[_0x7721('0x46')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x7fbd6c,null))['then'](removeEntity(_0x7fbd6c,null))[_0x7721('0x51')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x54')]=function(_0x1234bc,_0x2ee3c0,_0x15ed3b){return db[_0x7721('0x2d')][_0x7721('0x47')]({'where':{'id':_0x1234bc[_0x7721('0x46')]['id']},'attributes':[_0x7721('0x50'),_0x7721('0x55'),_0x7721('0x56'),_0x7721('0x57')],'raw':!![]})[_0x7721('0x24')](handleEntityNotFound(_0x2ee3c0,null))[_0x7721('0x24')](function(_0x300ea4){if(_0x300ea4){if(!fs['existsSync'](path['join'](config['root'],_0x7721('0x58'),_0x300ea4['savename']))){throw new db['Sequelize']['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x1234bc[_0x7721('0x2f')][_0x7721('0x59')]){return _0x2ee3c0[_0x7721('0x1a')](0xc8);}return _0x2ee3c0['download'](path[_0x7721('0x5a')](config['root'],'server/files/reports',_0x300ea4['savename']),util[_0x7721('0x5b')]('%s.%s',_0x300ea4['basename']||_0x300ea4['name'],_0x300ea4[_0x7721('0x57')][_0x7721('0x5c')]()));}})[_0x7721('0x51')](handleError(_0x2ee3c0,null));}; \ No newline at end of file +var _0x5fc3=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','name','send','AnalyticExtractedReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','key','field','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0xf51ea6,_0x26483f){var _0x44dfe2=function(_0x3faef3){while(--_0x3faef3){_0xf51ea6['push'](_0xf51ea6['shift']());}};_0x44dfe2(++_0x26483f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x5fc3[_0x2aa0e7];return _0x1472c0;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var hardwareService=require(_0x35fc('0x13'));var logger=require('../../config/logger')(_0x35fc('0x14'));var utils=require(_0x35fc('0x15'));var config=require('../../config/environment');var db=require(_0x35fc('0x16'))['db'];function respondWithStatusCode(_0x1a9f2b,_0x5469f5){_0x5469f5=_0x5469f5||0xcc;return function(_0x4cbe74){if(_0x4cbe74){return _0x1a9f2b[_0x35fc('0x17')](_0x5469f5);}return _0x1a9f2b['status'](_0x5469f5)[_0x35fc('0x18')]();};}function respondWithResult(_0x22055e,_0x2a6ad2){_0x2a6ad2=_0x2a6ad2||0xc8;return function(_0x29730f){if(_0x29730f){return _0x22055e[_0x35fc('0x19')](_0x2a6ad2)['json'](_0x29730f);}};}function respondWithFilteredResult(_0x59507a,_0x5eac0f){return function(_0x558364){if(_0x558364){var _0x398b67=_0x558364[_0x35fc('0x1a')],_0x229d56=_0x5eac0f[_0x35fc('0x1b')],_0x53b898=_0x5eac0f['offset']+_0x5eac0f[_0x35fc('0x1c')],_0x154958;if(_0x53b898>=_0x398b67){_0x53b898=_0x398b67;_0x154958=0xc8;}else{_0x154958=0xce;}_0x59507a[_0x35fc('0x19')](_0x154958);return _0x59507a['set'](_0x35fc('0x1d'),_0x229d56+'-'+_0x53b898+'/'+_0x398b67)[_0x35fc('0x1e')](_0x558364);}return null;};}function patchUpdates(_0x2e513b){return function(_0x5f56c6){try{jsonpatch[_0x35fc('0x1f')](_0x5f56c6,_0x2e513b,!![]);}catch(_0x3c58ea){return BPromise[_0x35fc('0x20')](_0x3c58ea);}return _0x5f56c6['save']();};}function saveUpdates(_0x402cff,_0x350a27){return function(_0x3229d1){if(_0x3229d1){return _0x3229d1[_0x35fc('0x21')](_0x402cff)[_0x35fc('0x22')](function(_0x21f1a9){return _0x21f1a9;});}return null;};}function removeEntity(_0x155016,_0x3b05b0){return function(_0x2405e8){if(_0x2405e8){return _0x2405e8[_0x35fc('0x23')]()['then'](function(){var _0x323aee=_0x2405e8[_0x35fc('0x24')]({'plain':!![]});var _0x257719=_0x35fc('0x25');return db[_0x35fc('0x26')]['destroy']({'where':{'type':_0x257719,'resourceId':_0x323aee['id']}})[_0x35fc('0x22')](function(){return _0x2405e8;});})[_0x35fc('0x22')](function(){_0x155016['status'](0xcc)[_0x35fc('0x18')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x27')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x19')](_0x1bf180)[_0x35fc('0x28')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=db[_0x35fc('0x29')][_0x35fc('0x2a')];_0x9f3c8a['model']=_[_0x35fc('0x2b')](_0x134dfa);_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x2b')](_0x26b7cb['query']);_0x9f3c8a[_0x35fc('0x2d')]=_[_0x35fc('0x2e')](_0x9f3c8a[_0x35fc('0x2f')],_0x9f3c8a[_0x35fc('0x2c')]);_0x383837[_0x35fc('0x30')]=_[_0x35fc('0x2e')](_0x9f3c8a[_0x35fc('0x2f')],qs[_0x35fc('0x31')](_0x26b7cb[_0x35fc('0x2c')][_0x35fc('0x31')]));_0x383837['attributes']=_0x383837['attributes'][_0x35fc('0x32')]?_0x383837['attributes']:_0x9f3c8a[_0x35fc('0x2f')];if(!_0x26b7cb[_0x35fc('0x2c')][_0x35fc('0x33')](_0x35fc('0x34'))){_0x383837[_0x35fc('0x1c')]=qs[_0x35fc('0x1c')](_0x26b7cb['query'][_0x35fc('0x1c')]);_0x383837[_0x35fc('0x1b')]=qs[_0x35fc('0x1b')](_0x26b7cb[_0x35fc('0x2c')][_0x35fc('0x1b')]);}_0x383837[_0x35fc('0x35')]=qs['sort'](_0x26b7cb[_0x35fc('0x2c')][_0x35fc('0x36')]);_0x383837[_0x35fc('0x37')]=qs['filters'](_[_0x35fc('0x38')](_0x26b7cb['query'],_0x9f3c8a[_0x35fc('0x2d')]));if(_0x26b7cb[_0x35fc('0x2c')][_0x35fc('0x39')]){_0x383837[_0x35fc('0x37')]=_['merge'](_0x383837['where'],{'$or':_['map'](_0x134dfa,function(_0x20f5fe){if(_0x20f5fe['type'][_0x35fc('0x3a')]!=='VIRTUAL'){var _0x9c6b65={};_0x9c6b65[_0x20f5fe[_0x35fc('0x3b')]]={'$like':'%'+_0x26b7cb[_0x35fc('0x2c')][_0x35fc('0x39')]+'%'};return _0x9c6b65;}})});}_0x383837=_[_0x35fc('0x3c')]({},_0x383837,_0x26b7cb[_0x35fc('0x3d')]);var _0x9fe7d6={'where':_0x383837['where']};return db[_0x35fc('0x29')][_0x35fc('0x1a')](_0x9fe7d6)['then'](function(_0x1feda5){_0x3735da[_0x35fc('0x1a')]=_0x1feda5;if(_0x26b7cb[_0x35fc('0x2c')][_0x35fc('0x3e')]){_0x383837[_0x35fc('0x3f')]=[{'all':!![]}];}return db[_0x35fc('0x29')]['findAll'](_0x383837);})[_0x35fc('0x22')](function(_0x267858){_0x3735da[_0x35fc('0x40')]=_0x267858;return _0x3735da;})['then'](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x41')](handleError(_0x645eac,null));};exports[_0x35fc('0x42')]=function(_0x596919,_0x237548){var _0x280af1={'raw':!![],'where':{'id':_0x596919[_0x35fc('0x43')]['id']}},_0x43b77c={};_0x43b77c[_0x35fc('0x2f')]=_[_0x35fc('0x2b')](db[_0x35fc('0x29')][_0x35fc('0x2a')]);_0x43b77c['query']=_['keys'](_0x596919[_0x35fc('0x2c')]);_0x43b77c[_0x35fc('0x2d')]=_['intersection'](_0x43b77c['model'],_0x43b77c['query']);_0x280af1[_0x35fc('0x30')]=_[_0x35fc('0x2e')](_0x43b77c['model'],qs[_0x35fc('0x31')](_0x596919[_0x35fc('0x2c')][_0x35fc('0x31')]));_0x280af1[_0x35fc('0x30')]=_0x280af1['attributes']['length']?_0x280af1['attributes']:_0x43b77c['model'];if(_0x596919['query'][_0x35fc('0x3e')]){_0x280af1[_0x35fc('0x3f')]=[{'all':!![]}];}_0x280af1=_['merge']({},_0x280af1,_0x596919[_0x35fc('0x3d')]);return db['AnalyticExtractedReport'][_0x35fc('0x44')](_0x280af1)[_0x35fc('0x22')](handleEntityNotFound(_0x237548,null))[_0x35fc('0x22')](respondWithResult(_0x237548,null))[_0x35fc('0x41')](handleError(_0x237548,null));};exports[_0x35fc('0x45')]=function(_0x5d3d0f,_0x64d381){return db[_0x35fc('0x29')]['create'](_0x5d3d0f[_0x35fc('0x46')],{})[_0x35fc('0x22')](function(_0x2a8a09){var _0x211746=_0x5d3d0f['user'][_0x35fc('0x24')]({'plain':!![]});if(!_0x211746)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x211746['role']===_0x35fc('0x47')){var _0x9db7e8=_0x2a8a09[_0x35fc('0x24')]({'plain':!![]});var _0xca8aef=_0x35fc('0x25');return db[_0x35fc('0x48')][_0x35fc('0x44')]({'where':{'name':_0xca8aef,'userProfileId':_0x211746[_0x35fc('0x49')]},'raw':!![]})['then'](function(_0x3e2961){if(_0x3e2961&&_0x3e2961[_0x35fc('0x4a')]===0x0){return db[_0x35fc('0x26')][_0x35fc('0x45')]({'name':_0x9db7e8[_0x35fc('0x27')],'resourceId':_0x9db7e8['id'],'type':_0x3e2961[_0x35fc('0x27')],'sectionId':_0x3e2961['id']},{})[_0x35fc('0x22')](function(){return _0x2a8a09;});}else{return _0x2a8a09;}})[_0x35fc('0x41')](function(_0x35fb53){logger[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x35fb53);throw _0x35fb53;});}return _0x2a8a09;})[_0x35fc('0x22')](respondWithResult(_0x64d381,0xc9))[_0x35fc('0x41')](handleError(_0x64d381,null));};exports[_0x35fc('0x21')]=function(_0x59c666,_0x553ed6){if(_0x59c666[_0x35fc('0x46')]['id']){delete _0x59c666[_0x35fc('0x46')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x59c666[_0x35fc('0x43')]['id']}})[_0x35fc('0x22')](handleEntityNotFound(_0x553ed6,null))['then'](saveUpdates(_0x59c666['body'],null))[_0x35fc('0x22')](respondWithResult(_0x553ed6,null))[_0x35fc('0x41')](handleError(_0x553ed6,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x38bc78['params']['id']}})[_0x35fc('0x22')](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x22')](removeEntity(_0x5b2595,null))['catch'](handleError(_0x5b2595,null));};exports[_0x35fc('0x4d')]=function(_0x1ab472,_0x26118e,_0x18f18b){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1ab472['params']['id']},'attributes':[_0x35fc('0x27'),_0x35fc('0x4e'),'savename',_0x35fc('0x4f')],'raw':!![]})[_0x35fc('0x22')](handleEntityNotFound(_0x26118e,null))[_0x35fc('0x22')](function(_0x145854){if(_0x145854){if(!fs[_0x35fc('0x50')](path['join'](config[_0x35fc('0x51')],_0x35fc('0x52'),_0x145854[_0x35fc('0x53')]))){throw new db['Sequelize'][(_0x35fc('0x54'))](_0x35fc('0x55'));}if(_0x1ab472['query'][_0x35fc('0x56')]){return _0x26118e[_0x35fc('0x17')](0xc8);}return _0x26118e[_0x35fc('0x4d')](path[_0x35fc('0x57')](config[_0x35fc('0x51')],_0x35fc('0x52'),_0x145854[_0x35fc('0x53')]),util[_0x35fc('0x58')]('%s.%s',_0x145854[_0x35fc('0x4e')]||_0x145854[_0x35fc('0x27')],_0x145854[_0x35fc('0x4f')]['toLowerCase']()));}})[_0x35fc('0x41')](handleError(_0x26118e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 69a4117..1d284bc 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 _0x28cc=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define'];(function(_0x1c0332,_0x12b1a4){var _0x2810fd=function(_0x44ee73){while(--_0x44ee73){_0x1c0332['push'](_0x1c0332['shift']());}};_0x2810fd(++_0x12b1a4);}(_0x28cc,0x198));var _0xc28c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc28c('0x0'));var util=require(_0xc28c('0x1'));var logger=require(_0xc28c('0x2'))(_0xc28c('0x3'));var moment=require(_0xc28c('0x4'));var BPromise=require(_0xc28c('0x5'));var rp=require(_0xc28c('0x6'));var fs=require('fs');var path=require(_0xc28c('0x7'));var rimraf=require(_0xc28c('0x8'));var config=require(_0xc28c('0x9'));var attributes=require(_0xc28c('0xa'));module['exports']=function(_0x3d45c3,_0x4db5d8){return _0x3d45c3[_0xc28c('0xb')](_0xc28c('0xc'),attributes,{'tableName':_0xc28c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x272e=['moment','bluebird','path','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','api'];(function(_0x292bab,_0x18b725){var _0x3a1de1=function(_0x8d52cf){while(--_0x8d52cf){_0x292bab['push'](_0x292bab['shift']());}};_0x3a1de1(++_0x18b725);}(_0x272e,0xb2));var _0xe272=function(_0x42fd77,_0x4089fb){_0x42fd77=_0x42fd77-0x0;var _0x4ab7bf=_0x272e[_0x42fd77];return _0x4ab7bf;};'use strict';var _=require(_0xe272('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe272('0x1'));var moment=require(_0xe272('0x2'));var BPromise=require(_0xe272('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe272('0x4'));var rimraf=require('rimraf');var config=require(_0xe272('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0xe272('0x6')]=function(_0x4a1651,_0x1ed7af){return _0x4a1651[_0xe272('0x7')](_0xe272('0x8'),attributes,{'tableName':_0xe272('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 03e5e55..8434600 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 _0x5f37=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x929009,_0xa89fa5){var _0x13d770=function(_0x2cadc0){while(--_0x2cadc0){_0x929009['push'](_0x929009['shift']());}};_0x13d770(++_0xa89fa5);}(_0x5f37,0xb9));var _0x75f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5f37[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x75f3('0x0'));var util=require(_0x75f3('0x1'));var moment=require(_0x75f3('0x2'));var BPromise=require(_0x75f3('0x3'));var rs=require(_0x75f3('0x4'));var fs=require('fs');var Redis=require(_0x75f3('0x5'));var db=require(_0x75f3('0x6'))['db'];var utils=require(_0x75f3('0x7'));var logger=require(_0x75f3('0x8'))(_0x75f3('0x9'));var config=require(_0x75f3('0xa'));var jayson=require(_0x75f3('0xb'));var client=jayson[_0x75f3('0xc')][_0x75f3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c579d,_0x48f8c0,_0x5a88cc){return new BPromise(function(_0x11f813,_0x108a38){return client[_0x75f3('0xe')](_0x3c579d,_0x5a88cc)['then'](function(_0x47138a){logger[_0x75f3('0xf')](_0x75f3('0x10'),_0x48f8c0,_0x75f3('0x11'));logger[_0x75f3('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x48f8c0,_0x75f3('0x11'),JSON[_0x75f3('0x13')](_0x47138a));if(_0x47138a[_0x75f3('0x14')]){if(_0x47138a['error'][_0x75f3('0x15')]===0x1f4){logger[_0x75f3('0x14')](_0x75f3('0x10'),_0x48f8c0,_0x47138a[_0x75f3('0x14')][_0x75f3('0x16')]);return _0x108a38(_0x47138a[_0x75f3('0x14')]['message']);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x48f8c0,_0x47138a['error'][_0x75f3('0x16')]);return _0x11f813(_0x47138a[_0x75f3('0x14')][_0x75f3('0x16')]);}else{logger[_0x75f3('0xf')](_0x75f3('0x10'),_0x48f8c0,_0x75f3('0x11'));_0x11f813(_0x47138a[_0x75f3('0x17')]['message']);}})[_0x75f3('0x18')](function(_0x1ca6bf){logger['error'](_0x75f3('0x10'),_0x48f8c0,_0x1ca6bf);_0x108a38(_0x1ca6bf);});});} \ No newline at end of file +var _0xf11f=['jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x3da69b,_0x2f51a5){var _0x312cec=function(_0x24a1c5){while(--_0x24a1c5){_0x3da69b['push'](_0x3da69b['shift']());}};_0x312cec(++_0x2f51a5);}(_0xf11f,0x9a));var _0xff11=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0xf11f[_0x459a0a];return _0x4ab46c;};'use strict';var _=require(_0xff11('0x0'));var util=require('util');var moment=require(_0xff11('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff11('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xff11('0x3'))(_0xff11('0x4'));var config=require(_0xff11('0x5'));var jayson=require(_0xff11('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc9d6,_0x440a46,_0x5db391){return new BPromise(function(_0x568b0e,_0x5d78a0){return client[_0xff11('0x7')](_0x3cc9d6,_0x5db391)[_0xff11('0x8')](function(_0x1e8be2){logger[_0xff11('0x9')](_0xff11('0xa'),_0x440a46,_0xff11('0xb'));logger[_0xff11('0xc')](_0xff11('0xd'),_0x440a46,'request\x20sent',JSON[_0xff11('0xe')](_0x1e8be2));if(_0x1e8be2[_0xff11('0xf')]){if(_0x1e8be2[_0xff11('0xf')][_0xff11('0x10')]===0x1f4){logger[_0xff11('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x440a46,_0x1e8be2['error'][_0xff11('0x11')]);return _0x5d78a0(_0x1e8be2['error'][_0xff11('0x11')]);}logger[_0xff11('0xf')](_0xff11('0xa'),_0x440a46,_0x1e8be2[_0xff11('0xf')][_0xff11('0x11')]);return _0x568b0e(_0x1e8be2[_0xff11('0xf')][_0xff11('0x11')]);}else{logger[_0xff11('0x9')](_0xff11('0xa'),_0x440a46,_0xff11('0xb'));_0x568b0e(_0x1e8be2[_0xff11('0x12')][_0xff11('0x11')]);}})[_0xff11('0x13')](function(_0x4678f7){logger[_0xff11('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x440a46,_0x4678f7);_0x5d78a0(_0x4678f7);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2c95368..f4a218a 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 _0xf7ea=['../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xf7ea,0xea));var _0xaf7e=function(_0x18fd54,_0x4e7612){_0x18fd54=_0x18fd54-0x0;var _0x3d5c8d=_0xf7ea[_0x18fd54];return _0x3d5c8d;};'use strict';var multer=require(_0xaf7e('0x0'));var util=require(_0xaf7e('0x1'));var path=require(_0xaf7e('0x2'));var timeout=require(_0xaf7e('0x3'));var express=require(_0xaf7e('0x4'));var router=express[_0xaf7e('0x5')]();var auth=require(_0xaf7e('0x6'));var interaction=require(_0xaf7e('0x7'));var config=require(_0xaf7e('0x8'));var controller=require(_0xaf7e('0x9'));router['get']('/',auth[_0xaf7e('0xa')](),controller[_0xaf7e('0xb')]);router[_0xaf7e('0xc')](_0xaf7e('0xd'),auth['isAuthenticated'](),controller[_0xaf7e('0xe')]);router[_0xaf7e('0xc')](_0xaf7e('0xf'),auth[_0xaf7e('0xa')](),controller[_0xaf7e('0x10')]);router[_0xaf7e('0x11')]('/',auth[_0xaf7e('0xa')](),controller[_0xaf7e('0x12')]);router['put']('/:id',auth[_0xaf7e('0xa')](),controller[_0xaf7e('0x13')]);router[_0xaf7e('0x14')](_0xaf7e('0xd'),auth[_0xaf7e('0xa')](),controller[_0xaf7e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2fe3=['get','index','/:id','isAuthenticated','show','download','post','update','delete','multer','util','express','../../components/auth/service','./analyticExtractedReport.controller'];(function(_0x51b3f0,_0x3a72b4){var _0x534ec3=function(_0x5a9c8c){while(--_0x5a9c8c){_0x51b3f0['push'](_0x51b3f0['shift']());}};_0x534ec3(++_0x3a72b4);}(_0x2fe3,0x87));var _0x32fe=function(_0x1f0fa5,_0x3624f0){_0x1f0fa5=_0x1f0fa5-0x0;var _0x2044b3=_0x2fe3[_0x1f0fa5];return _0x2044b3;};'use strict';var multer=require(_0x32fe('0x0'));var util=require(_0x32fe('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x32fe('0x2'));var router=express['Router']();var auth=require(_0x32fe('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32fe('0x4'));router[_0x32fe('0x5')]('/',auth['isAuthenticated'](),controller[_0x32fe('0x6')]);router[_0x32fe('0x5')](_0x32fe('0x7'),auth[_0x32fe('0x8')](),controller[_0x32fe('0x9')]);router[_0x32fe('0x5')]('/:id/download',auth[_0x32fe('0x8')](),controller[_0x32fe('0xa')]);router[_0x32fe('0xb')]('/',auth[_0x32fe('0x8')](),controller['create']);router['put'](_0x32fe('0x7'),auth[_0x32fe('0x8')](),controller[_0x32fe('0xc')]);router[_0x32fe('0xd')]('/:id',auth[_0x32fe('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a8f30ad..f0a23b2 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 _0xe14b=['sequelize','exports','STRING'];(function(_0x5c02b9,_0x208238){var _0x18a7e1=function(_0x4db78d){while(--_0x4db78d){_0x5c02b9['push'](_0x5c02b9['shift']());}};_0x18a7e1(++_0x208238);}(_0xe14b,0x93));var _0xbe14=function(_0x23691e,_0x2e1e18){_0x23691e=_0x23691e-0x0;var _0x3a2700=_0xe14b[_0x23691e];return _0x3a2700;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x4c693b,_0x3523c3){var _0x4f2d59=function(_0x3dca5e){while(--_0x3dca5e){_0x4c693b['push'](_0x4c693b['shift']());}};_0x4f2d59(++_0x3523c3);}(_0x1261,0x144));var _0x1126=function(_0x2fbb8c,_0x15bc93){_0x2fbb8c=_0x2fbb8c-0x0;var _0x1005b4=_0x1261[_0x2fbb8c];return _0x1005b4;};'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 38af6ee..17d56d2 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 _0x8e24=['includeAll','include','findAll','rows','catch','show','find','create','body','bulkCreate','params','addFields','AnalyticCustomReport','sequelize','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','json','count','offset','set','apply','save','update','then','destroy','end','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','map','type','key','VIRTUAL','merge'];(function(_0x30e9b5,_0x337678){var _0x3682e6=function(_0x2cf384){while(--_0x2cf384){_0x30e9b5['push'](_0x30e9b5['shift']());}};_0x3682e6(++_0x337678);}(_0x8e24,0xa0));var _0x48e2=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x8e24[_0x538c70];return _0x42ae01;};'use strict';var pdf=require(_0x48e2('0x0'));var emlformat=require(_0x48e2('0x1'));var rimraf=require(_0x48e2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48e2('0x3'));var rp=require(_0x48e2('0x4'));var moment=require('moment');var BPromise=require(_0x48e2('0x5'));var Mustache=require(_0x48e2('0x6'));var util=require(_0x48e2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x48e2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x48e2('0x9'));var squel=require(_0x48e2('0xa'));var crypto=require(_0x48e2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x48e2('0xc'));var toCsv=require(_0x48e2('0x8'));var querystring=require('querystring');var Papa=require(_0x48e2('0xd'));var Redis=require(_0x48e2('0xe'));var authService=require(_0x48e2('0xf'));var qs=require(_0x48e2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48e2('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x48e2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe2d831,_0x3c68e9){_0x3c68e9=_0x3c68e9||0xcc;return function(_0x273034){if(_0x273034){return _0xe2d831[_0x48e2('0x13')](_0x3c68e9);}return _0xe2d831[_0x48e2('0x14')](_0x3c68e9)['end']();};}function respondWithResult(_0x254472,_0x3be4b6){_0x3be4b6=_0x3be4b6||0xc8;return function(_0x22ed4a){if(_0x22ed4a){return _0x254472[_0x48e2('0x14')](_0x3be4b6)[_0x48e2('0x15')](_0x22ed4a);}};}function respondWithFilteredResult(_0x2075a9,_0x4cc825){return function(_0x3e243f){if(_0x3e243f){var _0x1d98af=_0x3e243f[_0x48e2('0x16')],_0x4d06f3=_0x4cc825[_0x48e2('0x17')],_0x44445a=_0x4cc825[_0x48e2('0x17')]+_0x4cc825['limit'],_0x2b44a8;if(_0x44445a>=_0x1d98af){_0x44445a=_0x1d98af;_0x2b44a8=0xc8;}else{_0x2b44a8=0xce;}_0x2075a9[_0x48e2('0x14')](_0x2b44a8);return _0x2075a9[_0x48e2('0x18')]('Content-Range',_0x4d06f3+'-'+_0x44445a+'/'+_0x1d98af)['json'](_0x3e243f);}return null;};}function patchUpdates(_0x2b4d3b){return function(_0x2a6d5e){try{jsonpatch[_0x48e2('0x19')](_0x2a6d5e,_0x2b4d3b,!![]);}catch(_0x18a730){return BPromise['reject'](_0x18a730);}return _0x2a6d5e[_0x48e2('0x1a')]();};}function saveUpdates(_0x30b510,_0x2dfc27){return function(_0x328780){if(_0x328780){return _0x328780[_0x48e2('0x1b')](_0x30b510)[_0x48e2('0x1c')](function(_0x17d659){return _0x17d659;});}return null;};}function removeEntity(_0x3d293b,_0x47b289){return function(_0x414052){if(_0x414052){return _0x414052[_0x48e2('0x1d')]()[_0x48e2('0x1c')](function(){_0x3d293b['status'](0xcc)[_0x48e2('0x1e')]();});}};}function handleEntityNotFound(_0x150db5,_0x411d3d){return function(_0x419329){if(!_0x419329){_0x150db5[_0x48e2('0x13')](0x194);}return _0x419329;};}function handleError(_0x277acc,_0x1ad608){_0x1ad608=_0x1ad608||0x1f4;return function(_0x1387ea){logger[_0x48e2('0x1f')](_0x1387ea[_0x48e2('0x20')]);if(_0x1387ea[_0x48e2('0x21')]){delete _0x1387ea[_0x48e2('0x21')];}_0x277acc[_0x48e2('0x14')](_0x1ad608)[_0x48e2('0x22')](_0x1387ea);};}exports[_0x48e2('0x23')]=function(_0xe9097d,_0x445b86){var _0x4a279f={},_0x21cbf8={},_0x5015fe={'count':0x0,'rows':[]};var _0x4d3b4b=db[_0x48e2('0x24')][_0x48e2('0x25')];_0x21cbf8[_0x48e2('0x26')]=_[_0x48e2('0x27')](_0x4d3b4b);_0x21cbf8[_0x48e2('0x28')]=_[_0x48e2('0x27')](_0xe9097d[_0x48e2('0x28')]);_0x21cbf8[_0x48e2('0x29')]=_[_0x48e2('0x2a')](_0x21cbf8['model'],_0x21cbf8[_0x48e2('0x28')]);_0x4a279f[_0x48e2('0x2b')]=_[_0x48e2('0x2a')](_0x21cbf8[_0x48e2('0x26')],qs[_0x48e2('0x2c')](_0xe9097d[_0x48e2('0x28')]['fields']));_0x4a279f[_0x48e2('0x2b')]=_0x4a279f[_0x48e2('0x2b')][_0x48e2('0x2d')]?_0x4a279f[_0x48e2('0x2b')]:_0x21cbf8['model'];if(!_0xe9097d[_0x48e2('0x28')][_0x48e2('0x2e')](_0x48e2('0x2f'))){_0x4a279f[_0x48e2('0x30')]=qs[_0x48e2('0x30')](_0xe9097d[_0x48e2('0x28')][_0x48e2('0x30')]);_0x4a279f[_0x48e2('0x17')]=qs[_0x48e2('0x17')](_0xe9097d[_0x48e2('0x28')][_0x48e2('0x17')]);}_0x4a279f[_0x48e2('0x31')]=qs[_0x48e2('0x32')](_0xe9097d[_0x48e2('0x28')]['sort']);_0x4a279f['where']=qs[_0x48e2('0x29')](_[_0x48e2('0x33')](_0xe9097d[_0x48e2('0x28')],_0x21cbf8['filters']));if(_0xe9097d[_0x48e2('0x28')][_0x48e2('0x34')]){_0x4a279f[_0x48e2('0x35')]=_['merge'](_0x4a279f['where'],{'$or':_[_0x48e2('0x36')](_0x4d3b4b,function(_0x214135){if(_0x214135[_0x48e2('0x37')][_0x48e2('0x38')]!==_0x48e2('0x39')){var _0xa45ced={};_0xa45ced[_0x214135['field']]={'$like':'%'+_0xe9097d['query']['filter']+'%'};return _0xa45ced;}})});}_0x4a279f=_[_0x48e2('0x3a')]({},_0x4a279f,_0xe9097d['options']);var _0x439998={'where':_0x4a279f['where']};return db[_0x48e2('0x24')][_0x48e2('0x16')](_0x439998)['then'](function(_0x3f6c17){_0x5015fe[_0x48e2('0x16')]=_0x3f6c17;if(_0xe9097d[_0x48e2('0x28')][_0x48e2('0x3b')]){_0x4a279f[_0x48e2('0x3c')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x48e2('0x3d')](_0x4a279f);})[_0x48e2('0x1c')](function(_0x2f24ea){_0x5015fe[_0x48e2('0x3e')]=_0x2f24ea;return _0x5015fe;})[_0x48e2('0x1c')](respondWithFilteredResult(_0x445b86,_0x4a279f))[_0x48e2('0x3f')](handleError(_0x445b86,null));};exports[_0x48e2('0x40')]=function(_0x54d837,_0x22a66f){var _0x1fa29e={'raw':![],'where':{'id':_0x54d837['params']['id']}},_0x46c949={};_0x46c949['model']=_[_0x48e2('0x27')](db[_0x48e2('0x24')]['rawAttributes']);_0x46c949[_0x48e2('0x28')]=_[_0x48e2('0x27')](_0x54d837[_0x48e2('0x28')]);_0x46c949[_0x48e2('0x29')]=_['intersection'](_0x46c949['model'],_0x46c949['query']);_0x1fa29e[_0x48e2('0x2b')]=_['intersection'](_0x46c949['model'],qs['fields'](_0x54d837[_0x48e2('0x28')][_0x48e2('0x2c')]));_0x1fa29e[_0x48e2('0x2b')]=_0x1fa29e['attributes']['length']?_0x1fa29e[_0x48e2('0x2b')]:_0x46c949['model'];if(_0x54d837['query'][_0x48e2('0x3b')]){_0x1fa29e['include']=[{'all':!![]}];}_0x1fa29e=_[_0x48e2('0x3a')]({},_0x1fa29e,_0x54d837['options']);return db[_0x48e2('0x24')][_0x48e2('0x41')](_0x1fa29e)['then'](handleEntityNotFound(_0x22a66f,null))[_0x48e2('0x1c')](respondWithResult(_0x22a66f,null))[_0x48e2('0x3f')](handleError(_0x22a66f,null));};exports[_0x48e2('0x42')]=function(_0xc1eb6f,_0x310dc2){return db['AnalyticFieldReport'][_0x48e2('0x42')](_0xc1eb6f[_0x48e2('0x43')],{})[_0x48e2('0x1c')](respondWithResult(_0x310dc2,0xc9))[_0x48e2('0x3f')](handleError(_0x310dc2,null));};exports[_0x48e2('0x44')]=function(_0x124a9c,_0x4d0ccf){return db[_0x48e2('0x24')][_0x48e2('0x44')](_0x124a9c[_0x48e2('0x43')],{'raw':![],'individualHooks':!![]})[_0x48e2('0x1c')](respondWithResult(_0x4d0ccf,0xc9))[_0x48e2('0x3f')](handleError(_0x4d0ccf,null));};exports[_0x48e2('0x1b')]=function(_0x2ec989,_0x44dfb0){if(_0x2ec989[_0x48e2('0x43')]['id']){delete _0x2ec989['body']['id'];}return db['AnalyticFieldReport'][_0x48e2('0x41')]({'where':{'id':_0x2ec989['params']['id']}})[_0x48e2('0x1c')](handleEntityNotFound(_0x44dfb0,null))['then'](saveUpdates(_0x2ec989['body'],null))[_0x48e2('0x1c')](respondWithResult(_0x44dfb0,null))['catch'](handleError(_0x44dfb0,null));};exports['destroy']=function(_0x2e248a,_0x196fb7){return db[_0x48e2('0x24')][_0x48e2('0x41')]({'where':{'id':_0x2e248a[_0x48e2('0x45')]['id']}})['then'](handleEntityNotFound(_0x196fb7,null))[_0x48e2('0x1c')](removeEntity(_0x196fb7,null))[_0x48e2('0x3f')](handleError(_0x196fb7,null));};exports['bulkDestroy']=function(_0x377aa8,_0x5b4c7b){return db[_0x48e2('0x24')]['destroy']({'where':{'id':_0x377aa8[_0x48e2('0x28')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x48e2('0x1c')](respondWithResult(_0x5b4c7b,0xcc))[_0x48e2('0x3f')](handleError(_0x5b4c7b,null));};exports[_0x48e2('0x46')]=function(_0x40fd5d,_0x5227c2,_0x2537c0){return db[_0x48e2('0x47')]['findOne']({'where':{'id':_0x40fd5d[_0x48e2('0x45')]['id']}})['then'](handleEntityNotFound(_0x5227c2,null))[_0x48e2('0x1c')](function(_0x4aa357){if(_0x4aa357){return db[_0x48e2('0x48')]['transaction'](function(_0x26e132){return db[_0x48e2('0x24')][_0x48e2('0x1d')]({'where':{'CustomReportId':_0x40fd5d[_0x48e2('0x45')]['id']},'transaction':_0x26e132})['then'](function(_0x3b7d9b){var _0x2ac935=_[_0x48e2('0x36')](_0x40fd5d[_0x48e2('0x43')],function(_0x2938d1){delete _0x2938d1['id'];_0x2938d1['CustomReportId']=_0x40fd5d[_0x48e2('0x45')]['id'];return _0x2938d1;});return db['AnalyticFieldReport'][_0x48e2('0x44')](_0x2ac935,{'transaction':_0x26e132});});})[_0x48e2('0x1c')](function(){return db[_0x48e2('0x24')][_0x48e2('0x3d')]({'where':{'CustomReportId':_0x40fd5d['params']['id']}});});}})['then'](respondWithResult(_0x5227c2,null))['catch'](handleError(_0x5227c2,null));}; \ No newline at end of file +var _0xd246=['type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','intersection','include','find','create','bulkCreate','body','params','destroy','bulkDestroy','addFields','findOne','sequelize','map','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','reject','save','update','then','stack','name','AnalyticFieldReport','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge'];(function(_0x324fbb,_0x3846a7){var _0x128922=function(_0x14e3b0){while(--_0x14e3b0){_0x324fbb['push'](_0x324fbb['shift']());}};_0x128922(++_0x3846a7);}(_0xd246,0x1e5));var _0x6d24=function(_0x450e22,_0x3ba125){_0x450e22=_0x450e22-0x0;var _0x5e3b1d=_0xd246[_0x450e22];return _0x5e3b1d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6d24('0x0'));var moment=require(_0x6d24('0x1'));var BPromise=require(_0x6d24('0x2'));var Mustache=require(_0x6d24('0x3'));var util=require(_0x6d24('0x4'));var path=require(_0x6d24('0x5'));var sox=require(_0x6d24('0x6'));var csv=require(_0x6d24('0x7'));var ejs=require(_0x6d24('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6d24('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d24('0xa'));var toCsv=require(_0x6d24('0x7'));var querystring=require(_0x6d24('0xb'));var Papa=require(_0x6d24('0xc'));var Redis=require(_0x6d24('0xd'));var authService=require(_0x6d24('0xe'));var qs=require(_0x6d24('0xf'));var hardwareService=require(_0x6d24('0x10'));var logger=require(_0x6d24('0x11'))(_0x6d24('0x12'));var utils=require(_0x6d24('0x13'));var config=require(_0x6d24('0x14'));var db=require(_0x6d24('0x15'))['db'];function respondWithStatusCode(_0x4f567c,_0x3ca1c3){_0x3ca1c3=_0x3ca1c3||0xcc;return function(_0x4ce5a1){if(_0x4ce5a1){return _0x4f567c[_0x6d24('0x16')](_0x3ca1c3);}return _0x4f567c['status'](_0x3ca1c3)[_0x6d24('0x17')]();};}function respondWithResult(_0x334640,_0x152153){_0x152153=_0x152153||0xc8;return function(_0x311f59){if(_0x311f59){return _0x334640[_0x6d24('0x18')](_0x152153)['json'](_0x311f59);}};}function respondWithFilteredResult(_0x33e572,_0x4a83ff){return function(_0x7933e1){if(_0x7933e1){var _0x190ffa=_0x7933e1[_0x6d24('0x19')],_0x2b522d=_0x4a83ff[_0x6d24('0x1a')],_0x59123a=_0x4a83ff['offset']+_0x4a83ff['limit'],_0x2985ee;if(_0x59123a>=_0x190ffa){_0x59123a=_0x190ffa;_0x2985ee=0xc8;}else{_0x2985ee=0xce;}_0x33e572[_0x6d24('0x18')](_0x2985ee);return _0x33e572[_0x6d24('0x1b')](_0x6d24('0x1c'),_0x2b522d+'-'+_0x59123a+'/'+_0x190ffa)[_0x6d24('0x1d')](_0x7933e1);}return null;};}function patchUpdates(_0x5baf74){return function(_0x440ee9){try{jsonpatch['apply'](_0x440ee9,_0x5baf74,!![]);}catch(_0x3c689a){return BPromise[_0x6d24('0x1e')](_0x3c689a);}return _0x440ee9[_0x6d24('0x1f')]();};}function saveUpdates(_0x3a7566,_0x24eac3){return function(_0x1d0e06){if(_0x1d0e06){return _0x1d0e06[_0x6d24('0x20')](_0x3a7566)[_0x6d24('0x21')](function(_0x50fd22){return _0x50fd22;});}return null;};}function removeEntity(_0x29d5ef,_0x116d81){return function(_0x3c1af9){if(_0x3c1af9){return _0x3c1af9['destroy']()[_0x6d24('0x21')](function(){_0x29d5ef['status'](0xcc)[_0x6d24('0x17')]();});}};}function handleEntityNotFound(_0x3c46aa,_0x3fca49){return function(_0x46c0ee){if(!_0x46c0ee){_0x3c46aa['sendStatus'](0x194);}return _0x46c0ee;};}function handleError(_0x5aa0e0,_0x3f5cbf){_0x3f5cbf=_0x3f5cbf||0x1f4;return function(_0x3d14d6){logger['error'](_0x3d14d6[_0x6d24('0x22')]);if(_0x3d14d6[_0x6d24('0x23')]){delete _0x3d14d6[_0x6d24('0x23')];}_0x5aa0e0[_0x6d24('0x18')](_0x3f5cbf)['send'](_0x3d14d6);};}exports['index']=function(_0x35beb5,_0x1a462e){var _0x47d0c9={},_0x57da8e={},_0x149df0={'count':0x0,'rows':[]};var _0x3191f0=db[_0x6d24('0x24')][_0x6d24('0x25')];_0x57da8e[_0x6d24('0x26')]=_[_0x6d24('0x27')](_0x3191f0);_0x57da8e[_0x6d24('0x28')]=_[_0x6d24('0x27')](_0x35beb5['query']);_0x57da8e[_0x6d24('0x29')]=_['intersection'](_0x57da8e[_0x6d24('0x26')],_0x57da8e[_0x6d24('0x28')]);_0x47d0c9[_0x6d24('0x2a')]=_['intersection'](_0x57da8e['model'],qs[_0x6d24('0x2b')](_0x35beb5[_0x6d24('0x28')][_0x6d24('0x2b')]));_0x47d0c9[_0x6d24('0x2a')]=_0x47d0c9[_0x6d24('0x2a')][_0x6d24('0x2c')]?_0x47d0c9[_0x6d24('0x2a')]:_0x57da8e['model'];if(!_0x35beb5['query'][_0x6d24('0x2d')](_0x6d24('0x2e'))){_0x47d0c9['limit']=qs[_0x6d24('0x2f')](_0x35beb5[_0x6d24('0x28')][_0x6d24('0x2f')]);_0x47d0c9[_0x6d24('0x1a')]=qs[_0x6d24('0x1a')](_0x35beb5[_0x6d24('0x28')][_0x6d24('0x1a')]);}_0x47d0c9[_0x6d24('0x30')]=qs[_0x6d24('0x31')](_0x35beb5[_0x6d24('0x28')][_0x6d24('0x31')]);_0x47d0c9[_0x6d24('0x32')]=qs['filters'](_[_0x6d24('0x33')](_0x35beb5['query'],_0x57da8e[_0x6d24('0x29')]));if(_0x35beb5[_0x6d24('0x28')][_0x6d24('0x34')]){_0x47d0c9[_0x6d24('0x32')]=_[_0x6d24('0x35')](_0x47d0c9[_0x6d24('0x32')],{'$or':_['map'](_0x3191f0,function(_0x2bb568){if(_0x2bb568[_0x6d24('0x36')][_0x6d24('0x37')]!==_0x6d24('0x38')){var _0x485d99={};_0x485d99[_0x2bb568[_0x6d24('0x39')]]={'$like':'%'+_0x35beb5['query'][_0x6d24('0x34')]+'%'};return _0x485d99;}})});}_0x47d0c9=_['merge']({},_0x47d0c9,_0x35beb5[_0x6d24('0x3a')]);var _0x423746={'where':_0x47d0c9[_0x6d24('0x32')]};return db[_0x6d24('0x24')]['count'](_0x423746)['then'](function(_0x7720de){_0x149df0['count']=_0x7720de;if(_0x35beb5[_0x6d24('0x28')][_0x6d24('0x3b')]){_0x47d0c9['include']=[{'all':!![]}];}return db[_0x6d24('0x24')][_0x6d24('0x3c')](_0x47d0c9);})[_0x6d24('0x21')](function(_0x3da33a){_0x149df0[_0x6d24('0x3d')]=_0x3da33a;return _0x149df0;})['then'](respondWithFilteredResult(_0x1a462e,_0x47d0c9))[_0x6d24('0x3e')](handleError(_0x1a462e,null));};exports[_0x6d24('0x3f')]=function(_0x23e213,_0x54e989){var _0x150448={'raw':![],'where':{'id':_0x23e213['params']['id']}},_0x204fbf={};_0x204fbf['model']=_[_0x6d24('0x27')](db[_0x6d24('0x24')][_0x6d24('0x25')]);_0x204fbf[_0x6d24('0x28')]=_['keys'](_0x23e213[_0x6d24('0x28')]);_0x204fbf[_0x6d24('0x29')]=_[_0x6d24('0x40')](_0x204fbf[_0x6d24('0x26')],_0x204fbf['query']);_0x150448[_0x6d24('0x2a')]=_[_0x6d24('0x40')](_0x204fbf[_0x6d24('0x26')],qs['fields'](_0x23e213[_0x6d24('0x28')][_0x6d24('0x2b')]));_0x150448[_0x6d24('0x2a')]=_0x150448['attributes'][_0x6d24('0x2c')]?_0x150448[_0x6d24('0x2a')]:_0x204fbf[_0x6d24('0x26')];if(_0x23e213['query']['includeAll']){_0x150448[_0x6d24('0x41')]=[{'all':!![]}];}_0x150448=_[_0x6d24('0x35')]({},_0x150448,_0x23e213[_0x6d24('0x3a')]);return db['AnalyticFieldReport'][_0x6d24('0x42')](_0x150448)['then'](handleEntityNotFound(_0x54e989,null))[_0x6d24('0x21')](respondWithResult(_0x54e989,null))['catch'](handleError(_0x54e989,null));};exports[_0x6d24('0x43')]=function(_0x44e05d,_0x146b35){return db[_0x6d24('0x24')][_0x6d24('0x43')](_0x44e05d['body'],{})[_0x6d24('0x21')](respondWithResult(_0x146b35,0xc9))[_0x6d24('0x3e')](handleError(_0x146b35,null));};exports[_0x6d24('0x44')]=function(_0x5181e8,_0x5286a3){return db[_0x6d24('0x24')][_0x6d24('0x44')](_0x5181e8[_0x6d24('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5286a3,0xc9))['catch'](handleError(_0x5286a3,null));};exports['update']=function(_0x33e5cf,_0x9d425a){if(_0x33e5cf['body']['id']){delete _0x33e5cf[_0x6d24('0x45')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x33e5cf[_0x6d24('0x46')]['id']}})['then'](handleEntityNotFound(_0x9d425a,null))[_0x6d24('0x21')](saveUpdates(_0x33e5cf[_0x6d24('0x45')],null))['then'](respondWithResult(_0x9d425a,null))['catch'](handleError(_0x9d425a,null));};exports[_0x6d24('0x47')]=function(_0x250de7,_0x362dae){return db[_0x6d24('0x24')][_0x6d24('0x42')]({'where':{'id':_0x250de7[_0x6d24('0x46')]['id']}})[_0x6d24('0x21')](handleEntityNotFound(_0x362dae,null))[_0x6d24('0x21')](removeEntity(_0x362dae,null))[_0x6d24('0x3e')](handleError(_0x362dae,null));};exports[_0x6d24('0x48')]=function(_0x2fbc65,_0x2f4a0e){return db[_0x6d24('0x24')][_0x6d24('0x47')]({'where':{'id':_0x2fbc65[_0x6d24('0x28')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2f4a0e,0xcc))[_0x6d24('0x3e')](handleError(_0x2f4a0e,null));};exports[_0x6d24('0x49')]=function(_0x3e987d,_0x5f4776,_0x283be2){return db['AnalyticCustomReport'][_0x6d24('0x4a')]({'where':{'id':_0x3e987d[_0x6d24('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f4776,null))['then'](function(_0x3cdee0){if(_0x3cdee0){return db[_0x6d24('0x4b')]['transaction'](function(_0x11dcea){return db[_0x6d24('0x24')][_0x6d24('0x47')]({'where':{'CustomReportId':_0x3e987d[_0x6d24('0x46')]['id']},'transaction':_0x11dcea})['then'](function(_0x5aaa8b){var _0x321c27=_[_0x6d24('0x4c')](_0x3e987d[_0x6d24('0x45')],function(_0x23ce97){delete _0x23ce97['id'];_0x23ce97['CustomReportId']=_0x3e987d[_0x6d24('0x46')]['id'];return _0x23ce97;});return db['AnalyticFieldReport']['bulkCreate'](_0x321c27,{'transaction':_0x11dcea});});})[_0x6d24('0x21')](function(){return db['AnalyticFieldReport'][_0x6d24('0x3c')]({'where':{'CustomReportId':_0x3e987d[_0x6d24('0x46')]['id']}});});}})[_0x6d24('0x21')](respondWithResult(_0x5f4776,null))['catch'](handleError(_0x5f4776,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e76f4bf..2b0412a 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 _0x7dd2=['path','rimraf','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','request-promise'];(function(_0x62079,_0x45db0e){var _0x4d6e32=function(_0x161ba0){while(--_0x161ba0){_0x62079['push'](_0x62079['shift']());}};_0x4d6e32(++_0x45db0e);}(_0x7dd2,0x1c9));var _0x27dd=function(_0x307a8c,_0x296706){_0x307a8c=_0x307a8c-0x0;var _0x30a1a6=_0x7dd2[_0x307a8c];return _0x30a1a6;};'use strict';var _=require(_0x27dd('0x0'));var util=require('util');var logger=require(_0x27dd('0x1'))(_0x27dd('0x2'));var moment=require(_0x27dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x27dd('0x4'));var fs=require('fs');var path=require(_0x27dd('0x5'));var rimraf=require(_0x27dd('0x6'));var config=require('../../config/environment');var attributes=require(_0x27dd('0x7'));module[_0x27dd('0x8')]=function(_0x1907a9,_0x17209e){return _0x1907a9['define'](_0x27dd('0x9'),attributes,{'tableName':_0x27dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30c5=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','moment','bluebird','rimraf'];(function(_0x35cb30,_0x12ac50){var _0x2742b9=function(_0x54e888){while(--_0x54e888){_0x35cb30['push'](_0x35cb30['shift']());}};_0x2742b9(++_0x12ac50);}(_0x30c5,0x166));var _0x530c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x30c5[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x530c('0x0'));var util=require(_0x530c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x530c('0x2'));var BPromise=require(_0x530c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x530c('0x4'));var config=require(_0x530c('0x5'));var attributes=require(_0x530c('0x6'));module[_0x530c('0x7')]=function(_0x77d1ae,_0x216052){return _0x77d1ae[_0x530c('0x8')](_0x530c('0x9'),attributes,{'tableName':_0x530c('0xa'),'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 6465bc7..2935248 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 _0xc4fe=['jayson/promise','client','request','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0xc4fe,0x1c6));var _0xec4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xec4f('0x0'));var moment=require(_0xec4f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec4f('0x2'));var db=require(_0xec4f('0x3'))['db'];var utils=require(_0xec4f('0x4'));var logger=require(_0xec4f('0x5'))(_0xec4f('0x6'));var config=require(_0xec4f('0x7'));var jayson=require(_0xec4f('0x8'));var client=jayson[_0xec4f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f73ae,_0xe45732,_0x4c099f){return new BPromise(function(_0x263f4e,_0x2e9c2f){return client[_0xec4f('0xa')](_0x3f73ae,_0x4c099f)['then'](function(_0x5ad607){logger['info'](_0xec4f('0xb'),_0xe45732,'request\x20sent');logger['debug'](_0xec4f('0xc'),_0xe45732,_0xec4f('0xd'),JSON[_0xec4f('0xe')](_0x5ad607));if(_0x5ad607['error']){if(_0x5ad607[_0xec4f('0xf')][_0xec4f('0x10')]===0x1f4){logger[_0xec4f('0xf')](_0xec4f('0xb'),_0xe45732,_0x5ad607[_0xec4f('0xf')][_0xec4f('0x11')]);return _0x2e9c2f(_0x5ad607[_0xec4f('0xf')][_0xec4f('0x11')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xe45732,_0x5ad607[_0xec4f('0xf')][_0xec4f('0x11')]);return _0x263f4e(_0x5ad607[_0xec4f('0xf')][_0xec4f('0x11')]);}else{logger[_0xec4f('0x12')](_0xec4f('0xb'),_0xe45732,_0xec4f('0xd'));_0x263f4e(_0x5ad607[_0xec4f('0x13')][_0xec4f('0x11')]);}})[_0xec4f('0x14')](function(_0x3898e2){logger[_0xec4f('0xf')](_0xec4f('0xb'),_0xe45732,_0x3898e2);_0x2e9c2f(_0x3898e2);});});} \ No newline at end of file +var _0xedde=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x200036,_0x5b9d16){var _0x4f6d3c=function(_0x132e4d){while(--_0x132e4d){_0x200036['push'](_0x200036['shift']());}};_0x4f6d3c(++_0x5b9d16);}(_0xedde,0x17c));var _0xeedd=function(_0x275320,_0x1c2ce9){_0x275320=_0x275320-0x0;var _0x1b13fd=_0xedde[_0x275320];return _0x1b13fd;};'use strict';var _=require(_0xeedd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeedd('0x1'));var rs=require(_0xeedd('0x2'));var fs=require('fs');var Redis=require(_0xeedd('0x3'));var db=require(_0xeedd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeedd('0x5'))(_0xeedd('0x6'));var config=require(_0xeedd('0x7'));var jayson=require(_0xeedd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16aa68,_0x1323a0,_0x195767){return new BPromise(function(_0x48e971,_0x1e1b12){return client[_0xeedd('0x9')](_0x16aa68,_0x195767)['then'](function(_0x2d242b){logger[_0xeedd('0xa')](_0xeedd('0xb'),_0x1323a0,_0xeedd('0xc'));logger[_0xeedd('0xd')](_0xeedd('0xe'),_0x1323a0,_0xeedd('0xc'),JSON[_0xeedd('0xf')](_0x2d242b));if(_0x2d242b['error']){if(_0x2d242b['error'][_0xeedd('0x10')]===0x1f4){logger[_0xeedd('0x11')](_0xeedd('0xb'),_0x1323a0,_0x2d242b[_0xeedd('0x11')][_0xeedd('0x12')]);return _0x1e1b12(_0x2d242b[_0xeedd('0x11')][_0xeedd('0x12')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x1323a0,_0x2d242b[_0xeedd('0x11')]['message']);return _0x48e971(_0x2d242b['error'][_0xeedd('0x12')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x1323a0,_0xeedd('0xc'));_0x48e971(_0x2d242b[_0xeedd('0x13')]['message']);}})[_0xeedd('0x14')](function(_0x251870){logger[_0xeedd('0x11')](_0xeedd('0xb'),_0x1323a0,_0x251870);_0x1e1b12(_0x251870);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 56ed99f..e01f761 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 _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0x3e74,0x175));var _0x43e7=function(_0x5e4947,_0x536c5b){_0x5e4947=_0x5e4947-0x0;var _0x27b753=_0x3e74[_0x5e4947];return _0x27b753;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file +var _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x4e0e02,_0x2dd614){var _0x4c32f5=function(_0x215403){while(--_0x215403){_0x4e0e02['push'](_0x4e0e02['shift']());}};_0x4c32f5(++_0x2dd614);}(_0x3e74,0x175));var _0x43e7=function(_0x35a159,_0x4e4d94){_0x35a159=_0x35a159-0x0;var _0x5cc1b2=_0x3e74[_0x35a159];return _0x5cc1b2;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 83ad9a3..27b8207 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 _0xba30=['sequelize','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xba30,0xf0));var _0x0ba3=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0xba30[_0x2797c6];return _0x54809f;};'use strict';var Sequelize=require(_0x0ba3('0x0'));module[_0x0ba3('0x1')]={'name':{'type':Sequelize[_0x0ba3('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x0ba3('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3145=['STRING','name','TEXT','exports'];(function(_0x152215,_0x263ce){var _0x38e93a=function(_0x42c092){while(--_0x42c092){_0x152215['push'](_0x152215['shift']());}};_0x38e93a(++_0x263ce);}(_0x3145,0xc7));var _0x5314=function(_0x1de261,_0x2c7552){_0x1de261=_0x1de261-0x0;var _0x52b51e=_0x3145[_0x1de261];return _0x52b51e;};'use strict';var Sequelize=require('sequelize');module[_0x5314('0x0')]={'name':{'type':Sequelize[_0x5314('0x1')],'allowNull':![],'unique':_0x5314('0x2')},'table':{'type':Sequelize[_0x5314('0x1')]},'metric':{'type':Sequelize[_0x5314('0x3')]},'description':{'type':Sequelize[_0x5314('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a635ec0..2d6fbf1 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 _0xc2a2=['json','count','offset','limit','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','AnalyticMetric','rawAttributes','model','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','query','order','sort','where','filters','pick','filter','type','key','field','merge','options','include','findAll','show','params','catch','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','body','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2a2,0x83));var _0x2c2a=function(_0x1c8177,_0x1055c1){_0x1c8177=_0x1c8177-0x0;var _0x44a33e=_0xc2a2[_0x1c8177];return _0x44a33e;};'use strict';var pdf=require(_0x2c2a('0x0'));var emlformat=require(_0x2c2a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c2a('0x2'));var rp=require(_0x2c2a('0x3'));var moment=require('moment');var BPromise=require(_0x2c2a('0x4'));var Mustache=require(_0x2c2a('0x5'));var util=require(_0x2c2a('0x6'));var path=require(_0x2c2a('0x7'));var sox=require(_0x2c2a('0x8'));var csv=require('to-csv');var ejs=require(_0x2c2a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c2a('0xa'));var crypto=require(_0x2c2a('0xb'));var jsforce=require(_0x2c2a('0xc'));var deskjs=require(_0x2c2a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2c2a('0xe'));var Papa=require(_0x2c2a('0xf'));var Redis=require('ioredis');var authService=require(_0x2c2a('0x10'));var qs=require(_0x2c2a('0x11'));var hardwareService=require(_0x2c2a('0x12'));var logger=require(_0x2c2a('0x13'))(_0x2c2a('0x14'));var utils=require(_0x2c2a('0x15'));var config=require(_0x2c2a('0x16'));var db=require(_0x2c2a('0x17'))['db'];function respondWithStatusCode(_0x249c99,_0x3d4eab){_0x3d4eab=_0x3d4eab||0xcc;return function(_0x38d9aa){if(_0x38d9aa){return _0x249c99[_0x2c2a('0x18')](_0x3d4eab);}return _0x249c99[_0x2c2a('0x19')](_0x3d4eab)[_0x2c2a('0x1a')]();};}function respondWithResult(_0x26d155,_0x32e3d2){_0x32e3d2=_0x32e3d2||0xc8;return function(_0x5c114c){if(_0x5c114c){return _0x26d155[_0x2c2a('0x19')](_0x32e3d2)[_0x2c2a('0x1b')](_0x5c114c);}};}function respondWithFilteredResult(_0x872c90,_0x339c46){return function(_0x1adae1){if(_0x1adae1){var _0x2fbaa6=_0x1adae1[_0x2c2a('0x1c')],_0x43cc53=_0x339c46['offset'],_0x2a3e90=_0x339c46[_0x2c2a('0x1d')]+_0x339c46[_0x2c2a('0x1e')],_0x1eb099;if(_0x2a3e90>=_0x2fbaa6){_0x2a3e90=_0x2fbaa6;_0x1eb099=0xc8;}else{_0x1eb099=0xce;}_0x872c90['status'](_0x1eb099);return _0x872c90[_0x2c2a('0x1f')](_0x2c2a('0x20'),_0x43cc53+'-'+_0x2a3e90+'/'+_0x2fbaa6)[_0x2c2a('0x1b')](_0x1adae1);}return null;};}function patchUpdates(_0x58d148){return function(_0x3254ad){try{jsonpatch['apply'](_0x3254ad,_0x58d148,!![]);}catch(_0x3ff5b9){return BPromise[_0x2c2a('0x21')](_0x3ff5b9);}return _0x3254ad[_0x2c2a('0x22')]();};}function saveUpdates(_0x257c7d,_0x572a65){return function(_0x6facc1){if(_0x6facc1){return _0x6facc1[_0x2c2a('0x23')](_0x257c7d)['then'](function(_0x27d5a5){return _0x27d5a5;});}return null;};}function removeEntity(_0x266b3d,_0x1a3410){return function(_0x376624){if(_0x376624){return _0x376624['destroy']()[_0x2c2a('0x24')](function(){var _0x159f55=_0x376624[_0x2c2a('0x25')]({'plain':!![]});var _0x41e244=_0x2c2a('0x26');return db[_0x2c2a('0x27')][_0x2c2a('0x28')]({'where':{'type':_0x41e244,'resourceId':_0x159f55['id']}})[_0x2c2a('0x24')](function(){return _0x376624;});})[_0x2c2a('0x24')](function(){_0x266b3d[_0x2c2a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x396871,_0x404c5b){return function(_0x2637d6){if(!_0x2637d6){_0x396871['sendStatus'](0x194);}return _0x2637d6;};}function handleError(_0x526138,_0x2a312c){_0x2a312c=_0x2a312c||0x1f4;return function(_0x46a508){logger[_0x2c2a('0x29')](_0x46a508[_0x2c2a('0x2a')]);if(_0x46a508[_0x2c2a('0x2b')]){delete _0x46a508[_0x2c2a('0x2b')];}_0x526138['status'](_0x2a312c)['send'](_0x46a508);};}exports['index']=function(_0x10f9a4,_0x18e4a6){var _0x34e1b8={},_0x13be6b={},_0x40fac5={'count':0x0,'rows':[]};var _0x544c43=db[_0x2c2a('0x2c')][_0x2c2a('0x2d')];_0x13be6b[_0x2c2a('0x2e')]=_[_0x2c2a('0x2f')](_0x544c43);_0x13be6b['query']=_['keys'](_0x10f9a4['query']);_0x13be6b['filters']=_[_0x2c2a('0x30')](_0x13be6b[_0x2c2a('0x2e')],_0x13be6b['query']);_0x34e1b8[_0x2c2a('0x31')]=_['intersection'](_0x13be6b[_0x2c2a('0x2e')],qs['fields'](_0x10f9a4['query'][_0x2c2a('0x32')]));_0x34e1b8[_0x2c2a('0x31')]=_0x34e1b8[_0x2c2a('0x31')][_0x2c2a('0x33')]?_0x34e1b8[_0x2c2a('0x31')]:_0x13be6b[_0x2c2a('0x2e')];if(!_0x10f9a4['query'][_0x2c2a('0x34')](_0x2c2a('0x35'))){_0x34e1b8[_0x2c2a('0x1e')]=qs['limit'](_0x10f9a4[_0x2c2a('0x36')]['limit']);_0x34e1b8[_0x2c2a('0x1d')]=qs[_0x2c2a('0x1d')](_0x10f9a4[_0x2c2a('0x36')]['offset']);}_0x34e1b8[_0x2c2a('0x37')]=qs['sort'](_0x10f9a4[_0x2c2a('0x36')][_0x2c2a('0x38')]);_0x34e1b8[_0x2c2a('0x39')]=qs[_0x2c2a('0x3a')](_[_0x2c2a('0x3b')](_0x10f9a4[_0x2c2a('0x36')],_0x13be6b[_0x2c2a('0x3a')]));if(_0x10f9a4[_0x2c2a('0x36')][_0x2c2a('0x3c')]){_0x34e1b8['where']=_['merge'](_0x34e1b8[_0x2c2a('0x39')],{'$or':_['map'](_0x544c43,function(_0x433d8b){if(_0x433d8b[_0x2c2a('0x3d')][_0x2c2a('0x3e')]!=='VIRTUAL'){var _0x4261e2={};_0x4261e2[_0x433d8b[_0x2c2a('0x3f')]]={'$like':'%'+_0x10f9a4[_0x2c2a('0x36')][_0x2c2a('0x3c')]+'%'};return _0x4261e2;}})});}_0x34e1b8=_[_0x2c2a('0x40')]({},_0x34e1b8,_0x10f9a4[_0x2c2a('0x41')]);var _0xb52cc0={'where':_0x34e1b8[_0x2c2a('0x39')]};return db['AnalyticMetric'][_0x2c2a('0x1c')](_0xb52cc0)['then'](function(_0x52a4bc){_0x40fac5[_0x2c2a('0x1c')]=_0x52a4bc;if(_0x10f9a4[_0x2c2a('0x36')]['includeAll']){_0x34e1b8[_0x2c2a('0x42')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x2c2a('0x43')](_0x34e1b8);})[_0x2c2a('0x24')](function(_0x451a4c){_0x40fac5['rows']=_0x451a4c;return _0x40fac5;})['then'](respondWithFilteredResult(_0x18e4a6,_0x34e1b8))['catch'](handleError(_0x18e4a6,null));};exports[_0x2c2a('0x44')]=function(_0x3049a4,_0x2e8025){var _0x445468={'raw':!![],'where':{'id':_0x3049a4[_0x2c2a('0x45')]['id']}},_0x3aa5ee={};_0x3aa5ee[_0x2c2a('0x2e')]=_[_0x2c2a('0x2f')](db[_0x2c2a('0x2c')][_0x2c2a('0x2d')]);_0x3aa5ee[_0x2c2a('0x36')]=_[_0x2c2a('0x2f')](_0x3049a4[_0x2c2a('0x36')]);_0x3aa5ee[_0x2c2a('0x3a')]=_['intersection'](_0x3aa5ee[_0x2c2a('0x2e')],_0x3aa5ee[_0x2c2a('0x36')]);_0x445468[_0x2c2a('0x31')]=_['intersection'](_0x3aa5ee[_0x2c2a('0x2e')],qs['fields'](_0x3049a4[_0x2c2a('0x36')][_0x2c2a('0x32')]));_0x445468[_0x2c2a('0x31')]=_0x445468[_0x2c2a('0x31')][_0x2c2a('0x33')]?_0x445468[_0x2c2a('0x31')]:_0x3aa5ee[_0x2c2a('0x2e')];if(_0x3049a4[_0x2c2a('0x36')]['includeAll']){_0x445468['include']=[{'all':!![]}];}_0x445468=_[_0x2c2a('0x40')]({},_0x445468,_0x3049a4[_0x2c2a('0x41')]);return db[_0x2c2a('0x2c')]['find'](_0x445468)[_0x2c2a('0x24')](handleEntityNotFound(_0x2e8025,null))[_0x2c2a('0x24')](respondWithResult(_0x2e8025,null))[_0x2c2a('0x46')](handleError(_0x2e8025,null));};exports[_0x2c2a('0x47')]=function(_0x1e2011,_0x514633){return db[_0x2c2a('0x2c')]['create'](_0x1e2011['body'],{})[_0x2c2a('0x24')](function(_0xf1c6e2){var _0x4b6542=_0x1e2011[_0x2c2a('0x48')]['get']({'plain':!![]});if(!_0x4b6542)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b6542[_0x2c2a('0x49')]===_0x2c2a('0x48')){var _0x2ca3c6=_0xf1c6e2[_0x2c2a('0x25')]({'plain':!![]});var _0x57e3d0='Metrics';return db[_0x2c2a('0x4a')][_0x2c2a('0x4b')]({'where':{'name':_0x57e3d0,'userProfileId':_0x4b6542[_0x2c2a('0x4c')]},'raw':!![]})[_0x2c2a('0x24')](function(_0x3277ef){if(_0x3277ef&&_0x3277ef[_0x2c2a('0x4d')]===0x0){return db[_0x2c2a('0x27')][_0x2c2a('0x47')]({'name':_0x2ca3c6[_0x2c2a('0x2b')],'resourceId':_0x2ca3c6['id'],'type':_0x3277ef[_0x2c2a('0x2b')],'sectionId':_0x3277ef['id']},{})[_0x2c2a('0x24')](function(){return _0xf1c6e2;});}else{return _0xf1c6e2;}})['catch'](function(_0x40aafa){logger[_0x2c2a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40aafa);throw _0x40aafa;});}return _0xf1c6e2;})[_0x2c2a('0x24')](respondWithResult(_0x514633,0xc9))[_0x2c2a('0x46')](handleError(_0x514633,null));};exports[_0x2c2a('0x23')]=function(_0x49236e,_0x44e8dd){if(_0x49236e[_0x2c2a('0x4e')]['id']){delete _0x49236e[_0x2c2a('0x4e')]['id'];}return db[_0x2c2a('0x2c')]['find']({'where':{'id':_0x49236e[_0x2c2a('0x45')]['id']}})[_0x2c2a('0x24')](handleEntityNotFound(_0x44e8dd,null))[_0x2c2a('0x24')](saveUpdates(_0x49236e[_0x2c2a('0x4e')],null))[_0x2c2a('0x24')](respondWithResult(_0x44e8dd,null))[_0x2c2a('0x46')](handleError(_0x44e8dd,null));};exports[_0x2c2a('0x28')]=function(_0x4a0679,_0x3bd3ce){return db[_0x2c2a('0x2c')]['find']({'where':{'id':_0x4a0679['params']['id']}})['then'](handleEntityNotFound(_0x3bd3ce,null))['then'](removeEntity(_0x3bd3ce,null))['catch'](handleError(_0x3bd3ce,null));}; \ No newline at end of file +var _0x44ae=['filter','merge','type','key','VIRTUAL','includeAll','include','rows','catch','show','options','create','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','sendStatus','error','stack','name','index','AnalyticMetric','rawAttributes','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x44ae,0x19a));var _0xe44a=function(_0x7d0149,_0x1b6d23){_0x7d0149=_0x7d0149-0x0;var _0xaabd78=_0x44ae[_0x7d0149];return _0xaabd78;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe44a('0x0'));var zipdir=require(_0xe44a('0x1'));var jsonpatch=require(_0xe44a('0x2'));var rp=require(_0xe44a('0x3'));var moment=require(_0xe44a('0x4'));var BPromise=require(_0xe44a('0x5'));var Mustache=require('mustache');var util=require(_0xe44a('0x6'));var path=require('path');var sox=require(_0xe44a('0x7'));var csv=require('to-csv');var ejs=require(_0xe44a('0x8'));var fs=require('fs');var _=require(_0xe44a('0x9'));var squel=require(_0xe44a('0xa'));var crypto=require(_0xe44a('0xb'));var jsforce=require(_0xe44a('0xc'));var deskjs=require(_0xe44a('0xd'));var toCsv=require(_0xe44a('0xe'));var querystring=require(_0xe44a('0xf'));var Papa=require(_0xe44a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe44a('0x11'));var hardwareService=require(_0xe44a('0x12'));var logger=require('../../config/logger')(_0xe44a('0x13'));var utils=require(_0xe44a('0x14'));var config=require(_0xe44a('0x15'));var db=require(_0xe44a('0x16'))['db'];function respondWithStatusCode(_0xf59ebe,_0x2d8a43){_0x2d8a43=_0x2d8a43||0xcc;return function(_0x3e8114){if(_0x3e8114){return _0xf59ebe['sendStatus'](_0x2d8a43);}return _0xf59ebe[_0xe44a('0x17')](_0x2d8a43)[_0xe44a('0x18')]();};}function respondWithResult(_0x5e6ec4,_0x7f6515){_0x7f6515=_0x7f6515||0xc8;return function(_0x42ca65){if(_0x42ca65){return _0x5e6ec4[_0xe44a('0x17')](_0x7f6515)['json'](_0x42ca65);}};}function respondWithFilteredResult(_0x56cef6,_0x49e4ff){return function(_0xc83823){if(_0xc83823){var _0x3a7fcf=_0xc83823[_0xe44a('0x19')],_0x155f03=_0x49e4ff[_0xe44a('0x1a')],_0x24483c=_0x49e4ff[_0xe44a('0x1a')]+_0x49e4ff[_0xe44a('0x1b')],_0x4c9e1b;if(_0x24483c>=_0x3a7fcf){_0x24483c=_0x3a7fcf;_0x4c9e1b=0xc8;}else{_0x4c9e1b=0xce;}_0x56cef6[_0xe44a('0x17')](_0x4c9e1b);return _0x56cef6['set'](_0xe44a('0x1c'),_0x155f03+'-'+_0x24483c+'/'+_0x3a7fcf)[_0xe44a('0x1d')](_0xc83823);}return null;};}function patchUpdates(_0x2aebb1){return function(_0x48a963){try{jsonpatch[_0xe44a('0x1e')](_0x48a963,_0x2aebb1,!![]);}catch(_0x22af1c){return BPromise[_0xe44a('0x1f')](_0x22af1c);}return _0x48a963[_0xe44a('0x20')]();};}function saveUpdates(_0x151d3e,_0x424210){return function(_0x27df9d){if(_0x27df9d){return _0x27df9d[_0xe44a('0x21')](_0x151d3e)[_0xe44a('0x22')](function(_0x45b193){return _0x45b193;});}return null;};}function removeEntity(_0x31030a,_0x506bf6){return function(_0x385f73){if(_0x385f73){return _0x385f73[_0xe44a('0x23')]()['then'](function(){var _0x1d8b27=_0x385f73[_0xe44a('0x24')]({'plain':!![]});var _0xa19947=_0xe44a('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0xa19947,'resourceId':_0x1d8b27['id']}})['then'](function(){return _0x385f73;});})['then'](function(){_0x31030a['status'](0xcc)[_0xe44a('0x18')]();});}};}function handleEntityNotFound(_0x30b7ea,_0x3977fa){return function(_0x53364c){if(!_0x53364c){_0x30b7ea[_0xe44a('0x26')](0x194);}return _0x53364c;};}function handleError(_0x34b730,_0x4cef8b){_0x4cef8b=_0x4cef8b||0x1f4;return function(_0xbfa47a){logger[_0xe44a('0x27')](_0xbfa47a[_0xe44a('0x28')]);if(_0xbfa47a[_0xe44a('0x29')]){delete _0xbfa47a[_0xe44a('0x29')];}_0x34b730[_0xe44a('0x17')](_0x4cef8b)['send'](_0xbfa47a);};}exports[_0xe44a('0x2a')]=function(_0x354257,_0x2c7b89){var _0x12f6c7={},_0x367139={},_0x19956e={'count':0x0,'rows':[]};var _0x405b26=db[_0xe44a('0x2b')][_0xe44a('0x2c')];_0x367139['model']=_[_0xe44a('0x2d')](_0x405b26);_0x367139[_0xe44a('0x2e')]=_['keys'](_0x354257[_0xe44a('0x2e')]);_0x367139[_0xe44a('0x2f')]=_[_0xe44a('0x30')](_0x367139['model'],_0x367139[_0xe44a('0x2e')]);_0x12f6c7[_0xe44a('0x31')]=_['intersection'](_0x367139[_0xe44a('0x32')],qs['fields'](_0x354257[_0xe44a('0x2e')][_0xe44a('0x33')]));_0x12f6c7[_0xe44a('0x31')]=_0x12f6c7[_0xe44a('0x31')]['length']?_0x12f6c7[_0xe44a('0x31')]:_0x367139[_0xe44a('0x32')];if(!_0x354257['query'][_0xe44a('0x34')](_0xe44a('0x35'))){_0x12f6c7[_0xe44a('0x1b')]=qs[_0xe44a('0x1b')](_0x354257[_0xe44a('0x2e')][_0xe44a('0x1b')]);_0x12f6c7['offset']=qs['offset'](_0x354257['query'][_0xe44a('0x1a')]);}_0x12f6c7[_0xe44a('0x36')]=qs['sort'](_0x354257[_0xe44a('0x2e')][_0xe44a('0x37')]);_0x12f6c7[_0xe44a('0x38')]=qs['filters'](_[_0xe44a('0x39')](_0x354257[_0xe44a('0x2e')],_0x367139['filters']));if(_0x354257[_0xe44a('0x2e')][_0xe44a('0x3a')]){_0x12f6c7[_0xe44a('0x38')]=_[_0xe44a('0x3b')](_0x12f6c7['where'],{'$or':_['map'](_0x405b26,function(_0x1ce3ce){if(_0x1ce3ce[_0xe44a('0x3c')][_0xe44a('0x3d')]!==_0xe44a('0x3e')){var _0x51aadb={};_0x51aadb[_0x1ce3ce['field']]={'$like':'%'+_0x354257[_0xe44a('0x2e')][_0xe44a('0x3a')]+'%'};return _0x51aadb;}})});}_0x12f6c7=_[_0xe44a('0x3b')]({},_0x12f6c7,_0x354257['options']);var _0x19da0c={'where':_0x12f6c7[_0xe44a('0x38')]};return db[_0xe44a('0x2b')]['count'](_0x19da0c)['then'](function(_0x50b319){_0x19956e['count']=_0x50b319;if(_0x354257[_0xe44a('0x2e')][_0xe44a('0x3f')]){_0x12f6c7[_0xe44a('0x40')]=[{'all':!![]}];}return db[_0xe44a('0x2b')]['findAll'](_0x12f6c7);})[_0xe44a('0x22')](function(_0x4d8456){_0x19956e[_0xe44a('0x41')]=_0x4d8456;return _0x19956e;})[_0xe44a('0x22')](respondWithFilteredResult(_0x2c7b89,_0x12f6c7))[_0xe44a('0x42')](handleError(_0x2c7b89,null));};exports[_0xe44a('0x43')]=function(_0x2f8966,_0x50e95d){var _0x212a26={'raw':!![],'where':{'id':_0x2f8966['params']['id']}},_0xe92ef7={};_0xe92ef7['model']=_[_0xe44a('0x2d')](db['AnalyticMetric'][_0xe44a('0x2c')]);_0xe92ef7[_0xe44a('0x2e')]=_[_0xe44a('0x2d')](_0x2f8966['query']);_0xe92ef7[_0xe44a('0x2f')]=_[_0xe44a('0x30')](_0xe92ef7['model'],_0xe92ef7[_0xe44a('0x2e')]);_0x212a26[_0xe44a('0x31')]=_['intersection'](_0xe92ef7[_0xe44a('0x32')],qs[_0xe44a('0x33')](_0x2f8966[_0xe44a('0x2e')]['fields']));_0x212a26[_0xe44a('0x31')]=_0x212a26[_0xe44a('0x31')]['length']?_0x212a26[_0xe44a('0x31')]:_0xe92ef7[_0xe44a('0x32')];if(_0x2f8966[_0xe44a('0x2e')][_0xe44a('0x3f')]){_0x212a26['include']=[{'all':!![]}];}_0x212a26=_[_0xe44a('0x3b')]({},_0x212a26,_0x2f8966[_0xe44a('0x44')]);return db[_0xe44a('0x2b')]['find'](_0x212a26)['then'](handleEntityNotFound(_0x50e95d,null))['then'](respondWithResult(_0x50e95d,null))[_0xe44a('0x42')](handleError(_0x50e95d,null));};exports[_0xe44a('0x45')]=function(_0x2ad9e0,_0x2eb743){return db[_0xe44a('0x2b')]['create'](_0x2ad9e0['body'],{})[_0xe44a('0x22')](function(_0x15ede9){var _0x3ebf85=_0x2ad9e0[_0xe44a('0x46')][_0xe44a('0x24')]({'plain':!![]});if(!_0x3ebf85)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ebf85['role']===_0xe44a('0x46')){var _0x46f4c0=_0x15ede9[_0xe44a('0x24')]({'plain':!![]});var _0xf43cb6='Metrics';return db[_0xe44a('0x47')][_0xe44a('0x48')]({'where':{'name':_0xf43cb6,'userProfileId':_0x3ebf85[_0xe44a('0x49')]},'raw':!![]})[_0xe44a('0x22')](function(_0x13d6bf){if(_0x13d6bf&&_0x13d6bf[_0xe44a('0x4a')]===0x0){return db[_0xe44a('0x4b')]['create']({'name':_0x46f4c0[_0xe44a('0x29')],'resourceId':_0x46f4c0['id'],'type':_0x13d6bf[_0xe44a('0x29')],'sectionId':_0x13d6bf['id']},{})[_0xe44a('0x22')](function(){return _0x15ede9;});}else{return _0x15ede9;}})[_0xe44a('0x42')](function(_0x464b9e){logger[_0xe44a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464b9e);throw _0x464b9e;});}return _0x15ede9;})[_0xe44a('0x22')](respondWithResult(_0x2eb743,0xc9))[_0xe44a('0x42')](handleError(_0x2eb743,null));};exports[_0xe44a('0x21')]=function(_0x158c0c,_0x27074e){if(_0x158c0c[_0xe44a('0x4c')]['id']){delete _0x158c0c[_0xe44a('0x4c')]['id'];}return db['AnalyticMetric'][_0xe44a('0x48')]({'where':{'id':_0x158c0c[_0xe44a('0x4d')]['id']}})[_0xe44a('0x22')](handleEntityNotFound(_0x27074e,null))['then'](saveUpdates(_0x158c0c[_0xe44a('0x4c')],null))[_0xe44a('0x22')](respondWithResult(_0x27074e,null))[_0xe44a('0x42')](handleError(_0x27074e,null));};exports['destroy']=function(_0x4cb9a7,_0x421dfa){return db[_0xe44a('0x2b')][_0xe44a('0x48')]({'where':{'id':_0x4cb9a7[_0xe44a('0x4d')]['id']}})[_0xe44a('0x22')](handleEntityNotFound(_0x421dfa,null))[_0xe44a('0x22')](removeEntity(_0x421dfa,null))[_0xe44a('0x42')](handleError(_0x421dfa,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f940d3e..8d03ad3 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 _0x73f7=['AnalyticMetric','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x73f7,0x182));var _0x773f=function(_0x14711c,_0x2bc35a){_0x14711c=_0x14711c-0x0;var _0x22932=_0x73f7[_0x14711c];return _0x22932;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x773f('0x0'))(_0x773f('0x1'));var moment=require(_0x773f('0x2'));var BPromise=require('bluebird');var rp=require(_0x773f('0x3'));var fs=require('fs');var path=require(_0x773f('0x4'));var rimraf=require(_0x773f('0x5'));var config=require(_0x773f('0x6'));var attributes=require(_0x773f('0x7'));module[_0x773f('0x8')]=function(_0x5646eb,_0x2fff0b){return _0x5646eb[_0x773f('0x9')](_0x773f('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd156=['./analyticMetric.attributes','exports','define','analytics_metrics','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x150efd,_0x1a7ee7){var _0x450588=function(_0x29ee11){while(--_0x29ee11){_0x150efd['push'](_0x150efd['shift']());}};_0x450588(++_0x1a7ee7);}(_0xd156,0x68));var _0x6d15=function(_0x42ab07,_0x2fd96f){_0x42ab07=_0x42ab07-0x0;var _0x5ffe1e=_0xd156[_0x42ab07];return _0x5ffe1e;};'use strict';var _=require('lodash');var util=require(_0x6d15('0x0'));var logger=require(_0x6d15('0x1'))('api');var moment=require(_0x6d15('0x2'));var BPromise=require('bluebird');var rp=require(_0x6d15('0x3'));var fs=require('fs');var path=require(_0x6d15('0x4'));var rimraf=require('rimraf');var config=require(_0x6d15('0x5'));var attributes=require(_0x6d15('0x6'));module[_0x6d15('0x7')]=function(_0x5e351d,_0x519dd6){return _0x5e351d[_0x6d15('0x8')]('AnalyticMetric',attributes,{'tableName':_0x6d15('0x9'),'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 fa7f89f..61856c9 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 _0x06de=['stringify','error','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','request\x20sent'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x06de,0xf6));var _0xe06d=function(_0x475bf1,_0x5235b6){_0x475bf1=_0x475bf1-0x0;var _0x4095d1=_0x06de[_0x475bf1];return _0x4095d1;};'use strict';var _=require(_0xe06d('0x0'));var util=require(_0xe06d('0x1'));var moment=require(_0xe06d('0x2'));var BPromise=require('bluebird');var rs=require(_0xe06d('0x3'));var fs=require('fs');var Redis=require(_0xe06d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe06d('0x5'))(_0xe06d('0x6'));var config=require(_0xe06d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe06d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x435c23,_0x4d4e4c,_0x5e0c29){return new BPromise(function(_0x2381ca,_0x48a6b1){return client[_0xe06d('0x9')](_0x435c23,_0x5e0c29)[_0xe06d('0xa')](function(_0xafa42a){logger[_0xe06d('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x4d4e4c,'request\x20sent');logger[_0xe06d('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4d4e4c,_0xe06d('0xd'),JSON[_0xe06d('0xe')](_0xafa42a));if(_0xafa42a[_0xe06d('0xf')]){if(_0xafa42a[_0xe06d('0xf')]['code']===0x1f4){logger[_0xe06d('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x4d4e4c,_0xafa42a[_0xe06d('0xf')]['message']);return _0x48a6b1(_0xafa42a[_0xe06d('0xf')][_0xe06d('0x10')]);}logger[_0xe06d('0xf')](_0xe06d('0x11'),_0x4d4e4c,_0xafa42a['error'][_0xe06d('0x10')]);return _0x2381ca(_0xafa42a['error'][_0xe06d('0x10')]);}else{logger[_0xe06d('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x4d4e4c,_0xe06d('0xd'));_0x2381ca(_0xafa42a[_0xe06d('0x12')][_0xe06d('0x10')]);}})[_0xe06d('0x13')](function(_0x3a31e2){logger[_0xe06d('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x4d4e4c,_0x3a31e2);_0x48a6b1(_0x3a31e2);});});} \ No newline at end of file +var _0x2b7e=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2b12b0,_0x4480ce){var _0x221d21=function(_0xbdc428){while(--_0xbdc428){_0x2b12b0['push'](_0x2b12b0['shift']());}};_0x221d21(++_0x4480ce);}(_0x2b7e,0xb2));var _0xe2b7=function(_0x25f7c2,_0x2fc28f){_0x25f7c2=_0x25f7c2-0x0;var _0x1a2924=_0x2b7e[_0x25f7c2];return _0x1a2924;};'use strict';var _=require(_0xe2b7('0x0'));var util=require(_0xe2b7('0x1'));var moment=require(_0xe2b7('0x2'));var BPromise=require('bluebird');var rs=require(_0xe2b7('0x3'));var fs=require('fs');var Redis=require(_0xe2b7('0x4'));var db=require(_0xe2b7('0x5'))['db'];var utils=require(_0xe2b7('0x6'));var logger=require('../../config/logger')(_0xe2b7('0x7'));var config=require(_0xe2b7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe2b7('0x9')][_0xe2b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41f8c0,_0x4df0eb,_0x14062c){return new BPromise(function(_0x44a581,_0x2432ba){return client[_0xe2b7('0xb')](_0x41f8c0,_0x14062c)[_0xe2b7('0xc')](function(_0x46244c){logger[_0xe2b7('0xd')](_0xe2b7('0xe'),_0x4df0eb,_0xe2b7('0xf'));logger[_0xe2b7('0x10')](_0xe2b7('0x11'),_0x4df0eb,'request\x20sent',JSON[_0xe2b7('0x12')](_0x46244c));if(_0x46244c[_0xe2b7('0x13')]){if(_0x46244c['error'][_0xe2b7('0x14')]===0x1f4){logger[_0xe2b7('0x13')](_0xe2b7('0xe'),_0x4df0eb,_0x46244c[_0xe2b7('0x13')]['message']);return _0x2432ba(_0x46244c['error'][_0xe2b7('0x15')]);}logger[_0xe2b7('0x13')](_0xe2b7('0xe'),_0x4df0eb,_0x46244c[_0xe2b7('0x13')][_0xe2b7('0x15')]);return _0x44a581(_0x46244c[_0xe2b7('0x13')][_0xe2b7('0x15')]);}else{logger[_0xe2b7('0xd')](_0xe2b7('0xe'),_0x4df0eb,'request\x20sent');_0x44a581(_0x46244c[_0xe2b7('0x16')][_0xe2b7('0x15')]);}})[_0xe2b7('0x17')](function(_0x26859c){logger[_0xe2b7('0x13')](_0xe2b7('0xe'),_0x4df0eb,_0x26859c);_0x2432ba(_0x26859c);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2292345..570dd4a 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 _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x1a8b58,_0x2c6665){var _0x3fa938=function(_0xc93616){while(--_0xc93616){_0x1a8b58['push'](_0x1a8b58['shift']());}};_0x3fa938(++_0x2c6665);}(_0x2542,0x169));var _0x2254=function(_0x103525,_0x2a3fb4){_0x103525=_0x103525-0x0;var _0x3f6cba=_0x2542[_0x103525];return _0x3f6cba;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file +var _0x66fa=['index','get','/:id','isAuthenticated','show','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x66fa,0x117));var _0xa66f=function(_0x144883,_0x10c865){_0x144883=_0x144883-0x0;var _0x199b14=_0x66fa[_0x144883];return _0x199b14;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var auth=require(_0xa66f('0x5'));var interaction=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var controller=require(_0xa66f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa66f('0x9')]);router[_0xa66f('0xa')](_0xa66f('0xb'),auth[_0xa66f('0xc')](),controller[_0xa66f('0xd')]);router['post']('/',auth[_0xa66f('0xc')](),controller['create']);router[_0xa66f('0xe')]('/:id',auth[_0xa66f('0xc')](),controller['update']);router['delete']('/:id',auth[_0xa66f('0xc')](),controller[_0xa66f('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 09fee48..f1d6e69 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 _0x79f0=['sequelize'];(function(_0x42eb51,_0xafa7f2){var _0x403569=function(_0x51d5b9){while(--_0x51d5b9){_0x42eb51['push'](_0x42eb51['shift']());}};_0x403569(++_0xafa7f2);}(_0x79f0,0x105));var _0x079f=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x79f0[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x079f('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x1e59=['exports','TEXT','sequelize'];(function(_0x12cffd,_0x2241cc){var _0x289107=function(_0xb1f244){while(--_0xb1f244){_0x12cffd['push'](_0x12cffd['shift']());}};_0x289107(++_0x2241cc);}(_0x1e59,0x182));var _0x91e5=function(_0x1428f5,_0x402c48){_0x1428f5=_0x1428f5-0x0;var _0xb8f32d=_0x1e59[_0x1428f5];return _0xb8f32d;};'use strict';var Sequelize=require(_0x91e5('0x0'));module[_0x91e5('0x1')]={'tree':{'type':Sequelize[_0x91e5('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 61fb899..338a4bb 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 _0x8827=['apply','save','update','then','end','error','name','index','AnalyticTreeReport','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','params','rawAttributes','create','body','find','catch','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','count','offset','limit','json'];(function(_0x16a2fc,_0x1782ed){var _0x3b914a=function(_0x1226a6){while(--_0x1226a6){_0x16a2fc['push'](_0x16a2fc['shift']());}};_0x3b914a(++_0x1782ed);}(_0x8827,0x68));var _0x7882=function(_0x2570b5,_0xa6f6a6){_0x2570b5=_0x2570b5-0x0;var _0x3afb19=_0x8827[_0x2570b5];return _0x3afb19;};'use strict';var pdf=require(_0x7882('0x0'));var emlformat=require(_0x7882('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7882('0x2'));var jsonpatch=require(_0x7882('0x3'));var rp=require(_0x7882('0x4'));var moment=require(_0x7882('0x5'));var BPromise=require(_0x7882('0x6'));var Mustache=require(_0x7882('0x7'));var util=require('util');var path=require(_0x7882('0x8'));var sox=require('sox');var csv=require(_0x7882('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7882('0xa'));var squel=require('squel');var crypto=require(_0x7882('0xb'));var jsforce=require(_0x7882('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7882('0x9'));var querystring=require('querystring');var Papa=require(_0x7882('0xd'));var Redis=require(_0x7882('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7882('0xf'));var hardwareService=require(_0x7882('0x10'));var logger=require(_0x7882('0x11'))(_0x7882('0x12'));var utils=require('../../config/utils');var config=require(_0x7882('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55e40d,_0x63eeb){_0x63eeb=_0x63eeb||0xcc;return function(_0x25ae70){if(_0x25ae70){return _0x55e40d[_0x7882('0x14')](_0x63eeb);}return _0x55e40d[_0x7882('0x15')](_0x63eeb)['end']();};}function respondWithResult(_0x3e17c9,_0x461bc8){_0x461bc8=_0x461bc8||0xc8;return function(_0x459da3){if(_0x459da3){return _0x3e17c9['status'](_0x461bc8)['json'](_0x459da3);}};}function respondWithFilteredResult(_0x1d6ffd,_0x8cf1a3){return function(_0x48962f){if(_0x48962f){var _0x1ef994=_0x48962f[_0x7882('0x16')],_0x3febb2=_0x8cf1a3[_0x7882('0x17')],_0x294a6e=_0x8cf1a3['offset']+_0x8cf1a3[_0x7882('0x18')],_0x37cd2f;if(_0x294a6e>=_0x1ef994){_0x294a6e=_0x1ef994;_0x37cd2f=0xc8;}else{_0x37cd2f=0xce;}_0x1d6ffd[_0x7882('0x15')](_0x37cd2f);return _0x1d6ffd['set']('Content-Range',_0x3febb2+'-'+_0x294a6e+'/'+_0x1ef994)[_0x7882('0x19')](_0x48962f);}return null;};}function patchUpdates(_0xafa3b1){return function(_0x522cc4){try{jsonpatch[_0x7882('0x1a')](_0x522cc4,_0xafa3b1,!![]);}catch(_0x2a933f){return BPromise['reject'](_0x2a933f);}return _0x522cc4[_0x7882('0x1b')]();};}function saveUpdates(_0x59126a,_0x3b31b5){return function(_0x54fd1c){if(_0x54fd1c){return _0x54fd1c[_0x7882('0x1c')](_0x59126a)[_0x7882('0x1d')](function(_0x3754c9){return _0x3754c9;});}return null;};}function removeEntity(_0x2c8e18,_0x1b6296){return function(_0x5bcb7b){if(_0x5bcb7b){return _0x5bcb7b['destroy']()[_0x7882('0x1d')](function(){_0x2c8e18[_0x7882('0x15')](0xcc)[_0x7882('0x1e')]();});}};}function handleEntityNotFound(_0x4ce5d3,_0x1a4092){return function(_0x2a623a){if(!_0x2a623a){_0x4ce5d3[_0x7882('0x14')](0x194);}return _0x2a623a;};}function handleError(_0x9d0468,_0x8bc692){_0x8bc692=_0x8bc692||0x1f4;return function(_0xa2c1ac){logger[_0x7882('0x1f')](_0xa2c1ac['stack']);if(_0xa2c1ac['name']){delete _0xa2c1ac[_0x7882('0x20')];}_0x9d0468[_0x7882('0x15')](_0x8bc692)['send'](_0xa2c1ac);};}exports[_0x7882('0x21')]=function(_0x5004ff,_0x16db26){var _0x39423c={},_0x41e203={},_0x146491={'count':0x0,'rows':[]};var _0x2a383e=db[_0x7882('0x22')]['rawAttributes'];_0x41e203[_0x7882('0x23')]=_[_0x7882('0x24')](_0x2a383e);_0x41e203['query']=_[_0x7882('0x24')](_0x5004ff[_0x7882('0x25')]);_0x41e203[_0x7882('0x26')]=_[_0x7882('0x27')](_0x41e203[_0x7882('0x23')],_0x41e203[_0x7882('0x25')]);_0x39423c['attributes']=_['intersection'](_0x41e203['model'],qs[_0x7882('0x28')](_0x5004ff[_0x7882('0x25')][_0x7882('0x28')]));_0x39423c[_0x7882('0x29')]=_0x39423c[_0x7882('0x29')][_0x7882('0x2a')]?_0x39423c[_0x7882('0x29')]:_0x41e203[_0x7882('0x23')];if(!_0x5004ff[_0x7882('0x25')][_0x7882('0x2b')](_0x7882('0x2c'))){_0x39423c['limit']=qs[_0x7882('0x18')](_0x5004ff[_0x7882('0x25')]['limit']);_0x39423c[_0x7882('0x17')]=qs[_0x7882('0x17')](_0x5004ff[_0x7882('0x25')][_0x7882('0x17')]);}_0x39423c[_0x7882('0x2d')]=qs['sort'](_0x5004ff[_0x7882('0x25')][_0x7882('0x2e')]);_0x39423c[_0x7882('0x2f')]=qs['filters'](_[_0x7882('0x30')](_0x5004ff[_0x7882('0x25')],_0x41e203[_0x7882('0x26')]));if(_0x5004ff[_0x7882('0x25')][_0x7882('0x31')]){_0x39423c[_0x7882('0x2f')]=_[_0x7882('0x32')](_0x39423c[_0x7882('0x2f')],{'$or':_[_0x7882('0x33')](_0x2a383e,function(_0x4e45f1){if(_0x4e45f1[_0x7882('0x34')][_0x7882('0x35')]!==_0x7882('0x36')){var _0x5927d6={};_0x5927d6[_0x4e45f1['field']]={'$like':'%'+_0x5004ff[_0x7882('0x25')][_0x7882('0x31')]+'%'};return _0x5927d6;}})});}_0x39423c=_[_0x7882('0x32')]({},_0x39423c,_0x5004ff[_0x7882('0x37')]);var _0x5d4505={'where':_0x39423c[_0x7882('0x2f')]};return db[_0x7882('0x22')][_0x7882('0x16')](_0x5d4505)[_0x7882('0x1d')](function(_0x1f223d){_0x146491[_0x7882('0x16')]=_0x1f223d;if(_0x5004ff[_0x7882('0x25')][_0x7882('0x38')]){_0x39423c[_0x7882('0x39')]=[{'all':!![]}];}return db[_0x7882('0x22')]['findAll'](_0x39423c);})[_0x7882('0x1d')](function(_0x1824ce){_0x146491['rows']=_0x1824ce;return _0x146491;})[_0x7882('0x1d')](respondWithFilteredResult(_0x16db26,_0x39423c))['catch'](handleError(_0x16db26,null));};exports['show']=function(_0x2d3107,_0x1f147e){var _0x1d6694={'raw':!![],'where':{'id':_0x2d3107[_0x7882('0x3a')]['id']}},_0x4701fc={};_0x4701fc['model']=_[_0x7882('0x24')](db[_0x7882('0x22')][_0x7882('0x3b')]);_0x4701fc[_0x7882('0x25')]=_[_0x7882('0x24')](_0x2d3107[_0x7882('0x25')]);_0x4701fc[_0x7882('0x26')]=_[_0x7882('0x27')](_0x4701fc[_0x7882('0x23')],_0x4701fc[_0x7882('0x25')]);_0x1d6694[_0x7882('0x29')]=_['intersection'](_0x4701fc['model'],qs['fields'](_0x2d3107[_0x7882('0x25')][_0x7882('0x28')]));_0x1d6694[_0x7882('0x29')]=_0x1d6694[_0x7882('0x29')][_0x7882('0x2a')]?_0x1d6694['attributes']:_0x4701fc[_0x7882('0x23')];if(_0x2d3107['query'][_0x7882('0x38')]){_0x1d6694[_0x7882('0x39')]=[{'all':!![]}];}_0x1d6694=_[_0x7882('0x32')]({},_0x1d6694,_0x2d3107[_0x7882('0x37')]);return db['AnalyticTreeReport']['find'](_0x1d6694)[_0x7882('0x1d')](handleEntityNotFound(_0x1f147e,null))[_0x7882('0x1d')](respondWithResult(_0x1f147e,null))['catch'](handleError(_0x1f147e,null));};exports[_0x7882('0x3c')]=function(_0x2d1e53,_0x19eca8){return db[_0x7882('0x22')][_0x7882('0x3c')](_0x2d1e53[_0x7882('0x3d')],{})[_0x7882('0x1d')](respondWithResult(_0x19eca8,0xc9))['catch'](handleError(_0x19eca8,null));};exports[_0x7882('0x1c')]=function(_0x3172d4,_0x530f79){if(_0x3172d4[_0x7882('0x3d')]['id']){delete _0x3172d4[_0x7882('0x3d')]['id'];}return db['AnalyticTreeReport'][_0x7882('0x3e')]({'where':{'id':_0x3172d4[_0x7882('0x3a')]['id']}})[_0x7882('0x1d')](handleEntityNotFound(_0x530f79,null))[_0x7882('0x1d')](saveUpdates(_0x3172d4['body'],null))['then'](respondWithResult(_0x530f79,null))[_0x7882('0x3f')](handleError(_0x530f79,null));};exports[_0x7882('0x40')]=function(_0x22c922,_0x3b5842){return db[_0x7882('0x22')]['find']({'where':{'id':_0x22c922['params']['id']}})[_0x7882('0x1d')](handleEntityNotFound(_0x3b5842,null))[_0x7882('0x1d')](removeEntity(_0x3b5842,null))[_0x7882('0x3f')](handleError(_0x3b5842,null));}; \ No newline at end of file +var _0x673b=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','then','error','name','index','AnalyticTreeReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','map','type','key','options','include','findAll','catch','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0x5724b2,_0x53cf85){var _0x8ef99f=function(_0x41ac8c){while(--_0x41ac8c){_0x5724b2['push'](_0x5724b2['shift']());}};_0x8ef99f(++_0x53cf85);}(_0x673b,0xb8));var _0xb673=function(_0x3fa479,_0x222259){_0x3fa479=_0x3fa479-0x0;var _0x23feb5=_0x673b[_0x3fa479];return _0x23feb5;};'use strict';var pdf=require(_0xb673('0x0'));var emlformat=require(_0xb673('0x1'));var rimraf=require(_0xb673('0x2'));var zipdir=require(_0xb673('0x3'));var jsonpatch=require(_0xb673('0x4'));var rp=require('request-promise');var moment=require(_0xb673('0x5'));var BPromise=require(_0xb673('0x6'));var Mustache=require(_0xb673('0x7'));var util=require(_0xb673('0x8'));var path=require(_0xb673('0x9'));var sox=require('sox');var csv=require(_0xb673('0xa'));var ejs=require(_0xb673('0xb'));var fs=require('fs');var _=require(_0xb673('0xc'));var squel=require(_0xb673('0xd'));var crypto=require('crypto');var jsforce=require(_0xb673('0xe'));var deskjs=require(_0xb673('0xf'));var toCsv=require(_0xb673('0xa'));var querystring=require(_0xb673('0x10'));var Papa=require(_0xb673('0x11'));var Redis=require(_0xb673('0x12'));var authService=require(_0xb673('0x13'));var qs=require(_0xb673('0x14'));var hardwareService=require(_0xb673('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb673('0x16'))['db'];function respondWithStatusCode(_0x2cb194,_0x3fbc46){_0x3fbc46=_0x3fbc46||0xcc;return function(_0x31ee93){if(_0x31ee93){return _0x2cb194[_0xb673('0x17')](_0x3fbc46);}return _0x2cb194[_0xb673('0x18')](_0x3fbc46)[_0xb673('0x19')]();};}function respondWithResult(_0x1649a1,_0x1e47b2){_0x1e47b2=_0x1e47b2||0xc8;return function(_0x379691){if(_0x379691){return _0x1649a1[_0xb673('0x18')](_0x1e47b2)[_0xb673('0x1a')](_0x379691);}};}function respondWithFilteredResult(_0x588b1e,_0xae03aa){return function(_0x2f5c4d){if(_0x2f5c4d){var _0x405b41=_0x2f5c4d[_0xb673('0x1b')],_0x1d454b=_0xae03aa[_0xb673('0x1c')],_0x2118dd=_0xae03aa[_0xb673('0x1c')]+_0xae03aa[_0xb673('0x1d')],_0x29d086;if(_0x2118dd>=_0x405b41){_0x2118dd=_0x405b41;_0x29d086=0xc8;}else{_0x29d086=0xce;}_0x588b1e[_0xb673('0x18')](_0x29d086);return _0x588b1e[_0xb673('0x1e')]('Content-Range',_0x1d454b+'-'+_0x2118dd+'/'+_0x405b41)[_0xb673('0x1a')](_0x2f5c4d);}return null;};}function patchUpdates(_0x1f4925){return function(_0x394e2a){try{jsonpatch[_0xb673('0x1f')](_0x394e2a,_0x1f4925,!![]);}catch(_0x403403){return BPromise['reject'](_0x403403);}return _0x394e2a[_0xb673('0x20')]();};}function saveUpdates(_0x1e3cec,_0x2a9812){return function(_0x557d1d){if(_0x557d1d){return _0x557d1d[_0xb673('0x21')](_0x1e3cec)['then'](function(_0x126823){return _0x126823;});}return null;};}function removeEntity(_0x30e746,_0x18ec82){return function(_0x287470){if(_0x287470){return _0x287470[_0xb673('0x22')]()[_0xb673('0x23')](function(){_0x30e746[_0xb673('0x18')](0xcc)[_0xb673('0x19')]();});}};}function handleEntityNotFound(_0x316973,_0x117dc3){return function(_0x1c9dda){if(!_0x1c9dda){_0x316973['sendStatus'](0x194);}return _0x1c9dda;};}function handleError(_0xb35c0a,_0x39bca0){_0x39bca0=_0x39bca0||0x1f4;return function(_0x589203){logger[_0xb673('0x24')](_0x589203['stack']);if(_0x589203[_0xb673('0x25')]){delete _0x589203[_0xb673('0x25')];}_0xb35c0a[_0xb673('0x18')](_0x39bca0)['send'](_0x589203);};}exports[_0xb673('0x26')]=function(_0x3264fe,_0x499683){var _0x565b68={},_0xda78d={},_0xd6b273={'count':0x0,'rows':[]};var _0x100a0f=db[_0xb673('0x27')][_0xb673('0x28')];_0xda78d[_0xb673('0x29')]=_[_0xb673('0x2a')](_0x100a0f);_0xda78d[_0xb673('0x2b')]=_[_0xb673('0x2a')](_0x3264fe['query']);_0xda78d[_0xb673('0x2c')]=_['intersection'](_0xda78d['model'],_0xda78d[_0xb673('0x2b')]);_0x565b68[_0xb673('0x2d')]=_[_0xb673('0x2e')](_0xda78d[_0xb673('0x29')],qs[_0xb673('0x2f')](_0x3264fe[_0xb673('0x2b')][_0xb673('0x2f')]));_0x565b68[_0xb673('0x2d')]=_0x565b68[_0xb673('0x2d')][_0xb673('0x30')]?_0x565b68[_0xb673('0x2d')]:_0xda78d[_0xb673('0x29')];if(!_0x3264fe[_0xb673('0x2b')]['hasOwnProperty']('nolimit')){_0x565b68['limit']=qs['limit'](_0x3264fe['query']['limit']);_0x565b68[_0xb673('0x1c')]=qs[_0xb673('0x1c')](_0x3264fe[_0xb673('0x2b')][_0xb673('0x1c')]);}_0x565b68[_0xb673('0x31')]=qs[_0xb673('0x32')](_0x3264fe[_0xb673('0x2b')]['sort']);_0x565b68[_0xb673('0x33')]=qs[_0xb673('0x2c')](_['pick'](_0x3264fe[_0xb673('0x2b')],_0xda78d[_0xb673('0x2c')]));if(_0x3264fe[_0xb673('0x2b')][_0xb673('0x34')]){_0x565b68[_0xb673('0x33')]=_[_0xb673('0x35')](_0x565b68[_0xb673('0x33')],{'$or':_[_0xb673('0x36')](_0x100a0f,function(_0x29ff48){if(_0x29ff48[_0xb673('0x37')][_0xb673('0x38')]!=='VIRTUAL'){var _0x386f83={};_0x386f83[_0x29ff48['field']]={'$like':'%'+_0x3264fe[_0xb673('0x2b')][_0xb673('0x34')]+'%'};return _0x386f83;}})});}_0x565b68=_[_0xb673('0x35')]({},_0x565b68,_0x3264fe[_0xb673('0x39')]);var _0x34d76f={'where':_0x565b68[_0xb673('0x33')]};return db['AnalyticTreeReport'][_0xb673('0x1b')](_0x34d76f)[_0xb673('0x23')](function(_0x436924){_0xd6b273[_0xb673('0x1b')]=_0x436924;if(_0x3264fe[_0xb673('0x2b')]['includeAll']){_0x565b68[_0xb673('0x3a')]=[{'all':!![]}];}return db[_0xb673('0x27')][_0xb673('0x3b')](_0x565b68);})[_0xb673('0x23')](function(_0x49ee75){_0xd6b273['rows']=_0x49ee75;return _0xd6b273;})[_0xb673('0x23')](respondWithFilteredResult(_0x499683,_0x565b68))[_0xb673('0x3c')](handleError(_0x499683,null));};exports['show']=function(_0x5602c6,_0x5cac64){var _0x126e26={'raw':!![],'where':{'id':_0x5602c6[_0xb673('0x3d')]['id']}},_0xa1135d={};_0xa1135d['model']=_['keys'](db[_0xb673('0x27')]['rawAttributes']);_0xa1135d[_0xb673('0x2b')]=_[_0xb673('0x2a')](_0x5602c6[_0xb673('0x2b')]);_0xa1135d['filters']=_[_0xb673('0x2e')](_0xa1135d[_0xb673('0x29')],_0xa1135d['query']);_0x126e26[_0xb673('0x2d')]=_['intersection'](_0xa1135d[_0xb673('0x29')],qs[_0xb673('0x2f')](_0x5602c6[_0xb673('0x2b')][_0xb673('0x2f')]));_0x126e26[_0xb673('0x2d')]=_0x126e26[_0xb673('0x2d')][_0xb673('0x30')]?_0x126e26[_0xb673('0x2d')]:_0xa1135d[_0xb673('0x29')];if(_0x5602c6[_0xb673('0x2b')][_0xb673('0x3e')]){_0x126e26[_0xb673('0x3a')]=[{'all':!![]}];}_0x126e26=_[_0xb673('0x35')]({},_0x126e26,_0x5602c6[_0xb673('0x39')]);return db[_0xb673('0x27')][_0xb673('0x3f')](_0x126e26)['then'](handleEntityNotFound(_0x5cac64,null))['then'](respondWithResult(_0x5cac64,null))[_0xb673('0x3c')](handleError(_0x5cac64,null));};exports[_0xb673('0x40')]=function(_0x18fceb,_0x45f6e){return db[_0xb673('0x27')][_0xb673('0x40')](_0x18fceb[_0xb673('0x41')],{})[_0xb673('0x23')](respondWithResult(_0x45f6e,0xc9))[_0xb673('0x3c')](handleError(_0x45f6e,null));};exports[_0xb673('0x21')]=function(_0x1cfe91,_0x269c86){if(_0x1cfe91['body']['id']){delete _0x1cfe91[_0xb673('0x41')]['id'];}return db[_0xb673('0x27')][_0xb673('0x3f')]({'where':{'id':_0x1cfe91[_0xb673('0x3d')]['id']}})[_0xb673('0x23')](handleEntityNotFound(_0x269c86,null))[_0xb673('0x23')](saveUpdates(_0x1cfe91[_0xb673('0x41')],null))['then'](respondWithResult(_0x269c86,null))[_0xb673('0x3c')](handleError(_0x269c86,null));};exports[_0xb673('0x22')]=function(_0x2cf03b,_0x565140){return db[_0xb673('0x27')][_0xb673('0x3f')]({'where':{'id':_0x2cf03b[_0xb673('0x3d')]['id']}})[_0xb673('0x23')](handleEntityNotFound(_0x565140,null))[_0xb673('0x23')](removeEntity(_0x565140,null))['catch'](handleError(_0x565140,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index d510465..eda58dc 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 _0x2015=['api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2015,0x193));var _0x5201=function(_0x222ae1,_0x29adb6){_0x222ae1=_0x222ae1-0x0;var _0x3263ae=_0x2015[_0x222ae1];return _0x3263ae;};'use strict';var _=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var logger=require(_0x5201('0x2'))(_0x5201('0x3'));var moment=require(_0x5201('0x4'));var BPromise=require(_0x5201('0x5'));var rp=require(_0x5201('0x6'));var fs=require('fs');var path=require(_0x5201('0x7'));var rimraf=require('rimraf');var config=require(_0x5201('0x8'));var attributes=require(_0x5201('0x9'));module[_0x5201('0xa')]=function(_0x10e33b,_0xf013a){return _0x10e33b[_0x5201('0xb')](_0x5201('0xc'),attributes,{'tableName':_0x5201('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da6=['exports','define','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7da6,0x124));var _0x67da=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0x7da6[_0x3cb530];return _0x4168ea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x67da('0x0'))(_0x67da('0x1'));var moment=require(_0x67da('0x2'));var BPromise=require(_0x67da('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67da('0x4'));var rimraf=require(_0x67da('0x5'));var config=require(_0x67da('0x6'));var attributes=require(_0x67da('0x7'));module[_0x67da('0x8')]=function(_0x40d5f8,_0x59af9a){return _0x40d5f8[_0x67da('0x9')]('AnalyticTreeReport',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 2d42e91..f5f931e 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 _0x6e93=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment'];(function(_0x4eac9d,_0x5efb30){var _0x1e6cad=function(_0x4dd0f0){while(--_0x4dd0f0){_0x4eac9d['push'](_0x4eac9d['shift']());}};_0x1e6cad(++_0x5efb30);}(_0x6e93,0x14d));var _0x36e9=function(_0x503185,_0x471bca){_0x503185=_0x503185-0x0;var _0x3675da=_0x6e93[_0x503185];return _0x3675da;};'use strict';var _=require(_0x36e9('0x0'));var util=require(_0x36e9('0x1'));var moment=require(_0x36e9('0x2'));var BPromise=require(_0x36e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x36e9('0x5'));var logger=require(_0x36e9('0x6'))(_0x36e9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x36e9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x332889,_0x201cd2,_0x3ea4de){return new BPromise(function(_0x445ef2,_0x56e5f9){return client[_0x36e9('0x9')](_0x332889,_0x3ea4de)[_0x36e9('0xa')](function(_0x3004c5){logger[_0x36e9('0xb')](_0x36e9('0xc'),_0x201cd2,_0x36e9('0xd'));logger[_0x36e9('0xe')](_0x36e9('0xf'),_0x201cd2,_0x36e9('0xd'),JSON[_0x36e9('0x10')](_0x3004c5));if(_0x3004c5['error']){if(_0x3004c5['error'][_0x36e9('0x11')]===0x1f4){logger['error'](_0x36e9('0xc'),_0x201cd2,_0x3004c5[_0x36e9('0x12')][_0x36e9('0x13')]);return _0x56e5f9(_0x3004c5['error'][_0x36e9('0x13')]);}logger[_0x36e9('0x12')](_0x36e9('0xc'),_0x201cd2,_0x3004c5['error'][_0x36e9('0x13')]);return _0x445ef2(_0x3004c5['error']['message']);}else{logger[_0x36e9('0xb')](_0x36e9('0xc'),_0x201cd2,'request\x20sent');_0x445ef2(_0x3004c5[_0x36e9('0x14')][_0x36e9('0x13')]);}})['catch'](function(_0x3598b9){logger[_0x36e9('0x12')](_0x36e9('0xc'),_0x201cd2,_0x3598b9);_0x56e5f9(_0x3598b9);});});} \ No newline at end of file +var _0x7aeb=['AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4346ee,_0x547f15){var _0x5a9f24=function(_0x3bf9e9){while(--_0x3bf9e9){_0x4346ee['push'](_0x4346ee['shift']());}};_0x5a9f24(++_0x547f15);}(_0x7aeb,0x17f));var _0xb7ae=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x7aeb[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xb7ae('0x0'));var util=require(_0xb7ae('0x1'));var moment=require(_0xb7ae('0x2'));var BPromise=require(_0xb7ae('0x3'));var rs=require(_0xb7ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7ae('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb7ae('0x6'));var config=require(_0xb7ae('0x7'));var jayson=require(_0xb7ae('0x8'));var client=jayson['client'][_0xb7ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3eb726,_0x34175d,_0x5d0d3f){return new BPromise(function(_0xbe5032,_0x4b188d){return client[_0xb7ae('0xa')](_0x3eb726,_0x5d0d3f)[_0xb7ae('0xb')](function(_0x192df2){logger[_0xb7ae('0xc')](_0xb7ae('0xd'),_0x34175d,_0xb7ae('0xe'));logger[_0xb7ae('0xf')](_0xb7ae('0x10'),_0x34175d,_0xb7ae('0xe'),JSON[_0xb7ae('0x11')](_0x192df2));if(_0x192df2['error']){if(_0x192df2[_0xb7ae('0x12')]['code']===0x1f4){logger[_0xb7ae('0x12')](_0xb7ae('0xd'),_0x34175d,_0x192df2[_0xb7ae('0x12')]['message']);return _0x4b188d(_0x192df2['error']['message']);}logger[_0xb7ae('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x34175d,_0x192df2[_0xb7ae('0x12')][_0xb7ae('0x13')]);return _0xbe5032(_0x192df2[_0xb7ae('0x12')][_0xb7ae('0x13')]);}else{logger[_0xb7ae('0xc')](_0xb7ae('0xd'),_0x34175d,_0xb7ae('0xe'));_0xbe5032(_0x192df2[_0xb7ae('0x14')][_0xb7ae('0x13')]);}})['catch'](function(_0x35d937){logger[_0xb7ae('0x12')](_0xb7ae('0xd'),_0x34175d,_0x35d937);_0x4b188d(_0x35d937);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 6e59569..63324d3 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 _0x7825=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x13b0f4,_0x1f6826){var _0x3f2eb5=function(_0x35d6bb){while(--_0x35d6bb){_0x13b0f4['push'](_0x13b0f4['shift']());}};_0x3f2eb5(++_0x1f6826);}(_0x7825,0x140));var _0x5782=function(_0x1930b7,_0x13f7d5){_0x1930b7=_0x1930b7-0x0;var _0x118097=_0x7825[_0x1930b7];return _0x118097;};'use strict';var multer=require(_0x5782('0x0'));var util=require(_0x5782('0x1'));var path=require(_0x5782('0x2'));var timeout=require(_0x5782('0x3'));var express=require(_0x5782('0x4'));var router=express[_0x5782('0x5')]();var auth=require(_0x5782('0x6'));var interaction=require(_0x5782('0x7'));var config=require('../../config/environment');var controller=require(_0x5782('0x8'));router[_0x5782('0x9')]('/',auth[_0x5782('0xa')](),controller[_0x5782('0xb')]);router[_0x5782('0x9')](_0x5782('0xc'),auth[_0x5782('0xa')](),controller['show']);router[_0x5782('0xd')]('/',auth['isAuthenticated'](),controller[_0x5782('0xe')]);router[_0x5782('0xf')](_0x5782('0xc'),auth[_0x5782('0xa')](),controller[_0x5782('0x10')]);router[_0x5782('0x11')](_0x5782('0xc'),auth[_0x5782('0xa')](),controller[_0x5782('0x12')]);module[_0x5782('0x13')]=router; \ No newline at end of file +var _0x7fd1=['../../config/environment','get','isAuthenticated','index','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x2d505b,_0x399a91){var _0x198da6=function(_0x3c76f2){while(--_0x3c76f2){_0x2d505b['push'](_0x2d505b['shift']());}};_0x198da6(++_0x399a91);}(_0x7fd1,0x1da));var _0x17fd=function(_0x4b769c,_0x2769eb){_0x4b769c=_0x4b769c-0x0;var _0x55c986=_0x7fd1[_0x4b769c];return _0x55c986;};'use strict';var multer=require(_0x17fd('0x0'));var util=require(_0x17fd('0x1'));var path=require('path');var timeout=require(_0x17fd('0x2'));var express=require(_0x17fd('0x3'));var router=express[_0x17fd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x17fd('0x5'));var config=require(_0x17fd('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x17fd('0x7')]('/',auth[_0x17fd('0x8')](),controller[_0x17fd('0x9')]);router[_0x17fd('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x17fd('0xa')]);router[_0x17fd('0xb')]('/',auth[_0x17fd('0x8')](),controller['create']);router[_0x17fd('0xc')]('/:id',auth[_0x17fd('0x8')](),controller['update']);router[_0x17fd('0xd')]('/:id',auth[_0x17fd('0x8')](),controller[_0x17fd('0xe')]);module[_0x17fd('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a3389f8..022b0b8 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 _0xfbdb=['sequelize'];(function(_0x103359,_0x1d886e){var _0x6f700a=function(_0x495f8e){while(--_0x495f8e){_0x103359['push'](_0x103359['shift']());}};_0x6f700a(++_0x1d886e);}(_0xfbdb,0x11c));var _0xbfbd=function(_0x585bf6,_0x440e6d){_0x585bf6=_0x585bf6-0x0;var _0x6466e2=_0xfbdb[_0x585bf6];return _0x6466e2;};'use strict';var Sequelize=require(_0xbfbd('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2ee1=['STRING'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0x2ee1,0x9d));var _0x12ee=function(_0x12c70b,_0x57b968){_0x12c70b=_0x12c70b-0x0;var _0x217046=_0x2ee1[_0x12c70b];return _0x217046;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x12ee('0x0')]},'basename':{'type':Sequelize[_0x12ee('0x0')]},'type':{'type':Sequelize[_0x12ee('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e4ae325..4687530 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 _0x4137=['filename','mimetype','download','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','index','Attachment','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','map','type','key','VIRTUAL','field','filter','merge','options','count','includeAll','catch','params','keys','include','find','body','name','file','originalname','basename'];(function(_0x519be8,_0x2e5349){var _0x41f1e5=function(_0x16864a){while(--_0x16864a){_0x519be8['push'](_0x519be8['shift']());}};_0x41f1e5(++_0x2e5349);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x7413('0x0'));var emlformat=require(_0x7413('0x1'));var rimraf=require(_0x7413('0x2'));var zipdir=require(_0x7413('0x3'));var jsonpatch=require(_0x7413('0x4'));var rp=require(_0x7413('0x5'));var moment=require(_0x7413('0x6'));var BPromise=require(_0x7413('0x7'));var Mustache=require(_0x7413('0x8'));var util=require(_0x7413('0x9'));var path=require(_0x7413('0xa'));var sox=require(_0x7413('0xb'));var csv=require('to-csv');var ejs=require(_0x7413('0xc'));var fs=require('fs');var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0x11'));var querystring=require('querystring');var Papa=require(_0x7413('0x12'));var Redis=require(_0x7413('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require(_0x7413('0x18'));var config=require('../../config/environment');var db=require(_0x7413('0x19'))['db'];function respondWithStatusCode(_0x32034c,_0x4bf07d){_0x4bf07d=_0x4bf07d||0xcc;return function(_0x18a874){if(_0x18a874){return _0x32034c[_0x7413('0x1a')](_0x4bf07d);}return _0x32034c[_0x7413('0x1b')](_0x4bf07d)['end']();};}function respondWithResult(_0x5956b0,_0x55ef69){_0x55ef69=_0x55ef69||0xc8;return function(_0x2267f6){if(_0x2267f6){return _0x5956b0[_0x7413('0x1b')](_0x55ef69)['json'](_0x2267f6);}};}function respondWithFilteredResult(_0x1a42aa,_0x45bef0){return function(_0x4955d3){if(_0x4955d3){var _0x38b3d1=_0x4955d3['count'],_0x50f301=_0x45bef0[_0x7413('0x1c')],_0x4b9a5b=_0x45bef0['offset']+_0x45bef0[_0x7413('0x1d')],_0x26501b;if(_0x4b9a5b>=_0x38b3d1){_0x4b9a5b=_0x38b3d1;_0x26501b=0xc8;}else{_0x26501b=0xce;}_0x1a42aa[_0x7413('0x1b')](_0x26501b);return _0x1a42aa[_0x7413('0x1e')](_0x7413('0x1f'),_0x50f301+'-'+_0x4b9a5b+'/'+_0x38b3d1)[_0x7413('0x20')](_0x4955d3);}return null;};}function patchUpdates(_0x26dafe){return function(_0x51194e){try{jsonpatch[_0x7413('0x21')](_0x51194e,_0x26dafe,!![]);}catch(_0x17c062){return BPromise[_0x7413('0x22')](_0x17c062);}return _0x51194e[_0x7413('0x23')]();};}function saveUpdates(_0x5bee15,_0x239d0e){return function(_0x12d94d){if(_0x12d94d){return _0x12d94d[_0x7413('0x24')](_0x5bee15)[_0x7413('0x25')](function(_0x409392){return _0x409392;});}return null;};}function removeEntity(_0x2d220f,_0x4886e3){return function(_0x4e18cb){if(_0x4e18cb){return _0x4e18cb['destroy']()['then'](function(){_0x2d220f[_0x7413('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1585ba,_0x372944){return function(_0x3b0c81){if(!_0x3b0c81){_0x1585ba[_0x7413('0x1a')](0x194);}return _0x3b0c81;};}function handleError(_0x1d46e9,_0x346ce8){_0x346ce8=_0x346ce8||0x1f4;return function(_0x1d97fd){logger[_0x7413('0x26')](_0x1d97fd[_0x7413('0x27')]);if(_0x1d97fd['name']){delete _0x1d97fd['name'];}_0x1d46e9[_0x7413('0x1b')](_0x346ce8)['send'](_0x1d97fd);};}exports[_0x7413('0x28')]=function(_0x71cbb4,_0x463b21){var _0x4c2e90={},_0x35e0fd={},_0x896552={'count':0x0,'rows':[]};var _0x79cab6=db[_0x7413('0x29')][_0x7413('0x2a')];_0x35e0fd[_0x7413('0x2b')]=_['keys'](_0x79cab6);_0x35e0fd[_0x7413('0x2c')]=_['keys'](_0x71cbb4[_0x7413('0x2c')]);_0x35e0fd[_0x7413('0x2d')]=_[_0x7413('0x2e')](_0x35e0fd[_0x7413('0x2b')],_0x35e0fd[_0x7413('0x2c')]);_0x4c2e90[_0x7413('0x2f')]=_['intersection'](_0x35e0fd[_0x7413('0x2b')],qs[_0x7413('0x30')](_0x71cbb4[_0x7413('0x2c')][_0x7413('0x30')]));_0x4c2e90[_0x7413('0x2f')]=_0x4c2e90[_0x7413('0x2f')][_0x7413('0x31')]?_0x4c2e90['attributes']:_0x35e0fd[_0x7413('0x2b')];if(!_0x71cbb4[_0x7413('0x2c')][_0x7413('0x32')](_0x7413('0x33'))){_0x4c2e90[_0x7413('0x1d')]=qs['limit'](_0x71cbb4[_0x7413('0x2c')]['limit']);_0x4c2e90[_0x7413('0x1c')]=qs[_0x7413('0x1c')](_0x71cbb4[_0x7413('0x2c')]['offset']);}_0x4c2e90[_0x7413('0x34')]=qs['sort'](_0x71cbb4[_0x7413('0x2c')][_0x7413('0x35')]);_0x4c2e90['where']=qs['filters'](_[_0x7413('0x36')](_0x71cbb4[_0x7413('0x2c')],_0x35e0fd[_0x7413('0x2d')]));if(_0x71cbb4['query']['filter']){_0x4c2e90[_0x7413('0x37')]=_['merge'](_0x4c2e90['where'],{'$or':_[_0x7413('0x38')](_0x79cab6,function(_0x575a79){if(_0x575a79[_0x7413('0x39')][_0x7413('0x3a')]!==_0x7413('0x3b')){var _0x2b178c={};_0x2b178c[_0x575a79[_0x7413('0x3c')]]={'$like':'%'+_0x71cbb4['query'][_0x7413('0x3d')]+'%'};return _0x2b178c;}})});}_0x4c2e90=_[_0x7413('0x3e')]({},_0x4c2e90,_0x71cbb4[_0x7413('0x3f')]);var _0xfa34ef={'where':_0x4c2e90[_0x7413('0x37')]};return db[_0x7413('0x29')][_0x7413('0x40')](_0xfa34ef)[_0x7413('0x25')](function(_0x5993d){_0x896552[_0x7413('0x40')]=_0x5993d;if(_0x71cbb4[_0x7413('0x2c')][_0x7413('0x41')]){_0x4c2e90['include']=[{'all':!![]}];}return db[_0x7413('0x29')]['findAll'](_0x4c2e90);})['then'](function(_0x5b592c){_0x896552['rows']=_0x5b592c;return _0x896552;})['then'](respondWithFilteredResult(_0x463b21,_0x4c2e90))[_0x7413('0x42')](handleError(_0x463b21,null));};exports['show']=function(_0x535e49,_0x5dc077){var _0x4d0008={'raw':!![],'where':{'id':_0x535e49[_0x7413('0x43')]['id']}},_0x4c6746={};_0x4c6746[_0x7413('0x2b')]=_[_0x7413('0x44')](db[_0x7413('0x29')][_0x7413('0x2a')]);_0x4c6746['query']=_[_0x7413('0x44')](_0x535e49['query']);_0x4c6746[_0x7413('0x2d')]=_[_0x7413('0x2e')](_0x4c6746[_0x7413('0x2b')],_0x4c6746[_0x7413('0x2c')]);_0x4d0008[_0x7413('0x2f')]=_[_0x7413('0x2e')](_0x4c6746[_0x7413('0x2b')],qs[_0x7413('0x30')](_0x535e49[_0x7413('0x2c')][_0x7413('0x30')]));_0x4d0008[_0x7413('0x2f')]=_0x4d0008[_0x7413('0x2f')][_0x7413('0x31')]?_0x4d0008['attributes']:_0x4c6746[_0x7413('0x2b')];if(_0x535e49[_0x7413('0x2c')][_0x7413('0x41')]){_0x4d0008[_0x7413('0x45')]=[{'all':!![]}];}_0x4d0008=_[_0x7413('0x3e')]({},_0x4d0008,_0x535e49[_0x7413('0x3f')]);return db[_0x7413('0x29')][_0x7413('0x46')](_0x4d0008)[_0x7413('0x25')](handleEntityNotFound(_0x5dc077,null))[_0x7413('0x25')](respondWithResult(_0x5dc077,null))[_0x7413('0x42')](handleError(_0x5dc077,null));};exports['update']=function(_0x2c5d1b,_0x52a088){if(_0x2c5d1b[_0x7413('0x47')]['id']){delete _0x2c5d1b[_0x7413('0x47')]['id'];}return db[_0x7413('0x29')][_0x7413('0x46')]({'where':{'id':_0x2c5d1b[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x52a088,null))[_0x7413('0x25')](saveUpdates(_0x2c5d1b[_0x7413('0x47')],null))[_0x7413('0x25')](respondWithResult(_0x52a088,null))[_0x7413('0x42')](handleError(_0x52a088,null));};exports['destroy']=function(_0x513657,_0x3c1f1a){return db['Attachment']['find']({'where':{'id':_0x513657[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x3c1f1a,null))['then'](removeEntity(_0x3c1f1a,null))[_0x7413('0x42')](handleError(_0x3c1f1a,null));};exports['create']=function(_0x562bae,_0xe58860,_0x5f263e){_0x562bae[_0x7413('0x47')][_0x7413('0x48')]=_0x562bae[_0x7413('0x49')][_0x7413('0x4a')];_0x562bae[_0x7413('0x47')][_0x7413('0x4b')]=_0x562bae[_0x7413('0x49')][_0x7413('0x4c')];_0x562bae[_0x7413('0x47')][_0x7413('0x39')]=_0x562bae['file'][_0x7413('0x4d')];return db['Attachment']['create'](_0x562bae['body'])[_0x7413('0x25')](respondWithResult(_0xe58860,0xc9))[_0x7413('0x42')](handleError(_0xe58860,null));};exports[_0x7413('0x4e')]=function(_0x1ba4e9,_0x4bc337,_0x5a6a66){return db[_0x7413('0x29')]['findOne']({'where':{'id':_0x1ba4e9[_0x7413('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4bc337,null))['then'](function(_0x4b6e16){if(_0x4b6e16){return _0x4bc337['download'](path['join'](config[_0x7413('0x4f')],_0x7413('0x50'),_0x4b6e16[_0x7413('0x4b')]));}})[_0x7413('0x42')](handleError(_0x4bc337,null));}; \ No newline at end of file +var _0xdb28=['options','include','findAll','rows','catch','show','find','body','params','create','file','originalname','basename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Attachment','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','map','type','key','filter'];(function(_0x35f154,_0x50c6e2){var _0x3302b6=function(_0x23f58b){while(--_0x23f58b){_0x35f154['push'](_0x35f154['shift']());}};_0x3302b6(++_0x50c6e2);}(_0xdb28,0x106));var _0x8db2=function(_0x1144fe,_0x84e14c){_0x1144fe=_0x1144fe-0x0;var _0x423baf=_0xdb28[_0x1144fe];return _0x423baf;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var hardwareService=require(_0x8db2('0x13'));var logger=require('../../config/logger')(_0x8db2('0x14'));var utils=require(_0x8db2('0x15'));var config=require('../../config/environment');var db=require(_0x8db2('0x16'))['db'];function respondWithStatusCode(_0x3b2faa,_0x1349f6){_0x1349f6=_0x1349f6||0xcc;return function(_0x204f49){if(_0x204f49){return _0x3b2faa[_0x8db2('0x17')](_0x1349f6);}return _0x3b2faa['status'](_0x1349f6)['end']();};}function respondWithResult(_0x15070d,_0x15e87c){_0x15e87c=_0x15e87c||0xc8;return function(_0x350d61){if(_0x350d61){return _0x15070d[_0x8db2('0x18')](_0x15e87c)[_0x8db2('0x19')](_0x350d61);}};}function respondWithFilteredResult(_0xfa285b,_0x2f177a){return function(_0x3c96a7){if(_0x3c96a7){var _0x131252=_0x3c96a7[_0x8db2('0x1a')],_0x16c8c2=_0x2f177a['offset'],_0x5489a9=_0x2f177a[_0x8db2('0x1b')]+_0x2f177a[_0x8db2('0x1c')],_0x13b0f5;if(_0x5489a9>=_0x131252){_0x5489a9=_0x131252;_0x13b0f5=0xc8;}else{_0x13b0f5=0xce;}_0xfa285b[_0x8db2('0x18')](_0x13b0f5);return _0xfa285b[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x16c8c2+'-'+_0x5489a9+'/'+_0x131252)[_0x8db2('0x19')](_0x3c96a7);}return null;};}function patchUpdates(_0x51d60d){return function(_0x5df464){try{jsonpatch[_0x8db2('0x1f')](_0x5df464,_0x51d60d,!![]);}catch(_0x104e33){return BPromise[_0x8db2('0x20')](_0x104e33);}return _0x5df464[_0x8db2('0x21')]();};}function saveUpdates(_0x58562e,_0x431d60){return function(_0x36a9ff){if(_0x36a9ff){return _0x36a9ff[_0x8db2('0x22')](_0x58562e)[_0x8db2('0x23')](function(_0x3dbe8e){return _0x3dbe8e;});}return null;};}function removeEntity(_0x597260,_0x124467){return function(_0x3e30e6){if(_0x3e30e6){return _0x3e30e6[_0x8db2('0x24')]()[_0x8db2('0x23')](function(){_0x597260[_0x8db2('0x18')](0xcc)[_0x8db2('0x25')]();});}};}function handleEntityNotFound(_0x796ec1,_0x5c6614){return function(_0x256202){if(!_0x256202){_0x796ec1['sendStatus'](0x194);}return _0x256202;};}function handleError(_0x5725f0,_0x52a9ca){_0x52a9ca=_0x52a9ca||0x1f4;return function(_0x4d923c){logger[_0x8db2('0x26')](_0x4d923c[_0x8db2('0x27')]);if(_0x4d923c[_0x8db2('0x28')]){delete _0x4d923c[_0x8db2('0x28')];}_0x5725f0[_0x8db2('0x18')](_0x52a9ca)[_0x8db2('0x29')](_0x4d923c);};}exports['index']=function(_0x3544ba,_0x372311){var _0x430dd5={},_0x8b7cec={},_0x483aee={'count':0x0,'rows':[]};var _0x2e0691=db[_0x8db2('0x2a')][_0x8db2('0x2b')];_0x8b7cec[_0x8db2('0x2c')]=_[_0x8db2('0x2d')](_0x2e0691);_0x8b7cec[_0x8db2('0x2e')]=_[_0x8db2('0x2d')](_0x3544ba[_0x8db2('0x2e')]);_0x8b7cec[_0x8db2('0x2f')]=_['intersection'](_0x8b7cec[_0x8db2('0x2c')],_0x8b7cec['query']);_0x430dd5['attributes']=_[_0x8db2('0x30')](_0x8b7cec[_0x8db2('0x2c')],qs[_0x8db2('0x31')](_0x3544ba['query'][_0x8db2('0x31')]));_0x430dd5['attributes']=_0x430dd5[_0x8db2('0x32')][_0x8db2('0x33')]?_0x430dd5[_0x8db2('0x32')]:_0x8b7cec['model'];if(!_0x3544ba['query'][_0x8db2('0x34')](_0x8db2('0x35'))){_0x430dd5['limit']=qs['limit'](_0x3544ba[_0x8db2('0x2e')][_0x8db2('0x1c')]);_0x430dd5[_0x8db2('0x1b')]=qs[_0x8db2('0x1b')](_0x3544ba[_0x8db2('0x2e')][_0x8db2('0x1b')]);}_0x430dd5[_0x8db2('0x36')]=qs[_0x8db2('0x37')](_0x3544ba[_0x8db2('0x2e')][_0x8db2('0x37')]);_0x430dd5['where']=qs[_0x8db2('0x2f')](_[_0x8db2('0x38')](_0x3544ba['query'],_0x8b7cec[_0x8db2('0x2f')]));if(_0x3544ba[_0x8db2('0x2e')]['filter']){_0x430dd5['where']=_[_0x8db2('0x39')](_0x430dd5['where'],{'$or':_[_0x8db2('0x3a')](_0x2e0691,function(_0x264696){if(_0x264696[_0x8db2('0x3b')][_0x8db2('0x3c')]!=='VIRTUAL'){var _0x2d3e98={};_0x2d3e98[_0x264696['field']]={'$like':'%'+_0x3544ba[_0x8db2('0x2e')][_0x8db2('0x3d')]+'%'};return _0x2d3e98;}})});}_0x430dd5=_[_0x8db2('0x39')]({},_0x430dd5,_0x3544ba[_0x8db2('0x3e')]);var _0x50e88a={'where':_0x430dd5['where']};return db[_0x8db2('0x2a')][_0x8db2('0x1a')](_0x50e88a)['then'](function(_0x2bac57){_0x483aee[_0x8db2('0x1a')]=_0x2bac57;if(_0x3544ba[_0x8db2('0x2e')]['includeAll']){_0x430dd5[_0x8db2('0x3f')]=[{'all':!![]}];}return db[_0x8db2('0x2a')][_0x8db2('0x40')](_0x430dd5);})[_0x8db2('0x23')](function(_0x2e6f0c){_0x483aee[_0x8db2('0x41')]=_0x2e6f0c;return _0x483aee;})[_0x8db2('0x23')](respondWithFilteredResult(_0x372311,_0x430dd5))[_0x8db2('0x42')](handleError(_0x372311,null));};exports[_0x8db2('0x43')]=function(_0x63c561,_0x21cf7c){var _0x20bf0b={'raw':!![],'where':{'id':_0x63c561['params']['id']}},_0x1d9025={};_0x1d9025[_0x8db2('0x2c')]=_[_0x8db2('0x2d')](db['Attachment']['rawAttributes']);_0x1d9025[_0x8db2('0x2e')]=_['keys'](_0x63c561[_0x8db2('0x2e')]);_0x1d9025[_0x8db2('0x2f')]=_[_0x8db2('0x30')](_0x1d9025[_0x8db2('0x2c')],_0x1d9025[_0x8db2('0x2e')]);_0x20bf0b[_0x8db2('0x32')]=_[_0x8db2('0x30')](_0x1d9025['model'],qs[_0x8db2('0x31')](_0x63c561[_0x8db2('0x2e')][_0x8db2('0x31')]));_0x20bf0b[_0x8db2('0x32')]=_0x20bf0b['attributes'][_0x8db2('0x33')]?_0x20bf0b[_0x8db2('0x32')]:_0x1d9025[_0x8db2('0x2c')];if(_0x63c561[_0x8db2('0x2e')]['includeAll']){_0x20bf0b[_0x8db2('0x3f')]=[{'all':!![]}];}_0x20bf0b=_['merge']({},_0x20bf0b,_0x63c561[_0x8db2('0x3e')]);return db[_0x8db2('0x2a')][_0x8db2('0x44')](_0x20bf0b)['then'](handleEntityNotFound(_0x21cf7c,null))['then'](respondWithResult(_0x21cf7c,null))[_0x8db2('0x42')](handleError(_0x21cf7c,null));};exports['update']=function(_0x173cc7,_0x467866){if(_0x173cc7[_0x8db2('0x45')]['id']){delete _0x173cc7[_0x8db2('0x45')]['id'];}return db[_0x8db2('0x2a')][_0x8db2('0x44')]({'where':{'id':_0x173cc7[_0x8db2('0x46')]['id']}})[_0x8db2('0x23')](handleEntityNotFound(_0x467866,null))[_0x8db2('0x23')](saveUpdates(_0x173cc7[_0x8db2('0x45')],null))[_0x8db2('0x23')](respondWithResult(_0x467866,null))[_0x8db2('0x42')](handleError(_0x467866,null));};exports['destroy']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2a')][_0x8db2('0x44')]({'where':{'id':_0x449109['params']['id']}})['then'](handleEntityNotFound(_0x2ada52,null))[_0x8db2('0x23')](removeEntity(_0x2ada52,null))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x47')]=function(_0x4c66e5,_0x540d90,_0x494d6e){_0x4c66e5[_0x8db2('0x45')][_0x8db2('0x28')]=_0x4c66e5[_0x8db2('0x48')][_0x8db2('0x49')];_0x4c66e5[_0x8db2('0x45')][_0x8db2('0x4a')]=_0x4c66e5[_0x8db2('0x48')]['filename'];_0x4c66e5['body'][_0x8db2('0x3b')]=_0x4c66e5[_0x8db2('0x48')][_0x8db2('0x4b')];return db[_0x8db2('0x2a')][_0x8db2('0x47')](_0x4c66e5[_0x8db2('0x45')])[_0x8db2('0x23')](respondWithResult(_0x540d90,0xc9))[_0x8db2('0x42')](handleError(_0x540d90,null));};exports[_0x8db2('0x4c')]=function(_0x426ae0,_0x3bc632,_0x319273){return db[_0x8db2('0x2a')][_0x8db2('0x4d')]({'where':{'id':_0x426ae0[_0x8db2('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3bc632,null))[_0x8db2('0x23')](function(_0xb4b0a){if(_0xb4b0a){return _0x3bc632['download'](path[_0x8db2('0x4e')](config[_0x8db2('0x4f')],_0x8db2('0x50'),_0xb4b0a['basename']));}})[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index efd00b7..cf72be5 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 _0xdca3=['../../config/environment','./attachment.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0xdca3,0x64));var _0x3dca=function(_0x5ba5d4,_0x1b1ff5){_0x5ba5d4=_0x5ba5d4-0x0;var _0x5d2e91=_0xdca3[_0x5ba5d4];return _0x5d2e91;};'use strict';var _=require(_0x3dca('0x0'));var util=require('util');var logger=require(_0x3dca('0x1'))(_0x3dca('0x2'));var moment=require(_0x3dca('0x3'));var BPromise=require(_0x3dca('0x4'));var rp=require(_0x3dca('0x5'));var fs=require('fs');var path=require(_0x3dca('0x6'));var rimraf=require(_0x3dca('0x7'));var config=require(_0x3dca('0x8'));var attributes=require(_0x3dca('0x9'));module[_0x3dca('0xa')]=function(_0x3e2811,_0x5cfa9a){return _0x3e2811[_0x3dca('0xb')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30c7=['attachments','lodash','../../config/logger','api','moment','request-promise','path','Attachment'];(function(_0x5bb706,_0x2df2b8){var _0x55a50f=function(_0x329893){while(--_0x329893){_0x5bb706['push'](_0x5bb706['shift']());}};_0x55a50f(++_0x2df2b8);}(_0x30c7,0x111));var _0x730c=function(_0x495c21,_0x58a753){_0x495c21=_0x495c21-0x0;var _0x5dd503=_0x30c7[_0x495c21];return _0x5dd503;};'use strict';var _=require(_0x730c('0x0'));var util=require('util');var logger=require(_0x730c('0x1'))(_0x730c('0x2'));var moment=require(_0x730c('0x3'));var BPromise=require('bluebird');var rp=require(_0x730c('0x4'));var fs=require('fs');var path=require(_0x730c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module['exports']=function(_0x3516be,_0x229682){return _0x3516be['define'](_0x730c('0x6'),attributes,{'tableName':_0x730c('0x7'),'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 e19b3b6..41da503 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 _0xc4a5=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','error','code','Attachment,\x20%s,\x20%s','message','info','result','catch','Attachment','create','body','options','raw','CreateAttachment','stringify','lodash'];(function(_0x2a6193,_0x2ec097){var _0x317a31=function(_0x478fa1){while(--_0x478fa1){_0x2a6193['push'](_0x2a6193['shift']());}};_0x317a31(++_0x2ec097);}(_0xc4a5,0x1a3));var _0x5c4a=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xc4a5[_0x2d994d];return _0xd54be4;};'use strict';var _=require(_0x5c4a('0x0'));var util=require(_0x5c4a('0x1'));var moment=require(_0x5c4a('0x2'));var BPromise=require(_0x5c4a('0x3'));var rs=require(_0x5c4a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c4a('0x5'))['db'];var utils=require(_0x5c4a('0x6'));var logger=require(_0x5c4a('0x7'))(_0x5c4a('0x8'));var config=require(_0x5c4a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5c4a('0xa')][_0x5c4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e3713,_0x9e7fc1,_0x294880){return new BPromise(function(_0x44dfd1,_0x2db67b){return client[_0x5c4a('0xc')](_0x1e3713,_0x294880)[_0x5c4a('0xd')](function(_0x4770bc){logger['info']('Attachment,\x20%s,\x20%s',_0x9e7fc1,_0x5c4a('0xe'));logger[_0x5c4a('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x9e7fc1,_0x5c4a('0xe'),JSON['stringify'](_0x4770bc));if(_0x4770bc[_0x5c4a('0x10')]){if(_0x4770bc[_0x5c4a('0x10')][_0x5c4a('0x11')]===0x1f4){logger['error'](_0x5c4a('0x12'),_0x9e7fc1,_0x4770bc['error'][_0x5c4a('0x13')]);return _0x2db67b(_0x4770bc[_0x5c4a('0x10')][_0x5c4a('0x13')]);}logger[_0x5c4a('0x10')](_0x5c4a('0x12'),_0x9e7fc1,_0x4770bc[_0x5c4a('0x10')]['message']);return _0x44dfd1(_0x4770bc['error']['message']);}else{logger[_0x5c4a('0x14')](_0x5c4a('0x12'),_0x9e7fc1,'request\x20sent');_0x44dfd1(_0x4770bc[_0x5c4a('0x15')][_0x5c4a('0x13')]);}})[_0x5c4a('0x16')](function(_0x36886e){logger[_0x5c4a('0x10')](_0x5c4a('0x12'),_0x9e7fc1,_0x36886e);_0x2db67b(_0x36886e);});});}exports['CreateAttachment']=function(_0x43fc3b){var _0x3a6741=this;return new Promise(function(_0x4a2747,_0x206add){return db[_0x5c4a('0x17')][_0x5c4a('0x18')](_0x43fc3b[_0x5c4a('0x19')],{'raw':_0x43fc3b[_0x5c4a('0x1a')]?_0x43fc3b['options'][_0x5c4a('0x1b')]===undefined?!![]:![]:!![]})[_0x5c4a('0xd')](function(_0x121a37){logger[_0x5c4a('0x14')](_0x5c4a('0x1c'),_0x43fc3b);logger[_0x5c4a('0xf')](_0x5c4a('0x1c'),_0x43fc3b,JSON[_0x5c4a('0x1d')](_0x121a37));_0x4a2747(_0x121a37);})[_0x5c4a('0x16')](function(_0x4e078f){logger[_0x5c4a('0x10')](_0x5c4a('0x1c'),_0x4e078f[_0x5c4a('0x13')],_0x43fc3b);_0x206add(_0x3a6741[_0x5c4a('0x10')](0x1f4,_0x4e078f[_0x5c4a('0x13')]));});});}; \ No newline at end of file +var _0x1d2d=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','Attachment','create','body','options','raw','debug','moment','bluebird','../../mysqldb'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0x1d2d,0x1ad));var _0xd1d2=function(_0x47fb96,_0x35a2c1){_0x47fb96=_0x47fb96-0x0;var _0xd59198=_0x1d2d[_0x47fb96];return _0xd59198;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd1d2('0x0'));var BPromise=require(_0xd1d2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1d2('0x3'))(_0xd1d2('0x4'));var config=require(_0xd1d2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd1d2('0x6')][_0xd1d2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14cb2f,_0x392ae8,_0x1e41ab){return new BPromise(function(_0x4157fa,_0x2214f8){return client[_0xd1d2('0x8')](_0x14cb2f,_0x1e41ab)[_0xd1d2('0x9')](function(_0x398b5c){logger[_0xd1d2('0xa')]('Attachment,\x20%s,\x20%s',_0x392ae8,_0xd1d2('0xb'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x392ae8,_0xd1d2('0xb'),JSON['stringify'](_0x398b5c));if(_0x398b5c['error']){if(_0x398b5c[_0xd1d2('0xc')][_0xd1d2('0xd')]===0x1f4){logger[_0xd1d2('0xc')](_0xd1d2('0xe'),_0x392ae8,_0x398b5c['error'][_0xd1d2('0xf')]);return _0x2214f8(_0x398b5c[_0xd1d2('0xc')][_0xd1d2('0xf')]);}logger[_0xd1d2('0xc')]('Attachment,\x20%s,\x20%s',_0x392ae8,_0x398b5c[_0xd1d2('0xc')][_0xd1d2('0xf')]);return _0x4157fa(_0x398b5c['error'][_0xd1d2('0xf')]);}else{logger[_0xd1d2('0xa')](_0xd1d2('0xe'),_0x392ae8,_0xd1d2('0xb'));_0x4157fa(_0x398b5c['result'][_0xd1d2('0xf')]);}})[_0xd1d2('0x10')](function(_0x5195c8){logger[_0xd1d2('0xc')](_0xd1d2('0xe'),_0x392ae8,_0x5195c8);_0x2214f8(_0x5195c8);});});}exports[_0xd1d2('0x11')]=function(_0x1907e4){var _0x2f007a=this;return new Promise(function(_0x289919,_0x2ee0e9){return db[_0xd1d2('0x12')][_0xd1d2('0x13')](_0x1907e4[_0xd1d2('0x14')],{'raw':_0x1907e4[_0xd1d2('0x15')]?_0x1907e4['options'][_0xd1d2('0x16')]===undefined?!![]:![]:!![]})[_0xd1d2('0x9')](function(_0xf692bf){logger[_0xd1d2('0xa')](_0xd1d2('0x11'),_0x1907e4);logger[_0xd1d2('0x17')]('CreateAttachment',_0x1907e4,JSON['stringify'](_0xf692bf));_0x289919(_0xf692bf);})[_0xd1d2('0x10')](function(_0x3e5a25){logger[_0xd1d2('0xc')](_0xd1d2('0x11'),_0x3e5a25[_0xd1d2('0xf')],_0x1907e4);_0x2ee0e9(_0x2f007a['error'](0x1f4,_0x3e5a25['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b5deaf7..8033bab 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 _0x1f47=['../../config/environment','./attachment.controller','index','get','/:id','show','/:id/download','isAuthenticated','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x20114e,_0x22b501){var _0x3401af=function(_0x31c913){while(--_0x31c913){_0x20114e['push'](_0x20114e['shift']());}};_0x3401af(++_0x22b501);}(_0x1f47,0x6e));var _0x71f4=function(_0x55b882,_0x553347){_0x55b882=_0x55b882-0x0;var _0x49164e=_0x1f47[_0x55b882];return _0x49164e;};'use strict';var multer=require('multer');var util=require(_0x71f4('0x0'));var path=require(_0x71f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x71f4('0x2'));var router=express[_0x71f4('0x3')]();var auth=require(_0x71f4('0x4'));var interaction=require(_0x71f4('0x5'));var config=require(_0x71f4('0x6'));var controller=require(_0x71f4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x71f4('0x8')]);router[_0x71f4('0x9')](_0x71f4('0xa'),auth['isAuthenticated'](),controller[_0x71f4('0xb')]);router[_0x71f4('0x9')](_0x71f4('0xc'),auth[_0x71f4('0xd')](),controller['download']);var upload=multer({'storage':multer[_0x71f4('0xe')]({'destination':function(_0x34210f,_0x138490,_0x1d26f8){_0x1d26f8(null,path[_0x71f4('0xf')](config[_0x71f4('0x10')],_0x71f4('0x11')));},'filename':function(_0x5b6bb3,_0x23bf48,_0x5debe2){_0x5debe2(null,util['format'](_0x71f4('0x12'),Date[_0x71f4('0x13')](),_0x23bf48[_0x71f4('0x14')][_0x71f4('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x71f4('0x16')](_0x71f4('0x17')),controller[_0x71f4('0x18')]);router[_0x71f4('0x19')](_0x71f4('0xa'),auth[_0x71f4('0xd')](),controller[_0x71f4('0x1a')]);router['delete'](_0x71f4('0xa'),auth[_0x71f4('0xd')](),controller[_0x71f4('0x1b')]);module[_0x71f4('0x1c')]=router; \ No newline at end of file +var _0xbf8f=['create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','join','root','server/files/attachments/','format','post','single','file'];(function(_0x56b6d5,_0x388f95){var _0x2fb790=function(_0x2a41b0){while(--_0x2a41b0){_0x56b6d5['push'](_0x56b6d5['shift']());}};_0x2fb790(++_0x388f95);}(_0xbf8f,0x14a));var _0xfbf8=function(_0x4d4875,_0x3909ea){_0x4d4875=_0x4d4875-0x0;var _0x4efff4=_0xbf8f[_0x4d4875];return _0x4efff4;};'use strict';var multer=require(_0xfbf8('0x0'));var util=require(_0xfbf8('0x1'));var path=require('path');var timeout=require(_0xfbf8('0x2'));var express=require(_0xfbf8('0x3'));var router=express[_0xfbf8('0x4')]();var auth=require(_0xfbf8('0x5'));var interaction=require(_0xfbf8('0x6'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0xfbf8('0x7')]('/',auth[_0xfbf8('0x8')](),controller[_0xfbf8('0x9')]);router[_0xfbf8('0x7')]('/:id',auth[_0xfbf8('0x8')](),controller[_0xfbf8('0xa')]);router['get'](_0xfbf8('0xb'),auth[_0xfbf8('0x8')](),controller[_0xfbf8('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xcefc12,_0x5c114a,_0x363d1e){_0x363d1e(null,path[_0xfbf8('0xd')](config[_0xfbf8('0xe')],_0xfbf8('0xf')));},'filename':function(_0x19dc28,_0x3f1354,_0x53d327){_0x53d327(null,util[_0xfbf8('0x10')]('%s-%s',Date['now'](),_0x3f1354['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfbf8('0x11')]('/',upload[_0xfbf8('0x12')](_0xfbf8('0x13')),controller[_0xfbf8('0x14')]);router[_0xfbf8('0x15')](_0xfbf8('0x16'),auth[_0xfbf8('0x8')](),controller['update']);router['delete'](_0xfbf8('0x16'),auth[_0xfbf8('0x8')](),controller[_0xfbf8('0x17')]);module[_0xfbf8('0x18')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 51f0435..b81a683 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 _0x1feb=['lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','clearBlockUser','getLicense'];(function(_0x140358,_0x52cc34){var _0x49e20f=function(_0x4e84a9){while(--_0x4e84a9){_0x140358['push'](_0x140358['shift']());}};_0x49e20f(++_0x52cc34);}(_0x1feb,0x1b0));var _0xb1fe=function(_0x517681,_0x342a5e){_0x517681=_0x517681-0x0;var _0x24dac7=_0x1feb[_0x517681];return _0x24dac7;};'use strict';var _=require(_0xb1fe('0x0'));var passport=require(_0xb1fe('0x1'));var GoogleStrategy=require(_0xb1fe('0x2'))['Strategy'];var moment=require(_0xb1fe('0x3'));var db=require(_0xb1fe('0x4'))['db'];var config=require(_0xb1fe('0x5'));var signToken=require(_0xb1fe('0x6'))[_0xb1fe('0x7')];var utils=require('../../config/utils');exports[_0xb1fe('0x8')]=passport[_0xb1fe('0x9')](_0xb1fe('0xa'),{'failureRedirect':_0xb1fe('0xb'),'scope':[_0xb1fe('0xc'),_0xb1fe('0xd')],'session':![]});exports[_0xb1fe('0xe')]=passport['authenticate'](_0xb1fe('0xa'),{'failureRedirect':'/login','session':![]});passport[_0xb1fe('0xf')](new GoogleStrategy({'clientID':config[_0xb1fe('0xa')]?config['google'][_0xb1fe('0x10')]:'id','clientSecret':config[_0xb1fe('0xa')]?config[_0xb1fe('0xa')][_0xb1fe('0x11')]:'secret','callbackURL':config[_0xb1fe('0xa')]?config[_0xb1fe('0xa')]['callbackURL']:''},function(_0x46acb5,_0x34228a,_0x3bddf8,_0x56d57f){var _0x13ecc,_0x2ee96c;return db[_0xb1fe('0x12')][_0xb1fe('0x13')]({'where':{'id':0x1},'attributes':[_0xb1fe('0x14'),_0xb1fe('0x15')],'raw':!![]})[_0xb1fe('0x16')](function(_0x345b49){_0x13ecc=_0x345b49;return db[_0xb1fe('0x17')][_0xb1fe('0x18')]({'where':{'email':_[_0xb1fe('0x19')](_0x3bddf8[_0xb1fe('0x1a')],_0xb1fe('0x1b')),'role':{'$or':['admin',_0xb1fe('0x1c'),_0xb1fe('0x1d')]}}});})[_0xb1fe('0x16')](function(_0x5cdde7){_0x2ee96c=_0x5cdde7;if(_0x2ee96c){if(_0x2ee96c['disabled']){return _0x56d57f(_0xb1fe('0x1e'));}else if(_0x13ecc[_0xb1fe('0x15')]>0x0){if(_0x2ee96c[_0xb1fe('0x1f')]){if(moment(_0x2ee96c[_0xb1fe('0x20')])['add'](_0x13ecc[_0xb1fe('0x15')],_0xb1fe('0x21'))>moment()){return _0x56d57f(_0xb1fe('0x1e'));}else{return utils[_0xb1fe('0x22')](_0x2ee96c,0x0,![],null)[_0xb1fe('0x16')](function(){return utils['getLicense'](_0x2ee96c);})[_0xb1fe('0x16')](function(){return _0x56d57f(null,_0x2ee96c);});}}else{return utils[_0xb1fe('0x23')](_0x2ee96c)['then'](function(){return _0x56d57f(null,_0x2ee96c);});}}else{return utils[_0xb1fe('0x23')](_0x2ee96c)[_0xb1fe('0x16')](function(){return _0x56d57f(null,_0x2ee96c);});}}return _0x56d57f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0xeb45c7){_0x56d57f(_0xeb45c7);});})); \ No newline at end of file +var _0x4d0b=['getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','use','secret','Setting','findOne','allowedLoginAttempts','blockDuration','User','find','map','emails','value','user','agent','then','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d0b,0x122));var _0xb4d0=function(_0x5528c5,_0x2a70b1){_0x5528c5=_0x5528c5-0x0;var _0x3f5c43=_0x4d0b[_0x5528c5];return _0x3f5c43;};'use strict';var _=require(_0xb4d0('0x0'));var passport=require(_0xb4d0('0x1'));var GoogleStrategy=require(_0xb4d0('0x2'))[_0xb4d0('0x3')];var moment=require(_0xb4d0('0x4'));var db=require(_0xb4d0('0x5'))['db'];var config=require(_0xb4d0('0x6'));var signToken=require(_0xb4d0('0x7'))[_0xb4d0('0x8')];var utils=require(_0xb4d0('0x9'));exports[_0xb4d0('0xa')]=passport[_0xb4d0('0xb')](_0xb4d0('0xc'),{'failureRedirect':_0xb4d0('0xd'),'scope':[_0xb4d0('0xe'),_0xb4d0('0xf')],'session':![]});exports['callback']=passport[_0xb4d0('0xb')](_0xb4d0('0xc'),{'failureRedirect':_0xb4d0('0xd'),'session':![]});passport[_0xb4d0('0x10')](new GoogleStrategy({'clientID':config[_0xb4d0('0xc')]?config['google']['clientID']:'id','clientSecret':config['google']?config[_0xb4d0('0xc')]['clientSecret']:_0xb4d0('0x11'),'callbackURL':config[_0xb4d0('0xc')]?config[_0xb4d0('0xc')]['callbackURL']:''},function(_0x1f4a08,_0x2a4788,_0xa7eeb9,_0x4d2bbe){var _0x115a08,_0xe2a59a;return db[_0xb4d0('0x12')][_0xb4d0('0x13')]({'where':{'id':0x1},'attributes':[_0xb4d0('0x14'),_0xb4d0('0x15')],'raw':!![]})['then'](function(_0xb13f48){_0x115a08=_0xb13f48;return db[_0xb4d0('0x16')][_0xb4d0('0x17')]({'where':{'email':_[_0xb4d0('0x18')](_0xa7eeb9[_0xb4d0('0x19')],_0xb4d0('0x1a')),'role':{'$or':['admin',_0xb4d0('0x1b'),_0xb4d0('0x1c')]}}});})[_0xb4d0('0x1d')](function(_0x4e1637){_0xe2a59a=_0x4e1637;if(_0xe2a59a){if(_0xe2a59a['disabled']){return _0x4d2bbe('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x115a08[_0xb4d0('0x15')]>0x0){if(_0xe2a59a['blocked']){if(moment(_0xe2a59a['blockedAt'])[_0xb4d0('0x1e')](_0x115a08[_0xb4d0('0x15')],_0xb4d0('0x1f'))>moment()){return _0x4d2bbe(_0xb4d0('0x20'));}else{return utils[_0xb4d0('0x21')](_0xe2a59a,0x0,![],null)[_0xb4d0('0x1d')](function(){return utils[_0xb4d0('0x22')](_0xe2a59a);})[_0xb4d0('0x1d')](function(){return _0x4d2bbe(null,_0xe2a59a);});}}else{return utils[_0xb4d0('0x22')](_0xe2a59a)['then'](function(){return _0x4d2bbe(null,_0xe2a59a);});}}else{return utils[_0xb4d0('0x22')](_0xe2a59a)[_0xb4d0('0x1d')](function(){return _0x4d2bbe(null,_0xe2a59a);});}}return _0x4d2bbe(_0xb4d0('0x20'));})[_0xb4d0('0x23')](function(_0x2bd032){_0x4d2bbe(_0x2bd032);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 1f5603a..6c0ea04 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 _0x44f8=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','setTokenCookie','exports','express','passport'];(function(_0x48e35d,_0x312292){var _0x28ac6e=function(_0xed4dd3){while(--_0xed4dd3){_0x48e35d['push'](_0x48e35d['shift']());}};_0x28ac6e(++_0x312292);}(_0x44f8,0x1de));var _0x844f=function(_0x58d1d2,_0x3677dc){_0x58d1d2=_0x58d1d2-0x0;var _0x441045=_0x44f8[_0x58d1d2];return _0x441045;};'use strict';var express=require(_0x844f('0x0'));var passport=require(_0x844f('0x1'));var router=express[_0x844f('0x2')]();var controller=require(_0x844f('0x3'));var userController=require(_0x844f('0x4'));var authService=require(_0x844f('0x5'));router['get']('/',controller['login']);router[_0x844f('0x6')]('/callback',controller['callback'],authService['isMiddleware'],userController[_0x844f('0x7')],authService[_0x844f('0x8')]);module[_0x844f('0x9')]=router; \ No newline at end of file +var _0x1b32=['exports','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x5d8afd,_0xd7f769){var _0x336c61=function(_0x539e58){while(--_0x539e58){_0x5d8afd['push'](_0x5d8afd['shift']());}};_0x336c61(++_0xd7f769);}(_0x1b32,0x85));var _0x21b3=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x1b32[_0x42bdad];return _0x122626;};'use strict';var express=require('express');var passport=require(_0x21b3('0x0'));var router=express[_0x21b3('0x1')]();var controller=require(_0x21b3('0x2'));var userController=require(_0x21b3('0x3'));var authService=require(_0x21b3('0x4'));router[_0x21b3('0x5')]('/',controller[_0x21b3('0x6')]);router[_0x21b3('0x5')](_0x21b3('0x7'),controller[_0x21b3('0x8')],authService[_0x21b3('0x9')],userController[_0x21b3('0x6')],authService[_0x21b3('0xa')]);module[_0x21b3('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 5b23183..5dbdb51 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 _0x951e=['service','host','port','secure','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','test','login','authenticate','local','json','online','forgot','Email\x20parameter\x20is\x20missing','body','trim','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','http://','headers','/reset/','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','resetPasswordToken','resetPasswordExpires','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!'];(function(_0x1efb89,_0x12dd98){var _0x2f9acc=function(_0x42a426){while(--_0x42a426){_0x1efb89['push'](_0x1efb89['shift']());}};_0x2f9acc(++_0x12dd98);}(_0x951e,0xc9));var _0xe951=function(_0x10855c,_0x3a079c){_0x10855c=_0x10855c-0x0;var _0x2baac0=_0x951e[_0x10855c];return _0x2baac0;};'use strict';var util=require(_0xe951('0x0'));var passport=require(_0xe951('0x1'));var LocalStrategy=require(_0xe951('0x2'))[_0xe951('0x3')];var jayson=require(_0xe951('0x4'));var _=require(_0xe951('0x5'));var rs=require(_0xe951('0x6'));var moment=require(_0xe951('0x7'));var db=require(_0xe951('0x8'))['db'];var authService=require(_0xe951('0x9'));var utils=require('../../config/utils');var client=jayson['client'][_0xe951('0xa')]({'port':0x232b});function localAuthenticate(_0x2d8dcc,_0x4a8fa5,_0x44fe53,_0x582e1f){var _0x3383fc,_0x146675;return db['Setting'][_0xe951('0xb')]({'where':{'id':0x1},'attributes':[_0xe951('0xc'),_0xe951('0xd')],'raw':!![]})[_0xe951('0xe')](function(_0xe662c2){_0x3383fc=_0xe662c2;return _0x2d8dcc['findOne']({'attributes':['id',_0xe951('0xf'),_0xe951('0x10'),_0xe951('0x11'),_0xe951('0x12'),_0xe951('0x13'),'blocked',_0xe951('0x14'),_0xe951('0x15')],'where':{'name':_0x4a8fa5,'role':{'$or':['admin','user',_0xe951('0x16')]}}});})[_0xe951('0xe')](function(_0x4381d1){if(!_0x4381d1||_0x4381d1&&_0x4381d1[_0xe951('0xf')]!==_0x4a8fa5){throw new Error(_0xe951('0x17'));}else{_0x146675=_0x4381d1;return _0x146675;}})[_0xe951('0xe')](function(){_0x146675['authenticate'](_0x44fe53,function(_0x13d586,_0x3939c9){var _0x440991=_0x146675[_0xe951('0x15')]+0x1;if(_0x13d586){return _0x582e1f(_0x13d586);}else if(!_0x3939c9){if(_0x146675[_0xe951('0x13')]){return _0x582e1f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3383fc[_0xe951('0xc')]>0x0){if(_0x146675[_0xe951('0x18')]){if(_0x3383fc[_0xe951('0xd')]>0x0){if(moment(_0x146675['blockedAt'])[_0xe951('0x19')](_0x3383fc[_0xe951('0xd')],_0xe951('0x1a'))>moment()){return _0x582e1f(null,![],{'message':_0xe951('0x17')});}else{return utils[_0xe951('0x1b')](_0x146675,_0x440991,![],null)['then'](function(){return _0x582e1f(null,![],{'message':_0xe951('0x17')});});}}else{return _0x582e1f(null,![],{'message':_0xe951('0x17')});}}else{if(_0x440991>=_0x3383fc['allowedLoginAttempts']){return utils[_0xe951('0x1b')](_0x146675,0x0,!![],moment())[_0xe951('0xe')](function(){return _0x582e1f(null,![],{'message':_0xe951('0x17')});});}else{return utils[_0xe951('0x1b')](_0x146675,_0x440991,![],null)[_0xe951('0xe')](function(){return _0x582e1f(null,![],{'message':_0xe951('0x17')});});}}}else{return _0x582e1f(null,![],{'message':_0xe951('0x17')});}}else{if(_0x146675['disabled']){return _0x582e1f(null,![],{'message':_0xe951('0x17')});}else if(_0x3383fc[_0xe951('0xc')]>0x0){if(_0x146675[_0xe951('0x18')]){if(_0x3383fc[_0xe951('0xd')]>0x0){if(moment(_0x146675['blockedAt'])[_0xe951('0x19')](_0x3383fc[_0xe951('0xd')],_0xe951('0x1a'))>moment()){return _0x582e1f(null,![],{'message':_0xe951('0x17')});}else{return utils['clearBlockUser'](_0x146675,0x0,![],null)[_0xe951('0xe')](function(){return utils[_0xe951('0x1c')](_0x146675);})[_0xe951('0xe')](function(){return _0x582e1f(null,_0x146675);});}}else{return _0x582e1f(null,![],{'message':_0xe951('0x17')});}}else{return utils[_0xe951('0x1b')](_0x146675,0x0,![],null)['then'](function(){return utils['getLicense'](_0x146675);})[_0xe951('0xe')](function(){return _0x582e1f(null,_0x146675);})[_0xe951('0x1d')](function(_0x2f9030){return _0x582e1f(null,![],_0x2f9030);});}}else{if(_0x146675[_0xe951('0x18')]){return _0x582e1f(null,![],{'message':_0xe951('0x17')});}else{return utils['getLicense'](_0x146675)['then'](function(){return _0x582e1f(null,_0x146675);});}}}});})[_0xe951('0x1d')](function(_0x10835d){return _0x582e1f(null,![],_0x10835d);});}function sendServiceMail(_0x1ba9d8){return db[_0xe951('0x1e')][_0xe951('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xe951('0xf'),_0xe951('0x20')],'include':[{'model':db[_0xe951('0x21')],'as':_0xe951('0x22')}]})[_0xe951('0xe')](function(_0x985555){if(!_0x985555){throw new Error(_0xe951('0x23'));}var _0x3d862d={'tls':{'rejectUnauthorized':![]}};if(_0x985555['Smtp'][_0xe951('0x24')]){_0x3d862d[_0xe951('0x24')]=_0x985555[_0xe951('0x22')]['service'];}else{_0x3d862d[_0xe951('0x25')]=_0x985555[_0xe951('0x22')][_0xe951('0x25')];_0x3d862d[_0xe951('0x26')]=_0x985555[_0xe951('0x22')][_0xe951('0x26')];_0x3d862d[_0xe951('0x27')]=_0x985555['Smtp'][_0xe951('0x27')];}if(_0x985555[_0xe951('0x22')][_0xe951('0x28')]){_0x3d862d[_0xe951('0x29')]={'user':_0x985555['Smtp'][_0xe951('0x2a')],'pass':_0x985555[_0xe951('0x22')][_0xe951('0x2b')]};}var _0x139b87={'account':_0x3d862d,'message':_[_0xe951('0x2c')]({'from':util[_0xe951('0x2d')](_0xe951('0x2e'),_0x985555[_0xe951('0xf')],_0x985555[_0xe951('0x20')]||_0x985555[_0xe951('0x22')][_0xe951('0x2a')])},_0x1ba9d8)};return client[_0xe951('0x2f')](_0xe951('0x30'),_0x139b87);})[_0xe951('0xe')](function(_0x137141){if(_0x137141[_0xe951('0x31')]){throw new Error(util[_0xe951('0x2d')](_0xe951('0x32'),_0x137141[_0xe951('0x31')]['message']||JSON[_0xe951('0x33')](_0x137141['error'])));}return!![];});}function handleError(_0x5a1d31,_0x380fc4,_0x26e1ca){return _0x5a1d31[_0xe951('0x34')](_0x380fc4||0x1f4)[_0xe951('0x35')]({'message':_0x26e1ca?_0x26e1ca['message']||_0x26e1ca:''});}function checkPasswordPattern(_0x478983,_0x5c730c,_0x2fb115){if(_0x2fb115){var _0x5bde04=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bde04[_0xe951('0x36')](_0x5c730c)){return _0x478983;}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 _0x478983;}}exports[_0xe951('0x37')]=function(_0xedc3d8,_0x168804,_0x1c273e){passport[_0xe951('0x38')](_0xe951('0x39'),function(_0x1b8fad,_0x5a5820,_0x4ddcfd){var _0x144b08=_0x1b8fad||_0x4ddcfd;if(_0x144b08){return handleError(_0x168804,0x191,_0x144b08);}if(!_0x5a5820){return handleError(_0x168804,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2d7105={'payload':{'id':_0x5a5820['id'],'role':_0x5a5820[_0xe951('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2d7105)[_0xe951('0xe')](function(_0x5a4946){_0x168804[_0xe951('0x3a')]({'id':_0x5a5820['id'],'token':_0x5a4946,'statusCall':'','isAlreadyLogged':_0x5a5820[_0xe951('0x3b')]});});}})(_0xedc3d8,_0x168804,_0x1c273e);};exports[_0xe951('0x3c')]=function(_0x58af70,_0x1adcc0,_0x3b75f3){if(!_0x58af70['body'][_0xe951('0x20')]){return handleError(_0x1adcc0,0x1f4,{'message':_0xe951('0x3d')});}var _0x12d12b=rs['generate']();_0x58af70[_0xe951('0x3e')][_0xe951('0x20')]=_0x58af70[_0xe951('0x3e')][_0xe951('0x20')][_0xe951('0x3f')]()[_0xe951('0x40')]();var _0x598362;return db[_0xe951('0x41')][_0xe951('0xb')]({'where':{'id':0x1},'attributes':[_0xe951('0xc'),_0xe951('0xd')],'raw':!![]})[_0xe951('0xe')](function(_0x1b27e6){_0x598362=_0x1b27e6;return db['User']['find']({'where':{'email':_0x58af70[_0xe951('0x3e')][_0xe951('0x20')]}});})[_0xe951('0xe')](function(_0x356617){if(!_0x356617){throw new Error(_0xe951('0x42'));}if(_0x356617[_0xe951('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x356617[_0xe951('0x18')]){if(moment(_0x356617[_0xe951('0x14')])[_0xe951('0x19')](_0x598362['blockDuration'],'minutes')>moment()){throw new Error(_0xe951('0x43'));}else{_0x356617['blocked']=![];_0x356617[_0xe951('0x14')]=null;}}_0x356617['resetPasswordToken']=_0x12d12b;_0x356617['resetPasswordExpires']=Date[_0xe951('0x44')]()+0x36ee80;return _0x356617[_0xe951('0x45')]();})[_0xe951('0xe')](function(){return sendServiceMail({'to':_0x58af70[_0xe951('0x3e')][_0xe951('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xe951('0x46')+_0x58af70[_0xe951('0x47')][_0xe951('0x25')]+_0xe951('0x48')+_0x12d12b+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x1adcc0['status'](0xc8)[_0xe951('0x35')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x316fe1){return handleError(_0x1adcc0,0x1f4,_0x316fe1);});};exports['reset']=function(_0x28852e,_0x356c36,_0x4bd168){var _0x4482f4;return db[_0xe951('0x49')][_0xe951('0x1f')]({'where':{'resetPasswordToken':_0x28852e['params'][_0xe951('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xe951('0x44')]()}}})[_0xe951('0xe')](function(_0x5cecaa){_0x4482f4=_0x5cecaa;if(!_0x4482f4){throw new Error(_0xe951('0x4b'));}return db['Setting'][_0xe951('0xb')]({'attributes':['id',_0xe951('0x4c')]});})[_0xe951('0xe')](function(_0x53e71f){return checkPasswordPattern(_0x53e71f,_0x28852e[_0xe951('0x3e')][_0xe951('0x10')],_0x53e71f[_0xe951('0x4c')]);})[_0xe951('0xe')](function(){_0x4482f4[_0xe951('0x10')]=_0x28852e[_0xe951('0x3e')]['password'];_0x4482f4[_0xe951('0x4d')]=null;_0x4482f4[_0xe951('0x4e')]=null;return _0x4482f4[_0xe951('0x45')]();})[_0xe951('0xe')](function(){_0x356c36[_0xe951('0x34')](0xc8)[_0xe951('0x35')]({'message':'Password\x20reset!'});})[_0xe951('0x1d')](function(_0x1f686b){return handleError(_0x356c36,0x1f4,_0x1f686b);});};passport['use'](new LocalStrategy({'usernameField':_0xe951('0xf'),'passwordField':'password'},function(_0x4c781d,_0x1c1219,_0x3b449d){return localAuthenticate(db['User'],_0x4c781d,_0x1c1219,_0x3b449d);})); \ No newline at end of file +var _0x461a=['name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','catch','getLicense','MailAccount','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','local','signToken','json','online','email','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','find','body','This\x20email\x20is\x20not\x20registered.','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration'];(function(_0x125e3c,_0x59cbb3){var _0x15e625=function(_0x31d88c){while(--_0x31d88c){_0x125e3c['push'](_0x125e3c['shift']());}};_0x15e625(++_0x59cbb3);}(_0x461a,0x192));var _0xa461=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x461a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var passport=require(_0xa461('0x0'));var LocalStrategy=require(_0xa461('0x1'))[_0xa461('0x2')];var jayson=require(_0xa461('0x3'));var _=require(_0xa461('0x4'));var rs=require(_0xa461('0x5'));var moment=require(_0xa461('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xa461('0x7'));var utils=require(_0xa461('0x8'));var client=jayson['client'][_0xa461('0x9')]({'port':0x232b});function localAuthenticate(_0x113f3f,_0x2b181a,_0x143950,_0x4b288b){var _0x510a74,_0xa49464;return db['Setting'][_0xa461('0xa')]({'where':{'id':0x1},'attributes':[_0xa461('0xb'),_0xa461('0xc')],'raw':!![]})['then'](function(_0x1de33e){_0x510a74=_0x1de33e;return _0x113f3f[_0xa461('0xa')]({'attributes':['id',_0xa461('0xd'),_0xa461('0xe'),_0xa461('0xf'),_0xa461('0x10'),_0xa461('0x11'),_0xa461('0x12'),_0xa461('0x13'),_0xa461('0x14')],'where':{'name':_0x2b181a,'role':{'$or':[_0xa461('0x15'),_0xa461('0x16'),_0xa461('0x17')]}}});})[_0xa461('0x18')](function(_0x43d221){if(!_0x43d221||_0x43d221&&_0x43d221[_0xa461('0xd')]!==_0x2b181a){throw new Error(_0xa461('0x19'));}else{_0xa49464=_0x43d221;return _0xa49464;}})[_0xa461('0x18')](function(){_0xa49464[_0xa461('0x1a')](_0x143950,function(_0x4c4d3b,_0x21e6e2){var _0x3e5e3c=_0xa49464[_0xa461('0x14')]+0x1;if(_0x4c4d3b){return _0x4b288b(_0x4c4d3b);}else if(!_0x21e6e2){if(_0xa49464['disabled']){return _0x4b288b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x510a74[_0xa461('0xb')]>0x0){if(_0xa49464['blocked']){if(_0x510a74[_0xa461('0xc')]>0x0){if(moment(_0xa49464[_0xa461('0x13')])[_0xa461('0x1b')](_0x510a74[_0xa461('0xc')],_0xa461('0x1c'))>moment()){return _0x4b288b(null,![],{'message':_0xa461('0x19')});}else{return utils['clearBlockUser'](_0xa49464,_0x3e5e3c,![],null)[_0xa461('0x18')](function(){return _0x4b288b(null,![],{'message':_0xa461('0x19')});});}}else{return _0x4b288b(null,![],{'message':_0xa461('0x19')});}}else{if(_0x3e5e3c>=_0x510a74[_0xa461('0xb')]){return utils[_0xa461('0x1d')](_0xa49464,0x0,!![],moment())[_0xa461('0x18')](function(){return _0x4b288b(null,![],{'message':_0xa461('0x19')});});}else{return utils['clearBlockUser'](_0xa49464,_0x3e5e3c,![],null)['then'](function(){return _0x4b288b(null,![],{'message':_0xa461('0x19')});});}}}else{return _0x4b288b(null,![],{'message':_0xa461('0x19')});}}else{if(_0xa49464[_0xa461('0x11')]){return _0x4b288b(null,![],{'message':_0xa461('0x19')});}else if(_0x510a74[_0xa461('0xb')]>0x0){if(_0xa49464[_0xa461('0x12')]){if(_0x510a74[_0xa461('0xc')]>0x0){if(moment(_0xa49464[_0xa461('0x13')])['add'](_0x510a74[_0xa461('0xc')],_0xa461('0x1c'))>moment()){return _0x4b288b(null,![],{'message':_0xa461('0x19')});}else{return utils['clearBlockUser'](_0xa49464,0x0,![],null)[_0xa461('0x18')](function(){return utils['getLicense'](_0xa49464);})[_0xa461('0x18')](function(){return _0x4b288b(null,_0xa49464);});}}else{return _0x4b288b(null,![],{'message':_0xa461('0x19')});}}else{return utils['clearBlockUser'](_0xa49464,0x0,![],null)[_0xa461('0x18')](function(){return utils['getLicense'](_0xa49464);})[_0xa461('0x18')](function(){return _0x4b288b(null,_0xa49464);})[_0xa461('0x1e')](function(_0x479525){return _0x4b288b(null,![],_0x479525);});}}else{if(_0xa49464[_0xa461('0x12')]){return _0x4b288b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa461('0x1f')](_0xa49464)[_0xa461('0x18')](function(){return _0x4b288b(null,_0xa49464);});}}}});})['catch'](function(_0x37eafe){return _0x4b288b(null,![],_0x37eafe);});}function sendServiceMail(_0x127a00){return db[_0xa461('0x20')]['find']({'where':{'service':!![]},'attributes':['id',_0xa461('0xd'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xa461('0x21')}]})['then'](function(_0x55d873){if(!_0x55d873){throw new Error(_0xa461('0x22'));}var _0x30af76={'tls':{'rejectUnauthorized':![]}};if(_0x55d873[_0xa461('0x21')][_0xa461('0x23')]){_0x30af76[_0xa461('0x23')]=_0x55d873[_0xa461('0x21')][_0xa461('0x23')];}else{_0x30af76[_0xa461('0x24')]=_0x55d873['Smtp']['host'];_0x30af76[_0xa461('0x25')]=_0x55d873[_0xa461('0x21')][_0xa461('0x25')];_0x30af76[_0xa461('0x26')]=_0x55d873['Smtp']['secure'];}if(_0x55d873['Smtp'][_0xa461('0x27')]){_0x30af76[_0xa461('0x28')]={'user':_0x55d873[_0xa461('0x21')][_0xa461('0x16')],'pass':_0x55d873[_0xa461('0x21')][_0xa461('0x29')]};}var _0x5489dd={'account':_0x30af76,'message':_[_0xa461('0x2a')]({'from':util[_0xa461('0x2b')](_0xa461('0x2c'),_0x55d873['name'],_0x55d873['email']||_0x55d873['Smtp'][_0xa461('0x16')])},_0x127a00)};return client[_0xa461('0x2d')](_0xa461('0x2e'),_0x5489dd);})['then'](function(_0x2bde48){if(_0x2bde48[_0xa461('0x2f')]){throw new Error(util[_0xa461('0x2b')](_0xa461('0x30'),_0x2bde48[_0xa461('0x2f')][_0xa461('0x31')]||JSON[_0xa461('0x32')](_0x2bde48[_0xa461('0x2f')])));}return!![];});}function handleError(_0x1cc3eb,_0x4d38ff,_0x2906d5){return _0x1cc3eb['status'](_0x4d38ff||0x1f4)[_0xa461('0x33')]({'message':_0x2906d5?_0x2906d5[_0xa461('0x31')]||_0x2906d5:''});}function checkPasswordPattern(_0x515148,_0x430234,_0xa0cb0a){if(_0xa0cb0a){var _0x4199bd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4199bd['test'](_0x430234)){return _0x515148;}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 _0x515148;}}exports['login']=function(_0x348a20,_0x4855d2,_0x308210){passport[_0xa461('0x1a')](_0xa461('0x34'),function(_0x175106,_0x2372cc,_0x9e67c5){var _0x1b5e9c=_0x175106||_0x9e67c5;if(_0x1b5e9c){return handleError(_0x4855d2,0x191,_0x1b5e9c);}if(!_0x2372cc){return handleError(_0x4855d2,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x253282={'payload':{'id':_0x2372cc['id'],'role':_0x2372cc[_0xa461('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xa461('0x35')](_0x253282)[_0xa461('0x18')](function(_0x469775){_0x4855d2[_0xa461('0x36')]({'id':_0x2372cc['id'],'token':_0x469775,'statusCall':'','isAlreadyLogged':_0x2372cc[_0xa461('0x37')]});});}})(_0x348a20,_0x4855d2,_0x308210);};exports['forgot']=function(_0x155302,_0x42037c,_0x149b27){if(!_0x155302['body'][_0xa461('0x38')]){return handleError(_0x42037c,0x1f4,{'message':_0xa461('0x39')});}var _0x1afb84=rs[_0xa461('0x3a')]();_0x155302['body'][_0xa461('0x38')]=_0x155302['body']['email'][_0xa461('0x3b')]()[_0xa461('0x3c')]();var _0x43f68d;return db[_0xa461('0x3d')][_0xa461('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa461('0xc')],'raw':!![]})[_0xa461('0x18')](function(_0xdb8a7a){_0x43f68d=_0xdb8a7a;return db[_0xa461('0x3e')][_0xa461('0x3f')]({'where':{'email':_0x155302[_0xa461('0x40')][_0xa461('0x38')]}});})['then'](function(_0x2228a1){if(!_0x2228a1){throw new Error(_0xa461('0x41'));}if(_0x2228a1[_0xa461('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x2228a1['blocked']){if(moment(_0x2228a1['blockedAt'])['add'](_0x43f68d['blockDuration'],_0xa461('0x1c'))>moment()){throw new Error(_0xa461('0x42'));}else{_0x2228a1[_0xa461('0x12')]=![];_0x2228a1[_0xa461('0x13')]=null;}}_0x2228a1[_0xa461('0x43')]=_0x1afb84;_0x2228a1[_0xa461('0x44')]=Date['now']()+0x36ee80;return _0x2228a1[_0xa461('0x45')]();})[_0xa461('0x18')](function(){return sendServiceMail({'to':_0x155302[_0xa461('0x40')][_0xa461('0x38')],'subject':_0xa461('0x46'),'text':_0xa461('0x47')+_0xa461('0x48')+_0xa461('0x49')+_0x155302['headers']['host']+'/reset/'+_0x1afb84+'\x0a\x0a'+_0xa461('0x4a')});})[_0xa461('0x18')](function(){_0x42037c[_0xa461('0x4b')](0xc8)[_0xa461('0x33')]({'message':_0xa461('0x4c')});})[_0xa461('0x1e')](function(_0x3168a6){return handleError(_0x42037c,0x1f4,_0x3168a6);});};exports[_0xa461('0x4d')]=function(_0x4b4fc4,_0xe17c1e,_0x34dd40){var _0x1c1286;return db[_0xa461('0x3e')][_0xa461('0x3f')]({'where':{'resetPasswordToken':_0x4b4fc4[_0xa461('0x4e')]['token'],'resetPasswordExpires':{'$gt':Date[_0xa461('0x4f')]()}}})['then'](function(_0x2d2073){_0x1c1286=_0x2d2073;if(!_0x1c1286){throw new Error(_0xa461('0x50'));}return db[_0xa461('0x3d')][_0xa461('0xa')]({'attributes':['id',_0xa461('0x51')]});})[_0xa461('0x18')](function(_0x28cffc){return checkPasswordPattern(_0x28cffc,_0x4b4fc4['body'][_0xa461('0xe')],_0x28cffc[_0xa461('0x51')]);})[_0xa461('0x18')](function(){_0x1c1286[_0xa461('0xe')]=_0x4b4fc4[_0xa461('0x40')][_0xa461('0xe')];_0x1c1286[_0xa461('0x43')]=null;_0x1c1286[_0xa461('0x44')]=null;return _0x1c1286[_0xa461('0x45')]();})['then'](function(){_0xe17c1e['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0xa461('0x1e')](function(_0x23bbd9){return handleError(_0xe17c1e,0x1f4,_0x23bbd9);});};passport[_0xa461('0x52')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x5046be,_0xaf724a,_0x15d779){return localAuthenticate(db[_0xa461('0x3e')],_0x5046be,_0xaf724a,_0x15d779);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 7f24e98..ebb0dc8 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 _0xb116=['./authLocal.controller','post','login','/forgot','/reset/:token','reset','express'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xb116,0x8b));var _0x6b11=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0xb116[_0x37ded3];return _0x51e49e;};'use strict';var express=require(_0x6b11('0x0'));var router=express['Router']();var controller=require(_0x6b11('0x1'));router[_0x6b11('0x2')]('/',controller[_0x6b11('0x3')]);router[_0x6b11('0x2')](_0x6b11('0x4'),controller['forgot']);router[_0x6b11('0x2')](_0x6b11('0x5'),controller[_0x6b11('0x6')]);module['exports']=router; \ No newline at end of file +var _0x3104=['/reset/:token','./authLocal.controller','post','/forgot','forgot'];(function(_0xbfcb39,_0x4b297e){var _0x3e8da0=function(_0x519701){while(--_0x519701){_0xbfcb39['push'](_0xbfcb39['shift']());}};_0x3e8da0(++_0x4b297e);}(_0x3104,0x1b9));var _0x4310=function(_0x32831e,_0x1055b3){_0x32831e=_0x32831e-0x0;var _0x2dae79=_0x3104[_0x32831e];return _0x2dae79;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x4310('0x0'));router['post']('/',controller['login']);router[_0x4310('0x1')](_0x4310('0x2'),controller[_0x4310('0x3')]);router[_0x4310('0x1')](_0x4310('0x4'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index dc5345a..b7097b5 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 _0x6f81=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x1840ac,_0x379e76){var _0x3cda07=function(_0x13a6fa){while(--_0x13a6fa){_0x1840ac['push'](_0x1840ac['shift']());}};_0x3cda07(++_0x379e76);}(_0x6f81,0x1f3));var _0x16f8=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x6f81[_0x75f869];return _0x10af8b;};'use strict';var Sequelize=require(_0x16f8('0x0'));module[_0x16f8('0x1')]={'name':{'type':Sequelize[_0x16f8('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x16f8('0x2')]},'description':{'type':Sequelize[_0x16f8('0x2')]},'status':{'type':Sequelize[_0x16f8('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x16f8('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x6b25=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x18eeaa,_0x4380b6){var _0x23d240=function(_0x864c98){while(--_0x864c98){_0x18eeaa['push'](_0x18eeaa['shift']());}};_0x23d240(++_0x4380b6);}(_0x6b25,0xea));var _0x56b2=function(_0x319230,_0x2f0f61){_0x319230=_0x319230-0x0;var _0x15329a=_0x6b25[_0x319230];return _0x15329a;};'use strict';var Sequelize=require(_0x56b2('0x0'));module[_0x56b2('0x1')]={'name':{'type':Sequelize[_0x56b2('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x56b2('0x2')]},'description':{'type':Sequelize[_0x56b2('0x2')]},'status':{'type':Sequelize[_0x56b2('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x56b2('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index f53cc43..ae779a8 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 _0x46f2=['save','update','then','destroy','error','stack','name','send','Automation','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','map','key','VIRTUAL','field','merge','options','include','rows','catch','show','rawAttributes','includeAll','create','body','find','params','addConditions','ids','getConditions','findOne','Condition','order','nolimit','addActions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x2c503c,_0xd88a2a){var _0x39dce7=function(_0x4b01a5){while(--_0x4b01a5){_0x2c503c['push'](_0x2c503c['shift']());}};_0x39dce7(++_0xd88a2a);}(_0x46f2,0x1ba));var _0x246f=function(_0x46a802,_0x15772e){_0x46a802=_0x46a802-0x0;var _0x26ecf2=_0x46f2[_0x46a802];return _0x26ecf2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x246f('0x0'));var rimraf=require(_0x246f('0x1'));var zipdir=require(_0x246f('0x2'));var jsonpatch=require(_0x246f('0x3'));var rp=require('request-promise');var moment=require(_0x246f('0x4'));var BPromise=require(_0x246f('0x5'));var Mustache=require(_0x246f('0x6'));var util=require(_0x246f('0x7'));var path=require(_0x246f('0x8'));var sox=require('sox');var csv=require(_0x246f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x246f('0xa'));var crypto=require('crypto');var jsforce=require(_0x246f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x246f('0x9'));var querystring=require(_0x246f('0xc'));var Papa=require(_0x246f('0xd'));var Redis=require(_0x246f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x246f('0xf'));var hardwareService=require(_0x246f('0x10'));var logger=require(_0x246f('0x11'))('api');var utils=require(_0x246f('0x12'));var config=require(_0x246f('0x13'));var db=require(_0x246f('0x14'))['db'];function respondWithStatusCode(_0x4c2f9f,_0x326140){_0x326140=_0x326140||0xcc;return function(_0x3884c5){if(_0x3884c5){return _0x4c2f9f[_0x246f('0x15')](_0x326140);}return _0x4c2f9f['status'](_0x326140)[_0x246f('0x16')]();};}function respondWithResult(_0x1d5440,_0xe6416f){_0xe6416f=_0xe6416f||0xc8;return function(_0x1442ae){if(_0x1442ae){return _0x1d5440[_0x246f('0x17')](_0xe6416f)[_0x246f('0x18')](_0x1442ae);}};}function respondWithFilteredResult(_0x38fdc4,_0x4cebaf){return function(_0x4ddf50){if(_0x4ddf50){var _0x3bb0f4=_0x4ddf50[_0x246f('0x19')],_0x5f5991=_0x4cebaf[_0x246f('0x1a')],_0x13817f=_0x4cebaf[_0x246f('0x1a')]+_0x4cebaf[_0x246f('0x1b')],_0x1d153d;if(_0x13817f>=_0x3bb0f4){_0x13817f=_0x3bb0f4;_0x1d153d=0xc8;}else{_0x1d153d=0xce;}_0x38fdc4[_0x246f('0x17')](_0x1d153d);return _0x38fdc4[_0x246f('0x1c')](_0x246f('0x1d'),_0x5f5991+'-'+_0x13817f+'/'+_0x3bb0f4)[_0x246f('0x18')](_0x4ddf50);}return null;};}function patchUpdates(_0x4aa12c){return function(_0x35ea2d){try{jsonpatch[_0x246f('0x1e')](_0x35ea2d,_0x4aa12c,!![]);}catch(_0xa8f5c7){return BPromise[_0x246f('0x1f')](_0xa8f5c7);}return _0x35ea2d[_0x246f('0x20')]();};}function saveUpdates(_0x40b48e,_0x1513f0){return function(_0x2ea9c2){if(_0x2ea9c2){return _0x2ea9c2[_0x246f('0x21')](_0x40b48e)[_0x246f('0x22')](function(_0x312715){return _0x312715;});}return null;};}function removeEntity(_0x3bc1d5,_0x508434){return function(_0xec5156){if(_0xec5156){return _0xec5156[_0x246f('0x23')]()['then'](function(){_0x3bc1d5['status'](0xcc)[_0x246f('0x16')]();});}};}function handleEntityNotFound(_0x3d1aba,_0x2fd932){return function(_0x4865a9){if(!_0x4865a9){_0x3d1aba[_0x246f('0x15')](0x194);}return _0x4865a9;};}function handleError(_0x512c57,_0x596b23){_0x596b23=_0x596b23||0x1f4;return function(_0x5bd6fd){logger[_0x246f('0x24')](_0x5bd6fd[_0x246f('0x25')]);if(_0x5bd6fd['name']){delete _0x5bd6fd[_0x246f('0x26')];}_0x512c57['status'](_0x596b23)[_0x246f('0x27')](_0x5bd6fd);};}exports['index']=function(_0x433dcb,_0x343297){var _0x3eca5c={},_0x45854a={},_0x32bafa={'count':0x0,'rows':[]};var _0x30bd9c=db[_0x246f('0x28')]['rawAttributes'];_0x45854a[_0x246f('0x29')]=_[_0x246f('0x2a')](_0x30bd9c);_0x45854a[_0x246f('0x2b')]=_[_0x246f('0x2a')](_0x433dcb[_0x246f('0x2b')]);_0x45854a[_0x246f('0x2c')]=_[_0x246f('0x2d')](_0x45854a['model'],_0x45854a[_0x246f('0x2b')]);_0x3eca5c['attributes']=_[_0x246f('0x2d')](_0x45854a['model'],qs[_0x246f('0x2e')](_0x433dcb[_0x246f('0x2b')][_0x246f('0x2e')]));_0x3eca5c[_0x246f('0x2f')]=_0x3eca5c[_0x246f('0x2f')][_0x246f('0x30')]?_0x3eca5c[_0x246f('0x2f')]:_0x45854a[_0x246f('0x29')];if(!_0x433dcb['query'][_0x246f('0x31')]('nolimit')){_0x3eca5c[_0x246f('0x1b')]=qs[_0x246f('0x1b')](_0x433dcb[_0x246f('0x2b')][_0x246f('0x1b')]);_0x3eca5c[_0x246f('0x1a')]=qs['offset'](_0x433dcb['query']['offset']);}_0x3eca5c['order']=qs[_0x246f('0x32')](_0x433dcb['query'][_0x246f('0x32')]);_0x3eca5c[_0x246f('0x33')]=qs[_0x246f('0x2c')](_[_0x246f('0x34')](_0x433dcb[_0x246f('0x2b')],_0x45854a[_0x246f('0x2c')]));if(_0x433dcb['query'][_0x246f('0x35')]){_0x3eca5c[_0x246f('0x33')]=_['merge'](_0x3eca5c[_0x246f('0x33')],{'$or':_[_0x246f('0x36')](_0x30bd9c,function(_0x75c9e){if(_0x75c9e['type'][_0x246f('0x37')]!==_0x246f('0x38')){var _0x4cd01c={};_0x4cd01c[_0x75c9e[_0x246f('0x39')]]={'$like':'%'+_0x433dcb['query'][_0x246f('0x35')]+'%'};return _0x4cd01c;}})});}_0x3eca5c=_[_0x246f('0x3a')]({},_0x3eca5c,_0x433dcb[_0x246f('0x3b')]);var _0x9452d9={'where':_0x3eca5c['where']};return db['Automation'][_0x246f('0x19')](_0x9452d9)[_0x246f('0x22')](function(_0x2ae0e6){_0x32bafa[_0x246f('0x19')]=_0x2ae0e6;if(_0x433dcb[_0x246f('0x2b')]['includeAll']){_0x3eca5c[_0x246f('0x3c')]=[{'all':!![]}];}return db[_0x246f('0x28')]['findAll'](_0x3eca5c);})[_0x246f('0x22')](function(_0x4494e5){_0x32bafa[_0x246f('0x3d')]=_0x4494e5;return _0x32bafa;})[_0x246f('0x22')](respondWithFilteredResult(_0x343297,_0x3eca5c))[_0x246f('0x3e')](handleError(_0x343297,null));};exports[_0x246f('0x3f')]=function(_0x5b9101,_0x428b9a){var _0x138429={'raw':![],'where':{'id':_0x5b9101['params']['id']}},_0x15d063={};_0x15d063[_0x246f('0x29')]=_['keys'](db[_0x246f('0x28')][_0x246f('0x40')]);_0x15d063['query']=_['keys'](_0x5b9101['query']);_0x15d063[_0x246f('0x2c')]=_[_0x246f('0x2d')](_0x15d063[_0x246f('0x29')],_0x15d063['query']);_0x138429[_0x246f('0x2f')]=_[_0x246f('0x2d')](_0x15d063[_0x246f('0x29')],qs[_0x246f('0x2e')](_0x5b9101['query'][_0x246f('0x2e')]));_0x138429[_0x246f('0x2f')]=_0x138429['attributes'][_0x246f('0x30')]?_0x138429[_0x246f('0x2f')]:_0x15d063[_0x246f('0x29')];if(_0x5b9101[_0x246f('0x2b')][_0x246f('0x41')]){_0x138429[_0x246f('0x3c')]=[{'all':!![]}];}_0x138429=_[_0x246f('0x3a')]({},_0x138429,_0x5b9101[_0x246f('0x3b')]);return db[_0x246f('0x28')]['find'](_0x138429)['then'](handleEntityNotFound(_0x428b9a,null))[_0x246f('0x22')](respondWithResult(_0x428b9a,null))[_0x246f('0x3e')](handleError(_0x428b9a,null));};exports[_0x246f('0x42')]=function(_0x3e6075,_0x1edc23){return db['Automation'][_0x246f('0x42')](_0x3e6075[_0x246f('0x43')],{})['then'](respondWithResult(_0x1edc23,0xc9))[_0x246f('0x3e')](handleError(_0x1edc23,null));};exports[_0x246f('0x21')]=function(_0x30f77d,_0x4cbaef){if(_0x30f77d[_0x246f('0x43')]['id']){delete _0x30f77d[_0x246f('0x43')]['id'];}return db[_0x246f('0x28')][_0x246f('0x44')]({'where':{'id':_0x30f77d[_0x246f('0x45')]['id']}})[_0x246f('0x22')](handleEntityNotFound(_0x4cbaef,null))[_0x246f('0x22')](saveUpdates(_0x30f77d[_0x246f('0x43')],null))['then'](respondWithResult(_0x4cbaef,null))[_0x246f('0x3e')](handleError(_0x4cbaef,null));};exports[_0x246f('0x23')]=function(_0x26024f,_0x1e24aa){return db[_0x246f('0x28')]['find']({'where':{'id':_0x26024f[_0x246f('0x45')]['id']}})[_0x246f('0x22')](handleEntityNotFound(_0x1e24aa,null))[_0x246f('0x22')](removeEntity(_0x1e24aa,null))['catch'](handleError(_0x1e24aa,null));};exports['addConditions']=function(_0x586ef1,_0x34059e,_0x5a3197){return db['Condition'][_0x246f('0x44')]({'where':{'id':_0x586ef1['params']['id']}})[_0x246f('0x22')](handleEntityNotFound(_0x34059e,null))[_0x246f('0x22')](function(_0x1023da){if(_0x1023da){return _0x1023da[_0x246f('0x46')](_0x586ef1[_0x246f('0x43')][_0x246f('0x47')],_['omit'](_0x586ef1[_0x246f('0x43')],['ids','id'])||{});}})[_0x246f('0x22')](respondWithResult(_0x34059e,null))['catch'](handleError(_0x34059e,null));};exports[_0x246f('0x48')]=function(_0x2e06b8,_0x3547cc,_0xde5b8e){var _0x3ee795={};var _0x3ee84b={};var _0x293c25;var _0x36c5cb;return db[_0x246f('0x28')][_0x246f('0x49')]({'where':{'id':_0x2e06b8['params']['id']}})[_0x246f('0x22')](handleEntityNotFound(_0x3547cc,null))[_0x246f('0x22')](function(_0x53587e){if(_0x53587e){_0x293c25=_0x53587e;_0x3ee84b[_0x246f('0x29')]=_[_0x246f('0x2a')](db[_0x246f('0x4a')][_0x246f('0x40')]);_0x3ee84b[_0x246f('0x2b')]=_[_0x246f('0x2a')](_0x2e06b8[_0x246f('0x2b')]);_0x3ee84b[_0x246f('0x2c')]=_[_0x246f('0x2d')](_0x3ee84b[_0x246f('0x29')],_0x3ee84b[_0x246f('0x2b')]);_0x3ee795[_0x246f('0x2f')]=_[_0x246f('0x2d')](_0x3ee84b['model'],qs[_0x246f('0x2e')](_0x2e06b8['query'][_0x246f('0x2e')]));_0x3ee795[_0x246f('0x2f')]=_0x3ee795[_0x246f('0x2f')][_0x246f('0x30')]?_0x3ee795[_0x246f('0x2f')]:_0x3ee84b[_0x246f('0x29')];_0x3ee795[_0x246f('0x4b')]=qs[_0x246f('0x32')](_0x2e06b8[_0x246f('0x2b')][_0x246f('0x32')]);_0x3ee795[_0x246f('0x33')]=qs[_0x246f('0x2c')](_[_0x246f('0x34')](_0x2e06b8[_0x246f('0x2b')],_0x3ee84b[_0x246f('0x2c')]));if(_0x2e06b8[_0x246f('0x2b')]['filter']){_0x3ee795['where']=_[_0x246f('0x3a')](_0x3ee795[_0x246f('0x33')],{'$or':_[_0x246f('0x36')](_0x3ee795[_0x246f('0x2f')],function(_0x93bcb9){var _0x253172={};_0x253172[_0x93bcb9]={'$like':'%'+_0x2e06b8['query'][_0x246f('0x35')]+'%'};return _0x253172;})});}_0x3ee795=_[_0x246f('0x3a')]({},_0x3ee795,_0x2e06b8[_0x246f('0x3b')]);return _0x293c25['getConditions'](_0x3ee795);}})['then'](function(_0x53bce8){if(_0x53bce8){_0x36c5cb=_0x53bce8[_0x246f('0x30')];if(!_0x2e06b8[_0x246f('0x2b')][_0x246f('0x31')](_0x246f('0x4c'))){_0x3ee795['limit']=qs[_0x246f('0x1b')](_0x2e06b8[_0x246f('0x2b')]['limit']);_0x3ee795[_0x246f('0x1a')]=qs[_0x246f('0x1a')](_0x2e06b8[_0x246f('0x2b')]['offset']);}return _0x293c25['getConditions'](_0x3ee795);}})['then'](function(_0x884c75){if(_0x884c75){return _0x884c75?{'count':_0x36c5cb,'rows':_0x884c75}:null;}})['then'](respondWithResult(_0x3547cc,null))[_0x246f('0x3e')](handleError(_0x3547cc,null));};exports[_0x246f('0x4d')]=function(_0x56e847,_0x2c1a99,_0x216a63){return db['Action'][_0x246f('0x44')]({'where':{'id':_0x56e847[_0x246f('0x45')]['id']}})[_0x246f('0x22')](handleEntityNotFound(_0x2c1a99,null))['then'](function(_0x1659cd){if(_0x1659cd){return _0x1659cd[_0x246f('0x4d')](_0x56e847[_0x246f('0x43')]['ids'],_['omit'](_0x56e847['body'],[_0x246f('0x47'),'id'])||{});}})[_0x246f('0x22')](respondWithResult(_0x2c1a99,null))[_0x246f('0x3e')](handleError(_0x2c1a99,null));};exports[_0x246f('0x4e')]=function(_0x5f2116,_0x52a4bb,_0x578181){var _0x4eb3fd={};var _0x4b9b26={};var _0x267700;var _0x3e0b11;return db[_0x246f('0x28')][_0x246f('0x49')]({'where':{'id':_0x5f2116['params']['id']}})['then'](handleEntityNotFound(_0x52a4bb,null))['then'](function(_0x2d99f4){if(_0x2d99f4){_0x267700=_0x2d99f4;_0x4b9b26[_0x246f('0x29')]=_['keys'](db['Action'][_0x246f('0x40')]);_0x4b9b26[_0x246f('0x2b')]=_[_0x246f('0x2a')](_0x5f2116['query']);_0x4b9b26[_0x246f('0x2c')]=_['intersection'](_0x4b9b26[_0x246f('0x29')],_0x4b9b26[_0x246f('0x2b')]);_0x4eb3fd['attributes']=_[_0x246f('0x2d')](_0x4b9b26[_0x246f('0x29')],qs[_0x246f('0x2e')](_0x5f2116[_0x246f('0x2b')][_0x246f('0x2e')]));_0x4eb3fd[_0x246f('0x2f')]=_0x4eb3fd[_0x246f('0x2f')][_0x246f('0x30')]?_0x4eb3fd['attributes']:_0x4b9b26[_0x246f('0x29')];_0x4eb3fd[_0x246f('0x4b')]=qs[_0x246f('0x32')](_0x5f2116[_0x246f('0x2b')]['sort']);_0x4eb3fd['where']=qs[_0x246f('0x2c')](_[_0x246f('0x34')](_0x5f2116[_0x246f('0x2b')],_0x4b9b26[_0x246f('0x2c')]));if(_0x5f2116[_0x246f('0x2b')][_0x246f('0x35')]){_0x4eb3fd[_0x246f('0x33')]=_[_0x246f('0x3a')](_0x4eb3fd[_0x246f('0x33')],{'$or':_[_0x246f('0x36')](_0x4eb3fd[_0x246f('0x2f')],function(_0x475143){var _0x1013ed={};_0x1013ed[_0x475143]={'$like':'%'+_0x5f2116[_0x246f('0x2b')][_0x246f('0x35')]+'%'};return _0x1013ed;})});}_0x4eb3fd=_[_0x246f('0x3a')]({},_0x4eb3fd,_0x5f2116[_0x246f('0x3b')]);return _0x267700[_0x246f('0x4e')](_0x4eb3fd);}})['then'](function(_0x1b7ffb){if(_0x1b7ffb){_0x3e0b11=_0x1b7ffb[_0x246f('0x30')];if(!_0x5f2116['query'][_0x246f('0x31')](_0x246f('0x4c'))){_0x4eb3fd[_0x246f('0x1b')]=qs[_0x246f('0x1b')](_0x5f2116['query'][_0x246f('0x1b')]);_0x4eb3fd[_0x246f('0x1a')]=qs[_0x246f('0x1a')](_0x5f2116[_0x246f('0x2b')]['offset']);}return _0x267700[_0x246f('0x4e')](_0x4eb3fd);}})['then'](function(_0x9acb1a){if(_0x9acb1a){return _0x9acb1a?{'count':_0x3e0b11,'rows':_0x9acb1a}:null;}})[_0x246f('0x22')](respondWithResult(_0x52a4bb,null))[_0x246f('0x3e')](handleError(_0x52a4bb,null));}; \ No newline at end of file +var _0xcda9=['intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','type','key','field','options','includeAll','include','rows','catch','show','params','find','create','body','update','destroy','addConditions','Condition','ids','omit','findOne','merge','getConditions','nolimit','addActions','Action','getActions','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','Automation','rawAttributes','model','keys','query'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xcda9,0xd7));var _0x9cda=function(_0x2d8da4,_0x3f1949){_0x2d8da4=_0x2d8da4-0x0;var _0x57be77=_0xcda9[_0x2d8da4];return _0x57be77;};'use strict';var pdf=require(_0x9cda('0x0'));var emlformat=require(_0x9cda('0x1'));var rimraf=require(_0x9cda('0x2'));var zipdir=require(_0x9cda('0x3'));var jsonpatch=require(_0x9cda('0x4'));var rp=require(_0x9cda('0x5'));var moment=require(_0x9cda('0x6'));var BPromise=require(_0x9cda('0x7'));var Mustache=require(_0x9cda('0x8'));var util=require(_0x9cda('0x9'));var path=require(_0x9cda('0xa'));var sox=require('sox');var csv=require(_0x9cda('0xb'));var ejs=require(_0x9cda('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9cda('0xd'));var crypto=require(_0x9cda('0xe'));var jsforce=require(_0x9cda('0xf'));var deskjs=require(_0x9cda('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9cda('0x11'));var Papa=require(_0x9cda('0x12'));var Redis=require(_0x9cda('0x13'));var authService=require(_0x9cda('0x14'));var qs=require(_0x9cda('0x15'));var hardwareService=require(_0x9cda('0x16'));var logger=require(_0x9cda('0x17'))(_0x9cda('0x18'));var utils=require(_0x9cda('0x19'));var config=require(_0x9cda('0x1a'));var db=require(_0x9cda('0x1b'))['db'];function respondWithStatusCode(_0x1d9c93,_0x2fbf94){_0x2fbf94=_0x2fbf94||0xcc;return function(_0x22ba82){if(_0x22ba82){return _0x1d9c93['sendStatus'](_0x2fbf94);}return _0x1d9c93[_0x9cda('0x1c')](_0x2fbf94)['end']();};}function respondWithResult(_0x4f894c,_0x9d1ae){_0x9d1ae=_0x9d1ae||0xc8;return function(_0x685dbd){if(_0x685dbd){return _0x4f894c['status'](_0x9d1ae)[_0x9cda('0x1d')](_0x685dbd);}};}function respondWithFilteredResult(_0x1ee6aa,_0x105ae0){return function(_0x1f290e){if(_0x1f290e){var _0x368658=_0x1f290e[_0x9cda('0x1e')],_0x8c8a58=_0x105ae0[_0x9cda('0x1f')],_0x6f72ce=_0x105ae0[_0x9cda('0x1f')]+_0x105ae0['limit'],_0x1f45b3;if(_0x6f72ce>=_0x368658){_0x6f72ce=_0x368658;_0x1f45b3=0xc8;}else{_0x1f45b3=0xce;}_0x1ee6aa[_0x9cda('0x1c')](_0x1f45b3);return _0x1ee6aa[_0x9cda('0x20')](_0x9cda('0x21'),_0x8c8a58+'-'+_0x6f72ce+'/'+_0x368658)[_0x9cda('0x1d')](_0x1f290e);}return null;};}function patchUpdates(_0x56e4e0){return function(_0x2b57c3){try{jsonpatch[_0x9cda('0x22')](_0x2b57c3,_0x56e4e0,!![]);}catch(_0x153864){return BPromise[_0x9cda('0x23')](_0x153864);}return _0x2b57c3[_0x9cda('0x24')]();};}function saveUpdates(_0x43492d,_0x4f0471){return function(_0x28f4a0){if(_0x28f4a0){return _0x28f4a0['update'](_0x43492d)[_0x9cda('0x25')](function(_0x5aa8d7){return _0x5aa8d7;});}return null;};}function removeEntity(_0x1b8c83,_0x5ac378){return function(_0xf145c7){if(_0xf145c7){return _0xf145c7['destroy']()[_0x9cda('0x25')](function(){_0x1b8c83[_0x9cda('0x1c')](0xcc)[_0x9cda('0x26')]();});}};}function handleEntityNotFound(_0x1458b8,_0x59b530){return function(_0x4572f5){if(!_0x4572f5){_0x1458b8[_0x9cda('0x27')](0x194);}return _0x4572f5;};}function handleError(_0x122c8e,_0x5c107e){_0x5c107e=_0x5c107e||0x1f4;return function(_0x11bfab){logger[_0x9cda('0x28')](_0x11bfab[_0x9cda('0x29')]);if(_0x11bfab[_0x9cda('0x2a')]){delete _0x11bfab[_0x9cda('0x2a')];}_0x122c8e[_0x9cda('0x1c')](_0x5c107e)[_0x9cda('0x2b')](_0x11bfab);};}exports['index']=function(_0x223553,_0xcf74e3){var _0x1086d9={},_0xc8df3c={},_0x5a2d80={'count':0x0,'rows':[]};var _0x4908da=db[_0x9cda('0x2c')][_0x9cda('0x2d')];_0xc8df3c[_0x9cda('0x2e')]=_['keys'](_0x4908da);_0xc8df3c['query']=_[_0x9cda('0x2f')](_0x223553[_0x9cda('0x30')]);_0xc8df3c['filters']=_[_0x9cda('0x31')](_0xc8df3c[_0x9cda('0x2e')],_0xc8df3c[_0x9cda('0x30')]);_0x1086d9['attributes']=_[_0x9cda('0x31')](_0xc8df3c['model'],qs[_0x9cda('0x32')](_0x223553[_0x9cda('0x30')][_0x9cda('0x32')]));_0x1086d9[_0x9cda('0x33')]=_0x1086d9[_0x9cda('0x33')][_0x9cda('0x34')]?_0x1086d9[_0x9cda('0x33')]:_0xc8df3c[_0x9cda('0x2e')];if(!_0x223553[_0x9cda('0x30')][_0x9cda('0x35')]('nolimit')){_0x1086d9[_0x9cda('0x36')]=qs[_0x9cda('0x36')](_0x223553[_0x9cda('0x30')][_0x9cda('0x36')]);_0x1086d9[_0x9cda('0x1f')]=qs[_0x9cda('0x1f')](_0x223553['query']['offset']);}_0x1086d9[_0x9cda('0x37')]=qs[_0x9cda('0x38')](_0x223553[_0x9cda('0x30')]['sort']);_0x1086d9[_0x9cda('0x39')]=qs[_0x9cda('0x3a')](_[_0x9cda('0x3b')](_0x223553[_0x9cda('0x30')],_0xc8df3c[_0x9cda('0x3a')]));if(_0x223553[_0x9cda('0x30')][_0x9cda('0x3c')]){_0x1086d9['where']=_['merge'](_0x1086d9[_0x9cda('0x39')],{'$or':_['map'](_0x4908da,function(_0x4bbdc9){if(_0x4bbdc9[_0x9cda('0x3d')][_0x9cda('0x3e')]!=='VIRTUAL'){var _0x361c5d={};_0x361c5d[_0x4bbdc9[_0x9cda('0x3f')]]={'$like':'%'+_0x223553[_0x9cda('0x30')][_0x9cda('0x3c')]+'%'};return _0x361c5d;}})});}_0x1086d9=_['merge']({},_0x1086d9,_0x223553[_0x9cda('0x40')]);var _0x3257f4={'where':_0x1086d9[_0x9cda('0x39')]};return db['Automation']['count'](_0x3257f4)[_0x9cda('0x25')](function(_0x56d29f){_0x5a2d80['count']=_0x56d29f;if(_0x223553[_0x9cda('0x30')][_0x9cda('0x41')]){_0x1086d9[_0x9cda('0x42')]=[{'all':!![]}];}return db[_0x9cda('0x2c')]['findAll'](_0x1086d9);})[_0x9cda('0x25')](function(_0x213124){_0x5a2d80[_0x9cda('0x43')]=_0x213124;return _0x5a2d80;})[_0x9cda('0x25')](respondWithFilteredResult(_0xcf74e3,_0x1086d9))[_0x9cda('0x44')](handleError(_0xcf74e3,null));};exports[_0x9cda('0x45')]=function(_0x195755,_0x22deda){var _0x353adc={'raw':![],'where':{'id':_0x195755[_0x9cda('0x46')]['id']}},_0x1d28de={};_0x1d28de[_0x9cda('0x2e')]=_[_0x9cda('0x2f')](db[_0x9cda('0x2c')][_0x9cda('0x2d')]);_0x1d28de['query']=_[_0x9cda('0x2f')](_0x195755[_0x9cda('0x30')]);_0x1d28de['filters']=_[_0x9cda('0x31')](_0x1d28de[_0x9cda('0x2e')],_0x1d28de[_0x9cda('0x30')]);_0x353adc['attributes']=_[_0x9cda('0x31')](_0x1d28de[_0x9cda('0x2e')],qs[_0x9cda('0x32')](_0x195755[_0x9cda('0x30')][_0x9cda('0x32')]));_0x353adc['attributes']=_0x353adc[_0x9cda('0x33')]['length']?_0x353adc['attributes']:_0x1d28de['model'];if(_0x195755['query'][_0x9cda('0x41')]){_0x353adc['include']=[{'all':!![]}];}_0x353adc=_['merge']({},_0x353adc,_0x195755[_0x9cda('0x40')]);return db['Automation'][_0x9cda('0x47')](_0x353adc)['then'](handleEntityNotFound(_0x22deda,null))[_0x9cda('0x25')](respondWithResult(_0x22deda,null))['catch'](handleError(_0x22deda,null));};exports[_0x9cda('0x48')]=function(_0x55875f,_0x141e03){return db[_0x9cda('0x2c')]['create'](_0x55875f[_0x9cda('0x49')],{})[_0x9cda('0x25')](respondWithResult(_0x141e03,0xc9))[_0x9cda('0x44')](handleError(_0x141e03,null));};exports[_0x9cda('0x4a')]=function(_0x4ab8e8,_0x594f54){if(_0x4ab8e8[_0x9cda('0x49')]['id']){delete _0x4ab8e8[_0x9cda('0x49')]['id'];}return db[_0x9cda('0x2c')][_0x9cda('0x47')]({'where':{'id':_0x4ab8e8[_0x9cda('0x46')]['id']}})[_0x9cda('0x25')](handleEntityNotFound(_0x594f54,null))['then'](saveUpdates(_0x4ab8e8[_0x9cda('0x49')],null))[_0x9cda('0x25')](respondWithResult(_0x594f54,null))[_0x9cda('0x44')](handleError(_0x594f54,null));};exports[_0x9cda('0x4b')]=function(_0x1525ca,_0x4f5156){return db[_0x9cda('0x2c')][_0x9cda('0x47')]({'where':{'id':_0x1525ca[_0x9cda('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f5156,null))['then'](removeEntity(_0x4f5156,null))[_0x9cda('0x44')](handleError(_0x4f5156,null));};exports[_0x9cda('0x4c')]=function(_0x1fb5b0,_0x1d11cc,_0x5bff2e){return db[_0x9cda('0x4d')][_0x9cda('0x47')]({'where':{'id':_0x1fb5b0[_0x9cda('0x46')]['id']}})[_0x9cda('0x25')](handleEntityNotFound(_0x1d11cc,null))[_0x9cda('0x25')](function(_0x384429){if(_0x384429){return _0x384429[_0x9cda('0x4c')](_0x1fb5b0[_0x9cda('0x49')][_0x9cda('0x4e')],_[_0x9cda('0x4f')](_0x1fb5b0[_0x9cda('0x49')],[_0x9cda('0x4e'),'id'])||{});}})[_0x9cda('0x25')](respondWithResult(_0x1d11cc,null))[_0x9cda('0x44')](handleError(_0x1d11cc,null));};exports['getConditions']=function(_0x32a268,_0x58989d,_0x3b4e61){var _0x3c1f49={};var _0xa42166={};var _0x230509;var _0xcd99d;return db[_0x9cda('0x2c')][_0x9cda('0x50')]({'where':{'id':_0x32a268[_0x9cda('0x46')]['id']}})[_0x9cda('0x25')](handleEntityNotFound(_0x58989d,null))[_0x9cda('0x25')](function(_0x5139fe){if(_0x5139fe){_0x230509=_0x5139fe;_0xa42166['model']=_[_0x9cda('0x2f')](db[_0x9cda('0x4d')]['rawAttributes']);_0xa42166['query']=_[_0x9cda('0x2f')](_0x32a268[_0x9cda('0x30')]);_0xa42166['filters']=_[_0x9cda('0x31')](_0xa42166[_0x9cda('0x2e')],_0xa42166[_0x9cda('0x30')]);_0x3c1f49[_0x9cda('0x33')]=_['intersection'](_0xa42166['model'],qs[_0x9cda('0x32')](_0x32a268[_0x9cda('0x30')][_0x9cda('0x32')]));_0x3c1f49[_0x9cda('0x33')]=_0x3c1f49[_0x9cda('0x33')][_0x9cda('0x34')]?_0x3c1f49[_0x9cda('0x33')]:_0xa42166[_0x9cda('0x2e')];_0x3c1f49[_0x9cda('0x37')]=qs[_0x9cda('0x38')](_0x32a268[_0x9cda('0x30')][_0x9cda('0x38')]);_0x3c1f49[_0x9cda('0x39')]=qs[_0x9cda('0x3a')](_[_0x9cda('0x3b')](_0x32a268['query'],_0xa42166['filters']));if(_0x32a268['query'][_0x9cda('0x3c')]){_0x3c1f49[_0x9cda('0x39')]=_[_0x9cda('0x51')](_0x3c1f49[_0x9cda('0x39')],{'$or':_['map'](_0x3c1f49[_0x9cda('0x33')],function(_0x5aa161){var _0xb87302={};_0xb87302[_0x5aa161]={'$like':'%'+_0x32a268[_0x9cda('0x30')][_0x9cda('0x3c')]+'%'};return _0xb87302;})});}_0x3c1f49=_[_0x9cda('0x51')]({},_0x3c1f49,_0x32a268[_0x9cda('0x40')]);return _0x230509[_0x9cda('0x52')](_0x3c1f49);}})[_0x9cda('0x25')](function(_0x1b8bcc){if(_0x1b8bcc){_0xcd99d=_0x1b8bcc['length'];if(!_0x32a268[_0x9cda('0x30')]['hasOwnProperty'](_0x9cda('0x53'))){_0x3c1f49['limit']=qs[_0x9cda('0x36')](_0x32a268[_0x9cda('0x30')]['limit']);_0x3c1f49[_0x9cda('0x1f')]=qs['offset'](_0x32a268[_0x9cda('0x30')][_0x9cda('0x1f')]);}return _0x230509[_0x9cda('0x52')](_0x3c1f49);}})[_0x9cda('0x25')](function(_0x4c6ce4){if(_0x4c6ce4){return _0x4c6ce4?{'count':_0xcd99d,'rows':_0x4c6ce4}:null;}})[_0x9cda('0x25')](respondWithResult(_0x58989d,null))[_0x9cda('0x44')](handleError(_0x58989d,null));};exports[_0x9cda('0x54')]=function(_0x2c4c78,_0x23f5b3,_0xcd967e){return db[_0x9cda('0x55')][_0x9cda('0x47')]({'where':{'id':_0x2c4c78['params']['id']}})['then'](handleEntityNotFound(_0x23f5b3,null))[_0x9cda('0x25')](function(_0x28192c){if(_0x28192c){return _0x28192c[_0x9cda('0x54')](_0x2c4c78[_0x9cda('0x49')][_0x9cda('0x4e')],_[_0x9cda('0x4f')](_0x2c4c78['body'],[_0x9cda('0x4e'),'id'])||{});}})[_0x9cda('0x25')](respondWithResult(_0x23f5b3,null))[_0x9cda('0x44')](handleError(_0x23f5b3,null));};exports[_0x9cda('0x56')]=function(_0x10c8c9,_0x4d2f72,_0x26261e){var _0x521ff8={};var _0x5a2dd8={};var _0x1ce723;var _0x7f1b75;return db[_0x9cda('0x2c')][_0x9cda('0x50')]({'where':{'id':_0x10c8c9['params']['id']}})['then'](handleEntityNotFound(_0x4d2f72,null))[_0x9cda('0x25')](function(_0x1f5c6f){if(_0x1f5c6f){_0x1ce723=_0x1f5c6f;_0x5a2dd8[_0x9cda('0x2e')]=_[_0x9cda('0x2f')](db[_0x9cda('0x55')][_0x9cda('0x2d')]);_0x5a2dd8[_0x9cda('0x30')]=_['keys'](_0x10c8c9['query']);_0x5a2dd8[_0x9cda('0x3a')]=_[_0x9cda('0x31')](_0x5a2dd8[_0x9cda('0x2e')],_0x5a2dd8[_0x9cda('0x30')]);_0x521ff8[_0x9cda('0x33')]=_['intersection'](_0x5a2dd8[_0x9cda('0x2e')],qs[_0x9cda('0x32')](_0x10c8c9[_0x9cda('0x30')]['fields']));_0x521ff8[_0x9cda('0x33')]=_0x521ff8['attributes'][_0x9cda('0x34')]?_0x521ff8['attributes']:_0x5a2dd8['model'];_0x521ff8[_0x9cda('0x37')]=qs[_0x9cda('0x38')](_0x10c8c9[_0x9cda('0x30')]['sort']);_0x521ff8['where']=qs[_0x9cda('0x3a')](_['pick'](_0x10c8c9['query'],_0x5a2dd8[_0x9cda('0x3a')]));if(_0x10c8c9[_0x9cda('0x30')][_0x9cda('0x3c')]){_0x521ff8['where']=_[_0x9cda('0x51')](_0x521ff8[_0x9cda('0x39')],{'$or':_[_0x9cda('0x57')](_0x521ff8[_0x9cda('0x33')],function(_0x3d0033){var _0x41d69c={};_0x41d69c[_0x3d0033]={'$like':'%'+_0x10c8c9[_0x9cda('0x30')][_0x9cda('0x3c')]+'%'};return _0x41d69c;})});}_0x521ff8=_[_0x9cda('0x51')]({},_0x521ff8,_0x10c8c9[_0x9cda('0x40')]);return _0x1ce723[_0x9cda('0x56')](_0x521ff8);}})[_0x9cda('0x25')](function(_0xcdf291){if(_0xcdf291){_0x7f1b75=_0xcdf291[_0x9cda('0x34')];if(!_0x10c8c9[_0x9cda('0x30')][_0x9cda('0x35')]('nolimit')){_0x521ff8[_0x9cda('0x36')]=qs[_0x9cda('0x36')](_0x10c8c9[_0x9cda('0x30')][_0x9cda('0x36')]);_0x521ff8[_0x9cda('0x1f')]=qs['offset'](_0x10c8c9['query'][_0x9cda('0x1f')]);}return _0x1ce723[_0x9cda('0x56')](_0x521ff8);}})['then'](function(_0x50149a){if(_0x50149a){return _0x50149a?{'count':_0x7f1b75,'rows':_0x50149a}:null;}})[_0x9cda('0x25')](respondWithResult(_0x4d2f72,null))['catch'](handleError(_0x4d2f72,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e9ea3b1..7cac6ab 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 _0xb44f=['bluebird','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','lodash','util','api','moment'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0xb44f,0xe3));var _0xfb44=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb44f[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xfb44('0x0'));var util=require(_0xfb44('0x1'));var logger=require('../../config/logger')(_0xfb44('0x2'));var moment=require(_0xfb44('0x3'));var BPromise=require(_0xfb44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfb44('0x5'));var config=require(_0xfb44('0x6'));var attributes=require(_0xfb44('0x7'));module[_0xfb44('0x8')]=function(_0x1d2e44,_0x45c1e4){return _0x1d2e44[_0xfb44('0x9')](_0xfb44('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a8=['bluebird','request-promise','path','../../config/environment','./automation.attributes','Automation','tools_automations','util','../../config/logger','api','moment'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x97a8,0xe3));var _0x897a=function(_0x226159,_0x280c65){_0x226159=_0x226159-0x0;var _0x5af6f3=_0x97a8[_0x226159];return _0x5af6f3;};'use strict';var _=require('lodash');var util=require(_0x897a('0x0'));var logger=require(_0x897a('0x1'))(_0x897a('0x2'));var moment=require(_0x897a('0x3'));var BPromise=require(_0x897a('0x4'));var rp=require(_0x897a('0x5'));var fs=require('fs');var path=require(_0x897a('0x6'));var rimraf=require('rimraf');var config=require(_0x897a('0x7'));var attributes=require(_0x897a('0x8'));module['exports']=function(_0x5adcfd,_0x55e647){return _0x5adcfd['define'](_0x897a('0x9'),attributes,{'tableName':_0x897a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 47c9c7c..4129e59 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 _0x23e0=['http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x15b086,_0x1d6069){var _0xda0249=function(_0x3f45fc){while(--_0x3f45fc){_0x15b086['push'](_0x15b086['shift']());}};_0xda0249(++_0x1d6069);}(_0x23e0,0x79));var _0x023e=function(_0x281d32,_0x3b772f){_0x281d32=_0x281d32-0x0;var _0x429903=_0x23e0[_0x281d32];return _0x429903;};'use strict';var _=require(_0x023e('0x0'));var util=require(_0x023e('0x1'));var moment=require('moment');var BPromise=require(_0x023e('0x2'));var rs=require(_0x023e('0x3'));var fs=require('fs');var Redis=require(_0x023e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x023e('0x5'));var logger=require(_0x023e('0x6'))(_0x023e('0x7'));var config=require(_0x023e('0x8'));var jayson=require(_0x023e('0x9'));var client=jayson[_0x023e('0xa')][_0x023e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb604c5,_0x295791,_0x535ed0){return new BPromise(function(_0x42fdc4,_0x2193a3){return client[_0x023e('0xc')](_0xb604c5,_0x535ed0)[_0x023e('0xd')](function(_0x4d2dbe){logger[_0x023e('0xe')](_0x023e('0xf'),_0x295791,_0x023e('0x10'));logger[_0x023e('0x11')](_0x023e('0x12'),_0x295791,_0x023e('0x10'),JSON[_0x023e('0x13')](_0x4d2dbe));if(_0x4d2dbe[_0x023e('0x14')]){if(_0x4d2dbe[_0x023e('0x14')]['code']===0x1f4){logger['error'](_0x023e('0xf'),_0x295791,_0x4d2dbe['error'][_0x023e('0x15')]);return _0x2193a3(_0x4d2dbe[_0x023e('0x14')][_0x023e('0x15')]);}logger[_0x023e('0x14')](_0x023e('0xf'),_0x295791,_0x4d2dbe[_0x023e('0x14')][_0x023e('0x15')]);return _0x42fdc4(_0x4d2dbe[_0x023e('0x14')][_0x023e('0x15')]);}else{logger[_0x023e('0xe')](_0x023e('0xf'),_0x295791,_0x023e('0x10'));_0x42fdc4(_0x4d2dbe['result']['message']);}})['catch'](function(_0x2c6b25){logger[_0x023e('0x14')](_0x023e('0xf'),_0x295791,_0x2c6b25);_0x2193a3(_0x2c6b25);});});} \ No newline at end of file +var _0xdc39=['../../config/logger','../../config/environment','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a4781,_0x28837d){var _0x4164a9=function(_0x54801d){while(--_0x54801d){_0x4a4781['push'](_0x4a4781['shift']());}};_0x4164a9(++_0x28837d);}(_0xdc39,0x12b));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9dc3('0x0'));var moment=require('moment');var BPromise=require(_0x9dc3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc3('0x2'));var db=require(_0x9dc3('0x3'))['db'];var utils=require(_0x9dc3('0x4'));var logger=require(_0x9dc3('0x5'))('rpc');var config=require(_0x9dc3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9dc3('0x7')][_0x9dc3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ee301,_0x502993,_0x5b3578){return new BPromise(function(_0x5356d1,_0x9de81){return client['request'](_0x2ee301,_0x5b3578)[_0x9dc3('0x9')](function(_0xc4ab29){logger[_0x9dc3('0xa')](_0x9dc3('0xb'),_0x502993,_0x9dc3('0xc'));logger[_0x9dc3('0xd')](_0x9dc3('0xe'),_0x502993,'request\x20sent',JSON[_0x9dc3('0xf')](_0xc4ab29));if(_0xc4ab29['error']){if(_0xc4ab29['error'][_0x9dc3('0x10')]===0x1f4){logger['error'](_0x9dc3('0xb'),_0x502993,_0xc4ab29[_0x9dc3('0x11')][_0x9dc3('0x12')]);return _0x9de81(_0xc4ab29['error'][_0x9dc3('0x12')]);}logger[_0x9dc3('0x11')](_0x9dc3('0xb'),_0x502993,_0xc4ab29[_0x9dc3('0x11')]['message']);return _0x5356d1(_0xc4ab29[_0x9dc3('0x11')][_0x9dc3('0x12')]);}else{logger[_0x9dc3('0xa')]('Automation,\x20%s,\x20%s',_0x502993,_0x9dc3('0xc'));_0x5356d1(_0xc4ab29['result'][_0x9dc3('0x12')]);}})['catch'](function(_0x1273eb){logger[_0x9dc3('0x11')](_0x9dc3('0xb'),_0x502993,_0x1273eb);_0x9de81(_0x1273eb);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e2e84c6..5946630 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 _0xa71d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','/:id','delete','destroy','exports','multer','util','express'];(function(_0x15797a,_0x16274f){var _0x3e2618=function(_0x2b6e99){while(--_0x2b6e99){_0x15797a['push'](_0x15797a['shift']());}};_0x3e2618(++_0x16274f);}(_0xa71d,0xbd));var _0xda71=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xa71d[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require(_0xda71('0x0'));var util=require(_0xda71('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xda71('0x2'));var router=express[_0xda71('0x3')]();var auth=require(_0xda71('0x4'));var interaction=require(_0xda71('0x5'));var config=require(_0xda71('0x6'));var controller=require(_0xda71('0x7'));router[_0xda71('0x8')]('/',auth[_0xda71('0x9')](),controller['index']);router['get']('/:id',auth[_0xda71('0x9')](),controller[_0xda71('0xa')]);router[_0xda71('0x8')](_0xda71('0xb'),auth[_0xda71('0x9')](),controller[_0xda71('0xc')]);router[_0xda71('0x8')](_0xda71('0xd'),auth[_0xda71('0x9')](),controller[_0xda71('0xe')]);router[_0xda71('0xf')]('/',auth[_0xda71('0x9')](),controller[_0xda71('0x10')]);router[_0xda71('0xf')](_0xda71('0xb'),auth[_0xda71('0x9')](),controller[_0xda71('0x11')]);router[_0xda71('0xf')](_0xda71('0xd'),auth[_0xda71('0x9')](),controller[_0xda71('0x12')]);router[_0xda71('0x13')](_0xda71('0x14'),auth[_0xda71('0x9')](),controller['update']);router[_0xda71('0x15')](_0xda71('0x14'),auth[_0xda71('0x9')](),controller[_0xda71('0x16')]);module[_0xda71('0x17')]=router; \ No newline at end of file +var _0x58b6=['connect-timeout','express','../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getActions','post','create','addConditions','/:id/actions','addActions','/:id','delete','destroy','exports','multer','util','path'];(function(_0x798cab,_0x501c64){var _0x1b1477=function(_0x37d395){while(--_0x37d395){_0x798cab['push'](_0x798cab['shift']());}};_0x1b1477(++_0x501c64);}(_0x58b6,0x138));var _0x658b=function(_0x51cb0e,_0x50279c){_0x51cb0e=_0x51cb0e-0x0;var _0x47d4d6=_0x58b6[_0x51cb0e];return _0x47d4d6;};'use strict';var multer=require(_0x658b('0x0'));var util=require(_0x658b('0x1'));var path=require(_0x658b('0x2'));var timeout=require(_0x658b('0x3'));var express=require(_0x658b('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x658b('0x5'));var controller=require(_0x658b('0x6'));router[_0x658b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x658b('0x7')]('/:id',auth[_0x658b('0x8')](),controller[_0x658b('0x9')]);router[_0x658b('0x7')](_0x658b('0xa'),auth[_0x658b('0x8')](),controller['getConditions']);router[_0x658b('0x7')]('/:id/actions',auth[_0x658b('0x8')](),controller[_0x658b('0xb')]);router[_0x658b('0xc')]('/',auth[_0x658b('0x8')](),controller[_0x658b('0xd')]);router['post'](_0x658b('0xa'),auth[_0x658b('0x8')](),controller[_0x658b('0xe')]);router[_0x658b('0xc')](_0x658b('0xf'),auth['isAuthenticated'](),controller[_0x658b('0x10')]);router['put'](_0x658b('0x11'),auth[_0x658b('0x8')](),controller['update']);router[_0x658b('0x12')](_0x658b('0x11'),auth[_0x658b('0x8')](),controller[_0x658b('0x13')]);module[_0x658b('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4c62f1a..41c438c 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 _0x79af=['sequelize','exports','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0xe0bc7c,_0x26acec){var _0x2191b7=function(_0x21c8b7){while(--_0x21c8b7){_0xe0bc7c['push'](_0xe0bc7c['shift']());}};_0x2191b7(++_0x26acec);}(_0x79af,0x160));var _0xf79a=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x79af[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0xf79a('0x0'));module[_0xf79a('0x1')]={'name':{'type':Sequelize[_0xf79a('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf79a('0x3')](_0xf79a('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf79a('0x5')},'limitCalls':{'type':Sequelize[_0xf79a('0x6')](0x4)[_0xf79a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf79a('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf79a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf79a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xf79a('0x6')](0x3)[_0xf79a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf79a('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf79a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf79a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf79a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf79a('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf79a('0x6')](0x5)[_0xf79a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf79a('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf79a('0x7')],'defaultValue':0x3,'comment':_0xf79a('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf79a('0x6')](0x5)[_0xf79a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf79a('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf79a('0xd')},'dialTimezone':{'type':Sequelize[_0xf79a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf79a('0x2')],'defaultValue':_0xf79a('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xf79a('0x3')](_0xf79a('0xf'),_0xf79a('0x10'),_0xf79a('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xf79a('0x12')],'defaultValue':0x0,'comment':_0xf79a('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xf79a('0x6')](0x9)[_0xf79a('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf79a('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xf79a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf79a('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf79a('0x6')](0x9)[_0xf79a('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf79a('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf79a('0x6')](0x9)[_0xf79a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf79a('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xf79a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf79a('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf79a('0x6')](0x9)[_0xf79a('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf79a('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf79a('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf79a('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf79a('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf79a('0x6')](0x9)[_0xf79a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf79a('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf79a('0x3')](_0xf79a('0x1d'),_0xf79a('0x1e')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xf79a('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf79a('0x6')](0x3)[_0xf79a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf79a('0x1f')}}; \ No newline at end of file +var _0x7d9f=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED'];(function(_0x12f9a7,_0xc6cb2e){var _0x59b5a5=function(_0x3ce5eb){while(--_0x3ce5eb){_0x12f9a7['push'](_0x12f9a7['shift']());}};_0x59b5a5(++_0xc6cb2e);}(_0x7d9f,0xfd));var _0xf7d9=function(_0x2e2e41,_0x3a7848){_0x2e2e41=_0x2e2e41-0x0;var _0x266226=_0x7d9f[_0x2e2e41];return _0x266226;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module['exports']={'name':{'type':Sequelize[_0xf7d9('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf7d9('0x2')]('ivr'),'allowNull':![],'defaultValue':_0xf7d9('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf7d9('0x4')],'defaultValue':0x0,'comment':_0xf7d9('0x5')},'limitCalls':{'type':Sequelize[_0xf7d9('0x6')](0x4)[_0xf7d9('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xf7d9('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf7d9('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf7d9('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf7d9('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf7d9('0x6')](0x5)[_0xf7d9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf7d9('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xf7d9('0x6')](0x3)[_0xf7d9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf7d9('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf7d9('0x6')](0x5)[_0xf7d9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf7d9('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf7d9('0x6')](0x3)[_0xf7d9('0x7')],'defaultValue':0x3,'comment':_0xf7d9('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf7d9('0x6')](0x5)[_0xf7d9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf7d9('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf7d9('0x6')](0x3)[_0xf7d9('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf7d9('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf7d9('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xf7d9('0x2')](_0xf7d9('0x10'),_0xf7d9('0x11'),'onlyIfOpen'),'defaultValue':_0xf7d9('0x10')},'dialAMDActive':{'type':Sequelize[_0xf7d9('0x4')],'defaultValue':0x0,'comment':_0xf7d9('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xf7d9('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf7d9('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xf7d9('0x6')](0x9)[_0xf7d9('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf7d9('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf7d9('0x6')](0x9)[_0xf7d9('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf7d9('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf7d9('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf7d9('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf7d9('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf7d9('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf7d9('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf7d9('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf7d9('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf7d9('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf7d9('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf7d9('0x1a'),_0xf7d9('0x1b')),'defaultValue':_0xf7d9('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf7d9('0x6')](0x3)[_0xf7d9('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf7d9('0x1c')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index bbbeb08..90e7cce 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 _0xbf0e=['ContactId','ListId','select','NOW()','toString','from','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?','onlyIfOpen','into','cm_hopper','cm_contacts','COALESCE(phone,\x27\x27)','all','removeLists','addBlackLists','cm_hopper_black','push','removeBlackLists','html-pdf','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','Campaign','model','keys','query','intersection','attributes','nolimit','limit','order','sort','where','filters','filter','merge','map','key','field','includeAll','include','findAll','rows','show','params','fields','length','options','find','catch','create','body','user','UserProfileSection','userProfileId','clone','rawAttributes','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','autoAssociation','name','CmHopper','hasOwnProperty','pick','findOne','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt'];(function(_0x156cb1,_0x48331b){var _0xa50017=function(_0x570c82){while(--_0x570c82){_0x156cb1['push'](_0x156cb1['shift']());}};_0xa50017(++_0x48331b);}(_0xbf0e,0x199));var _0xebf0=function(_0x547160,_0x537a78){_0x547160=_0x547160-0x0;var _0x3f7b71=_0xbf0e[_0x547160];return _0x3f7b71;};'use strict';var pdf=require(_0xebf0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xebf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebf0('0x2'));var rp=require('request-promise');var moment=require(_0xebf0('0x3'));var BPromise=require(_0xebf0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xebf0('0x5'));var csv=require(_0xebf0('0x6'));var ejs=require(_0xebf0('0x7'));var fs=require('fs');var _=require(_0xebf0('0x8'));var squel=require(_0xebf0('0x9'));var crypto=require(_0xebf0('0xa'));var jsforce=require(_0xebf0('0xb'));var deskjs=require(_0xebf0('0xc'));var toCsv=require(_0xebf0('0x6'));var querystring=require(_0xebf0('0xd'));var Papa=require(_0xebf0('0xe'));var Redis=require(_0xebf0('0xf'));var authService=require(_0xebf0('0x10'));var qs=require(_0xebf0('0x11'));var hardwareService=require(_0xebf0('0x12'));var logger=require('../../config/logger')(_0xebf0('0x13'));var utils=require(_0xebf0('0x14'));var config=require('../../config/environment');var db=require(_0xebf0('0x15'))['db'];function respondWithStatusCode(_0x1062e8,_0x197b84){_0x197b84=_0x197b84||0xcc;return function(_0x4b4d90){if(_0x4b4d90){return _0x1062e8[_0xebf0('0x16')](_0x197b84);}return _0x1062e8[_0xebf0('0x17')](_0x197b84)[_0xebf0('0x18')]();};}function respondWithResult(_0x5447c3,_0x2360c5){_0x2360c5=_0x2360c5||0xc8;return function(_0x14f92f){if(_0x14f92f){return _0x5447c3[_0xebf0('0x17')](_0x2360c5)['json'](_0x14f92f);}};}function respondWithFilteredResult(_0x5a4df6,_0x5447f7){return function(_0x261d51){if(_0x261d51){var _0x55c4f2=_0x261d51[_0xebf0('0x19')],_0x5ed901=_0x5447f7['offset'],_0x314af4=_0x5447f7[_0xebf0('0x1a')]+_0x5447f7['limit'],_0x53a4ba;if(_0x314af4>=_0x55c4f2){_0x314af4=_0x55c4f2;_0x53a4ba=0xc8;}else{_0x53a4ba=0xce;}_0x5a4df6[_0xebf0('0x17')](_0x53a4ba);return _0x5a4df6['set'](_0xebf0('0x1b'),_0x5ed901+'-'+_0x314af4+'/'+_0x55c4f2)[_0xebf0('0x1c')](_0x261d51);}return null;};}function patchUpdates(_0xa37b1f){return function(_0x1aafe0){try{jsonpatch[_0xebf0('0x1d')](_0x1aafe0,_0xa37b1f,!![]);}catch(_0x1f7fe6){return BPromise['reject'](_0x1f7fe6);}return _0x1aafe0[_0xebf0('0x1e')]();};}function saveUpdates(_0x327d58,_0x496021){return function(_0x32c523){if(_0x32c523){return _0x32c523[_0xebf0('0x1f')](_0x327d58)[_0xebf0('0x20')](function(_0x4cccb6){return _0x4cccb6;});}return null;};}function removeEntity(_0x344fa0,_0x149d87){return function(_0x41340f){if(_0x41340f){return _0x41340f[_0xebf0('0x21')]()[_0xebf0('0x20')](function(){var _0x43301a=_0x41340f[_0xebf0('0x22')]({'plain':!![]});var _0x2324c1='IvrCampaigns';return db[_0xebf0('0x23')][_0xebf0('0x21')]({'where':{'type':_0x2324c1,'resourceId':_0x43301a['id']}})[_0xebf0('0x20')](function(){return _0x41340f;});})[_0xebf0('0x20')](function(){_0x344fa0['status'](0xcc)[_0xebf0('0x18')]();});}};}function handleEntityNotFound(_0x148ba0,_0x20d031){return function(_0x4a43c3){if(!_0x4a43c3){_0x148ba0[_0xebf0('0x16')](0x194);}return _0x4a43c3;};}function handleError(_0x532525,_0x4e4445){_0x4e4445=_0x4e4445||0x1f4;return function(_0x439617){logger[_0xebf0('0x24')](_0x439617[_0xebf0('0x25')]);if(_0x439617['name']){delete _0x439617['name'];}_0x532525[_0xebf0('0x17')](_0x4e4445)[_0xebf0('0x26')](_0x439617);};}exports[_0xebf0('0x27')]=function(_0x28e33c,_0x6d0b68){var _0x30f727={},_0xe21403={},_0x2e1b91={'count':0x0,'rows':[]};var _0x48e4d4=db[_0xebf0('0x28')]['rawAttributes'];_0xe21403[_0xebf0('0x29')]=_[_0xebf0('0x2a')](_0x48e4d4);_0xe21403[_0xebf0('0x2b')]=_['keys'](_0x28e33c[_0xebf0('0x2b')]);_0xe21403['filters']=_[_0xebf0('0x2c')](_0xe21403[_0xebf0('0x29')],_0xe21403['query']);_0x30f727[_0xebf0('0x2d')]=_[_0xebf0('0x2c')](_0xe21403[_0xebf0('0x29')],qs['fields'](_0x28e33c['query']['fields']));_0x30f727['attributes']=_0x30f727['attributes']['length']?_0x30f727[_0xebf0('0x2d')]:_0xe21403[_0xebf0('0x29')];if(!_0x28e33c[_0xebf0('0x2b')]['hasOwnProperty'](_0xebf0('0x2e'))){_0x30f727[_0xebf0('0x2f')]=qs['limit'](_0x28e33c['query'][_0xebf0('0x2f')]);_0x30f727[_0xebf0('0x1a')]=qs[_0xebf0('0x1a')](_0x28e33c[_0xebf0('0x2b')][_0xebf0('0x1a')]);}_0x30f727[_0xebf0('0x30')]=qs[_0xebf0('0x31')](_0x28e33c[_0xebf0('0x2b')][_0xebf0('0x31')]);_0x30f727[_0xebf0('0x32')]=qs[_0xebf0('0x33')](_['pick'](_0x28e33c[_0xebf0('0x2b')],_0xe21403['filters']));if(_0x28e33c[_0xebf0('0x2b')][_0xebf0('0x34')]){_0x30f727[_0xebf0('0x32')]=_[_0xebf0('0x35')](_0x30f727[_0xebf0('0x32')],{'$or':_[_0xebf0('0x36')](_0x48e4d4,function(_0x4bf677){if(_0x4bf677['type'][_0xebf0('0x37')]!=='VIRTUAL'){var _0x48beab={};_0x48beab[_0x4bf677[_0xebf0('0x38')]]={'$like':'%'+_0x28e33c[_0xebf0('0x2b')][_0xebf0('0x34')]+'%'};return _0x48beab;}})});}_0x30f727=_[_0xebf0('0x35')]({},_0x30f727,_0x28e33c['options']);var _0x39e290={'where':_0x30f727[_0xebf0('0x32')]};return db[_0xebf0('0x28')][_0xebf0('0x19')](_0x39e290)[_0xebf0('0x20')](function(_0x13de58){_0x2e1b91[_0xebf0('0x19')]=_0x13de58;if(_0x28e33c[_0xebf0('0x2b')][_0xebf0('0x39')]){_0x30f727[_0xebf0('0x3a')]=[{'all':!![]}];}return db[_0xebf0('0x28')][_0xebf0('0x3b')](_0x30f727);})[_0xebf0('0x20')](function(_0x1090cc){_0x2e1b91[_0xebf0('0x3c')]=_0x1090cc;return _0x2e1b91;})['then'](respondWithFilteredResult(_0x6d0b68,_0x30f727))['catch'](handleError(_0x6d0b68,null));};exports[_0xebf0('0x3d')]=function(_0x507b81,_0x3b2595){var _0x5cc88d={'raw':![],'where':{'id':_0x507b81[_0xebf0('0x3e')]['id']}},_0x4d8fe7={};_0x4d8fe7[_0xebf0('0x29')]=_[_0xebf0('0x2a')](db[_0xebf0('0x28')]['rawAttributes']);_0x4d8fe7['query']=_[_0xebf0('0x2a')](_0x507b81['query']);_0x4d8fe7[_0xebf0('0x33')]=_[_0xebf0('0x2c')](_0x4d8fe7[_0xebf0('0x29')],_0x4d8fe7['query']);_0x5cc88d[_0xebf0('0x2d')]=_['intersection'](_0x4d8fe7[_0xebf0('0x29')],qs[_0xebf0('0x3f')](_0x507b81[_0xebf0('0x2b')][_0xebf0('0x3f')]));_0x5cc88d[_0xebf0('0x2d')]=_0x5cc88d[_0xebf0('0x2d')][_0xebf0('0x40')]?_0x5cc88d[_0xebf0('0x2d')]:_0x4d8fe7[_0xebf0('0x29')];if(_0x507b81[_0xebf0('0x2b')][_0xebf0('0x39')]){_0x5cc88d[_0xebf0('0x3a')]=[{'all':!![]}];}_0x5cc88d=_[_0xebf0('0x35')]({},_0x5cc88d,_0x507b81[_0xebf0('0x41')]);return db[_0xebf0('0x28')][_0xebf0('0x42')](_0x5cc88d)['then'](handleEntityNotFound(_0x3b2595,null))['then'](respondWithResult(_0x3b2595,null))[_0xebf0('0x43')](handleError(_0x3b2595,null));};exports[_0xebf0('0x44')]=function(_0x348fee,_0x552d5e){return db[_0xebf0('0x28')][_0xebf0('0x44')](_0x348fee[_0xebf0('0x45')],{})['then'](function(_0x134209){var _0x2cea6f=_0x348fee[_0xebf0('0x46')][_0xebf0('0x22')]({'plain':!![]});if(!_0x2cea6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cea6f['role']===_0xebf0('0x46')){var _0x554513=_0x134209[_0xebf0('0x22')]({'plain':!![]});var _0x5ac702='IvrCampaigns';return db[_0xebf0('0x47')][_0xebf0('0x42')]({'where':{'name':_0x5ac702,'userProfileId':_0x2cea6f[_0xebf0('0x48')]},'raw':!![]})[_0xebf0('0x20')](function(_0x4d8ebe){if(_0x4d8ebe&&_0x4d8ebe['autoAssociation']===0x0){return db[_0xebf0('0x23')][_0xebf0('0x44')]({'name':_0x554513['name'],'resourceId':_0x554513['id'],'type':_0x4d8ebe['name'],'sectionId':_0x4d8ebe['id']},{})[_0xebf0('0x20')](function(){return _0x134209;});}else{return _0x134209;}})[_0xebf0('0x43')](function(_0x45bd4e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45bd4e);throw _0x45bd4e;});}return _0x134209;})[_0xebf0('0x20')](respondWithResult(_0x552d5e,0xc9))[_0xebf0('0x43')](handleError(_0x552d5e,null));};exports[_0xebf0('0x49')]=function(_0x11555a,_0x4f8e2d){var _0x276d0a={'raw':![],'where':{'id':_0x11555a[_0xebf0('0x3e')]['id']}},_0x57177b={};_0x57177b['model']=_[_0xebf0('0x2a')](db['Campaign'][_0xebf0('0x4a')]);_0x276d0a[_0xebf0('0x2d')]=_[_0xebf0('0x2c')](_0x57177b[_0xebf0('0x29')],qs[_0xebf0('0x3f')](_0x11555a['query'][_0xebf0('0x3f')]));_0x276d0a['attributes']=_0x276d0a[_0xebf0('0x2d')][_0xebf0('0x40')]?_0x276d0a[_0xebf0('0x2d')]:_0x57177b[_0xebf0('0x29')];if(_0x11555a[_0xebf0('0x2b')][_0xebf0('0x39')]){_0x276d0a['include']=[{'all':!![]}];}_0x276d0a=_[_0xebf0('0x35')]({},_0x276d0a,_0x11555a['options']);return db[_0xebf0('0x28')][_0xebf0('0x42')](_0x276d0a)['then'](handleEntityNotFound(_0x4f8e2d,null))[_0xebf0('0x20')](function(_0x249f17){if(_0x249f17){var _0x4a0208=_0x249f17[_0xebf0('0x22')]({'plain':!![]});_0x4a0208=qs[_0xebf0('0x4b')](_0x4a0208,['id','createdAt',_0xebf0('0x4c')]);_0x11555a[_0xebf0('0x45')]=_[_0xebf0('0x4b')](_0x11555a[_0xebf0('0x45')],['id',_0xebf0('0x4d'),_0xebf0('0x4c')]);return db[_0xebf0('0x28')][_0xebf0('0x44')](_[_0xebf0('0x35')](_0x4a0208,_0x11555a[_0xebf0('0x45')]),{'include':_0x11555a[_0xebf0('0x2b')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x536e72){var _0x2446b9=_0x11555a[_0xebf0('0x46')]['get']({'plain':!![]});if(!_0x2446b9)throw new Error(_0xebf0('0x4e'));if(_0x2446b9[_0xebf0('0x4f')]===_0xebf0('0x46')){var _0x4a3226=_0x536e72[_0xebf0('0x22')]({'plain':!![]});var _0x3cc890=_0xebf0('0x50');return db[_0xebf0('0x47')][_0xebf0('0x42')]({'where':{'name':_0x3cc890,'userProfileId':_0x2446b9['userProfileId']},'raw':!![]})['then'](function(_0x40ff28){if(_0x40ff28&&_0x40ff28[_0xebf0('0x51')]===0x0){return db[_0xebf0('0x23')]['create']({'name':_0x4a3226[_0xebf0('0x52')],'resourceId':_0x4a3226['id'],'type':_0x40ff28[_0xebf0('0x52')],'sectionId':_0x40ff28['id']},{})['then'](function(){return _0x536e72;});}else{return _0x536e72;}})[_0xebf0('0x43')](function(_0x3a95c3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a95c3);throw _0x3a95c3;});}return _0x536e72;});}})[_0xebf0('0x20')](respondWithResult(_0x4f8e2d,0xc9))[_0xebf0('0x43')](handleError(_0x4f8e2d,null));};exports[_0xebf0('0x1f')]=function(_0x3af386,_0x16f1e9){if(_0x3af386[_0xebf0('0x45')]['id']){delete _0x3af386[_0xebf0('0x45')]['id'];}return db[_0xebf0('0x28')]['find']({'where':{'id':_0x3af386[_0xebf0('0x3e')]['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x16f1e9,null))['then'](saveUpdates(_0x3af386[_0xebf0('0x45')],null))[_0xebf0('0x20')](respondWithResult(_0x16f1e9,null))[_0xebf0('0x43')](handleError(_0x16f1e9,null));};exports[_0xebf0('0x21')]=function(_0x273326,_0x19532b){return db[_0xebf0('0x28')][_0xebf0('0x42')]({'where':{'id':_0x273326['params']['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x19532b,null))['then'](removeEntity(_0x19532b,null))[_0xebf0('0x43')](handleError(_0x19532b,null));};exports['getHoppers']=function(_0x4a8b7b,_0x32e44c,_0x5d49c6){var _0x23fc79={'raw':!![],'where':{}};var _0x158352={};var _0x4e2e5d={'count':0x0,'rows':[]};return db[_0xebf0('0x28')]['findOne']({'where':{'id':_0x4a8b7b['params']['id']}})['then'](handleEntityNotFound(_0x32e44c,null))[_0xebf0('0x20')](function(_0x51ea63){if(_0x51ea63){_0x158352[_0xebf0('0x29')]=_['keys'](db[_0xebf0('0x53')][_0xebf0('0x4a')]);_0x158352['query']=_[_0xebf0('0x2a')](_0x4a8b7b[_0xebf0('0x2b')]);_0x158352[_0xebf0('0x33')]=_[_0xebf0('0x2c')](_0x158352[_0xebf0('0x29')],_0x158352['query']);_0x23fc79['attributes']=_[_0xebf0('0x2c')](_0x158352[_0xebf0('0x29')],qs[_0xebf0('0x3f')](_0x4a8b7b['query']['fields']));_0x23fc79[_0xebf0('0x2d')]=_0x23fc79['attributes'][_0xebf0('0x40')]?_0x23fc79['attributes']:_0x158352[_0xebf0('0x29')];if(!_0x4a8b7b['query'][_0xebf0('0x54')](_0xebf0('0x2e'))){_0x23fc79['limit']=qs[_0xebf0('0x2f')](_0x4a8b7b[_0xebf0('0x2b')]['limit']);_0x23fc79['offset']=qs[_0xebf0('0x1a')](_0x4a8b7b[_0xebf0('0x2b')][_0xebf0('0x1a')]);}_0x23fc79[_0xebf0('0x30')]=qs[_0xebf0('0x31')](_0x4a8b7b[_0xebf0('0x2b')][_0xebf0('0x31')]);_0x23fc79[_0xebf0('0x32')]=qs['filters'](_[_0xebf0('0x55')](_0x4a8b7b[_0xebf0('0x2b')],_0x158352[_0xebf0('0x33')]));_0x23fc79['where']['CampaignId']=_0x51ea63['id'];if(_0x4a8b7b[_0xebf0('0x2b')][_0xebf0('0x34')]){_0x23fc79[_0xebf0('0x32')]=_[_0xebf0('0x35')](_0x23fc79[_0xebf0('0x32')],{'$or':_['map'](_0x23fc79['attributes'],function(_0x4ffaa3){var _0x5ea9dc={};_0x5ea9dc[_0x4ffaa3]={'$like':'%'+_0x4a8b7b[_0xebf0('0x2b')][_0xebf0('0x34')]+'%'};return _0x5ea9dc;})});}_0x23fc79=_['merge']({},_0x23fc79,_0x4a8b7b[_0xebf0('0x41')]);return db['CmHopper']['count']({'where':_0x23fc79[_0xebf0('0x32')]})[_0xebf0('0x20')](function(_0x4a66ab){_0x4e2e5d[_0xebf0('0x19')]=_0x4a66ab;if(_0x4a8b7b[_0xebf0('0x2b')][_0xebf0('0x39')]){_0x23fc79[_0xebf0('0x3a')]=[{'all':!![]}];}return db[_0xebf0('0x53')][_0xebf0('0x3b')](_0x23fc79);})[_0xebf0('0x20')](function(_0x445e23){_0x4e2e5d[_0xebf0('0x3c')]=_0x445e23;return _0x4e2e5d;});}})[_0xebf0('0x20')](respondWithFilteredResult(_0x32e44c,_0x23fc79))[_0xebf0('0x43')](handleError(_0x32e44c,null));};exports['getHopperHistories']=function(_0x6ec7f6,_0x1864ea,_0x25d8ec){var _0x486f07={'raw':!![],'where':{}};var _0x2bcf5d={};var _0x37a4fd={'count':0x0,'rows':[]};return db['Campaign'][_0xebf0('0x56')]({'where':{'id':_0x6ec7f6[_0xebf0('0x3e')]['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x1864ea,null))['then'](function(_0x312659){if(_0x312659){_0x2bcf5d['model']=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x2bcf5d[_0xebf0('0x2b')]=_[_0xebf0('0x2a')](_0x6ec7f6[_0xebf0('0x2b')]);_0x2bcf5d[_0xebf0('0x33')]=_[_0xebf0('0x2c')](_0x2bcf5d['model'],_0x2bcf5d[_0xebf0('0x2b')]);_0x486f07[_0xebf0('0x2d')]=_[_0xebf0('0x2c')](_0x2bcf5d[_0xebf0('0x29')],qs[_0xebf0('0x3f')](_0x6ec7f6[_0xebf0('0x2b')]['fields']));_0x486f07[_0xebf0('0x2d')]=_0x486f07[_0xebf0('0x2d')][_0xebf0('0x40')]?_0x486f07[_0xebf0('0x2d')]:_0x2bcf5d[_0xebf0('0x29')];if(!_0x6ec7f6['query']['hasOwnProperty'](_0xebf0('0x2e'))){_0x486f07[_0xebf0('0x2f')]=qs[_0xebf0('0x2f')](_0x6ec7f6[_0xebf0('0x2b')][_0xebf0('0x2f')]);_0x486f07[_0xebf0('0x1a')]=qs['offset'](_0x6ec7f6[_0xebf0('0x2b')][_0xebf0('0x1a')]);}_0x486f07['order']=qs[_0xebf0('0x31')](_0x6ec7f6[_0xebf0('0x2b')][_0xebf0('0x31')]);_0x486f07[_0xebf0('0x32')]=qs[_0xebf0('0x33')](_[_0xebf0('0x55')](_0x6ec7f6[_0xebf0('0x2b')],_0x2bcf5d[_0xebf0('0x33')]));_0x486f07[_0xebf0('0x32')][_0xebf0('0x57')]=_0x312659['id'];if(_0x6ec7f6[_0xebf0('0x2b')][_0xebf0('0x34')]){_0x486f07[_0xebf0('0x32')]=_[_0xebf0('0x35')](_0x486f07[_0xebf0('0x32')],{'$or':_[_0xebf0('0x36')](_0x486f07[_0xebf0('0x2d')],function(_0x34a01a){var _0x14b7fe={};_0x14b7fe[_0x34a01a]={'$like':'%'+_0x6ec7f6[_0xebf0('0x2b')][_0xebf0('0x34')]+'%'};return _0x14b7fe;})});}_0x486f07=_['merge']({},_0x486f07,_0x6ec7f6['options']);return db[_0xebf0('0x58')][_0xebf0('0x19')]({'where':_0x486f07[_0xebf0('0x32')]})[_0xebf0('0x20')](function(_0x59c847){_0x37a4fd[_0xebf0('0x19')]=_0x59c847;if(_0x6ec7f6['query'][_0xebf0('0x39')]){_0x486f07['include']=[{'all':!![]}];}return db[_0xebf0('0x58')]['findAll'](_0x486f07);})[_0xebf0('0x20')](function(_0xf1d58f){_0x37a4fd[_0xebf0('0x3c')]=_0xf1d58f;return _0x37a4fd;});}})[_0xebf0('0x20')](respondWithFilteredResult(_0x1864ea,_0x486f07))['catch'](handleError(_0x1864ea,null));};exports['getHopperFinals']=function(_0x249abb,_0x42eefa,_0x5ce125){var _0x4be96d={'raw':!![],'where':{}};var _0x24078e={};var _0x2240a4={'count':0x0,'rows':[]};return db[_0xebf0('0x28')][_0xebf0('0x56')]({'where':{'id':_0x249abb[_0xebf0('0x3e')]['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x42eefa,null))[_0xebf0('0x20')](function(_0x34c5d3){if(_0x34c5d3){_0x24078e[_0xebf0('0x29')]=_[_0xebf0('0x2a')](db[_0xebf0('0x59')][_0xebf0('0x4a')]);_0x24078e[_0xebf0('0x2b')]=_['keys'](_0x249abb[_0xebf0('0x2b')]);_0x24078e[_0xebf0('0x33')]=_[_0xebf0('0x2c')](_0x24078e[_0xebf0('0x29')],_0x24078e[_0xebf0('0x2b')]);_0x4be96d['attributes']=_['intersection'](_0x24078e[_0xebf0('0x29')],qs[_0xebf0('0x3f')](_0x249abb['query'][_0xebf0('0x3f')]));_0x4be96d[_0xebf0('0x2d')]=_0x4be96d[_0xebf0('0x2d')]['length']?_0x4be96d[_0xebf0('0x2d')]:_0x24078e[_0xebf0('0x29')];if(!_0x249abb[_0xebf0('0x2b')][_0xebf0('0x54')](_0xebf0('0x2e'))){_0x4be96d[_0xebf0('0x2f')]=qs[_0xebf0('0x2f')](_0x249abb[_0xebf0('0x2b')][_0xebf0('0x2f')]);_0x4be96d[_0xebf0('0x1a')]=qs[_0xebf0('0x1a')](_0x249abb[_0xebf0('0x2b')][_0xebf0('0x1a')]);}_0x4be96d[_0xebf0('0x30')]=qs[_0xebf0('0x31')](_0x249abb[_0xebf0('0x2b')]['sort']);_0x4be96d[_0xebf0('0x32')]=qs[_0xebf0('0x33')](_['pick'](_0x249abb[_0xebf0('0x2b')],_0x24078e[_0xebf0('0x33')]));_0x4be96d[_0xebf0('0x32')]['CampaignId']=_0x34c5d3['id'];if(_0x249abb[_0xebf0('0x2b')][_0xebf0('0x34')]){_0x4be96d[_0xebf0('0x32')]=_[_0xebf0('0x35')](_0x4be96d[_0xebf0('0x32')],{'$or':_[_0xebf0('0x36')](_0x4be96d[_0xebf0('0x2d')],function(_0xfdcdd3){var _0x27a0d9={};_0x27a0d9[_0xfdcdd3]={'$like':'%'+_0x249abb[_0xebf0('0x2b')][_0xebf0('0x34')]+'%'};return _0x27a0d9;})});}_0x4be96d=_[_0xebf0('0x35')]({},_0x4be96d,_0x249abb['options']);return db[_0xebf0('0x59')][_0xebf0('0x19')]({'where':_0x4be96d[_0xebf0('0x32')]})['then'](function(_0x2e4b1a){_0x2240a4[_0xebf0('0x19')]=_0x2e4b1a;if(_0x249abb[_0xebf0('0x2b')]['includeAll']){_0x4be96d[_0xebf0('0x3a')]=[{'all':!![]}];}return db[_0xebf0('0x59')]['findAll'](_0x4be96d);})['then'](function(_0x4ada83){_0x2240a4[_0xebf0('0x3c')]=_0x4ada83;return _0x2240a4;});}})[_0xebf0('0x20')](respondWithFilteredResult(_0x42eefa,_0x4be96d))[_0xebf0('0x43')](handleError(_0x42eefa,null));};exports[_0xebf0('0x5a')]=function(_0x317422,_0x569f2e,_0x55c506){var _0x54a19a={'raw':!![],'where':{}};var _0x289ee6={};var _0x4c1957={'count':0x0,'rows':[]};return db['Campaign'][_0xebf0('0x56')]({'where':{'id':_0x317422[_0xebf0('0x3e')]['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x569f2e,null))[_0xebf0('0x20')](function(_0x45e374){if(_0x45e374){_0x289ee6[_0xebf0('0x29')]=_[_0xebf0('0x2a')](db[_0xebf0('0x5b')][_0xebf0('0x4a')]);_0x289ee6[_0xebf0('0x2b')]=_['keys'](_0x317422[_0xebf0('0x2b')]);_0x289ee6['filters']=_[_0xebf0('0x2c')](_0x289ee6[_0xebf0('0x29')],_0x289ee6[_0xebf0('0x2b')]);_0x54a19a['attributes']=_[_0xebf0('0x2c')](_0x289ee6[_0xebf0('0x29')],qs[_0xebf0('0x3f')](_0x317422[_0xebf0('0x2b')][_0xebf0('0x3f')]));_0x54a19a[_0xebf0('0x2d')]=_0x54a19a['attributes'][_0xebf0('0x40')]?_0x54a19a[_0xebf0('0x2d')]:_0x289ee6[_0xebf0('0x29')];if(!_0x317422['query'][_0xebf0('0x54')](_0xebf0('0x2e'))){_0x54a19a[_0xebf0('0x2f')]=qs['limit'](_0x317422[_0xebf0('0x2b')][_0xebf0('0x2f')]);_0x54a19a['offset']=qs['offset'](_0x317422[_0xebf0('0x2b')][_0xebf0('0x1a')]);}_0x54a19a[_0xebf0('0x30')]=qs[_0xebf0('0x31')](_0x317422['query'][_0xebf0('0x31')]);_0x54a19a['where']=qs[_0xebf0('0x33')](_[_0xebf0('0x55')](_0x317422['query'],_0x289ee6[_0xebf0('0x33')]));_0x54a19a[_0xebf0('0x32')][_0xebf0('0x57')]=_0x45e374['id'];if(_0x317422[_0xebf0('0x2b')][_0xebf0('0x34')]){_0x54a19a[_0xebf0('0x32')]=_[_0xebf0('0x35')](_0x54a19a['where'],{'$or':_[_0xebf0('0x36')](_0x54a19a['attributes'],function(_0x94f0c0){var _0x26bd1b={};_0x26bd1b[_0x94f0c0]={'$like':'%'+_0x317422['query']['filter']+'%'};return _0x26bd1b;})});}_0x54a19a=_[_0xebf0('0x35')]({},_0x54a19a,_0x317422['options']);return db[_0xebf0('0x5b')][_0xebf0('0x19')]({'where':_0x54a19a[_0xebf0('0x32')]})[_0xebf0('0x20')](function(_0x56e4cc){_0x4c1957[_0xebf0('0x19')]=_0x56e4cc;if(_0x317422[_0xebf0('0x2b')]['includeAll']){_0x54a19a[_0xebf0('0x3a')]=[{'all':!![]}];}return db[_0xebf0('0x5b')][_0xebf0('0x3b')](_0x54a19a);})['then'](function(_0xf5fc02){_0x4c1957[_0xebf0('0x3c')]=_0xf5fc02;return _0x4c1957;});}})[_0xebf0('0x20')](respondWithFilteredResult(_0x569f2e,_0x54a19a))[_0xebf0('0x43')](handleError(_0x569f2e,null));};exports['getLists']=function(_0x26f3e0,_0x18402a,_0x4d294a){var _0x5c10c6={};var _0x3d34a9={};var _0x14e860;var _0x30341b;return db['Campaign'][_0xebf0('0x56')]({'where':{'id':_0x26f3e0[_0xebf0('0x3e')]['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x18402a,null))[_0xebf0('0x20')](function(_0x5601c6){if(_0x5601c6){_0x14e860=_0x5601c6;_0x3d34a9[_0xebf0('0x29')]=_['keys'](db[_0xebf0('0x5c')][_0xebf0('0x4a')]);_0x3d34a9['query']=_[_0xebf0('0x2a')](_0x26f3e0[_0xebf0('0x2b')]);_0x3d34a9[_0xebf0('0x33')]=_['intersection'](_0x3d34a9[_0xebf0('0x29')],_0x3d34a9[_0xebf0('0x2b')]);_0x5c10c6[_0xebf0('0x2d')]=_[_0xebf0('0x2c')](_0x3d34a9[_0xebf0('0x29')],qs[_0xebf0('0x3f')](_0x26f3e0[_0xebf0('0x2b')][_0xebf0('0x3f')]));_0x5c10c6[_0xebf0('0x2d')]=_0x5c10c6[_0xebf0('0x2d')]['length']?_0x5c10c6[_0xebf0('0x2d')]:_0x3d34a9['model'];_0x5c10c6['order']=qs[_0xebf0('0x31')](_0x26f3e0['query'][_0xebf0('0x31')]);_0x5c10c6['where']=qs[_0xebf0('0x33')](_[_0xebf0('0x55')](_0x26f3e0['query'],_0x3d34a9[_0xebf0('0x33')]));if(_0x26f3e0[_0xebf0('0x2b')][_0xebf0('0x34')]){_0x5c10c6['where']=_[_0xebf0('0x35')](_0x5c10c6['where'],{'$or':_[_0xebf0('0x36')](_0x5c10c6[_0xebf0('0x2d')],function(_0x2eb665){var _0x11d47f={};_0x11d47f[_0x2eb665]={'$like':'%'+_0x26f3e0['query'][_0xebf0('0x34')]+'%'};return _0x11d47f;})});}_0x5c10c6=_[_0xebf0('0x35')]({},_0x5c10c6,_0x26f3e0['options']);return _0x14e860[_0xebf0('0x5d')](_0x5c10c6);}})[_0xebf0('0x20')](function(_0x205384){if(_0x205384){_0x30341b=_0x205384[_0xebf0('0x40')];if(!_0x26f3e0['query']['hasOwnProperty'](_0xebf0('0x2e'))){_0x5c10c6[_0xebf0('0x2f')]=qs[_0xebf0('0x2f')](_0x26f3e0[_0xebf0('0x2b')]['limit']);_0x5c10c6[_0xebf0('0x1a')]=qs[_0xebf0('0x1a')](_0x26f3e0[_0xebf0('0x2b')][_0xebf0('0x1a')]);}return _0x14e860[_0xebf0('0x5d')](_0x5c10c6);}})['then'](function(_0x223a25){if(_0x223a25){return _0x223a25?{'count':_0x30341b,'rows':_0x223a25}:null;}})[_0xebf0('0x20')](respondWithResult(_0x18402a,null))['catch'](handleError(_0x18402a,null));};exports[_0xebf0('0x5e')]=function(_0x2c6541,_0x24deff,_0x418b4f){var _0x20b9c2,_0x2ebaf4;return db[_0xebf0('0x28')][_0xebf0('0x42')]({'where':{'id':_0x2c6541['params']['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x24deff,null))[_0xebf0('0x20')](function(_0x2f4d30){if(_0x2f4d30){_0x2ebaf4=_0x2f4d30;return _0x2f4d30[_0xebf0('0x5e')](_0x2c6541[_0xebf0('0x45')][_0xebf0('0x5f')],_[_0xebf0('0x4b')](_0x2c6541[_0xebf0('0x45')],[_0xebf0('0x5f'),'id'])||{});}return null;})[_0xebf0('0x60')](function(_0x5c016a){var _0x6897b6;_0x20b9c2=_0x5c016a||[];var _0x402787=[];if(_0x5c016a){for(var _0x3d700c=0x0;_0x3d700c<_0x5c016a[_0xebf0('0x40')];_0x3d700c+=0x1){var _0x3218d6=_0x5c016a[_0x3d700c][_0xebf0('0x22')]({'plain':!![]});_0x2ebaf4[_0xebf0('0x61')]=_0x2c6541[_0xebf0('0x45')]['dialCheckDuplicateType']?_0x2c6541[_0xebf0('0x45')]['dialCheckDuplicateType']:_0x2ebaf4[_0xebf0('0x61')];switch(_0x2ebaf4[_0xebf0('0x61')]){case _0xebf0('0x62'):_0x6897b6=squel[_0xebf0('0x63')]()['into']('cm_hopper')[_0xebf0('0x64')]([_0xebf0('0x65'),_0xebf0('0x66'),_0xebf0('0x67'),_0xebf0('0x68'),_0xebf0('0x57'),_0xebf0('0x4d'),_0xebf0('0x4c')],squel[_0xebf0('0x69')]()[_0xebf0('0x38')](_0xebf0('0x65'),_0xebf0('0x65'))[_0xebf0('0x38')](_0xebf0('0x6a'),_0xebf0('0x66'))[_0xebf0('0x38')]('id',_0xebf0('0x67'))['field'](_0x3218d6['CmListId'][_0xebf0('0x6b')](),_0xebf0('0x68'))['field'](_0x2c6541[_0xebf0('0x3e')]['id'][_0xebf0('0x6b')](),_0xebf0('0x57'))[_0xebf0('0x38')]('NOW()','createdAt')[_0xebf0('0x38')](_0xebf0('0x6a'),_0xebf0('0x4c'))[_0xebf0('0x6c')]('cm_contacts')[_0xebf0('0x32')](_0xebf0('0x6d'))[_0xebf0('0x32')](_0xebf0('0x6e'),_0x3218d6[_0xebf0('0x6f')][_0xebf0('0x6b')]())[_0xebf0('0x32')](_0xebf0('0x70'))['where'](_0xebf0('0x71'),squel['select']()[_0xebf0('0x38')](_0xebf0('0x72'))['from'](_0xebf0('0x73'))[_0xebf0('0x32')](_0xebf0('0x74'),_0x2c6541[_0xebf0('0x3e')]['id'][_0xebf0('0x6b')]()))[_0xebf0('0x32')](_0xebf0('0x71'),squel[_0xebf0('0x69')]()[_0xebf0('0x38')]('COALESCE(phone,\x27\x27)')[_0xebf0('0x6c')]('cm_hopper')['where'](_0xebf0('0x74'),_0x2c6541['params']['id'][_0xebf0('0x6b')]())))[_0xebf0('0x6b')]();break;case _0xebf0('0x75'):_0x6897b6=squel[_0xebf0('0x63')]()[_0xebf0('0x76')](_0xebf0('0x77'))['fromQuery']([_0xebf0('0x65'),_0xebf0('0x66'),_0xebf0('0x67'),_0xebf0('0x68'),_0xebf0('0x57'),_0xebf0('0x4d'),_0xebf0('0x4c')],squel[_0xebf0('0x69')]()[_0xebf0('0x38')](_0xebf0('0x65'),_0xebf0('0x65'))[_0xebf0('0x38')](_0xebf0('0x6a'),_0xebf0('0x66'))[_0xebf0('0x38')]('id','ContactId')['field'](_0x3218d6[_0xebf0('0x6f')][_0xebf0('0x6b')](),'ListId')['field'](_0x2c6541[_0xebf0('0x3e')]['id'][_0xebf0('0x6b')](),'CampaignId')[_0xebf0('0x38')](_0xebf0('0x6a'),_0xebf0('0x4d'))['field'](_0xebf0('0x6a'),_0xebf0('0x4c'))[_0xebf0('0x6c')](_0xebf0('0x78'))['where'](_0xebf0('0x6d'))['where'](_0xebf0('0x6e'),_0x3218d6[_0xebf0('0x6f')][_0xebf0('0x6b')]())[_0xebf0('0x32')]('phone\x20IS\x20NOT\x20NULL')[_0xebf0('0x32')](_0xebf0('0x71'),squel[_0xebf0('0x69')]()['field'](_0xebf0('0x79'))[_0xebf0('0x6c')]('cm_hopper')['where'](_0xebf0('0x74'),_0x2c6541[_0xebf0('0x3e')]['id'][_0xebf0('0x6b')]())))[_0xebf0('0x6b')]();break;default:_0x6897b6=squel[_0xebf0('0x63')]()[_0xebf0('0x76')](_0xebf0('0x77'))[_0xebf0('0x64')]([_0xebf0('0x65'),_0xebf0('0x66'),_0xebf0('0x67'),_0xebf0('0x68'),_0xebf0('0x57'),_0xebf0('0x4d'),_0xebf0('0x4c')],squel[_0xebf0('0x69')]()[_0xebf0('0x38')](_0xebf0('0x65'),_0xebf0('0x65'))[_0xebf0('0x38')]('NOW()',_0xebf0('0x66'))[_0xebf0('0x38')]('id',_0xebf0('0x67'))[_0xebf0('0x38')](_0x3218d6[_0xebf0('0x6f')][_0xebf0('0x6b')](),_0xebf0('0x68'))[_0xebf0('0x38')](_0x2c6541['params']['id'][_0xebf0('0x6b')](),'CampaignId')[_0xebf0('0x38')](_0xebf0('0x6a'),'createdAt')[_0xebf0('0x38')](_0xebf0('0x6a'),_0xebf0('0x4c'))[_0xebf0('0x6c')](_0xebf0('0x78'))['where'](_0xebf0('0x6d'))[_0xebf0('0x32')]('ListId\x20=\x20?',_0x3218d6[_0xebf0('0x6f')]['toString']())[_0xebf0('0x32')](_0xebf0('0x70')))[_0xebf0('0x6b')]();}_0x402787['push'](db['sequelize'][_0xebf0('0x2b')](_0x6897b6));}return BPromise[_0xebf0('0x7a')](_0x402787);}})['then'](function(){return _0x20b9c2;})[_0xebf0('0x20')](respondWithResult(_0x24deff,null))[_0xebf0('0x43')](handleError(_0x24deff,null));};exports[_0xebf0('0x7b')]=function(_0x39651a,_0x177dfb,_0x491e81){return db['Campaign']['find']({'where':{'id':_0x39651a['params']['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x177dfb,null))[_0xebf0('0x20')](function(_0x307c53){if(_0x307c53){return _0x307c53[_0xebf0('0x7b')](_0x39651a[_0xebf0('0x2b')][_0xebf0('0x5f')]);}})[_0xebf0('0x20')](function(_0x484ce5){if(_0x484ce5){return db[_0xebf0('0x53')][_0xebf0('0x21')]({'where':{'ListId':_0x39651a['query'][_0xebf0('0x5f')],'CampaignId':_0x39651a[_0xebf0('0x3e')]['id']}})[_0xebf0('0x20')](function(){return _0x484ce5;});}})['then'](respondWithStatusCode(_0x177dfb,null))[_0xebf0('0x43')](handleError(_0x177dfb,null));};exports['getBlackLists']=function(_0x56c37e,_0x3f01ba,_0x5c220e){var _0x2e6f15={'raw':!![],'where':{}};var _0x5e4073={};var _0x23cc99={'count':0x0,'rows':[]};return db[_0xebf0('0x28')][_0xebf0('0x56')]({'where':{'id':_0x56c37e[_0xebf0('0x3e')]['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0x3f01ba,null))[_0xebf0('0x20')](function(_0x51a46d){if(_0x51a46d){_0x5e4073[_0xebf0('0x29')]=_['keys'](db[_0xebf0('0x5c')][_0xebf0('0x4a')]);_0x5e4073[_0xebf0('0x2b')]=_[_0xebf0('0x2a')](_0x56c37e[_0xebf0('0x2b')]);_0x5e4073['filters']=_[_0xebf0('0x2c')](_0x5e4073[_0xebf0('0x29')],_0x5e4073[_0xebf0('0x2b')]);_0x2e6f15['attributes']=_[_0xebf0('0x2c')](_0x5e4073[_0xebf0('0x29')],qs['fields'](_0x56c37e[_0xebf0('0x2b')][_0xebf0('0x3f')]));_0x2e6f15['attributes']=_0x2e6f15['attributes'][_0xebf0('0x40')]?_0x2e6f15['attributes']:_0x5e4073[_0xebf0('0x29')];if(!_0x56c37e[_0xebf0('0x2b')][_0xebf0('0x54')](_0xebf0('0x2e'))){_0x2e6f15[_0xebf0('0x2f')]=qs[_0xebf0('0x2f')](_0x56c37e[_0xebf0('0x2b')][_0xebf0('0x2f')]);_0x2e6f15[_0xebf0('0x1a')]=qs[_0xebf0('0x1a')](_0x56c37e[_0xebf0('0x2b')][_0xebf0('0x1a')]);}_0x2e6f15['order']=qs[_0xebf0('0x31')](_0x56c37e[_0xebf0('0x2b')]['sort']);_0x2e6f15[_0xebf0('0x32')]=qs[_0xebf0('0x33')](_['pick'](_0x56c37e[_0xebf0('0x2b')],_0x5e4073['filters']));_0x2e6f15['where']['CampaignId']=_0x51a46d['id'];if(_0x56c37e[_0xebf0('0x2b')][_0xebf0('0x34')]){_0x2e6f15[_0xebf0('0x32')]=_[_0xebf0('0x35')](_0x2e6f15[_0xebf0('0x32')],{'$or':_['map'](_0x2e6f15['attributes'],function(_0x31d312){var _0x593dac={};_0x593dac[_0x31d312]={'$like':'%'+_0x56c37e[_0xebf0('0x2b')]['filter']+'%'};return _0x593dac;})});}_0x2e6f15=_[_0xebf0('0x35')]({},_0x2e6f15,_0x56c37e['options']);return db[_0xebf0('0x5c')][_0xebf0('0x19')]({'where':_0x2e6f15[_0xebf0('0x32')]})[_0xebf0('0x20')](function(_0x164ebe){_0x23cc99['count']=_0x164ebe;if(_0x56c37e[_0xebf0('0x2b')]['includeAll']){_0x2e6f15['include']=[{'all':!![]}];}return db[_0xebf0('0x5c')]['findAll'](_0x2e6f15);})[_0xebf0('0x20')](function(_0x58b474){_0x23cc99['rows']=_0x58b474;return _0x23cc99;});}})[_0xebf0('0x20')](respondWithFilteredResult(_0x3f01ba,_0x2e6f15))[_0xebf0('0x43')](handleError(_0x3f01ba,null));};exports[_0xebf0('0x7c')]=function(_0x42ea80,_0xc75d23,_0x215fe4){var _0x38b4a1,_0x26a666;return db['Campaign'][_0xebf0('0x42')]({'where':{'id':_0x42ea80[_0xebf0('0x3e')]['id']}})[_0xebf0('0x20')](handleEntityNotFound(_0xc75d23,null))[_0xebf0('0x20')](function(_0x26ae72){if(_0x26ae72){_0x26a666=_0x26ae72;return _0x26ae72[_0xebf0('0x7c')](_0x42ea80[_0xebf0('0x45')][_0xebf0('0x5f')],_[_0xebf0('0x4b')](_0x42ea80[_0xebf0('0x45')],[_0xebf0('0x5f'),'id'])||{});}return null;})[_0xebf0('0x60')](function(_0x4d0394){var _0x5a72fd;_0x38b4a1=_0x4d0394||[];var _0x424c35=[];if(_0x4d0394){for(var _0x3f0be7=0x0;_0x3f0be7<_0x4d0394[_0xebf0('0x40')];_0x3f0be7+=0x1){var _0x430f0e=_0x4d0394[_0x3f0be7][_0xebf0('0x22')]({'plain':!![]});_0x5a72fd=squel[_0xebf0('0x63')]()[_0xebf0('0x76')](_0xebf0('0x7d'))[_0xebf0('0x64')]([_0xebf0('0x65'),_0xebf0('0x67'),'ListId',_0xebf0('0x57'),'createdAt',_0xebf0('0x4c')],squel[_0xebf0('0x69')]()[_0xebf0('0x38')](_0xebf0('0x65'),_0xebf0('0x65'))[_0xebf0('0x38')]('id',_0xebf0('0x67'))[_0xebf0('0x38')](_0x430f0e[_0xebf0('0x6f')][_0xebf0('0x6b')](),_0xebf0('0x68'))[_0xebf0('0x38')](_0x42ea80[_0xebf0('0x3e')]['id'][_0xebf0('0x6b')](),'CampaignId')[_0xebf0('0x38')](_0xebf0('0x6a'),_0xebf0('0x4d'))[_0xebf0('0x38')](_0xebf0('0x6a'),_0xebf0('0x4c'))[_0xebf0('0x6c')](_0xebf0('0x78'))[_0xebf0('0x32')]('deletedAt\x20IS\x20NULL')[_0xebf0('0x32')]('ListId\x20=\x20?',_0x430f0e[_0xebf0('0x6f')][_0xebf0('0x6b')]())['where'](_0xebf0('0x70')))['toString']();_0x424c35[_0xebf0('0x7e')](db['sequelize']['query'](_0x5a72fd));}return BPromise[_0xebf0('0x7a')](_0x424c35);}})[_0xebf0('0x20')](function(){return _0x38b4a1;})[_0xebf0('0x20')](respondWithResult(_0xc75d23,null))['catch'](handleError(_0xc75d23,null));};exports[_0xebf0('0x7f')]=function(_0x336d1d,_0x542539,_0xfb242b){return db[_0xebf0('0x28')][_0xebf0('0x42')]({'where':{'id':_0x336d1d[_0xebf0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x542539,null))[_0xebf0('0x20')](function(_0x3f823c){if(_0x3f823c){return _0x3f823c[_0xebf0('0x7f')](_0x336d1d['query']['ids']);}})[_0xebf0('0x20')](function(_0x37905c){if(_0x37905c){return db[_0xebf0('0x5b')][_0xebf0('0x21')]({'where':{'ListId':_0x336d1d[_0xebf0('0x2b')][_0xebf0('0x5f')],'CampaignId':_0x336d1d['params']['id']}})[_0xebf0('0x20')](function(){return _0x37905c;});}})['then'](respondWithStatusCode(_0x542539,null))['catch'](handleError(_0x542539,null));}; \ No newline at end of file +var _0xd19f=['CmHopperFinal','CampaignId','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','sequelize','all','removeLists','destroy','getBlackLists','CmList','addBlackLists','cm_hopper_black','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','update','then','IvrCampaigns','UserProfileResource','error','stack','name','index','Campaign','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','map','type','VIRTUAL','field','merge','options','count','includeAll','include','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','autoAssociation','getHoppers','CmHopper','nolimit','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals'];(function(_0x30fe8c,_0x272cb9){var _0x4f1068=function(_0x5f52c7){while(--_0x5f52c7){_0x30fe8c['push'](_0x30fe8c['shift']());}};_0x4f1068(++_0x272cb9);}(_0xd19f,0x125));var _0xfd19=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0xd19f[_0x491cbe];return _0x59449d;};'use strict';var pdf=require(_0xfd19('0x0'));var emlformat=require(_0xfd19('0x1'));var rimraf=require(_0xfd19('0x2'));var zipdir=require(_0xfd19('0x3'));var jsonpatch=require(_0xfd19('0x4'));var rp=require('request-promise');var moment=require(_0xfd19('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfd19('0x6'));var util=require(_0xfd19('0x7'));var path=require(_0xfd19('0x8'));var sox=require('sox');var csv=require(_0xfd19('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfd19('0xa'));var crypto=require(_0xfd19('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfd19('0x9'));var querystring=require(_0xfd19('0xc'));var Papa=require(_0xfd19('0xd'));var Redis=require(_0xfd19('0xe'));var authService=require(_0xfd19('0xf'));var qs=require(_0xfd19('0x10'));var hardwareService=require(_0xfd19('0x11'));var logger=require(_0xfd19('0x12'))(_0xfd19('0x13'));var utils=require(_0xfd19('0x14'));var config=require(_0xfd19('0x15'));var db=require(_0xfd19('0x16'))['db'];function respondWithStatusCode(_0xfd29ec,_0x8d67ed){_0x8d67ed=_0x8d67ed||0xcc;return function(_0x34c22e){if(_0x34c22e){return _0xfd29ec[_0xfd19('0x17')](_0x8d67ed);}return _0xfd29ec[_0xfd19('0x18')](_0x8d67ed)[_0xfd19('0x19')]();};}function respondWithResult(_0x16faba,_0x241eb2){_0x241eb2=_0x241eb2||0xc8;return function(_0x4cfd2a){if(_0x4cfd2a){return _0x16faba[_0xfd19('0x18')](_0x241eb2)['json'](_0x4cfd2a);}};}function respondWithFilteredResult(_0x3b889c,_0x4a85fd){return function(_0x5e8e23){if(_0x5e8e23){var _0x38db29=_0x5e8e23['count'],_0x184871=_0x4a85fd[_0xfd19('0x1a')],_0x5be1b3=_0x4a85fd['offset']+_0x4a85fd[_0xfd19('0x1b')],_0x2d1282;if(_0x5be1b3>=_0x38db29){_0x5be1b3=_0x38db29;_0x2d1282=0xc8;}else{_0x2d1282=0xce;}_0x3b889c[_0xfd19('0x18')](_0x2d1282);return _0x3b889c['set'](_0xfd19('0x1c'),_0x184871+'-'+_0x5be1b3+'/'+_0x38db29)[_0xfd19('0x1d')](_0x5e8e23);}return null;};}function patchUpdates(_0x564e17){return function(_0x40e35c){try{jsonpatch[_0xfd19('0x1e')](_0x40e35c,_0x564e17,!![]);}catch(_0x4d9d7d){return BPromise['reject'](_0x4d9d7d);}return _0x40e35c['save']();};}function saveUpdates(_0x2db1c6,_0x1abf72){return function(_0x54fe68){if(_0x54fe68){return _0x54fe68[_0xfd19('0x1f')](_0x2db1c6)[_0xfd19('0x20')](function(_0x71b975){return _0x71b975;});}return null;};}function removeEntity(_0x116fef,_0x512ce4){return function(_0x27f529){if(_0x27f529){return _0x27f529['destroy']()['then'](function(){var _0xade393=_0x27f529['get']({'plain':!![]});var _0x4c13ee=_0xfd19('0x21');return db[_0xfd19('0x22')]['destroy']({'where':{'type':_0x4c13ee,'resourceId':_0xade393['id']}})[_0xfd19('0x20')](function(){return _0x27f529;});})[_0xfd19('0x20')](function(){_0x116fef[_0xfd19('0x18')](0xcc)[_0xfd19('0x19')]();});}};}function handleEntityNotFound(_0x1c6258,_0x2f9998){return function(_0x51b5d6){if(!_0x51b5d6){_0x1c6258[_0xfd19('0x17')](0x194);}return _0x51b5d6;};}function handleError(_0x309973,_0x41269f){_0x41269f=_0x41269f||0x1f4;return function(_0x13edf4){logger[_0xfd19('0x23')](_0x13edf4[_0xfd19('0x24')]);if(_0x13edf4[_0xfd19('0x25')]){delete _0x13edf4[_0xfd19('0x25')];}_0x309973[_0xfd19('0x18')](_0x41269f)['send'](_0x13edf4);};}exports[_0xfd19('0x26')]=function(_0x109559,_0x8048a0){var _0x24805f={},_0x3dee38={},_0x16974e={'count':0x0,'rows':[]};var _0x258731=db[_0xfd19('0x27')][_0xfd19('0x28')];_0x3dee38[_0xfd19('0x29')]=_[_0xfd19('0x2a')](_0x258731);_0x3dee38['query']=_[_0xfd19('0x2a')](_0x109559[_0xfd19('0x2b')]);_0x3dee38['filters']=_[_0xfd19('0x2c')](_0x3dee38[_0xfd19('0x29')],_0x3dee38[_0xfd19('0x2b')]);_0x24805f[_0xfd19('0x2d')]=_[_0xfd19('0x2c')](_0x3dee38[_0xfd19('0x29')],qs[_0xfd19('0x2e')](_0x109559[_0xfd19('0x2b')][_0xfd19('0x2e')]));_0x24805f[_0xfd19('0x2d')]=_0x24805f['attributes'][_0xfd19('0x2f')]?_0x24805f[_0xfd19('0x2d')]:_0x3dee38[_0xfd19('0x29')];if(!_0x109559[_0xfd19('0x2b')][_0xfd19('0x30')]('nolimit')){_0x24805f[_0xfd19('0x1b')]=qs[_0xfd19('0x1b')](_0x109559[_0xfd19('0x2b')]['limit']);_0x24805f[_0xfd19('0x1a')]=qs[_0xfd19('0x1a')](_0x109559['query'][_0xfd19('0x1a')]);}_0x24805f[_0xfd19('0x31')]=qs['sort'](_0x109559['query'][_0xfd19('0x32')]);_0x24805f[_0xfd19('0x33')]=qs[_0xfd19('0x34')](_[_0xfd19('0x35')](_0x109559['query'],_0x3dee38[_0xfd19('0x34')]));if(_0x109559[_0xfd19('0x2b')][_0xfd19('0x36')]){_0x24805f[_0xfd19('0x33')]=_['merge'](_0x24805f[_0xfd19('0x33')],{'$or':_[_0xfd19('0x37')](_0x258731,function(_0x943ab7){if(_0x943ab7[_0xfd19('0x38')]['key']!==_0xfd19('0x39')){var _0x3399dc={};_0x3399dc[_0x943ab7[_0xfd19('0x3a')]]={'$like':'%'+_0x109559['query'][_0xfd19('0x36')]+'%'};return _0x3399dc;}})});}_0x24805f=_[_0xfd19('0x3b')]({},_0x24805f,_0x109559[_0xfd19('0x3c')]);var _0x549592={'where':_0x24805f[_0xfd19('0x33')]};return db['Campaign'][_0xfd19('0x3d')](_0x549592)[_0xfd19('0x20')](function(_0x4cefb5){_0x16974e[_0xfd19('0x3d')]=_0x4cefb5;if(_0x109559[_0xfd19('0x2b')][_0xfd19('0x3e')]){_0x24805f[_0xfd19('0x3f')]=[{'all':!![]}];}return db[_0xfd19('0x27')][_0xfd19('0x40')](_0x24805f);})['then'](function(_0x245c72){_0x16974e['rows']=_0x245c72;return _0x16974e;})[_0xfd19('0x20')](respondWithFilteredResult(_0x8048a0,_0x24805f))[_0xfd19('0x41')](handleError(_0x8048a0,null));};exports[_0xfd19('0x42')]=function(_0x21bbe5,_0xe9346b){var _0x36b12c={'raw':![],'where':{'id':_0x21bbe5[_0xfd19('0x43')]['id']}},_0x1af7b6={};_0x1af7b6['model']=_[_0xfd19('0x2a')](db[_0xfd19('0x27')]['rawAttributes']);_0x1af7b6[_0xfd19('0x2b')]=_['keys'](_0x21bbe5[_0xfd19('0x2b')]);_0x1af7b6[_0xfd19('0x34')]=_[_0xfd19('0x2c')](_0x1af7b6[_0xfd19('0x29')],_0x1af7b6[_0xfd19('0x2b')]);_0x36b12c[_0xfd19('0x2d')]=_[_0xfd19('0x2c')](_0x1af7b6['model'],qs[_0xfd19('0x2e')](_0x21bbe5[_0xfd19('0x2b')]['fields']));_0x36b12c[_0xfd19('0x2d')]=_0x36b12c['attributes'][_0xfd19('0x2f')]?_0x36b12c[_0xfd19('0x2d')]:_0x1af7b6['model'];if(_0x21bbe5[_0xfd19('0x2b')][_0xfd19('0x3e')]){_0x36b12c[_0xfd19('0x3f')]=[{'all':!![]}];}_0x36b12c=_[_0xfd19('0x3b')]({},_0x36b12c,_0x21bbe5[_0xfd19('0x3c')]);return db[_0xfd19('0x27')][_0xfd19('0x44')](_0x36b12c)['then'](handleEntityNotFound(_0xe9346b,null))[_0xfd19('0x20')](respondWithResult(_0xe9346b,null))[_0xfd19('0x41')](handleError(_0xe9346b,null));};exports['create']=function(_0x752eea,_0x11d554){return db['Campaign'][_0xfd19('0x45')](_0x752eea['body'],{})[_0xfd19('0x20')](function(_0x158408){var _0x44b6f8=_0x752eea[_0xfd19('0x46')]['get']({'plain':!![]});if(!_0x44b6f8)throw new Error(_0xfd19('0x47'));if(_0x44b6f8['role']===_0xfd19('0x46')){var _0x38f7f2=_0x158408[_0xfd19('0x48')]({'plain':!![]});var _0x20bba2=_0xfd19('0x21');return db[_0xfd19('0x49')][_0xfd19('0x44')]({'where':{'name':_0x20bba2,'userProfileId':_0x44b6f8['userProfileId']},'raw':!![]})[_0xfd19('0x20')](function(_0x1ae07c){if(_0x1ae07c&&_0x1ae07c['autoAssociation']===0x0){return db['UserProfileResource'][_0xfd19('0x45')]({'name':_0x38f7f2[_0xfd19('0x25')],'resourceId':_0x38f7f2['id'],'type':_0x1ae07c['name'],'sectionId':_0x1ae07c['id']},{})[_0xfd19('0x20')](function(){return _0x158408;});}else{return _0x158408;}})[_0xfd19('0x41')](function(_0x32bc0f){logger[_0xfd19('0x23')](_0xfd19('0x4a'),_0x32bc0f);throw _0x32bc0f;});}return _0x158408;})[_0xfd19('0x20')](respondWithResult(_0x11d554,0xc9))['catch'](handleError(_0x11d554,null));};exports['clone']=function(_0xd964d4,_0xe4e058){var _0x486646={'raw':![],'where':{'id':_0xd964d4[_0xfd19('0x43')]['id']}},_0x1af380={};_0x1af380['model']=_['keys'](db['Campaign'][_0xfd19('0x28')]);_0x486646[_0xfd19('0x2d')]=_['intersection'](_0x1af380[_0xfd19('0x29')],qs['fields'](_0xd964d4[_0xfd19('0x2b')]['fields']));_0x486646[_0xfd19('0x2d')]=_0x486646['attributes']['length']?_0x486646['attributes']:_0x1af380[_0xfd19('0x29')];if(_0xd964d4[_0xfd19('0x2b')][_0xfd19('0x3e')]){_0x486646['include']=[{'all':!![]}];}_0x486646=_[_0xfd19('0x3b')]({},_0x486646,_0xd964d4[_0xfd19('0x3c')]);return db[_0xfd19('0x27')][_0xfd19('0x44')](_0x486646)[_0xfd19('0x20')](handleEntityNotFound(_0xe4e058,null))[_0xfd19('0x20')](function(_0x5663f7){if(_0x5663f7){var _0x365753=_0x5663f7['get']({'plain':!![]});_0x365753=qs[_0xfd19('0x4b')](_0x365753,['id',_0xfd19('0x4c'),_0xfd19('0x4d')]);_0xd964d4[_0xfd19('0x4e')]=_[_0xfd19('0x4b')](_0xd964d4[_0xfd19('0x4e')],['id',_0xfd19('0x4c'),'updatedAt']);return db['Campaign'][_0xfd19('0x45')](_[_0xfd19('0x3b')](_0x365753,_0xd964d4[_0xfd19('0x4e')]),{'include':_0xd964d4[_0xfd19('0x2b')][_0xfd19('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x1cdff7){var _0x1c6924=_0xd964d4[_0xfd19('0x46')][_0xfd19('0x48')]({'plain':!![]});if(!_0x1c6924)throw new Error(_0xfd19('0x47'));if(_0x1c6924['role']===_0xfd19('0x46')){var _0x298e49=_0x1cdff7[_0xfd19('0x48')]({'plain':!![]});var _0x58d778=_0xfd19('0x21');return db['UserProfileSection']['find']({'where':{'name':_0x58d778,'userProfileId':_0x1c6924['userProfileId']},'raw':!![]})[_0xfd19('0x20')](function(_0x4407a6){if(_0x4407a6&&_0x4407a6[_0xfd19('0x4f')]===0x0){return db[_0xfd19('0x22')][_0xfd19('0x45')]({'name':_0x298e49[_0xfd19('0x25')],'resourceId':_0x298e49['id'],'type':_0x4407a6[_0xfd19('0x25')],'sectionId':_0x4407a6['id']},{})['then'](function(){return _0x1cdff7;});}else{return _0x1cdff7;}})[_0xfd19('0x41')](function(_0x351c11){logger[_0xfd19('0x23')](_0xfd19('0x4a'),_0x351c11);throw _0x351c11;});}return _0x1cdff7;});}})[_0xfd19('0x20')](respondWithResult(_0xe4e058,0xc9))[_0xfd19('0x41')](handleError(_0xe4e058,null));};exports[_0xfd19('0x1f')]=function(_0x5d5555,_0x29d0bf){if(_0x5d5555['body']['id']){delete _0x5d5555[_0xfd19('0x4e')]['id'];}return db[_0xfd19('0x27')][_0xfd19('0x44')]({'where':{'id':_0x5d5555[_0xfd19('0x43')]['id']}})['then'](handleEntityNotFound(_0x29d0bf,null))[_0xfd19('0x20')](saveUpdates(_0x5d5555[_0xfd19('0x4e')],null))['then'](respondWithResult(_0x29d0bf,null))[_0xfd19('0x41')](handleError(_0x29d0bf,null));};exports['destroy']=function(_0x36595c,_0x368391){return db['Campaign'][_0xfd19('0x44')]({'where':{'id':_0x36595c[_0xfd19('0x43')]['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x368391,null))[_0xfd19('0x20')](removeEntity(_0x368391,null))['catch'](handleError(_0x368391,null));};exports[_0xfd19('0x50')]=function(_0x4276f3,_0xe033be,_0x8eee43){var _0x329bed={'raw':!![],'where':{}};var _0x35ee1f={};var _0x4bb6a0={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4276f3[_0xfd19('0x43')]['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0xe033be,null))[_0xfd19('0x20')](function(_0x52390d){if(_0x52390d){_0x35ee1f['model']=_['keys'](db[_0xfd19('0x51')][_0xfd19('0x28')]);_0x35ee1f[_0xfd19('0x2b')]=_[_0xfd19('0x2a')](_0x4276f3['query']);_0x35ee1f[_0xfd19('0x34')]=_[_0xfd19('0x2c')](_0x35ee1f['model'],_0x35ee1f[_0xfd19('0x2b')]);_0x329bed[_0xfd19('0x2d')]=_[_0xfd19('0x2c')](_0x35ee1f[_0xfd19('0x29')],qs[_0xfd19('0x2e')](_0x4276f3[_0xfd19('0x2b')]['fields']));_0x329bed[_0xfd19('0x2d')]=_0x329bed['attributes']['length']?_0x329bed[_0xfd19('0x2d')]:_0x35ee1f[_0xfd19('0x29')];if(!_0x4276f3['query']['hasOwnProperty'](_0xfd19('0x52'))){_0x329bed[_0xfd19('0x1b')]=qs[_0xfd19('0x1b')](_0x4276f3[_0xfd19('0x2b')][_0xfd19('0x1b')]);_0x329bed[_0xfd19('0x1a')]=qs[_0xfd19('0x1a')](_0x4276f3['query']['offset']);}_0x329bed['order']=qs['sort'](_0x4276f3['query']['sort']);_0x329bed[_0xfd19('0x33')]=qs[_0xfd19('0x34')](_[_0xfd19('0x35')](_0x4276f3[_0xfd19('0x2b')],_0x35ee1f['filters']));_0x329bed[_0xfd19('0x33')]['CampaignId']=_0x52390d['id'];if(_0x4276f3['query'][_0xfd19('0x36')]){_0x329bed[_0xfd19('0x33')]=_[_0xfd19('0x3b')](_0x329bed[_0xfd19('0x33')],{'$or':_[_0xfd19('0x37')](_0x329bed[_0xfd19('0x2d')],function(_0x491755){var _0x50a0a3={};_0x50a0a3[_0x491755]={'$like':'%'+_0x4276f3['query'][_0xfd19('0x36')]+'%'};return _0x50a0a3;})});}_0x329bed=_[_0xfd19('0x3b')]({},_0x329bed,_0x4276f3[_0xfd19('0x3c')]);return db[_0xfd19('0x51')][_0xfd19('0x3d')]({'where':_0x329bed[_0xfd19('0x33')]})[_0xfd19('0x20')](function(_0x4f1d21){_0x4bb6a0[_0xfd19('0x3d')]=_0x4f1d21;if(_0x4276f3['query']['includeAll']){_0x329bed[_0xfd19('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0xfd19('0x40')](_0x329bed);})[_0xfd19('0x20')](function(_0x26df16){_0x4bb6a0[_0xfd19('0x53')]=_0x26df16;return _0x4bb6a0;});}})[_0xfd19('0x20')](respondWithFilteredResult(_0xe033be,_0x329bed))[_0xfd19('0x41')](handleError(_0xe033be,null));};exports[_0xfd19('0x54')]=function(_0x3b7b7c,_0x16d252,_0x561473){var _0x17e5b3={'raw':!![],'where':{}};var _0x547d2a={};var _0x593abc={'count':0x0,'rows':[]};return db[_0xfd19('0x27')][_0xfd19('0x55')]({'where':{'id':_0x3b7b7c['params']['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x16d252,null))[_0xfd19('0x20')](function(_0x52c3b7){if(_0x52c3b7){_0x547d2a[_0xfd19('0x29')]=_[_0xfd19('0x2a')](db[_0xfd19('0x56')][_0xfd19('0x28')]);_0x547d2a[_0xfd19('0x2b')]=_[_0xfd19('0x2a')](_0x3b7b7c['query']);_0x547d2a[_0xfd19('0x34')]=_['intersection'](_0x547d2a[_0xfd19('0x29')],_0x547d2a[_0xfd19('0x2b')]);_0x17e5b3[_0xfd19('0x2d')]=_[_0xfd19('0x2c')](_0x547d2a[_0xfd19('0x29')],qs['fields'](_0x3b7b7c[_0xfd19('0x2b')]['fields']));_0x17e5b3[_0xfd19('0x2d')]=_0x17e5b3[_0xfd19('0x2d')][_0xfd19('0x2f')]?_0x17e5b3[_0xfd19('0x2d')]:_0x547d2a['model'];if(!_0x3b7b7c['query'][_0xfd19('0x30')](_0xfd19('0x52'))){_0x17e5b3['limit']=qs['limit'](_0x3b7b7c['query'][_0xfd19('0x1b')]);_0x17e5b3[_0xfd19('0x1a')]=qs['offset'](_0x3b7b7c['query'][_0xfd19('0x1a')]);}_0x17e5b3['order']=qs['sort'](_0x3b7b7c[_0xfd19('0x2b')][_0xfd19('0x32')]);_0x17e5b3['where']=qs[_0xfd19('0x34')](_[_0xfd19('0x35')](_0x3b7b7c[_0xfd19('0x2b')],_0x547d2a[_0xfd19('0x34')]));_0x17e5b3['where']['CampaignId']=_0x52c3b7['id'];if(_0x3b7b7c['query'][_0xfd19('0x36')]){_0x17e5b3[_0xfd19('0x33')]=_[_0xfd19('0x3b')](_0x17e5b3[_0xfd19('0x33')],{'$or':_[_0xfd19('0x37')](_0x17e5b3[_0xfd19('0x2d')],function(_0x36a2e0){var _0x809a3d={};_0x809a3d[_0x36a2e0]={'$like':'%'+_0x3b7b7c[_0xfd19('0x2b')][_0xfd19('0x36')]+'%'};return _0x809a3d;})});}_0x17e5b3=_[_0xfd19('0x3b')]({},_0x17e5b3,_0x3b7b7c[_0xfd19('0x3c')]);return db[_0xfd19('0x56')]['count']({'where':_0x17e5b3['where']})[_0xfd19('0x20')](function(_0x373bcb){_0x593abc[_0xfd19('0x3d')]=_0x373bcb;if(_0x3b7b7c[_0xfd19('0x2b')][_0xfd19('0x3e')]){_0x17e5b3[_0xfd19('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x17e5b3);})[_0xfd19('0x20')](function(_0x1fe4d7){_0x593abc[_0xfd19('0x53')]=_0x1fe4d7;return _0x593abc;});}})[_0xfd19('0x20')](respondWithFilteredResult(_0x16d252,_0x17e5b3))[_0xfd19('0x41')](handleError(_0x16d252,null));};exports[_0xfd19('0x57')]=function(_0x1a50d0,_0x110285,_0x2fc02e){var _0x298056={'raw':!![],'where':{}};var _0x3a027b={};var _0x3b8aa1={'count':0x0,'rows':[]};return db[_0xfd19('0x27')][_0xfd19('0x55')]({'where':{'id':_0x1a50d0[_0xfd19('0x43')]['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x110285,null))[_0xfd19('0x20')](function(_0x23eb05){if(_0x23eb05){_0x3a027b[_0xfd19('0x29')]=_['keys'](db[_0xfd19('0x58')][_0xfd19('0x28')]);_0x3a027b['query']=_[_0xfd19('0x2a')](_0x1a50d0[_0xfd19('0x2b')]);_0x3a027b[_0xfd19('0x34')]=_[_0xfd19('0x2c')](_0x3a027b[_0xfd19('0x29')],_0x3a027b[_0xfd19('0x2b')]);_0x298056[_0xfd19('0x2d')]=_[_0xfd19('0x2c')](_0x3a027b['model'],qs[_0xfd19('0x2e')](_0x1a50d0['query'][_0xfd19('0x2e')]));_0x298056[_0xfd19('0x2d')]=_0x298056['attributes'][_0xfd19('0x2f')]?_0x298056['attributes']:_0x3a027b[_0xfd19('0x29')];if(!_0x1a50d0['query'][_0xfd19('0x30')]('nolimit')){_0x298056[_0xfd19('0x1b')]=qs[_0xfd19('0x1b')](_0x1a50d0[_0xfd19('0x2b')][_0xfd19('0x1b')]);_0x298056['offset']=qs[_0xfd19('0x1a')](_0x1a50d0[_0xfd19('0x2b')][_0xfd19('0x1a')]);}_0x298056[_0xfd19('0x31')]=qs[_0xfd19('0x32')](_0x1a50d0[_0xfd19('0x2b')][_0xfd19('0x32')]);_0x298056[_0xfd19('0x33')]=qs[_0xfd19('0x34')](_['pick'](_0x1a50d0['query'],_0x3a027b[_0xfd19('0x34')]));_0x298056[_0xfd19('0x33')][_0xfd19('0x59')]=_0x23eb05['id'];if(_0x1a50d0[_0xfd19('0x2b')][_0xfd19('0x36')]){_0x298056['where']=_['merge'](_0x298056[_0xfd19('0x33')],{'$or':_['map'](_0x298056[_0xfd19('0x2d')],function(_0x164c9a){var _0x418eca={};_0x418eca[_0x164c9a]={'$like':'%'+_0x1a50d0['query'][_0xfd19('0x36')]+'%'};return _0x418eca;})});}_0x298056=_[_0xfd19('0x3b')]({},_0x298056,_0x1a50d0['options']);return db[_0xfd19('0x58')][_0xfd19('0x3d')]({'where':_0x298056['where']})[_0xfd19('0x20')](function(_0x44f019){_0x3b8aa1['count']=_0x44f019;if(_0x1a50d0[_0xfd19('0x2b')][_0xfd19('0x3e')]){_0x298056['include']=[{'all':!![]}];}return db[_0xfd19('0x58')][_0xfd19('0x40')](_0x298056);})[_0xfd19('0x20')](function(_0x52c767){_0x3b8aa1['rows']=_0x52c767;return _0x3b8aa1;});}})[_0xfd19('0x20')](respondWithFilteredResult(_0x110285,_0x298056))[_0xfd19('0x41')](handleError(_0x110285,null));};exports[_0xfd19('0x5a')]=function(_0x1624a7,_0x5f495c,_0x25ab45){var _0x3fff7a={'raw':!![],'where':{}};var _0x3842a9={};var _0x45a1ec={'count':0x0,'rows':[]};return db[_0xfd19('0x27')][_0xfd19('0x55')]({'where':{'id':_0x1624a7[_0xfd19('0x43')]['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x5f495c,null))[_0xfd19('0x20')](function(_0x3fcda6){if(_0x3fcda6){_0x3842a9[_0xfd19('0x29')]=_[_0xfd19('0x2a')](db['CmHopperBlack'][_0xfd19('0x28')]);_0x3842a9[_0xfd19('0x2b')]=_[_0xfd19('0x2a')](_0x1624a7[_0xfd19('0x2b')]);_0x3842a9[_0xfd19('0x34')]=_['intersection'](_0x3842a9[_0xfd19('0x29')],_0x3842a9['query']);_0x3fff7a['attributes']=_[_0xfd19('0x2c')](_0x3842a9[_0xfd19('0x29')],qs[_0xfd19('0x2e')](_0x1624a7['query']['fields']));_0x3fff7a[_0xfd19('0x2d')]=_0x3fff7a[_0xfd19('0x2d')][_0xfd19('0x2f')]?_0x3fff7a['attributes']:_0x3842a9[_0xfd19('0x29')];if(!_0x1624a7[_0xfd19('0x2b')][_0xfd19('0x30')]('nolimit')){_0x3fff7a[_0xfd19('0x1b')]=qs[_0xfd19('0x1b')](_0x1624a7[_0xfd19('0x2b')][_0xfd19('0x1b')]);_0x3fff7a[_0xfd19('0x1a')]=qs[_0xfd19('0x1a')](_0x1624a7[_0xfd19('0x2b')][_0xfd19('0x1a')]);}_0x3fff7a['order']=qs[_0xfd19('0x32')](_0x1624a7[_0xfd19('0x2b')]['sort']);_0x3fff7a['where']=qs['filters'](_[_0xfd19('0x35')](_0x1624a7[_0xfd19('0x2b')],_0x3842a9[_0xfd19('0x34')]));_0x3fff7a['where'][_0xfd19('0x59')]=_0x3fcda6['id'];if(_0x1624a7[_0xfd19('0x2b')][_0xfd19('0x36')]){_0x3fff7a['where']=_['merge'](_0x3fff7a[_0xfd19('0x33')],{'$or':_[_0xfd19('0x37')](_0x3fff7a[_0xfd19('0x2d')],function(_0x21b657){var _0x5e0d9e={};_0x5e0d9e[_0x21b657]={'$like':'%'+_0x1624a7[_0xfd19('0x2b')][_0xfd19('0x36')]+'%'};return _0x5e0d9e;})});}_0x3fff7a=_[_0xfd19('0x3b')]({},_0x3fff7a,_0x1624a7['options']);return db[_0xfd19('0x5b')][_0xfd19('0x3d')]({'where':_0x3fff7a[_0xfd19('0x33')]})[_0xfd19('0x20')](function(_0x438aef){_0x45a1ec[_0xfd19('0x3d')]=_0x438aef;if(_0x1624a7[_0xfd19('0x2b')][_0xfd19('0x3e')]){_0x3fff7a[_0xfd19('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xfd19('0x40')](_0x3fff7a);})[_0xfd19('0x20')](function(_0x3b4cca){_0x45a1ec[_0xfd19('0x53')]=_0x3b4cca;return _0x45a1ec;});}})[_0xfd19('0x20')](respondWithFilteredResult(_0x5f495c,_0x3fff7a))[_0xfd19('0x41')](handleError(_0x5f495c,null));};exports[_0xfd19('0x5c')]=function(_0x260678,_0x34ad7d,_0x22d396){var _0x2ae2f5={};var _0x55ef5f={};var _0x4c6d63;var _0x5180da;return db[_0xfd19('0x27')][_0xfd19('0x55')]({'where':{'id':_0x260678[_0xfd19('0x43')]['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x34ad7d,null))[_0xfd19('0x20')](function(_0x333ede){if(_0x333ede){_0x4c6d63=_0x333ede;_0x55ef5f[_0xfd19('0x29')]=_[_0xfd19('0x2a')](db['CmList'][_0xfd19('0x28')]);_0x55ef5f[_0xfd19('0x2b')]=_[_0xfd19('0x2a')](_0x260678[_0xfd19('0x2b')]);_0x55ef5f[_0xfd19('0x34')]=_['intersection'](_0x55ef5f[_0xfd19('0x29')],_0x55ef5f[_0xfd19('0x2b')]);_0x2ae2f5['attributes']=_['intersection'](_0x55ef5f['model'],qs[_0xfd19('0x2e')](_0x260678[_0xfd19('0x2b')][_0xfd19('0x2e')]));_0x2ae2f5[_0xfd19('0x2d')]=_0x2ae2f5[_0xfd19('0x2d')][_0xfd19('0x2f')]?_0x2ae2f5[_0xfd19('0x2d')]:_0x55ef5f['model'];_0x2ae2f5['order']=qs[_0xfd19('0x32')](_0x260678[_0xfd19('0x2b')][_0xfd19('0x32')]);_0x2ae2f5[_0xfd19('0x33')]=qs['filters'](_[_0xfd19('0x35')](_0x260678['query'],_0x55ef5f[_0xfd19('0x34')]));if(_0x260678[_0xfd19('0x2b')]['filter']){_0x2ae2f5[_0xfd19('0x33')]=_[_0xfd19('0x3b')](_0x2ae2f5[_0xfd19('0x33')],{'$or':_[_0xfd19('0x37')](_0x2ae2f5[_0xfd19('0x2d')],function(_0x4714a2){var _0x4ce893={};_0x4ce893[_0x4714a2]={'$like':'%'+_0x260678[_0xfd19('0x2b')][_0xfd19('0x36')]+'%'};return _0x4ce893;})});}_0x2ae2f5=_[_0xfd19('0x3b')]({},_0x2ae2f5,_0x260678[_0xfd19('0x3c')]);return _0x4c6d63['getLists'](_0x2ae2f5);}})['then'](function(_0x3775ef){if(_0x3775ef){_0x5180da=_0x3775ef['length'];if(!_0x260678[_0xfd19('0x2b')][_0xfd19('0x30')](_0xfd19('0x52'))){_0x2ae2f5[_0xfd19('0x1b')]=qs[_0xfd19('0x1b')](_0x260678[_0xfd19('0x2b')][_0xfd19('0x1b')]);_0x2ae2f5[_0xfd19('0x1a')]=qs[_0xfd19('0x1a')](_0x260678[_0xfd19('0x2b')][_0xfd19('0x1a')]);}return _0x4c6d63[_0xfd19('0x5c')](_0x2ae2f5);}})[_0xfd19('0x20')](function(_0xabd729){if(_0xabd729){return _0xabd729?{'count':_0x5180da,'rows':_0xabd729}:null;}})[_0xfd19('0x20')](respondWithResult(_0x34ad7d,null))[_0xfd19('0x41')](handleError(_0x34ad7d,null));};exports['addLists']=function(_0x26c7aa,_0x49e86d,_0x28742e){var _0x3547ee,_0x266e3f;return db[_0xfd19('0x27')]['find']({'where':{'id':_0x26c7aa[_0xfd19('0x43')]['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x49e86d,null))[_0xfd19('0x20')](function(_0x392d92){if(_0x392d92){_0x266e3f=_0x392d92;return _0x392d92[_0xfd19('0x5d')](_0x26c7aa[_0xfd19('0x4e')][_0xfd19('0x5e')],_[_0xfd19('0x4b')](_0x26c7aa[_0xfd19('0x4e')],['ids','id'])||{});}return null;})[_0xfd19('0x5f')](function(_0x5f2dbc){var _0x55c9c0;_0x3547ee=_0x5f2dbc||[];var _0x5d8f10=[];if(_0x5f2dbc){for(var _0x323030=0x0;_0x323030<_0x5f2dbc[_0xfd19('0x2f')];_0x323030+=0x1){var _0x11c129=_0x5f2dbc[_0x323030][_0xfd19('0x48')]({'plain':!![]});_0x266e3f[_0xfd19('0x60')]=_0x26c7aa[_0xfd19('0x4e')][_0xfd19('0x60')]?_0x26c7aa[_0xfd19('0x4e')]['dialCheckDuplicateType']:_0x266e3f['dialCheckDuplicateType'];switch(_0x266e3f['dialCheckDuplicateType']){case _0xfd19('0x61'):_0x55c9c0=squel[_0xfd19('0x62')]()[_0xfd19('0x63')](_0xfd19('0x64'))[_0xfd19('0x65')]([_0xfd19('0x66'),_0xfd19('0x67'),_0xfd19('0x68'),_0xfd19('0x69'),_0xfd19('0x59'),_0xfd19('0x4c'),_0xfd19('0x4d')],squel[_0xfd19('0x6a')]()[_0xfd19('0x3a')]('phone',_0xfd19('0x66'))[_0xfd19('0x3a')](_0xfd19('0x6b'),_0xfd19('0x67'))['field']('id',_0xfd19('0x68'))['field'](_0x11c129[_0xfd19('0x6c')][_0xfd19('0x6d')](),'ListId')['field'](_0x26c7aa[_0xfd19('0x43')]['id'][_0xfd19('0x6d')](),'CampaignId')[_0xfd19('0x3a')](_0xfd19('0x6b'),'createdAt')['field'](_0xfd19('0x6b'),_0xfd19('0x4d'))[_0xfd19('0x6e')](_0xfd19('0x6f'))[_0xfd19('0x33')](_0xfd19('0x70'))[_0xfd19('0x33')](_0xfd19('0x71'),_0x11c129[_0xfd19('0x6c')][_0xfd19('0x6d')]())[_0xfd19('0x33')](_0xfd19('0x72'))[_0xfd19('0x33')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfd19('0x6a')]()[_0xfd19('0x3a')](_0xfd19('0x73'))['from'](_0xfd19('0x74'))[_0xfd19('0x33')](_0xfd19('0x75'),_0x26c7aa[_0xfd19('0x43')]['id'][_0xfd19('0x6d')]()))[_0xfd19('0x33')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfd19('0x6a')]()[_0xfd19('0x3a')](_0xfd19('0x76'))[_0xfd19('0x6e')](_0xfd19('0x64'))[_0xfd19('0x33')]('CampaignId\x20=\x20?',_0x26c7aa[_0xfd19('0x43')]['id'][_0xfd19('0x6d')]())))[_0xfd19('0x6d')]();break;case'onlyIfOpen':_0x55c9c0=squel[_0xfd19('0x62')]()[_0xfd19('0x63')](_0xfd19('0x64'))['fromQuery']([_0xfd19('0x66'),_0xfd19('0x67'),_0xfd19('0x68'),_0xfd19('0x69'),'CampaignId','createdAt',_0xfd19('0x4d')],squel[_0xfd19('0x6a')]()[_0xfd19('0x3a')]('phone',_0xfd19('0x66'))[_0xfd19('0x3a')](_0xfd19('0x6b'),'scheduledAt')[_0xfd19('0x3a')]('id',_0xfd19('0x68'))[_0xfd19('0x3a')](_0x11c129[_0xfd19('0x6c')][_0xfd19('0x6d')](),'ListId')[_0xfd19('0x3a')](_0x26c7aa[_0xfd19('0x43')]['id'][_0xfd19('0x6d')](),_0xfd19('0x59'))[_0xfd19('0x3a')](_0xfd19('0x6b'),_0xfd19('0x4c'))[_0xfd19('0x3a')](_0xfd19('0x6b'),_0xfd19('0x4d'))[_0xfd19('0x6e')](_0xfd19('0x6f'))['where'](_0xfd19('0x70'))[_0xfd19('0x33')](_0xfd19('0x71'),_0x11c129[_0xfd19('0x6c')]['toString']())[_0xfd19('0x33')](_0xfd19('0x72'))[_0xfd19('0x33')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfd19('0x6a')]()[_0xfd19('0x3a')](_0xfd19('0x76'))[_0xfd19('0x6e')](_0xfd19('0x64'))[_0xfd19('0x33')](_0xfd19('0x75'),_0x26c7aa[_0xfd19('0x43')]['id'][_0xfd19('0x6d')]())))[_0xfd19('0x6d')]();break;default:_0x55c9c0=squel[_0xfd19('0x62')]()[_0xfd19('0x63')](_0xfd19('0x64'))[_0xfd19('0x65')]([_0xfd19('0x66'),_0xfd19('0x67'),_0xfd19('0x68'),_0xfd19('0x69'),'CampaignId',_0xfd19('0x4c'),_0xfd19('0x4d')],squel[_0xfd19('0x6a')]()[_0xfd19('0x3a')]('phone','phone')['field'](_0xfd19('0x6b'),_0xfd19('0x67'))[_0xfd19('0x3a')]('id','ContactId')[_0xfd19('0x3a')](_0x11c129['CmListId'][_0xfd19('0x6d')](),_0xfd19('0x69'))[_0xfd19('0x3a')](_0x26c7aa[_0xfd19('0x43')]['id'][_0xfd19('0x6d')](),_0xfd19('0x59'))[_0xfd19('0x3a')](_0xfd19('0x6b'),_0xfd19('0x4c'))[_0xfd19('0x3a')](_0xfd19('0x6b'),'updatedAt')[_0xfd19('0x6e')](_0xfd19('0x6f'))[_0xfd19('0x33')]('deletedAt\x20IS\x20NULL')[_0xfd19('0x33')](_0xfd19('0x71'),_0x11c129[_0xfd19('0x6c')][_0xfd19('0x6d')]())['where'](_0xfd19('0x72')))[_0xfd19('0x6d')]();}_0x5d8f10['push'](db[_0xfd19('0x77')]['query'](_0x55c9c0));}return BPromise[_0xfd19('0x78')](_0x5d8f10);}})[_0xfd19('0x20')](function(){return _0x3547ee;})[_0xfd19('0x20')](respondWithResult(_0x49e86d,null))[_0xfd19('0x41')](handleError(_0x49e86d,null));};exports[_0xfd19('0x79')]=function(_0x13a71e,_0x460e50,_0x1dcfb1){return db[_0xfd19('0x27')]['find']({'where':{'id':_0x13a71e[_0xfd19('0x43')]['id']}})['then'](handleEntityNotFound(_0x460e50,null))[_0xfd19('0x20')](function(_0xb712bc){if(_0xb712bc){return _0xb712bc['removeLists'](_0x13a71e['query'][_0xfd19('0x5e')]);}})['then'](function(_0x28955e){if(_0x28955e){return db[_0xfd19('0x51')][_0xfd19('0x7a')]({'where':{'ListId':_0x13a71e['query'][_0xfd19('0x5e')],'CampaignId':_0x13a71e['params']['id']}})[_0xfd19('0x20')](function(){return _0x28955e;});}})[_0xfd19('0x20')](respondWithStatusCode(_0x460e50,null))[_0xfd19('0x41')](handleError(_0x460e50,null));};exports[_0xfd19('0x7b')]=function(_0x14ad29,_0x56f3ca,_0x4ed6b9){var _0xdb849={'raw':!![],'where':{}};var _0x19edac={};var _0x5169d9={'count':0x0,'rows':[]};return db['Campaign'][_0xfd19('0x55')]({'where':{'id':_0x14ad29[_0xfd19('0x43')]['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x56f3ca,null))[_0xfd19('0x20')](function(_0x4367bf){if(_0x4367bf){_0x19edac[_0xfd19('0x29')]=_[_0xfd19('0x2a')](db[_0xfd19('0x7c')]['rawAttributes']);_0x19edac[_0xfd19('0x2b')]=_[_0xfd19('0x2a')](_0x14ad29[_0xfd19('0x2b')]);_0x19edac[_0xfd19('0x34')]=_[_0xfd19('0x2c')](_0x19edac['model'],_0x19edac[_0xfd19('0x2b')]);_0xdb849[_0xfd19('0x2d')]=_['intersection'](_0x19edac[_0xfd19('0x29')],qs[_0xfd19('0x2e')](_0x14ad29[_0xfd19('0x2b')][_0xfd19('0x2e')]));_0xdb849[_0xfd19('0x2d')]=_0xdb849[_0xfd19('0x2d')][_0xfd19('0x2f')]?_0xdb849['attributes']:_0x19edac[_0xfd19('0x29')];if(!_0x14ad29[_0xfd19('0x2b')]['hasOwnProperty'](_0xfd19('0x52'))){_0xdb849[_0xfd19('0x1b')]=qs[_0xfd19('0x1b')](_0x14ad29[_0xfd19('0x2b')][_0xfd19('0x1b')]);_0xdb849['offset']=qs[_0xfd19('0x1a')](_0x14ad29[_0xfd19('0x2b')]['offset']);}_0xdb849[_0xfd19('0x31')]=qs[_0xfd19('0x32')](_0x14ad29[_0xfd19('0x2b')][_0xfd19('0x32')]);_0xdb849[_0xfd19('0x33')]=qs[_0xfd19('0x34')](_[_0xfd19('0x35')](_0x14ad29[_0xfd19('0x2b')],_0x19edac[_0xfd19('0x34')]));_0xdb849['where'][_0xfd19('0x59')]=_0x4367bf['id'];if(_0x14ad29['query'][_0xfd19('0x36')]){_0xdb849[_0xfd19('0x33')]=_[_0xfd19('0x3b')](_0xdb849[_0xfd19('0x33')],{'$or':_['map'](_0xdb849[_0xfd19('0x2d')],function(_0x4bc6d5){var _0x1eb3eb={};_0x1eb3eb[_0x4bc6d5]={'$like':'%'+_0x14ad29[_0xfd19('0x2b')][_0xfd19('0x36')]+'%'};return _0x1eb3eb;})});}_0xdb849=_[_0xfd19('0x3b')]({},_0xdb849,_0x14ad29['options']);return db[_0xfd19('0x7c')][_0xfd19('0x3d')]({'where':_0xdb849[_0xfd19('0x33')]})[_0xfd19('0x20')](function(_0x486c14){_0x5169d9[_0xfd19('0x3d')]=_0x486c14;if(_0x14ad29['query'][_0xfd19('0x3e')]){_0xdb849[_0xfd19('0x3f')]=[{'all':!![]}];}return db['CmList'][_0xfd19('0x40')](_0xdb849);})['then'](function(_0x5f314d){_0x5169d9[_0xfd19('0x53')]=_0x5f314d;return _0x5169d9;});}})['then'](respondWithFilteredResult(_0x56f3ca,_0xdb849))[_0xfd19('0x41')](handleError(_0x56f3ca,null));};exports[_0xfd19('0x7d')]=function(_0x260134,_0x58cd94,_0x1e398a){var _0x1b6b0a,_0x143b67;return db[_0xfd19('0x27')]['find']({'where':{'id':_0x260134[_0xfd19('0x43')]['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x58cd94,null))[_0xfd19('0x20')](function(_0x51830e){if(_0x51830e){_0x143b67=_0x51830e;return _0x51830e[_0xfd19('0x7d')](_0x260134[_0xfd19('0x4e')][_0xfd19('0x5e')],_['omit'](_0x260134[_0xfd19('0x4e')],[_0xfd19('0x5e'),'id'])||{});}return null;})[_0xfd19('0x5f')](function(_0x20742c){var _0x56a6bb;_0x1b6b0a=_0x20742c||[];var _0x3e5461=[];if(_0x20742c){for(var _0x5c0eec=0x0;_0x5c0eec<_0x20742c[_0xfd19('0x2f')];_0x5c0eec+=0x1){var _0x2dabd6=_0x20742c[_0x5c0eec][_0xfd19('0x48')]({'plain':!![]});_0x56a6bb=squel[_0xfd19('0x62')]()['into'](_0xfd19('0x7e'))['fromQuery'](['phone',_0xfd19('0x68'),_0xfd19('0x69'),'CampaignId','createdAt',_0xfd19('0x4d')],squel[_0xfd19('0x6a')]()[_0xfd19('0x3a')](_0xfd19('0x66'),_0xfd19('0x66'))['field']('id','ContactId')['field'](_0x2dabd6[_0xfd19('0x6c')][_0xfd19('0x6d')](),_0xfd19('0x69'))[_0xfd19('0x3a')](_0x260134['params']['id']['toString'](),_0xfd19('0x59'))[_0xfd19('0x3a')](_0xfd19('0x6b'),_0xfd19('0x4c'))[_0xfd19('0x3a')](_0xfd19('0x6b'),_0xfd19('0x4d'))[_0xfd19('0x6e')]('cm_contacts')[_0xfd19('0x33')](_0xfd19('0x70'))[_0xfd19('0x33')](_0xfd19('0x71'),_0x2dabd6[_0xfd19('0x6c')][_0xfd19('0x6d')]())['where'](_0xfd19('0x72')))['toString']();_0x3e5461['push'](db[_0xfd19('0x77')]['query'](_0x56a6bb));}return BPromise[_0xfd19('0x78')](_0x3e5461);}})[_0xfd19('0x20')](function(){return _0x1b6b0a;})[_0xfd19('0x20')](respondWithResult(_0x58cd94,null))[_0xfd19('0x41')](handleError(_0x58cd94,null));};exports['removeBlackLists']=function(_0x43fb80,_0x4d10d9,_0x334897){return db[_0xfd19('0x27')][_0xfd19('0x44')]({'where':{'id':_0x43fb80['params']['id']}})[_0xfd19('0x20')](handleEntityNotFound(_0x4d10d9,null))[_0xfd19('0x20')](function(_0x542691){if(_0x542691){return _0x542691['removeBlackLists'](_0x43fb80[_0xfd19('0x2b')][_0xfd19('0x5e')]);}})[_0xfd19('0x20')](function(_0x564da8){if(_0x564da8){return db[_0xfd19('0x5b')][_0xfd19('0x7a')]({'where':{'ListId':_0x43fb80[_0xfd19('0x2b')]['ids'],'CampaignId':_0x43fb80['params']['id']}})[_0xfd19('0x20')](function(){return _0x564da8;});}})[_0xfd19('0x20')](respondWithStatusCode(_0x4d10d9,null))[_0xfd19('0x41')](handleError(_0x4d10d9,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 00fe1b8..564b007 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 _0x4272=['lodash','util','bluebird','path','../../config/environment','exports','Campaign','campaigns'];(function(_0x59e35c,_0x5d3c07){var _0x9c8398=function(_0x227239){while(--_0x227239){_0x59e35c['push'](_0x59e35c['shift']());}};_0x9c8398(++_0x5d3c07);}(_0x4272,0x170));var _0x2427=function(_0xf6f77,_0x2ec8fc){_0xf6f77=_0xf6f77-0x0;var _0x23dcb0=_0x4272[_0xf6f77];return _0x23dcb0;};'use strict';var _=require(_0x2427('0x0'));var util=require(_0x2427('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2427('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2427('0x3'));var rimraf=require('rimraf');var config=require(_0x2427('0x4'));var attributes=require('./campaign.attributes');module[_0x2427('0x5')]=function(_0x4f1b9d,_0x284260){return _0x4f1b9d['define'](_0x2427('0x6'),attributes,{'tableName':_0x2427('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3ee=['exports','Campaign','api','bluebird','request-promise','rimraf','./campaign.attributes'];(function(_0x5238b1,_0x5f5531){var _0x297ec8=function(_0x268b90){while(--_0x268b90){_0x5238b1['push'](_0x5238b1['shift']());}};_0x297ec8(++_0x5f5531);}(_0xd3ee,0xa3));var _0xed3e=function(_0x25a86b,_0x269489){_0x25a86b=_0x25a86b-0x0;var _0x584cac=_0xd3ee[_0x25a86b];return _0x584cac;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xed3e('0x0'));var moment=require('moment');var BPromise=require(_0xed3e('0x1'));var rp=require(_0xed3e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed3e('0x3'));var config=require('../../config/environment');var attributes=require(_0xed3e('0x4'));module[_0xed3e('0x5')]=function(_0x1d679f,_0x38420e){return _0x1d679f['define'](_0xed3e('0x6'),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 25c7004..7a0dda5 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(_0x7ae804,_0x3c2ccb){var _0xf8e059=function(_0x2d49a0){while(--_0x2d49a0){_0x7ae804['push'](_0x7ae804['shift']());}};_0xf8e059(++_0x3c2ccb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x456709,_0x528f8c){var _0x3d1793=function(_0x4433fa){while(--_0x4433fa){_0x456709['push'](_0x456709['shift']());}};_0x3d1793(++_0x528f8c);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 4206049..7b0d42e 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 _0xa9f0=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','/:id','update','destroy','delete','removeBlackLists','exports','multer'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9f0,0x153));var _0x0a9f=function(_0x1450e4,_0x18699f){_0x1450e4=_0x1450e4-0x0;var _0x166ac0=_0xa9f0[_0x1450e4];return _0x166ac0;};'use strict';var multer=require(_0x0a9f('0x0'));var util=require('util');var path=require(_0x0a9f('0x1'));var timeout=require(_0x0a9f('0x2'));var express=require(_0x0a9f('0x3'));var router=express[_0x0a9f('0x4')]();var auth=require(_0x0a9f('0x5'));var interaction=require(_0x0a9f('0x6'));var config=require(_0x0a9f('0x7'));var controller=require(_0x0a9f('0x8'));router['get']('/',auth[_0x0a9f('0x9')](),controller['index']);router[_0x0a9f('0xa')]('/:id',auth[_0x0a9f('0x9')](),controller[_0x0a9f('0xb')]);router[_0x0a9f('0xa')](_0x0a9f('0xc'),auth['isAuthenticated'](),controller[_0x0a9f('0xd')]);router[_0x0a9f('0xa')](_0x0a9f('0xe'),auth[_0x0a9f('0x9')](),controller['getHopperHistories']);router['get'](_0x0a9f('0xf'),auth[_0x0a9f('0x9')](),controller[_0x0a9f('0x10')]);router[_0x0a9f('0xa')](_0x0a9f('0x11'),auth[_0x0a9f('0x9')](),controller[_0x0a9f('0x12')]);router[_0x0a9f('0xa')](_0x0a9f('0x13'),auth[_0x0a9f('0x9')](),controller[_0x0a9f('0x14')]);router[_0x0a9f('0xa')](_0x0a9f('0x15'),auth['isAuthenticated'](),controller[_0x0a9f('0x16')]);router[_0x0a9f('0x17')]('/',auth[_0x0a9f('0x9')](),controller[_0x0a9f('0x18')]);router[_0x0a9f('0x17')](_0x0a9f('0x19'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/lists',auth[_0x0a9f('0x9')](),controller[_0x0a9f('0x1a')]);router['post'](_0x0a9f('0x15'),auth[_0x0a9f('0x9')](),controller[_0x0a9f('0x1b')]);router['put'](_0x0a9f('0x1c'),auth[_0x0a9f('0x9')](),controller[_0x0a9f('0x1d')]);router['delete'](_0x0a9f('0x1c'),auth['isAuthenticated'](),controller[_0x0a9f('0x1e')]);router[_0x0a9f('0x1f')](_0x0a9f('0x13'),auth[_0x0a9f('0x9')](),controller['removeLists']);router['delete'](_0x0a9f('0x15'),auth[_0x0a9f('0x9')](),controller[_0x0a9f('0x20')]);module[_0x0a9f('0x21')]=router; \ No newline at end of file +var _0x3aa2=['/:id/lists','addLists','addBlackLists','delete','removeLists','removeBlackLists','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','get','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','post','clone'];(function(_0x239273,_0xab8a05){var _0x5017b8=function(_0x51d2fe){while(--_0x51d2fe){_0x239273['push'](_0x239273['shift']());}};_0x5017b8(++_0xab8a05);}(_0x3aa2,0x13b));var _0x23aa=function(_0x12551a,_0x5af080){_0x12551a=_0x12551a-0x0;var _0x6f8fc0=_0x3aa2[_0x12551a];return _0x6f8fc0;};'use strict';var multer=require(_0x23aa('0x0'));var util=require(_0x23aa('0x1'));var path=require('path');var timeout=require(_0x23aa('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x23aa('0x3'));var interaction=require(_0x23aa('0x4'));var config=require('../../config/environment');var controller=require(_0x23aa('0x5'));router['get']('/',auth[_0x23aa('0x6')](),controller[_0x23aa('0x7')]);router['get'](_0x23aa('0x8'),auth[_0x23aa('0x6')](),controller[_0x23aa('0x9')]);router['get'](_0x23aa('0xa'),auth[_0x23aa('0x6')](),controller[_0x23aa('0xb')]);router['get']('/:id/hopper_histories',auth[_0x23aa('0x6')](),controller['getHopperHistories']);router[_0x23aa('0xc')](_0x23aa('0xd'),auth[_0x23aa('0x6')](),controller[_0x23aa('0xe')]);router[_0x23aa('0xc')](_0x23aa('0xf'),auth[_0x23aa('0x6')](),controller['getHopperBlacks']);router['get']('/:id/lists',auth[_0x23aa('0x6')](),controller[_0x23aa('0x10')]);router[_0x23aa('0xc')](_0x23aa('0x11'),auth[_0x23aa('0x6')](),controller[_0x23aa('0x12')]);router[_0x23aa('0x13')]('/',auth[_0x23aa('0x6')](),controller['create']);router[_0x23aa('0x13')]('/:id/clone',auth['isAuthenticated'](),controller[_0x23aa('0x14')]);router[_0x23aa('0x13')](_0x23aa('0x15'),auth[_0x23aa('0x6')](),controller[_0x23aa('0x16')]);router[_0x23aa('0x13')]('/:id/blacklists',auth[_0x23aa('0x6')](),controller[_0x23aa('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x23aa('0x18')](_0x23aa('0x8'),auth[_0x23aa('0x6')](),controller['destroy']);router[_0x23aa('0x18')](_0x23aa('0x15'),auth['isAuthenticated'](),controller[_0x23aa('0x19')]);router[_0x23aa('0x18')](_0x23aa('0x11'),auth[_0x23aa('0x6')](),controller[_0x23aa('0x1a')]);module[_0x23aa('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f20c37f..52b6a0e 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 _0xcffa=['VIRTUAL','getDataValue','key','sequelize','STRING','TEXT'];(function(_0x1b12e6,_0x120ff2){var _0x2710c4=function(_0x49bf0d){while(--_0x49bf0d){_0x1b12e6['push'](_0x1b12e6['shift']());}};_0x2710c4(++_0x120ff2);}(_0xcffa,0x189));var _0xacff=function(_0x421476,_0x268c5d){_0x421476=_0x421476-0x0;var _0x4d5ab3=_0xcffa[_0x421476];return _0x4d5ab3;};'use strict';var Sequelize=require(_0xacff('0x0'));module['exports']={'key':{'type':Sequelize[_0xacff('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xacff('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xacff('0x1')]},'name':{'type':Sequelize[_0xacff('0x3')],'get':function(){return this[_0xacff('0x4')](_0xacff('0x5'));}}}; \ No newline at end of file +var _0x9a07=['key','sequelize','exports','STRING','TEXT','getDataValue'];(function(_0x449cec,_0x26e46a){var _0x2edb1c=function(_0x308faf){while(--_0x308faf){_0x449cec['push'](_0x449cec['shift']());}};_0x2edb1c(++_0x26e46a);}(_0x9a07,0xaf));var _0x79a0=function(_0x28d59f,_0x39af9d){_0x28d59f=_0x28d59f-0x0;var _0xfb81ee=_0x9a07[_0x28d59f];return _0xfb81ee;};'use strict';var Sequelize=require(_0x79a0('0x0'));module[_0x79a0('0x1')]={'key':{'type':Sequelize[_0x79a0('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x79a0('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x79a0('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x79a0('0x4')](_0x79a0('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 07b3b03..964f95a 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 _0xd87a=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','then','CannedAnswers','UserProfileResource','error','stack','name','send','index','CannedAnswer','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','type','VIRTUAL','field','options','includeAll','include','findAll','rows','show','merge','find','body','params','catch','key','MailAccountId','SmsAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xd87a,0x1f4));var _0xad87=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0xd87a[_0x2850c0];return _0x21e830;};'use strict';var pdf=require(_0xad87('0x0'));var emlformat=require(_0xad87('0x1'));var rimraf=require(_0xad87('0x2'));var zipdir=require(_0xad87('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad87('0x4'));var moment=require(_0xad87('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xad87('0x6'));var path=require(_0xad87('0x7'));var sox=require(_0xad87('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xad87('0x9'));var jsforce=require(_0xad87('0xa'));var deskjs=require(_0xad87('0xb'));var toCsv=require(_0xad87('0xc'));var querystring=require(_0xad87('0xd'));var Papa=require(_0xad87('0xe'));var Redis=require(_0xad87('0xf'));var authService=require(_0xad87('0x10'));var qs=require(_0xad87('0x11'));var hardwareService=require(_0xad87('0x12'));var logger=require(_0xad87('0x13'))(_0xad87('0x14'));var utils=require('../../config/utils');var config=require(_0xad87('0x15'));var db=require(_0xad87('0x16'))['db'];function respondWithStatusCode(_0x546f8b,_0x1a2976){_0x1a2976=_0x1a2976||0xcc;return function(_0x438df4){if(_0x438df4){return _0x546f8b[_0xad87('0x17')](_0x1a2976);}return _0x546f8b[_0xad87('0x18')](_0x1a2976)[_0xad87('0x19')]();};}function respondWithResult(_0x23f918,_0x18d2c6){_0x18d2c6=_0x18d2c6||0xc8;return function(_0x3ccecb){if(_0x3ccecb){return _0x23f918['status'](_0x18d2c6)[_0xad87('0x1a')](_0x3ccecb);}};}function respondWithFilteredResult(_0x3e38be,_0x5bb48a){return function(_0x26e640){if(_0x26e640){var _0x4f3855=_0x26e640[_0xad87('0x1b')],_0x5f556e=_0x5bb48a[_0xad87('0x1c')],_0x3abc83=_0x5bb48a[_0xad87('0x1c')]+_0x5bb48a[_0xad87('0x1d')],_0x2457ad;if(_0x3abc83>=_0x4f3855){_0x3abc83=_0x4f3855;_0x2457ad=0xc8;}else{_0x2457ad=0xce;}_0x3e38be[_0xad87('0x18')](_0x2457ad);return _0x3e38be[_0xad87('0x1e')]('Content-Range',_0x5f556e+'-'+_0x3abc83+'/'+_0x4f3855)['json'](_0x26e640);}return null;};}function patchUpdates(_0x600444){return function(_0x6da851){try{jsonpatch[_0xad87('0x1f')](_0x6da851,_0x600444,!![]);}catch(_0x31318e){return BPromise['reject'](_0x31318e);}return _0x6da851[_0xad87('0x20')]();};}function saveUpdates(_0x38f1f0,_0x5a8c88){return function(_0x513cf8){if(_0x513cf8){return _0x513cf8[_0xad87('0x21')](_0x38f1f0)['then'](function(_0x247aa4){return _0x247aa4;});}return null;};}function removeEntity(_0x3e7554,_0x133f68){return function(_0x339057){if(_0x339057){return _0x339057[_0xad87('0x22')]()[_0xad87('0x23')](function(){var _0x1b32ec=_0x339057['get']({'plain':!![]});var _0x54c620=_0xad87('0x24');return db[_0xad87('0x25')][_0xad87('0x22')]({'where':{'type':_0x54c620,'resourceId':_0x1b32ec['id']}})[_0xad87('0x23')](function(){return _0x339057;});})[_0xad87('0x23')](function(){_0x3e7554[_0xad87('0x18')](0xcc)[_0xad87('0x19')]();});}};}function handleEntityNotFound(_0x3ba3fb,_0x1d1eb8){return function(_0x3fc812){if(!_0x3fc812){_0x3ba3fb['sendStatus'](0x194);}return _0x3fc812;};}function handleError(_0x411436,_0x5d73d9){_0x5d73d9=_0x5d73d9||0x1f4;return function(_0x30f328){logger[_0xad87('0x26')](_0x30f328[_0xad87('0x27')]);if(_0x30f328[_0xad87('0x28')]){delete _0x30f328[_0xad87('0x28')];}_0x411436[_0xad87('0x18')](_0x5d73d9)[_0xad87('0x29')](_0x30f328);};}exports[_0xad87('0x2a')]=function(_0x1ffcb8,_0x5e1ad4){var _0x343d91={},_0x1738b9={},_0x45928b={'count':0x0,'rows':[]};var _0x1a05fe=db[_0xad87('0x2b')][_0xad87('0x2c')];_0x1738b9[_0xad87('0x2d')]=_[_0xad87('0x2e')](_0x1a05fe);_0x1738b9['query']=_[_0xad87('0x2e')](_0x1ffcb8[_0xad87('0x2f')]);_0x1738b9[_0xad87('0x30')]=_[_0xad87('0x31')](_0x1738b9[_0xad87('0x2d')],_0x1738b9[_0xad87('0x2f')]);_0x343d91[_0xad87('0x32')]=_[_0xad87('0x31')](_0x1738b9[_0xad87('0x2d')],qs[_0xad87('0x33')](_0x1ffcb8[_0xad87('0x2f')][_0xad87('0x33')]));_0x343d91['attributes']=_0x343d91[_0xad87('0x32')][_0xad87('0x34')]?_0x343d91[_0xad87('0x32')]:_0x1738b9[_0xad87('0x2d')];if(!_0x1ffcb8[_0xad87('0x2f')][_0xad87('0x35')](_0xad87('0x36'))){_0x343d91[_0xad87('0x1d')]=qs[_0xad87('0x1d')](_0x1ffcb8[_0xad87('0x2f')][_0xad87('0x1d')]);_0x343d91[_0xad87('0x1c')]=qs[_0xad87('0x1c')](_0x1ffcb8[_0xad87('0x2f')][_0xad87('0x1c')]);}_0x343d91[_0xad87('0x37')]=qs['sort'](_0x1ffcb8['query']['sort']);_0x343d91['where']=qs[_0xad87('0x30')](_[_0xad87('0x38')](_0x1ffcb8[_0xad87('0x2f')],_0x1738b9[_0xad87('0x30')]));if(_0x1ffcb8[_0xad87('0x2f')][_0xad87('0x39')]){_0x343d91[_0xad87('0x3a')]=_['merge'](_0x343d91[_0xad87('0x3a')],{'$or':_['map'](_0x1a05fe,function(_0x13cc7d){if(_0x13cc7d[_0xad87('0x3b')]['key']!==_0xad87('0x3c')){var _0x2c50aa={};_0x2c50aa[_0x13cc7d[_0xad87('0x3d')]]={'$like':'%'+_0x1ffcb8[_0xad87('0x2f')][_0xad87('0x39')]+'%'};return _0x2c50aa;}})});}_0x343d91=_['merge']({},_0x343d91,_0x1ffcb8[_0xad87('0x3e')]);var _0x4454b0={'where':_0x343d91[_0xad87('0x3a')]};return db[_0xad87('0x2b')][_0xad87('0x1b')](_0x4454b0)[_0xad87('0x23')](function(_0x1404a3){_0x45928b['count']=_0x1404a3;if(_0x1ffcb8[_0xad87('0x2f')][_0xad87('0x3f')]){_0x343d91[_0xad87('0x40')]=[{'all':!![]}];}return db['CannedAnswer'][_0xad87('0x41')](_0x343d91);})[_0xad87('0x23')](function(_0x9f80a6){_0x45928b[_0xad87('0x42')]=_0x9f80a6;return _0x45928b;})[_0xad87('0x23')](respondWithFilteredResult(_0x5e1ad4,_0x343d91))['catch'](handleError(_0x5e1ad4,null));};exports[_0xad87('0x43')]=function(_0x56f41d,_0x19d95d){var _0x45b87c={'raw':!![],'where':{'id':_0x56f41d['params']['id']}},_0x1d0533={};_0x1d0533[_0xad87('0x2d')]=_[_0xad87('0x2e')](db[_0xad87('0x2b')][_0xad87('0x2c')]);_0x1d0533[_0xad87('0x2f')]=_[_0xad87('0x2e')](_0x56f41d[_0xad87('0x2f')]);_0x1d0533[_0xad87('0x30')]=_[_0xad87('0x31')](_0x1d0533[_0xad87('0x2d')],_0x1d0533['query']);_0x45b87c[_0xad87('0x32')]=_['intersection'](_0x1d0533[_0xad87('0x2d')],qs[_0xad87('0x33')](_0x56f41d[_0xad87('0x2f')]['fields']));_0x45b87c[_0xad87('0x32')]=_0x45b87c[_0xad87('0x32')][_0xad87('0x34')]?_0x45b87c['attributes']:_0x1d0533[_0xad87('0x2d')];if(_0x56f41d[_0xad87('0x2f')][_0xad87('0x3f')]){_0x45b87c[_0xad87('0x40')]=[{'all':!![]}];}_0x45b87c=_[_0xad87('0x44')]({},_0x45b87c,_0x56f41d[_0xad87('0x3e')]);return db[_0xad87('0x2b')][_0xad87('0x45')](_0x45b87c)[_0xad87('0x23')](handleEntityNotFound(_0x19d95d,null))[_0xad87('0x23')](respondWithResult(_0x19d95d,null))['catch'](handleError(_0x19d95d,null));};exports[_0xad87('0x21')]=function(_0x41b42f,_0x16d1bc){if(_0x41b42f['body']['id']){delete _0x41b42f[_0xad87('0x46')]['id'];}return db['CannedAnswer'][_0xad87('0x45')]({'where':{'id':_0x41b42f[_0xad87('0x47')]['id']}})[_0xad87('0x23')](handleEntityNotFound(_0x16d1bc,null))[_0xad87('0x23')](saveUpdates(_0x41b42f[_0xad87('0x46')],null))[_0xad87('0x23')](respondWithResult(_0x16d1bc,null))[_0xad87('0x48')](handleError(_0x16d1bc,null));};exports[_0xad87('0x22')]=function(_0x5c5bc5,_0x1d32f5){return db[_0xad87('0x2b')][_0xad87('0x45')]({'where':{'id':_0x5c5bc5[_0xad87('0x47')]['id']}})[_0xad87('0x23')](handleEntityNotFound(_0x1d32f5,null))['then'](removeEntity(_0x1d32f5,null))[_0xad87('0x48')](handleError(_0x1d32f5,null));};exports['create']=function(_0x2a8447,_0x273800){var _0x4c7e1e={'key':_0x2a8447[_0xad87('0x46')][_0xad87('0x49')]};if(_0x2a8447['body'][_0xad87('0x4a')]){_0x4c7e1e[_0xad87('0x4a')]=_0x2a8447[_0xad87('0x46')][_0xad87('0x4a')];}else if(_0x2a8447[_0xad87('0x46')][_0xad87('0x4b')]){_0x4c7e1e[_0xad87('0x4b')]=_0x2a8447['body'][_0xad87('0x4b')];}else if(_0x2a8447[_0xad87('0x46')]['OpenchannelAccountId']){_0x4c7e1e['OpenchannelAccountId']=_0x2a8447[_0xad87('0x46')]['OpenchannelAccountId'];}else if(_0x2a8447[_0xad87('0x46')][_0xad87('0x4c')]){_0x4c7e1e[_0xad87('0x4c')]=_0x2a8447[_0xad87('0x46')][_0xad87('0x4c')];}return db[_0xad87('0x2b')]['find']({'where':_0x4c7e1e})[_0xad87('0x23')](function(_0xc051dc){if(_0xc051dc){throw new db[(_0xad87('0x4d'))][(_0xad87('0x4e'))](_0xad87('0x4f'));}return db['CannedAnswer'][_0xad87('0x50')](_0x2a8447['body']);})['then'](function(_0x3c1090){var _0x200255=_0x2a8447[_0xad87('0x51')]['get']({'plain':!![]});if(!_0x200255)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200255[_0xad87('0x52')]===_0xad87('0x51')){var _0xbf0366=_0x3c1090[_0xad87('0x53')]({'plain':!![]});return db['UserProfileSection'][_0xad87('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x200255[_0xad87('0x54')]},'raw':!![]})[_0xad87('0x23')](function(_0x5d98b7){if(_0x5d98b7&&_0x5d98b7[_0xad87('0x55')]===0x0){return db[_0xad87('0x25')][_0xad87('0x50')]({'name':_0xbf0366['name'],'resourceId':_0xbf0366['id'],'type':_0x5d98b7[_0xad87('0x28')],'sectionId':_0x5d98b7['id']},{})['then'](function(){return _0x3c1090;});}else{return _0x3c1090;}})[_0xad87('0x48')](function(_0x46f87c){logger[_0xad87('0x26')](_0xad87('0x56'),_0x46f87c);throw _0x46f87c;});}return _0x3c1090;})[_0xad87('0x23')](respondWithResult(_0x273800,0xc9))[_0xad87('0x48')](handleError(_0x273800,null));}; \ No newline at end of file +var _0x8a46=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','field','options','CannedAnswer','includeAll','include','rows','catch','show','body','find','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8a46,0x152));var _0x68a4=function(_0x4d6f65,_0x397489){_0x4d6f65=_0x4d6f65-0x0;var _0x48d0e8=_0x8a46[_0x4d6f65];return _0x48d0e8;};'use strict';var pdf=require(_0x68a4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x68a4('0x1'));var jsonpatch=require(_0x68a4('0x2'));var rp=require(_0x68a4('0x3'));var moment=require(_0x68a4('0x4'));var BPromise=require(_0x68a4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x68a4('0x6'));var sox=require(_0x68a4('0x7'));var csv=require(_0x68a4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x68a4('0x9'));var squel=require(_0x68a4('0xa'));var crypto=require('crypto');var jsforce=require(_0x68a4('0xb'));var deskjs=require(_0x68a4('0xc'));var toCsv=require(_0x68a4('0x8'));var querystring=require('querystring');var Papa=require(_0x68a4('0xd'));var Redis=require('ioredis');var authService=require(_0x68a4('0xe'));var qs=require(_0x68a4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68a4('0x10'));var utils=require(_0x68a4('0x11'));var config=require(_0x68a4('0x12'));var db=require(_0x68a4('0x13'))['db'];function respondWithStatusCode(_0x5f371f,_0x2efe35){_0x2efe35=_0x2efe35||0xcc;return function(_0x4547ac){if(_0x4547ac){return _0x5f371f[_0x68a4('0x14')](_0x2efe35);}return _0x5f371f[_0x68a4('0x15')](_0x2efe35)[_0x68a4('0x16')]();};}function respondWithResult(_0x4c0512,_0x43495d){_0x43495d=_0x43495d||0xc8;return function(_0x48942e){if(_0x48942e){return _0x4c0512['status'](_0x43495d)[_0x68a4('0x17')](_0x48942e);}};}function respondWithFilteredResult(_0x10883d,_0x23f321){return function(_0x33f958){if(_0x33f958){var _0x1dc45b=_0x33f958[_0x68a4('0x18')],_0x43cb2b=_0x23f321[_0x68a4('0x19')],_0x386611=_0x23f321[_0x68a4('0x19')]+_0x23f321[_0x68a4('0x1a')],_0x1e87de;if(_0x386611>=_0x1dc45b){_0x386611=_0x1dc45b;_0x1e87de=0xc8;}else{_0x1e87de=0xce;}_0x10883d[_0x68a4('0x15')](_0x1e87de);return _0x10883d['set'](_0x68a4('0x1b'),_0x43cb2b+'-'+_0x386611+'/'+_0x1dc45b)[_0x68a4('0x17')](_0x33f958);}return null;};}function patchUpdates(_0xed2e6c){return function(_0x3a44d2){try{jsonpatch[_0x68a4('0x1c')](_0x3a44d2,_0xed2e6c,!![]);}catch(_0x1d7a71){return BPromise[_0x68a4('0x1d')](_0x1d7a71);}return _0x3a44d2[_0x68a4('0x1e')]();};}function saveUpdates(_0x567ed6,_0x115e93){return function(_0x184dda){if(_0x184dda){return _0x184dda[_0x68a4('0x1f')](_0x567ed6)[_0x68a4('0x20')](function(_0x5e09b0){return _0x5e09b0;});}return null;};}function removeEntity(_0x330570,_0x2511f7){return function(_0x292b58){if(_0x292b58){return _0x292b58['destroy']()[_0x68a4('0x20')](function(){var _0x3e0ae8=_0x292b58[_0x68a4('0x21')]({'plain':!![]});var _0x1d61d4=_0x68a4('0x22');return db[_0x68a4('0x23')][_0x68a4('0x24')]({'where':{'type':_0x1d61d4,'resourceId':_0x3e0ae8['id']}})['then'](function(){return _0x292b58;});})['then'](function(){_0x330570['status'](0xcc)[_0x68a4('0x16')]();});}};}function handleEntityNotFound(_0x44b6d3,_0x519459){return function(_0x2fd8fa){if(!_0x2fd8fa){_0x44b6d3[_0x68a4('0x14')](0x194);}return _0x2fd8fa;};}function handleError(_0x3f09ff,_0x501fe9){_0x501fe9=_0x501fe9||0x1f4;return function(_0x4c2482){logger[_0x68a4('0x25')](_0x4c2482['stack']);if(_0x4c2482[_0x68a4('0x26')]){delete _0x4c2482[_0x68a4('0x26')];}_0x3f09ff[_0x68a4('0x15')](_0x501fe9)[_0x68a4('0x27')](_0x4c2482);};}exports[_0x68a4('0x28')]=function(_0x1b9dc2,_0x3a4a1a){var _0x3d1d59={},_0x52b308={},_0x3bf33a={'count':0x0,'rows':[]};var _0x555b6e=db['CannedAnswer'][_0x68a4('0x29')];_0x52b308[_0x68a4('0x2a')]=_[_0x68a4('0x2b')](_0x555b6e);_0x52b308['query']=_[_0x68a4('0x2b')](_0x1b9dc2[_0x68a4('0x2c')]);_0x52b308[_0x68a4('0x2d')]=_[_0x68a4('0x2e')](_0x52b308[_0x68a4('0x2a')],_0x52b308[_0x68a4('0x2c')]);_0x3d1d59[_0x68a4('0x2f')]=_[_0x68a4('0x2e')](_0x52b308[_0x68a4('0x2a')],qs[_0x68a4('0x30')](_0x1b9dc2['query']['fields']));_0x3d1d59[_0x68a4('0x2f')]=_0x3d1d59['attributes'][_0x68a4('0x31')]?_0x3d1d59['attributes']:_0x52b308[_0x68a4('0x2a')];if(!_0x1b9dc2[_0x68a4('0x2c')][_0x68a4('0x32')](_0x68a4('0x33'))){_0x3d1d59[_0x68a4('0x1a')]=qs[_0x68a4('0x1a')](_0x1b9dc2[_0x68a4('0x2c')][_0x68a4('0x1a')]);_0x3d1d59['offset']=qs[_0x68a4('0x19')](_0x1b9dc2[_0x68a4('0x2c')][_0x68a4('0x19')]);}_0x3d1d59[_0x68a4('0x34')]=qs[_0x68a4('0x35')](_0x1b9dc2[_0x68a4('0x2c')][_0x68a4('0x35')]);_0x3d1d59['where']=qs[_0x68a4('0x2d')](_[_0x68a4('0x36')](_0x1b9dc2['query'],_0x52b308[_0x68a4('0x2d')]));if(_0x1b9dc2[_0x68a4('0x2c')][_0x68a4('0x37')]){_0x3d1d59[_0x68a4('0x38')]=_[_0x68a4('0x39')](_0x3d1d59[_0x68a4('0x38')],{'$or':_[_0x68a4('0x3a')](_0x555b6e,function(_0x530a05){if(_0x530a05[_0x68a4('0x3b')]['key']!=='VIRTUAL'){var _0x1f9a22={};_0x1f9a22[_0x530a05[_0x68a4('0x3c')]]={'$like':'%'+_0x1b9dc2[_0x68a4('0x2c')][_0x68a4('0x37')]+'%'};return _0x1f9a22;}})});}_0x3d1d59=_[_0x68a4('0x39')]({},_0x3d1d59,_0x1b9dc2[_0x68a4('0x3d')]);var _0x5aacfe={'where':_0x3d1d59[_0x68a4('0x38')]};return db[_0x68a4('0x3e')]['count'](_0x5aacfe)[_0x68a4('0x20')](function(_0x5acdf6){_0x3bf33a[_0x68a4('0x18')]=_0x5acdf6;if(_0x1b9dc2['query'][_0x68a4('0x3f')]){_0x3d1d59[_0x68a4('0x40')]=[{'all':!![]}];}return db[_0x68a4('0x3e')]['findAll'](_0x3d1d59);})[_0x68a4('0x20')](function(_0xed318a){_0x3bf33a[_0x68a4('0x41')]=_0xed318a;return _0x3bf33a;})[_0x68a4('0x20')](respondWithFilteredResult(_0x3a4a1a,_0x3d1d59))[_0x68a4('0x42')](handleError(_0x3a4a1a,null));};exports[_0x68a4('0x43')]=function(_0x280a64,_0x1db1aa){var _0x1cff0d={'raw':!![],'where':{'id':_0x280a64['params']['id']}},_0x1ad8c2={};_0x1ad8c2['model']=_[_0x68a4('0x2b')](db[_0x68a4('0x3e')][_0x68a4('0x29')]);_0x1ad8c2[_0x68a4('0x2c')]=_[_0x68a4('0x2b')](_0x280a64['query']);_0x1ad8c2[_0x68a4('0x2d')]=_['intersection'](_0x1ad8c2[_0x68a4('0x2a')],_0x1ad8c2[_0x68a4('0x2c')]);_0x1cff0d['attributes']=_['intersection'](_0x1ad8c2['model'],qs[_0x68a4('0x30')](_0x280a64['query'][_0x68a4('0x30')]));_0x1cff0d['attributes']=_0x1cff0d[_0x68a4('0x2f')][_0x68a4('0x31')]?_0x1cff0d['attributes']:_0x1ad8c2['model'];if(_0x280a64[_0x68a4('0x2c')][_0x68a4('0x3f')]){_0x1cff0d[_0x68a4('0x40')]=[{'all':!![]}];}_0x1cff0d=_[_0x68a4('0x39')]({},_0x1cff0d,_0x280a64[_0x68a4('0x3d')]);return db['CannedAnswer']['find'](_0x1cff0d)['then'](handleEntityNotFound(_0x1db1aa,null))[_0x68a4('0x20')](respondWithResult(_0x1db1aa,null))[_0x68a4('0x42')](handleError(_0x1db1aa,null));};exports['update']=function(_0x2d14c3,_0x18d148){if(_0x2d14c3[_0x68a4('0x44')]['id']){delete _0x2d14c3[_0x68a4('0x44')]['id'];}return db[_0x68a4('0x3e')][_0x68a4('0x45')]({'where':{'id':_0x2d14c3[_0x68a4('0x46')]['id']}})[_0x68a4('0x20')](handleEntityNotFound(_0x18d148,null))[_0x68a4('0x20')](saveUpdates(_0x2d14c3[_0x68a4('0x44')],null))['then'](respondWithResult(_0x18d148,null))[_0x68a4('0x42')](handleError(_0x18d148,null));};exports[_0x68a4('0x24')]=function(_0x3ad7db,_0x351d8a){return db[_0x68a4('0x3e')][_0x68a4('0x45')]({'where':{'id':_0x3ad7db[_0x68a4('0x46')]['id']}})[_0x68a4('0x20')](handleEntityNotFound(_0x351d8a,null))[_0x68a4('0x20')](removeEntity(_0x351d8a,null))[_0x68a4('0x42')](handleError(_0x351d8a,null));};exports[_0x68a4('0x47')]=function(_0xb63476,_0x29d32c){var _0x25ba1e={'key':_0xb63476[_0x68a4('0x44')][_0x68a4('0x48')]};if(_0xb63476[_0x68a4('0x44')][_0x68a4('0x49')]){_0x25ba1e['MailAccountId']=_0xb63476[_0x68a4('0x44')][_0x68a4('0x49')];}else if(_0xb63476[_0x68a4('0x44')][_0x68a4('0x4a')]){_0x25ba1e[_0x68a4('0x4a')]=_0xb63476[_0x68a4('0x44')][_0x68a4('0x4a')];}else if(_0xb63476['body'][_0x68a4('0x4b')]){_0x25ba1e['OpenchannelAccountId']=_0xb63476['body'][_0x68a4('0x4b')];}else if(_0xb63476[_0x68a4('0x44')][_0x68a4('0x4c')]){_0x25ba1e['ChatWebsiteId']=_0xb63476[_0x68a4('0x44')][_0x68a4('0x4c')];}return db[_0x68a4('0x3e')]['find']({'where':_0x25ba1e})[_0x68a4('0x20')](function(_0x3f8651){if(_0x3f8651){throw new db[(_0x68a4('0x4d'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x68a4('0x3e')]['create'](_0xb63476[_0x68a4('0x44')]);})[_0x68a4('0x20')](function(_0x4e39f9){var _0x37d27f=_0xb63476[_0x68a4('0x4e')]['get']({'plain':!![]});if(!_0x37d27f)throw new Error(_0x68a4('0x4f'));if(_0x37d27f[_0x68a4('0x50')]===_0x68a4('0x4e')){var _0xdf48c5=_0x4e39f9[_0x68a4('0x21')]({'plain':!![]});return db[_0x68a4('0x51')][_0x68a4('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x37d27f[_0x68a4('0x52')]},'raw':!![]})[_0x68a4('0x20')](function(_0x5501ea){if(_0x5501ea&&_0x5501ea['autoAssociation']===0x0){return db['UserProfileResource'][_0x68a4('0x47')]({'name':_0xdf48c5[_0x68a4('0x26')],'resourceId':_0xdf48c5['id'],'type':_0x5501ea[_0x68a4('0x26')],'sectionId':_0x5501ea['id']},{})[_0x68a4('0x20')](function(){return _0x4e39f9;});}else{return _0x4e39f9;}})[_0x68a4('0x42')](function(_0x2b16c9){logger[_0x68a4('0x25')](_0x68a4('0x53'),_0x2b16c9);throw _0x2b16c9;});}return _0x4e39f9;})[_0x68a4('0x20')](respondWithResult(_0x29d32c,0xc9))['catch'](handleError(_0x29d32c,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 6668bca..57b93fb 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 _0x0f1e=['tools_canned_answers','utf8mb4','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f1e,0x18e));var _0xe0f1=function(_0xcd13ec,_0x2b9db5){_0xcd13ec=_0xcd13ec-0x0;var _0x11bc04=_0x0f1e[_0xcd13ec];return _0x11bc04;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe0f1('0x0'))('api');var moment=require(_0xe0f1('0x1'));var BPromise=require(_0xe0f1('0x2'));var rp=require(_0xe0f1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0f1('0x4'));var config=require(_0xe0f1('0x5'));var attributes=require(_0xe0f1('0x6'));module[_0xe0f1('0x7')]=function(_0x4a3fb7,_0x58088e){return _0x4a3fb7[_0xe0f1('0x8')]('CannedAnswer',attributes,{'tableName':_0xe0f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe0f1('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4574=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','CannedAnswer','lodash','../../config/logger'];(function(_0x1c5f54,_0x39561e){var _0x25cebe=function(_0x38a2cb){while(--_0x38a2cb){_0x1c5f54['push'](_0x1c5f54['shift']());}};_0x25cebe(++_0x39561e);}(_0x4574,0xbc));var _0x4457=function(_0x3be342,_0x22468b){_0x3be342=_0x3be342-0x0;var _0x5bb3e5=_0x4574[_0x3be342];return _0x5bb3e5;};'use strict';var _=require(_0x4457('0x0'));var util=require('util');var logger=require(_0x4457('0x1'))(_0x4457('0x2'));var moment=require('moment');var BPromise=require(_0x4457('0x3'));var rp=require(_0x4457('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4457('0x5'));var config=require(_0x4457('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x4457('0x7')]=function(_0x25bd0b,_0x110a03){return _0x25bd0b[_0x4457('0x8')](_0x4457('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 1cdc1da..9493d65 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 _0x3079=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x659699,_0x28f865){var _0x11641b=function(_0x52117e){while(--_0x52117e){_0x659699['push'](_0x659699['shift']());}};_0x11641b(++_0x28f865);}(_0x3079,0x70));var _0x9307=function(_0x1b4f28,_0x1fd756){_0x1b4f28=_0x1b4f28-0x0;var _0x354abe=_0x3079[_0x1b4f28];return _0x354abe;};'use strict';var _=require(_0x9307('0x0'));var util=require(_0x9307('0x1'));var moment=require('moment');var BPromise=require(_0x9307('0x2'));var rs=require(_0x9307('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9307('0x4'))['db'];var utils=require(_0x9307('0x5'));var logger=require(_0x9307('0x6'))(_0x9307('0x7'));var config=require('../../config/environment');var jayson=require(_0x9307('0x8'));var client=jayson[_0x9307('0x9')][_0x9307('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39c369,_0x1d6143,_0x1e4a10){return new BPromise(function(_0x1df60f,_0x5ecea8){return client[_0x9307('0xb')](_0x39c369,_0x1e4a10)['then'](function(_0x443f70){logger[_0x9307('0xc')](_0x9307('0xd'),_0x1d6143,_0x9307('0xe'));logger[_0x9307('0xf')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x1d6143,'request\x20sent',JSON[_0x9307('0x10')](_0x443f70));if(_0x443f70[_0x9307('0x11')]){if(_0x443f70[_0x9307('0x11')][_0x9307('0x12')]===0x1f4){logger['error'](_0x9307('0xd'),_0x1d6143,_0x443f70[_0x9307('0x11')][_0x9307('0x13')]);return _0x5ecea8(_0x443f70[_0x9307('0x11')][_0x9307('0x13')]);}logger[_0x9307('0x11')](_0x9307('0xd'),_0x1d6143,_0x443f70[_0x9307('0x11')]['message']);return _0x1df60f(_0x443f70['error'][_0x9307('0x13')]);}else{logger[_0x9307('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x1d6143,'request\x20sent');_0x1df60f(_0x443f70[_0x9307('0x14')][_0x9307('0x13')]);}})[_0x9307('0x15')](function(_0x7e6e9e){logger[_0x9307('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x1d6143,_0x7e6e9e);_0x5ecea8(_0x7e6e9e);});});} \ No newline at end of file +var _0x5867=['info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x137d0e,_0x2e59a8){var _0x226fb8=function(_0xf8b508){while(--_0xf8b508){_0x137d0e['push'](_0x137d0e['shift']());}};_0x226fb8(++_0x2e59a8);}(_0x5867,0x1d8));var _0x7586=function(_0x47ee66,_0x4a77d4){_0x47ee66=_0x47ee66-0x0;var _0x4ad1da=_0x5867[_0x47ee66];return _0x4ad1da;};'use strict';var _=require(_0x7586('0x0'));var util=require('util');var moment=require(_0x7586('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7586('0x2'));var db=require(_0x7586('0x3'))['db'];var utils=require(_0x7586('0x4'));var logger=require(_0x7586('0x5'))(_0x7586('0x6'));var config=require(_0x7586('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7586('0x8')][_0x7586('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x86668f,_0x49890f,_0x29be6b){return new BPromise(function(_0x357f4a,_0x390054){return client[_0x7586('0xa')](_0x86668f,_0x29be6b)[_0x7586('0xb')](function(_0x14f5d5){logger[_0x7586('0xc')](_0x7586('0xd'),_0x49890f,_0x7586('0xe'));logger[_0x7586('0xf')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x49890f,_0x7586('0xe'),JSON[_0x7586('0x10')](_0x14f5d5));if(_0x14f5d5['error']){if(_0x14f5d5[_0x7586('0x11')][_0x7586('0x12')]===0x1f4){logger['error'](_0x7586('0xd'),_0x49890f,_0x14f5d5[_0x7586('0x11')][_0x7586('0x13')]);return _0x390054(_0x14f5d5['error'][_0x7586('0x13')]);}logger[_0x7586('0x11')](_0x7586('0xd'),_0x49890f,_0x14f5d5[_0x7586('0x11')][_0x7586('0x13')]);return _0x357f4a(_0x14f5d5[_0x7586('0x11')][_0x7586('0x13')]);}else{logger[_0x7586('0xc')](_0x7586('0xd'),_0x49890f,'request\x20sent');_0x357f4a(_0x14f5d5[_0x7586('0x14')]['message']);}})[_0x7586('0x15')](function(_0xd14e90){logger[_0x7586('0x11')](_0x7586('0xd'),_0x49890f,_0xd14e90);_0x390054(_0xd14e90);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 5788632..8b9e0f7 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 _0xa089=['isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa089,0x80));var _0x9a08=function(_0x67cfff,_0x32223f){_0x67cfff=_0x67cfff-0x0;var _0x31e66f=_0xa089[_0x67cfff];return _0x31e66f;};'use strict';var multer=require(_0x9a08('0x0'));var util=require(_0x9a08('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9a08('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x9a08('0x3'));var config=require(_0x9a08('0x4'));var controller=require(_0x9a08('0x5'));router[_0x9a08('0x6')]('/',auth[_0x9a08('0x7')](),controller[_0x9a08('0x8')]);router['get'](_0x9a08('0x9'),auth[_0x9a08('0x7')](),controller['show']);router[_0x9a08('0xa')]('/',auth[_0x9a08('0x7')](),controller['create']);router['put'](_0x9a08('0x9'),auth['isAuthenticated'](),controller[_0x9a08('0xb')]);router[_0x9a08('0xc')](_0x9a08('0x9'),auth[_0x9a08('0x7')](),controller[_0x9a08('0xd')]);module[_0x9a08('0xe')]=router; \ No newline at end of file +var _0xb768=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','put','update','delete','/:id','destroy','exports','multer'];(function(_0x719a88,_0x2fee21){var _0x3df882=function(_0x50c97d){while(--_0x50c97d){_0x719a88['push'](_0x719a88['shift']());}};_0x3df882(++_0x2fee21);}(_0xb768,0x7d));var _0x8b76=function(_0x356486,_0x15902f){_0x356486=_0x356486-0x0;var _0xf2cec1=_0xb768[_0x356486];return _0xf2cec1;};'use strict';var multer=require(_0x8b76('0x0'));var util=require('util');var path=require(_0x8b76('0x1'));var timeout=require(_0x8b76('0x2'));var express=require('express');var router=express[_0x8b76('0x3')]();var auth=require(_0x8b76('0x4'));var interaction=require(_0x8b76('0x5'));var config=require(_0x8b76('0x6'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x8b76('0x7')](),controller[_0x8b76('0x8')]);router[_0x8b76('0x9')]('/:id',auth[_0x8b76('0x7')](),controller[_0x8b76('0xa')]);router[_0x8b76('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8b76('0xc')]('/:id',auth[_0x8b76('0x7')](),controller[_0x8b76('0xd')]);router[_0x8b76('0xe')](_0x8b76('0xf'),auth[_0x8b76('0x7')](),controller[_0x8b76('0x10')]);module[_0x8b76('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ef5bb90..9814acb 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 _0x0f3d=['DATE','STRING','INTEGER','exports'];(function(_0x411ad5,_0x3d92fc){var _0x5a96c6=function(_0x5be874){while(--_0x5be874){_0x411ad5['push'](_0x411ad5['shift']());}};_0x5a96c6(++_0x3d92fc);}(_0x0f3d,0x18b));var _0xd0f3=function(_0x465544,_0x15e165){_0x465544=_0x465544-0x0;var _0x3b5518=_0x0f3d[_0x465544];return _0x3b5518;};'use strict';var Sequelize=require('sequelize');module[_0xd0f3('0x0')]={'calldate':{'type':Sequelize[_0xd0f3('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xd0f3('0x2')]},'src':{'type':Sequelize[_0xd0f3('0x2')]},'dst':{'type':Sequelize[_0xd0f3('0x2')]},'dcontext':{'type':Sequelize[_0xd0f3('0x2')]},'channel':{'type':Sequelize[_0xd0f3('0x2')]},'dstchannel':{'type':Sequelize[_0xd0f3('0x2')]},'lastapp':{'type':Sequelize[_0xd0f3('0x2')]},'lastdata':{'type':Sequelize[_0xd0f3('0x2')]},'duration':{'type':Sequelize[_0xd0f3('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd0f3('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd0f3('0x2')]},'amaflags':{'type':Sequelize[_0xd0f3('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd0f3('0x2')]},'userfield':{'type':Sequelize[_0xd0f3('0x2')]},'uniqueid':{'type':Sequelize[_0xd0f3('0x2')]},'linkedid':{'type':Sequelize[_0xd0f3('0x2')]},'sequence':{'type':Sequelize[_0xd0f3('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd0f3('0x2')]},'tag':{'type':Sequelize[_0xd0f3('0x2')]}}; \ No newline at end of file +var _0x94ae=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x94ae,0xc7));var _0xe94a=function(_0x37a042,_0x2c307a){_0x37a042=_0x37a042-0x0;var _0x19a727=_0x94ae[_0x37a042];return _0x19a727;};'use strict';var Sequelize=require(_0xe94a('0x0'));module[_0xe94a('0x1')]={'calldate':{'type':Sequelize[_0xe94a('0x2')],'allowNull':![],'defaultValue':_0xe94a('0x3')},'clid':{'type':Sequelize[_0xe94a('0x4')]},'src':{'type':Sequelize[_0xe94a('0x4')]},'dst':{'type':Sequelize[_0xe94a('0x4')]},'dcontext':{'type':Sequelize[_0xe94a('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xe94a('0x4')]},'lastapp':{'type':Sequelize[_0xe94a('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xe94a('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xe94a('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe94a('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe94a('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe94a('0x4')]},'peeraccount':{'type':Sequelize[_0xe94a('0x4')]},'type':{'type':Sequelize[_0xe94a('0x4')]},'tag':{'type':Sequelize[_0xe94a('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index d561acf..6e49951 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 _0x0abf=['length','hasOwnProperty','order','sort','where','pick','filter','map','key','VIRTUAL','merge','Cdr','includeAll','findAll','rows','catch','params','options','find','create','body','describe','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields'];(function(_0x24ca51,_0x4d69dd){var _0x58d4da=function(_0x4497c4){while(--_0x4497c4){_0x24ca51['push'](_0x24ca51['shift']());}};_0x58d4da(++_0x4d69dd);}(_0x0abf,0xe8));var _0xf0ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0abf[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0xf0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf0ab('0x1'));var zipdir=require(_0xf0ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0ab('0x4'));var util=require(_0xf0ab('0x5'));var path=require(_0xf0ab('0x6'));var sox=require(_0xf0ab('0x7'));var csv=require(_0xf0ab('0x8'));var ejs=require(_0xf0ab('0x9'));var fs=require('fs');var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x8'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x11'))('api');var utils=require(_0xf0ab('0x12'));var config=require(_0xf0ab('0x13'));var db=require(_0xf0ab('0x14'))['db'];function respondWithStatusCode(_0x410df5,_0x2dc4f8){_0x2dc4f8=_0x2dc4f8||0xcc;return function(_0x38ca67){if(_0x38ca67){return _0x410df5[_0xf0ab('0x15')](_0x2dc4f8);}return _0x410df5['status'](_0x2dc4f8)[_0xf0ab('0x16')]();};}function respondWithResult(_0x2cc002,_0x1913fe){_0x1913fe=_0x1913fe||0xc8;return function(_0x35c75f){if(_0x35c75f){return _0x2cc002[_0xf0ab('0x17')](_0x1913fe)[_0xf0ab('0x18')](_0x35c75f);}};}function respondWithFilteredResult(_0x3d7129,_0x1fb4e5){return function(_0x180d0b){if(_0x180d0b){var _0x3c5bfd=_0x180d0b[_0xf0ab('0x19')],_0x20f453=_0x1fb4e5[_0xf0ab('0x1a')],_0x221bac=_0x1fb4e5['offset']+_0x1fb4e5[_0xf0ab('0x1b')],_0x200cf5;if(_0x221bac>=_0x3c5bfd){_0x221bac=_0x3c5bfd;_0x200cf5=0xc8;}else{_0x200cf5=0xce;}_0x3d7129[_0xf0ab('0x17')](_0x200cf5);return _0x3d7129[_0xf0ab('0x1c')](_0xf0ab('0x1d'),_0x20f453+'-'+_0x221bac+'/'+_0x3c5bfd)[_0xf0ab('0x18')](_0x180d0b);}return null;};}function patchUpdates(_0xb9a33){return function(_0x3a0edf){try{jsonpatch[_0xf0ab('0x1e')](_0x3a0edf,_0xb9a33,!![]);}catch(_0x1713d6){return BPromise[_0xf0ab('0x1f')](_0x1713d6);}return _0x3a0edf[_0xf0ab('0x20')]();};}function saveUpdates(_0xdfcfb2,_0xf43bc4){return function(_0x22a205){if(_0x22a205){return _0x22a205[_0xf0ab('0x21')](_0xdfcfb2)[_0xf0ab('0x22')](function(_0x537673){return _0x537673;});}return null;};}function removeEntity(_0x153492,_0x6fa888){return function(_0x1e1483){if(_0x1e1483){return _0x1e1483[_0xf0ab('0x23')]()[_0xf0ab('0x22')](function(){_0x153492[_0xf0ab('0x17')](0xcc)[_0xf0ab('0x16')]();});}};}function handleEntityNotFound(_0x20140b,_0x36ad01){return function(_0x18bb37){if(!_0x18bb37){_0x20140b[_0xf0ab('0x15')](0x194);}return _0x18bb37;};}function handleError(_0x5645b2,_0x585841){_0x585841=_0x585841||0x1f4;return function(_0x4eee21){logger[_0xf0ab('0x24')](_0x4eee21['stack']);if(_0x4eee21[_0xf0ab('0x25')]){delete _0x4eee21[_0xf0ab('0x25')];}_0x5645b2['status'](_0x585841)[_0xf0ab('0x26')](_0x4eee21);};}exports[_0xf0ab('0x27')]=function(_0x10bf5f,_0x38fb71){var _0x7d4ff9={},_0x502921={},_0x2d0da7={'count':0x0,'rows':[]};var _0x574ce7=db['Cdr'][_0xf0ab('0x28')];_0x502921[_0xf0ab('0x29')]=_[_0xf0ab('0x2a')](_0x574ce7);_0x502921[_0xf0ab('0x2b')]=_[_0xf0ab('0x2a')](_0x10bf5f[_0xf0ab('0x2b')]);_0x502921[_0xf0ab('0x2c')]=_[_0xf0ab('0x2d')](_0x502921[_0xf0ab('0x29')],_0x502921[_0xf0ab('0x2b')]);_0x7d4ff9[_0xf0ab('0x2e')]=_[_0xf0ab('0x2d')](_0x502921['model'],qs[_0xf0ab('0x2f')](_0x10bf5f[_0xf0ab('0x2b')]['fields']));_0x7d4ff9['attributes']=_0x7d4ff9[_0xf0ab('0x2e')][_0xf0ab('0x30')]?_0x7d4ff9[_0xf0ab('0x2e')]:_0x502921['model'];if(!_0x10bf5f['query'][_0xf0ab('0x31')]('nolimit')){_0x7d4ff9[_0xf0ab('0x1b')]=qs['limit'](_0x10bf5f[_0xf0ab('0x2b')][_0xf0ab('0x1b')]);_0x7d4ff9['offset']=qs['offset'](_0x10bf5f[_0xf0ab('0x2b')][_0xf0ab('0x1a')]);}_0x7d4ff9[_0xf0ab('0x32')]=qs[_0xf0ab('0x33')](_0x10bf5f[_0xf0ab('0x2b')][_0xf0ab('0x33')]);_0x7d4ff9[_0xf0ab('0x34')]=qs[_0xf0ab('0x2c')](_[_0xf0ab('0x35')](_0x10bf5f[_0xf0ab('0x2b')],_0x502921[_0xf0ab('0x2c')]));if(_0x10bf5f[_0xf0ab('0x2b')][_0xf0ab('0x36')]){_0x7d4ff9[_0xf0ab('0x34')]=_['merge'](_0x7d4ff9[_0xf0ab('0x34')],{'$or':_[_0xf0ab('0x37')](_0x574ce7,function(_0xc575ed){if(_0xc575ed['type'][_0xf0ab('0x38')]!==_0xf0ab('0x39')){var _0x5d99e7={};_0x5d99e7[_0xc575ed['field']]={'$like':'%'+_0x10bf5f[_0xf0ab('0x2b')]['filter']+'%'};return _0x5d99e7;}})});}_0x7d4ff9=_[_0xf0ab('0x3a')]({},_0x7d4ff9,_0x10bf5f['options']);var _0x4763f7={'where':_0x7d4ff9[_0xf0ab('0x34')]};return db[_0xf0ab('0x3b')][_0xf0ab('0x19')](_0x4763f7)[_0xf0ab('0x22')](function(_0x1dfb2e){_0x2d0da7['count']=_0x1dfb2e;if(_0x10bf5f[_0xf0ab('0x2b')][_0xf0ab('0x3c')]){_0x7d4ff9['include']=[{'all':!![]}];}return db[_0xf0ab('0x3b')][_0xf0ab('0x3d')](_0x7d4ff9);})[_0xf0ab('0x22')](function(_0x44988b){_0x2d0da7[_0xf0ab('0x3e')]=_0x44988b;return _0x2d0da7;})[_0xf0ab('0x22')](respondWithFilteredResult(_0x38fb71,_0x7d4ff9))[_0xf0ab('0x3f')](handleError(_0x38fb71,null));};exports['show']=function(_0x406a1d,_0x4f6e93){var _0x7c4629={'raw':!![],'where':{'id':_0x406a1d[_0xf0ab('0x40')]['id']}},_0x4bd6d1={};_0x4bd6d1[_0xf0ab('0x29')]=_[_0xf0ab('0x2a')](db[_0xf0ab('0x3b')][_0xf0ab('0x28')]);_0x4bd6d1['query']=_[_0xf0ab('0x2a')](_0x406a1d[_0xf0ab('0x2b')]);_0x4bd6d1[_0xf0ab('0x2c')]=_[_0xf0ab('0x2d')](_0x4bd6d1[_0xf0ab('0x29')],_0x4bd6d1[_0xf0ab('0x2b')]);_0x7c4629[_0xf0ab('0x2e')]=_[_0xf0ab('0x2d')](_0x4bd6d1[_0xf0ab('0x29')],qs[_0xf0ab('0x2f')](_0x406a1d[_0xf0ab('0x2b')][_0xf0ab('0x2f')]));_0x7c4629[_0xf0ab('0x2e')]=_0x7c4629['attributes']['length']?_0x7c4629[_0xf0ab('0x2e')]:_0x4bd6d1['model'];if(_0x406a1d[_0xf0ab('0x2b')][_0xf0ab('0x3c')]){_0x7c4629['include']=[{'all':!![]}];}_0x7c4629=_[_0xf0ab('0x3a')]({},_0x7c4629,_0x406a1d[_0xf0ab('0x41')]);return db['Cdr'][_0xf0ab('0x42')](_0x7c4629)[_0xf0ab('0x22')](handleEntityNotFound(_0x4f6e93,null))[_0xf0ab('0x22')](respondWithResult(_0x4f6e93,null))[_0xf0ab('0x3f')](handleError(_0x4f6e93,null));};exports[_0xf0ab('0x43')]=function(_0x376651,_0x198cc3){return db[_0xf0ab('0x3b')][_0xf0ab('0x43')](_0x376651[_0xf0ab('0x44')],{})[_0xf0ab('0x22')](respondWithResult(_0x198cc3,0xc9))[_0xf0ab('0x3f')](handleError(_0x198cc3,null));};exports[_0xf0ab('0x21')]=function(_0x99ce7,_0x58fea3){if(_0x99ce7['body']['id']){delete _0x99ce7[_0xf0ab('0x44')]['id'];}return db['Cdr']['find']({'where':{'id':_0x99ce7['params']['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x58fea3,null))[_0xf0ab('0x22')](saveUpdates(_0x99ce7[_0xf0ab('0x44')],null))[_0xf0ab('0x22')](respondWithResult(_0x58fea3,null))[_0xf0ab('0x3f')](handleError(_0x58fea3,null));};exports[_0xf0ab('0x23')]=function(_0x472c1b,_0x1a0f21){return db[_0xf0ab('0x3b')][_0xf0ab('0x42')]({'where':{'id':_0x472c1b[_0xf0ab('0x40')]['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x1a0f21,null))['then'](removeEntity(_0x1a0f21,null))[_0xf0ab('0x3f')](handleError(_0x1a0f21,null));};exports[_0xf0ab('0x45')]=function(_0x43abde,_0x46b998){return db[_0xf0ab('0x3b')][_0xf0ab('0x45')]()[_0xf0ab('0x22')](respondWithResult(_0x46b998,null))[_0xf0ab('0x3f')](handleError(_0x46b998,null));}; \ No newline at end of file +var _0xb688=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','Cdr','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','destroy','describe','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'];(function(_0x1d8409,_0x3ed12e){var _0x16374c=function(_0xdedbf0){while(--_0xdedbf0){_0x1d8409['push'](_0x1d8409['shift']());}};_0x16374c(++_0x3ed12e);}(_0xb688,0xcf));var _0x8b68=function(_0x111d0e,_0x58bc1a){_0x111d0e=_0x111d0e-0x0;var _0x4b8c5e=_0xb688[_0x111d0e];return _0x4b8c5e;};'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 hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))(_0x8b68('0x17'));var utils=require('../../config/utils');var config=require(_0x8b68('0x18'));var db=require(_0x8b68('0x19'))['db'];function respondWithStatusCode(_0x5e76c,_0x2d8472){_0x2d8472=_0x2d8472||0xcc;return function(_0x1965cf){if(_0x1965cf){return _0x5e76c[_0x8b68('0x1a')](_0x2d8472);}return _0x5e76c[_0x8b68('0x1b')](_0x2d8472)[_0x8b68('0x1c')]();};}function respondWithResult(_0x2686c7,_0x5b4364){_0x5b4364=_0x5b4364||0xc8;return function(_0xb2df35){if(_0xb2df35){return _0x2686c7['status'](_0x5b4364)['json'](_0xb2df35);}};}function respondWithFilteredResult(_0x22f75b,_0x1554d6){return function(_0x27d717){if(_0x27d717){var _0x5d3468=_0x27d717[_0x8b68('0x1d')],_0x5c8d0e=_0x1554d6[_0x8b68('0x1e')],_0x23bd52=_0x1554d6[_0x8b68('0x1e')]+_0x1554d6[_0x8b68('0x1f')],_0x5c1e44;if(_0x23bd52>=_0x5d3468){_0x23bd52=_0x5d3468;_0x5c1e44=0xc8;}else{_0x5c1e44=0xce;}_0x22f75b['status'](_0x5c1e44);return _0x22f75b[_0x8b68('0x20')](_0x8b68('0x21'),_0x5c8d0e+'-'+_0x23bd52+'/'+_0x5d3468)['json'](_0x27d717);}return null;};}function patchUpdates(_0x42b3bd){return function(_0x3c7e5a){try{jsonpatch[_0x8b68('0x22')](_0x3c7e5a,_0x42b3bd,!![]);}catch(_0x17f321){return BPromise[_0x8b68('0x23')](_0x17f321);}return _0x3c7e5a['save']();};}function saveUpdates(_0x7b0b70,_0x4b4b0f){return function(_0x59e9b1){if(_0x59e9b1){return _0x59e9b1[_0x8b68('0x24')](_0x7b0b70)[_0x8b68('0x25')](function(_0x1dbc1d){return _0x1dbc1d;});}return null;};}function removeEntity(_0x5603d4,_0x571adf){return function(_0x23edc1){if(_0x23edc1){return _0x23edc1['destroy']()[_0x8b68('0x25')](function(){_0x5603d4[_0x8b68('0x1b')](0xcc)[_0x8b68('0x1c')]();});}};}function handleEntityNotFound(_0x21ecca,_0x32ddc5){return function(_0x173524){if(!_0x173524){_0x21ecca['sendStatus'](0x194);}return _0x173524;};}function handleError(_0x1a6fe8,_0x46e827){_0x46e827=_0x46e827||0x1f4;return function(_0x4ca77d){logger[_0x8b68('0x26')](_0x4ca77d[_0x8b68('0x27')]);if(_0x4ca77d[_0x8b68('0x28')]){delete _0x4ca77d['name'];}_0x1a6fe8['status'](_0x46e827)['send'](_0x4ca77d);};}exports[_0x8b68('0x29')]=function(_0x448e43,_0x2ba2a3){var _0x583476={},_0x3311c7={},_0x53aaa2={'count':0x0,'rows':[]};var _0x4cf89d=db[_0x8b68('0x2a')]['rawAttributes'];_0x3311c7[_0x8b68('0x2b')]=_[_0x8b68('0x2c')](_0x4cf89d);_0x3311c7['query']=_['keys'](_0x448e43[_0x8b68('0x2d')]);_0x3311c7[_0x8b68('0x2e')]=_[_0x8b68('0x2f')](_0x3311c7[_0x8b68('0x2b')],_0x3311c7[_0x8b68('0x2d')]);_0x583476[_0x8b68('0x30')]=_[_0x8b68('0x2f')](_0x3311c7['model'],qs[_0x8b68('0x31')](_0x448e43['query'][_0x8b68('0x31')]));_0x583476[_0x8b68('0x30')]=_0x583476['attributes'][_0x8b68('0x32')]?_0x583476[_0x8b68('0x30')]:_0x3311c7[_0x8b68('0x2b')];if(!_0x448e43['query']['hasOwnProperty'](_0x8b68('0x33'))){_0x583476[_0x8b68('0x1f')]=qs[_0x8b68('0x1f')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x1f')]);_0x583476[_0x8b68('0x1e')]=qs[_0x8b68('0x1e')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x1e')]);}_0x583476[_0x8b68('0x34')]=qs[_0x8b68('0x35')](_0x448e43[_0x8b68('0x2d')][_0x8b68('0x35')]);_0x583476[_0x8b68('0x36')]=qs[_0x8b68('0x2e')](_[_0x8b68('0x37')](_0x448e43[_0x8b68('0x2d')],_0x3311c7[_0x8b68('0x2e')]));if(_0x448e43[_0x8b68('0x2d')][_0x8b68('0x38')]){_0x583476[_0x8b68('0x36')]=_[_0x8b68('0x39')](_0x583476['where'],{'$or':_['map'](_0x4cf89d,function(_0x24026c){if(_0x24026c[_0x8b68('0x3a')][_0x8b68('0x3b')]!==_0x8b68('0x3c')){var _0xf2154f={};_0xf2154f[_0x24026c[_0x8b68('0x3d')]]={'$like':'%'+_0x448e43[_0x8b68('0x2d')][_0x8b68('0x38')]+'%'};return _0xf2154f;}})});}_0x583476=_['merge']({},_0x583476,_0x448e43[_0x8b68('0x3e')]);var _0x2c94d0={'where':_0x583476[_0x8b68('0x36')]};return db[_0x8b68('0x2a')][_0x8b68('0x1d')](_0x2c94d0)[_0x8b68('0x25')](function(_0xff4080){_0x53aaa2[_0x8b68('0x1d')]=_0xff4080;if(_0x448e43['query'][_0x8b68('0x3f')]){_0x583476[_0x8b68('0x40')]=[{'all':!![]}];}return db[_0x8b68('0x2a')][_0x8b68('0x41')](_0x583476);})[_0x8b68('0x25')](function(_0x3b3394){_0x53aaa2[_0x8b68('0x42')]=_0x3b3394;return _0x53aaa2;})['then'](respondWithFilteredResult(_0x2ba2a3,_0x583476))[_0x8b68('0x43')](handleError(_0x2ba2a3,null));};exports[_0x8b68('0x44')]=function(_0x48f159,_0x14ec40){var _0x27a717={'raw':!![],'where':{'id':_0x48f159['params']['id']}},_0x50b2f1={};_0x50b2f1['model']=_['keys'](db[_0x8b68('0x2a')][_0x8b68('0x45')]);_0x50b2f1['query']=_[_0x8b68('0x2c')](_0x48f159['query']);_0x50b2f1[_0x8b68('0x2e')]=_[_0x8b68('0x2f')](_0x50b2f1['model'],_0x50b2f1[_0x8b68('0x2d')]);_0x27a717['attributes']=_['intersection'](_0x50b2f1['model'],qs[_0x8b68('0x31')](_0x48f159[_0x8b68('0x2d')][_0x8b68('0x31')]));_0x27a717[_0x8b68('0x30')]=_0x27a717['attributes'][_0x8b68('0x32')]?_0x27a717['attributes']:_0x50b2f1[_0x8b68('0x2b')];if(_0x48f159[_0x8b68('0x2d')]['includeAll']){_0x27a717[_0x8b68('0x40')]=[{'all':!![]}];}_0x27a717=_[_0x8b68('0x39')]({},_0x27a717,_0x48f159[_0x8b68('0x3e')]);return db[_0x8b68('0x2a')]['find'](_0x27a717)[_0x8b68('0x25')](handleEntityNotFound(_0x14ec40,null))[_0x8b68('0x25')](respondWithResult(_0x14ec40,null))[_0x8b68('0x43')](handleError(_0x14ec40,null));};exports[_0x8b68('0x46')]=function(_0xae2c2a,_0x1362d3){return db[_0x8b68('0x2a')][_0x8b68('0x46')](_0xae2c2a[_0x8b68('0x47')],{})[_0x8b68('0x25')](respondWithResult(_0x1362d3,0xc9))[_0x8b68('0x43')](handleError(_0x1362d3,null));};exports[_0x8b68('0x24')]=function(_0x1af430,_0x108c8d){if(_0x1af430[_0x8b68('0x47')]['id']){delete _0x1af430[_0x8b68('0x47')]['id'];}return db['Cdr'][_0x8b68('0x48')]({'where':{'id':_0x1af430[_0x8b68('0x49')]['id']}})['then'](handleEntityNotFound(_0x108c8d,null))[_0x8b68('0x25')](saveUpdates(_0x1af430['body'],null))['then'](respondWithResult(_0x108c8d,null))['catch'](handleError(_0x108c8d,null));};exports[_0x8b68('0x4a')]=function(_0x35874b,_0x34047c){return db[_0x8b68('0x2a')]['find']({'where':{'id':_0x35874b['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x34047c,null))[_0x8b68('0x25')](removeEntity(_0x34047c,null))[_0x8b68('0x43')](handleError(_0x34047c,null));};exports['describe']=function(_0x3f6e21,_0x431a75){return db['Cdr'][_0x8b68('0x4b')]()[_0x8b68('0x25')](respondWithResult(_0x431a75,null))['catch'](handleError(_0x431a75,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index eedc6b3..69cb4c2 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 _0x4819=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','Cdr'];(function(_0x53c2e3,_0x486f96){var _0x28bfd5=function(_0x4af9f2){while(--_0x4af9f2){_0x53c2e3['push'](_0x53c2e3['shift']());}};_0x28bfd5(++_0x486f96);}(_0x4819,0xcd));var _0x9481=function(_0x11435c,_0x436ccf){_0x11435c=_0x11435c-0x0;var _0x556167=_0x4819[_0x11435c];return _0x556167;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['calldate']},{'name':_0x9481('0xe'),'fields':['disposition']},{'name':_0x9481('0xf'),'fields':['dst']},{'name':_0x9481('0x10'),'fields':[_0x9481('0x10')]},{'name':_0x9481('0x11'),'fields':[_0x9481('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2a07=['moment','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x2a07,0x74));var _0x72a0=function(_0x33925b,_0x95cfc6){_0x33925b=_0x33925b-0x0;var _0x375e21=_0x2a07[_0x33925b];return _0x375e21;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['disposition']},{'name':_0x72a0('0x11'),'fields':[_0x72a0('0x11')]},{'name':'src','fields':[_0x72a0('0x12')]},{'name':_0x72a0('0x13'),'fields':[_0x72a0('0x13')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 10f4d9d..4e661f4 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 _0x4fdc=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0xe34491,_0x325ded){var _0x51d3d1=function(_0x6961bd){while(--_0x6961bd){_0xe34491['push'](_0xe34491['shift']());}};_0x51d3d1(++_0x325ded);}(_0x4fdc,0xff));var _0xc4fd=function(_0x340b34,_0x520ec6){_0x340b34=_0x340b34-0x0;var _0x40c0e8=_0x4fdc[_0x340b34];return _0x40c0e8;};'use strict';var _=require(_0xc4fd('0x0'));var util=require(_0xc4fd('0x1'));var moment=require(_0xc4fd('0x2'));var BPromise=require(_0xc4fd('0x3'));var rs=require(_0xc4fd('0x4'));var fs=require('fs');var Redis=require(_0xc4fd('0x5'));var db=require(_0xc4fd('0x6'))['db'];var utils=require(_0xc4fd('0x7'));var logger=require(_0xc4fd('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc4fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x260899,_0x5cf1c1,_0x542922){return new BPromise(function(_0x300025,_0x26f1e6){return client[_0xc4fd('0xa')](_0x260899,_0x542922)[_0xc4fd('0xb')](function(_0x12a5dd){logger[_0xc4fd('0xc')](_0xc4fd('0xd'),_0x5cf1c1,'request\x20sent');logger[_0xc4fd('0xe')](_0xc4fd('0xf'),_0x5cf1c1,'request\x20sent',JSON[_0xc4fd('0x10')](_0x12a5dd));if(_0x12a5dd['error']){if(_0x12a5dd[_0xc4fd('0x11')][_0xc4fd('0x12')]===0x1f4){logger['error'](_0xc4fd('0xd'),_0x5cf1c1,_0x12a5dd[_0xc4fd('0x11')][_0xc4fd('0x13')]);return _0x26f1e6(_0x12a5dd[_0xc4fd('0x11')][_0xc4fd('0x13')]);}logger[_0xc4fd('0x11')](_0xc4fd('0xd'),_0x5cf1c1,_0x12a5dd['error'][_0xc4fd('0x13')]);return _0x300025(_0x12a5dd[_0xc4fd('0x11')][_0xc4fd('0x13')]);}else{logger[_0xc4fd('0xc')]('Cdr,\x20%s,\x20%s',_0x5cf1c1,_0xc4fd('0x14'));_0x300025(_0x12a5dd[_0xc4fd('0x15')][_0xc4fd('0x13')]);}})[_0xc4fd('0x16')](function(_0x1d1b92){logger[_0xc4fd('0x11')](_0xc4fd('0xd'),_0x5cf1c1,_0x1d1b92);_0x26f1e6(_0x1d1b92);});});} \ No newline at end of file +var _0xaf2a=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','message','Cdr,\x20%s,\x20%s','result','lodash','util','moment','randomstring'];(function(_0x33a17b,_0x4e04ff){var _0x57e182=function(_0x5a62b7){while(--_0x5a62b7){_0x33a17b['push'](_0x33a17b['shift']());}};_0x57e182(++_0x4e04ff);}(_0xaf2a,0x1c4));var _0xaaf2=function(_0x1e6e8d,_0x528a89){_0x1e6e8d=_0x1e6e8d-0x0;var _0x24eaa7=_0xaf2a[_0x1e6e8d];return _0x24eaa7;};'use strict';var _=require(_0xaaf2('0x0'));var util=require(_0xaaf2('0x1'));var moment=require(_0xaaf2('0x2'));var BPromise=require('bluebird');var rs=require(_0xaaf2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaaf2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaaf2('0x5'))(_0xaaf2('0x6'));var config=require('../../config/environment');var jayson=require(_0xaaf2('0x7'));var client=jayson[_0xaaf2('0x8')][_0xaaf2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b9d46,_0x1a02c1,_0x3f6b8b){return new BPromise(function(_0x2de8d4,_0x2f8e85){return client[_0xaaf2('0xa')](_0x2b9d46,_0x3f6b8b)[_0xaaf2('0xb')](function(_0x4e3334){logger[_0xaaf2('0xc')]('Cdr,\x20%s,\x20%s',_0x1a02c1,_0xaaf2('0xd'));logger[_0xaaf2('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1a02c1,_0xaaf2('0xd'),JSON['stringify'](_0x4e3334));if(_0x4e3334[_0xaaf2('0xf')]){if(_0x4e3334[_0xaaf2('0xf')]['code']===0x1f4){logger[_0xaaf2('0xf')]('Cdr,\x20%s,\x20%s',_0x1a02c1,_0x4e3334[_0xaaf2('0xf')]['message']);return _0x2f8e85(_0x4e3334['error'][_0xaaf2('0x10')]);}logger['error'](_0xaaf2('0x11'),_0x1a02c1,_0x4e3334['error'][_0xaaf2('0x10')]);return _0x2de8d4(_0x4e3334[_0xaaf2('0xf')][_0xaaf2('0x10')]);}else{logger[_0xaaf2('0xc')](_0xaaf2('0x11'),_0x1a02c1,_0xaaf2('0xd'));_0x2de8d4(_0x4e3334[_0xaaf2('0x12')]['message']);}})['catch'](function(_0x5db55a){logger['error'](_0xaaf2('0x11'),_0x1a02c1,_0x5db55a);_0x2f8e85(_0x5db55a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 5885ccc..24a01d9 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 _0xaf45=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x506680,_0x5318fd){var _0x56c0b1=function(_0x1b2e51){while(--_0x1b2e51){_0x506680['push'](_0x506680['shift']());}};_0x56c0b1(++_0x5318fd);}(_0xaf45,0x133));var _0x5af4=function(_0x1f50a2,_0x387c1a){_0x1f50a2=_0x1f50a2-0x0;var _0x33a8c0=_0xaf45[_0x1f50a2];return _0x33a8c0;};'use strict';var multer=require(_0x5af4('0x0'));var util=require(_0x5af4('0x1'));var path=require(_0x5af4('0x2'));var timeout=require(_0x5af4('0x3'));var express=require(_0x5af4('0x4'));var router=express[_0x5af4('0x5')]();var auth=require(_0x5af4('0x6'));var interaction=require(_0x5af4('0x7'));var config=require(_0x5af4('0x8'));var controller=require(_0x5af4('0x9'));router[_0x5af4('0xa')]('/',auth[_0x5af4('0xb')](),controller['index']);router[_0x5af4('0xa')](_0x5af4('0xc'),auth[_0x5af4('0xb')](),controller[_0x5af4('0xd')]);router[_0x5af4('0xa')](_0x5af4('0xe'),auth[_0x5af4('0xb')](),controller[_0x5af4('0xf')]);router[_0x5af4('0x10')]('/',auth[_0x5af4('0xb')](),controller[_0x5af4('0x11')]);router[_0x5af4('0x12')](_0x5af4('0xe'),auth[_0x5af4('0xb')](),controller[_0x5af4('0x13')]);router[_0x5af4('0x14')](_0x5af4('0xe'),auth[_0x5af4('0xb')](),controller[_0x5af4('0x15')]);module[_0x5af4('0x16')]=router; \ No newline at end of file +var _0x604e=['exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','get','describe','show','create','put','update','delete','/:id'];(function(_0x38604d,_0x25602a){var _0x1b66b0=function(_0xe18e8f){while(--_0xe18e8f){_0x38604d['push'](_0x38604d['shift']());}};_0x1b66b0(++_0x25602a);}(_0x604e,0xd9));var _0xe604=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x604e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe604('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe604('0x1'));var express=require(_0xe604('0x2'));var router=express['Router']();var auth=require(_0xe604('0x3'));var interaction=require(_0xe604('0x4'));var config=require(_0xe604('0x5'));var controller=require(_0xe604('0x6'));router['get']('/',auth[_0xe604('0x7')](),controller[_0xe604('0x8')]);router[_0xe604('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe604('0xa')]);router[_0xe604('0x9')]('/:id',auth[_0xe604('0x7')](),controller[_0xe604('0xb')]);router['post']('/',auth[_0xe604('0x7')](),controller[_0xe604('0xc')]);router[_0xe604('0xd')]('/:id',auth[_0xe604('0x7')](),controller[_0xe604('0xe')]);router[_0xe604('0xf')](_0xe604('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xe604('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 3a8d644..f855bfe 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 _0xeede=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xeede,0xec));var _0xeeed=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0xeede[_0x5b8b97];return _0x1fdf84;};'use strict';var Sequelize=require(_0xeeed('0x0'));module[_0xeeed('0x1')]={'priority':{'type':Sequelize[_0xeeed('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xeeed('0x3')],'allowNull':![],'defaultValue':_0xeeed('0x4')},'appdata':{'type':Sequelize[_0xeeed('0x5')]()},'description':{'type':Sequelize[_0xeeed('0x3')]},'interval':{'type':Sequelize[_0xeeed('0x3')],'defaultValue':_0xeeed('0x6')}}; \ No newline at end of file +var _0x83ec=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x270402,_0x23c76a){var _0x5f4d2e=function(_0x4aa8d6){while(--_0x4aa8d6){_0x270402['push'](_0x270402['shift']());}};_0x5f4d2e(++_0x23c76a);}(_0x83ec,0x1c7));var _0xc83e=function(_0x569dba,_0x1f08d4){_0x569dba=_0x569dba-0x0;var _0xbfc691=_0x83ec[_0x569dba];return _0xbfc691;};'use strict';var Sequelize=require(_0xc83e('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc83e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc83e('0x2')],'allowNull':![],'defaultValue':_0xc83e('0x3')},'appdata':{'type':Sequelize[_0xc83e('0x4')]()},'description':{'type':Sequelize[_0xc83e('0x2')]},'interval':{'type':Sequelize[_0xc83e('0x2')],'defaultValue':_0xc83e('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2a1a9c8..b0f19b7 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 _0x32ce=['end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','sendStatus','error','send','show','params','keys','ChatApplication','query','intersection','model','attributes','fields','length','include','merge','options','find','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status'];(function(_0x56b275,_0x3462c7){var _0xcd350d=function(_0x4bb6b0){while(--_0x4bb6b0){_0x56b275['push'](_0x56b275['shift']());}};_0xcd350d(++_0x3462c7);}(_0x32ce,0xba));var _0xe32c=function(_0x4e77dd,_0xd9cbc){_0x4e77dd=_0x4e77dd-0x0;var _0x3638ce=_0x32ce[_0x4e77dd];return _0x3638ce;};'use strict';var pdf=require(_0xe32c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe32c('0x1'));var zipdir=require(_0xe32c('0x2'));var jsonpatch=require(_0xe32c('0x3'));var rp=require(_0xe32c('0x4'));var moment=require(_0xe32c('0x5'));var BPromise=require(_0xe32c('0x6'));var Mustache=require(_0xe32c('0x7'));var util=require('util');var path=require(_0xe32c('0x8'));var sox=require('sox');var csv=require(_0xe32c('0x9'));var ejs=require(_0xe32c('0xa'));var fs=require('fs');var _=require(_0xe32c('0xb'));var squel=require('squel');var crypto=require(_0xe32c('0xc'));var jsforce=require(_0xe32c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe32c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe32c('0xe'));var authService=require(_0xe32c('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xe32c('0x10'));var logger=require(_0xe32c('0x11'))(_0xe32c('0x12'));var utils=require(_0xe32c('0x13'));var config=require(_0xe32c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b35ec,_0x12eee7){_0x12eee7=_0x12eee7||0xcc;return function(_0x495f9a){if(_0x495f9a){return _0x3b35ec['sendStatus'](_0x12eee7);}return _0x3b35ec[_0xe32c('0x15')](_0x12eee7)[_0xe32c('0x16')]();};}function respondWithResult(_0x115fb8,_0x333bd9){_0x333bd9=_0x333bd9||0xc8;return function(_0x176c4b){if(_0x176c4b){return _0x115fb8['status'](_0x333bd9)[_0xe32c('0x17')](_0x176c4b);}};}function respondWithFilteredResult(_0x1f62e1,_0x46598f){return function(_0x3ae39d){if(_0x3ae39d){var _0x453e79=_0x3ae39d[_0xe32c('0x18')],_0x553bd3=_0x46598f[_0xe32c('0x19')],_0x3550e6=_0x46598f['offset']+_0x46598f[_0xe32c('0x1a')],_0x2d96c9;if(_0x3550e6>=_0x453e79){_0x3550e6=_0x453e79;_0x2d96c9=0xc8;}else{_0x2d96c9=0xce;}_0x1f62e1[_0xe32c('0x15')](_0x2d96c9);return _0x1f62e1['set'](_0xe32c('0x1b'),_0x553bd3+'-'+_0x3550e6+'/'+_0x453e79)[_0xe32c('0x17')](_0x3ae39d);}return null;};}function patchUpdates(_0x114cf0){return function(_0x27ffb4){try{jsonpatch['apply'](_0x27ffb4,_0x114cf0,!![]);}catch(_0x19b8fc){return BPromise[_0xe32c('0x1c')](_0x19b8fc);}return _0x27ffb4[_0xe32c('0x1d')]();};}function saveUpdates(_0x538225,_0x567f8a){return function(_0x22e2df){if(_0x22e2df){return _0x22e2df[_0xe32c('0x1e')](_0x538225)[_0xe32c('0x1f')](function(_0x2d8dc0){return _0x2d8dc0;});}return null;};}function removeEntity(_0x18c07d,_0x2b0878){return function(_0x1591e4){if(_0x1591e4){return _0x1591e4[_0xe32c('0x20')]()[_0xe32c('0x1f')](function(){_0x18c07d[_0xe32c('0x15')](0xcc)[_0xe32c('0x16')]();});}};}function handleEntityNotFound(_0x4cc1b1,_0x4d4f10){return function(_0x57ffe5){if(!_0x57ffe5){_0x4cc1b1[_0xe32c('0x21')](0x194);}return _0x57ffe5;};}function handleError(_0x4fbcb3,_0x23bc9e){_0x23bc9e=_0x23bc9e||0x1f4;return function(_0x138032){logger[_0xe32c('0x22')](_0x138032['stack']);if(_0x138032['name']){delete _0x138032['name'];}_0x4fbcb3[_0xe32c('0x15')](_0x23bc9e)[_0xe32c('0x23')](_0x138032);};}exports[_0xe32c('0x24')]=function(_0x44e7ad,_0x4f5da3){var _0x3dad27={'raw':!![],'where':{'id':_0x44e7ad[_0xe32c('0x25')]['id']}},_0x225245={};_0x225245['model']=_[_0xe32c('0x26')](db[_0xe32c('0x27')]['rawAttributes']);_0x225245[_0xe32c('0x28')]=_[_0xe32c('0x26')](_0x44e7ad[_0xe32c('0x28')]);_0x225245['filters']=_[_0xe32c('0x29')](_0x225245[_0xe32c('0x2a')],_0x225245[_0xe32c('0x28')]);_0x3dad27[_0xe32c('0x2b')]=_['intersection'](_0x225245['model'],qs[_0xe32c('0x2c')](_0x44e7ad[_0xe32c('0x28')]['fields']));_0x3dad27[_0xe32c('0x2b')]=_0x3dad27[_0xe32c('0x2b')][_0xe32c('0x2d')]?_0x3dad27[_0xe32c('0x2b')]:_0x225245[_0xe32c('0x2a')];if(_0x44e7ad['query']['includeAll']){_0x3dad27[_0xe32c('0x2e')]=[{'all':!![]}];}_0x3dad27=_[_0xe32c('0x2f')]({},_0x3dad27,_0x44e7ad[_0xe32c('0x30')]);return db[_0xe32c('0x27')][_0xe32c('0x31')](_0x3dad27)[_0xe32c('0x1f')](handleEntityNotFound(_0x4f5da3,null))[_0xe32c('0x1f')](respondWithResult(_0x4f5da3,null))[_0xe32c('0x32')](handleError(_0x4f5da3,null));};exports[_0xe32c('0x1e')]=function(_0x174a93,_0x43e6d2){if(_0x174a93[_0xe32c('0x33')]['id']){delete _0x174a93[_0xe32c('0x33')]['id'];}return db[_0xe32c('0x27')][_0xe32c('0x31')]({'where':{'id':_0x174a93[_0xe32c('0x25')]['id']}})[_0xe32c('0x1f')](handleEntityNotFound(_0x43e6d2,null))[_0xe32c('0x1f')](saveUpdates(_0x174a93['body'],null))['then'](respondWithResult(_0x43e6d2,null))['catch'](handleError(_0x43e6d2,null));};exports[_0xe32c('0x20')]=function(_0x229f60,_0x59fc36){return db['ChatApplication'][_0xe32c('0x31')]({'where':{'id':_0x229f60[_0xe32c('0x25')]['id']}})[_0xe32c('0x1f')](handleEntityNotFound(_0x59fc36,null))[_0xe32c('0x1f')](removeEntity(_0x59fc36,null))['catch'](handleError(_0x59fc36,null));}; \ No newline at end of file +var _0x2fc8=['bluebird','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','model','length','merge','find','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x36c728,_0x2b536c){var _0x18bf9a=function(_0x1d750a){while(--_0x1d750a){_0x36c728['push'](_0x36c728['shift']());}};_0x18bf9a(++_0x2b536c);}(_0x2fc8,0x118));var _0x82fc=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x2fc8[_0x3054be];return _0x3df150;};'use strict';var pdf=require(_0x82fc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x82fc('0x1'));var zipdir=require(_0x82fc('0x2'));var jsonpatch=require(_0x82fc('0x3'));var rp=require(_0x82fc('0x4'));var moment=require('moment');var BPromise=require(_0x82fc('0x5'));var Mustache=require(_0x82fc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x82fc('0x7'));var ejs=require(_0x82fc('0x8'));var fs=require('fs');var _=require(_0x82fc('0x9'));var squel=require(_0x82fc('0xa'));var crypto=require(_0x82fc('0xb'));var jsforce=require(_0x82fc('0xc'));var deskjs=require(_0x82fc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x82fc('0xe'));var Papa=require(_0x82fc('0xf'));var Redis=require(_0x82fc('0x10'));var authService=require(_0x82fc('0x11'));var qs=require(_0x82fc('0x12'));var hardwareService=require(_0x82fc('0x13'));var logger=require(_0x82fc('0x14'))(_0x82fc('0x15'));var utils=require(_0x82fc('0x16'));var config=require(_0x82fc('0x17'));var db=require(_0x82fc('0x18'))['db'];function respondWithStatusCode(_0x3a5c1f,_0x3650f9){_0x3650f9=_0x3650f9||0xcc;return function(_0x641017){if(_0x641017){return _0x3a5c1f[_0x82fc('0x19')](_0x3650f9);}return _0x3a5c1f['status'](_0x3650f9)[_0x82fc('0x1a')]();};}function respondWithResult(_0x4e2491,_0x288e20){_0x288e20=_0x288e20||0xc8;return function(_0x8217ea){if(_0x8217ea){return _0x4e2491[_0x82fc('0x1b')](_0x288e20)[_0x82fc('0x1c')](_0x8217ea);}};}function respondWithFilteredResult(_0x15a342,_0xc3d8c2){return function(_0x14cb27){if(_0x14cb27){var _0x2a0649=_0x14cb27[_0x82fc('0x1d')],_0xc2f36c=_0xc3d8c2[_0x82fc('0x1e')],_0x937a8f=_0xc3d8c2[_0x82fc('0x1e')]+_0xc3d8c2[_0x82fc('0x1f')],_0x2fb961;if(_0x937a8f>=_0x2a0649){_0x937a8f=_0x2a0649;_0x2fb961=0xc8;}else{_0x2fb961=0xce;}_0x15a342[_0x82fc('0x1b')](_0x2fb961);return _0x15a342[_0x82fc('0x20')](_0x82fc('0x21'),_0xc2f36c+'-'+_0x937a8f+'/'+_0x2a0649)[_0x82fc('0x1c')](_0x14cb27);}return null;};}function patchUpdates(_0x3896f6){return function(_0x4a8546){try{jsonpatch[_0x82fc('0x22')](_0x4a8546,_0x3896f6,!![]);}catch(_0xf6a8a5){return BPromise[_0x82fc('0x23')](_0xf6a8a5);}return _0x4a8546['save']();};}function saveUpdates(_0x7b5764,_0x3e05a1){return function(_0x6d4dde){if(_0x6d4dde){return _0x6d4dde[_0x82fc('0x24')](_0x7b5764)[_0x82fc('0x25')](function(_0xfd982a){return _0xfd982a;});}return null;};}function removeEntity(_0x298be4,_0x35a578){return function(_0x255f95){if(_0x255f95){return _0x255f95[_0x82fc('0x26')]()['then'](function(){_0x298be4[_0x82fc('0x1b')](0xcc)[_0x82fc('0x1a')]();});}};}function handleEntityNotFound(_0x20b786,_0xb54e92){return function(_0xfae31c){if(!_0xfae31c){_0x20b786[_0x82fc('0x19')](0x194);}return _0xfae31c;};}function handleError(_0xd0861b,_0x4cd7f6){_0x4cd7f6=_0x4cd7f6||0x1f4;return function(_0x2dcc74){logger[_0x82fc('0x27')](_0x2dcc74[_0x82fc('0x28')]);if(_0x2dcc74[_0x82fc('0x29')]){delete _0x2dcc74[_0x82fc('0x29')];}_0xd0861b[_0x82fc('0x1b')](_0x4cd7f6)['send'](_0x2dcc74);};}exports[_0x82fc('0x2a')]=function(_0x5bb18e,_0x1b2b76){var _0x56402d={'raw':!![],'where':{'id':_0x5bb18e[_0x82fc('0x2b')]['id']}},_0x300751={};_0x300751['model']=_[_0x82fc('0x2c')](db[_0x82fc('0x2d')][_0x82fc('0x2e')]);_0x300751[_0x82fc('0x2f')]=_['keys'](_0x5bb18e[_0x82fc('0x2f')]);_0x300751[_0x82fc('0x30')]=_[_0x82fc('0x31')](_0x300751['model'],_0x300751[_0x82fc('0x2f')]);_0x56402d[_0x82fc('0x32')]=_['intersection'](_0x300751[_0x82fc('0x33')],qs['fields'](_0x5bb18e[_0x82fc('0x2f')]['fields']));_0x56402d[_0x82fc('0x32')]=_0x56402d['attributes'][_0x82fc('0x34')]?_0x56402d[_0x82fc('0x32')]:_0x300751[_0x82fc('0x33')];if(_0x5bb18e[_0x82fc('0x2f')]['includeAll']){_0x56402d['include']=[{'all':!![]}];}_0x56402d=_[_0x82fc('0x35')]({},_0x56402d,_0x5bb18e['options']);return db[_0x82fc('0x2d')][_0x82fc('0x36')](_0x56402d)[_0x82fc('0x25')](handleEntityNotFound(_0x1b2b76,null))[_0x82fc('0x25')](respondWithResult(_0x1b2b76,null))[_0x82fc('0x37')](handleError(_0x1b2b76,null));};exports[_0x82fc('0x24')]=function(_0xcc72ec,_0x51e0a4){if(_0xcc72ec[_0x82fc('0x38')]['id']){delete _0xcc72ec['body']['id'];}return db[_0x82fc('0x2d')]['find']({'where':{'id':_0xcc72ec[_0x82fc('0x2b')]['id']}})[_0x82fc('0x25')](handleEntityNotFound(_0x51e0a4,null))[_0x82fc('0x25')](saveUpdates(_0xcc72ec[_0x82fc('0x38')],null))[_0x82fc('0x25')](respondWithResult(_0x51e0a4,null))['catch'](handleError(_0x51e0a4,null));};exports[_0x82fc('0x26')]=function(_0x187cf5,_0x20c3db){return db[_0x82fc('0x2d')]['find']({'where':{'id':_0x187cf5[_0x82fc('0x2b')]['id']}})[_0x82fc('0x25')](handleEntityNotFound(_0x20c3db,null))[_0x82fc('0x25')](removeEntity(_0x20c3db,null))[_0x82fc('0x37')](handleError(_0x20c3db,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 6e1dd0d..1dad767 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2eea6d1..5179637 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 _0x4bc3=['info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1f38c2,_0x49cee1){var _0x162c59=function(_0x24b45d){while(--_0x24b45d){_0x1f38c2['push'](_0x1f38c2['shift']());}};_0x162c59(++_0x49cee1);}(_0x4bc3,0x107));var _0x34bc=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4bc3[_0x5a776b];return _0xbbef59;};'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':0x232a});function respondWithRpcPromise(_0x26dcec,_0x4c5b6a,_0x4b018d){return new BPromise(function(_0x22b365,_0xa46259){return client[_0x34bc('0xb')](_0x26dcec,_0x4b018d)[_0x34bc('0xc')](function(_0x2bc33b){logger[_0x34bc('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4c5b6a,_0x34bc('0xe'));logger[_0x34bc('0xf')](_0x34bc('0x10'),_0x4c5b6a,_0x34bc('0xe'),JSON['stringify'](_0x2bc33b));if(_0x2bc33b[_0x34bc('0x11')]){if(_0x2bc33b[_0x34bc('0x11')][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x4c5b6a,_0x2bc33b['error'][_0x34bc('0x14')]);return _0xa46259(_0x2bc33b[_0x34bc('0x11')][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x4c5b6a,_0x2bc33b['error']['message']);return _0x22b365(_0x2bc33b[_0x34bc('0x11')][_0x34bc('0x14')]);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x4c5b6a,_0x34bc('0xe'));_0x22b365(_0x2bc33b[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x46e087){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x4c5b6a,_0x46e087);_0xa46259(_0x46e087);});});} \ No newline at end of file +var _0xf3fb=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','ChatApplication,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x262736,_0x1c6067){var _0x5e018a=function(_0x5e96fc){while(--_0x5e96fc){_0x262736['push'](_0x262736['shift']());}};_0x5e018a(++_0x1c6067);}(_0xf3fb,0x1eb));var _0xbf3f=function(_0x2211b2,_0x3c32a7){_0x2211b2=_0x2211b2-0x0;var _0x1ff209=_0xf3fb[_0x2211b2];return _0x1ff209;};'use strict';var _=require(_0xbf3f('0x0'));var util=require('util');var moment=require(_0xbf3f('0x1'));var BPromise=require(_0xbf3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf3f('0x3'));var db=require(_0xbf3f('0x4'))['db'];var utils=require(_0xbf3f('0x5'));var logger=require(_0xbf3f('0x6'))(_0xbf3f('0x7'));var config=require(_0xbf3f('0x8'));var jayson=require(_0xbf3f('0x9'));var client=jayson[_0xbf3f('0xa')][_0xbf3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x456886,_0x1dac3e,_0x3a800d){return new BPromise(function(_0x5a41e1,_0x1afd0a){return client[_0xbf3f('0xc')](_0x456886,_0x3a800d)[_0xbf3f('0xd')](function(_0x3624d3){logger[_0xbf3f('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1dac3e,_0xbf3f('0xf'));logger[_0xbf3f('0x10')](_0xbf3f('0x11'),_0x1dac3e,_0xbf3f('0xf'),JSON['stringify'](_0x3624d3));if(_0x3624d3[_0xbf3f('0x12')]){if(_0x3624d3[_0xbf3f('0x12')]['code']===0x1f4){logger['error'](_0xbf3f('0x13'),_0x1dac3e,_0x3624d3[_0xbf3f('0x12')][_0xbf3f('0x14')]);return _0x1afd0a(_0x3624d3[_0xbf3f('0x12')][_0xbf3f('0x14')]);}logger['error'](_0xbf3f('0x13'),_0x1dac3e,_0x3624d3[_0xbf3f('0x12')]['message']);return _0x5a41e1(_0x3624d3[_0xbf3f('0x12')][_0xbf3f('0x14')]);}else{logger[_0xbf3f('0xe')](_0xbf3f('0x13'),_0x1dac3e,'request\x20sent');_0x5a41e1(_0x3624d3[_0xbf3f('0x15')][_0xbf3f('0x14')]);}})['catch'](function(_0x40725c){logger[_0xbf3f('0x12')](_0xbf3f('0x13'),_0x1dac3e,_0x40725c);_0x1afd0a(_0x40725c);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index bce7d83..6546e36 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 _0x1d75=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5a57a3,_0x2a7018){var _0x2ef960=function(_0x9de98f){while(--_0x9de98f){_0x5a57a3['push'](_0x5a57a3['shift']());}};_0x2ef960(++_0x2a7018);}(_0x1d75,0x95));var _0x51d7=function(_0x38a050,_0x146a74){_0x38a050=_0x38a050-0x0;var _0x373062=_0x1d75[_0x38a050];return _0x373062;};'use strict';var multer=require(_0x51d7('0x0'));var util=require(_0x51d7('0x1'));var path=require(_0x51d7('0x2'));var timeout=require(_0x51d7('0x3'));var express=require(_0x51d7('0x4'));var router=express['Router']();var auth=require(_0x51d7('0x5'));var interaction=require(_0x51d7('0x6'));var config=require(_0x51d7('0x7'));var controller=require(_0x51d7('0x8'));router[_0x51d7('0x9')]('/:id',auth[_0x51d7('0xa')](),controller['show']);router[_0x51d7('0xb')](_0x51d7('0xc'),auth['isAuthenticated'](),controller[_0x51d7('0xd')]);router[_0x51d7('0xe')](_0x51d7('0xc'),auth[_0x51d7('0xa')](),controller[_0x51d7('0xf')]);module[_0x51d7('0x10')]=router; \ No newline at end of file +var _0x41cb=['/:id','isAuthenticated','show','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get'];(function(_0xffd9e8,_0x165d2a){var _0x5d6c6e=function(_0x51e3f9){while(--_0x51e3f9){_0xffd9e8['push'](_0xffd9e8['shift']());}};_0x5d6c6e(++_0x165d2a);}(_0x41cb,0x1e6));var _0xb41c=function(_0x12e948,_0x1da6c6){_0x12e948=_0x12e948-0x0;var _0x31d715=_0x41cb[_0x12e948];return _0x31d715;};'use strict';var multer=require(_0xb41c('0x0'));var util=require(_0xb41c('0x1'));var path=require('path');var timeout=require(_0xb41c('0x2'));var express=require(_0xb41c('0x3'));var router=express[_0xb41c('0x4')]();var auth=require(_0xb41c('0x5'));var interaction=require(_0xb41c('0x6'));var config=require('../../config/environment');var controller=require(_0xb41c('0x7'));router[_0xb41c('0x8')](_0xb41c('0x9'),auth[_0xb41c('0xa')](),controller[_0xb41c('0xb')]);router['put']('/:id',auth[_0xb41c('0xa')](),controller['update']);router[_0xb41c('0xc')]('/:id',auth[_0xb41c('0xa')](),controller[_0xb41c('0xd')]);module[_0xb41c('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d84714c..ab045ac 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 _0xc069=['sequelize','exports','BOOLEAN'];(function(_0x78665d,_0x259080){var _0x51eb1f=function(_0x360032){while(--_0x360032){_0x78665d['push'](_0x78665d['shift']());}};_0x51eb1f(++_0x259080);}(_0xc069,0x7e));var _0x9c06=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc069[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9c06('0x0'));module[_0x9c06('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x9c06('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa57d=['BOOLEAN','STRING'];(function(_0x5714bc,_0x1597c1){var _0x3eebde=function(_0x706e9a){while(--_0x706e9a){_0x5714bc['push'](_0x5714bc['shift']());}};_0x3eebde(++_0x1597c1);}(_0xa57d,0x147));var _0xda57=function(_0x534380,_0x4c3a1d){_0x534380=_0x534380-0x0;var _0x18f1c0=_0xa57d[_0x534380];return _0x18f1c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xda57('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xda57('0x0')]},'write':{'type':Sequelize[_0xda57('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4bee534..37ded01 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 _0xa688=['then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','ChatGroup','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','type','key','merge','includeAll','findAll','rows','catch','params','include','options','create','update','body','find','describe','getUnread','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','client','test','Sequelize','request'];(function(_0x11ce5a,_0x143309){var _0xc9efd0=function(_0x4eec6e){while(--_0x4eec6e){_0x11ce5a['push'](_0x11ce5a['shift']());}};_0xc9efd0(++_0x143309);}(_0xa688,0x122));var _0x8a68=function(_0x541095,_0x582b30){_0x541095=_0x541095-0x0;var _0x5a2c40=_0xa688[_0x541095];return _0x5a2c40;};'use strict';var pdf=require(_0x8a68('0x0'));var emlformat=require(_0x8a68('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8a68('0x2'));var moment=require(_0x8a68('0x3'));var BPromise=require(_0x8a68('0x4'));var Mustache=require('mustache');var util=require(_0x8a68('0x5'));var path=require(_0x8a68('0x6'));var sox=require(_0x8a68('0x7'));var csv=require(_0x8a68('0x8'));var ejs=require(_0x8a68('0x9'));var fs=require('fs');var _=require(_0x8a68('0xa'));var squel=require('squel');var crypto=require(_0x8a68('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8a68('0xc'));var toCsv=require(_0x8a68('0x8'));var querystring=require('querystring');var Papa=require(_0x8a68('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x8a68('0xe'));var logger=require(_0x8a68('0xf'))(_0x8a68('0x10'));var utils=require(_0x8a68('0x11'));var config=require('../../config/environment');var db=require(_0x8a68('0x12'))['db'];config[_0x8a68('0x13')]=_['defaults'](config[_0x8a68('0x13')],{'host':_0x8a68('0x14'),'port':0x18eb});var socket=require(_0x8a68('0x15'))(new Redis(config[_0x8a68('0x13')]));require(_0x8a68('0x16'))['register'](socket);var jayson=require(_0x8a68('0x17'));var client=jayson[_0x8a68('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x12fd60,_0x1d10e1,_0x5ab293){if(_0x5ab293){var _0x27d07=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27d07[_0x8a68('0x19')](_0x1d10e1)){return _0x12fd60;}else{throw new db[(_0x8a68('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 _0x12fd60;}}function respondWithRpcPromise(_0x48de33,_0x1aa5f2,_0xfcee07,_0x240124){return new BPromise(function(_0x5836ae,_0x2de527){var _0x42ddf0=_0x240124||client;return _0x42ddf0[_0x8a68('0x1b')](_0x48de33,_0xfcee07)[_0x8a68('0x1c')](function(_0x2d60ed){logger[_0x8a68('0x1d')](_0x8a68('0x1e'),_0x1aa5f2,_0x8a68('0x1f'));logger[_0x8a68('0x20')](_0x8a68('0x21'),_0x1aa5f2,_0x8a68('0x1f'),JSON[_0x8a68('0x22')](_0x2d60ed));if(_0x2d60ed[_0x8a68('0x23')]){if(_0x2d60ed[_0x8a68('0x23')][_0x8a68('0x24')]===0x1f4){logger[_0x8a68('0x23')]('ChatGroup,\x20%s,\x20%s',_0x1aa5f2,_0x2d60ed[_0x8a68('0x23')][_0x8a68('0x25')]);return _0x2de527(_0x2d60ed[_0x8a68('0x23')][_0x8a68('0x25')]);}logger['error'](_0x8a68('0x1e'),_0x1aa5f2,_0x2d60ed[_0x8a68('0x23')][_0x8a68('0x25')]);return _0x5836ae(_0x2d60ed['error']['message']);}else{logger[_0x8a68('0x1d')](_0x8a68('0x1e'),_0x1aa5f2,_0x8a68('0x1f'));_0x5836ae(_0x2d60ed[_0x8a68('0x26')]['message']);}})['catch'](function(_0x55dde0){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1aa5f2,_0x55dde0);_0x2de527(_0x55dde0);});});}function respondWithStatusCode(_0x1be8c1,_0x5804f2){_0x5804f2=_0x5804f2||0xcc;return function(_0x2054f9){if(_0x2054f9){return _0x1be8c1[_0x8a68('0x27')](_0x5804f2);}return _0x1be8c1[_0x8a68('0x28')](_0x5804f2)[_0x8a68('0x29')]();};}function respondWithResult(_0x101c0d,_0x24f957){_0x24f957=_0x24f957||0xc8;return function(_0x5a007d){if(_0x5a007d){return _0x101c0d[_0x8a68('0x28')](_0x24f957)[_0x8a68('0x2a')](_0x5a007d);}};}function respondWithFilteredResult(_0x2ed3a1,_0x23395c){return function(_0xf8a60e){if(_0xf8a60e){var _0x3dbcb0=_0xf8a60e[_0x8a68('0x2b')],_0x59707a=_0x23395c['offset'],_0x3f1354=_0x23395c[_0x8a68('0x2c')]+_0x23395c[_0x8a68('0x2d')],_0x45e228;if(_0x3f1354>=_0x3dbcb0){_0x3f1354=_0x3dbcb0;_0x45e228=0xc8;}else{_0x45e228=0xce;}_0x2ed3a1[_0x8a68('0x28')](_0x45e228);return _0x2ed3a1[_0x8a68('0x2e')](_0x8a68('0x2f'),_0x59707a+'-'+_0x3f1354+'/'+_0x3dbcb0)[_0x8a68('0x2a')](_0xf8a60e);}return null;};}function patchUpdates(_0x49b0e3){return function(_0x4c72fb){try{jsonpatch[_0x8a68('0x30')](_0x4c72fb,_0x49b0e3,!![]);}catch(_0x241164){return BPromise[_0x8a68('0x31')](_0x241164);}return _0x4c72fb[_0x8a68('0x32')]();};}function saveUpdates(_0x447302,_0x1a7a24){return function(_0x4d2255){if(_0x4d2255){return _0x4d2255['update'](_0x447302)[_0x8a68('0x1c')](function(_0x45d50c){return _0x45d50c;});}return null;};}function removeEntity(_0x4eefaa,_0x125a62){return function(_0x2edc7d){if(_0x2edc7d){return _0x2edc7d[_0x8a68('0x33')]()[_0x8a68('0x1c')](function(){_0x4eefaa['status'](0xcc)[_0x8a68('0x29')]();});}};}function handleEntityNotFound(_0x409d9c,_0x1ae00a){return function(_0x549847){if(!_0x549847){_0x409d9c[_0x8a68('0x27')](0x194);}return _0x549847;};}function handleError(_0x553af5,_0xc100f){_0xc100f=_0xc100f||0x1f4;return function(_0x2c209d){logger['error'](_0x2c209d[_0x8a68('0x34')]);if(_0x2c209d[_0x8a68('0x35')]){delete _0x2c209d['name'];}_0x553af5[_0x8a68('0x28')](_0xc100f)['send'](_0x2c209d);};}exports[_0x8a68('0x36')]=function(_0x158e2f,_0x39ad2e){var _0x516c8d={},_0x159941={},_0x4ebb0b={'count':0x0,'rows':[]};var _0x36c26e=db[_0x8a68('0x37')][_0x8a68('0x38')];_0x159941[_0x8a68('0x39')]=_[_0x8a68('0x3a')](_0x36c26e);_0x159941[_0x8a68('0x3b')]=_[_0x8a68('0x3a')](_0x158e2f['query']);_0x159941[_0x8a68('0x3c')]=_[_0x8a68('0x3d')](_0x159941['model'],_0x159941[_0x8a68('0x3b')]);_0x516c8d[_0x8a68('0x3e')]=_[_0x8a68('0x3d')](_0x159941[_0x8a68('0x39')],qs[_0x8a68('0x3f')](_0x158e2f[_0x8a68('0x3b')][_0x8a68('0x3f')]));_0x516c8d[_0x8a68('0x3e')]=_0x516c8d['attributes'][_0x8a68('0x40')]?_0x516c8d[_0x8a68('0x3e')]:_0x159941['model'];if(!_0x158e2f[_0x8a68('0x3b')]['hasOwnProperty'](_0x8a68('0x41'))){_0x516c8d[_0x8a68('0x2d')]=qs['limit'](_0x158e2f[_0x8a68('0x3b')][_0x8a68('0x2d')]);_0x516c8d[_0x8a68('0x2c')]=qs[_0x8a68('0x2c')](_0x158e2f[_0x8a68('0x3b')]['offset']);}_0x516c8d[_0x8a68('0x42')]=qs[_0x8a68('0x43')](_0x158e2f[_0x8a68('0x3b')][_0x8a68('0x43')]);_0x516c8d[_0x8a68('0x44')]=qs['filters'](_[_0x8a68('0x45')](_0x158e2f[_0x8a68('0x3b')],_0x159941[_0x8a68('0x3c')]));if(_0x158e2f[_0x8a68('0x3b')][_0x8a68('0x46')]){_0x516c8d[_0x8a68('0x44')]=_['merge'](_0x516c8d[_0x8a68('0x44')],{'$or':_[_0x8a68('0x47')](_0x36c26e,function(_0x459ab5){if(_0x459ab5[_0x8a68('0x48')][_0x8a68('0x49')]!=='VIRTUAL'){var _0x41c3dc={};_0x41c3dc[_0x459ab5['field']]={'$like':'%'+_0x158e2f[_0x8a68('0x3b')][_0x8a68('0x46')]+'%'};return _0x41c3dc;}})});}_0x516c8d=_[_0x8a68('0x4a')]({},_0x516c8d,_0x158e2f['options']);var _0x38f02d={'where':_0x516c8d[_0x8a68('0x44')]};return db[_0x8a68('0x37')][_0x8a68('0x2b')](_0x38f02d)[_0x8a68('0x1c')](function(_0x54964e){_0x4ebb0b[_0x8a68('0x2b')]=_0x54964e;if(_0x158e2f[_0x8a68('0x3b')][_0x8a68('0x4b')]){_0x516c8d['include']=[{'all':!![]}];}return db['ChatGroup'][_0x8a68('0x4c')](_0x516c8d);})['then'](function(_0x1b2d7d){_0x4ebb0b[_0x8a68('0x4d')]=_0x1b2d7d;return _0x4ebb0b;})[_0x8a68('0x1c')](respondWithFilteredResult(_0x39ad2e,_0x516c8d))[_0x8a68('0x4e')](handleError(_0x39ad2e,null));};exports['show']=function(_0x3d6345,_0x5d17b7){var _0x1e3113={'raw':!![],'where':{'id':_0x3d6345[_0x8a68('0x4f')]['id']}},_0x1a3a96={};_0x1a3a96['model']=_['keys'](db[_0x8a68('0x37')][_0x8a68('0x38')]);_0x1a3a96[_0x8a68('0x3b')]=_['keys'](_0x3d6345[_0x8a68('0x3b')]);_0x1a3a96[_0x8a68('0x3c')]=_[_0x8a68('0x3d')](_0x1a3a96[_0x8a68('0x39')],_0x1a3a96['query']);_0x1e3113['attributes']=_[_0x8a68('0x3d')](_0x1a3a96[_0x8a68('0x39')],qs[_0x8a68('0x3f')](_0x3d6345[_0x8a68('0x3b')][_0x8a68('0x3f')]));_0x1e3113[_0x8a68('0x3e')]=_0x1e3113[_0x8a68('0x3e')][_0x8a68('0x40')]?_0x1e3113[_0x8a68('0x3e')]:_0x1a3a96['model'];if(_0x3d6345[_0x8a68('0x3b')][_0x8a68('0x4b')]){_0x1e3113[_0x8a68('0x50')]=[{'all':!![]}];}_0x1e3113=_[_0x8a68('0x4a')]({},_0x1e3113,_0x3d6345[_0x8a68('0x51')]);return db[_0x8a68('0x37')]['find'](_0x1e3113)[_0x8a68('0x1c')](handleEntityNotFound(_0x5d17b7,null))[_0x8a68('0x1c')](respondWithResult(_0x5d17b7,null))[_0x8a68('0x4e')](handleError(_0x5d17b7,null));};exports['create']=function(_0x2cb191,_0x291595){return db[_0x8a68('0x37')][_0x8a68('0x52')](_0x2cb191['body'],{})['then'](respondWithResult(_0x291595,0xc9))['catch'](handleError(_0x291595,null));};exports[_0x8a68('0x53')]=function(_0x3e44f6,_0xc1b429){if(_0x3e44f6[_0x8a68('0x54')]['id']){delete _0x3e44f6[_0x8a68('0x54')]['id'];}return db[_0x8a68('0x37')][_0x8a68('0x55')]({'where':{'id':_0x3e44f6[_0x8a68('0x4f')]['id']}})[_0x8a68('0x1c')](handleEntityNotFound(_0xc1b429,null))[_0x8a68('0x1c')](saveUpdates(_0x3e44f6[_0x8a68('0x54')],null))[_0x8a68('0x1c')](respondWithResult(_0xc1b429,null))[_0x8a68('0x4e')](handleError(_0xc1b429,null));};exports[_0x8a68('0x33')]=function(_0x1c4c84,_0x1aa908){return db[_0x8a68('0x37')][_0x8a68('0x55')]({'where':{'id':_0x1c4c84[_0x8a68('0x4f')]['id']}})[_0x8a68('0x1c')](handleEntityNotFound(_0x1aa908,null))[_0x8a68('0x1c')](removeEntity(_0x1aa908,null))['catch'](handleError(_0x1aa908,null));};exports[_0x8a68('0x56')]=function(_0x4f4c44,_0x5270c0){return db[_0x8a68('0x37')][_0x8a68('0x56')]()[_0x8a68('0x1c')](respondWithResult(_0x5270c0,null))[_0x8a68('0x4e')](handleError(_0x5270c0,null));};exports[_0x8a68('0x57')]=function(_0x34e6f0,_0x415b2f,_0x205e74){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x34e6f0[_0x8a68('0x4f')]['id'],'ToId':_0x34e6f0[_0x8a68('0x58')]['id'],'read':![]}})['then'](function(_0x15c901){return{'id':_[_0x8a68('0x59')](_0x34e6f0[_0x8a68('0x4f')]['id']),'count':_0x15c901};})[_0x8a68('0x1c')](respondWithResult(_0x415b2f,null))[_0x8a68('0x4e')](handleError(_0x415b2f,null));};exports[_0x8a68('0x5a')]=function(_0x55bccd,_0x298686,_0x2ed235){return db[_0x8a68('0x37')]['find']({'where':{'id':_0x55bccd[_0x8a68('0x4f')]['id']}})[_0x8a68('0x1c')](handleEntityNotFound(_0x298686,null))['then'](function(_0xa29ac4){if(_0xa29ac4){return _0xa29ac4['addMembers'](_0x55bccd[_0x8a68('0x54')][_0x8a68('0x5b')],_[_0x8a68('0x5c')](_0x55bccd[_0x8a68('0x54')],[_0x8a68('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x298686,null))[_0x8a68('0x4e')](handleError(_0x298686,null));};exports['getMembers']=function(_0x48530b,_0x4ed3ca,_0x3ac4a3){var _0x40b8c0={};var _0x12042c={};var _0x101205;var _0x33ff2b;return db['ChatGroup'][_0x8a68('0x5d')]({'where':{'id':_0x48530b['params']['id']}})[_0x8a68('0x1c')](handleEntityNotFound(_0x4ed3ca,null))[_0x8a68('0x1c')](function(_0x53b250){if(_0x53b250){_0x101205=_0x53b250;_0x12042c[_0x8a68('0x39')]=_[_0x8a68('0x3a')](db[_0x8a68('0x5e')][_0x8a68('0x38')]);_0x12042c[_0x8a68('0x3b')]=_[_0x8a68('0x3a')](_0x48530b[_0x8a68('0x3b')]);_0x12042c[_0x8a68('0x3c')]=_[_0x8a68('0x3d')](_0x12042c[_0x8a68('0x39')],_0x12042c[_0x8a68('0x3b')]);_0x40b8c0[_0x8a68('0x3e')]=_[_0x8a68('0x3d')](_0x12042c[_0x8a68('0x39')],qs['fields'](_0x48530b[_0x8a68('0x3b')][_0x8a68('0x3f')]));_0x40b8c0[_0x8a68('0x3e')]=_0x40b8c0[_0x8a68('0x3e')][_0x8a68('0x40')]?_0x40b8c0[_0x8a68('0x3e')]:_0x12042c[_0x8a68('0x39')];_0x40b8c0['order']=qs['sort'](_0x48530b[_0x8a68('0x3b')]['sort']);_0x40b8c0[_0x8a68('0x44')]=qs[_0x8a68('0x3c')](_['pick'](_0x48530b['query'],_0x12042c['filters']));if(_0x48530b[_0x8a68('0x3b')][_0x8a68('0x46')]){_0x40b8c0[_0x8a68('0x44')]=_[_0x8a68('0x4a')](_0x40b8c0[_0x8a68('0x44')],{'$or':_[_0x8a68('0x47')](_0x40b8c0[_0x8a68('0x3e')],function(_0xecb8e6){var _0x173350={};_0x173350[_0xecb8e6]={'$like':'%'+_0x48530b[_0x8a68('0x3b')][_0x8a68('0x46')]+'%'};return _0x173350;})});}_0x40b8c0=_[_0x8a68('0x4a')]({},_0x40b8c0,_0x48530b['options']);return _0x101205[_0x8a68('0x5f')](_0x40b8c0);}})['then'](function(_0x47b6b5){if(_0x47b6b5){_0x33ff2b=_0x47b6b5[_0x8a68('0x40')];if(!_0x48530b['query'][_0x8a68('0x60')](_0x8a68('0x41'))){_0x40b8c0[_0x8a68('0x2d')]=qs[_0x8a68('0x2d')](_0x48530b['query'][_0x8a68('0x2d')]);_0x40b8c0[_0x8a68('0x2c')]=qs[_0x8a68('0x2c')](_0x48530b[_0x8a68('0x3b')][_0x8a68('0x2c')]);}return _0x101205[_0x8a68('0x5f')](_0x40b8c0);}})[_0x8a68('0x1c')](function(_0x166d76){if(_0x166d76){return _0x166d76?{'count':_0x33ff2b,'rows':_0x166d76}:null;}})[_0x8a68('0x1c')](respondWithResult(_0x4ed3ca,null))[_0x8a68('0x4e')](handleError(_0x4ed3ca,null));};exports[_0x8a68('0x61')]=function(_0x15f300,_0x41c9c4,_0x16b20b){return db[_0x8a68('0x37')]['find']({'where':{'id':_0x15f300[_0x8a68('0x4f')]['id']}})[_0x8a68('0x1c')](handleEntityNotFound(_0x41c9c4,null))[_0x8a68('0x1c')](function(_0x589fbe){if(_0x589fbe){return _0x589fbe[_0x8a68('0x61')](_0x15f300[_0x8a68('0x3b')][_0x8a68('0x5b')]);}})[_0x8a68('0x1c')](respondWithStatusCode(_0x41c9c4,null))[_0x8a68('0x4e')](handleError(_0x41c9c4,null));};exports[_0x8a68('0x62')]=function(_0x835931,_0x1ee6bb,_0x2bcd58){if(_0x835931[_0x8a68('0x54')]['id']){delete _0x835931[_0x8a68('0x54')]['id'];}return db[_0x8a68('0x37')][_0x8a68('0x55')]({'where':{'id':_0x835931[_0x8a68('0x4f')]['id']}})[_0x8a68('0x1c')](handleEntityNotFound(_0x1ee6bb,null))['then'](function(_0x23a800){if(_0x23a800){_0x835931['body'][_0x8a68('0x63')]=_0x23a800['id'];return db[_0x8a68('0x64')][_0x8a68('0x52')](_0x835931[_0x8a68('0x54')]);}})['then'](respondWithResult(_0x1ee6bb,null))['catch'](handleError(_0x1ee6bb,null));};exports[_0x8a68('0x65')]=function(_0x10cac2,_0x29aa5e,_0x38930e){var _0x16a338={};var _0x4176d2={};var _0x10b0d4;var _0x4fc26e;return db['ChatGroup'][_0x8a68('0x5d')]({'where':{'id':_0x10cac2[_0x8a68('0x4f')]['id']}})[_0x8a68('0x1c')](handleEntityNotFound(_0x29aa5e,null))[_0x8a68('0x1c')](function(_0x4004d6){if(_0x4004d6){_0x10b0d4=_0x4004d6;_0x4176d2[_0x8a68('0x39')]=_[_0x8a68('0x3a')](db['ChatInternalMessage'][_0x8a68('0x38')]);_0x4176d2[_0x8a68('0x3b')]=_[_0x8a68('0x3a')](_0x10cac2['query']);_0x4176d2[_0x8a68('0x3c')]=_[_0x8a68('0x3d')](_0x4176d2['model'],_0x4176d2[_0x8a68('0x3b')]);_0x16a338[_0x8a68('0x3e')]=_[_0x8a68('0x3d')](_0x4176d2['model'],qs['fields'](_0x10cac2[_0x8a68('0x3b')][_0x8a68('0x3f')]));_0x16a338[_0x8a68('0x3e')]=_0x16a338[_0x8a68('0x3e')][_0x8a68('0x40')]?_0x16a338[_0x8a68('0x3e')]:_0x4176d2[_0x8a68('0x39')];_0x16a338['order']=qs['sort'](_0x10cac2['query']['sort']);_0x16a338[_0x8a68('0x44')]=qs[_0x8a68('0x3c')](_[_0x8a68('0x45')](_0x10cac2[_0x8a68('0x3b')],_0x4176d2[_0x8a68('0x3c')]));if(_0x10cac2['query']['filter']){_0x16a338['where']=_[_0x8a68('0x4a')](_0x16a338[_0x8a68('0x44')],{'$or':_[_0x8a68('0x47')](_0x16a338[_0x8a68('0x3e')],function(_0x19d197){var _0x5095b0={};_0x5095b0[_0x19d197]={'$like':'%'+_0x10cac2[_0x8a68('0x3b')][_0x8a68('0x46')]+'%'};return _0x5095b0;})});}if(_0x10cac2[_0x8a68('0x3b')]['$gte']){var _0x55b56e=_0x10cac2[_0x8a68('0x3b')][_0x8a68('0x66')][_0x8a68('0x67')](',');var _0x281071={};_0x281071[_0x55b56e[0x0]]={'$gte':moment(_0x55b56e[0x1])[_0x8a68('0x68')](_0x8a68('0x69'))};_0x16a338[_0x8a68('0x44')]=_[_0x8a68('0x4a')](_0x16a338[_0x8a68('0x44')],_0x281071);}_0x16a338=_['merge']({},_0x16a338,_0x10cac2[_0x8a68('0x51')]);return _0x10b0d4[_0x8a68('0x65')](_0x16a338);}})[_0x8a68('0x1c')](function(_0x569c3c){if(_0x569c3c){_0x4fc26e=_0x569c3c[_0x8a68('0x40')];if(!_0x10cac2[_0x8a68('0x3b')]['hasOwnProperty'](_0x8a68('0x41'))){_0x16a338[_0x8a68('0x2d')]=qs['limit'](_0x10cac2[_0x8a68('0x3b')][_0x8a68('0x2d')]);_0x16a338[_0x8a68('0x2c')]=qs[_0x8a68('0x2c')](_0x10cac2['query'][_0x8a68('0x2c')]);}return _0x10b0d4[_0x8a68('0x65')](_0x16a338);}})[_0x8a68('0x1c')](function(_0x35d1d5){if(_0x35d1d5){return _0x35d1d5?{'count':_0x4fc26e,'rows':_0x35d1d5}:null;}})[_0x8a68('0x1c')](respondWithResult(_0x29aa5e,null))[_0x8a68('0x4e')](handleError(_0x29aa5e,null));}; \ No newline at end of file +var _0xa511=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','destroy','stack','name','send','ChatGroup','rawAttributes','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','count','includeAll','include','findAll','rows','show','params','find','body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','getMembers','findOne','removeMembers','ids','getMessages','$gte','split','format','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info'];(function(_0x345451,_0x42168e){var _0x1be34b=function(_0x1a77c4){while(--_0x1a77c4){_0x345451['push'](_0x345451['shift']());}};_0x1be34b(++_0x42168e);}(_0xa511,0xb0));var _0x1a51=function(_0x812c93,_0x366b2e){_0x812c93=_0x812c93-0x0;var _0x20ebdd=_0xa511[_0x812c93];return _0x20ebdd;};'use strict';var pdf=require(_0x1a51('0x0'));var emlformat=require(_0x1a51('0x1'));var rimraf=require(_0x1a51('0x2'));var zipdir=require(_0x1a51('0x3'));var jsonpatch=require(_0x1a51('0x4'));var rp=require(_0x1a51('0x5'));var moment=require(_0x1a51('0x6'));var BPromise=require(_0x1a51('0x7'));var Mustache=require(_0x1a51('0x8'));var util=require('util');var path=require(_0x1a51('0x9'));var sox=require(_0x1a51('0xa'));var csv=require('to-csv');var ejs=require(_0x1a51('0xb'));var fs=require('fs');var _=require(_0x1a51('0xc'));var squel=require(_0x1a51('0xd'));var crypto=require(_0x1a51('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1a51('0xf'));var toCsv=require(_0x1a51('0x10'));var querystring=require(_0x1a51('0x11'));var Papa=require('papaparse');var Redis=require(_0x1a51('0x12'));var authService=require(_0x1a51('0x13'));var qs=require(_0x1a51('0x14'));var hardwareService=require(_0x1a51('0x15'));var logger=require('../../config/logger')(_0x1a51('0x16'));var utils=require(_0x1a51('0x17'));var config=require('../../config/environment');var db=require(_0x1a51('0x18'))['db'];config['redis']=_[_0x1a51('0x19')](config[_0x1a51('0x1a')],{'host':_0x1a51('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a51('0x1a')]));require('./chatGroup.socket')[_0x1a51('0x1c')](socket);var jayson=require(_0x1a51('0x1d'));var client=jayson[_0x1a51('0x1e')][_0x1a51('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x27b6f6,_0x304100,_0x477b9d){if(_0x477b9d){var _0x47a91b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47a91b[_0x1a51('0x20')](_0x304100)){return _0x27b6f6;}else{throw new db[(_0x1a51('0x21'))][(_0x1a51('0x22'))](_0x1a51('0x23'));}}else{return _0x27b6f6;}}function respondWithRpcPromise(_0x2acd99,_0x4f770f,_0x26df69,_0x4335a){return new BPromise(function(_0x45748f,_0x3c7708){var _0x46acd5=_0x4335a||client;return _0x46acd5['request'](_0x2acd99,_0x26df69)[_0x1a51('0x24')](function(_0x153692){logger[_0x1a51('0x25')](_0x1a51('0x26'),_0x4f770f,_0x1a51('0x27'));logger[_0x1a51('0x28')](_0x1a51('0x29'),_0x4f770f,_0x1a51('0x27'),JSON[_0x1a51('0x2a')](_0x153692));if(_0x153692[_0x1a51('0x2b')]){if(_0x153692[_0x1a51('0x2b')]['code']===0x1f4){logger[_0x1a51('0x2b')](_0x1a51('0x26'),_0x4f770f,_0x153692[_0x1a51('0x2b')]['message']);return _0x3c7708(_0x153692[_0x1a51('0x2b')]['message']);}logger[_0x1a51('0x2b')](_0x1a51('0x26'),_0x4f770f,_0x153692[_0x1a51('0x2b')][_0x1a51('0x2c')]);return _0x45748f(_0x153692['error']['message']);}else{logger[_0x1a51('0x25')](_0x1a51('0x26'),_0x4f770f,_0x1a51('0x27'));_0x45748f(_0x153692[_0x1a51('0x2d')][_0x1a51('0x2c')]);}})[_0x1a51('0x2e')](function(_0x56ba74){logger[_0x1a51('0x2b')]('ChatGroup,\x20%s,\x20%s',_0x4f770f,_0x56ba74);_0x3c7708(_0x56ba74);});});}function respondWithStatusCode(_0x1c1fd4,_0x440177){_0x440177=_0x440177||0xcc;return function(_0x5872a7){if(_0x5872a7){return _0x1c1fd4[_0x1a51('0x2f')](_0x440177);}return _0x1c1fd4[_0x1a51('0x30')](_0x440177)[_0x1a51('0x31')]();};}function respondWithResult(_0x4397e5,_0x1e4cdd){_0x1e4cdd=_0x1e4cdd||0xc8;return function(_0x293477){if(_0x293477){return _0x4397e5['status'](_0x1e4cdd)[_0x1a51('0x32')](_0x293477);}};}function respondWithFilteredResult(_0x1a5669,_0x16b184){return function(_0x57e122){if(_0x57e122){var _0x33f5bc=_0x57e122['count'],_0x3096ae=_0x16b184[_0x1a51('0x33')],_0x22a868=_0x16b184[_0x1a51('0x33')]+_0x16b184[_0x1a51('0x34')],_0x2692b7;if(_0x22a868>=_0x33f5bc){_0x22a868=_0x33f5bc;_0x2692b7=0xc8;}else{_0x2692b7=0xce;}_0x1a5669[_0x1a51('0x30')](_0x2692b7);return _0x1a5669[_0x1a51('0x35')](_0x1a51('0x36'),_0x3096ae+'-'+_0x22a868+'/'+_0x33f5bc)[_0x1a51('0x32')](_0x57e122);}return null;};}function patchUpdates(_0x2b4797){return function(_0x5e4636){try{jsonpatch['apply'](_0x5e4636,_0x2b4797,!![]);}catch(_0x481d87){return BPromise[_0x1a51('0x37')](_0x481d87);}return _0x5e4636['save']();};}function saveUpdates(_0x55f3ed,_0x480f36){return function(_0x160da9){if(_0x160da9){return _0x160da9['update'](_0x55f3ed)[_0x1a51('0x24')](function(_0xa4d91b){return _0xa4d91b;});}return null;};}function removeEntity(_0x596685,_0x247db9){return function(_0x46fe3f){if(_0x46fe3f){return _0x46fe3f[_0x1a51('0x38')]()[_0x1a51('0x24')](function(){_0x596685['status'](0xcc)[_0x1a51('0x31')]();});}};}function handleEntityNotFound(_0x5323e6,_0x207219){return function(_0x1804e6){if(!_0x1804e6){_0x5323e6['sendStatus'](0x194);}return _0x1804e6;};}function handleError(_0x3da55e,_0x4b7941){_0x4b7941=_0x4b7941||0x1f4;return function(_0x514938){logger[_0x1a51('0x2b')](_0x514938[_0x1a51('0x39')]);if(_0x514938[_0x1a51('0x3a')]){delete _0x514938[_0x1a51('0x3a')];}_0x3da55e[_0x1a51('0x30')](_0x4b7941)[_0x1a51('0x3b')](_0x514938);};}exports['index']=function(_0x2ad3d6,_0x5671a2){var _0x3f0c87={},_0x5b576c={},_0x2139be={'count':0x0,'rows':[]};var _0x2c4a90=db[_0x1a51('0x3c')][_0x1a51('0x3d')];_0x5b576c['model']=_[_0x1a51('0x3e')](_0x2c4a90);_0x5b576c[_0x1a51('0x3f')]=_[_0x1a51('0x3e')](_0x2ad3d6[_0x1a51('0x3f')]);_0x5b576c[_0x1a51('0x40')]=_['intersection'](_0x5b576c['model'],_0x5b576c['query']);_0x3f0c87[_0x1a51('0x41')]=_[_0x1a51('0x42')](_0x5b576c[_0x1a51('0x43')],qs[_0x1a51('0x44')](_0x2ad3d6[_0x1a51('0x3f')][_0x1a51('0x44')]));_0x3f0c87[_0x1a51('0x41')]=_0x3f0c87[_0x1a51('0x41')][_0x1a51('0x45')]?_0x3f0c87[_0x1a51('0x41')]:_0x5b576c[_0x1a51('0x43')];if(!_0x2ad3d6[_0x1a51('0x3f')][_0x1a51('0x46')](_0x1a51('0x47'))){_0x3f0c87[_0x1a51('0x34')]=qs[_0x1a51('0x34')](_0x2ad3d6[_0x1a51('0x3f')][_0x1a51('0x34')]);_0x3f0c87[_0x1a51('0x33')]=qs[_0x1a51('0x33')](_0x2ad3d6[_0x1a51('0x3f')][_0x1a51('0x33')]);}_0x3f0c87[_0x1a51('0x48')]=qs['sort'](_0x2ad3d6['query'][_0x1a51('0x49')]);_0x3f0c87['where']=qs[_0x1a51('0x40')](_[_0x1a51('0x4a')](_0x2ad3d6['query'],_0x5b576c['filters']));if(_0x2ad3d6['query'][_0x1a51('0x4b')]){_0x3f0c87[_0x1a51('0x4c')]=_[_0x1a51('0x4d')](_0x3f0c87[_0x1a51('0x4c')],{'$or':_[_0x1a51('0x4e')](_0x2c4a90,function(_0x2b0020){if(_0x2b0020[_0x1a51('0x4f')][_0x1a51('0x50')]!==_0x1a51('0x51')){var _0x167192={};_0x167192[_0x2b0020['field']]={'$like':'%'+_0x2ad3d6['query'][_0x1a51('0x4b')]+'%'};return _0x167192;}})});}_0x3f0c87=_['merge']({},_0x3f0c87,_0x2ad3d6['options']);var _0x4e263c={'where':_0x3f0c87[_0x1a51('0x4c')]};return db['ChatGroup'][_0x1a51('0x52')](_0x4e263c)['then'](function(_0x2b77da){_0x2139be[_0x1a51('0x52')]=_0x2b77da;if(_0x2ad3d6[_0x1a51('0x3f')][_0x1a51('0x53')]){_0x3f0c87[_0x1a51('0x54')]=[{'all':!![]}];}return db[_0x1a51('0x3c')][_0x1a51('0x55')](_0x3f0c87);})['then'](function(_0x32616a){_0x2139be[_0x1a51('0x56')]=_0x32616a;return _0x2139be;})[_0x1a51('0x24')](respondWithFilteredResult(_0x5671a2,_0x3f0c87))[_0x1a51('0x2e')](handleError(_0x5671a2,null));};exports[_0x1a51('0x57')]=function(_0x436701,_0x2fc74d){var _0x4b99eb={'raw':!![],'where':{'id':_0x436701[_0x1a51('0x58')]['id']}},_0x3ce7be={};_0x3ce7be[_0x1a51('0x43')]=_[_0x1a51('0x3e')](db[_0x1a51('0x3c')][_0x1a51('0x3d')]);_0x3ce7be[_0x1a51('0x3f')]=_['keys'](_0x436701[_0x1a51('0x3f')]);_0x3ce7be[_0x1a51('0x40')]=_[_0x1a51('0x42')](_0x3ce7be[_0x1a51('0x43')],_0x3ce7be['query']);_0x4b99eb[_0x1a51('0x41')]=_[_0x1a51('0x42')](_0x3ce7be[_0x1a51('0x43')],qs[_0x1a51('0x44')](_0x436701['query'][_0x1a51('0x44')]));_0x4b99eb[_0x1a51('0x41')]=_0x4b99eb[_0x1a51('0x41')]['length']?_0x4b99eb[_0x1a51('0x41')]:_0x3ce7be[_0x1a51('0x43')];if(_0x436701['query'][_0x1a51('0x53')]){_0x4b99eb[_0x1a51('0x54')]=[{'all':!![]}];}_0x4b99eb=_[_0x1a51('0x4d')]({},_0x4b99eb,_0x436701['options']);return db[_0x1a51('0x3c')][_0x1a51('0x59')](_0x4b99eb)[_0x1a51('0x24')](handleEntityNotFound(_0x2fc74d,null))[_0x1a51('0x24')](respondWithResult(_0x2fc74d,null))[_0x1a51('0x2e')](handleError(_0x2fc74d,null));};exports['create']=function(_0x13f208,_0x4a8851){return db[_0x1a51('0x3c')]['create'](_0x13f208[_0x1a51('0x5a')],{})[_0x1a51('0x24')](respondWithResult(_0x4a8851,0xc9))['catch'](handleError(_0x4a8851,null));};exports[_0x1a51('0x5b')]=function(_0x39ae67,_0x526cee){if(_0x39ae67['body']['id']){delete _0x39ae67[_0x1a51('0x5a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x39ae67['params']['id']}})['then'](handleEntityNotFound(_0x526cee,null))[_0x1a51('0x24')](saveUpdates(_0x39ae67[_0x1a51('0x5a')],null))[_0x1a51('0x24')](respondWithResult(_0x526cee,null))[_0x1a51('0x2e')](handleError(_0x526cee,null));};exports['destroy']=function(_0x3a05a3,_0x1b0759){return db[_0x1a51('0x3c')][_0x1a51('0x59')]({'where':{'id':_0x3a05a3[_0x1a51('0x58')]['id']}})[_0x1a51('0x24')](handleEntityNotFound(_0x1b0759,null))[_0x1a51('0x24')](removeEntity(_0x1b0759,null))[_0x1a51('0x2e')](handleError(_0x1b0759,null));};exports[_0x1a51('0x5c')]=function(_0x2c1399,_0x5d8822){return db[_0x1a51('0x3c')]['describe']()[_0x1a51('0x24')](respondWithResult(_0x5d8822,null))[_0x1a51('0x2e')](handleError(_0x5d8822,null));};exports[_0x1a51('0x5d')]=function(_0x4404fc,_0x41184a,_0x5bc88e){return db[_0x1a51('0x5e')]['count']({'where':{'ChatGroupId':_0x4404fc[_0x1a51('0x58')]['id'],'ToId':_0x4404fc[_0x1a51('0x5f')]['id'],'read':![]}})[_0x1a51('0x24')](function(_0x5623ba){return{'id':_[_0x1a51('0x60')](_0x4404fc[_0x1a51('0x58')]['id']),'count':_0x5623ba};})[_0x1a51('0x24')](respondWithResult(_0x41184a,null))[_0x1a51('0x2e')](handleError(_0x41184a,null));};exports[_0x1a51('0x61')]=function(_0x5b53e5,_0x1de4f7,_0x8242b9){return db[_0x1a51('0x3c')][_0x1a51('0x59')]({'where':{'id':_0x5b53e5[_0x1a51('0x58')]['id']}})[_0x1a51('0x24')](handleEntityNotFound(_0x1de4f7,null))[_0x1a51('0x24')](function(_0x3ed5e1){if(_0x3ed5e1){return _0x3ed5e1['addMembers'](_0x5b53e5[_0x1a51('0x5a')]['ids'],_[_0x1a51('0x62')](_0x5b53e5[_0x1a51('0x5a')],['ids','id'])||{});}})[_0x1a51('0x24')](respondWithResult(_0x1de4f7,null))['catch'](handleError(_0x1de4f7,null));};exports[_0x1a51('0x63')]=function(_0x32782,_0x4f6861,_0x572c37){var _0x3f7c42={};var _0x47374b={};var _0x313592;var _0x46d597;return db['ChatGroup'][_0x1a51('0x64')]({'where':{'id':_0x32782['params']['id']}})[_0x1a51('0x24')](handleEntityNotFound(_0x4f6861,null))[_0x1a51('0x24')](function(_0x5eda84){if(_0x5eda84){_0x313592=_0x5eda84;_0x47374b[_0x1a51('0x43')]=_[_0x1a51('0x3e')](db['User']['rawAttributes']);_0x47374b[_0x1a51('0x3f')]=_[_0x1a51('0x3e')](_0x32782[_0x1a51('0x3f')]);_0x47374b[_0x1a51('0x40')]=_[_0x1a51('0x42')](_0x47374b['model'],_0x47374b['query']);_0x3f7c42[_0x1a51('0x41')]=_[_0x1a51('0x42')](_0x47374b[_0x1a51('0x43')],qs[_0x1a51('0x44')](_0x32782[_0x1a51('0x3f')][_0x1a51('0x44')]));_0x3f7c42[_0x1a51('0x41')]=_0x3f7c42[_0x1a51('0x41')][_0x1a51('0x45')]?_0x3f7c42['attributes']:_0x47374b[_0x1a51('0x43')];_0x3f7c42[_0x1a51('0x48')]=qs[_0x1a51('0x49')](_0x32782[_0x1a51('0x3f')]['sort']);_0x3f7c42[_0x1a51('0x4c')]=qs['filters'](_[_0x1a51('0x4a')](_0x32782[_0x1a51('0x3f')],_0x47374b['filters']));if(_0x32782[_0x1a51('0x3f')][_0x1a51('0x4b')]){_0x3f7c42[_0x1a51('0x4c')]=_[_0x1a51('0x4d')](_0x3f7c42[_0x1a51('0x4c')],{'$or':_['map'](_0x3f7c42[_0x1a51('0x41')],function(_0x419702){var _0x513bdb={};_0x513bdb[_0x419702]={'$like':'%'+_0x32782['query'][_0x1a51('0x4b')]+'%'};return _0x513bdb;})});}_0x3f7c42=_[_0x1a51('0x4d')]({},_0x3f7c42,_0x32782['options']);return _0x313592[_0x1a51('0x63')](_0x3f7c42);}})[_0x1a51('0x24')](function(_0x447136){if(_0x447136){_0x46d597=_0x447136[_0x1a51('0x45')];if(!_0x32782[_0x1a51('0x3f')][_0x1a51('0x46')](_0x1a51('0x47'))){_0x3f7c42['limit']=qs[_0x1a51('0x34')](_0x32782[_0x1a51('0x3f')][_0x1a51('0x34')]);_0x3f7c42[_0x1a51('0x33')]=qs[_0x1a51('0x33')](_0x32782[_0x1a51('0x3f')][_0x1a51('0x33')]);}return _0x313592['getMembers'](_0x3f7c42);}})['then'](function(_0x28ea6c){if(_0x28ea6c){return _0x28ea6c?{'count':_0x46d597,'rows':_0x28ea6c}:null;}})[_0x1a51('0x24')](respondWithResult(_0x4f6861,null))[_0x1a51('0x2e')](handleError(_0x4f6861,null));};exports[_0x1a51('0x65')]=function(_0x401766,_0x56e367,_0x4dd519){return db[_0x1a51('0x3c')][_0x1a51('0x59')]({'where':{'id':_0x401766[_0x1a51('0x58')]['id']}})[_0x1a51('0x24')](handleEntityNotFound(_0x56e367,null))[_0x1a51('0x24')](function(_0x5599c4){if(_0x5599c4){return _0x5599c4['removeMembers'](_0x401766[_0x1a51('0x3f')][_0x1a51('0x66')]);}})[_0x1a51('0x24')](respondWithStatusCode(_0x56e367,null))[_0x1a51('0x2e')](handleError(_0x56e367,null));};exports['addMessage']=function(_0x9da775,_0x11efb0,_0x2ebe3f){if(_0x9da775[_0x1a51('0x5a')]['id']){delete _0x9da775[_0x1a51('0x5a')]['id'];}return db[_0x1a51('0x3c')]['find']({'where':{'id':_0x9da775[_0x1a51('0x58')]['id']}})[_0x1a51('0x24')](handleEntityNotFound(_0x11efb0,null))[_0x1a51('0x24')](function(_0x755a26){if(_0x755a26){_0x9da775['body']['ChatGroupId']=_0x755a26['id'];return db['ChatInternalMessage']['create'](_0x9da775[_0x1a51('0x5a')]);}})[_0x1a51('0x24')](respondWithResult(_0x11efb0,null))[_0x1a51('0x2e')](handleError(_0x11efb0,null));};exports[_0x1a51('0x67')]=function(_0x32acac,_0x48cfe2,_0x202f1a){var _0x32a6ba={};var _0x30ed5b={};var _0x7d9964;var _0x52a6f1;return db[_0x1a51('0x3c')][_0x1a51('0x64')]({'where':{'id':_0x32acac[_0x1a51('0x58')]['id']}})[_0x1a51('0x24')](handleEntityNotFound(_0x48cfe2,null))[_0x1a51('0x24')](function(_0x47cf6d){if(_0x47cf6d){_0x7d9964=_0x47cf6d;_0x30ed5b['model']=_['keys'](db['ChatInternalMessage'][_0x1a51('0x3d')]);_0x30ed5b[_0x1a51('0x3f')]=_[_0x1a51('0x3e')](_0x32acac[_0x1a51('0x3f')]);_0x30ed5b[_0x1a51('0x40')]=_[_0x1a51('0x42')](_0x30ed5b[_0x1a51('0x43')],_0x30ed5b[_0x1a51('0x3f')]);_0x32a6ba[_0x1a51('0x41')]=_[_0x1a51('0x42')](_0x30ed5b[_0x1a51('0x43')],qs[_0x1a51('0x44')](_0x32acac[_0x1a51('0x3f')][_0x1a51('0x44')]));_0x32a6ba[_0x1a51('0x41')]=_0x32a6ba[_0x1a51('0x41')][_0x1a51('0x45')]?_0x32a6ba[_0x1a51('0x41')]:_0x30ed5b[_0x1a51('0x43')];_0x32a6ba[_0x1a51('0x48')]=qs[_0x1a51('0x49')](_0x32acac[_0x1a51('0x3f')][_0x1a51('0x49')]);_0x32a6ba[_0x1a51('0x4c')]=qs[_0x1a51('0x40')](_[_0x1a51('0x4a')](_0x32acac[_0x1a51('0x3f')],_0x30ed5b[_0x1a51('0x40')]));if(_0x32acac[_0x1a51('0x3f')][_0x1a51('0x4b')]){_0x32a6ba[_0x1a51('0x4c')]=_[_0x1a51('0x4d')](_0x32a6ba[_0x1a51('0x4c')],{'$or':_['map'](_0x32a6ba['attributes'],function(_0x41dcb3){var _0x3c1673={};_0x3c1673[_0x41dcb3]={'$like':'%'+_0x32acac[_0x1a51('0x3f')][_0x1a51('0x4b')]+'%'};return _0x3c1673;})});}if(_0x32acac['query'][_0x1a51('0x68')]){var _0x1214d4=_0x32acac[_0x1a51('0x3f')]['$gte'][_0x1a51('0x69')](',');var _0x3d5098={};_0x3d5098[_0x1214d4[0x0]]={'$gte':moment(_0x1214d4[0x1])[_0x1a51('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x32a6ba[_0x1a51('0x4c')]=_[_0x1a51('0x4d')](_0x32a6ba[_0x1a51('0x4c')],_0x3d5098);}_0x32a6ba=_[_0x1a51('0x4d')]({},_0x32a6ba,_0x32acac['options']);return _0x7d9964[_0x1a51('0x67')](_0x32a6ba);}})[_0x1a51('0x24')](function(_0xac8de9){if(_0xac8de9){_0x52a6f1=_0xac8de9['length'];if(!_0x32acac['query'][_0x1a51('0x46')]('nolimit')){_0x32a6ba['limit']=qs[_0x1a51('0x34')](_0x32acac[_0x1a51('0x3f')][_0x1a51('0x34')]);_0x32a6ba[_0x1a51('0x33')]=qs[_0x1a51('0x33')](_0x32acac[_0x1a51('0x3f')][_0x1a51('0x33')]);}return _0x7d9964['getMessages'](_0x32a6ba);}})[_0x1a51('0x24')](function(_0x5e562c){if(_0x5e562c){return _0x5e562c?{'count':_0x52a6f1,'rows':_0x5e562c}:null;}})[_0x1a51('0x24')](respondWithResult(_0x48cfe2,null))[_0x1a51('0x2e')](handleError(_0x48cfe2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 21a65b1..73a5e9b 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 _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x65a878,_0x29f557){var _0x43f1c8=function(_0x1077fc){while(--_0x1077fc){_0x65a878['push'](_0x65a878['shift']());}};_0x43f1c8(++_0x29f557);}(_0xdb28,0x106));var _0x8db2=function(_0x63e658,_0xb7c559){_0x63e658=_0x63e658-0x0;var _0xef8466=_0xdb28[_0x63e658];return _0xef8466;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xadb5,0xad));var _0x5adb=function(_0x5c5b8b,_0x5cbe96){_0x5c5b8b=_0x5c5b8b-0x0;var _0x5f3047=_0xadb5[_0x5c5b8b];return _0x5f3047;};'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 diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index a9e81c1..bbd1bdd 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 _0xadb8=['ChatGroup','chat_groups','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define'];(function(_0x20e2b4,_0x5eb924){var _0x1a670f=function(_0x3b17fe){while(--_0x3b17fe){_0x20e2b4['push'](_0x20e2b4['shift']());}};_0x1a670f(++_0x5eb924);}(_0xadb8,0x1d0));var _0x8adb=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0xadb8[_0xb7b878];return _0x3c84b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23d3=['../../config/environment','exports','define','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23d3,0xe8));var _0x323d=function(_0x10009f,_0x1b4f78){_0x10009f=_0x10009f-0x0;var _0x2308f0=_0x23d3[_0x10009f];return _0x2308f0;};'use strict';var _=require(_0x323d('0x0'));var util=require(_0x323d('0x1'));var logger=require(_0x323d('0x2'))('api');var moment=require(_0x323d('0x3'));var BPromise=require(_0x323d('0x4'));var rp=require(_0x323d('0x5'));var fs=require('fs');var path=require(_0x323d('0x6'));var rimraf=require(_0x323d('0x7'));var config=require(_0x323d('0x8'));var attributes=require('./chatGroup.attributes');module[_0x323d('0x9')]=function(_0x34f513,_0x160a18){return _0x34f513[_0x323d('0xa')]('ChatGroup',attributes,{'tableName':_0x323d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index a937807..d662f75 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 _0xffcf=['socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xffcf,0x141));var _0xfffc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xffcf[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0xfffc('0x0'));var moment=require(_0xfffc('0x1'));var BPromise=require(_0xfffc('0x2'));var rs=require(_0xfffc('0x3'));var fs=require('fs');var Redis=require(_0xfffc('0x4'));var db=require(_0xfffc('0x5'))['db'];var utils=require(_0xfffc('0x6'));var logger=require(_0xfffc('0x7'))(_0xfffc('0x8'));var config=require('../../config/environment');var jayson=require(_0xfffc('0x9'));var client=jayson[_0xfffc('0xa')][_0xfffc('0xb')]({'port':0x232a});config[_0xfffc('0xc')]=_[_0xfffc('0xd')](config[_0xfffc('0xc')],{'host':_0xfffc('0xe'),'port':0x18eb});var socket=require(_0xfffc('0xf'))(new Redis(config[_0xfffc('0xc')]));require('./chatGroup.socket')[_0xfffc('0x10')](socket);function respondWithRpcPromise(_0x18b0ed,_0x415ebb,_0x1be6ef){return new BPromise(function(_0x33d66e,_0x58eee0){return client['request'](_0x18b0ed,_0x1be6ef)[_0xfffc('0x11')](function(_0x350442){logger[_0xfffc('0x12')](_0xfffc('0x13'),_0x415ebb,_0xfffc('0x14'));logger['debug'](_0xfffc('0x15'),_0x415ebb,_0xfffc('0x14'),JSON[_0xfffc('0x16')](_0x350442));if(_0x350442['error']){if(_0x350442[_0xfffc('0x17')][_0xfffc('0x18')]===0x1f4){logger[_0xfffc('0x17')](_0xfffc('0x13'),_0x415ebb,_0x350442[_0xfffc('0x17')][_0xfffc('0x19')]);return _0x58eee0(_0x350442[_0xfffc('0x17')][_0xfffc('0x19')]);}logger[_0xfffc('0x17')](_0xfffc('0x13'),_0x415ebb,_0x350442[_0xfffc('0x17')]['message']);return _0x33d66e(_0x350442[_0xfffc('0x17')]['message']);}else{logger[_0xfffc('0x12')](_0xfffc('0x13'),_0x415ebb,'request\x20sent');_0x33d66e(_0x350442[_0xfffc('0x1a')]['message']);}})[_0xfffc('0x1b')](function(_0x2417ab){logger['error'](_0xfffc('0x13'),_0x415ebb,_0x2417ab);_0x58eee0(_0x2417ab);});});} \ No newline at end of file +var _0x3bfb=['client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x203b04,_0x42f09f){var _0xa09a75=function(_0x1ad9f8){while(--_0x1ad9f8){_0x203b04['push'](_0x203b04['shift']());}};_0xa09a75(++_0x42f09f);}(_0x3bfb,0xdc));var _0xb3bf=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x3bfb[_0xf0ec6e];return _0x8bbc27;};'use strict';var _=require(_0xb3bf('0x0'));var util=require(_0xb3bf('0x1'));var moment=require(_0xb3bf('0x2'));var BPromise=require(_0xb3bf('0x3'));var rs=require(_0xb3bf('0x4'));var fs=require('fs');var Redis=require(_0xb3bf('0x5'));var db=require(_0xb3bf('0x6'))['db'];var utils=require(_0xb3bf('0x7'));var logger=require(_0xb3bf('0x8'))(_0xb3bf('0x9'));var config=require(_0xb3bf('0xa'));var jayson=require(_0xb3bf('0xb'));var client=jayson[_0xb3bf('0xc')][_0xb3bf('0xd')]({'port':0x232a});config['redis']=_[_0xb3bf('0xe')](config[_0xb3bf('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3bf('0x10'))(new Redis(config[_0xb3bf('0xf')]));require(_0xb3bf('0x11'))[_0xb3bf('0x12')](socket);function respondWithRpcPromise(_0x2e5d54,_0x2004c6,_0x2cc2ab){return new BPromise(function(_0x1828d6,_0x1e28d7){return client['request'](_0x2e5d54,_0x2cc2ab)[_0xb3bf('0x13')](function(_0xcdb55d){logger[_0xb3bf('0x14')](_0xb3bf('0x15'),_0x2004c6,_0xb3bf('0x16'));logger['debug'](_0xb3bf('0x17'),_0x2004c6,_0xb3bf('0x16'),JSON['stringify'](_0xcdb55d));if(_0xcdb55d[_0xb3bf('0x18')]){if(_0xcdb55d['error'][_0xb3bf('0x19')]===0x1f4){logger[_0xb3bf('0x18')](_0xb3bf('0x15'),_0x2004c6,_0xcdb55d['error']['message']);return _0x1e28d7(_0xcdb55d[_0xb3bf('0x18')]['message']);}logger[_0xb3bf('0x18')](_0xb3bf('0x15'),_0x2004c6,_0xcdb55d['error'][_0xb3bf('0x1a')]);return _0x1828d6(_0xcdb55d[_0xb3bf('0x18')][_0xb3bf('0x1a')]);}else{logger['info'](_0xb3bf('0x15'),_0x2004c6,_0xb3bf('0x16'));_0x1828d6(_0xcdb55d[_0xb3bf('0x1b')][_0xb3bf('0x1a')]);}})[_0xb3bf('0x1c')](function(_0x38bfdc){logger['error']('ChatGroup,\x20%s,\x20%s',_0x2004c6,_0x38bfdc);_0x1e28d7(_0x38bfdc);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 65ec59d..8396f90 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 _0xf03a=['update','emit','removeListener','register','length','remove'];(function(_0x26ce99,_0x55b7fc){var _0x36411c=function(_0x46b575){while(--_0x46b575){_0x26ce99['push'](_0x26ce99['shift']());}};_0x36411c(++_0x55b7fc);}(_0xf03a,0x167));var _0xaf03=function(_0x14c734,_0x396c99){_0x14c734=_0x14c734-0x0;var _0x56ecaf=_0xf03a[_0x14c734];return _0x56ecaf;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0xaf03('0x0'),_0xaf03('0x1')];function createListener(_0x1faeb2,_0x1d342e){return function(_0x422197){_0x1d342e[_0xaf03('0x2')](_0x1faeb2,_0x422197);};}function removeListener(_0x162ff8,_0xc2c96d){return function(){ChatGroupEvents[_0xaf03('0x3')](_0x162ff8,_0xc2c96d);};}exports[_0xaf03('0x4')]=function(_0x2b5848){for(var _0x395c3a=0x0,_0x5a0e5b=events[_0xaf03('0x5')];_0x395c3a<_0x5a0e5b;_0x395c3a++){var _0x40ef4d=events[_0x395c3a];var _0x2640c7=createListener('chatGroup:'+_0x40ef4d,_0x2b5848);ChatGroupEvents['on'](_0x40ef4d,_0x2640c7);}}; \ No newline at end of file +var _0x193a=['remove','update','emit','removeListener','register','chatGroup:','./chatGroup.events','save'];(function(_0x7daf33,_0x3bbadf){var _0x45b925=function(_0x309854){while(--_0x309854){_0x7daf33['push'](_0x7daf33['shift']());}};_0x45b925(++_0x3bbadf);}(_0x193a,0x1ae));var _0xa193=function(_0x9d5029,_0x1a612e){_0x9d5029=_0x9d5029-0x0;var _0x529309=_0x193a[_0x9d5029];return _0x529309;};'use strict';var ChatGroupEvents=require(_0xa193('0x0'));var events=[_0xa193('0x1'),_0xa193('0x2'),_0xa193('0x3')];function createListener(_0x1e097a,_0x243734){return function(_0x400f75){_0x243734[_0xa193('0x4')](_0x1e097a,_0x400f75);};}function removeListener(_0x35c5a4,_0x33d417){return function(){ChatGroupEvents[_0xa193('0x5')](_0x35c5a4,_0x33d417);};}exports[_0xa193('0x6')]=function(_0x24e269){for(var _0xa3add0=0x0,_0x1134f9=events['length'];_0xa3add0<_0x1134f9;_0xa3add0++){var _0x663973=events[_0xa3add0];var _0x2ca2c4=createListener(_0xa193('0x7')+_0x663973,_0x24e269);ChatGroupEvents['on'](_0x663973,_0x2ca2c4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 18e1499..0de8acc 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 _0xa17c=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','/:id/messages','getMessages','create','post','/:id/members','addMembers','addMessage','put','update','delete'];(function(_0xdd58cd,_0x102a7d){var _0x4b57ab=function(_0x5ceb5f){while(--_0x5ceb5f){_0xdd58cd['push'](_0xdd58cd['shift']());}};_0x4b57ab(++_0x102a7d);}(_0xa17c,0x1c1));var _0xca17=function(_0x219e10,_0x1202b3){_0x219e10=_0x219e10-0x0;var _0x162e2b=_0xa17c[_0x219e10];return _0x162e2b;};'use strict';var multer=require(_0xca17('0x0'));var util=require(_0xca17('0x1'));var path=require(_0xca17('0x2'));var timeout=require(_0xca17('0x3'));var express=require(_0xca17('0x4'));var router=express[_0xca17('0x5')]();var auth=require(_0xca17('0x6'));var interaction=require(_0xca17('0x7'));var config=require('../../config/environment');var controller=require(_0xca17('0x8'));router[_0xca17('0x9')]('/',auth[_0xca17('0xa')](),controller[_0xca17('0xb')]);router[_0xca17('0x9')](_0xca17('0xc'),auth[_0xca17('0xa')](),controller[_0xca17('0xd')]);router[_0xca17('0x9')](_0xca17('0xe'),auth[_0xca17('0xa')](),controller[_0xca17('0xf')]);router['get']('/:id/unread',auth['isAuthenticated'](),controller[_0xca17('0x10')]);router['get']('/:id/members',auth[_0xca17('0xa')](),controller['getMembers']);router[_0xca17('0x9')](_0xca17('0x11'),auth[_0xca17('0xa')](),controller[_0xca17('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xca17('0x13')]);router[_0xca17('0x14')](_0xca17('0x15'),auth['isAuthenticated'](),controller[_0xca17('0x16')]);router[_0xca17('0x14')](_0xca17('0x11'),auth['isAuthenticated'](),controller[_0xca17('0x17')]);router[_0xca17('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xca17('0x19')]);router[_0xca17('0x1a')](_0xca17('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xca17('0x15'),auth[_0xca17('0xa')](),controller['removeMembers']);module[_0xca17('0x1b')]=router; \ No newline at end of file +var _0x84e3=['getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','update','delete','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x84e3,0xda));var _0x384e=function(_0x336df4,_0x52c1dc){_0x336df4=_0x336df4-0x0;var _0x580d8c=_0x84e3[_0x336df4];return _0x580d8c;};'use strict';var multer=require(_0x384e('0x0'));var util=require('util');var path=require(_0x384e('0x1'));var timeout=require(_0x384e('0x2'));var express=require(_0x384e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x384e('0x4'));var config=require(_0x384e('0x5'));var controller=require(_0x384e('0x6'));router[_0x384e('0x7')]('/',auth[_0x384e('0x8')](),controller['index']);router['get'](_0x384e('0x9'),auth['isAuthenticated'](),controller[_0x384e('0xa')]);router['get'](_0x384e('0xb'),auth[_0x384e('0x8')](),controller[_0x384e('0xc')]);router['get'](_0x384e('0xd'),auth[_0x384e('0x8')](),controller[_0x384e('0xe')]);router[_0x384e('0x7')](_0x384e('0xf'),auth['isAuthenticated'](),controller[_0x384e('0x10')]);router[_0x384e('0x7')](_0x384e('0x11'),auth['isAuthenticated'](),controller[_0x384e('0x12')]);router['post']('/',auth[_0x384e('0x8')](),controller[_0x384e('0x13')]);router[_0x384e('0x14')](_0x384e('0xf'),auth['isAuthenticated'](),controller[_0x384e('0x15')]);router[_0x384e('0x14')](_0x384e('0x11'),auth[_0x384e('0x8')](),controller[_0x384e('0x16')]);router['put']('/:id',auth[_0x384e('0x8')](),controller[_0x384e('0x17')]);router[_0x384e('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x384e('0x19')]);router[_0x384e('0x18')](_0x384e('0xf'),auth['isAuthenticated'](),controller['removeMembers']);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 732427d..c5df3a1 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 _0xde90=['sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','out'];(function(_0x28622d,_0x296199){var _0x5b8527=function(_0x25afc6){while(--_0x25afc6){_0x28622d['push'](_0x28622d['shift']());}};_0x5b8527(++_0x296199);}(_0xde90,0xd2));var _0x0de9=function(_0x2cbec0,_0x262fef){_0x2cbec0=_0x2cbec0-0x0;var _0x3d4101=_0xde90[_0x2cbec0];return _0x3d4101;};'use strict';var Sequelize=require(_0x0de9('0x0'));module['exports']={'closed':{'type':Sequelize[_0x0de9('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0de9('0x2')]},'ratingType':{'type':Sequelize[_0x0de9('0x3')](_0x0de9('0x4'),_0x0de9('0x5')),'defaultValue':_0x0de9('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x0de9('0x6')]},'mailTranscript':{'type':Sequelize[_0x0de9('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0de9('0x7')]},'note':{'type':Sequelize[_0x0de9('0x7')]},'browserName':{'type':Sequelize[_0x0de9('0x7')]},'browserVersion':{'type':Sequelize[_0x0de9('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x0de9('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x0de9('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x0de9('0x6')]},'customerIp':{'type':Sequelize[_0x0de9('0x7')]},'formData':{'type':Sequelize[_0x0de9('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x0de9('0x8')]},'lastMsgAt':{'type':Sequelize[_0x0de9('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x0de9('0x3')]('in',_0x0de9('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0de9('0x7')]},'customerPort':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x395e=['BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','out','exports'];(function(_0x365f6c,_0x36938f){var _0x124bb3=function(_0x204c55){while(--_0x204c55){_0x365f6c['push'](_0x365f6c['shift']());}};_0x124bb3(++_0x36938f);}(_0x395e,0x1af));var _0xe395=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x395e[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0xe395('0x0')]={'closed':{'type':Sequelize[_0xe395('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xe395('0x2')](_0xe395('0x3'),_0xe395('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xe395('0x5')]},'pathTranscript':{'type':Sequelize[_0xe395('0x5')]},'mailTranscript':{'type':Sequelize[_0xe395('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe395('0x7')]},'disposition':{'type':Sequelize[_0xe395('0x6')]},'note':{'type':Sequelize[_0xe395('0x6')]},'browserName':{'type':Sequelize[_0xe395('0x6')]},'browserVersion':{'type':Sequelize[_0xe395('0x6')]},'osName':{'type':Sequelize[_0xe395('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xe395('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xe395('0x6')]},'referer':{'type':Sequelize[_0xe395('0x5')]},'customerIp':{'type':Sequelize[_0xe395('0x6')]},'formData':{'type':Sequelize[_0xe395('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xe395('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe395('0x2')]('in',_0xe395('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe395('0x6')]},'customerPort':{'type':Sequelize[_0xe395('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6a9cfc4..250c90d 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 _0x6b4b=['t.id\x20=\x20it.TagId','t.id\x20IN\x20?','expr','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','rows','show','params','include','create','body','find','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Sequelize','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','filename','type','mimetype','attachmentDownload','findOne','Unauthorized','Attachment','attachId','root','basename','close','server/files/chat/upload/','now','pathTranscript','ChatMessage','Messages','User','ChatWebsite','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','sendMail','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','$gte','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','getMyMessages','includeAgent','findAll','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','server','files','attachments','firstName','Account','Owner','10px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','out','Contact','renderFile','views','downloadInteraction.html','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','sendStatus','status','json','count','offset','set','apply','reject','save','update','destroy','end','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','ChatInteraction','rawAttributes','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','field','chat_messages','me.ChatInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','select','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','me.ChatInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false','advancedFilter','createdAt','value','day','utc','endOf','format','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','TagId','unreadMessages','length','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','c.firstName','\x20LIKE\x20?','c.lastName','c.email','\x20>\x20?','\x20<\x20?','ContactId','filter','isNil','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','null','\x20IS\x20NULL','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','toString','join','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','DESC','group','i.id','QueryTypes','SELECT','clone','COUNT(*)','COUNT(me.id)','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x6b4b,0x88));var _0xb6b4=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x6b4b[_0x47aa64];return _0x549c7a;};'use strict';var pdf=require(_0xb6b4('0x0'));var emlformat=require(_0xb6b4('0x1'));var rimraf=require(_0xb6b4('0x2'));var zipdir=require(_0xb6b4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb6b4('0x4'));var BPromise=require(_0xb6b4('0x5'));var Mustache=require(_0xb6b4('0x6'));var util=require(_0xb6b4('0x7'));var path=require('path');var sox=require(_0xb6b4('0x8'));var csv=require(_0xb6b4('0x9'));var ejs=require(_0xb6b4('0xa'));var fs=require('fs');var _=require(_0xb6b4('0xb'));var squel=require(_0xb6b4('0xc'));var crypto=require(_0xb6b4('0xd'));var jsforce=require(_0xb6b4('0xe'));var deskjs=require(_0xb6b4('0xf'));var toCsv=require(_0xb6b4('0x9'));var querystring=require(_0xb6b4('0x10'));var Papa=require(_0xb6b4('0x11'));var Redis=require(_0xb6b4('0x12'));var authService=require(_0xb6b4('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xb6b4('0x14'));var logger=require(_0xb6b4('0x15'))('api');var utils=require(_0xb6b4('0x16'));var config=require(_0xb6b4('0x17'));var db=require(_0xb6b4('0x18'))['db'];config[_0xb6b4('0x19')]=_[_0xb6b4('0x1a')](config[_0xb6b4('0x19')],{'host':_0xb6b4('0x1b'),'port':0x18eb});var socket=require(_0xb6b4('0x1c'))(new Redis(config[_0xb6b4('0x19')]));require(_0xb6b4('0x1d'))[_0xb6b4('0x1e')](socket);var jayson=require(_0xb6b4('0x1f'));var client=jayson[_0xb6b4('0x20')][_0xb6b4('0x21')]({'port':0x232b});var client9004=jayson[_0xb6b4('0x20')][_0xb6b4('0x21')]({'port':0x232c});function checkPasswordPattern(_0x307c2b,_0x1e21e3,_0x21870d){if(_0x21870d){var _0x5d1cae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d1cae[_0xb6b4('0x22')](_0x1e21e3)){return _0x307c2b;}else{throw new db['Sequelize'][(_0xb6b4('0x23'))](_0xb6b4('0x24'));}}else{return _0x307c2b;}}function respondWithRpcPromise(_0x8765fc,_0x5d456f,_0x3bacc8,_0x5e5e51){return new BPromise(function(_0x4a72f3,_0x3635a2){var _0x3cdf6a=_0x5e5e51||client;return _0x3cdf6a[_0xb6b4('0x25')](_0x8765fc,_0x3bacc8)[_0xb6b4('0x26')](function(_0x4ceb65){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5d456f,_0xb6b4('0x27'));logger[_0xb6b4('0x28')](_0xb6b4('0x29'),_0x5d456f,_0xb6b4('0x27'),JSON[_0xb6b4('0x2a')](_0x4ceb65));if(_0x4ceb65[_0xb6b4('0x2b')]){if(_0x4ceb65[_0xb6b4('0x2b')][_0xb6b4('0x2c')]===0x1f4){logger[_0xb6b4('0x2b')](_0xb6b4('0x2d'),_0x5d456f,_0x4ceb65['error'][_0xb6b4('0x2e')]);return _0x3635a2(_0x4ceb65[_0xb6b4('0x2b')][_0xb6b4('0x2e')]);}logger[_0xb6b4('0x2b')](_0xb6b4('0x2d'),_0x5d456f,_0x4ceb65['error'][_0xb6b4('0x2e')]);return _0x4a72f3(_0x4ceb65[_0xb6b4('0x2b')][_0xb6b4('0x2e')]);}else{logger['info'](_0xb6b4('0x2d'),_0x5d456f,_0xb6b4('0x27'));_0x4a72f3(_0x4ceb65['result']['message']);}})['catch'](function(_0x2110d9){logger[_0xb6b4('0x2b')](_0xb6b4('0x2d'),_0x5d456f,_0x2110d9);_0x3635a2(_0x2110d9);});});}function respondWithStatusCode(_0x3ca0e8,_0x317c2a){_0x317c2a=_0x317c2a||0xcc;return function(_0xb294d3){if(_0xb294d3){return _0x3ca0e8[_0xb6b4('0x2f')](_0x317c2a);}return _0x3ca0e8[_0xb6b4('0x30')](_0x317c2a)['end']();};}function respondWithResult(_0x21b0eb,_0x285747){_0x285747=_0x285747||0xc8;return function(_0xb2fce0){if(_0xb2fce0){return _0x21b0eb[_0xb6b4('0x30')](_0x285747)[_0xb6b4('0x31')](_0xb2fce0);}};}function respondWithFilteredResult(_0x438815,_0x155ff2){return function(_0x52963a){if(_0x52963a){var _0x2063bd=_0x52963a[_0xb6b4('0x32')],_0x5b472a=_0x155ff2[_0xb6b4('0x33')],_0x559d96=_0x155ff2[_0xb6b4('0x33')]+_0x155ff2['limit'],_0x499037;if(_0x559d96>=_0x2063bd){_0x559d96=_0x2063bd;_0x499037=0xc8;}else{_0x499037=0xce;}_0x438815['status'](_0x499037);return _0x438815[_0xb6b4('0x34')]('Content-Range',_0x5b472a+'-'+_0x559d96+'/'+_0x2063bd)[_0xb6b4('0x31')](_0x52963a);}return null;};}function patchUpdates(_0x1cde91){return function(_0x3f6581){try{jsonpatch[_0xb6b4('0x35')](_0x3f6581,_0x1cde91,!![]);}catch(_0x9a8744){return BPromise[_0xb6b4('0x36')](_0x9a8744);}return _0x3f6581[_0xb6b4('0x37')]();};}function saveUpdates(_0x220bd0,_0x209f59){return function(_0x412497){if(_0x412497){return _0x412497[_0xb6b4('0x38')](_0x220bd0)[_0xb6b4('0x26')](function(_0x493f7f){return _0x493f7f;});}return null;};}function removeEntity(_0x5c3fe8,_0x2e302f){return function(_0xafbebd){if(_0xafbebd){return _0xafbebd[_0xb6b4('0x39')]()[_0xb6b4('0x26')](function(){_0x5c3fe8[_0xb6b4('0x30')](0xcc)[_0xb6b4('0x3a')]();});}};}function handleEntityNotFound(_0x2098bc,_0x5aeaa2){return function(_0x558323){if(!_0x558323){_0x2098bc['sendStatus'](0x194);}return _0x558323;};}function handleError(_0x12945b,_0x3f1341){_0x3f1341=_0x3f1341||0x1f4;return function(_0x6b55f){logger[_0xb6b4('0x2b')](_0x6b55f['stack']);if(_0x6b55f['name']){delete _0x6b55f[_0xb6b4('0x3b')];}_0x12945b[_0xb6b4('0x30')](_0x3f1341)[_0xb6b4('0x3c')](_0x6b55f);};}function getInteractionUsers(_0x54fb29,_0x1cc8ce){return new BPromise(function(_0x4f9f13,_0x1ddb96){try{if(_0x1cc8ce[_0x54fb29['id']]){_0x54fb29[_0xb6b4('0x3d')]=_[_0xb6b4('0x3e')](_0x1cc8ce[_0x54fb29['id']],function(_0x24866c){return{'id':_0x24866c['id']};});}}catch(_0x1c9f38){_0x1ddb96(_0x1c9f38);}_0x4f9f13(_0x54fb29);});}function getInteractionTags(_0x3fad35,_0x1cffdc){return new BPromise(function(_0x53c016,_0x39f025){try{if(_0x3fad35[_0xb6b4('0x3f')]){_0x3fad35[_0xb6b4('0x40')]=[];_0x3fad35[_0xb6b4('0x3f')][_0xb6b4('0x41')](',')[_0xb6b4('0x42')](function(_0x459b9f){_0x3fad35[_0xb6b4('0x40')][_0xb6b4('0x43')](_0x1cffdc[_0x459b9f]);});}delete _0x3fad35[_0xb6b4('0x3f')];}catch(_0x247fac){_0x39f025(_0x247fac);}_0x53c016(_0x3fad35);});}function updateChatInteraction(_0x26c315,_0x27980b,_0x326d81){return new BPromise(function(_0x4d2c75,_0x2779a5){return getInteractionUsers(_0x26c315,_0x326d81)[_0xb6b4('0x26')](function(_0x129f80){return getInteractionTags(_0x129f80,_0x27980b);})['then'](function(_0x35180e){_0x4d2c75(_0x35180e);})[_0xb6b4('0x44')](function(_0xd15b3a){_0x2779a5(_0xd15b3a);});});}exports[_0xb6b4('0x45')]=function(_0x5e1ac5,_0x5ebac2){var _0x4563c4={},_0x1adbfb={},_0x15aa82={'count':0x0,'rows':[]};var _0x2539b3=db[_0xb6b4('0x46')][_0xb6b4('0x47')];_0x1adbfb['model']=_[_0xb6b4('0x48')](_0x2539b3);_0x1adbfb[_0xb6b4('0x49')]=_[_0xb6b4('0x48')](_0x5e1ac5[_0xb6b4('0x49')]);_0x1adbfb[_0xb6b4('0x4a')]=_[_0xb6b4('0x4b')](_0x1adbfb['model'],_0x1adbfb[_0xb6b4('0x49')]);_0x4563c4[_0xb6b4('0x4c')]=_[_0xb6b4('0x4b')](_0x1adbfb[_0xb6b4('0x4d')],qs[_0xb6b4('0x4e')](_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x4e')]));_0x4563c4[_0xb6b4('0x4c')]=_0x4563c4[_0xb6b4('0x4c')]['length']?_0x4563c4['attributes']:_0x1adbfb['model'];if(!_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x4f')](_0xb6b4('0x50'))){_0x4563c4[_0xb6b4('0x51')]=qs[_0xb6b4('0x51')](_0x5e1ac5['query'][_0xb6b4('0x51')]);_0x4563c4['offset']=qs[_0xb6b4('0x33')](_0x5e1ac5[_0xb6b4('0x49')]['offset']);}_0x4563c4[_0xb6b4('0x52')]=qs[_0xb6b4('0x53')](_0x5e1ac5[_0xb6b4('0x49')]['sort']);_0x4563c4[_0xb6b4('0x54')]=qs[_0xb6b4('0x4a')](_['pick'](_0x5e1ac5['query'],_0x1adbfb['filters']));var _0xed9f3e=[];var _0x42eba4=squel['select']()[_0xb6b4('0x55')]('id')['field'](_0xb6b4('0x3b'))[_0xb6b4('0x55')]('color')['from']('tools_tags');var _0x4c8d24=squel['select']()[_0xb6b4('0x55')]('COUNT(*)')['from'](_0xb6b4('0x56'),'me')[_0xb6b4('0x54')](_0xb6b4('0x57'))['where'](_0xb6b4('0x58'))[_0xb6b4('0x54')](_0xb6b4('0x59'));var _0x5198f8=squel[_0xb6b4('0x5a')]()['field'](_0xb6b4('0x5b'))[_0xb6b4('0x55')](_0xb6b4('0x5c'))[_0xb6b4('0x5d')](_0xb6b4('0x5e'),'ui')[_0xb6b4('0x5f')](_0xb6b4('0x60'),'u','u.id\x20=\x20ui.UserId');var _0x5cf037=squel['select']()[_0xb6b4('0x5d')](_0xb6b4('0x61'),'i')[_0xb6b4('0x5f')](_0xb6b4('0x62'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb6b4('0x5f')](_0xb6b4('0x60'),'o',_0xb6b4('0x63'))[_0xb6b4('0x5f')](_0xb6b4('0x64'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join']('chat_messages','me',_0xb6b4('0x65'));var _0x2d6adf=squel['expr']();if(_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x66')]){var _0x242299=JSON['parse'](_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x66')]);_[_0xb6b4('0x48')](_0x242299)[_0xb6b4('0x42')](function(_0x3097b0){var _0x32214f=_0x242299[_0x3097b0];if(_0x3097b0===_0xb6b4('0x67')){var _0x155458=moment(_0x32214f[_0xb6b4('0x68')]['dateStart'])['startOf'](_0xb6b4('0x69'))[_0xb6b4('0x6a')]()['format']();var _0x572db6=moment(_0x572db6)[_0xb6b4('0x6a')]()[_0xb6b4('0x6b')](_0xb6b4('0x69'))[_0xb6b4('0x6c')]();_0x2d6adf[_0xb6b4('0x6d')](_0xb6b4('0x6e'),_0x155458,_0x572db6);}else{if(_[_0xb6b4('0x6f')](_0x32214f[_0xb6b4('0x70')])){_0x32214f['condition']['forEach'](function(_0x1cd113){switch(_0x32214f[_0xb6b4('0x70')][_0xb6b4('0x68')]){case'IS':if(_0x3097b0!==_0xb6b4('0x71')&&_0x3097b0!==_0xb6b4('0x72')){if(_[_0xb6b4('0x6f')](_0x32214f['value'])&&_0x32214f['value'][_0xb6b4('0x73')]>0x1){_0x2d6adf[_0xb6b4('0x6d')](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x75'),_0x32214f[_0xb6b4('0x68')]);}else{_0x2d6adf['and'](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x76'),_0x32214f['value'][0x0]);}}break;case'=':_0x2d6adf[_0xb6b4('0x6d')](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x76'),_0x32214f[_0xb6b4('0x68')]);break;case _0xb6b4('0x77'):if(_0x3097b0==='ContactId'){_0x2d6adf[_0xb6b4('0x6d')](_0xb6b4('0x78')+_0xb6b4('0x79'),'%'+_0x32214f['value']+'%');_0x2d6adf['or'](_0xb6b4('0x7a')+_0xb6b4('0x79'),'%'+_0x32214f[_0xb6b4('0x68')]+'%');_0x2d6adf['or'](_0xb6b4('0x7b')+_0xb6b4('0x79'),'%'+_0x32214f[_0xb6b4('0x68')]+'%');}else{_0x2d6adf['and'](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x79'),'%'+_0x32214f[_0xb6b4('0x68')]+'%');}break;case'>':_0x2d6adf['and'](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x7c'),_0x32214f['value']);break;case'<':_0x2d6adf[_0xb6b4('0x6d')](_0x32214f['tableAlias']+'.'+_0x3097b0+_0xb6b4('0x7d'),_0x32214f[_0xb6b4('0x68')]);break;}});}else{switch(_0x32214f[_0xb6b4('0x70')][_0xb6b4('0x68')]){case'IS':if(_0x3097b0!=='TagId'&&_0x3097b0!==_0xb6b4('0x72')){if(_[_0xb6b4('0x6f')](_0x32214f[_0xb6b4('0x68')])&&_0x32214f[_0xb6b4('0x68')]['length']>0x1){_0x2d6adf[_0xb6b4('0x6d')](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x75'),_0x32214f[_0xb6b4('0x68')]);}else{_0x2d6adf['and'](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x76'),_0x32214f[_0xb6b4('0x68')][0x0]);}}break;case'=':_0x2d6adf[_0xb6b4('0x6d')](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x76'),_0x32214f[_0xb6b4('0x68')]);break;case'LIKE':if(_0x3097b0===_0xb6b4('0x7e')){_0x2d6adf['and'](_0xb6b4('0x78')+_0xb6b4('0x79'),'%'+_0x32214f[_0xb6b4('0x68')]+'%');_0x2d6adf['or'](_0xb6b4('0x7a')+_0xb6b4('0x79'),'%'+_0x32214f[_0xb6b4('0x68')]+'%');_0x2d6adf['or']('c.email'+_0xb6b4('0x79'),'%'+_0x32214f[_0xb6b4('0x68')]+'%');}else{_0x2d6adf[_0xb6b4('0x6d')](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x79'),'%'+_0x32214f[_0xb6b4('0x68')]+'%');}break;case'>':_0x2d6adf[_0xb6b4('0x6d')](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x7c'),_0x32214f[_0xb6b4('0x68')]);break;case'<':_0x2d6adf[_0xb6b4('0x6d')](_0x32214f[_0xb6b4('0x74')]+'.'+_0x3097b0+_0xb6b4('0x7d'),_0x32214f['value']);break;}}}});}else{var _0x487ff8=_(Object[_0xb6b4('0x48')](_0x5e1ac5[_0xb6b4('0x49')]))[_0xb6b4('0x3e')](function(_0x4f8b53){return _0x2539b3[_0xb6b4('0x4f')](_0x4f8b53)?_0x4f8b53:undefined;})[_0xb6b4('0x7f')](function(_0xbd79e0){return!_[_0xb6b4('0x80')](_0xbd79e0);})[_0xb6b4('0x68')]();if(!_[_0xb6b4('0x81')](_0x487ff8)){_0x487ff8[_0xb6b4('0x42')](function(_0x220a92){if(_0x220a92===_0xb6b4('0x82')){_0x5cf037['where'](_0xb6b4('0x83'),[]['concat'](_0x5e1ac5['query'][_0x220a92]));}else if(_0x220a92==='createdAt'){var _0xa177ae=JSON[_0xb6b4('0x84')](_0x5e1ac5[_0xb6b4('0x49')][_0x220a92])['$gte'];var _0x25029c=JSON['parse'](_0x5e1ac5['query'][_0x220a92])[_0xb6b4('0x85')];_0x5cf037[_0xb6b4('0x54')](_0xb6b4('0x6e'),_0xa177ae,_0x25029c);}else{if(_0x5e1ac5[_0xb6b4('0x49')][_0x220a92]===_0xb6b4('0x86')){_0x5cf037[_0xb6b4('0x54')]('i.'+_0x220a92+_0xb6b4('0x87'));}else{_0x5cf037[_0xb6b4('0x54')]('i.'+_0x220a92+_0xb6b4('0x76'),_0x5e1ac5[_0xb6b4('0x49')][_0x220a92]);}}});}if(_0x5e1ac5[_0xb6b4('0x49')]['filter']){var _0x518706=_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x7f')][_0xb6b4('0x88')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xb6b4('0x89'));if(qs[_0xb6b4('0x8a')](_0x518706)){_0x2d6adf['or'](_0xb6b4('0x8b'),_0x518706+'%');}else{var _0x38fd7b=[];_0x518706[_0xb6b4('0x41')]('\x20')[_0xb6b4('0x42')](function(_0x345654){_0x38fd7b[_0xb6b4('0x43')]('+'+_0x345654[_0xb6b4('0x8c')]());});var _0x3f25d0=_0x38fd7b[_0xb6b4('0x8d')]('\x20');_0x2d6adf['or'](_0xb6b4('0x8e'),_0x3f25d0)['or'](_0xb6b4('0x8f'),_0x518706+'%');}}}_0x5cf037[_0xb6b4('0x54')](_0x2d6adf);if(_0x4563c4[_0xb6b4('0x52')]){_0x4563c4['order'][_0xb6b4('0x42')](function(_0x1269cd){_0x5cf037[_0xb6b4('0x52')]('i.'+_0x1269cd[0x0],_0x1269cd[0x1]===_0xb6b4('0x90')?![]:!![]);});}_0x5cf037[_0xb6b4('0x91')](_0xb6b4('0x92'));var _0x58eb73={'type':db['Sequelize'][_0xb6b4('0x93')][_0xb6b4('0x94')],'raw':!![]};var _0x22056e=_0x5cf037[_0xb6b4('0x95')]()[_0xb6b4('0x55')](_0xb6b4('0x96'))[_0xb6b4('0x55')](_0xb6b4('0x97'),_0xb6b4('0x72'));if(!_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x66')]){if(_0x5e1ac5['query'][_0xb6b4('0x98')]){if(_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x98')]==0x1){_0x22056e[_0xb6b4('0x99')](_0xb6b4('0x9a'));_0x5cf037[_0xb6b4('0x99')](_0xb6b4('0x9a'));}else{_0x22056e[_0xb6b4('0x99')](_0xb6b4('0x9b'));_0x5cf037['having'](_0xb6b4('0x9b'));}}if(_0x5e1ac5['query'][_0xb6b4('0x9c')]){var _0x244fae=_[_0xb6b4('0x6f')](_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x9c')])?_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x9c')]:new Array(_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x9c')]);var _0x4ab30b=squel['expr']();_0x244fae['forEach'](function(_0x12e23c){_0x4ab30b['or'](_0xb6b4('0x9d'),'%,'+_0x12e23c+',%');});_0x5cf037[_0xb6b4('0x99')](_0x4ab30b);_0x22056e['left_join'](_0xb6b4('0x9e'),'it',_0xb6b4('0x9f'));_0x22056e[_0xb6b4('0x5f')]('tools_tags','t',_0xb6b4('0xa0'));_0x22056e[_0xb6b4('0x54')](_0xb6b4('0xa1'),_0x244fae);}}else{var _0x242299=JSON['parse'](_0x5e1ac5[_0xb6b4('0x49')][_0xb6b4('0x66')]);_[_0xb6b4('0x48')](_0x242299)[_0xb6b4('0x42')](function(_0x57be04){var _0x4c364f=_0x242299[_0x57be04];if(_0x57be04===_0xb6b4('0x71')){var _0x1eefe3=_0x4c364f[_0xb6b4('0x68')];var _0x548d9c=squel[_0xb6b4('0xa2')]();_0x1eefe3[_0xb6b4('0x42')](function(_0x2a5126){_0x548d9c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a5126+',%');});_0x5cf037['having'](_0x548d9c);_0x22056e[_0xb6b4('0x5f')](_0xb6b4('0xa3'),'it',_0xb6b4('0xa4'));_0x22056e[_0xb6b4('0x5f')](_0xb6b4('0xa5'),'t','t.id\x20=\x20it.TagId');_0x22056e[_0xb6b4('0x54')](_0xb6b4('0xa1'),_0x1eefe3);}else if(_0x57be04===_0xb6b4('0x72')){if(_0x4c364f[_0xb6b4('0x68')][_0xb6b4('0x73')]===0x1){if(_0x4c364f[_0xb6b4('0x68')][0x0]===0x1){_0x22056e[_0xb6b4('0x99')](_0xb6b4('0x9a'));_0x5cf037['having']('`unreadMessages`\x20=\x200');}else{_0x22056e[_0xb6b4('0x99')](_0xb6b4('0x9b'));_0x5cf037[_0xb6b4('0x99')](_0xb6b4('0x9b'));}}}});}db[_0xb6b4('0xa6')]['query'](_0x22056e[_0xb6b4('0x8c')](),_0x58eb73)[_0xb6b4('0x26')](function(_0x3a3d3c){_0x15aa82[_0xb6b4('0x32')]=_0x3a3d3c['length'];if(_0x15aa82['count']===0x0)return[];return db[_0xb6b4('0xa6')]['query'](_0x42eba4[_0xb6b4('0x8c')](),_0x58eb73)[_0xb6b4('0x26')](function(_0x27e926){_0xed9f3e=_[_0xb6b4('0xa7')](_0x27e926,'id');_0x58eb73=_[_0xb6b4('0xa8')](_0x58eb73,{'model':db[_0xb6b4('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x5cf037[_0xb6b4('0x55')](_0xb6b4('0x97'),_0xb6b4('0x72'));_0x5cf037[_0xb6b4('0x55')](_0xb6b4('0xa9'),_0xb6b4('0xaa'));_0x5cf037[_0xb6b4('0x55')](_0xb6b4('0xab'),_0xb6b4('0xac'));_0x5cf037['field'](_0xb6b4('0xad'));_0x5cf037[_0xb6b4('0x55')]('c.firstName',_0xb6b4('0xae'));_0x5cf037[_0xb6b4('0x55')](_0xb6b4('0x7a'),_0xb6b4('0xaf'));_0x5cf037['field'](_0xb6b4('0x7b'),_0xb6b4('0xb0'));_0x5cf037[_0xb6b4('0x55')](_0xb6b4('0xb1'),_0xb6b4('0xb2'));_0x5cf037[_0xb6b4('0x55')](_0xb6b4('0xb3'),'Contact.mobile');_0x5cf037[_0xb6b4('0x55')](_0xb6b4('0xb4'),_0xb6b4('0xb5'));_0x5cf037[_0xb6b4('0x55')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');_0x5cf037[_0xb6b4('0x5f')]('chat_interaction_has_tags','it',_0xb6b4('0x9f'));_0x5cf037[_0xb6b4('0x5f')](_0xb6b4('0xa5'),'t',_0xb6b4('0xa0'));_0x5cf037['limit'](_0x4563c4['limit']);_0x5cf037[_0xb6b4('0x33')](_0x4563c4[_0xb6b4('0x33')]);return db['sequelize'][_0xb6b4('0x49')](_0x5cf037[_0xb6b4('0x8c')](),_0x58eb73);})[_0xb6b4('0x26')](function(_0x5545d8){_0x5198f8[_0xb6b4('0x54')](_0xb6b4('0xb6'),_[_0xb6b4('0x3e')](_0x5545d8,'id'));return db[_0xb6b4('0xa6')][_0xb6b4('0x49')](_0x5198f8[_0xb6b4('0x8c')](),_0x58eb73)[_0xb6b4('0x26')](function(_0x4aa739){var _0x399825=_['groupBy'](_0x4aa739,_0xb6b4('0xb7'));var _0x5b70d9=[];_0x5545d8[_0xb6b4('0x42')](function(_0x3e7126){_0x5b70d9[_0xb6b4('0x43')](updateChatInteraction(_0x3e7126,_0xed9f3e,_0x399825));});return BPromise['all'](_0x5b70d9);});});})[_0xb6b4('0x26')](function(_0x25018d){_0x15aa82[_0xb6b4('0xb8')]=_0x25018d;return _0x15aa82;})[_0xb6b4('0x26')](respondWithFilteredResult(_0x5ebac2,_0x4563c4))[_0xb6b4('0x44')](handleError(_0x5ebac2,null));};exports[_0xb6b4('0xb9')]=function(_0x92f423,_0x1cefa4){var _0xc1c833={'raw':![],'where':{'id':_0x92f423[_0xb6b4('0xba')]['id']}},_0x52c28e={};_0x52c28e[_0xb6b4('0x4d')]=_[_0xb6b4('0x48')](db[_0xb6b4('0x46')][_0xb6b4('0x47')]);_0x52c28e['query']=_[_0xb6b4('0x48')](_0x92f423[_0xb6b4('0x49')]);_0x52c28e['filters']=_[_0xb6b4('0x4b')](_0x52c28e[_0xb6b4('0x4d')],_0x52c28e[_0xb6b4('0x49')]);_0xc1c833['attributes']=_[_0xb6b4('0x4b')](_0x52c28e[_0xb6b4('0x4d')],qs[_0xb6b4('0x4e')](_0x92f423[_0xb6b4('0x49')][_0xb6b4('0x4e')]));_0xc1c833['attributes']=_0xc1c833['attributes'][_0xb6b4('0x73')]?_0xc1c833[_0xb6b4('0x4c')]:_0x52c28e[_0xb6b4('0x4d')];if(_0x92f423[_0xb6b4('0x49')]['includeAll']){_0xc1c833[_0xb6b4('0xbb')]=[{'all':!![]}];}_0xc1c833=_[_0xb6b4('0xa8')]({},_0xc1c833,_0x92f423['options']);return db[_0xb6b4('0x46')]['find'](_0xc1c833)['then'](handleEntityNotFound(_0x1cefa4,null))[_0xb6b4('0x26')](respondWithResult(_0x1cefa4,null))['catch'](handleError(_0x1cefa4,null));};exports[_0xb6b4('0xbc')]=function(_0x3814f1,_0x598a5a){return db[_0xb6b4('0x46')][_0xb6b4('0xbc')](_0x3814f1['body'],{})[_0xb6b4('0x26')](respondWithResult(_0x598a5a,0xc9))['catch'](handleError(_0x598a5a,null));};exports['update']=function(_0x2aae9,_0x46da3c){if(_0x2aae9[_0xb6b4('0xbd')]['id']){delete _0x2aae9[_0xb6b4('0xbd')]['id'];}return db[_0xb6b4('0x46')][_0xb6b4('0xbe')]({'where':{'id':_0x2aae9[_0xb6b4('0xba')]['id']}})[_0xb6b4('0x26')](handleEntityNotFound(_0x46da3c,null))[_0xb6b4('0x26')](saveUpdates(_0x2aae9[_0xb6b4('0xbd')],null))[_0xb6b4('0x26')](respondWithResult(_0x46da3c,null))[_0xb6b4('0x44')](handleError(_0x46da3c,null));};exports['destroy']=function(_0x12c7dc,_0x1453f9){return db[_0xb6b4('0x46')][_0xb6b4('0xbe')]({'where':{'id':_0x12c7dc[_0xb6b4('0xba')]['id']}})[_0xb6b4('0x26')](handleEntityNotFound(_0x1453f9,null))[_0xb6b4('0x26')](removeEntity(_0x1453f9,null))['catch'](handleError(_0x1453f9,null));};exports['describe']=function(_0x3708d3,_0x5a6a95){return db[_0xb6b4('0x46')]['describe']()['then'](respondWithResult(_0x5a6a95,null))['catch'](handleError(_0x5a6a95,null));};exports[_0xb6b4('0xbf')]=function(_0x84723,_0x31e5ea){if(_0x84723[_0xb6b4('0xbd')]['id']){delete _0x84723[_0xb6b4('0xbd')]['id'];}return db[_0xb6b4('0x46')][_0xb6b4('0xbe')]({'where':{'id':_0x84723[_0xb6b4('0xba')]['id']}})[_0xb6b4('0x26')](handleEntityNotFound(_0x31e5ea,null))[_0xb6b4('0x26')](saveUpdates(_0x84723['body'],null))[_0xb6b4('0x26')](respondWithResult(_0x31e5ea,null))[_0xb6b4('0x44')](handleError(_0x31e5ea,null));};exports[_0xb6b4('0xc0')]=function(_0x4e4546,_0x27d121,_0x3a2831){if(_0x4e4546[_0xb6b4('0xbd')]['id']){delete _0x4e4546['body']['id'];}return db[_0xb6b4('0x46')][_0xb6b4('0xbe')]({'where':{'id':_0x4e4546[_0xb6b4('0xba')]['id']}})['then'](function(_0x27e3cc){if(!_0x27e3cc){logger[_0xb6b4('0x2b')](_0xb6b4('0xc1'),_0xb6b4('0xc0'),0x194,_0xb6b4('0xc2'));_0x27d121[_0xb6b4('0x2f')](0x194);}else{if(_0x27e3cc[_0xb6b4('0xc3')]){throw new db[(_0xb6b4('0xc4'))]['ValidationError'](_0xb6b4('0xc5'));}}return _0x27e3cc;})[_0xb6b4('0x26')](function(_0x3e4fbd){if(_0x3e4fbd){return _0x3e4fbd['update']({'closed':_0x4e4546['body'][_0xb6b4('0xc6')],'disposition':_0x4e4546['body'][_0xb6b4('0xc7')]})['then'](function(_0x3b58b8){return _0x3b58b8;});}})['then'](function(_0x5e2a61){return respondWithRpcPromise(_0xb6b4('0xc8'),_0xb6b4('0xc0'),_0x4e4546[_0xb6b4('0xbd')],client9004);})[_0xb6b4('0x26')](respondWithResult(_0x27d121,null))[_0xb6b4('0x44')](handleError(_0x27d121,null));};exports['attachmentUpload']=function(_0x2ce83e,_0x5ce070,_0x28a66d){_0x2ce83e[_0xb6b4('0xbd')][_0xb6b4('0x3b')]=_0x2ce83e[_0xb6b4('0xc9')][_0xb6b4('0xca')];_0x2ce83e['body']['basename']=_0x2ce83e['file'][_0xb6b4('0xcb')];_0x2ce83e['body'][_0xb6b4('0xcc')]=_0x2ce83e[_0xb6b4('0xc9')][_0xb6b4('0xcd')];return db['Attachment'][_0xb6b4('0xbc')](_0x2ce83e[_0xb6b4('0xbd')])[_0xb6b4('0x26')](respondWithResult(_0x5ce070,0xc9))[_0xb6b4('0x44')](handleError(_0x5ce070,null));};exports[_0xb6b4('0xce')]=function(_0x347bd5,_0x4edcba,_0x45ce01){return db[_0xb6b4('0x46')][_0xb6b4('0xcf')]({'where':{'id':_0x347bd5[_0xb6b4('0xba')]['id']},'raw':!![]})[_0xb6b4('0x26')](handleEntityNotFound(_0x4edcba,null))[_0xb6b4('0x26')](function(_0xfd0cd3){if(_0xfd0cd3){if(_0xfd0cd3[_0xb6b4('0xc6')]){return _0x4edcba[_0xb6b4('0x30')](0x193)[_0xb6b4('0x31')]({'status':0x193,'message':_0xb6b4('0xd0')});}return db[_0xb6b4('0xd1')][_0xb6b4('0xcf')]({'where':{'id':_0x347bd5[_0xb6b4('0x49')][_0xb6b4('0xd2')]},'raw':!![]})['then'](handleEntityNotFound(_0x4edcba,null));}})['then'](function(_0x115694){if(_0x115694){return _0x4edcba['download'](path['join'](config[_0xb6b4('0xd3')],'server/files/attachments/',_0x115694[_0xb6b4('0xd4')]));}})[_0xb6b4('0x44')](handleError(_0x4edcba,null));};exports[_0xb6b4('0xd5')]=function(_0x3bad22,_0x2e2de2){var _0x59c90e=null;var _0x369ad9=null;var _0x53a152=null;var _0x3df59d=null;if(_0x3bad22[_0xb6b4('0xbd')]['id']){delete _0x3bad22[_0xb6b4('0xbd')]['id'];}if(_0x3bad22['body']['mailTranscript']){_0x3df59d=path['join'](config['root'],_0xb6b4('0xd6'),util[_0xb6b4('0x6c')]('transcript-%s.txt',Date[_0xb6b4('0xd7')]()));_0x3bad22['body'][_0xb6b4('0xd8')]=_0x3df59d;}return db['ChatInteraction'][_0xb6b4('0xbe')]({'where':{'id':_0x3bad22[_0xb6b4('0xba')]['id']},'include':[{'model':db[_0xb6b4('0xd9')],'as':_0xb6b4('0xda'),'include':[{'model':db[_0xb6b4('0xdb')],'as':_0xb6b4('0xdb')}]}]})[_0xb6b4('0x26')](handleEntityNotFound(_0x2e2de2,null))['then'](saveUpdates(_0x3bad22[_0xb6b4('0xbd')],null))[_0xb6b4('0x26')](function(_0x395ef8){if(_0x395ef8){_0x59c90e=_0x395ef8;return db[_0xb6b4('0xdc')][_0xb6b4('0xbe')]({'where':{'id':_0x59c90e[_0xb6b4('0x82')]}});}})[_0xb6b4('0x26')](function(_0x4cd93b){if(_0x4cd93b){_0x53a152=_0x4cd93b;return db[_0xb6b4('0xdd')][_0xb6b4('0xbe')]({'where':{'id':_0x59c90e[_0xb6b4('0x7e')]}});}})[_0xb6b4('0x26')](function(_0x25f241){if(_0x25f241){_0x369ad9=_0x25f241;if(_0x3df59d){var _0x2836c4=null;for(var _0x15efab=0x1;_0x15efab<_0x59c90e[_0xb6b4('0xda')][_0xb6b4('0x73')];++_0x15efab){_0x2836c4=_0x59c90e[_0xb6b4('0xda')][_0x15efab];var _0x83798a=_0x2836c4[_0xb6b4('0xc3')]?util[_0xb6b4('0x6c')](_0xb6b4('0xde'),_0x53a152[_0xb6b4('0xdf')],_0x2836c4['UserId']):_0xb6b4('0xe0');var _0x31bc7f=_0x3bad22[_0xb6b4('0xbd')][_0xb6b4('0xe1')]||util['format']('%s%d',_0xb6b4('0xe2'),_0x2836c4['ContactId']);switch(_0x53a152[_0xb6b4('0xe3')]){case _0xb6b4('0xe4'):_0x83798a=_0x2836c4[_0xb6b4('0xc3')]?util[_0xb6b4('0x6c')](_0xb6b4('0xde'),_0x53a152[_0xb6b4('0xdf')],_0x2836c4['UserId']):'System';break;case _0xb6b4('0xe5'):_0x83798a=_0x2836c4[_0xb6b4('0xc3')]?_0x2836c4[_0xb6b4('0xdb')]['alias']||_0x2836c4[_0xb6b4('0xdb')][_0xb6b4('0xe6')]:_0xb6b4('0xe0');break;case'agent_fullname':_0x83798a=_0x2836c4[_0xb6b4('0xc3')]?_0x2836c4[_0xb6b4('0xdb')][_0xb6b4('0xe6')]:_0xb6b4('0xe0');break;default:_0x83798a=_0x2836c4[_0xb6b4('0xc3')]?util[_0xb6b4('0x6c')]('%s%d',_0x53a152[_0xb6b4('0xdf')],_0x2836c4['UserId']):_0xb6b4('0xe0');}var _0x38834a=util[_0xb6b4('0x6c')](_0xb6b4('0xe7'),moment(_0x2836c4[_0xb6b4('0x67')])[_0xb6b4('0x6c')](_0xb6b4('0xe8')),_0x2836c4[_0xb6b4('0xe9')]==='in'?_0x31bc7f:_0x83798a,_0x2836c4[_0xb6b4('0xbd')]);if(!_0x2836c4[_0xb6b4('0xea')]){fs['appendFileSync'](_0x3df59d,_0x38834a);}}return db[_0xb6b4('0xeb')][_0xb6b4('0xcf')]({'where':{'service':!![]},'include':[{'model':db[_0xb6b4('0xec')],'as':_0xb6b4('0xed'),'raw':!![]}]});}}})['then'](function(_0x4c2bec){if(_0x4c2bec&&_0x4c2bec['Smtp']&&_0x3bad22[_0xb6b4('0xbd')]){var _0x5da414={'tls':{'rejectUnauthorized':![]}};if(_0x4c2bec[_0xb6b4('0xed')][_0xb6b4('0xee')]){_0x5da414[_0xb6b4('0xee')]=_0x4c2bec[_0xb6b4('0xed')]['service'];}else{_0x5da414['host']=_0x4c2bec[_0xb6b4('0xed')][_0xb6b4('0xef')];_0x5da414[_0xb6b4('0xf0')]=_0x4c2bec['Smtp'][_0xb6b4('0xf0')];_0x5da414[_0xb6b4('0xf1')]=_0x4c2bec[_0xb6b4('0xed')]['secure'];}if(_0x4c2bec[_0xb6b4('0xed')]['authentication']){_0x5da414['auth']={'user':_0x4c2bec['Smtp']['user'],'pass':_0x4c2bec[_0xb6b4('0xed')][_0xb6b4('0xf2')]};}return respondWithRpcPromise(_0xb6b4('0xf3'),_0xb6b4('0xf4'),{'account':_0x5da414,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4c2bec['name'],_0x4c2bec[_0xb6b4('0xf5')]||_0x4c2bec[_0xb6b4('0xed')]['user']),'to':_0x3bad22[_0xb6b4('0xbd')]['mailTranscript'],'subject':_0xb6b4('0xf6'),'text':util[_0xb6b4('0x6c')](_0xb6b4('0xf7'),_0x3bad22[_0xb6b4('0xbd')]['mailTranscript']),'attachments':[{'path':_0x3df59d}]}})[_0xb6b4('0x26')](function(){return _0x59c90e;})[_0xb6b4('0x44')](function(_0x3ca988){console[_0xb6b4('0x2b')](_0x3ca988);});}else{return _0x59c90e;}})[_0xb6b4('0x26')](respondWithStatusCode(_0x2e2de2,0xc8))[_0xb6b4('0x44')](handleError(_0x2e2de2,null));};exports[_0xb6b4('0xf8')]=function(_0x474426,_0x51ecdd,_0x5b41b9){return db[_0xb6b4('0xd9')]['find']({'where':{'id':_0x474426[_0xb6b4('0xba')]['id']}})[_0xb6b4('0x26')](handleEntityNotFound(_0x51ecdd,null))['then'](function(_0x5cadf7){if(_0x5cadf7){return _0x5cadf7[_0xb6b4('0xf8')](_0x474426['body'][_0xb6b4('0xf9')],_[_0xb6b4('0xfa')](_0x474426[_0xb6b4('0xbd')],[_0xb6b4('0xf9'),'id'])||{});}})['then'](respondWithResult(_0x51ecdd,null))[_0xb6b4('0x44')](handleError(_0x51ecdd,null));};exports['getMessages']=function(_0x47eee8,_0x232c84,_0x1c4b18){var _0x4f36e9={'raw':![],'where':{}};var _0x49a46c={};var _0x1852ec={'count':0x0,'rows':[]};return db[_0xb6b4('0x46')][_0xb6b4('0xcf')]({'where':{'id':_0x47eee8[_0xb6b4('0xba')]['id']}})['then'](handleEntityNotFound(_0x232c84,null))[_0xb6b4('0x26')](function(_0x1de2ef){if(_0x1de2ef){_0x49a46c[_0xb6b4('0x4d')]=_[_0xb6b4('0x48')](db[_0xb6b4('0xd9')][_0xb6b4('0x47')]);_0x49a46c[_0xb6b4('0x49')]=_[_0xb6b4('0x48')](_0x47eee8[_0xb6b4('0x49')]);_0x49a46c['filters']=_[_0xb6b4('0x4b')](_0x49a46c[_0xb6b4('0x4d')],_0x49a46c[_0xb6b4('0x49')]);_0x4f36e9['attributes']=_[_0xb6b4('0x4b')](_0x49a46c[_0xb6b4('0x4d')],qs['fields'](_0x47eee8[_0xb6b4('0x49')][_0xb6b4('0x4e')]));_0x4f36e9[_0xb6b4('0x4c')]=_0x4f36e9['attributes']['length']?_0x4f36e9[_0xb6b4('0x4c')]:_0x49a46c['model'];if(!_0x47eee8['query']['hasOwnProperty']('nolimit')){_0x4f36e9['limit']=qs[_0xb6b4('0x51')](_0x47eee8[_0xb6b4('0x49')]['limit']);_0x4f36e9[_0xb6b4('0x33')]=qs[_0xb6b4('0x33')](_0x47eee8[_0xb6b4('0x49')][_0xb6b4('0x33')]);}_0x4f36e9[_0xb6b4('0x52')]=qs[_0xb6b4('0x53')](_0x47eee8['query'][_0xb6b4('0x53')]);_0x4f36e9[_0xb6b4('0x54')]=qs[_0xb6b4('0x4a')](_['pick'](_0x47eee8[_0xb6b4('0x49')],_0x49a46c[_0xb6b4('0x4a')]));_0x4f36e9[_0xb6b4('0x54')]['ChatInteractionId']=_0x1de2ef['id'];if(_0x47eee8[_0xb6b4('0x49')][_0xb6b4('0x7f')]){_0x4f36e9[_0xb6b4('0x54')]=_['merge'](_0x4f36e9[_0xb6b4('0x54')],{'$or':_[_0xb6b4('0x3e')](_0x4f36e9[_0xb6b4('0x4c')],function(_0x3e860c){var _0x481709={};_0x481709[_0x3e860c]={'$like':'%'+_0x47eee8[_0xb6b4('0x49')][_0xb6b4('0x7f')]+'%'};return _0x481709;})});}if(_0x47eee8[_0xb6b4('0x49')]['$gte']){var _0x308df4=_0x47eee8[_0xb6b4('0x49')][_0xb6b4('0xfb')][_0xb6b4('0x41')](',');var _0x25878c={};_0x25878c[_0x308df4[0x0]]={'$gte':moment(_0x308df4[0x1])[_0xb6b4('0x6c')](_0xb6b4('0xfc'))};_0x4f36e9[_0xb6b4('0x54')]=_[_0xb6b4('0xa8')](_0x4f36e9[_0xb6b4('0x54')],_0x25878c);}_0x4f36e9=_[_0xb6b4('0xa8')]({},_0x4f36e9,_0x47eee8[_0xb6b4('0xfd')]);return db[_0xb6b4('0xd9')][_0xb6b4('0x32')]({'where':_0x4f36e9['where']})[_0xb6b4('0x26')](function(_0x3049bf){_0x1852ec['count']=_0x3049bf;if(_0x47eee8[_0xb6b4('0x49')][_0xb6b4('0xfe')]){_0x4f36e9[_0xb6b4('0xbb')]=[{'all':!![]}];}return db[_0xb6b4('0xd9')]['findAll'](_0x4f36e9);})[_0xb6b4('0x26')](function(_0x19a758){_0x1852ec[_0xb6b4('0xb8')]=_0x19a758;return _0x1852ec;});}})['then'](respondWithFilteredResult(_0x232c84,_0x4f36e9))['catch'](handleError(_0x232c84,null));};exports[_0xb6b4('0xff')]=function(_0x1dccbe,_0x627c46,_0x51444b){var _0x309c8f={'where':{}},_0x50dd13={},_0x526945={'count':0x0,'rows':[]};return db[_0xb6b4('0x46')][_0xb6b4('0xcf')]({'where':{'id':_0x1dccbe['params']['id']}})[_0xb6b4('0x26')](handleEntityNotFound(_0x627c46,null))['then'](function(_0xe37db7){if(_0xe37db7){_0x50dd13[_0xb6b4('0x4d')]=_[_0xb6b4('0x48')](db['ChatMessage'][_0xb6b4('0x47')]);_0x50dd13['query']=_[_0xb6b4('0x48')](_0x1dccbe[_0xb6b4('0x49')]);_0x50dd13[_0xb6b4('0x4a')]=_[_0xb6b4('0x4b')](_0x50dd13[_0xb6b4('0x4d')],_0x50dd13['query']);_0x309c8f['attributes']=_['intersection'](_0x50dd13['model'],qs[_0xb6b4('0x4e')](_0x1dccbe['query'][_0xb6b4('0x4e')]));_0x309c8f[_0xb6b4('0x4c')]=_0x309c8f[_0xb6b4('0x4c')][_0xb6b4('0x73')]?_0x309c8f['attributes']:_0x50dd13[_0xb6b4('0x4d')];if(!_0x1dccbe['query'][_0xb6b4('0x4f')](_0xb6b4('0x50'))){_0x309c8f['limit']=qs['limit'](_0x1dccbe[_0xb6b4('0x49')][_0xb6b4('0x51')]);_0x309c8f[_0xb6b4('0x33')]=qs[_0xb6b4('0x33')](_0x1dccbe[_0xb6b4('0x49')]['offset']);}_0x309c8f[_0xb6b4('0x52')]=qs[_0xb6b4('0x53')](_0x1dccbe[_0xb6b4('0x49')][_0xb6b4('0x53')]);_0x309c8f[_0xb6b4('0x54')]=qs['filters'](_['pick'](_0x1dccbe[_0xb6b4('0x49')],_0x50dd13[_0xb6b4('0x4a')]));_0x309c8f['where']['ChatInteractionId']=_0xe37db7['id'];if(_0x1dccbe[_0xb6b4('0x49')][_0xb6b4('0x7f')]){_0x309c8f[_0xb6b4('0x54')]=_[_0xb6b4('0xa8')](_0x309c8f[_0xb6b4('0x54')],{'$or':_['map'](_0x309c8f[_0xb6b4('0x4c')],function(_0x48fc22){var _0x459790={};_0x459790[_0x48fc22]={'$like':'%'+_0x1dccbe[_0xb6b4('0x49')][_0xb6b4('0x7f')]+'%'};return _0x459790;})});}_0x309c8f[_0xb6b4('0x54')][_0xb6b4('0xea')]=![];if(_0x1dccbe['query']['id']){_0x309c8f[_0xb6b4('0x54')]['id']={'$gt':_0x1dccbe[_0xb6b4('0x49')]['id']};}_0x309c8f=_[_0xb6b4('0xa8')]({},_0x309c8f,_0x1dccbe[_0xb6b4('0xfd')]);return db[_0xb6b4('0xd9')][_0xb6b4('0x32')]({'where':_0x309c8f[_0xb6b4('0x54')]})[_0xb6b4('0x26')](function(_0x6810ba){_0x526945['count']=_0x6810ba;_0x309c8f[_0xb6b4('0xbb')]=[];if(_0x1dccbe[_0xb6b4('0x49')][_0xb6b4('0x100')]){_0x309c8f[_0xb6b4('0xbb')][_0xb6b4('0x43')]({'model':db['User'],'as':_0xb6b4('0xdb'),'attributes':['id',_0xb6b4('0xe6'),'alias']});}if(_0x1dccbe[_0xb6b4('0x49')]['includeAll']){_0x309c8f['include']=[{'all':!![]}];}return db['ChatMessage'][_0xb6b4('0x101')](_0x309c8f);})[_0xb6b4('0x26')](function(_0x23b004){_0x526945[_0xb6b4('0xb8')]=_0x23b004;return _0x526945;});}})[_0xb6b4('0x26')](respondWithFilteredResult(_0x627c46,_0x309c8f))[_0xb6b4('0x44')](handleError(_0x627c46,null));};exports[_0xb6b4('0x102')]=function(_0x297b56,_0x2d403e,_0x341b30){return db['ChatInteraction']['find']({'where':{'id':_0x297b56[_0xb6b4('0xba')]['id']}})[_0xb6b4('0x26')](handleEntityNotFound(_0x2d403e,null))[_0xb6b4('0x26')](function(_0x142992){if(_0x142992){return _0x142992[_0xb6b4('0x103')](_0x297b56['body'][_0xb6b4('0xf9')],_[_0xb6b4('0xfa')](_0x297b56[_0xb6b4('0xbd')],[_0xb6b4('0xf9'),'id'])||{})[_0xb6b4('0x104')](function(){return db[_0xb6b4('0x105')]['findAll']({'attributes':['id',_0xb6b4('0x3b'),_0xb6b4('0x106')],'where':{'id':_0x297b56[_0xb6b4('0xbd')][_0xb6b4('0xf9')]}});})[_0xb6b4('0x26')](function(_0x12e41e){socket[_0xb6b4('0x107')](_0xb6b4('0x108'),{'id':Number(_0x297b56[_0xb6b4('0xba')]['id']),'tags':_0x12e41e||[]});return{'id':Number(_0x297b56[_0xb6b4('0xba')]['id']),'tags':_0x12e41e||[]};});}})[_0xb6b4('0x26')](respondWithResult(_0x2d403e,null))['catch'](handleError(_0x2d403e,null));};exports[_0xb6b4('0x109')]=function(_0x32ae1b,_0xa8514e,_0x4fe1ec){return db['ChatInteraction']['find']({'where':{'id':_0x32ae1b[_0xb6b4('0xba')]['id']}})['then'](handleEntityNotFound(_0xa8514e,null))[_0xb6b4('0x26')](function(_0x1ec15b){if(_0x1ec15b){return _0x1ec15b[_0xb6b4('0x109')](_0x32ae1b[_0xb6b4('0x49')][_0xb6b4('0xf9')]);}})[_0xb6b4('0x26')](respondWithStatusCode(_0xa8514e,null))[_0xb6b4('0x44')](handleError(_0xa8514e,null));};exports[_0xb6b4('0x10a')]=function(_0x2d561a,_0x69068e){var _0x243c5d=moment()['unix']()[_0xb6b4('0x8c')]();var _0x56eb6a=path[_0xb6b4('0x8d')](config[_0xb6b4('0xd3')],_0xb6b4('0x10b'),_0xb6b4('0x10c'),'tmp');var _0x3fed95=path['join'](config[_0xb6b4('0xd3')],'server',_0xb6b4('0x10c'),_0xb6b4('0x10d'));var _0x2efffa=path[_0xb6b4('0x8d')](_0x56eb6a,_0x243c5d);var _0x51ff9c=util[_0xb6b4('0x6c')]('transcript-%d-%s.zip',_0x2d561a[_0xb6b4('0xba')]['id'],_0x243c5d);var _0x378f19=path[_0xb6b4('0x8d')](_0x56eb6a,_0x51ff9c);var _0x179c70=![];return db[_0xb6b4('0x46')][_0xb6b4('0xbe')]({'where':{'id':_0x2d561a[_0xb6b4('0xba')]['id']},'include':[{'model':db[_0xb6b4('0xd9')],'as':'Messages','attributes':['id',_0xb6b4('0xbd'),_0xb6b4('0x67'),'direction',_0xb6b4('0xea'),_0xb6b4('0x98')],'include':[{'model':db[_0xb6b4('0xdb')],'as':_0xb6b4('0xdb'),'attributes':['id','fullname'],'raw':!![]},{'model':db[_0xb6b4('0xdd')],'as':'Contact','attributes':['id',_0xb6b4('0x10e'),'lastName'],'raw':!![]},{'model':db[_0xb6b4('0xd1')],'as':_0xb6b4('0xd1'),'raw':!![]}]},{'model':db[_0xb6b4('0xdc')],'as':_0xb6b4('0x10f'),'attributes':['id','name']},{'model':db['User'],'as':_0xb6b4('0x110'),'attributes':['id',_0xb6b4('0xe6')]}]})['then'](handleEntityNotFound(_0x69068e,null))[_0xb6b4('0x26')](function(_0x19473c){if(_0x19473c){var _0x283cdc=_0x19473c['get']({'plain':!![]});_0x179c70=!![];var _0x4f2f92={'format':'A4','border':_0xb6b4('0x111'),'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\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\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xb6b4('0x112'),'contents':{'default':util[_0xb6b4('0x6c')](_0xb6b4('0x113'),util['format']('%s\x20#%d',_0xb6b4('0x114'),_0x283cdc['id']),moment()[_0xb6b4('0x6c')](_0xb6b4('0x115'))[_0xb6b4('0x8c')]())}}};fs['mkdirSync'](_0x2efffa);var _0x22d96e={'channel':_0xb6b4('0x114'),'account':_0x283cdc[_0xb6b4('0x10f')][_0xb6b4('0x3b')],'agent':_0x283cdc[_0xb6b4('0x110')]?_0x283cdc['Owner'][_0xb6b4('0xe6')]:'N.A.','createdAt':moment(_0x283cdc['createdAt'])[_0xb6b4('0x6c')](_0xb6b4('0xfc'))[_0xb6b4('0x8c')](),'closedAt':_0x283cdc[_0xb6b4('0xc6')]?moment(_0x283cdc['closedAt'])[_0xb6b4('0x6c')](_0xb6b4('0xfc'))['toString']():'','disposition':_0x283cdc[_0xb6b4('0xc7')],'chatInfo':{'browser':_0x283cdc[_0xb6b4('0x116')],'os':_0x283cdc[_0xb6b4('0x117')],'referer':_0x283cdc[_0xb6b4('0x118')],'customerIp':_0x283cdc[_0xb6b4('0x119')],'customerPort':_0x283cdc[_0xb6b4('0x11a')]?_0x283cdc['customerPort']:_0xb6b4('0x11b')},'messages':_(_0x283cdc['Messages'])[_0xb6b4('0x11c')]()['filter']({'secret':![]})[_0xb6b4('0x3e')](function(_0x23841b){if(_0x23841b[_0xb6b4('0xd1')]){var _0x225055=path[_0xb6b4('0x8d')](_0x3fed95,_0x23841b[_0xb6b4('0xd1')][_0xb6b4('0xd4')]);if(fs[_0xb6b4('0x11d')](_0x225055)){fs[_0xb6b4('0x11e')](_0x225055)['pipe'](fs['createWriteStream'](path['join'](_0x2efffa,_0x23841b[_0xb6b4('0xd1')][_0xb6b4('0xd4')])));}}return{'date':moment(_0x23841b[_0xb6b4('0x67')])[_0xb6b4('0x6c')](_0xb6b4('0xfc'))[_0xb6b4('0x8c')](),'sender':_0x23841b[_0xb6b4('0xe9')]===_0xb6b4('0x11f')?_0x23841b[_0xb6b4('0xdb')]?_0x23841b[_0xb6b4('0xdb')]['fullname']:_0xb6b4('0xe0'):_0x23841b[_0xb6b4('0x120')][_0xb6b4('0x10e')]+(_0x23841b[_0xb6b4('0x120')]['lastName']?'\x20'+_0x23841b[_0xb6b4('0x120')]['lastName']:''),'body':_0x23841b[_0xb6b4('0xd1')]?_0x23841b['Attachment'][_0xb6b4('0xd4')]:_0x23841b[_0xb6b4('0xbd')],'direction':_0x23841b[_0xb6b4('0xe9')]==='out'?'A':'C','secret':_0x23841b[_0xb6b4('0xea')],'read':_0x23841b[_0xb6b4('0x98')],'attachment':_0x23841b[_0xb6b4('0xd1')]};})[_0xb6b4('0x68')]()};return ejs[_0xb6b4('0x121')](path[_0xb6b4('0x8d')](config[_0xb6b4('0xd3')],_0xb6b4('0x10b'),_0xb6b4('0x122'),_0xb6b4('0x123')),{'interaction':_0x22d96e})[_0xb6b4('0x26')](function(_0x2accb6){return new BPromise(function(_0x4b38c2,_0x456c39){pdf['create'](_0x2accb6,_0x4f2f92)['toFile'](path[_0xb6b4('0x8d')](_0x2efffa,'transcript-'+_0x283cdc['id']+'-'+_0x243c5d+_0xb6b4('0x124')),function(_0x31d2ba,_0x1d6532){if(_0x31d2ba)return _0x456c39(_0x31d2ba);_0x4b38c2(_0x1d6532);});});});}})[_0xb6b4('0x26')](function(){if(_0x179c70){return new BPromise(function(_0x2b5ed8,_0x2b8b90){zipdir(_0x2efffa,{'saveTo':_0x378f19},function(_0x344dde,_0x51f870){if(_0x344dde)return _0x2b8b90(_0x344dde);return _0x2b5ed8(_0x51f870);});})[_0xb6b4('0x26')](function(){return new BPromise(function(_0x32084c,_0x2696f6){rimraf(_0x2efffa,function(_0x3633f6){if(_0x3633f6)_0x2696f6(_0x3633f6);return _0x32084c();});});})[_0xb6b4('0x26')](function(){return _0x69068e[_0xb6b4('0x10a')](_0x378f19,_0x51ff9c,function(_0x5711b5){if(_0x5711b5){console[_0xb6b4('0x125')](_0xb6b4('0x126'),_0x5711b5);}else{fs[_0xb6b4('0x127')](_0x378f19);}});});}else{return _0x69068e['sendStatus'](0xc8);}})[_0xb6b4('0x44')](handleError(_0x69068e,null));}; \ No newline at end of file +var _0x3754=['merge','options','create','body','find','describe','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','findOne','Unauthorized','Attachment','attachId','download','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','User','ChatWebsite','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','UserId','agent_alias','alias','fullname','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','service','host','port','Smtp','secure','authentication','auth','user','pass','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','ids','omit','getMessages','ChatMessage','fields','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','getMyMessages','includeAgent','addTags','setTags','spread','chatInteractionTags:save','removeTags','unix','server','files','tmp','Contact','firstName','lastName','Account','get','10px','40px','30px','%s\x20#%d','Chat','YYYY-MM-DD','Owner','N.A.','browserName','referer','customerPort','tail','map','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','update','destroy','stack','name','send','Users','Tags','TagIds','push','ChatInteraction','rawAttributes','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','select','field','color','from','tools_tags','COUNT(*)','chat_messages','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false','advancedFilter','parse','forEach','value','dateStart','startOf','day','utc','format','endOf','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','TagId','unreadMessages','length','tableAlias','\x20IN\x20?','\x20=\x20?','ContactId','c.firstName','\x20LIKE\x20?','\x20<\x20?','c.lastName','c.email','filter','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','null','\x20IS\x20NULL','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','split','toString','join','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','DESC','group','QueryTypes','clone','COUNT(me.id)','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','expr','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','mail_interaction_has_tags','sequelize','keyBy','a.key','Contact.firstName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','params'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3754,0x72));var _0x4375=function(_0xa1d083,_0x474e3b){_0xa1d083=_0xa1d083-0x0;var _0x192c6d=_0x3754[_0xa1d083];return _0x192c6d;};'use strict';var pdf=require(_0x4375('0x0'));var emlformat=require(_0x4375('0x1'));var rimraf=require(_0x4375('0x2'));var zipdir=require(_0x4375('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4375('0x4'));var Mustache=require(_0x4375('0x5'));var util=require(_0x4375('0x6'));var path=require(_0x4375('0x7'));var sox=require(_0x4375('0x8'));var csv=require(_0x4375('0x9'));var ejs=require(_0x4375('0xa'));var fs=require('fs');var _=require(_0x4375('0xb'));var squel=require('squel');var crypto=require(_0x4375('0xc'));var jsforce=require(_0x4375('0xd'));var deskjs=require(_0x4375('0xe'));var toCsv=require(_0x4375('0x9'));var querystring=require(_0x4375('0xf'));var Papa=require(_0x4375('0x10'));var Redis=require(_0x4375('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4375('0x12'));var hardwareService=require(_0x4375('0x13'));var logger=require(_0x4375('0x14'))(_0x4375('0x15'));var utils=require(_0x4375('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4375('0x17')]=_['defaults'](config['redis'],{'host':_0x4375('0x18'),'port':0x18eb});var socket=require(_0x4375('0x19'))(new Redis(config['redis']));require(_0x4375('0x1a'))['register'](socket);var jayson=require(_0x4375('0x1b'));var client=jayson[_0x4375('0x1c')][_0x4375('0x1d')]({'port':0x232b});var client9004=jayson[_0x4375('0x1c')][_0x4375('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x4d3cec,_0x25899a,_0xee996d){if(_0xee996d){var _0x499b79=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x499b79['test'](_0x25899a)){return _0x4d3cec;}else{throw new db[(_0x4375('0x1e'))][(_0x4375('0x1f'))](_0x4375('0x20'));}}else{return _0x4d3cec;}}function respondWithRpcPromise(_0x16fb30,_0x3ca0b9,_0x3f65b3,_0x48919f){return new BPromise(function(_0x32cde5,_0x4a637d){var _0x233488=_0x48919f||client;return _0x233488[_0x4375('0x21')](_0x16fb30,_0x3f65b3)[_0x4375('0x22')](function(_0x16bca9){logger[_0x4375('0x23')](_0x4375('0x24'),_0x3ca0b9,_0x4375('0x25'));logger['debug'](_0x4375('0x26'),_0x3ca0b9,'request\x20sent',JSON[_0x4375('0x27')](_0x16bca9));if(_0x16bca9['error']){if(_0x16bca9[_0x4375('0x28')]['code']===0x1f4){logger[_0x4375('0x28')](_0x4375('0x24'),_0x3ca0b9,_0x16bca9[_0x4375('0x28')][_0x4375('0x29')]);return _0x4a637d(_0x16bca9['error']['message']);}logger['error'](_0x4375('0x24'),_0x3ca0b9,_0x16bca9[_0x4375('0x28')]['message']);return _0x32cde5(_0x16bca9[_0x4375('0x28')][_0x4375('0x29')]);}else{logger['info'](_0x4375('0x24'),_0x3ca0b9,_0x4375('0x25'));_0x32cde5(_0x16bca9[_0x4375('0x2a')][_0x4375('0x29')]);}})[_0x4375('0x2b')](function(_0x509e46){logger['error'](_0x4375('0x24'),_0x3ca0b9,_0x509e46);_0x4a637d(_0x509e46);});});}function respondWithStatusCode(_0x381d90,_0x37388d){_0x37388d=_0x37388d||0xcc;return function(_0x36787a){if(_0x36787a){return _0x381d90[_0x4375('0x2c')](_0x37388d);}return _0x381d90['status'](_0x37388d)[_0x4375('0x2d')]();};}function respondWithResult(_0x3b511e,_0x189a3b){_0x189a3b=_0x189a3b||0xc8;return function(_0x4ca13f){if(_0x4ca13f){return _0x3b511e[_0x4375('0x2e')](_0x189a3b)[_0x4375('0x2f')](_0x4ca13f);}};}function respondWithFilteredResult(_0x211432,_0x52b7ab){return function(_0x1418ee){if(_0x1418ee){var _0x51ada2=_0x1418ee[_0x4375('0x30')],_0x5b7f2f=_0x52b7ab['offset'],_0x2a52dc=_0x52b7ab[_0x4375('0x31')]+_0x52b7ab['limit'],_0x3cd088;if(_0x2a52dc>=_0x51ada2){_0x2a52dc=_0x51ada2;_0x3cd088=0xc8;}else{_0x3cd088=0xce;}_0x211432['status'](_0x3cd088);return _0x211432[_0x4375('0x32')](_0x4375('0x33'),_0x5b7f2f+'-'+_0x2a52dc+'/'+_0x51ada2)[_0x4375('0x2f')](_0x1418ee);}return null;};}function patchUpdates(_0x2ceb9d){return function(_0x1dfccd){try{jsonpatch['apply'](_0x1dfccd,_0x2ceb9d,!![]);}catch(_0x195d55){return BPromise['reject'](_0x195d55);}return _0x1dfccd['save']();};}function saveUpdates(_0x424771,_0x554470){return function(_0x3f841c){if(_0x3f841c){return _0x3f841c[_0x4375('0x34')](_0x424771)[_0x4375('0x22')](function(_0x1c9aaa){return _0x1c9aaa;});}return null;};}function removeEntity(_0x5c28a7,_0x254bc3){return function(_0x447865){if(_0x447865){return _0x447865[_0x4375('0x35')]()[_0x4375('0x22')](function(){_0x5c28a7[_0x4375('0x2e')](0xcc)[_0x4375('0x2d')]();});}};}function handleEntityNotFound(_0x27d4a4,_0x331bdf){return function(_0x31570e){if(!_0x31570e){_0x27d4a4[_0x4375('0x2c')](0x194);}return _0x31570e;};}function handleError(_0x10dab8,_0x5b5eeb){_0x5b5eeb=_0x5b5eeb||0x1f4;return function(_0x42c07e){logger[_0x4375('0x28')](_0x42c07e[_0x4375('0x36')]);if(_0x42c07e[_0x4375('0x37')]){delete _0x42c07e[_0x4375('0x37')];}_0x10dab8['status'](_0x5b5eeb)[_0x4375('0x38')](_0x42c07e);};}function getInteractionUsers(_0x329194,_0x4ed82f){return new BPromise(function(_0x110d3d,_0x57b9f3){try{if(_0x4ed82f[_0x329194['id']]){_0x329194[_0x4375('0x39')]=_['map'](_0x4ed82f[_0x329194['id']],function(_0x55923e){return{'id':_0x55923e['id']};});}}catch(_0xa4c84d){_0x57b9f3(_0xa4c84d);}_0x110d3d(_0x329194);});}function getInteractionTags(_0x2bf0d5,_0xf43128){return new BPromise(function(_0x4168d3,_0x271d7e){try{if(_0x2bf0d5['TagIds']){_0x2bf0d5[_0x4375('0x3a')]=[];_0x2bf0d5[_0x4375('0x3b')]['split'](',')['forEach'](function(_0xbbc5cb){_0x2bf0d5[_0x4375('0x3a')][_0x4375('0x3c')](_0xf43128[_0xbbc5cb]);});}delete _0x2bf0d5[_0x4375('0x3b')];}catch(_0x4417c6){_0x271d7e(_0x4417c6);}_0x4168d3(_0x2bf0d5);});}function updateChatInteraction(_0x2c985b,_0x59406a,_0x499d5c){return new BPromise(function(_0x46dbd0,_0x160e5c){return getInteractionUsers(_0x2c985b,_0x499d5c)[_0x4375('0x22')](function(_0x588876){return getInteractionTags(_0x588876,_0x59406a);})['then'](function(_0x3e85c5){_0x46dbd0(_0x3e85c5);})[_0x4375('0x2b')](function(_0x5e9ae6){_0x160e5c(_0x5e9ae6);});});}exports['index']=function(_0x3891c6,_0x46509c){var _0x4f0b64={},_0x162039={},_0x1cbb5c={'count':0x0,'rows':[]};var _0x4ef852=db[_0x4375('0x3d')][_0x4375('0x3e')];_0x162039[_0x4375('0x3f')]=_[_0x4375('0x40')](_0x4ef852);_0x162039[_0x4375('0x41')]=_[_0x4375('0x40')](_0x3891c6[_0x4375('0x41')]);_0x162039['filters']=_[_0x4375('0x42')](_0x162039[_0x4375('0x3f')],_0x162039[_0x4375('0x41')]);_0x4f0b64[_0x4375('0x43')]=_[_0x4375('0x42')](_0x162039[_0x4375('0x3f')],qs['fields'](_0x3891c6[_0x4375('0x41')]['fields']));_0x4f0b64[_0x4375('0x43')]=_0x4f0b64['attributes']['length']?_0x4f0b64[_0x4375('0x43')]:_0x162039['model'];if(!_0x3891c6[_0x4375('0x41')][_0x4375('0x44')](_0x4375('0x45'))){_0x4f0b64['limit']=qs[_0x4375('0x46')](_0x3891c6[_0x4375('0x41')][_0x4375('0x46')]);_0x4f0b64[_0x4375('0x31')]=qs['offset'](_0x3891c6[_0x4375('0x41')]['offset']);}_0x4f0b64[_0x4375('0x47')]=qs[_0x4375('0x48')](_0x3891c6[_0x4375('0x41')][_0x4375('0x48')]);_0x4f0b64[_0x4375('0x49')]=qs['filters'](_[_0x4375('0x4a')](_0x3891c6[_0x4375('0x41')],_0x162039[_0x4375('0x4b')]));var _0x3e8cf1=[];var _0x3e4887=squel[_0x4375('0x4c')]()[_0x4375('0x4d')]('id')[_0x4375('0x4d')](_0x4375('0x37'))[_0x4375('0x4d')](_0x4375('0x4e'))[_0x4375('0x4f')](_0x4375('0x50'));var _0x2acbf0=squel[_0x4375('0x4c')]()[_0x4375('0x4d')](_0x4375('0x51'))[_0x4375('0x4f')](_0x4375('0x52'),'me')[_0x4375('0x49')]('me.ChatInteractionId\x20=\x20i.id')[_0x4375('0x49')](_0x4375('0x53'))[_0x4375('0x49')](_0x4375('0x54'));var _0x322d58=squel[_0x4375('0x4c')]()['field'](_0x4375('0x55'))[_0x4375('0x4d')](_0x4375('0x56'))[_0x4375('0x4f')](_0x4375('0x57'),'ui')[_0x4375('0x58')]('users','u',_0x4375('0x59'));var _0x285b02=squel[_0x4375('0x4c')]()['from'](_0x4375('0x5a'),'i')['left_join'](_0x4375('0x5b'),'c',_0x4375('0x5c'))[_0x4375('0x58')](_0x4375('0x5d'),'o',_0x4375('0x5e'))[_0x4375('0x58')]('chat_websites','a',_0x4375('0x5f'))[_0x4375('0x58')](_0x4375('0x52'),'me',_0x4375('0x60'));var _0xf30603=squel['expr']();if(_0x3891c6[_0x4375('0x41')][_0x4375('0x61')]){var _0x55d8b0=JSON[_0x4375('0x62')](_0x3891c6[_0x4375('0x41')][_0x4375('0x61')]);_[_0x4375('0x40')](_0x55d8b0)[_0x4375('0x63')](function(_0x4c52f2){var _0x2287f3=_0x55d8b0[_0x4c52f2];if(_0x4c52f2==='createdAt'){var _0x1291e9=moment(_0x2287f3[_0x4375('0x64')][_0x4375('0x65')])[_0x4375('0x66')](_0x4375('0x67'))[_0x4375('0x68')]()[_0x4375('0x69')]();var _0x3536dc=moment(_0x3536dc)[_0x4375('0x68')]()[_0x4375('0x6a')](_0x4375('0x67'))[_0x4375('0x69')]();_0xf30603[_0x4375('0x6b')](_0x4375('0x6c'),_0x1291e9,_0x3536dc);}else{if(_[_0x4375('0x6d')](_0x2287f3[_0x4375('0x6e')])){_0x2287f3['condition']['forEach'](function(_0x1987ba){switch(_0x2287f3[_0x4375('0x6e')]['value']){case'IS':if(_0x4c52f2!==_0x4375('0x6f')&&_0x4c52f2!==_0x4375('0x70')){if(_[_0x4375('0x6d')](_0x2287f3[_0x4375('0x64')])&&_0x2287f3['value'][_0x4375('0x71')]>0x1){_0xf30603[_0x4375('0x6b')](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+_0x4375('0x73'),_0x2287f3[_0x4375('0x64')]);}else{_0xf30603[_0x4375('0x6b')](_0x2287f3['tableAlias']+'.'+_0x4c52f2+'\x20=\x20?',_0x2287f3[_0x4375('0x64')][0x0]);}}break;case'=':_0xf30603[_0x4375('0x6b')](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+_0x4375('0x74'),_0x2287f3[_0x4375('0x64')]);break;case'LIKE':if(_0x4c52f2===_0x4375('0x75')){_0xf30603[_0x4375('0x6b')](_0x4375('0x76')+_0x4375('0x77'),'%'+_0x2287f3[_0x4375('0x64')]+'%');_0xf30603['or']('c.lastName'+_0x4375('0x77'),'%'+_0x2287f3['value']+'%');_0xf30603['or']('c.email'+'\x20LIKE\x20?','%'+_0x2287f3[_0x4375('0x64')]+'%');}else{_0xf30603[_0x4375('0x6b')](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+_0x4375('0x77'),'%'+_0x2287f3[_0x4375('0x64')]+'%');}break;case'>':_0xf30603[_0x4375('0x6b')](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+'\x20>\x20?',_0x2287f3[_0x4375('0x64')]);break;case'<':_0xf30603[_0x4375('0x6b')](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+_0x4375('0x78'),_0x2287f3[_0x4375('0x64')]);break;}});}else{switch(_0x2287f3[_0x4375('0x6e')]['value']){case'IS':if(_0x4c52f2!==_0x4375('0x6f')&&_0x4c52f2!=='unreadMessages'){if(_[_0x4375('0x6d')](_0x2287f3['value'])&&_0x2287f3['value'][_0x4375('0x71')]>0x1){_0xf30603['and'](_0x2287f3['tableAlias']+'.'+_0x4c52f2+'\x20IN\x20?',_0x2287f3[_0x4375('0x64')]);}else{_0xf30603[_0x4375('0x6b')](_0x2287f3['tableAlias']+'.'+_0x4c52f2+_0x4375('0x74'),_0x2287f3[_0x4375('0x64')][0x0]);}}break;case'=':_0xf30603[_0x4375('0x6b')](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+_0x4375('0x74'),_0x2287f3['value']);break;case'LIKE':if(_0x4c52f2===_0x4375('0x75')){_0xf30603[_0x4375('0x6b')](_0x4375('0x76')+_0x4375('0x77'),'%'+_0x2287f3[_0x4375('0x64')]+'%');_0xf30603['or'](_0x4375('0x79')+'\x20LIKE\x20?','%'+_0x2287f3[_0x4375('0x64')]+'%');_0xf30603['or'](_0x4375('0x7a')+'\x20LIKE\x20?','%'+_0x2287f3[_0x4375('0x64')]+'%');}else{_0xf30603[_0x4375('0x6b')](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+_0x4375('0x77'),'%'+_0x2287f3[_0x4375('0x64')]+'%');}break;case'>':_0xf30603['and'](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+'\x20>\x20?',_0x2287f3['value']);break;case'<':_0xf30603[_0x4375('0x6b')](_0x2287f3[_0x4375('0x72')]+'.'+_0x4c52f2+'\x20<\x20?',_0x2287f3[_0x4375('0x64')]);break;}}}});}else{var _0x4c1bf3=_(Object[_0x4375('0x40')](_0x3891c6[_0x4375('0x41')]))['map'](function(_0x80d425){return _0x4ef852[_0x4375('0x44')](_0x80d425)?_0x80d425:undefined;})[_0x4375('0x7b')](function(_0x93a9cb){return!_['isNil'](_0x93a9cb);})[_0x4375('0x64')]();if(!_[_0x4375('0x7c')](_0x4c1bf3)){_0x4c1bf3[_0x4375('0x63')](function(_0x58819f){if(_0x58819f===_0x4375('0x7d')){_0x285b02['where'](_0x4375('0x7e'),[]['concat'](_0x3891c6[_0x4375('0x41')][_0x58819f]));}else if(_0x58819f===_0x4375('0x7f')){var _0x43682e=JSON[_0x4375('0x62')](_0x3891c6[_0x4375('0x41')][_0x58819f])[_0x4375('0x80')];var _0x1f7489=JSON['parse'](_0x3891c6[_0x4375('0x41')][_0x58819f])['$lte'];_0x285b02['where'](_0x4375('0x6c'),_0x43682e,_0x1f7489);}else{if(_0x3891c6['query'][_0x58819f]===_0x4375('0x81')){_0x285b02[_0x4375('0x49')]('i.'+_0x58819f+_0x4375('0x82'));}else{_0x285b02[_0x4375('0x49')]('i.'+_0x58819f+_0x4375('0x74'),_0x3891c6['query'][_0x58819f]);}}});}if(_0x3891c6[_0x4375('0x41')][_0x4375('0x7b')]){var _0x201d44=_0x3891c6['query'][_0x4375('0x7b')][_0x4375('0x83')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x4375('0x84'));if(qs['isNumeric'](_0x201d44)){_0xf30603['or'](_0x4375('0x85'),_0x201d44+'%');}else{var _0x569397=[];_0x201d44[_0x4375('0x86')]('\x20')[_0x4375('0x63')](function(_0x3356fc){_0x569397[_0x4375('0x3c')]('+'+_0x3356fc[_0x4375('0x87')]());});var _0x37e848=_0x569397[_0x4375('0x88')]('\x20');_0xf30603['or'](_0x4375('0x89'),_0x37e848)['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x201d44+'%');}}}_0x285b02[_0x4375('0x49')](_0xf30603);if(_0x4f0b64[_0x4375('0x47')]){_0x4f0b64['order']['forEach'](function(_0x3d81b6){_0x285b02[_0x4375('0x47')]('i.'+_0x3d81b6[0x0],_0x3d81b6[0x1]===_0x4375('0x8a')?![]:!![]);});}_0x285b02[_0x4375('0x8b')]('i.id');var _0x82cee={'type':db[_0x4375('0x1e')][_0x4375('0x8c')]['SELECT'],'raw':!![]};var _0x2ad815=_0x285b02[_0x4375('0x8d')]()['field'](_0x4375('0x51'))[_0x4375('0x4d')](_0x4375('0x8e'),_0x4375('0x70'));if(!_0x3891c6[_0x4375('0x41')][_0x4375('0x61')]){if(_0x3891c6['query'][_0x4375('0x8f')]){if(_0x3891c6['query'][_0x4375('0x8f')]==0x1){_0x2ad815[_0x4375('0x90')](_0x4375('0x91'));_0x285b02[_0x4375('0x90')](_0x4375('0x91'));}else{_0x2ad815[_0x4375('0x90')](_0x4375('0x92'));_0x285b02[_0x4375('0x90')](_0x4375('0x92'));}}if(_0x3891c6[_0x4375('0x41')][_0x4375('0x93')]){var _0x351b86=_[_0x4375('0x6d')](_0x3891c6[_0x4375('0x41')]['tag'])?_0x3891c6[_0x4375('0x41')][_0x4375('0x93')]:new Array(_0x3891c6[_0x4375('0x41')][_0x4375('0x93')]);var _0x524a81=squel[_0x4375('0x94')]();_0x351b86[_0x4375('0x63')](function(_0x121f18){_0x524a81['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x121f18+',%');});_0x285b02['having'](_0x524a81);_0x2ad815[_0x4375('0x58')](_0x4375('0x95'),'it',_0x4375('0x96'));_0x2ad815[_0x4375('0x58')](_0x4375('0x50'),'t',_0x4375('0x97'));_0x2ad815['where'](_0x4375('0x98'),_0x351b86);}}else{var _0x55d8b0=JSON[_0x4375('0x62')](_0x3891c6[_0x4375('0x41')][_0x4375('0x61')]);_[_0x4375('0x40')](_0x55d8b0)['forEach'](function(_0x1ca1fc){var _0x145fde=_0x55d8b0[_0x1ca1fc];if(_0x1ca1fc===_0x4375('0x6f')){var _0xae50cf=_0x145fde[_0x4375('0x64')];var _0xf577a8=squel[_0x4375('0x94')]();_0xae50cf[_0x4375('0x63')](function(_0x3122d1){_0xf577a8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3122d1+',%');});_0x285b02[_0x4375('0x90')](_0xf577a8);_0x2ad815[_0x4375('0x58')](_0x4375('0x99'),'it','it.MailInteractionId\x20=\x20i.id');_0x2ad815[_0x4375('0x58')](_0x4375('0x50'),'t',_0x4375('0x97'));_0x2ad815['where']('t.id\x20IN\x20?',_0xae50cf);}else if(_0x1ca1fc===_0x4375('0x70')){if(_0x145fde[_0x4375('0x64')][_0x4375('0x71')]===0x1){if(_0x145fde['value'][0x0]===0x1){_0x2ad815[_0x4375('0x90')](_0x4375('0x91'));_0x285b02[_0x4375('0x90')]('`unreadMessages`\x20=\x200');}else{_0x2ad815[_0x4375('0x90')](_0x4375('0x92'));_0x285b02[_0x4375('0x90')](_0x4375('0x92'));}}}});}db['sequelize'][_0x4375('0x41')](_0x2ad815[_0x4375('0x87')](),_0x82cee)[_0x4375('0x22')](function(_0x5eb459){_0x1cbb5c[_0x4375('0x30')]=_0x5eb459[_0x4375('0x71')];if(_0x1cbb5c['count']===0x0)return[];return db[_0x4375('0x9a')]['query'](_0x3e4887[_0x4375('0x87')](),_0x82cee)[_0x4375('0x22')](function(_0x1b4dfc){_0x3e8cf1=_[_0x4375('0x9b')](_0x1b4dfc,'id');_0x82cee=_['merge'](_0x82cee,{'model':db[_0x4375('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x285b02[_0x4375('0x4d')](_0x4375('0x8e'),_0x4375('0x70'));_0x285b02[_0x4375('0x4d')](_0x4375('0x9c'),'Account.key');_0x285b02[_0x4375('0x4d')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x285b02[_0x4375('0x4d')]('i.*');_0x285b02[_0x4375('0x4d')]('c.firstName',_0x4375('0x9d'));_0x285b02[_0x4375('0x4d')](_0x4375('0x79'),_0x4375('0x9e'));_0x285b02['field'](_0x4375('0x7a'),'Contact.email');_0x285b02[_0x4375('0x4d')](_0x4375('0x9f'),_0x4375('0xa0'));_0x285b02[_0x4375('0x4d')](_0x4375('0xa1'),_0x4375('0xa2'));_0x285b02[_0x4375('0x4d')]('c.fax','Contact.fax');_0x285b02['field'](_0x4375('0xa3'),_0x4375('0x3b'));_0x285b02['left_join'](_0x4375('0x95'),'it',_0x4375('0x96'));_0x285b02[_0x4375('0x58')](_0x4375('0x50'),'t','t.id\x20=\x20it.TagId');_0x285b02['limit'](_0x4f0b64[_0x4375('0x46')]);_0x285b02[_0x4375('0x31')](_0x4f0b64[_0x4375('0x31')]);return db[_0x4375('0x9a')][_0x4375('0x41')](_0x285b02[_0x4375('0x87')](),_0x82cee);})[_0x4375('0x22')](function(_0x3087d3){_0x322d58[_0x4375('0x49')](_0x4375('0xa4'),_['map'](_0x3087d3,'id'));return db[_0x4375('0x9a')][_0x4375('0x41')](_0x322d58[_0x4375('0x87')](),_0x82cee)[_0x4375('0x22')](function(_0x594046){var _0x49358b=_[_0x4375('0xa5')](_0x594046,_0x4375('0xa6'));var _0x259286=[];_0x3087d3[_0x4375('0x63')](function(_0x1dba6b){_0x259286[_0x4375('0x3c')](updateChatInteraction(_0x1dba6b,_0x3e8cf1,_0x49358b));});return BPromise['all'](_0x259286);});});})['then'](function(_0x3a923e){_0x1cbb5c['rows']=_0x3a923e;return _0x1cbb5c;})[_0x4375('0x22')](respondWithFilteredResult(_0x46509c,_0x4f0b64))[_0x4375('0x2b')](handleError(_0x46509c,null));};exports['show']=function(_0x3be615,_0x51d577){var _0x31d6ce={'raw':![],'where':{'id':_0x3be615[_0x4375('0xa7')]['id']}},_0x100646={};_0x100646[_0x4375('0x3f')]=_[_0x4375('0x40')](db['ChatInteraction']['rawAttributes']);_0x100646['query']=_['keys'](_0x3be615[_0x4375('0x41')]);_0x100646[_0x4375('0x4b')]=_[_0x4375('0x42')](_0x100646[_0x4375('0x3f')],_0x100646[_0x4375('0x41')]);_0x31d6ce[_0x4375('0x43')]=_[_0x4375('0x42')](_0x100646['model'],qs['fields'](_0x3be615[_0x4375('0x41')]['fields']));_0x31d6ce['attributes']=_0x31d6ce['attributes'][_0x4375('0x71')]?_0x31d6ce[_0x4375('0x43')]:_0x100646['model'];if(_0x3be615[_0x4375('0x41')]['includeAll']){_0x31d6ce['include']=[{'all':!![]}];}_0x31d6ce=_[_0x4375('0xa8')]({},_0x31d6ce,_0x3be615[_0x4375('0xa9')]);return db['ChatInteraction']['find'](_0x31d6ce)[_0x4375('0x22')](handleEntityNotFound(_0x51d577,null))[_0x4375('0x22')](respondWithResult(_0x51d577,null))[_0x4375('0x2b')](handleError(_0x51d577,null));};exports['create']=function(_0x174fce,_0x4bea1a){return db[_0x4375('0x3d')][_0x4375('0xaa')](_0x174fce['body'],{})[_0x4375('0x22')](respondWithResult(_0x4bea1a,0xc9))['catch'](handleError(_0x4bea1a,null));};exports['update']=function(_0x43c50d,_0xaa2e22){if(_0x43c50d['body']['id']){delete _0x43c50d[_0x4375('0xab')]['id'];}return db[_0x4375('0x3d')]['find']({'where':{'id':_0x43c50d['params']['id']}})[_0x4375('0x22')](handleEntityNotFound(_0xaa2e22,null))['then'](saveUpdates(_0x43c50d[_0x4375('0xab')],null))[_0x4375('0x22')](respondWithResult(_0xaa2e22,null))[_0x4375('0x2b')](handleError(_0xaa2e22,null));};exports[_0x4375('0x35')]=function(_0x560f37,_0x477215){return db[_0x4375('0x3d')][_0x4375('0xac')]({'where':{'id':_0x560f37[_0x4375('0xa7')]['id']}})[_0x4375('0x22')](handleEntityNotFound(_0x477215,null))['then'](removeEntity(_0x477215,null))[_0x4375('0x2b')](handleError(_0x477215,null));};exports[_0x4375('0xad')]=function(_0x213615,_0x5aeffe){return db[_0x4375('0x3d')][_0x4375('0xad')]()[_0x4375('0x22')](respondWithResult(_0x5aeffe,null))[_0x4375('0x2b')](handleError(_0x5aeffe,null));};exports['customUpdate']=function(_0x30bdec,_0x432e8d){if(_0x30bdec['body']['id']){delete _0x30bdec[_0x4375('0xab')]['id'];}return db[_0x4375('0x3d')][_0x4375('0xac')]({'where':{'id':_0x30bdec['params']['id']}})[_0x4375('0x22')](handleEntityNotFound(_0x432e8d,null))[_0x4375('0x22')](saveUpdates(_0x30bdec[_0x4375('0xab')],null))[_0x4375('0x22')](respondWithResult(_0x432e8d,null))['catch'](handleError(_0x432e8d,null));};exports[_0x4375('0xae')]=function(_0x3b1a4c,_0x3df063,_0x25bc1a){if(_0x3b1a4c['body']['id']){delete _0x3b1a4c[_0x4375('0xab')]['id'];}return db[_0x4375('0x3d')][_0x4375('0xac')]({'where':{'id':_0x3b1a4c['params']['id']}})['then'](function(_0x44947d){if(!_0x44947d){logger[_0x4375('0x28')](_0x4375('0xaf'),_0x4375('0xae'),0x194,_0x4375('0xb0'));_0x3df063['sendStatus'](0x194);}else{if(_0x44947d['UserId']){throw new db[(_0x4375('0x1e'))][(_0x4375('0x1f'))]('Interaction\x20already\x20assigned');}}return _0x44947d;})[_0x4375('0x22')](function(_0x1fc4cb){if(_0x1fc4cb){return _0x1fc4cb[_0x4375('0x34')]({'closed':_0x3b1a4c[_0x4375('0xab')][_0x4375('0xb1')],'disposition':_0x3b1a4c[_0x4375('0xab')][_0x4375('0xb2')]})[_0x4375('0x22')](function(_0xa844f){return _0xa844f;});}})[_0x4375('0x22')](function(_0x4d0104){return respondWithRpcPromise(_0x4375('0xb3'),_0x4375('0xae'),_0x3b1a4c[_0x4375('0xab')],client9004);})[_0x4375('0x22')](respondWithResult(_0x3df063,null))[_0x4375('0x2b')](handleError(_0x3df063,null));};exports[_0x4375('0xb4')]=function(_0x72545a,_0xc789c7,_0x4563ad){_0x72545a[_0x4375('0xab')][_0x4375('0x37')]=_0x72545a[_0x4375('0xb5')][_0x4375('0xb6')];_0x72545a['body'][_0x4375('0xb7')]=_0x72545a['file'][_0x4375('0xb8')];_0x72545a['body']['type']=_0x72545a['file']['mimetype'];return db['Attachment'][_0x4375('0xaa')](_0x72545a[_0x4375('0xab')])[_0x4375('0x22')](respondWithResult(_0xc789c7,0xc9))[_0x4375('0x2b')](handleError(_0xc789c7,null));};exports['attachmentDownload']=function(_0x2653f1,_0x21e98c,_0x3bf7e3){return db[_0x4375('0x3d')][_0x4375('0xb9')]({'where':{'id':_0x2653f1['params']['id']},'raw':!![]})[_0x4375('0x22')](handleEntityNotFound(_0x21e98c,null))[_0x4375('0x22')](function(_0x195ce2){if(_0x195ce2){if(_0x195ce2[_0x4375('0xb1')]){return _0x21e98c[_0x4375('0x2e')](0x193)[_0x4375('0x2f')]({'status':0x193,'message':_0x4375('0xba')});}return db[_0x4375('0xbb')][_0x4375('0xb9')]({'where':{'id':_0x2653f1[_0x4375('0x41')][_0x4375('0xbc')]},'raw':!![]})['then'](handleEntityNotFound(_0x21e98c,null));}})[_0x4375('0x22')](function(_0x1591f3){if(_0x1591f3){return _0x21e98c[_0x4375('0xbd')](path[_0x4375('0x88')](config[_0x4375('0xbe')],_0x4375('0xbf'),_0x1591f3[_0x4375('0xb7')]));}})[_0x4375('0x2b')](handleError(_0x21e98c,null));};exports['close']=function(_0x25f8b6,_0x460595){var _0x519e59=null;var _0x7fba62=null;var _0x412ee9=null;var _0x303f2d=null;if(_0x25f8b6[_0x4375('0xab')]['id']){delete _0x25f8b6[_0x4375('0xab')]['id'];}if(_0x25f8b6[_0x4375('0xab')][_0x4375('0xc0')]){_0x303f2d=path['join'](config[_0x4375('0xbe')],_0x4375('0xc1'),util[_0x4375('0x69')](_0x4375('0xc2'),Date[_0x4375('0xc3')]()));_0x25f8b6[_0x4375('0xab')][_0x4375('0xc4')]=_0x303f2d;}return db['ChatInteraction'][_0x4375('0xac')]({'where':{'id':_0x25f8b6[_0x4375('0xa7')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0x4375('0xc5')}]}]})[_0x4375('0x22')](handleEntityNotFound(_0x460595,null))['then'](saveUpdates(_0x25f8b6[_0x4375('0xab')],null))[_0x4375('0x22')](function(_0x51014d){if(_0x51014d){_0x519e59=_0x51014d;return db[_0x4375('0xc6')][_0x4375('0xac')]({'where':{'id':_0x519e59[_0x4375('0x7d')]}});}})['then'](function(_0x441ccc){if(_0x441ccc){_0x412ee9=_0x441ccc;return db[_0x4375('0xc7')]['find']({'where':{'id':_0x519e59['ContactId']}});}})[_0x4375('0x22')](function(_0x527d11){if(_0x527d11){_0x7fba62=_0x527d11;if(_0x303f2d){var _0x276bd6=null;for(var _0x4f5eb6=0x1;_0x4f5eb6<_0x519e59[_0x4375('0xc8')][_0x4375('0x71')];++_0x4f5eb6){_0x276bd6=_0x519e59['Messages'][_0x4f5eb6];var _0x5b1079=_0x276bd6['UserId']?util['format'](_0x4375('0xc9'),_0x412ee9[_0x4375('0xca')],_0x276bd6['UserId']):_0x4375('0xcb');var _0x43f410=_0x25f8b6[_0x4375('0xab')][_0x4375('0xcc')]||util[_0x4375('0x69')](_0x4375('0xc9'),_0x4375('0xcd'),_0x276bd6[_0x4375('0x75')]);switch(_0x412ee9['agentIdentifier']){case'website_alias':_0x5b1079=_0x276bd6[_0x4375('0xce')]?util[_0x4375('0x69')](_0x4375('0xc9'),_0x412ee9[_0x4375('0xca')],_0x276bd6['UserId']):_0x4375('0xcb');break;case _0x4375('0xcf'):_0x5b1079=_0x276bd6[_0x4375('0xce')]?_0x276bd6[_0x4375('0xc5')][_0x4375('0xd0')]||_0x276bd6[_0x4375('0xc5')][_0x4375('0xd1')]:_0x4375('0xcb');break;case _0x4375('0xd2'):_0x5b1079=_0x276bd6['UserId']?_0x276bd6[_0x4375('0xc5')][_0x4375('0xd1')]:_0x4375('0xcb');break;default:_0x5b1079=_0x276bd6['UserId']?util['format'](_0x4375('0xc9'),_0x412ee9[_0x4375('0xca')],_0x276bd6[_0x4375('0xce')]):_0x4375('0xcb');}var _0x1b8a36=util[_0x4375('0x69')]('[%s]\x20%s:\x20%s\x0a',moment(_0x276bd6[_0x4375('0x7f')])[_0x4375('0x69')](_0x4375('0xd3')),_0x276bd6[_0x4375('0xd4')]==='in'?_0x43f410:_0x5b1079,_0x276bd6[_0x4375('0xab')]);if(!_0x276bd6[_0x4375('0xd5')]){fs[_0x4375('0xd6')](_0x303f2d,_0x1b8a36);}}return db[_0x4375('0xd7')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x4375('0xd8')],'as':'Smtp','raw':!![]}]});}}})[_0x4375('0x22')](function(_0x3f1b6d){if(_0x3f1b6d&&_0x3f1b6d['Smtp']&&_0x25f8b6[_0x4375('0xab')]){var _0x1d00e9={'tls':{'rejectUnauthorized':![]}};if(_0x3f1b6d['Smtp']['service']){_0x1d00e9[_0x4375('0xd9')]=_0x3f1b6d['Smtp']['service'];}else{_0x1d00e9[_0x4375('0xda')]=_0x3f1b6d['Smtp'][_0x4375('0xda')];_0x1d00e9[_0x4375('0xdb')]=_0x3f1b6d[_0x4375('0xdc')]['port'];_0x1d00e9[_0x4375('0xdd')]=_0x3f1b6d['Smtp']['secure'];}if(_0x3f1b6d[_0x4375('0xdc')][_0x4375('0xde')]){_0x1d00e9[_0x4375('0xdf')]={'user':_0x3f1b6d['Smtp'][_0x4375('0xe0')],'pass':_0x3f1b6d['Smtp'][_0x4375('0xe1')]};}return respondWithRpcPromise(_0x4375('0xe2'),'sendMail',{'account':_0x1d00e9,'message':{'from':util[_0x4375('0x69')](_0x4375('0xe3'),_0x3f1b6d[_0x4375('0x37')],_0x3f1b6d[_0x4375('0xe4')]||_0x3f1b6d[_0x4375('0xdc')][_0x4375('0xe0')]),'to':_0x25f8b6['body'][_0x4375('0xc0')],'subject':_0x4375('0xe5'),'text':util[_0x4375('0x69')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x25f8b6[_0x4375('0xab')]['mailTranscript']),'attachments':[{'path':_0x303f2d}]}})[_0x4375('0x22')](function(){return _0x519e59;})[_0x4375('0x2b')](function(_0xcd97e9){console[_0x4375('0x28')](_0xcd97e9);});}else{return _0x519e59;}})['then'](respondWithStatusCode(_0x460595,0xc8))['catch'](handleError(_0x460595,null));};exports[_0x4375('0xe6')]=function(_0x1d7842,_0x111aeb,_0x2f71d4){return db['ChatMessage'][_0x4375('0xac')]({'where':{'id':_0x1d7842['params']['id']}})[_0x4375('0x22')](handleEntityNotFound(_0x111aeb,null))[_0x4375('0x22')](function(_0x11c4b9){if(_0x11c4b9){return _0x11c4b9[_0x4375('0xe6')](_0x1d7842[_0x4375('0xab')][_0x4375('0xe7')],_[_0x4375('0xe8')](_0x1d7842['body'],[_0x4375('0xe7'),'id'])||{});}})['then'](respondWithResult(_0x111aeb,null))['catch'](handleError(_0x111aeb,null));};exports[_0x4375('0xe9')]=function(_0x5c842f,_0x5a34c5,_0x19e586){var _0x39c7b3={'raw':![],'where':{}};var _0x574033={};var _0x52dc3e={'count':0x0,'rows':[]};return db[_0x4375('0x3d')][_0x4375('0xb9')]({'where':{'id':_0x5c842f[_0x4375('0xa7')]['id']}})[_0x4375('0x22')](handleEntityNotFound(_0x5a34c5,null))[_0x4375('0x22')](function(_0x2f1fed){if(_0x2f1fed){_0x574033['model']=_[_0x4375('0x40')](db[_0x4375('0xea')]['rawAttributes']);_0x574033[_0x4375('0x41')]=_[_0x4375('0x40')](_0x5c842f['query']);_0x574033['filters']=_[_0x4375('0x42')](_0x574033[_0x4375('0x3f')],_0x574033[_0x4375('0x41')]);_0x39c7b3[_0x4375('0x43')]=_[_0x4375('0x42')](_0x574033[_0x4375('0x3f')],qs[_0x4375('0xeb')](_0x5c842f['query'][_0x4375('0xeb')]));_0x39c7b3[_0x4375('0x43')]=_0x39c7b3[_0x4375('0x43')]['length']?_0x39c7b3[_0x4375('0x43')]:_0x574033[_0x4375('0x3f')];if(!_0x5c842f['query'][_0x4375('0x44')](_0x4375('0x45'))){_0x39c7b3[_0x4375('0x46')]=qs[_0x4375('0x46')](_0x5c842f[_0x4375('0x41')][_0x4375('0x46')]);_0x39c7b3[_0x4375('0x31')]=qs[_0x4375('0x31')](_0x5c842f['query'][_0x4375('0x31')]);}_0x39c7b3['order']=qs[_0x4375('0x48')](_0x5c842f['query']['sort']);_0x39c7b3['where']=qs['filters'](_[_0x4375('0x4a')](_0x5c842f[_0x4375('0x41')],_0x574033['filters']));_0x39c7b3[_0x4375('0x49')][_0x4375('0xa6')]=_0x2f1fed['id'];if(_0x5c842f[_0x4375('0x41')][_0x4375('0x7b')]){_0x39c7b3[_0x4375('0x49')]=_[_0x4375('0xa8')](_0x39c7b3[_0x4375('0x49')],{'$or':_['map'](_0x39c7b3['attributes'],function(_0x8d5b89){var _0x5d76bd={};_0x5d76bd[_0x8d5b89]={'$like':'%'+_0x5c842f[_0x4375('0x41')][_0x4375('0x7b')]+'%'};return _0x5d76bd;})});}if(_0x5c842f[_0x4375('0x41')][_0x4375('0x80')]){var _0x302c52=_0x5c842f[_0x4375('0x41')][_0x4375('0x80')][_0x4375('0x86')](',');var _0xf70956={};_0xf70956[_0x302c52[0x0]]={'$gte':moment(_0x302c52[0x1])[_0x4375('0x69')](_0x4375('0xec'))};_0x39c7b3[_0x4375('0x49')]=_[_0x4375('0xa8')](_0x39c7b3[_0x4375('0x49')],_0xf70956);}_0x39c7b3=_['merge']({},_0x39c7b3,_0x5c842f[_0x4375('0xa9')]);return db[_0x4375('0xea')]['count']({'where':_0x39c7b3[_0x4375('0x49')]})['then'](function(_0x50c2e3){_0x52dc3e[_0x4375('0x30')]=_0x50c2e3;if(_0x5c842f[_0x4375('0x41')][_0x4375('0xed')]){_0x39c7b3[_0x4375('0xee')]=[{'all':!![]}];}return db['ChatMessage'][_0x4375('0xef')](_0x39c7b3);})[_0x4375('0x22')](function(_0x449931){_0x52dc3e[_0x4375('0xf0')]=_0x449931;return _0x52dc3e;});}})[_0x4375('0x22')](respondWithFilteredResult(_0x5a34c5,_0x39c7b3))[_0x4375('0x2b')](handleError(_0x5a34c5,null));};exports[_0x4375('0xf1')]=function(_0x195d88,_0x144648,_0x205ecf){var _0x514495={'where':{}},_0x1d0a66={},_0xe4ac9d={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x4375('0xb9')]({'where':{'id':_0x195d88[_0x4375('0xa7')]['id']}})[_0x4375('0x22')](handleEntityNotFound(_0x144648,null))[_0x4375('0x22')](function(_0x599a14){if(_0x599a14){_0x1d0a66[_0x4375('0x3f')]=_[_0x4375('0x40')](db[_0x4375('0xea')][_0x4375('0x3e')]);_0x1d0a66[_0x4375('0x41')]=_[_0x4375('0x40')](_0x195d88[_0x4375('0x41')]);_0x1d0a66['filters']=_['intersection'](_0x1d0a66[_0x4375('0x3f')],_0x1d0a66[_0x4375('0x41')]);_0x514495[_0x4375('0x43')]=_[_0x4375('0x42')](_0x1d0a66[_0x4375('0x3f')],qs[_0x4375('0xeb')](_0x195d88[_0x4375('0x41')][_0x4375('0xeb')]));_0x514495['attributes']=_0x514495[_0x4375('0x43')][_0x4375('0x71')]?_0x514495['attributes']:_0x1d0a66[_0x4375('0x3f')];if(!_0x195d88[_0x4375('0x41')][_0x4375('0x44')](_0x4375('0x45'))){_0x514495[_0x4375('0x46')]=qs[_0x4375('0x46')](_0x195d88[_0x4375('0x41')][_0x4375('0x46')]);_0x514495[_0x4375('0x31')]=qs[_0x4375('0x31')](_0x195d88[_0x4375('0x41')][_0x4375('0x31')]);}_0x514495[_0x4375('0x47')]=qs[_0x4375('0x48')](_0x195d88[_0x4375('0x41')][_0x4375('0x48')]);_0x514495['where']=qs['filters'](_[_0x4375('0x4a')](_0x195d88['query'],_0x1d0a66[_0x4375('0x4b')]));_0x514495['where'][_0x4375('0xa6')]=_0x599a14['id'];if(_0x195d88['query'][_0x4375('0x7b')]){_0x514495[_0x4375('0x49')]=_['merge'](_0x514495['where'],{'$or':_['map'](_0x514495[_0x4375('0x43')],function(_0x18c5f5){var _0x5cd0d5={};_0x5cd0d5[_0x18c5f5]={'$like':'%'+_0x195d88['query'][_0x4375('0x7b')]+'%'};return _0x5cd0d5;})});}_0x514495[_0x4375('0x49')][_0x4375('0xd5')]=![];if(_0x195d88[_0x4375('0x41')]['id']){_0x514495[_0x4375('0x49')]['id']={'$gt':_0x195d88['query']['id']};}_0x514495=_['merge']({},_0x514495,_0x195d88[_0x4375('0xa9')]);return db[_0x4375('0xea')][_0x4375('0x30')]({'where':_0x514495[_0x4375('0x49')]})[_0x4375('0x22')](function(_0x1556a4){_0xe4ac9d[_0x4375('0x30')]=_0x1556a4;_0x514495[_0x4375('0xee')]=[];if(_0x195d88[_0x4375('0x41')][_0x4375('0xf2')]){_0x514495[_0x4375('0xee')][_0x4375('0x3c')]({'model':db['User'],'as':_0x4375('0xc5'),'attributes':['id','fullname',_0x4375('0xd0')]});}if(_0x195d88[_0x4375('0x41')]['includeAll']){_0x514495[_0x4375('0xee')]=[{'all':!![]}];}return db[_0x4375('0xea')][_0x4375('0xef')](_0x514495);})[_0x4375('0x22')](function(_0x3155c9){_0xe4ac9d['rows']=_0x3155c9;return _0xe4ac9d;});}})[_0x4375('0x22')](respondWithFilteredResult(_0x144648,_0x514495))[_0x4375('0x2b')](handleError(_0x144648,null));};exports[_0x4375('0xf3')]=function(_0xee17e3,_0x2b5640,_0x2eb566){return db[_0x4375('0x3d')][_0x4375('0xac')]({'where':{'id':_0xee17e3[_0x4375('0xa7')]['id']}})[_0x4375('0x22')](handleEntityNotFound(_0x2b5640,null))['then'](function(_0x42a6bc){if(_0x42a6bc){return _0x42a6bc[_0x4375('0xf4')](_0xee17e3[_0x4375('0xab')][_0x4375('0xe7')],_[_0x4375('0xe8')](_0xee17e3[_0x4375('0xab')],[_0x4375('0xe7'),'id'])||{})[_0x4375('0xf5')](function(){return db['Tag'][_0x4375('0xef')]({'attributes':['id','name',_0x4375('0x4e')],'where':{'id':_0xee17e3[_0x4375('0xab')][_0x4375('0xe7')]}});})[_0x4375('0x22')](function(_0x410b14){socket['emit'](_0x4375('0xf6'),{'id':Number(_0xee17e3[_0x4375('0xa7')]['id']),'tags':_0x410b14||[]});return{'id':Number(_0xee17e3[_0x4375('0xa7')]['id']),'tags':_0x410b14||[]};});}})['then'](respondWithResult(_0x2b5640,null))[_0x4375('0x2b')](handleError(_0x2b5640,null));};exports[_0x4375('0xf7')]=function(_0xbea1fb,_0x3b69ea,_0x2a32bc){return db[_0x4375('0x3d')]['find']({'where':{'id':_0xbea1fb[_0x4375('0xa7')]['id']}})['then'](handleEntityNotFound(_0x3b69ea,null))[_0x4375('0x22')](function(_0x45d32a){if(_0x45d32a){return _0x45d32a['removeTags'](_0xbea1fb['query'][_0x4375('0xe7')]);}})[_0x4375('0x22')](respondWithStatusCode(_0x3b69ea,null))[_0x4375('0x2b')](handleError(_0x3b69ea,null));};exports[_0x4375('0xbd')]=function(_0x54294b,_0x10d671){var _0x5e3363=moment()[_0x4375('0xf8')]()[_0x4375('0x87')]();var _0x73b098=path[_0x4375('0x88')](config['root'],_0x4375('0xf9'),_0x4375('0xfa'),_0x4375('0xfb'));var _0x44c568=path[_0x4375('0x88')](config['root'],_0x4375('0xf9'),_0x4375('0xfa'),'attachments');var _0x4629ad=path['join'](_0x73b098,_0x5e3363);var _0x5c576a=util[_0x4375('0x69')]('transcript-%d-%s.zip',_0x54294b[_0x4375('0xa7')]['id'],_0x5e3363);var _0x582551=path[_0x4375('0x88')](_0x73b098,_0x5c576a);var _0x3f22db=![];return db[_0x4375('0x3d')][_0x4375('0xac')]({'where':{'id':_0x54294b[_0x4375('0xa7')]['id']},'include':[{'model':db[_0x4375('0xea')],'as':_0x4375('0xc8'),'attributes':['id',_0x4375('0xab'),_0x4375('0x7f'),'direction',_0x4375('0xd5'),'read'],'include':[{'model':db[_0x4375('0xc5')],'as':'User','attributes':['id','fullname'],'raw':!![]},{'model':db[_0x4375('0xc7')],'as':_0x4375('0xfc'),'attributes':['id',_0x4375('0xfd'),_0x4375('0xfe')],'raw':!![]},{'model':db[_0x4375('0xbb')],'as':_0x4375('0xbb'),'raw':!![]}]},{'model':db['ChatWebsite'],'as':_0x4375('0xff'),'attributes':['id','name']},{'model':db[_0x4375('0xc5')],'as':'Owner','attributes':['id','fullname']}]})['then'](handleEntityNotFound(_0x10d671,null))[_0x4375('0x22')](function(_0x2fc1fe){if(_0x2fc1fe){var _0x30c1cd=_0x2fc1fe[_0x4375('0x100')]({'plain':!![]});_0x3f22db=!![];var _0x3c35c2={'format':'A4','border':_0x4375('0x101'),'header':{'height':_0x4375('0x102'),'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\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\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x4375('0x103'),'contents':{'default':util[_0x4375('0x69')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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[_0x4375('0x69')](_0x4375('0x104'),_0x4375('0x105'),_0x30c1cd['id']),moment()[_0x4375('0x69')](_0x4375('0x106'))[_0x4375('0x87')]())}}};fs['mkdirSync'](_0x4629ad);var _0x2732df={'channel':_0x4375('0x105'),'account':_0x30c1cd[_0x4375('0xff')][_0x4375('0x37')],'agent':_0x30c1cd[_0x4375('0x107')]?_0x30c1cd['Owner'][_0x4375('0xd1')]:_0x4375('0x108'),'createdAt':moment(_0x30c1cd[_0x4375('0x7f')])[_0x4375('0x69')](_0x4375('0xec'))[_0x4375('0x87')](),'closedAt':_0x30c1cd['closed']?moment(_0x30c1cd['closedAt'])[_0x4375('0x69')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4375('0x87')]():'','disposition':_0x30c1cd['disposition'],'chatInfo':{'browser':_0x30c1cd[_0x4375('0x109')],'os':_0x30c1cd['osName'],'referer':_0x30c1cd[_0x4375('0x10a')],'customerIp':_0x30c1cd['customerIp'],'customerPort':_0x30c1cd[_0x4375('0x10b')]?_0x30c1cd[_0x4375('0x10b')]:'N.A.'},'messages':_(_0x30c1cd[_0x4375('0xc8')])[_0x4375('0x10c')]()[_0x4375('0x7b')]({'secret':![]})[_0x4375('0x10d')](function(_0x3286c5){if(_0x3286c5[_0x4375('0xbb')]){var _0x2b704e=path[_0x4375('0x88')](_0x44c568,_0x3286c5[_0x4375('0xbb')][_0x4375('0xb7')]);if(fs['existsSync'](_0x2b704e)){fs[_0x4375('0x10e')](_0x2b704e)[_0x4375('0x10f')](fs[_0x4375('0x110')](path[_0x4375('0x88')](_0x4629ad,_0x3286c5[_0x4375('0xbb')][_0x4375('0xb7')])));}}return{'date':moment(_0x3286c5['createdAt'])['format'](_0x4375('0xec'))['toString'](),'sender':_0x3286c5[_0x4375('0xd4')]===_0x4375('0x111')?_0x3286c5['User']?_0x3286c5[_0x4375('0xc5')][_0x4375('0xd1')]:'System':_0x3286c5[_0x4375('0xfc')][_0x4375('0xfd')]+(_0x3286c5[_0x4375('0xfc')][_0x4375('0xfe')]?'\x20'+_0x3286c5[_0x4375('0xfc')][_0x4375('0xfe')]:''),'body':_0x3286c5['Attachment']?_0x3286c5[_0x4375('0xbb')][_0x4375('0xb7')]:_0x3286c5['body'],'direction':_0x3286c5['direction']===_0x4375('0x111')?'A':'C','secret':_0x3286c5[_0x4375('0xd5')],'read':_0x3286c5[_0x4375('0x8f')],'attachment':_0x3286c5['Attachment']};})[_0x4375('0x64')]()};return ejs[_0x4375('0x112')](path['join'](config['root'],_0x4375('0xf9'),_0x4375('0x113'),_0x4375('0x114')),{'interaction':_0x2732df})[_0x4375('0x22')](function(_0x2ae895){return new BPromise(function(_0x4e9b83,_0x1bab3d){pdf[_0x4375('0xaa')](_0x2ae895,_0x3c35c2)[_0x4375('0x115')](path[_0x4375('0x88')](_0x4629ad,_0x4375('0x116')+_0x30c1cd['id']+'-'+_0x5e3363+_0x4375('0x117')),function(_0x298e88,_0x302506){if(_0x298e88)return _0x1bab3d(_0x298e88);_0x4e9b83(_0x302506);});});});}})[_0x4375('0x22')](function(){if(_0x3f22db){return new BPromise(function(_0x1d86ab,_0x215cb4){zipdir(_0x4629ad,{'saveTo':_0x582551},function(_0x91ae13,_0x29fa07){if(_0x91ae13)return _0x215cb4(_0x91ae13);return _0x1d86ab(_0x29fa07);});})[_0x4375('0x22')](function(){return new BPromise(function(_0x13b95a,_0x5cebd1){rimraf(_0x4629ad,function(_0x2660aa){if(_0x2660aa)_0x5cebd1(_0x2660aa);return _0x13b95a();});});})[_0x4375('0x22')](function(){return _0x10d671[_0x4375('0xbd')](_0x582551,_0x5c576a,function(_0xceac2b){if(_0xceac2b){console[_0x4375('0x118')]('err',_0xceac2b);}else{fs[_0x4375('0x119')](_0x582551);}});});}else{return _0x10d671[_0x4375('0x2c')](0xc8);}})['catch'](handleError(_0x10d671,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 534cdea..8b4421e 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 _0x6114=['ChatMessage','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction'];(function(_0x4014c8,_0x38efb6){var _0x194847=function(_0x83288a){while(--_0x83288a){_0x4014c8['push'](_0x4014c8['shift']());}};_0x194847(++_0x38efb6);}(_0x6114,0x6d));var _0x4611=function(_0x4c6b93,_0x19880d){_0x4c6b93=_0x4c6b93-0x0;var _0x119770=_0x6114[_0x4c6b93];return _0x119770;};'use strict';var EventEmitter=require(_0x4611('0x0'));var ChatInteraction=require(_0x4611('0x1'))['db'][_0x4611('0x2')];var ChatMessage=require(_0x4611('0x1'))['db'][_0x4611('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4611('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38cbde){return function(_0x30b241,_0x1d5658,_0x5382da){_0x30b241[_0x4611('0x5')]({'attributes':['id'],'raw':!![]})[_0x4611('0x6')](function(_0x5724c2){_0x30b241[_0x4611('0x7')](_0x4611('0x8'),_0x5724c2[_0x4611('0x9')](function(_0x29891b){return{'id':_0x29891b['id']};}));return ChatMessage[_0x4611('0xa')]({'where':{'ChatInteractionId':_0x30b241['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4611('0x6')](function(_0x427587){_0x30b241[_0x4611('0x7')](_0x4611('0xb'),_0x427587['length']);ChatInteractionEvents['emit'](_0x38cbde+':'+_0x30b241['id'],_0x30b241);ChatInteractionEvents['emit'](_0x38cbde,_0x30b241);_0x5382da(null);})[_0x4611('0xc')](_0x5382da(null));};}for(var e in events){if(events[_0x4611('0xd')](e)){var event=events[e];ChatInteraction[_0x4611('0xe')](e,emitEvent(event));}}module[_0x4611('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x6da4=['emit','catch','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','length'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x6da4,0x132));var _0x46da=function(_0xcc5983,_0x13440c){_0xcc5983=_0xcc5983-0x0;var _0x575745=_0x6da4[_0xcc5983];return _0x575745;};'use strict';var EventEmitter=require(_0x46da('0x0'));var ChatInteraction=require(_0x46da('0x1'))['db'][_0x46da('0x2')];var ChatMessage=require(_0x46da('0x1'))['db'][_0x46da('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46da('0x4'),'afterUpdate':_0x46da('0x5'),'afterDestroy':_0x46da('0x6')};function emitEvent(_0x37bd5e){return function(_0x5c39b9,_0x234267,_0x8c39f5){_0x5c39b9[_0x46da('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x36bbd4){_0x5c39b9[_0x46da('0x8')](_0x46da('0x9'),_0x36bbd4['map'](function(_0x4ca140){return{'id':_0x4ca140['id']};}));return ChatMessage[_0x46da('0xa')]({'where':{'ChatInteractionId':_0x5c39b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x46da('0xb')](function(_0x1eadae){_0x5c39b9['setDataValue'](_0x46da('0xc'),_0x1eadae[_0x46da('0xd')]);ChatInteractionEvents['emit'](_0x37bd5e+':'+_0x5c39b9['id'],_0x5c39b9);ChatInteractionEvents[_0x46da('0xe')](_0x37bd5e,_0x5c39b9);_0x8c39f5(null);})[_0x46da('0xf')](_0x8c39f5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](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 0b9be9b..69586a3 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 _0x8d23=['ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d23,0xc6));var _0x38d2=function(_0x32f7eb,_0xbcd9f){_0x32f7eb=_0x32f7eb-0x0;var _0x7fe938=_0x8d23[_0x32f7eb];return _0x7fe938;};'use strict';var _=require(_0x38d2('0x0'));var util=require(_0x38d2('0x1'));var logger=require(_0x38d2('0x2'))(_0x38d2('0x3'));var moment=require(_0x38d2('0x4'));var BPromise=require(_0x38d2('0x5'));var rp=require(_0x38d2('0x6'));var fs=require('fs');var path=require(_0x38d2('0x7'));var rimraf=require(_0x38d2('0x8'));var config=require(_0x38d2('0x9'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x3bae32,_0x485ee0){return _0x3bae32[_0x38d2('0xa')](_0x38d2('0xb'),attributes,{'tableName':_0x38d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c28fe,_0x191832,_0x1e7c82){if(_0x5c28fe['changed'](_0x38d2('0xd'))){_0x5c28fe[_0x38d2('0xe')]=moment()[_0x38d2('0xf')](_0x38d2('0x10'));}_0x1e7c82(null,_0x5c28fe);}},'charset':_0x38d2('0x11'),'collate':_0x38d2('0x12')});}; \ No newline at end of file +var _0x297f=['exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x297f,0xdb));var _0xf297=function(_0x4e7aba,_0x1fd2f4){_0x4e7aba=_0x4e7aba-0x0;var _0x9d7489=_0x297f[_0x4e7aba];return _0x9d7489;};'use strict';var _=require(_0xf297('0x0'));var util=require(_0xf297('0x1'));var logger=require('../../config/logger')(_0xf297('0x2'));var moment=require('moment');var BPromise=require(_0xf297('0x3'));var rp=require(_0xf297('0x4'));var fs=require('fs');var path=require(_0xf297('0x5'));var rimraf=require(_0xf297('0x6'));var config=require(_0xf297('0x7'));var attributes=require(_0xf297('0x8'));module[_0xf297('0x9')]=function(_0x1ac68d,_0xeadf51){return _0x1ac68d[_0xf297('0xa')](_0xf297('0xb'),attributes,{'tableName':_0xf297('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3dd641,_0x183bdf,_0x532108){if(_0x3dd641[_0xf297('0xd')](_0xf297('0xe'))){_0x3dd641[_0xf297('0xf')]=moment()['format'](_0xf297('0x10'));}_0x532108(null,_0x3dd641);}},'charset':_0xf297('0x11'),'collate':_0xf297('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index a32880d..ce1da48 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 _0xa6c3=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ChatInteraction','options','where','limit','UpdateChatInteraction','AddTagsToChatInteraction','addTags','body','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis'];(function(_0x26475e,_0xe34ebb){var _0x44d0dc=function(_0x170925){while(--_0x170925){_0x26475e['push'](_0x26475e['shift']());}};_0x44d0dc(++_0xe34ebb);}(_0xa6c3,0x16d));var _0x3a6c=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xa6c3[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x3a6c('0x0'));var util=require(_0x3a6c('0x1'));var moment=require('moment');var BPromise=require(_0x3a6c('0x2'));var rs=require(_0x3a6c('0x3'));var fs=require('fs');var Redis=require(_0x3a6c('0x4'));var db=require(_0x3a6c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a6c('0x6'))(_0x3a6c('0x7'));var config=require(_0x3a6c('0x8'));var jayson=require(_0x3a6c('0x9'));var client=jayson[_0x3a6c('0xa')][_0x3a6c('0xb')]({'port':0x232a});config[_0x3a6c('0xc')]=_[_0x3a6c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3a6c('0xe'))(new Redis(config[_0x3a6c('0xc')]));require(_0x3a6c('0xf'))['register'](socket);function respondWithRpcPromise(_0x43dfd9,_0x482e62,_0xf78592){return new BPromise(function(_0x53e9d1,_0x1ab7ad){return client['request'](_0x43dfd9,_0xf78592)[_0x3a6c('0x10')](function(_0xc75d20){logger[_0x3a6c('0x11')](_0x3a6c('0x12'),_0x482e62,_0x3a6c('0x13'));logger[_0x3a6c('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x482e62,'request\x20sent',JSON[_0x3a6c('0x15')](_0xc75d20));if(_0xc75d20[_0x3a6c('0x16')]){if(_0xc75d20[_0x3a6c('0x16')][_0x3a6c('0x17')]===0x1f4){logger['error'](_0x3a6c('0x12'),_0x482e62,_0xc75d20[_0x3a6c('0x16')][_0x3a6c('0x18')]);return _0x1ab7ad(_0xc75d20[_0x3a6c('0x16')]['message']);}logger[_0x3a6c('0x16')](_0x3a6c('0x12'),_0x482e62,_0xc75d20[_0x3a6c('0x16')][_0x3a6c('0x18')]);return _0x53e9d1(_0xc75d20[_0x3a6c('0x16')][_0x3a6c('0x18')]);}else{logger['info'](_0x3a6c('0x12'),_0x482e62,'request\x20sent');_0x53e9d1(_0xc75d20['result'][_0x3a6c('0x18')]);}})[_0x3a6c('0x19')](function(_0x538fdb){logger[_0x3a6c('0x16')](_0x3a6c('0x12'),_0x482e62,_0x538fdb);_0x1ab7ad(_0x538fdb);});});}exports['UpdateChatInteraction']=function(_0x555d83){var _0x29d962=this;return new Promise(function(_0x21e489,_0x350511){return db[_0x3a6c('0x1a')]['update'](_0x555d83['body'],{'raw':_0x555d83['options']?_0x555d83[_0x3a6c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555d83[_0x3a6c('0x1b')]?_0x555d83[_0x3a6c('0x1b')][_0x3a6c('0x1c')]||null:null,'attributes':_0x555d83[_0x3a6c('0x1b')]?_0x555d83[_0x3a6c('0x1b')]['attributes']||null:null,'limit':_0x555d83[_0x3a6c('0x1b')]?_0x555d83[_0x3a6c('0x1b')][_0x3a6c('0x1d')]||null:null})[_0x3a6c('0x10')](function(_0x26482d){logger[_0x3a6c('0x11')]('UpdateChatInteraction',_0x555d83);logger[_0x3a6c('0x14')](_0x3a6c('0x1e'),_0x555d83,JSON[_0x3a6c('0x15')](_0x26482d));_0x21e489(_0x26482d);})[_0x3a6c('0x19')](function(_0x4200cf){logger[_0x3a6c('0x16')]('UpdateChatInteraction',_0x4200cf['message'],_0x555d83);_0x350511(_0x29d962[_0x3a6c('0x16')](0x1f4,_0x4200cf[_0x3a6c('0x18')]));});});};exports[_0x3a6c('0x1f')]=function(_0x1cf766){return new Promise(function(_0x3acc74,_0x27644e){return db[_0x3a6c('0x1a')]['find']({'where':_0x1cf766[_0x3a6c('0x1b')]?_0x1cf766[_0x3a6c('0x1b')][_0x3a6c('0x1c')]||null:null})[_0x3a6c('0x10')](function(_0x327244){if(_0x327244){return _0x327244[_0x3a6c('0x20')](_0x1cf766[_0x3a6c('0x21')][_0x3a6c('0x22')],_[_0x3a6c('0x23')](_0x1cf766['body'],[_0x3a6c('0x22'),'id'])||{});}})['spread'](function(_0x346801){logger[_0x3a6c('0x11')](_0x3a6c('0x24'),_0x1cf766);logger[_0x3a6c('0x14')]('AddTags',_0x1cf766,JSON['stringify'](_0x346801));_0x3acc74(_0x346801);})[_0x3a6c('0x19')](function(_0x231a4b){logger[_0x3a6c('0x16')](_0x3a6c('0x24'),_0x231a4b[_0x3a6c('0x18')],_0x1cf766);_0x27644e(_this[_0x3a6c('0x16')](0x1f4,_0x231a4b['message']));});});}; \ No newline at end of file +var _0x0c87=['then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ChatInteraction','update','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x42ace3,_0x3c99d1){var _0x526bc9=function(_0x573823){while(--_0x573823){_0x42ace3['push'](_0x42ace3['shift']());}};_0x526bc9(++_0x3c99d1);}(_0x0c87,0x1b0));var _0x70c8=function(_0x5db51a,_0x436f97){_0x5db51a=_0x5db51a-0x0;var _0x4e1d6d=_0x0c87[_0x5db51a];return _0x4e1d6d;};'use strict';var _=require(_0x70c8('0x0'));var util=require(_0x70c8('0x1'));var moment=require(_0x70c8('0x2'));var BPromise=require(_0x70c8('0x3'));var rs=require(_0x70c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70c8('0x5'))['db'];var utils=require(_0x70c8('0x6'));var logger=require(_0x70c8('0x7'))(_0x70c8('0x8'));var config=require(_0x70c8('0x9'));var jayson=require(_0x70c8('0xa'));var client=jayson['client'][_0x70c8('0xb')]({'port':0x232a});config[_0x70c8('0xc')]=_['defaults'](config[_0x70c8('0xc')],{'host':_0x70c8('0xd'),'port':0x18eb});var socket=require(_0x70c8('0xe'))(new Redis(config[_0x70c8('0xc')]));require(_0x70c8('0xf'))[_0x70c8('0x10')](socket);function respondWithRpcPromise(_0xa91d15,_0x14ed72,_0x41f543){return new BPromise(function(_0x1fd742,_0x2128d1){return client[_0x70c8('0x11')](_0xa91d15,_0x41f543)[_0x70c8('0x12')](function(_0x4ce604){logger['info'](_0x70c8('0x13'),_0x14ed72,_0x70c8('0x14'));logger[_0x70c8('0x15')](_0x70c8('0x16'),_0x14ed72,_0x70c8('0x14'),JSON['stringify'](_0x4ce604));if(_0x4ce604[_0x70c8('0x17')]){if(_0x4ce604[_0x70c8('0x17')][_0x70c8('0x18')]===0x1f4){logger[_0x70c8('0x17')](_0x70c8('0x13'),_0x14ed72,_0x4ce604[_0x70c8('0x17')][_0x70c8('0x19')]);return _0x2128d1(_0x4ce604[_0x70c8('0x17')][_0x70c8('0x19')]);}logger[_0x70c8('0x17')](_0x70c8('0x13'),_0x14ed72,_0x4ce604[_0x70c8('0x17')]['message']);return _0x1fd742(_0x4ce604['error'][_0x70c8('0x19')]);}else{logger[_0x70c8('0x1a')](_0x70c8('0x13'),_0x14ed72,_0x70c8('0x14'));_0x1fd742(_0x4ce604[_0x70c8('0x1b')]['message']);}})[_0x70c8('0x1c')](function(_0x2d6614){logger['error'](_0x70c8('0x13'),_0x14ed72,_0x2d6614);_0x2128d1(_0x2d6614);});});}exports['UpdateChatInteraction']=function(_0x3ff668){var _0x48d3ca=this;return new Promise(function(_0x9f7ff6,_0x915153){return db[_0x70c8('0x1d')][_0x70c8('0x1e')](_0x3ff668['body'],{'raw':_0x3ff668[_0x70c8('0x1f')]?_0x3ff668[_0x70c8('0x1f')][_0x70c8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff668[_0x70c8('0x1f')]?_0x3ff668['options'][_0x70c8('0x21')]||null:null,'attributes':_0x3ff668['options']?_0x3ff668[_0x70c8('0x1f')][_0x70c8('0x22')]||null:null,'limit':_0x3ff668[_0x70c8('0x1f')]?_0x3ff668[_0x70c8('0x1f')][_0x70c8('0x23')]||null:null})['then'](function(_0x3b4dbf){logger['info'](_0x70c8('0x24'),_0x3ff668);logger[_0x70c8('0x15')]('UpdateChatInteraction',_0x3ff668,JSON[_0x70c8('0x25')](_0x3b4dbf));_0x9f7ff6(_0x3b4dbf);})[_0x70c8('0x1c')](function(_0x2fc3ef){logger['error']('UpdateChatInteraction',_0x2fc3ef[_0x70c8('0x19')],_0x3ff668);_0x915153(_0x48d3ca[_0x70c8('0x17')](0x1f4,_0x2fc3ef[_0x70c8('0x19')]));});});};exports[_0x70c8('0x26')]=function(_0x18780e){return new Promise(function(_0x44a98f,_0x3b75ea){return db[_0x70c8('0x1d')]['find']({'where':_0x18780e[_0x70c8('0x1f')]?_0x18780e[_0x70c8('0x1f')][_0x70c8('0x21')]||null:null})[_0x70c8('0x12')](function(_0x423a12){if(_0x423a12){return _0x423a12[_0x70c8('0x27')](_0x18780e[_0x70c8('0x28')][_0x70c8('0x29')],_[_0x70c8('0x2a')](_0x18780e['body'],[_0x70c8('0x29'),'id'])||{});}})[_0x70c8('0x2b')](function(_0x2d3805){logger[_0x70c8('0x1a')](_0x70c8('0x2c'),_0x18780e);logger['debug'](_0x70c8('0x2c'),_0x18780e,JSON[_0x70c8('0x25')](_0x2d3805));_0x44a98f(_0x2d3805);})[_0x70c8('0x1c')](function(_0x15b70b){logger['error'](_0x70c8('0x2c'),_0x15b70b[_0x70c8('0x19')],_0x18780e);_0x3b75ea(_this[_0x70c8('0x17')](0x1f4,_0x15b70b[_0x70c8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c47df5b..c0ef6ea 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 _0x782e=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','emit'];(function(_0x3ab164,_0x2fa5e9){var _0x39565e=function(_0x40dfe8){while(--_0x40dfe8){_0x3ab164['push'](_0x3ab164['shift']());}};_0x39565e(++_0x2fa5e9);}(_0x782e,0x1d4));var _0xe782=function(_0x7ab300,_0x1df3aa){_0x7ab300=_0x7ab300-0x0;var _0x4f6b3b=_0x782e[_0x7ab300];return _0x4f6b3b;};'use strict';var ChatInteractionEvents=require(_0xe782('0x0'));var events=[_0xe782('0x1'),_0xe782('0x2'),'update'];function createListener(_0x500c71,_0x38802e){return function(_0x13e20d){_0x38802e[_0xe782('0x3')](_0x500c71,_0x13e20d);};}function removeListener(_0x35540c,_0x357e69){return function(){ChatInteractionEvents[_0xe782('0x4')](_0x35540c,_0x357e69);};}exports[_0xe782('0x5')]=function(_0x2183d8){for(var _0x2f9f5d=0x0,_0x286374=events[_0xe782('0x6')];_0x2f9f5d<_0x286374;_0x2f9f5d++){var _0x831385=events[_0x2f9f5d];var _0x383667=createListener(_0xe782('0x7')+_0x831385,_0x2183d8);ChatInteractionEvents['on'](_0x831385,_0x383667);}}; \ No newline at end of file +var _0xe16d=['chatInteraction:','./chatInteraction.events','save','emit','removeListener','register'];(function(_0x8c5e19,_0x2db917){var _0xca6fbf=function(_0x3ac821){while(--_0x3ac821){_0x8c5e19['push'](_0x8c5e19['shift']());}};_0xca6fbf(++_0x2db917);}(_0xe16d,0x169));var _0xde16=function(_0xeef46,_0x5deed3){_0xeef46=_0xeef46-0x0;var _0x34d10d=_0xe16d[_0xeef46];return _0x34d10d;};'use strict';var ChatInteractionEvents=require(_0xde16('0x0'));var events=[_0xde16('0x1'),'remove','update'];function createListener(_0x36183f,_0x4c114d){return function(_0x5cba7d){_0x4c114d[_0xde16('0x2')](_0x36183f,_0x5cba7d);};}function removeListener(_0x5bebe1,_0x37aef0){return function(){ChatInteractionEvents[_0xde16('0x3')](_0x5bebe1,_0x37aef0);};}exports[_0xde16('0x4')]=function(_0x2c3642){for(var _0x463a3e=0x0,_0x50080f=events['length'];_0x463a3e<_0x50080f;_0x463a3e++){var _0x3a7edc=events[_0x463a3e];var _0x44ae8e=createListener(_0xde16('0x5')+_0x3a7edc,_0x2c3642);ChatInteractionEvents['on'](_0x3a7edc,_0x44ae8e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index dbd4f8a..9fb58b7 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 _0x0a28=['/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','get','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','create','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','post','/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chat','addTags','put','/:id','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatInteraction.controller','isAuthenticated','index'];(function(_0x5bfa42,_0x46ec12){var _0x5b1a31=function(_0x2e1e7e){while(--_0x2e1e7e){_0x5bfa42['push'](_0x5bfa42['shift']());}};_0x5b1a31(++_0x46ec12);}(_0x0a28,0x18e));var _0x80a2=function(_0x57187b,_0x166237){_0x57187b=_0x57187b-0x0;var _0x42eef8=_0x0a28[_0x57187b];return _0x42eef8;};'use strict';var multer=require(_0x80a2('0x0'));var util=require(_0x80a2('0x1'));var path=require(_0x80a2('0x2'));var timeout=require(_0x80a2('0x3'));var express=require(_0x80a2('0x4'));var router=express[_0x80a2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x80a2('0x6'));var controller=require(_0x80a2('0x7'));router['get']('/',auth[_0x80a2('0x8')](),controller[_0x80a2('0x9')]);router['get'](_0x80a2('0xa'),auth['isAuthenticated'](),controller[_0x80a2('0xb')]);router['get']('/:id',auth[_0x80a2('0xc')](),controller[_0x80a2('0xd')]);router['get'](_0x80a2('0xe'),auth[_0x80a2('0xc')](),controller[_0x80a2('0xf')]);router[_0x80a2('0x10')](_0x80a2('0x11'),auth[_0x80a2('0x8')](),controller[_0x80a2('0x12')]);router[_0x80a2('0x10')](_0x80a2('0x13'),auth[_0x80a2('0xc')](),controller[_0x80a2('0x14')]);router['get']('/:id/download',auth[_0x80a2('0x8')](),controller[_0x80a2('0x15')]);router['post']('/',auth[_0x80a2('0x8')](),controller[_0x80a2('0x16')]);var upload=multer({'storage':multer[_0x80a2('0x17')]({'destination':function(_0x2b05ac,_0x4e0a96,_0x12a277){_0x12a277(null,path['join'](config[_0x80a2('0x18')],_0x80a2('0x19')));},'filename':function(_0x20ea40,_0x33ffb2,_0x8fe67c){_0x8fe67c(null,util[_0x80a2('0x1a')](_0x80a2('0x1b'),Date[_0x80a2('0x1c')](),_0x33ffb2[_0x80a2('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x80a2('0x1e')](_0x80a2('0x1f'),upload['single'](_0x80a2('0x20')),controller[_0x80a2('0x21')]);router[_0x80a2('0x1e')]('/:id/messages',auth[_0x80a2('0xc')](),controller['addMessage']);router[_0x80a2('0x1e')](_0x80a2('0x22'),auth[_0x80a2('0x8')](),interaction[_0x80a2('0x23')](_0x80a2('0x24'),'chatinteraction:addtags'),controller[_0x80a2('0x25')]);router[_0x80a2('0x26')](_0x80a2('0x27'),auth['isAuthenticated'](),interaction[_0x80a2('0x23')]('chat','chatinteraction:update'),controller[_0x80a2('0x28')]);router[_0x80a2('0x26')](_0x80a2('0x29'),controller[_0x80a2('0x2a')]);router[_0x80a2('0x26')](_0x80a2('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x80a2('0x2c')]);router['put'](_0x80a2('0x2d'),controller[_0x80a2('0x2e')]);router[_0x80a2('0x2f')](_0x80a2('0x27'),auth[_0x80a2('0x8')](),interaction[_0x80a2('0x23')](_0x80a2('0x24'),_0x80a2('0x30')),controller[_0x80a2('0x31')]);router[_0x80a2('0x2f')](_0x80a2('0x22'),auth[_0x80a2('0x8')](),controller['removeTags']);module[_0x80a2('0x32')]=router; \ No newline at end of file +var _0x5dbe=['/:id/messages','/:id/my_messages','getMyMessages','download','post','create','diskStorage','join','root','server/files/attachments/','format','%s-%s','replace','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','update','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0x5dbe,0x160));var _0xe5db=function(_0x272d97,_0x3cb745){_0x272d97=_0x272d97-0x0;var _0x40fc01=_0x5dbe[_0x272d97];return _0x40fc01;};'use strict';var multer=require('multer');var util=require(_0xe5db('0x0'));var path=require('path');var timeout=require(_0xe5db('0x1'));var express=require(_0xe5db('0x2'));var router=express['Router']();var auth=require(_0xe5db('0x3'));var interaction=require(_0xe5db('0x4'));var config=require('../../config/environment');var controller=require(_0xe5db('0x5'));router['get']('/',auth[_0xe5db('0x6')](),controller[_0xe5db('0x7')]);router['get'](_0xe5db('0x8'),auth[_0xe5db('0x6')](),controller[_0xe5db('0x9')]);router[_0xe5db('0xa')](_0xe5db('0xb'),auth[_0xe5db('0xc')](),controller[_0xe5db('0xd')]);router[_0xe5db('0xa')](_0xe5db('0xe'),auth[_0xe5db('0xc')](),controller[_0xe5db('0xf')]);router[_0xe5db('0xa')](_0xe5db('0x10'),auth[_0xe5db('0x6')](),controller['getMessages']);router[_0xe5db('0xa')](_0xe5db('0x11'),auth[_0xe5db('0xc')](),controller[_0xe5db('0x12')]);router[_0xe5db('0xa')]('/:id/download',auth[_0xe5db('0x6')](),controller[_0xe5db('0x13')]);router[_0xe5db('0x14')]('/',auth[_0xe5db('0x6')](),controller[_0xe5db('0x15')]);var upload=multer({'storage':multer[_0xe5db('0x16')]({'destination':function(_0x1f0095,_0x3d2fbd,_0x5b08a6){_0x5b08a6(null,path[_0xe5db('0x17')](config[_0xe5db('0x18')],_0xe5db('0x19')));},'filename':function(_0x3352b9,_0x301523,_0xcaec86){_0xcaec86(null,util[_0xe5db('0x1a')](_0xe5db('0x1b'),Date['now'](),_0x301523['originalname'][_0xe5db('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xe5db('0x1d')]('file'),controller[_0xe5db('0x1e')]);router[_0xe5db('0x14')](_0xe5db('0x10'),auth[_0xe5db('0xc')](),controller[_0xe5db('0x1f')]);router['post'](_0xe5db('0x20'),auth[_0xe5db('0x6')](),interaction[_0xe5db('0x21')](_0xe5db('0x22'),'chatinteraction:addtags'),controller[_0xe5db('0x23')]);router[_0xe5db('0x24')]('/:id',auth[_0xe5db('0x6')](),interaction['tracked'](_0xe5db('0x22'),'chatinteraction:update'),controller[_0xe5db('0x25')]);router[_0xe5db('0x24')]('/:id/custom_update',controller['customUpdate']);router[_0xe5db('0x24')](_0xe5db('0x26'),auth[_0xe5db('0xc')](),controller['abandon']);router['put'](_0xe5db('0x27'),controller[_0xe5db('0x28')]);router[_0xe5db('0x29')](_0xe5db('0xb'),auth['isAuthenticated'](),interaction[_0xe5db('0x21')](_0xe5db('0x22'),_0xe5db('0x2a')),controller[_0xe5db('0x2b')]);router['delete'](_0xe5db('0x20'),auth[_0xe5db('0x6')](),controller[_0xe5db('0x2c')]);module[_0xe5db('0x2d')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e662c88..de2328c 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 _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x1a85,0x178));var _0x51a8=function(_0x5e13fe,_0x339218){_0x5e13fe=_0x5e13fe-0x0;var _0x26f143=_0x1a85[_0x5e13fe];return _0x26f143;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0xfe00c0,_0x21dbc7){var _0x536fb5=function(_0x4711b7){while(--_0x4711b7){_0xfe00c0['push'](_0xfe00c0['shift']());}};_0x536fb5(++_0x21dbc7);}(_0xda2d,0x102));var _0xdda2=function(_0x33687b,_0x275b0e){_0x33687b=_0x33687b-0x0;var _0xe999df=_0xda2d[_0x33687b];return _0xe999df;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'body':{'type':Sequelize[_0xdda2('0x1')](_0xdda2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdda2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 863a45f..ed0cdc5 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 _0xb13e=['keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','type','field','options','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','user','fullname','role','online','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','isEmpty','agent','resourceId','push','messages','FromId','ToId','read','-createdAt','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','stack','name','send','ChatInternalMessage','model'];(function(_0x7aaac8,_0x3a4233){var _0x4a8013=function(_0x45cf4e){while(--_0x45cf4e){_0x7aaac8['push'](_0x7aaac8['shift']());}};_0x4a8013(++_0x3a4233);}(_0xb13e,0x97));var _0xeb13=function(_0x52c80b,_0x1cc9ea){_0x52c80b=_0x52c80b-0x0;var _0x2907a9=_0xb13e[_0x52c80b];return _0x2907a9;};'use strict';var pdf=require(_0xeb13('0x0'));var emlformat=require(_0xeb13('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb13('0x3'));var moment=require(_0xeb13('0x4'));var BPromise=require(_0xeb13('0x5'));var Mustache=require(_0xeb13('0x6'));var util=require(_0xeb13('0x7'));var path=require('path');var sox=require(_0xeb13('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xeb13('0x9'));var squel=require(_0xeb13('0xa'));var crypto=require(_0xeb13('0xb'));var jsforce=require(_0xeb13('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeb13('0xd'));var Redis=require(_0xeb13('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xeb13('0xf'));var hardwareService=require(_0xeb13('0x10'));var logger=require(_0xeb13('0x11'))('api');var utils=require(_0xeb13('0x12'));var config=require(_0xeb13('0x13'));var db=require('../../mysqldb')['db'];config[_0xeb13('0x14')]=_[_0xeb13('0x15')](config[_0xeb13('0x14')],{'host':_0xeb13('0x16'),'port':0x18eb});var socket=require(_0xeb13('0x17'))(new Redis(config[_0xeb13('0x14')]));require('./chatInternalMessage.socket')[_0xeb13('0x18')](socket);function respondWithStatusCode(_0x3720c0,_0x26e3c1){_0x26e3c1=_0x26e3c1||0xcc;return function(_0x26c2fe){if(_0x26c2fe){return _0x3720c0[_0xeb13('0x19')](_0x26e3c1);}return _0x3720c0['status'](_0x26e3c1)['end']();};}function respondWithResult(_0x2f63db,_0x13da6b){_0x13da6b=_0x13da6b||0xc8;return function(_0xb9c956){if(_0xb9c956){return _0x2f63db[_0xeb13('0x1a')](_0x13da6b)[_0xeb13('0x1b')](_0xb9c956);}};}function respondWithFilteredResult(_0x26bede,_0x408524){return function(_0x36c3b3){if(_0x36c3b3){var _0xa5ef60=_0x36c3b3[_0xeb13('0x1c')],_0x380737=_0x408524[_0xeb13('0x1d')],_0x31f9be=_0x408524['offset']+_0x408524['limit'],_0x32d583;if(_0x31f9be>=_0xa5ef60){_0x31f9be=_0xa5ef60;_0x32d583=0xc8;}else{_0x32d583=0xce;}_0x26bede[_0xeb13('0x1a')](_0x32d583);return _0x26bede[_0xeb13('0x1e')]('Content-Range',_0x380737+'-'+_0x31f9be+'/'+_0xa5ef60)[_0xeb13('0x1b')](_0x36c3b3);}return null;};}function patchUpdates(_0x30b0bc){return function(_0x2f8a70){try{jsonpatch[_0xeb13('0x1f')](_0x2f8a70,_0x30b0bc,!![]);}catch(_0x417092){return BPromise[_0xeb13('0x20')](_0x417092);}return _0x2f8a70[_0xeb13('0x21')]();};}function saveUpdates(_0x5128f9,_0x2b5296){return function(_0x1c1f29){if(_0x1c1f29){return _0x1c1f29[_0xeb13('0x22')](_0x5128f9)[_0xeb13('0x23')](function(_0x50ec62){return _0x50ec62;});}return null;};}function removeEntity(_0xac1f7b,_0x2a38f3){return function(_0x4b3bab){if(_0x4b3bab){return _0x4b3bab['destroy']()[_0xeb13('0x23')](function(){_0xac1f7b[_0xeb13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58fb9a,_0x4868e2){return function(_0x4d28f3){if(!_0x4d28f3){_0x58fb9a[_0xeb13('0x19')](0x194);}return _0x4d28f3;};}function handleError(_0x26aa6a,_0x4b289f){_0x4b289f=_0x4b289f||0x1f4;return function(_0x1e72cd){logger['error'](_0x1e72cd[_0xeb13('0x24')]);if(_0x1e72cd[_0xeb13('0x25')]){delete _0x1e72cd[_0xeb13('0x25')];}_0x26aa6a[_0xeb13('0x1a')](_0x4b289f)[_0xeb13('0x26')](_0x1e72cd);};}exports['index']=function(_0x14e19b,_0x5d6c74){var _0xfd99c1={},_0x35da46={},_0x3c918d={'count':0x0,'rows':[]};var _0x201506=db[_0xeb13('0x27')]['rawAttributes'];_0x35da46[_0xeb13('0x28')]=_[_0xeb13('0x29')](_0x201506);_0x35da46[_0xeb13('0x2a')]=_[_0xeb13('0x29')](_0x14e19b[_0xeb13('0x2a')]);_0x35da46[_0xeb13('0x2b')]=_[_0xeb13('0x2c')](_0x35da46[_0xeb13('0x28')],_0x35da46[_0xeb13('0x2a')]);_0xfd99c1[_0xeb13('0x2d')]=_[_0xeb13('0x2c')](_0x35da46[_0xeb13('0x28')],qs[_0xeb13('0x2e')](_0x14e19b['query'][_0xeb13('0x2e')]));_0xfd99c1[_0xeb13('0x2d')]=_0xfd99c1[_0xeb13('0x2d')][_0xeb13('0x2f')]?_0xfd99c1[_0xeb13('0x2d')]:_0x35da46[_0xeb13('0x28')];if(!_0x14e19b[_0xeb13('0x2a')]['hasOwnProperty'](_0xeb13('0x30'))){_0xfd99c1['limit']=qs['limit'](_0x14e19b[_0xeb13('0x2a')]['limit']);_0xfd99c1[_0xeb13('0x1d')]=qs[_0xeb13('0x1d')](_0x14e19b[_0xeb13('0x2a')][_0xeb13('0x1d')]);}_0xfd99c1[_0xeb13('0x31')]=qs[_0xeb13('0x32')](_0x14e19b[_0xeb13('0x2a')][_0xeb13('0x32')]);_0xfd99c1[_0xeb13('0x33')]=qs[_0xeb13('0x2b')](_['pick'](_0x14e19b['query'],_0x35da46['filters']));if(_0x14e19b[_0xeb13('0x2a')][_0xeb13('0x34')]){_0xfd99c1[_0xeb13('0x33')]=_[_0xeb13('0x35')](_0xfd99c1[_0xeb13('0x33')],{'$or':_[_0xeb13('0x36')](_0x201506,function(_0x37d501){if(_0x37d501[_0xeb13('0x37')]['key']!=='VIRTUAL'){var _0x501173={};_0x501173[_0x37d501[_0xeb13('0x38')]]={'$like':'%'+_0x14e19b['query'][_0xeb13('0x34')]+'%'};return _0x501173;}})});}_0xfd99c1=_[_0xeb13('0x35')]({},_0xfd99c1,_0x14e19b[_0xeb13('0x39')]);var _0x1f435f={'where':_0xfd99c1[_0xeb13('0x33')]};return db[_0xeb13('0x27')]['count'](_0x1f435f)['then'](function(_0x41a429){_0x3c918d['count']=_0x41a429;if(_0x14e19b['query']['includeAll']){_0xfd99c1[_0xeb13('0x3a')]=[{'all':!![]}];}return db[_0xeb13('0x27')][_0xeb13('0x3b')](_0xfd99c1);})[_0xeb13('0x23')](function(_0x5ecadd){_0x3c918d[_0xeb13('0x3c')]=_0x5ecadd;return _0x3c918d;})[_0xeb13('0x23')](respondWithFilteredResult(_0x5d6c74,_0xfd99c1))[_0xeb13('0x3d')](handleError(_0x5d6c74,null));};exports[_0xeb13('0x3e')]=function(_0x5d0e33,_0x5efc07){var _0x32de13={'raw':!![],'where':{'id':_0x5d0e33[_0xeb13('0x3f')]['id']}},_0x3705ca={};_0x3705ca[_0xeb13('0x28')]=_['keys'](db[_0xeb13('0x27')][_0xeb13('0x40')]);_0x3705ca[_0xeb13('0x2a')]=_[_0xeb13('0x29')](_0x5d0e33[_0xeb13('0x2a')]);_0x3705ca[_0xeb13('0x2b')]=_['intersection'](_0x3705ca[_0xeb13('0x28')],_0x3705ca[_0xeb13('0x2a')]);_0x32de13['attributes']=_[_0xeb13('0x2c')](_0x3705ca['model'],qs[_0xeb13('0x2e')](_0x5d0e33['query'][_0xeb13('0x2e')]));_0x32de13['attributes']=_0x32de13['attributes'][_0xeb13('0x2f')]?_0x32de13['attributes']:_0x3705ca[_0xeb13('0x28')];if(_0x5d0e33[_0xeb13('0x2a')]['includeAll']){_0x32de13[_0xeb13('0x3a')]=[{'all':!![]}];}_0x32de13=_[_0xeb13('0x35')]({},_0x32de13,_0x5d0e33[_0xeb13('0x39')]);return db[_0xeb13('0x27')]['find'](_0x32de13)[_0xeb13('0x23')](handleEntityNotFound(_0x5efc07,null))[_0xeb13('0x23')](respondWithResult(_0x5efc07,null))[_0xeb13('0x3d')](handleError(_0x5efc07,null));};exports[_0xeb13('0x41')]=function(_0x533deb,_0x56485a){return db[_0xeb13('0x27')][_0xeb13('0x41')](_0x533deb[_0xeb13('0x42')],{})['then'](respondWithResult(_0x56485a,0xc9))[_0xeb13('0x3d')](handleError(_0x56485a,null));};exports[_0xeb13('0x22')]=function(_0x27bed4,_0x201b0d){if(_0x27bed4[_0xeb13('0x42')]['id']){delete _0x27bed4[_0xeb13('0x42')]['id'];}return db[_0xeb13('0x27')]['find']({'where':{'id':_0x27bed4['params']['id']}})[_0xeb13('0x23')](handleEntityNotFound(_0x201b0d,null))['then'](saveUpdates(_0x27bed4[_0xeb13('0x42')],null))[_0xeb13('0x23')](respondWithResult(_0x201b0d,null))[_0xeb13('0x3d')](handleError(_0x201b0d,null));};exports['destroy']=function(_0x3aaf5a,_0xd7b8c5){return db[_0xeb13('0x27')][_0xeb13('0x43')]({'where':{'id':_0x3aaf5a[_0xeb13('0x3f')]['id']}})[_0xeb13('0x23')](handleEntityNotFound(_0xd7b8c5,null))[_0xeb13('0x23')](removeEntity(_0xd7b8c5,null))[_0xeb13('0x3d')](handleError(_0xd7b8c5,null));};exports[_0xeb13('0x44')]=function(_0x1f56d5,_0x3a5e9b){return db[_0xeb13('0x27')][_0xeb13('0x44')]()['then'](respondWithResult(_0x3a5e9b,null))[_0xeb13('0x3d')](handleError(_0x3a5e9b,null));};function wrapUser(_0x8b2490){return function(_0x540bd7){var _0x89afa1=_0x8b2490[_0xeb13('0x45')]({'plain':!![]});_0x89afa1['messages']=[];if(_0x540bd7){_0x89afa1['lastMessageAt']=_0x540bd7[_0xeb13('0x46')];_0x89afa1[_0xeb13('0x47')]=_0x540bd7;}else{_0x89afa1[_0xeb13('0x48')]=moment(0x0)[_0xeb13('0x49')](_0xeb13('0x4a'));_0x89afa1['lastMessage']={};}return _0x89afa1;};}exports['getUsers']=function(_0x130381,_0xbeea73,_0x2bcd59){var _0x22e498=[];return db[_0xeb13('0x4b')][_0xeb13('0x3b')]({'where':{'role':['agent','admin',_0xeb13('0x4c')]},'attributes':['id',_0xeb13('0x4d'),_0xeb13('0x25'),_0xeb13('0x4e'),'userpic','internal',_0xeb13('0x4f'),'lastLoginAt',_0xeb13('0x50'),'showWebBar'],'order':qs[_0xeb13('0x32')](_0xeb13('0x51')),'include':[{'model':db[_0xeb13('0x52')],'as':_0xeb13('0x53'),'attributes':['id',_0xeb13('0x25'),_0xeb13('0x37')],'through':{'attributes':[]}}]})[_0xeb13('0x23')](function(_0x49b960){if(_0x49b960){var _0x7e87df=_0x130381[_0xeb13('0x4c')][_0xeb13('0x45')]({'plain':!![]});if(!_0x7e87df)throw new Error(_0xeb13('0x54'));if(_0x7e87df['role']===_0xeb13('0x4c')){return db[_0xeb13('0x55')]['find']({'where':{'name':_0xeb13('0x56'),'userProfileId':_0x7e87df['userProfileId']},'raw':!![]})[_0xeb13('0x23')](function(_0x2668ed){if(_0x2668ed){if(_0x2668ed['autoAssociation']===0x0){return db['UserProfileResource'][_0xeb13('0x3b')]({'where':{'sectionId':_0x2668ed['id']},'raw':!![]})['then'](function(_0x1ad272){var _0x57eae6=[];if(_[_0xeb13('0x57')](_0x1ad272)){_0x57eae6=_['filter'](_0x49b960,function(_0x3c8748){if(_0x3c8748[_0xeb13('0x4e')]!==_0xeb13('0x58')){return _0x3c8748;}});return _0x57eae6;}else{for(var _0x508388=0x0;_0x508388<_0x49b960[_0xeb13('0x2f')];_0x508388++){var _0x243067=_0x49b960[_0x508388];if(_0x243067[_0xeb13('0x4e')]===_0xeb13('0x58')){var _0x309bd9=_[_0xeb13('0x43')](_0x1ad272,function(_0x58b67f){return _0x58b67f[_0xeb13('0x59')]===_0x243067['id'];});if(_0x309bd9)_0x57eae6['push'](_0x243067);}else{_0x57eae6[_0xeb13('0x5a')](_0x243067);}}return _0x57eae6;}});}else{return _0x49b960;}}else{var _0x2a977a=_[_0xeb13('0x34')](_0x49b960,function(_0x3709aa){if(_0x3709aa[_0xeb13('0x4e')]!=='agent'){return _0x3709aa;}});return _0x2a977a;}});}else{return _0x49b960;}}})['then'](function(_0x19680a){var _0x80b61e=[];if(_0x19680a){_0x22e498=_0x19680a;for(var _0x51612e=0x0;_0x51612e<_0x19680a['length'];_0x51612e+=0x1){_0x22e498[_0x51612e][_0xeb13('0x5b')]=[];_0x80b61e[_0xeb13('0x5a')](db[_0xeb13('0x27')]['find']({'where':{'FromId':[_0x130381[_0xeb13('0x4c')]['id'],_0x19680a[_0x51612e]['id']],'ToId':[_0x130381[_0xeb13('0x4c')]['id'],_0x19680a[_0x51612e]['id']],'ChatGroupId':null},'attributes':['id',_0xeb13('0x46'),_0xeb13('0x5c'),_0xeb13('0x5d'),_0xeb13('0x5e'),'body'],'order':qs[_0xeb13('0x32')](_0xeb13('0x5f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xeb13('0x23')](wrapUser(_0x19680a[_0x51612e])));}return BPromise['all'](_0x80b61e);}return[];})[_0xeb13('0x23')](function(_0xcac8af){return{'rows':_0xcac8af,'count':_0xcac8af[_0xeb13('0x2f')]};})[_0xeb13('0x23')](respondWithResult(_0xbeea73,null))[_0xeb13('0x3d')](handleError(_0xbeea73,null));}; \ No newline at end of file +var _0xd9dc=['user','fullname','role','userpic','internal','online','showWebBar','sort','-online','VoiceQueue','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','findAll','isEmpty','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','end','status','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','ChatInternalMessage','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','map','VIRTUAL','field','options','includeAll','rows','show','params','find','catch','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','User','agent','admin'];(function(_0xd819e,_0x1b9900){var _0x2ea85c=function(_0x4c2ff1){while(--_0x4c2ff1){_0xd819e['push'](_0xd819e['shift']());}};_0x2ea85c(++_0x1b9900);}(_0xd9dc,0x1b0));var _0xcd9d=function(_0x5b1f35,_0x508d2f){_0x5b1f35=_0x5b1f35-0x0;var _0x7d4c55=_0xd9dc[_0x5b1f35];return _0x7d4c55;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcd9d('0x0'));var rimraf=require(_0xcd9d('0x1'));var zipdir=require(_0xcd9d('0x2'));var jsonpatch=require(_0xcd9d('0x3'));var rp=require(_0xcd9d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcd9d('0x5'));var path=require('path');var sox=require(_0xcd9d('0x6'));var csv=require(_0xcd9d('0x7'));var ejs=require(_0xcd9d('0x8'));var fs=require('fs');var _=require(_0xcd9d('0x9'));var squel=require('squel');var crypto=require(_0xcd9d('0xa'));var jsforce=require(_0xcd9d('0xb'));var deskjs=require(_0xcd9d('0xc'));var toCsv=require(_0xcd9d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd9d('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd9d('0xe'))('api');var utils=require(_0xcd9d('0xf'));var config=require(_0xcd9d('0x10'));var db=require(_0xcd9d('0x11'))['db'];config[_0xcd9d('0x12')]=_['defaults'](config[_0xcd9d('0x12')],{'host':_0xcd9d('0x13'),'port':0x18eb});var socket=require(_0xcd9d('0x14'))(new Redis(config[_0xcd9d('0x12')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0xb9ff58,_0x12bf75){_0x12bf75=_0x12bf75||0xcc;return function(_0x54dc8f){if(_0x54dc8f){return _0xb9ff58[_0xcd9d('0x15')](_0x12bf75);}return _0xb9ff58['status'](_0x12bf75)[_0xcd9d('0x16')]();};}function respondWithResult(_0x1bba52,_0x244f45){_0x244f45=_0x244f45||0xc8;return function(_0x3af17d){if(_0x3af17d){return _0x1bba52[_0xcd9d('0x17')](_0x244f45)['json'](_0x3af17d);}};}function respondWithFilteredResult(_0x325030,_0x20ef08){return function(_0x54d478){if(_0x54d478){var _0x8ff70f=_0x54d478[_0xcd9d('0x18')],_0x1bf299=_0x20ef08['offset'],_0x826d29=_0x20ef08['offset']+_0x20ef08[_0xcd9d('0x19')],_0x2188d4;if(_0x826d29>=_0x8ff70f){_0x826d29=_0x8ff70f;_0x2188d4=0xc8;}else{_0x2188d4=0xce;}_0x325030[_0xcd9d('0x17')](_0x2188d4);return _0x325030[_0xcd9d('0x1a')](_0xcd9d('0x1b'),_0x1bf299+'-'+_0x826d29+'/'+_0x8ff70f)[_0xcd9d('0x1c')](_0x54d478);}return null;};}function patchUpdates(_0x477a0b){return function(_0xf17ba6){try{jsonpatch[_0xcd9d('0x1d')](_0xf17ba6,_0x477a0b,!![]);}catch(_0x151f64){return BPromise['reject'](_0x151f64);}return _0xf17ba6[_0xcd9d('0x1e')]();};}function saveUpdates(_0x153316,_0xa586d4){return function(_0x46fc56){if(_0x46fc56){return _0x46fc56[_0xcd9d('0x1f')](_0x153316)[_0xcd9d('0x20')](function(_0x30fa7f){return _0x30fa7f;});}return null;};}function removeEntity(_0x3ceb09,_0x37bfc2){return function(_0x345d37){if(_0x345d37){return _0x345d37[_0xcd9d('0x21')]()[_0xcd9d('0x20')](function(){_0x3ceb09['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1877,_0x563e39){return function(_0x7f37ef){if(!_0x7f37ef){_0x4b1877[_0xcd9d('0x15')](0x194);}return _0x7f37ef;};}function handleError(_0x4521b0,_0x517af9){_0x517af9=_0x517af9||0x1f4;return function(_0x76f9dc){logger[_0xcd9d('0x22')](_0x76f9dc[_0xcd9d('0x23')]);if(_0x76f9dc[_0xcd9d('0x24')]){delete _0x76f9dc[_0xcd9d('0x24')];}_0x4521b0[_0xcd9d('0x17')](_0x517af9)['send'](_0x76f9dc);};}exports[_0xcd9d('0x25')]=function(_0x3e2d92,_0x57e079){var _0x3e5961={},_0x4de50e={},_0x232153={'count':0x0,'rows':[]};var _0x19e73a=db[_0xcd9d('0x26')][_0xcd9d('0x27')];_0x4de50e[_0xcd9d('0x28')]=_['keys'](_0x19e73a);_0x4de50e[_0xcd9d('0x29')]=_[_0xcd9d('0x2a')](_0x3e2d92[_0xcd9d('0x29')]);_0x4de50e[_0xcd9d('0x2b')]=_['intersection'](_0x4de50e[_0xcd9d('0x28')],_0x4de50e[_0xcd9d('0x29')]);_0x3e5961['attributes']=_[_0xcd9d('0x2c')](_0x4de50e[_0xcd9d('0x28')],qs[_0xcd9d('0x2d')](_0x3e2d92['query']['fields']));_0x3e5961['attributes']=_0x3e5961[_0xcd9d('0x2e')][_0xcd9d('0x2f')]?_0x3e5961['attributes']:_0x4de50e[_0xcd9d('0x28')];if(!_0x3e2d92[_0xcd9d('0x29')][_0xcd9d('0x30')](_0xcd9d('0x31'))){_0x3e5961[_0xcd9d('0x19')]=qs[_0xcd9d('0x19')](_0x3e2d92['query'][_0xcd9d('0x19')]);_0x3e5961[_0xcd9d('0x32')]=qs[_0xcd9d('0x32')](_0x3e2d92['query'][_0xcd9d('0x32')]);}_0x3e5961[_0xcd9d('0x33')]=qs['sort'](_0x3e2d92['query']['sort']);_0x3e5961[_0xcd9d('0x34')]=qs[_0xcd9d('0x2b')](_[_0xcd9d('0x35')](_0x3e2d92[_0xcd9d('0x29')],_0x4de50e[_0xcd9d('0x2b')]));if(_0x3e2d92[_0xcd9d('0x29')][_0xcd9d('0x36')]){_0x3e5961[_0xcd9d('0x34')]=_[_0xcd9d('0x37')](_0x3e5961[_0xcd9d('0x34')],{'$or':_[_0xcd9d('0x38')](_0x19e73a,function(_0x6781a0){if(_0x6781a0['type']['key']!==_0xcd9d('0x39')){var _0x1bc312={};_0x1bc312[_0x6781a0[_0xcd9d('0x3a')]]={'$like':'%'+_0x3e2d92[_0xcd9d('0x29')]['filter']+'%'};return _0x1bc312;}})});}_0x3e5961=_[_0xcd9d('0x37')]({},_0x3e5961,_0x3e2d92[_0xcd9d('0x3b')]);var _0x3974a6={'where':_0x3e5961[_0xcd9d('0x34')]};return db[_0xcd9d('0x26')][_0xcd9d('0x18')](_0x3974a6)[_0xcd9d('0x20')](function(_0x94529){_0x232153[_0xcd9d('0x18')]=_0x94529;if(_0x3e2d92[_0xcd9d('0x29')][_0xcd9d('0x3c')]){_0x3e5961['include']=[{'all':!![]}];}return db[_0xcd9d('0x26')]['findAll'](_0x3e5961);})[_0xcd9d('0x20')](function(_0x1999cf){_0x232153[_0xcd9d('0x3d')]=_0x1999cf;return _0x232153;})[_0xcd9d('0x20')](respondWithFilteredResult(_0x57e079,_0x3e5961))['catch'](handleError(_0x57e079,null));};exports[_0xcd9d('0x3e')]=function(_0x4fbd96,_0x67f266){var _0x2cc34f={'raw':!![],'where':{'id':_0x4fbd96[_0xcd9d('0x3f')]['id']}},_0x198fd5={};_0x198fd5['model']=_['keys'](db[_0xcd9d('0x26')]['rawAttributes']);_0x198fd5[_0xcd9d('0x29')]=_[_0xcd9d('0x2a')](_0x4fbd96[_0xcd9d('0x29')]);_0x198fd5[_0xcd9d('0x2b')]=_[_0xcd9d('0x2c')](_0x198fd5['model'],_0x198fd5[_0xcd9d('0x29')]);_0x2cc34f[_0xcd9d('0x2e')]=_[_0xcd9d('0x2c')](_0x198fd5[_0xcd9d('0x28')],qs[_0xcd9d('0x2d')](_0x4fbd96[_0xcd9d('0x29')][_0xcd9d('0x2d')]));_0x2cc34f['attributes']=_0x2cc34f[_0xcd9d('0x2e')][_0xcd9d('0x2f')]?_0x2cc34f[_0xcd9d('0x2e')]:_0x198fd5['model'];if(_0x4fbd96[_0xcd9d('0x29')]['includeAll']){_0x2cc34f['include']=[{'all':!![]}];}_0x2cc34f=_[_0xcd9d('0x37')]({},_0x2cc34f,_0x4fbd96[_0xcd9d('0x3b')]);return db[_0xcd9d('0x26')][_0xcd9d('0x40')](_0x2cc34f)[_0xcd9d('0x20')](handleEntityNotFound(_0x67f266,null))[_0xcd9d('0x20')](respondWithResult(_0x67f266,null))[_0xcd9d('0x41')](handleError(_0x67f266,null));};exports[_0xcd9d('0x42')]=function(_0x2ce475,_0xcc533c){return db[_0xcd9d('0x26')][_0xcd9d('0x42')](_0x2ce475[_0xcd9d('0x43')],{})[_0xcd9d('0x20')](respondWithResult(_0xcc533c,0xc9))[_0xcd9d('0x41')](handleError(_0xcc533c,null));};exports[_0xcd9d('0x1f')]=function(_0x2c765e,_0x434090){if(_0x2c765e[_0xcd9d('0x43')]['id']){delete _0x2c765e[_0xcd9d('0x43')]['id'];}return db[_0xcd9d('0x26')]['find']({'where':{'id':_0x2c765e[_0xcd9d('0x3f')]['id']}})[_0xcd9d('0x20')](handleEntityNotFound(_0x434090,null))[_0xcd9d('0x20')](saveUpdates(_0x2c765e[_0xcd9d('0x43')],null))[_0xcd9d('0x20')](respondWithResult(_0x434090,null))[_0xcd9d('0x41')](handleError(_0x434090,null));};exports[_0xcd9d('0x21')]=function(_0x122070,_0xe5332d){return db[_0xcd9d('0x26')][_0xcd9d('0x40')]({'where':{'id':_0x122070[_0xcd9d('0x3f')]['id']}})['then'](handleEntityNotFound(_0xe5332d,null))[_0xcd9d('0x20')](removeEntity(_0xe5332d,null))['catch'](handleError(_0xe5332d,null));};exports[_0xcd9d('0x44')]=function(_0x307656,_0x5c2611){return db[_0xcd9d('0x26')][_0xcd9d('0x44')]()[_0xcd9d('0x20')](respondWithResult(_0x5c2611,null))['catch'](handleError(_0x5c2611,null));};function wrapUser(_0x35f14b){return function(_0x39f50e){var _0x1ecdce=_0x35f14b[_0xcd9d('0x45')]({'plain':!![]});_0x1ecdce[_0xcd9d('0x46')]=[];if(_0x39f50e){_0x1ecdce[_0xcd9d('0x47')]=_0x39f50e[_0xcd9d('0x48')];_0x1ecdce[_0xcd9d('0x49')]=_0x39f50e;}else{_0x1ecdce['lastMessageAt']=moment(0x0)[_0xcd9d('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ecdce[_0xcd9d('0x49')]={};}return _0x1ecdce;};}exports['getUsers']=function(_0x3d4b87,_0x116a92,_0x405323){var _0x5f4fe2=[];return db[_0xcd9d('0x4b')]['findAll']({'where':{'role':[_0xcd9d('0x4c'),_0xcd9d('0x4d'),_0xcd9d('0x4e')]},'attributes':['id',_0xcd9d('0x4f'),_0xcd9d('0x24'),_0xcd9d('0x50'),_0xcd9d('0x51'),_0xcd9d('0x52'),_0xcd9d('0x53'),'lastLoginAt','allowmessenger',_0xcd9d('0x54')],'order':qs[_0xcd9d('0x55')](_0xcd9d('0x56')),'include':[{'model':db[_0xcd9d('0x57')],'as':'VoiceQueues','attributes':['id',_0xcd9d('0x24'),_0xcd9d('0x58')],'through':{'attributes':[]}}]})[_0xcd9d('0x20')](function(_0x45dc06){if(_0x45dc06){var _0x286dd9=_0x3d4b87['user'][_0xcd9d('0x45')]({'plain':!![]});if(!_0x286dd9)throw new Error(_0xcd9d('0x59'));if(_0x286dd9[_0xcd9d('0x50')]==='user'){return db[_0xcd9d('0x5a')][_0xcd9d('0x40')]({'where':{'name':_0xcd9d('0x5b'),'userProfileId':_0x286dd9[_0xcd9d('0x5c')]},'raw':!![]})[_0xcd9d('0x20')](function(_0x1a37af){if(_0x1a37af){if(_0x1a37af[_0xcd9d('0x5d')]===0x0){return db['UserProfileResource'][_0xcd9d('0x5e')]({'where':{'sectionId':_0x1a37af['id']},'raw':!![]})['then'](function(_0x399f6b){var _0x50b42c=[];if(_[_0xcd9d('0x5f')](_0x399f6b)){_0x50b42c=_[_0xcd9d('0x36')](_0x45dc06,function(_0x305073){if(_0x305073[_0xcd9d('0x50')]!==_0xcd9d('0x4c')){return _0x305073;}});return _0x50b42c;}else{for(var _0x10a33f=0x0;_0x10a33f<_0x45dc06[_0xcd9d('0x2f')];_0x10a33f++){var _0x1c41fd=_0x45dc06[_0x10a33f];if(_0x1c41fd[_0xcd9d('0x50')]==='agent'){var _0x59b7b=_['find'](_0x399f6b,function(_0x48ee7d){return _0x48ee7d['resourceId']===_0x1c41fd['id'];});if(_0x59b7b)_0x50b42c[_0xcd9d('0x60')](_0x1c41fd);}else{_0x50b42c[_0xcd9d('0x60')](_0x1c41fd);}}return _0x50b42c;}});}else{return _0x45dc06;}}else{var _0x4c8431=_[_0xcd9d('0x36')](_0x45dc06,function(_0x399fa0){if(_0x399fa0['role']!==_0xcd9d('0x4c')){return _0x399fa0;}});return _0x4c8431;}});}else{return _0x45dc06;}}})[_0xcd9d('0x20')](function(_0x48b8f5){var _0x45cc5d=[];if(_0x48b8f5){_0x5f4fe2=_0x48b8f5;for(var _0x5d8d4a=0x0;_0x5d8d4a<_0x48b8f5[_0xcd9d('0x2f')];_0x5d8d4a+=0x1){_0x5f4fe2[_0x5d8d4a]['messages']=[];_0x45cc5d[_0xcd9d('0x60')](db[_0xcd9d('0x26')][_0xcd9d('0x40')]({'where':{'FromId':[_0x3d4b87[_0xcd9d('0x4e')]['id'],_0x48b8f5[_0x5d8d4a]['id']],'ToId':[_0x3d4b87[_0xcd9d('0x4e')]['id'],_0x48b8f5[_0x5d8d4a]['id']],'ChatGroupId':null},'attributes':['id',_0xcd9d('0x48'),_0xcd9d('0x61'),_0xcd9d('0x62'),_0xcd9d('0x63'),_0xcd9d('0x43')],'order':qs[_0xcd9d('0x55')](_0xcd9d('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xcd9d('0x20')](wrapUser(_0x48b8f5[_0x5d8d4a])));}return BPromise[_0xcd9d('0x65')](_0x45cc5d);}return[];})[_0xcd9d('0x20')](function(_0x1015be){return{'rows':_0x1015be,'count':_0x1015be['length']};})[_0xcd9d('0x20')](respondWithResult(_0x116a92,null))['catch'](handleError(_0x116a92,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e9de603..76aa533 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 _0x43f3=['hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','save','remove','emit'];(function(_0x5b1ab1,_0x9bbe2b){var _0x357b2f=function(_0x3741dc){while(--_0x3741dc){_0x5b1ab1['push'](_0x5b1ab1['shift']());}};_0x357b2f(++_0x9bbe2b);}(_0x43f3,0xab));var _0x343f=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x43f3[_0x35007a];return _0x574f68;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x343f('0x0'))['db'][_0x343f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x343f('0x2'),'afterUpdate':'update','afterDestroy':_0x343f('0x3')};function emitEvent(_0x48008f){return function(_0x3339a9,_0x24b4e8,_0x2f3439){ChatInternalMessageEvents['emit'](_0x48008f+':'+_0x3339a9['id'],_0x3339a9);ChatInternalMessageEvents[_0x343f('0x4')](_0x48008f,_0x3339a9);_0x2f3439(null);};}for(var e in events){if(events[_0x343f('0x5')](e)){var event=events[e];ChatInternalMessage[_0x343f('0x6')](e,emitEvent(event));}}module[_0x343f('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xef8b=['hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0xef8b,0x192));var _0xbef8=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xef8b[_0x17b6e3];return _0x3906f3;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xbef8('0x0'))['db'][_0xbef8('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbef8('0x2')](0x0);var events={'afterCreate':_0xbef8('0x3'),'afterUpdate':_0xbef8('0x4'),'afterDestroy':_0xbef8('0x5')};function emitEvent(_0x336519){return function(_0x224dd2,_0x201996,_0x110835){ChatInternalMessageEvents[_0xbef8('0x6')](_0x336519+':'+_0x224dd2['id'],_0x224dd2);ChatInternalMessageEvents['emit'](_0x336519,_0x224dd2);_0x110835(null);};}for(var e in events){if(events[_0xbef8('0x7')](e)){var event=events[e];ChatInternalMessage[_0xbef8('0x8')](e,emitEvent(event));}}module[_0xbef8('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f9f7a93..1427c0b 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 _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x356dc4,_0x4985bd){var _0x5de437=function(_0x506088){while(--_0x506088){_0x356dc4['push'](_0x356dc4['shift']());}};_0x5de437(++_0x4985bd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file +var _0xf4eb=['./chatInternalMessage.attributes','exports','define','chat_internal_messages','lodash','bluebird','rimraf','../../config/environment'];(function(_0x4ab4e3,_0x54cc66){var _0x2843bd=function(_0x1ded46){while(--_0x1ded46){_0x4ab4e3['push'](_0x4ab4e3['shift']());}};_0x2843bd(++_0x54cc66);}(_0xf4eb,0xec));var _0xbf4e=function(_0x33c0bf,_0x2c9c37){_0x33c0bf=_0x33c0bf-0x0;var _0x174149=_0xf4eb[_0x33c0bf];return _0x174149;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('ChatInternalMessage',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2d06de9..34fb9f0 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 _0x80ae=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x1ef547,_0x31bfdb){var _0x1d697b=function(_0x57fbdc){while(--_0x57fbdc){_0x1ef547['push'](_0x1ef547['shift']());}};_0x1d697b(++_0x31bfdb);}(_0x80ae,0x11d));var _0xe80a=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0x80ae[_0x4eec9b];return _0x2e3849;};'use strict';var _=require(_0xe80a('0x0'));var util=require(_0xe80a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe80a('0x2'));var db=require(_0xe80a('0x3'))['db'];var utils=require(_0xe80a('0x4'));var logger=require(_0xe80a('0x5'))(_0xe80a('0x6'));var config=require(_0xe80a('0x7'));var jayson=require(_0xe80a('0x8'));var client=jayson[_0xe80a('0x9')]['http']({'port':0x232a});config['redis']=_[_0xe80a('0xa')](config[_0xe80a('0xb')],{'host':_0xe80a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe80a('0xb')]));require(_0xe80a('0xd'))[_0xe80a('0xe')](socket);function respondWithRpcPromise(_0x5e93a9,_0xd95e81,_0x298918){return new BPromise(function(_0x4d2772,_0x5154b4){return client[_0xe80a('0xf')](_0x5e93a9,_0x298918)['then'](function(_0x31a1bf){logger[_0xe80a('0x10')](_0xe80a('0x11'),_0xd95e81,_0xe80a('0x12'));logger[_0xe80a('0x13')](_0xe80a('0x14'),_0xd95e81,_0xe80a('0x12'),JSON[_0xe80a('0x15')](_0x31a1bf));if(_0x31a1bf[_0xe80a('0x16')]){if(_0x31a1bf[_0xe80a('0x16')]['code']===0x1f4){logger[_0xe80a('0x16')](_0xe80a('0x11'),_0xd95e81,_0x31a1bf['error'][_0xe80a('0x17')]);return _0x5154b4(_0x31a1bf[_0xe80a('0x16')][_0xe80a('0x17')]);}logger['error'](_0xe80a('0x11'),_0xd95e81,_0x31a1bf[_0xe80a('0x16')][_0xe80a('0x17')]);return _0x4d2772(_0x31a1bf[_0xe80a('0x16')][_0xe80a('0x17')]);}else{logger[_0xe80a('0x10')](_0xe80a('0x11'),_0xd95e81,_0xe80a('0x12'));_0x4d2772(_0x31a1bf[_0xe80a('0x18')][_0xe80a('0x17')]);}})[_0xe80a('0x19')](function(_0x64cfc){logger[_0xe80a('0x16')](_0xe80a('0x11'),_0xd95e81,_0x64cfc);_0x5154b4(_0x64cfc);});});} \ No newline at end of file +var _0x15af=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf44d3b,_0x47e4d3){var _0x4ff522=function(_0x397af7){while(--_0x397af7){_0xf44d3b['push'](_0xf44d3b['shift']());}};_0x4ff522(++_0x47e4d3);}(_0x15af,0xb5));var _0xf15a=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x15af[_0x1477ef];return _0x164acd;};'use strict';var _=require('lodash');var util=require(_0xf15a('0x0'));var moment=require('moment');var BPromise=require(_0xf15a('0x1'));var rs=require(_0xf15a('0x2'));var fs=require('fs');var Redis=require(_0xf15a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf15a('0x4'))(_0xf15a('0x5'));var config=require('../../config/environment');var jayson=require(_0xf15a('0x6'));var client=jayson[_0xf15a('0x7')][_0xf15a('0x8')]({'port':0x232a});config[_0xf15a('0x9')]=_[_0xf15a('0xa')](config[_0xf15a('0x9')],{'host':_0xf15a('0xb'),'port':0x18eb});var socket=require(_0xf15a('0xc'))(new Redis(config[_0xf15a('0x9')]));require(_0xf15a('0xd'))['register'](socket);function respondWithRpcPromise(_0x3404de,_0x1bb591,_0x28b386){return new BPromise(function(_0x96edf7,_0x2cbe3d){return client[_0xf15a('0xe')](_0x3404de,_0x28b386)['then'](function(_0x5c6d99){logger[_0xf15a('0xf')](_0xf15a('0x10'),_0x1bb591,_0xf15a('0x11'));logger[_0xf15a('0x12')](_0xf15a('0x13'),_0x1bb591,_0xf15a('0x11'),JSON['stringify'](_0x5c6d99));if(_0x5c6d99['error']){if(_0x5c6d99[_0xf15a('0x14')][_0xf15a('0x15')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1bb591,_0x5c6d99[_0xf15a('0x14')][_0xf15a('0x16')]);return _0x2cbe3d(_0x5c6d99['error']['message']);}logger[_0xf15a('0x14')](_0xf15a('0x10'),_0x1bb591,_0x5c6d99[_0xf15a('0x14')][_0xf15a('0x16')]);return _0x96edf7(_0x5c6d99[_0xf15a('0x14')][_0xf15a('0x16')]);}else{logger['info'](_0xf15a('0x10'),_0x1bb591,_0xf15a('0x11'));_0x96edf7(_0x5c6d99[_0xf15a('0x17')][_0xf15a('0x16')]);}})[_0xf15a('0x18')](function(_0x3001f5){logger[_0xf15a('0x14')](_0xf15a('0x10'),_0x1bb591,_0x3001f5);_0x2cbe3d(_0x3001f5);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 41011d3..e561ea2 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 _0x222f=['./chatInternalMessage.events','save','remove','update','emit','register'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x222f,0x1a4));var _0xf222=function(_0x39fba9,_0x245311){_0x39fba9=_0x39fba9-0x0;var _0x3078c5=_0x222f[_0x39fba9];return _0x3078c5;};'use strict';var ChatInternalMessageEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){ChatInternalMessageEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('chatInternalMessage:'+_0xf5a105,_0x54a758);ChatInternalMessageEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file +var _0x0834=['update','emit','removeListener','register','length','chatInternalMessage:','remove'];(function(_0x54c715,_0xd765a5){var _0x48b500=function(_0x28539c){while(--_0x28539c){_0x54c715['push'](_0x54c715['shift']());}};_0x48b500(++_0xd765a5);}(_0x0834,0x18e));var _0x4083=function(_0x544767,_0x1b130e){_0x544767=_0x544767-0x0;var _0x1d9229=_0x0834[_0x544767];return _0x1d9229;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x4083('0x0'),_0x4083('0x1')];function createListener(_0x5cbfad,_0x491147){return function(_0x5e1812){_0x491147[_0x4083('0x2')](_0x5cbfad,_0x5e1812);};}function removeListener(_0x14b7c6,_0x4e3837){return function(){ChatInternalMessageEvents[_0x4083('0x3')](_0x14b7c6,_0x4e3837);};}exports[_0x4083('0x4')]=function(_0x50a894){for(var _0x3bf635=0x0,_0x5c5a54=events[_0x4083('0x5')];_0x3bf635<_0x5c5a54;_0x3bf635++){var _0x26ed53=events[_0x3bf635];var _0x2c42bb=createListener(_0x4083('0x6')+_0x26ed53,_0x50a894);ChatInternalMessageEvents['on'](_0x26ed53,_0x2c42bb);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 160d41b..87cfb24 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 _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x443fc8,_0x594106){var _0x637d58=function(_0x419ad1){while(--_0x419ad1){_0x443fc8['push'](_0x443fc8['shift']());}};_0x637d58(++_0x594106);}(_0xe706,0xa3));var _0x6e70=function(_0x2ba609,_0x391585){_0x2ba609=_0x2ba609-0x0;var _0x563793=_0xe706[_0x2ba609];return _0x563793;};'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('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file +var _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x79fa72,_0x475a5b){var _0x49f42f=function(_0x102383){while(--_0x102383){_0x79fa72['push'](_0x79fa72['shift']());}};_0x49f42f(++_0x475a5b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xcb91[_0x13b02f];return _0x12e9a6;};'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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 893dd29..2b96ba8 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 _0x40c6=['exports','TEXT','medium','BOOLEAN','ENUM','out','sequelize'];(function(_0x27bb46,_0x4d243f){var _0x42b899=function(_0x517c15){while(--_0x517c15){_0x27bb46['push'](_0x27bb46['shift']());}};_0x42b899(++_0x4d243f);}(_0x40c6,0x1f0));var _0x640c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x40c6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x640c('0x0'));module[_0x640c('0x1')]={'body':{'type':Sequelize[_0x640c('0x2')](_0x640c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x640c('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x640c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x640c('0x5')]('in','out'),'defaultValue':_0x640c('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x3e69=['sequelize','medium','BOOLEAN','out'];(function(_0x4a9ef8,_0x31b2f5){var _0x2bf9ce=function(_0x2dcb95){while(--_0x2dcb95){_0x4a9ef8['push'](_0x4a9ef8['shift']());}};_0x2bf9ce(++_0x31b2f5);}(_0x3e69,0x1b4));var _0x93e6=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x3e69[_0x343090];return _0x3ff3e8;};'use strict';var Sequelize=require(_0x93e6('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x93e6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x93e6('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x93e6('0x3')),'defaultValue':_0x93e6('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 0b264ab..6a4216c 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 _0x5aab=['save','update','destroy','end','stack','name','send','index','rawAttributes','model','query','filters','intersection','attributes','fields','length','order','sort','where','map','type','key','VIRTUAL','filter','merge','ChatMessage','includeAll','include','findAll','rows','params','keys','options','create','body','find','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x36192f,_0x2e07e2){var _0x13f52d=function(_0x3b8eaa){while(--_0x3b8eaa){_0x36192f['push'](_0x36192f['shift']());}};_0x13f52d(++_0x2e07e2);}(_0x5aab,0xbe));var _0xb5aa=function(_0x3776e1,_0x3a7438){_0x3776e1=_0x3776e1-0x0;var _0xaec1af=_0x5aab[_0x3776e1];return _0xaec1af;};'use strict';var pdf=require(_0xb5aa('0x0'));var emlformat=require(_0xb5aa('0x1'));var rimraf=require(_0xb5aa('0x2'));var zipdir=require(_0xb5aa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5aa('0x4'));var moment=require(_0xb5aa('0x5'));var BPromise=require(_0xb5aa('0x6'));var Mustache=require(_0xb5aa('0x7'));var util=require(_0xb5aa('0x8'));var path=require('path');var sox=require(_0xb5aa('0x9'));var csv=require(_0xb5aa('0xa'));var ejs=require(_0xb5aa('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb5aa('0xc'));var crypto=require(_0xb5aa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb5aa('0xe'));var toCsv=require(_0xb5aa('0xa'));var querystring=require(_0xb5aa('0xf'));var Papa=require('papaparse');var Redis=require(_0xb5aa('0x10'));var authService=require(_0xb5aa('0x11'));var qs=require(_0xb5aa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5aa('0x13'))(_0xb5aa('0x14'));var utils=require(_0xb5aa('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb5aa('0x16')]=_[_0xb5aa('0x17')](config[_0xb5aa('0x16')],{'host':_0xb5aa('0x18'),'port':0x18eb});var socket=require(_0xb5aa('0x19'))(new Redis(config[_0xb5aa('0x16')]));require('./chatMessage.socket')[_0xb5aa('0x1a')](socket);var jayson=require(_0xb5aa('0x1b'));var client=jayson[_0xb5aa('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0xb5aa('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1524b4,_0x11f3f5,_0x36886d){if(_0x36886d){var _0x37ece5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37ece5[_0xb5aa('0x1e')](_0x11f3f5)){return _0x1524b4;}else{throw new db[(_0xb5aa('0x1f'))][(_0xb5aa('0x20'))](_0xb5aa('0x21'));}}else{return _0x1524b4;}}function respondWithRpcPromise(_0x3869d9,_0x1b7858,_0x25dc73,_0x28aff6){return new BPromise(function(_0x5dd482,_0x50a5a8){var _0x3ea11a=_0x28aff6||client;return _0x3ea11a[_0xb5aa('0x22')](_0x3869d9,_0x25dc73)[_0xb5aa('0x23')](function(_0x525385){logger[_0xb5aa('0x24')](_0xb5aa('0x25'),_0x1b7858,'request\x20sent');logger[_0xb5aa('0x26')](_0xb5aa('0x27'),_0x1b7858,_0xb5aa('0x28'),JSON[_0xb5aa('0x29')](_0x525385));if(_0x525385['error']){if(_0x525385['error'][_0xb5aa('0x2a')]===0x1f4){logger[_0xb5aa('0x2b')](_0xb5aa('0x25'),_0x1b7858,_0x525385[_0xb5aa('0x2b')][_0xb5aa('0x2c')]);return _0x50a5a8(_0x525385[_0xb5aa('0x2b')][_0xb5aa('0x2c')]);}logger[_0xb5aa('0x2b')](_0xb5aa('0x25'),_0x1b7858,_0x525385[_0xb5aa('0x2b')]['message']);return _0x5dd482(_0x525385[_0xb5aa('0x2b')][_0xb5aa('0x2c')]);}else{logger[_0xb5aa('0x24')](_0xb5aa('0x25'),_0x1b7858,_0xb5aa('0x28'));_0x5dd482(_0x525385[_0xb5aa('0x2d')][_0xb5aa('0x2c')]);}})[_0xb5aa('0x2e')](function(_0x4bb3f6){logger['error'](_0xb5aa('0x25'),_0x1b7858,_0x4bb3f6);_0x50a5a8(_0x4bb3f6);});});}function respondWithStatusCode(_0x33d913,_0x2a6ff6){_0x2a6ff6=_0x2a6ff6||0xcc;return function(_0x3ef416){if(_0x3ef416){return _0x33d913['sendStatus'](_0x2a6ff6);}return _0x33d913[_0xb5aa('0x2f')](_0x2a6ff6)['end']();};}function respondWithResult(_0x2c6547,_0x2149a5){_0x2149a5=_0x2149a5||0xc8;return function(_0x245ae2){if(_0x245ae2){return _0x2c6547['status'](_0x2149a5)[_0xb5aa('0x30')](_0x245ae2);}};}function respondWithFilteredResult(_0x47c668,_0x117020){return function(_0x4838b0){if(_0x4838b0){var _0x11e93d=_0x4838b0[_0xb5aa('0x31')],_0x31d8ab=_0x117020[_0xb5aa('0x32')],_0x2672e7=_0x117020[_0xb5aa('0x32')]+_0x117020[_0xb5aa('0x33')],_0x224e58;if(_0x2672e7>=_0x11e93d){_0x2672e7=_0x11e93d;_0x224e58=0xc8;}else{_0x224e58=0xce;}_0x47c668[_0xb5aa('0x2f')](_0x224e58);return _0x47c668[_0xb5aa('0x34')](_0xb5aa('0x35'),_0x31d8ab+'-'+_0x2672e7+'/'+_0x11e93d)['json'](_0x4838b0);}return null;};}function patchUpdates(_0x2792d5){return function(_0x2a1772){try{jsonpatch[_0xb5aa('0x36')](_0x2a1772,_0x2792d5,!![]);}catch(_0x26b2c6){return BPromise[_0xb5aa('0x37')](_0x26b2c6);}return _0x2a1772[_0xb5aa('0x38')]();};}function saveUpdates(_0x727439,_0x3d542f){return function(_0x363f68){if(_0x363f68){return _0x363f68[_0xb5aa('0x39')](_0x727439)[_0xb5aa('0x23')](function(_0x48c1b2){return _0x48c1b2;});}return null;};}function removeEntity(_0x328a03,_0x23404f){return function(_0x1c236f){if(_0x1c236f){return _0x1c236f[_0xb5aa('0x3a')]()[_0xb5aa('0x23')](function(){_0x328a03[_0xb5aa('0x2f')](0xcc)[_0xb5aa('0x3b')]();});}};}function handleEntityNotFound(_0x27f77d,_0x37119d){return function(_0x127bd7){if(!_0x127bd7){_0x27f77d['sendStatus'](0x194);}return _0x127bd7;};}function handleError(_0x30ac5e,_0x2d662c){_0x2d662c=_0x2d662c||0x1f4;return function(_0x1fc031){logger[_0xb5aa('0x2b')](_0x1fc031[_0xb5aa('0x3c')]);if(_0x1fc031[_0xb5aa('0x3d')]){delete _0x1fc031[_0xb5aa('0x3d')];}_0x30ac5e[_0xb5aa('0x2f')](_0x2d662c)[_0xb5aa('0x3e')](_0x1fc031);};}exports[_0xb5aa('0x3f')]=function(_0x5e9bba,_0x493d2c){var _0x3afd8f={},_0x4eab38={},_0x437715={'count':0x0,'rows':[]};var _0x765053=db['ChatMessage'][_0xb5aa('0x40')];_0x4eab38[_0xb5aa('0x41')]=_['keys'](_0x765053);_0x4eab38['query']=_['keys'](_0x5e9bba[_0xb5aa('0x42')]);_0x4eab38[_0xb5aa('0x43')]=_[_0xb5aa('0x44')](_0x4eab38['model'],_0x4eab38[_0xb5aa('0x42')]);_0x3afd8f[_0xb5aa('0x45')]=_['intersection'](_0x4eab38[_0xb5aa('0x41')],qs[_0xb5aa('0x46')](_0x5e9bba[_0xb5aa('0x42')]['fields']));_0x3afd8f[_0xb5aa('0x45')]=_0x3afd8f[_0xb5aa('0x45')][_0xb5aa('0x47')]?_0x3afd8f[_0xb5aa('0x45')]:_0x4eab38[_0xb5aa('0x41')];if(!_0x5e9bba['query']['hasOwnProperty']('nolimit')){_0x3afd8f[_0xb5aa('0x33')]=qs[_0xb5aa('0x33')](_0x5e9bba['query'][_0xb5aa('0x33')]);_0x3afd8f[_0xb5aa('0x32')]=qs[_0xb5aa('0x32')](_0x5e9bba[_0xb5aa('0x42')][_0xb5aa('0x32')]);}_0x3afd8f[_0xb5aa('0x48')]=qs[_0xb5aa('0x49')](_0x5e9bba[_0xb5aa('0x42')]['sort']);_0x3afd8f[_0xb5aa('0x4a')]=qs[_0xb5aa('0x43')](_['pick'](_0x5e9bba[_0xb5aa('0x42')],_0x4eab38[_0xb5aa('0x43')]));if(_0x5e9bba[_0xb5aa('0x42')]['filter']){_0x3afd8f[_0xb5aa('0x4a')]=_['merge'](_0x3afd8f[_0xb5aa('0x4a')],{'$or':_[_0xb5aa('0x4b')](_0x765053,function(_0x2f895f){if(_0x2f895f[_0xb5aa('0x4c')][_0xb5aa('0x4d')]!==_0xb5aa('0x4e')){var _0x12f9d9={};_0x12f9d9[_0x2f895f['field']]={'$like':'%'+_0x5e9bba[_0xb5aa('0x42')][_0xb5aa('0x4f')]+'%'};return _0x12f9d9;}})});}_0x3afd8f=_[_0xb5aa('0x50')]({},_0x3afd8f,_0x5e9bba['options']);var _0x44d32e={'where':_0x3afd8f[_0xb5aa('0x4a')]};return db[_0xb5aa('0x51')][_0xb5aa('0x31')](_0x44d32e)['then'](function(_0x3885f3){_0x437715[_0xb5aa('0x31')]=_0x3885f3;if(_0x5e9bba[_0xb5aa('0x42')][_0xb5aa('0x52')]){_0x3afd8f[_0xb5aa('0x53')]=[{'all':!![]}];}return db['ChatMessage'][_0xb5aa('0x54')](_0x3afd8f);})[_0xb5aa('0x23')](function(_0x1655f6){_0x437715[_0xb5aa('0x55')]=_0x1655f6;return _0x437715;})[_0xb5aa('0x23')](respondWithFilteredResult(_0x493d2c,_0x3afd8f))[_0xb5aa('0x2e')](handleError(_0x493d2c,null));};exports['show']=function(_0x334ada,_0x1e5887){var _0x9e24ab={'raw':!![],'where':{'id':_0x334ada[_0xb5aa('0x56')]['id']}},_0x32ace8={};_0x32ace8[_0xb5aa('0x41')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x32ace8[_0xb5aa('0x42')]=_[_0xb5aa('0x57')](_0x334ada[_0xb5aa('0x42')]);_0x32ace8[_0xb5aa('0x43')]=_[_0xb5aa('0x44')](_0x32ace8['model'],_0x32ace8[_0xb5aa('0x42')]);_0x9e24ab[_0xb5aa('0x45')]=_[_0xb5aa('0x44')](_0x32ace8['model'],qs[_0xb5aa('0x46')](_0x334ada[_0xb5aa('0x42')][_0xb5aa('0x46')]));_0x9e24ab[_0xb5aa('0x45')]=_0x9e24ab[_0xb5aa('0x45')]['length']?_0x9e24ab['attributes']:_0x32ace8[_0xb5aa('0x41')];if(_0x334ada['query'][_0xb5aa('0x52')]){_0x9e24ab[_0xb5aa('0x53')]=[{'all':!![]}];}_0x9e24ab=_[_0xb5aa('0x50')]({},_0x9e24ab,_0x334ada[_0xb5aa('0x58')]);return db[_0xb5aa('0x51')]['find'](_0x9e24ab)[_0xb5aa('0x23')](handleEntityNotFound(_0x1e5887,null))[_0xb5aa('0x23')](respondWithResult(_0x1e5887,null))[_0xb5aa('0x2e')](handleError(_0x1e5887,null));};exports[_0xb5aa('0x59')]=function(_0x1631f3,_0x4df86e){return db[_0xb5aa('0x51')][_0xb5aa('0x59')](_0x1631f3[_0xb5aa('0x5a')],{})[_0xb5aa('0x23')](respondWithResult(_0x4df86e,0xc9))[_0xb5aa('0x2e')](handleError(_0x4df86e,null));};exports['update']=function(_0x350ecc,_0x5a6e34){if(_0x350ecc['body']['id']){delete _0x350ecc[_0xb5aa('0x5a')]['id'];}return db[_0xb5aa('0x51')][_0xb5aa('0x5b')]({'where':{'id':_0x350ecc['params']['id']}})[_0xb5aa('0x23')](handleEntityNotFound(_0x5a6e34,null))[_0xb5aa('0x23')](saveUpdates(_0x350ecc[_0xb5aa('0x5a')],null))[_0xb5aa('0x23')](respondWithResult(_0x5a6e34,null))[_0xb5aa('0x2e')](handleError(_0x5a6e34,null));};exports[_0xb5aa('0x3a')]=function(_0x4b6fda,_0x20b35f){return db[_0xb5aa('0x51')]['find']({'where':{'id':_0x4b6fda[_0xb5aa('0x56')]['id']}})[_0xb5aa('0x23')](handleEntityNotFound(_0x20b35f,null))[_0xb5aa('0x23')](removeEntity(_0x20b35f,null))['catch'](handleError(_0x20b35f,null));};exports['describe']=function(_0x3b2334,_0x19f4e5){return db['ChatMessage'][_0xb5aa('0x5c')]()[_0xb5aa('0x23')](respondWithResult(_0x19f4e5,null))[_0xb5aa('0x2e')](handleError(_0x19f4e5,null));};var interaction_log=require(_0xb5aa('0x13'))(_0xb5aa('0x5d'));exports[_0xb5aa('0x5e')]=function(_0x31ee3d,_0x52b99a,_0x371de5){var _0x5636c5={'channel':_0xb5aa('0x5f')};if(_0x31ee3d[_0xb5aa('0x5a')]['id']){delete _0x31ee3d[_0xb5aa('0x5a')]['id'];}_0x31ee3d[_0xb5aa('0x5a')][_0xb5aa('0x60')]=!![];_0x31ee3d['body'][_0xb5aa('0x61')]=moment()[_0xb5aa('0x62')](_0xb5aa('0x63'));_0x31ee3d[_0xb5aa('0x5a')]['UserId']=_0x31ee3d[_0xb5aa('0x5a')][_0xb5aa('0x64')]||_0x31ee3d[_0xb5aa('0x65')]['id'];return db[_0xb5aa('0x51')][_0xb5aa('0x5b')]({'where':{'id':_0x31ee3d[_0xb5aa('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xb5aa('0x23')](handleEntityNotFound(_0x52b99a,null))[_0xb5aa('0x23')](saveUpdates(_0x31ee3d[_0xb5aa('0x5a')],null))['then'](function(_0x2b5e15){if(_0x2b5e15){_0x5636c5[_0xb5aa('0x2c')]=_0x2b5e15[_0xb5aa('0x66')]({'plain':!![]});return db[_0xb5aa('0x67')]['find']({'where':{'id':_0x2b5e15[_0xb5aa('0x68')]}});}return null;})[_0xb5aa('0x23')](handleEntityNotFound(_0x52b99a,null))[_0xb5aa('0x23')](function(_0x2b452a){if(_0x2b452a){return _0x2b452a[_0xb5aa('0x39')]({'UserId':_0x31ee3d[_0xb5aa('0x5a')][_0xb5aa('0x64')],'read1stAt':_[_0xb5aa('0x69')](_0x2b452a['read1stAt'])?moment()[_0xb5aa('0x62')](_0xb5aa('0x63')):undefined});}return null;})[_0xb5aa('0x23')](function(_0x13b99a){if(_0x13b99a){_0x5636c5[_0xb5aa('0x6a')]=_0x13b99a[_0xb5aa('0x66')]({'plain':!![]});interaction_log[_0xb5aa('0x24')](_0xb5aa('0x6b'),_0x31ee3d[_0xb5aa('0x65')]['id'],_0x31ee3d[_0xb5aa('0x65')]['name'],_0x31ee3d['user'][_0xb5aa('0x6c')],_0x5636c5[_0xb5aa('0x6a')]['id'],_0x31ee3d[_0xb5aa('0x5a')]?JSON[_0xb5aa('0x29')](_0x31ee3d['body']):_0xb5aa('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5636c5);}return null;})['then'](function(_0xd1a06b){if(_0xd1a06b){if(_0x31ee3d[_0xb5aa('0x5a')][_0xb5aa('0x6e')]){_0x5636c5[_0xb5aa('0x2c')][_0xb5aa('0x6f')]=util[_0xb5aa('0x62')](_0xb5aa('0x70'),_0x31ee3d[_0xb5aa('0x65')][_0xb5aa('0x3d')]);_0x5636c5['message'][_0xb5aa('0x71')]=_0x5636c5[_0xb5aa('0x71')];_0x5636c5[_0xb5aa('0x2c')][_0xb5aa('0x72')]=_0xb5aa('0x5e');return respondWithRpcPromise(_0xb5aa('0x73'),_0xb5aa('0x73'),{'event':_0xb5aa('0x74'),'message':_[_0xb5aa('0x50')](_0x5636c5[_0xb5aa('0x2c')],JSON[_0xb5aa('0x75')](_0x5636c5['interaction'][_0xb5aa('0x76')]))},client9002)['then'](function(){return _0x5636c5;});}return _0x5636c5;}return null;})[_0xb5aa('0x23')](respondWithResult(_0x52b99a,null))[_0xb5aa('0x2e')](handleError(_0x52b99a,null));};var interaction_log=require(_0xb5aa('0x13'))(_0xb5aa('0x5d'));exports[_0xb5aa('0x37')]=function(_0x4d4ec9,_0x46ff60,_0x3e20c6){var _0x55ebdc={'agent':{},'channel':_0xb5aa('0x5f')};if(_0x4d4ec9[_0xb5aa('0x5a')]['id']){delete _0x4d4ec9[_0xb5aa('0x5a')]['id'];}_0x4d4ec9[_0xb5aa('0x5a')][_0xb5aa('0x64')]=_0x4d4ec9[_0xb5aa('0x5a')][_0xb5aa('0x64')]||_0x4d4ec9[_0xb5aa('0x65')]['id'];_0x55ebdc['agent']['id']=_0x4d4ec9[_0xb5aa('0x5a')][_0xb5aa('0x64')];return db[_0xb5aa('0x51')][_0xb5aa('0x5b')]({'where':{'id':_0x4d4ec9[_0xb5aa('0x56')]['id'],'UserId':null}})[_0xb5aa('0x23')](handleEntityNotFound(_0x46ff60,null))[_0xb5aa('0x23')](function(_0x54d291){if(_0x54d291){_0x55ebdc[_0xb5aa('0x2c')]=_0x54d291[_0xb5aa('0x66')]({'plain':!![]});return db[_0xb5aa('0x67')]['find']({'where':{'id':_0x54d291[_0xb5aa('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x46ff60,null))['then'](function(_0x37d8b5){if(_0x37d8b5){_0x55ebdc[_0xb5aa('0x6a')]=_0x37d8b5[_0xb5aa('0x66')]({'plain':!![]});interaction_log['info'](_0xb5aa('0x77'),_0x4d4ec9[_0xb5aa('0x65')]['id'],_0x4d4ec9[_0xb5aa('0x65')]['name'],_0x4d4ec9[_0xb5aa('0x65')][_0xb5aa('0x6c')],_0x55ebdc[_0xb5aa('0x6a')]['id'],_0x4d4ec9[_0xb5aa('0x5a')]?JSON[_0xb5aa('0x29')](_0x4d4ec9[_0xb5aa('0x5a')]):_0xb5aa('0x6d'));return respondWithRpcPromise(_0xb5aa('0x78'),_0xb5aa('0x79'),_0x55ebdc);}return null;})[_0xb5aa('0x23')](function(_0x547d4a){if(_0x547d4a){_0x547d4a[_0xb5aa('0x2c')][_0xb5aa('0x6f')]=util[_0xb5aa('0x62')](_0xb5aa('0x70'),_0x4d4ec9[_0xb5aa('0x65')][_0xb5aa('0x3d')]);_0x547d4a['message'][_0xb5aa('0x71')]=_0x55ebdc[_0xb5aa('0x71')];_0x547d4a[_0xb5aa('0x2c')]['event']='reject';respondWithRpcPromise(_0xb5aa('0x73'),_0xb5aa('0x73'),{'event':_0xb5aa('0x7a'),'message':_0x547d4a[_0xb5aa('0x2c')]},client9002);return _0x55ebdc;}return null;})[_0xb5aa('0x23')](respondWithResult(_0x46ff60,null))[_0xb5aa('0x2e')](handleError(_0x46ff60,null));}; \ No newline at end of file +var _0x7192=['keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','map','key','VIRTUAL','field','merge','include','findAll','catch','show','params','includeAll','find','create','body','update','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','interaction','formData','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.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~!@#$%^&-_=+[{]}.','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','set','apply','save','then','destroy','stack','name','send','index','ChatMessage','rawAttributes'];(function(_0x424329,_0x1a3e61){var _0x324625=function(_0x3e2ce2){while(--_0x3e2ce2){_0x424329['push'](_0x424329['shift']());}};_0x324625(++_0x1a3e61);}(_0x7192,0x1b8));var _0x2719=function(_0x51dcb0,_0x287686){_0x51dcb0=_0x51dcb0-0x0;var _0x51d4c6=_0x7192[_0x51dcb0];return _0x51d4c6;};'use strict';var pdf=require(_0x2719('0x0'));var emlformat=require(_0x2719('0x1'));var rimraf=require(_0x2719('0x2'));var zipdir=require(_0x2719('0x3'));var jsonpatch=require(_0x2719('0x4'));var rp=require(_0x2719('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2719('0x6'));var util=require(_0x2719('0x7'));var path=require(_0x2719('0x8'));var sox=require(_0x2719('0x9'));var csv=require(_0x2719('0xa'));var ejs=require(_0x2719('0xb'));var fs=require('fs');var _=require(_0x2719('0xc'));var squel=require(_0x2719('0xd'));var crypto=require(_0x2719('0xe'));var jsforce=require(_0x2719('0xf'));var deskjs=require(_0x2719('0x10'));var toCsv=require(_0x2719('0xa'));var querystring=require(_0x2719('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2719('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x2719('0x13'));var logger=require(_0x2719('0x14'))(_0x2719('0x15'));var utils=require(_0x2719('0x16'));var config=require('../../config/environment');var db=require(_0x2719('0x17'))['db'];config[_0x2719('0x18')]=_[_0x2719('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2719('0x1a'))(new Redis(config['redis']));require(_0x2719('0x1b'))['register'](socket);var jayson=require(_0x2719('0x1c'));var client=jayson[_0x2719('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x2719('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x28d8c1,_0x4f4ea5,_0xa3ff9f){if(_0xa3ff9f){var _0x3175fa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3175fa[_0x2719('0x1e')](_0x4f4ea5)){return _0x28d8c1;}else{throw new db['Sequelize'][(_0x2719('0x1f'))](_0x2719('0x20'));}}else{return _0x28d8c1;}}function respondWithRpcPromise(_0x295b22,_0x244a24,_0x4a2954,_0x540f12){return new BPromise(function(_0x318c28,_0x46dc63){var _0x40cf69=_0x540f12||client;return _0x40cf69[_0x2719('0x21')](_0x295b22,_0x4a2954)['then'](function(_0xef393f){logger[_0x2719('0x22')](_0x2719('0x23'),_0x244a24,_0x2719('0x24'));logger[_0x2719('0x25')](_0x2719('0x26'),_0x244a24,_0x2719('0x24'),JSON[_0x2719('0x27')](_0xef393f));if(_0xef393f['error']){if(_0xef393f[_0x2719('0x28')][_0x2719('0x29')]===0x1f4){logger['error'](_0x2719('0x23'),_0x244a24,_0xef393f['error'][_0x2719('0x2a')]);return _0x46dc63(_0xef393f[_0x2719('0x28')][_0x2719('0x2a')]);}logger[_0x2719('0x28')](_0x2719('0x23'),_0x244a24,_0xef393f[_0x2719('0x28')]['message']);return _0x318c28(_0xef393f['error'][_0x2719('0x2a')]);}else{logger[_0x2719('0x22')](_0x2719('0x23'),_0x244a24,_0x2719('0x24'));_0x318c28(_0xef393f[_0x2719('0x2b')][_0x2719('0x2a')]);}})['catch'](function(_0x357a44){logger['error']('ChatMessage,\x20%s,\x20%s',_0x244a24,_0x357a44);_0x46dc63(_0x357a44);});});}function respondWithStatusCode(_0x1d9b39,_0x34024a){_0x34024a=_0x34024a||0xcc;return function(_0x4d1a9c){if(_0x4d1a9c){return _0x1d9b39[_0x2719('0x2c')](_0x34024a);}return _0x1d9b39[_0x2719('0x2d')](_0x34024a)[_0x2719('0x2e')]();};}function respondWithResult(_0x1f5104,_0x457dbd){_0x457dbd=_0x457dbd||0xc8;return function(_0x49a619){if(_0x49a619){return _0x1f5104['status'](_0x457dbd)[_0x2719('0x2f')](_0x49a619);}};}function respondWithFilteredResult(_0x3fdd92,_0x2ce00b){return function(_0x5b539e){if(_0x5b539e){var _0xdc2eb1=_0x5b539e[_0x2719('0x30')],_0x25e8b7=_0x2ce00b['offset'],_0x9d8af4=_0x2ce00b['offset']+_0x2ce00b['limit'],_0x31e96c;if(_0x9d8af4>=_0xdc2eb1){_0x9d8af4=_0xdc2eb1;_0x31e96c=0xc8;}else{_0x31e96c=0xce;}_0x3fdd92['status'](_0x31e96c);return _0x3fdd92[_0x2719('0x31')]('Content-Range',_0x25e8b7+'-'+_0x9d8af4+'/'+_0xdc2eb1)['json'](_0x5b539e);}return null;};}function patchUpdates(_0x16a11c){return function(_0x3d5751){try{jsonpatch[_0x2719('0x32')](_0x3d5751,_0x16a11c,!![]);}catch(_0x3db43e){return BPromise['reject'](_0x3db43e);}return _0x3d5751[_0x2719('0x33')]();};}function saveUpdates(_0x54cb05,_0x38f380){return function(_0x799dda){if(_0x799dda){return _0x799dda['update'](_0x54cb05)[_0x2719('0x34')](function(_0x4430bd){return _0x4430bd;});}return null;};}function removeEntity(_0x20e7ed,_0x4c4e5a){return function(_0x5b160a){if(_0x5b160a){return _0x5b160a[_0x2719('0x35')]()[_0x2719('0x34')](function(){_0x20e7ed['status'](0xcc)[_0x2719('0x2e')]();});}};}function handleEntityNotFound(_0x457f8d,_0x4ca4e2){return function(_0x1d54ff){if(!_0x1d54ff){_0x457f8d[_0x2719('0x2c')](0x194);}return _0x1d54ff;};}function handleError(_0x2c7d77,_0x3a52e0){_0x3a52e0=_0x3a52e0||0x1f4;return function(_0x28bde0){logger['error'](_0x28bde0[_0x2719('0x36')]);if(_0x28bde0[_0x2719('0x37')]){delete _0x28bde0['name'];}_0x2c7d77[_0x2719('0x2d')](_0x3a52e0)[_0x2719('0x38')](_0x28bde0);};}exports[_0x2719('0x39')]=function(_0x5007e4,_0x4ae76d){var _0x396ea4={},_0x288d1a={},_0x4735be={'count':0x0,'rows':[]};var _0xacb3b5=db[_0x2719('0x3a')][_0x2719('0x3b')];_0x288d1a['model']=_[_0x2719('0x3c')](_0xacb3b5);_0x288d1a[_0x2719('0x3d')]=_[_0x2719('0x3c')](_0x5007e4[_0x2719('0x3d')]);_0x288d1a[_0x2719('0x3e')]=_[_0x2719('0x3f')](_0x288d1a[_0x2719('0x40')],_0x288d1a[_0x2719('0x3d')]);_0x396ea4['attributes']=_['intersection'](_0x288d1a[_0x2719('0x40')],qs[_0x2719('0x41')](_0x5007e4['query'][_0x2719('0x41')]));_0x396ea4[_0x2719('0x42')]=_0x396ea4[_0x2719('0x42')]['length']?_0x396ea4['attributes']:_0x288d1a[_0x2719('0x40')];if(!_0x5007e4[_0x2719('0x3d')][_0x2719('0x43')](_0x2719('0x44'))){_0x396ea4['limit']=qs[_0x2719('0x45')](_0x5007e4['query'][_0x2719('0x45')]);_0x396ea4[_0x2719('0x46')]=qs[_0x2719('0x46')](_0x5007e4[_0x2719('0x3d')][_0x2719('0x46')]);}_0x396ea4[_0x2719('0x47')]=qs[_0x2719('0x48')](_0x5007e4[_0x2719('0x3d')][_0x2719('0x48')]);_0x396ea4[_0x2719('0x49')]=qs[_0x2719('0x3e')](_[_0x2719('0x4a')](_0x5007e4[_0x2719('0x3d')],_0x288d1a[_0x2719('0x3e')]));if(_0x5007e4[_0x2719('0x3d')][_0x2719('0x4b')]){_0x396ea4['where']=_['merge'](_0x396ea4['where'],{'$or':_[_0x2719('0x4c')](_0xacb3b5,function(_0x1b3579){if(_0x1b3579['type'][_0x2719('0x4d')]!==_0x2719('0x4e')){var _0x220054={};_0x220054[_0x1b3579[_0x2719('0x4f')]]={'$like':'%'+_0x5007e4[_0x2719('0x3d')][_0x2719('0x4b')]+'%'};return _0x220054;}})});}_0x396ea4=_[_0x2719('0x50')]({},_0x396ea4,_0x5007e4['options']);var _0x54db10={'where':_0x396ea4['where']};return db[_0x2719('0x3a')]['count'](_0x54db10)['then'](function(_0x3e3c3d){_0x4735be[_0x2719('0x30')]=_0x3e3c3d;if(_0x5007e4[_0x2719('0x3d')]['includeAll']){_0x396ea4[_0x2719('0x51')]=[{'all':!![]}];}return db[_0x2719('0x3a')][_0x2719('0x52')](_0x396ea4);})['then'](function(_0x3f40aa){_0x4735be['rows']=_0x3f40aa;return _0x4735be;})[_0x2719('0x34')](respondWithFilteredResult(_0x4ae76d,_0x396ea4))[_0x2719('0x53')](handleError(_0x4ae76d,null));};exports[_0x2719('0x54')]=function(_0x105a56,_0x40439a){var _0x40274c={'raw':!![],'where':{'id':_0x105a56[_0x2719('0x55')]['id']}},_0x129e5d={};_0x129e5d[_0x2719('0x40')]=_['keys'](db[_0x2719('0x3a')]['rawAttributes']);_0x129e5d[_0x2719('0x3d')]=_['keys'](_0x105a56[_0x2719('0x3d')]);_0x129e5d[_0x2719('0x3e')]=_[_0x2719('0x3f')](_0x129e5d[_0x2719('0x40')],_0x129e5d[_0x2719('0x3d')]);_0x40274c[_0x2719('0x42')]=_[_0x2719('0x3f')](_0x129e5d[_0x2719('0x40')],qs[_0x2719('0x41')](_0x105a56[_0x2719('0x3d')][_0x2719('0x41')]));_0x40274c[_0x2719('0x42')]=_0x40274c[_0x2719('0x42')]['length']?_0x40274c[_0x2719('0x42')]:_0x129e5d[_0x2719('0x40')];if(_0x105a56['query'][_0x2719('0x56')]){_0x40274c[_0x2719('0x51')]=[{'all':!![]}];}_0x40274c=_[_0x2719('0x50')]({},_0x40274c,_0x105a56['options']);return db[_0x2719('0x3a')][_0x2719('0x57')](_0x40274c)[_0x2719('0x34')](handleEntityNotFound(_0x40439a,null))['then'](respondWithResult(_0x40439a,null))[_0x2719('0x53')](handleError(_0x40439a,null));};exports['create']=function(_0x11d2da,_0x2ad6ce){return db[_0x2719('0x3a')][_0x2719('0x58')](_0x11d2da[_0x2719('0x59')],{})[_0x2719('0x34')](respondWithResult(_0x2ad6ce,0xc9))[_0x2719('0x53')](handleError(_0x2ad6ce,null));};exports[_0x2719('0x5a')]=function(_0x14104f,_0xcc2150){if(_0x14104f[_0x2719('0x59')]['id']){delete _0x14104f[_0x2719('0x59')]['id'];}return db['ChatMessage'][_0x2719('0x57')]({'where':{'id':_0x14104f['params']['id']}})[_0x2719('0x34')](handleEntityNotFound(_0xcc2150,null))[_0x2719('0x34')](saveUpdates(_0x14104f[_0x2719('0x59')],null))[_0x2719('0x34')](respondWithResult(_0xcc2150,null))[_0x2719('0x53')](handleError(_0xcc2150,null));};exports[_0x2719('0x35')]=function(_0x214dbb,_0x1730ea){return db[_0x2719('0x3a')]['find']({'where':{'id':_0x214dbb[_0x2719('0x55')]['id']}})[_0x2719('0x34')](handleEntityNotFound(_0x1730ea,null))['then'](removeEntity(_0x1730ea,null))[_0x2719('0x53')](handleError(_0x1730ea,null));};exports['describe']=function(_0x3e07e7,_0x308f80){return db[_0x2719('0x3a')][_0x2719('0x5b')]()['then'](respondWithResult(_0x308f80,null))[_0x2719('0x53')](handleError(_0x308f80,null));};var interaction_log=require(_0x2719('0x14'))(_0x2719('0x5c'));exports[_0x2719('0x5d')]=function(_0x816983,_0x4a41e6,_0x2d5d37){var _0x3ad46d={'channel':_0x2719('0x5e')};if(_0x816983[_0x2719('0x59')]['id']){delete _0x816983['body']['id'];}_0x816983['body'][_0x2719('0x5f')]=!![];_0x816983['body']['readAt']=moment()[_0x2719('0x60')](_0x2719('0x61'));_0x816983[_0x2719('0x59')][_0x2719('0x62')]=_0x816983['body']['UserId']||_0x816983[_0x2719('0x63')]['id'];return db['ChatMessage'][_0x2719('0x57')]({'where':{'id':_0x816983[_0x2719('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x2719('0x64')],'as':_0x2719('0x65')}]})[_0x2719('0x34')](handleEntityNotFound(_0x4a41e6,null))[_0x2719('0x34')](saveUpdates(_0x816983['body'],null))[_0x2719('0x34')](function(_0x3dcb7d){if(_0x3dcb7d){_0x3ad46d[_0x2719('0x2a')]=_0x3dcb7d[_0x2719('0x66')]({'plain':!![]});return db[_0x2719('0x67')]['find']({'where':{'id':_0x3dcb7d[_0x2719('0x68')]}});}return null;})[_0x2719('0x34')](handleEntityNotFound(_0x4a41e6,null))['then'](function(_0x37dff3){if(_0x37dff3){return _0x37dff3['update']({'UserId':_0x816983[_0x2719('0x59')]['UserId'],'read1stAt':_['isNil'](_0x37dff3['read1stAt'])?moment()[_0x2719('0x60')](_0x2719('0x61')):undefined});}return null;})['then'](function(_0x1b59c9){if(_0x1b59c9){_0x3ad46d['interaction']=_0x1b59c9[_0x2719('0x66')]({'plain':!![]});interaction_log['info'](_0x2719('0x69'),_0x816983[_0x2719('0x63')]['id'],_0x816983['user'][_0x2719('0x37')],_0x816983[_0x2719('0x63')][_0x2719('0x6a')],_0x3ad46d['interaction']['id'],_0x816983[_0x2719('0x59')]?JSON[_0x2719('0x27')](_0x816983[_0x2719('0x59')]):_0x2719('0x6b'));return respondWithRpcPromise(_0x2719('0x6c'),_0x2719('0x6d'),_0x3ad46d);}return null;})[_0x2719('0x34')](function(_0x469c8c){if(_0x469c8c){if(_0x816983[_0x2719('0x59')][_0x2719('0x6e')]){_0x3ad46d[_0x2719('0x2a')][_0x2719('0x6f')]=util[_0x2719('0x60')](_0x2719('0x70'),_0x816983[_0x2719('0x63')]['name']);_0x3ad46d['message'][_0x2719('0x71')]=_0x3ad46d[_0x2719('0x71')];_0x3ad46d[_0x2719('0x2a')][_0x2719('0x72')]=_0x2719('0x5d');return respondWithRpcPromise(_0x2719('0x73'),_0x2719('0x73'),{'event':_0x2719('0x74'),'message':_[_0x2719('0x50')](_0x3ad46d[_0x2719('0x2a')],JSON[_0x2719('0x75')](_0x3ad46d[_0x2719('0x76')][_0x2719('0x77')]))},client9002)[_0x2719('0x34')](function(){return _0x3ad46d;});}return _0x3ad46d;}return null;})['then'](respondWithResult(_0x4a41e6,null))[_0x2719('0x53')](handleError(_0x4a41e6,null));};var interaction_log=require(_0x2719('0x14'))('chat-interactions');exports[_0x2719('0x78')]=function(_0x41af74,_0x10cb5e,_0x3dcd98){var _0x20cf19={'agent':{},'channel':'chat'};if(_0x41af74[_0x2719('0x59')]['id']){delete _0x41af74['body']['id'];}_0x41af74[_0x2719('0x59')][_0x2719('0x62')]=_0x41af74[_0x2719('0x59')][_0x2719('0x62')]||_0x41af74[_0x2719('0x63')]['id'];_0x20cf19[_0x2719('0x79')]['id']=_0x41af74[_0x2719('0x59')][_0x2719('0x62')];return db['ChatMessage'][_0x2719('0x57')]({'where':{'id':_0x41af74[_0x2719('0x55')]['id'],'UserId':null}})[_0x2719('0x34')](handleEntityNotFound(_0x10cb5e,null))[_0x2719('0x34')](function(_0x256655){if(_0x256655){_0x20cf19[_0x2719('0x2a')]=_0x256655[_0x2719('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x2719('0x57')]({'where':{'id':_0x256655['ChatInteractionId']}});}return null;})[_0x2719('0x34')](handleEntityNotFound(_0x10cb5e,null))['then'](function(_0x28350c){if(_0x28350c){_0x20cf19[_0x2719('0x76')]=_0x28350c['get']({'plain':!![]});interaction_log[_0x2719('0x22')](_0x2719('0x7a'),_0x41af74[_0x2719('0x63')]['id'],_0x41af74[_0x2719('0x63')]['name'],_0x41af74[_0x2719('0x63')][_0x2719('0x6a')],_0x20cf19['interaction']['id'],_0x41af74[_0x2719('0x59')]?JSON[_0x2719('0x27')](_0x41af74[_0x2719('0x59')]):_0x2719('0x6b'));return respondWithRpcPromise(_0x2719('0x7b'),_0x2719('0x7c'),_0x20cf19);}return null;})['then'](function(_0x160aae){if(_0x160aae){_0x160aae[_0x2719('0x2a')]['interface']=util['format']('SIP/%s',_0x41af74[_0x2719('0x63')][_0x2719('0x37')]);_0x160aae[_0x2719('0x2a')][_0x2719('0x71')]=_0x20cf19[_0x2719('0x71')];_0x160aae[_0x2719('0x2a')][_0x2719('0x72')]=_0x2719('0x78');respondWithRpcPromise('EventManager',_0x2719('0x73'),{'event':'rejectmessage','message':_0x160aae['message']},client9002);return _0x20cf19;}return null;})[_0x2719('0x34')](respondWithResult(_0x10cb5e,null))['catch'](handleError(_0x10cb5e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index d7b1e73..dabc599 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 _0x2e2e=['update','remove','hook','events','ChatMessage','save'];(function(_0x1792aa,_0x296e8f){var _0x217c51=function(_0x1ad423){while(--_0x1ad423){_0x1792aa['push'](_0x1792aa['shift']());}};_0x217c51(++_0x296e8f);}(_0x2e2e,0x11d));var _0xe2e2=function(_0x5f2205,_0x595d35){_0x5f2205=_0x5f2205-0x0;var _0xed9401=_0x2e2e[_0x5f2205];return _0xed9401;};'use strict';var EventEmitter=require(_0xe2e2('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xe2e2('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe2e2('0x2'),'afterUpdate':_0xe2e2('0x3'),'afterDestroy':_0xe2e2('0x4')};function emitEvent(_0x51bc89){return function(_0x18fa6b,_0x364f11,_0x37aa76){ChatMessageEvents['emit'](_0x51bc89+':'+_0x18fa6b['id'],_0x18fa6b);ChatMessageEvents['emit'](_0x51bc89,_0x18fa6b);_0x37aa76(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xe2e2('0x5')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xdcd9=['../../mysqldb','ChatMessage','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0xdcd9,0x170));var _0x9dcd=function(_0x2a418b,_0x23a09e){_0x2a418b=_0x2a418b-0x0;var _0x4152ad=_0xdcd9[_0x2a418b];return _0x4152ad;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x9dcd('0x0'))['db'][_0x9dcd('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9dcd('0x2')](0x0);var events={'afterCreate':_0x9dcd('0x3'),'afterUpdate':'update','afterDestroy':_0x9dcd('0x4')};function emitEvent(_0x450450){return function(_0x57f078,_0x2f1e02,_0x57f6f0){ChatMessageEvents['emit'](_0x450450+':'+_0x57f078['id'],_0x57f078);ChatMessageEvents[_0x9dcd('0x5')](_0x450450,_0x57f078);_0x57f6f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x9dcd('0x6')](e,emitEvent(event));}}module[_0x9dcd('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a602a00..94e2cae 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 _0xedd2=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xedd2,0x153));var _0x2edd=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xedd2[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x2edd('0x0'));var util=require(_0x2edd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2edd('0x2'));var BPromise=require(_0x2edd('0x3'));var rp=require(_0x2edd('0x4'));var fs=require('fs');var path=require(_0x2edd('0x5'));var rimraf=require('rimraf');var config=require(_0x2edd('0x6'));var attributes=require(_0x2edd('0x7'));module['exports']=function(_0xdfacba,_0x5186ee){return _0xdfacba['define'](_0x2edd('0x8'),attributes,{'tableName':_0x2edd('0x9'),'paranoid':![],'indexes':[{'name':_0x2edd('0xa'),'fields':[_0x2edd('0xb')],'type':_0x2edd('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf4581b,_0x261f4b,_0x290cd7){var _0x5350ea=_0xdfacba[_0x2edd('0xd')];var _0xa59228=_0xf4581b[_0x2edd('0xe')]({'plain':!![]});if(_0xa59228[_0x2edd('0xf')]['toLowerCase']()==='in'||_0xa59228[_0x2edd('0xf')][_0x2edd('0x10')]()==='out'&&!_0xa59228[_0x2edd('0x11')]&&!_[_0x2edd('0x12')](_0xa59228[_0x2edd('0x13')])){_0x5350ea[_0x2edd('0x14')]['findOne']({'where':{'id':_0xa59228[_0x2edd('0x15')]}})[_0x2edd('0x16')](function(_0x2efd35){if(_0x2efd35){_0x2efd35[_0x2edd('0x17')]({'lastMsgAt':_0xa59228[_0x2edd('0x18')],'lastMsgDirection':_0xa59228['direction'][_0x2edd('0x10')]()});}})[_0x2edd('0x19')](function(_0x2c9529){console['error'](_0x2c9529);});}_0x290cd7();}},'charset':_0x2edd('0x1a'),'collate':_0x2edd('0x1b')});}; \ No newline at end of file +var _0xd006=['error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','./chatMessage.attributes','exports','ChatMessage','chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','createdAt','catch'];(function(_0x4f39ff,_0x52d156){var _0x45690d=function(_0x21d033){while(--_0x21d033){_0x4f39ff['push'](_0x4f39ff['shift']());}};_0x45690d(++_0x52d156);}(_0xd006,0x1f0));var _0x6d00=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xd006[_0x590a38];return _0xf36626;};'use strict';var _=require(_0x6d00('0x0'));var util=require(_0x6d00('0x1'));var logger=require(_0x6d00('0x2'))('api');var moment=require(_0x6d00('0x3'));var BPromise=require(_0x6d00('0x4'));var rp=require(_0x6d00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d00('0x6'));module[_0x6d00('0x7')]=function(_0x5ea3a3,_0x1cd2a4){return _0x5ea3a3['define'](_0x6d00('0x8'),attributes,{'tableName':_0x6d00('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x6d00('0xa')],'type':_0x6d00('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x218827,_0xecd3d4,_0x108c6a){var _0x4ba007=_0x5ea3a3[_0x6d00('0xc')];var _0x32e550=_0x218827['get']({'plain':!![]});if(_0x32e550[_0x6d00('0xd')][_0x6d00('0xe')]()==='in'||_0x32e550['direction']['toLowerCase']()===_0x6d00('0xf')&&!_0x32e550[_0x6d00('0x10')]&&!_[_0x6d00('0x11')](_0x32e550[_0x6d00('0x12')])){_0x4ba007[_0x6d00('0x13')]['findOne']({'where':{'id':_0x32e550[_0x6d00('0x14')]}})[_0x6d00('0x15')](function(_0x47defc){if(_0x47defc){_0x47defc['update']({'lastMsgAt':_0x32e550[_0x6d00('0x16')],'lastMsgDirection':_0x32e550[_0x6d00('0xd')][_0x6d00('0xe')]()});}})[_0x6d00('0x17')](function(_0x5bf2cb){console[_0x6d00('0x18')](_0x5bf2cb);});}_0x108c6a();}},'charset':'utf8mb4','collate':_0x6d00('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 43bd138..87fc2aa 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 _0xc3e4=['raw','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','create','options'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc3e4,0x136));var _0x4c3e=function(_0x3bf94b,_0x388336){_0x3bf94b=_0x3bf94b-0x0;var _0x5cdcd8=_0xc3e4[_0x3bf94b];return _0x5cdcd8;};'use strict';var _=require(_0x4c3e('0x0'));var util=require(_0x4c3e('0x1'));var moment=require(_0x4c3e('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(_0x4c3e('0x3'));var logger=require(_0x4c3e('0x4'))(_0x4c3e('0x5'));var config=require(_0x4c3e('0x6'));var jayson=require(_0x4c3e('0x7'));var client=jayson['client'][_0x4c3e('0x8')]({'port':0x232a});config[_0x4c3e('0x9')]=_[_0x4c3e('0xa')](config[_0x4c3e('0x9')],{'host':_0x4c3e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c3e('0x9')]));require('./chatMessage.socket')[_0x4c3e('0xc')](socket);function respondWithRpcPromise(_0x352dc3,_0x27451e,_0x28c553){return new BPromise(function(_0x6d02a1,_0x235c1b){return client['request'](_0x352dc3,_0x28c553)['then'](function(_0x3f6612){logger[_0x4c3e('0xd')](_0x4c3e('0xe'),_0x27451e,_0x4c3e('0xf'));logger[_0x4c3e('0x10')](_0x4c3e('0x11'),_0x27451e,_0x4c3e('0xf'),JSON[_0x4c3e('0x12')](_0x3f6612));if(_0x3f6612[_0x4c3e('0x13')]){if(_0x3f6612[_0x4c3e('0x13')][_0x4c3e('0x14')]===0x1f4){logger[_0x4c3e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x27451e,_0x3f6612[_0x4c3e('0x13')]['message']);return _0x235c1b(_0x3f6612['error'][_0x4c3e('0x15')]);}logger[_0x4c3e('0x13')](_0x4c3e('0xe'),_0x27451e,_0x3f6612['error'][_0x4c3e('0x15')]);return _0x6d02a1(_0x3f6612['error'][_0x4c3e('0x15')]);}else{logger[_0x4c3e('0xd')](_0x4c3e('0xe'),_0x27451e,'request\x20sent');_0x6d02a1(_0x3f6612[_0x4c3e('0x16')][_0x4c3e('0x15')]);}})['catch'](function(_0x2f3d65){logger[_0x4c3e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x27451e,_0x2f3d65);_0x235c1b(_0x2f3d65);});});}exports[_0x4c3e('0x17')]=function(_0xe0bf89){var _0x281f1f=this;return new Promise(function(_0x35861d,_0x34da78){return db['ChatMessage'][_0x4c3e('0x18')](_0xe0bf89['body'],{'raw':_0xe0bf89[_0x4c3e('0x19')]?_0xe0bf89[_0x4c3e('0x19')][_0x4c3e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x468689){logger[_0x4c3e('0xd')](_0x4c3e('0x17'),_0xe0bf89);logger[_0x4c3e('0x10')]('CreateChatMessage',_0xe0bf89,JSON[_0x4c3e('0x12')](_0x468689));_0x35861d(_0x468689);})[_0x4c3e('0x1b')](function(_0x274cf5){logger['error'](_0x4c3e('0x17'),_0x274cf5[_0x4c3e('0x15')],_0xe0bf89);_0x34da78(_0x281f1f[_0x4c3e('0x13')](0x1f4,_0x274cf5[_0x4c3e('0x15')]));});});}; \ No newline at end of file +var _0x8d6b=['ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateChatMessage','ChatMessage','create','body','options','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d6b,0x12c));var _0xb8d6=function(_0x180ab4,_0xa35f6){_0x180ab4=_0x180ab4-0x0;var _0x1d96e3=_0x8d6b[_0x180ab4];return _0x1d96e3;};'use strict';var _=require(_0xb8d6('0x0'));var util=require(_0xb8d6('0x1'));var moment=require('moment');var BPromise=require(_0xb8d6('0x2'));var rs=require(_0xb8d6('0x3'));var fs=require('fs');var Redis=require(_0xb8d6('0x4'));var db=require(_0xb8d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8d6('0x6'))(_0xb8d6('0x7'));var config=require(_0xb8d6('0x8'));var jayson=require(_0xb8d6('0x9'));var client=jayson[_0xb8d6('0xa')][_0xb8d6('0xb')]({'port':0x232a});config[_0xb8d6('0xc')]=_['defaults'](config[_0xb8d6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8d6('0xd'))(new Redis(config[_0xb8d6('0xc')]));require(_0xb8d6('0xe'))['register'](socket);function respondWithRpcPromise(_0x57c9b4,_0x198964,_0x1859f0){return new BPromise(function(_0x229600,_0x5000ce){return client[_0xb8d6('0xf')](_0x57c9b4,_0x1859f0)[_0xb8d6('0x10')](function(_0x5c5257){logger[_0xb8d6('0x11')](_0xb8d6('0x12'),_0x198964,'request\x20sent');logger[_0xb8d6('0x13')](_0xb8d6('0x14'),_0x198964,_0xb8d6('0x15'),JSON[_0xb8d6('0x16')](_0x5c5257));if(_0x5c5257[_0xb8d6('0x17')]){if(_0x5c5257['error']['code']===0x1f4){logger['error'](_0xb8d6('0x12'),_0x198964,_0x5c5257[_0xb8d6('0x17')][_0xb8d6('0x18')]);return _0x5000ce(_0x5c5257[_0xb8d6('0x17')][_0xb8d6('0x18')]);}logger[_0xb8d6('0x17')](_0xb8d6('0x12'),_0x198964,_0x5c5257['error']['message']);return _0x229600(_0x5c5257[_0xb8d6('0x17')][_0xb8d6('0x18')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x198964,_0xb8d6('0x15'));_0x229600(_0x5c5257[_0xb8d6('0x19')][_0xb8d6('0x18')]);}})['catch'](function(_0x283457){logger['error']('ChatMessage,\x20%s,\x20%s',_0x198964,_0x283457);_0x5000ce(_0x283457);});});}exports[_0xb8d6('0x1a')]=function(_0xe37704){var _0x5715da=this;return new Promise(function(_0x6630c1,_0x215a6f){return db[_0xb8d6('0x1b')][_0xb8d6('0x1c')](_0xe37704[_0xb8d6('0x1d')],{'raw':_0xe37704['options']?_0xe37704[_0xb8d6('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb8d6('0x10')](function(_0x213306){logger[_0xb8d6('0x11')](_0xb8d6('0x1a'),_0xe37704);logger['debug']('CreateChatMessage',_0xe37704,JSON[_0xb8d6('0x16')](_0x213306));_0x6630c1(_0x213306);})[_0xb8d6('0x1f')](function(_0x46ef1){logger[_0xb8d6('0x17')](_0xb8d6('0x1a'),_0x46ef1[_0xb8d6('0x18')],_0xe37704);_0x215a6f(_0x5715da[_0xb8d6('0x17')](0x1f4,_0x46ef1[_0xb8d6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e8122d6..6b196cf 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 _0x2ef3=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x4d0c01,_0x3f0d88){var _0x39295a=function(_0xc93765){while(--_0xc93765){_0x4d0c01['push'](_0x4d0c01['shift']());}};_0x39295a(++_0x3f0d88);}(_0x2ef3,0xba));var _0x32ef=function(_0x556da4,_0x482991){_0x556da4=_0x556da4-0x0;var _0x5e695e=_0x2ef3[_0x556da4];return _0x5e695e;};'use strict';var ChatMessageEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){ChatMessageEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);ChatMessageEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0xd117=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x2caddc,_0x12ec6c){var _0x2098a5=function(_0x2edf03){while(--_0x2edf03){_0x2caddc['push'](_0x2caddc['shift']());}};_0x2098a5(++_0x12ec6c);}(_0xd117,0x182));var _0x7d11=function(_0x1103c4,_0x562d1d){_0x1103c4=_0x1103c4-0x0;var _0x1c19ab=_0xd117[_0x1103c4];return _0x1c19ab;};'use strict';var ChatMessageEvents=require(_0x7d11('0x0'));var events=[_0x7d11('0x1'),_0x7d11('0x2'),_0x7d11('0x3')];function createListener(_0x454387,_0x26e0f0){return function(_0x306ae4){_0x26e0f0[_0x7d11('0x4')](_0x454387,_0x306ae4);};}function removeListener(_0x3c07be,_0x31fcb0){return function(){ChatMessageEvents[_0x7d11('0x5')](_0x3c07be,_0x31fcb0);};}exports[_0x7d11('0x6')]=function(_0x27d7e8){for(var _0x40c3c4=0x0,_0x345602=events[_0x7d11('0x7')];_0x40c3c4<_0x345602;_0x40c3c4++){var _0x47b5e6=events[_0x40c3c4];var _0x3803b5=createListener(_0x7d11('0x8')+_0x47b5e6,_0x27d7e8);ChatMessageEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 44e92df..49bacdc 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 _0x07ca=['show','post','tracked','chat','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x07ca,0x78));var _0xa07c=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x07ca[_0xb65e77];return _0x38134b;};'use strict';var multer=require(_0xa07c('0x0'));var util=require(_0xa07c('0x1'));var path=require(_0xa07c('0x2'));var timeout=require(_0xa07c('0x3'));var express=require(_0xa07c('0x4'));var router=express[_0xa07c('0x5')]();var auth=require(_0xa07c('0x6'));var interaction=require(_0xa07c('0x7'));var config=require(_0xa07c('0x8'));var controller=require(_0xa07c('0x9'));router[_0xa07c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa07c('0xb'),auth[_0xa07c('0xc')](),controller[_0xa07c('0xd')]);router[_0xa07c('0xa')](_0xa07c('0xe'),auth[_0xa07c('0xc')](),controller[_0xa07c('0xf')]);router[_0xa07c('0x10')]('/',auth[_0xa07c('0xc')](),interaction[_0xa07c('0x11')](_0xa07c('0x12'),'chatmessage:create'),controller[_0xa07c('0x13')]);router[_0xa07c('0x14')](_0xa07c('0xe'),controller[_0xa07c('0x15')]);router[_0xa07c('0x14')](_0xa07c('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xa07c('0x14')](_0xa07c('0x17'),auth[_0xa07c('0xc')](),controller[_0xa07c('0x18')]);router[_0xa07c('0x19')](_0xa07c('0xe'),auth[_0xa07c('0xc')](),controller[_0xa07c('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x89e8=['/:id/accept','/:id/reject','reject','delete','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','index','/describe','isAuthenticated','post','chat','chatmessage:create','create','put','update'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x89e8,0x66));var _0x889e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x89e8[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x889e('0x0'));var path=require(_0x889e('0x1'));var timeout=require(_0x889e('0x2'));var express=require(_0x889e('0x3'));var router=express[_0x889e('0x4')]();var auth=require(_0x889e('0x5'));var interaction=require(_0x889e('0x6'));var config=require('../../config/environment');var controller=require(_0x889e('0x7'));router[_0x889e('0x8')]('/',auth['isAuthenticated'](),controller[_0x889e('0x9')]);router['get'](_0x889e('0xa'),auth[_0x889e('0xb')](),controller['describe']);router[_0x889e('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x889e('0xc')]('/',auth[_0x889e('0xb')](),interaction['tracked'](_0x889e('0xd'),_0x889e('0xe')),controller[_0x889e('0xf')]);router[_0x889e('0x10')]('/:id',controller[_0x889e('0x11')]);router[_0x889e('0x10')](_0x889e('0x12'),auth['isAuthenticated'](),controller['accept']);router[_0x889e('0x10')](_0x889e('0x13'),auth[_0x889e('0xb')](),controller[_0x889e('0x14')]);router[_0x889e('0x15')](_0x889e('0x16'),auth[_0x889e('0xb')](),controller[_0x889e('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9f0cf9c..20fabab 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 _0x2d21=['medium','exports','TEXT'];(function(_0x5a8e99,_0xf41073){var _0x260e1c=function(_0x1447b6){while(--_0x1447b6){_0x5a8e99['push'](_0x5a8e99['shift']());}};_0x260e1c(++_0xf41073);}(_0x2d21,0x157));var _0x12d2=function(_0x212dad,_0xb862ef){_0x212dad=_0x212dad-0x0;var _0x4fea3f=_0x2d21[_0x212dad];return _0x4fea3f;};'use strict';var Sequelize=require('sequelize');module[_0x12d2('0x0')]={'body':{'type':Sequelize[_0x12d2('0x1')](_0x12d2('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x1069=['sequelize','exports','TEXT','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1069,0x17c));var _0x9106=function(_0x4cffd5,_0x57d52b){_0x4cffd5=_0x4cffd5-0x0;var _0x3b2779=_0x1069[_0x4cffd5];return _0x3b2779;};'use strict';var Sequelize=require(_0x9106('0x0'));module[_0x9106('0x1')]={'body':{'type':Sequelize[_0x9106('0x2')](_0x9106('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index f97dc3a..24f93de 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 _0x7409=['rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','ChatOfflineMessage','count','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','json','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send'];(function(_0x491612,_0x169abd){var _0x1432a2=function(_0x10edc9){while(--_0x10edc9){_0x491612['push'](_0x491612['shift']());}};_0x1432a2(++_0x169abd);}(_0x7409,0x6e));var _0x9740=function(_0x454db3,_0xcd150e){_0x454db3=_0x454db3-0x0;var _0x3b36da=_0x7409[_0x454db3];return _0x3b36da;};'use strict';var pdf=require(_0x9740('0x0'));var emlformat=require(_0x9740('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9740('0x2'));var jsonpatch=require(_0x9740('0x3'));var rp=require(_0x9740('0x4'));var moment=require(_0x9740('0x5'));var BPromise=require(_0x9740('0x6'));var Mustache=require(_0x9740('0x7'));var util=require(_0x9740('0x8'));var path=require(_0x9740('0x9'));var sox=require(_0x9740('0xa'));var csv=require('to-csv');var ejs=require(_0x9740('0xb'));var fs=require('fs');var _=require(_0x9740('0xc'));var squel=require(_0x9740('0xd'));var crypto=require('crypto');var jsforce=require(_0x9740('0xe'));var deskjs=require(_0x9740('0xf'));var toCsv=require(_0x9740('0x10'));var querystring=require('querystring');var Papa=require(_0x9740('0x11'));var Redis=require('ioredis');var authService=require(_0x9740('0x12'));var qs=require(_0x9740('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9740('0x14'));var config=require(_0x9740('0x15'));var db=require(_0x9740('0x16'))['db'];function respondWithStatusCode(_0x584ef0,_0x5d9c6c){_0x5d9c6c=_0x5d9c6c||0xcc;return function(_0x5263b3){if(_0x5263b3){return _0x584ef0['sendStatus'](_0x5d9c6c);}return _0x584ef0['status'](_0x5d9c6c)['end']();};}function respondWithResult(_0x52298c,_0x20b27b){_0x20b27b=_0x20b27b||0xc8;return function(_0x4d50ad){if(_0x4d50ad){return _0x52298c['status'](_0x20b27b)[_0x9740('0x17')](_0x4d50ad);}};}function respondWithFilteredResult(_0x581a72,_0x34cc50){return function(_0x1d4aa8){if(_0x1d4aa8){var _0x3c20ec=_0x1d4aa8['count'],_0x217a52=_0x34cc50[_0x9740('0x18')],_0x480af9=_0x34cc50[_0x9740('0x18')]+_0x34cc50[_0x9740('0x19')],_0x32edbf;if(_0x480af9>=_0x3c20ec){_0x480af9=_0x3c20ec;_0x32edbf=0xc8;}else{_0x32edbf=0xce;}_0x581a72[_0x9740('0x1a')](_0x32edbf);return _0x581a72[_0x9740('0x1b')](_0x9740('0x1c'),_0x217a52+'-'+_0x480af9+'/'+_0x3c20ec)[_0x9740('0x17')](_0x1d4aa8);}return null;};}function patchUpdates(_0x1c8210){return function(_0x206c4d){try{jsonpatch['apply'](_0x206c4d,_0x1c8210,!![]);}catch(_0x28e655){return BPromise[_0x9740('0x1d')](_0x28e655);}return _0x206c4d[_0x9740('0x1e')]();};}function saveUpdates(_0x31d4f7,_0x3f9e9d){return function(_0xdf62fc){if(_0xdf62fc){return _0xdf62fc[_0x9740('0x1f')](_0x31d4f7)[_0x9740('0x20')](function(_0x56766c){return _0x56766c;});}return null;};}function removeEntity(_0x351f5c,_0x47b7f1){return function(_0x1f8a78){if(_0x1f8a78){return _0x1f8a78[_0x9740('0x21')]()[_0x9740('0x20')](function(){_0x351f5c[_0x9740('0x1a')](0xcc)[_0x9740('0x22')]();});}};}function handleEntityNotFound(_0x34af43,_0x4e4627){return function(_0x2550f2){if(!_0x2550f2){_0x34af43[_0x9740('0x23')](0x194);}return _0x2550f2;};}function handleError(_0xa24326,_0x617a14){_0x617a14=_0x617a14||0x1f4;return function(_0x2a6965){logger[_0x9740('0x24')](_0x2a6965[_0x9740('0x25')]);if(_0x2a6965[_0x9740('0x26')]){delete _0x2a6965[_0x9740('0x26')];}_0xa24326['status'](_0x617a14)[_0x9740('0x27')](_0x2a6965);};}exports['index']=function(_0x4e5074,_0x4b8d88){var _0x4d2e0d={},_0x414b2f={},_0x169d65={'count':0x0,'rows':[]};var _0x127342=db['ChatOfflineMessage'][_0x9740('0x28')];_0x414b2f[_0x9740('0x29')]=_[_0x9740('0x2a')](_0x127342);_0x414b2f[_0x9740('0x2b')]=_['keys'](_0x4e5074[_0x9740('0x2b')]);_0x414b2f[_0x9740('0x2c')]=_[_0x9740('0x2d')](_0x414b2f['model'],_0x414b2f[_0x9740('0x2b')]);_0x4d2e0d[_0x9740('0x2e')]=_[_0x9740('0x2d')](_0x414b2f[_0x9740('0x29')],qs[_0x9740('0x2f')](_0x4e5074[_0x9740('0x2b')][_0x9740('0x2f')]));_0x4d2e0d[_0x9740('0x2e')]=_0x4d2e0d[_0x9740('0x2e')][_0x9740('0x30')]?_0x4d2e0d['attributes']:_0x414b2f[_0x9740('0x29')];if(!_0x4e5074[_0x9740('0x2b')][_0x9740('0x31')](_0x9740('0x32'))){_0x4d2e0d[_0x9740('0x19')]=qs[_0x9740('0x19')](_0x4e5074['query'][_0x9740('0x19')]);_0x4d2e0d['offset']=qs['offset'](_0x4e5074[_0x9740('0x2b')][_0x9740('0x18')]);}_0x4d2e0d[_0x9740('0x33')]=qs[_0x9740('0x34')](_0x4e5074[_0x9740('0x2b')]['sort']);_0x4d2e0d[_0x9740('0x35')]=qs[_0x9740('0x2c')](_[_0x9740('0x36')](_0x4e5074[_0x9740('0x2b')],_0x414b2f[_0x9740('0x2c')]));if(_0x4e5074[_0x9740('0x2b')][_0x9740('0x37')]){_0x4d2e0d[_0x9740('0x35')]=_[_0x9740('0x38')](_0x4d2e0d[_0x9740('0x35')],{'$or':_[_0x9740('0x39')](_0x127342,function(_0x1c4edc){if(_0x1c4edc[_0x9740('0x3a')][_0x9740('0x3b')]!==_0x9740('0x3c')){var _0x3efef2={};_0x3efef2[_0x1c4edc[_0x9740('0x3d')]]={'$like':'%'+_0x4e5074[_0x9740('0x2b')][_0x9740('0x37')]+'%'};return _0x3efef2;}})});}_0x4d2e0d=_[_0x9740('0x38')]({},_0x4d2e0d,_0x4e5074[_0x9740('0x3e')]);var _0x16595c={'where':_0x4d2e0d['where']};return db[_0x9740('0x3f')]['count'](_0x16595c)[_0x9740('0x20')](function(_0xc727a3){_0x169d65[_0x9740('0x40')]=_0xc727a3;if(_0x4e5074[_0x9740('0x2b')][_0x9740('0x41')]){_0x4d2e0d[_0x9740('0x42')]=[{'all':!![]}];}return db[_0x9740('0x3f')]['findAll'](_0x4d2e0d);})['then'](function(_0x54018a){_0x169d65[_0x9740('0x43')]=_0x54018a;return _0x169d65;})[_0x9740('0x20')](respondWithFilteredResult(_0x4b8d88,_0x4d2e0d))[_0x9740('0x44')](handleError(_0x4b8d88,null));};exports[_0x9740('0x45')]=function(_0x38b1d9,_0x5e6ced){var _0xbd74de={'raw':!![],'where':{'id':_0x38b1d9[_0x9740('0x46')]['id']}},_0x44fdf2={};_0x44fdf2[_0x9740('0x29')]=_[_0x9740('0x2a')](db[_0x9740('0x3f')]['rawAttributes']);_0x44fdf2[_0x9740('0x2b')]=_[_0x9740('0x2a')](_0x38b1d9[_0x9740('0x2b')]);_0x44fdf2['filters']=_['intersection'](_0x44fdf2[_0x9740('0x29')],_0x44fdf2[_0x9740('0x2b')]);_0xbd74de[_0x9740('0x2e')]=_['intersection'](_0x44fdf2[_0x9740('0x29')],qs[_0x9740('0x2f')](_0x38b1d9[_0x9740('0x2b')]['fields']));_0xbd74de[_0x9740('0x2e')]=_0xbd74de[_0x9740('0x2e')][_0x9740('0x30')]?_0xbd74de[_0x9740('0x2e')]:_0x44fdf2[_0x9740('0x29')];if(_0x38b1d9['query'][_0x9740('0x41')]){_0xbd74de[_0x9740('0x42')]=[{'all':!![]}];}_0xbd74de=_[_0x9740('0x38')]({},_0xbd74de,_0x38b1d9['options']);return db[_0x9740('0x3f')][_0x9740('0x47')](_0xbd74de)['then'](handleEntityNotFound(_0x5e6ced,null))[_0x9740('0x20')](respondWithResult(_0x5e6ced,null))[_0x9740('0x44')](handleError(_0x5e6ced,null));};exports[_0x9740('0x48')]=function(_0x1faa8b,_0x518662){return db[_0x9740('0x3f')][_0x9740('0x48')](_0x1faa8b[_0x9740('0x49')],{})[_0x9740('0x20')](respondWithResult(_0x518662,0xc9))[_0x9740('0x44')](handleError(_0x518662,null));};exports[_0x9740('0x1f')]=function(_0x5457de,_0x317f21){if(_0x5457de[_0x9740('0x49')]['id']){delete _0x5457de[_0x9740('0x49')]['id'];}return db[_0x9740('0x3f')]['find']({'where':{'id':_0x5457de[_0x9740('0x46')]['id']}})[_0x9740('0x20')](handleEntityNotFound(_0x317f21,null))['then'](saveUpdates(_0x5457de[_0x9740('0x49')],null))[_0x9740('0x20')](respondWithResult(_0x317f21,null))[_0x9740('0x44')](handleError(_0x317f21,null));};exports['destroy']=function(_0xac3ed,_0x45df52){return db[_0x9740('0x3f')][_0x9740('0x47')]({'where':{'id':_0xac3ed[_0x9740('0x46')]['id']}})[_0x9740('0x20')](handleEntityNotFound(_0x45df52,null))['then'](removeEntity(_0x45df52,null))[_0x9740('0x44')](handleError(_0x45df52,null));};exports[_0x9740('0x4a')]=function(_0x23a8ca,_0x262148){return db['ChatOfflineMessage'][_0x9740('0x4a')]()[_0x9740('0x20')](respondWithResult(_0x262148,null))[_0x9740('0x44')](handleError(_0x262148,null));}; \ No newline at end of file +var _0x1b94=['bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0xb04a45,_0x2ccefa){var _0x3980de=function(_0x33deb1){while(--_0x33deb1){_0xb04a45['push'](_0xb04a45['shift']());}};_0x3980de(++_0x2ccefa);}(_0x1b94,0x1f2));var _0x41b9=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x1b94[_0x25e7cb];return _0x375d92;};'use strict';var pdf=require(_0x41b9('0x0'));var emlformat=require(_0x41b9('0x1'));var rimraf=require(_0x41b9('0x2'));var zipdir=require(_0x41b9('0x3'));var jsonpatch=require(_0x41b9('0x4'));var rp=require('request-promise');var moment=require(_0x41b9('0x5'));var BPromise=require(_0x41b9('0x6'));var Mustache=require(_0x41b9('0x7'));var util=require('util');var path=require(_0x41b9('0x8'));var sox=require(_0x41b9('0x9'));var csv=require(_0x41b9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x41b9('0xb'));var squel=require(_0x41b9('0xc'));var crypto=require(_0x41b9('0xd'));var jsforce=require(_0x41b9('0xe'));var deskjs=require(_0x41b9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x41b9('0x10'));var Papa=require(_0x41b9('0x11'));var Redis=require('ioredis');var authService=require(_0x41b9('0x12'));var qs=require(_0x41b9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41b9('0x14'))(_0x41b9('0x15'));var utils=require('../../config/utils');var config=require(_0x41b9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4204cd,_0x478b82){_0x478b82=_0x478b82||0xcc;return function(_0x3f0b64){if(_0x3f0b64){return _0x4204cd[_0x41b9('0x17')](_0x478b82);}return _0x4204cd[_0x41b9('0x18')](_0x478b82)[_0x41b9('0x19')]();};}function respondWithResult(_0x1bc82c,_0x48be78){_0x48be78=_0x48be78||0xc8;return function(_0x428efe){if(_0x428efe){return _0x1bc82c[_0x41b9('0x18')](_0x48be78)['json'](_0x428efe);}};}function respondWithFilteredResult(_0x44ee18,_0x134902){return function(_0x303433){if(_0x303433){var _0x2200f7=_0x303433[_0x41b9('0x1a')],_0x4b38da=_0x134902[_0x41b9('0x1b')],_0x5849aa=_0x134902['offset']+_0x134902['limit'],_0x4a6357;if(_0x5849aa>=_0x2200f7){_0x5849aa=_0x2200f7;_0x4a6357=0xc8;}else{_0x4a6357=0xce;}_0x44ee18[_0x41b9('0x18')](_0x4a6357);return _0x44ee18[_0x41b9('0x1c')](_0x41b9('0x1d'),_0x4b38da+'-'+_0x5849aa+'/'+_0x2200f7)[_0x41b9('0x1e')](_0x303433);}return null;};}function patchUpdates(_0x45b813){return function(_0x475aa8){try{jsonpatch['apply'](_0x475aa8,_0x45b813,!![]);}catch(_0x10bfdf){return BPromise[_0x41b9('0x1f')](_0x10bfdf);}return _0x475aa8['save']();};}function saveUpdates(_0x155043,_0x2f6b69){return function(_0x2c205e){if(_0x2c205e){return _0x2c205e[_0x41b9('0x20')](_0x155043)[_0x41b9('0x21')](function(_0x1893ca){return _0x1893ca;});}return null;};}function removeEntity(_0x508039,_0x69eb43){return function(_0x5367b2){if(_0x5367b2){return _0x5367b2[_0x41b9('0x22')]()[_0x41b9('0x21')](function(){_0x508039[_0x41b9('0x18')](0xcc)[_0x41b9('0x19')]();});}};}function handleEntityNotFound(_0x2fe95,_0x5f2154){return function(_0x231f64){if(!_0x231f64){_0x2fe95['sendStatus'](0x194);}return _0x231f64;};}function handleError(_0x5553ca,_0x59f751){_0x59f751=_0x59f751||0x1f4;return function(_0x10bdbf){logger[_0x41b9('0x23')](_0x10bdbf[_0x41b9('0x24')]);if(_0x10bdbf[_0x41b9('0x25')]){delete _0x10bdbf[_0x41b9('0x25')];}_0x5553ca[_0x41b9('0x18')](_0x59f751)[_0x41b9('0x26')](_0x10bdbf);};}exports[_0x41b9('0x27')]=function(_0x18ea59,_0x545ad5){var _0x516845={},_0x1a3aee={},_0xe70b4d={'count':0x0,'rows':[]};var _0x208750=db[_0x41b9('0x28')][_0x41b9('0x29')];_0x1a3aee[_0x41b9('0x2a')]=_[_0x41b9('0x2b')](_0x208750);_0x1a3aee[_0x41b9('0x2c')]=_['keys'](_0x18ea59['query']);_0x1a3aee[_0x41b9('0x2d')]=_['intersection'](_0x1a3aee[_0x41b9('0x2a')],_0x1a3aee['query']);_0x516845[_0x41b9('0x2e')]=_[_0x41b9('0x2f')](_0x1a3aee['model'],qs['fields'](_0x18ea59[_0x41b9('0x2c')][_0x41b9('0x30')]));_0x516845['attributes']=_0x516845[_0x41b9('0x2e')][_0x41b9('0x31')]?_0x516845['attributes']:_0x1a3aee[_0x41b9('0x2a')];if(!_0x18ea59['query']['hasOwnProperty'](_0x41b9('0x32'))){_0x516845['limit']=qs[_0x41b9('0x33')](_0x18ea59[_0x41b9('0x2c')][_0x41b9('0x33')]);_0x516845['offset']=qs[_0x41b9('0x1b')](_0x18ea59[_0x41b9('0x2c')][_0x41b9('0x1b')]);}_0x516845[_0x41b9('0x34')]=qs[_0x41b9('0x35')](_0x18ea59[_0x41b9('0x2c')][_0x41b9('0x35')]);_0x516845[_0x41b9('0x36')]=qs[_0x41b9('0x2d')](_[_0x41b9('0x37')](_0x18ea59[_0x41b9('0x2c')],_0x1a3aee[_0x41b9('0x2d')]));if(_0x18ea59['query'][_0x41b9('0x38')]){_0x516845[_0x41b9('0x36')]=_[_0x41b9('0x39')](_0x516845[_0x41b9('0x36')],{'$or':_['map'](_0x208750,function(_0x4124bd){if(_0x4124bd['type']['key']!==_0x41b9('0x3a')){var _0x5c9bf6={};_0x5c9bf6[_0x4124bd[_0x41b9('0x3b')]]={'$like':'%'+_0x18ea59['query'][_0x41b9('0x38')]+'%'};return _0x5c9bf6;}})});}_0x516845=_[_0x41b9('0x39')]({},_0x516845,_0x18ea59[_0x41b9('0x3c')]);var _0x119ce2={'where':_0x516845[_0x41b9('0x36')]};return db[_0x41b9('0x28')]['count'](_0x119ce2)['then'](function(_0x193c3a){_0xe70b4d[_0x41b9('0x1a')]=_0x193c3a;if(_0x18ea59['query'][_0x41b9('0x3d')]){_0x516845[_0x41b9('0x3e')]=[{'all':!![]}];}return db[_0x41b9('0x28')][_0x41b9('0x3f')](_0x516845);})[_0x41b9('0x21')](function(_0x13b4d0){_0xe70b4d[_0x41b9('0x40')]=_0x13b4d0;return _0xe70b4d;})[_0x41b9('0x21')](respondWithFilteredResult(_0x545ad5,_0x516845))[_0x41b9('0x41')](handleError(_0x545ad5,null));};exports[_0x41b9('0x42')]=function(_0x4ec74b,_0x4bedd7){var _0x1bd038={'raw':!![],'where':{'id':_0x4ec74b[_0x41b9('0x43')]['id']}},_0x119322={};_0x119322[_0x41b9('0x2a')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x119322[_0x41b9('0x2c')]=_[_0x41b9('0x2b')](_0x4ec74b[_0x41b9('0x2c')]);_0x119322['filters']=_['intersection'](_0x119322['model'],_0x119322[_0x41b9('0x2c')]);_0x1bd038[_0x41b9('0x2e')]=_[_0x41b9('0x2f')](_0x119322['model'],qs[_0x41b9('0x30')](_0x4ec74b[_0x41b9('0x2c')][_0x41b9('0x30')]));_0x1bd038['attributes']=_0x1bd038['attributes'][_0x41b9('0x31')]?_0x1bd038[_0x41b9('0x2e')]:_0x119322[_0x41b9('0x2a')];if(_0x4ec74b['query'][_0x41b9('0x3d')]){_0x1bd038[_0x41b9('0x3e')]=[{'all':!![]}];}_0x1bd038=_[_0x41b9('0x39')]({},_0x1bd038,_0x4ec74b['options']);return db[_0x41b9('0x28')][_0x41b9('0x44')](_0x1bd038)[_0x41b9('0x21')](handleEntityNotFound(_0x4bedd7,null))[_0x41b9('0x21')](respondWithResult(_0x4bedd7,null))['catch'](handleError(_0x4bedd7,null));};exports[_0x41b9('0x45')]=function(_0x4b74c7,_0x18c144){return db[_0x41b9('0x28')]['create'](_0x4b74c7[_0x41b9('0x46')],{})['then'](respondWithResult(_0x18c144,0xc9))[_0x41b9('0x41')](handleError(_0x18c144,null));};exports['update']=function(_0x5427f7,_0x411eeb){if(_0x5427f7['body']['id']){delete _0x5427f7[_0x41b9('0x46')]['id'];}return db['ChatOfflineMessage'][_0x41b9('0x44')]({'where':{'id':_0x5427f7[_0x41b9('0x43')]['id']}})[_0x41b9('0x21')](handleEntityNotFound(_0x411eeb,null))[_0x41b9('0x21')](saveUpdates(_0x5427f7[_0x41b9('0x46')],null))[_0x41b9('0x21')](respondWithResult(_0x411eeb,null))[_0x41b9('0x41')](handleError(_0x411eeb,null));};exports['destroy']=function(_0x46f4d8,_0x2289c3){return db[_0x41b9('0x28')][_0x41b9('0x44')]({'where':{'id':_0x46f4d8[_0x41b9('0x43')]['id']}})[_0x41b9('0x21')](handleEntityNotFound(_0x2289c3,null))[_0x41b9('0x21')](removeEntity(_0x2289c3,null))[_0x41b9('0x41')](handleError(_0x2289c3,null));};exports[_0x41b9('0x47')]=function(_0x53b83d,_0x5424f9){return db['ChatOfflineMessage'][_0x41b9('0x47')]()[_0x41b9('0x21')](respondWithResult(_0x5424f9,null))['catch'](handleError(_0x5424f9,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a0c0a7c..3503977 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 _0x5ad3=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0x5ad3[_0x3d34da];return _0xcf6af8;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));module[_0x35ad('0xa')]=function(_0x436dcb,_0x36c606){return _0x436dcb[_0x35ad('0xb')]('ChatOfflineMessage',attributes,{'tableName':_0x35ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35ad('0xd'),'collate':_0x35ad('0xe')});}; \ No newline at end of file +var _0x5db8=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x3f4d46,_0x1e1f23){var _0x498287=function(_0x15a0d8){while(--_0x15a0d8){_0x3f4d46['push'](_0x3f4d46['shift']());}};_0x498287(++_0x1e1f23);}(_0x5db8,0xbb));var _0x85db=function(_0x121350,_0x361f4d){_0x121350=_0x121350-0x0;var _0x2e21c7=_0x5db8[_0x121350];return _0x2e21c7;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x85db('0xb'),'collate':_0x85db('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 36acba9..49d9116 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 _0x4022=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x1164d1,_0x53e130){var _0x184f16=function(_0x4506f4){while(--_0x4506f4){_0x1164d1['push'](_0x1164d1['shift']());}};_0x184f16(++_0x53e130);}(_0x4022,0x18e));var _0x2402=function(_0x2d7103,_0xe72901){_0x2d7103=_0x2d7103-0x0;var _0xf443fd=_0x4022[_0x2d7103];return _0xf443fd;};'use strict';var _=require('lodash');var util=require(_0x2402('0x0'));var moment=require(_0x2402('0x1'));var BPromise=require(_0x2402('0x2'));var rs=require(_0x2402('0x3'));var fs=require('fs');var Redis=require(_0x2402('0x4'));var db=require(_0x2402('0x5'))['db'];var utils=require(_0x2402('0x6'));var logger=require(_0x2402('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2402('0x8'));var client=jayson[_0x2402('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52f428,_0x1b4d63,_0x5f3b0b){return new BPromise(function(_0x163303,_0x1241f5){return client[_0x2402('0xa')](_0x52f428,_0x5f3b0b)['then'](function(_0x38bb51){logger[_0x2402('0xb')](_0x2402('0xc'),_0x1b4d63,_0x2402('0xd'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1b4d63,'request\x20sent',JSON['stringify'](_0x38bb51));if(_0x38bb51[_0x2402('0xe')]){if(_0x38bb51[_0x2402('0xe')][_0x2402('0xf')]===0x1f4){logger[_0x2402('0xe')](_0x2402('0xc'),_0x1b4d63,_0x38bb51['error']['message']);return _0x1241f5(_0x38bb51[_0x2402('0xe')][_0x2402('0x10')]);}logger[_0x2402('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b4d63,_0x38bb51['error'][_0x2402('0x10')]);return _0x163303(_0x38bb51[_0x2402('0xe')][_0x2402('0x10')]);}else{logger[_0x2402('0xb')](_0x2402('0xc'),_0x1b4d63,_0x2402('0xd'));_0x163303(_0x38bb51['result'][_0x2402('0x10')]);}})[_0x2402('0x11')](function(_0x27426c){logger[_0x2402('0xe')](_0x2402('0xc'),_0x1b4d63,_0x27426c);_0x1241f5(_0x27426c);});});} \ No newline at end of file +var _0xb2a8=['info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0xb2a8,0x80));var _0x8b2a=function(_0x4c6b93,_0x19880d){_0x4c6b93=_0x4c6b93-0x0;var _0x119770=_0xb2a8[_0x4c6b93];return _0x119770;};'use strict';var _=require(_0x8b2a('0x0'));var util=require('util');var moment=require(_0x8b2a('0x1'));var BPromise=require(_0x8b2a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b2a('0x3'));var db=require(_0x8b2a('0x4'))['db'];var utils=require(_0x8b2a('0x5'));var logger=require('../../config/logger')(_0x8b2a('0x6'));var config=require(_0x8b2a('0x7'));var jayson=require(_0x8b2a('0x8'));var client=jayson[_0x8b2a('0x9')][_0x8b2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44dd4b,_0x270db0,_0x4b58c9){return new BPromise(function(_0xa0d025,_0x5798a8){return client[_0x8b2a('0xb')](_0x44dd4b,_0x4b58c9)['then'](function(_0x17125d){logger['info'](_0x8b2a('0xc'),_0x270db0,_0x8b2a('0xd'));logger[_0x8b2a('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x270db0,_0x8b2a('0xd'),JSON[_0x8b2a('0xf')](_0x17125d));if(_0x17125d[_0x8b2a('0x10')]){if(_0x17125d[_0x8b2a('0x10')][_0x8b2a('0x11')]===0x1f4){logger[_0x8b2a('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x270db0,_0x17125d['error'][_0x8b2a('0x12')]);return _0x5798a8(_0x17125d['error'][_0x8b2a('0x12')]);}logger[_0x8b2a('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x270db0,_0x17125d['error'][_0x8b2a('0x12')]);return _0xa0d025(_0x17125d[_0x8b2a('0x10')][_0x8b2a('0x12')]);}else{logger[_0x8b2a('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x270db0,_0x8b2a('0xd'));_0xa0d025(_0x17125d['result'][_0x8b2a('0x12')]);}})[_0x8b2a('0x14')](function(_0x27f1bc){logger[_0x8b2a('0x10')](_0x8b2a('0xc'),_0x270db0,_0x27f1bc);_0x5798a8(_0x27f1bc);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index b82781e..2faba07 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 _0xb325=['isAuthenticated','index','get','describe','show','post','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xdeb8fe,_0x455878){var _0x4c7674=function(_0x439b27){while(--_0x439b27){_0xdeb8fe['push'](_0xdeb8fe['shift']());}};_0x4c7674(++_0x455878);}(_0xb325,0xf5));var _0x5b32=function(_0x1b6e16,_0x70475){_0x1b6e16=_0x1b6e16-0x0;var _0x4f341b=_0xb325[_0x1b6e16];return _0x4f341b;};'use strict';var multer=require('multer');var util=require(_0x5b32('0x0'));var path=require(_0x5b32('0x1'));var timeout=require(_0x5b32('0x2'));var express=require(_0x5b32('0x3'));var router=express[_0x5b32('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5b32('0x5'));var config=require(_0x5b32('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x5b32('0x7')](),controller[_0x5b32('0x8')]);router[_0x5b32('0x9')]('/describe',auth[_0x5b32('0x7')](),controller[_0x5b32('0xa')]);router['get']('/:id',auth[_0x5b32('0x7')](),controller[_0x5b32('0xb')]);router[_0x5b32('0xc')]('/',auth[_0x5b32('0x7')](),controller['create']);router[_0x5b32('0xd')](_0x5b32('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x5b32('0xf')](_0x5b32('0xe'),auth[_0x5b32('0x7')](),controller[_0x5b32('0x10')]);module[_0x5b32('0x11')]=router; \ No newline at end of file +var _0x9a3c=['destroy','exports','multer','connect-timeout','express','Router','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update'];(function(_0x352fcd,_0x11b7df){var _0x238085=function(_0x23f3a7){while(--_0x23f3a7){_0x352fcd['push'](_0x352fcd['shift']());}};_0x238085(++_0x11b7df);}(_0x9a3c,0x134));var _0xc9a3=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9a3c[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0xc9a3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc9a3('0x1'));var express=require(_0xc9a3('0x2'));var router=express[_0xc9a3('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc9a3('0x4'));var controller=require(_0xc9a3('0x5'));router['get']('/',auth[_0xc9a3('0x6')](),controller[_0xc9a3('0x7')]);router[_0xc9a3('0x8')](_0xc9a3('0x9'),auth[_0xc9a3('0x6')](),controller[_0xc9a3('0xa')]);router[_0xc9a3('0x8')](_0xc9a3('0xb'),auth['isAuthenticated'](),controller[_0xc9a3('0xc')]);router['post']('/',auth[_0xc9a3('0x6')](),controller['create']);router[_0xc9a3('0xd')](_0xc9a3('0xb'),auth['isAuthenticated'](),controller[_0xc9a3('0xe')]);router['delete'](_0xc9a3('0xb'),auth[_0xc9a3('0x6')](),controller[_0xc9a3('0xf')]);module[_0xc9a3('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 5a11e90..065f26f 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 _0x4b34=['sequelize','exports','STRING','mouseOver','timeout'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x4b34,0x12c));var _0x44b3=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x4b34[_0x25d386];return _0x857f4a;};'use strict';var Sequelize=require(_0x44b3('0x0'));module[_0x44b3('0x1')]={'name':{'type':Sequelize[_0x44b3('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x44b3('0x3'),_0x44b3('0x4')),'defaultValue':_0x44b3('0x3')},'selector':{'type':Sequelize[_0x44b3('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8e73=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x1e6351,_0x3cec15){var _0x3e418d=function(_0x1cf535){while(--_0x1cf535){_0x1e6351['push'](_0x1e6351['shift']());}};_0x3e418d(++_0x3cec15);}(_0x8e73,0x89));var _0x38e7=function(_0xba88f8,_0x268005){_0xba88f8=_0xba88f8-0x0;var _0x58def7=_0x8e73[_0xba88f8];return _0x58def7;};'use strict';var Sequelize=require(_0x38e7('0x0'));module[_0x38e7('0x1')]={'name':{'type':Sequelize[_0x38e7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x38e7('0x3')](_0x38e7('0x4'),_0x38e7('0x5')),'defaultValue':_0x38e7('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x38e7('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 0d32648..502d596 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 _0x37c5=['includeAll','include','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','then','error','stack','name','show','params','ChatProactiveAction','rawAttributes','query','keys','intersection','model','fields','attributes','length'];(function(_0x415d43,_0x309808){var _0x35def1=function(_0x5d80c6){while(--_0x5d80c6){_0x415d43['push'](_0x415d43['shift']());}};_0x35def1(++_0x309808);}(_0x37c5,0xa7));var _0x537c=function(_0x3535fd,_0x3739f7){_0x3535fd=_0x3535fd-0x0;var _0xe03077=_0x37c5[_0x3535fd];return _0xe03077;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x537c('0x0'));var rimraf=require(_0x537c('0x1'));var zipdir=require(_0x537c('0x2'));var jsonpatch=require(_0x537c('0x3'));var rp=require(_0x537c('0x4'));var moment=require(_0x537c('0x5'));var BPromise=require(_0x537c('0x6'));var Mustache=require(_0x537c('0x7'));var util=require(_0x537c('0x8'));var path=require(_0x537c('0x9'));var sox=require('sox');var csv=require(_0x537c('0xa'));var ejs=require(_0x537c('0xb'));var fs=require('fs');var _=require(_0x537c('0xc'));var squel=require('squel');var crypto=require(_0x537c('0xd'));var jsforce=require(_0x537c('0xe'));var deskjs=require(_0x537c('0xf'));var toCsv=require(_0x537c('0xa'));var querystring=require('querystring');var Papa=require(_0x537c('0x10'));var Redis=require(_0x537c('0x11'));var authService=require(_0x537c('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x537c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x537c('0x14'));var config=require('../../config/environment');var db=require(_0x537c('0x15'))['db'];function respondWithStatusCode(_0x2ec541,_0x3fa3a6){_0x3fa3a6=_0x3fa3a6||0xcc;return function(_0x473606){if(_0x473606){return _0x2ec541[_0x537c('0x16')](_0x3fa3a6);}return _0x2ec541[_0x537c('0x17')](_0x3fa3a6)[_0x537c('0x18')]();};}function respondWithResult(_0x2d1f01,_0x15aaca){_0x15aaca=_0x15aaca||0xc8;return function(_0x577981){if(_0x577981){return _0x2d1f01[_0x537c('0x17')](_0x15aaca)[_0x537c('0x19')](_0x577981);}};}function respondWithFilteredResult(_0x463703,_0x131226){return function(_0x116453){if(_0x116453){var _0x392421=_0x116453['count'],_0x2158e2=_0x131226[_0x537c('0x1a')],_0x3776c3=_0x131226['offset']+_0x131226['limit'],_0x445763;if(_0x3776c3>=_0x392421){_0x3776c3=_0x392421;_0x445763=0xc8;}else{_0x445763=0xce;}_0x463703[_0x537c('0x17')](_0x445763);return _0x463703[_0x537c('0x1b')](_0x537c('0x1c'),_0x2158e2+'-'+_0x3776c3+'/'+_0x392421)['json'](_0x116453);}return null;};}function patchUpdates(_0x28b410){return function(_0x229ffd){try{jsonpatch['apply'](_0x229ffd,_0x28b410,!![]);}catch(_0x5ca4d5){return BPromise[_0x537c('0x1d')](_0x5ca4d5);}return _0x229ffd['save']();};}function saveUpdates(_0x59a481,_0x2307c7){return function(_0x32be40){if(_0x32be40){return _0x32be40['update'](_0x59a481)[_0x537c('0x1e')](function(_0x259ab2){return _0x259ab2;});}return null;};}function removeEntity(_0x528042,_0x576330){return function(_0x1a91d1){if(_0x1a91d1){return _0x1a91d1['destroy']()['then'](function(){_0x528042[_0x537c('0x17')](0xcc)[_0x537c('0x18')]();});}};}function handleEntityNotFound(_0x13fd5e,_0x28a35a){return function(_0x3698bc){if(!_0x3698bc){_0x13fd5e[_0x537c('0x16')](0x194);}return _0x3698bc;};}function handleError(_0x5802d1,_0x2ea036){_0x2ea036=_0x2ea036||0x1f4;return function(_0x2412fd){logger[_0x537c('0x1f')](_0x2412fd[_0x537c('0x20')]);if(_0x2412fd[_0x537c('0x21')]){delete _0x2412fd['name'];}_0x5802d1['status'](_0x2ea036)['send'](_0x2412fd);};}exports[_0x537c('0x22')]=function(_0x1fa0ca,_0x54569f){var _0x3005a4={'raw':!![],'where':{'id':_0x1fa0ca[_0x537c('0x23')]['id']}},_0x351792={};_0x351792['model']=_['keys'](db[_0x537c('0x24')][_0x537c('0x25')]);_0x351792[_0x537c('0x26')]=_[_0x537c('0x27')](_0x1fa0ca[_0x537c('0x26')]);_0x351792['filters']=_[_0x537c('0x28')](_0x351792[_0x537c('0x29')],_0x351792['query']);_0x3005a4['attributes']=_['intersection'](_0x351792['model'],qs[_0x537c('0x2a')](_0x1fa0ca[_0x537c('0x26')][_0x537c('0x2a')]));_0x3005a4['attributes']=_0x3005a4[_0x537c('0x2b')][_0x537c('0x2c')]?_0x3005a4[_0x537c('0x2b')]:_0x351792['model'];if(_0x1fa0ca[_0x537c('0x26')][_0x537c('0x2d')]){_0x3005a4[_0x537c('0x2e')]=[{'all':!![]}];}_0x3005a4=_['merge']({},_0x3005a4,_0x1fa0ca['options']);return db[_0x537c('0x24')][_0x537c('0x2f')](_0x3005a4)[_0x537c('0x1e')](handleEntityNotFound(_0x54569f,null))[_0x537c('0x1e')](respondWithResult(_0x54569f,null))[_0x537c('0x30')](handleError(_0x54569f,null));};exports[_0x537c('0x31')]=function(_0x40cc06,_0xed36b2){return db['ChatProactiveAction']['create'](_0x40cc06[_0x537c('0x32')],{})[_0x537c('0x1e')](respondWithResult(_0xed36b2,0xc9))['catch'](handleError(_0xed36b2,null));};exports[_0x537c('0x33')]=function(_0xf7a818,_0x116b5e){if(_0xf7a818[_0x537c('0x32')]['id']){delete _0xf7a818[_0x537c('0x32')]['id'];}return db['ChatProactiveAction'][_0x537c('0x2f')]({'where':{'id':_0xf7a818['params']['id']}})['then'](handleEntityNotFound(_0x116b5e,null))['then'](saveUpdates(_0xf7a818['body'],null))[_0x537c('0x1e')](respondWithResult(_0x116b5e,null))[_0x537c('0x30')](handleError(_0x116b5e,null));};exports[_0x537c('0x34')]=function(_0x20fe55,_0xeb1025){return db[_0x537c('0x24')][_0x537c('0x2f')]({'where':{'id':_0x20fe55[_0x537c('0x23')]['id']}})[_0x537c('0x1e')](handleEntityNotFound(_0xeb1025,null))[_0x537c('0x1e')](removeEntity(_0xeb1025,null))[_0x537c('0x30')](handleError(_0xeb1025,null));}; \ No newline at end of file +var _0x9ab0=['merge','options','create','body','find','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','send','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include'];(function(_0x3aec3b,_0x378a48){var _0x1bc671=function(_0x50ce5b){while(--_0x50ce5b){_0x3aec3b['push'](_0x3aec3b['shift']());}};_0x1bc671(++_0x378a48);}(_0x9ab0,0x195));var _0x09ab=function(_0x5c01dc,_0x814086){_0x5c01dc=_0x5c01dc-0x0;var _0x570e1a=_0x9ab0[_0x5c01dc];return _0x570e1a;};'use strict';var pdf=require(_0x09ab('0x0'));var emlformat=require(_0x09ab('0x1'));var rimraf=require(_0x09ab('0x2'));var zipdir=require(_0x09ab('0x3'));var jsonpatch=require(_0x09ab('0x4'));var rp=require(_0x09ab('0x5'));var moment=require(_0x09ab('0x6'));var BPromise=require(_0x09ab('0x7'));var Mustache=require(_0x09ab('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x09ab('0x9'));var ejs=require(_0x09ab('0xa'));var fs=require('fs');var _=require(_0x09ab('0xb'));var squel=require(_0x09ab('0xc'));var crypto=require(_0x09ab('0xd'));var jsforce=require(_0x09ab('0xe'));var deskjs=require(_0x09ab('0xf'));var toCsv=require(_0x09ab('0x9'));var querystring=require(_0x09ab('0x10'));var Papa=require('papaparse');var Redis=require(_0x09ab('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x09ab('0x12'));var hardwareService=require(_0x09ab('0x13'));var logger=require(_0x09ab('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x09ab('0x15'));var db=require(_0x09ab('0x16'))['db'];function respondWithStatusCode(_0x553791,_0x58f0bb){_0x58f0bb=_0x58f0bb||0xcc;return function(_0x3cd3d7){if(_0x3cd3d7){return _0x553791[_0x09ab('0x17')](_0x58f0bb);}return _0x553791[_0x09ab('0x18')](_0x58f0bb)[_0x09ab('0x19')]();};}function respondWithResult(_0x116193,_0x34afbd){_0x34afbd=_0x34afbd||0xc8;return function(_0x18ecda){if(_0x18ecda){return _0x116193[_0x09ab('0x18')](_0x34afbd)[_0x09ab('0x1a')](_0x18ecda);}};}function respondWithFilteredResult(_0x1d4354,_0x2a16e4){return function(_0x27cf42){if(_0x27cf42){var _0x5ac9da=_0x27cf42['count'],_0x24db01=_0x2a16e4[_0x09ab('0x1b')],_0x3ff3b2=_0x2a16e4[_0x09ab('0x1b')]+_0x2a16e4[_0x09ab('0x1c')],_0x3aa4f6;if(_0x3ff3b2>=_0x5ac9da){_0x3ff3b2=_0x5ac9da;_0x3aa4f6=0xc8;}else{_0x3aa4f6=0xce;}_0x1d4354['status'](_0x3aa4f6);return _0x1d4354[_0x09ab('0x1d')](_0x09ab('0x1e'),_0x24db01+'-'+_0x3ff3b2+'/'+_0x5ac9da)[_0x09ab('0x1a')](_0x27cf42);}return null;};}function patchUpdates(_0x43d764){return function(_0x2e3af2){try{jsonpatch[_0x09ab('0x1f')](_0x2e3af2,_0x43d764,!![]);}catch(_0x5c053b){return BPromise[_0x09ab('0x20')](_0x5c053b);}return _0x2e3af2[_0x09ab('0x21')]();};}function saveUpdates(_0x4a2a7b,_0xddb65d){return function(_0x6a3b15){if(_0x6a3b15){return _0x6a3b15[_0x09ab('0x22')](_0x4a2a7b)[_0x09ab('0x23')](function(_0x403d30){return _0x403d30;});}return null;};}function removeEntity(_0x3682ce,_0x37b525){return function(_0x1bde95){if(_0x1bde95){return _0x1bde95['destroy']()[_0x09ab('0x23')](function(){_0x3682ce[_0x09ab('0x18')](0xcc)[_0x09ab('0x19')]();});}};}function handleEntityNotFound(_0x33e2d8,_0x3314b8){return function(_0x35ea70){if(!_0x35ea70){_0x33e2d8['sendStatus'](0x194);}return _0x35ea70;};}function handleError(_0x414277,_0x26d939){_0x26d939=_0x26d939||0x1f4;return function(_0x2122d1){logger[_0x09ab('0x24')](_0x2122d1[_0x09ab('0x25')]);if(_0x2122d1['name']){delete _0x2122d1['name'];}_0x414277[_0x09ab('0x18')](_0x26d939)[_0x09ab('0x26')](_0x2122d1);};}exports['show']=function(_0x429b1b,_0x18e960){var _0x22d3dd={'raw':!![],'where':{'id':_0x429b1b[_0x09ab('0x27')]['id']}},_0x1e6303={};_0x1e6303[_0x09ab('0x28')]=_[_0x09ab('0x29')](db[_0x09ab('0x2a')]['rawAttributes']);_0x1e6303[_0x09ab('0x2b')]=_[_0x09ab('0x29')](_0x429b1b[_0x09ab('0x2b')]);_0x1e6303[_0x09ab('0x2c')]=_[_0x09ab('0x2d')](_0x1e6303[_0x09ab('0x28')],_0x1e6303[_0x09ab('0x2b')]);_0x22d3dd[_0x09ab('0x2e')]=_[_0x09ab('0x2d')](_0x1e6303[_0x09ab('0x28')],qs[_0x09ab('0x2f')](_0x429b1b[_0x09ab('0x2b')][_0x09ab('0x2f')]));_0x22d3dd['attributes']=_0x22d3dd[_0x09ab('0x2e')][_0x09ab('0x30')]?_0x22d3dd[_0x09ab('0x2e')]:_0x1e6303[_0x09ab('0x28')];if(_0x429b1b[_0x09ab('0x2b')][_0x09ab('0x31')]){_0x22d3dd[_0x09ab('0x32')]=[{'all':!![]}];}_0x22d3dd=_[_0x09ab('0x33')]({},_0x22d3dd,_0x429b1b[_0x09ab('0x34')]);return db['ChatProactiveAction']['find'](_0x22d3dd)[_0x09ab('0x23')](handleEntityNotFound(_0x18e960,null))[_0x09ab('0x23')](respondWithResult(_0x18e960,null))['catch'](handleError(_0x18e960,null));};exports[_0x09ab('0x35')]=function(_0x34b993,_0x80d2fa){return db['ChatProactiveAction'][_0x09ab('0x35')](_0x34b993[_0x09ab('0x36')],{})[_0x09ab('0x23')](respondWithResult(_0x80d2fa,0xc9))['catch'](handleError(_0x80d2fa,null));};exports['update']=function(_0x1a225c,_0x2141a3){if(_0x1a225c[_0x09ab('0x36')]['id']){delete _0x1a225c[_0x09ab('0x36')]['id'];}return db[_0x09ab('0x2a')]['find']({'where':{'id':_0x1a225c[_0x09ab('0x27')]['id']}})[_0x09ab('0x23')](handleEntityNotFound(_0x2141a3,null))['then'](saveUpdates(_0x1a225c[_0x09ab('0x36')],null))[_0x09ab('0x23')](respondWithResult(_0x2141a3,null))['catch'](handleError(_0x2141a3,null));};exports['destroy']=function(_0x49b520,_0x57578f){return db[_0x09ab('0x2a')][_0x09ab('0x37')]({'where':{'id':_0x49b520['params']['id']}})[_0x09ab('0x23')](handleEntityNotFound(_0x57578f,null))[_0x09ab('0x23')](removeEntity(_0x57578f,null))[_0x09ab('0x38')](handleError(_0x57578f,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f8e6351..d42bf01 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 _0xb8e0=['path','./chatProactiveAction.attributes','exports','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xb8e0,0xfb));var _0x0b8e=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xb8e0[_0x5d225a];return _0x1e7761;};'use strict';var _=require(_0x0b8e('0x0'));var util=require(_0x0b8e('0x1'));var logger=require(_0x0b8e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0b8e('0x3'));var rp=require(_0x0b8e('0x4'));var fs=require('fs');var path=require(_0x0b8e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b8e('0x6'));module[_0x0b8e('0x7')]=function(_0x233d22,_0x12b9f9){return _0x233d22['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x544b=['exports','define','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes'];(function(_0x118058,_0x582379){var _0x3d5ef9=function(_0x5410a2){while(--_0x5410a2){_0x118058['push'](_0x118058['shift']());}};_0x3d5ef9(++_0x582379);}(_0x544b,0x10b));var _0xb544=function(_0x33b656,_0x5ecb2c){_0x33b656=_0x33b656-0x0;var _0x2e6687=_0x544b[_0x33b656];return _0x2e6687;};'use strict';var _=require(_0xb544('0x0'));var util=require(_0xb544('0x1'));var logger=require('../../config/logger')(_0xb544('0x2'));var moment=require(_0xb544('0x3'));var BPromise=require(_0xb544('0x4'));var rp=require(_0xb544('0x5'));var fs=require('fs');var path=require(_0xb544('0x6'));var rimraf=require('rimraf');var config=require(_0xb544('0x7'));var attributes=require(_0xb544('0x8'));module[_0xb544('0x9')]=function(_0x460308,_0x4a74c2){return _0x460308[_0xb544('0xa')]('ChatProactiveAction',attributes,{'tableName':_0xb544('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 919ed75..0ca2a2a 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 _0xcf9b=['request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x37bc41,_0x323aed){var _0x247936=function(_0xd4d8e5){while(--_0xd4d8e5){_0x37bc41['push'](_0x37bc41['shift']());}};_0x247936(++_0x323aed);}(_0xcf9b,0xcf));var _0xbcf9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xcf9b[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xbcf9('0x0'));var util=require(_0xbcf9('0x1'));var moment=require('moment');var BPromise=require(_0xbcf9('0x2'));var rs=require(_0xbcf9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcf9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcf9('0x5'))('rpc');var config=require(_0xbcf9('0x6'));var jayson=require(_0xbcf9('0x7'));var client=jayson[_0xbcf9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd00486,_0x508c9d,_0x327693){return new BPromise(function(_0x325ba7,_0x5e18ab){return client[_0xbcf9('0x9')](_0xd00486,_0x327693)[_0xbcf9('0xa')](function(_0x4aeb90){logger[_0xbcf9('0xb')](_0xbcf9('0xc'),_0x508c9d,_0xbcf9('0xd'));logger['debug'](_0xbcf9('0xe'),_0x508c9d,'request\x20sent',JSON[_0xbcf9('0xf')](_0x4aeb90));if(_0x4aeb90[_0xbcf9('0x10')]){if(_0x4aeb90['error']['code']===0x1f4){logger[_0xbcf9('0x10')](_0xbcf9('0xc'),_0x508c9d,_0x4aeb90['error'][_0xbcf9('0x11')]);return _0x5e18ab(_0x4aeb90[_0xbcf9('0x10')]['message']);}logger[_0xbcf9('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x508c9d,_0x4aeb90['error'][_0xbcf9('0x11')]);return _0x325ba7(_0x4aeb90[_0xbcf9('0x10')][_0xbcf9('0x11')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x508c9d,'request\x20sent');_0x325ba7(_0x4aeb90[_0xbcf9('0x12')][_0xbcf9('0x11')]);}})[_0xbcf9('0x13')](function(_0x2b6914){logger['error'](_0xbcf9('0xc'),_0x508c9d,_0x2b6914);_0x5e18ab(_0x2b6914);});});} \ No newline at end of file +var _0x28de=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x578430,_0x2c041b){var _0x3d69de=function(_0xe3499a){while(--_0xe3499a){_0x578430['push'](_0x578430['shift']());}};_0x3d69de(++_0x2c041b);}(_0x28de,0xf5));var _0xe28d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28de[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe28d('0x0'));var util=require(_0xe28d('0x1'));var moment=require('moment');var BPromise=require(_0xe28d('0x2'));var rs=require(_0xe28d('0x3'));var fs=require('fs');var Redis=require(_0xe28d('0x4'));var db=require(_0xe28d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe28d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe28d('0x7'));var client=jayson[_0xe28d('0x8')][_0xe28d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5906eb,_0x272c51,_0x5b70fb){return new BPromise(function(_0x5a5562,_0x499777){return client[_0xe28d('0xa')](_0x5906eb,_0x5b70fb)[_0xe28d('0xb')](function(_0x2427d9){logger[_0xe28d('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x272c51,_0xe28d('0xd'));logger[_0xe28d('0xe')](_0xe28d('0xf'),_0x272c51,'request\x20sent',JSON[_0xe28d('0x10')](_0x2427d9));if(_0x2427d9[_0xe28d('0x11')]){if(_0x2427d9[_0xe28d('0x11')]['code']===0x1f4){logger[_0xe28d('0x11')](_0xe28d('0x12'),_0x272c51,_0x2427d9[_0xe28d('0x11')]['message']);return _0x499777(_0x2427d9['error']['message']);}logger[_0xe28d('0x11')](_0xe28d('0x12'),_0x272c51,_0x2427d9[_0xe28d('0x11')][_0xe28d('0x13')]);return _0x5a5562(_0x2427d9[_0xe28d('0x11')]['message']);}else{logger['info'](_0xe28d('0x12'),_0x272c51,_0xe28d('0xd'));_0x5a5562(_0x2427d9[_0xe28d('0x14')][_0xe28d('0x13')]);}})[_0xe28d('0x15')](function(_0x651ce5){logger['error'](_0xe28d('0x12'),_0x272c51,_0x651ce5);_0x499777(_0x651ce5);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 4eddbf4..2274209 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 _0x8c5a=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x2d7773,_0x4b8f58){var _0x3b5a0d=function(_0x3e9852){while(--_0x3e9852){_0x2d7773['push'](_0x2d7773['shift']());}};_0x3b5a0d(++_0x4b8f58);}(_0x8c5a,0x1b6));var _0xa8c5=function(_0x23f1ce,_0x3fc63a){_0x23f1ce=_0x23f1ce-0x0;var _0x54f3f2=_0x8c5a[_0x23f1ce];return _0x54f3f2;};'use strict';var multer=require(_0xa8c5('0x0'));var util=require(_0xa8c5('0x1'));var path=require(_0xa8c5('0x2'));var timeout=require(_0xa8c5('0x3'));var express=require(_0xa8c5('0x4'));var router=express[_0xa8c5('0x5')]();var auth=require(_0xa8c5('0x6'));var interaction=require(_0xa8c5('0x7'));var config=require('../../config/environment');var controller=require(_0xa8c5('0x8'));router[_0xa8c5('0x9')](_0xa8c5('0xa'),auth[_0xa8c5('0xb')](),controller[_0xa8c5('0xc')]);router['post']('/',auth[_0xa8c5('0xb')](),controller[_0xa8c5('0xd')]);router[_0xa8c5('0xe')](_0xa8c5('0xa'),auth['isAuthenticated'](),controller[_0xa8c5('0xf')]);router[_0xa8c5('0x10')]('/:id',auth[_0xa8c5('0xb')](),controller[_0xa8c5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x43c0=['get','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e8268,_0x3127e7){var _0x44c6e4=function(_0x1cb4e9){while(--_0x1cb4e9){_0x1e8268['push'](_0x1e8268['shift']());}};_0x44c6e4(++_0x3127e7);}(_0x43c0,0x13b));var _0x043c=function(_0x5d8b9b,_0x520d68){_0x5d8b9b=_0x5d8b9b-0x0;var _0x4c666b=_0x43c0[_0x5d8b9b];return _0x4c666b;};'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('./chatProactiveAction.controller');router[_0x043c('0x9')](_0x043c('0xa'),auth[_0x043c('0xb')](),controller[_0x043c('0xc')]);router[_0x043c('0xd')]('/',auth['isAuthenticated'](),controller[_0x043c('0xe')]);router[_0x043c('0xf')](_0x043c('0xa'),auth[_0x043c('0xb')](),controller['update']);router['delete'](_0x043c('0xa'),auth[_0x043c('0xb')](),controller[_0x043c('0x10')]);module[_0x043c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4eeeee6..4db926a 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 _0xfc39=['name','INTEGER','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0xfc39,0x177));var _0x9fc3=function(_0x122dd0,_0x5d5424){_0x122dd0=_0x122dd0-0x0;var _0x2fe785=_0xfc39[_0x122dd0];return _0x2fe785;};'use strict';var Sequelize=require(_0x9fc3('0x0'));module[_0x9fc3('0x1')]={'name':{'type':Sequelize[_0x9fc3('0x2')],'unique':_0x9fc3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9fc3('0x2')]},'timeout':{'type':Sequelize[_0x9fc3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9fc3('0x5'),'beepall',_0x9fc3('0x6'))}}; \ No newline at end of file +var _0x342c=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x342c,0x152));var _0xc342=function(_0x5bc3bf,_0x1924fe){_0x5bc3bf=_0x5bc3bf-0x0;var _0x4b9cf2=_0x342c[_0x5bc3bf];return _0x4b9cf2;};'use strict';var Sequelize=require(_0xc342('0x0'));module[_0xc342('0x1')]={'name':{'type':Sequelize[_0xc342('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc342('0x2')]},'timeout':{'type':Sequelize[_0xc342('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc342('0x4')](_0xc342('0x5'),_0xc342('0x6'),_0xc342('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9ffcafb..b1a9f9a 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 _0x0871=['all','union','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','type','field','merge','options','ChatQueue','includeAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','ids','Team','online','voicePause','flatMap','Agents','sequelize','transaction','addTeams','userChatQueue:save','removeTeams','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x0871,0x13e));var _0x1087=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x0871[_0x5cbf0e];return _0x1c76f8;};'use strict';var pdf=require(_0x1087('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1087('0x1'));var jsonpatch=require(_0x1087('0x2'));var rp=require(_0x1087('0x3'));var moment=require(_0x1087('0x4'));var BPromise=require(_0x1087('0x5'));var Mustache=require(_0x1087('0x6'));var util=require(_0x1087('0x7'));var path=require(_0x1087('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1087('0x9'));var fs=require('fs');var _=require(_0x1087('0xa'));var squel=require(_0x1087('0xb'));var crypto=require('crypto');var jsforce=require(_0x1087('0xc'));var deskjs=require(_0x1087('0xd'));var toCsv=require(_0x1087('0xe'));var querystring=require(_0x1087('0xf'));var Papa=require('papaparse');var Redis=require(_0x1087('0x10'));var authService=require(_0x1087('0x11'));var qs=require(_0x1087('0x12'));var hardwareService=require(_0x1087('0x13'));var logger=require(_0x1087('0x14'))('api');var utils=require(_0x1087('0x15'));var config=require(_0x1087('0x16'));var db=require(_0x1087('0x17'))['db'];config[_0x1087('0x18')]=_[_0x1087('0x19')](config[_0x1087('0x18')],{'host':_0x1087('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1087('0x18')]));require(_0x1087('0x1b'))[_0x1087('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1087('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x55bf48,_0x9fec2f,_0x14e8a9){if(_0x14e8a9){var _0x5d06f4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d06f4[_0x1087('0x1e')](_0x9fec2f)){return _0x55bf48;}else{throw new db['Sequelize'][(_0x1087('0x1f'))](_0x1087('0x20'));}}else{return _0x55bf48;}}function respondWithRpcPromise(_0x45147d,_0x22885d,_0x3000dc,_0x1731b7){return new BPromise(function(_0x57576d,_0x124357){var _0x276025=_0x1731b7||client;return _0x276025[_0x1087('0x21')](_0x45147d,_0x3000dc)[_0x1087('0x22')](function(_0x2943af){logger[_0x1087('0x23')]('ChatQueue,\x20%s,\x20%s',_0x22885d,_0x1087('0x24'));logger[_0x1087('0x25')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x22885d,_0x1087('0x24'),JSON[_0x1087('0x26')](_0x2943af));if(_0x2943af[_0x1087('0x27')]){if(_0x2943af[_0x1087('0x27')][_0x1087('0x28')]===0x1f4){logger['error'](_0x1087('0x29'),_0x22885d,_0x2943af[_0x1087('0x27')][_0x1087('0x2a')]);return _0x124357(_0x2943af[_0x1087('0x27')]['message']);}logger[_0x1087('0x27')](_0x1087('0x29'),_0x22885d,_0x2943af[_0x1087('0x27')]['message']);return _0x57576d(_0x2943af[_0x1087('0x27')][_0x1087('0x2a')]);}else{logger[_0x1087('0x23')]('ChatQueue,\x20%s,\x20%s',_0x22885d,_0x1087('0x24'));_0x57576d(_0x2943af[_0x1087('0x2b')][_0x1087('0x2a')]);}})[_0x1087('0x2c')](function(_0x45eacf){logger['error']('ChatQueue,\x20%s,\x20%s',_0x22885d,_0x45eacf);_0x124357(_0x45eacf);});});}function respondWithStatusCode(_0x54de1f,_0x358943){_0x358943=_0x358943||0xcc;return function(_0x58c471){if(_0x58c471){return _0x54de1f[_0x1087('0x2d')](_0x358943);}return _0x54de1f[_0x1087('0x2e')](_0x358943)['end']();};}function respondWithResult(_0x289f34,_0x33ab6e){_0x33ab6e=_0x33ab6e||0xc8;return function(_0x13179c){if(_0x13179c){return _0x289f34['status'](_0x33ab6e)[_0x1087('0x2f')](_0x13179c);}};}function respondWithFilteredResult(_0xe0bcd1,_0x2f253b){return function(_0x41c3cb){if(_0x41c3cb){var _0x2a6bf5=_0x41c3cb[_0x1087('0x30')],_0x37d375=_0x2f253b[_0x1087('0x31')],_0x1d2f9b=_0x2f253b['offset']+_0x2f253b[_0x1087('0x32')],_0x2cf873;if(_0x1d2f9b>=_0x2a6bf5){_0x1d2f9b=_0x2a6bf5;_0x2cf873=0xc8;}else{_0x2cf873=0xce;}_0xe0bcd1[_0x1087('0x2e')](_0x2cf873);return _0xe0bcd1[_0x1087('0x33')](_0x1087('0x34'),_0x37d375+'-'+_0x1d2f9b+'/'+_0x2a6bf5)['json'](_0x41c3cb);}return null;};}function patchUpdates(_0x528214){return function(_0x399de8){try{jsonpatch[_0x1087('0x35')](_0x399de8,_0x528214,!![]);}catch(_0x2aba05){return BPromise[_0x1087('0x36')](_0x2aba05);}return _0x399de8[_0x1087('0x37')]();};}function saveUpdates(_0x2d72b9,_0x1c23a1){return function(_0x58514f){if(_0x58514f){return _0x58514f[_0x1087('0x38')](_0x2d72b9)[_0x1087('0x22')](function(_0x5c15ed){return _0x5c15ed;});}return null;};}function removeEntity(_0x21e96a,_0x5ba9b5){return function(_0x447e37){if(_0x447e37){return _0x447e37[_0x1087('0x39')]()[_0x1087('0x22')](function(){var _0x3fab48=_0x447e37[_0x1087('0x3a')]({'plain':!![]});var _0x1525a2=_0x1087('0x3b');return db[_0x1087('0x3c')][_0x1087('0x39')]({'where':{'type':_0x1525a2,'resourceId':_0x3fab48['id']}})[_0x1087('0x22')](function(){return _0x447e37;});})[_0x1087('0x22')](function(){_0x21e96a[_0x1087('0x2e')](0xcc)[_0x1087('0x3d')]();});}};}function handleEntityNotFound(_0x1480fb,_0x34b824){return function(_0x5a66d5){if(!_0x5a66d5){_0x1480fb[_0x1087('0x2d')](0x194);}return _0x5a66d5;};}function handleError(_0x34250a,_0x2e2ede){_0x2e2ede=_0x2e2ede||0x1f4;return function(_0x378635){logger[_0x1087('0x27')](_0x378635['stack']);if(_0x378635['name']){delete _0x378635['name'];}_0x34250a['status'](_0x2e2ede)['send'](_0x378635);};}exports[_0x1087('0x3e')]=function(_0x43c363,_0x2098fa){var _0x33d010={},_0x27dc5b={},_0x496c50={'count':0x0,'rows':[]};var _0x311957=db['ChatQueue'][_0x1087('0x3f')];_0x27dc5b[_0x1087('0x40')]=_[_0x1087('0x41')](_0x311957);_0x27dc5b[_0x1087('0x42')]=_[_0x1087('0x41')](_0x43c363['query']);_0x27dc5b[_0x1087('0x43')]=_[_0x1087('0x44')](_0x27dc5b['model'],_0x27dc5b[_0x1087('0x42')]);_0x33d010[_0x1087('0x45')]=_[_0x1087('0x44')](_0x27dc5b['model'],qs[_0x1087('0x46')](_0x43c363[_0x1087('0x42')][_0x1087('0x46')]));_0x33d010[_0x1087('0x45')]=_0x33d010[_0x1087('0x45')][_0x1087('0x47')]?_0x33d010[_0x1087('0x45')]:_0x27dc5b[_0x1087('0x40')];if(!_0x43c363[_0x1087('0x42')]['hasOwnProperty'](_0x1087('0x48'))){_0x33d010[_0x1087('0x32')]=qs['limit'](_0x43c363[_0x1087('0x42')][_0x1087('0x32')]);_0x33d010[_0x1087('0x31')]=qs[_0x1087('0x31')](_0x43c363[_0x1087('0x42')][_0x1087('0x31')]);}_0x33d010[_0x1087('0x49')]=qs['sort'](_0x43c363['query'][_0x1087('0x4a')]);_0x33d010['where']=qs[_0x1087('0x43')](_[_0x1087('0x4b')](_0x43c363[_0x1087('0x42')],_0x27dc5b[_0x1087('0x43')]));if(_0x43c363[_0x1087('0x42')][_0x1087('0x4c')]){_0x33d010[_0x1087('0x4d')]=_['merge'](_0x33d010[_0x1087('0x4d')],{'$or':_[_0x1087('0x4e')](_0x311957,function(_0x5ca0d5){if(_0x5ca0d5[_0x1087('0x4f')]['key']!=='VIRTUAL'){var _0x224fad={};_0x224fad[_0x5ca0d5[_0x1087('0x50')]]={'$like':'%'+_0x43c363[_0x1087('0x42')][_0x1087('0x4c')]+'%'};return _0x224fad;}})});}_0x33d010=_[_0x1087('0x51')]({},_0x33d010,_0x43c363[_0x1087('0x52')]);var _0xd0c999={'where':_0x33d010['where']};return db[_0x1087('0x53')]['count'](_0xd0c999)[_0x1087('0x22')](function(_0x412123){_0x496c50[_0x1087('0x30')]=_0x412123;if(_0x43c363['query'][_0x1087('0x54')]){_0x33d010['include']=[{'all':!![]}];}return db[_0x1087('0x53')]['findAll'](_0x33d010);})[_0x1087('0x22')](function(_0x2056bf){_0x496c50[_0x1087('0x55')]=_0x2056bf;return _0x496c50;})[_0x1087('0x22')](respondWithFilteredResult(_0x2098fa,_0x33d010))[_0x1087('0x2c')](handleError(_0x2098fa,null));};exports[_0x1087('0x56')]=function(_0x30b99a,_0x5627e0){var _0x758812={'raw':!![],'where':{'id':_0x30b99a[_0x1087('0x57')]['id']}},_0x3ea9bd={};_0x3ea9bd[_0x1087('0x40')]=_['keys'](db[_0x1087('0x53')][_0x1087('0x3f')]);_0x3ea9bd[_0x1087('0x42')]=_[_0x1087('0x41')](_0x30b99a[_0x1087('0x42')]);_0x3ea9bd['filters']=_[_0x1087('0x44')](_0x3ea9bd['model'],_0x3ea9bd[_0x1087('0x42')]);_0x758812[_0x1087('0x45')]=_['intersection'](_0x3ea9bd[_0x1087('0x40')],qs[_0x1087('0x46')](_0x30b99a[_0x1087('0x42')][_0x1087('0x46')]));_0x758812[_0x1087('0x45')]=_0x758812[_0x1087('0x45')][_0x1087('0x47')]?_0x758812[_0x1087('0x45')]:_0x3ea9bd[_0x1087('0x40')];if(_0x30b99a['query'][_0x1087('0x54')]){_0x758812['include']=[{'all':!![]}];}_0x758812=_['merge']({},_0x758812,_0x30b99a['options']);return db[_0x1087('0x53')][_0x1087('0x58')](_0x758812)[_0x1087('0x22')](handleEntityNotFound(_0x5627e0,null))[_0x1087('0x22')](respondWithResult(_0x5627e0,null))[_0x1087('0x2c')](handleError(_0x5627e0,null));};exports[_0x1087('0x59')]=function(_0x5de501,_0x7d2466){return db[_0x1087('0x53')][_0x1087('0x59')](_0x5de501[_0x1087('0x5a')],{})['then'](function(_0x1c2e36){var _0x53f379=_0x5de501[_0x1087('0x5b')][_0x1087('0x3a')]({'plain':!![]});if(!_0x53f379)throw new Error(_0x1087('0x5c'));if(_0x53f379[_0x1087('0x5d')]===_0x1087('0x5b')){var _0x1a4db7=_0x1c2e36['get']({'plain':!![]});var _0x12d810=_0x1087('0x3b');return db[_0x1087('0x5e')][_0x1087('0x58')]({'where':{'name':_0x12d810,'userProfileId':_0x53f379[_0x1087('0x5f')]},'raw':!![]})[_0x1087('0x22')](function(_0x18b06e){if(_0x18b06e&&_0x18b06e[_0x1087('0x60')]===0x0){return db[_0x1087('0x3c')][_0x1087('0x59')]({'name':_0x1a4db7['name'],'resourceId':_0x1a4db7['id'],'type':_0x18b06e[_0x1087('0x61')],'sectionId':_0x18b06e['id']},{})[_0x1087('0x22')](function(){return _0x1c2e36;});}else{return _0x1c2e36;}})[_0x1087('0x2c')](function(_0x961e5b){logger[_0x1087('0x27')](_0x1087('0x62'),_0x961e5b);throw _0x961e5b;});}return _0x1c2e36;})[_0x1087('0x22')](respondWithResult(_0x7d2466,0xc9))[_0x1087('0x2c')](handleError(_0x7d2466,null));};exports[_0x1087('0x38')]=function(_0x40e1b3,_0x5538d9){if(_0x40e1b3['body']['id']){delete _0x40e1b3[_0x1087('0x5a')]['id'];}return db[_0x1087('0x53')][_0x1087('0x58')]({'where':{'id':_0x40e1b3[_0x1087('0x57')]['id']}})[_0x1087('0x22')](handleEntityNotFound(_0x5538d9,null))[_0x1087('0x22')](saveUpdates(_0x40e1b3['body'],null))[_0x1087('0x22')](respondWithResult(_0x5538d9,null))[_0x1087('0x2c')](handleError(_0x5538d9,null));};exports['destroy']=function(_0x414fa4,_0x280a82){return db[_0x1087('0x53')]['find']({'where':{'id':_0x414fa4[_0x1087('0x57')]['id']}})['then'](handleEntityNotFound(_0x280a82,null))['then'](removeEntity(_0x280a82,null))['catch'](handleError(_0x280a82,null));};exports[_0x1087('0x63')]=function(_0x338412,_0x110355){return db[_0x1087('0x53')][_0x1087('0x63')]()[_0x1087('0x22')](respondWithResult(_0x110355,null))[_0x1087('0x2c')](handleError(_0x110355,null));};exports[_0x1087('0x64')]=function(_0x42683e,_0x4cb33a,_0x1e4499){var _0x3ca9ce={'raw':!![],'where':{}},_0x1c1c82={},_0x236598;return db['ChatQueue'][_0x1087('0x65')]({'where':{'id':_0x42683e[_0x1087('0x57')]['id']}})[_0x1087('0x22')](handleEntityNotFound(_0x4cb33a,null))[_0x1087('0x22')](function(_0x3a441d){if(_0x3a441d){_0x236598=_0x3a441d[_0x1087('0x3a')]({'plain':!![]});_0x1c1c82['model']=_['keys'](db[_0x1087('0x66')][_0x1087('0x3f')]);_0x1c1c82['query']=_[_0x1087('0x41')](_0x42683e[_0x1087('0x42')]);_0x1c1c82[_0x1087('0x43')]=_['intersection'](_0x1c1c82[_0x1087('0x40')],_0x1c1c82[_0x1087('0x42')]);_0x3ca9ce[_0x1087('0x45')]=_[_0x1087('0x44')](_0x1c1c82['model'],qs[_0x1087('0x46')](_0x42683e['query'][_0x1087('0x46')]));_0x3ca9ce['attributes']=_0x3ca9ce[_0x1087('0x45')][_0x1087('0x47')]?_0x3ca9ce[_0x1087('0x45')]:_0x1c1c82['model'];if(!_0x42683e[_0x1087('0x42')][_0x1087('0x67')](_0x1087('0x48'))){_0x3ca9ce[_0x1087('0x32')]=qs[_0x1087('0x32')](_0x42683e[_0x1087('0x42')][_0x1087('0x32')]);_0x3ca9ce[_0x1087('0x31')]=qs[_0x1087('0x31')](_0x42683e[_0x1087('0x42')][_0x1087('0x31')]);}_0x3ca9ce['order']=qs[_0x1087('0x4a')](_0x42683e[_0x1087('0x42')]['sort']);_0x3ca9ce[_0x1087('0x4d')]=qs[_0x1087('0x43')](_[_0x1087('0x4b')](_0x42683e[_0x1087('0x42')],_0x1c1c82[_0x1087('0x43')]));_0x3ca9ce[_0x1087('0x4d')]['ChatQueueId']=_0x3a441d['id'];if(_0x42683e[_0x1087('0x42')][_0x1087('0x4c')]){_0x3ca9ce['where']=_[_0x1087('0x51')](_0x3ca9ce[_0x1087('0x4d')],{'$or':_[_0x1087('0x4e')](_0x3ca9ce[_0x1087('0x45')],function(_0x3db4ff){var _0x53beae={};_0x53beae[_0x3db4ff]={'$like':'%'+_0x42683e['query'][_0x1087('0x4c')]+'%'};return _0x53beae;})});}_0x3ca9ce=_[_0x1087('0x51')]({},_0x3ca9ce,_0x42683e[_0x1087('0x52')]);return db['UserChatQueue'][_0x1087('0x68')](_0x3ca9ce);}})['then'](function(_0x306da6){if(_0x306da6){return db[_0x1087('0x69')]['findAndCountAll']({'where':{'id':_['map'](_0x306da6,_0x1087('0x6a')),'role':_0x1087('0x6b')},'attributes':['id','name',_0x1087('0x6c'),_0x1087('0x6d'),_0x1087('0x6e')]});}})[_0x1087('0x22')](function(_0xc16bd3){if(_0xc16bd3){return{'count':_0xc16bd3[_0x1087('0x30')],'rows':_[_0x1087('0x4e')](_0xc16bd3['rows'],function(_0x494ae3){return{'membername':_0x494ae3[_0x1087('0x61')],'UserId':_0x494ae3['id'],'queue_name':_0x236598[_0x1087('0x61')],'ChatQueueId':_0x236598['id'],'interface':util[_0x1087('0x6f')](_0x1087('0x70'),'SIP',_0x494ae3[_0x1087('0x61')]),'penalty':0x0,'paused':_0x494ae3[_0x1087('0x6c')],'createdAt':_0x494ae3[_0x1087('0x6e')],'updatedAt':_0x494ae3[_0x1087('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1087('0x22')](respondWithFilteredResult(_0x4cb33a,_0x3ca9ce))[_0x1087('0x2c')](handleError(_0x4cb33a,null));};exports[_0x1087('0x71')]=function(_0x55edfd,_0x248df7,_0x31e7ff){var _0x42a142={};var _0x349355={};var _0x48c015;var _0x12059d;return db[_0x1087('0x53')][_0x1087('0x65')]({'where':{'id':_0x55edfd['params']['id']}})[_0x1087('0x22')](handleEntityNotFound(_0x248df7,null))[_0x1087('0x22')](function(_0x1fe37d){if(_0x1fe37d){_0x48c015=_0x1fe37d;_0x349355[_0x1087('0x40')]=_[_0x1087('0x41')](db['Team'][_0x1087('0x3f')]);_0x349355['query']=_['keys'](_0x55edfd[_0x1087('0x42')]);_0x349355[_0x1087('0x43')]=_['intersection'](_0x349355[_0x1087('0x40')],_0x349355[_0x1087('0x42')]);_0x42a142[_0x1087('0x45')]=_[_0x1087('0x44')](_0x349355[_0x1087('0x40')],qs[_0x1087('0x46')](_0x55edfd[_0x1087('0x42')][_0x1087('0x46')]));_0x42a142['attributes']=_0x42a142[_0x1087('0x45')][_0x1087('0x47')]?_0x42a142[_0x1087('0x45')]:_0x349355['model'];_0x42a142[_0x1087('0x49')]=qs[_0x1087('0x4a')](_0x55edfd['query'][_0x1087('0x4a')]);_0x42a142[_0x1087('0x4d')]=qs[_0x1087('0x43')](_[_0x1087('0x4b')](_0x55edfd['query'],_0x349355[_0x1087('0x43')]));if(_0x55edfd[_0x1087('0x42')][_0x1087('0x4c')]){_0x42a142['where']=_[_0x1087('0x51')](_0x42a142['where'],{'$or':_['map'](_0x42a142[_0x1087('0x45')],function(_0x5896ad){var _0x37d108={};_0x37d108[_0x5896ad]={'$like':'%'+_0x55edfd[_0x1087('0x42')][_0x1087('0x4c')]+'%'};return _0x37d108;})});}_0x42a142=_[_0x1087('0x51')]({},_0x42a142,_0x55edfd['options']);return _0x48c015[_0x1087('0x71')](_0x42a142);}})[_0x1087('0x22')](function(_0x36b544){if(_0x36b544){_0x12059d=_0x36b544[_0x1087('0x47')];if(!_0x55edfd['query'][_0x1087('0x67')](_0x1087('0x48'))){_0x42a142[_0x1087('0x32')]=qs[_0x1087('0x32')](_0x55edfd['query'][_0x1087('0x32')]);_0x42a142[_0x1087('0x31')]=qs[_0x1087('0x31')](_0x55edfd[_0x1087('0x42')][_0x1087('0x31')]);}return _0x48c015['getTeams'](_0x42a142);}})[_0x1087('0x22')](function(_0x2136f6){if(_0x2136f6){return _0x2136f6?{'count':_0x12059d,'rows':_0x2136f6}:null;}})[_0x1087('0x22')](respondWithResult(_0x248df7,null))['catch'](handleError(_0x248df7,null));};exports['addTeams']=function(_0x1ffa31,_0x56b5a6,_0x1e5483){var _0x141079=_0x1ffa31[_0x1087('0x5a')][_0x1087('0x72')];return db[_0x1087('0x73')][_0x1087('0x68')]({'where':{'id':_0x141079},'attributes':['id'],'include':[{'model':db[_0x1087('0x69')],'as':'Agents','attributes':['id',_0x1087('0x61'),_0x1087('0x74'),_0x1087('0x75'),'interface'],'raw':!![]}]})['then'](function(_0x1b7139){if(_0x1b7139){var _0x204c58=_[_0x1087('0x76')](_0x1b7139,function(_0x5eda0d){var _0x555abe=_0x5eda0d[_0x1087('0x3a')]({'plain':!![]});return _0x555abe[_0x1087('0x77')];});return db[_0x1087('0x53')][_0x1087('0x58')]({'where':{'id':_0x1ffa31['params']['id']}})[_0x1087('0x22')](function(_0x2576a9){return db[_0x1087('0x78')][_0x1087('0x79')](function(_0x1cd45b){return _0x2576a9[_0x1087('0x7a')](_0x141079,{'transaction':_0x1cd45b})[_0x1087('0x22')](function(){return BPromise['each'](_0x204c58,function(_0x411114){return db[_0x1087('0x66')]['findOrCreate']({'where':{'UserId':_0x411114['id'],'ChatQueueId':_0x1ffa31['params']['id']},'transaction':_0x1cd45b});});})['then'](function(){_0x204c58['forEach'](function(_0x2ee4f4){socket['emit'](_0x1087('0x7b'),{'UserId':_0x2ee4f4['id'],'ChatQueueId':_0x2576a9['id']});});});});});}})[_0x1087('0x22')](respondWithStatusCode(_0x56b5a6,null))[_0x1087('0x2c')](handleError(_0x56b5a6,null));};exports[_0x1087('0x7c')]=function(_0x487104,_0x356347,_0x58bb4b){return db[_0x1087('0x73')][_0x1087('0x68')]({'where':{'id':_0x487104['query'][_0x1087('0x72')]},'attributes':['id'],'include':[{'model':db[_0x1087('0x69')],'as':_0x1087('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x356347,null))[_0x1087('0x22')](function(_0x39a5e4){var _0x3bbb28=_['map'](_0x39a5e4,'id');var _0x5143e4=[];var _0x27bd44=[];var _0x2e7d35=squel[_0x1087('0x7d')]();_0x2e7d35['field'](_0x1087('0x7e'))['from'](_0x1087('0x7f'),'tq')[_0x1087('0x80')](_0x1087('0x81'),'ut',_0x1087('0x82'))[_0x1087('0x4d')](_0x1087('0x83'),_0x487104[_0x1087('0x57')]['id']);for(var _0x512d77=0x0;_0x512d77<_0x39a5e4[_0x1087('0x47')];_0x512d77+=0x1){let _0x5d3839=_0x39a5e4[_0x512d77];for(var _0x25b8e1=0x0;_0x25b8e1<_0x5d3839[_0x1087('0x77')]['length'];_0x25b8e1+=0x1){let _0x5dd69e=_0x5d3839[_0x1087('0x77')][_0x25b8e1];var _0x21cf80=_0x2e7d35[_0x1087('0x84')]();_0x21cf80['where'](_0x1087('0x85'),_0x5dd69e['id']);_0x27bd44[_0x1087('0x86')](db['sequelize'][_0x1087('0x42')](_0x21cf80[_0x1087('0x87')](),{'type':db[_0x1087('0x78')][_0x1087('0x88')][_0x1087('0x89')]})['then'](function(_0x1ef102){if(_0x1ef102[_0x1087('0x47')]===0x1){return _0x5dd69e['id'];}else{var _0x49e035=_[_0x1087('0x8a')](_[_0x1087('0x4e')](_0x1ef102,_0x1087('0x8b')),function(_0x5af076){return _[_0x1087('0x8c')](_0x3bbb28,_0x5af076);});if(_0x49e035){return _0x5dd69e['id'];}}}));}}return BPromise[_0x1087('0x8d')](_0x27bd44)[_0x1087('0x22')](function(_0x4c2f91){_0x5143e4=_(_0x5143e4)[_0x1087('0x8e')](_0x4c2f91)['compact']()[_0x1087('0x8f')]();return db[_0x1087('0x53')]['find']({'where':{'id':_0x487104[_0x1087('0x57')]['id']}})[_0x1087('0x22')](function(_0x58d292){return db['sequelize']['transaction'](function(_0x38ff98){return _0x58d292[_0x1087('0x7c')](_0x487104[_0x1087('0x42')][_0x1087('0x72')],{'transaction':_0x38ff98})[_0x1087('0x22')](function(){if(!_[_0x1087('0x90')](_0x5143e4)){return _0x58d292[_0x1087('0x91')](_0x5143e4,{'transaction':_0x38ff98});}})[_0x1087('0x22')](function(){_0x5143e4['forEach'](function(_0x26dc76){socket[_0x1087('0x92')](_0x1087('0x93'),{'UserId':_0x26dc76,'ChatQueueId':_0x58d292['id']});});});});});});})[_0x1087('0x22')](respondWithStatusCode(_0x356347,null))[_0x1087('0x2c')](handleError(_0x356347,null));};exports[_0x1087('0x94')]=function(_0xa16af4,_0x218761,_0x610958){return db[_0x1087('0x53')][_0x1087('0x58')]({'where':{'id':_0xa16af4[_0x1087('0x57')]['id']}})['then'](handleEntityNotFound(_0x218761,null))[_0x1087('0x22')](function(_0x11f67d){if(_0x11f67d){return _0x11f67d[_0x1087('0x94')](_0xa16af4['body']['ids'],_[_0x1087('0x95')](_0xa16af4[_0x1087('0x5a')],['ids','id'])||{})[_0x1087('0x96')](function(_0x1cdd9a){for(var _0x848af6=0x0;_0x848af6<_0xa16af4[_0x1087('0x5a')][_0x1087('0x72')][_0x1087('0x47')];_0x848af6+=0x1){socket[_0x1087('0x92')](_0x1087('0x7b'),{'UserId':_0xa16af4[_0x1087('0x5a')]['ids'][_0x848af6],'ChatQueueId':_0xa16af4[_0x1087('0x57')]['id']});}return _0x1cdd9a;});}})[_0x1087('0x22')](respondWithResult(_0x218761,null))[_0x1087('0x2c')](handleError(_0x218761,null));};exports[_0x1087('0x91')]=function(_0x314571,_0x39dcc4,_0x5c5f84){return db[_0x1087('0x53')][_0x1087('0x58')]({'where':{'id':_0x314571[_0x1087('0x57')]['id']}})[_0x1087('0x22')](handleEntityNotFound(_0x39dcc4,null))[_0x1087('0x22')](function(_0x3a8711){if(_0x3a8711){return _0x3a8711['removeAgents'](_0x314571[_0x1087('0x42')]['ids'])['then'](function(){if(_[_0x1087('0x97')](_0x314571[_0x1087('0x42')][_0x1087('0x72')])){for(var _0x54edba=0x0;_0x54edba<_0x314571[_0x1087('0x42')][_0x1087('0x72')]['length'];_0x54edba+=0x1){socket[_0x1087('0x92')](_0x1087('0x93'),{'UserId':Number(_0x314571[_0x1087('0x42')]['ids'][_0x54edba]),'ChatQueueId':Number(_0x314571['params']['id'])});}}else{socket[_0x1087('0x92')](_0x1087('0x93'),{'UserId':Number(_0x314571['query'][_0x1087('0x72')]),'ChatQueueId':Number(_0x314571[_0x1087('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x39dcc4,null))['catch'](handleError(_0x39dcc4,null));};exports[_0x1087('0x98')]=function(_0x315ffa,_0x5a2767,_0x31387e){var _0x392ea6={};var _0x53d41e={};var _0x419742;var _0x3a9bc4;return db[_0x1087('0x53')][_0x1087('0x65')]({'where':{'id':_0x315ffa['params']['id']}})[_0x1087('0x22')](handleEntityNotFound(_0x5a2767,null))[_0x1087('0x22')](function(_0x41960a){if(_0x41960a){_0x419742=_0x41960a;_0x53d41e[_0x1087('0x40')]=_[_0x1087('0x41')](db[_0x1087('0x69')][_0x1087('0x3f')]);_0x53d41e[_0x1087('0x42')]=_['keys'](_0x315ffa[_0x1087('0x42')]);_0x53d41e[_0x1087('0x43')]=_[_0x1087('0x44')](_0x53d41e['model'],_0x53d41e[_0x1087('0x42')]);_0x392ea6[_0x1087('0x45')]=_[_0x1087('0x44')](_0x53d41e['model'],qs[_0x1087('0x46')](_0x315ffa[_0x1087('0x42')][_0x1087('0x46')]));_0x392ea6[_0x1087('0x45')]=_0x392ea6[_0x1087('0x45')][_0x1087('0x47')]?_0x392ea6['attributes']:_0x53d41e[_0x1087('0x40')];_0x392ea6[_0x1087('0x49')]=qs[_0x1087('0x4a')](_0x315ffa[_0x1087('0x42')][_0x1087('0x4a')]);_0x392ea6[_0x1087('0x4d')]=qs[_0x1087('0x43')](_[_0x1087('0x4b')](_0x315ffa[_0x1087('0x42')],_0x53d41e['filters']));if(_0x315ffa[_0x1087('0x42')][_0x1087('0x4c')]){_0x392ea6[_0x1087('0x4d')]=_['merge'](_0x392ea6[_0x1087('0x4d')],{'$or':_[_0x1087('0x4e')](_0x392ea6[_0x1087('0x45')],function(_0x16ef42){var _0x5a5003={};_0x5a5003[_0x16ef42]={'$like':'%'+_0x315ffa['query'][_0x1087('0x4c')]+'%'};return _0x5a5003;})});}_0x392ea6=_[_0x1087('0x51')]({},_0x392ea6,_0x315ffa[_0x1087('0x52')]);return _0x419742[_0x1087('0x98')](_0x392ea6);}})[_0x1087('0x22')](function(_0xdccada){if(_0xdccada){_0x3a9bc4=_0xdccada[_0x1087('0x47')];if(!_0x315ffa[_0x1087('0x42')][_0x1087('0x67')](_0x1087('0x48'))){_0x392ea6[_0x1087('0x32')]=qs[_0x1087('0x32')](_0x315ffa['query'][_0x1087('0x32')]);_0x392ea6['offset']=qs[_0x1087('0x31')](_0x315ffa[_0x1087('0x42')][_0x1087('0x31')]);}return _0x419742[_0x1087('0x98')](_0x392ea6);}})['then'](function(_0x557a82){if(_0x557a82){return _0x557a82?{'count':_0x3a9bc4,'rows':_0x557a82}:null;}})['then'](respondWithResult(_0x5a2767,null))['catch'](handleError(_0x5a2767,null));}; \ No newline at end of file +var _0x57ff=['agent','updatedAt','SIP','chatPause','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','tq.TeamId','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.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~!@#$%^&-_=+[{]}.','ChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','get','ChatQueues','UserProfileResource','stack','name','send','index','ChatQueue','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','getMembers','findOne','ChatQueueId','UserChatQueue','findAndCountAll','UserId'];(function(_0x2b048e,_0x289f5d){var _0x23e6d3=function(_0x1bfdf8){while(--_0x1bfdf8){_0x2b048e['push'](_0x2b048e['shift']());}};_0x23e6d3(++_0x289f5d);}(_0x57ff,0x1e1));var _0xf57f=function(_0x5409f7,_0x2bea06){_0x5409f7=_0x5409f7-0x0;var _0x45e2cf=_0x57ff[_0x5409f7];return _0x45e2cf;};'use strict';var pdf=require(_0xf57f('0x0'));var emlformat=require(_0xf57f('0x1'));var rimraf=require(_0xf57f('0x2'));var zipdir=require(_0xf57f('0x3'));var jsonpatch=require(_0xf57f('0x4'));var rp=require(_0xf57f('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf57f('0x6'));var util=require(_0xf57f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf57f('0x8'));var ejs=require(_0xf57f('0x9'));var fs=require('fs');var _=require(_0xf57f('0xa'));var squel=require('squel');var crypto=require(_0xf57f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf57f('0xc'));var toCsv=require(_0xf57f('0x8'));var querystring=require(_0xf57f('0xd'));var Papa=require(_0xf57f('0xe'));var Redis=require(_0xf57f('0xf'));var authService=require(_0xf57f('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57f('0x11'))('api');var utils=require(_0xf57f('0x12'));var config=require(_0xf57f('0x13'));var db=require(_0xf57f('0x14'))['db'];config[_0xf57f('0x15')]=_[_0xf57f('0x16')](config[_0xf57f('0x15')],{'host':_0xf57f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf57f('0x18'))[_0xf57f('0x19')](socket);var jayson=require(_0xf57f('0x1a'));var client=jayson[_0xf57f('0x1b')][_0xf57f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4901b7,_0x166baa,_0x47ba25){if(_0x47ba25){var _0x5bdccc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bdccc[_0xf57f('0x1d')](_0x166baa)){return _0x4901b7;}else{throw new db[(_0xf57f('0x1e'))]['ValidationError'](_0xf57f('0x1f'));}}else{return _0x4901b7;}}function respondWithRpcPromise(_0x3ff77a,_0x5f40e7,_0x3e63ec,_0x3ba9fc){return new BPromise(function(_0x88c493,_0x1c60fd){var _0xca1d8a=_0x3ba9fc||client;return _0xca1d8a['request'](_0x3ff77a,_0x3e63ec)['then'](function(_0x2e5788){logger['info'](_0xf57f('0x20'),_0x5f40e7,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5f40e7,_0xf57f('0x21'),JSON['stringify'](_0x2e5788));if(_0x2e5788['error']){if(_0x2e5788[_0xf57f('0x22')][_0xf57f('0x23')]===0x1f4){logger['error'](_0xf57f('0x20'),_0x5f40e7,_0x2e5788[_0xf57f('0x22')][_0xf57f('0x24')]);return _0x1c60fd(_0x2e5788[_0xf57f('0x22')][_0xf57f('0x24')]);}logger[_0xf57f('0x22')](_0xf57f('0x20'),_0x5f40e7,_0x2e5788[_0xf57f('0x22')][_0xf57f('0x24')]);return _0x88c493(_0x2e5788[_0xf57f('0x22')][_0xf57f('0x24')]);}else{logger[_0xf57f('0x25')](_0xf57f('0x20'),_0x5f40e7,_0xf57f('0x21'));_0x88c493(_0x2e5788['result']['message']);}})['catch'](function(_0x577021){logger['error'](_0xf57f('0x20'),_0x5f40e7,_0x577021);_0x1c60fd(_0x577021);});});}function respondWithStatusCode(_0x1b10d9,_0xf60bed){_0xf60bed=_0xf60bed||0xcc;return function(_0x5d37c9){if(_0x5d37c9){return _0x1b10d9[_0xf57f('0x26')](_0xf60bed);}return _0x1b10d9[_0xf57f('0x27')](_0xf60bed)[_0xf57f('0x28')]();};}function respondWithResult(_0x29c91c,_0x42cd23){_0x42cd23=_0x42cd23||0xc8;return function(_0x24a07b){if(_0x24a07b){return _0x29c91c[_0xf57f('0x27')](_0x42cd23)['json'](_0x24a07b);}};}function respondWithFilteredResult(_0x166c47,_0x4ac1c5){return function(_0x5c2fc8){if(_0x5c2fc8){var _0x2d3930=_0x5c2fc8[_0xf57f('0x29')],_0x398ef3=_0x4ac1c5[_0xf57f('0x2a')],_0x6f9473=_0x4ac1c5['offset']+_0x4ac1c5[_0xf57f('0x2b')],_0x3b3be6;if(_0x6f9473>=_0x2d3930){_0x6f9473=_0x2d3930;_0x3b3be6=0xc8;}else{_0x3b3be6=0xce;}_0x166c47['status'](_0x3b3be6);return _0x166c47['set'](_0xf57f('0x2c'),_0x398ef3+'-'+_0x6f9473+'/'+_0x2d3930)[_0xf57f('0x2d')](_0x5c2fc8);}return null;};}function patchUpdates(_0x3bdd45){return function(_0x2198f9){try{jsonpatch[_0xf57f('0x2e')](_0x2198f9,_0x3bdd45,!![]);}catch(_0x26afe4){return BPromise[_0xf57f('0x2f')](_0x26afe4);}return _0x2198f9['save']();};}function saveUpdates(_0x47422b,_0x5cc31a){return function(_0x3034fb){if(_0x3034fb){return _0x3034fb[_0xf57f('0x30')](_0x47422b)[_0xf57f('0x31')](function(_0x1d6090){return _0x1d6090;});}return null;};}function removeEntity(_0x2ad2a1,_0x18bb8c){return function(_0x2402e0){if(_0x2402e0){return _0x2402e0['destroy']()['then'](function(){var _0xb00e3a=_0x2402e0[_0xf57f('0x32')]({'plain':!![]});var _0x352e1a=_0xf57f('0x33');return db[_0xf57f('0x34')]['destroy']({'where':{'type':_0x352e1a,'resourceId':_0xb00e3a['id']}})['then'](function(){return _0x2402e0;});})[_0xf57f('0x31')](function(){_0x2ad2a1['status'](0xcc)[_0xf57f('0x28')]();});}};}function handleEntityNotFound(_0x2ea473,_0x5c84af){return function(_0x594d08){if(!_0x594d08){_0x2ea473[_0xf57f('0x26')](0x194);}return _0x594d08;};}function handleError(_0xccd53a,_0x4573a0){_0x4573a0=_0x4573a0||0x1f4;return function(_0x48197e){logger[_0xf57f('0x22')](_0x48197e[_0xf57f('0x35')]);if(_0x48197e[_0xf57f('0x36')]){delete _0x48197e[_0xf57f('0x36')];}_0xccd53a['status'](_0x4573a0)[_0xf57f('0x37')](_0x48197e);};}exports[_0xf57f('0x38')]=function(_0x1352ad,_0x2d6be3){var _0x56c543={},_0x45a538={},_0x3563f4={'count':0x0,'rows':[]};var _0x37a631=db[_0xf57f('0x39')][_0xf57f('0x3a')];_0x45a538[_0xf57f('0x3b')]=_[_0xf57f('0x3c')](_0x37a631);_0x45a538[_0xf57f('0x3d')]=_[_0xf57f('0x3c')](_0x1352ad[_0xf57f('0x3d')]);_0x45a538[_0xf57f('0x3e')]=_['intersection'](_0x45a538[_0xf57f('0x3b')],_0x45a538[_0xf57f('0x3d')]);_0x56c543[_0xf57f('0x3f')]=_[_0xf57f('0x40')](_0x45a538[_0xf57f('0x3b')],qs['fields'](_0x1352ad['query'][_0xf57f('0x41')]));_0x56c543[_0xf57f('0x3f')]=_0x56c543['attributes'][_0xf57f('0x42')]?_0x56c543[_0xf57f('0x3f')]:_0x45a538['model'];if(!_0x1352ad['query'][_0xf57f('0x43')](_0xf57f('0x44'))){_0x56c543[_0xf57f('0x2b')]=qs[_0xf57f('0x2b')](_0x1352ad[_0xf57f('0x3d')][_0xf57f('0x2b')]);_0x56c543['offset']=qs[_0xf57f('0x2a')](_0x1352ad[_0xf57f('0x3d')][_0xf57f('0x2a')]);}_0x56c543[_0xf57f('0x45')]=qs[_0xf57f('0x46')](_0x1352ad[_0xf57f('0x3d')]['sort']);_0x56c543[_0xf57f('0x47')]=qs[_0xf57f('0x3e')](_[_0xf57f('0x48')](_0x1352ad[_0xf57f('0x3d')],_0x45a538['filters']));if(_0x1352ad['query'][_0xf57f('0x49')]){_0x56c543[_0xf57f('0x47')]=_[_0xf57f('0x4a')](_0x56c543[_0xf57f('0x47')],{'$or':_[_0xf57f('0x4b')](_0x37a631,function(_0x3955e1){if(_0x3955e1[_0xf57f('0x4c')]['key']!==_0xf57f('0x4d')){var _0x290b7f={};_0x290b7f[_0x3955e1['field']]={'$like':'%'+_0x1352ad[_0xf57f('0x3d')][_0xf57f('0x49')]+'%'};return _0x290b7f;}})});}_0x56c543=_[_0xf57f('0x4a')]({},_0x56c543,_0x1352ad['options']);var _0x3b72ad={'where':_0x56c543[_0xf57f('0x47')]};return db[_0xf57f('0x39')][_0xf57f('0x29')](_0x3b72ad)[_0xf57f('0x31')](function(_0x41cc8f){_0x3563f4[_0xf57f('0x29')]=_0x41cc8f;if(_0x1352ad[_0xf57f('0x3d')]['includeAll']){_0x56c543[_0xf57f('0x4e')]=[{'all':!![]}];}return db[_0xf57f('0x39')][_0xf57f('0x4f')](_0x56c543);})[_0xf57f('0x31')](function(_0x3ab511){_0x3563f4[_0xf57f('0x50')]=_0x3ab511;return _0x3563f4;})['then'](respondWithFilteredResult(_0x2d6be3,_0x56c543))[_0xf57f('0x51')](handleError(_0x2d6be3,null));};exports[_0xf57f('0x52')]=function(_0x2fd389,_0xb3c4e7){var _0x3f06b6={'raw':!![],'where':{'id':_0x2fd389['params']['id']}},_0x5cfa88={};_0x5cfa88[_0xf57f('0x3b')]=_[_0xf57f('0x3c')](db[_0xf57f('0x39')][_0xf57f('0x3a')]);_0x5cfa88[_0xf57f('0x3d')]=_[_0xf57f('0x3c')](_0x2fd389['query']);_0x5cfa88[_0xf57f('0x3e')]=_['intersection'](_0x5cfa88[_0xf57f('0x3b')],_0x5cfa88[_0xf57f('0x3d')]);_0x3f06b6['attributes']=_[_0xf57f('0x40')](_0x5cfa88['model'],qs[_0xf57f('0x41')](_0x2fd389[_0xf57f('0x3d')][_0xf57f('0x41')]));_0x3f06b6['attributes']=_0x3f06b6['attributes'][_0xf57f('0x42')]?_0x3f06b6[_0xf57f('0x3f')]:_0x5cfa88[_0xf57f('0x3b')];if(_0x2fd389[_0xf57f('0x3d')][_0xf57f('0x53')]){_0x3f06b6[_0xf57f('0x4e')]=[{'all':!![]}];}_0x3f06b6=_[_0xf57f('0x4a')]({},_0x3f06b6,_0x2fd389[_0xf57f('0x54')]);return db[_0xf57f('0x39')]['find'](_0x3f06b6)['then'](handleEntityNotFound(_0xb3c4e7,null))[_0xf57f('0x31')](respondWithResult(_0xb3c4e7,null))[_0xf57f('0x51')](handleError(_0xb3c4e7,null));};exports['create']=function(_0x1bc504,_0x106b73){return db[_0xf57f('0x39')][_0xf57f('0x55')](_0x1bc504[_0xf57f('0x56')],{})[_0xf57f('0x31')](function(_0x19505e){var _0x2ac8e9=_0x1bc504[_0xf57f('0x57')][_0xf57f('0x32')]({'plain':!![]});if(!_0x2ac8e9)throw new Error(_0xf57f('0x58'));if(_0x2ac8e9[_0xf57f('0x59')]===_0xf57f('0x57')){var _0xfe1aa3=_0x19505e['get']({'plain':!![]});var _0x1876c2=_0xf57f('0x33');return db[_0xf57f('0x5a')][_0xf57f('0x5b')]({'where':{'name':_0x1876c2,'userProfileId':_0x2ac8e9[_0xf57f('0x5c')]},'raw':!![]})[_0xf57f('0x31')](function(_0x4b039d){if(_0x4b039d&&_0x4b039d[_0xf57f('0x5d')]===0x0){return db[_0xf57f('0x34')][_0xf57f('0x55')]({'name':_0xfe1aa3['name'],'resourceId':_0xfe1aa3['id'],'type':_0x4b039d[_0xf57f('0x36')],'sectionId':_0x4b039d['id']},{})[_0xf57f('0x31')](function(){return _0x19505e;});}else{return _0x19505e;}})[_0xf57f('0x51')](function(_0x377b72){logger[_0xf57f('0x22')](_0xf57f('0x5e'),_0x377b72);throw _0x377b72;});}return _0x19505e;})[_0xf57f('0x31')](respondWithResult(_0x106b73,0xc9))[_0xf57f('0x51')](handleError(_0x106b73,null));};exports[_0xf57f('0x30')]=function(_0x54bd39,_0x20095f){if(_0x54bd39[_0xf57f('0x56')]['id']){delete _0x54bd39[_0xf57f('0x56')]['id'];}return db[_0xf57f('0x39')][_0xf57f('0x5b')]({'where':{'id':_0x54bd39[_0xf57f('0x5f')]['id']}})[_0xf57f('0x31')](handleEntityNotFound(_0x20095f,null))[_0xf57f('0x31')](saveUpdates(_0x54bd39[_0xf57f('0x56')],null))[_0xf57f('0x31')](respondWithResult(_0x20095f,null))[_0xf57f('0x51')](handleError(_0x20095f,null));};exports[_0xf57f('0x60')]=function(_0x1dc162,_0x13b3ad){return db[_0xf57f('0x39')]['find']({'where':{'id':_0x1dc162['params']['id']}})[_0xf57f('0x31')](handleEntityNotFound(_0x13b3ad,null))[_0xf57f('0x31')](removeEntity(_0x13b3ad,null))[_0xf57f('0x51')](handleError(_0x13b3ad,null));};exports['describe']=function(_0x39e6de,_0x253054){return db[_0xf57f('0x39')]['describe']()['then'](respondWithResult(_0x253054,null))[_0xf57f('0x51')](handleError(_0x253054,null));};exports[_0xf57f('0x61')]=function(_0x5a51d2,_0x27068a,_0x1f921d){var _0xc830cd={'raw':!![],'where':{}},_0xb3d321={},_0x391788;return db[_0xf57f('0x39')][_0xf57f('0x62')]({'where':{'id':_0x5a51d2[_0xf57f('0x5f')]['id']}})[_0xf57f('0x31')](handleEntityNotFound(_0x27068a,null))[_0xf57f('0x31')](function(_0x2a0330){if(_0x2a0330){_0x391788=_0x2a0330['get']({'plain':!![]});_0xb3d321[_0xf57f('0x3b')]=_['keys'](db['UserChatQueue']['rawAttributes']);_0xb3d321[_0xf57f('0x3d')]=_[_0xf57f('0x3c')](_0x5a51d2[_0xf57f('0x3d')]);_0xb3d321[_0xf57f('0x3e')]=_[_0xf57f('0x40')](_0xb3d321[_0xf57f('0x3b')],_0xb3d321['query']);_0xc830cd[_0xf57f('0x3f')]=_[_0xf57f('0x40')](_0xb3d321[_0xf57f('0x3b')],qs[_0xf57f('0x41')](_0x5a51d2[_0xf57f('0x3d')]['fields']));_0xc830cd[_0xf57f('0x3f')]=_0xc830cd[_0xf57f('0x3f')][_0xf57f('0x42')]?_0xc830cd[_0xf57f('0x3f')]:_0xb3d321[_0xf57f('0x3b')];if(!_0x5a51d2[_0xf57f('0x3d')][_0xf57f('0x43')](_0xf57f('0x44'))){_0xc830cd['limit']=qs['limit'](_0x5a51d2['query'][_0xf57f('0x2b')]);_0xc830cd['offset']=qs['offset'](_0x5a51d2[_0xf57f('0x3d')][_0xf57f('0x2a')]);}_0xc830cd[_0xf57f('0x45')]=qs[_0xf57f('0x46')](_0x5a51d2['query'][_0xf57f('0x46')]);_0xc830cd[_0xf57f('0x47')]=qs['filters'](_[_0xf57f('0x48')](_0x5a51d2[_0xf57f('0x3d')],_0xb3d321[_0xf57f('0x3e')]));_0xc830cd[_0xf57f('0x47')][_0xf57f('0x63')]=_0x2a0330['id'];if(_0x5a51d2['query'][_0xf57f('0x49')]){_0xc830cd[_0xf57f('0x47')]=_['merge'](_0xc830cd['where'],{'$or':_[_0xf57f('0x4b')](_0xc830cd[_0xf57f('0x3f')],function(_0x4a2fff){var _0x3f6b0d={};_0x3f6b0d[_0x4a2fff]={'$like':'%'+_0x5a51d2[_0xf57f('0x3d')][_0xf57f('0x49')]+'%'};return _0x3f6b0d;})});}_0xc830cd=_[_0xf57f('0x4a')]({},_0xc830cd,_0x5a51d2[_0xf57f('0x54')]);return db[_0xf57f('0x64')]['findAll'](_0xc830cd);}})[_0xf57f('0x31')](function(_0x12129c){if(_0x12129c){return db['User'][_0xf57f('0x65')]({'where':{'id':_['map'](_0x12129c,_0xf57f('0x66')),'role':_0xf57f('0x67')},'attributes':['id','name','chatPause',_0xf57f('0x68'),'createdAt']});}})[_0xf57f('0x31')](function(_0x98b048){if(_0x98b048){return{'count':_0x98b048[_0xf57f('0x29')],'rows':_[_0xf57f('0x4b')](_0x98b048[_0xf57f('0x50')],function(_0x2d22ef){return{'membername':_0x2d22ef['name'],'UserId':_0x2d22ef['id'],'queue_name':_0x391788[_0xf57f('0x36')],'ChatQueueId':_0x391788['id'],'interface':util['format']('%s/%s',_0xf57f('0x69'),_0x2d22ef[_0xf57f('0x36')]),'penalty':0x0,'paused':_0x2d22ef[_0xf57f('0x6a')],'createdAt':_0x2d22ef[_0xf57f('0x6b')],'updatedAt':_0x2d22ef[_0xf57f('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x27068a,_0xc830cd))[_0xf57f('0x51')](handleError(_0x27068a,null));};exports[_0xf57f('0x6c')]=function(_0x5009a5,_0x1caa51,_0x28d281){var _0x38e70b={};var _0x5f4e2c={};var _0x32cca9;var _0x94936e;return db[_0xf57f('0x39')][_0xf57f('0x62')]({'where':{'id':_0x5009a5[_0xf57f('0x5f')]['id']}})[_0xf57f('0x31')](handleEntityNotFound(_0x1caa51,null))[_0xf57f('0x31')](function(_0x3d67a5){if(_0x3d67a5){_0x32cca9=_0x3d67a5;_0x5f4e2c[_0xf57f('0x3b')]=_[_0xf57f('0x3c')](db[_0xf57f('0x6d')][_0xf57f('0x3a')]);_0x5f4e2c[_0xf57f('0x3d')]=_[_0xf57f('0x3c')](_0x5009a5[_0xf57f('0x3d')]);_0x5f4e2c['filters']=_[_0xf57f('0x40')](_0x5f4e2c['model'],_0x5f4e2c[_0xf57f('0x3d')]);_0x38e70b['attributes']=_[_0xf57f('0x40')](_0x5f4e2c[_0xf57f('0x3b')],qs[_0xf57f('0x41')](_0x5009a5[_0xf57f('0x3d')]['fields']));_0x38e70b[_0xf57f('0x3f')]=_0x38e70b['attributes'][_0xf57f('0x42')]?_0x38e70b['attributes']:_0x5f4e2c[_0xf57f('0x3b')];_0x38e70b[_0xf57f('0x45')]=qs['sort'](_0x5009a5[_0xf57f('0x3d')][_0xf57f('0x46')]);_0x38e70b[_0xf57f('0x47')]=qs[_0xf57f('0x3e')](_[_0xf57f('0x48')](_0x5009a5[_0xf57f('0x3d')],_0x5f4e2c[_0xf57f('0x3e')]));if(_0x5009a5[_0xf57f('0x3d')]['filter']){_0x38e70b['where']=_[_0xf57f('0x4a')](_0x38e70b[_0xf57f('0x47')],{'$or':_['map'](_0x38e70b['attributes'],function(_0x13a1d8){var _0x15dc8e={};_0x15dc8e[_0x13a1d8]={'$like':'%'+_0x5009a5[_0xf57f('0x3d')][_0xf57f('0x49')]+'%'};return _0x15dc8e;})});}_0x38e70b=_[_0xf57f('0x4a')]({},_0x38e70b,_0x5009a5[_0xf57f('0x54')]);return _0x32cca9['getTeams'](_0x38e70b);}})[_0xf57f('0x31')](function(_0xf26fe7){if(_0xf26fe7){_0x94936e=_0xf26fe7[_0xf57f('0x42')];if(!_0x5009a5[_0xf57f('0x3d')]['hasOwnProperty'](_0xf57f('0x44'))){_0x38e70b['limit']=qs[_0xf57f('0x2b')](_0x5009a5[_0xf57f('0x3d')]['limit']);_0x38e70b[_0xf57f('0x2a')]=qs['offset'](_0x5009a5[_0xf57f('0x3d')][_0xf57f('0x2a')]);}return _0x32cca9[_0xf57f('0x6c')](_0x38e70b);}})['then'](function(_0x4bee9a){if(_0x4bee9a){return _0x4bee9a?{'count':_0x94936e,'rows':_0x4bee9a}:null;}})[_0xf57f('0x31')](respondWithResult(_0x1caa51,null))[_0xf57f('0x51')](handleError(_0x1caa51,null));};exports[_0xf57f('0x6e')]=function(_0xd07139,_0x4dd5f5,_0x4d1565){var _0x24de4c=_0xd07139[_0xf57f('0x56')][_0xf57f('0x6f')];return db[_0xf57f('0x6d')][_0xf57f('0x4f')]({'where':{'id':_0x24de4c},'attributes':['id'],'include':[{'model':db[_0xf57f('0x70')],'as':_0xf57f('0x71'),'attributes':['id',_0xf57f('0x36'),_0xf57f('0x72'),'voicePause',_0xf57f('0x73')],'raw':!![]}]})[_0xf57f('0x31')](function(_0x5a46cf){if(_0x5a46cf){var _0x33b3a2=_[_0xf57f('0x74')](_0x5a46cf,function(_0x4debee){var _0x118837=_0x4debee[_0xf57f('0x32')]({'plain':!![]});return _0x118837['Agents'];});return db['ChatQueue'][_0xf57f('0x5b')]({'where':{'id':_0xd07139[_0xf57f('0x5f')]['id']}})[_0xf57f('0x31')](function(_0x116b6b){return db[_0xf57f('0x75')][_0xf57f('0x76')](function(_0x233ea8){return _0x116b6b[_0xf57f('0x6e')](_0x24de4c,{'transaction':_0x233ea8})[_0xf57f('0x31')](function(){return BPromise[_0xf57f('0x77')](_0x33b3a2,function(_0x22e491){return db[_0xf57f('0x64')][_0xf57f('0x78')]({'where':{'UserId':_0x22e491['id'],'ChatQueueId':_0xd07139[_0xf57f('0x5f')]['id']},'transaction':_0x233ea8});});})[_0xf57f('0x31')](function(){_0x33b3a2[_0xf57f('0x79')](function(_0x168843){socket[_0xf57f('0x7a')](_0xf57f('0x7b'),{'UserId':_0x168843['id'],'ChatQueueId':_0x116b6b['id']});});});});});}})[_0xf57f('0x31')](respondWithStatusCode(_0x4dd5f5,null))[_0xf57f('0x51')](handleError(_0x4dd5f5,null));};exports[_0xf57f('0x7c')]=function(_0x3dcd33,_0x1e9bfa,_0x57ec57){return db[_0xf57f('0x6d')]['findAll']({'where':{'id':_0x3dcd33[_0xf57f('0x3d')][_0xf57f('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xf57f('0x70')],'as':_0xf57f('0x71'),'attributes':['id'],'raw':!![]}]})[_0xf57f('0x31')](handleEntityNotFound(_0x1e9bfa,null))[_0xf57f('0x31')](function(_0x1e4e9f){var _0x8c0ccc=_[_0xf57f('0x4b')](_0x1e4e9f,'id');var _0x5f3523=[];var _0x1bb09d=[];var _0x379ebe=squel['select']();_0x379ebe['field'](_0xf57f('0x7d'))['from'](_0xf57f('0x7e'),'tq')['join'](_0xf57f('0x7f'),'ut',_0xf57f('0x80'))[_0xf57f('0x47')](_0xf57f('0x81'),_0x3dcd33[_0xf57f('0x5f')]['id']);for(var _0x2bd073=0x0;_0x2bd073<_0x1e4e9f['length'];_0x2bd073+=0x1){let _0x2b9f72=_0x1e4e9f[_0x2bd073];for(var _0xc1743e=0x0;_0xc1743e<_0x2b9f72[_0xf57f('0x71')][_0xf57f('0x42')];_0xc1743e+=0x1){let _0x3f2508=_0x2b9f72[_0xf57f('0x71')][_0xc1743e];var _0x2599bf=_0x379ebe[_0xf57f('0x82')]();_0x2599bf[_0xf57f('0x47')](_0xf57f('0x83'),_0x3f2508['id']);_0x1bb09d[_0xf57f('0x84')](db[_0xf57f('0x75')][_0xf57f('0x3d')](_0x2599bf[_0xf57f('0x85')](),{'type':db[_0xf57f('0x75')]['QueryTypes']['SELECT']})[_0xf57f('0x31')](function(_0x37a4c0){if(_0x37a4c0['length']===0x1){return _0x3f2508['id'];}else{var _0x36d096=_[_0xf57f('0x86')](_[_0xf57f('0x4b')](_0x37a4c0,_0xf57f('0x87')),function(_0x316bf1){return _['includes'](_0x8c0ccc,_0x316bf1);});if(_0x36d096){return _0x3f2508['id'];}}}));}}return BPromise[_0xf57f('0x88')](_0x1bb09d)['then'](function(_0x4a6df7){_0x5f3523=_(_0x5f3523)[_0xf57f('0x89')](_0x4a6df7)[_0xf57f('0x8a')]()['value']();return db['ChatQueue'][_0xf57f('0x5b')]({'where':{'id':_0x3dcd33[_0xf57f('0x5f')]['id']}})[_0xf57f('0x31')](function(_0x5b1bbb){return db[_0xf57f('0x75')][_0xf57f('0x76')](function(_0x11a015){return _0x5b1bbb[_0xf57f('0x7c')](_0x3dcd33[_0xf57f('0x3d')]['ids'],{'transaction':_0x11a015})['then'](function(){if(!_[_0xf57f('0x8b')](_0x5f3523)){return _0x5b1bbb[_0xf57f('0x8c')](_0x5f3523,{'transaction':_0x11a015});}})[_0xf57f('0x31')](function(){_0x5f3523[_0xf57f('0x79')](function(_0x310f69){socket[_0xf57f('0x7a')](_0xf57f('0x8d'),{'UserId':_0x310f69,'ChatQueueId':_0x5b1bbb['id']});});});});});});})[_0xf57f('0x31')](respondWithStatusCode(_0x1e9bfa,null))[_0xf57f('0x51')](handleError(_0x1e9bfa,null));};exports[_0xf57f('0x8e')]=function(_0x363c88,_0x44769e,_0x36ce1d){return db['ChatQueue']['find']({'where':{'id':_0x363c88[_0xf57f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x44769e,null))[_0xf57f('0x31')](function(_0xba0652){if(_0xba0652){return _0xba0652['addAgents'](_0x363c88[_0xf57f('0x56')][_0xf57f('0x6f')],_[_0xf57f('0x8f')](_0x363c88[_0xf57f('0x56')],[_0xf57f('0x6f'),'id'])||{})[_0xf57f('0x90')](function(_0xdb47ff){for(var _0x22ec89=0x0;_0x22ec89<_0x363c88['body'][_0xf57f('0x6f')]['length'];_0x22ec89+=0x1){socket['emit'](_0xf57f('0x7b'),{'UserId':_0x363c88[_0xf57f('0x56')][_0xf57f('0x6f')][_0x22ec89],'ChatQueueId':_0x363c88['params']['id']});}return _0xdb47ff;});}})[_0xf57f('0x31')](respondWithResult(_0x44769e,null))[_0xf57f('0x51')](handleError(_0x44769e,null));};exports[_0xf57f('0x8c')]=function(_0x1ca8a9,_0x4b21fa,_0xda68b8){return db[_0xf57f('0x39')][_0xf57f('0x5b')]({'where':{'id':_0x1ca8a9[_0xf57f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4b21fa,null))[_0xf57f('0x31')](function(_0x4a0cdc){if(_0x4a0cdc){return _0x4a0cdc[_0xf57f('0x8c')](_0x1ca8a9[_0xf57f('0x3d')][_0xf57f('0x6f')])[_0xf57f('0x31')](function(){if(_['isArray'](_0x1ca8a9[_0xf57f('0x3d')][_0xf57f('0x6f')])){for(var _0x5f1d6b=0x0;_0x5f1d6b<_0x1ca8a9['query'][_0xf57f('0x6f')]['length'];_0x5f1d6b+=0x1){socket[_0xf57f('0x7a')](_0xf57f('0x8d'),{'UserId':Number(_0x1ca8a9['query'][_0xf57f('0x6f')][_0x5f1d6b]),'ChatQueueId':Number(_0x1ca8a9[_0xf57f('0x5f')]['id'])});}}else{socket[_0xf57f('0x7a')](_0xf57f('0x8d'),{'UserId':Number(_0x1ca8a9[_0xf57f('0x3d')]['ids']),'ChatQueueId':Number(_0x1ca8a9[_0xf57f('0x5f')]['id'])});}});}})[_0xf57f('0x31')](respondWithStatusCode(_0x4b21fa,null))[_0xf57f('0x51')](handleError(_0x4b21fa,null));};exports[_0xf57f('0x91')]=function(_0x291552,_0x2de6de,_0x37bf2a){var _0x2d2202={};var _0x250936={};var _0x1d05eb;var _0x42707e;return db[_0xf57f('0x39')][_0xf57f('0x62')]({'where':{'id':_0x291552[_0xf57f('0x5f')]['id']}})[_0xf57f('0x31')](handleEntityNotFound(_0x2de6de,null))[_0xf57f('0x31')](function(_0xe84efe){if(_0xe84efe){_0x1d05eb=_0xe84efe;_0x250936[_0xf57f('0x3b')]=_['keys'](db['User']['rawAttributes']);_0x250936['query']=_['keys'](_0x291552[_0xf57f('0x3d')]);_0x250936[_0xf57f('0x3e')]=_[_0xf57f('0x40')](_0x250936[_0xf57f('0x3b')],_0x250936[_0xf57f('0x3d')]);_0x2d2202[_0xf57f('0x3f')]=_[_0xf57f('0x40')](_0x250936[_0xf57f('0x3b')],qs['fields'](_0x291552[_0xf57f('0x3d')][_0xf57f('0x41')]));_0x2d2202[_0xf57f('0x3f')]=_0x2d2202[_0xf57f('0x3f')][_0xf57f('0x42')]?_0x2d2202[_0xf57f('0x3f')]:_0x250936['model'];_0x2d2202['order']=qs['sort'](_0x291552['query'][_0xf57f('0x46')]);_0x2d2202[_0xf57f('0x47')]=qs['filters'](_[_0xf57f('0x48')](_0x291552[_0xf57f('0x3d')],_0x250936[_0xf57f('0x3e')]));if(_0x291552[_0xf57f('0x3d')][_0xf57f('0x49')]){_0x2d2202[_0xf57f('0x47')]=_[_0xf57f('0x4a')](_0x2d2202[_0xf57f('0x47')],{'$or':_[_0xf57f('0x4b')](_0x2d2202['attributes'],function(_0x4c7646){var _0x809b52={};_0x809b52[_0x4c7646]={'$like':'%'+_0x291552[_0xf57f('0x3d')]['filter']+'%'};return _0x809b52;})});}_0x2d2202=_[_0xf57f('0x4a')]({},_0x2d2202,_0x291552[_0xf57f('0x54')]);return _0x1d05eb[_0xf57f('0x91')](_0x2d2202);}})[_0xf57f('0x31')](function(_0x20477e){if(_0x20477e){_0x42707e=_0x20477e[_0xf57f('0x42')];if(!_0x291552['query'][_0xf57f('0x43')](_0xf57f('0x44'))){_0x2d2202[_0xf57f('0x2b')]=qs['limit'](_0x291552[_0xf57f('0x3d')][_0xf57f('0x2b')]);_0x2d2202[_0xf57f('0x2a')]=qs[_0xf57f('0x2a')](_0x291552[_0xf57f('0x3d')][_0xf57f('0x2a')]);}return _0x1d05eb[_0xf57f('0x91')](_0x2d2202);}})[_0xf57f('0x31')](function(_0x3644d1){if(_0x3644d1){return _0x3644d1?{'count':_0x42707e,'rows':_0x3644d1}:null;}})[_0xf57f('0x31')](respondWithResult(_0x2de6de,null))[_0xf57f('0x51')](handleError(_0x2de6de,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e781fae..41fe7cf 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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3d1843,_0x1d2b90){var _0x2a6274=function(_0x3a8ea9){while(--_0x3a8ea9){_0x3d1843['push'](_0x3d1843['shift']());}};_0x2a6274(++_0x1d2b90);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4a3ee3,_0x304512){_0x4a3ee3=_0x4a3ee3-0x0;var _0x56d16d=_0x0b0e[_0x4a3ee3];return _0x56d16d;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0xea3a17,_0x1fa90a){var _0x2765bb=function(_0x43a769){while(--_0x43a769){_0xea3a17['push'](_0xea3a17['shift']());}};_0x2765bb(++_0x1fa90a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1bce65,_0x4ef9bf){_0x1bce65=_0x1bce65-0x0;var _0xe96787=_0x5f2f[_0x1bce65];return _0xe96787;};'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 6889ecc..750316d 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 _0x6425=['../../config/environment','./chatQueue.attributes','exports','define','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x419c10,_0x263c86){var _0x30a33a=function(_0x2df0e7){while(--_0x2df0e7){_0x419c10['push'](_0x419c10['shift']());}};_0x30a33a(++_0x263c86);}(_0x6425,0x9f));var _0x5642=function(_0x15e8e7,_0x1f7c51){_0x15e8e7=_0x15e8e7-0x0;var _0x1bd660=_0x6425[_0x15e8e7];return _0x1bd660;};'use strict';var _=require(_0x5642('0x0'));var util=require(_0x5642('0x1'));var logger=require(_0x5642('0x2'))(_0x5642('0x3'));var moment=require(_0x5642('0x4'));var BPromise=require(_0x5642('0x5'));var rp=require(_0x5642('0x6'));var fs=require('fs');var path=require(_0x5642('0x7'));var rimraf=require(_0x5642('0x8'));var config=require(_0x5642('0x9'));var attributes=require(_0x5642('0xa'));module[_0x5642('0xb')]=function(_0x462344,_0x3896c2){return _0x462344[_0x5642('0xc')]('ChatQueue',attributes,{'tableName':_0x5642('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee28=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues','lodash','util'];(function(_0x4b9761,_0x5dcb7d){var _0x477333=function(_0x7f1119){while(--_0x7f1119){_0x4b9761['push'](_0x4b9761['shift']());}};_0x477333(++_0x5dcb7d);}(_0xee28,0x127));var _0x8ee2=function(_0xc7f90a,_0x471f81){_0xc7f90a=_0xc7f90a-0x0;var _0x2c5e40=_0xee28[_0xc7f90a];return _0x2c5e40;};'use strict';var _=require(_0x8ee2('0x0'));var util=require(_0x8ee2('0x1'));var logger=require(_0x8ee2('0x2'))('api');var moment=require(_0x8ee2('0x3'));var BPromise=require(_0x8ee2('0x4'));var rp=require(_0x8ee2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ee2('0x6'));var config=require(_0x8ee2('0x7'));var attributes=require(_0x8ee2('0x8'));module['exports']=function(_0x4d8592,_0x45aeed){return _0x4d8592['define'](_0x8ee2('0x9'),attributes,{'tableName':_0x8ee2('0xa'),'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 ef0759f..a9190c4 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 _0xf990=['result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','limit','include','map','model','attributes','ShowChatQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatQueue,\x20%s,\x20%s'];(function(_0x3cbe49,_0x4b96d5){var _0x4dcda2=function(_0x462f53){while(--_0x462f53){_0x3cbe49['push'](_0x3cbe49['shift']());}};_0x4dcda2(++_0x4b96d5);}(_0xf990,0x87));var _0x0f99=function(_0x5afff6,_0x3c2363){_0x5afff6=_0x5afff6-0x0;var _0x39adb1=_0xf990[_0x5afff6];return _0x39adb1;};'use strict';var _=require(_0x0f99('0x0'));var util=require('util');var moment=require(_0x0f99('0x1'));var BPromise=require(_0x0f99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f99('0x3'));var db=require(_0x0f99('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f99('0x5'))(_0x0f99('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f99('0x7'));var client=jayson[_0x0f99('0x8')][_0x0f99('0x9')]({'port':0x232a});config[_0x0f99('0xa')]=_['defaults'](config['redis'],{'host':_0x0f99('0xb'),'port':0x18eb});var socket=require(_0x0f99('0xc'))(new Redis(config[_0x0f99('0xa')]));require(_0x0f99('0xd'))['register'](socket);function respondWithRpcPromise(_0x184326,_0x40e2e8,_0x1dae9f){return new BPromise(function(_0x32a489,_0x56b042){return client[_0x0f99('0xe')](_0x184326,_0x1dae9f)[_0x0f99('0xf')](function(_0x31c4e8){logger[_0x0f99('0x10')]('ChatQueue,\x20%s,\x20%s',_0x40e2e8,'request\x20sent');logger[_0x0f99('0x11')](_0x0f99('0x12'),_0x40e2e8,_0x0f99('0x13'),JSON[_0x0f99('0x14')](_0x31c4e8));if(_0x31c4e8[_0x0f99('0x15')]){if(_0x31c4e8[_0x0f99('0x15')][_0x0f99('0x16')]===0x1f4){logger[_0x0f99('0x15')]('ChatQueue,\x20%s,\x20%s',_0x40e2e8,_0x31c4e8[_0x0f99('0x15')]['message']);return _0x56b042(_0x31c4e8['error'][_0x0f99('0x17')]);}logger[_0x0f99('0x15')](_0x0f99('0x18'),_0x40e2e8,_0x31c4e8[_0x0f99('0x15')][_0x0f99('0x17')]);return _0x32a489(_0x31c4e8['error'][_0x0f99('0x17')]);}else{logger[_0x0f99('0x10')]('ChatQueue,\x20%s,\x20%s',_0x40e2e8,_0x0f99('0x13'));_0x32a489(_0x31c4e8[_0x0f99('0x19')][_0x0f99('0x17')]);}})[_0x0f99('0x1a')](function(_0x34b545){logger[_0x0f99('0x15')](_0x0f99('0x18'),_0x40e2e8,_0x34b545);_0x56b042(_0x34b545);});});}exports[_0x0f99('0x1b')]=function(_0x119e5d){var _0x347656=this;return new Promise(function(_0x4f1fb1,_0x2f977c){return db[_0x0f99('0x1c')][_0x0f99('0x1d')]({'raw':_0x119e5d['options']?_0x119e5d['options'][_0x0f99('0x1e')]===undefined?!![]:![]:!![],'where':_0x119e5d[_0x0f99('0x1f')]?_0x119e5d['options'][_0x0f99('0x20')]||null:null,'attributes':_0x119e5d[_0x0f99('0x1f')]?_0x119e5d[_0x0f99('0x1f')]['attributes']||null:null,'limit':_0x119e5d[_0x0f99('0x1f')]?_0x119e5d[_0x0f99('0x1f')][_0x0f99('0x21')]||null:null,'include':_0x119e5d[_0x0f99('0x1f')]?_0x119e5d[_0x0f99('0x1f')][_0x0f99('0x22')]?_[_0x0f99('0x23')](_0x119e5d[_0x0f99('0x1f')]['include'],function(_0x32584c){return{'model':db[_0x32584c[_0x0f99('0x24')]],'as':_0x32584c['as'],'attributes':_0x32584c['attributes'],'include':_0x32584c[_0x0f99('0x22')]?_[_0x0f99('0x23')](_0x32584c[_0x0f99('0x22')],function(_0x3a32c6){return{'model':db[_0x3a32c6['model']],'as':_0x3a32c6['as'],'attributes':_0x3a32c6['attributes'],'include':_0x3a32c6[_0x0f99('0x22')]?_[_0x0f99('0x23')](_0x3a32c6[_0x0f99('0x22')],function(_0x32eb8d){return{'model':db[_0x32eb8d['model']],'as':_0x32eb8d['as'],'attributes':_0x32eb8d[_0x0f99('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0f99('0xf')](function(_0x7bdbd9){logger['info'](_0x0f99('0x1b'),_0x119e5d);logger['debug']('GetChatQueue',_0x119e5d,JSON[_0x0f99('0x14')](_0x7bdbd9));_0x4f1fb1(_0x7bdbd9);})['catch'](function(_0x4ed199){logger[_0x0f99('0x15')](_0x0f99('0x1b'),_0x4ed199['message'],_0x119e5d);_0x2f977c(_0x347656[_0x0f99('0x15')](0x1f4,_0x4ed199[_0x0f99('0x17')]));});});};exports[_0x0f99('0x26')]=function(_0x13a887){var _0x42e263=this;return new Promise(function(_0x32f40b,_0x5b86f8){return db['ChatQueue'][_0x0f99('0x27')]({'raw':_0x13a887[_0x0f99('0x1f')]?_0x13a887[_0x0f99('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x13a887[_0x0f99('0x1f')]?_0x13a887[_0x0f99('0x1f')][_0x0f99('0x20')]||null:null,'attributes':_0x13a887[_0x0f99('0x1f')]?_0x13a887[_0x0f99('0x1f')][_0x0f99('0x25')]||null:null,'include':_0x13a887[_0x0f99('0x1f')]?_0x13a887[_0x0f99('0x1f')][_0x0f99('0x22')]?_[_0x0f99('0x23')](_0x13a887[_0x0f99('0x1f')][_0x0f99('0x22')],function(_0x38c6f5){return{'model':db[_0x38c6f5[_0x0f99('0x24')]],'as':_0x38c6f5['as'],'attributes':_0x38c6f5[_0x0f99('0x25')],'include':_0x38c6f5['include']?_[_0x0f99('0x23')](_0x38c6f5[_0x0f99('0x22')],function(_0x2c5034){return{'model':db[_0x2c5034[_0x0f99('0x24')]],'as':_0x2c5034['as'],'attributes':_0x2c5034[_0x0f99('0x25')],'include':_0x2c5034[_0x0f99('0x22')]?_[_0x0f99('0x23')](_0x2c5034[_0x0f99('0x22')],function(_0x2b68fd){return{'model':db[_0x2b68fd[_0x0f99('0x24')]],'as':_0x2b68fd['as'],'attributes':_0x2b68fd[_0x0f99('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0f99('0xf')](function(_0x2f644f){logger['info'](_0x0f99('0x26'),_0x13a887);logger[_0x0f99('0x11')](_0x0f99('0x26'),_0x13a887,JSON['stringify'](_0x2f644f));_0x32f40b(_0x2f644f);})[_0x0f99('0x1a')](function(_0x50a145){logger[_0x0f99('0x15')](_0x0f99('0x26'),_0x50a145[_0x0f99('0x17')],_0x13a887);_0x5b86f8(_0x42e263[_0x0f99('0x15')](0x1f4,_0x50a145[_0x0f99('0x17')]));});});}; \ No newline at end of file +var _0xb9e7=['where','attributes','limit','include','map','model','then','info','debug','ShowChatQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','register','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetChatQueue','ChatQueue','findAll','options'];(function(_0xcc9e86,_0x4417fe){var _0x1ba436=function(_0x145b13){while(--_0x145b13){_0xcc9e86['push'](_0xcc9e86['shift']());}};_0x1ba436(++_0x4417fe);}(_0xb9e7,0x1df));var _0x7b9e=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xb9e7[_0xd2d54];return _0x78b113;};'use strict';var _=require('lodash');var util=require(_0x7b9e('0x0'));var moment=require(_0x7b9e('0x1'));var BPromise=require(_0x7b9e('0x2'));var rs=require(_0x7b9e('0x3'));var fs=require('fs');var Redis=require(_0x7b9e('0x4'));var db=require(_0x7b9e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b9e('0x6'))(_0x7b9e('0x7'));var config=require('../../config/environment');var jayson=require(_0x7b9e('0x8'));var client=jayson['client'][_0x7b9e('0x9')]({'port':0x232a});config[_0x7b9e('0xa')]=_[_0x7b9e('0xb')](config[_0x7b9e('0xa')],{'host':_0x7b9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b9e('0xa')]));require(_0x7b9e('0xd'))[_0x7b9e('0xe')](socket);function respondWithRpcPromise(_0x5e3651,_0x1fc56d,_0x564e6c){return new BPromise(function(_0x3d9495,_0x2d6ffd){return client['request'](_0x5e3651,_0x564e6c)['then'](function(_0x15ef78){logger['info'](_0x7b9e('0xf'),_0x1fc56d,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1fc56d,_0x7b9e('0x10'),JSON[_0x7b9e('0x11')](_0x15ef78));if(_0x15ef78[_0x7b9e('0x12')]){if(_0x15ef78[_0x7b9e('0x12')]['code']===0x1f4){logger[_0x7b9e('0x12')](_0x7b9e('0xf'),_0x1fc56d,_0x15ef78[_0x7b9e('0x12')][_0x7b9e('0x13')]);return _0x2d6ffd(_0x15ef78[_0x7b9e('0x12')][_0x7b9e('0x13')]);}logger[_0x7b9e('0x12')](_0x7b9e('0xf'),_0x1fc56d,_0x15ef78[_0x7b9e('0x12')][_0x7b9e('0x13')]);return _0x3d9495(_0x15ef78['error'][_0x7b9e('0x13')]);}else{logger['info'](_0x7b9e('0xf'),_0x1fc56d,_0x7b9e('0x10'));_0x3d9495(_0x15ef78['result'][_0x7b9e('0x13')]);}})[_0x7b9e('0x14')](function(_0x5cbc8b){logger['error'](_0x7b9e('0xf'),_0x1fc56d,_0x5cbc8b);_0x2d6ffd(_0x5cbc8b);});});}exports[_0x7b9e('0x15')]=function(_0x31dd0b){var _0x10e24e=this;return new Promise(function(_0x524d43,_0xa6db8b){return db[_0x7b9e('0x16')][_0x7b9e('0x17')]({'raw':_0x31dd0b[_0x7b9e('0x18')]?_0x31dd0b[_0x7b9e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x31dd0b[_0x7b9e('0x18')]?_0x31dd0b[_0x7b9e('0x18')][_0x7b9e('0x19')]||null:null,'attributes':_0x31dd0b[_0x7b9e('0x18')]?_0x31dd0b[_0x7b9e('0x18')][_0x7b9e('0x1a')]||null:null,'limit':_0x31dd0b[_0x7b9e('0x18')]?_0x31dd0b[_0x7b9e('0x18')][_0x7b9e('0x1b')]||null:null,'include':_0x31dd0b[_0x7b9e('0x18')]?_0x31dd0b[_0x7b9e('0x18')][_0x7b9e('0x1c')]?_[_0x7b9e('0x1d')](_0x31dd0b[_0x7b9e('0x18')][_0x7b9e('0x1c')],function(_0x2fde42){return{'model':db[_0x2fde42[_0x7b9e('0x1e')]],'as':_0x2fde42['as'],'attributes':_0x2fde42[_0x7b9e('0x1a')],'include':_0x2fde42[_0x7b9e('0x1c')]?_[_0x7b9e('0x1d')](_0x2fde42['include'],function(_0x2fd4c7){return{'model':db[_0x2fd4c7[_0x7b9e('0x1e')]],'as':_0x2fd4c7['as'],'attributes':_0x2fd4c7[_0x7b9e('0x1a')],'include':_0x2fd4c7[_0x7b9e('0x1c')]?_[_0x7b9e('0x1d')](_0x2fd4c7[_0x7b9e('0x1c')],function(_0x5b9db4){return{'model':db[_0x5b9db4[_0x7b9e('0x1e')]],'as':_0x5b9db4['as'],'attributes':_0x5b9db4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b9e('0x1f')](function(_0x49c4d8){logger[_0x7b9e('0x20')](_0x7b9e('0x15'),_0x31dd0b);logger[_0x7b9e('0x21')](_0x7b9e('0x15'),_0x31dd0b,JSON[_0x7b9e('0x11')](_0x49c4d8));_0x524d43(_0x49c4d8);})[_0x7b9e('0x14')](function(_0x17d5b2){logger[_0x7b9e('0x12')](_0x7b9e('0x15'),_0x17d5b2['message'],_0x31dd0b);_0xa6db8b(_0x10e24e[_0x7b9e('0x12')](0x1f4,_0x17d5b2[_0x7b9e('0x13')]));});});};exports[_0x7b9e('0x22')]=function(_0x378638){var _0xe53f7b=this;return new Promise(function(_0x4796b6,_0x2c005a){return db[_0x7b9e('0x16')][_0x7b9e('0x23')]({'raw':_0x378638[_0x7b9e('0x18')]?_0x378638[_0x7b9e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x378638[_0x7b9e('0x18')]?_0x378638[_0x7b9e('0x18')][_0x7b9e('0x19')]||null:null,'attributes':_0x378638[_0x7b9e('0x18')]?_0x378638['options']['attributes']||null:null,'include':_0x378638[_0x7b9e('0x18')]?_0x378638['options']['include']?_[_0x7b9e('0x1d')](_0x378638['options'][_0x7b9e('0x1c')],function(_0x5f568e){return{'model':db[_0x5f568e[_0x7b9e('0x1e')]],'as':_0x5f568e['as'],'attributes':_0x5f568e[_0x7b9e('0x1a')],'include':_0x5f568e['include']?_[_0x7b9e('0x1d')](_0x5f568e[_0x7b9e('0x1c')],function(_0x19c7ae){return{'model':db[_0x19c7ae[_0x7b9e('0x1e')]],'as':_0x19c7ae['as'],'attributes':_0x19c7ae['attributes'],'include':_0x19c7ae[_0x7b9e('0x1c')]?_[_0x7b9e('0x1d')](_0x19c7ae[_0x7b9e('0x1c')],function(_0x108870){return{'model':db[_0x108870[_0x7b9e('0x1e')]],'as':_0x108870['as'],'attributes':_0x108870['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x495d95){logger[_0x7b9e('0x20')]('ShowChatQueue',_0x378638);logger[_0x7b9e('0x21')](_0x7b9e('0x22'),_0x378638,JSON[_0x7b9e('0x11')](_0x495d95));_0x4796b6(_0x495d95);})['catch'](function(_0x344b10){logger[_0x7b9e('0x12')](_0x7b9e('0x22'),_0x344b10[_0x7b9e('0x13')],_0x378638);_0x2c005a(_0xe53f7b[_0x7b9e('0x12')](0x1f4,_0x344b10[_0x7b9e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d770b87..505c544 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xb10b,0x12a));var _0xbb10=function(_0x476c6c,_0x434db8){_0x476c6c=_0x476c6c-0x0;var _0xbb94db=_0xb10b[_0x476c6c];return _0xbb94db;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x470dbb,_0xbdf285){var _0x1e5d9c=function(_0x4c7715){while(--_0x4c7715){_0x470dbb['push'](_0x470dbb['shift']());}};_0x1e5d9c(++_0xbdf285);}(_0x5f2f,0x73));var _0xf5f2=function(_0x19fb09,_0x229c68){_0x19fb09=_0x19fb09-0x0;var _0x5b6b1b=_0x5f2f[_0x19fb09];return _0x5b6b1b;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 2c19fcb..dfc7ab8 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 _0x26d2=['../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x957193,_0x3fec8b){var _0x9473f8=function(_0x34b82b){while(--_0x34b82b){_0x957193['push'](_0x957193['shift']());}};_0x9473f8(++_0x3fec8b);}(_0x26d2,0x108));var _0x226d=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x26d2[_0x15b380];return _0x232c5c;};'use strict';var multer=require(_0x226d('0x0'));var util=require(_0x226d('0x1'));var path=require(_0x226d('0x2'));var timeout=require(_0x226d('0x3'));var express=require(_0x226d('0x4'));var router=express[_0x226d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x226d('0x6'));var config=require(_0x226d('0x7'));var controller=require(_0x226d('0x8'));router[_0x226d('0x9')]('/',auth[_0x226d('0xa')](),controller[_0x226d('0xb')]);router[_0x226d('0x9')](_0x226d('0xc'),auth[_0x226d('0xa')](),controller[_0x226d('0xd')]);router[_0x226d('0x9')](_0x226d('0xe'),auth['isAuthenticated'](),controller[_0x226d('0xf')]);router[_0x226d('0x9')](_0x226d('0x10'),auth[_0x226d('0xa')](),controller[_0x226d('0x11')]);router['get'](_0x226d('0x12'),auth['isAuthenticated'](),controller[_0x226d('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x226d('0x14')]);router[_0x226d('0x15')]('/',auth[_0x226d('0xa')](),controller['create']);router[_0x226d('0x15')](_0x226d('0x12'),auth[_0x226d('0xa')](),controller['addTeams']);router[_0x226d('0x15')](_0x226d('0x16'),auth[_0x226d('0xa')](),controller['addAgents']);router[_0x226d('0x17')](_0x226d('0xe'),auth[_0x226d('0xa')](),controller[_0x226d('0x18')]);router[_0x226d('0x19')](_0x226d('0xe'),auth[_0x226d('0xa')](),controller[_0x226d('0x1a')]);router[_0x226d('0x19')](_0x226d('0x12'),auth['isAuthenticated'](),controller[_0x226d('0x1b')]);router[_0x226d('0x19')](_0x226d('0x16'),auth[_0x226d('0xa')](),controller[_0x226d('0x1c')]);module[_0x226d('0x1d')]=router; \ No newline at end of file +var _0x42d9=['describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','addTeams','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','express','Router','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x17583f,_0x459860){var _0x1ab743=function(_0x302e31){while(--_0x302e31){_0x17583f['push'](_0x17583f['shift']());}};_0x1ab743(++_0x459860);}(_0x42d9,0x160));var _0x942d=function(_0x5cf063,_0x1b9a96){_0x5cf063=_0x5cf063-0x0;var _0xfa3092=_0x42d9[_0x5cf063];return _0xfa3092;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x942d('0x0'));var router=express[_0x942d('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x942d('0x2'));var config=require(_0x942d('0x3'));var controller=require(_0x942d('0x4'));router[_0x942d('0x5')]('/',auth[_0x942d('0x6')](),controller[_0x942d('0x7')]);router[_0x942d('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x942d('0x8')]);router['get'](_0x942d('0x9'),auth['isAuthenticated'](),controller[_0x942d('0xa')]);router[_0x942d('0x5')](_0x942d('0xb'),auth[_0x942d('0x6')](),controller[_0x942d('0xc')]);router['get']('/:id/teams',auth[_0x942d('0x6')](),controller[_0x942d('0xd')]);router[_0x942d('0x5')]('/:id/users',auth[_0x942d('0x6')](),controller[_0x942d('0xe')]);router[_0x942d('0xf')]('/',auth[_0x942d('0x6')](),controller['create']);router[_0x942d('0xf')]('/:id/teams',auth[_0x942d('0x6')](),controller[_0x942d('0x10')]);router[_0x942d('0xf')]('/:id/users',auth[_0x942d('0x6')](),controller['addAgents']);router[_0x942d('0x11')](_0x942d('0x9'),auth['isAuthenticated'](),controller[_0x942d('0x12')]);router[_0x942d('0x13')](_0x942d('0x9'),auth[_0x942d('0x6')](),controller[_0x942d('0x14')]);router[_0x942d('0x13')](_0x942d('0x15'),auth[_0x942d('0x6')](),controller[_0x942d('0x16')]);router[_0x942d('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x942d('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f08d049..dc3e1df 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 _0xad27=['STRING','DATE','moment','sequelize'];(function(_0x2cbce6,_0x3c8940){var _0x507d6a=function(_0x2ed6b8){while(--_0x2ed6b8){_0x2cbce6['push'](_0x2cbce6['shift']());}};_0x507d6a(++_0x3c8940);}(_0xad27,0x1a6));var _0x7ad2=function(_0x11329e,_0x51650d){_0x11329e=_0x11329e-0x0;var _0x66d9f2=_0xad27[_0x11329e];return _0x66d9f2;};'use strict';var moment=require(_0x7ad2('0x0'));var Sequelize=require(_0x7ad2('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7ad2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7ad2('0x2')]},'joinAt':{'type':Sequelize[_0x7ad2('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7ad2('0x3')]},'exitAt':{'type':Sequelize[_0x7ad2('0x3')]},'reason':{'type':Sequelize[_0x7ad2('0x2')]}}; \ No newline at end of file +var _0x759c=['exports','STRING','DATE','moment'];(function(_0xebf07d,_0x152383){var _0x636164=function(_0x34b1dd){while(--_0x34b1dd){_0xebf07d['push'](_0xebf07d['shift']());}};_0x636164(++_0x152383);}(_0x759c,0xeb));var _0xc759=function(_0x46470f,_0xe5381){_0x46470f=_0x46470f-0x0;var _0x56d3b5=_0x759c[_0x46470f];return _0x56d3b5;};'use strict';var moment=require(_0xc759('0x0'));var Sequelize=require('sequelize');module[_0xc759('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc759('0x2')]},'joinAt':{'type':Sequelize[_0xc759('0x3')]},'leaveAt':{'type':Sequelize[_0xc759('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc759('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 689d6fe..acf6581 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 _0x9fc5=['then','destroy','error','stack','name','send','ChatQueueReport','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','key','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x1c413e,_0x51788b){var _0x1d8309=function(_0x335195){while(--_0x335195){_0x1c413e['push'](_0x1c413e['shift']());}};_0x1d8309(++_0x51788b);}(_0x9fc5,0xb6));var _0x59fc=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x9fc5[_0xbb091];return _0x467a04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x59fc('0x0'));var rimraf=require(_0x59fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59fc('0x2'));var rp=require(_0x59fc('0x3'));var moment=require(_0x59fc('0x4'));var BPromise=require(_0x59fc('0x5'));var Mustache=require(_0x59fc('0x6'));var util=require(_0x59fc('0x7'));var path=require(_0x59fc('0x8'));var sox=require(_0x59fc('0x9'));var csv=require('to-csv');var ejs=require(_0x59fc('0xa'));var fs=require('fs');var _=require(_0x59fc('0xb'));var squel=require(_0x59fc('0xc'));var crypto=require('crypto');var jsforce=require(_0x59fc('0xd'));var deskjs=require(_0x59fc('0xe'));var toCsv=require(_0x59fc('0xf'));var querystring=require(_0x59fc('0x10'));var Papa=require(_0x59fc('0x11'));var Redis=require(_0x59fc('0x12'));var authService=require(_0x59fc('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x59fc('0x14'));var logger=require(_0x59fc('0x15'))(_0x59fc('0x16'));var utils=require(_0x59fc('0x17'));var config=require(_0x59fc('0x18'));var db=require(_0x59fc('0x19'))['db'];function respondWithStatusCode(_0x18e99e,_0x5da55d){_0x5da55d=_0x5da55d||0xcc;return function(_0x29ffcc){if(_0x29ffcc){return _0x18e99e[_0x59fc('0x1a')](_0x5da55d);}return _0x18e99e[_0x59fc('0x1b')](_0x5da55d)[_0x59fc('0x1c')]();};}function respondWithResult(_0x141769,_0x4fdce7){_0x4fdce7=_0x4fdce7||0xc8;return function(_0x1d02d0){if(_0x1d02d0){return _0x141769[_0x59fc('0x1b')](_0x4fdce7)[_0x59fc('0x1d')](_0x1d02d0);}};}function respondWithFilteredResult(_0x3139c0,_0x1ea295){return function(_0x50365f){if(_0x50365f){var _0x386d87=_0x50365f[_0x59fc('0x1e')],_0x362c6b=_0x1ea295[_0x59fc('0x1f')],_0x4e01f6=_0x1ea295[_0x59fc('0x1f')]+_0x1ea295[_0x59fc('0x20')],_0x206b54;if(_0x4e01f6>=_0x386d87){_0x4e01f6=_0x386d87;_0x206b54=0xc8;}else{_0x206b54=0xce;}_0x3139c0['status'](_0x206b54);return _0x3139c0[_0x59fc('0x21')](_0x59fc('0x22'),_0x362c6b+'-'+_0x4e01f6+'/'+_0x386d87)[_0x59fc('0x1d')](_0x50365f);}return null;};}function patchUpdates(_0x2a4c5f){return function(_0x395ede){try{jsonpatch[_0x59fc('0x23')](_0x395ede,_0x2a4c5f,!![]);}catch(_0x2157b3){return BPromise[_0x59fc('0x24')](_0x2157b3);}return _0x395ede['save']();};}function saveUpdates(_0x153c58,_0x530c11){return function(_0xdcfddb){if(_0xdcfddb){return _0xdcfddb['update'](_0x153c58)[_0x59fc('0x25')](function(_0x25cbdc){return _0x25cbdc;});}return null;};}function removeEntity(_0x3b1389,_0x28606a){return function(_0x327b1c){if(_0x327b1c){return _0x327b1c[_0x59fc('0x26')]()['then'](function(){_0x3b1389[_0x59fc('0x1b')](0xcc)[_0x59fc('0x1c')]();});}};}function handleEntityNotFound(_0x4b6964,_0x4cd81e){return function(_0x3ccb60){if(!_0x3ccb60){_0x4b6964[_0x59fc('0x1a')](0x194);}return _0x3ccb60;};}function handleError(_0x39d3a0,_0x25d8e5){_0x25d8e5=_0x25d8e5||0x1f4;return function(_0x188c1d){logger[_0x59fc('0x27')](_0x188c1d[_0x59fc('0x28')]);if(_0x188c1d[_0x59fc('0x29')]){delete _0x188c1d[_0x59fc('0x29')];}_0x39d3a0['status'](_0x25d8e5)[_0x59fc('0x2a')](_0x188c1d);};}exports['index']=function(_0x1975a1,_0x5eeabb){var _0x2b9e06={},_0x13dd35={},_0x5573e5={'count':0x0,'rows':[]};var _0x47121f=db[_0x59fc('0x2b')]['rawAttributes'];_0x13dd35[_0x59fc('0x2c')]=_[_0x59fc('0x2d')](_0x47121f);_0x13dd35[_0x59fc('0x2e')]=_[_0x59fc('0x2d')](_0x1975a1[_0x59fc('0x2e')]);_0x13dd35['filters']=_[_0x59fc('0x2f')](_0x13dd35[_0x59fc('0x2c')],_0x13dd35[_0x59fc('0x2e')]);_0x2b9e06['attributes']=_[_0x59fc('0x2f')](_0x13dd35[_0x59fc('0x2c')],qs[_0x59fc('0x30')](_0x1975a1[_0x59fc('0x2e')][_0x59fc('0x30')]));_0x2b9e06[_0x59fc('0x31')]=_0x2b9e06[_0x59fc('0x31')][_0x59fc('0x32')]?_0x2b9e06['attributes']:_0x13dd35[_0x59fc('0x2c')];if(!_0x1975a1[_0x59fc('0x2e')][_0x59fc('0x33')]('nolimit')){_0x2b9e06[_0x59fc('0x20')]=qs['limit'](_0x1975a1[_0x59fc('0x2e')][_0x59fc('0x20')]);_0x2b9e06[_0x59fc('0x1f')]=qs['offset'](_0x1975a1['query'][_0x59fc('0x1f')]);}_0x2b9e06[_0x59fc('0x34')]=qs[_0x59fc('0x35')](_0x1975a1[_0x59fc('0x2e')][_0x59fc('0x35')]);_0x2b9e06[_0x59fc('0x36')]=qs[_0x59fc('0x37')](_[_0x59fc('0x38')](_0x1975a1[_0x59fc('0x2e')],_0x13dd35[_0x59fc('0x37')]));if(_0x1975a1[_0x59fc('0x2e')][_0x59fc('0x39')]){_0x2b9e06[_0x59fc('0x36')]=_[_0x59fc('0x3a')](_0x2b9e06[_0x59fc('0x36')],{'$or':_[_0x59fc('0x3b')](_0x47121f,function(_0x38eda6){if(_0x38eda6['type'][_0x59fc('0x3c')]!==_0x59fc('0x3d')){var _0x314bf0={};_0x314bf0[_0x38eda6['field']]={'$like':'%'+_0x1975a1['query']['filter']+'%'};return _0x314bf0;}})});}_0x2b9e06=_['merge']({},_0x2b9e06,_0x1975a1[_0x59fc('0x3e')]);var _0xeeeb8b={'where':_0x2b9e06['where']};return db[_0x59fc('0x2b')][_0x59fc('0x1e')](_0xeeeb8b)[_0x59fc('0x25')](function(_0x10d421){_0x5573e5[_0x59fc('0x1e')]=_0x10d421;if(_0x1975a1[_0x59fc('0x2e')]['includeAll']){_0x2b9e06['include']=[{'all':!![]}];}return db[_0x59fc('0x2b')][_0x59fc('0x3f')](_0x2b9e06);})[_0x59fc('0x25')](function(_0x54a6fa){_0x5573e5[_0x59fc('0x40')]=_0x54a6fa;return _0x5573e5;})[_0x59fc('0x25')](respondWithFilteredResult(_0x5eeabb,_0x2b9e06))[_0x59fc('0x41')](handleError(_0x5eeabb,null));};exports['show']=function(_0x4dc127,_0x422bd9){var _0x4b90db={'raw':!![],'where':{'id':_0x4dc127[_0x59fc('0x42')]['id']}},_0x48231f={};_0x48231f[_0x59fc('0x2c')]=_[_0x59fc('0x2d')](db[_0x59fc('0x2b')]['rawAttributes']);_0x48231f[_0x59fc('0x2e')]=_[_0x59fc('0x2d')](_0x4dc127[_0x59fc('0x2e')]);_0x48231f['filters']=_[_0x59fc('0x2f')](_0x48231f[_0x59fc('0x2c')],_0x48231f[_0x59fc('0x2e')]);_0x4b90db[_0x59fc('0x31')]=_[_0x59fc('0x2f')](_0x48231f['model'],qs[_0x59fc('0x30')](_0x4dc127[_0x59fc('0x2e')]['fields']));_0x4b90db[_0x59fc('0x31')]=_0x4b90db[_0x59fc('0x31')][_0x59fc('0x32')]?_0x4b90db[_0x59fc('0x31')]:_0x48231f['model'];if(_0x4dc127[_0x59fc('0x2e')][_0x59fc('0x43')]){_0x4b90db[_0x59fc('0x44')]=[{'all':!![]}];}_0x4b90db=_[_0x59fc('0x3a')]({},_0x4b90db,_0x4dc127['options']);return db[_0x59fc('0x2b')][_0x59fc('0x45')](_0x4b90db)[_0x59fc('0x25')](handleEntityNotFound(_0x422bd9,null))[_0x59fc('0x25')](respondWithResult(_0x422bd9,null))[_0x59fc('0x41')](handleError(_0x422bd9,null));};exports[_0x59fc('0x46')]=function(_0xe8ef06,_0x2a5535){return db[_0x59fc('0x2b')][_0x59fc('0x46')](_0xe8ef06[_0x59fc('0x47')],{})['then'](respondWithResult(_0x2a5535,0xc9))[_0x59fc('0x41')](handleError(_0x2a5535,null));};exports['update']=function(_0x1549ae,_0x3fb30e){if(_0x1549ae['body']['id']){delete _0x1549ae[_0x59fc('0x47')]['id'];}return db[_0x59fc('0x2b')][_0x59fc('0x45')]({'where':{'id':_0x1549ae['params']['id']}})[_0x59fc('0x25')](handleEntityNotFound(_0x3fb30e,null))[_0x59fc('0x25')](saveUpdates(_0x1549ae['body'],null))[_0x59fc('0x25')](respondWithResult(_0x3fb30e,null))['catch'](handleError(_0x3fb30e,null));};exports[_0x59fc('0x26')]=function(_0x346b31,_0xa7095f){return db[_0x59fc('0x2b')][_0x59fc('0x45')]({'where':{'id':_0x346b31[_0x59fc('0x42')]['id']}})[_0x59fc('0x25')](handleEntityNotFound(_0xa7095f,null))[_0x59fc('0x25')](removeEntity(_0xa7095f,null))[_0x59fc('0x41')](handleError(_0xa7095f,null));};exports['describe']=function(_0x169506,_0x3b9ac5){return db['ChatQueueReport'][_0x59fc('0x48')]()[_0x59fc('0x25')](respondWithResult(_0x3b9ac5,null))[_0x59fc('0x41')](handleError(_0x3b9ac5,null));}; \ No newline at end of file +var _0x1a8f=['desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','map','type','VIRTUAL','field','filter','includeAll','include','findAll','rows','catch','show','params','intersection','options','ChatQueueReport','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','squel','jsforce'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x1a8f,0x87));var _0xf1a8=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0x1a8f[_0x447ef1];return _0x3d72ec;};'use strict';var pdf=require(_0xf1a8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf1a8('0x1'));var zipdir=require(_0xf1a8('0x2'));var jsonpatch=require(_0xf1a8('0x3'));var rp=require(_0xf1a8('0x4'));var moment=require(_0xf1a8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf1a8('0x6'));var csv=require(_0xf1a8('0x7'));var ejs=require(_0xf1a8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf1a8('0x9'));var crypto=require('crypto');var jsforce=require(_0xf1a8('0xa'));var deskjs=require(_0xf1a8('0xb'));var toCsv=require(_0xf1a8('0x7'));var querystring=require('querystring');var Papa=require(_0xf1a8('0xc'));var Redis=require('ioredis');var authService=require(_0xf1a8('0xd'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xf1a8('0xe'));var logger=require(_0xf1a8('0xf'))(_0xf1a8('0x10'));var utils=require(_0xf1a8('0x11'));var config=require('../../config/environment');var db=require(_0xf1a8('0x12'))['db'];function respondWithStatusCode(_0x548dee,_0x250103){_0x250103=_0x250103||0xcc;return function(_0x482274){if(_0x482274){return _0x548dee[_0xf1a8('0x13')](_0x250103);}return _0x548dee[_0xf1a8('0x14')](_0x250103)[_0xf1a8('0x15')]();};}function respondWithResult(_0x1ad08f,_0x2d0965){_0x2d0965=_0x2d0965||0xc8;return function(_0x292f03){if(_0x292f03){return _0x1ad08f[_0xf1a8('0x14')](_0x2d0965)[_0xf1a8('0x16')](_0x292f03);}};}function respondWithFilteredResult(_0x7438a7,_0x5854c5){return function(_0xd9c1bf){if(_0xd9c1bf){var _0x3efcf1=_0xd9c1bf[_0xf1a8('0x17')],_0x18533d=_0x5854c5[_0xf1a8('0x18')],_0x65d930=_0x5854c5[_0xf1a8('0x18')]+_0x5854c5[_0xf1a8('0x19')],_0x7c2937;if(_0x65d930>=_0x3efcf1){_0x65d930=_0x3efcf1;_0x7c2937=0xc8;}else{_0x7c2937=0xce;}_0x7438a7[_0xf1a8('0x14')](_0x7c2937);return _0x7438a7[_0xf1a8('0x1a')](_0xf1a8('0x1b'),_0x18533d+'-'+_0x65d930+'/'+_0x3efcf1)[_0xf1a8('0x16')](_0xd9c1bf);}return null;};}function patchUpdates(_0x50d06a){return function(_0x159d9d){try{jsonpatch[_0xf1a8('0x1c')](_0x159d9d,_0x50d06a,!![]);}catch(_0x389ef7){return BPromise[_0xf1a8('0x1d')](_0x389ef7);}return _0x159d9d[_0xf1a8('0x1e')]();};}function saveUpdates(_0x50c41f,_0xd2839){return function(_0x5a558a){if(_0x5a558a){return _0x5a558a[_0xf1a8('0x1f')](_0x50c41f)[_0xf1a8('0x20')](function(_0x26ee20){return _0x26ee20;});}return null;};}function removeEntity(_0x366b72,_0x32ada6){return function(_0x1b0fc0){if(_0x1b0fc0){return _0x1b0fc0[_0xf1a8('0x21')]()[_0xf1a8('0x20')](function(){_0x366b72['status'](0xcc)[_0xf1a8('0x15')]();});}};}function handleEntityNotFound(_0x153dbc,_0x1fa221){return function(_0x7ba846){if(!_0x7ba846){_0x153dbc[_0xf1a8('0x13')](0x194);}return _0x7ba846;};}function handleError(_0x4996a8,_0x121df2){_0x121df2=_0x121df2||0x1f4;return function(_0x380527){logger[_0xf1a8('0x22')](_0x380527[_0xf1a8('0x23')]);if(_0x380527['name']){delete _0x380527[_0xf1a8('0x24')];}_0x4996a8['status'](_0x121df2)[_0xf1a8('0x25')](_0x380527);};}exports[_0xf1a8('0x26')]=function(_0x2903c8,_0x5ef78e){var _0x50c807={},_0x43ba70={},_0x36769c={'count':0x0,'rows':[]};var _0x2bdc47=db['ChatQueueReport'][_0xf1a8('0x27')];_0x43ba70['model']=_[_0xf1a8('0x28')](_0x2bdc47);_0x43ba70[_0xf1a8('0x29')]=_['keys'](_0x2903c8[_0xf1a8('0x29')]);_0x43ba70['filters']=_['intersection'](_0x43ba70[_0xf1a8('0x2a')],_0x43ba70[_0xf1a8('0x29')]);_0x50c807[_0xf1a8('0x2b')]=_['intersection'](_0x43ba70[_0xf1a8('0x2a')],qs[_0xf1a8('0x2c')](_0x2903c8[_0xf1a8('0x29')]['fields']));_0x50c807[_0xf1a8('0x2b')]=_0x50c807[_0xf1a8('0x2b')][_0xf1a8('0x2d')]?_0x50c807[_0xf1a8('0x2b')]:_0x43ba70[_0xf1a8('0x2a')];if(!_0x2903c8[_0xf1a8('0x29')][_0xf1a8('0x2e')](_0xf1a8('0x2f'))){_0x50c807[_0xf1a8('0x19')]=qs[_0xf1a8('0x19')](_0x2903c8['query'][_0xf1a8('0x19')]);_0x50c807[_0xf1a8('0x18')]=qs[_0xf1a8('0x18')](_0x2903c8['query']['offset']);}_0x50c807[_0xf1a8('0x30')]=qs[_0xf1a8('0x31')](_0x2903c8[_0xf1a8('0x29')][_0xf1a8('0x31')]);_0x50c807[_0xf1a8('0x32')]=qs['filters'](_[_0xf1a8('0x33')](_0x2903c8['query'],_0x43ba70[_0xf1a8('0x34')]));if(_0x2903c8[_0xf1a8('0x29')]['filter']){_0x50c807[_0xf1a8('0x32')]=_[_0xf1a8('0x35')](_0x50c807[_0xf1a8('0x32')],{'$or':_[_0xf1a8('0x36')](_0x2bdc47,function(_0x27051d){if(_0x27051d[_0xf1a8('0x37')]['key']!==_0xf1a8('0x38')){var _0x17dc8b={};_0x17dc8b[_0x27051d[_0xf1a8('0x39')]]={'$like':'%'+_0x2903c8['query'][_0xf1a8('0x3a')]+'%'};return _0x17dc8b;}})});}_0x50c807=_[_0xf1a8('0x35')]({},_0x50c807,_0x2903c8['options']);var _0x46a7e6={'where':_0x50c807[_0xf1a8('0x32')]};return db['ChatQueueReport'][_0xf1a8('0x17')](_0x46a7e6)[_0xf1a8('0x20')](function(_0x5e0af1){_0x36769c[_0xf1a8('0x17')]=_0x5e0af1;if(_0x2903c8[_0xf1a8('0x29')][_0xf1a8('0x3b')]){_0x50c807[_0xf1a8('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xf1a8('0x3d')](_0x50c807);})[_0xf1a8('0x20')](function(_0x5bc6fe){_0x36769c[_0xf1a8('0x3e')]=_0x5bc6fe;return _0x36769c;})['then'](respondWithFilteredResult(_0x5ef78e,_0x50c807))[_0xf1a8('0x3f')](handleError(_0x5ef78e,null));};exports[_0xf1a8('0x40')]=function(_0x5b5fe2,_0x109271){var _0x45ff08={'raw':!![],'where':{'id':_0x5b5fe2[_0xf1a8('0x41')]['id']}},_0x1fe136={};_0x1fe136[_0xf1a8('0x2a')]=_[_0xf1a8('0x28')](db['ChatQueueReport'][_0xf1a8('0x27')]);_0x1fe136['query']=_[_0xf1a8('0x28')](_0x5b5fe2[_0xf1a8('0x29')]);_0x1fe136[_0xf1a8('0x34')]=_['intersection'](_0x1fe136[_0xf1a8('0x2a')],_0x1fe136[_0xf1a8('0x29')]);_0x45ff08[_0xf1a8('0x2b')]=_[_0xf1a8('0x42')](_0x1fe136[_0xf1a8('0x2a')],qs[_0xf1a8('0x2c')](_0x5b5fe2['query'][_0xf1a8('0x2c')]));_0x45ff08['attributes']=_0x45ff08[_0xf1a8('0x2b')][_0xf1a8('0x2d')]?_0x45ff08[_0xf1a8('0x2b')]:_0x1fe136[_0xf1a8('0x2a')];if(_0x5b5fe2[_0xf1a8('0x29')][_0xf1a8('0x3b')]){_0x45ff08[_0xf1a8('0x3c')]=[{'all':!![]}];}_0x45ff08=_[_0xf1a8('0x35')]({},_0x45ff08,_0x5b5fe2[_0xf1a8('0x43')]);return db[_0xf1a8('0x44')][_0xf1a8('0x45')](_0x45ff08)[_0xf1a8('0x20')](handleEntityNotFound(_0x109271,null))[_0xf1a8('0x20')](respondWithResult(_0x109271,null))[_0xf1a8('0x3f')](handleError(_0x109271,null));};exports[_0xf1a8('0x46')]=function(_0x273d50,_0x3b0996){return db[_0xf1a8('0x44')][_0xf1a8('0x46')](_0x273d50['body'],{})[_0xf1a8('0x20')](respondWithResult(_0x3b0996,0xc9))['catch'](handleError(_0x3b0996,null));};exports[_0xf1a8('0x1f')]=function(_0x18d8c8,_0xe0ea98){if(_0x18d8c8[_0xf1a8('0x47')]['id']){delete _0x18d8c8['body']['id'];}return db[_0xf1a8('0x44')][_0xf1a8('0x45')]({'where':{'id':_0x18d8c8[_0xf1a8('0x41')]['id']}})['then'](handleEntityNotFound(_0xe0ea98,null))[_0xf1a8('0x20')](saveUpdates(_0x18d8c8[_0xf1a8('0x47')],null))[_0xf1a8('0x20')](respondWithResult(_0xe0ea98,null))[_0xf1a8('0x3f')](handleError(_0xe0ea98,null));};exports[_0xf1a8('0x21')]=function(_0xf69e59,_0x31c05b){return db[_0xf1a8('0x44')][_0xf1a8('0x45')]({'where':{'id':_0xf69e59[_0xf1a8('0x41')]['id']}})['then'](handleEntityNotFound(_0x31c05b,null))[_0xf1a8('0x20')](removeEntity(_0x31c05b,null))[_0xf1a8('0x3f')](handleError(_0x31c05b,null));};exports['describe']=function(_0x1ee46b,_0x83afa2){return db[_0xf1a8('0x44')][_0xf1a8('0x48')]()[_0xf1a8('0x20')](respondWithResult(_0x83afa2,null))[_0xf1a8('0x3f')](handleError(_0x83afa2,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c276db4..420f8f2 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 _0x73c6=['moment','bluebird','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','report_chat_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1342bb,_0x522400){var _0x3a91de=function(_0x38b6eb){while(--_0x38b6eb){_0x1342bb['push'](_0x1342bb['shift']());}};_0x3a91de(++_0x522400);}(_0x73c6,0x134));var _0x673c=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x73c6[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x673c('0x0'));var util=require(_0x673c('0x1'));var logger=require(_0x673c('0x2'))(_0x673c('0x3'));var moment=require(_0x673c('0x4'));var BPromise=require(_0x673c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x673c('0x6'));var rimraf=require(_0x673c('0x7'));var config=require(_0x673c('0x8'));var attributes=require(_0x673c('0x9'));module[_0x673c('0xa')]=function(_0x47b3de,_0x43f640){return _0x47b3de['define']('ChatQueueReport',attributes,{'tableName':_0x673c('0xb'),'paranoid':![],'indexes':[{'name':_0x673c('0xc'),'fields':[_0x673c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fa7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue','uniqueid','util'];(function(_0x40cfbe,_0x2b3c05){var _0x148201=function(_0x319b9f){while(--_0x319b9f){_0x40cfbe['push'](_0x40cfbe['shift']());}};_0x148201(++_0x2b3c05);}(_0x7fa7,0x74));var _0x77fa=function(_0x323413,_0x421d63){_0x323413=_0x323413-0x0;var _0xe2aca0=_0x7fa7[_0x323413];return _0xe2aca0;};'use strict';var _=require('lodash');var util=require(_0x77fa('0x0'));var logger=require(_0x77fa('0x1'))(_0x77fa('0x2'));var moment=require(_0x77fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x77fa('0x4'));var fs=require('fs');var path=require(_0x77fa('0x5'));var rimraf=require(_0x77fa('0x6'));var config=require(_0x77fa('0x7'));var attributes=require(_0x77fa('0x8'));module['exports']=function(_0x1ecfe0,_0x166997){return _0x1ecfe0[_0x77fa('0x9')](_0x77fa('0xa'),attributes,{'tableName':_0x77fa('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x77fa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8b642f7..9c3427b 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 _0x2ff5=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','ChatQueueReport','options','raw','CreateChatQueueReport','UpdateChatQueueReport','body','where','limit'];(function(_0x414ffa,_0x1ea7a5){var _0x55a8fb=function(_0x5a310e){while(--_0x5a310e){_0x414ffa['push'](_0x414ffa['shift']());}};_0x55a8fb(++_0x1ea7a5);}(_0x2ff5,0xd2));var _0x52ff=function(_0x46840a,_0x17415f){_0x46840a=_0x46840a-0x0;var _0x5435dd=_0x2ff5[_0x46840a];return _0x5435dd;};'use strict';var _=require(_0x52ff('0x0'));var util=require(_0x52ff('0x1'));var moment=require(_0x52ff('0x2'));var BPromise=require(_0x52ff('0x3'));var rs=require(_0x52ff('0x4'));var fs=require('fs');var Redis=require(_0x52ff('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x52ff('0x6'))('rpc');var config=require(_0x52ff('0x7'));var jayson=require(_0x52ff('0x8'));var client=jayson[_0x52ff('0x9')][_0x52ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x270252,_0x120aac,_0x377cb1){return new BPromise(function(_0x50d709,_0x494b6a){return client[_0x52ff('0xb')](_0x270252,_0x377cb1)[_0x52ff('0xc')](function(_0x27c001){logger['info'](_0x52ff('0xd'),_0x120aac,_0x52ff('0xe'));logger[_0x52ff('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x120aac,_0x52ff('0xe'),JSON[_0x52ff('0x10')](_0x27c001));if(_0x27c001['error']){if(_0x27c001['error'][_0x52ff('0x11')]===0x1f4){logger['error'](_0x52ff('0xd'),_0x120aac,_0x27c001[_0x52ff('0x12')][_0x52ff('0x13')]);return _0x494b6a(_0x27c001[_0x52ff('0x12')][_0x52ff('0x13')]);}logger[_0x52ff('0x12')](_0x52ff('0xd'),_0x120aac,_0x27c001['error']['message']);return _0x50d709(_0x27c001[_0x52ff('0x12')][_0x52ff('0x13')]);}else{logger[_0x52ff('0x14')](_0x52ff('0xd'),_0x120aac,'request\x20sent');_0x50d709(_0x27c001['result'][_0x52ff('0x13')]);}})[_0x52ff('0x15')](function(_0xe71d08){logger['error'](_0x52ff('0xd'),_0x120aac,_0xe71d08);_0x494b6a(_0xe71d08);});});}exports['CreateChatQueueReport']=function(_0x3f6a81){var _0x3d5fce=this;return new Promise(function(_0x1ee7ff,_0x1d8363){return db[_0x52ff('0x16')]['create'](_0x3f6a81['body'],{'raw':_0x3f6a81[_0x52ff('0x17')]?_0x3f6a81[_0x52ff('0x17')][_0x52ff('0x18')]===undefined?!![]:![]:!![]})[_0x52ff('0xc')](function(_0x4ff794){logger[_0x52ff('0x14')](_0x52ff('0x19'),_0x3f6a81);logger[_0x52ff('0xf')](_0x52ff('0x19'),_0x3f6a81,JSON[_0x52ff('0x10')](_0x4ff794));_0x1ee7ff(_0x4ff794);})[_0x52ff('0x15')](function(_0x2e476f){logger['error'](_0x52ff('0x19'),_0x2e476f[_0x52ff('0x13')],_0x3f6a81);_0x1d8363(_0x3d5fce[_0x52ff('0x12')](0x1f4,_0x2e476f[_0x52ff('0x13')]));});});};exports[_0x52ff('0x1a')]=function(_0x3cef17){var _0x213a59=this;return new Promise(function(_0x313d69,_0x1d6135){return db[_0x52ff('0x16')]['update'](_0x3cef17[_0x52ff('0x1b')],{'raw':_0x3cef17[_0x52ff('0x17')]?_0x3cef17['options'][_0x52ff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cef17['options']?_0x3cef17[_0x52ff('0x17')][_0x52ff('0x1c')]||null:null,'attributes':_0x3cef17[_0x52ff('0x17')]?_0x3cef17[_0x52ff('0x17')]['attributes']||null:null,'limit':_0x3cef17[_0x52ff('0x17')]?_0x3cef17[_0x52ff('0x17')][_0x52ff('0x1d')]||null:null})[_0x52ff('0xc')](function(_0x298ff8){logger[_0x52ff('0x14')](_0x52ff('0x1a'),_0x3cef17);logger[_0x52ff('0xf')](_0x52ff('0x1a'),_0x3cef17,JSON[_0x52ff('0x10')](_0x298ff8));_0x313d69(_0x298ff8);})[_0x52ff('0x15')](function(_0x597172){logger[_0x52ff('0x12')](_0x52ff('0x1a'),_0x597172[_0x52ff('0x13')],_0x3cef17);_0x1d6135(_0x213a59[_0x52ff('0x12')](0x1f4,_0x597172[_0x52ff('0x13')]));});});}; \ No newline at end of file +var _0x5632=['CreateChatQueueReport','create','body','options','UpdateChatQueueReport','ChatQueueReport','raw','where','limit','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x2d2201,_0x3cfe3d){var _0x12e6cd=function(_0x5e4cf6){while(--_0x5e4cf6){_0x2d2201['push'](_0x2d2201['shift']());}};_0x12e6cd(++_0x3cfe3d);}(_0x5632,0x10a));var _0x2563=function(_0x44ea6b,_0x107e99){_0x44ea6b=_0x44ea6b-0x0;var _0x183d34=_0x5632[_0x44ea6b];return _0x183d34;};'use strict';var _=require(_0x2563('0x0'));var util=require(_0x2563('0x1'));var moment=require(_0x2563('0x2'));var BPromise=require('bluebird');var rs=require(_0x2563('0x3'));var fs=require('fs');var Redis=require(_0x2563('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2563('0x5'));var logger=require(_0x2563('0x6'))(_0x2563('0x7'));var config=require(_0x2563('0x8'));var jayson=require(_0x2563('0x9'));var client=jayson['client'][_0x2563('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b44ba,_0x5bd31d,_0x47f6ee){return new BPromise(function(_0x46822e,_0xd5abcc){return client[_0x2563('0xb')](_0x5b44ba,_0x47f6ee)[_0x2563('0xc')](function(_0x3503a0){logger[_0x2563('0xd')](_0x2563('0xe'),_0x5bd31d,_0x2563('0xf'));logger[_0x2563('0x10')](_0x2563('0x11'),_0x5bd31d,_0x2563('0xf'),JSON['stringify'](_0x3503a0));if(_0x3503a0[_0x2563('0x12')]){if(_0x3503a0[_0x2563('0x12')][_0x2563('0x13')]===0x1f4){logger[_0x2563('0x12')](_0x2563('0xe'),_0x5bd31d,_0x3503a0['error']['message']);return _0xd5abcc(_0x3503a0[_0x2563('0x12')][_0x2563('0x14')]);}logger[_0x2563('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x5bd31d,_0x3503a0['error'][_0x2563('0x14')]);return _0x46822e(_0x3503a0[_0x2563('0x12')][_0x2563('0x14')]);}else{logger[_0x2563('0xd')](_0x2563('0xe'),_0x5bd31d,_0x2563('0xf'));_0x46822e(_0x3503a0['result'][_0x2563('0x14')]);}})[_0x2563('0x15')](function(_0x1aac36){logger['error'](_0x2563('0xe'),_0x5bd31d,_0x1aac36);_0xd5abcc(_0x1aac36);});});}exports[_0x2563('0x16')]=function(_0x431796){var _0x3fce04=this;return new Promise(function(_0x4a3a67,_0x3b7ae4){return db['ChatQueueReport'][_0x2563('0x17')](_0x431796[_0x2563('0x18')],{'raw':_0x431796[_0x2563('0x19')]?_0x431796[_0x2563('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2563('0xc')](function(_0x354003){logger['info'](_0x2563('0x16'),_0x431796);logger['debug'](_0x2563('0x16'),_0x431796,JSON['stringify'](_0x354003));_0x4a3a67(_0x354003);})[_0x2563('0x15')](function(_0x5870d7){logger[_0x2563('0x12')](_0x2563('0x16'),_0x5870d7[_0x2563('0x14')],_0x431796);_0x3b7ae4(_0x3fce04[_0x2563('0x12')](0x1f4,_0x5870d7[_0x2563('0x14')]));});});};exports[_0x2563('0x1a')]=function(_0x5535e3){var _0x1beb8f=this;return new Promise(function(_0x1c2ec2,_0x252f66){return db[_0x2563('0x1b')]['update'](_0x5535e3[_0x2563('0x18')],{'raw':_0x5535e3[_0x2563('0x19')]?_0x5535e3['options'][_0x2563('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5535e3['options']?_0x5535e3[_0x2563('0x19')][_0x2563('0x1d')]||null:null,'attributes':_0x5535e3[_0x2563('0x19')]?_0x5535e3['options']['attributes']||null:null,'limit':_0x5535e3['options']?_0x5535e3[_0x2563('0x19')][_0x2563('0x1e')]||null:null})[_0x2563('0xc')](function(_0x34c016){logger[_0x2563('0xd')](_0x2563('0x1a'),_0x5535e3);logger[_0x2563('0x10')](_0x2563('0x1a'),_0x5535e3,JSON[_0x2563('0x1f')](_0x34c016));_0x1c2ec2(_0x34c016);})[_0x2563('0x15')](function(_0x22bed1){logger[_0x2563('0x12')](_0x2563('0x1a'),_0x22bed1[_0x2563('0x14')],_0x5535e3);_0x252f66(_0x1beb8f[_0x2563('0x12')](0x1f4,_0x22bed1['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 07d45ef..e04a796 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 _0xd346=['isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','multer','util','path','../../components/auth/service','./chatQueueReport.controller'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xd346,0xab));var _0x6d34=function(_0x3ea747,_0x517a74){_0x3ea747=_0x3ea747-0x0;var _0x205fb8=_0xd346[_0x3ea747];return _0x205fb8;};'use strict';var multer=require(_0x6d34('0x0'));var util=require(_0x6d34('0x1'));var path=require(_0x6d34('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x6d34('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d34('0x4'));router['get']('/',auth[_0x6d34('0x5')](),controller[_0x6d34('0x6')]);router[_0x6d34('0x7')](_0x6d34('0x8'),auth[_0x6d34('0x5')](),controller[_0x6d34('0x9')]);router[_0x6d34('0x7')](_0x6d34('0xa'),auth[_0x6d34('0x5')](),controller[_0x6d34('0xb')]);router['post']('/',auth[_0x6d34('0x5')](),controller[_0x6d34('0xc')]);router[_0x6d34('0xd')](_0x6d34('0xa'),auth[_0x6d34('0x5')](),controller[_0x6d34('0xe')]);router['delete'](_0x6d34('0xa'),auth[_0x6d34('0x5')](),controller[_0x6d34('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd436=['get','isAuthenticated','index','/describe','describe','/:id','show','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0xd436,0x1c3));var _0x6d43=function(_0x4ccf96,_0x34978e){_0x4ccf96=_0x4ccf96-0x0;var _0xd103b7=_0xd436[_0x4ccf96];return _0xd103b7;};'use strict';var multer=require(_0x6d43('0x0'));var util=require(_0x6d43('0x1'));var path=require(_0x6d43('0x2'));var timeout=require(_0x6d43('0x3'));var express=require(_0x6d43('0x4'));var router=express[_0x6d43('0x5')]();var auth=require(_0x6d43('0x6'));var interaction=require(_0x6d43('0x7'));var config=require('../../config/environment');var controller=require(_0x6d43('0x8'));router[_0x6d43('0x9')]('/',auth[_0x6d43('0xa')](),controller[_0x6d43('0xb')]);router[_0x6d43('0x9')](_0x6d43('0xc'),auth[_0x6d43('0xa')](),controller[_0x6d43('0xd')]);router[_0x6d43('0x9')](_0x6d43('0xe'),auth[_0x6d43('0xa')](),controller[_0x6d43('0xf')]);router[_0x6d43('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6d43('0xe'),auth[_0x6d43('0xa')](),controller[_0x6d43('0x11')]);router['delete'](_0x6d43('0xe'),auth[_0x6d43('0xa')](),controller[_0x6d43('0x12')]);module[_0x6d43('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a232e3c..639b3a9 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 _0xd8ad=['NOW','sequelize','exports','STRING','ENUM','queue','DATE'];(function(_0x448570,_0x2222b1){var _0x20f5fb=function(_0x13254a){while(--_0x13254a){_0x448570['push'](_0x448570['shift']());}};_0x20f5fb(++_0x2222b1);}(_0xd8ad,0xc5));var _0xdd8a=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0xd8ad[_0x1bc762];return _0x40f70c;};'use strict';var moment=require('moment');var Sequelize=require(_0xdd8a('0x0'));module[_0xdd8a('0x1')]={'uniqueid':{'type':Sequelize[_0xdd8a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdd8a('0x3')]('account','agent',_0xdd8a('0x4')),'allowNull':![],'defaultValue':_0xdd8a('0x4')},'transferredAt':{'type':Sequelize[_0xdd8a('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xdd8a('0x6')]}}; \ No newline at end of file +var _0x7823=['STRING','queue','sequelize','exports'];(function(_0x49611d,_0x3109af){var _0x4308e7=function(_0x453433){while(--_0x453433){_0x49611d['push'](_0x49611d['shift']());}};_0x4308e7(++_0x3109af);}(_0x7823,0x1a2));var _0x3782=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7823[_0x6131cd];return _0x47e916;};'use strict';var moment=require('moment');var Sequelize=require(_0x3782('0x0'));module[_0x3782('0x1')]={'uniqueid':{'type':Sequelize[_0x3782('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0x3782('0x3')),'allowNull':![],'defaultValue':_0x3782('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index de501dd..52c1ff4 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 _0xddc3=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','ChatTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','describe','html-pdf'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xddc3,0x123));var _0x3ddc=function(_0x199bd3,_0x20ab47){_0x199bd3=_0x199bd3-0x0;var _0x535515=_0xddc3[_0x199bd3];return _0x535515;};'use strict';var pdf=require(_0x3ddc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ddc('0x1'));var zipdir=require(_0x3ddc('0x2'));var jsonpatch=require(_0x3ddc('0x3'));var rp=require(_0x3ddc('0x4'));var moment=require(_0x3ddc('0x5'));var BPromise=require(_0x3ddc('0x6'));var Mustache=require(_0x3ddc('0x7'));var util=require(_0x3ddc('0x8'));var path=require(_0x3ddc('0x9'));var sox=require('sox');var csv=require(_0x3ddc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3ddc('0xb'));var squel=require(_0x3ddc('0xc'));var crypto=require(_0x3ddc('0xd'));var jsforce=require(_0x3ddc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3ddc('0xa'));var querystring=require(_0x3ddc('0xf'));var Papa=require(_0x3ddc('0x10'));var Redis=require('ioredis');var authService=require(_0x3ddc('0x11'));var qs=require(_0x3ddc('0x12'));var hardwareService=require(_0x3ddc('0x13'));var logger=require(_0x3ddc('0x14'))(_0x3ddc('0x15'));var utils=require(_0x3ddc('0x16'));var config=require('../../config/environment');var db=require(_0x3ddc('0x17'))['db'];function respondWithStatusCode(_0x590e47,_0x18c390){_0x18c390=_0x18c390||0xcc;return function(_0x2a144e){if(_0x2a144e){return _0x590e47[_0x3ddc('0x18')](_0x18c390);}return _0x590e47[_0x3ddc('0x19')](_0x18c390)['end']();};}function respondWithResult(_0x50ca1b,_0x380418){_0x380418=_0x380418||0xc8;return function(_0x4f270d){if(_0x4f270d){return _0x50ca1b[_0x3ddc('0x19')](_0x380418)[_0x3ddc('0x1a')](_0x4f270d);}};}function respondWithFilteredResult(_0x403257,_0x260089){return function(_0x5cd8dc){if(_0x5cd8dc){var _0x24e930=_0x5cd8dc[_0x3ddc('0x1b')],_0x41c178=_0x260089['offset'],_0x3e05cb=_0x260089[_0x3ddc('0x1c')]+_0x260089[_0x3ddc('0x1d')],_0x4cc0bf;if(_0x3e05cb>=_0x24e930){_0x3e05cb=_0x24e930;_0x4cc0bf=0xc8;}else{_0x4cc0bf=0xce;}_0x403257['status'](_0x4cc0bf);return _0x403257[_0x3ddc('0x1e')](_0x3ddc('0x1f'),_0x41c178+'-'+_0x3e05cb+'/'+_0x24e930)['json'](_0x5cd8dc);}return null;};}function patchUpdates(_0x416973){return function(_0x573df2){try{jsonpatch[_0x3ddc('0x20')](_0x573df2,_0x416973,!![]);}catch(_0x5b9b9e){return BPromise[_0x3ddc('0x21')](_0x5b9b9e);}return _0x573df2[_0x3ddc('0x22')]();};}function saveUpdates(_0x1345e5,_0x7cfaad){return function(_0xd91fb9){if(_0xd91fb9){return _0xd91fb9['update'](_0x1345e5)['then'](function(_0x40aa46){return _0x40aa46;});}return null;};}function removeEntity(_0x40082e,_0x34e3d9){return function(_0x16aa58){if(_0x16aa58){return _0x16aa58[_0x3ddc('0x23')]()[_0x3ddc('0x24')](function(){_0x40082e['status'](0xcc)[_0x3ddc('0x25')]();});}};}function handleEntityNotFound(_0x1de8a8,_0x95b7ac){return function(_0x401c49){if(!_0x401c49){_0x1de8a8[_0x3ddc('0x18')](0x194);}return _0x401c49;};}function handleError(_0x3a31ea,_0x1538ed){_0x1538ed=_0x1538ed||0x1f4;return function(_0x57c42c){logger[_0x3ddc('0x26')](_0x57c42c[_0x3ddc('0x27')]);if(_0x57c42c[_0x3ddc('0x28')]){delete _0x57c42c['name'];}_0x3a31ea[_0x3ddc('0x19')](_0x1538ed)[_0x3ddc('0x29')](_0x57c42c);};}exports[_0x3ddc('0x2a')]=function(_0x2bbb5c,_0x344775){var _0x90a3f={},_0x5cbe2c={},_0x4427aa={'count':0x0,'rows':[]};var _0xf1b4a6=db[_0x3ddc('0x2b')][_0x3ddc('0x2c')];_0x5cbe2c[_0x3ddc('0x2d')]=_[_0x3ddc('0x2e')](_0xf1b4a6);_0x5cbe2c[_0x3ddc('0x2f')]=_[_0x3ddc('0x2e')](_0x2bbb5c[_0x3ddc('0x2f')]);_0x5cbe2c[_0x3ddc('0x30')]=_[_0x3ddc('0x31')](_0x5cbe2c[_0x3ddc('0x2d')],_0x5cbe2c[_0x3ddc('0x2f')]);_0x90a3f[_0x3ddc('0x32')]=_[_0x3ddc('0x31')](_0x5cbe2c[_0x3ddc('0x2d')],qs[_0x3ddc('0x33')](_0x2bbb5c[_0x3ddc('0x2f')][_0x3ddc('0x33')]));_0x90a3f['attributes']=_0x90a3f['attributes']['length']?_0x90a3f['attributes']:_0x5cbe2c[_0x3ddc('0x2d')];if(!_0x2bbb5c[_0x3ddc('0x2f')][_0x3ddc('0x34')]('nolimit')){_0x90a3f[_0x3ddc('0x1d')]=qs[_0x3ddc('0x1d')](_0x2bbb5c[_0x3ddc('0x2f')][_0x3ddc('0x1d')]);_0x90a3f[_0x3ddc('0x1c')]=qs['offset'](_0x2bbb5c[_0x3ddc('0x2f')]['offset']);}_0x90a3f[_0x3ddc('0x35')]=qs[_0x3ddc('0x36')](_0x2bbb5c[_0x3ddc('0x2f')][_0x3ddc('0x36')]);_0x90a3f[_0x3ddc('0x37')]=qs[_0x3ddc('0x30')](_[_0x3ddc('0x38')](_0x2bbb5c[_0x3ddc('0x2f')],_0x5cbe2c['filters']));if(_0x2bbb5c['query'][_0x3ddc('0x39')]){_0x90a3f[_0x3ddc('0x37')]=_[_0x3ddc('0x3a')](_0x90a3f[_0x3ddc('0x37')],{'$or':_['map'](_0xf1b4a6,function(_0xe04bbb){if(_0xe04bbb['type'][_0x3ddc('0x3b')]!==_0x3ddc('0x3c')){var _0x3999bf={};_0x3999bf[_0xe04bbb['field']]={'$like':'%'+_0x2bbb5c[_0x3ddc('0x2f')][_0x3ddc('0x39')]+'%'};return _0x3999bf;}})});}_0x90a3f=_[_0x3ddc('0x3a')]({},_0x90a3f,_0x2bbb5c[_0x3ddc('0x3d')]);var _0x165d3c={'where':_0x90a3f[_0x3ddc('0x37')]};return db['ChatTransferReport'][_0x3ddc('0x1b')](_0x165d3c)[_0x3ddc('0x24')](function(_0x49569b){_0x4427aa[_0x3ddc('0x1b')]=_0x49569b;if(_0x2bbb5c[_0x3ddc('0x2f')][_0x3ddc('0x3e')]){_0x90a3f[_0x3ddc('0x3f')]=[{'all':!![]}];}return db[_0x3ddc('0x2b')][_0x3ddc('0x40')](_0x90a3f);})[_0x3ddc('0x24')](function(_0x54c15c){_0x4427aa[_0x3ddc('0x41')]=_0x54c15c;return _0x4427aa;})['then'](respondWithFilteredResult(_0x344775,_0x90a3f))[_0x3ddc('0x42')](handleError(_0x344775,null));};exports['show']=function(_0x31e554,_0x24dbe6){var _0x4a5f6f={'raw':!![],'where':{'id':_0x31e554[_0x3ddc('0x43')]['id']}},_0x27d1b8={};_0x27d1b8[_0x3ddc('0x2d')]=_[_0x3ddc('0x2e')](db[_0x3ddc('0x2b')][_0x3ddc('0x2c')]);_0x27d1b8[_0x3ddc('0x2f')]=_[_0x3ddc('0x2e')](_0x31e554[_0x3ddc('0x2f')]);_0x27d1b8[_0x3ddc('0x30')]=_[_0x3ddc('0x31')](_0x27d1b8['model'],_0x27d1b8['query']);_0x4a5f6f[_0x3ddc('0x32')]=_[_0x3ddc('0x31')](_0x27d1b8[_0x3ddc('0x2d')],qs[_0x3ddc('0x33')](_0x31e554[_0x3ddc('0x2f')][_0x3ddc('0x33')]));_0x4a5f6f[_0x3ddc('0x32')]=_0x4a5f6f['attributes']['length']?_0x4a5f6f[_0x3ddc('0x32')]:_0x27d1b8[_0x3ddc('0x2d')];if(_0x31e554[_0x3ddc('0x2f')][_0x3ddc('0x3e')]){_0x4a5f6f['include']=[{'all':!![]}];}_0x4a5f6f=_['merge']({},_0x4a5f6f,_0x31e554[_0x3ddc('0x3d')]);return db[_0x3ddc('0x2b')][_0x3ddc('0x44')](_0x4a5f6f)[_0x3ddc('0x24')](handleEntityNotFound(_0x24dbe6,null))[_0x3ddc('0x24')](respondWithResult(_0x24dbe6,null))[_0x3ddc('0x42')](handleError(_0x24dbe6,null));};exports['create']=function(_0x33694f,_0x593d4b){return db[_0x3ddc('0x2b')][_0x3ddc('0x45')](_0x33694f['body'],{})[_0x3ddc('0x24')](respondWithResult(_0x593d4b,0xc9))['catch'](handleError(_0x593d4b,null));};exports[_0x3ddc('0x46')]=function(_0x466c1c,_0x191f86){if(_0x466c1c['body']['id']){delete _0x466c1c['body']['id'];}return db['ChatTransferReport'][_0x3ddc('0x44')]({'where':{'id':_0x466c1c[_0x3ddc('0x43')]['id']}})[_0x3ddc('0x24')](handleEntityNotFound(_0x191f86,null))['then'](saveUpdates(_0x466c1c[_0x3ddc('0x47')],null))['then'](respondWithResult(_0x191f86,null))[_0x3ddc('0x42')](handleError(_0x191f86,null));};exports[_0x3ddc('0x23')]=function(_0x52c2cb,_0x51aa8d){return db[_0x3ddc('0x2b')]['find']({'where':{'id':_0x52c2cb[_0x3ddc('0x43')]['id']}})[_0x3ddc('0x24')](handleEntityNotFound(_0x51aa8d,null))[_0x3ddc('0x24')](removeEntity(_0x51aa8d,null))['catch'](handleError(_0x51aa8d,null));};exports['describe']=function(_0x560a2b,_0x338467){return db['ChatTransferReport'][_0x3ddc('0x48')]()[_0x3ddc('0x24')](respondWithResult(_0x338467,null))['catch'](handleError(_0x338467,null));}; \ No newline at end of file +var _0xeb47=['Content-Range','apply','reject','save','update','then','error','name','index','ChatTransferReport','model','query','filters','attributes','intersection','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','map','type','key','field','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','describe','html-pdf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb47,0xf0));var _0x7eb4=function(_0x4ff9e8,_0x59c1d6){_0x4ff9e8=_0x4ff9e8-0x0;var _0x34a0d7=_0xeb47[_0x4ff9e8];return _0x34a0d7;};'use strict';var pdf=require(_0x7eb4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7eb4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7eb4('0x2'));var BPromise=require(_0x7eb4('0x3'));var Mustache=require(_0x7eb4('0x4'));var util=require('util');var path=require(_0x7eb4('0x5'));var sox=require(_0x7eb4('0x6'));var csv=require(_0x7eb4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7eb4('0x8'));var crypto=require('crypto');var jsforce=require(_0x7eb4('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7eb4('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x7eb4('0xb'));var hardwareService=require(_0x7eb4('0xc'));var logger=require(_0x7eb4('0xd'))(_0x7eb4('0xe'));var utils=require(_0x7eb4('0xf'));var config=require(_0x7eb4('0x10'));var db=require(_0x7eb4('0x11'))['db'];function respondWithStatusCode(_0x4ad9a6,_0x5aac2d){_0x5aac2d=_0x5aac2d||0xcc;return function(_0x74ac59){if(_0x74ac59){return _0x4ad9a6[_0x7eb4('0x12')](_0x5aac2d);}return _0x4ad9a6['status'](_0x5aac2d)[_0x7eb4('0x13')]();};}function respondWithResult(_0x5d35f0,_0x2b5831){_0x2b5831=_0x2b5831||0xc8;return function(_0x5a57ca){if(_0x5a57ca){return _0x5d35f0[_0x7eb4('0x14')](_0x2b5831)[_0x7eb4('0x15')](_0x5a57ca);}};}function respondWithFilteredResult(_0x455d93,_0x143512){return function(_0x17a318){if(_0x17a318){var _0x52dda2=_0x17a318[_0x7eb4('0x16')],_0x11f68d=_0x143512['offset'],_0x170303=_0x143512['offset']+_0x143512[_0x7eb4('0x17')],_0x1910b9;if(_0x170303>=_0x52dda2){_0x170303=_0x52dda2;_0x1910b9=0xc8;}else{_0x1910b9=0xce;}_0x455d93[_0x7eb4('0x14')](_0x1910b9);return _0x455d93['set'](_0x7eb4('0x18'),_0x11f68d+'-'+_0x170303+'/'+_0x52dda2)['json'](_0x17a318);}return null;};}function patchUpdates(_0x23483f){return function(_0x522e34){try{jsonpatch[_0x7eb4('0x19')](_0x522e34,_0x23483f,!![]);}catch(_0x3206e2){return BPromise[_0x7eb4('0x1a')](_0x3206e2);}return _0x522e34[_0x7eb4('0x1b')]();};}function saveUpdates(_0x359c37,_0x567aad){return function(_0xc131a6){if(_0xc131a6){return _0xc131a6[_0x7eb4('0x1c')](_0x359c37)[_0x7eb4('0x1d')](function(_0xa7adb6){return _0xa7adb6;});}return null;};}function removeEntity(_0xe37c26,_0x368f73){return function(_0x1b32cf){if(_0x1b32cf){return _0x1b32cf['destroy']()[_0x7eb4('0x1d')](function(){_0xe37c26['status'](0xcc)[_0x7eb4('0x13')]();});}};}function handleEntityNotFound(_0x5779fd,_0x4589ba){return function(_0x2ad2c8){if(!_0x2ad2c8){_0x5779fd['sendStatus'](0x194);}return _0x2ad2c8;};}function handleError(_0x28d438,_0x59de08){_0x59de08=_0x59de08||0x1f4;return function(_0x1d6e41){logger[_0x7eb4('0x1e')](_0x1d6e41['stack']);if(_0x1d6e41['name']){delete _0x1d6e41[_0x7eb4('0x1f')];}_0x28d438[_0x7eb4('0x14')](_0x59de08)['send'](_0x1d6e41);};}exports[_0x7eb4('0x20')]=function(_0x180c19,_0x65eca1){var _0x46a897={},_0x3282b5={},_0x4d37e3={'count':0x0,'rows':[]};var _0x323d6a=db[_0x7eb4('0x21')]['rawAttributes'];_0x3282b5[_0x7eb4('0x22')]=_['keys'](_0x323d6a);_0x3282b5[_0x7eb4('0x23')]=_['keys'](_0x180c19[_0x7eb4('0x23')]);_0x3282b5[_0x7eb4('0x24')]=_['intersection'](_0x3282b5[_0x7eb4('0x22')],_0x3282b5['query']);_0x46a897[_0x7eb4('0x25')]=_[_0x7eb4('0x26')](_0x3282b5['model'],qs[_0x7eb4('0x27')](_0x180c19['query'][_0x7eb4('0x27')]));_0x46a897['attributes']=_0x46a897[_0x7eb4('0x25')]['length']?_0x46a897[_0x7eb4('0x25')]:_0x3282b5[_0x7eb4('0x22')];if(!_0x180c19[_0x7eb4('0x23')][_0x7eb4('0x28')]('nolimit')){_0x46a897[_0x7eb4('0x17')]=qs[_0x7eb4('0x17')](_0x180c19[_0x7eb4('0x23')]['limit']);_0x46a897[_0x7eb4('0x29')]=qs['offset'](_0x180c19[_0x7eb4('0x23')]['offset']);}_0x46a897[_0x7eb4('0x2a')]=qs[_0x7eb4('0x2b')](_0x180c19[_0x7eb4('0x23')]['sort']);_0x46a897[_0x7eb4('0x2c')]=qs[_0x7eb4('0x24')](_[_0x7eb4('0x2d')](_0x180c19['query'],_0x3282b5[_0x7eb4('0x24')]));if(_0x180c19['query'][_0x7eb4('0x2e')]){_0x46a897[_0x7eb4('0x2c')]=_[_0x7eb4('0x2f')](_0x46a897['where'],{'$or':_[_0x7eb4('0x30')](_0x323d6a,function(_0x4ee480){if(_0x4ee480[_0x7eb4('0x31')][_0x7eb4('0x32')]!=='VIRTUAL'){var _0x34b96f={};_0x34b96f[_0x4ee480[_0x7eb4('0x33')]]={'$like':'%'+_0x180c19[_0x7eb4('0x23')][_0x7eb4('0x2e')]+'%'};return _0x34b96f;}})});}_0x46a897=_['merge']({},_0x46a897,_0x180c19[_0x7eb4('0x34')]);var _0x5745e6={'where':_0x46a897[_0x7eb4('0x2c')]};return db['ChatTransferReport']['count'](_0x5745e6)[_0x7eb4('0x1d')](function(_0x48fe2f){_0x4d37e3[_0x7eb4('0x16')]=_0x48fe2f;if(_0x180c19[_0x7eb4('0x23')][_0x7eb4('0x35')]){_0x46a897['include']=[{'all':!![]}];}return db[_0x7eb4('0x21')][_0x7eb4('0x36')](_0x46a897);})[_0x7eb4('0x1d')](function(_0x59e24b){_0x4d37e3[_0x7eb4('0x37')]=_0x59e24b;return _0x4d37e3;})[_0x7eb4('0x1d')](respondWithFilteredResult(_0x65eca1,_0x46a897))[_0x7eb4('0x38')](handleError(_0x65eca1,null));};exports[_0x7eb4('0x39')]=function(_0x3705b1,_0x311fdf){var _0x5414e9={'raw':!![],'where':{'id':_0x3705b1[_0x7eb4('0x3a')]['id']}},_0x1e4464={};_0x1e4464['model']=_['keys'](db[_0x7eb4('0x21')][_0x7eb4('0x3b')]);_0x1e4464[_0x7eb4('0x23')]=_['keys'](_0x3705b1[_0x7eb4('0x23')]);_0x1e4464[_0x7eb4('0x24')]=_[_0x7eb4('0x26')](_0x1e4464[_0x7eb4('0x22')],_0x1e4464['query']);_0x5414e9[_0x7eb4('0x25')]=_[_0x7eb4('0x26')](_0x1e4464['model'],qs[_0x7eb4('0x27')](_0x3705b1['query'][_0x7eb4('0x27')]));_0x5414e9[_0x7eb4('0x25')]=_0x5414e9[_0x7eb4('0x25')][_0x7eb4('0x3c')]?_0x5414e9[_0x7eb4('0x25')]:_0x1e4464[_0x7eb4('0x22')];if(_0x3705b1[_0x7eb4('0x23')][_0x7eb4('0x35')]){_0x5414e9[_0x7eb4('0x3d')]=[{'all':!![]}];}_0x5414e9=_[_0x7eb4('0x2f')]({},_0x5414e9,_0x3705b1['options']);return db[_0x7eb4('0x21')][_0x7eb4('0x3e')](_0x5414e9)[_0x7eb4('0x1d')](handleEntityNotFound(_0x311fdf,null))[_0x7eb4('0x1d')](respondWithResult(_0x311fdf,null))[_0x7eb4('0x38')](handleError(_0x311fdf,null));};exports[_0x7eb4('0x3f')]=function(_0x111c43,_0x186fc5){return db[_0x7eb4('0x21')]['create'](_0x111c43[_0x7eb4('0x40')],{})[_0x7eb4('0x1d')](respondWithResult(_0x186fc5,0xc9))[_0x7eb4('0x38')](handleError(_0x186fc5,null));};exports[_0x7eb4('0x1c')]=function(_0x1a0c70,_0x316b7b){if(_0x1a0c70['body']['id']){delete _0x1a0c70['body']['id'];}return db[_0x7eb4('0x21')]['find']({'where':{'id':_0x1a0c70[_0x7eb4('0x3a')]['id']}})[_0x7eb4('0x1d')](handleEntityNotFound(_0x316b7b,null))['then'](saveUpdates(_0x1a0c70[_0x7eb4('0x40')],null))['then'](respondWithResult(_0x316b7b,null))[_0x7eb4('0x38')](handleError(_0x316b7b,null));};exports['destroy']=function(_0x3a8248,_0x42f0d8){return db[_0x7eb4('0x21')][_0x7eb4('0x3e')]({'where':{'id':_0x3a8248[_0x7eb4('0x3a')]['id']}})[_0x7eb4('0x1d')](handleEntityNotFound(_0x42f0d8,null))[_0x7eb4('0x1d')](removeEntity(_0x42f0d8,null))[_0x7eb4('0x38')](handleError(_0x42f0d8,null));};exports[_0x7eb4('0x41')]=function(_0x113741,_0x51cf06){return db[_0x7eb4('0x21')][_0x7eb4('0x41')]()['then'](respondWithResult(_0x51cf06,null))[_0x7eb4('0x38')](handleError(_0x51cf06,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8cd6546..74bca12 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 _0xd2c6=['lodash','util','api','request-promise','path','rimraf','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x16e607,_0x5821bd){var _0x88b32a=function(_0x13c868){while(--_0x13c868){_0x16e607['push'](_0x16e607['shift']());}};_0x88b32a(++_0x5821bd);}(_0xd2c6,0x171));var _0x6d2c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xd2c6[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x6d2c('0x0'));var util=require(_0x6d2c('0x1'));var logger=require('../../config/logger')(_0x6d2c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6d2c('0x3'));var fs=require('fs');var path=require(_0x6d2c('0x4'));var rimraf=require(_0x6d2c('0x5'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x5a6327,_0x551cea){return _0x5a6327['define'](_0x6d2c('0x6'),attributes,{'tableName':_0x6d2c('0x7'),'paranoid':![],'indexes':[{'name':_0x6d2c('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa226=['bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x31cba,_0x45c0fd){var _0x17bd83=function(_0x4feee5){while(--_0x4feee5){_0x31cba['push'](_0x31cba['shift']());}};_0x17bd83(++_0x45c0fd);}(_0xa226,0x1b7));var _0x6a22=function(_0x33d49c,_0x42a0b8){_0x33d49c=_0x33d49c-0x0;var _0x189b76=_0xa226[_0x33d49c];return _0x189b76;};'use strict';var _=require(_0x6a22('0x0'));var util=require(_0x6a22('0x1'));var logger=require(_0x6a22('0x2'))(_0x6a22('0x3'));var moment=require(_0x6a22('0x4'));var BPromise=require(_0x6a22('0x5'));var rp=require(_0x6a22('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6a22('0x7'));var attributes=require(_0x6a22('0x8'));module['exports']=function(_0x15b62b,_0x38cfa8){return _0x15b62b[_0x6a22('0x9')](_0x6a22('0xa'),attributes,{'tableName':_0x6a22('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 978313a..0e7c768 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 _0x9059=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','moment'];(function(_0x5908ab,_0x14cd9a){var _0x25c59a=function(_0x33aea9){while(--_0x33aea9){_0x5908ab['push'](_0x5908ab['shift']());}};_0x25c59a(++_0x14cd9a);}(_0x9059,0xe5));var _0x9905=function(_0x490395,_0x23b0b1){_0x490395=_0x490395-0x0;var _0x44114c=_0x9059[_0x490395];return _0x44114c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9905('0x0'));var BPromise=require(_0x9905('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9905('0x2'));var db=require(_0x9905('0x3'))['db'];var utils=require(_0x9905('0x4'));var logger=require(_0x9905('0x5'))(_0x9905('0x6'));var config=require(_0x9905('0x7'));var jayson=require(_0x9905('0x8'));var client=jayson[_0x9905('0x9')][_0x9905('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x237791,_0x1c9ef5,_0x52b675){return new BPromise(function(_0x31a96f,_0x6dffdc){return client[_0x9905('0xb')](_0x237791,_0x52b675)[_0x9905('0xc')](function(_0x4d1843){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x1c9ef5,_0x9905('0xd'));logger[_0x9905('0xe')](_0x9905('0xf'),_0x1c9ef5,_0x9905('0xd'),JSON[_0x9905('0x10')](_0x4d1843));if(_0x4d1843[_0x9905('0x11')]){if(_0x4d1843['error'][_0x9905('0x12')]===0x1f4){logger[_0x9905('0x11')](_0x9905('0x13'),_0x1c9ef5,_0x4d1843['error'][_0x9905('0x14')]);return _0x6dffdc(_0x4d1843['error'][_0x9905('0x14')]);}logger[_0x9905('0x11')](_0x9905('0x13'),_0x1c9ef5,_0x4d1843[_0x9905('0x11')][_0x9905('0x14')]);return _0x31a96f(_0x4d1843[_0x9905('0x11')][_0x9905('0x14')]);}else{logger[_0x9905('0x15')](_0x9905('0x13'),_0x1c9ef5,_0x9905('0xd'));_0x31a96f(_0x4d1843[_0x9905('0x16')][_0x9905('0x14')]);}})['catch'](function(_0x5a64f0){logger['error'](_0x9905('0x13'),_0x1c9ef5,_0x5a64f0);_0x6dffdc(_0x5a64f0);});});} \ No newline at end of file +var _0xaada=['jayson/promise','client','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x20d2f9,_0x20862d){var _0x2d6822=function(_0x2f519a){while(--_0x2f519a){_0x20d2f9['push'](_0x20d2f9['shift']());}};_0x2d6822(++_0x20862d);}(_0xaada,0x1d7));var _0xaaad=function(_0x5a0b43,_0x311337){_0x5a0b43=_0x5a0b43-0x0;var _0x1cff2b=_0xaada[_0x5a0b43];return _0x1cff2b;};'use strict';var _=require(_0xaaad('0x0'));var util=require('util');var moment=require(_0xaaad('0x1'));var BPromise=require(_0xaaad('0x2'));var rs=require(_0xaaad('0x3'));var fs=require('fs');var Redis=require(_0xaaad('0x4'));var db=require(_0xaaad('0x5'))['db'];var utils=require(_0xaaad('0x6'));var logger=require(_0xaaad('0x7'))(_0xaaad('0x8'));var config=require('../../config/environment');var jayson=require(_0xaaad('0x9'));var client=jayson[_0xaaad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x228ed7,_0x48c91a,_0x2712fd){return new BPromise(function(_0x49e817,_0xbe3bc4){return client['request'](_0x228ed7,_0x2712fd)['then'](function(_0xd427fe){logger[_0xaaad('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x48c91a,_0xaaad('0xc'));logger['debug'](_0xaaad('0xd'),_0x48c91a,_0xaaad('0xc'),JSON[_0xaaad('0xe')](_0xd427fe));if(_0xd427fe[_0xaaad('0xf')]){if(_0xd427fe[_0xaaad('0xf')][_0xaaad('0x10')]===0x1f4){logger['error'](_0xaaad('0x11'),_0x48c91a,_0xd427fe[_0xaaad('0xf')][_0xaaad('0x12')]);return _0xbe3bc4(_0xd427fe[_0xaaad('0xf')][_0xaaad('0x12')]);}logger[_0xaaad('0xf')](_0xaaad('0x11'),_0x48c91a,_0xd427fe[_0xaaad('0xf')]['message']);return _0x49e817(_0xd427fe['error'][_0xaaad('0x12')]);}else{logger[_0xaaad('0xb')](_0xaaad('0x11'),_0x48c91a,_0xaaad('0xc'));_0x49e817(_0xd427fe['result'][_0xaaad('0x12')]);}})[_0xaaad('0x13')](function(_0x21f708){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x48c91a,_0x21f708);_0xbe3bc4(_0x21f708);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 747515a..6592c92 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x757a,0xde));var _0xa757=function(_0x58338f,_0x1ec83a){_0x58338f=_0x58338f-0x0;var _0x402ff2=_0x757a[_0x58338f];return _0x402ff2;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 53f889c..eb3da8a 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 _0x4c74=['#9f946a','#ffffff','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','TEXT','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email'];(function(_0x3e17af,_0x2ebd76){var _0x12a095=function(_0x4f75e1){while(--_0x4f75e1){_0x3e17af['push'](_0x3e17af['shift']());}};_0x12a095(++_0x2ebd76);}(_0x4c74,0x18a));var _0x44c7=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x4c74[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0x44c7('0x0'));var rs=require(_0x44c7('0x1'));module[_0x44c7('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x44c7('0x3')],'allowNull':![],'unique':_0x44c7('0x4')},'description':{'type':Sequelize[_0x44c7('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x44c7('0x5')},'mapKeyOffline':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x5')},'key':{'type':Sequelize[_0x44c7('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x44c7('0x3')],'allowNull':![],'defaultValue':_0x44c7('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x44c7('0x3')],'allowNull':![],'defaultValue':_0x44c7('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x44c7('0x3')],'allowNull':![],'defaultValue':_0x44c7('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x44c7('0x9')](_0x44c7('0xa'),_0x44c7('0xb')),'defaultValue':_0x44c7('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x44c7('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x44c7('0xe')},'download_transcript':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x44c7('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x12')},'noteTitle':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x13')},'placeholderMessage':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x14')},'closingMessage':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x44c7('0xd')},'skipMessageButton':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x17')},'ratingType':{'type':Sequelize[_0x44c7('0x9')]('star',_0x44c7('0x18')),'defaultValue':_0x44c7('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x44c7('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x44c7('0x1a')],'defaultValue':function(){return JSON[_0x44c7('0x1b')]({'items':[{'type':_0x44c7('0x1c'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x44c7('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x44c7('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x44c7('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x44c7('0x1e')](_0x44c7('0x1f'))?JSON['parse'](this[_0x44c7('0x1e')](_0x44c7('0x1f'))):{};},'set':function(_0x3a5a09){return this[_0x44c7('0x20')](_0x44c7('0x1f'),JSON['stringify'](_0x3a5a09));}},'offlineForm':{'type':Sequelize[_0x44c7('0x1a')],'defaultValue':function(){return JSON[_0x44c7('0x1b')]({'items':[{'type':_0x44c7('0x1c'),'props':{'title':_0x44c7('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x44c7('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0x44c7('0x22'),'helpText':_0x44c7('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x44c7('0x1e')](_0x44c7('0x24'))?JSON['parse'](this[_0x44c7('0x1e')](_0x44c7('0x24'))):{};},'set':function(_0x18e51f){return this[_0x44c7('0x20')](_0x44c7('0x24'),JSON[_0x44c7('0x1b')](_0x18e51f));}},'token':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':function(){return rs[_0x44c7('0x25')]();}},'autoclose':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x44c7('0x3')]},'forwardOffline':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x44c7('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x44c7('0x27')},'offlineMessageBody':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x29')},'skipUnmanaged':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x16')},'sendUnmanaged':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x44c7('0x1a')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x44c7('0x3')]},'notificationTemplate':{'type':Sequelize[_0x44c7('0x1a')],'defaultValue':function(){return _0x44c7('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x44c7('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x2c')},'verticalAlignment':{'type':Sequelize[_0x44c7('0xf')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':_0x44c7('0x2d')},'defaultTitle':{'type':Sequelize[_0x44c7('0x3')]},'customerAvatar':{'type':Sequelize[_0x44c7('0x1a')]},'showCustomerAvatar':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x44c7('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x44c7('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x44c7('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x44c7('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x44c7('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x44c7('0xf')],'comment':_0x44c7('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x44c7('0x8')],'defaultValue':![],'comment':_0x44c7('0x30'),'set':function(_0x209dc4){if(!_0x209dc4)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x44c7('0x31'),_0x209dc4);}}}; \ No newline at end of file +var _0x9620=['setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','address','email','Agent','#9f946a','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Send','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!','Skip','Feedback','star','thumb','stringify','input','name','text','parse','getDataValue','onlineForm'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9620,0x130));var _0x0962=function(_0x3e70ed,_0x1e346c){_0x3e70ed=_0x3e70ed-0x0;var _0x52c329=_0x9620[_0x3e70ed];return _0x52c329;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0962('0x0')]={'name':{'type':Sequelize[_0x0962('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x0962('0x1')],'allowNull':![],'unique':_0x0962('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x3')},'mapKeyOffline':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x3')},'key':{'type':Sequelize[_0x0962('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0962('0x4')},'customerAlias':{'type':Sequelize[_0x0962('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0962('0x1')],'allowNull':![],'defaultValue':_0x0962('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0962('0x1')],'allowNull':![],'defaultValue':_0x0962('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0962('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0962('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0962('0x1')]},'animation':{'type':Sequelize[_0x0962('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x0962('0x8')),'defaultValue':_0x0962('0x9')},'header_online':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0xa')},'start_chat_button':{'type':Sequelize[_0x0962('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0962('0xb')},'header_offline':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x0962('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0962('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x0962('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x11')},'noteTitle':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x12')},'placeholderMessage':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x13')},'closingMessage':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x0962('0xb')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x0962('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x0962('0x17'),_0x0962('0x18')),'defaultValue':_0x0962('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x0962('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0962('0xe')],'defaultValue':function(){return JSON[_0x0962('0x19')]({'items':[{'type':_0x0962('0x1a'),'variable':null,'config':{'placeholder':_0x0962('0x1b'),'type':_0x0962('0x1c'),'required':!![]},'props':{'title':_0x0962('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0x0962('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x0962('0x3'),'type':_0x0962('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x0962('0x1d')](this[_0x0962('0x1e')](_0x0962('0x1f'))):{};},'set':function(_0x4c251f){return this[_0x0962('0x20')](_0x0962('0x1f'),JSON[_0x0962('0x19')](_0x4c251f));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0962('0x19')]({'items':[{'type':_0x0962('0x1a'),'props':{'title':_0x0962('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x0962('0x3'),'type':_0x0962('0x3')},'variable':null},{'type':_0x0962('0x21'),'config':{'placeholder':_0x0962('0x22')},'props':{'title':_0x0962('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x0962('0x1e')](_0x0962('0x23'))?JSON[_0x0962('0x1d')](this['getDataValue'](_0x0962('0x23'))):{};},'set':function(_0x2f0995){return this['setDataValue'](_0x0962('0x23'),JSON[_0x0962('0x19')](_0x2f0995));}},'token':{'type':Sequelize[_0x0962('0x1')],'defaultValue':function(){return rs[_0x0962('0x24')]();}},'autoclose':{'type':Sequelize[_0x0962('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0962('0x1')]},'forwardOffline':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x25')},'waitingMessage':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0962('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x0962('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x0962('0x15')},'sendUnmanaged':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0962('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0962('0x1')]},'notificationTemplate':{'type':Sequelize[_0x0962('0xe')],'defaultValue':function(){return _0x0962('0x29');}},'notificationSound':{'type':Sequelize[_0x0962('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0962('0x1')],'defaultValue':_0x0962('0x2b')},'verticalAlignment':{'type':Sequelize[_0x0962('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0962('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x0962('0x1')]},'customerAvatar':{'type':Sequelize[_0x0962('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0962('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0962('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0962('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0962('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0962('0x2c')},'systemAvatar':{'type':Sequelize[_0x0962('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0962('0x6')],'comment':_0x0962('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x0962('0x7')],'defaultValue':![],'comment':_0x0962('0x2e'),'set':function(_0x503437){if(!_0x503437)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x0962('0x20')](_0x0962('0x2f'),_0x503437);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4a7de15..cd00b07 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 _0x0d0b=['role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','ChatWebsiteId','getDispositions','Disposition','nolimit','order','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.png','../../config/license/util','custom','existsSync','root','server/files/images/logos/','download','getAvatar','agentAvatar','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','difference','createdAt','updatedAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','list','orderBy','priority','asc','account','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','no\x20available\x20attributes','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','omit','ids','getInteractions','Contact','Owner','fullname','internal','Tag','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','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','Intervals','push','all','some','server/files/chat/iframe.js','remote','connection','replace','alignment','verticalAlignment','addApplications','sequelize','transaction','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','jayson/promise','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','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','ChatWebsite,\x20%s,\x20%s','message','info','result','sendStatus','end','status','json','count','offset','limit','set','apply','update','destroy','ChatWebsites','UserProfileResource','stack','name','mandatoryDispositionPause','ChatWebsite','model','keys','query','filters','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','merge','map','type','key','options','includeAll','include','rows','catch','show','Pause','rawAttributes','attributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x9ded14,_0x34dbc9){var _0x20c47c=function(_0x243efd){while(--_0x243efd){_0x9ded14['push'](_0x9ded14['shift']());}};_0x20c47c(++_0x34dbc9);}(_0x0d0b,0x1ef));var _0xb0d0=function(_0x1ee5b4,_0x28cf7b){_0x1ee5b4=_0x1ee5b4-0x0;var _0x336c7a=_0x0d0b[_0x1ee5b4];return _0x336c7a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb0d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0d0('0x2'));var moment=require(_0xb0d0('0x3'));var BPromise=require(_0xb0d0('0x4'));var Mustache=require(_0xb0d0('0x5'));var util=require(_0xb0d0('0x6'));var path=require(_0xb0d0('0x7'));var sox=require(_0xb0d0('0x8'));var csv=require(_0xb0d0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0d0('0xa'));var squel=require(_0xb0d0('0xb'));var crypto=require(_0xb0d0('0xc'));var jsforce=require(_0xb0d0('0xd'));var deskjs=require(_0xb0d0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0d0('0xf'));var Redis=require(_0xb0d0('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xb0d0('0x11'));var logger=require(_0xb0d0('0x12'))(_0xb0d0('0x13'));var utils=require(_0xb0d0('0x14'));var config=require(_0xb0d0('0x15'));var db=require(_0xb0d0('0x16'))['db'];config['redis']=_[_0xb0d0('0x17')](config[_0xb0d0('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xb0d0('0x19'))(new Redis(config['redis']));require(_0xb0d0('0x1a'))['register'](socket);var jayson=require(_0xb0d0('0x1b'));var client=jayson['client'][_0xb0d0('0x1c')]({'port':0x232c});var client9002=jayson[_0xb0d0('0x1d')]['http']({'port':0x232a});var client9003=jayson[_0xb0d0('0x1d')][_0xb0d0('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x59882e,_0x4e017d,_0x4dc7cd){if(_0x4dc7cd){var _0x42d986=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42d986[_0xb0d0('0x1e')](_0x4e017d)){return _0x59882e;}else{throw new db['Sequelize'][(_0xb0d0('0x1f'))](_0xb0d0('0x20'));}}else{return _0x59882e;}}function respondWithRpcPromise(_0x3a6b51,_0x3939cc,_0x38ab47,_0x528449){return new BPromise(function(_0x2643e3,_0x10392a){var _0x40049b=_0x528449||client;return _0x40049b[_0xb0d0('0x21')](_0x3a6b51,_0x38ab47)[_0xb0d0('0x22')](function(_0x3a248f){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3939cc,_0xb0d0('0x23'));logger['debug'](_0xb0d0('0x24'),_0x3939cc,_0xb0d0('0x23'),JSON['stringify'](_0x3a248f));if(_0x3a248f[_0xb0d0('0x25')]){if(_0x3a248f['error']['code']===0x1f4){logger['error'](_0xb0d0('0x26'),_0x3939cc,_0x3a248f[_0xb0d0('0x25')][_0xb0d0('0x27')]);return _0x10392a(_0x3a248f[_0xb0d0('0x25')][_0xb0d0('0x27')]);}logger[_0xb0d0('0x25')](_0xb0d0('0x26'),_0x3939cc,_0x3a248f['error']['message']);return _0x2643e3(_0x3a248f[_0xb0d0('0x25')][_0xb0d0('0x27')]);}else{logger[_0xb0d0('0x28')](_0xb0d0('0x26'),_0x3939cc,_0xb0d0('0x23'));_0x2643e3(_0x3a248f[_0xb0d0('0x29')][_0xb0d0('0x27')]);}})['catch'](function(_0x52deef){logger[_0xb0d0('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x3939cc,_0x52deef);_0x10392a(_0x52deef);});});}function respondWithStatusCode(_0x397a48,_0x4e865b){_0x4e865b=_0x4e865b||0xcc;return function(_0x254f22){if(_0x254f22){return _0x397a48[_0xb0d0('0x2a')](_0x4e865b);}return _0x397a48['status'](_0x4e865b)[_0xb0d0('0x2b')]();};}function respondWithResult(_0x3fffb8,_0x3b3179){_0x3b3179=_0x3b3179||0xc8;return function(_0x181f8a){if(_0x181f8a){return _0x3fffb8[_0xb0d0('0x2c')](_0x3b3179)[_0xb0d0('0x2d')](_0x181f8a);}};}function respondWithFilteredResult(_0x32e3c3,_0x17597a){return function(_0x147ad2){if(_0x147ad2){var _0x1331a0=_0x147ad2[_0xb0d0('0x2e')],_0x409ba1=_0x17597a['offset'],_0xbc77be=_0x17597a[_0xb0d0('0x2f')]+_0x17597a[_0xb0d0('0x30')],_0x37bc51;if(_0xbc77be>=_0x1331a0){_0xbc77be=_0x1331a0;_0x37bc51=0xc8;}else{_0x37bc51=0xce;}_0x32e3c3[_0xb0d0('0x2c')](_0x37bc51);return _0x32e3c3[_0xb0d0('0x31')]('Content-Range',_0x409ba1+'-'+_0xbc77be+'/'+_0x1331a0)[_0xb0d0('0x2d')](_0x147ad2);}return null;};}function patchUpdates(_0x1a6e57){return function(_0x458501){try{jsonpatch[_0xb0d0('0x32')](_0x458501,_0x1a6e57,!![]);}catch(_0x4e4e22){return BPromise['reject'](_0x4e4e22);}return _0x458501['save']();};}function saveUpdates(_0x16f48f,_0x4fab05){return function(_0x20739c){if(_0x20739c){return _0x20739c[_0xb0d0('0x33')](_0x16f48f)['then'](function(_0x6ee3d3){return _0x6ee3d3;});}return null;};}function removeEntity(_0x5c8b35,_0x2d54e7){return function(_0x4d2fbe){if(_0x4d2fbe){return _0x4d2fbe[_0xb0d0('0x34')]()[_0xb0d0('0x22')](function(){var _0x535eb0=_0x4d2fbe['get']({'plain':!![]});var _0x597e22=_0xb0d0('0x35');return db[_0xb0d0('0x36')][_0xb0d0('0x34')]({'where':{'type':_0x597e22,'resourceId':_0x535eb0['id']}})[_0xb0d0('0x22')](function(){return _0x4d2fbe;});})[_0xb0d0('0x22')](function(){_0x5c8b35[_0xb0d0('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2208d0,_0x110b9d){return function(_0x22c501){if(!_0x22c501){_0x2208d0[_0xb0d0('0x2a')](0x194);}return _0x22c501;};}function handleError(_0x151dd5,_0x110638){_0x110638=_0x110638||0x1f4;return function(_0x493e85){logger['error'](_0x493e85[_0xb0d0('0x37')]);if(_0x493e85[_0xb0d0('0x38')]){delete _0x493e85[_0xb0d0('0x38')];}_0x151dd5['status'](_0x110638)['send'](_0x493e85);};}exports['index']=function(_0x39eda6,_0x4e51b2){var _0xce4c7f={'include':[{'model':db['Pause'],'as':_0xb0d0('0x39')}]},_0xfde4e7={},_0x319932={'count':0x0,'rows':[]};var _0x2c5913=db[_0xb0d0('0x3a')]['rawAttributes'];_0xfde4e7[_0xb0d0('0x3b')]=_[_0xb0d0('0x3c')](_0x2c5913);_0xfde4e7[_0xb0d0('0x3d')]=_[_0xb0d0('0x3c')](_0x39eda6['query']);_0xfde4e7[_0xb0d0('0x3e')]=_[_0xb0d0('0x3f')](_0xfde4e7[_0xb0d0('0x3b')],_0xfde4e7[_0xb0d0('0x3d')]);_0xce4c7f['attributes']=_['intersection'](_0xfde4e7[_0xb0d0('0x3b')],qs[_0xb0d0('0x40')](_0x39eda6[_0xb0d0('0x3d')][_0xb0d0('0x40')]));_0xce4c7f['attributes']=_0xce4c7f['attributes'][_0xb0d0('0x41')]?_0xce4c7f['attributes']:_0xfde4e7[_0xb0d0('0x3b')];if(!_0x39eda6[_0xb0d0('0x3d')][_0xb0d0('0x42')]('nolimit')){_0xce4c7f[_0xb0d0('0x30')]=qs[_0xb0d0('0x30')](_0x39eda6[_0xb0d0('0x3d')][_0xb0d0('0x30')]);_0xce4c7f['offset']=qs['offset'](_0x39eda6['query'][_0xb0d0('0x2f')]);}_0xce4c7f['order']=qs[_0xb0d0('0x43')](_0x39eda6[_0xb0d0('0x3d')]['sort']);_0xce4c7f['where']=qs[_0xb0d0('0x3e')](_[_0xb0d0('0x44')](_0x39eda6[_0xb0d0('0x3d')],_0xfde4e7[_0xb0d0('0x3e')]));if(_0x39eda6[_0xb0d0('0x3d')][_0xb0d0('0x45')]){_0xce4c7f[_0xb0d0('0x46')]=_[_0xb0d0('0x47')](_0xce4c7f['where'],{'$or':_[_0xb0d0('0x48')](_0x2c5913,function(_0x578ee8){if(_0x578ee8[_0xb0d0('0x49')][_0xb0d0('0x4a')]!=='VIRTUAL'){var _0x288fa2={};_0x288fa2[_0x578ee8['field']]={'$like':'%'+_0x39eda6[_0xb0d0('0x3d')][_0xb0d0('0x45')]+'%'};return _0x288fa2;}})});}_0xce4c7f=_[_0xb0d0('0x47')]({},_0xce4c7f,_0x39eda6[_0xb0d0('0x4b')]);var _0x5f36de={'where':_0xce4c7f[_0xb0d0('0x46')]};return db['ChatWebsite'][_0xb0d0('0x2e')](_0x5f36de)[_0xb0d0('0x22')](function(_0x19e7c0){_0x319932[_0xb0d0('0x2e')]=_0x19e7c0;if(_0x39eda6['query'][_0xb0d0('0x4c')]){_0xce4c7f[_0xb0d0('0x4d')]=[{'all':!![]}];}return db[_0xb0d0('0x3a')]['findAll'](_0xce4c7f);})[_0xb0d0('0x22')](function(_0x4c291a){_0x319932[_0xb0d0('0x4e')]=_0x4c291a;return _0x319932;})[_0xb0d0('0x22')](respondWithFilteredResult(_0x4e51b2,_0xce4c7f))[_0xb0d0('0x4f')](handleError(_0x4e51b2,null));};exports[_0xb0d0('0x50')]=function(_0xf1c101,_0x1e1025){var _0x57c5de={'raw':![],'where':{'id':_0xf1c101['params']['id']},'include':[{'model':db[_0xb0d0('0x51')],'as':_0xb0d0('0x39')}]},_0x2aed81={};_0x2aed81[_0xb0d0('0x3b')]=_[_0xb0d0('0x3c')](db[_0xb0d0('0x3a')][_0xb0d0('0x52')]);_0x2aed81[_0xb0d0('0x3d')]=_[_0xb0d0('0x3c')](_0xf1c101[_0xb0d0('0x3d')]);_0x2aed81[_0xb0d0('0x3e')]=_['intersection'](_0x2aed81['model'],_0x2aed81['query']);_0x57c5de['attributes']=_[_0xb0d0('0x3f')](_0x2aed81[_0xb0d0('0x3b')],qs[_0xb0d0('0x40')](_0xf1c101[_0xb0d0('0x3d')]['fields']));_0x57c5de['attributes']=_0x57c5de[_0xb0d0('0x53')][_0xb0d0('0x41')]?_0x57c5de[_0xb0d0('0x53')]:_0x2aed81[_0xb0d0('0x3b')];if(_0xf1c101[_0xb0d0('0x3d')][_0xb0d0('0x4c')]){_0x57c5de[_0xb0d0('0x4d')]=[{'all':!![]}];}_0x57c5de=_[_0xb0d0('0x47')]({},_0x57c5de,_0xf1c101['options']);return db[_0xb0d0('0x3a')]['find'](_0x57c5de)['then'](handleEntityNotFound(_0x1e1025,null))['then'](respondWithResult(_0x1e1025,null))[_0xb0d0('0x4f')](handleError(_0x1e1025,null));};exports[_0xb0d0('0x54')]=function(_0xcd8989,_0x267a36){return db[_0xb0d0('0x3a')][_0xb0d0('0x54')](_0xcd8989[_0xb0d0('0x55')],{})['then'](function(_0x279b2c){var _0x3b8a4b=_0xcd8989[_0xb0d0('0x56')][_0xb0d0('0x57')]({'plain':!![]});if(!_0x3b8a4b)throw new Error(_0xb0d0('0x58'));if(_0x3b8a4b[_0xb0d0('0x59')]==='user'){var _0x49fff0=_0x279b2c[_0xb0d0('0x57')]({'plain':!![]});var _0x20f3a3=_0xb0d0('0x35');return db[_0xb0d0('0x5a')]['find']({'where':{'name':_0x20f3a3,'userProfileId':_0x3b8a4b['userProfileId']},'raw':!![]})['then'](function(_0x2cfd9d){if(_0x2cfd9d&&_0x2cfd9d[_0xb0d0('0x5b')]===0x0){return db[_0xb0d0('0x36')][_0xb0d0('0x54')]({'name':_0x49fff0['name'],'resourceId':_0x49fff0['id'],'type':_0x2cfd9d[_0xb0d0('0x38')],'sectionId':_0x2cfd9d['id']},{})[_0xb0d0('0x22')](function(){return _0x279b2c;});}else{return _0x279b2c;}})[_0xb0d0('0x4f')](function(_0xcdedc4){logger[_0xb0d0('0x25')](_0xb0d0('0x5c'),_0xcdedc4);throw _0xcdedc4;});}return _0x279b2c;})[_0xb0d0('0x22')](respondWithResult(_0x267a36,0xc9))[_0xb0d0('0x4f')](handleError(_0x267a36,null));};exports[_0xb0d0('0x33')]=function(_0x2325f1,_0x4da05d){if(_0x2325f1[_0xb0d0('0x55')]['id']){delete _0x2325f1[_0xb0d0('0x55')]['id'];}return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'where':{'id':_0x2325f1[_0xb0d0('0x5e')]['id']},'include':[{'model':db[_0xb0d0('0x51')],'as':'mandatoryDispositionPause'}]})[_0xb0d0('0x22')](handleEntityNotFound(_0x4da05d,null))[_0xb0d0('0x22')](saveUpdates(_0x2325f1[_0xb0d0('0x55')],null))[_0xb0d0('0x22')](respondWithResult(_0x4da05d,null))[_0xb0d0('0x4f')](handleError(_0x4da05d,null));};exports[_0xb0d0('0x34')]=function(_0x47d14e,_0x188666){return db['ChatWebsite'][_0xb0d0('0x5d')]({'where':{'id':_0x47d14e[_0xb0d0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x188666,null))['then'](removeEntity(_0x188666,null))[_0xb0d0('0x4f')](handleError(_0x188666,null));};exports[_0xb0d0('0x5f')]=function(_0x53d860,_0x487dac){return db['ChatWebsite']['describe']()[_0xb0d0('0x22')](respondWithResult(_0x487dac,null))[_0xb0d0('0x4f')](handleError(_0x487dac,null));};exports['addDisposition']=function(_0x388b6c,_0x1d7b87,_0x15f7f9){if(_0x388b6c[_0xb0d0('0x55')]['id']){delete _0x388b6c['body']['id'];}return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'where':{'id':_0x388b6c[_0xb0d0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1d7b87,null))[_0xb0d0('0x22')](function(_0x27666f){if(_0x27666f){_0x388b6c[_0xb0d0('0x55')][_0xb0d0('0x60')]=_0x27666f['id'];return db['Disposition'][_0xb0d0('0x54')](_0x388b6c['body']);}})[_0xb0d0('0x22')](respondWithResult(_0x1d7b87,null))[_0xb0d0('0x4f')](handleError(_0x1d7b87,null));};exports[_0xb0d0('0x61')]=function(_0x144ce3,_0x4dfe38,_0x11c061){var _0x452fda={'raw':![],'where':{}};var _0x86243d={};var _0x3beb0a={'count':0x0,'rows':[]};return db[_0xb0d0('0x3a')]['findOne']({'where':{'id':_0x144ce3['params']['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x4dfe38,null))[_0xb0d0('0x22')](function(_0x250f82){if(_0x250f82){_0x86243d[_0xb0d0('0x3b')]=_['keys'](db[_0xb0d0('0x62')][_0xb0d0('0x52')]);_0x86243d[_0xb0d0('0x3d')]=_[_0xb0d0('0x3c')](_0x144ce3[_0xb0d0('0x3d')]);_0x86243d[_0xb0d0('0x3e')]=_[_0xb0d0('0x3f')](_0x86243d[_0xb0d0('0x3b')],_0x86243d[_0xb0d0('0x3d')]);_0x452fda[_0xb0d0('0x53')]=_[_0xb0d0('0x3f')](_0x86243d[_0xb0d0('0x3b')],qs['fields'](_0x144ce3[_0xb0d0('0x3d')][_0xb0d0('0x40')]));_0x452fda[_0xb0d0('0x53')]=_0x452fda[_0xb0d0('0x53')]['length']?_0x452fda['attributes']:_0x86243d[_0xb0d0('0x3b')];if(!_0x144ce3[_0xb0d0('0x3d')][_0xb0d0('0x42')](_0xb0d0('0x63'))){_0x452fda[_0xb0d0('0x30')]=qs[_0xb0d0('0x30')](_0x144ce3[_0xb0d0('0x3d')]['limit']);_0x452fda[_0xb0d0('0x2f')]=qs[_0xb0d0('0x2f')](_0x144ce3[_0xb0d0('0x3d')][_0xb0d0('0x2f')]);}_0x452fda[_0xb0d0('0x64')]=qs[_0xb0d0('0x43')](_0x144ce3[_0xb0d0('0x3d')][_0xb0d0('0x43')]);_0x452fda['where']=qs[_0xb0d0('0x3e')](_[_0xb0d0('0x44')](_0x144ce3[_0xb0d0('0x3d')],_0x86243d[_0xb0d0('0x3e')]));_0x452fda[_0xb0d0('0x46')][_0xb0d0('0x60')]=_0x250f82['id'];if(_0x144ce3[_0xb0d0('0x3d')][_0xb0d0('0x45')]){_0x452fda['where']=_[_0xb0d0('0x47')](_0x452fda[_0xb0d0('0x46')],{'$or':_[_0xb0d0('0x48')](_0x452fda[_0xb0d0('0x53')],function(_0xf51b53){var _0x23b515={};_0x23b515[_0xf51b53]={'$like':'%'+_0x144ce3['query'][_0xb0d0('0x45')]+'%'};return _0x23b515;})});}_0x452fda=_['merge']({},_0x452fda,_0x144ce3[_0xb0d0('0x4b')]);return db['Disposition']['count']({'where':_0x452fda['where']})[_0xb0d0('0x22')](function(_0xe73fb6){_0x3beb0a[_0xb0d0('0x2e')]=_0xe73fb6;if(_0x144ce3[_0xb0d0('0x3d')][_0xb0d0('0x4c')]){_0x452fda[_0xb0d0('0x4d')]=[{'all':!![]}];}return db[_0xb0d0('0x62')][_0xb0d0('0x65')](_0x452fda);})[_0xb0d0('0x22')](function(_0x454283){_0x3beb0a[_0xb0d0('0x4e')]=_0x454283;return _0x3beb0a;});}})[_0xb0d0('0x22')](respondWithFilteredResult(_0x4dfe38,_0x452fda))[_0xb0d0('0x4f')](handleError(_0x4dfe38,null));};exports[_0xb0d0('0x66')]=function(_0x3ebe62,_0x1038cb,_0xca7552){return db['ChatWebsite']['find']({'where':{'id':_0x3ebe62[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x1038cb,null))['then'](function(_0x17eba0){if(_0x17eba0){return _0x17eba0['removeDispositions'](_0x3ebe62[_0xb0d0('0x3d')]['ids']);}})[_0xb0d0('0x22')](respondWithStatusCode(_0x1038cb,null))[_0xb0d0('0x4f')](handleError(_0x1038cb,null));};exports[_0xb0d0('0x67')]=function(_0x2506b6,_0x424834,_0x5e0581){if(_0x2506b6[_0xb0d0('0x55')]['id']){delete _0x2506b6[_0xb0d0('0x55')]['id'];}return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'where':{'id':_0x2506b6[_0xb0d0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x424834,null))[_0xb0d0('0x22')](function(_0x2a5a8b){if(_0x2a5a8b){_0x2506b6[_0xb0d0('0x55')][_0xb0d0('0x60')]=_0x2a5a8b['id'];return db[_0xb0d0('0x68')][_0xb0d0('0x54')](_0x2506b6[_0xb0d0('0x55')]);}})[_0xb0d0('0x22')](respondWithResult(_0x424834,null))[_0xb0d0('0x4f')](handleError(_0x424834,null));};exports[_0xb0d0('0x69')]=function(_0x54156a,_0x2e6ab6,_0x5191a5){var _0x34d9f3={'raw':![],'where':{}};var _0x4db54f={};var _0x254b3c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb0d0('0x6a')]({'where':{'id':_0x54156a[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x2e6ab6,null))['then'](function(_0x3b9393){if(_0x3b9393){_0x4db54f[_0xb0d0('0x3b')]=_[_0xb0d0('0x3c')](db[_0xb0d0('0x68')][_0xb0d0('0x52')]);_0x4db54f[_0xb0d0('0x3d')]=_[_0xb0d0('0x3c')](_0x54156a[_0xb0d0('0x3d')]);_0x4db54f[_0xb0d0('0x3e')]=_[_0xb0d0('0x3f')](_0x4db54f['model'],_0x4db54f['query']);_0x34d9f3[_0xb0d0('0x53')]=_[_0xb0d0('0x3f')](_0x4db54f['model'],qs['fields'](_0x54156a[_0xb0d0('0x3d')][_0xb0d0('0x40')]));_0x34d9f3[_0xb0d0('0x53')]=_0x34d9f3[_0xb0d0('0x53')]['length']?_0x34d9f3[_0xb0d0('0x53')]:_0x4db54f['model'];if(!_0x54156a[_0xb0d0('0x3d')][_0xb0d0('0x42')](_0xb0d0('0x63'))){_0x34d9f3[_0xb0d0('0x30')]=qs['limit'](_0x54156a[_0xb0d0('0x3d')]['limit']);_0x34d9f3[_0xb0d0('0x2f')]=qs[_0xb0d0('0x2f')](_0x54156a['query'][_0xb0d0('0x2f')]);}_0x34d9f3[_0xb0d0('0x64')]=qs[_0xb0d0('0x43')](_0x54156a[_0xb0d0('0x3d')]['sort']);_0x34d9f3['where']=qs['filters'](_[_0xb0d0('0x44')](_0x54156a[_0xb0d0('0x3d')],_0x4db54f[_0xb0d0('0x3e')]));_0x34d9f3['where'][_0xb0d0('0x60')]=_0x3b9393['id'];if(_0x54156a[_0xb0d0('0x3d')]['filter']){_0x34d9f3[_0xb0d0('0x46')]=_[_0xb0d0('0x47')](_0x34d9f3[_0xb0d0('0x46')],{'$or':_[_0xb0d0('0x48')](_0x34d9f3[_0xb0d0('0x53')],function(_0x373755){var _0x38786f={};_0x38786f[_0x373755]={'$like':'%'+_0x54156a[_0xb0d0('0x3d')][_0xb0d0('0x45')]+'%'};return _0x38786f;})});}_0x34d9f3=_['merge']({},_0x34d9f3,_0x54156a[_0xb0d0('0x4b')]);return db['CannedAnswer']['count']({'where':_0x34d9f3[_0xb0d0('0x46')]})[_0xb0d0('0x22')](function(_0x3b1fcb){_0x254b3c[_0xb0d0('0x2e')]=_0x3b1fcb;if(_0x54156a['query'][_0xb0d0('0x4c')]){_0x34d9f3[_0xb0d0('0x4d')]=[{'all':!![]}];}return db[_0xb0d0('0x68')]['findAll'](_0x34d9f3);})[_0xb0d0('0x22')](function(_0x546e33){_0x254b3c[_0xb0d0('0x4e')]=_0x546e33;return _0x254b3c;});}})[_0xb0d0('0x22')](respondWithFilteredResult(_0x2e6ab6,_0x34d9f3))[_0xb0d0('0x4f')](handleError(_0x2e6ab6,null));};exports[_0xb0d0('0x6b')]=function(_0x5c8352,_0x40f221,_0x57bee0){return db['ChatWebsite'][_0xb0d0('0x5d')]({'where':{'id':_0x5c8352[_0xb0d0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x40f221,null))[_0xb0d0('0x22')](function(_0xfa7d54){if(_0xfa7d54){return _0xfa7d54['removeAnswers'](_0x5c8352[_0xb0d0('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x40f221,null))[_0xb0d0('0x4f')](handleError(_0x40f221,null));};exports[_0xb0d0('0x6c')]=function(_0x1b7efc,_0x24560c,_0x3379a8){_0x1b7efc['body'][_0xb0d0('0x6d')]=_0x1b7efc[_0xb0d0('0x6e')][_0xb0d0('0x6f')];return db[_0xb0d0('0x3a')]['find']({'where':{'id':_0x1b7efc[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x24560c,null))[_0xb0d0('0x22')](saveUpdates(_0x1b7efc[_0xb0d0('0x55')],null))['then'](respondWithResult(_0x24560c,null))['catch'](handleError(_0x24560c,null));};exports[_0xb0d0('0x70')]=function(_0x1a369c,_0x4cf63c,_0x2a0b16){_0x1a369c['body']['agentAvatar']=_0x1a369c['file'][_0xb0d0('0x6f')];return db['ChatWebsite'][_0xb0d0('0x5d')]({'where':{'id':_0x1a369c[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x4cf63c,null))['then'](saveUpdates(_0x1a369c['body'],null))[_0xb0d0('0x22')](respondWithResult(_0x4cf63c,null))[_0xb0d0('0x4f')](handleError(_0x4cf63c,null));};exports[_0xb0d0('0x71')]=function(_0x1aa475,_0x2ad142,_0x1e86f5){_0x1aa475[_0xb0d0('0x55')][_0xb0d0('0x72')]=_0x1aa475[_0xb0d0('0x6e')][_0xb0d0('0x6f')];return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'where':{'id':_0x1aa475[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x2ad142,null))['then'](saveUpdates(_0x1aa475['body'],null))[_0xb0d0('0x22')](respondWithResult(_0x2ad142,null))[_0xb0d0('0x4f')](handleError(_0x2ad142,null));};exports[_0xb0d0('0x73')]=function(_0x49695a,_0x318a7b,_0x2c707f){_0x49695a[_0xb0d0('0x55')][_0xb0d0('0x74')]=_0x49695a['file']['filename'];return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'where':{'id':_0x49695a[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x318a7b,null))[_0xb0d0('0x22')](saveUpdates(_0x49695a[_0xb0d0('0x55')],null))[_0xb0d0('0x22')](respondWithResult(_0x318a7b,null))[_0xb0d0('0x4f')](handleError(_0x318a7b,null));};exports[_0xb0d0('0x75')]=function(_0x254d9a,_0x437254,_0x537b24){var _0x1e3fc1=path[_0xb0d0('0x76')](config['root'],_0xb0d0('0x77'));var _0x3dba86={'where':{'id':_0x254d9a[_0xb0d0('0x5e')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x560e12=![];return require(_0xb0d0('0x78'))['getLicense']()[_0xb0d0('0x22')](function(_0x1f941b){if(_0x1f941b){_0x560e12=_0x1f941b[_0xb0d0('0x79')];}})[_0xb0d0('0x22')](function(){return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')](_0x3dba86);})[_0xb0d0('0x22')](handleEntityNotFound(_0x437254,null))[_0xb0d0('0x22')](function(_0x1ffa53){if(_0x1ffa53){if(!_['isNil'](_0x1ffa53[_0xb0d0('0x6d')])){if(fs[_0xb0d0('0x7a')](path['join'](config[_0xb0d0('0x7b')],_0xb0d0('0x7c'),_0x1ffa53['sitepic']))&&_0x560e12){_0x1e3fc1=path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],'server/files/images/logos/',_0x1ffa53[_0xb0d0('0x6d')]);}}return _0x437254[_0xb0d0('0x7d')](_0x1e3fc1);}})['catch'](handleError(_0x437254,null));};exports[_0xb0d0('0x7e')]=function(_0xaf45c7,_0x14ff4e,_0x5537b1){var _0x3cb5f8=path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],'server/files/images/avatars/default_avatar.png');var _0x5b6035={'where':{'id':_0xaf45c7[_0xb0d0('0x5e')]['id']},'attributes':['id',_0xb0d0('0x7f')],'raw':!![]};return db[_0xb0d0('0x3a')]['find'](_0x5b6035)[_0xb0d0('0x22')](handleEntityNotFound(_0x14ff4e,null))[_0xb0d0('0x22')](function(_0x571a54){if(_0x571a54){if(!_[_0xb0d0('0x80')](_0x571a54[_0xb0d0('0x7f')])){if(fs['existsSync'](path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],_0xb0d0('0x81'),_0x571a54[_0xb0d0('0x7f')]))){_0x3cb5f8=path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],'server/files/images/avatars/',_0x571a54['agentAvatar']);}}return _0x14ff4e[_0xb0d0('0x7d')](_0x3cb5f8);}})['catch'](handleError(_0x14ff4e,null));};exports['getCustomerAvatar']=function(_0x50bce0,_0x514133,_0xd3db04){var _0x517f83=path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],_0xb0d0('0x82'));var _0x5630a6={'where':{'id':_0x50bce0[_0xb0d0('0x5e')]['id']},'attributes':['id','customerAvatar',_0xb0d0('0x83')],'raw':!![]};return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')](_0x5630a6)[_0xb0d0('0x22')](handleEntityNotFound(_0x514133,null))[_0xb0d0('0x22')](function(_0x5d428b){if(_0x5d428b){if(!_['isNil'](_0x5d428b[_0xb0d0('0x72')])){if(fs[_0xb0d0('0x7a')](path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],_0xb0d0('0x81'),_0x5d428b[_0xb0d0('0x72')]))&&_0x5d428b[_0xb0d0('0x83')]){_0x517f83=path['join'](config[_0xb0d0('0x7b')],_0xb0d0('0x81'),_0x5d428b[_0xb0d0('0x72')]);}}return _0x514133['download'](_0x517f83);}})[_0xb0d0('0x4f')](handleError(_0x514133,null));};exports[_0xb0d0('0x84')]=function(_0x3ec3ac,_0xc7a799,_0x2c8742){var _0x1ad156=path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],_0xb0d0('0x85'));var _0x2ccb09={'where':{'id':_0x3ec3ac[_0xb0d0('0x5e')]['id']},'attributes':['id',_0xb0d0('0x74')],'raw':!![]};return db[_0xb0d0('0x3a')]['find'](_0x2ccb09)['then'](handleEntityNotFound(_0xc7a799,null))[_0xb0d0('0x22')](function(_0x13db34){if(_0x13db34){if(!_['isNil'](_0x13db34[_0xb0d0('0x74')])){if(fs[_0xb0d0('0x7a')](path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],_0xb0d0('0x81'),_0x13db34[_0xb0d0('0x74')]))){_0x1ad156=path[_0xb0d0('0x76')](config['root'],_0xb0d0('0x81'),_0x13db34[_0xb0d0('0x74')]);}}return _0xc7a799[_0xb0d0('0x7d')](_0x1ad156);}})[_0xb0d0('0x4f')](handleError(_0xc7a799,null));};exports[_0xb0d0('0x86')]=function(_0x3cb971,_0x5b13dd,_0x520d10){var _0x322bfe=require(_0xb0d0('0x87'));var _0x95c5cf=new _0x322bfe();var _0x42f52f=_0x95c5cf[_0xb0d0('0x88')](_0x3cb971[_0xb0d0('0x89')]['user-agent'])[_0xb0d0('0x8a')]();var _0x579f35={'body':_0x3cb971[_0xb0d0('0x55')],'channel':_0xb0d0('0x8b')};var _0x32d4c5=[];var _0xd91f82=[];var _0x4787af={};var _0x32fbbb=![];return db[_0xb0d0('0x8c')]['describe']()[_0xb0d0('0x22')](function(_0x3c4c4b){if(!_0x3c4c4b){throw new db['Sequelize'][(_0xb0d0('0x1f'))]('no\x20available\x20attributes');}_0x32d4c5=_[_0xb0d0('0x8d')](_[_0xb0d0('0x3c')](_0x3c4c4b),[_0xb0d0('0x8e'),_0xb0d0('0x8f')]);_0xd91f82=_['difference'](_[_0xb0d0('0x3c')](_0x3c4c4b),[_0xb0d0('0x8e'),_0xb0d0('0x8f'),_0xb0d0('0x90'),'ListId']);if(_0x3cb971[_0xb0d0('0x55')]['id']){delete _0x3cb971['body']['id'];}if(_[_0xb0d0('0x80')](_0x3cb971['body'][_0xb0d0('0x91')])){throw new db[(_0xb0d0('0x92'))][(_0xb0d0('0x1f'))](_0xb0d0('0x93'));}if(_[_0xb0d0('0x80')](_0x3cb971['body']['body'])||_0x3cb971['body'][_0xb0d0('0x55')]===''){throw new db['Sequelize'][(_0xb0d0('0x1f'))](_0xb0d0('0x94'));}if(_[_0xb0d0('0x80')](_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0x95')])){throw new db[(_0xb0d0('0x92'))][(_0xb0d0('0x1f'))](_0xb0d0('0x96')+_0xd91f82);}if(!_[_0xb0d0('0x97')](_0xd91f82,_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0x95')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xd91f82);}_0x4787af[_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0x95')]]=_0x3cb971['body'][_0xb0d0('0x91')];})[_0xb0d0('0x22')](function(){return db['ChatWebsite'][_0xb0d0('0x5d')]({'where':{'id':_0x3cb971[_0xb0d0('0x5e')]['id']},'include':[{'model':db[_0xb0d0('0x98')],'as':_0xb0d0('0x99'),'include':[{'model':db[_0xb0d0('0x8c')],'as':_0xb0d0('0x9a'),'where':_0x4787af,'limit':0x1,'order':[['updatedAt',_0xb0d0('0x9b')]]}]},{'model':db[_0xb0d0('0x9c')],'as':_0xb0d0('0x9d')}]});})[_0xb0d0('0x22')](handleEntityNotFound(_0x5b13dd,null))[_0xb0d0('0x22')](function(_0x4cb218){if(_0x4cb218&&_0x4cb218[_0xb0d0('0x99')]){_0x579f35['account']=_0x4cb218;_0x579f35[_0xb0d0('0x9e')]=_0x4cb218['Applications'];_0x579f35[_0xb0d0('0x9f')]=_0x4cb218['List'];_0x579f35[_0xb0d0('0x9e')]=_[_0xb0d0('0xa0')](_0x579f35[_0xb0d0('0x9e')],[_0xb0d0('0xa1')],[_0xb0d0('0xa2')]);if(_0x579f35[_0xb0d0('0xa3')][_0xb0d0('0x9d')]){delete _0x579f35['account'][_0xb0d0('0x9d')];}if(_0x579f35[_0xb0d0('0xa3')][_0xb0d0('0x99')]&&_0x579f35[_0xb0d0('0xa3')]['List']['Contacts']['length']){return _0x579f35[_0xb0d0('0xa3')][_0xb0d0('0x99')][_0xb0d0('0x9a')][0x0];}var _0x14d161=_['defaults'](_0x3cb971['body'],{'firstName':_0x3cb971[_0xb0d0('0x55')]['from'],'ListId':_0x4cb218[_0xb0d0('0xa4')]});_0x14d161[_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0x95')]]=_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0x91')];return db[_0xb0d0('0x8c')][_0xb0d0('0x54')](_0x14d161,{'fields':_0x32d4c5,'raw':!![]});}})[_0xb0d0('0x22')](handleEntityNotFound(_0x5b13dd,null))[_0xb0d0('0x22')](function(_0x4b0186){_0x579f35[_0xb0d0('0xa5')]=_0x4b0186;var _0x5095ee=_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xa6')];if(_0x3cb971['headers'][_0xb0d0('0xa7')]){_0x5095ee=_0x3cb971[_0xb0d0('0x89')][_0xb0d0('0xa7')];}else if(_0x3cb971['headers'][_0xb0d0('0xa8')]){_0x5095ee=_[_0xb0d0('0xa9')](_0x3cb971[_0xb0d0('0x89')][_0xb0d0('0xa8')][_0xb0d0('0xaa')](','));}if(_0x4b0186){var _0x64a24={'ContactId':_0x4b0186['id'],'ChatWebsiteId':_0x3cb971[_0xb0d0('0x5e')]['id'],'from':(_0x4b0186[_0xb0d0('0xab')]||'')+'\x20'+(_0x4b0186[_0xb0d0('0xac')]||''),'customerIp':_0x5095ee,'customerPort':_0x3cb971[_0xb0d0('0x89')][_0xb0d0('0xad')]?_0x3cb971[_0xb0d0('0x89')][_0xb0d0('0xad')]:null,'referer':_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xae')],'browserName':_0x42f52f[_0xb0d0('0xaf')][_0xb0d0('0x38')]&&_0x42f52f[_0xb0d0('0xaf')][_0xb0d0('0xb0')]?util[_0xb0d0('0xb1')](_0xb0d0('0xb2'),_0x42f52f[_0xb0d0('0xaf')][_0xb0d0('0x38')],_0x42f52f[_0xb0d0('0xaf')][_0xb0d0('0xb0')]):_0xb0d0('0xb3'),'browserVersion':_0x42f52f[_0xb0d0('0xaf')]['version']||'unknown','osName':util[_0xb0d0('0xb1')](_0xb0d0('0xb2'),_0x42f52f['os'][_0xb0d0('0x38')],_0x42f52f['os'][_0xb0d0('0xb0')]),'osVersion':_0x42f52f['os']['version'],'deviceModel':_0x42f52f[_0xb0d0('0xb4')]['model']&&_0x42f52f[_0xb0d0('0xb4')][_0xb0d0('0xb5')]?util[_0xb0d0('0xb1')](_0xb0d0('0xb6'),_0x42f52f['device'][_0xb0d0('0x3b')],_0x42f52f[_0xb0d0('0xb4')]['vendor'],_0x42f52f[_0xb0d0('0xb4')]['type']):null,'deviceVendor':_0x42f52f[_0xb0d0('0xb4')][_0xb0d0('0xb5')],'deviceType':_0x42f52f['device'][_0xb0d0('0x49')],'formData':JSON[_0xb0d0('0xb7')](_0x3cb971['body'])};var _0xe32e19={'ChatWebsiteId':_0x3cb971[_0xb0d0('0x5e')]['id'],'closed':![]};if(_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xb8')]){_0xe32e19[_0xb0d0('0xb8')]=_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xb8')];return db['ChatInteraction'][_0xb0d0('0x5d')]({'where':_0xe32e19})[_0xb0d0('0x22')](function(_0x17876a){if(_0x17876a){return[_0x17876a,![]];}_0x64a24[_0xb0d0('0xb8')]=_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xb8')];_0x64a24[_0xb0d0('0xb9')]=_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xb9')];return db[_0xb0d0('0xba')]['create'](_0x64a24)['then'](function(_0x10399c){return[_0x10399c,!![]];});});}_0xe32e19[_0xb0d0('0xbb')]=_0x4b0186['id'];if(_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xbc')]&&_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xbc')]['id']){_0xe32e19['id']=_0x3cb971['body'][_0xb0d0('0xbc')]['id'];return db[_0xb0d0('0xba')]['find']({'where':_0xe32e19})[_0xb0d0('0x22')](function(_0x1a0b88){if(_0x1a0b88){return[_0x1a0b88,![]];}return db[_0xb0d0('0xba')]['create'](_0x64a24)[_0xb0d0('0x22')](function(_0x35d9ff){return[_0x35d9ff,!![]];});});}return db[_0xb0d0('0xba')][_0xb0d0('0x54')](_0x64a24)[_0xb0d0('0x22')](function(_0x202660){return[_0x202660,!![]];});}})[_0xb0d0('0xbd')](function(_0x324ca1,_0x6e9604){if(_0x324ca1){_0x32fbbb=_0x6e9604;if(!_0x6e9604){var _0x557ace={'from':(_0x579f35[_0xb0d0('0xa5')][_0xb0d0('0xab')]||'')+'\x20'+(_0x579f35[_0xb0d0('0xa5')]['lastName']||'')};if(_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xb8')]&&_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xbe')]&&_0x3cb971[_0xb0d0('0x55')]['threadId']!=_0x3cb971[_0xb0d0('0x55')]['messageId']){_0x557ace[_0xb0d0('0xb8')]=_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xbe')];}return _0x324ca1[_0xb0d0('0x33')](_0x557ace);}else{return _0x324ca1;}}})[_0xb0d0('0x22')](function(_0x2e7245){_0x579f35[_0xb0d0('0xbc')]=_0x2e7245[_0xb0d0('0x57')]({'plain':!![]});_0x579f35[_0xb0d0('0xbc')][_0xb0d0('0xbf')]=_0x32fbbb;if(_0x579f35[_0xb0d0('0xbc')][_0xb0d0('0xbf')]){if(_0x579f35[_0xb0d0('0xa3')]['autoclose']){_0x579f35['applications']['push']({'id':0x0,'priority':_0x579f35[_0xb0d0('0x9e')][_0xb0d0('0x41')]+0x1,'app':'close','appdata':_0xb0d0('0xc0'),'interval':_0xb0d0('0xc1')});}}return db['ChatMessage'][_0xb0d0('0x54')]({'body':_0x3cb971['body']['body'],'ChatWebsiteId':_0x3cb971[_0xb0d0('0x5e')]['id'],'ChatInteractionId':_0x2e7245['id'],'direction':'in','ContactId':_0x579f35['contact']['id'],'AttachmentId':_0x3cb971[_0xb0d0('0x55')][_0xb0d0('0xc2')]});})[_0xb0d0('0x22')](function(_0xf85053){_0x579f35[_0xb0d0('0x27')]=_0xf85053;if(_0x579f35[_0xb0d0('0xbc')][_0xb0d0('0xc3')]){return db[_0xb0d0('0xc4')]['find']({'attributes':['id',_0xb0d0('0x38')],'where':{'id':_0x579f35[_0xb0d0('0xbc')][_0xb0d0('0xc3')]}})['then'](function(_0x1c8833){if(_0x1c8833){_0x579f35['applications'][_0xb0d0('0xc5')]({'id':0x0,'priority':0x0,'app':_0xb0d0('0xc6'),'appdata':_0x1c8833['name']+','+(_0x579f35[_0xb0d0('0xa3')][_0xb0d0('0xc7')]||0xa),'interval':_0xb0d0('0xc1')});_0x579f35[_0xb0d0('0xc8')]=!![];}return respondWithRpcPromise('Start',_0xb0d0('0xc9'),_0x579f35);});}return respondWithRpcPromise(_0xb0d0('0xca'),_0xb0d0('0xc9'),_0x579f35);})[_0xb0d0('0x22')](function(_0x149840){respondWithRpcPromise(_0xb0d0('0xcb'),_0xb0d0('0xcb'),{'event':_0xb0d0('0x86'),'message':_0x149840},client9002);return _0x149840;})[_0xb0d0('0x22')](respondWithResult(_0x5b13dd,null))[_0xb0d0('0x4f')](handleError(_0x5b13dd,null));};exports[_0xb0d0('0xcc')]=function(_0x2ff439,_0x24b9eb,_0x173450){var _0x1dc1b2,_0x47b449,_0x134d03;var _0xaf9ab2=[];var _0x33ac1d=[];var _0x3c8fab={};return db[_0xb0d0('0x8c')][_0xb0d0('0x5f')]()[_0xb0d0('0x22')](function(_0x57c7d7){if(!_0x57c7d7){throw new db[(_0xb0d0('0x92'))][(_0xb0d0('0x1f'))](_0xb0d0('0xcd'));}_0x33ac1d=_['difference'](_[_0xb0d0('0x3c')](_0x57c7d7),[_0xb0d0('0x8e'),_0xb0d0('0x8f')]);_0xaf9ab2=_[_0xb0d0('0x8d')](_[_0xb0d0('0x3c')](_0x57c7d7),[_0xb0d0('0x8e'),_0xb0d0('0x8f'),_0xb0d0('0x90'),_0xb0d0('0xa4')]);if(_0x2ff439[_0xb0d0('0x55')]['id']){delete _0x2ff439[_0xb0d0('0x55')]['id'];}if(_[_0xb0d0('0x80')](_0x2ff439[_0xb0d0('0x55')][_0xb0d0('0x91')])){throw _0x24b9eb[_0xb0d0('0x2c')](0x1f4)[_0xb0d0('0xce')](new db['Sequelize'][(_0xb0d0('0x1f'))](_0xb0d0('0x93')));}if(_[_0xb0d0('0x80')](_0x2ff439[_0xb0d0('0x55')]['body'])||_0x2ff439[_0xb0d0('0x55')]['body']===''){throw _0x24b9eb[_0xb0d0('0x2c')](0x1f4)['send'](new db[(_0xb0d0('0x92'))][(_0xb0d0('0x1f'))](_0xb0d0('0x94')));}if(_[_0xb0d0('0x80')](_0x2ff439[_0xb0d0('0x55')][_0xb0d0('0xcf')])){throw _0x24b9eb[_0xb0d0('0x2c')](0x1f4)[_0xb0d0('0xce')](new db[(_0xb0d0('0x92'))][(_0xb0d0('0x1f'))](_0xb0d0('0xd0')+_0xaf9ab2));}if(!_[_0xb0d0('0x97')](_0xaf9ab2,_0x2ff439[_0xb0d0('0x55')][_0xb0d0('0xcf')])){throw _0x24b9eb[_0xb0d0('0x2c')](0x1f4)[_0xb0d0('0xce')](new db[(_0xb0d0('0x92'))][(_0xb0d0('0x1f'))](_0xb0d0('0xd1')+_0xaf9ab2));}_0x3c8fab[_0x2ff439[_0xb0d0('0x55')][_0xb0d0('0xcf')]]=_0x2ff439[_0xb0d0('0x55')][_0xb0d0('0x91')];})['then'](function(){return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'where':{'id':_0x2ff439[_0xb0d0('0x5e')]['id']},'include':[{'model':db[_0xb0d0('0x98')],'as':_0xb0d0('0x99')}]});})[_0xb0d0('0x22')](handleEntityNotFound(_0x24b9eb,null))[_0xb0d0('0x22')](function(_0x2913bb){if(_0x2913bb&&_0x2913bb['List']){_0x47b449=_0x2913bb;var _0x279406=_[_0xb0d0('0x17')](_0x2ff439['body'],{'firstName':_0x2ff439[_0xb0d0('0x55')][_0xb0d0('0x91')],'phone':_0x2ff439[_0xb0d0('0x55')]['from'],'ListId':_0x2913bb[_0xb0d0('0xa4')]});_0x279406[_0x2ff439[_0xb0d0('0x55')][_0xb0d0('0xcf')]]=_0x2ff439[_0xb0d0('0x55')]['from'];return db[_0xb0d0('0x8c')][_0xb0d0('0xd2')]({'where':_0x3c8fab,'defaults':_0x279406});}})['spread'](function(_0x291672){if(_0x291672){_0x134d03=_0x291672;var _0x40f593=fs[_0xb0d0('0xd3')](path['join'](config['root'],_0xb0d0('0xd4')),_0xb0d0('0xd5'));var _0x501321=ejs[_0xb0d0('0xd6')](_0x40f593,{'body':_[_0xb0d0('0xd7')](_0x2ff439[_0xb0d0('0x55')][_0xb0d0('0x55')]),'bodyTitle':_0x47b449[_0xb0d0('0xd8')]});return db[_0xb0d0('0xd9')][_0xb0d0('0x54')]({'body':_0x501321,'ContactId':_0x291672['id'],'ChatWebsiteId':_0x47b449['id']});}})[_0xb0d0('0x22')](function(_0x4b69bf){if(_0x4b69bf){_0x1dc1b2=_0x4b69bf;return db[_0xb0d0('0xda')][_0xb0d0('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0xb0d0('0xdb')],'as':_0xb0d0('0xdc'),'raw':!![]}]});}})[_0xb0d0('0x22')](function(_0x527fd4){if(_0x527fd4&&_0x527fd4[_0xb0d0('0xdc')]&&_0x47b449[_0xb0d0('0xdd')]){var _0x9b420b={'tls':{'rejectUnauthorized':![]}};if(_0x527fd4[_0xb0d0('0xdc')][_0xb0d0('0xde')]){_0x9b420b[_0xb0d0('0xde')]=_0x527fd4[_0xb0d0('0xdc')][_0xb0d0('0xde')];}else{_0x9b420b['host']=_0x527fd4['Smtp']['host'];_0x9b420b[_0xb0d0('0xdf')]=_0x527fd4[_0xb0d0('0xdc')][_0xb0d0('0xdf')];_0x9b420b['secure']=_0x527fd4[_0xb0d0('0xdc')][_0xb0d0('0xe0')];}if(_0x527fd4[_0xb0d0('0xdc')][_0xb0d0('0xe1')]){_0x9b420b[_0xb0d0('0xe2')]={'user':_0x527fd4[_0xb0d0('0xdc')][_0xb0d0('0x56')],'pass':_0x527fd4['Smtp'][_0xb0d0('0xe3')]};}return respondWithRpcPromise(_0xb0d0('0xe4'),_0xb0d0('0xe5'),{'account':_0x9b420b,'message':{'from':util['format'](_0xb0d0('0xe6'),_0x527fd4['name'],_0x527fd4['email']||_0x527fd4[_0xb0d0('0xdc')][_0xb0d0('0x56')]),'to':_0x47b449[_0xb0d0('0xdd')],'subject':_0x47b449[_0xb0d0('0xe7')],'text':_0x1dc1b2[_0xb0d0('0x55')]}},client9003)['then'](function(){return _0x1dc1b2;})[_0xb0d0('0x4f')](function(_0x595699){console[_0xb0d0('0x25')](_0x595699);});}})['then'](function(){if(_0x1dc1b2){return _0x1dc1b2;}})['then'](respondWithResult(_0x24b9eb,null))[_0xb0d0('0x4f')](handleError(_0x24b9eb,null));};exports['addInteraction']=function(_0x25b62f,_0x43b5ed,_0x15573d){return db[_0xb0d0('0xba')][_0xb0d0('0x5d')]({'where':{'id':_0x25b62f[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x43b5ed,null))[_0xb0d0('0x22')](function(_0x16c60c){if(_0x16c60c){return _0x16c60c['addInteraction'](_0x25b62f['body']['ids'],_[_0xb0d0('0xe8')](_0x25b62f[_0xb0d0('0x55')],[_0xb0d0('0xe9'),'id'])||{});}})['then'](respondWithResult(_0x43b5ed,null))[_0xb0d0('0x4f')](handleError(_0x43b5ed,null));};exports[_0xb0d0('0xea')]=function(_0x1f79ca,_0x4d9163,_0x200169){var _0x302576={'raw':![],'where':{}};var _0x418eca={};var _0x2944f1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb0d0('0x6a')]({'where':{'id':_0x1f79ca['params']['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x4d9163,null))[_0xb0d0('0x22')](function(_0x581fff){if(_0x581fff){_0x418eca[_0xb0d0('0x3b')]=_[_0xb0d0('0x3c')](db[_0xb0d0('0xba')][_0xb0d0('0x52')]);_0x418eca[_0xb0d0('0x3d')]=_[_0xb0d0('0x3c')](_0x1f79ca[_0xb0d0('0x3d')]);_0x418eca[_0xb0d0('0x3e')]=_[_0xb0d0('0x3f')](_0x418eca[_0xb0d0('0x3b')],_0x418eca[_0xb0d0('0x3d')]);_0x302576[_0xb0d0('0x53')]=_[_0xb0d0('0x3f')](_0x418eca[_0xb0d0('0x3b')],qs[_0xb0d0('0x40')](_0x1f79ca[_0xb0d0('0x3d')]['fields']));_0x302576[_0xb0d0('0x53')]=_0x302576['attributes'][_0xb0d0('0x41')]?_0x302576[_0xb0d0('0x53')]:_0x418eca[_0xb0d0('0x3b')];if(!_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0x42')](_0xb0d0('0x63'))){_0x302576[_0xb0d0('0x30')]=qs[_0xb0d0('0x30')](_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0x30')]);_0x302576['offset']=qs[_0xb0d0('0x2f')](_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0x2f')]);}_0x302576[_0xb0d0('0x64')]=qs[_0xb0d0('0x43')](_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0x43')]);_0x302576[_0xb0d0('0x46')]=qs[_0xb0d0('0x3e')](_[_0xb0d0('0x44')](_0x1f79ca[_0xb0d0('0x3d')],_0x418eca[_0xb0d0('0x3e')]));_0x302576[_0xb0d0('0x46')][_0xb0d0('0x60')]=_0x581fff['id'];if(_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0x45')]){_0x302576[_0xb0d0('0x46')]=_[_0xb0d0('0x47')](_0x302576[_0xb0d0('0x46')],{'$or':_['map'](_0x302576[_0xb0d0('0x53')],function(_0x12506a){var _0x3642f9={};_0x3642f9[_0x12506a]={'$like':'%'+_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0x45')]+'%'};return _0x3642f9;})});}_0x302576=_['merge']({},_0x302576,_0x1f79ca['options']);return db[_0xb0d0('0xba')][_0xb0d0('0x2e')]({'where':_0x302576[_0xb0d0('0x46')]})['then'](function(_0x15ef5c){_0x2944f1[_0xb0d0('0x2e')]=_0x15ef5c;if(_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0x4c')]){_0x302576['include']=[{'model':db[_0xb0d0('0x8c')],'as':_0xb0d0('0xeb'),'required':![]},{'model':db['User'],'as':_0xb0d0('0xec'),'attributes':[_0xb0d0('0x38'),_0xb0d0('0xed'),_0xb0d0('0xee')],'required':![]},{'model':db[_0xb0d0('0xef')],'as':'Tags','attributes':['id',_0xb0d0('0x38'),_0xb0d0('0xf0')],'where':_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0xf1')]?{'id':_0x1f79ca[_0xb0d0('0x3d')][_0xb0d0('0xf1')]}:undefined,'required':_0x1f79ca[_0xb0d0('0x3d')]['tag']?!![]:![]}];}return db[_0xb0d0('0xba')][_0xb0d0('0x65')](_0x302576);})['then'](function(_0x4377db){_0x2944f1['rows']=_0x4377db;return _0x2944f1;});}})['then'](respondWithFilteredResult(_0x4d9163,_0x302576))[_0xb0d0('0x4f')](handleError(_0x4d9163,null));};function iftimePromise(_0x46ff91,_0x17b7d7){return respondWithRpcPromise(_0xb0d0('0xf2'),'getSnippet',{'command':_0x17b7d7[_0xb0d0('0xf3')]?util[_0xb0d0('0xb1')](_0xb0d0('0xf4'),_0x46ff91[_0xb0d0('0xf5')],_0x17b7d7[_0xb0d0('0xf3')]):util['format'](_0xb0d0('0xf6'),_0x46ff91['interval'])},client9002)[_0xb0d0('0x22')](function(_0x25e09e){var _0x25a9fb=_0x25e09e&&_0x25e09e[_0xb0d0('0xf7')](_0xb0d0('0xf8'))>=0x0?!![]:![];logger[_0xb0d0('0x28')](_0xb0d0('0xf9'),_0x17b7d7['id'],_0x46ff91['id'],_0x46ff91[_0xb0d0('0xf5')],_0x25a9fb?_0xb0d0('0xfa'):_0xb0d0('0xfb'),_0x17b7d7['timezone']?_0x17b7d7[_0xb0d0('0xf3')]:_0xb0d0('0xfc'));return _0x25a9fb;})[_0xb0d0('0x4f')](function(_0x569f73){logger[_0xb0d0('0x25')](_0xb0d0('0xf9'),_0x17b7d7['id'],_0x46ff91['id'],_0x46ff91[_0xb0d0('0xf5')],util[_0xb0d0('0xfd')](_0x569f73,{'showHidden':![],'depth':null}),_0x17b7d7[_0xb0d0('0xf3')]?_0x17b7d7[_0xb0d0('0xf3')]:_0xb0d0('0xfc'));return![];});}exports['getSnippet']=function(_0x47ec86,_0x1d25e9,_0xcd2981){var _0x3368b2=0x0;var _0x5a5b8f=0x0;var _0x5b0e0e=![];var _0x1bb49c;var _0x3b638b;return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'where':{'id':_0x47ec86[_0xb0d0('0x5e')]['id']},'include':[{'model':db[_0xb0d0('0xfe')],'as':_0xb0d0('0xfe'),'include':[{'model':db[_0xb0d0('0xfe')],'as':'Intervals','attributes':['id',_0xb0d0('0xf5')],'raw':!![]}]}]})[_0xb0d0('0x22')](handleEntityNotFound(_0x1d25e9,null))[_0xb0d0('0x22')](function(_0xbd8bee){if(_0xbd8bee){_0x1bb49c=_0xbd8bee;return _0xbd8bee[_0xb0d0('0xff')]({'raw':!![]});}})[_0xb0d0('0x22')](function(_0x2a5ced){if(_0x1bb49c){if(_0x2a5ced){_0x3b638b=_0x2a5ced;}}return require('../../config/license/util')[_0xb0d0('0x100')]();})[_0xb0d0('0x22')](function(_0x549ad6){if(_0x549ad6){_0x5a5b8f=_0x549ad6[_0xb0d0('0x101')];_0x5b0e0e=_0x549ad6[_0xb0d0('0x79')];}})[_0xb0d0('0x22')](function(){return db['ChatInteraction'][_0xb0d0('0x2e')]({'where':{'closed':![]}});})['then'](function(_0x16f638){_0x3368b2=_0x16f638;if(_0x5a5b8f&&_0x16f638>_0x5a5b8f){return db[_0xb0d0('0x102')]['findOne']({'where':{'id':0x1}})[_0xb0d0('0x22')](function(_0x3b4c41){if(_0x3b4c41){_0x3b4c41[_0xb0d0('0x103')](_0xb0d0('0x104'));}});}})['then'](function(){if(_0x1bb49c[_0xb0d0('0xfe')]&&_0x1bb49c[_0xb0d0('0xfe')][_0xb0d0('0x105')]){var _0x2ec439=[];for(var _0x4166ba=0x0;_0x4166ba<_0x1bb49c[_0xb0d0('0xfe')][_0xb0d0('0x105')][_0xb0d0('0x41')];_0x4166ba++){var _0x104d44=_0x1bb49c['Interval'][_0xb0d0('0x105')][_0x4166ba][_0xb0d0('0x57')]({'plain':!![]});_0x2ec439[_0xb0d0('0x106')](iftimePromise(_0x104d44,_0x1bb49c));}return BPromise[_0xb0d0('0x107')](_0x2ec439)[_0xb0d0('0x22')](function(_0x309c22){return _[_0xb0d0('0x108')](_0x309c22);});}else{return!![];}})[_0xb0d0('0x22')](function(_0x3ddee0){var _0x3e465d=fs[_0xb0d0('0xd3')](path[_0xb0d0('0x76')](config[_0xb0d0('0x7b')],_0xb0d0('0x109')),_0xb0d0('0xd5'));var _0x2bea34={'remote':_0x1bb49c[_0xb0d0('0x10a')],'query':querystring[_0xb0d0('0xb7')](_['merge'](_0x1bb49c[_0xb0d0('0x57')]({'plain':!![]}),{'customerIp':_0x47ec86[_0xb0d0('0x89')][_0xb0d0('0xa8')]||_0x47ec86[_0xb0d0('0x89')]['x-real-ip']||_0x47ec86[_0xb0d0('0x10b')]['remoteAddress']||_0x47ec86['ip'],'referer':_0x47ec86['headers'][_0xb0d0('0xae')],'openedInteractions':_0x3368b2,'maxInteractions':_0x5a5b8f,'virtual':_0x5b0e0e[_0xb0d0('0x101')],'online':_0x3ddee0,'custom':_0x5b0e0e}))[_0xb0d0('0x10c')](/'/g,'\x5c\x27')};_0x1d25e9[_0xb0d0('0xce')](ejs['render'](Mustache['render'](_0x3e465d,_0x2bea34),{'proactiveActions':_0x3b638b,'alignment':_0x1bb49c[_0xb0d0('0x10d')],'verticalAlignment':_0x1bb49c[_0xb0d0('0x10e')]}));})[_0xb0d0('0x4f')](handleError(_0x1d25e9,null));};exports[_0xb0d0('0x10f')]=function(_0x2fa691,_0x2e131d,_0x404b9d){return db['ChatWebsite'][_0xb0d0('0x6a')]({'where':{'id':_0x2fa691[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x2e131d,null))['then'](function(_0x319fb7){if(_0x319fb7){return db[_0xb0d0('0x110')][_0xb0d0('0x111')](function(_0x444d93){return db[_0xb0d0('0x9c')][_0xb0d0('0x34')]({'where':{'ChatWebsiteId':_0x2fa691['params']['id']},'transaction':_0x444d93})[_0xb0d0('0x22')](function(_0x14d332){var _0x5cd17c=_[_0xb0d0('0x48')](_0x2fa691[_0xb0d0('0x55')],function(_0x5a0456){_0x5a0456[_0xb0d0('0x60')]=_0x2fa691['params']['id'];return _0x5a0456;});return db[_0xb0d0('0x9c')][_0xb0d0('0x112')](_0x5cd17c,{'transaction':_0x444d93});});})[_0xb0d0('0x22')](function(){return db[_0xb0d0('0x9c')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x2fa691['params']['id']},'order':_0xb0d0('0xa1')});});}})[_0xb0d0('0x22')](respondWithResult(_0x2e131d,null))[_0xb0d0('0x4f')](handleError(_0x2e131d,null));};exports[_0xb0d0('0x113')]=function(_0x288097,_0x385011,_0x93db15){var _0x756145={};var _0xa69a57={};var _0x1d304e;var _0x2e9689;return db[_0xb0d0('0x3a')][_0xb0d0('0x6a')]({'where':{'id':_0x288097[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x385011,null))[_0xb0d0('0x22')](function(_0x4707ef){if(_0x4707ef){_0x1d304e=_0x4707ef;_0xa69a57['model']=_['keys'](db['ChatApplication'][_0xb0d0('0x52')]);_0xa69a57[_0xb0d0('0x3d')]=_[_0xb0d0('0x3c')](_0x288097[_0xb0d0('0x3d')]);_0xa69a57[_0xb0d0('0x3e')]=_[_0xb0d0('0x3f')](_0xa69a57[_0xb0d0('0x3b')],_0xa69a57['query']);_0x756145[_0xb0d0('0x53')]=_[_0xb0d0('0x3f')](_0xa69a57['model'],qs['fields'](_0x288097[_0xb0d0('0x3d')][_0xb0d0('0x40')]));_0x756145[_0xb0d0('0x53')]=_0x756145[_0xb0d0('0x53')][_0xb0d0('0x41')]?_0x756145['attributes']:_0xa69a57[_0xb0d0('0x3b')];_0x756145[_0xb0d0('0x64')]=qs[_0xb0d0('0x43')](_0x288097[_0xb0d0('0x3d')][_0xb0d0('0x43')]);_0x756145[_0xb0d0('0x46')]=qs[_0xb0d0('0x3e')](_[_0xb0d0('0x44')](_0x288097[_0xb0d0('0x3d')],_0xa69a57['filters']));if(_0x288097['query'][_0xb0d0('0x45')]){_0x756145[_0xb0d0('0x46')]=_[_0xb0d0('0x47')](_0x756145[_0xb0d0('0x46')],{'$or':_[_0xb0d0('0x48')](_0x756145['attributes'],function(_0x4748a0){var _0x51d331={};_0x51d331[_0x4748a0]={'$like':'%'+_0x288097[_0xb0d0('0x3d')]['filter']+'%'};return _0x51d331;})});}_0x756145=_[_0xb0d0('0x47')]({},_0x756145,_0x288097[_0xb0d0('0x4b')]);return _0x1d304e[_0xb0d0('0x113')](_0x756145);}})[_0xb0d0('0x22')](function(_0xda94d2){if(_0xda94d2){_0x2e9689=_0xda94d2[_0xb0d0('0x41')];if(!_0x288097['query'][_0xb0d0('0x42')]('nolimit')){_0x756145[_0xb0d0('0x30')]=qs[_0xb0d0('0x30')](_0x288097['query'][_0xb0d0('0x30')]);_0x756145[_0xb0d0('0x2f')]=qs[_0xb0d0('0x2f')](_0x288097['query'][_0xb0d0('0x2f')]);}return _0x1d304e[_0xb0d0('0x113')](_0x756145);}})[_0xb0d0('0x22')](function(_0x2992bb){if(_0x2992bb){return _0x2992bb?{'count':_0x2e9689,'rows':_0x2992bb}:null;}})['then'](respondWithResult(_0x385011,null))[_0xb0d0('0x4f')](handleError(_0x385011,null));};exports[_0xb0d0('0x114')]=function(_0x522f19,_0x575bf8,_0xe3a9f1){return db[_0xb0d0('0x115')][_0xb0d0('0x5d')]({'where':{'id':_0x522f19['params']['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x575bf8,null))[_0xb0d0('0x22')](function(_0x4a6954){if(_0x4a6954){return _0x4a6954[_0xb0d0('0x114')](_0x522f19[_0xb0d0('0x55')]['ids'],_[_0xb0d0('0xe8')](_0x522f19[_0xb0d0('0x55')],[_0xb0d0('0xe9'),'id'])||{});}})[_0xb0d0('0x22')](respondWithResult(_0x575bf8,null))[_0xb0d0('0x4f')](handleError(_0x575bf8,null));};exports['getProactiveActions']=function(_0xa33f3d,_0x1b7eed,_0x2beae3){var _0x39b1d1={};var _0x2da727={};var _0x5c3146;var _0xbd365b;return db[_0xb0d0('0x3a')][_0xb0d0('0x6a')]({'where':{'id':_0xa33f3d[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x1b7eed,null))[_0xb0d0('0x22')](function(_0x29e95d){if(_0x29e95d){_0x5c3146=_0x29e95d;_0x2da727['model']=_[_0xb0d0('0x3c')](db[_0xb0d0('0x116')][_0xb0d0('0x52')]);_0x2da727['query']=_[_0xb0d0('0x3c')](_0xa33f3d[_0xb0d0('0x3d')]);_0x2da727[_0xb0d0('0x3e')]=_[_0xb0d0('0x3f')](_0x2da727[_0xb0d0('0x3b')],_0x2da727[_0xb0d0('0x3d')]);_0x39b1d1[_0xb0d0('0x53')]=_[_0xb0d0('0x3f')](_0x2da727['model'],qs[_0xb0d0('0x40')](_0xa33f3d[_0xb0d0('0x3d')][_0xb0d0('0x40')]));_0x39b1d1[_0xb0d0('0x53')]=_0x39b1d1[_0xb0d0('0x53')]['length']?_0x39b1d1['attributes']:_0x2da727[_0xb0d0('0x3b')];_0x39b1d1[_0xb0d0('0x64')]=qs[_0xb0d0('0x43')](_0xa33f3d[_0xb0d0('0x3d')][_0xb0d0('0x43')]);_0x39b1d1['where']=qs['filters'](_[_0xb0d0('0x44')](_0xa33f3d[_0xb0d0('0x3d')],_0x2da727['filters']));if(_0xa33f3d[_0xb0d0('0x3d')][_0xb0d0('0x45')]){_0x39b1d1['where']=_[_0xb0d0('0x47')](_0x39b1d1['where'],{'$or':_['map'](_0x39b1d1[_0xb0d0('0x53')],function(_0x1328bf){var _0x46175a={};_0x46175a[_0x1328bf]={'$like':'%'+_0xa33f3d[_0xb0d0('0x3d')]['filter']+'%'};return _0x46175a;})});}_0x39b1d1=_['merge']({},_0x39b1d1,_0xa33f3d[_0xb0d0('0x4b')]);return _0x5c3146[_0xb0d0('0xff')](_0x39b1d1);}})[_0xb0d0('0x22')](function(_0x3ec3ff){if(_0x3ec3ff){_0xbd365b=_0x3ec3ff['length'];if(!_0xa33f3d[_0xb0d0('0x3d')][_0xb0d0('0x42')](_0xb0d0('0x63'))){_0x39b1d1[_0xb0d0('0x30')]=qs[_0xb0d0('0x30')](_0xa33f3d[_0xb0d0('0x3d')][_0xb0d0('0x30')]);_0x39b1d1['offset']=qs[_0xb0d0('0x2f')](_0xa33f3d[_0xb0d0('0x3d')]['offset']);}return _0x5c3146[_0xb0d0('0xff')](_0x39b1d1);}})[_0xb0d0('0x22')](function(_0xd5ef73){if(_0xd5ef73){return _0xd5ef73?{'count':_0xbd365b,'rows':_0xd5ef73}:null;}})[_0xb0d0('0x22')](respondWithResult(_0x1b7eed,null))['catch'](handleError(_0x1b7eed,null));};exports[_0xb0d0('0x117')]=function(_0x147c14,_0x47c0bd,_0x28e4a7){var _0x57a9be=_0x147c14[_0xb0d0('0x3d')]['online']===_0xb0d0('0x118')?_0xb0d0('0x119'):_0xb0d0('0x11a');return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'attributes':['id',_0x57a9be],'where':{'id':_0x147c14[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x47c0bd,null))[_0xb0d0('0x22')](function(_0x10325d){if(_0x10325d){var _0x276876=_0x10325d[_0x57a9be];var _0x1b3521=_0x276876&&_0x276876[_0xb0d0('0x11b')]?_0x276876['items']:[];_0x47c0bd[_0xb0d0('0xce')]({'fromKey':_[_0xb0d0('0x80')](_0x276876[_0xb0d0('0x11c')])?undefined:_0x276876[_0xb0d0('0x11c')],'count':_0x1b3521[_0xb0d0('0x41')],'rows':_0x1b3521});}})[_0xb0d0('0x4f')](handleError(_0x47c0bd,null));};exports['getOfflineMessages']=function(_0x30bf50,_0x76dbf8,_0x1a2b00){var _0x3fe792={'raw':!![],'where':{}};var _0x379624={};var _0x5531bb={'count':0x0,'rows':[]};return db[_0xb0d0('0x3a')][_0xb0d0('0x6a')]({'where':{'id':_0x30bf50[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x76dbf8,null))[_0xb0d0('0x22')](function(_0x30cd30){if(_0x30cd30){_0x379624[_0xb0d0('0x3b')]=_['keys'](db[_0xb0d0('0xd9')][_0xb0d0('0x52')]);_0x379624['query']=_[_0xb0d0('0x3c')](_0x30bf50['query']);_0x379624['filters']=_[_0xb0d0('0x3f')](_0x379624[_0xb0d0('0x3b')],_0x379624[_0xb0d0('0x3d')]);_0x3fe792[_0xb0d0('0x53')]=_[_0xb0d0('0x3f')](_0x379624[_0xb0d0('0x3b')],qs['fields'](_0x30bf50[_0xb0d0('0x3d')][_0xb0d0('0x40')]));_0x3fe792['attributes']=_0x3fe792[_0xb0d0('0x53')][_0xb0d0('0x41')]?_0x3fe792[_0xb0d0('0x53')]:_0x379624[_0xb0d0('0x3b')];if(!_0x30bf50[_0xb0d0('0x3d')]['hasOwnProperty'](_0xb0d0('0x63'))){_0x3fe792[_0xb0d0('0x30')]=qs[_0xb0d0('0x30')](_0x30bf50[_0xb0d0('0x3d')][_0xb0d0('0x30')]);_0x3fe792['offset']=qs[_0xb0d0('0x2f')](_0x30bf50[_0xb0d0('0x3d')]['offset']);}_0x3fe792[_0xb0d0('0x64')]=qs['sort'](_0x30bf50[_0xb0d0('0x3d')][_0xb0d0('0x43')]);_0x3fe792[_0xb0d0('0x46')]=qs[_0xb0d0('0x3e')](_[_0xb0d0('0x44')](_0x30bf50[_0xb0d0('0x3d')],_0x379624[_0xb0d0('0x3e')]));_0x3fe792[_0xb0d0('0x46')][_0xb0d0('0x60')]=_0x30cd30['id'];if(_0x30bf50[_0xb0d0('0x3d')][_0xb0d0('0x45')]){_0x3fe792[_0xb0d0('0x46')]=_[_0xb0d0('0x47')](_0x3fe792[_0xb0d0('0x46')],{'$or':_[_0xb0d0('0x48')](_0x3fe792[_0xb0d0('0x53')],function(_0x59be3a){var _0x3f8cbd={};_0x3f8cbd[_0x59be3a]={'$like':'%'+_0x30bf50['query'][_0xb0d0('0x45')]+'%'};return _0x3f8cbd;})});}_0x3fe792=_[_0xb0d0('0x47')]({},_0x3fe792,_0x30bf50[_0xb0d0('0x4b')]);return db[_0xb0d0('0xd9')][_0xb0d0('0x2e')]({'where':_0x3fe792['where']})[_0xb0d0('0x22')](function(_0x353b52){_0x5531bb[_0xb0d0('0x2e')]=_0x353b52;if(_0x30bf50[_0xb0d0('0x3d')][_0xb0d0('0x4c')]){_0x3fe792[_0xb0d0('0x4d')]=[{'all':!![]}];}return db[_0xb0d0('0xd9')][_0xb0d0('0x65')](_0x3fe792);})[_0xb0d0('0x22')](function(_0x53c614){_0x5531bb['rows']=_0x53c614;return _0x5531bb;});}})['then'](respondWithFilteredResult(_0x76dbf8,_0x3fe792))[_0xb0d0('0x4f')](handleError(_0x76dbf8,null));};exports[_0xb0d0('0x11d')]=function(_0x3c61e5,_0x1db50d,_0x32e8a6){return db['ChatWebsite'][_0xb0d0('0x5d')]({'where':{'id':_0x3c61e5['params']['id']}})['then'](handleEntityNotFound(_0x1db50d,null))['then'](function(_0x5fffe1){if(_0x5fffe1){return _0x5fffe1['addAgents'](_0x3c61e5[_0xb0d0('0x55')][_0xb0d0('0xe9')],_[_0xb0d0('0xe8')](_0x3c61e5[_0xb0d0('0x55')],[_0xb0d0('0xe9'),'id'])||{})[_0xb0d0('0xbd')](function(_0x44ba6e){for(var _0x5be50f=0x0;_0x5be50f<_0x3c61e5['body'][_0xb0d0('0xe9')][_0xb0d0('0x41')];_0x5be50f+=0x1){socket[_0xb0d0('0x11e')](_0xb0d0('0x11f'),{'UserId':_0x3c61e5[_0xb0d0('0x55')][_0xb0d0('0xe9')][_0x5be50f],'ChatWebsiteId':_0x3c61e5[_0xb0d0('0x5e')]['id']});}return _0x44ba6e;});}})[_0xb0d0('0x22')](respondWithResult(_0x1db50d,null))[_0xb0d0('0x4f')](handleError(_0x1db50d,null));};exports['removeAgents']=function(_0x44e961,_0xc322ef,_0xb6dc0a){return db[_0xb0d0('0x3a')][_0xb0d0('0x5d')]({'where':{'id':_0x44e961[_0xb0d0('0x5e')]['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0xc322ef,null))[_0xb0d0('0x22')](function(_0x51eff0){if(_0x51eff0){return _0x51eff0[_0xb0d0('0x120')](_0x44e961[_0xb0d0('0x3d')][_0xb0d0('0xe9')])[_0xb0d0('0x22')](function(){if(_[_0xb0d0('0x121')](_0x44e961[_0xb0d0('0x3d')][_0xb0d0('0xe9')])){for(var _0x53c187=0x0;_0x53c187<_0x44e961[_0xb0d0('0x3d')][_0xb0d0('0xe9')]['length'];_0x53c187+=0x1){socket[_0xb0d0('0x11e')]('userChatWebsite:remove',{'UserId':Number(_0x44e961['query'][_0xb0d0('0xe9')][_0x53c187]),'ChatWebsiteId':Number(_0x44e961[_0xb0d0('0x5e')]['id'])});}}else{socket[_0xb0d0('0x11e')](_0xb0d0('0x122'),{'UserId':Number(_0x44e961[_0xb0d0('0x3d')][_0xb0d0('0xe9')]),'ChatWebsiteId':Number(_0x44e961['params']['id'])});}});}})['then'](respondWithStatusCode(_0xc322ef,null))[_0xb0d0('0x4f')](handleError(_0xc322ef,null));};exports[_0xb0d0('0x123')]=function(_0x173123,_0x1123dc,_0x16d629){var _0x507104={};var _0x51d8fd={};var _0x11a128;var _0x4b175c;return db[_0xb0d0('0x3a')][_0xb0d0('0x6a')]({'where':{'id':_0x173123['params']['id']}})[_0xb0d0('0x22')](handleEntityNotFound(_0x1123dc,null))['then'](function(_0x3c71c1){if(_0x3c71c1){_0x11a128=_0x3c71c1;_0x51d8fd[_0xb0d0('0x3b')]=_[_0xb0d0('0x3c')](db['User'][_0xb0d0('0x52')]);_0x51d8fd[_0xb0d0('0x3d')]=_[_0xb0d0('0x3c')](_0x173123['query']);_0x51d8fd['filters']=_['intersection'](_0x51d8fd[_0xb0d0('0x3b')],_0x51d8fd[_0xb0d0('0x3d')]);_0x507104[_0xb0d0('0x53')]=_[_0xb0d0('0x3f')](_0x51d8fd[_0xb0d0('0x3b')],qs[_0xb0d0('0x40')](_0x173123[_0xb0d0('0x3d')][_0xb0d0('0x40')]));_0x507104['attributes']=_0x507104['attributes'][_0xb0d0('0x41')]?_0x507104[_0xb0d0('0x53')]:_0x51d8fd[_0xb0d0('0x3b')];_0x507104[_0xb0d0('0x64')]=qs[_0xb0d0('0x43')](_0x173123[_0xb0d0('0x3d')][_0xb0d0('0x43')]);_0x507104[_0xb0d0('0x46')]=qs[_0xb0d0('0x3e')](_[_0xb0d0('0x44')](_0x173123[_0xb0d0('0x3d')],_0x51d8fd[_0xb0d0('0x3e')]));if(_0x173123[_0xb0d0('0x3d')][_0xb0d0('0x45')]){_0x507104[_0xb0d0('0x46')]=_[_0xb0d0('0x47')](_0x507104['where'],{'$or':_[_0xb0d0('0x48')](_0x507104[_0xb0d0('0x53')],function(_0x2d0593){var _0x4464a1={};_0x4464a1[_0x2d0593]={'$like':'%'+_0x173123['query'][_0xb0d0('0x45')]+'%'};return _0x4464a1;})});}_0x507104=_['merge']({},_0x507104,_0x173123['options']);return _0x11a128['getAgents'](_0x507104);}})[_0xb0d0('0x22')](function(_0x58389a){if(_0x58389a){_0x4b175c=_0x58389a[_0xb0d0('0x41')];if(!_0x173123[_0xb0d0('0x3d')][_0xb0d0('0x42')](_0xb0d0('0x63'))){_0x507104['limit']=qs[_0xb0d0('0x30')](_0x173123[_0xb0d0('0x3d')][_0xb0d0('0x30')]);_0x507104[_0xb0d0('0x2f')]=qs['offset'](_0x173123['query'][_0xb0d0('0x2f')]);}return _0x11a128[_0xb0d0('0x123')](_0x507104);}})[_0xb0d0('0x22')](function(_0xbf6cc5){if(_0xbf6cc5){return _0xbf6cc5?{'count':_0x4b175c,'rows':_0xbf6cc5}:null;}})[_0xb0d0('0x22')](respondWithResult(_0x1123dc,null))[_0xb0d0('0x4f')](handleError(_0x1123dc,null));}; \ No newline at end of file +var _0x0ab2=['server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','Applications','account','List','orderBy','applications','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','unknown','device','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','ListId','send','mapKeyOffline','includes','findOrCreate','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','getSnippet','Interval','virtual','custom','License','increment','chatLicenseExceeded','Intervals','all','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','alignment','transaction','ChatApplication','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','redis','./chatWebsite.socket','register','jayson/promise','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','json','count','offset','set','apply','reject','save','update','ChatWebsites','destroy','sendStatus','name','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','type','key','VIRTUAL','field','merge','includeAll','include','findAll','rows','show','fields','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','ChatWebsiteId','Disposition','getDispositions','findOne','ids','addAnswer','CannedAnswer','pick','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','systemAvatar','getLogo','../../config/license/util','getLicense','isNil','existsSync','root','server/files/images/logos/','join','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar'];(function(_0x506f64,_0x395f5a){var _0x389fdb=function(_0x3cf504){while(--_0x3cf504){_0x506f64['push'](_0x506f64['shift']());}};_0x389fdb(++_0x395f5a);}(_0x0ab2,0x92));var _0x20ab=function(_0xfeccd6,_0x2a5806){_0xfeccd6=_0xfeccd6-0x0;var _0x16a1f2=_0x0ab2[_0xfeccd6];return _0x16a1f2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x20ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20ab('0x1'));var rp=require(_0x20ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x20ab('0x3'));var util=require('util');var path=require(_0x20ab('0x4'));var sox=require('sox');var csv=require(_0x20ab('0x5'));var ejs=require(_0x20ab('0x6'));var fs=require('fs');var _=require(_0x20ab('0x7'));var squel=require(_0x20ab('0x8'));var crypto=require(_0x20ab('0x9'));var jsforce=require(_0x20ab('0xa'));var deskjs=require(_0x20ab('0xb'));var toCsv=require(_0x20ab('0x5'));var querystring=require(_0x20ab('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x20ab('0xd'));var logger=require(_0x20ab('0xe'))(_0x20ab('0xf'));var utils=require(_0x20ab('0x10'));var config=require('../../config/environment');var db=require(_0x20ab('0x11'))['db'];config['redis']=_[_0x20ab('0x12')](config['redis'],{'host':_0x20ab('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20ab('0x14')]));require(_0x20ab('0x15'))[_0x20ab('0x16')](socket);var jayson=require(_0x20ab('0x17'));var client=jayson['client'][_0x20ab('0x18')]({'port':0x232c});var client9002=jayson[_0x20ab('0x19')][_0x20ab('0x18')]({'port':0x232a});var client9003=jayson[_0x20ab('0x19')]['http']({'port':0x232b});function checkPasswordPattern(_0x23618e,_0x305d1e,_0x29f882){if(_0x29f882){var _0x2c550f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c550f['test'](_0x305d1e)){return _0x23618e;}else{throw new db[(_0x20ab('0x1a'))][(_0x20ab('0x1b'))](_0x20ab('0x1c'));}}else{return _0x23618e;}}function respondWithRpcPromise(_0x732ca7,_0x4559fb,_0x95dff2,_0x57309a){return new BPromise(function(_0x545d14,_0xa347ce){var _0x39bf0e=_0x57309a||client;return _0x39bf0e[_0x20ab('0x1d')](_0x732ca7,_0x95dff2)[_0x20ab('0x1e')](function(_0xb6d8c7){logger[_0x20ab('0x1f')](_0x20ab('0x20'),_0x4559fb,_0x20ab('0x21'));logger[_0x20ab('0x22')](_0x20ab('0x23'),_0x4559fb,_0x20ab('0x21'),JSON[_0x20ab('0x24')](_0xb6d8c7));if(_0xb6d8c7['error']){if(_0xb6d8c7['error'][_0x20ab('0x25')]===0x1f4){logger[_0x20ab('0x26')](_0x20ab('0x20'),_0x4559fb,_0xb6d8c7['error'][_0x20ab('0x27')]);return _0xa347ce(_0xb6d8c7[_0x20ab('0x26')][_0x20ab('0x27')]);}logger['error'](_0x20ab('0x20'),_0x4559fb,_0xb6d8c7[_0x20ab('0x26')][_0x20ab('0x27')]);return _0x545d14(_0xb6d8c7[_0x20ab('0x26')][_0x20ab('0x27')]);}else{logger['info'](_0x20ab('0x20'),_0x4559fb,'request\x20sent');_0x545d14(_0xb6d8c7[_0x20ab('0x28')][_0x20ab('0x27')]);}})[_0x20ab('0x29')](function(_0x27432a){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4559fb,_0x27432a);_0xa347ce(_0x27432a);});});}function respondWithStatusCode(_0x2f7605,_0x30dde8){_0x30dde8=_0x30dde8||0xcc;return function(_0x3a025d){if(_0x3a025d){return _0x2f7605['sendStatus'](_0x30dde8);}return _0x2f7605[_0x20ab('0x2a')](_0x30dde8)[_0x20ab('0x2b')]();};}function respondWithResult(_0x3d8468,_0x229278){_0x229278=_0x229278||0xc8;return function(_0x1f41db){if(_0x1f41db){return _0x3d8468[_0x20ab('0x2a')](_0x229278)[_0x20ab('0x2c')](_0x1f41db);}};}function respondWithFilteredResult(_0x3b33ae,_0x4d4a79){return function(_0x1e70e8){if(_0x1e70e8){var _0x3ce672=_0x1e70e8[_0x20ab('0x2d')],_0x5bf2af=_0x4d4a79[_0x20ab('0x2e')],_0x3a90b8=_0x4d4a79[_0x20ab('0x2e')]+_0x4d4a79['limit'],_0x247257;if(_0x3a90b8>=_0x3ce672){_0x3a90b8=_0x3ce672;_0x247257=0xc8;}else{_0x247257=0xce;}_0x3b33ae[_0x20ab('0x2a')](_0x247257);return _0x3b33ae[_0x20ab('0x2f')]('Content-Range',_0x5bf2af+'-'+_0x3a90b8+'/'+_0x3ce672)[_0x20ab('0x2c')](_0x1e70e8);}return null;};}function patchUpdates(_0x31e364){return function(_0x5ac020){try{jsonpatch[_0x20ab('0x30')](_0x5ac020,_0x31e364,!![]);}catch(_0x4bfed1){return BPromise[_0x20ab('0x31')](_0x4bfed1);}return _0x5ac020[_0x20ab('0x32')]();};}function saveUpdates(_0xf1f956,_0x5b3cc9){return function(_0x48ae0d){if(_0x48ae0d){return _0x48ae0d[_0x20ab('0x33')](_0xf1f956)['then'](function(_0x135cc7){return _0x135cc7;});}return null;};}function removeEntity(_0x58f0dc,_0x59af5b){return function(_0xd633a5){if(_0xd633a5){return _0xd633a5['destroy']()['then'](function(){var _0x54c114=_0xd633a5['get']({'plain':!![]});var _0x382ab0=_0x20ab('0x34');return db['UserProfileResource'][_0x20ab('0x35')]({'where':{'type':_0x382ab0,'resourceId':_0x54c114['id']}})['then'](function(){return _0xd633a5;});})[_0x20ab('0x1e')](function(){_0x58f0dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19259f,_0x1b46de){return function(_0x4a537c){if(!_0x4a537c){_0x19259f[_0x20ab('0x36')](0x194);}return _0x4a537c;};}function handleError(_0x3091e9,_0x2f08cc){_0x2f08cc=_0x2f08cc||0x1f4;return function(_0x3dc9e1){logger[_0x20ab('0x26')](_0x3dc9e1['stack']);if(_0x3dc9e1[_0x20ab('0x37')]){delete _0x3dc9e1['name'];}_0x3091e9[_0x20ab('0x2a')](_0x2f08cc)['send'](_0x3dc9e1);};}exports[_0x20ab('0x38')]=function(_0x3c0822,_0x338e26){var _0x3d54b6={'include':[{'model':db[_0x20ab('0x39')],'as':_0x20ab('0x3a')}]},_0x239346={},_0x4bd478={'count':0x0,'rows':[]};var _0x5d40cc=db[_0x20ab('0x3b')][_0x20ab('0x3c')];_0x239346[_0x20ab('0x3d')]=_[_0x20ab('0x3e')](_0x5d40cc);_0x239346['query']=_[_0x20ab('0x3e')](_0x3c0822[_0x20ab('0x3f')]);_0x239346[_0x20ab('0x40')]=_[_0x20ab('0x41')](_0x239346[_0x20ab('0x3d')],_0x239346['query']);_0x3d54b6['attributes']=_[_0x20ab('0x41')](_0x239346['model'],qs['fields'](_0x3c0822['query']['fields']));_0x3d54b6[_0x20ab('0x42')]=_0x3d54b6[_0x20ab('0x42')][_0x20ab('0x43')]?_0x3d54b6[_0x20ab('0x42')]:_0x239346[_0x20ab('0x3d')];if(!_0x3c0822[_0x20ab('0x3f')][_0x20ab('0x44')](_0x20ab('0x45'))){_0x3d54b6[_0x20ab('0x46')]=qs['limit'](_0x3c0822['query'][_0x20ab('0x46')]);_0x3d54b6[_0x20ab('0x2e')]=qs[_0x20ab('0x2e')](_0x3c0822[_0x20ab('0x3f')][_0x20ab('0x2e')]);}_0x3d54b6[_0x20ab('0x47')]=qs[_0x20ab('0x48')](_0x3c0822['query'][_0x20ab('0x48')]);_0x3d54b6[_0x20ab('0x49')]=qs[_0x20ab('0x40')](_['pick'](_0x3c0822[_0x20ab('0x3f')],_0x239346[_0x20ab('0x40')]));if(_0x3c0822['query'][_0x20ab('0x4a')]){_0x3d54b6[_0x20ab('0x49')]=_['merge'](_0x3d54b6[_0x20ab('0x49')],{'$or':_[_0x20ab('0x4b')](_0x5d40cc,function(_0x20f8a1){if(_0x20f8a1[_0x20ab('0x4c')][_0x20ab('0x4d')]!==_0x20ab('0x4e')){var _0x5e94ea={};_0x5e94ea[_0x20f8a1[_0x20ab('0x4f')]]={'$like':'%'+_0x3c0822[_0x20ab('0x3f')]['filter']+'%'};return _0x5e94ea;}})});}_0x3d54b6=_[_0x20ab('0x50')]({},_0x3d54b6,_0x3c0822['options']);var _0x5c15cf={'where':_0x3d54b6[_0x20ab('0x49')]};return db[_0x20ab('0x3b')][_0x20ab('0x2d')](_0x5c15cf)[_0x20ab('0x1e')](function(_0x106bb5){_0x4bd478[_0x20ab('0x2d')]=_0x106bb5;if(_0x3c0822['query'][_0x20ab('0x51')]){_0x3d54b6[_0x20ab('0x52')]=[{'all':!![]}];}return db[_0x20ab('0x3b')][_0x20ab('0x53')](_0x3d54b6);})['then'](function(_0x276b9d){_0x4bd478[_0x20ab('0x54')]=_0x276b9d;return _0x4bd478;})[_0x20ab('0x1e')](respondWithFilteredResult(_0x338e26,_0x3d54b6))[_0x20ab('0x29')](handleError(_0x338e26,null));};exports[_0x20ab('0x55')]=function(_0x5b4ae5,_0xc49670){var _0x23e37f={'raw':![],'where':{'id':_0x5b4ae5['params']['id']},'include':[{'model':db[_0x20ab('0x39')],'as':_0x20ab('0x3a')}]},_0x1246b8={};_0x1246b8[_0x20ab('0x3d')]=_['keys'](db[_0x20ab('0x3b')]['rawAttributes']);_0x1246b8['query']=_['keys'](_0x5b4ae5[_0x20ab('0x3f')]);_0x1246b8['filters']=_[_0x20ab('0x41')](_0x1246b8[_0x20ab('0x3d')],_0x1246b8[_0x20ab('0x3f')]);_0x23e37f[_0x20ab('0x42')]=_[_0x20ab('0x41')](_0x1246b8[_0x20ab('0x3d')],qs[_0x20ab('0x56')](_0x5b4ae5['query']['fields']));_0x23e37f['attributes']=_0x23e37f[_0x20ab('0x42')]['length']?_0x23e37f['attributes']:_0x1246b8[_0x20ab('0x3d')];if(_0x5b4ae5[_0x20ab('0x3f')][_0x20ab('0x51')]){_0x23e37f[_0x20ab('0x52')]=[{'all':!![]}];}_0x23e37f=_[_0x20ab('0x50')]({},_0x23e37f,_0x5b4ae5[_0x20ab('0x57')]);return db[_0x20ab('0x3b')][_0x20ab('0x58')](_0x23e37f)['then'](handleEntityNotFound(_0xc49670,null))[_0x20ab('0x1e')](respondWithResult(_0xc49670,null))[_0x20ab('0x29')](handleError(_0xc49670,null));};exports[_0x20ab('0x59')]=function(_0x80fb35,_0xcced41){return db['ChatWebsite'][_0x20ab('0x59')](_0x80fb35[_0x20ab('0x5a')],{})[_0x20ab('0x1e')](function(_0x357ccf){var _0x433fdb=_0x80fb35[_0x20ab('0x5b')][_0x20ab('0x5c')]({'plain':!![]});if(!_0x433fdb)throw new Error(_0x20ab('0x5d'));if(_0x433fdb['role']===_0x20ab('0x5b')){var _0x16b4f2=_0x357ccf[_0x20ab('0x5c')]({'plain':!![]});var _0x23676e=_0x20ab('0x34');return db[_0x20ab('0x5e')]['find']({'where':{'name':_0x23676e,'userProfileId':_0x433fdb['userProfileId']},'raw':!![]})[_0x20ab('0x1e')](function(_0x3684df){if(_0x3684df&&_0x3684df[_0x20ab('0x5f')]===0x0){return db[_0x20ab('0x60')]['create']({'name':_0x16b4f2[_0x20ab('0x37')],'resourceId':_0x16b4f2['id'],'type':_0x3684df[_0x20ab('0x37')],'sectionId':_0x3684df['id']},{})[_0x20ab('0x1e')](function(){return _0x357ccf;});}else{return _0x357ccf;}})[_0x20ab('0x29')](function(_0x3a2624){logger[_0x20ab('0x26')](_0x20ab('0x61'),_0x3a2624);throw _0x3a2624;});}return _0x357ccf;})['then'](respondWithResult(_0xcced41,0xc9))[_0x20ab('0x29')](handleError(_0xcced41,null));};exports['update']=function(_0x5caa2f,_0x3032be){if(_0x5caa2f[_0x20ab('0x5a')]['id']){delete _0x5caa2f[_0x20ab('0x5a')]['id'];}return db['ChatWebsite'][_0x20ab('0x58')]({'where':{'id':_0x5caa2f['params']['id']},'include':[{'model':db[_0x20ab('0x39')],'as':'mandatoryDispositionPause'}]})[_0x20ab('0x1e')](handleEntityNotFound(_0x3032be,null))[_0x20ab('0x1e')](saveUpdates(_0x5caa2f[_0x20ab('0x5a')],null))[_0x20ab('0x1e')](respondWithResult(_0x3032be,null))[_0x20ab('0x29')](handleError(_0x3032be,null));};exports[_0x20ab('0x35')]=function(_0x54f711,_0x584464){return db['ChatWebsite']['find']({'where':{'id':_0x54f711['params']['id']}})['then'](handleEntityNotFound(_0x584464,null))[_0x20ab('0x1e')](removeEntity(_0x584464,null))[_0x20ab('0x29')](handleError(_0x584464,null));};exports[_0x20ab('0x62')]=function(_0x4c5632,_0x346a63){return db[_0x20ab('0x3b')][_0x20ab('0x62')]()[_0x20ab('0x1e')](respondWithResult(_0x346a63,null))[_0x20ab('0x29')](handleError(_0x346a63,null));};exports[_0x20ab('0x63')]=function(_0x189a43,_0x2169cf,_0x237294){if(_0x189a43['body']['id']){delete _0x189a43[_0x20ab('0x5a')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x189a43[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x2169cf,null))[_0x20ab('0x1e')](function(_0x5bdbf2){if(_0x5bdbf2){_0x189a43[_0x20ab('0x5a')][_0x20ab('0x65')]=_0x5bdbf2['id'];return db[_0x20ab('0x66')][_0x20ab('0x59')](_0x189a43[_0x20ab('0x5a')]);}})[_0x20ab('0x1e')](respondWithResult(_0x2169cf,null))['catch'](handleError(_0x2169cf,null));};exports[_0x20ab('0x67')]=function(_0x5bffba,_0x421766,_0x3c388d){var _0x229f3b={'raw':![],'where':{}};var _0x386b5d={};var _0x286c36={'count':0x0,'rows':[]};return db[_0x20ab('0x3b')][_0x20ab('0x68')]({'where':{'id':_0x5bffba[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x421766,null))[_0x20ab('0x1e')](function(_0x3bade4){if(_0x3bade4){_0x386b5d[_0x20ab('0x3d')]=_[_0x20ab('0x3e')](db['Disposition'][_0x20ab('0x3c')]);_0x386b5d[_0x20ab('0x3f')]=_[_0x20ab('0x3e')](_0x5bffba[_0x20ab('0x3f')]);_0x386b5d[_0x20ab('0x40')]=_[_0x20ab('0x41')](_0x386b5d['model'],_0x386b5d[_0x20ab('0x3f')]);_0x229f3b[_0x20ab('0x42')]=_[_0x20ab('0x41')](_0x386b5d[_0x20ab('0x3d')],qs['fields'](_0x5bffba[_0x20ab('0x3f')][_0x20ab('0x56')]));_0x229f3b['attributes']=_0x229f3b['attributes'][_0x20ab('0x43')]?_0x229f3b[_0x20ab('0x42')]:_0x386b5d[_0x20ab('0x3d')];if(!_0x5bffba['query'][_0x20ab('0x44')](_0x20ab('0x45'))){_0x229f3b[_0x20ab('0x46')]=qs['limit'](_0x5bffba[_0x20ab('0x3f')][_0x20ab('0x46')]);_0x229f3b[_0x20ab('0x2e')]=qs[_0x20ab('0x2e')](_0x5bffba[_0x20ab('0x3f')][_0x20ab('0x2e')]);}_0x229f3b[_0x20ab('0x47')]=qs[_0x20ab('0x48')](_0x5bffba[_0x20ab('0x3f')][_0x20ab('0x48')]);_0x229f3b[_0x20ab('0x49')]=qs[_0x20ab('0x40')](_['pick'](_0x5bffba[_0x20ab('0x3f')],_0x386b5d[_0x20ab('0x40')]));_0x229f3b[_0x20ab('0x49')]['ChatWebsiteId']=_0x3bade4['id'];if(_0x5bffba[_0x20ab('0x3f')][_0x20ab('0x4a')]){_0x229f3b[_0x20ab('0x49')]=_[_0x20ab('0x50')](_0x229f3b[_0x20ab('0x49')],{'$or':_[_0x20ab('0x4b')](_0x229f3b[_0x20ab('0x42')],function(_0x5f415d){var _0x183e36={};_0x183e36[_0x5f415d]={'$like':'%'+_0x5bffba['query'][_0x20ab('0x4a')]+'%'};return _0x183e36;})});}_0x229f3b=_[_0x20ab('0x50')]({},_0x229f3b,_0x5bffba[_0x20ab('0x57')]);return db['Disposition'][_0x20ab('0x2d')]({'where':_0x229f3b[_0x20ab('0x49')]})[_0x20ab('0x1e')](function(_0x41afa1){_0x286c36['count']=_0x41afa1;if(_0x5bffba['query'][_0x20ab('0x51')]){_0x229f3b['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x229f3b);})['then'](function(_0x156773){_0x286c36['rows']=_0x156773;return _0x286c36;});}})[_0x20ab('0x1e')](respondWithFilteredResult(_0x421766,_0x229f3b))['catch'](handleError(_0x421766,null));};exports['removeDispositions']=function(_0x48f929,_0x1a2959,_0x3bfce3){return db['ChatWebsite']['find']({'where':{'id':_0x48f929[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x1a2959,null))[_0x20ab('0x1e')](function(_0x27cb9c){if(_0x27cb9c){return _0x27cb9c['removeDispositions'](_0x48f929['query'][_0x20ab('0x69')]);}})[_0x20ab('0x1e')](respondWithStatusCode(_0x1a2959,null))['catch'](handleError(_0x1a2959,null));};exports[_0x20ab('0x6a')]=function(_0x3a6316,_0x37c49e,_0xe5c3c2){if(_0x3a6316[_0x20ab('0x5a')]['id']){delete _0x3a6316['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x3a6316['params']['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x37c49e,null))[_0x20ab('0x1e')](function(_0x28304c){if(_0x28304c){_0x3a6316[_0x20ab('0x5a')][_0x20ab('0x65')]=_0x28304c['id'];return db[_0x20ab('0x6b')]['create'](_0x3a6316[_0x20ab('0x5a')]);}})[_0x20ab('0x1e')](respondWithResult(_0x37c49e,null))['catch'](handleError(_0x37c49e,null));};exports['getAnswers']=function(_0x297cb6,_0x404813,_0x3aa7ae){var _0x4a5a80={'raw':![],'where':{}};var _0x10d366={};var _0x35188b={'count':0x0,'rows':[]};return db[_0x20ab('0x3b')][_0x20ab('0x68')]({'where':{'id':_0x297cb6[_0x20ab('0x64')]['id']}})['then'](handleEntityNotFound(_0x404813,null))[_0x20ab('0x1e')](function(_0x1856f9){if(_0x1856f9){_0x10d366[_0x20ab('0x3d')]=_[_0x20ab('0x3e')](db['CannedAnswer'][_0x20ab('0x3c')]);_0x10d366[_0x20ab('0x3f')]=_[_0x20ab('0x3e')](_0x297cb6[_0x20ab('0x3f')]);_0x10d366['filters']=_['intersection'](_0x10d366[_0x20ab('0x3d')],_0x10d366['query']);_0x4a5a80['attributes']=_[_0x20ab('0x41')](_0x10d366[_0x20ab('0x3d')],qs[_0x20ab('0x56')](_0x297cb6[_0x20ab('0x3f')][_0x20ab('0x56')]));_0x4a5a80[_0x20ab('0x42')]=_0x4a5a80[_0x20ab('0x42')][_0x20ab('0x43')]?_0x4a5a80[_0x20ab('0x42')]:_0x10d366['model'];if(!_0x297cb6['query']['hasOwnProperty']('nolimit')){_0x4a5a80[_0x20ab('0x46')]=qs[_0x20ab('0x46')](_0x297cb6[_0x20ab('0x3f')][_0x20ab('0x46')]);_0x4a5a80['offset']=qs['offset'](_0x297cb6['query'][_0x20ab('0x2e')]);}_0x4a5a80[_0x20ab('0x47')]=qs[_0x20ab('0x48')](_0x297cb6[_0x20ab('0x3f')][_0x20ab('0x48')]);_0x4a5a80[_0x20ab('0x49')]=qs[_0x20ab('0x40')](_[_0x20ab('0x6c')](_0x297cb6[_0x20ab('0x3f')],_0x10d366[_0x20ab('0x40')]));_0x4a5a80['where'][_0x20ab('0x65')]=_0x1856f9['id'];if(_0x297cb6[_0x20ab('0x3f')]['filter']){_0x4a5a80[_0x20ab('0x49')]=_[_0x20ab('0x50')](_0x4a5a80[_0x20ab('0x49')],{'$or':_[_0x20ab('0x4b')](_0x4a5a80[_0x20ab('0x42')],function(_0x34e23d){var _0x26ec18={};_0x26ec18[_0x34e23d]={'$like':'%'+_0x297cb6[_0x20ab('0x3f')][_0x20ab('0x4a')]+'%'};return _0x26ec18;})});}_0x4a5a80=_[_0x20ab('0x50')]({},_0x4a5a80,_0x297cb6[_0x20ab('0x57')]);return db[_0x20ab('0x6b')][_0x20ab('0x2d')]({'where':_0x4a5a80[_0x20ab('0x49')]})[_0x20ab('0x1e')](function(_0x4794e3){_0x35188b[_0x20ab('0x2d')]=_0x4794e3;if(_0x297cb6['query'][_0x20ab('0x51')]){_0x4a5a80['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x20ab('0x53')](_0x4a5a80);})['then'](function(_0x1df398){_0x35188b['rows']=_0x1df398;return _0x35188b;});}})[_0x20ab('0x1e')](respondWithFilteredResult(_0x404813,_0x4a5a80))[_0x20ab('0x29')](handleError(_0x404813,null));};exports[_0x20ab('0x6d')]=function(_0x30d378,_0x140e17,_0x3c8036){return db['ChatWebsite'][_0x20ab('0x58')]({'where':{'id':_0x30d378[_0x20ab('0x64')]['id']}})['then'](handleEntityNotFound(_0x140e17,null))[_0x20ab('0x1e')](function(_0x407221){if(_0x407221){return _0x407221[_0x20ab('0x6d')](_0x30d378[_0x20ab('0x3f')][_0x20ab('0x69')]);}})[_0x20ab('0x1e')](respondWithStatusCode(_0x140e17,null))[_0x20ab('0x29')](handleError(_0x140e17,null));};exports[_0x20ab('0x6e')]=function(_0x1a1c9d,_0x198ab7,_0x51acda){_0x1a1c9d[_0x20ab('0x5a')][_0x20ab('0x6f')]=_0x1a1c9d[_0x20ab('0x70')][_0x20ab('0x71')];return db['ChatWebsite'][_0x20ab('0x58')]({'where':{'id':_0x1a1c9d[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x198ab7,null))[_0x20ab('0x1e')](saveUpdates(_0x1a1c9d[_0x20ab('0x5a')],null))[_0x20ab('0x1e')](respondWithResult(_0x198ab7,null))[_0x20ab('0x29')](handleError(_0x198ab7,null));};exports['addAvatar']=function(_0x44fa36,_0x1e89d0,_0x5136cf){_0x44fa36[_0x20ab('0x5a')][_0x20ab('0x72')]=_0x44fa36[_0x20ab('0x70')][_0x20ab('0x71')];return db[_0x20ab('0x3b')]['find']({'where':{'id':_0x44fa36[_0x20ab('0x64')]['id']}})['then'](handleEntityNotFound(_0x1e89d0,null))[_0x20ab('0x1e')](saveUpdates(_0x44fa36[_0x20ab('0x5a')],null))['then'](respondWithResult(_0x1e89d0,null))[_0x20ab('0x29')](handleError(_0x1e89d0,null));};exports['addCustomerAvatar']=function(_0x14c856,_0x334c25,_0x57b151){_0x14c856[_0x20ab('0x5a')][_0x20ab('0x73')]=_0x14c856[_0x20ab('0x70')][_0x20ab('0x71')];return db[_0x20ab('0x3b')]['find']({'where':{'id':_0x14c856[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x334c25,null))[_0x20ab('0x1e')](saveUpdates(_0x14c856[_0x20ab('0x5a')],null))['then'](respondWithResult(_0x334c25,null))[_0x20ab('0x29')](handleError(_0x334c25,null));};exports['addSystemAvatar']=function(_0x531b08,_0x62f6b1,_0x107f99){_0x531b08[_0x20ab('0x5a')][_0x20ab('0x74')]=_0x531b08['file'][_0x20ab('0x71')];return db[_0x20ab('0x3b')][_0x20ab('0x58')]({'where':{'id':_0x531b08[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x62f6b1,null))['then'](saveUpdates(_0x531b08['body'],null))[_0x20ab('0x1e')](respondWithResult(_0x62f6b1,null))[_0x20ab('0x29')](handleError(_0x62f6b1,null));};exports[_0x20ab('0x75')]=function(_0x285e5f,_0x5b9604,_0x2d2e7c){var _0x478189=path['join'](config['root'],'server/files/images/logos/default_logo.png');var _0x74c739={'where':{'id':_0x285e5f[_0x20ab('0x64')]['id']},'attributes':['id',_0x20ab('0x6f')],'raw':!![]};var _0x53a9e7=![];return require(_0x20ab('0x76'))[_0x20ab('0x77')]()['then'](function(_0x2fd147){if(_0x2fd147){_0x53a9e7=_0x2fd147['custom'];}})[_0x20ab('0x1e')](function(){return db[_0x20ab('0x3b')][_0x20ab('0x58')](_0x74c739);})[_0x20ab('0x1e')](handleEntityNotFound(_0x5b9604,null))['then'](function(_0x2d0f16){if(_0x2d0f16){if(!_[_0x20ab('0x78')](_0x2d0f16[_0x20ab('0x6f')])){if(fs[_0x20ab('0x79')](path['join'](config[_0x20ab('0x7a')],_0x20ab('0x7b'),_0x2d0f16['sitepic']))&&_0x53a9e7){_0x478189=path[_0x20ab('0x7c')](config[_0x20ab('0x7a')],_0x20ab('0x7b'),_0x2d0f16[_0x20ab('0x6f')]);}}return _0x5b9604[_0x20ab('0x7d')](_0x478189);}})[_0x20ab('0x29')](handleError(_0x5b9604,null));};exports[_0x20ab('0x7e')]=function(_0x23e4d2,_0x28e90d,_0x167369){var _0x10037e=path[_0x20ab('0x7c')](config[_0x20ab('0x7a')],_0x20ab('0x7f'));var _0x581072={'where':{'id':_0x23e4d2[_0x20ab('0x64')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x20ab('0x3b')][_0x20ab('0x58')](_0x581072)[_0x20ab('0x1e')](handleEntityNotFound(_0x28e90d,null))[_0x20ab('0x1e')](function(_0x171e43){if(_0x171e43){if(!_[_0x20ab('0x78')](_0x171e43['agentAvatar'])){if(fs[_0x20ab('0x79')](path[_0x20ab('0x7c')](config[_0x20ab('0x7a')],_0x20ab('0x80'),_0x171e43[_0x20ab('0x72')]))){_0x10037e=path[_0x20ab('0x7c')](config[_0x20ab('0x7a')],_0x20ab('0x80'),_0x171e43[_0x20ab('0x72')]);}}return _0x28e90d[_0x20ab('0x7d')](_0x10037e);}})['catch'](handleError(_0x28e90d,null));};exports[_0x20ab('0x81')]=function(_0x108844,_0x5648e0,_0x180dbe){var _0x338948=path[_0x20ab('0x7c')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x2c9fe6={'where':{'id':_0x108844[_0x20ab('0x64')]['id']},'attributes':['id',_0x20ab('0x73'),'showCustomerAvatar'],'raw':!![]};return db[_0x20ab('0x3b')][_0x20ab('0x58')](_0x2c9fe6)[_0x20ab('0x1e')](handleEntityNotFound(_0x5648e0,null))[_0x20ab('0x1e')](function(_0x268964){if(_0x268964){if(!_[_0x20ab('0x78')](_0x268964['customerAvatar'])){if(fs[_0x20ab('0x79')](path[_0x20ab('0x7c')](config['root'],_0x20ab('0x80'),_0x268964[_0x20ab('0x73')]))&&_0x268964['showCustomerAvatar']){_0x338948=path[_0x20ab('0x7c')](config['root'],_0x20ab('0x80'),_0x268964[_0x20ab('0x73')]);}}return _0x5648e0[_0x20ab('0x7d')](_0x338948);}})['catch'](handleError(_0x5648e0,null));};exports['getSystemAvatar']=function(_0x381270,_0x504a50,_0x1134d6){var _0x11ad55=path[_0x20ab('0x7c')](config[_0x20ab('0x7a')],_0x20ab('0x82'));var _0x102875={'where':{'id':_0x381270['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x20ab('0x3b')][_0x20ab('0x58')](_0x102875)['then'](handleEntityNotFound(_0x504a50,null))[_0x20ab('0x1e')](function(_0x226e21){if(_0x226e21){if(!_[_0x20ab('0x78')](_0x226e21[_0x20ab('0x74')])){if(fs[_0x20ab('0x79')](path[_0x20ab('0x7c')](config[_0x20ab('0x7a')],_0x20ab('0x80'),_0x226e21['systemAvatar']))){_0x11ad55=path[_0x20ab('0x7c')](config['root'],_0x20ab('0x80'),_0x226e21[_0x20ab('0x74')]);}}return _0x504a50['download'](_0x11ad55);}})['catch'](handleError(_0x504a50,null));};exports[_0x20ab('0x83')]=function(_0xaf3a45,_0x50a033,_0x106cc9){var _0x476b7f=require(_0x20ab('0x84'));var _0x2cd2b9=new _0x476b7f();var _0x5b200b=_0x2cd2b9['setUA'](_0xaf3a45[_0x20ab('0x85')][_0x20ab('0x86')])[_0x20ab('0x87')]();var _0x8ca173={'body':_0xaf3a45['body'],'channel':_0x20ab('0x88')};var _0x12aaa1=[];var _0x958ff1=[];var _0x2ab3fa={};var _0x4b608d=![];return db[_0x20ab('0x89')][_0x20ab('0x62')]()[_0x20ab('0x1e')](function(_0x914563){if(!_0x914563){throw new db[(_0x20ab('0x1a'))][(_0x20ab('0x1b'))]('no\x20available\x20attributes');}_0x12aaa1=_[_0x20ab('0x8a')](_[_0x20ab('0x3e')](_0x914563),[_0x20ab('0x8b'),'updatedAt']);_0x958ff1=_[_0x20ab('0x8a')](_[_0x20ab('0x3e')](_0x914563),[_0x20ab('0x8b'),_0x20ab('0x8c'),_0x20ab('0x8d'),'ListId']);if(_0xaf3a45[_0x20ab('0x5a')]['id']){delete _0xaf3a45['body']['id'];}if(_[_0x20ab('0x78')](_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0x8e')])){throw new db[(_0x20ab('0x1a'))][(_0x20ab('0x1b'))](_0x20ab('0x8f'));}if(_[_0x20ab('0x78')](_0xaf3a45['body']['body'])||_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0x20ab('0x90'));}if(_[_0x20ab('0x78')](_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0x91')])){throw new db[(_0x20ab('0x1a'))][(_0x20ab('0x1b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x958ff1);}if(!_['includes'](_0x958ff1,_0xaf3a45['body'][_0x20ab('0x91')])){throw new db[(_0x20ab('0x1a'))][(_0x20ab('0x1b'))](_0x20ab('0x92')+_0x958ff1);}_0x2ab3fa[_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0x91')]]=_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0x8e')];})[_0x20ab('0x1e')](function(){return db[_0x20ab('0x3b')][_0x20ab('0x58')]({'where':{'id':_0xaf3a45[_0x20ab('0x64')]['id']},'include':[{'model':db[_0x20ab('0x93')],'as':'List','include':[{'model':db[_0x20ab('0x89')],'as':_0x20ab('0x94'),'where':_0x2ab3fa,'limit':0x1,'order':[[_0x20ab('0x8c'),_0x20ab('0x95')]]}]},{'model':db['ChatApplication'],'as':_0x20ab('0x96')}]});})[_0x20ab('0x1e')](handleEntityNotFound(_0x50a033,null))['then'](function(_0x4dd363){if(_0x4dd363&&_0x4dd363['List']){_0x8ca173[_0x20ab('0x97')]=_0x4dd363;_0x8ca173['applications']=_0x4dd363[_0x20ab('0x96')];_0x8ca173['list']=_0x4dd363[_0x20ab('0x98')];_0x8ca173['applications']=_[_0x20ab('0x99')](_0x8ca173[_0x20ab('0x9a')],['priority'],[_0x20ab('0x9b')]);if(_0x8ca173[_0x20ab('0x97')][_0x20ab('0x96')]){delete _0x8ca173[_0x20ab('0x97')][_0x20ab('0x96')];}if(_0x8ca173[_0x20ab('0x97')][_0x20ab('0x98')]&&_0x8ca173[_0x20ab('0x97')][_0x20ab('0x98')][_0x20ab('0x94')]['length']){return _0x8ca173[_0x20ab('0x97')][_0x20ab('0x98')]['Contacts'][0x0];}var _0x1885a0=_[_0x20ab('0x12')](_0xaf3a45[_0x20ab('0x5a')],{'firstName':_0xaf3a45['body'][_0x20ab('0x8e')],'ListId':_0x4dd363['ListId']});_0x1885a0[_0xaf3a45['body'][_0x20ab('0x91')]]=_0xaf3a45['body'][_0x20ab('0x8e')];return db[_0x20ab('0x89')][_0x20ab('0x59')](_0x1885a0,{'fields':_0x12aaa1,'raw':!![]});}})['then'](handleEntityNotFound(_0x50a033,null))['then'](function(_0x5fa9f5){_0x8ca173[_0x20ab('0x9c')]=_0x5fa9f5;var _0x31d0ea=_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0x9d')];if(_0xaf3a45[_0x20ab('0x85')][_0x20ab('0x9e')]){_0x31d0ea=_0xaf3a45[_0x20ab('0x85')]['cf-connecting-ip'];}else if(_0xaf3a45[_0x20ab('0x85')][_0x20ab('0x9f')]){_0x31d0ea=_[_0x20ab('0xa0')](_0xaf3a45[_0x20ab('0x85')]['x-forwarded-for']['split'](','));}if(_0x5fa9f5){var _0x59fda8={'ContactId':_0x5fa9f5['id'],'ChatWebsiteId':_0xaf3a45[_0x20ab('0x64')]['id'],'from':(_0x5fa9f5[_0x20ab('0xa1')]||'')+'\x20'+(_0x5fa9f5[_0x20ab('0xa2')]||''),'customerIp':_0x31d0ea,'customerPort':_0xaf3a45[_0x20ab('0x85')][_0x20ab('0xa3')]?_0xaf3a45[_0x20ab('0x85')][_0x20ab('0xa3')]:null,'referer':_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xa4')],'browserName':_0x5b200b[_0x20ab('0xa5')]['name']&&_0x5b200b[_0x20ab('0xa5')][_0x20ab('0xa6')]?util[_0x20ab('0xa7')]('%s\x20%s',_0x5b200b[_0x20ab('0xa5')][_0x20ab('0x37')],_0x5b200b[_0x20ab('0xa5')]['version']):_0x20ab('0xa8'),'browserVersion':_0x5b200b[_0x20ab('0xa5')][_0x20ab('0xa6')]||_0x20ab('0xa8'),'osName':util[_0x20ab('0xa7')]('%s\x20%s',_0x5b200b['os'][_0x20ab('0x37')],_0x5b200b['os'][_0x20ab('0xa6')]),'osVersion':_0x5b200b['os'][_0x20ab('0xa6')],'deviceModel':_0x5b200b[_0x20ab('0xa9')][_0x20ab('0x3d')]&&_0x5b200b[_0x20ab('0xa9')]['vendor']?util[_0x20ab('0xa7')]('%s\x20%s\x20%s',_0x5b200b[_0x20ab('0xa9')][_0x20ab('0x3d')],_0x5b200b[_0x20ab('0xa9')][_0x20ab('0xaa')],_0x5b200b['device'][_0x20ab('0x4c')]):null,'deviceVendor':_0x5b200b[_0x20ab('0xa9')][_0x20ab('0xaa')],'deviceType':_0x5b200b['device']['type'],'formData':JSON[_0x20ab('0x24')](_0xaf3a45[_0x20ab('0x5a')])};var _0x576f0f={'ChatWebsiteId':_0xaf3a45[_0x20ab('0x64')]['id'],'closed':![]};if(_0xaf3a45['body']['threadId']){_0x576f0f['threadId']=_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xab')];return db['ChatInteraction'][_0x20ab('0x58')]({'where':_0x576f0f})['then'](function(_0x4a9774){if(_0x4a9774){return[_0x4a9774,![]];}_0x59fda8[_0x20ab('0xab')]=_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xab')];_0x59fda8[_0x20ab('0xac')]=_0xaf3a45[_0x20ab('0x5a')]['externalUrl'];return db[_0x20ab('0xad')][_0x20ab('0x59')](_0x59fda8)[_0x20ab('0x1e')](function(_0xd2a577){return[_0xd2a577,!![]];});});}_0x576f0f[_0x20ab('0xae')]=_0x5fa9f5['id'];if(_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xaf')]&&_0xaf3a45['body']['interaction']['id']){_0x576f0f['id']=_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xaf')]['id'];return db[_0x20ab('0xad')]['find']({'where':_0x576f0f})[_0x20ab('0x1e')](function(_0x3bf758){if(_0x3bf758){return[_0x3bf758,![]];}return db['ChatInteraction'][_0x20ab('0x59')](_0x59fda8)[_0x20ab('0x1e')](function(_0x5c29b2){return[_0x5c29b2,!![]];});});}return db[_0x20ab('0xad')][_0x20ab('0x59')](_0x59fda8)[_0x20ab('0x1e')](function(_0x3c98eb){return[_0x3c98eb,!![]];});}})[_0x20ab('0xb0')](function(_0xc778f5,_0x29b63b){if(_0xc778f5){_0x4b608d=_0x29b63b;if(!_0x29b63b){var _0x331a44={'from':(_0x8ca173['contact'][_0x20ab('0xa1')]||'')+'\x20'+(_0x8ca173[_0x20ab('0x9c')][_0x20ab('0xa2')]||'')};if(_0xaf3a45[_0x20ab('0x5a')]['threadId']&&_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xb1')]&&_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xab')]!=_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xb1')]){_0x331a44[_0x20ab('0xab')]=_0xaf3a45['body'][_0x20ab('0xb1')];}return _0xc778f5[_0x20ab('0x33')](_0x331a44);}else{return _0xc778f5;}}})[_0x20ab('0x1e')](function(_0x498cfe){_0x8ca173['interaction']=_0x498cfe[_0x20ab('0x5c')]({'plain':!![]});_0x8ca173[_0x20ab('0xaf')][_0x20ab('0xb2')]=_0x4b608d;if(_0x8ca173[_0x20ab('0xaf')][_0x20ab('0xb2')]){if(_0x8ca173[_0x20ab('0x97')][_0x20ab('0xb3')]){_0x8ca173[_0x20ab('0x9a')][_0x20ab('0xb4')]({'id':0x0,'priority':_0x8ca173[_0x20ab('0x9a')]['length']+0x1,'app':_0x20ab('0xb5'),'appdata':_0x20ab('0xb6'),'interval':_0x20ab('0xb7')});}}return db[_0x20ab('0xb8')][_0x20ab('0x59')]({'body':_0xaf3a45['body']['body'],'ChatWebsiteId':_0xaf3a45[_0x20ab('0x64')]['id'],'ChatInteractionId':_0x498cfe['id'],'direction':'in','ContactId':_0x8ca173['contact']['id'],'AttachmentId':_0xaf3a45[_0x20ab('0x5a')][_0x20ab('0xb9')]});})[_0x20ab('0x1e')](function(_0x5289bc){_0x8ca173[_0x20ab('0x27')]=_0x5289bc;if(_0x8ca173[_0x20ab('0xaf')][_0x20ab('0xba')]){return db[_0x20ab('0xbb')][_0x20ab('0x58')]({'attributes':['id',_0x20ab('0x37')],'where':{'id':_0x8ca173[_0x20ab('0xaf')]['UserId']}})[_0x20ab('0x1e')](function(_0x4446d9){if(_0x4446d9){_0x8ca173[_0x20ab('0x9a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x20ab('0xbc'),'appdata':_0x4446d9['name']+','+(_0x8ca173[_0x20ab('0x97')][_0x20ab('0xbd')]||0xa),'interval':_0x20ab('0xb7')});_0x8ca173[_0x20ab('0xbe')]=!![];}return respondWithRpcPromise(_0x20ab('0xbf'),_0x20ab('0xc0'),_0x8ca173);});}return respondWithRpcPromise(_0x20ab('0xbf'),_0x20ab('0xc0'),_0x8ca173);})[_0x20ab('0x1e')](function(_0x4f3c74){respondWithRpcPromise(_0x20ab('0xc1'),_0x20ab('0xc1'),{'event':'notify','message':_0x4f3c74},client9002);return _0x4f3c74;})[_0x20ab('0x1e')](respondWithResult(_0x50a033,null))[_0x20ab('0x29')](handleError(_0x50a033,null));};exports[_0x20ab('0xc2')]=function(_0x5db231,_0x5aaca0,_0xb2f661){var _0x48b087,_0x1b4443,_0x2f1191;var _0x3da51e=[];var _0x1e4381=[];var _0x589e97={};return db[_0x20ab('0x89')][_0x20ab('0x62')]()[_0x20ab('0x1e')](function(_0x5abdd1){if(!_0x5abdd1){throw new db['Sequelize'][(_0x20ab('0x1b'))](_0x20ab('0xc3'));}_0x1e4381=_[_0x20ab('0x8a')](_['keys'](_0x5abdd1),[_0x20ab('0x8b'),'updatedAt']);_0x3da51e=_[_0x20ab('0x8a')](_[_0x20ab('0x3e')](_0x5abdd1),[_0x20ab('0x8b'),_0x20ab('0x8c'),'CompanyId',_0x20ab('0xc4')]);if(_0x5db231['body']['id']){delete _0x5db231['body']['id'];}if(_[_0x20ab('0x78')](_0x5db231['body'][_0x20ab('0x8e')])){throw _0x5aaca0[_0x20ab('0x2a')](0x1f4)[_0x20ab('0xc5')](new db[(_0x20ab('0x1a'))][(_0x20ab('0x1b'))](_0x20ab('0x8f')));}if(_['isNil'](_0x5db231[_0x20ab('0x5a')][_0x20ab('0x5a')])||_0x5db231[_0x20ab('0x5a')][_0x20ab('0x5a')]===''){throw _0x5aaca0['status'](0x1f4)[_0x20ab('0xc5')](new db[(_0x20ab('0x1a'))][(_0x20ab('0x1b'))](_0x20ab('0x90')));}if(_[_0x20ab('0x78')](_0x5db231[_0x20ab('0x5a')][_0x20ab('0xc6')])){throw _0x5aaca0[_0x20ab('0x2a')](0x1f4)[_0x20ab('0xc5')](new db['Sequelize'][(_0x20ab('0x1b'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3da51e));}if(!_[_0x20ab('0xc7')](_0x3da51e,_0x5db231[_0x20ab('0x5a')][_0x20ab('0xc6')])){throw _0x5aaca0[_0x20ab('0x2a')](0x1f4)['send'](new db[(_0x20ab('0x1a'))][(_0x20ab('0x1b'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3da51e));}_0x589e97[_0x5db231[_0x20ab('0x5a')]['mapKeyOffline']]=_0x5db231[_0x20ab('0x5a')][_0x20ab('0x8e')];})[_0x20ab('0x1e')](function(){return db[_0x20ab('0x3b')][_0x20ab('0x58')]({'where':{'id':_0x5db231[_0x20ab('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x20ab('0x98')}]});})['then'](handleEntityNotFound(_0x5aaca0,null))['then'](function(_0x33ac5b){if(_0x33ac5b&&_0x33ac5b[_0x20ab('0x98')]){_0x1b4443=_0x33ac5b;var _0x3c2fa2=_[_0x20ab('0x12')](_0x5db231[_0x20ab('0x5a')],{'firstName':_0x5db231['body']['from'],'phone':_0x5db231[_0x20ab('0x5a')]['from'],'ListId':_0x33ac5b['ListId']});_0x3c2fa2[_0x5db231['body'][_0x20ab('0xc6')]]=_0x5db231[_0x20ab('0x5a')][_0x20ab('0x8e')];return db[_0x20ab('0x89')][_0x20ab('0xc8')]({'where':_0x589e97,'defaults':_0x3c2fa2});}})[_0x20ab('0xb0')](function(_0x305aec){if(_0x305aec){_0x2f1191=_0x305aec;var _0x14604a=fs['readFileSync'](path['join'](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0x20ab('0xc9'));var _0x3e31bb=ejs[_0x20ab('0xca')](_0x14604a,{'body':_[_0x20ab('0xcb')](_0x5db231[_0x20ab('0x5a')][_0x20ab('0x5a')]),'bodyTitle':_0x1b4443['offlineMessageBody']});return db[_0x20ab('0xcc')]['create']({'body':_0x3e31bb,'ContactId':_0x305aec['id'],'ChatWebsiteId':_0x1b4443['id']});}})['then'](function(_0x5639ee){if(_0x5639ee){_0x48b087=_0x5639ee;return db[_0x20ab('0xcd')][_0x20ab('0x68')]({'where':{'service':!![]},'include':[{'model':db[_0x20ab('0xce')],'as':_0x20ab('0xcf'),'raw':!![]}]});}})[_0x20ab('0x1e')](function(_0x1b52f7){if(_0x1b52f7&&_0x1b52f7[_0x20ab('0xcf')]&&_0x1b4443['forwardOfflineAddress']){var _0x37c986={'tls':{'rejectUnauthorized':![]}};if(_0x1b52f7[_0x20ab('0xcf')][_0x20ab('0xd0')]){_0x37c986[_0x20ab('0xd0')]=_0x1b52f7[_0x20ab('0xcf')][_0x20ab('0xd0')];}else{_0x37c986[_0x20ab('0xd1')]=_0x1b52f7[_0x20ab('0xcf')]['host'];_0x37c986[_0x20ab('0xd2')]=_0x1b52f7[_0x20ab('0xcf')][_0x20ab('0xd2')];_0x37c986[_0x20ab('0xd3')]=_0x1b52f7['Smtp'][_0x20ab('0xd3')];}if(_0x1b52f7[_0x20ab('0xcf')][_0x20ab('0xd4')]){_0x37c986['auth']={'user':_0x1b52f7[_0x20ab('0xcf')][_0x20ab('0x5b')],'pass':_0x1b52f7[_0x20ab('0xcf')][_0x20ab('0xd5')]};}return respondWithRpcPromise(_0x20ab('0xd6'),'sendMail',{'account':_0x37c986,'message':{'from':util[_0x20ab('0xa7')](_0x20ab('0xd7'),_0x1b52f7[_0x20ab('0x37')],_0x1b52f7[_0x20ab('0xd8')]||_0x1b52f7[_0x20ab('0xcf')]['user']),'to':_0x1b4443[_0x20ab('0xd9')],'subject':_0x1b4443[_0x20ab('0xda')],'text':_0x48b087[_0x20ab('0x5a')]}},client9003)['then'](function(){return _0x48b087;})[_0x20ab('0x29')](function(_0xad888d){console[_0x20ab('0x26')](_0xad888d);});}})[_0x20ab('0x1e')](function(){if(_0x48b087){return _0x48b087;}})[_0x20ab('0x1e')](respondWithResult(_0x5aaca0,null))[_0x20ab('0x29')](handleError(_0x5aaca0,null));};exports[_0x20ab('0xdb')]=function(_0x35b9a6,_0x14ad3d,_0x5d6c00){return db[_0x20ab('0xad')]['find']({'where':{'id':_0x35b9a6[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x14ad3d,null))[_0x20ab('0x1e')](function(_0x4d05ae){if(_0x4d05ae){return _0x4d05ae['addInteraction'](_0x35b9a6[_0x20ab('0x5a')][_0x20ab('0x69')],_[_0x20ab('0xdc')](_0x35b9a6[_0x20ab('0x5a')],['ids','id'])||{});}})[_0x20ab('0x1e')](respondWithResult(_0x14ad3d,null))['catch'](handleError(_0x14ad3d,null));};exports[_0x20ab('0xdd')]=function(_0x856466,_0x20fb8c,_0x329ed1){var _0x4d52d2={'raw':![],'where':{}};var _0x2efa55={};var _0x55babf={'count':0x0,'rows':[]};return db[_0x20ab('0x3b')][_0x20ab('0x68')]({'where':{'id':_0x856466[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x20fb8c,null))['then'](function(_0x4e35f6){if(_0x4e35f6){_0x2efa55[_0x20ab('0x3d')]=_[_0x20ab('0x3e')](db[_0x20ab('0xad')]['rawAttributes']);_0x2efa55[_0x20ab('0x3f')]=_[_0x20ab('0x3e')](_0x856466['query']);_0x2efa55[_0x20ab('0x40')]=_['intersection'](_0x2efa55[_0x20ab('0x3d')],_0x2efa55[_0x20ab('0x3f')]);_0x4d52d2[_0x20ab('0x42')]=_[_0x20ab('0x41')](_0x2efa55[_0x20ab('0x3d')],qs[_0x20ab('0x56')](_0x856466['query']['fields']));_0x4d52d2['attributes']=_0x4d52d2['attributes']['length']?_0x4d52d2['attributes']:_0x2efa55[_0x20ab('0x3d')];if(!_0x856466[_0x20ab('0x3f')]['hasOwnProperty'](_0x20ab('0x45'))){_0x4d52d2['limit']=qs['limit'](_0x856466[_0x20ab('0x3f')]['limit']);_0x4d52d2[_0x20ab('0x2e')]=qs[_0x20ab('0x2e')](_0x856466['query'][_0x20ab('0x2e')]);}_0x4d52d2[_0x20ab('0x47')]=qs[_0x20ab('0x48')](_0x856466[_0x20ab('0x3f')][_0x20ab('0x48')]);_0x4d52d2[_0x20ab('0x49')]=qs[_0x20ab('0x40')](_[_0x20ab('0x6c')](_0x856466[_0x20ab('0x3f')],_0x2efa55[_0x20ab('0x40')]));_0x4d52d2[_0x20ab('0x49')][_0x20ab('0x65')]=_0x4e35f6['id'];if(_0x856466[_0x20ab('0x3f')]['filter']){_0x4d52d2[_0x20ab('0x49')]=_[_0x20ab('0x50')](_0x4d52d2[_0x20ab('0x49')],{'$or':_[_0x20ab('0x4b')](_0x4d52d2[_0x20ab('0x42')],function(_0x1a5c6d){var _0x3df146={};_0x3df146[_0x1a5c6d]={'$like':'%'+_0x856466[_0x20ab('0x3f')][_0x20ab('0x4a')]+'%'};return _0x3df146;})});}_0x4d52d2=_[_0x20ab('0x50')]({},_0x4d52d2,_0x856466[_0x20ab('0x57')]);return db[_0x20ab('0xad')][_0x20ab('0x2d')]({'where':_0x4d52d2['where']})[_0x20ab('0x1e')](function(_0x11e43d){_0x55babf[_0x20ab('0x2d')]=_0x11e43d;if(_0x856466['query'][_0x20ab('0x51')]){_0x4d52d2[_0x20ab('0x52')]=[{'model':db[_0x20ab('0x89')],'as':_0x20ab('0xde'),'required':![]},{'model':db[_0x20ab('0xbb')],'as':'Owner','attributes':[_0x20ab('0x37'),_0x20ab('0xdf'),_0x20ab('0xe0')],'required':![]},{'model':db[_0x20ab('0xe1')],'as':_0x20ab('0xe2'),'attributes':['id',_0x20ab('0x37'),_0x20ab('0xe3')],'where':_0x856466[_0x20ab('0x3f')][_0x20ab('0xe4')]?{'id':_0x856466[_0x20ab('0x3f')][_0x20ab('0xe4')]}:undefined,'required':_0x856466[_0x20ab('0x3f')]['tag']?!![]:![]}];}return db[_0x20ab('0xad')][_0x20ab('0x53')](_0x4d52d2);})[_0x20ab('0x1e')](function(_0x4cb39b){_0x55babf[_0x20ab('0x54')]=_0x4cb39b;return _0x55babf;});}})['then'](respondWithFilteredResult(_0x20fb8c,_0x4d52d2))[_0x20ab('0x29')](handleError(_0x20fb8c,null));};function iftimePromise(_0x3f0628,_0x4a1095){return respondWithRpcPromise(_0x20ab('0xe5'),'getSnippet',{'command':_0x4a1095[_0x20ab('0xe6')]?util[_0x20ab('0xa7')](_0x20ab('0xe7'),_0x3f0628[_0x20ab('0xe8')],_0x4a1095[_0x20ab('0xe6')]):util[_0x20ab('0xa7')]('iftime\x20%s',_0x3f0628[_0x20ab('0xe8')])},client9002)[_0x20ab('0x1e')](function(_0x583848){var _0x1c0d2a=_0x583848&&_0x583848[_0x20ab('0xe9')](_0x20ab('0xea'))>=0x0?!![]:![];logger[_0x20ab('0x1f')](_0x20ab('0xeb'),_0x4a1095['id'],_0x3f0628['id'],_0x3f0628[_0x20ab('0xe8')],_0x1c0d2a?_0x20ab('0xec'):'OFFLINE',_0x4a1095[_0x20ab('0xe6')]?_0x4a1095['timezone']:_0x20ab('0xed'));return _0x1c0d2a;})['catch'](function(_0x42730a){logger[_0x20ab('0x26')](_0x20ab('0xeb'),_0x4a1095['id'],_0x3f0628['id'],_0x3f0628[_0x20ab('0xe8')],util['inspect'](_0x42730a,{'showHidden':![],'depth':null}),_0x4a1095['timezone']?_0x4a1095[_0x20ab('0xe6')]:_0x20ab('0xed'));return![];});}exports[_0x20ab('0xee')]=function(_0x3d886c,_0x2b970a,_0x48af64){var _0x3a19b2=0x0;var _0x4c948c=0x0;var _0x5319a1=![];var _0xc1d0d9;var _0x1966c4;return db[_0x20ab('0x3b')][_0x20ab('0x58')]({'where':{'id':_0x3d886c[_0x20ab('0x64')]['id']},'include':[{'model':db[_0x20ab('0xef')],'as':_0x20ab('0xef'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x20ab('0xe8')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2b970a,null))[_0x20ab('0x1e')](function(_0x159631){if(_0x159631){_0xc1d0d9=_0x159631;return _0x159631['getProactiveActions']({'raw':!![]});}})[_0x20ab('0x1e')](function(_0xb0be40){if(_0xc1d0d9){if(_0xb0be40){_0x1966c4=_0xb0be40;}}return require(_0x20ab('0x76'))[_0x20ab('0x77')]();})[_0x20ab('0x1e')](function(_0xab4c04){if(_0xab4c04){_0x4c948c=_0xab4c04[_0x20ab('0xf0')];_0x5319a1=_0xab4c04[_0x20ab('0xf1')];}})[_0x20ab('0x1e')](function(){return db[_0x20ab('0xad')][_0x20ab('0x2d')]({'where':{'closed':![]}});})[_0x20ab('0x1e')](function(_0x2594a0){_0x3a19b2=_0x2594a0;if(_0x4c948c&&_0x2594a0>_0x4c948c){return db[_0x20ab('0xf2')][_0x20ab('0x68')]({'where':{'id':0x1}})[_0x20ab('0x1e')](function(_0x24c6fb){if(_0x24c6fb){_0x24c6fb[_0x20ab('0xf3')](_0x20ab('0xf4'));}});}})['then'](function(){if(_0xc1d0d9[_0x20ab('0xef')]&&_0xc1d0d9[_0x20ab('0xef')][_0x20ab('0xf5')]){var _0x19642e=[];for(var _0x5a077d=0x0;_0x5a077d<_0xc1d0d9[_0x20ab('0xef')][_0x20ab('0xf5')]['length'];_0x5a077d++){var _0x4e5002=_0xc1d0d9[_0x20ab('0xef')][_0x20ab('0xf5')][_0x5a077d][_0x20ab('0x5c')]({'plain':!![]});_0x19642e[_0x20ab('0xb4')](iftimePromise(_0x4e5002,_0xc1d0d9));}return BPromise[_0x20ab('0xf6')](_0x19642e)['then'](function(_0x5e55ee){return _['some'](_0x5e55ee);});}else{return!![];}})[_0x20ab('0x1e')](function(_0x33f66f){var _0x411f52=fs['readFileSync'](path[_0x20ab('0x7c')](config[_0x20ab('0x7a')],_0x20ab('0xf7')),_0x20ab('0xc9'));var _0x50a749={'remote':_0xc1d0d9[_0x20ab('0xf8')],'query':querystring[_0x20ab('0x24')](_['merge'](_0xc1d0d9[_0x20ab('0x5c')]({'plain':!![]}),{'customerIp':_0x3d886c[_0x20ab('0x85')]['x-forwarded-for']||_0x3d886c['headers'][_0x20ab('0xf9')]||_0x3d886c[_0x20ab('0xfa')][_0x20ab('0xfb')]||_0x3d886c['ip'],'referer':_0x3d886c[_0x20ab('0x85')][_0x20ab('0xa4')],'openedInteractions':_0x3a19b2,'maxInteractions':_0x4c948c,'virtual':_0x5319a1[_0x20ab('0xf0')],'online':_0x33f66f,'custom':_0x5319a1}))['replace'](/'/g,'\x5c\x27')};_0x2b970a[_0x20ab('0xc5')](ejs[_0x20ab('0xca')](Mustache[_0x20ab('0xca')](_0x411f52,_0x50a749),{'proactiveActions':_0x1966c4,'alignment':_0xc1d0d9[_0x20ab('0xfc')],'verticalAlignment':_0xc1d0d9['verticalAlignment']}));})[_0x20ab('0x29')](handleError(_0x2b970a,null));};exports['addApplications']=function(_0x224c8c,_0xeacb52,_0x2563ce){return db['ChatWebsite'][_0x20ab('0x68')]({'where':{'id':_0x224c8c['params']['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0xeacb52,null))['then'](function(_0x17ccc7){if(_0x17ccc7){return db['sequelize'][_0x20ab('0xfd')](function(_0x3efae7){return db[_0x20ab('0xfe')][_0x20ab('0x35')]({'where':{'ChatWebsiteId':_0x224c8c[_0x20ab('0x64')]['id']},'transaction':_0x3efae7})[_0x20ab('0x1e')](function(_0x44caa3){var _0x1ea971=_[_0x20ab('0x4b')](_0x224c8c[_0x20ab('0x5a')],function(_0x52da17){_0x52da17[_0x20ab('0x65')]=_0x224c8c['params']['id'];return _0x52da17;});return db[_0x20ab('0xfe')][_0x20ab('0xff')](_0x1ea971,{'transaction':_0x3efae7});});})[_0x20ab('0x1e')](function(){return db[_0x20ab('0xfe')][_0x20ab('0x100')]({'where':{'ChatWebsiteId':_0x224c8c['params']['id']},'order':_0x20ab('0x101')});});}})[_0x20ab('0x1e')](respondWithResult(_0xeacb52,null))[_0x20ab('0x29')](handleError(_0xeacb52,null));};exports[_0x20ab('0x102')]=function(_0x19220e,_0x32c8e5,_0x59b0f1){var _0x4be1df={};var _0x50aeea={};var _0x32f705;var _0x5ae7c1;return db[_0x20ab('0x3b')][_0x20ab('0x68')]({'where':{'id':_0x19220e[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x32c8e5,null))[_0x20ab('0x1e')](function(_0xa9ff6b){if(_0xa9ff6b){_0x32f705=_0xa9ff6b;_0x50aeea[_0x20ab('0x3d')]=_[_0x20ab('0x3e')](db['ChatApplication'][_0x20ab('0x3c')]);_0x50aeea['query']=_['keys'](_0x19220e[_0x20ab('0x3f')]);_0x50aeea[_0x20ab('0x40')]=_['intersection'](_0x50aeea[_0x20ab('0x3d')],_0x50aeea[_0x20ab('0x3f')]);_0x4be1df['attributes']=_['intersection'](_0x50aeea['model'],qs[_0x20ab('0x56')](_0x19220e[_0x20ab('0x3f')][_0x20ab('0x56')]));_0x4be1df['attributes']=_0x4be1df[_0x20ab('0x42')][_0x20ab('0x43')]?_0x4be1df[_0x20ab('0x42')]:_0x50aeea[_0x20ab('0x3d')];_0x4be1df[_0x20ab('0x47')]=qs['sort'](_0x19220e['query'][_0x20ab('0x48')]);_0x4be1df[_0x20ab('0x49')]=qs[_0x20ab('0x40')](_[_0x20ab('0x6c')](_0x19220e[_0x20ab('0x3f')],_0x50aeea[_0x20ab('0x40')]));if(_0x19220e[_0x20ab('0x3f')][_0x20ab('0x4a')]){_0x4be1df[_0x20ab('0x49')]=_[_0x20ab('0x50')](_0x4be1df['where'],{'$or':_[_0x20ab('0x4b')](_0x4be1df[_0x20ab('0x42')],function(_0x111f23){var _0x51892e={};_0x51892e[_0x111f23]={'$like':'%'+_0x19220e[_0x20ab('0x3f')][_0x20ab('0x4a')]+'%'};return _0x51892e;})});}_0x4be1df=_[_0x20ab('0x50')]({},_0x4be1df,_0x19220e[_0x20ab('0x57')]);return _0x32f705['getApplications'](_0x4be1df);}})[_0x20ab('0x1e')](function(_0x3a8a93){if(_0x3a8a93){_0x5ae7c1=_0x3a8a93[_0x20ab('0x43')];if(!_0x19220e[_0x20ab('0x3f')][_0x20ab('0x44')](_0x20ab('0x45'))){_0x4be1df['limit']=qs[_0x20ab('0x46')](_0x19220e[_0x20ab('0x3f')]['limit']);_0x4be1df[_0x20ab('0x2e')]=qs[_0x20ab('0x2e')](_0x19220e[_0x20ab('0x3f')][_0x20ab('0x2e')]);}return _0x32f705[_0x20ab('0x102')](_0x4be1df);}})[_0x20ab('0x1e')](function(_0x4f4a88){if(_0x4f4a88){return _0x4f4a88?{'count':_0x5ae7c1,'rows':_0x4f4a88}:null;}})[_0x20ab('0x1e')](respondWithResult(_0x32c8e5,null))[_0x20ab('0x29')](handleError(_0x32c8e5,null));};exports[_0x20ab('0x103')]=function(_0x5ca914,_0x45502c,_0x42e76a){return db[_0x20ab('0x104')][_0x20ab('0x58')]({'where':{'id':_0x5ca914[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x45502c,null))[_0x20ab('0x1e')](function(_0x8a64a9){if(_0x8a64a9){return _0x8a64a9[_0x20ab('0x103')](_0x5ca914[_0x20ab('0x5a')][_0x20ab('0x69')],_[_0x20ab('0xdc')](_0x5ca914[_0x20ab('0x5a')],[_0x20ab('0x69'),'id'])||{});}})[_0x20ab('0x1e')](respondWithResult(_0x45502c,null))[_0x20ab('0x29')](handleError(_0x45502c,null));};exports[_0x20ab('0x105')]=function(_0xb9e3a0,_0x23eadf,_0x4ef0f7){var _0x8f01d={};var _0x29e3bf={};var _0x188ac2;var _0x5c88c9;return db[_0x20ab('0x3b')][_0x20ab('0x68')]({'where':{'id':_0xb9e3a0[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x23eadf,null))[_0x20ab('0x1e')](function(_0x5a68d0){if(_0x5a68d0){_0x188ac2=_0x5a68d0;_0x29e3bf['model']=_['keys'](db[_0x20ab('0x106')][_0x20ab('0x3c')]);_0x29e3bf['query']=_[_0x20ab('0x3e')](_0xb9e3a0[_0x20ab('0x3f')]);_0x29e3bf[_0x20ab('0x40')]=_['intersection'](_0x29e3bf['model'],_0x29e3bf[_0x20ab('0x3f')]);_0x8f01d[_0x20ab('0x42')]=_['intersection'](_0x29e3bf[_0x20ab('0x3d')],qs[_0x20ab('0x56')](_0xb9e3a0[_0x20ab('0x3f')][_0x20ab('0x56')]));_0x8f01d[_0x20ab('0x42')]=_0x8f01d[_0x20ab('0x42')][_0x20ab('0x43')]?_0x8f01d[_0x20ab('0x42')]:_0x29e3bf[_0x20ab('0x3d')];_0x8f01d[_0x20ab('0x47')]=qs[_0x20ab('0x48')](_0xb9e3a0[_0x20ab('0x3f')][_0x20ab('0x48')]);_0x8f01d[_0x20ab('0x49')]=qs[_0x20ab('0x40')](_[_0x20ab('0x6c')](_0xb9e3a0[_0x20ab('0x3f')],_0x29e3bf[_0x20ab('0x40')]));if(_0xb9e3a0['query'][_0x20ab('0x4a')]){_0x8f01d['where']=_['merge'](_0x8f01d[_0x20ab('0x49')],{'$or':_['map'](_0x8f01d['attributes'],function(_0x58e98e){var _0x3401a9={};_0x3401a9[_0x58e98e]={'$like':'%'+_0xb9e3a0[_0x20ab('0x3f')][_0x20ab('0x4a')]+'%'};return _0x3401a9;})});}_0x8f01d=_[_0x20ab('0x50')]({},_0x8f01d,_0xb9e3a0[_0x20ab('0x57')]);return _0x188ac2[_0x20ab('0x105')](_0x8f01d);}})['then'](function(_0xda230f){if(_0xda230f){_0x5c88c9=_0xda230f[_0x20ab('0x43')];if(!_0xb9e3a0[_0x20ab('0x3f')][_0x20ab('0x44')](_0x20ab('0x45'))){_0x8f01d[_0x20ab('0x46')]=qs[_0x20ab('0x46')](_0xb9e3a0['query'][_0x20ab('0x46')]);_0x8f01d[_0x20ab('0x2e')]=qs[_0x20ab('0x2e')](_0xb9e3a0['query'][_0x20ab('0x2e')]);}return _0x188ac2[_0x20ab('0x105')](_0x8f01d);}})[_0x20ab('0x1e')](function(_0x377537){if(_0x377537){return _0x377537?{'count':_0x5c88c9,'rows':_0x377537}:null;}})['then'](respondWithResult(_0x23eadf,null))[_0x20ab('0x29')](handleError(_0x23eadf,null));};exports[_0x20ab('0x107')]=function(_0x29fa3e,_0x110ba4,_0x2f2740){var _0x25a7a1=_0x29fa3e['query'][_0x20ab('0x108')]===_0x20ab('0x109')?_0x20ab('0x10a'):'onlineForm';return db[_0x20ab('0x3b')][_0x20ab('0x58')]({'attributes':['id',_0x25a7a1],'where':{'id':_0x29fa3e[_0x20ab('0x64')]['id']}})['then'](handleEntityNotFound(_0x110ba4,null))['then'](function(_0x185c9b){if(_0x185c9b){var _0x41cbce=_0x185c9b[_0x25a7a1];var _0x4a561d=_0x41cbce&&_0x41cbce[_0x20ab('0x10b')]?_0x41cbce['items']:[];_0x110ba4[_0x20ab('0xc5')]({'fromKey':_['isNil'](_0x41cbce[_0x20ab('0x10c')])?undefined:_0x41cbce[_0x20ab('0x10c')],'count':_0x4a561d[_0x20ab('0x43')],'rows':_0x4a561d});}})[_0x20ab('0x29')](handleError(_0x110ba4,null));};exports[_0x20ab('0x10d')]=function(_0x21ffe1,_0xb2e5b0,_0x2d9d0b){var _0x208f35={'raw':!![],'where':{}};var _0x4a1b74={};var _0x494f16={'count':0x0,'rows':[]};return db[_0x20ab('0x3b')][_0x20ab('0x68')]({'where':{'id':_0x21ffe1[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0xb2e5b0,null))[_0x20ab('0x1e')](function(_0x11001e){if(_0x11001e){_0x4a1b74[_0x20ab('0x3d')]=_[_0x20ab('0x3e')](db['ChatOfflineMessage'][_0x20ab('0x3c')]);_0x4a1b74[_0x20ab('0x3f')]=_[_0x20ab('0x3e')](_0x21ffe1['query']);_0x4a1b74[_0x20ab('0x40')]=_['intersection'](_0x4a1b74['model'],_0x4a1b74['query']);_0x208f35[_0x20ab('0x42')]=_['intersection'](_0x4a1b74[_0x20ab('0x3d')],qs[_0x20ab('0x56')](_0x21ffe1[_0x20ab('0x3f')][_0x20ab('0x56')]));_0x208f35[_0x20ab('0x42')]=_0x208f35['attributes'][_0x20ab('0x43')]?_0x208f35['attributes']:_0x4a1b74[_0x20ab('0x3d')];if(!_0x21ffe1[_0x20ab('0x3f')][_0x20ab('0x44')](_0x20ab('0x45'))){_0x208f35[_0x20ab('0x46')]=qs[_0x20ab('0x46')](_0x21ffe1[_0x20ab('0x3f')]['limit']);_0x208f35[_0x20ab('0x2e')]=qs['offset'](_0x21ffe1[_0x20ab('0x3f')][_0x20ab('0x2e')]);}_0x208f35[_0x20ab('0x47')]=qs[_0x20ab('0x48')](_0x21ffe1[_0x20ab('0x3f')][_0x20ab('0x48')]);_0x208f35[_0x20ab('0x49')]=qs[_0x20ab('0x40')](_[_0x20ab('0x6c')](_0x21ffe1[_0x20ab('0x3f')],_0x4a1b74[_0x20ab('0x40')]));_0x208f35['where'][_0x20ab('0x65')]=_0x11001e['id'];if(_0x21ffe1[_0x20ab('0x3f')][_0x20ab('0x4a')]){_0x208f35['where']=_[_0x20ab('0x50')](_0x208f35[_0x20ab('0x49')],{'$or':_[_0x20ab('0x4b')](_0x208f35['attributes'],function(_0xa391bf){var _0x4c23f8={};_0x4c23f8[_0xa391bf]={'$like':'%'+_0x21ffe1['query'][_0x20ab('0x4a')]+'%'};return _0x4c23f8;})});}_0x208f35=_[_0x20ab('0x50')]({},_0x208f35,_0x21ffe1[_0x20ab('0x57')]);return db[_0x20ab('0xcc')][_0x20ab('0x2d')]({'where':_0x208f35[_0x20ab('0x49')]})[_0x20ab('0x1e')](function(_0x2e2853){_0x494f16[_0x20ab('0x2d')]=_0x2e2853;if(_0x21ffe1[_0x20ab('0x3f')][_0x20ab('0x51')]){_0x208f35[_0x20ab('0x52')]=[{'all':!![]}];}return db[_0x20ab('0xcc')][_0x20ab('0x53')](_0x208f35);})[_0x20ab('0x1e')](function(_0x14bd42){_0x494f16[_0x20ab('0x54')]=_0x14bd42;return _0x494f16;});}})[_0x20ab('0x1e')](respondWithFilteredResult(_0xb2e5b0,_0x208f35))[_0x20ab('0x29')](handleError(_0xb2e5b0,null));};exports['addAgents']=function(_0x5b80db,_0x357033,_0x94798){return db['ChatWebsite'][_0x20ab('0x58')]({'where':{'id':_0x5b80db[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x357033,null))['then'](function(_0x23931b){if(_0x23931b){return _0x23931b[_0x20ab('0x10e')](_0x5b80db[_0x20ab('0x5a')][_0x20ab('0x69')],_[_0x20ab('0xdc')](_0x5b80db[_0x20ab('0x5a')],[_0x20ab('0x69'),'id'])||{})[_0x20ab('0xb0')](function(_0x9b31cd){for(var _0x3d8346=0x0;_0x3d8346<_0x5b80db[_0x20ab('0x5a')]['ids'][_0x20ab('0x43')];_0x3d8346+=0x1){socket[_0x20ab('0x10f')](_0x20ab('0x110'),{'UserId':_0x5b80db['body'][_0x20ab('0x69')][_0x3d8346],'ChatWebsiteId':_0x5b80db[_0x20ab('0x64')]['id']});}return _0x9b31cd;});}})['then'](respondWithResult(_0x357033,null))[_0x20ab('0x29')](handleError(_0x357033,null));};exports['removeAgents']=function(_0x427593,_0x3a9a4a,_0x5cdb38){return db['ChatWebsite'][_0x20ab('0x58')]({'where':{'id':_0x427593[_0x20ab('0x64')]['id']}})[_0x20ab('0x1e')](handleEntityNotFound(_0x3a9a4a,null))[_0x20ab('0x1e')](function(_0x341389){if(_0x341389){return _0x341389[_0x20ab('0x111')](_0x427593[_0x20ab('0x3f')][_0x20ab('0x69')])[_0x20ab('0x1e')](function(){if(_['isArray'](_0x427593[_0x20ab('0x3f')]['ids'])){for(var _0x1c4c5e=0x0;_0x1c4c5e<_0x427593[_0x20ab('0x3f')]['ids']['length'];_0x1c4c5e+=0x1){socket[_0x20ab('0x10f')](_0x20ab('0x112'),{'UserId':Number(_0x427593[_0x20ab('0x3f')][_0x20ab('0x69')][_0x1c4c5e]),'ChatWebsiteId':Number(_0x427593[_0x20ab('0x64')]['id'])});}}else{socket[_0x20ab('0x10f')](_0x20ab('0x112'),{'UserId':Number(_0x427593['query'][_0x20ab('0x69')]),'ChatWebsiteId':Number(_0x427593['params']['id'])});}});}})[_0x20ab('0x1e')](respondWithStatusCode(_0x3a9a4a,null))[_0x20ab('0x29')](handleError(_0x3a9a4a,null));};exports['getAgents']=function(_0x6e7d24,_0x18bffa,_0x5039dc){var _0x1795e1={};var _0x286d7d={};var _0x120217;var _0x38b1b3;return db[_0x20ab('0x3b')][_0x20ab('0x68')]({'where':{'id':_0x6e7d24[_0x20ab('0x64')]['id']}})['then'](handleEntityNotFound(_0x18bffa,null))[_0x20ab('0x1e')](function(_0x12f404){if(_0x12f404){_0x120217=_0x12f404;_0x286d7d['model']=_[_0x20ab('0x3e')](db[_0x20ab('0xbb')][_0x20ab('0x3c')]);_0x286d7d[_0x20ab('0x3f')]=_[_0x20ab('0x3e')](_0x6e7d24[_0x20ab('0x3f')]);_0x286d7d[_0x20ab('0x40')]=_['intersection'](_0x286d7d[_0x20ab('0x3d')],_0x286d7d[_0x20ab('0x3f')]);_0x1795e1['attributes']=_[_0x20ab('0x41')](_0x286d7d['model'],qs[_0x20ab('0x56')](_0x6e7d24['query'][_0x20ab('0x56')]));_0x1795e1['attributes']=_0x1795e1['attributes']['length']?_0x1795e1['attributes']:_0x286d7d[_0x20ab('0x3d')];_0x1795e1['order']=qs[_0x20ab('0x48')](_0x6e7d24[_0x20ab('0x3f')][_0x20ab('0x48')]);_0x1795e1[_0x20ab('0x49')]=qs[_0x20ab('0x40')](_[_0x20ab('0x6c')](_0x6e7d24['query'],_0x286d7d[_0x20ab('0x40')]));if(_0x6e7d24[_0x20ab('0x3f')][_0x20ab('0x4a')]){_0x1795e1[_0x20ab('0x49')]=_['merge'](_0x1795e1[_0x20ab('0x49')],{'$or':_[_0x20ab('0x4b')](_0x1795e1[_0x20ab('0x42')],function(_0x435583){var _0x1b5e41={};_0x1b5e41[_0x435583]={'$like':'%'+_0x6e7d24[_0x20ab('0x3f')][_0x20ab('0x4a')]+'%'};return _0x1b5e41;})});}_0x1795e1=_[_0x20ab('0x50')]({},_0x1795e1,_0x6e7d24[_0x20ab('0x57')]);return _0x120217['getAgents'](_0x1795e1);}})[_0x20ab('0x1e')](function(_0x2c67dd){if(_0x2c67dd){_0x38b1b3=_0x2c67dd[_0x20ab('0x43')];if(!_0x6e7d24[_0x20ab('0x3f')][_0x20ab('0x44')](_0x20ab('0x45'))){_0x1795e1['limit']=qs[_0x20ab('0x46')](_0x6e7d24[_0x20ab('0x3f')][_0x20ab('0x46')]);_0x1795e1[_0x20ab('0x2e')]=qs['offset'](_0x6e7d24[_0x20ab('0x3f')]['offset']);}return _0x120217[_0x20ab('0x113')](_0x1795e1);}})['then'](function(_0x25f6a4){if(_0x25f6a4){return _0x25f6a4?{'count':_0x38b1b3,'rows':_0x25f6a4}:null;}})[_0x20ab('0x1e')](respondWithResult(_0x18bffa,null))[_0x20ab('0x29')](handleError(_0x18bffa,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 203875a..60b6a89 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 _0x4422=['emit','hook','exports','events','setMaxListeners','update','remove'];(function(_0x2ea900,_0xd4c112){var _0x20ab6e=function(_0x4cc0ca){while(--_0x4cc0ca){_0x2ea900['push'](_0x2ea900['shift']());}};_0x20ab6e(++_0xd4c112);}(_0x4422,0xab));var _0x2442=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4422[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x2442('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2442('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2442('0x2'),'afterDestroy':_0x2442('0x3')};function emitEvent(_0x5b09f3){return function(_0x58a5f0,_0x3d2979,_0xda4a3e){ChatWebsiteEvents[_0x2442('0x4')](_0x5b09f3+':'+_0x58a5f0['id'],_0x58a5f0);ChatWebsiteEvents[_0x2442('0x4')](_0x5b09f3,_0x58a5f0);_0xda4a3e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x2442('0x5')](e,emitEvent(event));}}module[_0x2442('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xfcda=['events','../../mysqldb','setMaxListeners','emit','hasOwnProperty','exports'];(function(_0x35af4c,_0x4039f2){var _0x215308=function(_0x12eba2){while(--_0x12eba2){_0x35af4c['push'](_0x35af4c['shift']());}};_0x215308(++_0x4039f2);}(_0xfcda,0x198));var _0xafcd=function(_0x493221,_0x282a30){_0x493221=_0x493221-0x0;var _0x527301=_0xfcda[_0x493221];return _0x527301;};'use strict';var EventEmitter=require(_0xafcd('0x0'));var ChatWebsite=require(_0xafcd('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xafcd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32a471){return function(_0x187185,_0x18d3fd,_0x20b8bb){ChatWebsiteEvents[_0xafcd('0x3')](_0x32a471+':'+_0x187185['id'],_0x187185);ChatWebsiteEvents[_0xafcd('0x3')](_0x32a471,_0x187185);_0x20b8bb(null);};}for(var e in events){if(events[_0xafcd('0x4')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xafcd('0x5')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 08e8c30..933a02d 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 _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','../../config/logger'];(function(_0x37ba84,_0x449c8c){var _0x43dc4f=function(_0x2eee47){while(--_0x2eee47){_0x37ba84['push'](_0x37ba84['shift']());}};_0x43dc4f(++_0x449c8c);}(_0x0427,0x137));var _0x7042=function(_0x287b62,_0x57ebaa){_0x287b62=_0x287b62-0x0;var _0xa9825d=_0x0427[_0x287b62];return _0xa9825d;};'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'));module[_0x7042('0x8')]=function(_0x53ab81,_0x37a35b){return _0x53ab81[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80df=['../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var logger=require(_0xf80d('0x2'))(_0xf80d('0x3'));var moment=require('moment');var BPromise=require(_0xf80d('0x4'));var rp=require(_0xf80d('0x5'));var fs=require('fs');var path=require(_0xf80d('0x6'));var rimraf=require(_0xf80d('0x7'));var config=require(_0xf80d('0x8'));var attributes=require(_0xf80d('0x9'));module[_0xf80d('0xa')]=function(_0xeffeb7,_0x1c9b19){return _0xeffeb7[_0xf80d('0xb')]('ChatWebsite',attributes,{'tableName':_0xf80d('0xc'),'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 d4138e4..8c5a180 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 _0xafc4=['error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40922f,_0x50ecbd){var _0x50c760=function(_0x491c26){while(--_0x491c26){_0x40922f['push'](_0x40922f['shift']());}};_0x50c760(++_0x50ecbd);}(_0xafc4,0x69));var _0x4afc=function(_0xd25bc,_0x58f058){_0xd25bc=_0xd25bc-0x0;var _0x177b30=_0xafc4[_0xd25bc];return _0x177b30;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});config[_0x4afc('0x9')]=_[_0x4afc('0xa')](config[_0x4afc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4afc('0xb'))(new Redis(config[_0x4afc('0x9')]));require(_0x4afc('0xc'))[_0x4afc('0xd')](socket);function respondWithRpcPromise(_0x1b8981,_0x458fde,_0x5542ec){return new BPromise(function(_0x5c523b,_0x7f127f){return client['request'](_0x1b8981,_0x5542ec)[_0x4afc('0xe')](function(_0x225793){logger['info'](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));logger[_0x4afc('0x11')](_0x4afc('0x12'),_0x458fde,_0x4afc('0x10'),JSON[_0x4afc('0x13')](_0x225793));if(_0x225793[_0x4afc('0x14')]){if(_0x225793[_0x4afc('0x14')]['code']===0x1f4){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x7f127f(_0x225793['error']['message']);}logger[_0x4afc('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x5c523b(_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);}else{logger[_0x4afc('0x16')](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));_0x5c523b(_0x225793[_0x4afc('0x17')][_0x4afc('0x15')]);}})[_0x4afc('0x18')](function(_0x178229){logger['error'](_0x4afc('0xf'),_0x458fde,_0x178229);_0x7f127f(_0x178229);});});} \ No newline at end of file +var _0xc1c6=['./chatWebsite.socket','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x3f1687,_0x415b3f){var _0x273f93=function(_0x28e920){while(--_0x28e920){_0x3f1687['push'](_0x3f1687['shift']());}};_0x273f93(++_0x415b3f);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1981d8,_0x257a93){_0x1981d8=_0x1981d8-0x0;var _0x425148=_0xc1c6[_0x1981d8];return _0x425148;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});config['redis']=_[_0x6c1c('0x9')](config[_0x6c1c('0xa')],{'host':_0x6c1c('0xb'),'port':0x18eb});var socket=require(_0x6c1c('0xc'))(new Redis(config['redis']));require(_0x6c1c('0xd'))[_0x6c1c('0xe')](socket);function respondWithRpcPromise(_0x524d21,_0x147c7b,_0x36275f){return new BPromise(function(_0xb3bd12,_0x1137e8){return client['request'](_0x524d21,_0x36275f)[_0x6c1c('0xf')](function(_0x2a4fd4){logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));logger[_0x6c1c('0x12')](_0x6c1c('0x13'),_0x147c7b,'request\x20sent',JSON[_0x6c1c('0x14')](_0x2a4fd4));if(_0x2a4fd4['error']){if(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x16')]===0x1f4){logger[_0x6c1c('0x15')](_0x6c1c('0x17'),_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0x1137e8(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);}logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0xb3bd12(_0x2a4fd4['error'][_0x6c1c('0x18')]);}else{logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));_0xb3bd12(_0x2a4fd4['result'][_0x6c1c('0x18')]);}})[_0x6c1c('0x19')](function(_0x5a3bb7){logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x5a3bb7);_0x1137e8(_0x5a3bb7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 0012b9a..70409e5 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(_0x298064,_0x1d2bfb){var _0x2512ea=function(_0x3e5b28){while(--_0x3e5b28){_0x298064['push'](_0x298064['shift']());}};_0x2512ea(++_0x1d2bfb);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d4e87,_0x3da0bc){_0x4d4e87=_0x4d4e87-0x0;var _0x580ca3=_0xb10b[_0x4d4e87];return _0x580ca3;};'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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x195690,_0x13d76e){var _0xcd8219=function(_0x5b918e){while(--_0x5b918e){_0x195690['push'](_0x195690['shift']());}};_0xcd8219(++_0x13d76e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x41f01d,_0x19f328){_0x41f01d=_0x41f01d-0x0;var _0x1a1220=_0x5f2f[_0x41f01d];return _0x1a1220;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ae2f800..5901901 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 _0x4b2c=['getProactiveActions','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','/:id/avatar','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getLogo','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x4b2c,0x1b0));var _0xc4b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b2c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc4b2('0x0'));var util=require(_0xc4b2('0x1'));var path=require(_0xc4b2('0x2'));var timeout=require(_0xc4b2('0x3'));var express=require(_0xc4b2('0x4'));var router=express[_0xc4b2('0x5')]();var auth=require(_0xc4b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc4b2('0x7'));var controller=require(_0xc4b2('0x8'));router['get']('/',auth[_0xc4b2('0x9')](),controller[_0xc4b2('0xa')]);router[_0xc4b2('0xb')](_0xc4b2('0xc'),auth[_0xc4b2('0x9')](),controller[_0xc4b2('0xd')]);router[_0xc4b2('0xb')](_0xc4b2('0xe'),auth['isAuthenticated'](),controller[_0xc4b2('0xf')]);router['get'](_0xc4b2('0x10'),auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x11')]);router[_0xc4b2('0xb')]('/:id/canned_answers',auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x12')]);router[_0xc4b2('0xb')]('/:id/logo',controller[_0xc4b2('0x13')]);router[_0xc4b2('0xb')]('/:id/avatar',controller['getAvatar']);router['get'](_0xc4b2('0x14'),controller['getCustomerAvatar']);router[_0xc4b2('0xb')](_0xc4b2('0x15'),controller[_0xc4b2('0x16')]);router[_0xc4b2('0xb')](_0xc4b2('0x17'),auth['isAuthenticated'](),controller[_0xc4b2('0x18')]);router['get'](_0xc4b2('0x19'),controller[_0xc4b2('0x1a')]);router[_0xc4b2('0xb')](_0xc4b2('0x1b'),auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x1c')]);router[_0xc4b2('0xb')](_0xc4b2('0x1d'),auth['isAuthenticated'](),controller[_0xc4b2('0x1e')]);router['get']('/:id/fields',controller['getFields']);router['get']('/:id/offline_messages',auth[_0xc4b2('0x9')](),controller['getOfflineMessages']);router[_0xc4b2('0xb')](_0xc4b2('0x1f'),auth['isAuthenticated'](),controller[_0xc4b2('0x20')]);router[_0xc4b2('0x21')]('/',auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x22')]);router[_0xc4b2('0x21')](_0xc4b2('0x10'),auth[_0xc4b2('0x9')](),controller['addDisposition']);router[_0xc4b2('0x21')](_0xc4b2('0x23'),auth['isAuthenticated'](),controller[_0xc4b2('0x24')]);var upload=multer({'storage':multer[_0xc4b2('0x25')]({'destination':function(_0xb3ab61,_0x16e346,_0x46493c){_0x46493c(null,path[_0xc4b2('0x26')](config[_0xc4b2('0x27')],_0xc4b2('0x28')));},'filename':function(_0x2e957a,_0x120187,_0x1a97a2){_0x1a97a2(null,util[_0xc4b2('0x29')](_0xc4b2('0x2a'),Date[_0xc4b2('0x2b')](),_0x120187[_0xc4b2('0x2c')]));}})});router[_0xc4b2('0x21')](_0xc4b2('0x2d'),upload[_0xc4b2('0x2e')](_0xc4b2('0x2f')),controller[_0xc4b2('0x30')]);var upload=multer({'storage':multer[_0xc4b2('0x25')]({'destination':function(_0x1094d3,_0x2bfdf5,_0x4123a6){_0x4123a6(null,path[_0xc4b2('0x26')](config['root'],_0xc4b2('0x31')));},'filename':function(_0x3fab84,_0x247781,_0x4e9622){_0x4e9622(null,util[_0xc4b2('0x29')](_0xc4b2('0x2a'),Date[_0xc4b2('0x2b')](),_0x247781[_0xc4b2('0x2c')]));}})});router[_0xc4b2('0x21')](_0xc4b2('0x32'),upload[_0xc4b2('0x2e')](_0xc4b2('0x2f')),controller[_0xc4b2('0x33')]);var upload=multer({'storage':multer[_0xc4b2('0x25')]({'destination':function(_0x448ba9,_0x4d2705,_0x55fc28){_0x55fc28(null,path['join'](config['root'],_0xc4b2('0x31')));},'filename':function(_0x5b9700,_0x31b95b,_0x412dd8){_0x412dd8(null,util[_0xc4b2('0x29')](_0xc4b2('0x2a'),Date[_0xc4b2('0x2b')](),_0x31b95b[_0xc4b2('0x2c')]));}})});router['post'](_0xc4b2('0x14'),upload['single'](_0xc4b2('0x2f')),controller[_0xc4b2('0x34')]);var upload=multer({'storage':multer[_0xc4b2('0x25')]({'destination':function(_0x131b86,_0x1dc1eb,_0x2e684a){_0x2e684a(null,path[_0xc4b2('0x26')](config['root'],_0xc4b2('0x31')));},'filename':function(_0xab7c16,_0x5c39fa,_0x5ba149){_0x5ba149(null,util[_0xc4b2('0x29')]('%s-%s',Date[_0xc4b2('0x2b')](),_0x5c39fa[_0xc4b2('0x2c')]));}})});router[_0xc4b2('0x21')](_0xc4b2('0x15'),upload[_0xc4b2('0x2e')]('file'),controller[_0xc4b2('0x35')]);router['post'](_0xc4b2('0x36'),controller[_0xc4b2('0x37')]);router['post'](_0xc4b2('0x38'),controller['offline']);router[_0xc4b2('0x21')]('/:id/interactions',auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x39')]);router[_0xc4b2('0x21')]('/:id/applications',auth[_0xc4b2('0x9')](),controller['addApplications']);router['post']('/:id/proactive_actions',auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x3a')]);router[_0xc4b2('0x21')](_0xc4b2('0x1f'),auth['isAuthenticated'](),controller[_0xc4b2('0x3b')]);router[_0xc4b2('0x3c')](_0xc4b2('0xe'),auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x3d')]);router['delete'](_0xc4b2('0xe'),auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x3e')]);router[_0xc4b2('0x3f')](_0xc4b2('0x10'),auth[_0xc4b2('0x9')](),controller[_0xc4b2('0x40')]);router[_0xc4b2('0x3f')](_0xc4b2('0x23'),auth['isAuthenticated'](),controller[_0xc4b2('0x41')]);router[_0xc4b2('0x3f')](_0xc4b2('0x1f'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x197c=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','join','server/files/images/avatars/','originalname','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','addAgents','put','update','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x197c,0xc1));var _0xc197=function(_0x5736f0,_0x41e20b){_0x5736f0=_0x5736f0-0x0;var _0x834986=_0x197c[_0x5736f0];return _0x834986;};'use strict';var multer=require(_0xc197('0x0'));var util=require(_0xc197('0x1'));var path=require(_0xc197('0x2'));var timeout=require('connect-timeout');var express=require(_0xc197('0x3'));var router=express[_0xc197('0x4')]();var auth=require(_0xc197('0x5'));var interaction=require(_0xc197('0x6'));var config=require(_0xc197('0x7'));var controller=require('./chatWebsite.controller');router[_0xc197('0x8')]('/',auth[_0xc197('0x9')](),controller[_0xc197('0xa')]);router['get'](_0xc197('0xb'),auth[_0xc197('0x9')](),controller[_0xc197('0xc')]);router[_0xc197('0x8')](_0xc197('0xd'),auth[_0xc197('0x9')](),controller[_0xc197('0xe')]);router[_0xc197('0x8')](_0xc197('0xf'),auth[_0xc197('0x9')](),controller[_0xc197('0x10')]);router[_0xc197('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc197('0x11')]);router[_0xc197('0x8')](_0xc197('0x12'),controller['getLogo']);router[_0xc197('0x8')](_0xc197('0x13'),controller[_0xc197('0x14')]);router[_0xc197('0x8')](_0xc197('0x15'),controller[_0xc197('0x16')]);router[_0xc197('0x8')](_0xc197('0x17'),controller[_0xc197('0x18')]);router[_0xc197('0x8')](_0xc197('0x19'),auth[_0xc197('0x9')](),controller[_0xc197('0x1a')]);router[_0xc197('0x8')](_0xc197('0x1b'),controller['getSnippet']);router[_0xc197('0x8')](_0xc197('0x1c'),auth[_0xc197('0x9')](),controller['getApplications']);router[_0xc197('0x8')](_0xc197('0x1d'),auth['isAuthenticated'](),controller[_0xc197('0x1e')]);router['get'](_0xc197('0x1f'),controller[_0xc197('0x20')]);router[_0xc197('0x8')](_0xc197('0x21'),auth['isAuthenticated'](),controller[_0xc197('0x22')]);router[_0xc197('0x8')](_0xc197('0x23'),auth[_0xc197('0x9')](),controller[_0xc197('0x24')]);router['post']('/',auth[_0xc197('0x9')](),controller['create']);router[_0xc197('0x25')](_0xc197('0xf'),auth[_0xc197('0x9')](),controller['addDisposition']);router[_0xc197('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc197('0x26')]);var upload=multer({'storage':multer[_0xc197('0x27')]({'destination':function(_0x4ff358,_0x342fa4,_0x767aa5){_0x767aa5(null,path['join'](config[_0xc197('0x28')],_0xc197('0x29')));},'filename':function(_0x41cdee,_0x5ace85,_0x440464){_0x440464(null,util[_0xc197('0x2a')](_0xc197('0x2b'),Date[_0xc197('0x2c')](),_0x5ace85['originalname']));}})});router[_0xc197('0x25')](_0xc197('0x12'),upload[_0xc197('0x2d')](_0xc197('0x2e')),controller[_0xc197('0x2f')]);var upload=multer({'storage':multer[_0xc197('0x27')]({'destination':function(_0xa1f3ae,_0x1a8a1b,_0x397f3f){_0x397f3f(null,path[_0xc197('0x30')](config[_0xc197('0x28')],_0xc197('0x31')));},'filename':function(_0x3a7f9a,_0x2ef857,_0x308057){_0x308057(null,util['format'](_0xc197('0x2b'),Date['now'](),_0x2ef857[_0xc197('0x32')]));}})});router[_0xc197('0x25')](_0xc197('0x13'),upload[_0xc197('0x2d')](_0xc197('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0xc197('0x27')]({'destination':function(_0x9204e1,_0x237dc9,_0x12d944){_0x12d944(null,path[_0xc197('0x30')](config['root'],_0xc197('0x31')));},'filename':function(_0x10f014,_0x3a10d3,_0x410bda){_0x410bda(null,util[_0xc197('0x2a')](_0xc197('0x2b'),Date['now'](),_0x3a10d3['originalname']));}})});router[_0xc197('0x25')]('/:id/customer_avatar',upload[_0xc197('0x2d')](_0xc197('0x2e')),controller[_0xc197('0x33')]);var upload=multer({'storage':multer[_0xc197('0x27')]({'destination':function(_0x494ad1,_0x4bc808,_0x1805ec){_0x1805ec(null,path['join'](config[_0xc197('0x28')],'server/files/images/avatars/'));},'filename':function(_0x2c23b5,_0x181b2e,_0x3eca7d){_0x3eca7d(null,util[_0xc197('0x2a')](_0xc197('0x2b'),Date[_0xc197('0x2c')](),_0x181b2e['originalname']));}})});router['post'](_0xc197('0x17'),upload[_0xc197('0x2d')](_0xc197('0x2e')),controller[_0xc197('0x34')]);router[_0xc197('0x25')](_0xc197('0x35'),controller[_0xc197('0x36')]);router['post'](_0xc197('0x37'),controller[_0xc197('0x38')]);router[_0xc197('0x25')](_0xc197('0x19'),auth[_0xc197('0x9')](),controller['addInteraction']);router[_0xc197('0x25')]('/:id/applications',auth['isAuthenticated'](),controller[_0xc197('0x39')]);router['post']('/:id/proactive_actions',auth[_0xc197('0x9')](),controller['addProactiveActions']);router[_0xc197('0x25')]('/:id/users',auth[_0xc197('0x9')](),controller[_0xc197('0x3a')]);router[_0xc197('0x3b')](_0xc197('0xd'),auth[_0xc197('0x9')](),controller[_0xc197('0x3c')]);router['delete']('/:id',auth[_0xc197('0x9')](),controller[_0xc197('0x3d')]);router[_0xc197('0x3e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc197('0x3f')]);router['delete'](_0xc197('0x40'),auth[_0xc197('0x9')](),controller[_0xc197('0x41')]);router[_0xc197('0x3e')](_0xc197('0x23'),auth[_0xc197('0x9')](),controller[_0xc197('0x42')]);module[_0xc197('0x43')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index fc980fe..6b9e323 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 _0x4c79=['STRING'];(function(_0x3b729e,_0xf58096){var _0x48939e=function(_0x1fb46c){while(--_0x1fb46c){_0x3b729e['push'](_0x3b729e['shift']());}};_0x48939e(++_0xf58096);}(_0x4c79,0x13f));var _0x94c7=function(_0x99ba67,_0x10eae9){_0x99ba67=_0x99ba67-0x0;var _0x5c4f7d=_0x4c79[_0x99ba67];return _0x5c4f7d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x94c7('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x94c7('0x0')]},'companyId':{'type':Sequelize[_0x94c7('0x0')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x94c7('0x0')]},'fax':{'type':Sequelize[_0x94c7('0x0')]},'type':{'type':Sequelize[_0x94c7('0x0')]},'street':{'type':Sequelize[_0x94c7('0x0')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x94c7('0x0')]},'country':{'type':Sequelize[_0x94c7('0x0')]},'email':{'type':Sequelize[_0x94c7('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x94c7('0x0')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x94c7('0x0')]},'sCountry':{'type':Sequelize[_0x94c7('0x0')]},'description':{'type':Sequelize[_0x94c7('0x0')]}}; \ No newline at end of file +var _0x7d42=['STRING','name','exports'];(function(_0x1ecd2d,_0x3e247a){var _0x17aba7=function(_0x1acd9b){while(--_0x1acd9b){_0x1ecd2d['push'](_0x1ecd2d['shift']());}};_0x17aba7(++_0x3e247a);}(_0x7d42,0x16a));var _0x27d4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7d42[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0x27d4('0x0')]={'name':{'type':Sequelize[_0x27d4('0x1')],'unique':_0x27d4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x27d4('0x1')]},'companyId':{'type':Sequelize[_0x27d4('0x1')]},'website':{'type':Sequelize[_0x27d4('0x1')]},'phone':{'type':Sequelize[_0x27d4('0x1')]},'fax':{'type':Sequelize[_0x27d4('0x1')]},'type':{'type':Sequelize[_0x27d4('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x27d4('0x1')]},'country':{'type':Sequelize[_0x27d4('0x1')]},'email':{'type':Sequelize[_0x27d4('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x27d4('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x27d4('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x27d4('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index eabde2e..99a23c1 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 _0x2bd8=['limit','status','set','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','index','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','map','includeAll','include','CmCompany','findAll','rows','params','keys','rawAttributes','length','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','omit','ids','getContacts','findOne','CmContact','where','pick','options','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset'];(function(_0x1c4438,_0x385c54){var _0x5497cb=function(_0x4d7ef2){while(--_0x4d7ef2){_0x1c4438['push'](_0x1c4438['shift']());}};_0x5497cb(++_0x385c54);}(_0x2bd8,0x130));var _0x82bd=function(_0x57184b,_0x2b2ede){_0x57184b=_0x57184b-0x0;var _0x2d3148=_0x2bd8[_0x57184b];return _0x2d3148;};'use strict';var pdf=require(_0x82bd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x82bd('0x1'));var zipdir=require(_0x82bd('0x2'));var jsonpatch=require(_0x82bd('0x3'));var rp=require(_0x82bd('0x4'));var moment=require(_0x82bd('0x5'));var BPromise=require(_0x82bd('0x6'));var Mustache=require(_0x82bd('0x7'));var util=require('util');var path=require(_0x82bd('0x8'));var sox=require(_0x82bd('0x9'));var csv=require(_0x82bd('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x82bd('0xb'));var squel=require(_0x82bd('0xc'));var crypto=require(_0x82bd('0xd'));var jsforce=require(_0x82bd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x82bd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82bd('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x82bd('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x82bd('0x11'));var db=require(_0x82bd('0x12'))['db'];function respondWithStatusCode(_0x5a6a2d,_0x140ad6){_0x140ad6=_0x140ad6||0xcc;return function(_0x5f1ab9){if(_0x5f1ab9){return _0x5a6a2d[_0x82bd('0x13')](_0x140ad6);}return _0x5a6a2d['status'](_0x140ad6)[_0x82bd('0x14')]();};}function respondWithResult(_0x3c4042,_0x1b2324){_0x1b2324=_0x1b2324||0xc8;return function(_0x2ca530){if(_0x2ca530){return _0x3c4042['status'](_0x1b2324)[_0x82bd('0x15')](_0x2ca530);}};}function respondWithFilteredResult(_0xd43e79,_0x52e533){return function(_0x3667ef){if(_0x3667ef){var _0x4db39d=_0x3667ef[_0x82bd('0x16')],_0x35dd09=_0x52e533[_0x82bd('0x17')],_0x433e7d=_0x52e533[_0x82bd('0x17')]+_0x52e533[_0x82bd('0x18')],_0x2c5155;if(_0x433e7d>=_0x4db39d){_0x433e7d=_0x4db39d;_0x2c5155=0xc8;}else{_0x2c5155=0xce;}_0xd43e79[_0x82bd('0x19')](_0x2c5155);return _0xd43e79[_0x82bd('0x1a')](_0x82bd('0x1b'),_0x35dd09+'-'+_0x433e7d+'/'+_0x4db39d)[_0x82bd('0x15')](_0x3667ef);}return null;};}function patchUpdates(_0x29b689){return function(_0x1c3779){try{jsonpatch[_0x82bd('0x1c')](_0x1c3779,_0x29b689,!![]);}catch(_0x4a1e62){return BPromise['reject'](_0x4a1e62);}return _0x1c3779[_0x82bd('0x1d')]();};}function saveUpdates(_0x3eb844,_0x2ee27c){return function(_0xc9fcdf){if(_0xc9fcdf){return _0xc9fcdf[_0x82bd('0x1e')](_0x3eb844)[_0x82bd('0x1f')](function(_0x2c1810){return _0x2c1810;});}return null;};}function removeEntity(_0x32954d,_0x1fc715){return function(_0x3291cd){if(_0x3291cd){return _0x3291cd[_0x82bd('0x20')]()[_0x82bd('0x1f')](function(){var _0x1ca91f=_0x3291cd[_0x82bd('0x21')]({'plain':!![]});var _0x3d9f03=_0x82bd('0x22');return db[_0x82bd('0x23')][_0x82bd('0x20')]({'where':{'type':_0x3d9f03,'resourceId':_0x1ca91f['id']}})[_0x82bd('0x1f')](function(){return _0x3291cd;});})['then'](function(){_0x32954d['status'](0xcc)[_0x82bd('0x14')]();});}};}function handleEntityNotFound(_0x436ecd,_0x1cb292){return function(_0x3eb6a5){if(!_0x3eb6a5){_0x436ecd[_0x82bd('0x13')](0x194);}return _0x3eb6a5;};}function handleError(_0x10d101,_0x3c7751){_0x3c7751=_0x3c7751||0x1f4;return function(_0xbef23b){logger[_0x82bd('0x24')](_0xbef23b[_0x82bd('0x25')]);if(_0xbef23b['name']){delete _0xbef23b['name'];}_0x10d101['status'](_0x3c7751)['send'](_0xbef23b);};}exports[_0x82bd('0x26')]=function(_0x52bcd8,_0x351d3d){var _0x190bca={},_0x363ef9={},_0x50585e={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x82bd('0x1f')](function(_0x2a5867){_0x363ef9[_0x82bd('0x27')]=_['keys'](_0x2a5867);_0x363ef9[_0x82bd('0x28')]=_['keys'](_0x52bcd8[_0x82bd('0x28')]);_0x363ef9[_0x82bd('0x29')]=_[_0x82bd('0x2a')](_0x363ef9[_0x82bd('0x27')],_0x363ef9[_0x82bd('0x28')]);_0x190bca[_0x82bd('0x2b')]=_['intersection'](_0x363ef9[_0x82bd('0x27')],qs[_0x82bd('0x2c')](_0x52bcd8[_0x82bd('0x28')]['fields']));_0x190bca[_0x82bd('0x2b')]=_0x190bca['attributes']['length']?_0x190bca[_0x82bd('0x2b')]:_0x363ef9[_0x82bd('0x27')];if(!_0x52bcd8[_0x82bd('0x28')][_0x82bd('0x2d')](_0x82bd('0x2e'))){_0x190bca[_0x82bd('0x18')]=qs[_0x82bd('0x18')](_0x52bcd8[_0x82bd('0x28')][_0x82bd('0x18')]);_0x190bca[_0x82bd('0x17')]=qs[_0x82bd('0x17')](_0x52bcd8[_0x82bd('0x28')][_0x82bd('0x17')]);}_0x190bca[_0x82bd('0x2f')]=qs[_0x82bd('0x30')](_0x52bcd8[_0x82bd('0x28')][_0x82bd('0x30')]);_0x190bca['where']=qs['filters'](_['pick'](_0x52bcd8[_0x82bd('0x28')],_0x363ef9[_0x82bd('0x29')]));if(_0x52bcd8['query'][_0x82bd('0x31')]){_0x190bca['where']=_['merge'](_0x190bca['where'],{'$or':_[_0x82bd('0x32')](_0x190bca[_0x82bd('0x2b')],function(_0x28e521){var _0x396585={};_0x396585[_0x28e521]={'$like':'%'+_0x52bcd8[_0x82bd('0x28')]['filter']+'%'};return _0x396585;})});}_0x190bca=_['merge']({},_0x190bca,_0x52bcd8['options']);var _0x64bc54={'where':_0x190bca['where']};return db['CmCompany'][_0x82bd('0x16')](_0x64bc54)[_0x82bd('0x1f')](function(_0x3192e2){_0x50585e[_0x82bd('0x16')]=_0x3192e2;if(_0x52bcd8[_0x82bd('0x28')][_0x82bd('0x33')]){_0x190bca[_0x82bd('0x34')]=[{'all':!![]}];}return db[_0x82bd('0x35')][_0x82bd('0x36')](_0x190bca);})['then'](function(_0x5c7661){_0x50585e[_0x82bd('0x37')]=_0x5c7661;return _0x50585e;})[_0x82bd('0x1f')](respondWithFilteredResult(_0x351d3d,_0x190bca))['catch'](handleError(_0x351d3d,null));});};exports['show']=function(_0x277b7a,_0x18a697){var _0x4d310b={'raw':![],'where':{'id':_0x277b7a[_0x82bd('0x38')]['id']}},_0x121f1f={};_0x121f1f[_0x82bd('0x27')]=_[_0x82bd('0x39')](db[_0x82bd('0x35')][_0x82bd('0x3a')]);_0x121f1f[_0x82bd('0x28')]=_[_0x82bd('0x39')](_0x277b7a[_0x82bd('0x28')]);_0x121f1f[_0x82bd('0x29')]=_[_0x82bd('0x2a')](_0x121f1f[_0x82bd('0x27')],_0x121f1f['query']);_0x4d310b[_0x82bd('0x2b')]=_[_0x82bd('0x2a')](_0x121f1f['model'],qs['fields'](_0x277b7a[_0x82bd('0x28')][_0x82bd('0x2c')]));_0x4d310b[_0x82bd('0x2b')]=_0x4d310b[_0x82bd('0x2b')][_0x82bd('0x3b')]?_0x4d310b['attributes']:_0x121f1f['model'];if(_0x277b7a[_0x82bd('0x28')][_0x82bd('0x33')]){_0x4d310b['include']=[{'all':!![]}];}_0x4d310b=_[_0x82bd('0x3c')]({},_0x4d310b,_0x277b7a['options']);return db[_0x82bd('0x35')][_0x82bd('0x3d')](_0x4d310b)['then'](handleEntityNotFound(_0x18a697,null))[_0x82bd('0x1f')](respondWithResult(_0x18a697,null))[_0x82bd('0x3e')](handleError(_0x18a697,null));};exports['create']=function(_0x498824,_0x403afe){return db['CmCompany'][_0x82bd('0x3f')](_0x498824[_0x82bd('0x40')],{})[_0x82bd('0x1f')](function(_0x462da0){var _0x4eca1e=_0x498824['user'][_0x82bd('0x21')]({'plain':!![]});if(!_0x4eca1e)throw new Error(_0x82bd('0x41'));if(_0x4eca1e['role']===_0x82bd('0x42')){var _0x350ab6=_0x462da0[_0x82bd('0x21')]({'plain':!![]});var _0x4d58af=_0x82bd('0x22');return db[_0x82bd('0x43')][_0x82bd('0x3d')]({'where':{'name':_0x4d58af,'userProfileId':_0x4eca1e[_0x82bd('0x44')]},'raw':!![]})[_0x82bd('0x1f')](function(_0x2c2cb9){if(_0x2c2cb9&&_0x2c2cb9[_0x82bd('0x45')]===0x0){return db[_0x82bd('0x23')][_0x82bd('0x3f')]({'name':_0x350ab6[_0x82bd('0x46')],'resourceId':_0x350ab6['id'],'type':_0x2c2cb9[_0x82bd('0x46')],'sectionId':_0x2c2cb9['id']},{})[_0x82bd('0x1f')](function(){return _0x462da0;});}else{return _0x462da0;}})[_0x82bd('0x3e')](function(_0x55a0d4){logger[_0x82bd('0x24')](_0x82bd('0x47'),_0x55a0d4);throw _0x55a0d4;});}return _0x462da0;})['then'](respondWithResult(_0x403afe,0xc9))[_0x82bd('0x3e')](handleError(_0x403afe,null));};exports[_0x82bd('0x1e')]=function(_0x8dfe63,_0x4237ef){if(_0x8dfe63['body']['id']){delete _0x8dfe63['body']['id'];}return db[_0x82bd('0x35')]['find']({'where':{'id':_0x8dfe63['params']['id']}})[_0x82bd('0x1f')](handleEntityNotFound(_0x4237ef,null))['then'](saveUpdates(_0x8dfe63['body'],null))[_0x82bd('0x1f')](respondWithResult(_0x4237ef,null))[_0x82bd('0x3e')](handleError(_0x4237ef,null));};exports[_0x82bd('0x20')]=function(_0xcfb5ef,_0x1e80f0){return db[_0x82bd('0x35')][_0x82bd('0x3d')]({'where':{'id':_0xcfb5ef[_0x82bd('0x38')]['id']}})[_0x82bd('0x1f')](handleEntityNotFound(_0x1e80f0,null))[_0x82bd('0x1f')](removeEntity(_0x1e80f0,null))[_0x82bd('0x3e')](handleError(_0x1e80f0,null));};exports[_0x82bd('0x48')]=function(_0x153fad,_0x1a1cdc){return db[_0x82bd('0x35')]['describe']()[_0x82bd('0x1f')](respondWithResult(_0x1a1cdc,null))[_0x82bd('0x3e')](handleError(_0x1a1cdc,null));};exports[_0x82bd('0x49')]=function(_0x354581,_0x9bf8fa,_0x5466d9){return db['CmContact']['find']({'where':{'id':_0x354581['params']['id']}})[_0x82bd('0x1f')](handleEntityNotFound(_0x9bf8fa,null))[_0x82bd('0x1f')](function(_0x1a4620){if(_0x1a4620){return _0x1a4620[_0x82bd('0x49')](_0x354581['body']['ids'],_[_0x82bd('0x4a')](_0x354581[_0x82bd('0x40')],[_0x82bd('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x9bf8fa,null))[_0x82bd('0x3e')](handleError(_0x9bf8fa,null));};exports[_0x82bd('0x4c')]=function(_0x243153,_0xe29090,_0x3f339d){var _0xb40c5e={};var _0x144a47={};var _0x28b2be;var _0x15f843;return db[_0x82bd('0x35')][_0x82bd('0x4d')]({'where':{'id':_0x243153[_0x82bd('0x38')]['id']}})[_0x82bd('0x1f')](handleEntityNotFound(_0xe29090,null))[_0x82bd('0x1f')](function(_0x25ec59){if(_0x25ec59){_0x28b2be=_0x25ec59;_0x144a47[_0x82bd('0x27')]=_[_0x82bd('0x39')](db[_0x82bd('0x4e')]['rawAttributes']);_0x144a47[_0x82bd('0x28')]=_['keys'](_0x243153['query']);_0x144a47[_0x82bd('0x29')]=_['intersection'](_0x144a47[_0x82bd('0x27')],_0x144a47[_0x82bd('0x28')]);_0xb40c5e[_0x82bd('0x2b')]=_[_0x82bd('0x2a')](_0x144a47[_0x82bd('0x27')],qs[_0x82bd('0x2c')](_0x243153[_0x82bd('0x28')][_0x82bd('0x2c')]));_0xb40c5e[_0x82bd('0x2b')]=_0xb40c5e[_0x82bd('0x2b')][_0x82bd('0x3b')]?_0xb40c5e['attributes']:_0x144a47['model'];_0xb40c5e[_0x82bd('0x2f')]=qs[_0x82bd('0x30')](_0x243153['query']['sort']);_0xb40c5e[_0x82bd('0x4f')]=qs[_0x82bd('0x29')](_[_0x82bd('0x50')](_0x243153[_0x82bd('0x28')],_0x144a47['filters']));if(_0x243153[_0x82bd('0x28')]['filter']){_0xb40c5e[_0x82bd('0x4f')]=_[_0x82bd('0x3c')](_0xb40c5e['where'],{'$or':_[_0x82bd('0x32')](_0xb40c5e[_0x82bd('0x2b')],function(_0x44636e){var _0x2e1b07={};_0x2e1b07[_0x44636e]={'$like':'%'+_0x243153['query'][_0x82bd('0x31')]+'%'};return _0x2e1b07;})});}_0xb40c5e=_[_0x82bd('0x3c')]({},_0xb40c5e,_0x243153[_0x82bd('0x51')]);return _0x28b2be[_0x82bd('0x4c')](_0xb40c5e);}})[_0x82bd('0x1f')](function(_0x27dc80){if(_0x27dc80){_0x15f843=_0x27dc80[_0x82bd('0x3b')];if(!_0x243153[_0x82bd('0x28')][_0x82bd('0x2d')]('nolimit')){_0xb40c5e[_0x82bd('0x18')]=qs['limit'](_0x243153['query'][_0x82bd('0x18')]);_0xb40c5e[_0x82bd('0x17')]=qs['offset'](_0x243153[_0x82bd('0x28')]['offset']);}return _0x28b2be[_0x82bd('0x4c')](_0xb40c5e);}})[_0x82bd('0x1f')](function(_0x578b61){if(_0x578b61){return _0x578b61?{'count':_0x15f843,'rows':_0x578b61}:null;}})[_0x82bd('0x1f')](respondWithResult(_0xe29090,null))[_0x82bd('0x3e')](handleError(_0xe29090,null));}; \ No newline at end of file +var _0x8819=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','describe','model','keys','query','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','CmCompany','includeAll','findAll','rows','catch','params','rawAttributes','include','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','addContacts','CmContact','ids','findOne','map','getContacts','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x3a459d,_0x145349){var _0x2eed7a=function(_0x428450){while(--_0x428450){_0x3a459d['push'](_0x3a459d['shift']());}};_0x2eed7a(++_0x145349);}(_0x8819,0x94));var _0x9881=function(_0x568c8f,_0x398c2d){_0x568c8f=_0x568c8f-0x0;var _0x57a684=_0x8819[_0x568c8f];return _0x57a684;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9881('0x0'));var zipdir=require(_0x9881('0x1'));var jsonpatch=require(_0x9881('0x2'));var rp=require(_0x9881('0x3'));var moment=require(_0x9881('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9881('0x5'));var util=require(_0x9881('0x6'));var path=require(_0x9881('0x7'));var sox=require(_0x9881('0x8'));var csv=require(_0x9881('0x9'));var ejs=require(_0x9881('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var hardwareService=require(_0x9881('0x10'));var logger=require('../../config/logger')(_0x9881('0x11'));var utils=require(_0x9881('0x12'));var config=require(_0x9881('0x13'));var db=require(_0x9881('0x14'))['db'];function respondWithStatusCode(_0x5b6bad,_0x3c4a2c){_0x3c4a2c=_0x3c4a2c||0xcc;return function(_0x26ee3f){if(_0x26ee3f){return _0x5b6bad['sendStatus'](_0x3c4a2c);}return _0x5b6bad[_0x9881('0x15')](_0x3c4a2c)['end']();};}function respondWithResult(_0x52744e,_0x48cfe1){_0x48cfe1=_0x48cfe1||0xc8;return function(_0x58f526){if(_0x58f526){return _0x52744e[_0x9881('0x15')](_0x48cfe1)[_0x9881('0x16')](_0x58f526);}};}function respondWithFilteredResult(_0x39f5fb,_0x1947e8){return function(_0x39d127){if(_0x39d127){var _0x1d57ea=_0x39d127[_0x9881('0x17')],_0x4b9d1b=_0x1947e8['offset'],_0x411513=_0x1947e8['offset']+_0x1947e8['limit'],_0x14b5a9;if(_0x411513>=_0x1d57ea){_0x411513=_0x1d57ea;_0x14b5a9=0xc8;}else{_0x14b5a9=0xce;}_0x39f5fb[_0x9881('0x15')](_0x14b5a9);return _0x39f5fb['set'](_0x9881('0x18'),_0x4b9d1b+'-'+_0x411513+'/'+_0x1d57ea)['json'](_0x39d127);}return null;};}function patchUpdates(_0x59ff56){return function(_0x1f6e20){try{jsonpatch[_0x9881('0x19')](_0x1f6e20,_0x59ff56,!![]);}catch(_0x1cbac3){return BPromise[_0x9881('0x1a')](_0x1cbac3);}return _0x1f6e20[_0x9881('0x1b')]();};}function saveUpdates(_0xe97d44,_0x3ae21d){return function(_0x1243cc){if(_0x1243cc){return _0x1243cc[_0x9881('0x1c')](_0xe97d44)[_0x9881('0x1d')](function(_0x32ca84){return _0x32ca84;});}return null;};}function removeEntity(_0x39659b,_0xe60803){return function(_0x300fa6){if(_0x300fa6){return _0x300fa6[_0x9881('0x1e')]()['then'](function(){var _0x493032=_0x300fa6[_0x9881('0x1f')]({'plain':!![]});var _0x513545='Companies';return db[_0x9881('0x20')][_0x9881('0x1e')]({'where':{'type':_0x513545,'resourceId':_0x493032['id']}})['then'](function(){return _0x300fa6;});})['then'](function(){_0x39659b[_0x9881('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bddc1,_0x161f8d){return function(_0x16eeca){if(!_0x16eeca){_0x2bddc1[_0x9881('0x21')](0x194);}return _0x16eeca;};}function handleError(_0x2c3cd1,_0x14e6f9){_0x14e6f9=_0x14e6f9||0x1f4;return function(_0x2f6b7c){logger[_0x9881('0x22')](_0x2f6b7c[_0x9881('0x23')]);if(_0x2f6b7c[_0x9881('0x24')]){delete _0x2f6b7c[_0x9881('0x24')];}_0x2c3cd1[_0x9881('0x15')](_0x14e6f9)[_0x9881('0x25')](_0x2f6b7c);};}exports['index']=function(_0x31956e,_0x41fe0d){var _0x5c2815={},_0x236979={},_0x3d7120={'count':0x0,'rows':[]};return db['CmCompany'][_0x9881('0x26')]()[_0x9881('0x1d')](function(_0x217a1c){_0x236979[_0x9881('0x27')]=_[_0x9881('0x28')](_0x217a1c);_0x236979[_0x9881('0x29')]=_[_0x9881('0x28')](_0x31956e[_0x9881('0x29')]);_0x236979['filters']=_[_0x9881('0x2a')](_0x236979[_0x9881('0x27')],_0x236979[_0x9881('0x29')]);_0x5c2815[_0x9881('0x2b')]=_[_0x9881('0x2a')](_0x236979[_0x9881('0x27')],qs['fields'](_0x31956e[_0x9881('0x29')][_0x9881('0x2c')]));_0x5c2815['attributes']=_0x5c2815[_0x9881('0x2b')][_0x9881('0x2d')]?_0x5c2815[_0x9881('0x2b')]:_0x236979[_0x9881('0x27')];if(!_0x31956e[_0x9881('0x29')]['hasOwnProperty'](_0x9881('0x2e'))){_0x5c2815[_0x9881('0x2f')]=qs[_0x9881('0x2f')](_0x31956e[_0x9881('0x29')][_0x9881('0x2f')]);_0x5c2815[_0x9881('0x30')]=qs[_0x9881('0x30')](_0x31956e[_0x9881('0x29')][_0x9881('0x30')]);}_0x5c2815[_0x9881('0x31')]=qs[_0x9881('0x32')](_0x31956e[_0x9881('0x29')][_0x9881('0x32')]);_0x5c2815[_0x9881('0x33')]=qs[_0x9881('0x34')](_[_0x9881('0x35')](_0x31956e['query'],_0x236979[_0x9881('0x34')]));if(_0x31956e['query'][_0x9881('0x36')]){_0x5c2815['where']=_[_0x9881('0x37')](_0x5c2815[_0x9881('0x33')],{'$or':_['map'](_0x5c2815[_0x9881('0x2b')],function(_0x59e548){var _0x2f298d={};_0x2f298d[_0x59e548]={'$like':'%'+_0x31956e[_0x9881('0x29')][_0x9881('0x36')]+'%'};return _0x2f298d;})});}_0x5c2815=_[_0x9881('0x37')]({},_0x5c2815,_0x31956e['options']);var _0x2b2a0b={'where':_0x5c2815[_0x9881('0x33')]};return db[_0x9881('0x38')][_0x9881('0x17')](_0x2b2a0b)[_0x9881('0x1d')](function(_0x201dcd){_0x3d7120[_0x9881('0x17')]=_0x201dcd;if(_0x31956e['query'][_0x9881('0x39')]){_0x5c2815['include']=[{'all':!![]}];}return db[_0x9881('0x38')][_0x9881('0x3a')](_0x5c2815);})[_0x9881('0x1d')](function(_0x526ceb){_0x3d7120[_0x9881('0x3b')]=_0x526ceb;return _0x3d7120;})[_0x9881('0x1d')](respondWithFilteredResult(_0x41fe0d,_0x5c2815))[_0x9881('0x3c')](handleError(_0x41fe0d,null));});};exports['show']=function(_0x424d71,_0x15d0ba){var _0x4fe13d={'raw':![],'where':{'id':_0x424d71[_0x9881('0x3d')]['id']}},_0x15cdd8={};_0x15cdd8[_0x9881('0x27')]=_[_0x9881('0x28')](db[_0x9881('0x38')][_0x9881('0x3e')]);_0x15cdd8[_0x9881('0x29')]=_[_0x9881('0x28')](_0x424d71[_0x9881('0x29')]);_0x15cdd8[_0x9881('0x34')]=_['intersection'](_0x15cdd8[_0x9881('0x27')],_0x15cdd8[_0x9881('0x29')]);_0x4fe13d[_0x9881('0x2b')]=_[_0x9881('0x2a')](_0x15cdd8[_0x9881('0x27')],qs['fields'](_0x424d71[_0x9881('0x29')][_0x9881('0x2c')]));_0x4fe13d[_0x9881('0x2b')]=_0x4fe13d[_0x9881('0x2b')]['length']?_0x4fe13d[_0x9881('0x2b')]:_0x15cdd8[_0x9881('0x27')];if(_0x424d71[_0x9881('0x29')]['includeAll']){_0x4fe13d[_0x9881('0x3f')]=[{'all':!![]}];}_0x4fe13d=_[_0x9881('0x37')]({},_0x4fe13d,_0x424d71[_0x9881('0x40')]);return db[_0x9881('0x38')][_0x9881('0x41')](_0x4fe13d)[_0x9881('0x1d')](handleEntityNotFound(_0x15d0ba,null))[_0x9881('0x1d')](respondWithResult(_0x15d0ba,null))[_0x9881('0x3c')](handleError(_0x15d0ba,null));};exports[_0x9881('0x42')]=function(_0x33ab0a,_0x4e20f7){return db[_0x9881('0x38')][_0x9881('0x42')](_0x33ab0a[_0x9881('0x43')],{})['then'](function(_0x2b6e21){var _0x24a52b=_0x33ab0a[_0x9881('0x44')]['get']({'plain':!![]});if(!_0x24a52b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24a52b[_0x9881('0x45')]===_0x9881('0x44')){var _0x4732f9=_0x2b6e21[_0x9881('0x1f')]({'plain':!![]});var _0x49c478='Companies';return db[_0x9881('0x46')][_0x9881('0x41')]({'where':{'name':_0x49c478,'userProfileId':_0x24a52b[_0x9881('0x47')]},'raw':!![]})['then'](function(_0x2e22e8){if(_0x2e22e8&&_0x2e22e8[_0x9881('0x48')]===0x0){return db['UserProfileResource'][_0x9881('0x42')]({'name':_0x4732f9[_0x9881('0x24')],'resourceId':_0x4732f9['id'],'type':_0x2e22e8[_0x9881('0x24')],'sectionId':_0x2e22e8['id']},{})[_0x9881('0x1d')](function(){return _0x2b6e21;});}else{return _0x2b6e21;}})[_0x9881('0x3c')](function(_0x32cb89){logger[_0x9881('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32cb89);throw _0x32cb89;});}return _0x2b6e21;})[_0x9881('0x1d')](respondWithResult(_0x4e20f7,0xc9))['catch'](handleError(_0x4e20f7,null));};exports[_0x9881('0x1c')]=function(_0x147bce,_0x7fb92e){if(_0x147bce[_0x9881('0x43')]['id']){delete _0x147bce['body']['id'];}return db['CmCompany'][_0x9881('0x41')]({'where':{'id':_0x147bce[_0x9881('0x3d')]['id']}})[_0x9881('0x1d')](handleEntityNotFound(_0x7fb92e,null))['then'](saveUpdates(_0x147bce[_0x9881('0x43')],null))[_0x9881('0x1d')](respondWithResult(_0x7fb92e,null))[_0x9881('0x3c')](handleError(_0x7fb92e,null));};exports[_0x9881('0x1e')]=function(_0xa03650,_0xa91d6f){return db['CmCompany'][_0x9881('0x41')]({'where':{'id':_0xa03650[_0x9881('0x3d')]['id']}})[_0x9881('0x1d')](handleEntityNotFound(_0xa91d6f,null))[_0x9881('0x1d')](removeEntity(_0xa91d6f,null))[_0x9881('0x3c')](handleError(_0xa91d6f,null));};exports['describe']=function(_0x4ae8c7,_0x484fea){return db[_0x9881('0x38')][_0x9881('0x26')]()[_0x9881('0x1d')](respondWithResult(_0x484fea,null))[_0x9881('0x3c')](handleError(_0x484fea,null));};exports[_0x9881('0x49')]=function(_0x23445e,_0x4da4bf,_0x5e1df3){return db[_0x9881('0x4a')][_0x9881('0x41')]({'where':{'id':_0x23445e['params']['id']}})[_0x9881('0x1d')](handleEntityNotFound(_0x4da4bf,null))[_0x9881('0x1d')](function(_0x1eb964){if(_0x1eb964){return _0x1eb964[_0x9881('0x49')](_0x23445e['body'][_0x9881('0x4b')],_['omit'](_0x23445e[_0x9881('0x43')],[_0x9881('0x4b'),'id'])||{});}})[_0x9881('0x1d')](respondWithResult(_0x4da4bf,null))['catch'](handleError(_0x4da4bf,null));};exports['getContacts']=function(_0x489fc0,_0x3ae4fa,_0x131ea3){var _0x572858={};var _0x1fd4f7={};var _0x3bc1e1;var _0x9ce0de;return db[_0x9881('0x38')][_0x9881('0x4c')]({'where':{'id':_0x489fc0[_0x9881('0x3d')]['id']}})[_0x9881('0x1d')](handleEntityNotFound(_0x3ae4fa,null))[_0x9881('0x1d')](function(_0x5a9958){if(_0x5a9958){_0x3bc1e1=_0x5a9958;_0x1fd4f7['model']=_[_0x9881('0x28')](db[_0x9881('0x4a')][_0x9881('0x3e')]);_0x1fd4f7[_0x9881('0x29')]=_[_0x9881('0x28')](_0x489fc0[_0x9881('0x29')]);_0x1fd4f7['filters']=_[_0x9881('0x2a')](_0x1fd4f7[_0x9881('0x27')],_0x1fd4f7[_0x9881('0x29')]);_0x572858[_0x9881('0x2b')]=_['intersection'](_0x1fd4f7[_0x9881('0x27')],qs['fields'](_0x489fc0[_0x9881('0x29')][_0x9881('0x2c')]));_0x572858[_0x9881('0x2b')]=_0x572858[_0x9881('0x2b')]['length']?_0x572858['attributes']:_0x1fd4f7[_0x9881('0x27')];_0x572858['order']=qs['sort'](_0x489fc0[_0x9881('0x29')][_0x9881('0x32')]);_0x572858[_0x9881('0x33')]=qs['filters'](_[_0x9881('0x35')](_0x489fc0[_0x9881('0x29')],_0x1fd4f7['filters']));if(_0x489fc0[_0x9881('0x29')][_0x9881('0x36')]){_0x572858['where']=_[_0x9881('0x37')](_0x572858['where'],{'$or':_[_0x9881('0x4d')](_0x572858[_0x9881('0x2b')],function(_0x476227){var _0x228b47={};_0x228b47[_0x476227]={'$like':'%'+_0x489fc0[_0x9881('0x29')][_0x9881('0x36')]+'%'};return _0x228b47;})});}_0x572858=_['merge']({},_0x572858,_0x489fc0[_0x9881('0x40')]);return _0x3bc1e1[_0x9881('0x4e')](_0x572858);}})[_0x9881('0x1d')](function(_0x265401){if(_0x265401){_0x9ce0de=_0x265401[_0x9881('0x2d')];if(!_0x489fc0[_0x9881('0x29')][_0x9881('0x4f')](_0x9881('0x2e'))){_0x572858[_0x9881('0x2f')]=qs[_0x9881('0x2f')](_0x489fc0[_0x9881('0x29')]['limit']);_0x572858[_0x9881('0x30')]=qs[_0x9881('0x30')](_0x489fc0['query'][_0x9881('0x30')]);}return _0x3bc1e1[_0x9881('0x4e')](_0x572858);}})['then'](function(_0xfb3ff1){if(_0xfb3ff1){return _0xfb3ff1?{'count':_0x9ce0de,'rows':_0xfb3ff1}:null;}})[_0x9881('0x1d')](respondWithResult(_0x3ae4fa,null))[_0x9881('0x3c')](handleError(_0x3ae4fa,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 9bf9db7..f252497 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 _0x0207=['CmCompany','cm_companies','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define'];(function(_0x355de0,_0x3e1d21){var _0xad0de2=function(_0x5ac42d){while(--_0x5ac42d){_0x355de0['push'](_0x355de0['shift']());}};_0xad0de2(++_0x3e1d21);}(_0x0207,0x162));var _0x7020=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x0207[_0x14a862];return _0x245eb5;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7020('0x1'));var BPromise=require(_0x7020('0x2'));var rp=require(_0x7020('0x3'));var fs=require('fs');var path=require(_0x7020('0x4'));var rimraf=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var attributes=require(_0x7020('0x7'));module['exports']=function(_0x5074d7,_0x38c320){return _0x5074d7[_0x7020('0x8')](_0x7020('0x9'),attributes,{'tableName':_0x7020('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7cf=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5847db,_0x3cdf16){var _0x19fc52=function(_0x464104){while(--_0x464104){_0x5847db['push'](_0x5847db['shift']());}};_0x19fc52(++_0x3cdf16);}(_0xb7cf,0xca));var _0xfb7c=function(_0x310043,_0x435e95){_0x310043=_0x310043-0x0;var _0x43283d=_0xb7cf[_0x310043];return _0x43283d;};'use strict';var _=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var logger=require(_0xfb7c('0x2'))(_0xfb7c('0x3'));var moment=require(_0xfb7c('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb7c('0x5'));var fs=require('fs');var path=require(_0xfb7c('0x6'));var rimraf=require(_0xfb7c('0x7'));var config=require(_0xfb7c('0x8'));var attributes=require(_0xfb7c('0x9'));module[_0xfb7c('0xa')]=function(_0x2e245c,_0x135394){return _0x2e245c[_0xfb7c('0xb')](_0xfb7c('0xc'),attributes,{'tableName':_0xfb7c('0xd'),'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 6d36abd..bb9f1a7 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 _0x6fab=['then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6fab,0x1d7));var _0xb6fa=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x6fab[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0xb6fa('0x0'));var util=require('util');var moment=require(_0xb6fa('0x1'));var BPromise=require(_0xb6fa('0x2'));var rs=require(_0xb6fa('0x3'));var fs=require('fs');var Redis=require(_0xb6fa('0x4'));var db=require(_0xb6fa('0x5'))['db'];var utils=require(_0xb6fa('0x6'));var logger=require(_0xb6fa('0x7'))(_0xb6fa('0x8'));var config=require(_0xb6fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb6fa('0xa')][_0xb6fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd51bf9,_0x2eab21,_0x19a381){return new BPromise(function(_0x3326b4,_0xec7d7){return client['request'](_0xd51bf9,_0x19a381)[_0xb6fa('0xc')](function(_0x554390){logger['info'](_0xb6fa('0xd'),_0x2eab21,_0xb6fa('0xe'));logger[_0xb6fa('0xf')](_0xb6fa('0x10'),_0x2eab21,_0xb6fa('0xe'),JSON[_0xb6fa('0x11')](_0x554390));if(_0x554390[_0xb6fa('0x12')]){if(_0x554390['error'][_0xb6fa('0x13')]===0x1f4){logger['error'](_0xb6fa('0xd'),_0x2eab21,_0x554390['error'][_0xb6fa('0x14')]);return _0xec7d7(_0x554390['error'][_0xb6fa('0x14')]);}logger[_0xb6fa('0x12')](_0xb6fa('0xd'),_0x2eab21,_0x554390[_0xb6fa('0x12')][_0xb6fa('0x14')]);return _0x3326b4(_0x554390[_0xb6fa('0x12')][_0xb6fa('0x14')]);}else{logger[_0xb6fa('0x15')](_0xb6fa('0xd'),_0x2eab21,_0xb6fa('0xe'));_0x3326b4(_0x554390['result'][_0xb6fa('0x14')]);}})[_0xb6fa('0x16')](function(_0x15d6ee){logger[_0xb6fa('0x12')](_0xb6fa('0xd'),_0x2eab21,_0x15d6ee);_0xec7d7(_0x15d6ee);});});} \ No newline at end of file +var _0x79cb=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message'];(function(_0xfb02c9,_0x43c274){var _0x9afb71=function(_0x56dff0){while(--_0x56dff0){_0xfb02c9['push'](_0xfb02c9['shift']());}};_0x9afb71(++_0x43c274);}(_0x79cb,0x75));var _0xb79c=function(_0x5d3e13,_0xe20dff){_0x5d3e13=_0x5d3e13-0x0;var _0x5ae6f1=_0x79cb[_0x5d3e13];return _0x5ae6f1;};'use strict';var _=require(_0xb79c('0x0'));var util=require('util');var moment=require(_0xb79c('0x1'));var BPromise=require(_0xb79c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb79c('0x3'));var db=require(_0xb79c('0x4'))['db'];var utils=require(_0xb79c('0x5'));var logger=require(_0xb79c('0x6'))(_0xb79c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb79c('0x8'));var client=jayson[_0xb79c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26536a,_0x2e9e50,_0xc83a9b){return new BPromise(function(_0x2911b6,_0x206289){return client[_0xb79c('0xa')](_0x26536a,_0xc83a9b)[_0xb79c('0xb')](function(_0x340da0){logger[_0xb79c('0xc')]('CmCompany,\x20%s,\x20%s',_0x2e9e50,_0xb79c('0xd'));logger[_0xb79c('0xe')](_0xb79c('0xf'),_0x2e9e50,_0xb79c('0xd'),JSON[_0xb79c('0x10')](_0x340da0));if(_0x340da0[_0xb79c('0x11')]){if(_0x340da0[_0xb79c('0x11')][_0xb79c('0x12')]===0x1f4){logger[_0xb79c('0x11')](_0xb79c('0x13'),_0x2e9e50,_0x340da0[_0xb79c('0x11')]['message']);return _0x206289(_0x340da0[_0xb79c('0x11')][_0xb79c('0x14')]);}logger[_0xb79c('0x11')](_0xb79c('0x13'),_0x2e9e50,_0x340da0[_0xb79c('0x11')][_0xb79c('0x14')]);return _0x2911b6(_0x340da0[_0xb79c('0x11')][_0xb79c('0x14')]);}else{logger[_0xb79c('0xc')](_0xb79c('0x13'),_0x2e9e50,_0xb79c('0xd'));_0x2911b6(_0x340da0[_0xb79c('0x15')]['message']);}})[_0xb79c('0x16')](function(_0x8b9701){logger[_0xb79c('0x11')]('CmCompany,\x20%s,\x20%s',_0x2e9e50,_0x8b9701);_0x206289(_0x8b9701);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d4add3d..419cf10 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 _0x4bd3=['/describe','get','/:id','show','/:id/contacts','getContacts','post','create','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0x4bd3,0x174));var _0x34bd=function(_0x1a5e1b,_0x1faa33){_0x1a5e1b=_0x1a5e1b-0x0;var _0x31ae77=_0x4bd3[_0x1a5e1b];return _0x31ae77;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x34bd('0x3'));var config=require(_0x34bd('0x4'));var controller=require(_0x34bd('0x5'));router['get']('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0x7')]);router['get'](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller['describe']);router[_0x34bd('0x9')](_0x34bd('0xa'),auth[_0x34bd('0x6')](),controller[_0x34bd('0xb')]);router[_0x34bd('0x9')](_0x34bd('0xc'),auth['isAuthenticated'](),controller[_0x34bd('0xd')]);router[_0x34bd('0xe')]('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0xf')]);router['post']('/:id/contacts',auth[_0x34bd('0x6')](),controller['addContacts']);router['put'](_0x34bd('0xa'),auth[_0x34bd('0x6')](),controller[_0x34bd('0x10')]);router[_0x34bd('0x11')](_0x34bd('0xa'),auth[_0x34bd('0x6')](),controller[_0x34bd('0x12')]);module[_0x34bd('0x13')]=router; \ No newline at end of file +var _0x3e24=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show','getContacts','addContacts','put','update','delete'];(function(_0x5c4e47,_0x2be1a3){var _0x3caa2d=function(_0x27883a){while(--_0x27883a){_0x5c4e47['push'](_0x5c4e47['shift']());}};_0x3caa2d(++_0x2be1a3);}(_0x3e24,0x167));var _0x43e2=function(_0x4736ea,_0x9256c4){_0x4736ea=_0x4736ea-0x0;var _0x29ee17=_0x3e24[_0x4736ea];return _0x29ee17;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var auth=require(_0x43e2('0x5'));var interaction=require(_0x43e2('0x6'));var config=require('../../config/environment');var controller=require(_0x43e2('0x7'));router[_0x43e2('0x8')]('/',auth[_0x43e2('0x9')](),controller[_0x43e2('0xa')]);router[_0x43e2('0x8')](_0x43e2('0xb'),auth[_0x43e2('0x9')](),controller['describe']);router[_0x43e2('0x8')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x8')]('/:id/contacts',auth[_0x43e2('0x9')](),controller[_0x43e2('0xe')]);router['post']('/',auth[_0x43e2('0x9')](),controller['create']);router['post']('/:id/contacts',auth[_0x43e2('0x9')](),controller[_0x43e2('0xf')]);router[_0x43e2('0x10')](_0x43e2('0xc'),auth[_0x43e2('0x9')](),controller[_0x43e2('0x11')]);router[_0x43e2('0x12')](_0x43e2('0xc'),auth[_0x43e2('0x9')](),controller[_0x43e2('0x13')]);module[_0x43e2('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 b39958d..2033056 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 _0x7c0d=['exports','STRING','TEXT','INTEGER','DATE','NOW','sequelize'];(function(_0x30dac9,_0x11346d){var _0x22edb5=function(_0x32ed21){while(--_0x32ed21){_0x30dac9['push'](_0x30dac9['shift']());}};_0x22edb5(++_0x11346d);}(_0x7c0d,0x195));var _0xd7c0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c0d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var Sequelize=require(_0xd7c0('0x0'));module[_0xd7c0('0x1')]={'firstName':{'type':Sequelize[_0xd7c0('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd7c0('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xd7c0('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xd7c0('0x2')]},'description':{'type':Sequelize[_0xd7c0('0x3')]},'phone':{'type':Sequelize[_0xd7c0('0x2')]},'mobile':{'type':Sequelize[_0xd7c0('0x2')]},'fax':{'type':Sequelize[_0xd7c0('0x2')]},'email':{'type':Sequelize[_0xd7c0('0x2')]},'url':{'type':Sequelize[_0xd7c0('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xd7c0('0x2')]},'twitter':{'type':Sequelize[_0xd7c0('0x2')]},'skype':{'type':Sequelize[_0xd7c0('0x2')]},'teams':{'type':Sequelize[_0xd7c0('0x2')]},'viber':{'type':Sequelize[_0xd7c0('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xd7c0('0x2')]},'telegram':{'type':Sequelize[_0xd7c0('0x2')]},'UserId':{'type':Sequelize[_0xd7c0('0x4')]},'priority':{'type':Sequelize[_0xd7c0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd7c0('0x5')],'defaultValue':Sequelize[_0xd7c0('0x6')]}}; \ No newline at end of file +var _0x1889=['exports','STRING','TEXT','INTEGER','DATE','lodash','sequelize'];(function(_0x7171b6,_0x57e286){var _0x369dd9=function(_0x1122f2){while(--_0x1122f2){_0x7171b6['push'](_0x7171b6['shift']());}};_0x369dd9(++_0x57e286);}(_0x1889,0xa6));var _0x9188=function(_0x34c0a7,_0x4accd3){_0x34c0a7=_0x34c0a7-0x0;var _0x3295d3=_0x1889[_0x34c0a7];return _0x3295d3;};'use strict';var _=require(_0x9188('0x0'));var Sequelize=require(_0x9188('0x1'));module[_0x9188('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x9188('0x3')]},'street':{'type':Sequelize[_0x9188('0x3')]},'postalCode':{'type':Sequelize[_0x9188('0x3')]},'city':{'type':Sequelize[_0x9188('0x3')]},'country':{'type':Sequelize[_0x9188('0x3')]},'dateOfBirth':{'type':Sequelize[_0x9188('0x3')]},'description':{'type':Sequelize[_0x9188('0x4')]},'phone':{'type':Sequelize[_0x9188('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9188('0x3')]},'email':{'type':Sequelize[_0x9188('0x3')]},'url':{'type':Sequelize[_0x9188('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x9188('0x3')]},'twitter':{'type':Sequelize[_0x9188('0x3')]},'skype':{'type':Sequelize[_0x9188('0x3')]},'teams':{'type':Sequelize[_0x9188('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x9188('0x3')]},'UserId':{'type':Sequelize[_0x9188('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9188('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d0299e2..011049f 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 _0x0c6a=['keyBy','c.*','GROUP_CONCAT(DISTINCT\x20t.id)','t.id\x20=\x20ct.TagId','TagIds','split','Tags','push','catch','find','params','cf_','columnName','displayName','CmCustomField','findAll','alias','custom','values','body','get','mergeWith','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','SmsQueueReport','JscriptySessionReport','join','bulkCreate','duplicates','$or','findOrCreate','spread','Tag','$and','omit','pickBy','cf_%d','table','id\x20=\x20?','toParam','phone','getTags','findOne','intersection','merge','options','nolimit','setTags','getHoppers','rawAttributes','includeAll','rows','ContactId','include','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','CompanyId','pid','upload','createReadStream','file','parse','import','User','binding','child_process','fork','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','sendStatus','status','json','count','offset','limit','Content-Range','update','destroy','then','error','stack','name','send','index','CmContact','describe','keys','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','expr','advancedFilter','forEach','condition','isArray','value','and','tableAlias','LIKE','\x20LIKE\x20?','\x20>\x20?','\x20<\x20?','map','filter','isEmpty','ListId','concat','\x20=\x20?','replace','\x27\x27\x27\x27','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','DESC','Sequelize','QueryTypes','SELECT','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','having','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','left_join','t.id\x20IN\x20?','sequelize','toString'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0c6a,0x6c));var _0xa0c6=function(_0x43d8be,_0x5d5e50){_0x43d8be=_0x43d8be-0x0;var _0x4adaac=_0x0c6a[_0x43d8be];return _0x4adaac;};'use strict';var pdf=require(_0xa0c6('0x0'));var emlformat=require(_0xa0c6('0x1'));var rimraf=require(_0xa0c6('0x2'));var zipdir=require(_0xa0c6('0x3'));var jsonpatch=require(_0xa0c6('0x4'));var rp=require(_0xa0c6('0x5'));var moment=require(_0xa0c6('0x6'));var BPromise=require(_0xa0c6('0x7'));var Mustache=require(_0xa0c6('0x8'));var util=require(_0xa0c6('0x9'));var path=require(_0xa0c6('0xa'));var sox=require(_0xa0c6('0xb'));var csv=require(_0xa0c6('0xc'));var ejs=require(_0xa0c6('0xd'));var fs=require('fs');var _=require(_0xa0c6('0xe'));var squel=require(_0xa0c6('0xf'));var crypto=require(_0xa0c6('0x10'));var jsforce=require(_0xa0c6('0x11'));var deskjs=require(_0xa0c6('0x12'));var toCsv=require('to-csv');var querystring=require(_0xa0c6('0x13'));var Papa=require(_0xa0c6('0x14'));var Redis=require(_0xa0c6('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xa0c6('0x16'));var hardwareService=require(_0xa0c6('0x17'));var logger=require(_0xa0c6('0x18'))('api');var utils=require(_0xa0c6('0x19'));var config=require(_0xa0c6('0x1a'));var db=require('../../mysqldb')['db'];config[_0xa0c6('0x1b')]=_[_0xa0c6('0x1c')](config[_0xa0c6('0x1b')],{'host':_0xa0c6('0x1d'),'port':0x18eb});var socket=require(_0xa0c6('0x1e'))(new Redis(config[_0xa0c6('0x1b')]));require(_0xa0c6('0x1f'))['register'](socket);function respondWithStatusCode(_0x532768,_0x277c3a){_0x277c3a=_0x277c3a||0xcc;return function(_0x16b5b2){if(_0x16b5b2){return _0x532768[_0xa0c6('0x20')](_0x277c3a);}return _0x532768[_0xa0c6('0x21')](_0x277c3a)['end']();};}function respondWithResult(_0x41ac1b,_0x1c2e23){_0x1c2e23=_0x1c2e23||0xc8;return function(_0x4eaf3a){if(_0x4eaf3a){return _0x41ac1b[_0xa0c6('0x21')](_0x1c2e23)[_0xa0c6('0x22')](_0x4eaf3a);}};}function respondWithFilteredResult(_0x5e8288,_0x4519f8){return function(_0x1e32dc){if(_0x1e32dc){var _0x55283f=_0x1e32dc[_0xa0c6('0x23')],_0x3b2162=_0x4519f8[_0xa0c6('0x24')],_0x2ecad5=_0x4519f8[_0xa0c6('0x24')]+_0x4519f8[_0xa0c6('0x25')],_0x73c2e3;if(_0x2ecad5>=_0x55283f){_0x2ecad5=_0x55283f;_0x73c2e3=0xc8;}else{_0x73c2e3=0xce;}_0x5e8288[_0xa0c6('0x21')](_0x73c2e3);return _0x5e8288['set'](_0xa0c6('0x26'),_0x3b2162+'-'+_0x2ecad5+'/'+_0x55283f)[_0xa0c6('0x22')](_0x1e32dc);}return null;};}function patchUpdates(_0x4222bf){return function(_0x55d3c7){try{jsonpatch['apply'](_0x55d3c7,_0x4222bf,!![]);}catch(_0x4614cc){return BPromise['reject'](_0x4614cc);}return _0x55d3c7['save']();};}function saveUpdates(_0xcecb0,_0x5dc7fe){return function(_0xf9669){if(_0xf9669){return _0xf9669[_0xa0c6('0x27')](_0xcecb0)['then'](function(_0x3eb96b){return _0x3eb96b;});}return null;};}function removeEntity(_0x4b75b7,_0x56fbbf){return function(_0x4330f8){if(_0x4330f8){return _0x4330f8[_0xa0c6('0x28')]()[_0xa0c6('0x29')](function(){_0x4b75b7[_0xa0c6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb631,_0x542019){return function(_0x4d491e){if(!_0x4d491e){_0x4fb631[_0xa0c6('0x20')](0x194);}return _0x4d491e;};}function handleError(_0x1b8f1c,_0x3f41e4){_0x3f41e4=_0x3f41e4||0x1f4;return function(_0x1c0a50){logger[_0xa0c6('0x2a')](_0x1c0a50[_0xa0c6('0x2b')]);if(_0x1c0a50['name']){delete _0x1c0a50[_0xa0c6('0x2c')];}_0x1b8f1c[_0xa0c6('0x21')](_0x3f41e4)[_0xa0c6('0x2d')](_0x1c0a50);};}exports[_0xa0c6('0x2e')]=function(_0x211e7a,_0x20dd28){var _0x5e58db={},_0x2abc5d={},_0x104544={'count':0x0,'rows':[]};return db[_0xa0c6('0x2f')][_0xa0c6('0x30')]()[_0xa0c6('0x29')](function(_0x36502d){_0x2abc5d['model']=_[_0xa0c6('0x31')](_0x36502d);_0x2abc5d[_0xa0c6('0x32')]=_['keys'](_0x211e7a[_0xa0c6('0x32')]);_0x2abc5d[_0xa0c6('0x33')]=_['intersection'](_0x2abc5d[_0xa0c6('0x34')],_0x2abc5d[_0xa0c6('0x32')]);_0x5e58db[_0xa0c6('0x35')]=_['intersection'](_0x2abc5d[_0xa0c6('0x34')],qs[_0xa0c6('0x36')](_0x211e7a[_0xa0c6('0x32')][_0xa0c6('0x36')]));_0x5e58db[_0xa0c6('0x35')]=_0x5e58db[_0xa0c6('0x35')][_0xa0c6('0x37')]?_0x5e58db[_0xa0c6('0x35')]:_0x2abc5d[_0xa0c6('0x34')];if(!_0x211e7a['query'][_0xa0c6('0x38')]('nolimit')){_0x5e58db[_0xa0c6('0x25')]=qs[_0xa0c6('0x25')](_0x211e7a[_0xa0c6('0x32')][_0xa0c6('0x25')]);_0x5e58db[_0xa0c6('0x24')]=qs[_0xa0c6('0x24')](_0x211e7a[_0xa0c6('0x32')]['offset']);}_0x5e58db[_0xa0c6('0x39')]=qs['sort'](_0x211e7a[_0xa0c6('0x32')][_0xa0c6('0x3a')]);_0x5e58db[_0xa0c6('0x3b')]=qs[_0xa0c6('0x33')](_[_0xa0c6('0x3c')](_0x211e7a['query'],_0x2abc5d[_0xa0c6('0x33')]));var _0x4a22b2=[];var _0x171839=squel[_0xa0c6('0x3d')]()[_0xa0c6('0x3e')]('id')[_0xa0c6('0x3e')](_0xa0c6('0x2c'))[_0xa0c6('0x3e')](_0xa0c6('0x3f'))[_0xa0c6('0x40')](_0xa0c6('0x41'));var _0x2f6a0b=squel[_0xa0c6('0x3d')]()[_0xa0c6('0x40')](_0xa0c6('0x42'),'c')[_0xa0c6('0x3b')]('c.deletedAt\x20IS\x20NULL');var _0x34eee6=squel[_0xa0c6('0x43')]();if(_0x211e7a[_0xa0c6('0x32')][_0xa0c6('0x44')]){var _0x3efc55=JSON['parse'](_0x211e7a['query']['advancedFilter']);_['keys'](_0x3efc55)[_0xa0c6('0x45')](function(_0x24ff29){var _0x5cefcf=_0x3efc55[_0x24ff29];switch(_0x5cefcf[_0xa0c6('0x46')]){case'IS':if(_[_0xa0c6('0x47')](_0x5cefcf['value'])&&_0x5cefcf[_0xa0c6('0x48')]['length']>0x1){_0x34eee6[_0xa0c6('0x49')](_0x5cefcf[_0xa0c6('0x4a')]+'.'+_0x24ff29+'\x20IN\x20?',_0x5cefcf[_0xa0c6('0x48')]);}else{_0x34eee6[_0xa0c6('0x49')](_0x5cefcf[_0xa0c6('0x4a')]+'.'+_0x24ff29+'\x20=\x20?',_0x5cefcf[_0xa0c6('0x48')][0x0]);}break;case'=':_0x34eee6[_0xa0c6('0x49')](_0x5cefcf[_0xa0c6('0x4a')]+'.'+_0x24ff29+'\x20=\x20?',_0x5cefcf[_0xa0c6('0x48')]);break;case _0xa0c6('0x4b'):_0x34eee6[_0xa0c6('0x49')](_0x5cefcf[_0xa0c6('0x4a')]+'.'+_0x24ff29+_0xa0c6('0x4c'),'%'+_0x5cefcf[_0xa0c6('0x48')]+'%');break;case'>':_0x34eee6['and'](_0x5cefcf[_0xa0c6('0x4a')]+'.'+_0x24ff29+_0xa0c6('0x4d'),_0x5cefcf[_0xa0c6('0x48')]);break;case'<':_0x34eee6[_0xa0c6('0x49')](_0x5cefcf[_0xa0c6('0x4a')]+'.'+_0x24ff29+_0xa0c6('0x4e'),_0x5cefcf[_0xa0c6('0x48')]);break;}});}else{var _0x5871ce=_(Object[_0xa0c6('0x31')](_0x211e7a[_0xa0c6('0x32')]))[_0xa0c6('0x4f')](function(_0xf0bf4c){return _0x36502d[_0xa0c6('0x38')](_0xf0bf4c)?_0xf0bf4c:undefined;})[_0xa0c6('0x50')](function(_0x5e076b){return!_['isNil'](_0x5e076b);})[_0xa0c6('0x48')]();if(!_[_0xa0c6('0x51')](_0x5871ce)){_0x5871ce[_0xa0c6('0x45')](function(_0x27156b){if(_0x27156b===_0xa0c6('0x52')){_0x2f6a0b['where']('c.ListId\x20IN\x20?',[][_0xa0c6('0x53')](_0x211e7a[_0xa0c6('0x32')][_0x27156b]));}else{_0x2f6a0b[_0xa0c6('0x3b')]('c.'+_0x27156b+_0xa0c6('0x54'),_0x211e7a[_0xa0c6('0x32')][_0x27156b]);}});}if(_0x211e7a[_0xa0c6('0x32')][_0xa0c6('0x50')]){var _0x49891d=_0x211e7a[_0xa0c6('0x32')]['filter'][_0xa0c6('0x55')]('\x5c','\x5c\x5c')[_0xa0c6('0x55')]('\x27\x27',_0xa0c6('0x56'));if(qs[_0xa0c6('0x57')](_0x49891d)){_0x34eee6['or'](_0xa0c6('0x58'),_0x49891d+'%');_0x34eee6['or'](_0xa0c6('0x59'),_0x49891d+'%');_0x34eee6['or'](_0xa0c6('0x5a'),_0x49891d+'%');_0x34eee6['or'](_0xa0c6('0x5b'),_0x49891d+'%');}else if(qs[_0xa0c6('0x5c')](_0x49891d)){_0x34eee6['or']('c.email\x20LIKE\x20?',_0x49891d+'%');}else{_0x34eee6['or'](_0xa0c6('0x5d'),_0x49891d+'%');_0x34eee6['or'](_0xa0c6('0x5e'),_0x49891d+'%');_0x34eee6['or'](_0xa0c6('0x5f'),_0x49891d+'%');}}}_0x2f6a0b['where'](_0x34eee6);if(_0x5e58db[_0xa0c6('0x39')]){_0x5e58db[_0xa0c6('0x39')]['forEach'](function(_0x11dfb2){_0x2f6a0b[_0xa0c6('0x39')]('c.'+_0x11dfb2[0x0],_0x11dfb2[0x1]===_0xa0c6('0x60')?![]:!![]);});}_0x2f6a0b['group']('c.id');var _0x5292c7={'type':db[_0xa0c6('0x61')][_0xa0c6('0x62')][_0xa0c6('0x63')],'raw':!![]};var _0x1bf260=_0x2f6a0b['clone']()[_0xa0c6('0x3e')]('COUNT(*)');if(!_0x211e7a[_0xa0c6('0x32')]['advancedFilter']){if(_0x211e7a[_0xa0c6('0x32')][_0xa0c6('0x64')]){var _0x2f6ae6=_[_0xa0c6('0x47')](_0x211e7a['query']['tag'])?_0x211e7a[_0xa0c6('0x32')][_0xa0c6('0x64')]:new Array(_0x211e7a[_0xa0c6('0x32')][_0xa0c6('0x64')]);var _0x3b8aa4=squel[_0xa0c6('0x43')]();_0x2f6ae6[_0xa0c6('0x45')](function(_0x82f665){_0x3b8aa4['or'](_0xa0c6('0x65'),'%,'+_0x82f665+',%');});_0x2f6a0b[_0xa0c6('0x66')](_0x3b8aa4);_0x1bf260['left_join'](_0xa0c6('0x67'),'ct',_0xa0c6('0x68'));_0x1bf260[_0xa0c6('0x69')](_0xa0c6('0x41'),'t','t.id\x20=\x20ct.TagId');_0x1bf260[_0xa0c6('0x3b')](_0xa0c6('0x6a'),_0x2f6ae6);}}db[_0xa0c6('0x6b')][_0xa0c6('0x32')](_0x171839[_0xa0c6('0x6c')](),_0x5292c7)[_0xa0c6('0x29')](function(_0x1705ef){_0x4a22b2=_[_0xa0c6('0x6d')](_0x1705ef,'id');return db['sequelize']['query'](_0x1bf260[_0xa0c6('0x6c')](),_0x5292c7);})['then'](function(_0x15783c){_0x104544[_0xa0c6('0x23')]=_0x15783c[_0xa0c6('0x37')];_0x5292c7=_['merge'](_0x5292c7,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});_0x2f6a0b[_0xa0c6('0x3e')](_0xa0c6('0x6e'));_0x2f6a0b[_0xa0c6('0x3e')](_0xa0c6('0x6f'),'TagIds');_0x2f6a0b[_0xa0c6('0x69')](_0xa0c6('0x67'),'ct',_0xa0c6('0x68'));_0x2f6a0b[_0xa0c6('0x69')](_0xa0c6('0x41'),'t',_0xa0c6('0x70'));if(_0x5e58db[_0xa0c6('0x25')]){_0x2f6a0b[_0xa0c6('0x25')](_0x5e58db[_0xa0c6('0x25')]);}if(_0x5e58db['offset']){_0x2f6a0b['offset'](_0x5e58db[_0xa0c6('0x24')]);}db[_0xa0c6('0x6b')][_0xa0c6('0x32')](_0x2f6a0b[_0xa0c6('0x6c')](),_0x5292c7)[_0xa0c6('0x29')](function(_0x1d8194){_0x1d8194[_0xa0c6('0x45')](function(_0x4eed1b){if(_0x4eed1b[_0xa0c6('0x71')]){_0x4eed1b['Tags']=[];_0x4eed1b['TagIds'][_0xa0c6('0x72')](',')[_0xa0c6('0x45')](function(_0xd7c6cd){_0x4eed1b[_0xa0c6('0x73')][_0xa0c6('0x74')](_0x4a22b2[_0xd7c6cd]);});}delete _0x4eed1b['TagIds'];});_0x104544['rows']=_0x1d8194;return _0x104544;})['then'](respondWithFilteredResult(_0x20dd28,_0x5e58db))[_0xa0c6('0x75')](handleError(_0x20dd28,null));});});};exports[_0xa0c6('0x28')]=function(_0x807277,_0x4fcb51){return db['CmContact'][_0xa0c6('0x76')]({'where':{'id':_0x807277[_0xa0c6('0x77')]['id']}})[_0xa0c6('0x29')](handleEntityNotFound(_0x4fcb51,null))[_0xa0c6('0x29')](removeEntity(_0x4fcb51,null))[_0xa0c6('0x75')](handleError(_0x4fcb51,null));};exports['describe']=function(_0x5a2296,_0x5f197e){return db['CmContact'][_0xa0c6('0x30')]()[_0xa0c6('0x29')](function(_0x3c04f5){for(var _0x383fa6=0x0;_0x383fa6\x20?','\x20<\x20?','map','hasOwnProperty','filter','isNil','isEmpty','ListId','c.ListId\x20IN\x20?','replace','\x27\x27\x27\x27','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','order','Sequelize','QueryTypes','SELECT','clone','COUNT(*)','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','having','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','t.id\x20IN\x20?','sequelize','toString','keyBy','merge','forEach','TagIds','split','Tags','push','find','params','catch','describe','startsWith','cf_','columnName','findAll','displayName','alias','custom','type','values','body','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','bulkCreate','each','duplicates','findOrCreate','error','show','Tag','$and','omit','cf_%d','CmCustomField','format','table','setFields','id\x20=\x20?','text','phone','getTags','rawAttributes','sort','options','setTags','findOne','ids','getHoppers','include','rows','getHopperHistories','CmHopperHistory','includeAll','getHopperFinals','pick','ContactId','getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','server/files/tmp','filename','chmodSync','0777','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','file','meta','import','User','binding','No\x20firstName\x20column\x20specified','child_process','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x9bfbfe,_0xe4d79f){var _0x480748=function(_0x5b0c1d){while(--_0x5b0c1d){_0x9bfbfe['push'](_0x9bfbfe['shift']());}};_0x480748(++_0xe4d79f);}(_0xd1a9,0xdf));var _0x9d1a=function(_0x1a57c7,_0x1f0c32){_0x1a57c7=_0x1a57c7-0x0;var _0xb5899c=_0xd1a9[_0x1a57c7];return _0xb5899c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9d1a('0x0'));var zipdir=require(_0x9d1a('0x1'));var jsonpatch=require(_0x9d1a('0x2'));var rp=require(_0x9d1a('0x3'));var moment=require(_0x9d1a('0x4'));var BPromise=require(_0x9d1a('0x5'));var Mustache=require(_0x9d1a('0x6'));var util=require(_0x9d1a('0x7'));var path=require(_0x9d1a('0x8'));var sox=require(_0x9d1a('0x9'));var csv=require(_0x9d1a('0xa'));var ejs=require(_0x9d1a('0xb'));var fs=require('fs');var _=require(_0x9d1a('0xc'));var squel=require(_0x9d1a('0xd'));var crypto=require(_0x9d1a('0xe'));var jsforce=require(_0x9d1a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9d1a('0xa'));var querystring=require(_0x9d1a('0x10'));var Papa=require(_0x9d1a('0x11'));var Redis=require(_0x9d1a('0x12'));var authService=require(_0x9d1a('0x13'));var qs=require(_0x9d1a('0x14'));var hardwareService=require(_0x9d1a('0x15'));var logger=require(_0x9d1a('0x16'))(_0x9d1a('0x17'));var utils=require(_0x9d1a('0x18'));var config=require(_0x9d1a('0x19'));var db=require(_0x9d1a('0x1a'))['db'];config['redis']=_['defaults'](config[_0x9d1a('0x1b')],{'host':_0x9d1a('0x1c'),'port':0x18eb});var socket=require(_0x9d1a('0x1d'))(new Redis(config['redis']));require(_0x9d1a('0x1e'))[_0x9d1a('0x1f')](socket);function respondWithStatusCode(_0x2233b0,_0x30940a){_0x30940a=_0x30940a||0xcc;return function(_0x1f5e84){if(_0x1f5e84){return _0x2233b0[_0x9d1a('0x20')](_0x30940a);}return _0x2233b0['status'](_0x30940a)[_0x9d1a('0x21')]();};}function respondWithResult(_0x5d61f5,_0x27e955){_0x27e955=_0x27e955||0xc8;return function(_0x146106){if(_0x146106){return _0x5d61f5[_0x9d1a('0x22')](_0x27e955)[_0x9d1a('0x23')](_0x146106);}};}function respondWithFilteredResult(_0x4eafa1,_0x545f57){return function(_0x14d8c6){if(_0x14d8c6){var _0x1d6697=_0x14d8c6[_0x9d1a('0x24')],_0x27a0ae=_0x545f57[_0x9d1a('0x25')],_0x8b678=_0x545f57[_0x9d1a('0x25')]+_0x545f57['limit'],_0x367cc9;if(_0x8b678>=_0x1d6697){_0x8b678=_0x1d6697;_0x367cc9=0xc8;}else{_0x367cc9=0xce;}_0x4eafa1[_0x9d1a('0x22')](_0x367cc9);return _0x4eafa1['set'](_0x9d1a('0x26'),_0x27a0ae+'-'+_0x8b678+'/'+_0x1d6697)[_0x9d1a('0x23')](_0x14d8c6);}return null;};}function patchUpdates(_0x23bca4){return function(_0xc49999){try{jsonpatch[_0x9d1a('0x27')](_0xc49999,_0x23bca4,!![]);}catch(_0x3d6471){return BPromise[_0x9d1a('0x28')](_0x3d6471);}return _0xc49999['save']();};}function saveUpdates(_0xf18dae,_0x174884){return function(_0x37bc12){if(_0x37bc12){return _0x37bc12['update'](_0xf18dae)[_0x9d1a('0x29')](function(_0x1ad49b){return _0x1ad49b;});}return null;};}function removeEntity(_0x55e205,_0x2c2702){return function(_0x4cc11a){if(_0x4cc11a){return _0x4cc11a[_0x9d1a('0x2a')]()[_0x9d1a('0x29')](function(){_0x55e205[_0x9d1a('0x22')](0xcc)[_0x9d1a('0x21')]();});}};}function handleEntityNotFound(_0x499791,_0x3bb7b8){return function(_0x12328f){if(!_0x12328f){_0x499791[_0x9d1a('0x20')](0x194);}return _0x12328f;};}function handleError(_0x4dd3fa,_0x2482d0){_0x2482d0=_0x2482d0||0x1f4;return function(_0x2a9939){logger['error'](_0x2a9939[_0x9d1a('0x2b')]);if(_0x2a9939[_0x9d1a('0x2c')]){delete _0x2a9939[_0x9d1a('0x2c')];}_0x4dd3fa[_0x9d1a('0x22')](_0x2482d0)[_0x9d1a('0x2d')](_0x2a9939);};}exports[_0x9d1a('0x2e')]=function(_0x539b03,_0x45476f){var _0xccee38={},_0x272532={},_0x84a0bf={'count':0x0,'rows':[]};return db[_0x9d1a('0x2f')]['describe']()[_0x9d1a('0x29')](function(_0x301aeb){_0x272532[_0x9d1a('0x30')]=_[_0x9d1a('0x31')](_0x301aeb);_0x272532[_0x9d1a('0x32')]=_[_0x9d1a('0x31')](_0x539b03[_0x9d1a('0x32')]);_0x272532['filters']=_[_0x9d1a('0x33')](_0x272532[_0x9d1a('0x30')],_0x272532[_0x9d1a('0x32')]);_0xccee38[_0x9d1a('0x34')]=_[_0x9d1a('0x33')](_0x272532[_0x9d1a('0x30')],qs['fields'](_0x539b03[_0x9d1a('0x32')][_0x9d1a('0x35')]));_0xccee38[_0x9d1a('0x34')]=_0xccee38[_0x9d1a('0x34')]['length']?_0xccee38[_0x9d1a('0x34')]:_0x272532[_0x9d1a('0x30')];if(!_0x539b03[_0x9d1a('0x32')]['hasOwnProperty'](_0x9d1a('0x36'))){_0xccee38[_0x9d1a('0x37')]=qs['limit'](_0x539b03[_0x9d1a('0x32')]['limit']);_0xccee38[_0x9d1a('0x25')]=qs[_0x9d1a('0x25')](_0x539b03[_0x9d1a('0x32')][_0x9d1a('0x25')]);}_0xccee38['order']=qs['sort'](_0x539b03[_0x9d1a('0x32')]['sort']);_0xccee38[_0x9d1a('0x38')]=qs[_0x9d1a('0x39')](_['pick'](_0x539b03[_0x9d1a('0x32')],_0x272532[_0x9d1a('0x39')]));var _0x12baf5=[];var _0x1ca35f=squel[_0x9d1a('0x3a')]()[_0x9d1a('0x3b')]('id')[_0x9d1a('0x3b')](_0x9d1a('0x2c'))['field'](_0x9d1a('0x3c'))[_0x9d1a('0x3d')](_0x9d1a('0x3e'));var _0x15ee5b=squel['select']()[_0x9d1a('0x3d')](_0x9d1a('0x3f'),'c')[_0x9d1a('0x38')](_0x9d1a('0x40'));var _0x20f905=squel[_0x9d1a('0x41')]();if(_0x539b03[_0x9d1a('0x32')]['advancedFilter']){var _0x12fcc7=JSON['parse'](_0x539b03[_0x9d1a('0x32')][_0x9d1a('0x42')]);_[_0x9d1a('0x31')](_0x12fcc7)['forEach'](function(_0x4daf0e){var _0x4f553b=_0x12fcc7[_0x4daf0e];switch(_0x4f553b[_0x9d1a('0x43')]){case'IS':if(_[_0x9d1a('0x44')](_0x4f553b[_0x9d1a('0x45')])&&_0x4f553b['value'][_0x9d1a('0x46')]>0x1){_0x20f905[_0x9d1a('0x47')](_0x4f553b[_0x9d1a('0x48')]+'.'+_0x4daf0e+_0x9d1a('0x49'),_0x4f553b[_0x9d1a('0x45')]);}else{_0x20f905[_0x9d1a('0x47')](_0x4f553b['tableAlias']+'.'+_0x4daf0e+_0x9d1a('0x4a'),_0x4f553b[_0x9d1a('0x45')][0x0]);}break;case'=':_0x20f905[_0x9d1a('0x47')](_0x4f553b['tableAlias']+'.'+_0x4daf0e+'\x20=\x20?',_0x4f553b[_0x9d1a('0x45')]);break;case _0x9d1a('0x4b'):_0x20f905[_0x9d1a('0x47')](_0x4f553b[_0x9d1a('0x48')]+'.'+_0x4daf0e+_0x9d1a('0x4c'),'%'+_0x4f553b[_0x9d1a('0x45')]+'%');break;case'>':_0x20f905[_0x9d1a('0x47')](_0x4f553b[_0x9d1a('0x48')]+'.'+_0x4daf0e+_0x9d1a('0x4d'),_0x4f553b[_0x9d1a('0x45')]);break;case'<':_0x20f905[_0x9d1a('0x47')](_0x4f553b[_0x9d1a('0x48')]+'.'+_0x4daf0e+_0x9d1a('0x4e'),_0x4f553b[_0x9d1a('0x45')]);break;}});}else{var _0x1f4756=_(Object[_0x9d1a('0x31')](_0x539b03['query']))[_0x9d1a('0x4f')](function(_0x5d2bfa){return _0x301aeb[_0x9d1a('0x50')](_0x5d2bfa)?_0x5d2bfa:undefined;})[_0x9d1a('0x51')](function(_0x4b0cba){return!_[_0x9d1a('0x52')](_0x4b0cba);})[_0x9d1a('0x45')]();if(!_[_0x9d1a('0x53')](_0x1f4756)){_0x1f4756['forEach'](function(_0x1a3da7){if(_0x1a3da7===_0x9d1a('0x54')){_0x15ee5b[_0x9d1a('0x38')](_0x9d1a('0x55'),[]['concat'](_0x539b03[_0x9d1a('0x32')][_0x1a3da7]));}else{_0x15ee5b[_0x9d1a('0x38')]('c.'+_0x1a3da7+'\x20=\x20?',_0x539b03['query'][_0x1a3da7]);}});}if(_0x539b03[_0x9d1a('0x32')][_0x9d1a('0x51')]){var _0x4bb428=_0x539b03[_0x9d1a('0x32')][_0x9d1a('0x51')][_0x9d1a('0x56')]('\x5c','\x5c\x5c')[_0x9d1a('0x56')]('\x27\x27',_0x9d1a('0x57'));if(qs[_0x9d1a('0x58')](_0x4bb428)){_0x20f905['or'](_0x9d1a('0x59'),_0x4bb428+'%');_0x20f905['or'](_0x9d1a('0x5a'),_0x4bb428+'%');_0x20f905['or'](_0x9d1a('0x5b'),_0x4bb428+'%');_0x20f905['or'](_0x9d1a('0x5c'),_0x4bb428+'%');}else if(qs[_0x9d1a('0x5d')](_0x4bb428)){_0x20f905['or'](_0x9d1a('0x5e'),_0x4bb428+'%');}else{_0x20f905['or']('c.email\x20LIKE\x20?',_0x4bb428+'%');_0x20f905['or'](_0x9d1a('0x5f'),_0x4bb428+'%');_0x20f905['or'](_0x9d1a('0x60'),_0x4bb428+'%');}}}_0x15ee5b[_0x9d1a('0x38')](_0x20f905);if(_0xccee38['order']){_0xccee38[_0x9d1a('0x61')]['forEach'](function(_0x28327a){_0x15ee5b[_0x9d1a('0x61')]('c.'+_0x28327a[0x0],_0x28327a[0x1]==='DESC'?![]:!![]);});}_0x15ee5b['group']('c.id');var _0x1ceaf1={'type':db[_0x9d1a('0x62')][_0x9d1a('0x63')][_0x9d1a('0x64')],'raw':!![]};var _0x570297=_0x15ee5b[_0x9d1a('0x65')]()[_0x9d1a('0x3b')](_0x9d1a('0x66'));if(!_0x539b03[_0x9d1a('0x32')]['advancedFilter']){if(_0x539b03[_0x9d1a('0x32')][_0x9d1a('0x67')]){var _0x7f5182=_['isArray'](_0x539b03[_0x9d1a('0x32')][_0x9d1a('0x67')])?_0x539b03[_0x9d1a('0x32')]['tag']:new Array(_0x539b03[_0x9d1a('0x32')][_0x9d1a('0x67')]);var _0x1f8c11=squel[_0x9d1a('0x41')]();_0x7f5182['forEach'](function(_0x2de649){_0x1f8c11['or'](_0x9d1a('0x68'),'%,'+_0x2de649+',%');});_0x15ee5b[_0x9d1a('0x69')](_0x1f8c11);_0x570297[_0x9d1a('0x6a')](_0x9d1a('0x6b'),'ct',_0x9d1a('0x6c'));_0x570297[_0x9d1a('0x6a')](_0x9d1a('0x3e'),'t',_0x9d1a('0x6d'));_0x570297['where'](_0x9d1a('0x6e'),_0x7f5182);}}db[_0x9d1a('0x6f')]['query'](_0x1ca35f[_0x9d1a('0x70')](),_0x1ceaf1)[_0x9d1a('0x29')](function(_0x2c9bf3){_0x12baf5=_[_0x9d1a('0x71')](_0x2c9bf3,'id');return db[_0x9d1a('0x6f')][_0x9d1a('0x32')](_0x570297[_0x9d1a('0x70')](),_0x1ceaf1);})[_0x9d1a('0x29')](function(_0x56c654){_0x84a0bf[_0x9d1a('0x24')]=_0x56c654['length'];_0x1ceaf1=_[_0x9d1a('0x72')](_0x1ceaf1,{'model':db[_0x9d1a('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x15ee5b[_0x9d1a('0x3b')]('c.*');_0x15ee5b[_0x9d1a('0x3b')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');_0x15ee5b[_0x9d1a('0x6a')](_0x9d1a('0x6b'),'ct','ct.CmContactId\x20=\x20c.id');_0x15ee5b[_0x9d1a('0x6a')](_0x9d1a('0x3e'),'t',_0x9d1a('0x6d'));if(_0xccee38[_0x9d1a('0x37')]){_0x15ee5b[_0x9d1a('0x37')](_0xccee38[_0x9d1a('0x37')]);}if(_0xccee38[_0x9d1a('0x25')]){_0x15ee5b[_0x9d1a('0x25')](_0xccee38[_0x9d1a('0x25')]);}db['sequelize'][_0x9d1a('0x32')](_0x15ee5b[_0x9d1a('0x70')](),_0x1ceaf1)[_0x9d1a('0x29')](function(_0x40a178){_0x40a178[_0x9d1a('0x73')](function(_0x20aca0){if(_0x20aca0[_0x9d1a('0x74')]){_0x20aca0['Tags']=[];_0x20aca0['TagIds'][_0x9d1a('0x75')](',')['forEach'](function(_0x353b4e){_0x20aca0[_0x9d1a('0x76')][_0x9d1a('0x77')](_0x12baf5[_0x353b4e]);});}delete _0x20aca0['TagIds'];});_0x84a0bf['rows']=_0x40a178;return _0x84a0bf;})[_0x9d1a('0x29')](respondWithFilteredResult(_0x45476f,_0xccee38))['catch'](handleError(_0x45476f,null));});});};exports['destroy']=function(_0x459f9f,_0x451f6c){return db[_0x9d1a('0x2f')][_0x9d1a('0x78')]({'where':{'id':_0x459f9f[_0x9d1a('0x79')]['id']}})['then'](handleEntityNotFound(_0x451f6c,null))[_0x9d1a('0x29')](removeEntity(_0x451f6c,null))[_0x9d1a('0x7a')](handleError(_0x451f6c,null));};exports['describe']=function(_0x69dbc,_0x4c8e93){return db[_0x9d1a('0x2f')][_0x9d1a('0x7b')]()[_0x9d1a('0x29')](function(_0x379531){for(var _0x1940e6=0x0;_0x1940e6{}\s\\|]/g,'-');_0x48d18a(null,util[_0x1ac3('0x23')](_0x1ac3('0x24'),path[_0x1ac3('0x25')](_0x5f1918[_0x1ac3('0x21')],path[_0x1ac3('0x26')](_0x5f1918[_0x1ac3('0x21')])),Date['now'](),path[_0x1ac3('0x26')](_0x5f1918[_0x1ac3('0x21')])));}})});router['post'](_0x1ac3('0x27'),upload[_0x1ac3('0x28')]('file'),controller[_0x1ac3('0x29')]);var upload=multer({'storage':multer[_0x1ac3('0x1d')]({'destination':function(_0x145486,_0x2dfdb7,_0x10db3d){_0x10db3d(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x528807,_0x52a1a5,_0x3ea482){_0x52a1a5['originalname']=_0x52a1a5[_0x1ac3('0x21')][_0x1ac3('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ea482(null,util[_0x1ac3('0x23')](_0x1ac3('0x24'),path['basename'](_0x52a1a5[_0x1ac3('0x21')],path['extname'](_0x52a1a5[_0x1ac3('0x21')])),Date[_0x1ac3('0x2a')](),path[_0x1ac3('0x26')](_0x52a1a5[_0x1ac3('0x21')])));}})});router[_0x1ac3('0x18')](_0x1ac3('0x2b'),upload[_0x1ac3('0x28')]('file'),controller[_0x1ac3('0x2c')]);router[_0x1ac3('0x18')](_0x1ac3('0x2d'),auth[_0x1ac3('0xc')](),controller['import']);router[_0x1ac3('0x2e')](_0x1ac3('0xe'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x2f')]);router[_0x1ac3('0x30')]('/:id',auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x31')]);module[_0x1ac3('0x32')]=router; \ No newline at end of file +var _0xda19=['isAuthenticated','index','/describe','describe','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/merge','merge','post','create','bulkCreate','/:id/tags','setTags','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','extname','now','single','file','diskStorage','/upload','upload','/upload/:id','put','/:id','update','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./cmContact.controller','get'];(function(_0x502ce3,_0x3d5cdf){var _0x2c69f5=function(_0x1e4b68){while(--_0x1e4b68){_0x502ce3['push'](_0x502ce3['shift']());}};_0x2c69f5(++_0x3d5cdf);}(_0xda19,0xd5));var _0x9da1=function(_0x3611cd,_0x5b2b47){_0x3611cd=_0x3611cd-0x0;var _0x58d809=_0xda19[_0x3611cd];return _0x58d809;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9da1('0x6')]('/:id/tags',auth[_0x9da1('0x7')](),controller[_0x9da1('0xb')]);router[_0x9da1('0x6')](_0x9da1('0xc'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xd')]);router[_0x9da1('0x6')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x9da1('0xe')]);router['get'](_0x9da1('0xf'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x10')]);router[_0x9da1('0x6')]('/:id/jscripty_sessions',auth[_0x9da1('0x7')](),controller['getJscriptySessions']);router['post'](_0x9da1('0x11'),auth['isAuthenticated'](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x14')]);router[_0x9da1('0x13')]('/create_many',auth[_0x9da1('0x7')](),controller[_0x9da1('0x15')]);router[_0x9da1('0x13')](_0x9da1('0x16'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d4541,_0x17205d,_0x8da712){_0x8da712(null,path[_0x9da1('0x18')](config[_0x9da1('0x19')],_0x9da1('0x1a')));},'filename':function(_0x3b1645,_0xe56279,_0x47e5cf){_0xe56279[_0x9da1('0x1b')]=_0xe56279[_0x9da1('0x1b')][_0x9da1('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47e5cf(null,util[_0x9da1('0x1d')](_0x9da1('0x1e'),path['basename'](_0xe56279['originalname'],path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])));}})});router[_0x9da1('0x13')]('/csv',upload[_0x9da1('0x21')](_0x9da1('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x9da1('0x23')]({'destination':function(_0x3f5680,_0x534210,_0x2fd49c){_0x2fd49c(null,path[_0x9da1('0x18')](config['root'],_0x9da1('0x1a')));},'filename':function(_0x1d6af5,_0x55cd3d,_0x5c09ed){_0x55cd3d[_0x9da1('0x1b')]=_0x55cd3d[_0x9da1('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c09ed(null,util[_0x9da1('0x1d')]('%s-%s%s',path['basename'](_0x55cd3d['originalname'],path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])));}})});router['post'](_0x9da1('0x24'),upload['single'](_0x9da1('0x22')),controller[_0x9da1('0x25')]);router['post'](_0x9da1('0x26'),auth[_0x9da1('0x7')](),controller['import']);router[_0x9da1('0x27')](_0x9da1('0x28'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x29')]);router['delete']('/:id',auth[_0x9da1('0x7')](),controller[_0x9da1('0x2a')]);module[_0x9da1('0x2b')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4af87e4..4ec3f65 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 _0x9544=['setDataValue','getDataValue','name','TEXT','type','select','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','VIRTUAL','alias','STRING'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0x9544,0x19b));var _0x4954=function(_0x15b33d,_0x3a17b0){_0x15b33d=_0x15b33d-0x0;var _0x3b09b6=_0x9544[_0x15b33d];return _0x3b09b6;};'use strict';var Sequelize=require(_0x4954('0x0'));var _=require(_0x4954('0x1'));module['exports']={'name':{'type':Sequelize[_0x4954('0x2')],'get':function(_0x1a8c71){return this['getDataValue'](_0x4954('0x3'));}},'alias':{'type':Sequelize[_0x4954('0x4')],'allowNull':![],'set':function(_0x3674f4){this[_0x4954('0x5')]('alias',_0x3674f4?_0x3674f4:this[_0x4954('0x6')](_0x4954('0x7')));}},'type':{'type':Sequelize[_0x4954('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x4954('0x8')]('long'),'get':function(){if(this['getDataValue'](_0x4954('0x9'))===_0x4954('0xa')){return JSON[_0x4954('0xb')](this[_0x4954('0x6')](_0x4954('0xc')));}else{return this[_0x4954('0x6')](_0x4954('0xc'));}},'set':function(_0x16c0f0){if(Array[_0x4954('0xd')](_0x16c0f0)){this['setDataValue']('values',JSON[_0x4954('0xe')](_0x16c0f0));}else{this[_0x4954('0x5')](_0x4954('0xc'),_0x16c0f0);}}},'required':{'type':Sequelize[_0x4954('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xf41d=['long','type','parse','values','stringify','BOOLEAN','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT'];(function(_0x202686,_0x5c3908){var _0x35ade5=function(_0x4b8ed0){while(--_0x4b8ed0){_0x202686['push'](_0x202686['shift']());}};_0x35ade5(++_0x5c3908);}(_0xf41d,0xc9));var _0xdf41=function(_0x45bb93,_0x45345c){_0x45bb93=_0x45bb93-0x0;var _0x377411=_0xf41d[_0x45bb93];return _0x377411;};'use strict';var Sequelize=require(_0xdf41('0x0'));var _=require(_0xdf41('0x1'));module['exports']={'name':{'type':Sequelize[_0xdf41('0x2')],'get':function(_0x3153b5){return this[_0xdf41('0x3')](_0xdf41('0x4'));}},'alias':{'type':Sequelize[_0xdf41('0x5')],'allowNull':![],'set':function(_0x2b027f){this[_0xdf41('0x6')](_0xdf41('0x4'),_0x2b027f?_0x2b027f:this[_0xdf41('0x3')](_0xdf41('0x7')));}},'type':{'type':Sequelize[_0xdf41('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xdf41('0x8')](_0xdf41('0x9')),'get':function(){if(this[_0xdf41('0x3')](_0xdf41('0xa'))==='select'){return JSON[_0xdf41('0xb')](this[_0xdf41('0x3')](_0xdf41('0xc')));}else{return this[_0xdf41('0x3')](_0xdf41('0xc'));}},'set':function(_0x5ace70){if(Array['isArray'](_0x5ace70)){this[_0xdf41('0x6')](_0xdf41('0xc'),JSON[_0xdf41('0xd')](_0x5ace70));}else{this['setDataValue'](_0xdf41('0xc'),_0x5ace70);}}},'required':{'type':Sequelize[_0xdf41('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 37632e4..38940a5 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 _0x5eb4=['query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','key','VIRTUAL','CmCustomField','includeAll','findAll','rows','catch','show','params','include','find','body','destroy','create','sequelize','transaction','TEXT','text','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','model','differenceBy','keys'];(function(_0x290781,_0x53d542){var _0x1ef41f=function(_0x2940a5){while(--_0x2940a5){_0x290781['push'](_0x290781['shift']());}};_0x1ef41f(++_0x53d542);}(_0x5eb4,0x175));var _0x45eb=function(_0x75941,_0x1f0323){_0x75941=_0x75941-0x0;var _0x32fa13=_0x5eb4[_0x75941];return _0x32fa13;};'use strict';var pdf=require(_0x45eb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x45eb('0x1'));var zipdir=require(_0x45eb('0x2'));var jsonpatch=require(_0x45eb('0x3'));var rp=require(_0x45eb('0x4'));var moment=require(_0x45eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x45eb('0x6'));var util=require(_0x45eb('0x7'));var path=require('path');var sox=require(_0x45eb('0x8'));var csv=require('to-csv');var ejs=require(_0x45eb('0x9'));var fs=require('fs');var _=require(_0x45eb('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x45eb('0xb'));var deskjs=require(_0x45eb('0xc'));var toCsv=require(_0x45eb('0xd'));var querystring=require(_0x45eb('0xe'));var Papa=require(_0x45eb('0xf'));var Redis=require(_0x45eb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x45eb('0x11'));var hardwareService=require(_0x45eb('0x12'));var logger=require('../../config/logger')(_0x45eb('0x13'));var utils=require(_0x45eb('0x14'));var config=require(_0x45eb('0x15'));var db=require(_0x45eb('0x16'))['db'];function respondWithStatusCode(_0x19c681,_0x230201){_0x230201=_0x230201||0xcc;return function(_0x20062e){if(_0x20062e){return _0x19c681[_0x45eb('0x17')](_0x230201);}return _0x19c681[_0x45eb('0x18')](_0x230201)['end']();};}function respondWithResult(_0x46ba5e,_0x20fc5b){_0x20fc5b=_0x20fc5b||0xc8;return function(_0x1ae5ea){if(_0x1ae5ea){return _0x46ba5e[_0x45eb('0x18')](_0x20fc5b)['json'](_0x1ae5ea);}};}function respondWithFilteredResult(_0x4b70ea,_0x138fcd){return function(_0x4ecd7d){if(_0x4ecd7d){var _0x317a98=_0x4ecd7d['count'],_0x225de7=_0x138fcd[_0x45eb('0x19')],_0x54c7b2=_0x138fcd[_0x45eb('0x19')]+_0x138fcd[_0x45eb('0x1a')],_0x1c62f4;if(_0x54c7b2>=_0x317a98){_0x54c7b2=_0x317a98;_0x1c62f4=0xc8;}else{_0x1c62f4=0xce;}_0x4b70ea['status'](_0x1c62f4);return _0x4b70ea[_0x45eb('0x1b')](_0x45eb('0x1c'),_0x225de7+'-'+_0x54c7b2+'/'+_0x317a98)['json'](_0x4ecd7d);}return null;};}function patchUpdates(_0x43134c){return function(_0x223209){try{jsonpatch[_0x45eb('0x1d')](_0x223209,_0x43134c,!![]);}catch(_0x190d3b){return BPromise[_0x45eb('0x1e')](_0x190d3b);}return _0x223209[_0x45eb('0x1f')]();};}function saveUpdates(_0x14660f,_0x32c8dd){return function(_0x163e21){if(_0x163e21){return _0x163e21[_0x45eb('0x20')](_0x14660f)[_0x45eb('0x21')](function(_0x12a245){return _0x12a245;});}return null;};}function removeEntity(_0x442034,_0x456982){return function(_0x11f631){if(_0x11f631){return _0x11f631['destroy']()[_0x45eb('0x21')](function(){_0x442034[_0x45eb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b769,_0x17c4e7){return function(_0x4c6ac7){if(!_0x4c6ac7){_0x20b769['sendStatus'](0x194);}return _0x4c6ac7;};}function handleError(_0x320c22,_0x2620bb){_0x2620bb=_0x2620bb||0x1f4;return function(_0xaf6747){logger[_0x45eb('0x22')](_0xaf6747[_0x45eb('0x23')]);if(_0xaf6747[_0x45eb('0x24')]){delete _0xaf6747[_0x45eb('0x24')];}_0x320c22['status'](_0x2620bb)[_0x45eb('0x25')](_0xaf6747);};}exports['index']=function(_0x17da5e,_0x2311f9){var _0x169589={},_0x1b73fe={},_0x4d3149={'count':0x0,'rows':[]};var _0x3c7e42=db['CmCustomField'][_0x45eb('0x26')];_0x1b73fe[_0x45eb('0x27')]=_[_0x45eb('0x28')](_[_0x45eb('0x29')](_0x3c7e42),['name']);_0x1b73fe[_0x45eb('0x2a')]=_[_0x45eb('0x29')](_0x17da5e[_0x45eb('0x2a')]);_0x1b73fe['filters']=_[_0x45eb('0x2b')](_0x1b73fe['model'],_0x1b73fe[_0x45eb('0x2a')]);_0x169589['attributes']=_['intersection'](_0x1b73fe['model'],qs[_0x45eb('0x2c')](_0x17da5e[_0x45eb('0x2a')]['fields']));_0x169589['attributes']=_0x169589[_0x45eb('0x2d')][_0x45eb('0x2e')]?_0x169589[_0x45eb('0x2d')]:_0x1b73fe['model'];if(!_0x17da5e['query'][_0x45eb('0x2f')](_0x45eb('0x30'))){_0x169589['limit']=qs[_0x45eb('0x1a')](_0x17da5e['query'][_0x45eb('0x1a')]);_0x169589['offset']=qs[_0x45eb('0x19')](_0x17da5e[_0x45eb('0x2a')]['offset']);}_0x169589[_0x45eb('0x31')]=qs[_0x45eb('0x32')](_0x17da5e[_0x45eb('0x2a')][_0x45eb('0x32')]);_0x169589[_0x45eb('0x33')]=qs[_0x45eb('0x34')](_[_0x45eb('0x35')](_0x17da5e[_0x45eb('0x2a')],_0x1b73fe[_0x45eb('0x34')]));if(_0x17da5e[_0x45eb('0x2a')][_0x45eb('0x36')]){_0x169589[_0x45eb('0x33')]=_[_0x45eb('0x37')](_0x169589[_0x45eb('0x33')],{'$or':_['map'](_0x3c7e42,function(_0x1c323b){if(_0x1c323b[_0x45eb('0x38')][_0x45eb('0x39')]!==_0x45eb('0x3a')){var _0x4d261a={};_0x4d261a[_0x1c323b['field']]={'$like':'%'+_0x17da5e[_0x45eb('0x2a')]['filter']+'%'};return _0x4d261a;}})});}_0x169589=_['merge']({},_0x169589,_0x17da5e['options']);var _0x3d7a9a={'where':_0x169589['where']};return db[_0x45eb('0x3b')]['count'](_0x3d7a9a)['then'](function(_0x14d123){_0x4d3149['count']=_0x14d123;if(_0x17da5e['query'][_0x45eb('0x3c')]){_0x169589['include']=[{'all':!![]}];}return db['CmCustomField'][_0x45eb('0x3d')](_0x169589);})[_0x45eb('0x21')](function(_0xdc7b41){_0x4d3149[_0x45eb('0x3e')]=_0xdc7b41;return _0x4d3149;})[_0x45eb('0x21')](respondWithFilteredResult(_0x2311f9,_0x169589))[_0x45eb('0x3f')](handleError(_0x2311f9,null));};exports[_0x45eb('0x40')]=function(_0x4813ed,_0x36fd78){var _0x199978={'raw':!![],'where':{'id':_0x4813ed[_0x45eb('0x41')]['id']}},_0x371811={};_0x371811[_0x45eb('0x27')]=_[_0x45eb('0x29')](db[_0x45eb('0x3b')][_0x45eb('0x26')]);_0x371811[_0x45eb('0x2a')]=_[_0x45eb('0x29')](_0x4813ed[_0x45eb('0x2a')]);_0x371811[_0x45eb('0x34')]=_[_0x45eb('0x2b')](_0x371811[_0x45eb('0x27')],_0x371811[_0x45eb('0x2a')]);_0x199978['attributes']=_[_0x45eb('0x2b')](_0x371811[_0x45eb('0x27')],qs['fields'](_0x4813ed[_0x45eb('0x2a')][_0x45eb('0x2c')]));_0x199978[_0x45eb('0x2d')]=_0x199978['attributes'][_0x45eb('0x2e')]?_0x199978['attributes']:_0x371811[_0x45eb('0x27')];if(_0x4813ed['query'][_0x45eb('0x3c')]){_0x199978[_0x45eb('0x42')]=[{'all':!![]}];}_0x199978=_[_0x45eb('0x37')]({},_0x199978,_0x4813ed['options']);return db[_0x45eb('0x3b')][_0x45eb('0x43')](_0x199978)[_0x45eb('0x21')](handleEntityNotFound(_0x36fd78,null))['then'](respondWithResult(_0x36fd78,null))['catch'](handleError(_0x36fd78,null));};exports['update']=function(_0x51f804,_0x5d3b91){if(_0x51f804[_0x45eb('0x44')]['id']){delete _0x51f804[_0x45eb('0x44')]['id'];}return db[_0x45eb('0x3b')][_0x45eb('0x43')]({'where':{'id':_0x51f804[_0x45eb('0x41')]['id']}})[_0x45eb('0x21')](handleEntityNotFound(_0x5d3b91,null))[_0x45eb('0x21')](saveUpdates(_0x51f804['body'],null))[_0x45eb('0x21')](respondWithResult(_0x5d3b91,null))[_0x45eb('0x3f')](handleError(_0x5d3b91,null));};exports[_0x45eb('0x45')]=function(_0x93a967,_0xa463db){return db[_0x45eb('0x3b')][_0x45eb('0x43')]({'where':{'id':_0x93a967[_0x45eb('0x41')]['id']}})[_0x45eb('0x21')](handleEntityNotFound(_0xa463db,null))['then'](removeEntity(_0xa463db,null))[_0x45eb('0x3f')](handleError(_0xa463db,null));};exports[_0x45eb('0x46')]=function(_0x3ad010,_0x527cdd){var _0xb014c2;return db[_0x45eb('0x47')][_0x45eb('0x48')](function(_0x2b30f1){return db[_0x45eb('0x3b')][_0x45eb('0x46')](_0x3ad010['body'],{'transaction':_0x2b30f1})[_0x45eb('0x21')](function(_0x5e8b16){_0xb014c2=_0x5e8b16;var _0x5935cc={'type':db['Sequelize'][_0x45eb('0x49')],'transaction':_0x2b30f1};switch(_0x3ad010[_0x45eb('0x44')][_0x45eb('0x38')]){case _0x45eb('0x4a'):_0x5935cc[_0x45eb('0x38')]=db[_0x45eb('0x4b')]['TEXT'];break;case _0x45eb('0x4c'):_0x5935cc[_0x45eb('0x38')]=db[_0x45eb('0x4b')]['INTEGER'];break;case _0x45eb('0x4d'):_0x5935cc[_0x45eb('0x38')]=db[_0x45eb('0x4b')][_0x45eb('0x4e')];_0x5935cc[_0x45eb('0x4f')]=![];break;default:}return db[_0x45eb('0x47')][_0x45eb('0x50')][_0x45eb('0x51')]('cm_contacts',util['format'](_0x45eb('0x52'),_0xb014c2['id']),_0x5935cc);})[_0x45eb('0x21')](function(){return _0xb014c2;});})[_0x45eb('0x21')](respondWithResult(_0x527cdd,0xc9))[_0x45eb('0x3f')](handleError(_0x527cdd,null));}; \ No newline at end of file +var _0xfac1=['Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','CmCustomField','differenceBy','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','show','rawAttributes','include','find','catch','body','params','create','sequelize','transaction'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xfac1,0x15a));var _0x1fac=function(_0x14f21c,_0x315b28){_0x14f21c=_0x14f21c-0x0;var _0x2b509b=_0xfac1[_0x14f21c];return _0x2b509b;};'use strict';var pdf=require(_0x1fac('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1fac('0x1'));var zipdir=require(_0x1fac('0x2'));var jsonpatch=require(_0x1fac('0x3'));var rp=require('request-promise');var moment=require(_0x1fac('0x4'));var BPromise=require(_0x1fac('0x5'));var Mustache=require(_0x1fac('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1fac('0x7'));var csv=require(_0x1fac('0x8'));var ejs=require(_0x1fac('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1fac('0xa'));var crypto=require(_0x1fac('0xb'));var jsforce=require(_0x1fac('0xc'));var deskjs=require(_0x1fac('0xd'));var toCsv=require(_0x1fac('0x8'));var querystring=require(_0x1fac('0xe'));var Papa=require(_0x1fac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1fac('0x10'));var hardwareService=require(_0x1fac('0x11'));var logger=require(_0x1fac('0x12'))(_0x1fac('0x13'));var utils=require(_0x1fac('0x14'));var config=require(_0x1fac('0x15'));var db=require(_0x1fac('0x16'))['db'];function respondWithStatusCode(_0x57cd8a,_0x491fdf){_0x491fdf=_0x491fdf||0xcc;return function(_0x21da7a){if(_0x21da7a){return _0x57cd8a[_0x1fac('0x17')](_0x491fdf);}return _0x57cd8a[_0x1fac('0x18')](_0x491fdf)[_0x1fac('0x19')]();};}function respondWithResult(_0x14f3ad,_0xfda216){_0xfda216=_0xfda216||0xc8;return function(_0x357b52){if(_0x357b52){return _0x14f3ad[_0x1fac('0x18')](_0xfda216)[_0x1fac('0x1a')](_0x357b52);}};}function respondWithFilteredResult(_0xb18f38,_0x164ac4){return function(_0x4b6e27){if(_0x4b6e27){var _0x3f7c6f=_0x4b6e27[_0x1fac('0x1b')],_0x3923ef=_0x164ac4[_0x1fac('0x1c')],_0x2e4378=_0x164ac4[_0x1fac('0x1c')]+_0x164ac4[_0x1fac('0x1d')],_0x2c7e31;if(_0x2e4378>=_0x3f7c6f){_0x2e4378=_0x3f7c6f;_0x2c7e31=0xc8;}else{_0x2c7e31=0xce;}_0xb18f38[_0x1fac('0x18')](_0x2c7e31);return _0xb18f38[_0x1fac('0x1e')](_0x1fac('0x1f'),_0x3923ef+'-'+_0x2e4378+'/'+_0x3f7c6f)[_0x1fac('0x1a')](_0x4b6e27);}return null;};}function patchUpdates(_0x1233ff){return function(_0x5a3ca2){try{jsonpatch[_0x1fac('0x20')](_0x5a3ca2,_0x1233ff,!![]);}catch(_0x3b958c){return BPromise[_0x1fac('0x21')](_0x3b958c);}return _0x5a3ca2['save']();};}function saveUpdates(_0x5556a6,_0x572322){return function(_0x412622){if(_0x412622){return _0x412622[_0x1fac('0x22')](_0x5556a6)[_0x1fac('0x23')](function(_0x44f6a4){return _0x44f6a4;});}return null;};}function removeEntity(_0x2cf457,_0x24b0e5){return function(_0x3c465a){if(_0x3c465a){return _0x3c465a[_0x1fac('0x24')]()[_0x1fac('0x23')](function(){_0x2cf457[_0x1fac('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42dd25,_0x5a1a0f){return function(_0x585fae){if(!_0x585fae){_0x42dd25[_0x1fac('0x17')](0x194);}return _0x585fae;};}function handleError(_0x5c20c1,_0x4c9076){_0x4c9076=_0x4c9076||0x1f4;return function(_0x29a97f){logger[_0x1fac('0x25')](_0x29a97f[_0x1fac('0x26')]);if(_0x29a97f[_0x1fac('0x27')]){delete _0x29a97f[_0x1fac('0x27')];}_0x5c20c1['status'](_0x4c9076)['send'](_0x29a97f);};}exports[_0x1fac('0x28')]=function(_0x214ff5,_0x215d04){var _0x442ef9={},_0x380299={},_0x5ce4d9={'count':0x0,'rows':[]};var _0x381aec=db[_0x1fac('0x29')]['rawAttributes'];_0x380299['model']=_[_0x1fac('0x2a')](_[_0x1fac('0x2b')](_0x381aec),[_0x1fac('0x27')]);_0x380299[_0x1fac('0x2c')]=_['keys'](_0x214ff5[_0x1fac('0x2c')]);_0x380299[_0x1fac('0x2d')]=_[_0x1fac('0x2e')](_0x380299[_0x1fac('0x2f')],_0x380299[_0x1fac('0x2c')]);_0x442ef9[_0x1fac('0x30')]=_[_0x1fac('0x2e')](_0x380299[_0x1fac('0x2f')],qs['fields'](_0x214ff5[_0x1fac('0x2c')][_0x1fac('0x31')]));_0x442ef9[_0x1fac('0x30')]=_0x442ef9[_0x1fac('0x30')][_0x1fac('0x32')]?_0x442ef9['attributes']:_0x380299['model'];if(!_0x214ff5[_0x1fac('0x2c')]['hasOwnProperty'](_0x1fac('0x33'))){_0x442ef9[_0x1fac('0x1d')]=qs[_0x1fac('0x1d')](_0x214ff5[_0x1fac('0x2c')][_0x1fac('0x1d')]);_0x442ef9[_0x1fac('0x1c')]=qs[_0x1fac('0x1c')](_0x214ff5[_0x1fac('0x2c')][_0x1fac('0x1c')]);}_0x442ef9['order']=qs[_0x1fac('0x34')](_0x214ff5[_0x1fac('0x2c')][_0x1fac('0x34')]);_0x442ef9[_0x1fac('0x35')]=qs[_0x1fac('0x2d')](_[_0x1fac('0x36')](_0x214ff5[_0x1fac('0x2c')],_0x380299[_0x1fac('0x2d')]));if(_0x214ff5[_0x1fac('0x2c')]['filter']){_0x442ef9[_0x1fac('0x35')]=_[_0x1fac('0x37')](_0x442ef9['where'],{'$or':_[_0x1fac('0x38')](_0x381aec,function(_0x22c38e){if(_0x22c38e[_0x1fac('0x39')][_0x1fac('0x3a')]!==_0x1fac('0x3b')){var _0x29ac06={};_0x29ac06[_0x22c38e[_0x1fac('0x3c')]]={'$like':'%'+_0x214ff5[_0x1fac('0x2c')]['filter']+'%'};return _0x29ac06;}})});}_0x442ef9=_['merge']({},_0x442ef9,_0x214ff5[_0x1fac('0x3d')]);var _0x207540={'where':_0x442ef9[_0x1fac('0x35')]};return db['CmCustomField'][_0x1fac('0x1b')](_0x207540)[_0x1fac('0x23')](function(_0x36b0a5){_0x5ce4d9[_0x1fac('0x1b')]=_0x36b0a5;if(_0x214ff5[_0x1fac('0x2c')][_0x1fac('0x3e')]){_0x442ef9['include']=[{'all':!![]}];}return db[_0x1fac('0x29')][_0x1fac('0x3f')](_0x442ef9);})[_0x1fac('0x23')](function(_0x64c4d1){_0x5ce4d9['rows']=_0x64c4d1;return _0x5ce4d9;})[_0x1fac('0x23')](respondWithFilteredResult(_0x215d04,_0x442ef9))['catch'](handleError(_0x215d04,null));};exports[_0x1fac('0x40')]=function(_0x7349e7,_0xb56653){var _0x3af5ab={'raw':!![],'where':{'id':_0x7349e7['params']['id']}},_0x325e12={};_0x325e12[_0x1fac('0x2f')]=_[_0x1fac('0x2b')](db[_0x1fac('0x29')][_0x1fac('0x41')]);_0x325e12['query']=_[_0x1fac('0x2b')](_0x7349e7['query']);_0x325e12[_0x1fac('0x2d')]=_['intersection'](_0x325e12[_0x1fac('0x2f')],_0x325e12[_0x1fac('0x2c')]);_0x3af5ab['attributes']=_['intersection'](_0x325e12[_0x1fac('0x2f')],qs[_0x1fac('0x31')](_0x7349e7[_0x1fac('0x2c')][_0x1fac('0x31')]));_0x3af5ab[_0x1fac('0x30')]=_0x3af5ab[_0x1fac('0x30')][_0x1fac('0x32')]?_0x3af5ab['attributes']:_0x325e12[_0x1fac('0x2f')];if(_0x7349e7[_0x1fac('0x2c')][_0x1fac('0x3e')]){_0x3af5ab[_0x1fac('0x42')]=[{'all':!![]}];}_0x3af5ab=_[_0x1fac('0x37')]({},_0x3af5ab,_0x7349e7[_0x1fac('0x3d')]);return db[_0x1fac('0x29')][_0x1fac('0x43')](_0x3af5ab)['then'](handleEntityNotFound(_0xb56653,null))[_0x1fac('0x23')](respondWithResult(_0xb56653,null))[_0x1fac('0x44')](handleError(_0xb56653,null));};exports[_0x1fac('0x22')]=function(_0x1856af,_0x58a9de){if(_0x1856af[_0x1fac('0x45')]['id']){delete _0x1856af[_0x1fac('0x45')]['id'];}return db['CmCustomField'][_0x1fac('0x43')]({'where':{'id':_0x1856af[_0x1fac('0x46')]['id']}})['then'](handleEntityNotFound(_0x58a9de,null))[_0x1fac('0x23')](saveUpdates(_0x1856af[_0x1fac('0x45')],null))[_0x1fac('0x23')](respondWithResult(_0x58a9de,null))[_0x1fac('0x44')](handleError(_0x58a9de,null));};exports[_0x1fac('0x24')]=function(_0x142386,_0xef3a11){return db[_0x1fac('0x29')][_0x1fac('0x43')]({'where':{'id':_0x142386[_0x1fac('0x46')]['id']}})[_0x1fac('0x23')](handleEntityNotFound(_0xef3a11,null))['then'](removeEntity(_0xef3a11,null))['catch'](handleError(_0xef3a11,null));};exports[_0x1fac('0x47')]=function(_0x495098,_0x55a7dd){var _0x2dac9b;return db[_0x1fac('0x48')][_0x1fac('0x49')](function(_0x1d1f14){return db[_0x1fac('0x29')][_0x1fac('0x47')](_0x495098[_0x1fac('0x45')],{'transaction':_0x1d1f14})['then'](function(_0x300d45){_0x2dac9b=_0x300d45;var _0x4b1402={'type':db[_0x1fac('0x4a')][_0x1fac('0x4b')],'transaction':_0x1d1f14};switch(_0x495098[_0x1fac('0x45')][_0x1fac('0x39')]){case _0x1fac('0x4c'):_0x4b1402[_0x1fac('0x39')]=db[_0x1fac('0x4a')]['TEXT'];break;case'number':_0x4b1402[_0x1fac('0x39')]=db[_0x1fac('0x4a')]['INTEGER'];break;case _0x1fac('0x4d'):_0x4b1402[_0x1fac('0x39')]=db[_0x1fac('0x4a')][_0x1fac('0x4e')];_0x4b1402[_0x1fac('0x4f')]=![];break;default:}return db[_0x1fac('0x48')]['queryInterface'][_0x1fac('0x50')](_0x1fac('0x51'),util[_0x1fac('0x52')](_0x1fac('0x53'),_0x2dac9b['id']),_0x4b1402);})[_0x1fac('0x23')](function(){return _0x2dac9b;});})[_0x1fac('0x23')](respondWithResult(_0x55a7dd,0xc9))[_0x1fac('0x44')](handleError(_0x55a7dd,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 73fe762..baf9ab3 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 _0x8bb4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash'];(function(_0x1b7f2f,_0x4bb7d2){var _0x4621c1=function(_0x2e42b5){while(--_0x2e42b5){_0x1b7f2f['push'](_0x1b7f2f['shift']());}};_0x4621c1(++_0x4bb7d2);}(_0x8bb4,0x11f));var _0x48bb=function(_0x48db50,_0x49f6e9){_0x48db50=_0x48db50-0x0;var _0x43e92f=_0x8bb4[_0x48db50];return _0x43e92f;};'use strict';var _=require(_0x48bb('0x0'));var util=require('util');var logger=require(_0x48bb('0x1'))(_0x48bb('0x2'));var moment=require(_0x48bb('0x3'));var BPromise=require(_0x48bb('0x4'));var rp=require(_0x48bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48bb('0x6'));var config=require(_0x48bb('0x7'));var attributes=require(_0x48bb('0x8'));module[_0x48bb('0x9')]=function(_0x15fb05,_0x57e538){return _0x15fb05[_0x48bb('0xa')](_0x48bb('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef44=['moment','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','api'];(function(_0x340f46,_0x18becf){var _0x330cbd=function(_0x35e51a){while(--_0x35e51a){_0x340f46['push'](_0x340f46['shift']());}};_0x330cbd(++_0x18becf);}(_0xef44,0x1ea));var _0x4ef4=function(_0x249f40,_0x5e09d0){_0x249f40=_0x249f40-0x0;var _0x21fddc=_0xef44[_0x249f40];return _0x21fddc;};'use strict';var _=require(_0x4ef4('0x0'));var util=require(_0x4ef4('0x1'));var logger=require(_0x4ef4('0x2'))(_0x4ef4('0x3'));var moment=require(_0x4ef4('0x4'));var BPromise=require(_0x4ef4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ef4('0x6'));var rimraf=require(_0x4ef4('0x7'));var config=require(_0x4ef4('0x8'));var attributes=require(_0x4ef4('0x9'));module[_0x4ef4('0xa')]=function(_0x2caacd,_0xb47b40){return _0x2caacd[_0x4ef4('0xb')](_0x4ef4('0xc'),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 cb0fcd0..9c9158d 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 _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','CmCustomField,\x20%s,\x20%s'];(function(_0x4fdc55,_0x2be9ed){var _0x2c05ce=function(_0xc3b573){while(--_0xc3b573){_0x4fdc55['push'](_0x4fdc55['shift']());}};_0x2c05ce(++_0x2be9ed);}(_0x5ff3,0x17d));var _0x35ff=function(_0x4ac87e,_0x3d50c3){_0x4ac87e=_0x4ac87e-0x0;var _0x36b8c5=_0x5ff3[_0x4ac87e];return _0x36b8c5;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('CmCustomField,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x240cca,_0x392017){var _0x118f2c=function(_0x2a42de){while(--_0x2a42de){_0x240cca['push'](_0x240cca['shift']());}};_0x118f2c(++_0x392017);}(_0x99e9,0xb4));var _0x999e=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x99e9[_0x3358ba];return _0x296e73;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('CmCustomField,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 94c0a26..8ac7a86 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 _0xd02a=['connect-timeout','Router','../../config/environment','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x398d85,_0x2465d7){var _0x33c2bb=function(_0x4aa229){while(--_0x4aa229){_0x398d85['push'](_0x398d85['shift']());}};_0x33c2bb(++_0x2465d7);}(_0xd02a,0x85));var _0xad02=function(_0xcf6e41,_0x38884f){_0xcf6e41=_0xcf6e41-0x0;var _0x2b6fd2=_0xd02a[_0xcf6e41];return _0x2b6fd2;};'use strict';var multer=require(_0xad02('0x0'));var util=require(_0xad02('0x1'));var path=require(_0xad02('0x2'));var timeout=require(_0xad02('0x3'));var express=require('express');var router=express[_0xad02('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xad02('0x5'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xad02('0x6')](),controller[_0xad02('0x7')]);router[_0xad02('0x8')]('/:id',auth[_0xad02('0x6')](),controller['show']);router[_0xad02('0x9')]('/',auth[_0xad02('0x6')](),controller[_0xad02('0xa')]);router[_0xad02('0xb')](_0xad02('0xc'),auth[_0xad02('0x6')](),controller[_0xad02('0xd')]);router[_0xad02('0xe')](_0xad02('0xc'),auth[_0xad02('0x6')](),controller[_0xad02('0xf')]);module[_0xad02('0x10')]=router; \ No newline at end of file +var _0xf452=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x1b1237,_0x2b8663){var _0x44dd8b=function(_0x407866){while(--_0x407866){_0x1b1237['push'](_0x1b1237['shift']());}};_0x44dd8b(++_0x2b8663);}(_0xf452,0x144));var _0x2f45=function(_0x4387d7,_0x5f1745){_0x4387d7=_0x4387d7-0x0;var _0x528ee3=_0xf452[_0x4387d7];return _0x528ee3;};'use strict';var multer=require('multer');var util=require(_0x2f45('0x0'));var path=require(_0x2f45('0x1'));var timeout=require('connect-timeout');var express=require(_0x2f45('0x2'));var router=express['Router']();var auth=require(_0x2f45('0x3'));var interaction=require(_0x2f45('0x4'));var config=require(_0x2f45('0x5'));var controller=require(_0x2f45('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2f45('0x7')]);router[_0x2f45('0x8')](_0x2f45('0x9'),auth[_0x2f45('0xa')](),controller[_0x2f45('0xb')]);router[_0x2f45('0xc')]('/',auth[_0x2f45('0xa')](),controller[_0x2f45('0xd')]);router[_0x2f45('0xe')](_0x2f45('0x9'),auth[_0x2f45('0xa')](),controller[_0x2f45('0xf')]);router[_0x2f45('0x10')]('/:id',auth[_0x2f45('0xa')](),controller[_0x2f45('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 57278b6..83f1ed8 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 _0x177a=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','STRING','BOOLEAN','DATE'];(function(_0x9565e9,_0x3de8c1){var _0x43c55d=function(_0x282ebc){while(--_0x282ebc){_0x9565e9['push'](_0x9565e9['shift']());}};_0x43c55d(++_0x3de8c1);}(_0x177a,0xdd));var _0xa177=function(_0x3b3fae,_0x4ee450){_0x3b3fae=_0x3b3fae-0x0;var _0x2a9748=_0x177a[_0x3b3fae];return _0x2a9748;};'use strict';var moment=require(_0xa177('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xa177('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xa177('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa177('0x3')],'defaultValue':moment()[_0xa177('0x4')](_0xa177('0x5'))},'countbusyretry':{'type':Sequelize[_0xa177('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa177('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa177('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa177('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa177('0x3')]},'priority':{'type':Sequelize[_0xa177('0x6')](0x2)[_0xa177('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa177('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa177('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa177('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xa177('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xa177('0x6')],'unique':_0xa177('0x8')},'CampaignId':{'type':Sequelize[_0xa177('0x6')]}}; \ No newline at end of file +var _0x976e=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN'];(function(_0x4f3ba4,_0x2c16bb){var _0x458f38=function(_0x2d571c){while(--_0x2d571c){_0x4f3ba4['push'](_0x4f3ba4['shift']());}};_0x458f38(++_0x2c16bb);}(_0x976e,0x1c9));var _0xe976=function(_0x3bbe5b,_0xfb4c3e){_0x3bbe5b=_0x3bbe5b-0x0;var _0x1f529d=_0x976e[_0x3bbe5b];return _0x1f529d;};'use strict';var moment=require('moment');var Sequelize=require(_0xe976('0x0'));module[_0xe976('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xe976('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe976('0x3')],'defaultValue':moment()[_0xe976('0x4')](_0xe976('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe976('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe976('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe976('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe976('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe976('0x3')]},'priority':{'type':Sequelize[_0xe976('0x6')](0x2)[_0xe976('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe976('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe976('0x6')],'unique':_0xe976('0x9')},'ListId':{'type':Sequelize[_0xe976('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xe976('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xe976('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 4ed05c9..2fd648c 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 _0x59c3=['firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','Company','List','getOpenContacts','isNumber','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','index','CmHopper','rawAttributes','model','keys','query','filters','$and','$or','$gt','$gte','$lt','$ne','$between','$notBetween','$in','$notIn','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','key','VIRTUAL','include','findAll','rows','catch','show','intersection','includeAll','options','find','create','body','describe','params','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','ContactId'];(function(_0x3017b9,_0x5c2c5e){var _0x55eada=function(_0x210c6d){while(--_0x210c6d){_0x3017b9['push'](_0x3017b9['shift']());}};_0x55eada(++_0x5c2c5e);}(_0x59c3,0xb0));var _0x359c=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x59c3[_0x53cf8e];return _0x459197;};'use strict';var pdf=require(_0x359c('0x0'));var emlformat=require(_0x359c('0x1'));var rimraf=require(_0x359c('0x2'));var zipdir=require(_0x359c('0x3'));var jsonpatch=require(_0x359c('0x4'));var rp=require(_0x359c('0x5'));var moment=require('moment');var BPromise=require(_0x359c('0x6'));var Mustache=require(_0x359c('0x7'));var util=require('util');var path=require(_0x359c('0x8'));var sox=require(_0x359c('0x9'));var csv=require(_0x359c('0xa'));var ejs=require(_0x359c('0xb'));var fs=require('fs');var _=require(_0x359c('0xc'));var squel=require(_0x359c('0xd'));var crypto=require('crypto');var jsforce=require(_0x359c('0xe'));var deskjs=require(_0x359c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x359c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x359c('0x11'));var qs=require(_0x359c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x359c('0x13'))(_0x359c('0x14'));var utils=require(_0x359c('0x15'));var config=require('../../config/environment');var db=require(_0x359c('0x16'))['db'];function respondWithStatusCode(_0xc73fce,_0x403b2e){_0x403b2e=_0x403b2e||0xcc;return function(_0x1058cd){if(_0x1058cd){return _0xc73fce['sendStatus'](_0x403b2e);}return _0xc73fce['status'](_0x403b2e)[_0x359c('0x17')]();};}function respondWithResult(_0x38bcf0,_0xbc5838){_0xbc5838=_0xbc5838||0xc8;return function(_0x5a3def){if(_0x5a3def){return _0x38bcf0[_0x359c('0x18')](_0xbc5838)[_0x359c('0x19')](_0x5a3def);}};}function respondWithFilteredResult(_0x8a8591,_0x51face){return function(_0x290a24){if(_0x290a24){var _0x4f797d=_0x290a24[_0x359c('0x1a')],_0xa3b3ba=_0x51face[_0x359c('0x1b')],_0x71c99d=_0x51face['offset']+_0x51face[_0x359c('0x1c')],_0x5f2c52;if(_0x71c99d>=_0x4f797d){_0x71c99d=_0x4f797d;_0x5f2c52=0xc8;}else{_0x5f2c52=0xce;}_0x8a8591[_0x359c('0x18')](_0x5f2c52);return _0x8a8591[_0x359c('0x1d')](_0x359c('0x1e'),_0xa3b3ba+'-'+_0x71c99d+'/'+_0x4f797d)[_0x359c('0x19')](_0x290a24);}return null;};}function patchUpdates(_0x1d791f){return function(_0x2f5ad3){try{jsonpatch[_0x359c('0x1f')](_0x2f5ad3,_0x1d791f,!![]);}catch(_0x6d2ee7){return BPromise['reject'](_0x6d2ee7);}return _0x2f5ad3[_0x359c('0x20')]();};}function saveUpdates(_0xee2fa3,_0x574b8b){return function(_0x15eb82){if(_0x15eb82){return _0x15eb82[_0x359c('0x21')](_0xee2fa3)[_0x359c('0x22')](function(_0x4269ad){return _0x4269ad;});}return null;};}function removeEntity(_0x4b862,_0x4c74fe){return function(_0x303fc9){if(_0x303fc9){return _0x303fc9[_0x359c('0x23')]()[_0x359c('0x22')](function(){_0x4b862[_0x359c('0x18')](0xcc)[_0x359c('0x17')]();});}};}function handleEntityNotFound(_0x2bbbe0,_0x3ca147){return function(_0xe8293b){if(!_0xe8293b){_0x2bbbe0[_0x359c('0x24')](0x194);}return _0xe8293b;};}function handleError(_0x4058bd,_0x17e714){_0x17e714=_0x17e714||0x1f4;return function(_0x3b8602){logger[_0x359c('0x25')](_0x3b8602['stack']);if(_0x3b8602[_0x359c('0x26')]){delete _0x3b8602['name'];}_0x4058bd[_0x359c('0x18')](_0x17e714)['send'](_0x3b8602);};}exports[_0x359c('0x27')]=function(_0x50614a,_0x4627ed){var _0x4ed1ba={},_0x3c8284={},_0x4ed8da={'count':0x0,'rows':[]};var _0x28514f=db[_0x359c('0x28')][_0x359c('0x29')];_0x3c8284[_0x359c('0x2a')]=_[_0x359c('0x2b')](_0x28514f);_0x3c8284[_0x359c('0x2c')]=_[_0x359c('0x2b')](_0x50614a['query']);_0x3c8284[_0x359c('0x2d')]=_['intersection'](_0x3c8284[_0x359c('0x2a')],_0x3c8284[_0x359c('0x2c')]);_0x3c8284[_0x359c('0x2d')]=_['concat'](_0x3c8284[_0x359c('0x2d')],[_0x359c('0x2e'),_0x359c('0x2f'),_0x359c('0x30'),_0x359c('0x31'),_0x359c('0x32'),'$lte',_0x359c('0x33'),'$eq','$not',_0x359c('0x34'),_0x359c('0x35'),_0x359c('0x36'),_0x359c('0x37'),'$like','$notLike',_0x359c('0x38'),_0x359c('0x39'),'$like',_0x359c('0x3a'),_0x359c('0x3b'),_0x359c('0x3c'),_0x359c('0x3d')]);_0x4ed1ba[_0x359c('0x3e')]=_['intersection'](_0x3c8284['model'],qs[_0x359c('0x3f')](_0x50614a['query'][_0x359c('0x3f')]));_0x4ed1ba[_0x359c('0x3e')]=_0x4ed1ba[_0x359c('0x3e')][_0x359c('0x40')]?_0x4ed1ba[_0x359c('0x3e')]:_0x3c8284[_0x359c('0x2a')];if(!_0x50614a[_0x359c('0x2c')][_0x359c('0x41')](_0x359c('0x42'))){_0x4ed1ba[_0x359c('0x1c')]=qs[_0x359c('0x1c')](_0x50614a[_0x359c('0x2c')]['limit']);_0x4ed1ba['offset']=qs[_0x359c('0x1b')](_0x50614a['query'][_0x359c('0x1b')]);}_0x4ed1ba['order']=qs[_0x359c('0x43')](_0x50614a[_0x359c('0x2c')][_0x359c('0x43')]);_0x4ed1ba['where']=qs['filters'](_[_0x359c('0x44')](_0x50614a[_0x359c('0x2c')],_0x3c8284[_0x359c('0x2d')]));if(_0x50614a[_0x359c('0x2c')][_0x359c('0x45')]){_0x4ed1ba[_0x359c('0x46')]=_[_0x359c('0x47')](_0x4ed1ba['where'],{'$or':_[_0x359c('0x48')](_0x28514f,function(_0x421917){if(_0x421917[_0x359c('0x49')][_0x359c('0x4a')]!==_0x359c('0x4b')){var _0x203e9d={};_0x203e9d[_0x421917['field']]={'$like':'%'+_0x50614a[_0x359c('0x2c')][_0x359c('0x45')]+'%'};return _0x203e9d;}})});}_0x4ed1ba=_[_0x359c('0x47')]({},_0x4ed1ba,_0x50614a['options']);var _0x4f54fc={'where':_0x4ed1ba[_0x359c('0x46')]};return db[_0x359c('0x28')]['count'](_0x4f54fc)[_0x359c('0x22')](function(_0x1b2b8c){_0x4ed8da[_0x359c('0x1a')]=_0x1b2b8c;if(_0x50614a['query']['includeAll']){_0x4ed1ba[_0x359c('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0x359c('0x4d')](_0x4ed1ba);})['then'](function(_0x4d9e3d){_0x4ed8da[_0x359c('0x4e')]=_0x4d9e3d;return _0x4ed8da;})[_0x359c('0x22')](respondWithFilteredResult(_0x4627ed,_0x4ed1ba))[_0x359c('0x4f')](handleError(_0x4627ed,null));};exports[_0x359c('0x50')]=function(_0x5053a5,_0x27d6db){var _0x3266b2={'raw':!![],'where':{'id':_0x5053a5['params']['id']}},_0x767e08={};_0x767e08[_0x359c('0x2a')]=_[_0x359c('0x2b')](db[_0x359c('0x28')][_0x359c('0x29')]);_0x767e08[_0x359c('0x2c')]=_[_0x359c('0x2b')](_0x5053a5[_0x359c('0x2c')]);_0x767e08[_0x359c('0x2d')]=_['intersection'](_0x767e08[_0x359c('0x2a')],_0x767e08[_0x359c('0x2c')]);_0x3266b2['attributes']=_[_0x359c('0x51')](_0x767e08[_0x359c('0x2a')],qs[_0x359c('0x3f')](_0x5053a5['query']['fields']));_0x3266b2[_0x359c('0x3e')]=_0x3266b2[_0x359c('0x3e')]['length']?_0x3266b2['attributes']:_0x767e08[_0x359c('0x2a')];if(_0x5053a5[_0x359c('0x2c')][_0x359c('0x52')]){_0x3266b2['include']=[{'all':!![]}];}_0x3266b2=_[_0x359c('0x47')]({},_0x3266b2,_0x5053a5[_0x359c('0x53')]);return db['CmHopper'][_0x359c('0x54')](_0x3266b2)[_0x359c('0x22')](handleEntityNotFound(_0x27d6db,null))[_0x359c('0x22')](respondWithResult(_0x27d6db,null))[_0x359c('0x4f')](handleError(_0x27d6db,null));};exports['create']=function(_0x360d6b,_0xa8b161){return db['CmHopper'][_0x359c('0x55')](_0x360d6b['body'],{})[_0x359c('0x22')](respondWithResult(_0xa8b161,0xc9))[_0x359c('0x4f')](handleError(_0xa8b161,null));};exports[_0x359c('0x21')]=function(_0x39fbbf,_0x346553){if(_0x39fbbf[_0x359c('0x56')]['id']){delete _0x39fbbf[_0x359c('0x56')]['id'];}return db[_0x359c('0x28')][_0x359c('0x54')]({'where':{'id':_0x39fbbf['params']['id']}})[_0x359c('0x22')](handleEntityNotFound(_0x346553,null))[_0x359c('0x22')](saveUpdates(_0x39fbbf[_0x359c('0x56')],null))['then'](respondWithResult(_0x346553,null))[_0x359c('0x4f')](handleError(_0x346553,null));};exports[_0x359c('0x57')]=function(_0x5257f6,_0x4ddd52){return db[_0x359c('0x28')][_0x359c('0x57')]()['then'](respondWithResult(_0x4ddd52,null))[_0x359c('0x4f')](handleError(_0x4ddd52,null));};exports[_0x359c('0x23')]=function(_0xa3711c,_0x511baf){var _0x298314;return db[_0x359c('0x28')][_0x359c('0x54')]({'where':{'id':_0xa3711c[_0x359c('0x58')]['id']}})['then'](handleEntityNotFound(_0x511baf,null))[_0x359c('0x22')](function(_0x209fb5){if(_0x209fb5){return _0x209fb5['destroy']()[_0x359c('0x22')](function(_0x2f24cd){return _0x2f24cd;});}})[_0x359c('0x22')](function(_0x518ce9){_0x298314=_0x518ce9;if(_0x518ce9){if(_0x518ce9[_0x359c('0x59')]||_0x518ce9['CampaignId']){return db[_0x518ce9[_0x359c('0x59')]?_0x359c('0x5a'):_0x359c('0x5b')][_0x359c('0x54')]({'where':{'id':_0x518ce9['VoiceQueueId']?_0x518ce9[_0x359c('0x59')]:_0x518ce9[_0x359c('0x5c')]},'attributes':['id',_0x359c('0x26')],'raw':!![]});}}})[_0x359c('0x22')](function(_0x55b85a){var _0x112d04={};if(_0x55b85a){_[_0x359c('0x47')](_0x112d04,_[_0x359c('0x5d')](_0x298314[_0x359c('0x5e')],[_0x359c('0x5f'),_0x359c('0x60'),'id']));_0x112d04['state']=0x15;_0x112d04[_0x359c('0x61')]='deleted';_0x112d04[_0x359c('0x62')]=_0x55b85a['name'];_0x112d04[_0x359c('0x63')]=_0xa3711c[_0x359c('0x64')][_0x359c('0x26')];_0x112d04[_0x359c('0x65')]=_0xa3711c[_0x359c('0x64')]['id'];_0x112d04[_0x359c('0x66')]=!![];_0x112d04[_0x359c('0x67')]=moment()[_0x359c('0x68')](_0x359c('0x69'));_0x112d04[_0x359c('0x6a')]=_0x298314[_0x359c('0x6b')];_0x112d04['campaigntype']=_0x298314[_0x359c('0x59')]?'queue':_0x359c('0x6c');return db['CmContact'][_0x359c('0x54')]({'where':{'id':_0x112d04[_0x359c('0x6d')]},'attributes':[_0x359c('0x6e'),_0x359c('0x6f')]})['then'](function(_0x4aee54){if(!_[_0x359c('0x70')](_0x511baf)&&!_[_0x359c('0x70')](_0x4aee54['firstName'])){_0x112d04['calleridname']=_0x4aee54['firstName'];if(!_[_0x359c('0x70')](_0x4aee54['lastName'])){_0x112d04[_0x359c('0x71')]+='\x20'+_0x4aee54[_0x359c('0x6f')];}}})[_0x359c('0x72')](function(){return db[_0x359c('0x73')]['create'](_0x112d04);});}})['then'](function(){return _0x511baf[_0x359c('0x18')](0xcc)[_0x359c('0x17')]();})['catch'](handleError(_0x511baf,null));};exports[_0x359c('0x74')]=function(_0x46efa8,_0xffe3cf,_0x2a506a){var _0xc0709d=[];return db[_0x359c('0x75')]['describe']()[_0x359c('0x22')](function(_0x28c7ad){_0xc0709d=_[_0x359c('0x2b')](_0x28c7ad);return _0x46efa8[_0x359c('0x64')][_0x359c('0x76')]({'where':{'type':_0x359c('0x77'),'dialActive':!![],'dialMethod':_0x359c('0x78')},'attributes':['id',_0x359c('0x79')],'raw':!![]});})[_0x359c('0x22')](function(_0x45b676){if(_0x45b676&&_0x45b676[_0x359c('0x40')]){return db[_0x359c('0x7a')]['transaction'](function(_0x3e56c5){var _0x4a5c41={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x359c('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x359c('0x48')](_0x45b676,'id')},'$or':[{'UserId':null},{'UserId':_0x46efa8[_0x359c('0x64')]['id']}]};var _0x47569d=[];if(_0x46efa8[_0x359c('0x56')][_0x359c('0x7b')]&&_0x46efa8[_0x359c('0x56')][_0x359c('0x7b')]===_0x359c('0x7c')){if(!_[_0x359c('0x7d')](_0x46efa8[_0x359c('0x56')][_0x359c('0x7e')])){_0x4a5c41['id']={'$in':_0x46efa8['body']['hopperIds']};}_0x47569d=[[_0x359c('0x7f'),_0x359c('0x80')],['scheduledAt',_0x45b676[0x0][_0x359c('0x79')]===_0x359c('0x80')?'DESC':_0x359c('0x80')],db[_0x359c('0x7a')][_0x359c('0x81')](_0x359c('0x82')),['id',_0x359c('0x83')]];}else{if(!_['isEmpty'](_0x46efa8['body']['hopperIds'])){_0x4a5c41['id']={'$notIn':_0x46efa8[_0x359c('0x56')][_0x359c('0x7e')]};}_0x47569d=[[_0x359c('0x7f'),_0x359c('0x83')],[_0x359c('0x84'),_0x45b676[0x0][_0x359c('0x79')]],db['sequelize'][_0x359c('0x81')](_0x359c('0x85')),['id',_0x359c('0x80')]];}return db[_0x359c('0x28')][_0x359c('0x86')]({'attributes':['id','scheduledat'],'where':_0x4a5c41,'order':_0x47569d,'transaction':_0x3e56c5,'lock':_0x3e56c5[_0x359c('0x87')][_0x359c('0x88')],'include':[{'model':db['CmContact'],'as':_0x359c('0x89'),'attributes':_0xc0709d,'include':[{'model':db['CmCompany'],'as':_0x359c('0x8a'),'attributes':['id',_0x359c('0x26')]}]},{'model':db['CmList'],'as':_0x359c('0x8b'),'attributes':['id',_0x359c('0x26')]},{'model':db[_0x359c('0x5a')],'as':'Queue','attributes':['id',_0x359c('0x26'),'dialActive']}]})['then'](function(_0x48c58e){if(_0x48c58e){return _0x48c58e[_0x359c('0x21')]({'UserId':_0x46efa8[_0x359c('0x64')]['id']},{'transaction':_0x3e56c5});}});});}})[_0x359c('0x22')](handleEntityNotFound(_0xffe3cf,null))[_0x359c('0x22')](respondWithResult(_0xffe3cf,null))[_0x359c('0x4f')](handleError(_0xffe3cf,null));};exports[_0x359c('0x8c')]=function(_0x106aeb,_0x4a5f20,_0x6795ee){return _0x106aeb[_0x359c('0x64')][_0x359c('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x359c('0x78')},'attributes':['id'],'raw':!![]})['then'](function(_0x19bafc){if(_0x19bafc&&_0x19bafc['length']){return db['CmHopper'][_0x359c('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x359c('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x359c('0x48')](_0x19bafc,'id')},'$or':[{'UserId':null},{'UserId':_0x106aeb[_0x359c('0x64')]['id']}]}});}return 0x0;})[_0x359c('0x22')](function(_0x4f17c4){if(!_[_0x359c('0x70')](_0x4f17c4)&&_[_0x359c('0x8d')](_0x4f17c4)){return _0x4a5f20[_0x359c('0x18')](0xc8)[_0x359c('0x19')]({'contacts':_0x4f17c4});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x359c('0x8c'),0x194,_0x359c('0x8e'));_0x4a5f20['sendStatus'](0x194);}})[_0x359c('0x4f')](handleError(_0x4a5f20,null));}; \ No newline at end of file +var _0x8d26=['VoiceQueue','CampaignId','omit','dataValues','createdAt','updatedAt','statedesc','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmList','List','dialActive','getOpenContacts','isNumber','json','error','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','limit','set','reject','save','update','then','stack','name','index','CmHopper','model','keys','query','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','key','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','describe','destroy','find','VoiceQueueId'];(function(_0x2841f4,_0x5ab834){var _0x543466=function(_0xe5b341){while(--_0xe5b341){_0x2841f4['push'](_0x2841f4['shift']());}};_0x543466(++_0x5ab834);}(_0x8d26,0x150));var _0x68d2=function(_0x2d3df2,_0x2f9498){_0x2d3df2=_0x2d3df2-0x0;var _0x347bda=_0x8d26[_0x2d3df2];return _0x347bda;};'use strict';var pdf=require(_0x68d2('0x0'));var emlformat=require(_0x68d2('0x1'));var rimraf=require(_0x68d2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68d2('0x3'));var rp=require(_0x68d2('0x4'));var moment=require(_0x68d2('0x5'));var BPromise=require(_0x68d2('0x6'));var Mustache=require(_0x68d2('0x7'));var util=require(_0x68d2('0x8'));var path=require(_0x68d2('0x9'));var sox=require('sox');var csv=require(_0x68d2('0xa'));var ejs=require(_0x68d2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x68d2('0xc'));var crypto=require(_0x68d2('0xd'));var jsforce=require(_0x68d2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x68d2('0xa'));var querystring=require(_0x68d2('0xf'));var Papa=require(_0x68d2('0x10'));var Redis=require(_0x68d2('0x11'));var authService=require(_0x68d2('0x12'));var qs=require(_0x68d2('0x13'));var hardwareService=require(_0x68d2('0x14'));var logger=require(_0x68d2('0x15'))(_0x68d2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfb2b31,_0x530623){_0x530623=_0x530623||0xcc;return function(_0x587507){if(_0x587507){return _0xfb2b31[_0x68d2('0x17')](_0x530623);}return _0xfb2b31[_0x68d2('0x18')](_0x530623)[_0x68d2('0x19')]();};}function respondWithResult(_0x2f24fc,_0xe29def){_0xe29def=_0xe29def||0xc8;return function(_0x31b7f0){if(_0x31b7f0){return _0x2f24fc[_0x68d2('0x18')](_0xe29def)['json'](_0x31b7f0);}};}function respondWithFilteredResult(_0x3d0b0f,_0x427043){return function(_0x1546c3){if(_0x1546c3){var _0x461410=_0x1546c3[_0x68d2('0x1a')],_0xa12d2a=_0x427043[_0x68d2('0x1b')],_0x216cdb=_0x427043[_0x68d2('0x1b')]+_0x427043[_0x68d2('0x1c')],_0x155a45;if(_0x216cdb>=_0x461410){_0x216cdb=_0x461410;_0x155a45=0xc8;}else{_0x155a45=0xce;}_0x3d0b0f[_0x68d2('0x18')](_0x155a45);return _0x3d0b0f[_0x68d2('0x1d')]('Content-Range',_0xa12d2a+'-'+_0x216cdb+'/'+_0x461410)['json'](_0x1546c3);}return null;};}function patchUpdates(_0x3e69be){return function(_0x245304){try{jsonpatch['apply'](_0x245304,_0x3e69be,!![]);}catch(_0x29c36e){return BPromise[_0x68d2('0x1e')](_0x29c36e);}return _0x245304[_0x68d2('0x1f')]();};}function saveUpdates(_0x4987e3,_0x5ee0cb){return function(_0x16d913){if(_0x16d913){return _0x16d913[_0x68d2('0x20')](_0x4987e3)[_0x68d2('0x21')](function(_0x3ade7f){return _0x3ade7f;});}return null;};}function removeEntity(_0x4a33a0,_0x434c07){return function(_0x2c6d15){if(_0x2c6d15){return _0x2c6d15['destroy']()[_0x68d2('0x21')](function(){_0x4a33a0[_0x68d2('0x18')](0xcc)[_0x68d2('0x19')]();});}};}function handleEntityNotFound(_0x2ca303,_0x10801a){return function(_0x19e586){if(!_0x19e586){_0x2ca303[_0x68d2('0x17')](0x194);}return _0x19e586;};}function handleError(_0x3ab281,_0x3e7e28){_0x3e7e28=_0x3e7e28||0x1f4;return function(_0x32afdf){logger['error'](_0x32afdf[_0x68d2('0x22')]);if(_0x32afdf[_0x68d2('0x23')]){delete _0x32afdf[_0x68d2('0x23')];}_0x3ab281['status'](_0x3e7e28)['send'](_0x32afdf);};}exports[_0x68d2('0x24')]=function(_0x58a0b3,_0x27f7a2){var _0x30f664={},_0x51d650={},_0x503ffc={'count':0x0,'rows':[]};var _0x413e49=db[_0x68d2('0x25')]['rawAttributes'];_0x51d650[_0x68d2('0x26')]=_[_0x68d2('0x27')](_0x413e49);_0x51d650[_0x68d2('0x28')]=_['keys'](_0x58a0b3[_0x68d2('0x28')]);_0x51d650[_0x68d2('0x29')]=_[_0x68d2('0x2a')](_0x51d650['model'],_0x51d650[_0x68d2('0x28')]);_0x51d650[_0x68d2('0x29')]=_[_0x68d2('0x2b')](_0x51d650[_0x68d2('0x29')],[_0x68d2('0x2c'),'$or',_0x68d2('0x2d'),_0x68d2('0x2e'),_0x68d2('0x2f'),_0x68d2('0x30'),_0x68d2('0x31'),_0x68d2('0x32'),_0x68d2('0x33'),_0x68d2('0x34'),_0x68d2('0x35'),'$in',_0x68d2('0x36'),_0x68d2('0x37'),_0x68d2('0x38'),_0x68d2('0x39'),_0x68d2('0x3a'),'$like','$overlap',_0x68d2('0x3b'),_0x68d2('0x3c'),_0x68d2('0x3d')]);_0x30f664[_0x68d2('0x3e')]=_[_0x68d2('0x2a')](_0x51d650['model'],qs[_0x68d2('0x3f')](_0x58a0b3[_0x68d2('0x28')][_0x68d2('0x3f')]));_0x30f664[_0x68d2('0x3e')]=_0x30f664[_0x68d2('0x3e')][_0x68d2('0x40')]?_0x30f664['attributes']:_0x51d650[_0x68d2('0x26')];if(!_0x58a0b3[_0x68d2('0x28')][_0x68d2('0x41')](_0x68d2('0x42'))){_0x30f664[_0x68d2('0x1c')]=qs[_0x68d2('0x1c')](_0x58a0b3[_0x68d2('0x28')][_0x68d2('0x1c')]);_0x30f664['offset']=qs[_0x68d2('0x1b')](_0x58a0b3[_0x68d2('0x28')][_0x68d2('0x1b')]);}_0x30f664[_0x68d2('0x43')]=qs['sort'](_0x58a0b3['query'][_0x68d2('0x44')]);_0x30f664[_0x68d2('0x45')]=qs[_0x68d2('0x29')](_[_0x68d2('0x46')](_0x58a0b3[_0x68d2('0x28')],_0x51d650['filters']));if(_0x58a0b3['query'][_0x68d2('0x47')]){_0x30f664[_0x68d2('0x45')]=_['merge'](_0x30f664['where'],{'$or':_[_0x68d2('0x48')](_0x413e49,function(_0x2effdb){if(_0x2effdb['type'][_0x68d2('0x49')]!==_0x68d2('0x4a')){var _0x1ea4f0={};_0x1ea4f0[_0x2effdb['field']]={'$like':'%'+_0x58a0b3[_0x68d2('0x28')][_0x68d2('0x47')]+'%'};return _0x1ea4f0;}})});}_0x30f664=_[_0x68d2('0x4b')]({},_0x30f664,_0x58a0b3[_0x68d2('0x4c')]);var _0x298a33={'where':_0x30f664[_0x68d2('0x45')]};return db[_0x68d2('0x25')][_0x68d2('0x1a')](_0x298a33)[_0x68d2('0x21')](function(_0x4e8725){_0x503ffc['count']=_0x4e8725;if(_0x58a0b3[_0x68d2('0x28')][_0x68d2('0x4d')]){_0x30f664['include']=[{'all':!![]}];}return db[_0x68d2('0x25')][_0x68d2('0x4e')](_0x30f664);})[_0x68d2('0x21')](function(_0xc48c18){_0x503ffc['rows']=_0xc48c18;return _0x503ffc;})[_0x68d2('0x21')](respondWithFilteredResult(_0x27f7a2,_0x30f664))[_0x68d2('0x4f')](handleError(_0x27f7a2,null));};exports[_0x68d2('0x50')]=function(_0x2b4871,_0x3e664e){var _0x16c5a0={'raw':!![],'where':{'id':_0x2b4871[_0x68d2('0x51')]['id']}},_0x1b3055={};_0x1b3055[_0x68d2('0x26')]=_[_0x68d2('0x27')](db[_0x68d2('0x25')][_0x68d2('0x52')]);_0x1b3055[_0x68d2('0x28')]=_[_0x68d2('0x27')](_0x2b4871[_0x68d2('0x28')]);_0x1b3055['filters']=_[_0x68d2('0x2a')](_0x1b3055[_0x68d2('0x26')],_0x1b3055['query']);_0x16c5a0[_0x68d2('0x3e')]=_[_0x68d2('0x2a')](_0x1b3055[_0x68d2('0x26')],qs[_0x68d2('0x3f')](_0x2b4871[_0x68d2('0x28')][_0x68d2('0x3f')]));_0x16c5a0[_0x68d2('0x3e')]=_0x16c5a0[_0x68d2('0x3e')]['length']?_0x16c5a0['attributes']:_0x1b3055[_0x68d2('0x26')];if(_0x2b4871['query'][_0x68d2('0x4d')]){_0x16c5a0[_0x68d2('0x53')]=[{'all':!![]}];}_0x16c5a0=_[_0x68d2('0x4b')]({},_0x16c5a0,_0x2b4871[_0x68d2('0x4c')]);return db['CmHopper']['find'](_0x16c5a0)[_0x68d2('0x21')](handleEntityNotFound(_0x3e664e,null))['then'](respondWithResult(_0x3e664e,null))[_0x68d2('0x4f')](handleError(_0x3e664e,null));};exports[_0x68d2('0x54')]=function(_0x588ba5,_0x25bfa8){return db['CmHopper'][_0x68d2('0x54')](_0x588ba5[_0x68d2('0x55')],{})[_0x68d2('0x21')](respondWithResult(_0x25bfa8,0xc9))['catch'](handleError(_0x25bfa8,null));};exports[_0x68d2('0x20')]=function(_0x567565,_0x25a115){if(_0x567565[_0x68d2('0x55')]['id']){delete _0x567565[_0x68d2('0x55')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x567565[_0x68d2('0x51')]['id']}})[_0x68d2('0x21')](handleEntityNotFound(_0x25a115,null))[_0x68d2('0x21')](saveUpdates(_0x567565[_0x68d2('0x55')],null))['then'](respondWithResult(_0x25a115,null))[_0x68d2('0x4f')](handleError(_0x25a115,null));};exports[_0x68d2('0x56')]=function(_0x3b3da9,_0x53901c){return db[_0x68d2('0x25')][_0x68d2('0x56')]()[_0x68d2('0x21')](respondWithResult(_0x53901c,null))[_0x68d2('0x4f')](handleError(_0x53901c,null));};exports[_0x68d2('0x57')]=function(_0xa22fbd,_0x419101){var _0x2b695c;return db[_0x68d2('0x25')][_0x68d2('0x58')]({'where':{'id':_0xa22fbd[_0x68d2('0x51')]['id']}})[_0x68d2('0x21')](handleEntityNotFound(_0x419101,null))[_0x68d2('0x21')](function(_0x289934){if(_0x289934){return _0x289934[_0x68d2('0x57')]()[_0x68d2('0x21')](function(_0x31ecb4){return _0x31ecb4;});}})[_0x68d2('0x21')](function(_0x43719a){_0x2b695c=_0x43719a;if(_0x43719a){if(_0x43719a[_0x68d2('0x59')]||_0x43719a['CampaignId']){return db[_0x43719a[_0x68d2('0x59')]?_0x68d2('0x5a'):'Campaign']['find']({'where':{'id':_0x43719a[_0x68d2('0x59')]?_0x43719a['VoiceQueueId']:_0x43719a[_0x68d2('0x5b')]},'attributes':['id',_0x68d2('0x23')],'raw':!![]});}}})[_0x68d2('0x21')](function(_0x4f6d76){var _0x3cf0ec={};if(_0x4f6d76){_[_0x68d2('0x4b')](_0x3cf0ec,_[_0x68d2('0x5c')](_0x2b695c[_0x68d2('0x5d')],[_0x68d2('0x5e'),_0x68d2('0x5f'),'id']));_0x3cf0ec['state']=0x15;_0x3cf0ec[_0x68d2('0x60')]='deleted';_0x3cf0ec[_0x68d2('0x61')]=_0x4f6d76[_0x68d2('0x23')];_0x3cf0ec[_0x68d2('0x62')]=_0xa22fbd[_0x68d2('0x63')]['name'];_0x3cf0ec[_0x68d2('0x64')]=_0xa22fbd[_0x68d2('0x63')]['id'];_0x3cf0ec['deleted']=!![];_0x3cf0ec[_0x68d2('0x65')]=moment()[_0x68d2('0x66')](_0x68d2('0x67'));_0x3cf0ec[_0x68d2('0x68')]=_0x2b695c['phone'];_0x3cf0ec['campaigntype']=_0x2b695c[_0x68d2('0x59')]?_0x68d2('0x69'):_0x68d2('0x6a');return db[_0x68d2('0x6b')][_0x68d2('0x58')]({'where':{'id':_0x3cf0ec[_0x68d2('0x6c')]},'attributes':[_0x68d2('0x6d'),'lastName']})[_0x68d2('0x21')](function(_0x5aa49b){if(!_[_0x68d2('0x6e')](_0x419101)&&!_[_0x68d2('0x6e')](_0x5aa49b[_0x68d2('0x6d')])){_0x3cf0ec[_0x68d2('0x6f')]=_0x5aa49b[_0x68d2('0x6d')];if(!_['isNil'](_0x5aa49b[_0x68d2('0x70')])){_0x3cf0ec[_0x68d2('0x6f')]+='\x20'+_0x5aa49b['lastName'];}}})[_0x68d2('0x71')](function(){return db['CmHopperFinal'][_0x68d2('0x54')](_0x3cf0ec);});}})[_0x68d2('0x21')](function(){return _0x419101[_0x68d2('0x18')](0xcc)[_0x68d2('0x19')]();})[_0x68d2('0x4f')](handleError(_0x419101,null));};exports[_0x68d2('0x72')]=function(_0x63fc8c,_0x2a8b6a,_0x30153c){var _0x1b1c26=[];return db[_0x68d2('0x6b')][_0x68d2('0x56')]()[_0x68d2('0x21')](function(_0x5f4737){_0x1b1c26=_[_0x68d2('0x27')](_0x5f4737);return _0x63fc8c[_0x68d2('0x63')][_0x68d2('0x73')]({'where':{'type':_0x68d2('0x74'),'dialActive':!![],'dialMethod':_0x68d2('0x75')},'attributes':['id',_0x68d2('0x76')],'raw':!![]});})[_0x68d2('0x21')](function(_0x4d0d19){if(_0x4d0d19&&_0x4d0d19['length']){return db[_0x68d2('0x77')]['transaction'](function(_0x5c8159){var _0x51380b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x68d2('0x67'))},'VoiceQueueId':{'$in':_[_0x68d2('0x48')](_0x4d0d19,'id')},'$or':[{'UserId':null},{'UserId':_0x63fc8c[_0x68d2('0x63')]['id']}]};var _0x5c9dff=[];if(_0x63fc8c[_0x68d2('0x55')][_0x68d2('0x78')]&&_0x63fc8c['body'][_0x68d2('0x78')]===_0x68d2('0x79')){if(!_[_0x68d2('0x7a')](_0x63fc8c[_0x68d2('0x55')]['hopperIds'])){_0x51380b['id']={'$in':_0x63fc8c['body'][_0x68d2('0x7b')]};}_0x5c9dff=[[_0x68d2('0x7c'),'ASC'],[_0x68d2('0x7d'),_0x4d0d19[0x0][_0x68d2('0x76')]===_0x68d2('0x7e')?_0x68d2('0x7f'):_0x68d2('0x7e')],db[_0x68d2('0x77')]['literal'](_0x68d2('0x80')),['id',_0x68d2('0x7f')]];}else{if(!_[_0x68d2('0x7a')](_0x63fc8c[_0x68d2('0x55')]['hopperIds'])){_0x51380b['id']={'$notIn':_0x63fc8c[_0x68d2('0x55')][_0x68d2('0x7b')]};}_0x5c9dff=[[_0x68d2('0x7c'),'DESC'],[_0x68d2('0x7d'),_0x4d0d19[0x0][_0x68d2('0x76')]],db[_0x68d2('0x77')][_0x68d2('0x81')](_0x68d2('0x82')),['id',_0x68d2('0x7e')]];}return db[_0x68d2('0x25')][_0x68d2('0x83')]({'attributes':['id','scheduledat'],'where':_0x51380b,'order':_0x5c9dff,'transaction':_0x5c8159,'lock':_0x5c8159[_0x68d2('0x84')][_0x68d2('0x85')],'include':[{'model':db['CmContact'],'as':_0x68d2('0x86'),'attributes':_0x1b1c26,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x68d2('0x23')]}]},{'model':db[_0x68d2('0x87')],'as':_0x68d2('0x88'),'attributes':['id',_0x68d2('0x23')]},{'model':db[_0x68d2('0x5a')],'as':'Queue','attributes':['id',_0x68d2('0x23'),_0x68d2('0x89')]}]})['then'](function(_0x486031){if(_0x486031){return _0x486031[_0x68d2('0x20')]({'UserId':_0x63fc8c['user']['id']},{'transaction':_0x5c8159});}});});}})[_0x68d2('0x21')](handleEntityNotFound(_0x2a8b6a,null))[_0x68d2('0x21')](respondWithResult(_0x2a8b6a,null))['catch'](handleError(_0x2a8b6a,null));};exports[_0x68d2('0x8a')]=function(_0x305d11,_0x266679,_0x340a5d){return _0x305d11[_0x68d2('0x63')][_0x68d2('0x73')]({'where':{'type':_0x68d2('0x74'),'dialActive':!![],'dialMethod':_0x68d2('0x75')},'attributes':['id'],'raw':!![]})['then'](function(_0x43dcaf){if(_0x43dcaf&&_0x43dcaf['length']){return db[_0x68d2('0x25')][_0x68d2('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x68d2('0x66')](_0x68d2('0x67'))},'VoiceQueueId':{'$in':_[_0x68d2('0x48')](_0x43dcaf,'id')},'$or':[{'UserId':null},{'UserId':_0x305d11[_0x68d2('0x63')]['id']}]}});}return 0x0;})[_0x68d2('0x21')](function(_0x1fb08d){if(!_[_0x68d2('0x6e')](_0x1fb08d)&&_[_0x68d2('0x8b')](_0x1fb08d)){return _0x266679[_0x68d2('0x18')](0xc8)[_0x68d2('0x8c')]({'contacts':_0x1fb08d});}else{logger[_0x68d2('0x8d')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x68d2('0x8a'),0x194,'entity\x20not\x20found');_0x266679[_0x68d2('0x17')](0x194);}})[_0x68d2('0x4f')](handleError(_0x266679,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 915b10a..03690ae 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 _0xe743=['define','cm_hopper','scheduledat','phone','priority','lodash','util','bluebird','request-promise','../../config/environment','exports'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0xe743,0x1de));var _0x3e74=function(_0x5f3c3d,_0x3b11fd){_0x5f3c3d=_0x5f3c3d-0x0;var _0x365ea4=_0xe743[_0x5f3c3d];return _0x365ea4;};'use strict';var _=require(_0x3e74('0x0'));var util=require(_0x3e74('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3e74('0x2'));var rp=require(_0x3e74('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e74('0x4'));var attributes=require('./cmHopper.attributes');module[_0x3e74('0x5')]=function(_0x2bf1f8,_0x186c6e){return _0x2bf1f8[_0x3e74('0x6')]('CmHopper',attributes,{'tableName':_0x3e74('0x7'),'paranoid':![],'indexes':[{'name':_0x3e74('0x8'),'fields':[_0x3e74('0x8')]},{'name':'phone','fields':[_0x3e74('0x9')]},{'name':_0x3e74('0xa'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ee9=['path','rimraf','../../config/environment','exports','define','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','request-promise'];(function(_0x39900c,_0x2ed034){var _0x1885c9=function(_0x2c2c49){while(--_0x2c2c49){_0x39900c['push'](_0x39900c['shift']());}};_0x1885c9(++_0x2ed034);}(_0x3ee9,0x168));var _0x93ee=function(_0x47c9b1,_0x119667){_0x47c9b1=_0x47c9b1-0x0;var _0x314445=_0x3ee9[_0x47c9b1];return _0x314445;};'use strict';var _=require(_0x93ee('0x0'));var util=require('util');var logger=require(_0x93ee('0x1'))(_0x93ee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x93ee('0x3'));var fs=require('fs');var path=require(_0x93ee('0x4'));var rimraf=require(_0x93ee('0x5'));var config=require(_0x93ee('0x6'));var attributes=require('./cmHopper.attributes');module[_0x93ee('0x7')]=function(_0x2b9c97,_0x5313d7){return _0x2b9c97[_0x93ee('0x8')]('CmHopper',attributes,{'tableName':_0x93ee('0x9'),'paranoid':![],'indexes':[{'name':_0x93ee('0xa'),'fields':[_0x93ee('0xa')]},{'name':_0x93ee('0xb'),'fields':[_0x93ee('0xb')]},{'name':_0x93ee('0xc'),'fields':[_0x93ee('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 15a2e31..99ffab4 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 _0xd66e=['include','map','model','ShowCmHopper','CmHopper','find','then','create','CreateCmHopper','UpdateCmHopper','update','body','DestroyCmHopper','destroy','GetContactDialer','transaction','limit','order','LOCK','UPDATE','CmContact','Contact','keys','length','push','all','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','UserId','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes'];(function(_0x28b691,_0x16aad0){var _0x34ef70=function(_0x248ea9){while(--_0x248ea9){_0x28b691['push'](_0x28b691['shift']());}};_0x34ef70(++_0x16aad0);}(_0xd66e,0x6c));var _0xed66=function(_0x2cbfe5,_0x1fb99b){_0x2cbfe5=_0x2cbfe5-0x0;var _0x3f69ad=_0xd66e[_0x2cbfe5];return _0x3f69ad;};'use strict';var _=require(_0xed66('0x0'));var util=require('util');var moment=require(_0xed66('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed66('0x2'));var db=require(_0xed66('0x3'))['db'];var utils=require(_0xed66('0x4'));var logger=require('../../config/logger')(_0xed66('0x5'));var config=require(_0xed66('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed66('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1364a2,_0x27e712,_0x12a8fd){return new BPromise(function(_0x338786,_0x130fd3){return client[_0xed66('0x8')](_0x1364a2,_0x12a8fd)['then'](function(_0x28e842){logger[_0xed66('0x9')](_0xed66('0xa'),_0x27e712,'request\x20sent');logger[_0xed66('0xb')](_0xed66('0xc'),_0x27e712,_0xed66('0xd'),JSON[_0xed66('0xe')](_0x28e842));if(_0x28e842[_0xed66('0xf')]){if(_0x28e842[_0xed66('0xf')][_0xed66('0x10')]===0x1f4){logger[_0xed66('0xf')](_0xed66('0xa'),_0x27e712,_0x28e842[_0xed66('0xf')][_0xed66('0x11')]);return _0x130fd3(_0x28e842[_0xed66('0xf')][_0xed66('0x11')]);}logger[_0xed66('0xf')](_0xed66('0xa'),_0x27e712,_0x28e842[_0xed66('0xf')]['message']);return _0x338786(_0x28e842[_0xed66('0xf')][_0xed66('0x11')]);}else{logger[_0xed66('0x9')](_0xed66('0xa'),_0x27e712,'request\x20sent');_0x338786(_0x28e842[_0xed66('0x12')][_0xed66('0x11')]);}})[_0xed66('0x13')](function(_0x5a987c){logger[_0xed66('0xf')](_0xed66('0xa'),_0x27e712,_0x5a987c);_0x130fd3(_0x5a987c);});});}exports[_0xed66('0x14')]=function(_0x483bd7){var _0x4c437c=this;return new Promise(function(_0x575327,_0x36d717){return db['CmHopper'][_0xed66('0x15')]({'raw':_0x483bd7[_0xed66('0x16')]?_0x483bd7[_0xed66('0x16')][_0xed66('0x17')]===undefined?!![]:![]:!![],'where':_0x483bd7[_0xed66('0x16')]?_0x483bd7[_0xed66('0x16')][_0xed66('0x18')]||null:null,'attributes':_0x483bd7['options']?_0x483bd7[_0xed66('0x16')][_0xed66('0x19')]||null:null,'limit':_0x483bd7[_0xed66('0x16')]?_0x483bd7[_0xed66('0x16')]['limit']||null:null,'include':_0x483bd7[_0xed66('0x16')]?_0x483bd7[_0xed66('0x16')][_0xed66('0x1a')]?_[_0xed66('0x1b')](_0x483bd7['options'][_0xed66('0x1a')],function(_0x57ac58){return{'model':db[_0x57ac58[_0xed66('0x1c')]],'as':_0x57ac58['as'],'attributes':_0x57ac58[_0xed66('0x19')],'include':_0x57ac58[_0xed66('0x1a')]?_[_0xed66('0x1b')](_0x57ac58['include'],function(_0x188934){return{'model':db[_0x188934[_0xed66('0x1c')]],'as':_0x188934['as'],'attributes':_0x188934['attributes'],'include':_0x188934['include']?_[_0xed66('0x1b')](_0x188934[_0xed66('0x1a')],function(_0x4af87c){return{'model':db[_0x4af87c['model']],'as':_0x4af87c['as'],'attributes':_0x4af87c[_0xed66('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x300271){logger[_0xed66('0x9')]('GetCmHopper',_0x483bd7);logger[_0xed66('0xb')]('GetCmHopper',_0x483bd7,JSON[_0xed66('0xe')](_0x300271));_0x575327(_0x300271);})[_0xed66('0x13')](function(_0x278bf7){logger[_0xed66('0xf')]('GetCmHopper',_0x278bf7[_0xed66('0x11')],_0x483bd7);_0x36d717(_0x4c437c[_0xed66('0xf')](0x1f4,_0x278bf7[_0xed66('0x11')]));});});};exports[_0xed66('0x1d')]=function(_0x4ae5de){var _0x3f0716=this;return new Promise(function(_0x344fc9,_0x3dc144){return db[_0xed66('0x1e')][_0xed66('0x1f')]({'raw':_0x4ae5de['options']?_0x4ae5de[_0xed66('0x16')][_0xed66('0x17')]===undefined?!![]:![]:!![],'where':_0x4ae5de[_0xed66('0x16')]?_0x4ae5de['options'][_0xed66('0x18')]||null:null,'attributes':_0x4ae5de[_0xed66('0x16')]?_0x4ae5de[_0xed66('0x16')]['attributes']||null:null,'include':_0x4ae5de['options']?_0x4ae5de[_0xed66('0x16')][_0xed66('0x1a')]?_[_0xed66('0x1b')](_0x4ae5de[_0xed66('0x16')][_0xed66('0x1a')],function(_0x3de5f2){return{'model':db[_0x3de5f2['model']],'as':_0x3de5f2['as'],'attributes':_0x3de5f2['attributes'],'include':_0x3de5f2['include']?_[_0xed66('0x1b')](_0x3de5f2[_0xed66('0x1a')],function(_0x5d9f76){return{'model':db[_0x5d9f76[_0xed66('0x1c')]],'as':_0x5d9f76['as'],'attributes':_0x5d9f76[_0xed66('0x19')],'include':_0x5d9f76['include']?_[_0xed66('0x1b')](_0x5d9f76[_0xed66('0x1a')],function(_0x2be0dd){return{'model':db[_0x2be0dd['model']],'as':_0x2be0dd['as'],'attributes':_0x2be0dd[_0xed66('0x19')]};}):[]};}):[]};}):[]:[]})[_0xed66('0x20')](function(_0x4b952b){logger[_0xed66('0x9')](_0xed66('0x1d'),_0x4ae5de);logger[_0xed66('0xb')](_0xed66('0x1d'),_0x4ae5de,JSON['stringify'](_0x4b952b));_0x344fc9(_0x4b952b);})['catch'](function(_0x213c13){logger[_0xed66('0xf')](_0xed66('0x1d'),_0x213c13[_0xed66('0x11')],_0x4ae5de);_0x3dc144(_0x3f0716[_0xed66('0xf')](0x1f4,_0x213c13[_0xed66('0x11')]));});});};exports['CreateCmHopper']=function(_0x448f6a){var _0x18a2f1=this;return new Promise(function(_0x207ea7,_0x1ff57c){return db['CmHopper'][_0xed66('0x21')](_0x448f6a['body'],{'raw':_0x448f6a[_0xed66('0x16')]?_0x448f6a[_0xed66('0x16')][_0xed66('0x17')]===undefined?!![]:![]:!![]})[_0xed66('0x20')](function(_0x355218){logger[_0xed66('0x9')](_0xed66('0x22'),_0x448f6a);logger[_0xed66('0xb')](_0xed66('0x22'),_0x448f6a,JSON['stringify'](_0x355218));_0x207ea7(_0x355218);})[_0xed66('0x13')](function(_0x28a9e8){logger[_0xed66('0xf')](_0xed66('0x22'),_0x28a9e8[_0xed66('0x11')],_0x448f6a);_0x1ff57c(_0x18a2f1[_0xed66('0xf')](0x1f4,_0x28a9e8[_0xed66('0x11')]));});});};exports[_0xed66('0x23')]=function(_0x4ad8a6){var _0x1faf67=this;return new Promise(function(_0xe3fa68,_0x571254){return db['CmHopper'][_0xed66('0x24')](_0x4ad8a6[_0xed66('0x25')],{'raw':_0x4ad8a6['options']?_0x4ad8a6[_0xed66('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad8a6[_0xed66('0x16')]?_0x4ad8a6['options'][_0xed66('0x18')]||null:null,'attributes':_0x4ad8a6[_0xed66('0x16')]?_0x4ad8a6[_0xed66('0x16')]['attributes']||null:null,'limit':_0x4ad8a6[_0xed66('0x16')]?_0x4ad8a6[_0xed66('0x16')]['limit']||null:null})[_0xed66('0x20')](function(_0x4f8e0f){logger[_0xed66('0x9')](_0xed66('0x23'),_0x4ad8a6);logger['debug'](_0xed66('0x23'),_0x4ad8a6,JSON[_0xed66('0xe')](_0x4f8e0f));_0xe3fa68(_0x4f8e0f);})[_0xed66('0x13')](function(_0x478348){logger[_0xed66('0xf')](_0xed66('0x23'),_0x478348[_0xed66('0x11')],_0x4ad8a6);_0x571254(_0x1faf67[_0xed66('0xf')](0x1f4,_0x478348[_0xed66('0x11')]));});});};exports[_0xed66('0x26')]=function(_0x2a3762){var _0xa3f264=this;return new Promise(function(_0x146b0e,_0x406304){return db[_0xed66('0x1e')][_0xed66('0x27')]({'where':_0x2a3762[_0xed66('0x16')]?_0x2a3762[_0xed66('0x16')][_0xed66('0x18')]||null:null})[_0xed66('0x20')](function(_0x3f81da){logger['info']('DestroyCmHopper',_0x2a3762);logger[_0xed66('0xb')](_0xed66('0x26'),_0x2a3762,JSON[_0xed66('0xe')](_0x3f81da));_0x146b0e(_0x3f81da);})['catch'](function(_0xfdba51){logger[_0xed66('0xf')](_0xed66('0x26'),_0xfdba51['message'],_0x2a3762);_0x406304(_0xa3f264[_0xed66('0xf')](0x1f4,_0xfdba51[_0xed66('0x11')]));});});};exports[_0xed66('0x28')]=function(_0x487749){var _0x41d1fd=this;return new Promise(function(_0x43cf93,_0x2e07fd){return db['CmContact']['describe']()[_0xed66('0x20')](function(_0xa30b5f){return db['sequelize'][_0xed66('0x29')](function(_0x19c37e){return db[_0xed66('0x1e')]['findAll']({'where':_0x487749[_0xed66('0x16')]?_0x487749[_0xed66('0x16')][_0xed66('0x18')]||null:null,'attributes':_0x487749[_0xed66('0x16')]?_0x487749[_0xed66('0x16')][_0xed66('0x19')]||null:null,'limit':_0x487749[_0xed66('0x16')]?_0x487749[_0xed66('0x16')][_0xed66('0x2a')]||null:null,'order':_0x487749['options']?_0x487749[_0xed66('0x16')][_0xed66('0x2b')]||null:null,'transaction':_0x19c37e,'lock':_0x19c37e[_0xed66('0x2c')][_0xed66('0x2d')],'include':[{'model':db[_0xed66('0x2e')],'as':_0xed66('0x2f'),'attributes':_[_0xed66('0x30')](_0xa30b5f)}]})[_0xed66('0x20')](function(_0x2141fa){var _0x2451c0=[];for(var _0x48f335=0x0;_0x48f335<_0x2141fa[_0xed66('0x31')];_0x48f335+=0x1){_0x2451c0[_0xed66('0x32')](_0x2141fa[_0x48f335][_0xed66('0x24')](_0x487749[_0xed66('0x25')],{'transaction':_0x19c37e}));}return BPromise[_0xed66('0x33')](_0x2451c0);});})[_0xed66('0x20')](function(_0x1845f5){logger[_0xed66('0x9')]('GetContactDialer',_0x487749);logger[_0xed66('0xb')]('GetContactDialer',_0x487749,JSON[_0xed66('0xe')](_0x1845f5));_0x43cf93(_0x1845f5);})[_0xed66('0x13')](function(_0x43d07c){logger[_0xed66('0xf')](_0xed66('0x28'),_0x43d07c['message'],_0x487749);_0x2e07fd(_0x41d1fd[_0xed66('0xf')](0x1f4,_0x43d07c[_0xed66('0x11')]));});});});};exports[_0xed66('0x34')]=function(_0x1bd57e){var _0x49677c=this;return new Promise(function(_0x12b33f,_0x5ba4db){return db[_0xed66('0x35')]['transaction'](function(_0x43b008){return db[_0xed66('0x36')]['create'](_0x1bd57e[_0xed66('0x25')],{'raw':_0x1bd57e[_0xed66('0x16')]?_0x1bd57e[_0xed66('0x16')][_0xed66('0x17')]===undefined?!![]:![]:!![],'transaction':_0x43b008})[_0xed66('0x20')](function(){return db['CmHopper'][_0xed66('0x27')]({'where':_0x1bd57e[_0xed66('0x16')]?_0x1bd57e[_0xed66('0x16')][_0xed66('0x18')]||null:null,'transaction':_0x43b008});});})['then'](function(_0x434dd1){logger[_0xed66('0x9')](_0xed66('0x34'),_0x1bd57e);logger[_0xed66('0xb')](_0xed66('0x34'),_0x1bd57e,JSON['stringify'](_0x434dd1));_0x12b33f(_0x434dd1);})[_0xed66('0x13')](function(_0x51a974){logger[_0xed66('0xf')](_0xed66('0x34'),_0x51a974['message'],_0x1bd57e);_0x5ba4db(_0x49677c[_0xed66('0xf')](0x1f4,_0x51a974['message']));});});};exports[_0xed66('0x37')]=function(_0x4951d1){var _0x29b977=this;return new Promise(function(_0x4b8c7c,_0xc3bca5){return db[_0xed66('0x1e')][_0xed66('0x15')]({'raw':_0x4951d1[_0xed66('0x16')]?_0x4951d1[_0xed66('0x16')][_0xed66('0x17')]===undefined?!![]:![]:!![],'where':_0x4951d1['options']?_0x4951d1[_0xed66('0x16')][_0xed66('0x18')]||null:null,'attributes':[[db[_0xed66('0x35')]['fn'](_0xed66('0x38'),db[_0xed66('0x35')]['fn']('IF',db['sequelize'][_0xed66('0x39')](_0xed66('0x3a')+util[_0xed66('0x3b')](_0xed66('0x3c'),moment()[_0xed66('0x3b')](_0xed66('0x3d')))+_0xed66('0x3e')))),_0xed66('0x3f')]]})['then'](function(_0xaf209){logger['info']('CountReScheduled',_0x4951d1);logger[_0xed66('0xb')](_0xed66('0x37'),_0x4951d1,JSON['stringify'](_0xaf209));_0x4b8c7c(_0xaf209);})[_0xed66('0x13')](function(_0x16de2e){logger[_0xed66('0xf')]('CountReScheduled',_0x16de2e[_0xed66('0x11')],_0x4951d1);_0xc3bca5(_0x29b977[_0xed66('0xf')](0x1f4,_0x16de2e['message']));});});};exports[_0xed66('0x40')]=function(_0x57df1c){var _0x2fbe5f=this;return new Promise(function(_0x3c5327,_0x15041c){return db[_0xed66('0x2e')][_0xed66('0x41')]()[_0xed66('0x20')](function(_0x2893ad){return db[_0xed66('0x35')][_0xed66('0x29')](function(_0x4dea69){return db[_0xed66('0x1e')]['findAll']({'where':_0x57df1c[_0xed66('0x16')]?_0x57df1c[_0xed66('0x16')]['where']||null:null,'attributes':_0x57df1c[_0xed66('0x16')]?_0x57df1c[_0xed66('0x16')][_0xed66('0x19')]||null:null,'limit':0x1,'order':_0x57df1c[_0xed66('0x16')]?_0x57df1c['options'][_0xed66('0x2b')]||null:null,'group':db[_0xed66('0x1e')][_0xed66('0x42')],'transaction':_0x4dea69,'lock':_0x4dea69[_0xed66('0x2c')][_0xed66('0x2d')],'include':_0x57df1c['options']?_0x57df1c[_0xed66('0x16')][_0xed66('0x1a')]?_[_0xed66('0x1b')](_0x57df1c[_0xed66('0x16')][_0xed66('0x1a')],function(_0x42ba98){return{'model':db[_0x42ba98[_0xed66('0x1c')]],'as':_0x42ba98['as'],'attributes':_0x42ba98[_0xed66('0x19')],'include':_0x42ba98['include']?_['map'](_0x42ba98[_0xed66('0x1a')],function(_0x14d8b2){return{'model':db[_0x14d8b2[_0xed66('0x1c')]],'as':_0x14d8b2['as'],'attributes':_0x14d8b2[_0xed66('0x19')],'include':_0x14d8b2[_0xed66('0x1a')]?_[_0xed66('0x1b')](_0x14d8b2[_0xed66('0x1a')],function(_0x315e51){return{'model':db[_0x315e51['model']],'as':_0x315e51['as'],'attributes':_0x315e51[_0xed66('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x112c47){var _0x4a65b4=[];for(var _0x3068ee=0x0;_0x3068ee<_0x112c47[_0xed66('0x31')];_0x3068ee+=0x1){_0x4a65b4[_0xed66('0x32')](_0x112c47[_0x3068ee][_0xed66('0x24')](_0x57df1c[_0xed66('0x25')],{'transaction':_0x4dea69}));}return BPromise[_0xed66('0x33')](_0x4a65b4);});})[_0xed66('0x20')](function(_0x2843a8){logger[_0xed66('0x9')](_0xed66('0x40'),_0x57df1c);logger[_0xed66('0xb')](_0xed66('0x40'),_0x57df1c,JSON[_0xed66('0xe')](_0x2843a8));_0x3c5327(_0x2843a8);})['catch'](function(_0x30108d){logger[_0xed66('0xf')](_0xed66('0x40'),_0x30108d[_0xed66('0x11')],_0x57df1c);_0x15041c(_0x2fbe5f['error'](0x1f4,_0x30108d[_0xed66('0x11')]));});});});}; \ No newline at end of file +var _0x59eb=['sequelize','transaction','order','LOCK','Contact','length','CmHopperFinal','destroy','MoveContactManagedDialer','COUNT','literal','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','UserId','UPDATE','push','GetContactRecallMe','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','map','include','model','attributes','then','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','CmContact','describe'];(function(_0xb87692,_0x453279){var _0x41eb6f=function(_0x520092){while(--_0x520092){_0xb87692['push'](_0xb87692['shift']());}};_0x41eb6f(++_0x453279);}(_0x59eb,0x1e1));var _0xb59e=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x59eb[_0x313c96];return _0x522f53;};'use strict';var _=require(_0xb59e('0x0'));var util=require(_0xb59e('0x1'));var moment=require(_0xb59e('0x2'));var BPromise=require(_0xb59e('0x3'));var rs=require(_0xb59e('0x4'));var fs=require('fs');var Redis=require(_0xb59e('0x5'));var db=require(_0xb59e('0x6'))['db'];var utils=require(_0xb59e('0x7'));var logger=require(_0xb59e('0x8'))(_0xb59e('0x9'));var config=require(_0xb59e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb59e('0xb')][_0xb59e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cd2f3,_0x51e256,_0xf8d55c){return new BPromise(function(_0x25e28b,_0x5f51e5){return client[_0xb59e('0xd')](_0x2cd2f3,_0xf8d55c)['then'](function(_0x38b534){logger['info'](_0xb59e('0xe'),_0x51e256,_0xb59e('0xf'));logger[_0xb59e('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x51e256,'request\x20sent',JSON[_0xb59e('0x11')](_0x38b534));if(_0x38b534['error']){if(_0x38b534[_0xb59e('0x12')][_0xb59e('0x13')]===0x1f4){logger[_0xb59e('0x12')](_0xb59e('0xe'),_0x51e256,_0x38b534[_0xb59e('0x12')]['message']);return _0x5f51e5(_0x38b534[_0xb59e('0x12')][_0xb59e('0x14')]);}logger['error'](_0xb59e('0xe'),_0x51e256,_0x38b534[_0xb59e('0x12')][_0xb59e('0x14')]);return _0x25e28b(_0x38b534[_0xb59e('0x12')][_0xb59e('0x14')]);}else{logger[_0xb59e('0x15')](_0xb59e('0xe'),_0x51e256,_0xb59e('0xf'));_0x25e28b(_0x38b534[_0xb59e('0x16')]['message']);}})[_0xb59e('0x17')](function(_0x51c39c){logger[_0xb59e('0x12')](_0xb59e('0xe'),_0x51e256,_0x51c39c);_0x5f51e5(_0x51c39c);});});}exports[_0xb59e('0x18')]=function(_0x288e8c){var _0x5bbd20=this;return new Promise(function(_0x2b577a,_0x3d8e08){return db[_0xb59e('0x19')][_0xb59e('0x1a')]({'raw':_0x288e8c[_0xb59e('0x1b')]?_0x288e8c['options'][_0xb59e('0x1c')]===undefined?!![]:![]:!![],'where':_0x288e8c[_0xb59e('0x1b')]?_0x288e8c[_0xb59e('0x1b')][_0xb59e('0x1d')]||null:null,'attributes':_0x288e8c[_0xb59e('0x1b')]?_0x288e8c[_0xb59e('0x1b')]['attributes']||null:null,'limit':_0x288e8c[_0xb59e('0x1b')]?_0x288e8c[_0xb59e('0x1b')][_0xb59e('0x1e')]||null:null,'include':_0x288e8c['options']?_0x288e8c[_0xb59e('0x1b')]['include']?_[_0xb59e('0x1f')](_0x288e8c[_0xb59e('0x1b')][_0xb59e('0x20')],function(_0x14d369){return{'model':db[_0x14d369[_0xb59e('0x21')]],'as':_0x14d369['as'],'attributes':_0x14d369[_0xb59e('0x22')],'include':_0x14d369[_0xb59e('0x20')]?_[_0xb59e('0x1f')](_0x14d369['include'],function(_0x4c641d){return{'model':db[_0x4c641d['model']],'as':_0x4c641d['as'],'attributes':_0x4c641d[_0xb59e('0x22')],'include':_0x4c641d[_0xb59e('0x20')]?_['map'](_0x4c641d[_0xb59e('0x20')],function(_0x421281){return{'model':db[_0x421281[_0xb59e('0x21')]],'as':_0x421281['as'],'attributes':_0x421281[_0xb59e('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb59e('0x23')](function(_0x39e602){logger[_0xb59e('0x15')](_0xb59e('0x18'),_0x288e8c);logger[_0xb59e('0x10')](_0xb59e('0x18'),_0x288e8c,JSON[_0xb59e('0x11')](_0x39e602));_0x2b577a(_0x39e602);})[_0xb59e('0x17')](function(_0xfe58e7){logger[_0xb59e('0x12')](_0xb59e('0x18'),_0xfe58e7[_0xb59e('0x14')],_0x288e8c);_0x3d8e08(_0x5bbd20['error'](0x1f4,_0xfe58e7[_0xb59e('0x14')]));});});};exports[_0xb59e('0x24')]=function(_0x4566d0){var _0x5d3111=this;return new Promise(function(_0x15c417,_0x186fb4){return db[_0xb59e('0x19')][_0xb59e('0x25')]({'raw':_0x4566d0['options']?_0x4566d0[_0xb59e('0x1b')][_0xb59e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4566d0['options']?_0x4566d0[_0xb59e('0x1b')][_0xb59e('0x1d')]||null:null,'attributes':_0x4566d0[_0xb59e('0x1b')]?_0x4566d0[_0xb59e('0x1b')][_0xb59e('0x22')]||null:null,'include':_0x4566d0[_0xb59e('0x1b')]?_0x4566d0['options'][_0xb59e('0x20')]?_[_0xb59e('0x1f')](_0x4566d0[_0xb59e('0x1b')][_0xb59e('0x20')],function(_0x529705){return{'model':db[_0x529705[_0xb59e('0x21')]],'as':_0x529705['as'],'attributes':_0x529705[_0xb59e('0x22')],'include':_0x529705[_0xb59e('0x20')]?_['map'](_0x529705[_0xb59e('0x20')],function(_0x5d124d){return{'model':db[_0x5d124d[_0xb59e('0x21')]],'as':_0x5d124d['as'],'attributes':_0x5d124d[_0xb59e('0x22')],'include':_0x5d124d[_0xb59e('0x20')]?_[_0xb59e('0x1f')](_0x5d124d['include'],function(_0x3083e3){return{'model':db[_0x3083e3[_0xb59e('0x21')]],'as':_0x3083e3['as'],'attributes':_0x3083e3[_0xb59e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d9a17){logger[_0xb59e('0x15')](_0xb59e('0x24'),_0x4566d0);logger['debug']('ShowCmHopper',_0x4566d0,JSON['stringify'](_0x1d9a17));_0x15c417(_0x1d9a17);})[_0xb59e('0x17')](function(_0x5d7cb4){logger[_0xb59e('0x12')](_0xb59e('0x24'),_0x5d7cb4[_0xb59e('0x14')],_0x4566d0);_0x186fb4(_0x5d3111['error'](0x1f4,_0x5d7cb4[_0xb59e('0x14')]));});});};exports[_0xb59e('0x26')]=function(_0x10e978){var _0x38a7e7=this;return new Promise(function(_0x1ecd57,_0x3e7494){return db[_0xb59e('0x19')][_0xb59e('0x27')](_0x10e978[_0xb59e('0x28')],{'raw':_0x10e978['options']?_0x10e978[_0xb59e('0x1b')][_0xb59e('0x1c')]===undefined?!![]:![]:!![]})[_0xb59e('0x23')](function(_0x37808e){logger[_0xb59e('0x15')](_0xb59e('0x26'),_0x10e978);logger[_0xb59e('0x10')](_0xb59e('0x26'),_0x10e978,JSON[_0xb59e('0x11')](_0x37808e));_0x1ecd57(_0x37808e);})[_0xb59e('0x17')](function(_0x16eabc){logger['error'](_0xb59e('0x26'),_0x16eabc[_0xb59e('0x14')],_0x10e978);_0x3e7494(_0x38a7e7[_0xb59e('0x12')](0x1f4,_0x16eabc[_0xb59e('0x14')]));});});};exports[_0xb59e('0x29')]=function(_0x4ec629){var _0x28726b=this;return new Promise(function(_0x1ab754,_0x338e11){return db[_0xb59e('0x19')][_0xb59e('0x2a')](_0x4ec629[_0xb59e('0x28')],{'raw':_0x4ec629[_0xb59e('0x1b')]?_0x4ec629['options'][_0xb59e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ec629[_0xb59e('0x1b')]?_0x4ec629['options'][_0xb59e('0x1d')]||null:null,'attributes':_0x4ec629['options']?_0x4ec629['options'][_0xb59e('0x22')]||null:null,'limit':_0x4ec629[_0xb59e('0x1b')]?_0x4ec629[_0xb59e('0x1b')][_0xb59e('0x1e')]||null:null})[_0xb59e('0x23')](function(_0x5aedc7){logger[_0xb59e('0x15')](_0xb59e('0x29'),_0x4ec629);logger[_0xb59e('0x10')](_0xb59e('0x29'),_0x4ec629,JSON[_0xb59e('0x11')](_0x5aedc7));_0x1ab754(_0x5aedc7);})[_0xb59e('0x17')](function(_0x5687cf){logger['error'](_0xb59e('0x29'),_0x5687cf[_0xb59e('0x14')],_0x4ec629);_0x338e11(_0x28726b[_0xb59e('0x12')](0x1f4,_0x5687cf[_0xb59e('0x14')]));});});};exports[_0xb59e('0x2b')]=function(_0x146241){var _0x506d56=this;return new Promise(function(_0x127fce,_0x53304a){return db[_0xb59e('0x19')]['destroy']({'where':_0x146241[_0xb59e('0x1b')]?_0x146241['options'][_0xb59e('0x1d')]||null:null})['then'](function(_0x2f7bc0){logger['info']('DestroyCmHopper',_0x146241);logger[_0xb59e('0x10')]('DestroyCmHopper',_0x146241,JSON[_0xb59e('0x11')](_0x2f7bc0));_0x127fce(_0x2f7bc0);})[_0xb59e('0x17')](function(_0x5511ed){logger[_0xb59e('0x12')](_0xb59e('0x2b'),_0x5511ed[_0xb59e('0x14')],_0x146241);_0x53304a(_0x506d56[_0xb59e('0x12')](0x1f4,_0x5511ed[_0xb59e('0x14')]));});});};exports[_0xb59e('0x2c')]=function(_0x4f45dc){var _0x4c8ca0=this;return new Promise(function(_0x5c3ef8,_0xb50683){return db[_0xb59e('0x2d')][_0xb59e('0x2e')]()['then'](function(_0x478a36){return db[_0xb59e('0x2f')][_0xb59e('0x30')](function(_0x408576){return db['CmHopper'][_0xb59e('0x1a')]({'where':_0x4f45dc[_0xb59e('0x1b')]?_0x4f45dc['options'][_0xb59e('0x1d')]||null:null,'attributes':_0x4f45dc['options']?_0x4f45dc[_0xb59e('0x1b')][_0xb59e('0x22')]||null:null,'limit':_0x4f45dc[_0xb59e('0x1b')]?_0x4f45dc[_0xb59e('0x1b')]['limit']||null:null,'order':_0x4f45dc[_0xb59e('0x1b')]?_0x4f45dc['options'][_0xb59e('0x31')]||null:null,'transaction':_0x408576,'lock':_0x408576[_0xb59e('0x32')]['UPDATE'],'include':[{'model':db[_0xb59e('0x2d')],'as':_0xb59e('0x33'),'attributes':_['keys'](_0x478a36)}]})[_0xb59e('0x23')](function(_0x1d727a){var _0x256a03=[];for(var _0x228092=0x0;_0x228092<_0x1d727a[_0xb59e('0x34')];_0x228092+=0x1){_0x256a03['push'](_0x1d727a[_0x228092][_0xb59e('0x2a')](_0x4f45dc[_0xb59e('0x28')],{'transaction':_0x408576}));}return BPromise['all'](_0x256a03);});})[_0xb59e('0x23')](function(_0xf6d19f){logger[_0xb59e('0x15')](_0xb59e('0x2c'),_0x4f45dc);logger[_0xb59e('0x10')](_0xb59e('0x2c'),_0x4f45dc,JSON[_0xb59e('0x11')](_0xf6d19f));_0x5c3ef8(_0xf6d19f);})['catch'](function(_0x3650fb){logger[_0xb59e('0x12')](_0xb59e('0x2c'),_0x3650fb[_0xb59e('0x14')],_0x4f45dc);_0xb50683(_0x4c8ca0[_0xb59e('0x12')](0x1f4,_0x3650fb[_0xb59e('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x2746b5){var _0x40e8d3=this;return new Promise(function(_0x9b1328,_0x34b499){return db['sequelize']['transaction'](function(_0x506409){return db[_0xb59e('0x35')][_0xb59e('0x27')](_0x2746b5[_0xb59e('0x28')],{'raw':_0x2746b5[_0xb59e('0x1b')]?_0x2746b5[_0xb59e('0x1b')][_0xb59e('0x1c')]===undefined?!![]:![]:!![],'transaction':_0x506409})[_0xb59e('0x23')](function(){return db['CmHopper'][_0xb59e('0x36')]({'where':_0x2746b5[_0xb59e('0x1b')]?_0x2746b5['options'][_0xb59e('0x1d')]||null:null,'transaction':_0x506409});});})['then'](function(_0x32fbf5){logger[_0xb59e('0x15')](_0xb59e('0x37'),_0x2746b5);logger[_0xb59e('0x10')]('MoveContactManagedDialer',_0x2746b5,JSON['stringify'](_0x32fbf5));_0x9b1328(_0x32fbf5);})[_0xb59e('0x17')](function(_0x3c975e){logger['error'](_0xb59e('0x37'),_0x3c975e[_0xb59e('0x14')],_0x2746b5);_0x34b499(_0x40e8d3['error'](0x1f4,_0x3c975e[_0xb59e('0x14')]));});});};exports['CountReScheduled']=function(_0x101648){var _0x1b1093=this;return new Promise(function(_0x299107,_0x5696d2){return db['CmHopper'][_0xb59e('0x1a')]({'raw':_0x101648['options']?_0x101648[_0xb59e('0x1b')][_0xb59e('0x1c')]===undefined?!![]:![]:!![],'where':_0x101648[_0xb59e('0x1b')]?_0x101648[_0xb59e('0x1b')][_0xb59e('0x1d')]||null:null,'attributes':[[db[_0xb59e('0x2f')]['fn'](_0xb59e('0x38'),db[_0xb59e('0x2f')]['fn']('IF',db[_0xb59e('0x2f')][_0xb59e('0x39')]('`scheduledat`\x20>=\x20'+util['format'](_0xb59e('0x3a'),moment()['format'](_0xb59e('0x3b')))+'\x20,\x201,\x20null'))),_0xb59e('0x3c')]]})[_0xb59e('0x23')](function(_0x4aa989){logger[_0xb59e('0x15')](_0xb59e('0x3d'),_0x101648);logger['debug'](_0xb59e('0x3d'),_0x101648,JSON[_0xb59e('0x11')](_0x4aa989));_0x299107(_0x4aa989);})[_0xb59e('0x17')](function(_0x5baf7a){logger[_0xb59e('0x12')]('CountReScheduled',_0x5baf7a[_0xb59e('0x14')],_0x101648);_0x5696d2(_0x1b1093[_0xb59e('0x12')](0x1f4,_0x5baf7a[_0xb59e('0x14')]));});});};exports['GetContactRecallMe']=function(_0x1556f3){var _0x34d253=this;return new Promise(function(_0x258341,_0x1bd875){return db['CmContact'][_0xb59e('0x2e')]()[_0xb59e('0x23')](function(_0x3471ff){return db['sequelize'][_0xb59e('0x30')](function(_0x27cf1e){return db['CmHopper'][_0xb59e('0x1a')]({'where':_0x1556f3['options']?_0x1556f3[_0xb59e('0x1b')][_0xb59e('0x1d')]||null:null,'attributes':_0x1556f3[_0xb59e('0x1b')]?_0x1556f3[_0xb59e('0x1b')]['attributes']||null:null,'limit':0x1,'order':_0x1556f3[_0xb59e('0x1b')]?_0x1556f3[_0xb59e('0x1b')]['order']||null:null,'group':db[_0xb59e('0x19')][_0xb59e('0x3e')],'transaction':_0x27cf1e,'lock':_0x27cf1e[_0xb59e('0x32')][_0xb59e('0x3f')],'include':_0x1556f3['options']?_0x1556f3['options'][_0xb59e('0x20')]?_['map'](_0x1556f3[_0xb59e('0x1b')][_0xb59e('0x20')],function(_0x12cf44){return{'model':db[_0x12cf44[_0xb59e('0x21')]],'as':_0x12cf44['as'],'attributes':_0x12cf44[_0xb59e('0x22')],'include':_0x12cf44[_0xb59e('0x20')]?_[_0xb59e('0x1f')](_0x12cf44[_0xb59e('0x20')],function(_0x3c4967){return{'model':db[_0x3c4967[_0xb59e('0x21')]],'as':_0x3c4967['as'],'attributes':_0x3c4967[_0xb59e('0x22')],'include':_0x3c4967[_0xb59e('0x20')]?_[_0xb59e('0x1f')](_0x3c4967[_0xb59e('0x20')],function(_0x586335){return{'model':db[_0x586335[_0xb59e('0x21')]],'as':_0x586335['as'],'attributes':_0x586335['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f1ebc){var _0xc646df=[];for(var _0x40f197=0x0;_0x40f197<_0x4f1ebc[_0xb59e('0x34')];_0x40f197+=0x1){_0xc646df[_0xb59e('0x40')](_0x4f1ebc[_0x40f197][_0xb59e('0x2a')](_0x1556f3['body'],{'transaction':_0x27cf1e}));}return BPromise['all'](_0xc646df);});})[_0xb59e('0x23')](function(_0x424cdd){logger[_0xb59e('0x15')](_0xb59e('0x41'),_0x1556f3);logger['debug']('GetContactRecallMe',_0x1556f3,JSON[_0xb59e('0x11')](_0x424cdd));_0x258341(_0x424cdd);})['catch'](function(_0x55620e){logger[_0xb59e('0x12')](_0xb59e('0x41'),_0x55620e[_0xb59e('0x14')],_0x1556f3);_0x1bd875(_0x34d253[_0xb59e('0x12')](0x1f4,_0x55620e[_0xb59e('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a007218..fea74f9 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 _0x70db=['describe','/opencontacts','getOpenContacts','/:id','show','post','isAuthenticated','create','/preview','getPreview','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','/describe'];(function(_0x5e7e92,_0xdb0f1){var _0x412746=function(_0x1872fa){while(--_0x1872fa){_0x5e7e92['push'](_0x5e7e92['shift']());}};_0x412746(++_0xdb0f1);}(_0x70db,0x1a5));var _0xb70d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x70db[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xb70d('0x0'));var util=require(_0xb70d('0x1'));var path=require(_0xb70d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb70d('0x3'));var router=express[_0xb70d('0x4')]();var auth=require(_0xb70d('0x5'));var interaction=require(_0xb70d('0x6'));var config=require(_0xb70d('0x7'));var controller=require(_0xb70d('0x8'));router[_0xb70d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb70d('0x9')](_0xb70d('0xa'),auth['isAuthenticated'](),controller[_0xb70d('0xb')]);router['get'](_0xb70d('0xc'),auth['isAuthenticated'](),controller[_0xb70d('0xd')]);router['get'](_0xb70d('0xe'),auth['isAuthenticated'](),controller[_0xb70d('0xf')]);router[_0xb70d('0x10')]('/',auth[_0xb70d('0x11')](),controller[_0xb70d('0x12')]);router[_0xb70d('0x10')](_0xb70d('0x13'),auth[_0xb70d('0x11')](),controller[_0xb70d('0x14')]);router[_0xb70d('0x15')](_0xb70d('0xe'),auth[_0xb70d('0x11')](),controller[_0xb70d('0x16')]);router['delete'](_0xb70d('0xe'),auth[_0xb70d('0x11')](),controller['destroy']);module[_0xb70d('0x17')]=router; \ No newline at end of file +var _0x8d05=['isAuthenticated','index','describe','getOpenContacts','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./cmHopper.controller','get'];(function(_0xb1ee6d,_0x427b4c){var _0x559dde=function(_0x359e7a){while(--_0x359e7a){_0xb1ee6d['push'](_0xb1ee6d['shift']());}};_0x559dde(++_0x427b4c);}(_0x8d05,0x98));var _0x58d0=function(_0x806c89,_0x31e9ef){_0x806c89=_0x806c89-0x0;var _0x2ae0c7=_0x8d05[_0x806c89];return _0x2ae0c7;};'use strict';var multer=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var path=require(_0x58d0('0x2'));var timeout=require(_0x58d0('0x3'));var express=require(_0x58d0('0x4'));var router=express['Router']();var auth=require(_0x58d0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x58d0('0x6'));router[_0x58d0('0x7')]('/',auth[_0x58d0('0x8')](),controller[_0x58d0('0x9')]);router[_0x58d0('0x7')]('/describe',auth[_0x58d0('0x8')](),controller[_0x58d0('0xa')]);router[_0x58d0('0x7')]('/opencontacts',auth[_0x58d0('0x8')](),controller[_0x58d0('0xb')]);router[_0x58d0('0x7')](_0x58d0('0xc'),auth[_0x58d0('0x8')](),controller[_0x58d0('0xd')]);router[_0x58d0('0xe')]('/',auth[_0x58d0('0x8')](),controller[_0x58d0('0xf')]);router['post']('/preview',auth['isAuthenticated'](),controller['getPreview']);router[_0x58d0('0x10')](_0x58d0('0xc'),auth['isAuthenticated'](),controller[_0x58d0('0x11')]);router[_0x58d0('0x12')](_0x58d0('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x58d0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5768bf7..7376b78 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 _0xf3fe=['contactListQueue','sequelize','INTEGER'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xf3fe,0x190));var _0xef3f=function(_0x29f4d3,_0x247476){_0x29f4d3=_0x29f4d3-0x0;var _0x30d56e=_0xf3fe[_0x29f4d3];return _0x30d56e;};'use strict';var moment=require('moment');var Sequelize=require(_0xef3f('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xef3f('0x1')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xef3f('0x1')],'unique':_0xef3f('0x2')},'VoiceQueueId':{'type':Sequelize[_0xef3f('0x1')],'unique':_0xef3f('0x2')}}; \ No newline at end of file +var _0x9131=['sequelize','STRING','INTEGER','moment'];(function(_0x564511,_0x448a31){var _0x2e3160=function(_0x45360f){while(--_0x45360f){_0x564511['push'](_0x564511['shift']());}};_0x2e3160(++_0x448a31);}(_0x9131,0x1df));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x1913('0x0'));var Sequelize=require(_0x1913('0x1'));module['exports']={'phone':{'type':Sequelize[_0x1913('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x1913('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x1913('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9563119..7ce1689 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 _0x2c0c=['destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','CmHopperBlack','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','include','findAll','rows','catch','show','params','find','body'];(function(_0x1cfc75,_0x3ab46e){var _0x2bb17c=function(_0x87193){while(--_0x87193){_0x1cfc75['push'](_0x1cfc75['shift']());}};_0x2bb17c(++_0x3ab46e);}(_0x2c0c,0x132));var _0xc2c0=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0x2c0c[_0xe51596];return _0x22c705;};'use strict';var pdf=require(_0xc2c0('0x0'));var emlformat=require(_0xc2c0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc2c0('0x2'));var jsonpatch=require(_0xc2c0('0x3'));var rp=require(_0xc2c0('0x4'));var moment=require(_0xc2c0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc2c0('0x6'));var path=require(_0xc2c0('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc2c0('0x8'));var fs=require('fs');var _=require(_0xc2c0('0x9'));var squel=require(_0xc2c0('0xa'));var crypto=require('crypto');var jsforce=require(_0xc2c0('0xb'));var deskjs=require(_0xc2c0('0xc'));var toCsv=require(_0xc2c0('0xd'));var querystring=require(_0xc2c0('0xe'));var Papa=require(_0xc2c0('0xf'));var Redis=require(_0xc2c0('0x10'));var authService=require(_0xc2c0('0x11'));var qs=require(_0xc2c0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2c0('0x13'))(_0xc2c0('0x14'));var utils=require(_0xc2c0('0x15'));var config=require(_0xc2c0('0x16'));var db=require(_0xc2c0('0x17'))['db'];function respondWithStatusCode(_0x5e0bc1,_0x2b9984){_0x2b9984=_0x2b9984||0xcc;return function(_0x905a9b){if(_0x905a9b){return _0x5e0bc1[_0xc2c0('0x18')](_0x2b9984);}return _0x5e0bc1[_0xc2c0('0x19')](_0x2b9984)[_0xc2c0('0x1a')]();};}function respondWithResult(_0x498350,_0x38666f){_0x38666f=_0x38666f||0xc8;return function(_0x3287df){if(_0x3287df){return _0x498350[_0xc2c0('0x19')](_0x38666f)[_0xc2c0('0x1b')](_0x3287df);}};}function respondWithFilteredResult(_0x1a5fe0,_0x3fc8fa){return function(_0x495fd5){if(_0x495fd5){var _0x165483=_0x495fd5[_0xc2c0('0x1c')],_0x579568=_0x3fc8fa[_0xc2c0('0x1d')],_0x2ce60b=_0x3fc8fa[_0xc2c0('0x1d')]+_0x3fc8fa[_0xc2c0('0x1e')],_0x3e13b3;if(_0x2ce60b>=_0x165483){_0x2ce60b=_0x165483;_0x3e13b3=0xc8;}else{_0x3e13b3=0xce;}_0x1a5fe0[_0xc2c0('0x19')](_0x3e13b3);return _0x1a5fe0[_0xc2c0('0x1f')](_0xc2c0('0x20'),_0x579568+'-'+_0x2ce60b+'/'+_0x165483)[_0xc2c0('0x1b')](_0x495fd5);}return null;};}function patchUpdates(_0x579437){return function(_0x3c3114){try{jsonpatch['apply'](_0x3c3114,_0x579437,!![]);}catch(_0x42047f){return BPromise[_0xc2c0('0x21')](_0x42047f);}return _0x3c3114[_0xc2c0('0x22')]();};}function saveUpdates(_0x297cac,_0x24b9b0){return function(_0x5113e8){if(_0x5113e8){return _0x5113e8[_0xc2c0('0x23')](_0x297cac)['then'](function(_0x501191){return _0x501191;});}return null;};}function removeEntity(_0x445798,_0x4c3614){return function(_0x3fc7e2){if(_0x3fc7e2){return _0x3fc7e2['destroy']()[_0xc2c0('0x24')](function(){_0x445798['status'](0xcc)[_0xc2c0('0x1a')]();});}};}function handleEntityNotFound(_0x5584c4,_0x50fa8c){return function(_0x4f6cd2){if(!_0x4f6cd2){_0x5584c4[_0xc2c0('0x18')](0x194);}return _0x4f6cd2;};}function handleError(_0x3426f7,_0x173754){_0x173754=_0x173754||0x1f4;return function(_0x2b2714){logger[_0xc2c0('0x25')](_0x2b2714[_0xc2c0('0x26')]);if(_0x2b2714['name']){delete _0x2b2714[_0xc2c0('0x27')];}_0x3426f7[_0xc2c0('0x19')](_0x173754)[_0xc2c0('0x28')](_0x2b2714);};}exports[_0xc2c0('0x29')]=function(_0x22c8e3,_0x54dcc6){var _0x37c183={},_0x487dba={},_0x1bd62c={'count':0x0,'rows':[]};var _0x41b76c=db[_0xc2c0('0x2a')][_0xc2c0('0x2b')];_0x487dba[_0xc2c0('0x2c')]=_[_0xc2c0('0x2d')](_0x41b76c);_0x487dba['query']=_[_0xc2c0('0x2d')](_0x22c8e3[_0xc2c0('0x2e')]);_0x487dba[_0xc2c0('0x2f')]=_[_0xc2c0('0x30')](_0x487dba[_0xc2c0('0x2c')],_0x487dba[_0xc2c0('0x2e')]);_0x37c183[_0xc2c0('0x31')]=_['intersection'](_0x487dba[_0xc2c0('0x2c')],qs[_0xc2c0('0x32')](_0x22c8e3[_0xc2c0('0x2e')][_0xc2c0('0x32')]));_0x37c183['attributes']=_0x37c183[_0xc2c0('0x31')][_0xc2c0('0x33')]?_0x37c183[_0xc2c0('0x31')]:_0x487dba[_0xc2c0('0x2c')];if(!_0x22c8e3[_0xc2c0('0x2e')][_0xc2c0('0x34')](_0xc2c0('0x35'))){_0x37c183[_0xc2c0('0x1e')]=qs[_0xc2c0('0x1e')](_0x22c8e3[_0xc2c0('0x2e')][_0xc2c0('0x1e')]);_0x37c183[_0xc2c0('0x1d')]=qs['offset'](_0x22c8e3['query'][_0xc2c0('0x1d')]);}_0x37c183[_0xc2c0('0x36')]=qs[_0xc2c0('0x37')](_0x22c8e3[_0xc2c0('0x2e')][_0xc2c0('0x37')]);_0x37c183[_0xc2c0('0x38')]=qs[_0xc2c0('0x2f')](_[_0xc2c0('0x39')](_0x22c8e3[_0xc2c0('0x2e')],_0x487dba[_0xc2c0('0x2f')]));if(_0x22c8e3['query'][_0xc2c0('0x3a')]){_0x37c183['where']=_['merge'](_0x37c183[_0xc2c0('0x38')],{'$or':_[_0xc2c0('0x3b')](_0x41b76c,function(_0x52318b){if(_0x52318b[_0xc2c0('0x3c')][_0xc2c0('0x3d')]!==_0xc2c0('0x3e')){var _0x14fb11={};_0x14fb11[_0x52318b[_0xc2c0('0x3f')]]={'$like':'%'+_0x22c8e3['query'][_0xc2c0('0x3a')]+'%'};return _0x14fb11;}})});}_0x37c183=_[_0xc2c0('0x40')]({},_0x37c183,_0x22c8e3[_0xc2c0('0x41')]);var _0x2f0c0d={'where':_0x37c183['where']};return db[_0xc2c0('0x2a')][_0xc2c0('0x1c')](_0x2f0c0d)[_0xc2c0('0x24')](function(_0x4adc3c){_0x1bd62c['count']=_0x4adc3c;if(_0x22c8e3['query']['includeAll']){_0x37c183[_0xc2c0('0x42')]=[{'all':!![]}];}return db[_0xc2c0('0x2a')][_0xc2c0('0x43')](_0x37c183);})[_0xc2c0('0x24')](function(_0x5376a9){_0x1bd62c[_0xc2c0('0x44')]=_0x5376a9;return _0x1bd62c;})[_0xc2c0('0x24')](respondWithFilteredResult(_0x54dcc6,_0x37c183))[_0xc2c0('0x45')](handleError(_0x54dcc6,null));};exports[_0xc2c0('0x46')]=function(_0x20a813,_0x4d5abf){var _0x5ae6c4={'raw':!![],'where':{'id':_0x20a813[_0xc2c0('0x47')]['id']}},_0x5626bf={};_0x5626bf[_0xc2c0('0x2c')]=_[_0xc2c0('0x2d')](db[_0xc2c0('0x2a')][_0xc2c0('0x2b')]);_0x5626bf[_0xc2c0('0x2e')]=_[_0xc2c0('0x2d')](_0x20a813['query']);_0x5626bf[_0xc2c0('0x2f')]=_[_0xc2c0('0x30')](_0x5626bf['model'],_0x5626bf['query']);_0x5ae6c4[_0xc2c0('0x31')]=_[_0xc2c0('0x30')](_0x5626bf[_0xc2c0('0x2c')],qs[_0xc2c0('0x32')](_0x20a813[_0xc2c0('0x2e')][_0xc2c0('0x32')]));_0x5ae6c4[_0xc2c0('0x31')]=_0x5ae6c4['attributes'][_0xc2c0('0x33')]?_0x5ae6c4[_0xc2c0('0x31')]:_0x5626bf[_0xc2c0('0x2c')];if(_0x20a813[_0xc2c0('0x2e')]['includeAll']){_0x5ae6c4['include']=[{'all':!![]}];}_0x5ae6c4=_[_0xc2c0('0x40')]({},_0x5ae6c4,_0x20a813['options']);return db['CmHopperBlack'][_0xc2c0('0x48')](_0x5ae6c4)[_0xc2c0('0x24')](handleEntityNotFound(_0x4d5abf,null))[_0xc2c0('0x24')](respondWithResult(_0x4d5abf,null))['catch'](handleError(_0x4d5abf,null));};exports[_0xc2c0('0x23')]=function(_0x115c39,_0x44a211){if(_0x115c39[_0xc2c0('0x49')]['id']){delete _0x115c39[_0xc2c0('0x49')]['id'];}return db[_0xc2c0('0x2a')][_0xc2c0('0x48')]({'where':{'id':_0x115c39[_0xc2c0('0x47')]['id']}})[_0xc2c0('0x24')](handleEntityNotFound(_0x44a211,null))['then'](saveUpdates(_0x115c39['body'],null))[_0xc2c0('0x24')](respondWithResult(_0x44a211,null))[_0xc2c0('0x45')](handleError(_0x44a211,null));};exports[_0xc2c0('0x4a')]=function(_0x53931d,_0x470eee){return db[_0xc2c0('0x2a')][_0xc2c0('0x48')]({'where':{'id':_0x53931d[_0xc2c0('0x47')]['id']}})[_0xc2c0('0x24')](handleEntityNotFound(_0x470eee,null))[_0xc2c0('0x24')](removeEntity(_0x470eee,null))['catch'](handleError(_0x470eee,null));};exports['describe']=function(_0x508070,_0x5a7905){return db[_0xc2c0('0x2a')][_0xc2c0('0x4b')]()[_0xc2c0('0x24')](respondWithResult(_0x5a7905,null))[_0xc2c0('0x45')](handleError(_0x5a7905,null));}; \ No newline at end of file +var _0x1b50=['catch','body','describe','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','CmHopperBlack','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1b50,0x11f));var _0x01b5=function(_0x47ede9,_0x267314){_0x47ede9=_0x47ede9-0x0;var _0x37a0de=_0x1b50[_0x47ede9];return _0x37a0de;};'use strict';var pdf=require(_0x01b5('0x0'));var emlformat=require(_0x01b5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x01b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x01b5('0x3'));var BPromise=require(_0x01b5('0x4'));var Mustache=require('mustache');var util=require(_0x01b5('0x5'));var path=require(_0x01b5('0x6'));var sox=require(_0x01b5('0x7'));var csv=require(_0x01b5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x01b5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x01b5('0xa'));var toCsv=require(_0x01b5('0x8'));var querystring=require('querystring');var Papa=require(_0x01b5('0xb'));var Redis=require(_0x01b5('0xc'));var authService=require(_0x01b5('0xd'));var qs=require(_0x01b5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01b5('0xf'))(_0x01b5('0x10'));var utils=require(_0x01b5('0x11'));var config=require(_0x01b5('0x12'));var db=require(_0x01b5('0x13'))['db'];function respondWithStatusCode(_0x58f5a7,_0x585232){_0x585232=_0x585232||0xcc;return function(_0x28ad4e){if(_0x28ad4e){return _0x58f5a7['sendStatus'](_0x585232);}return _0x58f5a7[_0x01b5('0x14')](_0x585232)[_0x01b5('0x15')]();};}function respondWithResult(_0x398c02,_0x3ed857){_0x3ed857=_0x3ed857||0xc8;return function(_0x54c5d2){if(_0x54c5d2){return _0x398c02[_0x01b5('0x14')](_0x3ed857)[_0x01b5('0x16')](_0x54c5d2);}};}function respondWithFilteredResult(_0x1da5b5,_0x4a83fd){return function(_0x48716f){if(_0x48716f){var _0x3d5d62=_0x48716f[_0x01b5('0x17')],_0x346110=_0x4a83fd[_0x01b5('0x18')],_0x37c606=_0x4a83fd[_0x01b5('0x18')]+_0x4a83fd[_0x01b5('0x19')],_0x266a2a;if(_0x37c606>=_0x3d5d62){_0x37c606=_0x3d5d62;_0x266a2a=0xc8;}else{_0x266a2a=0xce;}_0x1da5b5[_0x01b5('0x14')](_0x266a2a);return _0x1da5b5[_0x01b5('0x1a')](_0x01b5('0x1b'),_0x346110+'-'+_0x37c606+'/'+_0x3d5d62)[_0x01b5('0x16')](_0x48716f);}return null;};}function patchUpdates(_0x545abd){return function(_0x3b9283){try{jsonpatch[_0x01b5('0x1c')](_0x3b9283,_0x545abd,!![]);}catch(_0x530541){return BPromise[_0x01b5('0x1d')](_0x530541);}return _0x3b9283[_0x01b5('0x1e')]();};}function saveUpdates(_0x1bd09f,_0x2fa91a){return function(_0x563f24){if(_0x563f24){return _0x563f24[_0x01b5('0x1f')](_0x1bd09f)[_0x01b5('0x20')](function(_0xa7d306){return _0xa7d306;});}return null;};}function removeEntity(_0x3522d1,_0x776866){return function(_0x514ad9){if(_0x514ad9){return _0x514ad9[_0x01b5('0x21')]()['then'](function(){_0x3522d1['status'](0xcc)[_0x01b5('0x15')]();});}};}function handleEntityNotFound(_0x4497ac,_0x114f9b){return function(_0x23f8bf){if(!_0x23f8bf){_0x4497ac[_0x01b5('0x22')](0x194);}return _0x23f8bf;};}function handleError(_0x17518f,_0x4aa978){_0x4aa978=_0x4aa978||0x1f4;return function(_0x1fdb7d){logger['error'](_0x1fdb7d[_0x01b5('0x23')]);if(_0x1fdb7d[_0x01b5('0x24')]){delete _0x1fdb7d['name'];}_0x17518f[_0x01b5('0x14')](_0x4aa978)[_0x01b5('0x25')](_0x1fdb7d);};}exports[_0x01b5('0x26')]=function(_0x55dff6,_0x28ecc9){var _0x53d052={},_0x24d5a2={},_0x1f72f2={'count':0x0,'rows':[]};var _0x4e6e45=db[_0x01b5('0x27')]['rawAttributes'];_0x24d5a2[_0x01b5('0x28')]=_[_0x01b5('0x29')](_0x4e6e45);_0x24d5a2[_0x01b5('0x2a')]=_[_0x01b5('0x29')](_0x55dff6[_0x01b5('0x2a')]);_0x24d5a2[_0x01b5('0x2b')]=_['intersection'](_0x24d5a2['model'],_0x24d5a2[_0x01b5('0x2a')]);_0x53d052[_0x01b5('0x2c')]=_[_0x01b5('0x2d')](_0x24d5a2[_0x01b5('0x28')],qs[_0x01b5('0x2e')](_0x55dff6[_0x01b5('0x2a')][_0x01b5('0x2e')]));_0x53d052[_0x01b5('0x2c')]=_0x53d052[_0x01b5('0x2c')][_0x01b5('0x2f')]?_0x53d052['attributes']:_0x24d5a2[_0x01b5('0x28')];if(!_0x55dff6[_0x01b5('0x2a')]['hasOwnProperty'](_0x01b5('0x30'))){_0x53d052[_0x01b5('0x19')]=qs[_0x01b5('0x19')](_0x55dff6[_0x01b5('0x2a')]['limit']);_0x53d052[_0x01b5('0x18')]=qs[_0x01b5('0x18')](_0x55dff6[_0x01b5('0x2a')][_0x01b5('0x18')]);}_0x53d052[_0x01b5('0x31')]=qs[_0x01b5('0x32')](_0x55dff6[_0x01b5('0x2a')][_0x01b5('0x32')]);_0x53d052[_0x01b5('0x33')]=qs[_0x01b5('0x2b')](_[_0x01b5('0x34')](_0x55dff6['query'],_0x24d5a2['filters']));if(_0x55dff6[_0x01b5('0x2a')][_0x01b5('0x35')]){_0x53d052[_0x01b5('0x33')]=_['merge'](_0x53d052[_0x01b5('0x33')],{'$or':_[_0x01b5('0x36')](_0x4e6e45,function(_0x2a600d){if(_0x2a600d[_0x01b5('0x37')]['key']!==_0x01b5('0x38')){var _0x1b593c={};_0x1b593c[_0x2a600d[_0x01b5('0x39')]]={'$like':'%'+_0x55dff6['query']['filter']+'%'};return _0x1b593c;}})});}_0x53d052=_[_0x01b5('0x3a')]({},_0x53d052,_0x55dff6[_0x01b5('0x3b')]);var _0x536f95={'where':_0x53d052['where']};return db[_0x01b5('0x27')][_0x01b5('0x17')](_0x536f95)[_0x01b5('0x20')](function(_0x370e9f){_0x1f72f2['count']=_0x370e9f;if(_0x55dff6['query'][_0x01b5('0x3c')]){_0x53d052[_0x01b5('0x3d')]=[{'all':!![]}];}return db[_0x01b5('0x27')][_0x01b5('0x3e')](_0x53d052);})['then'](function(_0x4c9ddc){_0x1f72f2[_0x01b5('0x3f')]=_0x4c9ddc;return _0x1f72f2;})[_0x01b5('0x20')](respondWithFilteredResult(_0x28ecc9,_0x53d052))['catch'](handleError(_0x28ecc9,null));};exports[_0x01b5('0x40')]=function(_0x5412ff,_0x1f6f0b){var _0x8150ba={'raw':!![],'where':{'id':_0x5412ff[_0x01b5('0x41')]['id']}},_0x2a7d4c={};_0x2a7d4c[_0x01b5('0x28')]=_[_0x01b5('0x29')](db[_0x01b5('0x27')][_0x01b5('0x42')]);_0x2a7d4c[_0x01b5('0x2a')]=_[_0x01b5('0x29')](_0x5412ff[_0x01b5('0x2a')]);_0x2a7d4c['filters']=_['intersection'](_0x2a7d4c['model'],_0x2a7d4c['query']);_0x8150ba[_0x01b5('0x2c')]=_[_0x01b5('0x2d')](_0x2a7d4c['model'],qs[_0x01b5('0x2e')](_0x5412ff[_0x01b5('0x2a')][_0x01b5('0x2e')]));_0x8150ba[_0x01b5('0x2c')]=_0x8150ba[_0x01b5('0x2c')][_0x01b5('0x2f')]?_0x8150ba[_0x01b5('0x2c')]:_0x2a7d4c['model'];if(_0x5412ff[_0x01b5('0x2a')][_0x01b5('0x3c')]){_0x8150ba[_0x01b5('0x3d')]=[{'all':!![]}];}_0x8150ba=_[_0x01b5('0x3a')]({},_0x8150ba,_0x5412ff[_0x01b5('0x3b')]);return db[_0x01b5('0x27')][_0x01b5('0x43')](_0x8150ba)['then'](handleEntityNotFound(_0x1f6f0b,null))[_0x01b5('0x20')](respondWithResult(_0x1f6f0b,null))[_0x01b5('0x44')](handleError(_0x1f6f0b,null));};exports[_0x01b5('0x1f')]=function(_0x1ff49a,_0x1e21b7){if(_0x1ff49a['body']['id']){delete _0x1ff49a[_0x01b5('0x45')]['id'];}return db[_0x01b5('0x27')][_0x01b5('0x43')]({'where':{'id':_0x1ff49a[_0x01b5('0x41')]['id']}})[_0x01b5('0x20')](handleEntityNotFound(_0x1e21b7,null))[_0x01b5('0x20')](saveUpdates(_0x1ff49a['body'],null))[_0x01b5('0x20')](respondWithResult(_0x1e21b7,null))[_0x01b5('0x44')](handleError(_0x1e21b7,null));};exports['destroy']=function(_0xc40998,_0x12e19e){return db[_0x01b5('0x27')]['find']({'where':{'id':_0xc40998[_0x01b5('0x41')]['id']}})[_0x01b5('0x20')](handleEntityNotFound(_0x12e19e,null))['then'](removeEntity(_0x12e19e,null))[_0x01b5('0x44')](handleError(_0x12e19e,null));};exports[_0x01b5('0x46')]=function(_0x109d95,_0x4d2ce9){return db['CmHopperBlack'][_0x01b5('0x46')]()[_0x01b5('0x20')](respondWithResult(_0x4d2ce9,null))['catch'](handleError(_0x4d2ce9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 64bfb36..f346f6d 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 _0x9e4a=['./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','util','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x9e4a,0x11b));var _0xa9e4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9e4a[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0xa9e4('0x0'));var logger=require(_0xa9e4('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa9e4('0x2'));var rp=require(_0xa9e4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9e4('0x4'));var attributes=require(_0xa9e4('0x5'));module[_0xa9e4('0x6')]=function(_0xfcb0cc,_0x273db1){return _0xfcb0cc['define'](_0xa9e4('0x7'),attributes,{'tableName':_0xa9e4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6f4=['define','cm_hopper_black','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x1b5e0f,_0x3b5849){var _0x589d08=function(_0x2b766a){while(--_0x2b766a){_0x1b5e0f['push'](_0x1b5e0f['shift']());}};_0x589d08(++_0x3b5849);}(_0xf6f4,0x161));var _0x4f6f=function(_0x541b64,_0x57b400){_0x541b64=_0x541b64-0x0;var _0x5fe6ea=_0xf6f4[_0x541b64];return _0x5fe6ea;};'use strict';var _=require('lodash');var util=require(_0x4f6f('0x0'));var logger=require(_0x4f6f('0x1'))(_0x4f6f('0x2'));var moment=require('moment');var BPromise=require(_0x4f6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f6f('0x4'));var rimraf=require('rimraf');var config=require(_0x4f6f('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0x4f6f('0x6')]=function(_0x1cb46d,_0x1393f7){return _0x1cb46d[_0x4f6f('0x7')]('CmHopperBlack',attributes,{'tableName':_0x4f6f('0x8'),'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 1041089..23ef0f4 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 _0x33cd=['DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','debug'];(function(_0x3caa70,_0x22546e){var _0x3ce8ad=function(_0x197f64){while(--_0x197f64){_0x3caa70['push'](_0x3caa70['shift']());}};_0x3ce8ad(++_0x22546e);}(_0x33cd,0xb6));var _0xd33c=function(_0xbf1b33,_0x4bab0b){_0xbf1b33=_0xbf1b33-0x0;var _0x466d32=_0x33cd[_0xbf1b33];return _0x466d32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd33c('0x0'));var BPromise=require(_0xd33c('0x1'));var rs=require(_0xd33c('0x2'));var fs=require('fs');var Redis=require(_0xd33c('0x3'));var db=require(_0xd33c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd33c('0x5'))(_0xd33c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd33c('0x7')][_0xd33c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d3f32,_0x122ee2,_0x441fb1){return new BPromise(function(_0x303ca1,_0x108d6c){return client['request'](_0x4d3f32,_0x441fb1)[_0xd33c('0x9')](function(_0x1aa425){logger[_0xd33c('0xa')](_0xd33c('0xb'),_0x122ee2,_0xd33c('0xc'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x122ee2,_0xd33c('0xc'),JSON[_0xd33c('0xd')](_0x1aa425));if(_0x1aa425[_0xd33c('0xe')]){if(_0x1aa425[_0xd33c('0xe')][_0xd33c('0xf')]===0x1f4){logger['error'](_0xd33c('0xb'),_0x122ee2,_0x1aa425[_0xd33c('0xe')][_0xd33c('0x10')]);return _0x108d6c(_0x1aa425[_0xd33c('0xe')][_0xd33c('0x10')]);}logger['error'](_0xd33c('0xb'),_0x122ee2,_0x1aa425['error'][_0xd33c('0x10')]);return _0x303ca1(_0x1aa425[_0xd33c('0xe')]['message']);}else{logger['info'](_0xd33c('0xb'),_0x122ee2,_0xd33c('0xc'));_0x303ca1(_0x1aa425[_0xd33c('0x11')]['message']);}})[_0xd33c('0x12')](function(_0x1a3efe){logger[_0xd33c('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x122ee2,_0x1a3efe);_0x108d6c(_0x1a3efe);});});}exports['GetCmHopperBlack']=function(_0x2648cb){var _0xad9cfb=this;return new Promise(function(_0x491ccd,_0x3844cf){return db[_0xd33c('0x13')][_0xd33c('0x14')]({'raw':_0x2648cb[_0xd33c('0x15')]?_0x2648cb[_0xd33c('0x15')][_0xd33c('0x16')]===undefined?!![]:![]:!![],'where':_0x2648cb[_0xd33c('0x15')]?_0x2648cb[_0xd33c('0x15')][_0xd33c('0x17')]||null:null,'attributes':_0x2648cb['options']?_0x2648cb['options'][_0xd33c('0x18')]||null:null,'limit':_0x2648cb[_0xd33c('0x15')]?_0x2648cb[_0xd33c('0x15')][_0xd33c('0x19')]||null:null,'include':_0x2648cb[_0xd33c('0x15')]?_0x2648cb[_0xd33c('0x15')][_0xd33c('0x1a')]?_[_0xd33c('0x1b')](_0x2648cb[_0xd33c('0x15')][_0xd33c('0x1a')],function(_0x45f7c5){return{'model':db[_0x45f7c5[_0xd33c('0x1c')]],'as':_0x45f7c5['as'],'attributes':_0x45f7c5['attributes'],'include':_0x45f7c5[_0xd33c('0x1a')]?_[_0xd33c('0x1b')](_0x45f7c5[_0xd33c('0x1a')],function(_0x21adca){return{'model':db[_0x21adca[_0xd33c('0x1c')]],'as':_0x21adca['as'],'attributes':_0x21adca['attributes'],'include':_0x21adca[_0xd33c('0x1a')]?_[_0xd33c('0x1b')](_0x21adca[_0xd33c('0x1a')],function(_0x803b73){return{'model':db[_0x803b73[_0xd33c('0x1c')]],'as':_0x803b73['as'],'attributes':_0x803b73[_0xd33c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3de43f){logger[_0xd33c('0xa')](_0xd33c('0x1d'),_0x2648cb);logger['debug'](_0xd33c('0x1d'),_0x2648cb,JSON[_0xd33c('0xd')](_0x3de43f));_0x491ccd(_0x3de43f);})[_0xd33c('0x12')](function(_0x416cc1){logger[_0xd33c('0xe')](_0xd33c('0x1d'),_0x416cc1[_0xd33c('0x10')],_0x2648cb);_0x3844cf(_0xad9cfb[_0xd33c('0xe')](0x1f4,_0x416cc1['message']));});});};exports[_0xd33c('0x1e')]=function(_0x523531){var _0x416e16=this;return new Promise(function(_0x1f6747,_0x555656){return db[_0xd33c('0x13')][_0xd33c('0x1f')](_0x523531[_0xd33c('0x20')],{'raw':_0x523531['options']?_0x523531[_0xd33c('0x15')][_0xd33c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x523531[_0xd33c('0x15')]?_0x523531[_0xd33c('0x15')][_0xd33c('0x17')]||null:null,'attributes':_0x523531[_0xd33c('0x15')]?_0x523531[_0xd33c('0x15')][_0xd33c('0x18')]||null:null,'limit':_0x523531[_0xd33c('0x15')]?_0x523531['options']['limit']||null:null})[_0xd33c('0x9')](function(_0x5e05da){logger[_0xd33c('0xa')](_0xd33c('0x1e'),_0x523531);logger[_0xd33c('0x21')](_0xd33c('0x1e'),_0x523531,JSON[_0xd33c('0xd')](_0x5e05da));_0x1f6747(_0x5e05da);})[_0xd33c('0x12')](function(_0xe96538){logger[_0xd33c('0xe')](_0xd33c('0x1e'),_0xe96538[_0xd33c('0x10')],_0x523531);_0x555656(_0x416e16[_0xd33c('0xe')](0x1f4,_0xe96538[_0xd33c('0x10')]));});});};exports[_0xd33c('0x22')]=function(_0x409745){var _0x489aab=this;return new Promise(function(_0x581ba8,_0xa5c304){return db[_0xd33c('0x13')][_0xd33c('0x23')]({'where':_0x409745[_0xd33c('0x15')]?_0x409745[_0xd33c('0x15')][_0xd33c('0x17')]||null:null})[_0xd33c('0x9')](function(_0x1a2f89){logger[_0xd33c('0xa')](_0xd33c('0x22'),_0x409745);logger['debug'](_0xd33c('0x22'),_0x409745,JSON[_0xd33c('0xd')](_0x1a2f89));_0x581ba8(_0x1a2f89);})[_0xd33c('0x12')](function(_0x4454a8){logger[_0xd33c('0xe')](_0xd33c('0x22'),_0x4454a8[_0xd33c('0x10')],_0x409745);_0xa5c304(_0x489aab[_0xd33c('0xe')](0x1f4,_0x4454a8[_0xd33c('0x10')]));});});}; \ No newline at end of file +var _0x8627=['model','attributes','UpdateCmHopperBlack','body','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','limit','include','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8627,0x1cd));var _0x7862=function(_0x361199,_0x544999){_0x361199=_0x361199-0x0;var _0x1938e6=_0x8627[_0x361199];return _0x1938e6;};'use strict';var _=require(_0x7862('0x0'));var util=require(_0x7862('0x1'));var moment=require(_0x7862('0x2'));var BPromise=require(_0x7862('0x3'));var rs=require(_0x7862('0x4'));var fs=require('fs');var Redis=require(_0x7862('0x5'));var db=require(_0x7862('0x6'))['db'];var utils=require(_0x7862('0x7'));var logger=require('../../config/logger')(_0x7862('0x8'));var config=require('../../config/environment');var jayson=require(_0x7862('0x9'));var client=jayson[_0x7862('0xa')][_0x7862('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cc0d2,_0x50ed0d,_0x46d561){return new BPromise(function(_0x2558a8,_0x551304){return client[_0x7862('0xc')](_0x1cc0d2,_0x46d561)[_0x7862('0xd')](function(_0x52886f){logger[_0x7862('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x50ed0d,_0x7862('0xf'));logger[_0x7862('0x10')](_0x7862('0x11'),_0x50ed0d,_0x7862('0xf'),JSON[_0x7862('0x12')](_0x52886f));if(_0x52886f[_0x7862('0x13')]){if(_0x52886f[_0x7862('0x13')][_0x7862('0x14')]===0x1f4){logger['error'](_0x7862('0x15'),_0x50ed0d,_0x52886f['error']['message']);return _0x551304(_0x52886f['error'][_0x7862('0x16')]);}logger[_0x7862('0x13')](_0x7862('0x15'),_0x50ed0d,_0x52886f[_0x7862('0x13')][_0x7862('0x16')]);return _0x2558a8(_0x52886f[_0x7862('0x13')][_0x7862('0x16')]);}else{logger[_0x7862('0xe')](_0x7862('0x15'),_0x50ed0d,_0x7862('0xf'));_0x2558a8(_0x52886f[_0x7862('0x17')]['message']);}})[_0x7862('0x18')](function(_0x1025ea){logger[_0x7862('0x13')](_0x7862('0x15'),_0x50ed0d,_0x1025ea);_0x551304(_0x1025ea);});});}exports[_0x7862('0x19')]=function(_0x19a00e){var _0x4f88fe=this;return new Promise(function(_0x95fbb4,_0x3f2feb){return db[_0x7862('0x1a')]['findAll']({'raw':_0x19a00e['options']?_0x19a00e[_0x7862('0x1b')][_0x7862('0x1c')]===undefined?!![]:![]:!![],'where':_0x19a00e[_0x7862('0x1b')]?_0x19a00e[_0x7862('0x1b')][_0x7862('0x1d')]||null:null,'attributes':_0x19a00e['options']?_0x19a00e[_0x7862('0x1b')]['attributes']||null:null,'limit':_0x19a00e[_0x7862('0x1b')]?_0x19a00e[_0x7862('0x1b')][_0x7862('0x1e')]||null:null,'include':_0x19a00e['options']?_0x19a00e[_0x7862('0x1b')][_0x7862('0x1f')]?_[_0x7862('0x20')](_0x19a00e[_0x7862('0x1b')]['include'],function(_0x386f63){return{'model':db[_0x386f63[_0x7862('0x21')]],'as':_0x386f63['as'],'attributes':_0x386f63[_0x7862('0x22')],'include':_0x386f63['include']?_[_0x7862('0x20')](_0x386f63[_0x7862('0x1f')],function(_0x47246f){return{'model':db[_0x47246f[_0x7862('0x21')]],'as':_0x47246f['as'],'attributes':_0x47246f[_0x7862('0x22')],'include':_0x47246f[_0x7862('0x1f')]?_[_0x7862('0x20')](_0x47246f[_0x7862('0x1f')],function(_0x145385){return{'model':db[_0x145385[_0x7862('0x21')]],'as':_0x145385['as'],'attributes':_0x145385['attributes']};}):[]};}):[]};}):[]:[]})[_0x7862('0xd')](function(_0x313c19){logger[_0x7862('0xe')](_0x7862('0x19'),_0x19a00e);logger[_0x7862('0x10')](_0x7862('0x19'),_0x19a00e,JSON['stringify'](_0x313c19));_0x95fbb4(_0x313c19);})['catch'](function(_0x3b2f11){logger[_0x7862('0x13')]('GetCmHopperBlack',_0x3b2f11[_0x7862('0x16')],_0x19a00e);_0x3f2feb(_0x4f88fe[_0x7862('0x13')](0x1f4,_0x3b2f11[_0x7862('0x16')]));});});};exports[_0x7862('0x23')]=function(_0x46830f){var _0x48486e=this;return new Promise(function(_0xca0836,_0x5a1e3c){return db[_0x7862('0x1a')]['update'](_0x46830f[_0x7862('0x24')],{'raw':_0x46830f['options']?_0x46830f['options'][_0x7862('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46830f['options']?_0x46830f['options'][_0x7862('0x1d')]||null:null,'attributes':_0x46830f['options']?_0x46830f['options'][_0x7862('0x22')]||null:null,'limit':_0x46830f[_0x7862('0x1b')]?_0x46830f[_0x7862('0x1b')][_0x7862('0x1e')]||null:null})['then'](function(_0x25ab35){logger[_0x7862('0xe')](_0x7862('0x23'),_0x46830f);logger['debug'](_0x7862('0x23'),_0x46830f,JSON[_0x7862('0x12')](_0x25ab35));_0xca0836(_0x25ab35);})['catch'](function(_0x4455b1){logger[_0x7862('0x13')](_0x7862('0x23'),_0x4455b1[_0x7862('0x16')],_0x46830f);_0x5a1e3c(_0x48486e[_0x7862('0x13')](0x1f4,_0x4455b1['message']));});});};exports[_0x7862('0x25')]=function(_0x34092a){var _0x26025a=this;return new Promise(function(_0x339e7a,_0x30f8ee){return db[_0x7862('0x1a')]['destroy']({'where':_0x34092a[_0x7862('0x1b')]?_0x34092a['options'][_0x7862('0x1d')]||null:null})[_0x7862('0xd')](function(_0x4bc695){logger[_0x7862('0xe')]('DestroyCmHopperBlack',_0x34092a);logger[_0x7862('0x10')](_0x7862('0x25'),_0x34092a,JSON[_0x7862('0x12')](_0x4bc695));_0x339e7a(_0x4bc695);})[_0x7862('0x18')](function(_0x31b1fe){logger[_0x7862('0x13')](_0x7862('0x25'),_0x31b1fe['message'],_0x34092a);_0x30f8ee(_0x26025a['error'](0x1f4,_0x31b1fe['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 670058f..62f2109 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 _0xac31=['./cmHopperBlack.controller','index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xac31,0xca));var _0x1ac3=function(_0x3174c9,_0x113cd2){_0x3174c9=_0x3174c9-0x0;var _0x4cea58=_0xac31[_0x3174c9];return _0x4cea58;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var auth=require(_0x1ac3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1ac3('0x7'));var controller=require(_0x1ac3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ac3('0x9')]);router[_0x1ac3('0xa')](_0x1ac3('0xb'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0x11')]);router[_0x1ac3('0x12')](_0x1ac3('0xe'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x13')]);module[_0x1ac3('0x14')]=router; \ No newline at end of file +var _0xbec5=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x5293c8,_0xab0c3c){var _0x3623fb=function(_0x23ef99){while(--_0x23ef99){_0x5293c8['push'](_0x5293c8['shift']());}};_0x3623fb(++_0xab0c3c);}(_0xbec5,0xe5));var _0x5bec=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0xbec5[_0x4164f2];return _0x2575c7;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0x8')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router['put'](_0x5bec('0xc'),auth['isAuthenticated'](),controller[_0x5bec('0xe')]);router[_0x5bec('0xf')](_0x5bec('0xc'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);module[_0x5bec('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e51bea1..d5ec6c5 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 _0xbc61=['getDataValue','endtime','followuptime','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING'];(function(_0x2abcf9,_0x2a6b59){var _0x9ac278=function(_0x553719){while(--_0x553719){_0x2abcf9['push'](_0x2abcf9['shift']());}};_0x9ac278(++_0x2a6b59);}(_0xbc61,0x1b2));var _0x1bc6=function(_0x1b9504,_0x168f84){_0x1b9504=_0x1b9504-0x0;var _0x3e80e6=_0xbc61[_0x1b9504];return _0x3e80e6;};'use strict';var Sequelize=require(_0x1bc6('0x0'));var moment=require(_0x1bc6('0x1'));module[_0x1bc6('0x2')]={'state':{'type':Sequelize[_0x1bc6('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1bc6('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1bc6('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1bc6('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1bc6('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x1bc6('0x5')]},'originatecalleridname':{'type':Sequelize[_0x1bc6('0x5')]},'calleridnum':{'type':Sequelize[_0x1bc6('0x5')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x1bc6('0x4')]},'responsetime':{'type':Sequelize[_0x1bc6('0x4')]},'answertime':{'type':Sequelize[_0x1bc6('0x4')]},'droptime':{'type':Sequelize[_0x1bc6('0x4')]},'endtime':{'type':Sequelize[_0x1bc6('0x4')]},'ringtime':{'type':Sequelize[_0x1bc6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1bc6('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1bc6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1bc6('0x5')]},'campaign':{'type':Sequelize[_0x1bc6('0x5')]},'campaigntype':{'type':Sequelize[_0x1bc6('0x5')]},'membername':{'type':Sequelize[_0x1bc6('0x5')]},'reason':{'type':Sequelize[_0x1bc6('0x5')]},'disposition':{'type':Sequelize[_0x1bc6('0x5')]},'dispositionat':{'type':Sequelize[_0x1bc6('0x4')],'set':function(_0x40a045){var _0x43e4cd=this[_0x1bc6('0x6')](_0x1bc6('0x7'));if(_0x43e4cd&&_0x40a045){this['setDataValue'](_0x1bc6('0x8'),moment(_0x40a045)['diff'](moment(_0x43e4cd),'seconds'));}return this['setDataValue'](_0x1bc6('0x9'),_0x40a045);}},'amd':{'type':Sequelize[_0x1bc6('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1bc6('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1bc6('0x4')]},'callback':{'type':Sequelize[_0x1bc6('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1bc6('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x1bc6('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1bc6('0x4')]},'recallme':{'type':Sequelize[_0x1bc6('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1bc6('0x4')]}}; \ No newline at end of file +var _0x1c90=['moment','exports','DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x1c90,0x104));var _0x01c9=function(_0x51906b,_0x3bb3a1){_0x51906b=_0x51906b-0x0;var _0x5c47c9=_0x1c90[_0x51906b];return _0x5c47c9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x01c9('0x0'));module[_0x01c9('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x01c9('0x2')]},'countbusyretry':{'type':Sequelize[_0x01c9('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x01c9('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x01c9('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x01c9('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x01c9('0x4')]},'calleridnum':{'type':Sequelize[_0x01c9('0x4')]},'calleridname':{'type':Sequelize[_0x01c9('0x4')]},'starttime':{'type':Sequelize[_0x01c9('0x2')]},'responsetime':{'type':Sequelize[_0x01c9('0x2')]},'answertime':{'type':Sequelize[_0x01c9('0x2')]},'droptime':{'type':Sequelize[_0x01c9('0x2')]},'endtime':{'type':Sequelize[_0x01c9('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x01c9('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x01c9('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x01c9('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x01c9('0x4')]},'campaign':{'type':Sequelize[_0x01c9('0x4')]},'campaigntype':{'type':Sequelize[_0x01c9('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x01c9('0x4')]},'disposition':{'type':Sequelize[_0x01c9('0x4')]},'dispositionat':{'type':Sequelize[_0x01c9('0x2')],'set':function(_0x547615){var _0x3d4123=this[_0x01c9('0x5')](_0x01c9('0x6'));if(_0x3d4123&&_0x547615){this[_0x01c9('0x7')](_0x01c9('0x8'),moment(_0x547615)[_0x01c9('0x9')](moment(_0x3d4123),_0x01c9('0xa')));}return this[_0x01c9('0x7')](_0x01c9('0xb'),_0x547615);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x01c9('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x01c9('0x2')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x01c9('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x01c9('0x2')]},'deleted':{'type':Sequelize[_0x01c9('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x01c9('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x01c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 457c643..447f333 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 _0x5784=['options','then','includeAll','findAll','show','params','keys','intersection','find','catch','update','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','NOW()','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','from','moveContactsIvrCampaignHopperFinal','cm_hopper','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','CampaignId','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','name','index','CmHopperFinal','rawAttributes','model','query','filters','attributes','fields','length','sort','where','filter','merge','map','type','key','field'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5784,0xba));var _0x4578=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5784[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x4578('0x0'));var emlformat=require(_0x4578('0x1'));var rimraf=require(_0x4578('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4578('0x3'));var rp=require(_0x4578('0x4'));var moment=require(_0x4578('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4578('0x6'));var path=require('path');var sox=require(_0x4578('0x7'));var csv=require(_0x4578('0x8'));var ejs=require(_0x4578('0x9'));var fs=require('fs');var _=require(_0x4578('0xa'));var squel=require(_0x4578('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4578('0xc'));var toCsv=require(_0x4578('0x8'));var querystring=require(_0x4578('0xd'));var Papa=require(_0x4578('0xe'));var Redis=require(_0x4578('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x4578('0x10'));var logger=require(_0x4578('0x11'))(_0x4578('0x12'));var utils=require(_0x4578('0x13'));var config=require(_0x4578('0x14'));var db=require(_0x4578('0x15'))['db'];function respondWithStatusCode(_0x2ae9f4,_0x2c0920){_0x2c0920=_0x2c0920||0xcc;return function(_0x8d9252){if(_0x8d9252){return _0x2ae9f4['sendStatus'](_0x2c0920);}return _0x2ae9f4[_0x4578('0x16')](_0x2c0920)[_0x4578('0x17')]();};}function respondWithResult(_0x134efd,_0x573db0){_0x573db0=_0x573db0||0xc8;return function(_0x1aad40){if(_0x1aad40){return _0x134efd[_0x4578('0x16')](_0x573db0)[_0x4578('0x18')](_0x1aad40);}};}function respondWithFilteredResult(_0x2e6f84,_0x8639a0){return function(_0x18c020){if(_0x18c020){var _0x17474a=_0x18c020[_0x4578('0x19')],_0x217313=_0x8639a0[_0x4578('0x1a')],_0x453abf=_0x8639a0[_0x4578('0x1a')]+_0x8639a0[_0x4578('0x1b')],_0x5d3a6d;if(_0x453abf>=_0x17474a){_0x453abf=_0x17474a;_0x5d3a6d=0xc8;}else{_0x5d3a6d=0xce;}_0x2e6f84[_0x4578('0x16')](_0x5d3a6d);return _0x2e6f84['set'](_0x4578('0x1c'),_0x217313+'-'+_0x453abf+'/'+_0x17474a)[_0x4578('0x18')](_0x18c020);}return null;};}function patchUpdates(_0x147781){return function(_0x356867){try{jsonpatch[_0x4578('0x1d')](_0x356867,_0x147781,!![]);}catch(_0x118a45){return BPromise[_0x4578('0x1e')](_0x118a45);}return _0x356867[_0x4578('0x1f')]();};}function saveUpdates(_0x26df97,_0x3faae5){return function(_0x4215ae){if(_0x4215ae){return _0x4215ae['update'](_0x26df97)['then'](function(_0x1396f7){return _0x1396f7;});}return null;};}function removeEntity(_0x2b6c11,_0x3c4de9){return function(_0x335527){if(_0x335527){return _0x335527[_0x4578('0x20')]()['then'](function(){_0x2b6c11[_0x4578('0x16')](0xcc)[_0x4578('0x17')]();});}};}function handleEntityNotFound(_0x42e9fa,_0x401a16){return function(_0x34c84a){if(!_0x34c84a){_0x42e9fa[_0x4578('0x21')](0x194);}return _0x34c84a;};}function handleError(_0x53e9ea,_0x6bc721){_0x6bc721=_0x6bc721||0x1f4;return function(_0x466834){logger[_0x4578('0x22')](_0x466834[_0x4578('0x23')]);if(_0x466834[_0x4578('0x24')]){delete _0x466834[_0x4578('0x24')];}_0x53e9ea['status'](_0x6bc721)['send'](_0x466834);};}exports[_0x4578('0x25')]=function(_0x3c6053,_0x192811){var _0x1b58f6={},_0x453e45={},_0x6dcc70={'count':0x0,'rows':[]};var _0x45b4e1=db[_0x4578('0x26')][_0x4578('0x27')];_0x453e45[_0x4578('0x28')]=_['keys'](_0x45b4e1);_0x453e45[_0x4578('0x29')]=_['keys'](_0x3c6053['query']);_0x453e45[_0x4578('0x2a')]=_['intersection'](_0x453e45[_0x4578('0x28')],_0x453e45[_0x4578('0x29')]);_0x1b58f6[_0x4578('0x2b')]=_['intersection'](_0x453e45['model'],qs[_0x4578('0x2c')](_0x3c6053['query'][_0x4578('0x2c')]));_0x1b58f6[_0x4578('0x2b')]=_0x1b58f6[_0x4578('0x2b')][_0x4578('0x2d')]?_0x1b58f6[_0x4578('0x2b')]:_0x453e45['model'];if(!_0x3c6053[_0x4578('0x29')]['hasOwnProperty']('nolimit')){_0x1b58f6[_0x4578('0x1b')]=qs[_0x4578('0x1b')](_0x3c6053[_0x4578('0x29')][_0x4578('0x1b')]);_0x1b58f6['offset']=qs['offset'](_0x3c6053['query'][_0x4578('0x1a')]);}_0x1b58f6['order']=qs[_0x4578('0x2e')](_0x3c6053[_0x4578('0x29')][_0x4578('0x2e')]);_0x1b58f6[_0x4578('0x2f')]=qs['filters'](_['pick'](_0x3c6053[_0x4578('0x29')],_0x453e45['filters']));if(_0x3c6053['query'][_0x4578('0x30')]){_0x1b58f6[_0x4578('0x2f')]=_[_0x4578('0x31')](_0x1b58f6[_0x4578('0x2f')],{'$or':_[_0x4578('0x32')](_0x45b4e1,function(_0x4a3f20){if(_0x4a3f20[_0x4578('0x33')][_0x4578('0x34')]!=='VIRTUAL'){var _0x2182a9={};_0x2182a9[_0x4a3f20[_0x4578('0x35')]]={'$like':'%'+_0x3c6053['query'][_0x4578('0x30')]+'%'};return _0x2182a9;}})});}_0x1b58f6=_['merge']({},_0x1b58f6,_0x3c6053[_0x4578('0x36')]);var _0x541989={'where':_0x1b58f6[_0x4578('0x2f')]};return db['CmHopperFinal'][_0x4578('0x19')](_0x541989)[_0x4578('0x37')](function(_0x14c172){_0x6dcc70[_0x4578('0x19')]=_0x14c172;if(_0x3c6053[_0x4578('0x29')][_0x4578('0x38')]){_0x1b58f6['include']=[{'all':!![]}];}return db[_0x4578('0x26')][_0x4578('0x39')](_0x1b58f6);})['then'](function(_0x35c318){_0x6dcc70['rows']=_0x35c318;return _0x6dcc70;})[_0x4578('0x37')](respondWithFilteredResult(_0x192811,_0x1b58f6))['catch'](handleError(_0x192811,null));};exports[_0x4578('0x3a')]=function(_0x558548,_0x4b799e){var _0xf43e48={'raw':!![],'where':{'id':_0x558548[_0x4578('0x3b')]['id']}},_0x503c7e={};_0x503c7e[_0x4578('0x28')]=_[_0x4578('0x3c')](db[_0x4578('0x26')][_0x4578('0x27')]);_0x503c7e[_0x4578('0x29')]=_[_0x4578('0x3c')](_0x558548['query']);_0x503c7e[_0x4578('0x2a')]=_[_0x4578('0x3d')](_0x503c7e[_0x4578('0x28')],_0x503c7e[_0x4578('0x29')]);_0xf43e48[_0x4578('0x2b')]=_['intersection'](_0x503c7e[_0x4578('0x28')],qs[_0x4578('0x2c')](_0x558548['query'][_0x4578('0x2c')]));_0xf43e48[_0x4578('0x2b')]=_0xf43e48[_0x4578('0x2b')]['length']?_0xf43e48[_0x4578('0x2b')]:_0x503c7e['model'];if(_0x558548[_0x4578('0x29')]['includeAll']){_0xf43e48['include']=[{'all':!![]}];}_0xf43e48=_['merge']({},_0xf43e48,_0x558548[_0x4578('0x36')]);return db['CmHopperFinal'][_0x4578('0x3e')](_0xf43e48)[_0x4578('0x37')](handleEntityNotFound(_0x4b799e,null))[_0x4578('0x37')](respondWithResult(_0x4b799e,null))[_0x4578('0x3f')](handleError(_0x4b799e,null));};exports['describe']=function(_0x1265a4,_0x26e111){return db[_0x4578('0x26')]['describe']()[_0x4578('0x37')](respondWithResult(_0x26e111,null))[_0x4578('0x3f')](handleError(_0x26e111,null));};exports[_0x4578('0x40')]=function(_0x327b0e,_0x5b7a7b){if(_0x327b0e['body']['uniqueid']){delete _0x327b0e['body'][_0x4578('0x41')];}return db[_0x4578('0x26')][_0x4578('0x3e')]({'where':{'uniqueid':_0x327b0e[_0x4578('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5b7a7b,null))[_0x4578('0x37')](saveUpdates(_0x327b0e[_0x4578('0x42')],null))[_0x4578('0x37')](respondWithResult(_0x5b7a7b,null))[_0x4578('0x3f')](handleError(_0x5b7a7b,null));};exports[_0x4578('0x43')]=function(_0x11bc40,_0x59ede1,_0x415c0d){return db[_0x4578('0x26')][_0x4578('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x11bc40[_0x4578('0x3b')]['id']},'attributes':[[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x47')))),_0x4578('0x48')],[db['sequelize']['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db['sequelize'][_0x4578('0x46')](_0x4578('0x49')))),_0x4578('0x4a')],[db['sequelize']['fn'](_0x4578('0x45'),db['sequelize']['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x4b')))),_0x4578('0x4c')],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x4d')))),'congestionContacts'],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x4e')))),_0x4578('0x4f')],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x50')))),_0x4578('0x51')],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x52')))),_0x4578('0x53')],[db['sequelize']['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')]['literal'](_0x4578('0x54')))),_0x4578('0x55')]]})['then'](handleEntityNotFound(_0x59ede1,null))[_0x4578('0x37')](respondWithResult(_0x59ede1,null))[_0x4578('0x3f')](handleError(_0x59ede1,null));};exports[_0x4578('0x56')]=function(_0x2102e7,_0x5d72d3,_0x3b72cd){return db['CmHopperFinal'][_0x4578('0x39')]({'raw':![],'where':{'CampaignId':_0x2102e7['params']['id']},'attributes':[[db[_0x4578('0x44')]['fn']('COUNT',db[_0x4578('0x44')]['fn']('IF',db['sequelize'][_0x4578('0x46')](_0x4578('0x47')))),'noSuchContacts'],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x49')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4578('0x4c')],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db[_0x4578('0x44')]['fn']('IF',db[_0x4578('0x44')]['literal'](_0x4578('0x4d')))),'congestionContacts'],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db['sequelize']['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x4e')))),_0x4578('0x4f')],[db[_0x4578('0x44')]['fn']('COUNT',db[_0x4578('0x44')]['fn']('IF',db['sequelize']['literal'](_0x4578('0x50')))),'abandonedContacts'],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db['sequelize']['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x52')))),_0x4578('0x53')],[db[_0x4578('0x44')]['fn'](_0x4578('0x45'),db['sequelize']['fn']('IF',db[_0x4578('0x44')][_0x4578('0x46')](_0x4578('0x54')))),_0x4578('0x55')]]})[_0x4578('0x37')](handleEntityNotFound(_0x5d72d3,null))['then'](respondWithResult(_0x5d72d3,null))[_0x4578('0x3f')](handleError(_0x5d72d3,null));};exports[_0x4578('0x57')]=function(_0x11b435,_0x3b5cad,_0xf895b3){return db['VoiceQueue'][_0x4578('0x3e')]({'where':{'id':_0x11b435[_0x4578('0x3b')]['id']}})[_0x4578('0x37')](handleEntityNotFound(_0x3b5cad,null))['then'](function(_0x427c62){var _0x279185;if(_0x427c62){_0x279185=squel[_0x4578('0x58')]()[_0x4578('0x59')]('cm_hopper')[_0x4578('0x5a')]([_0x4578('0x5b'),_0x4578('0x5c'),_0x4578('0x5d'),'ListId',_0x4578('0x5e'),_0x4578('0x5f'),_0x4578('0x60')],squel['select']()['field'](_0x4578('0x61'),_0x4578('0x5b'))[_0x4578('0x35')]('NOW()','scheduledAt')['field']('ANY_VALUE(ContactId)',_0x4578('0x5d'))[_0x4578('0x35')](_0x4578('0x62'),_0x4578('0x63'))[_0x4578('0x35')](_0x4578('0x64'),_0x4578('0x5e'))[_0x4578('0x35')](_0x4578('0x65'),_0x4578('0x5f'))[_0x4578('0x35')](_0x4578('0x65'),_0x4578('0x60'))['from'](_0x4578('0x66'))[_0x4578('0x2f')](_0x4578('0x67'),_0x11b435['params']['id']['toString']())['where'](_0x4578('0x68'),_0x11b435[_0x4578('0x42')][_0x4578('0x69')][_0x4578('0x6a')]())[_0x4578('0x2f')](_0x4578('0x6b'))[_0x4578('0x2f')](_0x4578('0x6c'),squel[_0x4578('0x6d')]()['field']('phone')['from']('cm_hopper')[_0x4578('0x2f')]('VoiceQueueId\x20=\x20?',_0x11b435[_0x4578('0x3b')]['id'][_0x4578('0x6a')]()))[_0x4578('0x2f')](_0x4578('0x6c'),squel[_0x4578('0x6d')]()['field'](_0x4578('0x6e'))[_0x4578('0x6f')](_0x4578('0x66'))[_0x4578('0x2f')]('VoiceQueueId\x20=\x20?',_0x11b435[_0x4578('0x3b')]['id'][_0x4578('0x6a')]())[_0x4578('0x2f')]('state\x20=\x204'))['group'](_0x4578('0x5d')))[_0x4578('0x6a')]();return db[_0x4578('0x44')][_0x4578('0x29')](_0x279185);}return[];})[_0x4578('0x37')](respondWithResult(_0x3b5cad,null))[_0x4578('0x3f')](handleError(_0x3b5cad,null));};exports[_0x4578('0x70')]=function(_0x1f0b2d,_0x24b041,_0x4e9146){return db['Campaign'][_0x4578('0x3e')]({'where':{'id':_0x1f0b2d['params']['id']}})[_0x4578('0x37')](handleEntityNotFound(_0x24b041,null))[_0x4578('0x37')](function(_0x3d9111){var _0x1e7031;if(_0x3d9111){_0x1e7031=squel[_0x4578('0x58')]()['into'](_0x4578('0x71'))[_0x4578('0x5a')]([_0x4578('0x5b'),'scheduledAt','ContactId',_0x4578('0x63'),'CampaignId',_0x4578('0x5f'),'updatedAt'],squel[_0x4578('0x6d')]()['field'](_0x4578('0x61'),_0x4578('0x5b'))[_0x4578('0x35')](_0x4578('0x65'),'scheduledAt')[_0x4578('0x35')]('ANY_VALUE(ContactId)',_0x4578('0x5d'))[_0x4578('0x35')]('ANY_VALUE(ListId)',_0x4578('0x63'))[_0x4578('0x35')](_0x4578('0x72'),'CampaignId')[_0x4578('0x35')](_0x4578('0x65'),_0x4578('0x5f'))[_0x4578('0x35')](_0x4578('0x65'),_0x4578('0x60'))[_0x4578('0x6f')]('cm_hopper_final')['where'](_0x4578('0x73'),_0x1f0b2d[_0x4578('0x3b')]['id']['toString']())[_0x4578('0x2f')](_0x4578('0x68'),_0x1f0b2d[_0x4578('0x42')][_0x4578('0x69')][_0x4578('0x6a')]())[_0x4578('0x2f')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x4578('0x2f')](_0x4578('0x6c'),squel[_0x4578('0x6d')]()[_0x4578('0x35')](_0x4578('0x5b'))[_0x4578('0x6f')](_0x4578('0x71'))[_0x4578('0x2f')](_0x4578('0x73'),_0x1f0b2d[_0x4578('0x3b')]['id'][_0x4578('0x6a')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4578('0x6d')]()[_0x4578('0x35')](_0x4578('0x6e'))[_0x4578('0x6f')]('cm_hopper_final')[_0x4578('0x2f')](_0x4578('0x73'),_0x1f0b2d[_0x4578('0x3b')]['id'][_0x4578('0x6a')]())['where']('state\x20=\x204'))['group'](_0x4578('0x5d')))[_0x4578('0x6a')]();return db[_0x4578('0x44')][_0x4578('0x29')](_0x1e7031);}return[];})[_0x4578('0x37')](respondWithResult(_0x24b041,null))['catch'](handleError(_0x24b041,null));};exports[_0x4578('0x74')]=function(_0x56851c,_0x11e684,_0xbcdc04){return db[_0x4578('0x75')][_0x4578('0x76')]({'where':{'VoiceQueueId':_0x56851c[_0x4578('0x42')]['VoiceQueueId'],'CampaignId':_0x56851c[_0x4578('0x42')][_0x4578('0x77')],'ContactId':_0x56851c[_0x4578('0x42')][_0x4578('0x5d')]}})[_0x4578('0x37')](handleEntityNotFound(_0x11e684,null))[_0x4578('0x37')](function(_0x56869b){if(_0x56869b){return _0x56869b;}return null;})[_0x4578('0x37')](respondWithResult(_0x11e684,null))[_0x4578('0x3f')](handleError(_0x11e684,null));}; \ No newline at end of file +var _0xe583=['model','attributes','length','hasOwnProperty','nolimit','order','filter','where','merge','type','key','VIRTUAL','field','options','CmHopperFinal','includeAll','include','findAll','show','params','fields','find','catch','describe','uniqueid','body','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','group','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','cm_hopper','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','update','then','destroy','sendStatus','error','name','send','rawAttributes','keys','query','filters','intersection'];(function(_0x272f3d,_0x3f75fe){var _0x2032e4=function(_0x3e9a59){while(--_0x3e9a59){_0x272f3d['push'](_0x272f3d['shift']());}};_0x2032e4(++_0x3f75fe);}(_0xe583,0x148));var _0x3e58=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xe583[_0x209941];return _0x1e8729;};'use strict';var pdf=require(_0x3e58('0x0'));var emlformat=require(_0x3e58('0x1'));var rimraf=require(_0x3e58('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e58('0x3'));var rp=require(_0x3e58('0x4'));var moment=require(_0x3e58('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3e58('0x6'));var path=require('path');var sox=require(_0x3e58('0x7'));var csv=require(_0x3e58('0x8'));var ejs=require(_0x3e58('0x9'));var fs=require('fs');var _=require(_0x3e58('0xa'));var squel=require(_0x3e58('0xb'));var crypto=require('crypto');var jsforce=require(_0x3e58('0xc'));var deskjs=require(_0x3e58('0xd'));var toCsv=require(_0x3e58('0x8'));var querystring=require('querystring');var Papa=require(_0x3e58('0xe'));var Redis=require('ioredis');var authService=require(_0x3e58('0xf'));var qs=require(_0x3e58('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3e58('0x11'));var utils=require(_0x3e58('0x12'));var config=require('../../config/environment');var db=require(_0x3e58('0x13'))['db'];function respondWithStatusCode(_0x3d63ff,_0x244ae6){_0x244ae6=_0x244ae6||0xcc;return function(_0x23d310){if(_0x23d310){return _0x3d63ff['sendStatus'](_0x244ae6);}return _0x3d63ff[_0x3e58('0x14')](_0x244ae6)[_0x3e58('0x15')]();};}function respondWithResult(_0x5efea3,_0x3ab61c){_0x3ab61c=_0x3ab61c||0xc8;return function(_0x2a9a2b){if(_0x2a9a2b){return _0x5efea3[_0x3e58('0x14')](_0x3ab61c)['json'](_0x2a9a2b);}};}function respondWithFilteredResult(_0xc628af,_0x3ad17b){return function(_0x1935a7){if(_0x1935a7){var _0x37fb26=_0x1935a7[_0x3e58('0x16')],_0x125805=_0x3ad17b['offset'],_0x3079c2=_0x3ad17b[_0x3e58('0x17')]+_0x3ad17b[_0x3e58('0x18')],_0x12aaeb;if(_0x3079c2>=_0x37fb26){_0x3079c2=_0x37fb26;_0x12aaeb=0xc8;}else{_0x12aaeb=0xce;}_0xc628af['status'](_0x12aaeb);return _0xc628af[_0x3e58('0x19')]('Content-Range',_0x125805+'-'+_0x3079c2+'/'+_0x37fb26)[_0x3e58('0x1a')](_0x1935a7);}return null;};}function patchUpdates(_0x45898c){return function(_0x4295e5){try{jsonpatch[_0x3e58('0x1b')](_0x4295e5,_0x45898c,!![]);}catch(_0x172660){return BPromise[_0x3e58('0x1c')](_0x172660);}return _0x4295e5['save']();};}function saveUpdates(_0x3e572c,_0x3570c5){return function(_0x1bd647){if(_0x1bd647){return _0x1bd647[_0x3e58('0x1d')](_0x3e572c)[_0x3e58('0x1e')](function(_0x8488b8){return _0x8488b8;});}return null;};}function removeEntity(_0x7428c,_0x32bbd8){return function(_0x5d4604){if(_0x5d4604){return _0x5d4604[_0x3e58('0x1f')]()[_0x3e58('0x1e')](function(){_0x7428c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44d296,_0xc00f7d){return function(_0x37cf87){if(!_0x37cf87){_0x44d296[_0x3e58('0x20')](0x194);}return _0x37cf87;};}function handleError(_0x53091a,_0x5e719a){_0x5e719a=_0x5e719a||0x1f4;return function(_0x5a245a){logger[_0x3e58('0x21')](_0x5a245a['stack']);if(_0x5a245a['name']){delete _0x5a245a[_0x3e58('0x22')];}_0x53091a[_0x3e58('0x14')](_0x5e719a)[_0x3e58('0x23')](_0x5a245a);};}exports['index']=function(_0x987e0b,_0xb92597){var _0x267d73={},_0x168aa0={},_0x4b85e3={'count':0x0,'rows':[]};var _0x36507c=db['CmHopperFinal'][_0x3e58('0x24')];_0x168aa0['model']=_[_0x3e58('0x25')](_0x36507c);_0x168aa0[_0x3e58('0x26')]=_[_0x3e58('0x25')](_0x987e0b['query']);_0x168aa0[_0x3e58('0x27')]=_[_0x3e58('0x28')](_0x168aa0[_0x3e58('0x29')],_0x168aa0[_0x3e58('0x26')]);_0x267d73[_0x3e58('0x2a')]=_[_0x3e58('0x28')](_0x168aa0[_0x3e58('0x29')],qs['fields'](_0x987e0b[_0x3e58('0x26')]['fields']));_0x267d73[_0x3e58('0x2a')]=_0x267d73[_0x3e58('0x2a')][_0x3e58('0x2b')]?_0x267d73[_0x3e58('0x2a')]:_0x168aa0[_0x3e58('0x29')];if(!_0x987e0b[_0x3e58('0x26')][_0x3e58('0x2c')](_0x3e58('0x2d'))){_0x267d73[_0x3e58('0x18')]=qs[_0x3e58('0x18')](_0x987e0b[_0x3e58('0x26')][_0x3e58('0x18')]);_0x267d73[_0x3e58('0x17')]=qs['offset'](_0x987e0b[_0x3e58('0x26')][_0x3e58('0x17')]);}_0x267d73[_0x3e58('0x2e')]=qs['sort'](_0x987e0b[_0x3e58('0x26')]['sort']);_0x267d73['where']=qs[_0x3e58('0x27')](_['pick'](_0x987e0b['query'],_0x168aa0[_0x3e58('0x27')]));if(_0x987e0b['query'][_0x3e58('0x2f')]){_0x267d73[_0x3e58('0x30')]=_[_0x3e58('0x31')](_0x267d73[_0x3e58('0x30')],{'$or':_['map'](_0x36507c,function(_0x1c7c3c){if(_0x1c7c3c[_0x3e58('0x32')][_0x3e58('0x33')]!==_0x3e58('0x34')){var _0x5708e3={};_0x5708e3[_0x1c7c3c[_0x3e58('0x35')]]={'$like':'%'+_0x987e0b[_0x3e58('0x26')][_0x3e58('0x2f')]+'%'};return _0x5708e3;}})});}_0x267d73=_[_0x3e58('0x31')]({},_0x267d73,_0x987e0b[_0x3e58('0x36')]);var _0x80725c={'where':_0x267d73[_0x3e58('0x30')]};return db[_0x3e58('0x37')][_0x3e58('0x16')](_0x80725c)[_0x3e58('0x1e')](function(_0x4bc317){_0x4b85e3['count']=_0x4bc317;if(_0x987e0b[_0x3e58('0x26')][_0x3e58('0x38')]){_0x267d73[_0x3e58('0x39')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3e58('0x3a')](_0x267d73);})[_0x3e58('0x1e')](function(_0x11c6de){_0x4b85e3['rows']=_0x11c6de;return _0x4b85e3;})['then'](respondWithFilteredResult(_0xb92597,_0x267d73))['catch'](handleError(_0xb92597,null));};exports[_0x3e58('0x3b')]=function(_0x601420,_0x5650ee){var _0x248bba={'raw':!![],'where':{'id':_0x601420[_0x3e58('0x3c')]['id']}},_0x374ef9={};_0x374ef9[_0x3e58('0x29')]=_[_0x3e58('0x25')](db[_0x3e58('0x37')][_0x3e58('0x24')]);_0x374ef9['query']=_['keys'](_0x601420[_0x3e58('0x26')]);_0x374ef9[_0x3e58('0x27')]=_[_0x3e58('0x28')](_0x374ef9['model'],_0x374ef9[_0x3e58('0x26')]);_0x248bba[_0x3e58('0x2a')]=_[_0x3e58('0x28')](_0x374ef9[_0x3e58('0x29')],qs[_0x3e58('0x3d')](_0x601420['query'][_0x3e58('0x3d')]));_0x248bba[_0x3e58('0x2a')]=_0x248bba[_0x3e58('0x2a')]['length']?_0x248bba[_0x3e58('0x2a')]:_0x374ef9[_0x3e58('0x29')];if(_0x601420[_0x3e58('0x26')][_0x3e58('0x38')]){_0x248bba[_0x3e58('0x39')]=[{'all':!![]}];}_0x248bba=_[_0x3e58('0x31')]({},_0x248bba,_0x601420[_0x3e58('0x36')]);return db['CmHopperFinal'][_0x3e58('0x3e')](_0x248bba)[_0x3e58('0x1e')](handleEntityNotFound(_0x5650ee,null))['then'](respondWithResult(_0x5650ee,null))[_0x3e58('0x3f')](handleError(_0x5650ee,null));};exports['describe']=function(_0x246b55,_0x2bc604){return db[_0x3e58('0x37')][_0x3e58('0x40')]()[_0x3e58('0x1e')](respondWithResult(_0x2bc604,null))[_0x3e58('0x3f')](handleError(_0x2bc604,null));};exports[_0x3e58('0x1d')]=function(_0x4fd416,_0x59906c){if(_0x4fd416['body'][_0x3e58('0x41')]){delete _0x4fd416[_0x3e58('0x42')][_0x3e58('0x41')];}return db[_0x3e58('0x37')][_0x3e58('0x3e')]({'where':{'uniqueid':_0x4fd416[_0x3e58('0x3c')]['id']}})['then'](handleEntityNotFound(_0x59906c,null))[_0x3e58('0x1e')](saveUpdates(_0x4fd416[_0x3e58('0x42')],null))[_0x3e58('0x1e')](respondWithResult(_0x59906c,null))[_0x3e58('0x3f')](handleError(_0x59906c,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x416de7,_0x747ccf,_0x21b7f1){return db[_0x3e58('0x37')][_0x3e58('0x3a')]({'raw':![],'where':{'VoiceQueueId':_0x416de7['params']['id']},'attributes':[[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db['sequelize'][_0x3e58('0x45')](_0x3e58('0x46')))),_0x3e58('0x47')],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db['sequelize']['fn']('IF',db[_0x3e58('0x43')][_0x3e58('0x45')](_0x3e58('0x48')))),_0x3e58('0x49')],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')][_0x3e58('0x45')](_0x3e58('0x4a')))),_0x3e58('0x4b')],[db[_0x3e58('0x43')]['fn']('COUNT',db[_0x3e58('0x43')]['fn']('IF',db['sequelize'][_0x3e58('0x45')](_0x3e58('0x4c')))),'congestionContacts'],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db['sequelize'][_0x3e58('0x45')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3e58('0x4d')],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')][_0x3e58('0x45')](_0x3e58('0x4e')))),_0x3e58('0x4f')],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')][_0x3e58('0x45')](_0x3e58('0x50')))),_0x3e58('0x51')],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db['sequelize']['fn']('IF',db[_0x3e58('0x43')]['literal'](_0x3e58('0x52')))),_0x3e58('0x53')]]})[_0x3e58('0x1e')](handleEntityNotFound(_0x747ccf,null))[_0x3e58('0x1e')](respondWithResult(_0x747ccf,null))[_0x3e58('0x3f')](handleError(_0x747ccf,null));};exports[_0x3e58('0x54')]=function(_0x12572b,_0xa85efb,_0x3f970a){return db[_0x3e58('0x37')]['findAll']({'raw':![],'where':{'CampaignId':_0x12572b[_0x3e58('0x3c')]['id']},'attributes':[[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')]['literal'](_0x3e58('0x46')))),_0x3e58('0x47')],[db['sequelize']['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')][_0x3e58('0x45')](_0x3e58('0x48')))),_0x3e58('0x49')],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')][_0x3e58('0x45')](_0x3e58('0x4a')))),_0x3e58('0x4b')],[db[_0x3e58('0x43')]['fn']('COUNT',db[_0x3e58('0x43')]['fn']('IF',db['sequelize'][_0x3e58('0x45')](_0x3e58('0x4c')))),'congestionContacts'],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0x3e58('0x45')](_0x3e58('0x55')))),_0x3e58('0x4d')],[db[_0x3e58('0x43')]['fn'](_0x3e58('0x44'),db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x3e58('0x43')]['fn']('COUNT',db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x3e58('0x51')],[db[_0x3e58('0x43')]['fn']('COUNT',db[_0x3e58('0x43')]['fn']('IF',db[_0x3e58('0x43')]['literal'](_0x3e58('0x52')))),'answeringMachine']]})[_0x3e58('0x1e')](handleEntityNotFound(_0xa85efb,null))[_0x3e58('0x1e')](respondWithResult(_0xa85efb,null))[_0x3e58('0x3f')](handleError(_0xa85efb,null));};exports[_0x3e58('0x56')]=function(_0x50a009,_0x4aea7f,_0x17ea03){return db[_0x3e58('0x57')]['find']({'where':{'id':_0x50a009[_0x3e58('0x3c')]['id']}})[_0x3e58('0x1e')](handleEntityNotFound(_0x4aea7f,null))['then'](function(_0x2fa00e){var _0x2b55b7;if(_0x2fa00e){_0x2b55b7=squel[_0x3e58('0x58')]()[_0x3e58('0x59')]('cm_hopper')[_0x3e58('0x5a')]([_0x3e58('0x5b'),_0x3e58('0x5c'),_0x3e58('0x5d'),_0x3e58('0x5e'),_0x3e58('0x5f'),'createdAt',_0x3e58('0x60')],squel['select']()['field']('ANY_VALUE(calleridnum)',_0x3e58('0x5b'))[_0x3e58('0x35')](_0x3e58('0x61'),_0x3e58('0x5c'))[_0x3e58('0x35')]('ANY_VALUE(ContactId)','ContactId')[_0x3e58('0x35')](_0x3e58('0x62'),_0x3e58('0x5e'))['field'](_0x3e58('0x63'),_0x3e58('0x5f'))[_0x3e58('0x35')](_0x3e58('0x61'),_0x3e58('0x64'))[_0x3e58('0x35')](_0x3e58('0x61'),_0x3e58('0x60'))[_0x3e58('0x65')](_0x3e58('0x66'))['where'](_0x3e58('0x67'),_0x50a009[_0x3e58('0x3c')]['id'][_0x3e58('0x68')]())[_0x3e58('0x30')](_0x3e58('0x69'),_0x50a009[_0x3e58('0x42')][_0x3e58('0x6a')][_0x3e58('0x68')]())['where'](_0x3e58('0x6b'))['where'](_0x3e58('0x6c'),squel[_0x3e58('0x6d')]()[_0x3e58('0x35')](_0x3e58('0x5b'))[_0x3e58('0x65')]('cm_hopper')[_0x3e58('0x30')](_0x3e58('0x67'),_0x50a009[_0x3e58('0x3c')]['id']['toString']()))['where'](_0x3e58('0x6c'),squel[_0x3e58('0x6d')]()[_0x3e58('0x35')](_0x3e58('0x6e'))[_0x3e58('0x65')]('cm_hopper_final')[_0x3e58('0x30')](_0x3e58('0x67'),_0x50a009[_0x3e58('0x3c')]['id'][_0x3e58('0x68')]())[_0x3e58('0x30')](_0x3e58('0x6f')))[_0x3e58('0x70')](_0x3e58('0x5d')))[_0x3e58('0x68')]();return db[_0x3e58('0x43')]['query'](_0x2b55b7);}return[];})[_0x3e58('0x1e')](respondWithResult(_0x4aea7f,null))[_0x3e58('0x3f')](handleError(_0x4aea7f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5e84c2,_0x31c9f2,_0x126c29){return db[_0x3e58('0x71')]['find']({'where':{'id':_0x5e84c2['params']['id']}})[_0x3e58('0x1e')](handleEntityNotFound(_0x31c9f2,null))[_0x3e58('0x1e')](function(_0x17524f){var _0x52ae93;if(_0x17524f){_0x52ae93=squel['insert']()[_0x3e58('0x59')]('cm_hopper')[_0x3e58('0x5a')]([_0x3e58('0x5b'),_0x3e58('0x5c'),_0x3e58('0x5d'),_0x3e58('0x5e'),_0x3e58('0x72'),'createdAt',_0x3e58('0x60')],squel[_0x3e58('0x6d')]()[_0x3e58('0x35')](_0x3e58('0x73'),_0x3e58('0x5b'))[_0x3e58('0x35')]('NOW()',_0x3e58('0x5c'))[_0x3e58('0x35')](_0x3e58('0x74'),_0x3e58('0x5d'))[_0x3e58('0x35')]('ANY_VALUE(ListId)','ListId')['field'](_0x3e58('0x75'),'CampaignId')['field'](_0x3e58('0x61'),_0x3e58('0x64'))[_0x3e58('0x35')](_0x3e58('0x61'),'updatedAt')[_0x3e58('0x65')](_0x3e58('0x66'))['where']('CampaignId\x20=\x20?',_0x5e84c2['params']['id'][_0x3e58('0x68')]())[_0x3e58('0x30')](_0x3e58('0x69'),_0x5e84c2[_0x3e58('0x42')][_0x3e58('0x6a')][_0x3e58('0x68')]())[_0x3e58('0x30')](_0x3e58('0x6b'))[_0x3e58('0x30')](_0x3e58('0x6c'),squel['select']()[_0x3e58('0x35')]('phone')[_0x3e58('0x65')](_0x3e58('0x76'))[_0x3e58('0x30')](_0x3e58('0x77'),_0x5e84c2['params']['id'][_0x3e58('0x68')]()))[_0x3e58('0x30')](_0x3e58('0x6c'),squel[_0x3e58('0x6d')]()[_0x3e58('0x35')](_0x3e58('0x6e'))[_0x3e58('0x65')](_0x3e58('0x66'))[_0x3e58('0x30')](_0x3e58('0x77'),_0x5e84c2[_0x3e58('0x3c')]['id'][_0x3e58('0x68')]())[_0x3e58('0x30')](_0x3e58('0x6f')))[_0x3e58('0x70')](_0x3e58('0x5d')))[_0x3e58('0x68')]();return db[_0x3e58('0x43')]['query'](_0x52ae93);}return[];})['then'](respondWithResult(_0x31c9f2,null))[_0x3e58('0x3f')](handleError(_0x31c9f2,null));};exports[_0x3e58('0x78')]=function(_0x540123,_0x1cc9db,_0x4ee4d3){return db[_0x3e58('0x79')][_0x3e58('0x7a')]({'where':{'VoiceQueueId':_0x540123[_0x3e58('0x42')][_0x3e58('0x5f')],'CampaignId':_0x540123[_0x3e58('0x42')][_0x3e58('0x72')],'ContactId':_0x540123['body'][_0x3e58('0x5d')]}})[_0x3e58('0x1e')](handleEntityNotFound(_0x1cc9db,null))[_0x3e58('0x1e')](function(_0x55e1c0){if(_0x55e1c0){return _0x55e1c0;}return null;})[_0x3e58('0x1e')](respondWithResult(_0x1cc9db,null))[_0x3e58('0x3f')](handleError(_0x1cc9db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index cf2ac9f..6cf1be8 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 _0x0429=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','uniqueid','lodash'];(function(_0x4736ea,_0x14e2b3){var _0x109270=function(_0x28ee98){while(--_0x28ee98){_0x4736ea['push'](_0x4736ea['shift']());}};_0x109270(++_0x14e2b3);}(_0x0429,0x6b));var _0x9042=function(_0x13688d,_0x1fc03f){_0x13688d=_0x13688d-0x0;var _0x2885e6=_0x0429[_0x13688d];return _0x2885e6;};'use strict';var _=require(_0x9042('0x0'));var util=require('util');var logger=require(_0x9042('0x1'))(_0x9042('0x2'));var moment=require(_0x9042('0x3'));var BPromise=require(_0x9042('0x4'));var rp=require(_0x9042('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9042('0x6'));var attributes=require(_0x9042('0x7'));module[_0x9042('0x8')]=function(_0xc119cf,_0xb52e5a){return _0xc119cf['define'](_0x9042('0x9'),attributes,{'tableName':_0x9042('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x9042('0xb'),'fields':[_0x9042('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6728=['path','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final','uniqueid','lodash','api','moment','request-promise'];(function(_0x2bf5bd,_0x120787){var _0xc810c0=function(_0xba9dd3){while(--_0xba9dd3){_0x2bf5bd['push'](_0x2bf5bd['shift']());}};_0xc810c0(++_0x120787);}(_0x6728,0x146));var _0x8672=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x6728[_0x49a57c];return _0x4e0316;};'use strict';var _=require(_0x8672('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8672('0x1'));var moment=require(_0x8672('0x2'));var BPromise=require('bluebird');var rp=require(_0x8672('0x3'));var fs=require('fs');var path=require(_0x8672('0x4'));var rimraf=require(_0x8672('0x5'));var config=require(_0x8672('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x8672('0x7')]=function(_0x3a5843,_0x5c440a){return _0x3a5843['define'](_0x8672('0x8'),attributes,{'tableName':_0x8672('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x8672('0xa'),'fields':[_0x8672('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index aa7b3c9..3f5fc9d 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 _0xf849=['options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0xf849,0x193));var _0x9f84=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xf849[_0x4409e7];return _0x24c751;};'use strict';var _=require(_0x9f84('0x0'));var util=require(_0x9f84('0x1'));var moment=require(_0x9f84('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f84('0x3'));var fs=require('fs');var Redis=require(_0x9f84('0x4'));var db=require(_0x9f84('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9f84('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9f84('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x598edf,_0x5643c9,_0x11eea9){return new BPromise(function(_0x583aca,_0xf06203){return client[_0x9f84('0x8')](_0x598edf,_0x11eea9)[_0x9f84('0x9')](function(_0x2110e3){logger[_0x9f84('0xa')](_0x9f84('0xb'),_0x5643c9,_0x9f84('0xc'));logger[_0x9f84('0xd')](_0x9f84('0xe'),_0x5643c9,_0x9f84('0xc'),JSON[_0x9f84('0xf')](_0x2110e3));if(_0x2110e3[_0x9f84('0x10')]){if(_0x2110e3[_0x9f84('0x10')][_0x9f84('0x11')]===0x1f4){logger[_0x9f84('0x10')](_0x9f84('0xb'),_0x5643c9,_0x2110e3['error'][_0x9f84('0x12')]);return _0xf06203(_0x2110e3[_0x9f84('0x10')][_0x9f84('0x12')]);}logger[_0x9f84('0x10')](_0x9f84('0xb'),_0x5643c9,_0x2110e3['error'][_0x9f84('0x12')]);return _0x583aca(_0x2110e3[_0x9f84('0x10')]['message']);}else{logger['info'](_0x9f84('0xb'),_0x5643c9,_0x9f84('0xc'));_0x583aca(_0x2110e3[_0x9f84('0x13')][_0x9f84('0x12')]);}})[_0x9f84('0x14')](function(_0x5b8cb6){logger[_0x9f84('0x10')](_0x9f84('0xb'),_0x5643c9,_0x5b8cb6);_0xf06203(_0x5b8cb6);});});}exports['CreateCmHopperFinal']=function(_0x55c325){var _0x31f422=this;return new Promise(function(_0x48ffc4,_0x3c2c01){return db['CmHopperFinal']['create'](_0x55c325[_0x9f84('0x15')],{'raw':_0x55c325[_0x9f84('0x16')]?_0x55c325[_0x9f84('0x16')][_0x9f84('0x17')]===undefined?!![]:![]:!![]})[_0x9f84('0x9')](function(_0x5ab9a3){logger[_0x9f84('0xa')]('CreateCmHopperFinal',_0x55c325);logger[_0x9f84('0xd')](_0x9f84('0x18'),_0x55c325,JSON[_0x9f84('0xf')](_0x5ab9a3));_0x48ffc4(_0x5ab9a3);})[_0x9f84('0x14')](function(_0xb1f4c8){logger['error'](_0x9f84('0x18'),_0xb1f4c8['message'],_0x55c325);_0x3c2c01(_0x31f422[_0x9f84('0x10')](0x1f4,_0xb1f4c8[_0x9f84('0x12')]));});});}; \ No newline at end of file +var _0xb8ba=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateCmHopperFinal','create','body','options','then','catch','lodash','util','moment'];(function(_0x58dc86,_0x361cef){var _0xe1857f=function(_0x23b1ac){while(--_0x23b1ac){_0x58dc86['push'](_0x58dc86['shift']());}};_0xe1857f(++_0x361cef);}(_0xb8ba,0x6d));var _0xab8b=function(_0x45b635,_0x14c711){_0x45b635=_0x45b635-0x0;var _0x408e43=_0xb8ba[_0x45b635];return _0x408e43;};'use strict';var _=require(_0xab8b('0x0'));var util=require(_0xab8b('0x1'));var moment=require(_0xab8b('0x2'));var BPromise=require('bluebird');var rs=require(_0xab8b('0x3'));var fs=require('fs');var Redis=require(_0xab8b('0x4'));var db=require(_0xab8b('0x5'))['db'];var utils=require(_0xab8b('0x6'));var logger=require(_0xab8b('0x7'))(_0xab8b('0x8'));var config=require(_0xab8b('0x9'));var jayson=require(_0xab8b('0xa'));var client=jayson['client'][_0xab8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5300bf,_0x1121e2,_0x57f8ba){return new BPromise(function(_0x233bfd,_0xb1ec1e){return client[_0xab8b('0xc')](_0x5300bf,_0x57f8ba)['then'](function(_0x5215cd){logger[_0xab8b('0xd')](_0xab8b('0xe'),_0x1121e2,_0xab8b('0xf'));logger[_0xab8b('0x10')](_0xab8b('0x11'),_0x1121e2,_0xab8b('0xf'),JSON[_0xab8b('0x12')](_0x5215cd));if(_0x5215cd[_0xab8b('0x13')]){if(_0x5215cd[_0xab8b('0x13')][_0xab8b('0x14')]===0x1f4){logger[_0xab8b('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x1121e2,_0x5215cd[_0xab8b('0x13')][_0xab8b('0x15')]);return _0xb1ec1e(_0x5215cd['error'][_0xab8b('0x15')]);}logger[_0xab8b('0x13')](_0xab8b('0xe'),_0x1121e2,_0x5215cd['error']['message']);return _0x233bfd(_0x5215cd[_0xab8b('0x13')][_0xab8b('0x15')]);}else{logger[_0xab8b('0xd')](_0xab8b('0xe'),_0x1121e2,_0xab8b('0xf'));_0x233bfd(_0x5215cd['result'][_0xab8b('0x15')]);}})['catch'](function(_0x5241b2){logger[_0xab8b('0x13')](_0xab8b('0xe'),_0x1121e2,_0x5241b2);_0xb1ec1e(_0x5241b2);});});}exports[_0xab8b('0x16')]=function(_0x31111b){var _0x28676d=this;return new Promise(function(_0x4da3f2,_0x9a41a9){return db['CmHopperFinal'][_0xab8b('0x17')](_0x31111b[_0xab8b('0x18')],{'raw':_0x31111b['options']?_0x31111b[_0xab8b('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xab8b('0x1a')](function(_0x37b5f2){logger[_0xab8b('0xd')](_0xab8b('0x16'),_0x31111b);logger[_0xab8b('0x10')](_0xab8b('0x16'),_0x31111b,JSON[_0xab8b('0x12')](_0x37b5f2));_0x4da3f2(_0x37b5f2);})[_0xab8b('0x1b')](function(_0x4a49a3){logger[_0xab8b('0x13')](_0xab8b('0x16'),_0x4a49a3[_0xab8b('0x15')],_0x31111b);_0x9a41a9(_0x28676d[_0xab8b('0x13')](0x1f4,_0x4a49a3[_0xab8b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 52472a6..cdfd2b7 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 _0xaf9d=['isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get'];(function(_0x57da50,_0x4e6129){var _0x59c551=function(_0x10600e){while(--_0x10600e){_0x57da50['push'](_0x57da50['shift']());}};_0x59c551(++_0x4e6129);}(_0xaf9d,0xfa));var _0xdaf9=function(_0x3ecefe,_0x2e7561){_0x3ecefe=_0x3ecefe-0x0;var _0x3f982b=_0xaf9d[_0x3ecefe];return _0x3f982b;};'use strict';var multer=require('multer');var util=require(_0xdaf9('0x0'));var path=require(_0xdaf9('0x1'));var timeout=require(_0xdaf9('0x2'));var express=require(_0xdaf9('0x3'));var router=express[_0xdaf9('0x4')]();var auth=require(_0xdaf9('0x5'));var interaction=require(_0xdaf9('0x6'));var config=require(_0xdaf9('0x7'));var controller=require(_0xdaf9('0x8'));router[_0xdaf9('0x9')]('/',auth[_0xdaf9('0xa')](),controller[_0xdaf9('0xb')]);router[_0xdaf9('0x9')](_0xdaf9('0xc'),auth['isAuthenticated'](),controller[_0xdaf9('0xd')]);router[_0xdaf9('0x9')](_0xdaf9('0xe'),auth[_0xdaf9('0xa')](),controller[_0xdaf9('0xf')]);router[_0xdaf9('0x9')](_0xdaf9('0x10'),auth['isAuthenticated'](),controller[_0xdaf9('0x11')]);router[_0xdaf9('0x9')](_0xdaf9('0x12'),auth[_0xdaf9('0xa')](),controller[_0xdaf9('0x13')]);router[_0xdaf9('0x14')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xdaf9('0x15')]);router[_0xdaf9('0x14')](_0xdaf9('0x16'),auth['isAuthenticated'](),controller[_0xdaf9('0x17')]);router[_0xdaf9('0x14')](_0xdaf9('0x18'),auth[_0xdaf9('0xa')](),controller['checkContactHopper']);router['put'](_0xdaf9('0xe'),auth[_0xdaf9('0xa')](),controller[_0xdaf9('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc5c7=['/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe'];(function(_0x126548,_0x25839c){var _0x404c89=function(_0x1c7125){while(--_0x1c7125){_0x126548['push'](_0x126548['shift']());}};_0x404c89(++_0x25839c);}(_0xc5c7,0x108));var _0x7c5c=function(_0x3272eb,_0x23811d){_0x3272eb=_0x3272eb-0x0;var _0x3a6c65=_0xc5c7[_0x3272eb];return _0x3a6c65;};'use strict';var multer=require(_0x7c5c('0x0'));var util=require(_0x7c5c('0x1'));var path=require(_0x7c5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c5c('0x3'));var router=express['Router']();var auth=require(_0x7c5c('0x4'));var interaction=require(_0x7c5c('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x7c5c('0x6')]('/',auth[_0x7c5c('0x7')](),controller['index']);router[_0x7c5c('0x6')]('/describe',auth[_0x7c5c('0x7')](),controller[_0x7c5c('0x8')]);router[_0x7c5c('0x6')](_0x7c5c('0x9'),auth[_0x7c5c('0x7')](),controller[_0x7c5c('0xa')]);router['get'](_0x7c5c('0xb'),auth[_0x7c5c('0x7')](),controller[_0x7c5c('0xc')]);router['get'](_0x7c5c('0xd'),auth[_0x7c5c('0x7')](),controller[_0x7c5c('0xe')]);router['post']('/voice/queue/moveContacts/:id',auth[_0x7c5c('0x7')](),controller[_0x7c5c('0xf')]);router[_0x7c5c('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x7c5c('0x7')](),controller[_0x7c5c('0x11')]);router[_0x7c5c('0x10')](_0x7c5c('0x12'),auth[_0x7c5c('0x7')](),controller['checkContactHopper']);router['put'](_0x7c5c('0x9'),auth['isAuthenticated'](),controller[_0x7c5c('0x13')]);module[_0x7c5c('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 491b4b1..1288f65 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 _0x92f8=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x5d21e4,_0x2cdbc3){var _0x247be8=function(_0xeaeb09){while(--_0xeaeb09){_0x5d21e4['push'](_0x5d21e4['shift']());}};_0x247be8(++_0x2cdbc3);}(_0x92f8,0x13e));var _0x892f=function(_0x17fd88,_0x13ee8c){_0x17fd88=_0x17fd88-0x0;var _0x34007f=_0x92f8[_0x17fd88];return _0x34007f;};'use strict';var Sequelize=require(_0x892f('0x0'));module[_0x892f('0x1')]={'state':{'type':Sequelize[_0x892f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x892f('0x3')]},'scheduledat':{'type':Sequelize[_0x892f('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x892f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x892f('0x3')]},'originatecalleridname':{'type':Sequelize[_0x892f('0x3')]},'calleridnum':{'type':Sequelize[_0x892f('0x3')]},'calleridname':{'type':Sequelize[_0x892f('0x3')]},'starttime':{'type':Sequelize[_0x892f('0x4')]},'responsetime':{'type':Sequelize[_0x892f('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x892f('0x4')]},'endtime':{'type':Sequelize[_0x892f('0x4')]},'ringtime':{'type':Sequelize[_0x892f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x892f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x892f('0x3')]},'campaign':{'type':Sequelize[_0x892f('0x3')]},'campaigntype':{'type':Sequelize[_0x892f('0x3')]},'membername':{'type':Sequelize[_0x892f('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x892f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x892f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x892f('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x892f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x892f('0x4')]},'edited':{'type':Sequelize[_0x892f('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xd312=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x4d8d34,_0x329802){var _0x2a97a8=function(_0x43d35d){while(--_0x43d35d){_0x4d8d34['push'](_0x4d8d34['shift']());}};_0x2a97a8(++_0x329802);}(_0xd312,0x18e));var _0x2d31=function(_0x326fb3,_0x6e1cb1){_0x326fb3=_0x326fb3-0x0;var _0x3d8b35=_0xd312[_0x326fb3];return _0x3d8b35;};'use strict';var Sequelize=require(_0x2d31('0x0'));module[_0x2d31('0x1')]={'state':{'type':Sequelize[_0x2d31('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2d31('0x3')]},'scheduledat':{'type':Sequelize[_0x2d31('0x4')]},'countbusyretry':{'type':Sequelize[_0x2d31('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2d31('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2d31('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2d31('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x2d31('0x3')]},'originatecalleridname':{'type':Sequelize[_0x2d31('0x3')]},'calleridnum':{'type':Sequelize[_0x2d31('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2d31('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x2d31('0x4')]},'endtime':{'type':Sequelize[_0x2d31('0x4')]},'ringtime':{'type':Sequelize[_0x2d31('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2d31('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2d31('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2d31('0x3')]},'reason':{'type':Sequelize[_0x2d31('0x3')]},'amd':{'type':Sequelize[_0x2d31('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x2d31('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2d31('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2d31('0x4')]},'recallme':{'type':Sequelize[_0x2d31('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2d31('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0b80b17..77bd49a 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 _0x663e=['error','stack','name','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','CmHopperHistory','include','findAll','params','includeAll','find','catch','create','body','describe','update','uniqueid','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','apply','reject','save','destroy','then'];(function(_0x500440,_0x49b1b1){var _0x4b9188=function(_0x26f47f){while(--_0x26f47f){_0x500440['push'](_0x500440['shift']());}};_0x4b9188(++_0x49b1b1);}(_0x663e,0xb3));var _0xe663=function(_0x532a7e,_0x29c877){_0x532a7e=_0x532a7e-0x0;var _0x58736a=_0x663e[_0x532a7e];return _0x58736a;};'use strict';var pdf=require(_0xe663('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe663('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe663('0x2'));var moment=require(_0xe663('0x3'));var BPromise=require(_0xe663('0x4'));var Mustache=require(_0xe663('0x5'));var util=require(_0xe663('0x6'));var path=require('path');var sox=require(_0xe663('0x7'));var csv=require(_0xe663('0x8'));var ejs=require(_0xe663('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe663('0xa'));var crypto=require(_0xe663('0xb'));var jsforce=require(_0xe663('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe663('0x8'));var querystring=require(_0xe663('0xd'));var Papa=require(_0xe663('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe663('0xf'));var hardwareService=require(_0xe663('0x10'));var logger=require(_0xe663('0x11'))('api');var utils=require(_0xe663('0x12'));var config=require(_0xe663('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508205,_0x532491){_0x532491=_0x532491||0xcc;return function(_0xf86f65){if(_0xf86f65){return _0x508205[_0xe663('0x14')](_0x532491);}return _0x508205[_0xe663('0x15')](_0x532491)[_0xe663('0x16')]();};}function respondWithResult(_0x4697fd,_0x22055d){_0x22055d=_0x22055d||0xc8;return function(_0x32b1e3){if(_0x32b1e3){return _0x4697fd[_0xe663('0x15')](_0x22055d)[_0xe663('0x17')](_0x32b1e3);}};}function respondWithFilteredResult(_0x39701e,_0x10732c){return function(_0x340aa4){if(_0x340aa4){var _0x32b989=_0x340aa4[_0xe663('0x18')],_0x7678ab=_0x10732c[_0xe663('0x19')],_0x267981=_0x10732c[_0xe663('0x19')]+_0x10732c['limit'],_0x13fa9f;if(_0x267981>=_0x32b989){_0x267981=_0x32b989;_0x13fa9f=0xc8;}else{_0x13fa9f=0xce;}_0x39701e[_0xe663('0x15')](_0x13fa9f);return _0x39701e['set']('Content-Range',_0x7678ab+'-'+_0x267981+'/'+_0x32b989)['json'](_0x340aa4);}return null;};}function patchUpdates(_0x1a06e1){return function(_0x478ddc){try{jsonpatch[_0xe663('0x1a')](_0x478ddc,_0x1a06e1,!![]);}catch(_0x1552ac){return BPromise[_0xe663('0x1b')](_0x1552ac);}return _0x478ddc[_0xe663('0x1c')]();};}function saveUpdates(_0x726219,_0x33d816){return function(_0x40ebfd){if(_0x40ebfd){return _0x40ebfd['update'](_0x726219)['then'](function(_0x5b8b44){return _0x5b8b44;});}return null;};}function removeEntity(_0xff675f,_0x134a95){return function(_0x17299e){if(_0x17299e){return _0x17299e[_0xe663('0x1d')]()[_0xe663('0x1e')](function(){_0xff675f[_0xe663('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f005,_0x4ca9e6){return function(_0x3c86fe){if(!_0x3c86fe){_0x45f005[_0xe663('0x14')](0x194);}return _0x3c86fe;};}function handleError(_0xe6c362,_0x20b9ae){_0x20b9ae=_0x20b9ae||0x1f4;return function(_0x2c251c){logger[_0xe663('0x1f')](_0x2c251c[_0xe663('0x20')]);if(_0x2c251c[_0xe663('0x21')]){delete _0x2c251c[_0xe663('0x21')];}_0xe6c362[_0xe663('0x15')](_0x20b9ae)['send'](_0x2c251c);};}exports[_0xe663('0x22')]=function(_0x5e89fb,_0x1fc22f){var _0xf5a07b={},_0x3593ca={},_0x50bf72={'count':0x0,'rows':[]};var _0x5a98c4=db['CmHopperHistory'][_0xe663('0x23')];_0x3593ca['model']=_[_0xe663('0x24')](_0x5a98c4);_0x3593ca[_0xe663('0x25')]=_[_0xe663('0x24')](_0x5e89fb[_0xe663('0x25')]);_0x3593ca[_0xe663('0x26')]=_[_0xe663('0x27')](_0x3593ca[_0xe663('0x28')],_0x3593ca['query']);_0xf5a07b[_0xe663('0x29')]=_[_0xe663('0x27')](_0x3593ca[_0xe663('0x28')],qs[_0xe663('0x2a')](_0x5e89fb[_0xe663('0x25')][_0xe663('0x2a')]));_0xf5a07b['attributes']=_0xf5a07b[_0xe663('0x29')][_0xe663('0x2b')]?_0xf5a07b[_0xe663('0x29')]:_0x3593ca[_0xe663('0x28')];if(!_0x5e89fb[_0xe663('0x25')][_0xe663('0x2c')](_0xe663('0x2d'))){_0xf5a07b['limit']=qs[_0xe663('0x2e')](_0x5e89fb['query'][_0xe663('0x2e')]);_0xf5a07b[_0xe663('0x19')]=qs['offset'](_0x5e89fb[_0xe663('0x25')]['offset']);}_0xf5a07b[_0xe663('0x2f')]=qs['sort'](_0x5e89fb[_0xe663('0x25')][_0xe663('0x30')]);_0xf5a07b[_0xe663('0x31')]=qs['filters'](_['pick'](_0x5e89fb['query'],_0x3593ca['filters']));if(_0x5e89fb[_0xe663('0x25')][_0xe663('0x32')]){_0xf5a07b['where']=_[_0xe663('0x33')](_0xf5a07b[_0xe663('0x31')],{'$or':_[_0xe663('0x34')](_0x5a98c4,function(_0x5484c0){if(_0x5484c0[_0xe663('0x35')][_0xe663('0x36')]!==_0xe663('0x37')){var _0x4a228a={};_0x4a228a[_0x5484c0[_0xe663('0x38')]]={'$like':'%'+_0x5e89fb['query'][_0xe663('0x32')]+'%'};return _0x4a228a;}})});}_0xf5a07b=_[_0xe663('0x33')]({},_0xf5a07b,_0x5e89fb[_0xe663('0x39')]);var _0x21cee2={'where':_0xf5a07b[_0xe663('0x31')]};return db[_0xe663('0x3a')][_0xe663('0x18')](_0x21cee2)[_0xe663('0x1e')](function(_0x273b3b){_0x50bf72[_0xe663('0x18')]=_0x273b3b;if(_0x5e89fb[_0xe663('0x25')]['includeAll']){_0xf5a07b[_0xe663('0x3b')]=[{'all':!![]}];}return db[_0xe663('0x3a')][_0xe663('0x3c')](_0xf5a07b);})['then'](function(_0x346beb){_0x50bf72['rows']=_0x346beb;return _0x50bf72;})[_0xe663('0x1e')](respondWithFilteredResult(_0x1fc22f,_0xf5a07b))['catch'](handleError(_0x1fc22f,null));};exports['show']=function(_0x2c62c2,_0x463c57){var _0x2a75f0={'raw':!![],'where':{'id':_0x2c62c2[_0xe663('0x3d')]['id']}},_0x42bbc5={};_0x42bbc5[_0xe663('0x28')]=_[_0xe663('0x24')](db['CmHopperHistory'][_0xe663('0x23')]);_0x42bbc5[_0xe663('0x25')]=_[_0xe663('0x24')](_0x2c62c2['query']);_0x42bbc5['filters']=_[_0xe663('0x27')](_0x42bbc5['model'],_0x42bbc5[_0xe663('0x25')]);_0x2a75f0[_0xe663('0x29')]=_['intersection'](_0x42bbc5[_0xe663('0x28')],qs['fields'](_0x2c62c2[_0xe663('0x25')][_0xe663('0x2a')]));_0x2a75f0['attributes']=_0x2a75f0[_0xe663('0x29')][_0xe663('0x2b')]?_0x2a75f0[_0xe663('0x29')]:_0x42bbc5[_0xe663('0x28')];if(_0x2c62c2['query'][_0xe663('0x3e')]){_0x2a75f0[_0xe663('0x3b')]=[{'all':!![]}];}_0x2a75f0=_[_0xe663('0x33')]({},_0x2a75f0,_0x2c62c2[_0xe663('0x39')]);return db[_0xe663('0x3a')][_0xe663('0x3f')](_0x2a75f0)[_0xe663('0x1e')](handleEntityNotFound(_0x463c57,null))['then'](respondWithResult(_0x463c57,null))[_0xe663('0x40')](handleError(_0x463c57,null));};exports[_0xe663('0x41')]=function(_0x15e860,_0x351278){return db[_0xe663('0x3a')][_0xe663('0x41')](_0x15e860[_0xe663('0x42')],{})['then'](respondWithResult(_0x351278,0xc9))[_0xe663('0x40')](handleError(_0x351278,null));};exports[_0xe663('0x43')]=function(_0x336e1f,_0x4cc4da){return db[_0xe663('0x3a')][_0xe663('0x43')]()['then'](respondWithResult(_0x4cc4da,null))[_0xe663('0x40')](handleError(_0x4cc4da,null));};exports[_0xe663('0x44')]=function(_0x450c6c,_0x335e9c){if(_0x450c6c['body'][_0xe663('0x45')]){delete _0x450c6c[_0xe663('0x42')]['uniqueid'];}return db[_0xe663('0x3a')]['find']({'where':{'uniqueid':_0x450c6c[_0xe663('0x3d')]['id']}})[_0xe663('0x1e')](handleEntityNotFound(_0x335e9c,null))[_0xe663('0x1e')](saveUpdates(_0x450c6c[_0xe663('0x42')],null))['then'](respondWithResult(_0x335e9c,null))[_0xe663('0x40')](handleError(_0x335e9c,null));}; \ No newline at end of file +var _0xbcad=['sendStatus','status','end','json','count','offset','Content-Range','then','destroy','error','name','send','index','CmHopperHistory','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','show','length','catch','describe','update','body','uniqueid','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x226b5c,_0x5865a9){var _0x445823=function(_0x28727d){while(--_0x28727d){_0x226b5c['push'](_0x226b5c['shift']());}};_0x445823(++_0x5865a9);}(_0xbcad,0x1d3));var _0xdbca=function(_0x49cb7c,_0x5f50ae){_0x49cb7c=_0x49cb7c-0x0;var _0x2b2cd3=_0xbcad[_0x49cb7c];return _0x2b2cd3;};'use strict';var pdf=require(_0xdbca('0x0'));var emlformat=require(_0xdbca('0x1'));var rimraf=require(_0xdbca('0x2'));var zipdir=require(_0xdbca('0x3'));var jsonpatch=require(_0xdbca('0x4'));var rp=require(_0xdbca('0x5'));var moment=require(_0xdbca('0x6'));var BPromise=require(_0xdbca('0x7'));var Mustache=require(_0xdbca('0x8'));var util=require('util');var path=require(_0xdbca('0x9'));var sox=require('sox');var csv=require(_0xdbca('0xa'));var ejs=require(_0xdbca('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdbca('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdbca('0xd'));var toCsv=require(_0xdbca('0xa'));var querystring=require(_0xdbca('0xe'));var Papa=require(_0xdbca('0xf'));var Redis=require('ioredis');var authService=require(_0xdbca('0x10'));var qs=require(_0xdbca('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbca('0x12'))(_0xdbca('0x13'));var utils=require(_0xdbca('0x14'));var config=require(_0xdbca('0x15'));var db=require(_0xdbca('0x16'))['db'];function respondWithStatusCode(_0x1a161a,_0x57231f){_0x57231f=_0x57231f||0xcc;return function(_0x545bd0){if(_0x545bd0){return _0x1a161a[_0xdbca('0x17')](_0x57231f);}return _0x1a161a[_0xdbca('0x18')](_0x57231f)[_0xdbca('0x19')]();};}function respondWithResult(_0x266be9,_0x5936c4){_0x5936c4=_0x5936c4||0xc8;return function(_0x29f8ec){if(_0x29f8ec){return _0x266be9[_0xdbca('0x18')](_0x5936c4)[_0xdbca('0x1a')](_0x29f8ec);}};}function respondWithFilteredResult(_0xed8297,_0x4040f0){return function(_0x4e66d3){if(_0x4e66d3){var _0x2374a3=_0x4e66d3[_0xdbca('0x1b')],_0x3e6f12=_0x4040f0[_0xdbca('0x1c')],_0x2e7941=_0x4040f0['offset']+_0x4040f0['limit'],_0x3b5397;if(_0x2e7941>=_0x2374a3){_0x2e7941=_0x2374a3;_0x3b5397=0xc8;}else{_0x3b5397=0xce;}_0xed8297[_0xdbca('0x18')](_0x3b5397);return _0xed8297['set'](_0xdbca('0x1d'),_0x3e6f12+'-'+_0x2e7941+'/'+_0x2374a3)['json'](_0x4e66d3);}return null;};}function patchUpdates(_0x50da12){return function(_0x1845ae){try{jsonpatch['apply'](_0x1845ae,_0x50da12,!![]);}catch(_0x331a8d){return BPromise['reject'](_0x331a8d);}return _0x1845ae['save']();};}function saveUpdates(_0x295c21,_0x2a8bd3){return function(_0x2bfa49){if(_0x2bfa49){return _0x2bfa49['update'](_0x295c21)[_0xdbca('0x1e')](function(_0x12a7d8){return _0x12a7d8;});}return null;};}function removeEntity(_0xfcd45c,_0x5cc679){return function(_0x56d39c){if(_0x56d39c){return _0x56d39c[_0xdbca('0x1f')]()[_0xdbca('0x1e')](function(){_0xfcd45c[_0xdbca('0x18')](0xcc)[_0xdbca('0x19')]();});}};}function handleEntityNotFound(_0x31711d,_0x988f80){return function(_0x58c35b){if(!_0x58c35b){_0x31711d[_0xdbca('0x17')](0x194);}return _0x58c35b;};}function handleError(_0x33ea1b,_0x43640f){_0x43640f=_0x43640f||0x1f4;return function(_0x13100d){logger[_0xdbca('0x20')](_0x13100d['stack']);if(_0x13100d['name']){delete _0x13100d[_0xdbca('0x21')];}_0x33ea1b[_0xdbca('0x18')](_0x43640f)[_0xdbca('0x22')](_0x13100d);};}exports[_0xdbca('0x23')]=function(_0x47be27,_0x5a1376){var _0x1b66a8={},_0xf2136b={},_0x11b82b={'count':0x0,'rows':[]};var _0x248376=db[_0xdbca('0x24')][_0xdbca('0x25')];_0xf2136b[_0xdbca('0x26')]=_[_0xdbca('0x27')](_0x248376);_0xf2136b[_0xdbca('0x28')]=_[_0xdbca('0x27')](_0x47be27[_0xdbca('0x28')]);_0xf2136b['filters']=_[_0xdbca('0x29')](_0xf2136b[_0xdbca('0x26')],_0xf2136b[_0xdbca('0x28')]);_0x1b66a8[_0xdbca('0x2a')]=_[_0xdbca('0x29')](_0xf2136b['model'],qs[_0xdbca('0x2b')](_0x47be27['query'][_0xdbca('0x2b')]));_0x1b66a8['attributes']=_0x1b66a8[_0xdbca('0x2a')]['length']?_0x1b66a8[_0xdbca('0x2a')]:_0xf2136b['model'];if(!_0x47be27[_0xdbca('0x28')][_0xdbca('0x2c')](_0xdbca('0x2d'))){_0x1b66a8['limit']=qs[_0xdbca('0x2e')](_0x47be27[_0xdbca('0x28')][_0xdbca('0x2e')]);_0x1b66a8[_0xdbca('0x1c')]=qs[_0xdbca('0x1c')](_0x47be27[_0xdbca('0x28')]['offset']);}_0x1b66a8['order']=qs[_0xdbca('0x2f')](_0x47be27['query'][_0xdbca('0x2f')]);_0x1b66a8[_0xdbca('0x30')]=qs[_0xdbca('0x31')](_['pick'](_0x47be27[_0xdbca('0x28')],_0xf2136b[_0xdbca('0x31')]));if(_0x47be27['query']['filter']){_0x1b66a8[_0xdbca('0x30')]=_[_0xdbca('0x32')](_0x1b66a8[_0xdbca('0x30')],{'$or':_[_0xdbca('0x33')](_0x248376,function(_0x5d747e){if(_0x5d747e[_0xdbca('0x34')][_0xdbca('0x35')]!==_0xdbca('0x36')){var _0x270d58={};_0x270d58[_0x5d747e[_0xdbca('0x37')]]={'$like':'%'+_0x47be27[_0xdbca('0x28')][_0xdbca('0x38')]+'%'};return _0x270d58;}})});}_0x1b66a8=_[_0xdbca('0x32')]({},_0x1b66a8,_0x47be27[_0xdbca('0x39')]);var _0x155244={'where':_0x1b66a8['where']};return db[_0xdbca('0x24')]['count'](_0x155244)[_0xdbca('0x1e')](function(_0x1ea5e0){_0x11b82b[_0xdbca('0x1b')]=_0x1ea5e0;if(_0x47be27[_0xdbca('0x28')][_0xdbca('0x3a')]){_0x1b66a8[_0xdbca('0x3b')]=[{'all':!![]}];}return db[_0xdbca('0x24')][_0xdbca('0x3c')](_0x1b66a8);})[_0xdbca('0x1e')](function(_0x96cd75){_0x11b82b['rows']=_0x96cd75;return _0x11b82b;})[_0xdbca('0x1e')](respondWithFilteredResult(_0x5a1376,_0x1b66a8))['catch'](handleError(_0x5a1376,null));};exports[_0xdbca('0x3d')]=function(_0x5c6d90,_0x312077){var _0x152555={'raw':!![],'where':{'id':_0x5c6d90['params']['id']}},_0x520007={};_0x520007[_0xdbca('0x26')]=_[_0xdbca('0x27')](db[_0xdbca('0x24')][_0xdbca('0x25')]);_0x520007[_0xdbca('0x28')]=_[_0xdbca('0x27')](_0x5c6d90[_0xdbca('0x28')]);_0x520007[_0xdbca('0x31')]=_[_0xdbca('0x29')](_0x520007[_0xdbca('0x26')],_0x520007[_0xdbca('0x28')]);_0x152555[_0xdbca('0x2a')]=_[_0xdbca('0x29')](_0x520007['model'],qs[_0xdbca('0x2b')](_0x5c6d90[_0xdbca('0x28')]['fields']));_0x152555[_0xdbca('0x2a')]=_0x152555['attributes'][_0xdbca('0x3e')]?_0x152555[_0xdbca('0x2a')]:_0x520007['model'];if(_0x5c6d90[_0xdbca('0x28')]['includeAll']){_0x152555[_0xdbca('0x3b')]=[{'all':!![]}];}_0x152555=_[_0xdbca('0x32')]({},_0x152555,_0x5c6d90[_0xdbca('0x39')]);return db['CmHopperHistory']['find'](_0x152555)['then'](handleEntityNotFound(_0x312077,null))[_0xdbca('0x1e')](respondWithResult(_0x312077,null))[_0xdbca('0x3f')](handleError(_0x312077,null));};exports['create']=function(_0x9314c,_0x74aa3b){return db[_0xdbca('0x24')]['create'](_0x9314c['body'],{})[_0xdbca('0x1e')](respondWithResult(_0x74aa3b,0xc9))[_0xdbca('0x3f')](handleError(_0x74aa3b,null));};exports['describe']=function(_0x50534c,_0x41b1c9){return db[_0xdbca('0x24')][_0xdbca('0x40')]()[_0xdbca('0x1e')](respondWithResult(_0x41b1c9,null))[_0xdbca('0x3f')](handleError(_0x41b1c9,null));};exports[_0xdbca('0x41')]=function(_0x2e1109,_0x874e8f){if(_0x2e1109[_0xdbca('0x42')][_0xdbca('0x43')]){delete _0x2e1109[_0xdbca('0x42')][_0xdbca('0x43')];}return db['CmHopperHistory'][_0xdbca('0x44')]({'where':{'uniqueid':_0x2e1109[_0xdbca('0x45')]['id']}})[_0xdbca('0x1e')](handleEntityNotFound(_0x874e8f,null))['then'](saveUpdates(_0x2e1109[_0xdbca('0x42')],null))['then'](respondWithResult(_0x874e8f,null))[_0xdbca('0x3f')](handleError(_0x874e8f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 2cea956..a44fd3b 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 _0x017b=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','endtime','uniqueid','lodash','util'];(function(_0x953048,_0x442ab0){var _0x4e2ae9=function(_0x562487){while(--_0x562487){_0x953048['push'](_0x953048['shift']());}};_0x4e2ae9(++_0x442ab0);}(_0x017b,0x9a));var _0xb017=function(_0x4cb6fc,_0x59c115){_0x4cb6fc=_0x4cb6fc-0x0;var _0xd33400=_0x017b[_0x4cb6fc];return _0xd33400;};'use strict';var _=require(_0xb017('0x0'));var util=require(_0xb017('0x1'));var logger=require(_0xb017('0x2'))('api');var moment=require(_0xb017('0x3'));var BPromise=require(_0xb017('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb017('0x5'));var rimraf=require(_0xb017('0x6'));var config=require(_0xb017('0x7'));var attributes=require(_0xb017('0x8'));module[_0xb017('0x9')]=function(_0x13ab16,_0x440f9b){return _0x13ab16[_0xb017('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xb017('0xb'),'fields':[_0xb017('0xb')]},{'name':_0xb017('0xc'),'fields':[_0xb017('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ace=['moment','bluebird','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api'];(function(_0x378c9e,_0x3d0d9b){var _0x4b44b2=function(_0x18b0e5){while(--_0x18b0e5){_0x378c9e['push'](_0x378c9e['shift']());}};_0x4b44b2(++_0x3d0d9b);}(_0x0ace,0x1de));var _0xe0ac=function(_0x3d7022,_0x59dfd5){_0x3d7022=_0x3d7022-0x0;var _0x40870b=_0x0ace[_0x3d7022];return _0x40870b;};'use strict';var _=require('lodash');var util=require(_0xe0ac('0x0'));var logger=require(_0xe0ac('0x1'))(_0xe0ac('0x2'));var moment=require(_0xe0ac('0x3'));var BPromise=require(_0xe0ac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe0ac('0x5'));var config=require(_0xe0ac('0x6'));var attributes=require(_0xe0ac('0x7'));module['exports']=function(_0x4fe82b,_0x39192b){return _0x4fe82b[_0xe0ac('0x8')](_0xe0ac('0x9'),attributes,{'tableName':_0xe0ac('0xa'),'paranoid':![],'indexes':[{'name':_0xe0ac('0xb'),'fields':['endtime']},{'name':_0xe0ac('0xc'),'fields':[_0xe0ac('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 eb8d4a6..3a2248d 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 _0x5c00=['outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','CmHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x5c00,0x17e));var _0x05c0=function(_0x267f04,_0x18005d){_0x267f04=_0x267f04-0x0;var _0x324621=_0x5c00[_0x267f04];return _0x324621;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});}exports[_0x05c0('0x16')]=function(_0x521cbd){var _0x422401=this;return new Promise(function(_0x1230e5,_0x4613c0){return db['CmHopperHistory'][_0x05c0('0x17')](_0x521cbd[_0x05c0('0x18')],{'raw':_0x521cbd[_0x05c0('0x19')]?_0x521cbd[_0x05c0('0x19')][_0x05c0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x407c1f){logger[_0x05c0('0xc')]('CreateCmHopperHistory',_0x521cbd);logger['debug']('CreateCmHopperHistory',_0x521cbd,JSON[_0x05c0('0x10')](_0x407c1f));_0x1230e5(_0x407c1f);})[_0x05c0('0x15')](function(_0x83f29){logger[_0x05c0('0x11')](_0x05c0('0x16'),_0x83f29[_0x05c0('0x13')],_0x521cbd);_0x4613c0(_0x422401[_0x05c0('0x11')](0x1f4,_0x83f29['message']));});});};exports[_0x05c0('0x1b')]=function(_0x1abbf3){var _0x4ba978=this;return new Promise(function(_0x530966,_0x4da6d6){return db['CmHopperHistory']['findAll']({'raw':_0x1abbf3[_0x05c0('0x19')]?_0x1abbf3[_0x05c0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1abbf3[_0x05c0('0x19')]?_0x1abbf3[_0x05c0('0x19')][_0x05c0('0x1c')]||null:null,'attributes':[[db[_0x05c0('0x1d')]['fn']('COUNT',db[_0x05c0('0x1d')][_0x05c0('0x1e')]('id')),_0x05c0('0x1f')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x05c0('0x21')))),_0x05c0('0x22')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')](_0x05c0('0x24')))),_0x05c0('0x25')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x05c0('0x26')))),_0x05c0('0x27')],[db[_0x05c0('0x1d')]['fn']('AVG',db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')]['literal'](_0x05c0('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x29'),db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')](_0x05c0('0x2a')))),_0x05c0('0x2b')]]})[_0x05c0('0xb')](function(_0x3d8d76){logger[_0x05c0('0xc')](_0x05c0('0x1b'),_0x1abbf3);logger[_0x05c0('0xf')](_0x05c0('0x1b'),_0x1abbf3,JSON[_0x05c0('0x10')](_0x3d8d76));_0x530966(_0x3d8d76);})[_0x05c0('0x15')](function(_0x3382f6){logger[_0x05c0('0x11')](_0x05c0('0x1b'),_0x3382f6[_0x05c0('0x13')],_0x1abbf3);_0x4da6d6(_0x4ba978[_0x05c0('0x11')](0x1f4,_0x3382f6[_0x05c0('0x13')]));});});};exports[_0x05c0('0x2c')]=function(_0x9ca737){var _0x285422=this;return new Promise(function(_0x3d3291,_0x2c9359){return db[_0x05c0('0x2d')][_0x05c0('0x2e')]({'raw':_0x9ca737[_0x05c0('0x19')]?_0x9ca737[_0x05c0('0x19')][_0x05c0('0x1a')]===undefined?!![]:![]:!![],'where':_0x9ca737[_0x05c0('0x19')]?_0x9ca737[_0x05c0('0x19')]['where']||null:null,'attributes':[[_0x05c0('0x2f'),_0x05c0('0x30')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x05c0('0x23')](_0x05c0('0x31')))),_0x05c0('0x32')],[db['sequelize']['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0x05c0('0x33')],[db[_0x05c0('0x1d')]['fn']('COUNT',db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')](_0x05c0('0x21')))),_0x05c0('0x34')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x05c0('0x23')](_0x05c0('0x35')))),_0x05c0('0x36')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db['sequelize']['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')](_0x05c0('0x37')))),_0x05c0('0x38')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db['sequelize'][_0x05c0('0x23')](_0x05c0('0x39')))),_0x05c0('0x3a')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')](_0x05c0('0x3b')))),_0x05c0('0x3c')],[db[_0x05c0('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')](_0x05c0('0x3d')))),_0x05c0('0x3e')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db['sequelize']['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')](_0x05c0('0x3f')))),_0x05c0('0x40')],[db['sequelize']['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0x05c0('0x41')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db['sequelize'][_0x05c0('0x23')](_0x05c0('0x42')))),'outboundRejectCallsDay'],[db[_0x05c0('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x05c0('0x1d')]['literal'](_0x05c0('0x43')))),_0x05c0('0x44')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')]['literal'](_0x05c0('0x45')))),'outboundRejectCallsDay'],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')](_0x05c0('0x46')))),_0x05c0('0x47')]],'group':['campaign']})['then'](function(_0x523153){logger[_0x05c0('0xc')](_0x05c0('0x2c'),_0x9ca737);logger['debug']('GetVoiceQueueHopperHistory',_0x9ca737,JSON[_0x05c0('0x10')](_0x523153));_0x3d3291(_0x523153);})[_0x05c0('0x15')](function(_0x476e16){logger[_0x05c0('0x11')](_0x05c0('0x2c'),_0x476e16[_0x05c0('0x13')],_0x9ca737);_0x2c9359(_0x285422[_0x05c0('0x11')](0x1f4,_0x476e16['message']));});});};exports[_0x05c0('0x48')]=function(_0x46105a){var _0x189a9a=this;return new Promise(function(_0x179e5a,_0x4b5e1f){return db[_0x05c0('0x2d')]['findAll']({'raw':_0x46105a[_0x05c0('0x19')]?_0x46105a[_0x05c0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x46105a[_0x05c0('0x19')]?_0x46105a['options'][_0x05c0('0x1c')]||null:null,'attributes':[[_0x05c0('0x2f'),_0x05c0('0x30')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['col']('id')),_0x05c0('0x49')],[db[_0x05c0('0x1d')]['fn'](_0x05c0('0x20'),db[_0x05c0('0x1d')]['fn']('IF',db[_0x05c0('0x1d')][_0x05c0('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x05c0('0x4a')]],'group':[_0x05c0('0x2f')]})[_0x05c0('0xb')](function(_0x41de8c){logger[_0x05c0('0xc')](_0x05c0('0x48'),_0x46105a);logger[_0x05c0('0xf')](_0x05c0('0x48'),_0x46105a,JSON[_0x05c0('0x10')](_0x41de8c));_0x179e5a(_0x41de8c);})[_0x05c0('0x15')](function(_0x23cc3e){logger[_0x05c0('0x11')]('GetCampaignHopperHistory',_0x23cc3e['message'],_0x46105a);_0x4b5e1f(_0x189a9a['error'](0x1f4,_0x23cc3e[_0x05c0('0x13')]));});});}; \ No newline at end of file +var _0x1775=['CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x1775,0x1db));var _0x5177=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1775[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateCmHopperHistory',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});};exports[_0x5177('0x1f')]=function(_0x3b39b5){var _0x2d51d0=this;return new Promise(function(_0x4bc8e2,_0x2503ef){return db['CmHopperHistory']['findAll']({'raw':_0x3b39b5[_0x5177('0x1d')]?_0x3b39b5[_0x5177('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3b39b5[_0x5177('0x1d')]?_0x3b39b5['options'][_0x5177('0x20')]||null:null,'attributes':[[db[_0x5177('0x21')]['fn']('COUNT',db[_0x5177('0x21')][_0x5177('0x22')]('id')),_0x5177('0x23')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db['sequelize']['literal'](_0x5177('0x25')))),_0x5177('0x26')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')](_0x5177('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db['sequelize']['fn']('IF',db[_0x5177('0x21')]['literal'](_0x5177('0x29')))),_0x5177('0x2a')],[db[_0x5177('0x21')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')](_0x5177('0x2b')))),_0x5177('0x2c')],[db[_0x5177('0x21')]['fn'](_0x5177('0x2d'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')]['literal'](_0x5177('0x2e')))),_0x5177('0x2f')]]})['then'](function(_0xa0851d){logger[_0x5177('0xf')](_0x5177('0x1f'),_0x3b39b5);logger[_0x5177('0x10')](_0x5177('0x1f'),_0x3b39b5,JSON[_0x5177('0x13')](_0xa0851d));_0x4bc8e2(_0xa0851d);})['catch'](function(_0x40c607){logger[_0x5177('0x14')](_0x5177('0x1f'),_0x40c607[_0x5177('0x17')],_0x3b39b5);_0x2503ef(_0x2d51d0[_0x5177('0x14')](0x1f4,_0x40c607[_0x5177('0x17')]));});});};exports[_0x5177('0x30')]=function(_0x5a5a33){var _0x257350=this;return new Promise(function(_0x2ff13b,_0x5eb62a){return db['CmHopperHistory'][_0x5177('0x31')]({'raw':_0x5a5a33[_0x5177('0x1d')]?_0x5a5a33[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a5a33[_0x5177('0x1d')]?_0x5a5a33[_0x5177('0x1d')][_0x5177('0x20')]||null:null,'attributes':[[_0x5177('0x32'),_0x5177('0x33')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')]['literal'](_0x5177('0x34')))),_0x5177('0x35')],[db['sequelize']['fn'](_0x5177('0x24'),db['sequelize']['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')](_0x5177('0x36')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')](_0x5177('0x25')))),_0x5177('0x37')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db['sequelize']['fn']('IF',db[_0x5177('0x21')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x5177('0x38')],[db[_0x5177('0x21')]['fn']('COUNT',db[_0x5177('0x21')]['fn']('IF',db['sequelize']['literal'](_0x5177('0x39')))),_0x5177('0x3a')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x5177('0x21')]['fn']('COUNT',db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')](_0x5177('0x3b')))),'outboundDropCallsDayCallersExit'],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')](_0x5177('0x3c')))),_0x5177('0x3d')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')]['literal'](_0x5177('0x3e')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')]['literal'](_0x5177('0x3f')))),_0x5177('0x40')],[db[_0x5177('0x21')]['fn']('COUNT',db[_0x5177('0x21')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x5177('0x41')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db['sequelize']['fn']('IF',db['sequelize'][_0x5177('0x27')]('`state`\x20=\x2016,\x201,\x20null'))),_0x5177('0x42')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')](_0x5177('0x43')))),_0x5177('0x41')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x5177('0x32')]})['then'](function(_0x649c6f){logger['info'](_0x5177('0x30'),_0x5a5a33);logger[_0x5177('0x10')](_0x5177('0x30'),_0x5a5a33,JSON['stringify'](_0x649c6f));_0x2ff13b(_0x649c6f);})['catch'](function(_0x19884e){logger[_0x5177('0x14')](_0x5177('0x30'),_0x19884e[_0x5177('0x17')],_0x5a5a33);_0x5eb62a(_0x257350['error'](0x1f4,_0x19884e['message']));});});};exports[_0x5177('0x44')]=function(_0x131da7){var _0x32a53a=this;return new Promise(function(_0x736b13,_0x4ad742){return db[_0x5177('0x1b')][_0x5177('0x31')]({'raw':_0x131da7[_0x5177('0x1d')]?_0x131da7['options'][_0x5177('0x1e')]===undefined?!![]:![]:!![],'where':_0x131da7[_0x5177('0x1d')]?_0x131da7[_0x5177('0x1d')]['where']||null:null,'attributes':[[_0x5177('0x32'),'name'],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['col']('id')),_0x5177('0x45')],[db[_0x5177('0x21')]['fn'](_0x5177('0x24'),db[_0x5177('0x21')]['fn']('IF',db[_0x5177('0x21')][_0x5177('0x27')](_0x5177('0x25')))),_0x5177('0x46')]],'group':['campaign']})['then'](function(_0x4b5b6b){logger[_0x5177('0xf')](_0x5177('0x44'),_0x131da7);logger[_0x5177('0x10')](_0x5177('0x44'),_0x131da7,JSON[_0x5177('0x13')](_0x4b5b6b));_0x736b13(_0x4b5b6b);})[_0x5177('0x19')](function(_0x4b0b3f){logger['error'](_0x5177('0x44'),_0x4b0b3f[_0x5177('0x17')],_0x131da7);_0x4ad742(_0x32a53a[_0x5177('0x14')](0x1f4,_0x4b0b3f[_0x5177('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 8f941ae..db0b0b4 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 _0xddf5=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','create','put','update'];(function(_0x336ca2,_0x1a813a){var _0xda59a6=function(_0x47caa6){while(--_0x47caa6){_0x336ca2['push'](_0x336ca2['shift']());}};_0xda59a6(++_0x1a813a);}(_0xddf5,0x121));var _0x5ddf=function(_0x3bce9a,_0x1e5e99){_0x3bce9a=_0x3bce9a-0x0;var _0x3c310d=_0xddf5[_0x3bce9a];return _0x3c310d;};'use strict';var multer=require(_0x5ddf('0x0'));var util=require(_0x5ddf('0x1'));var path=require(_0x5ddf('0x2'));var timeout=require(_0x5ddf('0x3'));var express=require(_0x5ddf('0x4'));var router=express['Router']();var auth=require(_0x5ddf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ddf('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x5ddf('0x7')]('/',auth[_0x5ddf('0x8')](),controller['index']);router[_0x5ddf('0x7')](_0x5ddf('0x9'),auth[_0x5ddf('0x8')](),controller['describe']);router[_0x5ddf('0x7')](_0x5ddf('0xa'),auth[_0x5ddf('0x8')](),controller[_0x5ddf('0xb')]);router['post']('/',auth[_0x5ddf('0x8')](),controller[_0x5ddf('0xc')]);router[_0x5ddf('0xd')]('/:id',auth[_0x5ddf('0x8')](),controller[_0x5ddf('0xe')]);module[_0x5ddf('0xf')]=router; \ No newline at end of file +var _0x2d01=['multer','path','connect-timeout','express','Router','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update'];(function(_0x45bfbc,_0x1ff15e){var _0x407018=function(_0x22f0f0){while(--_0x22f0f0){_0x45bfbc['push'](_0x45bfbc['shift']());}};_0x407018(++_0x1ff15e);}(_0x2d01,0x1f0));var _0x12d0=function(_0x5d1c0a,_0x39b381){_0x5d1c0a=_0x5d1c0a-0x0;var _0x6ba1b=_0x2d01[_0x5d1c0a];return _0x6ba1b;};'use strict';var multer=require(_0x12d0('0x0'));var util=require('util');var path=require(_0x12d0('0x1'));var timeout=require(_0x12d0('0x2'));var express=require(_0x12d0('0x3'));var router=express[_0x12d0('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x12d0('0x5'));router['get']('/',auth[_0x12d0('0x6')](),controller[_0x12d0('0x7')]);router[_0x12d0('0x8')](_0x12d0('0x9'),auth[_0x12d0('0x6')](),controller[_0x12d0('0xa')]);router[_0x12d0('0x8')](_0x12d0('0xb'),auth[_0x12d0('0x6')](),controller[_0x12d0('0xc')]);router[_0x12d0('0xd')]('/',auth[_0x12d0('0x6')](),controller[_0x12d0('0xe')]);router['put'](_0x12d0('0xb'),auth['isAuthenticated'](),controller[_0x12d0('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index dcdad54..0c75718 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 _0xe0cf=['exports','name','STRING','sequelize'];(function(_0x86f7db,_0x473d05){var _0x55d97e=function(_0x277371){while(--_0x277371){_0x86f7db['push'](_0x86f7db['shift']());}};_0x55d97e(++_0x473d05);}(_0xe0cf,0xcb));var _0xfe0c=function(_0x2f3738,_0x115a52){_0x2f3738=_0x2f3738-0x0;var _0x3dfa2c=_0xe0cf[_0x2f3738];return _0x3dfa2c;};'use strict';var Sequelize=require(_0xfe0c('0x0'));module[_0xfe0c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfe0c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfe0c('0x3')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x471a=['exports','name','STRING','sequelize'];(function(_0x2ba646,_0x5c4d10){var _0x25a779=function(_0x365675){while(--_0x365675){_0x2ba646['push'](_0x2ba646['shift']());}};_0x25a779(++_0x5c4d10);}(_0x471a,0x6f));var _0xa471=function(_0xc331c2,_0x3a6939){_0xc331c2=_0xc331c2-0x0;var _0x5104a2=_0x471a[_0xc331c2];return _0x5104a2;};'use strict';var Sequelize=require(_0xa471('0x0'));module[_0xa471('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa471('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa471('0x3')]},'dialPrefix':{'type':Sequelize[_0xa471('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index dd80fea..54e7f57 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 _0xd7ce=['Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','error','name','send','index','CmList','rawAttributes','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','map','type','key','VIRTUAL','field','merge','count','includeAll','findAll','rows','params','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','findOne','pick','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','dataValues','errors','message'];(function(_0x58c86a,_0x602654){var _0x2bb374=function(_0x1302a9){while(--_0x1302a9){_0x58c86a['push'](_0x58c86a['shift']());}};_0x2bb374(++_0x602654);}(_0xd7ce,0x147));var _0xed7c=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xd7ce[_0x254d9f];return _0x1eedb9;};'use strict';var pdf=require(_0xed7c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed7c('0x1'));var zipdir=require(_0xed7c('0x2'));var jsonpatch=require(_0xed7c('0x3'));var rp=require(_0xed7c('0x4'));var moment=require(_0xed7c('0x5'));var BPromise=require(_0xed7c('0x6'));var Mustache=require(_0xed7c('0x7'));var util=require(_0xed7c('0x8'));var path=require(_0xed7c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xed7c('0xa'));var crypto=require(_0xed7c('0xb'));var jsforce=require(_0xed7c('0xc'));var deskjs=require(_0xed7c('0xd'));var toCsv=require(_0xed7c('0xe'));var querystring=require(_0xed7c('0xf'));var Papa=require(_0xed7c('0x10'));var Redis=require(_0xed7c('0x11'));var authService=require(_0xed7c('0x12'));var qs=require(_0xed7c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed7c('0x14'));var utils=require(_0xed7c('0x15'));var config=require(_0xed7c('0x16'));var db=require(_0xed7c('0x17'))['db'];config['redis']=_[_0xed7c('0x18')](config[_0xed7c('0x19')],{'host':_0xed7c('0x1a'),'port':0x18eb});var socket=require(_0xed7c('0x1b'))(new Redis(config[_0xed7c('0x19')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x42d61e,_0x4e11b0){_0x4e11b0=_0x4e11b0||0xcc;return function(_0x19ab51){if(_0x19ab51){return _0x42d61e[_0xed7c('0x1c')](_0x4e11b0);}return _0x42d61e[_0xed7c('0x1d')](_0x4e11b0)[_0xed7c('0x1e')]();};}function respondWithResult(_0x1d6087,_0x4c0d45){_0x4c0d45=_0x4c0d45||0xc8;return function(_0x238d7c){if(_0x238d7c){return _0x1d6087[_0xed7c('0x1d')](_0x4c0d45)[_0xed7c('0x1f')](_0x238d7c);}};}function respondWithFilteredResult(_0x5debd9,_0x108941){return function(_0x1d7b12){if(_0x1d7b12){var _0x138cc6=_0x1d7b12['count'],_0x4cccc2=_0x108941[_0xed7c('0x20')],_0x105586=_0x108941['offset']+_0x108941[_0xed7c('0x21')],_0x1c8992;if(_0x105586>=_0x138cc6){_0x105586=_0x138cc6;_0x1c8992=0xc8;}else{_0x1c8992=0xce;}_0x5debd9[_0xed7c('0x1d')](_0x1c8992);return _0x5debd9['set'](_0xed7c('0x22'),_0x4cccc2+'-'+_0x105586+'/'+_0x138cc6)[_0xed7c('0x1f')](_0x1d7b12);}return null;};}function patchUpdates(_0x1b8bdf){return function(_0x3daa8e){try{jsonpatch[_0xed7c('0x23')](_0x3daa8e,_0x1b8bdf,!![]);}catch(_0xf78f04){return BPromise[_0xed7c('0x24')](_0xf78f04);}return _0x3daa8e[_0xed7c('0x25')]();};}function saveUpdates(_0x33cdf0,_0x193dc5){return function(_0x4a2bab){if(_0x4a2bab){return _0x4a2bab[_0xed7c('0x26')](_0x33cdf0)[_0xed7c('0x27')](function(_0x460862){return _0x460862;});}return null;};}function removeEntity(_0x579a41,_0x338f3e){return function(_0x1ebd83){if(_0x1ebd83){return _0x1ebd83[_0xed7c('0x28')]()[_0xed7c('0x27')](function(){var _0xcdc69e=_0x1ebd83[_0xed7c('0x29')]({'plain':!![]});var _0x4f4815='Lists';return db['UserProfileResource'][_0xed7c('0x28')]({'where':{'type':_0x4f4815,'resourceId':_0xcdc69e['id']}})['then'](function(){return _0x1ebd83;});})['then'](function(){_0x579a41[_0xed7c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ba35d,_0x53f449){return function(_0x4e7d26){if(!_0x4e7d26){_0x2ba35d[_0xed7c('0x1c')](0x194);}return _0x4e7d26;};}function handleError(_0x34564d,_0x923a47){_0x923a47=_0x923a47||0x1f4;return function(_0x562972){logger[_0xed7c('0x2a')](_0x562972['stack']);if(_0x562972[_0xed7c('0x2b')]){delete _0x562972[_0xed7c('0x2b')];}_0x34564d[_0xed7c('0x1d')](_0x923a47)[_0xed7c('0x2c')](_0x562972);};}exports[_0xed7c('0x2d')]=function(_0x4e035a,_0x3c1f32){var _0x3a400a={},_0x314085={},_0x585139={'count':0x0,'rows':[]};var _0x15907c=db[_0xed7c('0x2e')][_0xed7c('0x2f')];_0x314085[_0xed7c('0x30')]=_[_0xed7c('0x31')](_0x15907c);_0x314085[_0xed7c('0x32')]=_[_0xed7c('0x31')](_0x4e035a[_0xed7c('0x32')]);_0x314085['filters']=_['intersection'](_0x314085['model'],_0x314085[_0xed7c('0x32')]);_0x3a400a[_0xed7c('0x33')]=_[_0xed7c('0x34')](_0x314085[_0xed7c('0x30')],qs[_0xed7c('0x35')](_0x4e035a[_0xed7c('0x32')]['fields']));_0x3a400a[_0xed7c('0x33')]=_0x3a400a[_0xed7c('0x33')][_0xed7c('0x36')]?_0x3a400a[_0xed7c('0x33')]:_0x314085[_0xed7c('0x30')];if(!_0x4e035a[_0xed7c('0x32')][_0xed7c('0x37')](_0xed7c('0x38'))){_0x3a400a['limit']=qs[_0xed7c('0x21')](_0x4e035a[_0xed7c('0x32')][_0xed7c('0x21')]);_0x3a400a['offset']=qs[_0xed7c('0x20')](_0x4e035a[_0xed7c('0x32')][_0xed7c('0x20')]);}_0x3a400a[_0xed7c('0x39')]=qs[_0xed7c('0x3a')](_0x4e035a[_0xed7c('0x32')]['sort']);_0x3a400a[_0xed7c('0x3b')]=qs['filters'](_['pick'](_0x4e035a[_0xed7c('0x32')],_0x314085[_0xed7c('0x3c')]));if(_0x4e035a[_0xed7c('0x32')][_0xed7c('0x3d')]){_0x3a400a[_0xed7c('0x3b')]=_['merge'](_0x3a400a['where'],{'$or':_[_0xed7c('0x3e')](_0x15907c,function(_0x4cd74c){if(_0x4cd74c[_0xed7c('0x3f')][_0xed7c('0x40')]!==_0xed7c('0x41')){var _0x505fc8={};_0x505fc8[_0x4cd74c[_0xed7c('0x42')]]={'$like':'%'+_0x4e035a['query'][_0xed7c('0x3d')]+'%'};return _0x505fc8;}})});}_0x3a400a=_[_0xed7c('0x43')]({},_0x3a400a,_0x4e035a['options']);var _0x336974={'where':_0x3a400a[_0xed7c('0x3b')]};return db[_0xed7c('0x2e')][_0xed7c('0x44')](_0x336974)[_0xed7c('0x27')](function(_0x331612){_0x585139[_0xed7c('0x44')]=_0x331612;if(_0x4e035a[_0xed7c('0x32')][_0xed7c('0x45')]){_0x3a400a['include']=[{'all':!![]}];}return db[_0xed7c('0x2e')][_0xed7c('0x46')](_0x3a400a);})[_0xed7c('0x27')](function(_0x3a053f){_0x585139[_0xed7c('0x47')]=_0x3a053f;return _0x585139;})[_0xed7c('0x27')](respondWithFilteredResult(_0x3c1f32,_0x3a400a))['catch'](handleError(_0x3c1f32,null));};exports['show']=function(_0x323e75,_0x4736a1){var _0x9b7b9a={'raw':![],'where':{'id':_0x323e75[_0xed7c('0x48')]['id']}},_0x326d5b={};_0x326d5b[_0xed7c('0x30')]=_[_0xed7c('0x31')](db[_0xed7c('0x2e')]['rawAttributes']);_0x326d5b[_0xed7c('0x32')]=_[_0xed7c('0x31')](_0x323e75[_0xed7c('0x32')]);_0x326d5b[_0xed7c('0x3c')]=_[_0xed7c('0x34')](_0x326d5b[_0xed7c('0x30')],_0x326d5b[_0xed7c('0x32')]);_0x9b7b9a['attributes']=_[_0xed7c('0x34')](_0x326d5b['model'],qs[_0xed7c('0x35')](_0x323e75['query']['fields']));_0x9b7b9a[_0xed7c('0x33')]=_0x9b7b9a[_0xed7c('0x33')][_0xed7c('0x36')]?_0x9b7b9a[_0xed7c('0x33')]:_0x326d5b['model'];if(_0x323e75[_0xed7c('0x32')]['includeAll']){_0x9b7b9a[_0xed7c('0x49')]=[{'all':!![]}];}_0x9b7b9a=_['merge']({},_0x9b7b9a,_0x323e75[_0xed7c('0x4a')]);return db[_0xed7c('0x2e')][_0xed7c('0x4b')](_0x9b7b9a)['then'](handleEntityNotFound(_0x4736a1,null))[_0xed7c('0x27')](respondWithResult(_0x4736a1,null))[_0xed7c('0x4c')](handleError(_0x4736a1,null));};exports[_0xed7c('0x4d')]=function(_0x5643dc,_0x280d78){return db[_0xed7c('0x2e')][_0xed7c('0x4d')](_0x5643dc[_0xed7c('0x4e')],{})['then'](function(_0x2e1bc6){var _0x18f0e9=_0x5643dc[_0xed7c('0x4f')]['get']({'plain':!![]});if(!_0x18f0e9)throw new Error(_0xed7c('0x50'));if(_0x18f0e9[_0xed7c('0x51')]==='user'){var _0x40e093=_0x2e1bc6[_0xed7c('0x29')]({'plain':!![]});var _0x2437d3=_0xed7c('0x52');return db[_0xed7c('0x53')][_0xed7c('0x4b')]({'where':{'name':_0x2437d3,'userProfileId':_0x18f0e9['userProfileId']},'raw':!![]})['then'](function(_0x55e5d6){if(_0x55e5d6&&_0x55e5d6[_0xed7c('0x54')]===0x0){return db[_0xed7c('0x55')][_0xed7c('0x4d')]({'name':_0x40e093[_0xed7c('0x2b')],'resourceId':_0x40e093['id'],'type':_0x55e5d6[_0xed7c('0x2b')],'sectionId':_0x55e5d6['id']},{})[_0xed7c('0x27')](function(){return _0x2e1bc6;});}else{return _0x2e1bc6;}})[_0xed7c('0x4c')](function(_0x4f1513){logger['error'](_0xed7c('0x56'),_0x4f1513);throw _0x4f1513;});}return _0x2e1bc6;})['then'](respondWithResult(_0x280d78,0xc9))['catch'](handleError(_0x280d78,null));};exports[_0xed7c('0x26')]=function(_0x57fa1f,_0x1f9f0d){if(_0x57fa1f[_0xed7c('0x4e')]['id']){delete _0x57fa1f[_0xed7c('0x4e')]['id'];}return db[_0xed7c('0x2e')]['find']({'where':{'id':_0x57fa1f[_0xed7c('0x48')]['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x1f9f0d,null))['then'](saveUpdates(_0x57fa1f[_0xed7c('0x4e')],null))[_0xed7c('0x27')](respondWithResult(_0x1f9f0d,null))['catch'](handleError(_0x1f9f0d,null));};exports['destroy']=function(_0x4d6f54,_0xe6ccac){return db[_0xed7c('0x2e')][_0xed7c('0x4b')]({'where':{'id':_0x4d6f54['params']['id']}})['then'](handleEntityNotFound(_0xe6ccac,null))[_0xed7c('0x27')](removeEntity(_0xe6ccac,null))[_0xed7c('0x4c')](handleError(_0xe6ccac,null));};exports[_0xed7c('0x57')]=function(_0x12b6b4,_0x1bf82a){return db[_0xed7c('0x2e')][_0xed7c('0x57')]()[_0xed7c('0x27')](respondWithResult(_0x1bf82a,null))[_0xed7c('0x4c')](handleError(_0x1bf82a,null));};exports['addDisposition']=function(_0x12e844,_0x1020d5,_0x52d40d){if(_0x12e844['body']['id']){delete _0x12e844['body']['id'];}return db[_0xed7c('0x2e')][_0xed7c('0x4b')]({'where':{'id':_0x12e844['params']['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x1020d5,null))[_0xed7c('0x27')](function(_0x2287c4){if(_0x2287c4){_0x12e844['body'][_0xed7c('0x58')]=_0x2287c4['id'];return db[_0xed7c('0x59')]['create'](_0x12e844['body']);}})['then'](respondWithResult(_0x1020d5,null))[_0xed7c('0x4c')](handleError(_0x1020d5,null));};exports['getDispositions']=function(_0x443acd,_0x47fc25,_0x44110d){var _0x1dd169={'raw':![],'where':{}};var _0x3340c2={};var _0x4da485={'count':0x0,'rows':[]};return db[_0xed7c('0x2e')][_0xed7c('0x5a')]({'where':{'id':_0x443acd['params']['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x47fc25,null))[_0xed7c('0x27')](function(_0x51edaa){if(_0x51edaa){_0x3340c2[_0xed7c('0x30')]=_[_0xed7c('0x31')](db[_0xed7c('0x59')][_0xed7c('0x2f')]);_0x3340c2['query']=_[_0xed7c('0x31')](_0x443acd[_0xed7c('0x32')]);_0x3340c2['filters']=_[_0xed7c('0x34')](_0x3340c2[_0xed7c('0x30')],_0x3340c2['query']);_0x1dd169[_0xed7c('0x33')]=_['intersection'](_0x3340c2[_0xed7c('0x30')],qs[_0xed7c('0x35')](_0x443acd[_0xed7c('0x32')][_0xed7c('0x35')]));_0x1dd169['attributes']=_0x1dd169[_0xed7c('0x33')][_0xed7c('0x36')]?_0x1dd169[_0xed7c('0x33')]:_0x3340c2[_0xed7c('0x30')];if(!_0x443acd[_0xed7c('0x32')]['hasOwnProperty'](_0xed7c('0x38'))){_0x1dd169[_0xed7c('0x21')]=qs[_0xed7c('0x21')](_0x443acd[_0xed7c('0x32')][_0xed7c('0x21')]);_0x1dd169[_0xed7c('0x20')]=qs[_0xed7c('0x20')](_0x443acd[_0xed7c('0x32')][_0xed7c('0x20')]);}_0x1dd169[_0xed7c('0x39')]=qs[_0xed7c('0x3a')](_0x443acd[_0xed7c('0x32')][_0xed7c('0x3a')]);_0x1dd169[_0xed7c('0x3b')]=qs['filters'](_[_0xed7c('0x5b')](_0x443acd[_0xed7c('0x32')],_0x3340c2[_0xed7c('0x3c')]));_0x1dd169[_0xed7c('0x3b')][_0xed7c('0x58')]=_0x51edaa['id'];if(_0x443acd[_0xed7c('0x32')][_0xed7c('0x3d')]){_0x1dd169[_0xed7c('0x3b')]=_[_0xed7c('0x43')](_0x1dd169[_0xed7c('0x3b')],{'$or':_[_0xed7c('0x3e')](_0x1dd169[_0xed7c('0x33')],function(_0x3d0b09){var _0x5cb653={};_0x5cb653[_0x3d0b09]={'$like':'%'+_0x443acd['query']['filter']+'%'};return _0x5cb653;})});}_0x1dd169=_[_0xed7c('0x43')]({},_0x1dd169,_0x443acd[_0xed7c('0x4a')]);return db[_0xed7c('0x59')]['count']({'where':_0x1dd169[_0xed7c('0x3b')]})[_0xed7c('0x27')](function(_0x2cf485){_0x4da485[_0xed7c('0x44')]=_0x2cf485;if(_0x443acd[_0xed7c('0x32')][_0xed7c('0x45')]){_0x1dd169[_0xed7c('0x49')]=[{'all':!![]}];}return db[_0xed7c('0x59')][_0xed7c('0x46')](_0x1dd169);})['then'](function(_0x4cb2c3){_0x4da485[_0xed7c('0x47')]=_0x4cb2c3;return _0x4da485;});}})['then'](respondWithFilteredResult(_0x47fc25,_0x1dd169))['catch'](handleError(_0x47fc25,null));};exports[_0xed7c('0x5c')]=function(_0x5361b6,_0x2e1596,_0x2cd994){return db[_0xed7c('0x2e')][_0xed7c('0x4b')]({'where':{'id':_0x5361b6[_0xed7c('0x48')]['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x2e1596,null))[_0xed7c('0x27')](function(_0xbe8359){if(_0xbe8359){return _0xbe8359[_0xed7c('0x5c')](_0x5361b6['query'][_0xed7c('0x5d')]);}})[_0xed7c('0x27')](respondWithStatusCode(_0x2e1596,null))[_0xed7c('0x4c')](handleError(_0x2e1596,null));};exports[_0xed7c('0x5e')]=function(_0x141006,_0x2ec668,_0x1cfdad){return db[_0xed7c('0x2e')][_0xed7c('0x4b')]({'where':{'id':_0x141006[_0xed7c('0x48')]['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x2ec668,null))[_0xed7c('0x27')](function(_0x1c3267){if(_0x1c3267){var _0x4cb9ad=[];var _0x186304={'success':[],'errors':[]};return db[_0xed7c('0x5f')][_0xed7c('0x57')]()[_0xed7c('0x27')](function(_0x2660c0){if(_0x141006[_0xed7c('0x4e')]['tags']&&_[_0xed7c('0x60')](_0x141006[_0xed7c('0x4e')]['tags'])){if(_0x141006['body'][_0xed7c('0x61')]['length']){_0x141006[_0xed7c('0x4e')][_0xed7c('0x61')]=_0x141006[_0xed7c('0x4e')][_0xed7c('0x61')][_0xed7c('0x62')](';')+';';}else{_0x141006[_0xed7c('0x4e')]['tags']=null;}}else{_0x141006[_0xed7c('0x4e')][_0xed7c('0x61')]=null;}if(_0x141006[_0xed7c('0x4e')]&&_[_0xed7c('0x60')](_0x141006[_0xed7c('0x4e')])){for(var _0xa2850d=0x0;_0xa2850d<_0x141006[_0xed7c('0x4e')][_0xed7c('0x36')];_0xa2850d+=0x1){_0x141006['body'][_0xa2850d]['ListId']=_0x141006[_0xed7c('0x48')]['id'];_0x4cb9ad[_0xed7c('0x63')](_0x141006['body'][_0xa2850d]);}return BPromise[_0xed7c('0x64')](_0x4cb9ad,function(_0xfe44c4){return db[_0xed7c('0x5f')][_0xed7c('0x4d')](_[_0xed7c('0x65')](_0xfe44c4,[_0xed7c('0x5d'),'id'])||{},{'fields':_[_0xed7c('0x31')](_0x2660c0),'raw':!![]})[_0xed7c('0x27')](function(_0x446d75){_0x186304['success'][_0xed7c('0x63')](_0x446d75[_0xed7c('0x66')]);})[_0xed7c('0x4c')](function(_0x1778e6){_0x186304[_0xed7c('0x67')][_0xed7c('0x63')]({'data':_0xfe44c4,'error':_0x1778e6[_0xed7c('0x68')]});});})[_0xed7c('0x27')](function(_0x5d7467){return _0x186304;})['catch'](function(_0x2a1ca9){return _0x2a1ca9;});}else{_0x2ec668[_0xed7c('0x1d')](0x190)[_0xed7c('0x1f')]({'message':_0xed7c('0x69')});}});}})[_0xed7c('0x27')](respondWithResult(_0x2ec668,null))[_0xed7c('0x4c')](handleError(_0x2ec668,null));};exports['getContacts']=function(_0x213921,_0x23946f,_0x227f09){var _0x40be06;return db[_0xed7c('0x2e')][_0xed7c('0x4b')]({'where':{'id':_0x213921[_0xed7c('0x48')]['id']},'include':[{'model':db[_0xed7c('0x6a')],'as':_0xed7c('0x6b')}]})[_0xed7c('0x27')](handleEntityNotFound(_0x23946f,null))[_0xed7c('0x27')](function(_0x46355e){if(_0x46355e){_0x40be06=_0x46355e;return db['CmContact'][_0xed7c('0x2f')];}})['then'](function(_0x314aaa){if(_0x314aaa){var _0x1979a0={};var _0x387a41={};_0x387a41[_0xed7c('0x30')]=_[_0xed7c('0x6c')](_[_0xed7c('0x31')](_0x314aaa),_[_0xed7c('0x3e')](_0x40be06['CustomFields'],function(_0x50bb96){return util[_0xed7c('0x6d')](_0xed7c('0x6e'),_0x50bb96['id']);}));_0x387a41[_0xed7c('0x32')]=_[_0xed7c('0x31')](_0x213921['query']);_0x387a41[_0xed7c('0x3c')]=_[_0xed7c('0x34')](_0x387a41[_0xed7c('0x30')],_0x387a41[_0xed7c('0x32')]);_0x1979a0['attributes']=_[_0xed7c('0x34')](_0x387a41[_0xed7c('0x30')],qs[_0xed7c('0x35')](_0x213921[_0xed7c('0x32')][_0xed7c('0x35')]));_0x1979a0[_0xed7c('0x33')]=_0x1979a0['attributes']['length']?_0x1979a0[_0xed7c('0x33')]:_0x387a41[_0xed7c('0x30')];if(!_0x213921['query'][_0xed7c('0x37')](_0xed7c('0x38'))){_0x1979a0['limit']=qs[_0xed7c('0x21')](_0x213921['query'][_0xed7c('0x21')]);_0x1979a0[_0xed7c('0x20')]=qs[_0xed7c('0x20')](_0x213921[_0xed7c('0x32')]['offset']);}_0x1979a0[_0xed7c('0x39')]=qs[_0xed7c('0x3a')](_0x213921[_0xed7c('0x32')][_0xed7c('0x3a')]);_0x1979a0[_0xed7c('0x3b')]=qs['filters'](_['pick'](_0x213921[_0xed7c('0x32')],_0x387a41[_0xed7c('0x3c')]));_0x1979a0[_0xed7c('0x6f')]=!![];if(_0x213921[_0xed7c('0x32')][_0xed7c('0x3d')]){_0x1979a0[_0xed7c('0x3b')]=_[_0xed7c('0x43')](_0x1979a0[_0xed7c('0x3b')],{'$or':_[_0xed7c('0x3e')](_0x1979a0[_0xed7c('0x33')],function(_0x2a044b){var _0x5cff9b={};_0x5cff9b[_0x2a044b]={'$like':'%'+_0x213921['query'][_0xed7c('0x3d')]+'%'};return _0x5cff9b;})});}_0x1979a0=_['merge']({},_0x1979a0,_0x213921[_0xed7c('0x4a')]);return _0x40be06[_0xed7c('0x70')](_0x1979a0);}})[_0xed7c('0x27')](respondWithResult(_0x23946f,null))[_0xed7c('0x4c')](handleError(_0x23946f,null));};exports[_0xed7c('0x71')]=function(_0x588493,_0x190861,_0x20c671){var _0x45864b;return db[_0xed7c('0x2e')][_0xed7c('0x4b')]({'where':{'id':_0x588493['params']['id']},'include':[{'model':db[_0xed7c('0x6a')],'as':_0xed7c('0x6b')}]})['then'](handleEntityNotFound(_0x190861,null))[_0xed7c('0x27')](function(_0xb88b14){if(_0xb88b14){_0x45864b=_0xb88b14;return db[_0xed7c('0x5f')][_0xed7c('0x2f')];}})[_0xed7c('0x27')](function(_0x15ad90){if(_0x15ad90){var _0x41caa9={};var _0x247acd={};_0x247acd['model']=_[_0xed7c('0x6c')](_[_0xed7c('0x31')](_0x15ad90),_['map'](_0x45864b['CustomFields'],function(_0x2119ac){return util['format']('cf_%d',_0x2119ac['id']);}));_0x247acd['query']=_[_0xed7c('0x31')](_0x588493[_0xed7c('0x32')]);_0x247acd['filters']=_[_0xed7c('0x34')](_0x247acd[_0xed7c('0x30')],_0x247acd[_0xed7c('0x32')]);_0x41caa9['attributes']=_[_0xed7c('0x34')](_0x247acd['model'],qs[_0xed7c('0x35')](_0x588493['query']['fields']));_0x41caa9[_0xed7c('0x33')]=_0x41caa9[_0xed7c('0x33')]['length']?_0x41caa9[_0xed7c('0x33')]:_0x247acd[_0xed7c('0x30')];if(!_0x588493[_0xed7c('0x32')][_0xed7c('0x37')](_0xed7c('0x38'))){_0x41caa9[_0xed7c('0x21')]=qs[_0xed7c('0x21')](_0x588493[_0xed7c('0x32')][_0xed7c('0x21')]);_0x41caa9['offset']=qs['offset'](_0x588493[_0xed7c('0x32')][_0xed7c('0x20')]);}_0x41caa9[_0xed7c('0x39')]=qs[_0xed7c('0x3a')](_0x588493['query']['sort']);_0x41caa9['where']=qs[_0xed7c('0x3c')](_[_0xed7c('0x5b')](_0x588493[_0xed7c('0x32')],_0x247acd[_0xed7c('0x3c')]));_0x41caa9[_0xed7c('0x6f')]=!![];if(_0x588493[_0xed7c('0x32')][_0xed7c('0x3d')]){_0x41caa9[_0xed7c('0x3b')]=_[_0xed7c('0x43')](_0x41caa9['where'],{'$or':_[_0xed7c('0x3e')](_0x41caa9['attributes'],function(_0x1b7962){var _0x4cb5a9={};_0x4cb5a9[_0x1b7962]={'$like':'%'+_0x588493[_0xed7c('0x32')]['filter']+'%'};return _0x4cb5a9;})});}_0x41caa9=_[_0xed7c('0x43')]({},_0x41caa9,_0x588493[_0xed7c('0x4a')]);return _0x45864b['getContacts'](_0x41caa9);}})[_0xed7c('0x27')](function(_0x39c68a){if(!_['isEmpty'](_0x39c68a)){var _0x3b4597=toCsv(_0x39c68a);var _0x471fbd=Date[_0xed7c('0x72')]();fs['writeFileSync'](util[_0xed7c('0x6d')](_0xed7c('0x73'),_0x45864b['id'],_0x471fbd),_0x3b4597);_0x190861[_0xed7c('0x74')](_0xed7c('0x75'),_0xed7c('0x76')+util[_0xed7c('0x6d')](_0xed7c('0x77'),_0x45864b['id'],_0x471fbd));_0x190861['setHeader'](_0xed7c('0x78'),_0xed7c('0x79'));return _0x190861[_0xed7c('0x7a')](util[_0xed7c('0x6d')](_0xed7c('0x73'),_0x45864b['id'],_0x471fbd));}else{return _0x190861[_0xed7c('0x1c')](0xcc);}})[_0xed7c('0x4c')](handleError(_0x190861,null));};exports['addCustomField']=function(_0x3ffb71,_0x53b38e,_0x33ddc9){var _0x396e2d;delete _0x3ffb71[_0xed7c('0x4e')]['id'];return db[_0xed7c('0x2e')]['findOne']({'where':{'id':_0x3ffb71['params']['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x53b38e,null))[_0xed7c('0x27')](function(_0x2b462e){if(_0x2b462e){return db[_0xed7c('0x7b')][_0xed7c('0x7c')](function(_0x463d72){return db['CmCustomField']['create'](_0x3ffb71[_0xed7c('0x4e')],{'transaction':_0x463d72})[_0xed7c('0x27')](function(_0x393cae){_0x396e2d=_0x393cae;return _0x2b462e['addCustomFields'](_0x393cae,{'transaction':_0x463d72});})[_0xed7c('0x27')](function(){var _0x4c587e={'type':db[_0xed7c('0x7d')][_0xed7c('0x7e')],'transaction':_0x463d72};switch(_0x3ffb71['body'][_0xed7c('0x3f')]){case _0xed7c('0x7f'):_0x4c587e['type']=db[_0xed7c('0x7d')][_0xed7c('0x7e')];break;case _0xed7c('0x80'):_0x4c587e[_0xed7c('0x3f')]=db[_0xed7c('0x7d')][_0xed7c('0x81')];break;case _0xed7c('0x82'):_0x4c587e[_0xed7c('0x3f')]=db[_0xed7c('0x7d')][_0xed7c('0x83')];_0x4c587e['defaultValue']=![];break;default:}return db[_0xed7c('0x7b')]['queryInterface']['addColumn'](_0xed7c('0x84'),util[_0xed7c('0x6d')](_0xed7c('0x85'),_0x396e2d['id']),_0x4c587e);})[_0xed7c('0x27')](function(){return _0x396e2d;});});}})['then'](respondWithResult(_0x53b38e,null))[_0xed7c('0x4c')](handleError(_0x53b38e,null));};exports[_0xed7c('0x86')]=function(_0x396905,_0x5c6fe8,_0x35de1b){var _0x1eb5f6={};var _0x565d22={};var _0x3cb7e1;var _0xd5016c;return db[_0xed7c('0x2e')]['findOne']({'where':{'id':_0x396905[_0xed7c('0x48')]['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x5c6fe8,null))[_0xed7c('0x27')](function(_0x2db943){if(_0x2db943){_0x3cb7e1=_0x2db943;_0x565d22[_0xed7c('0x30')]=_[_0xed7c('0x31')](db[_0xed7c('0x6a')][_0xed7c('0x2f')]);_0x565d22['query']=_[_0xed7c('0x31')](_0x396905['query']);_0x565d22['filters']=_[_0xed7c('0x34')](_0x565d22['model'],_0x565d22[_0xed7c('0x32')]);_0x1eb5f6[_0xed7c('0x33')]=_[_0xed7c('0x34')](_0x565d22['model'],qs[_0xed7c('0x35')](_0x396905[_0xed7c('0x32')][_0xed7c('0x35')]));_0x1eb5f6[_0xed7c('0x33')]=_0x1eb5f6[_0xed7c('0x33')]['length']?_0x1eb5f6[_0xed7c('0x33')]:_0x565d22[_0xed7c('0x30')];_0x1eb5f6[_0xed7c('0x39')]=qs[_0xed7c('0x3a')](_0x396905['query'][_0xed7c('0x3a')]);_0x1eb5f6['where']=qs[_0xed7c('0x3c')](_[_0xed7c('0x5b')](_0x396905[_0xed7c('0x32')],_0x565d22[_0xed7c('0x3c')]));_0x1eb5f6[_0xed7c('0x3b')]=_[_0xed7c('0x43')](_0x1eb5f6[_0xed7c('0x3b')],{'$or':[{'ListId':_0x2db943['id']},{'ListId':null}]});if(_0x396905['query'][_0xed7c('0x3d')]){_0x1eb5f6['where']=_[_0xed7c('0x43')](_0x1eb5f6[_0xed7c('0x3b')],{'$or':_[_0xed7c('0x3e')](_0x1eb5f6[_0xed7c('0x33')],function(_0x4adad5){var _0x518d57={};_0x518d57[_0x4adad5]={'$like':'%'+_0x396905[_0xed7c('0x32')][_0xed7c('0x3d')]+'%'};return _0x518d57;})});}_0x1eb5f6=_['merge']({},_0x1eb5f6,_0x396905[_0xed7c('0x4a')]);return db['CmCustomField'][_0xed7c('0x87')](_0x1eb5f6);}})[_0xed7c('0x27')](respondWithResult(_0x5c6fe8,null))[_0xed7c('0x4c')](handleError(_0x5c6fe8,null));};exports[_0xed7c('0x88')]=function(_0x388306,_0x5d408d,_0x45b583){return db[_0xed7c('0x2e')][_0xed7c('0x4b')]({'where':{'id':_0x388306[_0xed7c('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d408d,null))[_0xed7c('0x27')](function(_0x515416){if(_0x515416){return _0x515416[_0xed7c('0x88')](_0x388306['body'][_0xed7c('0x5d')],_[_0xed7c('0x65')](_0x388306[_0xed7c('0x4e')],[_0xed7c('0x5d'),'id'])||{})[_0xed7c('0x89')](function(_0x143836){for(var _0x35d14e=0x0;_0x35d14e<_0x388306[_0xed7c('0x4e')]['ids'][_0xed7c('0x36')];_0x35d14e+=0x1){socket[_0xed7c('0x8a')](_0xed7c('0x8b'),{'UserId':_0x388306['body'][_0xed7c('0x5d')][_0x35d14e],'CmListId':_0x388306[_0xed7c('0x48')]['id']});}return _0x143836;});}})['then'](respondWithResult(_0x5d408d,null))['catch'](handleError(_0x5d408d,null));};exports['removeAgents']=function(_0x1f97f9,_0x556db0,_0x6a032c){return db[_0xed7c('0x2e')]['find']({'where':{'id':_0x1f97f9['params']['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x556db0,null))['then'](function(_0x4a1b6b){if(_0x4a1b6b){return _0x4a1b6b[_0xed7c('0x8c')](_0x1f97f9['query'][_0xed7c('0x5d')])['then'](function(){if(_[_0xed7c('0x60')](_0x1f97f9['query']['ids'])){for(var _0x4e01c8=0x0;_0x4e01c8<_0x1f97f9[_0xed7c('0x32')][_0xed7c('0x5d')][_0xed7c('0x36')];_0x4e01c8+=0x1){socket[_0xed7c('0x8a')](_0xed7c('0x8d'),{'UserId':Number(_0x1f97f9[_0xed7c('0x32')][_0xed7c('0x5d')][_0x4e01c8]),'CmListId':Number(_0x1f97f9[_0xed7c('0x48')]['id'])});}}else{socket[_0xed7c('0x8a')](_0xed7c('0x8d'),{'UserId':Number(_0x1f97f9[_0xed7c('0x32')]['ids']),'CmListId':Number(_0x1f97f9[_0xed7c('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x556db0,null))['catch'](handleError(_0x556db0,null));};exports['getAgents']=function(_0x5709fa,_0x3a0a52,_0x134b20){var _0x13e991={};var _0x39e110={};var _0x41e872;var _0x125b1f;return db[_0xed7c('0x2e')]['findOne']({'where':{'id':_0x5709fa[_0xed7c('0x48')]['id']}})[_0xed7c('0x27')](handleEntityNotFound(_0x3a0a52,null))['then'](function(_0x33adfc){if(_0x33adfc){_0x41e872=_0x33adfc;_0x39e110[_0xed7c('0x30')]=_[_0xed7c('0x31')](db[_0xed7c('0x8e')][_0xed7c('0x2f')]);_0x39e110['query']=_[_0xed7c('0x31')](_0x5709fa[_0xed7c('0x32')]);_0x39e110[_0xed7c('0x3c')]=_[_0xed7c('0x34')](_0x39e110['model'],_0x39e110['query']);_0x13e991['attributes']=_['intersection'](_0x39e110[_0xed7c('0x30')],qs[_0xed7c('0x35')](_0x5709fa[_0xed7c('0x32')][_0xed7c('0x35')]));_0x13e991[_0xed7c('0x33')]=_0x13e991[_0xed7c('0x33')][_0xed7c('0x36')]?_0x13e991['attributes']:_0x39e110['model'];_0x13e991[_0xed7c('0x39')]=qs[_0xed7c('0x3a')](_0x5709fa[_0xed7c('0x32')][_0xed7c('0x3a')]);_0x13e991[_0xed7c('0x3b')]=qs[_0xed7c('0x3c')](_[_0xed7c('0x5b')](_0x5709fa[_0xed7c('0x32')],_0x39e110['filters']));if(_0x5709fa[_0xed7c('0x32')]['filter']){_0x13e991['where']=_[_0xed7c('0x43')](_0x13e991[_0xed7c('0x3b')],{'$or':_['map'](_0x13e991[_0xed7c('0x33')],function(_0x8cffa9){var _0x4cd1f={};_0x4cd1f[_0x8cffa9]={'$like':'%'+_0x5709fa['query']['filter']+'%'};return _0x4cd1f;})});}_0x13e991=_['merge']({},_0x13e991,_0x5709fa['options']);return _0x41e872[_0xed7c('0x8f')](_0x13e991);}})[_0xed7c('0x27')](function(_0x571d92){if(_0x571d92){_0x125b1f=_0x571d92[_0xed7c('0x36')];if(!_0x5709fa[_0xed7c('0x32')][_0xed7c('0x37')](_0xed7c('0x38'))){_0x13e991[_0xed7c('0x21')]=qs[_0xed7c('0x21')](_0x5709fa['query'][_0xed7c('0x21')]);_0x13e991['offset']=qs[_0xed7c('0x20')](_0x5709fa[_0xed7c('0x32')][_0xed7c('0x20')]);}return _0x41e872['getAgents'](_0x13e991);}})[_0xed7c('0x27')](function(_0x4a48e3){if(_0x4a48e3){return _0x4a48e3?{'count':_0x125b1f,'rows':_0x4a48e3}:null;}})['then'](respondWithResult(_0x3a0a52,null))['catch'](handleError(_0x3a0a52,null));}; \ No newline at end of file +var _0x2e10=['stack','index','CmList','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge','map','type','VIRTUAL','field','options','findAll','rows','catch','params','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','ListId','Disposition','getDispositions','findOne','nolimit','pick','filter','includeAll','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','each','omit','success','push','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','cf_%d','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','sequelize','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','Lists'];(function(_0x4ca5d9,_0x57470d){var _0x33c1d1=function(_0x43db1a){while(--_0x43db1a){_0x4ca5d9['push'](_0x4ca5d9['shift']());}};_0x33c1d1(++_0x57470d);}(_0x2e10,0x66));var _0x02e1=function(_0x443a06,_0x2482c9){_0x443a06=_0x443a06-0x0;var _0x47299c=_0x2e10[_0x443a06];return _0x47299c;};'use strict';var pdf=require(_0x02e1('0x0'));var emlformat=require(_0x02e1('0x1'));var rimraf=require(_0x02e1('0x2'));var zipdir=require(_0x02e1('0x3'));var jsonpatch=require(_0x02e1('0x4'));var rp=require(_0x02e1('0x5'));var moment=require(_0x02e1('0x6'));var BPromise=require(_0x02e1('0x7'));var Mustache=require(_0x02e1('0x8'));var util=require(_0x02e1('0x9'));var path=require('path');var sox=require(_0x02e1('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x02e1('0xb'));var squel=require(_0x02e1('0xc'));var crypto=require('crypto');var jsforce=require(_0x02e1('0xd'));var deskjs=require(_0x02e1('0xe'));var toCsv=require(_0x02e1('0xf'));var querystring=require(_0x02e1('0x10'));var Papa=require(_0x02e1('0x11'));var Redis=require(_0x02e1('0x12'));var authService=require(_0x02e1('0x13'));var qs=require(_0x02e1('0x14'));var hardwareService=require(_0x02e1('0x15'));var logger=require(_0x02e1('0x16'))(_0x02e1('0x17'));var utils=require(_0x02e1('0x18'));var config=require(_0x02e1('0x19'));var db=require('../../mysqldb')['db'];config[_0x02e1('0x1a')]=_['defaults'](config[_0x02e1('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x02e1('0x1b'))(new Redis(config[_0x02e1('0x1a')]));require(_0x02e1('0x1c'))[_0x02e1('0x1d')](socket);function respondWithStatusCode(_0x47fa19,_0x51bb0d){_0x51bb0d=_0x51bb0d||0xcc;return function(_0x92820f){if(_0x92820f){return _0x47fa19[_0x02e1('0x1e')](_0x51bb0d);}return _0x47fa19[_0x02e1('0x1f')](_0x51bb0d)[_0x02e1('0x20')]();};}function respondWithResult(_0x376373,_0x309a7b){_0x309a7b=_0x309a7b||0xc8;return function(_0x28f86f){if(_0x28f86f){return _0x376373[_0x02e1('0x1f')](_0x309a7b)[_0x02e1('0x21')](_0x28f86f);}};}function respondWithFilteredResult(_0x30e479,_0x1db4c3){return function(_0xfde923){if(_0xfde923){var _0x494edb=_0xfde923[_0x02e1('0x22')],_0x467913=_0x1db4c3[_0x02e1('0x23')],_0x572693=_0x1db4c3[_0x02e1('0x23')]+_0x1db4c3[_0x02e1('0x24')],_0x2f9e0f;if(_0x572693>=_0x494edb){_0x572693=_0x494edb;_0x2f9e0f=0xc8;}else{_0x2f9e0f=0xce;}_0x30e479[_0x02e1('0x1f')](_0x2f9e0f);return _0x30e479[_0x02e1('0x25')]('Content-Range',_0x467913+'-'+_0x572693+'/'+_0x494edb)[_0x02e1('0x21')](_0xfde923);}return null;};}function patchUpdates(_0x2eeb44){return function(_0x1bfb19){try{jsonpatch[_0x02e1('0x26')](_0x1bfb19,_0x2eeb44,!![]);}catch(_0x20bc10){return BPromise['reject'](_0x20bc10);}return _0x1bfb19[_0x02e1('0x27')]();};}function saveUpdates(_0x3f464f,_0x35687d){return function(_0x18d07f){if(_0x18d07f){return _0x18d07f['update'](_0x3f464f)[_0x02e1('0x28')](function(_0x2656fc){return _0x2656fc;});}return null;};}function removeEntity(_0x1f9940,_0x26b2dd){return function(_0x22f82f){if(_0x22f82f){return _0x22f82f[_0x02e1('0x29')]()[_0x02e1('0x28')](function(){var _0x180225=_0x22f82f['get']({'plain':!![]});var _0x33179c=_0x02e1('0x2a');return db['UserProfileResource'][_0x02e1('0x29')]({'where':{'type':_0x33179c,'resourceId':_0x180225['id']}})['then'](function(){return _0x22f82f;});})[_0x02e1('0x28')](function(){_0x1f9940['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x153db3,_0x5178a2){return function(_0x3d6840){if(!_0x3d6840){_0x153db3[_0x02e1('0x1e')](0x194);}return _0x3d6840;};}function handleError(_0x5c65c0,_0x4bf06a){_0x4bf06a=_0x4bf06a||0x1f4;return function(_0x7bf23d){logger['error'](_0x7bf23d[_0x02e1('0x2b')]);if(_0x7bf23d['name']){delete _0x7bf23d['name'];}_0x5c65c0['status'](_0x4bf06a)['send'](_0x7bf23d);};}exports[_0x02e1('0x2c')]=function(_0x498be5,_0xf5d066){var _0x14544f={},_0x371791={},_0x2da1b6={'count':0x0,'rows':[]};var _0x5886ef=db[_0x02e1('0x2d')][_0x02e1('0x2e')];_0x371791[_0x02e1('0x2f')]=_['keys'](_0x5886ef);_0x371791['query']=_[_0x02e1('0x30')](_0x498be5[_0x02e1('0x31')]);_0x371791[_0x02e1('0x32')]=_[_0x02e1('0x33')](_0x371791[_0x02e1('0x2f')],_0x371791[_0x02e1('0x31')]);_0x14544f['attributes']=_[_0x02e1('0x33')](_0x371791[_0x02e1('0x2f')],qs[_0x02e1('0x34')](_0x498be5[_0x02e1('0x31')][_0x02e1('0x34')]));_0x14544f[_0x02e1('0x35')]=_0x14544f[_0x02e1('0x35')]['length']?_0x14544f[_0x02e1('0x35')]:_0x371791[_0x02e1('0x2f')];if(!_0x498be5[_0x02e1('0x31')][_0x02e1('0x36')]('nolimit')){_0x14544f['limit']=qs[_0x02e1('0x24')](_0x498be5[_0x02e1('0x31')][_0x02e1('0x24')]);_0x14544f[_0x02e1('0x23')]=qs[_0x02e1('0x23')](_0x498be5[_0x02e1('0x31')][_0x02e1('0x23')]);}_0x14544f[_0x02e1('0x37')]=qs[_0x02e1('0x38')](_0x498be5[_0x02e1('0x31')][_0x02e1('0x38')]);_0x14544f[_0x02e1('0x39')]=qs['filters'](_['pick'](_0x498be5[_0x02e1('0x31')],_0x371791[_0x02e1('0x32')]));if(_0x498be5[_0x02e1('0x31')]['filter']){_0x14544f[_0x02e1('0x39')]=_[_0x02e1('0x3a')](_0x14544f['where'],{'$or':_[_0x02e1('0x3b')](_0x5886ef,function(_0x6aa033){if(_0x6aa033[_0x02e1('0x3c')]['key']!==_0x02e1('0x3d')){var _0x4d3f4d={};_0x4d3f4d[_0x6aa033[_0x02e1('0x3e')]]={'$like':'%'+_0x498be5[_0x02e1('0x31')]['filter']+'%'};return _0x4d3f4d;}})});}_0x14544f=_[_0x02e1('0x3a')]({},_0x14544f,_0x498be5[_0x02e1('0x3f')]);var _0x55619a={'where':_0x14544f[_0x02e1('0x39')]};return db['CmList'][_0x02e1('0x22')](_0x55619a)[_0x02e1('0x28')](function(_0x2cd0bc){_0x2da1b6[_0x02e1('0x22')]=_0x2cd0bc;if(_0x498be5[_0x02e1('0x31')]['includeAll']){_0x14544f['include']=[{'all':!![]}];}return db['CmList'][_0x02e1('0x40')](_0x14544f);})[_0x02e1('0x28')](function(_0x3bf9c8){_0x2da1b6[_0x02e1('0x41')]=_0x3bf9c8;return _0x2da1b6;})[_0x02e1('0x28')](respondWithFilteredResult(_0xf5d066,_0x14544f))[_0x02e1('0x42')](handleError(_0xf5d066,null));};exports['show']=function(_0x522c7b,_0x39821f){var _0x545fc5={'raw':![],'where':{'id':_0x522c7b[_0x02e1('0x43')]['id']}},_0x236f86={};_0x236f86[_0x02e1('0x2f')]=_['keys'](db[_0x02e1('0x2d')][_0x02e1('0x2e')]);_0x236f86[_0x02e1('0x31')]=_[_0x02e1('0x30')](_0x522c7b[_0x02e1('0x31')]);_0x236f86[_0x02e1('0x32')]=_['intersection'](_0x236f86['model'],_0x236f86[_0x02e1('0x31')]);_0x545fc5['attributes']=_['intersection'](_0x236f86[_0x02e1('0x2f')],qs['fields'](_0x522c7b[_0x02e1('0x31')][_0x02e1('0x34')]));_0x545fc5[_0x02e1('0x35')]=_0x545fc5[_0x02e1('0x35')][_0x02e1('0x44')]?_0x545fc5[_0x02e1('0x35')]:_0x236f86['model'];if(_0x522c7b[_0x02e1('0x31')]['includeAll']){_0x545fc5[_0x02e1('0x45')]=[{'all':!![]}];}_0x545fc5=_['merge']({},_0x545fc5,_0x522c7b[_0x02e1('0x3f')]);return db[_0x02e1('0x2d')][_0x02e1('0x46')](_0x545fc5)[_0x02e1('0x28')](handleEntityNotFound(_0x39821f,null))['then'](respondWithResult(_0x39821f,null))[_0x02e1('0x42')](handleError(_0x39821f,null));};exports['create']=function(_0x31c472,_0x20aef1){return db['CmList'][_0x02e1('0x47')](_0x31c472[_0x02e1('0x48')],{})['then'](function(_0x192b57){var _0x2ef50a=_0x31c472['user'][_0x02e1('0x49')]({'plain':!![]});if(!_0x2ef50a)throw new Error(_0x02e1('0x4a'));if(_0x2ef50a['role']===_0x02e1('0x4b')){var _0xde84c2=_0x192b57[_0x02e1('0x49')]({'plain':!![]});var _0x2e0356='Lists';return db[_0x02e1('0x4c')][_0x02e1('0x46')]({'where':{'name':_0x2e0356,'userProfileId':_0x2ef50a[_0x02e1('0x4d')]},'raw':!![]})['then'](function(_0x1880e1){if(_0x1880e1&&_0x1880e1[_0x02e1('0x4e')]===0x0){return db[_0x02e1('0x4f')]['create']({'name':_0xde84c2[_0x02e1('0x50')],'resourceId':_0xde84c2['id'],'type':_0x1880e1['name'],'sectionId':_0x1880e1['id']},{})[_0x02e1('0x28')](function(){return _0x192b57;});}else{return _0x192b57;}})['catch'](function(_0x188522){logger['error'](_0x02e1('0x51'),_0x188522);throw _0x188522;});}return _0x192b57;})[_0x02e1('0x28')](respondWithResult(_0x20aef1,0xc9))[_0x02e1('0x42')](handleError(_0x20aef1,null));};exports[_0x02e1('0x52')]=function(_0x24b748,_0x4463fb){if(_0x24b748[_0x02e1('0x48')]['id']){delete _0x24b748[_0x02e1('0x48')]['id'];}return db[_0x02e1('0x2d')][_0x02e1('0x46')]({'where':{'id':_0x24b748[_0x02e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x4463fb,null))[_0x02e1('0x28')](saveUpdates(_0x24b748[_0x02e1('0x48')],null))['then'](respondWithResult(_0x4463fb,null))[_0x02e1('0x42')](handleError(_0x4463fb,null));};exports[_0x02e1('0x29')]=function(_0x37f8ed,_0x151d6d){return db[_0x02e1('0x2d')]['find']({'where':{'id':_0x37f8ed['params']['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x151d6d,null))[_0x02e1('0x28')](removeEntity(_0x151d6d,null))[_0x02e1('0x42')](handleError(_0x151d6d,null));};exports[_0x02e1('0x53')]=function(_0x3e326a,_0x26b99b){return db[_0x02e1('0x2d')][_0x02e1('0x53')]()['then'](respondWithResult(_0x26b99b,null))[_0x02e1('0x42')](handleError(_0x26b99b,null));};exports['addDisposition']=function(_0x4e3243,_0x2b655e,_0x101fdd){if(_0x4e3243['body']['id']){delete _0x4e3243['body']['id'];}return db[_0x02e1('0x2d')][_0x02e1('0x46')]({'where':{'id':_0x4e3243[_0x02e1('0x43')]['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x2b655e,null))[_0x02e1('0x28')](function(_0x2e72d6){if(_0x2e72d6){_0x4e3243['body'][_0x02e1('0x54')]=_0x2e72d6['id'];return db[_0x02e1('0x55')][_0x02e1('0x47')](_0x4e3243['body']);}})[_0x02e1('0x28')](respondWithResult(_0x2b655e,null))[_0x02e1('0x42')](handleError(_0x2b655e,null));};exports[_0x02e1('0x56')]=function(_0x43a148,_0x944c6a,_0x319447){var _0x576adb={'raw':![],'where':{}};var _0x5013f6={};var _0x108358={'count':0x0,'rows':[]};return db[_0x02e1('0x2d')][_0x02e1('0x57')]({'where':{'id':_0x43a148[_0x02e1('0x43')]['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x944c6a,null))[_0x02e1('0x28')](function(_0x451f6e){if(_0x451f6e){_0x5013f6[_0x02e1('0x2f')]=_[_0x02e1('0x30')](db[_0x02e1('0x55')][_0x02e1('0x2e')]);_0x5013f6[_0x02e1('0x31')]=_['keys'](_0x43a148['query']);_0x5013f6[_0x02e1('0x32')]=_[_0x02e1('0x33')](_0x5013f6[_0x02e1('0x2f')],_0x5013f6[_0x02e1('0x31')]);_0x576adb[_0x02e1('0x35')]=_[_0x02e1('0x33')](_0x5013f6[_0x02e1('0x2f')],qs[_0x02e1('0x34')](_0x43a148['query']['fields']));_0x576adb['attributes']=_0x576adb['attributes'][_0x02e1('0x44')]?_0x576adb[_0x02e1('0x35')]:_0x5013f6['model'];if(!_0x43a148[_0x02e1('0x31')]['hasOwnProperty'](_0x02e1('0x58'))){_0x576adb[_0x02e1('0x24')]=qs['limit'](_0x43a148[_0x02e1('0x31')][_0x02e1('0x24')]);_0x576adb[_0x02e1('0x23')]=qs[_0x02e1('0x23')](_0x43a148[_0x02e1('0x31')][_0x02e1('0x23')]);}_0x576adb[_0x02e1('0x37')]=qs['sort'](_0x43a148[_0x02e1('0x31')][_0x02e1('0x38')]);_0x576adb[_0x02e1('0x39')]=qs[_0x02e1('0x32')](_[_0x02e1('0x59')](_0x43a148['query'],_0x5013f6[_0x02e1('0x32')]));_0x576adb['where'][_0x02e1('0x54')]=_0x451f6e['id'];if(_0x43a148[_0x02e1('0x31')][_0x02e1('0x5a')]){_0x576adb[_0x02e1('0x39')]=_[_0x02e1('0x3a')](_0x576adb['where'],{'$or':_[_0x02e1('0x3b')](_0x576adb[_0x02e1('0x35')],function(_0x9f1cbb){var _0x50a8c4={};_0x50a8c4[_0x9f1cbb]={'$like':'%'+_0x43a148[_0x02e1('0x31')][_0x02e1('0x5a')]+'%'};return _0x50a8c4;})});}_0x576adb=_['merge']({},_0x576adb,_0x43a148[_0x02e1('0x3f')]);return db[_0x02e1('0x55')][_0x02e1('0x22')]({'where':_0x576adb['where']})[_0x02e1('0x28')](function(_0xe7ff81){_0x108358[_0x02e1('0x22')]=_0xe7ff81;if(_0x43a148[_0x02e1('0x31')][_0x02e1('0x5b')]){_0x576adb[_0x02e1('0x45')]=[{'all':!![]}];}return db[_0x02e1('0x55')][_0x02e1('0x40')](_0x576adb);})[_0x02e1('0x28')](function(_0x20d919){_0x108358[_0x02e1('0x41')]=_0x20d919;return _0x108358;});}})[_0x02e1('0x28')](respondWithFilteredResult(_0x944c6a,_0x576adb))[_0x02e1('0x42')](handleError(_0x944c6a,null));};exports['removeDispositions']=function(_0x3fa25f,_0x32d79b,_0x578c67){return db['CmList'][_0x02e1('0x46')]({'where':{'id':_0x3fa25f[_0x02e1('0x43')]['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x32d79b,null))['then'](function(_0x3ac3c5){if(_0x3ac3c5){return _0x3ac3c5[_0x02e1('0x5c')](_0x3fa25f[_0x02e1('0x31')][_0x02e1('0x5d')]);}})['then'](respondWithStatusCode(_0x32d79b,null))[_0x02e1('0x42')](handleError(_0x32d79b,null));};exports[_0x02e1('0x5e')]=function(_0x277137,_0x315500,_0x2e2a37){return db[_0x02e1('0x2d')][_0x02e1('0x46')]({'where':{'id':_0x277137['params']['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x315500,null))[_0x02e1('0x28')](function(_0x383daf){if(_0x383daf){var _0x33916f=[];var _0x3e9c1b={'success':[],'errors':[]};return db[_0x02e1('0x5f')][_0x02e1('0x53')]()[_0x02e1('0x28')](function(_0x3ad975){if(_0x277137['body']['tags']&&_[_0x02e1('0x60')](_0x277137[_0x02e1('0x48')][_0x02e1('0x61')])){if(_0x277137['body'][_0x02e1('0x61')][_0x02e1('0x44')]){_0x277137['body'][_0x02e1('0x61')]=_0x277137[_0x02e1('0x48')][_0x02e1('0x61')][_0x02e1('0x62')](';')+';';}else{_0x277137[_0x02e1('0x48')][_0x02e1('0x61')]=null;}}else{_0x277137[_0x02e1('0x48')]['tags']=null;}if(_0x277137['body']&&_[_0x02e1('0x60')](_0x277137[_0x02e1('0x48')])){for(var _0x52a294=0x0;_0x52a294<_0x277137['body'][_0x02e1('0x44')];_0x52a294+=0x1){_0x277137['body'][_0x52a294][_0x02e1('0x54')]=_0x277137[_0x02e1('0x43')]['id'];_0x33916f['push'](_0x277137[_0x02e1('0x48')][_0x52a294]);}return BPromise[_0x02e1('0x63')](_0x33916f,function(_0x198d58){return db[_0x02e1('0x5f')][_0x02e1('0x47')](_[_0x02e1('0x64')](_0x198d58,[_0x02e1('0x5d'),'id'])||{},{'fields':_['keys'](_0x3ad975),'raw':!![]})['then'](function(_0x41bc13){_0x3e9c1b[_0x02e1('0x65')][_0x02e1('0x66')](_0x41bc13['dataValues']);})[_0x02e1('0x42')](function(_0x5282ae){_0x3e9c1b[_0x02e1('0x67')][_0x02e1('0x66')]({'data':_0x198d58,'error':_0x5282ae['message']});});})['then'](function(_0x2c2c9){return _0x3e9c1b;})[_0x02e1('0x42')](function(_0x1b34d0){return _0x1b34d0;});}else{_0x315500['status'](0x190)[_0x02e1('0x21')]({'message':_0x02e1('0x68')});}});}})[_0x02e1('0x28')](respondWithResult(_0x315500,null))[_0x02e1('0x42')](handleError(_0x315500,null));};exports[_0x02e1('0x69')]=function(_0x155dd4,_0x38bcea,_0xacfa4b){var _0x37105c;return db[_0x02e1('0x2d')][_0x02e1('0x46')]({'where':{'id':_0x155dd4[_0x02e1('0x43')]['id']},'include':[{'model':db[_0x02e1('0x6a')],'as':_0x02e1('0x6b')}]})['then'](handleEntityNotFound(_0x38bcea,null))['then'](function(_0x2b037d){if(_0x2b037d){_0x37105c=_0x2b037d;return db[_0x02e1('0x5f')][_0x02e1('0x2e')];}})[_0x02e1('0x28')](function(_0x29139c){if(_0x29139c){var _0x31dbc2={};var _0x12b989={};_0x12b989[_0x02e1('0x2f')]=_[_0x02e1('0x6c')](_[_0x02e1('0x30')](_0x29139c),_[_0x02e1('0x3b')](_0x37105c[_0x02e1('0x6b')],function(_0x70276e){return util[_0x02e1('0x6d')]('cf_%d',_0x70276e['id']);}));_0x12b989['query']=_[_0x02e1('0x30')](_0x155dd4[_0x02e1('0x31')]);_0x12b989[_0x02e1('0x32')]=_[_0x02e1('0x33')](_0x12b989[_0x02e1('0x2f')],_0x12b989[_0x02e1('0x31')]);_0x31dbc2['attributes']=_['intersection'](_0x12b989['model'],qs[_0x02e1('0x34')](_0x155dd4[_0x02e1('0x31')]['fields']));_0x31dbc2[_0x02e1('0x35')]=_0x31dbc2[_0x02e1('0x35')][_0x02e1('0x44')]?_0x31dbc2['attributes']:_0x12b989['model'];if(!_0x155dd4['query'][_0x02e1('0x36')](_0x02e1('0x58'))){_0x31dbc2[_0x02e1('0x24')]=qs[_0x02e1('0x24')](_0x155dd4[_0x02e1('0x31')]['limit']);_0x31dbc2[_0x02e1('0x23')]=qs[_0x02e1('0x23')](_0x155dd4[_0x02e1('0x31')][_0x02e1('0x23')]);}_0x31dbc2[_0x02e1('0x37')]=qs[_0x02e1('0x38')](_0x155dd4[_0x02e1('0x31')][_0x02e1('0x38')]);_0x31dbc2[_0x02e1('0x39')]=qs[_0x02e1('0x32')](_[_0x02e1('0x59')](_0x155dd4['query'],_0x12b989[_0x02e1('0x32')]));_0x31dbc2[_0x02e1('0x6e')]=!![];if(_0x155dd4[_0x02e1('0x31')]['filter']){_0x31dbc2[_0x02e1('0x39')]=_[_0x02e1('0x3a')](_0x31dbc2[_0x02e1('0x39')],{'$or':_[_0x02e1('0x3b')](_0x31dbc2['attributes'],function(_0x5e00e5){var _0x41ab1c={};_0x41ab1c[_0x5e00e5]={'$like':'%'+_0x155dd4[_0x02e1('0x31')][_0x02e1('0x5a')]+'%'};return _0x41ab1c;})});}_0x31dbc2=_[_0x02e1('0x3a')]({},_0x31dbc2,_0x155dd4[_0x02e1('0x3f')]);return _0x37105c['getContacts'](_0x31dbc2);}})['then'](respondWithResult(_0x38bcea,null))[_0x02e1('0x42')](handleError(_0x38bcea,null));};exports[_0x02e1('0x6f')]=function(_0x252e02,_0x52017a,_0x2c2ea0){var _0x54e810;return db[_0x02e1('0x2d')]['find']({'where':{'id':_0x252e02[_0x02e1('0x43')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x02e1('0x6b')}]})[_0x02e1('0x28')](handleEntityNotFound(_0x52017a,null))['then'](function(_0x59d05e){if(_0x59d05e){_0x54e810=_0x59d05e;return db['CmContact'][_0x02e1('0x2e')];}})[_0x02e1('0x28')](function(_0x29070a){if(_0x29070a){var _0x1aa92e={};var _0x12a5c1={};_0x12a5c1['model']=_['concat'](_[_0x02e1('0x30')](_0x29070a),_[_0x02e1('0x3b')](_0x54e810[_0x02e1('0x6b')],function(_0x5d04e7){return util[_0x02e1('0x6d')](_0x02e1('0x70'),_0x5d04e7['id']);}));_0x12a5c1['query']=_[_0x02e1('0x30')](_0x252e02[_0x02e1('0x31')]);_0x12a5c1[_0x02e1('0x32')]=_[_0x02e1('0x33')](_0x12a5c1[_0x02e1('0x2f')],_0x12a5c1[_0x02e1('0x31')]);_0x1aa92e[_0x02e1('0x35')]=_['intersection'](_0x12a5c1['model'],qs[_0x02e1('0x34')](_0x252e02['query'][_0x02e1('0x34')]));_0x1aa92e[_0x02e1('0x35')]=_0x1aa92e[_0x02e1('0x35')][_0x02e1('0x44')]?_0x1aa92e[_0x02e1('0x35')]:_0x12a5c1[_0x02e1('0x2f')];if(!_0x252e02[_0x02e1('0x31')][_0x02e1('0x36')](_0x02e1('0x58'))){_0x1aa92e[_0x02e1('0x24')]=qs[_0x02e1('0x24')](_0x252e02[_0x02e1('0x31')][_0x02e1('0x24')]);_0x1aa92e['offset']=qs[_0x02e1('0x23')](_0x252e02[_0x02e1('0x31')][_0x02e1('0x23')]);}_0x1aa92e[_0x02e1('0x37')]=qs[_0x02e1('0x38')](_0x252e02['query'][_0x02e1('0x38')]);_0x1aa92e[_0x02e1('0x39')]=qs[_0x02e1('0x32')](_[_0x02e1('0x59')](_0x252e02['query'],_0x12a5c1['filters']));_0x1aa92e[_0x02e1('0x6e')]=!![];if(_0x252e02[_0x02e1('0x31')][_0x02e1('0x5a')]){_0x1aa92e[_0x02e1('0x39')]=_[_0x02e1('0x3a')](_0x1aa92e[_0x02e1('0x39')],{'$or':_[_0x02e1('0x3b')](_0x1aa92e['attributes'],function(_0x32630f){var _0x3a6665={};_0x3a6665[_0x32630f]={'$like':'%'+_0x252e02[_0x02e1('0x31')]['filter']+'%'};return _0x3a6665;})});}_0x1aa92e=_[_0x02e1('0x3a')]({},_0x1aa92e,_0x252e02['options']);return _0x54e810[_0x02e1('0x69')](_0x1aa92e);}})[_0x02e1('0x28')](function(_0x22941e){if(!_[_0x02e1('0x71')](_0x22941e)){var _0x3ece4b=toCsv(_0x22941e);var _0x2d1c1e=Date[_0x02e1('0x72')]();fs['writeFileSync'](util['format'](_0x02e1('0x73'),_0x54e810['id'],_0x2d1c1e),_0x3ece4b);_0x52017a[_0x02e1('0x74')]('Content-disposition',_0x02e1('0x75')+util[_0x02e1('0x6d')](_0x02e1('0x76'),_0x54e810['id'],_0x2d1c1e));_0x52017a[_0x02e1('0x74')](_0x02e1('0x77'),_0x02e1('0x78'));return _0x52017a[_0x02e1('0x79')](util[_0x02e1('0x6d')]('/tmp/list_%d_%s.csv',_0x54e810['id'],_0x2d1c1e));}else{return _0x52017a[_0x02e1('0x1e')](0xcc);}})[_0x02e1('0x42')](handleError(_0x52017a,null));};exports[_0x02e1('0x7a')]=function(_0x5b11b8,_0x29168c,_0x441719){var _0x3e1017;delete _0x5b11b8[_0x02e1('0x48')]['id'];return db[_0x02e1('0x2d')][_0x02e1('0x57')]({'where':{'id':_0x5b11b8[_0x02e1('0x43')]['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x29168c,null))[_0x02e1('0x28')](function(_0x56d9cc){if(_0x56d9cc){return db['sequelize'][_0x02e1('0x7b')](function(_0x3fc692){return db[_0x02e1('0x6a')][_0x02e1('0x47')](_0x5b11b8[_0x02e1('0x48')],{'transaction':_0x3fc692})['then'](function(_0x4853de){_0x3e1017=_0x4853de;return _0x56d9cc['addCustomFields'](_0x4853de,{'transaction':_0x3fc692});})[_0x02e1('0x28')](function(){var _0x5d9b76={'type':db[_0x02e1('0x7c')][_0x02e1('0x7d')],'transaction':_0x3fc692};switch(_0x5b11b8[_0x02e1('0x48')][_0x02e1('0x3c')]){case _0x02e1('0x7e'):_0x5d9b76[_0x02e1('0x3c')]=db[_0x02e1('0x7c')][_0x02e1('0x7d')];break;case _0x02e1('0x7f'):_0x5d9b76[_0x02e1('0x3c')]=db['Sequelize'][_0x02e1('0x80')];break;case _0x02e1('0x81'):_0x5d9b76[_0x02e1('0x3c')]=db['Sequelize'][_0x02e1('0x82')];_0x5d9b76['defaultValue']=![];break;default:}return db[_0x02e1('0x83')]['queryInterface'][_0x02e1('0x84')](_0x02e1('0x85'),util[_0x02e1('0x6d')](_0x02e1('0x86'),_0x3e1017['id']),_0x5d9b76);})[_0x02e1('0x28')](function(){return _0x3e1017;});});}})['then'](respondWithResult(_0x29168c,null))[_0x02e1('0x42')](handleError(_0x29168c,null));};exports[_0x02e1('0x87')]=function(_0x1b0c6d,_0x4015ba,_0x4dee4b){var _0x155240={};var _0x3657cd={};var _0x526a19;var _0x49cb95;return db['CmList'][_0x02e1('0x57')]({'where':{'id':_0x1b0c6d[_0x02e1('0x43')]['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x4015ba,null))[_0x02e1('0x28')](function(_0x306267){if(_0x306267){_0x526a19=_0x306267;_0x3657cd['model']=_[_0x02e1('0x30')](db[_0x02e1('0x6a')]['rawAttributes']);_0x3657cd[_0x02e1('0x31')]=_['keys'](_0x1b0c6d[_0x02e1('0x31')]);_0x3657cd[_0x02e1('0x32')]=_[_0x02e1('0x33')](_0x3657cd['model'],_0x3657cd[_0x02e1('0x31')]);_0x155240[_0x02e1('0x35')]=_[_0x02e1('0x33')](_0x3657cd[_0x02e1('0x2f')],qs[_0x02e1('0x34')](_0x1b0c6d[_0x02e1('0x31')][_0x02e1('0x34')]));_0x155240[_0x02e1('0x35')]=_0x155240[_0x02e1('0x35')][_0x02e1('0x44')]?_0x155240[_0x02e1('0x35')]:_0x3657cd[_0x02e1('0x2f')];_0x155240[_0x02e1('0x37')]=qs[_0x02e1('0x38')](_0x1b0c6d[_0x02e1('0x31')]['sort']);_0x155240[_0x02e1('0x39')]=qs[_0x02e1('0x32')](_['pick'](_0x1b0c6d[_0x02e1('0x31')],_0x3657cd[_0x02e1('0x32')]));_0x155240[_0x02e1('0x39')]=_['merge'](_0x155240[_0x02e1('0x39')],{'$or':[{'ListId':_0x306267['id']},{'ListId':null}]});if(_0x1b0c6d[_0x02e1('0x31')][_0x02e1('0x5a')]){_0x155240[_0x02e1('0x39')]=_[_0x02e1('0x3a')](_0x155240[_0x02e1('0x39')],{'$or':_[_0x02e1('0x3b')](_0x155240[_0x02e1('0x35')],function(_0x2ca9fb){var _0x12734a={};_0x12734a[_0x2ca9fb]={'$like':'%'+_0x1b0c6d[_0x02e1('0x31')][_0x02e1('0x5a')]+'%'};return _0x12734a;})});}_0x155240=_[_0x02e1('0x3a')]({},_0x155240,_0x1b0c6d[_0x02e1('0x3f')]);return db['CmCustomField'][_0x02e1('0x88')](_0x155240);}})[_0x02e1('0x28')](respondWithResult(_0x4015ba,null))['catch'](handleError(_0x4015ba,null));};exports['addAgents']=function(_0x10eb74,_0x92f87f,_0x3b98c4){return db['CmList'][_0x02e1('0x46')]({'where':{'id':_0x10eb74['params']['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x92f87f,null))['then'](function(_0x4c5699){if(_0x4c5699){return _0x4c5699[_0x02e1('0x89')](_0x10eb74['body'][_0x02e1('0x5d')],_[_0x02e1('0x64')](_0x10eb74[_0x02e1('0x48')],['ids','id'])||{})[_0x02e1('0x8a')](function(_0x927f40){for(var _0x59cbdb=0x0;_0x59cbdb<_0x10eb74[_0x02e1('0x48')][_0x02e1('0x5d')][_0x02e1('0x44')];_0x59cbdb+=0x1){socket[_0x02e1('0x8b')](_0x02e1('0x8c'),{'UserId':_0x10eb74[_0x02e1('0x48')][_0x02e1('0x5d')][_0x59cbdb],'CmListId':_0x10eb74[_0x02e1('0x43')]['id']});}return _0x927f40;});}})[_0x02e1('0x28')](respondWithResult(_0x92f87f,null))[_0x02e1('0x42')](handleError(_0x92f87f,null));};exports['removeAgents']=function(_0x35cd49,_0x355a9c,_0x263839){return db[_0x02e1('0x2d')][_0x02e1('0x46')]({'where':{'id':_0x35cd49[_0x02e1('0x43')]['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x355a9c,null))[_0x02e1('0x28')](function(_0x14d06b){if(_0x14d06b){return _0x14d06b[_0x02e1('0x8d')](_0x35cd49[_0x02e1('0x31')]['ids'])['then'](function(){if(_[_0x02e1('0x60')](_0x35cd49[_0x02e1('0x31')][_0x02e1('0x5d')])){for(var _0x43d187=0x0;_0x43d187<_0x35cd49[_0x02e1('0x31')][_0x02e1('0x5d')][_0x02e1('0x44')];_0x43d187+=0x1){socket[_0x02e1('0x8b')](_0x02e1('0x8e'),{'UserId':Number(_0x35cd49[_0x02e1('0x31')][_0x02e1('0x5d')][_0x43d187]),'CmListId':Number(_0x35cd49['params']['id'])});}}else{socket[_0x02e1('0x8b')](_0x02e1('0x8e'),{'UserId':Number(_0x35cd49[_0x02e1('0x31')]['ids']),'CmListId':Number(_0x35cd49[_0x02e1('0x43')]['id'])});}});}})[_0x02e1('0x28')](respondWithStatusCode(_0x355a9c,null))[_0x02e1('0x42')](handleError(_0x355a9c,null));};exports[_0x02e1('0x8f')]=function(_0x13791d,_0x365c23,_0x1b284b){var _0x1ead86={};var _0x6e5e06={};var _0x5a1309;var _0x2e249e;return db[_0x02e1('0x2d')][_0x02e1('0x57')]({'where':{'id':_0x13791d[_0x02e1('0x43')]['id']}})[_0x02e1('0x28')](handleEntityNotFound(_0x365c23,null))['then'](function(_0x413ff1){if(_0x413ff1){_0x5a1309=_0x413ff1;_0x6e5e06[_0x02e1('0x2f')]=_[_0x02e1('0x30')](db[_0x02e1('0x90')][_0x02e1('0x2e')]);_0x6e5e06[_0x02e1('0x31')]=_['keys'](_0x13791d['query']);_0x6e5e06[_0x02e1('0x32')]=_[_0x02e1('0x33')](_0x6e5e06[_0x02e1('0x2f')],_0x6e5e06['query']);_0x1ead86['attributes']=_[_0x02e1('0x33')](_0x6e5e06[_0x02e1('0x2f')],qs[_0x02e1('0x34')](_0x13791d[_0x02e1('0x31')][_0x02e1('0x34')]));_0x1ead86['attributes']=_0x1ead86['attributes']['length']?_0x1ead86[_0x02e1('0x35')]:_0x6e5e06[_0x02e1('0x2f')];_0x1ead86['order']=qs[_0x02e1('0x38')](_0x13791d[_0x02e1('0x31')]['sort']);_0x1ead86[_0x02e1('0x39')]=qs[_0x02e1('0x32')](_[_0x02e1('0x59')](_0x13791d[_0x02e1('0x31')],_0x6e5e06['filters']));if(_0x13791d[_0x02e1('0x31')][_0x02e1('0x5a')]){_0x1ead86[_0x02e1('0x39')]=_[_0x02e1('0x3a')](_0x1ead86[_0x02e1('0x39')],{'$or':_['map'](_0x1ead86[_0x02e1('0x35')],function(_0x8ec30b){var _0x3c3da8={};_0x3c3da8[_0x8ec30b]={'$like':'%'+_0x13791d[_0x02e1('0x31')][_0x02e1('0x5a')]+'%'};return _0x3c3da8;})});}_0x1ead86=_[_0x02e1('0x3a')]({},_0x1ead86,_0x13791d['options']);return _0x5a1309['getAgents'](_0x1ead86);}})['then'](function(_0x313bb5){if(_0x313bb5){_0x2e249e=_0x313bb5[_0x02e1('0x44')];if(!_0x13791d[_0x02e1('0x31')][_0x02e1('0x36')]('nolimit')){_0x1ead86[_0x02e1('0x24')]=qs[_0x02e1('0x24')](_0x13791d['query']['limit']);_0x1ead86[_0x02e1('0x23')]=qs['offset'](_0x13791d[_0x02e1('0x31')][_0x02e1('0x23')]);}return _0x5a1309['getAgents'](_0x1ead86);}})['then'](function(_0x37af2b){if(_0x37af2b){return _0x37af2b?{'count':_0x2e249e,'rows':_0x37af2b}:null;}})[_0x02e1('0x28')](respondWithResult(_0x365c23,null))[_0x02e1('0x42')](handleError(_0x365c23,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6f9d192..7c4b0bb 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 _0xe1b8=['CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x2f9b27,_0x4fd053){var _0x1d7dc9=function(_0x3e0a4f){while(--_0x3e0a4f){_0x2f9b27['push'](_0x2f9b27['shift']());}};_0x1d7dc9(++_0x4fd053);}(_0xe1b8,0x10d));var _0x8e1b=function(_0x582bc3,_0x2c4b7c){_0x582bc3=_0x582bc3-0x0;var _0x16fc82=_0xe1b8[_0x582bc3];return _0x16fc82;};'use strict';var EventEmitter=require('events');var CmList=require(_0x8e1b('0x0'))['db'][_0x8e1b('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x8e1b('0x2')](0x0);var events={'afterCreate':_0x8e1b('0x3'),'afterUpdate':_0x8e1b('0x4'),'afterDestroy':_0x8e1b('0x5')};function emitEvent(_0x276273){return function(_0x4ddd65,_0x3384c,_0x377e01){CmListEvents[_0x8e1b('0x6')](_0x276273+':'+_0x4ddd65['id'],_0x4ddd65);CmListEvents[_0x8e1b('0x6')](_0x276273,_0x4ddd65);_0x377e01(null);};}for(var e in events){if(events[_0x8e1b('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x8e1b('0x8')]=CmListEvents; \ No newline at end of file +var _0xd861=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x44e4f0,_0x4b9e4a){var _0x214e94=function(_0x47bf9a){while(--_0x47bf9a){_0x44e4f0['push'](_0x44e4f0['shift']());}};_0x214e94(++_0x4b9e4a);}(_0xd861,0x19f));var _0x1d86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd861[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var CmList=require(_0x1d86('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x1d86('0x1')](0x0);var events={'afterCreate':_0x1d86('0x2'),'afterUpdate':_0x1d86('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1c090d){return function(_0x2c3e20,_0x1fc8e3,_0x53c5c0){CmListEvents[_0x1d86('0x4')](_0x1c090d+':'+_0x2c3e20['id'],_0x2c3e20);CmListEvents[_0x1d86('0x4')](_0x1c090d,_0x2c3e20);_0x53c5c0(null);};}for(var e in events){if(events[_0x1d86('0x5')](e)){var event=events[e];CmList[_0x1d86('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 8eef53b..a574893 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 _0xfb41=['path','rimraf','./cmList.attributes','exports','CmList','cm_lists','lodash','../../config/logger','bluebird','request-promise'];(function(_0x482fdf,_0x2b3b09){var _0x161ddc=function(_0x3207fc){while(--_0x3207fc){_0x482fdf['push'](_0x482fdf['shift']());}};_0x161ddc(++_0x2b3b09);}(_0xfb41,0x114));var _0x1fb4=function(_0x5100bc,_0x35e471){_0x5100bc=_0x5100bc-0x0;var _0x1d6ec6=_0xfb41[_0x5100bc];return _0x1d6ec6;};'use strict';var _=require(_0x1fb4('0x0'));var util=require('util');var logger=require(_0x1fb4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1fb4('0x2'));var rp=require(_0x1fb4('0x3'));var fs=require('fs');var path=require(_0x1fb4('0x4'));var rimraf=require(_0x1fb4('0x5'));var config=require('../../config/environment');var attributes=require(_0x1fb4('0x6'));module[_0x1fb4('0x7')]=function(_0x2c10af,_0x448820){return _0x2c10af['define'](_0x1fb4('0x8'),attributes,{'tableName':_0x1fb4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b25=['path','rimraf','../../config/environment','./cmList.attributes','define','cm_lists','lodash','util','api','moment','bluebird','request-promise'];(function(_0x32756b,_0x4faad8){var _0x5d58d9=function(_0x42757a){while(--_0x42757a){_0x32756b['push'](_0x32756b['shift']());}};_0x5d58d9(++_0x4faad8);}(_0x4b25,0xc6));var _0x54b2=function(_0xbe2384,_0x1d09f1){_0xbe2384=_0xbe2384-0x0;var _0x17b30e=_0x4b25[_0xbe2384];return _0x17b30e;};'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(_0x54b2('0x5'));var fs=require('fs');var path=require(_0x54b2('0x6'));var rimraf=require(_0x54b2('0x7'));var config=require(_0x54b2('0x8'));var attributes=require(_0x54b2('0x9'));module['exports']=function(_0x1efabe,_0x127c20){return _0x1efabe[_0x54b2('0xa')]('CmList',attributes,{'tableName':_0x54b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index cafc292..f27d9df 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 _0x8576=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x2bda29,_0x3c165c){var _0xc68efb=function(_0x2575f3){while(--_0x2575f3){_0x2bda29['push'](_0x2bda29['shift']());}};_0xc68efb(++_0x3c165c);}(_0x8576,0x18d));var _0x6857=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x8576[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x6857('0x0'));var util=require('util');var moment=require(_0x6857('0x1'));var BPromise=require(_0x6857('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6857('0x3'));var db=require(_0x6857('0x4'))['db'];var utils=require(_0x6857('0x5'));var logger=require(_0x6857('0x6'))(_0x6857('0x7'));var config=require(_0x6857('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6857('0x9')][_0x6857('0xa')]({'port':0x232a});config['redis']=_[_0x6857('0xb')](config[_0x6857('0xc')],{'host':_0x6857('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x6857('0xe')](socket);function respondWithRpcPromise(_0x501b0b,_0x2a1357,_0x500474){return new BPromise(function(_0x5a8772,_0x5b3256){return client[_0x6857('0xf')](_0x501b0b,_0x500474)['then'](function(_0x354d80){logger[_0x6857('0x10')](_0x6857('0x11'),_0x2a1357,_0x6857('0x12'));logger['debug'](_0x6857('0x13'),_0x2a1357,'request\x20sent',JSON[_0x6857('0x14')](_0x354d80));if(_0x354d80[_0x6857('0x15')]){if(_0x354d80[_0x6857('0x15')][_0x6857('0x16')]===0x1f4){logger[_0x6857('0x15')](_0x6857('0x11'),_0x2a1357,_0x354d80[_0x6857('0x15')][_0x6857('0x17')]);return _0x5b3256(_0x354d80['error'][_0x6857('0x17')]);}logger[_0x6857('0x15')](_0x6857('0x11'),_0x2a1357,_0x354d80[_0x6857('0x15')]['message']);return _0x5a8772(_0x354d80['error'][_0x6857('0x17')]);}else{logger[_0x6857('0x10')](_0x6857('0x11'),_0x2a1357,'request\x20sent');_0x5a8772(_0x354d80['result']['message']);}})[_0x6857('0x18')](function(_0x3f3912){logger['error'](_0x6857('0x11'),_0x2a1357,_0x3f3912);_0x5b3256(_0x3f3912);});});} \ No newline at end of file +var _0x280a=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0xed5aea,_0x2b7243){var _0x39dd18=function(_0x2e83df){while(--_0x2e83df){_0xed5aea['push'](_0xed5aea['shift']());}};_0x39dd18(++_0x2b7243);}(_0x280a,0x199));var _0xa280=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0x280a[_0x2d0b84];return _0x8d0088;};'use strict';var _=require(_0xa280('0x0'));var util=require(_0xa280('0x1'));var moment=require(_0xa280('0x2'));var BPromise=require(_0xa280('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa280('0x4'));var db=require(_0xa280('0x5'))['db'];var utils=require(_0xa280('0x6'));var logger=require(_0xa280('0x7'))(_0xa280('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa280('0x9')][_0xa280('0xa')]({'port':0x232a});config[_0xa280('0xb')]=_['defaults'](config[_0xa280('0xb')],{'host':_0xa280('0xc'),'port':0x18eb});var socket=require(_0xa280('0xd'))(new Redis(config['redis']));require(_0xa280('0xe'))[_0xa280('0xf')](socket);function respondWithRpcPromise(_0x4e44f5,_0x44f1ad,_0x32712c){return new BPromise(function(_0x4aebfa,_0x356d70){return client[_0xa280('0x10')](_0x4e44f5,_0x32712c)[_0xa280('0x11')](function(_0x529eae){logger[_0xa280('0x12')](_0xa280('0x13'),_0x44f1ad,_0xa280('0x14'));logger[_0xa280('0x15')](_0xa280('0x16'),_0x44f1ad,_0xa280('0x14'),JSON['stringify'](_0x529eae));if(_0x529eae['error']){if(_0x529eae[_0xa280('0x17')][_0xa280('0x18')]===0x1f4){logger[_0xa280('0x17')]('CmList,\x20%s,\x20%s',_0x44f1ad,_0x529eae['error']['message']);return _0x356d70(_0x529eae[_0xa280('0x17')][_0xa280('0x19')]);}logger[_0xa280('0x17')]('CmList,\x20%s,\x20%s',_0x44f1ad,_0x529eae['error'][_0xa280('0x19')]);return _0x4aebfa(_0x529eae[_0xa280('0x17')][_0xa280('0x19')]);}else{logger[_0xa280('0x12')]('CmList,\x20%s,\x20%s',_0x44f1ad,_0xa280('0x14'));_0x4aebfa(_0x529eae['result'][_0xa280('0x19')]);}})[_0xa280('0x1a')](function(_0x24a011){logger[_0xa280('0x17')](_0xa280('0x13'),_0x44f1ad,_0x24a011);_0x356d70(_0x24a011);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index fd907f1..b44b850 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 _0xf961=['removeListener','register','length','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xf961,0x1cf));var _0x1f96=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xf961[_0x3ab9ee];return _0x82ee88;};'use strict';var CmListEvents=require(_0x1f96('0x0'));var events=[_0x1f96('0x1'),_0x1f96('0x2'),_0x1f96('0x3')];function createListener(_0x5f426a,_0x1174c8){return function(_0x1dc85a){_0x1174c8[_0x1f96('0x4')](_0x5f426a,_0x1dc85a);};}function removeListener(_0x4abe82,_0x3d032b){return function(){CmListEvents[_0x1f96('0x5')](_0x4abe82,_0x3d032b);};}exports[_0x1f96('0x6')]=function(_0x518062){for(var _0x40caad=0x0,_0x53e4d1=events[_0x1f96('0x7')];_0x40caad<_0x53e4d1;_0x40caad++){var _0x3244f8=events[_0x40caad];var _0x896b25=createListener(_0x1f96('0x8')+_0x3244f8,_0x518062);CmListEvents['on'](_0x3244f8,_0x896b25);}}; \ No newline at end of file +var _0x6596=['update','emit','register','length','cmList:','./cmList.events','save'];(function(_0x29d091,_0x3559f2){var _0x3a66c6=function(_0x2c97d0){while(--_0x2c97d0){_0x29d091['push'](_0x29d091['shift']());}};_0x3a66c6(++_0x3559f2);}(_0x6596,0x1d3));var _0x6659=function(_0x2d5fc3,_0x2d3f74){_0x2d5fc3=_0x2d5fc3-0x0;var _0xe107f3=_0x6596[_0x2d5fc3];return _0xe107f3;};'use strict';var CmListEvents=require(_0x6659('0x0'));var events=[_0x6659('0x1'),'remove',_0x6659('0x2')];function createListener(_0x114579,_0x3b1b74){return function(_0x2c58e1){_0x3b1b74[_0x6659('0x3')](_0x114579,_0x2c58e1);};}function removeListener(_0x67ac1d,_0x4bfd3c){return function(){CmListEvents['removeListener'](_0x67ac1d,_0x4bfd3c);};}exports[_0x6659('0x4')]=function(_0x3091f1){for(var _0xd6bf59=0x0,_0x1ed458=events[_0x6659('0x5')];_0xd6bf59<_0x1ed458;_0xd6bf59++){var _0x4a900d=events[_0xd6bf59];var _0x485ea0=createListener(_0x6659('0x6')+_0x4a900d,_0x3091f1);CmListEvents['on'](_0x4a900d,_0x485ea0);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 43da5d8..37b719f 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 _0xc093=['getDispositions','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/contacts','addContacts','/:id','delete','removeDispositions','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x4d443f,_0x27b16c){var _0x21ea4d=function(_0x2bcec3){while(--_0x2bcec3){_0x4d443f['push'](_0x4d443f['shift']());}};_0x21ea4d(++_0x27b16c);}(_0xc093,0x177));var _0x3c09=function(_0x33a573,_0x5e88b2){_0x33a573=_0x33a573-0x0;var _0xa8c4c0=_0xc093[_0x33a573];return _0xa8c4c0;};'use strict';var multer=require(_0x3c09('0x0'));var util=require('util');var path=require(_0x3c09('0x1'));var timeout=require(_0x3c09('0x2'));var express=require(_0x3c09('0x3'));var router=express[_0x3c09('0x4')]();var auth=require(_0x3c09('0x5'));var interaction=require(_0x3c09('0x6'));var config=require(_0x3c09('0x7'));var controller=require(_0x3c09('0x8'));router[_0x3c09('0x9')]('/',auth[_0x3c09('0xa')](),controller[_0x3c09('0xb')]);router['get'](_0x3c09('0xc'),auth[_0x3c09('0xa')](),controller[_0x3c09('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3c09('0xe')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3c09('0xf')]);router[_0x3c09('0x9')]('/:id/contacts',auth[_0x3c09('0xa')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x3c09('0xa')](),controller[_0x3c09('0x10')]);router['get'](_0x3c09('0x11'),auth['isAuthenticated'](),controller[_0x3c09('0x12')]);router['get'](_0x3c09('0x13'),auth[_0x3c09('0xa')](),controller[_0x3c09('0x14')]);router[_0x3c09('0x15')]('/',auth['isAuthenticated'](),controller[_0x3c09('0x16')]);router[_0x3c09('0x15')](_0x3c09('0x17'),auth[_0x3c09('0xa')](),controller[_0x3c09('0x18')]);router[_0x3c09('0x15')](_0x3c09('0x19'),auth[_0x3c09('0xa')](),controller[_0x3c09('0x1a')]);router[_0x3c09('0x15')](_0x3c09('0x11'),auth[_0x3c09('0xa')](),controller['addCustomField']);router['post'](_0x3c09('0x13'),auth[_0x3c09('0xa')](),controller['addAgents']);router['put'](_0x3c09('0x1b'),auth['isAuthenticated'](),controller['update']);router[_0x3c09('0x1c')](_0x3c09('0x1b'),auth[_0x3c09('0xa')](),controller['destroy']);router[_0x3c09('0x1c')](_0x3c09('0x17'),auth[_0x3c09('0xa')](),controller[_0x3c09('0x1d')]);router[_0x3c09('0x1c')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x2b68=['/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x53c33c,_0x27223d){var _0x277750=function(_0x3446fb){while(--_0x3446fb){_0x53c33c['push'](_0x53c33c['shift']());}};_0x277750(++_0x27223d);}(_0x2b68,0xbf));var _0x82b6=function(_0x38ac39,_0x44d712){_0x38ac39=_0x38ac39-0x0;var _0x24097c=_0x2b68[_0x38ac39];return _0x24097c;};'use strict';var multer=require(_0x82b6('0x0'));var util=require('util');var path=require(_0x82b6('0x1'));var timeout=require('connect-timeout');var express=require(_0x82b6('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x82b6('0x3'));var config=require(_0x82b6('0x4'));var controller=require('./cmList.controller');router[_0x82b6('0x5')]('/',auth[_0x82b6('0x6')](),controller[_0x82b6('0x7')]);router[_0x82b6('0x5')](_0x82b6('0x8'),auth[_0x82b6('0x6')](),controller[_0x82b6('0x9')]);router[_0x82b6('0x5')](_0x82b6('0xa'),auth[_0x82b6('0x6')](),controller[_0x82b6('0xb')]);router[_0x82b6('0x5')](_0x82b6('0xc'),auth[_0x82b6('0x6')](),controller['getDispositions']);router[_0x82b6('0x5')](_0x82b6('0xd'),auth[_0x82b6('0x6')](),controller[_0x82b6('0xe')]);router[_0x82b6('0x5')](_0x82b6('0xf'),auth[_0x82b6('0x6')](),controller[_0x82b6('0x10')]);router[_0x82b6('0x5')](_0x82b6('0x11'),auth[_0x82b6('0x6')](),controller[_0x82b6('0x12')]);router['get'](_0x82b6('0x13'),auth[_0x82b6('0x6')](),controller[_0x82b6('0x14')]);router[_0x82b6('0x15')]('/',auth[_0x82b6('0x6')](),controller[_0x82b6('0x16')]);router['post'](_0x82b6('0xc'),auth[_0x82b6('0x6')](),controller[_0x82b6('0x17')]);router[_0x82b6('0x15')](_0x82b6('0xd'),auth[_0x82b6('0x6')](),controller[_0x82b6('0x18')]);router[_0x82b6('0x15')](_0x82b6('0x11'),auth['isAuthenticated'](),controller[_0x82b6('0x19')]);router[_0x82b6('0x15')]('/:id/users',auth[_0x82b6('0x6')](),controller[_0x82b6('0x1a')]);router[_0x82b6('0x1b')]('/:id',auth[_0x82b6('0x6')](),controller[_0x82b6('0x1c')]);router['delete']('/:id',auth[_0x82b6('0x6')](),controller[_0x82b6('0x1d')]);router[_0x82b6('0x1e')]('/:id/dispositions',auth[_0x82b6('0x6')](),controller[_0x82b6('0x1f')]);router[_0x82b6('0x1e')]('/:id/users',auth[_0x82b6('0x6')](),controller[_0x82b6('0x20')]);module[_0x82b6('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3999f52..5b6262e 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x2c008c,_0x474d7a){var _0x19ec33=function(_0x24476f){while(--_0x24476f){_0x2c008c['push'](_0x2c008c['shift']());}};_0x19ec33(++_0x474d7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x47a4cb,_0x2c9282){var _0x288166=function(_0x4829cd){while(--_0x4829cd){_0x47a4cb['push'](_0x47a4cb['shift']());}};_0x288166(++_0x2c9282);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index f098761..967038c 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 _0x45ba=['catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','body','Condition','find','params'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x45ba,0x1d7));var _0xa45b=function(_0x51eca2,_0xc0ae82){_0x51eca2=_0x51eca2-0x0;var _0x203c3c=_0x45ba[_0x51eca2];return _0x203c3c;};'use strict';var pdf=require(_0xa45b('0x0'));var emlformat=require(_0xa45b('0x1'));var rimraf=require(_0xa45b('0x2'));var zipdir=require(_0xa45b('0x3'));var jsonpatch=require(_0xa45b('0x4'));var rp=require(_0xa45b('0x5'));var moment=require('moment');var BPromise=require(_0xa45b('0x6'));var Mustache=require(_0xa45b('0x7'));var util=require(_0xa45b('0x8'));var path=require(_0xa45b('0x9'));var sox=require(_0xa45b('0xa'));var csv=require(_0xa45b('0xb'));var ejs=require(_0xa45b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa45b('0xd'));var crypto=require(_0xa45b('0xe'));var jsforce=require(_0xa45b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa45b('0x10'));var Papa=require(_0xa45b('0x11'));var Redis=require('ioredis');var authService=require(_0xa45b('0x12'));var qs=require(_0xa45b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa45b('0x14'))(_0xa45b('0x15'));var utils=require(_0xa45b('0x16'));var config=require(_0xa45b('0x17'));var db=require(_0xa45b('0x18'))['db'];function respondWithStatusCode(_0xe5d9e4,_0x36a07e){_0x36a07e=_0x36a07e||0xcc;return function(_0x13c1d6){if(_0x13c1d6){return _0xe5d9e4['sendStatus'](_0x36a07e);}return _0xe5d9e4[_0xa45b('0x19')](_0x36a07e)[_0xa45b('0x1a')]();};}function respondWithResult(_0x1019b8,_0x2e5cd1){_0x2e5cd1=_0x2e5cd1||0xc8;return function(_0x39a176){if(_0x39a176){return _0x1019b8['status'](_0x2e5cd1)[_0xa45b('0x1b')](_0x39a176);}};}function respondWithFilteredResult(_0x46a916,_0x218ad4){return function(_0x22b19d){if(_0x22b19d){var _0x2de77f=_0x22b19d[_0xa45b('0x1c')],_0x4365af=_0x218ad4[_0xa45b('0x1d')],_0x2ce214=_0x218ad4[_0xa45b('0x1d')]+_0x218ad4[_0xa45b('0x1e')],_0x3ca811;if(_0x2ce214>=_0x2de77f){_0x2ce214=_0x2de77f;_0x3ca811=0xc8;}else{_0x3ca811=0xce;}_0x46a916['status'](_0x3ca811);return _0x46a916[_0xa45b('0x1f')](_0xa45b('0x20'),_0x4365af+'-'+_0x2ce214+'/'+_0x2de77f)[_0xa45b('0x1b')](_0x22b19d);}return null;};}function patchUpdates(_0x40b9b8){return function(_0x50c7ee){try{jsonpatch[_0xa45b('0x21')](_0x50c7ee,_0x40b9b8,!![]);}catch(_0x33e321){return BPromise['reject'](_0x33e321);}return _0x50c7ee[_0xa45b('0x22')]();};}function saveUpdates(_0x4107c9,_0x3b2e0e){return function(_0x5e7421){if(_0x5e7421){return _0x5e7421[_0xa45b('0x23')](_0x4107c9)[_0xa45b('0x24')](function(_0x401a66){return _0x401a66;});}return null;};}function removeEntity(_0x2b8a07,_0x3169b1){return function(_0x5bcac4){if(_0x5bcac4){return _0x5bcac4[_0xa45b('0x25')]()[_0xa45b('0x24')](function(){_0x2b8a07[_0xa45b('0x19')](0xcc)[_0xa45b('0x1a')]();});}};}function handleEntityNotFound(_0x244e82,_0xc5842e){return function(_0x3025fb){if(!_0x3025fb){_0x244e82['sendStatus'](0x194);}return _0x3025fb;};}function handleError(_0x2abd3d,_0x38991d){_0x38991d=_0x38991d||0x1f4;return function(_0x352b2c){logger[_0xa45b('0x26')](_0x352b2c[_0xa45b('0x27')]);if(_0x352b2c['name']){delete _0x352b2c[_0xa45b('0x28')];}_0x2abd3d[_0xa45b('0x19')](_0x38991d)[_0xa45b('0x29')](_0x352b2c);};}exports['update']=function(_0x3d72ac,_0xa58cfe){if(_0x3d72ac[_0xa45b('0x2a')]['id']){delete _0x3d72ac[_0xa45b('0x2a')]['id'];}return db[_0xa45b('0x2b')][_0xa45b('0x2c')]({'where':{'id':_0x3d72ac[_0xa45b('0x2d')]['id']}})['then'](handleEntityNotFound(_0xa58cfe,null))[_0xa45b('0x24')](saveUpdates(_0x3d72ac['body'],null))['then'](respondWithResult(_0xa58cfe,null))[_0xa45b('0x2e')](handleError(_0xa58cfe,null));};exports[_0xa45b('0x25')]=function(_0x1bd576,_0x54698c){return db[_0xa45b('0x2b')]['find']({'where':{'id':_0x1bd576[_0xa45b('0x2d')]['id']}})['then'](handleEntityNotFound(_0x54698c,null))[_0xa45b('0x24')](removeEntity(_0x54698c,null))[_0xa45b('0x2e')](handleError(_0x54698c,null));}; \ No newline at end of file +var _0x4693=['moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','save','then','error','stack','name','update','body','Condition','params','catch','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x362256,_0x4f8638){var _0xfa7997=function(_0xfb12d0){while(--_0xfb12d0){_0x362256['push'](_0x362256['shift']());}};_0xfa7997(++_0x4f8638);}(_0x4693,0x18b));var _0x3469=function(_0x5afeab,_0x557f5d){_0x5afeab=_0x5afeab-0x0;var _0x5ef61f=_0x4693[_0x5afeab];return _0x5ef61f;};'use strict';var pdf=require(_0x3469('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3469('0x1'));var zipdir=require(_0x3469('0x2'));var jsonpatch=require(_0x3469('0x3'));var rp=require(_0x3469('0x4'));var moment=require(_0x3469('0x5'));var BPromise=require(_0x3469('0x6'));var Mustache=require(_0x3469('0x7'));var util=require(_0x3469('0x8'));var path=require(_0x3469('0x9'));var sox=require('sox');var csv=require(_0x3469('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3469('0xb'));var squel=require(_0x3469('0xc'));var crypto=require(_0x3469('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3469('0xe'));var toCsv=require(_0x3469('0xa'));var querystring=require('querystring');var Papa=require(_0x3469('0xf'));var Redis=require('ioredis');var authService=require(_0x3469('0x10'));var qs=require(_0x3469('0x11'));var hardwareService=require(_0x3469('0x12'));var logger=require(_0x3469('0x13'))(_0x3469('0x14'));var utils=require(_0x3469('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x345992,_0x5d9426){_0x5d9426=_0x5d9426||0xcc;return function(_0x1af67b){if(_0x1af67b){return _0x345992[_0x3469('0x16')](_0x5d9426);}return _0x345992[_0x3469('0x17')](_0x5d9426)[_0x3469('0x18')]();};}function respondWithResult(_0x13fbfe,_0x2cb4c4){_0x2cb4c4=_0x2cb4c4||0xc8;return function(_0x58636c){if(_0x58636c){return _0x13fbfe[_0x3469('0x17')](_0x2cb4c4)[_0x3469('0x19')](_0x58636c);}};}function respondWithFilteredResult(_0xae32d,_0x24db00){return function(_0x1789f4){if(_0x1789f4){var _0x4b565a=_0x1789f4['count'],_0x3d7ad8=_0x24db00[_0x3469('0x1a')],_0x18c472=_0x24db00[_0x3469('0x1a')]+_0x24db00[_0x3469('0x1b')],_0x500251;if(_0x18c472>=_0x4b565a){_0x18c472=_0x4b565a;_0x500251=0xc8;}else{_0x500251=0xce;}_0xae32d[_0x3469('0x17')](_0x500251);return _0xae32d['set'](_0x3469('0x1c'),_0x3d7ad8+'-'+_0x18c472+'/'+_0x4b565a)[_0x3469('0x19')](_0x1789f4);}return null;};}function patchUpdates(_0x5011ff){return function(_0x13435d){try{jsonpatch['apply'](_0x13435d,_0x5011ff,!![]);}catch(_0x5d67b6){return BPromise['reject'](_0x5d67b6);}return _0x13435d[_0x3469('0x1d')]();};}function saveUpdates(_0x50fdf4,_0x4f6604){return function(_0x4c6956){if(_0x4c6956){return _0x4c6956['update'](_0x50fdf4)[_0x3469('0x1e')](function(_0x5da9b2){return _0x5da9b2;});}return null;};}function removeEntity(_0x538b68,_0x37607e){return function(_0xf393d0){if(_0xf393d0){return _0xf393d0['destroy']()['then'](function(){_0x538b68[_0x3469('0x17')](0xcc)[_0x3469('0x18')]();});}};}function handleEntityNotFound(_0x321728,_0x2c9fdf){return function(_0x4d4495){if(!_0x4d4495){_0x321728[_0x3469('0x16')](0x194);}return _0x4d4495;};}function handleError(_0x504196,_0x208754){_0x208754=_0x208754||0x1f4;return function(_0x949ed0){logger[_0x3469('0x1f')](_0x949ed0[_0x3469('0x20')]);if(_0x949ed0[_0x3469('0x21')]){delete _0x949ed0['name'];}_0x504196[_0x3469('0x17')](_0x208754)['send'](_0x949ed0);};}exports[_0x3469('0x22')]=function(_0x2ba232,_0x192533){if(_0x2ba232[_0x3469('0x23')]['id']){delete _0x2ba232[_0x3469('0x23')]['id'];}return db[_0x3469('0x24')]['find']({'where':{'id':_0x2ba232[_0x3469('0x25')]['id']}})['then'](handleEntityNotFound(_0x192533,null))['then'](saveUpdates(_0x2ba232[_0x3469('0x23')],null))[_0x3469('0x1e')](respondWithResult(_0x192533,null))[_0x3469('0x26')](handleError(_0x192533,null));};exports['destroy']=function(_0xbd30aa,_0x4239b4){return db['Condition'][_0x3469('0x27')]({'where':{'id':_0xbd30aa[_0x3469('0x25')]['id']}})[_0x3469('0x1e')](handleEntityNotFound(_0x4239b4,null))[_0x3469('0x1e')](removeEntity(_0x4239b4,null))[_0x3469('0x26')](handleError(_0x4239b4,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a35f53a..5f397df 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 _0x035c=['path','rimraf','../../config/environment','exports','define','util','../../config/logger','moment','request-promise'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x035c,0x1a3));var _0xc035=function(_0x469d4f,_0x1ca9a5){_0x469d4f=_0x469d4f-0x0;var _0x18fcaf=_0x035c[_0x469d4f];return _0x18fcaf;};'use strict';var _=require('lodash');var util=require(_0xc035('0x0'));var logger=require(_0xc035('0x1'))('api');var moment=require(_0xc035('0x2'));var BPromise=require('bluebird');var rp=require(_0xc035('0x3'));var fs=require('fs');var path=require(_0xc035('0x4'));var rimraf=require(_0xc035('0x5'));var config=require(_0xc035('0x6'));var attributes=require('./condition.attributes');module[_0xc035('0x7')]=function(_0x141453,_0x3db8ad){return _0x141453[_0xc035('0x8')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6366=['../../config/logger','api','bluebird','path','../../config/environment','./condition.attributes','exports','define','lodash','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6366,0x198));var _0x6636=function(_0x7a2c29,_0x5938f6){_0x7a2c29=_0x7a2c29-0x0;var _0x44d483=_0x6366[_0x7a2c29];return _0x44d483;};'use strict';var _=require(_0x6636('0x0'));var util=require(_0x6636('0x1'));var logger=require(_0x6636('0x2'))(_0x6636('0x3'));var moment=require('moment');var BPromise=require(_0x6636('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6636('0x5'));var rimraf=require('rimraf');var config=require(_0x6636('0x6'));var attributes=require(_0x6636('0x7'));module[_0x6636('0x8')]=function(_0x58186f,_0x2c06ab){return _0x58186f[_0x6636('0x9')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 5aa11c2..1347b80 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 _0xc1c7=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Condition,\x20%s,\x20%s','message','catch'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0xc1c7,0x159));var _0x7c1c=function(_0x4cdf79,_0x3959be){_0x4cdf79=_0x4cdf79-0x0;var _0x403a32=_0xc1c7[_0x4cdf79];return _0x403a32;};'use strict';var _=require(_0x7c1c('0x0'));var util=require(_0x7c1c('0x1'));var moment=require('moment');var BPromise=require(_0x7c1c('0x2'));var rs=require(_0x7c1c('0x3'));var fs=require('fs');var Redis=require(_0x7c1c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c1c('0x5'));var logger=require(_0x7c1c('0x6'))('rpc');var config=require(_0x7c1c('0x7'));var jayson=require(_0x7c1c('0x8'));var client=jayson[_0x7c1c('0x9')][_0x7c1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3679e5,_0x3297ec,_0x3af113){return new BPromise(function(_0x21afb1,_0x43495e){return client[_0x7c1c('0xb')](_0x3679e5,_0x3af113)[_0x7c1c('0xc')](function(_0x4c07cd){logger[_0x7c1c('0xd')]('Condition,\x20%s,\x20%s',_0x3297ec,'request\x20sent');logger[_0x7c1c('0xe')](_0x7c1c('0xf'),_0x3297ec,_0x7c1c('0x10'),JSON[_0x7c1c('0x11')](_0x4c07cd));if(_0x4c07cd['error']){if(_0x4c07cd['error'][_0x7c1c('0x12')]===0x1f4){logger[_0x7c1c('0x13')](_0x7c1c('0x14'),_0x3297ec,_0x4c07cd['error'][_0x7c1c('0x15')]);return _0x43495e(_0x4c07cd[_0x7c1c('0x13')][_0x7c1c('0x15')]);}logger[_0x7c1c('0x13')](_0x7c1c('0x14'),_0x3297ec,_0x4c07cd['error'][_0x7c1c('0x15')]);return _0x21afb1(_0x4c07cd[_0x7c1c('0x13')]['message']);}else{logger['info'](_0x7c1c('0x14'),_0x3297ec,_0x7c1c('0x10'));_0x21afb1(_0x4c07cd['result'][_0x7c1c('0x15')]);}})[_0x7c1c('0x16')](function(_0x5a280f){logger[_0x7c1c('0x13')]('Condition,\x20%s,\x20%s',_0x3297ec,_0x5a280f);_0x43495e(_0x5a280f);});});} \ No newline at end of file +var _0x2d91=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x16c4ef,_0x753145){var _0x6c69f7=function(_0x28de6f){while(--_0x28de6f){_0x16c4ef['push'](_0x16c4ef['shift']());}};_0x6c69f7(++_0x753145);}(_0x2d91,0x8e));var _0x12d9=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x2d91[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0x12d9('0x0'));var util=require(_0x12d9('0x1'));var moment=require('moment');var BPromise=require(_0x12d9('0x2'));var rs=require(_0x12d9('0x3'));var fs=require('fs');var Redis=require(_0x12d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x12d9('0x5'));var logger=require(_0x12d9('0x6'))(_0x12d9('0x7'));var config=require(_0x12d9('0x8'));var jayson=require(_0x12d9('0x9'));var client=jayson[_0x12d9('0xa')][_0x12d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x402361,_0x683c7d,_0x44c301){return new BPromise(function(_0x56a82d,_0x38381f){return client['request'](_0x402361,_0x44c301)[_0x12d9('0xc')](function(_0x5b37ba){logger[_0x12d9('0xd')](_0x12d9('0xe'),_0x683c7d,_0x12d9('0xf'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x683c7d,_0x12d9('0xf'),JSON[_0x12d9('0x10')](_0x5b37ba));if(_0x5b37ba[_0x12d9('0x11')]){if(_0x5b37ba[_0x12d9('0x11')]['code']===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x683c7d,_0x5b37ba[_0x12d9('0x11')][_0x12d9('0x12')]);return _0x38381f(_0x5b37ba[_0x12d9('0x11')][_0x12d9('0x12')]);}logger[_0x12d9('0x11')](_0x12d9('0xe'),_0x683c7d,_0x5b37ba['error'][_0x12d9('0x12')]);return _0x56a82d(_0x5b37ba[_0x12d9('0x11')][_0x12d9('0x12')]);}else{logger[_0x12d9('0xd')](_0x12d9('0xe'),_0x683c7d,'request\x20sent');_0x56a82d(_0x5b37ba[_0x12d9('0x13')]['message']);}})[_0x12d9('0x14')](function(_0x31274c){logger[_0x12d9('0x11')](_0x12d9('0xe'),_0x683c7d,_0x31274c);_0x38381f(_0x31274c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index ed29820..0ed9736 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 _0xda69=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','multer','connect-timeout'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xda69,0x7c));var _0x9da6=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xda69[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require(_0x9da6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9da6('0x1'));var express=require('express');var router=express[_0x9da6('0x2')]();var auth=require(_0x9da6('0x3'));var interaction=require(_0x9da6('0x4'));var config=require(_0x9da6('0x5'));var controller=require('./condition.controller');router[_0x9da6('0x6')](_0x9da6('0x7'),auth[_0x9da6('0x8')](),controller['update']);router['delete'](_0x9da6('0x7'),auth[_0x9da6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa99d=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0xa99d,0x1ac));var _0xda99=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0xa99d[_0x30c2ae];return _0x1ee1cc;};'use strict';var multer=require(_0xda99('0x0'));var util=require('util');var path=require(_0xda99('0x1'));var timeout=require(_0xda99('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xda99('0x3'));var interaction=require(_0xda99('0x4'));var config=require(_0xda99('0x5'));var controller=require(_0xda99('0x6'));router[_0xda99('0x7')]('/:id',auth[_0xda99('0x8')](),controller[_0xda99('0x9')]);router[_0xda99('0xa')]('/:id',auth[_0xda99('0x8')](),controller[_0xda99('0xb')]);module[_0xda99('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1171be2..a07dfd9 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 _0x2b67=['name','sequelize','STRING'];(function(_0x312940,_0xbf9725){var _0xf7bb45=function(_0x2e11dd){while(--_0x2e11dd){_0x312940['push'](_0x312940['shift']());}};_0xf7bb45(++_0xbf9725);}(_0x2b67,0x67));var _0x72b6=function(_0x70f043,_0xbaba82){_0x70f043=_0x70f043-0x0;var _0x47e496=_0x2b67[_0x70f043];return _0x47e496;};'use strict';var Sequelize=require(_0x72b6('0x0'));module['exports']={'name':{'type':Sequelize[_0x72b6('0x1')],'allowNull':![],'unique':_0x72b6('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeb98=['STRING','name','exports'];(function(_0x1743ae,_0x4a62ca){var _0x48c561=function(_0x1f580c){while(--_0x1f580c){_0x1743ae['push'](_0x1743ae['shift']());}};_0x48c561(++_0x4a62ca);}(_0xeb98,0xe0));var _0x8eb9=function(_0x4c7293,_0x301d0b){_0x4c7293=_0x4c7293-0x0;var _0x493013=_0xeb98[_0x4c7293];return _0x493013;};'use strict';var Sequelize=require('sequelize');module[_0x8eb9('0x0')]={'name':{'type':Sequelize[_0x8eb9('0x1')],'allowNull':![],'unique':_0x8eb9('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4e836e4..36b59cf 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 _0x8cca=['attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','pick','getItems','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','get','CustomDashboards','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','Dashboard','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','autoAssociation','iframe','attrUrl'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8cca,0x97));var _0xa8cc=function(_0x246ff0,_0x1ceb7d){_0x246ff0=_0x246ff0-0x0;var _0x43e83a=_0x8cca[_0x246ff0];return _0x43e83a;};'use strict';var pdf=require(_0xa8cc('0x0'));var emlformat=require(_0xa8cc('0x1'));var rimraf=require(_0xa8cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8cc('0x3'));var rp=require('request-promise');var moment=require(_0xa8cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8cc('0x5'));var util=require('util');var path=require(_0xa8cc('0x6'));var sox=require(_0xa8cc('0x7'));var csv=require('to-csv');var ejs=require(_0xa8cc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa8cc('0x9'));var jsforce=require(_0xa8cc('0xa'));var deskjs=require(_0xa8cc('0xb'));var toCsv=require(_0xa8cc('0xc'));var querystring=require(_0xa8cc('0xd'));var Papa=require(_0xa8cc('0xe'));var Redis=require(_0xa8cc('0xf'));var authService=require(_0xa8cc('0x10'));var qs=require(_0xa8cc('0x11'));var hardwareService=require(_0xa8cc('0x12'));var logger=require(_0xa8cc('0x13'))(_0xa8cc('0x14'));var utils=require(_0xa8cc('0x15'));var config=require(_0xa8cc('0x16'));var db=require(_0xa8cc('0x17'))['db'];config[_0xa8cc('0x18')]=_['defaults'](config['redis'],{'host':_0xa8cc('0x19'),'port':0x18eb});var socket=require(_0xa8cc('0x1a'))(new Redis(config[_0xa8cc('0x18')]));require(_0xa8cc('0x1b'))[_0xa8cc('0x1c')](socket);function respondWithStatusCode(_0x294273,_0x3c49fd){_0x3c49fd=_0x3c49fd||0xcc;return function(_0x4bef85){if(_0x4bef85){return _0x294273['sendStatus'](_0x3c49fd);}return _0x294273[_0xa8cc('0x1d')](_0x3c49fd)[_0xa8cc('0x1e')]();};}function respondWithResult(_0x260ee3,_0x4c2663){_0x4c2663=_0x4c2663||0xc8;return function(_0x3f279b){if(_0x3f279b){return _0x260ee3[_0xa8cc('0x1d')](_0x4c2663)[_0xa8cc('0x1f')](_0x3f279b);}};}function respondWithFilteredResult(_0x4852ca,_0x14b84b){return function(_0x2db7a7){if(_0x2db7a7){var _0x255fe8=_0x2db7a7[_0xa8cc('0x20')],_0x3d6be5=_0x14b84b['offset'],_0x4f937c=_0x14b84b[_0xa8cc('0x21')]+_0x14b84b['limit'],_0x188a22;if(_0x4f937c>=_0x255fe8){_0x4f937c=_0x255fe8;_0x188a22=0xc8;}else{_0x188a22=0xce;}_0x4852ca[_0xa8cc('0x1d')](_0x188a22);return _0x4852ca[_0xa8cc('0x22')](_0xa8cc('0x23'),_0x3d6be5+'-'+_0x4f937c+'/'+_0x255fe8)[_0xa8cc('0x1f')](_0x2db7a7);}return null;};}function patchUpdates(_0x5abc6c){return function(_0x5d66ff){try{jsonpatch[_0xa8cc('0x24')](_0x5d66ff,_0x5abc6c,!![]);}catch(_0x40a82a){return BPromise[_0xa8cc('0x25')](_0x40a82a);}return _0x5d66ff[_0xa8cc('0x26')]();};}function saveUpdates(_0x3c537e,_0x58265c){return function(_0x2057b5){if(_0x2057b5){return _0x2057b5[_0xa8cc('0x27')](_0x3c537e)['then'](function(_0x5e5723){return _0x5e5723;});}return null;};}function removeEntity(_0x21b823,_0x2b6a3f){return function(_0xc76ca){if(_0xc76ca){return _0xc76ca['destroy']()['then'](function(){var _0x1d0708=_0xc76ca[_0xa8cc('0x28')]({'plain':!![]});var _0x1aa67b=_0xa8cc('0x29');return db[_0xa8cc('0x2a')][_0xa8cc('0x2b')]({'where':{'type':_0x1aa67b,'resourceId':_0x1d0708['id']}})['then'](function(){return _0xc76ca;});})[_0xa8cc('0x2c')](function(){_0x21b823[_0xa8cc('0x1d')](0xcc)[_0xa8cc('0x1e')]();});}};}function handleEntityNotFound(_0x38a80d,_0x4bd07d){return function(_0x399064){if(!_0x399064){_0x38a80d[_0xa8cc('0x2d')](0x194);}return _0x399064;};}function handleError(_0x55f10e,_0x10b3d2){_0x10b3d2=_0x10b3d2||0x1f4;return function(_0x36b744){logger[_0xa8cc('0x2e')](_0x36b744[_0xa8cc('0x2f')]);if(_0x36b744['name']){delete _0x36b744[_0xa8cc('0x30')];}_0x55f10e[_0xa8cc('0x1d')](_0x10b3d2)[_0xa8cc('0x31')](_0x36b744);};}exports[_0xa8cc('0x32')]=function(_0x49d9c7,_0x1a17b5){var _0xdd68b={},_0x45af50={},_0x1f90c5={'count':0x0,'rows':[]};var _0x56b3e5=db[_0xa8cc('0x33')][_0xa8cc('0x34')];_0x45af50[_0xa8cc('0x35')]=_[_0xa8cc('0x36')](_0x56b3e5);_0x45af50['query']=_['keys'](_0x49d9c7[_0xa8cc('0x37')]);_0x45af50[_0xa8cc('0x38')]=_['intersection'](_0x45af50[_0xa8cc('0x35')],_0x45af50[_0xa8cc('0x37')]);_0xdd68b[_0xa8cc('0x39')]=_[_0xa8cc('0x3a')](_0x45af50[_0xa8cc('0x35')],qs[_0xa8cc('0x3b')](_0x49d9c7[_0xa8cc('0x37')][_0xa8cc('0x3b')]));_0xdd68b[_0xa8cc('0x39')]=_0xdd68b[_0xa8cc('0x39')][_0xa8cc('0x3c')]?_0xdd68b[_0xa8cc('0x39')]:_0x45af50[_0xa8cc('0x35')];if(!_0x49d9c7[_0xa8cc('0x37')][_0xa8cc('0x3d')](_0xa8cc('0x3e'))){_0xdd68b['limit']=qs[_0xa8cc('0x3f')](_0x49d9c7['query'][_0xa8cc('0x3f')]);_0xdd68b[_0xa8cc('0x21')]=qs[_0xa8cc('0x21')](_0x49d9c7[_0xa8cc('0x37')][_0xa8cc('0x21')]);}_0xdd68b[_0xa8cc('0x40')]=qs[_0xa8cc('0x41')](_0x49d9c7['query'][_0xa8cc('0x41')]);_0xdd68b[_0xa8cc('0x42')]=qs[_0xa8cc('0x38')](_['pick'](_0x49d9c7['query'],_0x45af50[_0xa8cc('0x38')]));if(_0x49d9c7[_0xa8cc('0x37')][_0xa8cc('0x43')]){_0xdd68b[_0xa8cc('0x42')]=_['merge'](_0xdd68b['where'],{'$or':_[_0xa8cc('0x44')](_0x56b3e5,function(_0x1c529d){if(_0x1c529d[_0xa8cc('0x45')][_0xa8cc('0x46')]!==_0xa8cc('0x47')){var _0x4c45b3={};_0x4c45b3[_0x1c529d[_0xa8cc('0x48')]]={'$like':'%'+_0x49d9c7[_0xa8cc('0x37')][_0xa8cc('0x43')]+'%'};return _0x4c45b3;}})});}_0xdd68b=_['merge']({},_0xdd68b,_0x49d9c7[_0xa8cc('0x49')]);var _0x2824d8={'where':_0xdd68b[_0xa8cc('0x42')]};return db[_0xa8cc('0x33')][_0xa8cc('0x20')](_0x2824d8)[_0xa8cc('0x2c')](function(_0xb95cb5){_0x1f90c5[_0xa8cc('0x20')]=_0xb95cb5;if(_0x49d9c7[_0xa8cc('0x37')][_0xa8cc('0x4a')]){_0xdd68b[_0xa8cc('0x4b')]=[{'all':!![]}];}return db['Dashboard'][_0xa8cc('0x4c')](_0xdd68b);})['then'](function(_0x4e8793){_0x1f90c5[_0xa8cc('0x4d')]=_0x4e8793;return _0x1f90c5;})[_0xa8cc('0x2c')](respondWithFilteredResult(_0x1a17b5,_0xdd68b))[_0xa8cc('0x4e')](handleError(_0x1a17b5,null));};exports['show']=function(_0x5925af,_0x317a93){var _0x308480={'raw':![],'where':{'id':_0x5925af['params']['id']}},_0x10c032={};_0x10c032[_0xa8cc('0x35')]=_[_0xa8cc('0x36')](db['Dashboard'][_0xa8cc('0x34')]);_0x10c032[_0xa8cc('0x37')]=_[_0xa8cc('0x36')](_0x5925af[_0xa8cc('0x37')]);_0x10c032[_0xa8cc('0x38')]=_['intersection'](_0x10c032['model'],_0x10c032[_0xa8cc('0x37')]);_0x308480[_0xa8cc('0x39')]=_[_0xa8cc('0x3a')](_0x10c032['model'],qs[_0xa8cc('0x3b')](_0x5925af[_0xa8cc('0x37')][_0xa8cc('0x3b')]));_0x308480[_0xa8cc('0x39')]=_0x308480[_0xa8cc('0x39')][_0xa8cc('0x3c')]?_0x308480[_0xa8cc('0x39')]:_0x10c032[_0xa8cc('0x35')];if(_0x5925af[_0xa8cc('0x37')][_0xa8cc('0x4a')]){_0x308480[_0xa8cc('0x4b')]=[{'all':!![]}];}_0x308480=_[_0xa8cc('0x4f')]({},_0x308480,_0x5925af['options']);return db[_0xa8cc('0x33')][_0xa8cc('0x50')](_0x308480)[_0xa8cc('0x2c')](handleEntityNotFound(_0x317a93,null))[_0xa8cc('0x2c')](respondWithResult(_0x317a93,null))['catch'](handleError(_0x317a93,null));};exports['create']=function(_0x38489f,_0x4e283a){return db[_0xa8cc('0x33')][_0xa8cc('0x51')](_0x38489f[_0xa8cc('0x52')],{})[_0xa8cc('0x2c')](function(_0x3461bf){var _0x26440d=_0x38489f[_0xa8cc('0x53')][_0xa8cc('0x28')]({'plain':!![]});if(!_0x26440d)throw new Error(_0xa8cc('0x54'));if(_0x26440d[_0xa8cc('0x55')]==='user'){var _0xc243a3=_0x3461bf['get']({'plain':!![]});var _0x192182='CustomDashboards';return db[_0xa8cc('0x56')][_0xa8cc('0x50')]({'where':{'name':_0x192182,'userProfileId':_0x26440d[_0xa8cc('0x57')]},'raw':!![]})[_0xa8cc('0x2c')](function(_0x422556){if(_0x422556&&_0x422556['autoAssociation']===0x0){return db[_0xa8cc('0x2a')]['create']({'name':_0xc243a3['name'],'resourceId':_0xc243a3['id'],'type':_0x422556[_0xa8cc('0x30')],'sectionId':_0x422556['id']},{})[_0xa8cc('0x2c')](function(){return _0x3461bf;});}else{return _0x3461bf;}})[_0xa8cc('0x4e')](function(_0x319b25){logger['error'](_0xa8cc('0x58'),_0x319b25);throw _0x319b25;});}return _0x3461bf;})[_0xa8cc('0x2c')](respondWithResult(_0x4e283a,0xc9))[_0xa8cc('0x4e')](handleError(_0x4e283a,null));};exports[_0xa8cc('0x59')]=function(_0x58143b,_0x3d29e1){var _0x48f817={'raw':![],'where':{'id':_0x58143b[_0xa8cc('0x5a')]['id']}},_0x504577={};_0x504577['model']=_[_0xa8cc('0x36')](db[_0xa8cc('0x33')][_0xa8cc('0x34')]);_0x48f817[_0xa8cc('0x39')]=_['intersection'](_0x504577[_0xa8cc('0x35')],qs[_0xa8cc('0x3b')](_0x58143b[_0xa8cc('0x37')][_0xa8cc('0x3b')]));_0x48f817[_0xa8cc('0x39')]=_0x48f817['attributes'][_0xa8cc('0x3c')]?_0x48f817['attributes']:_0x504577[_0xa8cc('0x35')];if(_0x58143b['query'][_0xa8cc('0x4a')]){_0x48f817[_0xa8cc('0x4b')]=[{'all':!![]}];}_0x48f817=_[_0xa8cc('0x4f')]({},_0x48f817,_0x58143b[_0xa8cc('0x49')]);return db[_0xa8cc('0x33')]['find'](_0x48f817)[_0xa8cc('0x2c')](handleEntityNotFound(_0x3d29e1,null))[_0xa8cc('0x2c')](function(_0xdb7c0e){if(_0xdb7c0e){var _0x44315a=_0xdb7c0e[_0xa8cc('0x28')]({'plain':!![]});_0x44315a=qs[_0xa8cc('0x5b')](_0x44315a,['id',_0xa8cc('0x5c'),_0xa8cc('0x5d')]);_0x58143b[_0xa8cc('0x52')]=_[_0xa8cc('0x5b')](_0x58143b[_0xa8cc('0x52')],['id','createdAt',_0xa8cc('0x5d')]);return db[_0xa8cc('0x33')]['create'](_['merge'](_0x44315a,_0x58143b['body']),{'include':_0x58143b[_0xa8cc('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0xa8cc('0x2c')](function(_0x47cb6c){var _0xbd292=_0x58143b[_0xa8cc('0x53')][_0xa8cc('0x28')]({'plain':!![]});if(!_0xbd292)throw new Error(_0xa8cc('0x54'));if(_0xbd292[_0xa8cc('0x55')]==='user'){var _0x5e2887=_0x47cb6c[_0xa8cc('0x28')]({'plain':!![]});var _0x10cadc=_0xa8cc('0x29');return db[_0xa8cc('0x56')][_0xa8cc('0x50')]({'where':{'name':_0x10cadc,'userProfileId':_0xbd292[_0xa8cc('0x57')]},'raw':!![]})[_0xa8cc('0x2c')](function(_0x25bf88){if(_0x25bf88&&_0x25bf88[_0xa8cc('0x5e')]===0x0){return db[_0xa8cc('0x2a')][_0xa8cc('0x51')]({'name':_0x5e2887[_0xa8cc('0x30')],'resourceId':_0x5e2887['id'],'type':_0x25bf88['name'],'sectionId':_0x25bf88['id']},{})[_0xa8cc('0x2c')](function(){return _0x47cb6c;});}else{return _0x47cb6c;}})[_0xa8cc('0x4e')](function(_0x138a97){logger[_0xa8cc('0x2e')](_0xa8cc('0x58'),_0x138a97);throw _0x138a97;});}return _0x47cb6c;});}})['then'](respondWithResult(_0x3d29e1,0xc9))[_0xa8cc('0x4e')](handleError(_0x3d29e1,null));};exports[_0xa8cc('0x27')]=function(_0x1e53e9,_0x11f60a){if(_0x1e53e9[_0xa8cc('0x52')]['id']){delete _0x1e53e9[_0xa8cc('0x52')]['id'];}return db[_0xa8cc('0x33')][_0xa8cc('0x50')]({'where':{'id':_0x1e53e9[_0xa8cc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x11f60a,null))[_0xa8cc('0x2c')](saveUpdates(_0x1e53e9[_0xa8cc('0x52')],null))[_0xa8cc('0x2c')](respondWithResult(_0x11f60a,null))[_0xa8cc('0x4e')](handleError(_0x11f60a,null));};exports['destroy']=function(_0x3fafa6,_0x405a65){return db[_0xa8cc('0x33')][_0xa8cc('0x50')]({'where':{'id':_0x3fafa6[_0xa8cc('0x5a')]['id']}})[_0xa8cc('0x2c')](handleEntityNotFound(_0x405a65,null))[_0xa8cc('0x2c')](removeEntity(_0x405a65,null))[_0xa8cc('0x4e')](handleError(_0x405a65,null));};function widgetAttributes(_0x5050c5){try{switch(_0x5050c5['type']){case _0xa8cc('0x5f'):return[{'name':_0xa8cc('0x60'),'value':_0x5050c5[_0xa8cc('0x60')]||(_0x5050c5['attrs']&&_0x5050c5[_0xa8cc('0x61')][0x0]?_0x5050c5[_0xa8cc('0x61')][0x0][_0xa8cc('0x62')]:undefined)||'https://'}];case'custom':return[{'name':_0xa8cc('0x63'),'value':_0x5050c5[_0xa8cc('0x63')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5[_0xa8cc('0x61')][0x0]?_0x5050c5['attrs'][0x0][_0xa8cc('0x62')]:undefined)||''}];case _0xa8cc('0x64'):return[{'name':'attrHourFormat','value':_0x5050c5[_0xa8cc('0x65')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5[_0xa8cc('0x61')][0x0]?_0x5050c5[_0xa8cc('0x61')][0x0][_0xa8cc('0x62')]:undefined)||_0xa8cc('0x66')},{'name':_0xa8cc('0x67'),'value':_0x5050c5[_0xa8cc('0x67')]||(_0x5050c5['attrs']&&_0x5050c5[_0xa8cc('0x61')][0x1]?_0x5050c5['attrs'][0x1]['value']:undefined)||_0xa8cc('0x68')},{'name':'attrFontSize','value':_0x5050c5[_0xa8cc('0x69')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5['attrs'][0x2]?_0x5050c5[_0xa8cc('0x61')][0x2][_0xa8cc('0x62')]:undefined)||0xc}];case'counter':return[{'name':_0xa8cc('0x6a'),'value':_0x5050c5[_0xa8cc('0x6a')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5['attrs'][0x0]?_0x5050c5[_0xa8cc('0x61')][0x0]['value']:undefined)||'total'},{'name':_0xa8cc('0x6b'),'value':_0x5050c5[_0xa8cc('0x6b')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5['attrs'][0x1]?_0x5050c5[_0xa8cc('0x61')][0x1][_0xa8cc('0x62')]:undefined)||[]},{'name':_0xa8cc('0x69'),'value':_0x5050c5[_0xa8cc('0x69')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5[_0xa8cc('0x61')][0x2]?_0x5050c5[_0xa8cc('0x61')][0x2][_0xa8cc('0x62')]:undefined)||0x14}];case'multibar-chart':case _0xa8cc('0x6c'):return[{'name':_0xa8cc('0x6d'),'value':_0x5050c5[_0xa8cc('0x6d')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5[_0xa8cc('0x61')][0x0]?_0x5050c5['attrs'][0x0][_0xa8cc('0x62')]:undefined)||'total'},{'name':_0xa8cc('0x6e'),'value':_0x5050c5[_0xa8cc('0x6e')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5[_0xa8cc('0x61')][0x1]?_0x5050c5[_0xa8cc('0x61')][0x1]['value']:undefined)||null},{'name':_0xa8cc('0x6f'),'value':_0x5050c5['attrSerie3']||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5[_0xa8cc('0x61')][0x2]?_0x5050c5[_0xa8cc('0x61')][0x2]['value']:undefined)||null},{'name':_0xa8cc('0x6b'),'value':_0x5050c5[_0xa8cc('0x6b')]||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5[_0xa8cc('0x61')][0x3]?_0x5050c5[_0xa8cc('0x61')][0x3][_0xa8cc('0x62')]:undefined)||[]}];case _0xa8cc('0x70'):return[{'name':_0xa8cc('0x71'),'type':_0x5050c5[_0xa8cc('0x72')]||(_0x5050c5['attrs']&&_0x5050c5[_0xa8cc('0x61')][0x0]?_0x5050c5['attrs'][0x0][_0xa8cc('0x45')]:undefined)||null,'value':_0x5050c5['attrReport']||(_0x5050c5[_0xa8cc('0x61')]&&_0x5050c5['attrs'][0x0]?_0x5050c5['attrs'][0x0][_0xa8cc('0x62')]:undefined)||null},{'name':_0xa8cc('0x73'),'value':_0x5050c5[_0xa8cc('0x73')]||(_0x5050c5['attrs']&&_0x5050c5[_0xa8cc('0x61')][0x1]?_0x5050c5[_0xa8cc('0x61')][0x1][_0xa8cc('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x48c6a7){logger[_0xa8cc('0x2e')](_0xa8cc('0x74'),JSON[_0xa8cc('0x75')](_0x48c6a7));return[];}}exports[_0xa8cc('0x76')]=function(_0x632753,_0x11bede,_0xbd8665){if(_0x632753['body']['id']){delete _0x632753[_0xa8cc('0x52')]['id'];}return db[_0xa8cc('0x33')][_0xa8cc('0x50')]({'where':{'id':_0x632753[_0xa8cc('0x5a')]['id']}})[_0xa8cc('0x2c')](handleEntityNotFound(_0x11bede,null))[_0xa8cc('0x2c')](function(_0x15f23d){if(_0x15f23d){_0x632753[_0xa8cc('0x52')][_0xa8cc('0x77')]=_0x15f23d['id'];_0x632753[_0xa8cc('0x52')][_0xa8cc('0x61')]=widgetAttributes(_0x632753[_0xa8cc('0x52')]);return db[_0xa8cc('0x78')][_0xa8cc('0x51')](_0x632753[_0xa8cc('0x52')]);}})[_0xa8cc('0x2c')](respondWithResult(_0x11bede,null))[_0xa8cc('0x4e')](handleError(_0x11bede,null));};exports['getItems']=function(_0xa1294a,_0x1a2438,_0x35c53d){var _0x11f523={};var _0x1f6b60={};var _0x31b6e2;var _0x324c74;return db[_0xa8cc('0x33')][_0xa8cc('0x79')]({'where':{'id':_0xa1294a['params']['id']}})['then'](handleEntityNotFound(_0x1a2438,null))['then'](function(_0x52892e){if(_0x52892e){_0x31b6e2=_0x52892e;_0x1f6b60['model']=_[_0xa8cc('0x36')](db[_0xa8cc('0x78')]['rawAttributes']);_0x1f6b60[_0xa8cc('0x37')]=_[_0xa8cc('0x36')](_0xa1294a[_0xa8cc('0x37')]);_0x1f6b60[_0xa8cc('0x38')]=_['intersection'](_0x1f6b60[_0xa8cc('0x35')],_0x1f6b60[_0xa8cc('0x37')]);_0x11f523[_0xa8cc('0x39')]=_[_0xa8cc('0x3a')](_0x1f6b60[_0xa8cc('0x35')],qs[_0xa8cc('0x3b')](_0xa1294a['query']['fields']));_0x11f523[_0xa8cc('0x39')]=_0x11f523[_0xa8cc('0x39')][_0xa8cc('0x3c')]?_0x11f523[_0xa8cc('0x39')]:_0x1f6b60[_0xa8cc('0x35')];_0x11f523[_0xa8cc('0x40')]=qs['sort'](_0xa1294a['query'][_0xa8cc('0x41')]);_0x11f523[_0xa8cc('0x42')]=qs[_0xa8cc('0x38')](_[_0xa8cc('0x7a')](_0xa1294a[_0xa8cc('0x37')],_0x1f6b60[_0xa8cc('0x38')]));if(_0xa1294a[_0xa8cc('0x37')]['filter']){_0x11f523[_0xa8cc('0x42')]=_[_0xa8cc('0x4f')](_0x11f523[_0xa8cc('0x42')],{'$or':_['map'](_0x11f523[_0xa8cc('0x39')],function(_0x4fe715){var _0x2d062e={};_0x2d062e[_0x4fe715]={'$like':'%'+_0xa1294a[_0xa8cc('0x37')][_0xa8cc('0x43')]+'%'};return _0x2d062e;})});}_0x11f523=_[_0xa8cc('0x4f')]({},_0x11f523,_0xa1294a[_0xa8cc('0x49')]);return _0x31b6e2[_0xa8cc('0x7b')](_0x11f523);}})['then'](function(_0x41a192){if(_0x41a192){_0x324c74=_0x41a192[_0xa8cc('0x3c')];if(!_0xa1294a['query'][_0xa8cc('0x3d')](_0xa8cc('0x3e'))){_0x11f523['limit']=qs[_0xa8cc('0x3f')](_0xa1294a[_0xa8cc('0x37')][_0xa8cc('0x3f')]);_0x11f523[_0xa8cc('0x21')]=qs[_0xa8cc('0x21')](_0xa1294a['query'][_0xa8cc('0x21')]);}return _0x31b6e2[_0xa8cc('0x7b')](_0x11f523);}})['then'](function(_0x538d2b){if(_0x538d2b){return _0x538d2b?{'count':_0x324c74,'rows':_0x538d2b}:null;}})['then'](respondWithResult(_0x1a2438,null))[_0xa8cc('0x4e')](handleError(_0x1a2438,null));}; \ No newline at end of file +var _0x2883=['DashboardItem','getItems','findOne','order','map','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','status','sendStatus','stack','name','send','Dashboard','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','key','VIRTUAL','field','filter','options','count','includeAll','include','findAll','catch','params','find','create','body','user','get','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId'];(function(_0x428897,_0x29baf2){var _0x41f740=function(_0x5e7e1a){while(--_0x5e7e1a){_0x428897['push'](_0x428897['shift']());}};_0x41f740(++_0x29baf2);}(_0x2883,0x1ed));var _0x3288=function(_0x1165f1,_0x4d92ef){_0x1165f1=_0x1165f1-0x0;var _0x1479b9=_0x2883[_0x1165f1];return _0x1479b9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3288('0x0'));var rimraf=require(_0x3288('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3288('0x2'));var moment=require('moment');var BPromise=require(_0x3288('0x3'));var Mustache=require(_0x3288('0x4'));var util=require(_0x3288('0x5'));var path=require(_0x3288('0x6'));var sox=require('sox');var csv=require(_0x3288('0x7'));var ejs=require(_0x3288('0x8'));var fs=require('fs');var _=require(_0x3288('0x9'));var squel=require(_0x3288('0xa'));var crypto=require(_0x3288('0xb'));var jsforce=require(_0x3288('0xc'));var deskjs=require(_0x3288('0xd'));var toCsv=require(_0x3288('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3288('0xe'));var authService=require(_0x3288('0xf'));var qs=require(_0x3288('0x10'));var hardwareService=require(_0x3288('0x11'));var logger=require(_0x3288('0x12'))(_0x3288('0x13'));var utils=require(_0x3288('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3288('0x15')](config[_0x3288('0x16')],{'host':_0x3288('0x17'),'port':0x18eb});var socket=require(_0x3288('0x18'))(new Redis(config[_0x3288('0x16')]));require(_0x3288('0x19'))[_0x3288('0x1a')](socket);function respondWithStatusCode(_0x1ee50c,_0x39ac78){_0x39ac78=_0x39ac78||0xcc;return function(_0x5b2091){if(_0x5b2091){return _0x1ee50c['sendStatus'](_0x39ac78);}return _0x1ee50c['status'](_0x39ac78)[_0x3288('0x1b')]();};}function respondWithResult(_0x1821f5,_0x2d68eb){_0x2d68eb=_0x2d68eb||0xc8;return function(_0x4cfc57){if(_0x4cfc57){return _0x1821f5['status'](_0x2d68eb)['json'](_0x4cfc57);}};}function respondWithFilteredResult(_0x3e8559,_0x58c829){return function(_0xdf94be){if(_0xdf94be){var _0x5af1c5=_0xdf94be['count'],_0x21feed=_0x58c829[_0x3288('0x1c')],_0x401b25=_0x58c829[_0x3288('0x1c')]+_0x58c829[_0x3288('0x1d')],_0x5bfafa;if(_0x401b25>=_0x5af1c5){_0x401b25=_0x5af1c5;_0x5bfafa=0xc8;}else{_0x5bfafa=0xce;}_0x3e8559['status'](_0x5bfafa);return _0x3e8559[_0x3288('0x1e')](_0x3288('0x1f'),_0x21feed+'-'+_0x401b25+'/'+_0x5af1c5)[_0x3288('0x20')](_0xdf94be);}return null;};}function patchUpdates(_0x3147de){return function(_0x3ae2cc){try{jsonpatch[_0x3288('0x21')](_0x3ae2cc,_0x3147de,!![]);}catch(_0x57b903){return BPromise[_0x3288('0x22')](_0x57b903);}return _0x3ae2cc[_0x3288('0x23')]();};}function saveUpdates(_0x3ea7cd,_0x21d38c){return function(_0x24ef39){if(_0x24ef39){return _0x24ef39[_0x3288('0x24')](_0x3ea7cd)[_0x3288('0x25')](function(_0x358471){return _0x358471;});}return null;};}function removeEntity(_0x564c1a,_0x3b4dea){return function(_0x42fc71){if(_0x42fc71){return _0x42fc71[_0x3288('0x26')]()[_0x3288('0x25')](function(){var _0x1a97ce=_0x42fc71['get']({'plain':!![]});var _0x3d6e2f=_0x3288('0x27');return db[_0x3288('0x28')][_0x3288('0x26')]({'where':{'type':_0x3d6e2f,'resourceId':_0x1a97ce['id']}})[_0x3288('0x25')](function(){return _0x42fc71;});})[_0x3288('0x25')](function(){_0x564c1a[_0x3288('0x29')](0xcc)[_0x3288('0x1b')]();});}};}function handleEntityNotFound(_0x3c535d,_0x209394){return function(_0x4d8d8d){if(!_0x4d8d8d){_0x3c535d[_0x3288('0x2a')](0x194);}return _0x4d8d8d;};}function handleError(_0x4cc051,_0x366db8){_0x366db8=_0x366db8||0x1f4;return function(_0x12be90){logger['error'](_0x12be90[_0x3288('0x2b')]);if(_0x12be90[_0x3288('0x2c')]){delete _0x12be90[_0x3288('0x2c')];}_0x4cc051[_0x3288('0x29')](_0x366db8)[_0x3288('0x2d')](_0x12be90);};}exports['index']=function(_0x3ce2e6,_0x149a8e){var _0x2f84b3={},_0x362b9f={},_0x505408={'count':0x0,'rows':[]};var _0x14c7a2=db[_0x3288('0x2e')][_0x3288('0x2f')];_0x362b9f[_0x3288('0x30')]=_[_0x3288('0x31')](_0x14c7a2);_0x362b9f['query']=_[_0x3288('0x31')](_0x3ce2e6[_0x3288('0x32')]);_0x362b9f[_0x3288('0x33')]=_[_0x3288('0x34')](_0x362b9f[_0x3288('0x30')],_0x362b9f[_0x3288('0x32')]);_0x2f84b3[_0x3288('0x35')]=_[_0x3288('0x34')](_0x362b9f[_0x3288('0x30')],qs[_0x3288('0x36')](_0x3ce2e6[_0x3288('0x32')][_0x3288('0x36')]));_0x2f84b3[_0x3288('0x35')]=_0x2f84b3['attributes'][_0x3288('0x37')]?_0x2f84b3[_0x3288('0x35')]:_0x362b9f[_0x3288('0x30')];if(!_0x3ce2e6[_0x3288('0x32')][_0x3288('0x38')](_0x3288('0x39'))){_0x2f84b3[_0x3288('0x1d')]=qs[_0x3288('0x1d')](_0x3ce2e6['query'][_0x3288('0x1d')]);_0x2f84b3[_0x3288('0x1c')]=qs[_0x3288('0x1c')](_0x3ce2e6[_0x3288('0x32')][_0x3288('0x1c')]);}_0x2f84b3['order']=qs[_0x3288('0x3a')](_0x3ce2e6[_0x3288('0x32')][_0x3288('0x3a')]);_0x2f84b3['where']=qs[_0x3288('0x33')](_[_0x3288('0x3b')](_0x3ce2e6[_0x3288('0x32')],_0x362b9f[_0x3288('0x33')]));if(_0x3ce2e6[_0x3288('0x32')]['filter']){_0x2f84b3[_0x3288('0x3c')]=_[_0x3288('0x3d')](_0x2f84b3[_0x3288('0x3c')],{'$or':_['map'](_0x14c7a2,function(_0xf4429f){if(_0xf4429f[_0x3288('0x3e')][_0x3288('0x3f')]!==_0x3288('0x40')){var _0x561c26={};_0x561c26[_0xf4429f[_0x3288('0x41')]]={'$like':'%'+_0x3ce2e6[_0x3288('0x32')][_0x3288('0x42')]+'%'};return _0x561c26;}})});}_0x2f84b3=_[_0x3288('0x3d')]({},_0x2f84b3,_0x3ce2e6[_0x3288('0x43')]);var _0x24538d={'where':_0x2f84b3[_0x3288('0x3c')]};return db[_0x3288('0x2e')][_0x3288('0x44')](_0x24538d)['then'](function(_0x5e81e8){_0x505408[_0x3288('0x44')]=_0x5e81e8;if(_0x3ce2e6[_0x3288('0x32')][_0x3288('0x45')]){_0x2f84b3[_0x3288('0x46')]=[{'all':!![]}];}return db[_0x3288('0x2e')][_0x3288('0x47')](_0x2f84b3);})[_0x3288('0x25')](function(_0x1adcd4){_0x505408['rows']=_0x1adcd4;return _0x505408;})['then'](respondWithFilteredResult(_0x149a8e,_0x2f84b3))[_0x3288('0x48')](handleError(_0x149a8e,null));};exports['show']=function(_0x4db238,_0x3eea89){var _0x39c1ea={'raw':![],'where':{'id':_0x4db238[_0x3288('0x49')]['id']}},_0x3e8c91={};_0x3e8c91[_0x3288('0x30')]=_[_0x3288('0x31')](db[_0x3288('0x2e')][_0x3288('0x2f')]);_0x3e8c91[_0x3288('0x32')]=_[_0x3288('0x31')](_0x4db238[_0x3288('0x32')]);_0x3e8c91[_0x3288('0x33')]=_[_0x3288('0x34')](_0x3e8c91['model'],_0x3e8c91[_0x3288('0x32')]);_0x39c1ea['attributes']=_[_0x3288('0x34')](_0x3e8c91[_0x3288('0x30')],qs['fields'](_0x4db238[_0x3288('0x32')][_0x3288('0x36')]));_0x39c1ea[_0x3288('0x35')]=_0x39c1ea[_0x3288('0x35')][_0x3288('0x37')]?_0x39c1ea[_0x3288('0x35')]:_0x3e8c91[_0x3288('0x30')];if(_0x4db238['query']['includeAll']){_0x39c1ea['include']=[{'all':!![]}];}_0x39c1ea=_['merge']({},_0x39c1ea,_0x4db238[_0x3288('0x43')]);return db[_0x3288('0x2e')][_0x3288('0x4a')](_0x39c1ea)[_0x3288('0x25')](handleEntityNotFound(_0x3eea89,null))['then'](respondWithResult(_0x3eea89,null))['catch'](handleError(_0x3eea89,null));};exports['create']=function(_0x440c35,_0x3b8c32){return db[_0x3288('0x2e')][_0x3288('0x4b')](_0x440c35[_0x3288('0x4c')],{})[_0x3288('0x25')](function(_0x64db09){var _0x529d69=_0x440c35[_0x3288('0x4d')][_0x3288('0x4e')]({'plain':!![]});if(!_0x529d69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x529d69[_0x3288('0x4f')]===_0x3288('0x4d')){var _0x1d3344=_0x64db09['get']({'plain':!![]});var _0x184e07=_0x3288('0x27');return db[_0x3288('0x50')][_0x3288('0x4a')]({'where':{'name':_0x184e07,'userProfileId':_0x529d69['userProfileId']},'raw':!![]})['then'](function(_0x13c8e6){if(_0x13c8e6&&_0x13c8e6[_0x3288('0x51')]===0x0){return db['UserProfileResource'][_0x3288('0x4b')]({'name':_0x1d3344[_0x3288('0x2c')],'resourceId':_0x1d3344['id'],'type':_0x13c8e6[_0x3288('0x2c')],'sectionId':_0x13c8e6['id']},{})[_0x3288('0x25')](function(){return _0x64db09;});}else{return _0x64db09;}})[_0x3288('0x48')](function(_0xde3433){logger[_0x3288('0x52')](_0x3288('0x53'),_0xde3433);throw _0xde3433;});}return _0x64db09;})[_0x3288('0x25')](respondWithResult(_0x3b8c32,0xc9))[_0x3288('0x48')](handleError(_0x3b8c32,null));};exports[_0x3288('0x54')]=function(_0x6a3c1a,_0x45c413){var _0x4b32b2={'raw':![],'where':{'id':_0x6a3c1a[_0x3288('0x49')]['id']}},_0x27abb9={};_0x27abb9[_0x3288('0x30')]=_[_0x3288('0x31')](db[_0x3288('0x2e')][_0x3288('0x2f')]);_0x4b32b2['attributes']=_[_0x3288('0x34')](_0x27abb9['model'],qs[_0x3288('0x36')](_0x6a3c1a[_0x3288('0x32')][_0x3288('0x36')]));_0x4b32b2[_0x3288('0x35')]=_0x4b32b2[_0x3288('0x35')][_0x3288('0x37')]?_0x4b32b2[_0x3288('0x35')]:_0x27abb9[_0x3288('0x30')];if(_0x6a3c1a[_0x3288('0x32')][_0x3288('0x45')]){_0x4b32b2[_0x3288('0x46')]=[{'all':!![]}];}_0x4b32b2=_[_0x3288('0x3d')]({},_0x4b32b2,_0x6a3c1a[_0x3288('0x43')]);return db[_0x3288('0x2e')][_0x3288('0x4a')](_0x4b32b2)[_0x3288('0x25')](handleEntityNotFound(_0x45c413,null))[_0x3288('0x25')](function(_0x3c78c8){if(_0x3c78c8){var _0x1c33af=_0x3c78c8['get']({'plain':!![]});_0x1c33af=qs[_0x3288('0x55')](_0x1c33af,['id',_0x3288('0x56'),'updatedAt']);_0x6a3c1a['body']=_['omit'](_0x6a3c1a[_0x3288('0x4c')],['id',_0x3288('0x56'),_0x3288('0x57')]);return db[_0x3288('0x2e')]['create'](_[_0x3288('0x3d')](_0x1c33af,_0x6a3c1a[_0x3288('0x4c')]),{'include':_0x6a3c1a['query'][_0x3288('0x45')]?[{'all':!![]}]:undefined})[_0x3288('0x25')](function(_0x1e032e){var _0x5540dc=_0x6a3c1a[_0x3288('0x4d')][_0x3288('0x4e')]({'plain':!![]});if(!_0x5540dc)throw new Error(_0x3288('0x58'));if(_0x5540dc[_0x3288('0x4f')]===_0x3288('0x4d')){var _0xa4ebaa=_0x1e032e[_0x3288('0x4e')]({'plain':!![]});var _0x5ac647=_0x3288('0x27');return db[_0x3288('0x50')]['find']({'where':{'name':_0x5ac647,'userProfileId':_0x5540dc['userProfileId']},'raw':!![]})[_0x3288('0x25')](function(_0x565d22){if(_0x565d22&&_0x565d22[_0x3288('0x51')]===0x0){return db[_0x3288('0x28')][_0x3288('0x4b')]({'name':_0xa4ebaa[_0x3288('0x2c')],'resourceId':_0xa4ebaa['id'],'type':_0x565d22['name'],'sectionId':_0x565d22['id']},{})[_0x3288('0x25')](function(){return _0x1e032e;});}else{return _0x1e032e;}})[_0x3288('0x48')](function(_0x252445){logger[_0x3288('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x252445);throw _0x252445;});}return _0x1e032e;});}})[_0x3288('0x25')](respondWithResult(_0x45c413,0xc9))[_0x3288('0x48')](handleError(_0x45c413,null));};exports['update']=function(_0x25ebb6,_0xc9f9ae){if(_0x25ebb6[_0x3288('0x4c')]['id']){delete _0x25ebb6[_0x3288('0x4c')]['id'];}return db[_0x3288('0x2e')][_0x3288('0x4a')]({'where':{'id':_0x25ebb6[_0x3288('0x49')]['id']}})[_0x3288('0x25')](handleEntityNotFound(_0xc9f9ae,null))[_0x3288('0x25')](saveUpdates(_0x25ebb6['body'],null))['then'](respondWithResult(_0xc9f9ae,null))['catch'](handleError(_0xc9f9ae,null));};exports['destroy']=function(_0x5ce7f8,_0x213a70){return db[_0x3288('0x2e')][_0x3288('0x4a')]({'where':{'id':_0x5ce7f8[_0x3288('0x49')]['id']}})[_0x3288('0x25')](handleEntityNotFound(_0x213a70,null))['then'](removeEntity(_0x213a70,null))[_0x3288('0x48')](handleError(_0x213a70,null));};function widgetAttributes(_0x4477e2){try{switch(_0x4477e2[_0x3288('0x3e')]){case _0x3288('0x59'):return[{'name':_0x3288('0x5a'),'value':_0x4477e2[_0x3288('0x5a')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2['attrs'][0x0]?_0x4477e2[_0x3288('0x5b')][0x0]['value']:undefined)||'https://'}];case _0x3288('0x5c'):return[{'name':_0x3288('0x5d'),'value':_0x4477e2[_0x3288('0x5d')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x0]?_0x4477e2['attrs'][0x0][_0x3288('0x5e')]:undefined)||''}];case _0x3288('0x5f'):return[{'name':_0x3288('0x60'),'value':_0x4477e2[_0x3288('0x60')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2['attrs'][0x0]?_0x4477e2[_0x3288('0x5b')][0x0][_0x3288('0x5e')]:undefined)||_0x3288('0x61')},{'name':_0x3288('0x62'),'value':_0x4477e2[_0x3288('0x62')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x1]?_0x4477e2[_0x3288('0x5b')][0x1][_0x3288('0x5e')]:undefined)||_0x3288('0x63')},{'name':_0x3288('0x64'),'value':_0x4477e2[_0x3288('0x64')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x2]?_0x4477e2['attrs'][0x2][_0x3288('0x5e')]:undefined)||0xc}];case _0x3288('0x65'):return[{'name':_0x3288('0x66'),'value':_0x4477e2['attrMetric']||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x0]?_0x4477e2['attrs'][0x0][_0x3288('0x5e')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x4477e2[_0x3288('0x67')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x1]?_0x4477e2[_0x3288('0x5b')][0x1][_0x3288('0x5e')]:undefined)||[]},{'name':_0x3288('0x64'),'value':_0x4477e2[_0x3288('0x64')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x2]?_0x4477e2[_0x3288('0x5b')][0x2]['value']:undefined)||0x14}];case _0x3288('0x68'):case _0x3288('0x69'):return[{'name':'attrSerie1','value':_0x4477e2[_0x3288('0x6a')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x0]?_0x4477e2[_0x3288('0x5b')][0x0]['value']:undefined)||_0x3288('0x6b')},{'name':'attrSerie2','value':_0x4477e2[_0x3288('0x6c')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x1]?_0x4477e2[_0x3288('0x5b')][0x1][_0x3288('0x5e')]:undefined)||null},{'name':_0x3288('0x6d'),'value':_0x4477e2['attrSerie3']||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2['attrs'][0x2]?_0x4477e2[_0x3288('0x5b')][0x2][_0x3288('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4477e2[_0x3288('0x67')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x3]?_0x4477e2['attrs'][0x3][_0x3288('0x5e')]:undefined)||[]}];case _0x3288('0x6e'):return[{'name':_0x3288('0x6f'),'type':_0x4477e2[_0x3288('0x70')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2[_0x3288('0x5b')][0x0]?_0x4477e2[_0x3288('0x5b')][0x0]['type']:undefined)||null,'value':_0x4477e2[_0x3288('0x6f')]||(_0x4477e2['attrs']&&_0x4477e2[_0x3288('0x5b')][0x0]?_0x4477e2[_0x3288('0x5b')][0x0][_0x3288('0x5e')]:undefined)||null},{'name':_0x3288('0x71'),'value':_0x4477e2[_0x3288('0x71')]||(_0x4477e2[_0x3288('0x5b')]&&_0x4477e2['attrs'][0x1]?_0x4477e2[_0x3288('0x5b')][0x1][_0x3288('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x4b0044){logger[_0x3288('0x52')](_0x3288('0x72'),JSON[_0x3288('0x73')](_0x4b0044));return[];}}exports['addItem']=function(_0x983936,_0x187af1,_0x57e9a2){if(_0x983936[_0x3288('0x4c')]['id']){delete _0x983936[_0x3288('0x4c')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x983936[_0x3288('0x49')]['id']}})['then'](handleEntityNotFound(_0x187af1,null))[_0x3288('0x25')](function(_0x48d4f7){if(_0x48d4f7){_0x983936[_0x3288('0x4c')][_0x3288('0x74')]=_0x48d4f7['id'];_0x983936[_0x3288('0x4c')][_0x3288('0x5b')]=widgetAttributes(_0x983936[_0x3288('0x4c')]);return db[_0x3288('0x75')][_0x3288('0x4b')](_0x983936[_0x3288('0x4c')]);}})['then'](respondWithResult(_0x187af1,null))[_0x3288('0x48')](handleError(_0x187af1,null));};exports[_0x3288('0x76')]=function(_0x33bff8,_0x43de70,_0x12c480){var _0x804891={};var _0x490432={};var _0x2c9cc7;var _0x2b1e26;return db[_0x3288('0x2e')][_0x3288('0x77')]({'where':{'id':_0x33bff8[_0x3288('0x49')]['id']}})[_0x3288('0x25')](handleEntityNotFound(_0x43de70,null))[_0x3288('0x25')](function(_0x3951b0){if(_0x3951b0){_0x2c9cc7=_0x3951b0;_0x490432[_0x3288('0x30')]=_[_0x3288('0x31')](db[_0x3288('0x75')][_0x3288('0x2f')]);_0x490432[_0x3288('0x32')]=_[_0x3288('0x31')](_0x33bff8[_0x3288('0x32')]);_0x490432[_0x3288('0x33')]=_['intersection'](_0x490432[_0x3288('0x30')],_0x490432[_0x3288('0x32')]);_0x804891[_0x3288('0x35')]=_[_0x3288('0x34')](_0x490432[_0x3288('0x30')],qs[_0x3288('0x36')](_0x33bff8[_0x3288('0x32')][_0x3288('0x36')]));_0x804891['attributes']=_0x804891[_0x3288('0x35')]['length']?_0x804891[_0x3288('0x35')]:_0x490432['model'];_0x804891[_0x3288('0x78')]=qs['sort'](_0x33bff8['query'][_0x3288('0x3a')]);_0x804891[_0x3288('0x3c')]=qs[_0x3288('0x33')](_[_0x3288('0x3b')](_0x33bff8[_0x3288('0x32')],_0x490432['filters']));if(_0x33bff8[_0x3288('0x32')]['filter']){_0x804891[_0x3288('0x3c')]=_[_0x3288('0x3d')](_0x804891[_0x3288('0x3c')],{'$or':_[_0x3288('0x79')](_0x804891[_0x3288('0x35')],function(_0x18f600){var _0x2b47cf={};_0x2b47cf[_0x18f600]={'$like':'%'+_0x33bff8['query'][_0x3288('0x42')]+'%'};return _0x2b47cf;})});}_0x804891=_[_0x3288('0x3d')]({},_0x804891,_0x33bff8['options']);return _0x2c9cc7[_0x3288('0x76')](_0x804891);}})[_0x3288('0x25')](function(_0x453915){if(_0x453915){_0x2b1e26=_0x453915[_0x3288('0x37')];if(!_0x33bff8[_0x3288('0x32')]['hasOwnProperty'](_0x3288('0x39'))){_0x804891[_0x3288('0x1d')]=qs[_0x3288('0x1d')](_0x33bff8[_0x3288('0x32')][_0x3288('0x1d')]);_0x804891[_0x3288('0x1c')]=qs['offset'](_0x33bff8['query'][_0x3288('0x1c')]);}return _0x2c9cc7['getItems'](_0x804891);}})[_0x3288('0x25')](function(_0xf90983){if(_0xf90983){return _0xf90983?{'count':_0x2b1e26,'rows':_0xf90983}:null;}})[_0x3288('0x25')](respondWithResult(_0x43de70,null))[_0x3288('0x48')](handleError(_0x43de70,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c3841a2..69294a3 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 _0x4d6d=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x295732,_0x56a6fd){var _0x4fc75b=function(_0x53dddb){while(--_0x53dddb){_0x295732['push'](_0x295732['shift']());}};_0x4fc75b(++_0x56a6fd);}(_0x4d6d,0xfc));var _0xd4d6=function(_0x4ad8ee,_0xea2d79){_0x4ad8ee=_0x4ad8ee-0x0;var _0x5b6373=_0x4d6d[_0x4ad8ee];return _0x5b6373;};'use strict';var EventEmitter=require(_0xd4d6('0x0'));var Dashboard=require(_0xd4d6('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd4d6('0x2')](0x0);var events={'afterCreate':_0xd4d6('0x3'),'afterUpdate':_0xd4d6('0x4'),'afterDestroy':_0xd4d6('0x5')};function emitEvent(_0x4bfb0e){return function(_0x4c2b7b,_0x4d234a,_0x5ac2b2){DashboardEvents[_0xd4d6('0x6')](_0x4bfb0e+':'+_0x4c2b7b['id'],_0x4c2b7b);DashboardEvents[_0xd4d6('0x6')](_0x4bfb0e,_0x4c2b7b);_0x5ac2b2(null);};}for(var e in events){if(events[_0xd4d6('0x7')](e)){var event=events[e];Dashboard[_0xd4d6('0x8')](e,emitEvent(event));}}module[_0xd4d6('0x9')]=DashboardEvents; \ No newline at end of file +var _0xa501=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x5f46c4,_0x505a0f){var _0x2f770a=function(_0x47424b){while(--_0x47424b){_0x5f46c4['push'](_0x5f46c4['shift']());}};_0x2f770a(++_0x505a0f);}(_0xa501,0x179));var _0x1a50=function(_0x2f13f2,_0x6114d7){_0x2f13f2=_0x2f13f2-0x0;var _0x124713=_0xa501[_0x2f13f2];return _0x124713;};'use strict';var EventEmitter=require(_0x1a50('0x0'));var Dashboard=require(_0x1a50('0x1'))['db'][_0x1a50('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1a50('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a50('0x4'),'afterDestroy':_0x1a50('0x5')};function emitEvent(_0x389444){return function(_0x2946c5,_0x4e3395,_0x4855cc){DashboardEvents[_0x1a50('0x6')](_0x389444+':'+_0x2946c5['id'],_0x2946c5);DashboardEvents['emit'](_0x389444,_0x2946c5);_0x4855cc(null);};}for(var e in events){if(events[_0x1a50('0x7')](e)){var event=events[e];Dashboard[_0x1a50('0x8')](e,emitEvent(event));}}module[_0x1a50('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 69e525a..963bbde 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 _0x8888=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util'];(function(_0x3852f1,_0x2a1e79){var _0x33f4b6=function(_0x304691){while(--_0x304691){_0x3852f1['push'](_0x3852f1['shift']());}};_0x33f4b6(++_0x2a1e79);}(_0x8888,0x1a2));var _0x8888=function(_0x1dc1e9,_0x21448f){_0x1dc1e9=_0x1dc1e9-0x0;var _0x45e150=_0x8888[_0x1dc1e9];return _0x45e150;};'use strict';var _=require(_0x8888('0x0'));var util=require(_0x8888('0x1'));var logger=require('../../config/logger')(_0x8888('0x2'));var moment=require(_0x8888('0x3'));var BPromise=require(_0x8888('0x4'));var rp=require(_0x8888('0x5'));var fs=require('fs');var path=require(_0x8888('0x6'));var rimraf=require(_0x8888('0x7'));var config=require(_0x8888('0x8'));var attributes=require(_0x8888('0x9'));module[_0x8888('0xa')]=function(_0x2d6100,_0x4c0f9e){return _0x2d6100[_0x8888('0xb')](_0x8888('0xc'),attributes,{'tableName':_0x8888('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb81c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards'];(function(_0x2af575,_0x22a4e6){var _0x28c5a8=function(_0x21c15e){while(--_0x21c15e){_0x2af575['push'](_0x2af575['shift']());}};_0x28c5a8(++_0x22a4e6);}(_0xb81c,0x1ba));var _0xcb81=function(_0x365c0a,_0x26dcb7){_0x365c0a=_0x365c0a-0x0;var _0x19e3e7=_0xb81c[_0x365c0a];return _0x19e3e7;};'use strict';var _=require('lodash');var util=require(_0xcb81('0x0'));var logger=require(_0xcb81('0x1'))(_0xcb81('0x2'));var moment=require(_0xcb81('0x3'));var BPromise=require(_0xcb81('0x4'));var rp=require(_0xcb81('0x5'));var fs=require('fs');var path=require(_0xcb81('0x6'));var rimraf=require(_0xcb81('0x7'));var config=require(_0xcb81('0x8'));var attributes=require(_0xcb81('0x9'));module[_0xcb81('0xa')]=function(_0x44f11d,_0x2ef3ca){return _0x44f11d[_0xcb81('0xb')]('Dashboard',attributes,{'tableName':_0xcb81('0xc'),'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 cc6b315..ebf967a 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 _0x3028=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x13ea36,_0x2805ad){var _0x312066=function(_0xfbee88){while(--_0xfbee88){_0x13ea36['push'](_0x13ea36['shift']());}};_0x312066(++_0x2805ad);}(_0x3028,0x1b0));var _0x8302=function(_0x4c7f14,_0x15fec4){_0x4c7f14=_0x4c7f14-0x0;var _0xae312f=_0x3028[_0x4c7f14];return _0xae312f;};'use strict';var _=require('lodash');var util=require(_0x8302('0x0'));var moment=require(_0x8302('0x1'));var BPromise=require(_0x8302('0x2'));var rs=require(_0x8302('0x3'));var fs=require('fs');var Redis=require(_0x8302('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8302('0x5'));var logger=require(_0x8302('0x6'))(_0x8302('0x7'));var config=require(_0x8302('0x8'));var jayson=require(_0x8302('0x9'));var client=jayson[_0x8302('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8302('0xb')](config['redis'],{'host':_0x8302('0xc'),'port':0x18eb});var socket=require(_0x8302('0xd'))(new Redis(config[_0x8302('0xe')]));require('./dashboard.socket')[_0x8302('0xf')](socket);function respondWithRpcPromise(_0x5a6efe,_0x35eea1,_0x4464fa){return new BPromise(function(_0xced1f7,_0x4525ba){return client['request'](_0x5a6efe,_0x4464fa)[_0x8302('0x10')](function(_0x3678d6){logger[_0x8302('0x11')](_0x8302('0x12'),_0x35eea1,'request\x20sent');logger[_0x8302('0x13')](_0x8302('0x14'),_0x35eea1,_0x8302('0x15'),JSON[_0x8302('0x16')](_0x3678d6));if(_0x3678d6[_0x8302('0x17')]){if(_0x3678d6[_0x8302('0x17')]['code']===0x1f4){logger[_0x8302('0x17')]('Dashboard,\x20%s,\x20%s',_0x35eea1,_0x3678d6[_0x8302('0x17')][_0x8302('0x18')]);return _0x4525ba(_0x3678d6[_0x8302('0x17')]['message']);}logger[_0x8302('0x17')]('Dashboard,\x20%s,\x20%s',_0x35eea1,_0x3678d6['error'][_0x8302('0x18')]);return _0xced1f7(_0x3678d6[_0x8302('0x17')][_0x8302('0x18')]);}else{logger[_0x8302('0x11')](_0x8302('0x12'),_0x35eea1,'request\x20sent');_0xced1f7(_0x3678d6[_0x8302('0x19')]['message']);}})[_0x8302('0x1a')](function(_0x2c1d58){logger[_0x8302('0x17')]('Dashboard,\x20%s,\x20%s',_0x35eea1,_0x2c1d58);_0x4525ba(_0x2c1d58);});});} \ No newline at end of file +var _0xbd23=['message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboard.socket','register','request','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','Dashboard,\x20%s,\x20%s','error'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbd23,0x9d));var _0x3bd2=function(_0x88b93a,_0x35f101){_0x88b93a=_0x88b93a-0x0;var _0xf230e2=_0xbd23[_0x88b93a];return _0xf230e2;};'use strict';var _=require(_0x3bd2('0x0'));var util=require(_0x3bd2('0x1'));var moment=require('moment');var BPromise=require(_0x3bd2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bd2('0x3'));var db=require(_0x3bd2('0x4'))['db'];var utils=require(_0x3bd2('0x5'));var logger=require(_0x3bd2('0x6'))(_0x3bd2('0x7'));var config=require(_0x3bd2('0x8'));var jayson=require(_0x3bd2('0x9'));var client=jayson[_0x3bd2('0xa')][_0x3bd2('0xb')]({'port':0x232a});config[_0x3bd2('0xc')]=_['defaults'](config[_0x3bd2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3bd2('0xd'))(new Redis(config[_0x3bd2('0xc')]));require(_0x3bd2('0xe'))[_0x3bd2('0xf')](socket);function respondWithRpcPromise(_0x37e244,_0x10c9f6,_0x1fb067){return new BPromise(function(_0x341867,_0x69c70e){return client[_0x3bd2('0x10')](_0x37e244,_0x1fb067)['then'](function(_0x5d64ad){logger[_0x3bd2('0x11')]('Dashboard,\x20%s,\x20%s',_0x10c9f6,_0x3bd2('0x12'));logger[_0x3bd2('0x13')](_0x3bd2('0x14'),_0x10c9f6,'request\x20sent',JSON[_0x3bd2('0x15')](_0x5d64ad));if(_0x5d64ad['error']){if(_0x5d64ad['error'][_0x3bd2('0x16')]===0x1f4){logger['error'](_0x3bd2('0x17'),_0x10c9f6,_0x5d64ad[_0x3bd2('0x18')][_0x3bd2('0x19')]);return _0x69c70e(_0x5d64ad[_0x3bd2('0x18')][_0x3bd2('0x19')]);}logger['error'](_0x3bd2('0x17'),_0x10c9f6,_0x5d64ad['error'][_0x3bd2('0x19')]);return _0x341867(_0x5d64ad[_0x3bd2('0x18')][_0x3bd2('0x19')]);}else{logger[_0x3bd2('0x11')]('Dashboard,\x20%s,\x20%s',_0x10c9f6,_0x3bd2('0x12'));_0x341867(_0x5d64ad['result'][_0x3bd2('0x19')]);}})['catch'](function(_0x5ab8e8){logger[_0x3bd2('0x18')](_0x3bd2('0x17'),_0x10c9f6,_0x5ab8e8);_0x69c70e(_0x5ab8e8);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8237d1b..f7aa491 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 _0x6487=['./dashboard.events','save','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x46f819,_0x1309a4){var _0x326b5c=function(_0x1e1e2a){while(--_0x1e1e2a){_0x46f819['push'](_0x46f819['shift']());}};_0x326b5c(++_0x1309a4);}(_0x6487,0x120));var _0x7648=function(_0x464bff,_0x5b96f1){_0x464bff=_0x464bff-0x0;var _0x38ea17=_0x6487[_0x464bff];return _0x38ea17;};'use strict';var DashboardEvents=require(_0x7648('0x0'));var events=[_0x7648('0x1'),_0x7648('0x2'),_0x7648('0x3')];function createListener(_0x592f46,_0x58e4c2){return function(_0x3368d7){_0x58e4c2[_0x7648('0x4')](_0x592f46,_0x3368d7);};}function removeListener(_0x5d4d73,_0x3039aa){return function(){DashboardEvents[_0x7648('0x5')](_0x5d4d73,_0x3039aa);};}exports[_0x7648('0x6')]=function(_0x4d7ce8){for(var _0x89a11=0x0,_0x355971=events[_0x7648('0x7')];_0x89a11<_0x355971;_0x89a11++){var _0x41542f=events[_0x89a11];var _0x225b8c=createListener(_0x7648('0x8')+_0x41542f,_0x4d7ce8);DashboardEvents['on'](_0x41542f,_0x225b8c);}}; \ No newline at end of file +var _0xc901=['emit','removeListener','register','length','./dashboard.events','save','remove','update'];(function(_0x13253c,_0x1ff0e2){var _0x39bb8d=function(_0x2a0dba){while(--_0x2a0dba){_0x13253c['push'](_0x13253c['shift']());}};_0x39bb8d(++_0x1ff0e2);}(_0xc901,0x19c));var _0x1c90=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc901[_0x4a9fb1];return _0x348672;};'use strict';var DashboardEvents=require(_0x1c90('0x0'));var events=[_0x1c90('0x1'),_0x1c90('0x2'),_0x1c90('0x3')];function createListener(_0x262553,_0x4a6683){return function(_0x15a82f){_0x4a6683[_0x1c90('0x4')](_0x262553,_0x15a82f);};}function removeListener(_0x397dd2,_0x4ddf17){return function(){DashboardEvents[_0x1c90('0x5')](_0x397dd2,_0x4ddf17);};}exports[_0x1c90('0x6')]=function(_0xb8dc95){for(var _0x4883cf=0x0,_0x1003e2=events[_0x1c90('0x7')];_0x4883cf<_0x1003e2;_0x4883cf++){var _0x1280e3=events[_0x4883cf];var _0x163d1f=createListener('dashboard:'+_0x1280e3,_0xb8dc95);DashboardEvents['on'](_0x1280e3,_0x163d1f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 4d33a68..b04acbe 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 _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x32e94b,_0x38c7a7){var _0x3b1567=function(_0x282670){while(--_0x282670){_0x32e94b['push'](_0x32e94b['shift']());}};_0x3b1567(++_0x38c7a7);}(_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')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=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(_0x5df18f,_0x4f30d9){var _0x173f30=function(_0x5b7a9c){while(--_0x5b7a9c){_0x5df18f['push'](_0x5df18f['shift']());}};_0x173f30(++_0x4f30d9);}(_0x70e0,0x17b));var _0x070e=function(_0x27a63d,_0x2204c9){_0x27a63d=_0x27a63d-0x0;var _0xe6cbc4=_0x70e0[_0x27a63d];return _0xe6cbc4;};'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 4dcbe9b..db9c36f 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 _0x606b=['exports','STRING','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash'];(function(_0x48be61,_0x204c04){var _0x55fcd9=function(_0x5a9c6b){while(--_0x5a9c6b){_0x48be61['push'](_0x48be61['shift']());}};_0x55fcd9(++_0x204c04);}(_0x606b,0x6a));var _0xb606=function(_0x331380,_0x5394e9){_0x331380=_0x331380-0x0;var _0x15d42c=_0x606b[_0x331380];return _0x15d42c;};'use strict';var Sequelize=require(_0xb606('0x0'));var squel=require('squel');var _=require(_0xb606('0x1'));module[_0xb606('0x2')]={'title':{'type':Sequelize[_0xb606('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb606('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0xb606('0x4')](this[_0xb606('0x5')](_0xb606('0x6')));}catch(_0x330f91){return[];}},'set':function(_0x11c291){try{this[_0xb606('0x7')](_0xb606('0x6'),JSON[_0xb606('0x8')](_0x11c291));}catch(_0x2a2db7){this[_0xb606('0x7')](_0xb606('0x6'),JSON[_0xb606('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xb606('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb606('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb606('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb606('0x3')],'allowNull':![],'defaultValue':_0xb606('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb606('0x3')],'allowNull':![],'defaultValue':_0xb606('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb606('0x3')]}}; \ No newline at end of file +var _0x5e8d=['stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','getDataValue','setDataValue','attrs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e8d,0x18c));var _0xd5e8=function(_0x20b5d9,_0x113ca6){_0x20b5d9=_0x20b5d9-0x0;var _0x31dd33=_0x5e8d[_0x20b5d9];return _0x31dd33;};'use strict';var Sequelize=require(_0xd5e8('0x0'));var squel=require(_0xd5e8('0x1'));var _=require(_0xd5e8('0x2'));module[_0xd5e8('0x3')]={'title':{'type':Sequelize[_0xd5e8('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xd5e8('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd5e8('0x5')](_0xd5e8('0x6')),'get':function(){try{return JSON['parse'](this[_0xd5e8('0x7')]('attrs'));}catch(_0x4eaf5e){return[];}},'set':function(_0x487eab){try{this[_0xd5e8('0x8')](_0xd5e8('0x9'),JSON['stringify'](_0x487eab));}catch(_0xc9cb5f){this[_0xd5e8('0x8')]('attrs',JSON[_0xd5e8('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0xd5e8('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd5e8('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd5e8('0xb')]},'col':{'type':Sequelize[_0xd5e8('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd5e8('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd5e8('0x4')],'allowNull':![],'defaultValue':_0xd5e8('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd5e8('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 493b756..16c9353 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 _0xc15b=['0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','stringify','create','body','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','./dashboardItem.socket','status','end','json','offset','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','value'];(function(_0x5b6fe5,_0x5ddf47){var _0x5928d4=function(_0x3e0846){while(--_0x3e0846){_0x5b6fe5['push'](_0x5b6fe5['shift']());}};_0x5928d4(++_0x5ddf47);}(_0xc15b,0x159));var _0xbc15=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc15b[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require(_0xbc15('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc15('0x1'));var rp=require(_0xbc15('0x2'));var moment=require(_0xbc15('0x3'));var BPromise=require(_0xbc15('0x4'));var Mustache=require(_0xbc15('0x5'));var util=require(_0xbc15('0x6'));var path=require(_0xbc15('0x7'));var sox=require(_0xbc15('0x8'));var csv=require(_0xbc15('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbc15('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbc15('0xb'));var deskjs=require(_0xbc15('0xc'));var toCsv=require(_0xbc15('0x9'));var querystring=require('querystring');var Papa=require(_0xbc15('0xd'));var Redis=require(_0xbc15('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xbc15('0xf'));var logger=require(_0xbc15('0x10'))(_0xbc15('0x11'));var utils=require('../../config/utils');var config=require(_0xbc15('0x12'));var db=require('../../mysqldb')['db'];config[_0xbc15('0x13')]=_[_0xbc15('0x14')](config[_0xbc15('0x13')],{'host':_0xbc15('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc15('0x13')]));require(_0xbc15('0x16'))['register'](socket);function respondWithStatusCode(_0x22b6f9,_0x4f0813){_0x4f0813=_0x4f0813||0xcc;return function(_0x4a967b){if(_0x4a967b){return _0x22b6f9['sendStatus'](_0x4f0813);}return _0x22b6f9[_0xbc15('0x17')](_0x4f0813)[_0xbc15('0x18')]();};}function respondWithResult(_0xb4c3db,_0x1b92e0){_0x1b92e0=_0x1b92e0||0xc8;return function(_0x355aaa){if(_0x355aaa){return _0xb4c3db[_0xbc15('0x17')](_0x1b92e0)[_0xbc15('0x19')](_0x355aaa);}};}function respondWithFilteredResult(_0xdf9863,_0x3fc90b){return function(_0x13886f){if(_0x13886f){var _0x1040b8=_0x13886f['count'],_0x1b4d24=_0x3fc90b['offset'],_0x277c37=_0x3fc90b[_0xbc15('0x1a')]+_0x3fc90b[_0xbc15('0x1b')],_0xd6bd5d;if(_0x277c37>=_0x1040b8){_0x277c37=_0x1040b8;_0xd6bd5d=0xc8;}else{_0xd6bd5d=0xce;}_0xdf9863[_0xbc15('0x17')](_0xd6bd5d);return _0xdf9863[_0xbc15('0x1c')]('Content-Range',_0x1b4d24+'-'+_0x277c37+'/'+_0x1040b8)[_0xbc15('0x19')](_0x13886f);}return null;};}function patchUpdates(_0x14be9f){return function(_0xdbc08b){try{jsonpatch[_0xbc15('0x1d')](_0xdbc08b,_0x14be9f,!![]);}catch(_0x2f9f4){return BPromise[_0xbc15('0x1e')](_0x2f9f4);}return _0xdbc08b['save']();};}function saveUpdates(_0x3ca487,_0x5d8bda){return function(_0x1cb9fa){if(_0x1cb9fa){return _0x1cb9fa[_0xbc15('0x1f')](_0x3ca487)[_0xbc15('0x20')](function(_0x221cfa){return _0x221cfa;});}return null;};}function removeEntity(_0x41b877,_0x19d76f){return function(_0x4c9a82){if(_0x4c9a82){return _0x4c9a82[_0xbc15('0x21')]()['then'](function(){_0x41b877[_0xbc15('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d64e,_0x4e738a){return function(_0x1739d3){if(!_0x1739d3){_0x24d64e[_0xbc15('0x22')](0x194);}return _0x1739d3;};}function handleError(_0x5228fa,_0x4e82bd){_0x4e82bd=_0x4e82bd||0x1f4;return function(_0x20d4d2){logger[_0xbc15('0x23')](_0x20d4d2[_0xbc15('0x24')]);if(_0x20d4d2[_0xbc15('0x25')]){delete _0x20d4d2[_0xbc15('0x25')];}_0x5228fa[_0xbc15('0x17')](_0x4e82bd)[_0xbc15('0x26')](_0x20d4d2);};}exports[_0xbc15('0x27')]=function(_0x39a532,_0x5f4387){var _0x4962da={'raw':![],'where':{'id':_0x39a532[_0xbc15('0x28')]['id']}},_0xaf8b37={};_0xaf8b37[_0xbc15('0x29')]=_[_0xbc15('0x2a')](db[_0xbc15('0x2b')][_0xbc15('0x2c')]);_0xaf8b37['query']=_['keys'](_0x39a532[_0xbc15('0x2d')]);_0xaf8b37[_0xbc15('0x2e')]=_[_0xbc15('0x2f')](_0xaf8b37[_0xbc15('0x29')],_0xaf8b37[_0xbc15('0x2d')]);_0x4962da[_0xbc15('0x30')]=_[_0xbc15('0x2f')](_0xaf8b37[_0xbc15('0x29')],qs[_0xbc15('0x31')](_0x39a532[_0xbc15('0x2d')][_0xbc15('0x31')]));_0x4962da[_0xbc15('0x30')]=_0x4962da[_0xbc15('0x30')]['length']?_0x4962da[_0xbc15('0x30')]:_0xaf8b37[_0xbc15('0x29')];if(_0x39a532[_0xbc15('0x2d')][_0xbc15('0x32')]){_0x4962da[_0xbc15('0x33')]=[{'all':!![]}];}_0x4962da=_[_0xbc15('0x34')]({},_0x4962da,_0x39a532[_0xbc15('0x35')]);return db[_0xbc15('0x2b')][_0xbc15('0x36')](_0x4962da)[_0xbc15('0x20')](handleEntityNotFound(_0x5f4387,null))[_0xbc15('0x20')](respondWithResult(_0x5f4387,null))[_0xbc15('0x37')](handleError(_0x5f4387,null));};exports['destroy']=function(_0x56130a,_0x57919d){return db[_0xbc15('0x2b')][_0xbc15('0x36')]({'where':{'id':_0x56130a[_0xbc15('0x28')]['id']}})['then'](handleEntityNotFound(_0x57919d,null))[_0xbc15('0x20')](removeEntity(_0x57919d,null))[_0xbc15('0x37')](handleError(_0x57919d,null));};function widgetAttributes(_0x123463){try{switch(_0x123463['type']){case'iframe':return[{'name':'attrUrl','value':_0x123463[_0xbc15('0x38')]||(_0x123463[_0xbc15('0x39')]&&_0x123463[_0xbc15('0x39')][0x0]?_0x123463[_0xbc15('0x39')][0x0]['value']:undefined)||'https://'}];case _0xbc15('0x3a'):return[{'name':'attrPath','value':_0x123463[_0xbc15('0x3b')]||(_0x123463['attrs']&&_0x123463['attrs'][0x0]?_0x123463[_0xbc15('0x39')][0x0]['value']:undefined)||''}];case _0xbc15('0x3c'):return[{'name':'attrHourFormat','value':_0x123463[_0xbc15('0x3d')]||(_0x123463[_0xbc15('0x39')]&&_0x123463[_0xbc15('0x39')][0x0]?_0x123463[_0xbc15('0x39')][0x0]['value']:undefined)||_0xbc15('0x3e')},{'name':'attrTimezone','value':_0x123463[_0xbc15('0x3f')]||(_0x123463[_0xbc15('0x39')]&&_0x123463['attrs'][0x1]?_0x123463[_0xbc15('0x39')][0x1][_0xbc15('0x40')]:undefined)||_0xbc15('0x41')},{'name':'attrFontSize','value':_0x123463['attrFontSize']||(_0x123463['attrs']&&_0x123463[_0xbc15('0x39')][0x2]?_0x123463[_0xbc15('0x39')][0x2][_0xbc15('0x40')]:undefined)||0xc}];case _0xbc15('0x42'):return[{'name':_0xbc15('0x43'),'value':_0x123463['attrMetric']||(_0x123463[_0xbc15('0x39')]&&_0x123463[_0xbc15('0x39')][0x0]?_0x123463[_0xbc15('0x39')][0x0][_0xbc15('0x40')]:undefined)||_0xbc15('0x44')},{'name':_0xbc15('0x45'),'value':_0x123463[_0xbc15('0x45')]||(_0x123463[_0xbc15('0x39')]&&_0x123463[_0xbc15('0x39')][0x1]?_0x123463[_0xbc15('0x39')][0x1][_0xbc15('0x40')]:undefined)||[]},{'name':'attrFontSize','value':_0x123463[_0xbc15('0x46')]||(_0x123463['attrs']&&_0x123463[_0xbc15('0x39')][0x2]?_0x123463[_0xbc15('0x39')][0x2][_0xbc15('0x40')]:undefined)||0x14}];case'multibar-chart':case _0xbc15('0x47'):return[{'name':_0xbc15('0x48'),'value':_0x123463[_0xbc15('0x48')]||(_0x123463[_0xbc15('0x39')]&&_0x123463[_0xbc15('0x39')][0x0]?_0x123463[_0xbc15('0x39')][0x0][_0xbc15('0x40')]:undefined)||_0xbc15('0x44')},{'name':_0xbc15('0x49'),'value':_0x123463[_0xbc15('0x49')]||(_0x123463[_0xbc15('0x39')]&&_0x123463[_0xbc15('0x39')][0x1]?_0x123463[_0xbc15('0x39')][0x1]['value']:undefined)||null},{'name':_0xbc15('0x4a'),'value':_0x123463[_0xbc15('0x4a')]||(_0x123463['attrs']&&_0x123463[_0xbc15('0x39')][0x2]?_0x123463[_0xbc15('0x39')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x123463[_0xbc15('0x45')]||(_0x123463['attrs']&&_0x123463[_0xbc15('0x39')][0x3]?_0x123463[_0xbc15('0x39')][0x3][_0xbc15('0x40')]:undefined)||[]}];case'web-report':return[{'name':_0xbc15('0x4b'),'type':_0x123463[_0xbc15('0x4c')]||(_0x123463[_0xbc15('0x39')]&&_0x123463[_0xbc15('0x39')][0x0]?_0x123463['attrs'][0x0][_0xbc15('0x4d')]:undefined)||null,'value':_0x123463[_0xbc15('0x4b')]||(_0x123463[_0xbc15('0x39')]&&_0x123463['attrs'][0x0]?_0x123463[_0xbc15('0x39')][0x0][_0xbc15('0x40')]:undefined)||null},{'name':_0xbc15('0x4e'),'value':_0x123463[_0xbc15('0x4e')]||(_0x123463['attrs']&&_0x123463[_0xbc15('0x39')][0x1]?_0x123463[_0xbc15('0x39')][0x1][_0xbc15('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x468f70){logger['error']('widgetAttributes:\x20%s',JSON[_0xbc15('0x4f')](_0x468f70));return[];}}exports[_0xbc15('0x50')]=function(_0x3eff5f,_0x5b9c6e){if(_0x3eff5f[_0xbc15('0x51')]){_0x3eff5f[_0xbc15('0x51')][_0xbc15('0x39')]=widgetAttributes(_0x3eff5f['body']);}return db[_0xbc15('0x2b')][_0xbc15('0x50')](_0x3eff5f[_0xbc15('0x51')],{})[_0xbc15('0x20')](respondWithResult(_0x5b9c6e,0xc9))[_0xbc15('0x37')](handleError(_0x5b9c6e,null));};exports[_0xbc15('0x1f')]=function(_0x467504,_0x2f0f37){if(_0x467504[_0xbc15('0x51')]['id']){delete _0x467504['body']['id'];}_0x467504[_0xbc15('0x51')][_0xbc15('0x39')]=widgetAttributes(_0x467504[_0xbc15('0x51')]);return db['DashboardItem'][_0xbc15('0x36')]({'where':{'id':_0x467504[_0xbc15('0x28')]['id']}})[_0xbc15('0x20')](handleEntityNotFound(_0x2f0f37,null))[_0xbc15('0x20')](saveUpdates(_0x467504[_0xbc15('0x51')],null))[_0xbc15('0x20')](respondWithResult(_0x2f0f37,null))[_0xbc15('0x37')](handleError(_0x2f0f37,null));}; \ No newline at end of file +var _0x8ebb=['limit','set','Content-Range','apply','then','destroy','error','name','send','params','keys','rawAttributes','query','intersection','attributes','model','fields','includeAll','options','catch','DashboardItem','find','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset'];(function(_0x76def9,_0x373afa){var _0x4251ba=function(_0xb79c40){while(--_0xb79c40){_0x76def9['push'](_0x76def9['shift']());}};_0x4251ba(++_0x373afa);}(_0x8ebb,0x88));var _0xb8eb=function(_0x3a9a1f,_0x27ce76){_0x3a9a1f=_0x3a9a1f-0x0;var _0xc1155d=_0x8ebb[_0x3a9a1f];return _0xc1155d;};'use strict';var pdf=require(_0xb8eb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb8eb('0x1'));var zipdir=require(_0xb8eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8eb('0x3'));var moment=require(_0xb8eb('0x4'));var BPromise=require(_0xb8eb('0x5'));var Mustache=require(_0xb8eb('0x6'));var util=require(_0xb8eb('0x7'));var path=require(_0xb8eb('0x8'));var sox=require(_0xb8eb('0x9'));var csv=require(_0xb8eb('0xa'));var ejs=require(_0xb8eb('0xb'));var fs=require('fs');var _=require(_0xb8eb('0xc'));var squel=require(_0xb8eb('0xd'));var crypto=require(_0xb8eb('0xe'));var jsforce=require(_0xb8eb('0xf'));var deskjs=require(_0xb8eb('0x10'));var toCsv=require(_0xb8eb('0xa'));var querystring=require(_0xb8eb('0x11'));var Papa=require(_0xb8eb('0x12'));var Redis=require(_0xb8eb('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb8eb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8eb('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb8eb('0x16'));var db=require(_0xb8eb('0x17'))['db'];config[_0xb8eb('0x18')]=_['defaults'](config[_0xb8eb('0x18')],{'host':_0xb8eb('0x19'),'port':0x18eb});var socket=require(_0xb8eb('0x1a'))(new Redis(config[_0xb8eb('0x18')]));require(_0xb8eb('0x1b'))[_0xb8eb('0x1c')](socket);function respondWithStatusCode(_0x45ce08,_0x26d944){_0x26d944=_0x26d944||0xcc;return function(_0x239a77){if(_0x239a77){return _0x45ce08[_0xb8eb('0x1d')](_0x26d944);}return _0x45ce08[_0xb8eb('0x1e')](_0x26d944)[_0xb8eb('0x1f')]();};}function respondWithResult(_0x10d8ca,_0x249535){_0x249535=_0x249535||0xc8;return function(_0x37a4ff){if(_0x37a4ff){return _0x10d8ca['status'](_0x249535)[_0xb8eb('0x20')](_0x37a4ff);}};}function respondWithFilteredResult(_0x420e66,_0x56a2bc){return function(_0x216a87){if(_0x216a87){var _0x750ae9=_0x216a87['count'],_0x3fb490=_0x56a2bc[_0xb8eb('0x21')],_0x133b9c=_0x56a2bc[_0xb8eb('0x21')]+_0x56a2bc[_0xb8eb('0x22')],_0x3ef60d;if(_0x133b9c>=_0x750ae9){_0x133b9c=_0x750ae9;_0x3ef60d=0xc8;}else{_0x3ef60d=0xce;}_0x420e66[_0xb8eb('0x1e')](_0x3ef60d);return _0x420e66[_0xb8eb('0x23')](_0xb8eb('0x24'),_0x3fb490+'-'+_0x133b9c+'/'+_0x750ae9)['json'](_0x216a87);}return null;};}function patchUpdates(_0x4cd4a2){return function(_0x3ae144){try{jsonpatch[_0xb8eb('0x25')](_0x3ae144,_0x4cd4a2,!![]);}catch(_0x2c50fb){return BPromise['reject'](_0x2c50fb);}return _0x3ae144['save']();};}function saveUpdates(_0x3fd1f8,_0x43b8d7){return function(_0x3cbf9a){if(_0x3cbf9a){return _0x3cbf9a['update'](_0x3fd1f8)[_0xb8eb('0x26')](function(_0x2474c3){return _0x2474c3;});}return null;};}function removeEntity(_0x390c02,_0x406988){return function(_0x2f0416){if(_0x2f0416){return _0x2f0416[_0xb8eb('0x27')]()[_0xb8eb('0x26')](function(){_0x390c02[_0xb8eb('0x1e')](0xcc)[_0xb8eb('0x1f')]();});}};}function handleEntityNotFound(_0x20e1e7,_0x4e9512){return function(_0x8c0478){if(!_0x8c0478){_0x20e1e7[_0xb8eb('0x1d')](0x194);}return _0x8c0478;};}function handleError(_0x36c372,_0x12382c){_0x12382c=_0x12382c||0x1f4;return function(_0x2273dc){logger[_0xb8eb('0x28')](_0x2273dc['stack']);if(_0x2273dc[_0xb8eb('0x29')]){delete _0x2273dc[_0xb8eb('0x29')];}_0x36c372[_0xb8eb('0x1e')](_0x12382c)[_0xb8eb('0x2a')](_0x2273dc);};}exports['show']=function(_0x2c1daa,_0x57ed50){var _0x3824f6={'raw':![],'where':{'id':_0x2c1daa[_0xb8eb('0x2b')]['id']}},_0x508697={};_0x508697['model']=_[_0xb8eb('0x2c')](db['DashboardItem'][_0xb8eb('0x2d')]);_0x508697['query']=_[_0xb8eb('0x2c')](_0x2c1daa[_0xb8eb('0x2e')]);_0x508697['filters']=_[_0xb8eb('0x2f')](_0x508697['model'],_0x508697[_0xb8eb('0x2e')]);_0x3824f6[_0xb8eb('0x30')]=_[_0xb8eb('0x2f')](_0x508697[_0xb8eb('0x31')],qs[_0xb8eb('0x32')](_0x2c1daa[_0xb8eb('0x2e')][_0xb8eb('0x32')]));_0x3824f6[_0xb8eb('0x30')]=_0x3824f6[_0xb8eb('0x30')]['length']?_0x3824f6[_0xb8eb('0x30')]:_0x508697[_0xb8eb('0x31')];if(_0x2c1daa[_0xb8eb('0x2e')][_0xb8eb('0x33')]){_0x3824f6['include']=[{'all':!![]}];}_0x3824f6=_['merge']({},_0x3824f6,_0x2c1daa[_0xb8eb('0x34')]);return db['DashboardItem']['find'](_0x3824f6)[_0xb8eb('0x26')](handleEntityNotFound(_0x57ed50,null))['then'](respondWithResult(_0x57ed50,null))[_0xb8eb('0x35')](handleError(_0x57ed50,null));};exports[_0xb8eb('0x27')]=function(_0x4db01f,_0x2decf9){return db[_0xb8eb('0x36')][_0xb8eb('0x37')]({'where':{'id':_0x4db01f[_0xb8eb('0x2b')]['id']}})[_0xb8eb('0x26')](handleEntityNotFound(_0x2decf9,null))[_0xb8eb('0x26')](removeEntity(_0x2decf9,null))[_0xb8eb('0x35')](handleError(_0x2decf9,null));};function widgetAttributes(_0x46f20d){try{switch(_0x46f20d['type']){case _0xb8eb('0x38'):return[{'name':_0xb8eb('0x39'),'value':_0x46f20d[_0xb8eb('0x39')]||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d[_0xb8eb('0x3a')][0x0]?_0x46f20d[_0xb8eb('0x3a')][0x0][_0xb8eb('0x3b')]:undefined)||'https://'}];case _0xb8eb('0x3c'):return[{'name':'attrPath','value':_0x46f20d[_0xb8eb('0x3d')]||(_0x46f20d['attrs']&&_0x46f20d[_0xb8eb('0x3a')][0x0]?_0x46f20d['attrs'][0x0][_0xb8eb('0x3b')]:undefined)||''}];case _0xb8eb('0x3e'):return[{'name':'attrHourFormat','value':_0x46f20d[_0xb8eb('0x3f')]||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d[_0xb8eb('0x3a')][0x0]?_0x46f20d['attrs'][0x0][_0xb8eb('0x3b')]:undefined)||_0xb8eb('0x40')},{'name':_0xb8eb('0x41'),'value':_0x46f20d[_0xb8eb('0x41')]||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d[_0xb8eb('0x3a')][0x1]?_0x46f20d['attrs'][0x1][_0xb8eb('0x3b')]:undefined)||_0xb8eb('0x42')},{'name':_0xb8eb('0x43'),'value':_0x46f20d[_0xb8eb('0x43')]||(_0x46f20d['attrs']&&_0x46f20d['attrs'][0x2]?_0x46f20d['attrs'][0x2][_0xb8eb('0x3b')]:undefined)||0xc}];case _0xb8eb('0x44'):return[{'name':_0xb8eb('0x45'),'value':_0x46f20d['attrMetric']||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d[_0xb8eb('0x3a')][0x0]?_0x46f20d['attrs'][0x0]['value']:undefined)||_0xb8eb('0x46')},{'name':_0xb8eb('0x47'),'value':_0x46f20d['attrVoiceQueues']||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d[_0xb8eb('0x3a')][0x1]?_0x46f20d[_0xb8eb('0x3a')][0x1][_0xb8eb('0x3b')]:undefined)||[]},{'name':_0xb8eb('0x43'),'value':_0x46f20d[_0xb8eb('0x43')]||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d[_0xb8eb('0x3a')][0x2]?_0x46f20d[_0xb8eb('0x3a')][0x2]['value']:undefined)||0x14}];case _0xb8eb('0x48'):case _0xb8eb('0x49'):return[{'name':_0xb8eb('0x4a'),'value':_0x46f20d[_0xb8eb('0x4a')]||(_0x46f20d['attrs']&&_0x46f20d[_0xb8eb('0x3a')][0x0]?_0x46f20d[_0xb8eb('0x3a')][0x0][_0xb8eb('0x3b')]:undefined)||_0xb8eb('0x46')},{'name':_0xb8eb('0x4b'),'value':_0x46f20d[_0xb8eb('0x4b')]||(_0x46f20d['attrs']&&_0x46f20d[_0xb8eb('0x3a')][0x1]?_0x46f20d[_0xb8eb('0x3a')][0x1]['value']:undefined)||null},{'name':_0xb8eb('0x4c'),'value':_0x46f20d[_0xb8eb('0x4c')]||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d[_0xb8eb('0x3a')][0x2]?_0x46f20d[_0xb8eb('0x3a')][0x2][_0xb8eb('0x3b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x46f20d[_0xb8eb('0x47')]||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d[_0xb8eb('0x3a')][0x3]?_0x46f20d[_0xb8eb('0x3a')][0x3][_0xb8eb('0x3b')]:undefined)||[]}];case _0xb8eb('0x4d'):return[{'name':_0xb8eb('0x4e'),'type':_0x46f20d[_0xb8eb('0x4f')]||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d['attrs'][0x0]?_0x46f20d['attrs'][0x0]['type']:undefined)||null,'value':_0x46f20d[_0xb8eb('0x4e')]||(_0x46f20d[_0xb8eb('0x3a')]&&_0x46f20d['attrs'][0x0]?_0x46f20d['attrs'][0x0][_0xb8eb('0x3b')]:undefined)||null},{'name':_0xb8eb('0x50'),'value':_0x46f20d[_0xb8eb('0x50')]||(_0x46f20d['attrs']&&_0x46f20d[_0xb8eb('0x3a')][0x1]?_0x46f20d['attrs'][0x1][_0xb8eb('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x5f464d){logger[_0xb8eb('0x28')](_0xb8eb('0x51'),JSON[_0xb8eb('0x52')](_0x5f464d));return[];}}exports['create']=function(_0x13aed2,_0xe0a319){if(_0x13aed2[_0xb8eb('0x53')]){_0x13aed2[_0xb8eb('0x53')][_0xb8eb('0x3a')]=widgetAttributes(_0x13aed2[_0xb8eb('0x53')]);}return db[_0xb8eb('0x36')][_0xb8eb('0x54')](_0x13aed2['body'],{})[_0xb8eb('0x26')](respondWithResult(_0xe0a319,0xc9))['catch'](handleError(_0xe0a319,null));};exports['update']=function(_0x9f6bef,_0x3b5cbe){if(_0x9f6bef['body']['id']){delete _0x9f6bef[_0xb8eb('0x53')]['id'];}_0x9f6bef['body'][_0xb8eb('0x3a')]=widgetAttributes(_0x9f6bef['body']);return db[_0xb8eb('0x36')][_0xb8eb('0x37')]({'where':{'id':_0x9f6bef[_0xb8eb('0x2b')]['id']}})[_0xb8eb('0x26')](handleEntityNotFound(_0x3b5cbe,null))[_0xb8eb('0x26')](saveUpdates(_0x9f6bef[_0xb8eb('0x53')],null))[_0xb8eb('0x26')](respondWithResult(_0x3b5cbe,null))['catch'](handleError(_0x3b5cbe,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index dda1b78..d2aab83 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 _0x5730=['emit','hasOwnProperty','exports','events','save','update','remove'];(function(_0x1eee21,_0x366090){var _0xf8123f=function(_0x1c4282){while(--_0x1c4282){_0x1eee21['push'](_0x1eee21['shift']());}};_0xf8123f(++_0x366090);}(_0x5730,0xd5));var _0x0573=function(_0x563590,_0x421a3f){_0x563590=_0x563590-0x0;var _0x33afb6=_0x5730[_0x563590];return _0x33afb6;};'use strict';var EventEmitter=require(_0x0573('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0573('0x1'),'afterUpdate':_0x0573('0x2'),'afterDestroy':_0x0573('0x3')};function emitEvent(_0x5c560d){return function(_0x5a1d23,_0x2205a9,_0x19fae0){DashboardItemEvents[_0x0573('0x4')](_0x5c560d+':'+_0x5a1d23['id'],_0x5a1d23);DashboardItemEvents['emit'](_0x5c560d,_0x5a1d23);_0x19fae0(null);};}for(var e in events){if(events[_0x0573('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x0573('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x7dcc=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports'];(function(_0x1177fb,_0x2a380a){var _0x23ba60=function(_0x6e8de){while(--_0x6e8de){_0x1177fb['push'](_0x1177fb['shift']());}};_0x23ba60(++_0x2a380a);}(_0x7dcc,0xaf));var _0xc7dc=function(_0x27a1a0,_0x32380c){_0x27a1a0=_0x27a1a0-0x0;var _0x38cf5c=_0x7dcc[_0x27a1a0];return _0x38cf5c;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xc7dc('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc7dc('0x1')](0x0);var events={'afterCreate':_0xc7dc('0x2'),'afterUpdate':_0xc7dc('0x3'),'afterDestroy':_0xc7dc('0x4')};function emitEvent(_0x33456c){return function(_0x46679d,_0xa9704c,_0x26ef99){DashboardItemEvents[_0xc7dc('0x5')](_0x33456c+':'+_0x46679d['id'],_0x46679d);DashboardItemEvents[_0xc7dc('0x5')](_0x33456c,_0x46679d);_0x26ef99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xc7dc('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5f2bb9c..e5c7eb1 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 _0x2a87=['dashboard_items','lodash','util','api','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x356d1b,_0x2a9fb7){var _0x4c2ca4=function(_0x4bf366){while(--_0x4bf366){_0x356d1b['push'](_0x356d1b['shift']());}};_0x4c2ca4(++_0x2a9fb7);}(_0x2a87,0xfe));var _0x72a8=function(_0xa741fa,_0x14b888){_0xa741fa=_0xa741fa-0x0;var _0xfa882c=_0x2a87[_0xa741fa];return _0xfa882c;};'use strict';var _=require(_0x72a8('0x0'));var util=require(_0x72a8('0x1'));var logger=require('../../config/logger')(_0x72a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x72a8('0x3'));var rimraf=require(_0x72a8('0x4'));var config=require(_0x72a8('0x5'));var attributes=require(_0x72a8('0x6'));module[_0x72a8('0x7')]=function(_0x1a6832,_0x4919b1){return _0x1a6832[_0x72a8('0x8')](_0x72a8('0x9'),attributes,{'tableName':_0x72a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x774d=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','api','bluebird','request-promise','path'];(function(_0x45acdb,_0x220bf2){var _0x3bbadd=function(_0x2a7903){while(--_0x2a7903){_0x45acdb['push'](_0x45acdb['shift']());}};_0x3bbadd(++_0x220bf2);}(_0x774d,0x13e));var _0xd774=function(_0x37ecdb,_0x259eac){_0x37ecdb=_0x37ecdb-0x0;var _0x4fa5cf=_0x774d[_0x37ecdb];return _0x4fa5cf;};'use strict';var _=require(_0xd774('0x0'));var util=require(_0xd774('0x1'));var logger=require('../../config/logger')(_0xd774('0x2'));var moment=require('moment');var BPromise=require(_0xd774('0x3'));var rp=require(_0xd774('0x4'));var fs=require('fs');var path=require(_0xd774('0x5'));var rimraf=require('rimraf');var config=require(_0xd774('0x6'));var attributes=require(_0xd774('0x7'));module[_0xd774('0x8')]=function(_0xc0ae84,_0x32f24f){return _0xc0ae84[_0xd774('0x9')](_0xd774('0xa'),attributes,{'tableName':_0xd774('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 83f29a5..1e22cf2 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 _0x5e7e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4e4a56,_0x515165){var _0x48f5ba=function(_0x162fde){while(--_0x162fde){_0x4e4a56['push'](_0x4e4a56['shift']());}};_0x48f5ba(++_0x515165);}(_0x5e7e,0xf3));var _0xe5e7=function(_0x90e3e0,_0x5ddcdf){_0x90e3e0=_0x90e3e0-0x0;var _0x4df3d1=_0x5e7e[_0x90e3e0];return _0x4df3d1;};'use strict';var _=require(_0xe5e7('0x0'));var util=require(_0xe5e7('0x1'));var moment=require('moment');var BPromise=require(_0xe5e7('0x2'));var rs=require(_0xe5e7('0x3'));var fs=require('fs');var Redis=require(_0xe5e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5e7('0x5'));var logger=require(_0xe5e7('0x6'))(_0xe5e7('0x7'));var config=require(_0xe5e7('0x8'));var jayson=require(_0xe5e7('0x9'));var client=jayson[_0xe5e7('0xa')][_0xe5e7('0xb')]({'port':0x232a});config[_0xe5e7('0xc')]=_[_0xe5e7('0xd')](config['redis'],{'host':_0xe5e7('0xe'),'port':0x18eb});var socket=require(_0xe5e7('0xf'))(new Redis(config[_0xe5e7('0xc')]));require(_0xe5e7('0x10'))[_0xe5e7('0x11')](socket);function respondWithRpcPromise(_0x21118b,_0x543438,_0x1ac16d){return new BPromise(function(_0x1aa99a,_0x549861){return client[_0xe5e7('0x12')](_0x21118b,_0x1ac16d)[_0xe5e7('0x13')](function(_0x3a8af3){logger[_0xe5e7('0x14')]('DashboardItem,\x20%s,\x20%s',_0x543438,_0xe5e7('0x15'));logger[_0xe5e7('0x16')](_0xe5e7('0x17'),_0x543438,'request\x20sent',JSON[_0xe5e7('0x18')](_0x3a8af3));if(_0x3a8af3[_0xe5e7('0x19')]){if(_0x3a8af3[_0xe5e7('0x19')][_0xe5e7('0x1a')]===0x1f4){logger[_0xe5e7('0x19')](_0xe5e7('0x1b'),_0x543438,_0x3a8af3['error']['message']);return _0x549861(_0x3a8af3[_0xe5e7('0x19')][_0xe5e7('0x1c')]);}logger[_0xe5e7('0x19')](_0xe5e7('0x1b'),_0x543438,_0x3a8af3[_0xe5e7('0x19')][_0xe5e7('0x1c')]);return _0x1aa99a(_0x3a8af3[_0xe5e7('0x19')][_0xe5e7('0x1c')]);}else{logger[_0xe5e7('0x14')](_0xe5e7('0x1b'),_0x543438,_0xe5e7('0x15'));_0x1aa99a(_0x3a8af3[_0xe5e7('0x1d')][_0xe5e7('0x1c')]);}})[_0xe5e7('0x1e')](function(_0x46bbce){logger[_0xe5e7('0x19')](_0xe5e7('0x1b'),_0x543438,_0x46bbce);_0x549861(_0x46bbce);});});} \ No newline at end of file +var _0x3a07=['stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x1ca305,_0x144853){var _0x454eec=function(_0x1bea3d){while(--_0x1bea3d){_0x1ca305['push'](_0x1ca305['shift']());}};_0x454eec(++_0x144853);}(_0x3a07,0x18d));var _0x73a0=function(_0x4dd5e,_0x1cf79e){_0x4dd5e=_0x4dd5e-0x0;var _0xa0ef5c=_0x3a07[_0x4dd5e];return _0xa0ef5c;};'use strict';var _=require(_0x73a0('0x0'));var util=require(_0x73a0('0x1'));var moment=require('moment');var BPromise=require(_0x73a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x73a0('0x4'));var logger=require(_0x73a0('0x5'))(_0x73a0('0x6'));var config=require(_0x73a0('0x7'));var jayson=require(_0x73a0('0x8'));var client=jayson[_0x73a0('0x9')][_0x73a0('0xa')]({'port':0x232a});config['redis']=_[_0x73a0('0xb')](config[_0x73a0('0xc')],{'host':_0x73a0('0xd'),'port':0x18eb});var socket=require(_0x73a0('0xe'))(new Redis(config[_0x73a0('0xc')]));require(_0x73a0('0xf'))[_0x73a0('0x10')](socket);function respondWithRpcPromise(_0x7c1a7c,_0x5cc673,_0x37881b){return new BPromise(function(_0x5a0937,_0x12a74b){return client['request'](_0x7c1a7c,_0x37881b)[_0x73a0('0x11')](function(_0x5a8669){logger[_0x73a0('0x12')](_0x73a0('0x13'),_0x5cc673,_0x73a0('0x14'));logger[_0x73a0('0x15')](_0x73a0('0x16'),_0x5cc673,_0x73a0('0x14'),JSON[_0x73a0('0x17')](_0x5a8669));if(_0x5a8669['error']){if(_0x5a8669[_0x73a0('0x18')][_0x73a0('0x19')]===0x1f4){logger[_0x73a0('0x18')]('DashboardItem,\x20%s,\x20%s',_0x5cc673,_0x5a8669[_0x73a0('0x18')]['message']);return _0x12a74b(_0x5a8669['error'][_0x73a0('0x1a')]);}logger[_0x73a0('0x18')](_0x73a0('0x13'),_0x5cc673,_0x5a8669[_0x73a0('0x18')]['message']);return _0x5a0937(_0x5a8669['error'][_0x73a0('0x1a')]);}else{logger[_0x73a0('0x12')](_0x73a0('0x13'),_0x5cc673,_0x73a0('0x14'));_0x5a0937(_0x5a8669['result'][_0x73a0('0x1a')]);}})[_0x73a0('0x1b')](function(_0x114353){logger[_0x73a0('0x18')](_0x73a0('0x13'),_0x5cc673,_0x114353);_0x12a74b(_0x114353);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index aeb0d7b..6c6eb54 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 _0x5895=['update','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x549e90,_0x40b61a){var _0x5c9623=function(_0x8244ed){while(--_0x8244ed){_0x549e90['push'](_0x549e90['shift']());}};_0x5c9623(++_0x40b61a);}(_0x5895,0x105));var _0x5589=function(_0x7248f4,_0x45bb49){_0x7248f4=_0x7248f4-0x0;var _0x349fbf=_0x5895[_0x7248f4];return _0x349fbf;};'use strict';var DashboardItemEvents=require(_0x5589('0x0'));var events=[_0x5589('0x1'),_0x5589('0x2'),_0x5589('0x3')];function createListener(_0x1f6ec3,_0x2327be){return function(_0x118b00){_0x2327be['emit'](_0x1f6ec3,_0x118b00);};}function removeListener(_0x3c6a76,_0xf72582){return function(){DashboardItemEvents[_0x5589('0x4')](_0x3c6a76,_0xf72582);};}exports[_0x5589('0x5')]=function(_0x49a967){for(var _0x52e084=0x0,_0x3b7f4c=events[_0x5589('0x6')];_0x52e084<_0x3b7f4c;_0x52e084++){var _0x334dd0=events[_0x52e084];var _0x7fb4e8=createListener(_0x5589('0x7')+_0x334dd0,_0x49a967);DashboardItemEvents['on'](_0x334dd0,_0x7fb4e8);}}; \ No newline at end of file +var _0xd079=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x1e668a,_0x3ee7ed){var _0xc5dbb1=function(_0x116bef){while(--_0x116bef){_0x1e668a['push'](_0x1e668a['shift']());}};_0xc5dbb1(++_0x3ee7ed);}(_0xd079,0x1a5));var _0x9d07=function(_0x10d5f1,_0x1e7e38){_0x10d5f1=_0x10d5f1-0x0;var _0x1ffb8e=_0xd079[_0x10d5f1];return _0x1ffb8e;};'use strict';var DashboardItemEvents=require(_0x9d07('0x0'));var events=[_0x9d07('0x1'),_0x9d07('0x2'),'update'];function createListener(_0x45c66a,_0x5c1424){return function(_0x1921fe){_0x5c1424[_0x9d07('0x3')](_0x45c66a,_0x1921fe);};}function removeListener(_0xf4ac0,_0x52f33f){return function(){DashboardItemEvents[_0x9d07('0x4')](_0xf4ac0,_0x52f33f);};}exports[_0x9d07('0x5')]=function(_0x3c2156){for(var _0x4c1ccb=0x0,_0x4bddff=events[_0x9d07('0x6')];_0x4c1ccb<_0x4bddff;_0x4c1ccb++){var _0x507f91=events[_0x4c1ccb];var _0x174823=createListener(_0x9d07('0x7')+_0x507f91,_0x3c2156);DashboardItemEvents['on'](_0x507f91,_0x174823);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4fa0b1c..6d32f7d 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 _0xc4aa=['connect-timeout','express','Router','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x4b1925,_0x150324){var _0x42cbf9=function(_0x24ac37){while(--_0x24ac37){_0x4b1925['push'](_0x4b1925['shift']());}};_0x42cbf9(++_0x150324);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')](_0xac4a('0x8'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0xb')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xc')]);router['put']('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router[_0xac4a('0xe')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);module[_0xac4a('0x10')]=router; \ No newline at end of file +var _0x4819=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','create','put','/:id','delete','exports','util','path','connect-timeout'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x4819,0xcd));var _0x9481=function(_0x11afe7,_0x2dcbae){_0x11afe7=_0x11afe7-0x0;var _0x2967b5=_0x4819[_0x11afe7];return _0x2967b5;};'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')]('/:id',auth[_0x9481('0xa')](),controller['show']);router['post']('/',auth[_0x9481('0xa')](),controller[_0x9481('0xb')]);router[_0x9481('0xc')](_0x9481('0xd'),auth[_0x9481('0xa')](),controller['update']);router[_0x9481('0xe')]('/:id',auth[_0x9481('0xa')](),controller['destroy']);module[_0x9481('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 22e3316..09558f9 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 _0x3743=['exports','STRING','sequelize'];(function(_0x117269,_0x35bc05){var _0x2e9901=function(_0x2757c2){while(--_0x2757c2){_0x117269['push'](_0x117269['shift']());}};_0x2e9901(++_0x35bc05);}(_0x3743,0xce));var _0x3374=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x3743[_0x4bed75];return _0x2dd8e8;};'use strict';var Sequelize=require(_0x3374('0x0'));module[_0x3374('0x1')]={'name':{'type':Sequelize[_0x3374('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8189=['exports','STRING','sequelize'];(function(_0x4d0ee8,_0x28acb8){var _0x3e41b2=function(_0x169561){while(--_0x169561){_0x4d0ee8['push'](_0x4d0ee8['shift']());}};_0x3e41b2(++_0x28acb8);}(_0x8189,0xaa));var _0x9818=function(_0x49102e,_0x232e95){_0x49102e=_0x49102e-0x0;var _0x2cd5bf=_0x8189[_0x49102e];return _0x2cd5bf;};'use strict';var Sequelize=require(_0x9818('0x0'));module[_0x9818('0x1')]={'name':{'type':Sequelize[_0x9818('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index b9c7c49..1945b3a 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 _0xef0f=['stack','name','send','index','Disposition','rawAttributes','keys','query','filters','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','key','field','options','include','rows','catch','show','intersection','attributes','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','then','Dispositions','UserProfileResource','destroy','error'];(function(_0x44ca27,_0x81f0da){var _0x38bc17=function(_0x476f85){while(--_0x476f85){_0x44ca27['push'](_0x44ca27['shift']());}};_0x38bc17(++_0x81f0da);}(_0xef0f,0x168));var _0xfef0=function(_0x37644c,_0x50c6e1){_0x37644c=_0x37644c-0x0;var _0xa9ef37=_0xef0f[_0x37644c];return _0xa9ef37;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfef0('0x1'));var zipdir=require(_0xfef0('0x2'));var jsonpatch=require(_0xfef0('0x3'));var rp=require('request-promise');var moment=require(_0xfef0('0x4'));var BPromise=require(_0xfef0('0x5'));var Mustache=require(_0xfef0('0x6'));var util=require('util');var path=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var csv=require(_0xfef0('0x9'));var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x9'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var hardwareService=require(_0xfef0('0x13'));var logger=require(_0xfef0('0x14'))(_0xfef0('0x15'));var utils=require(_0xfef0('0x16'));var config=require(_0xfef0('0x17'));var db=require(_0xfef0('0x18'))['db'];function respondWithStatusCode(_0x87f32a,_0x1bdb7b){_0x1bdb7b=_0x1bdb7b||0xcc;return function(_0x546c7a){if(_0x546c7a){return _0x87f32a[_0xfef0('0x19')](_0x1bdb7b);}return _0x87f32a[_0xfef0('0x1a')](_0x1bdb7b)[_0xfef0('0x1b')]();};}function respondWithResult(_0x30d61d,_0xe9f78d){_0xe9f78d=_0xe9f78d||0xc8;return function(_0x45599a){if(_0x45599a){return _0x30d61d[_0xfef0('0x1a')](_0xe9f78d)['json'](_0x45599a);}};}function respondWithFilteredResult(_0x3d1f02,_0x554aaa){return function(_0x4b5bcf){if(_0x4b5bcf){var _0x5acdd0=_0x4b5bcf[_0xfef0('0x1c')],_0x118b8d=_0x554aaa[_0xfef0('0x1d')],_0x284b6d=_0x554aaa[_0xfef0('0x1d')]+_0x554aaa[_0xfef0('0x1e')],_0x3510a7;if(_0x284b6d>=_0x5acdd0){_0x284b6d=_0x5acdd0;_0x3510a7=0xc8;}else{_0x3510a7=0xce;}_0x3d1f02[_0xfef0('0x1a')](_0x3510a7);return _0x3d1f02['set'](_0xfef0('0x1f'),_0x118b8d+'-'+_0x284b6d+'/'+_0x5acdd0)[_0xfef0('0x20')](_0x4b5bcf);}return null;};}function patchUpdates(_0x1577fa){return function(_0x39f9d3){try{jsonpatch[_0xfef0('0x21')](_0x39f9d3,_0x1577fa,!![]);}catch(_0x55912f){return BPromise[_0xfef0('0x22')](_0x55912f);}return _0x39f9d3['save']();};}function saveUpdates(_0x20826b,_0x1a0aa0){return function(_0x28dee1){if(_0x28dee1){return _0x28dee1['update'](_0x20826b)[_0xfef0('0x23')](function(_0x4c304d){return _0x4c304d;});}return null;};}function removeEntity(_0x4074b7,_0x394fbc){return function(_0x52b93b){if(_0x52b93b){return _0x52b93b['destroy']()['then'](function(){var _0x19fde8=_0x52b93b['get']({'plain':!![]});var _0x1f9970=_0xfef0('0x24');return db[_0xfef0('0x25')][_0xfef0('0x26')]({'where':{'type':_0x1f9970,'resourceId':_0x19fde8['id']}})[_0xfef0('0x23')](function(){return _0x52b93b;});})[_0xfef0('0x23')](function(){_0x4074b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x19')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x27')](_0x5df04f[_0xfef0('0x28')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x29')];}_0xab231c[_0xfef0('0x1a')](_0xf60f2)[_0xfef0('0x2a')](_0x5df04f);};}exports[_0xfef0('0x2b')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=db[_0xfef0('0x2c')][_0xfef0('0x2d')];_0x3e026a['model']=_[_0xfef0('0x2e')](_0x213a91);_0x3e026a['query']=_['keys'](_0x37921f[_0xfef0('0x2f')]);_0x3e026a[_0xfef0('0x30')]=_['intersection'](_0x3e026a['model'],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x31')],qs[_0xfef0('0x32')](_0x37921f[_0xfef0('0x2f')]['fields']));_0x3e3c4c['attributes']=_0x3e3c4c['attributes'][_0xfef0('0x33')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x31')];if(!_0x37921f[_0xfef0('0x2f')][_0xfef0('0x34')]('nolimit')){_0x3e3c4c[_0xfef0('0x1e')]=qs['limit'](_0x37921f[_0xfef0('0x2f')][_0xfef0('0x1e')]);_0x3e3c4c[_0xfef0('0x1d')]=qs[_0xfef0('0x1d')](_0x37921f[_0xfef0('0x2f')][_0xfef0('0x1d')]);}_0x3e3c4c[_0xfef0('0x35')]=qs[_0xfef0('0x36')](_0x37921f['query'][_0xfef0('0x36')]);_0x3e3c4c[_0xfef0('0x37')]=qs[_0xfef0('0x30')](_[_0xfef0('0x38')](_0x37921f[_0xfef0('0x2f')],_0x3e026a[_0xfef0('0x30')]));if(_0x37921f[_0xfef0('0x2f')][_0xfef0('0x39')]){_0x3e3c4c[_0xfef0('0x37')]=_[_0xfef0('0x3a')](_0x3e3c4c[_0xfef0('0x37')],{'$or':_[_0xfef0('0x3b')](_0x213a91,function(_0x366667){if(_0x366667['type'][_0xfef0('0x3c')]!=='VIRTUAL'){var _0x28e5c1={};_0x28e5c1[_0x366667[_0xfef0('0x3d')]]={'$like':'%'+_0x37921f[_0xfef0('0x2f')]['filter']+'%'};return _0x28e5c1;}})});}_0x3e3c4c=_[_0xfef0('0x3a')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x3e')]);var _0x3f2753={'where':_0x3e3c4c['where']};return db[_0xfef0('0x2c')][_0xfef0('0x1c')](_0x3f2753)[_0xfef0('0x23')](function(_0x5577f4){_0x26cb9a[_0xfef0('0x1c')]=_0x5577f4;if(_0x37921f['query']['includeAll']){_0x3e3c4c[_0xfef0('0x3f')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3e3c4c);})[_0xfef0('0x23')](function(_0x61f1ce){_0x26cb9a[_0xfef0('0x40')]=_0x61f1ce;return _0x26cb9a;})[_0xfef0('0x23')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))[_0xfef0('0x41')](handleError(_0x1ac4a3,null));};exports[_0xfef0('0x42')]=function(_0x4dd8f8,_0x417f13){var _0x2a5779={'raw':!![],'where':{'id':_0x4dd8f8['params']['id']}},_0x5a9ed3={};_0x5a9ed3[_0xfef0('0x31')]=_['keys'](db[_0xfef0('0x2c')][_0xfef0('0x2d')]);_0x5a9ed3[_0xfef0('0x2f')]=_[_0xfef0('0x2e')](_0x4dd8f8[_0xfef0('0x2f')]);_0x5a9ed3[_0xfef0('0x30')]=_[_0xfef0('0x43')](_0x5a9ed3[_0xfef0('0x31')],_0x5a9ed3['query']);_0x2a5779[_0xfef0('0x44')]=_['intersection'](_0x5a9ed3['model'],qs[_0xfef0('0x32')](_0x4dd8f8[_0xfef0('0x2f')]['fields']));_0x2a5779[_0xfef0('0x44')]=_0x2a5779['attributes'][_0xfef0('0x33')]?_0x2a5779[_0xfef0('0x44')]:_0x5a9ed3[_0xfef0('0x31')];if(_0x4dd8f8[_0xfef0('0x2f')]['includeAll']){_0x2a5779[_0xfef0('0x3f')]=[{'all':!![]}];}_0x2a5779=_[_0xfef0('0x3a')]({},_0x2a5779,_0x4dd8f8['options']);return db['Disposition'][_0xfef0('0x45')](_0x2a5779)['then'](handleEntityNotFound(_0x417f13,null))[_0xfef0('0x23')](respondWithResult(_0x417f13,null))[_0xfef0('0x41')](handleError(_0x417f13,null));};exports[_0xfef0('0x46')]=function(_0x19acde,_0x1c3e04){return db[_0xfef0('0x2c')]['create'](_0x19acde[_0xfef0('0x47')],{})['then'](function(_0x5a417e){var _0x2f11cb=_0x19acde[_0xfef0('0x48')][_0xfef0('0x49')]({'plain':!![]});if(!_0x2f11cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f11cb[_0xfef0('0x4a')]==='user'){var _0x5dd26b=_0x5a417e['get']({'plain':!![]});var _0x3a475a=_0xfef0('0x24');return db[_0xfef0('0x4b')][_0xfef0('0x45')]({'where':{'name':_0x3a475a,'userProfileId':_0x2f11cb[_0xfef0('0x4c')]},'raw':!![]})[_0xfef0('0x23')](function(_0x1b78af){if(_0x1b78af&&_0x1b78af[_0xfef0('0x4d')]===0x0){return db[_0xfef0('0x25')]['create']({'name':_0x5dd26b['name'],'resourceId':_0x5dd26b['id'],'type':_0x1b78af[_0xfef0('0x29')],'sectionId':_0x1b78af['id']},{})[_0xfef0('0x23')](function(){return _0x5a417e;});}else{return _0x5a417e;}})[_0xfef0('0x41')](function(_0x292e69){logger[_0xfef0('0x27')](_0xfef0('0x4e'),_0x292e69);throw _0x292e69;});}return _0x5a417e;})[_0xfef0('0x23')](respondWithResult(_0x1c3e04,0xc9))[_0xfef0('0x41')](handleError(_0x1c3e04,null));};exports['update']=function(_0x2466e7,_0x19e449){if(_0x2466e7[_0xfef0('0x47')]['id']){delete _0x2466e7[_0xfef0('0x47')]['id'];}return db[_0xfef0('0x2c')]['find']({'where':{'id':_0x2466e7['params']['id']}})['then'](handleEntityNotFound(_0x19e449,null))[_0xfef0('0x23')](saveUpdates(_0x2466e7[_0xfef0('0x47')],null))[_0xfef0('0x23')](respondWithResult(_0x19e449,null))[_0xfef0('0x41')](handleError(_0x19e449,null));};exports['destroy']=function(_0x18a6ee,_0x2b5c33){return db[_0xfef0('0x2c')][_0xfef0('0x45')]({'where':{'id':_0x18a6ee[_0xfef0('0x4f')]['id']}})[_0xfef0('0x23')](handleEntityNotFound(_0x2b5c33,null))[_0xfef0('0x23')](removeEntity(_0x2b5c33,null))['catch'](handleError(_0x2b5c33,null));}; \ No newline at end of file +var _0x8cda=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','then','Dispositions','destroy','error','stack','name','send','index','Disposition','rawAttributes','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','key','VIRTUAL','field','includeAll','include','findAll','show','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x1da173,_0x26fd7c){var _0x1e448b=function(_0x5d0382){while(--_0x5d0382){_0x1da173['push'](_0x1da173['shift']());}};_0x1e448b(++_0x26fd7c);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa8cd('0x0'));var rimraf=require(_0xa8cd('0x1'));var zipdir=require(_0xa8cd('0x2'));var jsonpatch=require(_0xa8cd('0x3'));var rp=require(_0xa8cd('0x4'));var moment=require(_0xa8cd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa8cd('0x6'));var util=require(_0xa8cd('0x7'));var path=require(_0xa8cd('0x8'));var sox=require('sox');var csv=require(_0xa8cd('0x9'));var ejs=require(_0xa8cd('0xa'));var fs=require('fs');var _=require(_0xa8cd('0xb'));var squel=require(_0xa8cd('0xc'));var crypto=require(_0xa8cd('0xd'));var jsforce=require(_0xa8cd('0xe'));var deskjs=require(_0xa8cd('0xf'));var toCsv=require(_0xa8cd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa8cd('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xa8cd('0x11'));var logger=require(_0xa8cd('0x12'))('api');var utils=require(_0xa8cd('0x13'));var config=require(_0xa8cd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56083d,_0xec5e4){_0xec5e4=_0xec5e4||0xcc;return function(_0xa2b804){if(_0xa2b804){return _0x56083d[_0xa8cd('0x15')](_0xec5e4);}return _0x56083d[_0xa8cd('0x16')](_0xec5e4)[_0xa8cd('0x17')]();};}function respondWithResult(_0x53a5d3,_0x3a87ff){_0x3a87ff=_0x3a87ff||0xc8;return function(_0x51d29e){if(_0x51d29e){return _0x53a5d3[_0xa8cd('0x16')](_0x3a87ff)['json'](_0x51d29e);}};}function respondWithFilteredResult(_0x213e36,_0x52d73b){return function(_0x1970c1){if(_0x1970c1){var _0x4f244b=_0x1970c1[_0xa8cd('0x18')],_0x9fe9b0=_0x52d73b[_0xa8cd('0x19')],_0x5bfc4c=_0x52d73b[_0xa8cd('0x19')]+_0x52d73b[_0xa8cd('0x1a')],_0x4e3efd;if(_0x5bfc4c>=_0x4f244b){_0x5bfc4c=_0x4f244b;_0x4e3efd=0xc8;}else{_0x4e3efd=0xce;}_0x213e36['status'](_0x4e3efd);return _0x213e36[_0xa8cd('0x1b')]('Content-Range',_0x9fe9b0+'-'+_0x5bfc4c+'/'+_0x4f244b)[_0xa8cd('0x1c')](_0x1970c1);}return null;};}function patchUpdates(_0x2ef224){return function(_0x572230){try{jsonpatch[_0xa8cd('0x1d')](_0x572230,_0x2ef224,!![]);}catch(_0x1260e5){return BPromise['reject'](_0x1260e5);}return _0x572230[_0xa8cd('0x1e')]();};}function saveUpdates(_0x385224,_0x1ecce0){return function(_0x289cb6){if(_0x289cb6){return _0x289cb6[_0xa8cd('0x1f')](_0x385224)['then'](function(_0xdd4de1){return _0xdd4de1;});}return null;};}function removeEntity(_0x3e43fc,_0x426baf){return function(_0x447d7f){if(_0x447d7f){return _0x447d7f['destroy']()[_0xa8cd('0x20')](function(){var _0x514665=_0x447d7f['get']({'plain':!![]});var _0x28574f=_0xa8cd('0x21');return db['UserProfileResource'][_0xa8cd('0x22')]({'where':{'type':_0x28574f,'resourceId':_0x514665['id']}})[_0xa8cd('0x20')](function(){return _0x447d7f;});})[_0xa8cd('0x20')](function(){_0x3e43fc[_0xa8cd('0x16')](0xcc)[_0xa8cd('0x17')]();});}};}function handleEntityNotFound(_0x2d1ef5,_0x1f369d){return function(_0x4a5221){if(!_0x4a5221){_0x2d1ef5[_0xa8cd('0x15')](0x194);}return _0x4a5221;};}function handleError(_0x42ae30,_0x3c4c22){_0x3c4c22=_0x3c4c22||0x1f4;return function(_0x393e5a){logger[_0xa8cd('0x23')](_0x393e5a[_0xa8cd('0x24')]);if(_0x393e5a['name']){delete _0x393e5a[_0xa8cd('0x25')];}_0x42ae30[_0xa8cd('0x16')](_0x3c4c22)[_0xa8cd('0x26')](_0x393e5a);};}exports[_0xa8cd('0x27')]=function(_0xe973cb,_0x2241f8){var _0x3285d8={},_0x3e1770={},_0x2a99e6={'count':0x0,'rows':[]};var _0x22cf82=db[_0xa8cd('0x28')][_0xa8cd('0x29')];_0x3e1770[_0xa8cd('0x2a')]=_[_0xa8cd('0x2b')](_0x22cf82);_0x3e1770[_0xa8cd('0x2c')]=_[_0xa8cd('0x2b')](_0xe973cb['query']);_0x3e1770['filters']=_['intersection'](_0x3e1770[_0xa8cd('0x2a')],_0x3e1770[_0xa8cd('0x2c')]);_0x3285d8[_0xa8cd('0x2d')]=_[_0xa8cd('0x2e')](_0x3e1770[_0xa8cd('0x2a')],qs[_0xa8cd('0x2f')](_0xe973cb['query']['fields']));_0x3285d8['attributes']=_0x3285d8[_0xa8cd('0x2d')][_0xa8cd('0x30')]?_0x3285d8[_0xa8cd('0x2d')]:_0x3e1770[_0xa8cd('0x2a')];if(!_0xe973cb[_0xa8cd('0x2c')][_0xa8cd('0x31')](_0xa8cd('0x32'))){_0x3285d8['limit']=qs[_0xa8cd('0x1a')](_0xe973cb[_0xa8cd('0x2c')]['limit']);_0x3285d8[_0xa8cd('0x19')]=qs[_0xa8cd('0x19')](_0xe973cb[_0xa8cd('0x2c')][_0xa8cd('0x19')]);}_0x3285d8['order']=qs[_0xa8cd('0x33')](_0xe973cb[_0xa8cd('0x2c')]['sort']);_0x3285d8[_0xa8cd('0x34')]=qs[_0xa8cd('0x35')](_[_0xa8cd('0x36')](_0xe973cb[_0xa8cd('0x2c')],_0x3e1770['filters']));if(_0xe973cb['query'][_0xa8cd('0x37')]){_0x3285d8['where']=_[_0xa8cd('0x38')](_0x3285d8['where'],{'$or':_[_0xa8cd('0x39')](_0x22cf82,function(_0x32bad6){if(_0x32bad6['type'][_0xa8cd('0x3a')]!==_0xa8cd('0x3b')){var _0x2ab7d6={};_0x2ab7d6[_0x32bad6[_0xa8cd('0x3c')]]={'$like':'%'+_0xe973cb[_0xa8cd('0x2c')][_0xa8cd('0x37')]+'%'};return _0x2ab7d6;}})});}_0x3285d8=_[_0xa8cd('0x38')]({},_0x3285d8,_0xe973cb['options']);var _0x2437b0={'where':_0x3285d8[_0xa8cd('0x34')]};return db['Disposition']['count'](_0x2437b0)[_0xa8cd('0x20')](function(_0x3da42e){_0x2a99e6[_0xa8cd('0x18')]=_0x3da42e;if(_0xe973cb[_0xa8cd('0x2c')][_0xa8cd('0x3d')]){_0x3285d8[_0xa8cd('0x3e')]=[{'all':!![]}];}return db[_0xa8cd('0x28')][_0xa8cd('0x3f')](_0x3285d8);})['then'](function(_0x232e8f){_0x2a99e6['rows']=_0x232e8f;return _0x2a99e6;})[_0xa8cd('0x20')](respondWithFilteredResult(_0x2241f8,_0x3285d8))['catch'](handleError(_0x2241f8,null));};exports[_0xa8cd('0x40')]=function(_0x27a64c,_0x2d3f37){var _0xa6dfdd={'raw':!![],'where':{'id':_0x27a64c['params']['id']}},_0x4b6573={};_0x4b6573['model']=_['keys'](db[_0xa8cd('0x28')][_0xa8cd('0x29')]);_0x4b6573['query']=_[_0xa8cd('0x2b')](_0x27a64c[_0xa8cd('0x2c')]);_0x4b6573[_0xa8cd('0x35')]=_[_0xa8cd('0x2e')](_0x4b6573[_0xa8cd('0x2a')],_0x4b6573[_0xa8cd('0x2c')]);_0xa6dfdd['attributes']=_['intersection'](_0x4b6573[_0xa8cd('0x2a')],qs[_0xa8cd('0x2f')](_0x27a64c[_0xa8cd('0x2c')][_0xa8cd('0x2f')]));_0xa6dfdd['attributes']=_0xa6dfdd[_0xa8cd('0x2d')][_0xa8cd('0x30')]?_0xa6dfdd[_0xa8cd('0x2d')]:_0x4b6573[_0xa8cd('0x2a')];if(_0x27a64c['query']['includeAll']){_0xa6dfdd['include']=[{'all':!![]}];}_0xa6dfdd=_[_0xa8cd('0x38')]({},_0xa6dfdd,_0x27a64c[_0xa8cd('0x41')]);return db['Disposition'][_0xa8cd('0x42')](_0xa6dfdd)[_0xa8cd('0x20')](handleEntityNotFound(_0x2d3f37,null))[_0xa8cd('0x20')](respondWithResult(_0x2d3f37,null))[_0xa8cd('0x43')](handleError(_0x2d3f37,null));};exports[_0xa8cd('0x44')]=function(_0xc210b5,_0x5a4de3){return db['Disposition']['create'](_0xc210b5[_0xa8cd('0x45')],{})[_0xa8cd('0x20')](function(_0x97f52a){var _0x15f872=_0xc210b5[_0xa8cd('0x46')][_0xa8cd('0x47')]({'plain':!![]});if(!_0x15f872)throw new Error(_0xa8cd('0x48'));if(_0x15f872[_0xa8cd('0x49')]===_0xa8cd('0x46')){var _0x534f5a=_0x97f52a['get']({'plain':!![]});var _0xacf670='Dispositions';return db[_0xa8cd('0x4a')][_0xa8cd('0x42')]({'where':{'name':_0xacf670,'userProfileId':_0x15f872[_0xa8cd('0x4b')]},'raw':!![]})[_0xa8cd('0x20')](function(_0x33a9a6){if(_0x33a9a6&&_0x33a9a6['autoAssociation']===0x0){return db[_0xa8cd('0x4c')]['create']({'name':_0x534f5a[_0xa8cd('0x25')],'resourceId':_0x534f5a['id'],'type':_0x33a9a6[_0xa8cd('0x25')],'sectionId':_0x33a9a6['id']},{})[_0xa8cd('0x20')](function(){return _0x97f52a;});}else{return _0x97f52a;}})[_0xa8cd('0x43')](function(_0x35f13a){logger[_0xa8cd('0x23')](_0xa8cd('0x4d'),_0x35f13a);throw _0x35f13a;});}return _0x97f52a;})[_0xa8cd('0x20')](respondWithResult(_0x5a4de3,0xc9))[_0xa8cd('0x43')](handleError(_0x5a4de3,null));};exports[_0xa8cd('0x1f')]=function(_0x7cbe1c,_0x208447){if(_0x7cbe1c[_0xa8cd('0x45')]['id']){delete _0x7cbe1c[_0xa8cd('0x45')]['id'];}return db[_0xa8cd('0x28')]['find']({'where':{'id':_0x7cbe1c['params']['id']}})[_0xa8cd('0x20')](handleEntityNotFound(_0x208447,null))[_0xa8cd('0x20')](saveUpdates(_0x7cbe1c['body'],null))[_0xa8cd('0x20')](respondWithResult(_0x208447,null))[_0xa8cd('0x43')](handleError(_0x208447,null));};exports['destroy']=function(_0x311d4c,_0x2df8c6){return db[_0xa8cd('0x28')]['find']({'where':{'id':_0x311d4c[_0xa8cd('0x4e')]['id']}})[_0xa8cd('0x20')](handleEntityNotFound(_0x2df8c6,null))[_0xa8cd('0x20')](removeEntity(_0x2df8c6,null))[_0xa8cd('0x43')](handleError(_0x2df8c6,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3f15c47..d4b3c22 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 _0x6aae=['FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','api','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax'];(function(_0x54822a,_0x20e794){var _0x486b24=function(_0x19f805){while(--_0x19f805){_0x54822a['push'](_0x54822a['shift']());}};_0x486b24(++_0x20e794);}(_0x6aae,0x100));var _0xe6aa=function(_0x358a16,_0x542781){_0x358a16=_0x358a16-0x0;var _0x15432c=_0x6aae[_0x358a16];return _0x15432c;};'use strict';var _=require(_0xe6aa('0x0'));var util=require(_0xe6aa('0x1'));var logger=require('../../config/logger')(_0xe6aa('0x2'));var moment=require('moment');var BPromise=require(_0xe6aa('0x3'));var rp=require(_0xe6aa('0x4'));var fs=require('fs');var path=require(_0xe6aa('0x5'));var rimraf=require('rimraf');var config=require(_0xe6aa('0x6'));var attributes=require(_0xe6aa('0x7'));module[_0xe6aa('0x8')]=function(_0x368967,_0x248edb){return _0x368967['define'](_0xe6aa('0x9'),attributes,{'tableName':_0xe6aa('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xe6aa('0xb'),'fields':[_0xe6aa('0xc'),_0xe6aa('0xd')]},{'unique':!![],'name':_0xe6aa('0xe'),'fields':[_0xe6aa('0xc'),_0xe6aa('0xf')]},{'unique':!![],'name':_0xe6aa('0x10'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xe6aa('0x11'),'fields':[_0xe6aa('0xc'),_0xe6aa('0x12')]},{'unique':!![],'name':_0xe6aa('0x13'),'fields':['name',_0xe6aa('0x14')]},{'unique':!![],'name':_0xe6aa('0x15'),'fields':['name',_0xe6aa('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b8d=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_openchannel','OpenchannelAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name','ListId'];(function(_0x55795a,_0x53d9b5){var _0x26ffa5=function(_0x4a3519){while(--_0x4a3519){_0x55795a['push'](_0x55795a['shift']());}};_0x26ffa5(++_0x53d9b5);}(_0x4b8d,0x1bd));var _0xd4b8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x4b8d[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xd4b8('0x0'));var util=require('util');var logger=require(_0xd4b8('0x1'))(_0xd4b8('0x2'));var moment=require(_0xd4b8('0x3'));var BPromise=require(_0xd4b8('0x4'));var rp=require(_0xd4b8('0x5'));var fs=require('fs');var path=require(_0xd4b8('0x6'));var rimraf=require(_0xd4b8('0x7'));var config=require(_0xd4b8('0x8'));var attributes=require('./disposition.attributes');module[_0xd4b8('0x9')]=function(_0x89560a,_0x58642a){return _0x89560a[_0xd4b8('0xa')](_0xd4b8('0xb'),attributes,{'tableName':_0xd4b8('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xd4b8('0xd'),_0xd4b8('0xe')]},{'unique':!![],'name':_0xd4b8('0xf'),'fields':[_0xd4b8('0xd'),_0xd4b8('0x10')]},{'unique':!![],'name':_0xd4b8('0x11'),'fields':['name',_0xd4b8('0x12')]},{'unique':!![],'name':_0xd4b8('0x13'),'fields':[_0xd4b8('0xd'),_0xd4b8('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0xd4b8('0xd'),'FaxAccountId']},{'unique':!![],'name':_0xd4b8('0x15'),'fields':[_0xd4b8('0xd'),_0xd4b8('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 75ac451..d0b6ebf 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 _0xdb03=['stringify','error','code','message','info','result','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3cc69e,_0x54c823){var _0x404bd4=function(_0x5638a9){while(--_0x5638a9){_0x3cc69e['push'](_0x3cc69e['shift']());}};_0x404bd4(++_0x54c823);}(_0xdb03,0x141));var _0x3db0=function(_0x3deeb8,_0x1f1490){_0x3deeb8=_0x3deeb8-0x0;var _0x3b864a=_0xdb03[_0x3deeb8];return _0x3b864a;};'use strict';var _=require('lodash');var util=require(_0x3db0('0x0'));var moment=require(_0x3db0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3db0('0x2'));var db=require(_0x3db0('0x3'))['db'];var utils=require(_0x3db0('0x4'));var logger=require('../../config/logger')(_0x3db0('0x5'));var config=require(_0x3db0('0x6'));var jayson=require(_0x3db0('0x7'));var client=jayson[_0x3db0('0x8')][_0x3db0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42e3ed,_0x5b33e9,_0x1d7f8a){return new BPromise(function(_0x525ffd,_0xe59b58){return client[_0x3db0('0xa')](_0x42e3ed,_0x1d7f8a)[_0x3db0('0xb')](function(_0x575b72){logger['info'](_0x3db0('0xc'),_0x5b33e9,_0x3db0('0xd'));logger[_0x3db0('0xe')]('Disposition,\x20%s,\x20%s,\x20%s',_0x5b33e9,_0x3db0('0xd'),JSON[_0x3db0('0xf')](_0x575b72));if(_0x575b72[_0x3db0('0x10')]){if(_0x575b72[_0x3db0('0x10')][_0x3db0('0x11')]===0x1f4){logger['error'](_0x3db0('0xc'),_0x5b33e9,_0x575b72[_0x3db0('0x10')][_0x3db0('0x12')]);return _0xe59b58(_0x575b72[_0x3db0('0x10')][_0x3db0('0x12')]);}logger['error'](_0x3db0('0xc'),_0x5b33e9,_0x575b72[_0x3db0('0x10')]['message']);return _0x525ffd(_0x575b72[_0x3db0('0x10')][_0x3db0('0x12')]);}else{logger[_0x3db0('0x13')](_0x3db0('0xc'),_0x5b33e9,'request\x20sent');_0x525ffd(_0x575b72[_0x3db0('0x14')]['message']);}})['catch'](function(_0x1b0af7){logger[_0x3db0('0x10')](_0x3db0('0xc'),_0x5b33e9,_0x1b0af7);_0xe59b58(_0x1b0af7);});});} \ No newline at end of file +var _0x1890=['../../config/utils','rpc','../../config/environment','client','request','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5eb4f0,_0x38f470){var _0xb7e5c3=function(_0x250bbe){while(--_0x250bbe){_0x5eb4f0['push'](_0x5eb4f0['shift']());}};_0xb7e5c3(++_0x38f470);}(_0x1890,0x1cf));var _0x0189=function(_0x1abd88,_0x3fabe0){_0x1abd88=_0x1abd88-0x0;var _0x404e98=_0x1890[_0x1abd88];return _0x404e98;};'use strict';var _=require(_0x0189('0x0'));var util=require('util');var moment=require(_0x0189('0x1'));var BPromise=require('bluebird');var rs=require(_0x0189('0x2'));var fs=require('fs');var Redis=require(_0x0189('0x3'));var db=require(_0x0189('0x4'))['db'];var utils=require(_0x0189('0x5'));var logger=require('../../config/logger')(_0x0189('0x6'));var config=require(_0x0189('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0189('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ae73e,_0x42c43d,_0x8a5933){return new BPromise(function(_0x409fae,_0x358a54){return client[_0x0189('0x9')](_0x2ae73e,_0x8a5933)['then'](function(_0x5e3a30){logger['info'](_0x0189('0xa'),_0x42c43d,_0x0189('0xb'));logger[_0x0189('0xc')]('Disposition,\x20%s,\x20%s,\x20%s',_0x42c43d,_0x0189('0xb'),JSON[_0x0189('0xd')](_0x5e3a30));if(_0x5e3a30[_0x0189('0xe')]){if(_0x5e3a30[_0x0189('0xe')][_0x0189('0xf')]===0x1f4){logger[_0x0189('0xe')](_0x0189('0xa'),_0x42c43d,_0x5e3a30[_0x0189('0xe')][_0x0189('0x10')]);return _0x358a54(_0x5e3a30[_0x0189('0xe')][_0x0189('0x10')]);}logger[_0x0189('0xe')](_0x0189('0xa'),_0x42c43d,_0x5e3a30[_0x0189('0xe')][_0x0189('0x10')]);return _0x409fae(_0x5e3a30[_0x0189('0xe')][_0x0189('0x10')]);}else{logger[_0x0189('0x11')](_0x0189('0xa'),_0x42c43d,'request\x20sent');_0x409fae(_0x5e3a30['result']['message']);}})['catch'](function(_0x516291){logger[_0x0189('0xe')](_0x0189('0xa'),_0x42c43d,_0x516291);_0x358a54(_0x516291);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 40ddc4f..e5bd1c5 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 _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x17f515,_0x26e47f){var _0x5ea54b=function(_0x32de1b){while(--_0x32de1b){_0x17f515['push'](_0x17f515['shift']());}};_0x5ea54b(++_0x26e47f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x8b0e=['delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x3d0f20,_0x392204){var _0x501671=function(_0x4c4777){while(--_0x4c4777){_0x3d0f20['push'](_0x3d0f20['shift']());}};_0x501671(++_0x392204);}(_0x8b0e,0x166));var _0xe8b0=function(_0x352de7,_0x42d665){_0x352de7=_0x352de7-0x0;var _0x76cff2=_0x8b0e[_0x352de7];return _0x76cff2;};'use strict';var multer=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var path=require(_0xe8b0('0x2'));var timeout=require(_0xe8b0('0x3'));var express=require(_0xe8b0('0x4'));var router=express[_0xe8b0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe8b0('0x6'));var config=require('../../config/environment');var controller=require(_0xe8b0('0x7'));router[_0xe8b0('0x8')]('/',auth[_0xe8b0('0x9')](),controller[_0xe8b0('0xa')]);router[_0xe8b0('0x8')](_0xe8b0('0xb'),auth[_0xe8b0('0x9')](),controller[_0xe8b0('0xc')]);router['post']('/',auth[_0xe8b0('0x9')](),controller[_0xe8b0('0xd')]);router[_0xe8b0('0xe')](_0xe8b0('0xb'),auth[_0xe8b0('0x9')](),controller[_0xe8b0('0xf')]);router[_0xe8b0('0x10')](_0xe8b0('0xb'),auth[_0xe8b0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index cd54188..f23b61b 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 _0x80aa=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','ENUM','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x80aa,0x1bb));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xa80a('0x0')]={'name':{'type':Sequelize[_0xa80a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa80a('0x1')]},'ecm':{'type':Sequelize[_0xa80a('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xa80a('0x1')],'defaultValue':_0xa80a('0x3')},'localstationid':{'type':Sequelize[_0xa80a('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xa80a('0x2')](_0xa80a('0x4'),_0xa80a('0x5'),_0xa80a('0x6'),_0xa80a('0x7'),'12000','14400'),'defaultValue':_0xa80a('0x5')},'maxrate':{'type':Sequelize[_0xa80a('0x2')](_0xa80a('0x4'),_0xa80a('0x5'),_0xa80a('0x6'),_0xa80a('0x7'),_0xa80a('0x8'),_0xa80a('0x9')),'defaultValue':_0xa80a('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xa80a('0xa')},'gateway':{'type':Sequelize[_0xa80a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa80a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa80a('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa80a('0x2')](_0xa80a('0xc'),'IAX','DADHI',_0xa80a('0xd')),'defaultValue':_0xa80a('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa80a('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa80a('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa80a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa80a('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xa80a('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xa80a('0xf')],'defaultValue':![],'comment':_0xa80a('0x11'),'set':function(_0x172c64){if(!_0x172c64)this[_0xa80a('0x12')]('mandatoryDispositionPauseId',null);this[_0xa80a('0x12')](_0xa80a('0x13'),_0x172c64);}}}; \ No newline at end of file +var _0x7d20=['INTEGER','SIP','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','9600','12000','14400','4800','ENUM','2400','7200','v17,v27,v29'];(function(_0x2e8f47,_0x4b2142){var _0x2ec2cb=function(_0x430e71){while(--_0x430e71){_0x2e8f47['push'](_0x2e8f47['shift']());}};_0x2ec2cb(++_0x4b2142);}(_0x7d20,0x15a));var _0x07d2=function(_0x1dff1e,_0x5c4d41){_0x1dff1e=_0x1dff1e-0x0;var _0x3556d9=_0x7d20[_0x1dff1e];return _0x3556d9;};'use strict';var Sequelize=require(_0x07d2('0x0'));module[_0x07d2('0x1')]={'name':{'type':Sequelize[_0x07d2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x07d2('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x07d2('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x07d2('0x4')},'localstationid':{'type':Sequelize[_0x07d2('0x2')],'unique':_0x07d2('0x5')},'minrate':{'type':Sequelize['ENUM']('2400','4800','7200',_0x07d2('0x6'),_0x07d2('0x7'),_0x07d2('0x8')),'defaultValue':_0x07d2('0x9')},'maxrate':{'type':Sequelize[_0x07d2('0xa')](_0x07d2('0xb'),'4800',_0x07d2('0xc'),_0x07d2('0x6'),'12000',_0x07d2('0x8')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x07d2('0x2')],'defaultValue':_0x07d2('0xd')},'gateway':{'type':Sequelize[_0x07d2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x07d2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x07d2('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x07d2('0xf'),'IAX',_0x07d2('0x10'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x07d2('0x11');}},'notificationSound':{'type':Sequelize[_0x07d2('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x07d2('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x07d2('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07d2('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x07d2('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07d2('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x07d2('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x07d2('0x12')],'defaultValue':![],'comment':_0x07d2('0x14'),'set':function(_0x1af579){if(!_0x1af579)this[_0x07d2('0x15')](_0x07d2('0x16'),null);this['setDataValue'](_0x07d2('0x17'),_0x1af579);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index cac12f7..872ba5e 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 _0xbaf0=['addDisposition','Disposition','getDispositions','findOne','FaxAccountId','filter','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','faxdetect','headerinfo','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','sequelize','update','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','Contacts','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','filename','Contact\x20not\x20found','spread','out','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','key','field','options','count','includeAll','include','findAll','rows','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe'];(function(_0x2409ad,_0x5f4078){var _0x2c24c9=function(_0x4ea567){while(--_0x4ea567){_0x2409ad['push'](_0x2409ad['shift']());}};_0x2c24c9(++_0x5f4078);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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 hardwareService=require(_0x0baf('0x15'));var logger=require(_0x0baf('0x16'))(_0x0baf('0x17'));var utils=require(_0x0baf('0x18'));var config=require(_0x0baf('0x19'));var db=require(_0x0baf('0x1a'))['db'];config['redis']=_['defaults'](config[_0x0baf('0x1b')],{'host':_0x0baf('0x1c'),'port':0x18eb});var socket=require(_0x0baf('0x1d'))(new Redis(config[_0x0baf('0x1b')]));require('./faxAccount.socket')[_0x0baf('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0baf('0x1f')][_0x0baf('0x20')]({'port':0x232c});var client9002=jayson[_0x0baf('0x1f')][_0x0baf('0x20')]({'port':0x232a});function checkPasswordPattern(_0xb8339e,_0x469599,_0x4f80a8){if(_0x4f80a8){var _0x4cd79d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cd79d[_0x0baf('0x21')](_0x469599)){return _0xb8339e;}else{throw new db[(_0x0baf('0x22'))][(_0x0baf('0x23'))](_0x0baf('0x24'));}}else{return _0xb8339e;}}function respondWithRpcPromise(_0x2cf7da,_0x288a98,_0x53c338,_0x63c820){return new BPromise(function(_0xfbecec,_0x1ef0e5){var _0x3e9cb4=_0x63c820||client;return _0x3e9cb4[_0x0baf('0x25')](_0x2cf7da,_0x53c338)[_0x0baf('0x26')](function(_0x4ff793){logger['info'](_0x0baf('0x27'),_0x288a98,_0x0baf('0x28'));logger[_0x0baf('0x29')](_0x0baf('0x2a'),_0x288a98,_0x0baf('0x28'),JSON[_0x0baf('0x2b')](_0x4ff793));if(_0x4ff793[_0x0baf('0x2c')]){if(_0x4ff793[_0x0baf('0x2c')][_0x0baf('0x2d')]===0x1f4){logger[_0x0baf('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x288a98,_0x4ff793[_0x0baf('0x2c')]['message']);return _0x1ef0e5(_0x4ff793[_0x0baf('0x2c')]['message']);}logger['error'](_0x0baf('0x27'),_0x288a98,_0x4ff793['error']['message']);return _0xfbecec(_0x4ff793[_0x0baf('0x2c')][_0x0baf('0x2e')]);}else{logger[_0x0baf('0x2f')](_0x0baf('0x27'),_0x288a98,_0x0baf('0x28'));_0xfbecec(_0x4ff793['result'][_0x0baf('0x2e')]);}})[_0x0baf('0x30')](function(_0x1ca35a){logger[_0x0baf('0x2c')](_0x0baf('0x27'),_0x288a98,_0x1ca35a);_0x1ef0e5(_0x1ca35a);});});}function respondWithStatusCode(_0x3b9b31,_0x453525){_0x453525=_0x453525||0xcc;return function(_0x549fd0){if(_0x549fd0){return _0x3b9b31[_0x0baf('0x31')](_0x453525);}return _0x3b9b31[_0x0baf('0x32')](_0x453525)[_0x0baf('0x33')]();};}function respondWithResult(_0x265915,_0x55c715){_0x55c715=_0x55c715||0xc8;return function(_0x29dbdf){if(_0x29dbdf){return _0x265915[_0x0baf('0x32')](_0x55c715)['json'](_0x29dbdf);}};}function respondWithFilteredResult(_0x44ec31,_0x32e4fb){return function(_0x478ce8){if(_0x478ce8){var _0xb4dbb1=_0x478ce8['count'],_0xd14f0f=_0x32e4fb[_0x0baf('0x34')],_0x366924=_0x32e4fb[_0x0baf('0x34')]+_0x32e4fb[_0x0baf('0x35')],_0x213a6a;if(_0x366924>=_0xb4dbb1){_0x366924=_0xb4dbb1;_0x213a6a=0xc8;}else{_0x213a6a=0xce;}_0x44ec31[_0x0baf('0x32')](_0x213a6a);return _0x44ec31[_0x0baf('0x36')](_0x0baf('0x37'),_0xd14f0f+'-'+_0x366924+'/'+_0xb4dbb1)[_0x0baf('0x38')](_0x478ce8);}return null;};}function patchUpdates(_0x2f0a45){return function(_0x59431b){try{jsonpatch[_0x0baf('0x39')](_0x59431b,_0x2f0a45,!![]);}catch(_0x2adfd7){return BPromise[_0x0baf('0x3a')](_0x2adfd7);}return _0x59431b[_0x0baf('0x3b')]();};}function saveUpdates(_0x3a3353,_0x57a6bb){return function(_0x2fd426){if(_0x2fd426){return _0x2fd426['update'](_0x3a3353)[_0x0baf('0x26')](function(_0x2b205b){return _0x2b205b;});}return null;};}function removeEntity(_0x35e534,_0x3d65f2){return function(_0x5300a5){if(_0x5300a5){return _0x5300a5[_0x0baf('0x3c')]()[_0x0baf('0x26')](function(){var _0x5088a5=_0x5300a5[_0x0baf('0x3d')]({'plain':!![]});var _0x2447c2=_0x0baf('0x3e');return db[_0x0baf('0x3f')][_0x0baf('0x3c')]({'where':{'type':_0x2447c2,'resourceId':_0x5088a5['id']}})[_0x0baf('0x26')](function(){return _0x5300a5;});})[_0x0baf('0x26')](function(){_0x35e534[_0x0baf('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e765b,_0x2ab8fa){return function(_0x5b991f){if(!_0x5b991f){_0x7e765b[_0x0baf('0x31')](0x194);}return _0x5b991f;};}function handleError(_0x57783c,_0x5c545f){_0x5c545f=_0x5c545f||0x1f4;return function(_0x11bc49){logger[_0x0baf('0x2c')](_0x11bc49['stack']);if(_0x11bc49['name']){delete _0x11bc49[_0x0baf('0x40')];}_0x57783c[_0x0baf('0x32')](_0x5c545f)[_0x0baf('0x41')](_0x11bc49);};}exports[_0x0baf('0x42')]=function(_0x15eb5c,_0x2028ad){var _0x290464={'include':[{'model':db[_0x0baf('0x43')],'as':_0x0baf('0x44')}]},_0x37c038={},_0x631f74={'count':0x0,'rows':[]};var _0x148540=db[_0x0baf('0x45')][_0x0baf('0x46')];_0x37c038['model']=_[_0x0baf('0x47')](_0x148540);_0x37c038[_0x0baf('0x48')]=_['keys'](_0x15eb5c[_0x0baf('0x48')]);_0x37c038[_0x0baf('0x49')]=_[_0x0baf('0x4a')](_0x37c038[_0x0baf('0x4b')],_0x37c038[_0x0baf('0x48')]);_0x290464[_0x0baf('0x4c')]=_['intersection'](_0x37c038[_0x0baf('0x4b')],qs[_0x0baf('0x4d')](_0x15eb5c['query'][_0x0baf('0x4d')]));_0x290464[_0x0baf('0x4c')]=_0x290464[_0x0baf('0x4c')][_0x0baf('0x4e')]?_0x290464['attributes']:_0x37c038[_0x0baf('0x4b')];if(!_0x15eb5c[_0x0baf('0x48')][_0x0baf('0x4f')](_0x0baf('0x50'))){_0x290464[_0x0baf('0x35')]=qs[_0x0baf('0x35')](_0x15eb5c[_0x0baf('0x48')][_0x0baf('0x35')]);_0x290464[_0x0baf('0x34')]=qs[_0x0baf('0x34')](_0x15eb5c['query'][_0x0baf('0x34')]);}_0x290464[_0x0baf('0x51')]=qs[_0x0baf('0x52')](_0x15eb5c[_0x0baf('0x48')][_0x0baf('0x52')]);_0x290464['where']=qs[_0x0baf('0x49')](_[_0x0baf('0x53')](_0x15eb5c[_0x0baf('0x48')],_0x37c038[_0x0baf('0x49')]));if(_0x15eb5c[_0x0baf('0x48')]['filter']){_0x290464[_0x0baf('0x54')]=_[_0x0baf('0x55')](_0x290464[_0x0baf('0x54')],{'$or':_[_0x0baf('0x56')](_0x148540,function(_0x41599f){if(_0x41599f[_0x0baf('0x57')][_0x0baf('0x58')]!=='VIRTUAL'){var _0x399be0={};_0x399be0[_0x41599f[_0x0baf('0x59')]]={'$like':'%'+_0x15eb5c[_0x0baf('0x48')]['filter']+'%'};return _0x399be0;}})});}_0x290464=_[_0x0baf('0x55')]({},_0x290464,_0x15eb5c[_0x0baf('0x5a')]);var _0x10fa62={'where':_0x290464[_0x0baf('0x54')]};return db[_0x0baf('0x45')][_0x0baf('0x5b')](_0x10fa62)[_0x0baf('0x26')](function(_0x5a54bb){_0x631f74[_0x0baf('0x5b')]=_0x5a54bb;if(_0x15eb5c[_0x0baf('0x48')][_0x0baf('0x5c')]){_0x290464[_0x0baf('0x5d')]=[{'all':!![]}];}return db[_0x0baf('0x45')][_0x0baf('0x5e')](_0x290464);})[_0x0baf('0x26')](function(_0x1af4aa){_0x631f74[_0x0baf('0x5f')]=_0x1af4aa;return _0x631f74;})[_0x0baf('0x26')](respondWithFilteredResult(_0x2028ad,_0x290464))[_0x0baf('0x30')](handleError(_0x2028ad,null));};exports['show']=function(_0x528ff6,_0x354329){var _0x3d6b19={'raw':![],'where':{'id':_0x528ff6[_0x0baf('0x60')]['id']},'include':[{'model':db[_0x0baf('0x43')],'as':_0x0baf('0x44')}]},_0x1cd114={};_0x1cd114[_0x0baf('0x4b')]=_['keys'](db[_0x0baf('0x45')][_0x0baf('0x46')]);_0x1cd114[_0x0baf('0x48')]=_[_0x0baf('0x47')](_0x528ff6[_0x0baf('0x48')]);_0x1cd114[_0x0baf('0x49')]=_['intersection'](_0x1cd114[_0x0baf('0x4b')],_0x1cd114['query']);_0x3d6b19[_0x0baf('0x4c')]=_['intersection'](_0x1cd114[_0x0baf('0x4b')],qs['fields'](_0x528ff6[_0x0baf('0x48')]['fields']));_0x3d6b19[_0x0baf('0x4c')]=_0x3d6b19[_0x0baf('0x4c')][_0x0baf('0x4e')]?_0x3d6b19[_0x0baf('0x4c')]:_0x1cd114[_0x0baf('0x4b')];if(_0x528ff6['query'][_0x0baf('0x5c')]){_0x3d6b19[_0x0baf('0x5d')]=[{'all':!![]}];}_0x3d6b19=_[_0x0baf('0x55')]({},_0x3d6b19,_0x528ff6[_0x0baf('0x5a')]);return db[_0x0baf('0x45')][_0x0baf('0x61')](_0x3d6b19)['then'](handleEntityNotFound(_0x354329,null))[_0x0baf('0x26')](respondWithResult(_0x354329,null))[_0x0baf('0x30')](handleError(_0x354329,null));};exports[_0x0baf('0x62')]=function(_0xabafaa,_0xbc7cc2){return db[_0x0baf('0x45')][_0x0baf('0x62')](_0xabafaa['body'],{})['then'](function(_0x23f6ea){var _0x11e18a=_0xabafaa[_0x0baf('0x63')][_0x0baf('0x3d')]({'plain':!![]});if(!_0x11e18a)throw new Error(_0x0baf('0x64'));if(_0x11e18a[_0x0baf('0x65')]===_0x0baf('0x63')){var _0x14a667=_0x23f6ea[_0x0baf('0x3d')]({'plain':!![]});var _0x585969=_0x0baf('0x3e');return db[_0x0baf('0x66')][_0x0baf('0x61')]({'where':{'name':_0x585969,'userProfileId':_0x11e18a[_0x0baf('0x67')]},'raw':!![]})[_0x0baf('0x26')](function(_0xebfc0c){if(_0xebfc0c&&_0xebfc0c[_0x0baf('0x68')]===0x0){return db['UserProfileResource'][_0x0baf('0x62')]({'name':_0x14a667[_0x0baf('0x40')],'resourceId':_0x14a667['id'],'type':_0xebfc0c[_0x0baf('0x40')],'sectionId':_0xebfc0c['id']},{})[_0x0baf('0x26')](function(){return _0x23f6ea;});}else{return _0x23f6ea;}})[_0x0baf('0x30')](function(_0x1a6d22){logger[_0x0baf('0x2c')](_0x0baf('0x69'),_0x1a6d22);throw _0x1a6d22;});}return _0x23f6ea;})['then'](respondWithResult(_0xbc7cc2,0xc9))[_0x0baf('0x30')](handleError(_0xbc7cc2,null));};exports['update']=function(_0x3c00e7,_0x5f2fbe){if(_0x3c00e7['body']['id']){delete _0x3c00e7[_0x0baf('0x6a')]['id'];}return db['FaxAccount'][_0x0baf('0x61')]({'where':{'id':_0x3c00e7[_0x0baf('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x0baf('0x44')}]})[_0x0baf('0x26')](handleEntityNotFound(_0x5f2fbe,null))[_0x0baf('0x26')](saveUpdates(_0x3c00e7['body'],null))['then'](respondWithResult(_0x5f2fbe,null))[_0x0baf('0x30')](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x3c')]=function(_0x6d789f,_0x7f49e){return db[_0x0baf('0x45')]['find']({'where':{'id':_0x6d789f[_0x0baf('0x60')]['id']}})['then'](handleEntityNotFound(_0x7f49e,null))['then'](removeEntity(_0x7f49e,null))['catch'](handleError(_0x7f49e,null));};exports[_0x0baf('0x6b')]=function(_0x58a366,_0x4946d4){return db[_0x0baf('0x45')][_0x0baf('0x6b')]()[_0x0baf('0x26')](respondWithResult(_0x4946d4,null))[_0x0baf('0x30')](handleError(_0x4946d4,null));};exports[_0x0baf('0x6c')]=function(_0x27ddc7,_0x4c05d6,_0xec3b32){if(_0x27ddc7[_0x0baf('0x6a')]['id']){delete _0x27ddc7[_0x0baf('0x6a')]['id'];}return db[_0x0baf('0x45')][_0x0baf('0x61')]({'where':{'id':_0x27ddc7[_0x0baf('0x60')]['id']}})['then'](handleEntityNotFound(_0x4c05d6,null))[_0x0baf('0x26')](function(_0x468363){if(_0x468363){_0x27ddc7[_0x0baf('0x6a')]['FaxAccountId']=_0x468363['id'];return db[_0x0baf('0x6d')][_0x0baf('0x62')](_0x27ddc7[_0x0baf('0x6a')]);}})[_0x0baf('0x26')](respondWithResult(_0x4c05d6,null))[_0x0baf('0x30')](handleError(_0x4c05d6,null));};exports[_0x0baf('0x6e')]=function(_0x4cc046,_0x5874cc,_0x54353a){var _0x4b7caa={'raw':![],'where':{}};var _0x6ce83c={};var _0x89bec7={'count':0x0,'rows':[]};return db[_0x0baf('0x45')][_0x0baf('0x6f')]({'where':{'id':_0x4cc046[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x5874cc,null))['then'](function(_0x591ea6){if(_0x591ea6){_0x6ce83c[_0x0baf('0x4b')]=_['keys'](db[_0x0baf('0x6d')][_0x0baf('0x46')]);_0x6ce83c['query']=_[_0x0baf('0x47')](_0x4cc046[_0x0baf('0x48')]);_0x6ce83c[_0x0baf('0x49')]=_[_0x0baf('0x4a')](_0x6ce83c[_0x0baf('0x4b')],_0x6ce83c[_0x0baf('0x48')]);_0x4b7caa[_0x0baf('0x4c')]=_[_0x0baf('0x4a')](_0x6ce83c[_0x0baf('0x4b')],qs['fields'](_0x4cc046['query']['fields']));_0x4b7caa['attributes']=_0x4b7caa['attributes'][_0x0baf('0x4e')]?_0x4b7caa[_0x0baf('0x4c')]:_0x6ce83c[_0x0baf('0x4b')];if(!_0x4cc046[_0x0baf('0x48')]['hasOwnProperty'](_0x0baf('0x50'))){_0x4b7caa[_0x0baf('0x35')]=qs['limit'](_0x4cc046['query'][_0x0baf('0x35')]);_0x4b7caa[_0x0baf('0x34')]=qs[_0x0baf('0x34')](_0x4cc046[_0x0baf('0x48')][_0x0baf('0x34')]);}_0x4b7caa[_0x0baf('0x51')]=qs[_0x0baf('0x52')](_0x4cc046[_0x0baf('0x48')]['sort']);_0x4b7caa[_0x0baf('0x54')]=qs[_0x0baf('0x49')](_['pick'](_0x4cc046[_0x0baf('0x48')],_0x6ce83c[_0x0baf('0x49')]));_0x4b7caa['where'][_0x0baf('0x70')]=_0x591ea6['id'];if(_0x4cc046[_0x0baf('0x48')][_0x0baf('0x71')]){_0x4b7caa[_0x0baf('0x54')]=_[_0x0baf('0x55')](_0x4b7caa['where'],{'$or':_['map'](_0x4b7caa[_0x0baf('0x4c')],function(_0xc46563){var _0x5dcd9e={};_0x5dcd9e[_0xc46563]={'$like':'%'+_0x4cc046[_0x0baf('0x48')][_0x0baf('0x71')]+'%'};return _0x5dcd9e;})});}_0x4b7caa=_[_0x0baf('0x55')]({},_0x4b7caa,_0x4cc046['options']);return db[_0x0baf('0x6d')][_0x0baf('0x5b')]({'where':_0x4b7caa[_0x0baf('0x54')]})['then'](function(_0x3c2bc1){_0x89bec7['count']=_0x3c2bc1;if(_0x4cc046[_0x0baf('0x48')][_0x0baf('0x5c')]){_0x4b7caa[_0x0baf('0x5d')]=[{'all':!![]}];}return db[_0x0baf('0x6d')][_0x0baf('0x5e')](_0x4b7caa);})['then'](function(_0x866e6e){_0x89bec7[_0x0baf('0x5f')]=_0x866e6e;return _0x89bec7;});}})['then'](respondWithFilteredResult(_0x5874cc,_0x4b7caa))[_0x0baf('0x30')](handleError(_0x5874cc,null));};exports[_0x0baf('0x72')]=function(_0x8a92db,_0x379c54,_0x1cbbcc){return db[_0x0baf('0x45')][_0x0baf('0x61')]({'where':{'id':_0x8a92db[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x379c54,null))[_0x0baf('0x26')](function(_0x3b7abf){if(_0x3b7abf){return _0x3b7abf[_0x0baf('0x72')](_0x8a92db['query']['ids']);}})[_0x0baf('0x26')](respondWithStatusCode(_0x379c54,null))[_0x0baf('0x30')](handleError(_0x379c54,null));};exports[_0x0baf('0x73')]=function(_0x52f267,_0x507783,_0x3f9b17){if(_0x52f267[_0x0baf('0x6a')]['id']){delete _0x52f267[_0x0baf('0x6a')]['id'];}return db[_0x0baf('0x45')][_0x0baf('0x61')]({'where':{'id':_0x52f267[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x507783,null))[_0x0baf('0x26')](function(_0x381344){if(_0x381344){_0x52f267['body'][_0x0baf('0x70')]=_0x381344['id'];return db[_0x0baf('0x74')][_0x0baf('0x62')](_0x52f267[_0x0baf('0x6a')]);}})['then'](respondWithResult(_0x507783,null))['catch'](handleError(_0x507783,null));};exports['getAnswers']=function(_0x15fa4c,_0x3c4c1e,_0x4ae032){var _0x48f3df={'raw':![],'where':{}};var _0x3c9105={};var _0x16c5c3={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0baf('0x6f')]({'where':{'id':_0x15fa4c[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x3c4c1e,null))[_0x0baf('0x26')](function(_0x46c95f){if(_0x46c95f){_0x3c9105[_0x0baf('0x4b')]=_[_0x0baf('0x47')](db[_0x0baf('0x74')][_0x0baf('0x46')]);_0x3c9105[_0x0baf('0x48')]=_[_0x0baf('0x47')](_0x15fa4c[_0x0baf('0x48')]);_0x3c9105['filters']=_[_0x0baf('0x4a')](_0x3c9105[_0x0baf('0x4b')],_0x3c9105[_0x0baf('0x48')]);_0x48f3df[_0x0baf('0x4c')]=_[_0x0baf('0x4a')](_0x3c9105[_0x0baf('0x4b')],qs['fields'](_0x15fa4c[_0x0baf('0x48')][_0x0baf('0x4d')]));_0x48f3df[_0x0baf('0x4c')]=_0x48f3df[_0x0baf('0x4c')][_0x0baf('0x4e')]?_0x48f3df['attributes']:_0x3c9105[_0x0baf('0x4b')];if(!_0x15fa4c[_0x0baf('0x48')][_0x0baf('0x4f')](_0x0baf('0x50'))){_0x48f3df[_0x0baf('0x35')]=qs['limit'](_0x15fa4c['query'][_0x0baf('0x35')]);_0x48f3df['offset']=qs[_0x0baf('0x34')](_0x15fa4c['query'][_0x0baf('0x34')]);}_0x48f3df[_0x0baf('0x51')]=qs[_0x0baf('0x52')](_0x15fa4c[_0x0baf('0x48')]['sort']);_0x48f3df[_0x0baf('0x54')]=qs[_0x0baf('0x49')](_[_0x0baf('0x53')](_0x15fa4c['query'],_0x3c9105['filters']));_0x48f3df['where']['FaxAccountId']=_0x46c95f['id'];if(_0x15fa4c[_0x0baf('0x48')][_0x0baf('0x71')]){_0x48f3df[_0x0baf('0x54')]=_[_0x0baf('0x55')](_0x48f3df['where'],{'$or':_[_0x0baf('0x56')](_0x48f3df[_0x0baf('0x4c')],function(_0x1843eb){var _0x4b4ef8={};_0x4b4ef8[_0x1843eb]={'$like':'%'+_0x15fa4c[_0x0baf('0x48')][_0x0baf('0x71')]+'%'};return _0x4b4ef8;})});}_0x48f3df=_['merge']({},_0x48f3df,_0x15fa4c[_0x0baf('0x5a')]);return db['CannedAnswer'][_0x0baf('0x5b')]({'where':_0x48f3df[_0x0baf('0x54')]})[_0x0baf('0x26')](function(_0x38d380){_0x16c5c3['count']=_0x38d380;if(_0x15fa4c['query'][_0x0baf('0x5c')]){_0x48f3df['include']=[{'all':!![]}];}return db[_0x0baf('0x74')][_0x0baf('0x5e')](_0x48f3df);})[_0x0baf('0x26')](function(_0x2094e6){_0x16c5c3[_0x0baf('0x5f')]=_0x2094e6;return _0x16c5c3;});}})['then'](respondWithFilteredResult(_0x3c4c1e,_0x48f3df))[_0x0baf('0x30')](handleError(_0x3c4c1e,null));};exports['removeAnswers']=function(_0x457b84,_0x5e94c5,_0x25032f){return db['FaxAccount'][_0x0baf('0x61')]({'where':{'id':_0x457b84[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x5e94c5,null))['then'](function(_0x4bdba0){if(_0x4bdba0){return _0x4bdba0[_0x0baf('0x75')](_0x457b84[_0x0baf('0x48')][_0x0baf('0x76')]);}})[_0x0baf('0x26')](respondWithStatusCode(_0x5e94c5,null))[_0x0baf('0x30')](handleError(_0x5e94c5,null));};exports[_0x0baf('0x77')]=function(_0x4e6059,_0xd4170d,_0x5ee37f){return db[_0x0baf('0x78')]['find']({'where':{'id':_0x4e6059[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0xd4170d,null))[_0x0baf('0x26')](function(_0x557a38){if(_0x557a38){return _0x557a38[_0x0baf('0x77')](_0x4e6059[_0x0baf('0x6a')]['ids'],_['omit'](_0x4e6059[_0x0baf('0x6a')],[_0x0baf('0x76'),'id'])||{});}})[_0x0baf('0x26')](respondWithResult(_0xd4170d,null))[_0x0baf('0x30')](handleError(_0xd4170d,null));};exports['getInteractions']=function(_0x54a606,_0x3bd26b,_0x12fb16){var _0x116d52={'raw':![],'where':{}};var _0x2c7417={};var _0xfc91ce={'count':0x0,'rows':[]};return db[_0x0baf('0x45')][_0x0baf('0x6f')]({'where':{'id':_0x54a606[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x3bd26b,null))[_0x0baf('0x26')](function(_0x58f95c){if(_0x58f95c){_0x2c7417[_0x0baf('0x4b')]=_['keys'](db[_0x0baf('0x78')][_0x0baf('0x46')]);_0x2c7417[_0x0baf('0x48')]=_[_0x0baf('0x47')](_0x54a606['query']);_0x2c7417[_0x0baf('0x49')]=_[_0x0baf('0x4a')](_0x2c7417[_0x0baf('0x4b')],_0x2c7417[_0x0baf('0x48')]);_0x116d52[_0x0baf('0x4c')]=_[_0x0baf('0x4a')](_0x2c7417[_0x0baf('0x4b')],qs[_0x0baf('0x4d')](_0x54a606[_0x0baf('0x48')]['fields']));_0x116d52[_0x0baf('0x4c')]=_0x116d52[_0x0baf('0x4c')]['length']?_0x116d52[_0x0baf('0x4c')]:_0x2c7417[_0x0baf('0x4b')];if(!_0x54a606[_0x0baf('0x48')][_0x0baf('0x4f')](_0x0baf('0x50'))){_0x116d52[_0x0baf('0x35')]=qs[_0x0baf('0x35')](_0x54a606[_0x0baf('0x48')][_0x0baf('0x35')]);_0x116d52['offset']=qs[_0x0baf('0x34')](_0x54a606[_0x0baf('0x48')][_0x0baf('0x34')]);}_0x116d52[_0x0baf('0x51')]=qs[_0x0baf('0x52')](_0x54a606[_0x0baf('0x48')]['sort']);_0x116d52[_0x0baf('0x54')]=qs[_0x0baf('0x49')](_[_0x0baf('0x53')](_0x54a606['query'],_0x2c7417['filters']));_0x116d52[_0x0baf('0x54')][_0x0baf('0x70')]=_0x58f95c['id'];if(_0x54a606[_0x0baf('0x48')]['filter']){_0x116d52[_0x0baf('0x54')]=_['merge'](_0x116d52[_0x0baf('0x54')],{'$or':_['map'](_0x116d52[_0x0baf('0x4c')],function(_0x3f2838){var _0x4da454={};_0x4da454[_0x3f2838]={'$like':'%'+_0x54a606[_0x0baf('0x48')][_0x0baf('0x71')]+'%'};return _0x4da454;})});}_0x116d52=_[_0x0baf('0x55')]({},_0x116d52,_0x54a606[_0x0baf('0x5a')]);return db[_0x0baf('0x78')][_0x0baf('0x5b')]({'where':_0x116d52[_0x0baf('0x54')]})['then'](function(_0x727cad){_0xfc91ce[_0x0baf('0x5b')]=_0x727cad;if(_0x54a606[_0x0baf('0x48')][_0x0baf('0x5c')]){_0x116d52[_0x0baf('0x5d')]=[{'model':db[_0x0baf('0x79')],'as':_0x0baf('0x7a'),'required':![]},{'model':db[_0x0baf('0x7b')],'as':_0x0baf('0x7c'),'attributes':[_0x0baf('0x40'),_0x0baf('0x7d'),_0x0baf('0x7e')],'required':![]},{'model':db[_0x0baf('0x7f')],'as':_0x0baf('0x80'),'attributes':['id','name','color'],'where':_0x54a606[_0x0baf('0x48')][_0x0baf('0x81')]?{'id':_0x54a606[_0x0baf('0x48')][_0x0baf('0x81')]}:undefined,'required':_0x54a606['query'][_0x0baf('0x81')]?!![]:![]}];}return db[_0x0baf('0x78')][_0x0baf('0x5e')](_0x116d52);})[_0x0baf('0x26')](function(_0x45a1c4){_0xfc91ce[_0x0baf('0x5f')]=_0x45a1c4;return _0xfc91ce;});}})['then'](respondWithFilteredResult(_0x3bd26b,_0x116d52))[_0x0baf('0x30')](handleError(_0x3bd26b,null));};exports[_0x0baf('0x82')]=function(_0x347c39,_0x578ed9,_0x32bf6d){return db[_0x0baf('0x45')][_0x0baf('0x6f')]({'where':{'id':_0x347c39['params']['id']}})['then'](handleEntityNotFound(_0x578ed9,null))['then'](function(_0x11a85a){if(_0x11a85a){return db['sequelize'][_0x0baf('0x83')](function(_0x29b824){return db['FaxApplication'][_0x0baf('0x3c')]({'where':{'FaxAccountId':_0x347c39['params']['id']},'transaction':_0x29b824})['then'](function(_0x21516f){var _0x5a42fa=_[_0x0baf('0x56')](_0x347c39['body'],function(_0x4b4ba6){_0x4b4ba6['FaxAccountId']=_0x347c39[_0x0baf('0x60')]['id'];return _0x4b4ba6;});return db[_0x0baf('0x84')][_0x0baf('0x85')](_0x5a42fa,{'transaction':_0x29b824});});})[_0x0baf('0x26')](function(){return db[_0x0baf('0x84')][_0x0baf('0x86')]({'where':{'FaxAccountId':_0x347c39[_0x0baf('0x60')]['id']},'order':'priority'});});}})[_0x0baf('0x26')](respondWithResult(_0x578ed9,null))[_0x0baf('0x30')](handleError(_0x578ed9,null));};exports[_0x0baf('0x87')]=function(_0x5cf14d,_0x24672f,_0x1e78d6){var _0x12311d={};var _0x52c7f7={};var _0x25eccd;var _0x5693d8;return db[_0x0baf('0x45')][_0x0baf('0x6f')]({'where':{'id':_0x5cf14d['params']['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x24672f,null))[_0x0baf('0x26')](function(_0x298ec8){if(_0x298ec8){_0x25eccd=_0x298ec8;_0x52c7f7[_0x0baf('0x4b')]=_['keys'](db[_0x0baf('0x84')][_0x0baf('0x46')]);_0x52c7f7['query']=_['keys'](_0x5cf14d[_0x0baf('0x48')]);_0x52c7f7[_0x0baf('0x49')]=_[_0x0baf('0x4a')](_0x52c7f7[_0x0baf('0x4b')],_0x52c7f7['query']);_0x12311d['attributes']=_[_0x0baf('0x4a')](_0x52c7f7[_0x0baf('0x4b')],qs[_0x0baf('0x4d')](_0x5cf14d[_0x0baf('0x48')][_0x0baf('0x4d')]));_0x12311d['attributes']=_0x12311d[_0x0baf('0x4c')][_0x0baf('0x4e')]?_0x12311d['attributes']:_0x52c7f7[_0x0baf('0x4b')];_0x12311d[_0x0baf('0x51')]=qs['sort'](_0x5cf14d[_0x0baf('0x48')][_0x0baf('0x52')]);_0x12311d[_0x0baf('0x54')]=qs[_0x0baf('0x49')](_[_0x0baf('0x53')](_0x5cf14d[_0x0baf('0x48')],_0x52c7f7[_0x0baf('0x49')]));if(_0x5cf14d[_0x0baf('0x48')]['filter']){_0x12311d[_0x0baf('0x54')]=_[_0x0baf('0x55')](_0x12311d[_0x0baf('0x54')],{'$or':_[_0x0baf('0x56')](_0x12311d['attributes'],function(_0x40bd76){var _0x108909={};_0x108909[_0x40bd76]={'$like':'%'+_0x5cf14d['query'][_0x0baf('0x71')]+'%'};return _0x108909;})});}_0x12311d=_[_0x0baf('0x55')]({},_0x12311d,_0x5cf14d[_0x0baf('0x5a')]);return _0x25eccd[_0x0baf('0x87')](_0x12311d);}})['then'](function(_0x3ca1a6){if(_0x3ca1a6){_0x5693d8=_0x3ca1a6[_0x0baf('0x4e')];if(!_0x5cf14d[_0x0baf('0x48')][_0x0baf('0x4f')](_0x0baf('0x50'))){_0x12311d['limit']=qs[_0x0baf('0x35')](_0x5cf14d[_0x0baf('0x48')][_0x0baf('0x35')]);_0x12311d['offset']=qs[_0x0baf('0x34')](_0x5cf14d[_0x0baf('0x48')][_0x0baf('0x34')]);}return _0x25eccd[_0x0baf('0x87')](_0x12311d);}})[_0x0baf('0x26')](function(_0x5d6253){if(_0x5d6253){return _0x5d6253?{'count':_0x5693d8,'rows':_0x5d6253}:null;}})['then'](respondWithResult(_0x24672f,null))[_0x0baf('0x30')](handleError(_0x24672f,null));};function Extension(_0x315ada,_0x3e90bc,_0x4dd433,_0x1d5eef){this[_0x0baf('0x88')]=_0x0baf('0x89');this[_0x0baf('0x8a')]=_0x315ada[_0x0baf('0x8b')];this[_0x0baf('0x8c')]=_0x1d5eef;this[_0x0baf('0x57')]=_0x0baf('0x8d');this[_0x0baf('0x8e')]=_0x0baf('0x8f');this['FaxAccountId']=_0x315ada['id'];this[_0x0baf('0x90')]=_0x3e90bc;this[_0x0baf('0x91')]=_0x4dd433;}function createExtensionsReciveFax(_0xe71ab6){var _0x3a63a5=0x1;var _0x5b119e=[];_0x5b119e[_0x0baf('0x92')](new Extension(_0xe71ab6,_0x3a63a5,'',_0x0baf('0x93')));_0x3a63a5+=0x1;_0x5b119e[_0x0baf('0x92')](new Extension(_0xe71ab6,_0x3a63a5,'CDR(type)=inbound-fax',_0x0baf('0x94')));_0x3a63a5+=0x1;for(var _0x2be868 in _0xe71ab6){if(_0xe71ab6[_0x0baf('0x4f')](_0x2be868)&&(_0x2be868===_0x0baf('0x95')||_0x2be868===_0x0baf('0x8b')||_0x2be868==='gateway'||_0x2be868===_0x0baf('0x96')||_0x2be868===_0x0baf('0x97')||_0x2be868==='maxrate'||_0x2be868==='minrate'||_0x2be868===_0x0baf('0x98')||_0x2be868===_0x0baf('0x99'))){_0x5b119e[_0x0baf('0x92')](new Extension(_0xe71ab6,_0x3a63a5,_0x0baf('0x9a')+_0x2be868+')='+_0xe71ab6[_0x2be868],_0x0baf('0x94')));_0x3a63a5+=0x1;}}_0x5b119e[_0x0baf('0x92')](new Extension(_0xe71ab6,_0x3a63a5,'6',_0x0baf('0x9b')));_0x3a63a5+=0x1;_0x5b119e['push'](new Extension(_0xe71ab6,_0x3a63a5,'/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',_0x0baf('0x9c')));_0x3a63a5=0x0;return _0x5b119e;}exports[_0x0baf('0x9d')]=function(_0xb7ef9d,_0x47de3f,_0x3425a8){var _0x3a6bf8;return db['sequelize'][_0x0baf('0x83')](function(_0x405236){return db['FaxAccount'][_0x0baf('0x62')](_0xb7ef9d[_0x0baf('0x6a')],{'transaction':_0x405236})[_0x0baf('0x26')](function(_0x4d6ac4){_0x3a6bf8=_0x4d6ac4[_0x0baf('0x3d')]({'plain':!![]});return db[_0x0baf('0x9e')][_0x0baf('0x85')](createExtensionsReciveFax(_0x3a6bf8),{'transaction':_0x405236});});})[_0x0baf('0x26')](function(){return _0x3a6bf8;})[_0x0baf('0x26')](respondWithResult(_0x47de3f,null))[_0x0baf('0x30')](handleError(_0x47de3f,null));};exports[_0x0baf('0x9f')]=function(_0x55bdcf,_0xdcae7b,_0x5d9885){var _0x399fbe;return db[_0x0baf('0xa0')]['transaction'](function(_0x54f723){return db[_0x0baf('0x45')][_0x0baf('0xa1')](_0x55bdcf[_0x0baf('0x6a')],{'where':{'id':_0x55bdcf['body']['id']},'transaction':_0x54f723})[_0x0baf('0x26')](function(_0x208b9f){return db[_0x0baf('0x9e')][_0x0baf('0x3c')]({'where':{'FaxAccountId':_0x55bdcf[_0x0baf('0x6a')]['id']},'transaction':_0x54f723})[_0x0baf('0x26')](function(_0x2f72ed){return db[_0x0baf('0x9e')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x55bdcf[_0x0baf('0x6a')],[_0x0baf('0xa2'),'key',_0x0baf('0xa3'),_0x0baf('0xa4'),_0x0baf('0xa5'),_0x0baf('0xa6')])),{'transaction':_0x54f723});});});})[_0x0baf('0x26')](function(){return db[_0x0baf('0x45')][_0x0baf('0xa7')](_0x55bdcf['body']['id']);})[_0x0baf('0x26')](respondWithResult(_0xdcae7b,null))['catch'](handleError(_0xdcae7b,null));};exports[_0x0baf('0xa8')]=function(_0x32abf2,_0x53a54f,_0x483c5d){var _0x1b9f0d={'raw':!![],'where':{}};var _0x8ff162={};var _0xde8797={'count':0x0,'rows':[]};return db[_0x0baf('0x45')][_0x0baf('0x6f')]({'where':{'id':_0x32abf2[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x53a54f,null))['then'](function(_0x5374eb){if(_0x5374eb){_0x8ff162['model']=_[_0x0baf('0x47')](db['FaxMessage'][_0x0baf('0x46')]);_0x8ff162[_0x0baf('0x48')]=_['keys'](_0x32abf2['query']);_0x8ff162[_0x0baf('0x49')]=_[_0x0baf('0x4a')](_0x8ff162[_0x0baf('0x4b')],_0x8ff162[_0x0baf('0x48')]);_0x1b9f0d[_0x0baf('0x4c')]=_['intersection'](_0x8ff162[_0x0baf('0x4b')],qs[_0x0baf('0x4d')](_0x32abf2[_0x0baf('0x48')][_0x0baf('0x4d')]));_0x1b9f0d[_0x0baf('0x4c')]=_0x1b9f0d[_0x0baf('0x4c')]['length']?_0x1b9f0d[_0x0baf('0x4c')]:_0x8ff162[_0x0baf('0x4b')];if(!_0x32abf2[_0x0baf('0x48')]['hasOwnProperty'](_0x0baf('0x50'))){_0x1b9f0d[_0x0baf('0x35')]=qs['limit'](_0x32abf2[_0x0baf('0x48')][_0x0baf('0x35')]);_0x1b9f0d[_0x0baf('0x34')]=qs[_0x0baf('0x34')](_0x32abf2['query']['offset']);}_0x1b9f0d[_0x0baf('0x51')]=qs[_0x0baf('0x52')](_0x32abf2['query'][_0x0baf('0x52')]);_0x1b9f0d[_0x0baf('0x54')]=qs[_0x0baf('0x49')](_[_0x0baf('0x53')](_0x32abf2[_0x0baf('0x48')],_0x8ff162['filters']));_0x1b9f0d[_0x0baf('0x54')][_0x0baf('0x70')]=_0x5374eb['id'];if(_0x32abf2[_0x0baf('0x48')][_0x0baf('0x71')]){_0x1b9f0d['where']=_[_0x0baf('0x55')](_0x1b9f0d['where'],{'$or':_[_0x0baf('0x56')](_0x1b9f0d[_0x0baf('0x4c')],function(_0x21dea5){var _0x4f0772={};_0x4f0772[_0x21dea5]={'$like':'%'+_0x32abf2[_0x0baf('0x48')][_0x0baf('0x71')]+'%'};return _0x4f0772;})});}if(_0x32abf2[_0x0baf('0x48')][_0x0baf('0xa9')]){var _0x1a922d=_0x32abf2[_0x0baf('0x48')][_0x0baf('0xa9')][_0x0baf('0xaa')](',');var _0x33965e={};_0x33965e[_0x1a922d[0x0]]={'$gte':moment(_0x1a922d[0x1])[_0x0baf('0xab')](_0x0baf('0xac'))};_0x1b9f0d[_0x0baf('0x54')]=_['merge'](_0x1b9f0d['where'],_0x33965e);}_0x1b9f0d=_[_0x0baf('0x55')]({},_0x1b9f0d,_0x32abf2['options']);return db['FaxMessage']['count']({'where':_0x1b9f0d['where']})[_0x0baf('0x26')](function(_0x45b083){_0xde8797['count']=_0x45b083;if(_0x32abf2['query']['includeAll']){_0x1b9f0d['include']=[{'all':!![]}];}return db[_0x0baf('0xad')]['findAll'](_0x1b9f0d);})[_0x0baf('0x26')](function(_0xdec2c5){_0xde8797[_0x0baf('0x5f')]=_0xdec2c5;return _0xde8797;});}})[_0x0baf('0x26')](respondWithFilteredResult(_0x53a54f,_0x1b9f0d))[_0x0baf('0x30')](handleError(_0x53a54f,null));};exports[_0x0baf('0x41')]=function(_0x3d0b21,_0xd30f94,_0x588e61){var _0x54c3c0,_0x2d7ec3={},_0x2a4d79;if(_0x3d0b21['body']['to']){_0x2a4d79=_0x3d0b21[_0x0baf('0x6a')]['to'][0x0];}return db['FaxAccount'][_0x0baf('0x61')]({'where':{'id':_0x3d0b21['params']['id']},'include':[{'model':db['CmList'],'as':_0x0baf('0xae'),'include':[{'model':db[_0x0baf('0x79')],'as':_0x0baf('0xaf'),'where':{'fax':_0x2a4d79},'limit':0x1,'order':[[_0x0baf('0xa4'),_0x0baf('0xb0')]]}]}]})[_0x0baf('0x26')](handleEntityNotFound(_0xd30f94,null))[_0x0baf('0x26')](function(_0x29568a){_0x54c3c0=_0x29568a;if(_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')]&&_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')][_0x0baf('0x4e')]){for(var _0x738da0=0x0;_0x738da0<_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')]['length'];_0x738da0+=0x1){_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')][_0x738da0]={'filename':_0x3d0b21['body'][_0x0baf('0xb1')][_0x738da0][_0x0baf('0x40')],'id':_0x3d0b21['body'][_0x0baf('0xb1')][_0x738da0]['id'],'path':path['join'](config[_0x0baf('0xb2')],'server/files/attachments',_0x3d0b21[_0x0baf('0x6a')]['attachments'][_0x738da0][_0x0baf('0xb3')])};}}return respondWithRpcPromise(_0x0baf('0xb4'),_0x0baf('0xb4'),{'FaxAccountId':_[_0x0baf('0xb5')](_0x3d0b21['params']['id'])?undefined:_0x3d0b21[_0x0baf('0x60')]['id'],'path':_[_0x0baf('0xb5')](_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')][0x0]['path'])?undefined:_0x3d0b21['body'][_0x0baf('0xb1')][0x0][_0x0baf('0x8')],'fax':_[_0x0baf('0xb5')](_0x3d0b21[_0x0baf('0x6a')]['to'][0x0])?undefined:_0x3d0b21['body']['to'][0x0]},client9002);})[_0x0baf('0x26')](function(){if(_0x54c3c0){if(_[_0x0baf('0xb5')](_0x3d0b21[_0x0baf('0x6a')]['from'])){_0x3d0b21['body'][_0x0baf('0xb6')]=util['format'](_0x0baf('0xb7'),_0x54c3c0['name'],_0x54c3c0[_0x0baf('0xb8')]);}if(_0x54c3c0[_0x0baf('0xae')]){if(_0x54c3c0[_0x0baf('0xae')]['Contacts'][_0x0baf('0x4e')]){return _0x54c3c0[_0x0baf('0xae')]['Contacts'][0x0];}else{return db['CmContact'][_0x0baf('0x62')](_['defaults'](_0x3d0b21[_0x0baf('0x6a')],{'firstName':_0x3d0b21[_0x0baf('0x6a')]['to'][0x0],'phone':_0x3d0b21['body']['to'][0x0],'fax':_0x3d0b21['body']['to'][0x0],'ListId':_0x54c3c0[_0x0baf('0xa6')]}));}}else{throw new Error(_0x0baf('0xb9'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x0baf('0x26')](function(_0x5994a0){if(_0x5994a0){return db[_0x0baf('0x78')][_0x0baf('0x61')]({'where':{'ContactId':_0x5994a0['id'],'closed':![],'FaxAccountId':_0x54c3c0['id']}})['then'](function(_0x1bb013){if(_0x1bb013){return[_0x1bb013,![]];}return db[_0x0baf('0x78')][_0x0baf('0x62')]({'UserId':_0x3d0b21[_0x0baf('0x63')]['id'],'ContactId':_0x5994a0['id'],'FaxAccountId':_0x54c3c0['id'],'fax':_0x3d0b21[_0x0baf('0x6a')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x0baf('0x55')](_0x3d0b21['body'],{'read':![],'body':_0x3d0b21['body']['attachments'][0x0][_0x0baf('0xba')],'FaxAccountId':_0x54c3c0['id'],'UserId':_0x3d0b21[_0x0baf('0x63')]['id'],'ContactId':_0x5994a0['id'],'AttachmentId':_0x3d0b21['body'][_0x0baf('0xb1')][0x0]['id']})]},{'include':[{'model':db[_0x0baf('0xad')],'as':'Messages'}]})[_0x0baf('0x26')](function(_0x25d1e7){return[_0x25d1e7,!![]];});});}else{throw new Error(_0x0baf('0xbb'));}})[_0x0baf('0xbc')](function(_0x4332df,_0xd05de8){if(_0xd05de8){return _0x4332df;}return db[_0x0baf('0xad')][_0x0baf('0x62')]({'direction':_0x0baf('0xbd'),'read':![],'body':_0x3d0b21[_0x0baf('0x6a')]['attachments'][0x0][_0x0baf('0xba')],'FaxAccountId':_0x54c3c0['id'],'FaxInteractionId':_0x4332df['id'],'UserId':_0x3d0b21[_0x0baf('0x63')]['id'],'ContactId':_0x4332df[_0x0baf('0xbe')],'AttachmentId':_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')][0x0]['id']})['then'](function(_0x3a0a2f){_0x4332df['dataValues'][_0x0baf('0xbf')]=[];_0x4332df[_0x0baf('0xc0')][_0x0baf('0xbf')][_0x0baf('0x92')](_0x3a0a2f[_0x0baf('0xc0')]);return _0x4332df;});})[_0x0baf('0x26')](function(_0x467a89){respondWithRpcPromise('SendFax',_0x0baf('0xc1'),{'FaxAccountId':_[_0x0baf('0xb5')](_0x3d0b21[_0x0baf('0x60')]['id'])?undefined:_0x3d0b21[_0x0baf('0x60')]['id'],'path':_[_0x0baf('0xb5')](_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')][0x0][_0x0baf('0x8')])?undefined:_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')][0x0][_0x0baf('0x8')],'fax':_[_0x0baf('0xb5')](_0x3d0b21[_0x0baf('0x6a')]['to'][0x0])?undefined:_0x3d0b21[_0x0baf('0x6a')]['to'][0x0],'AttachmentId':_0x3d0b21[_0x0baf('0x6a')][_0x0baf('0xb1')][0x0]['id']},client9002)[_0x0baf('0x26')](function(_0x61ffaf){logger['info'](_0x0baf('0xc2'),_0x61ffaf);})[_0x0baf('0x30')](function(_0x2ee248){logger[_0x0baf('0x2f')](_0x0baf('0xc2'),_0x2ee248);});return _0x467a89;})[_0x0baf('0x26')](respondWithResult(_0xd30f94,null))[_0x0baf('0x30')](handleError(_0xd30f94,null));};exports['addAgents']=function(_0xa7a73a,_0xf9b6cc,_0x12308c){return db[_0x0baf('0x45')][_0x0baf('0x61')]({'where':{'id':_0xa7a73a[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0xf9b6cc,null))['then'](function(_0x467d4a){if(_0x467d4a){return _0x467d4a[_0x0baf('0xc3')](_0xa7a73a[_0x0baf('0x6a')][_0x0baf('0x76')],_[_0x0baf('0xc4')](_0xa7a73a[_0x0baf('0x6a')],['ids','id'])||{})[_0x0baf('0xbc')](function(_0x378bd4){for(var _0xc89ff4=0x0;_0xc89ff4<_0xa7a73a[_0x0baf('0x6a')][_0x0baf('0x76')]['length'];_0xc89ff4+=0x1){socket['emit'](_0x0baf('0xc5'),{'UserId':_0xa7a73a[_0x0baf('0x6a')][_0x0baf('0x76')][_0xc89ff4],'FaxAccountId':_0xa7a73a[_0x0baf('0x60')]['id']});}return _0x378bd4;});}})[_0x0baf('0x26')](respondWithResult(_0xf9b6cc,null))[_0x0baf('0x30')](handleError(_0xf9b6cc,null));};exports[_0x0baf('0xc6')]=function(_0x430eb4,_0x1f6ec8,_0x9ebb37){return db[_0x0baf('0x45')][_0x0baf('0x61')]({'where':{'id':_0x430eb4[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x1f6ec8,null))[_0x0baf('0x26')](function(_0x20b173){if(_0x20b173){return _0x20b173[_0x0baf('0xc6')](_0x430eb4[_0x0baf('0x48')][_0x0baf('0x76')])[_0x0baf('0x26')](function(){if(_[_0x0baf('0xc7')](_0x430eb4[_0x0baf('0x48')][_0x0baf('0x76')])){for(var _0x249f32=0x0;_0x249f32<_0x430eb4[_0x0baf('0x48')][_0x0baf('0x76')][_0x0baf('0x4e')];_0x249f32+=0x1){socket['emit'](_0x0baf('0xc8'),{'UserId':Number(_0x430eb4[_0x0baf('0x48')][_0x0baf('0x76')][_0x249f32]),'FaxAccountId':Number(_0x430eb4[_0x0baf('0x60')]['id'])});}}else{socket[_0x0baf('0xc9')]('userFaxAccount:remove',{'UserId':Number(_0x430eb4[_0x0baf('0x48')][_0x0baf('0x76')]),'FaxAccountId':Number(_0x430eb4[_0x0baf('0x60')]['id'])});}});}})[_0x0baf('0x26')](respondWithStatusCode(_0x1f6ec8,null))[_0x0baf('0x30')](handleError(_0x1f6ec8,null));};exports[_0x0baf('0xca')]=function(_0x3358f5,_0x237a20,_0x26dd4c){var _0x45e4b0={};var _0xe840f2={};var _0x12726d;var _0xb36bcc;return db[_0x0baf('0x45')][_0x0baf('0x6f')]({'where':{'id':_0x3358f5[_0x0baf('0x60')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x237a20,null))[_0x0baf('0x26')](function(_0x4d9bfb){if(_0x4d9bfb){_0x12726d=_0x4d9bfb;_0xe840f2[_0x0baf('0x4b')]=_['keys'](db['User'][_0x0baf('0x46')]);_0xe840f2[_0x0baf('0x48')]=_[_0x0baf('0x47')](_0x3358f5['query']);_0xe840f2[_0x0baf('0x49')]=_[_0x0baf('0x4a')](_0xe840f2[_0x0baf('0x4b')],_0xe840f2[_0x0baf('0x48')]);_0x45e4b0[_0x0baf('0x4c')]=_[_0x0baf('0x4a')](_0xe840f2['model'],qs[_0x0baf('0x4d')](_0x3358f5[_0x0baf('0x48')][_0x0baf('0x4d')]));_0x45e4b0[_0x0baf('0x4c')]=_0x45e4b0[_0x0baf('0x4c')][_0x0baf('0x4e')]?_0x45e4b0['attributes']:_0xe840f2[_0x0baf('0x4b')];_0x45e4b0['order']=qs[_0x0baf('0x52')](_0x3358f5[_0x0baf('0x48')]['sort']);_0x45e4b0['where']=qs[_0x0baf('0x49')](_[_0x0baf('0x53')](_0x3358f5[_0x0baf('0x48')],_0xe840f2['filters']));if(_0x3358f5[_0x0baf('0x48')][_0x0baf('0x71')]){_0x45e4b0['where']=_[_0x0baf('0x55')](_0x45e4b0[_0x0baf('0x54')],{'$or':_[_0x0baf('0x56')](_0x45e4b0[_0x0baf('0x4c')],function(_0x3fa8eb){var _0x2759bb={};_0x2759bb[_0x3fa8eb]={'$like':'%'+_0x3358f5[_0x0baf('0x48')]['filter']+'%'};return _0x2759bb;})});}_0x45e4b0=_['merge']({},_0x45e4b0,_0x3358f5[_0x0baf('0x5a')]);return _0x12726d[_0x0baf('0xca')](_0x45e4b0);}})[_0x0baf('0x26')](function(_0x20ac9e){if(_0x20ac9e){_0xb36bcc=_0x20ac9e[_0x0baf('0x4e')];if(!_0x3358f5[_0x0baf('0x48')][_0x0baf('0x4f')](_0x0baf('0x50'))){_0x45e4b0[_0x0baf('0x35')]=qs[_0x0baf('0x35')](_0x3358f5['query']['limit']);_0x45e4b0[_0x0baf('0x34')]=qs[_0x0baf('0x34')](_0x3358f5[_0x0baf('0x48')]['offset']);}return _0x12726d['getAgents'](_0x45e4b0);}})[_0x0baf('0x26')](function(_0x2cb735){if(_0x2cb735){return _0x2cb735?{'count':_0xb36bcc,'rows':_0x2cb735}:null;}})[_0x0baf('0x26')](respondWithResult(_0x237a20,null))[_0x0baf('0x30')](handleError(_0x237a20,null));}; \ No newline at end of file +var _0x14a0=['status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','key','VIRTUAL','filter','options','includeAll','include','findAll','show','Pause','length','find','create','role','user','FaxAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','pick','map','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','findOne','CmContact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','exten','localstationid','type','system','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','modem','t38timeout','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','tech','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','CmList','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','List','Send\x20Fax\x20failed','out','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','sendStatus'];(function(_0xcc5c30,_0x25d9d4){var _0x35743b=function(_0x4e1000){while(--_0x4e1000){_0xcc5c30['push'](_0xcc5c30['shift']());}};_0x35743b(++_0x25d9d4);}(_0x14a0,0x8e));var _0x014a=function(_0x2ad0e7,_0xe9000d){_0x2ad0e7=_0x2ad0e7-0x0;var _0x398e95=_0x14a0[_0x2ad0e7];return _0x398e95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x014a('0x0'));var rimraf=require(_0x014a('0x1'));var zipdir=require(_0x014a('0x2'));var jsonpatch=require(_0x014a('0x3'));var rp=require(_0x014a('0x4'));var moment=require(_0x014a('0x5'));var BPromise=require(_0x014a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x014a('0x7'));var sox=require(_0x014a('0x8'));var csv=require(_0x014a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x014a('0xe'));var logger=require('../../config/logger')(_0x014a('0xf'));var utils=require(_0x014a('0x10'));var config=require('../../config/environment');var db=require(_0x014a('0x11'))['db'];config[_0x014a('0x12')]=_[_0x014a('0x13')](config[_0x014a('0x12')],{'host':_0x014a('0x14'),'port':0x18eb});var socket=require(_0x014a('0x15'))(new Redis(config[_0x014a('0x12')]));require(_0x014a('0x16'))[_0x014a('0x17')](socket);var jayson=require(_0x014a('0x18'));var client=jayson[_0x014a('0x19')][_0x014a('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x014a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3cf92f,_0x59f207,_0x3a836f){if(_0x3a836f){var _0x128c46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x128c46['test'](_0x59f207)){return _0x3cf92f;}else{throw new db[(_0x014a('0x1b'))][(_0x014a('0x1c'))](_0x014a('0x1d'));}}else{return _0x3cf92f;}}function respondWithRpcPromise(_0x12da95,_0x2c26ac,_0x12d339,_0x61ec9f){return new BPromise(function(_0x263b07,_0x16490a){var _0x3b9341=_0x61ec9f||client;return _0x3b9341[_0x014a('0x1e')](_0x12da95,_0x12d339)[_0x014a('0x1f')](function(_0x2a41f2){logger[_0x014a('0x20')]('FaxAccount,\x20%s,\x20%s',_0x2c26ac,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x2c26ac,_0x014a('0x21'),JSON[_0x014a('0x24')](_0x2a41f2));if(_0x2a41f2[_0x014a('0x25')]){if(_0x2a41f2[_0x014a('0x25')][_0x014a('0x26')]===0x1f4){logger[_0x014a('0x25')]('FaxAccount,\x20%s,\x20%s',_0x2c26ac,_0x2a41f2[_0x014a('0x25')]['message']);return _0x16490a(_0x2a41f2[_0x014a('0x25')][_0x014a('0x27')]);}logger[_0x014a('0x25')](_0x014a('0x28'),_0x2c26ac,_0x2a41f2[_0x014a('0x25')][_0x014a('0x27')]);return _0x263b07(_0x2a41f2[_0x014a('0x25')][_0x014a('0x27')]);}else{logger[_0x014a('0x20')]('FaxAccount,\x20%s,\x20%s',_0x2c26ac,_0x014a('0x21'));_0x263b07(_0x2a41f2['result'][_0x014a('0x27')]);}})[_0x014a('0x29')](function(_0x4f1c44){logger['error'](_0x014a('0x28'),_0x2c26ac,_0x4f1c44);_0x16490a(_0x4f1c44);});});}function respondWithStatusCode(_0x3f9719,_0x143346){_0x143346=_0x143346||0xcc;return function(_0x5ed71b){if(_0x5ed71b){return _0x3f9719[_0x014a('0x2a')](_0x143346);}return _0x3f9719[_0x014a('0x2b')](_0x143346)['end']();};}function respondWithResult(_0x31dc95,_0x2560a6){_0x2560a6=_0x2560a6||0xc8;return function(_0x496040){if(_0x496040){return _0x31dc95['status'](_0x2560a6)[_0x014a('0x2c')](_0x496040);}};}function respondWithFilteredResult(_0x3e5a0a,_0xe70dfa){return function(_0x29fce5){if(_0x29fce5){var _0x4ea00c=_0x29fce5[_0x014a('0x2d')],_0x434038=_0xe70dfa[_0x014a('0x2e')],_0x147e7e=_0xe70dfa[_0x014a('0x2e')]+_0xe70dfa[_0x014a('0x2f')],_0x15af07;if(_0x147e7e>=_0x4ea00c){_0x147e7e=_0x4ea00c;_0x15af07=0xc8;}else{_0x15af07=0xce;}_0x3e5a0a[_0x014a('0x2b')](_0x15af07);return _0x3e5a0a[_0x014a('0x30')](_0x014a('0x31'),_0x434038+'-'+_0x147e7e+'/'+_0x4ea00c)[_0x014a('0x2c')](_0x29fce5);}return null;};}function patchUpdates(_0x4ed54e){return function(_0x105d4a){try{jsonpatch[_0x014a('0x32')](_0x105d4a,_0x4ed54e,!![]);}catch(_0x1f7a3b){return BPromise[_0x014a('0x33')](_0x1f7a3b);}return _0x105d4a[_0x014a('0x34')]();};}function saveUpdates(_0x39b3b8,_0x211d18){return function(_0x4dd025){if(_0x4dd025){return _0x4dd025[_0x014a('0x35')](_0x39b3b8)[_0x014a('0x1f')](function(_0x5610cb){return _0x5610cb;});}return null;};}function removeEntity(_0x415f83,_0x12de94){return function(_0x40738f){if(_0x40738f){return _0x40738f[_0x014a('0x36')]()[_0x014a('0x1f')](function(){var _0xa8fcfb=_0x40738f[_0x014a('0x37')]({'plain':!![]});var _0x1cff0f='FaxAccounts';return db[_0x014a('0x38')][_0x014a('0x36')]({'where':{'type':_0x1cff0f,'resourceId':_0xa8fcfb['id']}})[_0x014a('0x1f')](function(){return _0x40738f;});})[_0x014a('0x1f')](function(){_0x415f83['status'](0xcc)[_0x014a('0x39')]();});}};}function handleEntityNotFound(_0x978870,_0x27ee0c){return function(_0x157bd0){if(!_0x157bd0){_0x978870[_0x014a('0x2a')](0x194);}return _0x157bd0;};}function handleError(_0x309925,_0x128fb9){_0x128fb9=_0x128fb9||0x1f4;return function(_0x36187b){logger[_0x014a('0x25')](_0x36187b['stack']);if(_0x36187b[_0x014a('0x3a')]){delete _0x36187b['name'];}_0x309925[_0x014a('0x2b')](_0x128fb9)[_0x014a('0x3b')](_0x36187b);};}exports[_0x014a('0x3c')]=function(_0x1398bb,_0x43376c){var _0x55126d={'include':[{'model':db['Pause'],'as':_0x014a('0x3d')}]},_0x1c6f6f={},_0x3f4a61={'count':0x0,'rows':[]};var _0x2990df=db[_0x014a('0x3e')][_0x014a('0x3f')];_0x1c6f6f[_0x014a('0x40')]=_[_0x014a('0x41')](_0x2990df);_0x1c6f6f[_0x014a('0x42')]=_[_0x014a('0x41')](_0x1398bb[_0x014a('0x42')]);_0x1c6f6f['filters']=_[_0x014a('0x43')](_0x1c6f6f[_0x014a('0x40')],_0x1c6f6f[_0x014a('0x42')]);_0x55126d[_0x014a('0x44')]=_['intersection'](_0x1c6f6f[_0x014a('0x40')],qs[_0x014a('0x45')](_0x1398bb[_0x014a('0x42')][_0x014a('0x45')]));_0x55126d[_0x014a('0x44')]=_0x55126d[_0x014a('0x44')]['length']?_0x55126d[_0x014a('0x44')]:_0x1c6f6f[_0x014a('0x40')];if(!_0x1398bb['query'][_0x014a('0x46')](_0x014a('0x47'))){_0x55126d[_0x014a('0x2f')]=qs['limit'](_0x1398bb[_0x014a('0x42')]['limit']);_0x55126d['offset']=qs[_0x014a('0x2e')](_0x1398bb[_0x014a('0x42')]['offset']);}_0x55126d[_0x014a('0x48')]=qs[_0x014a('0x49')](_0x1398bb[_0x014a('0x42')][_0x014a('0x49')]);_0x55126d[_0x014a('0x4a')]=qs[_0x014a('0x4b')](_['pick'](_0x1398bb[_0x014a('0x42')],_0x1c6f6f[_0x014a('0x4b')]));if(_0x1398bb[_0x014a('0x42')]['filter']){_0x55126d['where']=_[_0x014a('0x4c')](_0x55126d['where'],{'$or':_['map'](_0x2990df,function(_0x42c530){if(_0x42c530['type'][_0x014a('0x4d')]!==_0x014a('0x4e')){var _0x36372d={};_0x36372d[_0x42c530['field']]={'$like':'%'+_0x1398bb[_0x014a('0x42')][_0x014a('0x4f')]+'%'};return _0x36372d;}})});}_0x55126d=_[_0x014a('0x4c')]({},_0x55126d,_0x1398bb[_0x014a('0x50')]);var _0x449aea={'where':_0x55126d[_0x014a('0x4a')]};return db['FaxAccount'][_0x014a('0x2d')](_0x449aea)[_0x014a('0x1f')](function(_0x5a861c){_0x3f4a61[_0x014a('0x2d')]=_0x5a861c;if(_0x1398bb[_0x014a('0x42')][_0x014a('0x51')]){_0x55126d[_0x014a('0x52')]=[{'all':!![]}];}return db[_0x014a('0x3e')][_0x014a('0x53')](_0x55126d);})[_0x014a('0x1f')](function(_0x21680f){_0x3f4a61['rows']=_0x21680f;return _0x3f4a61;})[_0x014a('0x1f')](respondWithFilteredResult(_0x43376c,_0x55126d))[_0x014a('0x29')](handleError(_0x43376c,null));};exports[_0x014a('0x54')]=function(_0x135e7e,_0x312c7a){var _0x4b2fdb={'raw':![],'where':{'id':_0x135e7e['params']['id']},'include':[{'model':db[_0x014a('0x55')],'as':_0x014a('0x3d')}]},_0x19e3c3={};_0x19e3c3[_0x014a('0x40')]=_[_0x014a('0x41')](db[_0x014a('0x3e')]['rawAttributes']);_0x19e3c3['query']=_['keys'](_0x135e7e['query']);_0x19e3c3[_0x014a('0x4b')]=_['intersection'](_0x19e3c3[_0x014a('0x40')],_0x19e3c3['query']);_0x4b2fdb['attributes']=_[_0x014a('0x43')](_0x19e3c3['model'],qs[_0x014a('0x45')](_0x135e7e[_0x014a('0x42')][_0x014a('0x45')]));_0x4b2fdb[_0x014a('0x44')]=_0x4b2fdb[_0x014a('0x44')][_0x014a('0x56')]?_0x4b2fdb[_0x014a('0x44')]:_0x19e3c3[_0x014a('0x40')];if(_0x135e7e[_0x014a('0x42')][_0x014a('0x51')]){_0x4b2fdb['include']=[{'all':!![]}];}_0x4b2fdb=_['merge']({},_0x4b2fdb,_0x135e7e[_0x014a('0x50')]);return db[_0x014a('0x3e')][_0x014a('0x57')](_0x4b2fdb)['then'](handleEntityNotFound(_0x312c7a,null))['then'](respondWithResult(_0x312c7a,null))[_0x014a('0x29')](handleError(_0x312c7a,null));};exports['create']=function(_0x246b5c,_0x3f6177){return db[_0x014a('0x3e')][_0x014a('0x58')](_0x246b5c['body'],{})[_0x014a('0x1f')](function(_0x2ccc2f){var _0x3d1c9d=_0x246b5c['user'][_0x014a('0x37')]({'plain':!![]});if(!_0x3d1c9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d1c9d[_0x014a('0x59')]===_0x014a('0x5a')){var _0x34736b=_0x2ccc2f[_0x014a('0x37')]({'plain':!![]});var _0xd0334a=_0x014a('0x5b');return db['UserProfileSection'][_0x014a('0x57')]({'where':{'name':_0xd0334a,'userProfileId':_0x3d1c9d[_0x014a('0x5c')]},'raw':!![]})[_0x014a('0x1f')](function(_0x52b123){if(_0x52b123&&_0x52b123[_0x014a('0x5d')]===0x0){return db[_0x014a('0x38')][_0x014a('0x58')]({'name':_0x34736b[_0x014a('0x3a')],'resourceId':_0x34736b['id'],'type':_0x52b123[_0x014a('0x3a')],'sectionId':_0x52b123['id']},{})['then'](function(){return _0x2ccc2f;});}else{return _0x2ccc2f;}})[_0x014a('0x29')](function(_0x46168d){logger[_0x014a('0x25')](_0x014a('0x5e'),_0x46168d);throw _0x46168d;});}return _0x2ccc2f;})[_0x014a('0x1f')](respondWithResult(_0x3f6177,0xc9))[_0x014a('0x29')](handleError(_0x3f6177,null));};exports[_0x014a('0x35')]=function(_0x4039d1,_0x2d2496){if(_0x4039d1[_0x014a('0x5f')]['id']){delete _0x4039d1[_0x014a('0x5f')]['id'];}return db[_0x014a('0x3e')]['find']({'where':{'id':_0x4039d1[_0x014a('0x60')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2d2496,null))['then'](saveUpdates(_0x4039d1['body'],null))[_0x014a('0x1f')](respondWithResult(_0x2d2496,null))[_0x014a('0x29')](handleError(_0x2d2496,null));};exports[_0x014a('0x36')]=function(_0x52d602,_0x3c6fc0){return db[_0x014a('0x3e')][_0x014a('0x57')]({'where':{'id':_0x52d602[_0x014a('0x60')]['id']}})['then'](handleEntityNotFound(_0x3c6fc0,null))['then'](removeEntity(_0x3c6fc0,null))[_0x014a('0x29')](handleError(_0x3c6fc0,null));};exports[_0x014a('0x61')]=function(_0x411948,_0x36807a){return db[_0x014a('0x3e')][_0x014a('0x61')]()[_0x014a('0x1f')](respondWithResult(_0x36807a,null))[_0x014a('0x29')](handleError(_0x36807a,null));};exports[_0x014a('0x62')]=function(_0x2a510c,_0x3126f,_0x4b1fbf){if(_0x2a510c[_0x014a('0x5f')]['id']){delete _0x2a510c[_0x014a('0x5f')]['id'];}return db['FaxAccount'][_0x014a('0x57')]({'where':{'id':_0x2a510c[_0x014a('0x60')]['id']}})['then'](handleEntityNotFound(_0x3126f,null))[_0x014a('0x1f')](function(_0x51ddea){if(_0x51ddea){_0x2a510c[_0x014a('0x5f')][_0x014a('0x63')]=_0x51ddea['id'];return db[_0x014a('0x64')][_0x014a('0x58')](_0x2a510c[_0x014a('0x5f')]);}})['then'](respondWithResult(_0x3126f,null))[_0x014a('0x29')](handleError(_0x3126f,null));};exports[_0x014a('0x65')]=function(_0x107e1c,_0x36a756,_0xbad5ef){var _0x52e79e={'raw':![],'where':{}};var _0x20cddc={};var _0x188e65={'count':0x0,'rows':[]};return db[_0x014a('0x3e')]['findOne']({'where':{'id':_0x107e1c[_0x014a('0x60')]['id']}})['then'](handleEntityNotFound(_0x36a756,null))[_0x014a('0x1f')](function(_0x1caefa){if(_0x1caefa){_0x20cddc[_0x014a('0x40')]=_[_0x014a('0x41')](db[_0x014a('0x64')][_0x014a('0x3f')]);_0x20cddc[_0x014a('0x42')]=_['keys'](_0x107e1c['query']);_0x20cddc[_0x014a('0x4b')]=_['intersection'](_0x20cddc[_0x014a('0x40')],_0x20cddc['query']);_0x52e79e[_0x014a('0x44')]=_[_0x014a('0x43')](_0x20cddc['model'],qs['fields'](_0x107e1c[_0x014a('0x42')][_0x014a('0x45')]));_0x52e79e['attributes']=_0x52e79e[_0x014a('0x44')][_0x014a('0x56')]?_0x52e79e['attributes']:_0x20cddc['model'];if(!_0x107e1c[_0x014a('0x42')][_0x014a('0x46')](_0x014a('0x47'))){_0x52e79e[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x107e1c[_0x014a('0x42')]['limit']);_0x52e79e[_0x014a('0x2e')]=qs['offset'](_0x107e1c['query'][_0x014a('0x2e')]);}_0x52e79e[_0x014a('0x48')]=qs['sort'](_0x107e1c[_0x014a('0x42')][_0x014a('0x49')]);_0x52e79e[_0x014a('0x4a')]=qs[_0x014a('0x4b')](_[_0x014a('0x66')](_0x107e1c['query'],_0x20cddc[_0x014a('0x4b')]));_0x52e79e[_0x014a('0x4a')][_0x014a('0x63')]=_0x1caefa['id'];if(_0x107e1c[_0x014a('0x42')]['filter']){_0x52e79e[_0x014a('0x4a')]=_['merge'](_0x52e79e[_0x014a('0x4a')],{'$or':_[_0x014a('0x67')](_0x52e79e[_0x014a('0x44')],function(_0x1310b7){var _0xf7c997={};_0xf7c997[_0x1310b7]={'$like':'%'+_0x107e1c[_0x014a('0x42')]['filter']+'%'};return _0xf7c997;})});}_0x52e79e=_[_0x014a('0x4c')]({},_0x52e79e,_0x107e1c[_0x014a('0x50')]);return db[_0x014a('0x64')][_0x014a('0x2d')]({'where':_0x52e79e[_0x014a('0x4a')]})[_0x014a('0x1f')](function(_0x216b99){_0x188e65[_0x014a('0x2d')]=_0x216b99;if(_0x107e1c['query'][_0x014a('0x51')]){_0x52e79e[_0x014a('0x52')]=[{'all':!![]}];}return db[_0x014a('0x64')]['findAll'](_0x52e79e);})[_0x014a('0x1f')](function(_0x469cd8){_0x188e65[_0x014a('0x68')]=_0x469cd8;return _0x188e65;});}})[_0x014a('0x1f')](respondWithFilteredResult(_0x36a756,_0x52e79e))[_0x014a('0x29')](handleError(_0x36a756,null));};exports[_0x014a('0x69')]=function(_0x29b061,_0x48cec1,_0x5891cf){return db['FaxAccount']['find']({'where':{'id':_0x29b061[_0x014a('0x60')]['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x48cec1,null))[_0x014a('0x1f')](function(_0x3804e1){if(_0x3804e1){return _0x3804e1[_0x014a('0x69')](_0x29b061[_0x014a('0x42')][_0x014a('0x6a')]);}})['then'](respondWithStatusCode(_0x48cec1,null))[_0x014a('0x29')](handleError(_0x48cec1,null));};exports[_0x014a('0x6b')]=function(_0x3fd503,_0x28a8ec,_0x5108c5){if(_0x3fd503['body']['id']){delete _0x3fd503[_0x014a('0x5f')]['id'];}return db[_0x014a('0x3e')]['find']({'where':{'id':_0x3fd503['params']['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x28a8ec,null))['then'](function(_0x5d4099){if(_0x5d4099){_0x3fd503[_0x014a('0x5f')][_0x014a('0x63')]=_0x5d4099['id'];return db['CannedAnswer'][_0x014a('0x58')](_0x3fd503[_0x014a('0x5f')]);}})[_0x014a('0x1f')](respondWithResult(_0x28a8ec,null))[_0x014a('0x29')](handleError(_0x28a8ec,null));};exports[_0x014a('0x6c')]=function(_0x2b99d4,_0x13a545,_0xc86f44){var _0x5c3935={'raw':![],'where':{}};var _0x5bae68={};var _0x28dc6f={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2b99d4['params']['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x13a545,null))[_0x014a('0x1f')](function(_0x2c527f){if(_0x2c527f){_0x5bae68['model']=_[_0x014a('0x41')](db[_0x014a('0x6d')][_0x014a('0x3f')]);_0x5bae68[_0x014a('0x42')]=_['keys'](_0x2b99d4[_0x014a('0x42')]);_0x5bae68[_0x014a('0x4b')]=_[_0x014a('0x43')](_0x5bae68['model'],_0x5bae68[_0x014a('0x42')]);_0x5c3935[_0x014a('0x44')]=_['intersection'](_0x5bae68[_0x014a('0x40')],qs[_0x014a('0x45')](_0x2b99d4[_0x014a('0x42')]['fields']));_0x5c3935[_0x014a('0x44')]=_0x5c3935[_0x014a('0x44')]['length']?_0x5c3935[_0x014a('0x44')]:_0x5bae68[_0x014a('0x40')];if(!_0x2b99d4[_0x014a('0x42')][_0x014a('0x46')](_0x014a('0x47'))){_0x5c3935[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x2b99d4[_0x014a('0x42')]['limit']);_0x5c3935[_0x014a('0x2e')]=qs[_0x014a('0x2e')](_0x2b99d4['query']['offset']);}_0x5c3935[_0x014a('0x48')]=qs[_0x014a('0x49')](_0x2b99d4['query'][_0x014a('0x49')]);_0x5c3935[_0x014a('0x4a')]=qs[_0x014a('0x4b')](_['pick'](_0x2b99d4[_0x014a('0x42')],_0x5bae68[_0x014a('0x4b')]));_0x5c3935['where']['FaxAccountId']=_0x2c527f['id'];if(_0x2b99d4[_0x014a('0x42')]['filter']){_0x5c3935[_0x014a('0x4a')]=_['merge'](_0x5c3935[_0x014a('0x4a')],{'$or':_[_0x014a('0x67')](_0x5c3935[_0x014a('0x44')],function(_0x3af694){var _0x20b182={};_0x20b182[_0x3af694]={'$like':'%'+_0x2b99d4['query'][_0x014a('0x4f')]+'%'};return _0x20b182;})});}_0x5c3935=_[_0x014a('0x4c')]({},_0x5c3935,_0x2b99d4[_0x014a('0x50')]);return db[_0x014a('0x6d')][_0x014a('0x2d')]({'where':_0x5c3935[_0x014a('0x4a')]})[_0x014a('0x1f')](function(_0x2e53f9){_0x28dc6f['count']=_0x2e53f9;if(_0x2b99d4[_0x014a('0x42')]['includeAll']){_0x5c3935[_0x014a('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5c3935);})['then'](function(_0x4e10c2){_0x28dc6f[_0x014a('0x68')]=_0x4e10c2;return _0x28dc6f;});}})[_0x014a('0x1f')](respondWithFilteredResult(_0x13a545,_0x5c3935))[_0x014a('0x29')](handleError(_0x13a545,null));};exports[_0x014a('0x6e')]=function(_0x28a692,_0x27a899,_0x11c940){return db[_0x014a('0x3e')]['find']({'where':{'id':_0x28a692['params']['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x27a899,null))[_0x014a('0x1f')](function(_0x15d686){if(_0x15d686){return _0x15d686[_0x014a('0x6e')](_0x28a692[_0x014a('0x42')][_0x014a('0x6a')]);}})[_0x014a('0x1f')](respondWithStatusCode(_0x27a899,null))[_0x014a('0x29')](handleError(_0x27a899,null));};exports['addInteraction']=function(_0x27431c,_0x3cfcc7,_0x3a2752){return db[_0x014a('0x6f')][_0x014a('0x57')]({'where':{'id':_0x27431c['params']['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x3cfcc7,null))[_0x014a('0x1f')](function(_0x2b9496){if(_0x2b9496){return _0x2b9496[_0x014a('0x70')](_0x27431c[_0x014a('0x5f')][_0x014a('0x6a')],_[_0x014a('0x71')](_0x27431c['body'],[_0x014a('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x3cfcc7,null))['catch'](handleError(_0x3cfcc7,null));};exports[_0x014a('0x72')]=function(_0xaf1b9f,_0x4af6d4,_0x129c22){var _0x3199b9={'raw':![],'where':{}};var _0x10ceb0={};var _0x5e116d={'count':0x0,'rows':[]};return db[_0x014a('0x3e')][_0x014a('0x73')]({'where':{'id':_0xaf1b9f[_0x014a('0x60')]['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x4af6d4,null))[_0x014a('0x1f')](function(_0x263212){if(_0x263212){_0x10ceb0[_0x014a('0x40')]=_[_0x014a('0x41')](db[_0x014a('0x6f')]['rawAttributes']);_0x10ceb0['query']=_[_0x014a('0x41')](_0xaf1b9f[_0x014a('0x42')]);_0x10ceb0[_0x014a('0x4b')]=_['intersection'](_0x10ceb0[_0x014a('0x40')],_0x10ceb0[_0x014a('0x42')]);_0x3199b9[_0x014a('0x44')]=_[_0x014a('0x43')](_0x10ceb0[_0x014a('0x40')],qs[_0x014a('0x45')](_0xaf1b9f['query'][_0x014a('0x45')]));_0x3199b9[_0x014a('0x44')]=_0x3199b9[_0x014a('0x44')][_0x014a('0x56')]?_0x3199b9['attributes']:_0x10ceb0[_0x014a('0x40')];if(!_0xaf1b9f[_0x014a('0x42')][_0x014a('0x46')](_0x014a('0x47'))){_0x3199b9[_0x014a('0x2f')]=qs['limit'](_0xaf1b9f[_0x014a('0x42')]['limit']);_0x3199b9['offset']=qs[_0x014a('0x2e')](_0xaf1b9f[_0x014a('0x42')][_0x014a('0x2e')]);}_0x3199b9[_0x014a('0x48')]=qs[_0x014a('0x49')](_0xaf1b9f[_0x014a('0x42')][_0x014a('0x49')]);_0x3199b9[_0x014a('0x4a')]=qs[_0x014a('0x4b')](_[_0x014a('0x66')](_0xaf1b9f[_0x014a('0x42')],_0x10ceb0[_0x014a('0x4b')]));_0x3199b9[_0x014a('0x4a')][_0x014a('0x63')]=_0x263212['id'];if(_0xaf1b9f[_0x014a('0x42')][_0x014a('0x4f')]){_0x3199b9['where']=_[_0x014a('0x4c')](_0x3199b9[_0x014a('0x4a')],{'$or':_[_0x014a('0x67')](_0x3199b9['attributes'],function(_0x4495c1){var _0x2e2360={};_0x2e2360[_0x4495c1]={'$like':'%'+_0xaf1b9f[_0x014a('0x42')][_0x014a('0x4f')]+'%'};return _0x2e2360;})});}_0x3199b9=_[_0x014a('0x4c')]({},_0x3199b9,_0xaf1b9f[_0x014a('0x50')]);return db[_0x014a('0x6f')][_0x014a('0x2d')]({'where':_0x3199b9[_0x014a('0x4a')]})['then'](function(_0x346734){_0x5e116d[_0x014a('0x2d')]=_0x346734;if(_0xaf1b9f[_0x014a('0x42')][_0x014a('0x51')]){_0x3199b9['include']=[{'model':db[_0x014a('0x74')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x014a('0x75'),'attributes':['name',_0x014a('0x76'),_0x014a('0x77')],'required':![]},{'model':db['Tag'],'as':_0x014a('0x78'),'attributes':['id','name',_0x014a('0x79')],'where':_0xaf1b9f[_0x014a('0x42')]['tag']?{'id':_0xaf1b9f[_0x014a('0x42')][_0x014a('0x7a')]}:undefined,'required':_0xaf1b9f['query'][_0x014a('0x7a')]?!![]:![]}];}return db[_0x014a('0x6f')][_0x014a('0x53')](_0x3199b9);})[_0x014a('0x1f')](function(_0xa2d860){_0x5e116d[_0x014a('0x68')]=_0xa2d860;return _0x5e116d;});}})[_0x014a('0x1f')](respondWithFilteredResult(_0x4af6d4,_0x3199b9))[_0x014a('0x29')](handleError(_0x4af6d4,null));};exports[_0x014a('0x7b')]=function(_0x38df6c,_0x15e8ad,_0x1c8a58){return db['FaxAccount'][_0x014a('0x73')]({'where':{'id':_0x38df6c[_0x014a('0x60')]['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x15e8ad,null))[_0x014a('0x1f')](function(_0x3cf20e){if(_0x3cf20e){return db[_0x014a('0x7c')][_0x014a('0x7d')](function(_0x320be8){return db['FaxApplication'][_0x014a('0x36')]({'where':{'FaxAccountId':_0x38df6c[_0x014a('0x60')]['id']},'transaction':_0x320be8})[_0x014a('0x1f')](function(_0x29d217){var _0x169941=_[_0x014a('0x67')](_0x38df6c['body'],function(_0x20427f){_0x20427f[_0x014a('0x63')]=_0x38df6c[_0x014a('0x60')]['id'];return _0x20427f;});return db['FaxApplication']['bulkCreate'](_0x169941,{'transaction':_0x320be8});});})[_0x014a('0x1f')](function(){return db[_0x014a('0x7e')][_0x014a('0x7f')]({'where':{'FaxAccountId':_0x38df6c[_0x014a('0x60')]['id']},'order':_0x014a('0x80')});});}})['then'](respondWithResult(_0x15e8ad,null))[_0x014a('0x29')](handleError(_0x15e8ad,null));};exports[_0x014a('0x81')]=function(_0x41c88c,_0x5dd7a5,_0x185609){var _0x87c7e5={};var _0x518170={};var _0x2d4055;var _0x4a5ce5;return db[_0x014a('0x3e')]['findOne']({'where':{'id':_0x41c88c['params']['id']}})['then'](handleEntityNotFound(_0x5dd7a5,null))[_0x014a('0x1f')](function(_0x48849c){if(_0x48849c){_0x2d4055=_0x48849c;_0x518170[_0x014a('0x40')]=_['keys'](db[_0x014a('0x7e')][_0x014a('0x3f')]);_0x518170[_0x014a('0x42')]=_['keys'](_0x41c88c[_0x014a('0x42')]);_0x518170['filters']=_[_0x014a('0x43')](_0x518170[_0x014a('0x40')],_0x518170[_0x014a('0x42')]);_0x87c7e5['attributes']=_['intersection'](_0x518170[_0x014a('0x40')],qs[_0x014a('0x45')](_0x41c88c[_0x014a('0x42')][_0x014a('0x45')]));_0x87c7e5[_0x014a('0x44')]=_0x87c7e5[_0x014a('0x44')][_0x014a('0x56')]?_0x87c7e5[_0x014a('0x44')]:_0x518170[_0x014a('0x40')];_0x87c7e5[_0x014a('0x48')]=qs[_0x014a('0x49')](_0x41c88c[_0x014a('0x42')][_0x014a('0x49')]);_0x87c7e5['where']=qs['filters'](_[_0x014a('0x66')](_0x41c88c[_0x014a('0x42')],_0x518170['filters']));if(_0x41c88c[_0x014a('0x42')][_0x014a('0x4f')]){_0x87c7e5['where']=_['merge'](_0x87c7e5[_0x014a('0x4a')],{'$or':_[_0x014a('0x67')](_0x87c7e5['attributes'],function(_0xbfc324){var _0x5c7444={};_0x5c7444[_0xbfc324]={'$like':'%'+_0x41c88c[_0x014a('0x42')][_0x014a('0x4f')]+'%'};return _0x5c7444;})});}_0x87c7e5=_[_0x014a('0x4c')]({},_0x87c7e5,_0x41c88c[_0x014a('0x50')]);return _0x2d4055['getApplications'](_0x87c7e5);}})['then'](function(_0x5db9d1){if(_0x5db9d1){_0x4a5ce5=_0x5db9d1['length'];if(!_0x41c88c[_0x014a('0x42')][_0x014a('0x46')](_0x014a('0x47'))){_0x87c7e5[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x41c88c[_0x014a('0x42')][_0x014a('0x2f')]);_0x87c7e5[_0x014a('0x2e')]=qs[_0x014a('0x2e')](_0x41c88c[_0x014a('0x42')][_0x014a('0x2e')]);}return _0x2d4055['getApplications'](_0x87c7e5);}})['then'](function(_0x51dc2c){if(_0x51dc2c){return _0x51dc2c?{'count':_0x4a5ce5,'rows':_0x51dc2c}:null;}})[_0x014a('0x1f')](respondWithResult(_0x5dd7a5,null))[_0x014a('0x29')](handleError(_0x5dd7a5,null));};function Extension(_0x4da4a1,_0x396f99,_0x8a2706,_0x2a09d4){this[_0x014a('0x82')]='from-voip-provider';this[_0x014a('0x83')]=_0x4da4a1[_0x014a('0x84')];this['app']=_0x2a09d4;this[_0x014a('0x85')]=_0x014a('0x86');this['description']=_0x014a('0x87');this[_0x014a('0x63')]=_0x4da4a1['id'];this[_0x014a('0x80')]=_0x396f99;this[_0x014a('0x88')]=_0x8a2706;}function createExtensionsReciveFax(_0x2f45a6){var _0x2e957c=0x1;var _0x2362f2=[];_0x2362f2[_0x014a('0x89')](new Extension(_0x2f45a6,_0x2e957c,'','Answer'));_0x2e957c+=0x1;_0x2362f2[_0x014a('0x89')](new Extension(_0x2f45a6,_0x2e957c,_0x014a('0x8a'),_0x014a('0x8b')));_0x2e957c+=0x1;for(var _0x1bdf47 in _0x2f45a6){if(_0x2f45a6[_0x014a('0x46')](_0x1bdf47)&&(_0x1bdf47===_0x014a('0x8c')||_0x1bdf47===_0x014a('0x84')||_0x1bdf47===_0x014a('0x8d')||_0x1bdf47===_0x014a('0x8e')||_0x1bdf47==='headerinfo'||_0x1bdf47===_0x014a('0x8f')||_0x1bdf47==='minrate'||_0x1bdf47===_0x014a('0x90')||_0x1bdf47===_0x014a('0x91'))){_0x2362f2[_0x014a('0x89')](new Extension(_0x2f45a6,_0x2e957c,'FAXOPT('+_0x1bdf47+')='+_0x2f45a6[_0x1bdf47],'Set'));_0x2e957c+=0x1;}}_0x2362f2[_0x014a('0x89')](new Extension(_0x2f45a6,_0x2e957c,'6','Wait'));_0x2e957c+=0x1;_0x2362f2['push'](new Extension(_0x2f45a6,_0x2e957c,'/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',_0x014a('0x92')));_0x2e957c=0x0;return _0x2362f2;}exports[_0x014a('0x93')]=function(_0x46eae3,_0x5edabd,_0x38ea5a){var _0x19a2ed;return db['sequelize'][_0x014a('0x7d')](function(_0x2641f2){return db[_0x014a('0x3e')]['create'](_0x46eae3['body'],{'transaction':_0x2641f2})[_0x014a('0x1f')](function(_0x24e9d7){_0x19a2ed=_0x24e9d7[_0x014a('0x37')]({'plain':!![]});return db[_0x014a('0x94')][_0x014a('0x95')](createExtensionsReciveFax(_0x19a2ed),{'transaction':_0x2641f2});});})[_0x014a('0x1f')](function(){return _0x19a2ed;})['then'](respondWithResult(_0x5edabd,null))['catch'](handleError(_0x5edabd,null));};exports['updateAccountApplications']=function(_0x33de7b,_0x41f92e,_0x178d75){var _0x50b2ff;return db[_0x014a('0x7c')][_0x014a('0x7d')](function(_0x181cfc){return db['FaxAccount'][_0x014a('0x35')](_0x33de7b[_0x014a('0x5f')],{'where':{'id':_0x33de7b[_0x014a('0x5f')]['id']},'transaction':_0x181cfc})[_0x014a('0x1f')](function(_0x59d53c){return db[_0x014a('0x94')]['destroy']({'where':{'FaxAccountId':_0x33de7b[_0x014a('0x5f')]['id']},'transaction':_0x181cfc})[_0x014a('0x1f')](function(_0x2023d1){return db['VoiceExtension'][_0x014a('0x95')](createExtensionsReciveFax(_[_0x014a('0x71')](_0x33de7b[_0x014a('0x5f')],[_0x014a('0x96'),_0x014a('0x4d'),'createdAt',_0x014a('0x97'),_0x014a('0x98'),_0x014a('0x99')])),{'transaction':_0x181cfc});});});})[_0x014a('0x1f')](function(){return db[_0x014a('0x3e')][_0x014a('0x9a')](_0x33de7b['body']['id']);})[_0x014a('0x1f')](respondWithResult(_0x41f92e,null))[_0x014a('0x29')](handleError(_0x41f92e,null));};exports['getMessages']=function(_0x1b5b25,_0x5eda06,_0x196ae5){var _0x54ab59={'raw':!![],'where':{}};var _0x346c6b={};var _0x1ff46a={'count':0x0,'rows':[]};return db[_0x014a('0x3e')][_0x014a('0x73')]({'where':{'id':_0x1b5b25[_0x014a('0x60')]['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x5eda06,null))[_0x014a('0x1f')](function(_0x5db6f3){if(_0x5db6f3){_0x346c6b['model']=_[_0x014a('0x41')](db[_0x014a('0x9b')]['rawAttributes']);_0x346c6b[_0x014a('0x42')]=_[_0x014a('0x41')](_0x1b5b25[_0x014a('0x42')]);_0x346c6b[_0x014a('0x4b')]=_[_0x014a('0x43')](_0x346c6b['model'],_0x346c6b[_0x014a('0x42')]);_0x54ab59[_0x014a('0x44')]=_[_0x014a('0x43')](_0x346c6b[_0x014a('0x40')],qs['fields'](_0x1b5b25[_0x014a('0x42')]['fields']));_0x54ab59[_0x014a('0x44')]=_0x54ab59[_0x014a('0x44')][_0x014a('0x56')]?_0x54ab59[_0x014a('0x44')]:_0x346c6b[_0x014a('0x40')];if(!_0x1b5b25[_0x014a('0x42')][_0x014a('0x46')]('nolimit')){_0x54ab59[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x1b5b25[_0x014a('0x42')][_0x014a('0x2f')]);_0x54ab59['offset']=qs['offset'](_0x1b5b25[_0x014a('0x42')][_0x014a('0x2e')]);}_0x54ab59['order']=qs[_0x014a('0x49')](_0x1b5b25[_0x014a('0x42')][_0x014a('0x49')]);_0x54ab59[_0x014a('0x4a')]=qs[_0x014a('0x4b')](_[_0x014a('0x66')](_0x1b5b25[_0x014a('0x42')],_0x346c6b[_0x014a('0x4b')]));_0x54ab59[_0x014a('0x4a')]['FaxAccountId']=_0x5db6f3['id'];if(_0x1b5b25[_0x014a('0x42')]['filter']){_0x54ab59[_0x014a('0x4a')]=_[_0x014a('0x4c')](_0x54ab59['where'],{'$or':_[_0x014a('0x67')](_0x54ab59[_0x014a('0x44')],function(_0x27afb3){var _0x299b4d={};_0x299b4d[_0x27afb3]={'$like':'%'+_0x1b5b25[_0x014a('0x42')]['filter']+'%'};return _0x299b4d;})});}if(_0x1b5b25[_0x014a('0x42')][_0x014a('0x9c')]){var _0x40f949=_0x1b5b25[_0x014a('0x42')][_0x014a('0x9c')][_0x014a('0x9d')](',');var _0x2e1ad7={};_0x2e1ad7[_0x40f949[0x0]]={'$gte':moment(_0x40f949[0x1])[_0x014a('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x54ab59[_0x014a('0x4a')]=_['merge'](_0x54ab59[_0x014a('0x4a')],_0x2e1ad7);}_0x54ab59=_[_0x014a('0x4c')]({},_0x54ab59,_0x1b5b25[_0x014a('0x50')]);return db[_0x014a('0x9b')][_0x014a('0x2d')]({'where':_0x54ab59[_0x014a('0x4a')]})['then'](function(_0x8a39c5){_0x1ff46a['count']=_0x8a39c5;if(_0x1b5b25[_0x014a('0x42')][_0x014a('0x51')]){_0x54ab59[_0x014a('0x52')]=[{'all':!![]}];}return db[_0x014a('0x9b')][_0x014a('0x53')](_0x54ab59);})[_0x014a('0x1f')](function(_0x21ee47){_0x1ff46a[_0x014a('0x68')]=_0x21ee47;return _0x1ff46a;});}})['then'](respondWithFilteredResult(_0x5eda06,_0x54ab59))['catch'](handleError(_0x5eda06,null));};exports[_0x014a('0x3b')]=function(_0xb7c438,_0x41cbaf,_0x481ef6){var _0x3c5d4c,_0x30aa7b={},_0x451579;if(_0xb7c438[_0x014a('0x5f')]['to']){_0x451579=_0xb7c438[_0x014a('0x5f')]['to'][0x0];}return db[_0x014a('0x3e')][_0x014a('0x57')]({'where':{'id':_0xb7c438[_0x014a('0x60')]['id']},'include':[{'model':db[_0x014a('0x9f')],'as':'List','include':[{'model':db[_0x014a('0x74')],'as':_0x014a('0xa0'),'where':{'fax':_0x451579},'limit':0x1,'order':[[_0x014a('0x97'),'DESC']]}]}]})[_0x014a('0x1f')](handleEntityNotFound(_0x41cbaf,null))[_0x014a('0x1f')](function(_0x26420a){_0x3c5d4c=_0x26420a;if(_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')]&&_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][_0x014a('0x56')]){for(var _0x3bb1f=0x0;_0x3bb1f<_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][_0x014a('0x56')];_0x3bb1f+=0x1){_0xb7c438['body']['attachments'][_0x3bb1f]={'filename':_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][_0x3bb1f]['name'],'id':_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][_0x3bb1f]['id'],'path':path[_0x014a('0xa2')](config[_0x014a('0xa3')],_0x014a('0xa4'),_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][_0x3bb1f][_0x014a('0xa5')])};}}return respondWithRpcPromise('CheckAfterSend',_0x014a('0xa6'),{'FaxAccountId':_[_0x014a('0xa7')](_0xb7c438[_0x014a('0x60')]['id'])?undefined:_0xb7c438[_0x014a('0x60')]['id'],'path':_['isNil'](_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][0x0][_0x014a('0x7')])?undefined:_0xb7c438['body'][_0x014a('0xa1')][0x0][_0x014a('0x7')],'fax':_['isNil'](_0xb7c438[_0x014a('0x5f')]['to'][0x0])?undefined:_0xb7c438[_0x014a('0x5f')]['to'][0x0]},client9002);})[_0x014a('0x1f')](function(){if(_0x3c5d4c){if(_['isNil'](_0xb7c438[_0x014a('0x5f')][_0x014a('0xa8')])){_0xb7c438[_0x014a('0x5f')]['from']=util[_0x014a('0x9e')]('\x22%s\x22\x20<%s>',_0x3c5d4c[_0x014a('0x3a')],_0x3c5d4c['fax']);}if(_0x3c5d4c[_0x014a('0xa9')]){if(_0x3c5d4c[_0x014a('0xa9')]['Contacts'][_0x014a('0x56')]){return _0x3c5d4c['List'][_0x014a('0xa0')][0x0];}else{return db[_0x014a('0x74')][_0x014a('0x58')](_[_0x014a('0x13')](_0xb7c438[_0x014a('0x5f')],{'firstName':_0xb7c438['body']['to'][0x0],'phone':_0xb7c438[_0x014a('0x5f')]['to'][0x0],'fax':_0xb7c438[_0x014a('0x5f')]['to'][0x0],'ListId':_0x3c5d4c[_0x014a('0x99')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x014a('0xaa'));}})[_0x014a('0x1f')](function(_0x50ee6c){if(_0x50ee6c){return db['FaxInteraction'][_0x014a('0x57')]({'where':{'ContactId':_0x50ee6c['id'],'closed':![],'FaxAccountId':_0x3c5d4c['id']}})[_0x014a('0x1f')](function(_0x4a58f0){if(_0x4a58f0){return[_0x4a58f0,![]];}return db[_0x014a('0x6f')]['create']({'UserId':_0xb7c438['user']['id'],'ContactId':_0x50ee6c['id'],'FaxAccountId':_0x3c5d4c['id'],'fax':_0xb7c438[_0x014a('0x5f')]['to'][0x0],'firstMsgDirection':_0x014a('0xab'),'Messages':[_['merge'](_0xb7c438['body'],{'read':![],'body':_0xb7c438['body'][_0x014a('0xa1')][0x0][_0x014a('0xac')],'FaxAccountId':_0x3c5d4c['id'],'UserId':_0xb7c438[_0x014a('0x5a')]['id'],'ContactId':_0x50ee6c['id'],'AttachmentId':_0xb7c438['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x014a('0x9b')],'as':'Messages'}]})[_0x014a('0x1f')](function(_0x26fb1e){return[_0x26fb1e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x23f14b,_0x3f7fbe){if(_0x3f7fbe){return _0x23f14b;}return db['FaxMessage'][_0x014a('0x58')]({'direction':'out','read':![],'body':_0xb7c438[_0x014a('0x5f')]['attachments'][0x0][_0x014a('0xac')],'FaxAccountId':_0x3c5d4c['id'],'FaxInteractionId':_0x23f14b['id'],'UserId':_0xb7c438[_0x014a('0x5a')]['id'],'ContactId':_0x23f14b[_0x014a('0xad')],'AttachmentId':_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][0x0]['id']})[_0x014a('0x1f')](function(_0x68de07){_0x23f14b[_0x014a('0xae')]['Messages']=[];_0x23f14b[_0x014a('0xae')][_0x014a('0xaf')][_0x014a('0x89')](_0x68de07[_0x014a('0xae')]);return _0x23f14b;});})[_0x014a('0x1f')](function(_0x1cdb29){respondWithRpcPromise(_0x014a('0xb0'),_0x014a('0xb0'),{'FaxAccountId':_['isNil'](_0xb7c438[_0x014a('0x60')]['id'])?undefined:_0xb7c438[_0x014a('0x60')]['id'],'path':_[_0x014a('0xa7')](_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][0x0][_0x014a('0x7')])?undefined:_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][0x0][_0x014a('0x7')],'fax':_[_0x014a('0xa7')](_0xb7c438[_0x014a('0x5f')]['to'][0x0])?undefined:_0xb7c438['body']['to'][0x0],'AttachmentId':_0xb7c438[_0x014a('0x5f')][_0x014a('0xa1')][0x0]['id']},client9002)[_0x014a('0x1f')](function(_0x35bd80){logger[_0x014a('0x20')](_0x014a('0xb1'),_0x35bd80);})[_0x014a('0x29')](function(_0x49c86b){logger['info'](_0x014a('0xb1'),_0x49c86b);});return _0x1cdb29;})[_0x014a('0x1f')](respondWithResult(_0x41cbaf,null))[_0x014a('0x29')](handleError(_0x41cbaf,null));};exports[_0x014a('0xb2')]=function(_0x296366,_0x48768a,_0x4e691b){return db[_0x014a('0x3e')]['find']({'where':{'id':_0x296366[_0x014a('0x60')]['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x48768a,null))[_0x014a('0x1f')](function(_0x514b22){if(_0x514b22){return _0x514b22[_0x014a('0xb2')](_0x296366[_0x014a('0x5f')][_0x014a('0x6a')],_['omit'](_0x296366[_0x014a('0x5f')],[_0x014a('0x6a'),'id'])||{})['spread'](function(_0x3bc7f7){for(var _0x228e43=0x0;_0x228e43<_0x296366[_0x014a('0x5f')]['ids'][_0x014a('0x56')];_0x228e43+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x296366['body']['ids'][_0x228e43],'FaxAccountId':_0x296366[_0x014a('0x60')]['id']});}return _0x3bc7f7;});}})[_0x014a('0x1f')](respondWithResult(_0x48768a,null))[_0x014a('0x29')](handleError(_0x48768a,null));};exports[_0x014a('0xb3')]=function(_0x473c31,_0x1a1f24,_0x321bc5){return db['FaxAccount'][_0x014a('0x57')]({'where':{'id':_0x473c31['params']['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x1a1f24,null))[_0x014a('0x1f')](function(_0x10f6e9){if(_0x10f6e9){return _0x10f6e9['removeAgents'](_0x473c31[_0x014a('0x42')]['ids'])['then'](function(){if(_[_0x014a('0xb4')](_0x473c31[_0x014a('0x42')][_0x014a('0x6a')])){for(var _0x5168e5=0x0;_0x5168e5<_0x473c31['query'][_0x014a('0x6a')][_0x014a('0x56')];_0x5168e5+=0x1){socket[_0x014a('0xb5')](_0x014a('0xb6'),{'UserId':Number(_0x473c31[_0x014a('0x42')][_0x014a('0x6a')][_0x5168e5]),'FaxAccountId':Number(_0x473c31['params']['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x473c31[_0x014a('0x42')][_0x014a('0x6a')]),'FaxAccountId':Number(_0x473c31[_0x014a('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x1a1f24,null))[_0x014a('0x29')](handleError(_0x1a1f24,null));};exports[_0x014a('0xb7')]=function(_0x8a099,_0x81208d,_0x320be9){var _0x1d188d={};var _0x229c61={};var _0x43cbfa;var _0x4db5ae;return db[_0x014a('0x3e')][_0x014a('0x73')]({'where':{'id':_0x8a099['params']['id']}})[_0x014a('0x1f')](handleEntityNotFound(_0x81208d,null))[_0x014a('0x1f')](function(_0x39a11e){if(_0x39a11e){_0x43cbfa=_0x39a11e;_0x229c61['model']=_[_0x014a('0x41')](db[_0x014a('0xb8')]['rawAttributes']);_0x229c61[_0x014a('0x42')]=_['keys'](_0x8a099[_0x014a('0x42')]);_0x229c61[_0x014a('0x4b')]=_[_0x014a('0x43')](_0x229c61[_0x014a('0x40')],_0x229c61['query']);_0x1d188d['attributes']=_[_0x014a('0x43')](_0x229c61[_0x014a('0x40')],qs[_0x014a('0x45')](_0x8a099[_0x014a('0x42')][_0x014a('0x45')]));_0x1d188d[_0x014a('0x44')]=_0x1d188d[_0x014a('0x44')][_0x014a('0x56')]?_0x1d188d['attributes']:_0x229c61['model'];_0x1d188d['order']=qs[_0x014a('0x49')](_0x8a099[_0x014a('0x42')][_0x014a('0x49')]);_0x1d188d['where']=qs[_0x014a('0x4b')](_[_0x014a('0x66')](_0x8a099[_0x014a('0x42')],_0x229c61['filters']));if(_0x8a099[_0x014a('0x42')]['filter']){_0x1d188d['where']=_['merge'](_0x1d188d[_0x014a('0x4a')],{'$or':_['map'](_0x1d188d[_0x014a('0x44')],function(_0x3e7923){var _0x5980e4={};_0x5980e4[_0x3e7923]={'$like':'%'+_0x8a099[_0x014a('0x42')]['filter']+'%'};return _0x5980e4;})});}_0x1d188d=_[_0x014a('0x4c')]({},_0x1d188d,_0x8a099['options']);return _0x43cbfa[_0x014a('0xb7')](_0x1d188d);}})[_0x014a('0x1f')](function(_0x36ef0c){if(_0x36ef0c){_0x4db5ae=_0x36ef0c[_0x014a('0x56')];if(!_0x8a099[_0x014a('0x42')][_0x014a('0x46')](_0x014a('0x47'))){_0x1d188d['limit']=qs['limit'](_0x8a099[_0x014a('0x42')]['limit']);_0x1d188d[_0x014a('0x2e')]=qs[_0x014a('0x2e')](_0x8a099[_0x014a('0x42')]['offset']);}return _0x43cbfa[_0x014a('0xb7')](_0x1d188d);}})[_0x014a('0x1f')](function(_0x58b734){if(_0x58b734){return _0x58b734?{'count':_0x4db5ae,'rows':_0x58b734}:null;}})[_0x014a('0x1f')](respondWithResult(_0x81208d,null))[_0x014a('0x29')](handleError(_0x81208d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1fc2878..c5d925a 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 _0x69ed=['exports','events','../../mysqldb','FaxAccount','save','update','emit','hasOwnProperty','hook'];(function(_0x1aeaaf,_0x2572d3){var _0x8bd35=function(_0xd177a7){while(--_0xd177a7){_0x1aeaaf['push'](_0x1aeaaf['shift']());}};_0x8bd35(++_0x2572d3);}(_0x69ed,0x157));var _0xd69e=function(_0x4361c5,_0x28600b){_0x4361c5=_0x4361c5-0x0;var _0x348cec=_0x69ed[_0x4361c5];return _0x348cec;};'use strict';var EventEmitter=require(_0xd69e('0x0'));var FaxAccount=require(_0xd69e('0x1'))['db'][_0xd69e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd69e('0x3'),'afterUpdate':_0xd69e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31948a){return function(_0x468493,_0x4c0f05,_0x5a6fac){FaxAccountEvents[_0xd69e('0x5')](_0x31948a+':'+_0x468493['id'],_0x468493);FaxAccountEvents[_0xd69e('0x5')](_0x31948a,_0x468493);_0x5a6fac(null);};}for(var e in events){if(events[_0xd69e('0x6')](e)){var event=events[e];FaxAccount[_0xd69e('0x7')](e,emitEvent(event));}}module[_0xd69e('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x60b0=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x5bba2a,_0x22ed63){var _0x4d49ec=function(_0x4a6d01){while(--_0x4a6d01){_0x5bba2a['push'](_0x5bba2a['shift']());}};_0x4d49ec(++_0x22ed63);}(_0x60b0,0x140));var _0x060b=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x60b0[_0x1a36a5];return _0x746243;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x060b('0x0'))['db'][_0x060b('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x060b('0x2')](0x0);var events={'afterCreate':_0x060b('0x3'),'afterUpdate':'update','afterDestroy':_0x060b('0x4')};function emitEvent(_0xca67ef){return function(_0x1c2ae9,_0x3627cb,_0x2a876b){FaxAccountEvents[_0x060b('0x5')](_0xca67ef+':'+_0x1c2ae9['id'],_0x1c2ae9);FaxAccountEvents['emit'](_0xca67ef,_0x1c2ae9);_0x2a876b(null);};}for(var e in events){if(events[_0x060b('0x6')](e)){var event=events[e];FaxAccount[_0x060b('0x7')](e,emitEvent(event));}}module[_0x060b('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 bec07ad..6e7434c 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 _0x5f11=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5f11,0x6e));var _0x15f1=function(_0x4726a6,_0x1bd1e0){_0x4726a6=_0x4726a6-0x0;var _0x546f9e=_0x5f11[_0x4726a6];return _0x546f9e;};'use strict';var _=require(_0x15f1('0x0'));var util=require(_0x15f1('0x1'));var logger=require(_0x15f1('0x2'))('api');var moment=require(_0x15f1('0x3'));var BPromise=require(_0x15f1('0x4'));var rp=require(_0x15f1('0x5'));var fs=require('fs');var path=require(_0x15f1('0x6'));var rimraf=require('rimraf');var config=require(_0x15f1('0x7'));var attributes=require(_0x15f1('0x8'));module[_0x15f1('0x9')]=function(_0x46b7eb,_0x2c4c8e){return _0x46b7eb[_0x15f1('0xa')](_0x15f1('0xb'),attributes,{'tableName':_0x15f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d06=['rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5d6467,_0x46d65f){var _0x455ec0=function(_0xf260bd){while(--_0xf260bd){_0x5d6467['push'](_0x5d6467['shift']());}};_0x455ec0(++_0x46d65f);}(_0x1d06,0x16e));var _0x61d0=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x1d06[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x61d0('0x0'));var util=require(_0x61d0('0x1'));var logger=require(_0x61d0('0x2'))('api');var moment=require(_0x61d0('0x3'));var BPromise=require(_0x61d0('0x4'));var rp=require(_0x61d0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61d0('0x6'));var config=require(_0x61d0('0x7'));var attributes=require(_0x61d0('0x8'));module['exports']=function(_0x1c07f6,_0x35a551){return _0x1c07f6[_0x61d0('0x9')](_0x61d0('0xa'),attributes,{'tableName':_0x61d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 887cc65..7e9942c 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 _0xa29e=['get','push','close','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','UserId','name','interaction','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','stringify','error','message','FaxAccount,\x20%s,\x20%s','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','DESC','Applications','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','spread'];(function(_0x56e711,_0x5917c8){var _0x1cf38f=function(_0x145210){while(--_0x145210){_0x56e711['push'](_0x56e711['shift']());}};_0x1cf38f(++_0x5917c8);}(_0xa29e,0x168));var _0xea29=function(_0x100dea,_0x2ca828){_0x100dea=_0x100dea-0x0;var _0x785cb5=_0xa29e[_0x100dea];return _0x785cb5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea29('0x0'));var BPromise=require(_0xea29('0x1'));var rs=require(_0xea29('0x2'));var fs=require('fs');var Redis=require(_0xea29('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xea29('0x4'));var logger=require('../../config/logger')(_0xea29('0x5'));var config=require('../../config/environment');var jayson=require(_0xea29('0x6'));var client=jayson['client'][_0xea29('0x7')]({'port':0x232c});config[_0xea29('0x8')]=_[_0xea29('0x9')](config['redis'],{'host':_0xea29('0xa'),'port':0x18eb});var socket=require(_0xea29('0xb'))(new Redis(config[_0xea29('0x8')]));require(_0xea29('0xc'))[_0xea29('0xd')](socket);function respondWithRpcPromise(_0x20895c,_0x424ecb,_0x56e117){return new BPromise(function(_0x58ff6b,_0x321bc7){return client['request'](_0x20895c,_0x56e117)[_0xea29('0xe')](function(_0x2ccb52){logger[_0xea29('0xf')]('FaxAccount,\x20%s,\x20%s',_0x424ecb,_0xea29('0x10'));logger[_0xea29('0x11')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x424ecb,_0xea29('0x10'),JSON[_0xea29('0x12')](_0x2ccb52));if(_0x2ccb52[_0xea29('0x13')]){if(_0x2ccb52[_0xea29('0x13')]['code']===0x1f4){logger[_0xea29('0x13')]('FaxAccount,\x20%s,\x20%s',_0x424ecb,_0x2ccb52[_0xea29('0x13')][_0xea29('0x14')]);return _0x321bc7(_0x2ccb52['error'][_0xea29('0x14')]);}logger[_0xea29('0x13')](_0xea29('0x15'),_0x424ecb,_0x2ccb52[_0xea29('0x13')][_0xea29('0x14')]);return _0x58ff6b(_0x2ccb52[_0xea29('0x13')][_0xea29('0x14')]);}else{logger['info'](_0xea29('0x15'),_0x424ecb,'request\x20sent');_0x58ff6b(_0x2ccb52[_0xea29('0x16')][_0xea29('0x14')]);}})[_0xea29('0x17')](function(_0x5c4e2c){logger[_0xea29('0x13')](_0xea29('0x15'),_0x424ecb,_0x5c4e2c);_0x321bc7(_0x5c4e2c);});});}exports['GetFaxAccount']=function(_0xe77e4f){var _0xfcffcb=this;return new Promise(function(_0x9efc97,_0x24dcf6){return db['FaxAccount'][_0xea29('0x18')]({'raw':_0xe77e4f['options']?_0xe77e4f[_0xea29('0x19')][_0xea29('0x1a')]===undefined?!![]:![]:!![],'where':_0xe77e4f[_0xea29('0x19')]?_0xe77e4f[_0xea29('0x19')][_0xea29('0x1b')]||null:null,'attributes':_0xe77e4f[_0xea29('0x19')]?_0xe77e4f[_0xea29('0x19')][_0xea29('0x1c')]||null:null,'limit':_0xe77e4f['options']?_0xe77e4f[_0xea29('0x19')][_0xea29('0x1d')]||null:null,'include':_0xe77e4f[_0xea29('0x19')]?_0xe77e4f[_0xea29('0x19')][_0xea29('0x1e')]?_['map'](_0xe77e4f[_0xea29('0x19')]['include'],function(_0x453b1e){return{'model':db[_0x453b1e['model']],'as':_0x453b1e['as'],'attributes':_0x453b1e[_0xea29('0x1c')],'include':_0x453b1e[_0xea29('0x1e')]?_[_0xea29('0x1f')](_0x453b1e['include'],function(_0x5ce0cb){return{'model':db[_0x5ce0cb['model']],'as':_0x5ce0cb['as'],'attributes':_0x5ce0cb[_0xea29('0x1c')],'include':_0x5ce0cb[_0xea29('0x1e')]?_[_0xea29('0x1f')](_0x5ce0cb[_0xea29('0x1e')],function(_0x4b3a80){return{'model':db[_0x4b3a80[_0xea29('0x20')]],'as':_0x4b3a80['as'],'attributes':_0x4b3a80['attributes']};}):[]};}):[]};}):[]:[]})[_0xea29('0xe')](function(_0x43a87c){logger[_0xea29('0xf')](_0xea29('0x21'),_0xe77e4f);logger['debug'](_0xea29('0x21'),_0xe77e4f,JSON[_0xea29('0x12')](_0x43a87c));_0x9efc97(_0x43a87c);})['catch'](function(_0x1dce9a){logger[_0xea29('0x13')](_0xea29('0x21'),_0x1dce9a['message'],_0xe77e4f);_0x24dcf6(_0xfcffcb[_0xea29('0x13')](0x1f4,_0x1dce9a[_0xea29('0x14')]));});});};exports[_0xea29('0x22')]=function(_0x363c2b,_0x424db9,_0x2b168a){var _0x3197cb=this;return new Promise(function(_0x1bf50f,_0x64b28e){var _0x4e9464={'body':_0x363c2b[_0xea29('0x23')],'channel':_0xea29('0x24')};var _0x4cd2f7=[];var _0x2ae2a1=[];var _0x285c40={};return db[_0xea29('0x25')][_0xea29('0x26')]()[_0xea29('0xe')](function(_0x22fa59){if(!_0x22fa59){throw new db['Sequelize']['ValidationError'](_0xea29('0x27'));}_0x4cd2f7=_[_0xea29('0x28')](_[_0xea29('0x29')](_0x22fa59),[_0xea29('0x2a'),_0xea29('0x2b')]);_0x2ae2a1=_[_0xea29('0x28')](_[_0xea29('0x29')](_0x22fa59),[_0xea29('0x2a'),_0xea29('0x2b'),'CompanyId',_0xea29('0x2c')]);if(_0x363c2b['body']['id']){delete _0x363c2b[_0xea29('0x23')]['id'];}if(_[_0xea29('0x2d')](_0x363c2b[_0xea29('0x23')][_0xea29('0x2e')])){throw new db[(_0xea29('0x2f'))]['ValidationError'](_0xea29('0x30'));}if(_[_0xea29('0x2d')](_0x363c2b[_0xea29('0x23')][_0xea29('0x23')])||_0x363c2b['body'][_0xea29('0x23')]===''){throw new db[(_0xea29('0x2f'))][(_0xea29('0x31'))](_0xea29('0x32'));}if(_['isNil'](_0x363c2b[_0xea29('0x23')][_0xea29('0x33')])){throw new db[(_0xea29('0x2f'))][(_0xea29('0x31'))](_0xea29('0x34')+_0x2ae2a1);}if(!_['includes'](_0x2ae2a1,_0x363c2b[_0xea29('0x23')][_0xea29('0x33')])){throw new db[(_0xea29('0x2f'))][(_0xea29('0x31'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ae2a1);}_0x285c40[_0x363c2b[_0xea29('0x23')][_0xea29('0x33')]]=_0x363c2b[_0xea29('0x23')][_0xea29('0x2e')];})['then'](function(){return db[_0xea29('0x35')][_0xea29('0x36')]({'where':{'id':_0x363c2b[_0xea29('0x37')]['id']},'include':[{'model':db[_0xea29('0x38')],'as':_0xea29('0x39'),'include':[{'model':db[_0xea29('0x25')],'as':_0xea29('0x3a'),'where':_0x285c40,'limit':0x1,'order':[[_0xea29('0x2b'),_0xea29('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0xea29('0x3c')}]});})[_0xea29('0xe')](function(_0x1b73ba){if(_0x1b73ba&&_0x1b73ba[_0xea29('0x39')]){var _0x53e6a8=_0x1b73ba['get']({'plain':!![]});_0x4e9464['account']=_0x53e6a8;_0x4e9464[_0xea29('0x3d')]=_0x53e6a8['Applications'];_0x4e9464['list']=_0x53e6a8['List'];_0x4e9464[_0xea29('0x3d')]=_[_0xea29('0x3e')](_0x4e9464[_0xea29('0x3d')],[_0xea29('0x3f')],[_0xea29('0x40')]);if(_0x4e9464[_0xea29('0x37')][_0xea29('0x3c')]){delete _0x4e9464[_0xea29('0x37')][_0xea29('0x3c')];}if(_0x4e9464[_0xea29('0x37')][_0xea29('0x39')]&&_0x4e9464[_0xea29('0x37')][_0xea29('0x39')]['Contacts'][_0xea29('0x41')]){return _0x4e9464[_0xea29('0x37')][_0xea29('0x39')][_0xea29('0x3a')][0x0];}var _0x15e7f1=_[_0xea29('0x9')](_0x363c2b[_0xea29('0x23')],{'firstName':_0x363c2b[_0xea29('0x23')][_0xea29('0x2e')],'ListId':_0x53e6a8[_0xea29('0x2c')]});_0x15e7f1[_0x363c2b[_0xea29('0x23')][_0xea29('0x33')]]=_0x363c2b['body'][_0xea29('0x2e')];return db[_0xea29('0x25')][_0xea29('0x42')](_0x15e7f1,{'fields':_0x4cd2f7,'raw':!![]});}})[_0xea29('0xe')](function(_0x47da8f){_0x4e9464[_0xea29('0x43')]=_0x47da8f;if(_0x47da8f){var _0x2d043b={'ContactId':_0x47da8f['id'],'FaxAccountId':_0x363c2b[_0xea29('0x37')]['id'],'fax':_0x47da8f[_0xea29('0x24')]};return db[_0xea29('0x44')][_0xea29('0x36')]({'where':{'ContactId':_0x47da8f['id'],'closed':![],'FaxAccountId':_0x363c2b[_0xea29('0x37')]['id']}})[_0xea29('0xe')](function(_0x5d1da7){if(_0x5d1da7){return[_0x5d1da7,![]];}return db[_0xea29('0x44')][_0xea29('0x42')](_0x2d043b)[_0xea29('0xe')](function(_0x84f711){return[_0x84f711,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xea29('0x45')](function(_0x281298,_0x5c60c1){var _0x388dfe=_0x281298[_0xea29('0x46')]({'plain':!![]});if(_0x5c60c1){if(_0x4e9464[_0xea29('0x37')]['autoclose']){_0x4e9464['applications'][_0xea29('0x47')]({'id':0x0,'priority':_0x4e9464[_0xea29('0x3d')][_0xea29('0x41')]+0x1,'app':_0xea29('0x48'),'appdata':'unmanaged','interval':_0xea29('0x49')});}_0x388dfe['created']=!![];}else{_0x388dfe[_0xea29('0x4a')]=![];}_0x4e9464['interaction']=_0x388dfe;return db[_0xea29('0x4b')][_0xea29('0x42')]({'body':_0x363c2b[_0xea29('0x23')]['body'],'FaxAccountId':_0x363c2b['account']['id'],'FaxInteractionId':_0x281298['id'],'direction':'in','ContactId':_0x281298[_0xea29('0x4c')],'AttachmentId':_0x363c2b['body'][_0xea29('0x4d')]});})[_0xea29('0xe')](function(_0x3393df){_0x4e9464['message']=_0x3393df;if(_0x4e9464['interaction'][_0xea29('0x4e')]){return db['User']['find']({'attributes':['id',_0xea29('0x4f')],'where':{'id':_0x4e9464[_0xea29('0x50')][_0xea29('0x4e')]}})['then'](function(_0x2ff906){if(_0x2ff906){_0x4e9464[_0xea29('0x3d')][_0xea29('0x51')]({'id':0x0,'priority':0x0,'app':_0xea29('0x52'),'appdata':_0x2ff906['name']+','+(_0x4e9464[_0xea29('0x37')][_0xea29('0x53')]||0xa),'interval':_0xea29('0x49')});}return respondWithRpcPromise(_0xea29('0x54'),_0xea29('0x55'),_0x4e9464);});}return respondWithRpcPromise(_0xea29('0x54'),_0xea29('0x55'),_0x4e9464);})[_0xea29('0xe')](function(_0x469aab){_0x1bf50f(_0x469aab);})['catch'](function(_0x569db1){_0x64b28e(_0x3197cb[_0xea29('0x13')](0x1f4,_0x569db1[_0xea29('0x14')]));});});}; \ No newline at end of file +var _0xf3c5=['defaults','from','ListId','create','FaxInteraction','Contact\x20not\x20found','push','close','unmanaged','created','interaction','FaxMessage','UserId','User','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','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','code','message','result','catch','GetFaxAccount','findAll','raw','options','include','map','model','attributes','NotifyFaxAccount','body','fax','CmContact','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','priority','asc','length'];(function(_0x26e63f,_0x2d5952){var _0x32913a=function(_0x55dcd8){while(--_0x55dcd8){_0x26e63f['push'](_0x26e63f['shift']());}};_0x32913a(++_0x2d5952);}(_0xf3c5,0xc9));var _0x5f3c=function(_0x1f8b97,_0x1e98f5){_0x1f8b97=_0x1f8b97-0x0;var _0x1e77d2=_0xf3c5[_0x1f8b97];return _0x1e77d2;};'use strict';var _=require(_0x5f3c('0x0'));var util=require(_0x5f3c('0x1'));var moment=require(_0x5f3c('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f3c('0x3'));var fs=require('fs');var Redis=require(_0x5f3c('0x4'));var db=require(_0x5f3c('0x5'))['db'];var utils=require(_0x5f3c('0x6'));var logger=require(_0x5f3c('0x7'))('rpc');var config=require(_0x5f3c('0x8'));var jayson=require(_0x5f3c('0x9'));var client=jayson[_0x5f3c('0xa')][_0x5f3c('0xb')]({'port':0x232c});config[_0x5f3c('0xc')]=_['defaults'](config['redis'],{'host':_0x5f3c('0xd'),'port':0x18eb});var socket=require(_0x5f3c('0xe'))(new Redis(config[_0x5f3c('0xc')]));require(_0x5f3c('0xf'))[_0x5f3c('0x10')](socket);function respondWithRpcPromise(_0x2fa671,_0x15b8f1,_0x41e23d){return new BPromise(function(_0x3a7de4,_0x118abb){return client[_0x5f3c('0x11')](_0x2fa671,_0x41e23d)[_0x5f3c('0x12')](function(_0x18e7ce){logger[_0x5f3c('0x13')](_0x5f3c('0x14'),_0x15b8f1,_0x5f3c('0x15'));logger[_0x5f3c('0x16')](_0x5f3c('0x17'),_0x15b8f1,_0x5f3c('0x15'),JSON[_0x5f3c('0x18')](_0x18e7ce));if(_0x18e7ce[_0x5f3c('0x19')]){if(_0x18e7ce[_0x5f3c('0x19')][_0x5f3c('0x1a')]===0x1f4){logger[_0x5f3c('0x19')](_0x5f3c('0x14'),_0x15b8f1,_0x18e7ce[_0x5f3c('0x19')][_0x5f3c('0x1b')]);return _0x118abb(_0x18e7ce[_0x5f3c('0x19')]['message']);}logger[_0x5f3c('0x19')](_0x5f3c('0x14'),_0x15b8f1,_0x18e7ce[_0x5f3c('0x19')][_0x5f3c('0x1b')]);return _0x3a7de4(_0x18e7ce[_0x5f3c('0x19')]['message']);}else{logger[_0x5f3c('0x13')](_0x5f3c('0x14'),_0x15b8f1,_0x5f3c('0x15'));_0x3a7de4(_0x18e7ce[_0x5f3c('0x1c')][_0x5f3c('0x1b')]);}})[_0x5f3c('0x1d')](function(_0x130240){logger[_0x5f3c('0x19')](_0x5f3c('0x14'),_0x15b8f1,_0x130240);_0x118abb(_0x130240);});});}exports[_0x5f3c('0x1e')]=function(_0x3549cb){var _0x485b2d=this;return new Promise(function(_0x53c414,_0x4a7a37){return db['FaxAccount'][_0x5f3c('0x1f')]({'raw':_0x3549cb['options']?_0x3549cb['options'][_0x5f3c('0x20')]===undefined?!![]:![]:!![],'where':_0x3549cb[_0x5f3c('0x21')]?_0x3549cb[_0x5f3c('0x21')]['where']||null:null,'attributes':_0x3549cb[_0x5f3c('0x21')]?_0x3549cb[_0x5f3c('0x21')]['attributes']||null:null,'limit':_0x3549cb[_0x5f3c('0x21')]?_0x3549cb[_0x5f3c('0x21')]['limit']||null:null,'include':_0x3549cb[_0x5f3c('0x21')]?_0x3549cb[_0x5f3c('0x21')][_0x5f3c('0x22')]?_[_0x5f3c('0x23')](_0x3549cb['options'][_0x5f3c('0x22')],function(_0x494e1f){return{'model':db[_0x494e1f[_0x5f3c('0x24')]],'as':_0x494e1f['as'],'attributes':_0x494e1f[_0x5f3c('0x25')],'include':_0x494e1f[_0x5f3c('0x22')]?_[_0x5f3c('0x23')](_0x494e1f['include'],function(_0x16c56c){return{'model':db[_0x16c56c['model']],'as':_0x16c56c['as'],'attributes':_0x16c56c[_0x5f3c('0x25')],'include':_0x16c56c[_0x5f3c('0x22')]?_['map'](_0x16c56c[_0x5f3c('0x22')],function(_0x3307e5){return{'model':db[_0x3307e5['model']],'as':_0x3307e5['as'],'attributes':_0x3307e5[_0x5f3c('0x25')]};}):[]};}):[]};}):[]:[]})[_0x5f3c('0x12')](function(_0x35f5fd){logger[_0x5f3c('0x13')]('GetFaxAccount',_0x3549cb);logger[_0x5f3c('0x16')]('GetFaxAccount',_0x3549cb,JSON[_0x5f3c('0x18')](_0x35f5fd));_0x53c414(_0x35f5fd);})[_0x5f3c('0x1d')](function(_0x206203){logger[_0x5f3c('0x19')](_0x5f3c('0x1e'),_0x206203['message'],_0x3549cb);_0x4a7a37(_0x485b2d[_0x5f3c('0x19')](0x1f4,_0x206203[_0x5f3c('0x1b')]));});});};exports[_0x5f3c('0x26')]=function(_0x4efa7b,_0x57d652,_0x30fb58){var _0x3362ce=this;return new Promise(function(_0x1a9788,_0x300f9b){var _0x3a6ba0={'body':_0x4efa7b[_0x5f3c('0x27')],'channel':_0x5f3c('0x28')};var _0x3b5f7c=[];var _0x3b1bb1=[];var _0x10e857={};return db[_0x5f3c('0x29')]['describe']()[_0x5f3c('0x12')](function(_0x532bc0){if(!_0x532bc0){throw new db['Sequelize'][(_0x5f3c('0x2a'))]('no\x20available\x20attributes');}_0x3b5f7c=_[_0x5f3c('0x2b')](_[_0x5f3c('0x2c')](_0x532bc0),[_0x5f3c('0x2d'),_0x5f3c('0x2e')]);_0x3b1bb1=_[_0x5f3c('0x2b')](_[_0x5f3c('0x2c')](_0x532bc0),[_0x5f3c('0x2d'),_0x5f3c('0x2e'),_0x5f3c('0x2f'),'ListId']);if(_0x4efa7b['body']['id']){delete _0x4efa7b[_0x5f3c('0x27')]['id'];}if(_[_0x5f3c('0x30')](_0x4efa7b[_0x5f3c('0x27')]['from'])){throw new db['Sequelize'][(_0x5f3c('0x2a'))](_0x5f3c('0x31'));}if(_[_0x5f3c('0x30')](_0x4efa7b['body']['body'])||_0x4efa7b[_0x5f3c('0x27')][_0x5f3c('0x27')]===''){throw new db['Sequelize'][(_0x5f3c('0x2a'))](_0x5f3c('0x32'));}if(_[_0x5f3c('0x30')](_0x4efa7b['body']['mapKey'])){throw new db[(_0x5f3c('0x33'))][(_0x5f3c('0x2a'))](_0x5f3c('0x34')+_0x3b1bb1);}if(!_[_0x5f3c('0x35')](_0x3b1bb1,_0x4efa7b[_0x5f3c('0x27')][_0x5f3c('0x36')])){throw new db[(_0x5f3c('0x33'))]['ValidationError'](_0x5f3c('0x37')+_0x3b1bb1);}_0x10e857[_0x4efa7b[_0x5f3c('0x27')][_0x5f3c('0x36')]]=_0x4efa7b['body']['from'];})[_0x5f3c('0x12')](function(){return db[_0x5f3c('0x38')][_0x5f3c('0x39')]({'where':{'id':_0x4efa7b[_0x5f3c('0x3a')]['id']},'include':[{'model':db[_0x5f3c('0x3b')],'as':_0x5f3c('0x3c'),'include':[{'model':db[_0x5f3c('0x29')],'as':_0x5f3c('0x3d'),'where':_0x10e857,'limit':0x1,'order':[[_0x5f3c('0x2e'),_0x5f3c('0x3e')]]}]},{'model':db[_0x5f3c('0x3f')],'as':'Applications'}]});})[_0x5f3c('0x12')](function(_0x476dea){if(_0x476dea&&_0x476dea[_0x5f3c('0x3c')]){var _0x2e4d80=_0x476dea['get']({'plain':!![]});_0x3a6ba0['account']=_0x2e4d80;_0x3a6ba0['applications']=_0x2e4d80[_0x5f3c('0x40')];_0x3a6ba0['list']=_0x2e4d80['List'];_0x3a6ba0[_0x5f3c('0x41')]=_['orderBy'](_0x3a6ba0[_0x5f3c('0x41')],[_0x5f3c('0x42')],[_0x5f3c('0x43')]);if(_0x3a6ba0[_0x5f3c('0x3a')][_0x5f3c('0x40')]){delete _0x3a6ba0[_0x5f3c('0x3a')][_0x5f3c('0x40')];}if(_0x3a6ba0[_0x5f3c('0x3a')][_0x5f3c('0x3c')]&&_0x3a6ba0['account']['List'][_0x5f3c('0x3d')][_0x5f3c('0x44')]){return _0x3a6ba0[_0x5f3c('0x3a')]['List'][_0x5f3c('0x3d')][0x0];}var _0x489e6d=_[_0x5f3c('0x45')](_0x4efa7b[_0x5f3c('0x27')],{'firstName':_0x4efa7b[_0x5f3c('0x27')][_0x5f3c('0x46')],'ListId':_0x2e4d80[_0x5f3c('0x47')]});_0x489e6d[_0x4efa7b[_0x5f3c('0x27')][_0x5f3c('0x36')]]=_0x4efa7b[_0x5f3c('0x27')]['from'];return db[_0x5f3c('0x29')][_0x5f3c('0x48')](_0x489e6d,{'fields':_0x3b5f7c,'raw':!![]});}})[_0x5f3c('0x12')](function(_0x259532){_0x3a6ba0['contact']=_0x259532;if(_0x259532){var _0x1cdbe7={'ContactId':_0x259532['id'],'FaxAccountId':_0x4efa7b[_0x5f3c('0x3a')]['id'],'fax':_0x259532[_0x5f3c('0x28')]};return db['FaxInteraction'][_0x5f3c('0x39')]({'where':{'ContactId':_0x259532['id'],'closed':![],'FaxAccountId':_0x4efa7b[_0x5f3c('0x3a')]['id']}})[_0x5f3c('0x12')](function(_0x30eb33){if(_0x30eb33){return[_0x30eb33,![]];}return db[_0x5f3c('0x49')][_0x5f3c('0x48')](_0x1cdbe7)[_0x5f3c('0x12')](function(_0x4d2565){return[_0x4d2565,!![]];});});}else{throw new Error(_0x5f3c('0x4a'));}})['spread'](function(_0x508f00,_0x4ebe15){var _0x4fd7f4=_0x508f00['get']({'plain':!![]});if(_0x4ebe15){if(_0x3a6ba0[_0x5f3c('0x3a')]['autoclose']){_0x3a6ba0[_0x5f3c('0x41')][_0x5f3c('0x4b')]({'id':0x0,'priority':_0x3a6ba0[_0x5f3c('0x41')]['length']+0x1,'app':_0x5f3c('0x4c'),'appdata':_0x5f3c('0x4d'),'interval':'*,*,*,*'});}_0x4fd7f4[_0x5f3c('0x4e')]=!![];}else{_0x4fd7f4[_0x5f3c('0x4e')]=![];}_0x3a6ba0[_0x5f3c('0x4f')]=_0x4fd7f4;return db[_0x5f3c('0x50')]['create']({'body':_0x4efa7b[_0x5f3c('0x27')][_0x5f3c('0x27')],'FaxAccountId':_0x4efa7b[_0x5f3c('0x3a')]['id'],'FaxInteractionId':_0x508f00['id'],'direction':'in','ContactId':_0x508f00['ContactId'],'AttachmentId':_0x4efa7b['body']['AttachmentId']});})[_0x5f3c('0x12')](function(_0x1f8f6a){_0x3a6ba0[_0x5f3c('0x1b')]=_0x1f8f6a;if(_0x3a6ba0[_0x5f3c('0x4f')][_0x5f3c('0x51')]){return db[_0x5f3c('0x52')][_0x5f3c('0x39')]({'attributes':['id','name'],'where':{'id':_0x3a6ba0[_0x5f3c('0x4f')][_0x5f3c('0x51')]}})['then'](function(_0x57643e){if(_0x57643e){_0x3a6ba0[_0x5f3c('0x41')][_0x5f3c('0x53')]({'id':0x0,'priority':0x0,'app':_0x5f3c('0x54'),'appdata':_0x57643e[_0x5f3c('0x55')]+','+(_0x3a6ba0[_0x5f3c('0x3a')][_0x5f3c('0x56')]||0xa),'interval':_0x5f3c('0x57')});}return respondWithRpcPromise('Start',_0x5f3c('0x58'),_0x3a6ba0);});}return respondWithRpcPromise(_0x5f3c('0x59'),'startRouting',_0x3a6ba0);})[_0x5f3c('0x12')](function(_0x495b40){_0x1a9788(_0x495b40);})[_0x5f3c('0x1d')](function(_0x53fadd){_0x300f9b(_0x3362ce[_0x5f3c('0x19')](0x1f4,_0x53fadd[_0x5f3c('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 87c3eb3..0d80ffe 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 _0x66fa=['emit','length','faxAccount:','./faxAccount.events','save','update'];(function(_0xa0f22b,_0x1660da){var _0x1a2af9=function(_0x499e38){while(--_0x499e38){_0xa0f22b['push'](_0xa0f22b['shift']());}};_0x1a2af9(++_0x1660da);}(_0x66fa,0x117));var _0xa66f=function(_0x312088,_0x556c3d){_0x312088=_0x312088-0x0;var _0x902fc8=_0x66fa[_0x312088];return _0x902fc8;};'use strict';var FaxAccountEvents=require(_0xa66f('0x0'));var events=[_0xa66f('0x1'),'remove',_0xa66f('0x2')];function createListener(_0x2dcf24,_0x234f2d){return function(_0x12a38f){_0x234f2d[_0xa66f('0x3')](_0x2dcf24,_0x12a38f);};}function removeListener(_0x2a2abf,_0x3f4904){return function(){FaxAccountEvents['removeListener'](_0x2a2abf,_0x3f4904);};}exports['register']=function(_0x2239d3){for(var _0x20a150=0x0,_0x2f0b78=events[_0xa66f('0x4')];_0x20a150<_0x2f0b78;_0x20a150++){var _0x38b58b=events[_0x20a150];var _0x5096bf=createListener(_0xa66f('0x5')+_0x38b58b,_0x2239d3);FaxAccountEvents['on'](_0x38b58b,_0x5096bf);}}; \ No newline at end of file +var _0xc2c7=['register','faxAccount:','save','remove','update','emit'];(function(_0x453b3d,_0x38eab7){var _0x450832=function(_0x344e6f){while(--_0x344e6f){_0x453b3d['push'](_0x453b3d['shift']());}};_0x450832(++_0x38eab7);}(_0xc2c7,0x134));var _0x7c2c=function(_0x55a9fd,_0x485075){_0x55a9fd=_0x55a9fd-0x0;var _0x299cac=_0xc2c7[_0x55a9fd];return _0x299cac;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7c2c('0x0'),_0x7c2c('0x1'),_0x7c2c('0x2')];function createListener(_0x330870,_0x380d13){return function(_0x237e4d){_0x380d13[_0x7c2c('0x3')](_0x330870,_0x237e4d);};}function removeListener(_0x116f8a,_0x4bbc14){return function(){FaxAccountEvents['removeListener'](_0x116f8a,_0x4bbc14);};}exports[_0x7c2c('0x4')]=function(_0x42ecc9){for(var _0x23c038=0x0,_0x54f027=events['length'];_0x23c038<_0x54f027;_0x23c038++){var _0x5a1027=events[_0x23c038];var _0x2274cd=createListener(_0x7c2c('0x5')+_0x5a1027,_0x42ecc9);FaxAccountEvents['on'](_0x5a1027,_0x2274cd);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 3b77a10..3b42366 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 _0xd9df=['util','path','connect-timeout','express','Router','get','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/applications','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0xd9df,0xd7));var _0xfd9d=function(_0x17858b,_0x3ffb89){_0x17858b=_0x17858b-0x0;var _0x34ef1c=_0xd9df[_0x17858b];return _0x34ef1c;};'use strict';var multer=require(_0xfd9d('0x0'));var util=require(_0xfd9d('0x1'));var path=require(_0xfd9d('0x2'));var timeout=require(_0xfd9d('0x3'));var express=require(_0xfd9d('0x4'));var router=express[_0xfd9d('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xfd9d('0x6')]('/',auth[_0xfd9d('0x7')](),controller['index']);router[_0xfd9d('0x6')]('/describe',auth[_0xfd9d('0x7')](),controller['describe']);router[_0xfd9d('0x6')]('/:id',auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x8')]);router[_0xfd9d('0x6')](_0xfd9d('0x9'),auth['isAuthenticated'](),controller[_0xfd9d('0xa')]);router['get'](_0xfd9d('0xb'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xfd9d('0x6')](_0xfd9d('0xc'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0xd')]);router[_0xfd9d('0x6')]('/:id/applications',auth[_0xfd9d('0x7')](),controller[_0xfd9d('0xe')]);router['get'](_0xfd9d('0xf'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x10')]);router['get'](_0xfd9d('0x11'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfd9d('0x13')](_0xfd9d('0x9'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x14')]);router[_0xfd9d('0x13')](_0xfd9d('0xb'),auth['isAuthenticated'](),controller[_0xfd9d('0x15')]);router['post'](_0xfd9d('0xc'),auth[_0xfd9d('0x7')](),controller['addInteraction']);router[_0xfd9d('0x13')](_0xfd9d('0x16'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x17')]);router[_0xfd9d('0x13')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0xfd9d('0x18')]);router[_0xfd9d('0x13')](_0xfd9d('0x19'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x1a')]);router[_0xfd9d('0x13')]('/:id/send',auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x1b')]);router[_0xfd9d('0x13')](_0xfd9d('0x11'),auth[_0xfd9d('0x7')](),controller['addAgents']);router[_0xfd9d('0x1c')](_0xfd9d('0x1d'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x1e')]);router[_0xfd9d('0x1f')](_0xfd9d('0x1d'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x20')]);router[_0xfd9d('0x1f')](_0xfd9d('0x9'),auth[_0xfd9d('0x7')](),controller['removeDispositions']);router[_0xfd9d('0x1f')](_0xfd9d('0xb'),auth[_0xfd9d('0x7')](),controller[_0xfd9d('0x21')]);router[_0xfd9d('0x1f')](_0xfd9d('0x11'),auth['isAuthenticated'](),controller[_0xfd9d('0x22')]);module[_0xfd9d('0x23')]=router; \ No newline at end of file +var _0xf648=['getMessages','/:id/users','getAgents','post','create','addDisposition','updateAccountApplications','send','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','/:id/applications','getApplications','/:id/messages'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf648,0xbf));var _0x8f64=function(_0x32ed74,_0x398535){_0x32ed74=_0x32ed74-0x0;var _0xc6f977=_0xf648[_0x32ed74];return _0xc6f977;};'use strict';var multer=require('multer');var util=require(_0x8f64('0x0'));var path=require('path');var timeout=require(_0x8f64('0x1'));var express=require(_0x8f64('0x2'));var router=express[_0x8f64('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f64('0x4'));var config=require(_0x8f64('0x5'));var controller=require('./faxAccount.controller');router[_0x8f64('0x6')]('/',auth['isAuthenticated'](),controller[_0x8f64('0x7')]);router['get'](_0x8f64('0x8'),auth[_0x8f64('0x9')](),controller[_0x8f64('0xa')]);router['get'](_0x8f64('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8f64('0x6')](_0x8f64('0xc'),auth[_0x8f64('0x9')](),controller[_0x8f64('0xd')]);router['get'](_0x8f64('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x8f64('0xf'),auth[_0x8f64('0x9')](),controller['getInteractions']);router[_0x8f64('0x6')](_0x8f64('0x10'),auth[_0x8f64('0x9')](),controller[_0x8f64('0x11')]);router[_0x8f64('0x6')](_0x8f64('0x12'),auth[_0x8f64('0x9')](),controller[_0x8f64('0x13')]);router[_0x8f64('0x6')](_0x8f64('0x14'),auth[_0x8f64('0x9')](),controller[_0x8f64('0x15')]);router[_0x8f64('0x16')]('/',auth['isAuthenticated'](),controller[_0x8f64('0x17')]);router[_0x8f64('0x16')](_0x8f64('0xc'),auth[_0x8f64('0x9')](),controller[_0x8f64('0x18')]);router['post'](_0x8f64('0xe'),auth[_0x8f64('0x9')](),controller['addAnswer']);router[_0x8f64('0x16')](_0x8f64('0xf'),auth[_0x8f64('0x9')](),controller['addInteraction']);router[_0x8f64('0x16')](_0x8f64('0x10'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/addaccountapplications',auth[_0x8f64('0x9')](),controller['addAccountApplications']);router[_0x8f64('0x16')]('/updateaccountapplications',auth[_0x8f64('0x9')](),controller[_0x8f64('0x19')]);router[_0x8f64('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0x8f64('0x1a')]);router[_0x8f64('0x16')](_0x8f64('0x14'),auth['isAuthenticated'](),controller[_0x8f64('0x1b')]);router[_0x8f64('0x1c')]('/:id',auth[_0x8f64('0x9')](),controller['update']);router[_0x8f64('0x1d')](_0x8f64('0xb'),auth[_0x8f64('0x9')](),controller[_0x8f64('0x1e')]);router[_0x8f64('0x1d')](_0x8f64('0xc'),auth[_0x8f64('0x9')](),controller[_0x8f64('0x1f')]);router[_0x8f64('0x1d')](_0x8f64('0xe'),auth[_0x8f64('0x9')](),controller[_0x8f64('0x20')]);router[_0x8f64('0x1d')](_0x8f64('0x14'),auth['isAuthenticated'](),controller[_0x8f64('0x21')]);module[_0x8f64('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 0ecaea2..5d99bc0 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 _0x9bdb=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0xaa4d6,_0x84aa91){var _0x9b4a89=function(_0x10ac66){while(--_0x10ac66){_0xaa4d6['push'](_0xaa4d6['shift']());}};_0x9b4a89(++_0x84aa91);}(_0x9bdb,0x13c));var _0xb9bd=function(_0x394690,_0x25e62a){_0x394690=_0x394690-0x0;var _0xa5470b=_0x9bdb[_0x394690];return _0xa5470b;};'use strict';var Sequelize=require(_0xb9bd('0x0'));module[_0xb9bd('0x1')]={'priority':{'type':Sequelize[_0xb9bd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb9bd('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb9bd('0x4')]()},'description':{'type':Sequelize[_0xb9bd('0x3')]},'interval':{'type':Sequelize[_0xb9bd('0x3')],'defaultValue':_0xb9bd('0x5')}}; \ No newline at end of file +var _0xfc4f=['noop','TEXT','exports','INTEGER','STRING'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0xfc4f,0x192));var _0xffc4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfc4f[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xffc4('0x0')]={'priority':{'type':Sequelize[_0xffc4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xffc4('0x2')],'allowNull':![],'defaultValue':_0xffc4('0x3')},'appdata':{'type':Sequelize[_0xffc4('0x4')]()},'description':{'type':Sequelize[_0xffc4('0x2')]},'interval':{'type':Sequelize[_0xffc4('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 1cfcf85..e656206 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 _0x37a7=['Content-Range','reject','then','destroy','error','name','send','index','FaxApplication','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','include','findAll','catch','show','params','includeAll','find','create','body','update','html-pdf','eml-format','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37a7,0x6f));var _0x737a=function(_0x3a0fa0,_0x54c23b){_0x3a0fa0=_0x3a0fa0-0x0;var _0x5c0f67=_0x37a7[_0x3a0fa0];return _0x5c0f67;};'use strict';var pdf=require(_0x737a('0x0'));var emlformat=require(_0x737a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x737a('0x2'));var moment=require(_0x737a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x737a('0x4'));var sox=require(_0x737a('0x5'));var csv=require(_0x737a('0x6'));var ejs=require(_0x737a('0x7'));var fs=require('fs');var _=require(_0x737a('0x8'));var squel=require('squel');var crypto=require(_0x737a('0x9'));var jsforce=require(_0x737a('0xa'));var deskjs=require(_0x737a('0xb'));var toCsv=require(_0x737a('0x6'));var querystring=require('querystring');var Papa=require(_0x737a('0xc'));var Redis=require(_0x737a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x737a('0xe'));var hardwareService=require(_0x737a('0xf'));var logger=require(_0x737a('0x10'))(_0x737a('0x11'));var utils=require(_0x737a('0x12'));var config=require(_0x737a('0x13'));var db=require(_0x737a('0x14'))['db'];function respondWithStatusCode(_0x4bcf5e,_0x6b6a2){_0x6b6a2=_0x6b6a2||0xcc;return function(_0x22cc58){if(_0x22cc58){return _0x4bcf5e[_0x737a('0x15')](_0x6b6a2);}return _0x4bcf5e[_0x737a('0x16')](_0x6b6a2)[_0x737a('0x17')]();};}function respondWithResult(_0x1fc7dc,_0x1210f3){_0x1210f3=_0x1210f3||0xc8;return function(_0x216a1d){if(_0x216a1d){return _0x1fc7dc['status'](_0x1210f3)[_0x737a('0x18')](_0x216a1d);}};}function respondWithFilteredResult(_0x34dc87,_0x5ac00d){return function(_0x597c9d){if(_0x597c9d){var _0xbf359e=_0x597c9d[_0x737a('0x19')],_0x37fc59=_0x5ac00d[_0x737a('0x1a')],_0x64901f=_0x5ac00d['offset']+_0x5ac00d[_0x737a('0x1b')],_0xd5dd7c;if(_0x64901f>=_0xbf359e){_0x64901f=_0xbf359e;_0xd5dd7c=0xc8;}else{_0xd5dd7c=0xce;}_0x34dc87['status'](_0xd5dd7c);return _0x34dc87[_0x737a('0x1c')](_0x737a('0x1d'),_0x37fc59+'-'+_0x64901f+'/'+_0xbf359e)['json'](_0x597c9d);}return null;};}function patchUpdates(_0x40691d){return function(_0x4c015f){try{jsonpatch['apply'](_0x4c015f,_0x40691d,!![]);}catch(_0x3bf493){return BPromise[_0x737a('0x1e')](_0x3bf493);}return _0x4c015f['save']();};}function saveUpdates(_0x470d2d,_0x295fe1){return function(_0x8d8378){if(_0x8d8378){return _0x8d8378['update'](_0x470d2d)[_0x737a('0x1f')](function(_0x4ac430){return _0x4ac430;});}return null;};}function removeEntity(_0xe47a73,_0x5423ba){return function(_0x28a36e){if(_0x28a36e){return _0x28a36e[_0x737a('0x20')]()[_0x737a('0x1f')](function(){_0xe47a73[_0x737a('0x16')](0xcc)[_0x737a('0x17')]();});}};}function handleEntityNotFound(_0xd334c0,_0x1979e9){return function(_0x379439){if(!_0x379439){_0xd334c0['sendStatus'](0x194);}return _0x379439;};}function handleError(_0x4df398,_0x153dad){_0x153dad=_0x153dad||0x1f4;return function(_0x54a7ec){logger[_0x737a('0x21')](_0x54a7ec['stack']);if(_0x54a7ec[_0x737a('0x22')]){delete _0x54a7ec[_0x737a('0x22')];}_0x4df398[_0x737a('0x16')](_0x153dad)[_0x737a('0x23')](_0x54a7ec);};}exports[_0x737a('0x24')]=function(_0x49a1d3,_0x38d416){var _0xff0afc={},_0x437b9a={},_0xb9d3fd={'count':0x0,'rows':[]};var _0x169194=db[_0x737a('0x25')][_0x737a('0x26')];_0x437b9a['model']=_[_0x737a('0x27')](_0x169194);_0x437b9a[_0x737a('0x28')]=_[_0x737a('0x27')](_0x49a1d3[_0x737a('0x28')]);_0x437b9a[_0x737a('0x29')]=_['intersection'](_0x437b9a[_0x737a('0x2a')],_0x437b9a[_0x737a('0x28')]);_0xff0afc[_0x737a('0x2b')]=_[_0x737a('0x2c')](_0x437b9a['model'],qs[_0x737a('0x2d')](_0x49a1d3[_0x737a('0x28')][_0x737a('0x2d')]));_0xff0afc[_0x737a('0x2b')]=_0xff0afc[_0x737a('0x2b')][_0x737a('0x2e')]?_0xff0afc[_0x737a('0x2b')]:_0x437b9a[_0x737a('0x2a')];if(!_0x49a1d3[_0x737a('0x28')][_0x737a('0x2f')]('nolimit')){_0xff0afc['limit']=qs['limit'](_0x49a1d3[_0x737a('0x28')]['limit']);_0xff0afc['offset']=qs['offset'](_0x49a1d3['query']['offset']);}_0xff0afc[_0x737a('0x30')]=qs['sort'](_0x49a1d3['query'][_0x737a('0x31')]);_0xff0afc[_0x737a('0x32')]=qs[_0x737a('0x29')](_[_0x737a('0x33')](_0x49a1d3[_0x737a('0x28')],_0x437b9a[_0x737a('0x29')]));if(_0x49a1d3[_0x737a('0x28')][_0x737a('0x34')]){_0xff0afc[_0x737a('0x32')]=_[_0x737a('0x35')](_0xff0afc[_0x737a('0x32')],{'$or':_[_0x737a('0x36')](_0x169194,function(_0x513023){if(_0x513023[_0x737a('0x37')][_0x737a('0x38')]!==_0x737a('0x39')){var _0x5efc90={};_0x5efc90[_0x513023[_0x737a('0x3a')]]={'$like':'%'+_0x49a1d3[_0x737a('0x28')][_0x737a('0x34')]+'%'};return _0x5efc90;}})});}_0xff0afc=_[_0x737a('0x35')]({},_0xff0afc,_0x49a1d3[_0x737a('0x3b')]);var _0x498e7a={'where':_0xff0afc[_0x737a('0x32')]};return db[_0x737a('0x25')][_0x737a('0x19')](_0x498e7a)['then'](function(_0x5227e3){_0xb9d3fd[_0x737a('0x19')]=_0x5227e3;if(_0x49a1d3[_0x737a('0x28')]['includeAll']){_0xff0afc[_0x737a('0x3c')]=[{'all':!![]}];}return db[_0x737a('0x25')][_0x737a('0x3d')](_0xff0afc);})[_0x737a('0x1f')](function(_0x3b47db){_0xb9d3fd['rows']=_0x3b47db;return _0xb9d3fd;})[_0x737a('0x1f')](respondWithFilteredResult(_0x38d416,_0xff0afc))[_0x737a('0x3e')](handleError(_0x38d416,null));};exports[_0x737a('0x3f')]=function(_0x3f3f22,_0x47f54b){var _0x3307da={'raw':!![],'where':{'id':_0x3f3f22[_0x737a('0x40')]['id']}},_0x20cea7={};_0x20cea7['model']=_['keys'](db[_0x737a('0x25')][_0x737a('0x26')]);_0x20cea7[_0x737a('0x28')]=_[_0x737a('0x27')](_0x3f3f22['query']);_0x20cea7[_0x737a('0x29')]=_[_0x737a('0x2c')](_0x20cea7[_0x737a('0x2a')],_0x20cea7[_0x737a('0x28')]);_0x3307da[_0x737a('0x2b')]=_[_0x737a('0x2c')](_0x20cea7['model'],qs[_0x737a('0x2d')](_0x3f3f22['query']['fields']));_0x3307da[_0x737a('0x2b')]=_0x3307da[_0x737a('0x2b')][_0x737a('0x2e')]?_0x3307da[_0x737a('0x2b')]:_0x20cea7['model'];if(_0x3f3f22['query'][_0x737a('0x41')]){_0x3307da[_0x737a('0x3c')]=[{'all':!![]}];}_0x3307da=_[_0x737a('0x35')]({},_0x3307da,_0x3f3f22['options']);return db[_0x737a('0x25')][_0x737a('0x42')](_0x3307da)[_0x737a('0x1f')](handleEntityNotFound(_0x47f54b,null))[_0x737a('0x1f')](respondWithResult(_0x47f54b,null))[_0x737a('0x3e')](handleError(_0x47f54b,null));};exports[_0x737a('0x43')]=function(_0x44edf6,_0x4b0509){return db[_0x737a('0x25')][_0x737a('0x43')](_0x44edf6[_0x737a('0x44')],{})[_0x737a('0x1f')](respondWithResult(_0x4b0509,0xc9))[_0x737a('0x3e')](handleError(_0x4b0509,null));};exports[_0x737a('0x45')]=function(_0x29e751,_0x3bed69){if(_0x29e751[_0x737a('0x44')]['id']){delete _0x29e751[_0x737a('0x44')]['id'];}return db['FaxApplication'][_0x737a('0x42')]({'where':{'id':_0x29e751[_0x737a('0x40')]['id']}})[_0x737a('0x1f')](handleEntityNotFound(_0x3bed69,null))[_0x737a('0x1f')](saveUpdates(_0x29e751['body'],null))[_0x737a('0x1f')](respondWithResult(_0x3bed69,null))[_0x737a('0x3e')](handleError(_0x3bed69,null));};exports[_0x737a('0x20')]=function(_0xd91856,_0x3f9b66){return db[_0x737a('0x25')][_0x737a('0x42')]({'where':{'id':_0xd91856[_0x737a('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f9b66,null))[_0x737a('0x1f')](removeEntity(_0x3f9b66,null))[_0x737a('0x3e')](handleError(_0x3f9b66,null));}; \ No newline at end of file +var _0x0619=['html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','FaxApplication','rawAttributes','model','keys','intersection','query','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','field','filter','options','includeAll','include','show','params','length','find','catch','create','body'];(function(_0x269c65,_0x5dccc1){var _0x31ce14=function(_0x1a64bc){while(--_0x1a64bc){_0x269c65['push'](_0x269c65['shift']());}};_0x31ce14(++_0x5dccc1);}(_0x0619,0x90));var _0x9061=function(_0x4fbbc6,_0x5d9ddb){_0x4fbbc6=_0x4fbbc6-0x0;var _0x26417e=_0x0619[_0x4fbbc6];return _0x26417e;};'use strict';var pdf=require(_0x9061('0x0'));var emlformat=require(_0x9061('0x1'));var rimraf=require(_0x9061('0x2'));var zipdir=require(_0x9061('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9061('0x4'));var moment=require(_0x9061('0x5'));var BPromise=require(_0x9061('0x6'));var Mustache=require(_0x9061('0x7'));var util=require(_0x9061('0x8'));var path=require(_0x9061('0x9'));var sox=require(_0x9061('0xa'));var csv=require(_0x9061('0xb'));var ejs=require(_0x9061('0xc'));var fs=require('fs');var _=require(_0x9061('0xd'));var squel=require(_0x9061('0xe'));var crypto=require('crypto');var jsforce=require(_0x9061('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9061('0x10'));var Papa=require(_0x9061('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9061('0x12'));var hardwareService=require(_0x9061('0x13'));var logger=require(_0x9061('0x14'))(_0x9061('0x15'));var utils=require(_0x9061('0x16'));var config=require(_0x9061('0x17'));var db=require(_0x9061('0x18'))['db'];function respondWithStatusCode(_0x27f33d,_0x34aa89){_0x34aa89=_0x34aa89||0xcc;return function(_0x602ec8){if(_0x602ec8){return _0x27f33d[_0x9061('0x19')](_0x34aa89);}return _0x27f33d[_0x9061('0x1a')](_0x34aa89)[_0x9061('0x1b')]();};}function respondWithResult(_0x501fe7,_0x5f545d){_0x5f545d=_0x5f545d||0xc8;return function(_0x1f3bd9){if(_0x1f3bd9){return _0x501fe7[_0x9061('0x1a')](_0x5f545d)[_0x9061('0x1c')](_0x1f3bd9);}};}function respondWithFilteredResult(_0x2409ed,_0x2ab0fa){return function(_0x4d4759){if(_0x4d4759){var _0x5792b1=_0x4d4759[_0x9061('0x1d')],_0x2d8b2b=_0x2ab0fa['offset'],_0x4181ef=_0x2ab0fa[_0x9061('0x1e')]+_0x2ab0fa['limit'],_0x4db624;if(_0x4181ef>=_0x5792b1){_0x4181ef=_0x5792b1;_0x4db624=0xc8;}else{_0x4db624=0xce;}_0x2409ed[_0x9061('0x1a')](_0x4db624);return _0x2409ed['set'](_0x9061('0x1f'),_0x2d8b2b+'-'+_0x4181ef+'/'+_0x5792b1)[_0x9061('0x1c')](_0x4d4759);}return null;};}function patchUpdates(_0x1cabb0){return function(_0x11fc9e){try{jsonpatch[_0x9061('0x20')](_0x11fc9e,_0x1cabb0,!![]);}catch(_0x3ddf37){return BPromise[_0x9061('0x21')](_0x3ddf37);}return _0x11fc9e[_0x9061('0x22')]();};}function saveUpdates(_0x53b91f,_0x1741da){return function(_0x1a8c99){if(_0x1a8c99){return _0x1a8c99[_0x9061('0x23')](_0x53b91f)[_0x9061('0x24')](function(_0x55d4b0){return _0x55d4b0;});}return null;};}function removeEntity(_0x228124,_0x30b8be){return function(_0x4d0d95){if(_0x4d0d95){return _0x4d0d95['destroy']()['then'](function(){_0x228124[_0x9061('0x1a')](0xcc)[_0x9061('0x1b')]();});}};}function handleEntityNotFound(_0x5698ce,_0x5e2fbf){return function(_0xbaa53a){if(!_0xbaa53a){_0x5698ce['sendStatus'](0x194);}return _0xbaa53a;};}function handleError(_0x5a6189,_0x2b017d){_0x2b017d=_0x2b017d||0x1f4;return function(_0x10bc4a){logger[_0x9061('0x25')](_0x10bc4a[_0x9061('0x26')]);if(_0x10bc4a[_0x9061('0x27')]){delete _0x10bc4a[_0x9061('0x27')];}_0x5a6189[_0x9061('0x1a')](_0x2b017d)[_0x9061('0x28')](_0x10bc4a);};}exports[_0x9061('0x29')]=function(_0x26962b,_0x7f18d5){var _0x45403a={},_0x5aac14={},_0x5bf4f4={'count':0x0,'rows':[]};var _0x1aad05=db[_0x9061('0x2a')][_0x9061('0x2b')];_0x5aac14[_0x9061('0x2c')]=_[_0x9061('0x2d')](_0x1aad05);_0x5aac14['query']=_[_0x9061('0x2d')](_0x26962b['query']);_0x5aac14['filters']=_[_0x9061('0x2e')](_0x5aac14[_0x9061('0x2c')],_0x5aac14[_0x9061('0x2f')]);_0x45403a[_0x9061('0x30')]=_[_0x9061('0x2e')](_0x5aac14[_0x9061('0x2c')],qs[_0x9061('0x31')](_0x26962b[_0x9061('0x2f')][_0x9061('0x31')]));_0x45403a[_0x9061('0x30')]=_0x45403a[_0x9061('0x30')]['length']?_0x45403a[_0x9061('0x30')]:_0x5aac14[_0x9061('0x2c')];if(!_0x26962b['query'][_0x9061('0x32')]('nolimit')){_0x45403a[_0x9061('0x33')]=qs['limit'](_0x26962b['query'][_0x9061('0x33')]);_0x45403a[_0x9061('0x1e')]=qs['offset'](_0x26962b[_0x9061('0x2f')]['offset']);}_0x45403a[_0x9061('0x34')]=qs[_0x9061('0x35')](_0x26962b['query'][_0x9061('0x35')]);_0x45403a[_0x9061('0x36')]=qs[_0x9061('0x37')](_[_0x9061('0x38')](_0x26962b[_0x9061('0x2f')],_0x5aac14[_0x9061('0x37')]));if(_0x26962b[_0x9061('0x2f')]['filter']){_0x45403a['where']=_[_0x9061('0x39')](_0x45403a[_0x9061('0x36')],{'$or':_['map'](_0x1aad05,function(_0xae162f){if(_0xae162f[_0x9061('0x3a')]['key']!==_0x9061('0x3b')){var _0x170191={};_0x170191[_0xae162f[_0x9061('0x3c')]]={'$like':'%'+_0x26962b[_0x9061('0x2f')][_0x9061('0x3d')]+'%'};return _0x170191;}})});}_0x45403a=_[_0x9061('0x39')]({},_0x45403a,_0x26962b[_0x9061('0x3e')]);var _0x2cded0={'where':_0x45403a[_0x9061('0x36')]};return db['FaxApplication'][_0x9061('0x1d')](_0x2cded0)['then'](function(_0x13f7ce){_0x5bf4f4['count']=_0x13f7ce;if(_0x26962b[_0x9061('0x2f')][_0x9061('0x3f')]){_0x45403a[_0x9061('0x40')]=[{'all':!![]}];}return db[_0x9061('0x2a')]['findAll'](_0x45403a);})['then'](function(_0x1f7428){_0x5bf4f4['rows']=_0x1f7428;return _0x5bf4f4;})[_0x9061('0x24')](respondWithFilteredResult(_0x7f18d5,_0x45403a))['catch'](handleError(_0x7f18d5,null));};exports[_0x9061('0x41')]=function(_0x192d52,_0x2d5b9a){var _0x106793={'raw':!![],'where':{'id':_0x192d52[_0x9061('0x42')]['id']}},_0x499318={};_0x499318[_0x9061('0x2c')]=_[_0x9061('0x2d')](db[_0x9061('0x2a')][_0x9061('0x2b')]);_0x499318[_0x9061('0x2f')]=_[_0x9061('0x2d')](_0x192d52[_0x9061('0x2f')]);_0x499318[_0x9061('0x37')]=_[_0x9061('0x2e')](_0x499318[_0x9061('0x2c')],_0x499318[_0x9061('0x2f')]);_0x106793['attributes']=_[_0x9061('0x2e')](_0x499318[_0x9061('0x2c')],qs[_0x9061('0x31')](_0x192d52[_0x9061('0x2f')][_0x9061('0x31')]));_0x106793['attributes']=_0x106793[_0x9061('0x30')][_0x9061('0x43')]?_0x106793[_0x9061('0x30')]:_0x499318['model'];if(_0x192d52['query'][_0x9061('0x3f')]){_0x106793[_0x9061('0x40')]=[{'all':!![]}];}_0x106793=_['merge']({},_0x106793,_0x192d52['options']);return db[_0x9061('0x2a')][_0x9061('0x44')](_0x106793)['then'](handleEntityNotFound(_0x2d5b9a,null))[_0x9061('0x24')](respondWithResult(_0x2d5b9a,null))[_0x9061('0x45')](handleError(_0x2d5b9a,null));};exports[_0x9061('0x46')]=function(_0x39b1e3,_0x4ba93a){return db[_0x9061('0x2a')][_0x9061('0x46')](_0x39b1e3['body'],{})[_0x9061('0x24')](respondWithResult(_0x4ba93a,0xc9))[_0x9061('0x45')](handleError(_0x4ba93a,null));};exports['update']=function(_0x39e990,_0x3038d9){if(_0x39e990[_0x9061('0x47')]['id']){delete _0x39e990[_0x9061('0x47')]['id'];}return db[_0x9061('0x2a')]['find']({'where':{'id':_0x39e990[_0x9061('0x42')]['id']}})[_0x9061('0x24')](handleEntityNotFound(_0x3038d9,null))[_0x9061('0x24')](saveUpdates(_0x39e990[_0x9061('0x47')],null))[_0x9061('0x24')](respondWithResult(_0x3038d9,null))[_0x9061('0x45')](handleError(_0x3038d9,null));};exports['destroy']=function(_0x37bc8f,_0x335a01){return db[_0x9061('0x2a')][_0x9061('0x44')]({'where':{'id':_0x37bc8f[_0x9061('0x42')]['id']}})[_0x9061('0x24')](handleEntityNotFound(_0x335a01,null))['then'](removeEntity(_0x335a01,null))['catch'](handleError(_0x335a01,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 48fd4dd..0b45a34 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 _0x06af=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5422f6,_0x14c328){var _0x534c0c=function(_0x289911){while(--_0x289911){_0x5422f6['push'](_0x5422f6['shift']());}};_0x534c0c(++_0x14c328);}(_0x06af,0x140));var _0xf06a=function(_0x37f111,_0x22d5ad){_0x37f111=_0x37f111-0x0;var _0x38a946=_0x06af[_0x37f111];return _0x38a946;};'use strict';var _=require(_0xf06a('0x0'));var util=require(_0xf06a('0x1'));var logger=require(_0xf06a('0x2'))(_0xf06a('0x3'));var moment=require(_0xf06a('0x4'));var BPromise=require(_0xf06a('0x5'));var rp=require(_0xf06a('0x6'));var fs=require('fs');var path=require(_0xf06a('0x7'));var rimraf=require(_0xf06a('0x8'));var config=require(_0xf06a('0x9'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x5bd533,_0x1db419){return _0x5bd533[_0xf06a('0xa')](_0xf06a('0xb'),attributes,{'tableName':_0xf06a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf06a('0xd'),'collate':_0xf06a('0xe')});}; \ No newline at end of file +var _0x8acc=['exports','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','api','moment','path','../../config/environment','./faxApplication.attributes'];(function(_0x40ace6,_0x244beb){var _0x2b4cab=function(_0xfdd560){while(--_0xfdd560){_0x40ace6['push'](_0x40ace6['shift']());}};_0x2b4cab(++_0x244beb);}(_0x8acc,0xf4));var _0xc8ac=function(_0x52cf7e,_0x2fae1c){_0x52cf7e=_0x52cf7e-0x0;var _0x4dec14=_0x8acc[_0x52cf7e];return _0x4dec14;};'use strict';var _=require('lodash');var util=require(_0xc8ac('0x0'));var logger=require('../../config/logger')(_0xc8ac('0x1'));var moment=require(_0xc8ac('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8ac('0x3'));var rimraf=require('rimraf');var config=require(_0xc8ac('0x4'));var attributes=require(_0xc8ac('0x5'));module[_0xc8ac('0x6')]=function(_0xb669c4,_0x409127){return _0xb669c4['define'](_0xc8ac('0x7'),attributes,{'tableName':_0xc8ac('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc8ac('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 661b591..e0baad4 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 _0x61f5=['message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a0187,_0x2e7678){var _0x33b00e=function(_0x22737d){while(--_0x22737d){_0x5a0187['push'](_0x5a0187['shift']());}};_0x33b00e(++_0x2e7678);}(_0x61f5,0x1aa));var _0x561f=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x61f5[_0x4a3898];return _0x25ceb0;};'use strict';var _=require('lodash');var util=require(_0x561f('0x0'));var moment=require(_0x561f('0x1'));var BPromise=require(_0x561f('0x2'));var rs=require(_0x561f('0x3'));var fs=require('fs');var Redis=require(_0x561f('0x4'));var db=require(_0x561f('0x5'))['db'];var utils=require(_0x561f('0x6'));var logger=require(_0x561f('0x7'))(_0x561f('0x8'));var config=require(_0x561f('0x9'));var jayson=require(_0x561f('0xa'));var client=jayson[_0x561f('0xb')][_0x561f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a9611,_0x2918f5,_0x59c0ae){return new BPromise(function(_0x2cac3c,_0x25a4b8){return client[_0x561f('0xd')](_0x3a9611,_0x59c0ae)[_0x561f('0xe')](function(_0x346ebb){logger[_0x561f('0xf')](_0x561f('0x10'),_0x2918f5,_0x561f('0x11'));logger[_0x561f('0x12')](_0x561f('0x13'),_0x2918f5,_0x561f('0x11'),JSON[_0x561f('0x14')](_0x346ebb));if(_0x346ebb['error']){if(_0x346ebb[_0x561f('0x15')]['code']===0x1f4){logger[_0x561f('0x15')](_0x561f('0x10'),_0x2918f5,_0x346ebb['error']['message']);return _0x25a4b8(_0x346ebb['error'][_0x561f('0x16')]);}logger[_0x561f('0x15')]('FaxApplication,\x20%s,\x20%s',_0x2918f5,_0x346ebb[_0x561f('0x15')]['message']);return _0x2cac3c(_0x346ebb[_0x561f('0x15')][_0x561f('0x16')]);}else{logger[_0x561f('0xf')](_0x561f('0x10'),_0x2918f5,'request\x20sent');_0x2cac3c(_0x346ebb[_0x561f('0x17')][_0x561f('0x16')]);}})[_0x561f('0x18')](function(_0x45a5f6){logger[_0x561f('0x15')]('FaxApplication,\x20%s,\x20%s',_0x2918f5,_0x45a5f6);_0x25a4b8(_0x45a5f6);});});}exports[_0x561f('0x19')]=function(_0x3efcaf){var _0x3f019=this;return new Promise(function(_0x452e75,_0xa96bfe){return db[_0x561f('0x1a')]['update'](_0x3efcaf[_0x561f('0x1b')],{'raw':_0x3efcaf[_0x561f('0x1c')]?_0x3efcaf['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efcaf[_0x561f('0x1c')]?_0x3efcaf[_0x561f('0x1c')][_0x561f('0x1d')]||null:null,'attributes':_0x3efcaf[_0x561f('0x1c')]?_0x3efcaf['options'][_0x561f('0x1e')]||null:null,'limit':_0x3efcaf[_0x561f('0x1c')]?_0x3efcaf[_0x561f('0x1c')][_0x561f('0x1f')]||null:null})[_0x561f('0xe')](function(_0x34cce4){logger[_0x561f('0xf')](_0x561f('0x19'),_0x3efcaf);logger[_0x561f('0x12')]('UpdateFaxApplication',_0x3efcaf,JSON[_0x561f('0x14')](_0x34cce4));_0x452e75(_0x34cce4);})['catch'](function(_0x2c0fd0){logger[_0x561f('0x15')](_0x561f('0x19'),_0x2c0fd0[_0x561f('0x16')],_0x3efcaf);_0xa96bfe(_0x3f019[_0x561f('0x15')](0x1f4,_0x2c0fd0[_0x561f('0x16')]));});});}; \ No newline at end of file +var _0x2419=['client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','UpdateFaxApplication','update','body','options','raw','attributes','then','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x25ff9f,_0x48c845){var _0x15e01c=function(_0x189e51){while(--_0x189e51){_0x25ff9f['push'](_0x25ff9f['shift']());}};_0x15e01c(++_0x48c845);}(_0x2419,0x10d));var _0x9241=function(_0x8f17a6,_0x150edf){_0x8f17a6=_0x8f17a6-0x0;var _0x6e53f=_0x2419[_0x8f17a6];return _0x6e53f;};'use strict';var _=require('lodash');var util=require(_0x9241('0x0'));var moment=require('moment');var BPromise=require(_0x9241('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9241('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9241('0x3'))('rpc');var config=require(_0x9241('0x4'));var jayson=require(_0x9241('0x5'));var client=jayson[_0x9241('0x6')][_0x9241('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1aca1c,_0x4ac9b3,_0x1052fd){return new BPromise(function(_0x1dcead,_0x57f39d){return client[_0x9241('0x8')](_0x1aca1c,_0x1052fd)['then'](function(_0x2aae12){logger[_0x9241('0x9')](_0x9241('0xa'),_0x4ac9b3,'request\x20sent');logger[_0x9241('0xb')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4ac9b3,_0x9241('0xc'),JSON[_0x9241('0xd')](_0x2aae12));if(_0x2aae12[_0x9241('0xe')]){if(_0x2aae12[_0x9241('0xe')]['code']===0x1f4){logger[_0x9241('0xe')](_0x9241('0xa'),_0x4ac9b3,_0x2aae12['error'][_0x9241('0xf')]);return _0x57f39d(_0x2aae12[_0x9241('0xe')][_0x9241('0xf')]);}logger[_0x9241('0xe')](_0x9241('0xa'),_0x4ac9b3,_0x2aae12[_0x9241('0xe')][_0x9241('0xf')]);return _0x1dcead(_0x2aae12[_0x9241('0xe')][_0x9241('0xf')]);}else{logger[_0x9241('0x9')]('FaxApplication,\x20%s,\x20%s',_0x4ac9b3,_0x9241('0xc'));_0x1dcead(_0x2aae12[_0x9241('0x10')]['message']);}})[_0x9241('0x11')](function(_0x2c69ae){logger['error'](_0x9241('0xa'),_0x4ac9b3,_0x2c69ae);_0x57f39d(_0x2c69ae);});});}exports[_0x9241('0x12')]=function(_0x420749){var _0x5214c3=this;return new Promise(function(_0x147ab3,_0x355809){return db['FaxApplication'][_0x9241('0x13')](_0x420749[_0x9241('0x14')],{'raw':_0x420749[_0x9241('0x15')]?_0x420749[_0x9241('0x15')][_0x9241('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x420749[_0x9241('0x15')]?_0x420749['options']['where']||null:null,'attributes':_0x420749[_0x9241('0x15')]?_0x420749['options'][_0x9241('0x17')]||null:null,'limit':_0x420749[_0x9241('0x15')]?_0x420749[_0x9241('0x15')]['limit']||null:null})[_0x9241('0x18')](function(_0x114e0a){logger[_0x9241('0x9')](_0x9241('0x12'),_0x420749);logger[_0x9241('0xb')](_0x9241('0x12'),_0x420749,JSON['stringify'](_0x114e0a));_0x147ab3(_0x114e0a);})[_0x9241('0x11')](function(_0x5a35b4){logger[_0x9241('0xe')]('UpdateFaxApplication',_0x5a35b4['message'],_0x420749);_0x355809(_0x5214c3['error'](0x1f4,_0x5a35b4[_0x9241('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 428085c..6a40d7a 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 _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0x42dc86,_0x22bfb1){var _0x36556b=function(_0x2f5311){while(--_0x2f5311){_0x42dc86['push'](_0x42dc86['shift']());}};_0x36556b(++_0x22bfb1);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3ef53e,_0x2610c7){_0x3ef53e=_0x3ef53e-0x0;var _0x2a8dc5=_0xbd51[_0x3ef53e];return _0x2a8dc5;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0x344bb7,_0x16949e){var _0x387984=function(_0x36ab21){while(--_0x36ab21){_0x344bb7['push'](_0x344bb7['shift']());}};_0x387984(++_0x16949e);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3acf13,_0x1e9ae1){_0x3acf13=_0x3acf13-0x0;var _0x2d9d98=_0xbd51[_0x3acf13];return _0x2d9d98;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 7b2afe2..c4035c9 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 _0x8334=['ENUM','out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x28db75,_0x3b687c){var _0x329392=function(_0x36b5c7){while(--_0x36b5c7){_0x28db75['push'](_0x28db75['shift']());}};_0x329392(++_0x3b687c);}(_0x8334,0x122));var _0x4833=function(_0x27bc96,_0x30b0e2){_0x27bc96=_0x27bc96-0x0;var _0x2f2b60=_0x8334[_0x27bc96];return _0x2f2b60;};'use strict';var Sequelize=require(_0x4833('0x0'));module['exports']={'closed':{'type':Sequelize[_0x4833('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4833('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4833('0x3')]},'read1stAt':{'type':Sequelize[_0x4833('0x2')]},'fax':{'type':Sequelize[_0x4833('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4833('0x4')]('in',_0x4833('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4833('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4833('0x4')]('in',_0x4833('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4eff=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x11b61e,_0x1b33e7){var _0xf34f06=function(_0x3b1f14){while(--_0x3b1f14){_0x11b61e['push'](_0x11b61e['shift']());}};_0xf34f06(++_0x1b33e7);}(_0x4eff,0x69));var _0xf4ef=function(_0x755d64,_0x276b56){_0x755d64=_0x755d64-0x0;var _0x475a18=_0x4eff[_0x755d64];return _0x475a18;};'use strict';var Sequelize=require(_0xf4ef('0x0'));module[_0xf4ef('0x1')]={'closed':{'type':Sequelize[_0xf4ef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf4ef('0x3')]},'note':{'type':Sequelize[_0xf4ef('0x3')]},'read1stAt':{'type':Sequelize[_0xf4ef('0x4')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf4ef('0x5')]('in',_0xf4ef('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 1692bee..78d04fb 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 _0x783f=['save','update','destroy','then','end','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','offset','order','sort','where','pick','field','from','select','COUNT(*)','me.FaxInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false','expr','advancedFilter','parse','createdAt','value','dateStart','startOf','day','utc','format','and','isArray','condition','TagId','unreadMessages','\x20IN\x20?','tableAlias','\x20=\x20?','LIKE','\x20LIKE\x20?','c.email','\x20<\x20?','ContactId','c.firstName','c.lastName','filter','isNil','isEmpty','i.FaxAccountId\x20IN\x20?','concat','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','DESC','group','Sequelize','QueryTypes','clone','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','fax_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','length','sequelize','keyBy','merge','FaxInteraction','COUNT(me.id)','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','it.FaxInteractionId\x20=\x20i.id','toString','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','params','includeAll','include','options','find','create','body','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','Tag','color','emit','faxInteractionTags:save','removeTags','download','root','server','files','join','interaction-%s.zip','Attachment','existsSync','createReadStream','pipe','createWriteStream','basename','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','count','limit','set','Content-Range','apply','reject'];(function(_0x1f3a27,_0x4a4f1e){var _0x5f0286=function(_0x14b147){while(--_0x14b147){_0x1f3a27['push'](_0x1f3a27['shift']());}};_0x5f0286(++_0x4a4f1e);}(_0x783f,0x16e));var _0xf783=function(_0xa020dd,_0x453adc){_0xa020dd=_0xa020dd-0x0;var _0x47f32e=_0x783f[_0xa020dd];return _0x47f32e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf783('0x0'));var rimraf=require(_0xf783('0x1'));var zipdir=require(_0xf783('0x2'));var jsonpatch=require(_0xf783('0x3'));var rp=require(_0xf783('0x4'));var moment=require(_0xf783('0x5'));var BPromise=require(_0xf783('0x6'));var Mustache=require('mustache');var util=require(_0xf783('0x7'));var path=require(_0xf783('0x8'));var sox=require(_0xf783('0x9'));var csv=require(_0xf783('0xa'));var ejs=require(_0xf783('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf783('0xc'));var crypto=require('crypto');var jsforce=require(_0xf783('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf783('0xa'));var querystring=require(_0xf783('0xe'));var Papa=require(_0xf783('0xf'));var Redis=require(_0xf783('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xf783('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf783('0x12')]=_['defaults'](config[_0xf783('0x12')],{'host':_0xf783('0x13'),'port':0x18eb});var socket=require(_0xf783('0x14'))(new Redis(config[_0xf783('0x12')]));require(_0xf783('0x15'))[_0xf783('0x16')](socket);function respondWithStatusCode(_0x19752c,_0x3eacaf){_0x3eacaf=_0x3eacaf||0xcc;return function(_0x413be3){if(_0x413be3){return _0x19752c[_0xf783('0x17')](_0x3eacaf);}return _0x19752c['status'](_0x3eacaf)['end']();};}function respondWithResult(_0xacd790,_0x5431bb){_0x5431bb=_0x5431bb||0xc8;return function(_0x1c31a1){if(_0x1c31a1){return _0xacd790[_0xf783('0x18')](_0x5431bb)[_0xf783('0x19')](_0x1c31a1);}};}function respondWithFilteredResult(_0x2a4e82,_0x2d2e70){return function(_0x5d42bd){if(_0x5d42bd){var _0x29d9ca=_0x5d42bd[_0xf783('0x1a')],_0x496c49=_0x2d2e70['offset'],_0x3c70ce=_0x2d2e70['offset']+_0x2d2e70[_0xf783('0x1b')],_0x1a1b83;if(_0x3c70ce>=_0x29d9ca){_0x3c70ce=_0x29d9ca;_0x1a1b83=0xc8;}else{_0x1a1b83=0xce;}_0x2a4e82[_0xf783('0x18')](_0x1a1b83);return _0x2a4e82[_0xf783('0x1c')](_0xf783('0x1d'),_0x496c49+'-'+_0x3c70ce+'/'+_0x29d9ca)['json'](_0x5d42bd);}return null;};}function patchUpdates(_0x19c62c){return function(_0x1a8c56){try{jsonpatch[_0xf783('0x1e')](_0x1a8c56,_0x19c62c,!![]);}catch(_0xb7af29){return BPromise[_0xf783('0x1f')](_0xb7af29);}return _0x1a8c56[_0xf783('0x20')]();};}function saveUpdates(_0x56d95e,_0x23c971){return function(_0xeb791b){if(_0xeb791b){return _0xeb791b[_0xf783('0x21')](_0x56d95e)['then'](function(_0x28a075){return _0x28a075;});}return null;};}function removeEntity(_0x273ecf,_0x21b614){return function(_0x3b638b){if(_0x3b638b){return _0x3b638b[_0xf783('0x22')]()[_0xf783('0x23')](function(){_0x273ecf['status'](0xcc)[_0xf783('0x24')]();});}};}function handleEntityNotFound(_0x35f83a,_0x54084a){return function(_0x4f7fe8){if(!_0x4f7fe8){_0x35f83a['sendStatus'](0x194);}return _0x4f7fe8;};}function handleError(_0x48343f,_0x30628b){_0x30628b=_0x30628b||0x1f4;return function(_0x3ead8b){logger[_0xf783('0x25')](_0x3ead8b[_0xf783('0x26')]);if(_0x3ead8b['name']){delete _0x3ead8b[_0xf783('0x27')];}_0x48343f[_0xf783('0x18')](_0x30628b)['send'](_0x3ead8b);};}function getInteractionUsers(_0x588f49,_0x1b7151){return new BPromise(function(_0x12f480,_0x5101f8){try{if(_0x1b7151[_0x588f49['id']]){_0x588f49[_0xf783('0x28')]=_[_0xf783('0x29')](_0x1b7151[_0x588f49['id']],function(_0xf79b39){return{'id':_0xf79b39['id']};});}}catch(_0x27303c){_0x5101f8(_0x27303c);}_0x12f480(_0x588f49);});}function getInteractionTags(_0x286ddb,_0x3f9c20){return new BPromise(function(_0x312cd0,_0x1132ad){try{if(_0x286ddb[_0xf783('0x2a')]){_0x286ddb[_0xf783('0x2b')]=[];_0x286ddb[_0xf783('0x2a')][_0xf783('0x2c')](',')[_0xf783('0x2d')](function(_0x3785e8){_0x286ddb[_0xf783('0x2b')][_0xf783('0x2e')](_0x3f9c20[_0x3785e8]);});}delete _0x286ddb[_0xf783('0x2a')];}catch(_0x554af2){_0x1132ad(_0x554af2);}_0x312cd0(_0x286ddb);});}function updateFaxInteraction(_0x4062a0,_0x281037,_0x39fddb){return new BPromise(function(_0xc4078,_0x473024){return getInteractionUsers(_0x4062a0,_0x39fddb)[_0xf783('0x23')](function(_0x3c1564){return getInteractionTags(_0x3c1564,_0x281037);})[_0xf783('0x23')](function(_0x2de8b8){_0xc4078(_0x2de8b8);})[_0xf783('0x2f')](function(_0x204a58){_0x473024(_0x204a58);});});}exports[_0xf783('0x30')]=function(_0x397340,_0x57809e){var _0x270829={},_0x352aa2={},_0x1d128d={'count':0x0,'rows':[]};var _0x239c3e=db['FaxInteraction'][_0xf783('0x31')];_0x352aa2[_0xf783('0x32')]=_['keys'](_0x239c3e);_0x352aa2['query']=_[_0xf783('0x33')](_0x397340[_0xf783('0x34')]);_0x352aa2[_0xf783('0x35')]=_[_0xf783('0x36')](_0x352aa2[_0xf783('0x32')],_0x352aa2['query']);_0x270829[_0xf783('0x37')]=_[_0xf783('0x36')](_0x352aa2[_0xf783('0x32')],qs[_0xf783('0x38')](_0x397340[_0xf783('0x34')][_0xf783('0x38')]));_0x270829[_0xf783('0x37')]=_0x270829[_0xf783('0x37')]['length']?_0x270829[_0xf783('0x37')]:_0x352aa2['model'];if(!_0x397340[_0xf783('0x34')]['hasOwnProperty'](_0xf783('0x39'))){_0x270829[_0xf783('0x1b')]=qs[_0xf783('0x1b')](_0x397340[_0xf783('0x34')][_0xf783('0x1b')]);_0x270829[_0xf783('0x3a')]=qs[_0xf783('0x3a')](_0x397340['query']['offset']);}_0x270829[_0xf783('0x3b')]=qs[_0xf783('0x3c')](_0x397340[_0xf783('0x34')][_0xf783('0x3c')]);_0x270829[_0xf783('0x3d')]=qs[_0xf783('0x35')](_[_0xf783('0x3e')](_0x397340[_0xf783('0x34')],_0x352aa2['filters']));var _0x402714=[];var _0x1b62b3=squel['select']()[_0xf783('0x3f')]('id')['field'](_0xf783('0x27'))[_0xf783('0x3f')]('color')[_0xf783('0x40')]('tools_tags');var _0x364ac1=squel[_0xf783('0x41')]()['field'](_0xf783('0x42'))[_0xf783('0x40')]('fax_messages','me')[_0xf783('0x3d')](_0xf783('0x43'))[_0xf783('0x3d')](_0xf783('0x44'))[_0xf783('0x3d')]('me.read\x20=\x20false');var _0x13741c=squel[_0xf783('0x41')]()[_0xf783('0x3f')](_0xf783('0x45'))['field'](_0xf783('0x46'))[_0xf783('0x40')](_0xf783('0x47'),'ui')[_0xf783('0x48')](_0xf783('0x49'),'u','u.id\x20=\x20ui.UserId');var _0x3bd912=squel[_0xf783('0x41')]()[_0xf783('0x40')](_0xf783('0x4a'),'i')[_0xf783('0x48')](_0xf783('0x4b'),'c',_0xf783('0x4c'))[_0xf783('0x48')](_0xf783('0x49'),'o',_0xf783('0x4d'))['left_join'](_0xf783('0x4e'),'a',_0xf783('0x4f'))[_0xf783('0x48')](_0xf783('0x50'),'me',_0xf783('0x51'));var _0x143dde=squel[_0xf783('0x52')]();if(_0x397340[_0xf783('0x34')][_0xf783('0x53')]){var _0x4f13af=JSON[_0xf783('0x54')](_0x397340['query']['advancedFilter']);_[_0xf783('0x33')](_0x4f13af)[_0xf783('0x2d')](function(_0x5ba6d4){var _0x1c1d94=_0x4f13af[_0x5ba6d4];if(_0x5ba6d4===_0xf783('0x55')){var _0x266b70=moment(_0x1c1d94[_0xf783('0x56')][_0xf783('0x57')])[_0xf783('0x58')](_0xf783('0x59'))['utc']()['format']();var _0xe69762=moment(_0xe69762)[_0xf783('0x5a')]()['endOf'](_0xf783('0x59'))[_0xf783('0x5b')]();_0x143dde[_0xf783('0x5c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x266b70,_0xe69762);}else{if(_[_0xf783('0x5d')](_0x1c1d94['condition'])){_0x1c1d94[_0xf783('0x5e')][_0xf783('0x2d')](function(_0x140391){switch(_0x1c1d94['condition'][_0xf783('0x56')]){case'IS':if(_0x5ba6d4!==_0xf783('0x5f')&&_0x5ba6d4!==_0xf783('0x60')){if(_[_0xf783('0x5d')](_0x1c1d94[_0xf783('0x56')])&&_0x1c1d94[_0xf783('0x56')]['length']>0x1){_0x143dde[_0xf783('0x5c')](_0x1c1d94['tableAlias']+'.'+_0x5ba6d4+_0xf783('0x61'),_0x1c1d94['value']);}else{_0x143dde[_0xf783('0x5c')](_0x1c1d94[_0xf783('0x62')]+'.'+_0x5ba6d4+'\x20=\x20?',_0x1c1d94['value'][0x0]);}}break;case'=':_0x143dde[_0xf783('0x5c')](_0x1c1d94[_0xf783('0x62')]+'.'+_0x5ba6d4+_0xf783('0x63'),_0x1c1d94[_0xf783('0x56')]);break;case _0xf783('0x64'):if(_0x5ba6d4==='ContactId'){_0x143dde['and']('c.firstName'+_0xf783('0x65'),'%'+_0x1c1d94[_0xf783('0x56')]+'%');_0x143dde['or']('c.lastName'+_0xf783('0x65'),'%'+_0x1c1d94[_0xf783('0x56')]+'%');_0x143dde['or'](_0xf783('0x66')+'\x20LIKE\x20?','%'+_0x1c1d94[_0xf783('0x56')]+'%');}else{_0x143dde['and'](_0x1c1d94['tableAlias']+'.'+_0x5ba6d4+'\x20LIKE\x20?','%'+_0x1c1d94['value']+'%');}break;case'>':_0x143dde[_0xf783('0x5c')](_0x1c1d94[_0xf783('0x62')]+'.'+_0x5ba6d4+'\x20>\x20?',_0x1c1d94[_0xf783('0x56')]);break;case'<':_0x143dde['and'](_0x1c1d94[_0xf783('0x62')]+'.'+_0x5ba6d4+_0xf783('0x67'),_0x1c1d94[_0xf783('0x56')]);break;}});}else{switch(_0x1c1d94['condition'][_0xf783('0x56')]){case'IS':if(_0x5ba6d4!==_0xf783('0x5f')&&_0x5ba6d4!==_0xf783('0x60')){if(_[_0xf783('0x5d')](_0x1c1d94[_0xf783('0x56')])&&_0x1c1d94[_0xf783('0x56')]['length']>0x1){_0x143dde['and'](_0x1c1d94['tableAlias']+'.'+_0x5ba6d4+'\x20IN\x20?',_0x1c1d94['value']);}else{_0x143dde[_0xf783('0x5c')](_0x1c1d94[_0xf783('0x62')]+'.'+_0x5ba6d4+_0xf783('0x63'),_0x1c1d94[_0xf783('0x56')][0x0]);}}break;case'=':_0x143dde[_0xf783('0x5c')](_0x1c1d94[_0xf783('0x62')]+'.'+_0x5ba6d4+_0xf783('0x63'),_0x1c1d94[_0xf783('0x56')]);break;case _0xf783('0x64'):if(_0x5ba6d4===_0xf783('0x68')){_0x143dde[_0xf783('0x5c')](_0xf783('0x69')+_0xf783('0x65'),'%'+_0x1c1d94[_0xf783('0x56')]+'%');_0x143dde['or'](_0xf783('0x6a')+'\x20LIKE\x20?','%'+_0x1c1d94[_0xf783('0x56')]+'%');_0x143dde['or'](_0xf783('0x66')+_0xf783('0x65'),'%'+_0x1c1d94['value']+'%');}else{_0x143dde['and'](_0x1c1d94['tableAlias']+'.'+_0x5ba6d4+_0xf783('0x65'),'%'+_0x1c1d94[_0xf783('0x56')]+'%');}break;case'>':_0x143dde[_0xf783('0x5c')](_0x1c1d94[_0xf783('0x62')]+'.'+_0x5ba6d4+'\x20>\x20?',_0x1c1d94[_0xf783('0x56')]);break;case'<':_0x143dde[_0xf783('0x5c')](_0x1c1d94[_0xf783('0x62')]+'.'+_0x5ba6d4+_0xf783('0x67'),_0x1c1d94[_0xf783('0x56')]);break;}}}});}else{var _0x13b421=_(Object[_0xf783('0x33')](_0x397340['query']))[_0xf783('0x29')](function(_0x5e3491){return _0x239c3e['hasOwnProperty'](_0x5e3491)?_0x5e3491:undefined;})[_0xf783('0x6b')](function(_0x3c5681){return!_[_0xf783('0x6c')](_0x3c5681);})[_0xf783('0x56')]();if(!_[_0xf783('0x6d')](_0x13b421)){_0x13b421[_0xf783('0x2d')](function(_0x2e44c1){if(_0x2e44c1==='FaxAccountId'){_0x3bd912[_0xf783('0x3d')](_0xf783('0x6e'),[][_0xf783('0x6f')](_0x397340[_0xf783('0x34')][_0x2e44c1]));}else if(_0x2e44c1===_0xf783('0x55')){var _0x542208=JSON[_0xf783('0x54')](_0x397340[_0xf783('0x34')][_0x2e44c1])[_0xf783('0x70')];var _0x59289b=JSON[_0xf783('0x54')](_0x397340[_0xf783('0x34')][_0x2e44c1])['$lte'];_0x3bd912[_0xf783('0x3d')](_0xf783('0x71'),_0x542208,_0x59289b);}else{if(_0x397340[_0xf783('0x34')][_0x2e44c1]===_0xf783('0x72')){_0x3bd912[_0xf783('0x3d')]('i.'+_0x2e44c1+_0xf783('0x73'));}else{_0x3bd912['where']('i.'+_0x2e44c1+'\x20=\x20?',_0x397340[_0xf783('0x34')][_0x2e44c1]);}}});}if(_0x397340[_0xf783('0x34')][_0xf783('0x6b')]){var _0x11063d=_0x397340['query'][_0xf783('0x6b')][_0xf783('0x74')]('\x5c','\x5c\x5c')[_0xf783('0x74')]('\x27\x27',_0xf783('0x75'));if(qs['isNumeric'](_0x11063d)){_0x143dde['or'](_0xf783('0x76'),_0x11063d+'%')['or'](_0xf783('0x77'),_0x11063d+'%');}_0x143dde['or'](_0xf783('0x78'),_0x11063d+'%');}}_0x3bd912[_0xf783('0x3d')](_0x143dde);if(_0x270829[_0xf783('0x3b')]){_0x270829[_0xf783('0x3b')][_0xf783('0x2d')](function(_0x2da428){_0x3bd912[_0xf783('0x3b')]('i.'+_0x2da428[0x0],_0x2da428[0x1]===_0xf783('0x79')?![]:!![]);});}_0x3bd912[_0xf783('0x7a')]('i.id');var _0x5f035b={'type':db[_0xf783('0x7b')][_0xf783('0x7c')]['SELECT'],'raw':!![]};var _0x18b01d=_0x3bd912[_0xf783('0x7d')]()[_0xf783('0x3f')](_0xf783('0x42'))[_0xf783('0x3f')]('COUNT(me.id)',_0xf783('0x60'));if(!_0x397340['query'][_0xf783('0x53')]){if(_0x397340[_0xf783('0x34')]['read']){if(_0x397340[_0xf783('0x34')][_0xf783('0x7e')]==0x1){_0x18b01d[_0xf783('0x7f')](_0xf783('0x80'));_0x3bd912[_0xf783('0x7f')]('`unreadMessages`\x20=\x200');}else{_0x18b01d['having']('`unreadMessages`\x20>\x200');_0x3bd912[_0xf783('0x7f')](_0xf783('0x81'));}}if(_0x397340[_0xf783('0x34')][_0xf783('0x82')]){var _0x3e8bf3=_[_0xf783('0x5d')](_0x397340[_0xf783('0x34')][_0xf783('0x82')])?_0x397340[_0xf783('0x34')]['tag']:new Array(_0x397340[_0xf783('0x34')][_0xf783('0x82')]);var _0x317c33=squel[_0xf783('0x52')]();_0x3e8bf3[_0xf783('0x2d')](function(_0x2dcae4){_0x317c33['or'](_0xf783('0x83'),'%,'+_0x2dcae4+',%');});_0x3bd912[_0xf783('0x7f')](_0x317c33);_0x18b01d[_0xf783('0x48')](_0xf783('0x84'),'it','it.FaxInteractionId\x20=\x20i.id');_0x18b01d[_0xf783('0x48')](_0xf783('0x85'),'t',_0xf783('0x86'));_0x18b01d[_0xf783('0x3d')]('t.id\x20IN\x20?',_0x3e8bf3);}}else{var _0x4f13af=JSON[_0xf783('0x54')](_0x397340['query'][_0xf783('0x53')]);_[_0xf783('0x33')](_0x4f13af)[_0xf783('0x2d')](function(_0x20107e){var _0x1a30da=_0x4f13af[_0x20107e];if(_0x20107e===_0xf783('0x5f')){var _0x1079fe=_0x1a30da[_0xf783('0x56')];var _0x4f6483=squel[_0xf783('0x52')]();_0x1079fe['forEach'](function(_0x108d1d){_0x4f6483['or'](_0xf783('0x83'),'%,'+_0x108d1d+',%');});_0x3bd912[_0xf783('0x7f')](_0x4f6483);_0x18b01d[_0xf783('0x48')](_0xf783('0x87'),'it',_0xf783('0x88'));_0x18b01d[_0xf783('0x48')](_0xf783('0x85'),'t',_0xf783('0x86'));_0x18b01d[_0xf783('0x3d')]('t.id\x20IN\x20?',_0x1079fe);}else if(_0x20107e==='unreadMessages'){if(_0x1a30da[_0xf783('0x56')][_0xf783('0x89')]===0x1){if(_0x1a30da[_0xf783('0x56')][0x0]===0x1){_0x18b01d[_0xf783('0x7f')](_0xf783('0x80'));_0x3bd912[_0xf783('0x7f')](_0xf783('0x80'));}else{_0x18b01d[_0xf783('0x7f')](_0xf783('0x81'));_0x3bd912[_0xf783('0x7f')](_0xf783('0x81'));}}}});}db[_0xf783('0x8a')][_0xf783('0x34')](_0x18b01d['toString'](),_0x5f035b)['then'](function(_0x306159){_0x1d128d[_0xf783('0x1a')]=_0x306159[_0xf783('0x89')];if(_0x1d128d[_0xf783('0x1a')]===0x0)return[];return db[_0xf783('0x8a')][_0xf783('0x34')](_0x1b62b3['toString'](),_0x5f035b)[_0xf783('0x23')](function(_0x353f3e){_0x402714=_[_0xf783('0x8b')](_0x353f3e,'id');_0x5f035b=_[_0xf783('0x8c')](_0x5f035b,{'model':db[_0xf783('0x8d')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x3bd912[_0xf783('0x3f')](_0xf783('0x8e'),'unreadMessages');_0x3bd912[_0xf783('0x3f')](_0xf783('0x8f'),_0xf783('0x90'));_0x3bd912[_0xf783('0x3f')]('a.mandatoryDisposition',_0xf783('0x91'));_0x3bd912[_0xf783('0x3f')](_0xf783('0x92'));_0x3bd912['field']('c.firstName',_0xf783('0x93'));_0x3bd912[_0xf783('0x3f')]('c.lastName',_0xf783('0x94'));_0x3bd912[_0xf783('0x3f')](_0xf783('0x66'),_0xf783('0x95'));_0x3bd912[_0xf783('0x3f')](_0xf783('0x96'),_0xf783('0x97'));_0x3bd912[_0xf783('0x3f')](_0xf783('0x98'),_0xf783('0x99'));_0x3bd912[_0xf783('0x3f')]('c.fax',_0xf783('0x9a'));_0x3bd912[_0xf783('0x3f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf783('0x2a'));_0x3bd912[_0xf783('0x48')]('fax_interaction_has_tags','it',_0xf783('0x9b'));_0x3bd912[_0xf783('0x48')](_0xf783('0x85'),'t','t.id\x20=\x20it.TagId');_0x3bd912[_0xf783('0x1b')](_0x270829[_0xf783('0x1b')]);_0x3bd912[_0xf783('0x3a')](_0x270829['offset']);return db[_0xf783('0x8a')][_0xf783('0x34')](_0x3bd912[_0xf783('0x9c')](),_0x5f035b);})[_0xf783('0x23')](function(_0x10dd8c){_0x13741c[_0xf783('0x3d')](_0xf783('0x9d'),_['map'](_0x10dd8c,'id'));return db[_0xf783('0x8a')][_0xf783('0x34')](_0x13741c[_0xf783('0x9c')](),_0x5f035b)[_0xf783('0x23')](function(_0x17cd0c){var _0x4013ef=_['groupBy'](_0x17cd0c,_0xf783('0x9e'));var _0x3353c5=[];_0x10dd8c[_0xf783('0x2d')](function(_0x5f0585){_0x3353c5[_0xf783('0x2e')](updateFaxInteraction(_0x5f0585,_0x402714,_0x4013ef));});return BPromise[_0xf783('0x9f')](_0x3353c5);});});})['then'](function(_0x3a6893){_0x1d128d['rows']=_0x3a6893;return _0x1d128d;})[_0xf783('0x23')](respondWithFilteredResult(_0x57809e,_0x270829))['catch'](handleError(_0x57809e,null));};exports['show']=function(_0x10b6cd,_0x28413f){var _0x18ccfd={'raw':![],'where':{'id':_0x10b6cd[_0xf783('0xa0')]['id']}},_0x273c07={};_0x273c07['model']=_[_0xf783('0x33')](db[_0xf783('0x8d')][_0xf783('0x31')]);_0x273c07[_0xf783('0x34')]=_[_0xf783('0x33')](_0x10b6cd[_0xf783('0x34')]);_0x273c07['filters']=_[_0xf783('0x36')](_0x273c07[_0xf783('0x32')],_0x273c07['query']);_0x18ccfd[_0xf783('0x37')]=_[_0xf783('0x36')](_0x273c07[_0xf783('0x32')],qs[_0xf783('0x38')](_0x10b6cd['query'][_0xf783('0x38')]));_0x18ccfd[_0xf783('0x37')]=_0x18ccfd['attributes']['length']?_0x18ccfd[_0xf783('0x37')]:_0x273c07[_0xf783('0x32')];if(_0x10b6cd[_0xf783('0x34')][_0xf783('0xa1')]){_0x18ccfd[_0xf783('0xa2')]=[{'all':!![]}];}_0x18ccfd=_[_0xf783('0x8c')]({},_0x18ccfd,_0x10b6cd[_0xf783('0xa3')]);return db[_0xf783('0x8d')][_0xf783('0xa4')](_0x18ccfd)[_0xf783('0x23')](handleEntityNotFound(_0x28413f,null))[_0xf783('0x23')](respondWithResult(_0x28413f,null))[_0xf783('0x2f')](handleError(_0x28413f,null));};exports['create']=function(_0x300b77,_0x534cff){return db[_0xf783('0x8d')][_0xf783('0xa5')](_0x300b77[_0xf783('0xa6')],{})[_0xf783('0x23')](respondWithResult(_0x534cff,0xc9))[_0xf783('0x2f')](handleError(_0x534cff,null));};exports[_0xf783('0x21')]=function(_0x3b5a4a,_0x5b9e7d){if(_0x3b5a4a[_0xf783('0xa6')]['id']){delete _0x3b5a4a[_0xf783('0xa6')]['id'];}return db[_0xf783('0x8d')][_0xf783('0xa4')]({'where':{'id':_0x3b5a4a[_0xf783('0xa0')]['id']}})[_0xf783('0x23')](handleEntityNotFound(_0x5b9e7d,null))[_0xf783('0x23')](saveUpdates(_0x3b5a4a['body'],null))[_0xf783('0x23')](respondWithResult(_0x5b9e7d,null))['catch'](handleError(_0x5b9e7d,null));};exports[_0xf783('0x22')]=function(_0x47781f,_0x11fbff){return db[_0xf783('0x8d')][_0xf783('0xa4')]({'where':{'id':_0x47781f[_0xf783('0xa0')]['id']}})[_0xf783('0x23')](handleEntityNotFound(_0x11fbff,null))[_0xf783('0x23')](removeEntity(_0x11fbff,null))[_0xf783('0x2f')](handleError(_0x11fbff,null));};exports[_0xf783('0xa7')]=function(_0x5f34b9,_0xd62cfa){return db['FaxInteraction'][_0xf783('0xa7')]()['then'](respondWithResult(_0xd62cfa,null))['catch'](handleError(_0xd62cfa,null));};exports[_0xf783('0xa8')]=function(_0x890b62,_0x1339f9,_0x48e575){return db[_0xf783('0xa9')][_0xf783('0xa4')]({'where':{'id':_0x890b62[_0xf783('0xa0')]['id']}})[_0xf783('0x23')](handleEntityNotFound(_0x1339f9,null))[_0xf783('0x23')](function(_0x5f5925){if(_0x5f5925){return _0x5f5925['addMessage'](_0x890b62[_0xf783('0xa6')]['ids'],_[_0xf783('0xaa')](_0x890b62[_0xf783('0xa6')],[_0xf783('0xab'),'id'])||{});}})['then'](respondWithResult(_0x1339f9,null))['catch'](handleError(_0x1339f9,null));};exports[_0xf783('0xac')]=function(_0x1a2564,_0x427041,_0x5d97cd){var _0x46e4f0={'raw':![],'where':{}};var _0x496ce0={};var _0x4b5596={'count':0x0,'rows':[]};return db[_0xf783('0x8d')][_0xf783('0xad')]({'where':{'id':_0x1a2564[_0xf783('0xa0')]['id']}})[_0xf783('0x23')](handleEntityNotFound(_0x427041,null))[_0xf783('0x23')](function(_0x1d4754){if(_0x1d4754){_0x496ce0[_0xf783('0x32')]=_[_0xf783('0x33')](db[_0xf783('0xa9')][_0xf783('0x31')]);_0x496ce0[_0xf783('0x34')]=_[_0xf783('0x33')](_0x1a2564['query']);_0x496ce0['filters']=_[_0xf783('0x36')](_0x496ce0[_0xf783('0x32')],_0x496ce0[_0xf783('0x34')]);_0x46e4f0[_0xf783('0x37')]=_[_0xf783('0x36')](_0x496ce0['model'],qs[_0xf783('0x38')](_0x1a2564[_0xf783('0x34')][_0xf783('0x38')]));_0x46e4f0[_0xf783('0x37')]=_0x46e4f0['attributes'][_0xf783('0x89')]?_0x46e4f0['attributes']:_0x496ce0['model'];if(!_0x1a2564[_0xf783('0x34')][_0xf783('0xae')](_0xf783('0x39'))){_0x46e4f0[_0xf783('0x1b')]=qs['limit'](_0x1a2564[_0xf783('0x34')][_0xf783('0x1b')]);_0x46e4f0[_0xf783('0x3a')]=qs[_0xf783('0x3a')](_0x1a2564[_0xf783('0x34')][_0xf783('0x3a')]);}_0x46e4f0[_0xf783('0x3b')]=qs[_0xf783('0x3c')](_0x1a2564['query'][_0xf783('0x3c')]);_0x46e4f0[_0xf783('0x3d')]=qs[_0xf783('0x35')](_['pick'](_0x1a2564[_0xf783('0x34')],_0x496ce0[_0xf783('0x35')]));_0x46e4f0[_0xf783('0x3d')][_0xf783('0x9e')]=_0x1d4754['id'];if(_0x1a2564['query']['filter']){_0x46e4f0[_0xf783('0x3d')]=_[_0xf783('0x8c')](_0x46e4f0[_0xf783('0x3d')],{'$or':_[_0xf783('0x29')](_0x46e4f0[_0xf783('0x37')],function(_0x5944df){var _0x41aec3={};_0x41aec3[_0x5944df]={'$like':'%'+_0x1a2564[_0xf783('0x34')][_0xf783('0x6b')]+'%'};return _0x41aec3;})});}if(_0x1a2564[_0xf783('0x34')][_0xf783('0x70')]){var _0x46d497=_0x1a2564[_0xf783('0x34')][_0xf783('0x70')][_0xf783('0x2c')](',');var _0x2e8ebb={};_0x2e8ebb[_0x46d497[0x0]]={'$gte':moment(_0x46d497[0x1])[_0xf783('0x5b')](_0xf783('0xaf'))};_0x46e4f0[_0xf783('0x3d')]=_[_0xf783('0x8c')](_0x46e4f0[_0xf783('0x3d')],_0x2e8ebb);}_0x46e4f0=_[_0xf783('0x8c')]({},_0x46e4f0,_0x1a2564[_0xf783('0xa3')]);return db['FaxMessage'][_0xf783('0x1a')]({'where':_0x46e4f0[_0xf783('0x3d')]})['then'](function(_0x3d437b){_0x4b5596[_0xf783('0x1a')]=_0x3d437b;if(_0x1a2564[_0xf783('0x34')]['includeAll']){_0x46e4f0[_0xf783('0xa2')]=[{'all':!![]}];}return db[_0xf783('0xa9')][_0xf783('0xb0')](_0x46e4f0);})[_0xf783('0x23')](function(_0x2f5683){_0x4b5596[_0xf783('0xb1')]=_0x2f5683;return _0x4b5596;});}})[_0xf783('0x23')](respondWithFilteredResult(_0x427041,_0x46e4f0))[_0xf783('0x2f')](handleError(_0x427041,null));};exports[_0xf783('0xb2')]=function(_0x27dd57,_0x27126f,_0x28e5af){return db[_0xf783('0x8d')][_0xf783('0xa4')]({'where':{'id':_0x27dd57[_0xf783('0xa0')]['id']}})[_0xf783('0x23')](handleEntityNotFound(_0x27126f,null))[_0xf783('0x23')](function(_0x9df16c){if(_0x9df16c){return _0x9df16c[_0xf783('0xb3')](_0x27dd57[_0xf783('0xa6')][_0xf783('0xab')],_['omit'](_0x27dd57[_0xf783('0xa6')],[_0xf783('0xab'),'id'])||{})['spread'](function(){return db[_0xf783('0xb4')][_0xf783('0xb0')]({'attributes':['id',_0xf783('0x27'),_0xf783('0xb5')],'where':{'id':_0x27dd57[_0xf783('0xa6')][_0xf783('0xab')]}});})[_0xf783('0x23')](function(_0x3e2e2b){socket[_0xf783('0xb6')](_0xf783('0xb7'),{'id':Number(_0x27dd57[_0xf783('0xa0')]['id']),'tags':_0x3e2e2b||[]});return{'id':Number(_0x27dd57[_0xf783('0xa0')]['id']),'tags':_0x3e2e2b||[]};});}})[_0xf783('0x23')](respondWithResult(_0x27126f,null))['catch'](handleError(_0x27126f,null));};exports[_0xf783('0xb8')]=function(_0x3896b8,_0x54af84,_0x4b7611){return db[_0xf783('0x8d')][_0xf783('0xa4')]({'where':{'id':_0x3896b8['params']['id']}})[_0xf783('0x23')](handleEntityNotFound(_0x54af84,null))['then'](function(_0xdc9a16){if(_0xdc9a16){return _0xdc9a16[_0xf783('0xb8')](_0x3896b8[_0xf783('0x34')][_0xf783('0xab')]);}})[_0xf783('0x23')](respondWithStatusCode(_0x54af84,null))[_0xf783('0x2f')](handleError(_0x54af84,null));};exports[_0xf783('0xb9')]=function(_0x3b6a29,_0x7625eb){var _0x16079f=moment()['unix']()[_0xf783('0x9c')]();var _0x156473=path['join'](config[_0xf783('0xba')],_0xf783('0xbb'),_0xf783('0xbc'),'attachments');var _0x2750e6=path[_0xf783('0xbd')](config[_0xf783('0xba')],_0xf783('0xbb'),_0xf783('0xbc'),'tmp');var _0x934a75=path[_0xf783('0xbd')](_0x2750e6,_0x16079f);var _0x42bbd8=util[_0xf783('0x5b')](_0xf783('0xbe'),_0x16079f);var _0x485218=path[_0xf783('0xbd')](_0x2750e6,_0x42bbd8);var _0x40256c=![];return db[_0xf783('0x8d')]['find']({'where':{'id':_0x3b6a29[_0xf783('0xa0')]['id']}})[_0xf783('0x23')](handleEntityNotFound(_0x7625eb,null))[_0xf783('0x23')](function(_0x213998){if(_0x213998){return _0x213998['getMessages']({'attributes':['id',_0xf783('0xa6'),_0xf783('0x55')],'include':[{'model':db[_0xf783('0xbf')],'as':_0xf783('0xbf')}]});}return[];})[_0xf783('0x23')](function(_0x322a2e){_0x40256c=_0x322a2e[_0xf783('0x89')];if(_0x322a2e[_0xf783('0x89')]){fs['mkdirSync'](_0x934a75);for(var _0x1f895d=0x0;_0x1f895d<_0x322a2e['length'];_0x1f895d++){var _0x4941a5=_0x322a2e[_0x1f895d];var _0x299377=_0x4941a5[_0xf783('0xbf')];if(_0x299377){var _0x28ec41=path[_0xf783('0xbd')](_0x156473,_0x299377['basename']);if(fs[_0xf783('0xc0')](_0x28ec41)){fs[_0xf783('0xc1')](_0x28ec41)[_0xf783('0xc2')](fs[_0xf783('0xc3')](path[_0xf783('0xbd')](_0x934a75,_0x299377[_0xf783('0xc4')])));}}}}})['then'](function(){if(_0x40256c){return new BPromise(function(_0x5f0ab6,_0x4cdef3){zipdir(_0x934a75,{'saveTo':_0x485218},function(_0x19091c,_0x35a4cf){if(_0x19091c)return _0x4cdef3(_0x19091c);return _0x5f0ab6(_0x35a4cf);});});}})[_0xf783('0x23')](function(){if(_0x40256c){return new BPromise(function(_0x266274,_0x432f35){rimraf(_0x934a75,function(_0x39ac7d){if(_0x39ac7d)_0x432f35(_0x39ac7d);return _0x266274();});});}})[_0xf783('0x23')](function(){if(_0x40256c){return _0x7625eb[_0xf783('0xb9')](_0x485218,_0x42bbd8,function(_0x3a2ec9){if(_0x3a2ec9){console['log'](_0xf783('0xc5'),_0x3a2ec9);}else{fs[_0xf783('0xc6')](_0x485218);}});}else{return _0x7625eb['sendStatus'](0xc8);}})[_0xf783('0x2f')](handleError(_0x7625eb,null));}; \ No newline at end of file +var _0x6cf6=['catch','index','keys','query','filters','intersection','attributes','fields','model','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','COUNT(*)','me.FaxInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','ui.FaxInteractionId','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false','advancedFilter','parse','createdAt','dateStart','startOf','utc','endOf','day','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','value','TagId','unreadMessages','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','ContactId','c.firstName','\x20LIKE\x20?','c.email','\x20>\x20?','length','c.lastName','isNil','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','$gte','$lte','\x20IS\x20NULL','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','i.id','Sequelize','SELECT','COUNT(me.id)','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','toString','sequelize','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','push','show','params','rawAttributes','includeAll','options','find','create','body','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','Tag','emit','faxInteractionTags:save','removeTags','join','server','root','files','interaction-%s.zip','Attachment','mkdirSync','basename','existsSync','pipe','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','./faxInteraction.socket','register','end','status','count','offset','limit','set','Content-Range','save','update','then','error','name','send','map','TagIds','Tags','split','forEach'];(function(_0x4199e0,_0x4fd258){var _0x5dee9e=function(_0x4a0a7d){while(--_0x4a0a7d){_0x4199e0['push'](_0x4199e0['shift']());}};_0x5dee9e(++_0x4fd258);}(_0x6cf6,0x165));var _0x66cf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6cf6[_0x6131cd];return _0x47e916;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x66cf('0x0'));var rimraf=require(_0x66cf('0x1'));var zipdir=require(_0x66cf('0x2'));var jsonpatch=require(_0x66cf('0x3'));var rp=require(_0x66cf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66cf('0x5'));var path=require(_0x66cf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x66cf('0x7'));var fs=require('fs');var _=require(_0x66cf('0x8'));var squel=require(_0x66cf('0x9'));var crypto=require(_0x66cf('0xa'));var jsforce=require(_0x66cf('0xb'));var deskjs=require(_0x66cf('0xc'));var toCsv=require(_0x66cf('0xd'));var querystring=require(_0x66cf('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x66cf('0xf'));var qs=require(_0x66cf('0x10'));var hardwareService=require(_0x66cf('0x11'));var logger=require(_0x66cf('0x12'))(_0x66cf('0x13'));var utils=require('../../config/utils');var config=require(_0x66cf('0x14'));var db=require(_0x66cf('0x15'))['db'];config[_0x66cf('0x16')]=_['defaults'](config[_0x66cf('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66cf('0x16')]));require(_0x66cf('0x17'))[_0x66cf('0x18')](socket);function respondWithStatusCode(_0x17fd81,_0xd9c394){_0xd9c394=_0xd9c394||0xcc;return function(_0x25aedd){if(_0x25aedd){return _0x17fd81['sendStatus'](_0xd9c394);}return _0x17fd81['status'](_0xd9c394)[_0x66cf('0x19')]();};}function respondWithResult(_0x55badf,_0x32ba26){_0x32ba26=_0x32ba26||0xc8;return function(_0x1a78e0){if(_0x1a78e0){return _0x55badf[_0x66cf('0x1a')](_0x32ba26)['json'](_0x1a78e0);}};}function respondWithFilteredResult(_0x10ac6b,_0x29e235){return function(_0x5050c6){if(_0x5050c6){var _0x560b2f=_0x5050c6[_0x66cf('0x1b')],_0x1ce709=_0x29e235[_0x66cf('0x1c')],_0x2910a5=_0x29e235['offset']+_0x29e235[_0x66cf('0x1d')],_0x2cb438;if(_0x2910a5>=_0x560b2f){_0x2910a5=_0x560b2f;_0x2cb438=0xc8;}else{_0x2cb438=0xce;}_0x10ac6b[_0x66cf('0x1a')](_0x2cb438);return _0x10ac6b[_0x66cf('0x1e')](_0x66cf('0x1f'),_0x1ce709+'-'+_0x2910a5+'/'+_0x560b2f)['json'](_0x5050c6);}return null;};}function patchUpdates(_0x1f91b4){return function(_0x3f7f5a){try{jsonpatch['apply'](_0x3f7f5a,_0x1f91b4,!![]);}catch(_0x59e73e){return BPromise['reject'](_0x59e73e);}return _0x3f7f5a[_0x66cf('0x20')]();};}function saveUpdates(_0x497e9a,_0x568fc2){return function(_0x203458){if(_0x203458){return _0x203458[_0x66cf('0x21')](_0x497e9a)[_0x66cf('0x22')](function(_0x292b3f){return _0x292b3f;});}return null;};}function removeEntity(_0x57f656,_0x3a5a3d){return function(_0x208a32){if(_0x208a32){return _0x208a32['destroy']()[_0x66cf('0x22')](function(){_0x57f656[_0x66cf('0x1a')](0xcc)[_0x66cf('0x19')]();});}};}function handleEntityNotFound(_0x5b3ccc,_0xceee3c){return function(_0x1498c7){if(!_0x1498c7){_0x5b3ccc['sendStatus'](0x194);}return _0x1498c7;};}function handleError(_0x750598,_0x3a30a5){_0x3a30a5=_0x3a30a5||0x1f4;return function(_0x2201de){logger[_0x66cf('0x23')](_0x2201de['stack']);if(_0x2201de[_0x66cf('0x24')]){delete _0x2201de['name'];}_0x750598['status'](_0x3a30a5)[_0x66cf('0x25')](_0x2201de);};}function getInteractionUsers(_0x335ca7,_0x455742){return new BPromise(function(_0x5fc55e,_0x5207df){try{if(_0x455742[_0x335ca7['id']]){_0x335ca7['Users']=_[_0x66cf('0x26')](_0x455742[_0x335ca7['id']],function(_0x1b11c8){return{'id':_0x1b11c8['id']};});}}catch(_0x370a51){_0x5207df(_0x370a51);}_0x5fc55e(_0x335ca7);});}function getInteractionTags(_0x3e425b,_0x487df7){return new BPromise(function(_0x3b8ec8,_0x4758b7){try{if(_0x3e425b[_0x66cf('0x27')]){_0x3e425b[_0x66cf('0x28')]=[];_0x3e425b[_0x66cf('0x27')][_0x66cf('0x29')](',')[_0x66cf('0x2a')](function(_0x304599){_0x3e425b[_0x66cf('0x28')]['push'](_0x487df7[_0x304599]);});}delete _0x3e425b['TagIds'];}catch(_0x1e3685){_0x4758b7(_0x1e3685);}_0x3b8ec8(_0x3e425b);});}function updateFaxInteraction(_0x1f3575,_0x5d463e,_0x30a45d){return new BPromise(function(_0x48b6a4,_0x3174a1){return getInteractionUsers(_0x1f3575,_0x30a45d)['then'](function(_0x4b33eb){return getInteractionTags(_0x4b33eb,_0x5d463e);})[_0x66cf('0x22')](function(_0x11c49f){_0x48b6a4(_0x11c49f);})[_0x66cf('0x2b')](function(_0x38c004){_0x3174a1(_0x38c004);});});}exports[_0x66cf('0x2c')]=function(_0x14a547,_0xde0cb1){var _0x782e32={},_0x1cbae7={},_0xdb5ef2={'count':0x0,'rows':[]};var _0x515aa7=db['FaxInteraction']['rawAttributes'];_0x1cbae7['model']=_[_0x66cf('0x2d')](_0x515aa7);_0x1cbae7[_0x66cf('0x2e')]=_[_0x66cf('0x2d')](_0x14a547[_0x66cf('0x2e')]);_0x1cbae7[_0x66cf('0x2f')]=_[_0x66cf('0x30')](_0x1cbae7['model'],_0x1cbae7[_0x66cf('0x2e')]);_0x782e32[_0x66cf('0x31')]=_[_0x66cf('0x30')](_0x1cbae7['model'],qs[_0x66cf('0x32')](_0x14a547[_0x66cf('0x2e')][_0x66cf('0x32')]));_0x782e32['attributes']=_0x782e32['attributes']['length']?_0x782e32[_0x66cf('0x31')]:_0x1cbae7[_0x66cf('0x33')];if(!_0x14a547[_0x66cf('0x2e')][_0x66cf('0x34')]('nolimit')){_0x782e32[_0x66cf('0x1d')]=qs[_0x66cf('0x1d')](_0x14a547[_0x66cf('0x2e')][_0x66cf('0x1d')]);_0x782e32[_0x66cf('0x1c')]=qs[_0x66cf('0x1c')](_0x14a547['query'][_0x66cf('0x1c')]);}_0x782e32[_0x66cf('0x35')]=qs[_0x66cf('0x36')](_0x14a547[_0x66cf('0x2e')][_0x66cf('0x36')]);_0x782e32[_0x66cf('0x37')]=qs[_0x66cf('0x2f')](_[_0x66cf('0x38')](_0x14a547[_0x66cf('0x2e')],_0x1cbae7['filters']));var _0x447446=[];var _0x260043=squel[_0x66cf('0x39')]()[_0x66cf('0x3a')]('id')[_0x66cf('0x3a')](_0x66cf('0x24'))[_0x66cf('0x3a')](_0x66cf('0x3b'))[_0x66cf('0x3c')](_0x66cf('0x3d'));var _0x4672ec=squel['select']()[_0x66cf('0x3a')](_0x66cf('0x3e'))[_0x66cf('0x3c')]('fax_messages','me')['where'](_0x66cf('0x3f'))[_0x66cf('0x37')](_0x66cf('0x40'))[_0x66cf('0x37')](_0x66cf('0x41'));var _0x1f9981=squel[_0x66cf('0x39')]()['field'](_0x66cf('0x42'))[_0x66cf('0x3a')](_0x66cf('0x43'))[_0x66cf('0x3c')]('user_has_fax_interactions','ui')['left_join']('users','u',_0x66cf('0x44'));var _0x5090dd=squel['select']()[_0x66cf('0x3c')](_0x66cf('0x45'),'i')[_0x66cf('0x46')](_0x66cf('0x47'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x66cf('0x46')](_0x66cf('0x48'),'o',_0x66cf('0x49'))['left_join'](_0x66cf('0x4a'),'a',_0x66cf('0x4b'))['left_join'](_0x66cf('0x4c'),'me',_0x66cf('0x4d'));var _0x1d2f34=squel['expr']();if(_0x14a547[_0x66cf('0x2e')][_0x66cf('0x4e')]){var _0x16b3e7=JSON[_0x66cf('0x4f')](_0x14a547['query']['advancedFilter']);_[_0x66cf('0x2d')](_0x16b3e7)[_0x66cf('0x2a')](function(_0x392843){var _0x3e05d9=_0x16b3e7[_0x392843];if(_0x392843===_0x66cf('0x50')){var _0x40a2c7=moment(_0x3e05d9['value'][_0x66cf('0x51')])[_0x66cf('0x52')]('day')[_0x66cf('0x53')]()['format']();var _0x3c5b79=moment(_0x3c5b79)[_0x66cf('0x53')]()[_0x66cf('0x54')](_0x66cf('0x55'))['format']();_0x1d2f34[_0x66cf('0x56')](_0x66cf('0x57'),_0x40a2c7,_0x3c5b79);}else{if(_[_0x66cf('0x58')](_0x3e05d9[_0x66cf('0x59')])){_0x3e05d9[_0x66cf('0x59')][_0x66cf('0x2a')](function(_0x34d50f){switch(_0x3e05d9[_0x66cf('0x59')][_0x66cf('0x5a')]){case'IS':if(_0x392843!==_0x66cf('0x5b')&&_0x392843!==_0x66cf('0x5c')){if(_[_0x66cf('0x58')](_0x3e05d9['value'])&&_0x3e05d9[_0x66cf('0x5a')]['length']>0x1){_0x1d2f34['and'](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+_0x66cf('0x5e'),_0x3e05d9[_0x66cf('0x5a')]);}else{_0x1d2f34['and'](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+_0x66cf('0x5f'),_0x3e05d9[_0x66cf('0x5a')][0x0]);}}break;case'=':_0x1d2f34[_0x66cf('0x56')](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+_0x66cf('0x5f'),_0x3e05d9['value']);break;case _0x66cf('0x60'):if(_0x392843===_0x66cf('0x61')){_0x1d2f34['and'](_0x66cf('0x62')+_0x66cf('0x63'),'%'+_0x3e05d9[_0x66cf('0x5a')]+'%');_0x1d2f34['or']('c.lastName'+'\x20LIKE\x20?','%'+_0x3e05d9['value']+'%');_0x1d2f34['or'](_0x66cf('0x64')+_0x66cf('0x63'),'%'+_0x3e05d9[_0x66cf('0x5a')]+'%');}else{_0x1d2f34['and'](_0x3e05d9['tableAlias']+'.'+_0x392843+_0x66cf('0x63'),'%'+_0x3e05d9[_0x66cf('0x5a')]+'%');}break;case'>':_0x1d2f34[_0x66cf('0x56')](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+_0x66cf('0x65'),_0x3e05d9[_0x66cf('0x5a')]);break;case'<':_0x1d2f34['and'](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+'\x20<\x20?',_0x3e05d9[_0x66cf('0x5a')]);break;}});}else{switch(_0x3e05d9[_0x66cf('0x59')]['value']){case'IS':if(_0x392843!==_0x66cf('0x5b')&&_0x392843!==_0x66cf('0x5c')){if(_[_0x66cf('0x58')](_0x3e05d9['value'])&&_0x3e05d9['value'][_0x66cf('0x66')]>0x1){_0x1d2f34[_0x66cf('0x56')](_0x3e05d9['tableAlias']+'.'+_0x392843+_0x66cf('0x5e'),_0x3e05d9[_0x66cf('0x5a')]);}else{_0x1d2f34[_0x66cf('0x56')](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+_0x66cf('0x5f'),_0x3e05d9[_0x66cf('0x5a')][0x0]);}}break;case'=':_0x1d2f34['and'](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+_0x66cf('0x5f'),_0x3e05d9['value']);break;case _0x66cf('0x60'):if(_0x392843===_0x66cf('0x61')){_0x1d2f34[_0x66cf('0x56')](_0x66cf('0x62')+'\x20LIKE\x20?','%'+_0x3e05d9['value']+'%');_0x1d2f34['or'](_0x66cf('0x67')+'\x20LIKE\x20?','%'+_0x3e05d9[_0x66cf('0x5a')]+'%');_0x1d2f34['or']('c.email'+_0x66cf('0x63'),'%'+_0x3e05d9['value']+'%');}else{_0x1d2f34[_0x66cf('0x56')](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+_0x66cf('0x63'),'%'+_0x3e05d9['value']+'%');}break;case'>':_0x1d2f34[_0x66cf('0x56')](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+_0x66cf('0x65'),_0x3e05d9[_0x66cf('0x5a')]);break;case'<':_0x1d2f34[_0x66cf('0x56')](_0x3e05d9[_0x66cf('0x5d')]+'.'+_0x392843+'\x20<\x20?',_0x3e05d9['value']);break;}}}});}else{var _0x5a9fcf=_(Object[_0x66cf('0x2d')](_0x14a547[_0x66cf('0x2e')]))[_0x66cf('0x26')](function(_0x16341d){return _0x515aa7['hasOwnProperty'](_0x16341d)?_0x16341d:undefined;})['filter'](function(_0x4ec61f){return!_[_0x66cf('0x68')](_0x4ec61f);})[_0x66cf('0x5a')]();if(!_[_0x66cf('0x69')](_0x5a9fcf)){_0x5a9fcf[_0x66cf('0x2a')](function(_0x11e02b){if(_0x11e02b===_0x66cf('0x6a')){_0x5090dd[_0x66cf('0x37')](_0x66cf('0x6b'),[][_0x66cf('0x6c')](_0x14a547[_0x66cf('0x2e')][_0x11e02b]));}else if(_0x11e02b==='createdAt'){var _0x3635d6=JSON[_0x66cf('0x4f')](_0x14a547[_0x66cf('0x2e')][_0x11e02b])[_0x66cf('0x6d')];var _0x2ad617=JSON[_0x66cf('0x4f')](_0x14a547[_0x66cf('0x2e')][_0x11e02b])[_0x66cf('0x6e')];_0x5090dd['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3635d6,_0x2ad617);}else{if(_0x14a547[_0x66cf('0x2e')][_0x11e02b]==='null'){_0x5090dd[_0x66cf('0x37')]('i.'+_0x11e02b+_0x66cf('0x6f'));}else{_0x5090dd[_0x66cf('0x37')]('i.'+_0x11e02b+_0x66cf('0x5f'),_0x14a547[_0x66cf('0x2e')][_0x11e02b]);}}});}if(_0x14a547['query']['filter']){var _0x2cc171=_0x14a547[_0x66cf('0x2e')][_0x66cf('0x70')][_0x66cf('0x71')]('\x5c','\x5c\x5c')[_0x66cf('0x71')]('\x27\x27',_0x66cf('0x72'));if(qs[_0x66cf('0x73')](_0x2cc171)){_0x1d2f34['or'](_0x66cf('0x74'),_0x2cc171+'%')['or'](_0x66cf('0x75'),_0x2cc171+'%');}_0x1d2f34['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2cc171+'%');}}_0x5090dd['where'](_0x1d2f34);if(_0x782e32['order']){_0x782e32['order']['forEach'](function(_0x2f5983){_0x5090dd[_0x66cf('0x35')]('i.'+_0x2f5983[0x0],_0x2f5983[0x1]==='DESC'?![]:!![]);});}_0x5090dd['group'](_0x66cf('0x76'));var _0x384701={'type':db[_0x66cf('0x77')]['QueryTypes'][_0x66cf('0x78')],'raw':!![]};var _0x3ca83e=_0x5090dd['clone']()['field'](_0x66cf('0x3e'))[_0x66cf('0x3a')](_0x66cf('0x79'),'unreadMessages');if(!_0x14a547['query'][_0x66cf('0x4e')]){if(_0x14a547['query'][_0x66cf('0x7a')]){if(_0x14a547[_0x66cf('0x2e')]['read']==0x1){_0x3ca83e[_0x66cf('0x7b')](_0x66cf('0x7c'));_0x5090dd[_0x66cf('0x7b')](_0x66cf('0x7c'));}else{_0x3ca83e[_0x66cf('0x7b')](_0x66cf('0x7d'));_0x5090dd[_0x66cf('0x7b')](_0x66cf('0x7d'));}}if(_0x14a547[_0x66cf('0x2e')]['tag']){var _0x3fbb65=_[_0x66cf('0x58')](_0x14a547['query']['tag'])?_0x14a547[_0x66cf('0x2e')][_0x66cf('0x7e')]:new Array(_0x14a547['query'][_0x66cf('0x7e')]);var _0x1d4fb8=squel[_0x66cf('0x7f')]();_0x3fbb65[_0x66cf('0x2a')](function(_0x42a791){_0x1d4fb8['or'](_0x66cf('0x80'),'%,'+_0x42a791+',%');});_0x5090dd[_0x66cf('0x7b')](_0x1d4fb8);_0x3ca83e[_0x66cf('0x46')](_0x66cf('0x81'),'it',_0x66cf('0x82'));_0x3ca83e[_0x66cf('0x46')](_0x66cf('0x3d'),'t',_0x66cf('0x83'));_0x3ca83e[_0x66cf('0x37')](_0x66cf('0x84'),_0x3fbb65);}}else{var _0x16b3e7=JSON[_0x66cf('0x4f')](_0x14a547[_0x66cf('0x2e')][_0x66cf('0x4e')]);_['keys'](_0x16b3e7)['forEach'](function(_0xc36722){var _0x4f7dd4=_0x16b3e7[_0xc36722];if(_0xc36722===_0x66cf('0x5b')){var _0x43e522=_0x4f7dd4[_0x66cf('0x5a')];var _0x414ffc=squel[_0x66cf('0x7f')]();_0x43e522['forEach'](function(_0x7b74d1){_0x414ffc['or'](_0x66cf('0x80'),'%,'+_0x7b74d1+',%');});_0x5090dd['having'](_0x414ffc);_0x3ca83e[_0x66cf('0x46')](_0x66cf('0x85'),'it',_0x66cf('0x86'));_0x3ca83e[_0x66cf('0x46')]('tools_tags','t',_0x66cf('0x83'));_0x3ca83e['where'](_0x66cf('0x84'),_0x43e522);}else if(_0xc36722==='unreadMessages'){if(_0x4f7dd4['value'][_0x66cf('0x66')]===0x1){if(_0x4f7dd4[_0x66cf('0x5a')][0x0]===0x1){_0x3ca83e[_0x66cf('0x7b')](_0x66cf('0x7c'));_0x5090dd[_0x66cf('0x7b')](_0x66cf('0x7c'));}else{_0x3ca83e['having'](_0x66cf('0x7d'));_0x5090dd[_0x66cf('0x7b')](_0x66cf('0x7d'));}}}});}db['sequelize'][_0x66cf('0x2e')](_0x3ca83e[_0x66cf('0x87')](),_0x384701)[_0x66cf('0x22')](function(_0xb56e03){_0xdb5ef2[_0x66cf('0x1b')]=_0xb56e03[_0x66cf('0x66')];if(_0xdb5ef2[_0x66cf('0x1b')]===0x0)return[];return db[_0x66cf('0x88')][_0x66cf('0x2e')](_0x260043[_0x66cf('0x87')](),_0x384701)[_0x66cf('0x22')](function(_0x3edca3){_0x447446=_['keyBy'](_0x3edca3,'id');_0x384701=_[_0x66cf('0x89')](_0x384701,{'model':db[_0x66cf('0x8a')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x79'),_0x66cf('0x5c'));_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x8b'),_0x66cf('0x8c'));_0x5090dd['field'](_0x66cf('0x8d'),_0x66cf('0x8e'));_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x8f'));_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x62'),_0x66cf('0x90'));_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x67'),_0x66cf('0x91'));_0x5090dd['field']('c.email',_0x66cf('0x92'));_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x93'),_0x66cf('0x94'));_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x95'),_0x66cf('0x96'));_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x97'),_0x66cf('0x98'));_0x5090dd[_0x66cf('0x3a')](_0x66cf('0x99'),_0x66cf('0x27'));_0x5090dd[_0x66cf('0x46')](_0x66cf('0x81'),'it',_0x66cf('0x82'));_0x5090dd['left_join'](_0x66cf('0x3d'),'t',_0x66cf('0x83'));_0x5090dd[_0x66cf('0x1d')](_0x782e32[_0x66cf('0x1d')]);_0x5090dd[_0x66cf('0x1c')](_0x782e32[_0x66cf('0x1c')]);return db['sequelize']['query'](_0x5090dd[_0x66cf('0x87')](),_0x384701);})[_0x66cf('0x22')](function(_0x371b1c){_0x1f9981[_0x66cf('0x37')](_0x66cf('0x9a'),_[_0x66cf('0x26')](_0x371b1c,'id'));return db[_0x66cf('0x88')][_0x66cf('0x2e')](_0x1f9981[_0x66cf('0x87')](),_0x384701)[_0x66cf('0x22')](function(_0x3dc535){var _0x43a43f=_[_0x66cf('0x9b')](_0x3dc535,'FaxInteractionId');var _0x4c566c=[];_0x371b1c['forEach'](function(_0x371dff){_0x4c566c[_0x66cf('0x9c')](updateFaxInteraction(_0x371dff,_0x447446,_0x43a43f));});return BPromise['all'](_0x4c566c);});});})[_0x66cf('0x22')](function(_0x59dcdb){_0xdb5ef2['rows']=_0x59dcdb;return _0xdb5ef2;})['then'](respondWithFilteredResult(_0xde0cb1,_0x782e32))[_0x66cf('0x2b')](handleError(_0xde0cb1,null));};exports[_0x66cf('0x9d')]=function(_0x3ce006,_0x117733){var _0x380ede={'raw':![],'where':{'id':_0x3ce006[_0x66cf('0x9e')]['id']}},_0x3c1925={};_0x3c1925[_0x66cf('0x33')]=_['keys'](db[_0x66cf('0x8a')][_0x66cf('0x9f')]);_0x3c1925[_0x66cf('0x2e')]=_['keys'](_0x3ce006['query']);_0x3c1925[_0x66cf('0x2f')]=_['intersection'](_0x3c1925[_0x66cf('0x33')],_0x3c1925['query']);_0x380ede['attributes']=_['intersection'](_0x3c1925[_0x66cf('0x33')],qs['fields'](_0x3ce006['query'][_0x66cf('0x32')]));_0x380ede[_0x66cf('0x31')]=_0x380ede['attributes'][_0x66cf('0x66')]?_0x380ede[_0x66cf('0x31')]:_0x3c1925[_0x66cf('0x33')];if(_0x3ce006[_0x66cf('0x2e')][_0x66cf('0xa0')]){_0x380ede['include']=[{'all':!![]}];}_0x380ede=_['merge']({},_0x380ede,_0x3ce006[_0x66cf('0xa1')]);return db['FaxInteraction'][_0x66cf('0xa2')](_0x380ede)[_0x66cf('0x22')](handleEntityNotFound(_0x117733,null))['then'](respondWithResult(_0x117733,null))['catch'](handleError(_0x117733,null));};exports[_0x66cf('0xa3')]=function(_0x482e3d,_0x8a517){return db['FaxInteraction'][_0x66cf('0xa3')](_0x482e3d[_0x66cf('0xa4')],{})[_0x66cf('0x22')](respondWithResult(_0x8a517,0xc9))['catch'](handleError(_0x8a517,null));};exports[_0x66cf('0x21')]=function(_0x789a6,_0x22ec42){if(_0x789a6[_0x66cf('0xa4')]['id']){delete _0x789a6[_0x66cf('0xa4')]['id'];}return db['FaxInteraction'][_0x66cf('0xa2')]({'where':{'id':_0x789a6['params']['id']}})['then'](handleEntityNotFound(_0x22ec42,null))[_0x66cf('0x22')](saveUpdates(_0x789a6[_0x66cf('0xa4')],null))['then'](respondWithResult(_0x22ec42,null))['catch'](handleError(_0x22ec42,null));};exports[_0x66cf('0xa5')]=function(_0x4d3349,_0x271251){return db[_0x66cf('0x8a')][_0x66cf('0xa2')]({'where':{'id':_0x4d3349['params']['id']}})[_0x66cf('0x22')](handleEntityNotFound(_0x271251,null))[_0x66cf('0x22')](removeEntity(_0x271251,null))['catch'](handleError(_0x271251,null));};exports[_0x66cf('0xa6')]=function(_0x5ecf24,_0x157aeb){return db[_0x66cf('0x8a')][_0x66cf('0xa6')]()[_0x66cf('0x22')](respondWithResult(_0x157aeb,null))['catch'](handleError(_0x157aeb,null));};exports[_0x66cf('0xa7')]=function(_0x4cb375,_0x2c261a,_0x6a3d8b){return db[_0x66cf('0xa8')][_0x66cf('0xa2')]({'where':{'id':_0x4cb375[_0x66cf('0x9e')]['id']}})[_0x66cf('0x22')](handleEntityNotFound(_0x2c261a,null))[_0x66cf('0x22')](function(_0x46ca75){if(_0x46ca75){return _0x46ca75[_0x66cf('0xa7')](_0x4cb375[_0x66cf('0xa4')][_0x66cf('0xa9')],_[_0x66cf('0xaa')](_0x4cb375[_0x66cf('0xa4')],[_0x66cf('0xa9'),'id'])||{});}})[_0x66cf('0x22')](respondWithResult(_0x2c261a,null))[_0x66cf('0x2b')](handleError(_0x2c261a,null));};exports[_0x66cf('0xab')]=function(_0x42c5f2,_0x5f1975,_0x49bb3c){var _0x2d3236={'raw':![],'where':{}};var _0x56bd3d={};var _0x58087c={'count':0x0,'rows':[]};return db[_0x66cf('0x8a')][_0x66cf('0xac')]({'where':{'id':_0x42c5f2[_0x66cf('0x9e')]['id']}})[_0x66cf('0x22')](handleEntityNotFound(_0x5f1975,null))[_0x66cf('0x22')](function(_0x142af6){if(_0x142af6){_0x56bd3d[_0x66cf('0x33')]=_[_0x66cf('0x2d')](db['FaxMessage'][_0x66cf('0x9f')]);_0x56bd3d[_0x66cf('0x2e')]=_[_0x66cf('0x2d')](_0x42c5f2['query']);_0x56bd3d[_0x66cf('0x2f')]=_[_0x66cf('0x30')](_0x56bd3d[_0x66cf('0x33')],_0x56bd3d['query']);_0x2d3236['attributes']=_['intersection'](_0x56bd3d[_0x66cf('0x33')],qs[_0x66cf('0x32')](_0x42c5f2[_0x66cf('0x2e')][_0x66cf('0x32')]));_0x2d3236[_0x66cf('0x31')]=_0x2d3236[_0x66cf('0x31')][_0x66cf('0x66')]?_0x2d3236[_0x66cf('0x31')]:_0x56bd3d[_0x66cf('0x33')];if(!_0x42c5f2[_0x66cf('0x2e')][_0x66cf('0x34')](_0x66cf('0xad'))){_0x2d3236[_0x66cf('0x1d')]=qs['limit'](_0x42c5f2[_0x66cf('0x2e')][_0x66cf('0x1d')]);_0x2d3236[_0x66cf('0x1c')]=qs['offset'](_0x42c5f2[_0x66cf('0x2e')][_0x66cf('0x1c')]);}_0x2d3236['order']=qs[_0x66cf('0x36')](_0x42c5f2[_0x66cf('0x2e')]['sort']);_0x2d3236['where']=qs[_0x66cf('0x2f')](_['pick'](_0x42c5f2[_0x66cf('0x2e')],_0x56bd3d[_0x66cf('0x2f')]));_0x2d3236[_0x66cf('0x37')][_0x66cf('0xae')]=_0x142af6['id'];if(_0x42c5f2[_0x66cf('0x2e')][_0x66cf('0x70')]){_0x2d3236[_0x66cf('0x37')]=_[_0x66cf('0x89')](_0x2d3236['where'],{'$or':_['map'](_0x2d3236[_0x66cf('0x31')],function(_0x3780ba){var _0x464653={};_0x464653[_0x3780ba]={'$like':'%'+_0x42c5f2[_0x66cf('0x2e')][_0x66cf('0x70')]+'%'};return _0x464653;})});}if(_0x42c5f2[_0x66cf('0x2e')][_0x66cf('0x6d')]){var _0x4df791=_0x42c5f2[_0x66cf('0x2e')][_0x66cf('0x6d')][_0x66cf('0x29')](',');var _0x23f6e8={};_0x23f6e8[_0x4df791[0x0]]={'$gte':moment(_0x4df791[0x1])[_0x66cf('0xaf')](_0x66cf('0xb0'))};_0x2d3236['where']=_[_0x66cf('0x89')](_0x2d3236['where'],_0x23f6e8);}_0x2d3236=_[_0x66cf('0x89')]({},_0x2d3236,_0x42c5f2[_0x66cf('0xa1')]);return db['FaxMessage']['count']({'where':_0x2d3236[_0x66cf('0x37')]})[_0x66cf('0x22')](function(_0x58ad81){_0x58087c[_0x66cf('0x1b')]=_0x58ad81;if(_0x42c5f2[_0x66cf('0x2e')]['includeAll']){_0x2d3236[_0x66cf('0xb1')]=[{'all':!![]}];}return db[_0x66cf('0xa8')][_0x66cf('0xb2')](_0x2d3236);})['then'](function(_0xa446d2){_0x58087c[_0x66cf('0xb3')]=_0xa446d2;return _0x58087c;});}})[_0x66cf('0x22')](respondWithFilteredResult(_0x5f1975,_0x2d3236))['catch'](handleError(_0x5f1975,null));};exports[_0x66cf('0xb4')]=function(_0x1a7702,_0x26f1cd,_0x51f665){return db[_0x66cf('0x8a')][_0x66cf('0xa2')]({'where':{'id':_0x1a7702[_0x66cf('0x9e')]['id']}})['then'](handleEntityNotFound(_0x26f1cd,null))[_0x66cf('0x22')](function(_0x472d80){if(_0x472d80){return _0x472d80[_0x66cf('0xb5')](_0x1a7702[_0x66cf('0xa4')][_0x66cf('0xa9')],_['omit'](_0x1a7702['body'],[_0x66cf('0xa9'),'id'])||{})['spread'](function(){return db[_0x66cf('0xb6')][_0x66cf('0xb2')]({'attributes':['id',_0x66cf('0x24'),_0x66cf('0x3b')],'where':{'id':_0x1a7702[_0x66cf('0xa4')][_0x66cf('0xa9')]}});})[_0x66cf('0x22')](function(_0x557ccd){socket[_0x66cf('0xb7')](_0x66cf('0xb8'),{'id':Number(_0x1a7702[_0x66cf('0x9e')]['id']),'tags':_0x557ccd||[]});return{'id':Number(_0x1a7702[_0x66cf('0x9e')]['id']),'tags':_0x557ccd||[]};});}})['then'](respondWithResult(_0x26f1cd,null))['catch'](handleError(_0x26f1cd,null));};exports[_0x66cf('0xb9')]=function(_0x5d8bb9,_0x3b40f3,_0x14080c){return db[_0x66cf('0x8a')][_0x66cf('0xa2')]({'where':{'id':_0x5d8bb9[_0x66cf('0x9e')]['id']}})[_0x66cf('0x22')](handleEntityNotFound(_0x3b40f3,null))[_0x66cf('0x22')](function(_0x335868){if(_0x335868){return _0x335868[_0x66cf('0xb9')](_0x5d8bb9[_0x66cf('0x2e')][_0x66cf('0xa9')]);}})[_0x66cf('0x22')](respondWithStatusCode(_0x3b40f3,null))['catch'](handleError(_0x3b40f3,null));};exports['download']=function(_0x1e980c,_0x28e987){var _0x507620=moment()['unix']()[_0x66cf('0x87')]();var _0x417ca0=path[_0x66cf('0xba')](config['root'],_0x66cf('0xbb'),'files','attachments');var _0x4243c4=path['join'](config[_0x66cf('0xbc')],_0x66cf('0xbb'),_0x66cf('0xbd'),'tmp');var _0x541c73=path[_0x66cf('0xba')](_0x4243c4,_0x507620);var _0x5c40a8=util[_0x66cf('0xaf')](_0x66cf('0xbe'),_0x507620);var _0x189ab2=path[_0x66cf('0xba')](_0x4243c4,_0x5c40a8);var _0x2d4c06=![];return db['FaxInteraction']['find']({'where':{'id':_0x1e980c[_0x66cf('0x9e')]['id']}})[_0x66cf('0x22')](handleEntityNotFound(_0x28e987,null))['then'](function(_0x2dcda7){if(_0x2dcda7){return _0x2dcda7[_0x66cf('0xab')]({'attributes':['id',_0x66cf('0xa4'),_0x66cf('0x50')],'include':[{'model':db['Attachment'],'as':_0x66cf('0xbf')}]});}return[];})['then'](function(_0x1ef185){_0x2d4c06=_0x1ef185[_0x66cf('0x66')];if(_0x1ef185[_0x66cf('0x66')]){fs[_0x66cf('0xc0')](_0x541c73);for(var _0x222d1a=0x0;_0x222d1a<_0x1ef185[_0x66cf('0x66')];_0x222d1a++){var _0x471d32=_0x1ef185[_0x222d1a];var _0x2dd887=_0x471d32[_0x66cf('0xbf')];if(_0x2dd887){var _0x5412be=path[_0x66cf('0xba')](_0x417ca0,_0x2dd887[_0x66cf('0xc1')]);if(fs[_0x66cf('0xc2')](_0x5412be)){fs['createReadStream'](_0x5412be)[_0x66cf('0xc3')](fs['createWriteStream'](path[_0x66cf('0xba')](_0x541c73,_0x2dd887[_0x66cf('0xc1')])));}}}}})[_0x66cf('0x22')](function(){if(_0x2d4c06){return new BPromise(function(_0x1a524a,_0x1330f5){zipdir(_0x541c73,{'saveTo':_0x189ab2},function(_0x5d8f77,_0x5c6cb4){if(_0x5d8f77)return _0x1330f5(_0x5d8f77);return _0x1a524a(_0x5c6cb4);});});}})[_0x66cf('0x22')](function(){if(_0x2d4c06){return new BPromise(function(_0x122805,_0x1a80e8){rimraf(_0x541c73,function(_0x329748){if(_0x329748)_0x1a80e8(_0x329748);return _0x122805();});});}})['then'](function(){if(_0x2d4c06){return _0x28e987[_0x66cf('0xc4')](_0x189ab2,_0x5c40a8,function(_0x3e8634){if(_0x3e8634){console[_0x66cf('0xc5')](_0x66cf('0xc6'),_0x3e8634);}else{fs[_0x66cf('0xc7')](_0x189ab2);}});}else{return _0x28e987['sendStatus'](0xc8);}})['catch'](handleError(_0x28e987,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f8ed8f7..865ce98 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x5761ce,_0x268058){var _0x254e7b=function(_0x3a88c0){while(--_0x3a88c0){_0x5761ce['push'](_0x5761ce['shift']());}};_0x254e7b(++_0x268058);}(_0x814b,0x1a2));var _0xb814=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x814b[_0x396466];return _0x5e9ab4;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xdb28=['Users','map','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','setDataValue'];(function(_0x36d2a1,_0x176456){var _0x5de65d=function(_0xb44b57){while(--_0xb44b57){_0x36d2a1['push'](_0x36d2a1['shift']());}};_0x5de65d(++_0x176456);}(_0xdb28,0x106));var _0x8db2=function(_0x2dbd34,_0x1f6f0e){_0x2dbd34=_0x2dbd34-0x0;var _0x4d956a=_0xdb28[_0x2dbd34];return _0x4d956a;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var FaxInteraction=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var FaxMessage=require(_0x8db2('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':_0x8db2('0x4'),'afterUpdate':_0x8db2('0x5'),'afterDestroy':_0x8db2('0x6')};function emitEvent(_0x11109e){return function(_0x52bf99,_0x21a03e,_0x1d2dd3){_0x52bf99['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x477f50){_0x52bf99[_0x8db2('0x7')](_0x8db2('0x8'),_0x477f50[_0x8db2('0x9')](function(_0x2f3f2f){return{'id':_0x2f3f2f['id']};}));return FaxMessage[_0x8db2('0xa')]({'where':{'FaxInteractionId':_0x52bf99['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8db2('0xb')](function(_0x4ba340){_0x52bf99[_0x8db2('0x7')](_0x8db2('0xc'),_0x4ba340[_0x8db2('0xd')]);FaxInteractionEvents['emit'](_0x11109e+':'+_0x52bf99['id'],_0x52bf99);FaxInteractionEvents[_0x8db2('0xe')](_0x11109e,_0x52bf99);_0x1d2dd3(null);})[_0x8db2('0xf')](_0x1d2dd3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x8db2('0x10')](e,emitEvent(event));}}module[_0x8db2('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index f9e5235..def2677 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 _0x9280=['util','../../config/logger','api','bluebird','path','rimraf','exports','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3f9c37,_0x78dee0){var _0x2fcbb1=function(_0x5aeb32){while(--_0x5aeb32){_0x3f9c37['push'](_0x3f9c37['shift']());}};_0x2fcbb1(++_0x78dee0);}(_0x9280,0x1db));var _0x0928=function(_0x4148fd,_0x2f63d2){_0x4148fd=_0x4148fd-0x0;var _0x314711=_0x9280[_0x4148fd];return _0x314711;};'use strict';var _=require(_0x0928('0x0'));var util=require(_0x0928('0x1'));var logger=require(_0x0928('0x2'))(_0x0928('0x3'));var moment=require('moment');var BPromise=require(_0x0928('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0928('0x5'));var rimraf=require(_0x0928('0x6'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x0928('0x7')]=function(_0x42c7a7,_0x92dbf2){return _0x42c7a7['define'](_0x0928('0x8'),attributes,{'tableName':_0x0928('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf684ca,_0x11b7ec,_0x353c24){if(_0xf684ca[_0x0928('0xa')](_0x0928('0xb'))){_0xf684ca['closedAt']=moment()[_0x0928('0xc')](_0x0928('0xd'));}_0x353c24(null,_0xf684ca);}}});}; \ No newline at end of file +var _0x4edd=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0xd88b0e,_0x5e1a7a){var _0x480556=function(_0x4e13ec){while(--_0x4e13ec){_0xd88b0e['push'](_0xd88b0e['shift']());}};_0x480556(++_0x5e1a7a);}(_0x4edd,0x1de));var _0xd4ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4edd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4ed('0x0'));var util=require(_0xd4ed('0x1'));var logger=require(_0xd4ed('0x2'))(_0xd4ed('0x3'));var moment=require('moment');var BPromise=require(_0xd4ed('0x4'));var rp=require(_0xd4ed('0x5'));var fs=require('fs');var path=require(_0xd4ed('0x6'));var rimraf=require('rimraf');var config=require(_0xd4ed('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xd4ed('0x8')]=function(_0x5b4a4a,_0x305d74){return _0x5b4a4a[_0xd4ed('0x9')](_0xd4ed('0xa'),attributes,{'tableName':_0xd4ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8fb251,_0x43cad6,_0x120f9b){if(_0x8fb251[_0xd4ed('0xc')](_0xd4ed('0xd'))){_0x8fb251[_0xd4ed('0xe')]=moment()[_0xd4ed('0xf')](_0xd4ed('0x10'));}_0x120f9b(null,_0x8fb251);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f8b35fa..01e29be 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 _0xd3f3=['limit','AddTagsToFaxInteraction','find','ids','omit','AddTags','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3f3,0xd9));var _0x3d3f=function(_0x5326cf,_0x2d2646){_0x5326cf=_0x5326cf-0x0;var _0xa28cbe=_0xd3f3[_0x5326cf];return _0xa28cbe;};'use strict';var _=require('lodash');var util=require(_0x3d3f('0x0'));var moment=require(_0x3d3f('0x1'));var BPromise=require(_0x3d3f('0x2'));var rs=require(_0x3d3f('0x3'));var fs=require('fs');var Redis=require(_0x3d3f('0x4'));var db=require(_0x3d3f('0x5'))['db'];var utils=require(_0x3d3f('0x6'));var logger=require('../../config/logger')(_0x3d3f('0x7'));var config=require(_0x3d3f('0x8'));var jayson=require(_0x3d3f('0x9'));var client=jayson[_0x3d3f('0xa')][_0x3d3f('0xb')]({'port':0x232a});config['redis']=_[_0x3d3f('0xc')](config[_0x3d3f('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d3f('0xe'))[_0x3d3f('0xf')](socket);function respondWithRpcPromise(_0x48dd88,_0xed49e3,_0x24062c){return new BPromise(function(_0x122740,_0x5ab9be){return client[_0x3d3f('0x10')](_0x48dd88,_0x24062c)[_0x3d3f('0x11')](function(_0x4bc987){logger['info'](_0x3d3f('0x12'),_0xed49e3,_0x3d3f('0x13'));logger['debug'](_0x3d3f('0x14'),_0xed49e3,'request\x20sent',JSON['stringify'](_0x4bc987));if(_0x4bc987[_0x3d3f('0x15')]){if(_0x4bc987[_0x3d3f('0x15')][_0x3d3f('0x16')]===0x1f4){logger[_0x3d3f('0x15')](_0x3d3f('0x12'),_0xed49e3,_0x4bc987[_0x3d3f('0x15')][_0x3d3f('0x17')]);return _0x5ab9be(_0x4bc987[_0x3d3f('0x15')]['message']);}logger[_0x3d3f('0x15')](_0x3d3f('0x12'),_0xed49e3,_0x4bc987['error']['message']);return _0x122740(_0x4bc987[_0x3d3f('0x15')][_0x3d3f('0x17')]);}else{logger[_0x3d3f('0x18')](_0x3d3f('0x12'),_0xed49e3,'request\x20sent');_0x122740(_0x4bc987[_0x3d3f('0x19')][_0x3d3f('0x17')]);}})[_0x3d3f('0x1a')](function(_0x3e623a){logger[_0x3d3f('0x15')](_0x3d3f('0x12'),_0xed49e3,_0x3e623a);_0x5ab9be(_0x3e623a);});});}exports[_0x3d3f('0x1b')]=function(_0x6ab52e){var _0x390844=this;return new Promise(function(_0x34092e,_0x30d5e8){return db[_0x3d3f('0x1c')][_0x3d3f('0x1d')](_0x6ab52e[_0x3d3f('0x1e')],{'raw':_0x6ab52e[_0x3d3f('0x1f')]?_0x6ab52e[_0x3d3f('0x1f')][_0x3d3f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6ab52e[_0x3d3f('0x1f')]?_0x6ab52e[_0x3d3f('0x1f')][_0x3d3f('0x21')]||null:null,'attributes':_0x6ab52e[_0x3d3f('0x1f')]?_0x6ab52e['options'][_0x3d3f('0x22')]||null:null,'limit':_0x6ab52e[_0x3d3f('0x1f')]?_0x6ab52e['options'][_0x3d3f('0x23')]||null:null})[_0x3d3f('0x11')](function(_0x52c398){logger[_0x3d3f('0x18')](_0x3d3f('0x1b'),_0x6ab52e);logger['debug']('UpdateFaxInteraction',_0x6ab52e,JSON['stringify'](_0x52c398));_0x34092e(_0x52c398);})[_0x3d3f('0x1a')](function(_0x5508f8){logger[_0x3d3f('0x15')]('UpdateFaxInteraction',_0x5508f8[_0x3d3f('0x17')],_0x6ab52e);_0x30d5e8(_0x390844[_0x3d3f('0x15')](0x1f4,_0x5508f8[_0x3d3f('0x17')]));});});};exports[_0x3d3f('0x24')]=function(_0x17e944){return new Promise(function(_0x3459f5,_0x3b01a5){return db['FaxInteraction'][_0x3d3f('0x25')]({'where':_0x17e944['options']?_0x17e944['options']['where']||null:null})[_0x3d3f('0x11')](function(_0x588cbf){if(_0x588cbf){return _0x588cbf['addTags'](_0x17e944['body'][_0x3d3f('0x26')],_[_0x3d3f('0x27')](_0x17e944['body'],[_0x3d3f('0x26'),'id'])||{});}})['spread'](function(_0x36a8fe){logger[_0x3d3f('0x18')](_0x3d3f('0x28'),_0x17e944);logger[_0x3d3f('0x29')]('AddTags',_0x17e944,JSON['stringify'](_0x36a8fe));_0x3459f5(_0x36a8fe);})[_0x3d3f('0x1a')](function(_0x215e76){logger['error'](_0x3d3f('0x28'),_0x215e76[_0x3d3f('0x17')],_0x17e944);_0x3b01a5(_this[_0x3d3f('0x15')](0x1f4,_0x215e76[_0x3d3f('0x17')]));});});}; \ No newline at end of file +var _0xffe7=['addTags','ids','omit','AddTags','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','FaxInteraction','update','body','options','where','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xffe7,0x116));var _0x7ffe=function(_0x48c6b5,_0x4b615e){_0x48c6b5=_0x48c6b5-0x0;var _0x4a7632=_0xffe7[_0x48c6b5];return _0x4a7632;};'use strict';var _=require(_0x7ffe('0x0'));var util=require('util');var moment=require(_0x7ffe('0x1'));var BPromise=require(_0x7ffe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ffe('0x3'));var db=require(_0x7ffe('0x4'))['db'];var utils=require(_0x7ffe('0x5'));var logger=require(_0x7ffe('0x6'))(_0x7ffe('0x7'));var config=require(_0x7ffe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7ffe('0x9')][_0x7ffe('0xa')]({'port':0x232a});config[_0x7ffe('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7ffe('0xc'))(new Redis(config[_0x7ffe('0xb')]));require(_0x7ffe('0xd'))[_0x7ffe('0xe')](socket);function respondWithRpcPromise(_0x81e3cd,_0x256b26,_0xcb40f4){return new BPromise(function(_0x27d357,_0x4eb647){return client[_0x7ffe('0xf')](_0x81e3cd,_0xcb40f4)[_0x7ffe('0x10')](function(_0x2d0983){logger[_0x7ffe('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x256b26,_0x7ffe('0x12'));logger[_0x7ffe('0x13')](_0x7ffe('0x14'),_0x256b26,_0x7ffe('0x12'),JSON['stringify'](_0x2d0983));if(_0x2d0983[_0x7ffe('0x15')]){if(_0x2d0983['error'][_0x7ffe('0x16')]===0x1f4){logger[_0x7ffe('0x15')](_0x7ffe('0x17'),_0x256b26,_0x2d0983[_0x7ffe('0x15')][_0x7ffe('0x18')]);return _0x4eb647(_0x2d0983[_0x7ffe('0x15')][_0x7ffe('0x18')]);}logger[_0x7ffe('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x256b26,_0x2d0983[_0x7ffe('0x15')][_0x7ffe('0x18')]);return _0x27d357(_0x2d0983[_0x7ffe('0x15')][_0x7ffe('0x18')]);}else{logger[_0x7ffe('0x11')](_0x7ffe('0x17'),_0x256b26,_0x7ffe('0x12'));_0x27d357(_0x2d0983['result'][_0x7ffe('0x18')]);}})['catch'](function(_0x1029c1){logger[_0x7ffe('0x15')](_0x7ffe('0x17'),_0x256b26,_0x1029c1);_0x4eb647(_0x1029c1);});});}exports['UpdateFaxInteraction']=function(_0x1fb9f4){var _0x4046c5=this;return new Promise(function(_0xdfdd8c,_0x5db8bc){return db[_0x7ffe('0x19')][_0x7ffe('0x1a')](_0x1fb9f4[_0x7ffe('0x1b')],{'raw':_0x1fb9f4[_0x7ffe('0x1c')]?_0x1fb9f4[_0x7ffe('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fb9f4[_0x7ffe('0x1c')]?_0x1fb9f4['options'][_0x7ffe('0x1d')]||null:null,'attributes':_0x1fb9f4[_0x7ffe('0x1c')]?_0x1fb9f4[_0x7ffe('0x1c')]['attributes']||null:null,'limit':_0x1fb9f4[_0x7ffe('0x1c')]?_0x1fb9f4['options'][_0x7ffe('0x1e')]||null:null})[_0x7ffe('0x10')](function(_0x488252){logger[_0x7ffe('0x11')](_0x7ffe('0x1f'),_0x1fb9f4);logger[_0x7ffe('0x13')](_0x7ffe('0x1f'),_0x1fb9f4,JSON['stringify'](_0x488252));_0xdfdd8c(_0x488252);})['catch'](function(_0x124001){logger[_0x7ffe('0x15')](_0x7ffe('0x1f'),_0x124001[_0x7ffe('0x18')],_0x1fb9f4);_0x5db8bc(_0x4046c5[_0x7ffe('0x15')](0x1f4,_0x124001[_0x7ffe('0x18')]));});});};exports[_0x7ffe('0x20')]=function(_0x5e9925){return new Promise(function(_0x300b4a,_0x2370e2){return db['FaxInteraction'][_0x7ffe('0x21')]({'where':_0x5e9925['options']?_0x5e9925[_0x7ffe('0x1c')][_0x7ffe('0x1d')]||null:null})[_0x7ffe('0x10')](function(_0xc0f6d9){if(_0xc0f6d9){return _0xc0f6d9[_0x7ffe('0x22')](_0x5e9925[_0x7ffe('0x1b')][_0x7ffe('0x23')],_[_0x7ffe('0x24')](_0x5e9925['body'],[_0x7ffe('0x23'),'id'])||{});}})['spread'](function(_0x4b85bd){logger[_0x7ffe('0x11')](_0x7ffe('0x25'),_0x5e9925);logger[_0x7ffe('0x13')](_0x7ffe('0x25'),_0x5e9925,JSON[_0x7ffe('0x26')](_0x4b85bd));_0x300b4a(_0x4b85bd);})['catch'](function(_0x388a33){logger['error'](_0x7ffe('0x25'),_0x388a33['message'],_0x5e9925);_0x2370e2(_this[_0x7ffe('0x15')](0x1f4,_0x388a33['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 60395c9..dc3fd34 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 _0x61d3=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x23cf72,_0x40fc3e){var _0x157f57=function(_0x54987f){while(--_0x54987f){_0x23cf72['push'](_0x23cf72['shift']());}};_0x157f57(++_0x40fc3e);}(_0x61d3,0x1e9));var _0x361d=function(_0x3bb966,_0x12f2ce){_0x3bb966=_0x3bb966-0x0;var _0xa1257d=_0x61d3[_0x3bb966];return _0xa1257d;};'use strict';var FaxInteractionEvents=require(_0x361d('0x0'));var events=[_0x361d('0x1'),_0x361d('0x2'),_0x361d('0x3')];function createListener(_0x5a0c39,_0x3acf7e){return function(_0xe2e7a2){_0x3acf7e[_0x361d('0x4')](_0x5a0c39,_0xe2e7a2);};}function removeListener(_0x5e8bd6,_0x180423){return function(){FaxInteractionEvents[_0x361d('0x5')](_0x5e8bd6,_0x180423);};}exports[_0x361d('0x6')]=function(_0x50491a){for(var _0x19de90=0x0,_0x152d30=events['length'];_0x19de90<_0x152d30;_0x19de90++){var _0x18be47=events[_0x19de90];var _0x305245=createListener(_0x361d('0x7')+_0x18be47,_0x50491a);FaxInteractionEvents['on'](_0x18be47,_0x305245);}}; \ No newline at end of file +var _0x4ef5=['remove','emit','removeListener','register','faxInteraction:','./faxInteraction.events','save'];(function(_0x47878f,_0x48d3bf){var _0x4b05b8=function(_0x3d6597){while(--_0x3d6597){_0x47878f['push'](_0x47878f['shift']());}};_0x4b05b8(++_0x48d3bf);}(_0x4ef5,0xbb));var _0x54ef=function(_0x45a611,_0x50612f){_0x45a611=_0x45a611-0x0;var _0x3279d7=_0x4ef5[_0x45a611];return _0x3279d7;};'use strict';var FaxInteractionEvents=require(_0x54ef('0x0'));var events=[_0x54ef('0x1'),_0x54ef('0x2'),'update'];function createListener(_0x4a7fe8,_0x154b41){return function(_0x48fc58){_0x154b41[_0x54ef('0x3')](_0x4a7fe8,_0x48fc58);};}function removeListener(_0x10209e,_0xec51fb){return function(){FaxInteractionEvents[_0x54ef('0x4')](_0x10209e,_0xec51fb);};}exports[_0x54ef('0x5')]=function(_0x17255d){for(var _0x3dab20=0x0,_0x4de87f=events['length'];_0x3dab20<_0x4de87f;_0x3dab20++){var _0x5bbed4=events[_0x3dab20];var _0x2f4bb7=createListener(_0x54ef('0x6')+_0x5bbed4,_0x17255d);FaxInteractionEvents['on'](_0x5bbed4,_0x2f4bb7);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7fc23c8..262dc8c 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 _0xbb94=['addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','update','delete','faxinteraction:destroy','removeTags','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','getMessages','download','post','create','/:id/messages'];(function(_0x3aad3e,_0x217397){var _0x21ab5d=function(_0x109bd0){while(--_0x109bd0){_0x3aad3e['push'](_0x3aad3e['shift']());}};_0x21ab5d(++_0x217397);}(_0xbb94,0xde));var _0x4bb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb94[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4bb9('0x0'));var timeout=require('connect-timeout');var express=require(_0x4bb9('0x1'));var router=express[_0x4bb9('0x2')]();var auth=require(_0x4bb9('0x3'));var interaction=require(_0x4bb9('0x4'));var config=require(_0x4bb9('0x5'));var controller=require(_0x4bb9('0x6'));router[_0x4bb9('0x7')]('/',auth[_0x4bb9('0x8')](),controller[_0x4bb9('0x9')]);router['get'](_0x4bb9('0xa'),auth[_0x4bb9('0x8')](),controller[_0x4bb9('0xb')]);router['get'](_0x4bb9('0xc'),auth[_0x4bb9('0x8')](),controller['show']);router[_0x4bb9('0x7')]('/:id/messages',auth[_0x4bb9('0x8')](),controller[_0x4bb9('0xd')]);router['get']('/:id/download',auth[_0x4bb9('0x8')](),controller[_0x4bb9('0xe')]);router[_0x4bb9('0xf')]('/',auth[_0x4bb9('0x8')](),controller[_0x4bb9('0x10')]);router['post'](_0x4bb9('0x11'),auth['isAuthenticated'](),controller[_0x4bb9('0x12')]);router[_0x4bb9('0xf')](_0x4bb9('0x13'),auth[_0x4bb9('0x8')](),interaction[_0x4bb9('0x14')]('fax',_0x4bb9('0x15')),controller[_0x4bb9('0x16')]);router[_0x4bb9('0x17')](_0x4bb9('0xc'),auth[_0x4bb9('0x8')](),interaction[_0x4bb9('0x14')](_0x4bb9('0x18'),'faxinteraction:update'),controller[_0x4bb9('0x19')]);router[_0x4bb9('0x1a')]('/:id',auth[_0x4bb9('0x8')](),interaction['tracked'](_0x4bb9('0x18'),_0x4bb9('0x1b')),controller['destroy']);router['delete'](_0x4bb9('0x13'),auth[_0x4bb9('0x8')](),controller[_0x4bb9('0x1c')]);module[_0x4bb9('0x1d')]=router; \ No newline at end of file +var _0x57ae=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','describe','/:id','isAuthenticated','show','getMessages','/:id/download','post','create','/:id/messages','/:id/tags','fax','addTags','put','tracked','faxinteraction:update','faxinteraction:destroy','destroy','delete','removeTags','exports'];(function(_0x2b4e57,_0x4a7957){var _0x3a2a8e=function(_0x2251bd){while(--_0x2251bd){_0x2b4e57['push'](_0x2b4e57['shift']());}};_0x3a2a8e(++_0x4a7957);}(_0x57ae,0xb4));var _0xe57a=function(_0x50cb49,_0x287916){_0x50cb49=_0x50cb49-0x0;var _0x47b36c=_0x57ae[_0x50cb49];return _0x47b36c;};'use strict';var multer=require('multer');var util=require(_0xe57a('0x0'));var path=require(_0xe57a('0x1'));var timeout=require(_0xe57a('0x2'));var express=require(_0xe57a('0x3'));var router=express[_0xe57a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe57a('0x5'));var config=require(_0xe57a('0x6'));var controller=require(_0xe57a('0x7'));router[_0xe57a('0x8')]('/',auth['isAuthenticated'](),controller[_0xe57a('0x9')]);router[_0xe57a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe57a('0xa')]);router[_0xe57a('0x8')](_0xe57a('0xb'),auth[_0xe57a('0xc')](),controller[_0xe57a('0xd')]);router[_0xe57a('0x8')]('/:id/messages',auth[_0xe57a('0xc')](),controller[_0xe57a('0xe')]);router[_0xe57a('0x8')](_0xe57a('0xf'),auth[_0xe57a('0xc')](),controller['download']);router[_0xe57a('0x10')]('/',auth[_0xe57a('0xc')](),controller[_0xe57a('0x11')]);router[_0xe57a('0x10')](_0xe57a('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0xe57a('0x10')](_0xe57a('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0xe57a('0x14'),'faxinteraction:addtags'),controller[_0xe57a('0x15')]);router[_0xe57a('0x16')](_0xe57a('0xb'),auth[_0xe57a('0xc')](),interaction[_0xe57a('0x17')](_0xe57a('0x14'),_0xe57a('0x18')),controller['update']);router['delete'](_0xe57a('0xb'),auth[_0xe57a('0xc')](),interaction[_0xe57a('0x17')](_0xe57a('0x14'),_0xe57a('0x19')),controller[_0xe57a('0x1a')]);router[_0xe57a('0x1b')](_0xe57a('0x13'),auth[_0xe57a('0xc')](),controller[_0xe57a('0x1c')]);module[_0xe57a('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 744ba36..82eb2cc 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 _0xcfc9=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0xcfc9,0x9c));var _0x9cfc=function(_0x5cd473,_0x338664){_0x5cd473=_0x5cd473-0x0;var _0x399643=_0xcfc9[_0x5cd473];return _0x399643;};'use strict';var Sequelize=require(_0x9cfc('0x0'));module[_0x9cfc('0x1')]={'body':{'type':Sequelize[_0x9cfc('0x2')](_0x9cfc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9cfc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9cfc('0x5')]('in',_0x9cfc('0x6')),'defaultValue':_0x9cfc('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9cfc('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9cfc('0x7')]}}; \ No newline at end of file +var _0xb255=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2f2c51,_0x1a7b83){var _0x30c8b3=function(_0x20305a){while(--_0x20305a){_0x2f2c51['push'](_0x2f2c51['shift']());}};_0x30c8b3(++_0x1a7b83);}(_0xb255,0xbb));var _0x5b25=function(_0x483a6f,_0x5c11bd){_0x483a6f=_0x483a6f-0x0;var _0x1fc2df=_0xb255[_0x483a6f];return _0x1fc2df;};'use strict';var Sequelize=require(_0x5b25('0x0'));module[_0x5b25('0x1')]={'body':{'type':Sequelize[_0x5b25('0x2')](_0x5b25('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5b25('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5b25('0x5')]('in',_0x5b25('0x6')),'defaultValue':_0x5b25('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5b25('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x5b25('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 3a083c1..cd58e55 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 _0xfecc=['SendFax','FaxAccountId','basename','download','root','server','files','attachments','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','./faxMessage.socket','register','jayson/promise','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','FaxMessage,\x20%s,\x20%s','info','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','destroy','then','stack','name','send','index','FaxMessage','rawAttributes','model','keys','query','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filters','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','rows','show','params','intersection','find','body','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','CmContact','Contact','get','FaxInteraction','YYYY-MM-DD\x20HH:mm:ss','role','interaction','stringify','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','../../config/logger','reject','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','event','rejectmessage','create','findOne','ContactId','isNil','Attachment','AttachmentId'];(function(_0x2b5a6c,_0x496c32){var _0x5202ad=function(_0x2ae431){while(--_0x2ae431){_0x2b5a6c['push'](_0x2b5a6c['shift']());}};_0x5202ad(++_0x496c32);}(_0xfecc,0x112));var _0xcfec=function(_0x1689be,_0x4f4dd4){_0x1689be=_0x1689be-0x0;var _0x164117=_0xfecc[_0x1689be];return _0x164117;};'use strict';var pdf=require(_0xcfec('0x0'));var emlformat=require(_0xcfec('0x1'));var rimraf=require(_0xcfec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfec('0x3'));var rp=require(_0xcfec('0x4'));var moment=require(_0xcfec('0x5'));var BPromise=require(_0xcfec('0x6'));var Mustache=require(_0xcfec('0x7'));var util=require(_0xcfec('0x8'));var path=require(_0xcfec('0x9'));var sox=require(_0xcfec('0xa'));var csv=require(_0xcfec('0xb'));var ejs=require(_0xcfec('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcfec('0xd'));var crypto=require(_0xcfec('0xe'));var jsforce=require(_0xcfec('0xf'));var deskjs=require(_0xcfec('0x10'));var toCsv=require(_0xcfec('0xb'));var querystring=require(_0xcfec('0x11'));var Papa=require(_0xcfec('0x12'));var Redis=require(_0xcfec('0x13'));var authService=require(_0xcfec('0x14'));var qs=require(_0xcfec('0x15'));var hardwareService=require(_0xcfec('0x16'));var logger=require('../../config/logger')(_0xcfec('0x17'));var utils=require(_0xcfec('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xcfec('0x19')]=_['defaults'](config[_0xcfec('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcfec('0x1a'))[_0xcfec('0x1b')](socket);var jayson=require(_0xcfec('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1ce8d6,_0xcb8f36,_0x3a99b7){if(_0x3a99b7){var _0x478b3b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x478b3b['test'](_0xcb8f36)){return _0x1ce8d6;}else{throw new db['Sequelize'][(_0xcfec('0x1d'))](_0xcfec('0x1e'));}}else{return _0x1ce8d6;}}function respondWithRpcPromise(_0x4f94db,_0x41f77f,_0x1dccd8,_0x2857a8){return new BPromise(function(_0x5b1a5c,_0x14b1e7){var _0x4572e7=_0x2857a8||client;return _0x4572e7[_0xcfec('0x1f')](_0x4f94db,_0x1dccd8)['then'](function(_0x4ed4a0){logger['info']('FaxMessage,\x20%s,\x20%s',_0x41f77f,_0xcfec('0x20'));logger[_0xcfec('0x21')](_0xcfec('0x22'),_0x41f77f,'request\x20sent',JSON['stringify'](_0x4ed4a0));if(_0x4ed4a0['error']){if(_0x4ed4a0[_0xcfec('0x23')][_0xcfec('0x24')]===0x1f4){logger[_0xcfec('0x23')]('FaxMessage,\x20%s,\x20%s',_0x41f77f,_0x4ed4a0[_0xcfec('0x23')]['message']);return _0x14b1e7(_0x4ed4a0['error'][_0xcfec('0x25')]);}logger[_0xcfec('0x23')](_0xcfec('0x26'),_0x41f77f,_0x4ed4a0[_0xcfec('0x23')][_0xcfec('0x25')]);return _0x5b1a5c(_0x4ed4a0[_0xcfec('0x23')][_0xcfec('0x25')]);}else{logger[_0xcfec('0x27')]('FaxMessage,\x20%s,\x20%s',_0x41f77f,_0xcfec('0x20'));_0x5b1a5c(_0x4ed4a0['result'][_0xcfec('0x25')]);}})[_0xcfec('0x28')](function(_0x1985d0){logger[_0xcfec('0x23')](_0xcfec('0x26'),_0x41f77f,_0x1985d0);_0x14b1e7(_0x1985d0);});});}function respondWithStatusCode(_0x317331,_0x29ea5d){_0x29ea5d=_0x29ea5d||0xcc;return function(_0x1b7ce6){if(_0x1b7ce6){return _0x317331[_0xcfec('0x29')](_0x29ea5d);}return _0x317331[_0xcfec('0x2a')](_0x29ea5d)[_0xcfec('0x2b')]();};}function respondWithResult(_0xc9f05e,_0x3b5ddc){_0x3b5ddc=_0x3b5ddc||0xc8;return function(_0x5a8a35){if(_0x5a8a35){return _0xc9f05e['status'](_0x3b5ddc)[_0xcfec('0x2c')](_0x5a8a35);}};}function respondWithFilteredResult(_0x49ef86,_0x110f64){return function(_0x2948ec){if(_0x2948ec){var _0x53f105=_0x2948ec[_0xcfec('0x2d')],_0x2da025=_0x110f64[_0xcfec('0x2e')],_0x228ada=_0x110f64[_0xcfec('0x2e')]+_0x110f64['limit'],_0x5869c6;if(_0x228ada>=_0x53f105){_0x228ada=_0x53f105;_0x5869c6=0xc8;}else{_0x5869c6=0xce;}_0x49ef86[_0xcfec('0x2a')](_0x5869c6);return _0x49ef86[_0xcfec('0x2f')](_0xcfec('0x30'),_0x2da025+'-'+_0x228ada+'/'+_0x53f105)[_0xcfec('0x2c')](_0x2948ec);}return null;};}function patchUpdates(_0x31d977){return function(_0x134bdf){try{jsonpatch[_0xcfec('0x31')](_0x134bdf,_0x31d977,!![]);}catch(_0x1e3da6){return BPromise['reject'](_0x1e3da6);}return _0x134bdf['save']();};}function saveUpdates(_0x4f7659,_0x1d7c1e){return function(_0x2dfc2b){if(_0x2dfc2b){return _0x2dfc2b[_0xcfec('0x32')](_0x4f7659)['then'](function(_0x29191d){return _0x29191d;});}return null;};}function removeEntity(_0x57f7f8,_0x5f1e3e){return function(_0x2ee9b7){if(_0x2ee9b7){return _0x2ee9b7[_0xcfec('0x33')]()[_0xcfec('0x34')](function(){_0x57f7f8[_0xcfec('0x2a')](0xcc)[_0xcfec('0x2b')]();});}};}function handleEntityNotFound(_0x43a69e,_0x34022b){return function(_0x2012c4){if(!_0x2012c4){_0x43a69e[_0xcfec('0x29')](0x194);}return _0x2012c4;};}function handleError(_0x581ba3,_0x479c6b){_0x479c6b=_0x479c6b||0x1f4;return function(_0x3d68e8){logger[_0xcfec('0x23')](_0x3d68e8[_0xcfec('0x35')]);if(_0x3d68e8[_0xcfec('0x36')]){delete _0x3d68e8[_0xcfec('0x36')];}_0x581ba3[_0xcfec('0x2a')](_0x479c6b)[_0xcfec('0x37')](_0x3d68e8);};}exports[_0xcfec('0x38')]=function(_0x3f63a3,_0x41a70b){var _0x31995c={},_0x14fce3={},_0x3f5302={'count':0x0,'rows':[]};var _0x2418d9=db[_0xcfec('0x39')][_0xcfec('0x3a')];_0x14fce3[_0xcfec('0x3b')]=_[_0xcfec('0x3c')](_0x2418d9);_0x14fce3['query']=_['keys'](_0x3f63a3['query']);_0x14fce3['filters']=_['intersection'](_0x14fce3[_0xcfec('0x3b')],_0x14fce3[_0xcfec('0x3d')]);_0x31995c[_0xcfec('0x3e')]=_['intersection'](_0x14fce3[_0xcfec('0x3b')],qs[_0xcfec('0x3f')](_0x3f63a3['query'][_0xcfec('0x3f')]));_0x31995c[_0xcfec('0x3e')]=_0x31995c['attributes'][_0xcfec('0x40')]?_0x31995c[_0xcfec('0x3e')]:_0x14fce3[_0xcfec('0x3b')];if(!_0x3f63a3[_0xcfec('0x3d')][_0xcfec('0x41')]('nolimit')){_0x31995c[_0xcfec('0x42')]=qs['limit'](_0x3f63a3[_0xcfec('0x3d')][_0xcfec('0x42')]);_0x31995c[_0xcfec('0x2e')]=qs[_0xcfec('0x2e')](_0x3f63a3[_0xcfec('0x3d')][_0xcfec('0x2e')]);}_0x31995c['order']=qs[_0xcfec('0x43')](_0x3f63a3[_0xcfec('0x3d')][_0xcfec('0x43')]);_0x31995c[_0xcfec('0x44')]=qs['filters'](_[_0xcfec('0x45')](_0x3f63a3['query'],_0x14fce3[_0xcfec('0x46')]));if(_0x3f63a3[_0xcfec('0x3d')][_0xcfec('0x47')]){_0x31995c[_0xcfec('0x44')]=_[_0xcfec('0x48')](_0x31995c[_0xcfec('0x44')],{'$or':_[_0xcfec('0x49')](_0x2418d9,function(_0x277874){if(_0x277874[_0xcfec('0x4a')][_0xcfec('0x4b')]!==_0xcfec('0x4c')){var _0x4731af={};_0x4731af[_0x277874['field']]={'$like':'%'+_0x3f63a3['query'][_0xcfec('0x47')]+'%'};return _0x4731af;}})});}_0x31995c=_['merge']({},_0x31995c,_0x3f63a3[_0xcfec('0x4d')]);var _0x412412={'where':_0x31995c['where']};return db['FaxMessage']['count'](_0x412412)['then'](function(_0x45350e){_0x3f5302[_0xcfec('0x2d')]=_0x45350e;if(_0x3f63a3[_0xcfec('0x3d')][_0xcfec('0x4e')]){_0x31995c[_0xcfec('0x4f')]=[{'all':!![]}];}return db[_0xcfec('0x39')]['findAll'](_0x31995c);})[_0xcfec('0x34')](function(_0x2d2c01){_0x3f5302[_0xcfec('0x50')]=_0x2d2c01;return _0x3f5302;})[_0xcfec('0x34')](respondWithFilteredResult(_0x41a70b,_0x31995c))[_0xcfec('0x28')](handleError(_0x41a70b,null));};exports[_0xcfec('0x51')]=function(_0x562063,_0x3e903b){var _0x183535={'raw':!![],'where':{'id':_0x562063[_0xcfec('0x52')]['id']}},_0x3f5e1d={};_0x3f5e1d[_0xcfec('0x3b')]=_[_0xcfec('0x3c')](db[_0xcfec('0x39')][_0xcfec('0x3a')]);_0x3f5e1d[_0xcfec('0x3d')]=_[_0xcfec('0x3c')](_0x562063[_0xcfec('0x3d')]);_0x3f5e1d[_0xcfec('0x46')]=_['intersection'](_0x3f5e1d[_0xcfec('0x3b')],_0x3f5e1d['query']);_0x183535[_0xcfec('0x3e')]=_[_0xcfec('0x53')](_0x3f5e1d[_0xcfec('0x3b')],qs[_0xcfec('0x3f')](_0x562063[_0xcfec('0x3d')]['fields']));_0x183535['attributes']=_0x183535[_0xcfec('0x3e')][_0xcfec('0x40')]?_0x183535[_0xcfec('0x3e')]:_0x3f5e1d[_0xcfec('0x3b')];if(_0x562063['query'][_0xcfec('0x4e')]){_0x183535[_0xcfec('0x4f')]=[{'all':!![]}];}_0x183535=_[_0xcfec('0x48')]({},_0x183535,_0x562063[_0xcfec('0x4d')]);return db['FaxMessage'][_0xcfec('0x54')](_0x183535)[_0xcfec('0x34')](handleEntityNotFound(_0x3e903b,null))[_0xcfec('0x34')](respondWithResult(_0x3e903b,null))['catch'](handleError(_0x3e903b,null));};exports[_0xcfec('0x32')]=function(_0x5f3eb7,_0x39fa2b){if(_0x5f3eb7[_0xcfec('0x55')]['id']){delete _0x5f3eb7['body']['id'];}return db['FaxMessage'][_0xcfec('0x54')]({'where':{'id':_0x5f3eb7['params']['id']}})['then'](handleEntityNotFound(_0x39fa2b,null))[_0xcfec('0x34')](saveUpdates(_0x5f3eb7[_0xcfec('0x55')],null))[_0xcfec('0x34')](respondWithResult(_0x39fa2b,null))['catch'](handleError(_0x39fa2b,null));};exports[_0xcfec('0x33')]=function(_0x194796,_0x40be14){return db['FaxMessage'][_0xcfec('0x54')]({'where':{'id':_0x194796[_0xcfec('0x52')]['id']}})[_0xcfec('0x34')](handleEntityNotFound(_0x40be14,null))[_0xcfec('0x34')](removeEntity(_0x40be14,null))[_0xcfec('0x28')](handleError(_0x40be14,null));};exports[_0xcfec('0x56')]=function(_0x4242ee,_0x54ba9d){return db[_0xcfec('0x39')][_0xcfec('0x56')]()[_0xcfec('0x34')](respondWithResult(_0x54ba9d,null))['catch'](handleError(_0x54ba9d,null));};var interaction_log=require('../../config/logger')(_0xcfec('0x57'));exports[_0xcfec('0x58')]=function(_0xd4c6ad,_0x3d6b3e,_0x10ddfb){var _0x4e4663={'channel':_0xcfec('0x59')};if(_0xd4c6ad[_0xcfec('0x55')]['id']){delete _0xd4c6ad[_0xcfec('0x55')]['id'];}_0xd4c6ad[_0xcfec('0x55')][_0xcfec('0x5a')]=!![];_0xd4c6ad[_0xcfec('0x55')][_0xcfec('0x5b')]=moment()[_0xcfec('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0xd4c6ad['body'][_0xcfec('0x5d')]=_0xd4c6ad['body'][_0xcfec('0x5d')]||_0xd4c6ad[_0xcfec('0x5e')]['id'];return db[_0xcfec('0x39')][_0xcfec('0x54')]({'where':{'id':_0xd4c6ad[_0xcfec('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xcfec('0x5f')],'as':_0xcfec('0x60')}]})[_0xcfec('0x34')](handleEntityNotFound(_0x3d6b3e,null))[_0xcfec('0x34')](saveUpdates(_0xd4c6ad['body'],null))['then'](function(_0x187489){if(_0x187489){_0x4e4663[_0xcfec('0x25')]=_0x187489[_0xcfec('0x61')]({'plain':!![]});return db[_0xcfec('0x62')][_0xcfec('0x54')]({'where':{'id':_0x187489['FaxInteractionId']}});}return null;})[_0xcfec('0x34')](handleEntityNotFound(_0x3d6b3e,null))[_0xcfec('0x34')](function(_0xa5666c){if(_0xa5666c){return _0xa5666c[_0xcfec('0x32')]({'UserId':_0xd4c6ad[_0xcfec('0x55')][_0xcfec('0x5d')],'read1stAt':_['isNil'](_0xa5666c['read1stAt'])?moment()[_0xcfec('0x5c')](_0xcfec('0x63')):undefined});}return null;})[_0xcfec('0x34')](function(_0x4413cc){if(_0x4413cc){_0x4e4663['interaction']=_0x4413cc['get']({'plain':!![]});interaction_log[_0xcfec('0x27')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd4c6ad[_0xcfec('0x5e')]['id'],_0xd4c6ad[_0xcfec('0x5e')][_0xcfec('0x36')],_0xd4c6ad[_0xcfec('0x5e')][_0xcfec('0x64')],_0x4e4663[_0xcfec('0x65')]['id'],_0xd4c6ad[_0xcfec('0x55')]?JSON[_0xcfec('0x66')](_0xd4c6ad['body']):'null');return respondWithRpcPromise(_0xcfec('0x67'),'acceptMessage',_0x4e4663);}return null;})[_0xcfec('0x34')](function(_0x30a466){if(_0x30a466){if(_0xd4c6ad[_0xcfec('0x55')][_0xcfec('0x68')]){_0x4e4663[_0xcfec('0x25')][_0xcfec('0x69')]=util[_0xcfec('0x5c')]('SIP/%s',_0xd4c6ad[_0xcfec('0x5e')][_0xcfec('0x36')]);_0x4e4663['message'][_0xcfec('0x6a')]=_0x4e4663[_0xcfec('0x6a')];_0x4e4663[_0xcfec('0x25')]['event']=_0xcfec('0x58');return respondWithRpcPromise(_0xcfec('0x6b'),'EventManager',{'event':_0xcfec('0x6c'),'message':_0x4e4663['message']},client9002)['then'](function(){return _0x4e4663;});}return _0x4e4663;}return null;})[_0xcfec('0x34')](respondWithResult(_0x3d6b3e,null))[_0xcfec('0x28')](handleError(_0x3d6b3e,null));};var interaction_log=require(_0xcfec('0x6d'))('fax-interactions');exports[_0xcfec('0x6e')]=function(_0x4b87dd,_0x4e590f,_0x402f58){var _0x4573c9={'agent':{},'channel':_0xcfec('0x59')};if(_0x4b87dd[_0xcfec('0x55')]['id']){delete _0x4b87dd[_0xcfec('0x55')]['id'];}_0x4b87dd['body'][_0xcfec('0x5d')]=_0x4b87dd[_0xcfec('0x55')]['UserId']||_0x4b87dd[_0xcfec('0x5e')]['id'];_0x4573c9['agent']['id']=_0x4b87dd[_0xcfec('0x55')][_0xcfec('0x5d')];return db[_0xcfec('0x39')][_0xcfec('0x54')]({'where':{'id':_0x4b87dd['params']['id'],'UserId':null}})[_0xcfec('0x34')](handleEntityNotFound(_0x4e590f,null))[_0xcfec('0x34')](function(_0x3b9c88){if(_0x3b9c88){_0x4573c9[_0xcfec('0x25')]=_0x3b9c88[_0xcfec('0x61')]({'plain':!![]});return db['FaxInteraction'][_0xcfec('0x54')]({'where':{'id':_0x3b9c88[_0xcfec('0x6f')]}});}return null;})[_0xcfec('0x34')](handleEntityNotFound(_0x4e590f,null))[_0xcfec('0x34')](function(_0x4e8022){if(_0x4e8022){_0x4573c9['interaction']=_0x4e8022[_0xcfec('0x61')]({'plain':!![]});interaction_log['info'](_0xcfec('0x70'),_0x4b87dd['user']['id'],_0x4b87dd[_0xcfec('0x5e')][_0xcfec('0x36')],_0x4b87dd[_0xcfec('0x5e')][_0xcfec('0x64')],_0x4573c9['interaction']['id'],_0x4b87dd[_0xcfec('0x55')]?JSON[_0xcfec('0x66')](_0x4b87dd[_0xcfec('0x55')]):_0xcfec('0x71'));return respondWithRpcPromise(_0xcfec('0x72'),_0xcfec('0x73'),_0x4573c9);}return null;})[_0xcfec('0x34')](function(_0xa3c1b5){if(_0xa3c1b5){_0xa3c1b5[_0xcfec('0x25')]['interface']=util[_0xcfec('0x5c')](_0xcfec('0x74'),_0x4b87dd[_0xcfec('0x5e')]['name']);_0xa3c1b5[_0xcfec('0x25')][_0xcfec('0x6a')]=_0x4573c9[_0xcfec('0x6a')];_0xa3c1b5[_0xcfec('0x25')][_0xcfec('0x75')]=_0xcfec('0x6e');respondWithRpcPromise(_0xcfec('0x6b'),_0xcfec('0x6b'),{'event':_0xcfec('0x76'),'message':_0xa3c1b5[_0xcfec('0x25')]},client9002);return _0x4573c9;}return null;})['then'](respondWithResult(_0x4e590f,null))[_0xcfec('0x28')](handleError(_0x4e590f,null));};exports['create']=function(_0x3469c6,_0x29225d){var _0x284a64;return db['FaxMessage'][_0xcfec('0x77')](_0x3469c6[_0xcfec('0x55')],{})[_0xcfec('0x34')](function(_0x54d089){_0x284a64=_0x54d089;return db[_0xcfec('0x5f')][_0xcfec('0x78')]({'where':{'id':_0x284a64[_0xcfec('0x79')]}});})[_0xcfec('0x34')](function(_0x2ef12d){if(_[_0xcfec('0x7a')](_0x2ef12d)){return;}else{_0x284a64[_0xcfec('0x59')]=_0x2ef12d['fax'];return db[_0xcfec('0x7b')]['findOne']({'where':{'id':_0x284a64[_0xcfec('0x7c')]}});}})['then'](function(_0x5c3d69){return respondWithRpcPromise(_0xcfec('0x7d'),'SendFax',{'FaxAccountId':_[_0xcfec('0x7a')](_0x3469c6[_0xcfec('0x55')])?undefined:_0x3469c6[_0xcfec('0x55')][_0xcfec('0x7e')],'path':_['isNil'](_0x5c3d69)?undefined:util[_0xcfec('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x5c3d69[_0xcfec('0x7f')]),'fax':_[_0xcfec('0x7a')](_0x284a64[_0xcfec('0x59')])?undefined:_0x284a64[_0xcfec('0x59')],'AttachmentId':_0x284a64[_0xcfec('0x7c')]},client9002);})[_0xcfec('0x34')](respondWithResult(_0x29225d,0xc9))[_0xcfec('0x28')](handleError(_0x29225d,null));};exports[_0xcfec('0x80')]=function(_0x30f551,_0x120d79){var _0x584f74=path['join'](config[_0xcfec('0x81')],_0xcfec('0x82'),_0xcfec('0x83'),_0xcfec('0x84'));return db[_0xcfec('0x39')]['find']({'where':{'id':_0x30f551[_0xcfec('0x52')]['id']},'include':[{'model':db[_0xcfec('0x7b')],'as':_0xcfec('0x7b')}]})[_0xcfec('0x34')](handleEntityNotFound(_0x120d79,null))[_0xcfec('0x34')](function(_0x30f0b6){if(_0x30f0b6){return _0x120d79[_0xcfec('0x80')](path['join'](_0x584f74,_0x30f0b6['Attachment'][_0xcfec('0x7f')]));}})[_0xcfec('0x28')](handleError(_0x120d79,null));}; \ No newline at end of file +var _0x362d=['keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','field','merge','FaxMessage','count','include','findAll','rows','show','params','rawAttributes','length','includeAll','options','find','body','describe','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','fax-interactions','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','create','findOne','ContactId','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','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~!@#$%^&-_=+[{]}.','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','index','model'];(function(_0x39b352,_0x5db49d){var _0x4a39d3=function(_0x277004){while(--_0x277004){_0x39b352['push'](_0x39b352['shift']());}};_0x4a39d3(++_0x5db49d);}(_0x362d,0x1e1));var _0xd362=function(_0x2e1238,_0x4cca91){_0x2e1238=_0x2e1238-0x0;var _0x50ab80=_0x362d[_0x2e1238];return _0x50ab80;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd362('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd362('0x1'));var jsonpatch=require(_0xd362('0x2'));var rp=require(_0xd362('0x3'));var moment=require(_0xd362('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd362('0x5'));var util=require('util');var path=require(_0xd362('0x6'));var sox=require(_0xd362('0x7'));var csv=require(_0xd362('0x8'));var ejs=require(_0xd362('0x9'));var fs=require('fs');var _=require(_0xd362('0xa'));var squel=require(_0xd362('0xb'));var crypto=require('crypto');var jsforce=require(_0xd362('0xc'));var deskjs=require(_0xd362('0xd'));var toCsv=require(_0xd362('0x8'));var querystring=require(_0xd362('0xe'));var Papa=require('papaparse');var Redis=require(_0xd362('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xd362('0x10'));var logger=require(_0xd362('0x11'))(_0xd362('0x12'));var utils=require(_0xd362('0x13'));var config=require(_0xd362('0x14'));var db=require(_0xd362('0x15'))['db'];config[_0xd362('0x16')]=_[_0xd362('0x17')](config[_0xd362('0x16')],{'host':_0xd362('0x18'),'port':0x18eb});var socket=require(_0xd362('0x19'))(new Redis(config[_0xd362('0x16')]));require('./faxMessage.socket')[_0xd362('0x1a')](socket);var jayson=require(_0xd362('0x1b'));var client=jayson['client'][_0xd362('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xd362('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x566629,_0x45120f,_0x31a2a1){if(_0x31a2a1){var _0x5110f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5110f3['test'](_0x45120f)){return _0x566629;}else{throw new db[(_0xd362('0x1d'))]['ValidationError'](_0xd362('0x1e'));}}else{return _0x566629;}}function respondWithRpcPromise(_0x100973,_0x59b48c,_0x4c7a05,_0x15266b){return new BPromise(function(_0xbb95c9,_0x527b19){var _0x12420f=_0x15266b||client;return _0x12420f['request'](_0x100973,_0x4c7a05)[_0xd362('0x1f')](function(_0x67237a){logger[_0xd362('0x20')](_0xd362('0x21'),_0x59b48c,_0xd362('0x22'));logger[_0xd362('0x23')](_0xd362('0x24'),_0x59b48c,_0xd362('0x22'),JSON[_0xd362('0x25')](_0x67237a));if(_0x67237a['error']){if(_0x67237a['error'][_0xd362('0x26')]===0x1f4){logger[_0xd362('0x27')]('FaxMessage,\x20%s,\x20%s',_0x59b48c,_0x67237a[_0xd362('0x27')][_0xd362('0x28')]);return _0x527b19(_0x67237a[_0xd362('0x27')][_0xd362('0x28')]);}logger[_0xd362('0x27')](_0xd362('0x21'),_0x59b48c,_0x67237a[_0xd362('0x27')][_0xd362('0x28')]);return _0xbb95c9(_0x67237a[_0xd362('0x27')][_0xd362('0x28')]);}else{logger[_0xd362('0x20')](_0xd362('0x21'),_0x59b48c,_0xd362('0x22'));_0xbb95c9(_0x67237a[_0xd362('0x29')][_0xd362('0x28')]);}})[_0xd362('0x2a')](function(_0x4da35e){logger['error']('FaxMessage,\x20%s,\x20%s',_0x59b48c,_0x4da35e);_0x527b19(_0x4da35e);});});}function respondWithStatusCode(_0x5d4fce,_0x5d8518){_0x5d8518=_0x5d8518||0xcc;return function(_0x2b0e8e){if(_0x2b0e8e){return _0x5d4fce[_0xd362('0x2b')](_0x5d8518);}return _0x5d4fce[_0xd362('0x2c')](_0x5d8518)[_0xd362('0x2d')]();};}function respondWithResult(_0x2de27a,_0x957f3a){_0x957f3a=_0x957f3a||0xc8;return function(_0x3660c0){if(_0x3660c0){return _0x2de27a[_0xd362('0x2c')](_0x957f3a)[_0xd362('0x2e')](_0x3660c0);}};}function respondWithFilteredResult(_0x4aafc9,_0x2ad2e8){return function(_0x4bf29a){if(_0x4bf29a){var _0x5213d4=_0x4bf29a['count'],_0x51a54c=_0x2ad2e8[_0xd362('0x2f')],_0x44cf4a=_0x2ad2e8['offset']+_0x2ad2e8[_0xd362('0x30')],_0x4eac4c;if(_0x44cf4a>=_0x5213d4){_0x44cf4a=_0x5213d4;_0x4eac4c=0xc8;}else{_0x4eac4c=0xce;}_0x4aafc9['status'](_0x4eac4c);return _0x4aafc9[_0xd362('0x31')]('Content-Range',_0x51a54c+'-'+_0x44cf4a+'/'+_0x5213d4)['json'](_0x4bf29a);}return null;};}function patchUpdates(_0x1b476b){return function(_0x66230c){try{jsonpatch[_0xd362('0x32')](_0x66230c,_0x1b476b,!![]);}catch(_0x121b97){return BPromise[_0xd362('0x33')](_0x121b97);}return _0x66230c[_0xd362('0x34')]();};}function saveUpdates(_0x14edd2,_0xdcb3a5){return function(_0x25f07d){if(_0x25f07d){return _0x25f07d[_0xd362('0x35')](_0x14edd2)[_0xd362('0x1f')](function(_0x306858){return _0x306858;});}return null;};}function removeEntity(_0x433d4d,_0x3364e4){return function(_0x178480){if(_0x178480){return _0x178480[_0xd362('0x36')]()[_0xd362('0x1f')](function(){_0x433d4d[_0xd362('0x2c')](0xcc)[_0xd362('0x2d')]();});}};}function handleEntityNotFound(_0x46d282,_0x1a1855){return function(_0x3a189e){if(!_0x3a189e){_0x46d282[_0xd362('0x2b')](0x194);}return _0x3a189e;};}function handleError(_0x2e0b94,_0x5ce4d3){_0x5ce4d3=_0x5ce4d3||0x1f4;return function(_0x3af5c5){logger[_0xd362('0x27')](_0x3af5c5[_0xd362('0x37')]);if(_0x3af5c5[_0xd362('0x38')]){delete _0x3af5c5[_0xd362('0x38')];}_0x2e0b94[_0xd362('0x2c')](_0x5ce4d3)['send'](_0x3af5c5);};}exports[_0xd362('0x39')]=function(_0x1db264,_0x53bb34){var _0x5a7a39={},_0x1035a3={},_0x4578fe={'count':0x0,'rows':[]};var _0x3c44ee=db['FaxMessage']['rawAttributes'];_0x1035a3[_0xd362('0x3a')]=_[_0xd362('0x3b')](_0x3c44ee);_0x1035a3[_0xd362('0x3c')]=_[_0xd362('0x3b')](_0x1db264[_0xd362('0x3c')]);_0x1035a3[_0xd362('0x3d')]=_[_0xd362('0x3e')](_0x1035a3[_0xd362('0x3a')],_0x1035a3[_0xd362('0x3c')]);_0x5a7a39[_0xd362('0x3f')]=_['intersection'](_0x1035a3[_0xd362('0x3a')],qs[_0xd362('0x40')](_0x1db264['query'][_0xd362('0x40')]));_0x5a7a39['attributes']=_0x5a7a39[_0xd362('0x3f')]['length']?_0x5a7a39[_0xd362('0x3f')]:_0x1035a3['model'];if(!_0x1db264[_0xd362('0x3c')][_0xd362('0x41')]('nolimit')){_0x5a7a39[_0xd362('0x30')]=qs['limit'](_0x1db264[_0xd362('0x3c')][_0xd362('0x30')]);_0x5a7a39[_0xd362('0x2f')]=qs[_0xd362('0x2f')](_0x1db264[_0xd362('0x3c')][_0xd362('0x2f')]);}_0x5a7a39[_0xd362('0x42')]=qs[_0xd362('0x43')](_0x1db264[_0xd362('0x3c')][_0xd362('0x43')]);_0x5a7a39[_0xd362('0x44')]=qs[_0xd362('0x3d')](_[_0xd362('0x45')](_0x1db264['query'],_0x1035a3['filters']));if(_0x1db264[_0xd362('0x3c')][_0xd362('0x46')]){_0x5a7a39[_0xd362('0x44')]=_['merge'](_0x5a7a39[_0xd362('0x44')],{'$or':_[_0xd362('0x47')](_0x3c44ee,function(_0x53a314){if(_0x53a314[_0xd362('0x48')]['key']!==_0xd362('0x49')){var _0x3caee6={};_0x3caee6[_0x53a314[_0xd362('0x4a')]]={'$like':'%'+_0x1db264[_0xd362('0x3c')][_0xd362('0x46')]+'%'};return _0x3caee6;}})});}_0x5a7a39=_[_0xd362('0x4b')]({},_0x5a7a39,_0x1db264['options']);var _0x57a72d={'where':_0x5a7a39[_0xd362('0x44')]};return db[_0xd362('0x4c')]['count'](_0x57a72d)[_0xd362('0x1f')](function(_0x338158){_0x4578fe[_0xd362('0x4d')]=_0x338158;if(_0x1db264[_0xd362('0x3c')]['includeAll']){_0x5a7a39[_0xd362('0x4e')]=[{'all':!![]}];}return db[_0xd362('0x4c')][_0xd362('0x4f')](_0x5a7a39);})[_0xd362('0x1f')](function(_0x2425e8){_0x4578fe[_0xd362('0x50')]=_0x2425e8;return _0x4578fe;})[_0xd362('0x1f')](respondWithFilteredResult(_0x53bb34,_0x5a7a39))[_0xd362('0x2a')](handleError(_0x53bb34,null));};exports[_0xd362('0x51')]=function(_0x425495,_0x39d093){var _0x33ba46={'raw':!![],'where':{'id':_0x425495[_0xd362('0x52')]['id']}},_0x1414ed={};_0x1414ed[_0xd362('0x3a')]=_[_0xd362('0x3b')](db[_0xd362('0x4c')][_0xd362('0x53')]);_0x1414ed[_0xd362('0x3c')]=_[_0xd362('0x3b')](_0x425495['query']);_0x1414ed[_0xd362('0x3d')]=_['intersection'](_0x1414ed[_0xd362('0x3a')],_0x1414ed[_0xd362('0x3c')]);_0x33ba46[_0xd362('0x3f')]=_['intersection'](_0x1414ed[_0xd362('0x3a')],qs[_0xd362('0x40')](_0x425495[_0xd362('0x3c')][_0xd362('0x40')]));_0x33ba46[_0xd362('0x3f')]=_0x33ba46['attributes'][_0xd362('0x54')]?_0x33ba46['attributes']:_0x1414ed[_0xd362('0x3a')];if(_0x425495['query'][_0xd362('0x55')]){_0x33ba46[_0xd362('0x4e')]=[{'all':!![]}];}_0x33ba46=_[_0xd362('0x4b')]({},_0x33ba46,_0x425495[_0xd362('0x56')]);return db[_0xd362('0x4c')][_0xd362('0x57')](_0x33ba46)['then'](handleEntityNotFound(_0x39d093,null))['then'](respondWithResult(_0x39d093,null))['catch'](handleError(_0x39d093,null));};exports['update']=function(_0x462af4,_0x103a29){if(_0x462af4[_0xd362('0x58')]['id']){delete _0x462af4[_0xd362('0x58')]['id'];}return db[_0xd362('0x4c')][_0xd362('0x57')]({'where':{'id':_0x462af4[_0xd362('0x52')]['id']}})['then'](handleEntityNotFound(_0x103a29,null))['then'](saveUpdates(_0x462af4[_0xd362('0x58')],null))[_0xd362('0x1f')](respondWithResult(_0x103a29,null))[_0xd362('0x2a')](handleError(_0x103a29,null));};exports[_0xd362('0x36')]=function(_0x1fd04d,_0x3d08b5){return db['FaxMessage'][_0xd362('0x57')]({'where':{'id':_0x1fd04d['params']['id']}})[_0xd362('0x1f')](handleEntityNotFound(_0x3d08b5,null))[_0xd362('0x1f')](removeEntity(_0x3d08b5,null))['catch'](handleError(_0x3d08b5,null));};exports[_0xd362('0x59')]=function(_0x3fc7bb,_0x4d9e31){return db[_0xd362('0x4c')]['describe']()[_0xd362('0x1f')](respondWithResult(_0x4d9e31,null))[_0xd362('0x2a')](handleError(_0x4d9e31,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xd362('0x5a')]=function(_0x573b32,_0x481b95,_0x8e7f14){var _0x45e397={'channel':_0xd362('0x5b')};if(_0x573b32[_0xd362('0x58')]['id']){delete _0x573b32[_0xd362('0x58')]['id'];}_0x573b32['body']['read']=!![];_0x573b32[_0xd362('0x58')]['readAt']=moment()[_0xd362('0x5c')](_0xd362('0x5d'));_0x573b32[_0xd362('0x58')][_0xd362('0x5e')]=_0x573b32[_0xd362('0x58')][_0xd362('0x5e')]||_0x573b32[_0xd362('0x5f')]['id'];return db[_0xd362('0x4c')][_0xd362('0x57')]({'where':{'id':_0x573b32[_0xd362('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xd362('0x60')],'as':_0xd362('0x61')}]})[_0xd362('0x1f')](handleEntityNotFound(_0x481b95,null))[_0xd362('0x1f')](saveUpdates(_0x573b32['body'],null))[_0xd362('0x1f')](function(_0xdf299f){if(_0xdf299f){_0x45e397[_0xd362('0x28')]=_0xdf299f[_0xd362('0x62')]({'plain':!![]});return db[_0xd362('0x63')][_0xd362('0x57')]({'where':{'id':_0xdf299f[_0xd362('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x481b95,null))[_0xd362('0x1f')](function(_0xc98d8e){if(_0xc98d8e){return _0xc98d8e[_0xd362('0x35')]({'UserId':_0x573b32[_0xd362('0x58')][_0xd362('0x5e')],'read1stAt':_['isNil'](_0xc98d8e['read1stAt'])?moment()[_0xd362('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x37db55){if(_0x37db55){_0x45e397[_0xd362('0x65')]=_0x37db55[_0xd362('0x62')]({'plain':!![]});interaction_log['info'](_0xd362('0x66'),_0x573b32['user']['id'],_0x573b32['user']['name'],_0x573b32[_0xd362('0x5f')][_0xd362('0x67')],_0x45e397['interaction']['id'],_0x573b32[_0xd362('0x58')]?JSON['stringify'](_0x573b32[_0xd362('0x58')]):_0xd362('0x68'));return respondWithRpcPromise(_0xd362('0x69'),_0xd362('0x6a'),_0x45e397);}return null;})['then'](function(_0x346369){if(_0x346369){if(_0x573b32['body'][_0xd362('0x6b')]){_0x45e397[_0xd362('0x28')]['interface']=util[_0xd362('0x5c')](_0xd362('0x6c'),_0x573b32[_0xd362('0x5f')][_0xd362('0x38')]);_0x45e397['message'][_0xd362('0x6d')]=_0x45e397[_0xd362('0x6d')];_0x45e397['message'][_0xd362('0x6e')]='accept';return respondWithRpcPromise(_0xd362('0x6f'),_0xd362('0x6f'),{'event':_0xd362('0x70'),'message':_0x45e397[_0xd362('0x28')]},client9002)[_0xd362('0x1f')](function(){return _0x45e397;});}return _0x45e397;}return null;})[_0xd362('0x1f')](respondWithResult(_0x481b95,null))[_0xd362('0x2a')](handleError(_0x481b95,null));};var interaction_log=require(_0xd362('0x11'))(_0xd362('0x71'));exports[_0xd362('0x33')]=function(_0x549646,_0x2232cf,_0x568f3c){var _0xa0cfb={'agent':{},'channel':_0xd362('0x5b')};if(_0x549646[_0xd362('0x58')]['id']){delete _0x549646[_0xd362('0x58')]['id'];}_0x549646[_0xd362('0x58')][_0xd362('0x5e')]=_0x549646[_0xd362('0x58')][_0xd362('0x5e')]||_0x549646[_0xd362('0x5f')]['id'];_0xa0cfb[_0xd362('0x72')]['id']=_0x549646[_0xd362('0x58')][_0xd362('0x5e')];return db['FaxMessage'][_0xd362('0x57')]({'where':{'id':_0x549646[_0xd362('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2232cf,null))[_0xd362('0x1f')](function(_0x38a805){if(_0x38a805){_0xa0cfb[_0xd362('0x28')]=_0x38a805[_0xd362('0x62')]({'plain':!![]});return db[_0xd362('0x63')][_0xd362('0x57')]({'where':{'id':_0x38a805[_0xd362('0x64')]}});}return null;})[_0xd362('0x1f')](handleEntityNotFound(_0x2232cf,null))[_0xd362('0x1f')](function(_0x5506ee){if(_0x5506ee){_0xa0cfb[_0xd362('0x65')]=_0x5506ee[_0xd362('0x62')]({'plain':!![]});interaction_log[_0xd362('0x20')](_0xd362('0x73'),_0x549646[_0xd362('0x5f')]['id'],_0x549646[_0xd362('0x5f')][_0xd362('0x38')],_0x549646[_0xd362('0x5f')][_0xd362('0x67')],_0xa0cfb[_0xd362('0x65')]['id'],_0x549646[_0xd362('0x58')]?JSON['stringify'](_0x549646[_0xd362('0x58')]):_0xd362('0x68'));return respondWithRpcPromise(_0xd362('0x74'),_0xd362('0x75'),_0xa0cfb);}return null;})[_0xd362('0x1f')](function(_0x250946){if(_0x250946){_0x250946['message'][_0xd362('0x76')]=util[_0xd362('0x5c')]('SIP/%s',_0x549646[_0xd362('0x5f')][_0xd362('0x38')]);_0x250946[_0xd362('0x28')][_0xd362('0x6d')]=_0xa0cfb[_0xd362('0x6d')];_0x250946[_0xd362('0x28')][_0xd362('0x6e')]=_0xd362('0x33');respondWithRpcPromise(_0xd362('0x6f'),_0xd362('0x6f'),{'event':_0xd362('0x77'),'message':_0x250946[_0xd362('0x28')]},client9002);return _0xa0cfb;}return null;})[_0xd362('0x1f')](respondWithResult(_0x2232cf,null))[_0xd362('0x2a')](handleError(_0x2232cf,null));};exports[_0xd362('0x78')]=function(_0x2daf30,_0x1e3cd0){var _0x40341c;return db[_0xd362('0x4c')][_0xd362('0x78')](_0x2daf30[_0xd362('0x58')],{})['then'](function(_0x337dd0){_0x40341c=_0x337dd0;return db[_0xd362('0x60')][_0xd362('0x79')]({'where':{'id':_0x40341c[_0xd362('0x7a')]}});})['then'](function(_0x99a172){if(_[_0xd362('0x7b')](_0x99a172)){return;}else{_0x40341c[_0xd362('0x5b')]=_0x99a172[_0xd362('0x5b')];return db[_0xd362('0x7c')][_0xd362('0x79')]({'where':{'id':_0x40341c[_0xd362('0x7d')]}});}})[_0xd362('0x1f')](function(_0x35d0f8){return respondWithRpcPromise(_0xd362('0x7e'),'SendFax',{'FaxAccountId':_['isNil'](_0x2daf30[_0xd362('0x58')])?undefined:_0x2daf30[_0xd362('0x58')][_0xd362('0x7f')],'path':_[_0xd362('0x7b')](_0x35d0f8)?undefined:util[_0xd362('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x35d0f8[_0xd362('0x80')]),'fax':_[_0xd362('0x7b')](_0x40341c[_0xd362('0x5b')])?undefined:_0x40341c[_0xd362('0x5b')],'AttachmentId':_0x40341c[_0xd362('0x7d')]},client9002);})['then'](respondWithResult(_0x1e3cd0,0xc9))['catch'](handleError(_0x1e3cd0,null));};exports[_0xd362('0x81')]=function(_0x5b1291,_0x492759){var _0x29be21=path[_0xd362('0x82')](config[_0xd362('0x83')],_0xd362('0x84'),_0xd362('0x85'),_0xd362('0x86'));return db[_0xd362('0x4c')][_0xd362('0x57')]({'where':{'id':_0x5b1291[_0xd362('0x52')]['id']},'include':[{'model':db['Attachment'],'as':_0xd362('0x7c')}]})[_0xd362('0x1f')](handleEntityNotFound(_0x492759,null))[_0xd362('0x1f')](function(_0x5740b6){if(_0x5740b6){return _0x492759[_0xd362('0x81')](path[_0xd362('0x82')](_0x29be21,_0x5740b6[_0xd362('0x7c')][_0xd362('0x80')]));}})['catch'](handleError(_0x492759,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ab6faf1..803b4a9 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x5fc3[_0x25fa5c];return _0x1bade2;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var FaxMessage=require(_0x35fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){FaxMessageEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);FaxMessageEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x29912e,_0x39b7ba){_0x29912e=_0x29912e-0x0;var _0x32688c=_0xe14b[_0x29912e];return _0x32688c;};'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 diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 308c6d1..4389c59 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 _0x73d2=['lodash','moment','bluebird','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','FULLTEXT','models','direction','out','isNil','FaxInteraction','findOne','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x24c1f4,_0xf7c1ca){var _0x538cda=function(_0xa338a1){while(--_0xa338a1){_0x24c1f4['push'](_0x24c1f4['shift']());}};_0x538cda(++_0xf7c1ca);}(_0x73d2,0x1c2));var _0x273d=function(_0x21b695,_0x4fcaa6){_0x21b695=_0x21b695-0x0;var _0x51324f=_0x73d2[_0x21b695];return _0x51324f;};'use strict';var _=require(_0x273d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x273d('0x1'));var BPromise=require(_0x273d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x273d('0x3'));var rimraf=require('rimraf');var config=require(_0x273d('0x4'));var attributes=require(_0x273d('0x5'));module[_0x273d('0x6')]=function(_0x5164f1,_0x5499fb){return _0x5164f1[_0x273d('0x7')](_0x273d('0x8'),attributes,{'tableName':_0x273d('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x273d('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fdfb5,_0x5962ea,_0x47ac67){var _0x11ce15=_0x5164f1[_0x273d('0xb')];var _0x2da31d=_0x1fdfb5['get']({'plain':!![]});if(_0x2da31d[_0x273d('0xc')]['toLowerCase']()==='in'||_0x2da31d[_0x273d('0xc')]['toLowerCase']()===_0x273d('0xd')&&!_0x2da31d['secret']&&!_[_0x273d('0xe')](_0x2da31d['UserId'])){_0x11ce15[_0x273d('0xf')][_0x273d('0x10')]({'where':{'id':_0x2da31d['FaxInteractionId']}})[_0x273d('0x11')](function(_0x2c63de){if(_0x2c63de){_0x2c63de[_0x273d('0x12')]({'lastMsgAt':_0x2da31d[_0x273d('0x13')],'lastMsgDirection':_0x2da31d['direction'][_0x273d('0x14')]()});}})[_0x273d('0x15')](function(_0x429297){console[_0x273d('0x16')](_0x429297);});}_0x47ac67();}},'charset':_0x273d('0x17'),'collate':_0x273d('0x18')});}; \ No newline at end of file +var _0x5d8e=['exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','then','update','createdAt','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x2bcbe3,_0x2c8594){var _0x628edb=function(_0x263c17){while(--_0x263c17){_0x2bcbe3['push'](_0x2bcbe3['shift']());}};_0x628edb(++_0x2c8594);}(_0x5d8e,0x18c));var _0xe5d8=function(_0x25da04,_0x488b2c){_0x25da04=_0x25da04-0x0;var _0xfd4560=_0x5d8e[_0x25da04];return _0xfd4560;};'use strict';var _=require('lodash');var util=require(_0xe5d8('0x0'));var logger=require(_0xe5d8('0x1'))(_0xe5d8('0x2'));var moment=require(_0xe5d8('0x3'));var BPromise=require(_0xe5d8('0x4'));var rp=require(_0xe5d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5d8('0x6'));var config=require(_0xe5d8('0x7'));var attributes=require(_0xe5d8('0x8'));module[_0xe5d8('0x9')]=function(_0x3fce75,_0x56372a){return _0x3fce75[_0xe5d8('0xa')](_0xe5d8('0xb'),attributes,{'tableName':_0xe5d8('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xe5d8('0xd')],'type':_0xe5d8('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4dd208,_0x4c5d38,_0x109403){var _0x4073fc=_0x3fce75['models'];var _0x8e78a6=_0x4dd208[_0xe5d8('0xf')]({'plain':!![]});if(_0x8e78a6[_0xe5d8('0x10')][_0xe5d8('0x11')]()==='in'||_0x8e78a6['direction'][_0xe5d8('0x11')]()===_0xe5d8('0x12')&&!_0x8e78a6['secret']&&!_[_0xe5d8('0x13')](_0x8e78a6[_0xe5d8('0x14')])){_0x4073fc[_0xe5d8('0x15')][_0xe5d8('0x16')]({'where':{'id':_0x8e78a6['FaxInteractionId']}})[_0xe5d8('0x17')](function(_0xe51426){if(_0xe51426){_0xe51426[_0xe5d8('0x18')]({'lastMsgAt':_0x8e78a6[_0xe5d8('0x19')],'lastMsgDirection':_0x8e78a6['direction']['toLowerCase']()});}})['catch'](function(_0x524782){console['error'](_0x524782);});}_0x109403();}},'charset':'utf8mb4','collate':_0xe5d8('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3e3beb6..2f6432c 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 _0x8dd6=['FaxMessage','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','CreateFaxMessage','create','body','options','raw','then','UpdateFaxMessage'];(function(_0x31bf1f,_0x465d36){var _0x4bec2a=function(_0xe91ece){while(--_0xe91ece){_0x31bf1f['push'](_0x31bf1f['shift']());}};_0x4bec2a(++_0x465d36);}(_0x8dd6,0xcd));var _0x68dd=function(_0x34f331,_0xa9e329){_0x34f331=_0x34f331-0x0;var _0x240b3c=_0x8dd6[_0x34f331];return _0x240b3c;};'use strict';var _=require(_0x68dd('0x0'));var util=require('util');var moment=require(_0x68dd('0x1'));var BPromise=require(_0x68dd('0x2'));var rs=require(_0x68dd('0x3'));var fs=require('fs');var Redis=require(_0x68dd('0x4'));var db=require(_0x68dd('0x5'))['db'];var utils=require(_0x68dd('0x6'));var logger=require(_0x68dd('0x7'))(_0x68dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x68dd('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x68dd('0xa')]=_[_0x68dd('0xb')](config[_0x68dd('0xa')],{'host':_0x68dd('0xc'),'port':0x18eb});var socket=require(_0x68dd('0xd'))(new Redis(config[_0x68dd('0xa')]));require(_0x68dd('0xe'))[_0x68dd('0xf')](socket);function respondWithRpcPromise(_0x986a9a,_0x5173df,_0x5bfd09){return new BPromise(function(_0x2b0b2b,_0x3e9fc1){return client[_0x68dd('0x10')](_0x986a9a,_0x5bfd09)['then'](function(_0x2672a2){logger['info']('FaxMessage,\x20%s,\x20%s',_0x5173df,'request\x20sent');logger[_0x68dd('0x11')](_0x68dd('0x12'),_0x5173df,_0x68dd('0x13'),JSON[_0x68dd('0x14')](_0x2672a2));if(_0x2672a2[_0x68dd('0x15')]){if(_0x2672a2['error'][_0x68dd('0x16')]===0x1f4){logger[_0x68dd('0x15')](_0x68dd('0x17'),_0x5173df,_0x2672a2[_0x68dd('0x15')][_0x68dd('0x18')]);return _0x3e9fc1(_0x2672a2[_0x68dd('0x15')][_0x68dd('0x18')]);}logger[_0x68dd('0x15')]('FaxMessage,\x20%s,\x20%s',_0x5173df,_0x2672a2['error'][_0x68dd('0x18')]);return _0x2b0b2b(_0x2672a2[_0x68dd('0x15')]['message']);}else{logger[_0x68dd('0x19')](_0x68dd('0x17'),_0x5173df,_0x68dd('0x13'));_0x2b0b2b(_0x2672a2[_0x68dd('0x1a')][_0x68dd('0x18')]);}})[_0x68dd('0x1b')](function(_0x439aa5){logger[_0x68dd('0x15')]('FaxMessage,\x20%s,\x20%s',_0x5173df,_0x439aa5);_0x3e9fc1(_0x439aa5);});});}exports[_0x68dd('0x1c')]=function(_0x30bfd8){var _0x3aec26=this;return new Promise(function(_0x19594f,_0x20aad5){return db['FaxMessage'][_0x68dd('0x1d')](_0x30bfd8[_0x68dd('0x1e')],{'raw':_0x30bfd8[_0x68dd('0x1f')]?_0x30bfd8[_0x68dd('0x1f')][_0x68dd('0x20')]===undefined?!![]:![]:!![]})[_0x68dd('0x21')](function(_0x57f248){logger[_0x68dd('0x19')]('CreateFaxMessage',_0x30bfd8);logger['debug'](_0x68dd('0x1c'),_0x30bfd8,JSON[_0x68dd('0x14')](_0x57f248));_0x19594f(_0x57f248);})[_0x68dd('0x1b')](function(_0x120f5c){logger['error'](_0x68dd('0x1c'),_0x120f5c[_0x68dd('0x18')],_0x30bfd8);_0x20aad5(_0x3aec26[_0x68dd('0x15')](0x1f4,_0x120f5c['message']));});});};exports[_0x68dd('0x22')]=function(_0x49197e){var _0x29fe85=this;return new Promise(function(_0x2a589e,_0x3acc19){return db[_0x68dd('0x23')][_0x68dd('0x24')](_0x49197e['body'],{'raw':_0x49197e[_0x68dd('0x1f')]?_0x49197e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49197e['options']?_0x49197e[_0x68dd('0x1f')][_0x68dd('0x25')]||null:null,'attributes':_0x49197e[_0x68dd('0x1f')]?_0x49197e[_0x68dd('0x1f')][_0x68dd('0x26')]||null:null,'limit':_0x49197e['options']?_0x49197e[_0x68dd('0x1f')][_0x68dd('0x27')]||null:null})['then'](function(_0x2af422){logger[_0x68dd('0x19')](_0x68dd('0x22'),_0x49197e);logger[_0x68dd('0x11')](_0x68dd('0x22'),_0x49197e,JSON[_0x68dd('0x14')](_0x2af422));_0x2a589e(_0x2af422);})['catch'](function(_0x318df3){logger[_0x68dd('0x15')](_0x68dd('0x22'),_0x318df3[_0x68dd('0x18')],_0x49197e);_0x3acc19(_0x29fe85['error'](0x1f4,_0x318df3[_0x68dd('0x18')]));});});}; \ No newline at end of file +var _0xb377=['info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','options','raw','then','UpdateFaxMessage','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0xb377,0x1b6));var _0x7b37=function(_0x47222d,_0x53c795){_0x47222d=_0x47222d-0x0;var _0xf369b0=_0xb377[_0x47222d];return _0xf369b0;};'use strict';var _=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var moment=require(_0x7b37('0x2'));var BPromise=require(_0x7b37('0x3'));var rs=require(_0x7b37('0x4'));var fs=require('fs');var Redis=require(_0x7b37('0x5'));var db=require(_0x7b37('0x6'))['db'];var utils=require(_0x7b37('0x7'));var logger=require(_0x7b37('0x8'))(_0x7b37('0x9'));var config=require(_0x7b37('0xa'));var jayson=require(_0x7b37('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x7b37('0xc')]=_['defaults'](config['redis'],{'host':_0x7b37('0xd'),'port':0x18eb});var socket=require(_0x7b37('0xe'))(new Redis(config[_0x7b37('0xc')]));require(_0x7b37('0xf'))[_0x7b37('0x10')](socket);function respondWithRpcPromise(_0x2c8991,_0x4610cd,_0x39c4ef){return new BPromise(function(_0x59bd03,_0x22e0a9){return client[_0x7b37('0x11')](_0x2c8991,_0x39c4ef)['then'](function(_0x5e5fb5){logger[_0x7b37('0x12')](_0x7b37('0x13'),_0x4610cd,_0x7b37('0x14'));logger[_0x7b37('0x15')](_0x7b37('0x16'),_0x4610cd,_0x7b37('0x14'),JSON[_0x7b37('0x17')](_0x5e5fb5));if(_0x5e5fb5[_0x7b37('0x18')]){if(_0x5e5fb5[_0x7b37('0x18')][_0x7b37('0x19')]===0x1f4){logger[_0x7b37('0x18')](_0x7b37('0x13'),_0x4610cd,_0x5e5fb5[_0x7b37('0x18')][_0x7b37('0x1a')]);return _0x22e0a9(_0x5e5fb5[_0x7b37('0x18')][_0x7b37('0x1a')]);}logger[_0x7b37('0x18')]('FaxMessage,\x20%s,\x20%s',_0x4610cd,_0x5e5fb5['error'][_0x7b37('0x1a')]);return _0x59bd03(_0x5e5fb5['error']['message']);}else{logger[_0x7b37('0x12')](_0x7b37('0x13'),_0x4610cd,_0x7b37('0x14'));_0x59bd03(_0x5e5fb5['result'][_0x7b37('0x1a')]);}})[_0x7b37('0x1b')](function(_0x2a77ae){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4610cd,_0x2a77ae);_0x22e0a9(_0x2a77ae);});});}exports[_0x7b37('0x1c')]=function(_0x1ee877){var _0x3f3bbb=this;return new Promise(function(_0x28c427,_0x30bf66){return db['FaxMessage']['create'](_0x1ee877['body'],{'raw':_0x1ee877[_0x7b37('0x1d')]?_0x1ee877[_0x7b37('0x1d')][_0x7b37('0x1e')]===undefined?!![]:![]:!![]})[_0x7b37('0x1f')](function(_0x184bdd){logger[_0x7b37('0x12')](_0x7b37('0x1c'),_0x1ee877);logger['debug'](_0x7b37('0x1c'),_0x1ee877,JSON[_0x7b37('0x17')](_0x184bdd));_0x28c427(_0x184bdd);})['catch'](function(_0x239cfc){logger['error'](_0x7b37('0x1c'),_0x239cfc['message'],_0x1ee877);_0x30bf66(_0x3f3bbb['error'](0x1f4,_0x239cfc[_0x7b37('0x1a')]));});});};exports[_0x7b37('0x20')]=function(_0x42d1d7){var _0x94ecb2=this;return new Promise(function(_0x2f3805,_0x5ab694){return db['FaxMessage'][_0x7b37('0x21')](_0x42d1d7[_0x7b37('0x22')],{'raw':_0x42d1d7[_0x7b37('0x1d')]?_0x42d1d7[_0x7b37('0x1d')][_0x7b37('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42d1d7[_0x7b37('0x1d')]?_0x42d1d7[_0x7b37('0x1d')][_0x7b37('0x23')]||null:null,'attributes':_0x42d1d7[_0x7b37('0x1d')]?_0x42d1d7['options'][_0x7b37('0x24')]||null:null,'limit':_0x42d1d7[_0x7b37('0x1d')]?_0x42d1d7[_0x7b37('0x1d')][_0x7b37('0x25')]||null:null})['then'](function(_0x2949c6){logger[_0x7b37('0x12')](_0x7b37('0x20'),_0x42d1d7);logger[_0x7b37('0x15')](_0x7b37('0x20'),_0x42d1d7,JSON[_0x7b37('0x17')](_0x2949c6));_0x2f3805(_0x2949c6);})['catch'](function(_0x29ec63){logger['error'](_0x7b37('0x20'),_0x29ec63['message'],_0x42d1d7);_0x5ab694(_0x94ecb2[_0x7b37('0x18')](0x1f4,_0x29ec63[_0x7b37('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3eb540f..72ed8ed 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(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 1dfe081..fded482 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 _0x92af=['show','/:id/download','download','post','tracked','create','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5cf832,_0x4e60cc){var _0x49d0f9=function(_0x3f616a){while(--_0x3f616a){_0x5cf832['push'](_0x5cf832['shift']());}};_0x49d0f9(++_0x4e60cc);}(_0x92af,0xee));var _0xf92a=function(_0x5e042f,_0x838bcd){_0x5e042f=_0x5e042f-0x0;var _0x119f92=_0x92af[_0x5e042f];return _0x119f92;};'use strict';var multer=require(_0xf92a('0x0'));var util=require(_0xf92a('0x1'));var path=require(_0xf92a('0x2'));var timeout=require(_0xf92a('0x3'));var express=require(_0xf92a('0x4'));var router=express[_0xf92a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf92a('0x6'));var config=require(_0xf92a('0x7'));var controller=require(_0xf92a('0x8'));router[_0xf92a('0x9')]('/',auth[_0xf92a('0xa')](),controller[_0xf92a('0xb')]);router['get'](_0xf92a('0xc'),auth['isAuthenticated'](),controller[_0xf92a('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf92a('0xe')]);router['get'](_0xf92a('0xf'),auth[_0xf92a('0xa')](),controller[_0xf92a('0x10')]);router[_0xf92a('0x11')]('/',auth[_0xf92a('0xa')](),interaction[_0xf92a('0x12')]('fax','faxmessage:create'),controller[_0xf92a('0x13')]);router[_0xf92a('0x14')]('/:id',auth[_0xf92a('0xa')](),controller['update']);router['put'](_0xf92a('0x15'),auth[_0xf92a('0xa')](),controller[_0xf92a('0x16')]);router['put'](_0xf92a('0x17'),auth[_0xf92a('0xa')](),controller[_0xf92a('0x18')]);router[_0xf92a('0x19')](_0xf92a('0x1a'),auth[_0xf92a('0xa')](),controller[_0xf92a('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5228=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete'];(function(_0x4b3be6,_0x15cd53){var _0x3396ee=function(_0x2489b0){while(--_0x2489b0){_0x4b3be6['push'](_0x4b3be6['shift']());}};_0x3396ee(++_0x15cd53);}(_0x5228,0xcc));var _0x8522=function(_0x1c57b9,_0x4fc0d3){_0x1c57b9=_0x1c57b9-0x0;var _0x5cd8d9=_0x5228[_0x1c57b9];return _0x5cd8d9;};'use strict';var multer=require(_0x8522('0x0'));var util=require(_0x8522('0x1'));var path=require(_0x8522('0x2'));var timeout=require(_0x8522('0x3'));var express=require(_0x8522('0x4'));var router=express[_0x8522('0x5')]();var auth=require(_0x8522('0x6'));var interaction=require(_0x8522('0x7'));var config=require('../../config/environment');var controller=require(_0x8522('0x8'));router[_0x8522('0x9')]('/',auth[_0x8522('0xa')](),controller[_0x8522('0xb')]);router['get'](_0x8522('0xc'),auth[_0x8522('0xa')](),controller[_0x8522('0xd')]);router['get'](_0x8522('0xe'),auth[_0x8522('0xa')](),controller[_0x8522('0xf')]);router[_0x8522('0x9')](_0x8522('0x10'),auth[_0x8522('0xa')](),controller[_0x8522('0x11')]);router[_0x8522('0x12')]('/',auth[_0x8522('0xa')](),interaction['tracked'](_0x8522('0x13'),_0x8522('0x14')),controller[_0x8522('0x15')]);router[_0x8522('0x16')](_0x8522('0xe'),auth['isAuthenticated'](),controller[_0x8522('0x17')]);router['put'](_0x8522('0x18'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x8522('0x19'),auth[_0x8522('0xa')](),controller[_0x8522('0x1a')]);router[_0x8522('0x1b')](_0x8522('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x8522('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 46a13f0..0e20245 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 _0xcd70=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x491896,_0x2c6369){var _0x422edb=function(_0x31ea9c){while(--_0x31ea9c){_0x491896['push'](_0x491896['shift']());}};_0x422edb(++_0x2c6369);}(_0xcd70,0xb8));var _0x0cd7=function(_0x163c66,_0x69a3d4){_0x163c66=_0x163c66-0x0;var _0x255ff9=_0xcd70[_0x163c66];return _0x255ff9;};'use strict';var Sequelize=require('sequelize');module[_0x0cd7('0x0')]={'name':{'type':Sequelize[_0x0cd7('0x1')],'unique':_0x0cd7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0cd7('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0cd7('0x4')]('rrmemory',_0x0cd7('0x5'),_0x0cd7('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa132=['beepall','sequelize','STRING','INTEGER','ENUM'];(function(_0x3726da,_0x46278b){var _0xaf93bc=function(_0x301c11){while(--_0x301c11){_0x3726da['push'](_0x3726da['shift']());}};_0xaf93bc(++_0x46278b);}(_0xa132,0x196));var _0x2a13=function(_0x365931,_0xc5cb12){_0x365931=_0x365931-0x0;var _0x2474b9=_0xa132[_0x365931];return _0x2474b9;};'use strict';var Sequelize=require(_0x2a13('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a13('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a13('0x1')]},'timeout':{'type':Sequelize[_0x2a13('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a13('0x3')]('rrmemory',_0x2a13('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 931c9db..ef68d8a 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 _0xf26c=['userFaxQueue:remove','addAgents','body','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','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','end','error','name','send','index','FaxQueue','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','autoAssociation','describe','getMembers','findOne','UserFaxQueue','nolimit','findAll','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','updatedAt','getTeams','Team','pick','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','removeAgents'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf26c,0x94));var _0xcf26=function(_0x3fb23e,_0x3d505f){_0x3fb23e=_0x3fb23e-0x0;var _0xeabc04=_0xf26c[_0x3fb23e];return _0xeabc04;};'use strict';var pdf=require(_0xcf26('0x0'));var emlformat=require(_0xcf26('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcf26('0x2'));var jsonpatch=require(_0xcf26('0x3'));var rp=require(_0xcf26('0x4'));var moment=require(_0xcf26('0x5'));var BPromise=require(_0xcf26('0x6'));var Mustache=require(_0xcf26('0x7'));var util=require(_0xcf26('0x8'));var path=require(_0xcf26('0x9'));var sox=require(_0xcf26('0xa'));var csv=require(_0xcf26('0xb'));var ejs=require(_0xcf26('0xc'));var fs=require('fs');var _=require(_0xcf26('0xd'));var squel=require(_0xcf26('0xe'));var crypto=require(_0xcf26('0xf'));var jsforce=require(_0xcf26('0x10'));var deskjs=require(_0xcf26('0x11'));var toCsv=require(_0xcf26('0xb'));var querystring=require(_0xcf26('0x12'));var Papa=require(_0xcf26('0x13'));var Redis=require('ioredis');var authService=require(_0xcf26('0x14'));var qs=require(_0xcf26('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf26('0x16'))(_0xcf26('0x17'));var utils=require('../../config/utils');var config=require(_0xcf26('0x18'));var db=require(_0xcf26('0x19'))['db'];config[_0xcf26('0x1a')]=_[_0xcf26('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcf26('0x1c'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xcf26('0x1d')](socket);function respondWithStatusCode(_0x432b91,_0x3d9d46){_0x3d9d46=_0x3d9d46||0xcc;return function(_0x57aa4b){if(_0x57aa4b){return _0x432b91[_0xcf26('0x1e')](_0x3d9d46);}return _0x432b91['status'](_0x3d9d46)['end']();};}function respondWithResult(_0x5e6a85,_0x3b3e41){_0x3b3e41=_0x3b3e41||0xc8;return function(_0x1afd2f){if(_0x1afd2f){return _0x5e6a85[_0xcf26('0x1f')](_0x3b3e41)[_0xcf26('0x20')](_0x1afd2f);}};}function respondWithFilteredResult(_0x4beeaa,_0x17a9f7){return function(_0x433d38){if(_0x433d38){var _0x575172=_0x433d38[_0xcf26('0x21')],_0xe56f70=_0x17a9f7[_0xcf26('0x22')],_0x4158e5=_0x17a9f7['offset']+_0x17a9f7['limit'],_0x1d09bf;if(_0x4158e5>=_0x575172){_0x4158e5=_0x575172;_0x1d09bf=0xc8;}else{_0x1d09bf=0xce;}_0x4beeaa[_0xcf26('0x1f')](_0x1d09bf);return _0x4beeaa[_0xcf26('0x23')](_0xcf26('0x24'),_0xe56f70+'-'+_0x4158e5+'/'+_0x575172)[_0xcf26('0x20')](_0x433d38);}return null;};}function patchUpdates(_0x527186){return function(_0x2d16eb){try{jsonpatch[_0xcf26('0x25')](_0x2d16eb,_0x527186,!![]);}catch(_0x124d85){return BPromise[_0xcf26('0x26')](_0x124d85);}return _0x2d16eb['save']();};}function saveUpdates(_0x225071,_0xfea398){return function(_0x5949b8){if(_0x5949b8){return _0x5949b8[_0xcf26('0x27')](_0x225071)[_0xcf26('0x28')](function(_0x169d0f){return _0x169d0f;});}return null;};}function removeEntity(_0x141221,_0x419f69){return function(_0x150c70){if(_0x150c70){return _0x150c70['destroy']()[_0xcf26('0x28')](function(){var _0x1be955=_0x150c70[_0xcf26('0x29')]({'plain':!![]});var _0x14f322='FaxQueues';return db[_0xcf26('0x2a')][_0xcf26('0x2b')]({'where':{'type':_0x14f322,'resourceId':_0x1be955['id']}})[_0xcf26('0x28')](function(){return _0x150c70;});})[_0xcf26('0x28')](function(){_0x141221[_0xcf26('0x1f')](0xcc)[_0xcf26('0x2c')]();});}};}function handleEntityNotFound(_0x3e0a12,_0x1d31ea){return function(_0x32b875){if(!_0x32b875){_0x3e0a12[_0xcf26('0x1e')](0x194);}return _0x32b875;};}function handleError(_0x367e03,_0xe22de2){_0xe22de2=_0xe22de2||0x1f4;return function(_0x3d7363){logger[_0xcf26('0x2d')](_0x3d7363['stack']);if(_0x3d7363[_0xcf26('0x2e')]){delete _0x3d7363[_0xcf26('0x2e')];}_0x367e03['status'](_0xe22de2)[_0xcf26('0x2f')](_0x3d7363);};}exports[_0xcf26('0x30')]=function(_0x5b9111,_0x4dfaa2){var _0x97df33={},_0x320bb0={},_0x1cde84={'count':0x0,'rows':[]};var _0x402584=db[_0xcf26('0x31')][_0xcf26('0x32')];_0x320bb0[_0xcf26('0x33')]=_[_0xcf26('0x34')](_0x402584);_0x320bb0['query']=_[_0xcf26('0x34')](_0x5b9111[_0xcf26('0x35')]);_0x320bb0[_0xcf26('0x36')]=_[_0xcf26('0x37')](_0x320bb0['model'],_0x320bb0[_0xcf26('0x35')]);_0x97df33[_0xcf26('0x38')]=_[_0xcf26('0x37')](_0x320bb0[_0xcf26('0x33')],qs[_0xcf26('0x39')](_0x5b9111[_0xcf26('0x35')]['fields']));_0x97df33[_0xcf26('0x38')]=_0x97df33['attributes'][_0xcf26('0x3a')]?_0x97df33[_0xcf26('0x38')]:_0x320bb0['model'];if(!_0x5b9111[_0xcf26('0x35')][_0xcf26('0x3b')]('nolimit')){_0x97df33[_0xcf26('0x3c')]=qs['limit'](_0x5b9111[_0xcf26('0x35')][_0xcf26('0x3c')]);_0x97df33[_0xcf26('0x22')]=qs[_0xcf26('0x22')](_0x5b9111[_0xcf26('0x35')][_0xcf26('0x22')]);}_0x97df33[_0xcf26('0x3d')]=qs[_0xcf26('0x3e')](_0x5b9111[_0xcf26('0x35')][_0xcf26('0x3e')]);_0x97df33[_0xcf26('0x3f')]=qs[_0xcf26('0x36')](_['pick'](_0x5b9111['query'],_0x320bb0['filters']));if(_0x5b9111['query'][_0xcf26('0x40')]){_0x97df33[_0xcf26('0x3f')]=_[_0xcf26('0x41')](_0x97df33[_0xcf26('0x3f')],{'$or':_[_0xcf26('0x42')](_0x402584,function(_0x9bbc54){if(_0x9bbc54[_0xcf26('0x43')][_0xcf26('0x44')]!==_0xcf26('0x45')){var _0x311982={};_0x311982[_0x9bbc54[_0xcf26('0x46')]]={'$like':'%'+_0x5b9111[_0xcf26('0x35')][_0xcf26('0x40')]+'%'};return _0x311982;}})});}_0x97df33=_[_0xcf26('0x41')]({},_0x97df33,_0x5b9111[_0xcf26('0x47')]);var _0x291659={'where':_0x97df33[_0xcf26('0x3f')]};return db[_0xcf26('0x31')][_0xcf26('0x21')](_0x291659)['then'](function(_0x52cd49){_0x1cde84['count']=_0x52cd49;if(_0x5b9111[_0xcf26('0x35')]['includeAll']){_0x97df33[_0xcf26('0x48')]=[{'all':!![]}];}return db[_0xcf26('0x31')]['findAll'](_0x97df33);})[_0xcf26('0x28')](function(_0xc83f64){_0x1cde84[_0xcf26('0x49')]=_0xc83f64;return _0x1cde84;})[_0xcf26('0x28')](respondWithFilteredResult(_0x4dfaa2,_0x97df33))[_0xcf26('0x4a')](handleError(_0x4dfaa2,null));};exports[_0xcf26('0x4b')]=function(_0x2d7a0e,_0x41c526){var _0x3a2f97={'raw':!![],'where':{'id':_0x2d7a0e[_0xcf26('0x4c')]['id']}},_0x98ca61={};_0x98ca61[_0xcf26('0x33')]=_[_0xcf26('0x34')](db['FaxQueue'][_0xcf26('0x32')]);_0x98ca61[_0xcf26('0x35')]=_[_0xcf26('0x34')](_0x2d7a0e[_0xcf26('0x35')]);_0x98ca61[_0xcf26('0x36')]=_[_0xcf26('0x37')](_0x98ca61[_0xcf26('0x33')],_0x98ca61['query']);_0x3a2f97[_0xcf26('0x38')]=_['intersection'](_0x98ca61[_0xcf26('0x33')],qs[_0xcf26('0x39')](_0x2d7a0e[_0xcf26('0x35')]['fields']));_0x3a2f97[_0xcf26('0x38')]=_0x3a2f97[_0xcf26('0x38')]['length']?_0x3a2f97[_0xcf26('0x38')]:_0x98ca61[_0xcf26('0x33')];if(_0x2d7a0e[_0xcf26('0x35')][_0xcf26('0x4d')]){_0x3a2f97[_0xcf26('0x48')]=[{'all':!![]}];}_0x3a2f97=_[_0xcf26('0x41')]({},_0x3a2f97,_0x2d7a0e[_0xcf26('0x47')]);return db['FaxQueue'][_0xcf26('0x4e')](_0x3a2f97)[_0xcf26('0x28')](handleEntityNotFound(_0x41c526,null))['then'](respondWithResult(_0x41c526,null))['catch'](handleError(_0x41c526,null));};exports[_0xcf26('0x4f')]=function(_0x1e21ed,_0x1a23f1){return db['FaxQueue']['create'](_0x1e21ed['body'],{})[_0xcf26('0x28')](function(_0x164b7e){var _0x445a09=_0x1e21ed[_0xcf26('0x50')][_0xcf26('0x29')]({'plain':!![]});if(!_0x445a09)throw new Error(_0xcf26('0x51'));if(_0x445a09[_0xcf26('0x52')]==='user'){var _0x516d18=_0x164b7e['get']({'plain':!![]});var _0x3e29ca=_0xcf26('0x53');return db['UserProfileSection'][_0xcf26('0x4e')]({'where':{'name':_0x3e29ca,'userProfileId':_0x445a09[_0xcf26('0x54')]},'raw':!![]})[_0xcf26('0x28')](function(_0x58f0cf){if(_0x58f0cf&&_0x58f0cf[_0xcf26('0x55')]===0x0){return db[_0xcf26('0x2a')][_0xcf26('0x4f')]({'name':_0x516d18[_0xcf26('0x2e')],'resourceId':_0x516d18['id'],'type':_0x58f0cf[_0xcf26('0x2e')],'sectionId':_0x58f0cf['id']},{})['then'](function(){return _0x164b7e;});}else{return _0x164b7e;}})[_0xcf26('0x4a')](function(_0x3974f4){logger[_0xcf26('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3974f4);throw _0x3974f4;});}return _0x164b7e;})['then'](respondWithResult(_0x1a23f1,0xc9))[_0xcf26('0x4a')](handleError(_0x1a23f1,null));};exports[_0xcf26('0x27')]=function(_0x594d09,_0x4b49c0){if(_0x594d09['body']['id']){delete _0x594d09['body']['id'];}return db[_0xcf26('0x31')]['find']({'where':{'id':_0x594d09[_0xcf26('0x4c')]['id']}})[_0xcf26('0x28')](handleEntityNotFound(_0x4b49c0,null))['then'](saveUpdates(_0x594d09['body'],null))[_0xcf26('0x28')](respondWithResult(_0x4b49c0,null))[_0xcf26('0x4a')](handleError(_0x4b49c0,null));};exports[_0xcf26('0x2b')]=function(_0x24076f,_0x374559){return db[_0xcf26('0x31')][_0xcf26('0x4e')]({'where':{'id':_0x24076f[_0xcf26('0x4c')]['id']}})[_0xcf26('0x28')](handleEntityNotFound(_0x374559,null))[_0xcf26('0x28')](removeEntity(_0x374559,null))['catch'](handleError(_0x374559,null));};exports[_0xcf26('0x56')]=function(_0x52ffbf,_0x42239f){return db[_0xcf26('0x31')][_0xcf26('0x56')]()['then'](respondWithResult(_0x42239f,null))[_0xcf26('0x4a')](handleError(_0x42239f,null));};exports[_0xcf26('0x57')]=function(_0x1b642d,_0xbd7a18,_0x40b428){var _0x242153={'raw':!![],'where':{}},_0x311c96={},_0x1ad6c5;return db[_0xcf26('0x31')][_0xcf26('0x58')]({'where':{'id':_0x1b642d[_0xcf26('0x4c')]['id']}})['then'](handleEntityNotFound(_0xbd7a18,null))['then'](function(_0x314e4c){if(_0x314e4c){_0x1ad6c5=_0x314e4c[_0xcf26('0x29')]({'plain':!![]});_0x311c96['model']=_[_0xcf26('0x34')](db[_0xcf26('0x59')]['rawAttributes']);_0x311c96[_0xcf26('0x35')]=_['keys'](_0x1b642d[_0xcf26('0x35')]);_0x311c96[_0xcf26('0x36')]=_['intersection'](_0x311c96[_0xcf26('0x33')],_0x311c96[_0xcf26('0x35')]);_0x242153[_0xcf26('0x38')]=_[_0xcf26('0x37')](_0x311c96[_0xcf26('0x33')],qs[_0xcf26('0x39')](_0x1b642d[_0xcf26('0x35')][_0xcf26('0x39')]));_0x242153[_0xcf26('0x38')]=_0x242153[_0xcf26('0x38')][_0xcf26('0x3a')]?_0x242153[_0xcf26('0x38')]:_0x311c96[_0xcf26('0x33')];if(!_0x1b642d[_0xcf26('0x35')][_0xcf26('0x3b')](_0xcf26('0x5a'))){_0x242153['limit']=qs[_0xcf26('0x3c')](_0x1b642d[_0xcf26('0x35')][_0xcf26('0x3c')]);_0x242153[_0xcf26('0x22')]=qs[_0xcf26('0x22')](_0x1b642d[_0xcf26('0x35')][_0xcf26('0x22')]);}_0x242153[_0xcf26('0x3d')]=qs['sort'](_0x1b642d[_0xcf26('0x35')]['sort']);_0x242153[_0xcf26('0x3f')]=qs['filters'](_['pick'](_0x1b642d[_0xcf26('0x35')],_0x311c96[_0xcf26('0x36')]));_0x242153[_0xcf26('0x3f')]['FaxQueueId']=_0x314e4c['id'];if(_0x1b642d['query'][_0xcf26('0x40')]){_0x242153[_0xcf26('0x3f')]=_[_0xcf26('0x41')](_0x242153['where'],{'$or':_[_0xcf26('0x42')](_0x242153[_0xcf26('0x38')],function(_0x41cf14){var _0x1f2501={};_0x1f2501[_0x41cf14]={'$like':'%'+_0x1b642d['query']['filter']+'%'};return _0x1f2501;})});}_0x242153=_[_0xcf26('0x41')]({},_0x242153,_0x1b642d[_0xcf26('0x47')]);return db[_0xcf26('0x59')][_0xcf26('0x5b')](_0x242153);}})[_0xcf26('0x28')](function(_0x19d012){if(_0x19d012){return db[_0xcf26('0x5c')][_0xcf26('0x5d')]({'where':{'id':_['map'](_0x19d012,_0xcf26('0x5e')),'role':_0xcf26('0x5f')},'attributes':['id',_0xcf26('0x2e'),_0xcf26('0x60'),'updatedAt',_0xcf26('0x61')]});}})[_0xcf26('0x28')](function(_0x4792a3){if(_0x4792a3){return{'count':_0x4792a3[_0xcf26('0x21')],'rows':_[_0xcf26('0x42')](_0x4792a3[_0xcf26('0x49')],function(_0x174414){return{'membername':_0x174414[_0xcf26('0x2e')],'UserId':_0x174414['id'],'queue_name':_0x1ad6c5[_0xcf26('0x2e')],'FaxQueueId':_0x1ad6c5['id'],'interface':util[_0xcf26('0x62')](_0xcf26('0x63'),'SIP',_0x174414[_0xcf26('0x2e')]),'penalty':0x0,'paused':_0x174414['faxPause'],'createdAt':_0x174414[_0xcf26('0x61')],'updatedAt':_0x174414[_0xcf26('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcf26('0x28')](respondWithFilteredResult(_0xbd7a18,_0x242153))['catch'](handleError(_0xbd7a18,null));};exports[_0xcf26('0x65')]=function(_0x34f89e,_0x308403,_0x48297f){var _0x56ec0f={};var _0x2d5c0f={};var _0x1e57a5;var _0x5a116e;return db[_0xcf26('0x31')][_0xcf26('0x58')]({'where':{'id':_0x34f89e['params']['id']}})['then'](handleEntityNotFound(_0x308403,null))[_0xcf26('0x28')](function(_0x18da98){if(_0x18da98){_0x1e57a5=_0x18da98;_0x2d5c0f[_0xcf26('0x33')]=_[_0xcf26('0x34')](db[_0xcf26('0x66')]['rawAttributes']);_0x2d5c0f['query']=_['keys'](_0x34f89e[_0xcf26('0x35')]);_0x2d5c0f[_0xcf26('0x36')]=_[_0xcf26('0x37')](_0x2d5c0f[_0xcf26('0x33')],_0x2d5c0f[_0xcf26('0x35')]);_0x56ec0f[_0xcf26('0x38')]=_[_0xcf26('0x37')](_0x2d5c0f['model'],qs[_0xcf26('0x39')](_0x34f89e['query'][_0xcf26('0x39')]));_0x56ec0f[_0xcf26('0x38')]=_0x56ec0f[_0xcf26('0x38')][_0xcf26('0x3a')]?_0x56ec0f[_0xcf26('0x38')]:_0x2d5c0f[_0xcf26('0x33')];_0x56ec0f[_0xcf26('0x3d')]=qs[_0xcf26('0x3e')](_0x34f89e[_0xcf26('0x35')]['sort']);_0x56ec0f['where']=qs[_0xcf26('0x36')](_[_0xcf26('0x67')](_0x34f89e['query'],_0x2d5c0f['filters']));if(_0x34f89e[_0xcf26('0x35')][_0xcf26('0x40')]){_0x56ec0f[_0xcf26('0x3f')]=_[_0xcf26('0x41')](_0x56ec0f[_0xcf26('0x3f')],{'$or':_[_0xcf26('0x42')](_0x56ec0f['attributes'],function(_0x11f2dc){var _0x31b71a={};_0x31b71a[_0x11f2dc]={'$like':'%'+_0x34f89e[_0xcf26('0x35')][_0xcf26('0x40')]+'%'};return _0x31b71a;})});}_0x56ec0f=_[_0xcf26('0x41')]({},_0x56ec0f,_0x34f89e['options']);return _0x1e57a5[_0xcf26('0x65')](_0x56ec0f);}})[_0xcf26('0x28')](function(_0x214447){if(_0x214447){_0x5a116e=_0x214447[_0xcf26('0x3a')];if(!_0x34f89e[_0xcf26('0x35')][_0xcf26('0x3b')](_0xcf26('0x5a'))){_0x56ec0f[_0xcf26('0x3c')]=qs[_0xcf26('0x3c')](_0x34f89e[_0xcf26('0x35')][_0xcf26('0x3c')]);_0x56ec0f[_0xcf26('0x22')]=qs[_0xcf26('0x22')](_0x34f89e[_0xcf26('0x35')][_0xcf26('0x22')]);}return _0x1e57a5[_0xcf26('0x65')](_0x56ec0f);}})[_0xcf26('0x28')](function(_0x403c5a){if(_0x403c5a){return _0x403c5a?{'count':_0x5a116e,'rows':_0x403c5a}:null;}})[_0xcf26('0x28')](respondWithResult(_0x308403,null))[_0xcf26('0x4a')](handleError(_0x308403,null));};exports[_0xcf26('0x68')]=function(_0x5e4204,_0x47b52a,_0x5fb971){var _0x12d4ee=_0x5e4204['body']['ids'];return db[_0xcf26('0x66')][_0xcf26('0x5b')]({'where':{'id':_0x12d4ee},'attributes':['id'],'include':[{'model':db[_0xcf26('0x5c')],'as':_0xcf26('0x69'),'attributes':['id',_0xcf26('0x2e'),'online',_0xcf26('0x6a'),_0xcf26('0x6b')],'raw':!![]}]})[_0xcf26('0x28')](function(_0x582d6f){if(_0x582d6f){var _0x52ab6f=_[_0xcf26('0x6c')](_0x582d6f,function(_0x381123){var _0x413aca=_0x381123[_0xcf26('0x29')]({'plain':!![]});return _0x413aca[_0xcf26('0x69')];});return db[_0xcf26('0x31')][_0xcf26('0x4e')]({'where':{'id':_0x5e4204[_0xcf26('0x4c')]['id']}})[_0xcf26('0x28')](function(_0x1f213c){return db[_0xcf26('0x6d')][_0xcf26('0x6e')](function(_0x5d6484){return _0x1f213c['addTeams'](_0x12d4ee,{'transaction':_0x5d6484})[_0xcf26('0x28')](function(){return BPromise[_0xcf26('0x6f')](_0x52ab6f,function(_0x59cb46){return db[_0xcf26('0x59')]['findOrCreate']({'where':{'UserId':_0x59cb46['id'],'FaxQueueId':_0x5e4204[_0xcf26('0x4c')]['id']},'transaction':_0x5d6484});});})[_0xcf26('0x28')](function(){_0x52ab6f[_0xcf26('0x70')](function(_0x252606){socket[_0xcf26('0x71')](_0xcf26('0x72'),{'UserId':_0x252606['id'],'FaxQueueId':_0x1f213c['id']});});});});});}})[_0xcf26('0x28')](respondWithStatusCode(_0x47b52a,null))[_0xcf26('0x4a')](handleError(_0x47b52a,null));};exports[_0xcf26('0x73')]=function(_0x35a742,_0x19c2ee,_0x3c1746){return db[_0xcf26('0x66')][_0xcf26('0x5b')]({'where':{'id':_0x35a742[_0xcf26('0x35')][_0xcf26('0x74')]},'attributes':['id'],'include':[{'model':db[_0xcf26('0x5c')],'as':_0xcf26('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x19c2ee,null))[_0xcf26('0x28')](function(_0x307c57){var _0x113851=_[_0xcf26('0x42')](_0x307c57,'id');var _0x33c06e=[];var _0x25ec75=[];var _0x32c16d=squel[_0xcf26('0x75')]();_0x32c16d['field'](_0xcf26('0x76'))['from']('team_has_fax_queues','tq')[_0xcf26('0x77')](_0xcf26('0x78'),'ut',_0xcf26('0x79'))[_0xcf26('0x3f')](_0xcf26('0x7a'),_0x35a742[_0xcf26('0x4c')]['id']);for(var _0x20d77f=0x0;_0x20d77f<_0x307c57['length'];_0x20d77f+=0x1){let _0x1fd6ba=_0x307c57[_0x20d77f];for(var _0x3e4f48=0x0;_0x3e4f48<_0x1fd6ba['Agents'][_0xcf26('0x3a')];_0x3e4f48+=0x1){let _0x5d46ba=_0x1fd6ba[_0xcf26('0x69')][_0x3e4f48];var _0x12782a=_0x32c16d[_0xcf26('0x7b')]();_0x12782a[_0xcf26('0x3f')](_0xcf26('0x7c'),_0x5d46ba['id']);_0x25ec75['push'](db[_0xcf26('0x6d')][_0xcf26('0x35')](_0x12782a[_0xcf26('0x7d')](),{'type':db[_0xcf26('0x6d')][_0xcf26('0x7e')][_0xcf26('0x7f')]})[_0xcf26('0x28')](function(_0x459506){if(_0x459506[_0xcf26('0x3a')]===0x1){return _0x5d46ba['id'];}else{var _0x45fd3d=_[_0xcf26('0x80')](_[_0xcf26('0x42')](_0x459506,_0xcf26('0x81')),function(_0x59254d){return _[_0xcf26('0x82')](_0x113851,_0x59254d);});if(_0x45fd3d){return _0x5d46ba['id'];}}}));}}return BPromise['all'](_0x25ec75)['then'](function(_0x31d94c){_0x33c06e=_(_0x33c06e)['union'](_0x31d94c)[_0xcf26('0x83')]()[_0xcf26('0x84')]();return db['FaxQueue'][_0xcf26('0x4e')]({'where':{'id':_0x35a742[_0xcf26('0x4c')]['id']}})['then'](function(_0x1a2dc3){return db[_0xcf26('0x6d')][_0xcf26('0x6e')](function(_0x2bacd0){return _0x1a2dc3[_0xcf26('0x73')](_0x35a742[_0xcf26('0x35')][_0xcf26('0x74')],{'transaction':_0x2bacd0})[_0xcf26('0x28')](function(){if(!_['isEmpty'](_0x33c06e)){return _0x1a2dc3[_0xcf26('0x85')](_0x33c06e,{'transaction':_0x2bacd0});}})[_0xcf26('0x28')](function(){_0x33c06e[_0xcf26('0x70')](function(_0x5dd60c){socket[_0xcf26('0x71')](_0xcf26('0x86'),{'UserId':_0x5dd60c,'FaxQueueId':_0x1a2dc3['id']});});});});});});})[_0xcf26('0x28')](respondWithStatusCode(_0x19c2ee,null))[_0xcf26('0x4a')](handleError(_0x19c2ee,null));};exports[_0xcf26('0x87')]=function(_0x1cc557,_0x5be076,_0x1a3cdb){return db[_0xcf26('0x31')][_0xcf26('0x4e')]({'where':{'id':_0x1cc557['params']['id']}})[_0xcf26('0x28')](handleEntityNotFound(_0x5be076,null))[_0xcf26('0x28')](function(_0x513100){if(_0x513100){return _0x513100[_0xcf26('0x87')](_0x1cc557[_0xcf26('0x88')][_0xcf26('0x74')],_[_0xcf26('0x89')](_0x1cc557[_0xcf26('0x88')],[_0xcf26('0x74'),'id'])||{})[_0xcf26('0x8a')](function(_0x13450a){for(var _0xc69d98=0x0;_0xc69d98<_0x1cc557[_0xcf26('0x88')][_0xcf26('0x74')]['length'];_0xc69d98+=0x1){socket['emit'](_0xcf26('0x72'),{'UserId':_0x1cc557[_0xcf26('0x88')][_0xcf26('0x74')][_0xc69d98],'FaxQueueId':_0x1cc557[_0xcf26('0x4c')]['id']});}return _0x13450a;});}})[_0xcf26('0x28')](respondWithResult(_0x5be076,null))[_0xcf26('0x4a')](handleError(_0x5be076,null));};exports[_0xcf26('0x85')]=function(_0x4202e8,_0x3e685d,_0x1553da){return db['FaxQueue']['find']({'where':{'id':_0x4202e8[_0xcf26('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3e685d,null))['then'](function(_0x2ba21d){if(_0x2ba21d){return _0x2ba21d[_0xcf26('0x85')](_0x4202e8['query'][_0xcf26('0x74')])[_0xcf26('0x28')](function(){if(_[_0xcf26('0x8b')](_0x4202e8[_0xcf26('0x35')][_0xcf26('0x74')])){for(var _0x5588f8=0x0;_0x5588f8<_0x4202e8[_0xcf26('0x35')]['ids'][_0xcf26('0x3a')];_0x5588f8+=0x1){socket['emit'](_0xcf26('0x86'),{'UserId':Number(_0x4202e8[_0xcf26('0x35')][_0xcf26('0x74')][_0x5588f8]),'FaxQueueId':Number(_0x4202e8[_0xcf26('0x4c')]['id'])});}}else{socket[_0xcf26('0x71')](_0xcf26('0x86'),{'UserId':Number(_0x4202e8[_0xcf26('0x35')]['ids']),'FaxQueueId':Number(_0x4202e8['params']['id'])});}});}})[_0xcf26('0x28')](respondWithStatusCode(_0x3e685d,null))[_0xcf26('0x4a')](handleError(_0x3e685d,null));};exports[_0xcf26('0x8c')]=function(_0x57f484,_0xc6600a,_0x569e5a){var _0x1cd8ba={};var _0x7b3d66={};var _0x4697b6;var _0x572f2c;return db[_0xcf26('0x31')][_0xcf26('0x58')]({'where':{'id':_0x57f484['params']['id']}})[_0xcf26('0x28')](handleEntityNotFound(_0xc6600a,null))['then'](function(_0x2feb13){if(_0x2feb13){_0x4697b6=_0x2feb13;_0x7b3d66[_0xcf26('0x33')]=_[_0xcf26('0x34')](db[_0xcf26('0x5c')][_0xcf26('0x32')]);_0x7b3d66[_0xcf26('0x35')]=_[_0xcf26('0x34')](_0x57f484[_0xcf26('0x35')]);_0x7b3d66[_0xcf26('0x36')]=_[_0xcf26('0x37')](_0x7b3d66['model'],_0x7b3d66[_0xcf26('0x35')]);_0x1cd8ba[_0xcf26('0x38')]=_[_0xcf26('0x37')](_0x7b3d66[_0xcf26('0x33')],qs[_0xcf26('0x39')](_0x57f484[_0xcf26('0x35')][_0xcf26('0x39')]));_0x1cd8ba[_0xcf26('0x38')]=_0x1cd8ba[_0xcf26('0x38')][_0xcf26('0x3a')]?_0x1cd8ba[_0xcf26('0x38')]:_0x7b3d66[_0xcf26('0x33')];_0x1cd8ba['order']=qs[_0xcf26('0x3e')](_0x57f484[_0xcf26('0x35')][_0xcf26('0x3e')]);_0x1cd8ba[_0xcf26('0x3f')]=qs[_0xcf26('0x36')](_[_0xcf26('0x67')](_0x57f484[_0xcf26('0x35')],_0x7b3d66[_0xcf26('0x36')]));if(_0x57f484[_0xcf26('0x35')][_0xcf26('0x40')]){_0x1cd8ba['where']=_[_0xcf26('0x41')](_0x1cd8ba[_0xcf26('0x3f')],{'$or':_[_0xcf26('0x42')](_0x1cd8ba[_0xcf26('0x38')],function(_0x4b4629){var _0x15d0ec={};_0x15d0ec[_0x4b4629]={'$like':'%'+_0x57f484[_0xcf26('0x35')][_0xcf26('0x40')]+'%'};return _0x15d0ec;})});}_0x1cd8ba=_[_0xcf26('0x41')]({},_0x1cd8ba,_0x57f484[_0xcf26('0x47')]);return _0x4697b6[_0xcf26('0x8c')](_0x1cd8ba);}})[_0xcf26('0x28')](function(_0x27a003){if(_0x27a003){_0x572f2c=_0x27a003[_0xcf26('0x3a')];if(!_0x57f484[_0xcf26('0x35')][_0xcf26('0x3b')](_0xcf26('0x5a'))){_0x1cd8ba['limit']=qs[_0xcf26('0x3c')](_0x57f484[_0xcf26('0x35')][_0xcf26('0x3c')]);_0x1cd8ba[_0xcf26('0x22')]=qs[_0xcf26('0x22')](_0x57f484[_0xcf26('0x35')][_0xcf26('0x22')]);}return _0x4697b6['getAgents'](_0x1cd8ba);}})[_0xcf26('0x28')](function(_0x1cca05){if(_0x1cca05){return _0x1cca05?{'count':_0x572f2c,'rows':_0x1cca05}:null;}})[_0xcf26('0x28')](respondWithResult(_0xc6600a,null))[_0xcf26('0x4a')](handleError(_0xc6600a,null));}; \ No newline at end of file +var _0xe7cd=['query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','key','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','describe','getMembers','hasOwnProperty','FaxQueueId','filter','map','UserFaxQueue','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','findAll','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userFaxQueue:save','removeTeams','Agents','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','compact','transaction','removeAgents','forEach','userFaxQueue:remove','spread','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','FaxQueues','UserProfileResource','stack','name','index','FaxQueue','rawAttributes','model','keys'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0xe7cd,0x1ea));var _0xde7c=function(_0x5526e9,_0x4e89bc){_0x5526e9=_0x5526e9-0x0;var _0x4dab2f=_0xe7cd[_0x5526e9];return _0x4dab2f;};'use strict';var pdf=require(_0xde7c('0x0'));var emlformat=require(_0xde7c('0x1'));var rimraf=require(_0xde7c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde7c('0x3'));var moment=require(_0xde7c('0x4'));var BPromise=require(_0xde7c('0x5'));var Mustache=require(_0xde7c('0x6'));var util=require(_0xde7c('0x7'));var path=require(_0xde7c('0x8'));var sox=require(_0xde7c('0x9'));var csv=require('to-csv');var ejs=require(_0xde7c('0xa'));var fs=require('fs');var _=require(_0xde7c('0xb'));var squel=require(_0xde7c('0xc'));var crypto=require('crypto');var jsforce=require(_0xde7c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xde7c('0xe'));var querystring=require('querystring');var Papa=require(_0xde7c('0xf'));var Redis=require(_0xde7c('0x10'));var authService=require(_0xde7c('0x11'));var qs=require(_0xde7c('0x12'));var hardwareService=require(_0xde7c('0x13'));var logger=require(_0xde7c('0x14'))('api');var utils=require(_0xde7c('0x15'));var config=require(_0xde7c('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xde7c('0x17')],{'host':_0xde7c('0x18'),'port':0x18eb});var socket=require(_0xde7c('0x19'))(new Redis(config[_0xde7c('0x17')]));require(_0xde7c('0x1a'))[_0xde7c('0x1b')](socket);function respondWithStatusCode(_0x460b82,_0x3f0ba2){_0x3f0ba2=_0x3f0ba2||0xcc;return function(_0x5ee9b3){if(_0x5ee9b3){return _0x460b82[_0xde7c('0x1c')](_0x3f0ba2);}return _0x460b82[_0xde7c('0x1d')](_0x3f0ba2)[_0xde7c('0x1e')]();};}function respondWithResult(_0x31c3da,_0x547115){_0x547115=_0x547115||0xc8;return function(_0x312217){if(_0x312217){return _0x31c3da[_0xde7c('0x1d')](_0x547115)[_0xde7c('0x1f')](_0x312217);}};}function respondWithFilteredResult(_0x2c00f8,_0x3fa40e){return function(_0xdbeefa){if(_0xdbeefa){var _0x3ede81=_0xdbeefa[_0xde7c('0x20')],_0xd41c5c=_0x3fa40e[_0xde7c('0x21')],_0x157da3=_0x3fa40e['offset']+_0x3fa40e[_0xde7c('0x22')],_0x23f1e0;if(_0x157da3>=_0x3ede81){_0x157da3=_0x3ede81;_0x23f1e0=0xc8;}else{_0x23f1e0=0xce;}_0x2c00f8[_0xde7c('0x1d')](_0x23f1e0);return _0x2c00f8[_0xde7c('0x23')]('Content-Range',_0xd41c5c+'-'+_0x157da3+'/'+_0x3ede81)[_0xde7c('0x1f')](_0xdbeefa);}return null;};}function patchUpdates(_0x308c45){return function(_0x1ddbf1){try{jsonpatch['apply'](_0x1ddbf1,_0x308c45,!![]);}catch(_0xc04f8a){return BPromise[_0xde7c('0x24')](_0xc04f8a);}return _0x1ddbf1[_0xde7c('0x25')]();};}function saveUpdates(_0x31581f,_0x5e6b60){return function(_0x3f15be){if(_0x3f15be){return _0x3f15be[_0xde7c('0x26')](_0x31581f)[_0xde7c('0x27')](function(_0x142cb4){return _0x142cb4;});}return null;};}function removeEntity(_0x268581,_0x508dde){return function(_0x3952a1){if(_0x3952a1){return _0x3952a1[_0xde7c('0x28')]()[_0xde7c('0x27')](function(){var _0x697979=_0x3952a1['get']({'plain':!![]});var _0xac9b8a=_0xde7c('0x29');return db[_0xde7c('0x2a')]['destroy']({'where':{'type':_0xac9b8a,'resourceId':_0x697979['id']}})['then'](function(){return _0x3952a1;});})[_0xde7c('0x27')](function(){_0x268581['status'](0xcc)[_0xde7c('0x1e')]();});}};}function handleEntityNotFound(_0x56fe62,_0x1ea4ed){return function(_0x333060){if(!_0x333060){_0x56fe62[_0xde7c('0x1c')](0x194);}return _0x333060;};}function handleError(_0x5b5eba,_0x5245ef){_0x5245ef=_0x5245ef||0x1f4;return function(_0xb03647){logger['error'](_0xb03647[_0xde7c('0x2b')]);if(_0xb03647[_0xde7c('0x2c')]){delete _0xb03647['name'];}_0x5b5eba['status'](_0x5245ef)['send'](_0xb03647);};}exports[_0xde7c('0x2d')]=function(_0x5db09b,_0x3b5f0b){var _0x6cbaa3={},_0x5aab7c={},_0x42e260={'count':0x0,'rows':[]};var _0x1cb21e=db[_0xde7c('0x2e')][_0xde7c('0x2f')];_0x5aab7c[_0xde7c('0x30')]=_[_0xde7c('0x31')](_0x1cb21e);_0x5aab7c['query']=_['keys'](_0x5db09b[_0xde7c('0x32')]);_0x5aab7c[_0xde7c('0x33')]=_[_0xde7c('0x34')](_0x5aab7c[_0xde7c('0x30')],_0x5aab7c[_0xde7c('0x32')]);_0x6cbaa3['attributes']=_['intersection'](_0x5aab7c[_0xde7c('0x30')],qs[_0xde7c('0x35')](_0x5db09b[_0xde7c('0x32')]['fields']));_0x6cbaa3[_0xde7c('0x36')]=_0x6cbaa3[_0xde7c('0x36')][_0xde7c('0x37')]?_0x6cbaa3[_0xde7c('0x36')]:_0x5aab7c[_0xde7c('0x30')];if(!_0x5db09b['query']['hasOwnProperty'](_0xde7c('0x38'))){_0x6cbaa3[_0xde7c('0x22')]=qs[_0xde7c('0x22')](_0x5db09b[_0xde7c('0x32')]['limit']);_0x6cbaa3[_0xde7c('0x21')]=qs[_0xde7c('0x21')](_0x5db09b[_0xde7c('0x32')][_0xde7c('0x21')]);}_0x6cbaa3[_0xde7c('0x39')]=qs[_0xde7c('0x3a')](_0x5db09b[_0xde7c('0x32')][_0xde7c('0x3a')]);_0x6cbaa3[_0xde7c('0x3b')]=qs[_0xde7c('0x33')](_[_0xde7c('0x3c')](_0x5db09b[_0xde7c('0x32')],_0x5aab7c[_0xde7c('0x33')]));if(_0x5db09b[_0xde7c('0x32')]['filter']){_0x6cbaa3[_0xde7c('0x3b')]=_[_0xde7c('0x3d')](_0x6cbaa3[_0xde7c('0x3b')],{'$or':_['map'](_0x1cb21e,function(_0x4f1fa8){if(_0x4f1fa8[_0xde7c('0x3e')][_0xde7c('0x3f')]!==_0xde7c('0x40')){var _0x16eaab={};_0x16eaab[_0x4f1fa8['field']]={'$like':'%'+_0x5db09b['query']['filter']+'%'};return _0x16eaab;}})});}_0x6cbaa3=_['merge']({},_0x6cbaa3,_0x5db09b[_0xde7c('0x41')]);var _0x2d71a4={'where':_0x6cbaa3['where']};return db[_0xde7c('0x2e')][_0xde7c('0x20')](_0x2d71a4)[_0xde7c('0x27')](function(_0x213b2d){_0x42e260[_0xde7c('0x20')]=_0x213b2d;if(_0x5db09b['query'][_0xde7c('0x42')]){_0x6cbaa3[_0xde7c('0x43')]=[{'all':!![]}];}return db[_0xde7c('0x2e')]['findAll'](_0x6cbaa3);})[_0xde7c('0x27')](function(_0x33d3ed){_0x42e260[_0xde7c('0x44')]=_0x33d3ed;return _0x42e260;})[_0xde7c('0x27')](respondWithFilteredResult(_0x3b5f0b,_0x6cbaa3))[_0xde7c('0x45')](handleError(_0x3b5f0b,null));};exports['show']=function(_0x582948,_0x5d0f48){var _0x2f8e23={'raw':!![],'where':{'id':_0x582948['params']['id']}},_0x1c7667={};_0x1c7667[_0xde7c('0x30')]=_[_0xde7c('0x31')](db[_0xde7c('0x2e')]['rawAttributes']);_0x1c7667[_0xde7c('0x32')]=_[_0xde7c('0x31')](_0x582948[_0xde7c('0x32')]);_0x1c7667[_0xde7c('0x33')]=_[_0xde7c('0x34')](_0x1c7667[_0xde7c('0x30')],_0x1c7667[_0xde7c('0x32')]);_0x2f8e23[_0xde7c('0x36')]=_['intersection'](_0x1c7667[_0xde7c('0x30')],qs[_0xde7c('0x35')](_0x582948[_0xde7c('0x32')][_0xde7c('0x35')]));_0x2f8e23[_0xde7c('0x36')]=_0x2f8e23[_0xde7c('0x36')]['length']?_0x2f8e23[_0xde7c('0x36')]:_0x1c7667['model'];if(_0x582948['query'][_0xde7c('0x42')]){_0x2f8e23[_0xde7c('0x43')]=[{'all':!![]}];}_0x2f8e23=_[_0xde7c('0x3d')]({},_0x2f8e23,_0x582948[_0xde7c('0x41')]);return db[_0xde7c('0x2e')][_0xde7c('0x46')](_0x2f8e23)['then'](handleEntityNotFound(_0x5d0f48,null))[_0xde7c('0x27')](respondWithResult(_0x5d0f48,null))[_0xde7c('0x45')](handleError(_0x5d0f48,null));};exports[_0xde7c('0x47')]=function(_0xe2f6bf,_0x1ac190){return db[_0xde7c('0x2e')][_0xde7c('0x47')](_0xe2f6bf[_0xde7c('0x48')],{})[_0xde7c('0x27')](function(_0x15632e){var _0x3ec115=_0xe2f6bf[_0xde7c('0x49')][_0xde7c('0x4a')]({'plain':!![]});if(!_0x3ec115)throw new Error(_0xde7c('0x4b'));if(_0x3ec115[_0xde7c('0x4c')]===_0xde7c('0x49')){var _0xeb6e10=_0x15632e['get']({'plain':!![]});var _0x189914='FaxQueues';return db['UserProfileSection'][_0xde7c('0x46')]({'where':{'name':_0x189914,'userProfileId':_0x3ec115[_0xde7c('0x4d')]},'raw':!![]})[_0xde7c('0x27')](function(_0x492be9){if(_0x492be9&&_0x492be9[_0xde7c('0x4e')]===0x0){return db[_0xde7c('0x2a')][_0xde7c('0x47')]({'name':_0xeb6e10['name'],'resourceId':_0xeb6e10['id'],'type':_0x492be9[_0xde7c('0x2c')],'sectionId':_0x492be9['id']},{})[_0xde7c('0x27')](function(){return _0x15632e;});}else{return _0x15632e;}})['catch'](function(_0xec16e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xec16e1);throw _0xec16e1;});}return _0x15632e;})[_0xde7c('0x27')](respondWithResult(_0x1ac190,0xc9))['catch'](handleError(_0x1ac190,null));};exports['update']=function(_0x47513b,_0x5b6643){if(_0x47513b[_0xde7c('0x48')]['id']){delete _0x47513b[_0xde7c('0x48')]['id'];}return db['FaxQueue'][_0xde7c('0x46')]({'where':{'id':_0x47513b[_0xde7c('0x4f')]['id']}})[_0xde7c('0x27')](handleEntityNotFound(_0x5b6643,null))[_0xde7c('0x27')](saveUpdates(_0x47513b[_0xde7c('0x48')],null))['then'](respondWithResult(_0x5b6643,null))['catch'](handleError(_0x5b6643,null));};exports[_0xde7c('0x28')]=function(_0x571c2f,_0x5a9ee2){return db[_0xde7c('0x2e')][_0xde7c('0x46')]({'where':{'id':_0x571c2f[_0xde7c('0x4f')]['id']}})[_0xde7c('0x27')](handleEntityNotFound(_0x5a9ee2,null))[_0xde7c('0x27')](removeEntity(_0x5a9ee2,null))['catch'](handleError(_0x5a9ee2,null));};exports[_0xde7c('0x50')]=function(_0x4d2cbd,_0x20a669){return db[_0xde7c('0x2e')]['describe']()[_0xde7c('0x27')](respondWithResult(_0x20a669,null))[_0xde7c('0x45')](handleError(_0x20a669,null));};exports[_0xde7c('0x51')]=function(_0x1b287b,_0x58deb4,_0x43337d){var _0x363eab={'raw':!![],'where':{}},_0x4dcb92={},_0x3fbd26;return db[_0xde7c('0x2e')]['findOne']({'where':{'id':_0x1b287b[_0xde7c('0x4f')]['id']}})[_0xde7c('0x27')](handleEntityNotFound(_0x58deb4,null))[_0xde7c('0x27')](function(_0x3627bb){if(_0x3627bb){_0x3fbd26=_0x3627bb[_0xde7c('0x4a')]({'plain':!![]});_0x4dcb92['model']=_['keys'](db['UserFaxQueue'][_0xde7c('0x2f')]);_0x4dcb92['query']=_[_0xde7c('0x31')](_0x1b287b[_0xde7c('0x32')]);_0x4dcb92[_0xde7c('0x33')]=_[_0xde7c('0x34')](_0x4dcb92[_0xde7c('0x30')],_0x4dcb92[_0xde7c('0x32')]);_0x363eab[_0xde7c('0x36')]=_['intersection'](_0x4dcb92[_0xde7c('0x30')],qs[_0xde7c('0x35')](_0x1b287b[_0xde7c('0x32')][_0xde7c('0x35')]));_0x363eab[_0xde7c('0x36')]=_0x363eab['attributes'][_0xde7c('0x37')]?_0x363eab[_0xde7c('0x36')]:_0x4dcb92['model'];if(!_0x1b287b[_0xde7c('0x32')][_0xde7c('0x52')](_0xde7c('0x38'))){_0x363eab['limit']=qs['limit'](_0x1b287b[_0xde7c('0x32')][_0xde7c('0x22')]);_0x363eab['offset']=qs['offset'](_0x1b287b[_0xde7c('0x32')]['offset']);}_0x363eab['order']=qs[_0xde7c('0x3a')](_0x1b287b[_0xde7c('0x32')][_0xde7c('0x3a')]);_0x363eab[_0xde7c('0x3b')]=qs[_0xde7c('0x33')](_[_0xde7c('0x3c')](_0x1b287b[_0xde7c('0x32')],_0x4dcb92[_0xde7c('0x33')]));_0x363eab['where'][_0xde7c('0x53')]=_0x3627bb['id'];if(_0x1b287b[_0xde7c('0x32')][_0xde7c('0x54')]){_0x363eab['where']=_[_0xde7c('0x3d')](_0x363eab[_0xde7c('0x3b')],{'$or':_[_0xde7c('0x55')](_0x363eab[_0xde7c('0x36')],function(_0x55354f){var _0x518beb={};_0x518beb[_0x55354f]={'$like':'%'+_0x1b287b[_0xde7c('0x32')]['filter']+'%'};return _0x518beb;})});}_0x363eab=_[_0xde7c('0x3d')]({},_0x363eab,_0x1b287b[_0xde7c('0x41')]);return db[_0xde7c('0x56')]['findAll'](_0x363eab);}})[_0xde7c('0x27')](function(_0x2c1c37){if(_0x2c1c37){return db[_0xde7c('0x57')][_0xde7c('0x58')]({'where':{'id':_['map'](_0x2c1c37,_0xde7c('0x59')),'role':'agent'},'attributes':['id',_0xde7c('0x2c'),_0xde7c('0x5a'),_0xde7c('0x5b'),_0xde7c('0x5c')]});}})[_0xde7c('0x27')](function(_0x54a51d){if(_0x54a51d){return{'count':_0x54a51d[_0xde7c('0x20')],'rows':_['map'](_0x54a51d[_0xde7c('0x44')],function(_0x44393b){return{'membername':_0x44393b[_0xde7c('0x2c')],'UserId':_0x44393b['id'],'queue_name':_0x3fbd26[_0xde7c('0x2c')],'FaxQueueId':_0x3fbd26['id'],'interface':util[_0xde7c('0x5d')](_0xde7c('0x5e'),'SIP',_0x44393b['name']),'penalty':0x0,'paused':_0x44393b['faxPause'],'createdAt':_0x44393b[_0xde7c('0x5c')],'updatedAt':_0x44393b[_0xde7c('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xde7c('0x27')](respondWithFilteredResult(_0x58deb4,_0x363eab))['catch'](handleError(_0x58deb4,null));};exports[_0xde7c('0x5f')]=function(_0x4f8269,_0x100a28,_0x265ce2){var _0x3058d8={};var _0x4df74d={};var _0x441f72;var _0x3371ad;return db[_0xde7c('0x2e')][_0xde7c('0x60')]({'where':{'id':_0x4f8269[_0xde7c('0x4f')]['id']}})[_0xde7c('0x27')](handleEntityNotFound(_0x100a28,null))[_0xde7c('0x27')](function(_0x59fcfd){if(_0x59fcfd){_0x441f72=_0x59fcfd;_0x4df74d['model']=_[_0xde7c('0x31')](db[_0xde7c('0x61')]['rawAttributes']);_0x4df74d[_0xde7c('0x32')]=_[_0xde7c('0x31')](_0x4f8269['query']);_0x4df74d[_0xde7c('0x33')]=_[_0xde7c('0x34')](_0x4df74d[_0xde7c('0x30')],_0x4df74d[_0xde7c('0x32')]);_0x3058d8['attributes']=_['intersection'](_0x4df74d[_0xde7c('0x30')],qs[_0xde7c('0x35')](_0x4f8269[_0xde7c('0x32')][_0xde7c('0x35')]));_0x3058d8[_0xde7c('0x36')]=_0x3058d8['attributes'][_0xde7c('0x37')]?_0x3058d8[_0xde7c('0x36')]:_0x4df74d[_0xde7c('0x30')];_0x3058d8[_0xde7c('0x39')]=qs['sort'](_0x4f8269[_0xde7c('0x32')][_0xde7c('0x3a')]);_0x3058d8[_0xde7c('0x3b')]=qs['filters'](_[_0xde7c('0x3c')](_0x4f8269[_0xde7c('0x32')],_0x4df74d['filters']));if(_0x4f8269[_0xde7c('0x32')][_0xde7c('0x54')]){_0x3058d8[_0xde7c('0x3b')]=_['merge'](_0x3058d8[_0xde7c('0x3b')],{'$or':_[_0xde7c('0x55')](_0x3058d8[_0xde7c('0x36')],function(_0x268ab4){var _0x232c59={};_0x232c59[_0x268ab4]={'$like':'%'+_0x4f8269['query'][_0xde7c('0x54')]+'%'};return _0x232c59;})});}_0x3058d8=_[_0xde7c('0x3d')]({},_0x3058d8,_0x4f8269['options']);return _0x441f72[_0xde7c('0x5f')](_0x3058d8);}})[_0xde7c('0x27')](function(_0x1172d3){if(_0x1172d3){_0x3371ad=_0x1172d3['length'];if(!_0x4f8269['query'][_0xde7c('0x52')]('nolimit')){_0x3058d8[_0xde7c('0x22')]=qs[_0xde7c('0x22')](_0x4f8269[_0xde7c('0x32')][_0xde7c('0x22')]);_0x3058d8[_0xde7c('0x21')]=qs[_0xde7c('0x21')](_0x4f8269['query'][_0xde7c('0x21')]);}return _0x441f72[_0xde7c('0x5f')](_0x3058d8);}})['then'](function(_0x1aa2f2){if(_0x1aa2f2){return _0x1aa2f2?{'count':_0x3371ad,'rows':_0x1aa2f2}:null;}})[_0xde7c('0x27')](respondWithResult(_0x100a28,null))['catch'](handleError(_0x100a28,null));};exports[_0xde7c('0x62')]=function(_0x46396f,_0x3c524d,_0x87b312){var _0x10c1c9=_0x46396f[_0xde7c('0x48')][_0xde7c('0x63')];return db[_0xde7c('0x61')][_0xde7c('0x64')]({'where':{'id':_0x10c1c9},'attributes':['id'],'include':[{'model':db[_0xde7c('0x57')],'as':'Agents','attributes':['id',_0xde7c('0x2c'),_0xde7c('0x65'),_0xde7c('0x66'),_0xde7c('0x67')],'raw':!![]}]})[_0xde7c('0x27')](function(_0x4006a1){if(_0x4006a1){var _0x2b06f5=_[_0xde7c('0x68')](_0x4006a1,function(_0xd257dd){var _0x14f9d1=_0xd257dd[_0xde7c('0x4a')]({'plain':!![]});return _0x14f9d1['Agents'];});return db['FaxQueue'][_0xde7c('0x46')]({'where':{'id':_0x46396f[_0xde7c('0x4f')]['id']}})['then'](function(_0x1e572a){return db[_0xde7c('0x69')]['transaction'](function(_0x211877){return _0x1e572a['addTeams'](_0x10c1c9,{'transaction':_0x211877})[_0xde7c('0x27')](function(){return BPromise[_0xde7c('0x6a')](_0x2b06f5,function(_0x5b71f8){return db['UserFaxQueue'][_0xde7c('0x6b')]({'where':{'UserId':_0x5b71f8['id'],'FaxQueueId':_0x46396f[_0xde7c('0x4f')]['id']},'transaction':_0x211877});});})[_0xde7c('0x27')](function(){_0x2b06f5['forEach'](function(_0x451b6e){socket[_0xde7c('0x6c')](_0xde7c('0x6d'),{'UserId':_0x451b6e['id'],'FaxQueueId':_0x1e572a['id']});});});});});}})[_0xde7c('0x27')](respondWithStatusCode(_0x3c524d,null))['catch'](handleError(_0x3c524d,null));};exports[_0xde7c('0x6e')]=function(_0x504075,_0x1bdc03,_0x42482a){return db[_0xde7c('0x61')]['findAll']({'where':{'id':_0x504075[_0xde7c('0x32')][_0xde7c('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xde7c('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1bdc03,null))['then'](function(_0x539ecb){var _0x50cf6a=_[_0xde7c('0x55')](_0x539ecb,'id');var _0x542856=[];var _0x576f7d=[];var _0x356959=squel[_0xde7c('0x70')]();_0x356959['field'](_0xde7c('0x71'))[_0xde7c('0x72')](_0xde7c('0x73'),'tq')[_0xde7c('0x74')](_0xde7c('0x75'),'ut',_0xde7c('0x76'))[_0xde7c('0x3b')](_0xde7c('0x77'),_0x504075[_0xde7c('0x4f')]['id']);for(var _0x5375ad=0x0;_0x5375ad<_0x539ecb['length'];_0x5375ad+=0x1){let _0x430c14=_0x539ecb[_0x5375ad];for(var _0x57b1de=0x0;_0x57b1de<_0x430c14[_0xde7c('0x6f')][_0xde7c('0x37')];_0x57b1de+=0x1){let _0x59ead7=_0x430c14[_0xde7c('0x6f')][_0x57b1de];var _0x12c20e=_0x356959[_0xde7c('0x78')]();_0x12c20e[_0xde7c('0x3b')](_0xde7c('0x79'),_0x59ead7['id']);_0x576f7d[_0xde7c('0x7a')](db[_0xde7c('0x69')][_0xde7c('0x32')](_0x12c20e[_0xde7c('0x7b')](),{'type':db[_0xde7c('0x69')][_0xde7c('0x7c')]['SELECT']})[_0xde7c('0x27')](function(_0x4200c8){if(_0x4200c8[_0xde7c('0x37')]===0x1){return _0x59ead7['id'];}else{var _0x473cc2=_['every'](_['map'](_0x4200c8,_0xde7c('0x7d')),function(_0x867fcc){return _[_0xde7c('0x7e')](_0x50cf6a,_0x867fcc);});if(_0x473cc2){return _0x59ead7['id'];}}}));}}return BPromise[_0xde7c('0x7f')](_0x576f7d)[_0xde7c('0x27')](function(_0x534a61){_0x542856=_(_0x542856)['union'](_0x534a61)[_0xde7c('0x80')]()['value']();return db[_0xde7c('0x2e')][_0xde7c('0x46')]({'where':{'id':_0x504075[_0xde7c('0x4f')]['id']}})[_0xde7c('0x27')](function(_0x25a464){return db[_0xde7c('0x69')][_0xde7c('0x81')](function(_0x4ad658){return _0x25a464[_0xde7c('0x6e')](_0x504075[_0xde7c('0x32')]['ids'],{'transaction':_0x4ad658})['then'](function(){if(!_['isEmpty'](_0x542856)){return _0x25a464[_0xde7c('0x82')](_0x542856,{'transaction':_0x4ad658});}})[_0xde7c('0x27')](function(){_0x542856[_0xde7c('0x83')](function(_0x5bb1b0){socket[_0xde7c('0x6c')](_0xde7c('0x84'),{'UserId':_0x5bb1b0,'FaxQueueId':_0x25a464['id']});});});});});});})[_0xde7c('0x27')](respondWithStatusCode(_0x1bdc03,null))[_0xde7c('0x45')](handleError(_0x1bdc03,null));};exports['addAgents']=function(_0xefb940,_0x3b806e,_0x4bb33d){return db[_0xde7c('0x2e')][_0xde7c('0x46')]({'where':{'id':_0xefb940['params']['id']}})['then'](handleEntityNotFound(_0x3b806e,null))[_0xde7c('0x27')](function(_0x3776fd){if(_0x3776fd){return _0x3776fd['addAgents'](_0xefb940[_0xde7c('0x48')][_0xde7c('0x63')],_['omit'](_0xefb940[_0xde7c('0x48')],[_0xde7c('0x63'),'id'])||{})[_0xde7c('0x85')](function(_0x3acb63){for(var _0x58fa69=0x0;_0x58fa69<_0xefb940[_0xde7c('0x48')]['ids'][_0xde7c('0x37')];_0x58fa69+=0x1){socket[_0xde7c('0x6c')]('userFaxQueue:save',{'UserId':_0xefb940[_0xde7c('0x48')][_0xde7c('0x63')][_0x58fa69],'FaxQueueId':_0xefb940[_0xde7c('0x4f')]['id']});}return _0x3acb63;});}})[_0xde7c('0x27')](respondWithResult(_0x3b806e,null))[_0xde7c('0x45')](handleError(_0x3b806e,null));};exports['removeAgents']=function(_0xb1ab28,_0x5315ac,_0x222780){return db[_0xde7c('0x2e')][_0xde7c('0x46')]({'where':{'id':_0xb1ab28[_0xde7c('0x4f')]['id']}})[_0xde7c('0x27')](handleEntityNotFound(_0x5315ac,null))[_0xde7c('0x27')](function(_0x436988){if(_0x436988){return _0x436988['removeAgents'](_0xb1ab28[_0xde7c('0x32')][_0xde7c('0x63')])[_0xde7c('0x27')](function(){if(_['isArray'](_0xb1ab28[_0xde7c('0x32')]['ids'])){for(var _0x1e68a1=0x0;_0x1e68a1<_0xb1ab28[_0xde7c('0x32')][_0xde7c('0x63')]['length'];_0x1e68a1+=0x1){socket['emit'](_0xde7c('0x84'),{'UserId':Number(_0xb1ab28[_0xde7c('0x32')][_0xde7c('0x63')][_0x1e68a1]),'FaxQueueId':Number(_0xb1ab28[_0xde7c('0x4f')]['id'])});}}else{socket['emit'](_0xde7c('0x84'),{'UserId':Number(_0xb1ab28[_0xde7c('0x32')][_0xde7c('0x63')]),'FaxQueueId':Number(_0xb1ab28[_0xde7c('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x5315ac,null))[_0xde7c('0x45')](handleError(_0x5315ac,null));};exports[_0xde7c('0x86')]=function(_0x24bb0e,_0x3d12ba,_0x5ba800){var _0x59aa3f={};var _0x30a9c4={};var _0x12372f;var _0x183112;return db[_0xde7c('0x2e')][_0xde7c('0x60')]({'where':{'id':_0x24bb0e[_0xde7c('0x4f')]['id']}})[_0xde7c('0x27')](handleEntityNotFound(_0x3d12ba,null))[_0xde7c('0x27')](function(_0x2dfb77){if(_0x2dfb77){_0x12372f=_0x2dfb77;_0x30a9c4['model']=_[_0xde7c('0x31')](db['User'][_0xde7c('0x2f')]);_0x30a9c4[_0xde7c('0x32')]=_[_0xde7c('0x31')](_0x24bb0e['query']);_0x30a9c4[_0xde7c('0x33')]=_['intersection'](_0x30a9c4['model'],_0x30a9c4[_0xde7c('0x32')]);_0x59aa3f[_0xde7c('0x36')]=_['intersection'](_0x30a9c4[_0xde7c('0x30')],qs[_0xde7c('0x35')](_0x24bb0e[_0xde7c('0x32')][_0xde7c('0x35')]));_0x59aa3f[_0xde7c('0x36')]=_0x59aa3f[_0xde7c('0x36')][_0xde7c('0x37')]?_0x59aa3f[_0xde7c('0x36')]:_0x30a9c4[_0xde7c('0x30')];_0x59aa3f[_0xde7c('0x39')]=qs[_0xde7c('0x3a')](_0x24bb0e[_0xde7c('0x32')][_0xde7c('0x3a')]);_0x59aa3f[_0xde7c('0x3b')]=qs[_0xde7c('0x33')](_[_0xde7c('0x3c')](_0x24bb0e['query'],_0x30a9c4['filters']));if(_0x24bb0e[_0xde7c('0x32')][_0xde7c('0x54')]){_0x59aa3f['where']=_[_0xde7c('0x3d')](_0x59aa3f['where'],{'$or':_[_0xde7c('0x55')](_0x59aa3f[_0xde7c('0x36')],function(_0x58e08e){var _0x131ab6={};_0x131ab6[_0x58e08e]={'$like':'%'+_0x24bb0e[_0xde7c('0x32')][_0xde7c('0x54')]+'%'};return _0x131ab6;})});}_0x59aa3f=_[_0xde7c('0x3d')]({},_0x59aa3f,_0x24bb0e[_0xde7c('0x41')]);return _0x12372f[_0xde7c('0x86')](_0x59aa3f);}})[_0xde7c('0x27')](function(_0x2a17ec){if(_0x2a17ec){_0x183112=_0x2a17ec[_0xde7c('0x37')];if(!_0x24bb0e['query']['hasOwnProperty'](_0xde7c('0x38'))){_0x59aa3f[_0xde7c('0x22')]=qs['limit'](_0x24bb0e[_0xde7c('0x32')][_0xde7c('0x22')]);_0x59aa3f[_0xde7c('0x21')]=qs['offset'](_0x24bb0e['query']['offset']);}return _0x12372f['getAgents'](_0x59aa3f);}})[_0xde7c('0x27')](function(_0x11cd66){if(_0x11cd66){return _0x11cd66?{'count':_0x183112,'rows':_0x11cd66}:null;}})[_0xde7c('0x27')](respondWithResult(_0x3d12ba,null))[_0xde7c('0x45')](handleError(_0x3d12ba,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ee73b3c..cb0998c 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 _0xd726=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd726,0x108));var _0x6d72=function(_0x3e56b0,_0x572b33){_0x3e56b0=_0x3e56b0-0x0;var _0x4d0615=_0xd726[_0x3e56b0];return _0x4d0615;};'use strict';var EventEmitter=require(_0x6d72('0x0'));var FaxQueue=require(_0x6d72('0x1'))['db'][_0x6d72('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6d72('0x3')](0x0);var events={'afterCreate':_0x6d72('0x4'),'afterUpdate':_0x6d72('0x5'),'afterDestroy':_0x6d72('0x6')};function emitEvent(_0x29a4bf){return function(_0x4b381f,_0x2a685e,_0x33d6fb){FaxQueueEvents['emit'](_0x29a4bf+':'+_0x4b381f['id'],_0x4b381f);FaxQueueEvents[_0x6d72('0x7')](_0x29a4bf,_0x4b381f);_0x33d6fb(null);};}for(var e in events){if(events[_0x6d72('0x8')](e)){var event=events[e];FaxQueue[_0x6d72('0x9')](e,emitEvent(event));}}module[_0x6d72('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x4e17=['exports','events','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x354d83,_0x5e7a4e){var _0x106d0f=function(_0xca6e52){while(--_0xca6e52){_0x354d83['push'](_0x354d83['shift']());}};_0x106d0f(++_0x5e7a4e);}(_0x4e17,0x1c3));var _0x74e1=function(_0x25fc82,_0x2c867b){_0x25fc82=_0x25fc82-0x0;var _0x142f34=_0x4e17[_0x25fc82];return _0x142f34;};'use strict';var EventEmitter=require(_0x74e1('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x74e1('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x74e1('0x2')](0x0);var events={'afterCreate':_0x74e1('0x3'),'afterUpdate':_0x74e1('0x4'),'afterDestroy':_0x74e1('0x5')};function emitEvent(_0x7352f9){return function(_0x3114f9,_0x46ad75,_0x4d4af7){FaxQueueEvents['emit'](_0x7352f9+':'+_0x3114f9['id'],_0x3114f9);FaxQueueEvents[_0x74e1('0x6')](_0x7352f9,_0x3114f9);_0x4d4af7(null);};}for(var e in events){if(events[_0x74e1('0x7')](e)){var event=events[e];FaxQueue[_0x74e1('0x8')](e,emitEvent(event));}}module[_0x74e1('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index ccf4af6..dcf1bb5 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 _0xd831=['FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define'];(function(_0x38ff91,_0x26232d){var _0x39ad2e=function(_0x393b52){while(--_0x393b52){_0x38ff91['push'](_0x38ff91['shift']());}};_0x39ad2e(++_0x26232d);}(_0xd831,0x1a2));var _0x1d83=function(_0x5c3760,_0x32c298){_0x5c3760=_0x5c3760-0x0;var _0x2c22c8=_0xd831[_0x5c3760];return _0x2c22c8;};'use strict';var _=require(_0x1d83('0x0'));var util=require(_0x1d83('0x1'));var logger=require(_0x1d83('0x2'))('api');var moment=require(_0x1d83('0x3'));var BPromise=require(_0x1d83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d83('0x5'));var rimraf=require(_0x1d83('0x6'));var config=require(_0x1d83('0x7'));var attributes=require(_0x1d83('0x8'));module[_0x1d83('0x9')]=function(_0x1c412d,_0x14addc){return _0x1c412d[_0x1d83('0xa')](_0x1d83('0xb'),attributes,{'tableName':_0x1d83('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3ad=['fax_queues','util','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x4b35d1,_0x99d290){var _0xf24db=function(_0x2fc80c){while(--_0x2fc80c){_0x4b35d1['push'](_0x4b35d1['shift']());}};_0xf24db(++_0x99d290);}(_0xf3ad,0x161));var _0xdf3a=function(_0x525ab3,_0x3a170d){_0x525ab3=_0x525ab3-0x0;var _0x1d8675=_0xf3ad[_0x525ab3];return _0x1d8675;};'use strict';var _=require('lodash');var util=require(_0xdf3a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdf3a('0x1'));var BPromise=require(_0xdf3a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3a('0x3'));var rimraf=require(_0xdf3a('0x4'));var config=require(_0xdf3a('0x5'));var attributes=require(_0xdf3a('0x6'));module[_0xdf3a('0x7')]=function(_0x45c992,_0x1e242c){return _0x45c992[_0xdf3a('0x8')](_0xdf3a('0x9'),attributes,{'tableName':_0xdf3a('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 9b412ad..d912835 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 _0x537f=['code','message','info','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','debug','ShowFaxQueue','FaxQueue','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x27a4e8,_0x2a224d){var _0x6fb132=function(_0x541500){while(--_0x541500){_0x27a4e8['push'](_0x27a4e8['shift']());}};_0x6fb132(++_0x2a224d);}(_0x537f,0x1a2));var _0xf537=function(_0x3f8f26,_0x1a9b42){_0x3f8f26=_0x3f8f26-0x0;var _0x3b5e2f=_0x537f[_0x3f8f26];return _0x3b5e2f;};'use strict';var _=require('lodash');var util=require(_0xf537('0x0'));var moment=require('moment');var BPromise=require(_0xf537('0x1'));var rs=require(_0xf537('0x2'));var fs=require('fs');var Redis=require(_0xf537('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf537('0x4'));var logger=require(_0xf537('0x5'))(_0xf537('0x6'));var config=require(_0xf537('0x7'));var jayson=require(_0xf537('0x8'));var client=jayson['client'][_0xf537('0x9')]({'port':0x232a});config['redis']=_[_0xf537('0xa')](config['redis'],{'host':_0xf537('0xb'),'port':0x18eb});var socket=require(_0xf537('0xc'))(new Redis(config[_0xf537('0xd')]));require(_0xf537('0xe'))[_0xf537('0xf')](socket);function respondWithRpcPromise(_0x15ba53,_0x277650,_0x4abbe9){return new BPromise(function(_0x2c68a1,_0x30cad0){return client[_0xf537('0x10')](_0x15ba53,_0x4abbe9)[_0xf537('0x11')](function(_0x471bc1){logger['info'](_0xf537('0x12'),_0x277650,_0xf537('0x13'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x277650,_0xf537('0x13'),JSON[_0xf537('0x14')](_0x471bc1));if(_0x471bc1[_0xf537('0x15')]){if(_0x471bc1['error'][_0xf537('0x16')]===0x1f4){logger[_0xf537('0x15')]('FaxQueue,\x20%s,\x20%s',_0x277650,_0x471bc1['error']['message']);return _0x30cad0(_0x471bc1['error'][_0xf537('0x17')]);}logger[_0xf537('0x15')]('FaxQueue,\x20%s,\x20%s',_0x277650,_0x471bc1[_0xf537('0x15')][_0xf537('0x17')]);return _0x2c68a1(_0x471bc1[_0xf537('0x15')][_0xf537('0x17')]);}else{logger[_0xf537('0x18')](_0xf537('0x12'),_0x277650,_0xf537('0x13'));_0x2c68a1(_0x471bc1[_0xf537('0x19')][_0xf537('0x17')]);}})[_0xf537('0x1a')](function(_0x4c64e2){logger['error'](_0xf537('0x12'),_0x277650,_0x4c64e2);_0x30cad0(_0x4c64e2);});});}exports['GetFaxQueue']=function(_0xb8d191){var _0x419349=this;return new Promise(function(_0x2f5d1c,_0x1915b9){return db['FaxQueue'][_0xf537('0x1b')]({'raw':_0xb8d191[_0xf537('0x1c')]?_0xb8d191[_0xf537('0x1c')][_0xf537('0x1d')]===undefined?!![]:![]:!![],'where':_0xb8d191[_0xf537('0x1c')]?_0xb8d191['options'][_0xf537('0x1e')]||null:null,'attributes':_0xb8d191[_0xf537('0x1c')]?_0xb8d191[_0xf537('0x1c')][_0xf537('0x1f')]||null:null,'limit':_0xb8d191['options']?_0xb8d191[_0xf537('0x1c')][_0xf537('0x20')]||null:null,'include':_0xb8d191[_0xf537('0x1c')]?_0xb8d191[_0xf537('0x1c')][_0xf537('0x21')]?_[_0xf537('0x22')](_0xb8d191['options'][_0xf537('0x21')],function(_0x5d59be){return{'model':db[_0x5d59be[_0xf537('0x23')]],'as':_0x5d59be['as'],'attributes':_0x5d59be['attributes'],'include':_0x5d59be['include']?_[_0xf537('0x22')](_0x5d59be['include'],function(_0x2408d8){return{'model':db[_0x2408d8[_0xf537('0x23')]],'as':_0x2408d8['as'],'attributes':_0x2408d8[_0xf537('0x1f')],'include':_0x2408d8[_0xf537('0x21')]?_[_0xf537('0x22')](_0x2408d8[_0xf537('0x21')],function(_0x119571){return{'model':db[_0x119571[_0xf537('0x23')]],'as':_0x119571['as'],'attributes':_0x119571[_0xf537('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf537('0x11')](function(_0x52c988){logger['info'](_0xf537('0x24'),_0xb8d191);logger[_0xf537('0x25')](_0xf537('0x24'),_0xb8d191,JSON[_0xf537('0x14')](_0x52c988));_0x2f5d1c(_0x52c988);})[_0xf537('0x1a')](function(_0x4c3767){logger[_0xf537('0x15')](_0xf537('0x24'),_0x4c3767['message'],_0xb8d191);_0x1915b9(_0x419349[_0xf537('0x15')](0x1f4,_0x4c3767[_0xf537('0x17')]));});});};exports[_0xf537('0x26')]=function(_0x416b41){var _0x1f21cc=this;return new Promise(function(_0x255517,_0x4d6321){return db[_0xf537('0x27')]['find']({'raw':_0x416b41[_0xf537('0x1c')]?_0x416b41['options'][_0xf537('0x1d')]===undefined?!![]:![]:!![],'where':_0x416b41['options']?_0x416b41[_0xf537('0x1c')]['where']||null:null,'attributes':_0x416b41[_0xf537('0x1c')]?_0x416b41[_0xf537('0x1c')][_0xf537('0x1f')]||null:null,'include':_0x416b41[_0xf537('0x1c')]?_0x416b41['options'][_0xf537('0x21')]?_[_0xf537('0x22')](_0x416b41['options'][_0xf537('0x21')],function(_0x3f862e){return{'model':db[_0x3f862e[_0xf537('0x23')]],'as':_0x3f862e['as'],'attributes':_0x3f862e['attributes'],'include':_0x3f862e[_0xf537('0x21')]?_[_0xf537('0x22')](_0x3f862e['include'],function(_0x434f16){return{'model':db[_0x434f16[_0xf537('0x23')]],'as':_0x434f16['as'],'attributes':_0x434f16[_0xf537('0x1f')],'include':_0x434f16[_0xf537('0x21')]?_[_0xf537('0x22')](_0x434f16[_0xf537('0x21')],function(_0x18d818){return{'model':db[_0x18d818[_0xf537('0x23')]],'as':_0x18d818['as'],'attributes':_0x18d818['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d0156){logger[_0xf537('0x18')](_0xf537('0x26'),_0x416b41);logger[_0xf537('0x25')](_0xf537('0x26'),_0x416b41,JSON[_0xf537('0x14')](_0x1d0156));_0x255517(_0x1d0156);})['catch'](function(_0x66c48d){logger[_0xf537('0x15')](_0xf537('0x26'),_0x66c48d[_0xf537('0x17')],_0x416b41);_0x4d6321(_0x1f21cc['error'](0x1f4,_0x66c48d[_0xf537('0x17')]));});});}; \ No newline at end of file +var _0x7efe=['request','then','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','options','raw','attributes','limit','map','include','model','debug','ShowFaxQueue','FaxQueue','find','where','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./faxQueue.socket','register'];(function(_0x595e20,_0x1c118a){var _0x43b118=function(_0xc7f300){while(--_0xc7f300){_0x595e20['push'](_0x595e20['shift']());}};_0x43b118(++_0x1c118a);}(_0x7efe,0xa8));var _0xe7ef=function(_0x5cc2c3,_0x1357b2){_0x5cc2c3=_0x5cc2c3-0x0;var _0x401164=_0x7efe[_0x5cc2c3];return _0x401164;};'use strict';var _=require(_0xe7ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe7ef('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ef('0x3'));var logger=require('../../config/logger')(_0xe7ef('0x4'));var config=require(_0xe7ef('0x5'));var jayson=require(_0xe7ef('0x6'));var client=jayson['client'][_0xe7ef('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe7ef('0x8')],{'host':_0xe7ef('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe7ef('0x8')]));require(_0xe7ef('0xa'))[_0xe7ef('0xb')](socket);function respondWithRpcPromise(_0x53f7f7,_0x4d3807,_0x2367e0){return new BPromise(function(_0x57f77c,_0x5c3518){return client[_0xe7ef('0xc')](_0x53f7f7,_0x2367e0)[_0xe7ef('0xd')](function(_0x4cc004){logger[_0xe7ef('0xe')]('FaxQueue,\x20%s,\x20%s',_0x4d3807,_0xe7ef('0xf'));logger['debug'](_0xe7ef('0x10'),_0x4d3807,_0xe7ef('0xf'),JSON[_0xe7ef('0x11')](_0x4cc004));if(_0x4cc004['error']){if(_0x4cc004[_0xe7ef('0x12')]['code']===0x1f4){logger[_0xe7ef('0x12')](_0xe7ef('0x13'),_0x4d3807,_0x4cc004[_0xe7ef('0x12')][_0xe7ef('0x14')]);return _0x5c3518(_0x4cc004['error'][_0xe7ef('0x14')]);}logger['error'](_0xe7ef('0x13'),_0x4d3807,_0x4cc004[_0xe7ef('0x12')][_0xe7ef('0x14')]);return _0x57f77c(_0x4cc004[_0xe7ef('0x12')][_0xe7ef('0x14')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x4d3807,_0xe7ef('0xf'));_0x57f77c(_0x4cc004[_0xe7ef('0x15')][_0xe7ef('0x14')]);}})[_0xe7ef('0x16')](function(_0x4dec2f){logger[_0xe7ef('0x12')](_0xe7ef('0x13'),_0x4d3807,_0x4dec2f);_0x5c3518(_0x4dec2f);});});}exports[_0xe7ef('0x17')]=function(_0x19702b){var _0x45faaf=this;return new Promise(function(_0x2baf30,_0x4fd133){return db['FaxQueue']['findAll']({'raw':_0x19702b[_0xe7ef('0x18')]?_0x19702b[_0xe7ef('0x18')][_0xe7ef('0x19')]===undefined?!![]:![]:!![],'where':_0x19702b['options']?_0x19702b[_0xe7ef('0x18')]['where']||null:null,'attributes':_0x19702b[_0xe7ef('0x18')]?_0x19702b[_0xe7ef('0x18')][_0xe7ef('0x1a')]||null:null,'limit':_0x19702b[_0xe7ef('0x18')]?_0x19702b[_0xe7ef('0x18')][_0xe7ef('0x1b')]||null:null,'include':_0x19702b[_0xe7ef('0x18')]?_0x19702b['options']['include']?_[_0xe7ef('0x1c')](_0x19702b['options'][_0xe7ef('0x1d')],function(_0x11a770){return{'model':db[_0x11a770[_0xe7ef('0x1e')]],'as':_0x11a770['as'],'attributes':_0x11a770[_0xe7ef('0x1a')],'include':_0x11a770[_0xe7ef('0x1d')]?_['map'](_0x11a770[_0xe7ef('0x1d')],function(_0x1c0e80){return{'model':db[_0x1c0e80[_0xe7ef('0x1e')]],'as':_0x1c0e80['as'],'attributes':_0x1c0e80[_0xe7ef('0x1a')],'include':_0x1c0e80[_0xe7ef('0x1d')]?_[_0xe7ef('0x1c')](_0x1c0e80[_0xe7ef('0x1d')],function(_0x5e89c9){return{'model':db[_0x5e89c9[_0xe7ef('0x1e')]],'as':_0x5e89c9['as'],'attributes':_0x5e89c9[_0xe7ef('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f4336){logger[_0xe7ef('0xe')](_0xe7ef('0x17'),_0x19702b);logger[_0xe7ef('0x1f')]('GetFaxQueue',_0x19702b,JSON[_0xe7ef('0x11')](_0x2f4336));_0x2baf30(_0x2f4336);})[_0xe7ef('0x16')](function(_0x194b07){logger[_0xe7ef('0x12')](_0xe7ef('0x17'),_0x194b07[_0xe7ef('0x14')],_0x19702b);_0x4fd133(_0x45faaf['error'](0x1f4,_0x194b07['message']));});});};exports[_0xe7ef('0x20')]=function(_0x248afe){var _0x558579=this;return new Promise(function(_0x1f74b4,_0x30dca2){return db[_0xe7ef('0x21')][_0xe7ef('0x22')]({'raw':_0x248afe['options']?_0x248afe[_0xe7ef('0x18')][_0xe7ef('0x19')]===undefined?!![]:![]:!![],'where':_0x248afe[_0xe7ef('0x18')]?_0x248afe[_0xe7ef('0x18')][_0xe7ef('0x23')]||null:null,'attributes':_0x248afe[_0xe7ef('0x18')]?_0x248afe['options'][_0xe7ef('0x1a')]||null:null,'include':_0x248afe[_0xe7ef('0x18')]?_0x248afe[_0xe7ef('0x18')]['include']?_[_0xe7ef('0x1c')](_0x248afe[_0xe7ef('0x18')]['include'],function(_0x13aec6){return{'model':db[_0x13aec6['model']],'as':_0x13aec6['as'],'attributes':_0x13aec6['attributes'],'include':_0x13aec6[_0xe7ef('0x1d')]?_['map'](_0x13aec6[_0xe7ef('0x1d')],function(_0x458baf){return{'model':db[_0x458baf[_0xe7ef('0x1e')]],'as':_0x458baf['as'],'attributes':_0x458baf[_0xe7ef('0x1a')],'include':_0x458baf['include']?_[_0xe7ef('0x1c')](_0x458baf[_0xe7ef('0x1d')],function(_0xc148da){return{'model':db[_0xc148da[_0xe7ef('0x1e')]],'as':_0xc148da['as'],'attributes':_0xc148da['attributes']};}):[]};}):[]};}):[]:[]})[_0xe7ef('0xd')](function(_0x3e74a0){logger[_0xe7ef('0xe')]('ShowFaxQueue',_0x248afe);logger[_0xe7ef('0x1f')](_0xe7ef('0x20'),_0x248afe,JSON[_0xe7ef('0x11')](_0x3e74a0));_0x1f74b4(_0x3e74a0);})[_0xe7ef('0x16')](function(_0x6b4ef5){logger[_0xe7ef('0x12')](_0xe7ef('0x20'),_0x6b4ef5['message'],_0x248afe);_0x30dca2(_0x558579['error'](0x1f4,_0x6b4ef5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ea0ba72..cb68e7d 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 _0x26df=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x1b7fef,_0x8e856c){var _0x4c4dbd=function(_0x3a6480){while(--_0x3a6480){_0x1b7fef['push'](_0x1b7fef['shift']());}};_0x4c4dbd(++_0x8e856c);}(_0x26df,0x186));var _0xf26d=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x26df[_0x4d9bb2];return _0x3179fe;};'use strict';var FaxQueueEvents=require(_0xf26d('0x0'));var events=[_0xf26d('0x1'),'remove',_0xf26d('0x2')];function createListener(_0x19e77d,_0x27d50d){return function(_0x353506){_0x27d50d[_0xf26d('0x3')](_0x19e77d,_0x353506);};}function removeListener(_0x35279d,_0x525039){return function(){FaxQueueEvents[_0xf26d('0x4')](_0x35279d,_0x525039);};}exports[_0xf26d('0x5')]=function(_0xe7f6d8){for(var _0x23f317=0x0,_0x114aad=events[_0xf26d('0x6')];_0x23f317<_0x114aad;_0x23f317++){var _0x38d52e=events[_0x23f317];var _0x5f30da=createListener(_0xf26d('0x7')+_0x38d52e,_0xe7f6d8);FaxQueueEvents['on'](_0x38d52e,_0x5f30da);}}; \ No newline at end of file +var _0x342a=['faxQueue:','./faxQueue.events','remove','emit','register','length'];(function(_0xc0c214,_0x584bd0){var _0x1dfb18=function(_0x2d6bc0){while(--_0x2d6bc0){_0xc0c214['push'](_0xc0c214['shift']());}};_0x1dfb18(++_0x584bd0);}(_0x342a,0xf1));var _0xa342=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x342a[_0x4d8ed9];return _0x1e2140;};'use strict';var FaxQueueEvents=require(_0xa342('0x0'));var events=['save',_0xa342('0x1'),'update'];function createListener(_0x54abb0,_0x2513d8){return function(_0x550c8a){_0x2513d8[_0xa342('0x2')](_0x54abb0,_0x550c8a);};}function removeListener(_0x5956b1,_0x9b6b4c){return function(){FaxQueueEvents['removeListener'](_0x5956b1,_0x9b6b4c);};}exports[_0xa342('0x3')]=function(_0x6c4abb){for(var _0x27199e=0x0,_0x4f3ce1=events[_0xa342('0x4')];_0x27199e<_0x4f3ce1;_0x27199e++){var _0x53cea6=events[_0x27199e];var _0xcbd3ef=createListener(_0xa342('0x5')+_0x53cea6,_0x6c4abb);FaxQueueEvents['on'](_0x53cea6,_0xcbd3ef);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 28df21e..b272311 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xb10b,0x12a));var _0xbb10=function(_0xdbf8f2,_0x409a32){_0xdbf8f2=_0xdbf8f2-0x0;var _0x4ed5d2=_0xb10b[_0xdbf8f2];return _0x4ed5d2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xb10b,0x12a));var _0xbb10=function(_0x255caf,_0x2f893b){_0x255caf=_0x255caf-0x0;var _0x25e862=_0xb10b[_0x255caf];return _0x25e862;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 8ba33ea..77df299 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 _0x9d46=['DATE','moment','sequelize','STRING'];(function(_0x57a4e2,_0x5c4a5d){var _0x404379=function(_0x1f82d9){while(--_0x1f82d9){_0x57a4e2['push'](_0x57a4e2['shift']());}};_0x404379(++_0x5c4a5d);}(_0x9d46,0x105));var _0x69d4=function(_0x3f18dc,_0x1bbb87){_0x3f18dc=_0x3f18dc-0x0;var _0x180236=_0x9d46[_0x3f18dc];return _0x180236;};'use strict';var moment=require(_0x69d4('0x0'));var Sequelize=require(_0x69d4('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x69d4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x69d4('0x3')]},'leaveAt':{'type':Sequelize[_0x69d4('0x3')]},'acceptAt':{'type':Sequelize[_0x69d4('0x3')]},'exitAt':{'type':Sequelize[_0x69d4('0x3')]},'reason':{'type':Sequelize[_0x69d4('0x2')]}}; \ No newline at end of file +var _0x2a79=['DATE','moment','sequelize','exports','STRING'];(function(_0x323a7b,_0x3840c7){var _0x3391e6=function(_0x993cea){while(--_0x993cea){_0x323a7b['push'](_0x323a7b['shift']());}};_0x3391e6(++_0x3840c7);}(_0x2a79,0xec));var _0x92a7=function(_0x59da7d,_0x5be377){_0x59da7d=_0x59da7d-0x0;var _0xd0eefe=_0x2a79[_0x59da7d];return _0xd0eefe;};'use strict';var moment=require(_0x92a7('0x0'));var Sequelize=require(_0x92a7('0x1'));module[_0x92a7('0x2')]={'uniqueid':{'type':Sequelize[_0x92a7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x92a7('0x3')]},'joinAt':{'type':Sequelize[_0x92a7('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x92a7('0x4')]},'exitAt':{'type':Sequelize[_0x92a7('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 ab33986..d840e27 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 _0x2a07=['update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','map','type','key','VIRTUAL','field','options','includeAll','rows','catch','show','params','merge','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x48c1bc,_0xb8641f){var _0x26dfa8=function(_0x174e1e){while(--_0x174e1e){_0x48c1bc['push'](_0x48c1bc['shift']());}};_0x26dfa8(++_0xb8641f);}(_0x2a07,0x74));var _0x72a0=function(_0x4d7988,_0x4c62e3){_0x4d7988=_0x4d7988-0x0;var _0x97e287=_0x2a07[_0x4d7988];return _0x97e287;};'use strict';var pdf=require(_0x72a0('0x0'));var emlformat=require(_0x72a0('0x1'));var rimraf=require(_0x72a0('0x2'));var zipdir=require(_0x72a0('0x3'));var jsonpatch=require(_0x72a0('0x4'));var rp=require('request-promise');var moment=require(_0x72a0('0x5'));var BPromise=require(_0x72a0('0x6'));var Mustache=require(_0x72a0('0x7'));var util=require(_0x72a0('0x8'));var path=require(_0x72a0('0x9'));var sox=require(_0x72a0('0xa'));var csv=require(_0x72a0('0xb'));var ejs=require(_0x72a0('0xc'));var fs=require('fs');var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xb'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72a0('0x16'))(_0x72a0('0x17'));var utils=require(_0x72a0('0x18'));var config=require(_0x72a0('0x19'));var db=require(_0x72a0('0x1a'))['db'];function respondWithStatusCode(_0x516c08,_0x130797){_0x130797=_0x130797||0xcc;return function(_0x335b9f){if(_0x335b9f){return _0x516c08[_0x72a0('0x1b')](_0x130797);}return _0x516c08[_0x72a0('0x1c')](_0x130797)[_0x72a0('0x1d')]();};}function respondWithResult(_0x324cbd,_0xe73b5e){_0xe73b5e=_0xe73b5e||0xc8;return function(_0x5e0b5f){if(_0x5e0b5f){return _0x324cbd['status'](_0xe73b5e)[_0x72a0('0x1e')](_0x5e0b5f);}};}function respondWithFilteredResult(_0x3cd89f,_0x19eaf9){return function(_0x1d1133){if(_0x1d1133){var _0x23b001=_0x1d1133[_0x72a0('0x1f')],_0x3f3d62=_0x19eaf9[_0x72a0('0x20')],_0x4ab55e=_0x19eaf9[_0x72a0('0x20')]+_0x19eaf9[_0x72a0('0x21')],_0x30248e;if(_0x4ab55e>=_0x23b001){_0x4ab55e=_0x23b001;_0x30248e=0xc8;}else{_0x30248e=0xce;}_0x3cd89f['status'](_0x30248e);return _0x3cd89f[_0x72a0('0x22')](_0x72a0('0x23'),_0x3f3d62+'-'+_0x4ab55e+'/'+_0x23b001)[_0x72a0('0x1e')](_0x1d1133);}return null;};}function patchUpdates(_0x5b63c8){return function(_0x144bfc){try{jsonpatch[_0x72a0('0x24')](_0x144bfc,_0x5b63c8,!![]);}catch(_0x30899b){return BPromise[_0x72a0('0x25')](_0x30899b);}return _0x144bfc['save']();};}function saveUpdates(_0x3bc78b,_0x5b8f2c){return function(_0x3d0607){if(_0x3d0607){return _0x3d0607[_0x72a0('0x26')](_0x3bc78b)[_0x72a0('0x27')](function(_0x5c7479){return _0x5c7479;});}return null;};}function removeEntity(_0x35da77,_0x1849d1){return function(_0x1d22d8){if(_0x1d22d8){return _0x1d22d8[_0x72a0('0x28')]()['then'](function(){_0x35da77[_0x72a0('0x1c')](0xcc)[_0x72a0('0x1d')]();});}};}function handleEntityNotFound(_0x1ddd54,_0x23b918){return function(_0x3022b0){if(!_0x3022b0){_0x1ddd54[_0x72a0('0x1b')](0x194);}return _0x3022b0;};}function handleError(_0x5c4daf,_0x4dd1a6){_0x4dd1a6=_0x4dd1a6||0x1f4;return function(_0x468d66){logger[_0x72a0('0x29')](_0x468d66[_0x72a0('0x2a')]);if(_0x468d66[_0x72a0('0x2b')]){delete _0x468d66[_0x72a0('0x2b')];}_0x5c4daf[_0x72a0('0x1c')](_0x4dd1a6)[_0x72a0('0x2c')](_0x468d66);};}exports[_0x72a0('0x2d')]=function(_0xee99e2,_0x12dcc9){var _0x4f9718={},_0x304b92={},_0x553641={'count':0x0,'rows':[]};var _0xc22d18=db[_0x72a0('0x2e')][_0x72a0('0x2f')];_0x304b92[_0x72a0('0x30')]=_[_0x72a0('0x31')](_0xc22d18);_0x304b92[_0x72a0('0x32')]=_[_0x72a0('0x31')](_0xee99e2[_0x72a0('0x32')]);_0x304b92['filters']=_[_0x72a0('0x33')](_0x304b92[_0x72a0('0x30')],_0x304b92[_0x72a0('0x32')]);_0x4f9718[_0x72a0('0x34')]=_[_0x72a0('0x33')](_0x304b92[_0x72a0('0x30')],qs[_0x72a0('0x35')](_0xee99e2['query'][_0x72a0('0x35')]));_0x4f9718[_0x72a0('0x34')]=_0x4f9718[_0x72a0('0x34')][_0x72a0('0x36')]?_0x4f9718[_0x72a0('0x34')]:_0x304b92[_0x72a0('0x30')];if(!_0xee99e2[_0x72a0('0x32')][_0x72a0('0x37')]('nolimit')){_0x4f9718[_0x72a0('0x21')]=qs[_0x72a0('0x21')](_0xee99e2[_0x72a0('0x32')]['limit']);_0x4f9718[_0x72a0('0x20')]=qs['offset'](_0xee99e2[_0x72a0('0x32')][_0x72a0('0x20')]);}_0x4f9718[_0x72a0('0x38')]=qs[_0x72a0('0x39')](_0xee99e2[_0x72a0('0x32')][_0x72a0('0x39')]);_0x4f9718[_0x72a0('0x3a')]=qs[_0x72a0('0x3b')](_[_0x72a0('0x3c')](_0xee99e2[_0x72a0('0x32')],_0x304b92[_0x72a0('0x3b')]));if(_0xee99e2[_0x72a0('0x32')]['filter']){_0x4f9718[_0x72a0('0x3a')]=_['merge'](_0x4f9718[_0x72a0('0x3a')],{'$or':_[_0x72a0('0x3d')](_0xc22d18,function(_0x446222){if(_0x446222[_0x72a0('0x3e')][_0x72a0('0x3f')]!==_0x72a0('0x40')){var _0x90b437={};_0x90b437[_0x446222[_0x72a0('0x41')]]={'$like':'%'+_0xee99e2[_0x72a0('0x32')]['filter']+'%'};return _0x90b437;}})});}_0x4f9718=_['merge']({},_0x4f9718,_0xee99e2[_0x72a0('0x42')]);var _0x1d9403={'where':_0x4f9718[_0x72a0('0x3a')]};return db[_0x72a0('0x2e')][_0x72a0('0x1f')](_0x1d9403)['then'](function(_0x3bdd4e){_0x553641[_0x72a0('0x1f')]=_0x3bdd4e;if(_0xee99e2['query'][_0x72a0('0x43')]){_0x4f9718['include']=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4f9718);})[_0x72a0('0x27')](function(_0x49633b){_0x553641[_0x72a0('0x44')]=_0x49633b;return _0x553641;})[_0x72a0('0x27')](respondWithFilteredResult(_0x12dcc9,_0x4f9718))[_0x72a0('0x45')](handleError(_0x12dcc9,null));};exports[_0x72a0('0x46')]=function(_0x4bf56e,_0x5602cc){var _0x4bb006={'raw':!![],'where':{'id':_0x4bf56e[_0x72a0('0x47')]['id']}},_0x4a32bd={};_0x4a32bd[_0x72a0('0x30')]=_['keys'](db[_0x72a0('0x2e')][_0x72a0('0x2f')]);_0x4a32bd['query']=_[_0x72a0('0x31')](_0x4bf56e[_0x72a0('0x32')]);_0x4a32bd[_0x72a0('0x3b')]=_[_0x72a0('0x33')](_0x4a32bd[_0x72a0('0x30')],_0x4a32bd[_0x72a0('0x32')]);_0x4bb006['attributes']=_[_0x72a0('0x33')](_0x4a32bd['model'],qs[_0x72a0('0x35')](_0x4bf56e['query'][_0x72a0('0x35')]));_0x4bb006[_0x72a0('0x34')]=_0x4bb006['attributes'][_0x72a0('0x36')]?_0x4bb006['attributes']:_0x4a32bd[_0x72a0('0x30')];if(_0x4bf56e[_0x72a0('0x32')][_0x72a0('0x43')]){_0x4bb006['include']=[{'all':!![]}];}_0x4bb006=_[_0x72a0('0x48')]({},_0x4bb006,_0x4bf56e[_0x72a0('0x42')]);return db[_0x72a0('0x2e')]['find'](_0x4bb006)['then'](handleEntityNotFound(_0x5602cc,null))[_0x72a0('0x27')](respondWithResult(_0x5602cc,null))['catch'](handleError(_0x5602cc,null));};exports[_0x72a0('0x49')]=function(_0x1436f7,_0x1d2e44){return db[_0x72a0('0x2e')][_0x72a0('0x49')](_0x1436f7[_0x72a0('0x4a')],{})[_0x72a0('0x27')](respondWithResult(_0x1d2e44,0xc9))[_0x72a0('0x45')](handleError(_0x1d2e44,null));};exports[_0x72a0('0x26')]=function(_0x5029ca,_0x4fae3d){if(_0x5029ca[_0x72a0('0x4a')]['id']){delete _0x5029ca[_0x72a0('0x4a')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4b')]({'where':{'id':_0x5029ca[_0x72a0('0x47')]['id']}})[_0x72a0('0x27')](handleEntityNotFound(_0x4fae3d,null))['then'](saveUpdates(_0x5029ca['body'],null))[_0x72a0('0x27')](respondWithResult(_0x4fae3d,null))[_0x72a0('0x45')](handleError(_0x4fae3d,null));};exports[_0x72a0('0x28')]=function(_0x3cab6a,_0x35a6ad){return db[_0x72a0('0x2e')][_0x72a0('0x4b')]({'where':{'id':_0x3cab6a[_0x72a0('0x47')]['id']}})[_0x72a0('0x27')](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x27')](removeEntity(_0x35a6ad,null))['catch'](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4c')]=function(_0x28186f,_0x480d49){return db[_0x72a0('0x2e')][_0x72a0('0x4c')]()['then'](respondWithResult(_0x480d49,null))[_0x72a0('0x45')](handleError(_0x480d49,null));}; \ No newline at end of file +var _0xd943=['body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','sendStatus','error','stack','name','index','FaxQueueReport','rawAttributes','query','filters','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','params','keys','intersection','fields','catch','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd943,0x15d));var _0x3d94=function(_0x24b323,_0x15e297){_0x24b323=_0x24b323-0x0;var _0x368a68=_0xd943[_0x24b323];return _0x368a68;};'use strict';var pdf=require(_0x3d94('0x0'));var emlformat=require(_0x3d94('0x1'));var rimraf=require(_0x3d94('0x2'));var zipdir=require(_0x3d94('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d94('0x4'));var moment=require(_0x3d94('0x5'));var BPromise=require(_0x3d94('0x6'));var Mustache=require(_0x3d94('0x7'));var util=require(_0x3d94('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3d94('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d94('0x10'))(_0x3d94('0x11'));var utils=require('../../config/utils');var config=require(_0x3d94('0x12'));var db=require(_0x3d94('0x13'))['db'];function respondWithStatusCode(_0x203aa0,_0x368825){_0x368825=_0x368825||0xcc;return function(_0x15a392){if(_0x15a392){return _0x203aa0['sendStatus'](_0x368825);}return _0x203aa0[_0x3d94('0x14')](_0x368825)[_0x3d94('0x15')]();};}function respondWithResult(_0x172d0f,_0x4c167c){_0x4c167c=_0x4c167c||0xc8;return function(_0x24e8b9){if(_0x24e8b9){return _0x172d0f[_0x3d94('0x14')](_0x4c167c)[_0x3d94('0x16')](_0x24e8b9);}};}function respondWithFilteredResult(_0x5d9366,_0x14ea5f){return function(_0x340818){if(_0x340818){var _0x292419=_0x340818[_0x3d94('0x17')],_0x34098e=_0x14ea5f[_0x3d94('0x18')],_0xaf939a=_0x14ea5f['offset']+_0x14ea5f[_0x3d94('0x19')],_0xd8efaa;if(_0xaf939a>=_0x292419){_0xaf939a=_0x292419;_0xd8efaa=0xc8;}else{_0xd8efaa=0xce;}_0x5d9366[_0x3d94('0x14')](_0xd8efaa);return _0x5d9366[_0x3d94('0x1a')](_0x3d94('0x1b'),_0x34098e+'-'+_0xaf939a+'/'+_0x292419)[_0x3d94('0x16')](_0x340818);}return null;};}function patchUpdates(_0x3ca0e3){return function(_0xef8b3){try{jsonpatch['apply'](_0xef8b3,_0x3ca0e3,!![]);}catch(_0x9bca24){return BPromise['reject'](_0x9bca24);}return _0xef8b3[_0x3d94('0x1c')]();};}function saveUpdates(_0x193934,_0x16a6d0){return function(_0x1e9ec2){if(_0x1e9ec2){return _0x1e9ec2[_0x3d94('0x1d')](_0x193934)['then'](function(_0x578002){return _0x578002;});}return null;};}function removeEntity(_0x1406e9,_0x269491){return function(_0x9c2f2c){if(_0x9c2f2c){return _0x9c2f2c['destroy']()[_0x3d94('0x1e')](function(){_0x1406e9[_0x3d94('0x14')](0xcc)[_0x3d94('0x15')]();});}};}function handleEntityNotFound(_0x384f76,_0x395133){return function(_0x4093a4){if(!_0x4093a4){_0x384f76[_0x3d94('0x1f')](0x194);}return _0x4093a4;};}function handleError(_0x27f978,_0xee7b8d){_0xee7b8d=_0xee7b8d||0x1f4;return function(_0x18f58c){logger[_0x3d94('0x20')](_0x18f58c[_0x3d94('0x21')]);if(_0x18f58c[_0x3d94('0x22')]){delete _0x18f58c[_0x3d94('0x22')];}_0x27f978[_0x3d94('0x14')](_0xee7b8d)['send'](_0x18f58c);};}exports[_0x3d94('0x23')]=function(_0x558fd2,_0x28a698){var _0x1d0a7a={},_0xc2885={},_0x439173={'count':0x0,'rows':[]};var _0x13254f=db[_0x3d94('0x24')][_0x3d94('0x25')];_0xc2885['model']=_['keys'](_0x13254f);_0xc2885[_0x3d94('0x26')]=_['keys'](_0x558fd2['query']);_0xc2885[_0x3d94('0x27')]=_['intersection'](_0xc2885[_0x3d94('0x28')],_0xc2885[_0x3d94('0x26')]);_0x1d0a7a[_0x3d94('0x29')]=_['intersection'](_0xc2885[_0x3d94('0x28')],qs['fields'](_0x558fd2[_0x3d94('0x26')]['fields']));_0x1d0a7a[_0x3d94('0x29')]=_0x1d0a7a[_0x3d94('0x29')][_0x3d94('0x2a')]?_0x1d0a7a[_0x3d94('0x29')]:_0xc2885['model'];if(!_0x558fd2[_0x3d94('0x26')]['hasOwnProperty'](_0x3d94('0x2b'))){_0x1d0a7a[_0x3d94('0x19')]=qs['limit'](_0x558fd2['query'][_0x3d94('0x19')]);_0x1d0a7a[_0x3d94('0x18')]=qs[_0x3d94('0x18')](_0x558fd2['query'][_0x3d94('0x18')]);}_0x1d0a7a[_0x3d94('0x2c')]=qs['sort'](_0x558fd2[_0x3d94('0x26')][_0x3d94('0x2d')]);_0x1d0a7a[_0x3d94('0x2e')]=qs[_0x3d94('0x27')](_[_0x3d94('0x2f')](_0x558fd2['query'],_0xc2885[_0x3d94('0x27')]));if(_0x558fd2[_0x3d94('0x26')][_0x3d94('0x30')]){_0x1d0a7a[_0x3d94('0x2e')]=_[_0x3d94('0x31')](_0x1d0a7a[_0x3d94('0x2e')],{'$or':_['map'](_0x13254f,function(_0x555ec5){if(_0x555ec5[_0x3d94('0x32')][_0x3d94('0x33')]!==_0x3d94('0x34')){var _0x438ba3={};_0x438ba3[_0x555ec5[_0x3d94('0x35')]]={'$like':'%'+_0x558fd2[_0x3d94('0x26')][_0x3d94('0x30')]+'%'};return _0x438ba3;}})});}_0x1d0a7a=_[_0x3d94('0x31')]({},_0x1d0a7a,_0x558fd2[_0x3d94('0x36')]);var _0x2235f9={'where':_0x1d0a7a['where']};return db[_0x3d94('0x24')][_0x3d94('0x17')](_0x2235f9)[_0x3d94('0x1e')](function(_0xcc289a){_0x439173['count']=_0xcc289a;if(_0x558fd2[_0x3d94('0x26')][_0x3d94('0x37')]){_0x1d0a7a[_0x3d94('0x38')]=[{'all':!![]}];}return db[_0x3d94('0x24')][_0x3d94('0x39')](_0x1d0a7a);})['then'](function(_0x217e5e){_0x439173[_0x3d94('0x3a')]=_0x217e5e;return _0x439173;})[_0x3d94('0x1e')](respondWithFilteredResult(_0x28a698,_0x1d0a7a))['catch'](handleError(_0x28a698,null));};exports['show']=function(_0x4d8a8f,_0x47905e){var _0x3b3550={'raw':!![],'where':{'id':_0x4d8a8f[_0x3d94('0x3b')]['id']}},_0x22f52c={};_0x22f52c[_0x3d94('0x28')]=_[_0x3d94('0x3c')](db[_0x3d94('0x24')][_0x3d94('0x25')]);_0x22f52c['query']=_['keys'](_0x4d8a8f[_0x3d94('0x26')]);_0x22f52c[_0x3d94('0x27')]=_['intersection'](_0x22f52c[_0x3d94('0x28')],_0x22f52c['query']);_0x3b3550[_0x3d94('0x29')]=_[_0x3d94('0x3d')](_0x22f52c[_0x3d94('0x28')],qs[_0x3d94('0x3e')](_0x4d8a8f[_0x3d94('0x26')]['fields']));_0x3b3550[_0x3d94('0x29')]=_0x3b3550[_0x3d94('0x29')][_0x3d94('0x2a')]?_0x3b3550['attributes']:_0x22f52c[_0x3d94('0x28')];if(_0x4d8a8f['query']['includeAll']){_0x3b3550[_0x3d94('0x38')]=[{'all':!![]}];}_0x3b3550=_[_0x3d94('0x31')]({},_0x3b3550,_0x4d8a8f[_0x3d94('0x36')]);return db[_0x3d94('0x24')]['find'](_0x3b3550)[_0x3d94('0x1e')](handleEntityNotFound(_0x47905e,null))['then'](respondWithResult(_0x47905e,null))[_0x3d94('0x3f')](handleError(_0x47905e,null));};exports[_0x3d94('0x40')]=function(_0x35c911,_0x15c8e7){return db[_0x3d94('0x24')][_0x3d94('0x40')](_0x35c911[_0x3d94('0x41')],{})['then'](respondWithResult(_0x15c8e7,0xc9))[_0x3d94('0x3f')](handleError(_0x15c8e7,null));};exports[_0x3d94('0x1d')]=function(_0x52c82b,_0x53e611){if(_0x52c82b[_0x3d94('0x41')]['id']){delete _0x52c82b[_0x3d94('0x41')]['id'];}return db['FaxQueueReport'][_0x3d94('0x42')]({'where':{'id':_0x52c82b[_0x3d94('0x3b')]['id']}})[_0x3d94('0x1e')](handleEntityNotFound(_0x53e611,null))[_0x3d94('0x1e')](saveUpdates(_0x52c82b[_0x3d94('0x41')],null))[_0x3d94('0x1e')](respondWithResult(_0x53e611,null))[_0x3d94('0x3f')](handleError(_0x53e611,null));};exports[_0x3d94('0x43')]=function(_0x60279f,_0x2429bc){return db[_0x3d94('0x24')][_0x3d94('0x42')]({'where':{'id':_0x60279f[_0x3d94('0x3b')]['id']}})[_0x3d94('0x1e')](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x1e')](removeEntity(_0x2429bc,null))['catch'](handleError(_0x2429bc,null));};exports[_0x3d94('0x44')]=function(_0x22e2b8,_0x1a9338){return db[_0x3d94('0x24')][_0x3d94('0x44')]()[_0x3d94('0x1e')](respondWithResult(_0x1a9338,null))[_0x3d94('0x3f')](handleError(_0x1a9338,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1bdf41b..95237cf 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 _0x192e=['FaxQueueReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x192e,0xb6));var _0xe192=function(_0xde2bbc,_0x328cfb){_0xde2bbc=_0xde2bbc-0x0;var _0x332d95=_0x192e[_0xde2bbc];return _0x332d95;};'use strict';var _=require(_0xe192('0x0'));var util=require('util');var logger=require(_0xe192('0x1'))('api');var moment=require(_0xe192('0x2'));var BPromise=require(_0xe192('0x3'));var rp=require(_0xe192('0x4'));var fs=require('fs');var path=require(_0xe192('0x5'));var rimraf=require('rimraf');var config=require(_0xe192('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0xe192('0x7')]=function(_0x52649f,_0x593d55){return _0x52649f['define'](_0xe192('0x8'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe192('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6225=['../../config/logger','api','moment','request-promise','path','../../config/environment','./faxQueueReport.attributes','report_fax_queue','uniqueid','lodash'];(function(_0x498a86,_0x27d3fb){var _0x16a89e=function(_0x1c2940){while(--_0x1c2940){_0x498a86['push'](_0x498a86['shift']());}};_0x16a89e(++_0x27d3fb);}(_0x6225,0x1df));var _0x5622=function(_0x3cb260,_0x329d33){_0x3cb260=_0x3cb260-0x0;var _0xa99a90=_0x6225[_0x3cb260];return _0xa99a90;};'use strict';var _=require(_0x5622('0x0'));var util=require('util');var logger=require(_0x5622('0x1'))(_0x5622('0x2'));var moment=require(_0x5622('0x3'));var BPromise=require('bluebird');var rp=require(_0x5622('0x4'));var fs=require('fs');var path=require(_0x5622('0x5'));var rimraf=require('rimraf');var config=require(_0x5622('0x6'));var attributes=require(_0x5622('0x7'));module['exports']=function(_0x34d9a4,_0x20d907){return _0x34d9a4['define']('FaxQueueReport',attributes,{'tableName':_0x5622('0x8'),'paranoid':![],'indexes':[{'name':_0x5622('0x9'),'fields':[_0x5622('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index eb4c60b..714705f 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 _0x9cdc=['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','FaxQueueReport','body','options','raw','stringify','UpdateFaxQueueReport','update','attributes','limit','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x13524d,_0x505b49){var _0x9918b4=function(_0xef1f0a){while(--_0xef1f0a){_0x13524d['push'](_0x13524d['shift']());}};_0x9918b4(++_0x505b49);}(_0x9cdc,0x74));var _0xc9cd=function(_0x3b100b,_0x27785a){_0x3b100b=_0x3b100b-0x0;var _0x5aa1cb=_0x9cdc[_0x3b100b];return _0x5aa1cb;};'use strict';var _=require(_0xc9cd('0x0'));var util=require(_0xc9cd('0x1'));var moment=require('moment');var BPromise=require(_0xc9cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9cd('0x3'))['db'];var utils=require(_0xc9cd('0x4'));var logger=require(_0xc9cd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9cd('0x6'));var client=jayson[_0xc9cd('0x7')][_0xc9cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fa691,_0x37816c,_0x4e2486){return new BPromise(function(_0x2a9985,_0x142462){return client[_0xc9cd('0x9')](_0x2fa691,_0x4e2486)[_0xc9cd('0xa')](function(_0x5d76e6){logger[_0xc9cd('0xb')](_0xc9cd('0xc'),_0x37816c,_0xc9cd('0xd'));logger[_0xc9cd('0xe')](_0xc9cd('0xf'),_0x37816c,_0xc9cd('0xd'),JSON['stringify'](_0x5d76e6));if(_0x5d76e6['error']){if(_0x5d76e6[_0xc9cd('0x10')][_0xc9cd('0x11')]===0x1f4){logger[_0xc9cd('0x10')](_0xc9cd('0xc'),_0x37816c,_0x5d76e6['error']['message']);return _0x142462(_0x5d76e6[_0xc9cd('0x10')]['message']);}logger[_0xc9cd('0x10')](_0xc9cd('0xc'),_0x37816c,_0x5d76e6['error'][_0xc9cd('0x12')]);return _0x2a9985(_0x5d76e6['error'][_0xc9cd('0x12')]);}else{logger[_0xc9cd('0xb')](_0xc9cd('0xc'),_0x37816c,_0xc9cd('0xd'));_0x2a9985(_0x5d76e6[_0xc9cd('0x13')][_0xc9cd('0x12')]);}})[_0xc9cd('0x14')](function(_0x852bd8){logger[_0xc9cd('0x10')](_0xc9cd('0xc'),_0x37816c,_0x852bd8);_0x142462(_0x852bd8);});});}exports[_0xc9cd('0x15')]=function(_0x46550b){var _0x3a4a59=this;return new Promise(function(_0x21a38b,_0x5c7ac2){return db[_0xc9cd('0x16')]['create'](_0x46550b[_0xc9cd('0x17')],{'raw':_0x46550b[_0xc9cd('0x18')]?_0x46550b[_0xc9cd('0x18')][_0xc9cd('0x19')]===undefined?!![]:![]:!![]})[_0xc9cd('0xa')](function(_0x88f962){logger[_0xc9cd('0xb')](_0xc9cd('0x15'),_0x46550b);logger[_0xc9cd('0xe')]('CreateFaxQueueReport',_0x46550b,JSON[_0xc9cd('0x1a')](_0x88f962));_0x21a38b(_0x88f962);})[_0xc9cd('0x14')](function(_0x2b1bd6){logger[_0xc9cd('0x10')](_0xc9cd('0x15'),_0x2b1bd6[_0xc9cd('0x12')],_0x46550b);_0x5c7ac2(_0x3a4a59['error'](0x1f4,_0x2b1bd6['message']));});});};exports[_0xc9cd('0x1b')]=function(_0x1f0d1b){var _0x1d25bd=this;return new Promise(function(_0x241f72,_0x3e04b4){return db[_0xc9cd('0x16')][_0xc9cd('0x1c')](_0x1f0d1b['body'],{'raw':_0x1f0d1b[_0xc9cd('0x18')]?_0x1f0d1b[_0xc9cd('0x18')][_0xc9cd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0d1b[_0xc9cd('0x18')]?_0x1f0d1b['options']['where']||null:null,'attributes':_0x1f0d1b['options']?_0x1f0d1b[_0xc9cd('0x18')][_0xc9cd('0x1d')]||null:null,'limit':_0x1f0d1b[_0xc9cd('0x18')]?_0x1f0d1b[_0xc9cd('0x18')][_0xc9cd('0x1e')]||null:null})[_0xc9cd('0xa')](function(_0x2e0412){logger[_0xc9cd('0xb')](_0xc9cd('0x1b'),_0x1f0d1b);logger[_0xc9cd('0xe')](_0xc9cd('0x1b'),_0x1f0d1b,JSON[_0xc9cd('0x1a')](_0x2e0412));_0x241f72(_0x2e0412);})['catch'](function(_0x4070c9){logger[_0xc9cd('0x10')]('UpdateFaxQueueReport',_0x4070c9[_0xc9cd('0x12')],_0x1f0d1b);_0x3e04b4(_0x1d25bd[_0xc9cd('0x10')](0x1f4,_0x4070c9[_0xc9cd('0x12')]));});});}; \ No newline at end of file +var _0x4043=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateFaxQueueReport','create','body','options','UpdateFaxQueueReport','raw','where','limit','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x4043,0xd4));var _0x3404=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4043[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x3404('0x0'));var moment=require(_0x3404('0x1'));var BPromise=require(_0x3404('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3404('0x3'));var db=require(_0x3404('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3404('0x5'))(_0x3404('0x6'));var config=require(_0x3404('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3404('0x8')][_0x3404('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcef70c,_0x1433c3,_0x4d4d11){return new BPromise(function(_0x4a93f0,_0x53d40d){return client[_0x3404('0xa')](_0xcef70c,_0x4d4d11)[_0x3404('0xb')](function(_0x4501c7){logger[_0x3404('0xc')](_0x3404('0xd'),_0x1433c3,'request\x20sent');logger[_0x3404('0xe')](_0x3404('0xf'),_0x1433c3,'request\x20sent',JSON[_0x3404('0x10')](_0x4501c7));if(_0x4501c7[_0x3404('0x11')]){if(_0x4501c7['error'][_0x3404('0x12')]===0x1f4){logger[_0x3404('0x11')](_0x3404('0xd'),_0x1433c3,_0x4501c7[_0x3404('0x11')][_0x3404('0x13')]);return _0x53d40d(_0x4501c7[_0x3404('0x11')][_0x3404('0x13')]);}logger[_0x3404('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x1433c3,_0x4501c7[_0x3404('0x11')][_0x3404('0x13')]);return _0x4a93f0(_0x4501c7[_0x3404('0x11')][_0x3404('0x13')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1433c3,_0x3404('0x14'));_0x4a93f0(_0x4501c7[_0x3404('0x15')][_0x3404('0x13')]);}})[_0x3404('0x16')](function(_0x511fe6){logger['error'](_0x3404('0xd'),_0x1433c3,_0x511fe6);_0x53d40d(_0x511fe6);});});}exports[_0x3404('0x17')]=function(_0x3d5533){var _0x110f0a=this;return new Promise(function(_0x2da643,_0x16cd81){return db['FaxQueueReport'][_0x3404('0x18')](_0x3d5533[_0x3404('0x19')],{'raw':_0x3d5533[_0x3404('0x1a')]?_0x3d5533['options']['raw']===undefined?!![]:![]:!![]})[_0x3404('0xb')](function(_0x1038eb){logger[_0x3404('0xc')](_0x3404('0x17'),_0x3d5533);logger[_0x3404('0xe')](_0x3404('0x17'),_0x3d5533,JSON[_0x3404('0x10')](_0x1038eb));_0x2da643(_0x1038eb);})['catch'](function(_0xcd42e0){logger[_0x3404('0x11')](_0x3404('0x17'),_0xcd42e0[_0x3404('0x13')],_0x3d5533);_0x16cd81(_0x110f0a['error'](0x1f4,_0xcd42e0[_0x3404('0x13')]));});});};exports[_0x3404('0x1b')]=function(_0x417b71){var _0x5790de=this;return new Promise(function(_0x5281a2,_0x161d8b){return db['FaxQueueReport']['update'](_0x417b71[_0x3404('0x19')],{'raw':_0x417b71[_0x3404('0x1a')]?_0x417b71[_0x3404('0x1a')][_0x3404('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417b71[_0x3404('0x1a')]?_0x417b71[_0x3404('0x1a')][_0x3404('0x1d')]||null:null,'attributes':_0x417b71[_0x3404('0x1a')]?_0x417b71['options']['attributes']||null:null,'limit':_0x417b71[_0x3404('0x1a')]?_0x417b71[_0x3404('0x1a')][_0x3404('0x1e')]||null:null})['then'](function(_0x499387){logger['info'](_0x3404('0x1b'),_0x417b71);logger[_0x3404('0xe')](_0x3404('0x1b'),_0x417b71,JSON[_0x3404('0x10')](_0x499387));_0x5281a2(_0x499387);})[_0x3404('0x16')](function(_0x2f7ee4){logger[_0x3404('0x11')](_0x3404('0x1b'),_0x2f7ee4[_0x3404('0x13')],_0x417b71);_0x161d8b(_0x5790de['error'](0x1f4,_0x2f7ee4[_0x3404('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 3cec7bf..98b7a41 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 _0x5bed=['get','isAuthenticated','index','describe','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x5bed,0xd8));var _0xd5be=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x5bed[_0x5f3f88];return _0xd08119;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd5be('0x0'));var timeout=require(_0xd5be('0x1'));var express=require('express');var router=express[_0xd5be('0x2')]();var auth=require(_0xd5be('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd5be('0x4'));var controller=require('./faxQueueReport.controller');router[_0xd5be('0x5')]('/',auth[_0xd5be('0x6')](),controller[_0xd5be('0x7')]);router[_0xd5be('0x5')]('/describe',auth[_0xd5be('0x6')](),controller[_0xd5be('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd5be('0x9')]('/',auth[_0xd5be('0x6')](),controller[_0xd5be('0xa')]);router[_0xd5be('0xb')](_0xd5be('0xc'),auth['isAuthenticated'](),controller[_0xd5be('0xd')]);router[_0xd5be('0xe')](_0xd5be('0xc'),auth[_0xd5be('0x6')](),controller[_0xd5be('0xf')]);module[_0xd5be('0x10')]=router; \ No newline at end of file +var _0x31da=['show','post','create','put','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x328efe,_0x1eff30){var _0x4686e4=function(_0x541952){while(--_0x541952){_0x328efe['push'](_0x328efe['shift']());}};_0x4686e4(++_0x1eff30);}(_0x31da,0x14a));var _0xa31d=function(_0x1814a0,_0x5cac03){_0x1814a0=_0x1814a0-0x0;var _0x28019e=_0x31da[_0x1814a0];return _0x28019e;};'use strict';var multer=require(_0xa31d('0x0'));var util=require(_0xa31d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa31d('0x2')]();var auth=require(_0xa31d('0x3'));var interaction=require(_0xa31d('0x4'));var config=require('../../config/environment');var controller=require(_0xa31d('0x5'));router[_0xa31d('0x6')]('/',auth[_0xa31d('0x7')](),controller[_0xa31d('0x8')]);router[_0xa31d('0x6')](_0xa31d('0x9'),auth['isAuthenticated'](),controller[_0xa31d('0xa')]);router['get'](_0xa31d('0xb'),auth[_0xa31d('0x7')](),controller[_0xa31d('0xc')]);router[_0xa31d('0xd')]('/',auth[_0xa31d('0x7')](),controller[_0xa31d('0xe')]);router[_0xa31d('0xf')](_0xa31d('0xb'),auth[_0xa31d('0x7')](),controller['update']);router[_0xa31d('0x10')](_0xa31d('0xb'),auth[_0xa31d('0x7')](),controller[_0xa31d('0x11')]);module[_0xa31d('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3831042..56d2a83 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 _0x980b=['exports','STRING','ENUM','account','queue','DATE','NOW','moment'];(function(_0x41598d,_0x2d34ed){var _0x3cb671=function(_0x4b9045){while(--_0x4b9045){_0x41598d['push'](_0x41598d['shift']());}};_0x3cb671(++_0x2d34ed);}(_0x980b,0xb7));var _0xb980=function(_0xd6821d,_0x238bd1){_0xd6821d=_0xd6821d-0x0;var _0x26dc0e=_0x980b[_0xd6821d];return _0x26dc0e;};'use strict';var moment=require(_0xb980('0x0'));var Sequelize=require('sequelize');module[_0xb980('0x1')]={'uniqueid':{'type':Sequelize[_0xb980('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb980('0x3')](_0xb980('0x4'),'agent',_0xb980('0x5')),'allowNull':![],'defaultValue':_0xb980('0x5')},'transferredAt':{'type':Sequelize[_0xb980('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb980('0x7')]}}; \ No newline at end of file +var _0x80f4=['NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x40044c,_0x5b37c7){var _0x5d6177=function(_0x21d06e){while(--_0x21d06e){_0x40044c['push'](_0x40044c['shift']());}};_0x5d6177(++_0x5b37c7);}(_0x80f4,0x1ba));var _0x480f=function(_0x5e57d4,_0x43f851){_0x5e57d4=_0x5e57d4-0x0;var _0x5a8e10=_0x80f4[_0x5e57d4];return _0x5a8e10;};'use strict';var moment=require(_0x480f('0x0'));var Sequelize=require(_0x480f('0x1'));module[_0x480f('0x2')]={'uniqueid':{'type':Sequelize[_0x480f('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x480f('0x4'),_0x480f('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x480f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c4947ad..e40a9a4 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 _0x75a6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','FaxTransferReport','rawAttributes','model','keys','query','intersection','fields','attributes','length','nolimit','limit','order','sort','filters','pick','filter','where','map','key','VIRTUAL','field','merge','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x3845ec,_0x166f89){var _0x5b569d=function(_0x2f669c){while(--_0x2f669c){_0x3845ec['push'](_0x3845ec['shift']());}};_0x5b569d(++_0x166f89);}(_0x75a6,0x11d));var _0x675a=function(_0x565f78,_0x1f9e1e){_0x565f78=_0x565f78-0x0;var _0x17c531=_0x75a6[_0x565f78];return _0x17c531;};'use strict';var pdf=require(_0x675a('0x0'));var emlformat=require(_0x675a('0x1'));var rimraf=require(_0x675a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x675a('0x3'));var rp=require(_0x675a('0x4'));var moment=require(_0x675a('0x5'));var BPromise=require(_0x675a('0x6'));var Mustache=require(_0x675a('0x7'));var util=require(_0x675a('0x8'));var path=require(_0x675a('0x9'));var sox=require(_0x675a('0xa'));var csv=require('to-csv');var ejs=require(_0x675a('0xb'));var fs=require('fs');var _=require(_0x675a('0xc'));var squel=require(_0x675a('0xd'));var crypto=require(_0x675a('0xe'));var jsforce=require(_0x675a('0xf'));var deskjs=require(_0x675a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x675a('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x675a('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x675a('0x13'));var logger=require(_0x675a('0x14'))(_0x675a('0x15'));var utils=require(_0x675a('0x16'));var config=require(_0x675a('0x17'));var db=require(_0x675a('0x18'))['db'];function respondWithStatusCode(_0x1bf9af,_0x247f33){_0x247f33=_0x247f33||0xcc;return function(_0x1c5da3){if(_0x1c5da3){return _0x1bf9af['sendStatus'](_0x247f33);}return _0x1bf9af[_0x675a('0x19')](_0x247f33)[_0x675a('0x1a')]();};}function respondWithResult(_0x4dc48b,_0x483a4d){_0x483a4d=_0x483a4d||0xc8;return function(_0x2151ae){if(_0x2151ae){return _0x4dc48b[_0x675a('0x19')](_0x483a4d)[_0x675a('0x1b')](_0x2151ae);}};}function respondWithFilteredResult(_0x840550,_0x5a74d5){return function(_0x2a473f){if(_0x2a473f){var _0x3d4b34=_0x2a473f['count'],_0x4544e4=_0x5a74d5[_0x675a('0x1c')],_0x2b6d12=_0x5a74d5[_0x675a('0x1c')]+_0x5a74d5['limit'],_0x1bd2f0;if(_0x2b6d12>=_0x3d4b34){_0x2b6d12=_0x3d4b34;_0x1bd2f0=0xc8;}else{_0x1bd2f0=0xce;}_0x840550['status'](_0x1bd2f0);return _0x840550['set'](_0x675a('0x1d'),_0x4544e4+'-'+_0x2b6d12+'/'+_0x3d4b34)[_0x675a('0x1b')](_0x2a473f);}return null;};}function patchUpdates(_0x209623){return function(_0x30a38a){try{jsonpatch[_0x675a('0x1e')](_0x30a38a,_0x209623,!![]);}catch(_0x393258){return BPromise[_0x675a('0x1f')](_0x393258);}return _0x30a38a['save']();};}function saveUpdates(_0x426d30,_0x547be2){return function(_0x5f281b){if(_0x5f281b){return _0x5f281b[_0x675a('0x20')](_0x426d30)['then'](function(_0x54c90a){return _0x54c90a;});}return null;};}function removeEntity(_0xd1535,_0x5a074c){return function(_0x116d74){if(_0x116d74){return _0x116d74[_0x675a('0x21')]()[_0x675a('0x22')](function(){_0xd1535[_0x675a('0x19')](0xcc)[_0x675a('0x1a')]();});}};}function handleEntityNotFound(_0x336708,_0x1bf61f){return function(_0x7821cd){if(!_0x7821cd){_0x336708[_0x675a('0x23')](0x194);}return _0x7821cd;};}function handleError(_0x1e99d5,_0x3f5123){_0x3f5123=_0x3f5123||0x1f4;return function(_0x3c9a1a){logger[_0x675a('0x24')](_0x3c9a1a[_0x675a('0x25')]);if(_0x3c9a1a[_0x675a('0x26')]){delete _0x3c9a1a[_0x675a('0x26')];}_0x1e99d5['status'](_0x3f5123)[_0x675a('0x27')](_0x3c9a1a);};}exports[_0x675a('0x28')]=function(_0x3b4fc9,_0x29f032){var _0x577ebb={},_0x55e796={},_0x4ff09d={'count':0x0,'rows':[]};var _0x2f8899=db[_0x675a('0x29')][_0x675a('0x2a')];_0x55e796[_0x675a('0x2b')]=_[_0x675a('0x2c')](_0x2f8899);_0x55e796[_0x675a('0x2d')]=_['keys'](_0x3b4fc9[_0x675a('0x2d')]);_0x55e796['filters']=_[_0x675a('0x2e')](_0x55e796[_0x675a('0x2b')],_0x55e796[_0x675a('0x2d')]);_0x577ebb['attributes']=_[_0x675a('0x2e')](_0x55e796[_0x675a('0x2b')],qs[_0x675a('0x2f')](_0x3b4fc9[_0x675a('0x2d')][_0x675a('0x2f')]));_0x577ebb[_0x675a('0x30')]=_0x577ebb[_0x675a('0x30')][_0x675a('0x31')]?_0x577ebb[_0x675a('0x30')]:_0x55e796[_0x675a('0x2b')];if(!_0x3b4fc9[_0x675a('0x2d')]['hasOwnProperty'](_0x675a('0x32'))){_0x577ebb['limit']=qs[_0x675a('0x33')](_0x3b4fc9[_0x675a('0x2d')][_0x675a('0x33')]);_0x577ebb[_0x675a('0x1c')]=qs['offset'](_0x3b4fc9[_0x675a('0x2d')][_0x675a('0x1c')]);}_0x577ebb[_0x675a('0x34')]=qs['sort'](_0x3b4fc9[_0x675a('0x2d')][_0x675a('0x35')]);_0x577ebb['where']=qs[_0x675a('0x36')](_[_0x675a('0x37')](_0x3b4fc9[_0x675a('0x2d')],_0x55e796[_0x675a('0x36')]));if(_0x3b4fc9[_0x675a('0x2d')][_0x675a('0x38')]){_0x577ebb[_0x675a('0x39')]=_['merge'](_0x577ebb[_0x675a('0x39')],{'$or':_[_0x675a('0x3a')](_0x2f8899,function(_0x4bf55b){if(_0x4bf55b['type'][_0x675a('0x3b')]!==_0x675a('0x3c')){var _0x48cb8e={};_0x48cb8e[_0x4bf55b[_0x675a('0x3d')]]={'$like':'%'+_0x3b4fc9[_0x675a('0x2d')][_0x675a('0x38')]+'%'};return _0x48cb8e;}})});}_0x577ebb=_[_0x675a('0x3e')]({},_0x577ebb,_0x3b4fc9['options']);var _0x1fac2c={'where':_0x577ebb['where']};return db[_0x675a('0x29')][_0x675a('0x3f')](_0x1fac2c)[_0x675a('0x22')](function(_0x27cec8){_0x4ff09d[_0x675a('0x3f')]=_0x27cec8;if(_0x3b4fc9[_0x675a('0x2d')][_0x675a('0x40')]){_0x577ebb['include']=[{'all':!![]}];}return db[_0x675a('0x29')][_0x675a('0x41')](_0x577ebb);})[_0x675a('0x22')](function(_0x36fb51){_0x4ff09d[_0x675a('0x42')]=_0x36fb51;return _0x4ff09d;})[_0x675a('0x22')](respondWithFilteredResult(_0x29f032,_0x577ebb))[_0x675a('0x43')](handleError(_0x29f032,null));};exports[_0x675a('0x44')]=function(_0x1b3e5d,_0x14fb6a){var _0x171986={'raw':!![],'where':{'id':_0x1b3e5d[_0x675a('0x45')]['id']}},_0x3faf5f={};_0x3faf5f['model']=_[_0x675a('0x2c')](db[_0x675a('0x29')][_0x675a('0x2a')]);_0x3faf5f[_0x675a('0x2d')]=_[_0x675a('0x2c')](_0x1b3e5d[_0x675a('0x2d')]);_0x3faf5f['filters']=_[_0x675a('0x2e')](_0x3faf5f[_0x675a('0x2b')],_0x3faf5f[_0x675a('0x2d')]);_0x171986['attributes']=_[_0x675a('0x2e')](_0x3faf5f[_0x675a('0x2b')],qs[_0x675a('0x2f')](_0x1b3e5d['query'][_0x675a('0x2f')]));_0x171986[_0x675a('0x30')]=_0x171986['attributes'][_0x675a('0x31')]?_0x171986[_0x675a('0x30')]:_0x3faf5f[_0x675a('0x2b')];if(_0x1b3e5d[_0x675a('0x2d')][_0x675a('0x40')]){_0x171986[_0x675a('0x46')]=[{'all':!![]}];}_0x171986=_['merge']({},_0x171986,_0x1b3e5d[_0x675a('0x47')]);return db['FaxTransferReport'][_0x675a('0x48')](_0x171986)['then'](handleEntityNotFound(_0x14fb6a,null))[_0x675a('0x22')](respondWithResult(_0x14fb6a,null))[_0x675a('0x43')](handleError(_0x14fb6a,null));};exports['create']=function(_0x118182,_0x4d1b2c){return db['FaxTransferReport'][_0x675a('0x49')](_0x118182['body'],{})[_0x675a('0x22')](respondWithResult(_0x4d1b2c,0xc9))['catch'](handleError(_0x4d1b2c,null));};exports['update']=function(_0x293d58,_0x4be152){if(_0x293d58[_0x675a('0x4a')]['id']){delete _0x293d58['body']['id'];}return db[_0x675a('0x29')][_0x675a('0x48')]({'where':{'id':_0x293d58[_0x675a('0x45')]['id']}})[_0x675a('0x22')](handleEntityNotFound(_0x4be152,null))['then'](saveUpdates(_0x293d58[_0x675a('0x4a')],null))[_0x675a('0x22')](respondWithResult(_0x4be152,null))[_0x675a('0x43')](handleError(_0x4be152,null));};exports[_0x675a('0x21')]=function(_0x2856e2,_0x44f2f8){return db['FaxTransferReport']['find']({'where':{'id':_0x2856e2[_0x675a('0x45')]['id']}})[_0x675a('0x22')](handleEntityNotFound(_0x44f2f8,null))['then'](removeEntity(_0x44f2f8,null))[_0x675a('0x43')](handleError(_0x44f2f8,null));};exports['describe']=function(_0x386b4e,_0x3f78ac){return db[_0x675a('0x29')][_0x675a('0x4b')]()[_0x675a('0x22')](respondWithResult(_0x3f78ac,null))[_0x675a('0x43')](handleError(_0x3f78ac,null));}; \ No newline at end of file +var _0x684b=['bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','FaxTransferReport','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','key','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment'];(function(_0x19f137,_0x69a6c5){var _0x13021f=function(_0x53e2c5){while(--_0x53e2c5){_0x19f137['push'](_0x19f137['shift']());}};_0x13021f(++_0x69a6c5);}(_0x684b,0x1a5));var _0xb684=function(_0x3bd518,_0x27d31e){_0x3bd518=_0x3bd518-0x0;var _0x7ac905=_0x684b[_0x3bd518];return _0x7ac905;};'use strict';var pdf=require(_0xb684('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb684('0x1'));var zipdir=require(_0xb684('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb684('0x3'));var moment=require(_0xb684('0x4'));var BPromise=require(_0xb684('0x5'));var Mustache=require(_0xb684('0x6'));var util=require('util');var path=require(_0xb684('0x7'));var sox=require('sox');var csv=require(_0xb684('0x8'));var ejs=require(_0xb684('0x9'));var fs=require('fs');var _=require(_0xb684('0xa'));var squel=require(_0xb684('0xb'));var crypto=require(_0xb684('0xc'));var jsforce=require(_0xb684('0xd'));var deskjs=require(_0xb684('0xe'));var toCsv=require(_0xb684('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xb684('0xf'));var logger=require(_0xb684('0x10'))(_0xb684('0x11'));var utils=require(_0xb684('0x12'));var config=require(_0xb684('0x13'));var db=require(_0xb684('0x14'))['db'];function respondWithStatusCode(_0x2fa605,_0xfd9837){_0xfd9837=_0xfd9837||0xcc;return function(_0x507fec){if(_0x507fec){return _0x2fa605[_0xb684('0x15')](_0xfd9837);}return _0x2fa605['status'](_0xfd9837)[_0xb684('0x16')]();};}function respondWithResult(_0x549236,_0x3828ff){_0x3828ff=_0x3828ff||0xc8;return function(_0x52d397){if(_0x52d397){return _0x549236['status'](_0x3828ff)[_0xb684('0x17')](_0x52d397);}};}function respondWithFilteredResult(_0x3ede39,_0x1fd817){return function(_0x332687){if(_0x332687){var _0x1670c0=_0x332687[_0xb684('0x18')],_0x2f105c=_0x1fd817[_0xb684('0x19')],_0x1cd422=_0x1fd817['offset']+_0x1fd817[_0xb684('0x1a')],_0x194bf7;if(_0x1cd422>=_0x1670c0){_0x1cd422=_0x1670c0;_0x194bf7=0xc8;}else{_0x194bf7=0xce;}_0x3ede39[_0xb684('0x1b')](_0x194bf7);return _0x3ede39['set'](_0xb684('0x1c'),_0x2f105c+'-'+_0x1cd422+'/'+_0x1670c0)['json'](_0x332687);}return null;};}function patchUpdates(_0x190021){return function(_0x534685){try{jsonpatch[_0xb684('0x1d')](_0x534685,_0x190021,!![]);}catch(_0x42bc87){return BPromise[_0xb684('0x1e')](_0x42bc87);}return _0x534685[_0xb684('0x1f')]();};}function saveUpdates(_0x31a345,_0x3e7e40){return function(_0x20e27b){if(_0x20e27b){return _0x20e27b[_0xb684('0x20')](_0x31a345)[_0xb684('0x21')](function(_0x18fa18){return _0x18fa18;});}return null;};}function removeEntity(_0x1ff802,_0x5b94e5){return function(_0x2f6433){if(_0x2f6433){return _0x2f6433['destroy']()['then'](function(){_0x1ff802[_0xb684('0x1b')](0xcc)[_0xb684('0x16')]();});}};}function handleEntityNotFound(_0x7cb2cc,_0x3fde39){return function(_0x4fe185){if(!_0x4fe185){_0x7cb2cc[_0xb684('0x15')](0x194);}return _0x4fe185;};}function handleError(_0x1cf7ae,_0x251cdf){_0x251cdf=_0x251cdf||0x1f4;return function(_0x15c7bc){logger[_0xb684('0x22')](_0x15c7bc[_0xb684('0x23')]);if(_0x15c7bc[_0xb684('0x24')]){delete _0x15c7bc[_0xb684('0x24')];}_0x1cf7ae['status'](_0x251cdf)[_0xb684('0x25')](_0x15c7bc);};}exports[_0xb684('0x26')]=function(_0x25e4d1,_0x11ea2a){var _0x3f0844={},_0x4005e9={},_0x5eb96c={'count':0x0,'rows':[]};var _0x5a32b1=db[_0xb684('0x27')]['rawAttributes'];_0x4005e9[_0xb684('0x28')]=_[_0xb684('0x29')](_0x5a32b1);_0x4005e9[_0xb684('0x2a')]=_[_0xb684('0x29')](_0x25e4d1[_0xb684('0x2a')]);_0x4005e9[_0xb684('0x2b')]=_[_0xb684('0x2c')](_0x4005e9['model'],_0x4005e9[_0xb684('0x2a')]);_0x3f0844[_0xb684('0x2d')]=_[_0xb684('0x2c')](_0x4005e9[_0xb684('0x28')],qs['fields'](_0x25e4d1['query'][_0xb684('0x2e')]));_0x3f0844['attributes']=_0x3f0844['attributes'][_0xb684('0x2f')]?_0x3f0844[_0xb684('0x2d')]:_0x4005e9[_0xb684('0x28')];if(!_0x25e4d1[_0xb684('0x2a')][_0xb684('0x30')](_0xb684('0x31'))){_0x3f0844[_0xb684('0x1a')]=qs[_0xb684('0x1a')](_0x25e4d1[_0xb684('0x2a')][_0xb684('0x1a')]);_0x3f0844[_0xb684('0x19')]=qs[_0xb684('0x19')](_0x25e4d1[_0xb684('0x2a')][_0xb684('0x19')]);}_0x3f0844[_0xb684('0x32')]=qs[_0xb684('0x33')](_0x25e4d1[_0xb684('0x2a')][_0xb684('0x33')]);_0x3f0844['where']=qs[_0xb684('0x2b')](_[_0xb684('0x34')](_0x25e4d1[_0xb684('0x2a')],_0x4005e9['filters']));if(_0x25e4d1['query']['filter']){_0x3f0844[_0xb684('0x35')]=_[_0xb684('0x36')](_0x3f0844[_0xb684('0x35')],{'$or':_['map'](_0x5a32b1,function(_0xfd3c41){if(_0xfd3c41[_0xb684('0x37')][_0xb684('0x38')]!=='VIRTUAL'){var _0x34e623={};_0x34e623[_0xfd3c41['field']]={'$like':'%'+_0x25e4d1[_0xb684('0x2a')][_0xb684('0x39')]+'%'};return _0x34e623;}})});}_0x3f0844=_['merge']({},_0x3f0844,_0x25e4d1[_0xb684('0x3a')]);var _0x1efa71={'where':_0x3f0844['where']};return db[_0xb684('0x27')][_0xb684('0x18')](_0x1efa71)[_0xb684('0x21')](function(_0x5c9010){_0x5eb96c[_0xb684('0x18')]=_0x5c9010;if(_0x25e4d1['query'][_0xb684('0x3b')]){_0x3f0844[_0xb684('0x3c')]=[{'all':!![]}];}return db[_0xb684('0x27')][_0xb684('0x3d')](_0x3f0844);})[_0xb684('0x21')](function(_0x2989fe){_0x5eb96c[_0xb684('0x3e')]=_0x2989fe;return _0x5eb96c;})[_0xb684('0x21')](respondWithFilteredResult(_0x11ea2a,_0x3f0844))[_0xb684('0x3f')](handleError(_0x11ea2a,null));};exports[_0xb684('0x40')]=function(_0x388bf9,_0x4f5037){var _0x5a66d8={'raw':!![],'where':{'id':_0x388bf9['params']['id']}},_0x2253dc={};_0x2253dc['model']=_[_0xb684('0x29')](db[_0xb684('0x27')]['rawAttributes']);_0x2253dc[_0xb684('0x2a')]=_['keys'](_0x388bf9[_0xb684('0x2a')]);_0x2253dc['filters']=_[_0xb684('0x2c')](_0x2253dc['model'],_0x2253dc[_0xb684('0x2a')]);_0x5a66d8['attributes']=_[_0xb684('0x2c')](_0x2253dc[_0xb684('0x28')],qs[_0xb684('0x2e')](_0x388bf9[_0xb684('0x2a')][_0xb684('0x2e')]));_0x5a66d8[_0xb684('0x2d')]=_0x5a66d8[_0xb684('0x2d')]['length']?_0x5a66d8['attributes']:_0x2253dc['model'];if(_0x388bf9[_0xb684('0x2a')][_0xb684('0x3b')]){_0x5a66d8[_0xb684('0x3c')]=[{'all':!![]}];}_0x5a66d8=_[_0xb684('0x36')]({},_0x5a66d8,_0x388bf9[_0xb684('0x3a')]);return db[_0xb684('0x27')][_0xb684('0x41')](_0x5a66d8)[_0xb684('0x21')](handleEntityNotFound(_0x4f5037,null))['then'](respondWithResult(_0x4f5037,null))[_0xb684('0x3f')](handleError(_0x4f5037,null));};exports[_0xb684('0x42')]=function(_0x338c55,_0x1be2d5){return db[_0xb684('0x27')][_0xb684('0x42')](_0x338c55['body'],{})[_0xb684('0x21')](respondWithResult(_0x1be2d5,0xc9))[_0xb684('0x3f')](handleError(_0x1be2d5,null));};exports[_0xb684('0x20')]=function(_0x6e5240,_0x308de5){if(_0x6e5240[_0xb684('0x43')]['id']){delete _0x6e5240[_0xb684('0x43')]['id'];}return db[_0xb684('0x27')][_0xb684('0x41')]({'where':{'id':_0x6e5240[_0xb684('0x44')]['id']}})[_0xb684('0x21')](handleEntityNotFound(_0x308de5,null))['then'](saveUpdates(_0x6e5240[_0xb684('0x43')],null))[_0xb684('0x21')](respondWithResult(_0x308de5,null))[_0xb684('0x3f')](handleError(_0x308de5,null));};exports[_0xb684('0x45')]=function(_0x5a349b,_0x17381a){return db[_0xb684('0x27')][_0xb684('0x41')]({'where':{'id':_0x5a349b[_0xb684('0x44')]['id']}})['then'](handleEntityNotFound(_0x17381a,null))[_0xb684('0x21')](removeEntity(_0x17381a,null))[_0xb684('0x3f')](handleError(_0x17381a,null));};exports[_0xb684('0x46')]=function(_0x23ef3e,_0x1396f9){return db[_0xb684('0x27')][_0xb684('0x46')]()[_0xb684('0x21')](respondWithResult(_0x1396f9,null))['catch'](handleError(_0x1396f9,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index cd26e88..f0884ce 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 _0x30d2=['request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x20cc65,_0x5da109){var _0x353d4f=function(_0x349113){while(--_0x349113){_0x20cc65['push'](_0x20cc65['shift']());}};_0x353d4f(++_0x5da109);}(_0x30d2,0xcd));var _0x230d=function(_0x30853f,_0x4aa320){_0x30853f=_0x30853f-0x0;var _0x3c416d=_0x30d2[_0x30853f];return _0x3c416d;};'use strict';var _=require(_0x230d('0x0'));var util=require('util');var logger=require(_0x230d('0x1'))(_0x230d('0x2'));var moment=require(_0x230d('0x3'));var BPromise=require(_0x230d('0x4'));var rp=require(_0x230d('0x5'));var fs=require('fs');var path=require(_0x230d('0x6'));var rimraf=require(_0x230d('0x7'));var config=require('../../config/environment');var attributes=require(_0x230d('0x8'));module[_0x230d('0x9')]=function(_0x4ef314,_0x16f4fa){return _0x4ef314[_0x230d('0xa')](_0x230d('0xb'),attributes,{'tableName':_0x230d('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x230d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d28=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','api'];(function(_0x35d879,_0x517820){var _0x32530f=function(_0x599daa){while(--_0x599daa){_0x35d879['push'](_0x35d879['shift']());}};_0x32530f(++_0x517820);}(_0x7d28,0x73));var _0x87d2=function(_0x13a967,_0x3a6775){_0x13a967=_0x13a967-0x0;var _0x407b6c=_0x7d28[_0x13a967];return _0x407b6c;};'use strict';var _=require(_0x87d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x87d2('0x1'));var moment=require(_0x87d2('0x2'));var BPromise=require(_0x87d2('0x3'));var rp=require(_0x87d2('0x4'));var fs=require('fs');var path=require(_0x87d2('0x5'));var rimraf=require(_0x87d2('0x6'));var config=require(_0x87d2('0x7'));var attributes=require(_0x87d2('0x8'));module[_0x87d2('0x9')]=function(_0x1e638b,_0x1d7a66){return _0x1e638b['define'](_0x87d2('0xa'),attributes,{'tableName':_0x87d2('0xb'),'paranoid':![],'indexes':[{'name':_0x87d2('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 19c5188..ea8542d 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 _0x0619=['code','message','FaxTransferReport,\x20%s,\x20%s','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','request\x20sent','debug','stringify','error'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x0619,0x10e));var _0x9061=function(_0x2ea277,_0x52fb82){_0x2ea277=_0x2ea277-0x0;var _0x41ee83=_0x0619[_0x2ea277];return _0x41ee83;};'use strict';var _=require(_0x9061('0x0'));var util=require('util');var moment=require(_0x9061('0x1'));var BPromise=require('bluebird');var rs=require(_0x9061('0x2'));var fs=require('fs');var Redis=require(_0x9061('0x3'));var db=require(_0x9061('0x4'))['db'];var utils=require(_0x9061('0x5'));var logger=require(_0x9061('0x6'))(_0x9061('0x7'));var config=require(_0x9061('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9061('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ef03,_0x5150c2,_0xc79755){return new BPromise(function(_0x1690d0,_0x324efc){return client['request'](_0x30ef03,_0xc79755)['then'](function(_0x3599f9){logger[_0x9061('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x5150c2,_0x9061('0xb'));logger[_0x9061('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5150c2,_0x9061('0xb'),JSON[_0x9061('0xd')](_0x3599f9));if(_0x3599f9['error']){if(_0x3599f9[_0x9061('0xe')][_0x9061('0xf')]===0x1f4){logger[_0x9061('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x5150c2,_0x3599f9[_0x9061('0xe')]['message']);return _0x324efc(_0x3599f9[_0x9061('0xe')][_0x9061('0x10')]);}logger['error'](_0x9061('0x11'),_0x5150c2,_0x3599f9[_0x9061('0xe')]['message']);return _0x1690d0(_0x3599f9['error'][_0x9061('0x10')]);}else{logger[_0x9061('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x5150c2,'request\x20sent');_0x1690d0(_0x3599f9['result'][_0x9061('0x10')]);}})[_0x9061('0x12')](function(_0x20a94a){logger[_0x9061('0xe')](_0x9061('0x11'),_0x5150c2,_0x20a94a);_0x324efc(_0x20a94a);});});} \ No newline at end of file +var _0x7b1d=['code','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4672f2,_0x12a917){var _0x292905=function(_0x40a717){while(--_0x40a717){_0x4672f2['push'](_0x4672f2['shift']());}};_0x292905(++_0x12a917);}(_0x7b1d,0x18f));var _0xd7b1=function(_0x5a9f73,_0x1e60b5){_0x5a9f73=_0x5a9f73-0x0;var _0x57e04b=_0x7b1d[_0x5a9f73];return _0x57e04b;};'use strict';var _=require(_0xd7b1('0x0'));var util=require(_0xd7b1('0x1'));var moment=require(_0xd7b1('0x2'));var BPromise=require(_0xd7b1('0x3'));var rs=require(_0xd7b1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7b1('0x5'))['db'];var utils=require(_0xd7b1('0x6'));var logger=require(_0xd7b1('0x7'))('rpc');var config=require(_0xd7b1('0x8'));var jayson=require(_0xd7b1('0x9'));var client=jayson[_0xd7b1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3920a2,_0x3a87fa,_0x4c6128){return new BPromise(function(_0x12d4fb,_0x539fc2){return client[_0xd7b1('0xb')](_0x3920a2,_0x4c6128)[_0xd7b1('0xc')](function(_0x402ae6){logger['info'](_0xd7b1('0xd'),_0x3a87fa,_0xd7b1('0xe'));logger[_0xd7b1('0xf')](_0xd7b1('0x10'),_0x3a87fa,_0xd7b1('0xe'),JSON[_0xd7b1('0x11')](_0x402ae6));if(_0x402ae6[_0xd7b1('0x12')]){if(_0x402ae6[_0xd7b1('0x12')][_0xd7b1('0x13')]===0x1f4){logger[_0xd7b1('0x12')](_0xd7b1('0xd'),_0x3a87fa,_0x402ae6['error'][_0xd7b1('0x14')]);return _0x539fc2(_0x402ae6[_0xd7b1('0x12')][_0xd7b1('0x14')]);}logger[_0xd7b1('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x3a87fa,_0x402ae6[_0xd7b1('0x12')][_0xd7b1('0x14')]);return _0x12d4fb(_0x402ae6[_0xd7b1('0x12')]['message']);}else{logger[_0xd7b1('0x15')](_0xd7b1('0xd'),_0x3a87fa,'request\x20sent');_0x12d4fb(_0x402ae6['result']['message']);}})['catch'](function(_0x349394){logger['error'](_0xd7b1('0xd'),_0x3a87fa,_0x349394);_0x539fc2(_0x349394);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4a821aa..fb763f8 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 _0x5c36=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy'];(function(_0x44ba69,_0x5f4438){var _0x56966c=function(_0x31ac9f){while(--_0x31ac9f){_0x44ba69['push'](_0x44ba69['shift']());}};_0x56966c(++_0x5f4438);}(_0x5c36,0xd3));var _0x65c3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5c36[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x65c3('0x0'));var util=require(_0x65c3('0x1'));var path=require(_0x65c3('0x2'));var timeout=require(_0x65c3('0x3'));var express=require(_0x65c3('0x4'));var router=express[_0x65c3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x65c3('0x6'));var config=require('../../config/environment');var controller=require(_0x65c3('0x7'));router[_0x65c3('0x8')]('/',auth[_0x65c3('0x9')](),controller['index']);router[_0x65c3('0x8')](_0x65c3('0xa'),auth[_0x65c3('0x9')](),controller[_0x65c3('0xb')]);router['get']('/:id',auth[_0x65c3('0x9')](),controller[_0x65c3('0xc')]);router[_0x65c3('0xd')]('/',auth['isAuthenticated'](),controller[_0x65c3('0xe')]);router[_0x65c3('0xf')](_0x65c3('0x10'),auth[_0x65c3('0x9')](),controller[_0x65c3('0x11')]);router[_0x65c3('0x12')](_0x65c3('0x10'),auth[_0x65c3('0x9')](),controller[_0x65c3('0x13')]);module[_0x65c3('0x14')]=router; \ No newline at end of file +var _0x5e71=['update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','put','/:id'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x5e71,0x1c5));var _0x15e7=function(_0x24c332,_0x375a38){_0x24c332=_0x24c332-0x0;var _0x20c193=_0x5e71[_0x24c332];return _0x20c193;};'use strict';var multer=require(_0x15e7('0x0'));var util=require(_0x15e7('0x1'));var path=require(_0x15e7('0x2'));var timeout=require(_0x15e7('0x3'));var express=require('express');var router=express[_0x15e7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x15e7('0x5'));var config=require(_0x15e7('0x6'));var controller=require('./faxTransferReport.controller');router[_0x15e7('0x7')]('/',auth[_0x15e7('0x8')](),controller['index']);router[_0x15e7('0x7')](_0x15e7('0x9'),auth[_0x15e7('0x8')](),controller[_0x15e7('0xa')]);router['get']('/:id',auth[_0x15e7('0x8')](),controller[_0x15e7('0xb')]);router[_0x15e7('0xc')]('/',auth[_0x15e7('0x8')](),controller['create']);router[_0x15e7('0xd')](_0x15e7('0xe'),auth[_0x15e7('0x8')](),controller[_0x15e7('0xf')]);router[_0x15e7('0x10')]('/:id',auth[_0x15e7('0x8')](),controller[_0x15e7('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e68abb5..65b317c 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 _0x6075=['/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6075,0x191));var _0x5607=function(_0x9cd94,_0x4daa7a){_0x9cd94=_0x9cd94-0x0;var _0x343a0b=_0x6075[_0x9cd94];return _0x343a0b;};'use strict';var multer=require('multer');var util=require(_0x5607('0x0'));var path=require(_0x5607('0x1'));var timeout=require(_0x5607('0x2'));var express=require(_0x5607('0x3'));var router=express[_0x5607('0x4')]();var auth=require(_0x5607('0x5'));var interaction=require(_0x5607('0x6'));var config=require(_0x5607('0x7'));var controller=require(_0x5607('0x8'));router['get']('/',auth[_0x5607('0x9')](),controller[_0x5607('0xa')]);router[_0x5607('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5607('0xc')]);router[_0x5607('0xb')](_0x5607('0xd'),auth[_0x5607('0x9')](),controller[_0x5607('0xe')]);router['get'](_0x5607('0xf'),auth[_0x5607('0x9')](),controller[_0x5607('0x10')]);router['post']('/',auth[_0x5607('0x9')](),controller['create']);router['post'](_0x5607('0xd'),auth[_0x5607('0x9')](),controller[_0x5607('0x11')]);router['put'](_0x5607('0x12'),auth[_0x5607('0x9')](),controller[_0x5607('0x13')]);router[_0x5607('0x14')](_0x5607('0x12'),auth[_0x5607('0x9')](),controller[_0x5607('0x15')]);module[_0x5607('0x16')]=router; \ No newline at end of file +var _0x3c6c=['create','/:id/configurations','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','getConfigurations','/:id/fields','getFields','post'];(function(_0x440978,_0x280e70){var _0x4f4890=function(_0x5c1e36){while(--_0x5c1e36){_0x440978['push'](_0x440978['shift']());}};_0x4f4890(++_0x280e70);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x3471fb,_0x568a78){_0x3471fb=_0x3471fb-0x0;var _0x18a118=_0x3c6c[_0x3471fb];return _0x18a118;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require('util');var path=require(_0xc3c6('0x1'));var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var auth=require(_0xc3c6('0x5'));var interaction=require(_0xc3c6('0x6'));var config=require(_0xc3c6('0x7'));var controller=require(_0xc3c6('0x8'));router['get']('/',auth[_0xc3c6('0x9')](),controller['index']);router[_0xc3c6('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0xc3c6('0x9')](),controller[_0xc3c6('0xb')]);router['get'](_0xc3c6('0xc'),auth[_0xc3c6('0x9')](),controller[_0xc3c6('0xd')]);router[_0xc3c6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xf')]);router[_0xc3c6('0xe')](_0xc3c6('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc3c6('0x11')](_0xc3c6('0x12'),auth[_0xc3c6('0x9')](),controller[_0xc3c6('0x13')]);router[_0xc3c6('0x14')](_0xc3c6('0x12'),auth[_0xc3c6('0x9')](),controller[_0xc3c6('0x15')]);module[_0xc3c6('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 84235f1..1810998 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 _0x6907=['ENUM','basic','integrationTab','newTab','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6907,0x9a));var _0x7690=function(_0x26b5af,_0x38291e){_0x26b5af=_0x26b5af-0x0;var _0x13dad4=_0x6907[_0x26b5af];return _0x13dad4;};'use strict';var Sequelize=require('sequelize');module[_0x7690('0x0')]={'name':{'type':Sequelize[_0x7690('0x1')]},'description':{'type':Sequelize[_0x7690('0x1')]},'username':{'type':Sequelize[_0x7690('0x1')]},'remoteUri':{'type':Sequelize[_0x7690('0x1')]},'authType':{'type':Sequelize[_0x7690('0x2')]('basic'),'defaultValue':_0x7690('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x7690('0x1')]},'consumerSecret':{'type':Sequelize[_0x7690('0x1')]},'token':{'type':Sequelize[_0x7690('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7690('0x1')]},'type':{'type':Sequelize[_0x7690('0x2')](_0x7690('0x4'),_0x7690('0x5')),'defaultValue':_0x7690('0x4')}}; \ No newline at end of file +var _0x3462=['integrationTab','exports','STRING','basic','ENUM'];(function(_0x2ba422,_0x4a60b3){var _0xf16733=function(_0x3e38ac){while(--_0x3e38ac){_0x2ba422['push'](_0x2ba422['shift']());}};_0xf16733(++_0x4a60b3);}(_0x3462,0x1e6));var _0x2346=function(_0x38aab1,_0x508c36){_0x38aab1=_0x38aab1-0x0;var _0x32119f=_0x3462[_0x38aab1];return _0x32119f;};'use strict';var Sequelize=require('sequelize');module[_0x2346('0x0')]={'name':{'type':Sequelize[_0x2346('0x1')]},'description':{'type':Sequelize[_0x2346('0x1')]},'username':{'type':Sequelize[_0x2346('0x1')]},'remoteUri':{'type':Sequelize[_0x2346('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x2346('0x2')},'password':{'type':Sequelize[_0x2346('0x1')]},'consumerKey':{'type':Sequelize[_0x2346('0x1')]},'consumerSecret':{'type':Sequelize[_0x2346('0x1')]},'token':{'type':Sequelize[_0x2346('0x1')]},'tokenSecret':{'type':Sequelize[_0x2346('0x1')]},'serverUrl':{'type':Sequelize[_0x2346('0x1')]},'type':{'type':Sequelize[_0x2346('0x3')](_0x2346('0x4'),'newTab'),'defaultValue':_0x2346('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 0507ebe..1861031 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 _0x53cc=['moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','sendStatus','status','end','count','offset','limit','set','apply','reject','update','destroy','stack','name','send','index','DeskAccount','rawAttributes','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','key','field','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','DeskConfiguration','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','findOne','remoteUri','authType','consumerKey','consumerSecret','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','password','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2253a9,_0x35a00d){var _0x437b1a=function(_0x5c8707){while(--_0x5c8707){_0x2253a9['push'](_0x2253a9['shift']());}};_0x437b1a(++_0x35a00d);}(_0x53cc,0x178));var _0xc53c=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x53cc[_0x1ca4c3];return _0x4426a6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc53c('0x0'));var rimraf=require(_0xc53c('0x1'));var zipdir=require(_0xc53c('0x2'));var jsonpatch=require(_0xc53c('0x3'));var rp=require(_0xc53c('0x4'));var moment=require(_0xc53c('0x5'));var BPromise=require(_0xc53c('0x6'));var Mustache=require(_0xc53c('0x7'));var util=require(_0xc53c('0x8'));var path=require(_0xc53c('0x9'));var sox=require(_0xc53c('0xa'));var csv=require('to-csv');var ejs=require(_0xc53c('0xb'));var fs=require('fs');var _=require(_0xc53c('0xc'));var squel=require(_0xc53c('0xd'));var crypto=require(_0xc53c('0xe'));var jsforce=require(_0xc53c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc53c('0x10'));var querystring=require(_0xc53c('0x11'));var Papa=require(_0xc53c('0x12'));var Redis=require(_0xc53c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc53c('0x14'));var hardwareService=require(_0xc53c('0x15'));var logger=require(_0xc53c('0x16'))(_0xc53c('0x17'));var utils=require(_0xc53c('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xc53c('0x19'));var jayson=require(_0xc53c('0x1a'));var client=jayson[_0xc53c('0x1b')][_0xc53c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x97b58f,_0x30c155,_0x597354){if(_0x597354){var _0x3fc611=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fc611[_0xc53c('0x1d')](_0x30c155)){return _0x97b58f;}else{throw new db[(_0xc53c('0x1e'))]['ValidationError'](_0xc53c('0x1f'));}}else{return _0x97b58f;}}function respondWithRpcPromise(_0x74bcb1,_0x584ea6,_0x2d6d73,_0x1a8998){return new BPromise(function(_0x462cc2,_0x248ba8){var _0x15aa35=_0x1a8998||client;return _0x15aa35[_0xc53c('0x20')](_0x74bcb1,_0x2d6d73)[_0xc53c('0x21')](function(_0x3e484e){logger[_0xc53c('0x22')](_0xc53c('0x23'),_0x584ea6,'request\x20sent');logger[_0xc53c('0x24')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x584ea6,_0xc53c('0x25'),JSON['stringify'](_0x3e484e));if(_0x3e484e[_0xc53c('0x26')]){if(_0x3e484e[_0xc53c('0x26')][_0xc53c('0x27')]===0x1f4){logger[_0xc53c('0x26')]('DeskAccount,\x20%s,\x20%s',_0x584ea6,_0x3e484e[_0xc53c('0x26')][_0xc53c('0x28')]);return _0x248ba8(_0x3e484e[_0xc53c('0x26')][_0xc53c('0x28')]);}logger[_0xc53c('0x26')](_0xc53c('0x23'),_0x584ea6,_0x3e484e[_0xc53c('0x26')][_0xc53c('0x28')]);return _0x462cc2(_0x3e484e[_0xc53c('0x26')][_0xc53c('0x28')]);}else{logger[_0xc53c('0x22')](_0xc53c('0x23'),_0x584ea6,_0xc53c('0x25'));_0x462cc2(_0x3e484e['result'][_0xc53c('0x28')]);}})['catch'](function(_0x1cc39d){logger[_0xc53c('0x26')](_0xc53c('0x23'),_0x584ea6,_0x1cc39d);_0x248ba8(_0x1cc39d);});});}function respondWithStatusCode(_0x3f784e,_0x3aaa95){_0x3aaa95=_0x3aaa95||0xcc;return function(_0xc6997d){if(_0xc6997d){return _0x3f784e[_0xc53c('0x29')](_0x3aaa95);}return _0x3f784e[_0xc53c('0x2a')](_0x3aaa95)[_0xc53c('0x2b')]();};}function respondWithResult(_0x40b3e6,_0x4f4c83){_0x4f4c83=_0x4f4c83||0xc8;return function(_0x1b9e2f){if(_0x1b9e2f){return _0x40b3e6[_0xc53c('0x2a')](_0x4f4c83)['json'](_0x1b9e2f);}};}function respondWithFilteredResult(_0x7024d,_0x3d6b37){return function(_0x3b170a){if(_0x3b170a){var _0x3b18d5=_0x3b170a[_0xc53c('0x2c')],_0x4a86bc=_0x3d6b37[_0xc53c('0x2d')],_0x49a79e=_0x3d6b37[_0xc53c('0x2d')]+_0x3d6b37[_0xc53c('0x2e')],_0xefe385;if(_0x49a79e>=_0x3b18d5){_0x49a79e=_0x3b18d5;_0xefe385=0xc8;}else{_0xefe385=0xce;}_0x7024d[_0xc53c('0x2a')](_0xefe385);return _0x7024d[_0xc53c('0x2f')]('Content-Range',_0x4a86bc+'-'+_0x49a79e+'/'+_0x3b18d5)['json'](_0x3b170a);}return null;};}function patchUpdates(_0x2f05df){return function(_0x167e9b){try{jsonpatch[_0xc53c('0x30')](_0x167e9b,_0x2f05df,!![]);}catch(_0x3db961){return BPromise[_0xc53c('0x31')](_0x3db961);}return _0x167e9b['save']();};}function saveUpdates(_0x2a2940,_0x198a51){return function(_0x234697){if(_0x234697){return _0x234697[_0xc53c('0x32')](_0x2a2940)[_0xc53c('0x21')](function(_0x49f812){return _0x49f812;});}return null;};}function removeEntity(_0x4771bb,_0x55e800){return function(_0x5b8431){if(_0x5b8431){return _0x5b8431[_0xc53c('0x33')]()['then'](function(){_0x4771bb[_0xc53c('0x2a')](0xcc)[_0xc53c('0x2b')]();});}};}function handleEntityNotFound(_0x411891,_0x4de38c){return function(_0x453c6c){if(!_0x453c6c){_0x411891['sendStatus'](0x194);}return _0x453c6c;};}function handleError(_0x380e8b,_0x11fc73){_0x11fc73=_0x11fc73||0x1f4;return function(_0x3e3646){logger[_0xc53c('0x26')](_0x3e3646[_0xc53c('0x34')]);if(_0x3e3646['name']){delete _0x3e3646[_0xc53c('0x35')];}_0x380e8b[_0xc53c('0x2a')](_0x11fc73)[_0xc53c('0x36')](_0x3e3646);};}exports[_0xc53c('0x37')]=function(_0x15e86d,_0x4f805e){var _0x416486={},_0x5ef428={},_0x39bc3f={'count':0x0,'rows':[]};var _0x25dedf=db[_0xc53c('0x38')][_0xc53c('0x39')];_0x5ef428[_0xc53c('0x3a')]=_[_0xc53c('0x3b')](_0x25dedf);_0x5ef428[_0xc53c('0x3c')]=_[_0xc53c('0x3b')](_0x15e86d[_0xc53c('0x3c')]);_0x5ef428[_0xc53c('0x3d')]=_['intersection'](_0x5ef428[_0xc53c('0x3a')],_0x5ef428['query']);_0x416486[_0xc53c('0x3e')]=_[_0xc53c('0x3f')](_0x5ef428[_0xc53c('0x3a')],qs[_0xc53c('0x40')](_0x15e86d[_0xc53c('0x3c')][_0xc53c('0x40')]));_0x416486['attributes']=_0x416486['attributes']['length']?_0x416486[_0xc53c('0x3e')]:_0x5ef428['model'];if(!_0x15e86d[_0xc53c('0x3c')][_0xc53c('0x41')]('nolimit')){_0x416486[_0xc53c('0x2e')]=qs[_0xc53c('0x2e')](_0x15e86d['query'][_0xc53c('0x2e')]);_0x416486[_0xc53c('0x2d')]=qs['offset'](_0x15e86d[_0xc53c('0x3c')][_0xc53c('0x2d')]);}_0x416486[_0xc53c('0x42')]=qs[_0xc53c('0x43')](_0x15e86d['query'][_0xc53c('0x43')]);_0x416486['where']=qs['filters'](_[_0xc53c('0x44')](_0x15e86d[_0xc53c('0x3c')],_0x5ef428[_0xc53c('0x3d')]));if(_0x15e86d[_0xc53c('0x3c')][_0xc53c('0x45')]){_0x416486[_0xc53c('0x46')]=_[_0xc53c('0x47')](_0x416486['where'],{'$or':_[_0xc53c('0x48')](_0x25dedf,function(_0x44d200){if(_0x44d200[_0xc53c('0x49')][_0xc53c('0x4a')]!=='VIRTUAL'){var _0x845e19={};_0x845e19[_0x44d200[_0xc53c('0x4b')]]={'$like':'%'+_0x15e86d['query']['filter']+'%'};return _0x845e19;}})});}_0x416486=_['merge']({},_0x416486,_0x15e86d[_0xc53c('0x4c')]);var _0x2ef7ec={'where':_0x416486[_0xc53c('0x46')]};return db[_0xc53c('0x38')][_0xc53c('0x2c')](_0x2ef7ec)[_0xc53c('0x21')](function(_0x10e347){_0x39bc3f[_0xc53c('0x2c')]=_0x10e347;if(_0x15e86d[_0xc53c('0x3c')][_0xc53c('0x4d')]){_0x416486[_0xc53c('0x4e')]=[{'all':!![]}];}return db[_0xc53c('0x38')][_0xc53c('0x4f')](_0x416486);})[_0xc53c('0x21')](function(_0x59de00){_0x39bc3f[_0xc53c('0x50')]=_0x59de00;return _0x39bc3f;})[_0xc53c('0x21')](respondWithFilteredResult(_0x4f805e,_0x416486))[_0xc53c('0x51')](handleError(_0x4f805e,null));};exports[_0xc53c('0x52')]=function(_0x524c6d,_0x234b37){var _0x4f0f6d={'raw':![],'where':{'id':_0x524c6d[_0xc53c('0x53')]['id']}},_0x1b136b={};_0x1b136b[_0xc53c('0x3a')]=_['keys'](db[_0xc53c('0x38')]['rawAttributes']);_0x1b136b[_0xc53c('0x3c')]=_[_0xc53c('0x3b')](_0x524c6d[_0xc53c('0x3c')]);_0x1b136b[_0xc53c('0x3d')]=_[_0xc53c('0x3f')](_0x1b136b[_0xc53c('0x3a')],_0x1b136b[_0xc53c('0x3c')]);_0x4f0f6d[_0xc53c('0x3e')]=_[_0xc53c('0x3f')](_0x1b136b[_0xc53c('0x3a')],qs[_0xc53c('0x40')](_0x524c6d['query'][_0xc53c('0x40')]));_0x4f0f6d[_0xc53c('0x3e')]=_0x4f0f6d[_0xc53c('0x3e')][_0xc53c('0x54')]?_0x4f0f6d[_0xc53c('0x3e')]:_0x1b136b[_0xc53c('0x3a')];if(_0x524c6d['query'][_0xc53c('0x4d')]){_0x4f0f6d[_0xc53c('0x4e')]=[{'all':!![]}];}_0x4f0f6d=_[_0xc53c('0x47')]({},_0x4f0f6d,_0x524c6d[_0xc53c('0x4c')]);return db[_0xc53c('0x38')][_0xc53c('0x55')](_0x4f0f6d)[_0xc53c('0x21')](handleEntityNotFound(_0x234b37,null))[_0xc53c('0x21')](respondWithResult(_0x234b37,null))[_0xc53c('0x51')](handleError(_0x234b37,null));};exports[_0xc53c('0x56')]=function(_0x265d50,_0x118474){return db[_0xc53c('0x38')][_0xc53c('0x56')](_0x265d50[_0xc53c('0x57')],{})['then'](respondWithResult(_0x118474,0xc9))['catch'](handleError(_0x118474,null));};exports['update']=function(_0x5d8db0,_0x39f348){if(_0x5d8db0[_0xc53c('0x57')]['id']){delete _0x5d8db0[_0xc53c('0x57')]['id'];}return db[_0xc53c('0x38')]['find']({'where':{'id':_0x5d8db0[_0xc53c('0x53')]['id']}})['then'](handleEntityNotFound(_0x39f348,null))[_0xc53c('0x21')](saveUpdates(_0x5d8db0['body'],null))[_0xc53c('0x21')](respondWithResult(_0x39f348,null))[_0xc53c('0x51')](handleError(_0x39f348,null));};exports[_0xc53c('0x33')]=function(_0x5bdaaf,_0x59ae66){return db[_0xc53c('0x38')][_0xc53c('0x55')]({'where':{'id':_0x5bdaaf[_0xc53c('0x53')]['id']}})[_0xc53c('0x21')](handleEntityNotFound(_0x59ae66,null))[_0xc53c('0x21')](removeEntity(_0x59ae66,null))[_0xc53c('0x51')](handleError(_0x59ae66,null));};exports['getConfigurations']=function(_0x4e293a,_0x6565b9,_0x5b290d){var _0x54f02c={};var _0x597078={};var _0x1ccc78;var _0x1555f3;return db[_0xc53c('0x38')]['findOne']({'where':{'id':_0x4e293a[_0xc53c('0x53')]['id']}})[_0xc53c('0x21')](handleEntityNotFound(_0x6565b9,null))[_0xc53c('0x21')](function(_0x2a08fb){if(_0x2a08fb){_0x1ccc78=_0x2a08fb;_0x597078[_0xc53c('0x3a')]=_[_0xc53c('0x3b')](db[_0xc53c('0x58')][_0xc53c('0x39')]);_0x597078['query']=_[_0xc53c('0x3b')](_0x4e293a[_0xc53c('0x3c')]);_0x597078[_0xc53c('0x3d')]=_[_0xc53c('0x3f')](_0x597078[_0xc53c('0x3a')],_0x597078[_0xc53c('0x3c')]);_0x54f02c[_0xc53c('0x3e')]=_[_0xc53c('0x3f')](_0x597078['model'],qs[_0xc53c('0x40')](_0x4e293a[_0xc53c('0x3c')]['fields']));_0x54f02c['attributes']=_0x54f02c[_0xc53c('0x3e')][_0xc53c('0x54')]?_0x54f02c['attributes']:_0x597078['model'];_0x54f02c[_0xc53c('0x42')]=qs[_0xc53c('0x43')](_0x4e293a[_0xc53c('0x3c')]['sort']);_0x54f02c['where']=qs[_0xc53c('0x3d')](_[_0xc53c('0x44')](_0x4e293a['query'],_0x597078[_0xc53c('0x3d')]));if(_0x4e293a['query'][_0xc53c('0x45')]){_0x54f02c['where']=_[_0xc53c('0x47')](_0x54f02c[_0xc53c('0x46')],{'$or':_['map'](_0x54f02c[_0xc53c('0x3e')],function(_0x2ba3ed){var _0x5d00b6={};_0x5d00b6[_0x2ba3ed]={'$like':'%'+_0x4e293a[_0xc53c('0x3c')]['filter']+'%'};return _0x5d00b6;})});}_0x54f02c=_['merge']({},_0x54f02c,_0x4e293a[_0xc53c('0x4c')]);return _0x1ccc78['getConfigurations'](_0x54f02c);}})[_0xc53c('0x21')](function(_0x5a9027){if(_0x5a9027){_0x1555f3=_0x5a9027[_0xc53c('0x54')];if(!_0x4e293a['query'][_0xc53c('0x41')](_0xc53c('0x59'))){_0x54f02c[_0xc53c('0x2e')]=qs['limit'](_0x4e293a[_0xc53c('0x3c')][_0xc53c('0x2e')]);_0x54f02c[_0xc53c('0x2d')]=qs[_0xc53c('0x2d')](_0x4e293a[_0xc53c('0x3c')][_0xc53c('0x2d')]);}return _0x1ccc78[_0xc53c('0x5a')](_0x54f02c);}})[_0xc53c('0x21')](function(_0x5acd74){if(_0x5acd74){return _0x5acd74?{'count':_0x1555f3,'rows':_0x5acd74}:null;}})[_0xc53c('0x21')](respondWithResult(_0x6565b9,null))[_0xc53c('0x51')](handleError(_0x6565b9,null));};exports[_0xc53c('0x5b')]=function(_0x5e8edd,_0x201b35,_0x26b592){if(_0x5e8edd[_0xc53c('0x57')]['id']){delete _0x5e8edd['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x5e8edd[_0xc53c('0x53')]['id']}})[_0xc53c('0x21')](handleEntityNotFound(_0x201b35,null))['then'](function(_0x42e7e7){if(_0x42e7e7){_0x5e8edd[_0xc53c('0x57')][_0xc53c('0x5c')]=_0x42e7e7['id'];_0x5e8edd[_0xc53c('0x57')][_0xc53c('0x5d')]=integrations[_0xc53c('0x5e')](_0x5e8edd[_0xc53c('0x57')][_0xc53c('0x5f')],_0x5e8edd['body'][_0xc53c('0x49')]);_0x5e8edd['body'][_0xc53c('0x60')]=integrations[_0xc53c('0x61')](_0x5e8edd[_0xc53c('0x57')][_0xc53c('0x5f')],_0x5e8edd[_0xc53c('0x57')][_0xc53c('0x49')]);return db[_0xc53c('0x58')][_0xc53c('0x56')](_0x5e8edd['body'],{'include':[{'model':db[_0xc53c('0x62')],'as':_0xc53c('0x5d')},{'model':db[_0xc53c('0x62')],'as':'Descriptions'}]});}return null;})[_0xc53c('0x21')](respondWithResult(_0x201b35,null))[_0xc53c('0x51')](handleError(_0x201b35,null));};exports[_0xc53c('0x63')]=function(_0x5577c8,_0xb9f996,_0x3fc423){var _0x1320be=[{'name':_0xc53c('0x64'),'label':_0xc53c('0x64'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x281551='';return db[_0xc53c('0x38')][_0xc53c('0x65')]({'where':{'id':_0x5577c8[_0xc53c('0x53')]['id']},'attributes':['id',_0xc53c('0x66'),_0xc53c('0x67'),'username','password',_0xc53c('0x68'),_0xc53c('0x69'),'token',_0xc53c('0x6a')]})[_0xc53c('0x21')](handleEntityNotFound(_0xb9f996,null))['then'](function(_0x378b15){if(_0x378b15){_0x281551=_0x378b15[_0xc53c('0x66')];var _0x47683d=_0x281551['slice'](-0x1);if(_0x47683d==='/'){_0x281551=_0x281551[_0xc53c('0x6b')](0x0,_0x281551['lastIndexOf'](_0x47683d));}var _0xebb98b={'method':_0xc53c('0x6c'),'uri':util[_0xc53c('0x6d')](_0xc53c('0x6e'),_0x281551),'headers':{'Content-Type':_0xc53c('0x6f'),'Accept':'application/json'},'json':!![]};if(_0x378b15['authType']===_0xc53c('0x70')){_0xebb98b[_0xc53c('0x71')][_0xc53c('0x72')]=util[_0xc53c('0x6d')](_0xc53c('0x73'),new Buffer(util[_0xc53c('0x6d')](_0xc53c('0x74'),_0x378b15[_0xc53c('0x75')],_0x378b15[_0xc53c('0x76')]))['toString'](_0xc53c('0x77')));}return rp(_0xebb98b)[_0xc53c('0x21')](function(_0x1f3afe){return _0x1320be['concat'](_[_0xc53c('0x48')](_0x1f3afe[_0xc53c('0x78')][_0xc53c('0x79')],function(_0x496de1){return{'id':_0x496de1[_0xc53c('0x35')],'name':_0x496de1[_0xc53c('0x35')],'type':_0x496de1[_0xc53c('0x49')],'active':_0x496de1[_0xc53c('0x7a')],'label':_0x496de1[_0xc53c('0x7b')],'custom':!![]};}));});}})[_0xc53c('0x21')](function(_0x79176){return{'count':_0x79176[_0xc53c('0x54')],'rows':_0x79176};})[_0xc53c('0x21')](respondWithResult(_0xb9f996,null))[_0xc53c('0x51')](function(_0x2036bc){var _0x17a511=_0x5577c8['query']['test']?0x1f4:_0x2036bc[_0xc53c('0x7c')]||0x1f4;logger[_0xc53c('0x26')](_0xc53c('0x7d'),_0xc53c('0x63'),_0x17a511,JSON['stringify'](_0x2036bc));delete _0x2036bc[_0xc53c('0x35')];if(_0x17a511===0x191){_0x17a511=0x190;}_0xb9f996[_0xc53c('0x2a')](_0x17a511)[_0xc53c('0x36')](_0x5577c8[_0xc53c('0x3c')][_0xc53c('0x1d')]?{'message':_0xc53c('0x7e'),'statusCode':_0x2036bc[_0xc53c('0x7c')]}:_0x2036bc);});}; \ No newline at end of file +var _0x3b64=['end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','rawAttributes','keys','filters','intersection','attributes','model','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','DeskAccount','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','DeskField','getFields','priority','authType','username','password','consumerSecret','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../components/integrations/configuration','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','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status'];(function(_0x5e039f,_0xdbd134){var _0x4a6251=function(_0x1e1365){while(--_0x1e1365){_0x5e039f['push'](_0x5e039f['shift']());}};_0x4a6251(++_0xdbd134);}(_0x3b64,0x1bd));var _0x43b6=function(_0x4fdf81,_0x231f66){_0x4fdf81=_0x4fdf81-0x0;var _0xaa4a58=_0x3b64[_0x4fdf81];return _0xaa4a58;};'use strict';var pdf=require(_0x43b6('0x0'));var emlformat=require(_0x43b6('0x1'));var rimraf=require(_0x43b6('0x2'));var zipdir=require(_0x43b6('0x3'));var jsonpatch=require(_0x43b6('0x4'));var rp=require(_0x43b6('0x5'));var moment=require(_0x43b6('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x43b6('0x7'));var util=require('util');var path=require(_0x43b6('0x8'));var sox=require(_0x43b6('0x9'));var csv=require(_0x43b6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x43b6('0xb'));var squel=require('squel');var crypto=require(_0x43b6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x43b6('0xd'));var toCsv=require(_0x43b6('0xa'));var querystring=require(_0x43b6('0xe'));var Papa=require('papaparse');var Redis=require(_0x43b6('0xf'));var authService=require(_0x43b6('0x10'));var qs=require(_0x43b6('0x11'));var hardwareService=require(_0x43b6('0x12'));var logger=require('../../config/logger')(_0x43b6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x43b6('0x14'));var jayson=require('jayson/promise');var client=jayson['client'][_0x43b6('0x15')]({'port':0x232a});function checkPasswordPattern(_0x40f627,_0x2e3da2,_0x6f5dab){if(_0x6f5dab){var _0x4a355c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a355c[_0x43b6('0x16')](_0x2e3da2)){return _0x40f627;}else{throw new db['Sequelize'][(_0x43b6('0x17'))](_0x43b6('0x18'));}}else{return _0x40f627;}}function respondWithRpcPromise(_0x331284,_0x25f6f4,_0x48cbc7,_0x5ef391){return new BPromise(function(_0xe0b1f2,_0x148676){var _0x1bfb90=_0x5ef391||client;return _0x1bfb90['request'](_0x331284,_0x48cbc7)[_0x43b6('0x19')](function(_0x4c562b){logger['info'](_0x43b6('0x1a'),_0x25f6f4,'request\x20sent');logger[_0x43b6('0x1b')](_0x43b6('0x1c'),_0x25f6f4,_0x43b6('0x1d'),JSON[_0x43b6('0x1e')](_0x4c562b));if(_0x4c562b[_0x43b6('0x1f')]){if(_0x4c562b[_0x43b6('0x1f')][_0x43b6('0x20')]===0x1f4){logger['error'](_0x43b6('0x1a'),_0x25f6f4,_0x4c562b['error'][_0x43b6('0x21')]);return _0x148676(_0x4c562b['error']['message']);}logger[_0x43b6('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x25f6f4,_0x4c562b[_0x43b6('0x1f')][_0x43b6('0x21')]);return _0xe0b1f2(_0x4c562b['error']['message']);}else{logger[_0x43b6('0x22')](_0x43b6('0x1a'),_0x25f6f4,_0x43b6('0x1d'));_0xe0b1f2(_0x4c562b[_0x43b6('0x23')][_0x43b6('0x21')]);}})[_0x43b6('0x24')](function(_0xe02e38){logger[_0x43b6('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x25f6f4,_0xe02e38);_0x148676(_0xe02e38);});});}function respondWithStatusCode(_0x1807ef,_0x234e9a){_0x234e9a=_0x234e9a||0xcc;return function(_0x45881b){if(_0x45881b){return _0x1807ef[_0x43b6('0x25')](_0x234e9a);}return _0x1807ef[_0x43b6('0x26')](_0x234e9a)[_0x43b6('0x27')]();};}function respondWithResult(_0x1dbf3e,_0x4a79b1){_0x4a79b1=_0x4a79b1||0xc8;return function(_0x5f2e33){if(_0x5f2e33){return _0x1dbf3e[_0x43b6('0x26')](_0x4a79b1)[_0x43b6('0x28')](_0x5f2e33);}};}function respondWithFilteredResult(_0x224690,_0x42e9d1){return function(_0x589976){if(_0x589976){var _0x4c87b7=_0x589976[_0x43b6('0x29')],_0x25fc38=_0x42e9d1[_0x43b6('0x2a')],_0x2f4878=_0x42e9d1[_0x43b6('0x2a')]+_0x42e9d1[_0x43b6('0x2b')],_0x215a83;if(_0x2f4878>=_0x4c87b7){_0x2f4878=_0x4c87b7;_0x215a83=0xc8;}else{_0x215a83=0xce;}_0x224690[_0x43b6('0x26')](_0x215a83);return _0x224690[_0x43b6('0x2c')](_0x43b6('0x2d'),_0x25fc38+'-'+_0x2f4878+'/'+_0x4c87b7)[_0x43b6('0x28')](_0x589976);}return null;};}function patchUpdates(_0x10f602){return function(_0x392653){try{jsonpatch[_0x43b6('0x2e')](_0x392653,_0x10f602,!![]);}catch(_0x25c42b){return BPromise[_0x43b6('0x2f')](_0x25c42b);}return _0x392653[_0x43b6('0x30')]();};}function saveUpdates(_0x2547a6,_0x54be1d){return function(_0x247572){if(_0x247572){return _0x247572[_0x43b6('0x31')](_0x2547a6)[_0x43b6('0x19')](function(_0x3d0033){return _0x3d0033;});}return null;};}function removeEntity(_0x338384,_0x423650){return function(_0x47fff9){if(_0x47fff9){return _0x47fff9[_0x43b6('0x32')]()[_0x43b6('0x19')](function(){_0x338384['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x436419,_0x4f73e4){return function(_0x404f1a){if(!_0x404f1a){_0x436419[_0x43b6('0x25')](0x194);}return _0x404f1a;};}function handleError(_0x685002,_0x574bd2){_0x574bd2=_0x574bd2||0x1f4;return function(_0x2a3cc1){logger['error'](_0x2a3cc1['stack']);if(_0x2a3cc1[_0x43b6('0x33')]){delete _0x2a3cc1[_0x43b6('0x33')];}_0x685002[_0x43b6('0x26')](_0x574bd2)[_0x43b6('0x34')](_0x2a3cc1);};}exports['index']=function(_0x3616a1,_0x26ae20){var _0x754a61={},_0x5bcb11={},_0x16533f={'count':0x0,'rows':[]};var _0x3f89f6=db['DeskAccount'][_0x43b6('0x35')];_0x5bcb11['model']=_[_0x43b6('0x36')](_0x3f89f6);_0x5bcb11['query']=_[_0x43b6('0x36')](_0x3616a1['query']);_0x5bcb11[_0x43b6('0x37')]=_[_0x43b6('0x38')](_0x5bcb11['model'],_0x5bcb11['query']);_0x754a61[_0x43b6('0x39')]=_[_0x43b6('0x38')](_0x5bcb11[_0x43b6('0x3a')],qs['fields'](_0x3616a1[_0x43b6('0x3b')][_0x43b6('0x3c')]));_0x754a61['attributes']=_0x754a61['attributes'][_0x43b6('0x3d')]?_0x754a61[_0x43b6('0x39')]:_0x5bcb11[_0x43b6('0x3a')];if(!_0x3616a1[_0x43b6('0x3b')][_0x43b6('0x3e')](_0x43b6('0x3f'))){_0x754a61['limit']=qs[_0x43b6('0x2b')](_0x3616a1[_0x43b6('0x3b')][_0x43b6('0x2b')]);_0x754a61[_0x43b6('0x2a')]=qs['offset'](_0x3616a1['query'][_0x43b6('0x2a')]);}_0x754a61[_0x43b6('0x40')]=qs[_0x43b6('0x41')](_0x3616a1[_0x43b6('0x3b')][_0x43b6('0x41')]);_0x754a61[_0x43b6('0x42')]=qs[_0x43b6('0x37')](_[_0x43b6('0x43')](_0x3616a1['query'],_0x5bcb11[_0x43b6('0x37')]));if(_0x3616a1['query']['filter']){_0x754a61[_0x43b6('0x42')]=_[_0x43b6('0x44')](_0x754a61[_0x43b6('0x42')],{'$or':_[_0x43b6('0x45')](_0x3f89f6,function(_0x365878){if(_0x365878[_0x43b6('0x46')][_0x43b6('0x47')]!==_0x43b6('0x48')){var _0x48349e={};_0x48349e[_0x365878[_0x43b6('0x49')]]={'$like':'%'+_0x3616a1[_0x43b6('0x3b')][_0x43b6('0x4a')]+'%'};return _0x48349e;}})});}_0x754a61=_['merge']({},_0x754a61,_0x3616a1[_0x43b6('0x4b')]);var _0xb46cee={'where':_0x754a61['where']};return db[_0x43b6('0x4c')][_0x43b6('0x29')](_0xb46cee)[_0x43b6('0x19')](function(_0x5c6915){_0x16533f[_0x43b6('0x29')]=_0x5c6915;if(_0x3616a1[_0x43b6('0x3b')][_0x43b6('0x4d')]){_0x754a61[_0x43b6('0x4e')]=[{'all':!![]}];}return db[_0x43b6('0x4c')][_0x43b6('0x4f')](_0x754a61);})['then'](function(_0x56a8b3){_0x16533f['rows']=_0x56a8b3;return _0x16533f;})[_0x43b6('0x19')](respondWithFilteredResult(_0x26ae20,_0x754a61))['catch'](handleError(_0x26ae20,null));};exports[_0x43b6('0x50')]=function(_0x18ef89,_0x12e19d){var _0x18ec0f={'raw':![],'where':{'id':_0x18ef89[_0x43b6('0x51')]['id']}},_0x6dd3cc={};_0x6dd3cc[_0x43b6('0x3a')]=_[_0x43b6('0x36')](db[_0x43b6('0x4c')][_0x43b6('0x35')]);_0x6dd3cc['query']=_[_0x43b6('0x36')](_0x18ef89[_0x43b6('0x3b')]);_0x6dd3cc[_0x43b6('0x37')]=_[_0x43b6('0x38')](_0x6dd3cc['model'],_0x6dd3cc[_0x43b6('0x3b')]);_0x18ec0f['attributes']=_['intersection'](_0x6dd3cc[_0x43b6('0x3a')],qs[_0x43b6('0x3c')](_0x18ef89['query']['fields']));_0x18ec0f[_0x43b6('0x39')]=_0x18ec0f[_0x43b6('0x39')][_0x43b6('0x3d')]?_0x18ec0f[_0x43b6('0x39')]:_0x6dd3cc[_0x43b6('0x3a')];if(_0x18ef89[_0x43b6('0x3b')][_0x43b6('0x4d')]){_0x18ec0f[_0x43b6('0x4e')]=[{'all':!![]}];}_0x18ec0f=_[_0x43b6('0x44')]({},_0x18ec0f,_0x18ef89[_0x43b6('0x4b')]);return db['DeskAccount'][_0x43b6('0x52')](_0x18ec0f)['then'](handleEntityNotFound(_0x12e19d,null))[_0x43b6('0x19')](respondWithResult(_0x12e19d,null))[_0x43b6('0x24')](handleError(_0x12e19d,null));};exports[_0x43b6('0x53')]=function(_0x4e59b5,_0x3b6494){return db[_0x43b6('0x4c')][_0x43b6('0x53')](_0x4e59b5['body'],{})['then'](respondWithResult(_0x3b6494,0xc9))[_0x43b6('0x24')](handleError(_0x3b6494,null));};exports['update']=function(_0x78cf7a,_0x51efe0){if(_0x78cf7a[_0x43b6('0x54')]['id']){delete _0x78cf7a[_0x43b6('0x54')]['id'];}return db[_0x43b6('0x4c')]['find']({'where':{'id':_0x78cf7a[_0x43b6('0x51')]['id']}})[_0x43b6('0x19')](handleEntityNotFound(_0x51efe0,null))[_0x43b6('0x19')](saveUpdates(_0x78cf7a['body'],null))[_0x43b6('0x19')](respondWithResult(_0x51efe0,null))[_0x43b6('0x24')](handleError(_0x51efe0,null));};exports['destroy']=function(_0x64eaf0,_0x4d6aaa){return db['DeskAccount'][_0x43b6('0x52')]({'where':{'id':_0x64eaf0[_0x43b6('0x51')]['id']}})[_0x43b6('0x19')](handleEntityNotFound(_0x4d6aaa,null))['then'](removeEntity(_0x4d6aaa,null))['catch'](handleError(_0x4d6aaa,null));};exports[_0x43b6('0x55')]=function(_0x22909e,_0x5851ae,_0x3a4fd1){var _0x6ecdb2={};var _0x25c730={};var _0x2bbd8a;var _0x3d00fa;return db[_0x43b6('0x4c')][_0x43b6('0x56')]({'where':{'id':_0x22909e['params']['id']}})[_0x43b6('0x19')](handleEntityNotFound(_0x5851ae,null))[_0x43b6('0x19')](function(_0x348514){if(_0x348514){_0x2bbd8a=_0x348514;_0x25c730[_0x43b6('0x3a')]=_[_0x43b6('0x36')](db[_0x43b6('0x57')]['rawAttributes']);_0x25c730[_0x43b6('0x3b')]=_[_0x43b6('0x36')](_0x22909e[_0x43b6('0x3b')]);_0x25c730[_0x43b6('0x37')]=_[_0x43b6('0x38')](_0x25c730['model'],_0x25c730[_0x43b6('0x3b')]);_0x6ecdb2[_0x43b6('0x39')]=_['intersection'](_0x25c730[_0x43b6('0x3a')],qs[_0x43b6('0x3c')](_0x22909e[_0x43b6('0x3b')][_0x43b6('0x3c')]));_0x6ecdb2[_0x43b6('0x39')]=_0x6ecdb2[_0x43b6('0x39')][_0x43b6('0x3d')]?_0x6ecdb2[_0x43b6('0x39')]:_0x25c730['model'];_0x6ecdb2['order']=qs[_0x43b6('0x41')](_0x22909e[_0x43b6('0x3b')]['sort']);_0x6ecdb2[_0x43b6('0x42')]=qs['filters'](_[_0x43b6('0x43')](_0x22909e[_0x43b6('0x3b')],_0x25c730[_0x43b6('0x37')]));if(_0x22909e[_0x43b6('0x3b')][_0x43b6('0x4a')]){_0x6ecdb2[_0x43b6('0x42')]=_[_0x43b6('0x44')](_0x6ecdb2[_0x43b6('0x42')],{'$or':_[_0x43b6('0x45')](_0x6ecdb2[_0x43b6('0x39')],function(_0x20fe95){var _0x5aeda8={};_0x5aeda8[_0x20fe95]={'$like':'%'+_0x22909e[_0x43b6('0x3b')][_0x43b6('0x4a')]+'%'};return _0x5aeda8;})});}_0x6ecdb2=_[_0x43b6('0x44')]({},_0x6ecdb2,_0x22909e['options']);return _0x2bbd8a[_0x43b6('0x55')](_0x6ecdb2);}})[_0x43b6('0x19')](function(_0xe62394){if(_0xe62394){_0x3d00fa=_0xe62394[_0x43b6('0x3d')];if(!_0x22909e[_0x43b6('0x3b')]['hasOwnProperty'](_0x43b6('0x3f'))){_0x6ecdb2[_0x43b6('0x2b')]=qs['limit'](_0x22909e[_0x43b6('0x3b')]['limit']);_0x6ecdb2[_0x43b6('0x2a')]=qs[_0x43b6('0x2a')](_0x22909e['query'][_0x43b6('0x2a')]);}return _0x2bbd8a[_0x43b6('0x55')](_0x6ecdb2);}})[_0x43b6('0x19')](function(_0x53c7e2){if(_0x53c7e2){return _0x53c7e2?{'count':_0x3d00fa,'rows':_0x53c7e2}:null;}})['then'](respondWithResult(_0x5851ae,null))[_0x43b6('0x24')](handleError(_0x5851ae,null));};exports[_0x43b6('0x58')]=function(_0xc35a58,_0xcb1fdc,_0x4dece3){if(_0xc35a58[_0x43b6('0x54')]['id']){delete _0xc35a58[_0x43b6('0x54')]['id'];}return db['DeskAccount'][_0x43b6('0x56')]({'where':{'id':_0xc35a58[_0x43b6('0x51')]['id']}})[_0x43b6('0x19')](handleEntityNotFound(_0xcb1fdc,null))['then'](function(_0x5dcf4a){if(_0x5dcf4a){_0xc35a58[_0x43b6('0x54')][_0x43b6('0x59')]=_0x5dcf4a['id'];_0xc35a58[_0x43b6('0x54')]['Subjects']=integrations[_0x43b6('0x5a')](_0xc35a58[_0x43b6('0x54')][_0x43b6('0x5b')],_0xc35a58[_0x43b6('0x54')]['type']);_0xc35a58[_0x43b6('0x54')][_0x43b6('0x5c')]=integrations['getDescriptions'](_0xc35a58['body'][_0x43b6('0x5b')],_0xc35a58[_0x43b6('0x54')][_0x43b6('0x46')]);return db[_0x43b6('0x57')][_0x43b6('0x53')](_0xc35a58[_0x43b6('0x54')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x43b6('0x5d')],'as':_0x43b6('0x5c')}]});}return null;})[_0x43b6('0x19')](respondWithResult(_0xcb1fdc,null))[_0x43b6('0x24')](handleError(_0xcb1fdc,null));};exports[_0x43b6('0x5e')]=function(_0x245bd1,_0x5470e3,_0x4175b6){var _0x360ab2=[{'name':_0x43b6('0x5f'),'label':_0x43b6('0x5f'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x21dc78='';return db['DeskAccount'][_0x43b6('0x56')]({'where':{'id':_0x245bd1[_0x43b6('0x51')]['id']},'attributes':['id','remoteUri',_0x43b6('0x60'),_0x43b6('0x61'),_0x43b6('0x62'),'consumerKey',_0x43b6('0x63'),_0x43b6('0x64'),'tokenSecret']})[_0x43b6('0x19')](handleEntityNotFound(_0x5470e3,null))[_0x43b6('0x19')](function(_0x3e2e54){if(_0x3e2e54){_0x21dc78=_0x3e2e54[_0x43b6('0x65')];var _0x5d79f7=_0x21dc78[_0x43b6('0x66')](-0x1);if(_0x5d79f7==='/'){_0x21dc78=_0x21dc78[_0x43b6('0x67')](0x0,_0x21dc78[_0x43b6('0x68')](_0x5d79f7));}var _0x703be7={'method':_0x43b6('0x69'),'uri':util[_0x43b6('0x6a')](_0x43b6('0x6b'),_0x21dc78),'headers':{'Content-Type':_0x43b6('0x6c'),'Accept':_0x43b6('0x6c')},'json':!![]};if(_0x3e2e54['authType']===_0x43b6('0x6d')){_0x703be7[_0x43b6('0x6e')][_0x43b6('0x6f')]=util[_0x43b6('0x6a')](_0x43b6('0x70'),new Buffer(util['format']('%s:%s',_0x3e2e54[_0x43b6('0x61')],_0x3e2e54['password']))[_0x43b6('0x71')](_0x43b6('0x72')));}return rp(_0x703be7)[_0x43b6('0x19')](function(_0x57b8e0){return _0x360ab2[_0x43b6('0x73')](_[_0x43b6('0x45')](_0x57b8e0[_0x43b6('0x74')]['entries'],function(_0x7d843b){return{'id':_0x7d843b['name'],'name':_0x7d843b[_0x43b6('0x33')],'type':_0x7d843b[_0x43b6('0x46')],'active':_0x7d843b[_0x43b6('0x75')],'label':_0x7d843b['label'],'custom':!![]};}));});}})[_0x43b6('0x19')](function(_0x21a5de){return{'count':_0x21a5de[_0x43b6('0x3d')],'rows':_0x21a5de};})[_0x43b6('0x19')](respondWithResult(_0x5470e3,null))[_0x43b6('0x24')](function(_0x2fd911){var _0x21640e=_0x245bd1['query'][_0x43b6('0x16')]?0x1f4:_0x2fd911[_0x43b6('0x76')]||0x1f4;logger[_0x43b6('0x1f')](_0x43b6('0x77'),_0x43b6('0x5e'),_0x21640e,JSON[_0x43b6('0x1e')](_0x2fd911));delete _0x2fd911[_0x43b6('0x33')];if(_0x21640e===0x191){_0x21640e=0x190;}_0x5470e3[_0x43b6('0x26')](_0x21640e)['send'](_0x245bd1['query'][_0x43b6('0x16')]?{'message':_0x43b6('0x78'),'statusCode':_0x2fd911['statusCode']}:_0x2fd911);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index c4c6254..3ec1582 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 _0x1a1f=['./intDeskAccount.attributes','exports','define','DeskAccount','lodash','util','api','path','../../config/environment'];(function(_0x2e8752,_0x1597cc){var _0x7d4d25=function(_0x216ddf){while(--_0x216ddf){_0x2e8752['push'](_0x2e8752['shift']());}};_0x7d4d25(++_0x1597cc);}(_0x1a1f,0x17e));var _0xf1a1=function(_0x35ca06,_0x2547c1){_0x35ca06=_0x35ca06-0x0;var _0x21ab4e=_0x1a1f[_0x35ca06];return _0x21ab4e;};'use strict';var _=require(_0xf1a1('0x0'));var util=require(_0xf1a1('0x1'));var logger=require('../../config/logger')(_0xf1a1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1a1('0x3'));var rimraf=require('rimraf');var config=require(_0xf1a1('0x4'));var attributes=require(_0xf1a1('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xf1a1('0x6')]=function(_0x3f2d52,_0x321f46){return _0x3f2d52[_0xf1a1('0x7')](_0xf1a1('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3581=['api','moment','bluebird','request-promise','path','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x98cbdc,_0x5e5a9f){var _0x268762=function(_0x5eccea){while(--_0x5eccea){_0x98cbdc['push'](_0x98cbdc['shift']());}};_0x268762(++_0x5e5a9f);}(_0x3581,0x14f));var _0x1358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1358('0x0'));var util=require(_0x1358('0x1'));var logger=require(_0x1358('0x2'))(_0x1358('0x3'));var moment=require(_0x1358('0x4'));var BPromise=require(_0x1358('0x5'));var rp=require(_0x1358('0x6'));var fs=require('fs');var path=require(_0x1358('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1358('0x8'));var integrations=require(_0x1358('0x9'));module['exports']=function(_0x34eb2a,_0x1c3477){return _0x34eb2a[_0x1358('0xa')](_0x1358('0xb'),attributes,{'tableName':_0x1358('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 68e366c..7ee04a0 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 _0x59d2=['request\x20sent','debug','stringify','error','code','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetDeskAccount','ShowDeskAccount','find','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x9b436b,_0x35dcb2){var _0x422859=function(_0x435030){while(--_0x435030){_0x9b436b['push'](_0x9b436b['shift']());}};_0x422859(++_0x35dcb2);}(_0x59d2,0x180));var _0x259d=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x59d2[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0x259d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x259d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x259d('0x2'));var db=require(_0x259d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x259d('0x4'))(_0x259d('0x5'));var config=require(_0x259d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x259d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5d34,_0x381ce4,_0x40b9a8){return new BPromise(function(_0x20ca85,_0x2d00eb){return client[_0x259d('0x8')](_0x5d5d34,_0x40b9a8)[_0x259d('0x9')](function(_0x2aa1a6){logger[_0x259d('0xa')](_0x259d('0xb'),_0x381ce4,_0x259d('0xc'));logger[_0x259d('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x381ce4,_0x259d('0xc'),JSON[_0x259d('0xe')](_0x2aa1a6));if(_0x2aa1a6[_0x259d('0xf')]){if(_0x2aa1a6[_0x259d('0xf')][_0x259d('0x10')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x381ce4,_0x2aa1a6[_0x259d('0xf')]['message']);return _0x2d00eb(_0x2aa1a6[_0x259d('0xf')]['message']);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x381ce4,_0x2aa1a6['error'][_0x259d('0x11')]);return _0x20ca85(_0x2aa1a6[_0x259d('0xf')]['message']);}else{logger[_0x259d('0xa')]('DeskAccount,\x20%s,\x20%s',_0x381ce4,'request\x20sent');_0x20ca85(_0x2aa1a6[_0x259d('0x12')][_0x259d('0x11')]);}})[_0x259d('0x13')](function(_0x1b5c47){logger['error'](_0x259d('0xb'),_0x381ce4,_0x1b5c47);_0x2d00eb(_0x1b5c47);});});}exports['GetDeskAccount']=function(_0x43a24b){var _0x32dd02=this;return new Promise(function(_0x17986e,_0x3ce025){return db[_0x259d('0x14')][_0x259d('0x15')]({'raw':_0x43a24b[_0x259d('0x16')]?_0x43a24b[_0x259d('0x16')][_0x259d('0x17')]===undefined?!![]:![]:!![],'where':_0x43a24b[_0x259d('0x16')]?_0x43a24b[_0x259d('0x16')][_0x259d('0x18')]||null:null,'attributes':_0x43a24b[_0x259d('0x16')]?_0x43a24b['options'][_0x259d('0x19')]||null:null,'limit':_0x43a24b['options']?_0x43a24b[_0x259d('0x16')][_0x259d('0x1a')]||null:null,'include':_0x43a24b[_0x259d('0x16')]?_0x43a24b[_0x259d('0x16')][_0x259d('0x1b')]?_['map'](_0x43a24b[_0x259d('0x16')]['include'],function(_0x9867fd){return{'model':db[_0x9867fd[_0x259d('0x1c')]],'as':_0x9867fd['as'],'attributes':_0x9867fd[_0x259d('0x19')],'include':_0x9867fd['include']?_['map'](_0x9867fd[_0x259d('0x1b')],function(_0xaa18f3){return{'model':db[_0xaa18f3[_0x259d('0x1c')]],'as':_0xaa18f3['as'],'attributes':_0xaa18f3['attributes'],'include':_0xaa18f3[_0x259d('0x1b')]?_[_0x259d('0x1d')](_0xaa18f3['include'],function(_0x3ab642){return{'model':db[_0x3ab642['model']],'as':_0x3ab642['as'],'attributes':_0x3ab642['attributes']};}):[]};}):[]};}):[]:[]})[_0x259d('0x9')](function(_0x2e79aa){logger[_0x259d('0xa')](_0x259d('0x1e'),_0x43a24b);logger[_0x259d('0xd')]('GetDeskAccount',_0x43a24b,JSON[_0x259d('0xe')](_0x2e79aa));_0x17986e(_0x2e79aa);})['catch'](function(_0x5b0637){logger['error'](_0x259d('0x1e'),_0x5b0637[_0x259d('0x11')],_0x43a24b);_0x3ce025(_0x32dd02[_0x259d('0xf')](0x1f4,_0x5b0637[_0x259d('0x11')]));});});};exports[_0x259d('0x1f')]=function(_0x419c9f){var _0x45e406=this;return new Promise(function(_0x21cf8a,_0x3b819a){return db['DeskAccount'][_0x259d('0x20')]({'raw':_0x419c9f[_0x259d('0x16')]?_0x419c9f[_0x259d('0x16')][_0x259d('0x17')]===undefined?!![]:![]:!![],'where':_0x419c9f[_0x259d('0x16')]?_0x419c9f[_0x259d('0x16')][_0x259d('0x18')]||null:null,'attributes':_0x419c9f['options']?_0x419c9f[_0x259d('0x16')][_0x259d('0x19')]||null:null,'include':_0x419c9f['options']?_0x419c9f['options'][_0x259d('0x1b')]?_[_0x259d('0x1d')](_0x419c9f[_0x259d('0x16')][_0x259d('0x1b')],function(_0x5ec04c){return{'model':db[_0x5ec04c[_0x259d('0x1c')]],'as':_0x5ec04c['as'],'attributes':_0x5ec04c['attributes'],'include':_0x5ec04c['include']?_[_0x259d('0x1d')](_0x5ec04c[_0x259d('0x1b')],function(_0x5d2ab0){return{'model':db[_0x5d2ab0[_0x259d('0x1c')]],'as':_0x5d2ab0['as'],'attributes':_0x5d2ab0[_0x259d('0x19')],'include':_0x5d2ab0[_0x259d('0x1b')]?_[_0x259d('0x1d')](_0x5d2ab0[_0x259d('0x1b')],function(_0x2d38fc){return{'model':db[_0x2d38fc[_0x259d('0x1c')]],'as':_0x2d38fc['as'],'attributes':_0x2d38fc[_0x259d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x259d('0x9')](function(_0x22fada){logger['info'](_0x259d('0x1f'),_0x419c9f);logger[_0x259d('0xd')](_0x259d('0x1f'),_0x419c9f,JSON[_0x259d('0xe')](_0x22fada));_0x21cf8a(_0x22fada);})[_0x259d('0x13')](function(_0x4ed1cf){logger[_0x259d('0xf')](_0x259d('0x1f'),_0x4ed1cf['message'],_0x419c9f);_0x3b819a(_0x45e406['error'](0x1f4,_0x4ed1cf[_0x259d('0x11')]));});});}; \ No newline at end of file +var _0x5f4f=['options','raw','where','limit','include','map','attributes','model','debug','GetDeskAccount','stringify','ShowDeskAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','DeskAccount'];(function(_0x312b2f,_0x506271){var _0x51f93f=function(_0x3f0f88){while(--_0x3f0f88){_0x312b2f['push'](_0x312b2f['shift']());}};_0x51f93f(++_0x506271);}(_0x5f4f,0x136));var _0xf5f4=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x5f4f[_0x34a8c8];return _0x1fe6e5;};'use strict';var _=require(_0xf5f4('0x0'));var util=require(_0xf5f4('0x1'));var moment=require(_0xf5f4('0x2'));var BPromise=require('bluebird');var rs=require(_0xf5f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5f4('0x4'))['db'];var utils=require(_0xf5f4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f4('0x6'));var jayson=require(_0xf5f4('0x7'));var client=jayson[_0xf5f4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42676b,_0x57c88e,_0x31173f){return new BPromise(function(_0x5171a6,_0x546c29){return client[_0xf5f4('0x9')](_0x42676b,_0x31173f)[_0xf5f4('0xa')](function(_0x5aff68){logger['info'](_0xf5f4('0xb'),_0x57c88e,_0xf5f4('0xc'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x57c88e,_0xf5f4('0xc'),JSON['stringify'](_0x5aff68));if(_0x5aff68[_0xf5f4('0xd')]){if(_0x5aff68['error'][_0xf5f4('0xe')]===0x1f4){logger['error'](_0xf5f4('0xb'),_0x57c88e,_0x5aff68['error'][_0xf5f4('0xf')]);return _0x546c29(_0x5aff68['error'][_0xf5f4('0xf')]);}logger[_0xf5f4('0xd')](_0xf5f4('0xb'),_0x57c88e,_0x5aff68[_0xf5f4('0xd')][_0xf5f4('0xf')]);return _0x5171a6(_0x5aff68[_0xf5f4('0xd')]['message']);}else{logger[_0xf5f4('0x10')](_0xf5f4('0xb'),_0x57c88e,_0xf5f4('0xc'));_0x5171a6(_0x5aff68[_0xf5f4('0x11')]['message']);}})[_0xf5f4('0x12')](function(_0x53b866){logger[_0xf5f4('0xd')](_0xf5f4('0xb'),_0x57c88e,_0x53b866);_0x546c29(_0x53b866);});});}exports['GetDeskAccount']=function(_0x40fe62){var _0x4e4893=this;return new Promise(function(_0x3f86f8,_0x1e3eff){return db[_0xf5f4('0x13')]['findAll']({'raw':_0x40fe62[_0xf5f4('0x14')]?_0x40fe62[_0xf5f4('0x14')][_0xf5f4('0x15')]===undefined?!![]:![]:!![],'where':_0x40fe62[_0xf5f4('0x14')]?_0x40fe62[_0xf5f4('0x14')][_0xf5f4('0x16')]||null:null,'attributes':_0x40fe62[_0xf5f4('0x14')]?_0x40fe62[_0xf5f4('0x14')]['attributes']||null:null,'limit':_0x40fe62[_0xf5f4('0x14')]?_0x40fe62[_0xf5f4('0x14')][_0xf5f4('0x17')]||null:null,'include':_0x40fe62[_0xf5f4('0x14')]?_0x40fe62['options'][_0xf5f4('0x18')]?_[_0xf5f4('0x19')](_0x40fe62[_0xf5f4('0x14')][_0xf5f4('0x18')],function(_0x37e9db){return{'model':db[_0x37e9db['model']],'as':_0x37e9db['as'],'attributes':_0x37e9db[_0xf5f4('0x1a')],'include':_0x37e9db[_0xf5f4('0x18')]?_[_0xf5f4('0x19')](_0x37e9db[_0xf5f4('0x18')],function(_0x5aa6de){return{'model':db[_0x5aa6de[_0xf5f4('0x1b')]],'as':_0x5aa6de['as'],'attributes':_0x5aa6de['attributes'],'include':_0x5aa6de[_0xf5f4('0x18')]?_[_0xf5f4('0x19')](_0x5aa6de['include'],function(_0x2055df){return{'model':db[_0x2055df[_0xf5f4('0x1b')]],'as':_0x2055df['as'],'attributes':_0x2055df[_0xf5f4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf5f4('0xa')](function(_0xc0fc7a){logger[_0xf5f4('0x10')]('GetDeskAccount',_0x40fe62);logger[_0xf5f4('0x1c')](_0xf5f4('0x1d'),_0x40fe62,JSON[_0xf5f4('0x1e')](_0xc0fc7a));_0x3f86f8(_0xc0fc7a);})[_0xf5f4('0x12')](function(_0x4ddc4d){logger[_0xf5f4('0xd')]('GetDeskAccount',_0x4ddc4d['message'],_0x40fe62);_0x1e3eff(_0x4e4893[_0xf5f4('0xd')](0x1f4,_0x4ddc4d[_0xf5f4('0xf')]));});});};exports[_0xf5f4('0x1f')]=function(_0x4defd3){var _0x3fe9ae=this;return new Promise(function(_0x5ac477,_0x79a44f){return db[_0xf5f4('0x13')][_0xf5f4('0x20')]({'raw':_0x4defd3['options']?_0x4defd3[_0xf5f4('0x14')][_0xf5f4('0x15')]===undefined?!![]:![]:!![],'where':_0x4defd3[_0xf5f4('0x14')]?_0x4defd3[_0xf5f4('0x14')]['where']||null:null,'attributes':_0x4defd3[_0xf5f4('0x14')]?_0x4defd3[_0xf5f4('0x14')][_0xf5f4('0x1a')]||null:null,'include':_0x4defd3[_0xf5f4('0x14')]?_0x4defd3['options'][_0xf5f4('0x18')]?_['map'](_0x4defd3['options'][_0xf5f4('0x18')],function(_0x361e72){return{'model':db[_0x361e72[_0xf5f4('0x1b')]],'as':_0x361e72['as'],'attributes':_0x361e72[_0xf5f4('0x1a')],'include':_0x361e72[_0xf5f4('0x18')]?_[_0xf5f4('0x19')](_0x361e72[_0xf5f4('0x18')],function(_0x338c5d){return{'model':db[_0x338c5d[_0xf5f4('0x1b')]],'as':_0x338c5d['as'],'attributes':_0x338c5d[_0xf5f4('0x1a')],'include':_0x338c5d[_0xf5f4('0x18')]?_['map'](_0x338c5d[_0xf5f4('0x18')],function(_0x41fa29){return{'model':db[_0x41fa29['model']],'as':_0x41fa29['as'],'attributes':_0x41fa29['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f4('0xa')](function(_0x9db4d4){logger['info'](_0xf5f4('0x1f'),_0x4defd3);logger[_0xf5f4('0x1c')](_0xf5f4('0x1f'),_0x4defd3,JSON[_0xf5f4('0x1e')](_0x9db4d4));_0x5ac477(_0x9db4d4);})[_0xf5f4('0x12')](function(_0x30598b){logger[_0xf5f4('0xd')]('ShowDeskAccount',_0x30598b[_0xf5f4('0xf')],_0x4defd3);_0x79a44f(_0x3fe9ae['error'](0x1f4,_0x30598b['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index fc074e8..8757436 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 _0xe3da=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4c57cd,_0x1d685e){var _0x1d3402=function(_0x3ee2b2){while(--_0x3ee2b2){_0x4c57cd['push'](_0x4c57cd['shift']());}};_0x1d3402(++_0x1d685e);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var auth=require(_0xae3d('0x6'));var interaction=require(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var controller=require(_0xae3d('0x9'));router[_0xae3d('0xa')]('/',auth[_0xae3d('0xb')](),controller[_0xae3d('0xc')]);router[_0xae3d('0xa')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller['show']);router[_0xae3d('0xa')](_0xae3d('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xae3d('0xa')](_0xae3d('0xf'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x10')]);router[_0xae3d('0xa')](_0xae3d('0x11'),auth['isAuthenticated'](),controller[_0xae3d('0x12')]);router['get'](_0xae3d('0x13'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x14')]);router[_0xae3d('0x15')]('/',auth['isAuthenticated'](),controller[_0xae3d('0x16')]);router[_0xae3d('0x15')](_0xae3d('0x13'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x17')]);router[_0xae3d('0x18')](_0xae3d('0xd'),auth['isAuthenticated'](),controller[_0xae3d('0x19')]);router[_0xae3d('0x1a')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x1b')]);module[_0xae3d('0x1c')]=router; \ No newline at end of file +var _0x0af5=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','destroy','util'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x0af5,0x158));var _0x50af=function(_0x25f348,_0x2e1005){_0x25f348=_0x25f348-0x0;var _0x4bca71=_0x0af5[_0x25f348];return _0x4bca71;};'use strict';var multer=require('multer');var util=require(_0x50af('0x0'));var path=require(_0x50af('0x1'));var timeout=require(_0x50af('0x2'));var express=require(_0x50af('0x3'));var router=express[_0x50af('0x4')]();var auth=require(_0x50af('0x5'));var interaction=require(_0x50af('0x6'));var config=require(_0x50af('0x7'));var controller=require(_0x50af('0x8'));router[_0x50af('0x9')]('/',auth[_0x50af('0xa')](),controller[_0x50af('0xb')]);router['get']('/:id',auth[_0x50af('0xa')](),controller[_0x50af('0xc')]);router['get']('/:id/fields',auth[_0x50af('0xa')](),controller[_0x50af('0xd')]);router['get']('/:id/subjects',auth[_0x50af('0xa')](),controller[_0x50af('0xe')]);router['get'](_0x50af('0xf'),auth[_0x50af('0xa')](),controller[_0x50af('0x10')]);router[_0x50af('0x9')]('/:id/tags',auth[_0x50af('0xa')](),controller[_0x50af('0x11')]);router[_0x50af('0x12')]('/',auth[_0x50af('0xa')](),controller[_0x50af('0x13')]);router[_0x50af('0x12')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x50af('0x14')]('/:id',auth[_0x50af('0xa')](),controller[_0x50af('0x15')]);router['delete']('/:id',auth[_0x50af('0xa')](),controller[_0x50af('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index de4a77e..a76961a 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 _0x8e15=['sequelize','exports','STRING'];(function(_0x5629d3,_0x1a4ba8){var _0x1d43ca=function(_0x57fe7a){while(--_0x57fe7a){_0x5629d3['push'](_0x5629d3['shift']());}};_0x1d43ca(++_0x1a4ba8);}(_0x8e15,0xd8));var _0x58e1=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0x8e15[_0x311aad];return _0x1779bd;};'use strict';var Sequelize=require(_0x58e1('0x0'));module[_0x58e1('0x1')]={'name':{'type':Sequelize[_0x58e1('0x2')]},'description':{'type':Sequelize[_0x58e1('0x2')]}}; \ No newline at end of file +var _0x690a=['STRING','sequelize','exports'];(function(_0x1cf9b6,_0x209cc3){var _0x27ff1c=function(_0x9535f6){while(--_0x9535f6){_0x1cf9b6['push'](_0x1cf9b6['shift']());}};_0x27ff1c(++_0x209cc3);}(_0x690a,0xf1));var _0xa690=function(_0x40da46,_0x517167){_0x40da46=_0x40da46-0x0;var _0x52bde1=_0x690a[_0x40da46];return _0x52bde1;};'use strict';var Sequelize=require(_0xa690('0x0'));module[_0xa690('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa690('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1189111..dca8c6b 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 _0x5893=['set','Content-Range','reject','save','update','stack','name','send','index','DeskConfiguration','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','type','key','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','destroy','getFields','findOne','filter','getSubjects','keys','DeskField','map','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','ValidationError','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','catch','sendStatus','status','json','count','limit'];(function(_0x451b52,_0x35fadf){var _0x5463b2=function(_0x188c87){while(--_0x188c87){_0x451b52['push'](_0x451b52['shift']());}};_0x5463b2(++_0x35fadf);}(_0x5893,0xf3));var _0x3589=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5893[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3589('0x0'));var rimraf=require(_0x3589('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3589('0x2'));var moment=require(_0x3589('0x3'));var BPromise=require(_0x3589('0x4'));var Mustache=require(_0x3589('0x5'));var util=require(_0x3589('0x6'));var path=require(_0x3589('0x7'));var sox=require('sox');var csv=require(_0x3589('0x8'));var ejs=require(_0x3589('0x9'));var fs=require('fs');var _=require(_0x3589('0xa'));var squel=require(_0x3589('0xb'));var crypto=require(_0x3589('0xc'));var jsforce=require(_0x3589('0xd'));var deskjs=require(_0x3589('0xe'));var toCsv=require(_0x3589('0x8'));var querystring=require(_0x3589('0xf'));var Papa=require(_0x3589('0x10'));var Redis=require(_0x3589('0x11'));var authService=require(_0x3589('0x12'));var qs=require(_0x3589('0x13'));var hardwareService=require(_0x3589('0x14'));var logger=require(_0x3589('0x15'))('api');var utils=require(_0x3589('0x16'));var config=require(_0x3589('0x17'));var db=require(_0x3589('0x18'))['db'];var jayson=require(_0x3589('0x19'));var client=jayson[_0x3589('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0xcfa37,_0x1e5622,_0x4ed63a){if(_0x4ed63a){var _0x17fe0d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17fe0d['test'](_0x1e5622)){return _0xcfa37;}else{throw new db['Sequelize'][(_0x3589('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xcfa37;}}function respondWithRpcPromise(_0x42de54,_0x48dd1f,_0x53371e,_0x3fce9e){return new BPromise(function(_0xd930ed,_0x410b89){var _0x4a04d1=_0x3fce9e||client;return _0x4a04d1[_0x3589('0x1c')](_0x42de54,_0x53371e)[_0x3589('0x1d')](function(_0x5db74f){logger[_0x3589('0x1e')]('DeskConfiguration,\x20%s,\x20%s',_0x48dd1f,'request\x20sent');logger[_0x3589('0x1f')](_0x3589('0x20'),_0x48dd1f,_0x3589('0x21'),JSON[_0x3589('0x22')](_0x5db74f));if(_0x5db74f['error']){if(_0x5db74f[_0x3589('0x23')][_0x3589('0x24')]===0x1f4){logger[_0x3589('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x48dd1f,_0x5db74f[_0x3589('0x23')][_0x3589('0x25')]);return _0x410b89(_0x5db74f[_0x3589('0x23')][_0x3589('0x25')]);}logger['error'](_0x3589('0x26'),_0x48dd1f,_0x5db74f['error'][_0x3589('0x25')]);return _0xd930ed(_0x5db74f[_0x3589('0x23')][_0x3589('0x25')]);}else{logger[_0x3589('0x1e')](_0x3589('0x26'),_0x48dd1f,_0x3589('0x21'));_0xd930ed(_0x5db74f['result']['message']);}})[_0x3589('0x27')](function(_0x19130d){logger[_0x3589('0x23')](_0x3589('0x26'),_0x48dd1f,_0x19130d);_0x410b89(_0x19130d);});});}function respondWithStatusCode(_0x32546e,_0x16eb8a){_0x16eb8a=_0x16eb8a||0xcc;return function(_0x4c446d){if(_0x4c446d){return _0x32546e[_0x3589('0x28')](_0x16eb8a);}return _0x32546e[_0x3589('0x29')](_0x16eb8a)['end']();};}function respondWithResult(_0x3a2e73,_0x38b22a){_0x38b22a=_0x38b22a||0xc8;return function(_0x70a8fc){if(_0x70a8fc){return _0x3a2e73['status'](_0x38b22a)[_0x3589('0x2a')](_0x70a8fc);}};}function respondWithFilteredResult(_0x19bb74,_0x194103){return function(_0x1d855b){if(_0x1d855b){var _0x37ef7a=_0x1d855b[_0x3589('0x2b')],_0x1c7d2a=_0x194103['offset'],_0x4ba09f=_0x194103['offset']+_0x194103[_0x3589('0x2c')],_0x434b16;if(_0x4ba09f>=_0x37ef7a){_0x4ba09f=_0x37ef7a;_0x434b16=0xc8;}else{_0x434b16=0xce;}_0x19bb74[_0x3589('0x29')](_0x434b16);return _0x19bb74[_0x3589('0x2d')](_0x3589('0x2e'),_0x1c7d2a+'-'+_0x4ba09f+'/'+_0x37ef7a)[_0x3589('0x2a')](_0x1d855b);}return null;};}function patchUpdates(_0x2d0820){return function(_0x39e1ba){try{jsonpatch['apply'](_0x39e1ba,_0x2d0820,!![]);}catch(_0x5e79a2){return BPromise[_0x3589('0x2f')](_0x5e79a2);}return _0x39e1ba[_0x3589('0x30')]();};}function saveUpdates(_0x223f6a,_0x494a2f){return function(_0x3d8bf0){if(_0x3d8bf0){return _0x3d8bf0[_0x3589('0x31')](_0x223f6a)[_0x3589('0x1d')](function(_0x5593cc){return _0x5593cc;});}return null;};}function removeEntity(_0x95086,_0x3d15db){return function(_0x34f709){if(_0x34f709){return _0x34f709['destroy']()[_0x3589('0x1d')](function(){_0x95086['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c51d4,_0x3aaf49){return function(_0x2a659e){if(!_0x2a659e){_0x8c51d4[_0x3589('0x28')](0x194);}return _0x2a659e;};}function handleError(_0x31e7a7,_0x3d62cf){_0x3d62cf=_0x3d62cf||0x1f4;return function(_0x5b05e8){logger['error'](_0x5b05e8[_0x3589('0x32')]);if(_0x5b05e8[_0x3589('0x33')]){delete _0x5b05e8['name'];}_0x31e7a7['status'](_0x3d62cf)[_0x3589('0x34')](_0x5b05e8);};}exports[_0x3589('0x35')]=function(_0x1c42be,_0x1d4be9){var _0x40b67f={},_0xcd395c={},_0x4c5695={'count':0x0,'rows':[]};var _0x4b25ef=db[_0x3589('0x36')]['rawAttributes'];_0xcd395c[_0x3589('0x37')]=_['keys'](_0x4b25ef);_0xcd395c[_0x3589('0x38')]=_['keys'](_0x1c42be[_0x3589('0x38')]);_0xcd395c[_0x3589('0x39')]=_[_0x3589('0x3a')](_0xcd395c[_0x3589('0x37')],_0xcd395c[_0x3589('0x38')]);_0x40b67f[_0x3589('0x3b')]=_[_0x3589('0x3a')](_0xcd395c[_0x3589('0x37')],qs[_0x3589('0x3c')](_0x1c42be[_0x3589('0x38')][_0x3589('0x3c')]));_0x40b67f[_0x3589('0x3b')]=_0x40b67f[_0x3589('0x3b')][_0x3589('0x3d')]?_0x40b67f[_0x3589('0x3b')]:_0xcd395c[_0x3589('0x37')];if(!_0x1c42be[_0x3589('0x38')][_0x3589('0x3e')](_0x3589('0x3f'))){_0x40b67f[_0x3589('0x2c')]=qs['limit'](_0x1c42be['query'][_0x3589('0x2c')]);_0x40b67f[_0x3589('0x40')]=qs[_0x3589('0x40')](_0x1c42be['query'][_0x3589('0x40')]);}_0x40b67f[_0x3589('0x41')]=qs[_0x3589('0x42')](_0x1c42be[_0x3589('0x38')]['sort']);_0x40b67f['where']=qs[_0x3589('0x39')](_[_0x3589('0x43')](_0x1c42be[_0x3589('0x38')],_0xcd395c['filters']));if(_0x1c42be[_0x3589('0x38')]['filter']){_0x40b67f[_0x3589('0x44')]=_['merge'](_0x40b67f[_0x3589('0x44')],{'$or':_['map'](_0x4b25ef,function(_0x44fc30){if(_0x44fc30[_0x3589('0x45')][_0x3589('0x46')]!=='VIRTUAL'){var _0x324e73={};_0x324e73[_0x44fc30['field']]={'$like':'%'+_0x1c42be[_0x3589('0x38')]['filter']+'%'};return _0x324e73;}})});}_0x40b67f=_[_0x3589('0x47')]({},_0x40b67f,_0x1c42be[_0x3589('0x48')]);var _0x2afe4d={'where':_0x40b67f[_0x3589('0x44')]};return db[_0x3589('0x36')][_0x3589('0x2b')](_0x2afe4d)[_0x3589('0x1d')](function(_0xbdb571){_0x4c5695[_0x3589('0x2b')]=_0xbdb571;if(_0x1c42be[_0x3589('0x38')][_0x3589('0x49')]){_0x40b67f['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x3589('0x4a')](_0x40b67f);})[_0x3589('0x1d')](function(_0x1bfc13){_0x4c5695[_0x3589('0x4b')]=_0x1bfc13;return _0x4c5695;})[_0x3589('0x1d')](respondWithFilteredResult(_0x1d4be9,_0x40b67f))[_0x3589('0x27')](handleError(_0x1d4be9,null));};exports[_0x3589('0x4c')]=function(_0x4d86d6,_0x359415){var _0x238efa={'raw':![],'where':{'id':_0x4d86d6[_0x3589('0x4d')]['id']}},_0x21db67={};_0x21db67[_0x3589('0x37')]=_['keys'](db[_0x3589('0x36')][_0x3589('0x4e')]);_0x21db67[_0x3589('0x38')]=_['keys'](_0x4d86d6['query']);_0x21db67['filters']=_[_0x3589('0x3a')](_0x21db67['model'],_0x21db67[_0x3589('0x38')]);_0x238efa[_0x3589('0x3b')]=_[_0x3589('0x3a')](_0x21db67[_0x3589('0x37')],qs[_0x3589('0x3c')](_0x4d86d6[_0x3589('0x38')][_0x3589('0x3c')]));_0x238efa[_0x3589('0x3b')]=_0x238efa[_0x3589('0x3b')]['length']?_0x238efa[_0x3589('0x3b')]:_0x21db67[_0x3589('0x37')];if(_0x4d86d6[_0x3589('0x38')][_0x3589('0x49')]){_0x238efa[_0x3589('0x4f')]=[{'all':!![]}];}_0x238efa=_['merge']({},_0x238efa,_0x4d86d6[_0x3589('0x48')]);return db[_0x3589('0x36')][_0x3589('0x50')](_0x238efa)['then'](handleEntityNotFound(_0x359415,null))['then'](respondWithResult(_0x359415,null))[_0x3589('0x27')](handleError(_0x359415,null));};exports[_0x3589('0x51')]=function(_0x20c26e,_0x89c3dc){return db['DeskConfiguration'][_0x3589('0x51')](_0x20c26e[_0x3589('0x52')],{})[_0x3589('0x1d')](respondWithResult(_0x89c3dc,0xc9))[_0x3589('0x27')](handleError(_0x89c3dc,null));};exports[_0x3589('0x31')]=function(_0x3b7f52,_0x28e0f3){if(_0x3b7f52['body']['id']){delete _0x3b7f52[_0x3589('0x52')]['id'];}return db[_0x3589('0x36')][_0x3589('0x50')]({'where':{'id':_0x3b7f52[_0x3589('0x4d')]['id']}})[_0x3589('0x1d')](handleEntityNotFound(_0x28e0f3,null))[_0x3589('0x1d')](saveUpdates(_0x3b7f52['body'],null))[_0x3589('0x1d')](respondWithResult(_0x28e0f3,null))['catch'](handleError(_0x28e0f3,null));};exports[_0x3589('0x53')]=function(_0x362212,_0x5b05ad){return db[_0x3589('0x36')][_0x3589('0x50')]({'where':{'id':_0x362212[_0x3589('0x4d')]['id']}})[_0x3589('0x1d')](handleEntityNotFound(_0x5b05ad,null))[_0x3589('0x1d')](removeEntity(_0x5b05ad,null))['catch'](handleError(_0x5b05ad,null));};exports[_0x3589('0x54')]=function(_0x1c2e1a,_0xa2c40f,_0x596a04){var _0x14e8c5={};var _0x2dfa2d={};var _0x591374;var _0x57205f;return db[_0x3589('0x36')][_0x3589('0x55')]({'where':{'id':_0x1c2e1a[_0x3589('0x4d')]['id']}})[_0x3589('0x1d')](handleEntityNotFound(_0xa2c40f,null))[_0x3589('0x1d')](function(_0x3e13bc){if(_0x3e13bc){_0x591374=_0x3e13bc;_0x2dfa2d['model']=_['keys'](db['DeskField']['rawAttributes']);_0x2dfa2d['query']=_['keys'](_0x1c2e1a[_0x3589('0x38')]);_0x2dfa2d[_0x3589('0x39')]=_[_0x3589('0x3a')](_0x2dfa2d[_0x3589('0x37')],_0x2dfa2d['query']);_0x14e8c5[_0x3589('0x3b')]=_[_0x3589('0x3a')](_0x2dfa2d['model'],qs[_0x3589('0x3c')](_0x1c2e1a[_0x3589('0x38')][_0x3589('0x3c')]));_0x14e8c5[_0x3589('0x3b')]=_0x14e8c5['attributes']['length']?_0x14e8c5['attributes']:_0x2dfa2d[_0x3589('0x37')];_0x14e8c5[_0x3589('0x41')]=qs[_0x3589('0x42')](_0x1c2e1a[_0x3589('0x38')][_0x3589('0x42')]);_0x14e8c5[_0x3589('0x44')]=qs[_0x3589('0x39')](_[_0x3589('0x43')](_0x1c2e1a[_0x3589('0x38')],_0x2dfa2d['filters']));if(_0x1c2e1a['query'][_0x3589('0x56')]){_0x14e8c5[_0x3589('0x44')]=_[_0x3589('0x47')](_0x14e8c5[_0x3589('0x44')],{'$or':_['map'](_0x14e8c5[_0x3589('0x3b')],function(_0x11c613){var _0x287168={};_0x287168[_0x11c613]={'$like':'%'+_0x1c2e1a[_0x3589('0x38')]['filter']+'%'};return _0x287168;})});}_0x14e8c5=_[_0x3589('0x47')]({},_0x14e8c5,_0x1c2e1a['options']);return _0x591374[_0x3589('0x54')](_0x14e8c5);}})[_0x3589('0x1d')](function(_0x58693d){if(_0x58693d){_0x57205f=_0x58693d[_0x3589('0x3d')];if(!_0x1c2e1a[_0x3589('0x38')][_0x3589('0x3e')](_0x3589('0x3f'))){_0x14e8c5['limit']=qs[_0x3589('0x2c')](_0x1c2e1a['query'][_0x3589('0x2c')]);_0x14e8c5[_0x3589('0x40')]=qs[_0x3589('0x40')](_0x1c2e1a['query'][_0x3589('0x40')]);}return _0x591374[_0x3589('0x54')](_0x14e8c5);}})[_0x3589('0x1d')](function(_0x3f0509){if(_0x3f0509){return _0x3f0509?{'count':_0x57205f,'rows':_0x3f0509}:null;}})[_0x3589('0x1d')](respondWithResult(_0xa2c40f,null))[_0x3589('0x27')](handleError(_0xa2c40f,null));};exports[_0x3589('0x57')]=function(_0x21499e,_0x3c4a72,_0x1aa435){var _0x3cf726={};var _0x41d552={};var _0x2afa3e;var _0x75ba61;return db[_0x3589('0x36')][_0x3589('0x55')]({'where':{'id':_0x21499e[_0x3589('0x4d')]['id']}})[_0x3589('0x1d')](handleEntityNotFound(_0x3c4a72,null))[_0x3589('0x1d')](function(_0x14c82b){if(_0x14c82b){_0x2afa3e=_0x14c82b;_0x41d552['model']=_[_0x3589('0x58')](db[_0x3589('0x59')][_0x3589('0x4e')]);_0x41d552['query']=_[_0x3589('0x58')](_0x21499e[_0x3589('0x38')]);_0x41d552[_0x3589('0x39')]=_['intersection'](_0x41d552[_0x3589('0x37')],_0x41d552['query']);_0x3cf726[_0x3589('0x3b')]=_[_0x3589('0x3a')](_0x41d552[_0x3589('0x37')],qs[_0x3589('0x3c')](_0x21499e['query'][_0x3589('0x3c')]));_0x3cf726[_0x3589('0x3b')]=_0x3cf726[_0x3589('0x3b')][_0x3589('0x3d')]?_0x3cf726[_0x3589('0x3b')]:_0x41d552['model'];_0x3cf726[_0x3589('0x41')]=qs['sort'](_0x21499e[_0x3589('0x38')][_0x3589('0x42')]);_0x3cf726[_0x3589('0x44')]=qs[_0x3589('0x39')](_['pick'](_0x21499e['query'],_0x41d552[_0x3589('0x39')]));if(_0x21499e[_0x3589('0x38')][_0x3589('0x56')]){_0x3cf726['where']=_[_0x3589('0x47')](_0x3cf726[_0x3589('0x44')],{'$or':_[_0x3589('0x5a')](_0x3cf726[_0x3589('0x3b')],function(_0x58e733){var _0x597cec={};_0x597cec[_0x58e733]={'$like':'%'+_0x21499e[_0x3589('0x38')][_0x3589('0x56')]+'%'};return _0x597cec;})});}_0x3cf726=_[_0x3589('0x47')]({},_0x3cf726,_0x21499e['options']);return _0x2afa3e[_0x3589('0x57')](_0x3cf726);}})[_0x3589('0x1d')](function(_0x3e1063){if(_0x3e1063){_0x75ba61=_0x3e1063['length'];if(!_0x21499e['query']['hasOwnProperty'](_0x3589('0x3f'))){_0x3cf726['limit']=qs[_0x3589('0x2c')](_0x21499e[_0x3589('0x38')][_0x3589('0x2c')]);_0x3cf726[_0x3589('0x40')]=qs[_0x3589('0x40')](_0x21499e['query']['offset']);}return _0x2afa3e[_0x3589('0x57')](_0x3cf726);}})['then'](function(_0x34cf7f){if(_0x34cf7f){return _0x34cf7f?{'count':_0x75ba61,'rows':_0x34cf7f}:null;}})[_0x3589('0x1d')](respondWithResult(_0x3c4a72,null))[_0x3589('0x27')](handleError(_0x3c4a72,null));};exports[_0x3589('0x5b')]=function(_0x5f5d23,_0x46c870,_0x3eb5e1){var _0x34718f={};var _0x57d8fb={};var _0x38bdb5;var _0x24af28;return db[_0x3589('0x36')][_0x3589('0x55')]({'where':{'id':_0x5f5d23[_0x3589('0x4d')]['id']}})['then'](handleEntityNotFound(_0x46c870,null))['then'](function(_0x2b312e){if(_0x2b312e){_0x38bdb5=_0x2b312e;_0x57d8fb[_0x3589('0x37')]=_['keys'](db['DeskField'][_0x3589('0x4e')]);_0x57d8fb[_0x3589('0x38')]=_['keys'](_0x5f5d23['query']);_0x57d8fb[_0x3589('0x39')]=_[_0x3589('0x3a')](_0x57d8fb['model'],_0x57d8fb[_0x3589('0x38')]);_0x34718f[_0x3589('0x3b')]=_[_0x3589('0x3a')](_0x57d8fb[_0x3589('0x37')],qs[_0x3589('0x3c')](_0x5f5d23[_0x3589('0x38')][_0x3589('0x3c')]));_0x34718f['attributes']=_0x34718f[_0x3589('0x3b')][_0x3589('0x3d')]?_0x34718f['attributes']:_0x57d8fb[_0x3589('0x37')];_0x34718f[_0x3589('0x41')]=qs[_0x3589('0x42')](_0x5f5d23[_0x3589('0x38')][_0x3589('0x42')]);_0x34718f[_0x3589('0x44')]=qs[_0x3589('0x39')](_[_0x3589('0x43')](_0x5f5d23['query'],_0x57d8fb['filters']));if(_0x5f5d23[_0x3589('0x38')][_0x3589('0x56')]){_0x34718f[_0x3589('0x44')]=_['merge'](_0x34718f[_0x3589('0x44')],{'$or':_[_0x3589('0x5a')](_0x34718f[_0x3589('0x3b')],function(_0x58c123){var _0x5d1b91={};_0x5d1b91[_0x58c123]={'$like':'%'+_0x5f5d23[_0x3589('0x38')]['filter']+'%'};return _0x5d1b91;})});}_0x34718f=_[_0x3589('0x47')]({},_0x34718f,_0x5f5d23[_0x3589('0x48')]);return _0x38bdb5[_0x3589('0x5b')](_0x34718f);}})[_0x3589('0x1d')](function(_0x30932e){if(_0x30932e){_0x24af28=_0x30932e[_0x3589('0x3d')];if(!_0x5f5d23[_0x3589('0x38')][_0x3589('0x3e')](_0x3589('0x3f'))){_0x34718f[_0x3589('0x2c')]=qs[_0x3589('0x2c')](_0x5f5d23[_0x3589('0x38')][_0x3589('0x2c')]);_0x34718f['offset']=qs[_0x3589('0x40')](_0x5f5d23[_0x3589('0x38')]['offset']);}return _0x38bdb5[_0x3589('0x5b')](_0x34718f);}})['then'](function(_0x2c7043){if(_0x2c7043){return _0x2c7043?{'count':_0x24af28,'rows':_0x2c7043}:null;}})[_0x3589('0x1d')](respondWithResult(_0x46c870,null))[_0x3589('0x27')](handleError(_0x46c870,null));};exports[_0x3589('0x5c')]=function(_0x59da3f,_0x4747ce,_0x11240b){var _0x34416b={};var _0x2b9a11={};var _0x44abcf;var _0x561395;return db['DeskConfiguration']['findOne']({'where':{'id':_0x59da3f['params']['id']}})['then'](handleEntityNotFound(_0x4747ce,null))[_0x3589('0x1d')](function(_0x1dd213){if(_0x1dd213){_0x44abcf=_0x1dd213;_0x2b9a11[_0x3589('0x37')]=_[_0x3589('0x58')](db[_0x3589('0x5d')][_0x3589('0x4e')]);_0x2b9a11[_0x3589('0x38')]=_[_0x3589('0x58')](_0x59da3f[_0x3589('0x38')]);_0x2b9a11[_0x3589('0x39')]=_['intersection'](_0x2b9a11[_0x3589('0x37')],_0x2b9a11[_0x3589('0x38')]);_0x34416b['attributes']=_[_0x3589('0x3a')](_0x2b9a11[_0x3589('0x37')],qs[_0x3589('0x3c')](_0x59da3f[_0x3589('0x38')][_0x3589('0x3c')]));_0x34416b['attributes']=_0x34416b[_0x3589('0x3b')]['length']?_0x34416b['attributes']:_0x2b9a11[_0x3589('0x37')];_0x34416b[_0x3589('0x41')]=qs[_0x3589('0x42')](_0x59da3f[_0x3589('0x38')][_0x3589('0x42')]);_0x34416b[_0x3589('0x44')]=qs[_0x3589('0x39')](_[_0x3589('0x43')](_0x59da3f[_0x3589('0x38')],_0x2b9a11['filters']));if(_0x59da3f['query'][_0x3589('0x56')]){_0x34416b['where']=_[_0x3589('0x47')](_0x34416b[_0x3589('0x44')],{'$or':_[_0x3589('0x5a')](_0x34416b[_0x3589('0x3b')],function(_0x193af1){var _0x1742bd={};_0x1742bd[_0x193af1]={'$like':'%'+_0x59da3f['query'][_0x3589('0x56')]+'%'};return _0x1742bd;})});}_0x34416b=_[_0x3589('0x47')]({},_0x34416b,_0x59da3f[_0x3589('0x48')]);return _0x44abcf[_0x3589('0x5c')](_0x34416b);}})[_0x3589('0x1d')](function(_0x75b749){if(_0x75b749){_0x561395=_0x75b749[_0x3589('0x3d')];if(!_0x59da3f[_0x3589('0x38')][_0x3589('0x3e')](_0x3589('0x3f'))){_0x34416b[_0x3589('0x2c')]=qs[_0x3589('0x2c')](_0x59da3f[_0x3589('0x38')][_0x3589('0x2c')]);_0x34416b[_0x3589('0x40')]=qs['offset'](_0x59da3f[_0x3589('0x38')][_0x3589('0x40')]);}return _0x44abcf[_0x3589('0x5c')](_0x34416b);}})[_0x3589('0x1d')](function(_0x4e873b){if(_0x4e873b){return _0x4e873b?{'count':_0x561395,'rows':_0x4e873b}:null;}})[_0x3589('0x1d')](respondWithResult(_0x4747ce,null))[_0x3589('0x27')](handleError(_0x4747ce,null));};exports[_0x3589('0x5e')]=function(_0x20d9a6,_0x17add8,_0x3131ae){if(_0x20d9a6[_0x3589('0x52')]['id']){delete _0x20d9a6[_0x3589('0x52')]['id'];}return db[_0x3589('0x36')][_0x3589('0x55')]({'where':{'id':_0x20d9a6[_0x3589('0x4d')]['id']}})[_0x3589('0x1d')](handleEntityNotFound(_0x17add8,null))[_0x3589('0x1d')](function(_0x41aa50){if(_0x41aa50){return _0x41aa50[_0x3589('0x5e')](_0x20d9a6[_0x3589('0x52')][_0x3589('0x5f')]||[]);}return null;})['then'](respondWithResult(_0x17add8,null))['catch'](handleError(_0x17add8,null));}; \ No newline at end of file +var _0x2539=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','key','VIRTUAL','field','filter','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','findOne','DeskField','options','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','moment','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','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~!@#$%^&-_=+[{]}.','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','stack','name','send','DeskConfiguration','rawAttributes','model','keys','query','filters'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2539,0x1e6));var _0x9253=function(_0x5dece1,_0x27c25f){_0x5dece1=_0x5dece1-0x0;var _0x2fd5c1=_0x2539[_0x5dece1];return _0x2fd5c1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9253('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9253('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9253('0x2'));var path=require(_0x9253('0x3'));var sox=require(_0x9253('0x4'));var csv=require(_0x9253('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9253('0x6'));var squel=require(_0x9253('0x7'));var crypto=require(_0x9253('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x9253('0x9'));var toCsv=require(_0x9253('0x5'));var querystring=require('querystring');var Papa=require(_0x9253('0xa'));var Redis=require(_0x9253('0xb'));var authService=require(_0x9253('0xc'));var qs=require(_0x9253('0xd'));var hardwareService=require(_0x9253('0xe'));var logger=require('../../config/logger')(_0x9253('0xf'));var utils=require(_0x9253('0x10'));var config=require(_0x9253('0x11'));var db=require(_0x9253('0x12'))['db'];var jayson=require(_0x9253('0x13'));var client=jayson[_0x9253('0x14')][_0x9253('0x15')]({'port':0x232a});function checkPasswordPattern(_0x22b5dc,_0x4b5ecd,_0x36f24b){if(_0x36f24b){var _0x394bdd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x394bdd[_0x9253('0x16')](_0x4b5ecd)){return _0x22b5dc;}else{throw new db[(_0x9253('0x17'))]['ValidationError'](_0x9253('0x18'));}}else{return _0x22b5dc;}}function respondWithRpcPromise(_0x41cef2,_0x1fff75,_0x4023c6,_0x4199b1){return new BPromise(function(_0x1864af,_0x489dd7){var _0x2c0ae1=_0x4199b1||client;return _0x2c0ae1['request'](_0x41cef2,_0x4023c6)[_0x9253('0x19')](function(_0x3136c5){logger['info'](_0x9253('0x1a'),_0x1fff75,_0x9253('0x1b'));logger['debug'](_0x9253('0x1c'),_0x1fff75,_0x9253('0x1b'),JSON[_0x9253('0x1d')](_0x3136c5));if(_0x3136c5[_0x9253('0x1e')]){if(_0x3136c5[_0x9253('0x1e')]['code']===0x1f4){logger['error'](_0x9253('0x1a'),_0x1fff75,_0x3136c5[_0x9253('0x1e')][_0x9253('0x1f')]);return _0x489dd7(_0x3136c5[_0x9253('0x1e')]['message']);}logger[_0x9253('0x1e')](_0x9253('0x1a'),_0x1fff75,_0x3136c5[_0x9253('0x1e')][_0x9253('0x1f')]);return _0x1864af(_0x3136c5[_0x9253('0x1e')][_0x9253('0x1f')]);}else{logger[_0x9253('0x20')](_0x9253('0x1a'),_0x1fff75,_0x9253('0x1b'));_0x1864af(_0x3136c5[_0x9253('0x21')][_0x9253('0x1f')]);}})['catch'](function(_0xa428e3){logger[_0x9253('0x1e')](_0x9253('0x1a'),_0x1fff75,_0xa428e3);_0x489dd7(_0xa428e3);});});}function respondWithStatusCode(_0x5476ee,_0x392040){_0x392040=_0x392040||0xcc;return function(_0x1c4ceb){if(_0x1c4ceb){return _0x5476ee[_0x9253('0x22')](_0x392040);}return _0x5476ee[_0x9253('0x23')](_0x392040)[_0x9253('0x24')]();};}function respondWithResult(_0x229c8c,_0x4247ae){_0x4247ae=_0x4247ae||0xc8;return function(_0xfadb8b){if(_0xfadb8b){return _0x229c8c[_0x9253('0x23')](_0x4247ae)[_0x9253('0x25')](_0xfadb8b);}};}function respondWithFilteredResult(_0x5a37e5,_0x4b00fb){return function(_0x2ad123){if(_0x2ad123){var _0x20eb48=_0x2ad123[_0x9253('0x26')],_0x2dd607=_0x4b00fb[_0x9253('0x27')],_0x5d88b6=_0x4b00fb[_0x9253('0x27')]+_0x4b00fb[_0x9253('0x28')],_0x49af2c;if(_0x5d88b6>=_0x20eb48){_0x5d88b6=_0x20eb48;_0x49af2c=0xc8;}else{_0x49af2c=0xce;}_0x5a37e5[_0x9253('0x23')](_0x49af2c);return _0x5a37e5['set']('Content-Range',_0x2dd607+'-'+_0x5d88b6+'/'+_0x20eb48)[_0x9253('0x25')](_0x2ad123);}return null;};}function patchUpdates(_0x523b30){return function(_0x54c3ec){try{jsonpatch[_0x9253('0x29')](_0x54c3ec,_0x523b30,!![]);}catch(_0x4b2196){return BPromise[_0x9253('0x2a')](_0x4b2196);}return _0x54c3ec[_0x9253('0x2b')]();};}function saveUpdates(_0x11adb0,_0x14fbd4){return function(_0x29634b){if(_0x29634b){return _0x29634b[_0x9253('0x2c')](_0x11adb0)[_0x9253('0x19')](function(_0x228719){return _0x228719;});}return null;};}function removeEntity(_0x339d43,_0x1df865){return function(_0x1ca979){if(_0x1ca979){return _0x1ca979['destroy']()['then'](function(){_0x339d43[_0x9253('0x23')](0xcc)[_0x9253('0x24')]();});}};}function handleEntityNotFound(_0x1e4c51,_0x388665){return function(_0x5ba701){if(!_0x5ba701){_0x1e4c51[_0x9253('0x22')](0x194);}return _0x5ba701;};}function handleError(_0x5c09e8,_0x50ea90){_0x50ea90=_0x50ea90||0x1f4;return function(_0xae293e){logger[_0x9253('0x1e')](_0xae293e[_0x9253('0x2d')]);if(_0xae293e['name']){delete _0xae293e[_0x9253('0x2e')];}_0x5c09e8[_0x9253('0x23')](_0x50ea90)[_0x9253('0x2f')](_0xae293e);};}exports['index']=function(_0x56dfd8,_0x52d904){var _0x13f4b6={},_0x321127={},_0x3ee362={'count':0x0,'rows':[]};var _0x521c0c=db[_0x9253('0x30')][_0x9253('0x31')];_0x321127[_0x9253('0x32')]=_[_0x9253('0x33')](_0x521c0c);_0x321127[_0x9253('0x34')]=_[_0x9253('0x33')](_0x56dfd8['query']);_0x321127[_0x9253('0x35')]=_['intersection'](_0x321127[_0x9253('0x32')],_0x321127[_0x9253('0x34')]);_0x13f4b6[_0x9253('0x36')]=_[_0x9253('0x37')](_0x321127[_0x9253('0x32')],qs[_0x9253('0x38')](_0x56dfd8[_0x9253('0x34')][_0x9253('0x38')]));_0x13f4b6['attributes']=_0x13f4b6[_0x9253('0x36')][_0x9253('0x39')]?_0x13f4b6[_0x9253('0x36')]:_0x321127['model'];if(!_0x56dfd8[_0x9253('0x34')][_0x9253('0x3a')](_0x9253('0x3b'))){_0x13f4b6[_0x9253('0x28')]=qs[_0x9253('0x28')](_0x56dfd8[_0x9253('0x34')]['limit']);_0x13f4b6[_0x9253('0x27')]=qs[_0x9253('0x27')](_0x56dfd8['query'][_0x9253('0x27')]);}_0x13f4b6[_0x9253('0x3c')]=qs[_0x9253('0x3d')](_0x56dfd8[_0x9253('0x34')]['sort']);_0x13f4b6['where']=qs[_0x9253('0x35')](_[_0x9253('0x3e')](_0x56dfd8['query'],_0x321127[_0x9253('0x35')]));if(_0x56dfd8[_0x9253('0x34')]['filter']){_0x13f4b6[_0x9253('0x3f')]=_[_0x9253('0x40')](_0x13f4b6[_0x9253('0x3f')],{'$or':_[_0x9253('0x41')](_0x521c0c,function(_0x2e2b4b){if(_0x2e2b4b[_0x9253('0x42')][_0x9253('0x43')]!==_0x9253('0x44')){var _0x60471b={};_0x60471b[_0x2e2b4b[_0x9253('0x45')]]={'$like':'%'+_0x56dfd8[_0x9253('0x34')][_0x9253('0x46')]+'%'};return _0x60471b;}})});}_0x13f4b6=_[_0x9253('0x40')]({},_0x13f4b6,_0x56dfd8['options']);var _0x4c4e99={'where':_0x13f4b6[_0x9253('0x3f')]};return db[_0x9253('0x30')][_0x9253('0x26')](_0x4c4e99)[_0x9253('0x19')](function(_0x3004a7){_0x3ee362['count']=_0x3004a7;if(_0x56dfd8['query'][_0x9253('0x47')]){_0x13f4b6[_0x9253('0x48')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x9253('0x49')](_0x13f4b6);})[_0x9253('0x19')](function(_0x41e04f){_0x3ee362[_0x9253('0x4a')]=_0x41e04f;return _0x3ee362;})[_0x9253('0x19')](respondWithFilteredResult(_0x52d904,_0x13f4b6))[_0x9253('0x4b')](handleError(_0x52d904,null));};exports['show']=function(_0x2c1685,_0x3d2d6d){var _0x85d9b9={'raw':![],'where':{'id':_0x2c1685[_0x9253('0x4c')]['id']}},_0x5f1c48={};_0x5f1c48[_0x9253('0x32')]=_[_0x9253('0x33')](db[_0x9253('0x30')][_0x9253('0x31')]);_0x5f1c48[_0x9253('0x34')]=_[_0x9253('0x33')](_0x2c1685[_0x9253('0x34')]);_0x5f1c48['filters']=_['intersection'](_0x5f1c48[_0x9253('0x32')],_0x5f1c48['query']);_0x85d9b9['attributes']=_['intersection'](_0x5f1c48[_0x9253('0x32')],qs[_0x9253('0x38')](_0x2c1685[_0x9253('0x34')][_0x9253('0x38')]));_0x85d9b9[_0x9253('0x36')]=_0x85d9b9[_0x9253('0x36')][_0x9253('0x39')]?_0x85d9b9[_0x9253('0x36')]:_0x5f1c48[_0x9253('0x32')];if(_0x2c1685[_0x9253('0x34')][_0x9253('0x47')]){_0x85d9b9[_0x9253('0x48')]=[{'all':!![]}];}_0x85d9b9=_[_0x9253('0x40')]({},_0x85d9b9,_0x2c1685['options']);return db[_0x9253('0x30')][_0x9253('0x4d')](_0x85d9b9)[_0x9253('0x19')](handleEntityNotFound(_0x3d2d6d,null))[_0x9253('0x19')](respondWithResult(_0x3d2d6d,null))[_0x9253('0x4b')](handleError(_0x3d2d6d,null));};exports[_0x9253('0x4e')]=function(_0x42e9e7,_0x34b768){return db[_0x9253('0x30')]['create'](_0x42e9e7[_0x9253('0x4f')],{})['then'](respondWithResult(_0x34b768,0xc9))[_0x9253('0x4b')](handleError(_0x34b768,null));};exports[_0x9253('0x2c')]=function(_0x113867,_0x5c0730){if(_0x113867[_0x9253('0x4f')]['id']){delete _0x113867[_0x9253('0x4f')]['id'];}return db[_0x9253('0x30')][_0x9253('0x4d')]({'where':{'id':_0x113867[_0x9253('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c0730,null))[_0x9253('0x19')](saveUpdates(_0x113867[_0x9253('0x4f')],null))['then'](respondWithResult(_0x5c0730,null))[_0x9253('0x4b')](handleError(_0x5c0730,null));};exports[_0x9253('0x50')]=function(_0x5c483a,_0xeda3c3){return db[_0x9253('0x30')][_0x9253('0x4d')]({'where':{'id':_0x5c483a[_0x9253('0x4c')]['id']}})['then'](handleEntityNotFound(_0xeda3c3,null))[_0x9253('0x19')](removeEntity(_0xeda3c3,null))[_0x9253('0x4b')](handleError(_0xeda3c3,null));};exports['getFields']=function(_0x4d0aff,_0x37843e,_0x5974d4){var _0x37d1e4={};var _0x35f049={};var _0x1f3a8e;var _0x53758d;return db[_0x9253('0x30')][_0x9253('0x51')]({'where':{'id':_0x4d0aff[_0x9253('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37843e,null))[_0x9253('0x19')](function(_0x38c23c){if(_0x38c23c){_0x1f3a8e=_0x38c23c;_0x35f049[_0x9253('0x32')]=_[_0x9253('0x33')](db[_0x9253('0x52')][_0x9253('0x31')]);_0x35f049[_0x9253('0x34')]=_[_0x9253('0x33')](_0x4d0aff['query']);_0x35f049[_0x9253('0x35')]=_[_0x9253('0x37')](_0x35f049[_0x9253('0x32')],_0x35f049[_0x9253('0x34')]);_0x37d1e4[_0x9253('0x36')]=_['intersection'](_0x35f049[_0x9253('0x32')],qs['fields'](_0x4d0aff[_0x9253('0x34')]['fields']));_0x37d1e4['attributes']=_0x37d1e4[_0x9253('0x36')]['length']?_0x37d1e4[_0x9253('0x36')]:_0x35f049[_0x9253('0x32')];_0x37d1e4[_0x9253('0x3c')]=qs[_0x9253('0x3d')](_0x4d0aff[_0x9253('0x34')][_0x9253('0x3d')]);_0x37d1e4[_0x9253('0x3f')]=qs[_0x9253('0x35')](_[_0x9253('0x3e')](_0x4d0aff[_0x9253('0x34')],_0x35f049[_0x9253('0x35')]));if(_0x4d0aff[_0x9253('0x34')][_0x9253('0x46')]){_0x37d1e4[_0x9253('0x3f')]=_[_0x9253('0x40')](_0x37d1e4['where'],{'$or':_[_0x9253('0x41')](_0x37d1e4['attributes'],function(_0x142238){var _0x121b16={};_0x121b16[_0x142238]={'$like':'%'+_0x4d0aff[_0x9253('0x34')]['filter']+'%'};return _0x121b16;})});}_0x37d1e4=_[_0x9253('0x40')]({},_0x37d1e4,_0x4d0aff[_0x9253('0x53')]);return _0x1f3a8e[_0x9253('0x54')](_0x37d1e4);}})['then'](function(_0x574f68){if(_0x574f68){_0x53758d=_0x574f68[_0x9253('0x39')];if(!_0x4d0aff[_0x9253('0x34')][_0x9253('0x3a')](_0x9253('0x3b'))){_0x37d1e4['limit']=qs[_0x9253('0x28')](_0x4d0aff[_0x9253('0x34')]['limit']);_0x37d1e4['offset']=qs[_0x9253('0x27')](_0x4d0aff[_0x9253('0x34')][_0x9253('0x27')]);}return _0x1f3a8e[_0x9253('0x54')](_0x37d1e4);}})[_0x9253('0x19')](function(_0x57aeb5){if(_0x57aeb5){return _0x57aeb5?{'count':_0x53758d,'rows':_0x57aeb5}:null;}})['then'](respondWithResult(_0x37843e,null))['catch'](handleError(_0x37843e,null));};exports['getSubjects']=function(_0x3ea4d7,_0x305b76,_0x563069){var _0x13c852={};var _0x59b1d2={};var _0x3c5285;var _0x3be06b;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3ea4d7[_0x9253('0x4c')]['id']}})[_0x9253('0x19')](handleEntityNotFound(_0x305b76,null))[_0x9253('0x19')](function(_0x4a58f5){if(_0x4a58f5){_0x3c5285=_0x4a58f5;_0x59b1d2['model']=_[_0x9253('0x33')](db[_0x9253('0x52')][_0x9253('0x31')]);_0x59b1d2['query']=_[_0x9253('0x33')](_0x3ea4d7['query']);_0x59b1d2[_0x9253('0x35')]=_[_0x9253('0x37')](_0x59b1d2[_0x9253('0x32')],_0x59b1d2['query']);_0x13c852[_0x9253('0x36')]=_[_0x9253('0x37')](_0x59b1d2[_0x9253('0x32')],qs[_0x9253('0x38')](_0x3ea4d7[_0x9253('0x34')][_0x9253('0x38')]));_0x13c852[_0x9253('0x36')]=_0x13c852['attributes']['length']?_0x13c852[_0x9253('0x36')]:_0x59b1d2['model'];_0x13c852[_0x9253('0x3c')]=qs[_0x9253('0x3d')](_0x3ea4d7[_0x9253('0x34')][_0x9253('0x3d')]);_0x13c852[_0x9253('0x3f')]=qs[_0x9253('0x35')](_['pick'](_0x3ea4d7['query'],_0x59b1d2[_0x9253('0x35')]));if(_0x3ea4d7[_0x9253('0x34')][_0x9253('0x46')]){_0x13c852[_0x9253('0x3f')]=_[_0x9253('0x40')](_0x13c852[_0x9253('0x3f')],{'$or':_[_0x9253('0x41')](_0x13c852[_0x9253('0x36')],function(_0x4d7acb){var _0x1c7f59={};_0x1c7f59[_0x4d7acb]={'$like':'%'+_0x3ea4d7['query']['filter']+'%'};return _0x1c7f59;})});}_0x13c852=_[_0x9253('0x40')]({},_0x13c852,_0x3ea4d7[_0x9253('0x53')]);return _0x3c5285[_0x9253('0x55')](_0x13c852);}})['then'](function(_0x21091f){if(_0x21091f){_0x3be06b=_0x21091f[_0x9253('0x39')];if(!_0x3ea4d7[_0x9253('0x34')][_0x9253('0x3a')](_0x9253('0x3b'))){_0x13c852['limit']=qs[_0x9253('0x28')](_0x3ea4d7[_0x9253('0x34')][_0x9253('0x28')]);_0x13c852[_0x9253('0x27')]=qs[_0x9253('0x27')](_0x3ea4d7[_0x9253('0x34')][_0x9253('0x27')]);}return _0x3c5285[_0x9253('0x55')](_0x13c852);}})[_0x9253('0x19')](function(_0x5baf18){if(_0x5baf18){return _0x5baf18?{'count':_0x3be06b,'rows':_0x5baf18}:null;}})[_0x9253('0x19')](respondWithResult(_0x305b76,null))['catch'](handleError(_0x305b76,null));};exports[_0x9253('0x56')]=function(_0x53a028,_0x12be4d,_0x1469d4){var _0x416cf8={};var _0x168fac={};var _0x1086e6;var _0x44b28a;return db['DeskConfiguration'][_0x9253('0x51')]({'where':{'id':_0x53a028['params']['id']}})[_0x9253('0x19')](handleEntityNotFound(_0x12be4d,null))[_0x9253('0x19')](function(_0x3d58cd){if(_0x3d58cd){_0x1086e6=_0x3d58cd;_0x168fac[_0x9253('0x32')]=_[_0x9253('0x33')](db[_0x9253('0x52')][_0x9253('0x31')]);_0x168fac[_0x9253('0x34')]=_['keys'](_0x53a028['query']);_0x168fac[_0x9253('0x35')]=_['intersection'](_0x168fac[_0x9253('0x32')],_0x168fac['query']);_0x416cf8[_0x9253('0x36')]=_[_0x9253('0x37')](_0x168fac['model'],qs[_0x9253('0x38')](_0x53a028[_0x9253('0x34')]['fields']));_0x416cf8['attributes']=_0x416cf8[_0x9253('0x36')][_0x9253('0x39')]?_0x416cf8['attributes']:_0x168fac['model'];_0x416cf8[_0x9253('0x3c')]=qs[_0x9253('0x3d')](_0x53a028[_0x9253('0x34')][_0x9253('0x3d')]);_0x416cf8[_0x9253('0x3f')]=qs['filters'](_['pick'](_0x53a028[_0x9253('0x34')],_0x168fac[_0x9253('0x35')]));if(_0x53a028[_0x9253('0x34')][_0x9253('0x46')]){_0x416cf8[_0x9253('0x3f')]=_[_0x9253('0x40')](_0x416cf8[_0x9253('0x3f')],{'$or':_['map'](_0x416cf8['attributes'],function(_0x3e0093){var _0x431235={};_0x431235[_0x3e0093]={'$like':'%'+_0x53a028['query']['filter']+'%'};return _0x431235;})});}_0x416cf8=_[_0x9253('0x40')]({},_0x416cf8,_0x53a028[_0x9253('0x53')]);return _0x1086e6[_0x9253('0x56')](_0x416cf8);}})['then'](function(_0x312328){if(_0x312328){_0x44b28a=_0x312328[_0x9253('0x39')];if(!_0x53a028[_0x9253('0x34')][_0x9253('0x3a')](_0x9253('0x3b'))){_0x416cf8[_0x9253('0x28')]=qs['limit'](_0x53a028[_0x9253('0x34')][_0x9253('0x28')]);_0x416cf8['offset']=qs[_0x9253('0x27')](_0x53a028['query'][_0x9253('0x27')]);}return _0x1086e6['getDescriptions'](_0x416cf8);}})['then'](function(_0x149aa7){if(_0x149aa7){return _0x149aa7?{'count':_0x44b28a,'rows':_0x149aa7}:null;}})[_0x9253('0x19')](respondWithResult(_0x12be4d,null))[_0x9253('0x4b')](handleError(_0x12be4d,null));};exports[_0x9253('0x57')]=function(_0xa65da3,_0x2bc956,_0x250312){var _0x160490={};var _0xda0d23={};var _0x43f3ae;var _0x549e9b;return db[_0x9253('0x30')][_0x9253('0x51')]({'where':{'id':_0xa65da3[_0x9253('0x4c')]['id']}})[_0x9253('0x19')](handleEntityNotFound(_0x2bc956,null))[_0x9253('0x19')](function(_0x587b61){if(_0x587b61){_0x43f3ae=_0x587b61;_0xda0d23[_0x9253('0x32')]=_[_0x9253('0x33')](db[_0x9253('0x58')][_0x9253('0x31')]);_0xda0d23['query']=_[_0x9253('0x33')](_0xa65da3[_0x9253('0x34')]);_0xda0d23[_0x9253('0x35')]=_['intersection'](_0xda0d23[_0x9253('0x32')],_0xda0d23['query']);_0x160490[_0x9253('0x36')]=_[_0x9253('0x37')](_0xda0d23[_0x9253('0x32')],qs[_0x9253('0x38')](_0xa65da3[_0x9253('0x34')]['fields']));_0x160490['attributes']=_0x160490[_0x9253('0x36')]['length']?_0x160490[_0x9253('0x36')]:_0xda0d23[_0x9253('0x32')];_0x160490[_0x9253('0x3c')]=qs['sort'](_0xa65da3[_0x9253('0x34')]['sort']);_0x160490[_0x9253('0x3f')]=qs[_0x9253('0x35')](_[_0x9253('0x3e')](_0xa65da3[_0x9253('0x34')],_0xda0d23[_0x9253('0x35')]));if(_0xa65da3['query'][_0x9253('0x46')]){_0x160490[_0x9253('0x3f')]=_[_0x9253('0x40')](_0x160490['where'],{'$or':_['map'](_0x160490['attributes'],function(_0x1389df){var _0x4d36ac={};_0x4d36ac[_0x1389df]={'$like':'%'+_0xa65da3[_0x9253('0x34')][_0x9253('0x46')]+'%'};return _0x4d36ac;})});}_0x160490=_['merge']({},_0x160490,_0xa65da3['options']);return _0x43f3ae[_0x9253('0x57')](_0x160490);}})[_0x9253('0x19')](function(_0x2f4359){if(_0x2f4359){_0x549e9b=_0x2f4359[_0x9253('0x39')];if(!_0xa65da3[_0x9253('0x34')]['hasOwnProperty'](_0x9253('0x3b'))){_0x160490['limit']=qs[_0x9253('0x28')](_0xa65da3['query']['limit']);_0x160490['offset']=qs['offset'](_0xa65da3[_0x9253('0x34')][_0x9253('0x27')]);}return _0x43f3ae[_0x9253('0x57')](_0x160490);}})[_0x9253('0x19')](function(_0x34c5e5){if(_0x34c5e5){return _0x34c5e5?{'count':_0x549e9b,'rows':_0x34c5e5}:null;}})[_0x9253('0x19')](respondWithResult(_0x2bc956,null))[_0x9253('0x4b')](handleError(_0x2bc956,null));};exports[_0x9253('0x59')]=function(_0x2923f4,_0x5154c,_0x2d5044){if(_0x2923f4['body']['id']){delete _0x2923f4[_0x9253('0x4f')]['id'];}return db[_0x9253('0x30')]['findOne']({'where':{'id':_0x2923f4['params']['id']}})[_0x9253('0x19')](handleEntityNotFound(_0x5154c,null))[_0x9253('0x19')](function(_0x53ca31){if(_0x53ca31){return _0x53ca31[_0x9253('0x59')](_0x2923f4['body']['ids']||[]);}return null;})[_0x9253('0x19')](respondWithResult(_0x5154c,null))[_0x9253('0x4b')](handleError(_0x5154c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c37e2be..565dd5f 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 _0xd45c=['exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x24a2ab,_0x22b1e9){var _0x1aff56=function(_0x3453e6){while(--_0x3453e6){_0x24a2ab['push'](_0x24a2ab['shift']());}};_0x1aff56(++_0x22b1e9);}(_0xd45c,0x1b6));var _0xcd45=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd45c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xcd45('0x0'));var util=require(_0xcd45('0x1'));var logger=require('../../config/logger')(_0xcd45('0x2'));var moment=require(_0xcd45('0x3'));var BPromise=require(_0xcd45('0x4'));var rp=require(_0xcd45('0x5'));var fs=require('fs');var path=require(_0xcd45('0x6'));var rimraf=require(_0xcd45('0x7'));var config=require(_0xcd45('0x8'));var attributes=require(_0xcd45('0x9'));module[_0xcd45('0xa')]=function(_0x4a8fdd,_0xd0a401){return _0x4a8fdd[_0xcd45('0xb')](_0xcd45('0xc'),attributes,{'tableName':_0xcd45('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc85f=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b33d9,_0x59eeca){var _0x24a30e=function(_0x226e92){while(--_0x226e92){_0x2b33d9['push'](_0x2b33d9['shift']());}};_0x24a30e(++_0x59eeca);}(_0xc85f,0x12f));var _0xfc85=function(_0x3420e2,_0x3f70fe){_0x3420e2=_0x3420e2-0x0;var _0x571430=_0xc85f[_0x3420e2];return _0x571430;};'use strict';var _=require(_0xfc85('0x0'));var util=require(_0xfc85('0x1'));var logger=require(_0xfc85('0x2'))(_0xfc85('0x3'));var moment=require(_0xfc85('0x4'));var BPromise=require(_0xfc85('0x5'));var rp=require(_0xfc85('0x6'));var fs=require('fs');var path=require(_0xfc85('0x7'));var rimraf=require(_0xfc85('0x8'));var config=require('../../config/environment');var attributes=require(_0xfc85('0x9'));module[_0xfc85('0xa')]=function(_0x205158,_0x5f138a){return _0x205158[_0xfc85('0xb')](_0xfc85('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 70f7a4e..5a4bc80 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 _0x90ae=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x90ae,0x195));var _0xe90a=function(_0x235747,_0x4d2d27){_0x235747=_0x235747-0x0;var _0x4a16fa=_0x90ae[_0x235747];return _0x4a16fa;};'use strict';var _=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var moment=require(_0xe90a('0x2'));var BPromise=require('bluebird');var rs=require(_0xe90a('0x3'));var fs=require('fs');var Redis=require(_0xe90a('0x4'));var db=require(_0xe90a('0x5'))['db'];var utils=require(_0xe90a('0x6'));var logger=require(_0xe90a('0x7'))(_0xe90a('0x8'));var config=require(_0xe90a('0x9'));var jayson=require(_0xe90a('0xa'));var client=jayson[_0xe90a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x203575,_0x280721,_0x24b470){return new BPromise(function(_0x42fb64,_0x11cd54){return client[_0xe90a('0xc')](_0x203575,_0x24b470)['then'](function(_0x24c73f){logger[_0xe90a('0xd')](_0xe90a('0xe'),_0x280721,_0xe90a('0xf'));logger[_0xe90a('0x10')](_0xe90a('0x11'),_0x280721,_0xe90a('0xf'),JSON['stringify'](_0x24c73f));if(_0x24c73f[_0xe90a('0x12')]){if(_0x24c73f[_0xe90a('0x12')]['code']===0x1f4){logger['error'](_0xe90a('0xe'),_0x280721,_0x24c73f[_0xe90a('0x12')]['message']);return _0x11cd54(_0x24c73f[_0xe90a('0x12')][_0xe90a('0x13')]);}logger[_0xe90a('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x280721,_0x24c73f[_0xe90a('0x12')][_0xe90a('0x13')]);return _0x42fb64(_0x24c73f['error'][_0xe90a('0x13')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x280721,'request\x20sent');_0x42fb64(_0x24c73f[_0xe90a('0x14')][_0xe90a('0x13')]);}})[_0xe90a('0x15')](function(_0x22602f){logger[_0xe90a('0x12')](_0xe90a('0xe'),_0x280721,_0x22602f);_0x11cd54(_0x22602f);});});} \ No newline at end of file +var _0x2e35=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x27acda,_0x4c11a6){var _0x47f760=function(_0xc481bc){while(--_0xc481bc){_0x27acda['push'](_0x27acda['shift']());}};_0x47f760(++_0x4c11a6);}(_0x2e35,0x1d0));var _0x52e3=function(_0x2e5f00,_0x58b06e){_0x2e5f00=_0x2e5f00-0x0;var _0x52c140=_0x2e35[_0x2e5f00];return _0x52c140;};'use strict';var _=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var moment=require(_0x52e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x52e3('0x3'));var fs=require('fs');var Redis=require(_0x52e3('0x4'));var db=require(_0x52e3('0x5'))['db'];var utils=require(_0x52e3('0x6'));var logger=require('../../config/logger')(_0x52e3('0x7'));var config=require(_0x52e3('0x8'));var jayson=require(_0x52e3('0x9'));var client=jayson[_0x52e3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x483b93,_0x507a6c,_0x21ae13){return new BPromise(function(_0x4d77a0,_0x4b2662){return client[_0x52e3('0xb')](_0x483b93,_0x21ae13)[_0x52e3('0xc')](function(_0x551848){logger[_0x52e3('0xd')](_0x52e3('0xe'),_0x507a6c,'request\x20sent');logger[_0x52e3('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x507a6c,_0x52e3('0x10'),JSON[_0x52e3('0x11')](_0x551848));if(_0x551848[_0x52e3('0x12')]){if(_0x551848['error'][_0x52e3('0x13')]===0x1f4){logger[_0x52e3('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x507a6c,_0x551848[_0x52e3('0x12')]['message']);return _0x4b2662(_0x551848['error']['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x507a6c,_0x551848[_0x52e3('0x12')][_0x52e3('0x14')]);return _0x4d77a0(_0x551848[_0x52e3('0x12')][_0x52e3('0x14')]);}else{logger[_0x52e3('0xd')](_0x52e3('0xe'),_0x507a6c,_0x52e3('0x10'));_0x4d77a0(_0x551848[_0x52e3('0x15')][_0x52e3('0x14')]);}})[_0x52e3('0x16')](function(_0x3355e7){logger['error'](_0x52e3('0xe'),_0x507a6c,_0x3355e7);_0x4b2662(_0x3355e7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index d4c0c99..b4b15a6 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 _0x9f9d=['show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','get','/:id'];(function(_0x4334af,_0x21e066){var _0xec5be0=function(_0x1ee788){while(--_0x1ee788){_0x4334af['push'](_0x4334af['shift']());}};_0xec5be0(++_0x21e066);}(_0x9f9d,0x19f));var _0xd9f9=function(_0x310bef,_0x38797c){_0x310bef=_0x310bef-0x0;var _0x59716f=_0x9f9d[_0x310bef];return _0x59716f;};'use strict';var multer=require(_0xd9f9('0x0'));var util=require(_0xd9f9('0x1'));var path=require('path');var timeout=require(_0xd9f9('0x2'));var express=require('express');var router=express[_0xd9f9('0x3')]();var auth=require(_0xd9f9('0x4'));var interaction=require(_0xd9f9('0x5'));var config=require('../../config/environment');var controller=require(_0xd9f9('0x6'));router['get']('/',auth[_0xd9f9('0x7')](),controller['index']);router[_0xd9f9('0x8')](_0xd9f9('0x9'),auth[_0xd9f9('0x7')](),controller[_0xd9f9('0xa')]);router[_0xd9f9('0xb')]('/',auth[_0xd9f9('0x7')](),controller['create']);router[_0xd9f9('0xc')](_0xd9f9('0x9'),auth[_0xd9f9('0x7')](),controller[_0xd9f9('0xd')]);router[_0xd9f9('0xe')](_0xd9f9('0x9'),auth[_0xd9f9('0x7')](),controller[_0xd9f9('0xf')]);module[_0xd9f9('0x10')]=router; \ No newline at end of file +var _0xbb58=['show','post','isAuthenticated','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x145f26,_0x5b5422){var _0x435fa5=function(_0x3a01c6){while(--_0x3a01c6){_0x145f26['push'](_0x145f26['shift']());}};_0x435fa5(++_0x5b5422);}(_0xbb58,0x170));var _0x8bb5=function(_0x34910e,_0x3ed182){_0x34910e=_0x34910e-0x0;var _0x24cc8b=_0xbb58[_0x34910e];return _0x24cc8b;};'use strict';var multer=require(_0x8bb5('0x0'));var util=require(_0x8bb5('0x1'));var path=require(_0x8bb5('0x2'));var timeout=require(_0x8bb5('0x3'));var express=require(_0x8bb5('0x4'));var router=express[_0x8bb5('0x5')]();var auth=require(_0x8bb5('0x6'));var interaction=require(_0x8bb5('0x7'));var config=require(_0x8bb5('0x8'));var controller=require('./intDeskField.controller');router[_0x8bb5('0x9')]('/',auth['isAuthenticated'](),controller[_0x8bb5('0xa')]);router[_0x8bb5('0x9')](_0x8bb5('0xb'),auth['isAuthenticated'](),controller[_0x8bb5('0xc')]);router[_0x8bb5('0xd')]('/',auth[_0x8bb5('0xe')](),controller[_0x8bb5('0xf')]);router[_0x8bb5('0x10')](_0x8bb5('0xb'),auth[_0x8bb5('0xe')](),controller['update']);router[_0x8bb5('0x11')]('/:id',auth[_0x8bb5('0xe')](),controller['destroy']);module[_0x8bb5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 07d5d82..18910ed 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 _0xcc64=['BOOLEAN','sequelize','variable','STRING','ENUM','string'];(function(_0xef89d,_0x287047){var _0x23d599=function(_0x20ebad){while(--_0x20ebad){_0xef89d['push'](_0xef89d['shift']());}};_0x23d599(++_0x287047);}(_0xcc64,0x133));var _0x4cc6=function(_0x9e4b2a,_0x5bddc0){_0x9e4b2a=_0x9e4b2a-0x0;var _0x364d84=_0xcc64[_0x9e4b2a];return _0x364d84;};'use strict';var Sequelize=require(_0x4cc6('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x4cc6('0x1'),'customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4cc6('0x2')]},'keyType':{'type':Sequelize[_0x4cc6('0x3')](_0x4cc6('0x4'),_0x4cc6('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x4cc6('0x2')]},'idField':{'type':Sequelize[_0x4cc6('0x2')]},'nameField':{'type':Sequelize[_0x4cc6('0x2')]},'customField':{'type':Sequelize[_0x4cc6('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4cc6('0x2')]}}; \ No newline at end of file +var _0x3d59=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x44baf6,_0x1ec6f9){var _0x3b5c15=function(_0xb27fe0){while(--_0xb27fe0){_0x44baf6['push'](_0x44baf6['shift']());}};_0x3b5c15(++_0x1ec6f9);}(_0x3d59,0x64));var _0x93d5=function(_0x5a8ac0,_0x2e141a){_0x5a8ac0=_0x5a8ac0-0x0;var _0xaffa68=_0x3d59[_0x5a8ac0];return _0xaffa68;};'use strict';var Sequelize=require(_0x93d5('0x0'));module['exports']={'type':{'type':Sequelize[_0x93d5('0x1')](_0x93d5('0x2'),_0x93d5('0x3'),_0x93d5('0x4'),_0x93d5('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x93d5('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x93d5('0x1')](_0x93d5('0x2'),'variable',_0x93d5('0x4'))},'keyContent':{'type':Sequelize[_0x93d5('0x6')]},'idField':{'type':Sequelize[_0x93d5('0x6')]},'nameField':{'type':Sequelize[_0x93d5('0x6')]},'customField':{'type':Sequelize[_0x93d5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 73cfeaf..22c1f0f 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 _0xf9ad=['merge','map','type','VIRTUAL','field','filter','options','DeskField','includeAll','include','rows','catch','params','find','create','body','html-pdf','eml-format','fast-json-patch','path','sox','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','pick','where'];(function(_0x440d15,_0x3ce873){var _0x5ec520=function(_0x3f111f){while(--_0x3f111f){_0x440d15['push'](_0x440d15['shift']());}};_0x5ec520(++_0x3ce873);}(_0xf9ad,0xcd));var _0xdf9a=function(_0x418bc0,_0x4afbe4){_0x418bc0=_0x418bc0-0x0;var _0x3a1c96=_0xf9ad[_0x418bc0];return _0x3a1c96;};'use strict';var pdf=require(_0xdf9a('0x0'));var emlformat=require(_0xdf9a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdf9a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdf9a('0x3'));var sox=require(_0xdf9a('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdf9a('0x5'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdf9a('0x6'));var toCsv=require(_0xdf9a('0x7'));var querystring=require(_0xdf9a('0x8'));var Papa=require('papaparse');var Redis=require(_0xdf9a('0x9'));var authService=require(_0xdf9a('0xa'));var qs=require(_0xdf9a('0xb'));var hardwareService=require(_0xdf9a('0xc'));var logger=require(_0xdf9a('0xd'))('api');var utils=require(_0xdf9a('0xe'));var config=require(_0xdf9a('0xf'));var db=require(_0xdf9a('0x10'))['db'];function respondWithStatusCode(_0x59bc87,_0x26c70c){_0x26c70c=_0x26c70c||0xcc;return function(_0x15649e){if(_0x15649e){return _0x59bc87['sendStatus'](_0x26c70c);}return _0x59bc87[_0xdf9a('0x11')](_0x26c70c)[_0xdf9a('0x12')]();};}function respondWithResult(_0xc341fa,_0x5278ee){_0x5278ee=_0x5278ee||0xc8;return function(_0x49cdec){if(_0x49cdec){return _0xc341fa[_0xdf9a('0x11')](_0x5278ee)[_0xdf9a('0x13')](_0x49cdec);}};}function respondWithFilteredResult(_0xab26c9,_0xb0b21){return function(_0x57adbb){if(_0x57adbb){var _0x1d2d6b=_0x57adbb[_0xdf9a('0x14')],_0x15ec93=_0xb0b21[_0xdf9a('0x15')],_0x494f9b=_0xb0b21[_0xdf9a('0x15')]+_0xb0b21['limit'],_0x4fc101;if(_0x494f9b>=_0x1d2d6b){_0x494f9b=_0x1d2d6b;_0x4fc101=0xc8;}else{_0x4fc101=0xce;}_0xab26c9['status'](_0x4fc101);return _0xab26c9[_0xdf9a('0x16')](_0xdf9a('0x17'),_0x15ec93+'-'+_0x494f9b+'/'+_0x1d2d6b)[_0xdf9a('0x13')](_0x57adbb);}return null;};}function patchUpdates(_0x41e448){return function(_0x1afdfb){try{jsonpatch[_0xdf9a('0x18')](_0x1afdfb,_0x41e448,!![]);}catch(_0x235521){return BPromise[_0xdf9a('0x19')](_0x235521);}return _0x1afdfb['save']();};}function saveUpdates(_0x45febb,_0x2d1014){return function(_0x48a8c5){if(_0x48a8c5){return _0x48a8c5[_0xdf9a('0x1a')](_0x45febb)[_0xdf9a('0x1b')](function(_0x4fd891){return _0x4fd891;});}return null;};}function removeEntity(_0x45c33e,_0x496bcc){return function(_0x1f1abd){if(_0x1f1abd){return _0x1f1abd[_0xdf9a('0x1c')]()[_0xdf9a('0x1b')](function(){_0x45c33e['status'](0xcc)[_0xdf9a('0x12')]();});}};}function handleEntityNotFound(_0x28dfce,_0x5b2a95){return function(_0x5f08d7){if(!_0x5f08d7){_0x28dfce['sendStatus'](0x194);}return _0x5f08d7;};}function handleError(_0x5ea2c6,_0x195d5f){_0x195d5f=_0x195d5f||0x1f4;return function(_0x4cb745){logger[_0xdf9a('0x1d')](_0x4cb745[_0xdf9a('0x1e')]);if(_0x4cb745[_0xdf9a('0x1f')]){delete _0x4cb745['name'];}_0x5ea2c6['status'](_0x195d5f)['send'](_0x4cb745);};}exports[_0xdf9a('0x20')]=function(_0x16cac5,_0x1ccf5c){var _0x1e3e76={},_0x562f96={},_0x1222de={'count':0x0,'rows':[]};var _0x445820=db['DeskField'][_0xdf9a('0x21')];_0x562f96[_0xdf9a('0x22')]=_[_0xdf9a('0x23')](_0x445820);_0x562f96[_0xdf9a('0x24')]=_[_0xdf9a('0x23')](_0x16cac5[_0xdf9a('0x24')]);_0x562f96[_0xdf9a('0x25')]=_[_0xdf9a('0x26')](_0x562f96[_0xdf9a('0x22')],_0x562f96[_0xdf9a('0x24')]);_0x1e3e76['attributes']=_[_0xdf9a('0x26')](_0x562f96[_0xdf9a('0x22')],qs[_0xdf9a('0x27')](_0x16cac5[_0xdf9a('0x24')][_0xdf9a('0x27')]));_0x1e3e76[_0xdf9a('0x28')]=_0x1e3e76[_0xdf9a('0x28')][_0xdf9a('0x29')]?_0x1e3e76[_0xdf9a('0x28')]:_0x562f96[_0xdf9a('0x22')];if(!_0x16cac5[_0xdf9a('0x24')]['hasOwnProperty'](_0xdf9a('0x2a'))){_0x1e3e76[_0xdf9a('0x2b')]=qs[_0xdf9a('0x2b')](_0x16cac5[_0xdf9a('0x24')][_0xdf9a('0x2b')]);_0x1e3e76['offset']=qs[_0xdf9a('0x15')](_0x16cac5[_0xdf9a('0x24')][_0xdf9a('0x15')]);}_0x1e3e76['order']=qs[_0xdf9a('0x2c')](_0x16cac5[_0xdf9a('0x24')][_0xdf9a('0x2c')]);_0x1e3e76['where']=qs['filters'](_[_0xdf9a('0x2d')](_0x16cac5[_0xdf9a('0x24')],_0x562f96[_0xdf9a('0x25')]));if(_0x16cac5[_0xdf9a('0x24')]['filter']){_0x1e3e76[_0xdf9a('0x2e')]=_[_0xdf9a('0x2f')](_0x1e3e76['where'],{'$or':_[_0xdf9a('0x30')](_0x445820,function(_0x5a120a){if(_0x5a120a[_0xdf9a('0x31')]['key']!==_0xdf9a('0x32')){var _0x56c5ec={};_0x56c5ec[_0x5a120a[_0xdf9a('0x33')]]={'$like':'%'+_0x16cac5['query'][_0xdf9a('0x34')]+'%'};return _0x56c5ec;}})});}_0x1e3e76=_[_0xdf9a('0x2f')]({},_0x1e3e76,_0x16cac5[_0xdf9a('0x35')]);var _0x297f6b={'where':_0x1e3e76['where']};return db[_0xdf9a('0x36')][_0xdf9a('0x14')](_0x297f6b)[_0xdf9a('0x1b')](function(_0xdce2d7){_0x1222de[_0xdf9a('0x14')]=_0xdce2d7;if(_0x16cac5[_0xdf9a('0x24')][_0xdf9a('0x37')]){_0x1e3e76[_0xdf9a('0x38')]=[{'all':!![]}];}return db[_0xdf9a('0x36')]['findAll'](_0x1e3e76);})[_0xdf9a('0x1b')](function(_0x4b891c){_0x1222de[_0xdf9a('0x39')]=_0x4b891c;return _0x1222de;})[_0xdf9a('0x1b')](respondWithFilteredResult(_0x1ccf5c,_0x1e3e76))[_0xdf9a('0x3a')](handleError(_0x1ccf5c,null));};exports['show']=function(_0xd075ab,_0x5e71e2){var _0x39cb2d={'raw':!![],'where':{'id':_0xd075ab[_0xdf9a('0x3b')]['id']}},_0x3e1a5e={};_0x3e1a5e[_0xdf9a('0x22')]=_[_0xdf9a('0x23')](db[_0xdf9a('0x36')][_0xdf9a('0x21')]);_0x3e1a5e['query']=_[_0xdf9a('0x23')](_0xd075ab[_0xdf9a('0x24')]);_0x3e1a5e[_0xdf9a('0x25')]=_['intersection'](_0x3e1a5e[_0xdf9a('0x22')],_0x3e1a5e[_0xdf9a('0x24')]);_0x39cb2d[_0xdf9a('0x28')]=_[_0xdf9a('0x26')](_0x3e1a5e[_0xdf9a('0x22')],qs[_0xdf9a('0x27')](_0xd075ab['query'][_0xdf9a('0x27')]));_0x39cb2d[_0xdf9a('0x28')]=_0x39cb2d[_0xdf9a('0x28')][_0xdf9a('0x29')]?_0x39cb2d['attributes']:_0x3e1a5e[_0xdf9a('0x22')];if(_0xd075ab[_0xdf9a('0x24')]['includeAll']){_0x39cb2d[_0xdf9a('0x38')]=[{'all':!![]}];}_0x39cb2d=_['merge']({},_0x39cb2d,_0xd075ab[_0xdf9a('0x35')]);return db[_0xdf9a('0x36')][_0xdf9a('0x3c')](_0x39cb2d)[_0xdf9a('0x1b')](handleEntityNotFound(_0x5e71e2,null))[_0xdf9a('0x1b')](respondWithResult(_0x5e71e2,null))[_0xdf9a('0x3a')](handleError(_0x5e71e2,null));};exports[_0xdf9a('0x3d')]=function(_0x15f002,_0x1bdd9a){return db[_0xdf9a('0x36')]['create'](_0x15f002['body'],{})[_0xdf9a('0x1b')](respondWithResult(_0x1bdd9a,0xc9))[_0xdf9a('0x3a')](handleError(_0x1bdd9a,null));};exports[_0xdf9a('0x1a')]=function(_0x284e8d,_0x511615){if(_0x284e8d[_0xdf9a('0x3e')]['id']){delete _0x284e8d[_0xdf9a('0x3e')]['id'];}return db[_0xdf9a('0x36')][_0xdf9a('0x3c')]({'where':{'id':_0x284e8d[_0xdf9a('0x3b')]['id']}})[_0xdf9a('0x1b')](handleEntityNotFound(_0x511615,null))[_0xdf9a('0x1b')](saveUpdates(_0x284e8d[_0xdf9a('0x3e')],null))[_0xdf9a('0x1b')](respondWithResult(_0x511615,null))['catch'](handleError(_0x511615,null));};exports[_0xdf9a('0x1c')]=function(_0x49c187,_0x49c055){return db[_0xdf9a('0x36')]['find']({'where':{'id':_0x49c187['params']['id']}})[_0xdf9a('0x1b')](handleEntityNotFound(_0x49c055,null))[_0xdf9a('0x1b')](removeEntity(_0x49c055,null))[_0xdf9a('0x3a')](handleError(_0x49c055,null));}; \ No newline at end of file +var _0x913a=['request-promise','moment','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','save','update','then','destroy','stack','name','send','index','DeskField','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','where','type','key','VIRTUAL','field','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0x913a,0xce));var _0xa913=function(_0x4049ea,_0x3b2328){_0x4049ea=_0x4049ea-0x0;var _0x36f75b=_0x913a[_0x4049ea];return _0x36f75b;};'use strict';var pdf=require(_0xa913('0x0'));var emlformat=require(_0xa913('0x1'));var rimraf=require(_0xa913('0x2'));var zipdir=require(_0xa913('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa913('0x4'));var moment=require(_0xa913('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa913('0x6'));var path=require('path');var sox=require(_0xa913('0x7'));var csv=require(_0xa913('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa913('0x9'));var crypto=require(_0xa913('0xa'));var jsforce=require(_0xa913('0xb'));var deskjs=require(_0xa913('0xc'));var toCsv=require(_0xa913('0x8'));var querystring=require(_0xa913('0xd'));var Papa=require('papaparse');var Redis=require(_0xa913('0xe'));var authService=require(_0xa913('0xf'));var qs=require(_0xa913('0x10'));var hardwareService=require(_0xa913('0x11'));var logger=require(_0xa913('0x12'))(_0xa913('0x13'));var utils=require('../../config/utils');var config=require(_0xa913('0x14'));var db=require(_0xa913('0x15'))['db'];function respondWithStatusCode(_0x3c9ad7,_0x4aeccb){_0x4aeccb=_0x4aeccb||0xcc;return function(_0x974cab){if(_0x974cab){return _0x3c9ad7[_0xa913('0x16')](_0x4aeccb);}return _0x3c9ad7[_0xa913('0x17')](_0x4aeccb)[_0xa913('0x18')]();};}function respondWithResult(_0x47fa11,_0x4c41a6){_0x4c41a6=_0x4c41a6||0xc8;return function(_0x4f3249){if(_0x4f3249){return _0x47fa11[_0xa913('0x17')](_0x4c41a6)[_0xa913('0x19')](_0x4f3249);}};}function respondWithFilteredResult(_0x1c77d2,_0x345845){return function(_0x600c74){if(_0x600c74){var _0x2bf520=_0x600c74[_0xa913('0x1a')],_0x1a8493=_0x345845[_0xa913('0x1b')],_0x21935e=_0x345845[_0xa913('0x1b')]+_0x345845['limit'],_0x430c4f;if(_0x21935e>=_0x2bf520){_0x21935e=_0x2bf520;_0x430c4f=0xc8;}else{_0x430c4f=0xce;}_0x1c77d2[_0xa913('0x17')](_0x430c4f);return _0x1c77d2['set']('Content-Range',_0x1a8493+'-'+_0x21935e+'/'+_0x2bf520)[_0xa913('0x19')](_0x600c74);}return null;};}function patchUpdates(_0x5ec383){return function(_0x38b7c0){try{jsonpatch[_0xa913('0x1c')](_0x38b7c0,_0x5ec383,!![]);}catch(_0x3d5b7d){return BPromise[_0xa913('0x1d')](_0x3d5b7d);}return _0x38b7c0[_0xa913('0x1e')]();};}function saveUpdates(_0x9bab5f,_0x118311){return function(_0x32529a){if(_0x32529a){return _0x32529a[_0xa913('0x1f')](_0x9bab5f)[_0xa913('0x20')](function(_0x3f7079){return _0x3f7079;});}return null;};}function removeEntity(_0x37c358,_0x2fd7f6){return function(_0x55bad2){if(_0x55bad2){return _0x55bad2[_0xa913('0x21')]()[_0xa913('0x20')](function(){_0x37c358['status'](0xcc)[_0xa913('0x18')]();});}};}function handleEntityNotFound(_0x580f7f,_0x4ca337){return function(_0x417027){if(!_0x417027){_0x580f7f['sendStatus'](0x194);}return _0x417027;};}function handleError(_0x5beb4c,_0x5ea9f6){_0x5ea9f6=_0x5ea9f6||0x1f4;return function(_0x5f249e){logger['error'](_0x5f249e[_0xa913('0x22')]);if(_0x5f249e[_0xa913('0x23')]){delete _0x5f249e['name'];}_0x5beb4c['status'](_0x5ea9f6)[_0xa913('0x24')](_0x5f249e);};}exports[_0xa913('0x25')]=function(_0x478d71,_0x396ca3){var _0x885894={},_0x14ccbe={},_0xd440c3={'count':0x0,'rows':[]};var _0xf7261b=db[_0xa913('0x26')]['rawAttributes'];_0x14ccbe[_0xa913('0x27')]=_['keys'](_0xf7261b);_0x14ccbe['query']=_[_0xa913('0x28')](_0x478d71[_0xa913('0x29')]);_0x14ccbe[_0xa913('0x2a')]=_[_0xa913('0x2b')](_0x14ccbe[_0xa913('0x27')],_0x14ccbe[_0xa913('0x29')]);_0x885894['attributes']=_[_0xa913('0x2b')](_0x14ccbe[_0xa913('0x27')],qs['fields'](_0x478d71['query'][_0xa913('0x2c')]));_0x885894['attributes']=_0x885894[_0xa913('0x2d')][_0xa913('0x2e')]?_0x885894[_0xa913('0x2d')]:_0x14ccbe[_0xa913('0x27')];if(!_0x478d71[_0xa913('0x29')][_0xa913('0x2f')]('nolimit')){_0x885894['limit']=qs['limit'](_0x478d71[_0xa913('0x29')][_0xa913('0x30')]);_0x885894[_0xa913('0x1b')]=qs[_0xa913('0x1b')](_0x478d71[_0xa913('0x29')]['offset']);}_0x885894[_0xa913('0x31')]=qs[_0xa913('0x32')](_0x478d71['query'][_0xa913('0x32')]);_0x885894['where']=qs[_0xa913('0x2a')](_[_0xa913('0x33')](_0x478d71[_0xa913('0x29')],_0x14ccbe[_0xa913('0x2a')]));if(_0x478d71[_0xa913('0x29')]['filter']){_0x885894[_0xa913('0x34')]=_['merge'](_0x885894[_0xa913('0x34')],{'$or':_['map'](_0xf7261b,function(_0x41ad9c){if(_0x41ad9c[_0xa913('0x35')][_0xa913('0x36')]!==_0xa913('0x37')){var _0x1b1206={};_0x1b1206[_0x41ad9c[_0xa913('0x38')]]={'$like':'%'+_0x478d71[_0xa913('0x29')][_0xa913('0x39')]+'%'};return _0x1b1206;}})});}_0x885894=_[_0xa913('0x3a')]({},_0x885894,_0x478d71[_0xa913('0x3b')]);var _0x4297bd={'where':_0x885894[_0xa913('0x34')]};return db[_0xa913('0x26')][_0xa913('0x1a')](_0x4297bd)[_0xa913('0x20')](function(_0x41ad6d){_0xd440c3[_0xa913('0x1a')]=_0x41ad6d;if(_0x478d71[_0xa913('0x29')][_0xa913('0x3c')]){_0x885894[_0xa913('0x3d')]=[{'all':!![]}];}return db[_0xa913('0x26')][_0xa913('0x3e')](_0x885894);})[_0xa913('0x20')](function(_0x1249dc){_0xd440c3[_0xa913('0x3f')]=_0x1249dc;return _0xd440c3;})['then'](respondWithFilteredResult(_0x396ca3,_0x885894))[_0xa913('0x40')](handleError(_0x396ca3,null));};exports[_0xa913('0x41')]=function(_0x367355,_0x69ccff){var _0x465630={'raw':!![],'where':{'id':_0x367355[_0xa913('0x42')]['id']}},_0x25ab00={};_0x25ab00[_0xa913('0x27')]=_[_0xa913('0x28')](db[_0xa913('0x26')]['rawAttributes']);_0x25ab00['query']=_[_0xa913('0x28')](_0x367355['query']);_0x25ab00[_0xa913('0x2a')]=_[_0xa913('0x2b')](_0x25ab00[_0xa913('0x27')],_0x25ab00[_0xa913('0x29')]);_0x465630[_0xa913('0x2d')]=_[_0xa913('0x2b')](_0x25ab00['model'],qs[_0xa913('0x2c')](_0x367355[_0xa913('0x29')][_0xa913('0x2c')]));_0x465630['attributes']=_0x465630[_0xa913('0x2d')][_0xa913('0x2e')]?_0x465630[_0xa913('0x2d')]:_0x25ab00[_0xa913('0x27')];if(_0x367355[_0xa913('0x29')][_0xa913('0x3c')]){_0x465630[_0xa913('0x3d')]=[{'all':!![]}];}_0x465630=_[_0xa913('0x3a')]({},_0x465630,_0x367355['options']);return db[_0xa913('0x26')][_0xa913('0x43')](_0x465630)[_0xa913('0x20')](handleEntityNotFound(_0x69ccff,null))[_0xa913('0x20')](respondWithResult(_0x69ccff,null))[_0xa913('0x40')](handleError(_0x69ccff,null));};exports[_0xa913('0x44')]=function(_0x1ca2c2,_0x3e2ece){return db[_0xa913('0x26')]['create'](_0x1ca2c2[_0xa913('0x45')],{})['then'](respondWithResult(_0x3e2ece,0xc9))[_0xa913('0x40')](handleError(_0x3e2ece,null));};exports[_0xa913('0x1f')]=function(_0x4eee5d,_0x1c1137){if(_0x4eee5d[_0xa913('0x45')]['id']){delete _0x4eee5d[_0xa913('0x45')]['id'];}return db['DeskField']['find']({'where':{'id':_0x4eee5d['params']['id']}})[_0xa913('0x20')](handleEntityNotFound(_0x1c1137,null))[_0xa913('0x20')](saveUpdates(_0x4eee5d[_0xa913('0x45')],null))[_0xa913('0x20')](respondWithResult(_0x1c1137,null))[_0xa913('0x40')](handleError(_0x1c1137,null));};exports[_0xa913('0x21')]=function(_0x1c4d8f,_0x2fd036){return db[_0xa913('0x26')][_0xa913('0x43')]({'where':{'id':_0x1c4d8f['params']['id']}})[_0xa913('0x20')](handleEntityNotFound(_0x2fd036,null))['then'](removeEntity(_0x2fd036,null))[_0xa913('0x40')](handleError(_0x2fd036,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 5da899b..39f3e3d 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 _0x1dd0=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskField.attributes','int_desk_fields','FieldId','lodash'];(function(_0x23a818,_0x212c29){var _0x5d0151=function(_0x58fd86){while(--_0x58fd86){_0x23a818['push'](_0x23a818['shift']());}};_0x5d0151(++_0x212c29);}(_0x1dd0,0xe5));var _0x01dd=function(_0xd1fe09,_0x4a3246){_0xd1fe09=_0xd1fe09-0x0;var _0x460b07=_0x1dd0[_0xd1fe09];return _0x460b07;};'use strict';var _=require(_0x01dd('0x0'));var util=require('util');var logger=require(_0x01dd('0x1'))(_0x01dd('0x2'));var moment=require('moment');var BPromise=require(_0x01dd('0x3'));var rp=require(_0x01dd('0x4'));var fs=require('fs');var path=require(_0x01dd('0x5'));var rimraf=require(_0x01dd('0x6'));var config=require('../../config/environment');var attributes=require(_0x01dd('0x7'));module['exports']=function(_0x1c9cc2,_0x1c2151){return _0x1c9cc2['define']('DeskField',attributes,{'tableName':_0x01dd('0x8'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0x01dd('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x286e=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDeskField.attributes','exports','define','desk_unique_index','idField','FieldId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x286e,0x1e1));var _0xe286=function(_0x2ab21c,_0x137469){_0x2ab21c=_0x2ab21c-0x0;var _0x75a0eb=_0x286e[_0x2ab21c];return _0x75a0eb;};'use strict';var _=require(_0xe286('0x0'));var util=require('util');var logger=require(_0xe286('0x1'))(_0xe286('0x2'));var moment=require(_0xe286('0x3'));var BPromise=require(_0xe286('0x4'));var rp=require(_0xe286('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe286('0x6'));var config=require('../../config/environment');var attributes=require(_0xe286('0x7'));module[_0xe286('0x8')]=function(_0x5f47b8,_0x1cf7bf){return _0x5f47b8[_0xe286('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xe286('0xa'),'fields':[_0xe286('0xb'),_0xe286('0xc')],'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 9395eb1..c9564fe 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 _0xe834=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s'];(function(_0x5302ea,_0x570b43){var _0x24d9b1=function(_0xc53125){while(--_0xc53125){_0x5302ea['push'](_0x5302ea['shift']());}};_0x24d9b1(++_0x570b43);}(_0xe834,0x1bb));var _0x4e83=function(_0x4018d0,_0x10df66){_0x4018d0=_0x4018d0-0x0;var _0x229c58=_0xe834[_0x4018d0];return _0x229c58;};'use strict';var _=require(_0x4e83('0x0'));var util=require(_0x4e83('0x1'));var moment=require(_0x4e83('0x2'));var BPromise=require(_0x4e83('0x3'));var rs=require(_0x4e83('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e83('0x5'))['db'];var utils=require(_0x4e83('0x6'));var logger=require('../../config/logger')(_0x4e83('0x7'));var config=require(_0x4e83('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x417d65,_0x36473a,_0x5016f5){return new BPromise(function(_0x2d6205,_0x551317){return client[_0x4e83('0x9')](_0x417d65,_0x5016f5)[_0x4e83('0xa')](function(_0x5a4ea3){logger[_0x4e83('0xb')]('DeskField,\x20%s,\x20%s',_0x36473a,_0x4e83('0xc'));logger[_0x4e83('0xd')](_0x4e83('0xe'),_0x36473a,_0x4e83('0xc'),JSON[_0x4e83('0xf')](_0x5a4ea3));if(_0x5a4ea3[_0x4e83('0x10')]){if(_0x5a4ea3[_0x4e83('0x10')][_0x4e83('0x11')]===0x1f4){logger[_0x4e83('0x10')](_0x4e83('0x12'),_0x36473a,_0x5a4ea3['error']['message']);return _0x551317(_0x5a4ea3[_0x4e83('0x10')][_0x4e83('0x13')]);}logger[_0x4e83('0x10')](_0x4e83('0x12'),_0x36473a,_0x5a4ea3['error']['message']);return _0x2d6205(_0x5a4ea3[_0x4e83('0x10')][_0x4e83('0x13')]);}else{logger['info'](_0x4e83('0x12'),_0x36473a,_0x4e83('0xc'));_0x2d6205(_0x5a4ea3[_0x4e83('0x14')][_0x4e83('0x13')]);}})[_0x4e83('0x15')](function(_0x264eb2){logger['error'](_0x4e83('0x12'),_0x36473a,_0x264eb2);_0x551317(_0x264eb2);});});} \ No newline at end of file +var _0xa88b=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4ec7e9,_0x573904){var _0x195bd3=function(_0x5c50e2){while(--_0x5c50e2){_0x4ec7e9['push'](_0x4ec7e9['shift']());}};_0x195bd3(++_0x573904);}(_0xa88b,0xf2));var _0xba88=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0xa88b[_0x1faaa1];return _0x994ec;};'use strict';var _=require('lodash');var util=require(_0xba88('0x0'));var moment=require('moment');var BPromise=require(_0xba88('0x1'));var rs=require(_0xba88('0x2'));var fs=require('fs');var Redis=require(_0xba88('0x3'));var db=require(_0xba88('0x4'))['db'];var utils=require(_0xba88('0x5'));var logger=require(_0xba88('0x6'))(_0xba88('0x7'));var config=require('../../config/environment');var jayson=require(_0xba88('0x8'));var client=jayson[_0xba88('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55ac08,_0x3fa40f,_0x135f6e){return new BPromise(function(_0xf9e3f5,_0x5a27ae){return client[_0xba88('0xa')](_0x55ac08,_0x135f6e)['then'](function(_0x5f526a){logger[_0xba88('0xb')](_0xba88('0xc'),_0x3fa40f,_0xba88('0xd'));logger[_0xba88('0xe')](_0xba88('0xf'),_0x3fa40f,_0xba88('0xd'),JSON[_0xba88('0x10')](_0x5f526a));if(_0x5f526a[_0xba88('0x11')]){if(_0x5f526a['error'][_0xba88('0x12')]===0x1f4){logger[_0xba88('0x11')]('DeskField,\x20%s,\x20%s',_0x3fa40f,_0x5f526a['error'][_0xba88('0x13')]);return _0x5a27ae(_0x5f526a['error']['message']);}logger[_0xba88('0x11')](_0xba88('0xc'),_0x3fa40f,_0x5f526a[_0xba88('0x11')]['message']);return _0xf9e3f5(_0x5f526a['error'][_0xba88('0x13')]);}else{logger[_0xba88('0xb')](_0xba88('0xc'),_0x3fa40f,_0xba88('0xd'));_0xf9e3f5(_0x5f526a[_0xba88('0x14')][_0xba88('0x13')]);}})[_0xba88('0x15')](function(_0x3e1ce7){logger[_0xba88('0x11')](_0xba88('0xc'),_0x3fa40f,_0x3e1ce7);_0x5a27ae(_0x3e1ce7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index cfd5c71..4ae67a3 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 _0x0f87=['/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x0f87,0xdb));var _0x70f8=function(_0x47379b,_0x3bd9ae){_0x47379b=_0x47379b-0x0;var _0x3c3c71=_0x0f87[_0x47379b];return _0x3c3c71;};'use strict';var multer=require(_0x70f8('0x0'));var util=require(_0x70f8('0x1'));var path=require('path');var timeout=require(_0x70f8('0x2'));var express=require(_0x70f8('0x3'));var router=express[_0x70f8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x70f8('0x5'));var config=require(_0x70f8('0x6'));var controller=require(_0x70f8('0x7'));router[_0x70f8('0x8')]('/',auth[_0x70f8('0x9')](),controller[_0x70f8('0xa')]);router[_0x70f8('0x8')](_0x70f8('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x70f8('0xc'),auth['isAuthenticated'](),controller[_0x70f8('0xd')]);router[_0x70f8('0x8')](_0x70f8('0xe'),auth[_0x70f8('0x9')](),controller['getFields']);router[_0x70f8('0xf')]('/',auth[_0x70f8('0x9')](),controller['create']);router[_0x70f8('0xf')](_0x70f8('0xc'),auth['isAuthenticated'](),controller[_0x70f8('0x10')]);router[_0x70f8('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x70f8('0x12')]);router['delete'](_0x70f8('0xb'),auth['isAuthenticated'](),controller[_0x70f8('0x13')]);module[_0x70f8('0x14')]=router; \ No newline at end of file +var _0xf3d5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','express'];(function(_0x4b9216,_0x4eaf36){var _0x309f82=function(_0x3c4a31){while(--_0x3c4a31){_0x4b9216['push'](_0x4b9216['shift']());}};_0x309f82(++_0x4eaf36);}(_0xf3d5,0x81));var _0x5f3d=function(_0x5a6edd,_0x83b034){_0x5a6edd=_0x5a6edd-0x0;var _0xa2515=_0xf3d5[_0x5a6edd];return _0xa2515;};'use strict';var multer=require(_0x5f3d('0x0'));var util=require(_0x5f3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5f3d('0x2'));var router=express[_0x5f3d('0x3')]();var auth=require(_0x5f3d('0x4'));var interaction=require(_0x5f3d('0x5'));var config=require(_0x5f3d('0x6'));var controller=require('./intDynamics365Account.controller');router[_0x5f3d('0x7')]('/',auth['isAuthenticated'](),controller[_0x5f3d('0x8')]);router[_0x5f3d('0x7')]('/:id',auth[_0x5f3d('0x9')](),controller['show']);router[_0x5f3d('0x7')]('/:id/configurations',auth[_0x5f3d('0x9')](),controller[_0x5f3d('0xa')]);router['get']('/:id/fields',auth[_0x5f3d('0x9')](),controller[_0x5f3d('0xb')]);router[_0x5f3d('0xc')]('/',auth['isAuthenticated'](),controller[_0x5f3d('0xd')]);router[_0x5f3d('0xc')](_0x5f3d('0xe'),auth['isAuthenticated'](),controller[_0x5f3d('0xf')]);router[_0x5f3d('0x10')](_0x5f3d('0x11'),auth[_0x5f3d('0x9')](),controller[_0x5f3d('0x12')]);router[_0x5f3d('0x13')](_0x5f3d('0x11'),auth['isAuthenticated'](),controller[_0x5f3d('0x14')]);module[_0x5f3d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index fb3d3aa..026358e 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 _0x0ba4=['exports','STRING'];(function(_0x1a9bc2,_0x5c2e82){var _0x387349=function(_0x117361){while(--_0x117361){_0x1a9bc2['push'](_0x1a9bc2['shift']());}};_0x387349(++_0x5c2e82);}(_0x0ba4,0x16c));var _0x40ba=function(_0x10070c,_0x2228c5){_0x10070c=_0x10070c-0x0;var _0xe4f14b=_0x0ba4[_0x10070c];return _0xe4f14b;};'use strict';var Sequelize=require('sequelize');module[_0x40ba('0x0')]={'name':{'type':Sequelize[_0x40ba('0x1')]},'username':{'type':Sequelize[_0x40ba('0x1')]},'password':{'type':Sequelize[_0x40ba('0x1')]},'remoteUri':{'type':Sequelize[_0x40ba('0x1')]},'tenantId':{'type':Sequelize[_0x40ba('0x1')]},'clientId':{'type':Sequelize[_0x40ba('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x40ba('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb645=['exports','STRING','sequelize'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0xb645,0x1cd));var _0x5b64=function(_0x38e04e,_0x4d91f5){_0x38e04e=_0x38e04e-0x0;var _0x24d88a=_0xb645[_0x38e04e];return _0x24d88a;};'use strict';var Sequelize=require(_0x5b64('0x0'));module[_0x5b64('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5b64('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5b64('0x2')]},'tenantId':{'type':Sequelize[_0x5b64('0x2')]},'clientId':{'type':Sequelize[_0x5b64('0x2')]},'clientSecret':{'type':Sequelize[_0x5b64('0x2')]},'serverUrl':{'type':Sequelize[_0x5b64('0x2')]},'description':{'type':Sequelize[_0x5b64('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d2a9d0e..5e4d69a 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 _0xc07d=['reject','save','update','destroy','stack','name','send','index','Dynamics365Account','rawAttributes','keys','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','type','key','field','options','include','findAll','rows','show','params','fields','length','includeAll','create','body','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','log','Dynamics365\x20error:\x20','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','request-promise','bluebird','mustache','sox','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','client','http','test','ValidationError','request','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','Dynamics365Account,\x20%s,\x20%s','message','error','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x2cc178,_0x589ff6){var _0xb0a54d=function(_0x5fba48){while(--_0x5fba48){_0x2cc178['push'](_0x2cc178['shift']());}};_0xb0a54d(++_0x589ff6);}(_0xc07d,0xac));var _0xdc07=function(_0x48a032,_0x1f92e8){_0x48a032=_0x48a032-0x0;var _0xb7cb07=_0xc07d[_0x48a032];return _0xb7cb07;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdc07('0x0'));var rimraf=require(_0xdc07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc07('0x2'));var moment=require('moment');var BPromise=require(_0xdc07('0x3'));var Mustache=require(_0xdc07('0x4'));var util=require('util');var path=require('path');var sox=require(_0xdc07('0x5'));var csv=require(_0xdc07('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc07('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdc07('0x8'));var toCsv=require(_0xdc07('0x6'));var querystring=require(_0xdc07('0x9'));var Papa=require(_0xdc07('0xa'));var Redis=require(_0xdc07('0xb'));var authService=require(_0xdc07('0xc'));var qs=require(_0xdc07('0xd'));var hardwareService=require(_0xdc07('0xe'));var logger=require(_0xdc07('0xf'))(_0xdc07('0x10'));var utils=require('../../config/utils');var config=require(_0xdc07('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdc07('0x12'));var jayson=require('jayson/promise');var client=jayson[_0xdc07('0x13')][_0xdc07('0x14')]({'port':0x232a});function checkPasswordPattern(_0x4c3a26,_0x367e65,_0x5bed0){if(_0x5bed0){var _0x30b6e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30b6e1[_0xdc07('0x15')](_0x367e65)){return _0x4c3a26;}else{throw new db['Sequelize'][(_0xdc07('0x16'))]('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 _0x4c3a26;}}function respondWithRpcPromise(_0x599cc7,_0x5986b5,_0x3f73de,_0x89f09d){return new BPromise(function(_0x1610a2,_0x2edb50){var _0x454a05=_0x89f09d||client;return _0x454a05[_0xdc07('0x17')](_0x599cc7,_0x3f73de)[_0xdc07('0x18')](function(_0x2c06b8){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5986b5,_0xdc07('0x19'));logger['debug'](_0xdc07('0x1a'),_0x5986b5,_0xdc07('0x19'),JSON[_0xdc07('0x1b')](_0x2c06b8));if(_0x2c06b8['error']){if(_0x2c06b8['error'][_0xdc07('0x1c')]===0x1f4){logger['error'](_0xdc07('0x1d'),_0x5986b5,_0x2c06b8['error'][_0xdc07('0x1e')]);return _0x2edb50(_0x2c06b8['error'][_0xdc07('0x1e')]);}logger['error'](_0xdc07('0x1d'),_0x5986b5,_0x2c06b8[_0xdc07('0x1f')][_0xdc07('0x1e')]);return _0x1610a2(_0x2c06b8[_0xdc07('0x1f')][_0xdc07('0x1e')]);}else{logger[_0xdc07('0x20')](_0xdc07('0x1d'),_0x5986b5,'request\x20sent');_0x1610a2(_0x2c06b8[_0xdc07('0x21')][_0xdc07('0x1e')]);}})[_0xdc07('0x22')](function(_0x1eb44b){logger[_0xdc07('0x1f')](_0xdc07('0x1d'),_0x5986b5,_0x1eb44b);_0x2edb50(_0x1eb44b);});});}function respondWithStatusCode(_0x1ef00a,_0x16801f){_0x16801f=_0x16801f||0xcc;return function(_0x31c1c3){if(_0x31c1c3){return _0x1ef00a[_0xdc07('0x23')](_0x16801f);}return _0x1ef00a[_0xdc07('0x24')](_0x16801f)[_0xdc07('0x25')]();};}function respondWithResult(_0x5c9406,_0x596db0){_0x596db0=_0x596db0||0xc8;return function(_0x4c644c){if(_0x4c644c){return _0x5c9406[_0xdc07('0x24')](_0x596db0)[_0xdc07('0x26')](_0x4c644c);}};}function respondWithFilteredResult(_0x2da535,_0xd59dc1){return function(_0x3a53d5){if(_0x3a53d5){var _0x4ccb56=_0x3a53d5[_0xdc07('0x27')],_0x408c26=_0xd59dc1[_0xdc07('0x28')],_0x2ee499=_0xd59dc1['offset']+_0xd59dc1[_0xdc07('0x29')],_0x401e10;if(_0x2ee499>=_0x4ccb56){_0x2ee499=_0x4ccb56;_0x401e10=0xc8;}else{_0x401e10=0xce;}_0x2da535[_0xdc07('0x24')](_0x401e10);return _0x2da535[_0xdc07('0x2a')](_0xdc07('0x2b'),_0x408c26+'-'+_0x2ee499+'/'+_0x4ccb56)[_0xdc07('0x26')](_0x3a53d5);}return null;};}function patchUpdates(_0xb7bb54){return function(_0x3c17bb){try{jsonpatch[_0xdc07('0x2c')](_0x3c17bb,_0xb7bb54,!![]);}catch(_0x5ee309){return BPromise[_0xdc07('0x2d')](_0x5ee309);}return _0x3c17bb[_0xdc07('0x2e')]();};}function saveUpdates(_0x43caa6,_0x4c946f){return function(_0x47b11d){if(_0x47b11d){return _0x47b11d[_0xdc07('0x2f')](_0x43caa6)[_0xdc07('0x18')](function(_0x109acc){return _0x109acc;});}return null;};}function removeEntity(_0x1d4342,_0x503145){return function(_0xc43d39){if(_0xc43d39){return _0xc43d39[_0xdc07('0x30')]()[_0xdc07('0x18')](function(){_0x1d4342['status'](0xcc)[_0xdc07('0x25')]();});}};}function handleEntityNotFound(_0x2f1e89,_0x49d3ab){return function(_0x3180c3){if(!_0x3180c3){_0x2f1e89['sendStatus'](0x194);}return _0x3180c3;};}function handleError(_0x538a6d,_0x3df956){_0x3df956=_0x3df956||0x1f4;return function(_0x4058d9){logger[_0xdc07('0x1f')](_0x4058d9[_0xdc07('0x31')]);if(_0x4058d9[_0xdc07('0x32')]){delete _0x4058d9[_0xdc07('0x32')];}_0x538a6d[_0xdc07('0x24')](_0x3df956)[_0xdc07('0x33')](_0x4058d9);};}exports[_0xdc07('0x34')]=function(_0x436ff3,_0x1f8e8a){var _0x3af325={},_0x29b165={},_0x5e7660={'count':0x0,'rows':[]};var _0xa5382e=db[_0xdc07('0x35')][_0xdc07('0x36')];_0x29b165['model']=_[_0xdc07('0x37')](_0xa5382e);_0x29b165[_0xdc07('0x38')]=_[_0xdc07('0x37')](_0x436ff3['query']);_0x29b165['filters']=_[_0xdc07('0x39')](_0x29b165[_0xdc07('0x3a')],_0x29b165['query']);_0x3af325['attributes']=_[_0xdc07('0x39')](_0x29b165[_0xdc07('0x3a')],qs['fields'](_0x436ff3[_0xdc07('0x38')]['fields']));_0x3af325[_0xdc07('0x3b')]=_0x3af325['attributes']['length']?_0x3af325[_0xdc07('0x3b')]:_0x29b165[_0xdc07('0x3a')];if(!_0x436ff3[_0xdc07('0x38')][_0xdc07('0x3c')](_0xdc07('0x3d'))){_0x3af325[_0xdc07('0x29')]=qs[_0xdc07('0x29')](_0x436ff3[_0xdc07('0x38')][_0xdc07('0x29')]);_0x3af325[_0xdc07('0x28')]=qs['offset'](_0x436ff3['query'][_0xdc07('0x28')]);}_0x3af325[_0xdc07('0x3e')]=qs[_0xdc07('0x3f')](_0x436ff3[_0xdc07('0x38')][_0xdc07('0x3f')]);_0x3af325[_0xdc07('0x40')]=qs['filters'](_[_0xdc07('0x41')](_0x436ff3['query'],_0x29b165[_0xdc07('0x42')]));if(_0x436ff3[_0xdc07('0x38')][_0xdc07('0x43')]){_0x3af325[_0xdc07('0x40')]=_[_0xdc07('0x44')](_0x3af325['where'],{'$or':_[_0xdc07('0x45')](_0xa5382e,function(_0x469f16){if(_0x469f16[_0xdc07('0x46')][_0xdc07('0x47')]!=='VIRTUAL'){var _0xf210a5={};_0xf210a5[_0x469f16[_0xdc07('0x48')]]={'$like':'%'+_0x436ff3[_0xdc07('0x38')][_0xdc07('0x43')]+'%'};return _0xf210a5;}})});}_0x3af325=_[_0xdc07('0x44')]({},_0x3af325,_0x436ff3[_0xdc07('0x49')]);var _0x2e1fe4={'where':_0x3af325[_0xdc07('0x40')]};return db['Dynamics365Account'][_0xdc07('0x27')](_0x2e1fe4)[_0xdc07('0x18')](function(_0x361b19){_0x5e7660['count']=_0x361b19;if(_0x436ff3[_0xdc07('0x38')]['includeAll']){_0x3af325[_0xdc07('0x4a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xdc07('0x4b')](_0x3af325);})['then'](function(_0x266de2){_0x5e7660[_0xdc07('0x4c')]=_0x266de2;return _0x5e7660;})['then'](respondWithFilteredResult(_0x1f8e8a,_0x3af325))[_0xdc07('0x22')](handleError(_0x1f8e8a,null));};exports[_0xdc07('0x4d')]=function(_0x555855,_0x173bdc){var _0x9e7526={'raw':![],'where':{'id':_0x555855[_0xdc07('0x4e')]['id']}},_0xe9471b={};_0xe9471b[_0xdc07('0x3a')]=_[_0xdc07('0x37')](db[_0xdc07('0x35')][_0xdc07('0x36')]);_0xe9471b[_0xdc07('0x38')]=_[_0xdc07('0x37')](_0x555855[_0xdc07('0x38')]);_0xe9471b['filters']=_[_0xdc07('0x39')](_0xe9471b[_0xdc07('0x3a')],_0xe9471b[_0xdc07('0x38')]);_0x9e7526[_0xdc07('0x3b')]=_[_0xdc07('0x39')](_0xe9471b['model'],qs[_0xdc07('0x4f')](_0x555855[_0xdc07('0x38')][_0xdc07('0x4f')]));_0x9e7526['attributes']=_0x9e7526['attributes'][_0xdc07('0x50')]?_0x9e7526[_0xdc07('0x3b')]:_0xe9471b['model'];if(_0x555855['query'][_0xdc07('0x51')]){_0x9e7526[_0xdc07('0x4a')]=[{'all':!![]}];}_0x9e7526=_[_0xdc07('0x44')]({},_0x9e7526,_0x555855[_0xdc07('0x49')]);return db['Dynamics365Account']['find'](_0x9e7526)[_0xdc07('0x18')](handleEntityNotFound(_0x173bdc,null))['then'](respondWithResult(_0x173bdc,null))['catch'](handleError(_0x173bdc,null));};exports[_0xdc07('0x52')]=function(_0x1e2db5,_0x25e1dd){return db['Dynamics365Account']['create'](_0x1e2db5[_0xdc07('0x53')],{})[_0xdc07('0x18')](respondWithResult(_0x25e1dd,0xc9))[_0xdc07('0x22')](handleError(_0x25e1dd,null));};exports[_0xdc07('0x2f')]=function(_0x1c9f39,_0x531326){if(_0x1c9f39[_0xdc07('0x53')]['id']){delete _0x1c9f39[_0xdc07('0x53')]['id'];}return db[_0xdc07('0x35')][_0xdc07('0x54')]({'where':{'id':_0x1c9f39[_0xdc07('0x4e')]['id']}})[_0xdc07('0x18')](handleEntityNotFound(_0x531326,null))[_0xdc07('0x18')](saveUpdates(_0x1c9f39[_0xdc07('0x53')],null))[_0xdc07('0x18')](respondWithResult(_0x531326,null))[_0xdc07('0x22')](handleError(_0x531326,null));};exports['destroy']=function(_0x72edb9,_0x42537a){return db[_0xdc07('0x35')][_0xdc07('0x54')]({'where':{'id':_0x72edb9['params']['id']}})[_0xdc07('0x18')](handleEntityNotFound(_0x42537a,null))[_0xdc07('0x18')](removeEntity(_0x42537a,null))[_0xdc07('0x22')](handleError(_0x42537a,null));};exports[_0xdc07('0x55')]=function(_0x3632b7,_0x2ea44b,_0xd60469){var _0x32eb18={};var _0x56db6b={};var _0x598f30;var _0x1704c6;return db['Dynamics365Account'][_0xdc07('0x56')]({'where':{'id':_0x3632b7['params']['id']}})[_0xdc07('0x18')](handleEntityNotFound(_0x2ea44b,null))['then'](function(_0x3685f9){if(_0x3685f9){_0x598f30=_0x3685f9;_0x56db6b[_0xdc07('0x3a')]=_[_0xdc07('0x37')](db[_0xdc07('0x57')][_0xdc07('0x36')]);_0x56db6b['query']=_[_0xdc07('0x37')](_0x3632b7['query']);_0x56db6b[_0xdc07('0x42')]=_['intersection'](_0x56db6b[_0xdc07('0x3a')],_0x56db6b[_0xdc07('0x38')]);_0x32eb18['attributes']=_['intersection'](_0x56db6b[_0xdc07('0x3a')],qs['fields'](_0x3632b7['query']['fields']));_0x32eb18[_0xdc07('0x3b')]=_0x32eb18['attributes'][_0xdc07('0x50')]?_0x32eb18[_0xdc07('0x3b')]:_0x56db6b['model'];_0x32eb18[_0xdc07('0x3e')]=qs['sort'](_0x3632b7['query'][_0xdc07('0x3f')]);_0x32eb18[_0xdc07('0x40')]=qs[_0xdc07('0x42')](_['pick'](_0x3632b7[_0xdc07('0x38')],_0x56db6b['filters']));if(_0x3632b7['query'][_0xdc07('0x43')]){_0x32eb18[_0xdc07('0x40')]=_[_0xdc07('0x44')](_0x32eb18[_0xdc07('0x40')],{'$or':_[_0xdc07('0x45')](_0x32eb18[_0xdc07('0x3b')],function(_0x197995){var _0x1ad19f={};_0x1ad19f[_0x197995]={'$like':'%'+_0x3632b7[_0xdc07('0x38')][_0xdc07('0x43')]+'%'};return _0x1ad19f;})});}_0x32eb18=_['merge']({},_0x32eb18,_0x3632b7['options']);return _0x598f30[_0xdc07('0x55')](_0x32eb18);}})[_0xdc07('0x18')](function(_0x17aca1){if(_0x17aca1){_0x1704c6=_0x17aca1['length'];if(!_0x3632b7[_0xdc07('0x38')][_0xdc07('0x3c')](_0xdc07('0x3d'))){_0x32eb18[_0xdc07('0x29')]=qs[_0xdc07('0x29')](_0x3632b7[_0xdc07('0x38')][_0xdc07('0x29')]);_0x32eb18[_0xdc07('0x28')]=qs[_0xdc07('0x28')](_0x3632b7[_0xdc07('0x38')][_0xdc07('0x28')]);}return _0x598f30['getConfigurations'](_0x32eb18);}})['then'](function(_0xa7a9f4){if(_0xa7a9f4){return _0xa7a9f4?{'count':_0x1704c6,'rows':_0xa7a9f4}:null;}})[_0xdc07('0x18')](respondWithResult(_0x2ea44b,null))[_0xdc07('0x22')](handleError(_0x2ea44b,null));};exports[_0xdc07('0x58')]=function(_0x491aac,_0xaa21d1,_0x5f4796){if(_0x491aac[_0xdc07('0x53')]['id']){delete _0x491aac[_0xdc07('0x53')]['id'];}return db[_0xdc07('0x35')]['findOne']({'where':{'id':_0x491aac['params']['id']}})[_0xdc07('0x18')](handleEntityNotFound(_0xaa21d1,null))['then'](function(_0x407b70){if(_0x407b70){_0x491aac[_0xdc07('0x53')][_0xdc07('0x59')]=_0x407b70['id'];_0x491aac[_0xdc07('0x53')][_0xdc07('0x5a')]=integrations[_0xdc07('0x5b')](_0x491aac[_0xdc07('0x53')]['channel'],_0x491aac['body']['type']);_0x491aac[_0xdc07('0x53')][_0xdc07('0x5c')]=integrations[_0xdc07('0x5d')](_0x491aac['body'][_0xdc07('0x5e')],_0x491aac[_0xdc07('0x53')][_0xdc07('0x46')]);return db[_0xdc07('0x57')]['create'](_0x491aac[_0xdc07('0x53')],{'include':[{'model':db[_0xdc07('0x5f')],'as':_0xdc07('0x5a')},{'model':db[_0xdc07('0x5f')],'as':_0xdc07('0x5c')}]});}return null;})[_0xdc07('0x18')](respondWithResult(_0xaa21d1,null))[_0xdc07('0x22')](handleError(_0xaa21d1,null));};exports[_0xdc07('0x60')]=function(_0x47528d,_0x439053,_0x4b3d5a){var _0x54f94e=_0x47528d[_0xdc07('0x38')]['ticketType'];var _0x45e441=_0x54f94e==='incident'?_0xdc07('0x61'):_0xdc07('0x62');var _0x4d7b0b='';var _0x237238='';var _0x210e67='';var _0x1c888c='';var _0x44a22b='';var _0x5527cc='';var _0xe60e8c='';var _0x5beb91='';var _0x21af07=[_0xdc07('0x63'),'description',_0xdc07('0x64'),_0xdc07('0x65'),_0xdc07('0x66'),_0xdc07('0x67'),_0xdc07('0x68'),'regardingobjectid',_0xdc07('0x69'),_0xdc07('0x6a')];var _0xf5abb5=[_0xdc07('0x6b'),_0xdc07('0x6c'),_0xdc07('0x6d'),_0xdc07('0x6e'),_0xdc07('0x6f'),_0xdc07('0x70'),'contractdetailidname','contractidname',_0xdc07('0x71'),'createdbyexternalpartyyominame',_0xdc07('0x72'),_0xdc07('0x73'),'createdon','createdonbehalfbyname',_0xdc07('0x74'),_0xdc07('0x75'),_0xdc07('0x76'),_0xdc07('0x77'),_0xdc07('0x78'),_0xdc07('0x79'),_0xdc07('0x7a'),_0xdc07('0x7b'),_0xdc07('0x7c'),_0xdc07('0x7d'),_0xdc07('0x7e'),'followupby',_0xdc07('0x7f'),'influencescore',_0xdc07('0x80'),_0xdc07('0x81'),_0xdc07('0x82'),_0xdc07('0x83'),'modifiedbyexternalpartyyominame',_0xdc07('0x84'),'modifiedbyyominame','modifiedon',_0xdc07('0x85'),_0xdc07('0x86'),_0xdc07('0x87'),_0xdc07('0x88'),'numberofchildincidents','onholdtime',_0xdc07('0x89'),_0xdc07('0x8a'),_0xdc07('0x8b'),_0xdc07('0x8c'),'parentcaseidname',_0xdc07('0x8d'),_0xdc07('0x8e'),'prioritycodename',_0xdc07('0x8f'),'productserialnumber',_0xdc07('0x90'),_0xdc07('0x91'),_0xdc07('0x92'),_0xdc07('0x93'),'responsiblecontactidyominame',_0xdc07('0x94'),_0xdc07('0x95'),_0xdc07('0x96'),_0xdc07('0x97'),_0xdc07('0x98'),_0xdc07('0x99'),_0xdc07('0x9a'),_0xdc07('0x9b'),_0xdc07('0x9c'),_0xdc07('0x9d'),_0xdc07('0x9e'),_0xdc07('0x9f'),_0xdc07('0xa0')];var _0x6b7eda=_0x21af07[_0xdc07('0xa1')](_0xf5abb5);return db[_0xdc07('0x35')][_0xdc07('0x56')]({'where':{'id':_0x47528d[_0xdc07('0x4e')]['id']},'attributes':['id',_0xdc07('0xa2'),_0xdc07('0xa3'),_0xdc07('0xa4'),_0xdc07('0xa5'),'clientId',_0xdc07('0xa6')]})['then'](handleEntityNotFound(_0x439053,null))[_0xdc07('0x18')](function(_0x45a9d3){if(_0x45a9d3){_0x5beb91=_0x45a9d3[_0xdc07('0xa4')];var _0x5e2576=_0x5beb91[_0xdc07('0xa7')](-0x1);if(_0x5e2576==='/'){_0x5beb91=_0x5beb91[_0xdc07('0xa8')](0x0,_0x5beb91[_0xdc07('0xa9')](_0x5e2576));}_0xe60e8c=util[_0xdc07('0xaa')](_0xdc07('0xab'),_0x5beb91);var _0x5a5881={'method':_0xdc07('0xac'),'uri':'https://login.microsoftonline.com/'+_0x45a9d3['tenantId']+_0xdc07('0xad'),'form':{'client_id':_0x45a9d3[_0xdc07('0xae')],'resource':_0x5beb91,'username':_0x45a9d3[_0xdc07('0xa2')],'password':_0x45a9d3[_0xdc07('0xa3')],'grant_type':_0xdc07('0xa3'),'client_secret':_0x45a9d3[_0xdc07('0xa6')]},'json':!![]};return rp(_0x5a5881);}})[_0xdc07('0x18')](function(_0xa248e4){_0x5527cc=_0xa248e4[_0xdc07('0xaf')];var _0x542398={'method':_0xdc07('0xb0'),'uri':encodeURI(_0xe60e8c+_0xdc07('0xb1')+_0x45e441+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x5527cc,'If-None-Match':null,'OData-Version':_0xdc07('0xb2')},'json':!![]};return rp(_0x542398);})[_0xdc07('0x18')](function(_0x32c056){var _0x1a115d=_0x32c056['value'][0x0];var _0x172eb0=_0x1a115d[_0xdc07('0xb3')];var _0x7f6f1e={'method':'GET','uri':_0xe60e8c+_0xdc07('0xb4')+_0x172eb0+_0xdc07('0xb5'),'headers':{'Authorization':_0xdc07('0xb6')+_0x5527cc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7f6f1e);})[_0xdc07('0x18')](function(_0x41dd98){_0x4d7b0b=_0x41dd98;_0x237238=_0x4d7b0b[_0xdc07('0xb7')];_0x237238=_[_0xdc07('0xb8')](_0x237238,function(_0x3f19af){return!_0x6b7eda[_0xdc07('0xb9')](_0x3f19af[_0xdc07('0xba')]);});var _0x3f6772=[];var _0xbc907b=[];_0x237238[_0xdc07('0xbb')](function(_0x838d7){if(_0x838d7['@odata.type']){var _0x12fe40=_0x838d7[_0xdc07('0xbc')][_0xdc07('0xa8')](_0x838d7[_0xdc07('0xbc')]['lastIndexOf']('.')+0x1);if(_0x12fe40===_0xdc07('0xbd')){_0x3f6772[_0xdc07('0xbe')](getSelectList(_0xe60e8c,_0x54f94e,_0xbc907b,_0x4d7b0b[_0xdc07('0xb3')],_0x838d7[_0xdc07('0xb3')],_0x5527cc));}}});return Promise[_0xdc07('0xbf')](_0x3f6772);})[_0xdc07('0x18')](function(_0x49c4dd){_0x210e67=_0x49c4dd[0x0];var _0x729237=[];var _0x26d19d=[];_0x237238[_0xdc07('0xbb')](function(_0x573b2c){if(!_[_0xdc07('0xc0')](_0x573b2c[_0xdc07('0xbc')])){var _0xea494f=_0x573b2c['@odata.type'][_0xdc07('0xa8')](_0x573b2c[_0xdc07('0xbc')]['lastIndexOf']('.')+0x1);if(_0xea494f===_0xdc07('0xc1')){_0x729237[_0xdc07('0xbe')](getBooleanList(_0xe60e8c,_0x54f94e,_0x26d19d,_0x4d7b0b['MetadataId'],_0x573b2c[_0xdc07('0xb3')],_0x5527cc));}}});return Promise[_0xdc07('0xbf')](_0x729237);})[_0xdc07('0x18')](function(_0xfeb88b){_0x1c888c=_0xfeb88b[0x0];var _0x2d3a8f=[];var _0x1c76ce=[];_0x237238[_0xdc07('0xbb')](function(_0x238e78){if(_0x238e78[_0xdc07('0xbc')]){var _0x500f8e=_0x238e78[_0xdc07('0xbc')][_0xdc07('0xa8')](_0x238e78[_0xdc07('0xbc')]['lastIndexOf']('.')+0x1);if(_0x500f8e===_0xdc07('0xc2')||_0x500f8e==='DoubleAttributeMetadata'||_0x500f8e===_0xdc07('0xc3')||_0x500f8e==='IntegerAttributeMetadata'||_0x500f8e===_0xdc07('0xc4')||_0x500f8e==='DateTimeAttributeMetadata'||_0x500f8e===_0xdc07('0xc5')||_0x500f8e===_0xdc07('0xc6')||_0x500f8e==='StateAttributeMetadata'||_0x500f8e===_0xdc07('0xc7')){_0x2d3a8f['push'](getInputList(_0xe60e8c,_0x54f94e,_0x500f8e,_0x1c76ce,_0x4d7b0b['MetadataId'],_0x238e78[_0xdc07('0xb3')],_0x5527cc));}}});return Promise['all'](_0x2d3a8f);})[_0xdc07('0x18')](function(_0x54e748){_0x44a22b=_0x54e748[0x0];var _0x3e6093=_0x210e67[_0xdc07('0xa1')](_0x1c888c)[_0xdc07('0xa1')](_0x44a22b);var _0x38f85a={'count':_0x3e6093[_0xdc07('0x50')],'rows':_0x3e6093};return _0x38f85a;})['then'](respondWithResult(_0x439053,null))[_0xdc07('0x22')](function(_0x260e65){console[_0xdc07('0xc8')](_0xdc07('0xc9')+_0x260e65);var _0x55f36a=_0x47528d[_0xdc07('0x38')][_0xdc07('0x15')]?0x1f4:_0x260e65[_0xdc07('0xca')]||0x1f4;logger['error'](_0x260e65[_0xdc07('0x31')]);delete _0x260e65[_0xdc07('0x32')];if(_0x55f36a===0x191){_0x55f36a=0x190;}_0x439053[_0xdc07('0x24')](_0x55f36a)[_0xdc07('0x33')](_0x47528d[_0xdc07('0x38')][_0xdc07('0x15')]?{'message':_0xdc07('0xcb'),'statusCode':_0x260e65[_0xdc07('0xca')]}:_0x260e65);});};function getSelectList(_0x389e08,_0x26fdbf,_0x5b8e97,_0x33e8f8,_0x328f59,_0x121757){var _0x4bc816={'method':_0xdc07('0xb0'),'uri':_0x389e08+_0xdc07('0xb4')+_0x33e8f8+')/Attributes('+_0x328f59+_0xdc07('0xcc')+_0xdc07('0xcd'),'headers':{'Authorization':_0xdc07('0xb6')+_0x121757,'If-None-Match':null,'OData-Version':_0xdc07('0xb2')},'json':!![]};return rp(_0x4bc816)['then'](function(_0x370b40){var _0x176b57=[];var _0x448788=_0x370b40[_0xdc07('0xce')]['Options'];_0x448788['forEach'](function(_0x2a91d1){_0x176b57['push']({'name':_0x2a91d1[_0xdc07('0xcf')]['UserLocalizedLabel']['Label'],'value':String(_0x2a91d1['Value'])});});var _0x5d7e8c={'id':_0x26fdbf+'_'+_0x370b40['LogicalName'],'name':_0x370b40['DisplayName'][_0xdc07('0xd0')]['Label'],'custom':![],'options':_0x176b57};_0x5b8e97[_0xdc07('0xbe')](_0x5d7e8c);return _0x5b8e97;});}function getBooleanList(_0x157ca8,_0x324036,_0x30ab26,_0x108c3a,_0x2bfe4c,_0x26cec7){var _0x12e559={'method':_0xdc07('0xb0'),'uri':_0x157ca8+_0xdc07('0xb4')+_0x108c3a+_0xdc07('0xd1')+_0x2bfe4c+_0xdc07('0xd2'),'headers':{'Authorization':'Bearer\x20'+_0x26cec7,'If-None-Match':null,'OData-Version':_0xdc07('0xb2')},'json':!![]};return rp(_0x12e559)[_0xdc07('0x18')](function(_0x31f1aa){var _0x355633=[];_0x355633[_0xdc07('0xbe')]({'name':_0x31f1aa[_0xdc07('0xce')]['TrueOption']['Label'][_0xdc07('0xd0')]['Label'],'value':_0xdc07('0xd3')},{'name':_0x31f1aa[_0xdc07('0xce')][_0xdc07('0xd4')][_0xdc07('0xcf')]['UserLocalizedLabel'][_0xdc07('0xcf')],'value':_0xdc07('0xd5')});var _0x44946f={'id':_0x324036+'_'+_0x31f1aa['LogicalName'],'name':_0x31f1aa[_0xdc07('0xd6')][_0xdc07('0xd0')][_0xdc07('0xcf')],'custom':![],'options':_0x355633};_0x30ab26[_0xdc07('0xbe')](_0x44946f);return _0x30ab26;});}function getInputList(_0x13ed1b,_0x378f3a,_0x3b261d,_0x326303,_0x23f223,_0x26892a,_0x57465b){var _0x8f2050={'method':'GET','uri':_0x13ed1b+_0xdc07('0xb4')+_0x23f223+_0xdc07('0xd1')+_0x26892a+_0xdc07('0xd7')+_0x3b261d+_0xdc07('0xd8'),'headers':{'Authorization':_0xdc07('0xb6')+_0x57465b,'If-None-Match':null,'OData-Version':_0xdc07('0xb2')},'json':!![]};return rp(_0x8f2050)[_0xdc07('0x18')](function(_0x3eac9c){var _0x48c63a={'id':_0x378f3a+'_'+_0x3eac9c[_0xdc07('0xba')],'name':_0x3eac9c[_0xdc07('0xd6')][_0xdc07('0xd0')]?_0x3eac9c[_0xdc07('0xd6')][_0xdc07('0xd0')][_0xdc07('0xcf')]:_0x3eac9c[_0xdc07('0xba')],'custom':![],'options':[]};_0x326303[_0xdc07('0xbe')](_0x48c63a);return _0x326303;});} \ No newline at end of file +var _0xa7fa=['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','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','name','send','index','Dynamics365Account','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','findAll','rows','catch','show','params','length','includeAll','include','options','body','find','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','channel','type','getDescriptions','create','Dynamics365Field','Descriptions','getFields','ticketType','Incident','title','description','customerid','ownerid','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','parentcaseidname','primarycontactidname','primarycontactidyominame','productserialnumber','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','slice','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','all','isNil','push','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','log','Dynamics365\x20error:\x20','stack','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','LogicalName','DisplayName','UserLocalizedLabel','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test'];(function(_0xb6a965,_0x5c5ace){var _0x51d37d=function(_0x1c7c0d){while(--_0x1c7c0d){_0xb6a965['push'](_0xb6a965['shift']());}};_0x51d37d(++_0x5c5ace);}(_0xa7fa,0x197));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xaa7f('0x0'));var emlformat=require(_0xaa7f('0x1'));var rimraf=require(_0xaa7f('0x2'));var zipdir=require(_0xaa7f('0x3'));var jsonpatch=require(_0xaa7f('0x4'));var rp=require('request-promise');var moment=require(_0xaa7f('0x5'));var BPromise=require(_0xaa7f('0x6'));var Mustache=require(_0xaa7f('0x7'));var util=require('util');var path=require('path');var sox=require(_0xaa7f('0x8'));var csv=require(_0xaa7f('0x9'));var ejs=require(_0xaa7f('0xa'));var fs=require('fs');var _=require(_0xaa7f('0xb'));var squel=require(_0xaa7f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa7f('0xd'));var toCsv=require(_0xaa7f('0x9'));var querystring=require(_0xaa7f('0xe'));var Papa=require(_0xaa7f('0xf'));var Redis=require(_0xaa7f('0x10'));var authService=require(_0xaa7f('0x11'));var qs=require(_0xaa7f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa7f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa7f('0x14'));var db=require(_0xaa7f('0x15'))['db'];var integrations=require(_0xaa7f('0x16'));var jayson=require(_0xaa7f('0x17'));var client=jayson[_0xaa7f('0x18')][_0xaa7f('0x19')]({'port':0x232a});function checkPasswordPattern(_0x535268,_0x4f68c1,_0x881ac7){if(_0x881ac7){var _0x28c684=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28c684[_0xaa7f('0x1a')](_0x4f68c1)){return _0x535268;}else{throw new db[(_0xaa7f('0x1b'))][(_0xaa7f('0x1c'))](_0xaa7f('0x1d'));}}else{return _0x535268;}}function respondWithRpcPromise(_0x35748b,_0x5d28c1,_0x17df49,_0x2ffe70){return new BPromise(function(_0x1d9fa5,_0x40b774){var _0x147201=_0x2ffe70||client;return _0x147201['request'](_0x35748b,_0x17df49)[_0xaa7f('0x1e')](function(_0x2d43d7){logger[_0xaa7f('0x1f')](_0xaa7f('0x20'),_0x5d28c1,'request\x20sent');logger[_0xaa7f('0x21')](_0xaa7f('0x22'),_0x5d28c1,_0xaa7f('0x23'),JSON['stringify'](_0x2d43d7));if(_0x2d43d7['error']){if(_0x2d43d7['error'][_0xaa7f('0x24')]===0x1f4){logger[_0xaa7f('0x25')](_0xaa7f('0x20'),_0x5d28c1,_0x2d43d7['error'][_0xaa7f('0x26')]);return _0x40b774(_0x2d43d7['error'][_0xaa7f('0x26')]);}logger['error'](_0xaa7f('0x20'),_0x5d28c1,_0x2d43d7[_0xaa7f('0x25')][_0xaa7f('0x26')]);return _0x1d9fa5(_0x2d43d7[_0xaa7f('0x25')][_0xaa7f('0x26')]);}else{logger[_0xaa7f('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x5d28c1,_0xaa7f('0x23'));_0x1d9fa5(_0x2d43d7['result']['message']);}})['catch'](function(_0x454dc3){logger[_0xaa7f('0x25')](_0xaa7f('0x20'),_0x5d28c1,_0x454dc3);_0x40b774(_0x454dc3);});});}function respondWithStatusCode(_0x3c69fd,_0x20c9a1){_0x20c9a1=_0x20c9a1||0xcc;return function(_0x120ef7){if(_0x120ef7){return _0x3c69fd[_0xaa7f('0x27')](_0x20c9a1);}return _0x3c69fd[_0xaa7f('0x28')](_0x20c9a1)[_0xaa7f('0x29')]();};}function respondWithResult(_0x3972e4,_0x173f69){_0x173f69=_0x173f69||0xc8;return function(_0x34188f){if(_0x34188f){return _0x3972e4[_0xaa7f('0x28')](_0x173f69)[_0xaa7f('0x2a')](_0x34188f);}};}function respondWithFilteredResult(_0x2a5d0b,_0x5c3215){return function(_0x2b28a2){if(_0x2b28a2){var _0xcadcb1=_0x2b28a2[_0xaa7f('0x2b')],_0x30d05a=_0x5c3215[_0xaa7f('0x2c')],_0x5504c6=_0x5c3215[_0xaa7f('0x2c')]+_0x5c3215['limit'],_0x2f978c;if(_0x5504c6>=_0xcadcb1){_0x5504c6=_0xcadcb1;_0x2f978c=0xc8;}else{_0x2f978c=0xce;}_0x2a5d0b[_0xaa7f('0x28')](_0x2f978c);return _0x2a5d0b['set'](_0xaa7f('0x2d'),_0x30d05a+'-'+_0x5504c6+'/'+_0xcadcb1)[_0xaa7f('0x2a')](_0x2b28a2);}return null;};}function patchUpdates(_0x39a875){return function(_0x295128){try{jsonpatch[_0xaa7f('0x2e')](_0x295128,_0x39a875,!![]);}catch(_0xece6bd){return BPromise[_0xaa7f('0x2f')](_0xece6bd);}return _0x295128['save']();};}function saveUpdates(_0x110da5,_0x1094f6){return function(_0x360b05){if(_0x360b05){return _0x360b05[_0xaa7f('0x30')](_0x110da5)[_0xaa7f('0x1e')](function(_0x1d8ec8){return _0x1d8ec8;});}return null;};}function removeEntity(_0x1be7a7,_0x240ac1){return function(_0x3b558c){if(_0x3b558c){return _0x3b558c[_0xaa7f('0x31')]()[_0xaa7f('0x1e')](function(){_0x1be7a7[_0xaa7f('0x28')](0xcc)[_0xaa7f('0x29')]();});}};}function handleEntityNotFound(_0x527745,_0x536276){return function(_0x4631ed){if(!_0x4631ed){_0x527745['sendStatus'](0x194);}return _0x4631ed;};}function handleError(_0x5d7cfa,_0xcd28b9){_0xcd28b9=_0xcd28b9||0x1f4;return function(_0x2887b1){logger['error'](_0x2887b1['stack']);if(_0x2887b1[_0xaa7f('0x32')]){delete _0x2887b1[_0xaa7f('0x32')];}_0x5d7cfa[_0xaa7f('0x28')](_0xcd28b9)[_0xaa7f('0x33')](_0x2887b1);};}exports[_0xaa7f('0x34')]=function(_0x1bd34d,_0x62a922){var _0x4dedfd={},_0x31ee6f={},_0x6baa5e={'count':0x0,'rows':[]};var _0x17dcb3=db[_0xaa7f('0x35')][_0xaa7f('0x36')];_0x31ee6f[_0xaa7f('0x37')]=_[_0xaa7f('0x38')](_0x17dcb3);_0x31ee6f['query']=_[_0xaa7f('0x38')](_0x1bd34d[_0xaa7f('0x39')]);_0x31ee6f[_0xaa7f('0x3a')]=_[_0xaa7f('0x3b')](_0x31ee6f[_0xaa7f('0x37')],_0x31ee6f[_0xaa7f('0x39')]);_0x4dedfd[_0xaa7f('0x3c')]=_['intersection'](_0x31ee6f[_0xaa7f('0x37')],qs[_0xaa7f('0x3d')](_0x1bd34d['query'][_0xaa7f('0x3d')]));_0x4dedfd[_0xaa7f('0x3c')]=_0x4dedfd[_0xaa7f('0x3c')]['length']?_0x4dedfd['attributes']:_0x31ee6f[_0xaa7f('0x37')];if(!_0x1bd34d[_0xaa7f('0x39')][_0xaa7f('0x3e')]('nolimit')){_0x4dedfd[_0xaa7f('0x3f')]=qs[_0xaa7f('0x3f')](_0x1bd34d['query'][_0xaa7f('0x3f')]);_0x4dedfd['offset']=qs['offset'](_0x1bd34d[_0xaa7f('0x39')][_0xaa7f('0x2c')]);}_0x4dedfd[_0xaa7f('0x40')]=qs[_0xaa7f('0x41')](_0x1bd34d[_0xaa7f('0x39')][_0xaa7f('0x41')]);_0x4dedfd[_0xaa7f('0x42')]=qs['filters'](_[_0xaa7f('0x43')](_0x1bd34d['query'],_0x31ee6f[_0xaa7f('0x3a')]));if(_0x1bd34d[_0xaa7f('0x39')][_0xaa7f('0x44')]){_0x4dedfd[_0xaa7f('0x42')]=_[_0xaa7f('0x45')](_0x4dedfd['where'],{'$or':_[_0xaa7f('0x46')](_0x17dcb3,function(_0x436399){if(_0x436399['type'][_0xaa7f('0x47')]!==_0xaa7f('0x48')){var _0x5ec457={};_0x5ec457[_0x436399[_0xaa7f('0x49')]]={'$like':'%'+_0x1bd34d[_0xaa7f('0x39')][_0xaa7f('0x44')]+'%'};return _0x5ec457;}})});}_0x4dedfd=_[_0xaa7f('0x45')]({},_0x4dedfd,_0x1bd34d['options']);var _0x4011ea={'where':_0x4dedfd[_0xaa7f('0x42')]};return db['Dynamics365Account'][_0xaa7f('0x2b')](_0x4011ea)[_0xaa7f('0x1e')](function(_0x3f3ed7){_0x6baa5e['count']=_0x3f3ed7;if(_0x1bd34d[_0xaa7f('0x39')]['includeAll']){_0x4dedfd['include']=[{'all':!![]}];}return db[_0xaa7f('0x35')][_0xaa7f('0x4a')](_0x4dedfd);})[_0xaa7f('0x1e')](function(_0x3d7f98){_0x6baa5e[_0xaa7f('0x4b')]=_0x3d7f98;return _0x6baa5e;})[_0xaa7f('0x1e')](respondWithFilteredResult(_0x62a922,_0x4dedfd))[_0xaa7f('0x4c')](handleError(_0x62a922,null));};exports[_0xaa7f('0x4d')]=function(_0x6a2d99,_0x5ef84f){var _0x7fa2bb={'raw':![],'where':{'id':_0x6a2d99[_0xaa7f('0x4e')]['id']}},_0x2c4a52={};_0x2c4a52[_0xaa7f('0x37')]=_[_0xaa7f('0x38')](db[_0xaa7f('0x35')][_0xaa7f('0x36')]);_0x2c4a52[_0xaa7f('0x39')]=_[_0xaa7f('0x38')](_0x6a2d99['query']);_0x2c4a52[_0xaa7f('0x3a')]=_[_0xaa7f('0x3b')](_0x2c4a52[_0xaa7f('0x37')],_0x2c4a52['query']);_0x7fa2bb[_0xaa7f('0x3c')]=_[_0xaa7f('0x3b')](_0x2c4a52[_0xaa7f('0x37')],qs[_0xaa7f('0x3d')](_0x6a2d99[_0xaa7f('0x39')][_0xaa7f('0x3d')]));_0x7fa2bb[_0xaa7f('0x3c')]=_0x7fa2bb[_0xaa7f('0x3c')][_0xaa7f('0x4f')]?_0x7fa2bb[_0xaa7f('0x3c')]:_0x2c4a52[_0xaa7f('0x37')];if(_0x6a2d99[_0xaa7f('0x39')][_0xaa7f('0x50')]){_0x7fa2bb[_0xaa7f('0x51')]=[{'all':!![]}];}_0x7fa2bb=_[_0xaa7f('0x45')]({},_0x7fa2bb,_0x6a2d99[_0xaa7f('0x52')]);return db[_0xaa7f('0x35')]['find'](_0x7fa2bb)[_0xaa7f('0x1e')](handleEntityNotFound(_0x5ef84f,null))[_0xaa7f('0x1e')](respondWithResult(_0x5ef84f,null))[_0xaa7f('0x4c')](handleError(_0x5ef84f,null));};exports['create']=function(_0x52e45a,_0x49f30f){return db['Dynamics365Account']['create'](_0x52e45a['body'],{})[_0xaa7f('0x1e')](respondWithResult(_0x49f30f,0xc9))['catch'](handleError(_0x49f30f,null));};exports['update']=function(_0x1bc110,_0x406a56){if(_0x1bc110[_0xaa7f('0x53')]['id']){delete _0x1bc110[_0xaa7f('0x53')]['id'];}return db[_0xaa7f('0x35')]['find']({'where':{'id':_0x1bc110['params']['id']}})[_0xaa7f('0x1e')](handleEntityNotFound(_0x406a56,null))[_0xaa7f('0x1e')](saveUpdates(_0x1bc110[_0xaa7f('0x53')],null))[_0xaa7f('0x1e')](respondWithResult(_0x406a56,null))[_0xaa7f('0x4c')](handleError(_0x406a56,null));};exports[_0xaa7f('0x31')]=function(_0x1f7e60,_0x383524){return db['Dynamics365Account'][_0xaa7f('0x54')]({'where':{'id':_0x1f7e60['params']['id']}})[_0xaa7f('0x1e')](handleEntityNotFound(_0x383524,null))[_0xaa7f('0x1e')](removeEntity(_0x383524,null))[_0xaa7f('0x4c')](handleError(_0x383524,null));};exports[_0xaa7f('0x55')]=function(_0x5f0018,_0x290957,_0x7eb1c0){var _0x219b9b={};var _0x205a21={};var _0x299b45;var _0x48030b;return db[_0xaa7f('0x35')][_0xaa7f('0x56')]({'where':{'id':_0x5f0018[_0xaa7f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x290957,null))[_0xaa7f('0x1e')](function(_0x5727c1){if(_0x5727c1){_0x299b45=_0x5727c1;_0x205a21[_0xaa7f('0x37')]=_['keys'](db[_0xaa7f('0x57')]['rawAttributes']);_0x205a21[_0xaa7f('0x39')]=_[_0xaa7f('0x38')](_0x5f0018[_0xaa7f('0x39')]);_0x205a21[_0xaa7f('0x3a')]=_[_0xaa7f('0x3b')](_0x205a21['model'],_0x205a21['query']);_0x219b9b[_0xaa7f('0x3c')]=_[_0xaa7f('0x3b')](_0x205a21[_0xaa7f('0x37')],qs['fields'](_0x5f0018[_0xaa7f('0x39')][_0xaa7f('0x3d')]));_0x219b9b[_0xaa7f('0x3c')]=_0x219b9b[_0xaa7f('0x3c')][_0xaa7f('0x4f')]?_0x219b9b['attributes']:_0x205a21['model'];_0x219b9b[_0xaa7f('0x40')]=qs['sort'](_0x5f0018[_0xaa7f('0x39')][_0xaa7f('0x41')]);_0x219b9b[_0xaa7f('0x42')]=qs[_0xaa7f('0x3a')](_[_0xaa7f('0x43')](_0x5f0018[_0xaa7f('0x39')],_0x205a21[_0xaa7f('0x3a')]));if(_0x5f0018[_0xaa7f('0x39')][_0xaa7f('0x44')]){_0x219b9b['where']=_[_0xaa7f('0x45')](_0x219b9b[_0xaa7f('0x42')],{'$or':_[_0xaa7f('0x46')](_0x219b9b[_0xaa7f('0x3c')],function(_0x1a183b){var _0x397372={};_0x397372[_0x1a183b]={'$like':'%'+_0x5f0018[_0xaa7f('0x39')]['filter']+'%'};return _0x397372;})});}_0x219b9b=_['merge']({},_0x219b9b,_0x5f0018['options']);return _0x299b45['getConfigurations'](_0x219b9b);}})[_0xaa7f('0x1e')](function(_0x1c509a){if(_0x1c509a){_0x48030b=_0x1c509a['length'];if(!_0x5f0018[_0xaa7f('0x39')][_0xaa7f('0x3e')](_0xaa7f('0x58'))){_0x219b9b[_0xaa7f('0x3f')]=qs[_0xaa7f('0x3f')](_0x5f0018[_0xaa7f('0x39')][_0xaa7f('0x3f')]);_0x219b9b[_0xaa7f('0x2c')]=qs[_0xaa7f('0x2c')](_0x5f0018[_0xaa7f('0x39')][_0xaa7f('0x2c')]);}return _0x299b45[_0xaa7f('0x55')](_0x219b9b);}})[_0xaa7f('0x1e')](function(_0x194184){if(_0x194184){return _0x194184?{'count':_0x48030b,'rows':_0x194184}:null;}})[_0xaa7f('0x1e')](respondWithResult(_0x290957,null))[_0xaa7f('0x4c')](handleError(_0x290957,null));};exports[_0xaa7f('0x59')]=function(_0x2cf6f0,_0x200196,_0x4cf09d){if(_0x2cf6f0[_0xaa7f('0x53')]['id']){delete _0x2cf6f0[_0xaa7f('0x53')]['id'];}return db[_0xaa7f('0x35')][_0xaa7f('0x56')]({'where':{'id':_0x2cf6f0[_0xaa7f('0x4e')]['id']}})[_0xaa7f('0x1e')](handleEntityNotFound(_0x200196,null))['then'](function(_0x41958a){if(_0x41958a){_0x2cf6f0[_0xaa7f('0x53')][_0xaa7f('0x5a')]=_0x41958a['id'];_0x2cf6f0['body'][_0xaa7f('0x5b')]=integrations['getSubjects'](_0x2cf6f0[_0xaa7f('0x53')][_0xaa7f('0x5c')],_0x2cf6f0[_0xaa7f('0x53')][_0xaa7f('0x5d')]);_0x2cf6f0['body']['Descriptions']=integrations[_0xaa7f('0x5e')](_0x2cf6f0['body'][_0xaa7f('0x5c')],_0x2cf6f0[_0xaa7f('0x53')][_0xaa7f('0x5d')]);return db['Dynamics365Configuration'][_0xaa7f('0x5f')](_0x2cf6f0[_0xaa7f('0x53')],{'include':[{'model':db[_0xaa7f('0x60')],'as':_0xaa7f('0x5b')},{'model':db[_0xaa7f('0x60')],'as':_0xaa7f('0x61')}]});}return null;})['then'](respondWithResult(_0x200196,null))[_0xaa7f('0x4c')](handleError(_0x200196,null));};exports[_0xaa7f('0x62')]=function(_0x3b8a1e,_0x1ef8e7,_0x246a45){var _0x1e2068=_0x3b8a1e[_0xaa7f('0x39')][_0xaa7f('0x63')];var _0x4ee0b0=_0x1e2068==='incident'?_0xaa7f('0x64'):'PhoneCall';var _0x482048='';var _0x3d18c9='';var _0x288b61='';var _0x5cfd34='';var _0x554569='';var _0x3ee1be='';var _0x356525='';var _0x34f2f9='';var _0x3c8dcd=[_0xaa7f('0x65'),_0xaa7f('0x66'),_0xaa7f('0x67'),_0xaa7f('0x68'),'caseorigincode','subject',_0xaa7f('0x69'),_0xaa7f('0x6a'),_0xaa7f('0x6b'),'phonecall_activity_parties'];var _0x52490f=[_0xaa7f('0x6c'),_0xaa7f('0x6d'),'actualserviceunits',_0xaa7f('0x6e'),_0xaa7f('0x6f'),'contactidyominame','contractdetailidname',_0xaa7f('0x70'),_0xaa7f('0x71'),_0xaa7f('0x72'),_0xaa7f('0x73'),'createdbyyominame',_0xaa7f('0x74'),_0xaa7f('0x75'),_0xaa7f('0x76'),'customeridname',_0xaa7f('0x77'),'customeridyominame',_0xaa7f('0x78'),_0xaa7f('0x79'),_0xaa7f('0x7a'),_0xaa7f('0x7b'),_0xaa7f('0x7c'),_0xaa7f('0x7d'),_0xaa7f('0x7e'),_0xaa7f('0x7f'),_0xaa7f('0x80'),_0xaa7f('0x81'),'kbarticleidname','lastonholdtime','masteridname',_0xaa7f('0x82'),'modifiedbyexternalpartyyominame',_0xaa7f('0x83'),_0xaa7f('0x84'),_0xaa7f('0x85'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xaa7f('0x86'),_0xaa7f('0x87'),_0xaa7f('0x88'),_0xaa7f('0x89'),_0xaa7f('0x8a'),'owneridname','owneridtype','owneridyominame',_0xaa7f('0x8b'),_0xaa7f('0x8c'),_0xaa7f('0x8d'),'prioritycodename','productidname',_0xaa7f('0x8e'),'resolveby',_0xaa7f('0x8f'),'responseby','responsiblecontactidname',_0xaa7f('0x90'),_0xaa7f('0x91'),_0xaa7f('0x92'),'slaname',_0xaa7f('0x93'),_0xaa7f('0x94'),_0xaa7f('0x95'),'subjectidname',_0xaa7f('0x96'),_0xaa7f('0x97'),_0xaa7f('0x98'),_0xaa7f('0x99'),_0xaa7f('0x9a'),_0xaa7f('0x9b')];var _0x55e373=_0x3c8dcd[_0xaa7f('0x9c')](_0x52490f);return db[_0xaa7f('0x35')][_0xaa7f('0x56')]({'where':{'id':_0x3b8a1e[_0xaa7f('0x4e')]['id']},'attributes':['id',_0xaa7f('0x9d'),_0xaa7f('0x9e'),_0xaa7f('0x9f'),'tenantId',_0xaa7f('0xa0'),_0xaa7f('0xa1')]})[_0xaa7f('0x1e')](handleEntityNotFound(_0x1ef8e7,null))[_0xaa7f('0x1e')](function(_0x321b57){if(_0x321b57){_0x34f2f9=_0x321b57[_0xaa7f('0x9f')];var _0xc769a8=_0x34f2f9[_0xaa7f('0xa2')](-0x1);if(_0xc769a8==='/'){_0x34f2f9=_0x34f2f9[_0xaa7f('0xa3')](0x0,_0x34f2f9['lastIndexOf'](_0xc769a8));}_0x356525=util[_0xaa7f('0xa4')](_0xaa7f('0xa5'),_0x34f2f9);var _0x387272={'method':_0xaa7f('0xa6'),'uri':_0xaa7f('0xa7')+_0x321b57['tenantId']+_0xaa7f('0xa8'),'form':{'client_id':_0x321b57[_0xaa7f('0xa0')],'resource':_0x34f2f9,'username':_0x321b57[_0xaa7f('0x9d')],'password':_0x321b57['password'],'grant_type':_0xaa7f('0x9e'),'client_secret':_0x321b57[_0xaa7f('0xa1')]},'json':!![]};return rp(_0x387272);}})[_0xaa7f('0x1e')](function(_0x486a36){_0x3ee1be=_0x486a36[_0xaa7f('0xa9')];var _0x15f858={'method':_0xaa7f('0xaa'),'uri':encodeURI(_0x356525+_0xaa7f('0xab')+_0x4ee0b0+'\x27'),'headers':{'Authorization':_0xaa7f('0xac')+_0x3ee1be,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x15f858);})['then'](function(_0x51a9ad){var _0x54791e=_0x51a9ad[_0xaa7f('0xad')][0x0];var _0x20d1d0=_0x54791e[_0xaa7f('0xae')];var _0x8fbeb={'method':_0xaa7f('0xaa'),'uri':_0x356525+_0xaa7f('0xaf')+_0x20d1d0+_0xaa7f('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x3ee1be,'If-None-Match':null,'OData-Version':_0xaa7f('0xb1')},'json':!![]};return rp(_0x8fbeb);})[_0xaa7f('0x1e')](function(_0x142544){_0x482048=_0x142544;_0x3d18c9=_0x482048[_0xaa7f('0xb2')];_0x3d18c9=_[_0xaa7f('0xb3')](_0x3d18c9,function(_0x40f730){return!_0x55e373[_0xaa7f('0xb4')](_0x40f730['LogicalName']);});var _0x5da7d2=[];var _0x40e0a9=[];_0x3d18c9[_0xaa7f('0xb5')](function(_0x9039f1){if(_0x9039f1[_0xaa7f('0xb6')]){var _0x783620=_0x9039f1['@odata.type']['substring'](_0x9039f1[_0xaa7f('0xb6')][_0xaa7f('0xb7')]('.')+0x1);if(_0x783620===_0xaa7f('0xb8')){_0x5da7d2['push'](getSelectList(_0x356525,_0x1e2068,_0x40e0a9,_0x482048['MetadataId'],_0x9039f1['MetadataId'],_0x3ee1be));}}});return Promise[_0xaa7f('0xb9')](_0x5da7d2);})[_0xaa7f('0x1e')](function(_0x1aa721){_0x288b61=_0x1aa721[0x0];var _0xbd97e8=[];var _0x4c99ff=[];_0x3d18c9['forEach'](function(_0x1ac296){if(!_[_0xaa7f('0xba')](_0x1ac296['@odata.type'])){var _0x38234d=_0x1ac296['@odata.type'][_0xaa7f('0xa3')](_0x1ac296['@odata.type'][_0xaa7f('0xb7')]('.')+0x1);if(_0x38234d==='BooleanAttributeMetadata'){_0xbd97e8[_0xaa7f('0xbb')](getBooleanList(_0x356525,_0x1e2068,_0x4c99ff,_0x482048[_0xaa7f('0xae')],_0x1ac296[_0xaa7f('0xae')],_0x3ee1be));}}});return Promise['all'](_0xbd97e8);})['then'](function(_0x476c38){_0x5cfd34=_0x476c38[0x0];var _0x2e6c6c=[];var _0x15f5b8=[];_0x3d18c9[_0xaa7f('0xb5')](function(_0x3774ce){if(_0x3774ce[_0xaa7f('0xb6')]){var _0x2b7f87=_0x3774ce['@odata.type'][_0xaa7f('0xa3')](_0x3774ce[_0xaa7f('0xb6')]['lastIndexOf']('.')+0x1);if(_0x2b7f87==='StringAttributeMetadata'||_0x2b7f87===_0xaa7f('0xbc')||_0x2b7f87===_0xaa7f('0xbd')||_0x2b7f87===_0xaa7f('0xbe')||_0x2b7f87===_0xaa7f('0xbf')||_0x2b7f87===_0xaa7f('0xc0')||_0x2b7f87===_0xaa7f('0xc1')||_0x2b7f87===_0xaa7f('0xc2')||_0x2b7f87===_0xaa7f('0xc3')||_0x2b7f87===_0xaa7f('0xc4')){_0x2e6c6c[_0xaa7f('0xbb')](getInputList(_0x356525,_0x1e2068,_0x2b7f87,_0x15f5b8,_0x482048[_0xaa7f('0xae')],_0x3774ce[_0xaa7f('0xae')],_0x3ee1be));}}});return Promise[_0xaa7f('0xb9')](_0x2e6c6c);})['then'](function(_0x48366a){_0x554569=_0x48366a[0x0];var _0x2e26ff=_0x288b61['concat'](_0x5cfd34)[_0xaa7f('0x9c')](_0x554569);var _0x18899a={'count':_0x2e26ff['length'],'rows':_0x2e26ff};return _0x18899a;})[_0xaa7f('0x1e')](respondWithResult(_0x1ef8e7,null))['catch'](function(_0x384ada){console[_0xaa7f('0xc5')](_0xaa7f('0xc6')+_0x384ada);var _0x352866=_0x3b8a1e[_0xaa7f('0x39')][_0xaa7f('0x1a')]?0x1f4:_0x384ada['statusCode']||0x1f4;logger[_0xaa7f('0x25')](_0x384ada[_0xaa7f('0xc7')]);delete _0x384ada[_0xaa7f('0x32')];if(_0x352866===0x191){_0x352866=0x190;}_0x1ef8e7[_0xaa7f('0x28')](_0x352866)[_0xaa7f('0x33')](_0x3b8a1e['query'][_0xaa7f('0x1a')]?{'message':_0xaa7f('0xc8'),'statusCode':_0x384ada[_0xaa7f('0xc9')]}:_0x384ada);});};function getSelectList(_0x5b0427,_0x4cad33,_0x68e9e1,_0x23bb49,_0x158562,_0x515e6d){var _0x19f1b6={'method':_0xaa7f('0xaa'),'uri':_0x5b0427+_0xaa7f('0xaf')+_0x23bb49+_0xaa7f('0xca')+_0x158562+_0xaa7f('0xcb')+_0xaa7f('0xcc'),'headers':{'Authorization':_0xaa7f('0xac')+_0x515e6d,'If-None-Match':null,'OData-Version':_0xaa7f('0xb1')},'json':!![]};return rp(_0x19f1b6)[_0xaa7f('0x1e')](function(_0x3434c6){var _0x5b49e2=[];var _0x4aedb9=_0x3434c6[_0xaa7f('0xcd')][_0xaa7f('0xce')];_0x4aedb9[_0xaa7f('0xb5')](function(_0x1ccdb5){_0x5b49e2['push']({'name':_0x1ccdb5['Label']['UserLocalizedLabel'][_0xaa7f('0xcf')],'value':String(_0x1ccdb5[_0xaa7f('0xd0')])});});var _0x561ae7={'id':_0x4cad33+'_'+_0x3434c6[_0xaa7f('0xd1')],'name':_0x3434c6[_0xaa7f('0xd2')][_0xaa7f('0xd3')][_0xaa7f('0xcf')],'custom':![],'options':_0x5b49e2};_0x68e9e1[_0xaa7f('0xbb')](_0x561ae7);return _0x68e9e1;});}function getBooleanList(_0xc489a3,_0x5bacc8,_0x5c7546,_0x46ff78,_0x56e924,_0x3f22c6){var _0x5c446d={'method':_0xaa7f('0xaa'),'uri':_0xc489a3+_0xaa7f('0xaf')+_0x46ff78+_0xaa7f('0xca')+_0x56e924+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x3f22c6,'If-None-Match':null,'OData-Version':_0xaa7f('0xb1')},'json':!![]};return rp(_0x5c446d)['then'](function(_0x5398a4){var _0x5a3220=[];_0x5a3220[_0xaa7f('0xbb')]({'name':_0x5398a4[_0xaa7f('0xcd')]['TrueOption'][_0xaa7f('0xcf')]['UserLocalizedLabel'][_0xaa7f('0xcf')],'value':_0xaa7f('0xd4')},{'name':_0x5398a4[_0xaa7f('0xcd')][_0xaa7f('0xd5')][_0xaa7f('0xcf')]['UserLocalizedLabel']['Label'],'value':_0xaa7f('0xd6')});var _0x5a2901={'id':_0x5bacc8+'_'+_0x5398a4[_0xaa7f('0xd1')],'name':_0x5398a4[_0xaa7f('0xd2')]['UserLocalizedLabel'][_0xaa7f('0xcf')],'custom':![],'options':_0x5a3220};_0x5c7546['push'](_0x5a2901);return _0x5c7546;});}function getInputList(_0x3c4c59,_0x1744dc,_0x472a4f,_0x554d62,_0x277f96,_0x3dba71,_0x31b767){var _0x50fee9={'method':_0xaa7f('0xaa'),'uri':_0x3c4c59+_0xaa7f('0xaf')+_0x277f96+_0xaa7f('0xca')+_0x3dba71+_0xaa7f('0xd7')+_0x472a4f+_0xaa7f('0xd8'),'headers':{'Authorization':_0xaa7f('0xac')+_0x31b767,'If-None-Match':null,'OData-Version':_0xaa7f('0xb1')},'json':!![]};return rp(_0x50fee9)[_0xaa7f('0x1e')](function(_0x4a29df){var _0x2444df={'id':_0x1744dc+'_'+_0x4a29df[_0xaa7f('0xd1')],'name':_0x4a29df[_0xaa7f('0xd2')][_0xaa7f('0xd3')]?_0x4a29df[_0xaa7f('0xd2')][_0xaa7f('0xd3')][_0xaa7f('0xcf')]:_0x4a29df[_0xaa7f('0xd1')],'custom':![],'options':[]};_0x554d62['push'](_0x2444df);return _0x554d62;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 59a1d12..6d510c9 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 _0x92c8=['../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x92c8,0xdc));var _0x892c=function(_0x13d637,_0x4e9412){_0x13d637=_0x13d637-0x0;var _0x53d5d8=_0x92c8[_0x13d637];return _0x53d5d8;};'use strict';var _=require(_0x892c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x892c('0x1'));var moment=require('moment');var BPromise=require(_0x892c('0x2'));var rp=require(_0x892c('0x3'));var fs=require('fs');var path=require(_0x892c('0x4'));var rimraf=require(_0x892c('0x5'));var config=require(_0x892c('0x6'));var attributes=require(_0x892c('0x7'));var integrations=require(_0x892c('0x8'));module[_0x892c('0x9')]=function(_0x5a235f,_0xd20e00){return _0x5a235f['define'](_0x892c('0xa'),attributes,{'tableName':_0x892c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19d2=['../../components/integrations/configuration','exports','define','Dynamics365Account','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x60fd6c,_0x84596e){var _0x36e88a=function(_0x108fef){while(--_0x108fef){_0x60fd6c['push'](_0x60fd6c['shift']());}};_0x36e88a(++_0x84596e);}(_0x19d2,0x11c));var _0x219d=function(_0xd20adf,_0x1fc485){_0xd20adf=_0xd20adf-0x0;var _0x15cd5d=_0x19d2[_0xd20adf];return _0x15cd5d;};'use strict';var _=require('lodash');var util=require(_0x219d('0x0'));var logger=require(_0x219d('0x1'))(_0x219d('0x2'));var moment=require(_0x219d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x219d('0x4'));var rimraf=require('rimraf');var config=require(_0x219d('0x5'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x219d('0x6'));module[_0x219d('0x7')]=function(_0x179535,_0x862acb){return _0x179535[_0x219d('0x8')](_0x219d('0x9'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f42065e..178f39c 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 _0x89b8=['attributes','include','map','model','GetDynamics365Account','ShowDynamics365Account','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','Dynamics365Account','options','raw','where'];(function(_0x5d242a,_0x34ced5){var _0x17649d=function(_0x461da2){while(--_0x461da2){_0x5d242a['push'](_0x5d242a['shift']());}};_0x17649d(++_0x34ced5);}(_0x89b8,0x19f));var _0x889b=function(_0x4c87c6,_0x5689f0){_0x4c87c6=_0x4c87c6-0x0;var _0x2e4819=_0x89b8[_0x4c87c6];return _0x2e4819;};'use strict';var _=require(_0x889b('0x0'));var util=require(_0x889b('0x1'));var moment=require(_0x889b('0x2'));var BPromise=require(_0x889b('0x3'));var rs=require(_0x889b('0x4'));var fs=require('fs');var Redis=require(_0x889b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x889b('0x6'));var logger=require(_0x889b('0x7'))(_0x889b('0x8'));var config=require('../../config/environment');var jayson=require(_0x889b('0x9'));var client=jayson[_0x889b('0xa')][_0x889b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49313d,_0x3ea048,_0x403af7){return new BPromise(function(_0x310a10,_0xaf7cdd){return client[_0x889b('0xc')](_0x49313d,_0x403af7)[_0x889b('0xd')](function(_0x430615){logger[_0x889b('0xe')](_0x889b('0xf'),_0x3ea048,_0x889b('0x10'));logger[_0x889b('0x11')](_0x889b('0x12'),_0x3ea048,'request\x20sent',JSON['stringify'](_0x430615));if(_0x430615[_0x889b('0x13')]){if(_0x430615[_0x889b('0x13')]['code']===0x1f4){logger[_0x889b('0x13')](_0x889b('0xf'),_0x3ea048,_0x430615['error'][_0x889b('0x14')]);return _0xaf7cdd(_0x430615['error'][_0x889b('0x14')]);}logger[_0x889b('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x3ea048,_0x430615[_0x889b('0x13')][_0x889b('0x14')]);return _0x310a10(_0x430615['error']['message']);}else{logger['info'](_0x889b('0xf'),_0x3ea048,_0x889b('0x10'));_0x310a10(_0x430615[_0x889b('0x15')][_0x889b('0x14')]);}})[_0x889b('0x16')](function(_0x339556){logger['error'](_0x889b('0xf'),_0x3ea048,_0x339556);_0xaf7cdd(_0x339556);});});}exports['GetDynamics365Account']=function(_0x1221ae){var _0x358ccf=this;return new Promise(function(_0x22b059,_0x3b2381){return db[_0x889b('0x17')]['findAll']({'raw':_0x1221ae[_0x889b('0x18')]?_0x1221ae[_0x889b('0x18')][_0x889b('0x19')]===undefined?!![]:![]:!![],'where':_0x1221ae[_0x889b('0x18')]?_0x1221ae[_0x889b('0x18')][_0x889b('0x1a')]||null:null,'attributes':_0x1221ae[_0x889b('0x18')]?_0x1221ae[_0x889b('0x18')][_0x889b('0x1b')]||null:null,'limit':_0x1221ae[_0x889b('0x18')]?_0x1221ae[_0x889b('0x18')]['limit']||null:null,'include':_0x1221ae['options']?_0x1221ae['options'][_0x889b('0x1c')]?_['map'](_0x1221ae['options'][_0x889b('0x1c')],function(_0x3ebaad){return{'model':db[_0x3ebaad['model']],'as':_0x3ebaad['as'],'attributes':_0x3ebaad[_0x889b('0x1b')],'include':_0x3ebaad['include']?_[_0x889b('0x1d')](_0x3ebaad[_0x889b('0x1c')],function(_0x2f9b13){return{'model':db[_0x2f9b13[_0x889b('0x1e')]],'as':_0x2f9b13['as'],'attributes':_0x2f9b13['attributes'],'include':_0x2f9b13['include']?_[_0x889b('0x1d')](_0x2f9b13['include'],function(_0x3962d8){return{'model':db[_0x3962d8['model']],'as':_0x3962d8['as'],'attributes':_0x3962d8[_0x889b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c7c92){logger[_0x889b('0xe')](_0x889b('0x1f'),_0x1221ae);logger[_0x889b('0x11')](_0x889b('0x1f'),_0x1221ae,JSON['stringify'](_0x3c7c92));_0x22b059(_0x3c7c92);})['catch'](function(_0x395aab){logger[_0x889b('0x13')]('GetDynamics365Account',_0x395aab['message'],_0x1221ae);_0x3b2381(_0x358ccf[_0x889b('0x13')](0x1f4,_0x395aab[_0x889b('0x14')]));});});};exports[_0x889b('0x20')]=function(_0x17408e){var _0x1321c9=this;return new Promise(function(_0xb6748b,_0x41c417){return db[_0x889b('0x17')]['find']({'raw':_0x17408e['options']?_0x17408e['options'][_0x889b('0x19')]===undefined?!![]:![]:!![],'where':_0x17408e['options']?_0x17408e[_0x889b('0x18')]['where']||null:null,'attributes':_0x17408e[_0x889b('0x18')]?_0x17408e[_0x889b('0x18')][_0x889b('0x1b')]||null:null,'include':_0x17408e[_0x889b('0x18')]?_0x17408e[_0x889b('0x18')]['include']?_[_0x889b('0x1d')](_0x17408e['options'][_0x889b('0x1c')],function(_0x38a24b){return{'model':db[_0x38a24b[_0x889b('0x1e')]],'as':_0x38a24b['as'],'attributes':_0x38a24b['attributes'],'include':_0x38a24b[_0x889b('0x1c')]?_[_0x889b('0x1d')](_0x38a24b[_0x889b('0x1c')],function(_0x3bde7b){return{'model':db[_0x3bde7b['model']],'as':_0x3bde7b['as'],'attributes':_0x3bde7b['attributes'],'include':_0x3bde7b['include']?_[_0x889b('0x1d')](_0x3bde7b['include'],function(_0x419202){return{'model':db[_0x419202[_0x889b('0x1e')]],'as':_0x419202['as'],'attributes':_0x419202[_0x889b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13e2bc){logger[_0x889b('0xe')](_0x889b('0x20'),_0x17408e);logger['debug'](_0x889b('0x20'),_0x17408e,JSON[_0x889b('0x21')](_0x13e2bc));_0xb6748b(_0x13e2bc);})[_0x889b('0x16')](function(_0x45a1ac){logger[_0x889b('0x13')](_0x889b('0x20'),_0x45a1ac[_0x889b('0x14')],_0x17408e);_0x41c417(_0x1321c9[_0x889b('0x13')](0x1f4,_0x45a1ac[_0x889b('0x14')]));});});}; \ No newline at end of file +var _0x2f2e=['../../config/utils','../../config/logger','rpc','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','map','include','model','ShowDynamics365Account','raw','util','moment','randomstring','../../mysqldb'];(function(_0x2ed618,_0x58e11e){var _0xafddb3=function(_0xc414e6){while(--_0xc414e6){_0x2ed618['push'](_0x2ed618['shift']());}};_0xafddb3(++_0x58e11e);}(_0x2f2e,0x146));var _0xe2f2=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x2f2e[_0x52a857];return _0x4e2aae;};'use strict';var _=require('lodash');var util=require(_0xe2f2('0x0'));var moment=require(_0xe2f2('0x1'));var BPromise=require('bluebird');var rs=require(_0xe2f2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2f2('0x3'))['db'];var utils=require(_0xe2f2('0x4'));var logger=require(_0xe2f2('0x5'))(_0xe2f2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe2f2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23f7a8,_0x2bdfe5,_0xc44c89){return new BPromise(function(_0x48111c,_0x514125){return client['request'](_0x23f7a8,_0xc44c89)[_0xe2f2('0x8')](function(_0x48ee72){logger[_0xe2f2('0x9')](_0xe2f2('0xa'),_0x2bdfe5,_0xe2f2('0xb'));logger[_0xe2f2('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2bdfe5,_0xe2f2('0xb'),JSON[_0xe2f2('0xd')](_0x48ee72));if(_0x48ee72['error']){if(_0x48ee72[_0xe2f2('0xe')][_0xe2f2('0xf')]===0x1f4){logger[_0xe2f2('0xe')](_0xe2f2('0xa'),_0x2bdfe5,_0x48ee72[_0xe2f2('0xe')][_0xe2f2('0x10')]);return _0x514125(_0x48ee72[_0xe2f2('0xe')][_0xe2f2('0x10')]);}logger[_0xe2f2('0xe')](_0xe2f2('0xa'),_0x2bdfe5,_0x48ee72['error'][_0xe2f2('0x10')]);return _0x48111c(_0x48ee72[_0xe2f2('0xe')][_0xe2f2('0x10')]);}else{logger[_0xe2f2('0x9')](_0xe2f2('0xa'),_0x2bdfe5,'request\x20sent');_0x48111c(_0x48ee72['result'][_0xe2f2('0x10')]);}})[_0xe2f2('0x11')](function(_0x37f965){logger['error'](_0xe2f2('0xa'),_0x2bdfe5,_0x37f965);_0x514125(_0x37f965);});});}exports[_0xe2f2('0x12')]=function(_0x22433f){var _0x511d90=this;return new Promise(function(_0x1cf5ac,_0x14f5f6){return db[_0xe2f2('0x13')][_0xe2f2('0x14')]({'raw':_0x22433f[_0xe2f2('0x15')]?_0x22433f[_0xe2f2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x22433f[_0xe2f2('0x15')]?_0x22433f[_0xe2f2('0x15')][_0xe2f2('0x16')]||null:null,'attributes':_0x22433f[_0xe2f2('0x15')]?_0x22433f[_0xe2f2('0x15')][_0xe2f2('0x17')]||null:null,'limit':_0x22433f[_0xe2f2('0x15')]?_0x22433f[_0xe2f2('0x15')][_0xe2f2('0x18')]||null:null,'include':_0x22433f[_0xe2f2('0x15')]?_0x22433f[_0xe2f2('0x15')]['include']?_[_0xe2f2('0x19')](_0x22433f[_0xe2f2('0x15')][_0xe2f2('0x1a')],function(_0x38c524){return{'model':db[_0x38c524[_0xe2f2('0x1b')]],'as':_0x38c524['as'],'attributes':_0x38c524[_0xe2f2('0x17')],'include':_0x38c524[_0xe2f2('0x1a')]?_[_0xe2f2('0x19')](_0x38c524[_0xe2f2('0x1a')],function(_0x47a9a8){return{'model':db[_0x47a9a8[_0xe2f2('0x1b')]],'as':_0x47a9a8['as'],'attributes':_0x47a9a8['attributes'],'include':_0x47a9a8[_0xe2f2('0x1a')]?_[_0xe2f2('0x19')](_0x47a9a8[_0xe2f2('0x1a')],function(_0x5595b2){return{'model':db[_0x5595b2[_0xe2f2('0x1b')]],'as':_0x5595b2['as'],'attributes':_0x5595b2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe2f2('0x8')](function(_0x4cb3c5){logger[_0xe2f2('0x9')](_0xe2f2('0x12'),_0x22433f);logger[_0xe2f2('0xc')](_0xe2f2('0x12'),_0x22433f,JSON[_0xe2f2('0xd')](_0x4cb3c5));_0x1cf5ac(_0x4cb3c5);})[_0xe2f2('0x11')](function(_0x542e69){logger[_0xe2f2('0xe')](_0xe2f2('0x12'),_0x542e69[_0xe2f2('0x10')],_0x22433f);_0x14f5f6(_0x511d90['error'](0x1f4,_0x542e69['message']));});});};exports[_0xe2f2('0x1c')]=function(_0x143b6a){var _0x1ef6cf=this;return new Promise(function(_0x2f8c8e,_0x54ebd9){return db[_0xe2f2('0x13')]['find']({'raw':_0x143b6a[_0xe2f2('0x15')]?_0x143b6a[_0xe2f2('0x15')][_0xe2f2('0x1d')]===undefined?!![]:![]:!![],'where':_0x143b6a[_0xe2f2('0x15')]?_0x143b6a['options'][_0xe2f2('0x16')]||null:null,'attributes':_0x143b6a[_0xe2f2('0x15')]?_0x143b6a[_0xe2f2('0x15')]['attributes']||null:null,'include':_0x143b6a['options']?_0x143b6a['options'][_0xe2f2('0x1a')]?_[_0xe2f2('0x19')](_0x143b6a[_0xe2f2('0x15')][_0xe2f2('0x1a')],function(_0xce5725){return{'model':db[_0xce5725['model']],'as':_0xce5725['as'],'attributes':_0xce5725[_0xe2f2('0x17')],'include':_0xce5725['include']?_[_0xe2f2('0x19')](_0xce5725[_0xe2f2('0x1a')],function(_0x555dba){return{'model':db[_0x555dba[_0xe2f2('0x1b')]],'as':_0x555dba['as'],'attributes':_0x555dba[_0xe2f2('0x17')],'include':_0x555dba[_0xe2f2('0x1a')]?_[_0xe2f2('0x19')](_0x555dba[_0xe2f2('0x1a')],function(_0x3c5841){return{'model':db[_0x3c5841[_0xe2f2('0x1b')]],'as':_0x3c5841['as'],'attributes':_0x3c5841[_0xe2f2('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f3c24){logger[_0xe2f2('0x9')]('ShowDynamics365Account',_0x143b6a);logger[_0xe2f2('0xc')](_0xe2f2('0x1c'),_0x143b6a,JSON[_0xe2f2('0xd')](_0x5f3c24));_0x2f8c8e(_0x5f3c24);})['catch'](function(_0x38f34f){logger['error'](_0xe2f2('0x1c'),_0x38f34f[_0xe2f2('0x10')],_0x143b6a);_0x54ebd9(_0x1ef6cf[_0xe2f2('0xe')](0x1f4,_0x38f34f[_0xe2f2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ee07078..368a53d 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 _0x6368=['index','/:id/fields','getFields','getSubjects','create','/:id','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6368,0x185));var _0x8636=function(_0x12c67c,_0x30a563){_0x12c67c=_0x12c67c-0x0;var _0x2ae078=_0x6368[_0x12c67c];return _0x2ae078;};'use strict';var multer=require(_0x8636('0x0'));var util=require(_0x8636('0x1'));var path=require('path');var timeout=require(_0x8636('0x2'));var express=require('express');var router=express[_0x8636('0x3')]();var auth=require(_0x8636('0x4'));var interaction=require(_0x8636('0x5'));var config=require(_0x8636('0x6'));var controller=require(_0x8636('0x7'));router[_0x8636('0x8')]('/',auth[_0x8636('0x9')](),controller[_0x8636('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8636('0x8')](_0x8636('0xb'),auth[_0x8636('0x9')](),controller[_0x8636('0xc')]);router[_0x8636('0x8')]('/:id/subjects',auth[_0x8636('0x9')](),controller[_0x8636('0xd')]);router[_0x8636('0x8')]('/:id/descriptions',auth[_0x8636('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x8636('0x9')](),controller[_0x8636('0xe')]);router['put'](_0x8636('0xf'),auth[_0x8636('0x9')](),controller[_0x8636('0x10')]);router[_0x8636('0x11')]('/:id',auth[_0x8636('0x9')](),controller[_0x8636('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf7c8=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xf7c8,0x66));var _0x8f7c=function(_0x1f369b,_0x1da4ac){_0x1f369b=_0x1f369b-0x0;var _0x32f8f9=_0xf7c8[_0x1f369b];return _0x32f8f9;};'use strict';var multer=require(_0x8f7c('0x0'));var util=require(_0x8f7c('0x1'));var path=require(_0x8f7c('0x2'));var timeout=require(_0x8f7c('0x3'));var express=require('express');var router=express[_0x8f7c('0x4')]();var auth=require(_0x8f7c('0x5'));var interaction=require(_0x8f7c('0x6'));var config=require(_0x8f7c('0x7'));var controller=require(_0x8f7c('0x8'));router[_0x8f7c('0x9')]('/',auth[_0x8f7c('0xa')](),controller[_0x8f7c('0xb')]);router['get'](_0x8f7c('0xc'),auth[_0x8f7c('0xa')](),controller[_0x8f7c('0xd')]);router['get']('/:id/fields',auth[_0x8f7c('0xa')](),controller['getFields']);router[_0x8f7c('0x9')](_0x8f7c('0xe'),auth['isAuthenticated'](),controller[_0x8f7c('0xf')]);router[_0x8f7c('0x9')](_0x8f7c('0x10'),auth[_0x8f7c('0xa')](),controller[_0x8f7c('0x11')]);router[_0x8f7c('0x12')]('/',auth[_0x8f7c('0xa')](),controller[_0x8f7c('0x13')]);router[_0x8f7c('0x14')](_0x8f7c('0xc'),auth[_0x8f7c('0xa')](),controller[_0x8f7c('0x15')]);router[_0x8f7c('0x16')](_0x8f7c('0xc'),auth[_0x8f7c('0xa')](),controller[_0x8f7c('0x17')]);module[_0x8f7c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c4f698a..9d79794 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 _0x5fdf=['ENUM','incident','phonecall','exports','STRING'];(function(_0x56155b,_0x53a962){var _0x4fa7de=function(_0xa3319a){while(--_0xa3319a){_0x56155b['push'](_0x56155b['shift']());}};_0x4fa7de(++_0x53a962);}(_0x5fdf,0xe4));var _0xf5fd=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x5fdf[_0x1e5cc3];return _0x15c596;};'use strict';var Sequelize=require('sequelize');module[_0xf5fd('0x0')]={'name':{'type':Sequelize[_0xf5fd('0x1')]},'description':{'type':Sequelize[_0xf5fd('0x1')]},'ticketType':{'type':Sequelize[_0xf5fd('0x2')](_0xf5fd('0x3'),_0xf5fd('0x4')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x1886=['STRING','incident','phonecall','sequelize','exports'];(function(_0x5a9017,_0x4312fc){var _0x596e52=function(_0x35843d){while(--_0x35843d){_0x5a9017['push'](_0x5a9017['shift']());}};_0x596e52(++_0x4312fc);}(_0x1886,0xd0));var _0x6188=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1886[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x6188('0x0'));module[_0x6188('0x1')]={'name':{'type':Sequelize[_0x6188('0x2')]},'description':{'type':Sequelize[_0x6188('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x6188('0x3'),_0x6188('0x4')),'defaultValue':_0x6188('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7b53ce4..d3dabca 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 _0xfc5d=['getFields','findOne','map','getSubjects','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','request','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','end','status','json','count','set','apply','reject','stack','name','send','index','Dynamics365Configuration','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','update','destroy'];(function(_0x164283,_0x4b3b5a){var _0x3f111e=function(_0x1c89d7){while(--_0x1c89d7){_0x164283['push'](_0x164283['shift']());}};_0x3f111e(++_0x4b3b5a);}(_0xfc5d,0xbc));var _0xdfc5=function(_0x992931,_0x55b8e4){_0x992931=_0x992931-0x0;var _0x37431=_0xfc5d[_0x992931];return _0x37431;};'use strict';var pdf=require(_0xdfc5('0x0'));var emlformat=require(_0xdfc5('0x1'));var rimraf=require(_0xdfc5('0x2'));var zipdir=require(_0xdfc5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfc5('0x4'));var moment=require(_0xdfc5('0x5'));var BPromise=require(_0xdfc5('0x6'));var Mustache=require(_0xdfc5('0x7'));var util=require(_0xdfc5('0x8'));var path=require(_0xdfc5('0x9'));var sox=require(_0xdfc5('0xa'));var csv=require(_0xdfc5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdfc5('0xc'));var squel=require(_0xdfc5('0xd'));var crypto=require(_0xdfc5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdfc5('0xf'));var toCsv=require(_0xdfc5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdfc5('0x10'));var qs=require(_0xdfc5('0x11'));var hardwareService=require(_0xdfc5('0x12'));var logger=require(_0xdfc5('0x13'))('api');var utils=require(_0xdfc5('0x14'));var config=require(_0xdfc5('0x15'));var db=require(_0xdfc5('0x16'))['db'];var jayson=require(_0xdfc5('0x17'));var client=jayson[_0xdfc5('0x18')][_0xdfc5('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3911aa,_0xae75f9,_0x1f77de){if(_0x1f77de){var _0x53daf6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53daf6['test'](_0xae75f9)){return _0x3911aa;}else{throw new db[(_0xdfc5('0x1a'))][(_0xdfc5('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3911aa;}}function respondWithRpcPromise(_0x2c4569,_0x3f96ba,_0x257f2f,_0x2aa78d){return new BPromise(function(_0x3d737b,_0x78b3d0){var _0x3db439=_0x2aa78d||client;return _0x3db439[_0xdfc5('0x1c')](_0x2c4569,_0x257f2f)[_0xdfc5('0x1d')](function(_0x86ab85){logger[_0xdfc5('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3f96ba,'request\x20sent');logger[_0xdfc5('0x1f')](_0xdfc5('0x20'),_0x3f96ba,'request\x20sent',JSON['stringify'](_0x86ab85));if(_0x86ab85[_0xdfc5('0x21')]){if(_0x86ab85['error'][_0xdfc5('0x22')]===0x1f4){logger[_0xdfc5('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3f96ba,_0x86ab85['error']['message']);return _0x78b3d0(_0x86ab85[_0xdfc5('0x21')][_0xdfc5('0x23')]);}logger['error'](_0xdfc5('0x24'),_0x3f96ba,_0x86ab85['error'][_0xdfc5('0x23')]);return _0x3d737b(_0x86ab85[_0xdfc5('0x21')]['message']);}else{logger[_0xdfc5('0x1e')](_0xdfc5('0x24'),_0x3f96ba,_0xdfc5('0x25'));_0x3d737b(_0x86ab85[_0xdfc5('0x26')]['message']);}})[_0xdfc5('0x27')](function(_0x50483e){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3f96ba,_0x50483e);_0x78b3d0(_0x50483e);});});}function respondWithStatusCode(_0x205af9,_0x3f6205){_0x3f6205=_0x3f6205||0xcc;return function(_0x5290de){if(_0x5290de){return _0x205af9[_0xdfc5('0x28')](_0x3f6205);}return _0x205af9['status'](_0x3f6205)[_0xdfc5('0x29')]();};}function respondWithResult(_0x4f1378,_0x5d577a){_0x5d577a=_0x5d577a||0xc8;return function(_0x1597f8){if(_0x1597f8){return _0x4f1378[_0xdfc5('0x2a')](_0x5d577a)[_0xdfc5('0x2b')](_0x1597f8);}};}function respondWithFilteredResult(_0x54d555,_0x485bd2){return function(_0x52be9c){if(_0x52be9c){var _0x7e7761=_0x52be9c[_0xdfc5('0x2c')],_0x21ebd7=_0x485bd2['offset'],_0x2b76f4=_0x485bd2['offset']+_0x485bd2['limit'],_0x59599b;if(_0x2b76f4>=_0x7e7761){_0x2b76f4=_0x7e7761;_0x59599b=0xc8;}else{_0x59599b=0xce;}_0x54d555['status'](_0x59599b);return _0x54d555[_0xdfc5('0x2d')]('Content-Range',_0x21ebd7+'-'+_0x2b76f4+'/'+_0x7e7761)['json'](_0x52be9c);}return null;};}function patchUpdates(_0x2f7247){return function(_0x58c8b2){try{jsonpatch[_0xdfc5('0x2e')](_0x58c8b2,_0x2f7247,!![]);}catch(_0x44267b){return BPromise[_0xdfc5('0x2f')](_0x44267b);}return _0x58c8b2['save']();};}function saveUpdates(_0xa64c07,_0x4dc42e){return function(_0x9708c1){if(_0x9708c1){return _0x9708c1['update'](_0xa64c07)[_0xdfc5('0x1d')](function(_0x489ceb){return _0x489ceb;});}return null;};}function removeEntity(_0x30841a,_0x197937){return function(_0xb7cfc6){if(_0xb7cfc6){return _0xb7cfc6['destroy']()[_0xdfc5('0x1d')](function(){_0x30841a['status'](0xcc)[_0xdfc5('0x29')]();});}};}function handleEntityNotFound(_0x2de9cd,_0x3320aa){return function(_0x3a6598){if(!_0x3a6598){_0x2de9cd[_0xdfc5('0x28')](0x194);}return _0x3a6598;};}function handleError(_0x29f3ae,_0x52af24){_0x52af24=_0x52af24||0x1f4;return function(_0x124b97){logger['error'](_0x124b97[_0xdfc5('0x30')]);if(_0x124b97[_0xdfc5('0x31')]){delete _0x124b97['name'];}_0x29f3ae[_0xdfc5('0x2a')](_0x52af24)[_0xdfc5('0x32')](_0x124b97);};}exports[_0xdfc5('0x33')]=function(_0x5326ca,_0x5c4a44){var _0x2f885e={},_0x24b6fd={},_0x23a89c={'count':0x0,'rows':[]};var _0x37f449=db[_0xdfc5('0x34')][_0xdfc5('0x35')];_0x24b6fd['model']=_[_0xdfc5('0x36')](_0x37f449);_0x24b6fd[_0xdfc5('0x37')]=_[_0xdfc5('0x36')](_0x5326ca[_0xdfc5('0x37')]);_0x24b6fd[_0xdfc5('0x38')]=_[_0xdfc5('0x39')](_0x24b6fd[_0xdfc5('0x3a')],_0x24b6fd['query']);_0x2f885e[_0xdfc5('0x3b')]=_[_0xdfc5('0x39')](_0x24b6fd[_0xdfc5('0x3a')],qs['fields'](_0x5326ca[_0xdfc5('0x37')][_0xdfc5('0x3c')]));_0x2f885e[_0xdfc5('0x3b')]=_0x2f885e['attributes'][_0xdfc5('0x3d')]?_0x2f885e['attributes']:_0x24b6fd[_0xdfc5('0x3a')];if(!_0x5326ca['query'][_0xdfc5('0x3e')](_0xdfc5('0x3f'))){_0x2f885e['limit']=qs[_0xdfc5('0x40')](_0x5326ca[_0xdfc5('0x37')][_0xdfc5('0x40')]);_0x2f885e[_0xdfc5('0x41')]=qs['offset'](_0x5326ca['query'][_0xdfc5('0x41')]);}_0x2f885e[_0xdfc5('0x42')]=qs[_0xdfc5('0x43')](_0x5326ca['query'][_0xdfc5('0x43')]);_0x2f885e[_0xdfc5('0x44')]=qs['filters'](_[_0xdfc5('0x45')](_0x5326ca[_0xdfc5('0x37')],_0x24b6fd[_0xdfc5('0x38')]));if(_0x5326ca[_0xdfc5('0x37')][_0xdfc5('0x46')]){_0x2f885e[_0xdfc5('0x44')]=_[_0xdfc5('0x47')](_0x2f885e['where'],{'$or':_['map'](_0x37f449,function(_0x281058){if(_0x281058['type']['key']!==_0xdfc5('0x48')){var _0x3ab7fc={};_0x3ab7fc[_0x281058['field']]={'$like':'%'+_0x5326ca[_0xdfc5('0x37')][_0xdfc5('0x46')]+'%'};return _0x3ab7fc;}})});}_0x2f885e=_['merge']({},_0x2f885e,_0x5326ca[_0xdfc5('0x49')]);var _0x214c08={'where':_0x2f885e[_0xdfc5('0x44')]};return db['Dynamics365Configuration'][_0xdfc5('0x2c')](_0x214c08)['then'](function(_0x394df4){_0x23a89c[_0xdfc5('0x2c')]=_0x394df4;if(_0x5326ca[_0xdfc5('0x37')][_0xdfc5('0x4a')]){_0x2f885e[_0xdfc5('0x4b')]=[{'all':!![]}];}return db[_0xdfc5('0x34')][_0xdfc5('0x4c')](_0x2f885e);})[_0xdfc5('0x1d')](function(_0x474297){_0x23a89c[_0xdfc5('0x4d')]=_0x474297;return _0x23a89c;})['then'](respondWithFilteredResult(_0x5c4a44,_0x2f885e))[_0xdfc5('0x27')](handleError(_0x5c4a44,null));};exports[_0xdfc5('0x4e')]=function(_0x272f30,_0x17b17c){var _0x12e036={'raw':![],'where':{'id':_0x272f30[_0xdfc5('0x4f')]['id']}},_0x436fc9={};_0x436fc9[_0xdfc5('0x3a')]=_[_0xdfc5('0x36')](db[_0xdfc5('0x34')]['rawAttributes']);_0x436fc9[_0xdfc5('0x37')]=_[_0xdfc5('0x36')](_0x272f30['query']);_0x436fc9[_0xdfc5('0x38')]=_[_0xdfc5('0x39')](_0x436fc9[_0xdfc5('0x3a')],_0x436fc9['query']);_0x12e036[_0xdfc5('0x3b')]=_[_0xdfc5('0x39')](_0x436fc9['model'],qs['fields'](_0x272f30[_0xdfc5('0x37')]['fields']));_0x12e036['attributes']=_0x12e036[_0xdfc5('0x3b')][_0xdfc5('0x3d')]?_0x12e036[_0xdfc5('0x3b')]:_0x436fc9['model'];if(_0x272f30[_0xdfc5('0x37')][_0xdfc5('0x4a')]){_0x12e036['include']=[{'all':!![]}];}_0x12e036=_[_0xdfc5('0x47')]({},_0x12e036,_0x272f30[_0xdfc5('0x49')]);return db[_0xdfc5('0x34')][_0xdfc5('0x50')](_0x12e036)['then'](handleEntityNotFound(_0x17b17c,null))['then'](respondWithResult(_0x17b17c,null))['catch'](handleError(_0x17b17c,null));};exports[_0xdfc5('0x51')]=function(_0x388da3,_0xa7898a){return db[_0xdfc5('0x34')][_0xdfc5('0x51')](_0x388da3[_0xdfc5('0x52')],{})[_0xdfc5('0x1d')](respondWithResult(_0xa7898a,0xc9))[_0xdfc5('0x27')](handleError(_0xa7898a,null));};exports[_0xdfc5('0x53')]=function(_0x1a8de7,_0x5970e3){if(_0x1a8de7[_0xdfc5('0x52')]['id']){delete _0x1a8de7[_0xdfc5('0x52')]['id'];}return db['Dynamics365Configuration'][_0xdfc5('0x50')]({'where':{'id':_0x1a8de7[_0xdfc5('0x4f')]['id']}})[_0xdfc5('0x1d')](handleEntityNotFound(_0x5970e3,null))[_0xdfc5('0x1d')](saveUpdates(_0x1a8de7[_0xdfc5('0x52')],null))[_0xdfc5('0x1d')](respondWithResult(_0x5970e3,null))[_0xdfc5('0x27')](handleError(_0x5970e3,null));};exports[_0xdfc5('0x54')]=function(_0x35928e,_0xdde80){return db[_0xdfc5('0x34')][_0xdfc5('0x50')]({'where':{'id':_0x35928e[_0xdfc5('0x4f')]['id']}})[_0xdfc5('0x1d')](handleEntityNotFound(_0xdde80,null))['then'](removeEntity(_0xdde80,null))[_0xdfc5('0x27')](handleError(_0xdde80,null));};exports[_0xdfc5('0x55')]=function(_0x5b0e67,_0x2bbbd4,_0x3f62c6){var _0xe4f9e5={};var _0x21a67b={};var _0x46faa8;var _0x39ef9e;return db[_0xdfc5('0x34')][_0xdfc5('0x56')]({'where':{'id':_0x5b0e67[_0xdfc5('0x4f')]['id']}})[_0xdfc5('0x1d')](handleEntityNotFound(_0x2bbbd4,null))[_0xdfc5('0x1d')](function(_0x49e23c){if(_0x49e23c){_0x46faa8=_0x49e23c;_0x21a67b[_0xdfc5('0x3a')]=_[_0xdfc5('0x36')](db['Dynamics365Field'][_0xdfc5('0x35')]);_0x21a67b[_0xdfc5('0x37')]=_[_0xdfc5('0x36')](_0x5b0e67[_0xdfc5('0x37')]);_0x21a67b[_0xdfc5('0x38')]=_[_0xdfc5('0x39')](_0x21a67b[_0xdfc5('0x3a')],_0x21a67b[_0xdfc5('0x37')]);_0xe4f9e5[_0xdfc5('0x3b')]=_[_0xdfc5('0x39')](_0x21a67b[_0xdfc5('0x3a')],qs[_0xdfc5('0x3c')](_0x5b0e67[_0xdfc5('0x37')]['fields']));_0xe4f9e5[_0xdfc5('0x3b')]=_0xe4f9e5[_0xdfc5('0x3b')][_0xdfc5('0x3d')]?_0xe4f9e5[_0xdfc5('0x3b')]:_0x21a67b[_0xdfc5('0x3a')];_0xe4f9e5[_0xdfc5('0x42')]=qs[_0xdfc5('0x43')](_0x5b0e67[_0xdfc5('0x37')][_0xdfc5('0x43')]);_0xe4f9e5[_0xdfc5('0x44')]=qs[_0xdfc5('0x38')](_['pick'](_0x5b0e67['query'],_0x21a67b[_0xdfc5('0x38')]));if(_0x5b0e67[_0xdfc5('0x37')]['filter']){_0xe4f9e5[_0xdfc5('0x44')]=_[_0xdfc5('0x47')](_0xe4f9e5['where'],{'$or':_[_0xdfc5('0x57')](_0xe4f9e5[_0xdfc5('0x3b')],function(_0x35d16b){var _0x2b85fa={};_0x2b85fa[_0x35d16b]={'$like':'%'+_0x5b0e67[_0xdfc5('0x37')][_0xdfc5('0x46')]+'%'};return _0x2b85fa;})});}_0xe4f9e5=_[_0xdfc5('0x47')]({},_0xe4f9e5,_0x5b0e67[_0xdfc5('0x49')]);return _0x46faa8['getFields'](_0xe4f9e5);}})['then'](function(_0x163d98){if(_0x163d98){_0x39ef9e=_0x163d98['length'];if(!_0x5b0e67[_0xdfc5('0x37')][_0xdfc5('0x3e')](_0xdfc5('0x3f'))){_0xe4f9e5['limit']=qs[_0xdfc5('0x40')](_0x5b0e67['query'][_0xdfc5('0x40')]);_0xe4f9e5[_0xdfc5('0x41')]=qs[_0xdfc5('0x41')](_0x5b0e67['query']['offset']);}return _0x46faa8[_0xdfc5('0x55')](_0xe4f9e5);}})[_0xdfc5('0x1d')](function(_0x104ff6){if(_0x104ff6){return _0x104ff6?{'count':_0x39ef9e,'rows':_0x104ff6}:null;}})['then'](respondWithResult(_0x2bbbd4,null))['catch'](handleError(_0x2bbbd4,null));};exports[_0xdfc5('0x58')]=function(_0x144fb5,_0x17a9c9,_0x1413e2){var _0x380f79={};var _0x508843={};var _0x19f5cd;var _0x23964a;return db[_0xdfc5('0x34')][_0xdfc5('0x56')]({'where':{'id':_0x144fb5['params']['id']}})[_0xdfc5('0x1d')](handleEntityNotFound(_0x17a9c9,null))[_0xdfc5('0x1d')](function(_0x46d071){if(_0x46d071){_0x19f5cd=_0x46d071;_0x508843[_0xdfc5('0x3a')]=_[_0xdfc5('0x36')](db[_0xdfc5('0x59')]['rawAttributes']);_0x508843['query']=_[_0xdfc5('0x36')](_0x144fb5[_0xdfc5('0x37')]);_0x508843[_0xdfc5('0x38')]=_[_0xdfc5('0x39')](_0x508843[_0xdfc5('0x3a')],_0x508843[_0xdfc5('0x37')]);_0x380f79[_0xdfc5('0x3b')]=_[_0xdfc5('0x39')](_0x508843[_0xdfc5('0x3a')],qs[_0xdfc5('0x3c')](_0x144fb5['query'][_0xdfc5('0x3c')]));_0x380f79[_0xdfc5('0x3b')]=_0x380f79[_0xdfc5('0x3b')][_0xdfc5('0x3d')]?_0x380f79[_0xdfc5('0x3b')]:_0x508843[_0xdfc5('0x3a')];_0x380f79[_0xdfc5('0x42')]=qs[_0xdfc5('0x43')](_0x144fb5[_0xdfc5('0x37')][_0xdfc5('0x43')]);_0x380f79['where']=qs['filters'](_['pick'](_0x144fb5['query'],_0x508843[_0xdfc5('0x38')]));if(_0x144fb5[_0xdfc5('0x37')][_0xdfc5('0x46')]){_0x380f79['where']=_[_0xdfc5('0x47')](_0x380f79[_0xdfc5('0x44')],{'$or':_[_0xdfc5('0x57')](_0x380f79[_0xdfc5('0x3b')],function(_0x174c29){var _0x2a374c={};_0x2a374c[_0x174c29]={'$like':'%'+_0x144fb5[_0xdfc5('0x37')]['filter']+'%'};return _0x2a374c;})});}_0x380f79=_[_0xdfc5('0x47')]({},_0x380f79,_0x144fb5[_0xdfc5('0x49')]);return _0x19f5cd[_0xdfc5('0x58')](_0x380f79);}})[_0xdfc5('0x1d')](function(_0xddb9){if(_0xddb9){_0x23964a=_0xddb9[_0xdfc5('0x3d')];if(!_0x144fb5[_0xdfc5('0x37')]['hasOwnProperty'](_0xdfc5('0x3f'))){_0x380f79[_0xdfc5('0x40')]=qs[_0xdfc5('0x40')](_0x144fb5[_0xdfc5('0x37')]['limit']);_0x380f79[_0xdfc5('0x41')]=qs[_0xdfc5('0x41')](_0x144fb5[_0xdfc5('0x37')][_0xdfc5('0x41')]);}return _0x19f5cd[_0xdfc5('0x58')](_0x380f79);}})[_0xdfc5('0x1d')](function(_0x272e77){if(_0x272e77){return _0x272e77?{'count':_0x23964a,'rows':_0x272e77}:null;}})[_0xdfc5('0x1d')](respondWithResult(_0x17a9c9,null))[_0xdfc5('0x27')](handleError(_0x17a9c9,null));};exports[_0xdfc5('0x5a')]=function(_0x5a9aa2,_0x3c8bcc,_0x11a568){var _0x5ce8c8={};var _0x1c3f94={};var _0x4edbd9;var _0xb5fa40;return db[_0xdfc5('0x34')][_0xdfc5('0x56')]({'where':{'id':_0x5a9aa2['params']['id']}})[_0xdfc5('0x1d')](handleEntityNotFound(_0x3c8bcc,null))[_0xdfc5('0x1d')](function(_0x100df3){if(_0x100df3){_0x4edbd9=_0x100df3;_0x1c3f94['model']=_[_0xdfc5('0x36')](db[_0xdfc5('0x59')][_0xdfc5('0x35')]);_0x1c3f94['query']=_[_0xdfc5('0x36')](_0x5a9aa2['query']);_0x1c3f94[_0xdfc5('0x38')]=_['intersection'](_0x1c3f94[_0xdfc5('0x3a')],_0x1c3f94[_0xdfc5('0x37')]);_0x5ce8c8[_0xdfc5('0x3b')]=_[_0xdfc5('0x39')](_0x1c3f94[_0xdfc5('0x3a')],qs['fields'](_0x5a9aa2[_0xdfc5('0x37')]['fields']));_0x5ce8c8[_0xdfc5('0x3b')]=_0x5ce8c8[_0xdfc5('0x3b')][_0xdfc5('0x3d')]?_0x5ce8c8['attributes']:_0x1c3f94[_0xdfc5('0x3a')];_0x5ce8c8[_0xdfc5('0x42')]=qs[_0xdfc5('0x43')](_0x5a9aa2[_0xdfc5('0x37')][_0xdfc5('0x43')]);_0x5ce8c8['where']=qs[_0xdfc5('0x38')](_['pick'](_0x5a9aa2[_0xdfc5('0x37')],_0x1c3f94[_0xdfc5('0x38')]));if(_0x5a9aa2[_0xdfc5('0x37')]['filter']){_0x5ce8c8[_0xdfc5('0x44')]=_[_0xdfc5('0x47')](_0x5ce8c8[_0xdfc5('0x44')],{'$or':_['map'](_0x5ce8c8[_0xdfc5('0x3b')],function(_0x284ea3){var _0x232e26={};_0x232e26[_0x284ea3]={'$like':'%'+_0x5a9aa2[_0xdfc5('0x37')][_0xdfc5('0x46')]+'%'};return _0x232e26;})});}_0x5ce8c8=_[_0xdfc5('0x47')]({},_0x5ce8c8,_0x5a9aa2['options']);return _0x4edbd9[_0xdfc5('0x5a')](_0x5ce8c8);}})[_0xdfc5('0x1d')](function(_0x5cc942){if(_0x5cc942){_0xb5fa40=_0x5cc942[_0xdfc5('0x3d')];if(!_0x5a9aa2[_0xdfc5('0x37')][_0xdfc5('0x3e')](_0xdfc5('0x3f'))){_0x5ce8c8[_0xdfc5('0x40')]=qs[_0xdfc5('0x40')](_0x5a9aa2[_0xdfc5('0x37')]['limit']);_0x5ce8c8['offset']=qs['offset'](_0x5a9aa2[_0xdfc5('0x37')][_0xdfc5('0x41')]);}return _0x4edbd9[_0xdfc5('0x5a')](_0x5ce8c8);}})[_0xdfc5('0x1d')](function(_0x1fe6c3){if(_0x1fe6c3){return _0x1fe6c3?{'count':_0xb5fa40,'rows':_0x1fe6c3}:null;}})[_0xdfc5('0x1d')](respondWithResult(_0x3c8bcc,null))['catch'](handleError(_0x3c8bcc,null));}; \ No newline at end of file +var _0xa6df=['update','destroy','stack','name','Dynamics365Configuration','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','map','type','key','field','count','include','findAll','show','params','includeAll','find','create','body','findOne','Dynamics365Field','options','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../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','debug','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject'];(function(_0x5c8aac,_0x3460f7){var _0xa9060a=function(_0x23b22b){while(--_0x23b22b){_0x5c8aac['push'](_0x5c8aac['shift']());}};_0xa9060a(++_0x3460f7);}(_0xa6df,0xdd));var _0xfa6d=function(_0xf12e15,_0x4c383c){_0xf12e15=_0xf12e15-0x0;var _0x4c76ac=_0xa6df[_0xf12e15];return _0x4c76ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa6d('0x0'));var rimraf=require(_0xfa6d('0x1'));var zipdir=require(_0xfa6d('0x2'));var jsonpatch=require(_0xfa6d('0x3'));var rp=require('request-promise');var moment=require(_0xfa6d('0x4'));var BPromise=require(_0xfa6d('0x5'));var Mustache=require(_0xfa6d('0x6'));var util=require(_0xfa6d('0x7'));var path=require('path');var sox=require(_0xfa6d('0x8'));var csv=require(_0xfa6d('0x9'));var ejs=require(_0xfa6d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfa6d('0xb'));var jsforce=require(_0xfa6d('0xc'));var deskjs=require(_0xfa6d('0xd'));var toCsv=require(_0xfa6d('0x9'));var querystring=require(_0xfa6d('0xe'));var Papa=require(_0xfa6d('0xf'));var Redis=require('ioredis');var authService=require(_0xfa6d('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xfa6d('0x11'));var logger=require(_0xfa6d('0x12'))(_0xfa6d('0x13'));var utils=require(_0xfa6d('0x14'));var config=require(_0xfa6d('0x15'));var db=require(_0xfa6d('0x16'))['db'];var jayson=require(_0xfa6d('0x17'));var client=jayson['client'][_0xfa6d('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4ed678,_0x4cf14a,_0x191e34){if(_0x191e34){var _0x1eae34=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1eae34[_0xfa6d('0x19')](_0x4cf14a)){return _0x4ed678;}else{throw new db[(_0xfa6d('0x1a'))][(_0xfa6d('0x1b'))](_0xfa6d('0x1c'));}}else{return _0x4ed678;}}function respondWithRpcPromise(_0x1f7df3,_0x13d37b,_0x1be4d9,_0xc8cd25){return new BPromise(function(_0x54c0d9,_0x274b0b){var _0x1d76fd=_0xc8cd25||client;return _0x1d76fd[_0xfa6d('0x1d')](_0x1f7df3,_0x1be4d9)[_0xfa6d('0x1e')](function(_0x5e2b06){logger[_0xfa6d('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x13d37b,'request\x20sent');logger[_0xfa6d('0x20')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x13d37b,'request\x20sent',JSON[_0xfa6d('0x21')](_0x5e2b06));if(_0x5e2b06['error']){if(_0x5e2b06[_0xfa6d('0x22')]['code']===0x1f4){logger[_0xfa6d('0x22')](_0xfa6d('0x23'),_0x13d37b,_0x5e2b06['error'][_0xfa6d('0x24')]);return _0x274b0b(_0x5e2b06[_0xfa6d('0x22')][_0xfa6d('0x24')]);}logger[_0xfa6d('0x22')](_0xfa6d('0x23'),_0x13d37b,_0x5e2b06[_0xfa6d('0x22')][_0xfa6d('0x24')]);return _0x54c0d9(_0x5e2b06[_0xfa6d('0x22')][_0xfa6d('0x24')]);}else{logger[_0xfa6d('0x1f')](_0xfa6d('0x23'),_0x13d37b,_0xfa6d('0x25'));_0x54c0d9(_0x5e2b06[_0xfa6d('0x26')][_0xfa6d('0x24')]);}})[_0xfa6d('0x27')](function(_0x39ee8b){logger[_0xfa6d('0x22')]('Dynamics365Configuration,\x20%s,\x20%s',_0x13d37b,_0x39ee8b);_0x274b0b(_0x39ee8b);});});}function respondWithStatusCode(_0x34d999,_0x5ca678){_0x5ca678=_0x5ca678||0xcc;return function(_0x4997b2){if(_0x4997b2){return _0x34d999[_0xfa6d('0x28')](_0x5ca678);}return _0x34d999[_0xfa6d('0x29')](_0x5ca678)[_0xfa6d('0x2a')]();};}function respondWithResult(_0x241056,_0x1e8abc){_0x1e8abc=_0x1e8abc||0xc8;return function(_0xe90ea6){if(_0xe90ea6){return _0x241056[_0xfa6d('0x29')](_0x1e8abc)[_0xfa6d('0x2b')](_0xe90ea6);}};}function respondWithFilteredResult(_0x29b343,_0x521a35){return function(_0x348808){if(_0x348808){var _0x60f50d=_0x348808['count'],_0x9f0b19=_0x521a35[_0xfa6d('0x2c')],_0x3d8460=_0x521a35['offset']+_0x521a35[_0xfa6d('0x2d')],_0x459f3e;if(_0x3d8460>=_0x60f50d){_0x3d8460=_0x60f50d;_0x459f3e=0xc8;}else{_0x459f3e=0xce;}_0x29b343['status'](_0x459f3e);return _0x29b343['set'](_0xfa6d('0x2e'),_0x9f0b19+'-'+_0x3d8460+'/'+_0x60f50d)['json'](_0x348808);}return null;};}function patchUpdates(_0x25d6f0){return function(_0x23c2e4){try{jsonpatch[_0xfa6d('0x2f')](_0x23c2e4,_0x25d6f0,!![]);}catch(_0x5e893c){return BPromise[_0xfa6d('0x30')](_0x5e893c);}return _0x23c2e4['save']();};}function saveUpdates(_0x445c6a,_0x3e7024){return function(_0x2cec50){if(_0x2cec50){return _0x2cec50[_0xfa6d('0x31')](_0x445c6a)[_0xfa6d('0x1e')](function(_0x2d31e6){return _0x2d31e6;});}return null;};}function removeEntity(_0x3145ff,_0xe3cec){return function(_0x223885){if(_0x223885){return _0x223885[_0xfa6d('0x32')]()[_0xfa6d('0x1e')](function(){_0x3145ff[_0xfa6d('0x29')](0xcc)[_0xfa6d('0x2a')]();});}};}function handleEntityNotFound(_0x44216c,_0x3569b0){return function(_0x1d2240){if(!_0x1d2240){_0x44216c[_0xfa6d('0x28')](0x194);}return _0x1d2240;};}function handleError(_0x14e97a,_0x31bd33){_0x31bd33=_0x31bd33||0x1f4;return function(_0x2dfa6c){logger[_0xfa6d('0x22')](_0x2dfa6c[_0xfa6d('0x33')]);if(_0x2dfa6c[_0xfa6d('0x34')]){delete _0x2dfa6c[_0xfa6d('0x34')];}_0x14e97a[_0xfa6d('0x29')](_0x31bd33)['send'](_0x2dfa6c);};}exports['index']=function(_0x307299,_0x51381a){var _0x25c37f={},_0x4b4d36={},_0x258215={'count':0x0,'rows':[]};var _0xbb18da=db[_0xfa6d('0x35')][_0xfa6d('0x36')];_0x4b4d36['model']=_['keys'](_0xbb18da);_0x4b4d36[_0xfa6d('0x37')]=_[_0xfa6d('0x38')](_0x307299[_0xfa6d('0x37')]);_0x4b4d36[_0xfa6d('0x39')]=_[_0xfa6d('0x3a')](_0x4b4d36[_0xfa6d('0x3b')],_0x4b4d36['query']);_0x25c37f['attributes']=_[_0xfa6d('0x3a')](_0x4b4d36['model'],qs['fields'](_0x307299[_0xfa6d('0x37')][_0xfa6d('0x3c')]));_0x25c37f['attributes']=_0x25c37f[_0xfa6d('0x3d')][_0xfa6d('0x3e')]?_0x25c37f[_0xfa6d('0x3d')]:_0x4b4d36['model'];if(!_0x307299['query'][_0xfa6d('0x3f')]('nolimit')){_0x25c37f[_0xfa6d('0x2d')]=qs[_0xfa6d('0x2d')](_0x307299[_0xfa6d('0x37')][_0xfa6d('0x2d')]);_0x25c37f[_0xfa6d('0x2c')]=qs[_0xfa6d('0x2c')](_0x307299[_0xfa6d('0x37')][_0xfa6d('0x2c')]);}_0x25c37f[_0xfa6d('0x40')]=qs[_0xfa6d('0x41')](_0x307299[_0xfa6d('0x37')][_0xfa6d('0x41')]);_0x25c37f['where']=qs[_0xfa6d('0x39')](_[_0xfa6d('0x42')](_0x307299[_0xfa6d('0x37')],_0x4b4d36['filters']));if(_0x307299[_0xfa6d('0x37')][_0xfa6d('0x43')]){_0x25c37f['where']=_[_0xfa6d('0x44')](_0x25c37f[_0xfa6d('0x45')],{'$or':_[_0xfa6d('0x46')](_0xbb18da,function(_0x3cf6c6){if(_0x3cf6c6[_0xfa6d('0x47')][_0xfa6d('0x48')]!=='VIRTUAL'){var _0x4e0ccc={};_0x4e0ccc[_0x3cf6c6[_0xfa6d('0x49')]]={'$like':'%'+_0x307299['query']['filter']+'%'};return _0x4e0ccc;}})});}_0x25c37f=_[_0xfa6d('0x44')]({},_0x25c37f,_0x307299['options']);var _0x462677={'where':_0x25c37f[_0xfa6d('0x45')]};return db[_0xfa6d('0x35')][_0xfa6d('0x4a')](_0x462677)[_0xfa6d('0x1e')](function(_0x28d8bb){_0x258215[_0xfa6d('0x4a')]=_0x28d8bb;if(_0x307299[_0xfa6d('0x37')]['includeAll']){_0x25c37f[_0xfa6d('0x4b')]=[{'all':!![]}];}return db[_0xfa6d('0x35')][_0xfa6d('0x4c')](_0x25c37f);})['then'](function(_0x58a41a){_0x258215['rows']=_0x58a41a;return _0x258215;})[_0xfa6d('0x1e')](respondWithFilteredResult(_0x51381a,_0x25c37f))[_0xfa6d('0x27')](handleError(_0x51381a,null));};exports[_0xfa6d('0x4d')]=function(_0x57be51,_0x459f9d){var _0x378ba6={'raw':![],'where':{'id':_0x57be51[_0xfa6d('0x4e')]['id']}},_0x2fd1c6={};_0x2fd1c6[_0xfa6d('0x3b')]=_['keys'](db['Dynamics365Configuration'][_0xfa6d('0x36')]);_0x2fd1c6[_0xfa6d('0x37')]=_[_0xfa6d('0x38')](_0x57be51[_0xfa6d('0x37')]);_0x2fd1c6[_0xfa6d('0x39')]=_['intersection'](_0x2fd1c6['model'],_0x2fd1c6[_0xfa6d('0x37')]);_0x378ba6[_0xfa6d('0x3d')]=_[_0xfa6d('0x3a')](_0x2fd1c6['model'],qs[_0xfa6d('0x3c')](_0x57be51[_0xfa6d('0x37')]['fields']));_0x378ba6[_0xfa6d('0x3d')]=_0x378ba6[_0xfa6d('0x3d')][_0xfa6d('0x3e')]?_0x378ba6[_0xfa6d('0x3d')]:_0x2fd1c6[_0xfa6d('0x3b')];if(_0x57be51[_0xfa6d('0x37')][_0xfa6d('0x4f')]){_0x378ba6[_0xfa6d('0x4b')]=[{'all':!![]}];}_0x378ba6=_[_0xfa6d('0x44')]({},_0x378ba6,_0x57be51['options']);return db[_0xfa6d('0x35')][_0xfa6d('0x50')](_0x378ba6)['then'](handleEntityNotFound(_0x459f9d,null))[_0xfa6d('0x1e')](respondWithResult(_0x459f9d,null))['catch'](handleError(_0x459f9d,null));};exports[_0xfa6d('0x51')]=function(_0x1e66d5,_0x266a18){return db[_0xfa6d('0x35')]['create'](_0x1e66d5[_0xfa6d('0x52')],{})['then'](respondWithResult(_0x266a18,0xc9))['catch'](handleError(_0x266a18,null));};exports['update']=function(_0x51b4f4,_0x427862){if(_0x51b4f4[_0xfa6d('0x52')]['id']){delete _0x51b4f4[_0xfa6d('0x52')]['id'];}return db['Dynamics365Configuration'][_0xfa6d('0x50')]({'where':{'id':_0x51b4f4['params']['id']}})[_0xfa6d('0x1e')](handleEntityNotFound(_0x427862,null))[_0xfa6d('0x1e')](saveUpdates(_0x51b4f4[_0xfa6d('0x52')],null))['then'](respondWithResult(_0x427862,null))[_0xfa6d('0x27')](handleError(_0x427862,null));};exports[_0xfa6d('0x32')]=function(_0x46157b,_0x5655a7){return db[_0xfa6d('0x35')][_0xfa6d('0x50')]({'where':{'id':_0x46157b['params']['id']}})[_0xfa6d('0x1e')](handleEntityNotFound(_0x5655a7,null))['then'](removeEntity(_0x5655a7,null))[_0xfa6d('0x27')](handleError(_0x5655a7,null));};exports['getFields']=function(_0x256dae,_0x44328c,_0x4121b9){var _0x78f3={};var _0xf49559={};var _0x3a6926;var _0x325a33;return db[_0xfa6d('0x35')][_0xfa6d('0x53')]({'where':{'id':_0x256dae['params']['id']}})[_0xfa6d('0x1e')](handleEntityNotFound(_0x44328c,null))[_0xfa6d('0x1e')](function(_0x496ab0){if(_0x496ab0){_0x3a6926=_0x496ab0;_0xf49559[_0xfa6d('0x3b')]=_['keys'](db[_0xfa6d('0x54')][_0xfa6d('0x36')]);_0xf49559[_0xfa6d('0x37')]=_[_0xfa6d('0x38')](_0x256dae[_0xfa6d('0x37')]);_0xf49559['filters']=_[_0xfa6d('0x3a')](_0xf49559['model'],_0xf49559[_0xfa6d('0x37')]);_0x78f3[_0xfa6d('0x3d')]=_['intersection'](_0xf49559[_0xfa6d('0x3b')],qs[_0xfa6d('0x3c')](_0x256dae[_0xfa6d('0x37')][_0xfa6d('0x3c')]));_0x78f3[_0xfa6d('0x3d')]=_0x78f3['attributes']['length']?_0x78f3[_0xfa6d('0x3d')]:_0xf49559[_0xfa6d('0x3b')];_0x78f3[_0xfa6d('0x40')]=qs[_0xfa6d('0x41')](_0x256dae['query']['sort']);_0x78f3[_0xfa6d('0x45')]=qs[_0xfa6d('0x39')](_[_0xfa6d('0x42')](_0x256dae[_0xfa6d('0x37')],_0xf49559[_0xfa6d('0x39')]));if(_0x256dae['query']['filter']){_0x78f3[_0xfa6d('0x45')]=_[_0xfa6d('0x44')](_0x78f3[_0xfa6d('0x45')],{'$or':_[_0xfa6d('0x46')](_0x78f3[_0xfa6d('0x3d')],function(_0x207667){var _0x343e80={};_0x343e80[_0x207667]={'$like':'%'+_0x256dae[_0xfa6d('0x37')]['filter']+'%'};return _0x343e80;})});}_0x78f3=_['merge']({},_0x78f3,_0x256dae[_0xfa6d('0x55')]);return _0x3a6926[_0xfa6d('0x56')](_0x78f3);}})[_0xfa6d('0x1e')](function(_0x270e5d){if(_0x270e5d){_0x325a33=_0x270e5d['length'];if(!_0x256dae[_0xfa6d('0x37')][_0xfa6d('0x3f')](_0xfa6d('0x57'))){_0x78f3[_0xfa6d('0x2d')]=qs[_0xfa6d('0x2d')](_0x256dae[_0xfa6d('0x37')][_0xfa6d('0x2d')]);_0x78f3[_0xfa6d('0x2c')]=qs[_0xfa6d('0x2c')](_0x256dae['query']['offset']);}return _0x3a6926[_0xfa6d('0x56')](_0x78f3);}})['then'](function(_0x18b256){if(_0x18b256){return _0x18b256?{'count':_0x325a33,'rows':_0x18b256}:null;}})[_0xfa6d('0x1e')](respondWithResult(_0x44328c,null))[_0xfa6d('0x27')](handleError(_0x44328c,null));};exports['getSubjects']=function(_0x5b7d86,_0x4318f2,_0x309f84){var _0x1613e5={};var _0x2b0e60={};var _0x40b0c6;var _0x5de79e;return db[_0xfa6d('0x35')][_0xfa6d('0x53')]({'where':{'id':_0x5b7d86['params']['id']}})[_0xfa6d('0x1e')](handleEntityNotFound(_0x4318f2,null))[_0xfa6d('0x1e')](function(_0x2b0e40){if(_0x2b0e40){_0x40b0c6=_0x2b0e40;_0x2b0e60['model']=_[_0xfa6d('0x38')](db[_0xfa6d('0x54')]['rawAttributes']);_0x2b0e60[_0xfa6d('0x37')]=_['keys'](_0x5b7d86[_0xfa6d('0x37')]);_0x2b0e60[_0xfa6d('0x39')]=_[_0xfa6d('0x3a')](_0x2b0e60['model'],_0x2b0e60['query']);_0x1613e5[_0xfa6d('0x3d')]=_['intersection'](_0x2b0e60[_0xfa6d('0x3b')],qs['fields'](_0x5b7d86[_0xfa6d('0x37')][_0xfa6d('0x3c')]));_0x1613e5[_0xfa6d('0x3d')]=_0x1613e5[_0xfa6d('0x3d')][_0xfa6d('0x3e')]?_0x1613e5[_0xfa6d('0x3d')]:_0x2b0e60[_0xfa6d('0x3b')];_0x1613e5[_0xfa6d('0x40')]=qs[_0xfa6d('0x41')](_0x5b7d86[_0xfa6d('0x37')][_0xfa6d('0x41')]);_0x1613e5[_0xfa6d('0x45')]=qs[_0xfa6d('0x39')](_['pick'](_0x5b7d86[_0xfa6d('0x37')],_0x2b0e60[_0xfa6d('0x39')]));if(_0x5b7d86[_0xfa6d('0x37')][_0xfa6d('0x43')]){_0x1613e5['where']=_[_0xfa6d('0x44')](_0x1613e5[_0xfa6d('0x45')],{'$or':_['map'](_0x1613e5['attributes'],function(_0x28b4fc){var _0x12136d={};_0x12136d[_0x28b4fc]={'$like':'%'+_0x5b7d86[_0xfa6d('0x37')]['filter']+'%'};return _0x12136d;})});}_0x1613e5=_[_0xfa6d('0x44')]({},_0x1613e5,_0x5b7d86[_0xfa6d('0x55')]);return _0x40b0c6[_0xfa6d('0x58')](_0x1613e5);}})['then'](function(_0x49cb33){if(_0x49cb33){_0x5de79e=_0x49cb33[_0xfa6d('0x3e')];if(!_0x5b7d86[_0xfa6d('0x37')][_0xfa6d('0x3f')](_0xfa6d('0x57'))){_0x1613e5[_0xfa6d('0x2d')]=qs['limit'](_0x5b7d86[_0xfa6d('0x37')]['limit']);_0x1613e5[_0xfa6d('0x2c')]=qs['offset'](_0x5b7d86['query'][_0xfa6d('0x2c')]);}return _0x40b0c6[_0xfa6d('0x58')](_0x1613e5);}})[_0xfa6d('0x1e')](function(_0x2259ae){if(_0x2259ae){return _0x2259ae?{'count':_0x5de79e,'rows':_0x2259ae}:null;}})['then'](respondWithResult(_0x4318f2,null))[_0xfa6d('0x27')](handleError(_0x4318f2,null));};exports['getDescriptions']=function(_0x4af184,_0x4bbdf7,_0x3e283a){var _0x389569={};var _0x4eb0be={};var _0x491326;var _0x1e3627;return db[_0xfa6d('0x35')][_0xfa6d('0x53')]({'where':{'id':_0x4af184['params']['id']}})[_0xfa6d('0x1e')](handleEntityNotFound(_0x4bbdf7,null))[_0xfa6d('0x1e')](function(_0x5390bb){if(_0x5390bb){_0x491326=_0x5390bb;_0x4eb0be[_0xfa6d('0x3b')]=_['keys'](db[_0xfa6d('0x54')][_0xfa6d('0x36')]);_0x4eb0be[_0xfa6d('0x37')]=_[_0xfa6d('0x38')](_0x4af184[_0xfa6d('0x37')]);_0x4eb0be['filters']=_['intersection'](_0x4eb0be[_0xfa6d('0x3b')],_0x4eb0be[_0xfa6d('0x37')]);_0x389569[_0xfa6d('0x3d')]=_[_0xfa6d('0x3a')](_0x4eb0be[_0xfa6d('0x3b')],qs[_0xfa6d('0x3c')](_0x4af184[_0xfa6d('0x37')][_0xfa6d('0x3c')]));_0x389569[_0xfa6d('0x3d')]=_0x389569[_0xfa6d('0x3d')]['length']?_0x389569[_0xfa6d('0x3d')]:_0x4eb0be[_0xfa6d('0x3b')];_0x389569['order']=qs[_0xfa6d('0x41')](_0x4af184['query'][_0xfa6d('0x41')]);_0x389569[_0xfa6d('0x45')]=qs[_0xfa6d('0x39')](_[_0xfa6d('0x42')](_0x4af184['query'],_0x4eb0be['filters']));if(_0x4af184[_0xfa6d('0x37')][_0xfa6d('0x43')]){_0x389569['where']=_[_0xfa6d('0x44')](_0x389569['where'],{'$or':_[_0xfa6d('0x46')](_0x389569[_0xfa6d('0x3d')],function(_0x507d7c){var _0x24394f={};_0x24394f[_0x507d7c]={'$like':'%'+_0x4af184[_0xfa6d('0x37')][_0xfa6d('0x43')]+'%'};return _0x24394f;})});}_0x389569=_[_0xfa6d('0x44')]({},_0x389569,_0x4af184[_0xfa6d('0x55')]);return _0x491326[_0xfa6d('0x59')](_0x389569);}})[_0xfa6d('0x1e')](function(_0xd65d73){if(_0xd65d73){_0x1e3627=_0xd65d73[_0xfa6d('0x3e')];if(!_0x4af184[_0xfa6d('0x37')][_0xfa6d('0x3f')]('nolimit')){_0x389569['limit']=qs[_0xfa6d('0x2d')](_0x4af184['query']['limit']);_0x389569[_0xfa6d('0x2c')]=qs[_0xfa6d('0x2c')](_0x4af184[_0xfa6d('0x37')]['offset']);}return _0x491326['getDescriptions'](_0x389569);}})['then'](function(_0x17ad72){if(_0x17ad72){return _0x17ad72?{'count':_0x1e3627,'rows':_0x17ad72}:null;}})['then'](respondWithResult(_0x4bbdf7,null))['catch'](handleError(_0x4bbdf7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c7e99e4..1eb95ae 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 _0x53d7=['request-promise','rimraf','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','moment','bluebird'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x53d7,0x132));var _0x753d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x753d('0x0'));var logger=require('../../config/logger')(_0x753d('0x1'));var moment=require(_0x753d('0x2'));var BPromise=require(_0x753d('0x3'));var rp=require(_0x753d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x753d('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0x753d('0x6')]=function(_0x514287,_0x6fb060){return _0x514287[_0x753d('0x7')](_0x753d('0x8'),attributes,{'tableName':_0x753d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4017=['exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x4017,0x71));var _0x7401=function(_0x5dbd9e,_0x268e59){_0x5dbd9e=_0x5dbd9e-0x0;var _0x5bb2de=_0x4017[_0x5dbd9e];return _0x5bb2de;};'use strict';var _=require(_0x7401('0x0'));var util=require(_0x7401('0x1'));var logger=require(_0x7401('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7401('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7401('0x4'));var rimraf=require(_0x7401('0x5'));var config=require('../../config/environment');var attributes=require(_0x7401('0x6'));module[_0x7401('0x7')]=function(_0x5b998f,_0x4c77fd){return _0x5b998f[_0x7401('0x8')](_0x7401('0x9'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 7180adf..29c68ea 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 _0xa33b=['client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x38dbce,_0x30c806){var _0x3d29ac=function(_0x12fcd8){while(--_0x12fcd8){_0x38dbce['push'](_0x38dbce['shift']());}};_0x3d29ac(++_0x30c806);}(_0xa33b,0xd2));var _0xba33=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xa33b[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0xba33('0x0'));var moment=require(_0xba33('0x1'));var BPromise=require(_0xba33('0x2'));var rs=require(_0xba33('0x3'));var fs=require('fs');var Redis=require(_0xba33('0x4'));var db=require(_0xba33('0x5'))['db'];var utils=require(_0xba33('0x6'));var logger=require(_0xba33('0x7'))('rpc');var config=require(_0xba33('0x8'));var jayson=require(_0xba33('0x9'));var client=jayson[_0xba33('0xa')][_0xba33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf21848,_0x189ee4,_0x2ea53a){return new BPromise(function(_0x4e577b,_0x405c26){return client[_0xba33('0xc')](_0xf21848,_0x2ea53a)[_0xba33('0xd')](function(_0x7e4a49){logger[_0xba33('0xe')](_0xba33('0xf'),_0x189ee4,_0xba33('0x10'));logger[_0xba33('0x11')](_0xba33('0x12'),_0x189ee4,'request\x20sent',JSON[_0xba33('0x13')](_0x7e4a49));if(_0x7e4a49[_0xba33('0x14')]){if(_0x7e4a49['error']['code']===0x1f4){logger[_0xba33('0x14')](_0xba33('0xf'),_0x189ee4,_0x7e4a49['error'][_0xba33('0x15')]);return _0x405c26(_0x7e4a49[_0xba33('0x14')][_0xba33('0x15')]);}logger['error'](_0xba33('0xf'),_0x189ee4,_0x7e4a49[_0xba33('0x14')][_0xba33('0x15')]);return _0x4e577b(_0x7e4a49[_0xba33('0x14')]['message']);}else{logger[_0xba33('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x189ee4,_0xba33('0x10'));_0x4e577b(_0x7e4a49['result'][_0xba33('0x15')]);}})['catch'](function(_0x5d72b8){logger[_0xba33('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x189ee4,_0x5d72b8);_0x405c26(_0x5d72b8);});});} \ No newline at end of file +var _0x775f=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x39cc98,_0x697c22){var _0x5061d0=function(_0x17cc74){while(--_0x17cc74){_0x39cc98['push'](_0x39cc98['shift']());}};_0x5061d0(++_0x697c22);}(_0x775f,0x176));var _0xf775=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x775f[_0x13ff53];return _0x290228;};'use strict';var _=require(_0xf775('0x0'));var util=require(_0xf775('0x1'));var moment=require(_0xf775('0x2'));var BPromise=require(_0xf775('0x3'));var rs=require(_0xf775('0x4'));var fs=require('fs');var Redis=require(_0xf775('0x5'));var db=require(_0xf775('0x6'))['db'];var utils=require(_0xf775('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf775('0x8'));var jayson=require(_0xf775('0x9'));var client=jayson[_0xf775('0xa')][_0xf775('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f5759,_0x31cda0,_0x1497ff){return new BPromise(function(_0x16d43d,_0x2d08bf){return client['request'](_0x2f5759,_0x1497ff)[_0xf775('0xc')](function(_0x3992bb){logger[_0xf775('0xd')](_0xf775('0xe'),_0x31cda0,_0xf775('0xf'));logger[_0xf775('0x10')](_0xf775('0x11'),_0x31cda0,_0xf775('0xf'),JSON[_0xf775('0x12')](_0x3992bb));if(_0x3992bb['error']){if(_0x3992bb[_0xf775('0x13')]['code']===0x1f4){logger[_0xf775('0x13')](_0xf775('0xe'),_0x31cda0,_0x3992bb[_0xf775('0x13')][_0xf775('0x14')]);return _0x2d08bf(_0x3992bb[_0xf775('0x13')][_0xf775('0x14')]);}logger[_0xf775('0x13')](_0xf775('0xe'),_0x31cda0,_0x3992bb['error'][_0xf775('0x14')]);return _0x16d43d(_0x3992bb['error']['message']);}else{logger[_0xf775('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x31cda0,_0xf775('0xf'));_0x16d43d(_0x3992bb[_0xf775('0x15')][_0xf775('0x14')]);}})[_0xf775('0x16')](function(_0x2410ca){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x31cda0,_0x2410ca);_0x2d08bf(_0x2410ca);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index cf9bd7c..65017ed 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(_0x56bca2,_0x333d6c){var _0x5141d9=function(_0x55877f){while(--_0x55877f){_0x56bca2['push'](_0x56bca2['shift']());}};_0x5141d9(++_0x333d6c);}(_0xe28e,0x1ba));var _0xee28=function(_0x31e3ca,_0x1ba744){_0x31e3ca=_0x31e3ca-0x0;var _0x530fce=_0xe28e[_0x31e3ca];return _0x530fce;};'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 _0x87ae=['/:id','post','put','update','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated'];(function(_0x2b7e9c,_0x236531){var _0x39ac82=function(_0x351563){while(--_0x351563){_0x2b7e9c['push'](_0x2b7e9c['shift']());}};_0x39ac82(++_0x236531);}(_0x87ae,0xf5));var _0xe87a=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x87ae[_0x2f71f6];return _0x2b23ea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe87a('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe87a('0x1')]();var auth=require(_0xe87a('0x2'));var interaction=require(_0xe87a('0x3'));var config=require('../../config/environment');var controller=require(_0xe87a('0x4'));router[_0xe87a('0x5')]('/',auth[_0xe87a('0x6')](),controller['index']);router['get'](_0xe87a('0x7'),auth[_0xe87a('0x6')](),controller['show']);router[_0xe87a('0x8')]('/',auth[_0xe87a('0x6')](),controller['create']);router[_0xe87a('0x9')](_0xe87a('0x7'),auth['isAuthenticated'](),controller[_0xe87a('0xa')]);router[_0xe87a('0xb')](_0xe87a('0x7'),auth[_0xe87a('0x6')](),controller[_0xe87a('0xc')]);module[_0xe87a('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a32539d..7c94a63 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 _0x90f7=['ENUM','string','variable','customVariable','keyValue','STRING','exports'];(function(_0xb93e37,_0x3643bf){var _0x275cad=function(_0xb50af4){while(--_0xb50af4){_0xb93e37['push'](_0xb93e37['shift']());}};_0x275cad(++_0x3643bf);}(_0x90f7,0x187));var _0x790f=function(_0x3bd478,_0x1bb19a){_0x3bd478=_0x3bd478-0x0;var _0x5d4211=_0x90f7[_0x3bd478];return _0x5d4211;};'use strict';var Sequelize=require('sequelize');module[_0x790f('0x0')]={'type':{'type':Sequelize[_0x790f('0x1')](_0x790f('0x2'),_0x790f('0x3'),_0x790f('0x4'),_0x790f('0x5')),'defaultValue':_0x790f('0x2')},'content':{'type':Sequelize[_0x790f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x790f('0x1')](_0x790f('0x2'),_0x790f('0x3'),_0x790f('0x4'))},'keyContent':{'type':Sequelize[_0x790f('0x6')]},'idField':{'type':Sequelize[_0x790f('0x6')]},'nameField':{'type':Sequelize[_0x790f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcbe8=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x553342,_0x439dc3){var _0xad83da=function(_0x366822){while(--_0x366822){_0x553342['push'](_0x553342['shift']());}};_0xad83da(++_0x439dc3);}(_0xcbe8,0x1ea));var _0x8cbe=function(_0x1501f8,_0x35c5a6){_0x1501f8=_0x1501f8-0x0;var _0x56ab7c=_0xcbe8[_0x1501f8];return _0x56ab7c;};'use strict';var Sequelize=require('sequelize');module[_0x8cbe('0x0')]={'type':{'type':Sequelize[_0x8cbe('0x1')](_0x8cbe('0x2'),_0x8cbe('0x3'),_0x8cbe('0x4'),_0x8cbe('0x5')),'defaultValue':_0x8cbe('0x2')},'content':{'type':Sequelize[_0x8cbe('0x6')]},'key':{'type':Sequelize[_0x8cbe('0x6')]},'keyType':{'type':Sequelize[_0x8cbe('0x1')](_0x8cbe('0x2'),'variable',_0x8cbe('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8cbe('0x6')]},'customField':{'type':Sequelize[_0x8cbe('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 86ae158..54ed3cc 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 _0xe23a=['api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','send','index','Dynamics365Field','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','map','type','key','field','merge','options','include','findAll','rows','catch','params','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','moment','path','sox','ejs','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x103930,_0x3753ce){var _0x2b4cf1=function(_0x15ebea){while(--_0x15ebea){_0x103930['push'](_0x103930['shift']());}};_0x2b4cf1(++_0x3753ce);}(_0xe23a,0xf7));var _0xae23=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0xe23a[_0xf9a6cf];return _0x59e2bc;};'use strict';var pdf=require(_0xae23('0x0'));var emlformat=require(_0xae23('0x1'));var rimraf=require(_0xae23('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae23('0x3'));var rp=require('request-promise');var moment=require(_0xae23('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xae23('0x5'));var sox=require(_0xae23('0x6'));var csv=require('to-csv');var ejs=require(_0xae23('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xae23('0x8'));var jsforce=require(_0xae23('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xae23('0xa'));var querystring=require('querystring');var Papa=require(_0xae23('0xb'));var Redis=require(_0xae23('0xc'));var authService=require(_0xae23('0xd'));var qs=require(_0xae23('0xe'));var hardwareService=require(_0xae23('0xf'));var logger=require(_0xae23('0x10'))(_0xae23('0x11'));var utils=require(_0xae23('0x12'));var config=require('../../config/environment');var db=require(_0xae23('0x13'))['db'];function respondWithStatusCode(_0x5516b1,_0x11dd1d){_0x11dd1d=_0x11dd1d||0xcc;return function(_0x17adac){if(_0x17adac){return _0x5516b1[_0xae23('0x14')](_0x11dd1d);}return _0x5516b1[_0xae23('0x15')](_0x11dd1d)[_0xae23('0x16')]();};}function respondWithResult(_0x4e862b,_0x9cec37){_0x9cec37=_0x9cec37||0xc8;return function(_0x3997de){if(_0x3997de){return _0x4e862b[_0xae23('0x15')](_0x9cec37)[_0xae23('0x17')](_0x3997de);}};}function respondWithFilteredResult(_0x342d94,_0x1ee71f){return function(_0x30e310){if(_0x30e310){var _0x47fded=_0x30e310[_0xae23('0x18')],_0x4c1188=_0x1ee71f['offset'],_0x846f2f=_0x1ee71f[_0xae23('0x19')]+_0x1ee71f[_0xae23('0x1a')],_0x53e8f7;if(_0x846f2f>=_0x47fded){_0x846f2f=_0x47fded;_0x53e8f7=0xc8;}else{_0x53e8f7=0xce;}_0x342d94[_0xae23('0x15')](_0x53e8f7);return _0x342d94[_0xae23('0x1b')](_0xae23('0x1c'),_0x4c1188+'-'+_0x846f2f+'/'+_0x47fded)[_0xae23('0x17')](_0x30e310);}return null;};}function patchUpdates(_0x1c304a){return function(_0x23b6c4){try{jsonpatch['apply'](_0x23b6c4,_0x1c304a,!![]);}catch(_0x1e695d){return BPromise['reject'](_0x1e695d);}return _0x23b6c4[_0xae23('0x1d')]();};}function saveUpdates(_0x1c9498,_0x497b91){return function(_0x53851d){if(_0x53851d){return _0x53851d['update'](_0x1c9498)[_0xae23('0x1e')](function(_0x1818b0){return _0x1818b0;});}return null;};}function removeEntity(_0xa993ae,_0x1189ba){return function(_0x5e55e5){if(_0x5e55e5){return _0x5e55e5[_0xae23('0x1f')]()[_0xae23('0x1e')](function(){_0xa993ae[_0xae23('0x15')](0xcc)[_0xae23('0x16')]();});}};}function handleEntityNotFound(_0x3d7eee,_0x2ee208){return function(_0x27529e){if(!_0x27529e){_0x3d7eee[_0xae23('0x14')](0x194);}return _0x27529e;};}function handleError(_0x59ad85,_0xa47094){_0xa47094=_0xa47094||0x1f4;return function(_0x1199a8){logger[_0xae23('0x20')](_0x1199a8[_0xae23('0x21')]);if(_0x1199a8[_0xae23('0x22')]){delete _0x1199a8[_0xae23('0x22')];}_0x59ad85[_0xae23('0x15')](_0xa47094)[_0xae23('0x23')](_0x1199a8);};}exports[_0xae23('0x24')]=function(_0x207240,_0x4e3a55){var _0x3d0275={},_0x3c1028={},_0x59d15e={'count':0x0,'rows':[]};var _0x2072a6=db[_0xae23('0x25')]['rawAttributes'];_0x3c1028[_0xae23('0x26')]=_[_0xae23('0x27')](_0x2072a6);_0x3c1028[_0xae23('0x28')]=_[_0xae23('0x27')](_0x207240['query']);_0x3c1028[_0xae23('0x29')]=_[_0xae23('0x2a')](_0x3c1028['model'],_0x3c1028[_0xae23('0x28')]);_0x3d0275[_0xae23('0x2b')]=_[_0xae23('0x2a')](_0x3c1028[_0xae23('0x26')],qs[_0xae23('0x2c')](_0x207240[_0xae23('0x28')][_0xae23('0x2c')]));_0x3d0275['attributes']=_0x3d0275['attributes'][_0xae23('0x2d')]?_0x3d0275['attributes']:_0x3c1028[_0xae23('0x26')];if(!_0x207240[_0xae23('0x28')]['hasOwnProperty'](_0xae23('0x2e'))){_0x3d0275[_0xae23('0x1a')]=qs[_0xae23('0x1a')](_0x207240[_0xae23('0x28')][_0xae23('0x1a')]);_0x3d0275['offset']=qs[_0xae23('0x19')](_0x207240[_0xae23('0x28')]['offset']);}_0x3d0275['order']=qs[_0xae23('0x2f')](_0x207240[_0xae23('0x28')][_0xae23('0x2f')]);_0x3d0275[_0xae23('0x30')]=qs['filters'](_[_0xae23('0x31')](_0x207240[_0xae23('0x28')],_0x3c1028[_0xae23('0x29')]));if(_0x207240[_0xae23('0x28')][_0xae23('0x32')]){_0x3d0275['where']=_['merge'](_0x3d0275[_0xae23('0x30')],{'$or':_[_0xae23('0x33')](_0x2072a6,function(_0x23e448){if(_0x23e448[_0xae23('0x34')][_0xae23('0x35')]!=='VIRTUAL'){var _0x36dd03={};_0x36dd03[_0x23e448[_0xae23('0x36')]]={'$like':'%'+_0x207240['query']['filter']+'%'};return _0x36dd03;}})});}_0x3d0275=_[_0xae23('0x37')]({},_0x3d0275,_0x207240[_0xae23('0x38')]);var _0x1d2b73={'where':_0x3d0275[_0xae23('0x30')]};return db[_0xae23('0x25')][_0xae23('0x18')](_0x1d2b73)[_0xae23('0x1e')](function(_0x10da06){_0x59d15e['count']=_0x10da06;if(_0x207240[_0xae23('0x28')]['includeAll']){_0x3d0275[_0xae23('0x39')]=[{'all':!![]}];}return db[_0xae23('0x25')][_0xae23('0x3a')](_0x3d0275);})[_0xae23('0x1e')](function(_0x4eb4ff){_0x59d15e[_0xae23('0x3b')]=_0x4eb4ff;return _0x59d15e;})[_0xae23('0x1e')](respondWithFilteredResult(_0x4e3a55,_0x3d0275))[_0xae23('0x3c')](handleError(_0x4e3a55,null));};exports['show']=function(_0x4c927a,_0x15e488){var _0x463e36={'raw':!![],'where':{'id':_0x4c927a[_0xae23('0x3d')]['id']}},_0x1f76a3={};_0x1f76a3[_0xae23('0x26')]=_[_0xae23('0x27')](db[_0xae23('0x25')]['rawAttributes']);_0x1f76a3[_0xae23('0x28')]=_[_0xae23('0x27')](_0x4c927a[_0xae23('0x28')]);_0x1f76a3[_0xae23('0x29')]=_[_0xae23('0x2a')](_0x1f76a3['model'],_0x1f76a3['query']);_0x463e36[_0xae23('0x2b')]=_[_0xae23('0x2a')](_0x1f76a3[_0xae23('0x26')],qs[_0xae23('0x2c')](_0x4c927a['query']['fields']));_0x463e36[_0xae23('0x2b')]=_0x463e36[_0xae23('0x2b')][_0xae23('0x2d')]?_0x463e36[_0xae23('0x2b')]:_0x1f76a3[_0xae23('0x26')];if(_0x4c927a['query']['includeAll']){_0x463e36['include']=[{'all':!![]}];}_0x463e36=_[_0xae23('0x37')]({},_0x463e36,_0x4c927a['options']);return db['Dynamics365Field'][_0xae23('0x3e')](_0x463e36)[_0xae23('0x1e')](handleEntityNotFound(_0x15e488,null))[_0xae23('0x1e')](respondWithResult(_0x15e488,null))[_0xae23('0x3c')](handleError(_0x15e488,null));};exports[_0xae23('0x3f')]=function(_0x5340f8,_0x219670){return db[_0xae23('0x25')][_0xae23('0x3f')](_0x5340f8[_0xae23('0x40')],{})[_0xae23('0x1e')](respondWithResult(_0x219670,0xc9))[_0xae23('0x3c')](handleError(_0x219670,null));};exports[_0xae23('0x41')]=function(_0x32f1c2,_0xc60db3){if(_0x32f1c2[_0xae23('0x40')]['id']){delete _0x32f1c2['body']['id'];}return db['Dynamics365Field'][_0xae23('0x3e')]({'where':{'id':_0x32f1c2['params']['id']}})[_0xae23('0x1e')](handleEntityNotFound(_0xc60db3,null))[_0xae23('0x1e')](saveUpdates(_0x32f1c2[_0xae23('0x40')],null))[_0xae23('0x1e')](respondWithResult(_0xc60db3,null))['catch'](handleError(_0xc60db3,null));};exports[_0xae23('0x1f')]=function(_0x60b0cd,_0x129fbc){return db['Dynamics365Field'][_0xae23('0x3e')]({'where':{'id':_0x60b0cd['params']['id']}})[_0xae23('0x1e')](handleEntityNotFound(_0x129fbc,null))['then'](removeEntity(_0x129fbc,null))['catch'](handleError(_0x129fbc,null));}; \ No newline at end of file +var _0xad71=['apply','reject','save','then','destroy','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','map','type','key','field','filter','options','count','includeAll','Dynamics365Field','findAll','show','params','include','find','catch','create','body','update','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','offset','set','json'];(function(_0x49266b,_0x31521f){var _0x41941c=function(_0x48c6dd){while(--_0x48c6dd){_0x49266b['push'](_0x49266b['shift']());}};_0x41941c(++_0x31521f);}(_0xad71,0x108));var _0x1ad7=function(_0x856d1f,_0x2019a7){_0x856d1f=_0x856d1f-0x0;var _0x300f42=_0xad71[_0x856d1f];return _0x300f42;};'use strict';var pdf=require(_0x1ad7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1ad7('0x1'));var zipdir=require(_0x1ad7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ad7('0x3'));var moment=require(_0x1ad7('0x4'));var BPromise=require(_0x1ad7('0x5'));var Mustache=require('mustache');var util=require(_0x1ad7('0x6'));var path=require('path');var sox=require(_0x1ad7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ad7('0x8'));var squel=require(_0x1ad7('0x9'));var crypto=require(_0x1ad7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1ad7('0xb'));var toCsv=require(_0x1ad7('0xc'));var querystring=require(_0x1ad7('0xd'));var Papa=require(_0x1ad7('0xe'));var Redis=require(_0x1ad7('0xf'));var authService=require(_0x1ad7('0x10'));var qs=require(_0x1ad7('0x11'));var hardwareService=require(_0x1ad7('0x12'));var logger=require(_0x1ad7('0x13'))(_0x1ad7('0x14'));var utils=require(_0x1ad7('0x15'));var config=require(_0x1ad7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57d98c,_0x1c7829){_0x1c7829=_0x1c7829||0xcc;return function(_0x540325){if(_0x540325){return _0x57d98c['sendStatus'](_0x1c7829);}return _0x57d98c['status'](_0x1c7829)[_0x1ad7('0x17')]();};}function respondWithResult(_0xffd187,_0x23b44b){_0x23b44b=_0x23b44b||0xc8;return function(_0x30c74c){if(_0x30c74c){return _0xffd187[_0x1ad7('0x18')](_0x23b44b)['json'](_0x30c74c);}};}function respondWithFilteredResult(_0x38990e,_0x20ff1b){return function(_0x492de6){if(_0x492de6){var _0x18f8b3=_0x492de6['count'],_0x18805e=_0x20ff1b['offset'],_0x28797d=_0x20ff1b[_0x1ad7('0x19')]+_0x20ff1b['limit'],_0x23d151;if(_0x28797d>=_0x18f8b3){_0x28797d=_0x18f8b3;_0x23d151=0xc8;}else{_0x23d151=0xce;}_0x38990e[_0x1ad7('0x18')](_0x23d151);return _0x38990e[_0x1ad7('0x1a')]('Content-Range',_0x18805e+'-'+_0x28797d+'/'+_0x18f8b3)[_0x1ad7('0x1b')](_0x492de6);}return null;};}function patchUpdates(_0x1ec161){return function(_0x4d21d0){try{jsonpatch[_0x1ad7('0x1c')](_0x4d21d0,_0x1ec161,!![]);}catch(_0x4a29b9){return BPromise[_0x1ad7('0x1d')](_0x4a29b9);}return _0x4d21d0[_0x1ad7('0x1e')]();};}function saveUpdates(_0x438c47,_0x59f64a){return function(_0x501b55){if(_0x501b55){return _0x501b55['update'](_0x438c47)[_0x1ad7('0x1f')](function(_0x45df4d){return _0x45df4d;});}return null;};}function removeEntity(_0x44df5a,_0x585914){return function(_0x42880e){if(_0x42880e){return _0x42880e[_0x1ad7('0x20')]()[_0x1ad7('0x1f')](function(){_0x44df5a[_0x1ad7('0x18')](0xcc)[_0x1ad7('0x17')]();});}};}function handleEntityNotFound(_0x475315,_0x40460c){return function(_0x46bf87){if(!_0x46bf87){_0x475315[_0x1ad7('0x21')](0x194);}return _0x46bf87;};}function handleError(_0x43acb8,_0x3b12b0){_0x3b12b0=_0x3b12b0||0x1f4;return function(_0x2ccb3f){logger['error'](_0x2ccb3f[_0x1ad7('0x22')]);if(_0x2ccb3f[_0x1ad7('0x23')]){delete _0x2ccb3f['name'];}_0x43acb8[_0x1ad7('0x18')](_0x3b12b0)[_0x1ad7('0x24')](_0x2ccb3f);};}exports[_0x1ad7('0x25')]=function(_0x14a1b1,_0xaffd19){var _0x417ead={},_0x30ba55={},_0x26b87b={'count':0x0,'rows':[]};var _0x32c29f=db['Dynamics365Field'][_0x1ad7('0x26')];_0x30ba55[_0x1ad7('0x27')]=_[_0x1ad7('0x28')](_0x32c29f);_0x30ba55[_0x1ad7('0x29')]=_[_0x1ad7('0x28')](_0x14a1b1[_0x1ad7('0x29')]);_0x30ba55[_0x1ad7('0x2a')]=_[_0x1ad7('0x2b')](_0x30ba55[_0x1ad7('0x27')],_0x30ba55[_0x1ad7('0x29')]);_0x417ead[_0x1ad7('0x2c')]=_[_0x1ad7('0x2b')](_0x30ba55[_0x1ad7('0x27')],qs[_0x1ad7('0x2d')](_0x14a1b1['query'][_0x1ad7('0x2d')]));_0x417ead[_0x1ad7('0x2c')]=_0x417ead[_0x1ad7('0x2c')][_0x1ad7('0x2e')]?_0x417ead[_0x1ad7('0x2c')]:_0x30ba55[_0x1ad7('0x27')];if(!_0x14a1b1[_0x1ad7('0x29')][_0x1ad7('0x2f')](_0x1ad7('0x30'))){_0x417ead[_0x1ad7('0x31')]=qs[_0x1ad7('0x31')](_0x14a1b1['query']['limit']);_0x417ead['offset']=qs[_0x1ad7('0x19')](_0x14a1b1[_0x1ad7('0x29')][_0x1ad7('0x19')]);}_0x417ead[_0x1ad7('0x32')]=qs['sort'](_0x14a1b1[_0x1ad7('0x29')][_0x1ad7('0x33')]);_0x417ead['where']=qs[_0x1ad7('0x2a')](_[_0x1ad7('0x34')](_0x14a1b1[_0x1ad7('0x29')],_0x30ba55[_0x1ad7('0x2a')]));if(_0x14a1b1['query']['filter']){_0x417ead[_0x1ad7('0x35')]=_[_0x1ad7('0x36')](_0x417ead[_0x1ad7('0x35')],{'$or':_[_0x1ad7('0x37')](_0x32c29f,function(_0x133999){if(_0x133999[_0x1ad7('0x38')][_0x1ad7('0x39')]!=='VIRTUAL'){var _0x193acd={};_0x193acd[_0x133999[_0x1ad7('0x3a')]]={'$like':'%'+_0x14a1b1['query'][_0x1ad7('0x3b')]+'%'};return _0x193acd;}})});}_0x417ead=_['merge']({},_0x417ead,_0x14a1b1[_0x1ad7('0x3c')]);var _0x32a4c3={'where':_0x417ead[_0x1ad7('0x35')]};return db['Dynamics365Field'][_0x1ad7('0x3d')](_0x32a4c3)['then'](function(_0x45818a){_0x26b87b[_0x1ad7('0x3d')]=_0x45818a;if(_0x14a1b1['query'][_0x1ad7('0x3e')]){_0x417ead['include']=[{'all':!![]}];}return db[_0x1ad7('0x3f')][_0x1ad7('0x40')](_0x417ead);})[_0x1ad7('0x1f')](function(_0x474ca3){_0x26b87b['rows']=_0x474ca3;return _0x26b87b;})['then'](respondWithFilteredResult(_0xaffd19,_0x417ead))['catch'](handleError(_0xaffd19,null));};exports[_0x1ad7('0x41')]=function(_0x5e1ab9,_0x529aa0){var _0x54cbab={'raw':!![],'where':{'id':_0x5e1ab9[_0x1ad7('0x42')]['id']}},_0x3d28c2={};_0x3d28c2[_0x1ad7('0x27')]=_['keys'](db[_0x1ad7('0x3f')][_0x1ad7('0x26')]);_0x3d28c2[_0x1ad7('0x29')]=_[_0x1ad7('0x28')](_0x5e1ab9[_0x1ad7('0x29')]);_0x3d28c2['filters']=_[_0x1ad7('0x2b')](_0x3d28c2[_0x1ad7('0x27')],_0x3d28c2['query']);_0x54cbab[_0x1ad7('0x2c')]=_[_0x1ad7('0x2b')](_0x3d28c2['model'],qs[_0x1ad7('0x2d')](_0x5e1ab9[_0x1ad7('0x29')]['fields']));_0x54cbab['attributes']=_0x54cbab['attributes']['length']?_0x54cbab['attributes']:_0x3d28c2[_0x1ad7('0x27')];if(_0x5e1ab9[_0x1ad7('0x29')][_0x1ad7('0x3e')]){_0x54cbab[_0x1ad7('0x43')]=[{'all':!![]}];}_0x54cbab=_['merge']({},_0x54cbab,_0x5e1ab9[_0x1ad7('0x3c')]);return db['Dynamics365Field'][_0x1ad7('0x44')](_0x54cbab)[_0x1ad7('0x1f')](handleEntityNotFound(_0x529aa0,null))[_0x1ad7('0x1f')](respondWithResult(_0x529aa0,null))[_0x1ad7('0x45')](handleError(_0x529aa0,null));};exports[_0x1ad7('0x46')]=function(_0x162fd9,_0x266f82){return db['Dynamics365Field'][_0x1ad7('0x46')](_0x162fd9[_0x1ad7('0x47')],{})[_0x1ad7('0x1f')](respondWithResult(_0x266f82,0xc9))['catch'](handleError(_0x266f82,null));};exports[_0x1ad7('0x48')]=function(_0x4eff5e,_0xbbc464){if(_0x4eff5e[_0x1ad7('0x47')]['id']){delete _0x4eff5e[_0x1ad7('0x47')]['id'];}return db[_0x1ad7('0x3f')]['find']({'where':{'id':_0x4eff5e[_0x1ad7('0x42')]['id']}})[_0x1ad7('0x1f')](handleEntityNotFound(_0xbbc464,null))[_0x1ad7('0x1f')](saveUpdates(_0x4eff5e[_0x1ad7('0x47')],null))[_0x1ad7('0x1f')](respondWithResult(_0xbbc464,null))[_0x1ad7('0x45')](handleError(_0xbbc464,null));};exports[_0x1ad7('0x20')]=function(_0x1fd7ca,_0x1df7ba){return db[_0x1ad7('0x3f')][_0x1ad7('0x44')]({'where':{'id':_0x1fd7ca[_0x1ad7('0x42')]['id']}})[_0x1ad7('0x1f')](handleEntityNotFound(_0x1df7ba,null))[_0x1ad7('0x1f')](removeEntity(_0x1df7ba,null))[_0x1ad7('0x45')](handleError(_0x1df7ba,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3fa3614..6867c3e 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 _0xe0f1=['moment','bluebird','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','../../config/logger','api'];(function(_0x128017,_0x22dd51){var _0x168c37=function(_0x5dc97e){while(--_0x5dc97e){_0x128017['push'](_0x128017['shift']());}};_0x168c37(++_0x22dd51);}(_0xe0f1,0xf5));var _0x1e0f=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xe0f1[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e0f('0x0'))(_0x1e0f('0x1'));var moment=require(_0x1e0f('0x2'));var BPromise=require(_0x1e0f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e0f('0x4'));var config=require(_0x1e0f('0x5'));var attributes=require(_0x1e0f('0x6'));module[_0x1e0f('0x7')]=function(_0x12fb41,_0x5097b0){return _0x12fb41[_0x1e0f('0x8')](_0x1e0f('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x1e0f('0xa'),'fields':[_0x1e0f('0xb'),_0x1e0f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a29=['exports','define','Dynamics365Field','int_dynamics365_fields','FieldId','moment','bluebird','request-promise','../../config/environment','./intDynamics365Field.attributes'];(function(_0x1f9f83,_0x2fc8f2){var _0x250314=function(_0x25ac67){while(--_0x25ac67){_0x1f9f83['push'](_0x1f9f83['shift']());}};_0x250314(++_0x2fc8f2);}(_0x5a29,0x73));var _0x95a2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5a29[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x95a2('0x0'));var BPromise=require(_0x95a2('0x1'));var rp=require(_0x95a2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x95a2('0x3'));var attributes=require(_0x95a2('0x4'));module[_0x95a2('0x5')]=function(_0x356da9,_0x15628b){return _0x356da9[_0x95a2('0x6')](_0x95a2('0x7'),attributes,{'tableName':_0x95a2('0x8'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x95a2('0x9')],'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 8c366ce..24d899e 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 _0xaf11=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x248432,_0x5e6675){var _0x4ab8b5=function(_0x710af9){while(--_0x710af9){_0x248432['push'](_0x248432['shift']());}};_0x4ab8b5(++_0x5e6675);}(_0xaf11,0x12f));var _0x1af1=function(_0x21736f,_0x57271e){_0x21736f=_0x21736f-0x0;var _0x2deed1=_0xaf11[_0x21736f];return _0x2deed1;};'use strict';var _=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var moment=require(_0x1af1('0x2'));var BPromise=require(_0x1af1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1af1('0x4'));var db=require(_0x1af1('0x5'))['db'];var utils=require(_0x1af1('0x6'));var logger=require('../../config/logger')(_0x1af1('0x7'));var config=require(_0x1af1('0x8'));var jayson=require(_0x1af1('0x9'));var client=jayson['client'][_0x1af1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dbe9d,_0x20ba8b,_0x26d917){return new BPromise(function(_0x48b286,_0x260799){return client['request'](_0x5dbe9d,_0x26d917)['then'](function(_0x2d8327){logger[_0x1af1('0xb')](_0x1af1('0xc'),_0x20ba8b,_0x1af1('0xd'));logger[_0x1af1('0xe')](_0x1af1('0xf'),_0x20ba8b,'request\x20sent',JSON[_0x1af1('0x10')](_0x2d8327));if(_0x2d8327[_0x1af1('0x11')]){if(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x12')]===0x1f4){logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x2d8327[_0x1af1('0x11')]['message']);return _0x260799(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x13')]);}logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x2d8327['error'][_0x1af1('0x13')]);return _0x48b286(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x13')]);}else{logger['info'](_0x1af1('0xc'),_0x20ba8b,_0x1af1('0xd'));_0x48b286(_0x2d8327[_0x1af1('0x14')][_0x1af1('0x13')]);}})[_0x1af1('0x15')](function(_0x359eaf){logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x359eaf);_0x260799(_0x359eaf);});});} \ No newline at end of file +var _0x627e=['request','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x7ff789,_0x3cad59){var _0x381d87=function(_0x5acf3a){while(--_0x5acf3a){_0x7ff789['push'](_0x7ff789['shift']());}};_0x381d87(++_0x3cad59);}(_0x627e,0x14a));var _0xe627=function(_0x410619,_0x1cc95c){_0x410619=_0x410619-0x0;var _0x43a729=_0x627e[_0x410619];return _0x43a729;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 6d5153d..9dd73c1 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 _0x758e=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x758e,0xbf));var _0xe758=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x758e[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xe758('0x0'));var util=require(_0xe758('0x1'));var path=require(_0xe758('0x2'));var timeout=require(_0xe758('0x3'));var express=require(_0xe758('0x4'));var router=express['Router']();var auth=require(_0xe758('0x5'));var interaction=require(_0xe758('0x6'));var config=require(_0xe758('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0xe758('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe758('0x9'),auth[_0xe758('0xa')](),controller[_0xe758('0xb')]);router[_0xe758('0x8')](_0xe758('0xc'),auth[_0xe758('0xa')](),controller['getConfigurations']);router[_0xe758('0x8')](_0xe758('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xe758('0xe')]('/',auth['isAuthenticated'](),controller[_0xe758('0xf')]);router[_0xe758('0xe')]('/:id/configurations',auth[_0xe758('0xa')](),controller[_0xe758('0x10')]);router[_0xe758('0x11')](_0xe758('0x9'),auth[_0xe758('0xa')](),controller[_0xe758('0x12')]);router['delete'](_0xe758('0x9'),auth[_0xe758('0xa')](),controller[_0xe758('0x13')]);module[_0xe758('0x14')]=router; \ No newline at end of file +var _0x45e3=['/:id/fields','getFields','post','create','put','update','destroy','exports','util','connect-timeout','express','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0x45e3,0x1ac));var _0x345e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x45e3[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x345e('0x0'));var path=require('path');var timeout=require(_0x345e('0x1'));var express=require(_0x345e('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x345e('0x3'));var controller=require(_0x345e('0x4'));router[_0x345e('0x5')]('/',auth['isAuthenticated'](),controller[_0x345e('0x6')]);router[_0x345e('0x5')](_0x345e('0x7'),auth['isAuthenticated'](),controller[_0x345e('0x8')]);router[_0x345e('0x5')](_0x345e('0x9'),auth[_0x345e('0xa')](),controller[_0x345e('0xb')]);router[_0x345e('0x5')](_0x345e('0xc'),auth[_0x345e('0xa')](),controller[_0x345e('0xd')]);router[_0x345e('0xe')]('/',auth[_0x345e('0xa')](),controller[_0x345e('0xf')]);router['post'](_0x345e('0x9'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x345e('0x10')](_0x345e('0x7'),auth['isAuthenticated'](),controller[_0x345e('0x11')]);router['delete'](_0x345e('0x7'),auth[_0x345e('0xa')](),controller[_0x345e('0x12')]);module[_0x345e('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 5cd7af0..9074331 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 _0x5d0a=['username','sequelize','STRING'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0x5d0a,0x175));var _0xa5d0=function(_0x51d8e9,_0x4ef0ec){_0x51d8e9=_0x51d8e9-0x0;var _0x38a577=_0x5d0a[_0x51d8e9];return _0x38a577;};'use strict';var Sequelize=require(_0xa5d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa5d0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa5d0('0x1')],'unique':_0xa5d0('0x2')},'apiKey':{'type':Sequelize[_0xa5d0('0x1')]},'remoteUri':{'type':Sequelize[_0xa5d0('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa5d0('0x1')]}}; \ No newline at end of file +var _0x1fcc=['STRING','username','remoteUri','sequelize','exports'];(function(_0x2d89eb,_0x4dddde){var _0x3c602d=function(_0x31eb5c){while(--_0x31eb5c){_0x2d89eb['push'](_0x2d89eb['shift']());}};_0x3c602d(++_0x4dddde);}(_0x1fcc,0x125));var _0xc1fc=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x1fcc[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require(_0xc1fc('0x0'));module[_0xc1fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc1fc('0x2')]},'username':{'type':Sequelize[_0xc1fc('0x2')],'unique':_0xc1fc('0x3')},'apiKey':{'type':Sequelize[_0xc1fc('0x2')]},'remoteUri':{'type':Sequelize[_0xc1fc('0x2')],'unique':_0xc1fc('0x4')},'serverUrl':{'type':Sequelize[_0xc1fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 92c93fa..d803e6c 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 _0x55ca=['sort','where','pick','filter','map','type','VIRTUAL','options','include','FreshdeskAccount','catch','filters','merge','create','body','find','params','destroy','getConfigurations','findOne','length','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','requester','subject','agent','description','group','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','stack','name','index','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x55ca,0x126));var _0xa55c=function(_0x579121,_0x27e9e2){_0x579121=_0x579121-0x0;var _0x38a4ae=_0x55ca[_0x579121];return _0x38a4ae;};'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 hardwareService=require(_0xa55c('0x10'));var logger=require(_0xa55c('0x11'))(_0xa55c('0x12'));var utils=require(_0xa55c('0x13'));var config=require(_0xa55c('0x14'));var db=require(_0xa55c('0x15'))['db'];var integrations=require(_0xa55c('0x16'));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')]('FreshdeskAccount,\x20%s,\x20%s',_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x3dcf4f(_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);}else{logger[_0xa55c('0x1e')]('FreshdeskAccount,\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(){_0x2808e9[_0xa55c('0x27')](0xcc)[_0xa55c('0x28')]();});}};}function handleEntityNotFound(_0x4932d0,_0x30fadd){return function(_0x2f0110){if(!_0x2f0110){_0x4932d0[_0xa55c('0x26')](0x194);}return _0x2f0110;};}function handleError(_0x1839ac,_0x30d4f8){_0x30d4f8=_0x30d4f8||0x1f4;return function(_0x38ff96){logger[_0xa55c('0x24')](_0x38ff96[_0xa55c('0x32')]);if(_0x38ff96[_0xa55c('0x33')]){delete _0x38ff96['name'];}_0x1839ac['status'](_0x30d4f8)['send'](_0x38ff96);};}exports[_0xa55c('0x34')]=function(_0x18e00e,_0x2bb4f0){var _0x5802e4={},_0x768408={},_0x547930={'count':0x0,'rows':[]};var _0x119220=db['FreshdeskAccount'][_0xa55c('0x35')];_0x768408[_0xa55c('0x36')]=_[_0xa55c('0x37')](_0x119220);_0x768408['query']=_[_0xa55c('0x37')](_0x18e00e[_0xa55c('0x38')]);_0x768408['filters']=_[_0xa55c('0x39')](_0x768408[_0xa55c('0x36')],_0x768408['query']);_0x5802e4['attributes']=_[_0xa55c('0x39')](_0x768408['model'],qs[_0xa55c('0x3a')](_0x18e00e[_0xa55c('0x38')]['fields']));_0x5802e4['attributes']=_0x5802e4['attributes']['length']?_0x5802e4[_0xa55c('0x3b')]:_0x768408[_0xa55c('0x36')];if(!_0x18e00e[_0xa55c('0x38')][_0xa55c('0x3c')](_0xa55c('0x3d'))){_0x5802e4['limit']=qs[_0xa55c('0x2b')](_0x18e00e[_0xa55c('0x38')][_0xa55c('0x2b')]);_0x5802e4[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x18e00e[_0xa55c('0x38')]['offset']);}_0x5802e4[_0xa55c('0x3e')]=qs['sort'](_0x18e00e['query'][_0xa55c('0x3f')]);_0x5802e4[_0xa55c('0x40')]=qs['filters'](_[_0xa55c('0x41')](_0x18e00e['query'],_0x768408['filters']));if(_0x18e00e[_0xa55c('0x38')][_0xa55c('0x42')]){_0x5802e4[_0xa55c('0x40')]=_['merge'](_0x5802e4[_0xa55c('0x40')],{'$or':_[_0xa55c('0x43')](_0x119220,function(_0x5d9d5d){if(_0x5d9d5d[_0xa55c('0x44')]['key']!==_0xa55c('0x45')){var _0x43a42d={};_0x43a42d[_0x5d9d5d['field']]={'$like':'%'+_0x18e00e[_0xa55c('0x38')][_0xa55c('0x42')]+'%'};return _0x43a42d;}})});}_0x5802e4=_['merge']({},_0x5802e4,_0x18e00e[_0xa55c('0x46')]);var _0x187e09={'where':_0x5802e4[_0xa55c('0x40')]};return db['FreshdeskAccount'][_0xa55c('0x29')](_0x187e09)['then'](function(_0x2f9717){_0x547930[_0xa55c('0x29')]=_0x2f9717;if(_0x18e00e[_0xa55c('0x38')]['includeAll']){_0x5802e4[_0xa55c('0x47')]=[{'all':!![]}];}return db[_0xa55c('0x48')]['findAll'](_0x5802e4);})[_0xa55c('0x1d')](function(_0x931907){_0x547930['rows']=_0x931907;return _0x547930;})[_0xa55c('0x1d')](respondWithFilteredResult(_0x2bb4f0,_0x5802e4))[_0xa55c('0x49')](handleError(_0x2bb4f0,null));};exports['show']=function(_0x46f839,_0x81cee8){var _0x219a68={'raw':![],'where':{'id':_0x46f839['params']['id']}},_0x28b6c3={};_0x28b6c3[_0xa55c('0x36')]=_['keys'](db[_0xa55c('0x48')][_0xa55c('0x35')]);_0x28b6c3[_0xa55c('0x38')]=_['keys'](_0x46f839[_0xa55c('0x38')]);_0x28b6c3[_0xa55c('0x4a')]=_['intersection'](_0x28b6c3[_0xa55c('0x36')],_0x28b6c3[_0xa55c('0x38')]);_0x219a68[_0xa55c('0x3b')]=_[_0xa55c('0x39')](_0x28b6c3[_0xa55c('0x36')],qs[_0xa55c('0x3a')](_0x46f839[_0xa55c('0x38')][_0xa55c('0x3a')]));_0x219a68[_0xa55c('0x3b')]=_0x219a68[_0xa55c('0x3b')]['length']?_0x219a68[_0xa55c('0x3b')]:_0x28b6c3[_0xa55c('0x36')];if(_0x46f839[_0xa55c('0x38')]['includeAll']){_0x219a68[_0xa55c('0x47')]=[{'all':!![]}];}_0x219a68=_[_0xa55c('0x4b')]({},_0x219a68,_0x46f839['options']);return db[_0xa55c('0x48')]['find'](_0x219a68)[_0xa55c('0x1d')](handleEntityNotFound(_0x81cee8,null))[_0xa55c('0x1d')](respondWithResult(_0x81cee8,null))[_0xa55c('0x49')](handleError(_0x81cee8,null));};exports[_0xa55c('0x4c')]=function(_0x2ecf79,_0x5b1cf3){return db[_0xa55c('0x48')][_0xa55c('0x4c')](_0x2ecf79['body'],{})[_0xa55c('0x1d')](respondWithResult(_0x5b1cf3,0xc9))[_0xa55c('0x49')](handleError(_0x5b1cf3,null));};exports[_0xa55c('0x31')]=function(_0x30693a,_0x50176b){if(_0x30693a['body']['id']){delete _0x30693a[_0xa55c('0x4d')]['id'];}return db[_0xa55c('0x48')][_0xa55c('0x4e')]({'where':{'id':_0x30693a[_0xa55c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x50176b,null))[_0xa55c('0x1d')](saveUpdates(_0x30693a['body'],null))[_0xa55c('0x1d')](respondWithResult(_0x50176b,null))[_0xa55c('0x49')](handleError(_0x50176b,null));};exports[_0xa55c('0x50')]=function(_0x2ccfb1,_0xec640){return db['FreshdeskAccount'][_0xa55c('0x4e')]({'where':{'id':_0x2ccfb1['params']['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0xec640,null))[_0xa55c('0x1d')](removeEntity(_0xec640,null))[_0xa55c('0x49')](handleError(_0xec640,null));};exports[_0xa55c('0x51')]=function(_0x19aaf5,_0x138c9e,_0x5d14e0){var _0x53e2be={};var _0x450567={};var _0x449e00;var _0x2f2d21;return db[_0xa55c('0x48')][_0xa55c('0x52')]({'where':{'id':_0x19aaf5['params']['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x138c9e,null))[_0xa55c('0x1d')](function(_0x28bac4){if(_0x28bac4){_0x449e00=_0x28bac4;_0x450567[_0xa55c('0x36')]=_[_0xa55c('0x37')](db['FreshdeskConfiguration'][_0xa55c('0x35')]);_0x450567[_0xa55c('0x38')]=_[_0xa55c('0x37')](_0x19aaf5[_0xa55c('0x38')]);_0x450567[_0xa55c('0x4a')]=_['intersection'](_0x450567[_0xa55c('0x36')],_0x450567['query']);_0x53e2be[_0xa55c('0x3b')]=_['intersection'](_0x450567[_0xa55c('0x36')],qs['fields'](_0x19aaf5[_0xa55c('0x38')][_0xa55c('0x3a')]));_0x53e2be[_0xa55c('0x3b')]=_0x53e2be[_0xa55c('0x3b')][_0xa55c('0x53')]?_0x53e2be[_0xa55c('0x3b')]:_0x450567[_0xa55c('0x36')];_0x53e2be[_0xa55c('0x3e')]=qs[_0xa55c('0x3f')](_0x19aaf5[_0xa55c('0x38')]['sort']);_0x53e2be[_0xa55c('0x40')]=qs[_0xa55c('0x4a')](_['pick'](_0x19aaf5[_0xa55c('0x38')],_0x450567[_0xa55c('0x4a')]));if(_0x19aaf5[_0xa55c('0x38')][_0xa55c('0x42')]){_0x53e2be[_0xa55c('0x40')]=_[_0xa55c('0x4b')](_0x53e2be[_0xa55c('0x40')],{'$or':_[_0xa55c('0x43')](_0x53e2be['attributes'],function(_0x1dfaf7){var _0x475131={};_0x475131[_0x1dfaf7]={'$like':'%'+_0x19aaf5[_0xa55c('0x38')][_0xa55c('0x42')]+'%'};return _0x475131;})});}_0x53e2be=_[_0xa55c('0x4b')]({},_0x53e2be,_0x19aaf5[_0xa55c('0x46')]);return _0x449e00[_0xa55c('0x51')](_0x53e2be);}})[_0xa55c('0x1d')](function(_0x25d5a1){if(_0x25d5a1){_0x2f2d21=_0x25d5a1['length'];if(!_0x19aaf5[_0xa55c('0x38')][_0xa55c('0x3c')](_0xa55c('0x3d'))){_0x53e2be[_0xa55c('0x2b')]=qs[_0xa55c('0x2b')](_0x19aaf5[_0xa55c('0x38')][_0xa55c('0x2b')]);_0x53e2be[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x19aaf5[_0xa55c('0x38')][_0xa55c('0x2a')]);}return _0x449e00['getConfigurations'](_0x53e2be);}})[_0xa55c('0x1d')](function(_0x531eee){if(_0x531eee){return _0x531eee?{'count':_0x2f2d21,'rows':_0x531eee}:null;}})[_0xa55c('0x1d')](respondWithResult(_0x138c9e,null))[_0xa55c('0x49')](handleError(_0x138c9e,null));};exports[_0xa55c('0x54')]=function(_0x4f2a7b,_0x4d9722,_0x2640a1){if(_0x4f2a7b[_0xa55c('0x4d')]['id']){delete _0x4f2a7b[_0xa55c('0x4d')]['id'];}return db[_0xa55c('0x48')]['findOne']({'where':{'id':_0x4f2a7b[_0xa55c('0x4f')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x4d9722,null))[_0xa55c('0x1d')](function(_0x3a9910){if(_0x3a9910){_0x4f2a7b[_0xa55c('0x4d')]['AccountId']=_0x3a9910['id'];_0x4f2a7b['body'][_0xa55c('0x55')]=integrations[_0xa55c('0x56')](_0x4f2a7b[_0xa55c('0x4d')][_0xa55c('0x57')],_0x4f2a7b[_0xa55c('0x4d')]['type']);_0x4f2a7b[_0xa55c('0x4d')][_0xa55c('0x58')]=integrations['getDescriptions'](_0x4f2a7b[_0xa55c('0x4d')][_0xa55c('0x57')],_0x4f2a7b[_0xa55c('0x4d')]['type']);return db[_0xa55c('0x59')][_0xa55c('0x4c')](_0x4f2a7b[_0xa55c('0x4d')],{'include':[{'model':db[_0xa55c('0x5a')],'as':_0xa55c('0x55')},{'model':db['FreshdeskField'],'as':_0xa55c('0x58')}]});}return null;})[_0xa55c('0x1d')](respondWithResult(_0x4d9722,null))['catch'](handleError(_0x4d9722,null));};exports['getFields']=function(_0x194ddc,_0x4e1cbd,_0x752a0f){var _0x5ca0bc='';return db[_0xa55c('0x48')][_0xa55c('0x52')]({'where':{'id':_0x194ddc[_0xa55c('0x4f')]['id']},'attributes':['id',_0xa55c('0x5b'),_0xa55c('0x5c')]})[_0xa55c('0x1d')](handleEntityNotFound(_0x4e1cbd,null))[_0xa55c('0x1d')](function(_0x5d8551){if(_0x5d8551){_0x5ca0bc=_0x5d8551[_0xa55c('0x5b')];var _0x267855=_0x5ca0bc[_0xa55c('0x5d')](-0x1);if(_0x267855==='/'){_0x5ca0bc=_0x5ca0bc[_0xa55c('0x5e')](0x0,_0x5ca0bc['lastIndexOf'](_0x267855));}return rp({'method':_0xa55c('0x5f'),'uri':util[_0xa55c('0x60')](_0xa55c('0x61'),_0x5ca0bc,_0xa55c('0x62')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xa55c('0x60')](_0xa55c('0x63'),_0x5d8551[_0xa55c('0x5c')]))[_0xa55c('0x64')]('base64'))},'json':!![]});}})['then'](function(_0x40663){if(_0x40663){var _0x3b2a5c=[_0xa55c('0x65'),_0xa55c('0x66'),_0xa55c('0x67'),_0xa55c('0x68'),_0xa55c('0x27'),'priority',_0xa55c('0x69'),'source',_0xa55c('0x6a'),'group',_0xa55c('0x6b')];_[_0xa55c('0x6c')](_0x40663,function(_0x441c11){return _0x3b2a5c[_0xa55c('0x6d')](_0x441c11[_0xa55c('0x33')])||!_0x441c11[_0xa55c('0x6e')]&&_0x441c11[_0xa55c('0x44')]!==_0xa55c('0x6f')&&_0x441c11['type']!=='custom_dropdown';});return{'count':_0x40663[_0xa55c('0x53')],'rows':_[_0xa55c('0x43')](_0x40663,function(_0xc2ad5c){return{'id':_0xc2ad5c[_0xa55c('0x33')],'name':_0xc2ad5c[_0xa55c('0x70')],'custom':!_0xc2ad5c[_0xa55c('0x6e')],'options':_0xc2ad5c['choices']?_[_0xa55c('0x43')](_0xc2ad5c[_0xa55c('0x71')],function(_0x301e56){return{'name':_[_0xa55c('0x72')](_0x301e56),'value':_0x301e56};}):[]};})};}})[_0xa55c('0x1d')](respondWithResult(_0x4e1cbd,null))[_0xa55c('0x49')](function(_0xeb45b0){var _0x27ce81=_0x194ddc['query'][_0xa55c('0x18')]?0x1f4:_0xeb45b0[_0xa55c('0x73')]||0x1f4;logger[_0xa55c('0x24')](_0xa55c('0x74'),_0xa55c('0x75'),_0x27ce81,JSON['stringify'](_0xeb45b0));delete _0xeb45b0[_0xa55c('0x33')];if(_0x27ce81===0x191){_0x27ce81=0x190;}_0x4e1cbd[_0xa55c('0x27')](_0x27ce81)['send'](_0x194ddc['query'][_0xa55c('0x18')]?{'message':_0xa55c('0x76'),'statusCode':_0xeb45b0['statusCode']}:_0xeb45b0);});}; \ No newline at end of file +var _0xfc76=['pick','filter','merge','map','type','key','VIRTUAL','field','options','FreshdeskAccount','include','findAll','rows','show','rawAttributes','find','create','body','params','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Descriptions','remoteUri','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','update','destroy','then','stack','name','send','index','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x523671,_0x4657fc){var _0x5b0bdc=function(_0x301007){while(--_0x301007){_0x523671['push'](_0x523671['shift']());}};_0x5b0bdc(++_0x4657fc);}(_0xfc76,0xb5));var _0x6fc7=function(_0x16f833,_0x196439){_0x16f833=_0x16f833-0x0;var _0x465063=_0xfc76[_0x16f833];return _0x465063;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6fc7('0x0'));var rimraf=require(_0x6fc7('0x1'));var zipdir=require(_0x6fc7('0x2'));var jsonpatch=require(_0x6fc7('0x3'));var rp=require(_0x6fc7('0x4'));var moment=require('moment');var BPromise=require(_0x6fc7('0x5'));var Mustache=require(_0x6fc7('0x6'));var util=require('util');var path=require(_0x6fc7('0x7'));var sox=require('sox');var csv=require(_0x6fc7('0x8'));var ejs=require(_0x6fc7('0x9'));var fs=require('fs');var _=require(_0x6fc7('0xa'));var squel=require('squel');var crypto=require(_0x6fc7('0xb'));var jsforce=require(_0x6fc7('0xc'));var deskjs=require(_0x6fc7('0xd'));var toCsv=require(_0x6fc7('0x8'));var querystring=require(_0x6fc7('0xe'));var Papa=require(_0x6fc7('0xf'));var Redis=require('ioredis');var authService=require(_0x6fc7('0x10'));var qs=require(_0x6fc7('0x11'));var hardwareService=require(_0x6fc7('0x12'));var logger=require(_0x6fc7('0x13'))(_0x6fc7('0x14'));var utils=require(_0x6fc7('0x15'));var config=require('../../config/environment');var db=require(_0x6fc7('0x16'))['db'];var integrations=require(_0x6fc7('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x6fc7('0x18')][_0x6fc7('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5f438d,_0x1728ef,_0xd537f){if(_0xd537f){var _0x4af729=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4af729[_0x6fc7('0x1a')](_0x1728ef)){return _0x5f438d;}else{throw new db[(_0x6fc7('0x1b'))][(_0x6fc7('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5f438d;}}function respondWithRpcPromise(_0x556e28,_0xbb4a3e,_0x45d585,_0x499bcc){return new BPromise(function(_0x2b0122,_0x15e4db){var _0x124cd6=_0x499bcc||client;return _0x124cd6[_0x6fc7('0x1d')](_0x556e28,_0x45d585)['then'](function(_0x816704){logger[_0x6fc7('0x1e')](_0x6fc7('0x1f'),_0xbb4a3e,_0x6fc7('0x20'));logger[_0x6fc7('0x21')](_0x6fc7('0x22'),_0xbb4a3e,'request\x20sent',JSON[_0x6fc7('0x23')](_0x816704));if(_0x816704[_0x6fc7('0x24')]){if(_0x816704[_0x6fc7('0x24')][_0x6fc7('0x25')]===0x1f4){logger[_0x6fc7('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0xbb4a3e,_0x816704[_0x6fc7('0x24')][_0x6fc7('0x26')]);return _0x15e4db(_0x816704['error'][_0x6fc7('0x26')]);}logger['error'](_0x6fc7('0x1f'),_0xbb4a3e,_0x816704['error'][_0x6fc7('0x26')]);return _0x2b0122(_0x816704[_0x6fc7('0x24')][_0x6fc7('0x26')]);}else{logger['info'](_0x6fc7('0x1f'),_0xbb4a3e,'request\x20sent');_0x2b0122(_0x816704[_0x6fc7('0x27')][_0x6fc7('0x26')]);}})[_0x6fc7('0x28')](function(_0x1e79b9){logger[_0x6fc7('0x24')](_0x6fc7('0x1f'),_0xbb4a3e,_0x1e79b9);_0x15e4db(_0x1e79b9);});});}function respondWithStatusCode(_0x190680,_0x817221){_0x817221=_0x817221||0xcc;return function(_0x2b6b55){if(_0x2b6b55){return _0x190680[_0x6fc7('0x29')](_0x817221);}return _0x190680[_0x6fc7('0x2a')](_0x817221)[_0x6fc7('0x2b')]();};}function respondWithResult(_0x4612d4,_0x22f83c){_0x22f83c=_0x22f83c||0xc8;return function(_0x232324){if(_0x232324){return _0x4612d4['status'](_0x22f83c)[_0x6fc7('0x2c')](_0x232324);}};}function respondWithFilteredResult(_0x3053b1,_0x168c87){return function(_0x82c8cd){if(_0x82c8cd){var _0x5c1fd3=_0x82c8cd[_0x6fc7('0x2d')],_0xfff989=_0x168c87[_0x6fc7('0x2e')],_0x30e579=_0x168c87[_0x6fc7('0x2e')]+_0x168c87[_0x6fc7('0x2f')],_0xa93a4f;if(_0x30e579>=_0x5c1fd3){_0x30e579=_0x5c1fd3;_0xa93a4f=0xc8;}else{_0xa93a4f=0xce;}_0x3053b1[_0x6fc7('0x2a')](_0xa93a4f);return _0x3053b1['set']('Content-Range',_0xfff989+'-'+_0x30e579+'/'+_0x5c1fd3)[_0x6fc7('0x2c')](_0x82c8cd);}return null;};}function patchUpdates(_0x17ddfe){return function(_0x3e796a){try{jsonpatch[_0x6fc7('0x30')](_0x3e796a,_0x17ddfe,!![]);}catch(_0x3f89f2){return BPromise[_0x6fc7('0x31')](_0x3f89f2);}return _0x3e796a['save']();};}function saveUpdates(_0x278f8f,_0xbf7528){return function(_0x16c514){if(_0x16c514){return _0x16c514[_0x6fc7('0x32')](_0x278f8f)['then'](function(_0x5e3ca8){return _0x5e3ca8;});}return null;};}function removeEntity(_0x4973d6,_0xb80178){return function(_0x23bd52){if(_0x23bd52){return _0x23bd52[_0x6fc7('0x33')]()[_0x6fc7('0x34')](function(){_0x4973d6[_0x6fc7('0x2a')](0xcc)[_0x6fc7('0x2b')]();});}};}function handleEntityNotFound(_0x46aad4,_0x141898){return function(_0x3325bb){if(!_0x3325bb){_0x46aad4['sendStatus'](0x194);}return _0x3325bb;};}function handleError(_0x13c800,_0x549b27){_0x549b27=_0x549b27||0x1f4;return function(_0x40ee9c){logger[_0x6fc7('0x24')](_0x40ee9c[_0x6fc7('0x35')]);if(_0x40ee9c[_0x6fc7('0x36')]){delete _0x40ee9c['name'];}_0x13c800[_0x6fc7('0x2a')](_0x549b27)[_0x6fc7('0x37')](_0x40ee9c);};}exports[_0x6fc7('0x38')]=function(_0x3228d1,_0x5717cd){var _0x11167e={},_0x5f1c2e={},_0xec700a={'count':0x0,'rows':[]};var _0x59e181=db['FreshdeskAccount']['rawAttributes'];_0x5f1c2e[_0x6fc7('0x39')]=_['keys'](_0x59e181);_0x5f1c2e[_0x6fc7('0x3a')]=_[_0x6fc7('0x3b')](_0x3228d1[_0x6fc7('0x3a')]);_0x5f1c2e[_0x6fc7('0x3c')]=_[_0x6fc7('0x3d')](_0x5f1c2e[_0x6fc7('0x39')],_0x5f1c2e[_0x6fc7('0x3a')]);_0x11167e[_0x6fc7('0x3e')]=_[_0x6fc7('0x3d')](_0x5f1c2e[_0x6fc7('0x39')],qs[_0x6fc7('0x3f')](_0x3228d1[_0x6fc7('0x3a')][_0x6fc7('0x3f')]));_0x11167e[_0x6fc7('0x3e')]=_0x11167e[_0x6fc7('0x3e')][_0x6fc7('0x40')]?_0x11167e[_0x6fc7('0x3e')]:_0x5f1c2e[_0x6fc7('0x39')];if(!_0x3228d1['query']['hasOwnProperty'](_0x6fc7('0x41'))){_0x11167e[_0x6fc7('0x2f')]=qs[_0x6fc7('0x2f')](_0x3228d1[_0x6fc7('0x3a')]['limit']);_0x11167e[_0x6fc7('0x2e')]=qs[_0x6fc7('0x2e')](_0x3228d1[_0x6fc7('0x3a')][_0x6fc7('0x2e')]);}_0x11167e[_0x6fc7('0x42')]=qs[_0x6fc7('0x43')](_0x3228d1[_0x6fc7('0x3a')][_0x6fc7('0x43')]);_0x11167e[_0x6fc7('0x44')]=qs[_0x6fc7('0x3c')](_[_0x6fc7('0x45')](_0x3228d1[_0x6fc7('0x3a')],_0x5f1c2e['filters']));if(_0x3228d1[_0x6fc7('0x3a')][_0x6fc7('0x46')]){_0x11167e['where']=_[_0x6fc7('0x47')](_0x11167e[_0x6fc7('0x44')],{'$or':_[_0x6fc7('0x48')](_0x59e181,function(_0x188fcb){if(_0x188fcb[_0x6fc7('0x49')][_0x6fc7('0x4a')]!==_0x6fc7('0x4b')){var _0x201621={};_0x201621[_0x188fcb[_0x6fc7('0x4c')]]={'$like':'%'+_0x3228d1[_0x6fc7('0x3a')]['filter']+'%'};return _0x201621;}})});}_0x11167e=_[_0x6fc7('0x47')]({},_0x11167e,_0x3228d1[_0x6fc7('0x4d')]);var _0x494380={'where':_0x11167e['where']};return db[_0x6fc7('0x4e')][_0x6fc7('0x2d')](_0x494380)[_0x6fc7('0x34')](function(_0x554a48){_0xec700a[_0x6fc7('0x2d')]=_0x554a48;if(_0x3228d1[_0x6fc7('0x3a')]['includeAll']){_0x11167e[_0x6fc7('0x4f')]=[{'all':!![]}];}return db[_0x6fc7('0x4e')][_0x6fc7('0x50')](_0x11167e);})[_0x6fc7('0x34')](function(_0x322fc4){_0xec700a[_0x6fc7('0x51')]=_0x322fc4;return _0xec700a;})[_0x6fc7('0x34')](respondWithFilteredResult(_0x5717cd,_0x11167e))[_0x6fc7('0x28')](handleError(_0x5717cd,null));};exports[_0x6fc7('0x52')]=function(_0x24df1f,_0x237c06){var _0x5e08c0={'raw':![],'where':{'id':_0x24df1f['params']['id']}},_0x4a7ce1={};_0x4a7ce1['model']=_[_0x6fc7('0x3b')](db['FreshdeskAccount'][_0x6fc7('0x53')]);_0x4a7ce1[_0x6fc7('0x3a')]=_[_0x6fc7('0x3b')](_0x24df1f[_0x6fc7('0x3a')]);_0x4a7ce1[_0x6fc7('0x3c')]=_[_0x6fc7('0x3d')](_0x4a7ce1['model'],_0x4a7ce1[_0x6fc7('0x3a')]);_0x5e08c0[_0x6fc7('0x3e')]=_['intersection'](_0x4a7ce1[_0x6fc7('0x39')],qs[_0x6fc7('0x3f')](_0x24df1f[_0x6fc7('0x3a')][_0x6fc7('0x3f')]));_0x5e08c0[_0x6fc7('0x3e')]=_0x5e08c0[_0x6fc7('0x3e')][_0x6fc7('0x40')]?_0x5e08c0[_0x6fc7('0x3e')]:_0x4a7ce1[_0x6fc7('0x39')];if(_0x24df1f[_0x6fc7('0x3a')]['includeAll']){_0x5e08c0[_0x6fc7('0x4f')]=[{'all':!![]}];}_0x5e08c0=_[_0x6fc7('0x47')]({},_0x5e08c0,_0x24df1f[_0x6fc7('0x4d')]);return db['FreshdeskAccount'][_0x6fc7('0x54')](_0x5e08c0)['then'](handleEntityNotFound(_0x237c06,null))[_0x6fc7('0x34')](respondWithResult(_0x237c06,null))['catch'](handleError(_0x237c06,null));};exports[_0x6fc7('0x55')]=function(_0xcb8dc4,_0x37e6b5){return db[_0x6fc7('0x4e')][_0x6fc7('0x55')](_0xcb8dc4[_0x6fc7('0x56')],{})[_0x6fc7('0x34')](respondWithResult(_0x37e6b5,0xc9))[_0x6fc7('0x28')](handleError(_0x37e6b5,null));};exports['update']=function(_0x273743,_0x3bcd5b){if(_0x273743[_0x6fc7('0x56')]['id']){delete _0x273743[_0x6fc7('0x56')]['id'];}return db[_0x6fc7('0x4e')]['find']({'where':{'id':_0x273743[_0x6fc7('0x57')]['id']}})[_0x6fc7('0x34')](handleEntityNotFound(_0x3bcd5b,null))[_0x6fc7('0x34')](saveUpdates(_0x273743[_0x6fc7('0x56')],null))[_0x6fc7('0x34')](respondWithResult(_0x3bcd5b,null))[_0x6fc7('0x28')](handleError(_0x3bcd5b,null));};exports[_0x6fc7('0x33')]=function(_0x43e462,_0x2975ac){return db[_0x6fc7('0x4e')][_0x6fc7('0x54')]({'where':{'id':_0x43e462['params']['id']}})[_0x6fc7('0x34')](handleEntityNotFound(_0x2975ac,null))[_0x6fc7('0x34')](removeEntity(_0x2975ac,null))[_0x6fc7('0x28')](handleError(_0x2975ac,null));};exports[_0x6fc7('0x58')]=function(_0x4006a3,_0x2d2338,_0x39ae2f){var _0x1c7a57={};var _0x4f3c1c={};var _0x6223c9;var _0x578c08;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x4006a3[_0x6fc7('0x57')]['id']}})[_0x6fc7('0x34')](handleEntityNotFound(_0x2d2338,null))[_0x6fc7('0x34')](function(_0x4a166c){if(_0x4a166c){_0x6223c9=_0x4a166c;_0x4f3c1c['model']=_[_0x6fc7('0x3b')](db['FreshdeskConfiguration'][_0x6fc7('0x53')]);_0x4f3c1c[_0x6fc7('0x3a')]=_[_0x6fc7('0x3b')](_0x4006a3[_0x6fc7('0x3a')]);_0x4f3c1c[_0x6fc7('0x3c')]=_[_0x6fc7('0x3d')](_0x4f3c1c[_0x6fc7('0x39')],_0x4f3c1c[_0x6fc7('0x3a')]);_0x1c7a57[_0x6fc7('0x3e')]=_[_0x6fc7('0x3d')](_0x4f3c1c['model'],qs[_0x6fc7('0x3f')](_0x4006a3[_0x6fc7('0x3a')]['fields']));_0x1c7a57['attributes']=_0x1c7a57['attributes'][_0x6fc7('0x40')]?_0x1c7a57[_0x6fc7('0x3e')]:_0x4f3c1c[_0x6fc7('0x39')];_0x1c7a57[_0x6fc7('0x42')]=qs[_0x6fc7('0x43')](_0x4006a3[_0x6fc7('0x3a')]['sort']);_0x1c7a57[_0x6fc7('0x44')]=qs[_0x6fc7('0x3c')](_['pick'](_0x4006a3['query'],_0x4f3c1c[_0x6fc7('0x3c')]));if(_0x4006a3[_0x6fc7('0x3a')][_0x6fc7('0x46')]){_0x1c7a57[_0x6fc7('0x44')]=_[_0x6fc7('0x47')](_0x1c7a57[_0x6fc7('0x44')],{'$or':_[_0x6fc7('0x48')](_0x1c7a57[_0x6fc7('0x3e')],function(_0x287604){var _0xbeec61={};_0xbeec61[_0x287604]={'$like':'%'+_0x4006a3['query'][_0x6fc7('0x46')]+'%'};return _0xbeec61;})});}_0x1c7a57=_[_0x6fc7('0x47')]({},_0x1c7a57,_0x4006a3[_0x6fc7('0x4d')]);return _0x6223c9['getConfigurations'](_0x1c7a57);}})['then'](function(_0x1aca2d){if(_0x1aca2d){_0x578c08=_0x1aca2d[_0x6fc7('0x40')];if(!_0x4006a3[_0x6fc7('0x3a')][_0x6fc7('0x59')](_0x6fc7('0x41'))){_0x1c7a57[_0x6fc7('0x2f')]=qs['limit'](_0x4006a3[_0x6fc7('0x3a')]['limit']);_0x1c7a57[_0x6fc7('0x2e')]=qs[_0x6fc7('0x2e')](_0x4006a3['query'][_0x6fc7('0x2e')]);}return _0x6223c9[_0x6fc7('0x58')](_0x1c7a57);}})[_0x6fc7('0x34')](function(_0x241ee0){if(_0x241ee0){return _0x241ee0?{'count':_0x578c08,'rows':_0x241ee0}:null;}})[_0x6fc7('0x34')](respondWithResult(_0x2d2338,null))[_0x6fc7('0x28')](handleError(_0x2d2338,null));};exports['addConfiguration']=function(_0x5136f6,_0x2d799d,_0x53fa59){if(_0x5136f6[_0x6fc7('0x56')]['id']){delete _0x5136f6['body']['id'];}return db[_0x6fc7('0x4e')][_0x6fc7('0x5a')]({'where':{'id':_0x5136f6[_0x6fc7('0x57')]['id']}})[_0x6fc7('0x34')](handleEntityNotFound(_0x2d799d,null))[_0x6fc7('0x34')](function(_0x472330){if(_0x472330){_0x5136f6[_0x6fc7('0x56')][_0x6fc7('0x5b')]=_0x472330['id'];_0x5136f6[_0x6fc7('0x56')][_0x6fc7('0x5c')]=integrations[_0x6fc7('0x5d')](_0x5136f6[_0x6fc7('0x56')][_0x6fc7('0x5e')],_0x5136f6['body']['type']);_0x5136f6['body']['Descriptions']=integrations[_0x6fc7('0x5f')](_0x5136f6[_0x6fc7('0x56')][_0x6fc7('0x5e')],_0x5136f6['body']['type']);return db[_0x6fc7('0x60')][_0x6fc7('0x55')](_0x5136f6['body'],{'include':[{'model':db[_0x6fc7('0x61')],'as':_0x6fc7('0x5c')},{'model':db[_0x6fc7('0x61')],'as':_0x6fc7('0x62')}]});}return null;})['then'](respondWithResult(_0x2d799d,null))[_0x6fc7('0x28')](handleError(_0x2d799d,null));};exports['getFields']=function(_0x52508f,_0xcee3db,_0x148c69){var _0x681873='';return db[_0x6fc7('0x4e')][_0x6fc7('0x5a')]({'where':{'id':_0x52508f[_0x6fc7('0x57')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x6fc7('0x34')](handleEntityNotFound(_0xcee3db,null))[_0x6fc7('0x34')](function(_0x388556){if(_0x388556){_0x681873=_0x388556[_0x6fc7('0x63')];var _0xe563cf=_0x681873['slice'](-0x1);if(_0xe563cf==='/'){_0x681873=_0x681873[_0x6fc7('0x64')](0x0,_0x681873[_0x6fc7('0x65')](_0xe563cf));}return rp({'method':_0x6fc7('0x66'),'uri':util[_0x6fc7('0x67')]('%s/%s',_0x681873,_0x6fc7('0x68')),'headers':{'Authorization':util[_0x6fc7('0x67')](_0x6fc7('0x69'),new Buffer(util['format']('%s:X',_0x388556[_0x6fc7('0x6a')]))[_0x6fc7('0x6b')](_0x6fc7('0x6c')))},'json':!![]});}})[_0x6fc7('0x34')](function(_0x2290d5){if(_0x2290d5){var _0x29c723=[_0x6fc7('0x6d'),_0x6fc7('0x6e'),_0x6fc7('0x6f'),_0x6fc7('0x70'),'status',_0x6fc7('0x71'),_0x6fc7('0x72'),'source',_0x6fc7('0x73'),_0x6fc7('0x72'),_0x6fc7('0x74')];_[_0x6fc7('0x75')](_0x2290d5,function(_0x49b0d0){return _0x29c723[_0x6fc7('0x76')](_0x49b0d0[_0x6fc7('0x36')])||!_0x49b0d0[_0x6fc7('0x77')]&&_0x49b0d0[_0x6fc7('0x49')]!=='custom_text'&&_0x49b0d0[_0x6fc7('0x49')]!==_0x6fc7('0x78');});return{'count':_0x2290d5[_0x6fc7('0x40')],'rows':_[_0x6fc7('0x48')](_0x2290d5,function(_0x326329){return{'id':_0x326329[_0x6fc7('0x36')],'name':_0x326329[_0x6fc7('0x79')],'custom':!_0x326329[_0x6fc7('0x77')],'options':_0x326329[_0x6fc7('0x7a')]?_['map'](_0x326329[_0x6fc7('0x7a')],function(_0x5a19c0){return{'name':_['capitalize'](_0x5a19c0),'value':_0x5a19c0};}):[]};})};}})[_0x6fc7('0x34')](respondWithResult(_0xcee3db,null))[_0x6fc7('0x28')](function(_0x4866c4){var _0x198316=_0x52508f[_0x6fc7('0x3a')][_0x6fc7('0x1a')]?0x1f4:_0x4866c4['statusCode']||0x1f4;logger[_0x6fc7('0x24')](_0x6fc7('0x7b'),'getFields',_0x198316,JSON[_0x6fc7('0x23')](_0x4866c4));delete _0x4866c4[_0x6fc7('0x36')];if(_0x198316===0x191){_0x198316=0x190;}_0xcee3db[_0x6fc7('0x2a')](_0x198316)[_0x6fc7('0x37')](_0x52508f['query'][_0x6fc7('0x1a')]?{'message':_0x6fc7('0x7c'),'statusCode':_0x4866c4['statusCode']}:_0x4866c4);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 98aabfa..78a4ed0 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 _0x97c4=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','int_freshdesk_accounts','lodash','util'];(function(_0x5cfa93,_0x6890b1){var _0x724a19=function(_0x16174f){while(--_0x16174f){_0x5cfa93['push'](_0x5cfa93['shift']());}};_0x724a19(++_0x6890b1);}(_0x97c4,0x9a));var _0x497c=function(_0x16a774,_0x37da8f){_0x16a774=_0x16a774-0x0;var _0x55b5b2=_0x97c4[_0x16a774];return _0x55b5b2;};'use strict';var _=require(_0x497c('0x0'));var util=require(_0x497c('0x1'));var logger=require(_0x497c('0x2'))(_0x497c('0x3'));var moment=require('moment');var BPromise=require(_0x497c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x497c('0x5'));var rimraf=require(_0x497c('0x6'));var config=require(_0x497c('0x7'));var attributes=require(_0x497c('0x8'));var integrations=require(_0x497c('0x9'));module[_0x497c('0xa')]=function(_0x535fa6,_0x17a128){return _0x535fa6['define']('FreshdeskAccount',attributes,{'tableName':_0x497c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xece0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','util','../../config/logger','api'];(function(_0x54a3a5,_0x564e1b){var _0x315f40=function(_0x34f9e4){while(--_0x34f9e4){_0x54a3a5['push'](_0x54a3a5['shift']());}};_0x315f40(++_0x564e1b);}(_0xece0,0xeb));var _0x0ece=function(_0x17a8b5,_0x2842bd){_0x17a8b5=_0x17a8b5-0x0;var _0x3c05c6=_0xece0[_0x17a8b5];return _0x3c05c6;};'use strict';var _=require('lodash');var util=require(_0x0ece('0x0'));var logger=require(_0x0ece('0x1'))(_0x0ece('0x2'));var moment=require(_0x0ece('0x3'));var BPromise=require(_0x0ece('0x4'));var rp=require(_0x0ece('0x5'));var fs=require('fs');var path=require(_0x0ece('0x6'));var rimraf=require(_0x0ece('0x7'));var config=require(_0x0ece('0x8'));var attributes=require(_0x0ece('0x9'));var integrations=require(_0x0ece('0xa'));module[_0x0ece('0xb')]=function(_0x11fdbb,_0x42551b){return _0x11fdbb[_0x0ece('0xc')](_0x0ece('0xd'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index b037b04..80666b3 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 _0xde74=['stringify','error','code','message','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','attributes','model','then','catch','find','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xe66efe,_0xfce6d0){var _0x125287=function(_0x3e00a9){while(--_0x3e00a9){_0xe66efe['push'](_0xe66efe['shift']());}};_0x125287(++_0xfce6d0);}(_0xde74,0x1e7));var _0x4de7=function(_0x25584c,_0x418181){_0x25584c=_0x25584c-0x0;var _0x48b306=_0xde74[_0x25584c];return _0x48b306;};'use strict';var _=require(_0x4de7('0x0'));var util=require(_0x4de7('0x1'));var moment=require('moment');var BPromise=require(_0x4de7('0x2'));var rs=require(_0x4de7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4de7('0x4'))['db'];var utils=require(_0x4de7('0x5'));var logger=require(_0x4de7('0x6'))('rpc');var config=require(_0x4de7('0x7'));var jayson=require(_0x4de7('0x8'));var client=jayson[_0x4de7('0x9')][_0x4de7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48ae47,_0x1e23c7,_0x300970){return new BPromise(function(_0x3c074b,_0x5586ea){return client[_0x4de7('0xb')](_0x48ae47,_0x300970)['then'](function(_0x4d82fb){logger[_0x4de7('0xc')](_0x4de7('0xd'),_0x1e23c7,_0x4de7('0xe'));logger[_0x4de7('0xf')](_0x4de7('0x10'),_0x1e23c7,_0x4de7('0xe'),JSON[_0x4de7('0x11')](_0x4d82fb));if(_0x4d82fb['error']){if(_0x4d82fb[_0x4de7('0x12')][_0x4de7('0x13')]===0x1f4){logger[_0x4de7('0x12')](_0x4de7('0xd'),_0x1e23c7,_0x4d82fb['error'][_0x4de7('0x14')]);return _0x5586ea(_0x4d82fb['error'][_0x4de7('0x14')]);}logger[_0x4de7('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x1e23c7,_0x4d82fb[_0x4de7('0x12')][_0x4de7('0x14')]);return _0x3c074b(_0x4d82fb['error']['message']);}else{logger[_0x4de7('0xc')](_0x4de7('0xd'),_0x1e23c7,_0x4de7('0xe'));_0x3c074b(_0x4d82fb['result'][_0x4de7('0x14')]);}})['catch'](function(_0xe4933b){logger['error'](_0x4de7('0xd'),_0x1e23c7,_0xe4933b);_0x5586ea(_0xe4933b);});});}exports[_0x4de7('0x15')]=function(_0x1de099){var _0x34a293=this;return new Promise(function(_0x343011,_0x33fb3b){return db[_0x4de7('0x16')][_0x4de7('0x17')]({'raw':_0x1de099[_0x4de7('0x18')]?_0x1de099[_0x4de7('0x18')][_0x4de7('0x19')]===undefined?!![]:![]:!![],'where':_0x1de099[_0x4de7('0x18')]?_0x1de099[_0x4de7('0x18')][_0x4de7('0x1a')]||null:null,'attributes':_0x1de099['options']?_0x1de099['options']['attributes']||null:null,'limit':_0x1de099[_0x4de7('0x18')]?_0x1de099[_0x4de7('0x18')][_0x4de7('0x1b')]||null:null,'include':_0x1de099[_0x4de7('0x18')]?_0x1de099['options'][_0x4de7('0x1c')]?_[_0x4de7('0x1d')](_0x1de099['options']['include'],function(_0x2d992d){return{'model':db[_0x2d992d['model']],'as':_0x2d992d['as'],'attributes':_0x2d992d[_0x4de7('0x1e')],'include':_0x2d992d[_0x4de7('0x1c')]?_[_0x4de7('0x1d')](_0x2d992d[_0x4de7('0x1c')],function(_0x1f1fca){return{'model':db[_0x1f1fca['model']],'as':_0x1f1fca['as'],'attributes':_0x1f1fca[_0x4de7('0x1e')],'include':_0x1f1fca[_0x4de7('0x1c')]?_['map'](_0x1f1fca[_0x4de7('0x1c')],function(_0x5ad61b){return{'model':db[_0x5ad61b[_0x4de7('0x1f')]],'as':_0x5ad61b['as'],'attributes':_0x5ad61b[_0x4de7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4de7('0x20')](function(_0x84d51){logger[_0x4de7('0xc')](_0x4de7('0x15'),_0x1de099);logger[_0x4de7('0xf')](_0x4de7('0x15'),_0x1de099,JSON[_0x4de7('0x11')](_0x84d51));_0x343011(_0x84d51);})[_0x4de7('0x21')](function(_0x36cea4){logger[_0x4de7('0x12')](_0x4de7('0x15'),_0x36cea4[_0x4de7('0x14')],_0x1de099);_0x33fb3b(_0x34a293[_0x4de7('0x12')](0x1f4,_0x36cea4['message']));});});};exports['ShowFreshdeskAccount']=function(_0x54d198){var _0xcee5f6=this;return new Promise(function(_0x1af714,_0x37fb55){return db[_0x4de7('0x16')][_0x4de7('0x22')]({'raw':_0x54d198[_0x4de7('0x18')]?_0x54d198[_0x4de7('0x18')][_0x4de7('0x19')]===undefined?!![]:![]:!![],'where':_0x54d198['options']?_0x54d198[_0x4de7('0x18')]['where']||null:null,'attributes':_0x54d198[_0x4de7('0x18')]?_0x54d198[_0x4de7('0x18')][_0x4de7('0x1e')]||null:null,'include':_0x54d198[_0x4de7('0x18')]?_0x54d198['options'][_0x4de7('0x1c')]?_['map'](_0x54d198[_0x4de7('0x18')][_0x4de7('0x1c')],function(_0x456d96){return{'model':db[_0x456d96['model']],'as':_0x456d96['as'],'attributes':_0x456d96[_0x4de7('0x1e')],'include':_0x456d96[_0x4de7('0x1c')]?_[_0x4de7('0x1d')](_0x456d96[_0x4de7('0x1c')],function(_0x473854){return{'model':db[_0x473854[_0x4de7('0x1f')]],'as':_0x473854['as'],'attributes':_0x473854[_0x4de7('0x1e')],'include':_0x473854[_0x4de7('0x1c')]?_['map'](_0x473854[_0x4de7('0x1c')],function(_0xbe380a){return{'model':db[_0xbe380a[_0x4de7('0x1f')]],'as':_0xbe380a['as'],'attributes':_0xbe380a[_0x4de7('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe51077){logger[_0x4de7('0xc')](_0x4de7('0x23'),_0x54d198);logger[_0x4de7('0xf')]('ShowFreshdeskAccount',_0x54d198,JSON[_0x4de7('0x11')](_0xe51077));_0x1af714(_0xe51077);})[_0x4de7('0x21')](function(_0x44ed0d){logger['error'](_0x4de7('0x23'),_0x44ed0d['message'],_0x54d198);_0x37fb55(_0xcee5f6[_0x4de7('0x12')](0x1f4,_0x44ed0d[_0x4de7('0x14')]));});});}; \ No newline at end of file +var _0x4f8c=['message','result','catch','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2490ed,_0xa4ba89){var _0x10d23b=function(_0x155bfa){while(--_0x155bfa){_0x2490ed['push'](_0x2490ed['shift']());}};_0x10d23b(++_0xa4ba89);}(_0x4f8c,0xd4));var _0xc4f8=function(_0x5e2981,_0x289c75){_0x5e2981=_0x5e2981-0x0;var _0x461f06=_0x4f8c[_0x5e2981];return _0x461f06;};'use strict';var _=require(_0xc4f8('0x0'));var util=require(_0xc4f8('0x1'));var moment=require('moment');var BPromise=require(_0xc4f8('0x2'));var rs=require(_0xc4f8('0x3'));var fs=require('fs');var Redis=require(_0xc4f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4f8('0x5'));var logger=require(_0xc4f8('0x6'))(_0xc4f8('0x7'));var config=require('../../config/environment');var jayson=require(_0xc4f8('0x8'));var client=jayson['client'][_0xc4f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8539,_0x34f6e8,_0x43a395){return new BPromise(function(_0x609dcf,_0xcbb451){return client[_0xc4f8('0xa')](_0x3f8539,_0x43a395)[_0xc4f8('0xb')](function(_0x1a25b4){logger[_0xc4f8('0xc')](_0xc4f8('0xd'),_0x34f6e8,_0xc4f8('0xe'));logger[_0xc4f8('0xf')](_0xc4f8('0x10'),_0x34f6e8,_0xc4f8('0xe'),JSON[_0xc4f8('0x11')](_0x1a25b4));if(_0x1a25b4[_0xc4f8('0x12')]){if(_0x1a25b4[_0xc4f8('0x12')]['code']===0x1f4){logger['error'](_0xc4f8('0xd'),_0x34f6e8,_0x1a25b4[_0xc4f8('0x12')]['message']);return _0xcbb451(_0x1a25b4[_0xc4f8('0x12')][_0xc4f8('0x13')]);}logger[_0xc4f8('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x34f6e8,_0x1a25b4[_0xc4f8('0x12')]['message']);return _0x609dcf(_0x1a25b4[_0xc4f8('0x12')][_0xc4f8('0x13')]);}else{logger[_0xc4f8('0xc')](_0xc4f8('0xd'),_0x34f6e8,_0xc4f8('0xe'));_0x609dcf(_0x1a25b4[_0xc4f8('0x14')]['message']);}})[_0xc4f8('0x15')](function(_0xffa8ff){logger[_0xc4f8('0x12')](_0xc4f8('0xd'),_0x34f6e8,_0xffa8ff);_0xcbb451(_0xffa8ff);});});}exports['GetFreshdeskAccount']=function(_0x3c0586){var _0x16a09a=this;return new Promise(function(_0x453da8,_0x3efc30){return db[_0xc4f8('0x16')][_0xc4f8('0x17')]({'raw':_0x3c0586[_0xc4f8('0x18')]?_0x3c0586['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c0586[_0xc4f8('0x18')]?_0x3c0586[_0xc4f8('0x18')][_0xc4f8('0x19')]||null:null,'attributes':_0x3c0586[_0xc4f8('0x18')]?_0x3c0586['options'][_0xc4f8('0x1a')]||null:null,'limit':_0x3c0586[_0xc4f8('0x18')]?_0x3c0586[_0xc4f8('0x18')][_0xc4f8('0x1b')]||null:null,'include':_0x3c0586[_0xc4f8('0x18')]?_0x3c0586[_0xc4f8('0x18')][_0xc4f8('0x1c')]?_[_0xc4f8('0x1d')](_0x3c0586[_0xc4f8('0x18')][_0xc4f8('0x1c')],function(_0x4be38d){return{'model':db[_0x4be38d[_0xc4f8('0x1e')]],'as':_0x4be38d['as'],'attributes':_0x4be38d['attributes'],'include':_0x4be38d[_0xc4f8('0x1c')]?_[_0xc4f8('0x1d')](_0x4be38d['include'],function(_0x3343be){return{'model':db[_0x3343be['model']],'as':_0x3343be['as'],'attributes':_0x3343be['attributes'],'include':_0x3343be[_0xc4f8('0x1c')]?_[_0xc4f8('0x1d')](_0x3343be[_0xc4f8('0x1c')],function(_0x43f1a8){return{'model':db[_0x43f1a8[_0xc4f8('0x1e')]],'as':_0x43f1a8['as'],'attributes':_0x43f1a8[_0xc4f8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc4f8('0xb')](function(_0x173974){logger[_0xc4f8('0xc')](_0xc4f8('0x1f'),_0x3c0586);logger['debug'](_0xc4f8('0x1f'),_0x3c0586,JSON['stringify'](_0x173974));_0x453da8(_0x173974);})[_0xc4f8('0x15')](function(_0x4dd151){logger[_0xc4f8('0x12')](_0xc4f8('0x1f'),_0x4dd151[_0xc4f8('0x13')],_0x3c0586);_0x3efc30(_0x16a09a[_0xc4f8('0x12')](0x1f4,_0x4dd151[_0xc4f8('0x13')]));});});};exports[_0xc4f8('0x20')]=function(_0x11af73){var _0x53c693=this;return new Promise(function(_0x305659,_0x48e35d){return db['FreshdeskAccount']['find']({'raw':_0x11af73[_0xc4f8('0x18')]?_0x11af73[_0xc4f8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x11af73[_0xc4f8('0x18')]?_0x11af73[_0xc4f8('0x18')][_0xc4f8('0x19')]||null:null,'attributes':_0x11af73[_0xc4f8('0x18')]?_0x11af73[_0xc4f8('0x18')][_0xc4f8('0x1a')]||null:null,'include':_0x11af73['options']?_0x11af73[_0xc4f8('0x18')]['include']?_['map'](_0x11af73[_0xc4f8('0x18')][_0xc4f8('0x1c')],function(_0x4a8f06){return{'model':db[_0x4a8f06[_0xc4f8('0x1e')]],'as':_0x4a8f06['as'],'attributes':_0x4a8f06[_0xc4f8('0x1a')],'include':_0x4a8f06[_0xc4f8('0x1c')]?_['map'](_0x4a8f06[_0xc4f8('0x1c')],function(_0x5d9acb){return{'model':db[_0x5d9acb[_0xc4f8('0x1e')]],'as':_0x5d9acb['as'],'attributes':_0x5d9acb['attributes'],'include':_0x5d9acb['include']?_[_0xc4f8('0x1d')](_0x5d9acb[_0xc4f8('0x1c')],function(_0x58d0da){return{'model':db[_0x58d0da[_0xc4f8('0x1e')]],'as':_0x58d0da['as'],'attributes':_0x58d0da[_0xc4f8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc4f8('0xb')](function(_0x44cff6){logger['info'](_0xc4f8('0x20'),_0x11af73);logger[_0xc4f8('0xf')](_0xc4f8('0x20'),_0x11af73,JSON[_0xc4f8('0x11')](_0x44cff6));_0x305659(_0x44cff6);})[_0xc4f8('0x15')](function(_0x245988){logger['error']('ShowFreshdeskAccount',_0x245988['message'],_0x11af73);_0x48e35d(_0x53c693['error'](0x1f4,_0x245988[_0xc4f8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index bb59092..09b8a67 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 _0x890c=['get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0x3582f7,_0x8d479d){var _0x580d7b=function(_0x4495f6){while(--_0x4495f6){_0x3582f7['push'](_0x3582f7['shift']());}};_0x580d7b(++_0x8d479d);}(_0x890c,0xf1));var _0xc890=function(_0x1746fc,_0x10f046){_0x1746fc=_0x1746fc-0x0;var _0x4dbd91=_0x890c[_0x1746fc];return _0x4dbd91;};'use strict';var multer=require(_0xc890('0x0'));var util=require(_0xc890('0x1'));var path=require('path');var timeout=require(_0xc890('0x2'));var express=require(_0xc890('0x3'));var router=express[_0xc890('0x4')]();var auth=require(_0xc890('0x5'));var interaction=require(_0xc890('0x6'));var config=require(_0xc890('0x7'));var controller=require(_0xc890('0x8'));router[_0xc890('0x9')]('/',auth[_0xc890('0xa')](),controller[_0xc890('0xb')]);router['get'](_0xc890('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xc890('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xc890('0x9')](_0xc890('0xe'),auth[_0xc890('0xa')](),controller[_0xc890('0xf')]);router[_0xc890('0x9')]('/:id/descriptions',auth[_0xc890('0xa')](),controller[_0xc890('0x10')]);router[_0xc890('0x9')](_0xc890('0x11'),auth[_0xc890('0xa')](),controller[_0xc890('0x12')]);router[_0xc890('0x13')]('/',auth[_0xc890('0xa')](),controller[_0xc890('0x14')]);router[_0xc890('0x13')](_0xc890('0x11'),auth[_0xc890('0xa')](),controller['setTags']);router[_0xc890('0x15')](_0xc890('0xc'),auth[_0xc890('0xa')](),controller['update']);router[_0xc890('0x16')](_0xc890('0xc'),auth[_0xc890('0xa')](),controller[_0xc890('0x17')]);module[_0xc890('0x18')]=router; \ No newline at end of file +var _0xd5cb=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','update','delete','destroy','exports'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0xd5cb,0xd8));var _0xbd5c=function(_0x3ebf9,_0x2b2a2e){_0x3ebf9=_0x3ebf9-0x0;var _0x261bd4=_0xd5cb[_0x3ebf9];return _0x261bd4;};'use strict';var multer=require(_0xbd5c('0x0'));var util=require(_0xbd5c('0x1'));var path=require(_0xbd5c('0x2'));var timeout=require(_0xbd5c('0x3'));var express=require(_0xbd5c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd5c('0x5'));var config=require(_0xbd5c('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xbd5c('0x7')]('/',auth[_0xbd5c('0x8')](),controller['index']);router[_0xbd5c('0x7')](_0xbd5c('0x9'),auth[_0xbd5c('0x8')](),controller['show']);router['get'](_0xbd5c('0xa'),auth[_0xbd5c('0x8')](),controller[_0xbd5c('0xb')]);router[_0xbd5c('0x7')](_0xbd5c('0xc'),auth[_0xbd5c('0x8')](),controller[_0xbd5c('0xd')]);router['get'](_0xbd5c('0xe'),auth['isAuthenticated'](),controller[_0xbd5c('0xf')]);router[_0xbd5c('0x7')]('/:id/tags',auth['isAuthenticated'](),controller[_0xbd5c('0x10')]);router['post']('/',auth[_0xbd5c('0x8')](),controller[_0xbd5c('0x11')]);router[_0xbd5c('0x12')](_0xbd5c('0x13'),auth[_0xbd5c('0x8')](),controller['setTags']);router['put']('/:id',auth[_0xbd5c('0x8')](),controller[_0xbd5c('0x14')]);router[_0xbd5c('0x15')](_0xbd5c('0x9'),auth[_0xbd5c('0x8')](),controller[_0xbd5c('0x16')]);module[_0xbd5c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 8022b17..b61af7b 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 _0x8402=['STRING','exports'];(function(_0x316815,_0x30505d){var _0x5e3233=function(_0x57fbd7){while(--_0x57fbd7){_0x316815['push'](_0x316815['shift']());}};_0x5e3233(++_0x30505d);}(_0x8402,0x16f));var _0x2840=function(_0x499e75,_0x4bd43c){_0x499e75=_0x499e75-0x0;var _0x3926a7=_0x8402[_0x499e75];return _0x3926a7;};'use strict';var Sequelize=require('sequelize');module[_0x2840('0x0')]={'name':{'type':Sequelize[_0x2840('0x1')]},'description':{'type':Sequelize[_0x2840('0x1')]}}; \ No newline at end of file +var _0xc697=['sequelize','STRING'];(function(_0x2a5203,_0x42834d){var _0x580809=function(_0x319619){while(--_0x319619){_0x2a5203['push'](_0x2a5203['shift']());}};_0x580809(++_0x42834d);}(_0xc697,0xdc));var _0x7c69=function(_0x5956bd,_0x4215f2){_0x5956bd=_0x5956bd-0x0;var _0x2a2a27=_0xc697[_0x5956bd];return _0x2a2a27;};'use strict';var Sequelize=require(_0x7c69('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c69('0x1')]},'description':{'type':Sequelize[_0x7c69('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 12d6888..f146929 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 _0xa520=['FreshdeskField','getSubjects','pick','map','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','apply','reject','save','update','end','stack','name','send','index','FreshdeskConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','field','options','count','includeAll','include','rows','show','params','length','find','create','body','destroy','getFields','findOne'];(function(_0x4740ce,_0x216b86){var _0x5c1d82=function(_0x149639){while(--_0x149639){_0x4740ce['push'](_0x4740ce['shift']());}};_0x5c1d82(++_0x216b86);}(_0xa520,0x6b));var _0x0a52=function(_0x12cdf3,_0x34e82e){_0x12cdf3=_0x12cdf3-0x0;var _0x4e0fd7=_0xa520[_0x12cdf3];return _0x4e0fd7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0a52('0x0'));var zipdir=require(_0x0a52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a52('0x2'));var moment=require(_0x0a52('0x3'));var BPromise=require(_0x0a52('0x4'));var Mustache=require(_0x0a52('0x5'));var util=require(_0x0a52('0x6'));var path=require(_0x0a52('0x7'));var sox=require(_0x0a52('0x8'));var csv=require(_0x0a52('0x9'));var ejs=require(_0x0a52('0xa'));var fs=require('fs');var _=require(_0x0a52('0xb'));var squel=require(_0x0a52('0xc'));var crypto=require(_0x0a52('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0a52('0xe'));var toCsv=require(_0x0a52('0x9'));var querystring=require(_0x0a52('0xf'));var Papa=require(_0x0a52('0x10'));var Redis=require(_0x0a52('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0a52('0x12'));var hardwareService=require(_0x0a52('0x13'));var logger=require(_0x0a52('0x14'))(_0x0a52('0x15'));var utils=require(_0x0a52('0x16'));var config=require('../../config/environment');var db=require(_0x0a52('0x17'))['db'];var jayson=require(_0x0a52('0x18'));var client=jayson[_0x0a52('0x19')][_0x0a52('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x26f716,_0x2e48ba,_0x44881d){if(_0x44881d){var _0x9d6dc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9d6dc['test'](_0x2e48ba)){return _0x26f716;}else{throw new db['Sequelize'][(_0x0a52('0x1b'))](_0x0a52('0x1c'));}}else{return _0x26f716;}}function respondWithRpcPromise(_0x1fe8c4,_0x560c0b,_0x279ed0,_0x3311d3){return new BPromise(function(_0x2fda49,_0x2c7016){var _0x59be14=_0x3311d3||client;return _0x59be14[_0x0a52('0x1d')](_0x1fe8c4,_0x279ed0)[_0x0a52('0x1e')](function(_0x5565ee){logger['info'](_0x0a52('0x1f'),_0x560c0b,_0x0a52('0x20'));logger[_0x0a52('0x21')](_0x0a52('0x22'),_0x560c0b,_0x0a52('0x20'),JSON[_0x0a52('0x23')](_0x5565ee));if(_0x5565ee[_0x0a52('0x24')]){if(_0x5565ee['error'][_0x0a52('0x25')]===0x1f4){logger[_0x0a52('0x24')](_0x0a52('0x1f'),_0x560c0b,_0x5565ee['error'][_0x0a52('0x26')]);return _0x2c7016(_0x5565ee[_0x0a52('0x24')][_0x0a52('0x26')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x560c0b,_0x5565ee[_0x0a52('0x24')]['message']);return _0x2fda49(_0x5565ee[_0x0a52('0x24')]['message']);}else{logger[_0x0a52('0x27')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x560c0b,_0x0a52('0x20'));_0x2fda49(_0x5565ee[_0x0a52('0x28')][_0x0a52('0x26')]);}})[_0x0a52('0x29')](function(_0x2689cf){logger[_0x0a52('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x560c0b,_0x2689cf);_0x2c7016(_0x2689cf);});});}function respondWithStatusCode(_0x33c268,_0x4babd5){_0x4babd5=_0x4babd5||0xcc;return function(_0x5ee1ae){if(_0x5ee1ae){return _0x33c268[_0x0a52('0x2a')](_0x4babd5);}return _0x33c268['status'](_0x4babd5)['end']();};}function respondWithResult(_0x33cde5,_0x3ab07b){_0x3ab07b=_0x3ab07b||0xc8;return function(_0x42c8dd){if(_0x42c8dd){return _0x33cde5[_0x0a52('0x2b')](_0x3ab07b)[_0x0a52('0x2c')](_0x42c8dd);}};}function respondWithFilteredResult(_0x135794,_0x292acd){return function(_0x50c72e){if(_0x50c72e){var _0x2312f0=_0x50c72e['count'],_0x435cfb=_0x292acd[_0x0a52('0x2d')],_0x218577=_0x292acd[_0x0a52('0x2d')]+_0x292acd['limit'],_0xa23cef;if(_0x218577>=_0x2312f0){_0x218577=_0x2312f0;_0xa23cef=0xc8;}else{_0xa23cef=0xce;}_0x135794[_0x0a52('0x2b')](_0xa23cef);return _0x135794['set']('Content-Range',_0x435cfb+'-'+_0x218577+'/'+_0x2312f0)[_0x0a52('0x2c')](_0x50c72e);}return null;};}function patchUpdates(_0x49be1d){return function(_0x7f2145){try{jsonpatch[_0x0a52('0x2e')](_0x7f2145,_0x49be1d,!![]);}catch(_0x3d4ab0){return BPromise[_0x0a52('0x2f')](_0x3d4ab0);}return _0x7f2145[_0x0a52('0x30')]();};}function saveUpdates(_0x1d4a8e,_0x420ea2){return function(_0x46d72f){if(_0x46d72f){return _0x46d72f[_0x0a52('0x31')](_0x1d4a8e)[_0x0a52('0x1e')](function(_0x5b3268){return _0x5b3268;});}return null;};}function removeEntity(_0x267b27,_0x324dd2){return function(_0x5037bf){if(_0x5037bf){return _0x5037bf['destroy']()[_0x0a52('0x1e')](function(){_0x267b27[_0x0a52('0x2b')](0xcc)[_0x0a52('0x32')]();});}};}function handleEntityNotFound(_0x78bf3d,_0x4598c1){return function(_0x35ac74){if(!_0x35ac74){_0x78bf3d[_0x0a52('0x2a')](0x194);}return _0x35ac74;};}function handleError(_0x44e1b2,_0x3d723d){_0x3d723d=_0x3d723d||0x1f4;return function(_0x2533f7){logger[_0x0a52('0x24')](_0x2533f7[_0x0a52('0x33')]);if(_0x2533f7[_0x0a52('0x34')]){delete _0x2533f7['name'];}_0x44e1b2[_0x0a52('0x2b')](_0x3d723d)[_0x0a52('0x35')](_0x2533f7);};}exports[_0x0a52('0x36')]=function(_0x4afba1,_0x19f192){var _0x2dea5a={},_0x16ebbf={},_0x30e76d={'count':0x0,'rows':[]};var _0x426d9f=db[_0x0a52('0x37')][_0x0a52('0x38')];_0x16ebbf[_0x0a52('0x39')]=_[_0x0a52('0x3a')](_0x426d9f);_0x16ebbf[_0x0a52('0x3b')]=_[_0x0a52('0x3a')](_0x4afba1[_0x0a52('0x3b')]);_0x16ebbf[_0x0a52('0x3c')]=_[_0x0a52('0x3d')](_0x16ebbf[_0x0a52('0x39')],_0x16ebbf[_0x0a52('0x3b')]);_0x2dea5a[_0x0a52('0x3e')]=_['intersection'](_0x16ebbf[_0x0a52('0x39')],qs['fields'](_0x4afba1[_0x0a52('0x3b')][_0x0a52('0x3f')]));_0x2dea5a[_0x0a52('0x3e')]=_0x2dea5a[_0x0a52('0x3e')]['length']?_0x2dea5a['attributes']:_0x16ebbf[_0x0a52('0x39')];if(!_0x4afba1['query'][_0x0a52('0x40')](_0x0a52('0x41'))){_0x2dea5a[_0x0a52('0x42')]=qs[_0x0a52('0x42')](_0x4afba1['query'][_0x0a52('0x42')]);_0x2dea5a[_0x0a52('0x2d')]=qs[_0x0a52('0x2d')](_0x4afba1[_0x0a52('0x3b')][_0x0a52('0x2d')]);}_0x2dea5a[_0x0a52('0x43')]=qs[_0x0a52('0x44')](_0x4afba1[_0x0a52('0x3b')][_0x0a52('0x44')]);_0x2dea5a['where']=qs[_0x0a52('0x3c')](_['pick'](_0x4afba1[_0x0a52('0x3b')],_0x16ebbf['filters']));if(_0x4afba1[_0x0a52('0x3b')][_0x0a52('0x45')]){_0x2dea5a[_0x0a52('0x46')]=_[_0x0a52('0x47')](_0x2dea5a[_0x0a52('0x46')],{'$or':_['map'](_0x426d9f,function(_0x5c6aa8){if(_0x5c6aa8[_0x0a52('0x48')]['key']!==_0x0a52('0x49')){var _0x488e18={};_0x488e18[_0x5c6aa8[_0x0a52('0x4a')]]={'$like':'%'+_0x4afba1[_0x0a52('0x3b')][_0x0a52('0x45')]+'%'};return _0x488e18;}})});}_0x2dea5a=_['merge']({},_0x2dea5a,_0x4afba1[_0x0a52('0x4b')]);var _0x1209e9={'where':_0x2dea5a['where']};return db[_0x0a52('0x37')]['count'](_0x1209e9)[_0x0a52('0x1e')](function(_0x56b672){_0x30e76d[_0x0a52('0x4c')]=_0x56b672;if(_0x4afba1['query'][_0x0a52('0x4d')]){_0x2dea5a[_0x0a52('0x4e')]=[{'all':!![]}];}return db[_0x0a52('0x37')]['findAll'](_0x2dea5a);})['then'](function(_0x1e513f){_0x30e76d[_0x0a52('0x4f')]=_0x1e513f;return _0x30e76d;})['then'](respondWithFilteredResult(_0x19f192,_0x2dea5a))[_0x0a52('0x29')](handleError(_0x19f192,null));};exports[_0x0a52('0x50')]=function(_0x2fe85d,_0x4db36a){var _0x132914={'raw':![],'where':{'id':_0x2fe85d[_0x0a52('0x51')]['id']}},_0x2d193c={};_0x2d193c['model']=_['keys'](db[_0x0a52('0x37')][_0x0a52('0x38')]);_0x2d193c[_0x0a52('0x3b')]=_[_0x0a52('0x3a')](_0x2fe85d[_0x0a52('0x3b')]);_0x2d193c[_0x0a52('0x3c')]=_[_0x0a52('0x3d')](_0x2d193c[_0x0a52('0x39')],_0x2d193c[_0x0a52('0x3b')]);_0x132914[_0x0a52('0x3e')]=_['intersection'](_0x2d193c[_0x0a52('0x39')],qs[_0x0a52('0x3f')](_0x2fe85d[_0x0a52('0x3b')][_0x0a52('0x3f')]));_0x132914[_0x0a52('0x3e')]=_0x132914[_0x0a52('0x3e')][_0x0a52('0x52')]?_0x132914['attributes']:_0x2d193c['model'];if(_0x2fe85d['query'][_0x0a52('0x4d')]){_0x132914['include']=[{'all':!![]}];}_0x132914=_[_0x0a52('0x47')]({},_0x132914,_0x2fe85d[_0x0a52('0x4b')]);return db['FreshdeskConfiguration'][_0x0a52('0x53')](_0x132914)[_0x0a52('0x1e')](handleEntityNotFound(_0x4db36a,null))[_0x0a52('0x1e')](respondWithResult(_0x4db36a,null))[_0x0a52('0x29')](handleError(_0x4db36a,null));};exports[_0x0a52('0x54')]=function(_0x570fc4,_0x5392a3){return db['FreshdeskConfiguration']['create'](_0x570fc4['body'],{})['then'](respondWithResult(_0x5392a3,0xc9))[_0x0a52('0x29')](handleError(_0x5392a3,null));};exports[_0x0a52('0x31')]=function(_0x295bfe,_0x38fb99){if(_0x295bfe[_0x0a52('0x55')]['id']){delete _0x295bfe[_0x0a52('0x55')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x295bfe[_0x0a52('0x51')]['id']}})[_0x0a52('0x1e')](handleEntityNotFound(_0x38fb99,null))[_0x0a52('0x1e')](saveUpdates(_0x295bfe['body'],null))[_0x0a52('0x1e')](respondWithResult(_0x38fb99,null))['catch'](handleError(_0x38fb99,null));};exports[_0x0a52('0x56')]=function(_0x3c0d37,_0x2a924c){return db[_0x0a52('0x37')][_0x0a52('0x53')]({'where':{'id':_0x3c0d37[_0x0a52('0x51')]['id']}})[_0x0a52('0x1e')](handleEntityNotFound(_0x2a924c,null))[_0x0a52('0x1e')](removeEntity(_0x2a924c,null))[_0x0a52('0x29')](handleError(_0x2a924c,null));};exports[_0x0a52('0x57')]=function(_0x4b7623,_0x380edb,_0x595129){var _0x5e8a12={};var _0x5c5345={};var _0x22fb2d;var _0x3a3b4f;return db['FreshdeskConfiguration'][_0x0a52('0x58')]({'where':{'id':_0x4b7623['params']['id']}})[_0x0a52('0x1e')](handleEntityNotFound(_0x380edb,null))[_0x0a52('0x1e')](function(_0xe36a78){if(_0xe36a78){_0x22fb2d=_0xe36a78;_0x5c5345[_0x0a52('0x39')]=_['keys'](db[_0x0a52('0x59')][_0x0a52('0x38')]);_0x5c5345[_0x0a52('0x3b')]=_['keys'](_0x4b7623[_0x0a52('0x3b')]);_0x5c5345[_0x0a52('0x3c')]=_[_0x0a52('0x3d')](_0x5c5345[_0x0a52('0x39')],_0x5c5345[_0x0a52('0x3b')]);_0x5e8a12[_0x0a52('0x3e')]=_[_0x0a52('0x3d')](_0x5c5345[_0x0a52('0x39')],qs[_0x0a52('0x3f')](_0x4b7623[_0x0a52('0x3b')]['fields']));_0x5e8a12['attributes']=_0x5e8a12['attributes'][_0x0a52('0x52')]?_0x5e8a12[_0x0a52('0x3e')]:_0x5c5345['model'];_0x5e8a12[_0x0a52('0x43')]=qs[_0x0a52('0x44')](_0x4b7623[_0x0a52('0x3b')][_0x0a52('0x44')]);_0x5e8a12[_0x0a52('0x46')]=qs[_0x0a52('0x3c')](_['pick'](_0x4b7623[_0x0a52('0x3b')],_0x5c5345['filters']));if(_0x4b7623[_0x0a52('0x3b')]['filter']){_0x5e8a12[_0x0a52('0x46')]=_[_0x0a52('0x47')](_0x5e8a12[_0x0a52('0x46')],{'$or':_['map'](_0x5e8a12[_0x0a52('0x3e')],function(_0x28def6){var _0x292d44={};_0x292d44[_0x28def6]={'$like':'%'+_0x4b7623['query'][_0x0a52('0x45')]+'%'};return _0x292d44;})});}_0x5e8a12=_[_0x0a52('0x47')]({},_0x5e8a12,_0x4b7623['options']);return _0x22fb2d['getFields'](_0x5e8a12);}})[_0x0a52('0x1e')](function(_0x50c0aa){if(_0x50c0aa){_0x3a3b4f=_0x50c0aa[_0x0a52('0x52')];if(!_0x4b7623[_0x0a52('0x3b')][_0x0a52('0x40')](_0x0a52('0x41'))){_0x5e8a12[_0x0a52('0x42')]=qs['limit'](_0x4b7623[_0x0a52('0x3b')][_0x0a52('0x42')]);_0x5e8a12[_0x0a52('0x2d')]=qs[_0x0a52('0x2d')](_0x4b7623[_0x0a52('0x3b')]['offset']);}return _0x22fb2d[_0x0a52('0x57')](_0x5e8a12);}})['then'](function(_0x452b13){if(_0x452b13){return _0x452b13?{'count':_0x3a3b4f,'rows':_0x452b13}:null;}})[_0x0a52('0x1e')](respondWithResult(_0x380edb,null))['catch'](handleError(_0x380edb,null));};exports[_0x0a52('0x5a')]=function(_0x171f01,_0x2859eb,_0x158f5b){var _0x121050={};var _0x5741ff={};var _0x13897f;var _0x3ce5db;return db[_0x0a52('0x37')][_0x0a52('0x58')]({'where':{'id':_0x171f01[_0x0a52('0x51')]['id']}})['then'](handleEntityNotFound(_0x2859eb,null))[_0x0a52('0x1e')](function(_0x258e86){if(_0x258e86){_0x13897f=_0x258e86;_0x5741ff[_0x0a52('0x39')]=_[_0x0a52('0x3a')](db[_0x0a52('0x59')][_0x0a52('0x38')]);_0x5741ff[_0x0a52('0x3b')]=_[_0x0a52('0x3a')](_0x171f01['query']);_0x5741ff['filters']=_[_0x0a52('0x3d')](_0x5741ff[_0x0a52('0x39')],_0x5741ff['query']);_0x121050[_0x0a52('0x3e')]=_[_0x0a52('0x3d')](_0x5741ff[_0x0a52('0x39')],qs[_0x0a52('0x3f')](_0x171f01[_0x0a52('0x3b')][_0x0a52('0x3f')]));_0x121050[_0x0a52('0x3e')]=_0x121050[_0x0a52('0x3e')]['length']?_0x121050['attributes']:_0x5741ff[_0x0a52('0x39')];_0x121050[_0x0a52('0x43')]=qs[_0x0a52('0x44')](_0x171f01[_0x0a52('0x3b')][_0x0a52('0x44')]);_0x121050[_0x0a52('0x46')]=qs[_0x0a52('0x3c')](_[_0x0a52('0x5b')](_0x171f01['query'],_0x5741ff[_0x0a52('0x3c')]));if(_0x171f01[_0x0a52('0x3b')][_0x0a52('0x45')]){_0x121050[_0x0a52('0x46')]=_[_0x0a52('0x47')](_0x121050[_0x0a52('0x46')],{'$or':_[_0x0a52('0x5c')](_0x121050[_0x0a52('0x3e')],function(_0x407a6e){var _0x944898={};_0x944898[_0x407a6e]={'$like':'%'+_0x171f01['query'][_0x0a52('0x45')]+'%'};return _0x944898;})});}_0x121050=_[_0x0a52('0x47')]({},_0x121050,_0x171f01[_0x0a52('0x4b')]);return _0x13897f[_0x0a52('0x5a')](_0x121050);}})[_0x0a52('0x1e')](function(_0x2ba44f){if(_0x2ba44f){_0x3ce5db=_0x2ba44f[_0x0a52('0x52')];if(!_0x171f01[_0x0a52('0x3b')][_0x0a52('0x40')](_0x0a52('0x41'))){_0x121050[_0x0a52('0x42')]=qs['limit'](_0x171f01[_0x0a52('0x3b')]['limit']);_0x121050[_0x0a52('0x2d')]=qs[_0x0a52('0x2d')](_0x171f01[_0x0a52('0x3b')]['offset']);}return _0x13897f[_0x0a52('0x5a')](_0x121050);}})[_0x0a52('0x1e')](function(_0x1d6b85){if(_0x1d6b85){return _0x1d6b85?{'count':_0x3ce5db,'rows':_0x1d6b85}:null;}})[_0x0a52('0x1e')](respondWithResult(_0x2859eb,null))[_0x0a52('0x29')](handleError(_0x2859eb,null));};exports[_0x0a52('0x5d')]=function(_0xffb346,_0x5683a,_0x21aadb){var _0x4f3066={};var _0x22cf2a={};var _0x31831d;var _0x1a9707;return db[_0x0a52('0x37')]['findOne']({'where':{'id':_0xffb346[_0x0a52('0x51')]['id']}})[_0x0a52('0x1e')](handleEntityNotFound(_0x5683a,null))[_0x0a52('0x1e')](function(_0x914311){if(_0x914311){_0x31831d=_0x914311;_0x22cf2a['model']=_[_0x0a52('0x3a')](db['FreshdeskField'][_0x0a52('0x38')]);_0x22cf2a[_0x0a52('0x3b')]=_[_0x0a52('0x3a')](_0xffb346['query']);_0x22cf2a[_0x0a52('0x3c')]=_[_0x0a52('0x3d')](_0x22cf2a[_0x0a52('0x39')],_0x22cf2a[_0x0a52('0x3b')]);_0x4f3066['attributes']=_[_0x0a52('0x3d')](_0x22cf2a[_0x0a52('0x39')],qs[_0x0a52('0x3f')](_0xffb346[_0x0a52('0x3b')]['fields']));_0x4f3066[_0x0a52('0x3e')]=_0x4f3066[_0x0a52('0x3e')]['length']?_0x4f3066[_0x0a52('0x3e')]:_0x22cf2a[_0x0a52('0x39')];_0x4f3066[_0x0a52('0x43')]=qs[_0x0a52('0x44')](_0xffb346[_0x0a52('0x3b')][_0x0a52('0x44')]);_0x4f3066['where']=qs[_0x0a52('0x3c')](_['pick'](_0xffb346['query'],_0x22cf2a[_0x0a52('0x3c')]));if(_0xffb346[_0x0a52('0x3b')][_0x0a52('0x45')]){_0x4f3066['where']=_['merge'](_0x4f3066['where'],{'$or':_[_0x0a52('0x5c')](_0x4f3066[_0x0a52('0x3e')],function(_0x2de9d4){var _0x2f9376={};_0x2f9376[_0x2de9d4]={'$like':'%'+_0xffb346[_0x0a52('0x3b')][_0x0a52('0x45')]+'%'};return _0x2f9376;})});}_0x4f3066=_['merge']({},_0x4f3066,_0xffb346[_0x0a52('0x4b')]);return _0x31831d['getDescriptions'](_0x4f3066);}})[_0x0a52('0x1e')](function(_0x20feb2){if(_0x20feb2){_0x1a9707=_0x20feb2['length'];if(!_0xffb346[_0x0a52('0x3b')][_0x0a52('0x40')](_0x0a52('0x41'))){_0x4f3066[_0x0a52('0x42')]=qs[_0x0a52('0x42')](_0xffb346[_0x0a52('0x3b')]['limit']);_0x4f3066[_0x0a52('0x2d')]=qs[_0x0a52('0x2d')](_0xffb346[_0x0a52('0x3b')]['offset']);}return _0x31831d[_0x0a52('0x5d')](_0x4f3066);}})[_0x0a52('0x1e')](function(_0x463392){if(_0x463392){return _0x463392?{'count':_0x1a9707,'rows':_0x463392}:null;}})[_0x0a52('0x1e')](respondWithResult(_0x5683a,null))[_0x0a52('0x29')](handleError(_0x5683a,null));};exports[_0x0a52('0x5e')]=function(_0x2d790a,_0x1cd68a,_0x2680d8){var _0x13eb1e={};var _0x8d09c5={};var _0x192a9f;var _0x2fb26b;return db[_0x0a52('0x37')][_0x0a52('0x58')]({'where':{'id':_0x2d790a['params']['id']}})[_0x0a52('0x1e')](handleEntityNotFound(_0x1cd68a,null))[_0x0a52('0x1e')](function(_0x48b00f){if(_0x48b00f){_0x192a9f=_0x48b00f;_0x8d09c5[_0x0a52('0x39')]=_[_0x0a52('0x3a')](db[_0x0a52('0x5f')][_0x0a52('0x38')]);_0x8d09c5[_0x0a52('0x3b')]=_[_0x0a52('0x3a')](_0x2d790a['query']);_0x8d09c5[_0x0a52('0x3c')]=_[_0x0a52('0x3d')](_0x8d09c5[_0x0a52('0x39')],_0x8d09c5[_0x0a52('0x3b')]);_0x13eb1e[_0x0a52('0x3e')]=_['intersection'](_0x8d09c5[_0x0a52('0x39')],qs['fields'](_0x2d790a['query'][_0x0a52('0x3f')]));_0x13eb1e[_0x0a52('0x3e')]=_0x13eb1e[_0x0a52('0x3e')][_0x0a52('0x52')]?_0x13eb1e[_0x0a52('0x3e')]:_0x8d09c5['model'];_0x13eb1e[_0x0a52('0x43')]=qs[_0x0a52('0x44')](_0x2d790a[_0x0a52('0x3b')]['sort']);_0x13eb1e['where']=qs[_0x0a52('0x3c')](_[_0x0a52('0x5b')](_0x2d790a[_0x0a52('0x3b')],_0x8d09c5[_0x0a52('0x3c')]));if(_0x2d790a[_0x0a52('0x3b')][_0x0a52('0x45')]){_0x13eb1e['where']=_['merge'](_0x13eb1e[_0x0a52('0x46')],{'$or':_[_0x0a52('0x5c')](_0x13eb1e[_0x0a52('0x3e')],function(_0x40903a){var _0x401780={};_0x401780[_0x40903a]={'$like':'%'+_0x2d790a['query'][_0x0a52('0x45')]+'%'};return _0x401780;})});}_0x13eb1e=_[_0x0a52('0x47')]({},_0x13eb1e,_0x2d790a[_0x0a52('0x4b')]);return _0x192a9f['getTags'](_0x13eb1e);}})[_0x0a52('0x1e')](function(_0x391e1a){if(_0x391e1a){_0x2fb26b=_0x391e1a[_0x0a52('0x52')];if(!_0x2d790a['query']['hasOwnProperty']('nolimit')){_0x13eb1e[_0x0a52('0x42')]=qs['limit'](_0x2d790a[_0x0a52('0x3b')][_0x0a52('0x42')]);_0x13eb1e[_0x0a52('0x2d')]=qs[_0x0a52('0x2d')](_0x2d790a['query'][_0x0a52('0x2d')]);}return _0x192a9f['getTags'](_0x13eb1e);}})[_0x0a52('0x1e')](function(_0x1ef6f3){if(_0x1ef6f3){return _0x1ef6f3?{'count':_0x2fb26b,'rows':_0x1ef6f3}:null;}})[_0x0a52('0x1e')](respondWithResult(_0x1cd68a,null))['catch'](handleError(_0x1cd68a,null));};exports[_0x0a52('0x60')]=function(_0x13d297,_0x24c6c9,_0x328956){if(_0x13d297[_0x0a52('0x55')]['id']){delete _0x13d297['body']['id'];}return db[_0x0a52('0x37')][_0x0a52('0x58')]({'where':{'id':_0x13d297['params']['id']}})[_0x0a52('0x1e')](handleEntityNotFound(_0x24c6c9,null))[_0x0a52('0x1e')](function(_0x584f02){if(_0x584f02){return _0x584f02[_0x0a52('0x60')](_0x13d297['body'][_0x0a52('0x61')]||[]);}return null;})[_0x0a52('0x1e')](respondWithResult(_0x24c6c9,null))[_0x0a52('0x29')](handleError(_0x24c6c9,null));}; \ No newline at end of file +var _0xb031=['nolimit','limit','order','sort','where','pick','merge','map','key','VIRTUAL','field','filter','options','FreshdeskConfiguration','includeAll','include','findAll','show','params','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','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~!@#$%^&-_=+[{]}.','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','rawAttributes','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty'];(function(_0x4d13b1,_0x448b7e){var _0x295625=function(_0x516fbf){while(--_0x516fbf){_0x4d13b1['push'](_0x4d13b1['shift']());}};_0x295625(++_0x448b7e);}(_0xb031,0x192));var _0x1b03=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xb031[_0x38537f];return _0x141e23;};'use strict';var pdf=require(_0x1b03('0x0'));var emlformat=require(_0x1b03('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1b03('0x2'));var rp=require(_0x1b03('0x3'));var moment=require(_0x1b03('0x4'));var BPromise=require(_0x1b03('0x5'));var Mustache=require(_0x1b03('0x6'));var util=require('util');var path=require(_0x1b03('0x7'));var sox=require(_0x1b03('0x8'));var csv=require(_0x1b03('0x9'));var ejs=require(_0x1b03('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b03('0xb'));var crypto=require(_0x1b03('0xc'));var jsforce=require(_0x1b03('0xd'));var deskjs=require(_0x1b03('0xe'));var toCsv=require(_0x1b03('0x9'));var querystring=require(_0x1b03('0xf'));var Papa=require(_0x1b03('0x10'));var Redis=require('ioredis');var authService=require(_0x1b03('0x11'));var qs=require(_0x1b03('0x12'));var hardwareService=require(_0x1b03('0x13'));var logger=require(_0x1b03('0x14'))('api');var utils=require(_0x1b03('0x15'));var config=require('../../config/environment');var db=require(_0x1b03('0x16'))['db'];var jayson=require(_0x1b03('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x527601,_0xc7afc,_0xf157f6){if(_0xf157f6){var _0x2e0fe2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e0fe2[_0x1b03('0x18')](_0xc7afc)){return _0x527601;}else{throw new db[(_0x1b03('0x19'))]['ValidationError'](_0x1b03('0x1a'));}}else{return _0x527601;}}function respondWithRpcPromise(_0x301622,_0x1f086a,_0x46d9c0,_0x102fda){return new BPromise(function(_0x38ee7c,_0x526f67){var _0x51541c=_0x102fda||client;return _0x51541c['request'](_0x301622,_0x46d9c0)['then'](function(_0x2291a7){logger[_0x1b03('0x1b')](_0x1b03('0x1c'),_0x1f086a,_0x1b03('0x1d'));logger[_0x1b03('0x1e')](_0x1b03('0x1f'),_0x1f086a,_0x1b03('0x1d'),JSON['stringify'](_0x2291a7));if(_0x2291a7['error']){if(_0x2291a7[_0x1b03('0x20')][_0x1b03('0x21')]===0x1f4){logger['error'](_0x1b03('0x1c'),_0x1f086a,_0x2291a7[_0x1b03('0x20')]['message']);return _0x526f67(_0x2291a7[_0x1b03('0x20')][_0x1b03('0x22')]);}logger[_0x1b03('0x20')](_0x1b03('0x1c'),_0x1f086a,_0x2291a7[_0x1b03('0x20')][_0x1b03('0x22')]);return _0x38ee7c(_0x2291a7[_0x1b03('0x20')][_0x1b03('0x22')]);}else{logger[_0x1b03('0x1b')](_0x1b03('0x1c'),_0x1f086a,_0x1b03('0x1d'));_0x38ee7c(_0x2291a7[_0x1b03('0x23')][_0x1b03('0x22')]);}})[_0x1b03('0x24')](function(_0x4546de){logger[_0x1b03('0x20')](_0x1b03('0x1c'),_0x1f086a,_0x4546de);_0x526f67(_0x4546de);});});}function respondWithStatusCode(_0x3b81bf,_0xc787f8){_0xc787f8=_0xc787f8||0xcc;return function(_0x42a5dd){if(_0x42a5dd){return _0x3b81bf[_0x1b03('0x25')](_0xc787f8);}return _0x3b81bf['status'](_0xc787f8)[_0x1b03('0x26')]();};}function respondWithResult(_0x1d3e14,_0x2ecace){_0x2ecace=_0x2ecace||0xc8;return function(_0xde8361){if(_0xde8361){return _0x1d3e14[_0x1b03('0x27')](_0x2ecace)[_0x1b03('0x28')](_0xde8361);}};}function respondWithFilteredResult(_0x1165e2,_0xae3c04){return function(_0x310be0){if(_0x310be0){var _0x1568c0=_0x310be0[_0x1b03('0x29')],_0x10d352=_0xae3c04[_0x1b03('0x2a')],_0x55f392=_0xae3c04[_0x1b03('0x2a')]+_0xae3c04['limit'],_0x56486e;if(_0x55f392>=_0x1568c0){_0x55f392=_0x1568c0;_0x56486e=0xc8;}else{_0x56486e=0xce;}_0x1165e2[_0x1b03('0x27')](_0x56486e);return _0x1165e2['set'](_0x1b03('0x2b'),_0x10d352+'-'+_0x55f392+'/'+_0x1568c0)[_0x1b03('0x28')](_0x310be0);}return null;};}function patchUpdates(_0x12671e){return function(_0x437264){try{jsonpatch[_0x1b03('0x2c')](_0x437264,_0x12671e,!![]);}catch(_0x2ff0cd){return BPromise[_0x1b03('0x2d')](_0x2ff0cd);}return _0x437264[_0x1b03('0x2e')]();};}function saveUpdates(_0xf95611,_0x1c2b0b){return function(_0x1df8af){if(_0x1df8af){return _0x1df8af[_0x1b03('0x2f')](_0xf95611)['then'](function(_0x542b58){return _0x542b58;});}return null;};}function removeEntity(_0x4d472c,_0x5a6ad9){return function(_0x4b81b8){if(_0x4b81b8){return _0x4b81b8[_0x1b03('0x30')]()[_0x1b03('0x31')](function(){_0x4d472c[_0x1b03('0x27')](0xcc)[_0x1b03('0x26')]();});}};}function handleEntityNotFound(_0x157686,_0x3a2633){return function(_0x30fc2d){if(!_0x30fc2d){_0x157686[_0x1b03('0x25')](0x194);}return _0x30fc2d;};}function handleError(_0x2f890d,_0x302c38){_0x302c38=_0x302c38||0x1f4;return function(_0x2523d8){logger[_0x1b03('0x20')](_0x2523d8[_0x1b03('0x32')]);if(_0x2523d8[_0x1b03('0x33')]){delete _0x2523d8[_0x1b03('0x33')];}_0x2f890d[_0x1b03('0x27')](_0x302c38)['send'](_0x2523d8);};}exports[_0x1b03('0x34')]=function(_0x20a320,_0x54e79a){var _0x2b8df9={},_0x3e0bea={},_0x4e545c={'count':0x0,'rows':[]};var _0x295224=db['FreshdeskConfiguration'][_0x1b03('0x35')];_0x3e0bea['model']=_[_0x1b03('0x36')](_0x295224);_0x3e0bea[_0x1b03('0x37')]=_[_0x1b03('0x36')](_0x20a320[_0x1b03('0x37')]);_0x3e0bea[_0x1b03('0x38')]=_[_0x1b03('0x39')](_0x3e0bea['model'],_0x3e0bea[_0x1b03('0x37')]);_0x2b8df9[_0x1b03('0x3a')]=_['intersection'](_0x3e0bea['model'],qs[_0x1b03('0x3b')](_0x20a320[_0x1b03('0x37')][_0x1b03('0x3b')]));_0x2b8df9[_0x1b03('0x3a')]=_0x2b8df9['attributes'][_0x1b03('0x3c')]?_0x2b8df9[_0x1b03('0x3a')]:_0x3e0bea[_0x1b03('0x3d')];if(!_0x20a320[_0x1b03('0x37')][_0x1b03('0x3e')](_0x1b03('0x3f'))){_0x2b8df9['limit']=qs[_0x1b03('0x40')](_0x20a320['query']['limit']);_0x2b8df9[_0x1b03('0x2a')]=qs[_0x1b03('0x2a')](_0x20a320['query']['offset']);}_0x2b8df9[_0x1b03('0x41')]=qs[_0x1b03('0x42')](_0x20a320[_0x1b03('0x37')][_0x1b03('0x42')]);_0x2b8df9[_0x1b03('0x43')]=qs[_0x1b03('0x38')](_[_0x1b03('0x44')](_0x20a320['query'],_0x3e0bea['filters']));if(_0x20a320[_0x1b03('0x37')]['filter']){_0x2b8df9[_0x1b03('0x43')]=_[_0x1b03('0x45')](_0x2b8df9[_0x1b03('0x43')],{'$or':_[_0x1b03('0x46')](_0x295224,function(_0x2ff5e7){if(_0x2ff5e7['type'][_0x1b03('0x47')]!==_0x1b03('0x48')){var _0x299576={};_0x299576[_0x2ff5e7[_0x1b03('0x49')]]={'$like':'%'+_0x20a320[_0x1b03('0x37')][_0x1b03('0x4a')]+'%'};return _0x299576;}})});}_0x2b8df9=_[_0x1b03('0x45')]({},_0x2b8df9,_0x20a320[_0x1b03('0x4b')]);var _0x313e79={'where':_0x2b8df9[_0x1b03('0x43')]};return db[_0x1b03('0x4c')]['count'](_0x313e79)[_0x1b03('0x31')](function(_0x2dd263){_0x4e545c[_0x1b03('0x29')]=_0x2dd263;if(_0x20a320['query'][_0x1b03('0x4d')]){_0x2b8df9[_0x1b03('0x4e')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x1b03('0x4f')](_0x2b8df9);})[_0x1b03('0x31')](function(_0x55228f){_0x4e545c['rows']=_0x55228f;return _0x4e545c;})[_0x1b03('0x31')](respondWithFilteredResult(_0x54e79a,_0x2b8df9))[_0x1b03('0x24')](handleError(_0x54e79a,null));};exports[_0x1b03('0x50')]=function(_0x53bcc6,_0x1e9699){var _0x47396e={'raw':![],'where':{'id':_0x53bcc6[_0x1b03('0x51')]['id']}},_0x1afae0={};_0x1afae0['model']=_['keys'](db[_0x1b03('0x4c')]['rawAttributes']);_0x1afae0[_0x1b03('0x37')]=_[_0x1b03('0x36')](_0x53bcc6[_0x1b03('0x37')]);_0x1afae0['filters']=_[_0x1b03('0x39')](_0x1afae0[_0x1b03('0x3d')],_0x1afae0['query']);_0x47396e[_0x1b03('0x3a')]=_[_0x1b03('0x39')](_0x1afae0[_0x1b03('0x3d')],qs[_0x1b03('0x3b')](_0x53bcc6['query']['fields']));_0x47396e[_0x1b03('0x3a')]=_0x47396e['attributes'][_0x1b03('0x3c')]?_0x47396e['attributes']:_0x1afae0[_0x1b03('0x3d')];if(_0x53bcc6[_0x1b03('0x37')]['includeAll']){_0x47396e[_0x1b03('0x4e')]=[{'all':!![]}];}_0x47396e=_[_0x1b03('0x45')]({},_0x47396e,_0x53bcc6[_0x1b03('0x4b')]);return db['FreshdeskConfiguration'][_0x1b03('0x52')](_0x47396e)[_0x1b03('0x31')](handleEntityNotFound(_0x1e9699,null))['then'](respondWithResult(_0x1e9699,null))['catch'](handleError(_0x1e9699,null));};exports['create']=function(_0x25ccb6,_0x33d663){return db[_0x1b03('0x4c')][_0x1b03('0x53')](_0x25ccb6[_0x1b03('0x54')],{})[_0x1b03('0x31')](respondWithResult(_0x33d663,0xc9))[_0x1b03('0x24')](handleError(_0x33d663,null));};exports[_0x1b03('0x2f')]=function(_0x391f70,_0x1aea8a){if(_0x391f70[_0x1b03('0x54')]['id']){delete _0x391f70[_0x1b03('0x54')]['id'];}return db['FreshdeskConfiguration'][_0x1b03('0x52')]({'where':{'id':_0x391f70['params']['id']}})[_0x1b03('0x31')](handleEntityNotFound(_0x1aea8a,null))[_0x1b03('0x31')](saveUpdates(_0x391f70[_0x1b03('0x54')],null))[_0x1b03('0x31')](respondWithResult(_0x1aea8a,null))[_0x1b03('0x24')](handleError(_0x1aea8a,null));};exports[_0x1b03('0x30')]=function(_0x53c226,_0x2eb9b8){return db[_0x1b03('0x4c')][_0x1b03('0x52')]({'where':{'id':_0x53c226[_0x1b03('0x51')]['id']}})['then'](handleEntityNotFound(_0x2eb9b8,null))[_0x1b03('0x31')](removeEntity(_0x2eb9b8,null))['catch'](handleError(_0x2eb9b8,null));};exports[_0x1b03('0x55')]=function(_0xa90143,_0x23d5d0,_0x507aae){var _0x33ff2c={};var _0x10351c={};var _0x2eed81;var _0x46672a;return db['FreshdeskConfiguration'][_0x1b03('0x56')]({'where':{'id':_0xa90143[_0x1b03('0x51')]['id']}})[_0x1b03('0x31')](handleEntityNotFound(_0x23d5d0,null))[_0x1b03('0x31')](function(_0x3984d3){if(_0x3984d3){_0x2eed81=_0x3984d3;_0x10351c['model']=_[_0x1b03('0x36')](db[_0x1b03('0x57')]['rawAttributes']);_0x10351c[_0x1b03('0x37')]=_[_0x1b03('0x36')](_0xa90143[_0x1b03('0x37')]);_0x10351c[_0x1b03('0x38')]=_[_0x1b03('0x39')](_0x10351c[_0x1b03('0x3d')],_0x10351c[_0x1b03('0x37')]);_0x33ff2c['attributes']=_[_0x1b03('0x39')](_0x10351c[_0x1b03('0x3d')],qs['fields'](_0xa90143[_0x1b03('0x37')][_0x1b03('0x3b')]));_0x33ff2c[_0x1b03('0x3a')]=_0x33ff2c[_0x1b03('0x3a')]['length']?_0x33ff2c['attributes']:_0x10351c[_0x1b03('0x3d')];_0x33ff2c['order']=qs[_0x1b03('0x42')](_0xa90143[_0x1b03('0x37')][_0x1b03('0x42')]);_0x33ff2c[_0x1b03('0x43')]=qs[_0x1b03('0x38')](_['pick'](_0xa90143[_0x1b03('0x37')],_0x10351c['filters']));if(_0xa90143[_0x1b03('0x37')][_0x1b03('0x4a')]){_0x33ff2c[_0x1b03('0x43')]=_[_0x1b03('0x45')](_0x33ff2c[_0x1b03('0x43')],{'$or':_['map'](_0x33ff2c[_0x1b03('0x3a')],function(_0x109224){var _0x69c2b={};_0x69c2b[_0x109224]={'$like':'%'+_0xa90143[_0x1b03('0x37')][_0x1b03('0x4a')]+'%'};return _0x69c2b;})});}_0x33ff2c=_['merge']({},_0x33ff2c,_0xa90143[_0x1b03('0x4b')]);return _0x2eed81[_0x1b03('0x55')](_0x33ff2c);}})[_0x1b03('0x31')](function(_0x5d8a6b){if(_0x5d8a6b){_0x46672a=_0x5d8a6b['length'];if(!_0xa90143['query'][_0x1b03('0x3e')]('nolimit')){_0x33ff2c[_0x1b03('0x40')]=qs['limit'](_0xa90143[_0x1b03('0x37')][_0x1b03('0x40')]);_0x33ff2c[_0x1b03('0x2a')]=qs[_0x1b03('0x2a')](_0xa90143[_0x1b03('0x37')][_0x1b03('0x2a')]);}return _0x2eed81[_0x1b03('0x55')](_0x33ff2c);}})[_0x1b03('0x31')](function(_0x5da819){if(_0x5da819){return _0x5da819?{'count':_0x46672a,'rows':_0x5da819}:null;}})[_0x1b03('0x31')](respondWithResult(_0x23d5d0,null))['catch'](handleError(_0x23d5d0,null));};exports[_0x1b03('0x58')]=function(_0x1da879,_0x44be2c,_0x353431){var _0x58e689={};var _0x1105f0={};var _0xa1da9d;var _0x3b4f27;return db['FreshdeskConfiguration'][_0x1b03('0x56')]({'where':{'id':_0x1da879[_0x1b03('0x51')]['id']}})['then'](handleEntityNotFound(_0x44be2c,null))['then'](function(_0x96a41b){if(_0x96a41b){_0xa1da9d=_0x96a41b;_0x1105f0[_0x1b03('0x3d')]=_[_0x1b03('0x36')](db[_0x1b03('0x57')]['rawAttributes']);_0x1105f0['query']=_['keys'](_0x1da879[_0x1b03('0x37')]);_0x1105f0[_0x1b03('0x38')]=_[_0x1b03('0x39')](_0x1105f0[_0x1b03('0x3d')],_0x1105f0[_0x1b03('0x37')]);_0x58e689[_0x1b03('0x3a')]=_[_0x1b03('0x39')](_0x1105f0['model'],qs[_0x1b03('0x3b')](_0x1da879[_0x1b03('0x37')][_0x1b03('0x3b')]));_0x58e689[_0x1b03('0x3a')]=_0x58e689[_0x1b03('0x3a')][_0x1b03('0x3c')]?_0x58e689[_0x1b03('0x3a')]:_0x1105f0[_0x1b03('0x3d')];_0x58e689[_0x1b03('0x41')]=qs[_0x1b03('0x42')](_0x1da879[_0x1b03('0x37')][_0x1b03('0x42')]);_0x58e689[_0x1b03('0x43')]=qs[_0x1b03('0x38')](_[_0x1b03('0x44')](_0x1da879[_0x1b03('0x37')],_0x1105f0[_0x1b03('0x38')]));if(_0x1da879[_0x1b03('0x37')]['filter']){_0x58e689['where']=_['merge'](_0x58e689[_0x1b03('0x43')],{'$or':_[_0x1b03('0x46')](_0x58e689[_0x1b03('0x3a')],function(_0x5b3aaa){var _0x418775={};_0x418775[_0x5b3aaa]={'$like':'%'+_0x1da879[_0x1b03('0x37')][_0x1b03('0x4a')]+'%'};return _0x418775;})});}_0x58e689=_[_0x1b03('0x45')]({},_0x58e689,_0x1da879['options']);return _0xa1da9d[_0x1b03('0x58')](_0x58e689);}})[_0x1b03('0x31')](function(_0x3472d7){if(_0x3472d7){_0x3b4f27=_0x3472d7[_0x1b03('0x3c')];if(!_0x1da879[_0x1b03('0x37')]['hasOwnProperty'](_0x1b03('0x3f'))){_0x58e689[_0x1b03('0x40')]=qs[_0x1b03('0x40')](_0x1da879[_0x1b03('0x37')][_0x1b03('0x40')]);_0x58e689[_0x1b03('0x2a')]=qs[_0x1b03('0x2a')](_0x1da879[_0x1b03('0x37')][_0x1b03('0x2a')]);}return _0xa1da9d[_0x1b03('0x58')](_0x58e689);}})[_0x1b03('0x31')](function(_0x559061){if(_0x559061){return _0x559061?{'count':_0x3b4f27,'rows':_0x559061}:null;}})['then'](respondWithResult(_0x44be2c,null))[_0x1b03('0x24')](handleError(_0x44be2c,null));};exports[_0x1b03('0x59')]=function(_0x3adb96,_0x292b55,_0x97a110){var _0x2f88e8={};var _0x15d891={};var _0x3563d7;var _0x2b8d51;return db[_0x1b03('0x4c')][_0x1b03('0x56')]({'where':{'id':_0x3adb96[_0x1b03('0x51')]['id']}})[_0x1b03('0x31')](handleEntityNotFound(_0x292b55,null))[_0x1b03('0x31')](function(_0x2ad270){if(_0x2ad270){_0x3563d7=_0x2ad270;_0x15d891['model']=_[_0x1b03('0x36')](db[_0x1b03('0x57')][_0x1b03('0x35')]);_0x15d891[_0x1b03('0x37')]=_[_0x1b03('0x36')](_0x3adb96['query']);_0x15d891[_0x1b03('0x38')]=_[_0x1b03('0x39')](_0x15d891[_0x1b03('0x3d')],_0x15d891['query']);_0x2f88e8[_0x1b03('0x3a')]=_[_0x1b03('0x39')](_0x15d891[_0x1b03('0x3d')],qs['fields'](_0x3adb96[_0x1b03('0x37')][_0x1b03('0x3b')]));_0x2f88e8['attributes']=_0x2f88e8['attributes'][_0x1b03('0x3c')]?_0x2f88e8[_0x1b03('0x3a')]:_0x15d891[_0x1b03('0x3d')];_0x2f88e8[_0x1b03('0x41')]=qs[_0x1b03('0x42')](_0x3adb96['query'][_0x1b03('0x42')]);_0x2f88e8[_0x1b03('0x43')]=qs[_0x1b03('0x38')](_[_0x1b03('0x44')](_0x3adb96[_0x1b03('0x37')],_0x15d891['filters']));if(_0x3adb96[_0x1b03('0x37')]['filter']){_0x2f88e8[_0x1b03('0x43')]=_[_0x1b03('0x45')](_0x2f88e8[_0x1b03('0x43')],{'$or':_[_0x1b03('0x46')](_0x2f88e8[_0x1b03('0x3a')],function(_0x3a8788){var _0x21b84a={};_0x21b84a[_0x3a8788]={'$like':'%'+_0x3adb96[_0x1b03('0x37')]['filter']+'%'};return _0x21b84a;})});}_0x2f88e8=_[_0x1b03('0x45')]({},_0x2f88e8,_0x3adb96[_0x1b03('0x4b')]);return _0x3563d7[_0x1b03('0x59')](_0x2f88e8);}})[_0x1b03('0x31')](function(_0x4156c4){if(_0x4156c4){_0x2b8d51=_0x4156c4[_0x1b03('0x3c')];if(!_0x3adb96[_0x1b03('0x37')][_0x1b03('0x3e')](_0x1b03('0x3f'))){_0x2f88e8[_0x1b03('0x40')]=qs[_0x1b03('0x40')](_0x3adb96[_0x1b03('0x37')][_0x1b03('0x40')]);_0x2f88e8['offset']=qs['offset'](_0x3adb96[_0x1b03('0x37')][_0x1b03('0x2a')]);}return _0x3563d7['getDescriptions'](_0x2f88e8);}})[_0x1b03('0x31')](function(_0x19b029){if(_0x19b029){return _0x19b029?{'count':_0x2b8d51,'rows':_0x19b029}:null;}})[_0x1b03('0x31')](respondWithResult(_0x292b55,null))[_0x1b03('0x24')](handleError(_0x292b55,null));};exports['getTags']=function(_0x6120c3,_0x16a0a6,_0x1f13e1){var _0x4c9929={};var _0x587988={};var _0x2c0135;var _0x47f558;return db[_0x1b03('0x4c')]['findOne']({'where':{'id':_0x6120c3[_0x1b03('0x51')]['id']}})[_0x1b03('0x31')](handleEntityNotFound(_0x16a0a6,null))[_0x1b03('0x31')](function(_0x1d1d25){if(_0x1d1d25){_0x2c0135=_0x1d1d25;_0x587988[_0x1b03('0x3d')]=_['keys'](db['Tag'][_0x1b03('0x35')]);_0x587988[_0x1b03('0x37')]=_[_0x1b03('0x36')](_0x6120c3['query']);_0x587988[_0x1b03('0x38')]=_[_0x1b03('0x39')](_0x587988[_0x1b03('0x3d')],_0x587988[_0x1b03('0x37')]);_0x4c9929['attributes']=_[_0x1b03('0x39')](_0x587988[_0x1b03('0x3d')],qs[_0x1b03('0x3b')](_0x6120c3[_0x1b03('0x37')][_0x1b03('0x3b')]));_0x4c9929[_0x1b03('0x3a')]=_0x4c9929[_0x1b03('0x3a')][_0x1b03('0x3c')]?_0x4c9929[_0x1b03('0x3a')]:_0x587988['model'];_0x4c9929[_0x1b03('0x41')]=qs[_0x1b03('0x42')](_0x6120c3[_0x1b03('0x37')][_0x1b03('0x42')]);_0x4c9929['where']=qs[_0x1b03('0x38')](_[_0x1b03('0x44')](_0x6120c3[_0x1b03('0x37')],_0x587988[_0x1b03('0x38')]));if(_0x6120c3[_0x1b03('0x37')][_0x1b03('0x4a')]){_0x4c9929[_0x1b03('0x43')]=_['merge'](_0x4c9929[_0x1b03('0x43')],{'$or':_[_0x1b03('0x46')](_0x4c9929[_0x1b03('0x3a')],function(_0x11da7e){var _0xfafbe7={};_0xfafbe7[_0x11da7e]={'$like':'%'+_0x6120c3[_0x1b03('0x37')][_0x1b03('0x4a')]+'%'};return _0xfafbe7;})});}_0x4c9929=_[_0x1b03('0x45')]({},_0x4c9929,_0x6120c3[_0x1b03('0x4b')]);return _0x2c0135[_0x1b03('0x5a')](_0x4c9929);}})[_0x1b03('0x31')](function(_0xa24141){if(_0xa24141){_0x47f558=_0xa24141[_0x1b03('0x3c')];if(!_0x6120c3[_0x1b03('0x37')][_0x1b03('0x3e')](_0x1b03('0x3f'))){_0x4c9929[_0x1b03('0x40')]=qs['limit'](_0x6120c3[_0x1b03('0x37')][_0x1b03('0x40')]);_0x4c9929[_0x1b03('0x2a')]=qs[_0x1b03('0x2a')](_0x6120c3['query']['offset']);}return _0x2c0135[_0x1b03('0x5a')](_0x4c9929);}})['then'](function(_0x121eeb){if(_0x121eeb){return _0x121eeb?{'count':_0x47f558,'rows':_0x121eeb}:null;}})['then'](respondWithResult(_0x16a0a6,null))[_0x1b03('0x24')](handleError(_0x16a0a6,null));};exports[_0x1b03('0x5b')]=function(_0x4d069e,_0x482bad,_0x3d39c5){if(_0x4d069e[_0x1b03('0x54')]['id']){delete _0x4d069e[_0x1b03('0x54')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4d069e['params']['id']}})[_0x1b03('0x31')](handleEntityNotFound(_0x482bad,null))[_0x1b03('0x31')](function(_0xd2b5cc){if(_0xd2b5cc){return _0xd2b5cc[_0x1b03('0x5b')](_0x4d069e['body'][_0x1b03('0x5c')]||[]);}return null;})[_0x1b03('0x31')](respondWithResult(_0x482bad,null))[_0x1b03('0x24')](handleError(_0x482bad,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 301b7ff..89f7a0d 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 _0xc78d=['api','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','../../config/logger'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc78d,0x76));var _0xdc78=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc78d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xdc78('0x0'));var util=require('util');var logger=require(_0xdc78('0x1'))(_0xdc78('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdc78('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc78('0x4'));var config=require(_0xdc78('0x5'));var attributes=require(_0xdc78('0x6'));module[_0xdc78('0x7')]=function(_0x1ae505,_0xef8883){return _0x1ae505[_0xdc78('0x8')](_0xdc78('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cab=['request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','moment','bluebird'];(function(_0x54f603,_0x27a0b6){var _0x4452b6=function(_0x34661a){while(--_0x34661a){_0x54f603['push'](_0x54f603['shift']());}};_0x4452b6(++_0x27a0b6);}(_0x1cab,0x1ac));var _0xb1ca=function(_0x4edd88,_0x57266b){_0x4edd88=_0x4edd88-0x0;var _0x5f35c7=_0x1cab[_0x4edd88];return _0x5f35c7;};'use strict';var _=require(_0xb1ca('0x0'));var util=require('util');var logger=require(_0xb1ca('0x1'))('api');var moment=require(_0xb1ca('0x2'));var BPromise=require(_0xb1ca('0x3'));var rp=require(_0xb1ca('0x4'));var fs=require('fs');var path=require(_0xb1ca('0x5'));var rimraf=require('rimraf');var config=require(_0xb1ca('0x6'));var attributes=require(_0xb1ca('0x7'));module[_0xb1ca('0x8')]=function(_0x41c1fb,_0x4f8692){return _0x41c1fb[_0xb1ca('0x9')](_0xb1ca('0xa'),attributes,{'tableName':_0xb1ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 83d0b19..133f75a 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 _0x6675=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x6675,0x86));var _0x5667=function(_0x40810c,_0x254b72){_0x40810c=_0x40810c-0x0;var _0x42c00b=_0x6675[_0x40810c];return _0x42c00b;};'use strict';var _=require(_0x5667('0x0'));var util=require(_0x5667('0x1'));var moment=require(_0x5667('0x2'));var BPromise=require(_0x5667('0x3'));var rs=require(_0x5667('0x4'));var fs=require('fs');var Redis=require(_0x5667('0x5'));var db=require(_0x5667('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5667('0x7'));var config=require(_0x5667('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5667('0x9')][_0x5667('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ccb27,_0x42f39c,_0x1ec212){return new BPromise(function(_0x24b378,_0x4a16e5){return client[_0x5667('0xb')](_0x2ccb27,_0x1ec212)['then'](function(_0x31f260){logger[_0x5667('0xc')](_0x5667('0xd'),_0x42f39c,_0x5667('0xe'));logger[_0x5667('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x42f39c,_0x5667('0xe'),JSON['stringify'](_0x31f260));if(_0x31f260[_0x5667('0x10')]){if(_0x31f260[_0x5667('0x10')][_0x5667('0x11')]===0x1f4){logger[_0x5667('0x10')](_0x5667('0xd'),_0x42f39c,_0x31f260[_0x5667('0x10')][_0x5667('0x12')]);return _0x4a16e5(_0x31f260[_0x5667('0x10')][_0x5667('0x12')]);}logger[_0x5667('0x10')](_0x5667('0xd'),_0x42f39c,_0x31f260[_0x5667('0x10')][_0x5667('0x12')]);return _0x24b378(_0x31f260['error'][_0x5667('0x12')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x42f39c,_0x5667('0xe'));_0x24b378(_0x31f260[_0x5667('0x13')][_0x5667('0x12')]);}})[_0x5667('0x14')](function(_0xb5148e){logger[_0x5667('0x10')](_0x5667('0xd'),_0x42f39c,_0xb5148e);_0x4a16e5(_0xb5148e);});});} \ No newline at end of file +var _0xc15c=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xc15c,0x12a));var _0xcc15=function(_0x486d9d,_0x104e67){_0x486d9d=_0x486d9d-0x0;var _0xa9d427=_0xc15c[_0x486d9d];return _0xa9d427;};'use strict';var _=require(_0xcc15('0x0'));var util=require(_0xcc15('0x1'));var moment=require(_0xcc15('0x2'));var BPromise=require(_0xcc15('0x3'));var rs=require(_0xcc15('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc15('0x5'))['db'];var utils=require(_0xcc15('0x6'));var logger=require('../../config/logger')(_0xcc15('0x7'));var config=require(_0xcc15('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc15('0x9')][_0xcc15('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20094f,_0x14da0e,_0x492cfb){return new BPromise(function(_0x2699e6,_0x404890){return client[_0xcc15('0xb')](_0x20094f,_0x492cfb)[_0xcc15('0xc')](function(_0x4711bb){logger[_0xcc15('0xd')](_0xcc15('0xe'),_0x14da0e,_0xcc15('0xf'));logger['debug'](_0xcc15('0x10'),_0x14da0e,'request\x20sent',JSON[_0xcc15('0x11')](_0x4711bb));if(_0x4711bb[_0xcc15('0x12')]){if(_0x4711bb['error']['code']===0x1f4){logger[_0xcc15('0x12')](_0xcc15('0xe'),_0x14da0e,_0x4711bb['error'][_0xcc15('0x13')]);return _0x404890(_0x4711bb[_0xcc15('0x12')][_0xcc15('0x13')]);}logger[_0xcc15('0x12')](_0xcc15('0xe'),_0x14da0e,_0x4711bb[_0xcc15('0x12')][_0xcc15('0x13')]);return _0x2699e6(_0x4711bb['error']['message']);}else{logger[_0xcc15('0xd')](_0xcc15('0xe'),_0x14da0e,'request\x20sent');_0x2699e6(_0x4711bb[_0xcc15('0x14')][_0xcc15('0x13')]);}})[_0xcc15('0x15')](function(_0x328320){logger[_0xcc15('0x12')](_0xcc15('0xe'),_0x14da0e,_0x328320);_0x404890(_0x328320);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 822ce65..6c35b32 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(_0x54ccb6,_0x890e7c){var _0x37f3d7=function(_0x581f0e){while(--_0x581f0e){_0x54ccb6['push'](_0x54ccb6['shift']());}};_0x37f3d7(++_0x890e7c);}(_0x008c,0x188));var _0xc008=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x008c[_0x43941d];return _0x27b82a;};'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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x3dbba5,_0x3070c3){var _0x224fd0=function(_0x231f7b){while(--_0x231f7b){_0x3dbba5['push'](_0x3dbba5['shift']());}};_0x224fd0(++_0x3070c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 8adfd39..37161f9 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 _0x1c88=['string','variable','STRING','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x14282b,_0x36d885){var _0x41fe5b=function(_0xf78409){while(--_0xf78409){_0x14282b['push'](_0x14282b['shift']());}};_0x41fe5b(++_0x36d885);}(_0x1c88,0x1a9));var _0x81c8=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0x1c88[_0x508c10];return _0x3108b5;};'use strict';var Sequelize=require(_0x81c8('0x0'));module['exports']={'type':{'type':Sequelize[_0x81c8('0x1')](_0x81c8('0x2'),_0x81c8('0x3'),'customVariable','keyValue'),'defaultValue':_0x81c8('0x2')},'content':{'type':Sequelize[_0x81c8('0x4')]},'key':{'type':Sequelize[_0x81c8('0x4')]},'keyType':{'type':Sequelize[_0x81c8('0x1')](_0x81c8('0x2'),_0x81c8('0x3'),_0x81c8('0x5'))},'keyContent':{'type':Sequelize[_0x81c8('0x4')]},'idField':{'type':Sequelize[_0x81c8('0x4')]},'nameField':{'type':Sequelize[_0x81c8('0x4')]},'customField':{'type':Sequelize[_0x81c8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x81c8('0x4')]}}; \ No newline at end of file +var _0x665c=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xa75329,_0x58eb4b){var _0x291d8e=function(_0x1bc634){while(--_0x1bc634){_0xa75329['push'](_0xa75329['shift']());}};_0x291d8e(++_0x58eb4b);}(_0x665c,0x1a9));var _0xc665=function(_0x1669c3,_0x2c4626){_0x1669c3=_0x1669c3-0x0;var _0x327df0=_0x665c[_0x1669c3];return _0x327df0;};'use strict';var Sequelize=require(_0xc665('0x0'));module[_0xc665('0x1')]={'type':{'type':Sequelize[_0xc665('0x2')](_0xc665('0x3'),_0xc665('0x4'),_0xc665('0x5'),_0xc665('0x6')),'defaultValue':_0xc665('0x3')},'content':{'type':Sequelize[_0xc665('0x7')]},'key':{'type':Sequelize[_0xc665('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xc665('0x5'))},'keyContent':{'type':Sequelize[_0xc665('0x7')]},'idField':{'type':Sequelize[_0xc665('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc665('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index ab158e7..48f6bce 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 _0x88f4=['moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','key','VIRTUAL','field','options','FreshdeskField','includeAll','include','findAll','catch','params','length','find','create','update','body','eml-format','rimraf','fast-json-patch'];(function(_0x21233e,_0x2d39c1){var _0x3752c9=function(_0x1201f3){while(--_0x1201f3){_0x21233e['push'](_0x21233e['shift']());}};_0x3752c9(++_0x2d39c1);}(_0x88f4,0x87));var _0x488f=function(_0x3cf8ef,_0x532abb){_0x3cf8ef=_0x3cf8ef-0x0;var _0x477f37=_0x88f4[_0x3cf8ef];return _0x477f37;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x488f('0x0'));var rimraf=require(_0x488f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x488f('0x2'));var rp=require('request-promise');var moment=require(_0x488f('0x3'));var BPromise=require(_0x488f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x488f('0x5'));var csv=require(_0x488f('0x6'));var ejs=require(_0x488f('0x7'));var fs=require('fs');var _=require(_0x488f('0x8'));var squel=require(_0x488f('0x9'));var crypto=require(_0x488f('0xa'));var jsforce=require(_0x488f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x488f('0x6'));var querystring=require(_0x488f('0xc'));var Papa=require(_0x488f('0xd'));var Redis=require('ioredis');var authService=require(_0x488f('0xe'));var qs=require(_0x488f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x488f('0x10'));var utils=require(_0x488f('0x11'));var config=require(_0x488f('0x12'));var db=require(_0x488f('0x13'))['db'];function respondWithStatusCode(_0x1c255e,_0x5e3d3c){_0x5e3d3c=_0x5e3d3c||0xcc;return function(_0x844981){if(_0x844981){return _0x1c255e[_0x488f('0x14')](_0x5e3d3c);}return _0x1c255e[_0x488f('0x15')](_0x5e3d3c)[_0x488f('0x16')]();};}function respondWithResult(_0x1675c9,_0x5d463b){_0x5d463b=_0x5d463b||0xc8;return function(_0x5a8b04){if(_0x5a8b04){return _0x1675c9[_0x488f('0x15')](_0x5d463b)[_0x488f('0x17')](_0x5a8b04);}};}function respondWithFilteredResult(_0x1384e9,_0x56d37e){return function(_0x5440e1){if(_0x5440e1){var _0x32fb57=_0x5440e1[_0x488f('0x18')],_0x2bc6af=_0x56d37e[_0x488f('0x19')],_0x149f0e=_0x56d37e[_0x488f('0x19')]+_0x56d37e[_0x488f('0x1a')],_0x1ca031;if(_0x149f0e>=_0x32fb57){_0x149f0e=_0x32fb57;_0x1ca031=0xc8;}else{_0x1ca031=0xce;}_0x1384e9[_0x488f('0x15')](_0x1ca031);return _0x1384e9[_0x488f('0x1b')]('Content-Range',_0x2bc6af+'-'+_0x149f0e+'/'+_0x32fb57)[_0x488f('0x17')](_0x5440e1);}return null;};}function patchUpdates(_0x303aa6){return function(_0x458c11){try{jsonpatch['apply'](_0x458c11,_0x303aa6,!![]);}catch(_0x29c7c5){return BPromise[_0x488f('0x1c')](_0x29c7c5);}return _0x458c11[_0x488f('0x1d')]();};}function saveUpdates(_0x145c43,_0x3e00be){return function(_0x4ceff2){if(_0x4ceff2){return _0x4ceff2['update'](_0x145c43)['then'](function(_0x134748){return _0x134748;});}return null;};}function removeEntity(_0xf9138a,_0x19a87f){return function(_0x2025b9){if(_0x2025b9){return _0x2025b9[_0x488f('0x1e')]()[_0x488f('0x1f')](function(){_0xf9138a[_0x488f('0x15')](0xcc)[_0x488f('0x16')]();});}};}function handleEntityNotFound(_0x1dc114,_0x11843d){return function(_0x3c2524){if(!_0x3c2524){_0x1dc114[_0x488f('0x14')](0x194);}return _0x3c2524;};}function handleError(_0x224a59,_0x59bbc3){_0x59bbc3=_0x59bbc3||0x1f4;return function(_0x36d609){logger[_0x488f('0x20')](_0x36d609[_0x488f('0x21')]);if(_0x36d609[_0x488f('0x22')]){delete _0x36d609[_0x488f('0x22')];}_0x224a59['status'](_0x59bbc3)[_0x488f('0x23')](_0x36d609);};}exports[_0x488f('0x24')]=function(_0x13e802,_0x4325b3){var _0x3642e2={},_0x3068df={},_0x370cf8={'count':0x0,'rows':[]};var _0x412ce5=db['FreshdeskField'][_0x488f('0x25')];_0x3068df[_0x488f('0x26')]=_[_0x488f('0x27')](_0x412ce5);_0x3068df[_0x488f('0x28')]=_['keys'](_0x13e802[_0x488f('0x28')]);_0x3068df['filters']=_['intersection'](_0x3068df[_0x488f('0x26')],_0x3068df[_0x488f('0x28')]);_0x3642e2[_0x488f('0x29')]=_[_0x488f('0x2a')](_0x3068df['model'],qs[_0x488f('0x2b')](_0x13e802[_0x488f('0x28')][_0x488f('0x2b')]));_0x3642e2[_0x488f('0x29')]=_0x3642e2['attributes']['length']?_0x3642e2[_0x488f('0x29')]:_0x3068df[_0x488f('0x26')];if(!_0x13e802['query'][_0x488f('0x2c')](_0x488f('0x2d'))){_0x3642e2[_0x488f('0x1a')]=qs[_0x488f('0x1a')](_0x13e802[_0x488f('0x28')][_0x488f('0x1a')]);_0x3642e2[_0x488f('0x19')]=qs['offset'](_0x13e802['query'][_0x488f('0x19')]);}_0x3642e2[_0x488f('0x2e')]=qs[_0x488f('0x2f')](_0x13e802['query'][_0x488f('0x2f')]);_0x3642e2[_0x488f('0x30')]=qs[_0x488f('0x31')](_[_0x488f('0x32')](_0x13e802[_0x488f('0x28')],_0x3068df[_0x488f('0x31')]));if(_0x13e802[_0x488f('0x28')][_0x488f('0x33')]){_0x3642e2[_0x488f('0x30')]=_[_0x488f('0x34')](_0x3642e2[_0x488f('0x30')],{'$or':_[_0x488f('0x35')](_0x412ce5,function(_0x2fcfcb){if(_0x2fcfcb['type'][_0x488f('0x36')]!==_0x488f('0x37')){var _0x51963c={};_0x51963c[_0x2fcfcb[_0x488f('0x38')]]={'$like':'%'+_0x13e802['query'][_0x488f('0x33')]+'%'};return _0x51963c;}})});}_0x3642e2=_[_0x488f('0x34')]({},_0x3642e2,_0x13e802[_0x488f('0x39')]);var _0x57dc75={'where':_0x3642e2[_0x488f('0x30')]};return db[_0x488f('0x3a')][_0x488f('0x18')](_0x57dc75)[_0x488f('0x1f')](function(_0x3cd3bc){_0x370cf8[_0x488f('0x18')]=_0x3cd3bc;if(_0x13e802[_0x488f('0x28')][_0x488f('0x3b')]){_0x3642e2[_0x488f('0x3c')]=[{'all':!![]}];}return db[_0x488f('0x3a')][_0x488f('0x3d')](_0x3642e2);})[_0x488f('0x1f')](function(_0x24fe93){_0x370cf8['rows']=_0x24fe93;return _0x370cf8;})['then'](respondWithFilteredResult(_0x4325b3,_0x3642e2))[_0x488f('0x3e')](handleError(_0x4325b3,null));};exports['show']=function(_0x576be9,_0x238beb){var _0x247429={'raw':!![],'where':{'id':_0x576be9[_0x488f('0x3f')]['id']}},_0x50067f={};_0x50067f['model']=_['keys'](db[_0x488f('0x3a')][_0x488f('0x25')]);_0x50067f[_0x488f('0x28')]=_[_0x488f('0x27')](_0x576be9[_0x488f('0x28')]);_0x50067f[_0x488f('0x31')]=_['intersection'](_0x50067f[_0x488f('0x26')],_0x50067f[_0x488f('0x28')]);_0x247429[_0x488f('0x29')]=_[_0x488f('0x2a')](_0x50067f[_0x488f('0x26')],qs['fields'](_0x576be9[_0x488f('0x28')][_0x488f('0x2b')]));_0x247429[_0x488f('0x29')]=_0x247429[_0x488f('0x29')][_0x488f('0x40')]?_0x247429[_0x488f('0x29')]:_0x50067f['model'];if(_0x576be9[_0x488f('0x28')][_0x488f('0x3b')]){_0x247429[_0x488f('0x3c')]=[{'all':!![]}];}_0x247429=_['merge']({},_0x247429,_0x576be9[_0x488f('0x39')]);return db[_0x488f('0x3a')][_0x488f('0x41')](_0x247429)['then'](handleEntityNotFound(_0x238beb,null))['then'](respondWithResult(_0x238beb,null))[_0x488f('0x3e')](handleError(_0x238beb,null));};exports['create']=function(_0x1f497b,_0x4ee100){return db['FreshdeskField'][_0x488f('0x42')](_0x1f497b['body'],{})[_0x488f('0x1f')](respondWithResult(_0x4ee100,0xc9))[_0x488f('0x3e')](handleError(_0x4ee100,null));};exports[_0x488f('0x43')]=function(_0x2b8393,_0x2b6f6a){if(_0x2b8393[_0x488f('0x44')]['id']){delete _0x2b8393[_0x488f('0x44')]['id'];}return db[_0x488f('0x3a')][_0x488f('0x41')]({'where':{'id':_0x2b8393[_0x488f('0x3f')]['id']}})[_0x488f('0x1f')](handleEntityNotFound(_0x2b6f6a,null))[_0x488f('0x1f')](saveUpdates(_0x2b8393['body'],null))[_0x488f('0x1f')](respondWithResult(_0x2b6f6a,null))['catch'](handleError(_0x2b6f6a,null));};exports[_0x488f('0x1e')]=function(_0x2f4cf8,_0x367c90){return db[_0x488f('0x3a')][_0x488f('0x41')]({'where':{'id':_0x2f4cf8['params']['id']}})['then'](handleEntityNotFound(_0x367c90,null))[_0x488f('0x1f')](removeEntity(_0x367c90,null))[_0x488f('0x3e')](handleError(_0x367c90,null));}; \ No newline at end of file +var _0x205b=['set','Content-Range','apply','then','destroy','error','stack','name','send','FreshdeskField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','includeAll','create','body','update','find','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x1c0c36,_0x19a8c5){var _0x32cd88=function(_0x396803){while(--_0x396803){_0x1c0c36['push'](_0x1c0c36['shift']());}};_0x32cd88(++_0x19a8c5);}(_0x205b,0x14a));var _0xb205=function(_0x46ddfa,_0x2583c1){_0x46ddfa=_0x46ddfa-0x0;var _0x21dc9f=_0x205b[_0x46ddfa];return _0x21dc9f;};'use strict';var pdf=require(_0xb205('0x0'));var emlformat=require(_0xb205('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb205('0x2'));var rp=require(_0xb205('0x3'));var moment=require(_0xb205('0x4'));var BPromise=require(_0xb205('0x5'));var Mustache=require(_0xb205('0x6'));var util=require(_0xb205('0x7'));var path=require(_0xb205('0x8'));var sox=require(_0xb205('0x9'));var csv=require(_0xb205('0xa'));var ejs=require(_0xb205('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb205('0xc'));var jsforce=require(_0xb205('0xd'));var deskjs=require(_0xb205('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb205('0xf'));var Papa=require(_0xb205('0x10'));var Redis=require(_0xb205('0x11'));var authService=require(_0xb205('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb205('0x13'))(_0xb205('0x14'));var utils=require('../../config/utils');var config=require(_0xb205('0x15'));var db=require(_0xb205('0x16'))['db'];function respondWithStatusCode(_0x35796d,_0x255c12){_0x255c12=_0x255c12||0xcc;return function(_0x266bb8){if(_0x266bb8){return _0x35796d[_0xb205('0x17')](_0x255c12);}return _0x35796d[_0xb205('0x18')](_0x255c12)[_0xb205('0x19')]();};}function respondWithResult(_0x19f823,_0x8976bb){_0x8976bb=_0x8976bb||0xc8;return function(_0x3856e6){if(_0x3856e6){return _0x19f823[_0xb205('0x18')](_0x8976bb)[_0xb205('0x1a')](_0x3856e6);}};}function respondWithFilteredResult(_0x3b68e6,_0x5512cd){return function(_0x49df0d){if(_0x49df0d){var _0x41ad54=_0x49df0d[_0xb205('0x1b')],_0x253a0e=_0x5512cd[_0xb205('0x1c')],_0x2b627c=_0x5512cd[_0xb205('0x1c')]+_0x5512cd[_0xb205('0x1d')],_0x325b8c;if(_0x2b627c>=_0x41ad54){_0x2b627c=_0x41ad54;_0x325b8c=0xc8;}else{_0x325b8c=0xce;}_0x3b68e6[_0xb205('0x18')](_0x325b8c);return _0x3b68e6[_0xb205('0x1e')](_0xb205('0x1f'),_0x253a0e+'-'+_0x2b627c+'/'+_0x41ad54)[_0xb205('0x1a')](_0x49df0d);}return null;};}function patchUpdates(_0x4a7d23){return function(_0x4a608d){try{jsonpatch[_0xb205('0x20')](_0x4a608d,_0x4a7d23,!![]);}catch(_0x3e1928){return BPromise['reject'](_0x3e1928);}return _0x4a608d['save']();};}function saveUpdates(_0x342ccd,_0x39f338){return function(_0x15ce9a){if(_0x15ce9a){return _0x15ce9a['update'](_0x342ccd)[_0xb205('0x21')](function(_0x507995){return _0x507995;});}return null;};}function removeEntity(_0x4be63d,_0x3ad784){return function(_0x188c86){if(_0x188c86){return _0x188c86[_0xb205('0x22')]()[_0xb205('0x21')](function(){_0x4be63d[_0xb205('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1aaf8,_0x330059){return function(_0x7d900d){if(!_0x7d900d){_0xf1aaf8[_0xb205('0x17')](0x194);}return _0x7d900d;};}function handleError(_0x37e92d,_0x22d3a6){_0x22d3a6=_0x22d3a6||0x1f4;return function(_0x54fe85){logger[_0xb205('0x23')](_0x54fe85[_0xb205('0x24')]);if(_0x54fe85[_0xb205('0x25')]){delete _0x54fe85[_0xb205('0x25')];}_0x37e92d['status'](_0x22d3a6)[_0xb205('0x26')](_0x54fe85);};}exports['index']=function(_0x23e5cf,_0x3f4bf5){var _0x300230={},_0x452981={},_0xc268fd={'count':0x0,'rows':[]};var _0x57db83=db[_0xb205('0x27')][_0xb205('0x28')];_0x452981[_0xb205('0x29')]=_[_0xb205('0x2a')](_0x57db83);_0x452981[_0xb205('0x2b')]=_['keys'](_0x23e5cf[_0xb205('0x2b')]);_0x452981[_0xb205('0x2c')]=_[_0xb205('0x2d')](_0x452981[_0xb205('0x29')],_0x452981[_0xb205('0x2b')]);_0x300230[_0xb205('0x2e')]=_[_0xb205('0x2d')](_0x452981[_0xb205('0x29')],qs['fields'](_0x23e5cf[_0xb205('0x2b')][_0xb205('0x2f')]));_0x300230[_0xb205('0x2e')]=_0x300230['attributes'][_0xb205('0x30')]?_0x300230[_0xb205('0x2e')]:_0x452981[_0xb205('0x29')];if(!_0x23e5cf[_0xb205('0x2b')][_0xb205('0x31')](_0xb205('0x32'))){_0x300230[_0xb205('0x1d')]=qs['limit'](_0x23e5cf[_0xb205('0x2b')]['limit']);_0x300230[_0xb205('0x1c')]=qs[_0xb205('0x1c')](_0x23e5cf[_0xb205('0x2b')]['offset']);}_0x300230[_0xb205('0x33')]=qs['sort'](_0x23e5cf['query'][_0xb205('0x34')]);_0x300230[_0xb205('0x35')]=qs[_0xb205('0x2c')](_['pick'](_0x23e5cf[_0xb205('0x2b')],_0x452981[_0xb205('0x2c')]));if(_0x23e5cf[_0xb205('0x2b')][_0xb205('0x36')]){_0x300230['where']=_[_0xb205('0x37')](_0x300230[_0xb205('0x35')],{'$or':_[_0xb205('0x38')](_0x57db83,function(_0x4b769c){if(_0x4b769c[_0xb205('0x39')][_0xb205('0x3a')]!==_0xb205('0x3b')){var _0x2a2214={};_0x2a2214[_0x4b769c[_0xb205('0x3c')]]={'$like':'%'+_0x23e5cf['query'][_0xb205('0x36')]+'%'};return _0x2a2214;}})});}_0x300230=_['merge']({},_0x300230,_0x23e5cf[_0xb205('0x3d')]);var _0x49f328={'where':_0x300230[_0xb205('0x35')]};return db['FreshdeskField'][_0xb205('0x1b')](_0x49f328)['then'](function(_0x6a7f4d){_0xc268fd[_0xb205('0x1b')]=_0x6a7f4d;if(_0x23e5cf[_0xb205('0x2b')]['includeAll']){_0x300230[_0xb205('0x3e')]=[{'all':!![]}];}return db[_0xb205('0x27')]['findAll'](_0x300230);})['then'](function(_0x425016){_0xc268fd[_0xb205('0x3f')]=_0x425016;return _0xc268fd;})['then'](respondWithFilteredResult(_0x3f4bf5,_0x300230))[_0xb205('0x40')](handleError(_0x3f4bf5,null));};exports[_0xb205('0x41')]=function(_0xe6a8ef,_0x35413a){var _0x4c2f18={'raw':!![],'where':{'id':_0xe6a8ef[_0xb205('0x42')]['id']}},_0x448014={};_0x448014[_0xb205('0x29')]=_['keys'](db[_0xb205('0x27')]['rawAttributes']);_0x448014[_0xb205('0x2b')]=_[_0xb205('0x2a')](_0xe6a8ef[_0xb205('0x2b')]);_0x448014[_0xb205('0x2c')]=_[_0xb205('0x2d')](_0x448014[_0xb205('0x29')],_0x448014['query']);_0x4c2f18['attributes']=_[_0xb205('0x2d')](_0x448014[_0xb205('0x29')],qs[_0xb205('0x2f')](_0xe6a8ef[_0xb205('0x2b')][_0xb205('0x2f')]));_0x4c2f18[_0xb205('0x2e')]=_0x4c2f18[_0xb205('0x2e')][_0xb205('0x30')]?_0x4c2f18[_0xb205('0x2e')]:_0x448014[_0xb205('0x29')];if(_0xe6a8ef[_0xb205('0x2b')][_0xb205('0x43')]){_0x4c2f18['include']=[{'all':!![]}];}_0x4c2f18=_[_0xb205('0x37')]({},_0x4c2f18,_0xe6a8ef[_0xb205('0x3d')]);return db[_0xb205('0x27')]['find'](_0x4c2f18)[_0xb205('0x21')](handleEntityNotFound(_0x35413a,null))[_0xb205('0x21')](respondWithResult(_0x35413a,null))[_0xb205('0x40')](handleError(_0x35413a,null));};exports['create']=function(_0x1f498a,_0x5cc5ff){return db[_0xb205('0x27')][_0xb205('0x44')](_0x1f498a[_0xb205('0x45')],{})[_0xb205('0x21')](respondWithResult(_0x5cc5ff,0xc9))[_0xb205('0x40')](handleError(_0x5cc5ff,null));};exports[_0xb205('0x46')]=function(_0x5dd7ac,_0x4d5e06){if(_0x5dd7ac[_0xb205('0x45')]['id']){delete _0x5dd7ac[_0xb205('0x45')]['id'];}return db[_0xb205('0x27')][_0xb205('0x47')]({'where':{'id':_0x5dd7ac['params']['id']}})[_0xb205('0x21')](handleEntityNotFound(_0x4d5e06,null))[_0xb205('0x21')](saveUpdates(_0x5dd7ac['body'],null))[_0xb205('0x21')](respondWithResult(_0x4d5e06,null))['catch'](handleError(_0x4d5e06,null));};exports[_0xb205('0x22')]=function(_0x30e11b,_0x150805){return db[_0xb205('0x27')]['find']({'where':{'id':_0x30e11b[_0xb205('0x42')]['id']}})[_0xb205('0x21')](handleEntityNotFound(_0x150805,null))['then'](removeEntity(_0x150805,null))[_0xb205('0x40')](handleError(_0x150805,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 81d5d08..5b90968 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 _0xcb55=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','FreshdeskField'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0xcb55,0x1e4));var _0x5cb5=function(_0x15af8f,_0x130dc6){_0x15af8f=_0x15af8f-0x0;var _0x36fca0=_0xcb55[_0x15af8f];return _0x36fca0;};'use strict';var _=require(_0x5cb5('0x0'));var util=require(_0x5cb5('0x1'));var logger=require(_0x5cb5('0x2'))(_0x5cb5('0x3'));var moment=require(_0x5cb5('0x4'));var BPromise=require(_0x5cb5('0x5'));var rp=require(_0x5cb5('0x6'));var fs=require('fs');var path=require(_0x5cb5('0x7'));var rimraf=require(_0x5cb5('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x5cb5('0x9')]=function(_0x5b06cc,_0x340deb){return _0x5b06cc[_0x5cb5('0xa')](_0x5cb5('0xb'),attributes,{'tableName':_0x5cb5('0xc'),'paranoid':![],'indexes':[{'name':_0x5cb5('0xd'),'fields':[_0x5cb5('0xe'),_0x5cb5('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe82=['FieldId','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x1118da,_0x2fde4c){var _0x7374da=function(_0x46f897){while(--_0x46f897){_0x1118da['push'](_0x1118da['shift']());}};_0x7374da(++_0x2fde4c);}(_0xbe82,0xbc));var _0x2be8=function(_0x567a69,_0x47b1d1){_0x567a69=_0x567a69-0x0;var _0x280a9d=_0xbe82[_0x567a69];return _0x280a9d;};'use strict';var _=require('lodash');var util=require(_0x2be8('0x0'));var logger=require(_0x2be8('0x1'))('api');var moment=require(_0x2be8('0x2'));var BPromise=require(_0x2be8('0x3'));var rp=require(_0x2be8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2be8('0x5'));var config=require('../../config/environment');var attributes=require(_0x2be8('0x6'));module[_0x2be8('0x7')]=function(_0x15c638,_0x461166){return _0x15c638[_0x2be8('0x8')](_0x2be8('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x2be8('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index b903c56..ea5b322 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(_0x2479a2,_0x476cbb){var _0xdceb6=function(_0x51584d){while(--_0x51584d){_0x2479a2['push'](_0x2479a2['shift']());}};_0xdceb6(++_0x476cbb);}(_0xb10b,0x12a));var _0xbb10=function(_0x39b51c,_0x40010d){_0x39b51c=_0x39b51c-0x0;var _0x146312=_0xb10b[_0x39b51c];return _0x146312;};'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(_0x265a47,_0x574e8a){var _0x8035ff=function(_0x1b2083){while(--_0x1b2083){_0x265a47['push'](_0x265a47['shift']());}};_0x8035ff(++_0x574e8a);}(_0xb10b,0x12a));var _0xbb10=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xb10b[_0x282a1f];return _0x296ea7;};'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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index fcf36ae..2286004 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 _0xd1e7=['addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0xd1e7,0x1d4));var _0x7d1e=function(_0x35bf6c,_0x2ea4cf){_0x35bf6c=_0x35bf6c-0x0;var _0x2bf88d=_0xd1e7[_0x35bf6c];return _0x2bf88d;};'use strict';var multer=require(_0x7d1e('0x0'));var util=require(_0x7d1e('0x1'));var path=require(_0x7d1e('0x2'));var timeout=require(_0x7d1e('0x3'));var express=require(_0x7d1e('0x4'));var router=express['Router']();var auth=require(_0x7d1e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d1e('0x6'));var controller=require(_0x7d1e('0x7'));router[_0x7d1e('0x8')]('/',auth[_0x7d1e('0x9')](),controller[_0x7d1e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7d1e('0xb')]);router['get'](_0x7d1e('0xc'),auth['isAuthenticated'](),controller[_0x7d1e('0xd')]);router[_0x7d1e('0x8')](_0x7d1e('0xe'),auth[_0x7d1e('0x9')](),controller['getFields']);router[_0x7d1e('0xf')]('/',auth[_0x7d1e('0x9')](),controller['create']);router[_0x7d1e('0xf')](_0x7d1e('0xc'),auth[_0x7d1e('0x9')](),controller[_0x7d1e('0x10')]);router[_0x7d1e('0x11')](_0x7d1e('0x12'),auth[_0x7d1e('0x9')](),controller[_0x7d1e('0x13')]);router[_0x7d1e('0x14')]('/:id',auth[_0x7d1e('0x9')](),controller[_0x7d1e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb3e9=['post','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x3c2b18,_0xa4456e){var _0x548811=function(_0x5b0143){while(--_0x5b0143){_0x3c2b18['push'](_0x3c2b18['shift']());}};_0x548811(++_0xa4456e);}(_0xb3e9,0x1eb));var _0x9b3e=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xb3e9[_0x2283dc];return _0x16db90;};'use strict';var multer=require(_0x9b3e('0x0'));var util=require('util');var path=require(_0x9b3e('0x1'));var timeout=require(_0x9b3e('0x2'));var express=require(_0x9b3e('0x3'));var router=express[_0x9b3e('0x4')]();var auth=require(_0x9b3e('0x5'));var interaction=require(_0x9b3e('0x6'));var config=require(_0x9b3e('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0x9b3e('0x8')]('/',auth['isAuthenticated'](),controller[_0x9b3e('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9b3e('0xa')]);router['get']('/:id/configurations',auth[_0x9b3e('0xb')](),controller[_0x9b3e('0xc')]);router[_0x9b3e('0x8')](_0x9b3e('0xd'),auth[_0x9b3e('0xb')](),controller[_0x9b3e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9b3e('0xf')](_0x9b3e('0x10'),auth['isAuthenticated'](),controller[_0x9b3e('0x11')]);router[_0x9b3e('0x12')](_0x9b3e('0x13'),auth[_0x9b3e('0xb')](),controller[_0x9b3e('0x14')]);router['delete']('/:id',auth[_0x9b3e('0xb')](),controller[_0x9b3e('0x15')]);module[_0x9b3e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index aa7d52b..9daf749 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 _0xabce=['exports','STRING','ENUM','newTab','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xabce,0x103));var _0xeabc=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xabce[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')]},'description':{'type':Sequelize[_0xeabc('0x2')]},'username':{'type':Sequelize[_0xeabc('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xeabc('0x2')]},'clientId':{'type':Sequelize[_0xeabc('0x2')]},'clientSecret':{'type':Sequelize[_0xeabc('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xeabc('0x3')]('integrationTab',_0xeabc('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xabce=['exports','STRING','ENUM','newTab','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xabce,0x103));var _0xeabc=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xabce[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')]},'description':{'type':Sequelize[_0xeabc('0x2')]},'username':{'type':Sequelize[_0xeabc('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xeabc('0x2')]},'clientId':{'type':Sequelize[_0xeabc('0x2')]},'clientSecret':{'type':Sequelize[_0xeabc('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xeabc('0x3')]('integrationTab',_0xeabc('0x4')),'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 167a617..fcb16c1 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 _0xb89f=['catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','index','SalesforceAccount','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','merge','map','type','key','VIRTUAL','field','options','includeAll','include','show','params','find','create','body','getConfigurations','findOne','order','sort','filter','addConfiguration','AccountId','Descriptions','channel','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','ticketType','sobject','CallObject','CallType','IsArchived','Priority','Status','Type','Reason','IsEscalated','SuppliedName','custom','includes','label','picklistValues','boolean','true','False','false','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','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','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb89f,0x16a));var _0xfb89=function(_0x323d77,_0x3db422){_0x323d77=_0x323d77-0x0;var _0x3ca327=_0xb89f[_0x323d77];return _0x3ca327;};'use strict';var pdf=require(_0xfb89('0x0'));var emlformat=require(_0xfb89('0x1'));var rimraf=require(_0xfb89('0x2'));var zipdir=require(_0xfb89('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb89('0x4'));var moment=require(_0xfb89('0x5'));var BPromise=require(_0xfb89('0x6'));var Mustache=require(_0xfb89('0x7'));var util=require(_0xfb89('0x8'));var path=require(_0xfb89('0x9'));var sox=require('sox');var csv=require(_0xfb89('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb89('0xb'));var squel=require(_0xfb89('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb89('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfb89('0xa'));var querystring=require(_0xfb89('0xe'));var Papa=require(_0xfb89('0xf'));var Redis=require(_0xfb89('0x10'));var authService=require(_0xfb89('0x11'));var qs=require(_0xfb89('0x12'));var hardwareService=require(_0xfb89('0x13'));var logger=require(_0xfb89('0x14'))(_0xfb89('0x15'));var utils=require(_0xfb89('0x16'));var config=require(_0xfb89('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfb89('0x18'));var jayson=require(_0xfb89('0x19'));var client=jayson[_0xfb89('0x1a')][_0xfb89('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2c8e14,_0x2db002,_0xaf4b01){if(_0xaf4b01){var _0xc8ddec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc8ddec[_0xfb89('0x1c')](_0x2db002)){return _0x2c8e14;}else{throw new db[(_0xfb89('0x1d'))][(_0xfb89('0x1e'))](_0xfb89('0x1f'));}}else{return _0x2c8e14;}}function respondWithRpcPromise(_0x4098fc,_0x142390,_0x951e85,_0x56a5c1){return new BPromise(function(_0x4eed64,_0x43585e){var _0x4f57d9=_0x56a5c1||client;return _0x4f57d9[_0xfb89('0x20')](_0x4098fc,_0x951e85)[_0xfb89('0x21')](function(_0x1aa499){logger['info'](_0xfb89('0x22'),_0x142390,_0xfb89('0x23'));logger[_0xfb89('0x24')](_0xfb89('0x25'),_0x142390,_0xfb89('0x23'),JSON[_0xfb89('0x26')](_0x1aa499));if(_0x1aa499[_0xfb89('0x27')]){if(_0x1aa499['error'][_0xfb89('0x28')]===0x1f4){logger['error'](_0xfb89('0x22'),_0x142390,_0x1aa499['error'][_0xfb89('0x29')]);return _0x43585e(_0x1aa499['error'][_0xfb89('0x29')]);}logger['error'](_0xfb89('0x22'),_0x142390,_0x1aa499[_0xfb89('0x27')][_0xfb89('0x29')]);return _0x4eed64(_0x1aa499['error'][_0xfb89('0x29')]);}else{logger['info'](_0xfb89('0x22'),_0x142390,'request\x20sent');_0x4eed64(_0x1aa499[_0xfb89('0x2a')]['message']);}})[_0xfb89('0x2b')](function(_0x1951f7){logger[_0xfb89('0x27')]('SalesforceAccount,\x20%s,\x20%s',_0x142390,_0x1951f7);_0x43585e(_0x1951f7);});});}function respondWithStatusCode(_0x1972c2,_0x208e1b){_0x208e1b=_0x208e1b||0xcc;return function(_0x5b9d47){if(_0x5b9d47){return _0x1972c2[_0xfb89('0x2c')](_0x208e1b);}return _0x1972c2[_0xfb89('0x2d')](_0x208e1b)[_0xfb89('0x2e')]();};}function respondWithResult(_0x27308c,_0xec4d9e){_0xec4d9e=_0xec4d9e||0xc8;return function(_0xe8a7e9){if(_0xe8a7e9){return _0x27308c[_0xfb89('0x2d')](_0xec4d9e)[_0xfb89('0x2f')](_0xe8a7e9);}};}function respondWithFilteredResult(_0x4a3ac4,_0x2c5170){return function(_0xb03079){if(_0xb03079){var _0x2ae14a=_0xb03079[_0xfb89('0x30')],_0x133325=_0x2c5170[_0xfb89('0x31')],_0x5cd5a9=_0x2c5170[_0xfb89('0x31')]+_0x2c5170['limit'],_0x2e2834;if(_0x5cd5a9>=_0x2ae14a){_0x5cd5a9=_0x2ae14a;_0x2e2834=0xc8;}else{_0x2e2834=0xce;}_0x4a3ac4[_0xfb89('0x2d')](_0x2e2834);return _0x4a3ac4['set'](_0xfb89('0x32'),_0x133325+'-'+_0x5cd5a9+'/'+_0x2ae14a)['json'](_0xb03079);}return null;};}function patchUpdates(_0x3a1c64){return function(_0x31bd11){try{jsonpatch[_0xfb89('0x33')](_0x31bd11,_0x3a1c64,!![]);}catch(_0x350a24){return BPromise[_0xfb89('0x34')](_0x350a24);}return _0x31bd11[_0xfb89('0x35')]();};}function saveUpdates(_0x255328,_0x230c90){return function(_0xe39c38){if(_0xe39c38){return _0xe39c38[_0xfb89('0x36')](_0x255328)[_0xfb89('0x21')](function(_0x1155e3){return _0x1155e3;});}return null;};}function removeEntity(_0x12e020,_0x274bf0){return function(_0x131f1c){if(_0x131f1c){return _0x131f1c[_0xfb89('0x37')]()[_0xfb89('0x21')](function(){_0x12e020['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5876af,_0xa10900){return function(_0x151ad6){if(!_0x151ad6){_0x5876af[_0xfb89('0x2c')](0x194);}return _0x151ad6;};}function handleError(_0x34f751,_0x50af50){_0x50af50=_0x50af50||0x1f4;return function(_0x24d53e){logger['error'](_0x24d53e[_0xfb89('0x38')]);if(_0x24d53e[_0xfb89('0x39')]){delete _0x24d53e[_0xfb89('0x39')];}_0x34f751[_0xfb89('0x2d')](_0x50af50)['send'](_0x24d53e);};}exports[_0xfb89('0x3a')]=function(_0x338db5,_0x249bd5){var _0x38c159={},_0x25b5c1={},_0x8f6c23={'count':0x0,'rows':[]};var _0x34e8ab=db[_0xfb89('0x3b')][_0xfb89('0x3c')];_0x25b5c1[_0xfb89('0x3d')]=_[_0xfb89('0x3e')](_0x34e8ab);_0x25b5c1['query']=_['keys'](_0x338db5['query']);_0x25b5c1[_0xfb89('0x3f')]=_[_0xfb89('0x40')](_0x25b5c1[_0xfb89('0x3d')],_0x25b5c1[_0xfb89('0x41')]);_0x38c159[_0xfb89('0x42')]=_[_0xfb89('0x40')](_0x25b5c1['model'],qs[_0xfb89('0x43')](_0x338db5['query']['fields']));_0x38c159['attributes']=_0x38c159[_0xfb89('0x42')][_0xfb89('0x44')]?_0x38c159[_0xfb89('0x42')]:_0x25b5c1[_0xfb89('0x3d')];if(!_0x338db5[_0xfb89('0x41')][_0xfb89('0x45')](_0xfb89('0x46'))){_0x38c159[_0xfb89('0x47')]=qs[_0xfb89('0x47')](_0x338db5['query']['limit']);_0x38c159[_0xfb89('0x31')]=qs[_0xfb89('0x31')](_0x338db5[_0xfb89('0x41')][_0xfb89('0x31')]);}_0x38c159['order']=qs['sort'](_0x338db5['query']['sort']);_0x38c159[_0xfb89('0x48')]=qs[_0xfb89('0x3f')](_[_0xfb89('0x49')](_0x338db5['query'],_0x25b5c1[_0xfb89('0x3f')]));if(_0x338db5[_0xfb89('0x41')]['filter']){_0x38c159['where']=_[_0xfb89('0x4a')](_0x38c159[_0xfb89('0x48')],{'$or':_[_0xfb89('0x4b')](_0x34e8ab,function(_0x156636){if(_0x156636[_0xfb89('0x4c')][_0xfb89('0x4d')]!==_0xfb89('0x4e')){var _0x4f980a={};_0x4f980a[_0x156636[_0xfb89('0x4f')]]={'$like':'%'+_0x338db5[_0xfb89('0x41')]['filter']+'%'};return _0x4f980a;}})});}_0x38c159=_[_0xfb89('0x4a')]({},_0x38c159,_0x338db5[_0xfb89('0x50')]);var _0x1c83a0={'where':_0x38c159['where']};return db['SalesforceAccount'][_0xfb89('0x30')](_0x1c83a0)[_0xfb89('0x21')](function(_0x30fbd6){_0x8f6c23[_0xfb89('0x30')]=_0x30fbd6;if(_0x338db5[_0xfb89('0x41')][_0xfb89('0x51')]){_0x38c159[_0xfb89('0x52')]=[{'all':!![]}];}return db[_0xfb89('0x3b')]['findAll'](_0x38c159);})[_0xfb89('0x21')](function(_0xaa43e1){_0x8f6c23['rows']=_0xaa43e1;return _0x8f6c23;})['then'](respondWithFilteredResult(_0x249bd5,_0x38c159))['catch'](handleError(_0x249bd5,null));};exports[_0xfb89('0x53')]=function(_0x14e91d,_0x415e26){var _0xdb1ed1={'raw':![],'where':{'id':_0x14e91d[_0xfb89('0x54')]['id']}},_0x1a688f={};_0x1a688f[_0xfb89('0x3d')]=_['keys'](db[_0xfb89('0x3b')]['rawAttributes']);_0x1a688f['query']=_['keys'](_0x14e91d['query']);_0x1a688f[_0xfb89('0x3f')]=_[_0xfb89('0x40')](_0x1a688f['model'],_0x1a688f[_0xfb89('0x41')]);_0xdb1ed1[_0xfb89('0x42')]=_[_0xfb89('0x40')](_0x1a688f[_0xfb89('0x3d')],qs['fields'](_0x14e91d[_0xfb89('0x41')]['fields']));_0xdb1ed1['attributes']=_0xdb1ed1[_0xfb89('0x42')]['length']?_0xdb1ed1[_0xfb89('0x42')]:_0x1a688f[_0xfb89('0x3d')];if(_0x14e91d[_0xfb89('0x41')]['includeAll']){_0xdb1ed1[_0xfb89('0x52')]=[{'all':!![]}];}_0xdb1ed1=_[_0xfb89('0x4a')]({},_0xdb1ed1,_0x14e91d[_0xfb89('0x50')]);return db[_0xfb89('0x3b')][_0xfb89('0x55')](_0xdb1ed1)[_0xfb89('0x21')](handleEntityNotFound(_0x415e26,null))[_0xfb89('0x21')](respondWithResult(_0x415e26,null))[_0xfb89('0x2b')](handleError(_0x415e26,null));};exports[_0xfb89('0x56')]=function(_0x39fb30,_0x3869eb){return db[_0xfb89('0x3b')][_0xfb89('0x56')](_0x39fb30[_0xfb89('0x57')],{})[_0xfb89('0x21')](respondWithResult(_0x3869eb,0xc9))[_0xfb89('0x2b')](handleError(_0x3869eb,null));};exports[_0xfb89('0x36')]=function(_0x4f5017,_0x1a4d73){if(_0x4f5017[_0xfb89('0x57')]['id']){delete _0x4f5017[_0xfb89('0x57')]['id'];}return db[_0xfb89('0x3b')][_0xfb89('0x55')]({'where':{'id':_0x4f5017[_0xfb89('0x54')]['id']}})[_0xfb89('0x21')](handleEntityNotFound(_0x1a4d73,null))['then'](saveUpdates(_0x4f5017[_0xfb89('0x57')],null))[_0xfb89('0x21')](respondWithResult(_0x1a4d73,null))[_0xfb89('0x2b')](handleError(_0x1a4d73,null));};exports[_0xfb89('0x37')]=function(_0x719397,_0x5d732c){return db[_0xfb89('0x3b')][_0xfb89('0x55')]({'where':{'id':_0x719397[_0xfb89('0x54')]['id']}})[_0xfb89('0x21')](handleEntityNotFound(_0x5d732c,null))[_0xfb89('0x21')](removeEntity(_0x5d732c,null))[_0xfb89('0x2b')](handleError(_0x5d732c,null));};exports[_0xfb89('0x58')]=function(_0x404325,_0x4b58cb,_0xf02cd4){var _0x331e4f={};var _0x411922={};var _0x4eab8f;var _0x33925d;return db['SalesforceAccount'][_0xfb89('0x59')]({'where':{'id':_0x404325[_0xfb89('0x54')]['id']}})[_0xfb89('0x21')](handleEntityNotFound(_0x4b58cb,null))[_0xfb89('0x21')](function(_0x430e45){if(_0x430e45){_0x4eab8f=_0x430e45;_0x411922[_0xfb89('0x3d')]=_['keys'](db['SalesforceConfiguration'][_0xfb89('0x3c')]);_0x411922[_0xfb89('0x41')]=_[_0xfb89('0x3e')](_0x404325[_0xfb89('0x41')]);_0x411922[_0xfb89('0x3f')]=_[_0xfb89('0x40')](_0x411922['model'],_0x411922[_0xfb89('0x41')]);_0x331e4f[_0xfb89('0x42')]=_[_0xfb89('0x40')](_0x411922[_0xfb89('0x3d')],qs[_0xfb89('0x43')](_0x404325[_0xfb89('0x41')]['fields']));_0x331e4f[_0xfb89('0x42')]=_0x331e4f[_0xfb89('0x42')][_0xfb89('0x44')]?_0x331e4f['attributes']:_0x411922[_0xfb89('0x3d')];_0x331e4f[_0xfb89('0x5a')]=qs['sort'](_0x404325['query'][_0xfb89('0x5b')]);_0x331e4f['where']=qs[_0xfb89('0x3f')](_[_0xfb89('0x49')](_0x404325[_0xfb89('0x41')],_0x411922[_0xfb89('0x3f')]));if(_0x404325[_0xfb89('0x41')]['filter']){_0x331e4f[_0xfb89('0x48')]=_[_0xfb89('0x4a')](_0x331e4f['where'],{'$or':_[_0xfb89('0x4b')](_0x331e4f['attributes'],function(_0x3c0d87){var _0x5179cd={};_0x5179cd[_0x3c0d87]={'$like':'%'+_0x404325[_0xfb89('0x41')][_0xfb89('0x5c')]+'%'};return _0x5179cd;})});}_0x331e4f=_[_0xfb89('0x4a')]({},_0x331e4f,_0x404325[_0xfb89('0x50')]);return _0x4eab8f[_0xfb89('0x58')](_0x331e4f);}})[_0xfb89('0x21')](function(_0x3f2508){if(_0x3f2508){_0x33925d=_0x3f2508[_0xfb89('0x44')];if(!_0x404325['query'][_0xfb89('0x45')](_0xfb89('0x46'))){_0x331e4f[_0xfb89('0x47')]=qs[_0xfb89('0x47')](_0x404325[_0xfb89('0x41')][_0xfb89('0x47')]);_0x331e4f[_0xfb89('0x31')]=qs[_0xfb89('0x31')](_0x404325['query']['offset']);}return _0x4eab8f[_0xfb89('0x58')](_0x331e4f);}})['then'](function(_0x1a42f3){if(_0x1a42f3){return _0x1a42f3?{'count':_0x33925d,'rows':_0x1a42f3}:null;}})[_0xfb89('0x21')](respondWithResult(_0x4b58cb,null))['catch'](handleError(_0x4b58cb,null));};exports[_0xfb89('0x5d')]=function(_0x250f18,_0x43042b,_0x594596){if(_0x250f18[_0xfb89('0x57')]['id']){delete _0x250f18[_0xfb89('0x57')]['id'];}return db[_0xfb89('0x3b')]['findOne']({'where':{'id':_0x250f18[_0xfb89('0x54')]['id']}})[_0xfb89('0x21')](handleEntityNotFound(_0x43042b,null))[_0xfb89('0x21')](function(_0x577e42){if(_0x577e42){_0x250f18[_0xfb89('0x57')][_0xfb89('0x5e')]=_0x577e42['id'];_0x250f18['body']['Subjects']=integrations['getSubjects'](_0x250f18['body']['channel'],_0x250f18[_0xfb89('0x57')][_0xfb89('0x4c')]);_0x250f18[_0xfb89('0x57')][_0xfb89('0x5f')]=integrations['getDescriptions'](_0x250f18['body'][_0xfb89('0x60')],_0x250f18[_0xfb89('0x57')][_0xfb89('0x4c')]);return db[_0xfb89('0x61')][_0xfb89('0x56')](_0x250f18[_0xfb89('0x57')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xfb89('0x62')],'as':'Descriptions'}]});}return null;})[_0xfb89('0x21')](respondWithResult(_0x43042b,null))[_0xfb89('0x2b')](handleError(_0x43042b,null));};exports[_0xfb89('0x63')]=function(_0x4c37bb,_0x3d817f,_0x2ba5b3){var _0x2cadab;var _0x54672d='';var _0x2a7a67=_0xfb89('0x64');return db[_0xfb89('0x3b')][_0xfb89('0x59')]({'where':{'id':_0x4c37bb[_0xfb89('0x54')]['id']},'attributes':['id',_0xfb89('0x65'),_0xfb89('0x66'),'clientSecret',_0xfb89('0x67'),_0xfb89('0x68'),_0xfb89('0x69')]})['then'](handleEntityNotFound(_0x3d817f,null))['then'](function(_0x183c7e){if(_0x183c7e){_0x54672d=_0x183c7e[_0xfb89('0x65')];var _0x4098d1=_0x54672d[_0xfb89('0x6a')](-0x1);if(_0x4098d1==='/'){_0x54672d=_0x54672d[_0xfb89('0x6b')](0x0,_0x54672d[_0xfb89('0x6c')](_0x4098d1));}_0x2cadab=new jsforce[(_0xfb89('0x6d'))]({'oauth2':{'loginUrl':_0x54672d,'clientId':_0x183c7e[_0xfb89('0x66')],'clientSecret':_0x183c7e['clientSecret']}});return _0x2cadab[_0xfb89('0x6e')](_0x183c7e['username'],_0x183c7e[_0xfb89('0x68')][_0xfb89('0x6f')](_0x183c7e[_0xfb89('0x69')]));}})['then'](function(_0x52cbd6){if(_0x52cbd6){if(!_['isNil'](_0x4c37bb[_0xfb89('0x41')][_0xfb89('0x70')])){_0x2a7a67=_0x4c37bb['query'][_0xfb89('0x70')];}return _0x2cadab[_0xfb89('0x71')](_0x2a7a67)['describe']();}})[_0xfb89('0x21')](function(_0x16ced2){var _0x116d04=['CallDisposition','CallDurationInSeconds',_0xfb89('0x72'),_0xfb89('0x73'),_0xfb89('0x74'),_0xfb89('0x75'),_0xfb89('0x76'),_0xfb89('0x77')];if(!_['isNil'](_0x4c37bb[_0xfb89('0x41')][_0xfb89('0x70')])&&_0x4c37bb[_0xfb89('0x41')]['ticketType']==='Case'){_0x116d04=[_0xfb89('0x77'),'Origin',_0xfb89('0x78'),_0xfb89('0x76'),_0xfb89('0x75'),_0xfb89('0x79'),_0xfb89('0x7a'),'SuppliedCompany'];}if(_0x16ced2){_['remove'](_0x16ced2[_0xfb89('0x43')],function(_0x7b76a3){return _0x7b76a3[_0xfb89('0x7b')]===![]&&!_0x116d04[_0xfb89('0x7c')](_0x7b76a3[_0xfb89('0x39')]);});return{'count':_0x16ced2['fields']['length'],'rows':_[_0xfb89('0x4b')](_0x16ced2[_0xfb89('0x43')],function(_0xf748e4){return{'id':_0xf748e4[_0xfb89('0x39')],'name':_0xf748e4[_0xfb89('0x7d')],'custom':_0xf748e4['custom'],'options':_0xf748e4['picklistValues'][_0xfb89('0x44')]>0x0?_['map'](_0xf748e4[_0xfb89('0x7e')],function(_0x5c07aa){return{'name':_0x5c07aa['label'],'value':_0x5c07aa['value']};}):_0xf748e4[_0xfb89('0x4c')]==_0xfb89('0x7f')?[{'name':'True','value':_0xfb89('0x80')},{'name':_0xfb89('0x81'),'value':_0xfb89('0x82')}]:[]};})};}})[_0xfb89('0x21')](respondWithResult(_0x3d817f,null))[_0xfb89('0x2b')](function(_0x5b5fa1){var _0xfa15f2=_0x4c37bb[_0xfb89('0x41')][_0xfb89('0x1c')]?0x1f4:_0x5b5fa1['statusCode']||0x1f4;logger[_0xfb89('0x27')](_0xfb89('0x83'),_0xfb89('0x63'),_0xfa15f2,JSON[_0xfb89('0x26')](_0x5b5fa1));delete _0x5b5fa1['name'];if(_0xfa15f2===0x191){_0xfa15f2=0x190;}_0x3d817f[_0xfb89('0x2d')](_0xfa15f2)[_0xfb89('0x84')](_0x4c37bb[_0xfb89('0x41')][_0xfb89('0x1c')]?{'message':_0xfb89('0x85'),'statusCode':_0x5b5fa1[_0xfb89('0x86')]}:_0x5b5fa1);});}; \ No newline at end of file +var _0xa1f1=['../../components/parsers/qs','../../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','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','name','send','index','SalesforceAccount','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','map','VIRTUAL','field','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','channel','SalesforceConfiguration','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Type','Case','Reason','Status','SuppliedName','SuppliedCompany','remove','custom','label','picklistValues','value','boolean','True','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x15d2ee,_0x2c43d9){var _0x355358=function(_0x3b3b95){while(--_0x3b3b95){_0x15d2ee['push'](_0x15d2ee['shift']());}};_0x355358(++_0x2c43d9);}(_0xa1f1,0xfe));var _0x1a1f=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xa1f1[_0x23a79e];return _0x3dab57;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1a1f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1a1f('0x1'));var rp=require(_0x1a1f('0x2'));var moment=require(_0x1a1f('0x3'));var BPromise=require(_0x1a1f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1a1f('0x5'));var csv=require(_0x1a1f('0x6'));var ejs=require(_0x1a1f('0x7'));var fs=require('fs');var _=require(_0x1a1f('0x8'));var squel=require(_0x1a1f('0x9'));var crypto=require(_0x1a1f('0xa'));var jsforce=require(_0x1a1f('0xb'));var deskjs=require(_0x1a1f('0xc'));var toCsv=require(_0x1a1f('0x6'));var querystring=require(_0x1a1f('0xd'));var Papa=require(_0x1a1f('0xe'));var Redis=require('ioredis');var authService=require(_0x1a1f('0xf'));var qs=require(_0x1a1f('0x10'));var hardwareService=require(_0x1a1f('0x11'));var logger=require(_0x1a1f('0x12'))(_0x1a1f('0x13'));var utils=require(_0x1a1f('0x14'));var config=require(_0x1a1f('0x15'));var db=require(_0x1a1f('0x16'))['db'];var integrations=require(_0x1a1f('0x17'));var jayson=require(_0x1a1f('0x18'));var client=jayson[_0x1a1f('0x19')][_0x1a1f('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x24a6d8,_0x48cde2,_0x443252){if(_0x443252){var _0x1209e6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1209e6[_0x1a1f('0x1b')](_0x48cde2)){return _0x24a6d8;}else{throw new db[(_0x1a1f('0x1c'))][(_0x1a1f('0x1d'))](_0x1a1f('0x1e'));}}else{return _0x24a6d8;}}function respondWithRpcPromise(_0x2f193,_0x5098fa,_0x431090,_0x1108e8){return new BPromise(function(_0x4775a4,_0x41835f){var _0x499873=_0x1108e8||client;return _0x499873[_0x1a1f('0x1f')](_0x2f193,_0x431090)[_0x1a1f('0x20')](function(_0x4df213){logger[_0x1a1f('0x21')](_0x1a1f('0x22'),_0x5098fa,_0x1a1f('0x23'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5098fa,_0x1a1f('0x23'),JSON[_0x1a1f('0x24')](_0x4df213));if(_0x4df213[_0x1a1f('0x25')]){if(_0x4df213[_0x1a1f('0x25')]['code']===0x1f4){logger[_0x1a1f('0x25')](_0x1a1f('0x22'),_0x5098fa,_0x4df213['error'][_0x1a1f('0x26')]);return _0x41835f(_0x4df213[_0x1a1f('0x25')][_0x1a1f('0x26')]);}logger[_0x1a1f('0x25')](_0x1a1f('0x22'),_0x5098fa,_0x4df213[_0x1a1f('0x25')][_0x1a1f('0x26')]);return _0x4775a4(_0x4df213['error'][_0x1a1f('0x26')]);}else{logger[_0x1a1f('0x21')](_0x1a1f('0x22'),_0x5098fa,_0x1a1f('0x23'));_0x4775a4(_0x4df213[_0x1a1f('0x27')][_0x1a1f('0x26')]);}})['catch'](function(_0x43bcdf){logger[_0x1a1f('0x25')](_0x1a1f('0x22'),_0x5098fa,_0x43bcdf);_0x41835f(_0x43bcdf);});});}function respondWithStatusCode(_0x2f9d24,_0x277ee6){_0x277ee6=_0x277ee6||0xcc;return function(_0x2e5960){if(_0x2e5960){return _0x2f9d24[_0x1a1f('0x28')](_0x277ee6);}return _0x2f9d24[_0x1a1f('0x29')](_0x277ee6)[_0x1a1f('0x2a')]();};}function respondWithResult(_0x1dbc8e,_0x2a159f){_0x2a159f=_0x2a159f||0xc8;return function(_0x2f2ba9){if(_0x2f2ba9){return _0x1dbc8e[_0x1a1f('0x29')](_0x2a159f)[_0x1a1f('0x2b')](_0x2f2ba9);}};}function respondWithFilteredResult(_0x566e03,_0x1fabfa){return function(_0x391210){if(_0x391210){var _0x389e31=_0x391210['count'],_0x15facf=_0x1fabfa['offset'],_0x3c6fe6=_0x1fabfa['offset']+_0x1fabfa[_0x1a1f('0x2c')],_0x4f8755;if(_0x3c6fe6>=_0x389e31){_0x3c6fe6=_0x389e31;_0x4f8755=0xc8;}else{_0x4f8755=0xce;}_0x566e03[_0x1a1f('0x29')](_0x4f8755);return _0x566e03['set'](_0x1a1f('0x2d'),_0x15facf+'-'+_0x3c6fe6+'/'+_0x389e31)[_0x1a1f('0x2b')](_0x391210);}return null;};}function patchUpdates(_0xcc06d1){return function(_0x4f41eb){try{jsonpatch[_0x1a1f('0x2e')](_0x4f41eb,_0xcc06d1,!![]);}catch(_0x4c6a2e){return BPromise[_0x1a1f('0x2f')](_0x4c6a2e);}return _0x4f41eb[_0x1a1f('0x30')]();};}function saveUpdates(_0x536785,_0xee813a){return function(_0x3d093c){if(_0x3d093c){return _0x3d093c['update'](_0x536785)[_0x1a1f('0x20')](function(_0x18fbe1){return _0x18fbe1;});}return null;};}function removeEntity(_0x645715,_0x21363c){return function(_0x13220e){if(_0x13220e){return _0x13220e['destroy']()['then'](function(){_0x645715[_0x1a1f('0x29')](0xcc)[_0x1a1f('0x2a')]();});}};}function handleEntityNotFound(_0xbcd934,_0x4484b7){return function(_0x87b41){if(!_0x87b41){_0xbcd934[_0x1a1f('0x28')](0x194);}return _0x87b41;};}function handleError(_0x2c9be0,_0x40c0ff){_0x40c0ff=_0x40c0ff||0x1f4;return function(_0x265ed1){logger[_0x1a1f('0x25')](_0x265ed1['stack']);if(_0x265ed1[_0x1a1f('0x31')]){delete _0x265ed1['name'];}_0x2c9be0[_0x1a1f('0x29')](_0x40c0ff)[_0x1a1f('0x32')](_0x265ed1);};}exports[_0x1a1f('0x33')]=function(_0x134d94,_0x193f5c){var _0x158c46={},_0x1fdcfb={},_0x28c573={'count':0x0,'rows':[]};var _0x1bd9ad=db[_0x1a1f('0x34')]['rawAttributes'];_0x1fdcfb[_0x1a1f('0x35')]=_['keys'](_0x1bd9ad);_0x1fdcfb[_0x1a1f('0x36')]=_[_0x1a1f('0x37')](_0x134d94[_0x1a1f('0x36')]);_0x1fdcfb[_0x1a1f('0x38')]=_[_0x1a1f('0x39')](_0x1fdcfb['model'],_0x1fdcfb[_0x1a1f('0x36')]);_0x158c46[_0x1a1f('0x3a')]=_['intersection'](_0x1fdcfb[_0x1a1f('0x35')],qs['fields'](_0x134d94[_0x1a1f('0x36')][_0x1a1f('0x3b')]));_0x158c46['attributes']=_0x158c46['attributes'][_0x1a1f('0x3c')]?_0x158c46['attributes']:_0x1fdcfb[_0x1a1f('0x35')];if(!_0x134d94['query'][_0x1a1f('0x3d')](_0x1a1f('0x3e'))){_0x158c46['limit']=qs[_0x1a1f('0x2c')](_0x134d94['query'][_0x1a1f('0x2c')]);_0x158c46[_0x1a1f('0x3f')]=qs[_0x1a1f('0x3f')](_0x134d94[_0x1a1f('0x36')][_0x1a1f('0x3f')]);}_0x158c46[_0x1a1f('0x40')]=qs['sort'](_0x134d94[_0x1a1f('0x36')][_0x1a1f('0x41')]);_0x158c46[_0x1a1f('0x42')]=qs['filters'](_[_0x1a1f('0x43')](_0x134d94[_0x1a1f('0x36')],_0x1fdcfb[_0x1a1f('0x38')]));if(_0x134d94['query'][_0x1a1f('0x44')]){_0x158c46[_0x1a1f('0x42')]=_[_0x1a1f('0x45')](_0x158c46['where'],{'$or':_[_0x1a1f('0x46')](_0x1bd9ad,function(_0xb37dd0){if(_0xb37dd0['type']['key']!==_0x1a1f('0x47')){var _0x12f462={};_0x12f462[_0xb37dd0[_0x1a1f('0x48')]]={'$like':'%'+_0x134d94[_0x1a1f('0x36')][_0x1a1f('0x44')]+'%'};return _0x12f462;}})});}_0x158c46=_[_0x1a1f('0x45')]({},_0x158c46,_0x134d94[_0x1a1f('0x49')]);var _0x4a2dcb={'where':_0x158c46[_0x1a1f('0x42')]};return db[_0x1a1f('0x34')]['count'](_0x4a2dcb)['then'](function(_0x4292e3){_0x28c573['count']=_0x4292e3;if(_0x134d94[_0x1a1f('0x36')][_0x1a1f('0x4a')]){_0x158c46[_0x1a1f('0x4b')]=[{'all':!![]}];}return db[_0x1a1f('0x34')][_0x1a1f('0x4c')](_0x158c46);})[_0x1a1f('0x20')](function(_0x2f5952){_0x28c573['rows']=_0x2f5952;return _0x28c573;})[_0x1a1f('0x20')](respondWithFilteredResult(_0x193f5c,_0x158c46))[_0x1a1f('0x4d')](handleError(_0x193f5c,null));};exports[_0x1a1f('0x4e')]=function(_0x55821b,_0xb8f057){var _0x41675d={'raw':![],'where':{'id':_0x55821b[_0x1a1f('0x4f')]['id']}},_0x4aeca9={};_0x4aeca9[_0x1a1f('0x35')]=_[_0x1a1f('0x37')](db[_0x1a1f('0x34')][_0x1a1f('0x50')]);_0x4aeca9[_0x1a1f('0x36')]=_[_0x1a1f('0x37')](_0x55821b[_0x1a1f('0x36')]);_0x4aeca9[_0x1a1f('0x38')]=_[_0x1a1f('0x39')](_0x4aeca9['model'],_0x4aeca9[_0x1a1f('0x36')]);_0x41675d[_0x1a1f('0x3a')]=_[_0x1a1f('0x39')](_0x4aeca9[_0x1a1f('0x35')],qs[_0x1a1f('0x3b')](_0x55821b[_0x1a1f('0x36')][_0x1a1f('0x3b')]));_0x41675d[_0x1a1f('0x3a')]=_0x41675d[_0x1a1f('0x3a')][_0x1a1f('0x3c')]?_0x41675d[_0x1a1f('0x3a')]:_0x4aeca9[_0x1a1f('0x35')];if(_0x55821b[_0x1a1f('0x36')][_0x1a1f('0x4a')]){_0x41675d[_0x1a1f('0x4b')]=[{'all':!![]}];}_0x41675d=_[_0x1a1f('0x45')]({},_0x41675d,_0x55821b['options']);return db[_0x1a1f('0x34')][_0x1a1f('0x51')](_0x41675d)['then'](handleEntityNotFound(_0xb8f057,null))[_0x1a1f('0x20')](respondWithResult(_0xb8f057,null))[_0x1a1f('0x4d')](handleError(_0xb8f057,null));};exports[_0x1a1f('0x52')]=function(_0x5ae836,_0x18a8f1){return db['SalesforceAccount']['create'](_0x5ae836[_0x1a1f('0x53')],{})[_0x1a1f('0x20')](respondWithResult(_0x18a8f1,0xc9))['catch'](handleError(_0x18a8f1,null));};exports[_0x1a1f('0x54')]=function(_0x33cc1d,_0x65bcc2){if(_0x33cc1d[_0x1a1f('0x53')]['id']){delete _0x33cc1d[_0x1a1f('0x53')]['id'];}return db['SalesforceAccount'][_0x1a1f('0x51')]({'where':{'id':_0x33cc1d[_0x1a1f('0x4f')]['id']}})[_0x1a1f('0x20')](handleEntityNotFound(_0x65bcc2,null))[_0x1a1f('0x20')](saveUpdates(_0x33cc1d['body'],null))[_0x1a1f('0x20')](respondWithResult(_0x65bcc2,null))[_0x1a1f('0x4d')](handleError(_0x65bcc2,null));};exports[_0x1a1f('0x55')]=function(_0x2ffc73,_0x1be3d1){return db[_0x1a1f('0x34')][_0x1a1f('0x51')]({'where':{'id':_0x2ffc73[_0x1a1f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1be3d1,null))[_0x1a1f('0x20')](removeEntity(_0x1be3d1,null))[_0x1a1f('0x4d')](handleError(_0x1be3d1,null));};exports[_0x1a1f('0x56')]=function(_0x5009a2,_0x4d8c60,_0x1f4f1b){var _0x3408d7={};var _0x3e9726={};var _0x5d8c76;var _0x5bad47;return db['SalesforceAccount']['findOne']({'where':{'id':_0x5009a2['params']['id']}})['then'](handleEntityNotFound(_0x4d8c60,null))[_0x1a1f('0x20')](function(_0x537762){if(_0x537762){_0x5d8c76=_0x537762;_0x3e9726[_0x1a1f('0x35')]=_['keys'](db['SalesforceConfiguration'][_0x1a1f('0x50')]);_0x3e9726['query']=_[_0x1a1f('0x37')](_0x5009a2['query']);_0x3e9726[_0x1a1f('0x38')]=_[_0x1a1f('0x39')](_0x3e9726[_0x1a1f('0x35')],_0x3e9726[_0x1a1f('0x36')]);_0x3408d7[_0x1a1f('0x3a')]=_[_0x1a1f('0x39')](_0x3e9726[_0x1a1f('0x35')],qs[_0x1a1f('0x3b')](_0x5009a2[_0x1a1f('0x36')][_0x1a1f('0x3b')]));_0x3408d7[_0x1a1f('0x3a')]=_0x3408d7['attributes']['length']?_0x3408d7[_0x1a1f('0x3a')]:_0x3e9726[_0x1a1f('0x35')];_0x3408d7[_0x1a1f('0x40')]=qs['sort'](_0x5009a2['query']['sort']);_0x3408d7[_0x1a1f('0x42')]=qs['filters'](_[_0x1a1f('0x43')](_0x5009a2[_0x1a1f('0x36')],_0x3e9726[_0x1a1f('0x38')]));if(_0x5009a2[_0x1a1f('0x36')][_0x1a1f('0x44')]){_0x3408d7[_0x1a1f('0x42')]=_[_0x1a1f('0x45')](_0x3408d7[_0x1a1f('0x42')],{'$or':_[_0x1a1f('0x46')](_0x3408d7[_0x1a1f('0x3a')],function(_0x3fb047){var _0x103f01={};_0x103f01[_0x3fb047]={'$like':'%'+_0x5009a2[_0x1a1f('0x36')][_0x1a1f('0x44')]+'%'};return _0x103f01;})});}_0x3408d7=_[_0x1a1f('0x45')]({},_0x3408d7,_0x5009a2[_0x1a1f('0x49')]);return _0x5d8c76[_0x1a1f('0x56')](_0x3408d7);}})[_0x1a1f('0x20')](function(_0xc7b169){if(_0xc7b169){_0x5bad47=_0xc7b169[_0x1a1f('0x3c')];if(!_0x5009a2[_0x1a1f('0x36')]['hasOwnProperty'](_0x1a1f('0x3e'))){_0x3408d7[_0x1a1f('0x2c')]=qs['limit'](_0x5009a2['query'][_0x1a1f('0x2c')]);_0x3408d7[_0x1a1f('0x3f')]=qs[_0x1a1f('0x3f')](_0x5009a2['query'][_0x1a1f('0x3f')]);}return _0x5d8c76[_0x1a1f('0x56')](_0x3408d7);}})[_0x1a1f('0x20')](function(_0x26e8e5){if(_0x26e8e5){return _0x26e8e5?{'count':_0x5bad47,'rows':_0x26e8e5}:null;}})[_0x1a1f('0x20')](respondWithResult(_0x4d8c60,null))['catch'](handleError(_0x4d8c60,null));};exports[_0x1a1f('0x57')]=function(_0x23875d,_0x58a9b8,_0x38e7b2){if(_0x23875d[_0x1a1f('0x53')]['id']){delete _0x23875d[_0x1a1f('0x53')]['id'];}return db[_0x1a1f('0x34')][_0x1a1f('0x58')]({'where':{'id':_0x23875d[_0x1a1f('0x4f')]['id']}})[_0x1a1f('0x20')](handleEntityNotFound(_0x58a9b8,null))[_0x1a1f('0x20')](function(_0x339161){if(_0x339161){_0x23875d[_0x1a1f('0x53')][_0x1a1f('0x59')]=_0x339161['id'];_0x23875d[_0x1a1f('0x53')][_0x1a1f('0x5a')]=integrations[_0x1a1f('0x5b')](_0x23875d[_0x1a1f('0x53')]['channel'],_0x23875d[_0x1a1f('0x53')][_0x1a1f('0x5c')]);_0x23875d[_0x1a1f('0x53')][_0x1a1f('0x5d')]=integrations['getDescriptions'](_0x23875d[_0x1a1f('0x53')][_0x1a1f('0x5e')],_0x23875d[_0x1a1f('0x53')][_0x1a1f('0x5c')]);return db[_0x1a1f('0x5f')][_0x1a1f('0x52')](_0x23875d['body'],{'include':[{'model':db[_0x1a1f('0x60')],'as':_0x1a1f('0x5a')},{'model':db[_0x1a1f('0x60')],'as':_0x1a1f('0x5d')}]});}return null;})[_0x1a1f('0x20')](respondWithResult(_0x58a9b8,null))[_0x1a1f('0x4d')](handleError(_0x58a9b8,null));};exports[_0x1a1f('0x61')]=function(_0x5eb40c,_0x41b030,_0x20645a){var _0x301ea4;var _0x33d914='';var _0x36e497='Task';return db[_0x1a1f('0x34')][_0x1a1f('0x58')]({'where':{'id':_0x5eb40c['params']['id']},'attributes':['id',_0x1a1f('0x62'),_0x1a1f('0x63'),_0x1a1f('0x64'),_0x1a1f('0x65'),_0x1a1f('0x66'),_0x1a1f('0x67')]})[_0x1a1f('0x20')](handleEntityNotFound(_0x41b030,null))['then'](function(_0x341e0e){if(_0x341e0e){_0x33d914=_0x341e0e['remoteUri'];var _0x180be0=_0x33d914[_0x1a1f('0x68')](-0x1);if(_0x180be0==='/'){_0x33d914=_0x33d914[_0x1a1f('0x69')](0x0,_0x33d914[_0x1a1f('0x6a')](_0x180be0));}_0x301ea4=new jsforce[(_0x1a1f('0x6b'))]({'oauth2':{'loginUrl':_0x33d914,'clientId':_0x341e0e[_0x1a1f('0x63')],'clientSecret':_0x341e0e[_0x1a1f('0x64')]}});return _0x301ea4[_0x1a1f('0x6c')](_0x341e0e[_0x1a1f('0x65')],_0x341e0e['password'][_0x1a1f('0x6d')](_0x341e0e[_0x1a1f('0x67')]));}})[_0x1a1f('0x20')](function(_0x550e75){if(_0x550e75){if(!_[_0x1a1f('0x6e')](_0x5eb40c['query'][_0x1a1f('0x6f')])){_0x36e497=_0x5eb40c[_0x1a1f('0x36')][_0x1a1f('0x6f')];}return _0x301ea4['sobject'](_0x36e497)[_0x1a1f('0x70')]();}})[_0x1a1f('0x20')](function(_0x478750){var _0x6d1a30=[_0x1a1f('0x71'),_0x1a1f('0x72'),_0x1a1f('0x73'),'CallType',_0x1a1f('0x74'),_0x1a1f('0x75'),'Status',_0x1a1f('0x76')];if(!_[_0x1a1f('0x6e')](_0x5eb40c[_0x1a1f('0x36')]['ticketType'])&&_0x5eb40c[_0x1a1f('0x36')][_0x1a1f('0x6f')]===_0x1a1f('0x77')){_0x6d1a30=[_0x1a1f('0x76'),'Origin',_0x1a1f('0x78'),_0x1a1f('0x79'),_0x1a1f('0x75'),'IsEscalated',_0x1a1f('0x7a'),_0x1a1f('0x7b')];}if(_0x478750){_[_0x1a1f('0x7c')](_0x478750[_0x1a1f('0x3b')],function(_0xf83ead){return _0xf83ead[_0x1a1f('0x7d')]===![]&&!_0x6d1a30['includes'](_0xf83ead[_0x1a1f('0x31')]);});return{'count':_0x478750[_0x1a1f('0x3b')][_0x1a1f('0x3c')],'rows':_[_0x1a1f('0x46')](_0x478750[_0x1a1f('0x3b')],function(_0xba28b3){return{'id':_0xba28b3['name'],'name':_0xba28b3[_0x1a1f('0x7e')],'custom':_0xba28b3[_0x1a1f('0x7d')],'options':_0xba28b3[_0x1a1f('0x7f')][_0x1a1f('0x3c')]>0x0?_[_0x1a1f('0x46')](_0xba28b3[_0x1a1f('0x7f')],function(_0x5b1ec1){return{'name':_0x5b1ec1[_0x1a1f('0x7e')],'value':_0x5b1ec1[_0x1a1f('0x80')]};}):_0xba28b3[_0x1a1f('0x5c')]==_0x1a1f('0x81')?[{'name':_0x1a1f('0x82'),'value':'true'},{'name':'False','value':_0x1a1f('0x83')}]:[]};})};}})[_0x1a1f('0x20')](respondWithResult(_0x41b030,null))[_0x1a1f('0x4d')](function(_0x1fdd45){var _0x502a23=_0x5eb40c[_0x1a1f('0x36')][_0x1a1f('0x1b')]?0x1f4:_0x1fdd45[_0x1a1f('0x84')]||0x1f4;logger[_0x1a1f('0x25')](_0x1a1f('0x85'),'getFields',_0x502a23,JSON[_0x1a1f('0x24')](_0x1fdd45));delete _0x1fdd45[_0x1a1f('0x31')];if(_0x502a23===0x191){_0x502a23=0x190;}_0x41b030[_0x1a1f('0x29')](_0x502a23)[_0x1a1f('0x32')](_0x5eb40c[_0x1a1f('0x36')][_0x1a1f('0x1b')]?{'message':_0x1a1f('0x86'),'statusCode':_0x1fdd45[_0x1a1f('0x84')]}:_0x1fdd45);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 79cbd18..7258ad4 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 _0x826d=['SalesforceAccount','int_salesforce_accounts','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x826d,0x1ca));var _0xd826=function(_0x54861c,_0x8756fc){_0x54861c=_0x54861c-0x0;var _0x4786d6=_0x826d[_0x54861c];return _0x4786d6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd826('0x0'))('api');var moment=require(_0xd826('0x1'));var BPromise=require(_0xd826('0x2'));var rp=require(_0xd826('0x3'));var fs=require('fs');var path=require(_0xd826('0x4'));var rimraf=require('rimraf');var config=require(_0xd826('0x5'));var attributes=require(_0xd826('0x6'));var integrations=require(_0xd826('0x7'));module[_0xd826('0x8')]=function(_0x1b5555,_0xe661c4){return _0x1b5555[_0xd826('0x9')](_0xd826('0xa'),attributes,{'tableName':_0xd826('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0399=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0399,0x1a9));var _0x9039=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0399[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x9039('0x0'));var util=require(_0x9039('0x1'));var logger=require(_0x9039('0x2'))(_0x9039('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9039('0x4'));var fs=require('fs');var path=require(_0x9039('0x5'));var rimraf=require(_0x9039('0x6'));var config=require(_0x9039('0x7'));var attributes=require(_0x9039('0x8'));var integrations=require(_0x9039('0x9'));module[_0x9039('0xa')]=function(_0x326284,_0x5b3f10){return _0x326284[_0x9039('0xb')](_0x9039('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 72fab0b..53b59d6 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 _0x91a7=['SalesforceAccount,\x20%s,\x20%s','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','SalesforceAccount','find','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x375923,_0x3bf77f){var _0x3f15ab=function(_0x4f4037){while(--_0x4f4037){_0x375923['push'](_0x375923['shift']());}};_0x3f15ab(++_0x3bf77f);}(_0x91a7,0xe7));var _0x791a=function(_0x59ef86,_0x574972){_0x59ef86=_0x59ef86-0x0;var _0x3b148b=_0x91a7[_0x59ef86];return _0x3b148b;};'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')]('SalesforceAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('SalesforceAccount,\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')]('SalesforceAccount,\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')]('SalesforceAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});}exports[_0x791a('0x13')]=function(_0x52941d){var _0x4a84ee=this;return new Promise(function(_0x588d00,_0x40f0d3){return db['SalesforceAccount']['findAll']({'raw':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x15')]===undefined?!![]:![]:!![],'where':_0x52941d[_0x791a('0x14')]?_0x52941d['options'][_0x791a('0x16')]||null:null,'attributes':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x17')]||null:null,'limit':_0x52941d['options']?_0x52941d[_0x791a('0x14')][_0x791a('0x18')]||null:null,'include':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x52941d[_0x791a('0x14')][_0x791a('0x19')],function(_0x323c6a){return{'model':db[_0x323c6a[_0x791a('0x1b')]],'as':_0x323c6a['as'],'attributes':_0x323c6a[_0x791a('0x17')],'include':_0x323c6a['include']?_[_0x791a('0x1a')](_0x323c6a[_0x791a('0x19')],function(_0x380329){return{'model':db[_0x380329[_0x791a('0x1b')]],'as':_0x380329['as'],'attributes':_0x380329['attributes'],'include':_0x380329[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x380329['include'],function(_0xdfa84f){return{'model':db[_0xdfa84f[_0x791a('0x1b')]],'as':_0xdfa84f['as'],'attributes':_0xdfa84f[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29194d){logger[_0x791a('0xa')](_0x791a('0x13'),_0x52941d);logger[_0x791a('0xc')](_0x791a('0x13'),_0x52941d,JSON[_0x791a('0xd')](_0x29194d));_0x588d00(_0x29194d);})[_0x791a('0x12')](function(_0x889534){logger['error'](_0x791a('0x13'),_0x889534[_0x791a('0x10')],_0x52941d);_0x40f0d3(_0x4a84ee[_0x791a('0xe')](0x1f4,_0x889534['message']));});});};exports[_0x791a('0x1c')]=function(_0x5df656){var _0xc59f5e=this;return new Promise(function(_0x2e4ec8,_0xcde862){return db[_0x791a('0x1d')][_0x791a('0x1e')]({'raw':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x16')]||null:null,'attributes':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['attributes']||null:null,'include':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x5df656[_0x791a('0x14')]['include'],function(_0x305836){return{'model':db[_0x305836[_0x791a('0x1b')]],'as':_0x305836['as'],'attributes':_0x305836[_0x791a('0x17')],'include':_0x305836[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x305836['include'],function(_0xd5609){return{'model':db[_0xd5609['model']],'as':_0xd5609['as'],'attributes':_0xd5609[_0x791a('0x17')],'include':_0xd5609['include']?_['map'](_0xd5609[_0x791a('0x19')],function(_0x404530){return{'model':db[_0x404530[_0x791a('0x1b')]],'as':_0x404530['as'],'attributes':_0x404530[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x791a('0x9')](function(_0x3f46be){logger[_0x791a('0xa')]('ShowSalesforceAccount',_0x5df656);logger[_0x791a('0xc')]('ShowSalesforceAccount',_0x5df656,JSON[_0x791a('0xd')](_0x3f46be));_0x2e4ec8(_0x3f46be);})['catch'](function(_0x25e8cc){logger[_0x791a('0xe')]('ShowSalesforceAccount',_0x25e8cc[_0x791a('0x10')],_0x5df656);_0xcde862(_0xc59f5e[_0x791a('0xe')](0x1f4,_0x25e8cc['message']));});});}; \ No newline at end of file +var _0xe13a=['jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','include','model','map','debug','catch','find','ShowSalesforceAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xe13a,0x178));var _0xae13=function(_0x2507eb,_0x264c45){_0x2507eb=_0x2507eb-0x0;var _0x11d5f3=_0xe13a[_0x2507eb];return _0x11d5f3;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341ba4,_0x4ae51f,_0x2f6d10){return new BPromise(function(_0x2b2e1f,_0x27fefd){return client[_0xae13('0xc')](_0x341ba4,_0x2f6d10)[_0xae13('0xd')](function(_0x41bf44){logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));logger['debug'](_0xae13('0x11'),_0x4ae51f,_0xae13('0x10'),JSON[_0xae13('0x12')](_0x41bf44));if(_0x41bf44[_0xae13('0x13')]){if(_0x41bf44[_0xae13('0x13')][_0xae13('0x14')]===0x1f4){logger[_0xae13('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x4ae51f,_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);return _0x27fefd(_0x41bf44['error']['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4ae51f,_0x41bf44['error'][_0xae13('0x15')]);return _0x2b2e1f(_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);}else{logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));_0x2b2e1f(_0x41bf44['result'][_0xae13('0x15')]);}})['catch'](function(_0xe10aab){logger[_0xae13('0x13')](_0xae13('0xf'),_0x4ae51f,_0xe10aab);_0x27fefd(_0xe10aab);});});}exports[_0xae13('0x16')]=function(_0x1a9c07){var _0x1b33b7=this;return new Promise(function(_0x32dcbe,_0x326471){return db[_0xae13('0x17')]['findAll']({'raw':_0x1a9c07[_0xae13('0x18')]?_0x1a9c07['options'][_0xae13('0x19')]===undefined?!![]:![]:!![],'where':_0x1a9c07[_0xae13('0x18')]?_0x1a9c07['options'][_0xae13('0x1a')]||null:null,'attributes':_0x1a9c07[_0xae13('0x18')]?_0x1a9c07[_0xae13('0x18')][_0xae13('0x1b')]||null:null,'limit':_0x1a9c07[_0xae13('0x18')]?_0x1a9c07[_0xae13('0x18')]['limit']||null:null,'include':_0x1a9c07['options']?_0x1a9c07[_0xae13('0x18')][_0xae13('0x1c')]?_['map'](_0x1a9c07[_0xae13('0x18')]['include'],function(_0x13c2de){return{'model':db[_0x13c2de[_0xae13('0x1d')]],'as':_0x13c2de['as'],'attributes':_0x13c2de[_0xae13('0x1b')],'include':_0x13c2de['include']?_['map'](_0x13c2de['include'],function(_0x4edb8c){return{'model':db[_0x4edb8c[_0xae13('0x1d')]],'as':_0x4edb8c['as'],'attributes':_0x4edb8c[_0xae13('0x1b')],'include':_0x4edb8c['include']?_[_0xae13('0x1e')](_0x4edb8c['include'],function(_0x3d0d60){return{'model':db[_0x3d0d60['model']],'as':_0x3d0d60['as'],'attributes':_0x3d0d60[_0xae13('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae13('0xd')](function(_0x526e4e){logger[_0xae13('0xe')](_0xae13('0x16'),_0x1a9c07);logger[_0xae13('0x1f')](_0xae13('0x16'),_0x1a9c07,JSON['stringify'](_0x526e4e));_0x32dcbe(_0x526e4e);})[_0xae13('0x20')](function(_0x27b737){logger[_0xae13('0x13')](_0xae13('0x16'),_0x27b737[_0xae13('0x15')],_0x1a9c07);_0x326471(_0x1b33b7[_0xae13('0x13')](0x1f4,_0x27b737[_0xae13('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x133481){var _0x591f94=this;return new Promise(function(_0xf6289c,_0x100df1){return db[_0xae13('0x17')][_0xae13('0x21')]({'raw':_0x133481[_0xae13('0x18')]?_0x133481[_0xae13('0x18')][_0xae13('0x19')]===undefined?!![]:![]:!![],'where':_0x133481['options']?_0x133481['options'][_0xae13('0x1a')]||null:null,'attributes':_0x133481[_0xae13('0x18')]?_0x133481[_0xae13('0x18')][_0xae13('0x1b')]||null:null,'include':_0x133481[_0xae13('0x18')]?_0x133481[_0xae13('0x18')][_0xae13('0x1c')]?_[_0xae13('0x1e')](_0x133481[_0xae13('0x18')][_0xae13('0x1c')],function(_0x5f1aeb){return{'model':db[_0x5f1aeb[_0xae13('0x1d')]],'as':_0x5f1aeb['as'],'attributes':_0x5f1aeb[_0xae13('0x1b')],'include':_0x5f1aeb[_0xae13('0x1c')]?_['map'](_0x5f1aeb['include'],function(_0x587b6f){return{'model':db[_0x587b6f['model']],'as':_0x587b6f['as'],'attributes':_0x587b6f['attributes'],'include':_0x587b6f['include']?_[_0xae13('0x1e')](_0x587b6f[_0xae13('0x1c')],function(_0x34a801){return{'model':db[_0x34a801['model']],'as':_0x34a801['as'],'attributes':_0x34a801[_0xae13('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae13('0xd')](function(_0x40764c){logger[_0xae13('0xe')](_0xae13('0x22'),_0x133481);logger['debug'](_0xae13('0x22'),_0x133481,JSON[_0xae13('0x12')](_0x40764c));_0xf6289c(_0x40764c);})[_0xae13('0x20')](function(_0x535b0b){logger['error'](_0xae13('0x22'),_0x535b0b[_0xae13('0x15')],_0x133481);_0x100df1(_0x591f94[_0xae13('0x13')](0x1f4,_0x535b0b[_0xae13('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 974b629..a0aa4c7 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 _0xf8a5=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer'];(function(_0x4701ab,_0x418ef4){var _0x156219=function(_0x18e427){while(--_0x18e427){_0x4701ab['push'](_0x4701ab['shift']());}};_0x156219(++_0x418ef4);}(_0xf8a5,0x1c1));var _0x5f8a=function(_0x3ae7cc,_0x51e1b6){_0x3ae7cc=_0x3ae7cc-0x0;var _0x4a5b20=_0xf8a5[_0x3ae7cc];return _0x4a5b20;};'use strict';var multer=require(_0x5f8a('0x0'));var util=require(_0x5f8a('0x1'));var path=require(_0x5f8a('0x2'));var timeout=require(_0x5f8a('0x3'));var express=require(_0x5f8a('0x4'));var router=express[_0x5f8a('0x5')]();var auth=require(_0x5f8a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f8a('0x7'));var controller=require(_0x5f8a('0x8'));router[_0x5f8a('0x9')]('/',auth[_0x5f8a('0xa')](),controller[_0x5f8a('0xb')]);router[_0x5f8a('0x9')](_0x5f8a('0xc'),auth[_0x5f8a('0xa')](),controller[_0x5f8a('0xd')]);router['get'](_0x5f8a('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x5f8a('0x9')](_0x5f8a('0xf'),auth['isAuthenticated'](),controller[_0x5f8a('0x10')]);router['get'](_0x5f8a('0x11'),auth[_0x5f8a('0xa')](),controller[_0x5f8a('0x12')]);router[_0x5f8a('0x13')]('/',auth[_0x5f8a('0xa')](),controller[_0x5f8a('0x14')]);router[_0x5f8a('0x15')](_0x5f8a('0xc'),auth[_0x5f8a('0xa')](),controller[_0x5f8a('0x16')]);router[_0x5f8a('0x17')](_0x5f8a('0xc'),auth[_0x5f8a('0xa')](),controller[_0x5f8a('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb1f5=['express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3bbedc,_0x324c91){var _0xf329b2=function(_0x508255){while(--_0x508255){_0x3bbedc['push'](_0x3bbedc['shift']());}};_0xf329b2(++_0x324c91);}(_0xb1f5,0xd4));var _0x5b1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1f5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5b1f('0x0'));var util=require(_0x5b1f('0x1'));var path=require(_0x5b1f('0x2'));var timeout=require(_0x5b1f('0x3'));var express=require(_0x5b1f('0x4'));var router=express[_0x5b1f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5b1f('0x6'));var config=require(_0x5b1f('0x7'));var controller=require(_0x5b1f('0x8'));router[_0x5b1f('0x9')]('/',auth['isAuthenticated'](),controller[_0x5b1f('0xa')]);router[_0x5b1f('0x9')](_0x5b1f('0xb'),auth['isAuthenticated'](),controller[_0x5b1f('0xc')]);router[_0x5b1f('0x9')](_0x5b1f('0xd'),auth[_0x5b1f('0xe')](),controller[_0x5b1f('0xf')]);router[_0x5b1f('0x9')]('/:id/subjects',auth[_0x5b1f('0xe')](),controller[_0x5b1f('0x10')]);router[_0x5b1f('0x9')](_0x5b1f('0x11'),auth[_0x5b1f('0xe')](),controller['getDescriptions']);router[_0x5b1f('0x12')]('/',auth[_0x5b1f('0xe')](),controller[_0x5b1f('0x13')]);router['put'](_0x5b1f('0xb'),auth[_0x5b1f('0xe')](),controller[_0x5b1f('0x14')]);router[_0x5b1f('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5b1f('0x16')]);module[_0x5b1f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index bf86f76..46b94b6 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 _0x352f=['STRING','ENUM','Task','Case','contact','lead','sequelize','exports'];(function(_0x263385,_0xb99904){var _0x10950a=function(_0x1636fa){while(--_0x1636fa){_0x263385['push'](_0x263385['shift']());}};_0x10950a(++_0xb99904);}(_0x352f,0x8e));var _0xf352=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x352f[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xf352('0x0'));module[_0xf352('0x1')]={'name':{'type':Sequelize[_0xf352('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xf352('0x3')](_0xf352('0x4'),_0xf352('0x5')),'defaultValue':_0xf352('0x4')},'moduleSearch':{'type':Sequelize[_0xf352('0x3')]('contact_lead',_0xf352('0x6'),_0xf352('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xf352('0x3')]('nothing',_0xf352('0x6'),_0xf352('0x7')),'defaultValue':'lead'}}; \ No newline at end of file +var _0x782e=['lead','contact_lead','nothing','sequelize','exports','STRING','ENUM','Task','contact'];(function(_0x55283b,_0x5ceb3d){var _0x39d406=function(_0x2a3f3c){while(--_0x2a3f3c){_0x55283b['push'](_0x55283b['shift']());}};_0x39d406(++_0x5ceb3d);}(_0x782e,0xdb));var _0xe782=function(_0x385395,_0x49e03d){_0x385395=_0x385395-0x0;var _0x179203=_0x782e[_0x385395];return _0x179203;};'use strict';var Sequelize=require(_0xe782('0x0'));module[_0xe782('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe782('0x2')]},'ticketType':{'type':Sequelize[_0xe782('0x3')](_0xe782('0x4'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xe782('0x3')]('contact_lead',_0xe782('0x5'),_0xe782('0x6')),'defaultValue':_0xe782('0x7')},'moduleCreate':{'type':Sequelize[_0xe782('0x3')](_0xe782('0x8'),_0xe782('0x5'),_0xe782('0x6')),'defaultValue':_0xe782('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0181fb2..52f7ce7 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 _0xb10b=['attributes','length','nolimit','order','sort','where','filters','pick','merge','map','key','VIRTUAL','filter','options','include','rows','show','params','includeAll','find','create','body','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','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/logger','api','../../config/utils','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','apply','update','destroy','sendStatus','stack','name','index','SalesforceConfiguration','rawAttributes','keys','query','intersection','model','fields'];(function(_0x546f95,_0x2a7fed){var _0x30ea94=function(_0x420592){while(--_0x420592){_0x546f95['push'](_0x546f95['shift']());}};_0x30ea94(++_0x2a7fed);}(_0xb10b,0x12a));var _0xbb10=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xb10b[_0x18f64a];return _0x44687f;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbb10('0x18')][_0xbb10('0x19')]({'port':0x232a});function checkPasswordPattern(_0x285009,_0x193a27,_0x442548){if(_0x442548){var _0x147230=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x147230['test'](_0x193a27)){return _0x285009;}else{throw new db[(_0xbb10('0x1a'))][(_0xbb10('0x1b'))](_0xbb10('0x1c'));}}else{return _0x285009;}}function respondWithRpcPromise(_0x17fd46,_0x3df17b,_0x2f2ebf,_0x24a57b){return new BPromise(function(_0x36b5e8,_0x3e26f4){var _0x2b184e=_0x24a57b||client;return _0x2b184e['request'](_0x17fd46,_0x2f2ebf)[_0xbb10('0x1d')](function(_0x1145f1){logger[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x3df17b,_0xbb10('0x20'));logger[_0xbb10('0x21')](_0xbb10('0x22'),_0x3df17b,_0xbb10('0x20'),JSON[_0xbb10('0x23')](_0x1145f1));if(_0x1145f1[_0xbb10('0x24')]){if(_0x1145f1['error'][_0xbb10('0x25')]===0x1f4){logger[_0xbb10('0x24')](_0xbb10('0x1f'),_0x3df17b,_0x1145f1[_0xbb10('0x24')][_0xbb10('0x26')]);return _0x3e26f4(_0x1145f1[_0xbb10('0x24')]['message']);}logger[_0xbb10('0x24')](_0xbb10('0x1f'),_0x3df17b,_0x1145f1['error']['message']);return _0x36b5e8(_0x1145f1[_0xbb10('0x24')][_0xbb10('0x26')]);}else{logger[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x3df17b,_0xbb10('0x20'));_0x36b5e8(_0x1145f1[_0xbb10('0x27')][_0xbb10('0x26')]);}})[_0xbb10('0x28')](function(_0x7f2377){logger[_0xbb10('0x24')](_0xbb10('0x1f'),_0x3df17b,_0x7f2377);_0x3e26f4(_0x7f2377);});});}function respondWithStatusCode(_0x26ad93,_0x537898){_0x537898=_0x537898||0xcc;return function(_0x4fedac){if(_0x4fedac){return _0x26ad93['sendStatus'](_0x537898);}return _0x26ad93[_0xbb10('0x29')](_0x537898)[_0xbb10('0x2a')]();};}function respondWithResult(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0xc8;return function(_0x2fdde9){if(_0x2fdde9){return _0x2c89b9[_0xbb10('0x29')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);}};}function respondWithFilteredResult(_0x1d5e95,_0x1acce9){return function(_0x20d946){if(_0x20d946){var _0x2a0e8b=_0x20d946[_0xbb10('0x2c')],_0x4aabb9=_0x1acce9[_0xbb10('0x2d')],_0x3796c7=_0x1acce9[_0xbb10('0x2d')]+_0x1acce9[_0xbb10('0x2e')],_0x21ac54;if(_0x3796c7>=_0x2a0e8b){_0x3796c7=_0x2a0e8b;_0x21ac54=0xc8;}else{_0x21ac54=0xce;}_0x1d5e95['status'](_0x21ac54);return _0x1d5e95[_0xbb10('0x2f')]('Content-Range',_0x4aabb9+'-'+_0x3796c7+'/'+_0x2a0e8b)[_0xbb10('0x2b')](_0x20d946);}return null;};}function patchUpdates(_0x56f2da){return function(_0x16ad2a){try{jsonpatch[_0xbb10('0x30')](_0x16ad2a,_0x56f2da,!![]);}catch(_0x1b59f9){return BPromise['reject'](_0x1b59f9);}return _0x16ad2a['save']();};}function saveUpdates(_0x4c3744,_0x34f65e){return function(_0x4f590d){if(_0x4f590d){return _0x4f590d[_0xbb10('0x31')](_0x4c3744)[_0xbb10('0x1d')](function(_0x2f653f){return _0x2f653f;});}return null;};}function removeEntity(_0x1c0b57,_0x37a83f){return function(_0x138bc6){if(_0x138bc6){return _0x138bc6[_0xbb10('0x32')]()['then'](function(){_0x1c0b57[_0xbb10('0x29')](0xcc)[_0xbb10('0x2a')]();});}};}function handleEntityNotFound(_0x441d15,_0x8c1ce6){return function(_0xfb2c5e){if(!_0xfb2c5e){_0x441d15[_0xbb10('0x33')](0x194);}return _0xfb2c5e;};}function handleError(_0x188cbd,_0x10202c){_0x10202c=_0x10202c||0x1f4;return function(_0x3c8d7d){logger['error'](_0x3c8d7d[_0xbb10('0x34')]);if(_0x3c8d7d[_0xbb10('0x35')]){delete _0x3c8d7d[_0xbb10('0x35')];}_0x188cbd[_0xbb10('0x29')](_0x10202c)['send'](_0x3c8d7d);};}exports[_0xbb10('0x36')]=function(_0x5de37b,_0x4e2754){var _0x3eb3cc={},_0x40c164={},_0x26e76a={'count':0x0,'rows':[]};var _0x120d21=db[_0xbb10('0x37')][_0xbb10('0x38')];_0x40c164['model']=_[_0xbb10('0x39')](_0x120d21);_0x40c164[_0xbb10('0x3a')]=_['keys'](_0x5de37b['query']);_0x40c164['filters']=_[_0xbb10('0x3b')](_0x40c164[_0xbb10('0x3c')],_0x40c164[_0xbb10('0x3a')]);_0x3eb3cc['attributes']=_[_0xbb10('0x3b')](_0x40c164[_0xbb10('0x3c')],qs[_0xbb10('0x3d')](_0x5de37b['query'][_0xbb10('0x3d')]));_0x3eb3cc[_0xbb10('0x3e')]=_0x3eb3cc[_0xbb10('0x3e')][_0xbb10('0x3f')]?_0x3eb3cc['attributes']:_0x40c164[_0xbb10('0x3c')];if(!_0x5de37b[_0xbb10('0x3a')]['hasOwnProperty'](_0xbb10('0x40'))){_0x3eb3cc[_0xbb10('0x2e')]=qs[_0xbb10('0x2e')](_0x5de37b[_0xbb10('0x3a')][_0xbb10('0x2e')]);_0x3eb3cc[_0xbb10('0x2d')]=qs['offset'](_0x5de37b[_0xbb10('0x3a')][_0xbb10('0x2d')]);}_0x3eb3cc[_0xbb10('0x41')]=qs[_0xbb10('0x42')](_0x5de37b['query'][_0xbb10('0x42')]);_0x3eb3cc[_0xbb10('0x43')]=qs[_0xbb10('0x44')](_[_0xbb10('0x45')](_0x5de37b['query'],_0x40c164[_0xbb10('0x44')]));if(_0x5de37b[_0xbb10('0x3a')]['filter']){_0x3eb3cc['where']=_[_0xbb10('0x46')](_0x3eb3cc['where'],{'$or':_[_0xbb10('0x47')](_0x120d21,function(_0x180933){if(_0x180933['type'][_0xbb10('0x48')]!==_0xbb10('0x49')){var _0x474e99={};_0x474e99[_0x180933['field']]={'$like':'%'+_0x5de37b[_0xbb10('0x3a')][_0xbb10('0x4a')]+'%'};return _0x474e99;}})});}_0x3eb3cc=_[_0xbb10('0x46')]({},_0x3eb3cc,_0x5de37b[_0xbb10('0x4b')]);var _0x36e1fa={'where':_0x3eb3cc[_0xbb10('0x43')]};return db[_0xbb10('0x37')][_0xbb10('0x2c')](_0x36e1fa)[_0xbb10('0x1d')](function(_0x43b948){_0x26e76a[_0xbb10('0x2c')]=_0x43b948;if(_0x5de37b[_0xbb10('0x3a')]['includeAll']){_0x3eb3cc[_0xbb10('0x4c')]=[{'all':!![]}];}return db[_0xbb10('0x37')]['findAll'](_0x3eb3cc);})[_0xbb10('0x1d')](function(_0x2f5027){_0x26e76a[_0xbb10('0x4d')]=_0x2f5027;return _0x26e76a;})[_0xbb10('0x1d')](respondWithFilteredResult(_0x4e2754,_0x3eb3cc))[_0xbb10('0x28')](handleError(_0x4e2754,null));};exports[_0xbb10('0x4e')]=function(_0x3e06b0,_0x5be85e){var _0x4a9793={'raw':![],'where':{'id':_0x3e06b0[_0xbb10('0x4f')]['id']}},_0xcb3354={};_0xcb3354[_0xbb10('0x3c')]=_['keys'](db['SalesforceConfiguration'][_0xbb10('0x38')]);_0xcb3354[_0xbb10('0x3a')]=_[_0xbb10('0x39')](_0x3e06b0[_0xbb10('0x3a')]);_0xcb3354[_0xbb10('0x44')]=_[_0xbb10('0x3b')](_0xcb3354[_0xbb10('0x3c')],_0xcb3354[_0xbb10('0x3a')]);_0x4a9793[_0xbb10('0x3e')]=_[_0xbb10('0x3b')](_0xcb3354['model'],qs['fields'](_0x3e06b0[_0xbb10('0x3a')][_0xbb10('0x3d')]));_0x4a9793[_0xbb10('0x3e')]=_0x4a9793[_0xbb10('0x3e')][_0xbb10('0x3f')]?_0x4a9793[_0xbb10('0x3e')]:_0xcb3354[_0xbb10('0x3c')];if(_0x3e06b0[_0xbb10('0x3a')][_0xbb10('0x50')]){_0x4a9793[_0xbb10('0x4c')]=[{'all':!![]}];}_0x4a9793=_[_0xbb10('0x46')]({},_0x4a9793,_0x3e06b0[_0xbb10('0x4b')]);return db[_0xbb10('0x37')][_0xbb10('0x51')](_0x4a9793)[_0xbb10('0x1d')](handleEntityNotFound(_0x5be85e,null))['then'](respondWithResult(_0x5be85e,null))[_0xbb10('0x28')](handleError(_0x5be85e,null));};exports['create']=function(_0x33d60a,_0x2e21a0){return db[_0xbb10('0x37')][_0xbb10('0x52')](_0x33d60a[_0xbb10('0x53')],{})[_0xbb10('0x1d')](respondWithResult(_0x2e21a0,0xc9))[_0xbb10('0x28')](handleError(_0x2e21a0,null));};exports[_0xbb10('0x31')]=function(_0x180400,_0x3d71e){if(_0x180400[_0xbb10('0x53')]['id']){delete _0x180400[_0xbb10('0x53')]['id'];}return db[_0xbb10('0x37')][_0xbb10('0x51')]({'where':{'id':_0x180400[_0xbb10('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3d71e,null))[_0xbb10('0x1d')](saveUpdates(_0x180400[_0xbb10('0x53')],null))[_0xbb10('0x1d')](respondWithResult(_0x3d71e,null))[_0xbb10('0x28')](handleError(_0x3d71e,null));};exports[_0xbb10('0x32')]=function(_0x379d8c,_0x4bedd0){return db[_0xbb10('0x37')][_0xbb10('0x51')]({'where':{'id':_0x379d8c[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1d')](handleEntityNotFound(_0x4bedd0,null))[_0xbb10('0x1d')](removeEntity(_0x4bedd0,null))[_0xbb10('0x28')](handleError(_0x4bedd0,null));};exports[_0xbb10('0x54')]=function(_0x12ec18,_0x205e01,_0x40c4fb){var _0x2eb05a={};var _0x2a1ce1={};var _0x16932f;var _0x4e7fac;return db['SalesforceConfiguration'][_0xbb10('0x55')]({'where':{'id':_0x12ec18[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1d')](handleEntityNotFound(_0x205e01,null))[_0xbb10('0x1d')](function(_0x5573bb){if(_0x5573bb){_0x16932f=_0x5573bb;_0x2a1ce1['model']=_[_0xbb10('0x39')](db[_0xbb10('0x56')][_0xbb10('0x38')]);_0x2a1ce1[_0xbb10('0x3a')]=_[_0xbb10('0x39')](_0x12ec18[_0xbb10('0x3a')]);_0x2a1ce1[_0xbb10('0x44')]=_['intersection'](_0x2a1ce1[_0xbb10('0x3c')],_0x2a1ce1[_0xbb10('0x3a')]);_0x2eb05a['attributes']=_['intersection'](_0x2a1ce1['model'],qs[_0xbb10('0x3d')](_0x12ec18[_0xbb10('0x3a')][_0xbb10('0x3d')]));_0x2eb05a['attributes']=_0x2eb05a['attributes']['length']?_0x2eb05a[_0xbb10('0x3e')]:_0x2a1ce1[_0xbb10('0x3c')];_0x2eb05a[_0xbb10('0x41')]=qs['sort'](_0x12ec18[_0xbb10('0x3a')][_0xbb10('0x42')]);_0x2eb05a['where']=qs['filters'](_[_0xbb10('0x45')](_0x12ec18[_0xbb10('0x3a')],_0x2a1ce1[_0xbb10('0x44')]));if(_0x12ec18[_0xbb10('0x3a')]['filter']){_0x2eb05a[_0xbb10('0x43')]=_[_0xbb10('0x46')](_0x2eb05a[_0xbb10('0x43')],{'$or':_['map'](_0x2eb05a[_0xbb10('0x3e')],function(_0x2f05bc){var _0x3e3617={};_0x3e3617[_0x2f05bc]={'$like':'%'+_0x12ec18['query'][_0xbb10('0x4a')]+'%'};return _0x3e3617;})});}_0x2eb05a=_[_0xbb10('0x46')]({},_0x2eb05a,_0x12ec18[_0xbb10('0x4b')]);return _0x16932f[_0xbb10('0x54')](_0x2eb05a);}})['then'](function(_0x251417){if(_0x251417){_0x4e7fac=_0x251417[_0xbb10('0x3f')];if(!_0x12ec18[_0xbb10('0x3a')][_0xbb10('0x57')]('nolimit')){_0x2eb05a[_0xbb10('0x2e')]=qs[_0xbb10('0x2e')](_0x12ec18[_0xbb10('0x3a')][_0xbb10('0x2e')]);_0x2eb05a[_0xbb10('0x2d')]=qs[_0xbb10('0x2d')](_0x12ec18[_0xbb10('0x3a')]['offset']);}return _0x16932f['getFields'](_0x2eb05a);}})['then'](function(_0xdfbc0b){if(_0xdfbc0b){return _0xdfbc0b?{'count':_0x4e7fac,'rows':_0xdfbc0b}:null;}})[_0xbb10('0x1d')](respondWithResult(_0x205e01,null))[_0xbb10('0x28')](handleError(_0x205e01,null));};exports['getSubjects']=function(_0x5cd089,_0x46f462,_0x1b11c0){var _0xd9e743={};var _0x3a9677={};var _0x260e06;var _0x1ad2ed;return db['SalesforceConfiguration'][_0xbb10('0x55')]({'where':{'id':_0x5cd089[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1d')](handleEntityNotFound(_0x46f462,null))[_0xbb10('0x1d')](function(_0x2aaaa6){if(_0x2aaaa6){_0x260e06=_0x2aaaa6;_0x3a9677['model']=_['keys'](db['SalesforceField'][_0xbb10('0x38')]);_0x3a9677[_0xbb10('0x3a')]=_[_0xbb10('0x39')](_0x5cd089[_0xbb10('0x3a')]);_0x3a9677[_0xbb10('0x44')]=_[_0xbb10('0x3b')](_0x3a9677['model'],_0x3a9677[_0xbb10('0x3a')]);_0xd9e743['attributes']=_['intersection'](_0x3a9677['model'],qs[_0xbb10('0x3d')](_0x5cd089[_0xbb10('0x3a')][_0xbb10('0x3d')]));_0xd9e743[_0xbb10('0x3e')]=_0xd9e743['attributes'][_0xbb10('0x3f')]?_0xd9e743['attributes']:_0x3a9677['model'];_0xd9e743[_0xbb10('0x41')]=qs[_0xbb10('0x42')](_0x5cd089[_0xbb10('0x3a')][_0xbb10('0x42')]);_0xd9e743[_0xbb10('0x43')]=qs['filters'](_[_0xbb10('0x45')](_0x5cd089[_0xbb10('0x3a')],_0x3a9677[_0xbb10('0x44')]));if(_0x5cd089[_0xbb10('0x3a')][_0xbb10('0x4a')]){_0xd9e743[_0xbb10('0x43')]=_[_0xbb10('0x46')](_0xd9e743['where'],{'$or':_[_0xbb10('0x47')](_0xd9e743[_0xbb10('0x3e')],function(_0x30f3ea){var _0x322b41={};_0x322b41[_0x30f3ea]={'$like':'%'+_0x5cd089[_0xbb10('0x3a')][_0xbb10('0x4a')]+'%'};return _0x322b41;})});}_0xd9e743=_[_0xbb10('0x46')]({},_0xd9e743,_0x5cd089[_0xbb10('0x4b')]);return _0x260e06['getSubjects'](_0xd9e743);}})[_0xbb10('0x1d')](function(_0x218690){if(_0x218690){_0x1ad2ed=_0x218690[_0xbb10('0x3f')];if(!_0x5cd089['query']['hasOwnProperty']('nolimit')){_0xd9e743[_0xbb10('0x2e')]=qs['limit'](_0x5cd089['query'][_0xbb10('0x2e')]);_0xd9e743[_0xbb10('0x2d')]=qs[_0xbb10('0x2d')](_0x5cd089[_0xbb10('0x3a')][_0xbb10('0x2d')]);}return _0x260e06[_0xbb10('0x58')](_0xd9e743);}})[_0xbb10('0x1d')](function(_0x417304){if(_0x417304){return _0x417304?{'count':_0x1ad2ed,'rows':_0x417304}:null;}})[_0xbb10('0x1d')](respondWithResult(_0x46f462,null))['catch'](handleError(_0x46f462,null));};exports[_0xbb10('0x59')]=function(_0x1351eb,_0x46b6d2,_0x35b811){var _0x5c8eb8={};var _0x4c0795={};var _0x3547a3;var _0x2280bd;return db[_0xbb10('0x37')][_0xbb10('0x55')]({'where':{'id':_0x1351eb['params']['id']}})[_0xbb10('0x1d')](handleEntityNotFound(_0x46b6d2,null))[_0xbb10('0x1d')](function(_0x3f0d74){if(_0x3f0d74){_0x3547a3=_0x3f0d74;_0x4c0795[_0xbb10('0x3c')]=_[_0xbb10('0x39')](db['SalesforceField']['rawAttributes']);_0x4c0795[_0xbb10('0x3a')]=_[_0xbb10('0x39')](_0x1351eb[_0xbb10('0x3a')]);_0x4c0795['filters']=_[_0xbb10('0x3b')](_0x4c0795[_0xbb10('0x3c')],_0x4c0795['query']);_0x5c8eb8['attributes']=_[_0xbb10('0x3b')](_0x4c0795[_0xbb10('0x3c')],qs[_0xbb10('0x3d')](_0x1351eb['query'][_0xbb10('0x3d')]));_0x5c8eb8[_0xbb10('0x3e')]=_0x5c8eb8[_0xbb10('0x3e')][_0xbb10('0x3f')]?_0x5c8eb8[_0xbb10('0x3e')]:_0x4c0795[_0xbb10('0x3c')];_0x5c8eb8[_0xbb10('0x41')]=qs[_0xbb10('0x42')](_0x1351eb[_0xbb10('0x3a')]['sort']);_0x5c8eb8[_0xbb10('0x43')]=qs[_0xbb10('0x44')](_[_0xbb10('0x45')](_0x1351eb[_0xbb10('0x3a')],_0x4c0795[_0xbb10('0x44')]));if(_0x1351eb[_0xbb10('0x3a')][_0xbb10('0x4a')]){_0x5c8eb8[_0xbb10('0x43')]=_[_0xbb10('0x46')](_0x5c8eb8[_0xbb10('0x43')],{'$or':_[_0xbb10('0x47')](_0x5c8eb8[_0xbb10('0x3e')],function(_0x59e985){var _0x51f106={};_0x51f106[_0x59e985]={'$like':'%'+_0x1351eb[_0xbb10('0x3a')][_0xbb10('0x4a')]+'%'};return _0x51f106;})});}_0x5c8eb8=_[_0xbb10('0x46')]({},_0x5c8eb8,_0x1351eb[_0xbb10('0x4b')]);return _0x3547a3[_0xbb10('0x59')](_0x5c8eb8);}})['then'](function(_0x2749a7){if(_0x2749a7){_0x2280bd=_0x2749a7[_0xbb10('0x3f')];if(!_0x1351eb[_0xbb10('0x3a')][_0xbb10('0x57')](_0xbb10('0x40'))){_0x5c8eb8[_0xbb10('0x2e')]=qs['limit'](_0x1351eb[_0xbb10('0x3a')][_0xbb10('0x2e')]);_0x5c8eb8['offset']=qs[_0xbb10('0x2d')](_0x1351eb['query'][_0xbb10('0x2d')]);}return _0x3547a3[_0xbb10('0x59')](_0x5c8eb8);}})[_0xbb10('0x1d')](function(_0xa99bf5){if(_0xa99bf5){return _0xa99bf5?{'count':_0x2280bd,'rows':_0xa99bf5}:null;}})[_0xbb10('0x1d')](respondWithResult(_0x46b6d2,null))['catch'](handleError(_0x46b6d2,null));}; \ No newline at end of file +var _0x0713=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','destroy','stack','name','send','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','key','VIRTUAL','options','includeAll','SalesforceConfiguration','rows','show','params','include','find','create','body','getFields','findOne','SalesforceField','order','map','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x5a597a,_0xd8d6e2){var _0x52ced6=function(_0x5888ce){while(--_0x5888ce){_0x5a597a['push'](_0x5a597a['shift']());}};_0x52ced6(++_0xd8d6e2);}(_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 hardwareService=require(_0x3071('0x14'));var logger=require(_0x3071('0x15'))('api');var utils=require(_0x3071('0x16'));var config=require(_0x3071('0x17'));var db=require(_0x3071('0x18'))['db'];var jayson=require(_0x3071('0x19'));var client=jayson[_0x3071('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x5330a8,_0x1826ca,_0x5dc13b){if(_0x5dc13b){var _0x31c220=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31c220[_0x3071('0x1b')](_0x1826ca)){return _0x5330a8;}else{throw new db['Sequelize'][(_0x3071('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5330a8;}}function respondWithRpcPromise(_0x2fc15d,_0x45c93b,_0x1271d0,_0x1f14e1){return new BPromise(function(_0x1caa5d,_0x2a6a4b){var _0x157a47=_0x1f14e1||client;return _0x157a47[_0x3071('0x1d')](_0x2fc15d,_0x1271d0)[_0x3071('0x1e')](function(_0x344ea6){logger['info'](_0x3071('0x1f'),_0x45c93b,_0x3071('0x20'));logger[_0x3071('0x21')](_0x3071('0x22'),_0x45c93b,_0x3071('0x20'),JSON[_0x3071('0x23')](_0x344ea6));if(_0x344ea6[_0x3071('0x24')]){if(_0x344ea6[_0x3071('0x24')]['code']===0x1f4){logger[_0x3071('0x24')](_0x3071('0x1f'),_0x45c93b,_0x344ea6[_0x3071('0x24')]['message']);return _0x2a6a4b(_0x344ea6[_0x3071('0x24')]['message']);}logger[_0x3071('0x24')](_0x3071('0x1f'),_0x45c93b,_0x344ea6[_0x3071('0x24')][_0x3071('0x25')]);return _0x1caa5d(_0x344ea6[_0x3071('0x24')][_0x3071('0x25')]);}else{logger[_0x3071('0x26')](_0x3071('0x1f'),_0x45c93b,'request\x20sent');_0x1caa5d(_0x344ea6['result'][_0x3071('0x25')]);}})[_0x3071('0x27')](function(_0x412652){logger[_0x3071('0x24')](_0x3071('0x1f'),_0x45c93b,_0x412652);_0x2a6a4b(_0x412652);});});}function respondWithStatusCode(_0x44b45f,_0x7a4cb4){_0x7a4cb4=_0x7a4cb4||0xcc;return function(_0x1fe727){if(_0x1fe727){return _0x44b45f[_0x3071('0x28')](_0x7a4cb4);}return _0x44b45f['status'](_0x7a4cb4)[_0x3071('0x29')]();};}function respondWithResult(_0x3f1e6e,_0x177138){_0x177138=_0x177138||0xc8;return function(_0x4d5c4b){if(_0x4d5c4b){return _0x3f1e6e[_0x3071('0x2a')](_0x177138)[_0x3071('0x2b')](_0x4d5c4b);}};}function respondWithFilteredResult(_0x163604,_0x950fde){return function(_0x3fa3b8){if(_0x3fa3b8){var _0x25b96b=_0x3fa3b8[_0x3071('0x2c')],_0x177b5f=_0x950fde[_0x3071('0x2d')],_0x3921a1=_0x950fde['offset']+_0x950fde['limit'],_0x32f1b4;if(_0x3921a1>=_0x25b96b){_0x3921a1=_0x25b96b;_0x32f1b4=0xc8;}else{_0x32f1b4=0xce;}_0x163604[_0x3071('0x2a')](_0x32f1b4);return _0x163604[_0x3071('0x2e')](_0x3071('0x2f'),_0x177b5f+'-'+_0x3921a1+'/'+_0x25b96b)[_0x3071('0x2b')](_0x3fa3b8);}return null;};}function patchUpdates(_0x3f6d90){return function(_0x29538c){try{jsonpatch[_0x3071('0x30')](_0x29538c,_0x3f6d90,!![]);}catch(_0x1ccc41){return BPromise['reject'](_0x1ccc41);}return _0x29538c['save']();};}function saveUpdates(_0x4ab983,_0x1b0aaf){return function(_0x392800){if(_0x392800){return _0x392800['update'](_0x4ab983)[_0x3071('0x1e')](function(_0x28747d){return _0x28747d;});}return null;};}function removeEntity(_0x25250e,_0x13ae2c){return function(_0x5e1d2b){if(_0x5e1d2b){return _0x5e1d2b[_0x3071('0x31')]()[_0x3071('0x1e')](function(){_0x25250e[_0x3071('0x2a')](0xcc)[_0x3071('0x29')]();});}};}function handleEntityNotFound(_0x148096,_0x2068ce){return function(_0x3c55c){if(!_0x3c55c){_0x148096[_0x3071('0x28')](0x194);}return _0x3c55c;};}function handleError(_0x596cc3,_0x3988eb){_0x3988eb=_0x3988eb||0x1f4;return function(_0x54e52f){logger['error'](_0x54e52f[_0x3071('0x32')]);if(_0x54e52f[_0x3071('0x33')]){delete _0x54e52f['name'];}_0x596cc3[_0x3071('0x2a')](_0x3988eb)[_0x3071('0x34')](_0x54e52f);};}exports[_0x3071('0x35')]=function(_0x14ac42,_0xc60572){var _0x232235={},_0x5610ab={},_0x36afdc={'count':0x0,'rows':[]};var _0xd7971f=db['SalesforceConfiguration'][_0x3071('0x36')];_0x5610ab['model']=_[_0x3071('0x37')](_0xd7971f);_0x5610ab[_0x3071('0x38')]=_['keys'](_0x14ac42['query']);_0x5610ab[_0x3071('0x39')]=_[_0x3071('0x3a')](_0x5610ab[_0x3071('0x3b')],_0x5610ab['query']);_0x232235[_0x3071('0x3c')]=_['intersection'](_0x5610ab[_0x3071('0x3b')],qs['fields'](_0x14ac42[_0x3071('0x38')][_0x3071('0x3d')]));_0x232235[_0x3071('0x3c')]=_0x232235[_0x3071('0x3c')][_0x3071('0x3e')]?_0x232235['attributes']:_0x5610ab['model'];if(!_0x14ac42[_0x3071('0x38')][_0x3071('0x3f')](_0x3071('0x40'))){_0x232235[_0x3071('0x41')]=qs['limit'](_0x14ac42[_0x3071('0x38')][_0x3071('0x41')]);_0x232235[_0x3071('0x2d')]=qs[_0x3071('0x2d')](_0x14ac42[_0x3071('0x38')][_0x3071('0x2d')]);}_0x232235['order']=qs[_0x3071('0x42')](_0x14ac42['query']['sort']);_0x232235['where']=qs['filters'](_[_0x3071('0x43')](_0x14ac42[_0x3071('0x38')],_0x5610ab[_0x3071('0x39')]));if(_0x14ac42[_0x3071('0x38')][_0x3071('0x44')]){_0x232235[_0x3071('0x45')]=_[_0x3071('0x46')](_0x232235[_0x3071('0x45')],{'$or':_['map'](_0xd7971f,function(_0x1e8222){if(_0x1e8222[_0x3071('0x47')][_0x3071('0x48')]!==_0x3071('0x49')){var _0x93cbcc={};_0x93cbcc[_0x1e8222['field']]={'$like':'%'+_0x14ac42['query'][_0x3071('0x44')]+'%'};return _0x93cbcc;}})});}_0x232235=_[_0x3071('0x46')]({},_0x232235,_0x14ac42[_0x3071('0x4a')]);var _0x5c5865={'where':_0x232235[_0x3071('0x45')]};return db['SalesforceConfiguration'][_0x3071('0x2c')](_0x5c5865)['then'](function(_0x18a773){_0x36afdc['count']=_0x18a773;if(_0x14ac42['query'][_0x3071('0x4b')]){_0x232235['include']=[{'all':!![]}];}return db[_0x3071('0x4c')]['findAll'](_0x232235);})[_0x3071('0x1e')](function(_0x1d75e5){_0x36afdc[_0x3071('0x4d')]=_0x1d75e5;return _0x36afdc;})[_0x3071('0x1e')](respondWithFilteredResult(_0xc60572,_0x232235))['catch'](handleError(_0xc60572,null));};exports[_0x3071('0x4e')]=function(_0x575c12,_0xd273ec){var _0x4b6bbb={'raw':![],'where':{'id':_0x575c12[_0x3071('0x4f')]['id']}},_0x46924d={};_0x46924d['model']=_[_0x3071('0x37')](db[_0x3071('0x4c')][_0x3071('0x36')]);_0x46924d[_0x3071('0x38')]=_[_0x3071('0x37')](_0x575c12[_0x3071('0x38')]);_0x46924d[_0x3071('0x39')]=_['intersection'](_0x46924d[_0x3071('0x3b')],_0x46924d[_0x3071('0x38')]);_0x4b6bbb[_0x3071('0x3c')]=_[_0x3071('0x3a')](_0x46924d['model'],qs[_0x3071('0x3d')](_0x575c12[_0x3071('0x38')][_0x3071('0x3d')]));_0x4b6bbb[_0x3071('0x3c')]=_0x4b6bbb[_0x3071('0x3c')][_0x3071('0x3e')]?_0x4b6bbb[_0x3071('0x3c')]:_0x46924d[_0x3071('0x3b')];if(_0x575c12[_0x3071('0x38')][_0x3071('0x4b')]){_0x4b6bbb[_0x3071('0x50')]=[{'all':!![]}];}_0x4b6bbb=_[_0x3071('0x46')]({},_0x4b6bbb,_0x575c12[_0x3071('0x4a')]);return db[_0x3071('0x4c')][_0x3071('0x51')](_0x4b6bbb)[_0x3071('0x1e')](handleEntityNotFound(_0xd273ec,null))['then'](respondWithResult(_0xd273ec,null))['catch'](handleError(_0xd273ec,null));};exports[_0x3071('0x52')]=function(_0x580c04,_0x403761){return db[_0x3071('0x4c')][_0x3071('0x52')](_0x580c04['body'],{})[_0x3071('0x1e')](respondWithResult(_0x403761,0xc9))[_0x3071('0x27')](handleError(_0x403761,null));};exports['update']=function(_0x4b8ec0,_0x1b89ea){if(_0x4b8ec0[_0x3071('0x53')]['id']){delete _0x4b8ec0[_0x3071('0x53')]['id'];}return db[_0x3071('0x4c')]['find']({'where':{'id':_0x4b8ec0[_0x3071('0x4f')]['id']}})[_0x3071('0x1e')](handleEntityNotFound(_0x1b89ea,null))[_0x3071('0x1e')](saveUpdates(_0x4b8ec0[_0x3071('0x53')],null))[_0x3071('0x1e')](respondWithResult(_0x1b89ea,null))['catch'](handleError(_0x1b89ea,null));};exports[_0x3071('0x31')]=function(_0x67e36e,_0xbfce3e){return db[_0x3071('0x4c')][_0x3071('0x51')]({'where':{'id':_0x67e36e[_0x3071('0x4f')]['id']}})[_0x3071('0x1e')](handleEntityNotFound(_0xbfce3e,null))['then'](removeEntity(_0xbfce3e,null))['catch'](handleError(_0xbfce3e,null));};exports[_0x3071('0x54')]=function(_0x4de4f3,_0xe96994,_0x26ba8a){var _0x499b6a={};var _0x19dc95={};var _0x1bf911;var _0x4d3886;return db[_0x3071('0x4c')][_0x3071('0x55')]({'where':{'id':_0x4de4f3[_0x3071('0x4f')]['id']}})[_0x3071('0x1e')](handleEntityNotFound(_0xe96994,null))[_0x3071('0x1e')](function(_0x53a399){if(_0x53a399){_0x1bf911=_0x53a399;_0x19dc95[_0x3071('0x3b')]=_[_0x3071('0x37')](db[_0x3071('0x56')]['rawAttributes']);_0x19dc95[_0x3071('0x38')]=_[_0x3071('0x37')](_0x4de4f3[_0x3071('0x38')]);_0x19dc95[_0x3071('0x39')]=_[_0x3071('0x3a')](_0x19dc95[_0x3071('0x3b')],_0x19dc95[_0x3071('0x38')]);_0x499b6a[_0x3071('0x3c')]=_[_0x3071('0x3a')](_0x19dc95['model'],qs[_0x3071('0x3d')](_0x4de4f3[_0x3071('0x38')][_0x3071('0x3d')]));_0x499b6a[_0x3071('0x3c')]=_0x499b6a[_0x3071('0x3c')][_0x3071('0x3e')]?_0x499b6a[_0x3071('0x3c')]:_0x19dc95[_0x3071('0x3b')];_0x499b6a[_0x3071('0x57')]=qs[_0x3071('0x42')](_0x4de4f3[_0x3071('0x38')]['sort']);_0x499b6a[_0x3071('0x45')]=qs[_0x3071('0x39')](_[_0x3071('0x43')](_0x4de4f3[_0x3071('0x38')],_0x19dc95[_0x3071('0x39')]));if(_0x4de4f3[_0x3071('0x38')][_0x3071('0x44')]){_0x499b6a[_0x3071('0x45')]=_['merge'](_0x499b6a[_0x3071('0x45')],{'$or':_[_0x3071('0x58')](_0x499b6a['attributes'],function(_0x5d362f){var _0x147856={};_0x147856[_0x5d362f]={'$like':'%'+_0x4de4f3[_0x3071('0x38')][_0x3071('0x44')]+'%'};return _0x147856;})});}_0x499b6a=_[_0x3071('0x46')]({},_0x499b6a,_0x4de4f3['options']);return _0x1bf911['getFields'](_0x499b6a);}})[_0x3071('0x1e')](function(_0x4d54a5){if(_0x4d54a5){_0x4d3886=_0x4d54a5['length'];if(!_0x4de4f3['query']['hasOwnProperty'](_0x3071('0x40'))){_0x499b6a[_0x3071('0x41')]=qs[_0x3071('0x41')](_0x4de4f3['query'][_0x3071('0x41')]);_0x499b6a[_0x3071('0x2d')]=qs[_0x3071('0x2d')](_0x4de4f3[_0x3071('0x38')]['offset']);}return _0x1bf911[_0x3071('0x54')](_0x499b6a);}})[_0x3071('0x1e')](function(_0x588406){if(_0x588406){return _0x588406?{'count':_0x4d3886,'rows':_0x588406}:null;}})[_0x3071('0x1e')](respondWithResult(_0xe96994,null))[_0x3071('0x27')](handleError(_0xe96994,null));};exports[_0x3071('0x59')]=function(_0x40c258,_0x4edd23,_0x11ffdd){var _0x2deac2={};var _0x5d83aa={};var _0x5dde93;var _0x21c1e3;return db[_0x3071('0x4c')][_0x3071('0x55')]({'where':{'id':_0x40c258['params']['id']}})['then'](handleEntityNotFound(_0x4edd23,null))[_0x3071('0x1e')](function(_0x3d91cf){if(_0x3d91cf){_0x5dde93=_0x3d91cf;_0x5d83aa[_0x3071('0x3b')]=_[_0x3071('0x37')](db[_0x3071('0x56')][_0x3071('0x36')]);_0x5d83aa[_0x3071('0x38')]=_[_0x3071('0x37')](_0x40c258['query']);_0x5d83aa[_0x3071('0x39')]=_['intersection'](_0x5d83aa[_0x3071('0x3b')],_0x5d83aa[_0x3071('0x38')]);_0x2deac2[_0x3071('0x3c')]=_[_0x3071('0x3a')](_0x5d83aa[_0x3071('0x3b')],qs[_0x3071('0x3d')](_0x40c258[_0x3071('0x38')][_0x3071('0x3d')]));_0x2deac2['attributes']=_0x2deac2[_0x3071('0x3c')][_0x3071('0x3e')]?_0x2deac2[_0x3071('0x3c')]:_0x5d83aa['model'];_0x2deac2[_0x3071('0x57')]=qs[_0x3071('0x42')](_0x40c258[_0x3071('0x38')]['sort']);_0x2deac2['where']=qs[_0x3071('0x39')](_['pick'](_0x40c258[_0x3071('0x38')],_0x5d83aa[_0x3071('0x39')]));if(_0x40c258[_0x3071('0x38')][_0x3071('0x44')]){_0x2deac2[_0x3071('0x45')]=_[_0x3071('0x46')](_0x2deac2[_0x3071('0x45')],{'$or':_['map'](_0x2deac2[_0x3071('0x3c')],function(_0x5e2b17){var _0x42d310={};_0x42d310[_0x5e2b17]={'$like':'%'+_0x40c258[_0x3071('0x38')][_0x3071('0x44')]+'%'};return _0x42d310;})});}_0x2deac2=_[_0x3071('0x46')]({},_0x2deac2,_0x40c258[_0x3071('0x4a')]);return _0x5dde93[_0x3071('0x59')](_0x2deac2);}})['then'](function(_0x254adf){if(_0x254adf){_0x21c1e3=_0x254adf['length'];if(!_0x40c258[_0x3071('0x38')][_0x3071('0x3f')](_0x3071('0x40'))){_0x2deac2[_0x3071('0x41')]=qs[_0x3071('0x41')](_0x40c258[_0x3071('0x38')][_0x3071('0x41')]);_0x2deac2[_0x3071('0x2d')]=qs[_0x3071('0x2d')](_0x40c258[_0x3071('0x38')]['offset']);}return _0x5dde93[_0x3071('0x59')](_0x2deac2);}})[_0x3071('0x1e')](function(_0x4cf887){if(_0x4cf887){return _0x4cf887?{'count':_0x21c1e3,'rows':_0x4cf887}:null;}})[_0x3071('0x1e')](respondWithResult(_0x4edd23,null))[_0x3071('0x27')](handleError(_0x4edd23,null));};exports[_0x3071('0x5a')]=function(_0x4abbec,_0x37a707,_0x5c39b1){var _0x5a7d28={};var _0x3d2860={};var _0x4da539;var _0x2e6103;return db[_0x3071('0x4c')][_0x3071('0x55')]({'where':{'id':_0x4abbec[_0x3071('0x4f')]['id']}})[_0x3071('0x1e')](handleEntityNotFound(_0x37a707,null))[_0x3071('0x1e')](function(_0x568386){if(_0x568386){_0x4da539=_0x568386;_0x3d2860[_0x3071('0x3b')]=_[_0x3071('0x37')](db[_0x3071('0x56')][_0x3071('0x36')]);_0x3d2860['query']=_[_0x3071('0x37')](_0x4abbec[_0x3071('0x38')]);_0x3d2860['filters']=_[_0x3071('0x3a')](_0x3d2860[_0x3071('0x3b')],_0x3d2860[_0x3071('0x38')]);_0x5a7d28[_0x3071('0x3c')]=_[_0x3071('0x3a')](_0x3d2860['model'],qs[_0x3071('0x3d')](_0x4abbec['query'][_0x3071('0x3d')]));_0x5a7d28[_0x3071('0x3c')]=_0x5a7d28[_0x3071('0x3c')][_0x3071('0x3e')]?_0x5a7d28[_0x3071('0x3c')]:_0x3d2860[_0x3071('0x3b')];_0x5a7d28[_0x3071('0x57')]=qs[_0x3071('0x42')](_0x4abbec['query'][_0x3071('0x42')]);_0x5a7d28[_0x3071('0x45')]=qs[_0x3071('0x39')](_['pick'](_0x4abbec[_0x3071('0x38')],_0x3d2860['filters']));if(_0x4abbec[_0x3071('0x38')][_0x3071('0x44')]){_0x5a7d28[_0x3071('0x45')]=_['merge'](_0x5a7d28[_0x3071('0x45')],{'$or':_[_0x3071('0x58')](_0x5a7d28[_0x3071('0x3c')],function(_0x9cc58c){var _0x23c242={};_0x23c242[_0x9cc58c]={'$like':'%'+_0x4abbec[_0x3071('0x38')][_0x3071('0x44')]+'%'};return _0x23c242;})});}_0x5a7d28=_[_0x3071('0x46')]({},_0x5a7d28,_0x4abbec[_0x3071('0x4a')]);return _0x4da539['getDescriptions'](_0x5a7d28);}})[_0x3071('0x1e')](function(_0xd4ef21){if(_0xd4ef21){_0x2e6103=_0xd4ef21[_0x3071('0x3e')];if(!_0x4abbec['query']['hasOwnProperty']('nolimit')){_0x5a7d28['limit']=qs['limit'](_0x4abbec[_0x3071('0x38')][_0x3071('0x41')]);_0x5a7d28['offset']=qs[_0x3071('0x2d')](_0x4abbec[_0x3071('0x38')][_0x3071('0x2d')]);}return _0x4da539['getDescriptions'](_0x5a7d28);}})['then'](function(_0x24277a){if(_0x24277a){return _0x24277a?{'count':_0x2e6103,'rows':_0x24277a}:null;}})[_0x3071('0x1e')](respondWithResult(_0x37a707,null))[_0x3071('0x27')](handleError(_0x37a707,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 5ae9053..0604d91 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 _0x3ac4=['request-promise','rimraf','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','../../config/logger','api','moment'];(function(_0x2a0ced,_0x30aa6a){var _0x383265=function(_0x40dd0d){while(--_0x40dd0d){_0x2a0ced['push'](_0x2a0ced['shift']());}};_0x383265(++_0x30aa6a);}(_0x3ac4,0x1c5));var _0x43ac=function(_0x47dad0,_0x4752d3){_0x47dad0=_0x47dad0-0x0;var _0x43d82e=_0x3ac4[_0x47dad0];return _0x43d82e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x43ac('0x0'))(_0x43ac('0x1'));var moment=require(_0x43ac('0x2'));var BPromise=require('bluebird');var rp=require(_0x43ac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43ac('0x4'));var config=require('../../config/environment');var attributes=require(_0x43ac('0x5'));module[_0x43ac('0x6')]=function(_0x708d7e,_0x4bf3eb){return _0x708d7e['define']('SalesforceConfiguration',attributes,{'tableName':_0x43ac('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e7=['../../config/environment','exports','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x70e7,0x17f));var _0x770e=function(_0x2fd388,_0x32cc51){_0x2fd388=_0x2fd388-0x0;var _0x7b30ab=_0x70e7[_0x2fd388];return _0x7b30ab;};'use strict';var _=require(_0x770e('0x0'));var util=require(_0x770e('0x1'));var logger=require(_0x770e('0x2'))(_0x770e('0x3'));var moment=require(_0x770e('0x4'));var BPromise=require(_0x770e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x770e('0x6'));var config=require(_0x770e('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x770e('0x8')]=function(_0x4194b0,_0x2afaa8){return _0x4194b0['define'](_0x770e('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 3706dd7..bc6ca61 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 _0x4efd=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x42e09b,_0x486530){var _0x24d1fc=function(_0x207ab1){while(--_0x207ab1){_0x42e09b['push'](_0x42e09b['shift']());}};_0x24d1fc(++_0x486530);}(_0x4efd,0x136));var _0xd4ef=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x4efd[_0xf80b3];return _0x10c489;};'use strict';var _=require('lodash');var util=require(_0xd4ef('0x0'));var moment=require(_0xd4ef('0x1'));var BPromise=require(_0xd4ef('0x2'));var rs=require(_0xd4ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4ef('0x4'))['db'];var utils=require(_0xd4ef('0x5'));var logger=require(_0xd4ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd4ef('0x7'));var client=jayson[_0xd4ef('0x8')][_0xd4ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47847a,_0x5898eb,_0x46e809){return new BPromise(function(_0x173fcd,_0x431e5f){return client[_0xd4ef('0xa')](_0x47847a,_0x46e809)[_0xd4ef('0xb')](function(_0x5424b7){logger[_0xd4ef('0xc')](_0xd4ef('0xd'),_0x5898eb,_0xd4ef('0xe'));logger[_0xd4ef('0xf')](_0xd4ef('0x10'),_0x5898eb,_0xd4ef('0xe'),JSON[_0xd4ef('0x11')](_0x5424b7));if(_0x5424b7['error']){if(_0x5424b7[_0xd4ef('0x12')][_0xd4ef('0x13')]===0x1f4){logger[_0xd4ef('0x12')](_0xd4ef('0xd'),_0x5898eb,_0x5424b7[_0xd4ef('0x12')][_0xd4ef('0x14')]);return _0x431e5f(_0x5424b7['error'][_0xd4ef('0x14')]);}logger[_0xd4ef('0x12')](_0xd4ef('0xd'),_0x5898eb,_0x5424b7[_0xd4ef('0x12')][_0xd4ef('0x14')]);return _0x173fcd(_0x5424b7['error'][_0xd4ef('0x14')]);}else{logger[_0xd4ef('0xc')](_0xd4ef('0xd'),_0x5898eb,_0xd4ef('0xe'));_0x173fcd(_0x5424b7[_0xd4ef('0x15')][_0xd4ef('0x14')]);}})[_0xd4ef('0x16')](function(_0x1a79af){logger[_0xd4ef('0x12')](_0xd4ef('0xd'),_0x5898eb,_0x1a79af);_0x431e5f(_0x1a79af);});});} \ No newline at end of file +var _0x2301=['code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2301,0x77));var _0x1230=function(_0x265721,_0x1503f2){_0x265721=_0x265721-0x0;var _0x11ec95=_0x2301[_0x265721];return _0x11ec95;};'use strict';var _=require(_0x1230('0x0'));var util=require(_0x1230('0x1'));var moment=require(_0x1230('0x2'));var BPromise=require('bluebird');var rs=require(_0x1230('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1230('0x4'))['db'];var utils=require(_0x1230('0x5'));var logger=require(_0x1230('0x6'))(_0x1230('0x7'));var config=require(_0x1230('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1230('0x9')][_0x1230('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x400349,_0x8d7cec,_0x5a6aa1){return new BPromise(function(_0x32da0f,_0x15a674){return client[_0x1230('0xb')](_0x400349,_0x5a6aa1)[_0x1230('0xc')](function(_0x3ab45d){logger[_0x1230('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x8d7cec,'request\x20sent');logger[_0x1230('0xe')](_0x1230('0xf'),_0x8d7cec,_0x1230('0x10'),JSON[_0x1230('0x11')](_0x3ab45d));if(_0x3ab45d['error']){if(_0x3ab45d[_0x1230('0x12')][_0x1230('0x13')]===0x1f4){logger[_0x1230('0x12')](_0x1230('0x14'),_0x8d7cec,_0x3ab45d['error']['message']);return _0x15a674(_0x3ab45d[_0x1230('0x12')][_0x1230('0x15')]);}logger[_0x1230('0x12')](_0x1230('0x14'),_0x8d7cec,_0x3ab45d[_0x1230('0x12')][_0x1230('0x15')]);return _0x32da0f(_0x3ab45d[_0x1230('0x12')][_0x1230('0x15')]);}else{logger[_0x1230('0xd')](_0x1230('0x14'),_0x8d7cec,'request\x20sent');_0x32da0f(_0x3ab45d[_0x1230('0x16')][_0x1230('0x15')]);}})['catch'](function(_0x476600){logger[_0x1230('0x12')](_0x1230('0x14'),_0x8d7cec,_0x476600);_0x15a674(_0x476600);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 65fb52a..aead063 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 _0xd046=['Router','../../config/environment','get','/:id','post','isAuthenticated','update','destroy','exports','util','path','connect-timeout'];(function(_0x24e19c,_0x1eec14){var _0x188fac=function(_0xeac31d){while(--_0xeac31d){_0x24e19c['push'](_0x24e19c['shift']());}};_0x188fac(++_0x1eec14);}(_0xd046,0x129));var _0x6d04=function(_0x50d2b6,_0x2e04d2){_0x50d2b6=_0x50d2b6-0x0;var _0x258c35=_0xd046[_0x50d2b6];return _0x258c35;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d04('0x4'));var controller=require('./intSalesforceField.controller');router[_0x6d04('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d04('0x5')](_0x6d04('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x6d04('0x7')]('/',auth[_0x6d04('0x8')](),controller['create']);router['put'](_0x6d04('0x6'),auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6d04('0xa')]);module[_0x6d04('0xb')]=router; \ No newline at end of file +var _0x5496=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','put','update','delete','exports','multer'];(function(_0x2ba68e,_0x4482a6){var _0x4154b1=function(_0x402516){while(--_0x402516){_0x2ba68e['push'](_0x2ba68e['shift']());}};_0x4154b1(++_0x4482a6);}(_0x5496,0x175));var _0x6549=function(_0x1e9446,_0x153ea2){_0x1e9446=_0x1e9446-0x0;var _0x164730=_0x5496[_0x1e9446];return _0x164730;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var auth=require(_0x6549('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6549('0x6'));var controller=require(_0x6549('0x7'));router[_0x6549('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6549('0x8')](_0x6549('0x9'),auth['isAuthenticated'](),controller[_0x6549('0xa')]);router[_0x6549('0xb')]('/',auth[_0x6549('0xc')](),controller['create']);router[_0x6549('0xd')](_0x6549('0x9'),auth[_0x6549('0xc')](),controller[_0x6549('0xe')]);router[_0x6549('0xf')](_0x6549('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x6549('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e557ba1..4e951df 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 _0x9468=['string','customVariable','keyValue','STRING','ENUM','sequelize','exports'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x9468,0x132));var _0x8946=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x9468[_0x4914e2];return _0x2dcd07;};'use strict';var Sequelize=require(_0x8946('0x0'));module[_0x8946('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8946('0x2'),'variable',_0x8946('0x3'),_0x8946('0x4')),'defaultValue':_0x8946('0x2')},'content':{'type':Sequelize[_0x8946('0x5')]},'key':{'type':Sequelize[_0x8946('0x5')]},'keyType':{'type':Sequelize[_0x8946('0x6')](_0x8946('0x2'),'variable',_0x8946('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8946('0x5')]},'variableName':{'type':Sequelize[_0x8946('0x5')]}}; \ No newline at end of file +var _0x9259=['string','variable','customVariable','STRING','ENUM','sequelize','exports'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x9259,0xad));var _0x9925=function(_0x3bb21a,_0x353b56){_0x3bb21a=_0x3bb21a-0x0;var _0x5f3983=_0x9259[_0x3bb21a];return _0x5f3983;};'use strict';var Sequelize=require(_0x9925('0x0'));module[_0x9925('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9925('0x2'),_0x9925('0x3'),_0x9925('0x4'),'keyValue'),'defaultValue':_0x9925('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9925('0x5')]},'keyType':{'type':Sequelize[_0x9925('0x6')](_0x9925('0x2'),_0x9925('0x3'),_0x9925('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9925('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 4565784..93a8dc7 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 _0x5da6=['includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','destroy','then','end','error','stack','name','SalesforceField','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','map','type','key','options'];(function(_0x552041,_0xc34ee7){var _0x198a1a=function(_0x432f54){while(--_0x432f54){_0x552041['push'](_0x552041['shift']());}};_0x198a1a(++_0xc34ee7);}(_0x5da6,0x1c0));var _0x65da=function(_0x2e30c6,_0x40a809){_0x2e30c6=_0x2e30c6-0x0;var _0x470e59=_0x5da6[_0x2e30c6];return _0x470e59;};'use strict';var pdf=require(_0x65da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x65da('0x1'));var zipdir=require(_0x65da('0x2'));var jsonpatch=require(_0x65da('0x3'));var rp=require(_0x65da('0x4'));var moment=require(_0x65da('0x5'));var BPromise=require(_0x65da('0x6'));var Mustache=require(_0x65da('0x7'));var util=require('util');var path=require(_0x65da('0x8'));var sox=require(_0x65da('0x9'));var csv=require(_0x65da('0xa'));var ejs=require(_0x65da('0xb'));var fs=require('fs');var _=require(_0x65da('0xc'));var squel=require(_0x65da('0xd'));var crypto=require(_0x65da('0xe'));var jsforce=require(_0x65da('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x65da('0x10'));var Papa=require(_0x65da('0x11'));var Redis=require('ioredis');var authService=require(_0x65da('0x12'));var qs=require(_0x65da('0x13'));var hardwareService=require(_0x65da('0x14'));var logger=require(_0x65da('0x15'))(_0x65da('0x16'));var utils=require(_0x65da('0x17'));var config=require(_0x65da('0x18'));var db=require(_0x65da('0x19'))['db'];function respondWithStatusCode(_0x17756c,_0x59fb04){_0x59fb04=_0x59fb04||0xcc;return function(_0x1d0ffb){if(_0x1d0ffb){return _0x17756c[_0x65da('0x1a')](_0x59fb04);}return _0x17756c[_0x65da('0x1b')](_0x59fb04)['end']();};}function respondWithResult(_0x4fb0ba,_0x52e7ed){_0x52e7ed=_0x52e7ed||0xc8;return function(_0x453561){if(_0x453561){return _0x4fb0ba[_0x65da('0x1b')](_0x52e7ed)[_0x65da('0x1c')](_0x453561);}};}function respondWithFilteredResult(_0x53ba1a,_0x4b9b64){return function(_0x592f26){if(_0x592f26){var _0x3c1a0e=_0x592f26[_0x65da('0x1d')],_0x4d8dff=_0x4b9b64[_0x65da('0x1e')],_0xb4212c=_0x4b9b64[_0x65da('0x1e')]+_0x4b9b64['limit'],_0x4dc78a;if(_0xb4212c>=_0x3c1a0e){_0xb4212c=_0x3c1a0e;_0x4dc78a=0xc8;}else{_0x4dc78a=0xce;}_0x53ba1a[_0x65da('0x1b')](_0x4dc78a);return _0x53ba1a[_0x65da('0x1f')](_0x65da('0x20'),_0x4d8dff+'-'+_0xb4212c+'/'+_0x3c1a0e)[_0x65da('0x1c')](_0x592f26);}return null;};}function patchUpdates(_0x3a955f){return function(_0x1da974){try{jsonpatch[_0x65da('0x21')](_0x1da974,_0x3a955f,!![]);}catch(_0x4e1f61){return BPromise['reject'](_0x4e1f61);}return _0x1da974[_0x65da('0x22')]();};}function saveUpdates(_0x4af804,_0x572152){return function(_0x12265d){if(_0x12265d){return _0x12265d['update'](_0x4af804)['then'](function(_0x18289f){return _0x18289f;});}return null;};}function removeEntity(_0x4882d3,_0x2932c4){return function(_0x41bfec){if(_0x41bfec){return _0x41bfec[_0x65da('0x23')]()[_0x65da('0x24')](function(){_0x4882d3['status'](0xcc)[_0x65da('0x25')]();});}};}function handleEntityNotFound(_0x344596,_0x1ab2d6){return function(_0x43f53f){if(!_0x43f53f){_0x344596[_0x65da('0x1a')](0x194);}return _0x43f53f;};}function handleError(_0x5998b8,_0x5080c7){_0x5080c7=_0x5080c7||0x1f4;return function(_0x2a31e0){logger[_0x65da('0x26')](_0x2a31e0[_0x65da('0x27')]);if(_0x2a31e0[_0x65da('0x28')]){delete _0x2a31e0[_0x65da('0x28')];}_0x5998b8[_0x65da('0x1b')](_0x5080c7)['send'](_0x2a31e0);};}exports['index']=function(_0x1528ed,_0x3f5eab){var _0x3bbd92={},_0x5278e2={},_0x40e539={'count':0x0,'rows':[]};var _0x3712ec=db[_0x65da('0x29')][_0x65da('0x2a')];_0x5278e2[_0x65da('0x2b')]=_['keys'](_0x3712ec);_0x5278e2[_0x65da('0x2c')]=_[_0x65da('0x2d')](_0x1528ed[_0x65da('0x2c')]);_0x5278e2[_0x65da('0x2e')]=_[_0x65da('0x2f')](_0x5278e2[_0x65da('0x2b')],_0x5278e2[_0x65da('0x2c')]);_0x3bbd92['attributes']=_['intersection'](_0x5278e2[_0x65da('0x2b')],qs['fields'](_0x1528ed[_0x65da('0x2c')][_0x65da('0x30')]));_0x3bbd92[_0x65da('0x31')]=_0x3bbd92[_0x65da('0x31')][_0x65da('0x32')]?_0x3bbd92[_0x65da('0x31')]:_0x5278e2[_0x65da('0x2b')];if(!_0x1528ed[_0x65da('0x2c')]['hasOwnProperty'](_0x65da('0x33'))){_0x3bbd92[_0x65da('0x34')]=qs[_0x65da('0x34')](_0x1528ed[_0x65da('0x2c')]['limit']);_0x3bbd92[_0x65da('0x1e')]=qs[_0x65da('0x1e')](_0x1528ed[_0x65da('0x2c')][_0x65da('0x1e')]);}_0x3bbd92[_0x65da('0x35')]=qs[_0x65da('0x36')](_0x1528ed[_0x65da('0x2c')]['sort']);_0x3bbd92[_0x65da('0x37')]=qs[_0x65da('0x2e')](_[_0x65da('0x38')](_0x1528ed[_0x65da('0x2c')],_0x5278e2[_0x65da('0x2e')]));if(_0x1528ed['query'][_0x65da('0x39')]){_0x3bbd92[_0x65da('0x37')]=_[_0x65da('0x3a')](_0x3bbd92[_0x65da('0x37')],{'$or':_[_0x65da('0x3b')](_0x3712ec,function(_0x538cc6){if(_0x538cc6[_0x65da('0x3c')][_0x65da('0x3d')]!=='VIRTUAL'){var _0x1670c4={};_0x1670c4[_0x538cc6['field']]={'$like':'%'+_0x1528ed['query'][_0x65da('0x39')]+'%'};return _0x1670c4;}})});}_0x3bbd92=_[_0x65da('0x3a')]({},_0x3bbd92,_0x1528ed[_0x65da('0x3e')]);var _0x3fc2d2={'where':_0x3bbd92[_0x65da('0x37')]};return db['SalesforceField']['count'](_0x3fc2d2)[_0x65da('0x24')](function(_0x4282d1){_0x40e539[_0x65da('0x1d')]=_0x4282d1;if(_0x1528ed[_0x65da('0x2c')][_0x65da('0x3f')]){_0x3bbd92[_0x65da('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x65da('0x41')](_0x3bbd92);})[_0x65da('0x24')](function(_0x22774e){_0x40e539[_0x65da('0x42')]=_0x22774e;return _0x40e539;})[_0x65da('0x24')](respondWithFilteredResult(_0x3f5eab,_0x3bbd92))[_0x65da('0x43')](handleError(_0x3f5eab,null));};exports[_0x65da('0x44')]=function(_0xadfd79,_0x1bcf00){var _0x410bad={'raw':!![],'where':{'id':_0xadfd79[_0x65da('0x45')]['id']}},_0x5bb42f={};_0x5bb42f[_0x65da('0x2b')]=_['keys'](db[_0x65da('0x29')][_0x65da('0x2a')]);_0x5bb42f['query']=_[_0x65da('0x2d')](_0xadfd79[_0x65da('0x2c')]);_0x5bb42f[_0x65da('0x2e')]=_[_0x65da('0x2f')](_0x5bb42f['model'],_0x5bb42f[_0x65da('0x2c')]);_0x410bad[_0x65da('0x31')]=_[_0x65da('0x2f')](_0x5bb42f[_0x65da('0x2b')],qs[_0x65da('0x30')](_0xadfd79[_0x65da('0x2c')]['fields']));_0x410bad[_0x65da('0x31')]=_0x410bad[_0x65da('0x31')]['length']?_0x410bad['attributes']:_0x5bb42f[_0x65da('0x2b')];if(_0xadfd79['query'][_0x65da('0x3f')]){_0x410bad['include']=[{'all':!![]}];}_0x410bad=_['merge']({},_0x410bad,_0xadfd79[_0x65da('0x3e')]);return db['SalesforceField'][_0x65da('0x46')](_0x410bad)['then'](handleEntityNotFound(_0x1bcf00,null))[_0x65da('0x24')](respondWithResult(_0x1bcf00,null))[_0x65da('0x43')](handleError(_0x1bcf00,null));};exports[_0x65da('0x47')]=function(_0x3d19d7,_0xf87357){return db[_0x65da('0x29')][_0x65da('0x47')](_0x3d19d7[_0x65da('0x48')],{})[_0x65da('0x24')](respondWithResult(_0xf87357,0xc9))[_0x65da('0x43')](handleError(_0xf87357,null));};exports['update']=function(_0x4080f1,_0x56f3f7){if(_0x4080f1['body']['id']){delete _0x4080f1[_0x65da('0x48')]['id'];}return db[_0x65da('0x29')]['find']({'where':{'id':_0x4080f1[_0x65da('0x45')]['id']}})[_0x65da('0x24')](handleEntityNotFound(_0x56f3f7,null))[_0x65da('0x24')](saveUpdates(_0x4080f1[_0x65da('0x48')],null))[_0x65da('0x24')](respondWithResult(_0x56f3f7,null))['catch'](handleError(_0x56f3f7,null));};exports[_0x65da('0x23')]=function(_0x2c10c4,_0x3e58ff){return db[_0x65da('0x29')]['find']({'where':{'id':_0x2c10c4[_0x65da('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e58ff,null))[_0x65da('0x24')](removeEntity(_0x3e58ff,null))[_0x65da('0x43')](handleError(_0x3e58ff,null));}; \ No newline at end of file +var _0x917a=['intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','map','key','VIRTUAL','field','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','SalesforceField','model','keys','query','filters'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x917a,0x69));var _0xa917=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x917a[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xa917('0x0'));var emlformat=require(_0xa917('0x1'));var rimraf=require(_0xa917('0x2'));var zipdir=require(_0xa917('0x3'));var jsonpatch=require(_0xa917('0x4'));var rp=require(_0xa917('0x5'));var moment=require(_0xa917('0x6'));var BPromise=require(_0xa917('0x7'));var Mustache=require(_0xa917('0x8'));var util=require(_0xa917('0x9'));var path=require(_0xa917('0xa'));var sox=require(_0xa917('0xb'));var csv=require('to-csv');var ejs=require(_0xa917('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa917('0xd'));var jsforce=require(_0xa917('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa917('0xf'));var querystring=require(_0xa917('0x10'));var Papa=require('papaparse');var Redis=require(_0xa917('0x11'));var authService=require(_0xa917('0x12'));var qs=require(_0xa917('0x13'));var hardwareService=require(_0xa917('0x14'));var logger=require(_0xa917('0x15'))('api');var utils=require(_0xa917('0x16'));var config=require(_0xa917('0x17'));var db=require(_0xa917('0x18'))['db'];function respondWithStatusCode(_0x1760df,_0x4a2461){_0x4a2461=_0x4a2461||0xcc;return function(_0x3dae7e){if(_0x3dae7e){return _0x1760df[_0xa917('0x19')](_0x4a2461);}return _0x1760df[_0xa917('0x1a')](_0x4a2461)['end']();};}function respondWithResult(_0x4db8f3,_0x1b6d42){_0x1b6d42=_0x1b6d42||0xc8;return function(_0x373c8d){if(_0x373c8d){return _0x4db8f3['status'](_0x1b6d42)[_0xa917('0x1b')](_0x373c8d);}};}function respondWithFilteredResult(_0x50699f,_0x2b8c9e){return function(_0x53548e){if(_0x53548e){var _0xd05e4c=_0x53548e[_0xa917('0x1c')],_0x3da244=_0x2b8c9e[_0xa917('0x1d')],_0x5e6842=_0x2b8c9e[_0xa917('0x1d')]+_0x2b8c9e['limit'],_0x32c51d;if(_0x5e6842>=_0xd05e4c){_0x5e6842=_0xd05e4c;_0x32c51d=0xc8;}else{_0x32c51d=0xce;}_0x50699f[_0xa917('0x1a')](_0x32c51d);return _0x50699f[_0xa917('0x1e')](_0xa917('0x1f'),_0x3da244+'-'+_0x5e6842+'/'+_0xd05e4c)[_0xa917('0x1b')](_0x53548e);}return null;};}function patchUpdates(_0x287b4f){return function(_0x5d336d){try{jsonpatch['apply'](_0x5d336d,_0x287b4f,!![]);}catch(_0x3acbad){return BPromise[_0xa917('0x20')](_0x3acbad);}return _0x5d336d['save']();};}function saveUpdates(_0x54c70a,_0x55cca9){return function(_0x42fc91){if(_0x42fc91){return _0x42fc91[_0xa917('0x21')](_0x54c70a)[_0xa917('0x22')](function(_0x536b7d){return _0x536b7d;});}return null;};}function removeEntity(_0x326007,_0x4671ed){return function(_0x1fd909){if(_0x1fd909){return _0x1fd909[_0xa917('0x23')]()[_0xa917('0x22')](function(){_0x326007[_0xa917('0x1a')](0xcc)[_0xa917('0x24')]();});}};}function handleEntityNotFound(_0x4c6891,_0x58da40){return function(_0x1e75a7){if(!_0x1e75a7){_0x4c6891[_0xa917('0x19')](0x194);}return _0x1e75a7;};}function handleError(_0x39c8ec,_0x268174){_0x268174=_0x268174||0x1f4;return function(_0x2d6d65){logger[_0xa917('0x25')](_0x2d6d65[_0xa917('0x26')]);if(_0x2d6d65[_0xa917('0x27')]){delete _0x2d6d65[_0xa917('0x27')];}_0x39c8ec[_0xa917('0x1a')](_0x268174)[_0xa917('0x28')](_0x2d6d65);};}exports[_0xa917('0x29')]=function(_0x5ca160,_0x49e63e){var _0x4ae7f0={},_0x4770ab={},_0x238337={'count':0x0,'rows':[]};var _0x4f0700=db[_0xa917('0x2a')]['rawAttributes'];_0x4770ab[_0xa917('0x2b')]=_[_0xa917('0x2c')](_0x4f0700);_0x4770ab[_0xa917('0x2d')]=_[_0xa917('0x2c')](_0x5ca160[_0xa917('0x2d')]);_0x4770ab[_0xa917('0x2e')]=_[_0xa917('0x2f')](_0x4770ab['model'],_0x4770ab[_0xa917('0x2d')]);_0x4ae7f0[_0xa917('0x30')]=_[_0xa917('0x2f')](_0x4770ab[_0xa917('0x2b')],qs['fields'](_0x5ca160['query'][_0xa917('0x31')]));_0x4ae7f0[_0xa917('0x30')]=_0x4ae7f0[_0xa917('0x30')][_0xa917('0x32')]?_0x4ae7f0[_0xa917('0x30')]:_0x4770ab[_0xa917('0x2b')];if(!_0x5ca160[_0xa917('0x2d')][_0xa917('0x33')](_0xa917('0x34'))){_0x4ae7f0[_0xa917('0x35')]=qs[_0xa917('0x35')](_0x5ca160[_0xa917('0x2d')][_0xa917('0x35')]);_0x4ae7f0[_0xa917('0x1d')]=qs[_0xa917('0x1d')](_0x5ca160[_0xa917('0x2d')]['offset']);}_0x4ae7f0[_0xa917('0x36')]=qs[_0xa917('0x37')](_0x5ca160[_0xa917('0x2d')][_0xa917('0x37')]);_0x4ae7f0['where']=qs['filters'](_[_0xa917('0x38')](_0x5ca160['query'],_0x4770ab[_0xa917('0x2e')]));if(_0x5ca160['query']['filter']){_0x4ae7f0[_0xa917('0x39')]=_['merge'](_0x4ae7f0['where'],{'$or':_[_0xa917('0x3a')](_0x4f0700,function(_0x4a5500){if(_0x4a5500['type'][_0xa917('0x3b')]!==_0xa917('0x3c')){var _0x391060={};_0x391060[_0x4a5500[_0xa917('0x3d')]]={'$like':'%'+_0x5ca160[_0xa917('0x2d')][_0xa917('0x3e')]+'%'};return _0x391060;}})});}_0x4ae7f0=_[_0xa917('0x3f')]({},_0x4ae7f0,_0x5ca160[_0xa917('0x40')]);var _0x1bd07c={'where':_0x4ae7f0[_0xa917('0x39')]};return db[_0xa917('0x2a')][_0xa917('0x1c')](_0x1bd07c)[_0xa917('0x22')](function(_0x14a7fd){_0x238337[_0xa917('0x1c')]=_0x14a7fd;if(_0x5ca160[_0xa917('0x2d')][_0xa917('0x41')]){_0x4ae7f0[_0xa917('0x42')]=[{'all':!![]}];}return db[_0xa917('0x2a')][_0xa917('0x43')](_0x4ae7f0);})['then'](function(_0x462310){_0x238337[_0xa917('0x44')]=_0x462310;return _0x238337;})[_0xa917('0x22')](respondWithFilteredResult(_0x49e63e,_0x4ae7f0))[_0xa917('0x45')](handleError(_0x49e63e,null));};exports[_0xa917('0x46')]=function(_0x48295f,_0x387430){var _0x382832={'raw':!![],'where':{'id':_0x48295f[_0xa917('0x47')]['id']}},_0x5e2610={};_0x5e2610[_0xa917('0x2b')]=_[_0xa917('0x2c')](db[_0xa917('0x2a')][_0xa917('0x48')]);_0x5e2610[_0xa917('0x2d')]=_['keys'](_0x48295f[_0xa917('0x2d')]);_0x5e2610[_0xa917('0x2e')]=_['intersection'](_0x5e2610['model'],_0x5e2610['query']);_0x382832['attributes']=_[_0xa917('0x2f')](_0x5e2610['model'],qs[_0xa917('0x31')](_0x48295f[_0xa917('0x2d')][_0xa917('0x31')]));_0x382832[_0xa917('0x30')]=_0x382832[_0xa917('0x30')]['length']?_0x382832['attributes']:_0x5e2610[_0xa917('0x2b')];if(_0x48295f['query']['includeAll']){_0x382832[_0xa917('0x42')]=[{'all':!![]}];}_0x382832=_[_0xa917('0x3f')]({},_0x382832,_0x48295f[_0xa917('0x40')]);return db[_0xa917('0x2a')]['find'](_0x382832)[_0xa917('0x22')](handleEntityNotFound(_0x387430,null))[_0xa917('0x22')](respondWithResult(_0x387430,null))[_0xa917('0x45')](handleError(_0x387430,null));};exports['create']=function(_0x3d9694,_0x47d96d){return db[_0xa917('0x2a')][_0xa917('0x49')](_0x3d9694['body'],{})[_0xa917('0x22')](respondWithResult(_0x47d96d,0xc9))[_0xa917('0x45')](handleError(_0x47d96d,null));};exports['update']=function(_0x49de,_0x445341){if(_0x49de[_0xa917('0x4a')]['id']){delete _0x49de[_0xa917('0x4a')]['id'];}return db[_0xa917('0x2a')][_0xa917('0x4b')]({'where':{'id':_0x49de[_0xa917('0x47')]['id']}})['then'](handleEntityNotFound(_0x445341,null))['then'](saveUpdates(_0x49de[_0xa917('0x4a')],null))[_0xa917('0x22')](respondWithResult(_0x445341,null))[_0xa917('0x45')](handleError(_0x445341,null));};exports[_0xa917('0x23')]=function(_0x3c8b0f,_0x5249c8){return db[_0xa917('0x2a')][_0xa917('0x4b')]({'where':{'id':_0x3c8b0f[_0xa917('0x47')]['id']}})[_0xa917('0x22')](handleEntityNotFound(_0x5249c8,null))['then'](removeEntity(_0x5249c8,null))[_0xa917('0x45')](handleError(_0x5249c8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d7e2335..5de2577 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 _0x75ec=['../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x54f10e,_0x328584){var _0x1cc01d=function(_0x1aa9c0){while(--_0x1aa9c0){_0x54f10e['push'](_0x54f10e['shift']());}};_0x1cc01d(++_0x328584);}(_0x75ec,0x152));var _0xc75e=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x75ec[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0xc75e('0x0'));var logger=require(_0xc75e('0x1'))(_0xc75e('0x2'));var moment=require(_0xc75e('0x3'));var BPromise=require(_0xc75e('0x4'));var rp=require(_0xc75e('0x5'));var fs=require('fs');var path=require(_0xc75e('0x6'));var rimraf=require('rimraf');var config=require(_0xc75e('0x7'));var attributes=require(_0xc75e('0x8'));module[_0xc75e('0x9')]=function(_0x1b48e2,_0x251ce5){return _0x1b48e2[_0xc75e('0xa')]('SalesforceField',attributes,{'tableName':_0xc75e('0xb'),'paranoid':![],'indexes':[{'name':_0xc75e('0xc'),'fields':[_0xc75e('0xd'),_0xc75e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x569b=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x219a4d,_0x11bb2a){var _0x53f309=function(_0x3a0a3d){while(--_0x3a0a3d){_0x219a4d['push'](_0x219a4d['shift']());}};_0x53f309(++_0x11bb2a);}(_0x569b,0x173));var _0xb569=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x569b[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xb569('0x0'));var util=require(_0xb569('0x1'));var logger=require('../../config/logger')(_0xb569('0x2'));var moment=require(_0xb569('0x3'));var BPromise=require(_0xb569('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb569('0x5'));var rimraf=require(_0xb569('0x6'));var config=require('../../config/environment');var attributes=require(_0xb569('0x7'));module[_0xb569('0x8')]=function(_0x1730b2,_0x4ab4e4){return _0x1730b2[_0xb569('0x9')](_0xb569('0xa'),attributes,{'tableName':_0xb569('0xb'),'paranoid':![],'indexes':[{'name':_0xb569('0xc'),'fields':['idField',_0xb569('0xd')],'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 5ef4966..9901e31 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 _0xa571=['request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0xa571,0x107));var _0x1a57=function(_0x391bcb,_0x330470){_0x391bcb=_0x391bcb-0x0;var _0x17e310=_0xa571[_0x391bcb];return _0x17e310;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('SalesforceField,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('SalesforceField,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});} \ 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(_0x4d216f,_0xd384bf){var _0x36aea4=function(_0x5f0dbb){while(--_0x5f0dbb){_0x4d216f['push'](_0x4d216f['shift']());}};_0x36aea4(++_0xd384bf);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x20982e,_0x57fd55){_0x20982e=_0x20982e-0x0;var _0x379372=_0x6f0d[_0x20982e];return _0x379372;};'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 a7ece28..aca23be 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 _0x10af=['get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','show'];(function(_0x319468,_0x3fd526){var _0x5ed1e6=function(_0x5a8f85){while(--_0x5a8f85){_0x319468['push'](_0x319468['shift']());}};_0x5ed1e6(++_0x3fd526);}(_0x10af,0xfc));var _0xf10a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x10af[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xf10a('0x0'));var util=require('util');var path=require(_0xf10a('0x1'));var timeout=require(_0xf10a('0x2'));var express=require(_0xf10a('0x3'));var router=express[_0xf10a('0x4')]();var auth=require(_0xf10a('0x5'));var interaction=require(_0xf10a('0x6'));var config=require(_0xf10a('0x7'));var controller=require(_0xf10a('0x8'));router['get']('/',auth[_0xf10a('0x9')](),controller[_0xf10a('0xa')]);router['get']('/:id',auth[_0xf10a('0x9')](),controller[_0xf10a('0xb')]);router[_0xf10a('0xc')](_0xf10a('0xd'),auth['isAuthenticated'](),controller[_0xf10a('0xe')]);router['get'](_0xf10a('0xf'),auth['isAuthenticated'](),controller[_0xf10a('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf10a('0x11')]);router['post'](_0xf10a('0xd'),auth[_0xf10a('0x9')](),controller['addConfiguration']);router[_0xf10a('0x12')](_0xf10a('0x13'),auth[_0xf10a('0x9')](),controller[_0xf10a('0x14')]);router[_0xf10a('0x15')](_0xf10a('0x13'),auth[_0xf10a('0x9')](),controller[_0xf10a('0x16')]);module[_0xf10a('0x17')]=router; \ No newline at end of file +var _0xe4ef=['show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x4237c2,_0x5b398e){var _0x3c49dd=function(_0x25391e){while(--_0x25391e){_0x4237c2['push'](_0x4237c2['shift']());}};_0x3c49dd(++_0x5b398e);}(_0xe4ef,0x17b));var _0xfe4e=function(_0x5e65a0,_0x32472a){_0x5e65a0=_0x5e65a0-0x0;var _0xb1496f=_0xe4ef[_0x5e65a0];return _0xb1496f;};'use strict';var multer=require(_0xfe4e('0x0'));var util=require('util');var path=require(_0xfe4e('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe4e('0x2'));var router=express[_0xfe4e('0x3')]();var auth=require(_0xfe4e('0x4'));var interaction=require(_0xfe4e('0x5'));var config=require(_0xfe4e('0x6'));var controller=require(_0xfe4e('0x7'));router[_0xfe4e('0x8')]('/',auth[_0xfe4e('0x9')](),controller[_0xfe4e('0xa')]);router['get'](_0xfe4e('0xb'),auth['isAuthenticated'](),controller[_0xfe4e('0xc')]);router['get'](_0xfe4e('0xd'),auth[_0xfe4e('0x9')](),controller['getConfigurations']);router[_0xfe4e('0x8')](_0xfe4e('0xe'),auth['isAuthenticated'](),controller[_0xfe4e('0xf')]);router[_0xfe4e('0x10')]('/',auth[_0xfe4e('0x9')](),controller[_0xfe4e('0x11')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xfe4e('0x12')]);router[_0xfe4e('0x13')]('/:id',auth[_0xfe4e('0x9')](),controller[_0xfe4e('0x14')]);router[_0xfe4e('0x15')](_0xfe4e('0xb'),auth[_0xfe4e('0x9')](),controller['destroy']);module[_0xfe4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 782d804..5aecc8c 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 _0xda70=['remoteUri','sequelize','exports','STRING','username'];(function(_0x46b8aa,_0x246d21){var _0x5a3d61=function(_0x5c748d){while(--_0x5c748d){_0x46b8aa['push'](_0x46b8aa['shift']());}};_0x5a3d61(++_0x246d21);}(_0xda70,0x128));var _0x0da7=function(_0x18eeaa,_0x4380b6){_0x18eeaa=_0x18eeaa-0x0;var _0x23d240=_0xda70[_0x18eeaa];return _0x23d240;};'use strict';var Sequelize=require(_0x0da7('0x0'));module[_0x0da7('0x1')]={'name':{'type':Sequelize[_0x0da7('0x2')]},'description':{'type':Sequelize[_0x0da7('0x2')]},'username':{'type':Sequelize[_0x0da7('0x2')],'unique':_0x0da7('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0da7('0x2')]},'remoteUri':{'type':Sequelize[_0x0da7('0x2')],'unique':_0x0da7('0x4')},'serverUrl':{'type':Sequelize[_0x0da7('0x2')]}}; \ No newline at end of file +var _0x7c09=['STRING','username','exports'];(function(_0x446f5c,_0x143a87){var _0x34a5ad=function(_0x4eb716){while(--_0x4eb716){_0x446f5c['push'](_0x446f5c['shift']());}};_0x34a5ad(++_0x143a87);}(_0x7c09,0xfe));var _0x97c0=function(_0x116284,_0x108191){_0x116284=_0x116284-0x0;var _0x102c5c=_0x7c09[_0x116284];return _0x102c5c;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')]},'description':{'type':Sequelize[_0x97c0('0x1')]},'username':{'type':Sequelize[_0x97c0('0x1')],'unique':_0x97c0('0x2')},'password':{'type':Sequelize[_0x97c0('0x1')]},'email':{'type':Sequelize[_0x97c0('0x1')]},'remoteUri':{'type':Sequelize[_0x97c0('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x97c0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 09360ed..1512d9f 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 _0x07d8=['destroy','getConfigurations','findOne','ServicenowConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','label','TCL:\x20_object','includes','internalType','push','all','concat','ServiceNow\x20error:\x20','statusCode','stack','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','name','send','ServicenowAccount','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','includeAll','include','findAll','show','options','find','create','body','params'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07d8,0x1f1));var _0x807d=function(_0x38cf3d,_0x2b8f37){_0x38cf3d=_0x38cf3d-0x0;var _0x4b97f0=_0x07d8[_0x38cf3d];return _0x4b97f0;};'use strict';var pdf=require(_0x807d('0x0'));var emlformat=require(_0x807d('0x1'));var rimraf=require(_0x807d('0x2'));var zipdir=require(_0x807d('0x3'));var jsonpatch=require(_0x807d('0x4'));var rp=require(_0x807d('0x5'));var moment=require(_0x807d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x807d('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x807d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x807d('0x9'));var squel=require(_0x807d('0xa'));var crypto=require(_0x807d('0xb'));var jsforce=require(_0x807d('0xc'));var deskjs=require(_0x807d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x807d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x807d('0xf'));var qs=require(_0x807d('0x10'));var hardwareService=require(_0x807d('0x11'));var logger=require('../../config/logger')(_0x807d('0x12'));var utils=require(_0x807d('0x13'));var config=require(_0x807d('0x14'));var db=require(_0x807d('0x15'))['db'];var integrations=require(_0x807d('0x16'));var jayson=require(_0x807d('0x17'));var client=jayson[_0x807d('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x3c049c,_0x36bcb3,_0x5208b4){if(_0x5208b4){var _0x235005=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x235005[_0x807d('0x19')](_0x36bcb3)){return _0x3c049c;}else{throw new db[(_0x807d('0x1a'))]['ValidationError'](_0x807d('0x1b'));}}else{return _0x3c049c;}}function respondWithRpcPromise(_0x4372c2,_0x4e23ea,_0xa4b343,_0x53049e){return new BPromise(function(_0x36563b,_0x2a83cc){var _0x3b38ed=_0x53049e||client;return _0x3b38ed[_0x807d('0x1c')](_0x4372c2,_0xa4b343)[_0x807d('0x1d')](function(_0x11738b){logger[_0x807d('0x1e')](_0x807d('0x1f'),_0x4e23ea,_0x807d('0x20'));logger[_0x807d('0x21')](_0x807d('0x22'),_0x4e23ea,'request\x20sent',JSON[_0x807d('0x23')](_0x11738b));if(_0x11738b[_0x807d('0x24')]){if(_0x11738b[_0x807d('0x24')][_0x807d('0x25')]===0x1f4){logger[_0x807d('0x24')](_0x807d('0x1f'),_0x4e23ea,_0x11738b[_0x807d('0x24')][_0x807d('0x26')]);return _0x2a83cc(_0x11738b[_0x807d('0x24')]['message']);}logger['error'](_0x807d('0x1f'),_0x4e23ea,_0x11738b[_0x807d('0x24')][_0x807d('0x26')]);return _0x36563b(_0x11738b[_0x807d('0x24')][_0x807d('0x26')]);}else{logger[_0x807d('0x1e')](_0x807d('0x1f'),_0x4e23ea,_0x807d('0x20'));_0x36563b(_0x11738b[_0x807d('0x27')][_0x807d('0x26')]);}})[_0x807d('0x28')](function(_0x3c564b){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x4e23ea,_0x3c564b);_0x2a83cc(_0x3c564b);});});}function respondWithStatusCode(_0x13d9a7,_0x11e212){_0x11e212=_0x11e212||0xcc;return function(_0x3d7840){if(_0x3d7840){return _0x13d9a7[_0x807d('0x29')](_0x11e212);}return _0x13d9a7['status'](_0x11e212)[_0x807d('0x2a')]();};}function respondWithResult(_0x31a8fd,_0x3aa873){_0x3aa873=_0x3aa873||0xc8;return function(_0x143169){if(_0x143169){return _0x31a8fd[_0x807d('0x2b')](_0x3aa873)[_0x807d('0x2c')](_0x143169);}};}function respondWithFilteredResult(_0x4447e7,_0x113b93){return function(_0x193773){if(_0x193773){var _0x30ea99=_0x193773[_0x807d('0x2d')],_0x21b397=_0x113b93[_0x807d('0x2e')],_0x5c87e2=_0x113b93['offset']+_0x113b93['limit'],_0x2dca33;if(_0x5c87e2>=_0x30ea99){_0x5c87e2=_0x30ea99;_0x2dca33=0xc8;}else{_0x2dca33=0xce;}_0x4447e7[_0x807d('0x2b')](_0x2dca33);return _0x4447e7['set'](_0x807d('0x2f'),_0x21b397+'-'+_0x5c87e2+'/'+_0x30ea99)[_0x807d('0x2c')](_0x193773);}return null;};}function patchUpdates(_0x44b7fc){return function(_0xe24c15){try{jsonpatch[_0x807d('0x30')](_0xe24c15,_0x44b7fc,!![]);}catch(_0x5b1371){return BPromise[_0x807d('0x31')](_0x5b1371);}return _0xe24c15[_0x807d('0x32')]();};}function saveUpdates(_0x2ea94c,_0x445995){return function(_0xec5806){if(_0xec5806){return _0xec5806[_0x807d('0x33')](_0x2ea94c)['then'](function(_0x3cc875){return _0x3cc875;});}return null;};}function removeEntity(_0xc1ea55,_0x497ec1){return function(_0x1c4b6a){if(_0x1c4b6a){return _0x1c4b6a['destroy']()[_0x807d('0x1d')](function(){_0xc1ea55[_0x807d('0x2b')](0xcc)[_0x807d('0x2a')]();});}};}function handleEntityNotFound(_0x393f2d,_0x1a3bb4){return function(_0x5d3e80){if(!_0x5d3e80){_0x393f2d[_0x807d('0x29')](0x194);}return _0x5d3e80;};}function handleError(_0x10b236,_0x108d77){_0x108d77=_0x108d77||0x1f4;return function(_0x152963){logger[_0x807d('0x24')](_0x152963['stack']);if(_0x152963[_0x807d('0x34')]){delete _0x152963['name'];}_0x10b236[_0x807d('0x2b')](_0x108d77)[_0x807d('0x35')](_0x152963);};}exports['index']=function(_0x137569,_0x17affa){var _0x362361={},_0x5538fc={},_0xd8876d={'count':0x0,'rows':[]};var _0x2043ff=db[_0x807d('0x36')][_0x807d('0x37')];_0x5538fc[_0x807d('0x38')]=_[_0x807d('0x39')](_0x2043ff);_0x5538fc[_0x807d('0x3a')]=_['keys'](_0x137569[_0x807d('0x3a')]);_0x5538fc[_0x807d('0x3b')]=_['intersection'](_0x5538fc[_0x807d('0x38')],_0x5538fc[_0x807d('0x3a')]);_0x362361['attributes']=_[_0x807d('0x3c')](_0x5538fc[_0x807d('0x38')],qs[_0x807d('0x3d')](_0x137569[_0x807d('0x3a')][_0x807d('0x3d')]));_0x362361[_0x807d('0x3e')]=_0x362361[_0x807d('0x3e')][_0x807d('0x3f')]?_0x362361[_0x807d('0x3e')]:_0x5538fc[_0x807d('0x38')];if(!_0x137569[_0x807d('0x3a')]['hasOwnProperty'](_0x807d('0x40'))){_0x362361[_0x807d('0x41')]=qs[_0x807d('0x41')](_0x137569[_0x807d('0x3a')]['limit']);_0x362361[_0x807d('0x2e')]=qs[_0x807d('0x2e')](_0x137569['query'][_0x807d('0x2e')]);}_0x362361[_0x807d('0x42')]=qs[_0x807d('0x43')](_0x137569[_0x807d('0x3a')]['sort']);_0x362361[_0x807d('0x44')]=qs[_0x807d('0x3b')](_[_0x807d('0x45')](_0x137569[_0x807d('0x3a')],_0x5538fc[_0x807d('0x3b')]));if(_0x137569[_0x807d('0x3a')][_0x807d('0x46')]){_0x362361[_0x807d('0x44')]=_[_0x807d('0x47')](_0x362361[_0x807d('0x44')],{'$or':_[_0x807d('0x48')](_0x2043ff,function(_0x1c22c0){if(_0x1c22c0[_0x807d('0x49')][_0x807d('0x4a')]!==_0x807d('0x4b')){var _0x125c7b={};_0x125c7b[_0x1c22c0['field']]={'$like':'%'+_0x137569[_0x807d('0x3a')][_0x807d('0x46')]+'%'};return _0x125c7b;}})});}_0x362361=_[_0x807d('0x47')]({},_0x362361,_0x137569['options']);var _0x2be0ac={'where':_0x362361[_0x807d('0x44')]};return db['ServicenowAccount'][_0x807d('0x2d')](_0x2be0ac)[_0x807d('0x1d')](function(_0x34bcb1){_0xd8876d['count']=_0x34bcb1;if(_0x137569['query'][_0x807d('0x4c')]){_0x362361[_0x807d('0x4d')]=[{'all':!![]}];}return db[_0x807d('0x36')][_0x807d('0x4e')](_0x362361);})[_0x807d('0x1d')](function(_0x2057c9){_0xd8876d['rows']=_0x2057c9;return _0xd8876d;})[_0x807d('0x1d')](respondWithFilteredResult(_0x17affa,_0x362361))['catch'](handleError(_0x17affa,null));};exports[_0x807d('0x4f')]=function(_0x5cd17b,_0x2ceb03){var _0x3f3406={'raw':![],'where':{'id':_0x5cd17b['params']['id']}},_0x438b57={};_0x438b57[_0x807d('0x38')]=_[_0x807d('0x39')](db[_0x807d('0x36')]['rawAttributes']);_0x438b57[_0x807d('0x3a')]=_['keys'](_0x5cd17b[_0x807d('0x3a')]);_0x438b57[_0x807d('0x3b')]=_['intersection'](_0x438b57[_0x807d('0x38')],_0x438b57['query']);_0x3f3406[_0x807d('0x3e')]=_[_0x807d('0x3c')](_0x438b57[_0x807d('0x38')],qs['fields'](_0x5cd17b['query'][_0x807d('0x3d')]));_0x3f3406[_0x807d('0x3e')]=_0x3f3406[_0x807d('0x3e')][_0x807d('0x3f')]?_0x3f3406[_0x807d('0x3e')]:_0x438b57[_0x807d('0x38')];if(_0x5cd17b[_0x807d('0x3a')][_0x807d('0x4c')]){_0x3f3406[_0x807d('0x4d')]=[{'all':!![]}];}_0x3f3406=_[_0x807d('0x47')]({},_0x3f3406,_0x5cd17b[_0x807d('0x50')]);return db['ServicenowAccount'][_0x807d('0x51')](_0x3f3406)[_0x807d('0x1d')](handleEntityNotFound(_0x2ceb03,null))[_0x807d('0x1d')](respondWithResult(_0x2ceb03,null))[_0x807d('0x28')](handleError(_0x2ceb03,null));};exports['create']=function(_0x34a092,_0x4d34dd){return db[_0x807d('0x36')][_0x807d('0x52')](_0x34a092['body'],{})['then'](respondWithResult(_0x4d34dd,0xc9))[_0x807d('0x28')](handleError(_0x4d34dd,null));};exports[_0x807d('0x33')]=function(_0x409723,_0x153688){if(_0x409723['body']['id']){delete _0x409723[_0x807d('0x53')]['id'];}return db[_0x807d('0x36')][_0x807d('0x51')]({'where':{'id':_0x409723[_0x807d('0x54')]['id']}})[_0x807d('0x1d')](handleEntityNotFound(_0x153688,null))[_0x807d('0x1d')](saveUpdates(_0x409723[_0x807d('0x53')],null))['then'](respondWithResult(_0x153688,null))[_0x807d('0x28')](handleError(_0x153688,null));};exports[_0x807d('0x55')]=function(_0x347cf7,_0x205ad1){return db[_0x807d('0x36')][_0x807d('0x51')]({'where':{'id':_0x347cf7[_0x807d('0x54')]['id']}})['then'](handleEntityNotFound(_0x205ad1,null))['then'](removeEntity(_0x205ad1,null))[_0x807d('0x28')](handleError(_0x205ad1,null));};exports[_0x807d('0x56')]=function(_0x2bbe79,_0x5e72bd,_0x2a60a0){var _0xd97ba7={};var _0x118deb={};var _0x3b1832;var _0x50baf1;return db[_0x807d('0x36')][_0x807d('0x57')]({'where':{'id':_0x2bbe79[_0x807d('0x54')]['id']}})[_0x807d('0x1d')](handleEntityNotFound(_0x5e72bd,null))[_0x807d('0x1d')](function(_0x44e707){if(_0x44e707){_0x3b1832=_0x44e707;_0x118deb['model']=_[_0x807d('0x39')](db[_0x807d('0x58')][_0x807d('0x37')]);_0x118deb[_0x807d('0x3a')]=_['keys'](_0x2bbe79[_0x807d('0x3a')]);_0x118deb[_0x807d('0x3b')]=_[_0x807d('0x3c')](_0x118deb[_0x807d('0x38')],_0x118deb[_0x807d('0x3a')]);_0xd97ba7['attributes']=_[_0x807d('0x3c')](_0x118deb['model'],qs[_0x807d('0x3d')](_0x2bbe79[_0x807d('0x3a')][_0x807d('0x3d')]));_0xd97ba7[_0x807d('0x3e')]=_0xd97ba7[_0x807d('0x3e')][_0x807d('0x3f')]?_0xd97ba7['attributes']:_0x118deb[_0x807d('0x38')];_0xd97ba7[_0x807d('0x42')]=qs['sort'](_0x2bbe79[_0x807d('0x3a')][_0x807d('0x43')]);_0xd97ba7[_0x807d('0x44')]=qs[_0x807d('0x3b')](_['pick'](_0x2bbe79[_0x807d('0x3a')],_0x118deb[_0x807d('0x3b')]));if(_0x2bbe79['query'][_0x807d('0x46')]){_0xd97ba7[_0x807d('0x44')]=_['merge'](_0xd97ba7['where'],{'$or':_['map'](_0xd97ba7[_0x807d('0x3e')],function(_0x598c9b){var _0x1a9b94={};_0x1a9b94[_0x598c9b]={'$like':'%'+_0x2bbe79[_0x807d('0x3a')][_0x807d('0x46')]+'%'};return _0x1a9b94;})});}_0xd97ba7=_['merge']({},_0xd97ba7,_0x2bbe79[_0x807d('0x50')]);return _0x3b1832[_0x807d('0x56')](_0xd97ba7);}})['then'](function(_0x2d51c5){if(_0x2d51c5){_0x50baf1=_0x2d51c5[_0x807d('0x3f')];if(!_0x2bbe79[_0x807d('0x3a')]['hasOwnProperty'](_0x807d('0x40'))){_0xd97ba7[_0x807d('0x41')]=qs[_0x807d('0x41')](_0x2bbe79[_0x807d('0x3a')]['limit']);_0xd97ba7[_0x807d('0x2e')]=qs[_0x807d('0x2e')](_0x2bbe79[_0x807d('0x3a')][_0x807d('0x2e')]);}return _0x3b1832[_0x807d('0x56')](_0xd97ba7);}})[_0x807d('0x1d')](function(_0x52d10a){if(_0x52d10a){return _0x52d10a?{'count':_0x50baf1,'rows':_0x52d10a}:null;}})[_0x807d('0x1d')](respondWithResult(_0x5e72bd,null))[_0x807d('0x28')](handleError(_0x5e72bd,null));};exports['addConfiguration']=function(_0x18891f,_0x5ee7bf,_0x47923e){if(_0x18891f[_0x807d('0x53')]['id']){delete _0x18891f[_0x807d('0x53')]['id'];}return db['ServicenowAccount'][_0x807d('0x57')]({'where':{'id':_0x18891f['params']['id']}})[_0x807d('0x1d')](handleEntityNotFound(_0x5ee7bf,null))['then'](function(_0x28fd29){if(_0x28fd29){_0x18891f[_0x807d('0x53')]['AccountId']=_0x28fd29['id'];_0x18891f['body'][_0x807d('0x59')]=integrations[_0x807d('0x5a')](_0x18891f[_0x807d('0x53')][_0x807d('0x5b')],_0x18891f[_0x807d('0x53')][_0x807d('0x49')]);_0x18891f[_0x807d('0x53')]['Descriptions']=integrations[_0x807d('0x5c')](_0x18891f[_0x807d('0x53')]['channel'],_0x18891f[_0x807d('0x53')][_0x807d('0x49')]);return db['ServicenowConfiguration'][_0x807d('0x52')](_0x18891f[_0x807d('0x53')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x807d('0x5d')],'as':_0x807d('0x5e')}]});}return null;})['then'](respondWithResult(_0x5ee7bf,null))[_0x807d('0x28')](handleError(_0x5ee7bf,null));};exports[_0x807d('0x5f')]=function(_0x45d894,_0x4f64ed,_0x42176b){var _0x4c38b9=['made_sla',_0x807d('0x60'),_0x807d('0x61'),'subcategory',_0x807d('0x62'),_0x807d('0x63'),_0x807d('0x64'),'severity',_0x807d('0x65')];var _0xfce276=[_0x807d('0x66'),'made_sla',_0x807d('0x67'),_0x807d('0x68'),_0x807d('0x69'),_0x807d('0x6a'),_0x807d('0x6b'),_0x807d('0x60'),'approval_history','number',_0x807d('0x6c'),_0x807d('0x6d'),_0x807d('0x6e'),'user_input','sys_created_on',_0x807d('0x6f'),_0x807d('0x70'),_0x807d('0x71'),_0x807d('0x61'),'order','calendar_stc',_0x807d('0x72'),_0x807d('0x73'),_0x807d('0x74'),'impact',_0x807d('0x75'),_0x807d('0x76'),_0x807d('0x77'),'priority',_0x807d('0x78'),_0x807d('0x79'),_0x807d('0x7a'),'expected_start',_0x807d('0x7b'),'business_duration',_0x807d('0x7c'),_0x807d('0x7d'),_0x807d('0x7e'),_0x807d('0x7f'),_0x807d('0x80'),'approval_set','subcategory',_0x807d('0x81'),_0x807d('0x82'),_0x807d('0x62'),_0x807d('0x83'),'delivery_task','work_start','assignment_group',_0x807d('0x84'),_0x807d('0x85'),_0x807d('0x86'),'calendar_duration',_0x807d('0x63'),_0x807d('0x87'),_0x807d('0x88'),_0x807d('0x89'),_0x807d('0x8a'),_0x807d('0x8b'),'sys_id',_0x807d('0x8c'),_0x807d('0x8d'),_0x807d('0x64'),_0x807d('0x8e'),'problem_id',_0x807d('0x8f'),_0x807d('0x90'),_0x807d('0x91'),_0x807d('0x92'),_0x807d('0x93'),_0x807d('0x94'),_0x807d('0x95'),_0x807d('0x96'),'comments_and_work_notes',_0x807d('0x97'),_0x807d('0x98'),_0x807d('0x99'),_0x807d('0x9a'),_0x807d('0x9b'),_0x807d('0x9c'),_0x807d('0x9d'),_0x807d('0x9e'),_0x807d('0x65')];var _0x1695a2='';var _0x1d15bb='';var _0x441d86=[];var _0x326f91='';var _0x508874='';var _0x51c918=[];var _0x55567e='';var _0x15eadf='';var _0x4afdb6={};var _0x1969b5='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x45d894['params']['id']},'attributes':['id',_0x807d('0x9f'),_0x807d('0xa0'),_0x807d('0xa1'),_0x807d('0xa2'),_0x807d('0xa3')]})[_0x807d('0x1d')](handleEntityNotFound(_0x4f64ed,null))[_0x807d('0x1d')](function(_0x8fa26b){if(_0x8fa26b){_0x1969b5=_0x8fa26b[_0x807d('0xa2')];var _0x3c15c7=_0x1969b5[_0x807d('0xa4')](-0x1);if(_0x3c15c7==='/'){_0x1969b5=_0x1969b5[_0x807d('0xa5')](0x0,_0x1969b5[_0x807d('0xa6')](_0x3c15c7));}_0x15eadf=util[_0x807d('0xa7')](_0x807d('0xa8'),_0x1969b5);_0x55567e=util[_0x807d('0xa7')](_0x807d('0xa9'),_0x1969b5);_0x4afdb6={'user':_0x8fa26b[_0x807d('0x9f')],'pass':_0x8fa26b[_0x807d('0xa0')]};var _0x263bf9={'method':_0x807d('0xaa'),'uri':_0x15eadf+_0x807d('0xab'),'auth':_0x4afdb6,'json':!![]};return rp(_0x263bf9);}})['then'](function(_0x3d9e19){if(_0x3d9e19[_0x807d('0x27')]['length']>0x0){_0x1695a2=_0x3d9e19['result'];}console[_0x807d('0xac')](_0x807d('0xad'),_0x1695a2);_0x51c918=[];_0x1d15bb=Object[_0x807d('0xae')]([],_0x1695a2);_[_0x807d('0xaf')](_0x1d15bb,function(_0x3f04ad){return!_0x4c38b9['includes'](_0x3f04ad[_0x807d('0x34')]);});_0x1d15bb[_0x807d('0xb0')](function(_0x4f63d8){var _0x5e2b08=createFieldObject(_0x55567e,_0x4afdb6,_0x4f63d8['internalType'],_0x4f63d8[_0x807d('0x34')],_0x4f63d8[_0x807d('0xb1')],![]);_0x51c918['push'](_0x5e2b08);});return Promise['all'](_0x51c918);})[_0x807d('0x1d')](function(_0x28331e){_0x441d86=_0x28331e;_0x326f91=Object[_0x807d('0xae')]([],_0x1695a2);console[_0x807d('0xac')](_0x807d('0xb2'),_0x1695a2);_['remove'](_0x326f91,function(_0x501a2f){return _0xfce276[_0x807d('0xb3')](_0x501a2f[_0x807d('0x34')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x326f91);_0x51c918=[];_0x326f91[_0x807d('0xb0')](function(_0x1864d4){var _0x45fba6=createFieldObject(_0x55567e,_0x4afdb6,_0x1864d4[_0x807d('0xb4')],_0x1864d4[_0x807d('0x34')],_0x1864d4[_0x807d('0xb1')],!![]);_0x51c918[_0x807d('0xb5')](_0x45fba6);});return Promise[_0x807d('0xb6')](_0x51c918);})['then'](function(_0x31cc8b){_0x508874=_0x31cc8b;var _0x3d4b4d=_0x441d86[_0x807d('0xb7')](_0x508874);return{'count':_0x3d4b4d[_0x807d('0x3f')],'rows':_0x3d4b4d};})[_0x807d('0x1d')](respondWithResult(_0x4f64ed,null))[_0x807d('0x28')](function(_0x46fcde){console[_0x807d('0xac')](_0x807d('0xb8')+_0x46fcde);var _0x26c4aa=_0x45d894[_0x807d('0x3a')][_0x807d('0x19')]?0x1f4:_0x46fcde[_0x807d('0xb9')]||0x1f4;logger['error'](_0x46fcde[_0x807d('0xba')]);delete _0x46fcde[_0x807d('0x34')];if(_0x26c4aa===0x191){_0x26c4aa=0x190;}_0x4f64ed[_0x807d('0x2b')](_0x26c4aa)[_0x807d('0x35')](_0x45d894[_0x807d('0x3a')][_0x807d('0x19')]?{'message':_0x807d('0xbb'),'statusCode':_0x46fcde[_0x807d('0xb9')]}:_0x46fcde);});};function createFieldObject(_0x298ac7,_0x2f16d3,_0x35bda8,_0x2b5854,_0x2673ff,_0x3ad24c){return new Promise(function(_0x5cd234,_0x43105d){var _0x3d8cec={'id':_0x2b5854,'name':_0x2673ff,'custom':_0x3ad24c};if(_0x35bda8===_0x807d('0xbc')){_0x3d8cec[_0x807d('0x50')]=[{'name':_0x807d('0xbd'),'value':'true'},{'name':_0x807d('0xbe'),'value':_0x807d('0xbf')}];_0x5cd234(_0x3d8cec);}else{var _0xce555d={'method':_0x807d('0xaa'),'uri':_0x298ac7+_0x807d('0xc0')+_0x2b5854,'auth':_0x2f16d3,'json':!![]};return rp(_0xce555d)['then'](function(_0x295a8f){var _0x8c7210=[];if(_0x295a8f[_0x807d('0x27')][_0x807d('0x3f')]>0x0){_0x295a8f['result']['forEach'](function(_0x39b634){if(_0x39b634[_0x807d('0xc1')]===_0x807d('0xbf')){var _0xb7836f={'name':_0x39b634[_0x807d('0xb1')],'value':_0x39b634['value']};_0x8c7210[_0x807d('0xb5')](_0xb7836f);}});}_0x3d8cec[_0x807d('0x50')]=_0x8c7210;if(_0x3d8cec[_0x807d('0x50')][_0x807d('0x3f')]>0x0){_0x5cd234(_0x3d8cec);}else{if(_0x3ad24c==![]){_0x5cd234();}else{_0x5cd234(_0x3d8cec);}}});}});} \ No newline at end of file +var _0xed2f=['show','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','nolimit','addConfiguration','AccountId','Subjects','Descriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','number','sys_updated_by','opened_by','user_input','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','email','serverUrl','remoteUri','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','log','assign','remove','includes','internalType','label','push','TCL:\x20_object','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','false','value','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','ServicenowAccount','rawAttributes','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows'];(function(_0x3617bf,_0x4ae67f){var _0x5755ed=function(_0x355403){while(--_0x355403){_0x3617bf['push'](_0x3617bf['shift']());}};_0x5755ed(++_0x4ae67f);}(_0xed2f,0x136));var _0xfed2=function(_0x5c2d8a,_0x5b9a66){_0x5c2d8a=_0x5c2d8a-0x0;var _0x5e6810=_0xed2f[_0x5c2d8a];return _0x5e6810;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfed2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfed2('0x1'));var rp=require(_0xfed2('0x2'));var moment=require(_0xfed2('0x3'));var BPromise=require(_0xfed2('0x4'));var Mustache=require(_0xfed2('0x5'));var util=require(_0xfed2('0x6'));var path=require(_0xfed2('0x7'));var sox=require(_0xfed2('0x8'));var csv=require('to-csv');var ejs=require(_0xfed2('0x9'));var fs=require('fs');var _=require(_0xfed2('0xa'));var squel=require(_0xfed2('0xb'));var crypto=require(_0xfed2('0xc'));var jsforce=require(_0xfed2('0xd'));var deskjs=require(_0xfed2('0xe'));var toCsv=require(_0xfed2('0xf'));var querystring=require('querystring');var Papa=require(_0xfed2('0x10'));var Redis=require(_0xfed2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xfed2('0x12'));var logger=require('../../config/logger')(_0xfed2('0x13'));var utils=require(_0xfed2('0x14'));var config=require(_0xfed2('0x15'));var db=require(_0xfed2('0x16'))['db'];var integrations=require(_0xfed2('0x17'));var jayson=require(_0xfed2('0x18'));var client=jayson[_0xfed2('0x19')][_0xfed2('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x36b037,_0x2b8887,_0x321952){if(_0x321952){var _0x5ebeec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ebeec['test'](_0x2b8887)){return _0x36b037;}else{throw new db[(_0xfed2('0x1b'))]['ValidationError'](_0xfed2('0x1c'));}}else{return _0x36b037;}}function respondWithRpcPromise(_0x1e3d71,_0x559a06,_0x532190,_0x2fffca){return new BPromise(function(_0x3f216e,_0xcc131d){var _0x4e74da=_0x2fffca||client;return _0x4e74da[_0xfed2('0x1d')](_0x1e3d71,_0x532190)[_0xfed2('0x1e')](function(_0x13a719){logger[_0xfed2('0x1f')](_0xfed2('0x20'),_0x559a06,_0xfed2('0x21'));logger[_0xfed2('0x22')](_0xfed2('0x23'),_0x559a06,_0xfed2('0x21'),JSON[_0xfed2('0x24')](_0x13a719));if(_0x13a719[_0xfed2('0x25')]){if(_0x13a719[_0xfed2('0x25')][_0xfed2('0x26')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x559a06,_0x13a719[_0xfed2('0x25')][_0xfed2('0x27')]);return _0xcc131d(_0x13a719[_0xfed2('0x25')][_0xfed2('0x27')]);}logger['error'](_0xfed2('0x20'),_0x559a06,_0x13a719['error'][_0xfed2('0x27')]);return _0x3f216e(_0x13a719[_0xfed2('0x25')][_0xfed2('0x27')]);}else{logger['info'](_0xfed2('0x20'),_0x559a06,_0xfed2('0x21'));_0x3f216e(_0x13a719[_0xfed2('0x28')][_0xfed2('0x27')]);}})[_0xfed2('0x29')](function(_0x2a9284){logger[_0xfed2('0x25')](_0xfed2('0x20'),_0x559a06,_0x2a9284);_0xcc131d(_0x2a9284);});});}function respondWithStatusCode(_0x2da03a,_0x271655){_0x271655=_0x271655||0xcc;return function(_0x1ee87b){if(_0x1ee87b){return _0x2da03a[_0xfed2('0x2a')](_0x271655);}return _0x2da03a[_0xfed2('0x2b')](_0x271655)[_0xfed2('0x2c')]();};}function respondWithResult(_0x244a1d,_0x457614){_0x457614=_0x457614||0xc8;return function(_0x3e851b){if(_0x3e851b){return _0x244a1d[_0xfed2('0x2b')](_0x457614)[_0xfed2('0x2d')](_0x3e851b);}};}function respondWithFilteredResult(_0x1ed887,_0x36eb78){return function(_0xbda29f){if(_0xbda29f){var _0x157aae=_0xbda29f[_0xfed2('0x2e')],_0x3354d5=_0x36eb78[_0xfed2('0x2f')],_0x3f1f02=_0x36eb78[_0xfed2('0x2f')]+_0x36eb78[_0xfed2('0x30')],_0x3d67a3;if(_0x3f1f02>=_0x157aae){_0x3f1f02=_0x157aae;_0x3d67a3=0xc8;}else{_0x3d67a3=0xce;}_0x1ed887[_0xfed2('0x2b')](_0x3d67a3);return _0x1ed887[_0xfed2('0x31')](_0xfed2('0x32'),_0x3354d5+'-'+_0x3f1f02+'/'+_0x157aae)[_0xfed2('0x2d')](_0xbda29f);}return null;};}function patchUpdates(_0x4b1eee){return function(_0x1e123d){try{jsonpatch[_0xfed2('0x33')](_0x1e123d,_0x4b1eee,!![]);}catch(_0x39c72a){return BPromise['reject'](_0x39c72a);}return _0x1e123d[_0xfed2('0x34')]();};}function saveUpdates(_0x89aa89,_0x335968){return function(_0x466a38){if(_0x466a38){return _0x466a38[_0xfed2('0x35')](_0x89aa89)[_0xfed2('0x1e')](function(_0x176359){return _0x176359;});}return null;};}function removeEntity(_0x3d1ccb,_0x50dc11){return function(_0x3d72b5){if(_0x3d72b5){return _0x3d72b5[_0xfed2('0x36')]()[_0xfed2('0x1e')](function(){_0x3d1ccb[_0xfed2('0x2b')](0xcc)[_0xfed2('0x2c')]();});}};}function handleEntityNotFound(_0x1f0c2f,_0x310853){return function(_0x2f5ae4){if(!_0x2f5ae4){_0x1f0c2f['sendStatus'](0x194);}return _0x2f5ae4;};}function handleError(_0xb012db,_0x3cfa12){_0x3cfa12=_0x3cfa12||0x1f4;return function(_0x40f0c3){logger['error'](_0x40f0c3[_0xfed2('0x37')]);if(_0x40f0c3[_0xfed2('0x38')]){delete _0x40f0c3['name'];}_0xb012db[_0xfed2('0x2b')](_0x3cfa12)[_0xfed2('0x39')](_0x40f0c3);};}exports['index']=function(_0x53ed34,_0x2608eb){var _0x4a5f4b={},_0x31a054={},_0x4e65ef={'count':0x0,'rows':[]};var _0x5685d6=db[_0xfed2('0x3a')][_0xfed2('0x3b')];_0x31a054[_0xfed2('0x3c')]=_[_0xfed2('0x3d')](_0x5685d6);_0x31a054['query']=_[_0xfed2('0x3d')](_0x53ed34['query']);_0x31a054[_0xfed2('0x3e')]=_[_0xfed2('0x3f')](_0x31a054[_0xfed2('0x3c')],_0x31a054[_0xfed2('0x40')]);_0x4a5f4b['attributes']=_['intersection'](_0x31a054[_0xfed2('0x3c')],qs[_0xfed2('0x41')](_0x53ed34[_0xfed2('0x40')][_0xfed2('0x41')]));_0x4a5f4b[_0xfed2('0x42')]=_0x4a5f4b[_0xfed2('0x42')][_0xfed2('0x43')]?_0x4a5f4b['attributes']:_0x31a054['model'];if(!_0x53ed34[_0xfed2('0x40')][_0xfed2('0x44')]('nolimit')){_0x4a5f4b[_0xfed2('0x30')]=qs[_0xfed2('0x30')](_0x53ed34[_0xfed2('0x40')][_0xfed2('0x30')]);_0x4a5f4b[_0xfed2('0x2f')]=qs[_0xfed2('0x2f')](_0x53ed34[_0xfed2('0x40')][_0xfed2('0x2f')]);}_0x4a5f4b[_0xfed2('0x45')]=qs[_0xfed2('0x46')](_0x53ed34['query']['sort']);_0x4a5f4b['where']=qs[_0xfed2('0x3e')](_[_0xfed2('0x47')](_0x53ed34[_0xfed2('0x40')],_0x31a054[_0xfed2('0x3e')]));if(_0x53ed34[_0xfed2('0x40')][_0xfed2('0x48')]){_0x4a5f4b[_0xfed2('0x49')]=_[_0xfed2('0x4a')](_0x4a5f4b[_0xfed2('0x49')],{'$or':_[_0xfed2('0x4b')](_0x5685d6,function(_0x5bed11){if(_0x5bed11[_0xfed2('0x4c')][_0xfed2('0x4d')]!==_0xfed2('0x4e')){var _0x30d084={};_0x30d084[_0x5bed11[_0xfed2('0x4f')]]={'$like':'%'+_0x53ed34[_0xfed2('0x40')][_0xfed2('0x48')]+'%'};return _0x30d084;}})});}_0x4a5f4b=_[_0xfed2('0x4a')]({},_0x4a5f4b,_0x53ed34[_0xfed2('0x50')]);var _0x553113={'where':_0x4a5f4b[_0xfed2('0x49')]};return db[_0xfed2('0x3a')][_0xfed2('0x2e')](_0x553113)[_0xfed2('0x1e')](function(_0x3a139b){_0x4e65ef[_0xfed2('0x2e')]=_0x3a139b;if(_0x53ed34[_0xfed2('0x40')][_0xfed2('0x51')]){_0x4a5f4b['include']=[{'all':!![]}];}return db[_0xfed2('0x3a')][_0xfed2('0x52')](_0x4a5f4b);})[_0xfed2('0x1e')](function(_0x5b089d){_0x4e65ef[_0xfed2('0x53')]=_0x5b089d;return _0x4e65ef;})[_0xfed2('0x1e')](respondWithFilteredResult(_0x2608eb,_0x4a5f4b))[_0xfed2('0x29')](handleError(_0x2608eb,null));};exports[_0xfed2('0x54')]=function(_0x37f3f6,_0x4fc02a){var _0x4dfca6={'raw':![],'where':{'id':_0x37f3f6[_0xfed2('0x55')]['id']}},_0x570c96={};_0x570c96[_0xfed2('0x3c')]=_[_0xfed2('0x3d')](db[_0xfed2('0x3a')]['rawAttributes']);_0x570c96[_0xfed2('0x40')]=_['keys'](_0x37f3f6['query']);_0x570c96[_0xfed2('0x3e')]=_['intersection'](_0x570c96[_0xfed2('0x3c')],_0x570c96[_0xfed2('0x40')]);_0x4dfca6[_0xfed2('0x42')]=_[_0xfed2('0x3f')](_0x570c96[_0xfed2('0x3c')],qs[_0xfed2('0x41')](_0x37f3f6[_0xfed2('0x40')][_0xfed2('0x41')]));_0x4dfca6[_0xfed2('0x42')]=_0x4dfca6[_0xfed2('0x42')]['length']?_0x4dfca6[_0xfed2('0x42')]:_0x570c96['model'];if(_0x37f3f6[_0xfed2('0x40')][_0xfed2('0x51')]){_0x4dfca6['include']=[{'all':!![]}];}_0x4dfca6=_[_0xfed2('0x4a')]({},_0x4dfca6,_0x37f3f6[_0xfed2('0x50')]);return db[_0xfed2('0x3a')][_0xfed2('0x56')](_0x4dfca6)['then'](handleEntityNotFound(_0x4fc02a,null))[_0xfed2('0x1e')](respondWithResult(_0x4fc02a,null))['catch'](handleError(_0x4fc02a,null));};exports[_0xfed2('0x57')]=function(_0x2e09e9,_0x2269ce){return db[_0xfed2('0x3a')][_0xfed2('0x57')](_0x2e09e9[_0xfed2('0x58')],{})[_0xfed2('0x1e')](respondWithResult(_0x2269ce,0xc9))[_0xfed2('0x29')](handleError(_0x2269ce,null));};exports[_0xfed2('0x35')]=function(_0x5da4d1,_0x491369){if(_0x5da4d1['body']['id']){delete _0x5da4d1[_0xfed2('0x58')]['id'];}return db['ServicenowAccount'][_0xfed2('0x56')]({'where':{'id':_0x5da4d1['params']['id']}})[_0xfed2('0x1e')](handleEntityNotFound(_0x491369,null))[_0xfed2('0x1e')](saveUpdates(_0x5da4d1[_0xfed2('0x58')],null))['then'](respondWithResult(_0x491369,null))['catch'](handleError(_0x491369,null));};exports['destroy']=function(_0x15cd68,_0x2bd871){return db['ServicenowAccount']['find']({'where':{'id':_0x15cd68[_0xfed2('0x55')]['id']}})[_0xfed2('0x1e')](handleEntityNotFound(_0x2bd871,null))[_0xfed2('0x1e')](removeEntity(_0x2bd871,null))[_0xfed2('0x29')](handleError(_0x2bd871,null));};exports[_0xfed2('0x59')]=function(_0x388205,_0x3d4cd8,_0x3b7bea){var _0x134f55={};var _0x49aae4={};var _0x919b86;var _0x2bbe89;return db[_0xfed2('0x3a')][_0xfed2('0x5a')]({'where':{'id':_0x388205[_0xfed2('0x55')]['id']}})[_0xfed2('0x1e')](handleEntityNotFound(_0x3d4cd8,null))[_0xfed2('0x1e')](function(_0xde1f9b){if(_0xde1f9b){_0x919b86=_0xde1f9b;_0x49aae4[_0xfed2('0x3c')]=_['keys'](db[_0xfed2('0x5b')]['rawAttributes']);_0x49aae4[_0xfed2('0x40')]=_['keys'](_0x388205[_0xfed2('0x40')]);_0x49aae4[_0xfed2('0x3e')]=_[_0xfed2('0x3f')](_0x49aae4['model'],_0x49aae4[_0xfed2('0x40')]);_0x134f55[_0xfed2('0x42')]=_[_0xfed2('0x3f')](_0x49aae4[_0xfed2('0x3c')],qs[_0xfed2('0x41')](_0x388205[_0xfed2('0x40')][_0xfed2('0x41')]));_0x134f55[_0xfed2('0x42')]=_0x134f55['attributes'][_0xfed2('0x43')]?_0x134f55[_0xfed2('0x42')]:_0x49aae4[_0xfed2('0x3c')];_0x134f55[_0xfed2('0x45')]=qs[_0xfed2('0x46')](_0x388205[_0xfed2('0x40')][_0xfed2('0x46')]);_0x134f55[_0xfed2('0x49')]=qs[_0xfed2('0x3e')](_[_0xfed2('0x47')](_0x388205[_0xfed2('0x40')],_0x49aae4['filters']));if(_0x388205[_0xfed2('0x40')][_0xfed2('0x48')]){_0x134f55[_0xfed2('0x49')]=_[_0xfed2('0x4a')](_0x134f55[_0xfed2('0x49')],{'$or':_[_0xfed2('0x4b')](_0x134f55[_0xfed2('0x42')],function(_0x565809){var _0x49d365={};_0x49d365[_0x565809]={'$like':'%'+_0x388205[_0xfed2('0x40')][_0xfed2('0x48')]+'%'};return _0x49d365;})});}_0x134f55=_['merge']({},_0x134f55,_0x388205['options']);return _0x919b86[_0xfed2('0x59')](_0x134f55);}})[_0xfed2('0x1e')](function(_0x216d74){if(_0x216d74){_0x2bbe89=_0x216d74[_0xfed2('0x43')];if(!_0x388205[_0xfed2('0x40')]['hasOwnProperty'](_0xfed2('0x5c'))){_0x134f55[_0xfed2('0x30')]=qs[_0xfed2('0x30')](_0x388205[_0xfed2('0x40')][_0xfed2('0x30')]);_0x134f55[_0xfed2('0x2f')]=qs[_0xfed2('0x2f')](_0x388205[_0xfed2('0x40')][_0xfed2('0x2f')]);}return _0x919b86['getConfigurations'](_0x134f55);}})[_0xfed2('0x1e')](function(_0x5c833f){if(_0x5c833f){return _0x5c833f?{'count':_0x2bbe89,'rows':_0x5c833f}:null;}})['then'](respondWithResult(_0x3d4cd8,null))[_0xfed2('0x29')](handleError(_0x3d4cd8,null));};exports[_0xfed2('0x5d')]=function(_0xbe6ad,_0x42ec71,_0x396588){if(_0xbe6ad[_0xfed2('0x58')]['id']){delete _0xbe6ad['body']['id'];}return db[_0xfed2('0x3a')][_0xfed2('0x5a')]({'where':{'id':_0xbe6ad[_0xfed2('0x55')]['id']}})[_0xfed2('0x1e')](handleEntityNotFound(_0x42ec71,null))['then'](function(_0x127320){if(_0x127320){_0xbe6ad['body'][_0xfed2('0x5e')]=_0x127320['id'];_0xbe6ad['body'][_0xfed2('0x5f')]=integrations['getSubjects'](_0xbe6ad['body']['channel'],_0xbe6ad[_0xfed2('0x58')][_0xfed2('0x4c')]);_0xbe6ad[_0xfed2('0x58')][_0xfed2('0x60')]=integrations['getDescriptions'](_0xbe6ad[_0xfed2('0x58')]['channel'],_0xbe6ad[_0xfed2('0x58')]['type']);return db[_0xfed2('0x5b')][_0xfed2('0x57')](_0xbe6ad[_0xfed2('0x58')],{'include':[{'model':db[_0xfed2('0x61')],'as':_0xfed2('0x5f')},{'model':db[_0xfed2('0x61')],'as':'Descriptions'}]});}return null;})[_0xfed2('0x1e')](respondWithResult(_0x42ec71,null))[_0xfed2('0x29')](handleError(_0x42ec71,null));};exports[_0xfed2('0x62')]=function(_0x36870f,_0x1e886a,_0x58498a){var _0x54cf14=['made_sla',_0xfed2('0x63'),_0xfed2('0x64'),_0xfed2('0x65'),_0xfed2('0x66'),_0xfed2('0x67'),_0xfed2('0x68'),'severity',_0xfed2('0x69')];var _0x576fc6=[_0xfed2('0x6a'),_0xfed2('0x6b'),_0xfed2('0x6c'),_0xfed2('0x6d'),_0xfed2('0x6e'),_0xfed2('0x6f'),'child_incidents','hold_reason','approval_history',_0xfed2('0x70'),'resolved_by',_0xfed2('0x71'),_0xfed2('0x72'),_0xfed2('0x73'),'sys_created_on',_0xfed2('0x74'),'state',_0xfed2('0x75'),_0xfed2('0x64'),_0xfed2('0x45'),_0xfed2('0x76'),_0xfed2('0x77'),_0xfed2('0x78'),_0xfed2('0x79'),_0xfed2('0x7a'),_0xfed2('0x7b'),_0xfed2('0x7c'),_0xfed2('0x7d'),_0xfed2('0x7e'),_0xfed2('0x7f'),_0xfed2('0x80'),_0xfed2('0x81'),'expected_start',_0xfed2('0x82'),'business_duration',_0xfed2('0x83'),_0xfed2('0x84'),_0xfed2('0x85'),_0xfed2('0x86'),_0xfed2('0x87'),_0xfed2('0x88'),'subcategory',_0xfed2('0x89'),_0xfed2('0x8a'),_0xfed2('0x66'),'correlation_display','delivery_task',_0xfed2('0x8b'),_0xfed2('0x8c'),'business_stc',_0xfed2('0x8d'),_0xfed2('0x8e'),_0xfed2('0x8f'),_0xfed2('0x67'),_0xfed2('0x90'),_0xfed2('0x91'),'closed_by',_0xfed2('0x92'),_0xfed2('0x93'),_0xfed2('0x94'),_0xfed2('0x95'),'reopened_by',_0xfed2('0x68'),_0xfed2('0x96'),_0xfed2('0x97'),_0xfed2('0x98'),_0xfed2('0x99'),_0xfed2('0x9a'),_0xfed2('0x9b'),_0xfed2('0x9c'),_0xfed2('0x9d'),_0xfed2('0x9e'),_0xfed2('0x9f'),_0xfed2('0xa0'),_0xfed2('0xa1'),_0xfed2('0xa2'),'reopen_count',_0xfed2('0xa3'),_0xfed2('0xa4'),_0xfed2('0xa5'),_0xfed2('0xa6'),_0xfed2('0xa7'),_0xfed2('0x69')];var _0x314268='';var _0x315987='';var _0x2fe17c=[];var _0x2e6903='';var _0xcfdd3='';var _0x23fb2c=[];var _0x5ab2d8='';var _0x27a20d='';var _0x3ada42={};var _0x1a76ce='';return db[_0xfed2('0x3a')][_0xfed2('0x5a')]({'where':{'id':_0x36870f[_0xfed2('0x55')]['id']},'attributes':['id','username','password',_0xfed2('0xa8'),'remoteUri',_0xfed2('0xa9')]})[_0xfed2('0x1e')](handleEntityNotFound(_0x1e886a,null))[_0xfed2('0x1e')](function(_0x249c65){if(_0x249c65){_0x1a76ce=_0x249c65[_0xfed2('0xaa')];var _0x3d4399=_0x1a76ce['slice'](-0x1);if(_0x3d4399==='/'){_0x1a76ce=_0x1a76ce['substring'](0x0,_0x1a76ce['lastIndexOf'](_0x3d4399));}_0x27a20d=util[_0xfed2('0xab')](_0xfed2('0xac'),_0x1a76ce);_0x5ab2d8=util[_0xfed2('0xab')](_0xfed2('0xad'),_0x1a76ce);_0x3ada42={'user':_0x249c65[_0xfed2('0xae')],'pass':_0x249c65[_0xfed2('0xaf')]};var _0x5ecaee={'method':_0xfed2('0xb0'),'uri':_0x27a20d+'incident?sysparm_display_value=all','auth':_0x3ada42,'json':!![]};return rp(_0x5ecaee);}})['then'](function(_0x2afed9){if(_0x2afed9[_0xfed2('0x28')]['length']>0x0){_0x314268=_0x2afed9[_0xfed2('0x28')];}console[_0xfed2('0xb1')]('incident\x20table\x20objects',_0x314268);_0x23fb2c=[];_0x315987=Object[_0xfed2('0xb2')]([],_0x314268);_[_0xfed2('0xb3')](_0x315987,function(_0x4eb93d){return!_0x54cf14[_0xfed2('0xb4')](_0x4eb93d['name']);});_0x315987['forEach'](function(_0x5cbdea){var _0xebd5f1=createFieldObject(_0x5ab2d8,_0x3ada42,_0x5cbdea[_0xfed2('0xb5')],_0x5cbdea['name'],_0x5cbdea[_0xfed2('0xb6')],![]);_0x23fb2c[_0xfed2('0xb7')](_0xebd5f1);});return Promise['all'](_0x23fb2c);})['then'](function(_0x285dfc){_0x2fe17c=_0x285dfc;_0x2e6903=Object[_0xfed2('0xb2')]([],_0x314268);console[_0xfed2('0xb1')](_0xfed2('0xb8'),_0x314268);_['remove'](_0x2e6903,function(_0x5a698d){return _0x576fc6[_0xfed2('0xb4')](_0x5a698d[_0xfed2('0x38')]);});console[_0xfed2('0xb1')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x2e6903);_0x23fb2c=[];_0x2e6903[_0xfed2('0xb9')](function(_0x536889){var _0x29a7dc=createFieldObject(_0x5ab2d8,_0x3ada42,_0x536889[_0xfed2('0xb5')],_0x536889[_0xfed2('0x38')],_0x536889[_0xfed2('0xb6')],!![]);_0x23fb2c[_0xfed2('0xb7')](_0x29a7dc);});return Promise['all'](_0x23fb2c);})[_0xfed2('0x1e')](function(_0x197940){_0xcfdd3=_0x197940;var _0x107e87=_0x2fe17c[_0xfed2('0xba')](_0xcfdd3);return{'count':_0x107e87[_0xfed2('0x43')],'rows':_0x107e87};})['then'](respondWithResult(_0x1e886a,null))['catch'](function(_0x44088e){console[_0xfed2('0xb1')](_0xfed2('0xbb')+_0x44088e);var _0x2619d4=_0x36870f[_0xfed2('0x40')][_0xfed2('0xbc')]?0x1f4:_0x44088e[_0xfed2('0xbd')]||0x1f4;logger[_0xfed2('0x25')](_0x44088e[_0xfed2('0x37')]);delete _0x44088e['name'];if(_0x2619d4===0x191){_0x2619d4=0x190;}_0x1e886a[_0xfed2('0x2b')](_0x2619d4)[_0xfed2('0x39')](_0x36870f[_0xfed2('0x40')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x44088e['statusCode']}:_0x44088e);});};function createFieldObject(_0x170cd6,_0x186c47,_0xfbc679,_0x55c81b,_0x5d5fcf,_0x8983b5){return new Promise(function(_0x171837,_0x358c5b){var _0x18a32b={'id':_0x55c81b,'name':_0x5d5fcf,'custom':_0x8983b5};if(_0xfbc679===_0xfed2('0xbe')){_0x18a32b[_0xfed2('0x50')]=[{'name':_0xfed2('0xbf'),'value':_0xfed2('0xc0')},{'name':_0xfed2('0xc1'),'value':'false'}];_0x171837(_0x18a32b);}else{var _0x44d13f={'method':'GET','uri':_0x170cd6+_0xfed2('0xc2')+_0x55c81b,'auth':_0x186c47,'json':!![]};return rp(_0x44d13f)['then'](function(_0x72acf5){var _0x571c4c=[];if(_0x72acf5[_0xfed2('0x28')][_0xfed2('0x43')]>0x0){_0x72acf5[_0xfed2('0x28')][_0xfed2('0xb9')](function(_0x8742dd){if(_0x8742dd['inactive']===_0xfed2('0xc3')){var _0xd045a4={'name':_0x8742dd[_0xfed2('0xb6')],'value':_0x8742dd[_0xfed2('0xc4')]};_0x571c4c[_0xfed2('0xb7')](_0xd045a4);}});}_0x18a32b[_0xfed2('0x50')]=_0x571c4c;if(_0x18a32b[_0xfed2('0x50')]['length']>0x0){_0x171837(_0x18a32b);}else{if(_0x8983b5==![]){_0x171837();}else{_0x171837(_0x18a32b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0fd0fe3..8304a01 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 _0xae24=['../../config/logger','moment','bluebird','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x562458,_0xd892a0){var _0x51ff2b=function(_0x2e2ffc){while(--_0x2e2ffc){_0x562458['push'](_0x562458['shift']());}};_0x51ff2b(++_0xd892a0);}(_0xae24,0x182));var _0x4ae2=function(_0x2aa31e,_0x5d0f3f){_0x2aa31e=_0x2aa31e-0x0;var _0x5f35c3=_0xae24[_0x2aa31e];return _0x5f35c3;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));var integrations=require(_0x4ae2('0x6'));module[_0x4ae2('0x7')]=function(_0x3e6055,_0x428054){return _0x3e6055[_0x4ae2('0x8')]('ServicenowAccount',attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x3e206c,_0x545bd4){var _0x44d559=function(_0x1dbaa3){while(--_0x1dbaa3){_0x3e206c['push'](_0x3e206c['shift']());}};_0x44d559(++_0x545bd4);}(_0x2eb2,0x19f));var _0x22eb=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x2eb2[_0x18cd5b];return _0x5eaa52;};'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('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 00f2c77..f8b8b64 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 _0xb74c=['find','where','debug','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount'];(function(_0x5d37dc,_0x275ee5){var _0x25343a=function(_0x501268){while(--_0x501268){_0x5d37dc['push'](_0x5d37dc['shift']());}};_0x25343a(++_0x275ee5);}(_0xb74c,0x8b));var _0xcb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xcb74('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb74('0x1'));var fs=require('fs');var Redis=require(_0xcb74('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb74('0x3'));var logger=require(_0xcb74('0x4'))(_0xcb74('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb74('0x6')][_0xcb74('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c9207,_0x2b94b1,_0x2e880a){return new BPromise(function(_0x55c9a7,_0xb0b4eb){return client[_0xcb74('0x8')](_0x2c9207,_0x2e880a)[_0xcb74('0x9')](function(_0x140fe4){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x2b94b1,_0xcb74('0xa'));logger['debug'](_0xcb74('0xb'),_0x2b94b1,_0xcb74('0xa'),JSON[_0xcb74('0xc')](_0x140fe4));if(_0x140fe4[_0xcb74('0xd')]){if(_0x140fe4[_0xcb74('0xd')][_0xcb74('0xe')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2b94b1,_0x140fe4[_0xcb74('0xd')]['message']);return _0xb0b4eb(_0x140fe4[_0xcb74('0xd')][_0xcb74('0xf')]);}logger[_0xcb74('0xd')](_0xcb74('0x10'),_0x2b94b1,_0x140fe4[_0xcb74('0xd')]['message']);return _0x55c9a7(_0x140fe4[_0xcb74('0xd')][_0xcb74('0xf')]);}else{logger[_0xcb74('0x11')](_0xcb74('0x10'),_0x2b94b1,'request\x20sent');_0x55c9a7(_0x140fe4[_0xcb74('0x12')]['message']);}})[_0xcb74('0x13')](function(_0x1755bc){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2b94b1,_0x1755bc);_0xb0b4eb(_0x1755bc);});});}exports[_0xcb74('0x14')]=function(_0x3f9b94){var _0x4bfa0f=this;return new Promise(function(_0x4d73c1,_0x3160c9){return db[_0xcb74('0x15')][_0xcb74('0x16')]({'raw':_0x3f9b94[_0xcb74('0x17')]?_0x3f9b94[_0xcb74('0x17')][_0xcb74('0x18')]===undefined?!![]:![]:!![],'where':_0x3f9b94['options']?_0x3f9b94[_0xcb74('0x17')]['where']||null:null,'attributes':_0x3f9b94[_0xcb74('0x17')]?_0x3f9b94['options'][_0xcb74('0x19')]||null:null,'limit':_0x3f9b94[_0xcb74('0x17')]?_0x3f9b94[_0xcb74('0x17')][_0xcb74('0x1a')]||null:null,'include':_0x3f9b94[_0xcb74('0x17')]?_0x3f9b94[_0xcb74('0x17')][_0xcb74('0x1b')]?_[_0xcb74('0x1c')](_0x3f9b94[_0xcb74('0x17')][_0xcb74('0x1b')],function(_0x3870fc){return{'model':db[_0x3870fc[_0xcb74('0x1d')]],'as':_0x3870fc['as'],'attributes':_0x3870fc[_0xcb74('0x19')],'include':_0x3870fc[_0xcb74('0x1b')]?_[_0xcb74('0x1c')](_0x3870fc[_0xcb74('0x1b')],function(_0x20accc){return{'model':db[_0x20accc[_0xcb74('0x1d')]],'as':_0x20accc['as'],'attributes':_0x20accc[_0xcb74('0x19')],'include':_0x20accc[_0xcb74('0x1b')]?_['map'](_0x20accc[_0xcb74('0x1b')],function(_0x89aeec){return{'model':db[_0x89aeec['model']],'as':_0x89aeec['as'],'attributes':_0x89aeec[_0xcb74('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x494018){logger[_0xcb74('0x11')](_0xcb74('0x14'),_0x3f9b94);logger['debug'](_0xcb74('0x14'),_0x3f9b94,JSON['stringify'](_0x494018));_0x4d73c1(_0x494018);})[_0xcb74('0x13')](function(_0x443a01){logger[_0xcb74('0xd')](_0xcb74('0x14'),_0x443a01[_0xcb74('0xf')],_0x3f9b94);_0x3160c9(_0x4bfa0f[_0xcb74('0xd')](0x1f4,_0x443a01['message']));});});};exports[_0xcb74('0x1e')]=function(_0x375d87){var _0x2793d5=this;return new Promise(function(_0x52e9a1,_0x9ac39){return db[_0xcb74('0x15')][_0xcb74('0x1f')]({'raw':_0x375d87[_0xcb74('0x17')]?_0x375d87[_0xcb74('0x17')][_0xcb74('0x18')]===undefined?!![]:![]:!![],'where':_0x375d87['options']?_0x375d87[_0xcb74('0x17')][_0xcb74('0x20')]||null:null,'attributes':_0x375d87['options']?_0x375d87[_0xcb74('0x17')][_0xcb74('0x19')]||null:null,'include':_0x375d87[_0xcb74('0x17')]?_0x375d87[_0xcb74('0x17')][_0xcb74('0x1b')]?_['map'](_0x375d87['options'][_0xcb74('0x1b')],function(_0x11b141){return{'model':db[_0x11b141[_0xcb74('0x1d')]],'as':_0x11b141['as'],'attributes':_0x11b141[_0xcb74('0x19')],'include':_0x11b141['include']?_[_0xcb74('0x1c')](_0x11b141['include'],function(_0x5d2335){return{'model':db[_0x5d2335[_0xcb74('0x1d')]],'as':_0x5d2335['as'],'attributes':_0x5d2335[_0xcb74('0x19')],'include':_0x5d2335[_0xcb74('0x1b')]?_[_0xcb74('0x1c')](_0x5d2335[_0xcb74('0x1b')],function(_0xf7bec4){return{'model':db[_0xf7bec4['model']],'as':_0xf7bec4['as'],'attributes':_0xf7bec4[_0xcb74('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcb74('0x9')](function(_0x3b3188){logger['info']('ShowServicenowAccount',_0x375d87);logger[_0xcb74('0x21')](_0xcb74('0x1e'),_0x375d87,JSON[_0xcb74('0xc')](_0x3b3188));_0x52e9a1(_0x3b3188);})[_0xcb74('0x13')](function(_0x526c11){logger['error']('ShowServicenowAccount',_0x526c11['message'],_0x375d87);_0x9ac39(_0x2793d5[_0xcb74('0xd')](0x1f4,_0x526c11[_0xcb74('0xf')]));});});}; \ No newline at end of file +var _0x675b=['rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','raw','options','where','attributes','limit','include','map','model','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfb65aa,_0x1651a6){var _0x2aee31=function(_0x492245){while(--_0x492245){_0xfb65aa['push'](_0xfb65aa['shift']());}};_0x2aee31(++_0x1651a6);}(_0x675b,0x14d));var _0xb675=function(_0x2c4d2c,_0x433527){_0x2c4d2c=_0x2c4d2c-0x0;var _0x769dcf=_0x675b[_0x2c4d2c];return _0x769dcf;};'use strict';var _=require(_0xb675('0x0'));var util=require(_0xb675('0x1'));var moment=require(_0xb675('0x2'));var BPromise=require(_0xb675('0x3'));var rs=require(_0xb675('0x4'));var fs=require('fs');var Redis=require(_0xb675('0x5'));var db=require(_0xb675('0x6'))['db'];var utils=require(_0xb675('0x7'));var logger=require(_0xb675('0x8'))(_0xb675('0x9'));var config=require(_0xb675('0xa'));var jayson=require(_0xb675('0xb'));var client=jayson[_0xb675('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea852,_0x5e0600,_0x48b4fb){return new BPromise(function(_0x141518,_0x5026fa){return client[_0xb675('0xd')](_0x5ea852,_0x48b4fb)[_0xb675('0xe')](function(_0x22bfee){logger[_0xb675('0xf')](_0xb675('0x10'),_0x5e0600,_0xb675('0x11'));logger[_0xb675('0x12')](_0xb675('0x13'),_0x5e0600,_0xb675('0x11'),JSON[_0xb675('0x14')](_0x22bfee));if(_0x22bfee[_0xb675('0x15')]){if(_0x22bfee[_0xb675('0x15')][_0xb675('0x16')]===0x1f4){logger[_0xb675('0x15')](_0xb675('0x10'),_0x5e0600,_0x22bfee[_0xb675('0x15')][_0xb675('0x17')]);return _0x5026fa(_0x22bfee[_0xb675('0x15')][_0xb675('0x17')]);}logger[_0xb675('0x15')]('ServicenowAccount,\x20%s,\x20%s',_0x5e0600,_0x22bfee[_0xb675('0x15')]['message']);return _0x141518(_0x22bfee[_0xb675('0x15')][_0xb675('0x17')]);}else{logger[_0xb675('0xf')](_0xb675('0x10'),_0x5e0600,'request\x20sent');_0x141518(_0x22bfee[_0xb675('0x18')][_0xb675('0x17')]);}})[_0xb675('0x19')](function(_0x4cea32){logger['error'](_0xb675('0x10'),_0x5e0600,_0x4cea32);_0x5026fa(_0x4cea32);});});}exports[_0xb675('0x1a')]=function(_0x37cef6){var _0xa6610e=this;return new Promise(function(_0x3c206f,_0x1ffdd7){return db[_0xb675('0x1b')][_0xb675('0x1c')]({'raw':_0x37cef6['options']?_0x37cef6['options'][_0xb675('0x1d')]===undefined?!![]:![]:!![],'where':_0x37cef6['options']?_0x37cef6[_0xb675('0x1e')][_0xb675('0x1f')]||null:null,'attributes':_0x37cef6[_0xb675('0x1e')]?_0x37cef6[_0xb675('0x1e')][_0xb675('0x20')]||null:null,'limit':_0x37cef6['options']?_0x37cef6[_0xb675('0x1e')][_0xb675('0x21')]||null:null,'include':_0x37cef6[_0xb675('0x1e')]?_0x37cef6['options']['include']?_['map'](_0x37cef6[_0xb675('0x1e')][_0xb675('0x22')],function(_0x44e9ac){return{'model':db[_0x44e9ac['model']],'as':_0x44e9ac['as'],'attributes':_0x44e9ac[_0xb675('0x20')],'include':_0x44e9ac['include']?_[_0xb675('0x23')](_0x44e9ac[_0xb675('0x22')],function(_0x40317e){return{'model':db[_0x40317e[_0xb675('0x24')]],'as':_0x40317e['as'],'attributes':_0x40317e['attributes'],'include':_0x40317e[_0xb675('0x22')]?_[_0xb675('0x23')](_0x40317e['include'],function(_0x3d6672){return{'model':db[_0x3d6672[_0xb675('0x24')]],'as':_0x3d6672['as'],'attributes':_0x3d6672[_0xb675('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb675('0xe')](function(_0x1951ca){logger[_0xb675('0xf')](_0xb675('0x1a'),_0x37cef6);logger[_0xb675('0x12')](_0xb675('0x1a'),_0x37cef6,JSON[_0xb675('0x14')](_0x1951ca));_0x3c206f(_0x1951ca);})[_0xb675('0x19')](function(_0x2fc8a5){logger['error']('GetServicenowAccount',_0x2fc8a5[_0xb675('0x17')],_0x37cef6);_0x1ffdd7(_0xa6610e[_0xb675('0x15')](0x1f4,_0x2fc8a5[_0xb675('0x17')]));});});};exports[_0xb675('0x25')]=function(_0x42bdd0){var _0x3d8e8e=this;return new Promise(function(_0x58723b,_0x19e870){return db[_0xb675('0x1b')]['find']({'raw':_0x42bdd0['options']?_0x42bdd0[_0xb675('0x1e')][_0xb675('0x1d')]===undefined?!![]:![]:!![],'where':_0x42bdd0[_0xb675('0x1e')]?_0x42bdd0[_0xb675('0x1e')][_0xb675('0x1f')]||null:null,'attributes':_0x42bdd0[_0xb675('0x1e')]?_0x42bdd0[_0xb675('0x1e')][_0xb675('0x20')]||null:null,'include':_0x42bdd0[_0xb675('0x1e')]?_0x42bdd0[_0xb675('0x1e')][_0xb675('0x22')]?_['map'](_0x42bdd0[_0xb675('0x1e')][_0xb675('0x22')],function(_0x4eefe2){return{'model':db[_0x4eefe2[_0xb675('0x24')]],'as':_0x4eefe2['as'],'attributes':_0x4eefe2[_0xb675('0x20')],'include':_0x4eefe2[_0xb675('0x22')]?_[_0xb675('0x23')](_0x4eefe2[_0xb675('0x22')],function(_0x26cffa){return{'model':db[_0x26cffa[_0xb675('0x24')]],'as':_0x26cffa['as'],'attributes':_0x26cffa['attributes'],'include':_0x26cffa[_0xb675('0x22')]?_[_0xb675('0x23')](_0x26cffa[_0xb675('0x22')],function(_0x3e9010){return{'model':db[_0x3e9010[_0xb675('0x24')]],'as':_0x3e9010['as'],'attributes':_0x3e9010['attributes']};}):[]};}):[]};}):[]:[]})[_0xb675('0xe')](function(_0x424446){logger['info'](_0xb675('0x25'),_0x42bdd0);logger[_0xb675('0x12')](_0xb675('0x25'),_0x42bdd0,JSON[_0xb675('0x14')](_0x424446));_0x58723b(_0x424446);})[_0xb675('0x19')](function(_0x11c696){logger[_0xb675('0x15')]('ShowServicenowAccount',_0x11c696['message'],_0x42bdd0);_0x19e870(_0x3d8e8e['error'](0x1f4,_0x11c696[_0xb675('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 69db38a..b4c1b3c 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 _0x0050=['show','get','/:id/fields','getFields','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x125056,_0x38848b){var _0x3bc333=function(_0x568a39){while(--_0x568a39){_0x125056['push'](_0x125056['shift']());}};_0x3bc333(++_0x38848b);}(_0x0050,0x186));var _0x0005=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0050[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x0005('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0005('0x1'));var express=require(_0x0005('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0005('0x3'));var config=require(_0x0005('0x4'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x0005('0x5')](),controller[_0x0005('0x6')]);router[_0x0005('0x7')](_0x0005('0x8'),auth[_0x0005('0x5')](),controller[_0x0005('0x9')]);router[_0x0005('0x7')]('/:id/subjects',auth[_0x0005('0x5')](),controller['getSubjects']);router[_0x0005('0x7')](_0x0005('0xa'),auth[_0x0005('0x5')](),controller[_0x0005('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0005('0xc')]);router[_0x0005('0xd')](_0x0005('0xe'),auth['isAuthenticated'](),controller[_0x0005('0xf')]);router[_0x0005('0x10')]('/:id',auth[_0x0005('0x5')](),controller[_0x0005('0x11')]);module['exports']=router; \ No newline at end of file +var _0xba04=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','multer','path'];(function(_0x4afa81,_0x2b900a){var _0x30d928=function(_0x1b8ff4){while(--_0x1b8ff4){_0x4afa81['push'](_0x4afa81['shift']());}};_0x30d928(++_0x2b900a);}(_0xba04,0x82));var _0x4ba0=function(_0x5626c2,_0x1aba97){_0x5626c2=_0x5626c2-0x0;var _0x2d581a=_0xba04[_0x5626c2];return _0x2d581a;};'use strict';var multer=require(_0x4ba0('0x0'));var util=require('util');var path=require(_0x4ba0('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ba0('0x2'));var router=express[_0x4ba0('0x3')]();var auth=require(_0x4ba0('0x4'));var interaction=require(_0x4ba0('0x5'));var config=require(_0x4ba0('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x4ba0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4ba0('0x8')]);router['get'](_0x4ba0('0x9'),auth['isAuthenticated'](),controller[_0x4ba0('0xa')]);router['get'](_0x4ba0('0xb'),auth[_0x4ba0('0xc')](),controller[_0x4ba0('0xd')]);router[_0x4ba0('0x7')](_0x4ba0('0xe'),auth['isAuthenticated'](),controller[_0x4ba0('0xf')]);router[_0x4ba0('0x10')]('/',auth[_0x4ba0('0xc')](),controller[_0x4ba0('0x11')]);router[_0x4ba0('0x12')](_0x4ba0('0x13'),auth[_0x4ba0('0xc')](),controller[_0x4ba0('0x14')]);router['delete'](_0x4ba0('0x13'),auth[_0x4ba0('0xc')](),controller[_0x4ba0('0x15')]);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 09b31b9..32bf4f2 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 _0xa8f3=['sequelize','exports','STRING'];(function(_0x12df94,_0x43132c){var _0x297cf8=function(_0x38cd54){while(--_0x38cd54){_0x12df94['push'](_0x12df94['shift']());}};_0x297cf8(++_0x43132c);}(_0xa8f3,0x6c));var _0x3a8f=function(_0x45581f,_0x31ee56){_0x45581f=_0x45581f-0x0;var _0xb7fcbf=_0xa8f3[_0x45581f];return _0xb7fcbf;};'use strict';var Sequelize=require(_0x3a8f('0x0'));module[_0x3a8f('0x1')]={'name':{'type':Sequelize[_0x3a8f('0x2')]},'description':{'type':Sequelize[_0x3a8f('0x2')]}}; \ No newline at end of file +var _0xf85b=['STRING','exports'];(function(_0x388732,_0x2da18a){var _0x56f2d1=function(_0x16cd89){while(--_0x16cd89){_0x388732['push'](_0x388732['shift']());}};_0x56f2d1(++_0x2da18a);}(_0xf85b,0x135));var _0xbf85=function(_0x34dc17,_0x3b91d3){_0x34dc17=_0x34dc17-0x0;var _0x5c9a68=_0xf85b[_0x34dc17];return _0x5c9a68;};'use strict';var Sequelize=require('sequelize');module[_0xbf85('0x0')]={'name':{'type':Sequelize[_0xbf85('0x1')]},'description':{'type':Sequelize[_0xbf85('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index b8aa83c..3619c11 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 _0x7266=['request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','type','key','merge','includeAll','include','ServicenowConfiguration','findAll','rows','show','params','options','create','body','find','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x2d4a86,_0xe8e449){var _0x4518b2=function(_0x437c22){while(--_0x437c22){_0x2d4a86['push'](_0x2d4a86['shift']());}};_0x4518b2(++_0xe8e449);}(_0x7266,0xec));var _0x6726=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7266[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x6726('0x0'));var emlformat=require(_0x6726('0x1'));var rimraf=require(_0x6726('0x2'));var zipdir=require(_0x6726('0x3'));var jsonpatch=require(_0x6726('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6726('0x5'));var Mustache=require(_0x6726('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6726('0x7'));var csv=require(_0x6726('0x8'));var ejs=require(_0x6726('0x9'));var fs=require('fs');var _=require(_0x6726('0xa'));var squel=require(_0x6726('0xb'));var crypto=require(_0x6726('0xc'));var jsforce=require(_0x6726('0xd'));var deskjs=require(_0x6726('0xe'));var toCsv=require(_0x6726('0x8'));var querystring=require(_0x6726('0xf'));var Papa=require(_0x6726('0x10'));var Redis=require(_0x6726('0x11'));var authService=require(_0x6726('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x6726('0x13'));var logger=require(_0x6726('0x14'))(_0x6726('0x15'));var utils=require(_0x6726('0x16'));var config=require('../../config/environment');var db=require(_0x6726('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6726('0x18')][_0x6726('0x19')]({'port':0x232a});function checkPasswordPattern(_0x59c044,_0x1d088c,_0x2b7fb8){if(_0x2b7fb8){var _0x1182b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1182b2[_0x6726('0x1a')](_0x1d088c)){return _0x59c044;}else{throw new db['Sequelize'][(_0x6726('0x1b'))](_0x6726('0x1c'));}}else{return _0x59c044;}}function respondWithRpcPromise(_0x4dc47d,_0x9467a8,_0x5d3458,_0x12f043){return new BPromise(function(_0x36361d,_0xc1fed9){var _0x3a3b6a=_0x12f043||client;return _0x3a3b6a['request'](_0x4dc47d,_0x5d3458)[_0x6726('0x1d')](function(_0x46c5f5){logger['info'](_0x6726('0x1e'),_0x9467a8,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x9467a8,_0x6726('0x1f'),JSON[_0x6726('0x20')](_0x46c5f5));if(_0x46c5f5['error']){if(_0x46c5f5[_0x6726('0x21')][_0x6726('0x22')]===0x1f4){logger[_0x6726('0x21')](_0x6726('0x1e'),_0x9467a8,_0x46c5f5[_0x6726('0x21')][_0x6726('0x23')]);return _0xc1fed9(_0x46c5f5['error'][_0x6726('0x23')]);}logger['error'](_0x6726('0x1e'),_0x9467a8,_0x46c5f5[_0x6726('0x21')][_0x6726('0x23')]);return _0x36361d(_0x46c5f5[_0x6726('0x21')][_0x6726('0x23')]);}else{logger[_0x6726('0x24')]('ServicenowConfiguration,\x20%s,\x20%s',_0x9467a8,_0x6726('0x1f'));_0x36361d(_0x46c5f5[_0x6726('0x25')][_0x6726('0x23')]);}})[_0x6726('0x26')](function(_0x544b2b){logger[_0x6726('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x9467a8,_0x544b2b);_0xc1fed9(_0x544b2b);});});}function respondWithStatusCode(_0x497d49,_0x3cce96){_0x3cce96=_0x3cce96||0xcc;return function(_0x22d4f5){if(_0x22d4f5){return _0x497d49[_0x6726('0x27')](_0x3cce96);}return _0x497d49[_0x6726('0x28')](_0x3cce96)['end']();};}function respondWithResult(_0x2f2da3,_0x2c8068){_0x2c8068=_0x2c8068||0xc8;return function(_0x14cb1d){if(_0x14cb1d){return _0x2f2da3['status'](_0x2c8068)[_0x6726('0x29')](_0x14cb1d);}};}function respondWithFilteredResult(_0x5d25a0,_0x4fd2fd){return function(_0x50c743){if(_0x50c743){var _0x23e557=_0x50c743['count'],_0x24b355=_0x4fd2fd[_0x6726('0x2a')],_0x199af0=_0x4fd2fd[_0x6726('0x2a')]+_0x4fd2fd[_0x6726('0x2b')],_0x35382d;if(_0x199af0>=_0x23e557){_0x199af0=_0x23e557;_0x35382d=0xc8;}else{_0x35382d=0xce;}_0x5d25a0['status'](_0x35382d);return _0x5d25a0[_0x6726('0x2c')](_0x6726('0x2d'),_0x24b355+'-'+_0x199af0+'/'+_0x23e557)['json'](_0x50c743);}return null;};}function patchUpdates(_0x1f5946){return function(_0x1d2eeb){try{jsonpatch[_0x6726('0x2e')](_0x1d2eeb,_0x1f5946,!![]);}catch(_0x1a5c29){return BPromise[_0x6726('0x2f')](_0x1a5c29);}return _0x1d2eeb[_0x6726('0x30')]();};}function saveUpdates(_0x1a0453,_0x4a3cf){return function(_0x4e320a){if(_0x4e320a){return _0x4e320a[_0x6726('0x31')](_0x1a0453)[_0x6726('0x1d')](function(_0x2934de){return _0x2934de;});}return null;};}function removeEntity(_0x34a599,_0x3af1e0){return function(_0x2b1c64){if(_0x2b1c64){return _0x2b1c64[_0x6726('0x32')]()[_0x6726('0x1d')](function(){_0x34a599['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24e944,_0x49d394){return function(_0x1c4763){if(!_0x1c4763){_0x24e944[_0x6726('0x27')](0x194);}return _0x1c4763;};}function handleError(_0x548d4d,_0x39c4e3){_0x39c4e3=_0x39c4e3||0x1f4;return function(_0x41ec6b){logger[_0x6726('0x21')](_0x41ec6b['stack']);if(_0x41ec6b[_0x6726('0x33')]){delete _0x41ec6b[_0x6726('0x33')];}_0x548d4d['status'](_0x39c4e3)['send'](_0x41ec6b);};}exports[_0x6726('0x34')]=function(_0x3fada5,_0x44ff92){var _0x134e90={},_0x378c66={},_0x33a6ec={'count':0x0,'rows':[]};var _0x560c9e=db['ServicenowConfiguration'][_0x6726('0x35')];_0x378c66[_0x6726('0x36')]=_[_0x6726('0x37')](_0x560c9e);_0x378c66[_0x6726('0x38')]=_[_0x6726('0x37')](_0x3fada5['query']);_0x378c66[_0x6726('0x39')]=_[_0x6726('0x3a')](_0x378c66['model'],_0x378c66[_0x6726('0x38')]);_0x134e90[_0x6726('0x3b')]=_[_0x6726('0x3a')](_0x378c66[_0x6726('0x36')],qs[_0x6726('0x3c')](_0x3fada5[_0x6726('0x38')][_0x6726('0x3c')]));_0x134e90[_0x6726('0x3b')]=_0x134e90[_0x6726('0x3b')][_0x6726('0x3d')]?_0x134e90[_0x6726('0x3b')]:_0x378c66[_0x6726('0x36')];if(!_0x3fada5[_0x6726('0x38')][_0x6726('0x3e')](_0x6726('0x3f'))){_0x134e90[_0x6726('0x2b')]=qs[_0x6726('0x2b')](_0x3fada5[_0x6726('0x38')][_0x6726('0x2b')]);_0x134e90[_0x6726('0x2a')]=qs['offset'](_0x3fada5['query'][_0x6726('0x2a')]);}_0x134e90['order']=qs[_0x6726('0x40')](_0x3fada5[_0x6726('0x38')][_0x6726('0x40')]);_0x134e90[_0x6726('0x41')]=qs[_0x6726('0x39')](_[_0x6726('0x42')](_0x3fada5['query'],_0x378c66[_0x6726('0x39')]));if(_0x3fada5['query'][_0x6726('0x43')]){_0x134e90['where']=_['merge'](_0x134e90[_0x6726('0x41')],{'$or':_[_0x6726('0x44')](_0x560c9e,function(_0x5e74cb){if(_0x5e74cb[_0x6726('0x45')][_0x6726('0x46')]!=='VIRTUAL'){var _0xb7cc29={};_0xb7cc29[_0x5e74cb['field']]={'$like':'%'+_0x3fada5['query']['filter']+'%'};return _0xb7cc29;}})});}_0x134e90=_[_0x6726('0x47')]({},_0x134e90,_0x3fada5['options']);var _0x5f097d={'where':_0x134e90[_0x6726('0x41')]};return db['ServicenowConfiguration']['count'](_0x5f097d)[_0x6726('0x1d')](function(_0xb2bac6){_0x33a6ec['count']=_0xb2bac6;if(_0x3fada5['query'][_0x6726('0x48')]){_0x134e90[_0x6726('0x49')]=[{'all':!![]}];}return db[_0x6726('0x4a')][_0x6726('0x4b')](_0x134e90);})[_0x6726('0x1d')](function(_0x28e79e){_0x33a6ec[_0x6726('0x4c')]=_0x28e79e;return _0x33a6ec;})[_0x6726('0x1d')](respondWithFilteredResult(_0x44ff92,_0x134e90))[_0x6726('0x26')](handleError(_0x44ff92,null));};exports[_0x6726('0x4d')]=function(_0x332193,_0x372f47){var _0x5254b0={'raw':![],'where':{'id':_0x332193[_0x6726('0x4e')]['id']}},_0x30a4db={};_0x30a4db['model']=_[_0x6726('0x37')](db[_0x6726('0x4a')][_0x6726('0x35')]);_0x30a4db[_0x6726('0x38')]=_[_0x6726('0x37')](_0x332193['query']);_0x30a4db[_0x6726('0x39')]=_[_0x6726('0x3a')](_0x30a4db[_0x6726('0x36')],_0x30a4db[_0x6726('0x38')]);_0x5254b0[_0x6726('0x3b')]=_[_0x6726('0x3a')](_0x30a4db[_0x6726('0x36')],qs[_0x6726('0x3c')](_0x332193['query']['fields']));_0x5254b0[_0x6726('0x3b')]=_0x5254b0[_0x6726('0x3b')][_0x6726('0x3d')]?_0x5254b0[_0x6726('0x3b')]:_0x30a4db['model'];if(_0x332193[_0x6726('0x38')][_0x6726('0x48')]){_0x5254b0['include']=[{'all':!![]}];}_0x5254b0=_[_0x6726('0x47')]({},_0x5254b0,_0x332193[_0x6726('0x4f')]);return db[_0x6726('0x4a')]['find'](_0x5254b0)[_0x6726('0x1d')](handleEntityNotFound(_0x372f47,null))[_0x6726('0x1d')](respondWithResult(_0x372f47,null))[_0x6726('0x26')](handleError(_0x372f47,null));};exports[_0x6726('0x50')]=function(_0x164977,_0x9028ed){return db[_0x6726('0x4a')][_0x6726('0x50')](_0x164977[_0x6726('0x51')],{})['then'](respondWithResult(_0x9028ed,0xc9))[_0x6726('0x26')](handleError(_0x9028ed,null));};exports[_0x6726('0x31')]=function(_0x2f6574,_0x326011){if(_0x2f6574[_0x6726('0x51')]['id']){delete _0x2f6574[_0x6726('0x51')]['id'];}return db[_0x6726('0x4a')][_0x6726('0x52')]({'where':{'id':_0x2f6574[_0x6726('0x4e')]['id']}})[_0x6726('0x1d')](handleEntityNotFound(_0x326011,null))['then'](saveUpdates(_0x2f6574['body'],null))[_0x6726('0x1d')](respondWithResult(_0x326011,null))['catch'](handleError(_0x326011,null));};exports['destroy']=function(_0x274ac9,_0x59113c){return db[_0x6726('0x4a')][_0x6726('0x52')]({'where':{'id':_0x274ac9[_0x6726('0x4e')]['id']}})[_0x6726('0x1d')](handleEntityNotFound(_0x59113c,null))[_0x6726('0x1d')](removeEntity(_0x59113c,null))[_0x6726('0x26')](handleError(_0x59113c,null));};exports[_0x6726('0x53')]=function(_0x3a86d4,_0x4913fa,_0x2976dd){var _0xa74df8={};var _0x28f5d9={};var _0x3a454c;var _0x3f83bc;return db[_0x6726('0x4a')][_0x6726('0x54')]({'where':{'id':_0x3a86d4['params']['id']}})[_0x6726('0x1d')](handleEntityNotFound(_0x4913fa,null))[_0x6726('0x1d')](function(_0x309921){if(_0x309921){_0x3a454c=_0x309921;_0x28f5d9['model']=_['keys'](db[_0x6726('0x55')][_0x6726('0x35')]);_0x28f5d9['query']=_[_0x6726('0x37')](_0x3a86d4[_0x6726('0x38')]);_0x28f5d9['filters']=_['intersection'](_0x28f5d9['model'],_0x28f5d9[_0x6726('0x38')]);_0xa74df8[_0x6726('0x3b')]=_[_0x6726('0x3a')](_0x28f5d9[_0x6726('0x36')],qs[_0x6726('0x3c')](_0x3a86d4['query'][_0x6726('0x3c')]));_0xa74df8['attributes']=_0xa74df8[_0x6726('0x3b')]['length']?_0xa74df8[_0x6726('0x3b')]:_0x28f5d9[_0x6726('0x36')];_0xa74df8[_0x6726('0x56')]=qs[_0x6726('0x40')](_0x3a86d4[_0x6726('0x38')]['sort']);_0xa74df8[_0x6726('0x41')]=qs['filters'](_[_0x6726('0x42')](_0x3a86d4[_0x6726('0x38')],_0x28f5d9[_0x6726('0x39')]));if(_0x3a86d4[_0x6726('0x38')][_0x6726('0x43')]){_0xa74df8[_0x6726('0x41')]=_[_0x6726('0x47')](_0xa74df8['where'],{'$or':_[_0x6726('0x44')](_0xa74df8[_0x6726('0x3b')],function(_0x5a4df8){var _0x5bb851={};_0x5bb851[_0x5a4df8]={'$like':'%'+_0x3a86d4[_0x6726('0x38')][_0x6726('0x43')]+'%'};return _0x5bb851;})});}_0xa74df8=_[_0x6726('0x47')]({},_0xa74df8,_0x3a86d4[_0x6726('0x4f')]);return _0x3a454c[_0x6726('0x53')](_0xa74df8);}})[_0x6726('0x1d')](function(_0x3a3542){if(_0x3a3542){_0x3f83bc=_0x3a3542[_0x6726('0x3d')];if(!_0x3a86d4[_0x6726('0x38')][_0x6726('0x3e')](_0x6726('0x3f'))){_0xa74df8[_0x6726('0x2b')]=qs[_0x6726('0x2b')](_0x3a86d4[_0x6726('0x38')][_0x6726('0x2b')]);_0xa74df8[_0x6726('0x2a')]=qs['offset'](_0x3a86d4[_0x6726('0x38')][_0x6726('0x2a')]);}return _0x3a454c[_0x6726('0x53')](_0xa74df8);}})['then'](function(_0x359ea3){if(_0x359ea3){return _0x359ea3?{'count':_0x3f83bc,'rows':_0x359ea3}:null;}})[_0x6726('0x1d')](respondWithResult(_0x4913fa,null))[_0x6726('0x26')](handleError(_0x4913fa,null));};exports[_0x6726('0x57')]=function(_0x1eda20,_0x1de057,_0x3f750b){var _0x303d01={};var _0x51cfc2={};var _0x2d7aa3;var _0x55278b;return db['ServicenowConfiguration'][_0x6726('0x54')]({'where':{'id':_0x1eda20['params']['id']}})[_0x6726('0x1d')](handleEntityNotFound(_0x1de057,null))[_0x6726('0x1d')](function(_0x4da0d){if(_0x4da0d){_0x2d7aa3=_0x4da0d;_0x51cfc2[_0x6726('0x36')]=_[_0x6726('0x37')](db[_0x6726('0x55')][_0x6726('0x35')]);_0x51cfc2[_0x6726('0x38')]=_[_0x6726('0x37')](_0x1eda20[_0x6726('0x38')]);_0x51cfc2[_0x6726('0x39')]=_['intersection'](_0x51cfc2[_0x6726('0x36')],_0x51cfc2[_0x6726('0x38')]);_0x303d01['attributes']=_[_0x6726('0x3a')](_0x51cfc2[_0x6726('0x36')],qs[_0x6726('0x3c')](_0x1eda20[_0x6726('0x38')][_0x6726('0x3c')]));_0x303d01[_0x6726('0x3b')]=_0x303d01[_0x6726('0x3b')][_0x6726('0x3d')]?_0x303d01[_0x6726('0x3b')]:_0x51cfc2[_0x6726('0x36')];_0x303d01['order']=qs[_0x6726('0x40')](_0x1eda20[_0x6726('0x38')]['sort']);_0x303d01[_0x6726('0x41')]=qs['filters'](_[_0x6726('0x42')](_0x1eda20['query'],_0x51cfc2[_0x6726('0x39')]));if(_0x1eda20[_0x6726('0x38')][_0x6726('0x43')]){_0x303d01['where']=_[_0x6726('0x47')](_0x303d01[_0x6726('0x41')],{'$or':_['map'](_0x303d01[_0x6726('0x3b')],function(_0x11b221){var _0x29f64a={};_0x29f64a[_0x11b221]={'$like':'%'+_0x1eda20[_0x6726('0x38')]['filter']+'%'};return _0x29f64a;})});}_0x303d01=_['merge']({},_0x303d01,_0x1eda20[_0x6726('0x4f')]);return _0x2d7aa3[_0x6726('0x57')](_0x303d01);}})['then'](function(_0x3ce08a){if(_0x3ce08a){_0x55278b=_0x3ce08a[_0x6726('0x3d')];if(!_0x1eda20[_0x6726('0x38')]['hasOwnProperty'](_0x6726('0x3f'))){_0x303d01[_0x6726('0x2b')]=qs[_0x6726('0x2b')](_0x1eda20['query']['limit']);_0x303d01[_0x6726('0x2a')]=qs[_0x6726('0x2a')](_0x1eda20[_0x6726('0x38')]['offset']);}return _0x2d7aa3[_0x6726('0x57')](_0x303d01);}})[_0x6726('0x1d')](function(_0x24eee4){if(_0x24eee4){return _0x24eee4?{'count':_0x55278b,'rows':_0x24eee4}:null;}})[_0x6726('0x1d')](respondWithResult(_0x1de057,null))[_0x6726('0x26')](handleError(_0x1de057,null));};exports['getDescriptions']=function(_0x458e16,_0x569bb6,_0x43c07a){var _0x12fde1={};var _0x217c1f={};var _0x29886a;var _0x3644a6;return db[_0x6726('0x4a')][_0x6726('0x54')]({'where':{'id':_0x458e16['params']['id']}})[_0x6726('0x1d')](handleEntityNotFound(_0x569bb6,null))[_0x6726('0x1d')](function(_0x368afb){if(_0x368afb){_0x29886a=_0x368afb;_0x217c1f[_0x6726('0x36')]=_[_0x6726('0x37')](db[_0x6726('0x55')][_0x6726('0x35')]);_0x217c1f['query']=_[_0x6726('0x37')](_0x458e16['query']);_0x217c1f[_0x6726('0x39')]=_[_0x6726('0x3a')](_0x217c1f[_0x6726('0x36')],_0x217c1f[_0x6726('0x38')]);_0x12fde1['attributes']=_['intersection'](_0x217c1f[_0x6726('0x36')],qs[_0x6726('0x3c')](_0x458e16[_0x6726('0x38')][_0x6726('0x3c')]));_0x12fde1[_0x6726('0x3b')]=_0x12fde1[_0x6726('0x3b')][_0x6726('0x3d')]?_0x12fde1[_0x6726('0x3b')]:_0x217c1f['model'];_0x12fde1[_0x6726('0x56')]=qs[_0x6726('0x40')](_0x458e16[_0x6726('0x38')][_0x6726('0x40')]);_0x12fde1[_0x6726('0x41')]=qs[_0x6726('0x39')](_[_0x6726('0x42')](_0x458e16['query'],_0x217c1f[_0x6726('0x39')]));if(_0x458e16[_0x6726('0x38')][_0x6726('0x43')]){_0x12fde1[_0x6726('0x41')]=_[_0x6726('0x47')](_0x12fde1[_0x6726('0x41')],{'$or':_[_0x6726('0x44')](_0x12fde1[_0x6726('0x3b')],function(_0x3af35e){var _0x4ac42b={};_0x4ac42b[_0x3af35e]={'$like':'%'+_0x458e16[_0x6726('0x38')][_0x6726('0x43')]+'%'};return _0x4ac42b;})});}_0x12fde1=_[_0x6726('0x47')]({},_0x12fde1,_0x458e16[_0x6726('0x4f')]);return _0x29886a['getDescriptions'](_0x12fde1);}})[_0x6726('0x1d')](function(_0x44c0b8){if(_0x44c0b8){_0x3644a6=_0x44c0b8[_0x6726('0x3d')];if(!_0x458e16[_0x6726('0x38')]['hasOwnProperty']('nolimit')){_0x12fde1[_0x6726('0x2b')]=qs[_0x6726('0x2b')](_0x458e16[_0x6726('0x38')][_0x6726('0x2b')]);_0x12fde1['offset']=qs['offset'](_0x458e16[_0x6726('0x38')][_0x6726('0x2a')]);}return _0x29886a[_0x6726('0x58')](_0x12fde1);}})[_0x6726('0x1d')](function(_0x1bfd1f){if(_0x1bfd1f){return _0x1bfd1f?{'count':_0x3644a6,'rows':_0x1bfd1f}:null;}})[_0x6726('0x1d')](respondWithResult(_0x569bb6,null))[_0x6726('0x26')](handleError(_0x569bb6,null));}; \ No newline at end of file +var _0x535d=['update','destroy','sendStatus','stack','name','send','index','ServicenowConfiguration','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','map','type','key','field','filter','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','body','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','count','set','Content-Range','reject','save'];(function(_0x154ea8,_0x4c1efa){var _0x3672bd=function(_0x58f6de){while(--_0x58f6de){_0x154ea8['push'](_0x154ea8['shift']());}};_0x3672bd(++_0x4c1efa);}(_0x535d,0xe8));var _0xd535=function(_0x2e6370,_0x49acd0){_0x2e6370=_0x2e6370-0x0;var _0x52d129=_0x535d[_0x2e6370];return _0x52d129;};'use strict';var pdf=require(_0xd535('0x0'));var emlformat=require(_0xd535('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd535('0x2'));var jsonpatch=require(_0xd535('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd535('0x4'));var Mustache=require(_0xd535('0x5'));var util=require(_0xd535('0x6'));var path=require(_0xd535('0x7'));var sox=require(_0xd535('0x8'));var csv=require(_0xd535('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd535('0xa'));var crypto=require(_0xd535('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd535('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd535('0xd'));var Papa=require(_0xd535('0xe'));var Redis=require(_0xd535('0xf'));var authService=require(_0xd535('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xd535('0x11'));var logger=require(_0xd535('0x12'))(_0xd535('0x13'));var utils=require(_0xd535('0x14'));var config=require('../../config/environment');var db=require(_0xd535('0x15'))['db'];var jayson=require(_0xd535('0x16'));var client=jayson[_0xd535('0x17')][_0xd535('0x18')]({'port':0x232a});function checkPasswordPattern(_0x352bf3,_0x3fd304,_0xdaa01d){if(_0xdaa01d){var _0x5c178f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c178f[_0xd535('0x19')](_0x3fd304)){return _0x352bf3;}else{throw new db['Sequelize']['ValidationError'](_0xd535('0x1a'));}}else{return _0x352bf3;}}function respondWithRpcPromise(_0x2bf442,_0x578e07,_0x2078ad,_0x338042){return new BPromise(function(_0x29e478,_0x500675){var _0x4bf825=_0x338042||client;return _0x4bf825[_0xd535('0x1b')](_0x2bf442,_0x2078ad)[_0xd535('0x1c')](function(_0x2a9c9f){logger[_0xd535('0x1d')]('ServicenowConfiguration,\x20%s,\x20%s',_0x578e07,_0xd535('0x1e'));logger['debug'](_0xd535('0x1f'),_0x578e07,'request\x20sent',JSON[_0xd535('0x20')](_0x2a9c9f));if(_0x2a9c9f['error']){if(_0x2a9c9f[_0xd535('0x21')][_0xd535('0x22')]===0x1f4){logger[_0xd535('0x21')](_0xd535('0x23'),_0x578e07,_0x2a9c9f['error']['message']);return _0x500675(_0x2a9c9f[_0xd535('0x21')]['message']);}logger['error'](_0xd535('0x23'),_0x578e07,_0x2a9c9f[_0xd535('0x21')][_0xd535('0x24')]);return _0x29e478(_0x2a9c9f[_0xd535('0x21')][_0xd535('0x24')]);}else{logger[_0xd535('0x1d')]('ServicenowConfiguration,\x20%s,\x20%s',_0x578e07,_0xd535('0x1e'));_0x29e478(_0x2a9c9f[_0xd535('0x25')][_0xd535('0x24')]);}})[_0xd535('0x26')](function(_0x544781){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x578e07,_0x544781);_0x500675(_0x544781);});});}function respondWithStatusCode(_0x18989d,_0x1abfec){_0x1abfec=_0x1abfec||0xcc;return function(_0x482d00){if(_0x482d00){return _0x18989d['sendStatus'](_0x1abfec);}return _0x18989d[_0xd535('0x27')](_0x1abfec)[_0xd535('0x28')]();};}function respondWithResult(_0x13cdb2,_0x551a99){_0x551a99=_0x551a99||0xc8;return function(_0x5a989e){if(_0x5a989e){return _0x13cdb2[_0xd535('0x27')](_0x551a99)[_0xd535('0x29')](_0x5a989e);}};}function respondWithFilteredResult(_0x15769b,_0x1d17b8){return function(_0x11daf4){if(_0x11daf4){var _0x33fcb1=_0x11daf4[_0xd535('0x2a')],_0x231736=_0x1d17b8['offset'],_0x4b1e24=_0x1d17b8['offset']+_0x1d17b8['limit'],_0xcecc70;if(_0x4b1e24>=_0x33fcb1){_0x4b1e24=_0x33fcb1;_0xcecc70=0xc8;}else{_0xcecc70=0xce;}_0x15769b[_0xd535('0x27')](_0xcecc70);return _0x15769b[_0xd535('0x2b')](_0xd535('0x2c'),_0x231736+'-'+_0x4b1e24+'/'+_0x33fcb1)[_0xd535('0x29')](_0x11daf4);}return null;};}function patchUpdates(_0x3e4021){return function(_0x47d5e2){try{jsonpatch['apply'](_0x47d5e2,_0x3e4021,!![]);}catch(_0x2fc387){return BPromise[_0xd535('0x2d')](_0x2fc387);}return _0x47d5e2[_0xd535('0x2e')]();};}function saveUpdates(_0x34f12e,_0x57123e){return function(_0x379493){if(_0x379493){return _0x379493[_0xd535('0x2f')](_0x34f12e)[_0xd535('0x1c')](function(_0x27f53){return _0x27f53;});}return null;};}function removeEntity(_0x3a1d78,_0x308e33){return function(_0x517428){if(_0x517428){return _0x517428[_0xd535('0x30')]()[_0xd535('0x1c')](function(){_0x3a1d78[_0xd535('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb402,_0x27ed56){return function(_0x3babd8){if(!_0x3babd8){_0x2cb402[_0xd535('0x31')](0x194);}return _0x3babd8;};}function handleError(_0x420992,_0x53d6c7){_0x53d6c7=_0x53d6c7||0x1f4;return function(_0x5204aa){logger['error'](_0x5204aa[_0xd535('0x32')]);if(_0x5204aa[_0xd535('0x33')]){delete _0x5204aa[_0xd535('0x33')];}_0x420992[_0xd535('0x27')](_0x53d6c7)[_0xd535('0x34')](_0x5204aa);};}exports[_0xd535('0x35')]=function(_0x4db109,_0x4d628b){var _0x2a96c8={},_0x49cb56={},_0x354492={'count':0x0,'rows':[]};var _0x5ba3ba=db[_0xd535('0x36')]['rawAttributes'];_0x49cb56[_0xd535('0x37')]=_['keys'](_0x5ba3ba);_0x49cb56[_0xd535('0x38')]=_[_0xd535('0x39')](_0x4db109[_0xd535('0x38')]);_0x49cb56[_0xd535('0x3a')]=_['intersection'](_0x49cb56[_0xd535('0x37')],_0x49cb56[_0xd535('0x38')]);_0x2a96c8['attributes']=_[_0xd535('0x3b')](_0x49cb56[_0xd535('0x37')],qs[_0xd535('0x3c')](_0x4db109[_0xd535('0x38')][_0xd535('0x3c')]));_0x2a96c8[_0xd535('0x3d')]=_0x2a96c8[_0xd535('0x3d')][_0xd535('0x3e')]?_0x2a96c8[_0xd535('0x3d')]:_0x49cb56[_0xd535('0x37')];if(!_0x4db109['query'][_0xd535('0x3f')](_0xd535('0x40'))){_0x2a96c8[_0xd535('0x41')]=qs['limit'](_0x4db109[_0xd535('0x38')][_0xd535('0x41')]);_0x2a96c8[_0xd535('0x42')]=qs['offset'](_0x4db109[_0xd535('0x38')][_0xd535('0x42')]);}_0x2a96c8['order']=qs[_0xd535('0x43')](_0x4db109['query'][_0xd535('0x43')]);_0x2a96c8[_0xd535('0x44')]=qs[_0xd535('0x3a')](_[_0xd535('0x45')](_0x4db109['query'],_0x49cb56['filters']));if(_0x4db109['query']['filter']){_0x2a96c8[_0xd535('0x44')]=_[_0xd535('0x46')](_0x2a96c8['where'],{'$or':_[_0xd535('0x47')](_0x5ba3ba,function(_0x48e738){if(_0x48e738[_0xd535('0x48')][_0xd535('0x49')]!=='VIRTUAL'){var _0x56b375={};_0x56b375[_0x48e738[_0xd535('0x4a')]]={'$like':'%'+_0x4db109[_0xd535('0x38')][_0xd535('0x4b')]+'%'};return _0x56b375;}})});}_0x2a96c8=_['merge']({},_0x2a96c8,_0x4db109[_0xd535('0x4c')]);var _0x4b1777={'where':_0x2a96c8[_0xd535('0x44')]};return db[_0xd535('0x36')][_0xd535('0x2a')](_0x4b1777)[_0xd535('0x1c')](function(_0x141343){_0x354492[_0xd535('0x2a')]=_0x141343;if(_0x4db109[_0xd535('0x38')]['includeAll']){_0x2a96c8['include']=[{'all':!![]}];}return db[_0xd535('0x36')][_0xd535('0x4d')](_0x2a96c8);})[_0xd535('0x1c')](function(_0x520fd5){_0x354492[_0xd535('0x4e')]=_0x520fd5;return _0x354492;})['then'](respondWithFilteredResult(_0x4d628b,_0x2a96c8))[_0xd535('0x26')](handleError(_0x4d628b,null));};exports[_0xd535('0x4f')]=function(_0x35e65c,_0x389acd){var _0x4f517b={'raw':![],'where':{'id':_0x35e65c[_0xd535('0x50')]['id']}},_0x31a940={};_0x31a940[_0xd535('0x37')]=_[_0xd535('0x39')](db[_0xd535('0x36')][_0xd535('0x51')]);_0x31a940[_0xd535('0x38')]=_[_0xd535('0x39')](_0x35e65c[_0xd535('0x38')]);_0x31a940[_0xd535('0x3a')]=_['intersection'](_0x31a940[_0xd535('0x37')],_0x31a940[_0xd535('0x38')]);_0x4f517b['attributes']=_[_0xd535('0x3b')](_0x31a940[_0xd535('0x37')],qs[_0xd535('0x3c')](_0x35e65c[_0xd535('0x38')][_0xd535('0x3c')]));_0x4f517b['attributes']=_0x4f517b[_0xd535('0x3d')][_0xd535('0x3e')]?_0x4f517b[_0xd535('0x3d')]:_0x31a940[_0xd535('0x37')];if(_0x35e65c[_0xd535('0x38')][_0xd535('0x52')]){_0x4f517b[_0xd535('0x53')]=[{'all':!![]}];}_0x4f517b=_[_0xd535('0x46')]({},_0x4f517b,_0x35e65c['options']);return db[_0xd535('0x36')][_0xd535('0x54')](_0x4f517b)[_0xd535('0x1c')](handleEntityNotFound(_0x389acd,null))[_0xd535('0x1c')](respondWithResult(_0x389acd,null))['catch'](handleError(_0x389acd,null));};exports[_0xd535('0x55')]=function(_0xc28e20,_0xce1871){return db['ServicenowConfiguration'][_0xd535('0x55')](_0xc28e20[_0xd535('0x56')],{})[_0xd535('0x1c')](respondWithResult(_0xce1871,0xc9))['catch'](handleError(_0xce1871,null));};exports[_0xd535('0x2f')]=function(_0x9b6397,_0x314d37){if(_0x9b6397[_0xd535('0x56')]['id']){delete _0x9b6397[_0xd535('0x56')]['id'];}return db[_0xd535('0x36')][_0xd535('0x54')]({'where':{'id':_0x9b6397[_0xd535('0x50')]['id']}})[_0xd535('0x1c')](handleEntityNotFound(_0x314d37,null))[_0xd535('0x1c')](saveUpdates(_0x9b6397[_0xd535('0x56')],null))[_0xd535('0x1c')](respondWithResult(_0x314d37,null))[_0xd535('0x26')](handleError(_0x314d37,null));};exports['destroy']=function(_0x496ebe,_0x51ad02){return db[_0xd535('0x36')]['find']({'where':{'id':_0x496ebe['params']['id']}})['then'](handleEntityNotFound(_0x51ad02,null))[_0xd535('0x1c')](removeEntity(_0x51ad02,null))['catch'](handleError(_0x51ad02,null));};exports[_0xd535('0x57')]=function(_0x40475d,_0x471ccb,_0x5a286b){var _0x4282dc={};var _0x5cbe13={};var _0x387153;var _0x57cea1;return db[_0xd535('0x36')][_0xd535('0x58')]({'where':{'id':_0x40475d[_0xd535('0x50')]['id']}})[_0xd535('0x1c')](handleEntityNotFound(_0x471ccb,null))[_0xd535('0x1c')](function(_0x5d7fb5){if(_0x5d7fb5){_0x387153=_0x5d7fb5;_0x5cbe13[_0xd535('0x37')]=_['keys'](db[_0xd535('0x59')]['rawAttributes']);_0x5cbe13[_0xd535('0x38')]=_[_0xd535('0x39')](_0x40475d[_0xd535('0x38')]);_0x5cbe13[_0xd535('0x3a')]=_[_0xd535('0x3b')](_0x5cbe13[_0xd535('0x37')],_0x5cbe13[_0xd535('0x38')]);_0x4282dc[_0xd535('0x3d')]=_[_0xd535('0x3b')](_0x5cbe13[_0xd535('0x37')],qs['fields'](_0x40475d[_0xd535('0x38')][_0xd535('0x3c')]));_0x4282dc['attributes']=_0x4282dc[_0xd535('0x3d')]['length']?_0x4282dc[_0xd535('0x3d')]:_0x5cbe13[_0xd535('0x37')];_0x4282dc[_0xd535('0x5a')]=qs[_0xd535('0x43')](_0x40475d['query'][_0xd535('0x43')]);_0x4282dc['where']=qs[_0xd535('0x3a')](_['pick'](_0x40475d[_0xd535('0x38')],_0x5cbe13[_0xd535('0x3a')]));if(_0x40475d[_0xd535('0x38')][_0xd535('0x4b')]){_0x4282dc['where']=_['merge'](_0x4282dc[_0xd535('0x44')],{'$or':_['map'](_0x4282dc[_0xd535('0x3d')],function(_0x3b33a1){var _0x11b3a0={};_0x11b3a0[_0x3b33a1]={'$like':'%'+_0x40475d[_0xd535('0x38')][_0xd535('0x4b')]+'%'};return _0x11b3a0;})});}_0x4282dc=_[_0xd535('0x46')]({},_0x4282dc,_0x40475d[_0xd535('0x4c')]);return _0x387153[_0xd535('0x57')](_0x4282dc);}})[_0xd535('0x1c')](function(_0x230fc4){if(_0x230fc4){_0x57cea1=_0x230fc4[_0xd535('0x3e')];if(!_0x40475d['query'][_0xd535('0x3f')](_0xd535('0x40'))){_0x4282dc[_0xd535('0x41')]=qs[_0xd535('0x41')](_0x40475d[_0xd535('0x38')]['limit']);_0x4282dc[_0xd535('0x42')]=qs['offset'](_0x40475d[_0xd535('0x38')][_0xd535('0x42')]);}return _0x387153[_0xd535('0x57')](_0x4282dc);}})['then'](function(_0x50aa1a){if(_0x50aa1a){return _0x50aa1a?{'count':_0x57cea1,'rows':_0x50aa1a}:null;}})[_0xd535('0x1c')](respondWithResult(_0x471ccb,null))['catch'](handleError(_0x471ccb,null));};exports[_0xd535('0x5b')]=function(_0x512f2f,_0x146fa7,_0x49e2e4){var _0x304710={};var _0x2b3a25={};var _0xb5b395;var _0x3aa87c;return db[_0xd535('0x36')][_0xd535('0x58')]({'where':{'id':_0x512f2f[_0xd535('0x50')]['id']}})[_0xd535('0x1c')](handleEntityNotFound(_0x146fa7,null))[_0xd535('0x1c')](function(_0x5cc12f){if(_0x5cc12f){_0xb5b395=_0x5cc12f;_0x2b3a25[_0xd535('0x37')]=_[_0xd535('0x39')](db[_0xd535('0x59')][_0xd535('0x51')]);_0x2b3a25[_0xd535('0x38')]=_[_0xd535('0x39')](_0x512f2f[_0xd535('0x38')]);_0x2b3a25['filters']=_[_0xd535('0x3b')](_0x2b3a25['model'],_0x2b3a25[_0xd535('0x38')]);_0x304710[_0xd535('0x3d')]=_['intersection'](_0x2b3a25[_0xd535('0x37')],qs[_0xd535('0x3c')](_0x512f2f[_0xd535('0x38')][_0xd535('0x3c')]));_0x304710[_0xd535('0x3d')]=_0x304710[_0xd535('0x3d')][_0xd535('0x3e')]?_0x304710['attributes']:_0x2b3a25[_0xd535('0x37')];_0x304710[_0xd535('0x5a')]=qs[_0xd535('0x43')](_0x512f2f[_0xd535('0x38')]['sort']);_0x304710[_0xd535('0x44')]=qs[_0xd535('0x3a')](_[_0xd535('0x45')](_0x512f2f['query'],_0x2b3a25[_0xd535('0x3a')]));if(_0x512f2f[_0xd535('0x38')][_0xd535('0x4b')]){_0x304710[_0xd535('0x44')]=_[_0xd535('0x46')](_0x304710[_0xd535('0x44')],{'$or':_[_0xd535('0x47')](_0x304710[_0xd535('0x3d')],function(_0xa832e3){var _0x3e4c0f={};_0x3e4c0f[_0xa832e3]={'$like':'%'+_0x512f2f['query']['filter']+'%'};return _0x3e4c0f;})});}_0x304710=_[_0xd535('0x46')]({},_0x304710,_0x512f2f[_0xd535('0x4c')]);return _0xb5b395[_0xd535('0x5b')](_0x304710);}})[_0xd535('0x1c')](function(_0x4c7a1f){if(_0x4c7a1f){_0x3aa87c=_0x4c7a1f['length'];if(!_0x512f2f[_0xd535('0x38')][_0xd535('0x3f')](_0xd535('0x40'))){_0x304710[_0xd535('0x41')]=qs['limit'](_0x512f2f[_0xd535('0x38')]['limit']);_0x304710[_0xd535('0x42')]=qs[_0xd535('0x42')](_0x512f2f[_0xd535('0x38')][_0xd535('0x42')]);}return _0xb5b395[_0xd535('0x5b')](_0x304710);}})[_0xd535('0x1c')](function(_0x11e186){if(_0x11e186){return _0x11e186?{'count':_0x3aa87c,'rows':_0x11e186}:null;}})[_0xd535('0x1c')](respondWithResult(_0x146fa7,null))[_0xd535('0x26')](handleError(_0x146fa7,null));};exports[_0xd535('0x5c')]=function(_0x28d3c4,_0x1fe07e,_0x32c005){var _0x2fb5aa={};var _0x1ba5c9={};var _0x55b991;var _0x3452f7;return db[_0xd535('0x36')][_0xd535('0x58')]({'where':{'id':_0x28d3c4['params']['id']}})[_0xd535('0x1c')](handleEntityNotFound(_0x1fe07e,null))[_0xd535('0x1c')](function(_0x4b737e){if(_0x4b737e){_0x55b991=_0x4b737e;_0x1ba5c9['model']=_[_0xd535('0x39')](db[_0xd535('0x59')][_0xd535('0x51')]);_0x1ba5c9[_0xd535('0x38')]=_[_0xd535('0x39')](_0x28d3c4[_0xd535('0x38')]);_0x1ba5c9['filters']=_[_0xd535('0x3b')](_0x1ba5c9[_0xd535('0x37')],_0x1ba5c9['query']);_0x2fb5aa[_0xd535('0x3d')]=_[_0xd535('0x3b')](_0x1ba5c9[_0xd535('0x37')],qs['fields'](_0x28d3c4[_0xd535('0x38')]['fields']));_0x2fb5aa[_0xd535('0x3d')]=_0x2fb5aa[_0xd535('0x3d')][_0xd535('0x3e')]?_0x2fb5aa[_0xd535('0x3d')]:_0x1ba5c9['model'];_0x2fb5aa[_0xd535('0x5a')]=qs[_0xd535('0x43')](_0x28d3c4[_0xd535('0x38')][_0xd535('0x43')]);_0x2fb5aa['where']=qs[_0xd535('0x3a')](_[_0xd535('0x45')](_0x28d3c4[_0xd535('0x38')],_0x1ba5c9['filters']));if(_0x28d3c4[_0xd535('0x38')][_0xd535('0x4b')]){_0x2fb5aa[_0xd535('0x44')]=_[_0xd535('0x46')](_0x2fb5aa[_0xd535('0x44')],{'$or':_[_0xd535('0x47')](_0x2fb5aa['attributes'],function(_0x46ff9f){var _0x271de9={};_0x271de9[_0x46ff9f]={'$like':'%'+_0x28d3c4[_0xd535('0x38')][_0xd535('0x4b')]+'%'};return _0x271de9;})});}_0x2fb5aa=_[_0xd535('0x46')]({},_0x2fb5aa,_0x28d3c4['options']);return _0x55b991[_0xd535('0x5c')](_0x2fb5aa);}})[_0xd535('0x1c')](function(_0x404cff){if(_0x404cff){_0x3452f7=_0x404cff[_0xd535('0x3e')];if(!_0x28d3c4[_0xd535('0x38')][_0xd535('0x3f')](_0xd535('0x40'))){_0x2fb5aa['limit']=qs[_0xd535('0x41')](_0x28d3c4[_0xd535('0x38')][_0xd535('0x41')]);_0x2fb5aa[_0xd535('0x42')]=qs['offset'](_0x28d3c4['query'][_0xd535('0x42')]);}return _0x55b991[_0xd535('0x5c')](_0x2fb5aa);}})['then'](function(_0x5b0e83){if(_0x5b0e83){return _0x5b0e83?{'count':_0x3452f7,'rows':_0x5b0e83}:null;}})['then'](respondWithResult(_0x1fe07e,null))[_0xd535('0x26')](handleError(_0x1fe07e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 13cacb1..0714a58 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 _0xeb8f=['lodash','util','api','moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','ServicenowConfiguration'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xeb8f,0x14d));var _0xfeb8=function(_0x2973de,_0x5581ca){_0x2973de=_0x2973de-0x0;var _0x1cdf3=_0xeb8f[_0x2973de];return _0x1cdf3;};'use strict';var _=require(_0xfeb8('0x0'));var util=require(_0xfeb8('0x1'));var logger=require('../../config/logger')(_0xfeb8('0x2'));var moment=require(_0xfeb8('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeb8('0x4'));var fs=require('fs');var path=require(_0xfeb8('0x5'));var rimraf=require(_0xfeb8('0x6'));var config=require('../../config/environment');var attributes=require(_0xfeb8('0x7'));module['exports']=function(_0xdca24d,_0x5c3f7f){return _0xdca24d['define'](_0xfeb8('0x8'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4380=['../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','../../config/logger','api','bluebird','request-promise','path'];(function(_0x33004b,_0x5db304){var _0x3b1f09=function(_0xb24e6d){while(--_0xb24e6d){_0x33004b['push'](_0x33004b['shift']());}};_0x3b1f09(++_0x5db304);}(_0x4380,0x1b3));var _0x0438=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0x4380[_0x385fed];return _0x52fa25;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0438('0x0'))(_0x0438('0x1'));var moment=require('moment');var BPromise=require(_0x0438('0x2'));var rp=require(_0x0438('0x3'));var fs=require('fs');var path=require(_0x0438('0x4'));var rimraf=require('rimraf');var config=require(_0x0438('0x5'));var attributes=require(_0x0438('0x6'));module['exports']=function(_0x3e5044,_0xf6bdb1){return _0x3e5044[_0x0438('0x7')](_0x0438('0x8'),attributes,{'tableName':_0x0438('0x9'),'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 2980712..5c19b52 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 _0xbb10=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xbb10,0x1eb));var _0x0bb1=function(_0x4f66e8,_0x161266){_0x4f66e8=_0x4f66e8-0x0;var _0x2a93ad=_0xbb10[_0x4f66e8];return _0x2a93ad;};'use strict';var _=require(_0x0bb1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0bb1('0x1'));var rs=require(_0x0bb1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0bb1('0x3'))['db'];var utils=require(_0x0bb1('0x4'));var logger=require(_0x0bb1('0x5'))(_0x0bb1('0x6'));var config=require(_0x0bb1('0x7'));var jayson=require(_0x0bb1('0x8'));var client=jayson[_0x0bb1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36154a,_0x4d7b8c,_0x529291){return new BPromise(function(_0x5e9d5e,_0x4cb938){return client[_0x0bb1('0xa')](_0x36154a,_0x529291)[_0x0bb1('0xb')](function(_0x826de){logger[_0x0bb1('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4d7b8c,_0x0bb1('0xd'));logger[_0x0bb1('0xe')](_0x0bb1('0xf'),_0x4d7b8c,_0x0bb1('0xd'),JSON[_0x0bb1('0x10')](_0x826de));if(_0x826de[_0x0bb1('0x11')]){if(_0x826de['error']['code']===0x1f4){logger[_0x0bb1('0x11')](_0x0bb1('0x12'),_0x4d7b8c,_0x826de[_0x0bb1('0x11')][_0x0bb1('0x13')]);return _0x4cb938(_0x826de[_0x0bb1('0x11')][_0x0bb1('0x13')]);}logger[_0x0bb1('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4d7b8c,_0x826de[_0x0bb1('0x11')]['message']);return _0x5e9d5e(_0x826de[_0x0bb1('0x11')]['message']);}else{logger['info'](_0x0bb1('0x12'),_0x4d7b8c,_0x0bb1('0xd'));_0x5e9d5e(_0x826de[_0x0bb1('0x14')][_0x0bb1('0x13')]);}})[_0x0bb1('0x15')](function(_0x56bcd0){logger[_0x0bb1('0x11')](_0x0bb1('0x12'),_0x4d7b8c,_0x56bcd0);_0x4cb938(_0x56bcd0);});});} \ No newline at end of file +var _0xcd55=['client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xcd55,0xcb));var _0x5cd5=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xcd55[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x5cd5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5cd5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5cd5('0x2'));var db=require(_0x5cd5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5cd5('0x4'));var config=require(_0x5cd5('0x5'));var jayson=require(_0x5cd5('0x6'));var client=jayson[_0x5cd5('0x7')][_0x5cd5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28d366,_0x181cc3,_0x436697){return new BPromise(function(_0x5810fe,_0x752c87){return client[_0x5cd5('0x9')](_0x28d366,_0x436697)[_0x5cd5('0xa')](function(_0x1a85ca){logger[_0x5cd5('0xb')](_0x5cd5('0xc'),_0x181cc3,'request\x20sent');logger[_0x5cd5('0xd')](_0x5cd5('0xe'),_0x181cc3,_0x5cd5('0xf'),JSON['stringify'](_0x1a85ca));if(_0x1a85ca[_0x5cd5('0x10')]){if(_0x1a85ca['error'][_0x5cd5('0x11')]===0x1f4){logger['error'](_0x5cd5('0xc'),_0x181cc3,_0x1a85ca['error'][_0x5cd5('0x12')]);return _0x752c87(_0x1a85ca[_0x5cd5('0x10')]['message']);}logger[_0x5cd5('0x10')](_0x5cd5('0xc'),_0x181cc3,_0x1a85ca[_0x5cd5('0x10')][_0x5cd5('0x12')]);return _0x5810fe(_0x1a85ca['error'][_0x5cd5('0x12')]);}else{logger[_0x5cd5('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x181cc3,_0x5cd5('0xf'));_0x5810fe(_0x1a85ca[_0x5cd5('0x13')][_0x5cd5('0x12')]);}})[_0x5cd5('0x14')](function(_0x67c9c0){logger[_0x5cd5('0x10')](_0x5cd5('0xc'),_0x181cc3,_0x67c9c0);_0x752c87(_0x67c9c0);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 10da913..441da1a 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 _0x725d=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intServicenowField.controller','index','get','/:id','isAuthenticated'];(function(_0x3b855e,_0x5295d8){var _0x72d1d4=function(_0x112b56){while(--_0x112b56){_0x3b855e['push'](_0x3b855e['shift']());}};_0x72d1d4(++_0x5295d8);}(_0x725d,0x1e2));var _0xd725=function(_0x421f8b,_0x23dbcc){_0x421f8b=_0x421f8b-0x0;var _0x275f4c=_0x725d[_0x421f8b];return _0x275f4c;};'use strict';var multer=require(_0xd725('0x0'));var util=require(_0xd725('0x1'));var path=require(_0xd725('0x2'));var timeout=require(_0xd725('0x3'));var express=require(_0xd725('0x4'));var router=express[_0xd725('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd725('0x6'));var controller=require(_0xd725('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd725('0x8')]);router[_0xd725('0x9')](_0xd725('0xa'),auth[_0xd725('0xb')](),controller[_0xd725('0xc')]);router[_0xd725('0xd')]('/',auth['isAuthenticated'](),controller[_0xd725('0xe')]);router['put'](_0xd725('0xa'),auth[_0xd725('0xb')](),controller[_0xd725('0xf')]);router[_0xd725('0x10')](_0xd725('0xa'),auth[_0xd725('0xb')](),controller[_0xd725('0x11')]);module[_0xd725('0x12')]=router; \ No newline at end of file +var _0xbd7b=['index','/:id','post','create','put','update','isAuthenticated','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0xbd7b,0x1da));var _0xbbd7=function(_0x27ef42,_0x18c0ff){_0x27ef42=_0x27ef42-0x0;var _0x686f9b=_0xbd7b[_0x27ef42];return _0x686f9b;};'use strict';var multer=require('multer');var util=require(_0xbbd7('0x0'));var path=require('path');var timeout=require(_0xbbd7('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xbbd7('0x2'));var interaction=require(_0xbbd7('0x3'));var config=require(_0xbbd7('0x4'));var controller=require('./intServicenowField.controller');router[_0xbbd7('0x5')]('/',auth['isAuthenticated'](),controller[_0xbbd7('0x6')]);router[_0xbbd7('0x5')](_0xbbd7('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xbbd7('0x8')]('/',auth['isAuthenticated'](),controller[_0xbbd7('0x9')]);router[_0xbbd7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbbd7('0xb')]);router['delete'](_0xbbd7('0x7'),auth[_0xbbd7('0xc')](),controller[_0xbbd7('0xd')]);module[_0xbbd7('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a599ed3..2978cd4 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 _0xe41f=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xe41f,0x13e));var _0xfe41=function(_0x471053,_0x1b8b6e){_0x471053=_0x471053-0x0;var _0x5859fe=_0xe41f[_0x471053];return _0x5859fe;};'use strict';var Sequelize=require(_0xfe41('0x0'));module[_0xfe41('0x1')]={'type':{'type':Sequelize[_0xfe41('0x2')](_0xfe41('0x3'),'variable','customVariable','keyValue'),'defaultValue':_0xfe41('0x3')},'content':{'type':Sequelize[_0xfe41('0x4')]},'key':{'type':Sequelize[_0xfe41('0x4')]},'keyType':{'type':Sequelize[_0xfe41('0x2')]('string','variable',_0xfe41('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfe41('0x4')]},'nameField':{'type':Sequelize[_0xfe41('0x4')]},'customField':{'type':Sequelize[_0xfe41('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe41('0x4')]}}; \ No newline at end of file +var _0x97f4=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x97f4,0x166));var _0x497f=function(_0x3790b2,_0x1e673e){_0x3790b2=_0x3790b2-0x0;var _0x1a6640=_0x97f4[_0x3790b2];return _0x1a6640;};'use strict';var Sequelize=require(_0x497f('0x0'));module[_0x497f('0x1')]={'type':{'type':Sequelize[_0x497f('0x2')](_0x497f('0x3'),'variable',_0x497f('0x4'),_0x497f('0x5')),'defaultValue':_0x497f('0x3')},'content':{'type':Sequelize[_0x497f('0x6')]},'key':{'type':Sequelize[_0x497f('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x497f('0x7'),_0x497f('0x4'))},'keyContent':{'type':Sequelize[_0x497f('0x6')]},'idField':{'type':Sequelize[_0x497f('0x6')]},'nameField':{'type':Sequelize[_0x497f('0x6')]},'customField':{'type':Sequelize[_0x497f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x497f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 087c3b1..d4f2b62 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 _0xc341=['fields','length','hasOwnProperty','sort','where','filter','merge','map','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','send','index','ServicenowField','rawAttributes','model','keys','query','filters','intersection','attributes'];(function(_0x34d44f,_0x5dbe00){var _0x2b9d21=function(_0x2ceb54){while(--_0x2ceb54){_0x34d44f['push'](_0x34d44f['shift']());}};_0x2b9d21(++_0x5dbe00);}(_0xc341,0x1f3));var _0x1c34=function(_0xc80d54,_0x39a6a7){_0xc80d54=_0xc80d54-0x0;var _0x308fc6=_0xc341[_0xc80d54];return _0x308fc6;};'use strict';var pdf=require(_0x1c34('0x0'));var emlformat=require(_0x1c34('0x1'));var rimraf=require(_0x1c34('0x2'));var zipdir=require(_0x1c34('0x3'));var jsonpatch=require(_0x1c34('0x4'));var rp=require(_0x1c34('0x5'));var moment=require(_0x1c34('0x6'));var BPromise=require(_0x1c34('0x7'));var Mustache=require('mustache');var util=require(_0x1c34('0x8'));var path=require('path');var sox=require(_0x1c34('0x9'));var csv=require(_0x1c34('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c34('0xb'));var squel=require(_0x1c34('0xc'));var crypto=require(_0x1c34('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1c34('0xe'));var toCsv=require(_0x1c34('0xa'));var querystring=require(_0x1c34('0xf'));var Papa=require(_0x1c34('0x10'));var Redis=require('ioredis');var authService=require(_0x1c34('0x11'));var qs=require(_0x1c34('0x12'));var hardwareService=require(_0x1c34('0x13'));var logger=require(_0x1c34('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bc6ad,_0x20e1cd){_0x20e1cd=_0x20e1cd||0xcc;return function(_0x4edde6){if(_0x4edde6){return _0x2bc6ad[_0x1c34('0x15')](_0x20e1cd);}return _0x2bc6ad[_0x1c34('0x16')](_0x20e1cd)[_0x1c34('0x17')]();};}function respondWithResult(_0x3fc35e,_0x42d578){_0x42d578=_0x42d578||0xc8;return function(_0x517c6d){if(_0x517c6d){return _0x3fc35e[_0x1c34('0x16')](_0x42d578)[_0x1c34('0x18')](_0x517c6d);}};}function respondWithFilteredResult(_0x736777,_0x2704bb){return function(_0x386426){if(_0x386426){var _0x39d9ab=_0x386426['count'],_0x734698=_0x2704bb[_0x1c34('0x19')],_0x1fcf0f=_0x2704bb[_0x1c34('0x19')]+_0x2704bb[_0x1c34('0x1a')],_0x563d59;if(_0x1fcf0f>=_0x39d9ab){_0x1fcf0f=_0x39d9ab;_0x563d59=0xc8;}else{_0x563d59=0xce;}_0x736777[_0x1c34('0x16')](_0x563d59);return _0x736777[_0x1c34('0x1b')](_0x1c34('0x1c'),_0x734698+'-'+_0x1fcf0f+'/'+_0x39d9ab)[_0x1c34('0x18')](_0x386426);}return null;};}function patchUpdates(_0x56197e){return function(_0x1d5f55){try{jsonpatch['apply'](_0x1d5f55,_0x56197e,!![]);}catch(_0x570cf3){return BPromise[_0x1c34('0x1d')](_0x570cf3);}return _0x1d5f55[_0x1c34('0x1e')]();};}function saveUpdates(_0x288f5d,_0x435706){return function(_0x3970e1){if(_0x3970e1){return _0x3970e1['update'](_0x288f5d)[_0x1c34('0x1f')](function(_0x2527e7){return _0x2527e7;});}return null;};}function removeEntity(_0x1f3615,_0x572059){return function(_0x54f807){if(_0x54f807){return _0x54f807[_0x1c34('0x20')]()[_0x1c34('0x1f')](function(){_0x1f3615[_0x1c34('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cba72,_0x131f1d){return function(_0x592c5f){if(!_0x592c5f){_0x4cba72[_0x1c34('0x15')](0x194);}return _0x592c5f;};}function handleError(_0x30bb7d,_0x134917){_0x134917=_0x134917||0x1f4;return function(_0x311fa0){logger[_0x1c34('0x21')](_0x311fa0[_0x1c34('0x22')]);if(_0x311fa0['name']){delete _0x311fa0['name'];}_0x30bb7d['status'](_0x134917)[_0x1c34('0x23')](_0x311fa0);};}exports[_0x1c34('0x24')]=function(_0x40694b,_0x24af85){var _0x4ce1b2={},_0x2f216b={},_0x2cfa80={'count':0x0,'rows':[]};var _0x5643e7=db[_0x1c34('0x25')][_0x1c34('0x26')];_0x2f216b[_0x1c34('0x27')]=_[_0x1c34('0x28')](_0x5643e7);_0x2f216b[_0x1c34('0x29')]=_[_0x1c34('0x28')](_0x40694b[_0x1c34('0x29')]);_0x2f216b[_0x1c34('0x2a')]=_[_0x1c34('0x2b')](_0x2f216b[_0x1c34('0x27')],_0x2f216b['query']);_0x4ce1b2[_0x1c34('0x2c')]=_[_0x1c34('0x2b')](_0x2f216b[_0x1c34('0x27')],qs[_0x1c34('0x2d')](_0x40694b[_0x1c34('0x29')][_0x1c34('0x2d')]));_0x4ce1b2[_0x1c34('0x2c')]=_0x4ce1b2['attributes'][_0x1c34('0x2e')]?_0x4ce1b2['attributes']:_0x2f216b[_0x1c34('0x27')];if(!_0x40694b[_0x1c34('0x29')][_0x1c34('0x2f')]('nolimit')){_0x4ce1b2['limit']=qs[_0x1c34('0x1a')](_0x40694b['query'][_0x1c34('0x1a')]);_0x4ce1b2[_0x1c34('0x19')]=qs[_0x1c34('0x19')](_0x40694b['query'][_0x1c34('0x19')]);}_0x4ce1b2['order']=qs[_0x1c34('0x30')](_0x40694b[_0x1c34('0x29')]['sort']);_0x4ce1b2[_0x1c34('0x31')]=qs[_0x1c34('0x2a')](_['pick'](_0x40694b[_0x1c34('0x29')],_0x2f216b['filters']));if(_0x40694b[_0x1c34('0x29')][_0x1c34('0x32')]){_0x4ce1b2[_0x1c34('0x31')]=_[_0x1c34('0x33')](_0x4ce1b2['where'],{'$or':_[_0x1c34('0x34')](_0x5643e7,function(_0x526bde){if(_0x526bde['type'][_0x1c34('0x35')]!==_0x1c34('0x36')){var _0x20ffd3={};_0x20ffd3[_0x526bde[_0x1c34('0x37')]]={'$like':'%'+_0x40694b['query'][_0x1c34('0x32')]+'%'};return _0x20ffd3;}})});}_0x4ce1b2=_[_0x1c34('0x33')]({},_0x4ce1b2,_0x40694b[_0x1c34('0x38')]);var _0x135638={'where':_0x4ce1b2[_0x1c34('0x31')]};return db['ServicenowField'][_0x1c34('0x39')](_0x135638)['then'](function(_0xfc76f6){_0x2cfa80[_0x1c34('0x39')]=_0xfc76f6;if(_0x40694b[_0x1c34('0x29')][_0x1c34('0x3a')]){_0x4ce1b2[_0x1c34('0x3b')]=[{'all':!![]}];}return db[_0x1c34('0x25')][_0x1c34('0x3c')](_0x4ce1b2);})[_0x1c34('0x1f')](function(_0x490488){_0x2cfa80[_0x1c34('0x3d')]=_0x490488;return _0x2cfa80;})['then'](respondWithFilteredResult(_0x24af85,_0x4ce1b2))[_0x1c34('0x3e')](handleError(_0x24af85,null));};exports[_0x1c34('0x3f')]=function(_0x3b9aca,_0x488cc1){var _0x225b2a={'raw':!![],'where':{'id':_0x3b9aca[_0x1c34('0x40')]['id']}},_0x3a6a71={};_0x3a6a71[_0x1c34('0x27')]=_[_0x1c34('0x28')](db[_0x1c34('0x25')][_0x1c34('0x26')]);_0x3a6a71[_0x1c34('0x29')]=_[_0x1c34('0x28')](_0x3b9aca[_0x1c34('0x29')]);_0x3a6a71['filters']=_[_0x1c34('0x2b')](_0x3a6a71['model'],_0x3a6a71[_0x1c34('0x29')]);_0x225b2a[_0x1c34('0x2c')]=_[_0x1c34('0x2b')](_0x3a6a71[_0x1c34('0x27')],qs['fields'](_0x3b9aca[_0x1c34('0x29')]['fields']));_0x225b2a[_0x1c34('0x2c')]=_0x225b2a[_0x1c34('0x2c')][_0x1c34('0x2e')]?_0x225b2a[_0x1c34('0x2c')]:_0x3a6a71[_0x1c34('0x27')];if(_0x3b9aca[_0x1c34('0x29')][_0x1c34('0x3a')]){_0x225b2a[_0x1c34('0x3b')]=[{'all':!![]}];}_0x225b2a=_[_0x1c34('0x33')]({},_0x225b2a,_0x3b9aca['options']);return db[_0x1c34('0x25')][_0x1c34('0x41')](_0x225b2a)[_0x1c34('0x1f')](handleEntityNotFound(_0x488cc1,null))['then'](respondWithResult(_0x488cc1,null))[_0x1c34('0x3e')](handleError(_0x488cc1,null));};exports[_0x1c34('0x42')]=function(_0x565b16,_0x441a7){return db[_0x1c34('0x25')]['create'](_0x565b16[_0x1c34('0x43')],{})[_0x1c34('0x1f')](respondWithResult(_0x441a7,0xc9))['catch'](handleError(_0x441a7,null));};exports['update']=function(_0x1ca379,_0x5602a3){if(_0x1ca379['body']['id']){delete _0x1ca379[_0x1c34('0x43')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x1ca379[_0x1c34('0x40')]['id']}})[_0x1c34('0x1f')](handleEntityNotFound(_0x5602a3,null))['then'](saveUpdates(_0x1ca379[_0x1c34('0x43')],null))['then'](respondWithResult(_0x5602a3,null))[_0x1c34('0x3e')](handleError(_0x5602a3,null));};exports['destroy']=function(_0x2cd40f,_0x5686de){return db[_0x1c34('0x25')][_0x1c34('0x41')]({'where':{'id':_0x2cd40f['params']['id']}})[_0x1c34('0x1f')](handleEntityNotFound(_0x5686de,null))[_0x1c34('0x1f')](removeEntity(_0x5686de,null))[_0x1c34('0x3e')](handleError(_0x5686de,null));}; \ No newline at end of file +var _0x4b23=['keys','query','filters','intersection','attributes','fields','length','nolimit','offset','order','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','limit','status','set','Content-Range','reject','save','update','then','destroy','name','send','index','ServicenowField','model'];(function(_0x20663d,_0x3e032f){var _0x1ecf96=function(_0x306a8a){while(--_0x306a8a){_0x20663d['push'](_0x20663d['shift']());}};_0x1ecf96(++_0x3e032f);}(_0x4b23,0xef));var _0x34b2=function(_0x2250da,_0xdb9fe6){_0x2250da=_0x2250da-0x0;var _0x573dc5=_0x4b23[_0x2250da];return _0x573dc5;};'use strict';var pdf=require(_0x34b2('0x0'));var emlformat=require(_0x34b2('0x1'));var rimraf=require(_0x34b2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x34b2('0x3'));var moment=require(_0x34b2('0x4'));var BPromise=require(_0x34b2('0x5'));var Mustache=require('mustache');var util=require(_0x34b2('0x6'));var path=require('path');var sox=require(_0x34b2('0x7'));var csv=require('to-csv');var ejs=require(_0x34b2('0x8'));var fs=require('fs');var _=require(_0x34b2('0x9'));var squel=require(_0x34b2('0xa'));var crypto=require(_0x34b2('0xb'));var jsforce=require(_0x34b2('0xc'));var deskjs=require(_0x34b2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x34b2('0xe'));var Papa=require(_0x34b2('0xf'));var Redis=require(_0x34b2('0x10'));var authService=require(_0x34b2('0x11'));var qs=require(_0x34b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x34b2('0x13'));var utils=require(_0x34b2('0x14'));var config=require(_0x34b2('0x15'));var db=require(_0x34b2('0x16'))['db'];function respondWithStatusCode(_0x4a05db,_0x42ceed){_0x42ceed=_0x42ceed||0xcc;return function(_0x589acf){if(_0x589acf){return _0x4a05db[_0x34b2('0x17')](_0x42ceed);}return _0x4a05db['status'](_0x42ceed)[_0x34b2('0x18')]();};}function respondWithResult(_0x2ba6d9,_0x4adf42){_0x4adf42=_0x4adf42||0xc8;return function(_0x59122d){if(_0x59122d){return _0x2ba6d9['status'](_0x4adf42)[_0x34b2('0x19')](_0x59122d);}};}function respondWithFilteredResult(_0x25abc0,_0x39f06b){return function(_0x53529a){if(_0x53529a){var _0x51b984=_0x53529a[_0x34b2('0x1a')],_0x62e45d=_0x39f06b['offset'],_0x1ab4b3=_0x39f06b['offset']+_0x39f06b[_0x34b2('0x1b')],_0x2973df;if(_0x1ab4b3>=_0x51b984){_0x1ab4b3=_0x51b984;_0x2973df=0xc8;}else{_0x2973df=0xce;}_0x25abc0[_0x34b2('0x1c')](_0x2973df);return _0x25abc0[_0x34b2('0x1d')](_0x34b2('0x1e'),_0x62e45d+'-'+_0x1ab4b3+'/'+_0x51b984)['json'](_0x53529a);}return null;};}function patchUpdates(_0x47b9b9){return function(_0xc73cbb){try{jsonpatch['apply'](_0xc73cbb,_0x47b9b9,!![]);}catch(_0x1c73c2){return BPromise[_0x34b2('0x1f')](_0x1c73c2);}return _0xc73cbb[_0x34b2('0x20')]();};}function saveUpdates(_0x4add3b,_0x144b7d){return function(_0x3d99bc){if(_0x3d99bc){return _0x3d99bc[_0x34b2('0x21')](_0x4add3b)[_0x34b2('0x22')](function(_0x2ade2e){return _0x2ade2e;});}return null;};}function removeEntity(_0x4c33d0,_0x144e4c){return function(_0x50d5b9){if(_0x50d5b9){return _0x50d5b9[_0x34b2('0x23')]()['then'](function(){_0x4c33d0['status'](0xcc)[_0x34b2('0x18')]();});}};}function handleEntityNotFound(_0x4163af,_0x55df42){return function(_0x3d5e72){if(!_0x3d5e72){_0x4163af['sendStatus'](0x194);}return _0x3d5e72;};}function handleError(_0x5f0643,_0x32f68e){_0x32f68e=_0x32f68e||0x1f4;return function(_0xda944b){logger['error'](_0xda944b['stack']);if(_0xda944b[_0x34b2('0x24')]){delete _0xda944b[_0x34b2('0x24')];}_0x5f0643[_0x34b2('0x1c')](_0x32f68e)[_0x34b2('0x25')](_0xda944b);};}exports[_0x34b2('0x26')]=function(_0x158303,_0x4acf81){var _0x3cd178={},_0x487007={},_0x5d8617={'count':0x0,'rows':[]};var _0x5031f=db[_0x34b2('0x27')]['rawAttributes'];_0x487007[_0x34b2('0x28')]=_[_0x34b2('0x29')](_0x5031f);_0x487007[_0x34b2('0x2a')]=_[_0x34b2('0x29')](_0x158303[_0x34b2('0x2a')]);_0x487007[_0x34b2('0x2b')]=_[_0x34b2('0x2c')](_0x487007[_0x34b2('0x28')],_0x487007['query']);_0x3cd178[_0x34b2('0x2d')]=_[_0x34b2('0x2c')](_0x487007[_0x34b2('0x28')],qs[_0x34b2('0x2e')](_0x158303[_0x34b2('0x2a')][_0x34b2('0x2e')]));_0x3cd178[_0x34b2('0x2d')]=_0x3cd178[_0x34b2('0x2d')][_0x34b2('0x2f')]?_0x3cd178[_0x34b2('0x2d')]:_0x487007[_0x34b2('0x28')];if(!_0x158303['query']['hasOwnProperty'](_0x34b2('0x30'))){_0x3cd178[_0x34b2('0x1b')]=qs[_0x34b2('0x1b')](_0x158303[_0x34b2('0x2a')]['limit']);_0x3cd178[_0x34b2('0x31')]=qs[_0x34b2('0x31')](_0x158303[_0x34b2('0x2a')][_0x34b2('0x31')]);}_0x3cd178[_0x34b2('0x32')]=qs['sort'](_0x158303[_0x34b2('0x2a')]['sort']);_0x3cd178[_0x34b2('0x33')]=qs[_0x34b2('0x2b')](_[_0x34b2('0x34')](_0x158303[_0x34b2('0x2a')],_0x487007[_0x34b2('0x2b')]));if(_0x158303[_0x34b2('0x2a')][_0x34b2('0x35')]){_0x3cd178[_0x34b2('0x33')]=_[_0x34b2('0x36')](_0x3cd178['where'],{'$or':_[_0x34b2('0x37')](_0x5031f,function(_0x55e41a){if(_0x55e41a[_0x34b2('0x38')][_0x34b2('0x39')]!==_0x34b2('0x3a')){var _0x49a7de={};_0x49a7de[_0x55e41a[_0x34b2('0x3b')]]={'$like':'%'+_0x158303[_0x34b2('0x2a')][_0x34b2('0x35')]+'%'};return _0x49a7de;}})});}_0x3cd178=_['merge']({},_0x3cd178,_0x158303[_0x34b2('0x3c')]);var _0x3ddc74={'where':_0x3cd178[_0x34b2('0x33')]};return db[_0x34b2('0x27')][_0x34b2('0x1a')](_0x3ddc74)['then'](function(_0x121384){_0x5d8617[_0x34b2('0x1a')]=_0x121384;if(_0x158303['query'][_0x34b2('0x3d')]){_0x3cd178[_0x34b2('0x3e')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x3cd178);})['then'](function(_0x32f4e0){_0x5d8617[_0x34b2('0x3f')]=_0x32f4e0;return _0x5d8617;})[_0x34b2('0x22')](respondWithFilteredResult(_0x4acf81,_0x3cd178))[_0x34b2('0x40')](handleError(_0x4acf81,null));};exports['show']=function(_0x588202,_0x477ab7){var _0x5938e4={'raw':!![],'where':{'id':_0x588202[_0x34b2('0x41')]['id']}},_0x558c17={};_0x558c17[_0x34b2('0x28')]=_[_0x34b2('0x29')](db[_0x34b2('0x27')][_0x34b2('0x42')]);_0x558c17[_0x34b2('0x2a')]=_['keys'](_0x588202[_0x34b2('0x2a')]);_0x558c17[_0x34b2('0x2b')]=_['intersection'](_0x558c17[_0x34b2('0x28')],_0x558c17[_0x34b2('0x2a')]);_0x5938e4[_0x34b2('0x2d')]=_[_0x34b2('0x2c')](_0x558c17[_0x34b2('0x28')],qs['fields'](_0x588202[_0x34b2('0x2a')][_0x34b2('0x2e')]));_0x5938e4[_0x34b2('0x2d')]=_0x5938e4['attributes']['length']?_0x5938e4[_0x34b2('0x2d')]:_0x558c17[_0x34b2('0x28')];if(_0x588202[_0x34b2('0x2a')][_0x34b2('0x3d')]){_0x5938e4['include']=[{'all':!![]}];}_0x5938e4=_[_0x34b2('0x36')]({},_0x5938e4,_0x588202[_0x34b2('0x3c')]);return db[_0x34b2('0x27')][_0x34b2('0x43')](_0x5938e4)[_0x34b2('0x22')](handleEntityNotFound(_0x477ab7,null))['then'](respondWithResult(_0x477ab7,null))['catch'](handleError(_0x477ab7,null));};exports[_0x34b2('0x44')]=function(_0x587fae,_0x10110d){return db['ServicenowField'][_0x34b2('0x44')](_0x587fae['body'],{})[_0x34b2('0x22')](respondWithResult(_0x10110d,0xc9))[_0x34b2('0x40')](handleError(_0x10110d,null));};exports[_0x34b2('0x21')]=function(_0x2d8a24,_0x1b2443){if(_0x2d8a24[_0x34b2('0x45')]['id']){delete _0x2d8a24[_0x34b2('0x45')]['id'];}return db['ServicenowField'][_0x34b2('0x43')]({'where':{'id':_0x2d8a24[_0x34b2('0x41')]['id']}})[_0x34b2('0x22')](handleEntityNotFound(_0x1b2443,null))[_0x34b2('0x22')](saveUpdates(_0x2d8a24[_0x34b2('0x45')],null))[_0x34b2('0x22')](respondWithResult(_0x1b2443,null))[_0x34b2('0x40')](handleError(_0x1b2443,null));};exports[_0x34b2('0x23')]=function(_0x444be9,_0x450a09){return db[_0x34b2('0x27')][_0x34b2('0x43')]({'where':{'id':_0x444be9[_0x34b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x450a09,null))[_0x34b2('0x22')](removeEntity(_0x450a09,null))[_0x34b2('0x40')](handleError(_0x450a09,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 6025be6..37f73df 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 _0x81ab=['rimraf','../../config/environment','define','ServicenowField','servicenow_unique_index','idField','FieldId','util','bluebird','request-promise','path'];(function(_0x3b80c6,_0x1e727b){var _0x136029=function(_0x46924f){while(--_0x46924f){_0x3b80c6['push'](_0x3b80c6['shift']());}};_0x136029(++_0x1e727b);}(_0x81ab,0x188));var _0xb81a=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x81ab[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require('lodash');var util=require(_0xb81a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb81a('0x1'));var rp=require(_0xb81a('0x2'));var fs=require('fs');var path=require(_0xb81a('0x3'));var rimraf=require(_0xb81a('0x4'));var config=require(_0xb81a('0x5'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x1db795,_0xbd2cfb){return _0x1db795[_0xb81a('0x6')](_0xb81a('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xb81a('0x8'),'fields':[_0xb81a('0x9'),_0xb81a('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5197=['./intServicenowField.attributes','exports','define','servicenow_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4414f0,_0x10b931){var _0x485d89=function(_0x10f739){while(--_0x10f739){_0x4414f0['push'](_0x4414f0['shift']());}};_0x485d89(++_0x10b931);}(_0x5197,0x19b));var _0x7519=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x5197[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x7519('0x0'));var util=require(_0x7519('0x1'));var logger=require(_0x7519('0x2'))(_0x7519('0x3'));var moment=require('moment');var BPromise=require(_0x7519('0x4'));var rp=require(_0x7519('0x5'));var fs=require('fs');var path=require(_0x7519('0x6'));var rimraf=require(_0x7519('0x7'));var config=require(_0x7519('0x8'));var attributes=require(_0x7519('0x9'));module[_0x7519('0xa')]=function(_0x2a1195,_0x310f2c){return _0x2a1195[_0x7519('0xb')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x7519('0xc'),'fields':[_0x7519('0xd'),'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 a73c8fb..c60e7f7 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 _0x2c54=['ServicenowField,\x20%s,\x20%s,\x20%s','stringify','code','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent'];(function(_0x1ef04e,_0x26c2fd){var _0x59a3c8=function(_0x18fc2e){while(--_0x18fc2e){_0x1ef04e['push'](_0x1ef04e['shift']());}};_0x59a3c8(++_0x26c2fd);}(_0x2c54,0x198));var _0x42c5=function(_0xdea6de,_0x5644d3){_0xdea6de=_0xdea6de-0x0;var _0x56ceb2=_0x2c54[_0xdea6de];return _0x56ceb2;};'use strict';var _=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var moment=require(_0x42c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x42c5('0x3'));var fs=require('fs');var Redis=require(_0x42c5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x42c5('0x5'))(_0x42c5('0x6'));var config=require(_0x42c5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x42c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21b339,_0xbc4873,_0x5502c2){return new BPromise(function(_0x3ef126,_0x58a76d){return client[_0x42c5('0x9')](_0x21b339,_0x5502c2)['then'](function(_0x206282){logger[_0x42c5('0xa')]('ServicenowField,\x20%s,\x20%s',_0xbc4873,_0x42c5('0xb'));logger['debug'](_0x42c5('0xc'),_0xbc4873,_0x42c5('0xb'),JSON[_0x42c5('0xd')](_0x206282));if(_0x206282['error']){if(_0x206282['error'][_0x42c5('0xe')]===0x1f4){logger[_0x42c5('0xf')](_0x42c5('0x10'),_0xbc4873,_0x206282[_0x42c5('0xf')][_0x42c5('0x11')]);return _0x58a76d(_0x206282['error']['message']);}logger[_0x42c5('0xf')](_0x42c5('0x10'),_0xbc4873,_0x206282[_0x42c5('0xf')][_0x42c5('0x11')]);return _0x3ef126(_0x206282['error'][_0x42c5('0x11')]);}else{logger['info'](_0x42c5('0x10'),_0xbc4873,_0x42c5('0xb'));_0x3ef126(_0x206282[_0x42c5('0x12')]['message']);}})[_0x42c5('0x13')](function(_0x3143a6){logger[_0x42c5('0xf')](_0x42c5('0x10'),_0xbc4873,_0x3143a6);_0x58a76d(_0x3143a6);});});} \ No newline at end of file +var _0xe43e=['../../config/environment','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1ccd89,_0x34d6cb){var _0x2954e0=function(_0x34f22b){while(--_0x34f22b){_0x1ccd89['push'](_0x1ccd89['shift']());}};_0x2954e0(++_0x34d6cb);}(_0xe43e,0x147));var _0xee43=function(_0x417fbb,_0x300917){_0x417fbb=_0x417fbb-0x0;var _0x18ab13=_0xe43e[_0x417fbb];return _0x18ab13;};'use strict';var _=require(_0xee43('0x0'));var util=require(_0xee43('0x1'));var moment=require(_0xee43('0x2'));var BPromise=require(_0xee43('0x3'));var rs=require(_0xee43('0x4'));var fs=require('fs');var Redis=require(_0xee43('0x5'));var db=require(_0xee43('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xee43('0x7'))(_0xee43('0x8'));var config=require(_0xee43('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xee43('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eef0d,_0x364dcd,_0x2edfcf){return new BPromise(function(_0x4d9865,_0x57f06e){return client[_0xee43('0xb')](_0x2eef0d,_0x2edfcf)[_0xee43('0xc')](function(_0x54a2e9){logger[_0xee43('0xd')](_0xee43('0xe'),_0x364dcd,_0xee43('0xf'));logger['debug'](_0xee43('0x10'),_0x364dcd,_0xee43('0xf'),JSON['stringify'](_0x54a2e9));if(_0x54a2e9[_0xee43('0x11')]){if(_0x54a2e9[_0xee43('0x11')]['code']===0x1f4){logger[_0xee43('0x11')]('ServicenowField,\x20%s,\x20%s',_0x364dcd,_0x54a2e9[_0xee43('0x11')][_0xee43('0x12')]);return _0x57f06e(_0x54a2e9[_0xee43('0x11')][_0xee43('0x12')]);}logger[_0xee43('0x11')](_0xee43('0xe'),_0x364dcd,_0x54a2e9[_0xee43('0x11')]['message']);return _0x4d9865(_0x54a2e9[_0xee43('0x11')][_0xee43('0x12')]);}else{logger[_0xee43('0xd')](_0xee43('0xe'),_0x364dcd,'request\x20sent');_0x4d9865(_0x54a2e9[_0xee43('0x13')][_0xee43('0x12')]);}})[_0xee43('0x14')](function(_0x1645e6){logger[_0xee43('0x11')](_0xee43('0xe'),_0x364dcd,_0x1645e6);_0x57f06e(_0x1645e6);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index a748e43..bc41320 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 _0x6389=['get','getConfigurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','/:id','show'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x6389,0x184));var _0x9638=function(_0x30ede9,_0xbebb69){_0x30ede9=_0x30ede9-0x0;var _0x1c69a8=_0x6389[_0x30ede9];return _0x1c69a8;};'use strict';var multer=require(_0x9638('0x0'));var util=require(_0x9638('0x1'));var path=require(_0x9638('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9638('0x3')]();var auth=require(_0x9638('0x4'));var interaction=require(_0x9638('0x5'));var config=require(_0x9638('0x6'));var controller=require(_0x9638('0x7'));router['get']('/',auth[_0x9638('0x8')](),controller['index']);router['get'](_0x9638('0x9'),auth[_0x9638('0x8')](),controller[_0x9638('0xa')]);router[_0x9638('0xb')]('/:id/configurations',auth[_0x9638('0x8')](),controller[_0x9638('0xc')]);router['get'](_0x9638('0xd'),auth[_0x9638('0x8')](),controller['getFields']);router['post']('/',auth[_0x9638('0x8')](),controller[_0x9638('0xe')]);router[_0x9638('0xf')]('/:id/configurations',auth[_0x9638('0x8')](),controller['addConfiguration']);router[_0x9638('0x10')]('/:id',auth[_0x9638('0x8')](),controller[_0x9638('0x11')]);router[_0x9638('0x12')](_0x9638('0x9'),auth[_0x9638('0x8')](),controller[_0x9638('0x13')]);module[_0x9638('0x14')]=router; \ No newline at end of file +var _0xbd18=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd18,0x16d));var _0x8bd1=function(_0xe8118c,_0x5e92b2){_0xe8118c=_0xe8118c-0x0;var _0xc8ab37=_0xbd18[_0xe8118c];return _0xc8ab37;};'use strict';var multer=require(_0x8bd1('0x0'));var util=require(_0x8bd1('0x1'));var path=require('path');var timeout=require(_0x8bd1('0x2'));var express=require(_0x8bd1('0x3'));var router=express[_0x8bd1('0x4')]();var auth=require(_0x8bd1('0x5'));var interaction=require(_0x8bd1('0x6'));var config=require(_0x8bd1('0x7'));var controller=require(_0x8bd1('0x8'));router['get']('/',auth[_0x8bd1('0x9')](),controller[_0x8bd1('0xa')]);router[_0x8bd1('0xb')]('/:id',auth[_0x8bd1('0x9')](),controller[_0x8bd1('0xc')]);router[_0x8bd1('0xb')](_0x8bd1('0xd'),auth[_0x8bd1('0x9')](),controller[_0x8bd1('0xe')]);router[_0x8bd1('0xb')](_0x8bd1('0xf'),auth[_0x8bd1('0x9')](),controller[_0x8bd1('0x10')]);router[_0x8bd1('0x11')]('/',auth[_0x8bd1('0x9')](),controller['create']);router[_0x8bd1('0x11')](_0x8bd1('0xd'),auth['isAuthenticated'](),controller[_0x8bd1('0x12')]);router[_0x8bd1('0x13')]('/:id',auth[_0x8bd1('0x9')](),controller[_0x8bd1('0x14')]);router[_0x8bd1('0x15')]('/:id',auth[_0x8bd1('0x9')](),controller[_0x8bd1('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1e88fc2..b648202 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 _0xf5f8=['STRING','username','remoteUri','sequelize','exports'];(function(_0x23cf8c,_0x51ebb5){var _0xfc4ccc=function(_0x113fcc){while(--_0x113fcc){_0x23cf8c['push'](_0x23cf8c['shift']());}};_0xfc4ccc(++_0x51ebb5);}(_0xf5f8,0x1bb));var _0x8f5f=function(_0x1375de,_0x270730){_0x1375de=_0x1375de-0x0;var _0xd31b0a=_0xf5f8[_0x1375de];return _0xd31b0a;};'use strict';var Sequelize=require(_0x8f5f('0x0'));module[_0x8f5f('0x1')]={'name':{'type':Sequelize[_0x8f5f('0x2')]},'description':{'type':Sequelize[_0x8f5f('0x2')]},'username':{'type':Sequelize[_0x8f5f('0x2')],'unique':_0x8f5f('0x3')},'password':{'type':Sequelize[_0x8f5f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8f5f('0x4')},'serverUrl':{'type':Sequelize[_0x8f5f('0x2')]}}; \ No newline at end of file +var _0x02ca=['STRING','username','remoteUri','sequelize','exports'];(function(_0xcd70c1,_0x22bd1b){var _0x4655f0=function(_0x507fca){while(--_0x507fca){_0xcd70c1['push'](_0xcd70c1['shift']());}};_0x4655f0(++_0x22bd1b);}(_0x02ca,0xdf));var _0xa02c=function(_0xa3d53e,_0x571641){_0xa3d53e=_0xa3d53e-0x0;var _0x4935ed=_0x02ca[_0xa3d53e];return _0x4935ed;};'use strict';var Sequelize=require(_0xa02c('0x0'));module[_0xa02c('0x1')]={'name':{'type':Sequelize[_0xa02c('0x2')]},'description':{'type':Sequelize[_0xa02c('0x2')]},'username':{'type':Sequelize[_0xa02c('0x2')],'unique':_0xa02c('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa02c('0x2')],'unique':_0xa02c('0x4')},'serverUrl':{'type':Sequelize[_0xa02c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index e3f07b8..d62b9cc 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 _0x33ac=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','stack','name','index','SugarcrmAccount','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','field','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','http','test','ValidationError'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x33ac,0x1f2));var _0xc33a=function(_0x364602,_0x8f68e9){_0x364602=_0x364602-0x0;var _0x460de2=_0x33ac[_0x364602];return _0x460de2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc33a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc33a('0x1'));var rp=require(_0xc33a('0x2'));var moment=require(_0xc33a('0x3'));var BPromise=require(_0xc33a('0x4'));var Mustache=require(_0xc33a('0x5'));var util=require(_0xc33a('0x6'));var path=require(_0xc33a('0x7'));var sox=require(_0xc33a('0x8'));var csv=require(_0xc33a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc33a('0xa'));var crypto=require(_0xc33a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc33a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc33a('0xd'));var Papa=require(_0xc33a('0xe'));var Redis=require(_0xc33a('0xf'));var authService=require(_0xc33a('0x10'));var qs=require(_0xc33a('0x11'));var hardwareService=require(_0xc33a('0x12'));var logger=require(_0xc33a('0x13'))(_0xc33a('0x14'));var utils=require(_0xc33a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xc33a('0x16'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc33a('0x17')]({'port':0x232a});function checkPasswordPattern(_0x287e3b,_0x3b6cdd,_0xd1960f){if(_0xd1960f){var _0x40724a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40724a[_0xc33a('0x18')](_0x3b6cdd)){return _0x287e3b;}else{throw new db['Sequelize'][(_0xc33a('0x19'))](_0xc33a('0x1a'));}}else{return _0x287e3b;}}function respondWithRpcPromise(_0x14ccbf,_0x4c70ae,_0x1a77f7,_0x53f800){return new BPromise(function(_0x6d5b1,_0x3e1646){var _0x236280=_0x53f800||client;return _0x236280[_0xc33a('0x1b')](_0x14ccbf,_0x1a77f7)[_0xc33a('0x1c')](function(_0x4fa7d0){logger['info'](_0xc33a('0x1d'),_0x4c70ae,_0xc33a('0x1e'));logger[_0xc33a('0x1f')](_0xc33a('0x20'),_0x4c70ae,_0xc33a('0x1e'),JSON[_0xc33a('0x21')](_0x4fa7d0));if(_0x4fa7d0[_0xc33a('0x22')]){if(_0x4fa7d0[_0xc33a('0x22')]['code']===0x1f4){logger[_0xc33a('0x22')](_0xc33a('0x1d'),_0x4c70ae,_0x4fa7d0[_0xc33a('0x22')][_0xc33a('0x23')]);return _0x3e1646(_0x4fa7d0['error'][_0xc33a('0x23')]);}logger[_0xc33a('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x4c70ae,_0x4fa7d0[_0xc33a('0x22')][_0xc33a('0x23')]);return _0x6d5b1(_0x4fa7d0[_0xc33a('0x22')][_0xc33a('0x23')]);}else{logger[_0xc33a('0x24')](_0xc33a('0x1d'),_0x4c70ae,_0xc33a('0x1e'));_0x6d5b1(_0x4fa7d0[_0xc33a('0x25')][_0xc33a('0x23')]);}})[_0xc33a('0x26')](function(_0x1f829a){logger[_0xc33a('0x22')](_0xc33a('0x1d'),_0x4c70ae,_0x1f829a);_0x3e1646(_0x1f829a);});});}function respondWithStatusCode(_0x37b32d,_0x29d3d3){_0x29d3d3=_0x29d3d3||0xcc;return function(_0x3d3c3b){if(_0x3d3c3b){return _0x37b32d[_0xc33a('0x27')](_0x29d3d3);}return _0x37b32d[_0xc33a('0x28')](_0x29d3d3)[_0xc33a('0x29')]();};}function respondWithResult(_0x4c42d1,_0x451342){_0x451342=_0x451342||0xc8;return function(_0x18d77d){if(_0x18d77d){return _0x4c42d1[_0xc33a('0x28')](_0x451342)['json'](_0x18d77d);}};}function respondWithFilteredResult(_0xda6ac0,_0x163f2a){return function(_0x1745a4){if(_0x1745a4){var _0x2a1cc8=_0x1745a4[_0xc33a('0x2a')],_0x2cdd42=_0x163f2a[_0xc33a('0x2b')],_0x4c676=_0x163f2a[_0xc33a('0x2b')]+_0x163f2a['limit'],_0x4ccc71;if(_0x4c676>=_0x2a1cc8){_0x4c676=_0x2a1cc8;_0x4ccc71=0xc8;}else{_0x4ccc71=0xce;}_0xda6ac0['status'](_0x4ccc71);return _0xda6ac0[_0xc33a('0x2c')](_0xc33a('0x2d'),_0x2cdd42+'-'+_0x4c676+'/'+_0x2a1cc8)[_0xc33a('0x2e')](_0x1745a4);}return null;};}function patchUpdates(_0xf6488f){return function(_0x81cc14){try{jsonpatch[_0xc33a('0x2f')](_0x81cc14,_0xf6488f,!![]);}catch(_0x28df76){return BPromise[_0xc33a('0x30')](_0x28df76);}return _0x81cc14[_0xc33a('0x31')]();};}function saveUpdates(_0x49188a,_0x4f7d9e){return function(_0x4df6ff){if(_0x4df6ff){return _0x4df6ff[_0xc33a('0x32')](_0x49188a)[_0xc33a('0x1c')](function(_0x39baad){return _0x39baad;});}return null;};}function removeEntity(_0x356796,_0x2e3b7c){return function(_0x30c402){if(_0x30c402){return _0x30c402['destroy']()[_0xc33a('0x1c')](function(){_0x356796[_0xc33a('0x28')](0xcc)[_0xc33a('0x29')]();});}};}function handleEntityNotFound(_0x547317,_0xf27a68){return function(_0x30000b){if(!_0x30000b){_0x547317[_0xc33a('0x27')](0x194);}return _0x30000b;};}function handleError(_0x130133,_0xc1b566){_0xc1b566=_0xc1b566||0x1f4;return function(_0x44306b){logger[_0xc33a('0x22')](_0x44306b[_0xc33a('0x33')]);if(_0x44306b['name']){delete _0x44306b[_0xc33a('0x34')];}_0x130133['status'](_0xc1b566)['send'](_0x44306b);};}exports[_0xc33a('0x35')]=function(_0x4bcab1,_0xef555d){var _0x43b21e={},_0xf26091={},_0x2bfc2f={'count':0x0,'rows':[]};var _0x14db10=db[_0xc33a('0x36')]['rawAttributes'];_0xf26091[_0xc33a('0x37')]=_['keys'](_0x14db10);_0xf26091[_0xc33a('0x38')]=_[_0xc33a('0x39')](_0x4bcab1[_0xc33a('0x38')]);_0xf26091[_0xc33a('0x3a')]=_[_0xc33a('0x3b')](_0xf26091[_0xc33a('0x37')],_0xf26091[_0xc33a('0x38')]);_0x43b21e[_0xc33a('0x3c')]=_[_0xc33a('0x3b')](_0xf26091[_0xc33a('0x37')],qs['fields'](_0x4bcab1[_0xc33a('0x38')][_0xc33a('0x3d')]));_0x43b21e[_0xc33a('0x3c')]=_0x43b21e['attributes'][_0xc33a('0x3e')]?_0x43b21e[_0xc33a('0x3c')]:_0xf26091[_0xc33a('0x37')];if(!_0x4bcab1[_0xc33a('0x38')]['hasOwnProperty'](_0xc33a('0x3f'))){_0x43b21e['limit']=qs['limit'](_0x4bcab1[_0xc33a('0x38')][_0xc33a('0x40')]);_0x43b21e[_0xc33a('0x2b')]=qs['offset'](_0x4bcab1[_0xc33a('0x38')][_0xc33a('0x2b')]);}_0x43b21e[_0xc33a('0x41')]=qs[_0xc33a('0x42')](_0x4bcab1[_0xc33a('0x38')][_0xc33a('0x42')]);_0x43b21e['where']=qs['filters'](_[_0xc33a('0x43')](_0x4bcab1[_0xc33a('0x38')],_0xf26091[_0xc33a('0x3a')]));if(_0x4bcab1[_0xc33a('0x38')][_0xc33a('0x44')]){_0x43b21e[_0xc33a('0x45')]=_[_0xc33a('0x46')](_0x43b21e[_0xc33a('0x45')],{'$or':_[_0xc33a('0x47')](_0x14db10,function(_0x4be020){if(_0x4be020[_0xc33a('0x48')]['key']!==_0xc33a('0x49')){var _0x621e7d={};_0x621e7d[_0x4be020[_0xc33a('0x4a')]]={'$like':'%'+_0x4bcab1[_0xc33a('0x38')][_0xc33a('0x44')]+'%'};return _0x621e7d;}})});}_0x43b21e=_[_0xc33a('0x46')]({},_0x43b21e,_0x4bcab1['options']);var _0x255054={'where':_0x43b21e[_0xc33a('0x45')]};return db[_0xc33a('0x36')][_0xc33a('0x2a')](_0x255054)[_0xc33a('0x1c')](function(_0x13c8c7){_0x2bfc2f[_0xc33a('0x2a')]=_0x13c8c7;if(_0x4bcab1[_0xc33a('0x38')][_0xc33a('0x4b')]){_0x43b21e[_0xc33a('0x4c')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xc33a('0x4d')](_0x43b21e);})[_0xc33a('0x1c')](function(_0x3b0022){_0x2bfc2f[_0xc33a('0x4e')]=_0x3b0022;return _0x2bfc2f;})[_0xc33a('0x1c')](respondWithFilteredResult(_0xef555d,_0x43b21e))[_0xc33a('0x26')](handleError(_0xef555d,null));};exports[_0xc33a('0x4f')]=function(_0x35b26a,_0x22ab04){var _0x4a0453={'raw':![],'where':{'id':_0x35b26a[_0xc33a('0x50')]['id']}},_0x339842={};_0x339842['model']=_[_0xc33a('0x39')](db[_0xc33a('0x36')][_0xc33a('0x51')]);_0x339842[_0xc33a('0x38')]=_[_0xc33a('0x39')](_0x35b26a[_0xc33a('0x38')]);_0x339842[_0xc33a('0x3a')]=_[_0xc33a('0x3b')](_0x339842[_0xc33a('0x37')],_0x339842[_0xc33a('0x38')]);_0x4a0453[_0xc33a('0x3c')]=_['intersection'](_0x339842[_0xc33a('0x37')],qs[_0xc33a('0x3d')](_0x35b26a[_0xc33a('0x38')][_0xc33a('0x3d')]));_0x4a0453[_0xc33a('0x3c')]=_0x4a0453['attributes']['length']?_0x4a0453[_0xc33a('0x3c')]:_0x339842[_0xc33a('0x37')];if(_0x35b26a['query']['includeAll']){_0x4a0453[_0xc33a('0x4c')]=[{'all':!![]}];}_0x4a0453=_[_0xc33a('0x46')]({},_0x4a0453,_0x35b26a[_0xc33a('0x52')]);return db[_0xc33a('0x36')][_0xc33a('0x53')](_0x4a0453)[_0xc33a('0x1c')](handleEntityNotFound(_0x22ab04,null))[_0xc33a('0x1c')](respondWithResult(_0x22ab04,null))[_0xc33a('0x26')](handleError(_0x22ab04,null));};exports[_0xc33a('0x54')]=function(_0x379467,_0x1413b6){return db[_0xc33a('0x36')][_0xc33a('0x54')](_0x379467[_0xc33a('0x55')],{})[_0xc33a('0x1c')](respondWithResult(_0x1413b6,0xc9))[_0xc33a('0x26')](handleError(_0x1413b6,null));};exports[_0xc33a('0x32')]=function(_0x531558,_0xe51981){if(_0x531558[_0xc33a('0x55')]['id']){delete _0x531558[_0xc33a('0x55')]['id'];}return db[_0xc33a('0x36')][_0xc33a('0x53')]({'where':{'id':_0x531558[_0xc33a('0x50')]['id']}})[_0xc33a('0x1c')](handleEntityNotFound(_0xe51981,null))[_0xc33a('0x1c')](saveUpdates(_0x531558[_0xc33a('0x55')],null))[_0xc33a('0x1c')](respondWithResult(_0xe51981,null))[_0xc33a('0x26')](handleError(_0xe51981,null));};exports['destroy']=function(_0x37adf0,_0x6907ad){return db[_0xc33a('0x36')][_0xc33a('0x53')]({'where':{'id':_0x37adf0['params']['id']}})[_0xc33a('0x1c')](handleEntityNotFound(_0x6907ad,null))[_0xc33a('0x1c')](removeEntity(_0x6907ad,null))[_0xc33a('0x26')](handleError(_0x6907ad,null));};exports['getConfigurations']=function(_0x541d89,_0x34cc7f,_0x56c1b8){var _0x2d9f69={};var _0x17db8d={};var _0x5d0555;var _0x2a86f8;return db[_0xc33a('0x36')][_0xc33a('0x56')]({'where':{'id':_0x541d89[_0xc33a('0x50')]['id']}})[_0xc33a('0x1c')](handleEntityNotFound(_0x34cc7f,null))[_0xc33a('0x1c')](function(_0x373373){if(_0x373373){_0x5d0555=_0x373373;_0x17db8d[_0xc33a('0x37')]=_[_0xc33a('0x39')](db[_0xc33a('0x57')][_0xc33a('0x51')]);_0x17db8d[_0xc33a('0x38')]=_[_0xc33a('0x39')](_0x541d89[_0xc33a('0x38')]);_0x17db8d[_0xc33a('0x3a')]=_[_0xc33a('0x3b')](_0x17db8d[_0xc33a('0x37')],_0x17db8d['query']);_0x2d9f69[_0xc33a('0x3c')]=_['intersection'](_0x17db8d[_0xc33a('0x37')],qs[_0xc33a('0x3d')](_0x541d89[_0xc33a('0x38')][_0xc33a('0x3d')]));_0x2d9f69['attributes']=_0x2d9f69[_0xc33a('0x3c')]['length']?_0x2d9f69[_0xc33a('0x3c')]:_0x17db8d['model'];_0x2d9f69[_0xc33a('0x41')]=qs[_0xc33a('0x42')](_0x541d89[_0xc33a('0x38')][_0xc33a('0x42')]);_0x2d9f69['where']=qs['filters'](_['pick'](_0x541d89[_0xc33a('0x38')],_0x17db8d[_0xc33a('0x3a')]));if(_0x541d89['query'][_0xc33a('0x44')]){_0x2d9f69[_0xc33a('0x45')]=_[_0xc33a('0x46')](_0x2d9f69[_0xc33a('0x45')],{'$or':_[_0xc33a('0x47')](_0x2d9f69[_0xc33a('0x3c')],function(_0x1bd274){var _0x399220={};_0x399220[_0x1bd274]={'$like':'%'+_0x541d89[_0xc33a('0x38')]['filter']+'%'};return _0x399220;})});}_0x2d9f69=_[_0xc33a('0x46')]({},_0x2d9f69,_0x541d89[_0xc33a('0x52')]);return _0x5d0555[_0xc33a('0x58')](_0x2d9f69);}})[_0xc33a('0x1c')](function(_0x18577b){if(_0x18577b){_0x2a86f8=_0x18577b[_0xc33a('0x3e')];if(!_0x541d89['query'][_0xc33a('0x59')](_0xc33a('0x3f'))){_0x2d9f69['limit']=qs[_0xc33a('0x40')](_0x541d89['query'][_0xc33a('0x40')]);_0x2d9f69[_0xc33a('0x2b')]=qs[_0xc33a('0x2b')](_0x541d89['query'][_0xc33a('0x2b')]);}return _0x5d0555[_0xc33a('0x58')](_0x2d9f69);}})[_0xc33a('0x1c')](function(_0x3a96a7){if(_0x3a96a7){return _0x3a96a7?{'count':_0x2a86f8,'rows':_0x3a96a7}:null;}})[_0xc33a('0x1c')](respondWithResult(_0x34cc7f,null))['catch'](handleError(_0x34cc7f,null));};exports[_0xc33a('0x5a')]=function(_0x184990,_0x4501df,_0x1223d4){if(_0x184990[_0xc33a('0x55')]['id']){delete _0x184990[_0xc33a('0x55')]['id'];}return db[_0xc33a('0x36')][_0xc33a('0x56')]({'where':{'id':_0x184990[_0xc33a('0x50')]['id']}})['then'](handleEntityNotFound(_0x4501df,null))['then'](function(_0x4d99e5){if(_0x4d99e5){_0x184990[_0xc33a('0x55')][_0xc33a('0x5b')]=_0x4d99e5['id'];_0x184990[_0xc33a('0x55')][_0xc33a('0x5c')]=integrations['getSubjects'](_0x184990[_0xc33a('0x55')][_0xc33a('0x5d')],_0x184990['body'][_0xc33a('0x48')]);_0x184990[_0xc33a('0x55')]['Descriptions']=integrations[_0xc33a('0x5e')](_0x184990[_0xc33a('0x55')]['channel'],_0x184990['body'][_0xc33a('0x48')]);return db[_0xc33a('0x57')]['create'](_0x184990[_0xc33a('0x55')],{'include':[{'model':db['SugarcrmField'],'as':_0xc33a('0x5c')},{'model':db[_0xc33a('0x5f')],'as':'Descriptions'}]});}return null;})[_0xc33a('0x1c')](respondWithResult(_0x4501df,null))[_0xc33a('0x26')](handleError(_0x4501df,null));};exports[_0xc33a('0x60')]=function(_0x22f86f,_0x1a722c,_0x642875){var _0x13c55f='';var _0x3696ee=['id',_0xc33a('0x34'),_0xc33a('0x61'),_0xc33a('0x62'),'description','date_start',_0xc33a('0x63'),_0xc33a('0x64'),_0xc33a('0x65'),_0xc33a('0x66'),_0xc33a('0x67'),_0xc33a('0x68')];return db[_0xc33a('0x36')][_0xc33a('0x56')]({'where':{'id':_0x22f86f[_0xc33a('0x50')]['id']},'attributes':['id',_0xc33a('0x69'),'password',_0xc33a('0x6a')]})[_0xc33a('0x1c')](handleEntityNotFound(_0x1a722c,null))[_0xc33a('0x1c')](function(_0x3446bb){if(_0x3446bb){_0x13c55f=_0x3446bb[_0xc33a('0x6a')];var _0x348c9a=_0x13c55f[_0xc33a('0x6b')](-0x1);if(_0x348c9a==='/'){_0x13c55f=_0x13c55f[_0xc33a('0x6c')](0x0,_0x13c55f[_0xc33a('0x6d')](_0x348c9a));}return rp({'method':_0xc33a('0x6e'),'uri':util['format'](_0xc33a('0x6f'),_0x13c55f,_0xc33a('0x70')),'json':!![],'form':{'method':_0xc33a('0x71'),'input_type':_0xc33a('0x72'),'response_type':_0xc33a('0x72'),'rest_data':JSON[_0xc33a('0x21')]({'user_auth':{'user_name':_0x3446bb[_0xc33a('0x69')],'password':_0x3446bb['password'],'encryption':_0xc33a('0x73')},'application':_0xc33a('0x74')})}});}})[_0xc33a('0x1c')](function(_0x5026e8){if(_0x5026e8&&_0x5026e8[_0xc33a('0x34')]!==_0xc33a('0x75')&&_0x5026e8[_0xc33a('0x34')]!==_0xc33a('0x76')){return rp({'method':_0xc33a('0x6e'),'uri':util['format'](_0xc33a('0x6f'),_0x13c55f,_0xc33a('0x70')),'json':!![],'form':{'method':_0xc33a('0x77'),'input_type':_0xc33a('0x72'),'response_type':_0xc33a('0x72'),'rest_data':JSON[_0xc33a('0x21')]({'session':_0x5026e8['id'],'module_name':_0xc33a('0x78')})}})[_0xc33a('0x1c')](function(_0xf8e86){if(_0xf8e86){var _0x413207=_[_0xc33a('0x79')](_0xf8e86[_0xc33a('0x7a')]);_[_0xc33a('0x7b')](_0x413207,function(_0x1969d8){return _0x3696ee[_0xc33a('0x7c')](_0x1969d8[_0xc33a('0x34')]);});return{'count':_0x413207[_0xc33a('0x3e')],'rows':_[_0xc33a('0x47')](_0x413207,function(_0x10a4b2){return{'id':_0x10a4b2[_0xc33a('0x34')],'name':_0x10a4b2[_0xc33a('0x7d')],'custom':_[_0xc33a('0x7e')](_0x10a4b2[_0xc33a('0x34')],'_c')?!![]:![],'options':_0x10a4b2[_0xc33a('0x52')]?_['map'](_[_0xc33a('0x79')](_0x10a4b2[_0xc33a('0x52')]),function(_0x2a929d){return{'name':_0x2a929d[_0xc33a('0x7f')],'value':_0x2a929d[_0xc33a('0x34')]};}):[]};})};}})[_0xc33a('0x1c')](respondWithResult(_0x1a722c,null))[_0xc33a('0x26')](function(_0x42914d){var _0x330a37=_0x22f86f['query'][_0xc33a('0x18')]?0x1f4:_0x42914d[_0xc33a('0x80')]||0x1f4;logger[_0xc33a('0x22')](_0xc33a('0x81'),_0xc33a('0x60'),_0x330a37,JSON['stringify'](_0x42914d));delete _0x42914d[_0xc33a('0x34')];if(_0x330a37===0x191){_0x330a37=0x190;}_0x1a722c[_0xc33a('0x28')](_0x330a37)['send'](_0x22f86f[_0xc33a('0x38')]['test']?{'message':_0xc33a('0x82'),'statusCode':_0x42914d[_0xc33a('0x80')]}:_0x42914d);});}else{var _0xa3b6c8=0x1f4;_0x1a722c['status'](_0xa3b6c8)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x9303=['result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','SugarcrmAccount','model','query','fields','attributes','length','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','rows','show','params','rawAttributes','keys','filters','intersection','create','body','find','destroy','getConfigurations','pick','nolimit','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','lastIndexOf','POST','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','%s%s','get_module_fields','values','module_fields','includes','label','value','getFields,\x20%s,\x20%s,\x20%s','statusCode','Wrong\x20credentials','html-pdf','zip-dir','request-promise','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','SugarcrmAccount,\x20%s,\x20%s','error','message'];(function(_0x287955,_0x24e758){var _0x503953=function(_0x4c9641){while(--_0x4c9641){_0x287955['push'](_0x287955['shift']());}};_0x503953(++_0x24e758);}(_0x9303,0xd7));var _0x3930=function(_0x3c5924,_0x4d295f){_0x3c5924=_0x3c5924-0x0;var _0x576958=_0x9303[_0x3c5924];return _0x576958;};'use strict';var pdf=require(_0x3930('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3930('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3930('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3930('0x3'));var util=require(_0x3930('0x4'));var path=require(_0x3930('0x5'));var sox=require(_0x3930('0x6'));var csv=require('to-csv');var ejs=require(_0x3930('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3930('0x8'));var jsforce=require(_0x3930('0x9'));var deskjs=require(_0x3930('0xa'));var toCsv=require(_0x3930('0xb'));var querystring=require(_0x3930('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3930('0xd'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3930('0xe'));var utils=require(_0x3930('0xf'));var config=require(_0x3930('0x10'));var db=require(_0x3930('0x11'))['db'];var integrations=require(_0x3930('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x3930('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x185659,_0x37fb25,_0x5d44a1){if(_0x5d44a1){var _0x555cae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x555cae[_0x3930('0x14')](_0x37fb25)){return _0x185659;}else{throw new db[(_0x3930('0x15'))]['ValidationError'](_0x3930('0x16'));}}else{return _0x185659;}}function respondWithRpcPromise(_0x44603d,_0x3bc35e,_0x135498,_0x5db060){return new BPromise(function(_0x55ec9b,_0x3a2ac0){var _0x49468d=_0x5db060||client;return _0x49468d[_0x3930('0x17')](_0x44603d,_0x135498)['then'](function(_0x4113c4){logger[_0x3930('0x18')]('SugarcrmAccount,\x20%s,\x20%s',_0x3bc35e,'request\x20sent');logger['debug'](_0x3930('0x19'),_0x3bc35e,_0x3930('0x1a'),JSON[_0x3930('0x1b')](_0x4113c4));if(_0x4113c4['error']){if(_0x4113c4['error']['code']===0x1f4){logger['error'](_0x3930('0x1c'),_0x3bc35e,_0x4113c4[_0x3930('0x1d')][_0x3930('0x1e')]);return _0x3a2ac0(_0x4113c4[_0x3930('0x1d')][_0x3930('0x1e')]);}logger['error'](_0x3930('0x1c'),_0x3bc35e,_0x4113c4[_0x3930('0x1d')][_0x3930('0x1e')]);return _0x55ec9b(_0x4113c4['error'][_0x3930('0x1e')]);}else{logger[_0x3930('0x18')](_0x3930('0x1c'),_0x3bc35e,_0x3930('0x1a'));_0x55ec9b(_0x4113c4[_0x3930('0x1f')][_0x3930('0x1e')]);}})[_0x3930('0x20')](function(_0x14acf5){logger['error'](_0x3930('0x1c'),_0x3bc35e,_0x14acf5);_0x3a2ac0(_0x14acf5);});});}function respondWithStatusCode(_0x1dcdcd,_0x187453){_0x187453=_0x187453||0xcc;return function(_0x11358e){if(_0x11358e){return _0x1dcdcd[_0x3930('0x21')](_0x187453);}return _0x1dcdcd['status'](_0x187453)[_0x3930('0x22')]();};}function respondWithResult(_0x7b6825,_0x2489e6){_0x2489e6=_0x2489e6||0xc8;return function(_0x5b20a7){if(_0x5b20a7){return _0x7b6825[_0x3930('0x23')](_0x2489e6)[_0x3930('0x24')](_0x5b20a7);}};}function respondWithFilteredResult(_0x699a54,_0x423fe6){return function(_0x582b18){if(_0x582b18){var _0x575e76=_0x582b18['count'],_0x447d71=_0x423fe6[_0x3930('0x25')],_0x121cce=_0x423fe6[_0x3930('0x25')]+_0x423fe6[_0x3930('0x26')],_0xca904a;if(_0x121cce>=_0x575e76){_0x121cce=_0x575e76;_0xca904a=0xc8;}else{_0xca904a=0xce;}_0x699a54[_0x3930('0x23')](_0xca904a);return _0x699a54[_0x3930('0x27')](_0x3930('0x28'),_0x447d71+'-'+_0x121cce+'/'+_0x575e76)[_0x3930('0x24')](_0x582b18);}return null;};}function patchUpdates(_0xc4a53e){return function(_0x148f4e){try{jsonpatch[_0x3930('0x29')](_0x148f4e,_0xc4a53e,!![]);}catch(_0x43c17f){return BPromise[_0x3930('0x2a')](_0x43c17f);}return _0x148f4e[_0x3930('0x2b')]();};}function saveUpdates(_0x2e2431,_0x16dccf){return function(_0x39d56b){if(_0x39d56b){return _0x39d56b[_0x3930('0x2c')](_0x2e2431)[_0x3930('0x2d')](function(_0xdedb5c){return _0xdedb5c;});}return null;};}function removeEntity(_0x3a5e92,_0x571138){return function(_0x57e12b){if(_0x57e12b){return _0x57e12b['destroy']()[_0x3930('0x2d')](function(){_0x3a5e92[_0x3930('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x349868,_0x375ebb){return function(_0x4e05ba){if(!_0x4e05ba){_0x349868[_0x3930('0x21')](0x194);}return _0x4e05ba;};}function handleError(_0x587492,_0x476e6e){_0x476e6e=_0x476e6e||0x1f4;return function(_0x3aee1f){logger[_0x3930('0x1d')](_0x3aee1f[_0x3930('0x2e')]);if(_0x3aee1f[_0x3930('0x2f')]){delete _0x3aee1f[_0x3930('0x2f')];}_0x587492[_0x3930('0x23')](_0x476e6e)[_0x3930('0x30')](_0x3aee1f);};}exports[_0x3930('0x31')]=function(_0x3e9632,_0x315091){var _0x2e9694={},_0x3ff697={},_0xfc8229={'count':0x0,'rows':[]};var _0x231fa1=db[_0x3930('0x32')]['rawAttributes'];_0x3ff697[_0x3930('0x33')]=_['keys'](_0x231fa1);_0x3ff697[_0x3930('0x34')]=_['keys'](_0x3e9632[_0x3930('0x34')]);_0x3ff697['filters']=_['intersection'](_0x3ff697[_0x3930('0x33')],_0x3ff697[_0x3930('0x34')]);_0x2e9694['attributes']=_['intersection'](_0x3ff697[_0x3930('0x33')],qs['fields'](_0x3e9632[_0x3930('0x34')][_0x3930('0x35')]));_0x2e9694[_0x3930('0x36')]=_0x2e9694[_0x3930('0x36')][_0x3930('0x37')]?_0x2e9694[_0x3930('0x36')]:_0x3ff697[_0x3930('0x33')];if(!_0x3e9632[_0x3930('0x34')]['hasOwnProperty']('nolimit')){_0x2e9694[_0x3930('0x26')]=qs[_0x3930('0x26')](_0x3e9632['query']['limit']);_0x2e9694[_0x3930('0x25')]=qs[_0x3930('0x25')](_0x3e9632[_0x3930('0x34')]['offset']);}_0x2e9694['order']=qs[_0x3930('0x38')](_0x3e9632[_0x3930('0x34')][_0x3930('0x38')]);_0x2e9694[_0x3930('0x39')]=qs['filters'](_['pick'](_0x3e9632[_0x3930('0x34')],_0x3ff697['filters']));if(_0x3e9632[_0x3930('0x34')][_0x3930('0x3a')]){_0x2e9694['where']=_[_0x3930('0x3b')](_0x2e9694['where'],{'$or':_[_0x3930('0x3c')](_0x231fa1,function(_0x2ad188){if(_0x2ad188[_0x3930('0x3d')][_0x3930('0x3e')]!==_0x3930('0x3f')){var _0x2e5b04={};_0x2e5b04[_0x2ad188[_0x3930('0x40')]]={'$like':'%'+_0x3e9632[_0x3930('0x34')][_0x3930('0x3a')]+'%'};return _0x2e5b04;}})});}_0x2e9694=_[_0x3930('0x3b')]({},_0x2e9694,_0x3e9632[_0x3930('0x41')]);var _0x283862={'where':_0x2e9694[_0x3930('0x39')]};return db[_0x3930('0x32')][_0x3930('0x42')](_0x283862)['then'](function(_0x4450f5){_0xfc8229[_0x3930('0x42')]=_0x4450f5;if(_0x3e9632[_0x3930('0x34')][_0x3930('0x43')]){_0x2e9694[_0x3930('0x44')]=[{'all':!![]}];}return db[_0x3930('0x32')]['findAll'](_0x2e9694);})[_0x3930('0x2d')](function(_0xcb6e0){_0xfc8229[_0x3930('0x45')]=_0xcb6e0;return _0xfc8229;})[_0x3930('0x2d')](respondWithFilteredResult(_0x315091,_0x2e9694))['catch'](handleError(_0x315091,null));};exports[_0x3930('0x46')]=function(_0x5ae7fb,_0x168b40){var _0x4eaf27={'raw':![],'where':{'id':_0x5ae7fb[_0x3930('0x47')]['id']}},_0x4fdf3a={};_0x4fdf3a[_0x3930('0x33')]=_['keys'](db[_0x3930('0x32')][_0x3930('0x48')]);_0x4fdf3a[_0x3930('0x34')]=_[_0x3930('0x49')](_0x5ae7fb['query']);_0x4fdf3a[_0x3930('0x4a')]=_[_0x3930('0x4b')](_0x4fdf3a[_0x3930('0x33')],_0x4fdf3a[_0x3930('0x34')]);_0x4eaf27['attributes']=_[_0x3930('0x4b')](_0x4fdf3a[_0x3930('0x33')],qs[_0x3930('0x35')](_0x5ae7fb[_0x3930('0x34')][_0x3930('0x35')]));_0x4eaf27[_0x3930('0x36')]=_0x4eaf27['attributes'][_0x3930('0x37')]?_0x4eaf27[_0x3930('0x36')]:_0x4fdf3a['model'];if(_0x5ae7fb[_0x3930('0x34')]['includeAll']){_0x4eaf27[_0x3930('0x44')]=[{'all':!![]}];}_0x4eaf27=_[_0x3930('0x3b')]({},_0x4eaf27,_0x5ae7fb[_0x3930('0x41')]);return db[_0x3930('0x32')]['find'](_0x4eaf27)[_0x3930('0x2d')](handleEntityNotFound(_0x168b40,null))[_0x3930('0x2d')](respondWithResult(_0x168b40,null))[_0x3930('0x20')](handleError(_0x168b40,null));};exports[_0x3930('0x4c')]=function(_0xb82796,_0x36665b){return db[_0x3930('0x32')][_0x3930('0x4c')](_0xb82796[_0x3930('0x4d')],{})[_0x3930('0x2d')](respondWithResult(_0x36665b,0xc9))['catch'](handleError(_0x36665b,null));};exports[_0x3930('0x2c')]=function(_0x2c2cad,_0x113afd){if(_0x2c2cad['body']['id']){delete _0x2c2cad[_0x3930('0x4d')]['id'];}return db['SugarcrmAccount'][_0x3930('0x4e')]({'where':{'id':_0x2c2cad['params']['id']}})[_0x3930('0x2d')](handleEntityNotFound(_0x113afd,null))[_0x3930('0x2d')](saveUpdates(_0x2c2cad[_0x3930('0x4d')],null))[_0x3930('0x2d')](respondWithResult(_0x113afd,null))[_0x3930('0x20')](handleError(_0x113afd,null));};exports[_0x3930('0x4f')]=function(_0x186000,_0x218592){return db['SugarcrmAccount']['find']({'where':{'id':_0x186000[_0x3930('0x47')]['id']}})[_0x3930('0x2d')](handleEntityNotFound(_0x218592,null))['then'](removeEntity(_0x218592,null))['catch'](handleError(_0x218592,null));};exports[_0x3930('0x50')]=function(_0x18d0ce,_0x44dfd1,_0x550640){var _0x315f21={};var _0xfceaa4={};var _0x3e3881;var _0x5cf683;return db[_0x3930('0x32')]['findOne']({'where':{'id':_0x18d0ce['params']['id']}})[_0x3930('0x2d')](handleEntityNotFound(_0x44dfd1,null))[_0x3930('0x2d')](function(_0x3ccdc6){if(_0x3ccdc6){_0x3e3881=_0x3ccdc6;_0xfceaa4['model']=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0xfceaa4[_0x3930('0x34')]=_[_0x3930('0x49')](_0x18d0ce[_0x3930('0x34')]);_0xfceaa4[_0x3930('0x4a')]=_['intersection'](_0xfceaa4[_0x3930('0x33')],_0xfceaa4[_0x3930('0x34')]);_0x315f21['attributes']=_[_0x3930('0x4b')](_0xfceaa4[_0x3930('0x33')],qs[_0x3930('0x35')](_0x18d0ce[_0x3930('0x34')][_0x3930('0x35')]));_0x315f21[_0x3930('0x36')]=_0x315f21['attributes'][_0x3930('0x37')]?_0x315f21[_0x3930('0x36')]:_0xfceaa4[_0x3930('0x33')];_0x315f21['order']=qs[_0x3930('0x38')](_0x18d0ce[_0x3930('0x34')][_0x3930('0x38')]);_0x315f21[_0x3930('0x39')]=qs[_0x3930('0x4a')](_[_0x3930('0x51')](_0x18d0ce['query'],_0xfceaa4[_0x3930('0x4a')]));if(_0x18d0ce['query'][_0x3930('0x3a')]){_0x315f21['where']=_[_0x3930('0x3b')](_0x315f21[_0x3930('0x39')],{'$or':_[_0x3930('0x3c')](_0x315f21['attributes'],function(_0x508c62){var _0x222a0c={};_0x222a0c[_0x508c62]={'$like':'%'+_0x18d0ce[_0x3930('0x34')][_0x3930('0x3a')]+'%'};return _0x222a0c;})});}_0x315f21=_[_0x3930('0x3b')]({},_0x315f21,_0x18d0ce[_0x3930('0x41')]);return _0x3e3881[_0x3930('0x50')](_0x315f21);}})[_0x3930('0x2d')](function(_0x309d15){if(_0x309d15){_0x5cf683=_0x309d15['length'];if(!_0x18d0ce[_0x3930('0x34')]['hasOwnProperty'](_0x3930('0x52'))){_0x315f21[_0x3930('0x26')]=qs[_0x3930('0x26')](_0x18d0ce[_0x3930('0x34')][_0x3930('0x26')]);_0x315f21[_0x3930('0x25')]=qs['offset'](_0x18d0ce[_0x3930('0x34')][_0x3930('0x25')]);}return _0x3e3881['getConfigurations'](_0x315f21);}})[_0x3930('0x2d')](function(_0x2b5bad){if(_0x2b5bad){return _0x2b5bad?{'count':_0x5cf683,'rows':_0x2b5bad}:null;}})[_0x3930('0x2d')](respondWithResult(_0x44dfd1,null))['catch'](handleError(_0x44dfd1,null));};exports['addConfiguration']=function(_0x3715d3,_0x51920a,_0x20f91f){if(_0x3715d3['body']['id']){delete _0x3715d3[_0x3930('0x4d')]['id'];}return db[_0x3930('0x32')][_0x3930('0x53')]({'where':{'id':_0x3715d3[_0x3930('0x47')]['id']}})[_0x3930('0x2d')](handleEntityNotFound(_0x51920a,null))[_0x3930('0x2d')](function(_0x31a2c6){if(_0x31a2c6){_0x3715d3['body']['AccountId']=_0x31a2c6['id'];_0x3715d3[_0x3930('0x4d')][_0x3930('0x54')]=integrations[_0x3930('0x55')](_0x3715d3[_0x3930('0x4d')][_0x3930('0x56')],_0x3715d3[_0x3930('0x4d')][_0x3930('0x3d')]);_0x3715d3[_0x3930('0x4d')][_0x3930('0x57')]=integrations[_0x3930('0x58')](_0x3715d3['body'][_0x3930('0x56')],_0x3715d3[_0x3930('0x4d')][_0x3930('0x3d')]);return db['SugarcrmConfiguration'][_0x3930('0x4c')](_0x3715d3['body'],{'include':[{'model':db[_0x3930('0x59')],'as':'Subjects'},{'model':db[_0x3930('0x59')],'as':'Descriptions'}]});}return null;})[_0x3930('0x2d')](respondWithResult(_0x51920a,null))['catch'](handleError(_0x51920a,null));};exports[_0x3930('0x5a')]=function(_0x5c2daa,_0x5658c6,_0x582331){var _0x275d37='';var _0x435238=['id','name',_0x3930('0x5b'),_0x3930('0x5c'),_0x3930('0x5d'),_0x3930('0x5e'),_0x3930('0x5f'),_0x3930('0x60'),_0x3930('0x61'),_0x3930('0x62'),_0x3930('0x63'),'direction'];return db[_0x3930('0x32')][_0x3930('0x53')]({'where':{'id':_0x5c2daa[_0x3930('0x47')]['id']},'attributes':['id',_0x3930('0x64'),_0x3930('0x65'),_0x3930('0x66')]})[_0x3930('0x2d')](handleEntityNotFound(_0x5658c6,null))[_0x3930('0x2d')](function(_0xa63948){if(_0xa63948){_0x275d37=_0xa63948[_0x3930('0x66')];var _0x37a1bf=_0x275d37[_0x3930('0x67')](-0x1);if(_0x37a1bf==='/'){_0x275d37=_0x275d37['substring'](0x0,_0x275d37[_0x3930('0x68')](_0x37a1bf));}return rp({'method':_0x3930('0x69'),'uri':util['format']('%s%s',_0x275d37,_0x3930('0x6a')),'json':!![],'form':{'method':'login','input_type':_0x3930('0x6b'),'response_type':'JSON','rest_data':JSON[_0x3930('0x1b')]({'user_auth':{'user_name':_0xa63948[_0x3930('0x64')],'password':_0xa63948[_0x3930('0x65')],'encryption':_0x3930('0x6c')},'application':_0x3930('0x6d')})}});}})['then'](function(_0x3353f2){if(_0x3353f2&&_0x3353f2[_0x3930('0x2f')]!==_0x3930('0x6e')&&_0x3353f2[_0x3930('0x2f')]!==_0x3930('0x6f')){return rp({'method':'POST','uri':util[_0x3930('0x70')](_0x3930('0x71'),_0x275d37,_0x3930('0x6a')),'json':!![],'form':{'method':_0x3930('0x72'),'input_type':_0x3930('0x6b'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3353f2['id'],'module_name':'Calls'})}})['then'](function(_0x18cbe1){if(_0x18cbe1){var _0xc88811=_[_0x3930('0x73')](_0x18cbe1[_0x3930('0x74')]);_['remove'](_0xc88811,function(_0x3b8b94){return _0x435238[_0x3930('0x75')](_0x3b8b94[_0x3930('0x2f')]);});return{'count':_0xc88811[_0x3930('0x37')],'rows':_[_0x3930('0x3c')](_0xc88811,function(_0x29a1c7){return{'id':_0x29a1c7['name'],'name':_0x29a1c7[_0x3930('0x76')],'custom':_['endsWith'](_0x29a1c7[_0x3930('0x2f')],'_c')?!![]:![],'options':_0x29a1c7['options']?_[_0x3930('0x3c')](_[_0x3930('0x73')](_0x29a1c7[_0x3930('0x41')]),function(_0xae52a){return{'name':_0xae52a[_0x3930('0x77')],'value':_0xae52a[_0x3930('0x2f')]};}):[]};})};}})['then'](respondWithResult(_0x5658c6,null))['catch'](function(_0x151e1d){var _0x1350e3=_0x5c2daa[_0x3930('0x34')]['test']?0x1f4:_0x151e1d['statusCode']||0x1f4;logger[_0x3930('0x1d')](_0x3930('0x78'),_0x3930('0x5a'),_0x1350e3,JSON[_0x3930('0x1b')](_0x151e1d));delete _0x151e1d[_0x3930('0x2f')];if(_0x1350e3===0x191){_0x1350e3=0x190;}_0x5658c6[_0x3930('0x23')](_0x1350e3)[_0x3930('0x30')](_0x5c2daa['query'][_0x3930('0x14')]?{'message':'Wrong\x20credentials','statusCode':_0x151e1d[_0x3930('0x79')]}:_0x151e1d);});}else{var _0x4eb9c6=0x1f4;_0x5658c6[_0x3930('0x23')](_0x4eb9c6)[_0x3930('0x30')]({'message':_0x3930('0x7a'),'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 cfc4171..13004e6 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 _0x3c1d=['request-promise','path','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x5785a7,_0x4fdbd4){var _0x4ace64=function(_0x432978){while(--_0x432978){_0x5785a7['push'](_0x5785a7['shift']());}};_0x4ace64(++_0x4fdbd4);}(_0x3c1d,0x6b));var _0xd3c1=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3c1d[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xd3c1('0x0'));var util=require(_0xd3c1('0x1'));var logger=require(_0xd3c1('0x2'))(_0xd3c1('0x3'));var moment=require('moment');var BPromise=require(_0xd3c1('0x4'));var rp=require(_0xd3c1('0x5'));var fs=require('fs');var path=require(_0xd3c1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x29c072,_0x33b036){return _0x29c072[_0xd3c1('0x7')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aba=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','util'];(function(_0x279742,_0x3d5924){var _0x17aaac=function(_0x2b2aeb){while(--_0x2b2aeb){_0x279742['push'](_0x279742['shift']());}};_0x17aaac(++_0x3d5924);}(_0x6aba,0x83));var _0xa6ab=function(_0x1f9bef,_0x4b2ff3){_0x1f9bef=_0x1f9bef-0x0;var _0x2d2c4b=_0x6aba[_0x1f9bef];return _0x2d2c4b;};'use strict';var _=require('lodash');var util=require(_0xa6ab('0x0'));var logger=require(_0xa6ab('0x1'))(_0xa6ab('0x2'));var moment=require(_0xa6ab('0x3'));var BPromise=require('bluebird');var rp=require(_0xa6ab('0x4'));var fs=require('fs');var path=require(_0xa6ab('0x5'));var rimraf=require(_0xa6ab('0x6'));var config=require(_0xa6ab('0x7'));var attributes=require(_0xa6ab('0x8'));var integrations=require(_0xa6ab('0x9'));module[_0xa6ab('0xa')]=function(_0xc328d4,_0x26c264){return _0xc328d4[_0xa6ab('0xb')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 421f9aa..c791714 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 _0x6ad1=['limit','include','map','model','attributes','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','SugarcrmAccount','findAll','options','raw','where'];(function(_0x57505f,_0x3bcbcf){var _0x2b2920=function(_0x353f01){while(--_0x353f01){_0x57505f['push'](_0x57505f['shift']());}};_0x2b2920(++_0x3bcbcf);}(_0x6ad1,0x8c));var _0x16ad=function(_0x4e0553,_0x1cf2bf){_0x4e0553=_0x4e0553-0x0;var _0x2effde=_0x6ad1[_0x4e0553];return _0x2effde;};'use strict';var _=require(_0x16ad('0x0'));var util=require(_0x16ad('0x1'));var moment=require(_0x16ad('0x2'));var BPromise=require('bluebird');var rs=require(_0x16ad('0x3'));var fs=require('fs');var Redis=require(_0x16ad('0x4'));var db=require(_0x16ad('0x5'))['db'];var utils=require(_0x16ad('0x6'));var logger=require(_0x16ad('0x7'))('rpc');var config=require(_0x16ad('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455974,_0x2da06e,_0x442748){return new BPromise(function(_0x1b25c3,_0x287752){return client['request'](_0x455974,_0x442748)[_0x16ad('0x9')](function(_0x414b19){logger[_0x16ad('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x2da06e,_0x16ad('0xb'));logger[_0x16ad('0xc')](_0x16ad('0xd'),_0x2da06e,_0x16ad('0xb'),JSON[_0x16ad('0xe')](_0x414b19));if(_0x414b19[_0x16ad('0xf')]){if(_0x414b19['error']['code']===0x1f4){logger[_0x16ad('0xf')](_0x16ad('0x10'),_0x2da06e,_0x414b19[_0x16ad('0xf')][_0x16ad('0x11')]);return _0x287752(_0x414b19[_0x16ad('0xf')][_0x16ad('0x11')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2da06e,_0x414b19['error']['message']);return _0x1b25c3(_0x414b19[_0x16ad('0xf')][_0x16ad('0x11')]);}else{logger[_0x16ad('0xa')](_0x16ad('0x10'),_0x2da06e,_0x16ad('0xb'));_0x1b25c3(_0x414b19[_0x16ad('0x12')][_0x16ad('0x11')]);}})[_0x16ad('0x13')](function(_0x1c81e3){logger[_0x16ad('0xf')](_0x16ad('0x10'),_0x2da06e,_0x1c81e3);_0x287752(_0x1c81e3);});});}exports['GetSugarcrmAccount']=function(_0x5cd8cc){var _0x8425ce=this;return new Promise(function(_0x36ea10,_0x493ab8){return db[_0x16ad('0x14')][_0x16ad('0x15')]({'raw':_0x5cd8cc[_0x16ad('0x16')]?_0x5cd8cc[_0x16ad('0x16')][_0x16ad('0x17')]===undefined?!![]:![]:!![],'where':_0x5cd8cc[_0x16ad('0x16')]?_0x5cd8cc[_0x16ad('0x16')][_0x16ad('0x18')]||null:null,'attributes':_0x5cd8cc[_0x16ad('0x16')]?_0x5cd8cc[_0x16ad('0x16')]['attributes']||null:null,'limit':_0x5cd8cc[_0x16ad('0x16')]?_0x5cd8cc[_0x16ad('0x16')][_0x16ad('0x19')]||null:null,'include':_0x5cd8cc['options']?_0x5cd8cc[_0x16ad('0x16')][_0x16ad('0x1a')]?_[_0x16ad('0x1b')](_0x5cd8cc[_0x16ad('0x16')][_0x16ad('0x1a')],function(_0x1e8909){return{'model':db[_0x1e8909[_0x16ad('0x1c')]],'as':_0x1e8909['as'],'attributes':_0x1e8909[_0x16ad('0x1d')],'include':_0x1e8909[_0x16ad('0x1a')]?_[_0x16ad('0x1b')](_0x1e8909[_0x16ad('0x1a')],function(_0x154578){return{'model':db[_0x154578[_0x16ad('0x1c')]],'as':_0x154578['as'],'attributes':_0x154578[_0x16ad('0x1d')],'include':_0x154578[_0x16ad('0x1a')]?_[_0x16ad('0x1b')](_0x154578[_0x16ad('0x1a')],function(_0x38e1c7){return{'model':db[_0x38e1c7[_0x16ad('0x1c')]],'as':_0x38e1c7['as'],'attributes':_0x38e1c7[_0x16ad('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x16ad('0x9')](function(_0x24637a){logger[_0x16ad('0xa')]('GetSugarcrmAccount',_0x5cd8cc);logger[_0x16ad('0xc')](_0x16ad('0x1e'),_0x5cd8cc,JSON[_0x16ad('0xe')](_0x24637a));_0x36ea10(_0x24637a);})[_0x16ad('0x13')](function(_0x49e9cd){logger[_0x16ad('0xf')](_0x16ad('0x1e'),_0x49e9cd[_0x16ad('0x11')],_0x5cd8cc);_0x493ab8(_0x8425ce[_0x16ad('0xf')](0x1f4,_0x49e9cd[_0x16ad('0x11')]));});});};exports[_0x16ad('0x1f')]=function(_0x944518){var _0x12f2ae=this;return new Promise(function(_0x787367,_0x166249){return db[_0x16ad('0x14')][_0x16ad('0x20')]({'raw':_0x944518[_0x16ad('0x16')]?_0x944518[_0x16ad('0x16')][_0x16ad('0x17')]===undefined?!![]:![]:!![],'where':_0x944518['options']?_0x944518[_0x16ad('0x16')][_0x16ad('0x18')]||null:null,'attributes':_0x944518[_0x16ad('0x16')]?_0x944518['options']['attributes']||null:null,'include':_0x944518[_0x16ad('0x16')]?_0x944518[_0x16ad('0x16')][_0x16ad('0x1a')]?_['map'](_0x944518[_0x16ad('0x16')]['include'],function(_0x2c45c0){return{'model':db[_0x2c45c0[_0x16ad('0x1c')]],'as':_0x2c45c0['as'],'attributes':_0x2c45c0[_0x16ad('0x1d')],'include':_0x2c45c0[_0x16ad('0x1a')]?_[_0x16ad('0x1b')](_0x2c45c0['include'],function(_0x5cf051){return{'model':db[_0x5cf051[_0x16ad('0x1c')]],'as':_0x5cf051['as'],'attributes':_0x5cf051['attributes'],'include':_0x5cf051[_0x16ad('0x1a')]?_[_0x16ad('0x1b')](_0x5cf051['include'],function(_0x2f8e28){return{'model':db[_0x2f8e28[_0x16ad('0x1c')]],'as':_0x2f8e28['as'],'attributes':_0x2f8e28[_0x16ad('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x16ad('0x9')](function(_0x18f19f){logger[_0x16ad('0xa')](_0x16ad('0x1f'),_0x944518);logger[_0x16ad('0xc')](_0x16ad('0x1f'),_0x944518,JSON[_0x16ad('0xe')](_0x18f19f));_0x787367(_0x18f19f);})[_0x16ad('0x13')](function(_0x475519){logger['error'](_0x16ad('0x1f'),_0x475519[_0x16ad('0x11')],_0x944518);_0x166249(_0x12f2ae['error'](0x1f4,_0x475519['message']));});});}; \ No newline at end of file +var _0x3fa6=['GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSugarcrmAccount','find','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x432634,_0x2c04ac){var _0x54927e=function(_0x5d7185){while(--_0x5d7185){_0x432634['push'](_0x432634['shift']());}};_0x54927e(++_0x2c04ac);}(_0x3fa6,0x91));var _0x63fa=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x3fa6[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x63fa('0x0'));var rs=require(_0x63fa('0x1'));var fs=require('fs');var Redis=require(_0x63fa('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x63fa('0x3'));var logger=require('../../config/logger')(_0x63fa('0x4'));var config=require('../../config/environment');var jayson=require(_0x63fa('0x5'));var client=jayson[_0x63fa('0x6')][_0x63fa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c1126,_0x1b30e8,_0x5a588d){return new BPromise(function(_0x5345d4,_0x248a8f){return client[_0x63fa('0x8')](_0x4c1126,_0x5a588d)[_0x63fa('0x9')](function(_0x52bb94){logger[_0x63fa('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x1b30e8,_0x63fa('0xb'));logger[_0x63fa('0xc')](_0x63fa('0xd'),_0x1b30e8,_0x63fa('0xb'),JSON[_0x63fa('0xe')](_0x52bb94));if(_0x52bb94[_0x63fa('0xf')]){if(_0x52bb94['error']['code']===0x1f4){logger[_0x63fa('0xf')](_0x63fa('0x10'),_0x1b30e8,_0x52bb94[_0x63fa('0xf')][_0x63fa('0x11')]);return _0x248a8f(_0x52bb94['error'][_0x63fa('0x11')]);}logger[_0x63fa('0xf')](_0x63fa('0x10'),_0x1b30e8,_0x52bb94[_0x63fa('0xf')]['message']);return _0x5345d4(_0x52bb94['error']['message']);}else{logger[_0x63fa('0xa')](_0x63fa('0x10'),_0x1b30e8,_0x63fa('0xb'));_0x5345d4(_0x52bb94[_0x63fa('0x12')][_0x63fa('0x11')]);}})[_0x63fa('0x13')](function(_0x38cc70){logger[_0x63fa('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x1b30e8,_0x38cc70);_0x248a8f(_0x38cc70);});});}exports[_0x63fa('0x14')]=function(_0x5de0d6){var _0x9a7d27=this;return new Promise(function(_0x39c9e9,_0x301fc3){return db[_0x63fa('0x15')][_0x63fa('0x16')]({'raw':_0x5de0d6[_0x63fa('0x17')]?_0x5de0d6[_0x63fa('0x17')][_0x63fa('0x18')]===undefined?!![]:![]:!![],'where':_0x5de0d6[_0x63fa('0x17')]?_0x5de0d6[_0x63fa('0x17')][_0x63fa('0x19')]||null:null,'attributes':_0x5de0d6['options']?_0x5de0d6['options'][_0x63fa('0x1a')]||null:null,'limit':_0x5de0d6[_0x63fa('0x17')]?_0x5de0d6[_0x63fa('0x17')][_0x63fa('0x1b')]||null:null,'include':_0x5de0d6[_0x63fa('0x17')]?_0x5de0d6[_0x63fa('0x17')][_0x63fa('0x1c')]?_['map'](_0x5de0d6['options'][_0x63fa('0x1c')],function(_0x160dab){return{'model':db[_0x160dab[_0x63fa('0x1d')]],'as':_0x160dab['as'],'attributes':_0x160dab[_0x63fa('0x1a')],'include':_0x160dab[_0x63fa('0x1c')]?_[_0x63fa('0x1e')](_0x160dab[_0x63fa('0x1c')],function(_0x5b2dcc){return{'model':db[_0x5b2dcc[_0x63fa('0x1d')]],'as':_0x5b2dcc['as'],'attributes':_0x5b2dcc[_0x63fa('0x1a')],'include':_0x5b2dcc[_0x63fa('0x1c')]?_['map'](_0x5b2dcc[_0x63fa('0x1c')],function(_0x498165){return{'model':db[_0x498165[_0x63fa('0x1d')]],'as':_0x498165['as'],'attributes':_0x498165[_0x63fa('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27c9eb){logger[_0x63fa('0xa')]('GetSugarcrmAccount',_0x5de0d6);logger[_0x63fa('0xc')](_0x63fa('0x14'),_0x5de0d6,JSON[_0x63fa('0xe')](_0x27c9eb));_0x39c9e9(_0x27c9eb);})[_0x63fa('0x13')](function(_0x2be9e6){logger['error']('GetSugarcrmAccount',_0x2be9e6[_0x63fa('0x11')],_0x5de0d6);_0x301fc3(_0x9a7d27[_0x63fa('0xf')](0x1f4,_0x2be9e6[_0x63fa('0x11')]));});});};exports[_0x63fa('0x1f')]=function(_0x165297){var _0x18406b=this;return new Promise(function(_0x87239f,_0x13cf92){return db[_0x63fa('0x15')][_0x63fa('0x20')]({'raw':_0x165297[_0x63fa('0x17')]?_0x165297[_0x63fa('0x17')][_0x63fa('0x18')]===undefined?!![]:![]:!![],'where':_0x165297[_0x63fa('0x17')]?_0x165297[_0x63fa('0x17')][_0x63fa('0x19')]||null:null,'attributes':_0x165297[_0x63fa('0x17')]?_0x165297[_0x63fa('0x17')][_0x63fa('0x1a')]||null:null,'include':_0x165297['options']?_0x165297[_0x63fa('0x17')]['include']?_[_0x63fa('0x1e')](_0x165297['options']['include'],function(_0x5a497a){return{'model':db[_0x5a497a['model']],'as':_0x5a497a['as'],'attributes':_0x5a497a[_0x63fa('0x1a')],'include':_0x5a497a[_0x63fa('0x1c')]?_[_0x63fa('0x1e')](_0x5a497a['include'],function(_0x395d61){return{'model':db[_0x395d61[_0x63fa('0x1d')]],'as':_0x395d61['as'],'attributes':_0x395d61[_0x63fa('0x1a')],'include':_0x395d61[_0x63fa('0x1c')]?_[_0x63fa('0x1e')](_0x395d61[_0x63fa('0x1c')],function(_0x1a5c76){return{'model':db[_0x1a5c76[_0x63fa('0x1d')]],'as':_0x1a5c76['as'],'attributes':_0x1a5c76[_0x63fa('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52c55c){logger[_0x63fa('0xa')](_0x63fa('0x1f'),_0x165297);logger[_0x63fa('0xc')](_0x63fa('0x1f'),_0x165297,JSON[_0x63fa('0xe')](_0x52c55c));_0x87239f(_0x52c55c);})[_0x63fa('0x13')](function(_0x4d820b){logger[_0x63fa('0xf')](_0x63fa('0x1f'),_0x4d820b[_0x63fa('0x11')],_0x165297);_0x13cf92(_0x18406b['error'](0x1f4,_0x4d820b[_0x63fa('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index f9f66ee..40bd96a 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 _0xc2a4=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc2a4,0x16e));var _0x4c2a=function(_0x311ba6,_0x3de95b){_0x311ba6=_0x311ba6-0x0;var _0x227630=_0xc2a4[_0x311ba6];return _0x227630;};'use strict';var multer=require(_0x4c2a('0x0'));var util=require(_0x4c2a('0x1'));var path=require(_0x4c2a('0x2'));var timeout=require(_0x4c2a('0x3'));var express=require(_0x4c2a('0x4'));var router=express['Router']();var auth=require(_0x4c2a('0x5'));var interaction=require(_0x4c2a('0x6'));var config=require(_0x4c2a('0x7'));var controller=require(_0x4c2a('0x8'));router[_0x4c2a('0x9')]('/',auth[_0x4c2a('0xa')](),controller[_0x4c2a('0xb')]);router[_0x4c2a('0x9')](_0x4c2a('0xc'),auth[_0x4c2a('0xa')](),controller['show']);router['get']('/:id/fields',auth[_0x4c2a('0xa')](),controller['getFields']);router[_0x4c2a('0x9')]('/:id/subjects',auth[_0x4c2a('0xa')](),controller[_0x4c2a('0xd')]);router[_0x4c2a('0x9')](_0x4c2a('0xe'),auth[_0x4c2a('0xa')](),controller['getDescriptions']);router[_0x4c2a('0xf')]('/',auth[_0x4c2a('0xa')](),controller[_0x4c2a('0x10')]);router[_0x4c2a('0x11')](_0x4c2a('0xc'),auth[_0x4c2a('0xa')](),controller[_0x4c2a('0x12')]);router[_0x4c2a('0x13')]('/:id',auth[_0x4c2a('0xa')](),controller[_0x4c2a('0x14')]);module[_0x4c2a('0x15')]=router; \ No newline at end of file +var _0x8db7=['getDescriptions','post','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','isAuthenticated','index','get','show','getFields','getSubjects','/:id/descriptions'];(function(_0xae9491,_0x54a970){var _0x2f678b=function(_0x55ef9b){while(--_0x55ef9b){_0xae9491['push'](_0xae9491['shift']());}};_0x2f678b(++_0x54a970);}(_0x8db7,0x193));var _0x78db=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8db7[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x78db('0x0'));var path=require('path');var timeout=require(_0x78db('0x1'));var express=require(_0x78db('0x2'));var router=express[_0x78db('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x78db('0x4')](),controller[_0x78db('0x5')]);router[_0x78db('0x6')]('/:id',auth[_0x78db('0x4')](),controller[_0x78db('0x7')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x78db('0x8')]);router['get']('/:id/subjects',auth[_0x78db('0x4')](),controller[_0x78db('0x9')]);router[_0x78db('0x6')](_0x78db('0xa'),auth[_0x78db('0x4')](),controller[_0x78db('0xb')]);router[_0x78db('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x78db('0xd')](_0x78db('0xe'),auth[_0x78db('0x4')](),controller[_0x78db('0xf')]);router['delete'](_0x78db('0xe'),auth[_0x78db('0x4')](),controller[_0x78db('0x10')]);module[_0x78db('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 1e6d462..7f53929 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 _0x7460=['STRING'];(function(_0x25fd37,_0x1cecd6){var _0x5237e6=function(_0x3a8f80){while(--_0x3a8f80){_0x25fd37['push'](_0x25fd37['shift']());}};_0x5237e6(++_0x1cecd6);}(_0x7460,0x86));var _0x0746=function(_0xb85af0,_0x2d529d){_0xb85af0=_0xb85af0-0x0;var _0x3e3cd6=_0x7460[_0xb85af0];return _0x3e3cd6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0746('0x0')]},'description':{'type':Sequelize[_0x0746('0x0')]}}; \ No newline at end of file +var _0x91d4=['exports','STRING','sequelize'];(function(_0x451cc1,_0xba13e2){var _0x11745b=function(_0x50ce99){while(--_0x50ce99){_0x451cc1['push'](_0x451cc1['shift']());}};_0x11745b(++_0xba13e2);}(_0x91d4,0x18b));var _0x491d=function(_0x51543d,_0x204989){_0x51543d=_0x51543d-0x0;var _0x4a62cb=_0x91d4[_0x51543d];return _0x4a62cb;};'use strict';var Sequelize=require(_0x491d('0x0'));module[_0x491d('0x1')]={'name':{'type':Sequelize[_0x491d('0x2')]},'description':{'type':Sequelize[_0x491d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f490b3d..3153306 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 _0x43df=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','Sequelize','ValidationError','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','SugarcrmConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','rows','params','find','catch','create','body','findOne','SugarcrmField','pick','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv'];(function(_0x23eef6,_0x476f63){var _0x45b0dd=function(_0x578260){while(--_0x578260){_0x23eef6['push'](_0x23eef6['shift']());}};_0x45b0dd(++_0x476f63);}(_0x43df,0x1bd));var _0xf43d=function(_0x57fe36,_0x4f1db6){_0x57fe36=_0x57fe36-0x0;var _0x270f05=_0x43df[_0x57fe36];return _0x270f05;};'use strict';var pdf=require(_0xf43d('0x0'));var emlformat=require(_0xf43d('0x1'));var rimraf=require(_0xf43d('0x2'));var zipdir=require(_0xf43d('0x3'));var jsonpatch=require(_0xf43d('0x4'));var rp=require(_0xf43d('0x5'));var moment=require(_0xf43d('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf43d('0x7'));var sox=require(_0xf43d('0x8'));var csv=require(_0xf43d('0x9'));var ejs=require(_0xf43d('0xa'));var fs=require('fs');var _=require(_0xf43d('0xb'));var squel=require(_0xf43d('0xc'));var crypto=require(_0xf43d('0xd'));var jsforce=require(_0xf43d('0xe'));var deskjs=require(_0xf43d('0xf'));var toCsv=require(_0xf43d('0x9'));var querystring=require(_0xf43d('0x10'));var Papa=require('papaparse');var Redis=require(_0xf43d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf43d('0x12'));var hardwareService=require(_0xf43d('0x13'));var logger=require(_0xf43d('0x14'))(_0xf43d('0x15'));var utils=require(_0xf43d('0x16'));var config=require(_0xf43d('0x17'));var db=require(_0xf43d('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf43d('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x181568,_0x1c9b66,_0xcc8462){if(_0xcc8462){var _0x2da61d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2da61d['test'](_0x1c9b66)){return _0x181568;}else{throw new db[(_0xf43d('0x1a'))][(_0xf43d('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x181568;}}function respondWithRpcPromise(_0x597dec,_0x2a4f97,_0x58b871,_0x39d56a){return new BPromise(function(_0x265304,_0x5aa9fb){var _0x2f3d05=_0x39d56a||client;return _0x2f3d05[_0xf43d('0x1c')](_0x597dec,_0x58b871)[_0xf43d('0x1d')](function(_0x29c0a5){logger[_0xf43d('0x1e')](_0xf43d('0x1f'),_0x2a4f97,_0xf43d('0x20'));logger[_0xf43d('0x21')](_0xf43d('0x22'),_0x2a4f97,_0xf43d('0x20'),JSON['stringify'](_0x29c0a5));if(_0x29c0a5[_0xf43d('0x23')]){if(_0x29c0a5['error']['code']===0x1f4){logger[_0xf43d('0x23')](_0xf43d('0x1f'),_0x2a4f97,_0x29c0a5[_0xf43d('0x23')][_0xf43d('0x24')]);return _0x5aa9fb(_0x29c0a5[_0xf43d('0x23')]['message']);}logger[_0xf43d('0x23')](_0xf43d('0x1f'),_0x2a4f97,_0x29c0a5['error']['message']);return _0x265304(_0x29c0a5[_0xf43d('0x23')][_0xf43d('0x24')]);}else{logger[_0xf43d('0x1e')](_0xf43d('0x1f'),_0x2a4f97,_0xf43d('0x20'));_0x265304(_0x29c0a5['result']['message']);}})['catch'](function(_0xf78408){logger[_0xf43d('0x23')](_0xf43d('0x1f'),_0x2a4f97,_0xf78408);_0x5aa9fb(_0xf78408);});});}function respondWithStatusCode(_0x2217f3,_0x4c2a38){_0x4c2a38=_0x4c2a38||0xcc;return function(_0x348582){if(_0x348582){return _0x2217f3[_0xf43d('0x25')](_0x4c2a38);}return _0x2217f3[_0xf43d('0x26')](_0x4c2a38)[_0xf43d('0x27')]();};}function respondWithResult(_0x44084d,_0x4649e8){_0x4649e8=_0x4649e8||0xc8;return function(_0x3f3a1e){if(_0x3f3a1e){return _0x44084d[_0xf43d('0x26')](_0x4649e8)[_0xf43d('0x28')](_0x3f3a1e);}};}function respondWithFilteredResult(_0x1bc086,_0x1f4c65){return function(_0x94c426){if(_0x94c426){var _0x449df6=_0x94c426['count'],_0x10cf18=_0x1f4c65[_0xf43d('0x29')],_0x400420=_0x1f4c65[_0xf43d('0x29')]+_0x1f4c65[_0xf43d('0x2a')],_0x106858;if(_0x400420>=_0x449df6){_0x400420=_0x449df6;_0x106858=0xc8;}else{_0x106858=0xce;}_0x1bc086[_0xf43d('0x26')](_0x106858);return _0x1bc086[_0xf43d('0x2b')](_0xf43d('0x2c'),_0x10cf18+'-'+_0x400420+'/'+_0x449df6)[_0xf43d('0x28')](_0x94c426);}return null;};}function patchUpdates(_0x572b5e){return function(_0x23c691){try{jsonpatch[_0xf43d('0x2d')](_0x23c691,_0x572b5e,!![]);}catch(_0x304583){return BPromise[_0xf43d('0x2e')](_0x304583);}return _0x23c691[_0xf43d('0x2f')]();};}function saveUpdates(_0x4b976f,_0x59eb1f){return function(_0x116d84){if(_0x116d84){return _0x116d84[_0xf43d('0x30')](_0x4b976f)[_0xf43d('0x1d')](function(_0x5f4d76){return _0x5f4d76;});}return null;};}function removeEntity(_0x45411d,_0x62fada){return function(_0x2f75b0){if(_0x2f75b0){return _0x2f75b0[_0xf43d('0x31')]()[_0xf43d('0x1d')](function(){_0x45411d['status'](0xcc)[_0xf43d('0x27')]();});}};}function handleEntityNotFound(_0x183267,_0x3c9235){return function(_0x1854e2){if(!_0x1854e2){_0x183267[_0xf43d('0x25')](0x194);}return _0x1854e2;};}function handleError(_0x14e98b,_0x2b834d){_0x2b834d=_0x2b834d||0x1f4;return function(_0x1a323b){logger['error'](_0x1a323b[_0xf43d('0x32')]);if(_0x1a323b['name']){delete _0x1a323b[_0xf43d('0x33')];}_0x14e98b[_0xf43d('0x26')](_0x2b834d)['send'](_0x1a323b);};}exports[_0xf43d('0x34')]=function(_0x2a8eef,_0x22410c){var _0x1117c0={},_0x3f1be6={},_0x51ac5e={'count':0x0,'rows':[]};var _0x320fd9=db[_0xf43d('0x35')][_0xf43d('0x36')];_0x3f1be6[_0xf43d('0x37')]=_[_0xf43d('0x38')](_0x320fd9);_0x3f1be6['query']=_[_0xf43d('0x38')](_0x2a8eef[_0xf43d('0x39')]);_0x3f1be6[_0xf43d('0x3a')]=_[_0xf43d('0x3b')](_0x3f1be6[_0xf43d('0x37')],_0x3f1be6[_0xf43d('0x39')]);_0x1117c0[_0xf43d('0x3c')]=_['intersection'](_0x3f1be6[_0xf43d('0x37')],qs[_0xf43d('0x3d')](_0x2a8eef[_0xf43d('0x39')][_0xf43d('0x3d')]));_0x1117c0[_0xf43d('0x3c')]=_0x1117c0[_0xf43d('0x3c')][_0xf43d('0x3e')]?_0x1117c0['attributes']:_0x3f1be6[_0xf43d('0x37')];if(!_0x2a8eef[_0xf43d('0x39')][_0xf43d('0x3f')](_0xf43d('0x40'))){_0x1117c0[_0xf43d('0x2a')]=qs['limit'](_0x2a8eef[_0xf43d('0x39')][_0xf43d('0x2a')]);_0x1117c0[_0xf43d('0x29')]=qs['offset'](_0x2a8eef['query'][_0xf43d('0x29')]);}_0x1117c0[_0xf43d('0x41')]=qs[_0xf43d('0x42')](_0x2a8eef[_0xf43d('0x39')][_0xf43d('0x42')]);_0x1117c0[_0xf43d('0x43')]=qs[_0xf43d('0x3a')](_['pick'](_0x2a8eef[_0xf43d('0x39')],_0x3f1be6[_0xf43d('0x3a')]));if(_0x2a8eef[_0xf43d('0x39')][_0xf43d('0x44')]){_0x1117c0[_0xf43d('0x43')]=_[_0xf43d('0x45')](_0x1117c0['where'],{'$or':_[_0xf43d('0x46')](_0x320fd9,function(_0x2229f3){if(_0x2229f3[_0xf43d('0x47')][_0xf43d('0x48')]!==_0xf43d('0x49')){var _0x38a47f={};_0x38a47f[_0x2229f3[_0xf43d('0x4a')]]={'$like':'%'+_0x2a8eef[_0xf43d('0x39')][_0xf43d('0x44')]+'%'};return _0x38a47f;}})});}_0x1117c0=_[_0xf43d('0x45')]({},_0x1117c0,_0x2a8eef[_0xf43d('0x4b')]);var _0x5b68e1={'where':_0x1117c0[_0xf43d('0x43')]};return db['SugarcrmConfiguration'][_0xf43d('0x4c')](_0x5b68e1)[_0xf43d('0x1d')](function(_0x42dd47){_0x51ac5e['count']=_0x42dd47;if(_0x2a8eef[_0xf43d('0x39')][_0xf43d('0x4d')]){_0x1117c0[_0xf43d('0x4e')]=[{'all':!![]}];}return db[_0xf43d('0x35')]['findAll'](_0x1117c0);})['then'](function(_0x463f8d){_0x51ac5e[_0xf43d('0x4f')]=_0x463f8d;return _0x51ac5e;})[_0xf43d('0x1d')](respondWithFilteredResult(_0x22410c,_0x1117c0))['catch'](handleError(_0x22410c,null));};exports['show']=function(_0x52997d,_0x4746fc){var _0x32f300={'raw':![],'where':{'id':_0x52997d[_0xf43d('0x50')]['id']}},_0x220dda={};_0x220dda[_0xf43d('0x37')]=_[_0xf43d('0x38')](db[_0xf43d('0x35')][_0xf43d('0x36')]);_0x220dda['query']=_[_0xf43d('0x38')](_0x52997d['query']);_0x220dda[_0xf43d('0x3a')]=_['intersection'](_0x220dda['model'],_0x220dda['query']);_0x32f300[_0xf43d('0x3c')]=_[_0xf43d('0x3b')](_0x220dda[_0xf43d('0x37')],qs[_0xf43d('0x3d')](_0x52997d[_0xf43d('0x39')][_0xf43d('0x3d')]));_0x32f300['attributes']=_0x32f300[_0xf43d('0x3c')][_0xf43d('0x3e')]?_0x32f300['attributes']:_0x220dda['model'];if(_0x52997d[_0xf43d('0x39')]['includeAll']){_0x32f300['include']=[{'all':!![]}];}_0x32f300=_[_0xf43d('0x45')]({},_0x32f300,_0x52997d[_0xf43d('0x4b')]);return db[_0xf43d('0x35')][_0xf43d('0x51')](_0x32f300)[_0xf43d('0x1d')](handleEntityNotFound(_0x4746fc,null))[_0xf43d('0x1d')](respondWithResult(_0x4746fc,null))[_0xf43d('0x52')](handleError(_0x4746fc,null));};exports[_0xf43d('0x53')]=function(_0x48c0a7,_0x40c8b3){return db[_0xf43d('0x35')][_0xf43d('0x53')](_0x48c0a7[_0xf43d('0x54')],{})[_0xf43d('0x1d')](respondWithResult(_0x40c8b3,0xc9))[_0xf43d('0x52')](handleError(_0x40c8b3,null));};exports['update']=function(_0x478dda,_0x50e6cb){if(_0x478dda[_0xf43d('0x54')]['id']){delete _0x478dda['body']['id'];}return db[_0xf43d('0x35')][_0xf43d('0x51')]({'where':{'id':_0x478dda['params']['id']}})[_0xf43d('0x1d')](handleEntityNotFound(_0x50e6cb,null))[_0xf43d('0x1d')](saveUpdates(_0x478dda[_0xf43d('0x54')],null))[_0xf43d('0x1d')](respondWithResult(_0x50e6cb,null))[_0xf43d('0x52')](handleError(_0x50e6cb,null));};exports[_0xf43d('0x31')]=function(_0x89e5ce,_0x17dc65){return db[_0xf43d('0x35')][_0xf43d('0x51')]({'where':{'id':_0x89e5ce[_0xf43d('0x50')]['id']}})[_0xf43d('0x1d')](handleEntityNotFound(_0x17dc65,null))[_0xf43d('0x1d')](removeEntity(_0x17dc65,null))[_0xf43d('0x52')](handleError(_0x17dc65,null));};exports['getFields']=function(_0x386cfc,_0x1e5fb1,_0x114eab){var _0x440ba8={};var _0x512b27={};var _0x330116;var _0x58ad04;return db[_0xf43d('0x35')][_0xf43d('0x55')]({'where':{'id':_0x386cfc[_0xf43d('0x50')]['id']}})[_0xf43d('0x1d')](handleEntityNotFound(_0x1e5fb1,null))[_0xf43d('0x1d')](function(_0x1cad13){if(_0x1cad13){_0x330116=_0x1cad13;_0x512b27[_0xf43d('0x37')]=_['keys'](db[_0xf43d('0x56')][_0xf43d('0x36')]);_0x512b27[_0xf43d('0x39')]=_[_0xf43d('0x38')](_0x386cfc[_0xf43d('0x39')]);_0x512b27[_0xf43d('0x3a')]=_[_0xf43d('0x3b')](_0x512b27[_0xf43d('0x37')],_0x512b27['query']);_0x440ba8[_0xf43d('0x3c')]=_[_0xf43d('0x3b')](_0x512b27[_0xf43d('0x37')],qs[_0xf43d('0x3d')](_0x386cfc[_0xf43d('0x39')][_0xf43d('0x3d')]));_0x440ba8[_0xf43d('0x3c')]=_0x440ba8['attributes'][_0xf43d('0x3e')]?_0x440ba8[_0xf43d('0x3c')]:_0x512b27['model'];_0x440ba8['order']=qs[_0xf43d('0x42')](_0x386cfc[_0xf43d('0x39')][_0xf43d('0x42')]);_0x440ba8[_0xf43d('0x43')]=qs[_0xf43d('0x3a')](_[_0xf43d('0x57')](_0x386cfc[_0xf43d('0x39')],_0x512b27[_0xf43d('0x3a')]));if(_0x386cfc['query']['filter']){_0x440ba8[_0xf43d('0x43')]=_[_0xf43d('0x45')](_0x440ba8[_0xf43d('0x43')],{'$or':_[_0xf43d('0x46')](_0x440ba8['attributes'],function(_0x296e85){var _0x27820b={};_0x27820b[_0x296e85]={'$like':'%'+_0x386cfc[_0xf43d('0x39')]['filter']+'%'};return _0x27820b;})});}_0x440ba8=_[_0xf43d('0x45')]({},_0x440ba8,_0x386cfc[_0xf43d('0x4b')]);return _0x330116[_0xf43d('0x58')](_0x440ba8);}})[_0xf43d('0x1d')](function(_0x3a1ce7){if(_0x3a1ce7){_0x58ad04=_0x3a1ce7[_0xf43d('0x3e')];if(!_0x386cfc[_0xf43d('0x39')][_0xf43d('0x3f')]('nolimit')){_0x440ba8['limit']=qs[_0xf43d('0x2a')](_0x386cfc[_0xf43d('0x39')][_0xf43d('0x2a')]);_0x440ba8[_0xf43d('0x29')]=qs['offset'](_0x386cfc['query'][_0xf43d('0x29')]);}return _0x330116[_0xf43d('0x58')](_0x440ba8);}})[_0xf43d('0x1d')](function(_0x27869d){if(_0x27869d){return _0x27869d?{'count':_0x58ad04,'rows':_0x27869d}:null;}})[_0xf43d('0x1d')](respondWithResult(_0x1e5fb1,null))[_0xf43d('0x52')](handleError(_0x1e5fb1,null));};exports[_0xf43d('0x59')]=function(_0x5ba5e3,_0x2e9d05,_0x1d6476){var _0x289908={};var _0x4a3ef5={};var _0x3306f5;var _0x1a3df7;return db[_0xf43d('0x35')]['findOne']({'where':{'id':_0x5ba5e3[_0xf43d('0x50')]['id']}})[_0xf43d('0x1d')](handleEntityNotFound(_0x2e9d05,null))[_0xf43d('0x1d')](function(_0x48e0d0){if(_0x48e0d0){_0x3306f5=_0x48e0d0;_0x4a3ef5[_0xf43d('0x37')]=_[_0xf43d('0x38')](db[_0xf43d('0x56')][_0xf43d('0x36')]);_0x4a3ef5[_0xf43d('0x39')]=_[_0xf43d('0x38')](_0x5ba5e3['query']);_0x4a3ef5['filters']=_['intersection'](_0x4a3ef5[_0xf43d('0x37')],_0x4a3ef5['query']);_0x289908['attributes']=_[_0xf43d('0x3b')](_0x4a3ef5[_0xf43d('0x37')],qs[_0xf43d('0x3d')](_0x5ba5e3[_0xf43d('0x39')][_0xf43d('0x3d')]));_0x289908[_0xf43d('0x3c')]=_0x289908['attributes']['length']?_0x289908[_0xf43d('0x3c')]:_0x4a3ef5[_0xf43d('0x37')];_0x289908[_0xf43d('0x41')]=qs[_0xf43d('0x42')](_0x5ba5e3[_0xf43d('0x39')][_0xf43d('0x42')]);_0x289908[_0xf43d('0x43')]=qs[_0xf43d('0x3a')](_[_0xf43d('0x57')](_0x5ba5e3[_0xf43d('0x39')],_0x4a3ef5[_0xf43d('0x3a')]));if(_0x5ba5e3[_0xf43d('0x39')]['filter']){_0x289908['where']=_[_0xf43d('0x45')](_0x289908[_0xf43d('0x43')],{'$or':_[_0xf43d('0x46')](_0x289908[_0xf43d('0x3c')],function(_0x2a7c92){var _0x12c28e={};_0x12c28e[_0x2a7c92]={'$like':'%'+_0x5ba5e3[_0xf43d('0x39')][_0xf43d('0x44')]+'%'};return _0x12c28e;})});}_0x289908=_[_0xf43d('0x45')]({},_0x289908,_0x5ba5e3[_0xf43d('0x4b')]);return _0x3306f5[_0xf43d('0x59')](_0x289908);}})[_0xf43d('0x1d')](function(_0x1df575){if(_0x1df575){_0x1a3df7=_0x1df575[_0xf43d('0x3e')];if(!_0x5ba5e3[_0xf43d('0x39')]['hasOwnProperty'](_0xf43d('0x40'))){_0x289908['limit']=qs['limit'](_0x5ba5e3['query'][_0xf43d('0x2a')]);_0x289908['offset']=qs[_0xf43d('0x29')](_0x5ba5e3[_0xf43d('0x39')]['offset']);}return _0x3306f5['getSubjects'](_0x289908);}})[_0xf43d('0x1d')](function(_0x3b18ef){if(_0x3b18ef){return _0x3b18ef?{'count':_0x1a3df7,'rows':_0x3b18ef}:null;}})['then'](respondWithResult(_0x2e9d05,null))[_0xf43d('0x52')](handleError(_0x2e9d05,null));};exports[_0xf43d('0x5a')]=function(_0x18b754,_0x9dd875,_0x53237b){var _0x145319={};var _0x27db24={};var _0x5e4ccf;var _0x574276;return db[_0xf43d('0x35')][_0xf43d('0x55')]({'where':{'id':_0x18b754[_0xf43d('0x50')]['id']}})[_0xf43d('0x1d')](handleEntityNotFound(_0x9dd875,null))[_0xf43d('0x1d')](function(_0x381306){if(_0x381306){_0x5e4ccf=_0x381306;_0x27db24[_0xf43d('0x37')]=_[_0xf43d('0x38')](db['SugarcrmField'][_0xf43d('0x36')]);_0x27db24[_0xf43d('0x39')]=_[_0xf43d('0x38')](_0x18b754['query']);_0x27db24['filters']=_['intersection'](_0x27db24[_0xf43d('0x37')],_0x27db24[_0xf43d('0x39')]);_0x145319[_0xf43d('0x3c')]=_[_0xf43d('0x3b')](_0x27db24[_0xf43d('0x37')],qs[_0xf43d('0x3d')](_0x18b754['query'][_0xf43d('0x3d')]));_0x145319[_0xf43d('0x3c')]=_0x145319[_0xf43d('0x3c')]['length']?_0x145319[_0xf43d('0x3c')]:_0x27db24[_0xf43d('0x37')];_0x145319[_0xf43d('0x41')]=qs[_0xf43d('0x42')](_0x18b754[_0xf43d('0x39')][_0xf43d('0x42')]);_0x145319[_0xf43d('0x43')]=qs[_0xf43d('0x3a')](_[_0xf43d('0x57')](_0x18b754[_0xf43d('0x39')],_0x27db24[_0xf43d('0x3a')]));if(_0x18b754[_0xf43d('0x39')]['filter']){_0x145319['where']=_[_0xf43d('0x45')](_0x145319[_0xf43d('0x43')],{'$or':_[_0xf43d('0x46')](_0x145319[_0xf43d('0x3c')],function(_0x3bc184){var _0x36ac51={};_0x36ac51[_0x3bc184]={'$like':'%'+_0x18b754['query'][_0xf43d('0x44')]+'%'};return _0x36ac51;})});}_0x145319=_[_0xf43d('0x45')]({},_0x145319,_0x18b754[_0xf43d('0x4b')]);return _0x5e4ccf['getDescriptions'](_0x145319);}})[_0xf43d('0x1d')](function(_0x26142c){if(_0x26142c){_0x574276=_0x26142c['length'];if(!_0x18b754[_0xf43d('0x39')][_0xf43d('0x3f')](_0xf43d('0x40'))){_0x145319[_0xf43d('0x2a')]=qs[_0xf43d('0x2a')](_0x18b754[_0xf43d('0x39')][_0xf43d('0x2a')]);_0x145319[_0xf43d('0x29')]=qs[_0xf43d('0x29')](_0x18b754[_0xf43d('0x39')]['offset']);}return _0x5e4ccf[_0xf43d('0x5a')](_0x145319);}})['then'](function(_0x25499b){if(_0x25499b){return _0x25499b?{'count':_0x574276,'rows':_0x25499b}:null;}})['then'](respondWithResult(_0x9dd875,null))[_0xf43d('0x52')](handleError(_0x9dd875,null));}; \ No newline at end of file +var _0xfde0=['rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','map','key','VIRTUAL','field','merge','options','includeAll','findAll','rows','show','params','include','find','body','findOne','filter','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','set','reject','save','update','destroy','then','end','name','send','index','SugarcrmConfiguration'];(function(_0x1e3077,_0x4a403f){var _0xdd1847=function(_0x454893){while(--_0x454893){_0x1e3077['push'](_0x1e3077['shift']());}};_0xdd1847(++_0x4a403f);}(_0xfde0,0xd4));var _0x0fde=function(_0x18609d,_0x2e5c97){_0x18609d=_0x18609d-0x0;var _0x315fc6=_0xfde0[_0x18609d];return _0x315fc6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0fde('0x0'));var rimraf=require(_0x0fde('0x1'));var zipdir=require(_0x0fde('0x2'));var jsonpatch=require(_0x0fde('0x3'));var rp=require(_0x0fde('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0fde('0x5'));var util=require(_0x0fde('0x6'));var path=require(_0x0fde('0x7'));var sox=require(_0x0fde('0x8'));var csv=require(_0x0fde('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0fde('0xa'));var squel=require(_0x0fde('0xb'));var crypto=require(_0x0fde('0xc'));var jsforce=require(_0x0fde('0xd'));var deskjs=require(_0x0fde('0xe'));var toCsv=require(_0x0fde('0x9'));var querystring=require(_0x0fde('0xf'));var Papa=require(_0x0fde('0x10'));var Redis=require(_0x0fde('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x0fde('0x12'));var logger=require('../../config/logger')(_0x0fde('0x13'));var utils=require(_0x0fde('0x14'));var config=require(_0x0fde('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0fde('0x16'));var client=jayson[_0x0fde('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x28ff4f,_0x2ca259,_0x5135d7){if(_0x5135d7){var _0x1fbb5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1fbb5c['test'](_0x2ca259)){return _0x28ff4f;}else{throw new db[(_0x0fde('0x18'))][(_0x0fde('0x19'))](_0x0fde('0x1a'));}}else{return _0x28ff4f;}}function respondWithRpcPromise(_0x3fd2a5,_0x4accbd,_0xa32b88,_0x586873){return new BPromise(function(_0x41228c,_0x540bba){var _0x43e126=_0x586873||client;return _0x43e126[_0x0fde('0x1b')](_0x3fd2a5,_0xa32b88)['then'](function(_0x46a38d){logger[_0x0fde('0x1c')](_0x0fde('0x1d'),_0x4accbd,'request\x20sent');logger[_0x0fde('0x1e')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4accbd,'request\x20sent',JSON[_0x0fde('0x1f')](_0x46a38d));if(_0x46a38d['error']){if(_0x46a38d[_0x0fde('0x20')][_0x0fde('0x21')]===0x1f4){logger[_0x0fde('0x20')](_0x0fde('0x1d'),_0x4accbd,_0x46a38d[_0x0fde('0x20')]['message']);return _0x540bba(_0x46a38d[_0x0fde('0x20')][_0x0fde('0x22')]);}logger[_0x0fde('0x20')](_0x0fde('0x1d'),_0x4accbd,_0x46a38d[_0x0fde('0x20')][_0x0fde('0x22')]);return _0x41228c(_0x46a38d[_0x0fde('0x20')]['message']);}else{logger[_0x0fde('0x1c')](_0x0fde('0x1d'),_0x4accbd,_0x0fde('0x23'));_0x41228c(_0x46a38d[_0x0fde('0x24')]['message']);}})[_0x0fde('0x25')](function(_0x406cb6){logger[_0x0fde('0x20')](_0x0fde('0x1d'),_0x4accbd,_0x406cb6);_0x540bba(_0x406cb6);});});}function respondWithStatusCode(_0x516c7f,_0x5ae5ce){_0x5ae5ce=_0x5ae5ce||0xcc;return function(_0x30c69c){if(_0x30c69c){return _0x516c7f[_0x0fde('0x26')](_0x5ae5ce);}return _0x516c7f[_0x0fde('0x27')](_0x5ae5ce)['end']();};}function respondWithResult(_0x3eb152,_0x33424c){_0x33424c=_0x33424c||0xc8;return function(_0x5d13b7){if(_0x5d13b7){return _0x3eb152[_0x0fde('0x27')](_0x33424c)[_0x0fde('0x28')](_0x5d13b7);}};}function respondWithFilteredResult(_0x593867,_0xd12b95){return function(_0x4f4279){if(_0x4f4279){var _0x549320=_0x4f4279[_0x0fde('0x29')],_0x350288=_0xd12b95['offset'],_0x20758e=_0xd12b95[_0x0fde('0x2a')]+_0xd12b95[_0x0fde('0x2b')],_0x2dffc5;if(_0x20758e>=_0x549320){_0x20758e=_0x549320;_0x2dffc5=0xc8;}else{_0x2dffc5=0xce;}_0x593867[_0x0fde('0x27')](_0x2dffc5);return _0x593867[_0x0fde('0x2c')]('Content-Range',_0x350288+'-'+_0x20758e+'/'+_0x549320)['json'](_0x4f4279);}return null;};}function patchUpdates(_0x3f3576){return function(_0x56281a){try{jsonpatch['apply'](_0x56281a,_0x3f3576,!![]);}catch(_0x184f17){return BPromise[_0x0fde('0x2d')](_0x184f17);}return _0x56281a[_0x0fde('0x2e')]();};}function saveUpdates(_0x10cb38,_0x53478a){return function(_0xce5c4){if(_0xce5c4){return _0xce5c4[_0x0fde('0x2f')](_0x10cb38)['then'](function(_0x3dcd8e){return _0x3dcd8e;});}return null;};}function removeEntity(_0x525023,_0x47a703){return function(_0x361f28){if(_0x361f28){return _0x361f28[_0x0fde('0x30')]()[_0x0fde('0x31')](function(){_0x525023[_0x0fde('0x27')](0xcc)[_0x0fde('0x32')]();});}};}function handleEntityNotFound(_0x46b17,_0x21f36f){return function(_0x250d49){if(!_0x250d49){_0x46b17['sendStatus'](0x194);}return _0x250d49;};}function handleError(_0x327351,_0x3eb6d5){_0x3eb6d5=_0x3eb6d5||0x1f4;return function(_0x4748cc){logger[_0x0fde('0x20')](_0x4748cc['stack']);if(_0x4748cc[_0x0fde('0x33')]){delete _0x4748cc[_0x0fde('0x33')];}_0x327351[_0x0fde('0x27')](_0x3eb6d5)[_0x0fde('0x34')](_0x4748cc);};}exports[_0x0fde('0x35')]=function(_0x1d868b,_0x17ad84){var _0x51c798={},_0x328f01={},_0x7b332b={'count':0x0,'rows':[]};var _0xbd8a5c=db[_0x0fde('0x36')][_0x0fde('0x37')];_0x328f01['model']=_['keys'](_0xbd8a5c);_0x328f01[_0x0fde('0x38')]=_[_0x0fde('0x39')](_0x1d868b['query']);_0x328f01[_0x0fde('0x3a')]=_[_0x0fde('0x3b')](_0x328f01[_0x0fde('0x3c')],_0x328f01[_0x0fde('0x38')]);_0x51c798['attributes']=_[_0x0fde('0x3b')](_0x328f01[_0x0fde('0x3c')],qs[_0x0fde('0x3d')](_0x1d868b[_0x0fde('0x38')]['fields']));_0x51c798[_0x0fde('0x3e')]=_0x51c798[_0x0fde('0x3e')][_0x0fde('0x3f')]?_0x51c798[_0x0fde('0x3e')]:_0x328f01[_0x0fde('0x3c')];if(!_0x1d868b['query'][_0x0fde('0x40')]('nolimit')){_0x51c798[_0x0fde('0x2b')]=qs[_0x0fde('0x2b')](_0x1d868b[_0x0fde('0x38')]['limit']);_0x51c798[_0x0fde('0x2a')]=qs[_0x0fde('0x2a')](_0x1d868b[_0x0fde('0x38')][_0x0fde('0x2a')]);}_0x51c798[_0x0fde('0x41')]=qs[_0x0fde('0x42')](_0x1d868b['query'][_0x0fde('0x42')]);_0x51c798[_0x0fde('0x43')]=qs[_0x0fde('0x3a')](_[_0x0fde('0x44')](_0x1d868b[_0x0fde('0x38')],_0x328f01[_0x0fde('0x3a')]));if(_0x1d868b['query']['filter']){_0x51c798[_0x0fde('0x43')]=_['merge'](_0x51c798['where'],{'$or':_[_0x0fde('0x45')](_0xbd8a5c,function(_0x23af03){if(_0x23af03['type'][_0x0fde('0x46')]!==_0x0fde('0x47')){var _0x504eea={};_0x504eea[_0x23af03[_0x0fde('0x48')]]={'$like':'%'+_0x1d868b[_0x0fde('0x38')]['filter']+'%'};return _0x504eea;}})});}_0x51c798=_[_0x0fde('0x49')]({},_0x51c798,_0x1d868b[_0x0fde('0x4a')]);var _0x2bad37={'where':_0x51c798[_0x0fde('0x43')]};return db[_0x0fde('0x36')][_0x0fde('0x29')](_0x2bad37)[_0x0fde('0x31')](function(_0x258615){_0x7b332b[_0x0fde('0x29')]=_0x258615;if(_0x1d868b[_0x0fde('0x38')][_0x0fde('0x4b')]){_0x51c798['include']=[{'all':!![]}];}return db[_0x0fde('0x36')][_0x0fde('0x4c')](_0x51c798);})[_0x0fde('0x31')](function(_0x338ccc){_0x7b332b[_0x0fde('0x4d')]=_0x338ccc;return _0x7b332b;})[_0x0fde('0x31')](respondWithFilteredResult(_0x17ad84,_0x51c798))[_0x0fde('0x25')](handleError(_0x17ad84,null));};exports[_0x0fde('0x4e')]=function(_0x123920,_0x1142b8){var _0x3cc281={'raw':![],'where':{'id':_0x123920[_0x0fde('0x4f')]['id']}},_0x38b1ef={};_0x38b1ef['model']=_['keys'](db[_0x0fde('0x36')][_0x0fde('0x37')]);_0x38b1ef[_0x0fde('0x38')]=_[_0x0fde('0x39')](_0x123920['query']);_0x38b1ef[_0x0fde('0x3a')]=_[_0x0fde('0x3b')](_0x38b1ef[_0x0fde('0x3c')],_0x38b1ef['query']);_0x3cc281[_0x0fde('0x3e')]=_['intersection'](_0x38b1ef[_0x0fde('0x3c')],qs[_0x0fde('0x3d')](_0x123920['query'][_0x0fde('0x3d')]));_0x3cc281['attributes']=_0x3cc281[_0x0fde('0x3e')][_0x0fde('0x3f')]?_0x3cc281[_0x0fde('0x3e')]:_0x38b1ef[_0x0fde('0x3c')];if(_0x123920['query'][_0x0fde('0x4b')]){_0x3cc281[_0x0fde('0x50')]=[{'all':!![]}];}_0x3cc281=_[_0x0fde('0x49')]({},_0x3cc281,_0x123920[_0x0fde('0x4a')]);return db[_0x0fde('0x36')][_0x0fde('0x51')](_0x3cc281)['then'](handleEntityNotFound(_0x1142b8,null))[_0x0fde('0x31')](respondWithResult(_0x1142b8,null))['catch'](handleError(_0x1142b8,null));};exports['create']=function(_0x21e98b,_0x373041){return db[_0x0fde('0x36')]['create'](_0x21e98b[_0x0fde('0x52')],{})[_0x0fde('0x31')](respondWithResult(_0x373041,0xc9))[_0x0fde('0x25')](handleError(_0x373041,null));};exports['update']=function(_0x57d264,_0x2ee6dc){if(_0x57d264['body']['id']){delete _0x57d264[_0x0fde('0x52')]['id'];}return db[_0x0fde('0x36')][_0x0fde('0x51')]({'where':{'id':_0x57d264[_0x0fde('0x4f')]['id']}})[_0x0fde('0x31')](handleEntityNotFound(_0x2ee6dc,null))[_0x0fde('0x31')](saveUpdates(_0x57d264['body'],null))[_0x0fde('0x31')](respondWithResult(_0x2ee6dc,null))[_0x0fde('0x25')](handleError(_0x2ee6dc,null));};exports['destroy']=function(_0x23bcf9,_0x36a4b0){return db[_0x0fde('0x36')][_0x0fde('0x51')]({'where':{'id':_0x23bcf9[_0x0fde('0x4f')]['id']}})[_0x0fde('0x31')](handleEntityNotFound(_0x36a4b0,null))['then'](removeEntity(_0x36a4b0,null))[_0x0fde('0x25')](handleError(_0x36a4b0,null));};exports['getFields']=function(_0x2c724d,_0x261be7,_0x35c1c7){var _0x12d010={};var _0xa2fd46={};var _0x1dad23;var _0x41bdd8;return db['SugarcrmConfiguration'][_0x0fde('0x53')]({'where':{'id':_0x2c724d[_0x0fde('0x4f')]['id']}})[_0x0fde('0x31')](handleEntityNotFound(_0x261be7,null))[_0x0fde('0x31')](function(_0x4af653){if(_0x4af653){_0x1dad23=_0x4af653;_0xa2fd46['model']=_[_0x0fde('0x39')](db['SugarcrmField'][_0x0fde('0x37')]);_0xa2fd46[_0x0fde('0x38')]=_[_0x0fde('0x39')](_0x2c724d['query']);_0xa2fd46[_0x0fde('0x3a')]=_[_0x0fde('0x3b')](_0xa2fd46[_0x0fde('0x3c')],_0xa2fd46['query']);_0x12d010[_0x0fde('0x3e')]=_[_0x0fde('0x3b')](_0xa2fd46[_0x0fde('0x3c')],qs['fields'](_0x2c724d[_0x0fde('0x38')]['fields']));_0x12d010[_0x0fde('0x3e')]=_0x12d010['attributes']['length']?_0x12d010[_0x0fde('0x3e')]:_0xa2fd46[_0x0fde('0x3c')];_0x12d010[_0x0fde('0x41')]=qs[_0x0fde('0x42')](_0x2c724d[_0x0fde('0x38')][_0x0fde('0x42')]);_0x12d010[_0x0fde('0x43')]=qs[_0x0fde('0x3a')](_[_0x0fde('0x44')](_0x2c724d['query'],_0xa2fd46[_0x0fde('0x3a')]));if(_0x2c724d[_0x0fde('0x38')][_0x0fde('0x54')]){_0x12d010[_0x0fde('0x43')]=_[_0x0fde('0x49')](_0x12d010['where'],{'$or':_['map'](_0x12d010[_0x0fde('0x3e')],function(_0x2ff606){var _0xc3157e={};_0xc3157e[_0x2ff606]={'$like':'%'+_0x2c724d['query'][_0x0fde('0x54')]+'%'};return _0xc3157e;})});}_0x12d010=_[_0x0fde('0x49')]({},_0x12d010,_0x2c724d[_0x0fde('0x4a')]);return _0x1dad23[_0x0fde('0x55')](_0x12d010);}})[_0x0fde('0x31')](function(_0x5a6e71){if(_0x5a6e71){_0x41bdd8=_0x5a6e71[_0x0fde('0x3f')];if(!_0x2c724d['query'][_0x0fde('0x40')](_0x0fde('0x56'))){_0x12d010[_0x0fde('0x2b')]=qs[_0x0fde('0x2b')](_0x2c724d[_0x0fde('0x38')][_0x0fde('0x2b')]);_0x12d010[_0x0fde('0x2a')]=qs[_0x0fde('0x2a')](_0x2c724d['query']['offset']);}return _0x1dad23[_0x0fde('0x55')](_0x12d010);}})[_0x0fde('0x31')](function(_0x2e256a){if(_0x2e256a){return _0x2e256a?{'count':_0x41bdd8,'rows':_0x2e256a}:null;}})[_0x0fde('0x31')](respondWithResult(_0x261be7,null))['catch'](handleError(_0x261be7,null));};exports[_0x0fde('0x57')]=function(_0x56529a,_0x4fec02,_0x5988ba){var _0x18edd9={};var _0x137a09={};var _0x337169;var _0x356513;return db['SugarcrmConfiguration'][_0x0fde('0x53')]({'where':{'id':_0x56529a[_0x0fde('0x4f')]['id']}})[_0x0fde('0x31')](handleEntityNotFound(_0x4fec02,null))[_0x0fde('0x31')](function(_0x593e20){if(_0x593e20){_0x337169=_0x593e20;_0x137a09['model']=_[_0x0fde('0x39')](db['SugarcrmField']['rawAttributes']);_0x137a09[_0x0fde('0x38')]=_['keys'](_0x56529a[_0x0fde('0x38')]);_0x137a09[_0x0fde('0x3a')]=_[_0x0fde('0x3b')](_0x137a09[_0x0fde('0x3c')],_0x137a09[_0x0fde('0x38')]);_0x18edd9[_0x0fde('0x3e')]=_[_0x0fde('0x3b')](_0x137a09[_0x0fde('0x3c')],qs[_0x0fde('0x3d')](_0x56529a[_0x0fde('0x38')][_0x0fde('0x3d')]));_0x18edd9[_0x0fde('0x3e')]=_0x18edd9[_0x0fde('0x3e')][_0x0fde('0x3f')]?_0x18edd9['attributes']:_0x137a09[_0x0fde('0x3c')];_0x18edd9[_0x0fde('0x41')]=qs[_0x0fde('0x42')](_0x56529a[_0x0fde('0x38')][_0x0fde('0x42')]);_0x18edd9['where']=qs['filters'](_['pick'](_0x56529a[_0x0fde('0x38')],_0x137a09['filters']));if(_0x56529a['query'][_0x0fde('0x54')]){_0x18edd9['where']=_['merge'](_0x18edd9[_0x0fde('0x43')],{'$or':_[_0x0fde('0x45')](_0x18edd9['attributes'],function(_0x20da3d){var _0x411516={};_0x411516[_0x20da3d]={'$like':'%'+_0x56529a['query']['filter']+'%'};return _0x411516;})});}_0x18edd9=_[_0x0fde('0x49')]({},_0x18edd9,_0x56529a[_0x0fde('0x4a')]);return _0x337169[_0x0fde('0x57')](_0x18edd9);}})[_0x0fde('0x31')](function(_0x30602e){if(_0x30602e){_0x356513=_0x30602e[_0x0fde('0x3f')];if(!_0x56529a[_0x0fde('0x38')][_0x0fde('0x40')](_0x0fde('0x56'))){_0x18edd9['limit']=qs[_0x0fde('0x2b')](_0x56529a[_0x0fde('0x38')][_0x0fde('0x2b')]);_0x18edd9[_0x0fde('0x2a')]=qs[_0x0fde('0x2a')](_0x56529a[_0x0fde('0x38')]['offset']);}return _0x337169['getSubjects'](_0x18edd9);}})[_0x0fde('0x31')](function(_0x280807){if(_0x280807){return _0x280807?{'count':_0x356513,'rows':_0x280807}:null;}})['then'](respondWithResult(_0x4fec02,null))[_0x0fde('0x25')](handleError(_0x4fec02,null));};exports[_0x0fde('0x58')]=function(_0xaa5a2d,_0xa5cadb,_0x1bed27){var _0x48b13f={};var _0x1faf2a={};var _0x2dde06;var _0x2ff008;return db[_0x0fde('0x36')][_0x0fde('0x53')]({'where':{'id':_0xaa5a2d[_0x0fde('0x4f')]['id']}})[_0x0fde('0x31')](handleEntityNotFound(_0xa5cadb,null))[_0x0fde('0x31')](function(_0x215ca7){if(_0x215ca7){_0x2dde06=_0x215ca7;_0x1faf2a[_0x0fde('0x3c')]=_['keys'](db['SugarcrmField'][_0x0fde('0x37')]);_0x1faf2a[_0x0fde('0x38')]=_[_0x0fde('0x39')](_0xaa5a2d[_0x0fde('0x38')]);_0x1faf2a[_0x0fde('0x3a')]=_[_0x0fde('0x3b')](_0x1faf2a[_0x0fde('0x3c')],_0x1faf2a[_0x0fde('0x38')]);_0x48b13f[_0x0fde('0x3e')]=_[_0x0fde('0x3b')](_0x1faf2a[_0x0fde('0x3c')],qs['fields'](_0xaa5a2d['query'][_0x0fde('0x3d')]));_0x48b13f[_0x0fde('0x3e')]=_0x48b13f['attributes'][_0x0fde('0x3f')]?_0x48b13f[_0x0fde('0x3e')]:_0x1faf2a[_0x0fde('0x3c')];_0x48b13f[_0x0fde('0x41')]=qs['sort'](_0xaa5a2d[_0x0fde('0x38')][_0x0fde('0x42')]);_0x48b13f[_0x0fde('0x43')]=qs[_0x0fde('0x3a')](_[_0x0fde('0x44')](_0xaa5a2d[_0x0fde('0x38')],_0x1faf2a[_0x0fde('0x3a')]));if(_0xaa5a2d[_0x0fde('0x38')][_0x0fde('0x54')]){_0x48b13f['where']=_[_0x0fde('0x49')](_0x48b13f[_0x0fde('0x43')],{'$or':_[_0x0fde('0x45')](_0x48b13f[_0x0fde('0x3e')],function(_0x42e471){var _0x498a8={};_0x498a8[_0x42e471]={'$like':'%'+_0xaa5a2d['query'][_0x0fde('0x54')]+'%'};return _0x498a8;})});}_0x48b13f=_[_0x0fde('0x49')]({},_0x48b13f,_0xaa5a2d[_0x0fde('0x4a')]);return _0x2dde06[_0x0fde('0x58')](_0x48b13f);}})[_0x0fde('0x31')](function(_0x4b4320){if(_0x4b4320){_0x2ff008=_0x4b4320[_0x0fde('0x3f')];if(!_0xaa5a2d[_0x0fde('0x38')][_0x0fde('0x40')](_0x0fde('0x56'))){_0x48b13f[_0x0fde('0x2b')]=qs[_0x0fde('0x2b')](_0xaa5a2d[_0x0fde('0x38')][_0x0fde('0x2b')]);_0x48b13f[_0x0fde('0x2a')]=qs[_0x0fde('0x2a')](_0xaa5a2d[_0x0fde('0x38')][_0x0fde('0x2a')]);}return _0x2dde06['getDescriptions'](_0x48b13f);}})[_0x0fde('0x31')](function(_0x2e83ca){if(_0x2e83ca){return _0x2e83ca?{'count':_0x2ff008,'rows':_0x2e83ca}:null;}})['then'](respondWithResult(_0xa5cadb,null))[_0x0fde('0x25')](handleError(_0xa5cadb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 27407ee..0e70e1d 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 _0x83a6=['SugarcrmConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0x83a6,0x109));var _0x683a=function(_0x279183,_0x269688){_0x279183=_0x279183-0x0;var _0xd28a7a=_0x83a6[_0x279183];return _0xd28a7a;};'use strict';var _=require('lodash');var util=require(_0x683a('0x0'));var logger=require(_0x683a('0x1'))(_0x683a('0x2'));var moment=require(_0x683a('0x3'));var BPromise=require(_0x683a('0x4'));var rp=require(_0x683a('0x5'));var fs=require('fs');var path=require(_0x683a('0x6'));var rimraf=require(_0x683a('0x7'));var config=require(_0x683a('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x683a('0x9')]=function(_0x387606,_0x1000d0){return _0x387606['define'](_0x683a('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0429=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0429,0x191));var _0x9042=function(_0x2f743a,_0x3429d1){_0x2f743a=_0x2f743a-0x0;var _0x3bc1a3=_0x0429[_0x2f743a];return _0x3bc1a3;};'use strict';var _=require('lodash');var util=require(_0x9042('0x0'));var logger=require(_0x9042('0x1'))(_0x9042('0x2'));var moment=require(_0x9042('0x3'));var BPromise=require(_0x9042('0x4'));var rp=require(_0x9042('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9042('0x6'));var config=require('../../config/environment');var attributes=require(_0x9042('0x7'));module[_0x9042('0x8')]=function(_0x1f02df,_0x3ae919){return _0x1f02df[_0x9042('0x9')](_0x9042('0xa'),attributes,{'tableName':_0x9042('0xb'),'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 bcaa690..c44e220 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 _0x4f75=['request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x22febb,_0x4d156e){var _0x3d8ba2=function(_0x5c2af7){while(--_0x5c2af7){_0x22febb['push'](_0x22febb['shift']());}};_0x3d8ba2(++_0x4d156e);}(_0x4f75,0x111));var _0x54f7=function(_0x13bc55,_0x75ede9){_0x13bc55=_0x13bc55-0x0;var _0x5365b7=_0x4f75[_0x13bc55];return _0x5365b7;};'use strict';var _=require(_0x54f7('0x0'));var util=require(_0x54f7('0x1'));var moment=require(_0x54f7('0x2'));var BPromise=require(_0x54f7('0x3'));var rs=require(_0x54f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54f7('0x5'));var logger=require(_0x54f7('0x6'))('rpc');var config=require(_0x54f7('0x7'));var jayson=require(_0x54f7('0x8'));var client=jayson[_0x54f7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d7208,_0x4749a9,_0x4a6be4){return new BPromise(function(_0x594037,_0x5ae60f){return client[_0x54f7('0xa')](_0x4d7208,_0x4a6be4)[_0x54f7('0xb')](function(_0x1efcdf){logger['info'](_0x54f7('0xc'),_0x4749a9,_0x54f7('0xd'));logger['debug'](_0x54f7('0xe'),_0x4749a9,_0x54f7('0xd'),JSON[_0x54f7('0xf')](_0x1efcdf));if(_0x1efcdf[_0x54f7('0x10')]){if(_0x1efcdf[_0x54f7('0x10')][_0x54f7('0x11')]===0x1f4){logger[_0x54f7('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4749a9,_0x1efcdf[_0x54f7('0x10')][_0x54f7('0x12')]);return _0x5ae60f(_0x1efcdf[_0x54f7('0x10')][_0x54f7('0x12')]);}logger[_0x54f7('0x10')](_0x54f7('0xc'),_0x4749a9,_0x1efcdf[_0x54f7('0x10')][_0x54f7('0x12')]);return _0x594037(_0x1efcdf[_0x54f7('0x10')]['message']);}else{logger[_0x54f7('0x13')](_0x54f7('0xc'),_0x4749a9,'request\x20sent');_0x594037(_0x1efcdf[_0x54f7('0x14')][_0x54f7('0x12')]);}})[_0x54f7('0x15')](function(_0x6e818b){logger['error'](_0x54f7('0xc'),_0x4749a9,_0x6e818b);_0x5ae60f(_0x6e818b);});});} \ No newline at end of file +var _0xf964=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x48683e,_0x58db1c){var _0x517bf2=function(_0x63bf79){while(--_0x63bf79){_0x48683e['push'](_0x48683e['shift']());}};_0x517bf2(++_0x58db1c);}(_0xf964,0xc4));var _0x4f96=function(_0x16a831,_0x2ac6d8){_0x16a831=_0x16a831-0x0;var _0x1fa8a9=_0xf964[_0x16a831];return _0x1fa8a9;};'use strict';var _=require(_0x4f96('0x0'));var util=require(_0x4f96('0x1'));var moment=require(_0x4f96('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f96('0x3'));var fs=require('fs');var Redis=require(_0x4f96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f96('0x5'));var logger=require(_0x4f96('0x6'))(_0x4f96('0x7'));var config=require(_0x4f96('0x8'));var jayson=require(_0x4f96('0x9'));var client=jayson[_0x4f96('0xa')][_0x4f96('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d1930,_0x15c61a,_0x1226e9){return new BPromise(function(_0x230a91,_0xbf4780){return client['request'](_0x4d1930,_0x1226e9)[_0x4f96('0xc')](function(_0x1a0ebe){logger[_0x4f96('0xd')](_0x4f96('0xe'),_0x15c61a,_0x4f96('0xf'));logger['debug'](_0x4f96('0x10'),_0x15c61a,_0x4f96('0xf'),JSON[_0x4f96('0x11')](_0x1a0ebe));if(_0x1a0ebe[_0x4f96('0x12')]){if(_0x1a0ebe[_0x4f96('0x12')][_0x4f96('0x13')]===0x1f4){logger[_0x4f96('0x12')](_0x4f96('0xe'),_0x15c61a,_0x1a0ebe[_0x4f96('0x12')][_0x4f96('0x14')]);return _0xbf4780(_0x1a0ebe[_0x4f96('0x12')][_0x4f96('0x14')]);}logger[_0x4f96('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x15c61a,_0x1a0ebe[_0x4f96('0x12')][_0x4f96('0x14')]);return _0x230a91(_0x1a0ebe[_0x4f96('0x12')]['message']);}else{logger[_0x4f96('0xd')](_0x4f96('0xe'),_0x15c61a,_0x4f96('0xf'));_0x230a91(_0x1a0ebe[_0x4f96('0x15')][_0x4f96('0x14')]);}})['catch'](function(_0x41252d){logger[_0x4f96('0x12')](_0x4f96('0xe'),_0x15c61a,_0x41252d);_0xbf4780(_0x41252d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index adc6741..355ea5d 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 _0x8917=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','create','put','exports','util'];(function(_0x484493,_0x33b227){var _0x13d34e=function(_0x120d35){while(--_0x120d35){_0x484493['push'](_0x484493['shift']());}};_0x13d34e(++_0x33b227);}(_0x8917,0x99));var _0x7891=function(_0x32ad49,_0x405e1b){_0x32ad49=_0x32ad49-0x0;var _0x3b9917=_0x8917[_0x32ad49];return _0x3b9917;};'use strict';var multer=require('multer');var util=require(_0x7891('0x0'));var path=require(_0x7891('0x1'));var timeout=require(_0x7891('0x2'));var express=require('express');var router=express[_0x7891('0x3')]();var auth=require(_0x7891('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7891('0x5'));var controller=require(_0x7891('0x6'));router['get']('/',auth[_0x7891('0x7')](),controller[_0x7891('0x8')]);router[_0x7891('0x9')](_0x7891('0xa'),auth[_0x7891('0x7')](),controller['show']);router['post']('/',auth[_0x7891('0x7')](),controller[_0x7891('0xb')]);router[_0x7891('0xc')]('/:id',auth[_0x7891('0x7')](),controller['update']);router['delete'](_0x7891('0xa'),auth[_0x7891('0x7')](),controller['destroy']);module[_0x7891('0xd')]=router; \ No newline at end of file +var _0x6468=['post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','show'];(function(_0x4b38c2,_0x54550d){var _0x3081fe=function(_0x4d2d78){while(--_0x4d2d78){_0x4b38c2['push'](_0x4b38c2['shift']());}};_0x3081fe(++_0x54550d);}(_0x6468,0x198));var _0x8646=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x6468[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x8646('0x0'));var util=require(_0x8646('0x1'));var path=require(_0x8646('0x2'));var timeout=require('connect-timeout');var express=require(_0x8646('0x3'));var router=express[_0x8646('0x4')]();var auth=require(_0x8646('0x5'));var interaction=require(_0x8646('0x6'));var config=require(_0x8646('0x7'));var controller=require(_0x8646('0x8'));router['get']('/',auth[_0x8646('0x9')](),controller['index']);router[_0x8646('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8646('0xb')]);router[_0x8646('0xc')]('/',auth[_0x8646('0x9')](),controller[_0x8646('0xd')]);router[_0x8646('0xe')]('/:id',auth[_0x8646('0x9')](),controller[_0x8646('0xf')]);router[_0x8646('0x10')](_0x8646('0x11'),auth[_0x8646('0x9')](),controller[_0x8646('0x12')]);module[_0x8646('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5424ce4..d3961d1 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 _0xdb4b=['string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','exports'];(function(_0x38ae09,_0xe252e9){var _0x3fecf0=function(_0x18c63c){while(--_0x18c63c){_0x38ae09['push'](_0x38ae09['shift']());}};_0x3fecf0(++_0xe252e9);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x49e68f,_0x21fa6b){_0x49e68f=_0x49e68f-0x0;var _0x351589=_0xdb4b[_0x49e68f];return _0x351589;};'use strict';var Sequelize=require('sequelize');module[_0xbdb4('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbdb4('0x1'),_0xbdb4('0x2'),_0xbdb4('0x3'),_0xbdb4('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbdb4('0x5')]},'key':{'type':Sequelize[_0xbdb4('0x5')]},'keyType':{'type':Sequelize[_0xbdb4('0x6')](_0xbdb4('0x1'),_0xbdb4('0x2'),_0xbdb4('0x3'))},'keyContent':{'type':Sequelize[_0xbdb4('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbdb4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbdb4('0x5')]}}; \ No newline at end of file +var _0x1ef3=['BOOLEAN','sequelize','exports','string','variable','customVariable','STRING','ENUM'];(function(_0x1b1597,_0x11e2cb){var _0xe72be2=function(_0x5188f5){while(--_0x5188f5){_0x1b1597['push'](_0x1b1597['shift']());}};_0xe72be2(++_0x11e2cb);}(_0x1ef3,0x69));var _0x31ef=function(_0xb36524,_0x1c1947){_0xb36524=_0xb36524-0x0;var _0x25a02c=_0x1ef3[_0xb36524];return _0x25a02c;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'type':{'type':Sequelize['ENUM'](_0x31ef('0x2'),_0x31ef('0x3'),_0x31ef('0x4'),'keyValue'),'defaultValue':_0x31ef('0x2')},'content':{'type':Sequelize[_0x31ef('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x31ef('0x6')](_0x31ef('0x2'),_0x31ef('0x3'),_0x31ef('0x4'))},'keyContent':{'type':Sequelize[_0x31ef('0x5')]},'idField':{'type':Sequelize[_0x31ef('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x31ef('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x31ef('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5f55361..7146a94 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 _0xf31a=['index','SugarcrmField','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','key','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','create','find','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','then','error','name','send'];(function(_0xc92b81,_0x1ba725){var _0x38d666=function(_0x1c849b){while(--_0x1c849b){_0xc92b81['push'](_0xc92b81['shift']());}};_0x38d666(++_0x1ba725);}(_0xf31a,0xaa));var _0xaf31=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf31a[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaf31('0x0'));var rimraf=require(_0xaf31('0x1'));var zipdir=require(_0xaf31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf31('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaf31('0x4'));var util=require(_0xaf31('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xaf31('0x6'));var ejs=require(_0xaf31('0x7'));var fs=require('fs');var _=require(_0xaf31('0x8'));var squel=require(_0xaf31('0x9'));var crypto=require(_0xaf31('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaf31('0xb'));var toCsv=require(_0xaf31('0x6'));var querystring=require(_0xaf31('0xc'));var Papa=require(_0xaf31('0xd'));var Redis=require(_0xaf31('0xe'));var authService=require(_0xaf31('0xf'));var qs=require(_0xaf31('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf31('0x11'))(_0xaf31('0x12'));var utils=require(_0xaf31('0x13'));var config=require(_0xaf31('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29586f,_0x71df71){_0x71df71=_0x71df71||0xcc;return function(_0x521bc9){if(_0x521bc9){return _0x29586f[_0xaf31('0x15')](_0x71df71);}return _0x29586f[_0xaf31('0x16')](_0x71df71)[_0xaf31('0x17')]();};}function respondWithResult(_0x246f7f,_0x270c1a){_0x270c1a=_0x270c1a||0xc8;return function(_0x31bcee){if(_0x31bcee){return _0x246f7f[_0xaf31('0x16')](_0x270c1a)[_0xaf31('0x18')](_0x31bcee);}};}function respondWithFilteredResult(_0x38feed,_0xb62e50){return function(_0x2fea71){if(_0x2fea71){var _0x5ac8eb=_0x2fea71[_0xaf31('0x19')],_0x137633=_0xb62e50[_0xaf31('0x1a')],_0xb12808=_0xb62e50['offset']+_0xb62e50[_0xaf31('0x1b')],_0x3f2632;if(_0xb12808>=_0x5ac8eb){_0xb12808=_0x5ac8eb;_0x3f2632=0xc8;}else{_0x3f2632=0xce;}_0x38feed[_0xaf31('0x16')](_0x3f2632);return _0x38feed[_0xaf31('0x1c')]('Content-Range',_0x137633+'-'+_0xb12808+'/'+_0x5ac8eb)[_0xaf31('0x18')](_0x2fea71);}return null;};}function patchUpdates(_0x2a3e3b){return function(_0x127199){try{jsonpatch[_0xaf31('0x1d')](_0x127199,_0x2a3e3b,!![]);}catch(_0x4c65f5){return BPromise[_0xaf31('0x1e')](_0x4c65f5);}return _0x127199['save']();};}function saveUpdates(_0x493faf,_0x4101cc){return function(_0x5aa620){if(_0x5aa620){return _0x5aa620[_0xaf31('0x1f')](_0x493faf)['then'](function(_0x44e959){return _0x44e959;});}return null;};}function removeEntity(_0x3693e8,_0x2af8a4){return function(_0x4e599b){if(_0x4e599b){return _0x4e599b[_0xaf31('0x20')]()[_0xaf31('0x21')](function(){_0x3693e8[_0xaf31('0x16')](0xcc)[_0xaf31('0x17')]();});}};}function handleEntityNotFound(_0x3b56a6,_0x5df341){return function(_0x2e54e7){if(!_0x2e54e7){_0x3b56a6[_0xaf31('0x15')](0x194);}return _0x2e54e7;};}function handleError(_0x4e3caf,_0x399d05){_0x399d05=_0x399d05||0x1f4;return function(_0x4f7614){logger[_0xaf31('0x22')](_0x4f7614['stack']);if(_0x4f7614[_0xaf31('0x23')]){delete _0x4f7614['name'];}_0x4e3caf['status'](_0x399d05)[_0xaf31('0x24')](_0x4f7614);};}exports[_0xaf31('0x25')]=function(_0x4e1a30,_0x9eedb8){var _0x1a70de={},_0x267253={},_0xa63481={'count':0x0,'rows':[]};var _0x573ec1=db[_0xaf31('0x26')][_0xaf31('0x27')];_0x267253[_0xaf31('0x28')]=_['keys'](_0x573ec1);_0x267253[_0xaf31('0x29')]=_[_0xaf31('0x2a')](_0x4e1a30[_0xaf31('0x29')]);_0x267253[_0xaf31('0x2b')]=_[_0xaf31('0x2c')](_0x267253[_0xaf31('0x28')],_0x267253[_0xaf31('0x29')]);_0x1a70de['attributes']=_[_0xaf31('0x2c')](_0x267253[_0xaf31('0x28')],qs[_0xaf31('0x2d')](_0x4e1a30[_0xaf31('0x29')][_0xaf31('0x2d')]));_0x1a70de[_0xaf31('0x2e')]=_0x1a70de[_0xaf31('0x2e')][_0xaf31('0x2f')]?_0x1a70de['attributes']:_0x267253['model'];if(!_0x4e1a30[_0xaf31('0x29')][_0xaf31('0x30')](_0xaf31('0x31'))){_0x1a70de['limit']=qs[_0xaf31('0x1b')](_0x4e1a30[_0xaf31('0x29')][_0xaf31('0x1b')]);_0x1a70de[_0xaf31('0x1a')]=qs['offset'](_0x4e1a30['query'][_0xaf31('0x1a')]);}_0x1a70de[_0xaf31('0x32')]=qs[_0xaf31('0x33')](_0x4e1a30[_0xaf31('0x29')][_0xaf31('0x33')]);_0x1a70de[_0xaf31('0x34')]=qs['filters'](_[_0xaf31('0x35')](_0x4e1a30[_0xaf31('0x29')],_0x267253[_0xaf31('0x2b')]));if(_0x4e1a30['query']['filter']){_0x1a70de[_0xaf31('0x34')]=_[_0xaf31('0x36')](_0x1a70de[_0xaf31('0x34')],{'$or':_[_0xaf31('0x37')](_0x573ec1,function(_0x5e2ed1){if(_0x5e2ed1['type'][_0xaf31('0x38')]!==_0xaf31('0x39')){var _0xdeffc0={};_0xdeffc0[_0x5e2ed1['field']]={'$like':'%'+_0x4e1a30[_0xaf31('0x29')][_0xaf31('0x3a')]+'%'};return _0xdeffc0;}})});}_0x1a70de=_[_0xaf31('0x36')]({},_0x1a70de,_0x4e1a30[_0xaf31('0x3b')]);var _0x3e57f2={'where':_0x1a70de['where']};return db[_0xaf31('0x26')][_0xaf31('0x19')](_0x3e57f2)[_0xaf31('0x21')](function(_0x4bb5d0){_0xa63481[_0xaf31('0x19')]=_0x4bb5d0;if(_0x4e1a30[_0xaf31('0x29')]['includeAll']){_0x1a70de[_0xaf31('0x3c')]=[{'all':!![]}];}return db[_0xaf31('0x26')][_0xaf31('0x3d')](_0x1a70de);})['then'](function(_0x511aa4){_0xa63481[_0xaf31('0x3e')]=_0x511aa4;return _0xa63481;})[_0xaf31('0x21')](respondWithFilteredResult(_0x9eedb8,_0x1a70de))[_0xaf31('0x3f')](handleError(_0x9eedb8,null));};exports[_0xaf31('0x40')]=function(_0x555821,_0x57a0b4){var _0x2f3c52={'raw':!![],'where':{'id':_0x555821[_0xaf31('0x41')]['id']}},_0x260291={};_0x260291['model']=_[_0xaf31('0x2a')](db['SugarcrmField'][_0xaf31('0x27')]);_0x260291[_0xaf31('0x29')]=_['keys'](_0x555821['query']);_0x260291[_0xaf31('0x2b')]=_[_0xaf31('0x2c')](_0x260291[_0xaf31('0x28')],_0x260291['query']);_0x2f3c52[_0xaf31('0x2e')]=_[_0xaf31('0x2c')](_0x260291['model'],qs['fields'](_0x555821['query'][_0xaf31('0x2d')]));_0x2f3c52['attributes']=_0x2f3c52[_0xaf31('0x2e')]['length']?_0x2f3c52[_0xaf31('0x2e')]:_0x260291['model'];if(_0x555821['query']['includeAll']){_0x2f3c52[_0xaf31('0x3c')]=[{'all':!![]}];}_0x2f3c52=_[_0xaf31('0x36')]({},_0x2f3c52,_0x555821['options']);return db[_0xaf31('0x26')]['find'](_0x2f3c52)[_0xaf31('0x21')](handleEntityNotFound(_0x57a0b4,null))[_0xaf31('0x21')](respondWithResult(_0x57a0b4,null))[_0xaf31('0x3f')](handleError(_0x57a0b4,null));};exports[_0xaf31('0x42')]=function(_0x14ba1f,_0x432c26){return db['SugarcrmField'][_0xaf31('0x42')](_0x14ba1f['body'],{})[_0xaf31('0x21')](respondWithResult(_0x432c26,0xc9))['catch'](handleError(_0x432c26,null));};exports['update']=function(_0x11a3db,_0xb5d5a8){if(_0x11a3db['body']['id']){delete _0x11a3db['body']['id'];}return db['SugarcrmField'][_0xaf31('0x43')]({'where':{'id':_0x11a3db[_0xaf31('0x41')]['id']}})[_0xaf31('0x21')](handleEntityNotFound(_0xb5d5a8,null))[_0xaf31('0x21')](saveUpdates(_0x11a3db[_0xaf31('0x44')],null))[_0xaf31('0x21')](respondWithResult(_0xb5d5a8,null))[_0xaf31('0x3f')](handleError(_0xb5d5a8,null));};exports[_0xaf31('0x20')]=function(_0xecfb3d,_0x24db20){return db[_0xaf31('0x26')]['find']({'where':{'id':_0xecfb3d[_0xaf31('0x41')]['id']}})[_0xaf31('0x21')](handleEntityNotFound(_0x24db20,null))[_0xaf31('0x21')](removeEntity(_0x24db20,null))[_0xaf31('0x3f')](handleError(_0x24db20,null));}; \ No newline at end of file +var _0x7b5b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','error','index','SugarcrmField','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','filter','where','merge','map','type','key','VIRTUAL','count','then','includeAll','findAll','catch','show','params','find','create','body'];(function(_0x548421,_0x344940){var _0x4d5481=function(_0x941755){while(--_0x941755){_0x548421['push'](_0x548421['shift']());}};_0x4d5481(++_0x344940);}(_0x7b5b,0x14a));var _0xb7b5=function(_0x2e534c,_0x17a21c){_0x2e534c=_0x2e534c-0x0;var _0x3f06a8=_0x7b5b[_0x2e534c];return _0x3f06a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb7b5('0x0'));var rimraf=require(_0xb7b5('0x1'));var zipdir=require(_0xb7b5('0x2'));var jsonpatch=require(_0xb7b5('0x3'));var rp=require(_0xb7b5('0x4'));var moment=require(_0xb7b5('0x5'));var BPromise=require(_0xb7b5('0x6'));var Mustache=require(_0xb7b5('0x7'));var util=require(_0xb7b5('0x8'));var path=require(_0xb7b5('0x9'));var sox=require(_0xb7b5('0xa'));var csv=require(_0xb7b5('0xb'));var ejs=require(_0xb7b5('0xc'));var fs=require('fs');var _=require(_0xb7b5('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb7b5('0xe'));var deskjs=require(_0xb7b5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7b5('0x10'));var Redis=require(_0xb7b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb7b5('0x12'));var hardwareService=require(_0xb7b5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb7b5('0x14'));var config=require(_0xb7b5('0x15'));var db=require(_0xb7b5('0x16'))['db'];function respondWithStatusCode(_0x55ebe7,_0x35a576){_0x35a576=_0x35a576||0xcc;return function(_0x23296b){if(_0x23296b){return _0x55ebe7['sendStatus'](_0x35a576);}return _0x55ebe7['status'](_0x35a576)[_0xb7b5('0x17')]();};}function respondWithResult(_0xb46227,_0x2584a5){_0x2584a5=_0x2584a5||0xc8;return function(_0x74562f){if(_0x74562f){return _0xb46227[_0xb7b5('0x18')](_0x2584a5)[_0xb7b5('0x19')](_0x74562f);}};}function respondWithFilteredResult(_0x37ef65,_0x11bec6){return function(_0x5d9bba){if(_0x5d9bba){var _0x5bf6c2=_0x5d9bba['count'],_0x2d09f7=_0x11bec6[_0xb7b5('0x1a')],_0x5def9e=_0x11bec6['offset']+_0x11bec6['limit'],_0x241fcb;if(_0x5def9e>=_0x5bf6c2){_0x5def9e=_0x5bf6c2;_0x241fcb=0xc8;}else{_0x241fcb=0xce;}_0x37ef65[_0xb7b5('0x18')](_0x241fcb);return _0x37ef65[_0xb7b5('0x1b')](_0xb7b5('0x1c'),_0x2d09f7+'-'+_0x5def9e+'/'+_0x5bf6c2)[_0xb7b5('0x19')](_0x5d9bba);}return null;};}function patchUpdates(_0x5cd6bb){return function(_0x508ce9){try{jsonpatch[_0xb7b5('0x1d')](_0x508ce9,_0x5cd6bb,!![]);}catch(_0x460042){return BPromise[_0xb7b5('0x1e')](_0x460042);}return _0x508ce9['save']();};}function saveUpdates(_0x29a842,_0x4e9fc2){return function(_0x716b32){if(_0x716b32){return _0x716b32[_0xb7b5('0x1f')](_0x29a842)['then'](function(_0xd11b80){return _0xd11b80;});}return null;};}function removeEntity(_0x42721f,_0x28e60f){return function(_0x3487b5){if(_0x3487b5){return _0x3487b5[_0xb7b5('0x20')]()['then'](function(){_0x42721f[_0xb7b5('0x18')](0xcc)[_0xb7b5('0x17')]();});}};}function handleEntityNotFound(_0x22a073,_0x33b321){return function(_0x365629){if(!_0x365629){_0x22a073[_0xb7b5('0x21')](0x194);}return _0x365629;};}function handleError(_0x36a7db,_0x377cf2){_0x377cf2=_0x377cf2||0x1f4;return function(_0x44c6bb){logger[_0xb7b5('0x22')](_0x44c6bb['stack']);if(_0x44c6bb['name']){delete _0x44c6bb['name'];}_0x36a7db['status'](_0x377cf2)['send'](_0x44c6bb);};}exports[_0xb7b5('0x23')]=function(_0xea59f9,_0x544652){var _0x268cfa={},_0x437bce={},_0x1ba866={'count':0x0,'rows':[]};var _0x5b197c=db[_0xb7b5('0x24')][_0xb7b5('0x25')];_0x437bce['model']=_[_0xb7b5('0x26')](_0x5b197c);_0x437bce[_0xb7b5('0x27')]=_[_0xb7b5('0x26')](_0xea59f9['query']);_0x437bce[_0xb7b5('0x28')]=_[_0xb7b5('0x29')](_0x437bce[_0xb7b5('0x2a')],_0x437bce[_0xb7b5('0x27')]);_0x268cfa[_0xb7b5('0x2b')]=_['intersection'](_0x437bce[_0xb7b5('0x2a')],qs[_0xb7b5('0x2c')](_0xea59f9[_0xb7b5('0x27')][_0xb7b5('0x2c')]));_0x268cfa['attributes']=_0x268cfa['attributes'][_0xb7b5('0x2d')]?_0x268cfa[_0xb7b5('0x2b')]:_0x437bce['model'];if(!_0xea59f9[_0xb7b5('0x27')][_0xb7b5('0x2e')]('nolimit')){_0x268cfa[_0xb7b5('0x2f')]=qs[_0xb7b5('0x2f')](_0xea59f9['query']['limit']);_0x268cfa[_0xb7b5('0x1a')]=qs[_0xb7b5('0x1a')](_0xea59f9[_0xb7b5('0x27')]['offset']);}_0x268cfa['order']=qs['sort'](_0xea59f9[_0xb7b5('0x27')][_0xb7b5('0x30')]);_0x268cfa['where']=qs[_0xb7b5('0x28')](_['pick'](_0xea59f9[_0xb7b5('0x27')],_0x437bce[_0xb7b5('0x28')]));if(_0xea59f9[_0xb7b5('0x27')][_0xb7b5('0x31')]){_0x268cfa[_0xb7b5('0x32')]=_[_0xb7b5('0x33')](_0x268cfa[_0xb7b5('0x32')],{'$or':_[_0xb7b5('0x34')](_0x5b197c,function(_0x2ec8cb){if(_0x2ec8cb[_0xb7b5('0x35')][_0xb7b5('0x36')]!==_0xb7b5('0x37')){var _0x3ccf94={};_0x3ccf94[_0x2ec8cb['field']]={'$like':'%'+_0xea59f9['query'][_0xb7b5('0x31')]+'%'};return _0x3ccf94;}})});}_0x268cfa=_['merge']({},_0x268cfa,_0xea59f9['options']);var _0x1bef5e={'where':_0x268cfa[_0xb7b5('0x32')]};return db[_0xb7b5('0x24')][_0xb7b5('0x38')](_0x1bef5e)[_0xb7b5('0x39')](function(_0x1bd943){_0x1ba866[_0xb7b5('0x38')]=_0x1bd943;if(_0xea59f9['query'][_0xb7b5('0x3a')]){_0x268cfa['include']=[{'all':!![]}];}return db[_0xb7b5('0x24')][_0xb7b5('0x3b')](_0x268cfa);})['then'](function(_0x5894eb){_0x1ba866['rows']=_0x5894eb;return _0x1ba866;})[_0xb7b5('0x39')](respondWithFilteredResult(_0x544652,_0x268cfa))[_0xb7b5('0x3c')](handleError(_0x544652,null));};exports[_0xb7b5('0x3d')]=function(_0x309427,_0x31f349){var _0x305893={'raw':!![],'where':{'id':_0x309427[_0xb7b5('0x3e')]['id']}},_0x55868b={};_0x55868b['model']=_[_0xb7b5('0x26')](db[_0xb7b5('0x24')][_0xb7b5('0x25')]);_0x55868b[_0xb7b5('0x27')]=_[_0xb7b5('0x26')](_0x309427[_0xb7b5('0x27')]);_0x55868b['filters']=_[_0xb7b5('0x29')](_0x55868b[_0xb7b5('0x2a')],_0x55868b[_0xb7b5('0x27')]);_0x305893[_0xb7b5('0x2b')]=_['intersection'](_0x55868b[_0xb7b5('0x2a')],qs[_0xb7b5('0x2c')](_0x309427['query'][_0xb7b5('0x2c')]));_0x305893[_0xb7b5('0x2b')]=_0x305893[_0xb7b5('0x2b')][_0xb7b5('0x2d')]?_0x305893[_0xb7b5('0x2b')]:_0x55868b[_0xb7b5('0x2a')];if(_0x309427[_0xb7b5('0x27')][_0xb7b5('0x3a')]){_0x305893['include']=[{'all':!![]}];}_0x305893=_[_0xb7b5('0x33')]({},_0x305893,_0x309427['options']);return db[_0xb7b5('0x24')][_0xb7b5('0x3f')](_0x305893)[_0xb7b5('0x39')](handleEntityNotFound(_0x31f349,null))[_0xb7b5('0x39')](respondWithResult(_0x31f349,null))['catch'](handleError(_0x31f349,null));};exports[_0xb7b5('0x40')]=function(_0x41cf4f,_0x4a133a){return db[_0xb7b5('0x24')][_0xb7b5('0x40')](_0x41cf4f['body'],{})['then'](respondWithResult(_0x4a133a,0xc9))[_0xb7b5('0x3c')](handleError(_0x4a133a,null));};exports[_0xb7b5('0x1f')]=function(_0x9cb92c,_0x5d0eee){if(_0x9cb92c[_0xb7b5('0x41')]['id']){delete _0x9cb92c['body']['id'];}return db[_0xb7b5('0x24')][_0xb7b5('0x3f')]({'where':{'id':_0x9cb92c[_0xb7b5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5d0eee,null))[_0xb7b5('0x39')](saveUpdates(_0x9cb92c[_0xb7b5('0x41')],null))[_0xb7b5('0x39')](respondWithResult(_0x5d0eee,null))[_0xb7b5('0x3c')](handleError(_0x5d0eee,null));};exports['destroy']=function(_0x5ec3c6,_0x26fe1a){return db[_0xb7b5('0x24')][_0xb7b5('0x3f')]({'where':{'id':_0x5ec3c6[_0xb7b5('0x3e')]['id']}})[_0xb7b5('0x39')](handleEntityNotFound(_0x26fe1a,null))[_0xb7b5('0x39')](removeEntity(_0x26fe1a,null))[_0xb7b5('0x3c')](handleError(_0x26fe1a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 8896320..5bdd0ce 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 _0x0ae8=['path','rimraf','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x557e31,_0x5bbaca){var _0x3f3b9d=function(_0x3f8997){while(--_0x3f8997){_0x557e31['push'](_0x557e31['shift']());}};_0x3f3b9d(++_0x5bbaca);}(_0x0ae8,0x126));var _0x80ae=function(_0x2f401b,_0x5a9c64){_0x2f401b=_0x2f401b-0x0;var _0x3d4b06=_0x0ae8[_0x2f401b];return _0x3d4b06;};'use strict';var _=require(_0x80ae('0x0'));var util=require(_0x80ae('0x1'));var logger=require(_0x80ae('0x2'))(_0x80ae('0x3'));var moment=require('moment');var BPromise=require(_0x80ae('0x4'));var rp=require(_0x80ae('0x5'));var fs=require('fs');var path=require(_0x80ae('0x6'));var rimraf=require(_0x80ae('0x7'));var config=require('../../config/environment');var attributes=require(_0x80ae('0x8'));module[_0x80ae('0x9')]=function(_0x3558aa,_0x46b2c5){return _0x3558aa['define'](_0x80ae('0xa'),attributes,{'tableName':_0x80ae('0xb'),'paranoid':![],'indexes':[{'name':_0x80ae('0xc'),'fields':[_0x80ae('0xd'),_0x80ae('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a0a=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','api','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0x1a0a,0x18a));var _0xa1a0=function(_0x500d35,_0x3f5d69){_0x500d35=_0x500d35-0x0;var _0x383af4=_0x1a0a[_0x500d35];return _0x383af4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa1a0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa1a0('0x1'));var fs=require('fs');var path=require(_0xa1a0('0x2'));var rimraf=require(_0xa1a0('0x3'));var config=require(_0xa1a0('0x4'));var attributes=require(_0xa1a0('0x5'));module['exports']=function(_0x228a81,_0x1116c7){return _0x228a81['define'](_0xa1a0('0x6'),attributes,{'tableName':_0xa1a0('0x7'),'paranoid':![],'indexes':[{'name':_0xa1a0('0x8'),'fields':['idField',_0xa1a0('0x9')],'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 e8983b2..9c6d5d6 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 _0x5eb8=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x401d3d,_0x26cddb){var _0x5d11d5=function(_0x4cb66f){while(--_0x4cb66f){_0x401d3d['push'](_0x401d3d['shift']());}};_0x5d11d5(++_0x26cddb);}(_0x5eb8,0xb0));var _0x85eb=function(_0x48fff1,_0x50c537){_0x48fff1=_0x48fff1-0x0;var _0x127a1d=_0x5eb8[_0x48fff1];return _0x127a1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ 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','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4bed96,_0x5adc56){var _0x33dec2=function(_0x2444cb){while(--_0x2444cb){_0x4bed96['push'](_0x4bed96['shift']());}};_0x33dec2(++_0x5adc56);}(_0xb10b,0x12a));var _0xbb10=function(_0x15214b,_0x3a7ebd){_0x15214b=_0x15214b-0x0;var _0xe42e19=_0xb10b[_0x15214b];return _0xe42e19;};'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/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ca5b1f0..17f8c02 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 _0xc1ac=['getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xc1ac,0xa3));var _0xcc1a=function(_0x4e0dda,_0x23fcbe){_0x4e0dda=_0x4e0dda-0x0;var _0x203826=_0xc1ac[_0x4e0dda];return _0x203826;};'use strict';var multer=require(_0xcc1a('0x0'));var util=require(_0xcc1a('0x1'));var path=require(_0xcc1a('0x2'));var timeout=require(_0xcc1a('0x3'));var express=require('express');var router=express[_0xcc1a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcc1a('0x5'));var config=require(_0xcc1a('0x6'));var controller=require('./intVtigerAccount.controller');router[_0xcc1a('0x7')]('/',auth[_0xcc1a('0x8')](),controller[_0xcc1a('0x9')]);router['get'](_0xcc1a('0xa'),auth[_0xcc1a('0x8')](),controller[_0xcc1a('0xb')]);router['get'](_0xcc1a('0xc'),auth[_0xcc1a('0x8')](),controller[_0xcc1a('0xd')]);router['get'](_0xcc1a('0xe'),auth[_0xcc1a('0x8')](),controller['getFields']);router[_0xcc1a('0xf')]('/',auth[_0xcc1a('0x8')](),controller[_0xcc1a('0x10')]);router[_0xcc1a('0xf')]('/:id/configurations',auth[_0xcc1a('0x8')](),controller['addConfiguration']);router[_0xcc1a('0x11')]('/:id',auth[_0xcc1a('0x8')](),controller[_0xcc1a('0x12')]);router[_0xcc1a('0x13')]('/:id',auth[_0xcc1a('0x8')](),controller[_0xcc1a('0x14')]);module[_0xcc1a('0x15')]=router; \ No newline at end of file +var _0x388a=['/:id','/:id/configurations','getConfigurations','post','create','addConfiguration','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x47d9fa,_0x37070b){var _0x5a0511=function(_0xb5ee7a){while(--_0xb5ee7a){_0x47d9fa['push'](_0x47d9fa['shift']());}};_0x5a0511(++_0x37070b);}(_0x388a,0x7a));var _0xa388=function(_0x4ba2f7,_0x24a726){_0x4ba2f7=_0x4ba2f7-0x0;var _0x33d3e4=_0x388a[_0x4ba2f7];return _0x33d3e4;};'use strict';var multer=require(_0xa388('0x0'));var util=require(_0xa388('0x1'));var path=require(_0xa388('0x2'));var timeout=require(_0xa388('0x3'));var express=require('express');var router=express[_0xa388('0x4')]();var auth=require(_0xa388('0x5'));var interaction=require(_0xa388('0x6'));var config=require(_0xa388('0x7'));var controller=require(_0xa388('0x8'));router[_0xa388('0x9')]('/',auth[_0xa388('0xa')](),controller['index']);router['get'](_0xa388('0xb'),auth[_0xa388('0xa')](),controller['show']);router[_0xa388('0x9')](_0xa388('0xc'),auth[_0xa388('0xa')](),controller[_0xa388('0xd')]);router['get']('/:id/fields',auth[_0xa388('0xa')](),controller['getFields']);router[_0xa388('0xe')]('/',auth[_0xa388('0xa')](),controller[_0xa388('0xf')]);router[_0xa388('0xe')]('/:id/configurations',auth[_0xa388('0xa')](),controller[_0xa388('0x10')]);router['put'](_0xa388('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa388('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa388('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9480b26..1864069 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 _0xdb17=['STRING','HelpDesk','sequelize','exports'];(function(_0x51c4f3,_0x1ce048){var _0x2d46be=function(_0x2f2163){while(--_0x2f2163){_0x51c4f3['push'](_0x51c4f3['shift']());}};_0x2d46be(++_0x1ce048);}(_0xdb17,0xce));var _0x7db1=function(_0x2b5904,_0x209c1b){_0x2b5904=_0x2b5904-0x0;var _0x503faf=_0xdb17[_0x2b5904];return _0x503faf;};'use strict';var Sequelize=require(_0x7db1('0x0'));module[_0x7db1('0x1')]={'name':{'type':Sequelize[_0x7db1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7db1('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7db1('0x3')},'remoteUri':{'type':Sequelize[_0x7db1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7db1('0x2')]},'accessKey':{'type':Sequelize[_0x7db1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1b7c=['exports','STRING','HelpDesk'];(function(_0x4fba44,_0x10e53c){var _0x1b87ec=function(_0x20015c){while(--_0x20015c){_0x4fba44['push'](_0x4fba44['shift']());}};_0x1b87ec(++_0x10e53c);}(_0x1b7c,0xe1));var _0xc1b7=function(_0x12c2b0,_0x464233){_0x12c2b0=_0x12c2b0-0x0;var _0x466859=_0x1b7c[_0x12c2b0];return _0x466859;};'use strict';var Sequelize=require('sequelize');module[_0xc1b7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc1b7('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc1b7('0x1')],'allowNull':![],'defaultValue':_0xc1b7('0x2')},'remoteUri':{'type':Sequelize[_0xc1b7('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 9a9da96..fca0c07 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 _0x22dd=['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','then','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','stack','name','send','index','VtigerAccount','rawAttributes','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','map','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','VtigerConfiguration','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','VtigerField','Subjects','Descriptions','md5','getFields','username','remoteUri','serverUrl','accessKey','moduleName','slice','substring','POST','login','token','success','autogenerated','reference','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd22d('0x0'));var emlformat=require(_0xd22d('0x1'));var rimraf=require(_0xd22d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd22d('0x3'));var moment=require(_0xd22d('0x4'));var BPromise=require(_0xd22d('0x5'));var Mustache=require(_0xd22d('0x6'));var util=require(_0xd22d('0x7'));var path=require(_0xd22d('0x8'));var sox=require(_0xd22d('0x9'));var csv=require(_0xd22d('0xa'));var ejs=require(_0xd22d('0xb'));var fs=require('fs');var _=require(_0xd22d('0xc'));var squel=require('squel');var crypto=require(_0xd22d('0xd'));var jsforce=require(_0xd22d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd22d('0xa'));var querystring=require('querystring');var Papa=require(_0xd22d('0xf'));var Redis=require('ioredis');var authService=require(_0xd22d('0x10'));var qs=require(_0xd22d('0x11'));var hardwareService=require(_0xd22d('0x12'));var logger=require(_0xd22d('0x13'))(_0xd22d('0x14'));var utils=require(_0xd22d('0x15'));var config=require(_0xd22d('0x16'));var db=require(_0xd22d('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd22d('0x18'));var client=jayson[_0xd22d('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x38978b,_0xf15d9,_0x565828){if(_0x565828){var _0x4979cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4979cb['test'](_0xf15d9)){return _0x38978b;}else{throw new db[(_0xd22d('0x1a'))]['ValidationError'](_0xd22d('0x1b'));}}else{return _0x38978b;}}function respondWithRpcPromise(_0x505edd,_0x78d93e,_0x5b91bd,_0x5027d){return new BPromise(function(_0x377e75,_0x54eb93){var _0x3df8c5=_0x5027d||client;return _0x3df8c5[_0xd22d('0x1c')](_0x505edd,_0x5b91bd)[_0xd22d('0x1d')](function(_0x11c410){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x78d93e,_0xd22d('0x1e'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x78d93e,'request\x20sent',JSON[_0xd22d('0x1f')](_0x11c410));if(_0x11c410[_0xd22d('0x20')]){if(_0x11c410[_0xd22d('0x20')][_0xd22d('0x21')]===0x1f4){logger[_0xd22d('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x78d93e,_0x11c410[_0xd22d('0x20')]['message']);return _0x54eb93(_0x11c410['error']['message']);}logger[_0xd22d('0x20')](_0xd22d('0x22'),_0x78d93e,_0x11c410[_0xd22d('0x20')][_0xd22d('0x23')]);return _0x377e75(_0x11c410[_0xd22d('0x20')][_0xd22d('0x23')]);}else{logger[_0xd22d('0x24')]('VtigerAccount,\x20%s,\x20%s',_0x78d93e,_0xd22d('0x1e'));_0x377e75(_0x11c410[_0xd22d('0x25')]['message']);}})['catch'](function(_0x3a0773){logger[_0xd22d('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x78d93e,_0x3a0773);_0x54eb93(_0x3a0773);});});}function respondWithStatusCode(_0x2b0959,_0x370902){_0x370902=_0x370902||0xcc;return function(_0xee8f2){if(_0xee8f2){return _0x2b0959[_0xd22d('0x26')](_0x370902);}return _0x2b0959[_0xd22d('0x27')](_0x370902)[_0xd22d('0x28')]();};}function respondWithResult(_0x2d45ab,_0x318c45){_0x318c45=_0x318c45||0xc8;return function(_0x2f88a4){if(_0x2f88a4){return _0x2d45ab['status'](_0x318c45)[_0xd22d('0x29')](_0x2f88a4);}};}function respondWithFilteredResult(_0x93ffa,_0x51313a){return function(_0x8f0d76){if(_0x8f0d76){var _0x5f00f9=_0x8f0d76[_0xd22d('0x2a')],_0x5381a8=_0x51313a[_0xd22d('0x2b')],_0x2d377d=_0x51313a[_0xd22d('0x2b')]+_0x51313a['limit'],_0x96a17e;if(_0x2d377d>=_0x5f00f9){_0x2d377d=_0x5f00f9;_0x96a17e=0xc8;}else{_0x96a17e=0xce;}_0x93ffa[_0xd22d('0x27')](_0x96a17e);return _0x93ffa['set'](_0xd22d('0x2c'),_0x5381a8+'-'+_0x2d377d+'/'+_0x5f00f9)[_0xd22d('0x29')](_0x8f0d76);}return null;};}function patchUpdates(_0x4b0635){return function(_0x905a7c){try{jsonpatch[_0xd22d('0x2d')](_0x905a7c,_0x4b0635,!![]);}catch(_0x56f43e){return BPromise[_0xd22d('0x2e')](_0x56f43e);}return _0x905a7c[_0xd22d('0x2f')]();};}function saveUpdates(_0x517a86,_0x34cf93){return function(_0x53cd6b){if(_0x53cd6b){return _0x53cd6b[_0xd22d('0x30')](_0x517a86)[_0xd22d('0x1d')](function(_0x5338b2){return _0x5338b2;});}return null;};}function removeEntity(_0x224e1a,_0x399e3d){return function(_0x27ebec){if(_0x27ebec){return _0x27ebec['destroy']()[_0xd22d('0x1d')](function(){_0x224e1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f040,_0x50aed9){return function(_0x144fb9){if(!_0x144fb9){_0x21f040['sendStatus'](0x194);}return _0x144fb9;};}function handleError(_0x850ace,_0x3c4c0c){_0x3c4c0c=_0x3c4c0c||0x1f4;return function(_0x4cc764){logger['error'](_0x4cc764[_0xd22d('0x31')]);if(_0x4cc764[_0xd22d('0x32')]){delete _0x4cc764[_0xd22d('0x32')];}_0x850ace[_0xd22d('0x27')](_0x3c4c0c)[_0xd22d('0x33')](_0x4cc764);};}exports[_0xd22d('0x34')]=function(_0x8baeaf,_0x4bc5ec){var _0x49ea98={},_0x3129e3={},_0x2e6765={'count':0x0,'rows':[]};var _0x5e3b66=db[_0xd22d('0x35')][_0xd22d('0x36')];_0x3129e3['model']=_['keys'](_0x5e3b66);_0x3129e3['query']=_[_0xd22d('0x37')](_0x8baeaf[_0xd22d('0x38')]);_0x3129e3[_0xd22d('0x39')]=_['intersection'](_0x3129e3[_0xd22d('0x3a')],_0x3129e3['query']);_0x49ea98['attributes']=_[_0xd22d('0x3b')](_0x3129e3[_0xd22d('0x3a')],qs['fields'](_0x8baeaf[_0xd22d('0x38')][_0xd22d('0x3c')]));_0x49ea98[_0xd22d('0x3d')]=_0x49ea98['attributes'][_0xd22d('0x3e')]?_0x49ea98[_0xd22d('0x3d')]:_0x3129e3[_0xd22d('0x3a')];if(!_0x8baeaf[_0xd22d('0x38')][_0xd22d('0x3f')](_0xd22d('0x40'))){_0x49ea98[_0xd22d('0x41')]=qs[_0xd22d('0x41')](_0x8baeaf['query'][_0xd22d('0x41')]);_0x49ea98[_0xd22d('0x2b')]=qs[_0xd22d('0x2b')](_0x8baeaf[_0xd22d('0x38')]['offset']);}_0x49ea98[_0xd22d('0x42')]=qs[_0xd22d('0x43')](_0x8baeaf['query'][_0xd22d('0x43')]);_0x49ea98[_0xd22d('0x44')]=qs[_0xd22d('0x39')](_[_0xd22d('0x45')](_0x8baeaf[_0xd22d('0x38')],_0x3129e3[_0xd22d('0x39')]));if(_0x8baeaf[_0xd22d('0x38')]['filter']){_0x49ea98[_0xd22d('0x44')]=_['merge'](_0x49ea98[_0xd22d('0x44')],{'$or':_[_0xd22d('0x46')](_0x5e3b66,function(_0x12a553){if(_0x12a553[_0xd22d('0x47')]['key']!==_0xd22d('0x48')){var _0x24557e={};_0x24557e[_0x12a553['field']]={'$like':'%'+_0x8baeaf[_0xd22d('0x38')][_0xd22d('0x49')]+'%'};return _0x24557e;}})});}_0x49ea98=_[_0xd22d('0x4a')]({},_0x49ea98,_0x8baeaf['options']);var _0x1b368e={'where':_0x49ea98[_0xd22d('0x44')]};return db[_0xd22d('0x35')][_0xd22d('0x2a')](_0x1b368e)[_0xd22d('0x1d')](function(_0x4e8f4e){_0x2e6765[_0xd22d('0x2a')]=_0x4e8f4e;if(_0x8baeaf[_0xd22d('0x38')][_0xd22d('0x4b')]){_0x49ea98[_0xd22d('0x4c')]=[{'all':!![]}];}return db[_0xd22d('0x35')][_0xd22d('0x4d')](_0x49ea98);})[_0xd22d('0x1d')](function(_0x48d8bb){_0x2e6765[_0xd22d('0x4e')]=_0x48d8bb;return _0x2e6765;})[_0xd22d('0x1d')](respondWithFilteredResult(_0x4bc5ec,_0x49ea98))[_0xd22d('0x4f')](handleError(_0x4bc5ec,null));};exports[_0xd22d('0x50')]=function(_0xa3b8ec,_0x5ebcc5){var _0x1416de={'raw':![],'where':{'id':_0xa3b8ec[_0xd22d('0x51')]['id']}},_0x1df113={};_0x1df113[_0xd22d('0x3a')]=_[_0xd22d('0x37')](db[_0xd22d('0x35')][_0xd22d('0x36')]);_0x1df113['query']=_['keys'](_0xa3b8ec['query']);_0x1df113[_0xd22d('0x39')]=_[_0xd22d('0x3b')](_0x1df113['model'],_0x1df113[_0xd22d('0x38')]);_0x1416de[_0xd22d('0x3d')]=_[_0xd22d('0x3b')](_0x1df113[_0xd22d('0x3a')],qs[_0xd22d('0x3c')](_0xa3b8ec[_0xd22d('0x38')]['fields']));_0x1416de[_0xd22d('0x3d')]=_0x1416de['attributes'][_0xd22d('0x3e')]?_0x1416de[_0xd22d('0x3d')]:_0x1df113[_0xd22d('0x3a')];if(_0xa3b8ec['query'][_0xd22d('0x4b')]){_0x1416de[_0xd22d('0x4c')]=[{'all':!![]}];}_0x1416de=_['merge']({},_0x1416de,_0xa3b8ec['options']);return db[_0xd22d('0x35')][_0xd22d('0x52')](_0x1416de)[_0xd22d('0x1d')](handleEntityNotFound(_0x5ebcc5,null))['then'](respondWithResult(_0x5ebcc5,null))[_0xd22d('0x4f')](handleError(_0x5ebcc5,null));};exports[_0xd22d('0x53')]=function(_0x363d68,_0x2b4a24){return db[_0xd22d('0x35')][_0xd22d('0x53')](_0x363d68[_0xd22d('0x54')],{})[_0xd22d('0x1d')](respondWithResult(_0x2b4a24,0xc9))[_0xd22d('0x4f')](handleError(_0x2b4a24,null));};exports[_0xd22d('0x30')]=function(_0x4c78a8,_0x441b9d){if(_0x4c78a8[_0xd22d('0x54')]['id']){delete _0x4c78a8[_0xd22d('0x54')]['id'];}return db[_0xd22d('0x35')][_0xd22d('0x52')]({'where':{'id':_0x4c78a8['params']['id']}})[_0xd22d('0x1d')](handleEntityNotFound(_0x441b9d,null))[_0xd22d('0x1d')](saveUpdates(_0x4c78a8[_0xd22d('0x54')],null))[_0xd22d('0x1d')](respondWithResult(_0x441b9d,null))[_0xd22d('0x4f')](handleError(_0x441b9d,null));};exports[_0xd22d('0x55')]=function(_0x18f3fb,_0x5dbd0e){return db[_0xd22d('0x35')][_0xd22d('0x52')]({'where':{'id':_0x18f3fb[_0xd22d('0x51')]['id']}})[_0xd22d('0x1d')](handleEntityNotFound(_0x5dbd0e,null))[_0xd22d('0x1d')](removeEntity(_0x5dbd0e,null))[_0xd22d('0x4f')](handleError(_0x5dbd0e,null));};exports['getConfigurations']=function(_0x65ebc1,_0x5439f6,_0x2cb827){var _0x3f43dc={};var _0x1ac60d={};var _0x50407f;var _0x1da73a;return db['VtigerAccount']['findOne']({'where':{'id':_0x65ebc1[_0xd22d('0x51')]['id']}})[_0xd22d('0x1d')](handleEntityNotFound(_0x5439f6,null))[_0xd22d('0x1d')](function(_0x2b1068){if(_0x2b1068){_0x50407f=_0x2b1068;_0x1ac60d[_0xd22d('0x3a')]=_[_0xd22d('0x37')](db[_0xd22d('0x56')][_0xd22d('0x36')]);_0x1ac60d[_0xd22d('0x38')]=_['keys'](_0x65ebc1['query']);_0x1ac60d[_0xd22d('0x39')]=_[_0xd22d('0x3b')](_0x1ac60d['model'],_0x1ac60d[_0xd22d('0x38')]);_0x3f43dc[_0xd22d('0x3d')]=_[_0xd22d('0x3b')](_0x1ac60d[_0xd22d('0x3a')],qs[_0xd22d('0x3c')](_0x65ebc1['query'][_0xd22d('0x3c')]));_0x3f43dc[_0xd22d('0x3d')]=_0x3f43dc['attributes'][_0xd22d('0x3e')]?_0x3f43dc[_0xd22d('0x3d')]:_0x1ac60d['model'];_0x3f43dc[_0xd22d('0x42')]=qs['sort'](_0x65ebc1[_0xd22d('0x38')]['sort']);_0x3f43dc['where']=qs[_0xd22d('0x39')](_[_0xd22d('0x45')](_0x65ebc1['query'],_0x1ac60d[_0xd22d('0x39')]));if(_0x65ebc1[_0xd22d('0x38')][_0xd22d('0x49')]){_0x3f43dc[_0xd22d('0x44')]=_[_0xd22d('0x4a')](_0x3f43dc['where'],{'$or':_[_0xd22d('0x46')](_0x3f43dc[_0xd22d('0x3d')],function(_0x542830){var _0x2a88d3={};_0x2a88d3[_0x542830]={'$like':'%'+_0x65ebc1[_0xd22d('0x38')][_0xd22d('0x49')]+'%'};return _0x2a88d3;})});}_0x3f43dc=_[_0xd22d('0x4a')]({},_0x3f43dc,_0x65ebc1['options']);return _0x50407f[_0xd22d('0x57')](_0x3f43dc);}})['then'](function(_0x31c8b3){if(_0x31c8b3){_0x1da73a=_0x31c8b3[_0xd22d('0x3e')];if(!_0x65ebc1[_0xd22d('0x38')]['hasOwnProperty'](_0xd22d('0x40'))){_0x3f43dc[_0xd22d('0x41')]=qs['limit'](_0x65ebc1['query'][_0xd22d('0x41')]);_0x3f43dc[_0xd22d('0x2b')]=qs[_0xd22d('0x2b')](_0x65ebc1['query']['offset']);}return _0x50407f[_0xd22d('0x57')](_0x3f43dc);}})['then'](function(_0x188bb8){if(_0x188bb8){return _0x188bb8?{'count':_0x1da73a,'rows':_0x188bb8}:null;}})['then'](respondWithResult(_0x5439f6,null))[_0xd22d('0x4f')](handleError(_0x5439f6,null));};exports[_0xd22d('0x58')]=function(_0x2cddc,_0x8f1a50,_0x50afc2){if(_0x2cddc[_0xd22d('0x54')]['id']){delete _0x2cddc['body']['id'];}return db[_0xd22d('0x35')][_0xd22d('0x59')]({'where':{'id':_0x2cddc['params']['id']}})[_0xd22d('0x1d')](handleEntityNotFound(_0x8f1a50,null))[_0xd22d('0x1d')](function(_0xb8c946){if(_0xb8c946){_0x2cddc['body'][_0xd22d('0x5a')]=_0xb8c946['id'];_0x2cddc['body']['Subjects']=integrations[_0xd22d('0x5b')](_0x2cddc['body'][_0xd22d('0x5c')],_0x2cddc[_0xd22d('0x54')][_0xd22d('0x47')]);_0x2cddc[_0xd22d('0x54')]['Descriptions']=integrations[_0xd22d('0x5d')](_0x2cddc[_0xd22d('0x54')][_0xd22d('0x5c')],_0x2cddc['body'][_0xd22d('0x47')]);return db[_0xd22d('0x56')][_0xd22d('0x53')](_0x2cddc[_0xd22d('0x54')],{'include':[{'model':db[_0xd22d('0x5e')],'as':_0xd22d('0x5f')},{'model':db['VtigerField'],'as':_0xd22d('0x60')}]});}return null;})[_0xd22d('0x1d')](respondWithResult(_0x8f1a50,null))[_0xd22d('0x4f')](handleError(_0x8f1a50,null));};var md5=require(_0xd22d('0x61'));exports[_0xd22d('0x62')]=function(_0x1e8a84,_0x3aee1f,_0x3e9612){var _0x248f13=null;var _0x1b3259=null;var _0x18a7b1=null;var _0x458860=null;var _0xe0c7ab='';return db[_0xd22d('0x35')][_0xd22d('0x59')]({'where':{'id':_0x1e8a84['params']['id']},'attributes':['id',_0xd22d('0x32'),_0xd22d('0x63'),'description','moduleName',_0xd22d('0x64'),_0xd22d('0x65'),_0xd22d('0x66')]})[_0xd22d('0x1d')](handleEntityNotFound(_0x3aee1f,null))[_0xd22d('0x1d')](function(_0x37ad4c){if(_0x37ad4c){_0x248f13=_0x37ad4c[_0xd22d('0x63')];_0x1b3259=_0x37ad4c['accessKey'];_0x18a7b1=_0x37ad4c[_0xd22d('0x67')];_0xe0c7ab=_0x37ad4c[_0xd22d('0x64')];var _0x128518=_0xe0c7ab[_0xd22d('0x68')](-0x1);if(_0x128518==='/'){_0xe0c7ab=_0xe0c7ab[_0xd22d('0x69')](0x0,_0xe0c7ab['lastIndexOf'](_0x128518));}_0x458860=util['format']('%s/webservice.php',_0xe0c7ab);var _0x22e0d0={'method':'GET','uri':_0x458860,'qs':{'operation':'getchallenge','username':_0x37ad4c['username']},'json':!![]};return rp(_0x22e0d0);}})['then'](function(_0x862d60){if(_0x862d60['success']){var _0x332a48={'method':_0xd22d('0x6a'),'uri':_0x458860,'form':{'operation':_0xd22d('0x6b'),'username':_0x248f13,'accessKey':md5(_0x862d60['result'][_0xd22d('0x6c')]+_0x1b3259)},'json':!![]};return rp(_0x332a48);}})[_0xd22d('0x1d')](function(_0x2cdff1){if(_0x2cdff1[_0xd22d('0x6d')]){var _0x45103e={'method':'GET','uri':_0x458860,'qs':{'operation':'describe','username':_0x248f13,'sessionName':_0x2cdff1['result']['sessionName'],'elementType':_0x18a7b1},'json':!![]};return rp(_0x45103e);}})[_0xd22d('0x1d')](function(_0x111a26){if(_0x111a26[_0xd22d('0x6d')]){var _0x13f188=[_0xd22d('0x6e'),_0xd22d('0x6f'),'owner'];_['remove'](_0x111a26['result'][_0xd22d('0x3c')],function(_0x422405){return _0x13f188[_0xd22d('0x70')](_0x422405[_0xd22d('0x47')][_0xd22d('0x32')]);});_[_0xd22d('0x71')](_0x111a26[_0xd22d('0x25')][_0xd22d('0x3c')],function(_0x490cf5){return _0x490cf5[_0xd22d('0x72')]===_0xd22d('0x73');});return{'count':_0x111a26[_0xd22d('0x25')][_0xd22d('0x3c')]['length'],'rows':_['map'](_0x111a26[_0xd22d('0x25')][_0xd22d('0x3c')],function(_0x7faad1){return{'id':_0x7faad1[_0xd22d('0x32')],'name':_0x7faad1[_0xd22d('0x74')],'custom':_[_0xd22d('0x75')](_0x7faad1[_0xd22d('0x32')],_0xd22d('0x76'))?!![]:![],'options':_0x7faad1[_0xd22d('0x47')][_0xd22d('0x32')]===_0xd22d('0x77')&&_0x7faad1['type']['picklistValues']['length']>0x0?_[_0xd22d('0x46')](_0x7faad1[_0xd22d('0x47')][_0xd22d('0x78')],function(_0x5ec4a5){return{'name':_0x5ec4a5[_0xd22d('0x74')],'value':_0x5ec4a5['value']};}):[]};})};}})['then'](respondWithResult(_0x3aee1f,null))[_0xd22d('0x4f')](function(_0x579159){console['log'](_0xd22d('0x79')+_0x579159);var _0x3b17d5=_0x1e8a84['query'][_0xd22d('0x7a')]?0x1f4:_0x579159[_0xd22d('0x7b')]||0x1f4;logger[_0xd22d('0x20')](_0xd22d('0x7c'),_0xd22d('0x62'),_0x3b17d5,JSON[_0xd22d('0x1f')](_0x579159));delete _0x579159[_0xd22d('0x32')];if(_0x3b17d5===0x191){_0x3b17d5=0x190;}_0x3aee1f[_0xd22d('0x27')](_0x3b17d5)[_0xd22d('0x33')](_0x1e8a84[_0xd22d('0x38')][_0xd22d('0x7a')]?{'message':_0xd22d('0x7d'),'statusCode':_0x579159[_0xd22d('0x7b')]}:_0x579159);});}; \ No newline at end of file +var _0xeb08=['serverUrl','accessKey','slice','substring','lastIndexOf','GET','getchallenge','success','POST','token','describe','sessionName','owner','remove','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','test','ValidationError','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','stack','name','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','map','type','VIRTUAL','options','VtigerAccount','includeAll','findAll','rows','show','params','include','create','body','find','destroy','findOne','VtigerConfiguration','getConfigurations','nolimit','addConfiguration','getSubjects','channel','Descriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb08,0x92));var _0x8eb0=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0xeb08[_0x1d39f6];return _0x3dbd7a;};'use strict';var pdf=require(_0x8eb0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8eb0('0x1'));var zipdir=require(_0x8eb0('0x2'));var jsonpatch=require(_0x8eb0('0x3'));var rp=require('request-promise');var moment=require(_0x8eb0('0x4'));var BPromise=require(_0x8eb0('0x5'));var Mustache=require(_0x8eb0('0x6'));var util=require(_0x8eb0('0x7'));var path=require('path');var sox=require(_0x8eb0('0x8'));var csv=require(_0x8eb0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8eb0('0xa'));var crypto=require(_0x8eb0('0xb'));var jsforce=require(_0x8eb0('0xc'));var deskjs=require(_0x8eb0('0xd'));var toCsv=require(_0x8eb0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8eb0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8eb0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eb0('0x10'))(_0x8eb0('0x11'));var utils=require(_0x8eb0('0x12'));var config=require(_0x8eb0('0x13'));var db=require(_0x8eb0('0x14'))['db'];var integrations=require(_0x8eb0('0x15'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8eb0('0x16')]({'port':0x232a});function checkPasswordPattern(_0x558d65,_0x52f7e7,_0x5dde57){if(_0x5dde57){var _0x3ce18c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ce18c[_0x8eb0('0x17')](_0x52f7e7)){return _0x558d65;}else{throw new db['Sequelize'][(_0x8eb0('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 _0x558d65;}}function respondWithRpcPromise(_0x3f2a47,_0x34c152,_0x45e7e2,_0xecbcee){return new BPromise(function(_0x2e1c60,_0x21d2ef){var _0x35d9f2=_0xecbcee||client;return _0x35d9f2['request'](_0x3f2a47,_0x45e7e2)['then'](function(_0x3dde27){logger[_0x8eb0('0x19')](_0x8eb0('0x1a'),_0x34c152,_0x8eb0('0x1b'));logger[_0x8eb0('0x1c')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x34c152,_0x8eb0('0x1b'),JSON[_0x8eb0('0x1d')](_0x3dde27));if(_0x3dde27[_0x8eb0('0x1e')]){if(_0x3dde27[_0x8eb0('0x1e')][_0x8eb0('0x1f')]===0x1f4){logger[_0x8eb0('0x1e')](_0x8eb0('0x1a'),_0x34c152,_0x3dde27['error'][_0x8eb0('0x20')]);return _0x21d2ef(_0x3dde27[_0x8eb0('0x1e')]['message']);}logger['error'](_0x8eb0('0x1a'),_0x34c152,_0x3dde27[_0x8eb0('0x1e')][_0x8eb0('0x20')]);return _0x2e1c60(_0x3dde27['error'][_0x8eb0('0x20')]);}else{logger[_0x8eb0('0x19')](_0x8eb0('0x1a'),_0x34c152,_0x8eb0('0x1b'));_0x2e1c60(_0x3dde27[_0x8eb0('0x21')][_0x8eb0('0x20')]);}})[_0x8eb0('0x22')](function(_0x164337){logger['error'](_0x8eb0('0x1a'),_0x34c152,_0x164337);_0x21d2ef(_0x164337);});});}function respondWithStatusCode(_0x3761ab,_0x5e26e1){_0x5e26e1=_0x5e26e1||0xcc;return function(_0x2163cb){if(_0x2163cb){return _0x3761ab[_0x8eb0('0x23')](_0x5e26e1);}return _0x3761ab[_0x8eb0('0x24')](_0x5e26e1)[_0x8eb0('0x25')]();};}function respondWithResult(_0x43c4ff,_0x1bd142){_0x1bd142=_0x1bd142||0xc8;return function(_0x12f258){if(_0x12f258){return _0x43c4ff[_0x8eb0('0x24')](_0x1bd142)['json'](_0x12f258);}};}function respondWithFilteredResult(_0x2cbe50,_0x41c6c8){return function(_0x4d3087){if(_0x4d3087){var _0x1d1e7a=_0x4d3087[_0x8eb0('0x26')],_0x514557=_0x41c6c8[_0x8eb0('0x27')],_0x519026=_0x41c6c8[_0x8eb0('0x27')]+_0x41c6c8[_0x8eb0('0x28')],_0x3b17c5;if(_0x519026>=_0x1d1e7a){_0x519026=_0x1d1e7a;_0x3b17c5=0xc8;}else{_0x3b17c5=0xce;}_0x2cbe50[_0x8eb0('0x24')](_0x3b17c5);return _0x2cbe50[_0x8eb0('0x29')](_0x8eb0('0x2a'),_0x514557+'-'+_0x519026+'/'+_0x1d1e7a)[_0x8eb0('0x2b')](_0x4d3087);}return null;};}function patchUpdates(_0x3f8172){return function(_0x5ea1d4){try{jsonpatch['apply'](_0x5ea1d4,_0x3f8172,!![]);}catch(_0x4bd18f){return BPromise[_0x8eb0('0x2c')](_0x4bd18f);}return _0x5ea1d4[_0x8eb0('0x2d')]();};}function saveUpdates(_0x34d40e,_0x389f67){return function(_0xc2bad8){if(_0xc2bad8){return _0xc2bad8[_0x8eb0('0x2e')](_0x34d40e)[_0x8eb0('0x2f')](function(_0x2f1951){return _0x2f1951;});}return null;};}function removeEntity(_0x14b2b3,_0x26d786){return function(_0x4f6c2d){if(_0x4f6c2d){return _0x4f6c2d['destroy']()['then'](function(){_0x14b2b3[_0x8eb0('0x24')](0xcc)[_0x8eb0('0x25')]();});}};}function handleEntityNotFound(_0x26ae7d,_0x1ee064){return function(_0x3e0806){if(!_0x3e0806){_0x26ae7d[_0x8eb0('0x23')](0x194);}return _0x3e0806;};}function handleError(_0x3bd44f,_0xc3916){_0xc3916=_0xc3916||0x1f4;return function(_0x50c060){logger[_0x8eb0('0x1e')](_0x50c060[_0x8eb0('0x30')]);if(_0x50c060[_0x8eb0('0x31')]){delete _0x50c060[_0x8eb0('0x31')];}_0x3bd44f['status'](_0xc3916)[_0x8eb0('0x32')](_0x50c060);};}exports['index']=function(_0x4c5448,_0x17506b){var _0x50ee99={},_0x4ce450={},_0x311c76={'count':0x0,'rows':[]};var _0x1638e3=db['VtigerAccount'][_0x8eb0('0x33')];_0x4ce450[_0x8eb0('0x34')]=_[_0x8eb0('0x35')](_0x1638e3);_0x4ce450[_0x8eb0('0x36')]=_[_0x8eb0('0x35')](_0x4c5448[_0x8eb0('0x36')]);_0x4ce450[_0x8eb0('0x37')]=_[_0x8eb0('0x38')](_0x4ce450[_0x8eb0('0x34')],_0x4ce450['query']);_0x50ee99[_0x8eb0('0x39')]=_[_0x8eb0('0x38')](_0x4ce450[_0x8eb0('0x34')],qs[_0x8eb0('0x3a')](_0x4c5448['query'][_0x8eb0('0x3a')]));_0x50ee99[_0x8eb0('0x39')]=_0x50ee99[_0x8eb0('0x39')][_0x8eb0('0x3b')]?_0x50ee99['attributes']:_0x4ce450[_0x8eb0('0x34')];if(!_0x4c5448[_0x8eb0('0x36')][_0x8eb0('0x3c')]('nolimit')){_0x50ee99['limit']=qs['limit'](_0x4c5448[_0x8eb0('0x36')]['limit']);_0x50ee99[_0x8eb0('0x27')]=qs['offset'](_0x4c5448[_0x8eb0('0x36')][_0x8eb0('0x27')]);}_0x50ee99[_0x8eb0('0x3d')]=qs['sort'](_0x4c5448[_0x8eb0('0x36')][_0x8eb0('0x3e')]);_0x50ee99['where']=qs[_0x8eb0('0x37')](_['pick'](_0x4c5448[_0x8eb0('0x36')],_0x4ce450[_0x8eb0('0x37')]));if(_0x4c5448[_0x8eb0('0x36')][_0x8eb0('0x3f')]){_0x50ee99['where']=_[_0x8eb0('0x40')](_0x50ee99[_0x8eb0('0x41')],{'$or':_[_0x8eb0('0x42')](_0x1638e3,function(_0x3b0bd6){if(_0x3b0bd6[_0x8eb0('0x43')]['key']!==_0x8eb0('0x44')){var _0x44120a={};_0x44120a[_0x3b0bd6['field']]={'$like':'%'+_0x4c5448[_0x8eb0('0x36')][_0x8eb0('0x3f')]+'%'};return _0x44120a;}})});}_0x50ee99=_[_0x8eb0('0x40')]({},_0x50ee99,_0x4c5448[_0x8eb0('0x45')]);var _0x101e7f={'where':_0x50ee99['where']};return db[_0x8eb0('0x46')]['count'](_0x101e7f)['then'](function(_0x4af06f){_0x311c76[_0x8eb0('0x26')]=_0x4af06f;if(_0x4c5448['query'][_0x8eb0('0x47')]){_0x50ee99['include']=[{'all':!![]}];}return db[_0x8eb0('0x46')][_0x8eb0('0x48')](_0x50ee99);})[_0x8eb0('0x2f')](function(_0x5d7a47){_0x311c76[_0x8eb0('0x49')]=_0x5d7a47;return _0x311c76;})[_0x8eb0('0x2f')](respondWithFilteredResult(_0x17506b,_0x50ee99))['catch'](handleError(_0x17506b,null));};exports[_0x8eb0('0x4a')]=function(_0x5e196e,_0x151fa8){var _0x5eb1cd={'raw':![],'where':{'id':_0x5e196e[_0x8eb0('0x4b')]['id']}},_0xca2dc9={};_0xca2dc9[_0x8eb0('0x34')]=_['keys'](db['VtigerAccount'][_0x8eb0('0x33')]);_0xca2dc9[_0x8eb0('0x36')]=_[_0x8eb0('0x35')](_0x5e196e[_0x8eb0('0x36')]);_0xca2dc9[_0x8eb0('0x37')]=_[_0x8eb0('0x38')](_0xca2dc9[_0x8eb0('0x34')],_0xca2dc9[_0x8eb0('0x36')]);_0x5eb1cd[_0x8eb0('0x39')]=_[_0x8eb0('0x38')](_0xca2dc9[_0x8eb0('0x34')],qs['fields'](_0x5e196e[_0x8eb0('0x36')][_0x8eb0('0x3a')]));_0x5eb1cd['attributes']=_0x5eb1cd[_0x8eb0('0x39')][_0x8eb0('0x3b')]?_0x5eb1cd[_0x8eb0('0x39')]:_0xca2dc9[_0x8eb0('0x34')];if(_0x5e196e[_0x8eb0('0x36')][_0x8eb0('0x47')]){_0x5eb1cd[_0x8eb0('0x4c')]=[{'all':!![]}];}_0x5eb1cd=_[_0x8eb0('0x40')]({},_0x5eb1cd,_0x5e196e[_0x8eb0('0x45')]);return db['VtigerAccount']['find'](_0x5eb1cd)[_0x8eb0('0x2f')](handleEntityNotFound(_0x151fa8,null))[_0x8eb0('0x2f')](respondWithResult(_0x151fa8,null))[_0x8eb0('0x22')](handleError(_0x151fa8,null));};exports[_0x8eb0('0x4d')]=function(_0x1345c5,_0x222afa){return db[_0x8eb0('0x46')][_0x8eb0('0x4d')](_0x1345c5[_0x8eb0('0x4e')],{})[_0x8eb0('0x2f')](respondWithResult(_0x222afa,0xc9))[_0x8eb0('0x22')](handleError(_0x222afa,null));};exports[_0x8eb0('0x2e')]=function(_0x234e79,_0x4ec92f){if(_0x234e79['body']['id']){delete _0x234e79[_0x8eb0('0x4e')]['id'];}return db[_0x8eb0('0x46')][_0x8eb0('0x4f')]({'where':{'id':_0x234e79[_0x8eb0('0x4b')]['id']}})[_0x8eb0('0x2f')](handleEntityNotFound(_0x4ec92f,null))[_0x8eb0('0x2f')](saveUpdates(_0x234e79[_0x8eb0('0x4e')],null))[_0x8eb0('0x2f')](respondWithResult(_0x4ec92f,null))[_0x8eb0('0x22')](handleError(_0x4ec92f,null));};exports[_0x8eb0('0x50')]=function(_0x511be0,_0x48ae52){return db[_0x8eb0('0x46')][_0x8eb0('0x4f')]({'where':{'id':_0x511be0['params']['id']}})['then'](handleEntityNotFound(_0x48ae52,null))[_0x8eb0('0x2f')](removeEntity(_0x48ae52,null))['catch'](handleError(_0x48ae52,null));};exports['getConfigurations']=function(_0x1a228e,_0x5885fe,_0x4f5f3e){var _0xb71c94={};var _0x590c07={};var _0x4f6fcc;var _0x45a739;return db['VtigerAccount'][_0x8eb0('0x51')]({'where':{'id':_0x1a228e[_0x8eb0('0x4b')]['id']}})[_0x8eb0('0x2f')](handleEntityNotFound(_0x5885fe,null))[_0x8eb0('0x2f')](function(_0x1da8ec){if(_0x1da8ec){_0x4f6fcc=_0x1da8ec;_0x590c07[_0x8eb0('0x34')]=_[_0x8eb0('0x35')](db[_0x8eb0('0x52')][_0x8eb0('0x33')]);_0x590c07[_0x8eb0('0x36')]=_['keys'](_0x1a228e[_0x8eb0('0x36')]);_0x590c07[_0x8eb0('0x37')]=_['intersection'](_0x590c07['model'],_0x590c07['query']);_0xb71c94[_0x8eb0('0x39')]=_['intersection'](_0x590c07[_0x8eb0('0x34')],qs['fields'](_0x1a228e[_0x8eb0('0x36')][_0x8eb0('0x3a')]));_0xb71c94['attributes']=_0xb71c94[_0x8eb0('0x39')]['length']?_0xb71c94[_0x8eb0('0x39')]:_0x590c07['model'];_0xb71c94[_0x8eb0('0x3d')]=qs[_0x8eb0('0x3e')](_0x1a228e[_0x8eb0('0x36')][_0x8eb0('0x3e')]);_0xb71c94[_0x8eb0('0x41')]=qs[_0x8eb0('0x37')](_['pick'](_0x1a228e[_0x8eb0('0x36')],_0x590c07['filters']));if(_0x1a228e[_0x8eb0('0x36')][_0x8eb0('0x3f')]){_0xb71c94[_0x8eb0('0x41')]=_[_0x8eb0('0x40')](_0xb71c94[_0x8eb0('0x41')],{'$or':_[_0x8eb0('0x42')](_0xb71c94[_0x8eb0('0x39')],function(_0xc47e64){var _0x364eb1={};_0x364eb1[_0xc47e64]={'$like':'%'+_0x1a228e[_0x8eb0('0x36')]['filter']+'%'};return _0x364eb1;})});}_0xb71c94=_[_0x8eb0('0x40')]({},_0xb71c94,_0x1a228e[_0x8eb0('0x45')]);return _0x4f6fcc[_0x8eb0('0x53')](_0xb71c94);}})[_0x8eb0('0x2f')](function(_0x4087d8){if(_0x4087d8){_0x45a739=_0x4087d8['length'];if(!_0x1a228e[_0x8eb0('0x36')][_0x8eb0('0x3c')](_0x8eb0('0x54'))){_0xb71c94[_0x8eb0('0x28')]=qs[_0x8eb0('0x28')](_0x1a228e['query'][_0x8eb0('0x28')]);_0xb71c94[_0x8eb0('0x27')]=qs[_0x8eb0('0x27')](_0x1a228e[_0x8eb0('0x36')][_0x8eb0('0x27')]);}return _0x4f6fcc['getConfigurations'](_0xb71c94);}})['then'](function(_0x7547a){if(_0x7547a){return _0x7547a?{'count':_0x45a739,'rows':_0x7547a}:null;}})['then'](respondWithResult(_0x5885fe,null))[_0x8eb0('0x22')](handleError(_0x5885fe,null));};exports[_0x8eb0('0x55')]=function(_0x3142d0,_0x59f060,_0x3ee7be){if(_0x3142d0['body']['id']){delete _0x3142d0['body']['id'];}return db[_0x8eb0('0x46')]['findOne']({'where':{'id':_0x3142d0['params']['id']}})['then'](handleEntityNotFound(_0x59f060,null))[_0x8eb0('0x2f')](function(_0x3e36d8){if(_0x3e36d8){_0x3142d0[_0x8eb0('0x4e')]['AccountId']=_0x3e36d8['id'];_0x3142d0[_0x8eb0('0x4e')]['Subjects']=integrations[_0x8eb0('0x56')](_0x3142d0[_0x8eb0('0x4e')][_0x8eb0('0x57')],_0x3142d0[_0x8eb0('0x4e')][_0x8eb0('0x43')]);_0x3142d0[_0x8eb0('0x4e')][_0x8eb0('0x58')]=integrations['getDescriptions'](_0x3142d0[_0x8eb0('0x4e')][_0x8eb0('0x57')],_0x3142d0[_0x8eb0('0x4e')]['type']);return db[_0x8eb0('0x52')][_0x8eb0('0x4d')](_0x3142d0[_0x8eb0('0x4e')],{'include':[{'model':db[_0x8eb0('0x59')],'as':_0x8eb0('0x5a')},{'model':db['VtigerField'],'as':_0x8eb0('0x58')}]});}return null;})['then'](respondWithResult(_0x59f060,null))[_0x8eb0('0x22')](handleError(_0x59f060,null));};var md5=require('md5');exports[_0x8eb0('0x5b')]=function(_0x4fccde,_0xc730bf,_0x5494cd){var _0x16a38c=null;var _0x1d08ec=null;var _0x2fddb1=null;var _0x29cd4a=null;var _0x33e610='';return db[_0x8eb0('0x46')]['findOne']({'where':{'id':_0x4fccde[_0x8eb0('0x4b')]['id']},'attributes':['id',_0x8eb0('0x31'),_0x8eb0('0x5c'),_0x8eb0('0x5d'),_0x8eb0('0x5e'),_0x8eb0('0x5f'),_0x8eb0('0x60'),_0x8eb0('0x61')]})['then'](handleEntityNotFound(_0xc730bf,null))[_0x8eb0('0x2f')](function(_0x2363a1){if(_0x2363a1){_0x16a38c=_0x2363a1[_0x8eb0('0x5c')];_0x1d08ec=_0x2363a1[_0x8eb0('0x61')];_0x2fddb1=_0x2363a1['moduleName'];_0x33e610=_0x2363a1['remoteUri'];var _0x453317=_0x33e610[_0x8eb0('0x62')](-0x1);if(_0x453317==='/'){_0x33e610=_0x33e610[_0x8eb0('0x63')](0x0,_0x33e610[_0x8eb0('0x64')](_0x453317));}_0x29cd4a=util['format']('%s/webservice.php',_0x33e610);var _0x11de74={'method':_0x8eb0('0x65'),'uri':_0x29cd4a,'qs':{'operation':_0x8eb0('0x66'),'username':_0x2363a1[_0x8eb0('0x5c')]},'json':!![]};return rp(_0x11de74);}})[_0x8eb0('0x2f')](function(_0x1029dd){if(_0x1029dd[_0x8eb0('0x67')]){var _0xb2eae8={'method':_0x8eb0('0x68'),'uri':_0x29cd4a,'form':{'operation':'login','username':_0x16a38c,'accessKey':md5(_0x1029dd[_0x8eb0('0x21')][_0x8eb0('0x69')]+_0x1d08ec)},'json':!![]};return rp(_0xb2eae8);}})['then'](function(_0x46bbc7){if(_0x46bbc7[_0x8eb0('0x67')]){var _0x5f4244={'method':_0x8eb0('0x65'),'uri':_0x29cd4a,'qs':{'operation':_0x8eb0('0x6a'),'username':_0x16a38c,'sessionName':_0x46bbc7[_0x8eb0('0x21')][_0x8eb0('0x6b')],'elementType':_0x2fddb1},'json':!![]};return rp(_0x5f4244);}})[_0x8eb0('0x2f')](function(_0x16b391){if(_0x16b391[_0x8eb0('0x67')]){var _0x342495=['autogenerated','reference',_0x8eb0('0x6c')];_[_0x8eb0('0x6d')](_0x16b391[_0x8eb0('0x21')]['fields'],function(_0x5b80d9){return _0x342495['includes'](_0x5b80d9[_0x8eb0('0x43')][_0x8eb0('0x31')]);});_[_0x8eb0('0x6d')](_0x16b391[_0x8eb0('0x21')][_0x8eb0('0x3a')],function(_0x151ea0){return _0x151ea0['editable']===_0x8eb0('0x6e');});return{'count':_0x16b391[_0x8eb0('0x21')][_0x8eb0('0x3a')][_0x8eb0('0x3b')],'rows':_[_0x8eb0('0x42')](_0x16b391[_0x8eb0('0x21')][_0x8eb0('0x3a')],function(_0x4d50b9){return{'id':_0x4d50b9[_0x8eb0('0x31')],'name':_0x4d50b9[_0x8eb0('0x6f')],'custom':_[_0x8eb0('0x70')](_0x4d50b9[_0x8eb0('0x31')],_0x8eb0('0x71'))?!![]:![],'options':_0x4d50b9[_0x8eb0('0x43')][_0x8eb0('0x31')]===_0x8eb0('0x72')&&_0x4d50b9['type'][_0x8eb0('0x73')][_0x8eb0('0x3b')]>0x0?_[_0x8eb0('0x42')](_0x4d50b9[_0x8eb0('0x43')][_0x8eb0('0x73')],function(_0x49cfb7){return{'name':_0x49cfb7[_0x8eb0('0x6f')],'value':_0x49cfb7[_0x8eb0('0x74')]};}):[]};})};}})[_0x8eb0('0x2f')](respondWithResult(_0xc730bf,null))[_0x8eb0('0x22')](function(_0x5db1e3){console['log'](_0x8eb0('0x75')+_0x5db1e3);var _0x372d95=_0x4fccde['query'][_0x8eb0('0x17')]?0x1f4:_0x5db1e3[_0x8eb0('0x76')]||0x1f4;logger['error'](_0x8eb0('0x77'),'getFields',_0x372d95,JSON[_0x8eb0('0x1d')](_0x5db1e3));delete _0x5db1e3[_0x8eb0('0x31')];if(_0x372d95===0x191){_0x372d95=0x190;}_0xc730bf[_0x8eb0('0x24')](_0x372d95)[_0x8eb0('0x32')](_0x4fccde[_0x8eb0('0x36')][_0x8eb0('0x17')]?{'message':_0x8eb0('0x78'),'statusCode':_0x5db1e3[_0x8eb0('0x76')]}:_0x5db1e3);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f5d0208..ed742ed 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 _0x12fe=['rimraf','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x12fe,0x14f));var _0xe12f=function(_0x57d07c,_0x513070){_0x57d07c=_0x57d07c-0x0;var _0x514c42=_0x12fe[_0x57d07c];return _0x514c42;};'use strict';var _=require('lodash');var util=require(_0xe12f('0x0'));var logger=require(_0xe12f('0x1'))(_0xe12f('0x2'));var moment=require('moment');var BPromise=require(_0xe12f('0x3'));var rp=require(_0xe12f('0x4'));var fs=require('fs');var path=require(_0xe12f('0x5'));var rimraf=require(_0xe12f('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe12f('0x7')]=function(_0x2c77ad,_0x55bea8){return _0x2c77ad[_0xe12f('0x8')](_0xe12f('0x9'),attributes,{'tableName':_0xe12f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70d7=['moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api'];(function(_0x57524e,_0x236f11){var _0x4a0867=function(_0x472b27){while(--_0x472b27){_0x57524e['push'](_0x57524e['shift']());}};_0x4a0867(++_0x236f11);}(_0x70d7,0xc1));var _0x770d=function(_0x11ae05,_0xb34f47){_0x11ae05=_0x11ae05-0x0;var _0x239c2f=_0x70d7[_0x11ae05];return _0x239c2f;};'use strict';var _=require(_0x770d('0x0'));var util=require('util');var logger=require(_0x770d('0x1'))(_0x770d('0x2'));var moment=require(_0x770d('0x3'));var BPromise=require(_0x770d('0x4'));var rp=require(_0x770d('0x5'));var fs=require('fs');var path=require(_0x770d('0x6'));var rimraf=require(_0x770d('0x7'));var config=require('../../config/environment');var attributes=require(_0x770d('0x8'));var integrations=require(_0x770d('0x9'));module[_0x770d('0xa')]=function(_0x4ae5f0,_0x115525){return _0x4ae5f0[_0x770d('0xb')](_0x770d('0xc'),attributes,{'tableName':_0x770d('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 86355df..b75f003 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 _0xd133=['GetVtigerAccount','ShowVtigerAccount','debug','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VtigerAccount','options','raw','where','attributes','limit','include','map','model'];(function(_0xd8baf3,_0x238fd0){var _0x492838=function(_0xaffd75){while(--_0xaffd75){_0xd8baf3['push'](_0xd8baf3['shift']());}};_0x492838(++_0x238fd0);}(_0xd133,0xa8));var _0x3d13=function(_0x75e866,_0x30b4de){_0x75e866=_0x75e866-0x0;var _0x5e4b64=_0xd133[_0x75e866];return _0x5e4b64;};'use strict';var _=require(_0x3d13('0x0'));var util=require(_0x3d13('0x1'));var moment=require('moment');var BPromise=require(_0x3d13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d13('0x3'));var db=require(_0x3d13('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d13('0x5'));var config=require(_0x3d13('0x6'));var jayson=require(_0x3d13('0x7'));var client=jayson[_0x3d13('0x8')][_0x3d13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x889c3c,_0x3caa5d,_0xe468b3){return new BPromise(function(_0x515ea7,_0x5bb29a){return client[_0x3d13('0xa')](_0x889c3c,_0xe468b3)[_0x3d13('0xb')](function(_0x2c537f){logger[_0x3d13('0xc')](_0x3d13('0xd'),_0x3caa5d,_0x3d13('0xe'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3caa5d,_0x3d13('0xe'),JSON[_0x3d13('0xf')](_0x2c537f));if(_0x2c537f[_0x3d13('0x10')]){if(_0x2c537f[_0x3d13('0x10')][_0x3d13('0x11')]===0x1f4){logger[_0x3d13('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x3caa5d,_0x2c537f['error'][_0x3d13('0x12')]);return _0x5bb29a(_0x2c537f[_0x3d13('0x10')][_0x3d13('0x12')]);}logger[_0x3d13('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x3caa5d,_0x2c537f[_0x3d13('0x10')][_0x3d13('0x12')]);return _0x515ea7(_0x2c537f[_0x3d13('0x10')][_0x3d13('0x12')]);}else{logger[_0x3d13('0xc')](_0x3d13('0xd'),_0x3caa5d,_0x3d13('0xe'));_0x515ea7(_0x2c537f[_0x3d13('0x13')][_0x3d13('0x12')]);}})[_0x3d13('0x14')](function(_0x37083d){logger['error'](_0x3d13('0xd'),_0x3caa5d,_0x37083d);_0x5bb29a(_0x37083d);});});}exports['GetVtigerAccount']=function(_0x132b3e){var _0x43c092=this;return new Promise(function(_0x10d028,_0x37f131){return db[_0x3d13('0x15')]['findAll']({'raw':_0x132b3e[_0x3d13('0x16')]?_0x132b3e['options'][_0x3d13('0x17')]===undefined?!![]:![]:!![],'where':_0x132b3e[_0x3d13('0x16')]?_0x132b3e[_0x3d13('0x16')][_0x3d13('0x18')]||null:null,'attributes':_0x132b3e[_0x3d13('0x16')]?_0x132b3e[_0x3d13('0x16')][_0x3d13('0x19')]||null:null,'limit':_0x132b3e[_0x3d13('0x16')]?_0x132b3e[_0x3d13('0x16')][_0x3d13('0x1a')]||null:null,'include':_0x132b3e[_0x3d13('0x16')]?_0x132b3e[_0x3d13('0x16')][_0x3d13('0x1b')]?_['map'](_0x132b3e[_0x3d13('0x16')][_0x3d13('0x1b')],function(_0x4de0cb){return{'model':db[_0x4de0cb['model']],'as':_0x4de0cb['as'],'attributes':_0x4de0cb[_0x3d13('0x19')],'include':_0x4de0cb[_0x3d13('0x1b')]?_[_0x3d13('0x1c')](_0x4de0cb[_0x3d13('0x1b')],function(_0x271e46){return{'model':db[_0x271e46[_0x3d13('0x1d')]],'as':_0x271e46['as'],'attributes':_0x271e46[_0x3d13('0x19')],'include':_0x271e46[_0x3d13('0x1b')]?_[_0x3d13('0x1c')](_0x271e46[_0x3d13('0x1b')],function(_0x53c50e){return{'model':db[_0x53c50e[_0x3d13('0x1d')]],'as':_0x53c50e['as'],'attributes':_0x53c50e[_0x3d13('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x424809){logger[_0x3d13('0xc')](_0x3d13('0x1e'),_0x132b3e);logger['debug'](_0x3d13('0x1e'),_0x132b3e,JSON[_0x3d13('0xf')](_0x424809));_0x10d028(_0x424809);})[_0x3d13('0x14')](function(_0x173b55){logger[_0x3d13('0x10')](_0x3d13('0x1e'),_0x173b55[_0x3d13('0x12')],_0x132b3e);_0x37f131(_0x43c092[_0x3d13('0x10')](0x1f4,_0x173b55[_0x3d13('0x12')]));});});};exports[_0x3d13('0x1f')]=function(_0x312204){var _0x206b4f=this;return new Promise(function(_0x5d3f46,_0x3bc42e){return db[_0x3d13('0x15')]['find']({'raw':_0x312204['options']?_0x312204[_0x3d13('0x16')][_0x3d13('0x17')]===undefined?!![]:![]:!![],'where':_0x312204[_0x3d13('0x16')]?_0x312204[_0x3d13('0x16')][_0x3d13('0x18')]||null:null,'attributes':_0x312204[_0x3d13('0x16')]?_0x312204['options'][_0x3d13('0x19')]||null:null,'include':_0x312204[_0x3d13('0x16')]?_0x312204[_0x3d13('0x16')][_0x3d13('0x1b')]?_['map'](_0x312204[_0x3d13('0x16')][_0x3d13('0x1b')],function(_0x439c11){return{'model':db[_0x439c11[_0x3d13('0x1d')]],'as':_0x439c11['as'],'attributes':_0x439c11[_0x3d13('0x19')],'include':_0x439c11['include']?_[_0x3d13('0x1c')](_0x439c11[_0x3d13('0x1b')],function(_0x49f1e2){return{'model':db[_0x49f1e2[_0x3d13('0x1d')]],'as':_0x49f1e2['as'],'attributes':_0x49f1e2[_0x3d13('0x19')],'include':_0x49f1e2[_0x3d13('0x1b')]?_[_0x3d13('0x1c')](_0x49f1e2[_0x3d13('0x1b')],function(_0x48cbc8){return{'model':db[_0x48cbc8[_0x3d13('0x1d')]],'as':_0x48cbc8['as'],'attributes':_0x48cbc8[_0x3d13('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3d13('0xb')](function(_0x4e7a46){logger[_0x3d13('0xc')](_0x3d13('0x1f'),_0x312204);logger[_0x3d13('0x20')](_0x3d13('0x1f'),_0x312204,JSON['stringify'](_0x4e7a46));_0x5d3f46(_0x4e7a46);})[_0x3d13('0x14')](function(_0x35b501){logger['error'](_0x3d13('0x1f'),_0x35b501[_0x3d13('0x12')],_0x312204);_0x3bc42e(_0x206b4f['error'](0x1f4,_0x35b501[_0x3d13('0x12')]));});});}; \ No newline at end of file +var _0x0ee5=['raw','where','attributes','limit','include','map','model','GetVtigerAccount','debug','ShowVtigerAccount','find','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','VtigerAccount','findAll','options'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x0ee5,0x1c5));var _0x50ee=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0ee5[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x50ee('0x0'));var moment=require(_0x50ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x50ee('0x2'));var fs=require('fs');var Redis=require(_0x50ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50ee('0x4'))(_0x50ee('0x5'));var config=require('../../config/environment');var jayson=require(_0x50ee('0x6'));var client=jayson[_0x50ee('0x7')][_0x50ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4793ac,_0x2eea2a,_0x1bacc1){return new BPromise(function(_0x50ce65,_0x2782dc){return client['request'](_0x4793ac,_0x1bacc1)[_0x50ee('0x9')](function(_0x8e459b){logger[_0x50ee('0xa')](_0x50ee('0xb'),_0x2eea2a,_0x50ee('0xc'));logger['debug'](_0x50ee('0xd'),_0x2eea2a,_0x50ee('0xc'),JSON[_0x50ee('0xe')](_0x8e459b));if(_0x8e459b['error']){if(_0x8e459b['error'][_0x50ee('0xf')]===0x1f4){logger[_0x50ee('0x10')](_0x50ee('0xb'),_0x2eea2a,_0x8e459b['error'][_0x50ee('0x11')]);return _0x2782dc(_0x8e459b['error'][_0x50ee('0x11')]);}logger[_0x50ee('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x2eea2a,_0x8e459b[_0x50ee('0x10')][_0x50ee('0x11')]);return _0x50ce65(_0x8e459b[_0x50ee('0x10')][_0x50ee('0x11')]);}else{logger[_0x50ee('0xa')](_0x50ee('0xb'),_0x2eea2a,_0x50ee('0xc'));_0x50ce65(_0x8e459b[_0x50ee('0x12')]['message']);}})[_0x50ee('0x13')](function(_0x2181d2){logger[_0x50ee('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x2eea2a,_0x2181d2);_0x2782dc(_0x2181d2);});});}exports['GetVtigerAccount']=function(_0x38154d){var _0x1b8319=this;return new Promise(function(_0x5b84d6,_0x1b7b1b){return db[_0x50ee('0x14')][_0x50ee('0x15')]({'raw':_0x38154d[_0x50ee('0x16')]?_0x38154d[_0x50ee('0x16')][_0x50ee('0x17')]===undefined?!![]:![]:!![],'where':_0x38154d[_0x50ee('0x16')]?_0x38154d[_0x50ee('0x16')][_0x50ee('0x18')]||null:null,'attributes':_0x38154d[_0x50ee('0x16')]?_0x38154d[_0x50ee('0x16')][_0x50ee('0x19')]||null:null,'limit':_0x38154d['options']?_0x38154d[_0x50ee('0x16')][_0x50ee('0x1a')]||null:null,'include':_0x38154d['options']?_0x38154d['options'][_0x50ee('0x1b')]?_[_0x50ee('0x1c')](_0x38154d[_0x50ee('0x16')][_0x50ee('0x1b')],function(_0x179d73){return{'model':db[_0x179d73[_0x50ee('0x1d')]],'as':_0x179d73['as'],'attributes':_0x179d73['attributes'],'include':_0x179d73[_0x50ee('0x1b')]?_[_0x50ee('0x1c')](_0x179d73[_0x50ee('0x1b')],function(_0x5167ec){return{'model':db[_0x5167ec[_0x50ee('0x1d')]],'as':_0x5167ec['as'],'attributes':_0x5167ec[_0x50ee('0x19')],'include':_0x5167ec['include']?_[_0x50ee('0x1c')](_0x5167ec[_0x50ee('0x1b')],function(_0x27844e){return{'model':db[_0x27844e[_0x50ee('0x1d')]],'as':_0x27844e['as'],'attributes':_0x27844e[_0x50ee('0x19')]};}):[]};}):[]};}):[]:[]})[_0x50ee('0x9')](function(_0x66eaa3){logger[_0x50ee('0xa')](_0x50ee('0x1e'),_0x38154d);logger[_0x50ee('0x1f')](_0x50ee('0x1e'),_0x38154d,JSON[_0x50ee('0xe')](_0x66eaa3));_0x5b84d6(_0x66eaa3);})[_0x50ee('0x13')](function(_0x2f9d21){logger[_0x50ee('0x10')](_0x50ee('0x1e'),_0x2f9d21[_0x50ee('0x11')],_0x38154d);_0x1b7b1b(_0x1b8319['error'](0x1f4,_0x2f9d21[_0x50ee('0x11')]));});});};exports[_0x50ee('0x20')]=function(_0x2bbe36){var _0x2a9a55=this;return new Promise(function(_0x107a78,_0x263ef6){return db[_0x50ee('0x14')][_0x50ee('0x21')]({'raw':_0x2bbe36[_0x50ee('0x16')]?_0x2bbe36[_0x50ee('0x16')][_0x50ee('0x17')]===undefined?!![]:![]:!![],'where':_0x2bbe36['options']?_0x2bbe36[_0x50ee('0x16')][_0x50ee('0x18')]||null:null,'attributes':_0x2bbe36['options']?_0x2bbe36[_0x50ee('0x16')]['attributes']||null:null,'include':_0x2bbe36[_0x50ee('0x16')]?_0x2bbe36['options'][_0x50ee('0x1b')]?_[_0x50ee('0x1c')](_0x2bbe36[_0x50ee('0x16')][_0x50ee('0x1b')],function(_0x1e60e8){return{'model':db[_0x1e60e8[_0x50ee('0x1d')]],'as':_0x1e60e8['as'],'attributes':_0x1e60e8[_0x50ee('0x19')],'include':_0x1e60e8['include']?_[_0x50ee('0x1c')](_0x1e60e8[_0x50ee('0x1b')],function(_0x7c8984){return{'model':db[_0x7c8984['model']],'as':_0x7c8984['as'],'attributes':_0x7c8984[_0x50ee('0x19')],'include':_0x7c8984['include']?_[_0x50ee('0x1c')](_0x7c8984[_0x50ee('0x1b')],function(_0x4850d2){return{'model':db[_0x4850d2['model']],'as':_0x4850d2['as'],'attributes':_0x4850d2[_0x50ee('0x19')]};}):[]};}):[]};}):[]:[]})[_0x50ee('0x9')](function(_0x4d695c){logger[_0x50ee('0xa')](_0x50ee('0x20'),_0x2bbe36);logger['debug'](_0x50ee('0x20'),_0x2bbe36,JSON['stringify'](_0x4d695c));_0x107a78(_0x4d695c);})[_0x50ee('0x13')](function(_0x4c2218){logger['error'](_0x50ee('0x20'),_0x4c2218['message'],_0x2bbe36);_0x263ef6(_0x2a9a55[_0x50ee('0x10')](0x1f4,_0x4c2218[_0x50ee('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1181b03..70f4d6e 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(_0x2c79d4,_0x4cda73){var _0x1504fc=function(_0xaec96e){while(--_0xaec96e){_0x2c79d4['push'](_0x2c79d4['shift']());}};_0x1504fc(++_0x4cda73);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a1d58,_0x42ab8d){_0x5a1d58=_0x5a1d58-0x0;var _0x5911a9=_0xb10b[_0x5a1d58];return _0x5911a9;};'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(_0x323f4b,_0x4da4ce){var _0x288ba9=function(_0x2c44a7){while(--_0x2c44a7){_0x323f4b['push'](_0x323f4b['shift']());}};_0x288ba9(++_0x4da4ce);}(_0xb10b,0x12a));var _0xbb10=function(_0x5276a4,_0x3eaa2d){_0x5276a4=_0x5276a4-0x0;var _0x58669b=_0xb10b[_0x5276a4];return _0x58669b;};'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 b0a3716..18da521 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 _0x7b8c=['sequelize','STRING'];(function(_0x534159,_0x4ee72f){var _0x203b07=function(_0x21256a){while(--_0x21256a){_0x534159['push'](_0x534159['shift']());}};_0x203b07(++_0x4ee72f);}(_0x7b8c,0x1f0));var _0xc7b8=function(_0x3b625c,_0x216e02){_0x3b625c=_0x3b625c-0x0;var _0x343425=_0x7b8c[_0x3b625c];return _0x343425;};'use strict';var Sequelize=require(_0xc7b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xc7b8('0x1')]},'description':{'type':Sequelize[_0xc7b8('0x1')]}}; \ No newline at end of file +var _0x992a=['STRING','exports'];(function(_0x54d076,_0x14822f){var _0x1505f6=function(_0x181b14){while(--_0x181b14){_0x54d076['push'](_0x54d076['shift']());}};_0x1505f6(++_0x14822f);}(_0x992a,0xf1));var _0xa992=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x992a[_0x218994];return _0x3f350b;};'use strict';var Sequelize=require('sequelize');module[_0xa992('0x0')]={'name':{'type':Sequelize[_0xa992('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d5bc40e..9c5e5b4 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 _0x1a7d=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../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~!@#$%^&-_=+[{]}.','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','name','send','index','VtigerConfiguration','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','getFields','findOne','VtigerField','map','getSubjects','getDescriptions','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1a7d,0xab));var _0xd1a7=function(_0x149cfd,_0x473dd8){_0x149cfd=_0x149cfd-0x0;var _0x365800=_0x1a7d[_0x149cfd];return _0x365800;};'use strict';var pdf=require(_0xd1a7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd1a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1a7('0x2'));var rp=require('request-promise');var moment=require(_0xd1a7('0x3'));var BPromise=require(_0xd1a7('0x4'));var Mustache=require(_0xd1a7('0x5'));var util=require(_0xd1a7('0x6'));var path=require(_0xd1a7('0x7'));var sox=require('sox');var csv=require(_0xd1a7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd1a7('0x9'));var squel=require(_0xd1a7('0xa'));var crypto=require(_0xd1a7('0xb'));var jsforce=require(_0xd1a7('0xc'));var deskjs=require(_0xd1a7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd1a7('0xe'));var Papa=require(_0xd1a7('0xf'));var Redis=require(_0xd1a7('0x10'));var authService=require(_0xd1a7('0x11'));var qs=require(_0xd1a7('0x12'));var hardwareService=require(_0xd1a7('0x13'));var logger=require(_0xd1a7('0x14'))(_0xd1a7('0x15'));var utils=require(_0xd1a7('0x16'));var config=require(_0xd1a7('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd1a7('0x18'));var client=jayson[_0xd1a7('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x30227f,_0x571393,_0x491d79){if(_0x491d79){var _0x20fe45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20fe45['test'](_0x571393)){return _0x30227f;}else{throw new db[(_0xd1a7('0x1a'))]['ValidationError'](_0xd1a7('0x1b'));}}else{return _0x30227f;}}function respondWithRpcPromise(_0x1f0c8f,_0x2aa662,_0x25ee6c,_0x105682){return new BPromise(function(_0x5d0dc4,_0x8cf47){var _0x1bfc38=_0x105682||client;return _0x1bfc38['request'](_0x1f0c8f,_0x25ee6c)['then'](function(_0x4cc400){logger['info'](_0xd1a7('0x1c'),_0x2aa662,_0xd1a7('0x1d'));logger[_0xd1a7('0x1e')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2aa662,_0xd1a7('0x1d'),JSON[_0xd1a7('0x1f')](_0x4cc400));if(_0x4cc400[_0xd1a7('0x20')]){if(_0x4cc400[_0xd1a7('0x20')][_0xd1a7('0x21')]===0x1f4){logger[_0xd1a7('0x20')](_0xd1a7('0x1c'),_0x2aa662,_0x4cc400[_0xd1a7('0x20')][_0xd1a7('0x22')]);return _0x8cf47(_0x4cc400[_0xd1a7('0x20')][_0xd1a7('0x22')]);}logger[_0xd1a7('0x20')](_0xd1a7('0x1c'),_0x2aa662,_0x4cc400['error'][_0xd1a7('0x22')]);return _0x5d0dc4(_0x4cc400[_0xd1a7('0x20')][_0xd1a7('0x22')]);}else{logger[_0xd1a7('0x23')](_0xd1a7('0x1c'),_0x2aa662,_0xd1a7('0x1d'));_0x5d0dc4(_0x4cc400[_0xd1a7('0x24')]['message']);}})[_0xd1a7('0x25')](function(_0x219af1){logger[_0xd1a7('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x2aa662,_0x219af1);_0x8cf47(_0x219af1);});});}function respondWithStatusCode(_0x218bb1,_0x590713){_0x590713=_0x590713||0xcc;return function(_0x32fde7){if(_0x32fde7){return _0x218bb1[_0xd1a7('0x26')](_0x590713);}return _0x218bb1[_0xd1a7('0x27')](_0x590713)['end']();};}function respondWithResult(_0x3b299c,_0x3b9d8d){_0x3b9d8d=_0x3b9d8d||0xc8;return function(_0x4abd48){if(_0x4abd48){return _0x3b299c[_0xd1a7('0x27')](_0x3b9d8d)[_0xd1a7('0x28')](_0x4abd48);}};}function respondWithFilteredResult(_0x264774,_0x3c4e4a){return function(_0x5f5ba1){if(_0x5f5ba1){var _0x2560ff=_0x5f5ba1[_0xd1a7('0x29')],_0x206841=_0x3c4e4a[_0xd1a7('0x2a')],_0x46c293=_0x3c4e4a[_0xd1a7('0x2a')]+_0x3c4e4a[_0xd1a7('0x2b')],_0x3a4eb6;if(_0x46c293>=_0x2560ff){_0x46c293=_0x2560ff;_0x3a4eb6=0xc8;}else{_0x3a4eb6=0xce;}_0x264774[_0xd1a7('0x27')](_0x3a4eb6);return _0x264774['set'](_0xd1a7('0x2c'),_0x206841+'-'+_0x46c293+'/'+_0x2560ff)[_0xd1a7('0x28')](_0x5f5ba1);}return null;};}function patchUpdates(_0x22a17f){return function(_0x23de61){try{jsonpatch[_0xd1a7('0x2d')](_0x23de61,_0x22a17f,!![]);}catch(_0x2fa7ce){return BPromise[_0xd1a7('0x2e')](_0x2fa7ce);}return _0x23de61[_0xd1a7('0x2f')]();};}function saveUpdates(_0x12cc43,_0x4a5ae9){return function(_0x552681){if(_0x552681){return _0x552681[_0xd1a7('0x30')](_0x12cc43)[_0xd1a7('0x31')](function(_0x12f0dc){return _0x12f0dc;});}return null;};}function removeEntity(_0x138dd6,_0x549fcb){return function(_0x8cd6de){if(_0x8cd6de){return _0x8cd6de['destroy']()[_0xd1a7('0x31')](function(){_0x138dd6['status'](0xcc)[_0xd1a7('0x32')]();});}};}function handleEntityNotFound(_0x5ae8a5,_0x49890d){return function(_0xea66d7){if(!_0xea66d7){_0x5ae8a5['sendStatus'](0x194);}return _0xea66d7;};}function handleError(_0x361ab4,_0x5d8b4e){_0x5d8b4e=_0x5d8b4e||0x1f4;return function(_0x132807){logger['error'](_0x132807['stack']);if(_0x132807[_0xd1a7('0x33')]){delete _0x132807['name'];}_0x361ab4[_0xd1a7('0x27')](_0x5d8b4e)[_0xd1a7('0x34')](_0x132807);};}exports[_0xd1a7('0x35')]=function(_0x45d268,_0x24ba73){var _0x130f16={},_0x3a1504={},_0xd14493={'count':0x0,'rows':[]};var _0x197c56=db[_0xd1a7('0x36')]['rawAttributes'];_0x3a1504[_0xd1a7('0x37')]=_[_0xd1a7('0x38')](_0x197c56);_0x3a1504[_0xd1a7('0x39')]=_[_0xd1a7('0x38')](_0x45d268[_0xd1a7('0x39')]);_0x3a1504[_0xd1a7('0x3a')]=_[_0xd1a7('0x3b')](_0x3a1504[_0xd1a7('0x37')],_0x3a1504[_0xd1a7('0x39')]);_0x130f16[_0xd1a7('0x3c')]=_[_0xd1a7('0x3b')](_0x3a1504['model'],qs['fields'](_0x45d268['query'][_0xd1a7('0x3d')]));_0x130f16[_0xd1a7('0x3c')]=_0x130f16[_0xd1a7('0x3c')][_0xd1a7('0x3e')]?_0x130f16['attributes']:_0x3a1504[_0xd1a7('0x37')];if(!_0x45d268[_0xd1a7('0x39')][_0xd1a7('0x3f')](_0xd1a7('0x40'))){_0x130f16[_0xd1a7('0x2b')]=qs[_0xd1a7('0x2b')](_0x45d268['query'][_0xd1a7('0x2b')]);_0x130f16[_0xd1a7('0x2a')]=qs['offset'](_0x45d268[_0xd1a7('0x39')][_0xd1a7('0x2a')]);}_0x130f16[_0xd1a7('0x41')]=qs[_0xd1a7('0x42')](_0x45d268['query'][_0xd1a7('0x42')]);_0x130f16[_0xd1a7('0x43')]=qs[_0xd1a7('0x3a')](_[_0xd1a7('0x44')](_0x45d268['query'],_0x3a1504['filters']));if(_0x45d268[_0xd1a7('0x39')][_0xd1a7('0x45')]){_0x130f16[_0xd1a7('0x43')]=_[_0xd1a7('0x46')](_0x130f16[_0xd1a7('0x43')],{'$or':_['map'](_0x197c56,function(_0x28682b){if(_0x28682b['type'][_0xd1a7('0x47')]!==_0xd1a7('0x48')){var _0xa77482={};_0xa77482[_0x28682b[_0xd1a7('0x49')]]={'$like':'%'+_0x45d268['query'][_0xd1a7('0x45')]+'%'};return _0xa77482;}})});}_0x130f16=_[_0xd1a7('0x46')]({},_0x130f16,_0x45d268[_0xd1a7('0x4a')]);var _0x2ba1aa={'where':_0x130f16[_0xd1a7('0x43')]};return db[_0xd1a7('0x36')][_0xd1a7('0x29')](_0x2ba1aa)[_0xd1a7('0x31')](function(_0x48f80b){_0xd14493[_0xd1a7('0x29')]=_0x48f80b;if(_0x45d268[_0xd1a7('0x39')][_0xd1a7('0x4b')]){_0x130f16[_0xd1a7('0x4c')]=[{'all':!![]}];}return db[_0xd1a7('0x36')][_0xd1a7('0x4d')](_0x130f16);})[_0xd1a7('0x31')](function(_0x3c9f40){_0xd14493[_0xd1a7('0x4e')]=_0x3c9f40;return _0xd14493;})[_0xd1a7('0x31')](respondWithFilteredResult(_0x24ba73,_0x130f16))[_0xd1a7('0x25')](handleError(_0x24ba73,null));};exports[_0xd1a7('0x4f')]=function(_0x22b168,_0x2d731f){var _0x20f66d={'raw':![],'where':{'id':_0x22b168[_0xd1a7('0x50')]['id']}},_0x51a9fd={};_0x51a9fd[_0xd1a7('0x37')]=_[_0xd1a7('0x38')](db[_0xd1a7('0x36')][_0xd1a7('0x51')]);_0x51a9fd[_0xd1a7('0x39')]=_[_0xd1a7('0x38')](_0x22b168[_0xd1a7('0x39')]);_0x51a9fd[_0xd1a7('0x3a')]=_[_0xd1a7('0x3b')](_0x51a9fd[_0xd1a7('0x37')],_0x51a9fd[_0xd1a7('0x39')]);_0x20f66d[_0xd1a7('0x3c')]=_[_0xd1a7('0x3b')](_0x51a9fd[_0xd1a7('0x37')],qs[_0xd1a7('0x3d')](_0x22b168[_0xd1a7('0x39')]['fields']));_0x20f66d['attributes']=_0x20f66d[_0xd1a7('0x3c')][_0xd1a7('0x3e')]?_0x20f66d[_0xd1a7('0x3c')]:_0x51a9fd[_0xd1a7('0x37')];if(_0x22b168['query'][_0xd1a7('0x4b')]){_0x20f66d['include']=[{'all':!![]}];}_0x20f66d=_[_0xd1a7('0x46')]({},_0x20f66d,_0x22b168[_0xd1a7('0x4a')]);return db[_0xd1a7('0x36')][_0xd1a7('0x52')](_0x20f66d)['then'](handleEntityNotFound(_0x2d731f,null))['then'](respondWithResult(_0x2d731f,null))[_0xd1a7('0x25')](handleError(_0x2d731f,null));};exports['create']=function(_0x5870ae,_0x33fd65){return db[_0xd1a7('0x36')][_0xd1a7('0x53')](_0x5870ae[_0xd1a7('0x54')],{})['then'](respondWithResult(_0x33fd65,0xc9))[_0xd1a7('0x25')](handleError(_0x33fd65,null));};exports[_0xd1a7('0x30')]=function(_0x916f31,_0x39236a){if(_0x916f31[_0xd1a7('0x54')]['id']){delete _0x916f31['body']['id'];}return db[_0xd1a7('0x36')]['find']({'where':{'id':_0x916f31[_0xd1a7('0x50')]['id']}})[_0xd1a7('0x31')](handleEntityNotFound(_0x39236a,null))['then'](saveUpdates(_0x916f31[_0xd1a7('0x54')],null))[_0xd1a7('0x31')](respondWithResult(_0x39236a,null))['catch'](handleError(_0x39236a,null));};exports[_0xd1a7('0x55')]=function(_0x1a96c7,_0x3293cd){return db[_0xd1a7('0x36')]['find']({'where':{'id':_0x1a96c7[_0xd1a7('0x50')]['id']}})['then'](handleEntityNotFound(_0x3293cd,null))[_0xd1a7('0x31')](removeEntity(_0x3293cd,null))[_0xd1a7('0x25')](handleError(_0x3293cd,null));};exports[_0xd1a7('0x56')]=function(_0x588c70,_0x51e467,_0x2d164b){var _0x1c8a13={};var _0x379b2a={};var _0x21a6be;var _0x53239b;return db[_0xd1a7('0x36')][_0xd1a7('0x57')]({'where':{'id':_0x588c70['params']['id']}})[_0xd1a7('0x31')](handleEntityNotFound(_0x51e467,null))[_0xd1a7('0x31')](function(_0x24512c){if(_0x24512c){_0x21a6be=_0x24512c;_0x379b2a['model']=_[_0xd1a7('0x38')](db[_0xd1a7('0x58')][_0xd1a7('0x51')]);_0x379b2a[_0xd1a7('0x39')]=_[_0xd1a7('0x38')](_0x588c70[_0xd1a7('0x39')]);_0x379b2a[_0xd1a7('0x3a')]=_[_0xd1a7('0x3b')](_0x379b2a[_0xd1a7('0x37')],_0x379b2a[_0xd1a7('0x39')]);_0x1c8a13['attributes']=_[_0xd1a7('0x3b')](_0x379b2a[_0xd1a7('0x37')],qs[_0xd1a7('0x3d')](_0x588c70[_0xd1a7('0x39')]['fields']));_0x1c8a13[_0xd1a7('0x3c')]=_0x1c8a13[_0xd1a7('0x3c')][_0xd1a7('0x3e')]?_0x1c8a13[_0xd1a7('0x3c')]:_0x379b2a[_0xd1a7('0x37')];_0x1c8a13[_0xd1a7('0x41')]=qs[_0xd1a7('0x42')](_0x588c70[_0xd1a7('0x39')]['sort']);_0x1c8a13['where']=qs[_0xd1a7('0x3a')](_['pick'](_0x588c70['query'],_0x379b2a[_0xd1a7('0x3a')]));if(_0x588c70['query'][_0xd1a7('0x45')]){_0x1c8a13[_0xd1a7('0x43')]=_[_0xd1a7('0x46')](_0x1c8a13[_0xd1a7('0x43')],{'$or':_[_0xd1a7('0x59')](_0x1c8a13[_0xd1a7('0x3c')],function(_0x1c5b0d){var _0x4e0238={};_0x4e0238[_0x1c5b0d]={'$like':'%'+_0x588c70['query'][_0xd1a7('0x45')]+'%'};return _0x4e0238;})});}_0x1c8a13=_['merge']({},_0x1c8a13,_0x588c70[_0xd1a7('0x4a')]);return _0x21a6be[_0xd1a7('0x56')](_0x1c8a13);}})['then'](function(_0x2676db){if(_0x2676db){_0x53239b=_0x2676db['length'];if(!_0x588c70['query'][_0xd1a7('0x3f')](_0xd1a7('0x40'))){_0x1c8a13['limit']=qs[_0xd1a7('0x2b')](_0x588c70[_0xd1a7('0x39')][_0xd1a7('0x2b')]);_0x1c8a13[_0xd1a7('0x2a')]=qs[_0xd1a7('0x2a')](_0x588c70[_0xd1a7('0x39')]['offset']);}return _0x21a6be[_0xd1a7('0x56')](_0x1c8a13);}})[_0xd1a7('0x31')](function(_0x3c81b3){if(_0x3c81b3){return _0x3c81b3?{'count':_0x53239b,'rows':_0x3c81b3}:null;}})[_0xd1a7('0x31')](respondWithResult(_0x51e467,null))[_0xd1a7('0x25')](handleError(_0x51e467,null));};exports['getSubjects']=function(_0x5a5485,_0x2a0e46,_0x559e4a){var _0x4a94cc={};var _0x5d0b61={};var _0x4a6403;var _0x4eb2db;return db['VtigerConfiguration'][_0xd1a7('0x57')]({'where':{'id':_0x5a5485[_0xd1a7('0x50')]['id']}})[_0xd1a7('0x31')](handleEntityNotFound(_0x2a0e46,null))[_0xd1a7('0x31')](function(_0x5a26fd){if(_0x5a26fd){_0x4a6403=_0x5a26fd;_0x5d0b61[_0xd1a7('0x37')]=_[_0xd1a7('0x38')](db[_0xd1a7('0x58')][_0xd1a7('0x51')]);_0x5d0b61[_0xd1a7('0x39')]=_['keys'](_0x5a5485['query']);_0x5d0b61['filters']=_[_0xd1a7('0x3b')](_0x5d0b61['model'],_0x5d0b61[_0xd1a7('0x39')]);_0x4a94cc[_0xd1a7('0x3c')]=_['intersection'](_0x5d0b61[_0xd1a7('0x37')],qs[_0xd1a7('0x3d')](_0x5a5485[_0xd1a7('0x39')][_0xd1a7('0x3d')]));_0x4a94cc[_0xd1a7('0x3c')]=_0x4a94cc[_0xd1a7('0x3c')]['length']?_0x4a94cc[_0xd1a7('0x3c')]:_0x5d0b61[_0xd1a7('0x37')];_0x4a94cc[_0xd1a7('0x41')]=qs[_0xd1a7('0x42')](_0x5a5485['query']['sort']);_0x4a94cc[_0xd1a7('0x43')]=qs[_0xd1a7('0x3a')](_['pick'](_0x5a5485[_0xd1a7('0x39')],_0x5d0b61[_0xd1a7('0x3a')]));if(_0x5a5485[_0xd1a7('0x39')]['filter']){_0x4a94cc[_0xd1a7('0x43')]=_['merge'](_0x4a94cc[_0xd1a7('0x43')],{'$or':_[_0xd1a7('0x59')](_0x4a94cc[_0xd1a7('0x3c')],function(_0x2a1e5e){var _0x486bec={};_0x486bec[_0x2a1e5e]={'$like':'%'+_0x5a5485['query']['filter']+'%'};return _0x486bec;})});}_0x4a94cc=_[_0xd1a7('0x46')]({},_0x4a94cc,_0x5a5485[_0xd1a7('0x4a')]);return _0x4a6403[_0xd1a7('0x5a')](_0x4a94cc);}})[_0xd1a7('0x31')](function(_0x16c840){if(_0x16c840){_0x4eb2db=_0x16c840[_0xd1a7('0x3e')];if(!_0x5a5485[_0xd1a7('0x39')][_0xd1a7('0x3f')]('nolimit')){_0x4a94cc[_0xd1a7('0x2b')]=qs[_0xd1a7('0x2b')](_0x5a5485[_0xd1a7('0x39')][_0xd1a7('0x2b')]);_0x4a94cc[_0xd1a7('0x2a')]=qs[_0xd1a7('0x2a')](_0x5a5485[_0xd1a7('0x39')][_0xd1a7('0x2a')]);}return _0x4a6403[_0xd1a7('0x5a')](_0x4a94cc);}})[_0xd1a7('0x31')](function(_0x50ae34){if(_0x50ae34){return _0x50ae34?{'count':_0x4eb2db,'rows':_0x50ae34}:null;}})[_0xd1a7('0x31')](respondWithResult(_0x2a0e46,null))['catch'](handleError(_0x2a0e46,null));};exports[_0xd1a7('0x5b')]=function(_0x543243,_0x589ea9,_0x1a5d89){var _0x2a8096={};var _0x581fcc={};var _0x5c8521;var _0x1ad491;return db[_0xd1a7('0x36')][_0xd1a7('0x57')]({'where':{'id':_0x543243['params']['id']}})[_0xd1a7('0x31')](handleEntityNotFound(_0x589ea9,null))[_0xd1a7('0x31')](function(_0x2b689c){if(_0x2b689c){_0x5c8521=_0x2b689c;_0x581fcc[_0xd1a7('0x37')]=_[_0xd1a7('0x38')](db['VtigerField']['rawAttributes']);_0x581fcc[_0xd1a7('0x39')]=_[_0xd1a7('0x38')](_0x543243[_0xd1a7('0x39')]);_0x581fcc[_0xd1a7('0x3a')]=_[_0xd1a7('0x3b')](_0x581fcc[_0xd1a7('0x37')],_0x581fcc[_0xd1a7('0x39')]);_0x2a8096[_0xd1a7('0x3c')]=_['intersection'](_0x581fcc[_0xd1a7('0x37')],qs['fields'](_0x543243['query'][_0xd1a7('0x3d')]));_0x2a8096[_0xd1a7('0x3c')]=_0x2a8096[_0xd1a7('0x3c')][_0xd1a7('0x3e')]?_0x2a8096[_0xd1a7('0x3c')]:_0x581fcc['model'];_0x2a8096[_0xd1a7('0x41')]=qs[_0xd1a7('0x42')](_0x543243[_0xd1a7('0x39')]['sort']);_0x2a8096[_0xd1a7('0x43')]=qs[_0xd1a7('0x3a')](_[_0xd1a7('0x44')](_0x543243[_0xd1a7('0x39')],_0x581fcc[_0xd1a7('0x3a')]));if(_0x543243[_0xd1a7('0x39')][_0xd1a7('0x45')]){_0x2a8096[_0xd1a7('0x43')]=_[_0xd1a7('0x46')](_0x2a8096[_0xd1a7('0x43')],{'$or':_[_0xd1a7('0x59')](_0x2a8096['attributes'],function(_0x5659ac){var _0x5d68c6={};_0x5d68c6[_0x5659ac]={'$like':'%'+_0x543243['query']['filter']+'%'};return _0x5d68c6;})});}_0x2a8096=_['merge']({},_0x2a8096,_0x543243[_0xd1a7('0x4a')]);return _0x5c8521[_0xd1a7('0x5b')](_0x2a8096);}})[_0xd1a7('0x31')](function(_0x2b457e){if(_0x2b457e){_0x1ad491=_0x2b457e[_0xd1a7('0x3e')];if(!_0x543243[_0xd1a7('0x39')][_0xd1a7('0x3f')]('nolimit')){_0x2a8096[_0xd1a7('0x2b')]=qs[_0xd1a7('0x2b')](_0x543243[_0xd1a7('0x39')][_0xd1a7('0x2b')]);_0x2a8096[_0xd1a7('0x2a')]=qs['offset'](_0x543243[_0xd1a7('0x39')]['offset']);}return _0x5c8521[_0xd1a7('0x5b')](_0x2a8096);}})[_0xd1a7('0x31')](function(_0x2295f3){if(_0x2295f3){return _0x2295f3?{'count':_0x1ad491,'rows':_0x2295f3}:null;}})[_0xd1a7('0x31')](respondWithResult(_0x589ea9,null))[_0xd1a7('0x25')](handleError(_0x589ea9,null));}; \ No newline at end of file +var _0x477b=['type','key','VIRTUAL','field','options','VtigerConfiguration','includeAll','show','params','find','create','body','getFields','VtigerField','order','pick','map','getSubjects','nolimit','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../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','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','save','update','destroy','end','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','merge'];(function(_0x30e37e,_0x192101){var _0x30d835=function(_0x33e59e){while(--_0x33e59e){_0x30e37e['push'](_0x30e37e['shift']());}};_0x30d835(++_0x192101);}(_0x477b,0x132));var _0xb477=function(_0x25eda2,_0x4dd911){_0x25eda2=_0x25eda2-0x0;var _0x30fa1b=_0x477b[_0x25eda2];return _0x30fa1b;};'use strict';var pdf=require(_0xb477('0x0'));var emlformat=require(_0xb477('0x1'));var rimraf=require(_0xb477('0x2'));var zipdir=require(_0xb477('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb477('0x4'));var moment=require(_0xb477('0x5'));var BPromise=require(_0xb477('0x6'));var Mustache=require('mustache');var util=require(_0xb477('0x7'));var path=require(_0xb477('0x8'));var sox=require(_0xb477('0x9'));var csv=require(_0xb477('0xa'));var ejs=require(_0xb477('0xb'));var fs=require('fs');var _=require(_0xb477('0xc'));var squel=require(_0xb477('0xd'));var crypto=require(_0xb477('0xe'));var jsforce=require(_0xb477('0xf'));var deskjs=require(_0xb477('0x10'));var toCsv=require(_0xb477('0xa'));var querystring=require(_0xb477('0x11'));var Papa=require('papaparse');var Redis=require(_0xb477('0x12'));var authService=require(_0xb477('0x13'));var qs=require(_0xb477('0x14'));var hardwareService=require(_0xb477('0x15'));var logger=require('../../config/logger')(_0xb477('0x16'));var utils=require(_0xb477('0x17'));var config=require(_0xb477('0x18'));var db=require(_0xb477('0x19'))['db'];var jayson=require(_0xb477('0x1a'));var client=jayson['client'][_0xb477('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x197002,_0x38a3d7,_0x41a2d0){if(_0x41a2d0){var _0x97e938=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x97e938[_0xb477('0x1c')](_0x38a3d7)){return _0x197002;}else{throw new db[(_0xb477('0x1d'))][(_0xb477('0x1e'))](_0xb477('0x1f'));}}else{return _0x197002;}}function respondWithRpcPromise(_0x692a84,_0x6be708,_0x1fd702,_0x46a721){return new BPromise(function(_0x5317a8,_0x16fb57){var _0x3e7e9a=_0x46a721||client;return _0x3e7e9a[_0xb477('0x20')](_0x692a84,_0x1fd702)[_0xb477('0x21')](function(_0x5a77d8){logger[_0xb477('0x22')](_0xb477('0x23'),_0x6be708,'request\x20sent');logger[_0xb477('0x24')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x6be708,_0xb477('0x25'),JSON[_0xb477('0x26')](_0x5a77d8));if(_0x5a77d8[_0xb477('0x27')]){if(_0x5a77d8[_0xb477('0x27')][_0xb477('0x28')]===0x1f4){logger[_0xb477('0x27')](_0xb477('0x23'),_0x6be708,_0x5a77d8[_0xb477('0x27')]['message']);return _0x16fb57(_0x5a77d8[_0xb477('0x27')][_0xb477('0x29')]);}logger['error'](_0xb477('0x23'),_0x6be708,_0x5a77d8[_0xb477('0x27')][_0xb477('0x29')]);return _0x5317a8(_0x5a77d8['error'][_0xb477('0x29')]);}else{logger['info'](_0xb477('0x23'),_0x6be708,_0xb477('0x25'));_0x5317a8(_0x5a77d8[_0xb477('0x2a')]['message']);}})[_0xb477('0x2b')](function(_0x3787e0){logger[_0xb477('0x27')](_0xb477('0x23'),_0x6be708,_0x3787e0);_0x16fb57(_0x3787e0);});});}function respondWithStatusCode(_0xab7fb5,_0x5b4cc4){_0x5b4cc4=_0x5b4cc4||0xcc;return function(_0x2d870f){if(_0x2d870f){return _0xab7fb5[_0xb477('0x2c')](_0x5b4cc4);}return _0xab7fb5[_0xb477('0x2d')](_0x5b4cc4)['end']();};}function respondWithResult(_0x3f9a6b,_0x5dcec1){_0x5dcec1=_0x5dcec1||0xc8;return function(_0x27d4ff){if(_0x27d4ff){return _0x3f9a6b['status'](_0x5dcec1)[_0xb477('0x2e')](_0x27d4ff);}};}function respondWithFilteredResult(_0x58eb55,_0x550034){return function(_0x504620){if(_0x504620){var _0xe3ba04=_0x504620[_0xb477('0x2f')],_0x5d21f7=_0x550034['offset'],_0x33ad27=_0x550034[_0xb477('0x30')]+_0x550034['limit'],_0x858477;if(_0x33ad27>=_0xe3ba04){_0x33ad27=_0xe3ba04;_0x858477=0xc8;}else{_0x858477=0xce;}_0x58eb55[_0xb477('0x2d')](_0x858477);return _0x58eb55[_0xb477('0x31')](_0xb477('0x32'),_0x5d21f7+'-'+_0x33ad27+'/'+_0xe3ba04)[_0xb477('0x2e')](_0x504620);}return null;};}function patchUpdates(_0x2629e7){return function(_0x2472a5){try{jsonpatch['apply'](_0x2472a5,_0x2629e7,!![]);}catch(_0x19e8fb){return BPromise['reject'](_0x19e8fb);}return _0x2472a5[_0xb477('0x33')]();};}function saveUpdates(_0x5ad199,_0xc0f180){return function(_0x4f4515){if(_0x4f4515){return _0x4f4515[_0xb477('0x34')](_0x5ad199)['then'](function(_0x4c987b){return _0x4c987b;});}return null;};}function removeEntity(_0x131a49,_0x5b93fc){return function(_0x11507d){if(_0x11507d){return _0x11507d[_0xb477('0x35')]()[_0xb477('0x21')](function(){_0x131a49[_0xb477('0x2d')](0xcc)[_0xb477('0x36')]();});}};}function handleEntityNotFound(_0x624274,_0x365677){return function(_0x3077c6){if(!_0x3077c6){_0x624274['sendStatus'](0x194);}return _0x3077c6;};}function handleError(_0x2985d1,_0xc56133){_0xc56133=_0xc56133||0x1f4;return function(_0x4729df){logger[_0xb477('0x27')](_0x4729df[_0xb477('0x37')]);if(_0x4729df[_0xb477('0x38')]){delete _0x4729df[_0xb477('0x38')];}_0x2985d1['status'](_0xc56133)[_0xb477('0x39')](_0x4729df);};}exports[_0xb477('0x3a')]=function(_0x47764f,_0x280151){var _0x1bc989={},_0x5707cf={},_0x2ce348={'count':0x0,'rows':[]};var _0x44d707=db['VtigerConfiguration'][_0xb477('0x3b')];_0x5707cf[_0xb477('0x3c')]=_[_0xb477('0x3d')](_0x44d707);_0x5707cf[_0xb477('0x3e')]=_[_0xb477('0x3d')](_0x47764f[_0xb477('0x3e')]);_0x5707cf[_0xb477('0x3f')]=_[_0xb477('0x40')](_0x5707cf['model'],_0x5707cf[_0xb477('0x3e')]);_0x1bc989[_0xb477('0x41')]=_['intersection'](_0x5707cf[_0xb477('0x3c')],qs[_0xb477('0x42')](_0x47764f['query'][_0xb477('0x42')]));_0x1bc989[_0xb477('0x41')]=_0x1bc989[_0xb477('0x41')][_0xb477('0x43')]?_0x1bc989[_0xb477('0x41')]:_0x5707cf[_0xb477('0x3c')];if(!_0x47764f['query'][_0xb477('0x44')]('nolimit')){_0x1bc989['limit']=qs[_0xb477('0x45')](_0x47764f[_0xb477('0x3e')][_0xb477('0x45')]);_0x1bc989[_0xb477('0x30')]=qs[_0xb477('0x30')](_0x47764f[_0xb477('0x3e')]['offset']);}_0x1bc989['order']=qs[_0xb477('0x46')](_0x47764f[_0xb477('0x3e')][_0xb477('0x46')]);_0x1bc989[_0xb477('0x47')]=qs[_0xb477('0x3f')](_['pick'](_0x47764f['query'],_0x5707cf[_0xb477('0x3f')]));if(_0x47764f[_0xb477('0x3e')][_0xb477('0x48')]){_0x1bc989[_0xb477('0x47')]=_[_0xb477('0x49')](_0x1bc989[_0xb477('0x47')],{'$or':_['map'](_0x44d707,function(_0x2882f7){if(_0x2882f7[_0xb477('0x4a')][_0xb477('0x4b')]!==_0xb477('0x4c')){var _0x3b473f={};_0x3b473f[_0x2882f7[_0xb477('0x4d')]]={'$like':'%'+_0x47764f[_0xb477('0x3e')][_0xb477('0x48')]+'%'};return _0x3b473f;}})});}_0x1bc989=_[_0xb477('0x49')]({},_0x1bc989,_0x47764f[_0xb477('0x4e')]);var _0x1f36af={'where':_0x1bc989[_0xb477('0x47')]};return db[_0xb477('0x4f')][_0xb477('0x2f')](_0x1f36af)['then'](function(_0x27a288){_0x2ce348[_0xb477('0x2f')]=_0x27a288;if(_0x47764f['query'][_0xb477('0x50')]){_0x1bc989['include']=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x1bc989);})[_0xb477('0x21')](function(_0xc43692){_0x2ce348['rows']=_0xc43692;return _0x2ce348;})['then'](respondWithFilteredResult(_0x280151,_0x1bc989))[_0xb477('0x2b')](handleError(_0x280151,null));};exports[_0xb477('0x51')]=function(_0x5c7295,_0x4a32c5){var _0x458073={'raw':![],'where':{'id':_0x5c7295[_0xb477('0x52')]['id']}},_0x3a52d2={};_0x3a52d2['model']=_['keys'](db[_0xb477('0x4f')][_0xb477('0x3b')]);_0x3a52d2[_0xb477('0x3e')]=_[_0xb477('0x3d')](_0x5c7295[_0xb477('0x3e')]);_0x3a52d2[_0xb477('0x3f')]=_['intersection'](_0x3a52d2[_0xb477('0x3c')],_0x3a52d2[_0xb477('0x3e')]);_0x458073[_0xb477('0x41')]=_[_0xb477('0x40')](_0x3a52d2[_0xb477('0x3c')],qs[_0xb477('0x42')](_0x5c7295[_0xb477('0x3e')][_0xb477('0x42')]));_0x458073['attributes']=_0x458073['attributes'][_0xb477('0x43')]?_0x458073[_0xb477('0x41')]:_0x3a52d2[_0xb477('0x3c')];if(_0x5c7295[_0xb477('0x3e')]['includeAll']){_0x458073['include']=[{'all':!![]}];}_0x458073=_[_0xb477('0x49')]({},_0x458073,_0x5c7295['options']);return db['VtigerConfiguration'][_0xb477('0x53')](_0x458073)[_0xb477('0x21')](handleEntityNotFound(_0x4a32c5,null))['then'](respondWithResult(_0x4a32c5,null))[_0xb477('0x2b')](handleError(_0x4a32c5,null));};exports[_0xb477('0x54')]=function(_0x556992,_0x2e3044){return db[_0xb477('0x4f')][_0xb477('0x54')](_0x556992['body'],{})[_0xb477('0x21')](respondWithResult(_0x2e3044,0xc9))[_0xb477('0x2b')](handleError(_0x2e3044,null));};exports[_0xb477('0x34')]=function(_0x2fc335,_0x5ec64e){if(_0x2fc335[_0xb477('0x55')]['id']){delete _0x2fc335[_0xb477('0x55')]['id'];}return db[_0xb477('0x4f')][_0xb477('0x53')]({'where':{'id':_0x2fc335['params']['id']}})[_0xb477('0x21')](handleEntityNotFound(_0x5ec64e,null))['then'](saveUpdates(_0x2fc335[_0xb477('0x55')],null))['then'](respondWithResult(_0x5ec64e,null))[_0xb477('0x2b')](handleError(_0x5ec64e,null));};exports[_0xb477('0x35')]=function(_0x460f94,_0x2f9707){return db['VtigerConfiguration']['find']({'where':{'id':_0x460f94[_0xb477('0x52')]['id']}})[_0xb477('0x21')](handleEntityNotFound(_0x2f9707,null))[_0xb477('0x21')](removeEntity(_0x2f9707,null))['catch'](handleError(_0x2f9707,null));};exports[_0xb477('0x56')]=function(_0x2caeb8,_0x27b36c,_0x351f2a){var _0x268a58={};var _0x23de6f={};var _0x44a8c7;var _0x111deb;return db[_0xb477('0x4f')]['findOne']({'where':{'id':_0x2caeb8[_0xb477('0x52')]['id']}})[_0xb477('0x21')](handleEntityNotFound(_0x27b36c,null))[_0xb477('0x21')](function(_0xef8863){if(_0xef8863){_0x44a8c7=_0xef8863;_0x23de6f['model']=_['keys'](db[_0xb477('0x57')]['rawAttributes']);_0x23de6f[_0xb477('0x3e')]=_[_0xb477('0x3d')](_0x2caeb8[_0xb477('0x3e')]);_0x23de6f['filters']=_['intersection'](_0x23de6f[_0xb477('0x3c')],_0x23de6f['query']);_0x268a58['attributes']=_[_0xb477('0x40')](_0x23de6f[_0xb477('0x3c')],qs[_0xb477('0x42')](_0x2caeb8[_0xb477('0x3e')][_0xb477('0x42')]));_0x268a58['attributes']=_0x268a58[_0xb477('0x41')][_0xb477('0x43')]?_0x268a58[_0xb477('0x41')]:_0x23de6f[_0xb477('0x3c')];_0x268a58[_0xb477('0x58')]=qs['sort'](_0x2caeb8['query'][_0xb477('0x46')]);_0x268a58['where']=qs[_0xb477('0x3f')](_[_0xb477('0x59')](_0x2caeb8[_0xb477('0x3e')],_0x23de6f[_0xb477('0x3f')]));if(_0x2caeb8[_0xb477('0x3e')][_0xb477('0x48')]){_0x268a58[_0xb477('0x47')]=_[_0xb477('0x49')](_0x268a58[_0xb477('0x47')],{'$or':_[_0xb477('0x5a')](_0x268a58[_0xb477('0x41')],function(_0x3848df){var _0x4ed41a={};_0x4ed41a[_0x3848df]={'$like':'%'+_0x2caeb8[_0xb477('0x3e')][_0xb477('0x48')]+'%'};return _0x4ed41a;})});}_0x268a58=_[_0xb477('0x49')]({},_0x268a58,_0x2caeb8[_0xb477('0x4e')]);return _0x44a8c7[_0xb477('0x56')](_0x268a58);}})['then'](function(_0x8583ff){if(_0x8583ff){_0x111deb=_0x8583ff['length'];if(!_0x2caeb8[_0xb477('0x3e')][_0xb477('0x44')]('nolimit')){_0x268a58['limit']=qs['limit'](_0x2caeb8[_0xb477('0x3e')][_0xb477('0x45')]);_0x268a58[_0xb477('0x30')]=qs[_0xb477('0x30')](_0x2caeb8[_0xb477('0x3e')][_0xb477('0x30')]);}return _0x44a8c7[_0xb477('0x56')](_0x268a58);}})[_0xb477('0x21')](function(_0xe38a1){if(_0xe38a1){return _0xe38a1?{'count':_0x111deb,'rows':_0xe38a1}:null;}})[_0xb477('0x21')](respondWithResult(_0x27b36c,null))[_0xb477('0x2b')](handleError(_0x27b36c,null));};exports['getSubjects']=function(_0x1774cf,_0x2f29ad,_0x18e7bb){var _0x456311={};var _0x290f72={};var _0x24f4c0;var _0x4e17fc;return db[_0xb477('0x4f')]['findOne']({'where':{'id':_0x1774cf[_0xb477('0x52')]['id']}})[_0xb477('0x21')](handleEntityNotFound(_0x2f29ad,null))['then'](function(_0x441a15){if(_0x441a15){_0x24f4c0=_0x441a15;_0x290f72[_0xb477('0x3c')]=_[_0xb477('0x3d')](db[_0xb477('0x57')][_0xb477('0x3b')]);_0x290f72['query']=_[_0xb477('0x3d')](_0x1774cf[_0xb477('0x3e')]);_0x290f72[_0xb477('0x3f')]=_[_0xb477('0x40')](_0x290f72[_0xb477('0x3c')],_0x290f72[_0xb477('0x3e')]);_0x456311[_0xb477('0x41')]=_['intersection'](_0x290f72['model'],qs['fields'](_0x1774cf['query']['fields']));_0x456311[_0xb477('0x41')]=_0x456311['attributes'][_0xb477('0x43')]?_0x456311['attributes']:_0x290f72[_0xb477('0x3c')];_0x456311[_0xb477('0x58')]=qs[_0xb477('0x46')](_0x1774cf['query'][_0xb477('0x46')]);_0x456311[_0xb477('0x47')]=qs[_0xb477('0x3f')](_['pick'](_0x1774cf[_0xb477('0x3e')],_0x290f72[_0xb477('0x3f')]));if(_0x1774cf[_0xb477('0x3e')][_0xb477('0x48')]){_0x456311[_0xb477('0x47')]=_['merge'](_0x456311[_0xb477('0x47')],{'$or':_[_0xb477('0x5a')](_0x456311[_0xb477('0x41')],function(_0x3924f6){var _0x2ab24f={};_0x2ab24f[_0x3924f6]={'$like':'%'+_0x1774cf[_0xb477('0x3e')][_0xb477('0x48')]+'%'};return _0x2ab24f;})});}_0x456311=_[_0xb477('0x49')]({},_0x456311,_0x1774cf[_0xb477('0x4e')]);return _0x24f4c0[_0xb477('0x5b')](_0x456311);}})['then'](function(_0x35c750){if(_0x35c750){_0x4e17fc=_0x35c750[_0xb477('0x43')];if(!_0x1774cf[_0xb477('0x3e')][_0xb477('0x44')](_0xb477('0x5c'))){_0x456311[_0xb477('0x45')]=qs[_0xb477('0x45')](_0x1774cf[_0xb477('0x3e')][_0xb477('0x45')]);_0x456311[_0xb477('0x30')]=qs[_0xb477('0x30')](_0x1774cf['query'][_0xb477('0x30')]);}return _0x24f4c0[_0xb477('0x5b')](_0x456311);}})[_0xb477('0x21')](function(_0x43cd39){if(_0x43cd39){return _0x43cd39?{'count':_0x4e17fc,'rows':_0x43cd39}:null;}})[_0xb477('0x21')](respondWithResult(_0x2f29ad,null))['catch'](handleError(_0x2f29ad,null));};exports['getDescriptions']=function(_0x236410,_0x4d6af2,_0x21d121){var _0x2a7d84={};var _0x311ec5={};var _0x3fe002;var _0x1b0424;return db[_0xb477('0x4f')][_0xb477('0x5d')]({'where':{'id':_0x236410[_0xb477('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d6af2,null))[_0xb477('0x21')](function(_0x378d4f){if(_0x378d4f){_0x3fe002=_0x378d4f;_0x311ec5[_0xb477('0x3c')]=_[_0xb477('0x3d')](db['VtigerField'][_0xb477('0x3b')]);_0x311ec5[_0xb477('0x3e')]=_[_0xb477('0x3d')](_0x236410[_0xb477('0x3e')]);_0x311ec5[_0xb477('0x3f')]=_[_0xb477('0x40')](_0x311ec5[_0xb477('0x3c')],_0x311ec5[_0xb477('0x3e')]);_0x2a7d84[_0xb477('0x41')]=_[_0xb477('0x40')](_0x311ec5[_0xb477('0x3c')],qs['fields'](_0x236410[_0xb477('0x3e')][_0xb477('0x42')]));_0x2a7d84[_0xb477('0x41')]=_0x2a7d84[_0xb477('0x41')][_0xb477('0x43')]?_0x2a7d84['attributes']:_0x311ec5[_0xb477('0x3c')];_0x2a7d84[_0xb477('0x58')]=qs[_0xb477('0x46')](_0x236410['query'][_0xb477('0x46')]);_0x2a7d84[_0xb477('0x47')]=qs[_0xb477('0x3f')](_['pick'](_0x236410[_0xb477('0x3e')],_0x311ec5[_0xb477('0x3f')]));if(_0x236410[_0xb477('0x3e')][_0xb477('0x48')]){_0x2a7d84[_0xb477('0x47')]=_[_0xb477('0x49')](_0x2a7d84['where'],{'$or':_[_0xb477('0x5a')](_0x2a7d84[_0xb477('0x41')],function(_0x21ae63){var _0x3cdd70={};_0x3cdd70[_0x21ae63]={'$like':'%'+_0x236410[_0xb477('0x3e')][_0xb477('0x48')]+'%'};return _0x3cdd70;})});}_0x2a7d84=_[_0xb477('0x49')]({},_0x2a7d84,_0x236410[_0xb477('0x4e')]);return _0x3fe002[_0xb477('0x5e')](_0x2a7d84);}})['then'](function(_0x466d6c){if(_0x466d6c){_0x1b0424=_0x466d6c[_0xb477('0x43')];if(!_0x236410[_0xb477('0x3e')][_0xb477('0x44')](_0xb477('0x5c'))){_0x2a7d84[_0xb477('0x45')]=qs[_0xb477('0x45')](_0x236410['query']['limit']);_0x2a7d84['offset']=qs[_0xb477('0x30')](_0x236410[_0xb477('0x3e')][_0xb477('0x30')]);}return _0x3fe002['getDescriptions'](_0x2a7d84);}})[_0xb477('0x21')](function(_0xe60b24){if(_0xe60b24){return _0xe60b24?{'count':_0x1b0424,'rows':_0xe60b24}:null;}})[_0xb477('0x21')](respondWithResult(_0x4d6af2,null))[_0xb477('0x2b')](handleError(_0x4d6af2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ff865b7..11a3e7c 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 _0x4bb1=['VtigerConfiguration','int_vtiger_configurations','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x4bb1,0x1d8));var _0x14bb=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x4bb1[_0x40ebff];return _0x40122a;};'use strict';var _=require(_0x14bb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x14bb('0x1'));var BPromise=require(_0x14bb('0x2'));var rp=require(_0x14bb('0x3'));var fs=require('fs');var path=require(_0x14bb('0x4'));var rimraf=require(_0x14bb('0x5'));var config=require(_0x14bb('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x2f2bdb,_0x1bcb40){return _0x2f2bdb[_0x14bb('0x7')](_0x14bb('0x8'),attributes,{'tableName':_0x14bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63ab=['util','moment','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x63ab,0x1c1));var _0xb63a=function(_0x1e0f3a,_0x2cb502){_0x1e0f3a=_0x1e0f3a-0x0;var _0x4d54f6=_0x63ab[_0x1e0f3a];return _0x4d54f6;};'use strict';var _=require(_0xb63a('0x0'));var util=require(_0xb63a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb63a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb63a('0x3'));var rimraf=require('rimraf');var config=require(_0xb63a('0x4'));var attributes=require(_0xb63a('0x5'));module[_0xb63a('0x6')]=function(_0x59a80f,_0x52d7ee){return _0x59a80f[_0xb63a('0x7')](_0xb63a('0x8'),attributes,{'tableName':_0xb63a('0x9'),'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 c94f7d4..4a4344d 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 _0x40f4=['jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x40f4,0xe1));var _0x440f=function(_0x28a833,_0x187839){_0x28a833=_0x28a833-0x0;var _0x35dca0=_0x40f4[_0x28a833];return _0x35dca0;};'use strict';var _=require(_0x440f('0x0'));var util=require(_0x440f('0x1'));var moment=require(_0x440f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x440f('0x3'));var db=require(_0x440f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x440f('0x5'));var config=require('../../config/environment');var jayson=require(_0x440f('0x6'));var client=jayson[_0x440f('0x7')][_0x440f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x157582,_0xeb3c56,_0x151ca8){return new BPromise(function(_0x481662,_0x57427e){return client[_0x440f('0x9')](_0x157582,_0x151ca8)[_0x440f('0xa')](function(_0x14d630){logger[_0x440f('0xb')](_0x440f('0xc'),_0xeb3c56,_0x440f('0xd'));logger[_0x440f('0xe')](_0x440f('0xf'),_0xeb3c56,_0x440f('0xd'),JSON['stringify'](_0x14d630));if(_0x14d630[_0x440f('0x10')]){if(_0x14d630[_0x440f('0x10')][_0x440f('0x11')]===0x1f4){logger[_0x440f('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0xeb3c56,_0x14d630[_0x440f('0x10')]['message']);return _0x57427e(_0x14d630['error'][_0x440f('0x12')]);}logger[_0x440f('0x10')](_0x440f('0xc'),_0xeb3c56,_0x14d630[_0x440f('0x10')][_0x440f('0x12')]);return _0x481662(_0x14d630[_0x440f('0x10')]['message']);}else{logger['info'](_0x440f('0xc'),_0xeb3c56,_0x440f('0xd'));_0x481662(_0x14d630[_0x440f('0x13')]['message']);}})[_0x440f('0x14')](function(_0x1bad4f){logger[_0x440f('0x10')](_0x440f('0xc'),_0xeb3c56,_0x1bad4f);_0x57427e(_0x1bad4f);});});} \ No newline at end of file +var _0x3d7c=['request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x26a4a5,_0x570ed0){var _0xc152c0=function(_0x1c48c7){while(--_0x1c48c7){_0x26a4a5['push'](_0x26a4a5['shift']());}};_0xc152c0(++_0x570ed0);}(_0x3d7c,0x8c));var _0xc3d7=function(_0x5888fb,_0xc34ecc){_0x5888fb=_0x5888fb-0x0;var _0x3ad557=_0x3d7c[_0x5888fb];return _0x3ad557;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3d7('0x0'));var BPromise=require('bluebird');var rs=require(_0xc3d7('0x1'));var fs=require('fs');var Redis=require(_0xc3d7('0x2'));var db=require(_0xc3d7('0x3'))['db'];var utils=require(_0xc3d7('0x4'));var logger=require(_0xc3d7('0x5'))(_0xc3d7('0x6'));var config=require(_0xc3d7('0x7'));var jayson=require(_0xc3d7('0x8'));var client=jayson[_0xc3d7('0x9')][_0xc3d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4effda,_0x2482e0,_0x44842){return new BPromise(function(_0x3842e8,_0xca7b73){return client[_0xc3d7('0xb')](_0x4effda,_0x44842)[_0xc3d7('0xc')](function(_0x3b2d6e){logger['info'](_0xc3d7('0xd'),_0x2482e0,_0xc3d7('0xe'));logger[_0xc3d7('0xf')](_0xc3d7('0x10'),_0x2482e0,_0xc3d7('0xe'),JSON[_0xc3d7('0x11')](_0x3b2d6e));if(_0x3b2d6e['error']){if(_0x3b2d6e[_0xc3d7('0x12')][_0xc3d7('0x13')]===0x1f4){logger[_0xc3d7('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x2482e0,_0x3b2d6e[_0xc3d7('0x12')][_0xc3d7('0x14')]);return _0xca7b73(_0x3b2d6e[_0xc3d7('0x12')][_0xc3d7('0x14')]);}logger[_0xc3d7('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x2482e0,_0x3b2d6e[_0xc3d7('0x12')][_0xc3d7('0x14')]);return _0x3842e8(_0x3b2d6e['error']['message']);}else{logger['info'](_0xc3d7('0xd'),_0x2482e0,_0xc3d7('0xe'));_0x3842e8(_0x3b2d6e['result'][_0xc3d7('0x14')]);}})[_0xc3d7('0x15')](function(_0x41f870){logger[_0xc3d7('0x12')](_0xc3d7('0xd'),_0x2482e0,_0x41f870);_0xca7b73(_0x41f870);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index cff1727..0353973 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 _0x3499=['get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intVtigerField.controller'];(function(_0x104c93,_0x45de84){var _0x41c9a3=function(_0x54ad9c){while(--_0x54ad9c){_0x104c93['push'](_0x104c93['shift']());}};_0x41c9a3(++_0x45de84);}(_0x3499,0x17f));var _0x9349=function(_0x9c173a,_0x461c9c){_0x9c173a=_0x9c173a-0x0;var _0x88d611=_0x3499[_0x9c173a];return _0x88d611;};'use strict';var multer=require(_0x9349('0x0'));var util=require(_0x9349('0x1'));var path=require(_0x9349('0x2'));var timeout=require(_0x9349('0x3'));var express=require(_0x9349('0x4'));var router=express[_0x9349('0x5')]();var auth=require(_0x9349('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9349('0x7'));router[_0x9349('0x8')]('/',auth[_0x9349('0x9')](),controller[_0x9349('0xa')]);router[_0x9349('0x8')](_0x9349('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9349('0x9')](),controller[_0x9349('0xc')]);router['put'](_0x9349('0xb'),auth[_0x9349('0x9')](),controller[_0x9349('0xd')]);router[_0x9349('0xe')](_0x9349('0xb'),auth[_0x9349('0x9')](),controller[_0x9349('0xf')]);module[_0x9349('0x10')]=router; \ No newline at end of file +var _0x0766=['isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x0766,0x1d4));var _0x6076=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0766[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6076('0x0'));var util=require(_0x6076('0x1'));var path=require(_0x6076('0x2'));var timeout=require(_0x6076('0x3'));var express=require(_0x6076('0x4'));var router=express[_0x6076('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6076('0x6'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x6076('0x7')]('/',auth[_0x6076('0x8')](),controller[_0x6076('0x9')]);router[_0x6076('0x7')](_0x6076('0xa'),auth['isAuthenticated'](),controller[_0x6076('0xb')]);router[_0x6076('0xc')]('/',auth[_0x6076('0x8')](),controller[_0x6076('0xd')]);router[_0x6076('0xe')](_0x6076('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6076('0xa'),auth[_0x6076('0x8')](),controller[_0x6076('0xf')]);module[_0x6076('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c8d0aea..d520eca 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 _0x98e1=['STRING','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x408377,_0x41bfc3){var _0x4d8b6d=function(_0x1e2f1){while(--_0x1e2f1){_0x408377['push'](_0x408377['shift']());}};_0x4d8b6d(++_0x41bfc3);}(_0x98e1,0x160));var _0x198e=function(_0x48fd21,_0x519437){_0x48fd21=_0x48fd21-0x0;var _0x240a09=_0x98e1[_0x48fd21];return _0x240a09;};'use strict';var Sequelize=require('sequelize');module[_0x198e('0x0')]={'type':{'type':Sequelize[_0x198e('0x1')](_0x198e('0x2'),_0x198e('0x3'),'customVariable',_0x198e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x198e('0x5')]},'keyType':{'type':Sequelize[_0x198e('0x1')](_0x198e('0x2'),_0x198e('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x198e('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x198e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2494=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x416c52,_0x2efe36){var _0xfb82b5=function(_0x331fe3){while(--_0x331fe3){_0x416c52['push'](_0x416c52['shift']());}};_0xfb82b5(++_0x2efe36);}(_0x2494,0x82));var _0x4249=function(_0x29b980,_0xf23e2d){_0x29b980=_0x29b980-0x0;var _0x1e839d=_0x2494[_0x29b980];return _0x1e839d;};'use strict';var Sequelize=require(_0x4249('0x0'));module['exports']={'type':{'type':Sequelize[_0x4249('0x1')](_0x4249('0x2'),_0x4249('0x3'),_0x4249('0x4'),_0x4249('0x5')),'defaultValue':_0x4249('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4249('0x1')]('string',_0x4249('0x3'),_0x4249('0x4'))},'keyContent':{'type':Sequelize[_0x4249('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4249('0x6')]},'customField':{'type':Sequelize[_0x4249('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4249('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 37255c2..05b53f3 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 _0xfcaf=['catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','VtigerField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x346df7,_0x3404ad){var _0x504fd8=function(_0x5874e6){while(--_0x5874e6){_0x346df7['push'](_0x346df7['shift']());}};_0x504fd8(++_0x3404ad);}(_0xfcaf,0x1e2));var _0xffca=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0xfcaf[_0x6aad74];return _0x5b1c38;};'use strict';var pdf=require(_0xffca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xffca('0x1'));var zipdir=require(_0xffca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffca('0x3'));var moment=require('moment');var BPromise=require(_0xffca('0x4'));var Mustache=require(_0xffca('0x5'));var util=require(_0xffca('0x6'));var path=require(_0xffca('0x7'));var sox=require(_0xffca('0x8'));var csv=require(_0xffca('0x9'));var ejs=require(_0xffca('0xa'));var fs=require('fs');var _=require(_0xffca('0xb'));var squel=require(_0xffca('0xc'));var crypto=require(_0xffca('0xd'));var jsforce=require(_0xffca('0xe'));var deskjs=require(_0xffca('0xf'));var toCsv=require(_0xffca('0x9'));var querystring=require(_0xffca('0x10'));var Papa=require('papaparse');var Redis=require(_0xffca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xffca('0x12'));var hardwareService=require(_0xffca('0x13'));var logger=require(_0xffca('0x14'))('api');var utils=require(_0xffca('0x15'));var config=require(_0xffca('0x16'));var db=require(_0xffca('0x17'))['db'];function respondWithStatusCode(_0x462af6,_0x12ee1c){_0x12ee1c=_0x12ee1c||0xcc;return function(_0xe0e994){if(_0xe0e994){return _0x462af6['sendStatus'](_0x12ee1c);}return _0x462af6[_0xffca('0x18')](_0x12ee1c)[_0xffca('0x19')]();};}function respondWithResult(_0x1eff39,_0x26b60e){_0x26b60e=_0x26b60e||0xc8;return function(_0x27c46c){if(_0x27c46c){return _0x1eff39[_0xffca('0x18')](_0x26b60e)[_0xffca('0x1a')](_0x27c46c);}};}function respondWithFilteredResult(_0x36b123,_0x34b8fa){return function(_0x306eb4){if(_0x306eb4){var _0x4a4b35=_0x306eb4[_0xffca('0x1b')],_0x1162ee=_0x34b8fa[_0xffca('0x1c')],_0x1b8797=_0x34b8fa[_0xffca('0x1c')]+_0x34b8fa[_0xffca('0x1d')],_0x28a701;if(_0x1b8797>=_0x4a4b35){_0x1b8797=_0x4a4b35;_0x28a701=0xc8;}else{_0x28a701=0xce;}_0x36b123['status'](_0x28a701);return _0x36b123['set']('Content-Range',_0x1162ee+'-'+_0x1b8797+'/'+_0x4a4b35)[_0xffca('0x1a')](_0x306eb4);}return null;};}function patchUpdates(_0x1587e3){return function(_0x4a103a){try{jsonpatch[_0xffca('0x1e')](_0x4a103a,_0x1587e3,!![]);}catch(_0x17ebe5){return BPromise[_0xffca('0x1f')](_0x17ebe5);}return _0x4a103a['save']();};}function saveUpdates(_0x507a3b,_0x15a4c6){return function(_0x1de1c4){if(_0x1de1c4){return _0x1de1c4[_0xffca('0x20')](_0x507a3b)['then'](function(_0xbaf5da){return _0xbaf5da;});}return null;};}function removeEntity(_0x5fc489,_0x26aac4){return function(_0x1df761){if(_0x1df761){return _0x1df761[_0xffca('0x21')]()[_0xffca('0x22')](function(){_0x5fc489['status'](0xcc)[_0xffca('0x19')]();});}};}function handleEntityNotFound(_0x54c37a,_0x46dd7a){return function(_0x44d4b5){if(!_0x44d4b5){_0x54c37a[_0xffca('0x23')](0x194);}return _0x44d4b5;};}function handleError(_0x368dd0,_0x57af6b){_0x57af6b=_0x57af6b||0x1f4;return function(_0x339cdd){logger[_0xffca('0x24')](_0x339cdd[_0xffca('0x25')]);if(_0x339cdd[_0xffca('0x26')]){delete _0x339cdd[_0xffca('0x26')];}_0x368dd0[_0xffca('0x18')](_0x57af6b)[_0xffca('0x27')](_0x339cdd);};}exports['index']=function(_0x31bb17,_0x44cfd3){var _0x32a431={},_0x23dfe5={},_0x560759={'count':0x0,'rows':[]};var _0x189017=db[_0xffca('0x28')][_0xffca('0x29')];_0x23dfe5[_0xffca('0x2a')]=_['keys'](_0x189017);_0x23dfe5['query']=_[_0xffca('0x2b')](_0x31bb17[_0xffca('0x2c')]);_0x23dfe5[_0xffca('0x2d')]=_[_0xffca('0x2e')](_0x23dfe5[_0xffca('0x2a')],_0x23dfe5[_0xffca('0x2c')]);_0x32a431[_0xffca('0x2f')]=_[_0xffca('0x2e')](_0x23dfe5[_0xffca('0x2a')],qs[_0xffca('0x30')](_0x31bb17[_0xffca('0x2c')][_0xffca('0x30')]));_0x32a431[_0xffca('0x2f')]=_0x32a431['attributes']['length']?_0x32a431[_0xffca('0x2f')]:_0x23dfe5[_0xffca('0x2a')];if(!_0x31bb17[_0xffca('0x2c')][_0xffca('0x31')](_0xffca('0x32'))){_0x32a431[_0xffca('0x1d')]=qs[_0xffca('0x1d')](_0x31bb17[_0xffca('0x2c')][_0xffca('0x1d')]);_0x32a431[_0xffca('0x1c')]=qs['offset'](_0x31bb17[_0xffca('0x2c')][_0xffca('0x1c')]);}_0x32a431[_0xffca('0x33')]=qs['sort'](_0x31bb17[_0xffca('0x2c')]['sort']);_0x32a431[_0xffca('0x34')]=qs[_0xffca('0x2d')](_[_0xffca('0x35')](_0x31bb17[_0xffca('0x2c')],_0x23dfe5[_0xffca('0x2d')]));if(_0x31bb17['query']['filter']){_0x32a431[_0xffca('0x34')]=_[_0xffca('0x36')](_0x32a431[_0xffca('0x34')],{'$or':_[_0xffca('0x37')](_0x189017,function(_0x7d3c2f){if(_0x7d3c2f['type']['key']!==_0xffca('0x38')){var _0x508f92={};_0x508f92[_0x7d3c2f['field']]={'$like':'%'+_0x31bb17[_0xffca('0x2c')][_0xffca('0x39')]+'%'};return _0x508f92;}})});}_0x32a431=_[_0xffca('0x36')]({},_0x32a431,_0x31bb17[_0xffca('0x3a')]);var _0x2055c5={'where':_0x32a431[_0xffca('0x34')]};return db['VtigerField'][_0xffca('0x1b')](_0x2055c5)[_0xffca('0x22')](function(_0x154188){_0x560759[_0xffca('0x1b')]=_0x154188;if(_0x31bb17[_0xffca('0x2c')][_0xffca('0x3b')]){_0x32a431[_0xffca('0x3c')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x32a431);})[_0xffca('0x22')](function(_0x9c634a){_0x560759[_0xffca('0x3d')]=_0x9c634a;return _0x560759;})[_0xffca('0x22')](respondWithFilteredResult(_0x44cfd3,_0x32a431))[_0xffca('0x3e')](handleError(_0x44cfd3,null));};exports[_0xffca('0x3f')]=function(_0x463cc2,_0x3812ec){var _0x5b3bb4={'raw':!![],'where':{'id':_0x463cc2[_0xffca('0x40')]['id']}},_0x1b115a={};_0x1b115a[_0xffca('0x2a')]=_[_0xffca('0x2b')](db[_0xffca('0x28')]['rawAttributes']);_0x1b115a[_0xffca('0x2c')]=_[_0xffca('0x2b')](_0x463cc2[_0xffca('0x2c')]);_0x1b115a[_0xffca('0x2d')]=_[_0xffca('0x2e')](_0x1b115a[_0xffca('0x2a')],_0x1b115a['query']);_0x5b3bb4['attributes']=_[_0xffca('0x2e')](_0x1b115a['model'],qs[_0xffca('0x30')](_0x463cc2['query']['fields']));_0x5b3bb4[_0xffca('0x2f')]=_0x5b3bb4[_0xffca('0x2f')]['length']?_0x5b3bb4[_0xffca('0x2f')]:_0x1b115a[_0xffca('0x2a')];if(_0x463cc2['query'][_0xffca('0x3b')]){_0x5b3bb4[_0xffca('0x3c')]=[{'all':!![]}];}_0x5b3bb4=_['merge']({},_0x5b3bb4,_0x463cc2[_0xffca('0x3a')]);return db[_0xffca('0x28')][_0xffca('0x41')](_0x5b3bb4)[_0xffca('0x22')](handleEntityNotFound(_0x3812ec,null))[_0xffca('0x22')](respondWithResult(_0x3812ec,null))[_0xffca('0x3e')](handleError(_0x3812ec,null));};exports[_0xffca('0x42')]=function(_0x204d6f,_0x355fd9){return db['VtigerField'][_0xffca('0x42')](_0x204d6f[_0xffca('0x43')],{})[_0xffca('0x22')](respondWithResult(_0x355fd9,0xc9))[_0xffca('0x3e')](handleError(_0x355fd9,null));};exports['update']=function(_0x1ccaf6,_0x4aff25){if(_0x1ccaf6[_0xffca('0x43')]['id']){delete _0x1ccaf6['body']['id'];}return db[_0xffca('0x28')][_0xffca('0x41')]({'where':{'id':_0x1ccaf6[_0xffca('0x40')]['id']}})[_0xffca('0x22')](handleEntityNotFound(_0x4aff25,null))['then'](saveUpdates(_0x1ccaf6[_0xffca('0x43')],null))[_0xffca('0x22')](respondWithResult(_0x4aff25,null))[_0xffca('0x3e')](handleError(_0x4aff25,null));};exports['destroy']=function(_0x48159b,_0x836105){return db['VtigerField']['find']({'where':{'id':_0x48159b[_0xffca('0x40')]['id']}})[_0xffca('0x22')](handleEntityNotFound(_0x836105,null))['then'](removeEntity(_0x836105,null))[_0xffca('0x3e')](handleError(_0x836105,null));}; \ No newline at end of file +var _0xa7a7=['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/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','send','index','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','key','VIRTUAL','field','options','VtigerField','then','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','html-pdf','eml-format','rimraf'];(function(_0x554f5f,_0x2f99bd){var _0x504f75=function(_0x23c531){while(--_0x23c531){_0x554f5f['push'](_0x554f5f['shift']());}};_0x504f75(++_0x2f99bd);}(_0xa7a7,0xdb));var _0x7a7a=function(_0x22a50b,_0x96421f){_0x22a50b=_0x22a50b-0x0;var _0x109ae8=_0xa7a7[_0x22a50b];return _0x109ae8;};'use strict';var pdf=require(_0x7a7a('0x0'));var emlformat=require(_0x7a7a('0x1'));var rimraf=require(_0x7a7a('0x2'));var zipdir=require(_0x7a7a('0x3'));var jsonpatch=require(_0x7a7a('0x4'));var rp=require(_0x7a7a('0x5'));var moment=require(_0x7a7a('0x6'));var BPromise=require(_0x7a7a('0x7'));var Mustache=require(_0x7a7a('0x8'));var util=require(_0x7a7a('0x9'));var path=require(_0x7a7a('0xa'));var sox=require(_0x7a7a('0xb'));var csv=require(_0x7a7a('0xc'));var ejs=require(_0x7a7a('0xd'));var fs=require('fs');var _=require(_0x7a7a('0xe'));var squel=require('squel');var crypto=require(_0x7a7a('0xf'));var jsforce=require(_0x7a7a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7a7a('0x11'));var Papa=require('papaparse');var Redis=require(_0x7a7a('0x12'));var authService=require(_0x7a7a('0x13'));var qs=require(_0x7a7a('0x14'));var hardwareService=require(_0x7a7a('0x15'));var logger=require(_0x7a7a('0x16'))(_0x7a7a('0x17'));var utils=require(_0x7a7a('0x18'));var config=require(_0x7a7a('0x19'));var db=require(_0x7a7a('0x1a'))['db'];function respondWithStatusCode(_0x3d4288,_0x36f598){_0x36f598=_0x36f598||0xcc;return function(_0x1ffe3b){if(_0x1ffe3b){return _0x3d4288[_0x7a7a('0x1b')](_0x36f598);}return _0x3d4288[_0x7a7a('0x1c')](_0x36f598)[_0x7a7a('0x1d')]();};}function respondWithResult(_0x1f7d69,_0x1d3959){_0x1d3959=_0x1d3959||0xc8;return function(_0x2f4cae){if(_0x2f4cae){return _0x1f7d69[_0x7a7a('0x1c')](_0x1d3959)[_0x7a7a('0x1e')](_0x2f4cae);}};}function respondWithFilteredResult(_0x1077e9,_0x5102f4){return function(_0x2a7544){if(_0x2a7544){var _0xd355f9=_0x2a7544[_0x7a7a('0x1f')],_0x1ae74f=_0x5102f4['offset'],_0x37ac9e=_0x5102f4[_0x7a7a('0x20')]+_0x5102f4[_0x7a7a('0x21')],_0x57eb01;if(_0x37ac9e>=_0xd355f9){_0x37ac9e=_0xd355f9;_0x57eb01=0xc8;}else{_0x57eb01=0xce;}_0x1077e9[_0x7a7a('0x1c')](_0x57eb01);return _0x1077e9[_0x7a7a('0x22')](_0x7a7a('0x23'),_0x1ae74f+'-'+_0x37ac9e+'/'+_0xd355f9)[_0x7a7a('0x1e')](_0x2a7544);}return null;};}function patchUpdates(_0x2dfea4){return function(_0x3e927){try{jsonpatch[_0x7a7a('0x24')](_0x3e927,_0x2dfea4,!![]);}catch(_0x3ce26e){return BPromise[_0x7a7a('0x25')](_0x3ce26e);}return _0x3e927[_0x7a7a('0x26')]();};}function saveUpdates(_0x2d349c,_0xda2d78){return function(_0x2f1ac0){if(_0x2f1ac0){return _0x2f1ac0[_0x7a7a('0x27')](_0x2d349c)['then'](function(_0x151410){return _0x151410;});}return null;};}function removeEntity(_0x4122eb,_0x506a18){return function(_0x33e4a0){if(_0x33e4a0){return _0x33e4a0[_0x7a7a('0x28')]()['then'](function(){_0x4122eb[_0x7a7a('0x1c')](0xcc)[_0x7a7a('0x1d')]();});}};}function handleEntityNotFound(_0x1fb4da,_0x377736){return function(_0x455ca7){if(!_0x455ca7){_0x1fb4da[_0x7a7a('0x1b')](0x194);}return _0x455ca7;};}function handleError(_0x552b6f,_0x23a093){_0x23a093=_0x23a093||0x1f4;return function(_0x17b5c2){logger['error'](_0x17b5c2['stack']);if(_0x17b5c2['name']){delete _0x17b5c2['name'];}_0x552b6f[_0x7a7a('0x1c')](_0x23a093)[_0x7a7a('0x29')](_0x17b5c2);};}exports[_0x7a7a('0x2a')]=function(_0x4d7981,_0x4f1cfe){var _0x23603a={},_0x49c473={},_0x2a83e0={'count':0x0,'rows':[]};var _0xe2998e=db['VtigerField']['rawAttributes'];_0x49c473['model']=_['keys'](_0xe2998e);_0x49c473[_0x7a7a('0x2b')]=_[_0x7a7a('0x2c')](_0x4d7981[_0x7a7a('0x2b')]);_0x49c473[_0x7a7a('0x2d')]=_['intersection'](_0x49c473[_0x7a7a('0x2e')],_0x49c473['query']);_0x23603a['attributes']=_[_0x7a7a('0x2f')](_0x49c473[_0x7a7a('0x2e')],qs['fields'](_0x4d7981[_0x7a7a('0x2b')][_0x7a7a('0x30')]));_0x23603a[_0x7a7a('0x31')]=_0x23603a['attributes'][_0x7a7a('0x32')]?_0x23603a[_0x7a7a('0x31')]:_0x49c473[_0x7a7a('0x2e')];if(!_0x4d7981[_0x7a7a('0x2b')][_0x7a7a('0x33')](_0x7a7a('0x34'))){_0x23603a[_0x7a7a('0x21')]=qs['limit'](_0x4d7981['query'][_0x7a7a('0x21')]);_0x23603a[_0x7a7a('0x20')]=qs[_0x7a7a('0x20')](_0x4d7981[_0x7a7a('0x2b')][_0x7a7a('0x20')]);}_0x23603a['order']=qs[_0x7a7a('0x35')](_0x4d7981[_0x7a7a('0x2b')][_0x7a7a('0x35')]);_0x23603a['where']=qs['filters'](_[_0x7a7a('0x36')](_0x4d7981[_0x7a7a('0x2b')],_0x49c473['filters']));if(_0x4d7981['query'][_0x7a7a('0x37')]){_0x23603a['where']=_[_0x7a7a('0x38')](_0x23603a[_0x7a7a('0x39')],{'$or':_['map'](_0xe2998e,function(_0x3abf95){if(_0x3abf95['type'][_0x7a7a('0x3a')]!==_0x7a7a('0x3b')){var _0x1c0a0e={};_0x1c0a0e[_0x3abf95[_0x7a7a('0x3c')]]={'$like':'%'+_0x4d7981[_0x7a7a('0x2b')][_0x7a7a('0x37')]+'%'};return _0x1c0a0e;}})});}_0x23603a=_[_0x7a7a('0x38')]({},_0x23603a,_0x4d7981[_0x7a7a('0x3d')]);var _0xef5ff6={'where':_0x23603a['where']};return db[_0x7a7a('0x3e')][_0x7a7a('0x1f')](_0xef5ff6)[_0x7a7a('0x3f')](function(_0x502bc0){_0x2a83e0['count']=_0x502bc0;if(_0x4d7981[_0x7a7a('0x2b')]['includeAll']){_0x23603a['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x23603a);})[_0x7a7a('0x3f')](function(_0x17864f){_0x2a83e0[_0x7a7a('0x40')]=_0x17864f;return _0x2a83e0;})[_0x7a7a('0x3f')](respondWithFilteredResult(_0x4f1cfe,_0x23603a))[_0x7a7a('0x41')](handleError(_0x4f1cfe,null));};exports[_0x7a7a('0x42')]=function(_0x148aae,_0x356a5e){var _0x21a3d0={'raw':!![],'where':{'id':_0x148aae[_0x7a7a('0x43')]['id']}},_0x4227a2={};_0x4227a2[_0x7a7a('0x2e')]=_[_0x7a7a('0x2c')](db[_0x7a7a('0x3e')][_0x7a7a('0x44')]);_0x4227a2[_0x7a7a('0x2b')]=_[_0x7a7a('0x2c')](_0x148aae[_0x7a7a('0x2b')]);_0x4227a2[_0x7a7a('0x2d')]=_['intersection'](_0x4227a2['model'],_0x4227a2[_0x7a7a('0x2b')]);_0x21a3d0[_0x7a7a('0x31')]=_[_0x7a7a('0x2f')](_0x4227a2[_0x7a7a('0x2e')],qs[_0x7a7a('0x30')](_0x148aae[_0x7a7a('0x2b')][_0x7a7a('0x30')]));_0x21a3d0[_0x7a7a('0x31')]=_0x21a3d0[_0x7a7a('0x31')]['length']?_0x21a3d0['attributes']:_0x4227a2[_0x7a7a('0x2e')];if(_0x148aae[_0x7a7a('0x2b')][_0x7a7a('0x45')]){_0x21a3d0[_0x7a7a('0x46')]=[{'all':!![]}];}_0x21a3d0=_[_0x7a7a('0x38')]({},_0x21a3d0,_0x148aae[_0x7a7a('0x3d')]);return db[_0x7a7a('0x3e')][_0x7a7a('0x47')](_0x21a3d0)[_0x7a7a('0x3f')](handleEntityNotFound(_0x356a5e,null))[_0x7a7a('0x3f')](respondWithResult(_0x356a5e,null))[_0x7a7a('0x41')](handleError(_0x356a5e,null));};exports[_0x7a7a('0x48')]=function(_0x4b0e4a,_0x39b0cf){return db[_0x7a7a('0x3e')][_0x7a7a('0x48')](_0x4b0e4a[_0x7a7a('0x49')],{})['then'](respondWithResult(_0x39b0cf,0xc9))[_0x7a7a('0x41')](handleError(_0x39b0cf,null));};exports[_0x7a7a('0x27')]=function(_0x2abf6f,_0x579343){if(_0x2abf6f[_0x7a7a('0x49')]['id']){delete _0x2abf6f[_0x7a7a('0x49')]['id'];}return db[_0x7a7a('0x3e')][_0x7a7a('0x47')]({'where':{'id':_0x2abf6f[_0x7a7a('0x43')]['id']}})[_0x7a7a('0x3f')](handleEntityNotFound(_0x579343,null))[_0x7a7a('0x3f')](saveUpdates(_0x2abf6f[_0x7a7a('0x49')],null))[_0x7a7a('0x3f')](respondWithResult(_0x579343,null))[_0x7a7a('0x41')](handleError(_0x579343,null));};exports[_0x7a7a('0x28')]=function(_0x5237bb,_0x2eed3b){return db['VtigerField'][_0x7a7a('0x47')]({'where':{'id':_0x5237bb[_0x7a7a('0x43')]['id']}})['then'](handleEntityNotFound(_0x2eed3b,null))[_0x7a7a('0x3f')](removeEntity(_0x2eed3b,null))[_0x7a7a('0x41')](handleError(_0x2eed3b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1a43c83..04dd227 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x1f124b,_0x3f9379){var _0x2fa91f=function(_0x1da541){while(--_0x1da541){_0x1f124b['push'](_0x1f124b['shift']());}};_0x2fa91f(++_0x3f9379);}(_0x7a54,0x106));var _0x47a5=function(_0x58dce4,_0x503544){_0x58dce4=_0x58dce4-0x0;var _0x144198=_0x7a54[_0x58dce4];return _0x144198;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 617b36a..36af2fb 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 _0xdaa8=['client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../config/environment','jayson/promise'];(function(_0x255bd2,_0x1c20bc){var _0x5061f6=function(_0x51a788){while(--_0x51a788){_0x255bd2['push'](_0x255bd2['shift']());}};_0x5061f6(++_0x1c20bc);}(_0xdaa8,0xe4));var _0x8daa=function(_0x2897eb,_0x40cd00){_0x2897eb=_0x2897eb-0x0;var _0x3cef58=_0xdaa8[_0x2897eb];return _0x3cef58;};'use strict';var _=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var moment=require(_0x8daa('0x2'));var BPromise=require(_0x8daa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8daa('0x4'));var jayson=require(_0x8daa('0x5'));var client=jayson[_0x8daa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e8116,_0x1f5a97,_0x48bf41){return new BPromise(function(_0x41de3e,_0x2df1a0){return client[_0x8daa('0x7')](_0x4e8116,_0x48bf41)[_0x8daa('0x8')](function(_0x207291){logger['info'](_0x8daa('0x9'),_0x1f5a97,_0x8daa('0xa'));logger[_0x8daa('0xb')](_0x8daa('0xc'),_0x1f5a97,_0x8daa('0xa'),JSON[_0x8daa('0xd')](_0x207291));if(_0x207291[_0x8daa('0xe')]){if(_0x207291[_0x8daa('0xe')][_0x8daa('0xf')]===0x1f4){logger[_0x8daa('0xe')](_0x8daa('0x9'),_0x1f5a97,_0x207291['error'][_0x8daa('0x10')]);return _0x2df1a0(_0x207291[_0x8daa('0xe')][_0x8daa('0x10')]);}logger['error'](_0x8daa('0x9'),_0x1f5a97,_0x207291['error'][_0x8daa('0x10')]);return _0x41de3e(_0x207291[_0x8daa('0xe')][_0x8daa('0x10')]);}else{logger['info'](_0x8daa('0x9'),_0x1f5a97,_0x8daa('0xa'));_0x41de3e(_0x207291['result']['message']);}})[_0x8daa('0x11')](function(_0x2fc822){logger[_0x8daa('0xe')](_0x8daa('0x9'),_0x1f5a97,_0x2fc822);_0x2df1a0(_0x2fc822);});});} \ No newline at end of file +var _0xab23=['stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab23,0x1bc));var _0x3ab2=function(_0x3dbb69,_0x3f2aa7){_0x3dbb69=_0x3dbb69-0x0;var _0x11a4ad=_0xab23[_0x3dbb69];return _0x11a4ad;};'use strict';var _=require(_0x3ab2('0x0'));var util=require(_0x3ab2('0x1'));var moment=require(_0x3ab2('0x2'));var BPromise=require(_0x3ab2('0x3'));var rs=require(_0x3ab2('0x4'));var fs=require('fs');var Redis=require(_0x3ab2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ab2('0x6'));var logger=require(_0x3ab2('0x7'))(_0x3ab2('0x8'));var config=require(_0x3ab2('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3ab2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e8d92,_0x5c861e,_0x36eee5){return new BPromise(function(_0x46d253,_0x20cfe1){return client[_0x3ab2('0xb')](_0x4e8d92,_0x36eee5)[_0x3ab2('0xc')](function(_0x120021){logger[_0x3ab2('0xd')](_0x3ab2('0xe'),_0x5c861e,_0x3ab2('0xf'));logger[_0x3ab2('0x10')](_0x3ab2('0x11'),_0x5c861e,'request\x20sent',JSON[_0x3ab2('0x12')](_0x120021));if(_0x120021[_0x3ab2('0x13')]){if(_0x120021[_0x3ab2('0x13')]['code']===0x1f4){logger['error'](_0x3ab2('0xe'),_0x5c861e,_0x120021[_0x3ab2('0x13')][_0x3ab2('0x14')]);return _0x20cfe1(_0x120021[_0x3ab2('0x13')][_0x3ab2('0x14')]);}logger[_0x3ab2('0x13')](_0x3ab2('0xe'),_0x5c861e,_0x120021[_0x3ab2('0x13')][_0x3ab2('0x14')]);return _0x46d253(_0x120021['error'][_0x3ab2('0x14')]);}else{logger['info'](_0x3ab2('0xe'),_0x5c861e,_0x3ab2('0xf'));_0x46d253(_0x120021['result']['message']);}})[_0x3ab2('0x15')](function(_0x43336e){logger[_0x3ab2('0x13')](_0x3ab2('0xe'),_0x5c861e,_0x43336e);_0x20cfe1(_0x43336e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index c185246..19a5dea 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 _0x37b9=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','util'];(function(_0x5c1501,_0x38c0bf){var _0x39b858=function(_0x682e67){while(--_0x682e67){_0x5c1501['push'](_0x5c1501['shift']());}};_0x39b858(++_0x38c0bf);}(_0x37b9,0x84));var _0x937b=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x37b9[_0x506172];return _0x2723c0;};'use strict';var multer=require('multer');var util=require(_0x937b('0x0'));var path=require(_0x937b('0x1'));var timeout=require(_0x937b('0x2'));var express=require(_0x937b('0x3'));var router=express['Router']();var auth=require(_0x937b('0x4'));var interaction=require(_0x937b('0x5'));var config=require(_0x937b('0x6'));var controller=require(_0x937b('0x7'));router[_0x937b('0x8')]('/',auth[_0x937b('0x9')](),controller[_0x937b('0xa')]);router[_0x937b('0x8')](_0x937b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x937b('0x8')](_0x937b('0xc'),auth[_0x937b('0x9')](),controller['getConfigurations']);router[_0x937b('0x8')](_0x937b('0xd'),auth[_0x937b('0x9')](),controller['getFields']);router[_0x937b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x937b('0xc'),auth[_0x937b('0x9')](),controller[_0x937b('0xf')]);router[_0x937b('0x10')](_0x937b('0xb'),auth[_0x937b('0x9')](),controller[_0x937b('0x11')]);router[_0x937b('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5627=['isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x3485c9,_0x1b2e25){var _0x382b23=function(_0x3a6895){while(--_0x3a6895){_0x3485c9['push'](_0x3485c9['shift']());}};_0x382b23(++_0x1b2e25);}(_0x5627,0x73));var _0x7562=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5627[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x7562('0x0'));var path=require(_0x7562('0x1'));var timeout=require(_0x7562('0x2'));var express=require(_0x7562('0x3'));var router=express[_0x7562('0x4')]();var auth=require(_0x7562('0x5'));var interaction=require(_0x7562('0x6'));var config=require(_0x7562('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x7562('0x8')]('/',auth['isAuthenticated'](),controller[_0x7562('0x9')]);router[_0x7562('0x8')](_0x7562('0xa'),auth[_0x7562('0xb')](),controller[_0x7562('0xc')]);router[_0x7562('0x8')](_0x7562('0xd'),auth[_0x7562('0xb')](),controller[_0x7562('0xe')]);router[_0x7562('0x8')]('/:id/fields',auth[_0x7562('0xb')](),controller[_0x7562('0xf')]);router[_0x7562('0x10')]('/',auth[_0x7562('0xb')](),controller[_0x7562('0x11')]);router[_0x7562('0x10')](_0x7562('0xd'),auth[_0x7562('0xb')](),controller[_0x7562('0x12')]);router['put'](_0x7562('0xa'),auth[_0x7562('0xb')](),controller['update']);router[_0x7562('0x13')](_0x7562('0xa'),auth[_0x7562('0xb')](),controller[_0x7562('0x14')]);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 b2d986a..06bf26e 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 _0xd8fc=['token','integrationTab','newTab','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x2f5718,_0x5c9232){var _0x5af8e4=function(_0x9fe3e2){while(--_0x9fe3e2){_0x2f5718['push'](_0x2f5718['shift']());}};_0x5af8e4(++_0x5c9232);}(_0xd8fc,0x150));var _0xcd8f=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0xd8fc[_0x47568e];return _0x33815b;};'use strict';var Sequelize=require('sequelize');module[_0xcd8f('0x0')]={'name':{'type':Sequelize[_0xcd8f('0x1')]},'description':{'type':Sequelize[_0xcd8f('0x1')]},'username':{'type':Sequelize[_0xcd8f('0x1')],'unique':_0xcd8f('0x2')},'password':{'type':Sequelize[_0xcd8f('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcd8f('0x3')},'authType':{'type':Sequelize[_0xcd8f('0x4')](_0xcd8f('0x5'),_0xcd8f('0x6')),'defaultValue':_0xcd8f('0x5')},'serverUrl':{'type':Sequelize[_0xcd8f('0x1')]},'type':{'type':Sequelize['ENUM'](_0xcd8f('0x7'),_0xcd8f('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x5911=['exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5911,0x1d4));var _0x1591=function(_0x427f3a,_0x361a59){_0x427f3a=_0x427f3a-0x0;var _0xf40f18=_0x5911[_0x427f3a];return _0xf40f18;};'use strict';var Sequelize=require('sequelize');module[_0x1591('0x0')]={'name':{'type':Sequelize[_0x1591('0x1')]},'description':{'type':Sequelize[_0x1591('0x1')]},'username':{'type':Sequelize[_0x1591('0x1')],'unique':_0x1591('0x2')},'password':{'type':Sequelize[_0x1591('0x1')]},'token':{'type':Sequelize[_0x1591('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1591('0x3')},'authType':{'type':Sequelize[_0x1591('0x4')](_0x1591('0x5'),_0x1591('0x6')),'defaultValue':_0x1591('0x5')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1591('0x4')](_0x1591('0x7'),_0x1591('0x8')),'defaultValue':_0x1591('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 87118d7..6f45bae 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 _0x9957=['GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','group','assignee','remove','position','system_field_options','custom_field_options','test','statusCode','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZendeskAccount,\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','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','map','type','key','VIRTUAL','filter','options','includeAll','include','findAll','show','params','ZendeskAccount','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf'];(function(_0x815424,_0x210441){var _0x771366=function(_0x3f8216){while(--_0x3f8216){_0x815424['push'](_0x815424['shift']());}};_0x771366(++_0x210441);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 hardwareService=require(_0x7995('0x15'));var logger=require(_0x7995('0x16'))('api');var utils=require(_0x7995('0x17'));var config=require(_0x7995('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7995('0x19'));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')]('ZendeskAccount,\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')]('ZendeskAccount,\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')]('ZendeskAccount,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){_0x510841['status'](0xcc)[_0x7995('0x2d')]();});}};}function handleEntityNotFound(_0x3acfc3,_0x4a176f){return function(_0x3e7020){if(!_0x3e7020){_0x3acfc3['sendStatus'](0x194);}return _0x3e7020;};}function handleError(_0x37917b,_0x1cb058){_0x1cb058=_0x1cb058||0x1f4;return function(_0x177cb4){logger['error'](_0x177cb4['stack']);if(_0x177cb4[_0x7995('0x36')]){delete _0x177cb4['name'];}_0x37917b['status'](_0x1cb058)[_0x7995('0x37')](_0x177cb4);};}exports[_0x7995('0x38')]=function(_0x5212ff,_0x1baa15){var _0x1922b4={},_0x2b772f={},_0x18667c={'count':0x0,'rows':[]};var _0x1e3dbf=db['ZendeskAccount'][_0x7995('0x39')];_0x2b772f[_0x7995('0x3a')]=_[_0x7995('0x3b')](_0x1e3dbf);_0x2b772f[_0x7995('0x3c')]=_['keys'](_0x5212ff[_0x7995('0x3c')]);_0x2b772f[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x2b772f[_0x7995('0x3a')],_0x2b772f[_0x7995('0x3c')]);_0x1922b4[_0x7995('0x3f')]=_['intersection'](_0x2b772f[_0x7995('0x3a')],qs[_0x7995('0x40')](_0x5212ff[_0x7995('0x3c')][_0x7995('0x40')]));_0x1922b4[_0x7995('0x3f')]=_0x1922b4[_0x7995('0x3f')][_0x7995('0x41')]?_0x1922b4[_0x7995('0x3f')]:_0x2b772f[_0x7995('0x3a')];if(!_0x5212ff[_0x7995('0x3c')][_0x7995('0x42')](_0x7995('0x43'))){_0x1922b4[_0x7995('0x44')]=qs['limit'](_0x5212ff['query'][_0x7995('0x44')]);_0x1922b4[_0x7995('0x30')]=qs['offset'](_0x5212ff['query'][_0x7995('0x30')]);}_0x1922b4['order']=qs['sort'](_0x5212ff[_0x7995('0x3c')][_0x7995('0x45')]);_0x1922b4[_0x7995('0x46')]=qs['filters'](_[_0x7995('0x47')](_0x5212ff['query'],_0x2b772f[_0x7995('0x3d')]));if(_0x5212ff['query']['filter']){_0x1922b4[_0x7995('0x46')]=_[_0x7995('0x48')](_0x1922b4[_0x7995('0x46')],{'$or':_[_0x7995('0x49')](_0x1e3dbf,function(_0x599ecb){if(_0x599ecb[_0x7995('0x4a')][_0x7995('0x4b')]!==_0x7995('0x4c')){var _0x6c7bec={};_0x6c7bec[_0x599ecb['field']]={'$like':'%'+_0x5212ff['query'][_0x7995('0x4d')]+'%'};return _0x6c7bec;}})});}_0x1922b4=_['merge']({},_0x1922b4,_0x5212ff[_0x7995('0x4e')]);var _0x59c153={'where':_0x1922b4[_0x7995('0x46')]};return db['ZendeskAccount'][_0x7995('0x2f')](_0x59c153)[_0x7995('0x20')](function(_0x4d9245){_0x18667c[_0x7995('0x2f')]=_0x4d9245;if(_0x5212ff[_0x7995('0x3c')][_0x7995('0x4f')]){_0x1922b4[_0x7995('0x50')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x7995('0x51')](_0x1922b4);})[_0x7995('0x20')](function(_0x237270){_0x18667c['rows']=_0x237270;return _0x18667c;})[_0x7995('0x20')](respondWithFilteredResult(_0x1baa15,_0x1922b4))[_0x7995('0x2a')](handleError(_0x1baa15,null));};exports[_0x7995('0x52')]=function(_0x3d8ae3,_0x255313){var _0x51934b={'raw':![],'where':{'id':_0x3d8ae3[_0x7995('0x53')]['id']}},_0x1a5cec={};_0x1a5cec['model']=_[_0x7995('0x3b')](db['ZendeskAccount'][_0x7995('0x39')]);_0x1a5cec[_0x7995('0x3c')]=_[_0x7995('0x3b')](_0x3d8ae3[_0x7995('0x3c')]);_0x1a5cec[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x1a5cec[_0x7995('0x3a')],_0x1a5cec['query']);_0x51934b[_0x7995('0x3f')]=_[_0x7995('0x3e')](_0x1a5cec[_0x7995('0x3a')],qs['fields'](_0x3d8ae3[_0x7995('0x3c')][_0x7995('0x40')]));_0x51934b[_0x7995('0x3f')]=_0x51934b['attributes']['length']?_0x51934b['attributes']:_0x1a5cec[_0x7995('0x3a')];if(_0x3d8ae3[_0x7995('0x3c')]['includeAll']){_0x51934b[_0x7995('0x50')]=[{'all':!![]}];}_0x51934b=_[_0x7995('0x48')]({},_0x51934b,_0x3d8ae3[_0x7995('0x4e')]);return db[_0x7995('0x54')][_0x7995('0x55')](_0x51934b)['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x20')](respondWithResult(_0x255313,null))['catch'](handleError(_0x255313,null));};exports[_0x7995('0x56')]=function(_0x33c801,_0x206d2a){return db['ZendeskAccount']['create'](_0x33c801['body'],{})['then'](respondWithResult(_0x206d2a,0xc9))[_0x7995('0x2a')](handleError(_0x206d2a,null));};exports[_0x7995('0x35')]=function(_0x1a861c,_0x150261){if(_0x1a861c[_0x7995('0x57')]['id']){delete _0x1a861c[_0x7995('0x57')]['id'];}return db[_0x7995('0x54')][_0x7995('0x55')]({'where':{'id':_0x1a861c[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x150261,null))[_0x7995('0x20')](saveUpdates(_0x1a861c[_0x7995('0x57')],null))[_0x7995('0x20')](respondWithResult(_0x150261,null))[_0x7995('0x2a')](handleError(_0x150261,null));};exports[_0x7995('0x58')]=function(_0x416133,_0x447a2b){return db[_0x7995('0x54')][_0x7995('0x55')]({'where':{'id':_0x416133['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x447a2b,null))[_0x7995('0x20')](removeEntity(_0x447a2b,null))[_0x7995('0x2a')](handleError(_0x447a2b,null));};exports[_0x7995('0x59')]=function(_0x5d160d,_0x53125a,_0x402fa0){var _0x197b52={};var _0x5b9467={};var _0x332a85;var _0x51c50b;return db[_0x7995('0x54')][_0x7995('0x5a')]({'where':{'id':_0x5d160d[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x53125a,null))['then'](function(_0x5e2d97){if(_0x5e2d97){_0x332a85=_0x5e2d97;_0x5b9467[_0x7995('0x3a')]=_[_0x7995('0x3b')](db[_0x7995('0x5b')][_0x7995('0x39')]);_0x5b9467[_0x7995('0x3c')]=_[_0x7995('0x3b')](_0x5d160d[_0x7995('0x3c')]);_0x5b9467[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x5b9467['model'],_0x5b9467[_0x7995('0x3c')]);_0x197b52[_0x7995('0x3f')]=_[_0x7995('0x3e')](_0x5b9467[_0x7995('0x3a')],qs['fields'](_0x5d160d['query'][_0x7995('0x40')]));_0x197b52[_0x7995('0x3f')]=_0x197b52['attributes'][_0x7995('0x41')]?_0x197b52[_0x7995('0x3f')]:_0x5b9467[_0x7995('0x3a')];_0x197b52[_0x7995('0x5c')]=qs[_0x7995('0x45')](_0x5d160d['query'][_0x7995('0x45')]);_0x197b52['where']=qs[_0x7995('0x3d')](_[_0x7995('0x47')](_0x5d160d[_0x7995('0x3c')],_0x5b9467[_0x7995('0x3d')]));if(_0x5d160d[_0x7995('0x3c')][_0x7995('0x4d')]){_0x197b52[_0x7995('0x46')]=_[_0x7995('0x48')](_0x197b52[_0x7995('0x46')],{'$or':_[_0x7995('0x49')](_0x197b52[_0x7995('0x3f')],function(_0x234d8d){var _0x56eb85={};_0x56eb85[_0x234d8d]={'$like':'%'+_0x5d160d[_0x7995('0x3c')][_0x7995('0x4d')]+'%'};return _0x56eb85;})});}_0x197b52=_[_0x7995('0x48')]({},_0x197b52,_0x5d160d[_0x7995('0x4e')]);return _0x332a85[_0x7995('0x59')](_0x197b52);}})['then'](function(_0x4b54f2){if(_0x4b54f2){_0x51c50b=_0x4b54f2[_0x7995('0x41')];if(!_0x5d160d[_0x7995('0x3c')][_0x7995('0x42')](_0x7995('0x43'))){_0x197b52['limit']=qs[_0x7995('0x44')](_0x5d160d['query']['limit']);_0x197b52[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x5d160d[_0x7995('0x3c')][_0x7995('0x30')]);}return _0x332a85[_0x7995('0x59')](_0x197b52);}})[_0x7995('0x20')](function(_0x32a52f){if(_0x32a52f){return _0x32a52f?{'count':_0x51c50b,'rows':_0x32a52f}:null;}})[_0x7995('0x20')](respondWithResult(_0x53125a,null))[_0x7995('0x2a')](handleError(_0x53125a,null));};exports[_0x7995('0x5d')]=function(_0x560b0a,_0x2dc1f7,_0x8908cd){if(_0x560b0a[_0x7995('0x57')]['id']){delete _0x560b0a['body']['id'];}return db[_0x7995('0x54')][_0x7995('0x5a')]({'where':{'id':_0x560b0a[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x2dc1f7,null))[_0x7995('0x20')](function(_0x51ab1e){if(_0x51ab1e){_0x560b0a[_0x7995('0x57')][_0x7995('0x5e')]=_0x51ab1e['id'];_0x560b0a[_0x7995('0x57')][_0x7995('0x5f')]=integrations[_0x7995('0x60')](_0x560b0a['body']['channel'],_0x560b0a[_0x7995('0x57')][_0x7995('0x4a')]);_0x560b0a[_0x7995('0x57')][_0x7995('0x61')]=integrations['getDescriptions'](_0x560b0a[_0x7995('0x57')][_0x7995('0x62')],_0x560b0a['body']['type']);return db[_0x7995('0x5b')][_0x7995('0x56')](_0x560b0a['body'],{'include':[{'model':db[_0x7995('0x63')],'as':'Subjects'},{'model':db[_0x7995('0x63')],'as':_0x7995('0x61')}]});}return null;})['then'](respondWithResult(_0x2dc1f7,null))['catch'](handleError(_0x2dc1f7,null));};exports[_0x7995('0x64')]=function(_0x50c1a4,_0x31b9e6,_0xa41fff){var _0x3dd197='';return db[_0x7995('0x54')][_0x7995('0x5a')]({'where':{'id':_0x50c1a4[_0x7995('0x53')]['id']},'attributes':['id',_0x7995('0x65'),_0x7995('0x66'),_0x7995('0x67'),_0x7995('0x68'),_0x7995('0x69')]})[_0x7995('0x20')](handleEntityNotFound(_0x31b9e6,null))[_0x7995('0x20')](function(_0x1ff436){if(_0x1ff436){_0x3dd197=_0x1ff436[_0x7995('0x69')];var _0x3773de=_0x3dd197[_0x7995('0x6a')](-0x1);if(_0x3773de==='/'){_0x3dd197=_0x3dd197[_0x7995('0x6b')](0x0,_0x3dd197[_0x7995('0x6c')](_0x3773de));}var _0xa2fc8e={'method':_0x7995('0x6d'),'uri':util[_0x7995('0x6e')](_0x7995('0x6f'),_0x3dd197,_0x7995('0x70')),'json':!![]};switch(_0x1ff436[_0x7995('0x68')]){case _0x7995('0x66'):_0xa2fc8e[_0x7995('0x71')]={'Authorization':util[_0x7995('0x6e')]('Basic\x20%s',new Buffer(util[_0x7995('0x6e')](_0x7995('0x72'),_0x1ff436['username'],_0x1ff436['password']))[_0x7995('0x73')](_0x7995('0x74')))};break;case _0x7995('0x67'):_0xa2fc8e[_0x7995('0x71')]={'Authorization':util[_0x7995('0x6e')](_0x7995('0x75'),new Buffer(util['format'](_0x7995('0x76'),_0x1ff436[_0x7995('0x65')],_0x1ff436[_0x7995('0x67')]))[_0x7995('0x73')](_0x7995('0x74')))};break;default:throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x77'));}return rp(_0xa2fc8e);}})['then'](function(_0x1c8e7d){if(_0x1c8e7d){var _0x2b8217=['subject','description',_0x7995('0x78'),_0x7995('0x79')];_[_0x7995('0x7a')](_0x1c8e7d[_0x7995('0x70')],function(_0xe42797){return _0x2b8217['includes'](_0xe42797[_0x7995('0x4a')]);});return{'count':_0x1c8e7d[_0x7995('0x70')]['length'],'rows':_[_0x7995('0x49')](_0x1c8e7d[_0x7995('0x70')],function(_0x489bac){return{'id':_0x489bac['id'],'name':_0x489bac[_0x7995('0x7b')]>0x7?_0x489bac['title']:_0x489bac[_0x7995('0x4a')],'custom':_0x489bac[_0x7995('0x7b')]>0x7?!![]:![],'options':_0x489bac[_0x7995('0x7c')]?_0x489bac[_0x7995('0x7c')]:_0x489bac[_0x7995('0x7d')]?_0x489bac['custom_field_options']:[]};})};}})[_0x7995('0x20')](respondWithResult(_0x31b9e6,null))[_0x7995('0x2a')](function(_0x38b37f){var _0x5bc4fa=_0x50c1a4[_0x7995('0x3c')][_0x7995('0x7e')]?0x1f4:_0x38b37f[_0x7995('0x7f')]||0x1f4;logger[_0x7995('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x7995('0x64'),_0x5bc4fa,JSON[_0x7995('0x25')](_0x38b37f));delete _0x38b37f[_0x7995('0x36')];if(_0x5bc4fa===0x191){_0x5bc4fa=0x190;}_0x31b9e6['status'](_0x5bc4fa)['send'](_0x50c1a4[_0x7995('0x3c')][_0x7995('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x38b37f['statusCode']}:_0x38b37f);});}; \ No newline at end of file +var _0x814b=['merge','map','key','VIRTUAL','field','count','includeAll','include','findAll','rows','params','keys','rawAttributes','length','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','order','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZendeskField','token','authType','remoteUri','slice','format','%s/%s','ticket_fields','password','headers','username','toString','base64','Basic\x20%s','Unknown\x20authentication\x20type','subject','includes','position','title','system_field_options','custom_field_options','statusCode','getFields','Wrong\x20credentials','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','../../config/license/hardware','../../config/logger','api','../../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','error','ZendeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','Content-Range','reject','save','update','destroy','stack','name','send','index','ZendeskAccount','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where'];(function(_0x5bfb1c,_0x3ed67f){var _0x3cf3d8=function(_0x383373){while(--_0x383373){_0x5bfb1c['push'](_0x5bfb1c['shift']());}};_0x3cf3d8(++_0x3ed67f);}(_0x814b,0x1a2));var _0xb814=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0x814b[_0x272d90];return _0x2bf4a2;};'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 hardwareService=require(_0xb814('0x15'));var logger=require(_0xb814('0x16'))(_0xb814('0x17'));var utils=require('../../config/utils');var config=require(_0xb814('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb814('0x19'));var jayson=require(_0xb814('0x1a'));var client=jayson[_0xb814('0x1b')][_0xb814('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2ce718,_0x3bde14,_0x1438e7){if(_0x1438e7){var _0x41ed7b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41ed7b[_0xb814('0x1d')](_0x3bde14)){return _0x2ce718;}else{throw new db[(_0xb814('0x1e'))][(_0xb814('0x1f'))](_0xb814('0x20'));}}else{return _0x2ce718;}}function respondWithRpcPromise(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6){return new BPromise(function(_0x45e0d0,_0x265a83){var _0x125ce2=_0x3a71d6||client;return _0x125ce2[_0xb814('0x21')](_0x17f5bd,_0x303aca)[_0xb814('0x22')](function(_0x48c9df){logger[_0xb814('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x39bfcf,_0xb814('0x24'));logger[_0xb814('0x25')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x39bfcf,'request\x20sent',JSON['stringify'](_0x48c9df));if(_0x48c9df[_0xb814('0x26')]){if(_0x48c9df['error']['code']===0x1f4){logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x48c9df[_0xb814('0x26')]['message']);return _0x265a83(_0x48c9df[_0xb814('0x26')]['message']);}logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x48c9df[_0xb814('0x26')][_0xb814('0x28')]);return _0x45e0d0(_0x48c9df[_0xb814('0x26')][_0xb814('0x28')]);}else{logger[_0xb814('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x39bfcf,_0xb814('0x24'));_0x45e0d0(_0x48c9df['result'][_0xb814('0x28')]);}})[_0xb814('0x29')](function(_0x31c7ec){logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x31c7ec);_0x265a83(_0x31c7ec);});});}function respondWithStatusCode(_0xb9e57d,_0x3d836c){_0x3d836c=_0x3d836c||0xcc;return function(_0x5755ea){if(_0x5755ea){return _0xb9e57d[_0xb814('0x2a')](_0x3d836c);}return _0xb9e57d[_0xb814('0x2b')](_0x3d836c)[_0xb814('0x2c')]();};}function respondWithResult(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0xc8;return function(_0x1d5965){if(_0x1d5965){return _0x349394[_0xb814('0x2b')](_0x32ed56)[_0xb814('0x2d')](_0x1d5965);}};}function respondWithFilteredResult(_0x5a6291,_0x271aa8){return function(_0x328a08){if(_0x328a08){var _0x52ed64=_0x328a08['count'],_0x9008b2=_0x271aa8[_0xb814('0x2e')],_0x37d24d=_0x271aa8[_0xb814('0x2e')]+_0x271aa8['limit'],_0x530744;if(_0x37d24d>=_0x52ed64){_0x37d24d=_0x52ed64;_0x530744=0xc8;}else{_0x530744=0xce;}_0x5a6291[_0xb814('0x2b')](_0x530744);return _0x5a6291['set'](_0xb814('0x2f'),_0x9008b2+'-'+_0x37d24d+'/'+_0x52ed64)['json'](_0x328a08);}return null;};}function patchUpdates(_0x4cfc58){return function(_0x419cd9){try{jsonpatch['apply'](_0x419cd9,_0x4cfc58,!![]);}catch(_0x2431e2){return BPromise[_0xb814('0x30')](_0x2431e2);}return _0x419cd9[_0xb814('0x31')]();};}function saveUpdates(_0x599f9f,_0x51d5ae){return function(_0x26d3a9){if(_0x26d3a9){return _0x26d3a9[_0xb814('0x32')](_0x599f9f)['then'](function(_0x2c8943){return _0x2c8943;});}return null;};}function removeEntity(_0xe558d5,_0x692c72){return function(_0x217b7e){if(_0x217b7e){return _0x217b7e[_0xb814('0x33')]()[_0xb814('0x22')](function(){_0xe558d5[_0xb814('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3207ec,_0x2263f6){return function(_0x30de5a){if(!_0x30de5a){_0x3207ec[_0xb814('0x2a')](0x194);}return _0x30de5a;};}function handleError(_0x14100d,_0x4ff31a){_0x4ff31a=_0x4ff31a||0x1f4;return function(_0x16ef82){logger['error'](_0x16ef82[_0xb814('0x34')]);if(_0x16ef82[_0xb814('0x35')]){delete _0x16ef82[_0xb814('0x35')];}_0x14100d['status'](_0x4ff31a)[_0xb814('0x36')](_0x16ef82);};}exports[_0xb814('0x37')]=function(_0x4ea6f8,_0x2fcd92){var _0x2d0e27={},_0x1a8bd0={},_0x1f7cd8={'count':0x0,'rows':[]};var _0xd77d96=db[_0xb814('0x38')]['rawAttributes'];_0x1a8bd0[_0xb814('0x39')]=_['keys'](_0xd77d96);_0x1a8bd0[_0xb814('0x3a')]=_['keys'](_0x4ea6f8[_0xb814('0x3a')]);_0x1a8bd0['filters']=_[_0xb814('0x3b')](_0x1a8bd0[_0xb814('0x39')],_0x1a8bd0['query']);_0x2d0e27['attributes']=_['intersection'](_0x1a8bd0['model'],qs[_0xb814('0x3c')](_0x4ea6f8[_0xb814('0x3a')][_0xb814('0x3c')]));_0x2d0e27[_0xb814('0x3d')]=_0x2d0e27['attributes']['length']?_0x2d0e27[_0xb814('0x3d')]:_0x1a8bd0['model'];if(!_0x4ea6f8[_0xb814('0x3a')][_0xb814('0x3e')](_0xb814('0x3f'))){_0x2d0e27[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x4ea6f8[_0xb814('0x3a')][_0xb814('0x40')]);_0x2d0e27[_0xb814('0x2e')]=qs[_0xb814('0x2e')](_0x4ea6f8['query']['offset']);}_0x2d0e27['order']=qs[_0xb814('0x41')](_0x4ea6f8['query'][_0xb814('0x41')]);_0x2d0e27['where']=qs[_0xb814('0x42')](_[_0xb814('0x43')](_0x4ea6f8[_0xb814('0x3a')],_0x1a8bd0[_0xb814('0x42')]));if(_0x4ea6f8['query'][_0xb814('0x44')]){_0x2d0e27[_0xb814('0x45')]=_[_0xb814('0x46')](_0x2d0e27[_0xb814('0x45')],{'$or':_[_0xb814('0x47')](_0xd77d96,function(_0x450a08){if(_0x450a08['type'][_0xb814('0x48')]!==_0xb814('0x49')){var _0x9ffd73={};_0x9ffd73[_0x450a08[_0xb814('0x4a')]]={'$like':'%'+_0x4ea6f8[_0xb814('0x3a')][_0xb814('0x44')]+'%'};return _0x9ffd73;}})});}_0x2d0e27=_[_0xb814('0x46')]({},_0x2d0e27,_0x4ea6f8['options']);var _0x4a5e84={'where':_0x2d0e27[_0xb814('0x45')]};return db[_0xb814('0x38')][_0xb814('0x4b')](_0x4a5e84)[_0xb814('0x22')](function(_0x43f1b){_0x1f7cd8[_0xb814('0x4b')]=_0x43f1b;if(_0x4ea6f8[_0xb814('0x3a')][_0xb814('0x4c')]){_0x2d0e27[_0xb814('0x4d')]=[{'all':!![]}];}return db[_0xb814('0x38')][_0xb814('0x4e')](_0x2d0e27);})['then'](function(_0x37800a){_0x1f7cd8[_0xb814('0x4f')]=_0x37800a;return _0x1f7cd8;})['then'](respondWithFilteredResult(_0x2fcd92,_0x2d0e27))[_0xb814('0x29')](handleError(_0x2fcd92,null));};exports['show']=function(_0x2fb0f7,_0x37866f){var _0xc71270={'raw':![],'where':{'id':_0x2fb0f7[_0xb814('0x50')]['id']}},_0x22b2ef={};_0x22b2ef[_0xb814('0x39')]=_[_0xb814('0x51')](db[_0xb814('0x38')][_0xb814('0x52')]);_0x22b2ef[_0xb814('0x3a')]=_['keys'](_0x2fb0f7['query']);_0x22b2ef[_0xb814('0x42')]=_[_0xb814('0x3b')](_0x22b2ef[_0xb814('0x39')],_0x22b2ef[_0xb814('0x3a')]);_0xc71270[_0xb814('0x3d')]=_[_0xb814('0x3b')](_0x22b2ef[_0xb814('0x39')],qs['fields'](_0x2fb0f7[_0xb814('0x3a')][_0xb814('0x3c')]));_0xc71270[_0xb814('0x3d')]=_0xc71270['attributes'][_0xb814('0x53')]?_0xc71270['attributes']:_0x22b2ef[_0xb814('0x39')];if(_0x2fb0f7['query'][_0xb814('0x4c')]){_0xc71270[_0xb814('0x4d')]=[{'all':!![]}];}_0xc71270=_['merge']({},_0xc71270,_0x2fb0f7[_0xb814('0x54')]);return db[_0xb814('0x38')][_0xb814('0x55')](_0xc71270)['then'](handleEntityNotFound(_0x37866f,null))[_0xb814('0x22')](respondWithResult(_0x37866f,null))['catch'](handleError(_0x37866f,null));};exports[_0xb814('0x56')]=function(_0x158893,_0x4aed78){return db[_0xb814('0x38')]['create'](_0x158893['body'],{})[_0xb814('0x22')](respondWithResult(_0x4aed78,0xc9))[_0xb814('0x29')](handleError(_0x4aed78,null));};exports[_0xb814('0x32')]=function(_0x47a814,_0x28bbab){if(_0x47a814['body']['id']){delete _0x47a814[_0xb814('0x57')]['id'];}return db[_0xb814('0x38')]['find']({'where':{'id':_0x47a814[_0xb814('0x50')]['id']}})['then'](handleEntityNotFound(_0x28bbab,null))[_0xb814('0x22')](saveUpdates(_0x47a814[_0xb814('0x57')],null))[_0xb814('0x22')](respondWithResult(_0x28bbab,null))[_0xb814('0x29')](handleError(_0x28bbab,null));};exports[_0xb814('0x33')]=function(_0x34acca,_0x21d3e9){return db[_0xb814('0x38')]['find']({'where':{'id':_0x34acca[_0xb814('0x50')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x21d3e9,null))['then'](removeEntity(_0x21d3e9,null))[_0xb814('0x29')](handleError(_0x21d3e9,null));};exports[_0xb814('0x58')]=function(_0x4d13db,_0x371000,_0x58b9a6){var _0x48362c={};var _0x2114ca={};var _0x5257be;var _0x3ff213;return db[_0xb814('0x38')][_0xb814('0x59')]({'where':{'id':_0x4d13db['params']['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x371000,null))['then'](function(_0x2ef77d){if(_0x2ef77d){_0x5257be=_0x2ef77d;_0x2114ca[_0xb814('0x39')]=_[_0xb814('0x51')](db[_0xb814('0x5a')][_0xb814('0x52')]);_0x2114ca[_0xb814('0x3a')]=_[_0xb814('0x51')](_0x4d13db[_0xb814('0x3a')]);_0x2114ca[_0xb814('0x42')]=_['intersection'](_0x2114ca[_0xb814('0x39')],_0x2114ca[_0xb814('0x3a')]);_0x48362c[_0xb814('0x3d')]=_[_0xb814('0x3b')](_0x2114ca[_0xb814('0x39')],qs[_0xb814('0x3c')](_0x4d13db['query'][_0xb814('0x3c')]));_0x48362c['attributes']=_0x48362c[_0xb814('0x3d')][_0xb814('0x53')]?_0x48362c[_0xb814('0x3d')]:_0x2114ca['model'];_0x48362c[_0xb814('0x5b')]=qs['sort'](_0x4d13db[_0xb814('0x3a')]['sort']);_0x48362c[_0xb814('0x45')]=qs[_0xb814('0x42')](_[_0xb814('0x43')](_0x4d13db[_0xb814('0x3a')],_0x2114ca[_0xb814('0x42')]));if(_0x4d13db[_0xb814('0x3a')][_0xb814('0x44')]){_0x48362c['where']=_[_0xb814('0x46')](_0x48362c['where'],{'$or':_[_0xb814('0x47')](_0x48362c[_0xb814('0x3d')],function(_0x1b989d){var _0x3dcaeb={};_0x3dcaeb[_0x1b989d]={'$like':'%'+_0x4d13db[_0xb814('0x3a')][_0xb814('0x44')]+'%'};return _0x3dcaeb;})});}_0x48362c=_['merge']({},_0x48362c,_0x4d13db[_0xb814('0x54')]);return _0x5257be[_0xb814('0x58')](_0x48362c);}})['then'](function(_0x3bb2b4){if(_0x3bb2b4){_0x3ff213=_0x3bb2b4[_0xb814('0x53')];if(!_0x4d13db[_0xb814('0x3a')][_0xb814('0x3e')](_0xb814('0x3f'))){_0x48362c['limit']=qs[_0xb814('0x40')](_0x4d13db['query'][_0xb814('0x40')]);_0x48362c[_0xb814('0x2e')]=qs[_0xb814('0x2e')](_0x4d13db[_0xb814('0x3a')][_0xb814('0x2e')]);}return _0x5257be[_0xb814('0x58')](_0x48362c);}})['then'](function(_0x506bf2){if(_0x506bf2){return _0x506bf2?{'count':_0x3ff213,'rows':_0x506bf2}:null;}})['then'](respondWithResult(_0x371000,null))[_0xb814('0x29')](handleError(_0x371000,null));};exports['addConfiguration']=function(_0x45a8b9,_0x1d3954,_0x25db89){if(_0x45a8b9['body']['id']){delete _0x45a8b9[_0xb814('0x57')]['id'];}return db[_0xb814('0x38')][_0xb814('0x59')]({'where':{'id':_0x45a8b9['params']['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x1d3954,null))[_0xb814('0x22')](function(_0x1f39c0){if(_0x1f39c0){_0x45a8b9[_0xb814('0x57')]['AccountId']=_0x1f39c0['id'];_0x45a8b9['body'][_0xb814('0x5c')]=integrations[_0xb814('0x5d')](_0x45a8b9[_0xb814('0x57')][_0xb814('0x5e')],_0x45a8b9[_0xb814('0x57')][_0xb814('0x5f')]);_0x45a8b9[_0xb814('0x57')][_0xb814('0x60')]=integrations[_0xb814('0x61')](_0x45a8b9[_0xb814('0x57')][_0xb814('0x5e')],_0x45a8b9[_0xb814('0x57')][_0xb814('0x5f')]);return db[_0xb814('0x5a')][_0xb814('0x56')](_0x45a8b9['body'],{'include':[{'model':db[_0xb814('0x62')],'as':_0xb814('0x5c')},{'model':db[_0xb814('0x62')],'as':_0xb814('0x60')}]});}return null;})[_0xb814('0x22')](respondWithResult(_0x1d3954,null))[_0xb814('0x29')](handleError(_0x1d3954,null));};exports['getFields']=function(_0xff4dc2,_0x52e1fc,_0x872d43){var _0x39aa00='';return db[_0xb814('0x38')][_0xb814('0x59')]({'where':{'id':_0xff4dc2[_0xb814('0x50')]['id']},'attributes':['id','username','password',_0xb814('0x63'),_0xb814('0x64'),_0xb814('0x65')]})[_0xb814('0x22')](handleEntityNotFound(_0x52e1fc,null))['then'](function(_0x1ee95d){if(_0x1ee95d){_0x39aa00=_0x1ee95d['remoteUri'];var _0x39073c=_0x39aa00[_0xb814('0x66')](-0x1);if(_0x39073c==='/'){_0x39aa00=_0x39aa00['substring'](0x0,_0x39aa00['lastIndexOf'](_0x39073c));}var _0x2fa6b7={'method':'GET','uri':util[_0xb814('0x67')](_0xb814('0x68'),_0x39aa00,_0xb814('0x69')),'json':!![]};switch(_0x1ee95d[_0xb814('0x64')]){case _0xb814('0x6a'):_0x2fa6b7[_0xb814('0x6b')]={'Authorization':util[_0xb814('0x67')]('Basic\x20%s',new Buffer(util[_0xb814('0x67')]('%s:%s',_0x1ee95d[_0xb814('0x6c')],_0x1ee95d['password']))[_0xb814('0x6d')](_0xb814('0x6e')))};break;case'token':_0x2fa6b7[_0xb814('0x6b')]={'Authorization':util['format'](_0xb814('0x6f'),new Buffer(util[_0xb814('0x67')]('%s/token:%s',_0x1ee95d['username'],_0x1ee95d[_0xb814('0x63')]))[_0xb814('0x6d')](_0xb814('0x6e')))};break;default:throw new db[(_0xb814('0x1e'))][(_0xb814('0x1f'))](_0xb814('0x70'));}return rp(_0x2fa6b7);}})[_0xb814('0x22')](function(_0x314600){if(_0x314600){var _0x8cb107=[_0xb814('0x71'),'description','group','assignee'];_['remove'](_0x314600['ticket_fields'],function(_0x45a202){return _0x8cb107[_0xb814('0x72')](_0x45a202[_0xb814('0x5f')]);});return{'count':_0x314600['ticket_fields'][_0xb814('0x53')],'rows':_[_0xb814('0x47')](_0x314600[_0xb814('0x69')],function(_0x26ce5b){return{'id':_0x26ce5b['id'],'name':_0x26ce5b[_0xb814('0x73')]>0x7?_0x26ce5b[_0xb814('0x74')]:_0x26ce5b[_0xb814('0x5f')],'custom':_0x26ce5b[_0xb814('0x73')]>0x7?!![]:![],'options':_0x26ce5b['system_field_options']?_0x26ce5b[_0xb814('0x75')]:_0x26ce5b[_0xb814('0x76')]?_0x26ce5b[_0xb814('0x76')]:[]};})};}})[_0xb814('0x22')](respondWithResult(_0x52e1fc,null))['catch'](function(_0x29c1a4){var _0x280af5=_0xff4dc2[_0xb814('0x3a')][_0xb814('0x1d')]?0x1f4:_0x29c1a4[_0xb814('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb814('0x78'),_0x280af5,JSON['stringify'](_0x29c1a4));delete _0x29c1a4[_0xb814('0x35')];if(_0x280af5===0x191){_0x280af5=0x190;}_0x52e1fc[_0xb814('0x2b')](_0x280af5)['send'](_0xff4dc2[_0xb814('0x3a')]['test']?{'message':_0xb814('0x79'),'statusCode':_0x29c1a4['statusCode']}:_0x29c1a4);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7b533d8..a0e3df2 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 _0x3530=['moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','int_zendesk_accounts','lodash','util','api'];(function(_0x11b43b,_0x7c3c49){var _0x3f294a=function(_0x404b5a){while(--_0x404b5a){_0x11b43b['push'](_0x11b43b['shift']());}};_0x3f294a(++_0x7c3c49);}(_0x3530,0x105));var _0x0353=function(_0x1c514b,_0x268489){_0x1c514b=_0x1c514b-0x0;var _0x121aeb=_0x3530[_0x1c514b];return _0x121aeb;};'use strict';var _=require(_0x0353('0x0'));var util=require(_0x0353('0x1'));var logger=require('../../config/logger')(_0x0353('0x2'));var moment=require(_0x0353('0x3'));var BPromise=require('bluebird');var rp=require(_0x0353('0x4'));var fs=require('fs');var path=require(_0x0353('0x5'));var rimraf=require(_0x0353('0x6'));var config=require(_0x0353('0x7'));var attributes=require(_0x0353('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x0353('0x9')]=function(_0xa88fc6,_0x2191e7){return _0xa88fc6['define']('ZendeskAccount',attributes,{'tableName':_0x0353('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x965a=['moment','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x965a,0xb3));var _0xa965=function(_0x4fed26,_0x2dc716){_0x4fed26=_0x4fed26-0x0;var _0x225c76=_0x965a[_0x4fed26];return _0x225c76;};'use strict';var _=require(_0xa965('0x0'));var util=require(_0xa965('0x1'));var logger=require('../../config/logger')(_0xa965('0x2'));var moment=require(_0xa965('0x3'));var BPromise=require('bluebird');var rp=require(_0xa965('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa965('0x5'));var config=require(_0xa965('0x6'));var attributes=require(_0xa965('0x7'));var integrations=require(_0xa965('0x8'));module[_0xa965('0x9')]=function(_0x184a5d,_0x124d78){return _0x184a5d[_0xa965('0xa')](_0xa965('0xb'),attributes,{'tableName':_0xa965('0xc'),'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 c9e5889..94604b1 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x44256f,_0x4fda48){var _0x271d5a=function(_0x1ee169){while(--_0x1ee169){_0x44256f['push'](_0x44256f['shift']());}};_0x271d5a(++_0x4fda48);}(_0x757a,0xde));var _0xa757=function(_0xd8d04a,_0x70205e){_0xd8d04a=_0xd8d04a-0x0;var _0x42bbaf=_0x757a[_0xd8d04a];return _0x42bbaf;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0xfa582d,_0x29ca62){var _0x355a1e=function(_0x26146d){while(--_0x26146d){_0xfa582d['push'](_0xfa582d['shift']());}};_0x355a1e(++_0x29ca62);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 2a6e9c4..5de93f3 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 _0x839c=['getSubjects','getDescriptions','/:id/tags','getTags','post','create','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects'];(function(_0xeb453b,_0x43c736){var _0x4e48e5=function(_0x1dc341){while(--_0x1dc341){_0xeb453b['push'](_0xeb453b['shift']());}};_0x4e48e5(++_0x43c736);}(_0x839c,0x1ea));var _0xc839=function(_0x2173e7,_0x34fcd3){_0x2173e7=_0x2173e7-0x0;var _0x550cab=_0x839c[_0x2173e7];return _0x550cab;};'use strict';var multer=require(_0xc839('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc839('0x1'));var express=require(_0xc839('0x2'));var router=express[_0xc839('0x3')]();var auth=require(_0xc839('0x4'));var interaction=require(_0xc839('0x5'));var config=require(_0xc839('0x6'));var controller=require(_0xc839('0x7'));router['get']('/',auth[_0xc839('0x8')](),controller[_0xc839('0x9')]);router['get'](_0xc839('0xa'),auth[_0xc839('0x8')](),controller[_0xc839('0xb')]);router[_0xc839('0xc')](_0xc839('0xd'),auth['isAuthenticated'](),controller[_0xc839('0xe')]);router[_0xc839('0xc')](_0xc839('0xf'),auth[_0xc839('0x8')](),controller[_0xc839('0x10')]);router['get']('/:id/descriptions',auth[_0xc839('0x8')](),controller[_0xc839('0x11')]);router[_0xc839('0xc')](_0xc839('0x12'),auth[_0xc839('0x8')](),controller[_0xc839('0x13')]);router[_0xc839('0x14')]('/',auth[_0xc839('0x8')](),controller[_0xc839('0x15')]);router[_0xc839('0x14')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router['put'](_0xc839('0xa'),auth[_0xc839('0x8')](),controller['update']);router[_0xc839('0x16')](_0xc839('0xa'),auth[_0xc839('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd410=['getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x593adc,_0xb73a71){var _0x1213a8=function(_0x1e361b){while(--_0x1e361b){_0x593adc['push'](_0x593adc['shift']());}};_0x1213a8(++_0xb73a71);}(_0xd410,0x117));var _0x0d41=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xd410[_0x1f9f37];return _0x21c080;};'use strict';var multer=require(_0x0d41('0x0'));var util=require(_0x0d41('0x1'));var path=require(_0x0d41('0x2'));var timeout=require(_0x0d41('0x3'));var express=require(_0x0d41('0x4'));var router=express[_0x0d41('0x5')]();var auth=require(_0x0d41('0x6'));var interaction=require(_0x0d41('0x7'));var config=require(_0x0d41('0x8'));var controller=require(_0x0d41('0x9'));router[_0x0d41('0xa')]('/',auth[_0x0d41('0xb')](),controller['index']);router[_0x0d41('0xa')](_0x0d41('0xc'),auth[_0x0d41('0xb')](),controller[_0x0d41('0xd')]);router[_0x0d41('0xa')](_0x0d41('0xe'),auth[_0x0d41('0xb')](),controller[_0x0d41('0xf')]);router[_0x0d41('0xa')](_0x0d41('0x10'),auth[_0x0d41('0xb')](),controller[_0x0d41('0x11')]);router['get']('/:id/descriptions',auth[_0x0d41('0xb')](),controller[_0x0d41('0x12')]);router[_0x0d41('0xa')](_0x0d41('0x13'),auth['isAuthenticated'](),controller['getTags']);router[_0x0d41('0x14')]('/',auth['isAuthenticated'](),controller[_0x0d41('0x15')]);router[_0x0d41('0x14')](_0x0d41('0x13'),auth['isAuthenticated'](),controller[_0x0d41('0x16')]);router[_0x0d41('0x17')]('/:id',auth[_0x0d41('0xb')](),controller[_0x0d41('0x18')]);router[_0x0d41('0x19')]('/:id',auth[_0x0d41('0xb')](),controller[_0x0d41('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 0d174e1..9a97905 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 _0x4dbb=['sequelize','STRING'];(function(_0x3a0c80,_0x59f74c){var _0x771319=function(_0x5e03a7){while(--_0x5e03a7){_0x3a0c80['push'](_0x3a0c80['shift']());}};_0x771319(++_0x59f74c);}(_0x4dbb,0x19e));var _0xb4db=function(_0x4d578c,_0x4d2ed2){_0x4d578c=_0x4d578c-0x0;var _0xf41cac=_0x4dbb[_0x4d578c];return _0xf41cac;};'use strict';var Sequelize=require(_0xb4db('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb4db('0x1')]}}; \ No newline at end of file +var _0x0d0d=['sequelize','exports','STRING'];(function(_0x1f1f9e,_0x1ef7fc){var _0x1e2a98=function(_0x31b0c6){while(--_0x31b0c6){_0x1f1f9e['push'](_0x1f1f9e['shift']());}};_0x1e2a98(++_0x1ef7fc);}(_0x0d0d,0x13b));var _0xd0d0=function(_0x563553,_0x347762){_0x563553=_0x563553-0x0;var _0x3562f6=_0x0d0d[_0x563553];return _0x3562f6;};'use strict';var Sequelize=require(_0xd0d0('0x0'));module[_0xd0d0('0x1')]={'name':{'type':Sequelize[_0xd0d0('0x2')]},'description':{'type':Sequelize[_0xd0d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index a3739d9..c2483f1 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 _0xdc0f=['message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','destroy','name','ZendeskConfiguration','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','key','options','includeAll','include','findAll','rows','show','params','find','create','body','ZendeskField','map','getFields','findOne','order','getDescriptions','Tag','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','stringify','code','error','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc0f,0x90));var _0xfdc0=function(_0xfb63d3,_0x308062){_0xfb63d3=_0xfb63d3-0x0;var _0x523dac=_0xdc0f[_0xfb63d3];return _0x523dac;};'use strict';var pdf=require(_0xfdc0('0x0'));var emlformat=require(_0xfdc0('0x1'));var rimraf=require(_0xfdc0('0x2'));var zipdir=require(_0xfdc0('0x3'));var jsonpatch=require(_0xfdc0('0x4'));var rp=require(_0xfdc0('0x5'));var moment=require(_0xfdc0('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfdc0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfdc0('0x8'));var ejs=require(_0xfdc0('0x9'));var fs=require('fs');var _=require(_0xfdc0('0xa'));var squel=require(_0xfdc0('0xb'));var crypto=require(_0xfdc0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfdc0('0x8'));var querystring=require(_0xfdc0('0xd'));var Papa=require(_0xfdc0('0xe'));var Redis=require(_0xfdc0('0xf'));var authService=require(_0xfdc0('0x10'));var qs=require(_0xfdc0('0x11'));var hardwareService=require(_0xfdc0('0x12'));var logger=require(_0xfdc0('0x13'))(_0xfdc0('0x14'));var utils=require(_0xfdc0('0x15'));var config=require(_0xfdc0('0x16'));var db=require(_0xfdc0('0x17'))['db'];var jayson=require(_0xfdc0('0x18'));var client=jayson[_0xfdc0('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x536958,_0x4fd856,_0xe3475c){if(_0xe3475c){var _0x45f499=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45f499[_0xfdc0('0x1a')](_0x4fd856)){return _0x536958;}else{throw new db[(_0xfdc0('0x1b'))][(_0xfdc0('0x1c'))](_0xfdc0('0x1d'));}}else{return _0x536958;}}function respondWithRpcPromise(_0x107108,_0x223bfd,_0x372b75,_0x3319d8){return new BPromise(function(_0x2308a2,_0x15a2b3){var _0x3fb82f=_0x3319d8||client;return _0x3fb82f[_0xfdc0('0x1e')](_0x107108,_0x372b75)[_0xfdc0('0x1f')](function(_0x2cb9b8){logger[_0xfdc0('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x223bfd,'request\x20sent');logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x223bfd,_0xfdc0('0x21'),JSON[_0xfdc0('0x22')](_0x2cb9b8));if(_0x2cb9b8['error']){if(_0x2cb9b8['error'][_0xfdc0('0x23')]===0x1f4){logger[_0xfdc0('0x24')](_0xfdc0('0x25'),_0x223bfd,_0x2cb9b8[_0xfdc0('0x24')][_0xfdc0('0x26')]);return _0x15a2b3(_0x2cb9b8[_0xfdc0('0x24')]['message']);}logger[_0xfdc0('0x24')](_0xfdc0('0x25'),_0x223bfd,_0x2cb9b8[_0xfdc0('0x24')]['message']);return _0x2308a2(_0x2cb9b8[_0xfdc0('0x24')]['message']);}else{logger[_0xfdc0('0x20')](_0xfdc0('0x25'),_0x223bfd,_0xfdc0('0x21'));_0x2308a2(_0x2cb9b8[_0xfdc0('0x27')][_0xfdc0('0x26')]);}})[_0xfdc0('0x28')](function(_0x580e0c){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x223bfd,_0x580e0c);_0x15a2b3(_0x580e0c);});});}function respondWithStatusCode(_0x536c99,_0x288a76){_0x288a76=_0x288a76||0xcc;return function(_0x4164be){if(_0x4164be){return _0x536c99[_0xfdc0('0x29')](_0x288a76);}return _0x536c99['status'](_0x288a76)[_0xfdc0('0x2a')]();};}function respondWithResult(_0x571d3e,_0x56b53c){_0x56b53c=_0x56b53c||0xc8;return function(_0x4435da){if(_0x4435da){return _0x571d3e[_0xfdc0('0x2b')](_0x56b53c)[_0xfdc0('0x2c')](_0x4435da);}};}function respondWithFilteredResult(_0x37d82a,_0x256774){return function(_0x163c28){if(_0x163c28){var _0x410b8a=_0x163c28[_0xfdc0('0x2d')],_0x51d5f5=_0x256774['offset'],_0x39760a=_0x256774[_0xfdc0('0x2e')]+_0x256774[_0xfdc0('0x2f')],_0x162078;if(_0x39760a>=_0x410b8a){_0x39760a=_0x410b8a;_0x162078=0xc8;}else{_0x162078=0xce;}_0x37d82a['status'](_0x162078);return _0x37d82a[_0xfdc0('0x30')]('Content-Range',_0x51d5f5+'-'+_0x39760a+'/'+_0x410b8a)[_0xfdc0('0x2c')](_0x163c28);}return null;};}function patchUpdates(_0x52dd8b){return function(_0x11eedc){try{jsonpatch[_0xfdc0('0x31')](_0x11eedc,_0x52dd8b,!![]);}catch(_0x4f7fe4){return BPromise['reject'](_0x4f7fe4);}return _0x11eedc[_0xfdc0('0x32')]();};}function saveUpdates(_0x2df55c,_0x5e4614){return function(_0x51d4cf){if(_0x51d4cf){return _0x51d4cf[_0xfdc0('0x33')](_0x2df55c)[_0xfdc0('0x1f')](function(_0x4c72bf){return _0x4c72bf;});}return null;};}function removeEntity(_0x37669c,_0x24ff92){return function(_0x59c133){if(_0x59c133){return _0x59c133[_0xfdc0('0x34')]()[_0xfdc0('0x1f')](function(){_0x37669c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed328,_0x27ab2d){return function(_0x59acf9){if(!_0x59acf9){_0x2ed328['sendStatus'](0x194);}return _0x59acf9;};}function handleError(_0x1a7c57,_0xb5310a){_0xb5310a=_0xb5310a||0x1f4;return function(_0x3190eb){logger['error'](_0x3190eb['stack']);if(_0x3190eb[_0xfdc0('0x35')]){delete _0x3190eb['name'];}_0x1a7c57[_0xfdc0('0x2b')](_0xb5310a)['send'](_0x3190eb);};}exports['index']=function(_0x385fa5,_0x4f39df){var _0x36723b={},_0x1f737d={},_0x52cb07={'count':0x0,'rows':[]};var _0x188518=db[_0xfdc0('0x36')][_0xfdc0('0x37')];_0x1f737d[_0xfdc0('0x38')]=_[_0xfdc0('0x39')](_0x188518);_0x1f737d[_0xfdc0('0x3a')]=_[_0xfdc0('0x39')](_0x385fa5[_0xfdc0('0x3a')]);_0x1f737d[_0xfdc0('0x3b')]=_['intersection'](_0x1f737d[_0xfdc0('0x38')],_0x1f737d[_0xfdc0('0x3a')]);_0x36723b['attributes']=_[_0xfdc0('0x3c')](_0x1f737d[_0xfdc0('0x38')],qs['fields'](_0x385fa5[_0xfdc0('0x3a')][_0xfdc0('0x3d')]));_0x36723b[_0xfdc0('0x3e')]=_0x36723b[_0xfdc0('0x3e')][_0xfdc0('0x3f')]?_0x36723b['attributes']:_0x1f737d[_0xfdc0('0x38')];if(!_0x385fa5[_0xfdc0('0x3a')][_0xfdc0('0x40')](_0xfdc0('0x41'))){_0x36723b['limit']=qs['limit'](_0x385fa5[_0xfdc0('0x3a')][_0xfdc0('0x2f')]);_0x36723b['offset']=qs[_0xfdc0('0x2e')](_0x385fa5[_0xfdc0('0x3a')][_0xfdc0('0x2e')]);}_0x36723b['order']=qs[_0xfdc0('0x42')](_0x385fa5['query']['sort']);_0x36723b[_0xfdc0('0x43')]=qs[_0xfdc0('0x3b')](_[_0xfdc0('0x44')](_0x385fa5[_0xfdc0('0x3a')],_0x1f737d[_0xfdc0('0x3b')]));if(_0x385fa5[_0xfdc0('0x3a')][_0xfdc0('0x45')]){_0x36723b[_0xfdc0('0x43')]=_[_0xfdc0('0x46')](_0x36723b[_0xfdc0('0x43')],{'$or':_['map'](_0x188518,function(_0x3c111d){if(_0x3c111d[_0xfdc0('0x47')][_0xfdc0('0x48')]!=='VIRTUAL'){var _0x38fe7f={};_0x38fe7f[_0x3c111d['field']]={'$like':'%'+_0x385fa5[_0xfdc0('0x3a')][_0xfdc0('0x45')]+'%'};return _0x38fe7f;}})});}_0x36723b=_[_0xfdc0('0x46')]({},_0x36723b,_0x385fa5[_0xfdc0('0x49')]);var _0x524ddd={'where':_0x36723b[_0xfdc0('0x43')]};return db[_0xfdc0('0x36')][_0xfdc0('0x2d')](_0x524ddd)[_0xfdc0('0x1f')](function(_0x95c168){_0x52cb07[_0xfdc0('0x2d')]=_0x95c168;if(_0x385fa5['query'][_0xfdc0('0x4a')]){_0x36723b[_0xfdc0('0x4b')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xfdc0('0x4c')](_0x36723b);})[_0xfdc0('0x1f')](function(_0x213cf0){_0x52cb07[_0xfdc0('0x4d')]=_0x213cf0;return _0x52cb07;})[_0xfdc0('0x1f')](respondWithFilteredResult(_0x4f39df,_0x36723b))[_0xfdc0('0x28')](handleError(_0x4f39df,null));};exports[_0xfdc0('0x4e')]=function(_0x28d622,_0x570797){var _0x3da7d1={'raw':![],'where':{'id':_0x28d622[_0xfdc0('0x4f')]['id']}},_0x2c3431={};_0x2c3431[_0xfdc0('0x38')]=_[_0xfdc0('0x39')](db[_0xfdc0('0x36')]['rawAttributes']);_0x2c3431[_0xfdc0('0x3a')]=_[_0xfdc0('0x39')](_0x28d622[_0xfdc0('0x3a')]);_0x2c3431[_0xfdc0('0x3b')]=_[_0xfdc0('0x3c')](_0x2c3431[_0xfdc0('0x38')],_0x2c3431[_0xfdc0('0x3a')]);_0x3da7d1[_0xfdc0('0x3e')]=_[_0xfdc0('0x3c')](_0x2c3431['model'],qs[_0xfdc0('0x3d')](_0x28d622[_0xfdc0('0x3a')]['fields']));_0x3da7d1[_0xfdc0('0x3e')]=_0x3da7d1[_0xfdc0('0x3e')][_0xfdc0('0x3f')]?_0x3da7d1['attributes']:_0x2c3431[_0xfdc0('0x38')];if(_0x28d622[_0xfdc0('0x3a')][_0xfdc0('0x4a')]){_0x3da7d1[_0xfdc0('0x4b')]=[{'all':!![]}];}_0x3da7d1=_[_0xfdc0('0x46')]({},_0x3da7d1,_0x28d622['options']);return db[_0xfdc0('0x36')][_0xfdc0('0x50')](_0x3da7d1)['then'](handleEntityNotFound(_0x570797,null))['then'](respondWithResult(_0x570797,null))[_0xfdc0('0x28')](handleError(_0x570797,null));};exports[_0xfdc0('0x51')]=function(_0x53aa4f,_0x166577){return db[_0xfdc0('0x36')][_0xfdc0('0x51')](_0x53aa4f[_0xfdc0('0x52')],{})['then'](respondWithResult(_0x166577,0xc9))[_0xfdc0('0x28')](handleError(_0x166577,null));};exports[_0xfdc0('0x33')]=function(_0x1d74f5,_0x1dad56){if(_0x1d74f5[_0xfdc0('0x52')]['id']){delete _0x1d74f5['body']['id'];}return db[_0xfdc0('0x36')][_0xfdc0('0x50')]({'where':{'id':_0x1d74f5[_0xfdc0('0x4f')]['id']}})[_0xfdc0('0x1f')](handleEntityNotFound(_0x1dad56,null))['then'](saveUpdates(_0x1d74f5[_0xfdc0('0x52')],null))[_0xfdc0('0x1f')](respondWithResult(_0x1dad56,null))[_0xfdc0('0x28')](handleError(_0x1dad56,null));};exports[_0xfdc0('0x34')]=function(_0x12c172,_0x20cd3b){return db['ZendeskConfiguration'][_0xfdc0('0x50')]({'where':{'id':_0x12c172[_0xfdc0('0x4f')]['id']}})[_0xfdc0('0x1f')](handleEntityNotFound(_0x20cd3b,null))['then'](removeEntity(_0x20cd3b,null))[_0xfdc0('0x28')](handleError(_0x20cd3b,null));};exports['getFields']=function(_0x62612b,_0xe969b7,_0x1b5138){var _0x1949bd={};var _0x146f04={};var _0x529a7a;var _0x412a58;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x62612b['params']['id']}})['then'](handleEntityNotFound(_0xe969b7,null))[_0xfdc0('0x1f')](function(_0x4a622f){if(_0x4a622f){_0x529a7a=_0x4a622f;_0x146f04[_0xfdc0('0x38')]=_['keys'](db[_0xfdc0('0x53')][_0xfdc0('0x37')]);_0x146f04['query']=_['keys'](_0x62612b[_0xfdc0('0x3a')]);_0x146f04[_0xfdc0('0x3b')]=_['intersection'](_0x146f04['model'],_0x146f04[_0xfdc0('0x3a')]);_0x1949bd[_0xfdc0('0x3e')]=_[_0xfdc0('0x3c')](_0x146f04[_0xfdc0('0x38')],qs[_0xfdc0('0x3d')](_0x62612b['query']['fields']));_0x1949bd['attributes']=_0x1949bd['attributes'][_0xfdc0('0x3f')]?_0x1949bd['attributes']:_0x146f04[_0xfdc0('0x38')];_0x1949bd['order']=qs['sort'](_0x62612b[_0xfdc0('0x3a')][_0xfdc0('0x42')]);_0x1949bd[_0xfdc0('0x43')]=qs[_0xfdc0('0x3b')](_[_0xfdc0('0x44')](_0x62612b['query'],_0x146f04[_0xfdc0('0x3b')]));if(_0x62612b['query'][_0xfdc0('0x45')]){_0x1949bd[_0xfdc0('0x43')]=_[_0xfdc0('0x46')](_0x1949bd[_0xfdc0('0x43')],{'$or':_[_0xfdc0('0x54')](_0x1949bd[_0xfdc0('0x3e')],function(_0x306666){var _0x513817={};_0x513817[_0x306666]={'$like':'%'+_0x62612b['query'][_0xfdc0('0x45')]+'%'};return _0x513817;})});}_0x1949bd=_[_0xfdc0('0x46')]({},_0x1949bd,_0x62612b['options']);return _0x529a7a[_0xfdc0('0x55')](_0x1949bd);}})['then'](function(_0x208934){if(_0x208934){_0x412a58=_0x208934[_0xfdc0('0x3f')];if(!_0x62612b[_0xfdc0('0x3a')][_0xfdc0('0x40')](_0xfdc0('0x41'))){_0x1949bd['limit']=qs[_0xfdc0('0x2f')](_0x62612b['query'][_0xfdc0('0x2f')]);_0x1949bd[_0xfdc0('0x2e')]=qs['offset'](_0x62612b['query'][_0xfdc0('0x2e')]);}return _0x529a7a[_0xfdc0('0x55')](_0x1949bd);}})['then'](function(_0x563473){if(_0x563473){return _0x563473?{'count':_0x412a58,'rows':_0x563473}:null;}})[_0xfdc0('0x1f')](respondWithResult(_0xe969b7,null))[_0xfdc0('0x28')](handleError(_0xe969b7,null));};exports['getSubjects']=function(_0x4f6041,_0x10fcdf,_0xf04225){var _0x50a38f={};var _0x434a5a={};var _0x23ea76;var _0x2a022c;return db['ZendeskConfiguration'][_0xfdc0('0x56')]({'where':{'id':_0x4f6041['params']['id']}})['then'](handleEntityNotFound(_0x10fcdf,null))['then'](function(_0x37607c){if(_0x37607c){_0x23ea76=_0x37607c;_0x434a5a[_0xfdc0('0x38')]=_[_0xfdc0('0x39')](db['ZendeskField'][_0xfdc0('0x37')]);_0x434a5a['query']=_[_0xfdc0('0x39')](_0x4f6041[_0xfdc0('0x3a')]);_0x434a5a['filters']=_[_0xfdc0('0x3c')](_0x434a5a[_0xfdc0('0x38')],_0x434a5a[_0xfdc0('0x3a')]);_0x50a38f[_0xfdc0('0x3e')]=_[_0xfdc0('0x3c')](_0x434a5a['model'],qs[_0xfdc0('0x3d')](_0x4f6041['query'][_0xfdc0('0x3d')]));_0x50a38f[_0xfdc0('0x3e')]=_0x50a38f[_0xfdc0('0x3e')][_0xfdc0('0x3f')]?_0x50a38f['attributes']:_0x434a5a[_0xfdc0('0x38')];_0x50a38f[_0xfdc0('0x57')]=qs[_0xfdc0('0x42')](_0x4f6041[_0xfdc0('0x3a')][_0xfdc0('0x42')]);_0x50a38f[_0xfdc0('0x43')]=qs[_0xfdc0('0x3b')](_[_0xfdc0('0x44')](_0x4f6041['query'],_0x434a5a[_0xfdc0('0x3b')]));if(_0x4f6041[_0xfdc0('0x3a')][_0xfdc0('0x45')]){_0x50a38f[_0xfdc0('0x43')]=_[_0xfdc0('0x46')](_0x50a38f[_0xfdc0('0x43')],{'$or':_[_0xfdc0('0x54')](_0x50a38f['attributes'],function(_0x4562e4){var _0x1267c1={};_0x1267c1[_0x4562e4]={'$like':'%'+_0x4f6041['query'][_0xfdc0('0x45')]+'%'};return _0x1267c1;})});}_0x50a38f=_['merge']({},_0x50a38f,_0x4f6041['options']);return _0x23ea76['getSubjects'](_0x50a38f);}})[_0xfdc0('0x1f')](function(_0x2491ae){if(_0x2491ae){_0x2a022c=_0x2491ae[_0xfdc0('0x3f')];if(!_0x4f6041[_0xfdc0('0x3a')]['hasOwnProperty'](_0xfdc0('0x41'))){_0x50a38f['limit']=qs[_0xfdc0('0x2f')](_0x4f6041[_0xfdc0('0x3a')]['limit']);_0x50a38f[_0xfdc0('0x2e')]=qs[_0xfdc0('0x2e')](_0x4f6041['query'][_0xfdc0('0x2e')]);}return _0x23ea76['getSubjects'](_0x50a38f);}})[_0xfdc0('0x1f')](function(_0x17e724){if(_0x17e724){return _0x17e724?{'count':_0x2a022c,'rows':_0x17e724}:null;}})[_0xfdc0('0x1f')](respondWithResult(_0x10fcdf,null))[_0xfdc0('0x28')](handleError(_0x10fcdf,null));};exports['getDescriptions']=function(_0x27668e,_0x9c0f7e,_0x5d6b97){var _0x5bab1d={};var _0x5543ec={};var _0x23c2e1;var _0x49f7e1;return db[_0xfdc0('0x36')][_0xfdc0('0x56')]({'where':{'id':_0x27668e[_0xfdc0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x9c0f7e,null))[_0xfdc0('0x1f')](function(_0x1ec37){if(_0x1ec37){_0x23c2e1=_0x1ec37;_0x5543ec['model']=_['keys'](db[_0xfdc0('0x53')][_0xfdc0('0x37')]);_0x5543ec[_0xfdc0('0x3a')]=_[_0xfdc0('0x39')](_0x27668e['query']);_0x5543ec[_0xfdc0('0x3b')]=_[_0xfdc0('0x3c')](_0x5543ec[_0xfdc0('0x38')],_0x5543ec['query']);_0x5bab1d[_0xfdc0('0x3e')]=_[_0xfdc0('0x3c')](_0x5543ec[_0xfdc0('0x38')],qs[_0xfdc0('0x3d')](_0x27668e[_0xfdc0('0x3a')][_0xfdc0('0x3d')]));_0x5bab1d[_0xfdc0('0x3e')]=_0x5bab1d[_0xfdc0('0x3e')][_0xfdc0('0x3f')]?_0x5bab1d['attributes']:_0x5543ec[_0xfdc0('0x38')];_0x5bab1d[_0xfdc0('0x57')]=qs[_0xfdc0('0x42')](_0x27668e[_0xfdc0('0x3a')]['sort']);_0x5bab1d[_0xfdc0('0x43')]=qs[_0xfdc0('0x3b')](_[_0xfdc0('0x44')](_0x27668e[_0xfdc0('0x3a')],_0x5543ec[_0xfdc0('0x3b')]));if(_0x27668e[_0xfdc0('0x3a')][_0xfdc0('0x45')]){_0x5bab1d['where']=_[_0xfdc0('0x46')](_0x5bab1d[_0xfdc0('0x43')],{'$or':_[_0xfdc0('0x54')](_0x5bab1d[_0xfdc0('0x3e')],function(_0x55fdf9){var _0x5eb273={};_0x5eb273[_0x55fdf9]={'$like':'%'+_0x27668e['query']['filter']+'%'};return _0x5eb273;})});}_0x5bab1d=_[_0xfdc0('0x46')]({},_0x5bab1d,_0x27668e[_0xfdc0('0x49')]);return _0x23c2e1[_0xfdc0('0x58')](_0x5bab1d);}})[_0xfdc0('0x1f')](function(_0x4ae7a4){if(_0x4ae7a4){_0x49f7e1=_0x4ae7a4[_0xfdc0('0x3f')];if(!_0x27668e[_0xfdc0('0x3a')][_0xfdc0('0x40')](_0xfdc0('0x41'))){_0x5bab1d[_0xfdc0('0x2f')]=qs[_0xfdc0('0x2f')](_0x27668e[_0xfdc0('0x3a')]['limit']);_0x5bab1d[_0xfdc0('0x2e')]=qs[_0xfdc0('0x2e')](_0x27668e['query'][_0xfdc0('0x2e')]);}return _0x23c2e1[_0xfdc0('0x58')](_0x5bab1d);}})[_0xfdc0('0x1f')](function(_0x1bb7b3){if(_0x1bb7b3){return _0x1bb7b3?{'count':_0x49f7e1,'rows':_0x1bb7b3}:null;}})['then'](respondWithResult(_0x9c0f7e,null))[_0xfdc0('0x28')](handleError(_0x9c0f7e,null));};exports['getTags']=function(_0x2191b5,_0x6678d8,_0x492c4d){var _0x51e687={};var _0x4550f9={};var _0x4a1231;var _0x177baa;return db[_0xfdc0('0x36')][_0xfdc0('0x56')]({'where':{'id':_0x2191b5['params']['id']}})[_0xfdc0('0x1f')](handleEntityNotFound(_0x6678d8,null))[_0xfdc0('0x1f')](function(_0xde72eb){if(_0xde72eb){_0x4a1231=_0xde72eb;_0x4550f9[_0xfdc0('0x38')]=_['keys'](db[_0xfdc0('0x59')][_0xfdc0('0x37')]);_0x4550f9['query']=_['keys'](_0x2191b5[_0xfdc0('0x3a')]);_0x4550f9[_0xfdc0('0x3b')]=_[_0xfdc0('0x3c')](_0x4550f9[_0xfdc0('0x38')],_0x4550f9[_0xfdc0('0x3a')]);_0x51e687['attributes']=_['intersection'](_0x4550f9['model'],qs['fields'](_0x2191b5[_0xfdc0('0x3a')]['fields']));_0x51e687[_0xfdc0('0x3e')]=_0x51e687[_0xfdc0('0x3e')][_0xfdc0('0x3f')]?_0x51e687[_0xfdc0('0x3e')]:_0x4550f9[_0xfdc0('0x38')];_0x51e687[_0xfdc0('0x57')]=qs[_0xfdc0('0x42')](_0x2191b5[_0xfdc0('0x3a')]['sort']);_0x51e687[_0xfdc0('0x43')]=qs['filters'](_[_0xfdc0('0x44')](_0x2191b5[_0xfdc0('0x3a')],_0x4550f9[_0xfdc0('0x3b')]));if(_0x2191b5[_0xfdc0('0x3a')][_0xfdc0('0x45')]){_0x51e687[_0xfdc0('0x43')]=_[_0xfdc0('0x46')](_0x51e687['where'],{'$or':_['map'](_0x51e687[_0xfdc0('0x3e')],function(_0x7e4d8c){var _0x6b26a1={};_0x6b26a1[_0x7e4d8c]={'$like':'%'+_0x2191b5[_0xfdc0('0x3a')][_0xfdc0('0x45')]+'%'};return _0x6b26a1;})});}_0x51e687=_[_0xfdc0('0x46')]({},_0x51e687,_0x2191b5[_0xfdc0('0x49')]);return _0x4a1231['getTags'](_0x51e687);}})['then'](function(_0x1516c9){if(_0x1516c9){_0x177baa=_0x1516c9[_0xfdc0('0x3f')];if(!_0x2191b5['query'][_0xfdc0('0x40')](_0xfdc0('0x41'))){_0x51e687[_0xfdc0('0x2f')]=qs[_0xfdc0('0x2f')](_0x2191b5[_0xfdc0('0x3a')]['limit']);_0x51e687[_0xfdc0('0x2e')]=qs[_0xfdc0('0x2e')](_0x2191b5['query'][_0xfdc0('0x2e')]);}return _0x4a1231['getTags'](_0x51e687);}})['then'](function(_0x2eb1d9){if(_0x2eb1d9){return _0x2eb1d9?{'count':_0x177baa,'rows':_0x2eb1d9}:null;}})[_0xfdc0('0x1f')](respondWithResult(_0x6678d8,null))[_0xfdc0('0x28')](handleError(_0x6678d8,null));};exports['setTags']=function(_0x2fcc38,_0x48992c,_0x51d249){if(_0x2fcc38[_0xfdc0('0x52')]['id']){delete _0x2fcc38[_0xfdc0('0x52')]['id'];}return db[_0xfdc0('0x36')][_0xfdc0('0x56')]({'where':{'id':_0x2fcc38[_0xfdc0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x48992c,null))[_0xfdc0('0x1f')](function(_0x148e13){if(_0x148e13){return _0x148e13['setTags'](_0x2fcc38[_0xfdc0('0x52')][_0xfdc0('0x5a')]||[]);}return null;})[_0xfdc0('0x1f')](respondWithResult(_0x48992c,null))[_0xfdc0('0x28')](handleError(_0x48992c,null));}; \ No newline at end of file +var _0xc7e0=['setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','send','ZendeskConfiguration','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','map','type','key','field','includeAll','show','params','keys','length','options','find','body','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','Tag','getTags'];(function(_0x32ee10,_0x29ade5){var _0x39ec1b=function(_0x57fda3){while(--_0x57fda3){_0x32ee10['push'](_0x32ee10['shift']());}};_0x39ec1b(++_0x29ade5);}(_0xc7e0,0x18a));var _0x0c7e=function(_0xcdbead,_0x278a72){_0xcdbead=_0xcdbead-0x0;var _0x2e1cdb=_0xc7e0[_0xcdbead];return _0x2e1cdb;};'use strict';var pdf=require(_0x0c7e('0x0'));var emlformat=require(_0x0c7e('0x1'));var rimraf=require(_0x0c7e('0x2'));var zipdir=require(_0x0c7e('0x3'));var jsonpatch=require(_0x0c7e('0x4'));var rp=require(_0x0c7e('0x5'));var moment=require(_0x0c7e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0c7e('0x7'));var util=require(_0x0c7e('0x8'));var path=require('path');var sox=require(_0x0c7e('0x9'));var csv=require(_0x0c7e('0xa'));var ejs=require(_0x0c7e('0xb'));var fs=require('fs');var _=require(_0x0c7e('0xc'));var squel=require(_0x0c7e('0xd'));var crypto=require(_0x0c7e('0xe'));var jsforce=require(_0x0c7e('0xf'));var deskjs=require(_0x0c7e('0x10'));var toCsv=require(_0x0c7e('0xa'));var querystring=require(_0x0c7e('0x11'));var Papa=require(_0x0c7e('0x12'));var Redis=require(_0x0c7e('0x13'));var authService=require(_0x0c7e('0x14'));var qs=require(_0x0c7e('0x15'));var hardwareService=require(_0x0c7e('0x16'));var logger=require(_0x0c7e('0x17'))(_0x0c7e('0x18'));var utils=require(_0x0c7e('0x19'));var config=require('../../config/environment');var db=require(_0x0c7e('0x1a'))['db'];var jayson=require(_0x0c7e('0x1b'));var client=jayson[_0x0c7e('0x1c')][_0x0c7e('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x321dda,_0x52bad4,_0x21e217){if(_0x21e217){var _0xa79086=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa79086[_0x0c7e('0x1e')](_0x52bad4)){return _0x321dda;}else{throw new db[(_0x0c7e('0x1f'))][(_0x0c7e('0x20'))](_0x0c7e('0x21'));}}else{return _0x321dda;}}function respondWithRpcPromise(_0x328a04,_0x33c068,_0x2ac7fb,_0x1055e9){return new BPromise(function(_0x3e55a4,_0x19c16b){var _0x5eb6ec=_0x1055e9||client;return _0x5eb6ec[_0x0c7e('0x22')](_0x328a04,_0x2ac7fb)['then'](function(_0x148b6e){logger[_0x0c7e('0x23')](_0x0c7e('0x24'),_0x33c068,_0x0c7e('0x25'));logger[_0x0c7e('0x26')](_0x0c7e('0x27'),_0x33c068,'request\x20sent',JSON[_0x0c7e('0x28')](_0x148b6e));if(_0x148b6e[_0x0c7e('0x29')]){if(_0x148b6e['error'][_0x0c7e('0x2a')]===0x1f4){logger[_0x0c7e('0x29')](_0x0c7e('0x24'),_0x33c068,_0x148b6e[_0x0c7e('0x29')][_0x0c7e('0x2b')]);return _0x19c16b(_0x148b6e[_0x0c7e('0x29')]['message']);}logger[_0x0c7e('0x29')]('ZendeskConfiguration,\x20%s,\x20%s',_0x33c068,_0x148b6e[_0x0c7e('0x29')]['message']);return _0x3e55a4(_0x148b6e['error']['message']);}else{logger[_0x0c7e('0x23')](_0x0c7e('0x24'),_0x33c068,'request\x20sent');_0x3e55a4(_0x148b6e['result'][_0x0c7e('0x2b')]);}})[_0x0c7e('0x2c')](function(_0x5154ab){logger[_0x0c7e('0x29')](_0x0c7e('0x24'),_0x33c068,_0x5154ab);_0x19c16b(_0x5154ab);});});}function respondWithStatusCode(_0x12c236,_0x552bde){_0x552bde=_0x552bde||0xcc;return function(_0x47bff0){if(_0x47bff0){return _0x12c236[_0x0c7e('0x2d')](_0x552bde);}return _0x12c236['status'](_0x552bde)[_0x0c7e('0x2e')]();};}function respondWithResult(_0x1b8970,_0x5d9d9c){_0x5d9d9c=_0x5d9d9c||0xc8;return function(_0x4de6f2){if(_0x4de6f2){return _0x1b8970[_0x0c7e('0x2f')](_0x5d9d9c)[_0x0c7e('0x30')](_0x4de6f2);}};}function respondWithFilteredResult(_0x402da5,_0x15cd26){return function(_0x524751){if(_0x524751){var _0x5d15a7=_0x524751[_0x0c7e('0x31')],_0x5c56c3=_0x15cd26[_0x0c7e('0x32')],_0x45f40f=_0x15cd26[_0x0c7e('0x32')]+_0x15cd26['limit'],_0x3d0377;if(_0x45f40f>=_0x5d15a7){_0x45f40f=_0x5d15a7;_0x3d0377=0xc8;}else{_0x3d0377=0xce;}_0x402da5[_0x0c7e('0x2f')](_0x3d0377);return _0x402da5['set'](_0x0c7e('0x33'),_0x5c56c3+'-'+_0x45f40f+'/'+_0x5d15a7)[_0x0c7e('0x30')](_0x524751);}return null;};}function patchUpdates(_0x562919){return function(_0xeef593){try{jsonpatch[_0x0c7e('0x34')](_0xeef593,_0x562919,!![]);}catch(_0x1cf2dc){return BPromise[_0x0c7e('0x35')](_0x1cf2dc);}return _0xeef593['save']();};}function saveUpdates(_0x38da35,_0x42b438){return function(_0x14a6c6){if(_0x14a6c6){return _0x14a6c6[_0x0c7e('0x36')](_0x38da35)[_0x0c7e('0x37')](function(_0x570918){return _0x570918;});}return null;};}function removeEntity(_0x4a714e,_0x3b4596){return function(_0x4437af){if(_0x4437af){return _0x4437af[_0x0c7e('0x38')]()[_0x0c7e('0x37')](function(){_0x4a714e[_0x0c7e('0x2f')](0xcc)[_0x0c7e('0x2e')]();});}};}function handleEntityNotFound(_0x5772cc,_0xfc0a9d){return function(_0x42a9e4){if(!_0x42a9e4){_0x5772cc[_0x0c7e('0x2d')](0x194);}return _0x42a9e4;};}function handleError(_0x316eee,_0x4e6b7e){_0x4e6b7e=_0x4e6b7e||0x1f4;return function(_0x5e02fe){logger['error'](_0x5e02fe[_0x0c7e('0x39')]);if(_0x5e02fe['name']){delete _0x5e02fe[_0x0c7e('0x3a')];}_0x316eee['status'](_0x4e6b7e)[_0x0c7e('0x3b')](_0x5e02fe);};}exports['index']=function(_0x42f95e,_0x3d20eb){var _0x1abc5c={},_0x505b73={},_0x5aa14c={'count':0x0,'rows':[]};var _0x238c83=db[_0x0c7e('0x3c')][_0x0c7e('0x3d')];_0x505b73[_0x0c7e('0x3e')]=_['keys'](_0x238c83);_0x505b73[_0x0c7e('0x3f')]=_['keys'](_0x42f95e['query']);_0x505b73[_0x0c7e('0x40')]=_[_0x0c7e('0x41')](_0x505b73['model'],_0x505b73['query']);_0x1abc5c[_0x0c7e('0x42')]=_[_0x0c7e('0x41')](_0x505b73['model'],qs[_0x0c7e('0x43')](_0x42f95e[_0x0c7e('0x3f')][_0x0c7e('0x43')]));_0x1abc5c[_0x0c7e('0x42')]=_0x1abc5c[_0x0c7e('0x42')]['length']?_0x1abc5c['attributes']:_0x505b73[_0x0c7e('0x3e')];if(!_0x42f95e[_0x0c7e('0x3f')][_0x0c7e('0x44')](_0x0c7e('0x45'))){_0x1abc5c[_0x0c7e('0x46')]=qs['limit'](_0x42f95e[_0x0c7e('0x3f')][_0x0c7e('0x46')]);_0x1abc5c[_0x0c7e('0x32')]=qs[_0x0c7e('0x32')](_0x42f95e[_0x0c7e('0x3f')][_0x0c7e('0x32')]);}_0x1abc5c['order']=qs['sort'](_0x42f95e[_0x0c7e('0x3f')][_0x0c7e('0x47')]);_0x1abc5c['where']=qs[_0x0c7e('0x40')](_[_0x0c7e('0x48')](_0x42f95e[_0x0c7e('0x3f')],_0x505b73[_0x0c7e('0x40')]));if(_0x42f95e['query'][_0x0c7e('0x49')]){_0x1abc5c[_0x0c7e('0x4a')]=_[_0x0c7e('0x4b')](_0x1abc5c[_0x0c7e('0x4a')],{'$or':_[_0x0c7e('0x4c')](_0x238c83,function(_0x3ba497){if(_0x3ba497[_0x0c7e('0x4d')][_0x0c7e('0x4e')]!=='VIRTUAL'){var _0x1099c8={};_0x1099c8[_0x3ba497[_0x0c7e('0x4f')]]={'$like':'%'+_0x42f95e[_0x0c7e('0x3f')][_0x0c7e('0x49')]+'%'};return _0x1099c8;}})});}_0x1abc5c=_[_0x0c7e('0x4b')]({},_0x1abc5c,_0x42f95e['options']);var _0x171c15={'where':_0x1abc5c[_0x0c7e('0x4a')]};return db[_0x0c7e('0x3c')][_0x0c7e('0x31')](_0x171c15)['then'](function(_0x2603b6){_0x5aa14c[_0x0c7e('0x31')]=_0x2603b6;if(_0x42f95e[_0x0c7e('0x3f')][_0x0c7e('0x50')]){_0x1abc5c['include']=[{'all':!![]}];}return db[_0x0c7e('0x3c')]['findAll'](_0x1abc5c);})[_0x0c7e('0x37')](function(_0x417292){_0x5aa14c['rows']=_0x417292;return _0x5aa14c;})[_0x0c7e('0x37')](respondWithFilteredResult(_0x3d20eb,_0x1abc5c))['catch'](handleError(_0x3d20eb,null));};exports[_0x0c7e('0x51')]=function(_0x598c1d,_0x33a31e){var _0x417fdf={'raw':![],'where':{'id':_0x598c1d[_0x0c7e('0x52')]['id']}},_0x1ff7aa={};_0x1ff7aa['model']=_[_0x0c7e('0x53')](db[_0x0c7e('0x3c')][_0x0c7e('0x3d')]);_0x1ff7aa[_0x0c7e('0x3f')]=_['keys'](_0x598c1d[_0x0c7e('0x3f')]);_0x1ff7aa[_0x0c7e('0x40')]=_[_0x0c7e('0x41')](_0x1ff7aa[_0x0c7e('0x3e')],_0x1ff7aa[_0x0c7e('0x3f')]);_0x417fdf['attributes']=_[_0x0c7e('0x41')](_0x1ff7aa[_0x0c7e('0x3e')],qs[_0x0c7e('0x43')](_0x598c1d['query']['fields']));_0x417fdf[_0x0c7e('0x42')]=_0x417fdf[_0x0c7e('0x42')][_0x0c7e('0x54')]?_0x417fdf[_0x0c7e('0x42')]:_0x1ff7aa[_0x0c7e('0x3e')];if(_0x598c1d['query']['includeAll']){_0x417fdf['include']=[{'all':!![]}];}_0x417fdf=_[_0x0c7e('0x4b')]({},_0x417fdf,_0x598c1d[_0x0c7e('0x55')]);return db[_0x0c7e('0x3c')][_0x0c7e('0x56')](_0x417fdf)[_0x0c7e('0x37')](handleEntityNotFound(_0x33a31e,null))[_0x0c7e('0x37')](respondWithResult(_0x33a31e,null))[_0x0c7e('0x2c')](handleError(_0x33a31e,null));};exports['create']=function(_0x540b7b,_0x5979fc){return db[_0x0c7e('0x3c')]['create'](_0x540b7b['body'],{})['then'](respondWithResult(_0x5979fc,0xc9))[_0x0c7e('0x2c')](handleError(_0x5979fc,null));};exports[_0x0c7e('0x36')]=function(_0x3f5e93,_0x313d3e){if(_0x3f5e93[_0x0c7e('0x57')]['id']){delete _0x3f5e93[_0x0c7e('0x57')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x3f5e93[_0x0c7e('0x52')]['id']}})[_0x0c7e('0x37')](handleEntityNotFound(_0x313d3e,null))[_0x0c7e('0x37')](saveUpdates(_0x3f5e93[_0x0c7e('0x57')],null))[_0x0c7e('0x37')](respondWithResult(_0x313d3e,null))[_0x0c7e('0x2c')](handleError(_0x313d3e,null));};exports[_0x0c7e('0x38')]=function(_0x2a83ba,_0x50785b){return db[_0x0c7e('0x3c')][_0x0c7e('0x56')]({'where':{'id':_0x2a83ba[_0x0c7e('0x52')]['id']}})[_0x0c7e('0x37')](handleEntityNotFound(_0x50785b,null))[_0x0c7e('0x37')](removeEntity(_0x50785b,null))[_0x0c7e('0x2c')](handleError(_0x50785b,null));};exports[_0x0c7e('0x58')]=function(_0x4f5428,_0x3d4cfb,_0x12f79d){var _0x533a3c={};var _0x24c11e={};var _0x5e9993;var _0x1321cf;return db[_0x0c7e('0x3c')][_0x0c7e('0x59')]({'where':{'id':_0x4f5428['params']['id']}})['then'](handleEntityNotFound(_0x3d4cfb,null))['then'](function(_0x5b00ef){if(_0x5b00ef){_0x5e9993=_0x5b00ef;_0x24c11e[_0x0c7e('0x3e')]=_[_0x0c7e('0x53')](db[_0x0c7e('0x5a')][_0x0c7e('0x3d')]);_0x24c11e['query']=_['keys'](_0x4f5428[_0x0c7e('0x3f')]);_0x24c11e[_0x0c7e('0x40')]=_['intersection'](_0x24c11e[_0x0c7e('0x3e')],_0x24c11e[_0x0c7e('0x3f')]);_0x533a3c[_0x0c7e('0x42')]=_[_0x0c7e('0x41')](_0x24c11e[_0x0c7e('0x3e')],qs[_0x0c7e('0x43')](_0x4f5428[_0x0c7e('0x3f')]['fields']));_0x533a3c[_0x0c7e('0x42')]=_0x533a3c[_0x0c7e('0x42')][_0x0c7e('0x54')]?_0x533a3c['attributes']:_0x24c11e[_0x0c7e('0x3e')];_0x533a3c[_0x0c7e('0x5b')]=qs[_0x0c7e('0x47')](_0x4f5428[_0x0c7e('0x3f')]['sort']);_0x533a3c[_0x0c7e('0x4a')]=qs[_0x0c7e('0x40')](_['pick'](_0x4f5428[_0x0c7e('0x3f')],_0x24c11e[_0x0c7e('0x40')]));if(_0x4f5428[_0x0c7e('0x3f')][_0x0c7e('0x49')]){_0x533a3c[_0x0c7e('0x4a')]=_['merge'](_0x533a3c[_0x0c7e('0x4a')],{'$or':_[_0x0c7e('0x4c')](_0x533a3c[_0x0c7e('0x42')],function(_0x50a3e0){var _0x102b5d={};_0x102b5d[_0x50a3e0]={'$like':'%'+_0x4f5428['query'][_0x0c7e('0x49')]+'%'};return _0x102b5d;})});}_0x533a3c=_[_0x0c7e('0x4b')]({},_0x533a3c,_0x4f5428[_0x0c7e('0x55')]);return _0x5e9993['getFields'](_0x533a3c);}})[_0x0c7e('0x37')](function(_0x47d7df){if(_0x47d7df){_0x1321cf=_0x47d7df[_0x0c7e('0x54')];if(!_0x4f5428[_0x0c7e('0x3f')][_0x0c7e('0x44')](_0x0c7e('0x45'))){_0x533a3c['limit']=qs['limit'](_0x4f5428[_0x0c7e('0x3f')]['limit']);_0x533a3c[_0x0c7e('0x32')]=qs[_0x0c7e('0x32')](_0x4f5428[_0x0c7e('0x3f')][_0x0c7e('0x32')]);}return _0x5e9993[_0x0c7e('0x58')](_0x533a3c);}})[_0x0c7e('0x37')](function(_0x3ef60f){if(_0x3ef60f){return _0x3ef60f?{'count':_0x1321cf,'rows':_0x3ef60f}:null;}})[_0x0c7e('0x37')](respondWithResult(_0x3d4cfb,null))['catch'](handleError(_0x3d4cfb,null));};exports[_0x0c7e('0x5c')]=function(_0x92730b,_0x4cc068,_0x4643ca){var _0x56462d={};var _0x574d15={};var _0x604aaa;var _0x2dd941;return db['ZendeskConfiguration'][_0x0c7e('0x59')]({'where':{'id':_0x92730b[_0x0c7e('0x52')]['id']}})[_0x0c7e('0x37')](handleEntityNotFound(_0x4cc068,null))[_0x0c7e('0x37')](function(_0x4e1ece){if(_0x4e1ece){_0x604aaa=_0x4e1ece;_0x574d15[_0x0c7e('0x3e')]=_[_0x0c7e('0x53')](db['ZendeskField'][_0x0c7e('0x3d')]);_0x574d15['query']=_[_0x0c7e('0x53')](_0x92730b[_0x0c7e('0x3f')]);_0x574d15['filters']=_['intersection'](_0x574d15[_0x0c7e('0x3e')],_0x574d15[_0x0c7e('0x3f')]);_0x56462d[_0x0c7e('0x42')]=_['intersection'](_0x574d15[_0x0c7e('0x3e')],qs['fields'](_0x92730b[_0x0c7e('0x3f')]['fields']));_0x56462d['attributes']=_0x56462d['attributes'][_0x0c7e('0x54')]?_0x56462d[_0x0c7e('0x42')]:_0x574d15['model'];_0x56462d[_0x0c7e('0x5b')]=qs[_0x0c7e('0x47')](_0x92730b[_0x0c7e('0x3f')]['sort']);_0x56462d['where']=qs[_0x0c7e('0x40')](_[_0x0c7e('0x48')](_0x92730b[_0x0c7e('0x3f')],_0x574d15[_0x0c7e('0x40')]));if(_0x92730b['query'][_0x0c7e('0x49')]){_0x56462d[_0x0c7e('0x4a')]=_[_0x0c7e('0x4b')](_0x56462d[_0x0c7e('0x4a')],{'$or':_[_0x0c7e('0x4c')](_0x56462d['attributes'],function(_0x514218){var _0x38ee44={};_0x38ee44[_0x514218]={'$like':'%'+_0x92730b['query'][_0x0c7e('0x49')]+'%'};return _0x38ee44;})});}_0x56462d=_[_0x0c7e('0x4b')]({},_0x56462d,_0x92730b['options']);return _0x604aaa[_0x0c7e('0x5c')](_0x56462d);}})[_0x0c7e('0x37')](function(_0x4808b9){if(_0x4808b9){_0x2dd941=_0x4808b9[_0x0c7e('0x54')];if(!_0x92730b['query'][_0x0c7e('0x44')](_0x0c7e('0x45'))){_0x56462d[_0x0c7e('0x46')]=qs[_0x0c7e('0x46')](_0x92730b[_0x0c7e('0x3f')][_0x0c7e('0x46')]);_0x56462d[_0x0c7e('0x32')]=qs[_0x0c7e('0x32')](_0x92730b['query'][_0x0c7e('0x32')]);}return _0x604aaa[_0x0c7e('0x5c')](_0x56462d);}})['then'](function(_0x42dff6){if(_0x42dff6){return _0x42dff6?{'count':_0x2dd941,'rows':_0x42dff6}:null;}})[_0x0c7e('0x37')](respondWithResult(_0x4cc068,null))['catch'](handleError(_0x4cc068,null));};exports['getDescriptions']=function(_0x3703b6,_0x3b1355,_0x1c915c){var _0x36e5f2={};var _0x29e0f7={};var _0x22e968;var _0x1b5725;return db[_0x0c7e('0x3c')]['findOne']({'where':{'id':_0x3703b6[_0x0c7e('0x52')]['id']}})['then'](handleEntityNotFound(_0x3b1355,null))['then'](function(_0x262fe3){if(_0x262fe3){_0x22e968=_0x262fe3;_0x29e0f7[_0x0c7e('0x3e')]=_['keys'](db[_0x0c7e('0x5a')][_0x0c7e('0x3d')]);_0x29e0f7[_0x0c7e('0x3f')]=_[_0x0c7e('0x53')](_0x3703b6[_0x0c7e('0x3f')]);_0x29e0f7[_0x0c7e('0x40')]=_[_0x0c7e('0x41')](_0x29e0f7[_0x0c7e('0x3e')],_0x29e0f7[_0x0c7e('0x3f')]);_0x36e5f2[_0x0c7e('0x42')]=_[_0x0c7e('0x41')](_0x29e0f7[_0x0c7e('0x3e')],qs[_0x0c7e('0x43')](_0x3703b6['query'][_0x0c7e('0x43')]));_0x36e5f2['attributes']=_0x36e5f2[_0x0c7e('0x42')][_0x0c7e('0x54')]?_0x36e5f2[_0x0c7e('0x42')]:_0x29e0f7[_0x0c7e('0x3e')];_0x36e5f2['order']=qs['sort'](_0x3703b6[_0x0c7e('0x3f')][_0x0c7e('0x47')]);_0x36e5f2[_0x0c7e('0x4a')]=qs[_0x0c7e('0x40')](_[_0x0c7e('0x48')](_0x3703b6[_0x0c7e('0x3f')],_0x29e0f7[_0x0c7e('0x40')]));if(_0x3703b6[_0x0c7e('0x3f')][_0x0c7e('0x49')]){_0x36e5f2[_0x0c7e('0x4a')]=_[_0x0c7e('0x4b')](_0x36e5f2['where'],{'$or':_['map'](_0x36e5f2[_0x0c7e('0x42')],function(_0x1cdff6){var _0x83eea0={};_0x83eea0[_0x1cdff6]={'$like':'%'+_0x3703b6['query'][_0x0c7e('0x49')]+'%'};return _0x83eea0;})});}_0x36e5f2=_['merge']({},_0x36e5f2,_0x3703b6[_0x0c7e('0x55')]);return _0x22e968[_0x0c7e('0x5d')](_0x36e5f2);}})['then'](function(_0x58073c){if(_0x58073c){_0x1b5725=_0x58073c[_0x0c7e('0x54')];if(!_0x3703b6[_0x0c7e('0x3f')][_0x0c7e('0x44')]('nolimit')){_0x36e5f2[_0x0c7e('0x46')]=qs[_0x0c7e('0x46')](_0x3703b6[_0x0c7e('0x3f')][_0x0c7e('0x46')]);_0x36e5f2[_0x0c7e('0x32')]=qs['offset'](_0x3703b6[_0x0c7e('0x3f')][_0x0c7e('0x32')]);}return _0x22e968['getDescriptions'](_0x36e5f2);}})[_0x0c7e('0x37')](function(_0x33b0d2){if(_0x33b0d2){return _0x33b0d2?{'count':_0x1b5725,'rows':_0x33b0d2}:null;}})[_0x0c7e('0x37')](respondWithResult(_0x3b1355,null))[_0x0c7e('0x2c')](handleError(_0x3b1355,null));};exports['getTags']=function(_0x57b41b,_0x1380b4,_0x3d46a2){var _0x522881={};var _0x2e42d2={};var _0x3be7ec;var _0x2336a5;return db[_0x0c7e('0x3c')][_0x0c7e('0x59')]({'where':{'id':_0x57b41b[_0x0c7e('0x52')]['id']}})[_0x0c7e('0x37')](handleEntityNotFound(_0x1380b4,null))[_0x0c7e('0x37')](function(_0x32df64){if(_0x32df64){_0x3be7ec=_0x32df64;_0x2e42d2[_0x0c7e('0x3e')]=_['keys'](db[_0x0c7e('0x5e')][_0x0c7e('0x3d')]);_0x2e42d2['query']=_[_0x0c7e('0x53')](_0x57b41b['query']);_0x2e42d2[_0x0c7e('0x40')]=_[_0x0c7e('0x41')](_0x2e42d2[_0x0c7e('0x3e')],_0x2e42d2[_0x0c7e('0x3f')]);_0x522881[_0x0c7e('0x42')]=_['intersection'](_0x2e42d2[_0x0c7e('0x3e')],qs[_0x0c7e('0x43')](_0x57b41b[_0x0c7e('0x3f')]['fields']));_0x522881[_0x0c7e('0x42')]=_0x522881[_0x0c7e('0x42')]['length']?_0x522881[_0x0c7e('0x42')]:_0x2e42d2[_0x0c7e('0x3e')];_0x522881['order']=qs[_0x0c7e('0x47')](_0x57b41b[_0x0c7e('0x3f')]['sort']);_0x522881['where']=qs[_0x0c7e('0x40')](_[_0x0c7e('0x48')](_0x57b41b['query'],_0x2e42d2[_0x0c7e('0x40')]));if(_0x57b41b['query'][_0x0c7e('0x49')]){_0x522881[_0x0c7e('0x4a')]=_[_0x0c7e('0x4b')](_0x522881[_0x0c7e('0x4a')],{'$or':_['map'](_0x522881['attributes'],function(_0x397bb6){var _0x41c4a8={};_0x41c4a8[_0x397bb6]={'$like':'%'+_0x57b41b[_0x0c7e('0x3f')]['filter']+'%'};return _0x41c4a8;})});}_0x522881=_[_0x0c7e('0x4b')]({},_0x522881,_0x57b41b[_0x0c7e('0x55')]);return _0x3be7ec[_0x0c7e('0x5f')](_0x522881);}})[_0x0c7e('0x37')](function(_0x4dcdd4){if(_0x4dcdd4){_0x2336a5=_0x4dcdd4[_0x0c7e('0x54')];if(!_0x57b41b['query'][_0x0c7e('0x44')](_0x0c7e('0x45'))){_0x522881[_0x0c7e('0x46')]=qs[_0x0c7e('0x46')](_0x57b41b['query']['limit']);_0x522881[_0x0c7e('0x32')]=qs[_0x0c7e('0x32')](_0x57b41b[_0x0c7e('0x3f')][_0x0c7e('0x32')]);}return _0x3be7ec['getTags'](_0x522881);}})[_0x0c7e('0x37')](function(_0x1aeeca){if(_0x1aeeca){return _0x1aeeca?{'count':_0x2336a5,'rows':_0x1aeeca}:null;}})[_0x0c7e('0x37')](respondWithResult(_0x1380b4,null))['catch'](handleError(_0x1380b4,null));};exports['setTags']=function(_0x182eda,_0x1ac35a,_0x5d0e24){if(_0x182eda[_0x0c7e('0x57')]['id']){delete _0x182eda[_0x0c7e('0x57')]['id'];}return db[_0x0c7e('0x3c')][_0x0c7e('0x59')]({'where':{'id':_0x182eda[_0x0c7e('0x52')]['id']}})[_0x0c7e('0x37')](handleEntityNotFound(_0x1ac35a,null))['then'](function(_0xc6d963){if(_0xc6d963){return _0xc6d963[_0x0c7e('0x60')](_0x182eda[_0x0c7e('0x57')][_0x0c7e('0x61')]||[]);}return null;})[_0x0c7e('0x37')](respondWithResult(_0x1ac35a,null))['catch'](handleError(_0x1ac35a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2cfa784..075a4f4 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 _0x2e16=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0x2e16,0xc6));var _0x62e1=function(_0x3162de,_0x7fbdbc){_0x3162de=_0x3162de-0x0;var _0x1c6e65=_0x2e16[_0x3162de];return _0x1c6e65;};'use strict';var _=require('lodash');var util=require(_0x62e1('0x0'));var logger=require(_0x62e1('0x1'))(_0x62e1('0x2'));var moment=require('moment');var BPromise=require(_0x62e1('0x3'));var rp=require(_0x62e1('0x4'));var fs=require('fs');var path=require(_0x62e1('0x5'));var rimraf=require(_0x62e1('0x6'));var config=require('../../config/environment');var attributes=require(_0x62e1('0x7'));module[_0x62e1('0x8')]=function(_0xd4703,_0x345efc){return _0xd4703[_0x62e1('0x9')](_0x62e1('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd96f=['int_zendesk_configurations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xd96f,0xe5));var _0xfd96=function(_0x3f69ca,_0x296bd2){_0x3f69ca=_0x3f69ca-0x0;var _0x30b60c=_0xd96f[_0x3f69ca];return _0x30b60c;};'use strict';var _=require(_0xfd96('0x0'));var util=require('util');var logger=require(_0xfd96('0x1'))(_0xfd96('0x2'));var moment=require(_0xfd96('0x3'));var BPromise=require(_0xfd96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd96('0x5'));var rimraf=require(_0xfd96('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd96('0x7'));module[_0xfd96('0x8')]=function(_0x4ce6f4,_0x276bbf){return _0x4ce6f4[_0xfd96('0x9')](_0xfd96('0xa'),attributes,{'tableName':_0xfd96('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 0bb8173..5b487e1 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 _0xf305=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent'];(function(_0x5d7212,_0x1732eb){var _0xa3ca4b=function(_0x49fbee){while(--_0x49fbee){_0x5d7212['push'](_0x5d7212['shift']());}};_0xa3ca4b(++_0x1732eb);}(_0xf305,0x1ce));var _0x5f30=function(_0x2cbb74,_0x241c10){_0x2cbb74=_0x2cbb74-0x0;var _0xa6d18=_0xf305[_0x2cbb74];return _0xa6d18;};'use strict';var _=require(_0x5f30('0x0'));var util=require('util');var moment=require(_0x5f30('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f30('0x2'));var fs=require('fs');var Redis=require(_0x5f30('0x3'));var db=require(_0x5f30('0x4'))['db'];var utils=require(_0x5f30('0x5'));var logger=require(_0x5f30('0x6'))(_0x5f30('0x7'));var config=require(_0x5f30('0x8'));var jayson=require(_0x5f30('0x9'));var client=jayson[_0x5f30('0xa')][_0x5f30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0f8d,_0x516c69,_0x236f20){return new BPromise(function(_0x58d7bd,_0x4d0e2e){return client[_0x5f30('0xc')](_0x3c0f8d,_0x236f20)[_0x5f30('0xd')](function(_0x3e5321){logger[_0x5f30('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x516c69,'request\x20sent');logger['debug'](_0x5f30('0xf'),_0x516c69,'request\x20sent',JSON['stringify'](_0x3e5321));if(_0x3e5321['error']){if(_0x3e5321[_0x5f30('0x10')][_0x5f30('0x11')]===0x1f4){logger[_0x5f30('0x10')](_0x5f30('0x12'),_0x516c69,_0x3e5321[_0x5f30('0x10')][_0x5f30('0x13')]);return _0x4d0e2e(_0x3e5321['error']['message']);}logger[_0x5f30('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x516c69,_0x3e5321[_0x5f30('0x10')][_0x5f30('0x13')]);return _0x58d7bd(_0x3e5321[_0x5f30('0x10')][_0x5f30('0x13')]);}else{logger[_0x5f30('0xe')](_0x5f30('0x12'),_0x516c69,_0x5f30('0x14'));_0x58d7bd(_0x3e5321[_0x5f30('0x15')][_0x5f30('0x13')]);}})[_0x5f30('0x16')](function(_0x39d153){logger[_0x5f30('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x516c69,_0x39d153);_0x4d0e2e(_0x39d153);});});} \ No newline at end of file +var _0x545f=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x545f,0x8a));var _0xf545=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x545f[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0xf545('0x0'));var util=require(_0xf545('0x1'));var moment=require('moment');var BPromise=require(_0xf545('0x2'));var rs=require(_0xf545('0x3'));var fs=require('fs');var Redis=require(_0xf545('0x4'));var db=require(_0xf545('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf545('0x6'))(_0xf545('0x7'));var config=require(_0xf545('0x8'));var jayson=require(_0xf545('0x9'));var client=jayson[_0xf545('0xa')][_0xf545('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5570cc,_0x510a9a,_0x180a0e){return new BPromise(function(_0xbd3f74,_0x1d130b){return client['request'](_0x5570cc,_0x180a0e)['then'](function(_0x36e693){logger[_0xf545('0xc')](_0xf545('0xd'),_0x510a9a,_0xf545('0xe'));logger[_0xf545('0xf')](_0xf545('0x10'),_0x510a9a,_0xf545('0xe'),JSON[_0xf545('0x11')](_0x36e693));if(_0x36e693[_0xf545('0x12')]){if(_0x36e693[_0xf545('0x12')][_0xf545('0x13')]===0x1f4){logger[_0xf545('0x12')](_0xf545('0xd'),_0x510a9a,_0x36e693[_0xf545('0x12')]['message']);return _0x1d130b(_0x36e693[_0xf545('0x12')][_0xf545('0x14')]);}logger['error'](_0xf545('0xd'),_0x510a9a,_0x36e693[_0xf545('0x12')]['message']);return _0xbd3f74(_0x36e693['error'][_0xf545('0x14')]);}else{logger[_0xf545('0xc')](_0xf545('0xd'),_0x510a9a,_0xf545('0xe'));_0xbd3f74(_0x36e693[_0xf545('0x15')][_0xf545('0x14')]);}})[_0xf545('0x16')](function(_0x5cac9d){logger[_0xf545('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x510a9a,_0x5cac9d);_0x1d130b(_0x5cac9d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 28ff852..158c48b 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 _0xf0db=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x46ebfd,_0x4a1b14){var _0x21ee2e=function(_0x1130a3){while(--_0x1130a3){_0x46ebfd['push'](_0x46ebfd['shift']());}};_0x21ee2e(++_0x4a1b14);}(_0xf0db,0x12b));var _0xbf0d=function(_0x4d16c8,_0x17a386){_0x4d16c8=_0x4d16c8-0x0;var _0x22c359=_0xf0db[_0x4d16c8];return _0x22c359;};'use strict';var multer=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var path=require('path');var timeout=require(_0xbf0d('0x2'));var express=require(_0xbf0d('0x3'));var router=express[_0xbf0d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf0d('0x5'));var config=require(_0xbf0d('0x6'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xbf0d('0x7')](),controller[_0xbf0d('0x8')]);router[_0xbf0d('0x9')](_0xbf0d('0xa'),auth['isAuthenticated'](),controller[_0xbf0d('0xb')]);router[_0xbf0d('0xc')]('/',auth[_0xbf0d('0x7')](),controller[_0xbf0d('0xd')]);router[_0xbf0d('0xe')](_0xbf0d('0xa'),auth[_0xbf0d('0x7')](),controller[_0xbf0d('0xf')]);router['delete']('/:id',auth[_0xbf0d('0x7')](),controller[_0xbf0d('0x10')]);module[_0xbf0d('0x11')]=router; \ No newline at end of file +var _0x350a=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get'];(function(_0x3452eb,_0x44035e){var _0x4244fd=function(_0x48564b){while(--_0x48564b){_0x3452eb['push'](_0x3452eb['shift']());}};_0x4244fd(++_0x44035e);}(_0x350a,0xb1));var _0xa350=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x350a[_0x4c98b9];return _0x3a257a;};'use strict';var multer=require(_0xa350('0x0'));var util=require(_0xa350('0x1'));var path=require(_0xa350('0x2'));var timeout=require('connect-timeout');var express=require(_0xa350('0x3'));var router=express[_0xa350('0x4')]();var auth=require(_0xa350('0x5'));var interaction=require(_0xa350('0x6'));var config=require(_0xa350('0x7'));var controller=require(_0xa350('0x8'));router['get']('/',auth[_0xa350('0x9')](),controller[_0xa350('0xa')]);router[_0xa350('0xb')](_0xa350('0xc'),auth['isAuthenticated'](),controller[_0xa350('0xd')]);router[_0xa350('0xe')]('/',auth['isAuthenticated'](),controller[_0xa350('0xf')]);router[_0xa350('0x10')](_0xa350('0xc'),auth['isAuthenticated'](),controller[_0xa350('0x11')]);router[_0xa350('0x12')](_0xa350('0xc'),auth[_0xa350('0x9')](),controller[_0xa350('0x13')]);module[_0xa350('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 025a7b1..97872e5 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 _0x2308=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2308,0x108));var _0x8230=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x2308[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0x8230('0x0'));module['exports']={'type':{'type':Sequelize[_0x8230('0x1')](_0x8230('0x2'),_0x8230('0x3'),_0x8230('0x4'),_0x8230('0x5')),'defaultValue':_0x8230('0x2')},'content':{'type':Sequelize[_0x8230('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8230('0x1')]('string',_0x8230('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x8230('0x6')]},'idField':{'type':Sequelize[_0x8230('0x6')]},'nameField':{'type':Sequelize[_0x8230('0x6')]},'customField':{'type':Sequelize[_0x8230('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8230('0x6')]}}; \ No newline at end of file +var _0x7e63=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0xf1a10a,_0x52f183){var _0x4e3fbb=function(_0x166de){while(--_0x166de){_0xf1a10a['push'](_0xf1a10a['shift']());}};_0x4e3fbb(++_0x52f183);}(_0x7e63,0x74));var _0x37e6=function(_0x14b003,_0x20b0c9){_0x14b003=_0x14b003-0x0;var _0x1b4d48=_0x7e63[_0x14b003];return _0x1b4d48;};'use strict';var Sequelize=require(_0x37e6('0x0'));module[_0x37e6('0x1')]={'type':{'type':Sequelize[_0x37e6('0x2')]('string',_0x37e6('0x3'),_0x37e6('0x4'),_0x37e6('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x37e6('0x6')]},'key':{'type':Sequelize[_0x37e6('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x37e6('0x3'),_0x37e6('0x4'))},'keyContent':{'type':Sequelize[_0x37e6('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x37e6('0x6')]},'customField':{'type':Sequelize[_0x37e6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 23f1d07..6261be6 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 _0xf79f=['request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','rawAttributes','model','keys','intersection','attributes','fields','query','length','nolimit','sort','where','filters','pick','filter','map','key','VIRTUAL','field','merge','options','ZendeskField','rows','catch','params','includeAll','include','find','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf79f,0x193));var _0xff79=function(_0x98ee7c,_0x499bff){_0x98ee7c=_0x98ee7c-0x0;var _0xe4d709=_0xf79f[_0x98ee7c];return _0xe4d709;};'use strict';var pdf=require(_0xff79('0x0'));var emlformat=require(_0xff79('0x1'));var rimraf=require(_0xff79('0x2'));var zipdir=require(_0xff79('0x3'));var jsonpatch=require(_0xff79('0x4'));var rp=require(_0xff79('0x5'));var moment=require(_0xff79('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xff79('0x7'));var util=require(_0xff79('0x8'));var path=require(_0xff79('0x9'));var sox=require('sox');var csv=require(_0xff79('0xa'));var ejs=require(_0xff79('0xb'));var fs=require('fs');var _=require(_0xff79('0xc'));var squel=require(_0xff79('0xd'));var crypto=require(_0xff79('0xe'));var jsforce=require(_0xff79('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xff79('0xa'));var querystring=require('querystring');var Papa=require(_0xff79('0x10'));var Redis=require('ioredis');var authService=require(_0xff79('0x11'));var qs=require(_0xff79('0x12'));var hardwareService=require(_0xff79('0x13'));var logger=require(_0xff79('0x14'))(_0xff79('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd3aa,_0x2ac612){_0x2ac612=_0x2ac612||0xcc;return function(_0xea381b){if(_0xea381b){return _0x2bd3aa[_0xff79('0x16')](_0x2ac612);}return _0x2bd3aa[_0xff79('0x17')](_0x2ac612)[_0xff79('0x18')]();};}function respondWithResult(_0x2e45be,_0x22a97c){_0x22a97c=_0x22a97c||0xc8;return function(_0x466302){if(_0x466302){return _0x2e45be[_0xff79('0x17')](_0x22a97c)[_0xff79('0x19')](_0x466302);}};}function respondWithFilteredResult(_0x28de1e,_0x49b88b){return function(_0x3b7a76){if(_0x3b7a76){var _0x245b08=_0x3b7a76[_0xff79('0x1a')],_0x4b1d5b=_0x49b88b['offset'],_0x1b505f=_0x49b88b[_0xff79('0x1b')]+_0x49b88b[_0xff79('0x1c')],_0x5544d4;if(_0x1b505f>=_0x245b08){_0x1b505f=_0x245b08;_0x5544d4=0xc8;}else{_0x5544d4=0xce;}_0x28de1e[_0xff79('0x17')](_0x5544d4);return _0x28de1e[_0xff79('0x1d')](_0xff79('0x1e'),_0x4b1d5b+'-'+_0x1b505f+'/'+_0x245b08)[_0xff79('0x19')](_0x3b7a76);}return null;};}function patchUpdates(_0x1dcedb){return function(_0x109803){try{jsonpatch[_0xff79('0x1f')](_0x109803,_0x1dcedb,!![]);}catch(_0x1361f9){return BPromise[_0xff79('0x20')](_0x1361f9);}return _0x109803[_0xff79('0x21')]();};}function saveUpdates(_0x2f30b5,_0x2ed2a0){return function(_0x595904){if(_0x595904){return _0x595904['update'](_0x2f30b5)[_0xff79('0x22')](function(_0xa64a00){return _0xa64a00;});}return null;};}function removeEntity(_0x395f4d,_0x39c85b){return function(_0x12b423){if(_0x12b423){return _0x12b423[_0xff79('0x23')]()[_0xff79('0x22')](function(){_0x395f4d['status'](0xcc)[_0xff79('0x18')]();});}};}function handleEntityNotFound(_0x2ae958,_0x16fc66){return function(_0x5dcb5d){if(!_0x5dcb5d){_0x2ae958['sendStatus'](0x194);}return _0x5dcb5d;};}function handleError(_0x3ffd10,_0x3132f1){_0x3132f1=_0x3132f1||0x1f4;return function(_0x1ac6b0){logger[_0xff79('0x24')](_0x1ac6b0['stack']);if(_0x1ac6b0[_0xff79('0x25')]){delete _0x1ac6b0[_0xff79('0x25')];}_0x3ffd10[_0xff79('0x17')](_0x3132f1)['send'](_0x1ac6b0);};}exports[_0xff79('0x26')]=function(_0x51669c,_0x265848){var _0x11273c={},_0x179504={},_0x8f7a22={'count':0x0,'rows':[]};var _0x531821=db['ZendeskField'][_0xff79('0x27')];_0x179504[_0xff79('0x28')]=_[_0xff79('0x29')](_0x531821);_0x179504['query']=_[_0xff79('0x29')](_0x51669c['query']);_0x179504['filters']=_[_0xff79('0x2a')](_0x179504['model'],_0x179504['query']);_0x11273c[_0xff79('0x2b')]=_[_0xff79('0x2a')](_0x179504[_0xff79('0x28')],qs[_0xff79('0x2c')](_0x51669c[_0xff79('0x2d')][_0xff79('0x2c')]));_0x11273c['attributes']=_0x11273c[_0xff79('0x2b')][_0xff79('0x2e')]?_0x11273c[_0xff79('0x2b')]:_0x179504[_0xff79('0x28')];if(!_0x51669c[_0xff79('0x2d')]['hasOwnProperty'](_0xff79('0x2f'))){_0x11273c['limit']=qs[_0xff79('0x1c')](_0x51669c['query'][_0xff79('0x1c')]);_0x11273c[_0xff79('0x1b')]=qs[_0xff79('0x1b')](_0x51669c[_0xff79('0x2d')][_0xff79('0x1b')]);}_0x11273c['order']=qs[_0xff79('0x30')](_0x51669c[_0xff79('0x2d')][_0xff79('0x30')]);_0x11273c[_0xff79('0x31')]=qs[_0xff79('0x32')](_[_0xff79('0x33')](_0x51669c['query'],_0x179504[_0xff79('0x32')]));if(_0x51669c[_0xff79('0x2d')][_0xff79('0x34')]){_0x11273c['where']=_['merge'](_0x11273c[_0xff79('0x31')],{'$or':_[_0xff79('0x35')](_0x531821,function(_0xf99a61){if(_0xf99a61['type'][_0xff79('0x36')]!==_0xff79('0x37')){var _0x1d591a={};_0x1d591a[_0xf99a61[_0xff79('0x38')]]={'$like':'%'+_0x51669c[_0xff79('0x2d')][_0xff79('0x34')]+'%'};return _0x1d591a;}})});}_0x11273c=_[_0xff79('0x39')]({},_0x11273c,_0x51669c[_0xff79('0x3a')]);var _0x31d19c={'where':_0x11273c['where']};return db['ZendeskField'][_0xff79('0x1a')](_0x31d19c)[_0xff79('0x22')](function(_0x4dbf4a){_0x8f7a22[_0xff79('0x1a')]=_0x4dbf4a;if(_0x51669c[_0xff79('0x2d')]['includeAll']){_0x11273c['include']=[{'all':!![]}];}return db[_0xff79('0x3b')]['findAll'](_0x11273c);})[_0xff79('0x22')](function(_0x22a522){_0x8f7a22[_0xff79('0x3c')]=_0x22a522;return _0x8f7a22;})[_0xff79('0x22')](respondWithFilteredResult(_0x265848,_0x11273c))[_0xff79('0x3d')](handleError(_0x265848,null));};exports['show']=function(_0x3b69c1,_0x5911c0){var _0x42af1a={'raw':!![],'where':{'id':_0x3b69c1[_0xff79('0x3e')]['id']}},_0x3e446b={};_0x3e446b['model']=_[_0xff79('0x29')](db[_0xff79('0x3b')]['rawAttributes']);_0x3e446b[_0xff79('0x2d')]=_['keys'](_0x3b69c1['query']);_0x3e446b[_0xff79('0x32')]=_[_0xff79('0x2a')](_0x3e446b[_0xff79('0x28')],_0x3e446b[_0xff79('0x2d')]);_0x42af1a['attributes']=_[_0xff79('0x2a')](_0x3e446b['model'],qs['fields'](_0x3b69c1[_0xff79('0x2d')][_0xff79('0x2c')]));_0x42af1a[_0xff79('0x2b')]=_0x42af1a['attributes'][_0xff79('0x2e')]?_0x42af1a['attributes']:_0x3e446b[_0xff79('0x28')];if(_0x3b69c1['query'][_0xff79('0x3f')]){_0x42af1a[_0xff79('0x40')]=[{'all':!![]}];}_0x42af1a=_[_0xff79('0x39')]({},_0x42af1a,_0x3b69c1[_0xff79('0x3a')]);return db[_0xff79('0x3b')][_0xff79('0x41')](_0x42af1a)[_0xff79('0x22')](handleEntityNotFound(_0x5911c0,null))[_0xff79('0x22')](respondWithResult(_0x5911c0,null))['catch'](handleError(_0x5911c0,null));};exports['create']=function(_0x5d2cb3,_0x5c9855){return db[_0xff79('0x3b')]['create'](_0x5d2cb3[_0xff79('0x42')],{})[_0xff79('0x22')](respondWithResult(_0x5c9855,0xc9))[_0xff79('0x3d')](handleError(_0x5c9855,null));};exports[_0xff79('0x43')]=function(_0x21be07,_0x2453fc){if(_0x21be07[_0xff79('0x42')]['id']){delete _0x21be07[_0xff79('0x42')]['id'];}return db[_0xff79('0x3b')]['find']({'where':{'id':_0x21be07[_0xff79('0x3e')]['id']}})[_0xff79('0x22')](handleEntityNotFound(_0x2453fc,null))[_0xff79('0x22')](saveUpdates(_0x21be07[_0xff79('0x42')],null))[_0xff79('0x22')](respondWithResult(_0x2453fc,null))[_0xff79('0x3d')](handleError(_0x2453fc,null));};exports[_0xff79('0x23')]=function(_0x43e488,_0x46655b){return db[_0xff79('0x3b')][_0xff79('0x41')]({'where':{'id':_0x43e488['params']['id']}})[_0xff79('0x22')](handleEntityNotFound(_0x46655b,null))['then'](removeEntity(_0x46655b,null))[_0xff79('0x3d')](handleError(_0x46655b,null));}; \ No newline at end of file +var _0x1ae8=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','field','options','includeAll','include','findAll','catch','show','params','find','create','body','update','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel'];(function(_0x43c5f1,_0x24aded){var _0x3662ff=function(_0x11638d){while(--_0x11638d){_0x43c5f1['push'](_0x43c5f1['shift']());}};_0x3662ff(++_0x24aded);}(_0x1ae8,0xc5));var _0x81ae=function(_0x4e28a3,_0x4d0f64){_0x4e28a3=_0x4e28a3-0x0;var _0x367cd3=_0x1ae8[_0x4e28a3];return _0x367cd3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x81ae('0x0'));var zipdir=require(_0x81ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81ae('0x2'));var moment=require('moment');var BPromise=require(_0x81ae('0x3'));var Mustache=require('mustache');var util=require(_0x81ae('0x4'));var path=require(_0x81ae('0x5'));var sox=require('sox');var csv=require(_0x81ae('0x6'));var ejs=require(_0x81ae('0x7'));var fs=require('fs');var _=require(_0x81ae('0x8'));var squel=require(_0x81ae('0x9'));var crypto=require(_0x81ae('0xa'));var jsforce=require(_0x81ae('0xb'));var deskjs=require(_0x81ae('0xc'));var toCsv=require(_0x81ae('0x6'));var querystring=require(_0x81ae('0xd'));var Papa=require(_0x81ae('0xe'));var Redis=require('ioredis');var authService=require(_0x81ae('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x81ae('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x81ae('0x11'));var config=require(_0x81ae('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x526ecd,_0x5a9bb4){_0x5a9bb4=_0x5a9bb4||0xcc;return function(_0x16ea5b){if(_0x16ea5b){return _0x526ecd[_0x81ae('0x13')](_0x5a9bb4);}return _0x526ecd[_0x81ae('0x14')](_0x5a9bb4)[_0x81ae('0x15')]();};}function respondWithResult(_0x5bb687,_0x5c3b23){_0x5c3b23=_0x5c3b23||0xc8;return function(_0x6eb1c4){if(_0x6eb1c4){return _0x5bb687[_0x81ae('0x14')](_0x5c3b23)['json'](_0x6eb1c4);}};}function respondWithFilteredResult(_0xa1cb77,_0x76efa0){return function(_0x50a10f){if(_0x50a10f){var _0x47c254=_0x50a10f[_0x81ae('0x16')],_0x428eda=_0x76efa0[_0x81ae('0x17')],_0x2c9e39=_0x76efa0[_0x81ae('0x17')]+_0x76efa0[_0x81ae('0x18')],_0x1489b9;if(_0x2c9e39>=_0x47c254){_0x2c9e39=_0x47c254;_0x1489b9=0xc8;}else{_0x1489b9=0xce;}_0xa1cb77[_0x81ae('0x14')](_0x1489b9);return _0xa1cb77[_0x81ae('0x19')](_0x81ae('0x1a'),_0x428eda+'-'+_0x2c9e39+'/'+_0x47c254)[_0x81ae('0x1b')](_0x50a10f);}return null;};}function patchUpdates(_0x2a780d){return function(_0x497d51){try{jsonpatch[_0x81ae('0x1c')](_0x497d51,_0x2a780d,!![]);}catch(_0x5f072f){return BPromise[_0x81ae('0x1d')](_0x5f072f);}return _0x497d51[_0x81ae('0x1e')]();};}function saveUpdates(_0x5e31ac,_0x40421a){return function(_0x18a598){if(_0x18a598){return _0x18a598['update'](_0x5e31ac)[_0x81ae('0x1f')](function(_0x2747c1){return _0x2747c1;});}return null;};}function removeEntity(_0x51edb7,_0x13d776){return function(_0x543033){if(_0x543033){return _0x543033[_0x81ae('0x20')]()[_0x81ae('0x1f')](function(){_0x51edb7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a8508,_0x4ac620){return function(_0x5f196c){if(!_0x5f196c){_0x5a8508[_0x81ae('0x13')](0x194);}return _0x5f196c;};}function handleError(_0x291291,_0x147b62){_0x147b62=_0x147b62||0x1f4;return function(_0x31268d){logger[_0x81ae('0x21')](_0x31268d[_0x81ae('0x22')]);if(_0x31268d[_0x81ae('0x23')]){delete _0x31268d['name'];}_0x291291[_0x81ae('0x14')](_0x147b62)[_0x81ae('0x24')](_0x31268d);};}exports[_0x81ae('0x25')]=function(_0x500abd,_0xd49732){var _0x209e6e={},_0x3b0a83={},_0x162924={'count':0x0,'rows':[]};var _0x5b1977=db[_0x81ae('0x26')][_0x81ae('0x27')];_0x3b0a83[_0x81ae('0x28')]=_[_0x81ae('0x29')](_0x5b1977);_0x3b0a83[_0x81ae('0x2a')]=_[_0x81ae('0x29')](_0x500abd[_0x81ae('0x2a')]);_0x3b0a83['filters']=_[_0x81ae('0x2b')](_0x3b0a83['model'],_0x3b0a83['query']);_0x209e6e[_0x81ae('0x2c')]=_[_0x81ae('0x2b')](_0x3b0a83[_0x81ae('0x28')],qs['fields'](_0x500abd[_0x81ae('0x2a')][_0x81ae('0x2d')]));_0x209e6e[_0x81ae('0x2c')]=_0x209e6e[_0x81ae('0x2c')][_0x81ae('0x2e')]?_0x209e6e[_0x81ae('0x2c')]:_0x3b0a83[_0x81ae('0x28')];if(!_0x500abd['query'][_0x81ae('0x2f')]('nolimit')){_0x209e6e[_0x81ae('0x18')]=qs[_0x81ae('0x18')](_0x500abd['query'][_0x81ae('0x18')]);_0x209e6e[_0x81ae('0x17')]=qs['offset'](_0x500abd['query'][_0x81ae('0x17')]);}_0x209e6e[_0x81ae('0x30')]=qs['sort'](_0x500abd[_0x81ae('0x2a')][_0x81ae('0x31')]);_0x209e6e[_0x81ae('0x32')]=qs[_0x81ae('0x33')](_[_0x81ae('0x34')](_0x500abd[_0x81ae('0x2a')],_0x3b0a83['filters']));if(_0x500abd['query'][_0x81ae('0x35')]){_0x209e6e[_0x81ae('0x32')]=_[_0x81ae('0x36')](_0x209e6e[_0x81ae('0x32')],{'$or':_[_0x81ae('0x37')](_0x5b1977,function(_0x3b2717){if(_0x3b2717[_0x81ae('0x38')]['key']!=='VIRTUAL'){var _0x5e4091={};_0x5e4091[_0x3b2717[_0x81ae('0x39')]]={'$like':'%'+_0x500abd[_0x81ae('0x2a')]['filter']+'%'};return _0x5e4091;}})});}_0x209e6e=_[_0x81ae('0x36')]({},_0x209e6e,_0x500abd[_0x81ae('0x3a')]);var _0x43b73a={'where':_0x209e6e[_0x81ae('0x32')]};return db[_0x81ae('0x26')][_0x81ae('0x16')](_0x43b73a)[_0x81ae('0x1f')](function(_0x3502e1){_0x162924[_0x81ae('0x16')]=_0x3502e1;if(_0x500abd[_0x81ae('0x2a')][_0x81ae('0x3b')]){_0x209e6e[_0x81ae('0x3c')]=[{'all':!![]}];}return db[_0x81ae('0x26')][_0x81ae('0x3d')](_0x209e6e);})['then'](function(_0x41af84){_0x162924['rows']=_0x41af84;return _0x162924;})[_0x81ae('0x1f')](respondWithFilteredResult(_0xd49732,_0x209e6e))[_0x81ae('0x3e')](handleError(_0xd49732,null));};exports[_0x81ae('0x3f')]=function(_0x2d8b3b,_0x2d35b2){var _0x23449a={'raw':!![],'where':{'id':_0x2d8b3b[_0x81ae('0x40')]['id']}},_0x3a73d4={};_0x3a73d4['model']=_[_0x81ae('0x29')](db[_0x81ae('0x26')][_0x81ae('0x27')]);_0x3a73d4['query']=_[_0x81ae('0x29')](_0x2d8b3b[_0x81ae('0x2a')]);_0x3a73d4[_0x81ae('0x33')]=_[_0x81ae('0x2b')](_0x3a73d4[_0x81ae('0x28')],_0x3a73d4[_0x81ae('0x2a')]);_0x23449a[_0x81ae('0x2c')]=_[_0x81ae('0x2b')](_0x3a73d4['model'],qs[_0x81ae('0x2d')](_0x2d8b3b['query'][_0x81ae('0x2d')]));_0x23449a[_0x81ae('0x2c')]=_0x23449a['attributes'][_0x81ae('0x2e')]?_0x23449a[_0x81ae('0x2c')]:_0x3a73d4[_0x81ae('0x28')];if(_0x2d8b3b['query'][_0x81ae('0x3b')]){_0x23449a[_0x81ae('0x3c')]=[{'all':!![]}];}_0x23449a=_[_0x81ae('0x36')]({},_0x23449a,_0x2d8b3b[_0x81ae('0x3a')]);return db[_0x81ae('0x26')][_0x81ae('0x41')](_0x23449a)[_0x81ae('0x1f')](handleEntityNotFound(_0x2d35b2,null))[_0x81ae('0x1f')](respondWithResult(_0x2d35b2,null))[_0x81ae('0x3e')](handleError(_0x2d35b2,null));};exports['create']=function(_0x3e3061,_0x121ac2){return db['ZendeskField'][_0x81ae('0x42')](_0x3e3061[_0x81ae('0x43')],{})[_0x81ae('0x1f')](respondWithResult(_0x121ac2,0xc9))[_0x81ae('0x3e')](handleError(_0x121ac2,null));};exports[_0x81ae('0x44')]=function(_0x325c4e,_0x4123fa){if(_0x325c4e[_0x81ae('0x43')]['id']){delete _0x325c4e[_0x81ae('0x43')]['id'];}return db[_0x81ae('0x26')][_0x81ae('0x41')]({'where':{'id':_0x325c4e[_0x81ae('0x40')]['id']}})[_0x81ae('0x1f')](handleEntityNotFound(_0x4123fa,null))[_0x81ae('0x1f')](saveUpdates(_0x325c4e[_0x81ae('0x43')],null))[_0x81ae('0x1f')](respondWithResult(_0x4123fa,null))[_0x81ae('0x3e')](handleError(_0x4123fa,null));};exports[_0x81ae('0x20')]=function(_0x5d49e8,_0x28547f){return db[_0x81ae('0x26')][_0x81ae('0x41')]({'where':{'id':_0x5d49e8[_0x81ae('0x40')]['id']}})['then'](handleEntityNotFound(_0x28547f,null))[_0x81ae('0x1f')](removeEntity(_0x28547f,null))[_0x81ae('0x3e')](handleError(_0x28547f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 0464278..8f17ae9 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 _0x50a8=['lodash','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','zendesk_unique_index','idField','FieldId'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x50a8,0x198));var _0x850a=function(_0x505abd,_0x32d6ea){_0x505abd=_0x505abd-0x0;var _0x25b4de=_0x50a8[_0x505abd];return _0x25b4de;};'use strict';var _=require(_0x850a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x850a('0x1'));var BPromise=require('bluebird');var rp=require(_0x850a('0x2'));var fs=require('fs');var path=require(_0x850a('0x3'));var rimraf=require(_0x850a('0x4'));var config=require(_0x850a('0x5'));var attributes=require(_0x850a('0x6'));module[_0x850a('0x7')]=function(_0xb85c1a,_0x442316){return _0xb85c1a[_0x850a('0x8')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x850a('0x9'),'fields':[_0x850a('0xa'),_0x850a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7427=['zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields'];(function(_0x5c3aba,_0x4edded){var _0x1593fa=function(_0x498378){while(--_0x498378){_0x5c3aba['push'](_0x5c3aba['shift']());}};_0x1593fa(++_0x4edded);}(_0x7427,0x111));var _0x7742=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7427[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7742('0x0'));var util=require(_0x7742('0x1'));var logger=require(_0x7742('0x2'))(_0x7742('0x3'));var moment=require('moment');var BPromise=require(_0x7742('0x4'));var rp=require(_0x7742('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7742('0x6'));var config=require(_0x7742('0x7'));var attributes=require(_0x7742('0x8'));module[_0x7742('0x9')]=function(_0x360d59,_0x57fa9a){return _0x360d59['define'](_0x7742('0xa'),attributes,{'tableName':_0x7742('0xb'),'paranoid':![],'indexes':[{'name':_0x7742('0xc'),'fields':[_0x7742('0xd'),_0x7742('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index f6d80fe..274075c 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 _0x8757=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x28dd47,_0x917a2d){var _0x203afe=function(_0x51befe){while(--_0x51befe){_0x28dd47['push'](_0x28dd47['shift']());}};_0x203afe(++_0x917a2d);}(_0x8757,0x174));var _0x7875=function(_0x88c14c,_0x31cc60){_0x88c14c=_0x88c14c-0x0;var _0x4ee79f=_0x8757[_0x88c14c];return _0x4ee79f;};'use strict';var _=require(_0x7875('0x0'));var util=require('util');var moment=require(_0x7875('0x1'));var BPromise=require(_0x7875('0x2'));var rs=require(_0x7875('0x3'));var fs=require('fs');var Redis=require(_0x7875('0x4'));var db=require(_0x7875('0x5'))['db'];var utils=require(_0x7875('0x6'));var logger=require(_0x7875('0x7'))('rpc');var config=require(_0x7875('0x8'));var jayson=require(_0x7875('0x9'));var client=jayson[_0x7875('0xa')][_0x7875('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23a77a,_0x762c4d,_0x4a85a3){return new BPromise(function(_0x3ce49b,_0x543e8d){return client[_0x7875('0xc')](_0x23a77a,_0x4a85a3)[_0x7875('0xd')](function(_0x116358){logger[_0x7875('0xe')](_0x7875('0xf'),_0x762c4d,'request\x20sent');logger[_0x7875('0x10')](_0x7875('0x11'),_0x762c4d,_0x7875('0x12'),JSON[_0x7875('0x13')](_0x116358));if(_0x116358[_0x7875('0x14')]){if(_0x116358[_0x7875('0x14')][_0x7875('0x15')]===0x1f4){logger[_0x7875('0x14')]('ZendeskField,\x20%s,\x20%s',_0x762c4d,_0x116358['error'][_0x7875('0x16')]);return _0x543e8d(_0x116358[_0x7875('0x14')][_0x7875('0x16')]);}logger['error'](_0x7875('0xf'),_0x762c4d,_0x116358['error'][_0x7875('0x16')]);return _0x3ce49b(_0x116358['error'][_0x7875('0x16')]);}else{logger['info'](_0x7875('0xf'),_0x762c4d,_0x7875('0x12'));_0x3ce49b(_0x116358[_0x7875('0x17')][_0x7875('0x16')]);}})[_0x7875('0x18')](function(_0x28f1ae){logger['error'](_0x7875('0xf'),_0x762c4d,_0x28f1ae);_0x543e8d(_0x28f1ae);});});} \ No newline at end of file +var _0xfa51=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x177f2a,_0x2f3e55){var _0x39086a=function(_0x5b7cf6){while(--_0x5b7cf6){_0x177f2a['push'](_0x177f2a['shift']());}};_0x39086a(++_0x2f3e55);}(_0xfa51,0xd8));var _0x1fa5=function(_0x393488,_0x20a4be){_0x393488=_0x393488-0x0;var _0x7fdd7c=_0xfa51[_0x393488];return _0x7fdd7c;};'use strict';var _=require(_0x1fa5('0x0'));var util=require(_0x1fa5('0x1'));var moment=require(_0x1fa5('0x2'));var BPromise=require('bluebird');var rs=require(_0x1fa5('0x3'));var fs=require('fs');var Redis=require(_0x1fa5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fa5('0x5'));var logger=require(_0x1fa5('0x6'))(_0x1fa5('0x7'));var config=require(_0x1fa5('0x8'));var jayson=require(_0x1fa5('0x9'));var client=jayson[_0x1fa5('0xa')][_0x1fa5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59d52b,_0x4daf41,_0x543a43){return new BPromise(function(_0x58861b,_0x4cdee2){return client[_0x1fa5('0xc')](_0x59d52b,_0x543a43)[_0x1fa5('0xd')](function(_0x7532f0){logger[_0x1fa5('0xe')](_0x1fa5('0xf'),_0x4daf41,_0x1fa5('0x10'));logger[_0x1fa5('0x11')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4daf41,'request\x20sent',JSON['stringify'](_0x7532f0));if(_0x7532f0[_0x1fa5('0x12')]){if(_0x7532f0[_0x1fa5('0x12')]['code']===0x1f4){logger[_0x1fa5('0x12')](_0x1fa5('0xf'),_0x4daf41,_0x7532f0[_0x1fa5('0x12')][_0x1fa5('0x13')]);return _0x4cdee2(_0x7532f0[_0x1fa5('0x12')][_0x1fa5('0x13')]);}logger[_0x1fa5('0x12')](_0x1fa5('0xf'),_0x4daf41,_0x7532f0[_0x1fa5('0x12')][_0x1fa5('0x13')]);return _0x58861b(_0x7532f0['error'][_0x1fa5('0x13')]);}else{logger['info'](_0x1fa5('0xf'),_0x4daf41,'request\x20sent');_0x58861b(_0x7532f0[_0x1fa5('0x14')][_0x1fa5('0x13')]);}})[_0x1fa5('0x15')](function(_0x3d2799){logger[_0x1fa5('0x12')](_0x1fa5('0xf'),_0x4daf41,_0x3d2799);_0x4cdee2(_0x3d2799);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d8ee08e..d37e037 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 _0x6b12=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','/:id','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x609927,_0x2366ae){var _0x520492=function(_0x45e460){while(--_0x45e460){_0x609927['push'](_0x609927['shift']());}};_0x520492(++_0x2366ae);}(_0x6b12,0x1f2));var _0x26b1=function(_0x57b40f,_0xaf1145){_0x57b40f=_0x57b40f-0x0;var _0x5b59a4=_0x6b12[_0x57b40f];return _0x5b59a4;};'use strict';var multer=require(_0x26b1('0x0'));var util=require(_0x26b1('0x1'));var path=require(_0x26b1('0x2'));var timeout=require(_0x26b1('0x3'));var express=require(_0x26b1('0x4'));var router=express[_0x26b1('0x5')]();var auth=require(_0x26b1('0x6'));var interaction=require(_0x26b1('0x7'));var config=require(_0x26b1('0x8'));var controller=require(_0x26b1('0x9'));router[_0x26b1('0xa')]('/',auth[_0x26b1('0xb')](),controller[_0x26b1('0xc')]);router[_0x26b1('0xa')]('/:id',auth[_0x26b1('0xb')](),controller[_0x26b1('0xd')]);router[_0x26b1('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x26b1('0xe')]);router[_0x26b1('0xa')](_0x26b1('0xf'),auth[_0x26b1('0xb')](),controller['getFields']);router[_0x26b1('0x10')]('/',auth[_0x26b1('0xb')](),controller[_0x26b1('0x11')]);router['post'](_0x26b1('0x12'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x26b1('0x13'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x26b1('0xb')](),controller[_0x26b1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x720d=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x720d,0x16a));var _0xd720=function(_0x57592d,_0x402d7e){_0x57592d=_0x57592d-0x0;var _0x58cef5=_0x720d[_0x57592d];return _0x58cef5;};'use strict';var multer=require(_0xd720('0x0'));var util=require(_0xd720('0x1'));var path=require(_0xd720('0x2'));var timeout=require(_0xd720('0x3'));var express=require(_0xd720('0x4'));var router=express[_0xd720('0x5')]();var auth=require(_0xd720('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd720('0x7'));var controller=require(_0xd720('0x8'));router[_0xd720('0x9')]('/',auth[_0xd720('0xa')](),controller['index']);router[_0xd720('0x9')](_0xd720('0xb'),auth[_0xd720('0xa')](),controller['show']);router[_0xd720('0x9')](_0xd720('0xc'),auth[_0xd720('0xa')](),controller[_0xd720('0xd')]);router[_0xd720('0x9')](_0xd720('0xe'),auth[_0xd720('0xa')](),controller[_0xd720('0xf')]);router[_0xd720('0x10')]('/',auth[_0xd720('0xa')](),controller[_0xd720('0x11')]);router[_0xd720('0x10')](_0xd720('0xc'),auth['isAuthenticated'](),controller[_0xd720('0x12')]);router[_0xd720('0x13')](_0xd720('0xb'),auth[_0xd720('0xa')](),controller[_0xd720('0x14')]);router[_0xd720('0x15')](_0xd720('0xb'),auth[_0xd720('0xa')](),controller[_0xd720('0x16')]);module[_0xd720('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 8858bbe..3797903 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 _0x527d=['sequelize','exports','STRING'];(function(_0x2c556f,_0x53cd77){var _0x17f35e=function(_0x41e3da){while(--_0x41e3da){_0x2c556f['push'](_0x2c556f['shift']());}};_0x17f35e(++_0x53cd77);}(_0x527d,0x19e));var _0xd527=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0x527d[_0x34e752];return _0x7c6347;};'use strict';var Sequelize=require(_0xd527('0x0'));module[_0xd527('0x1')]={'name':{'type':Sequelize[_0xd527('0x2')]},'description':{'type':Sequelize[_0xd527('0x2')]},'host':{'type':Sequelize[_0xd527('0x2')]},'zone':{'type':Sequelize[_0xd527('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xd527('0x2')]},'serverUrl':{'type':Sequelize[_0xd527('0x2')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb993=['exports','STRING'];(function(_0x5e859a,_0x36bcc7){var _0x5b52ea=function(_0x243127){while(--_0x243127){_0x5e859a['push'](_0x5e859a['shift']());}};_0x5b52ea(++_0x36bcc7);}(_0xb993,0xa2));var _0x3b99=function(_0xec0f1f,_0x35058d){_0xec0f1f=_0xec0f1f-0x0;var _0x423ab9=_0xb993[_0xec0f1f];return _0x423ab9;};'use strict';var Sequelize=require('sequelize');module[_0x3b99('0x0')]={'name':{'type':Sequelize[_0x3b99('0x1')]},'description':{'type':Sequelize[_0x3b99('0x1')]},'host':{'type':Sequelize[_0x3b99('0x1')]},'zone':{'type':Sequelize[_0x3b99('0x1')]},'clientId':{'type':Sequelize[_0x3b99('0x1')]},'clientSecret':{'type':Sequelize[_0x3b99('0x1')]},'serverUrl':{'type':Sequelize[_0x3b99('0x1')]},'code':{'type':Sequelize[_0x3b99('0x1')]},'refreshToken':{'type':Sequelize[_0x3b99('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 35a8de7..b49dbc6 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 _0xd201=['name','index','ZohoAccount','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','rows','show','find','create','body','params','getConfigurations','ZohoConfiguration','map','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','getFields','zone','serverUrl','code','host','zoho.eu','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','push','display_label','pick_list_values','statusCode','send','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy'];(function(_0x11239b,_0xdfd2b0){var _0x1d51c4=function(_0x2bba88){while(--_0x2bba88){_0x11239b['push'](_0x11239b['shift']());}};_0x1d51c4(++_0xdfd2b0);}(_0xd201,0xd2));var _0x1d20=function(_0x20d7b2,_0x1cd564){_0x20d7b2=_0x20d7b2-0x0;var _0x483991=_0xd201[_0x20d7b2];return _0x483991;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1d20('0x0'));var jsonpatch=require(_0x1d20('0x1'));var rp=require(_0x1d20('0x2'));var moment=require(_0x1d20('0x3'));var BPromise=require(_0x1d20('0x4'));var Mustache=require(_0x1d20('0x5'));var util=require(_0x1d20('0x6'));var path=require(_0x1d20('0x7'));var sox=require(_0x1d20('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d20('0x9'));var squel=require(_0x1d20('0xa'));var crypto=require(_0x1d20('0xb'));var jsforce=require(_0x1d20('0xc'));var deskjs=require(_0x1d20('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1d20('0xe'));var Papa=require('papaparse');var Redis=require(_0x1d20('0xf'));var authService=require(_0x1d20('0x10'));var qs=require(_0x1d20('0x11'));var hardwareService=require(_0x1d20('0x12'));var logger=require(_0x1d20('0x13'))(_0x1d20('0x14'));var utils=require(_0x1d20('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1d20('0x16'));var client=jayson[_0x1d20('0x17')][_0x1d20('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2bcae0,_0x18a3d1,_0x2c7e50){if(_0x2c7e50){var _0x2c5d73=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c5d73[_0x1d20('0x19')](_0x18a3d1)){return _0x2bcae0;}else{throw new db['Sequelize'][(_0x1d20('0x1a'))](_0x1d20('0x1b'));}}else{return _0x2bcae0;}}function respondWithRpcPromise(_0x4d06e9,_0x273d7d,_0x3a0bd9,_0x250a8a){return new BPromise(function(_0x1e65f3,_0x443d7e){var _0x5884e9=_0x250a8a||client;return _0x5884e9[_0x1d20('0x1c')](_0x4d06e9,_0x3a0bd9)[_0x1d20('0x1d')](function(_0x599cb6){logger[_0x1d20('0x1e')](_0x1d20('0x1f'),_0x273d7d,_0x1d20('0x20'));logger[_0x1d20('0x21')](_0x1d20('0x22'),_0x273d7d,_0x1d20('0x20'),JSON[_0x1d20('0x23')](_0x599cb6));if(_0x599cb6[_0x1d20('0x24')]){if(_0x599cb6[_0x1d20('0x24')]['code']===0x1f4){logger[_0x1d20('0x24')](_0x1d20('0x1f'),_0x273d7d,_0x599cb6['error'][_0x1d20('0x25')]);return _0x443d7e(_0x599cb6[_0x1d20('0x24')][_0x1d20('0x25')]);}logger[_0x1d20('0x24')](_0x1d20('0x1f'),_0x273d7d,_0x599cb6[_0x1d20('0x24')][_0x1d20('0x25')]);return _0x1e65f3(_0x599cb6[_0x1d20('0x24')][_0x1d20('0x25')]);}else{logger[_0x1d20('0x1e')](_0x1d20('0x1f'),_0x273d7d,_0x1d20('0x20'));_0x1e65f3(_0x599cb6[_0x1d20('0x26')]['message']);}})[_0x1d20('0x27')](function(_0xf1cab9){logger[_0x1d20('0x24')](_0x1d20('0x1f'),_0x273d7d,_0xf1cab9);_0x443d7e(_0xf1cab9);});});}function respondWithStatusCode(_0x2753d7,_0x7aaca){_0x7aaca=_0x7aaca||0xcc;return function(_0x575eea){if(_0x575eea){return _0x2753d7[_0x1d20('0x28')](_0x7aaca);}return _0x2753d7[_0x1d20('0x29')](_0x7aaca)[_0x1d20('0x2a')]();};}function respondWithResult(_0x2eb3c9,_0x3f2829){_0x3f2829=_0x3f2829||0xc8;return function(_0x52849a){if(_0x52849a){return _0x2eb3c9[_0x1d20('0x29')](_0x3f2829)['json'](_0x52849a);}};}function respondWithFilteredResult(_0x73f5fc,_0x5144f8){return function(_0x5ed205){if(_0x5ed205){var _0x1f7d71=_0x5ed205[_0x1d20('0x2b')],_0xb0c6f9=_0x5144f8[_0x1d20('0x2c')],_0x1c93fe=_0x5144f8[_0x1d20('0x2c')]+_0x5144f8[_0x1d20('0x2d')],_0x32ccc5;if(_0x1c93fe>=_0x1f7d71){_0x1c93fe=_0x1f7d71;_0x32ccc5=0xc8;}else{_0x32ccc5=0xce;}_0x73f5fc[_0x1d20('0x29')](_0x32ccc5);return _0x73f5fc[_0x1d20('0x2e')](_0x1d20('0x2f'),_0xb0c6f9+'-'+_0x1c93fe+'/'+_0x1f7d71)[_0x1d20('0x30')](_0x5ed205);}return null;};}function patchUpdates(_0x189b33){return function(_0x4bb372){try{jsonpatch[_0x1d20('0x31')](_0x4bb372,_0x189b33,!![]);}catch(_0x56b968){return BPromise[_0x1d20('0x32')](_0x56b968);}return _0x4bb372[_0x1d20('0x33')]();};}function saveUpdates(_0x18b238,_0x11941d){return function(_0x1d4e5b){if(_0x1d4e5b){return _0x1d4e5b[_0x1d20('0x34')](_0x18b238)[_0x1d20('0x1d')](function(_0x5e7e65){return _0x5e7e65;});}return null;};}function removeEntity(_0x1a77d7,_0x3fee8f){return function(_0x408608){if(_0x408608){return _0x408608[_0x1d20('0x35')]()[_0x1d20('0x1d')](function(){_0x1a77d7[_0x1d20('0x29')](0xcc)[_0x1d20('0x2a')]();});}};}function handleEntityNotFound(_0x598661,_0x2560c9){return function(_0x28de65){if(!_0x28de65){_0x598661['sendStatus'](0x194);}return _0x28de65;};}function handleError(_0xd19fdd,_0x396bdc){_0x396bdc=_0x396bdc||0x1f4;return function(_0x1448cb){logger[_0x1d20('0x24')](_0x1448cb['stack']);if(_0x1448cb[_0x1d20('0x36')]){delete _0x1448cb['name'];}_0xd19fdd[_0x1d20('0x29')](_0x396bdc)['send'](_0x1448cb);};}exports[_0x1d20('0x37')]=function(_0x1e45cf,_0x4b477d){var _0x2a81ab={},_0x371c1e={},_0xbdb7cd={'count':0x0,'rows':[]};var _0x2caaef=db[_0x1d20('0x38')][_0x1d20('0x39')];_0x371c1e[_0x1d20('0x3a')]=_[_0x1d20('0x3b')](_0x2caaef);_0x371c1e[_0x1d20('0x3c')]=_[_0x1d20('0x3b')](_0x1e45cf[_0x1d20('0x3c')]);_0x371c1e[_0x1d20('0x3d')]=_['intersection'](_0x371c1e[_0x1d20('0x3a')],_0x371c1e[_0x1d20('0x3c')]);_0x2a81ab['attributes']=_[_0x1d20('0x3e')](_0x371c1e[_0x1d20('0x3a')],qs[_0x1d20('0x3f')](_0x1e45cf['query'][_0x1d20('0x3f')]));_0x2a81ab[_0x1d20('0x40')]=_0x2a81ab[_0x1d20('0x40')][_0x1d20('0x41')]?_0x2a81ab[_0x1d20('0x40')]:_0x371c1e[_0x1d20('0x3a')];if(!_0x1e45cf[_0x1d20('0x3c')]['hasOwnProperty'](_0x1d20('0x42'))){_0x2a81ab[_0x1d20('0x2d')]=qs[_0x1d20('0x2d')](_0x1e45cf['query']['limit']);_0x2a81ab['offset']=qs['offset'](_0x1e45cf[_0x1d20('0x3c')][_0x1d20('0x2c')]);}_0x2a81ab[_0x1d20('0x43')]=qs['sort'](_0x1e45cf[_0x1d20('0x3c')][_0x1d20('0x44')]);_0x2a81ab[_0x1d20('0x45')]=qs[_0x1d20('0x3d')](_[_0x1d20('0x46')](_0x1e45cf[_0x1d20('0x3c')],_0x371c1e[_0x1d20('0x3d')]));if(_0x1e45cf[_0x1d20('0x3c')][_0x1d20('0x47')]){_0x2a81ab[_0x1d20('0x45')]=_[_0x1d20('0x48')](_0x2a81ab[_0x1d20('0x45')],{'$or':_['map'](_0x2caaef,function(_0x44908c){if(_0x44908c[_0x1d20('0x49')][_0x1d20('0x4a')]!==_0x1d20('0x4b')){var _0x33ac8f={};_0x33ac8f[_0x44908c[_0x1d20('0x4c')]]={'$like':'%'+_0x1e45cf['query']['filter']+'%'};return _0x33ac8f;}})});}_0x2a81ab=_[_0x1d20('0x48')]({},_0x2a81ab,_0x1e45cf[_0x1d20('0x4d')]);var _0x3060b7={'where':_0x2a81ab['where']};return db[_0x1d20('0x38')][_0x1d20('0x2b')](_0x3060b7)['then'](function(_0x1577fb){_0xbdb7cd[_0x1d20('0x2b')]=_0x1577fb;if(_0x1e45cf[_0x1d20('0x3c')][_0x1d20('0x4e')]){_0x2a81ab[_0x1d20('0x4f')]=[{'all':!![]}];}return db[_0x1d20('0x38')]['findAll'](_0x2a81ab);})[_0x1d20('0x1d')](function(_0x5d9749){_0xbdb7cd[_0x1d20('0x50')]=_0x5d9749;return _0xbdb7cd;})['then'](respondWithFilteredResult(_0x4b477d,_0x2a81ab))['catch'](handleError(_0x4b477d,null));};exports[_0x1d20('0x51')]=function(_0x103b39,_0x1cc54f){var _0xfbc1e9={'raw':![],'where':{'id':_0x103b39['params']['id']}},_0x51bce3={};_0x51bce3['model']=_['keys'](db[_0x1d20('0x38')][_0x1d20('0x39')]);_0x51bce3['query']=_[_0x1d20('0x3b')](_0x103b39['query']);_0x51bce3[_0x1d20('0x3d')]=_['intersection'](_0x51bce3[_0x1d20('0x3a')],_0x51bce3['query']);_0xfbc1e9[_0x1d20('0x40')]=_[_0x1d20('0x3e')](_0x51bce3[_0x1d20('0x3a')],qs[_0x1d20('0x3f')](_0x103b39['query']['fields']));_0xfbc1e9['attributes']=_0xfbc1e9[_0x1d20('0x40')]['length']?_0xfbc1e9[_0x1d20('0x40')]:_0x51bce3[_0x1d20('0x3a')];if(_0x103b39[_0x1d20('0x3c')][_0x1d20('0x4e')]){_0xfbc1e9[_0x1d20('0x4f')]=[{'all':!![]}];}_0xfbc1e9=_[_0x1d20('0x48')]({},_0xfbc1e9,_0x103b39['options']);return db[_0x1d20('0x38')][_0x1d20('0x52')](_0xfbc1e9)[_0x1d20('0x1d')](handleEntityNotFound(_0x1cc54f,null))['then'](respondWithResult(_0x1cc54f,null))[_0x1d20('0x27')](handleError(_0x1cc54f,null));};exports[_0x1d20('0x53')]=function(_0x249a42,_0x134a42){return db[_0x1d20('0x38')][_0x1d20('0x53')](_0x249a42[_0x1d20('0x54')],{})[_0x1d20('0x1d')](respondWithResult(_0x134a42,0xc9))[_0x1d20('0x27')](handleError(_0x134a42,null));};exports[_0x1d20('0x34')]=function(_0x254c0f,_0x17f1a1){if(_0x254c0f[_0x1d20('0x54')]['id']){delete _0x254c0f[_0x1d20('0x54')]['id'];}return db[_0x1d20('0x38')][_0x1d20('0x52')]({'where':{'id':_0x254c0f[_0x1d20('0x55')]['id']}})[_0x1d20('0x1d')](handleEntityNotFound(_0x17f1a1,null))[_0x1d20('0x1d')](saveUpdates(_0x254c0f[_0x1d20('0x54')],null))[_0x1d20('0x1d')](respondWithResult(_0x17f1a1,null))[_0x1d20('0x27')](handleError(_0x17f1a1,null));};exports['destroy']=function(_0x20e036,_0x1aa507){return db['ZohoAccount'][_0x1d20('0x52')]({'where':{'id':_0x20e036['params']['id']}})['then'](handleEntityNotFound(_0x1aa507,null))[_0x1d20('0x1d')](removeEntity(_0x1aa507,null))['catch'](handleError(_0x1aa507,null));};exports[_0x1d20('0x56')]=function(_0x530231,_0x489205,_0x211b25){var _0x3eb6ce={};var _0x6e5d94={};var _0x100bab;var _0x1270dd;return db[_0x1d20('0x38')]['findOne']({'where':{'id':_0x530231[_0x1d20('0x55')]['id']}})[_0x1d20('0x1d')](handleEntityNotFound(_0x489205,null))[_0x1d20('0x1d')](function(_0x200ca8){if(_0x200ca8){_0x100bab=_0x200ca8;_0x6e5d94['model']=_[_0x1d20('0x3b')](db[_0x1d20('0x57')][_0x1d20('0x39')]);_0x6e5d94[_0x1d20('0x3c')]=_[_0x1d20('0x3b')](_0x530231[_0x1d20('0x3c')]);_0x6e5d94[_0x1d20('0x3d')]=_['intersection'](_0x6e5d94[_0x1d20('0x3a')],_0x6e5d94[_0x1d20('0x3c')]);_0x3eb6ce['attributes']=_['intersection'](_0x6e5d94[_0x1d20('0x3a')],qs[_0x1d20('0x3f')](_0x530231[_0x1d20('0x3c')][_0x1d20('0x3f')]));_0x3eb6ce['attributes']=_0x3eb6ce[_0x1d20('0x40')][_0x1d20('0x41')]?_0x3eb6ce[_0x1d20('0x40')]:_0x6e5d94[_0x1d20('0x3a')];_0x3eb6ce[_0x1d20('0x43')]=qs[_0x1d20('0x44')](_0x530231['query'][_0x1d20('0x44')]);_0x3eb6ce[_0x1d20('0x45')]=qs['filters'](_['pick'](_0x530231[_0x1d20('0x3c')],_0x6e5d94[_0x1d20('0x3d')]));if(_0x530231[_0x1d20('0x3c')][_0x1d20('0x47')]){_0x3eb6ce['where']=_[_0x1d20('0x48')](_0x3eb6ce[_0x1d20('0x45')],{'$or':_[_0x1d20('0x58')](_0x3eb6ce['attributes'],function(_0x8b83cd){var _0x288b31={};_0x288b31[_0x8b83cd]={'$like':'%'+_0x530231[_0x1d20('0x3c')][_0x1d20('0x47')]+'%'};return _0x288b31;})});}_0x3eb6ce=_[_0x1d20('0x48')]({},_0x3eb6ce,_0x530231[_0x1d20('0x4d')]);return _0x100bab[_0x1d20('0x56')](_0x3eb6ce);}})[_0x1d20('0x1d')](function(_0x51d7bf){if(_0x51d7bf){_0x1270dd=_0x51d7bf[_0x1d20('0x41')];if(!_0x530231[_0x1d20('0x3c')]['hasOwnProperty'](_0x1d20('0x42'))){_0x3eb6ce[_0x1d20('0x2d')]=qs[_0x1d20('0x2d')](_0x530231[_0x1d20('0x3c')][_0x1d20('0x2d')]);_0x3eb6ce[_0x1d20('0x2c')]=qs['offset'](_0x530231[_0x1d20('0x3c')][_0x1d20('0x2c')]);}return _0x100bab[_0x1d20('0x56')](_0x3eb6ce);}})['then'](function(_0x5f53fb){if(_0x5f53fb){return _0x5f53fb?{'count':_0x1270dd,'rows':_0x5f53fb}:null;}})[_0x1d20('0x1d')](respondWithResult(_0x489205,null))[_0x1d20('0x27')](handleError(_0x489205,null));};exports[_0x1d20('0x59')]=function(_0x393074,_0x57b3ce,_0x251ec3){if(_0x393074[_0x1d20('0x54')]['id']){delete _0x393074[_0x1d20('0x54')]['id'];}return db[_0x1d20('0x38')][_0x1d20('0x5a')]({'where':{'id':_0x393074[_0x1d20('0x55')]['id']}})[_0x1d20('0x1d')](handleEntityNotFound(_0x57b3ce,null))['then'](function(_0x6129da){if(_0x6129da){_0x393074[_0x1d20('0x54')]['AccountId']=_0x6129da['id'];_0x393074[_0x1d20('0x54')][_0x1d20('0x5b')]=integrations[_0x1d20('0x5c')](_0x393074[_0x1d20('0x54')][_0x1d20('0x5d')],_0x393074[_0x1d20('0x54')][_0x1d20('0x49')]);_0x393074[_0x1d20('0x54')][_0x1d20('0x5e')]=integrations['getDescriptions'](_0x393074['body'][_0x1d20('0x5d')],_0x393074[_0x1d20('0x54')]['type']);return db['ZohoConfiguration']['create'](_0x393074[_0x1d20('0x54')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x1d20('0x5f')],'as':'Descriptions'}]});}return null;})[_0x1d20('0x1d')](respondWithResult(_0x57b3ce,null))[_0x1d20('0x27')](handleError(_0x57b3ce,null));};function getAccessToken(_0x4d16a3){return new Promise(function(_0x43211b,_0x141435){var _0x34a135;switch(_0x4d16a3['zone']){case'US':_0x34a135=_0x1d20('0x60');break;case'AU':_0x34a135=_0x1d20('0x61');break;case'EU':_0x34a135=_0x1d20('0x62');break;case'IN':_0x34a135=_0x1d20('0x63');break;case'CN':_0x34a135=_0x1d20('0x64');break;default:_0x34a135=_0x1d20('0x62');break;}var _0x5b4b69={'method':'POST','uri':_0x34a135+_0x1d20('0x65'),'qs':{'refresh_token':_0x4d16a3[_0x1d20('0x66')],'client_id':_0x4d16a3[_0x1d20('0x67')],'client_secret':_0x4d16a3[_0x1d20('0x68')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5b4b69)[_0x1d20('0x1d')](function(_0x472790){if(_0x472790[_0x1d20('0x69')]){_0x43211b(_0x472790[_0x1d20('0x69')]);}else{_0x141435('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x1d20('0x27')](function(_0xd13e5){_0x141435(_0xd13e5);});});}exports[_0x1d20('0x6a')]=function(_0x46d377,_0x2db9ea,_0x38e6d8){var _0x584c98,_0x4b2a25,_0x424e9f,_0x1b005b,_0x65c881;return db[_0x1d20('0x38')][_0x1d20('0x5a')]({'where':{'id':_0x46d377[_0x1d20('0x55')]['id']},'attributes':['id','host',_0x1d20('0x6b'),_0x1d20('0x67'),_0x1d20('0x68'),_0x1d20('0x6c'),_0x1d20('0x6d'),_0x1d20('0x66')]})['then'](handleEntityNotFound(_0x2db9ea,null))[_0x1d20('0x1d')](function(_0x356515){_0x65c881=_0x356515;_0x584c98=_0x65c881[_0x1d20('0x6e')];_0x4b2a25=_0x584c98===_0x1d20('0x6f')?'eu':_0x1d20('0x70');_0x424e9f=_0x65c881[_0x1d20('0x6c')];var _0x56c09b=_0x424e9f['slice'](-0x1);if(_0x56c09b==='/'||_0x56c09b==='\x5c'||_0x56c09b===':'){_0x424e9f=_0x424e9f['substring'](0x0,_0x424e9f[_0x1d20('0x71')](_0x56c09b));}if(!_0x65c881[_0x1d20('0x66')]){throw new Error(_0x1d20('0x72'));}return getAccessToken(_0x65c881);})[_0x1d20('0x1d')](function(_0x42cba8){if(_0x42cba8){return rp({'method':_0x1d20('0x73'),'uri':util['format'](_0x1d20('0x74'),_0x4b2a25),'qs':{'module':'Calls'},'headers':{'Authorization':_0x1d20('0x75')+_0x42cba8},'json':!![]});}})[_0x1d20('0x1d')](function(_0x3c32fd){if(_0x3c32fd){if(_0x3c32fd[_0x1d20('0x76')]&&_0x3c32fd[_0x1d20('0x76')][_0x1d20('0x24')]){throw new Error(_0x3c32fd[_0x1d20('0x76')][_0x1d20('0x24')][_0x1d20('0x25')]);}var _0x4406d8=[];var _0x56a741=[];var _0x1958dd=[_0x1d20('0x77'),_0x1d20('0x78'),_0x1d20('0x79'),'WhoId',_0x1d20('0x7a'),_0x1d20('0x7b'),_0x1d20('0x7c'),_0x1d20('0x7d')];_0x56a741=_['remove'](_0x3c32fd[_0x1d20('0x3f')],function(_0x3caf85){return _0x1958dd[_0x1d20('0x7e')](_0x3caf85['api_name']);});for(var _0x355864=0x0;_0x355864<_0x56a741['length'];_0x355864++){if(_0x56a741[_0x355864]['system_mandatory']===![]){_0x4406d8[_0x1d20('0x7f')]({'id':_0x56a741[_0x355864]['id'],'name':_0x56a741[_0x355864][_0x1d20('0x80')],'custom':_0x56a741[_0x355864]['custom_field'],'options':_0x56a741[_0x355864]['data_type']==='picklist'&&_0x56a741[_0x355864][_0x1d20('0x81')][_0x1d20('0x41')]>-0x1?_['map'](_0x56a741[_0x355864][_0x1d20('0x81')],function(_0x9fed9b){return{'name':_0x9fed9b,'value':_0x9fed9b};}):[]});}}return{'count':_0x4406d8[_0x1d20('0x41')],'rows':_0x4406d8};}else{return{'count':0x0,'rows':[]};}})[_0x1d20('0x1d')](respondWithResult(_0x2db9ea,null))[_0x1d20('0x27')](function(_0x5a1e21){var _0x2ef160=_0x46d377[_0x1d20('0x3c')][_0x1d20('0x19')]?0x1f4:_0x5a1e21[_0x1d20('0x82')]||0x1f4;logger[_0x1d20('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2ef160,JSON[_0x1d20('0x23')](_0x5a1e21));delete _0x5a1e21[_0x1d20('0x36')];if(_0x2ef160===0x191){_0x2ef160=0x190;}_0x2db9ea[_0x1d20('0x29')](_0x2ef160)[_0x1d20('0x83')](_0x46d377[_0x1d20('0x3c')][_0x1d20('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x5a1e21[_0x1d20('0x82')]}:_0x5a1e21);});}; \ No newline at end of file +var _0x2348=['AccountId','Subjects','channel','type','getDescriptions','ZohoField','Descriptions','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','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','code','zoho.eu','com','slice','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','WhoId','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','end','offset','limit','Content-Range','json','apply','update','destroy','sendStatus','send','index','ZohoAccount','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','count','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration'];(function(_0x34d33c,_0x59d524){var _0x4ddf14=function(_0x18b852){while(--_0x18b852){_0x34d33c['push'](_0x34d33c['shift']());}};_0x4ddf14(++_0x59d524);}(_0x2348,0xba));var _0x8234=function(_0x51fe86,_0x422b66){_0x51fe86=_0x51fe86-0x0;var _0x3557d4=_0x2348[_0x51fe86];return _0x3557d4;};'use strict';var pdf=require(_0x8234('0x0'));var emlformat=require(_0x8234('0x1'));var rimraf=require(_0x8234('0x2'));var zipdir=require(_0x8234('0x3'));var jsonpatch=require(_0x8234('0x4'));var rp=require('request-promise');var moment=require(_0x8234('0x5'));var BPromise=require(_0x8234('0x6'));var Mustache=require(_0x8234('0x7'));var util=require(_0x8234('0x8'));var path=require('path');var sox=require(_0x8234('0x9'));var csv=require(_0x8234('0xa'));var ejs=require(_0x8234('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8234('0xc'));var jsforce=require(_0x8234('0xd'));var deskjs=require(_0x8234('0xe'));var toCsv=require(_0x8234('0xa'));var querystring=require(_0x8234('0xf'));var Papa=require(_0x8234('0x10'));var Redis=require(_0x8234('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8234('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8234('0x13'))(_0x8234('0x14'));var utils=require(_0x8234('0x15'));var config=require(_0x8234('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8234('0x17'));var jayson=require(_0x8234('0x18'));var client=jayson[_0x8234('0x19')][_0x8234('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x11f65a,_0x3ca08e,_0x25db52){if(_0x25db52){var _0x4a0088=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a0088[_0x8234('0x1b')](_0x3ca08e)){return _0x11f65a;}else{throw new db[(_0x8234('0x1c'))]['ValidationError'](_0x8234('0x1d'));}}else{return _0x11f65a;}}function respondWithRpcPromise(_0x271cdd,_0x379bf5,_0x126e4e,_0x5303dd){return new BPromise(function(_0x78ec7a,_0x35c589){var _0x2f8e37=_0x5303dd||client;return _0x2f8e37['request'](_0x271cdd,_0x126e4e)[_0x8234('0x1e')](function(_0x44c33c){logger['info'](_0x8234('0x1f'),_0x379bf5,'request\x20sent');logger[_0x8234('0x20')](_0x8234('0x21'),_0x379bf5,_0x8234('0x22'),JSON['stringify'](_0x44c33c));if(_0x44c33c[_0x8234('0x23')]){if(_0x44c33c['error']['code']===0x1f4){logger['error'](_0x8234('0x1f'),_0x379bf5,_0x44c33c['error'][_0x8234('0x24')]);return _0x35c589(_0x44c33c[_0x8234('0x23')][_0x8234('0x24')]);}logger[_0x8234('0x23')](_0x8234('0x1f'),_0x379bf5,_0x44c33c[_0x8234('0x23')][_0x8234('0x24')]);return _0x78ec7a(_0x44c33c[_0x8234('0x23')][_0x8234('0x24')]);}else{logger[_0x8234('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x379bf5,'request\x20sent');_0x78ec7a(_0x44c33c[_0x8234('0x26')][_0x8234('0x24')]);}})[_0x8234('0x27')](function(_0x19f72a){logger[_0x8234('0x23')](_0x8234('0x1f'),_0x379bf5,_0x19f72a);_0x35c589(_0x19f72a);});});}function respondWithStatusCode(_0x277d36,_0x13b3c6){_0x13b3c6=_0x13b3c6||0xcc;return function(_0x4179d4){if(_0x4179d4){return _0x277d36['sendStatus'](_0x13b3c6);}return _0x277d36[_0x8234('0x28')](_0x13b3c6)[_0x8234('0x29')]();};}function respondWithResult(_0x11abd7,_0x281b67){_0x281b67=_0x281b67||0xc8;return function(_0x1f9c50){if(_0x1f9c50){return _0x11abd7['status'](_0x281b67)['json'](_0x1f9c50);}};}function respondWithFilteredResult(_0x4a20d3,_0x378ef0){return function(_0x25febd){if(_0x25febd){var _0x59aef5=_0x25febd['count'],_0x14b59b=_0x378ef0[_0x8234('0x2a')],_0x32ba6a=_0x378ef0[_0x8234('0x2a')]+_0x378ef0[_0x8234('0x2b')],_0x429873;if(_0x32ba6a>=_0x59aef5){_0x32ba6a=_0x59aef5;_0x429873=0xc8;}else{_0x429873=0xce;}_0x4a20d3[_0x8234('0x28')](_0x429873);return _0x4a20d3['set'](_0x8234('0x2c'),_0x14b59b+'-'+_0x32ba6a+'/'+_0x59aef5)[_0x8234('0x2d')](_0x25febd);}return null;};}function patchUpdates(_0x2660d7){return function(_0x1e64b6){try{jsonpatch[_0x8234('0x2e')](_0x1e64b6,_0x2660d7,!![]);}catch(_0x50a81b){return BPromise['reject'](_0x50a81b);}return _0x1e64b6['save']();};}function saveUpdates(_0xd356f7,_0x5466c2){return function(_0x285066){if(_0x285066){return _0x285066[_0x8234('0x2f')](_0xd356f7)[_0x8234('0x1e')](function(_0x7f459f){return _0x7f459f;});}return null;};}function removeEntity(_0x137c03,_0x4173f1){return function(_0x4504ce){if(_0x4504ce){return _0x4504ce[_0x8234('0x30')]()[_0x8234('0x1e')](function(){_0x137c03[_0x8234('0x28')](0xcc)[_0x8234('0x29')]();});}};}function handleEntityNotFound(_0x4e40ed,_0xf16c55){return function(_0x160e6e){if(!_0x160e6e){_0x4e40ed[_0x8234('0x31')](0x194);}return _0x160e6e;};}function handleError(_0x57da5a,_0x401b0f){_0x401b0f=_0x401b0f||0x1f4;return function(_0x4dfc58){logger[_0x8234('0x23')](_0x4dfc58['stack']);if(_0x4dfc58['name']){delete _0x4dfc58['name'];}_0x57da5a['status'](_0x401b0f)[_0x8234('0x32')](_0x4dfc58);};}exports[_0x8234('0x33')]=function(_0x1b7532,_0xc396c4){var _0x48b418={},_0x1653a3={},_0x20640d={'count':0x0,'rows':[]};var _0x1fe518=db[_0x8234('0x34')][_0x8234('0x35')];_0x1653a3['model']=_[_0x8234('0x36')](_0x1fe518);_0x1653a3[_0x8234('0x37')]=_[_0x8234('0x36')](_0x1b7532['query']);_0x1653a3[_0x8234('0x38')]=_[_0x8234('0x39')](_0x1653a3[_0x8234('0x3a')],_0x1653a3[_0x8234('0x37')]);_0x48b418['attributes']=_[_0x8234('0x39')](_0x1653a3[_0x8234('0x3a')],qs[_0x8234('0x3b')](_0x1b7532[_0x8234('0x37')][_0x8234('0x3b')]));_0x48b418[_0x8234('0x3c')]=_0x48b418['attributes'][_0x8234('0x3d')]?_0x48b418[_0x8234('0x3c')]:_0x1653a3['model'];if(!_0x1b7532[_0x8234('0x37')][_0x8234('0x3e')](_0x8234('0x3f'))){_0x48b418['limit']=qs[_0x8234('0x2b')](_0x1b7532['query'][_0x8234('0x2b')]);_0x48b418[_0x8234('0x2a')]=qs['offset'](_0x1b7532[_0x8234('0x37')][_0x8234('0x2a')]);}_0x48b418[_0x8234('0x40')]=qs[_0x8234('0x41')](_0x1b7532['query'][_0x8234('0x41')]);_0x48b418[_0x8234('0x42')]=qs[_0x8234('0x38')](_[_0x8234('0x43')](_0x1b7532['query'],_0x1653a3[_0x8234('0x38')]));if(_0x1b7532[_0x8234('0x37')][_0x8234('0x44')]){_0x48b418[_0x8234('0x42')]=_[_0x8234('0x45')](_0x48b418[_0x8234('0x42')],{'$or':_[_0x8234('0x46')](_0x1fe518,function(_0x27cc26){if(_0x27cc26['type'][_0x8234('0x47')]!==_0x8234('0x48')){var _0x4a84fb={};_0x4a84fb[_0x27cc26[_0x8234('0x49')]]={'$like':'%'+_0x1b7532[_0x8234('0x37')][_0x8234('0x44')]+'%'};return _0x4a84fb;}})});}_0x48b418=_[_0x8234('0x45')]({},_0x48b418,_0x1b7532[_0x8234('0x4a')]);var _0x308582={'where':_0x48b418[_0x8234('0x42')]};return db[_0x8234('0x34')]['count'](_0x308582)[_0x8234('0x1e')](function(_0x408046){_0x20640d[_0x8234('0x4b')]=_0x408046;if(_0x1b7532[_0x8234('0x37')]['includeAll']){_0x48b418['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x8234('0x4c')](_0x48b418);})[_0x8234('0x1e')](function(_0x1451fa){_0x20640d[_0x8234('0x4d')]=_0x1451fa;return _0x20640d;})['then'](respondWithFilteredResult(_0xc396c4,_0x48b418))[_0x8234('0x27')](handleError(_0xc396c4,null));};exports[_0x8234('0x4e')]=function(_0x24dbf8,_0x538bff){var _0x1af890={'raw':![],'where':{'id':_0x24dbf8[_0x8234('0x4f')]['id']}},_0x54b596={};_0x54b596[_0x8234('0x3a')]=_[_0x8234('0x36')](db['ZohoAccount'][_0x8234('0x35')]);_0x54b596[_0x8234('0x37')]=_['keys'](_0x24dbf8[_0x8234('0x37')]);_0x54b596['filters']=_[_0x8234('0x39')](_0x54b596[_0x8234('0x3a')],_0x54b596['query']);_0x1af890[_0x8234('0x3c')]=_[_0x8234('0x39')](_0x54b596[_0x8234('0x3a')],qs['fields'](_0x24dbf8[_0x8234('0x37')]['fields']));_0x1af890[_0x8234('0x3c')]=_0x1af890[_0x8234('0x3c')]['length']?_0x1af890[_0x8234('0x3c')]:_0x54b596[_0x8234('0x3a')];if(_0x24dbf8['query'][_0x8234('0x50')]){_0x1af890['include']=[{'all':!![]}];}_0x1af890=_['merge']({},_0x1af890,_0x24dbf8['options']);return db[_0x8234('0x34')][_0x8234('0x51')](_0x1af890)[_0x8234('0x1e')](handleEntityNotFound(_0x538bff,null))[_0x8234('0x1e')](respondWithResult(_0x538bff,null))[_0x8234('0x27')](handleError(_0x538bff,null));};exports[_0x8234('0x52')]=function(_0x2d5915,_0x535e2a){return db[_0x8234('0x34')][_0x8234('0x52')](_0x2d5915[_0x8234('0x53')],{})[_0x8234('0x1e')](respondWithResult(_0x535e2a,0xc9))[_0x8234('0x27')](handleError(_0x535e2a,null));};exports['update']=function(_0x364ecb,_0x28a18a){if(_0x364ecb[_0x8234('0x53')]['id']){delete _0x364ecb[_0x8234('0x53')]['id'];}return db[_0x8234('0x34')][_0x8234('0x51')]({'where':{'id':_0x364ecb[_0x8234('0x4f')]['id']}})[_0x8234('0x1e')](handleEntityNotFound(_0x28a18a,null))[_0x8234('0x1e')](saveUpdates(_0x364ecb[_0x8234('0x53')],null))[_0x8234('0x1e')](respondWithResult(_0x28a18a,null))[_0x8234('0x27')](handleError(_0x28a18a,null));};exports[_0x8234('0x30')]=function(_0x548af6,_0x4aff78){return db['ZohoAccount']['find']({'where':{'id':_0x548af6[_0x8234('0x4f')]['id']}})[_0x8234('0x1e')](handleEntityNotFound(_0x4aff78,null))[_0x8234('0x1e')](removeEntity(_0x4aff78,null))[_0x8234('0x27')](handleError(_0x4aff78,null));};exports[_0x8234('0x54')]=function(_0x6f7b0,_0x285ad9,_0x250839){var _0x5797f0={};var _0x46b740={};var _0x47d05b;var _0x1edbd8;return db['ZohoAccount'][_0x8234('0x55')]({'where':{'id':_0x6f7b0['params']['id']}})['then'](handleEntityNotFound(_0x285ad9,null))[_0x8234('0x1e')](function(_0x464779){if(_0x464779){_0x47d05b=_0x464779;_0x46b740[_0x8234('0x3a')]=_[_0x8234('0x36')](db[_0x8234('0x56')][_0x8234('0x35')]);_0x46b740[_0x8234('0x37')]=_[_0x8234('0x36')](_0x6f7b0['query']);_0x46b740[_0x8234('0x38')]=_[_0x8234('0x39')](_0x46b740[_0x8234('0x3a')],_0x46b740[_0x8234('0x37')]);_0x5797f0[_0x8234('0x3c')]=_['intersection'](_0x46b740[_0x8234('0x3a')],qs[_0x8234('0x3b')](_0x6f7b0['query'][_0x8234('0x3b')]));_0x5797f0[_0x8234('0x3c')]=_0x5797f0[_0x8234('0x3c')][_0x8234('0x3d')]?_0x5797f0['attributes']:_0x46b740[_0x8234('0x3a')];_0x5797f0[_0x8234('0x40')]=qs['sort'](_0x6f7b0[_0x8234('0x37')]['sort']);_0x5797f0[_0x8234('0x42')]=qs[_0x8234('0x38')](_[_0x8234('0x43')](_0x6f7b0[_0x8234('0x37')],_0x46b740['filters']));if(_0x6f7b0[_0x8234('0x37')][_0x8234('0x44')]){_0x5797f0[_0x8234('0x42')]=_['merge'](_0x5797f0[_0x8234('0x42')],{'$or':_[_0x8234('0x46')](_0x5797f0['attributes'],function(_0x1edf47){var _0x2e06f0={};_0x2e06f0[_0x1edf47]={'$like':'%'+_0x6f7b0[_0x8234('0x37')]['filter']+'%'};return _0x2e06f0;})});}_0x5797f0=_[_0x8234('0x45')]({},_0x5797f0,_0x6f7b0[_0x8234('0x4a')]);return _0x47d05b[_0x8234('0x54')](_0x5797f0);}})['then'](function(_0x56cd5d){if(_0x56cd5d){_0x1edbd8=_0x56cd5d[_0x8234('0x3d')];if(!_0x6f7b0[_0x8234('0x37')][_0x8234('0x3e')](_0x8234('0x3f'))){_0x5797f0[_0x8234('0x2b')]=qs[_0x8234('0x2b')](_0x6f7b0['query']['limit']);_0x5797f0[_0x8234('0x2a')]=qs[_0x8234('0x2a')](_0x6f7b0[_0x8234('0x37')][_0x8234('0x2a')]);}return _0x47d05b[_0x8234('0x54')](_0x5797f0);}})[_0x8234('0x1e')](function(_0x4523e6){if(_0x4523e6){return _0x4523e6?{'count':_0x1edbd8,'rows':_0x4523e6}:null;}})[_0x8234('0x1e')](respondWithResult(_0x285ad9,null))[_0x8234('0x27')](handleError(_0x285ad9,null));};exports[_0x8234('0x57')]=function(_0x38dd5f,_0x3c54a4,_0x343e65){if(_0x38dd5f[_0x8234('0x53')]['id']){delete _0x38dd5f[_0x8234('0x53')]['id'];}return db[_0x8234('0x34')]['findOne']({'where':{'id':_0x38dd5f[_0x8234('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3c54a4,null))[_0x8234('0x1e')](function(_0xabe420){if(_0xabe420){_0x38dd5f[_0x8234('0x53')][_0x8234('0x58')]=_0xabe420['id'];_0x38dd5f[_0x8234('0x53')][_0x8234('0x59')]=integrations['getSubjects'](_0x38dd5f[_0x8234('0x53')][_0x8234('0x5a')],_0x38dd5f[_0x8234('0x53')][_0x8234('0x5b')]);_0x38dd5f[_0x8234('0x53')]['Descriptions']=integrations[_0x8234('0x5c')](_0x38dd5f[_0x8234('0x53')][_0x8234('0x5a')],_0x38dd5f[_0x8234('0x53')]['type']);return db[_0x8234('0x56')][_0x8234('0x52')](_0x38dd5f[_0x8234('0x53')],{'include':[{'model':db[_0x8234('0x5d')],'as':_0x8234('0x59')},{'model':db[_0x8234('0x5d')],'as':_0x8234('0x5e')}]});}return null;})[_0x8234('0x1e')](respondWithResult(_0x3c54a4,null))[_0x8234('0x27')](handleError(_0x3c54a4,null));};function getAccessToken(_0x1c1b47){return new Promise(function(_0x1dfc77,_0x5c89d3){var _0x26fca5;switch(_0x1c1b47[_0x8234('0x5f')]){case'US':_0x26fca5=_0x8234('0x60');break;case'AU':_0x26fca5=_0x8234('0x61');break;case'EU':_0x26fca5=_0x8234('0x62');break;case'IN':_0x26fca5=_0x8234('0x63');break;case'CN':_0x26fca5=_0x8234('0x64');break;default:_0x26fca5=_0x8234('0x62');break;}var _0x5ffb56={'method':_0x8234('0x65'),'uri':_0x26fca5+_0x8234('0x66'),'qs':{'refresh_token':_0x1c1b47[_0x8234('0x67')],'client_id':_0x1c1b47['clientId'],'client_secret':_0x1c1b47[_0x8234('0x68')],'grant_type':_0x8234('0x69')},'json':!![]};return rp(_0x5ffb56)[_0x8234('0x1e')](function(_0x448bdb){if(_0x448bdb['access_token']){_0x1dfc77(_0x448bdb[_0x8234('0x6a')]);}else{_0x5c89d3(_0x8234('0x6b'));}})[_0x8234('0x27')](function(_0x40f303){_0x5c89d3(_0x40f303);});});}exports[_0x8234('0x6c')]=function(_0x4f7065,_0x23c666,_0x1a5b41){var _0x69c96d,_0x3d4df3,_0x5c956b,_0x3c646c,_0x2520bf;return db['ZohoAccount'][_0x8234('0x55')]({'where':{'id':_0x4f7065[_0x8234('0x4f')]['id']},'attributes':['id',_0x8234('0x6d'),'zone',_0x8234('0x6e'),_0x8234('0x68'),_0x8234('0x6f'),_0x8234('0x70'),_0x8234('0x67')]})[_0x8234('0x1e')](handleEntityNotFound(_0x23c666,null))['then'](function(_0x45718d){_0x2520bf=_0x45718d;_0x69c96d=_0x2520bf[_0x8234('0x6d')];_0x3d4df3=_0x69c96d===_0x8234('0x71')?'eu':_0x8234('0x72');_0x5c956b=_0x2520bf[_0x8234('0x6f')];var _0x2abb01=_0x5c956b[_0x8234('0x73')](-0x1);if(_0x2abb01==='/'||_0x2abb01==='\x5c'||_0x2abb01===':'){_0x5c956b=_0x5c956b['substring'](0x0,_0x5c956b['lastIndexOf'](_0x2abb01));}if(!_0x2520bf['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2520bf);})[_0x8234('0x1e')](function(_0x2681a7){if(_0x2681a7){return rp({'method':_0x8234('0x74'),'uri':util[_0x8234('0x75')](_0x8234('0x76'),_0x3d4df3),'qs':{'module':_0x8234('0x77')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2681a7},'json':!![]});}})['then'](function(_0x43d53c){if(_0x43d53c){if(_0x43d53c['response']&&_0x43d53c[_0x8234('0x78')][_0x8234('0x23')]){throw new Error(_0x43d53c['response']['error'][_0x8234('0x24')]);}var _0x585e97=[];var _0x538f7e=[];var _0x448cad=[_0x8234('0x79'),_0x8234('0x7a'),'Description',_0x8234('0x7b'),'Call_Duration','Call_Result',_0x8234('0x7c'),_0x8234('0x7d')];_0x538f7e=_[_0x8234('0x7e')](_0x43d53c[_0x8234('0x3b')],function(_0x10fe83){return _0x448cad[_0x8234('0x7f')](_0x10fe83['api_name']);});for(var _0x59b645=0x0;_0x59b645<_0x538f7e[_0x8234('0x3d')];_0x59b645++){if(_0x538f7e[_0x59b645][_0x8234('0x80')]===![]){_0x585e97[_0x8234('0x81')]({'id':_0x538f7e[_0x59b645]['id'],'name':_0x538f7e[_0x59b645][_0x8234('0x82')],'custom':_0x538f7e[_0x59b645][_0x8234('0x83')],'options':_0x538f7e[_0x59b645]['data_type']===_0x8234('0x84')&&_0x538f7e[_0x59b645][_0x8234('0x85')][_0x8234('0x3d')]>-0x1?_[_0x8234('0x46')](_0x538f7e[_0x59b645][_0x8234('0x85')],function(_0x421f25){return{'name':_0x421f25,'value':_0x421f25};}):[]});}}return{'count':_0x585e97[_0x8234('0x3d')],'rows':_0x585e97};}else{return{'count':0x0,'rows':[]};}})[_0x8234('0x1e')](respondWithResult(_0x23c666,null))[_0x8234('0x27')](function(_0x5ef950){var _0x1e3cd2=_0x4f7065[_0x8234('0x37')][_0x8234('0x1b')]?0x1f4:_0x5ef950['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8234('0x6c'),_0x1e3cd2,JSON[_0x8234('0x86')](_0x5ef950));delete _0x5ef950['name'];if(_0x1e3cd2===0x191){_0x1e3cd2=0x190;}_0x23c666[_0x8234('0x28')](_0x1e3cd2)[_0x8234('0x32')](_0x4f7065[_0x8234('0x37')][_0x8234('0x1b')]?{'message':_0x8234('0x87'),'statusCode':_0x5ef950[_0x8234('0x88')]}:_0x5ef950);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0b8cd4c..b007264 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 _0xba9a=['https://accounts.zoho.com.au','catch','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','clientId','code','host','slice','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','zone','serverUrl','https://accounts.zoho.com'];(function(_0x4a63e3,_0x15eb31){var _0x90af6f=function(_0x4ef585){while(--_0x4ef585){_0x4a63e3['push'](_0x4a63e3['shift']());}};_0x90af6f(++_0x15eb31);}(_0xba9a,0xa2));var _0xaba9=function(_0x56056b,_0x555858){_0x56056b=_0x56056b-0x0;var _0xb4f44c=_0xba9a[_0x56056b];return _0xb4f44c;};'use strict';var _=require(_0xaba9('0x0'));var util=require('util');var logger=require(_0xaba9('0x1'))(_0xaba9('0x2'));var moment=require(_0xaba9('0x3'));var BPromise=require(_0xaba9('0x4'));var rp=require(_0xaba9('0x5'));var fs=require('fs');var path=require(_0xaba9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaba9('0x7'));var integrations=require(_0xaba9('0x8'));module[_0xaba9('0x9')]=function(_0x725963,_0x2d66b4){return _0x725963['define'](_0xaba9('0xa'),attributes,{'tableName':_0xaba9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b8d66,_0x7b0008,_0x535f9f){if(_0x3b8d66['changed']('zone')||_0x3b8d66[_0xaba9('0xc')]('serverUrl')||_0x3b8d66[_0xaba9('0xc')](_0xaba9('0xd'))||_0x3b8d66[_0xaba9('0xc')]('clientSecret')||_0x3b8d66[_0xaba9('0xc')](_0xaba9('0xe'))||_0x3b8d66['changed'](_0xaba9('0xf'))){var _0x290d96,_0x2a70b4;_0x290d96=_0x3b8d66['serverUrl'];var _0x2a8133=_0x290d96[_0xaba9('0x10')](-0x1);if(_0x2a8133==='/'||_0x2a8133==='\x5c'||_0x2a8133===':'){_0x290d96=_0x290d96[_0xaba9('0x11')](0x0,_0x290d96[_0xaba9('0x12')](_0x2a8133));}switch(_0x3b8d66['zone']){case'US':_0x2a70b4='https://accounts.zoho.com';break;case'AU':_0x2a70b4='https://accounts.zoho.com.au';break;case'IN':_0x2a70b4=_0xaba9('0x13');break;case'CN':_0x2a70b4=_0xaba9('0x14');break;default:_0x2a70b4='https://accounts.zoho.eu';break;}var _0x2118d7={'method':_0xaba9('0x15'),'uri':_0x2a70b4+_0xaba9('0x16'),'form':{'grant_type':_0xaba9('0x17'),'client_id':_0x3b8d66['clientId'],'client_secret':_0x3b8d66[_0xaba9('0x18')],'redirect_uri':_0x3b8d66['serverUrl'],'code':_0x3b8d66['code']},'headers':{'Content-Type':_0xaba9('0x19')}};return rp(_0x2118d7)[_0xaba9('0x1a')](function(_0x4502ec){var _0x4caf91=JSON[_0xaba9('0x1b')](_0x4502ec);if(_0x4caf91[_0xaba9('0x1c')]){_0x3b8d66['refreshToken']=_0x4caf91['refresh_token'];logger[_0xaba9('0x1d')](util[_0xaba9('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3b8d66[_0xaba9('0x1f')],_0x3b8d66['id']));}else{logger[_0xaba9('0x20')](util[_0xaba9('0x1e')](_0xaba9('0x21'),_0x3b8d66['name'],_0x3b8d66['id']),util[_0xaba9('0x22')](_0x4caf91,{'showHidden':![],'depth':null}));}return _0x535f9f(null,_0x7b0008);})['catch'](function(_0x2b95fa){logger[_0xaba9('0x20')](util[_0xaba9('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3b8d66[_0xaba9('0x1f')],_0x3b8d66['id']),util[_0xaba9('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x535f9f(_0x2b95fa);});}else{return _0x535f9f(null,_0x7b0008);}},'beforeUpdate':function(_0xb2f482,_0x173122,_0x28e887){if(_0xb2f482[_0xaba9('0xc')](_0xaba9('0x23'))||_0xb2f482[_0xaba9('0xc')]('serverUrl')||_0xb2f482[_0xaba9('0xc')]('clientId')||_0xb2f482['changed'](_0xaba9('0x18'))||_0xb2f482[_0xaba9('0xc')](_0xaba9('0xe'))||_0xb2f482[_0xaba9('0xc')](_0xaba9('0xf'))){var _0x317da6,_0x25ad30;_0x317da6=_0xb2f482[_0xaba9('0x24')];var _0x288327=_0x317da6[_0xaba9('0x10')](-0x1);if(_0x288327==='/'||_0x288327==='\x5c'||_0x288327===':'){_0x317da6=_0x317da6[_0xaba9('0x11')](0x0,_0x317da6[_0xaba9('0x12')](_0x288327));}switch(_0xb2f482[_0xaba9('0x23')]){case'US':_0x25ad30=_0xaba9('0x25');break;case'AU':_0x25ad30=_0xaba9('0x26');break;case'IN':_0x25ad30=_0xaba9('0x13');break;case'CN':_0x25ad30=_0xaba9('0x14');break;default:_0x25ad30='https://accounts.zoho.eu';break;}var _0x1d19f2={'method':_0xaba9('0x15'),'uri':_0x25ad30+'/oauth/v2/token','form':{'grant_type':_0xaba9('0x17'),'client_id':_0xb2f482[_0xaba9('0xd')],'client_secret':_0xb2f482[_0xaba9('0x18')],'redirect_uri':_0xb2f482[_0xaba9('0x24')],'code':_0xb2f482[_0xaba9('0xe')]},'headers':{'Content-Type':_0xaba9('0x19')}};return rp(_0x1d19f2)[_0xaba9('0x1a')](function(_0x34a7d5){var _0x4c9d7f=JSON[_0xaba9('0x1b')](_0x34a7d5);if(_0x4c9d7f[_0xaba9('0x1c')]){_0xb2f482['refreshToken']=_0x4c9d7f['refresh_token'];logger[_0xaba9('0x1d')](util[_0xaba9('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xb2f482[_0xaba9('0x1f')],_0xb2f482['id']));}else{logger[_0xaba9('0x20')](util[_0xaba9('0x1e')](_0xaba9('0x21'),_0xb2f482[_0xaba9('0x1f')],_0xb2f482['id']),util[_0xaba9('0x22')](_0x4c9d7f,{'showHidden':![],'depth':null}));}return _0x28e887(null,_0x173122);})[_0xaba9('0x27')](function(_0x312be0){logger['error'](util[_0xaba9('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xb2f482['name'],_0xb2f482['id']),util[_0xaba9('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x28e887(_0x312be0);});}else{return _0x28e887(null,_0x173122);}}}});}; \ No newline at end of file +var _0x77c9=['path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','serverUrl','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','parse','error','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5b4a94,_0x39e9ae){var _0x97d164=function(_0x490f24){while(--_0x490f24){_0x5b4a94['push'](_0x5b4a94['shift']());}};_0x97d164(++_0x39e9ae);}(_0x77c9,0x1c6));var _0x977c=function(_0x1d8679,_0x32a98f){_0x1d8679=_0x1d8679-0x0;var _0x427125=_0x77c9[_0x1d8679];return _0x427125;};'use strict';var _=require(_0x977c('0x0'));var util=require(_0x977c('0x1'));var logger=require(_0x977c('0x2'))('api');var moment=require(_0x977c('0x3'));var BPromise=require(_0x977c('0x4'));var rp=require(_0x977c('0x5'));var fs=require('fs');var path=require(_0x977c('0x6'));var rimraf=require(_0x977c('0x7'));var config=require(_0x977c('0x8'));var attributes=require(_0x977c('0x9'));var integrations=require(_0x977c('0xa'));module[_0x977c('0xb')]=function(_0x4218a2,_0x16ec1f){return _0x4218a2[_0x977c('0xc')](_0x977c('0xd'),attributes,{'tableName':_0x977c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a3c1e,_0x26f765,_0x35a85d){if(_0x1a3c1e[_0x977c('0xf')](_0x977c('0x10'))||_0x1a3c1e['changed']('serverUrl')||_0x1a3c1e[_0x977c('0xf')](_0x977c('0x11'))||_0x1a3c1e[_0x977c('0xf')](_0x977c('0x12'))||_0x1a3c1e[_0x977c('0xf')](_0x977c('0x13'))||_0x1a3c1e[_0x977c('0xf')](_0x977c('0x14'))){var _0x59a79a,_0x756b29;_0x59a79a=_0x1a3c1e['serverUrl'];var _0x115088=_0x59a79a['slice'](-0x1);if(_0x115088==='/'||_0x115088==='\x5c'||_0x115088===':'){_0x59a79a=_0x59a79a[_0x977c('0x15')](0x0,_0x59a79a[_0x977c('0x16')](_0x115088));}switch(_0x1a3c1e[_0x977c('0x10')]){case'US':_0x756b29='https://accounts.zoho.com';break;case'AU':_0x756b29='https://accounts.zoho.com.au';break;case'IN':_0x756b29=_0x977c('0x17');break;case'CN':_0x756b29='https://accounts.zoho.com.cn';break;default:_0x756b29=_0x977c('0x18');break;}var _0x464521={'method':_0x977c('0x19'),'uri':_0x756b29+_0x977c('0x1a'),'form':{'grant_type':_0x977c('0x1b'),'client_id':_0x1a3c1e[_0x977c('0x11')],'client_secret':_0x1a3c1e[_0x977c('0x12')],'redirect_uri':_0x1a3c1e[_0x977c('0x1c')],'code':_0x1a3c1e[_0x977c('0x13')]},'headers':{'Content-Type':_0x977c('0x1d')}};return rp(_0x464521)[_0x977c('0x1e')](function(_0x22dbe7){var _0x36f2e4=JSON['parse'](_0x22dbe7);if(_0x36f2e4[_0x977c('0x1f')]){_0x1a3c1e[_0x977c('0x20')]=_0x36f2e4[_0x977c('0x1f')];logger[_0x977c('0x21')](util['format'](_0x977c('0x22'),_0x1a3c1e[_0x977c('0x23')],_0x1a3c1e['id']));}else{logger['error'](util[_0x977c('0x24')](_0x977c('0x25'),_0x1a3c1e['name'],_0x1a3c1e['id']),util[_0x977c('0x26')](_0x36f2e4,{'showHidden':![],'depth':null}));}return _0x35a85d(null,_0x26f765);})[_0x977c('0x27')](function(_0x4f5cde){logger['error'](util[_0x977c('0x24')](_0x977c('0x25'),_0x1a3c1e['name'],_0x1a3c1e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x35a85d(_0x4f5cde);});}else{return _0x35a85d(null,_0x26f765);}},'beforeUpdate':function(_0x44416a,_0x27b3c7,_0x5f5b81){if(_0x44416a[_0x977c('0xf')](_0x977c('0x10'))||_0x44416a[_0x977c('0xf')](_0x977c('0x1c'))||_0x44416a['changed']('clientId')||_0x44416a[_0x977c('0xf')](_0x977c('0x12'))||_0x44416a[_0x977c('0xf')](_0x977c('0x13'))||_0x44416a[_0x977c('0xf')](_0x977c('0x14'))){var _0x47d963,_0x4620e4;_0x47d963=_0x44416a[_0x977c('0x1c')];var _0x275c21=_0x47d963[_0x977c('0x28')](-0x1);if(_0x275c21==='/'||_0x275c21==='\x5c'||_0x275c21===':'){_0x47d963=_0x47d963[_0x977c('0x15')](0x0,_0x47d963['lastIndexOf'](_0x275c21));}switch(_0x44416a['zone']){case'US':_0x4620e4=_0x977c('0x29');break;case'AU':_0x4620e4=_0x977c('0x2a');break;case'IN':_0x4620e4=_0x977c('0x17');break;case'CN':_0x4620e4=_0x977c('0x2b');break;default:_0x4620e4='https://accounts.zoho.eu';break;}var _0x509cd2={'method':_0x977c('0x19'),'uri':_0x4620e4+_0x977c('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x44416a['clientId'],'client_secret':_0x44416a[_0x977c('0x12')],'redirect_uri':_0x44416a[_0x977c('0x1c')],'code':_0x44416a['code']},'headers':{'Content-Type':_0x977c('0x1d')}};return rp(_0x509cd2)['then'](function(_0x2a9d66){var _0x3e46f4=JSON[_0x977c('0x2c')](_0x2a9d66);if(_0x3e46f4[_0x977c('0x1f')]){_0x44416a[_0x977c('0x20')]=_0x3e46f4[_0x977c('0x1f')];logger[_0x977c('0x21')](util[_0x977c('0x24')](_0x977c('0x22'),_0x44416a[_0x977c('0x23')],_0x44416a['id']));}else{logger[_0x977c('0x2d')](util['format'](_0x977c('0x25'),_0x44416a[_0x977c('0x23')],_0x44416a['id']),util['inspect'](_0x3e46f4,{'showHidden':![],'depth':null}));}return _0x5f5b81(null,_0x27b3c7);})['catch'](function(_0xf727fa){logger[_0x977c('0x2d')](util[_0x977c('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x44416a[_0x977c('0x23')],_0x44416a['id']),util[_0x977c('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x5f5b81(_0xf727fa);});}else{return _0x5f5b81(null,_0x27b3c7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 6301a83..f7386a1 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 _0x7985=['attributes','map','model','include','GetZohoAccount','ShowZohoAccount','find','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ZohoAccount','options','raw','where'];(function(_0x54ad74,_0x1a1fee){var _0x267888=function(_0x2c3fc6){while(--_0x2c3fc6){_0x54ad74['push'](_0x54ad74['shift']());}};_0x267888(++_0x1a1fee);}(_0x7985,0x128));var _0x5798=function(_0x2d604d,_0x51a1f5){_0x2d604d=_0x2d604d-0x0;var _0x159761=_0x7985[_0x2d604d];return _0x159761;};'use strict';var _=require(_0x5798('0x0'));var util=require(_0x5798('0x1'));var moment=require(_0x5798('0x2'));var BPromise=require(_0x5798('0x3'));var rs=require(_0x5798('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5798('0x5'))['db'];var utils=require(_0x5798('0x6'));var logger=require('../../config/logger')(_0x5798('0x7'));var config=require(_0x5798('0x8'));var jayson=require(_0x5798('0x9'));var client=jayson[_0x5798('0xa')][_0x5798('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfdfac1,_0x1b2e9c,_0x369715){return new BPromise(function(_0x3476af,_0x5bbee7){return client[_0x5798('0xc')](_0xfdfac1,_0x369715)[_0x5798('0xd')](function(_0x24f7c9){logger[_0x5798('0xe')](_0x5798('0xf'),_0x1b2e9c,_0x5798('0x10'));logger[_0x5798('0x11')](_0x5798('0x12'),_0x1b2e9c,_0x5798('0x10'),JSON['stringify'](_0x24f7c9));if(_0x24f7c9[_0x5798('0x13')]){if(_0x24f7c9[_0x5798('0x13')][_0x5798('0x14')]===0x1f4){logger[_0x5798('0x13')](_0x5798('0xf'),_0x1b2e9c,_0x24f7c9[_0x5798('0x13')][_0x5798('0x15')]);return _0x5bbee7(_0x24f7c9[_0x5798('0x13')][_0x5798('0x15')]);}logger[_0x5798('0x13')](_0x5798('0xf'),_0x1b2e9c,_0x24f7c9[_0x5798('0x13')][_0x5798('0x15')]);return _0x3476af(_0x24f7c9['error'][_0x5798('0x15')]);}else{logger[_0x5798('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1b2e9c,_0x5798('0x10'));_0x3476af(_0x24f7c9[_0x5798('0x16')][_0x5798('0x15')]);}})[_0x5798('0x17')](function(_0xb1d7ec){logger[_0x5798('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x1b2e9c,_0xb1d7ec);_0x5bbee7(_0xb1d7ec);});});}exports['GetZohoAccount']=function(_0x1c71fa){var _0x569320=this;return new Promise(function(_0x315b8a,_0x23630b){return db[_0x5798('0x18')]['findAll']({'raw':_0x1c71fa[_0x5798('0x19')]?_0x1c71fa[_0x5798('0x19')][_0x5798('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c71fa[_0x5798('0x19')]?_0x1c71fa[_0x5798('0x19')][_0x5798('0x1b')]||null:null,'attributes':_0x1c71fa[_0x5798('0x19')]?_0x1c71fa[_0x5798('0x19')][_0x5798('0x1c')]||null:null,'limit':_0x1c71fa[_0x5798('0x19')]?_0x1c71fa[_0x5798('0x19')]['limit']||null:null,'include':_0x1c71fa[_0x5798('0x19')]?_0x1c71fa[_0x5798('0x19')]['include']?_[_0x5798('0x1d')](_0x1c71fa[_0x5798('0x19')]['include'],function(_0x57737a){return{'model':db[_0x57737a[_0x5798('0x1e')]],'as':_0x57737a['as'],'attributes':_0x57737a[_0x5798('0x1c')],'include':_0x57737a[_0x5798('0x1f')]?_[_0x5798('0x1d')](_0x57737a['include'],function(_0x53ada8){return{'model':db[_0x53ada8[_0x5798('0x1e')]],'as':_0x53ada8['as'],'attributes':_0x53ada8[_0x5798('0x1c')],'include':_0x53ada8['include']?_[_0x5798('0x1d')](_0x53ada8['include'],function(_0x36f0d4){return{'model':db[_0x36f0d4[_0x5798('0x1e')]],'as':_0x36f0d4['as'],'attributes':_0x36f0d4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x124590){logger[_0x5798('0xe')](_0x5798('0x20'),_0x1c71fa);logger['debug']('GetZohoAccount',_0x1c71fa,JSON['stringify'](_0x124590));_0x315b8a(_0x124590);})[_0x5798('0x17')](function(_0x1069b3){logger['error'](_0x5798('0x20'),_0x1069b3[_0x5798('0x15')],_0x1c71fa);_0x23630b(_0x569320['error'](0x1f4,_0x1069b3[_0x5798('0x15')]));});});};exports[_0x5798('0x21')]=function(_0x552c34){var _0x45159f=this;return new Promise(function(_0x4a073a,_0x30d671){return db[_0x5798('0x18')][_0x5798('0x22')]({'raw':_0x552c34['options']?_0x552c34[_0x5798('0x19')][_0x5798('0x1a')]===undefined?!![]:![]:!![],'where':_0x552c34[_0x5798('0x19')]?_0x552c34[_0x5798('0x19')]['where']||null:null,'attributes':_0x552c34['options']?_0x552c34[_0x5798('0x19')][_0x5798('0x1c')]||null:null,'include':_0x552c34[_0x5798('0x19')]?_0x552c34[_0x5798('0x19')][_0x5798('0x1f')]?_[_0x5798('0x1d')](_0x552c34[_0x5798('0x19')][_0x5798('0x1f')],function(_0x520a20){return{'model':db[_0x520a20[_0x5798('0x1e')]],'as':_0x520a20['as'],'attributes':_0x520a20['attributes'],'include':_0x520a20[_0x5798('0x1f')]?_[_0x5798('0x1d')](_0x520a20[_0x5798('0x1f')],function(_0x499df0){return{'model':db[_0x499df0[_0x5798('0x1e')]],'as':_0x499df0['as'],'attributes':_0x499df0[_0x5798('0x1c')],'include':_0x499df0[_0x5798('0x1f')]?_['map'](_0x499df0['include'],function(_0x54143f){return{'model':db[_0x54143f['model']],'as':_0x54143f['as'],'attributes':_0x54143f[_0x5798('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5798('0xd')](function(_0xbf3a68){logger['info'](_0x5798('0x21'),_0x552c34);logger[_0x5798('0x11')](_0x5798('0x21'),_0x552c34,JSON[_0x5798('0x23')](_0xbf3a68));_0x4a073a(_0xbf3a68);})[_0x5798('0x17')](function(_0x2335a2){logger[_0x5798('0x13')](_0x5798('0x21'),_0x2335a2[_0x5798('0x15')],_0x552c34);_0x30d671(_0x45159f[_0x5798('0x13')](0x1f4,_0x2335a2[_0x5798('0x15')]));});});}; \ No newline at end of file +var _0x5c7c=['map','info','stringify','catch','find','raw','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','model'];(function(_0x41b4e9,_0xc2a1c1){var _0x5de954=function(_0xd0293c){while(--_0xd0293c){_0x41b4e9['push'](_0x41b4e9['shift']());}};_0x5de954(++_0xc2a1c1);}(_0x5c7c,0x172));var _0xc5c7=function(_0x51bdd4,_0x29b4be){_0x51bdd4=_0x51bdd4-0x0;var _0x1d3a75=_0x5c7c[_0x51bdd4];return _0x1d3a75;};'use strict';var _=require(_0xc5c7('0x0'));var util=require(_0xc5c7('0x1'));var moment=require(_0xc5c7('0x2'));var BPromise=require(_0xc5c7('0x3'));var rs=require(_0xc5c7('0x4'));var fs=require('fs');var Redis=require(_0xc5c7('0x5'));var db=require(_0xc5c7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5c7('0x7'))(_0xc5c7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc5c7('0x9')][_0xc5c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59e252,_0x393fc7,_0x1714a0){return new BPromise(function(_0x35f991,_0x43520f){return client['request'](_0x59e252,_0x1714a0)[_0xc5c7('0xb')](function(_0xb6831f){logger['info'](_0xc5c7('0xc'),_0x393fc7,_0xc5c7('0xd'));logger[_0xc5c7('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x393fc7,'request\x20sent',JSON['stringify'](_0xb6831f));if(_0xb6831f[_0xc5c7('0xf')]){if(_0xb6831f[_0xc5c7('0xf')]['code']===0x1f4){logger[_0xc5c7('0xf')](_0xc5c7('0xc'),_0x393fc7,_0xb6831f[_0xc5c7('0xf')][_0xc5c7('0x10')]);return _0x43520f(_0xb6831f[_0xc5c7('0xf')][_0xc5c7('0x10')]);}logger[_0xc5c7('0xf')](_0xc5c7('0xc'),_0x393fc7,_0xb6831f['error'][_0xc5c7('0x10')]);return _0x35f991(_0xb6831f[_0xc5c7('0xf')]['message']);}else{logger['info'](_0xc5c7('0xc'),_0x393fc7,_0xc5c7('0xd'));_0x35f991(_0xb6831f[_0xc5c7('0x11')][_0xc5c7('0x10')]);}})['catch'](function(_0x2552ef){logger[_0xc5c7('0xf')](_0xc5c7('0xc'),_0x393fc7,_0x2552ef);_0x43520f(_0x2552ef);});});}exports[_0xc5c7('0x12')]=function(_0x16e44c){var _0x4d531e=this;return new Promise(function(_0x53c148,_0x2a8d99){return db[_0xc5c7('0x13')]['findAll']({'raw':_0x16e44c['options']?_0x16e44c[_0xc5c7('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x16e44c[_0xc5c7('0x14')]?_0x16e44c[_0xc5c7('0x14')][_0xc5c7('0x15')]||null:null,'attributes':_0x16e44c['options']?_0x16e44c[_0xc5c7('0x14')][_0xc5c7('0x16')]||null:null,'limit':_0x16e44c[_0xc5c7('0x14')]?_0x16e44c[_0xc5c7('0x14')][_0xc5c7('0x17')]||null:null,'include':_0x16e44c[_0xc5c7('0x14')]?_0x16e44c[_0xc5c7('0x14')]['include']?_['map'](_0x16e44c[_0xc5c7('0x14')][_0xc5c7('0x18')],function(_0x414b28){return{'model':db[_0x414b28[_0xc5c7('0x19')]],'as':_0x414b28['as'],'attributes':_0x414b28[_0xc5c7('0x16')],'include':_0x414b28[_0xc5c7('0x18')]?_[_0xc5c7('0x1a')](_0x414b28['include'],function(_0xe38025){return{'model':db[_0xe38025[_0xc5c7('0x19')]],'as':_0xe38025['as'],'attributes':_0xe38025[_0xc5c7('0x16')],'include':_0xe38025[_0xc5c7('0x18')]?_[_0xc5c7('0x1a')](_0xe38025[_0xc5c7('0x18')],function(_0x579ab5){return{'model':db[_0x579ab5[_0xc5c7('0x19')]],'as':_0x579ab5['as'],'attributes':_0x579ab5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a84f0){logger[_0xc5c7('0x1b')](_0xc5c7('0x12'),_0x16e44c);logger[_0xc5c7('0xe')](_0xc5c7('0x12'),_0x16e44c,JSON[_0xc5c7('0x1c')](_0x1a84f0));_0x53c148(_0x1a84f0);})[_0xc5c7('0x1d')](function(_0x24d49b){logger[_0xc5c7('0xf')](_0xc5c7('0x12'),_0x24d49b[_0xc5c7('0x10')],_0x16e44c);_0x2a8d99(_0x4d531e[_0xc5c7('0xf')](0x1f4,_0x24d49b['message']));});});};exports['ShowZohoAccount']=function(_0x81f09b){var _0x4a2643=this;return new Promise(function(_0x5f1551,_0x525b8e){return db['ZohoAccount'][_0xc5c7('0x1e')]({'raw':_0x81f09b[_0xc5c7('0x14')]?_0x81f09b[_0xc5c7('0x14')][_0xc5c7('0x1f')]===undefined?!![]:![]:!![],'where':_0x81f09b['options']?_0x81f09b[_0xc5c7('0x14')]['where']||null:null,'attributes':_0x81f09b[_0xc5c7('0x14')]?_0x81f09b[_0xc5c7('0x14')][_0xc5c7('0x16')]||null:null,'include':_0x81f09b[_0xc5c7('0x14')]?_0x81f09b[_0xc5c7('0x14')][_0xc5c7('0x18')]?_[_0xc5c7('0x1a')](_0x81f09b[_0xc5c7('0x14')][_0xc5c7('0x18')],function(_0x50dd5b){return{'model':db[_0x50dd5b[_0xc5c7('0x19')]],'as':_0x50dd5b['as'],'attributes':_0x50dd5b[_0xc5c7('0x16')],'include':_0x50dd5b[_0xc5c7('0x18')]?_[_0xc5c7('0x1a')](_0x50dd5b[_0xc5c7('0x18')],function(_0x4a4744){return{'model':db[_0x4a4744[_0xc5c7('0x19')]],'as':_0x4a4744['as'],'attributes':_0x4a4744[_0xc5c7('0x16')],'include':_0x4a4744[_0xc5c7('0x18')]?_[_0xc5c7('0x1a')](_0x4a4744[_0xc5c7('0x18')],function(_0x2c074f){return{'model':db[_0x2c074f[_0xc5c7('0x19')]],'as':_0x2c074f['as'],'attributes':_0x2c074f[_0xc5c7('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d3d61){logger[_0xc5c7('0x1b')](_0xc5c7('0x20'),_0x81f09b);logger[_0xc5c7('0xe')](_0xc5c7('0x20'),_0x81f09b,JSON[_0xc5c7('0x1c')](_0x1d3d61));_0x5f1551(_0x1d3d61);})[_0xc5c7('0x1d')](function(_0x43b833){logger[_0xc5c7('0xf')]('ShowZohoAccount',_0x43b833[_0xc5c7('0x10')],_0x81f09b);_0x525b8e(_0x4a2643[_0xc5c7('0xf')](0x1f4,_0x43b833[_0xc5c7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9bb7d24..6d2d098 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 _0xf845=['delete','destroy','multer','util','../../components/auth/service','./intZohoConfiguration.controller','index','get','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id'];(function(_0xa7496,_0x3df9a6){var _0x240377=function(_0x238043){while(--_0x238043){_0xa7496['push'](_0xa7496['shift']());}};_0x240377(++_0x3df9a6);}(_0xf845,0x1d6));var _0x5f84=function(_0xf93600,_0x4c083f){_0xf93600=_0xf93600-0x0;var _0x38d071=_0xf845[_0xf93600];return _0x38d071;};'use strict';var multer=require(_0x5f84('0x0'));var util=require(_0x5f84('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x5f84('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5f84('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f84('0x4')]);router[_0x5f84('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5f84('0x5')](_0x5f84('0x6'),auth[_0x5f84('0x7')](),controller[_0x5f84('0x8')]);router[_0x5f84('0x5')](_0x5f84('0x9'),auth['isAuthenticated'](),controller[_0x5f84('0xa')]);router[_0x5f84('0x5')]('/:id/descriptions',auth[_0x5f84('0x7')](),controller[_0x5f84('0xb')]);router[_0x5f84('0xc')]('/',auth[_0x5f84('0x7')](),controller[_0x5f84('0xd')]);router[_0x5f84('0xe')](_0x5f84('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x5f84('0x10')](_0x5f84('0xf'),auth[_0x5f84('0x7')](),controller[_0x5f84('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe24d=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x347c7e,_0x17461a){var _0x6a7685=function(_0x5becd6){while(--_0x5becd6){_0x347c7e['push'](_0x347c7e['shift']());}};_0x6a7685(++_0x17461a);}(_0xe24d,0x1d6));var _0xde24=function(_0x3ef0b3,_0x1e749b){_0x3ef0b3=_0x3ef0b3-0x0;var _0x405750=_0xe24d[_0x3ef0b3];return _0x405750;};'use strict';var multer=require('multer');var util=require(_0xde24('0x0'));var path=require('path');var timeout=require(_0xde24('0x1'));var express=require(_0xde24('0x2'));var router=express[_0xde24('0x3')]();var auth=require(_0xde24('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xde24('0x5'));var controller=require(_0xde24('0x6'));router[_0xde24('0x7')]('/',auth[_0xde24('0x8')](),controller[_0xde24('0x9')]);router[_0xde24('0x7')](_0xde24('0xa'),auth['isAuthenticated'](),controller[_0xde24('0xb')]);router[_0xde24('0x7')](_0xde24('0xc'),auth[_0xde24('0x8')](),controller['getFields']);router[_0xde24('0x7')](_0xde24('0xd'),auth[_0xde24('0x8')](),controller[_0xde24('0xe')]);router['get'](_0xde24('0xf'),auth[_0xde24('0x8')](),controller[_0xde24('0x10')]);router[_0xde24('0x11')]('/',auth[_0xde24('0x8')](),controller[_0xde24('0x12')]);router[_0xde24('0x13')](_0xde24('0xa'),auth[_0xde24('0x8')](),controller[_0xde24('0x14')]);router[_0xde24('0x15')]('/:id',auth[_0xde24('0x8')](),controller[_0xde24('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 5a8722e..fdffd3f 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 _0x1a81=['sequelize','STRING','Leads','Contacts'];(function(_0xd54fe0,_0x1e4633){var _0x35e0b9=function(_0x5d3260){while(--_0x5d3260){_0xd54fe0['push'](_0xd54fe0['shift']());}};_0x35e0b9(++_0x1e4633);}(_0x1a81,0x104));var _0x11a8=function(_0x3c832a,_0xffc533){_0x3c832a=_0x3c832a-0x0;var _0x5ab453=_0x1a81[_0x3c832a];return _0x5ab453;};'use strict';var Sequelize=require(_0x11a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x11a8('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x11a8('0x2'),_0x11a8('0x3')),'defaultValue':_0x11a8('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbcb6=['Contacts','STRING','sequelize','exports','ENUM','Leads'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcb6,0x1a6));var _0x6bcb=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0xbcb6[_0x531e48];return _0x202971;};'use strict';var Sequelize=require(_0x6bcb('0x0'));module[_0x6bcb('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x6bcb('0x2')](_0x6bcb('0x3'),_0x6bcb('0x4')),'defaultValue':_0x6bcb('0x3')},'description':{'type':Sequelize[_0x6bcb('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 40fdfaa..ca38e7f 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 _0xf109=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','field','merge','options','includeAll','include','catch','show','params','find','create','body','ZohoField','getFields','getSubjects','getDescriptions','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','../../config/license/hardware','../../config/logger','../../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','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','ZohoConfiguration','rawAttributes','model','keys','query','filters','intersection'];(function(_0x1cab41,_0x4bfa57){var _0x511deb=function(_0x3d1a43){while(--_0x3d1a43){_0x1cab41['push'](_0x1cab41['shift']());}};_0x511deb(++_0x4bfa57);}(_0xf109,0xce));var _0x9f10=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xf109[_0x1b6186];return _0x186121;};'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 hardwareService=require(_0x9f10('0x13'));var logger=require(_0x9f10('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9f10('0x15'));var db=require(_0x9f10('0x16'))['db'];var jayson=require(_0x9f10('0x17'));var client=jayson['client'][_0x9f10('0x18')]({'port':0x232a});function checkPasswordPattern(_0x260606,_0x35c529,_0x58067f){if(_0x58067f){var _0x9a3ae6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9a3ae6[_0x9f10('0x19')](_0x35c529)){return _0x260606;}else{throw new db['Sequelize'][(_0x9f10('0x1a'))](_0x9f10('0x1b'));}}else{return _0x260606;}}function respondWithRpcPromise(_0x507e1a,_0x59bcad,_0x2b6c4c,_0x177918){return new BPromise(function(_0x549217,_0x11154b){var _0x5ae255=_0x177918||client;return _0x5ae255[_0x9f10('0x1c')](_0x507e1a,_0x2b6c4c)[_0x9f10('0x1d')](function(_0x4b1b8f){logger[_0x9f10('0x1e')](_0x9f10('0x1f'),_0x59bcad,'request\x20sent');logger[_0x9f10('0x20')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x59bcad,_0x9f10('0x21'),JSON['stringify'](_0x4b1b8f));if(_0x4b1b8f[_0x9f10('0x22')]){if(_0x4b1b8f['error']['code']===0x1f4){logger[_0x9f10('0x22')](_0x9f10('0x1f'),_0x59bcad,_0x4b1b8f[_0x9f10('0x22')][_0x9f10('0x23')]);return _0x11154b(_0x4b1b8f[_0x9f10('0x22')][_0x9f10('0x23')]);}logger[_0x9f10('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x59bcad,_0x4b1b8f[_0x9f10('0x22')]['message']);return _0x549217(_0x4b1b8f[_0x9f10('0x22')][_0x9f10('0x23')]);}else{logger[_0x9f10('0x1e')]('ZohoConfiguration,\x20%s,\x20%s',_0x59bcad,_0x9f10('0x21'));_0x549217(_0x4b1b8f[_0x9f10('0x24')][_0x9f10('0x23')]);}})['catch'](function(_0x36821e){logger[_0x9f10('0x22')](_0x9f10('0x1f'),_0x59bcad,_0x36821e);_0x11154b(_0x36821e);});});}function respondWithStatusCode(_0x4c531e,_0x2ec07d){_0x2ec07d=_0x2ec07d||0xcc;return function(_0x23c2e7){if(_0x23c2e7){return _0x4c531e[_0x9f10('0x25')](_0x2ec07d);}return _0x4c531e[_0x9f10('0x26')](_0x2ec07d)['end']();};}function respondWithResult(_0x57539b,_0x5c1800){_0x5c1800=_0x5c1800||0xc8;return function(_0x385a39){if(_0x385a39){return _0x57539b['status'](_0x5c1800)[_0x9f10('0x27')](_0x385a39);}};}function respondWithFilteredResult(_0x1de75a,_0x45fffc){return function(_0x2ed95b){if(_0x2ed95b){var _0x2e11b1=_0x2ed95b[_0x9f10('0x28')],_0x4f6b0c=_0x45fffc[_0x9f10('0x29')],_0x522805=_0x45fffc[_0x9f10('0x29')]+_0x45fffc[_0x9f10('0x2a')],_0x22814f;if(_0x522805>=_0x2e11b1){_0x522805=_0x2e11b1;_0x22814f=0xc8;}else{_0x22814f=0xce;}_0x1de75a['status'](_0x22814f);return _0x1de75a[_0x9f10('0x2b')](_0x9f10('0x2c'),_0x4f6b0c+'-'+_0x522805+'/'+_0x2e11b1)[_0x9f10('0x27')](_0x2ed95b);}return null;};}function patchUpdates(_0x1b03ee){return function(_0x49b3f4){try{jsonpatch[_0x9f10('0x2d')](_0x49b3f4,_0x1b03ee,!![]);}catch(_0x44f389){return BPromise[_0x9f10('0x2e')](_0x44f389);}return _0x49b3f4['save']();};}function saveUpdates(_0x434128,_0x5af399){return function(_0x1069ba){if(_0x1069ba){return _0x1069ba[_0x9f10('0x2f')](_0x434128)[_0x9f10('0x1d')](function(_0x5944e5){return _0x5944e5;});}return null;};}function removeEntity(_0x3ac139,_0x451478){return function(_0x436b4e){if(_0x436b4e){return _0x436b4e[_0x9f10('0x30')]()[_0x9f10('0x1d')](function(){_0x3ac139['status'](0xcc)[_0x9f10('0x31')]();});}};}function handleEntityNotFound(_0x4b54b7,_0x24d21d){return function(_0x17081c){if(!_0x17081c){_0x4b54b7[_0x9f10('0x25')](0x194);}return _0x17081c;};}function handleError(_0x11ee9c,_0x1aa277){_0x1aa277=_0x1aa277||0x1f4;return function(_0x12c486){logger['error'](_0x12c486[_0x9f10('0x32')]);if(_0x12c486[_0x9f10('0x33')]){delete _0x12c486[_0x9f10('0x33')];}_0x11ee9c['status'](_0x1aa277)[_0x9f10('0x34')](_0x12c486);};}exports[_0x9f10('0x35')]=function(_0x4c89fd,_0x2b0b17){var _0x5671fe={},_0x428bf0={},_0x1b7a66={'count':0x0,'rows':[]};var _0x26df66=db[_0x9f10('0x36')][_0x9f10('0x37')];_0x428bf0[_0x9f10('0x38')]=_[_0x9f10('0x39')](_0x26df66);_0x428bf0[_0x9f10('0x3a')]=_['keys'](_0x4c89fd[_0x9f10('0x3a')]);_0x428bf0[_0x9f10('0x3b')]=_[_0x9f10('0x3c')](_0x428bf0['model'],_0x428bf0[_0x9f10('0x3a')]);_0x5671fe[_0x9f10('0x3d')]=_['intersection'](_0x428bf0[_0x9f10('0x38')],qs[_0x9f10('0x3e')](_0x4c89fd[_0x9f10('0x3a')]['fields']));_0x5671fe['attributes']=_0x5671fe[_0x9f10('0x3d')][_0x9f10('0x3f')]?_0x5671fe[_0x9f10('0x3d')]:_0x428bf0[_0x9f10('0x38')];if(!_0x4c89fd[_0x9f10('0x3a')][_0x9f10('0x40')](_0x9f10('0x41'))){_0x5671fe[_0x9f10('0x2a')]=qs[_0x9f10('0x2a')](_0x4c89fd[_0x9f10('0x3a')][_0x9f10('0x2a')]);_0x5671fe[_0x9f10('0x29')]=qs['offset'](_0x4c89fd['query']['offset']);}_0x5671fe[_0x9f10('0x42')]=qs['sort'](_0x4c89fd[_0x9f10('0x3a')][_0x9f10('0x43')]);_0x5671fe[_0x9f10('0x44')]=qs['filters'](_[_0x9f10('0x45')](_0x4c89fd[_0x9f10('0x3a')],_0x428bf0[_0x9f10('0x3b')]));if(_0x4c89fd[_0x9f10('0x3a')][_0x9f10('0x46')]){_0x5671fe['where']=_['merge'](_0x5671fe['where'],{'$or':_[_0x9f10('0x47')](_0x26df66,function(_0x5d08fb){if(_0x5d08fb[_0x9f10('0x48')]['key']!==_0x9f10('0x49')){var _0x3e8d3c={};_0x3e8d3c[_0x5d08fb[_0x9f10('0x4a')]]={'$like':'%'+_0x4c89fd[_0x9f10('0x3a')]['filter']+'%'};return _0x3e8d3c;}})});}_0x5671fe=_[_0x9f10('0x4b')]({},_0x5671fe,_0x4c89fd[_0x9f10('0x4c')]);var _0x571101={'where':_0x5671fe[_0x9f10('0x44')]};return db[_0x9f10('0x36')][_0x9f10('0x28')](_0x571101)[_0x9f10('0x1d')](function(_0x1b3529){_0x1b7a66[_0x9f10('0x28')]=_0x1b3529;if(_0x4c89fd[_0x9f10('0x3a')][_0x9f10('0x4d')]){_0x5671fe[_0x9f10('0x4e')]=[{'all':!![]}];}return db[_0x9f10('0x36')]['findAll'](_0x5671fe);})[_0x9f10('0x1d')](function(_0x102730){_0x1b7a66['rows']=_0x102730;return _0x1b7a66;})[_0x9f10('0x1d')](respondWithFilteredResult(_0x2b0b17,_0x5671fe))[_0x9f10('0x4f')](handleError(_0x2b0b17,null));};exports[_0x9f10('0x50')]=function(_0x1807b3,_0x58b5b5){var _0x283f04={'raw':![],'where':{'id':_0x1807b3[_0x9f10('0x51')]['id']}},_0x2ae710={};_0x2ae710[_0x9f10('0x38')]=_[_0x9f10('0x39')](db[_0x9f10('0x36')]['rawAttributes']);_0x2ae710[_0x9f10('0x3a')]=_[_0x9f10('0x39')](_0x1807b3[_0x9f10('0x3a')]);_0x2ae710[_0x9f10('0x3b')]=_[_0x9f10('0x3c')](_0x2ae710[_0x9f10('0x38')],_0x2ae710['query']);_0x283f04[_0x9f10('0x3d')]=_[_0x9f10('0x3c')](_0x2ae710[_0x9f10('0x38')],qs[_0x9f10('0x3e')](_0x1807b3[_0x9f10('0x3a')][_0x9f10('0x3e')]));_0x283f04[_0x9f10('0x3d')]=_0x283f04[_0x9f10('0x3d')]['length']?_0x283f04[_0x9f10('0x3d')]:_0x2ae710['model'];if(_0x1807b3[_0x9f10('0x3a')]['includeAll']){_0x283f04[_0x9f10('0x4e')]=[{'all':!![]}];}_0x283f04=_[_0x9f10('0x4b')]({},_0x283f04,_0x1807b3[_0x9f10('0x4c')]);return db[_0x9f10('0x36')][_0x9f10('0x52')](_0x283f04)['then'](handleEntityNotFound(_0x58b5b5,null))[_0x9f10('0x1d')](respondWithResult(_0x58b5b5,null))[_0x9f10('0x4f')](handleError(_0x58b5b5,null));};exports[_0x9f10('0x53')]=function(_0x3818dc,_0x500e51){return db['ZohoConfiguration'][_0x9f10('0x53')](_0x3818dc[_0x9f10('0x54')],{})['then'](respondWithResult(_0x500e51,0xc9))['catch'](handleError(_0x500e51,null));};exports[_0x9f10('0x2f')]=function(_0x2a9165,_0x23369b){if(_0x2a9165['body']['id']){delete _0x2a9165[_0x9f10('0x54')]['id'];}return db[_0x9f10('0x36')][_0x9f10('0x52')]({'where':{'id':_0x2a9165['params']['id']}})[_0x9f10('0x1d')](handleEntityNotFound(_0x23369b,null))[_0x9f10('0x1d')](saveUpdates(_0x2a9165[_0x9f10('0x54')],null))['then'](respondWithResult(_0x23369b,null))[_0x9f10('0x4f')](handleError(_0x23369b,null));};exports[_0x9f10('0x30')]=function(_0x5f180f,_0x2a99fa){return db[_0x9f10('0x36')][_0x9f10('0x52')]({'where':{'id':_0x5f180f[_0x9f10('0x51')]['id']}})[_0x9f10('0x1d')](handleEntityNotFound(_0x2a99fa,null))['then'](removeEntity(_0x2a99fa,null))[_0x9f10('0x4f')](handleError(_0x2a99fa,null));};exports['getFields']=function(_0x47f756,_0x449eb6,_0x19b489){var _0x1f109a={};var _0x277a86={};var _0x2ed385;var _0x23e866;return db[_0x9f10('0x36')]['findOne']({'where':{'id':_0x47f756['params']['id']}})[_0x9f10('0x1d')](handleEntityNotFound(_0x449eb6,null))[_0x9f10('0x1d')](function(_0x1d6f4a){if(_0x1d6f4a){_0x2ed385=_0x1d6f4a;_0x277a86[_0x9f10('0x38')]=_[_0x9f10('0x39')](db[_0x9f10('0x55')][_0x9f10('0x37')]);_0x277a86['query']=_[_0x9f10('0x39')](_0x47f756[_0x9f10('0x3a')]);_0x277a86['filters']=_[_0x9f10('0x3c')](_0x277a86[_0x9f10('0x38')],_0x277a86['query']);_0x1f109a[_0x9f10('0x3d')]=_[_0x9f10('0x3c')](_0x277a86['model'],qs[_0x9f10('0x3e')](_0x47f756['query'][_0x9f10('0x3e')]));_0x1f109a[_0x9f10('0x3d')]=_0x1f109a[_0x9f10('0x3d')][_0x9f10('0x3f')]?_0x1f109a[_0x9f10('0x3d')]:_0x277a86['model'];_0x1f109a[_0x9f10('0x42')]=qs[_0x9f10('0x43')](_0x47f756[_0x9f10('0x3a')]['sort']);_0x1f109a['where']=qs[_0x9f10('0x3b')](_[_0x9f10('0x45')](_0x47f756[_0x9f10('0x3a')],_0x277a86[_0x9f10('0x3b')]));if(_0x47f756[_0x9f10('0x3a')][_0x9f10('0x46')]){_0x1f109a[_0x9f10('0x44')]=_['merge'](_0x1f109a[_0x9f10('0x44')],{'$or':_[_0x9f10('0x47')](_0x1f109a['attributes'],function(_0xb0f5e9){var _0x4bec94={};_0x4bec94[_0xb0f5e9]={'$like':'%'+_0x47f756[_0x9f10('0x3a')][_0x9f10('0x46')]+'%'};return _0x4bec94;})});}_0x1f109a=_['merge']({},_0x1f109a,_0x47f756[_0x9f10('0x4c')]);return _0x2ed385['getFields'](_0x1f109a);}})[_0x9f10('0x1d')](function(_0x25b3e2){if(_0x25b3e2){_0x23e866=_0x25b3e2[_0x9f10('0x3f')];if(!_0x47f756['query'][_0x9f10('0x40')]('nolimit')){_0x1f109a[_0x9f10('0x2a')]=qs[_0x9f10('0x2a')](_0x47f756[_0x9f10('0x3a')]['limit']);_0x1f109a[_0x9f10('0x29')]=qs['offset'](_0x47f756['query'][_0x9f10('0x29')]);}return _0x2ed385[_0x9f10('0x56')](_0x1f109a);}})[_0x9f10('0x1d')](function(_0x50ea89){if(_0x50ea89){return _0x50ea89?{'count':_0x23e866,'rows':_0x50ea89}:null;}})[_0x9f10('0x1d')](respondWithResult(_0x449eb6,null))['catch'](handleError(_0x449eb6,null));};exports['getSubjects']=function(_0x329a74,_0x551a5d,_0x4e7b27){var _0x13a2cb={};var _0x5302d3={};var _0x1a08f5;var _0x9f6f4b;return db[_0x9f10('0x36')]['findOne']({'where':{'id':_0x329a74[_0x9f10('0x51')]['id']}})[_0x9f10('0x1d')](handleEntityNotFound(_0x551a5d,null))['then'](function(_0x2941dc){if(_0x2941dc){_0x1a08f5=_0x2941dc;_0x5302d3['model']=_['keys'](db[_0x9f10('0x55')][_0x9f10('0x37')]);_0x5302d3[_0x9f10('0x3a')]=_[_0x9f10('0x39')](_0x329a74[_0x9f10('0x3a')]);_0x5302d3[_0x9f10('0x3b')]=_[_0x9f10('0x3c')](_0x5302d3['model'],_0x5302d3[_0x9f10('0x3a')]);_0x13a2cb[_0x9f10('0x3d')]=_[_0x9f10('0x3c')](_0x5302d3[_0x9f10('0x38')],qs[_0x9f10('0x3e')](_0x329a74[_0x9f10('0x3a')][_0x9f10('0x3e')]));_0x13a2cb[_0x9f10('0x3d')]=_0x13a2cb[_0x9f10('0x3d')]['length']?_0x13a2cb[_0x9f10('0x3d')]:_0x5302d3[_0x9f10('0x38')];_0x13a2cb[_0x9f10('0x42')]=qs[_0x9f10('0x43')](_0x329a74['query'][_0x9f10('0x43')]);_0x13a2cb[_0x9f10('0x44')]=qs[_0x9f10('0x3b')](_[_0x9f10('0x45')](_0x329a74['query'],_0x5302d3['filters']));if(_0x329a74[_0x9f10('0x3a')][_0x9f10('0x46')]){_0x13a2cb[_0x9f10('0x44')]=_[_0x9f10('0x4b')](_0x13a2cb[_0x9f10('0x44')],{'$or':_[_0x9f10('0x47')](_0x13a2cb[_0x9f10('0x3d')],function(_0x25a1d7){var _0x129f91={};_0x129f91[_0x25a1d7]={'$like':'%'+_0x329a74[_0x9f10('0x3a')][_0x9f10('0x46')]+'%'};return _0x129f91;})});}_0x13a2cb=_[_0x9f10('0x4b')]({},_0x13a2cb,_0x329a74[_0x9f10('0x4c')]);return _0x1a08f5[_0x9f10('0x57')](_0x13a2cb);}})[_0x9f10('0x1d')](function(_0x514315){if(_0x514315){_0x9f6f4b=_0x514315[_0x9f10('0x3f')];if(!_0x329a74[_0x9f10('0x3a')]['hasOwnProperty'](_0x9f10('0x41'))){_0x13a2cb[_0x9f10('0x2a')]=qs[_0x9f10('0x2a')](_0x329a74[_0x9f10('0x3a')]['limit']);_0x13a2cb[_0x9f10('0x29')]=qs['offset'](_0x329a74[_0x9f10('0x3a')][_0x9f10('0x29')]);}return _0x1a08f5[_0x9f10('0x57')](_0x13a2cb);}})['then'](function(_0x26edd6){if(_0x26edd6){return _0x26edd6?{'count':_0x9f6f4b,'rows':_0x26edd6}:null;}})[_0x9f10('0x1d')](respondWithResult(_0x551a5d,null))[_0x9f10('0x4f')](handleError(_0x551a5d,null));};exports['getDescriptions']=function(_0x29e1d3,_0x215f94,_0x28890c){var _0x57bc28={};var _0x4f2430={};var _0x4d41e7;var _0x5b78cd;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x29e1d3['params']['id']}})[_0x9f10('0x1d')](handleEntityNotFound(_0x215f94,null))[_0x9f10('0x1d')](function(_0x4dc5d5){if(_0x4dc5d5){_0x4d41e7=_0x4dc5d5;_0x4f2430[_0x9f10('0x38')]=_[_0x9f10('0x39')](db[_0x9f10('0x55')][_0x9f10('0x37')]);_0x4f2430[_0x9f10('0x3a')]=_[_0x9f10('0x39')](_0x29e1d3[_0x9f10('0x3a')]);_0x4f2430[_0x9f10('0x3b')]=_[_0x9f10('0x3c')](_0x4f2430[_0x9f10('0x38')],_0x4f2430['query']);_0x57bc28[_0x9f10('0x3d')]=_[_0x9f10('0x3c')](_0x4f2430['model'],qs[_0x9f10('0x3e')](_0x29e1d3['query']['fields']));_0x57bc28[_0x9f10('0x3d')]=_0x57bc28[_0x9f10('0x3d')]['length']?_0x57bc28[_0x9f10('0x3d')]:_0x4f2430[_0x9f10('0x38')];_0x57bc28['order']=qs[_0x9f10('0x43')](_0x29e1d3[_0x9f10('0x3a')][_0x9f10('0x43')]);_0x57bc28['where']=qs[_0x9f10('0x3b')](_[_0x9f10('0x45')](_0x29e1d3['query'],_0x4f2430['filters']));if(_0x29e1d3[_0x9f10('0x3a')][_0x9f10('0x46')]){_0x57bc28['where']=_[_0x9f10('0x4b')](_0x57bc28[_0x9f10('0x44')],{'$or':_['map'](_0x57bc28['attributes'],function(_0x36fe07){var _0x221b6c={};_0x221b6c[_0x36fe07]={'$like':'%'+_0x29e1d3['query']['filter']+'%'};return _0x221b6c;})});}_0x57bc28=_[_0x9f10('0x4b')]({},_0x57bc28,_0x29e1d3[_0x9f10('0x4c')]);return _0x4d41e7['getDescriptions'](_0x57bc28);}})[_0x9f10('0x1d')](function(_0x377078){if(_0x377078){_0x5b78cd=_0x377078[_0x9f10('0x3f')];if(!_0x29e1d3[_0x9f10('0x3a')][_0x9f10('0x40')]('nolimit')){_0x57bc28['limit']=qs['limit'](_0x29e1d3[_0x9f10('0x3a')][_0x9f10('0x2a')]);_0x57bc28[_0x9f10('0x29')]=qs['offset'](_0x29e1d3[_0x9f10('0x3a')]['offset']);}return _0x4d41e7[_0x9f10('0x58')](_0x57bc28);}})['then'](function(_0x4e9fde){if(_0x4e9fde){return _0x4e9fde?{'count':_0x5b78cd,'rows':_0x4e9fde}:null;}})['then'](respondWithResult(_0x215f94,null))[_0x9f10('0x4f')](handleError(_0x215f94,null));}; \ No newline at end of file +var _0x55e0=['rawAttributes','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','merge','type','key','VIRTUAL','filter','includeAll','findAll','rows','params','include','find','create','body','ZohoField','map','getFields','nolimit','getSubjects','findOne','options','getDescriptions','pick','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../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','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','stack','name','send','ZohoConfiguration'];(function(_0x186db8,_0x5a46a5){var _0x3768a8=function(_0x4b69d1){while(--_0x4b69d1){_0x186db8['push'](_0x186db8['shift']());}};_0x3768a8(++_0x5a46a5);}(_0x55e0,0xdc));var _0x055e=function(_0x1bd3b2,_0x14d3b7){_0x1bd3b2=_0x1bd3b2-0x0;var _0x2b95bc=_0x55e0[_0x1bd3b2];return _0x2b95bc;};'use strict';var pdf=require(_0x055e('0x0'));var emlformat=require(_0x055e('0x1'));var rimraf=require(_0x055e('0x2'));var zipdir=require(_0x055e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x055e('0x4'));var BPromise=require(_0x055e('0x5'));var Mustache=require(_0x055e('0x6'));var util=require(_0x055e('0x7'));var path=require(_0x055e('0x8'));var sox=require(_0x055e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x055e('0xa'));var squel=require('squel');var crypto=require(_0x055e('0xb'));var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0xe'));var querystring=require(_0x055e('0xf'));var Papa=require('papaparse');var Redis=require(_0x055e('0x10'));var authService=require(_0x055e('0x11'));var qs=require(_0x055e('0x12'));var hardwareService=require(_0x055e('0x13'));var logger=require(_0x055e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x055e('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x055e('0x16'));var client=jayson[_0x055e('0x17')][_0x055e('0x18')]({'port':0x232a});function checkPasswordPattern(_0x101bc3,_0xc98c6a,_0x31c649){if(_0x31c649){var _0x236a2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x236a2b['test'](_0xc98c6a)){return _0x101bc3;}else{throw new db[(_0x055e('0x19'))][(_0x055e('0x1a'))](_0x055e('0x1b'));}}else{return _0x101bc3;}}function respondWithRpcPromise(_0xe41bae,_0x222817,_0x56af18,_0x230674){return new BPromise(function(_0x2fe55f,_0x111cdb){var _0x599533=_0x230674||client;return _0x599533[_0x055e('0x1c')](_0xe41bae,_0x56af18)[_0x055e('0x1d')](function(_0xb4e6ca){logger[_0x055e('0x1e')](_0x055e('0x1f'),_0x222817,'request\x20sent');logger[_0x055e('0x20')](_0x055e('0x21'),_0x222817,_0x055e('0x22'),JSON[_0x055e('0x23')](_0xb4e6ca));if(_0xb4e6ca['error']){if(_0xb4e6ca[_0x055e('0x24')][_0x055e('0x25')]===0x1f4){logger['error'](_0x055e('0x1f'),_0x222817,_0xb4e6ca[_0x055e('0x24')][_0x055e('0x26')]);return _0x111cdb(_0xb4e6ca[_0x055e('0x24')][_0x055e('0x26')]);}logger[_0x055e('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x222817,_0xb4e6ca[_0x055e('0x24')][_0x055e('0x26')]);return _0x2fe55f(_0xb4e6ca[_0x055e('0x24')]['message']);}else{logger[_0x055e('0x1e')](_0x055e('0x1f'),_0x222817,_0x055e('0x22'));_0x2fe55f(_0xb4e6ca[_0x055e('0x27')]['message']);}})[_0x055e('0x28')](function(_0x56c372){logger[_0x055e('0x24')](_0x055e('0x1f'),_0x222817,_0x56c372);_0x111cdb(_0x56c372);});});}function respondWithStatusCode(_0xf8fa4d,_0x1a76c6){_0x1a76c6=_0x1a76c6||0xcc;return function(_0x40c62a){if(_0x40c62a){return _0xf8fa4d[_0x055e('0x29')](_0x1a76c6);}return _0xf8fa4d['status'](_0x1a76c6)[_0x055e('0x2a')]();};}function respondWithResult(_0x1f90a9,_0x2a82f8){_0x2a82f8=_0x2a82f8||0xc8;return function(_0x4b5891){if(_0x4b5891){return _0x1f90a9[_0x055e('0x2b')](_0x2a82f8)[_0x055e('0x2c')](_0x4b5891);}};}function respondWithFilteredResult(_0x42f2df,_0x2ef064){return function(_0x59539d){if(_0x59539d){var _0x27f81a=_0x59539d[_0x055e('0x2d')],_0x5958ef=_0x2ef064[_0x055e('0x2e')],_0x1528c3=_0x2ef064[_0x055e('0x2e')]+_0x2ef064['limit'],_0x35def0;if(_0x1528c3>=_0x27f81a){_0x1528c3=_0x27f81a;_0x35def0=0xc8;}else{_0x35def0=0xce;}_0x42f2df[_0x055e('0x2b')](_0x35def0);return _0x42f2df[_0x055e('0x2f')](_0x055e('0x30'),_0x5958ef+'-'+_0x1528c3+'/'+_0x27f81a)[_0x055e('0x2c')](_0x59539d);}return null;};}function patchUpdates(_0x36abb2){return function(_0x225c88){try{jsonpatch[_0x055e('0x31')](_0x225c88,_0x36abb2,!![]);}catch(_0x167322){return BPromise['reject'](_0x167322);}return _0x225c88[_0x055e('0x32')]();};}function saveUpdates(_0x43ec84,_0x5cfeea){return function(_0xd9298d){if(_0xd9298d){return _0xd9298d[_0x055e('0x33')](_0x43ec84)[_0x055e('0x1d')](function(_0x20717b){return _0x20717b;});}return null;};}function removeEntity(_0x23c611,_0x43d8b7){return function(_0x5e1a92){if(_0x5e1a92){return _0x5e1a92['destroy']()[_0x055e('0x1d')](function(){_0x23c611['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a1ee,_0x31ee60){return function(_0x436a3c){if(!_0x436a3c){_0x55a1ee[_0x055e('0x29')](0x194);}return _0x436a3c;};}function handleError(_0x1aab6d,_0x282914){_0x282914=_0x282914||0x1f4;return function(_0x16a4fa){logger[_0x055e('0x24')](_0x16a4fa[_0x055e('0x34')]);if(_0x16a4fa[_0x055e('0x35')]){delete _0x16a4fa[_0x055e('0x35')];}_0x1aab6d[_0x055e('0x2b')](_0x282914)[_0x055e('0x36')](_0x16a4fa);};}exports['index']=function(_0x571b75,_0x44fda3){var _0x47790a={},_0x10346b={},_0xf3abf6={'count':0x0,'rows':[]};var _0x34d5f2=db[_0x055e('0x37')][_0x055e('0x38')];_0x10346b['model']=_[_0x055e('0x39')](_0x34d5f2);_0x10346b[_0x055e('0x3a')]=_[_0x055e('0x39')](_0x571b75[_0x055e('0x3a')]);_0x10346b[_0x055e('0x3b')]=_['intersection'](_0x10346b[_0x055e('0x3c')],_0x10346b[_0x055e('0x3a')]);_0x47790a['attributes']=_[_0x055e('0x3d')](_0x10346b[_0x055e('0x3c')],qs['fields'](_0x571b75[_0x055e('0x3a')][_0x055e('0x3e')]));_0x47790a['attributes']=_0x47790a[_0x055e('0x3f')][_0x055e('0x40')]?_0x47790a['attributes']:_0x10346b[_0x055e('0x3c')];if(!_0x571b75[_0x055e('0x3a')][_0x055e('0x41')]('nolimit')){_0x47790a[_0x055e('0x42')]=qs[_0x055e('0x42')](_0x571b75['query'][_0x055e('0x42')]);_0x47790a[_0x055e('0x2e')]=qs[_0x055e('0x2e')](_0x571b75['query'][_0x055e('0x2e')]);}_0x47790a[_0x055e('0x43')]=qs[_0x055e('0x44')](_0x571b75['query']['sort']);_0x47790a[_0x055e('0x45')]=qs[_0x055e('0x3b')](_['pick'](_0x571b75[_0x055e('0x3a')],_0x10346b['filters']));if(_0x571b75[_0x055e('0x3a')]['filter']){_0x47790a[_0x055e('0x45')]=_[_0x055e('0x46')](_0x47790a[_0x055e('0x45')],{'$or':_['map'](_0x34d5f2,function(_0x57483c){if(_0x57483c[_0x055e('0x47')][_0x055e('0x48')]!==_0x055e('0x49')){var _0x445d74={};_0x445d74[_0x57483c['field']]={'$like':'%'+_0x571b75['query'][_0x055e('0x4a')]+'%'};return _0x445d74;}})});}_0x47790a=_[_0x055e('0x46')]({},_0x47790a,_0x571b75['options']);var _0x42dde3={'where':_0x47790a[_0x055e('0x45')]};return db[_0x055e('0x37')][_0x055e('0x2d')](_0x42dde3)[_0x055e('0x1d')](function(_0x1f3c73){_0xf3abf6['count']=_0x1f3c73;if(_0x571b75[_0x055e('0x3a')][_0x055e('0x4b')]){_0x47790a['include']=[{'all':!![]}];}return db[_0x055e('0x37')][_0x055e('0x4c')](_0x47790a);})[_0x055e('0x1d')](function(_0x11e860){_0xf3abf6[_0x055e('0x4d')]=_0x11e860;return _0xf3abf6;})[_0x055e('0x1d')](respondWithFilteredResult(_0x44fda3,_0x47790a))[_0x055e('0x28')](handleError(_0x44fda3,null));};exports['show']=function(_0x35b2c6,_0x48fb8f){var _0xc08c9b={'raw':![],'where':{'id':_0x35b2c6[_0x055e('0x4e')]['id']}},_0xed7611={};_0xed7611['model']=_['keys'](db[_0x055e('0x37')][_0x055e('0x38')]);_0xed7611[_0x055e('0x3a')]=_[_0x055e('0x39')](_0x35b2c6[_0x055e('0x3a')]);_0xed7611[_0x055e('0x3b')]=_[_0x055e('0x3d')](_0xed7611[_0x055e('0x3c')],_0xed7611[_0x055e('0x3a')]);_0xc08c9b['attributes']=_[_0x055e('0x3d')](_0xed7611[_0x055e('0x3c')],qs[_0x055e('0x3e')](_0x35b2c6[_0x055e('0x3a')][_0x055e('0x3e')]));_0xc08c9b['attributes']=_0xc08c9b[_0x055e('0x3f')][_0x055e('0x40')]?_0xc08c9b[_0x055e('0x3f')]:_0xed7611['model'];if(_0x35b2c6[_0x055e('0x3a')]['includeAll']){_0xc08c9b[_0x055e('0x4f')]=[{'all':!![]}];}_0xc08c9b=_[_0x055e('0x46')]({},_0xc08c9b,_0x35b2c6['options']);return db[_0x055e('0x37')][_0x055e('0x50')](_0xc08c9b)[_0x055e('0x1d')](handleEntityNotFound(_0x48fb8f,null))['then'](respondWithResult(_0x48fb8f,null))['catch'](handleError(_0x48fb8f,null));};exports[_0x055e('0x51')]=function(_0x413778,_0x393717){return db[_0x055e('0x37')][_0x055e('0x51')](_0x413778[_0x055e('0x52')],{})[_0x055e('0x1d')](respondWithResult(_0x393717,0xc9))[_0x055e('0x28')](handleError(_0x393717,null));};exports[_0x055e('0x33')]=function(_0x1a7113,_0x4d8698){if(_0x1a7113[_0x055e('0x52')]['id']){delete _0x1a7113[_0x055e('0x52')]['id'];}return db[_0x055e('0x37')][_0x055e('0x50')]({'where':{'id':_0x1a7113['params']['id']}})[_0x055e('0x1d')](handleEntityNotFound(_0x4d8698,null))[_0x055e('0x1d')](saveUpdates(_0x1a7113[_0x055e('0x52')],null))[_0x055e('0x1d')](respondWithResult(_0x4d8698,null))['catch'](handleError(_0x4d8698,null));};exports['destroy']=function(_0x22bf74,_0xd3a451){return db[_0x055e('0x37')][_0x055e('0x50')]({'where':{'id':_0x22bf74[_0x055e('0x4e')]['id']}})[_0x055e('0x1d')](handleEntityNotFound(_0xd3a451,null))[_0x055e('0x1d')](removeEntity(_0xd3a451,null))[_0x055e('0x28')](handleError(_0xd3a451,null));};exports['getFields']=function(_0x51b5a9,_0x1df839,_0x33592d){var _0x5240d5={};var _0x143e8c={};var _0x16dd1e;var _0x334a72;return db[_0x055e('0x37')]['findOne']({'where':{'id':_0x51b5a9[_0x055e('0x4e')]['id']}})[_0x055e('0x1d')](handleEntityNotFound(_0x1df839,null))[_0x055e('0x1d')](function(_0x1ec58d){if(_0x1ec58d){_0x16dd1e=_0x1ec58d;_0x143e8c[_0x055e('0x3c')]=_[_0x055e('0x39')](db[_0x055e('0x53')][_0x055e('0x38')]);_0x143e8c['query']=_[_0x055e('0x39')](_0x51b5a9[_0x055e('0x3a')]);_0x143e8c['filters']=_[_0x055e('0x3d')](_0x143e8c[_0x055e('0x3c')],_0x143e8c[_0x055e('0x3a')]);_0x5240d5[_0x055e('0x3f')]=_['intersection'](_0x143e8c[_0x055e('0x3c')],qs[_0x055e('0x3e')](_0x51b5a9[_0x055e('0x3a')]['fields']));_0x5240d5[_0x055e('0x3f')]=_0x5240d5[_0x055e('0x3f')][_0x055e('0x40')]?_0x5240d5[_0x055e('0x3f')]:_0x143e8c[_0x055e('0x3c')];_0x5240d5['order']=qs[_0x055e('0x44')](_0x51b5a9[_0x055e('0x3a')][_0x055e('0x44')]);_0x5240d5[_0x055e('0x45')]=qs[_0x055e('0x3b')](_['pick'](_0x51b5a9[_0x055e('0x3a')],_0x143e8c[_0x055e('0x3b')]));if(_0x51b5a9[_0x055e('0x3a')]['filter']){_0x5240d5[_0x055e('0x45')]=_[_0x055e('0x46')](_0x5240d5[_0x055e('0x45')],{'$or':_[_0x055e('0x54')](_0x5240d5[_0x055e('0x3f')],function(_0x553e16){var _0x301d72={};_0x301d72[_0x553e16]={'$like':'%'+_0x51b5a9['query'][_0x055e('0x4a')]+'%'};return _0x301d72;})});}_0x5240d5=_[_0x055e('0x46')]({},_0x5240d5,_0x51b5a9['options']);return _0x16dd1e[_0x055e('0x55')](_0x5240d5);}})[_0x055e('0x1d')](function(_0x30602f){if(_0x30602f){_0x334a72=_0x30602f[_0x055e('0x40')];if(!_0x51b5a9['query']['hasOwnProperty'](_0x055e('0x56'))){_0x5240d5['limit']=qs[_0x055e('0x42')](_0x51b5a9[_0x055e('0x3a')][_0x055e('0x42')]);_0x5240d5[_0x055e('0x2e')]=qs[_0x055e('0x2e')](_0x51b5a9[_0x055e('0x3a')][_0x055e('0x2e')]);}return _0x16dd1e[_0x055e('0x55')](_0x5240d5);}})[_0x055e('0x1d')](function(_0x14eb53){if(_0x14eb53){return _0x14eb53?{'count':_0x334a72,'rows':_0x14eb53}:null;}})['then'](respondWithResult(_0x1df839,null))['catch'](handleError(_0x1df839,null));};exports[_0x055e('0x57')]=function(_0x1f276f,_0x52a6e9,_0x2a4df8){var _0x55e1d7={};var _0x164afd={};var _0x45afd7;var _0x10093f;return db[_0x055e('0x37')][_0x055e('0x58')]({'where':{'id':_0x1f276f[_0x055e('0x4e')]['id']}})[_0x055e('0x1d')](handleEntityNotFound(_0x52a6e9,null))[_0x055e('0x1d')](function(_0x4dfdb0){if(_0x4dfdb0){_0x45afd7=_0x4dfdb0;_0x164afd[_0x055e('0x3c')]=_[_0x055e('0x39')](db[_0x055e('0x53')][_0x055e('0x38')]);_0x164afd[_0x055e('0x3a')]=_[_0x055e('0x39')](_0x1f276f[_0x055e('0x3a')]);_0x164afd[_0x055e('0x3b')]=_[_0x055e('0x3d')](_0x164afd['model'],_0x164afd[_0x055e('0x3a')]);_0x55e1d7[_0x055e('0x3f')]=_['intersection'](_0x164afd[_0x055e('0x3c')],qs[_0x055e('0x3e')](_0x1f276f[_0x055e('0x3a')][_0x055e('0x3e')]));_0x55e1d7['attributes']=_0x55e1d7[_0x055e('0x3f')][_0x055e('0x40')]?_0x55e1d7[_0x055e('0x3f')]:_0x164afd[_0x055e('0x3c')];_0x55e1d7[_0x055e('0x43')]=qs['sort'](_0x1f276f[_0x055e('0x3a')][_0x055e('0x44')]);_0x55e1d7[_0x055e('0x45')]=qs[_0x055e('0x3b')](_['pick'](_0x1f276f[_0x055e('0x3a')],_0x164afd[_0x055e('0x3b')]));if(_0x1f276f[_0x055e('0x3a')][_0x055e('0x4a')]){_0x55e1d7[_0x055e('0x45')]=_['merge'](_0x55e1d7[_0x055e('0x45')],{'$or':_[_0x055e('0x54')](_0x55e1d7[_0x055e('0x3f')],function(_0x1f3ba4){var _0x5df25b={};_0x5df25b[_0x1f3ba4]={'$like':'%'+_0x1f276f[_0x055e('0x3a')][_0x055e('0x4a')]+'%'};return _0x5df25b;})});}_0x55e1d7=_[_0x055e('0x46')]({},_0x55e1d7,_0x1f276f[_0x055e('0x59')]);return _0x45afd7['getSubjects'](_0x55e1d7);}})[_0x055e('0x1d')](function(_0x8e77e0){if(_0x8e77e0){_0x10093f=_0x8e77e0[_0x055e('0x40')];if(!_0x1f276f[_0x055e('0x3a')][_0x055e('0x41')]('nolimit')){_0x55e1d7[_0x055e('0x42')]=qs[_0x055e('0x42')](_0x1f276f[_0x055e('0x3a')]['limit']);_0x55e1d7['offset']=qs[_0x055e('0x2e')](_0x1f276f['query'][_0x055e('0x2e')]);}return _0x45afd7[_0x055e('0x57')](_0x55e1d7);}})['then'](function(_0x187f5){if(_0x187f5){return _0x187f5?{'count':_0x10093f,'rows':_0x187f5}:null;}})[_0x055e('0x1d')](respondWithResult(_0x52a6e9,null))[_0x055e('0x28')](handleError(_0x52a6e9,null));};exports[_0x055e('0x5a')]=function(_0x12a8ac,_0x10b63a,_0x1ad730){var _0x2b670c={};var _0x22b231={};var _0x431b5e;var _0x184a00;return db[_0x055e('0x37')][_0x055e('0x58')]({'where':{'id':_0x12a8ac[_0x055e('0x4e')]['id']}})[_0x055e('0x1d')](handleEntityNotFound(_0x10b63a,null))[_0x055e('0x1d')](function(_0x5d0ca3){if(_0x5d0ca3){_0x431b5e=_0x5d0ca3;_0x22b231[_0x055e('0x3c')]=_['keys'](db['ZohoField'][_0x055e('0x38')]);_0x22b231[_0x055e('0x3a')]=_[_0x055e('0x39')](_0x12a8ac['query']);_0x22b231[_0x055e('0x3b')]=_[_0x055e('0x3d')](_0x22b231['model'],_0x22b231[_0x055e('0x3a')]);_0x2b670c[_0x055e('0x3f')]=_['intersection'](_0x22b231[_0x055e('0x3c')],qs['fields'](_0x12a8ac[_0x055e('0x3a')][_0x055e('0x3e')]));_0x2b670c[_0x055e('0x3f')]=_0x2b670c[_0x055e('0x3f')]['length']?_0x2b670c['attributes']:_0x22b231['model'];_0x2b670c[_0x055e('0x43')]=qs['sort'](_0x12a8ac['query'][_0x055e('0x44')]);_0x2b670c['where']=qs[_0x055e('0x3b')](_[_0x055e('0x5b')](_0x12a8ac[_0x055e('0x3a')],_0x22b231[_0x055e('0x3b')]));if(_0x12a8ac['query']['filter']){_0x2b670c[_0x055e('0x45')]=_[_0x055e('0x46')](_0x2b670c[_0x055e('0x45')],{'$or':_[_0x055e('0x54')](_0x2b670c[_0x055e('0x3f')],function(_0x202572){var _0x1bb6ca={};_0x1bb6ca[_0x202572]={'$like':'%'+_0x12a8ac['query'][_0x055e('0x4a')]+'%'};return _0x1bb6ca;})});}_0x2b670c=_['merge']({},_0x2b670c,_0x12a8ac['options']);return _0x431b5e[_0x055e('0x5a')](_0x2b670c);}})[_0x055e('0x1d')](function(_0x237463){if(_0x237463){_0x184a00=_0x237463['length'];if(!_0x12a8ac[_0x055e('0x3a')][_0x055e('0x41')](_0x055e('0x56'))){_0x2b670c['limit']=qs[_0x055e('0x42')](_0x12a8ac[_0x055e('0x3a')][_0x055e('0x42')]);_0x2b670c[_0x055e('0x2e')]=qs[_0x055e('0x2e')](_0x12a8ac[_0x055e('0x3a')][_0x055e('0x2e')]);}return _0x431b5e[_0x055e('0x5a')](_0x2b670c);}})[_0x055e('0x1d')](function(_0x2260a5){if(_0x2260a5){return _0x2260a5?{'count':_0x184a00,'rows':_0x2260a5}:null;}})[_0x055e('0x1d')](respondWithResult(_0x10b63a,null))[_0x055e('0x28')](handleError(_0x10b63a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 7ff4b22..a1eb0de 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 _0xca97=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x51ee58,_0x1abc88){var _0x2a7901=function(_0x51debc){while(--_0x51debc){_0x51ee58['push'](_0x51ee58['shift']());}};_0x2a7901(++_0x1abc88);}(_0xca97,0xff));var _0x7ca9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xca97[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x7ca9('0x0'));var util=require(_0x7ca9('0x1'));var logger=require(_0x7ca9('0x2'))(_0x7ca9('0x3'));var moment=require(_0x7ca9('0x4'));var BPromise=require(_0x7ca9('0x5'));var rp=require(_0x7ca9('0x6'));var fs=require('fs');var path=require(_0x7ca9('0x7'));var rimraf=require(_0x7ca9('0x8'));var config=require(_0x7ca9('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0x7ca9('0xa')]=function(_0x41a722,_0x1e05a9){return _0x41a722[_0x7ca9('0xb')](_0x7ca9('0xc'),attributes,{'tableName':_0x7ca9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x171c=['ZohoConfiguration','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x50a81c,_0x93b9d1){var _0x2acee1=function(_0x56278e){while(--_0x56278e){_0x50a81c['push'](_0x50a81c['shift']());}};_0x2acee1(++_0x93b9d1);}(_0x171c,0x169));var _0xc171=function(_0xd1eba6,_0x52e623){_0xd1eba6=_0xd1eba6-0x0;var _0x2ad864=_0x171c[_0xd1eba6];return _0x2ad864;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc171('0x0'));var moment=require(_0xc171('0x1'));var BPromise=require(_0xc171('0x2'));var rp=require(_0xc171('0x3'));var fs=require('fs');var path=require(_0xc171('0x4'));var rimraf=require(_0xc171('0x5'));var config=require(_0xc171('0x6'));var attributes=require(_0xc171('0x7'));module['exports']=function(_0xc88754,_0x1ffb76){return _0xc88754['define'](_0xc171('0x8'),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 fce116d..35819c1 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 _0x0e11=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x0e11,0xec));var _0x10e1=function(_0x5f22c5,_0x4cc4ef){_0x5f22c5=_0x5f22c5-0x0;var _0x4b24cd=_0x0e11[_0x5f22c5];return _0x4b24cd;};'use strict';var _=require(_0x10e1('0x0'));var util=require(_0x10e1('0x1'));var moment=require(_0x10e1('0x2'));var BPromise=require(_0x10e1('0x3'));var rs=require(_0x10e1('0x4'));var fs=require('fs');var Redis=require(_0x10e1('0x5'));var db=require(_0x10e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x10e1('0x7'))('rpc');var config=require(_0x10e1('0x8'));var jayson=require(_0x10e1('0x9'));var client=jayson[_0x10e1('0xa')][_0x10e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdf8d31,_0xf0bb9c,_0xe3d0c3){return new BPromise(function(_0x15ca0f,_0x281aba){return client[_0x10e1('0xc')](_0xdf8d31,_0xe3d0c3)[_0x10e1('0xd')](function(_0x52f966){logger[_0x10e1('0xe')](_0x10e1('0xf'),_0xf0bb9c,'request\x20sent');logger[_0x10e1('0x10')](_0x10e1('0x11'),_0xf0bb9c,_0x10e1('0x12'),JSON[_0x10e1('0x13')](_0x52f966));if(_0x52f966[_0x10e1('0x14')]){if(_0x52f966[_0x10e1('0x14')][_0x10e1('0x15')]===0x1f4){logger[_0x10e1('0x14')](_0x10e1('0xf'),_0xf0bb9c,_0x52f966[_0x10e1('0x14')][_0x10e1('0x16')]);return _0x281aba(_0x52f966['error'][_0x10e1('0x16')]);}logger[_0x10e1('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0xf0bb9c,_0x52f966[_0x10e1('0x14')][_0x10e1('0x16')]);return _0x15ca0f(_0x52f966[_0x10e1('0x14')][_0x10e1('0x16')]);}else{logger['info'](_0x10e1('0xf'),_0xf0bb9c,'request\x20sent');_0x15ca0f(_0x52f966[_0x10e1('0x17')][_0x10e1('0x16')]);}})['catch'](function(_0x3ecb67){logger[_0x10e1('0x14')](_0x10e1('0xf'),_0xf0bb9c,_0x3ecb67);_0x281aba(_0x3ecb67);});});} \ No newline at end of file +var _0x4846=['message','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4846,0x1cb));var _0x6484=function(_0x4008f0,_0x17f1b2){_0x4008f0=_0x4008f0-0x0;var _0xb42e88=_0x4846[_0x4008f0];return _0xb42e88;};'use strict';var _=require(_0x6484('0x0'));var util=require(_0x6484('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6484('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6484('0x3'));var logger=require(_0x6484('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6484('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1ea68e,_0x4ff5e6,_0x5b8a19){return new BPromise(function(_0x2d4396,_0x1eb024){return client[_0x6484('0x6')](_0x1ea68e,_0x5b8a19)[_0x6484('0x7')](function(_0x42a612){logger[_0x6484('0x8')](_0x6484('0x9'),_0x4ff5e6,'request\x20sent');logger[_0x6484('0xa')](_0x6484('0xb'),_0x4ff5e6,_0x6484('0xc'),JSON[_0x6484('0xd')](_0x42a612));if(_0x42a612['error']){if(_0x42a612[_0x6484('0xe')][_0x6484('0xf')]===0x1f4){logger[_0x6484('0xe')](_0x6484('0x9'),_0x4ff5e6,_0x42a612['error'][_0x6484('0x10')]);return _0x1eb024(_0x42a612[_0x6484('0xe')]['message']);}logger[_0x6484('0xe')](_0x6484('0x9'),_0x4ff5e6,_0x42a612[_0x6484('0xe')]['message']);return _0x2d4396(_0x42a612[_0x6484('0xe')]['message']);}else{logger[_0x6484('0x8')](_0x6484('0x9'),_0x4ff5e6,_0x6484('0xc'));_0x2d4396(_0x42a612[_0x6484('0x11')]['message']);}})[_0x6484('0x12')](function(_0x2b26a3){logger[_0x6484('0xe')](_0x6484('0x9'),_0x4ff5e6,_0x2b26a3);_0x1eb024(_0x2b26a3);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 395467c..6d16099 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 _0x0424=['index','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x110528,_0x13f686){var _0x477e3e=function(_0x1f2631){while(--_0x1f2631){_0x110528['push'](_0x110528['shift']());}};_0x477e3e(++_0x13f686);}(_0x0424,0x159));var _0x4042=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x0424[_0x419e17];return _0x1f2044;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4042('0x4'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x4042('0x5')]('/',auth[_0x4042('0x6')](),controller[_0x4042('0x7')]);router[_0x4042('0x5')](_0x4042('0x8'),auth[_0x4042('0x6')](),controller[_0x4042('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4042('0xa')]);router[_0x4042('0xb')](_0x4042('0x8'),auth['isAuthenticated'](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0x8'),auth[_0x4042('0x6')](),controller[_0x4042('0xe')]);module[_0x4042('0xf')]=router; \ No newline at end of file +var _0x4e2e=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x3ff47f,_0x3738a8){var _0x2c7779=function(_0x4714f3){while(--_0x4714f3){_0x3ff47f['push'](_0x3ff47f['shift']());}};_0x2c7779(++_0x3738a8);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x4aac06,_0x4ef249){_0x4aac06=_0x4aac06-0x0;var _0x57a78e=_0x4e2e[_0x4aac06];return _0x57a78e;};'use strict';var multer=require('multer');var util=require(_0xe4e2('0x0'));var path=require(_0xe4e2('0x1'));var timeout=require(_0xe4e2('0x2'));var express=require(_0xe4e2('0x3'));var router=express[_0xe4e2('0x4')]();var auth=require(_0xe4e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4e2('0x6'));var controller=require(_0xe4e2('0x7'));router[_0xe4e2('0x8')]('/',auth[_0xe4e2('0x9')](),controller['index']);router[_0xe4e2('0x8')](_0xe4e2('0xa'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xb')]);router[_0xe4e2('0xc')]('/',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xd')]);router[_0xe4e2('0xe')]('/:id',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xf')]);router[_0xe4e2('0x10')]('/:id',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x11')]);module[_0xe4e2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 5f6c8a1..ea9e38f 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 _0xb90d=['exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x13fde2,_0x4947cf){var _0x423bd3=function(_0x531949){while(--_0x531949){_0x13fde2['push'](_0x13fde2['shift']());}};_0x423bd3(++_0x4947cf);}(_0xb90d,0x17a));var _0xdb90=function(_0x48b724,_0x5a8e26){_0x48b724=_0x48b724-0x0;var _0x4d38b3=_0xb90d[_0x48b724];return _0x4d38b3;};'use strict';var Sequelize=require('sequelize');module[_0xdb90('0x0')]={'type':{'type':Sequelize[_0xdb90('0x1')](_0xdb90('0x2'),_0xdb90('0x3'),_0xdb90('0x4'),_0xdb90('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdb90('0x6')]},'key':{'type':Sequelize[_0xdb90('0x6')]},'keyType':{'type':Sequelize[_0xdb90('0x1')]('string','variable',_0xdb90('0x4'))},'keyContent':{'type':Sequelize[_0xdb90('0x6')]},'idField':{'type':Sequelize[_0xdb90('0x6')]},'nameField':{'type':Sequelize[_0xdb90('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb90('0x6')]}}; \ No newline at end of file +var _0x8f2d=['variable','customVariable','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x8f2d,0xd5));var _0xd8f2=function(_0x34e943,_0x4eb0f0){_0x34e943=_0x34e943-0x0;var _0x8a251c=_0x8f2d[_0x34e943];return _0x8a251c;};'use strict';var Sequelize=require(_0xd8f2('0x0'));module[_0xd8f2('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd8f2('0x2'),_0xd8f2('0x3'),_0xd8f2('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd8f2('0x5')]},'key':{'type':Sequelize[_0xd8f2('0x5')]},'keyType':{'type':Sequelize[_0xd8f2('0x6')](_0xd8f2('0x2'),_0xd8f2('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd8f2('0x5')]},'idField':{'type':Sequelize[_0xd8f2('0x5')]},'nameField':{'type':Sequelize[_0xd8f2('0x5')]},'customField':{'type':Sequelize[_0xd8f2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd8f2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index cf42515..1cd9920 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 _0x5ec5=['destroy','stack','name','send','index','ZohoField','rawAttributes','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','key','VIRTUAL','field','options','includeAll','catch','include','find','create','body','update','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5ec5,0xa3));var _0x55ec=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5ec5[_0x1d1779];return _0x2377e9;};'use strict';var pdf=require(_0x55ec('0x0'));var emlformat=require(_0x55ec('0x1'));var rimraf=require(_0x55ec('0x2'));var zipdir=require(_0x55ec('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55ec('0x4'));var moment=require(_0x55ec('0x5'));var BPromise=require(_0x55ec('0x6'));var Mustache=require(_0x55ec('0x7'));var util=require('util');var path=require(_0x55ec('0x8'));var sox=require('sox');var csv=require(_0x55ec('0x9'));var ejs=require(_0x55ec('0xa'));var fs=require('fs');var _=require(_0x55ec('0xb'));var squel=require(_0x55ec('0xc'));var crypto=require(_0x55ec('0xd'));var jsforce=require(_0x55ec('0xe'));var deskjs=require(_0x55ec('0xf'));var toCsv=require(_0x55ec('0x9'));var querystring=require(_0x55ec('0x10'));var Papa=require('papaparse');var Redis=require(_0x55ec('0x11'));var authService=require(_0x55ec('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x55ec('0x13'));var logger=require(_0x55ec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x55ec('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8f816f,_0x30c698){_0x30c698=_0x30c698||0xcc;return function(_0x188657){if(_0x188657){return _0x8f816f[_0x55ec('0x16')](_0x30c698);}return _0x8f816f['status'](_0x30c698)[_0x55ec('0x17')]();};}function respondWithResult(_0x4ca507,_0x5530c6){_0x5530c6=_0x5530c6||0xc8;return function(_0x59240f){if(_0x59240f){return _0x4ca507[_0x55ec('0x18')](_0x5530c6)[_0x55ec('0x19')](_0x59240f);}};}function respondWithFilteredResult(_0x8d1436,_0x588011){return function(_0xe12a9){if(_0xe12a9){var _0x2741ce=_0xe12a9[_0x55ec('0x1a')],_0x1c1edf=_0x588011[_0x55ec('0x1b')],_0x5302b7=_0x588011[_0x55ec('0x1b')]+_0x588011[_0x55ec('0x1c')],_0x1b79c9;if(_0x5302b7>=_0x2741ce){_0x5302b7=_0x2741ce;_0x1b79c9=0xc8;}else{_0x1b79c9=0xce;}_0x8d1436[_0x55ec('0x18')](_0x1b79c9);return _0x8d1436['set'](_0x55ec('0x1d'),_0x1c1edf+'-'+_0x5302b7+'/'+_0x2741ce)[_0x55ec('0x19')](_0xe12a9);}return null;};}function patchUpdates(_0x5d5807){return function(_0x28d0f0){try{jsonpatch[_0x55ec('0x1e')](_0x28d0f0,_0x5d5807,!![]);}catch(_0x44d95b){return BPromise['reject'](_0x44d95b);}return _0x28d0f0['save']();};}function saveUpdates(_0x20c525,_0x4048c4){return function(_0x1e3daf){if(_0x1e3daf){return _0x1e3daf['update'](_0x20c525)[_0x55ec('0x1f')](function(_0x3fefeb){return _0x3fefeb;});}return null;};}function removeEntity(_0x5635f4,_0x270569){return function(_0x4e35e4){if(_0x4e35e4){return _0x4e35e4[_0x55ec('0x20')]()[_0x55ec('0x1f')](function(){_0x5635f4[_0x55ec('0x18')](0xcc)[_0x55ec('0x17')]();});}};}function handleEntityNotFound(_0xaf02ec,_0x45ae02){return function(_0x11213e){if(!_0x11213e){_0xaf02ec['sendStatus'](0x194);}return _0x11213e;};}function handleError(_0x317b61,_0x3683aa){_0x3683aa=_0x3683aa||0x1f4;return function(_0x17accc){logger['error'](_0x17accc[_0x55ec('0x21')]);if(_0x17accc['name']){delete _0x17accc[_0x55ec('0x22')];}_0x317b61[_0x55ec('0x18')](_0x3683aa)[_0x55ec('0x23')](_0x17accc);};}exports[_0x55ec('0x24')]=function(_0x270a98,_0xafb159){var _0x253228={},_0x5f2b1f={},_0x27b827={'count':0x0,'rows':[]};var _0xcf0d38=db[_0x55ec('0x25')][_0x55ec('0x26')];_0x5f2b1f[_0x55ec('0x27')]=_[_0x55ec('0x28')](_0xcf0d38);_0x5f2b1f['query']=_[_0x55ec('0x28')](_0x270a98['query']);_0x5f2b1f[_0x55ec('0x29')]=_[_0x55ec('0x2a')](_0x5f2b1f[_0x55ec('0x27')],_0x5f2b1f[_0x55ec('0x2b')]);_0x253228['attributes']=_[_0x55ec('0x2a')](_0x5f2b1f[_0x55ec('0x27')],qs[_0x55ec('0x2c')](_0x270a98[_0x55ec('0x2b')][_0x55ec('0x2c')]));_0x253228[_0x55ec('0x2d')]=_0x253228['attributes'][_0x55ec('0x2e')]?_0x253228[_0x55ec('0x2d')]:_0x5f2b1f[_0x55ec('0x27')];if(!_0x270a98[_0x55ec('0x2b')][_0x55ec('0x2f')](_0x55ec('0x30'))){_0x253228[_0x55ec('0x1c')]=qs[_0x55ec('0x1c')](_0x270a98[_0x55ec('0x2b')][_0x55ec('0x1c')]);_0x253228['offset']=qs[_0x55ec('0x1b')](_0x270a98[_0x55ec('0x2b')]['offset']);}_0x253228[_0x55ec('0x31')]=qs[_0x55ec('0x32')](_0x270a98['query']['sort']);_0x253228[_0x55ec('0x33')]=qs[_0x55ec('0x29')](_['pick'](_0x270a98['query'],_0x5f2b1f[_0x55ec('0x29')]));if(_0x270a98[_0x55ec('0x2b')]['filter']){_0x253228[_0x55ec('0x33')]=_[_0x55ec('0x34')](_0x253228['where'],{'$or':_['map'](_0xcf0d38,function(_0x4966e0){if(_0x4966e0['type'][_0x55ec('0x35')]!==_0x55ec('0x36')){var _0x20b179={};_0x20b179[_0x4966e0[_0x55ec('0x37')]]={'$like':'%'+_0x270a98[_0x55ec('0x2b')]['filter']+'%'};return _0x20b179;}})});}_0x253228=_[_0x55ec('0x34')]({},_0x253228,_0x270a98[_0x55ec('0x38')]);var _0x4a625b={'where':_0x253228[_0x55ec('0x33')]};return db[_0x55ec('0x25')][_0x55ec('0x1a')](_0x4a625b)['then'](function(_0x5e54bb){_0x27b827[_0x55ec('0x1a')]=_0x5e54bb;if(_0x270a98[_0x55ec('0x2b')][_0x55ec('0x39')]){_0x253228['include']=[{'all':!![]}];}return db[_0x55ec('0x25')]['findAll'](_0x253228);})[_0x55ec('0x1f')](function(_0x54ec83){_0x27b827['rows']=_0x54ec83;return _0x27b827;})['then'](respondWithFilteredResult(_0xafb159,_0x253228))[_0x55ec('0x3a')](handleError(_0xafb159,null));};exports['show']=function(_0x415d3d,_0xf262f4){var _0x2da760={'raw':!![],'where':{'id':_0x415d3d['params']['id']}},_0x4283a6={};_0x4283a6[_0x55ec('0x27')]=_[_0x55ec('0x28')](db[_0x55ec('0x25')]['rawAttributes']);_0x4283a6[_0x55ec('0x2b')]=_[_0x55ec('0x28')](_0x415d3d[_0x55ec('0x2b')]);_0x4283a6[_0x55ec('0x29')]=_['intersection'](_0x4283a6[_0x55ec('0x27')],_0x4283a6[_0x55ec('0x2b')]);_0x2da760[_0x55ec('0x2d')]=_[_0x55ec('0x2a')](_0x4283a6[_0x55ec('0x27')],qs[_0x55ec('0x2c')](_0x415d3d[_0x55ec('0x2b')]['fields']));_0x2da760[_0x55ec('0x2d')]=_0x2da760['attributes']['length']?_0x2da760['attributes']:_0x4283a6[_0x55ec('0x27')];if(_0x415d3d[_0x55ec('0x2b')][_0x55ec('0x39')]){_0x2da760[_0x55ec('0x3b')]=[{'all':!![]}];}_0x2da760=_['merge']({},_0x2da760,_0x415d3d[_0x55ec('0x38')]);return db[_0x55ec('0x25')][_0x55ec('0x3c')](_0x2da760)[_0x55ec('0x1f')](handleEntityNotFound(_0xf262f4,null))[_0x55ec('0x1f')](respondWithResult(_0xf262f4,null))[_0x55ec('0x3a')](handleError(_0xf262f4,null));};exports[_0x55ec('0x3d')]=function(_0x182287,_0xc87522){return db[_0x55ec('0x25')][_0x55ec('0x3d')](_0x182287[_0x55ec('0x3e')],{})[_0x55ec('0x1f')](respondWithResult(_0xc87522,0xc9))[_0x55ec('0x3a')](handleError(_0xc87522,null));};exports[_0x55ec('0x3f')]=function(_0x11e4d6,_0x35d8f6){if(_0x11e4d6[_0x55ec('0x3e')]['id']){delete _0x11e4d6[_0x55ec('0x3e')]['id'];}return db[_0x55ec('0x25')]['find']({'where':{'id':_0x11e4d6[_0x55ec('0x40')]['id']}})[_0x55ec('0x1f')](handleEntityNotFound(_0x35d8f6,null))[_0x55ec('0x1f')](saveUpdates(_0x11e4d6[_0x55ec('0x3e')],null))['then'](respondWithResult(_0x35d8f6,null))[_0x55ec('0x3a')](handleError(_0x35d8f6,null));};exports['destroy']=function(_0x28b434,_0x3700c0){return db['ZohoField']['find']({'where':{'id':_0x28b434[_0x55ec('0x40')]['id']}})[_0x55ec('0x1f')](handleEntityNotFound(_0x3700c0,null))[_0x55ec('0x1f')](removeEntity(_0x3700c0,null))[_0x55ec('0x3a')](handleError(_0x3700c0,null));}; \ No newline at end of file +var _0xda0f=['api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','end','error','stack','name','send','index','ZohoField','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','type','key','field','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4e34cf,_0x57c673){var _0x374a35=function(_0x41134f){while(--_0x41134f){_0x4e34cf['push'](_0x4e34cf['shift']());}};_0x374a35(++_0x57c673);}(_0xda0f,0x7d));var _0xfda0=function(_0x3f7830,_0x2ef515){_0x3f7830=_0x3f7830-0x0;var _0x392bcf=_0xda0f[_0x3f7830];return _0x392bcf;};'use strict';var pdf=require(_0xfda0('0x0'));var emlformat=require(_0xfda0('0x1'));var rimraf=require(_0xfda0('0x2'));var zipdir=require(_0xfda0('0x3'));var jsonpatch=require(_0xfda0('0x4'));var rp=require(_0xfda0('0x5'));var moment=require(_0xfda0('0x6'));var BPromise=require(_0xfda0('0x7'));var Mustache=require(_0xfda0('0x8'));var util=require(_0xfda0('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xfda0('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfda0('0xb'));var crypto=require('crypto');var jsforce=require(_0xfda0('0xc'));var deskjs=require(_0xfda0('0xd'));var toCsv=require(_0xfda0('0xa'));var querystring=require('querystring');var Papa=require(_0xfda0('0xe'));var Redis=require('ioredis');var authService=require(_0xfda0('0xf'));var qs=require(_0xfda0('0x10'));var hardwareService=require(_0xfda0('0x11'));var logger=require(_0xfda0('0x12'))(_0xfda0('0x13'));var utils=require(_0xfda0('0x14'));var config=require('../../config/environment');var db=require(_0xfda0('0x15'))['db'];function respondWithStatusCode(_0x5bc7dc,_0x455cf4){_0x455cf4=_0x455cf4||0xcc;return function(_0x42c5e1){if(_0x42c5e1){return _0x5bc7dc[_0xfda0('0x16')](_0x455cf4);}return _0x5bc7dc[_0xfda0('0x17')](_0x455cf4)['end']();};}function respondWithResult(_0x1f8d0c,_0xe292d1){_0xe292d1=_0xe292d1||0xc8;return function(_0x8914ad){if(_0x8914ad){return _0x1f8d0c[_0xfda0('0x17')](_0xe292d1)[_0xfda0('0x18')](_0x8914ad);}};}function respondWithFilteredResult(_0x3ab98a,_0x75147c){return function(_0x2adec9){if(_0x2adec9){var _0xac3649=_0x2adec9[_0xfda0('0x19')],_0x556b2a=_0x75147c['offset'],_0x400f15=_0x75147c[_0xfda0('0x1a')]+_0x75147c[_0xfda0('0x1b')],_0xdebdf2;if(_0x400f15>=_0xac3649){_0x400f15=_0xac3649;_0xdebdf2=0xc8;}else{_0xdebdf2=0xce;}_0x3ab98a[_0xfda0('0x17')](_0xdebdf2);return _0x3ab98a['set']('Content-Range',_0x556b2a+'-'+_0x400f15+'/'+_0xac3649)[_0xfda0('0x18')](_0x2adec9);}return null;};}function patchUpdates(_0x35bc65){return function(_0x1c11ef){try{jsonpatch[_0xfda0('0x1c')](_0x1c11ef,_0x35bc65,!![]);}catch(_0x36ac56){return BPromise[_0xfda0('0x1d')](_0x36ac56);}return _0x1c11ef[_0xfda0('0x1e')]();};}function saveUpdates(_0xe0e34c,_0x200f45){return function(_0x3cdf94){if(_0x3cdf94){return _0x3cdf94[_0xfda0('0x1f')](_0xe0e34c)[_0xfda0('0x20')](function(_0x3844ba){return _0x3844ba;});}return null;};}function removeEntity(_0x3800f9,_0x196c69){return function(_0x834dfb){if(_0x834dfb){return _0x834dfb['destroy']()[_0xfda0('0x20')](function(){_0x3800f9[_0xfda0('0x17')](0xcc)[_0xfda0('0x21')]();});}};}function handleEntityNotFound(_0x5a2445,_0x32b151){return function(_0x376132){if(!_0x376132){_0x5a2445[_0xfda0('0x16')](0x194);}return _0x376132;};}function handleError(_0x47c58a,_0x4985f1){_0x4985f1=_0x4985f1||0x1f4;return function(_0x58f0ca){logger[_0xfda0('0x22')](_0x58f0ca[_0xfda0('0x23')]);if(_0x58f0ca['name']){delete _0x58f0ca[_0xfda0('0x24')];}_0x47c58a[_0xfda0('0x17')](_0x4985f1)[_0xfda0('0x25')](_0x58f0ca);};}exports[_0xfda0('0x26')]=function(_0x46eb1c,_0x264b90){var _0x6b49cc={},_0x59a042={},_0x3db987={'count':0x0,'rows':[]};var _0x3395e5=db[_0xfda0('0x27')][_0xfda0('0x28')];_0x59a042[_0xfda0('0x29')]=_[_0xfda0('0x2a')](_0x3395e5);_0x59a042[_0xfda0('0x2b')]=_[_0xfda0('0x2a')](_0x46eb1c[_0xfda0('0x2b')]);_0x59a042['filters']=_[_0xfda0('0x2c')](_0x59a042[_0xfda0('0x29')],_0x59a042[_0xfda0('0x2b')]);_0x6b49cc['attributes']=_['intersection'](_0x59a042['model'],qs[_0xfda0('0x2d')](_0x46eb1c[_0xfda0('0x2b')][_0xfda0('0x2d')]));_0x6b49cc[_0xfda0('0x2e')]=_0x6b49cc['attributes'][_0xfda0('0x2f')]?_0x6b49cc['attributes']:_0x59a042['model'];if(!_0x46eb1c[_0xfda0('0x2b')][_0xfda0('0x30')](_0xfda0('0x31'))){_0x6b49cc[_0xfda0('0x1b')]=qs[_0xfda0('0x1b')](_0x46eb1c[_0xfda0('0x2b')]['limit']);_0x6b49cc['offset']=qs[_0xfda0('0x1a')](_0x46eb1c['query'][_0xfda0('0x1a')]);}_0x6b49cc[_0xfda0('0x32')]=qs[_0xfda0('0x33')](_0x46eb1c[_0xfda0('0x2b')][_0xfda0('0x33')]);_0x6b49cc[_0xfda0('0x34')]=qs['filters'](_['pick'](_0x46eb1c['query'],_0x59a042[_0xfda0('0x35')]));if(_0x46eb1c[_0xfda0('0x2b')][_0xfda0('0x36')]){_0x6b49cc['where']=_[_0xfda0('0x37')](_0x6b49cc[_0xfda0('0x34')],{'$or':_[_0xfda0('0x38')](_0x3395e5,function(_0x2f7345){if(_0x2f7345[_0xfda0('0x39')][_0xfda0('0x3a')]!=='VIRTUAL'){var _0x3e8ef2={};_0x3e8ef2[_0x2f7345[_0xfda0('0x3b')]]={'$like':'%'+_0x46eb1c[_0xfda0('0x2b')][_0xfda0('0x36')]+'%'};return _0x3e8ef2;}})});}_0x6b49cc=_['merge']({},_0x6b49cc,_0x46eb1c['options']);var _0x44eb63={'where':_0x6b49cc[_0xfda0('0x34')]};return db[_0xfda0('0x27')][_0xfda0('0x19')](_0x44eb63)[_0xfda0('0x20')](function(_0x23f0de){_0x3db987[_0xfda0('0x19')]=_0x23f0de;if(_0x46eb1c['query']['includeAll']){_0x6b49cc[_0xfda0('0x3c')]=[{'all':!![]}];}return db['ZohoField'][_0xfda0('0x3d')](_0x6b49cc);})[_0xfda0('0x20')](function(_0x4a77ab){_0x3db987[_0xfda0('0x3e')]=_0x4a77ab;return _0x3db987;})[_0xfda0('0x20')](respondWithFilteredResult(_0x264b90,_0x6b49cc))[_0xfda0('0x3f')](handleError(_0x264b90,null));};exports[_0xfda0('0x40')]=function(_0x3dfd6b,_0x1c9ca5){var _0x4e5441={'raw':!![],'where':{'id':_0x3dfd6b[_0xfda0('0x41')]['id']}},_0x592dca={};_0x592dca[_0xfda0('0x29')]=_['keys'](db['ZohoField'][_0xfda0('0x28')]);_0x592dca['query']=_[_0xfda0('0x2a')](_0x3dfd6b[_0xfda0('0x2b')]);_0x592dca[_0xfda0('0x35')]=_[_0xfda0('0x2c')](_0x592dca['model'],_0x592dca['query']);_0x4e5441[_0xfda0('0x2e')]=_[_0xfda0('0x2c')](_0x592dca['model'],qs[_0xfda0('0x2d')](_0x3dfd6b[_0xfda0('0x2b')]['fields']));_0x4e5441[_0xfda0('0x2e')]=_0x4e5441[_0xfda0('0x2e')][_0xfda0('0x2f')]?_0x4e5441[_0xfda0('0x2e')]:_0x592dca['model'];if(_0x3dfd6b[_0xfda0('0x2b')][_0xfda0('0x42')]){_0x4e5441[_0xfda0('0x3c')]=[{'all':!![]}];}_0x4e5441=_[_0xfda0('0x37')]({},_0x4e5441,_0x3dfd6b[_0xfda0('0x43')]);return db[_0xfda0('0x27')][_0xfda0('0x44')](_0x4e5441)[_0xfda0('0x20')](handleEntityNotFound(_0x1c9ca5,null))[_0xfda0('0x20')](respondWithResult(_0x1c9ca5,null))[_0xfda0('0x3f')](handleError(_0x1c9ca5,null));};exports[_0xfda0('0x45')]=function(_0x41aa7a,_0x125a47){return db[_0xfda0('0x27')][_0xfda0('0x45')](_0x41aa7a[_0xfda0('0x46')],{})[_0xfda0('0x20')](respondWithResult(_0x125a47,0xc9))[_0xfda0('0x3f')](handleError(_0x125a47,null));};exports['update']=function(_0x4f33d0,_0x4abc00){if(_0x4f33d0[_0xfda0('0x46')]['id']){delete _0x4f33d0[_0xfda0('0x46')]['id'];}return db[_0xfda0('0x27')][_0xfda0('0x44')]({'where':{'id':_0x4f33d0[_0xfda0('0x41')]['id']}})[_0xfda0('0x20')](handleEntityNotFound(_0x4abc00,null))['then'](saveUpdates(_0x4f33d0[_0xfda0('0x46')],null))[_0xfda0('0x20')](respondWithResult(_0x4abc00,null))['catch'](handleError(_0x4abc00,null));};exports[_0xfda0('0x47')]=function(_0xa2b8d2,_0x3ff336){return db[_0xfda0('0x27')]['find']({'where':{'id':_0xa2b8d2[_0xfda0('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ff336,null))[_0xfda0('0x20')](removeEntity(_0x3ff336,null))['catch'](handleError(_0x3ff336,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index e4f24e0..b15adf6 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 _0x0701=['rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','util','../../config/logger','api','moment','bluebird'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x0701,0x7d));var _0x1070=function(_0x6e4501,_0x3d4298){_0x6e4501=_0x6e4501-0x0;var _0x5eb981=_0x0701[_0x6e4501];return _0x5eb981;};'use strict';var _=require('lodash');var util=require(_0x1070('0x0'));var logger=require(_0x1070('0x1'))(_0x1070('0x2'));var moment=require(_0x1070('0x3'));var BPromise=require(_0x1070('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1070('0x5'));var config=require('../../config/environment');var attributes=require(_0x1070('0x6'));module[_0x1070('0x7')]=function(_0x1ba6d4,_0x305681){return _0x1ba6d4[_0x1070('0x8')](_0x1070('0x9'),attributes,{'tableName':_0x1070('0xa'),'paranoid':![],'indexes':[{'name':_0x1070('0xb'),'fields':[_0x1070('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7beb=['ZohoField','FieldId','lodash','util','../../config/logger','moment','path','rimraf','./intZohoField.attributes'];(function(_0x6d0444,_0x2fba16){var _0x5468be=function(_0x120d95){while(--_0x120d95){_0x6d0444['push'](_0x6d0444['shift']());}};_0x5468be(++_0x2fba16);}(_0x7beb,0x158));var _0xb7be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7beb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb7be('0x0'));var util=require(_0xb7be('0x1'));var logger=require(_0xb7be('0x2'))('api');var moment=require(_0xb7be('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7be('0x4'));var rimraf=require(_0xb7be('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7be('0x6'));module['exports']=function(_0x5ecb27,_0x978072){return _0x5ecb27['define'](_0xb7be('0x7'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xb7be('0x8')],'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 079298a..fb160bf 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(_0x11b56a,_0x487b24){var _0x23fe46=function(_0x40878a){while(--_0x40878a){_0x11b56a['push'](_0x11b56a['shift']());}};_0x23fe46(++_0x487b24);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x576275,_0x30f911){_0x576275=_0x576275-0x0;var _0x123ad8=_0x3eea[_0x576275];return _0x123ad8;};'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 _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x505019,_0x41f2db){var _0x48de7a=function(_0x42b942){while(--_0x42b942){_0x505019['push'](_0x505019['shift']());}};_0x48de7a(++_0x41f2db);}(_0x5fd1,0x155));var _0x15fd=function(_0x4db1c9,_0x39cebd){_0x4db1c9=_0x4db1c9-0x0;var _0xed42d=_0x5fd1[_0x4db1c9];return _0xed42d;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 40a98f9..c2a740a 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 _0x5e3b=['exports','multer','util','path','connect-timeout','express','../../config/environment'];(function(_0x23ae94,_0x432bda){var _0x51e7ab=function(_0x52ab80){while(--_0x52ab80){_0x23ae94['push'](_0x23ae94['shift']());}};_0x51e7ab(++_0x432bda);}(_0x5e3b,0x135));var _0xb5e3=function(_0x3722b5,_0x5b2d78){_0x3722b5=_0x3722b5-0x0;var _0x30bfff=_0x5e3b[_0x3722b5];return _0x30bfff;};'use strict';var multer=require(_0xb5e3('0x0'));var util=require(_0xb5e3('0x1'));var path=require(_0xb5e3('0x2'));var timeout=require(_0xb5e3('0x3'));var express=require(_0xb5e3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5e3('0x5'));module[_0xb5e3('0x6')]=router; \ No newline at end of file +var _0x6fba=['connect-timeout','express','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x6fba,0x1f1));var _0xa6fb=function(_0x79f9c5,_0x3810eb){_0x79f9c5=_0x79f9c5-0x0;var _0x5e9537=_0x6fba[_0x79f9c5];return _0x5e9537;};'use strict';var multer=require(_0xa6fb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa6fb('0x1'));var express=require(_0xa6fb('0x2'));var router=express['Router']();var auth=require(_0xa6fb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa6fb('0x4'));module[_0xa6fb('0x5')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5a8e950..031df24 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 _0x8a17=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x92efd5,_0x359f66){var _0x22f4ba=function(_0x2a3aa7){while(--_0x2a3aa7){_0x92efd5['push'](_0x92efd5['shift']());}};_0x22f4ba(++_0x359f66);}(_0x8a17,0x117));var _0x78a1=function(_0x229d7e,_0x5bc489){_0x229d7e=_0x229d7e-0x0;var _0xa78280=_0x8a17[_0x229d7e];return _0xa78280;};'use strict';var Sequelize=require(_0x78a1('0x0'));module[_0x78a1('0x1')]={'name':{'type':Sequelize[_0x78a1('0x2')],'allowNull':![],'unique':_0x78a1('0x3')},'version':{'type':Sequelize[_0x78a1('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x78a1('0x4')},'filename':{'type':Sequelize[_0x78a1('0x2')]},'path':{'type':Sequelize[_0x78a1('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x78a1('0x5')]},'active':{'type':Sequelize[_0x78a1('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x78a1('0x2')]},'state':{'type':Sequelize[_0x78a1('0x2')],'unique':_0x78a1('0x7')},'description':{'type':Sequelize[_0x78a1('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x78a1('0x2')]},'link':{'type':Sequelize[_0x78a1('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x2a1f=['BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','INTEGER'];(function(_0x59ab0c,_0x1652ce){var _0x5794cf=function(_0xb6d31c){while(--_0xb6d31c){_0x59ab0c['push'](_0x59ab0c['shift']());}};_0x5794cf(++_0x1652ce);}(_0x2a1f,0x1ad));var _0xf2a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a1f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf2a1('0x0'));module[_0xf2a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf2a1('0x2')},'version':{'type':Sequelize[_0xf2a1('0x3')],'allowNull':![],'unique':_0xf2a1('0x2')},'main':{'type':Sequelize[_0xf2a1('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xf2a1('0x3')]},'path':{'type':Sequelize[_0xf2a1('0x3')]},'type':{'type':Sequelize[_0xf2a1('0x3')]},'size':{'type':Sequelize[_0xf2a1('0x4')]},'active':{'type':Sequelize[_0xf2a1('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xf2a1('0x3')]},'logo':{'type':Sequelize[_0xf2a1('0x3')]},'state':{'type':Sequelize['STRING'],'unique':_0xf2a1('0x6')},'description':{'type':Sequelize[_0xf2a1('0x3')]},'title':{'type':Sequelize[_0xf2a1('0x3')]},'remoteUri':{'type':Sequelize[_0xf2a1('0x3')]},'link':{'type':Sequelize[_0xf2a1('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 632a95d..9835ebf 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 _0x4389=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','destroy','then','error','stack','send','index','rawAttributes','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','key','VIRTUAL','options','Integration','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce'];(function(_0x2f75bb,_0x271a59){var _0x1e3572=function(_0x16de8b){while(--_0x16de8b){_0x2f75bb['push'](_0x2f75bb['shift']());}};_0x1e3572(++_0x271a59);}(_0x4389,0x113));var _0x9438=function(_0x183f52,_0x5b9cc3){_0x183f52=_0x183f52-0x0;var _0x1470e9=_0x4389[_0x183f52];return _0x1470e9;};'use strict';var pdf=require(_0x9438('0x0'));var emlformat=require(_0x9438('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9438('0x2'));var jsonpatch=require(_0x9438('0x3'));var rp=require('request-promise');var moment=require(_0x9438('0x4'));var BPromise=require(_0x9438('0x5'));var Mustache=require(_0x9438('0x6'));var util=require(_0x9438('0x7'));var path=require(_0x9438('0x8'));var sox=require(_0x9438('0x9'));var csv=require(_0x9438('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9438('0xb'));var jsforce=require(_0x9438('0xc'));var deskjs=require(_0x9438('0xd'));var toCsv=require(_0x9438('0xa'));var querystring=require(_0x9438('0xe'));var Papa=require(_0x9438('0xf'));var Redis=require(_0x9438('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9438('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9438('0x12'))(_0x9438('0x13'));var utils=require(_0x9438('0x14'));var config=require(_0x9438('0x15'));var db=require(_0x9438('0x16'))['db'];function respondWithStatusCode(_0x47e7b8,_0x542299){_0x542299=_0x542299||0xcc;return function(_0x34db28){if(_0x34db28){return _0x47e7b8[_0x9438('0x17')](_0x542299);}return _0x47e7b8[_0x9438('0x18')](_0x542299)[_0x9438('0x19')]();};}function respondWithResult(_0x4d007c,_0xfb8aa0){_0xfb8aa0=_0xfb8aa0||0xc8;return function(_0x573e41){if(_0x573e41){return _0x4d007c[_0x9438('0x18')](_0xfb8aa0)['json'](_0x573e41);}};}function respondWithFilteredResult(_0x380e26,_0x16ed56){return function(_0x1e808c){if(_0x1e808c){var _0x3ec2ff=_0x1e808c['count'],_0x25b8a5=_0x16ed56[_0x9438('0x1a')],_0x6b208f=_0x16ed56[_0x9438('0x1a')]+_0x16ed56[_0x9438('0x1b')],_0x57b850;if(_0x6b208f>=_0x3ec2ff){_0x6b208f=_0x3ec2ff;_0x57b850=0xc8;}else{_0x57b850=0xce;}_0x380e26[_0x9438('0x18')](_0x57b850);return _0x380e26[_0x9438('0x1c')]('Content-Range',_0x25b8a5+'-'+_0x6b208f+'/'+_0x3ec2ff)[_0x9438('0x1d')](_0x1e808c);}return null;};}function patchUpdates(_0x989410){return function(_0x16442e){try{jsonpatch[_0x9438('0x1e')](_0x16442e,_0x989410,!![]);}catch(_0x1173e6){return BPromise[_0x9438('0x1f')](_0x1173e6);}return _0x16442e[_0x9438('0x20')]();};}function saveUpdates(_0x3d37c1,_0x35a3dd){return function(_0x23efe6){if(_0x23efe6){return _0x23efe6[_0x9438('0x21')](_0x3d37c1)['then'](function(_0x2317f8){return _0x2317f8;});}return null;};}function removeEntity(_0x3d2c3b,_0x33fed6){return function(_0x53c99a){if(_0x53c99a){return _0x53c99a[_0x9438('0x22')]()[_0x9438('0x23')](function(){_0x3d2c3b[_0x9438('0x18')](0xcc)[_0x9438('0x19')]();});}};}function handleEntityNotFound(_0x138f72,_0x3ee2ba){return function(_0x15a6ca){if(!_0x15a6ca){_0x138f72[_0x9438('0x17')](0x194);}return _0x15a6ca;};}function handleError(_0x4004ee,_0x1c189f){_0x1c189f=_0x1c189f||0x1f4;return function(_0x229c1e){logger[_0x9438('0x24')](_0x229c1e[_0x9438('0x25')]);if(_0x229c1e['name']){delete _0x229c1e['name'];}_0x4004ee[_0x9438('0x18')](_0x1c189f)[_0x9438('0x26')](_0x229c1e);};}exports[_0x9438('0x27')]=function(_0x2bedbf,_0x3e1021){var _0x92a8af={},_0x144c13={},_0xd5750d={'count':0x0,'rows':[]};var _0x207055=db['Integration'][_0x9438('0x28')];_0x144c13['model']=_[_0x9438('0x29')](_0x207055);_0x144c13[_0x9438('0x2a')]=_[_0x9438('0x29')](_0x2bedbf['query']);_0x144c13['filters']=_[_0x9438('0x2b')](_0x144c13[_0x9438('0x2c')],_0x144c13['query']);_0x92a8af[_0x9438('0x2d')]=_[_0x9438('0x2b')](_0x144c13[_0x9438('0x2c')],qs[_0x9438('0x2e')](_0x2bedbf[_0x9438('0x2a')][_0x9438('0x2e')]));_0x92a8af[_0x9438('0x2d')]=_0x92a8af[_0x9438('0x2d')][_0x9438('0x2f')]?_0x92a8af[_0x9438('0x2d')]:_0x144c13[_0x9438('0x2c')];if(!_0x2bedbf['query'][_0x9438('0x30')](_0x9438('0x31'))){_0x92a8af[_0x9438('0x1b')]=qs[_0x9438('0x1b')](_0x2bedbf[_0x9438('0x2a')][_0x9438('0x1b')]);_0x92a8af[_0x9438('0x1a')]=qs[_0x9438('0x1a')](_0x2bedbf[_0x9438('0x2a')][_0x9438('0x1a')]);}_0x92a8af['order']=qs['sort'](_0x2bedbf[_0x9438('0x2a')][_0x9438('0x32')]);_0x92a8af[_0x9438('0x33')]=qs[_0x9438('0x34')](_[_0x9438('0x35')](_0x2bedbf[_0x9438('0x2a')],_0x144c13[_0x9438('0x34')]));if(_0x2bedbf[_0x9438('0x2a')][_0x9438('0x36')]){_0x92a8af['where']=_[_0x9438('0x37')](_0x92a8af[_0x9438('0x33')],{'$or':_[_0x9438('0x38')](_0x207055,function(_0x56c70c){if(_0x56c70c['type'][_0x9438('0x39')]!==_0x9438('0x3a')){var _0x253a9c={};_0x253a9c[_0x56c70c['field']]={'$like':'%'+_0x2bedbf['query'][_0x9438('0x36')]+'%'};return _0x253a9c;}})});}_0x92a8af=_[_0x9438('0x37')]({},_0x92a8af,_0x2bedbf[_0x9438('0x3b')]);var _0x31566f={'where':_0x92a8af[_0x9438('0x33')]};return db[_0x9438('0x3c')][_0x9438('0x3d')](_0x31566f)['then'](function(_0x3d62cb){_0xd5750d[_0x9438('0x3d')]=_0x3d62cb;if(_0x2bedbf[_0x9438('0x2a')][_0x9438('0x3e')]){_0x92a8af[_0x9438('0x3f')]=[{'all':!![]}];}return db['Integration'][_0x9438('0x40')](_0x92a8af);})['then'](function(_0x3e7303){_0xd5750d[_0x9438('0x41')]=_0x3e7303;return _0xd5750d;})['then'](respondWithFilteredResult(_0x3e1021,_0x92a8af))['catch'](handleError(_0x3e1021,null));};exports[_0x9438('0x42')]=function(_0x111600,_0x1651b1){var _0x633642={'raw':![],'where':{'id':_0x111600[_0x9438('0x43')]['id']}},_0x3d8256={};_0x3d8256[_0x9438('0x2c')]=_[_0x9438('0x29')](db[_0x9438('0x3c')][_0x9438('0x28')]);_0x3d8256['query']=_[_0x9438('0x29')](_0x111600['query']);_0x3d8256[_0x9438('0x34')]=_['intersection'](_0x3d8256[_0x9438('0x2c')],_0x3d8256[_0x9438('0x2a')]);_0x633642[_0x9438('0x2d')]=_[_0x9438('0x2b')](_0x3d8256[_0x9438('0x2c')],qs[_0x9438('0x2e')](_0x111600[_0x9438('0x2a')]['fields']));_0x633642[_0x9438('0x2d')]=_0x633642[_0x9438('0x2d')][_0x9438('0x2f')]?_0x633642[_0x9438('0x2d')]:_0x3d8256[_0x9438('0x2c')];if(_0x111600[_0x9438('0x2a')][_0x9438('0x3e')]){_0x633642[_0x9438('0x3f')]=[{'all':!![]}];}_0x633642=_[_0x9438('0x37')]({},_0x633642,_0x111600['options']);return db[_0x9438('0x3c')]['find'](_0x633642)[_0x9438('0x23')](handleEntityNotFound(_0x1651b1,null))[_0x9438('0x23')](respondWithResult(_0x1651b1,null))[_0x9438('0x44')](handleError(_0x1651b1,null));};exports[_0x9438('0x45')]=function(_0x52c49e,_0x3e7eb0){return db['Integration'][_0x9438('0x45')](_0x52c49e[_0x9438('0x46')],{})[_0x9438('0x23')](respondWithResult(_0x3e7eb0,0xc9))['catch'](handleError(_0x3e7eb0,null));};exports[_0x9438('0x21')]=function(_0x3775b6,_0x4482fa){if(_0x3775b6[_0x9438('0x46')]['id']){delete _0x3775b6['body']['id'];}return db[_0x9438('0x3c')]['find']({'where':{'id':_0x3775b6[_0x9438('0x43')]['id']}})[_0x9438('0x23')](handleEntityNotFound(_0x4482fa,null))['then'](saveUpdates(_0x3775b6[_0x9438('0x46')],null))[_0x9438('0x23')](respondWithResult(_0x4482fa,null))[_0x9438('0x44')](handleError(_0x4482fa,null));};exports[_0x9438('0x22')]=function(_0x295989,_0x16c1ee){return db['Integration'][_0x9438('0x47')]({'where':{'id':_0x295989[_0x9438('0x43')]['id']}})[_0x9438('0x23')](handleEntityNotFound(_0x16c1ee,null))[_0x9438('0x23')](removeEntity(_0x16c1ee,null))['catch'](handleError(_0x16c1ee,null));}; \ No newline at end of file +var _0x0332=['destroy','sendStatus','error','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','Integration','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','apply','reject','save','update','then'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x0332,0x72));var _0x2033=function(_0x1c7d93,_0x3c5644){_0x1c7d93=_0x1c7d93-0x0;var _0x2b51aa=_0x0332[_0x1c7d93];return _0x2b51aa;};'use strict';var pdf=require(_0x2033('0x0'));var emlformat=require(_0x2033('0x1'));var rimraf=require(_0x2033('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2033('0x3'));var rp=require(_0x2033('0x4'));var moment=require(_0x2033('0x5'));var BPromise=require(_0x2033('0x6'));var Mustache=require(_0x2033('0x7'));var util=require(_0x2033('0x8'));var path=require(_0x2033('0x9'));var sox=require(_0x2033('0xa'));var csv=require('to-csv');var ejs=require(_0x2033('0xb'));var fs=require('fs');var _=require(_0x2033('0xc'));var squel=require(_0x2033('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2033('0xe'));var toCsv=require(_0x2033('0xf'));var querystring=require(_0x2033('0x10'));var Papa=require(_0x2033('0x11'));var Redis=require('ioredis');var authService=require(_0x2033('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2033('0x13'))(_0x2033('0x14'));var utils=require(_0x2033('0x15'));var config=require('../../config/environment');var db=require(_0x2033('0x16'))['db'];function respondWithStatusCode(_0x2554cc,_0x3938c4){_0x3938c4=_0x3938c4||0xcc;return function(_0x59d3e1){if(_0x59d3e1){return _0x2554cc['sendStatus'](_0x3938c4);}return _0x2554cc[_0x2033('0x17')](_0x3938c4)[_0x2033('0x18')]();};}function respondWithResult(_0x2b3f4e,_0x43eb02){_0x43eb02=_0x43eb02||0xc8;return function(_0x1773a4){if(_0x1773a4){return _0x2b3f4e['status'](_0x43eb02)[_0x2033('0x19')](_0x1773a4);}};}function respondWithFilteredResult(_0x1a23ef,_0x3c4452){return function(_0x337b02){if(_0x337b02){var _0x57f37b=_0x337b02[_0x2033('0x1a')],_0x4d8a36=_0x3c4452['offset'],_0x56b818=_0x3c4452['offset']+_0x3c4452['limit'],_0x4fc263;if(_0x56b818>=_0x57f37b){_0x56b818=_0x57f37b;_0x4fc263=0xc8;}else{_0x4fc263=0xce;}_0x1a23ef[_0x2033('0x17')](_0x4fc263);return _0x1a23ef['set']('Content-Range',_0x4d8a36+'-'+_0x56b818+'/'+_0x57f37b)[_0x2033('0x19')](_0x337b02);}return null;};}function patchUpdates(_0xdbbe5a){return function(_0x546e8d){try{jsonpatch[_0x2033('0x1b')](_0x546e8d,_0xdbbe5a,!![]);}catch(_0x1b909b){return BPromise[_0x2033('0x1c')](_0x1b909b);}return _0x546e8d[_0x2033('0x1d')]();};}function saveUpdates(_0x5512e5,_0x4313fb){return function(_0x2ae5ab){if(_0x2ae5ab){return _0x2ae5ab[_0x2033('0x1e')](_0x5512e5)[_0x2033('0x1f')](function(_0x12fdef){return _0x12fdef;});}return null;};}function removeEntity(_0xf07764,_0x4b38cf){return function(_0x4de593){if(_0x4de593){return _0x4de593[_0x2033('0x20')]()[_0x2033('0x1f')](function(){_0xf07764['status'](0xcc)[_0x2033('0x18')]();});}};}function handleEntityNotFound(_0xa7f57c,_0x5939a7){return function(_0x5527a9){if(!_0x5527a9){_0xa7f57c[_0x2033('0x21')](0x194);}return _0x5527a9;};}function handleError(_0x5f3f53,_0x2c8b45){_0x2c8b45=_0x2c8b45||0x1f4;return function(_0x5ba95b){logger[_0x2033('0x22')](_0x5ba95b[_0x2033('0x23')]);if(_0x5ba95b[_0x2033('0x24')]){delete _0x5ba95b[_0x2033('0x24')];}_0x5f3f53['status'](_0x2c8b45)[_0x2033('0x25')](_0x5ba95b);};}exports[_0x2033('0x26')]=function(_0x582ea1,_0x2efac4){var _0x266599={},_0x332d37={},_0x361c39={'count':0x0,'rows':[]};var _0x144116=db['Integration'][_0x2033('0x27')];_0x332d37[_0x2033('0x28')]=_['keys'](_0x144116);_0x332d37[_0x2033('0x29')]=_[_0x2033('0x2a')](_0x582ea1['query']);_0x332d37[_0x2033('0x2b')]=_[_0x2033('0x2c')](_0x332d37['model'],_0x332d37[_0x2033('0x29')]);_0x266599['attributes']=_[_0x2033('0x2c')](_0x332d37[_0x2033('0x28')],qs[_0x2033('0x2d')](_0x582ea1[_0x2033('0x29')]['fields']));_0x266599[_0x2033('0x2e')]=_0x266599[_0x2033('0x2e')][_0x2033('0x2f')]?_0x266599[_0x2033('0x2e')]:_0x332d37['model'];if(!_0x582ea1['query'][_0x2033('0x30')](_0x2033('0x31'))){_0x266599['limit']=qs['limit'](_0x582ea1[_0x2033('0x29')][_0x2033('0x32')]);_0x266599[_0x2033('0x33')]=qs[_0x2033('0x33')](_0x582ea1[_0x2033('0x29')][_0x2033('0x33')]);}_0x266599['order']=qs['sort'](_0x582ea1[_0x2033('0x29')][_0x2033('0x34')]);_0x266599[_0x2033('0x35')]=qs['filters'](_[_0x2033('0x36')](_0x582ea1[_0x2033('0x29')],_0x332d37[_0x2033('0x2b')]));if(_0x582ea1['query'][_0x2033('0x37')]){_0x266599['where']=_[_0x2033('0x38')](_0x266599[_0x2033('0x35')],{'$or':_['map'](_0x144116,function(_0x2bcce1){if(_0x2bcce1[_0x2033('0x39')][_0x2033('0x3a')]!==_0x2033('0x3b')){var _0x2547ae={};_0x2547ae[_0x2bcce1[_0x2033('0x3c')]]={'$like':'%'+_0x582ea1['query']['filter']+'%'};return _0x2547ae;}})});}_0x266599=_[_0x2033('0x38')]({},_0x266599,_0x582ea1[_0x2033('0x3d')]);var _0x5c342c={'where':_0x266599['where']};return db[_0x2033('0x3e')][_0x2033('0x1a')](_0x5c342c)['then'](function(_0x2bed5b){_0x361c39[_0x2033('0x1a')]=_0x2bed5b;if(_0x582ea1[_0x2033('0x29')][_0x2033('0x3f')]){_0x266599[_0x2033('0x40')]=[{'all':!![]}];}return db[_0x2033('0x3e')][_0x2033('0x41')](_0x266599);})[_0x2033('0x1f')](function(_0xbfab49){_0x361c39[_0x2033('0x42')]=_0xbfab49;return _0x361c39;})[_0x2033('0x1f')](respondWithFilteredResult(_0x2efac4,_0x266599))[_0x2033('0x43')](handleError(_0x2efac4,null));};exports[_0x2033('0x44')]=function(_0x39315e,_0x48a3b5){var _0x51e74f={'raw':![],'where':{'id':_0x39315e[_0x2033('0x45')]['id']}},_0x116f36={};_0x116f36[_0x2033('0x28')]=_[_0x2033('0x2a')](db[_0x2033('0x3e')][_0x2033('0x27')]);_0x116f36['query']=_[_0x2033('0x2a')](_0x39315e['query']);_0x116f36[_0x2033('0x2b')]=_[_0x2033('0x2c')](_0x116f36[_0x2033('0x28')],_0x116f36[_0x2033('0x29')]);_0x51e74f['attributes']=_['intersection'](_0x116f36['model'],qs[_0x2033('0x2d')](_0x39315e[_0x2033('0x29')][_0x2033('0x2d')]));_0x51e74f[_0x2033('0x2e')]=_0x51e74f[_0x2033('0x2e')]['length']?_0x51e74f['attributes']:_0x116f36[_0x2033('0x28')];if(_0x39315e['query'][_0x2033('0x3f')]){_0x51e74f[_0x2033('0x40')]=[{'all':!![]}];}_0x51e74f=_[_0x2033('0x38')]({},_0x51e74f,_0x39315e[_0x2033('0x3d')]);return db[_0x2033('0x3e')][_0x2033('0x46')](_0x51e74f)['then'](handleEntityNotFound(_0x48a3b5,null))[_0x2033('0x1f')](respondWithResult(_0x48a3b5,null))[_0x2033('0x43')](handleError(_0x48a3b5,null));};exports[_0x2033('0x47')]=function(_0x44dd31,_0x4e157c){return db[_0x2033('0x3e')]['create'](_0x44dd31[_0x2033('0x48')],{})[_0x2033('0x1f')](respondWithResult(_0x4e157c,0xc9))['catch'](handleError(_0x4e157c,null));};exports['update']=function(_0x531b9d,_0x4f9880){if(_0x531b9d[_0x2033('0x48')]['id']){delete _0x531b9d[_0x2033('0x48')]['id'];}return db[_0x2033('0x3e')]['find']({'where':{'id':_0x531b9d[_0x2033('0x45')]['id']}})[_0x2033('0x1f')](handleEntityNotFound(_0x4f9880,null))[_0x2033('0x1f')](saveUpdates(_0x531b9d[_0x2033('0x48')],null))[_0x2033('0x1f')](respondWithResult(_0x4f9880,null))[_0x2033('0x43')](handleError(_0x4f9880,null));};exports[_0x2033('0x20')]=function(_0x5ba742,_0x51a095){return db['Integration']['find']({'where':{'id':_0x5ba742[_0x2033('0x45')]['id']}})[_0x2033('0x1f')](handleEntityNotFound(_0x51a095,null))[_0x2033('0x1f')](removeEntity(_0x51a095,null))[_0x2033('0x43')](handleError(_0x51a095,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 9ca2d27..9e50b69 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 _0x3573=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','util'];(function(_0x279d0d,_0x4f60e0){var _0x1a2a38=function(_0x4cee0f){while(--_0x4cee0f){_0x279d0d['push'](_0x279d0d['shift']());}};_0x1a2a38(++_0x4f60e0);}(_0x3573,0xec));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3357('0x0'));var util=require(_0x3357('0x1'));var logger=require(_0x3357('0x2'))(_0x3357('0x3'));var moment=require(_0x3357('0x4'));var BPromise=require(_0x3357('0x5'));var rp=require(_0x3357('0x6'));var fs=require('fs');var path=require(_0x3357('0x7'));var rimraf=require(_0x3357('0x8'));var config=require(_0x3357('0x9'));var attributes=require(_0x3357('0xa'));module[_0x3357('0xb')]=function(_0x33a45f,_0xc37020){return _0x33a45f[_0x3357('0xc')](_0x3357('0xd'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd98d=['Integration','integrations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x5d1c44,_0x148bd9){var _0x169c70=function(_0x5827a5){while(--_0x5827a5){_0x5d1c44['push'](_0x5d1c44['shift']());}};_0x169c70(++_0x148bd9);}(_0xd98d,0xe9));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdd98('0x0'));var util=require('util');var logger=require(_0xdd98('0x1'))(_0xdd98('0x2'));var moment=require(_0xdd98('0x3'));var BPromise=require(_0xdd98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd98('0x5'));var rimraf=require(_0xdd98('0x6'));var config=require(_0xdd98('0x7'));var attributes=require('./integration.attributes');module[_0xdd98('0x8')]=function(_0x39fdc8,_0x3a5022){return _0x39fdc8['define'](_0xdd98('0x9'),attributes,{'tableName':_0xdd98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 9f421f5..910356e 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 _0x2263=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s'];(function(_0x2608cc,_0x550602){var _0x671ece=function(_0x35a8ee){while(--_0x35a8ee){_0x2608cc['push'](_0x2608cc['shift']());}};_0x671ece(++_0x550602);}(_0x2263,0x6e));var _0x3226=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x2263[_0x235482];return _0x5f5bea;};'use strict';var _=require(_0x3226('0x0'));var util=require(_0x3226('0x1'));var moment=require(_0x3226('0x2'));var BPromise=require(_0x3226('0x3'));var rs=require(_0x3226('0x4'));var fs=require('fs');var Redis=require(_0x3226('0x5'));var db=require(_0x3226('0x6'))['db'];var utils=require(_0x3226('0x7'));var logger=require('../../config/logger')(_0x3226('0x8'));var config=require(_0x3226('0x9'));var jayson=require(_0x3226('0xa'));var client=jayson[_0x3226('0xb')][_0x3226('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52d8e2,_0x45feb1,_0x1e05af){return new BPromise(function(_0x5d235b,_0x5a0667){return client[_0x3226('0xd')](_0x52d8e2,_0x1e05af)[_0x3226('0xe')](function(_0x51e819){logger[_0x3226('0xf')](_0x3226('0x10'),_0x45feb1,_0x3226('0x11'));logger[_0x3226('0x12')](_0x3226('0x13'),_0x45feb1,_0x3226('0x11'),JSON[_0x3226('0x14')](_0x51e819));if(_0x51e819['error']){if(_0x51e819[_0x3226('0x15')][_0x3226('0x16')]===0x1f4){logger[_0x3226('0x15')](_0x3226('0x10'),_0x45feb1,_0x51e819['error']['message']);return _0x5a0667(_0x51e819['error']['message']);}logger['error'](_0x3226('0x10'),_0x45feb1,_0x51e819[_0x3226('0x15')][_0x3226('0x17')]);return _0x5d235b(_0x51e819[_0x3226('0x15')]['message']);}else{logger['info'](_0x3226('0x10'),_0x45feb1,_0x3226('0x11'));_0x5d235b(_0x51e819[_0x3226('0x18')]['message']);}})[_0x3226('0x19')](function(_0x20f66c){logger[_0x3226('0x15')](_0x3226('0x10'),_0x45feb1,_0x20f66c);_0x5a0667(_0x20f66c);});});} \ No newline at end of file +var _0xf6d0=['request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s'];(function(_0x575f38,_0xce451b){var _0x3b8af5=function(_0x5537d4){while(--_0x5537d4){_0x575f38['push'](_0x575f38['shift']());}};_0x3b8af5(++_0xce451b);}(_0xf6d0,0x163));var _0x0f6d=function(_0x37f5e7,_0x232de1){_0x37f5e7=_0x37f5e7-0x0;var _0x33e89a=_0xf6d0[_0x37f5e7];return _0x33e89a;};'use strict';var _=require(_0x0f6d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f6d('0x1'));var rs=require(_0x0f6d('0x2'));var fs=require('fs');var Redis=require(_0x0f6d('0x3'));var db=require(_0x0f6d('0x4'))['db'];var utils=require(_0x0f6d('0x5'));var logger=require('../../config/logger')(_0x0f6d('0x6'));var config=require(_0x0f6d('0x7'));var jayson=require(_0x0f6d('0x8'));var client=jayson[_0x0f6d('0x9')][_0x0f6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fb958,_0xee4ae7,_0x5c2d38){return new BPromise(function(_0x5657de,_0x2268f1){return client['request'](_0x3fb958,_0x5c2d38)[_0x0f6d('0xb')](function(_0x5990fb){logger['info'](_0x0f6d('0xc'),_0xee4ae7,_0x0f6d('0xd'));logger[_0x0f6d('0xe')](_0x0f6d('0xf'),_0xee4ae7,'request\x20sent',JSON[_0x0f6d('0x10')](_0x5990fb));if(_0x5990fb['error']){if(_0x5990fb[_0x0f6d('0x11')][_0x0f6d('0x12')]===0x1f4){logger[_0x0f6d('0x11')]('Integration,\x20%s,\x20%s',_0xee4ae7,_0x5990fb[_0x0f6d('0x11')]['message']);return _0x2268f1(_0x5990fb['error'][_0x0f6d('0x13')]);}logger[_0x0f6d('0x11')](_0x0f6d('0xc'),_0xee4ae7,_0x5990fb[_0x0f6d('0x11')][_0x0f6d('0x13')]);return _0x5657de(_0x5990fb[_0x0f6d('0x11')]['message']);}else{logger[_0x0f6d('0x14')](_0x0f6d('0xc'),_0xee4ae7,_0x0f6d('0xd'));_0x5657de(_0x5990fb[_0x0f6d('0x15')]['message']);}})[_0x0f6d('0x16')](function(_0x228088){logger[_0x0f6d('0x11')](_0x0f6d('0xc'),_0xee4ae7,_0x228088);_0x2268f1(_0x228088);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3fc8ea0..07ae5eb 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 _0xb81f=['../../config/environment','./integrationReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','util','../../components/auth/service','../../components/interaction/service'];(function(_0x449659,_0xbfb5aa){var _0x3e91e1=function(_0x44dbcc){while(--_0x44dbcc){_0x449659['push'](_0x449659['shift']());}};_0x3e91e1(++_0xbfb5aa);}(_0xb81f,0xcc));var _0xfb81=function(_0x50b424,_0x32ad9a){_0x50b424=_0x50b424-0x0;var _0x338920=_0xb81f[_0x50b424];return _0x338920;};'use strict';var multer=require(_0xfb81('0x0'));var util=require(_0xfb81('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfb81('0x2'));var interaction=require(_0xfb81('0x3'));var config=require(_0xfb81('0x4'));var controller=require(_0xfb81('0x5'));router[_0xfb81('0x6')]('/',auth['isAuthenticated'](),controller[_0xfb81('0x7')]);router[_0xfb81('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xfb81('0x8'),auth[_0xfb81('0x9')](),controller[_0xfb81('0xa')]);router[_0xfb81('0xb')]('/',auth[_0xfb81('0x9')](),controller[_0xfb81('0xc')]);router[_0xfb81('0xd')](_0xfb81('0x8'),auth[_0xfb81('0x9')](),controller['update']);router[_0xfb81('0xe')](_0xfb81('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xfb81('0xf')]=router; \ No newline at end of file +var _0x252f=['index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x252f,0xd0));var _0xf252=function(_0x2ba425,_0x58d262){_0x2ba425=_0x2ba425-0x0;var _0x5dee4f=_0x252f[_0x2ba425];return _0x5dee4f;};'use strict';var multer=require(_0xf252('0x0'));var util=require(_0xf252('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf252('0x2'));var router=express[_0xf252('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf252('0x4'));var controller=require(_0xf252('0x5'));router[_0xf252('0x6')]('/',auth[_0xf252('0x7')](),controller[_0xf252('0x8')]);router['get'](_0xf252('0x9'),auth[_0xf252('0x7')](),controller[_0xf252('0xa')]);router[_0xf252('0x6')](_0xf252('0xb'),auth['isAuthenticated'](),controller[_0xf252('0xc')]);router[_0xf252('0xd')]('/',auth['isAuthenticated'](),controller[_0xf252('0xe')]);router['put'](_0xf252('0xb'),auth['isAuthenticated'](),controller[_0xf252('0xf')]);router[_0xf252('0x10')](_0xf252('0xb'),auth[_0xf252('0x7')](),controller['destroy']);module[_0xf252('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 60ce225..5a23220 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 _0x1e80=['SENT','SENDING','RECEIVED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x253673,_0x3287fb){var _0x259903=function(_0x19b680){while(--_0x19b680){_0x253673['push'](_0x253673['shift']());}};_0x259903(++_0x3287fb);}(_0x1e80,0xf6));var _0x01e8=function(_0x81a3b2,_0x47b5e9){_0x81a3b2=_0x81a3b2-0x0;var _0x4c12a=_0x1e80[_0x81a3b2];return _0x4c12a;};'use strict';var Sequelize=require('sequelize');module[_0x01e8('0x0')]={'integration':{'type':Sequelize[_0x01e8('0x1')]},'eventChannel':{'type':Sequelize[_0x01e8('0x1')]},'exitStatus':{'type':Sequelize[_0x01e8('0x1')]},'ticketId':{'type':Sequelize[_0x01e8('0x1')]},'integrationId':{'type':Sequelize[_0x01e8('0x2')]},'contacts':{'type':Sequelize[_0x01e8('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x01e8('0x1')]},'calleridname':{'type':Sequelize[_0x01e8('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x01e8('0x1')]},'membername':{'type':Sequelize[_0x01e8('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x01e8('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x01e8('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x01e8('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x01e8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x01e8('0x2')]},'reason':{'type':Sequelize[_0x01e8('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x01e8('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x01e8('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x01e8('0x3')]},'lastevent':{'type':Sequelize[_0x01e8('0x1')]},'channel':{'type':Sequelize[_0x01e8('0x1')]},'channelstate':{'type':Sequelize[_0x01e8('0x2')]},'channelstatedesc':{'type':Sequelize[_0x01e8('0x1')]},'connectedlinenum':{'type':Sequelize[_0x01e8('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x01e8('0x1')]},'context':{'type':Sequelize[_0x01e8('0x1')]},'exten':{'type':Sequelize[_0x01e8('0x1')]},'priority':{'type':Sequelize[_0x01e8('0x1')]},'destchannel':{'type':Sequelize[_0x01e8('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x01e8('0x1')]},'destcalleridnum':{'type':Sequelize[_0x01e8('0x1')]},'destcalleridname':{'type':Sequelize[_0x01e8('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x01e8('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x01e8('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x01e8('0x1')]},'destexten':{'type':Sequelize[_0x01e8('0x1')]},'destpriority':{'type':Sequelize[_0x01e8('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x01e8('0x1')]},'subject':{'type':Sequelize[_0x01e8('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x01e8('0x1')]},'attachment':{'type':Sequelize[_0x01e8('0x5')]},'html':{'type':Sequelize[_0x01e8('0x5')]},'text':{'type':Sequelize[_0x01e8('0x5')]},'status':{'type':Sequelize['ENUM'](_0x01e8('0x6'),_0x01e8('0x7'),_0x01e8('0x8'),'FAILED')},'url':{'type':Sequelize[_0x01e8('0x1')]},'app':{'type':Sequelize[_0x01e8('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x01e8('0x2')]}}; \ No newline at end of file +var _0x02e5=['INTEGER','DATE','BOOLEAN','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x16cc87,_0x23244f){var _0xdc610f=function(_0x3ee20a){while(--_0x3ee20a){_0x16cc87['push'](_0x16cc87['shift']());}};_0xdc610f(++_0x23244f);}(_0x02e5,0xbb));var _0x502e=function(_0x2f3332,_0x13dc63){_0x2f3332=_0x2f3332-0x0;var _0xddc4d8=_0x02e5[_0x2f3332];return _0xddc4d8;};'use strict';var Sequelize=require(_0x502e('0x0'));module[_0x502e('0x1')]={'integration':{'type':Sequelize[_0x502e('0x2')]},'eventChannel':{'type':Sequelize[_0x502e('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x502e('0x2')]},'integrationId':{'type':Sequelize[_0x502e('0x3')]},'contacts':{'type':Sequelize[_0x502e('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x502e('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x502e('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x502e('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x502e('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x502e('0x4')]},'talktime':{'type':Sequelize[_0x502e('0x3')]},'agentacw':{'type':Sequelize[_0x502e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x502e('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x502e('0x4')]},'agentdump':{'type':Sequelize[_0x502e('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x502e('0x4')]},'lastevent':{'type':Sequelize[_0x502e('0x2')]},'channel':{'type':Sequelize[_0x502e('0x2')]},'channelstate':{'type':Sequelize[_0x502e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x502e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x502e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x502e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x502e('0x2')]},'exten':{'type':Sequelize[_0x502e('0x2')]},'priority':{'type':Sequelize[_0x502e('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x502e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x502e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x502e('0x2')]},'destcalleridname':{'type':Sequelize[_0x502e('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x502e('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x502e('0x2')]},'destcontext':{'type':Sequelize[_0x502e('0x2')]},'destexten':{'type':Sequelize[_0x502e('0x2')]},'destpriority':{'type':Sequelize[_0x502e('0x2')]},'destuniqueid':{'type':Sequelize[_0x502e('0x2')]},'messageId':{'type':Sequelize[_0x502e('0x2')]},'inReplyTo':{'type':Sequelize[_0x502e('0x2')]},'subject':{'type':Sequelize[_0x502e('0x2')]},'from':{'type':Sequelize[_0x502e('0x2')]},'to':{'type':Sequelize[_0x502e('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x502e('0x6')]('SENT',_0x502e('0x7'),_0x502e('0x8'),_0x502e('0x9'))},'url':{'type':Sequelize[_0x502e('0x2')]},'app':{'type':Sequelize[_0x502e('0x2')]},'appdata':{'type':Sequelize[_0x502e('0x2')]},'projectId':{'type':Sequelize[_0x502e('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9855d31..d88f2ed 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 _0x0f7e=['type','key','VIRTUAL','field','options','includeAll','include','rows','catch','params','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','update','then','end','stack','name','index','IntegrationReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map'];(function(_0x36402a,_0x2f929f){var _0x15e35c=function(_0x33cc16){while(--_0x33cc16){_0x36402a['push'](_0x36402a['shift']());}};_0x15e35c(++_0x2f929f);}(_0x0f7e,0x178));var _0xe0f7=function(_0x5f37ae,_0x1cd4d1){_0x5f37ae=_0x5f37ae-0x0;var _0x5426fc=_0x0f7e[_0x5f37ae];return _0x5426fc;};'use strict';var pdf=require(_0xe0f7('0x0'));var emlformat=require(_0xe0f7('0x1'));var rimraf=require(_0xe0f7('0x2'));var zipdir=require(_0xe0f7('0x3'));var jsonpatch=require(_0xe0f7('0x4'));var rp=require(_0xe0f7('0x5'));var moment=require(_0xe0f7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe0f7('0x7'));var util=require(_0xe0f7('0x8'));var path=require(_0xe0f7('0x9'));var sox=require('sox');var csv=require(_0xe0f7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe0f7('0xb'));var squel=require(_0xe0f7('0xc'));var crypto=require('crypto');var jsforce=require(_0xe0f7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe0f7('0xa'));var querystring=require(_0xe0f7('0xe'));var Papa=require(_0xe0f7('0xf'));var Redis=require(_0xe0f7('0x10'));var authService=require(_0xe0f7('0x11'));var qs=require(_0xe0f7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe0f7('0x13'));var utils=require(_0xe0f7('0x14'));var config=require(_0xe0f7('0x15'));var db=require(_0xe0f7('0x16'))['db'];function respondWithStatusCode(_0x119c4a,_0x46b748){_0x46b748=_0x46b748||0xcc;return function(_0x4bc8c8){if(_0x4bc8c8){return _0x119c4a[_0xe0f7('0x17')](_0x46b748);}return _0x119c4a['status'](_0x46b748)['end']();};}function respondWithResult(_0x107fd4,_0x408d64){_0x408d64=_0x408d64||0xc8;return function(_0x256307){if(_0x256307){return _0x107fd4[_0xe0f7('0x18')](_0x408d64)[_0xe0f7('0x19')](_0x256307);}};}function respondWithFilteredResult(_0x5a0f4a,_0x59dbf3){return function(_0x3707e6){if(_0x3707e6){var _0x308f49=_0x3707e6[_0xe0f7('0x1a')],_0x56d7b3=_0x59dbf3[_0xe0f7('0x1b')],_0x4cf882=_0x59dbf3[_0xe0f7('0x1b')]+_0x59dbf3['limit'],_0x42773b;if(_0x4cf882>=_0x308f49){_0x4cf882=_0x308f49;_0x42773b=0xc8;}else{_0x42773b=0xce;}_0x5a0f4a[_0xe0f7('0x18')](_0x42773b);return _0x5a0f4a[_0xe0f7('0x1c')](_0xe0f7('0x1d'),_0x56d7b3+'-'+_0x4cf882+'/'+_0x308f49)[_0xe0f7('0x19')](_0x3707e6);}return null;};}function patchUpdates(_0x100c30){return function(_0x413ec7){try{jsonpatch['apply'](_0x413ec7,_0x100c30,!![]);}catch(_0x37f094){return BPromise[_0xe0f7('0x1e')](_0x37f094);}return _0x413ec7['save']();};}function saveUpdates(_0x3688cf,_0xe9c374){return function(_0x34d2e9){if(_0x34d2e9){return _0x34d2e9[_0xe0f7('0x1f')](_0x3688cf)[_0xe0f7('0x20')](function(_0x310b6c){return _0x310b6c;});}return null;};}function removeEntity(_0x1ed3b9,_0x8009a7){return function(_0x11b1ae){if(_0x11b1ae){return _0x11b1ae['destroy']()[_0xe0f7('0x20')](function(){_0x1ed3b9['status'](0xcc)[_0xe0f7('0x21')]();});}};}function handleEntityNotFound(_0x99f569,_0x2c40b6){return function(_0x579a12){if(!_0x579a12){_0x99f569[_0xe0f7('0x17')](0x194);}return _0x579a12;};}function handleError(_0x139116,_0x212b0d){_0x212b0d=_0x212b0d||0x1f4;return function(_0x1de75a){logger['error'](_0x1de75a[_0xe0f7('0x22')]);if(_0x1de75a[_0xe0f7('0x23')]){delete _0x1de75a[_0xe0f7('0x23')];}_0x139116[_0xe0f7('0x18')](_0x212b0d)['send'](_0x1de75a);};}exports[_0xe0f7('0x24')]=function(_0x20bc39,_0x19e996){var _0x27d39d={},_0x52c756={},_0x549ed9={'count':0x0,'rows':[]};var _0x8da5c2=db[_0xe0f7('0x25')][_0xe0f7('0x26')];_0x52c756[_0xe0f7('0x27')]=_[_0xe0f7('0x28')](_0x8da5c2);_0x52c756[_0xe0f7('0x29')]=_[_0xe0f7('0x28')](_0x20bc39['query']);_0x52c756[_0xe0f7('0x2a')]=_[_0xe0f7('0x2b')](_0x52c756[_0xe0f7('0x27')],_0x52c756[_0xe0f7('0x29')]);_0x27d39d[_0xe0f7('0x2c')]=_['intersection'](_0x52c756['model'],qs[_0xe0f7('0x2d')](_0x20bc39['query'][_0xe0f7('0x2d')]));_0x27d39d[_0xe0f7('0x2c')]=_0x27d39d[_0xe0f7('0x2c')]['length']?_0x27d39d[_0xe0f7('0x2c')]:_0x52c756[_0xe0f7('0x27')];if(!_0x20bc39[_0xe0f7('0x29')][_0xe0f7('0x2e')](_0xe0f7('0x2f'))){_0x27d39d[_0xe0f7('0x30')]=qs[_0xe0f7('0x30')](_0x20bc39[_0xe0f7('0x29')][_0xe0f7('0x30')]);_0x27d39d['offset']=qs[_0xe0f7('0x1b')](_0x20bc39['query'][_0xe0f7('0x1b')]);}_0x27d39d[_0xe0f7('0x31')]=qs[_0xe0f7('0x32')](_0x20bc39[_0xe0f7('0x29')][_0xe0f7('0x32')]);_0x27d39d[_0xe0f7('0x33')]=qs[_0xe0f7('0x2a')](_[_0xe0f7('0x34')](_0x20bc39['query'],_0x52c756['filters']));if(_0x20bc39['query'][_0xe0f7('0x35')]){_0x27d39d[_0xe0f7('0x33')]=_[_0xe0f7('0x36')](_0x27d39d[_0xe0f7('0x33')],{'$or':_[_0xe0f7('0x37')](_0x8da5c2,function(_0x5e0c31){if(_0x5e0c31[_0xe0f7('0x38')][_0xe0f7('0x39')]!==_0xe0f7('0x3a')){var _0x172f20={};_0x172f20[_0x5e0c31[_0xe0f7('0x3b')]]={'$like':'%'+_0x20bc39[_0xe0f7('0x29')]['filter']+'%'};return _0x172f20;}})});}_0x27d39d=_['merge']({},_0x27d39d,_0x20bc39[_0xe0f7('0x3c')]);var _0x4e162c={'where':_0x27d39d[_0xe0f7('0x33')]};return db[_0xe0f7('0x25')][_0xe0f7('0x1a')](_0x4e162c)[_0xe0f7('0x20')](function(_0x181b0d){_0x549ed9[_0xe0f7('0x1a')]=_0x181b0d;if(_0x20bc39[_0xe0f7('0x29')][_0xe0f7('0x3d')]){_0x27d39d[_0xe0f7('0x3e')]=[{'all':!![]}];}return db[_0xe0f7('0x25')]['findAll'](_0x27d39d);})[_0xe0f7('0x20')](function(_0x55c628){_0x549ed9[_0xe0f7('0x3f')]=_0x55c628;return _0x549ed9;})['then'](respondWithFilteredResult(_0x19e996,_0x27d39d))[_0xe0f7('0x40')](handleError(_0x19e996,null));};exports['show']=function(_0x5390a1,_0x566bae){var _0x206bbf={'raw':![],'where':{'id':_0x5390a1[_0xe0f7('0x41')]['id']}},_0x364616={};_0x364616[_0xe0f7('0x27')]=_[_0xe0f7('0x28')](db[_0xe0f7('0x25')][_0xe0f7('0x26')]);_0x364616[_0xe0f7('0x29')]=_[_0xe0f7('0x28')](_0x5390a1[_0xe0f7('0x29')]);_0x364616['filters']=_[_0xe0f7('0x2b')](_0x364616['model'],_0x364616[_0xe0f7('0x29')]);_0x206bbf[_0xe0f7('0x2c')]=_[_0xe0f7('0x2b')](_0x364616['model'],qs['fields'](_0x5390a1[_0xe0f7('0x29')]['fields']));_0x206bbf[_0xe0f7('0x2c')]=_0x206bbf[_0xe0f7('0x2c')][_0xe0f7('0x42')]?_0x206bbf[_0xe0f7('0x2c')]:_0x364616[_0xe0f7('0x27')];if(_0x5390a1[_0xe0f7('0x29')][_0xe0f7('0x3d')]){_0x206bbf[_0xe0f7('0x3e')]=[{'all':!![]}];}_0x206bbf=_[_0xe0f7('0x36')]({},_0x206bbf,_0x5390a1['options']);return db[_0xe0f7('0x25')][_0xe0f7('0x43')](_0x206bbf)[_0xe0f7('0x20')](handleEntityNotFound(_0x566bae,null))[_0xe0f7('0x20')](respondWithResult(_0x566bae,null))['catch'](handleError(_0x566bae,null));};exports[_0xe0f7('0x44')]=function(_0x310b9e,_0x347250){return db['IntegrationReport'][_0xe0f7('0x44')](_0x310b9e[_0xe0f7('0x45')],{})[_0xe0f7('0x20')](respondWithResult(_0x347250,0xc9))['catch'](handleError(_0x347250,null));};exports[_0xe0f7('0x1f')]=function(_0x46e18a,_0x3bd162){if(_0x46e18a['body']['id']){delete _0x46e18a['body']['id'];}return db[_0xe0f7('0x25')][_0xe0f7('0x43')]({'where':{'id':_0x46e18a[_0xe0f7('0x41')]['id']}})[_0xe0f7('0x20')](handleEntityNotFound(_0x3bd162,null))[_0xe0f7('0x20')](saveUpdates(_0x46e18a[_0xe0f7('0x45')],null))[_0xe0f7('0x20')](respondWithResult(_0x3bd162,null))[_0xe0f7('0x40')](handleError(_0x3bd162,null));};exports[_0xe0f7('0x46')]=function(_0x5a3b96,_0x4f44bb){return db[_0xe0f7('0x25')][_0xe0f7('0x43')]({'where':{'id':_0x5a3b96[_0xe0f7('0x41')]['id']}})[_0xe0f7('0x20')](handleEntityNotFound(_0x4f44bb,null))[_0xe0f7('0x20')](removeEntity(_0x4f44bb,null))['catch'](handleError(_0x4f44bb,null));};exports[_0xe0f7('0x47')]=function(_0x46a7ff,_0x2d029c){return db[_0xe0f7('0x25')][_0xe0f7('0x47')]()[_0xe0f7('0x20')](respondWithResult(_0x2d029c,null))[_0xe0f7('0x40')](handleError(_0x2d029c,null));}; \ No newline at end of file +var _0xc1e4=['map','type','key','options','then','includeAll','include','catch','params','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','end','stack','name','IntegrationReport','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x395296,_0x1fcd27){var _0x5db637=function(_0x5ddf92){while(--_0x5ddf92){_0x395296['push'](_0x395296['shift']());}};_0x5db637(++_0x1fcd27);}(_0xc1e4,0x1b2));var _0x4c1e=function(_0x3ff1bb,_0x3965ba){_0x3ff1bb=_0x3ff1bb-0x0;var _0x4324d3=_0xc1e4[_0x3ff1bb];return _0x4324d3;};'use strict';var pdf=require(_0x4c1e('0x0'));var emlformat=require(_0x4c1e('0x1'));var rimraf=require(_0x4c1e('0x2'));var zipdir=require(_0x4c1e('0x3'));var jsonpatch=require(_0x4c1e('0x4'));var rp=require(_0x4c1e('0x5'));var moment=require(_0x4c1e('0x6'));var BPromise=require(_0x4c1e('0x7'));var Mustache=require('mustache');var util=require(_0x4c1e('0x8'));var path=require('path');var sox=require(_0x4c1e('0x9'));var csv=require(_0x4c1e('0xa'));var ejs=require(_0x4c1e('0xb'));var fs=require('fs');var _=require(_0x4c1e('0xc'));var squel=require(_0x4c1e('0xd'));var crypto=require(_0x4c1e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4c1e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c1e('0x10'));var Papa=require(_0x4c1e('0x11'));var Redis=require(_0x4c1e('0x12'));var authService=require(_0x4c1e('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x4c1e('0x14'));var logger=require(_0x4c1e('0x15'))(_0x4c1e('0x16'));var utils=require('../../config/utils');var config=require(_0x4c1e('0x17'));var db=require(_0x4c1e('0x18'))['db'];function respondWithStatusCode(_0x45f0d7,_0x49cbdd){_0x49cbdd=_0x49cbdd||0xcc;return function(_0x36238d){if(_0x36238d){return _0x45f0d7[_0x4c1e('0x19')](_0x49cbdd);}return _0x45f0d7[_0x4c1e('0x1a')](_0x49cbdd)['end']();};}function respondWithResult(_0x243e72,_0x2a3ea4){_0x2a3ea4=_0x2a3ea4||0xc8;return function(_0x1d4787){if(_0x1d4787){return _0x243e72['status'](_0x2a3ea4)[_0x4c1e('0x1b')](_0x1d4787);}};}function respondWithFilteredResult(_0x2997c2,_0x2e84f5){return function(_0x4540ca){if(_0x4540ca){var _0x66f3a9=_0x4540ca[_0x4c1e('0x1c')],_0x440437=_0x2e84f5[_0x4c1e('0x1d')],_0x33f9d4=_0x2e84f5[_0x4c1e('0x1d')]+_0x2e84f5[_0x4c1e('0x1e')],_0x4b093f;if(_0x33f9d4>=_0x66f3a9){_0x33f9d4=_0x66f3a9;_0x4b093f=0xc8;}else{_0x4b093f=0xce;}_0x2997c2[_0x4c1e('0x1a')](_0x4b093f);return _0x2997c2[_0x4c1e('0x1f')](_0x4c1e('0x20'),_0x440437+'-'+_0x33f9d4+'/'+_0x66f3a9)[_0x4c1e('0x1b')](_0x4540ca);}return null;};}function patchUpdates(_0x5489ce){return function(_0x16044b){try{jsonpatch['apply'](_0x16044b,_0x5489ce,!![]);}catch(_0x3fe76f){return BPromise['reject'](_0x3fe76f);}return _0x16044b[_0x4c1e('0x21')]();};}function saveUpdates(_0x32b3b9,_0x43b949){return function(_0x387948){if(_0x387948){return _0x387948[_0x4c1e('0x22')](_0x32b3b9)['then'](function(_0x8b966e){return _0x8b966e;});}return null;};}function removeEntity(_0x4d5201,_0x3c8854){return function(_0x52b69f){if(_0x52b69f){return _0x52b69f[_0x4c1e('0x23')]()['then'](function(){_0x4d5201[_0x4c1e('0x1a')](0xcc)[_0x4c1e('0x24')]();});}};}function handleEntityNotFound(_0xee2aa6,_0x2e1590){return function(_0x132ec2){if(!_0x132ec2){_0xee2aa6['sendStatus'](0x194);}return _0x132ec2;};}function handleError(_0x14af07,_0x5f4f78){_0x5f4f78=_0x5f4f78||0x1f4;return function(_0x5771fc){logger['error'](_0x5771fc[_0x4c1e('0x25')]);if(_0x5771fc[_0x4c1e('0x26')]){delete _0x5771fc[_0x4c1e('0x26')];}_0x14af07[_0x4c1e('0x1a')](_0x5f4f78)['send'](_0x5771fc);};}exports['index']=function(_0x53bbdf,_0x30349f){var _0x34b73f={},_0x2ce7be={},_0x3c83e2={'count':0x0,'rows':[]};var _0x461bfa=db[_0x4c1e('0x27')]['rawAttributes'];_0x2ce7be[_0x4c1e('0x28')]=_[_0x4c1e('0x29')](_0x461bfa);_0x2ce7be[_0x4c1e('0x2a')]=_['keys'](_0x53bbdf[_0x4c1e('0x2a')]);_0x2ce7be[_0x4c1e('0x2b')]=_['intersection'](_0x2ce7be[_0x4c1e('0x28')],_0x2ce7be[_0x4c1e('0x2a')]);_0x34b73f[_0x4c1e('0x2c')]=_[_0x4c1e('0x2d')](_0x2ce7be['model'],qs[_0x4c1e('0x2e')](_0x53bbdf[_0x4c1e('0x2a')][_0x4c1e('0x2e')]));_0x34b73f[_0x4c1e('0x2c')]=_0x34b73f[_0x4c1e('0x2c')][_0x4c1e('0x2f')]?_0x34b73f[_0x4c1e('0x2c')]:_0x2ce7be[_0x4c1e('0x28')];if(!_0x53bbdf['query'][_0x4c1e('0x30')](_0x4c1e('0x31'))){_0x34b73f[_0x4c1e('0x1e')]=qs[_0x4c1e('0x1e')](_0x53bbdf[_0x4c1e('0x2a')][_0x4c1e('0x1e')]);_0x34b73f['offset']=qs[_0x4c1e('0x1d')](_0x53bbdf[_0x4c1e('0x2a')][_0x4c1e('0x1d')]);}_0x34b73f[_0x4c1e('0x32')]=qs[_0x4c1e('0x33')](_0x53bbdf[_0x4c1e('0x2a')]['sort']);_0x34b73f[_0x4c1e('0x34')]=qs[_0x4c1e('0x2b')](_[_0x4c1e('0x35')](_0x53bbdf[_0x4c1e('0x2a')],_0x2ce7be['filters']));if(_0x53bbdf[_0x4c1e('0x2a')][_0x4c1e('0x36')]){_0x34b73f['where']=_[_0x4c1e('0x37')](_0x34b73f['where'],{'$or':_[_0x4c1e('0x38')](_0x461bfa,function(_0x5421c6){if(_0x5421c6[_0x4c1e('0x39')][_0x4c1e('0x3a')]!=='VIRTUAL'){var _0xd33e48={};_0xd33e48[_0x5421c6['field']]={'$like':'%'+_0x53bbdf['query']['filter']+'%'};return _0xd33e48;}})});}_0x34b73f=_['merge']({},_0x34b73f,_0x53bbdf[_0x4c1e('0x3b')]);var _0x295c68={'where':_0x34b73f[_0x4c1e('0x34')]};return db['IntegrationReport'][_0x4c1e('0x1c')](_0x295c68)[_0x4c1e('0x3c')](function(_0x57de53){_0x3c83e2[_0x4c1e('0x1c')]=_0x57de53;if(_0x53bbdf[_0x4c1e('0x2a')][_0x4c1e('0x3d')]){_0x34b73f[_0x4c1e('0x3e')]=[{'all':!![]}];}return db[_0x4c1e('0x27')]['findAll'](_0x34b73f);})[_0x4c1e('0x3c')](function(_0x232305){_0x3c83e2['rows']=_0x232305;return _0x3c83e2;})['then'](respondWithFilteredResult(_0x30349f,_0x34b73f))[_0x4c1e('0x3f')](handleError(_0x30349f,null));};exports['show']=function(_0x207308,_0x37f3c9){var _0x1230ba={'raw':![],'where':{'id':_0x207308[_0x4c1e('0x40')]['id']}},_0x8d0be9={};_0x8d0be9[_0x4c1e('0x28')]=_[_0x4c1e('0x29')](db[_0x4c1e('0x27')][_0x4c1e('0x41')]);_0x8d0be9[_0x4c1e('0x2a')]=_['keys'](_0x207308[_0x4c1e('0x2a')]);_0x8d0be9[_0x4c1e('0x2b')]=_[_0x4c1e('0x2d')](_0x8d0be9[_0x4c1e('0x28')],_0x8d0be9[_0x4c1e('0x2a')]);_0x1230ba[_0x4c1e('0x2c')]=_[_0x4c1e('0x2d')](_0x8d0be9[_0x4c1e('0x28')],qs[_0x4c1e('0x2e')](_0x207308[_0x4c1e('0x2a')][_0x4c1e('0x2e')]));_0x1230ba[_0x4c1e('0x2c')]=_0x1230ba[_0x4c1e('0x2c')][_0x4c1e('0x2f')]?_0x1230ba[_0x4c1e('0x2c')]:_0x8d0be9[_0x4c1e('0x28')];if(_0x207308['query'][_0x4c1e('0x3d')]){_0x1230ba[_0x4c1e('0x3e')]=[{'all':!![]}];}_0x1230ba=_['merge']({},_0x1230ba,_0x207308['options']);return db[_0x4c1e('0x27')]['find'](_0x1230ba)['then'](handleEntityNotFound(_0x37f3c9,null))['then'](respondWithResult(_0x37f3c9,null))[_0x4c1e('0x3f')](handleError(_0x37f3c9,null));};exports[_0x4c1e('0x42')]=function(_0x1fd0bb,_0x10e9fe){return db[_0x4c1e('0x27')][_0x4c1e('0x42')](_0x1fd0bb[_0x4c1e('0x43')],{})['then'](respondWithResult(_0x10e9fe,0xc9))['catch'](handleError(_0x10e9fe,null));};exports[_0x4c1e('0x22')]=function(_0x59c0da,_0x41481c){if(_0x59c0da[_0x4c1e('0x43')]['id']){delete _0x59c0da['body']['id'];}return db['IntegrationReport'][_0x4c1e('0x44')]({'where':{'id':_0x59c0da[_0x4c1e('0x40')]['id']}})['then'](handleEntityNotFound(_0x41481c,null))[_0x4c1e('0x3c')](saveUpdates(_0x59c0da[_0x4c1e('0x43')],null))[_0x4c1e('0x3c')](respondWithResult(_0x41481c,null))[_0x4c1e('0x3f')](handleError(_0x41481c,null));};exports[_0x4c1e('0x23')]=function(_0x54e69a,_0x5e42bf){return db[_0x4c1e('0x27')]['find']({'where':{'id':_0x54e69a[_0x4c1e('0x40')]['id']}})[_0x4c1e('0x3c')](handleEntityNotFound(_0x5e42bf,null))[_0x4c1e('0x3c')](removeEntity(_0x5e42bf,null))[_0x4c1e('0x3f')](handleError(_0x5e42bf,null));};exports[_0x4c1e('0x45')]=function(_0x3e7166,_0x5976c1){return db[_0x4c1e('0x27')][_0x4c1e('0x45')]()[_0x4c1e('0x3c')](respondWithResult(_0x5976c1,null))[_0x4c1e('0x3f')](handleError(_0x5976c1,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 181e668..0572e2a 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 _0xd08d=['../../config/environment','exports','define','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0xd08d,0x1d7));var _0xdd08=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xd08d[_0x42f009];return _0x22a1e0;};'use strict';var _=require('lodash');var util=require(_0xdd08('0x0'));var logger=require(_0xdd08('0x1'))(_0xdd08('0x2'));var moment=require('moment');var BPromise=require(_0xdd08('0x3'));var rp=require(_0xdd08('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd08('0x5'));var config=require(_0xdd08('0x6'));var attributes=require('./integrationReport.attributes');module[_0xdd08('0x7')]=function(_0x56d994,_0x93d11){return _0x56d994[_0xdd08('0x8')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecaa=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xfbbe6a,_0x3e8431){var _0x32c20c=function(_0x2ff3b2){while(--_0x2ff3b2){_0xfbbe6a['push'](_0xfbbe6a['shift']());}};_0x32c20c(++_0x3e8431);}(_0xecaa,0x173));var _0xaeca=function(_0x5d9d32,_0x466493){_0x5d9d32=_0x5d9d32-0x0;var _0x20037c=_0xecaa[_0x5d9d32];return _0x20037c;};'use strict';var _=require('lodash');var util=require(_0xaeca('0x0'));var logger=require(_0xaeca('0x1'))(_0xaeca('0x2'));var moment=require(_0xaeca('0x3'));var BPromise=require(_0xaeca('0x4'));var rp=require(_0xaeca('0x5'));var fs=require('fs');var path=require(_0xaeca('0x6'));var rimraf=require(_0xaeca('0x7'));var config=require(_0xaeca('0x8'));var attributes=require(_0xaeca('0x9'));module[_0xaeca('0xa')]=function(_0x414542,_0x2039c9){return _0x414542[_0xaeca('0xb')](_0xaeca('0xc'),attributes,{'tableName':'report_integration','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 0708e1f..973ea13 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(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0b0e,0x187));var _0xe0b0=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x0b0e[_0x476c7];return _0x47ae56;};'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(_0x4dbd8a,_0x520a11){var _0x2a4241=function(_0x330776){while(--_0x330776){_0x4dbd8a['push'](_0x4dbd8a['shift']());}};_0x2a4241(++_0x520a11);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'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 154c7ea..8a4df02 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55ca,0x126));var _0xa55c=function(_0x9154ee,_0x5f2a85){_0x9154ee=_0x9154ee-0x0;var _0x24c414=_0x55ca[_0x9154ee];return _0x24c414;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x517981,_0x59afb2){var _0xb936b0=function(_0x1da536){while(--_0x1da536){_0x517981['push'](_0x517981['shift']());}};_0xb936b0(++_0x59afb2);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index ee02f54..a82d59a 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 _0x0c07=['sequelize','exports','STRING'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x0c07,0xe7));var _0x70c0=function(_0x363832,_0x569e4a){_0x363832=_0x363832-0x0;var _0x3802a8=_0x0c07[_0x363832];return _0x3802a8;};'use strict';var Sequelize=require(_0x70c0('0x0'));module[_0x70c0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x70c0('0x2')]},'interval':{'type':Sequelize[_0x70c0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x65ec=['sequelize','exports','STRING'];(function(_0x5c0e7d,_0x4edbcd){var _0x100cd6=function(_0x5d1f65){while(--_0x5d1f65){_0x5c0e7d['push'](_0x5c0e7d['shift']());}};_0x100cd6(++_0x4edbcd);}(_0x65ec,0x1ef));var _0xc65e=function(_0x5662fa,_0x20e070){_0x5662fa=_0x5662fa-0x0;var _0x32e48c=_0x65ec[_0x5662fa];return _0x32e48c;};'use strict';var Sequelize=require(_0xc65e('0x0'));module[_0xc65e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc65e('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index d0fb9c1..0683370 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 _0x0b3b=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','Intervals','UserProfileResource','end','error','stack','name','index','Interval','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','field','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','IntervalId','getIntervals','findOne','order','pick','map','sequelize','findAll','html-pdf','rimraf','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x81334d,_0x50c0e9){var _0x18923a=function(_0x360e24){while(--_0x360e24){_0x81334d['push'](_0x81334d['shift']());}};_0x18923a(++_0x50c0e9);}(_0x0b3b,0x99));var _0xb0b3=function(_0x409fa8,_0x3bd8d2){_0x409fa8=_0x409fa8-0x0;var _0x2642a4=_0x0b3b[_0x409fa8];return _0x2642a4;};'use strict';var pdf=require(_0xb0b3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb0b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb0b3('0x2'));var path=require(_0xb0b3('0x3'));var sox=require(_0xb0b3('0x4'));var csv=require('to-csv');var ejs=require(_0xb0b3('0x5'));var fs=require('fs');var _=require(_0xb0b3('0x6'));var squel=require(_0xb0b3('0x7'));var crypto=require(_0xb0b3('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb0b3('0x9'));var toCsv=require(_0xb0b3('0xa'));var querystring=require(_0xb0b3('0xb'));var Papa=require(_0xb0b3('0xc'));var Redis=require(_0xb0b3('0xd'));var authService=require(_0xb0b3('0xe'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xb0b3('0xf'));var logger=require(_0xb0b3('0x10'))(_0xb0b3('0x11'));var utils=require('../../config/utils');var config=require(_0xb0b3('0x12'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x38e95f,_0x23b5da){_0x23b5da=_0x23b5da||0xcc;return function(_0x233288){if(_0x233288){return _0x38e95f[_0xb0b3('0x13')](_0x23b5da);}return _0x38e95f['status'](_0x23b5da)['end']();};}function respondWithResult(_0x2d258b,_0x31d6b7){_0x31d6b7=_0x31d6b7||0xc8;return function(_0x4996aa){if(_0x4996aa){return _0x2d258b[_0xb0b3('0x14')](_0x31d6b7)['json'](_0x4996aa);}};}function respondWithFilteredResult(_0x20d7cc,_0x5c013c){return function(_0x37ac0d){if(_0x37ac0d){var _0x58f6da=_0x37ac0d[_0xb0b3('0x15')],_0x384578=_0x5c013c[_0xb0b3('0x16')],_0x551b3c=_0x5c013c['offset']+_0x5c013c[_0xb0b3('0x17')],_0xd97526;if(_0x551b3c>=_0x58f6da){_0x551b3c=_0x58f6da;_0xd97526=0xc8;}else{_0xd97526=0xce;}_0x20d7cc[_0xb0b3('0x14')](_0xd97526);return _0x20d7cc[_0xb0b3('0x18')](_0xb0b3('0x19'),_0x384578+'-'+_0x551b3c+'/'+_0x58f6da)[_0xb0b3('0x1a')](_0x37ac0d);}return null;};}function patchUpdates(_0x18f20e){return function(_0x233944){try{jsonpatch['apply'](_0x233944,_0x18f20e,!![]);}catch(_0x4da0d6){return BPromise[_0xb0b3('0x1b')](_0x4da0d6);}return _0x233944[_0xb0b3('0x1c')]();};}function saveUpdates(_0x28e966,_0x1bca04){return function(_0x1993d8){if(_0x1993d8){return _0x1993d8[_0xb0b3('0x1d')](_0x28e966)['then'](function(_0x4c70ce){return _0x4c70ce;});}return null;};}function removeEntity(_0x46ce29,_0x5eb8a7){return function(_0x49185f){if(_0x49185f){return _0x49185f[_0xb0b3('0x1e')]()[_0xb0b3('0x1f')](function(){var _0x3a3985=_0x49185f['get']({'plain':!![]});var _0x36f5af=_0xb0b3('0x20');return db[_0xb0b3('0x21')]['destroy']({'where':{'type':_0x36f5af,'resourceId':_0x3a3985['id']}})[_0xb0b3('0x1f')](function(){return _0x49185f;});})[_0xb0b3('0x1f')](function(){_0x46ce29['status'](0xcc)[_0xb0b3('0x22')]();});}};}function handleEntityNotFound(_0x20d2b8,_0x51dca2){return function(_0x2734c9){if(!_0x2734c9){_0x20d2b8[_0xb0b3('0x13')](0x194);}return _0x2734c9;};}function handleError(_0x2e2f5c,_0x63a25b){_0x63a25b=_0x63a25b||0x1f4;return function(_0x1260a6){logger[_0xb0b3('0x23')](_0x1260a6[_0xb0b3('0x24')]);if(_0x1260a6[_0xb0b3('0x25')]){delete _0x1260a6[_0xb0b3('0x25')];}_0x2e2f5c[_0xb0b3('0x14')](_0x63a25b)['send'](_0x1260a6);};}exports[_0xb0b3('0x26')]=function(_0x31a464,_0x4a85ac){var _0x12b1f4={},_0xad6b04={},_0x14196a={'count':0x0,'rows':[]};var _0x51773a=db[_0xb0b3('0x27')][_0xb0b3('0x28')];_0xad6b04[_0xb0b3('0x29')]=_[_0xb0b3('0x2a')](_0x51773a);_0xad6b04[_0xb0b3('0x2b')]=_[_0xb0b3('0x2a')](_0x31a464['query']);_0xad6b04[_0xb0b3('0x2c')]=_[_0xb0b3('0x2d')](_0xad6b04[_0xb0b3('0x29')],_0xad6b04['query']);_0x12b1f4['attributes']=_['intersection'](_0xad6b04[_0xb0b3('0x29')],qs[_0xb0b3('0x2e')](_0x31a464[_0xb0b3('0x2b')]['fields']));_0x12b1f4[_0xb0b3('0x2f')]=_0x12b1f4[_0xb0b3('0x2f')][_0xb0b3('0x30')]?_0x12b1f4['attributes']:_0xad6b04['model'];if(!_0x31a464[_0xb0b3('0x2b')][_0xb0b3('0x31')](_0xb0b3('0x32'))){_0x12b1f4[_0xb0b3('0x17')]=qs[_0xb0b3('0x17')](_0x31a464['query'][_0xb0b3('0x17')]);_0x12b1f4[_0xb0b3('0x16')]=qs[_0xb0b3('0x16')](_0x31a464[_0xb0b3('0x2b')]['offset']);}_0x12b1f4['order']=qs[_0xb0b3('0x33')](_0x31a464[_0xb0b3('0x2b')][_0xb0b3('0x33')]);_0x12b1f4[_0xb0b3('0x34')]=qs[_0xb0b3('0x2c')](_['pick'](_0x31a464[_0xb0b3('0x2b')],_0xad6b04['filters']));if(_0x31a464[_0xb0b3('0x2b')]['filter']){_0x12b1f4[_0xb0b3('0x34')]=_['merge'](_0x12b1f4['where'],{'$or':_['map'](_0x51773a,function(_0x462b73){if(_0x462b73[_0xb0b3('0x35')]['key']!==_0xb0b3('0x36')){var _0x3fbfee={};_0x3fbfee[_0x462b73[_0xb0b3('0x37')]]={'$like':'%'+_0x31a464[_0xb0b3('0x2b')][_0xb0b3('0x38')]+'%'};return _0x3fbfee;}})});}_0x12b1f4=_[_0xb0b3('0x39')]({},_0x12b1f4,_0x31a464[_0xb0b3('0x3a')]);var _0x20f4ae={'where':_0x12b1f4[_0xb0b3('0x34')]};return db['Interval'][_0xb0b3('0x15')](_0x20f4ae)['then'](function(_0x2d3d51){_0x14196a['count']=_0x2d3d51;if(_0x31a464[_0xb0b3('0x2b')][_0xb0b3('0x3b')]){_0x12b1f4[_0xb0b3('0x3c')]=[{'all':!![]}];}return db[_0xb0b3('0x27')]['findAll'](_0x12b1f4);})[_0xb0b3('0x1f')](function(_0xc339f8){_0x14196a[_0xb0b3('0x3d')]=_0xc339f8;return _0x14196a;})[_0xb0b3('0x1f')](respondWithFilteredResult(_0x4a85ac,_0x12b1f4))[_0xb0b3('0x3e')](handleError(_0x4a85ac,null));};exports[_0xb0b3('0x3f')]=function(_0xbd0830,_0x1565a1){var _0x4160bf={'raw':!![],'where':{'id':_0xbd0830[_0xb0b3('0x40')]['id']}},_0x42b48c={};_0x42b48c[_0xb0b3('0x29')]=_[_0xb0b3('0x2a')](db[_0xb0b3('0x27')][_0xb0b3('0x28')]);_0x42b48c[_0xb0b3('0x2b')]=_[_0xb0b3('0x2a')](_0xbd0830[_0xb0b3('0x2b')]);_0x42b48c[_0xb0b3('0x2c')]=_[_0xb0b3('0x2d')](_0x42b48c['model'],_0x42b48c[_0xb0b3('0x2b')]);_0x4160bf[_0xb0b3('0x2f')]=_['intersection'](_0x42b48c[_0xb0b3('0x29')],qs[_0xb0b3('0x2e')](_0xbd0830[_0xb0b3('0x2b')][_0xb0b3('0x2e')]));_0x4160bf[_0xb0b3('0x2f')]=_0x4160bf['attributes'][_0xb0b3('0x30')]?_0x4160bf[_0xb0b3('0x2f')]:_0x42b48c['model'];if(_0xbd0830[_0xb0b3('0x2b')]['includeAll']){_0x4160bf[_0xb0b3('0x3c')]=[{'all':!![]}];}_0x4160bf=_[_0xb0b3('0x39')]({},_0x4160bf,_0xbd0830['options']);return db[_0xb0b3('0x27')][_0xb0b3('0x41')](_0x4160bf)[_0xb0b3('0x1f')](handleEntityNotFound(_0x1565a1,null))['then'](respondWithResult(_0x1565a1,null))[_0xb0b3('0x3e')](handleError(_0x1565a1,null));};exports[_0xb0b3('0x42')]=function(_0xb673fe,_0x1056a4){return db['Interval'][_0xb0b3('0x42')](_0xb673fe[_0xb0b3('0x43')],{})[_0xb0b3('0x1f')](function(_0x32db51){var _0x5db763=_0xb673fe[_0xb0b3('0x44')][_0xb0b3('0x45')]({'plain':!![]});if(!_0x5db763)throw new Error(_0xb0b3('0x46'));if(_0x5db763[_0xb0b3('0x47')]===_0xb0b3('0x44')){var _0x6b2b1d=_0x32db51['get']({'plain':!![]});var _0x4e2239=_0xb0b3('0x20');return db[_0xb0b3('0x48')][_0xb0b3('0x41')]({'where':{'name':_0x4e2239,'userProfileId':_0x5db763[_0xb0b3('0x49')]},'raw':!![]})['then'](function(_0x24d746){if(_0x24d746&&_0x24d746[_0xb0b3('0x4a')]===0x0){return db[_0xb0b3('0x21')][_0xb0b3('0x42')]({'name':_0x6b2b1d[_0xb0b3('0x25')],'resourceId':_0x6b2b1d['id'],'type':_0x24d746[_0xb0b3('0x25')],'sectionId':_0x24d746['id']},{})[_0xb0b3('0x1f')](function(){return _0x32db51;});}else{return _0x32db51;}})[_0xb0b3('0x3e')](function(_0x1e567c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e567c);throw _0x1e567c;});}return _0x32db51;})[_0xb0b3('0x1f')](respondWithResult(_0x1056a4,0xc9))['catch'](handleError(_0x1056a4,null));};exports[_0xb0b3('0x1d')]=function(_0xb422ea,_0x1f7f13){if(_0xb422ea[_0xb0b3('0x43')]['id']){delete _0xb422ea[_0xb0b3('0x43')]['id'];}return db['Interval'][_0xb0b3('0x41')]({'where':{'id':_0xb422ea[_0xb0b3('0x40')]['id']}})[_0xb0b3('0x1f')](handleEntityNotFound(_0x1f7f13,null))[_0xb0b3('0x1f')](saveUpdates(_0xb422ea['body'],null))[_0xb0b3('0x1f')](respondWithResult(_0x1f7f13,null))[_0xb0b3('0x3e')](handleError(_0x1f7f13,null));};exports[_0xb0b3('0x1e')]=function(_0x5ae5d0,_0x4ee7fe){return db[_0xb0b3('0x27')][_0xb0b3('0x41')]({'where':{'id':_0x5ae5d0[_0xb0b3('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ee7fe,null))['then'](removeEntity(_0x4ee7fe,null))['catch'](handleError(_0x4ee7fe,null));};exports['addInterval']=function(_0x135e02,_0x49c14c,_0x4fc88f){if(_0x135e02['body']['id']){delete _0x135e02['body']['id'];}return db[_0xb0b3('0x27')][_0xb0b3('0x41')]({'where':{'id':_0x135e02[_0xb0b3('0x40')]['id']}})[_0xb0b3('0x1f')](handleEntityNotFound(_0x49c14c,null))[_0xb0b3('0x1f')](function(_0xae4b7b){if(_0xae4b7b){_0x135e02[_0xb0b3('0x43')][_0xb0b3('0x4b')]=_0xae4b7b['id'];return db[_0xb0b3('0x27')][_0xb0b3('0x42')](_0x135e02[_0xb0b3('0x43')]);}})[_0xb0b3('0x1f')](respondWithResult(_0x49c14c,null))[_0xb0b3('0x3e')](handleError(_0x49c14c,null));};exports[_0xb0b3('0x4c')]=function(_0x36e708,_0x248187,_0x258dc6){var _0x5165e4={};var _0x524206={};var _0x5f2582;var _0x1627a2;return db[_0xb0b3('0x27')][_0xb0b3('0x4d')]({'where':{'id':_0x36e708[_0xb0b3('0x40')]['id']}})[_0xb0b3('0x1f')](handleEntityNotFound(_0x248187,null))[_0xb0b3('0x1f')](function(_0x236153){if(_0x236153){_0x5f2582=_0x236153;_0x524206['model']=_['keys'](db[_0xb0b3('0x27')][_0xb0b3('0x28')]);_0x524206[_0xb0b3('0x2b')]=_[_0xb0b3('0x2a')](_0x36e708[_0xb0b3('0x2b')]);_0x524206[_0xb0b3('0x2c')]=_[_0xb0b3('0x2d')](_0x524206[_0xb0b3('0x29')],_0x524206[_0xb0b3('0x2b')]);_0x5165e4[_0xb0b3('0x2f')]=_[_0xb0b3('0x2d')](_0x524206[_0xb0b3('0x29')],qs[_0xb0b3('0x2e')](_0x36e708[_0xb0b3('0x2b')][_0xb0b3('0x2e')]));_0x5165e4[_0xb0b3('0x2f')]=_0x5165e4['attributes'][_0xb0b3('0x30')]?_0x5165e4[_0xb0b3('0x2f')]:_0x524206['model'];_0x5165e4[_0xb0b3('0x4e')]=qs['sort'](_0x36e708['query']['sort']);_0x5165e4[_0xb0b3('0x34')]=qs[_0xb0b3('0x2c')](_[_0xb0b3('0x4f')](_0x36e708['query'],_0x524206[_0xb0b3('0x2c')]));if(_0x36e708[_0xb0b3('0x2b')][_0xb0b3('0x38')]){_0x5165e4['where']=_['merge'](_0x5165e4['where'],{'$or':_[_0xb0b3('0x50')](_0x5165e4[_0xb0b3('0x2f')],function(_0x3d1f85){var _0x47f04f={};_0x47f04f[_0x3d1f85]={'$like':'%'+_0x36e708['query'][_0xb0b3('0x38')]+'%'};return _0x47f04f;})});}_0x5165e4=_[_0xb0b3('0x39')]({},_0x5165e4,_0x36e708[_0xb0b3('0x3a')]);return _0x5f2582[_0xb0b3('0x4c')](_0x5165e4);}})[_0xb0b3('0x1f')](function(_0x4f62e5){if(_0x4f62e5){_0x1627a2=_0x4f62e5['length'];if(!_0x36e708[_0xb0b3('0x2b')]['hasOwnProperty'](_0xb0b3('0x32'))){_0x5165e4[_0xb0b3('0x17')]=qs[_0xb0b3('0x17')](_0x36e708[_0xb0b3('0x2b')][_0xb0b3('0x17')]);_0x5165e4['offset']=qs[_0xb0b3('0x16')](_0x36e708[_0xb0b3('0x2b')]['offset']);}return _0x5f2582[_0xb0b3('0x4c')](_0x5165e4);}})[_0xb0b3('0x1f')](function(_0x4f7bf9){if(_0x4f7bf9){return _0x4f7bf9?{'count':_0x1627a2,'rows':_0x4f7bf9}:null;}})[_0xb0b3('0x1f')](respondWithResult(_0x248187,null))['catch'](handleError(_0x248187,null));};exports['addIntervals']=function(_0x2a986e,_0x1d17cc,_0x1c44cd){return db[_0xb0b3('0x27')][_0xb0b3('0x4d')]({'where':{'id':_0x2a986e[_0xb0b3('0x40')]['id']}})[_0xb0b3('0x1f')](handleEntityNotFound(_0x1d17cc,null))['then'](function(_0x39d8c8){if(_0x39d8c8){return db[_0xb0b3('0x51')]['transaction'](function(_0x164bbc){return db[_0xb0b3('0x27')][_0xb0b3('0x1e')]({'where':{'IntervalId':_0x2a986e[_0xb0b3('0x40')]['id']},'transaction':_0x164bbc})[_0xb0b3('0x1f')](function(_0x3ad4ef){var _0x25af9f=_['map'](_0x2a986e['body'],function(_0x10889c){delete _0x10889c['id'];_0x10889c['IntervalId']=_0x2a986e[_0xb0b3('0x40')]['id'];return _0x10889c;});return db[_0xb0b3('0x27')]['bulkCreate'](_0x25af9f,{'transaction':_0x164bbc});});})[_0xb0b3('0x1f')](function(){return db['Interval'][_0xb0b3('0x52')]({'where':{'IntervalId':_0x2a986e['params']['id']}});});}})[_0xb0b3('0x1f')](respondWithResult(_0x1d17cc,null))['catch'](handleError(_0x1d17cc,null));}; \ No newline at end of file +var _0x1832=['filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','map','type','key','VIRTUAL','field','filter','merge','options','Interval','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','getIntervals','order','addIntervals','sequelize','IntervalId','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','count','offset','limit','set','Content-Range','json','apply','save','destroy','then','get','Intervals','UserProfileResource','sendStatus','stack','name','send','index','rawAttributes','model'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1832,0x84));var _0x2183=function(_0x143200,_0xf0089c){_0x143200=_0x143200-0x0;var _0x3e769c=_0x1832[_0x143200];return _0x3e769c;};'use strict';var pdf=require(_0x2183('0x0'));var emlformat=require(_0x2183('0x1'));var rimraf=require(_0x2183('0x2'));var zipdir=require(_0x2183('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2183('0x4'));var moment=require('moment');var BPromise=require(_0x2183('0x5'));var Mustache=require(_0x2183('0x6'));var util=require(_0x2183('0x7'));var path=require(_0x2183('0x8'));var sox=require(_0x2183('0x9'));var csv=require(_0x2183('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2183('0xb'));var crypto=require(_0x2183('0xc'));var jsforce=require(_0x2183('0xd'));var deskjs=require(_0x2183('0xe'));var toCsv=require(_0x2183('0xa'));var querystring=require(_0x2183('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2183('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2183('0x11'))(_0x2183('0x12'));var utils=require('../../config/utils');var config=require(_0x2183('0x13'));var db=require(_0x2183('0x14'))['db'];var extensions=require(_0x2183('0x15'));function respondWithStatusCode(_0x318b1d,_0x249bb3){_0x249bb3=_0x249bb3||0xcc;return function(_0x5c9c14){if(_0x5c9c14){return _0x318b1d['sendStatus'](_0x249bb3);}return _0x318b1d[_0x2183('0x16')](_0x249bb3)[_0x2183('0x17')]();};}function respondWithResult(_0x294dfb,_0x5dca91){_0x5dca91=_0x5dca91||0xc8;return function(_0xac1f33){if(_0xac1f33){return _0x294dfb[_0x2183('0x16')](_0x5dca91)['json'](_0xac1f33);}};}function respondWithFilteredResult(_0x437f7a,_0xa8a59b){return function(_0xab331d){if(_0xab331d){var _0x1da0eb=_0xab331d[_0x2183('0x18')],_0x4dd7b9=_0xa8a59b[_0x2183('0x19')],_0x4cd9b5=_0xa8a59b[_0x2183('0x19')]+_0xa8a59b[_0x2183('0x1a')],_0x8e5835;if(_0x4cd9b5>=_0x1da0eb){_0x4cd9b5=_0x1da0eb;_0x8e5835=0xc8;}else{_0x8e5835=0xce;}_0x437f7a['status'](_0x8e5835);return _0x437f7a[_0x2183('0x1b')](_0x2183('0x1c'),_0x4dd7b9+'-'+_0x4cd9b5+'/'+_0x1da0eb)[_0x2183('0x1d')](_0xab331d);}return null;};}function patchUpdates(_0x193862){return function(_0x1d7ebc){try{jsonpatch[_0x2183('0x1e')](_0x1d7ebc,_0x193862,!![]);}catch(_0x168664){return BPromise['reject'](_0x168664);}return _0x1d7ebc[_0x2183('0x1f')]();};}function saveUpdates(_0x3530c3,_0x1c3ca8){return function(_0x1bf0fc){if(_0x1bf0fc){return _0x1bf0fc['update'](_0x3530c3)['then'](function(_0x35bbf){return _0x35bbf;});}return null;};}function removeEntity(_0x2f8803,_0x2ad06f){return function(_0xb1f669){if(_0xb1f669){return _0xb1f669[_0x2183('0x20')]()[_0x2183('0x21')](function(){var _0x55d73b=_0xb1f669[_0x2183('0x22')]({'plain':!![]});var _0x6b87e0=_0x2183('0x23');return db[_0x2183('0x24')]['destroy']({'where':{'type':_0x6b87e0,'resourceId':_0x55d73b['id']}})['then'](function(){return _0xb1f669;});})[_0x2183('0x21')](function(){_0x2f8803[_0x2183('0x16')](0xcc)[_0x2183('0x17')]();});}};}function handleEntityNotFound(_0x262824,_0x4329c3){return function(_0x31d5ba){if(!_0x31d5ba){_0x262824[_0x2183('0x25')](0x194);}return _0x31d5ba;};}function handleError(_0x2c20de,_0x3f4c3a){_0x3f4c3a=_0x3f4c3a||0x1f4;return function(_0x5e0e47){logger['error'](_0x5e0e47[_0x2183('0x26')]);if(_0x5e0e47['name']){delete _0x5e0e47[_0x2183('0x27')];}_0x2c20de['status'](_0x3f4c3a)[_0x2183('0x28')](_0x5e0e47);};}exports[_0x2183('0x29')]=function(_0xc1bbce,_0x39ccec){var _0xf4ef7d={},_0xc49367={},_0x4cc6f2={'count':0x0,'rows':[]};var _0x51c8a9=db['Interval'][_0x2183('0x2a')];_0xc49367[_0x2183('0x2b')]=_['keys'](_0x51c8a9);_0xc49367['query']=_['keys'](_0xc1bbce['query']);_0xc49367[_0x2183('0x2c')]=_[_0x2183('0x2d')](_0xc49367[_0x2183('0x2b')],_0xc49367[_0x2183('0x2e')]);_0xf4ef7d[_0x2183('0x2f')]=_[_0x2183('0x2d')](_0xc49367['model'],qs[_0x2183('0x30')](_0xc1bbce[_0x2183('0x2e')][_0x2183('0x30')]));_0xf4ef7d[_0x2183('0x2f')]=_0xf4ef7d[_0x2183('0x2f')][_0x2183('0x31')]?_0xf4ef7d[_0x2183('0x2f')]:_0xc49367[_0x2183('0x2b')];if(!_0xc1bbce[_0x2183('0x2e')][_0x2183('0x32')](_0x2183('0x33'))){_0xf4ef7d[_0x2183('0x1a')]=qs[_0x2183('0x1a')](_0xc1bbce[_0x2183('0x2e')]['limit']);_0xf4ef7d[_0x2183('0x19')]=qs[_0x2183('0x19')](_0xc1bbce[_0x2183('0x2e')]['offset']);}_0xf4ef7d['order']=qs[_0x2183('0x34')](_0xc1bbce[_0x2183('0x2e')][_0x2183('0x34')]);_0xf4ef7d['where']=qs[_0x2183('0x2c')](_[_0x2183('0x35')](_0xc1bbce['query'],_0xc49367[_0x2183('0x2c')]));if(_0xc1bbce['query']['filter']){_0xf4ef7d[_0x2183('0x36')]=_['merge'](_0xf4ef7d[_0x2183('0x36')],{'$or':_[_0x2183('0x37')](_0x51c8a9,function(_0x1f2c06){if(_0x1f2c06[_0x2183('0x38')][_0x2183('0x39')]!==_0x2183('0x3a')){var _0x330fbd={};_0x330fbd[_0x1f2c06[_0x2183('0x3b')]]={'$like':'%'+_0xc1bbce[_0x2183('0x2e')][_0x2183('0x3c')]+'%'};return _0x330fbd;}})});}_0xf4ef7d=_[_0x2183('0x3d')]({},_0xf4ef7d,_0xc1bbce[_0x2183('0x3e')]);var _0x578089={'where':_0xf4ef7d[_0x2183('0x36')]};return db[_0x2183('0x3f')][_0x2183('0x18')](_0x578089)[_0x2183('0x21')](function(_0x20e139){_0x4cc6f2['count']=_0x20e139;if(_0xc1bbce[_0x2183('0x2e')][_0x2183('0x40')]){_0xf4ef7d[_0x2183('0x41')]=[{'all':!![]}];}return db[_0x2183('0x3f')][_0x2183('0x42')](_0xf4ef7d);})[_0x2183('0x21')](function(_0x371959){_0x4cc6f2[_0x2183('0x43')]=_0x371959;return _0x4cc6f2;})[_0x2183('0x21')](respondWithFilteredResult(_0x39ccec,_0xf4ef7d))[_0x2183('0x44')](handleError(_0x39ccec,null));};exports[_0x2183('0x45')]=function(_0x19bfe9,_0xfecee8){var _0x329f8b={'raw':!![],'where':{'id':_0x19bfe9['params']['id']}},_0x26221b={};_0x26221b[_0x2183('0x2b')]=_[_0x2183('0x46')](db[_0x2183('0x3f')][_0x2183('0x2a')]);_0x26221b[_0x2183('0x2e')]=_[_0x2183('0x46')](_0x19bfe9[_0x2183('0x2e')]);_0x26221b[_0x2183('0x2c')]=_[_0x2183('0x2d')](_0x26221b[_0x2183('0x2b')],_0x26221b[_0x2183('0x2e')]);_0x329f8b[_0x2183('0x2f')]=_[_0x2183('0x2d')](_0x26221b[_0x2183('0x2b')],qs[_0x2183('0x30')](_0x19bfe9['query']['fields']));_0x329f8b['attributes']=_0x329f8b[_0x2183('0x2f')][_0x2183('0x31')]?_0x329f8b[_0x2183('0x2f')]:_0x26221b[_0x2183('0x2b')];if(_0x19bfe9[_0x2183('0x2e')]['includeAll']){_0x329f8b[_0x2183('0x41')]=[{'all':!![]}];}_0x329f8b=_['merge']({},_0x329f8b,_0x19bfe9[_0x2183('0x3e')]);return db[_0x2183('0x3f')][_0x2183('0x47')](_0x329f8b)[_0x2183('0x21')](handleEntityNotFound(_0xfecee8,null))[_0x2183('0x21')](respondWithResult(_0xfecee8,null))[_0x2183('0x44')](handleError(_0xfecee8,null));};exports[_0x2183('0x48')]=function(_0x54ecfd,_0x55bfcc){return db['Interval'][_0x2183('0x48')](_0x54ecfd[_0x2183('0x49')],{})[_0x2183('0x21')](function(_0x39454e){var _0xa3acdc=_0x54ecfd[_0x2183('0x4a')]['get']({'plain':!![]});if(!_0xa3acdc)throw new Error(_0x2183('0x4b'));if(_0xa3acdc['role']===_0x2183('0x4a')){var _0x27f1fd=_0x39454e[_0x2183('0x22')]({'plain':!![]});var _0x56e1a4=_0x2183('0x23');return db[_0x2183('0x4c')]['find']({'where':{'name':_0x56e1a4,'userProfileId':_0xa3acdc[_0x2183('0x4d')]},'raw':!![]})['then'](function(_0x4a7a1f){if(_0x4a7a1f&&_0x4a7a1f['autoAssociation']===0x0){return db[_0x2183('0x24')][_0x2183('0x48')]({'name':_0x27f1fd['name'],'resourceId':_0x27f1fd['id'],'type':_0x4a7a1f[_0x2183('0x27')],'sectionId':_0x4a7a1f['id']},{})[_0x2183('0x21')](function(){return _0x39454e;});}else{return _0x39454e;}})[_0x2183('0x44')](function(_0x1b6c6f){logger[_0x2183('0x4e')](_0x2183('0x4f'),_0x1b6c6f);throw _0x1b6c6f;});}return _0x39454e;})[_0x2183('0x21')](respondWithResult(_0x55bfcc,0xc9))[_0x2183('0x44')](handleError(_0x55bfcc,null));};exports[_0x2183('0x50')]=function(_0x1bca73,_0x4bcc1b){if(_0x1bca73[_0x2183('0x49')]['id']){delete _0x1bca73[_0x2183('0x49')]['id'];}return db[_0x2183('0x3f')][_0x2183('0x47')]({'where':{'id':_0x1bca73[_0x2183('0x51')]['id']}})[_0x2183('0x21')](handleEntityNotFound(_0x4bcc1b,null))[_0x2183('0x21')](saveUpdates(_0x1bca73[_0x2183('0x49')],null))[_0x2183('0x21')](respondWithResult(_0x4bcc1b,null))[_0x2183('0x44')](handleError(_0x4bcc1b,null));};exports[_0x2183('0x20')]=function(_0x46a0ed,_0x702f88){return db['Interval']['find']({'where':{'id':_0x46a0ed[_0x2183('0x51')]['id']}})[_0x2183('0x21')](handleEntityNotFound(_0x702f88,null))[_0x2183('0x21')](removeEntity(_0x702f88,null))[_0x2183('0x44')](handleError(_0x702f88,null));};exports[_0x2183('0x52')]=function(_0x57f17d,_0x49974b,_0xd68c18){if(_0x57f17d['body']['id']){delete _0x57f17d[_0x2183('0x49')]['id'];}return db[_0x2183('0x3f')][_0x2183('0x47')]({'where':{'id':_0x57f17d[_0x2183('0x51')]['id']}})['then'](handleEntityNotFound(_0x49974b,null))[_0x2183('0x21')](function(_0x2a798f){if(_0x2a798f){_0x57f17d[_0x2183('0x49')]['IntervalId']=_0x2a798f['id'];return db['Interval'][_0x2183('0x48')](_0x57f17d[_0x2183('0x49')]);}})['then'](respondWithResult(_0x49974b,null))[_0x2183('0x44')](handleError(_0x49974b,null));};exports[_0x2183('0x53')]=function(_0x57756a,_0x43fe6a,_0x7f85a){var _0xe75423={};var _0x472699={};var _0x355fed;var _0x164795;return db['Interval']['findOne']({'where':{'id':_0x57756a['params']['id']}})[_0x2183('0x21')](handleEntityNotFound(_0x43fe6a,null))[_0x2183('0x21')](function(_0x1adf52){if(_0x1adf52){_0x355fed=_0x1adf52;_0x472699[_0x2183('0x2b')]=_[_0x2183('0x46')](db[_0x2183('0x3f')]['rawAttributes']);_0x472699[_0x2183('0x2e')]=_[_0x2183('0x46')](_0x57756a[_0x2183('0x2e')]);_0x472699[_0x2183('0x2c')]=_[_0x2183('0x2d')](_0x472699[_0x2183('0x2b')],_0x472699[_0x2183('0x2e')]);_0xe75423[_0x2183('0x2f')]=_[_0x2183('0x2d')](_0x472699[_0x2183('0x2b')],qs[_0x2183('0x30')](_0x57756a[_0x2183('0x2e')][_0x2183('0x30')]));_0xe75423[_0x2183('0x2f')]=_0xe75423[_0x2183('0x2f')]['length']?_0xe75423[_0x2183('0x2f')]:_0x472699[_0x2183('0x2b')];_0xe75423[_0x2183('0x54')]=qs[_0x2183('0x34')](_0x57756a[_0x2183('0x2e')][_0x2183('0x34')]);_0xe75423[_0x2183('0x36')]=qs[_0x2183('0x2c')](_[_0x2183('0x35')](_0x57756a['query'],_0x472699[_0x2183('0x2c')]));if(_0x57756a['query'][_0x2183('0x3c')]){_0xe75423['where']=_['merge'](_0xe75423[_0x2183('0x36')],{'$or':_[_0x2183('0x37')](_0xe75423['attributes'],function(_0x5c6c6c){var _0x11887e={};_0x11887e[_0x5c6c6c]={'$like':'%'+_0x57756a['query'][_0x2183('0x3c')]+'%'};return _0x11887e;})});}_0xe75423=_['merge']({},_0xe75423,_0x57756a['options']);return _0x355fed['getIntervals'](_0xe75423);}})[_0x2183('0x21')](function(_0x34a5f2){if(_0x34a5f2){_0x164795=_0x34a5f2[_0x2183('0x31')];if(!_0x57756a[_0x2183('0x2e')][_0x2183('0x32')]('nolimit')){_0xe75423[_0x2183('0x1a')]=qs['limit'](_0x57756a[_0x2183('0x2e')]['limit']);_0xe75423[_0x2183('0x19')]=qs[_0x2183('0x19')](_0x57756a[_0x2183('0x2e')]['offset']);}return _0x355fed[_0x2183('0x53')](_0xe75423);}})[_0x2183('0x21')](function(_0x87e22d){if(_0x87e22d){return _0x87e22d?{'count':_0x164795,'rows':_0x87e22d}:null;}})[_0x2183('0x21')](respondWithResult(_0x43fe6a,null))[_0x2183('0x44')](handleError(_0x43fe6a,null));};exports[_0x2183('0x55')]=function(_0x56080d,_0xf727d3,_0x1ef59e){return db['Interval']['findOne']({'where':{'id':_0x56080d['params']['id']}})[_0x2183('0x21')](handleEntityNotFound(_0xf727d3,null))['then'](function(_0x2d95b3){if(_0x2d95b3){return db[_0x2183('0x56')]['transaction'](function(_0x274cd3){return db['Interval'][_0x2183('0x20')]({'where':{'IntervalId':_0x56080d[_0x2183('0x51')]['id']},'transaction':_0x274cd3})[_0x2183('0x21')](function(_0x3fadf7){var _0x33f3a1=_[_0x2183('0x37')](_0x56080d[_0x2183('0x49')],function(_0x505a9b){delete _0x505a9b['id'];_0x505a9b[_0x2183('0x57')]=_0x56080d[_0x2183('0x51')]['id'];return _0x505a9b;});return db[_0x2183('0x3f')]['bulkCreate'](_0x33f3a1,{'transaction':_0x274cd3});});})[_0x2183('0x21')](function(){return db[_0x2183('0x3f')][_0x2183('0x42')]({'where':{'IntervalId':_0x56080d[_0x2183('0x51')]['id']}});});}})[_0x2183('0x21')](respondWithResult(_0xf727d3,null))[_0x2183('0x44')](handleError(_0xf727d3,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 47de672..28db485 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 _0x1bca=['tools_intervals','rewrite','util','moment','request-promise','path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1bca,0xb6));var _0xa1bc=function(_0x2e89d4,_0x1fc182){_0x2e89d4=_0x2e89d4-0x0;var _0x3bba1b=_0x1bca[_0x2e89d4];return _0x3bba1b;};'use strict';var _=require('lodash');var util=require(_0xa1bc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa1bc('0x1'));var BPromise=require('bluebird');var rp=require(_0xa1bc('0x2'));var fs=require('fs');var path=require(_0xa1bc('0x3'));var rimraf=require(_0xa1bc('0x4'));var config=require('../../config/environment');var attributes=require(_0xa1bc('0x5'));var extensions=require(_0xa1bc('0x6'));module[_0xa1bc('0x7')]=function(_0x268ced,_0x54bffb){return _0x268ced[_0xa1bc('0x8')](_0xa1bc('0x9'),attributes,{'tableName':_0xa1bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x378061,_0x16b36f){extensions[_0xa1bc('0xb')](_0x268ced,_0x378061);},'afterBulkCreate':function(_0x2db364,_0x4b2e4e,_0x1b826d){_0x1b826d();extensions[_0xa1bc('0xb')](_0x268ced,_0x2db364[0x0]);},'afterUpdate':function(_0x23203c,_0x1ac68a){extensions[_0xa1bc('0xb')](_0x268ced,_0x23203c);},'afterDestroy':function(_0x24a815,_0x40c40e){extensions[_0xa1bc('0xb')](_0x268ced,_0x24a815);}}});}; \ No newline at end of file +var _0x6eaf=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','request-promise','rimraf'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x6eaf,0xe5));var _0xf6ea=function(_0x452568,_0x4ff94a){_0x452568=_0x452568-0x0;var _0x5b0781=_0x6eaf[_0x452568];return _0x5b0781;};'use strict';var _=require(_0xf6ea('0x0'));var util=require(_0xf6ea('0x1'));var logger=require(_0xf6ea('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6ea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6ea('0x4'));var config=require(_0xf6ea('0x5'));var attributes=require(_0xf6ea('0x6'));var extensions=require(_0xf6ea('0x7'));module[_0xf6ea('0x8')]=function(_0x19628e,_0x26aba6){return _0x19628e[_0xf6ea('0x9')](_0xf6ea('0xa'),attributes,{'tableName':_0xf6ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x312f69,_0x3567e6){extensions[_0xf6ea('0xc')](_0x19628e,_0x312f69);},'afterBulkCreate':function(_0x5df9e1,_0x5f5723,_0x4086b2){_0x4086b2();extensions[_0xf6ea('0xc')](_0x19628e,_0x5df9e1[0x0]);},'afterUpdate':function(_0x123e58,_0x14eae7){extensions[_0xf6ea('0xc')](_0x19628e,_0x123e58);},'afterDestroy':function(_0xa56b2a,_0x15d6d3){extensions['rewrite'](_0x19628e,_0xa56b2a);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 3e69663..9d30f7f 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 _0x8c91=['Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','Interval','findAll','options','raw','attributes','limit','map','include','model','GetInterval','ShowInterval','find','where','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Interval,\x20%s,\x20%s','debug'];(function(_0x491fcc,_0x5d2810){var _0x35cfb7=function(_0x5d9d6b){while(--_0x5d9d6b){_0x491fcc['push'](_0x491fcc['shift']());}};_0x35cfb7(++_0x5d2810);}(_0x8c91,0x195));var _0x18c9=function(_0x139531,_0x1e9fb0){_0x139531=_0x139531-0x0;var _0x2c4861=_0x8c91[_0x139531];return _0x2c4861;};'use strict';var _=require(_0x18c9('0x0'));var util=require('util');var moment=require(_0x18c9('0x1'));var BPromise=require(_0x18c9('0x2'));var rs=require(_0x18c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18c9('0x4'))['db'];var utils=require(_0x18c9('0x5'));var logger=require(_0x18c9('0x6'))(_0x18c9('0x7'));var config=require(_0x18c9('0x8'));var jayson=require(_0x18c9('0x9'));var client=jayson[_0x18c9('0xa')][_0x18c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x355731,_0x5f3fb0,_0x2f525a){return new BPromise(function(_0x9fc773,_0x40a24f){return client['request'](_0x355731,_0x2f525a)['then'](function(_0x132e40){logger[_0x18c9('0xc')](_0x18c9('0xd'),_0x5f3fb0,'request\x20sent');logger[_0x18c9('0xe')](_0x18c9('0xf'),_0x5f3fb0,_0x18c9('0x10'),JSON[_0x18c9('0x11')](_0x132e40));if(_0x132e40[_0x18c9('0x12')]){if(_0x132e40['error']['code']===0x1f4){logger[_0x18c9('0x12')](_0x18c9('0xd'),_0x5f3fb0,_0x132e40[_0x18c9('0x12')][_0x18c9('0x13')]);return _0x40a24f(_0x132e40['error'][_0x18c9('0x13')]);}logger[_0x18c9('0x12')](_0x18c9('0xd'),_0x5f3fb0,_0x132e40['error'][_0x18c9('0x13')]);return _0x9fc773(_0x132e40[_0x18c9('0x12')][_0x18c9('0x13')]);}else{logger['info'](_0x18c9('0xd'),_0x5f3fb0,_0x18c9('0x10'));_0x9fc773(_0x132e40['result'][_0x18c9('0x13')]);}})[_0x18c9('0x14')](function(_0x1e7d8b){logger[_0x18c9('0x12')](_0x18c9('0xd'),_0x5f3fb0,_0x1e7d8b);_0x40a24f(_0x1e7d8b);});});}exports['GetInterval']=function(_0x5d11bd){var _0x534a1e=this;return new Promise(function(_0x281d4c,_0x273eee){return db[_0x18c9('0x15')][_0x18c9('0x16')]({'raw':_0x5d11bd[_0x18c9('0x17')]?_0x5d11bd[_0x18c9('0x17')][_0x18c9('0x18')]===undefined?!![]:![]:!![],'where':_0x5d11bd['options']?_0x5d11bd['options']['where']||null:null,'attributes':_0x5d11bd[_0x18c9('0x17')]?_0x5d11bd[_0x18c9('0x17')][_0x18c9('0x19')]||null:null,'limit':_0x5d11bd[_0x18c9('0x17')]?_0x5d11bd[_0x18c9('0x17')][_0x18c9('0x1a')]||null:null,'include':_0x5d11bd[_0x18c9('0x17')]?_0x5d11bd[_0x18c9('0x17')]['include']?_[_0x18c9('0x1b')](_0x5d11bd[_0x18c9('0x17')][_0x18c9('0x1c')],function(_0x221114){return{'model':db[_0x221114[_0x18c9('0x1d')]],'as':_0x221114['as'],'attributes':_0x221114[_0x18c9('0x19')],'include':_0x221114['include']?_[_0x18c9('0x1b')](_0x221114[_0x18c9('0x1c')],function(_0x180717){return{'model':db[_0x180717[_0x18c9('0x1d')]],'as':_0x180717['as'],'attributes':_0x180717[_0x18c9('0x19')],'include':_0x180717[_0x18c9('0x1c')]?_[_0x18c9('0x1b')](_0x180717[_0x18c9('0x1c')],function(_0x198e83){return{'model':db[_0x198e83[_0x18c9('0x1d')]],'as':_0x198e83['as'],'attributes':_0x198e83['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x908b08){logger['info']('GetInterval',_0x5d11bd);logger[_0x18c9('0xe')](_0x18c9('0x1e'),_0x5d11bd,JSON[_0x18c9('0x11')](_0x908b08));_0x281d4c(_0x908b08);})['catch'](function(_0x26b33e){logger[_0x18c9('0x12')](_0x18c9('0x1e'),_0x26b33e[_0x18c9('0x13')],_0x5d11bd);_0x273eee(_0x534a1e[_0x18c9('0x12')](0x1f4,_0x26b33e[_0x18c9('0x13')]));});});};exports[_0x18c9('0x1f')]=function(_0x27d2f3){var _0x483bc5=this;return new Promise(function(_0xde228c,_0x184ef5){return db[_0x18c9('0x15')][_0x18c9('0x20')]({'raw':_0x27d2f3['options']?_0x27d2f3[_0x18c9('0x17')][_0x18c9('0x18')]===undefined?!![]:![]:!![],'where':_0x27d2f3[_0x18c9('0x17')]?_0x27d2f3[_0x18c9('0x17')][_0x18c9('0x21')]||null:null,'attributes':_0x27d2f3['options']?_0x27d2f3[_0x18c9('0x17')][_0x18c9('0x19')]||null:null,'include':_0x27d2f3[_0x18c9('0x17')]?_0x27d2f3[_0x18c9('0x17')][_0x18c9('0x1c')]?_[_0x18c9('0x1b')](_0x27d2f3['options'][_0x18c9('0x1c')],function(_0x235b25){return{'model':db[_0x235b25['model']],'as':_0x235b25['as'],'attributes':_0x235b25[_0x18c9('0x19')],'include':_0x235b25[_0x18c9('0x1c')]?_[_0x18c9('0x1b')](_0x235b25[_0x18c9('0x1c')],function(_0x401af5){return{'model':db[_0x401af5['model']],'as':_0x401af5['as'],'attributes':_0x401af5['attributes'],'include':_0x401af5[_0x18c9('0x1c')]?_['map'](_0x401af5[_0x18c9('0x1c')],function(_0x115fb6){return{'model':db[_0x115fb6[_0x18c9('0x1d')]],'as':_0x115fb6['as'],'attributes':_0x115fb6['attributes']};}):[]};}):[]};}):[]:[]})[_0x18c9('0x22')](function(_0x33987c){logger['info']('ShowInterval',_0x27d2f3);logger['debug'](_0x18c9('0x1f'),_0x27d2f3,JSON[_0x18c9('0x11')](_0x33987c));_0xde228c(_0x33987c);})['catch'](function(_0x4a3918){logger[_0x18c9('0x12')](_0x18c9('0x1f'),_0x4a3918[_0x18c9('0x13')],_0x27d2f3);_0x184ef5(_0x483bc5[_0x18c9('0x12')](0x1f4,_0x4a3918[_0x18c9('0x13')]));});});}; \ No newline at end of file +var _0xd8e3=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error','Interval,\x20%s,\x20%s','message','catch','findAll','options','raw','where','limit','include','map','model','attributes','then','debug','stringify','GetInterval','ShowInterval','find','lodash'];(function(_0x225cdb,_0x58f68f){var _0x13eca2=function(_0x4e80cd){while(--_0x4e80cd){_0x225cdb['push'](_0x225cdb['shift']());}};_0x13eca2(++_0x58f68f);}(_0xd8e3,0x1a3));var _0x3d8e=function(_0x36ad99,_0x4221b0){_0x36ad99=_0x36ad99-0x0;var _0x5bbbc9=_0xd8e3[_0x36ad99];return _0x5bbbc9;};'use strict';var _=require(_0x3d8e('0x0'));var util=require(_0x3d8e('0x1'));var moment=require('moment');var BPromise=require(_0x3d8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d8e('0x3'));var db=require(_0x3d8e('0x4'))['db'];var utils=require(_0x3d8e('0x5'));var logger=require(_0x3d8e('0x6'))(_0x3d8e('0x7'));var config=require(_0x3d8e('0x8'));var jayson=require(_0x3d8e('0x9'));var client=jayson[_0x3d8e('0xa')][_0x3d8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x368853,_0x1fb39e,_0xa91dfd){return new BPromise(function(_0xb1edc4,_0x41936b){return client[_0x3d8e('0xc')](_0x368853,_0xa91dfd)['then'](function(_0x45ed57){logger[_0x3d8e('0xd')]('Interval,\x20%s,\x20%s',_0x1fb39e,_0x3d8e('0xe'));logger['debug'](_0x3d8e('0xf'),_0x1fb39e,_0x3d8e('0xe'),JSON['stringify'](_0x45ed57));if(_0x45ed57[_0x3d8e('0x10')]){if(_0x45ed57['error']['code']===0x1f4){logger[_0x3d8e('0x10')](_0x3d8e('0x11'),_0x1fb39e,_0x45ed57[_0x3d8e('0x10')][_0x3d8e('0x12')]);return _0x41936b(_0x45ed57['error'][_0x3d8e('0x12')]);}logger[_0x3d8e('0x10')](_0x3d8e('0x11'),_0x1fb39e,_0x45ed57[_0x3d8e('0x10')][_0x3d8e('0x12')]);return _0xb1edc4(_0x45ed57[_0x3d8e('0x10')]['message']);}else{logger['info']('Interval,\x20%s,\x20%s',_0x1fb39e,_0x3d8e('0xe'));_0xb1edc4(_0x45ed57['result'][_0x3d8e('0x12')]);}})[_0x3d8e('0x13')](function(_0x242e74){logger[_0x3d8e('0x10')](_0x3d8e('0x11'),_0x1fb39e,_0x242e74);_0x41936b(_0x242e74);});});}exports['GetInterval']=function(_0x4372dc){var _0x2cfda0=this;return new Promise(function(_0x3b529d,_0x445c80){return db['Interval'][_0x3d8e('0x14')]({'raw':_0x4372dc['options']?_0x4372dc[_0x3d8e('0x15')][_0x3d8e('0x16')]===undefined?!![]:![]:!![],'where':_0x4372dc[_0x3d8e('0x15')]?_0x4372dc[_0x3d8e('0x15')][_0x3d8e('0x17')]||null:null,'attributes':_0x4372dc[_0x3d8e('0x15')]?_0x4372dc[_0x3d8e('0x15')]['attributes']||null:null,'limit':_0x4372dc['options']?_0x4372dc['options'][_0x3d8e('0x18')]||null:null,'include':_0x4372dc[_0x3d8e('0x15')]?_0x4372dc[_0x3d8e('0x15')][_0x3d8e('0x19')]?_[_0x3d8e('0x1a')](_0x4372dc[_0x3d8e('0x15')][_0x3d8e('0x19')],function(_0x3895f3){return{'model':db[_0x3895f3[_0x3d8e('0x1b')]],'as':_0x3895f3['as'],'attributes':_0x3895f3[_0x3d8e('0x1c')],'include':_0x3895f3[_0x3d8e('0x19')]?_['map'](_0x3895f3['include'],function(_0x2f6725){return{'model':db[_0x2f6725['model']],'as':_0x2f6725['as'],'attributes':_0x2f6725[_0x3d8e('0x1c')],'include':_0x2f6725[_0x3d8e('0x19')]?_[_0x3d8e('0x1a')](_0x2f6725[_0x3d8e('0x19')],function(_0x31c5c9){return{'model':db[_0x31c5c9['model']],'as':_0x31c5c9['as'],'attributes':_0x31c5c9['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d8e('0x1d')](function(_0x11c9d9){logger[_0x3d8e('0xd')]('GetInterval',_0x4372dc);logger[_0x3d8e('0x1e')]('GetInterval',_0x4372dc,JSON[_0x3d8e('0x1f')](_0x11c9d9));_0x3b529d(_0x11c9d9);})[_0x3d8e('0x13')](function(_0x2fc27c){logger[_0x3d8e('0x10')](_0x3d8e('0x20'),_0x2fc27c[_0x3d8e('0x12')],_0x4372dc);_0x445c80(_0x2cfda0[_0x3d8e('0x10')](0x1f4,_0x2fc27c[_0x3d8e('0x12')]));});});};exports[_0x3d8e('0x21')]=function(_0x8b3d9a){var _0x182fa0=this;return new Promise(function(_0x3e43f9,_0x1927f2){return db['Interval'][_0x3d8e('0x22')]({'raw':_0x8b3d9a['options']?_0x8b3d9a[_0x3d8e('0x15')][_0x3d8e('0x16')]===undefined?!![]:![]:!![],'where':_0x8b3d9a[_0x3d8e('0x15')]?_0x8b3d9a[_0x3d8e('0x15')][_0x3d8e('0x17')]||null:null,'attributes':_0x8b3d9a[_0x3d8e('0x15')]?_0x8b3d9a[_0x3d8e('0x15')][_0x3d8e('0x1c')]||null:null,'include':_0x8b3d9a[_0x3d8e('0x15')]?_0x8b3d9a['options'][_0x3d8e('0x19')]?_['map'](_0x8b3d9a[_0x3d8e('0x15')][_0x3d8e('0x19')],function(_0x132e2e){return{'model':db[_0x132e2e[_0x3d8e('0x1b')]],'as':_0x132e2e['as'],'attributes':_0x132e2e[_0x3d8e('0x1c')],'include':_0x132e2e[_0x3d8e('0x19')]?_[_0x3d8e('0x1a')](_0x132e2e[_0x3d8e('0x19')],function(_0x40cdee){return{'model':db[_0x40cdee['model']],'as':_0x40cdee['as'],'attributes':_0x40cdee[_0x3d8e('0x1c')],'include':_0x40cdee['include']?_[_0x3d8e('0x1a')](_0x40cdee[_0x3d8e('0x19')],function(_0x563104){return{'model':db[_0x563104[_0x3d8e('0x1b')]],'as':_0x563104['as'],'attributes':_0x563104['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d8e('0x1d')](function(_0xda6358){logger[_0x3d8e('0xd')](_0x3d8e('0x21'),_0x8b3d9a);logger[_0x3d8e('0x1e')](_0x3d8e('0x21'),_0x8b3d9a,JSON[_0x3d8e('0x1f')](_0xda6358));_0x3e43f9(_0xda6358);})['catch'](function(_0x4e77d7){logger[_0x3d8e('0x10')](_0x3d8e('0x21'),_0x4e77d7[_0x3d8e('0x12')],_0x8b3d9a);_0x1927f2(_0x182fa0['error'](0x1f4,_0x4e77d7[_0x3d8e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6f84a76..24162d5 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 _0xa4f9=['../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports','express'];(function(_0xad2257,_0x1203f4){var _0x484cd5=function(_0x55202b){while(--_0x55202b){_0xad2257['push'](_0xad2257['shift']());}};_0x484cd5(++_0x1203f4);}(_0xa4f9,0x18e));var _0x9a4f=function(_0x443cff,_0x46a4d8){_0x443cff=_0x443cff-0x0;var _0x265845=_0xa4f9[_0x443cff];return _0x265845;};'use strict';var express=require(_0x9a4f('0x0'));var router=express['Router']();var auth=require(_0x9a4f('0x1'));var controller=require(_0x9a4f('0x2'));router[_0x9a4f('0x3')]('/',auth[_0x9a4f('0x4')](),controller[_0x9a4f('0x5')]);module[_0x9a4f('0x6')]=router; \ No newline at end of file +var _0xde32=['post','send','exports','express','Router','./jira.controller'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xde32,0xd5));var _0x2de3=function(_0x17adf6,_0x395e3a){_0x17adf6=_0x17adf6-0x0;var _0x1a8364=_0xde32[_0x17adf6];return _0x1a8364;};'use strict';var express=require(_0x2de3('0x0'));var router=express[_0x2de3('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x2de3('0x2'));router[_0x2de3('0x3')]('/',auth['isAuthenticated'](),controller[_0x2de3('0x4')]);module[_0x2de3('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 86ffc08..6f06b48 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 _0xd5ad=['Basic\x20','toString','base64','request','setEncoding','data','statusCode','error','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','stringify','issuetype','email','fields','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','/rest/api/2/issue','POST','application/json'];(function(_0x18b312,_0x32ce71){var _0x5eef75=function(_0x46d88a){while(--_0x46d88a){_0x18b312['push'](_0x18b312['shift']());}};_0x5eef75(++_0x32ce71);}(_0xd5ad,0xce));var _0xdd5a=function(_0x5e0c6d,_0x3a2402){_0x5e0c6d=_0x5e0c6d-0x0;var _0x15a1c4=_0xd5ad[_0x5e0c6d];return _0x15a1c4;};'use strict';var BPromise=require(_0xdd5a('0x0'));var https=require(_0xdd5a('0x1'));var logger=require(_0xdd5a('0x2'))(_0xdd5a('0x3'));var USERNAME=_0xdd5a('0x4');var PASSWORD=_0xdd5a('0x5');function openIssue(_0x4f5b8f,_0x5528ea){var _0xa58bf7={'fields':{'project':{'key':_0x4f5b8f[_0xdd5a('0x6')]||'MOTGUI'},'summary':(_0x4f5b8f[_0xdd5a('0x7')]||_0xdd5a('0x8'))+_0xdd5a('0x9')+_0x4f5b8f['ip'],'description':_0x4f5b8f['description']||JSON[_0xdd5a('0xa')](_0x4f5b8f),'issuetype':{'name':_0x4f5b8f[_0xdd5a('0xb')]||'Bug'}}};_0xa58bf7['fields']['customfield_11500']=_0x4f5b8f[_0xdd5a('0xc')];_0xa58bf7[_0xdd5a('0xd')]['customfield_11501']=_0x4f5b8f[_0xdd5a('0xe')];_0xa58bf7[_0xdd5a('0xd')][_0xdd5a('0xf')]=_0x4f5b8f[_0xdd5a('0x10')];_0xa58bf7[_0xdd5a('0xd')][_0xdd5a('0x11')]=_0x4f5b8f[_0xdd5a('0x12')];_0xa58bf7['fields'][_0xdd5a('0x13')]=_0x4f5b8f['reason'];_0xa58bf7['fields'][_0xdd5a('0x14')]=_0x4f5b8f['ip'];var _0x5580b3={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xdd5a('0x15'),'method':_0xdd5a('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xdd5a('0x17'),'Authorization':_0xdd5a('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xdd5a('0x19')](_0xdd5a('0x1a'))}};var _0x407f3a=JSON[_0xdd5a('0xa')](_0xa58bf7);var _0x2fbcf7=https[_0xdd5a('0x1b')](_0x5580b3,function(_0x2f992b){_0x2f992b[_0xdd5a('0x1c')]('utf8');var _0x14aa5e='';_0x2f992b['on'](_0xdd5a('0x1d'),function(_0x32ef03){_0x14aa5e+=_0x32ef03;});_0x2f992b['on']('end',function(){if(_0x5528ea){return _0x5528ea['status'](_0x2f992b[_0xdd5a('0x1e')])['json'](JSON['parse'](_0x14aa5e));}});});_0x2fbcf7['on'](_0xdd5a('0x1f'),function(_0x4c3060){if(_0x5528ea){return _0x5528ea[_0xdd5a('0x20')](0x1f4)[_0xdd5a('0x21')]({'errors':[{'message':_0xdd5a('0x22'),'type':_0xdd5a('0x23')}]});}});_0x2fbcf7[_0xdd5a('0x24')](_0x407f3a);_0x2fbcf7[_0xdd5a('0x25')]();}exports[_0xdd5a('0x26')]=openIssue;exports[_0xdd5a('0x27')]=function(_0x3a1d32,_0x2cca9f){_0x3a1d32[_0xdd5a('0x28')]['ip']=_0x3a1d32[_0xdd5a('0x29')][_0xdd5a('0x2a')]||_0x3a1d32[_0xdd5a('0x2b')]['remoteAddress']||_0x3a1d32['socket']['remoteAddress']||_0x3a1d32[_0xdd5a('0x2b')][_0xdd5a('0x2c')][_0xdd5a('0x2d')];return openIssue(_0x3a1d32[_0xdd5a('0x28')],_0x2cca9f);}; \ No newline at end of file +var _0xe075=['customfield_11501','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','request','setEncoding','utf8','status','statusCode','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','MOTGUI','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe075,0x141));var _0x5e07=function(_0xf8310c,_0x546ee0){_0xf8310c=_0xf8310c-0x0;var _0x47068d=_0xe075[_0xf8310c];return _0x47068d;};'use strict';var BPromise=require(_0x5e07('0x0'));var https=require(_0x5e07('0x1'));var logger=require(_0x5e07('0x2'))(_0x5e07('0x3'));var USERNAME=_0x5e07('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x41bde5,_0x27981f){var _0x5cc199={'fields':{'project':{'key':_0x41bde5[_0x5e07('0x5')]||_0x5e07('0x6')},'summary':(_0x41bde5['summary']||_0x5e07('0x7'))+_0x5e07('0x8')+_0x41bde5['ip'],'description':_0x41bde5[_0x5e07('0x9')]||JSON[_0x5e07('0xa')](_0x41bde5),'issuetype':{'name':_0x41bde5['issuetype']||_0x5e07('0xb')}}};_0x5cc199['fields'][_0x5e07('0xc')]=_0x41bde5[_0x5e07('0xd')];_0x5cc199[_0x5e07('0xe')][_0x5e07('0xf')]=_0x41bde5['oldToken'];_0x5cc199[_0x5e07('0xe')][_0x5e07('0x10')]=_0x41bde5[_0x5e07('0x11')];_0x5cc199[_0x5e07('0xe')][_0x5e07('0x12')]=_0x41bde5[_0x5e07('0x13')];_0x5cc199[_0x5e07('0xe')]['customfield_11504']=_0x41bde5[_0x5e07('0x14')];_0x5cc199[_0x5e07('0xe')][_0x5e07('0x15')]=_0x41bde5['ip'];var _0x2ea619={'host':_0x5e07('0x16'),'port':0x1bb,'path':_0x5e07('0x17'),'method':_0x5e07('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x5e07('0x19')](_0x5e07('0x1a'))}};var _0x1321e4=JSON[_0x5e07('0xa')](_0x5cc199);var _0x4147cd=https[_0x5e07('0x1b')](_0x2ea619,function(_0x3cf33e){_0x3cf33e[_0x5e07('0x1c')](_0x5e07('0x1d'));var _0x80e55d='';_0x3cf33e['on']('data',function(_0x213d30){_0x80e55d+=_0x213d30;});_0x3cf33e['on']('end',function(){if(_0x27981f){return _0x27981f[_0x5e07('0x1e')](_0x3cf33e[_0x5e07('0x1f')])['json'](JSON[_0x5e07('0x20')](_0x80e55d));}});});_0x4147cd['on']('error',function(_0x3788ed){if(_0x27981f){return _0x27981f['status'](0x1f4)['json']({'errors':[{'message':_0x5e07('0x21'),'type':_0x5e07('0x22')}]});}});_0x4147cd[_0x5e07('0x23')](_0x1321e4);_0x4147cd['end']();}exports[_0x5e07('0x24')]=openIssue;exports[_0x5e07('0x25')]=function(_0x5a7673,_0x56f221){_0x5a7673[_0x5e07('0x26')]['ip']=_0x5a7673['headers']['x-forwarded-for']||_0x5a7673[_0x5e07('0x27')][_0x5e07('0x28')]||_0x5a7673[_0x5e07('0x29')]['remoteAddress']||_0x5a7673['connection']['socket'][_0x5e07('0x28')];return openIssue(_0x5a7673['body'],_0x56f221);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 229fe21..1c44643 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 _0x9ec1=['post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9ec1,0x77));var _0x19ec=function(_0x29186d,_0x4743c9){_0x29186d=_0x29186d-0x0;var _0x157360=_0x9ec1[_0x29186d];return _0x157360;};'use strict';var multer=require(_0x19ec('0x0'));var util=require(_0x19ec('0x1'));var path=require(_0x19ec('0x2'));var timeout=require(_0x19ec('0x3'));var express=require('express');var router=express[_0x19ec('0x4')]();var auth=require(_0x19ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x19ec('0x6'));var controller=require(_0x19ec('0x7'));router[_0x19ec('0x8')]('/',auth[_0x19ec('0x9')](),controller[_0x19ec('0xa')]);router[_0x19ec('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x19ec('0xb')]);router[_0x19ec('0x8')](_0x19ec('0xc'),auth[_0x19ec('0x9')](),controller[_0x19ec('0xd')]);router[_0x19ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x19ec('0xf')]);router['put'](_0x19ec('0xc'),auth[_0x19ec('0x9')](),controller[_0x19ec('0x10')]);router[_0x19ec('0x11')](_0x19ec('0xc'),auth[_0x19ec('0x9')](),controller[_0x19ec('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7ee8=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','exports','util','connect-timeout','express','Router'];(function(_0x35a3e4,_0x26b109){var _0x567beb=function(_0x4087ef){while(--_0x4087ef){_0x35a3e4['push'](_0x35a3e4['shift']());}};_0x567beb(++_0x26b109);}(_0x7ee8,0xf8));var _0x87ee=function(_0x39732c,_0x46ced1){_0x39732c=_0x39732c-0x0;var _0x2f5eda=_0x7ee8[_0x39732c];return _0x2f5eda;};'use strict';var multer=require('multer');var util=require(_0x87ee('0x0'));var path=require('path');var timeout=require(_0x87ee('0x1'));var express=require(_0x87ee('0x2'));var router=express[_0x87ee('0x3')]();var auth=require(_0x87ee('0x4'));var interaction=require(_0x87ee('0x5'));var config=require('../../config/environment');var controller=require(_0x87ee('0x6'));router[_0x87ee('0x7')]('/',auth[_0x87ee('0x8')](),controller[_0x87ee('0x9')]);router['get'](_0x87ee('0xa'),auth[_0x87ee('0x8')](),controller[_0x87ee('0xb')]);router[_0x87ee('0x7')](_0x87ee('0xc'),auth[_0x87ee('0x8')](),controller[_0x87ee('0xd')]);router[_0x87ee('0xe')]('/',auth[_0x87ee('0x8')](),controller['create']);router[_0x87ee('0xf')]('/:id',auth[_0x87ee('0x8')](),controller['update']);router[_0x87ee('0x10')](_0x87ee('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x87ee('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index d76df9f..db2fb54 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 _0x2659=['sequelize','STRING','TEXT','long'];(function(_0x578dd0,_0x14a476){var _0x1d633f=function(_0x4008de){while(--_0x4008de){_0x578dd0['push'](_0x578dd0['shift']());}};_0x1d633f(++_0x14a476);}(_0x2659,0x1a8));var _0x9265=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x2659[_0x1d39f6];return _0x3dbd7a;};'use strict';var Sequelize=require(_0x9265('0x0'));module['exports']={'question':{'type':Sequelize[_0x9265('0x1')]},'answer':{'type':Sequelize[_0x9265('0x2')](_0x9265('0x3'))},'membername':{'type':Sequelize[_0x9265('0x1')]},'projectname':{'type':Sequelize[_0x9265('0x1')]},'queue':{'type':Sequelize[_0x9265('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9265('0x1')]},'calleridnum':{'type':Sequelize[_0x9265('0x1')]},'questionId':{'type':Sequelize[_0x9265('0x1')]}}; \ No newline at end of file +var _0xd952=['STRING','TEXT','long','sequelize'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xd952,0x1df));var _0x2d95=function(_0x4e4696,_0x30cbf6){_0x4e4696=_0x4e4696-0x0;var _0x329938=_0xd952[_0x4e4696];return _0x329938;};'use strict';var Sequelize=require(_0x2d95('0x0'));module['exports']={'question':{'type':Sequelize[_0x2d95('0x1')]},'answer':{'type':Sequelize[_0x2d95('0x2')](_0x2d95('0x3'))},'membername':{'type':Sequelize[_0x2d95('0x1')]},'projectname':{'type':Sequelize[_0x2d95('0x1')]},'queue':{'type':Sequelize[_0x2d95('0x1')]},'uniqueid':{'type':Sequelize[_0x2d95('0x1')]},'calleridname':{'type':Sequelize[_0x2d95('0x1')]},'calleridnum':{'type':Sequelize[_0x2d95('0x1')]},'questionId':{'type':Sequelize[_0x2d95('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index b094a96..992ecb3 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 _0x3d8b=['key','VIRTUAL','field','JscriptyAnswerReport','count','includeAll','include','params','options','catch','create','body','destroy','find','describe','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','type'];(function(_0x558472,_0x27ffcf){var _0x37e917=function(_0x5759cd){while(--_0x5759cd){_0x558472['push'](_0x558472['shift']());}};_0x37e917(++_0x27ffcf);}(_0x3d8b,0x1cb));var _0xb3d8=function(_0x4f1128,_0x4f2aa7){_0x4f1128=_0x4f1128-0x0;var _0x5c865e=_0x3d8b[_0x4f1128];return _0x5c865e;};'use strict';var pdf=require(_0xb3d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb3d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb3d8('0x2'));var moment=require(_0xb3d8('0x3'));var BPromise=require(_0xb3d8('0x4'));var Mustache=require(_0xb3d8('0x5'));var util=require(_0xb3d8('0x6'));var path=require(_0xb3d8('0x7'));var sox=require(_0xb3d8('0x8'));var csv=require(_0xb3d8('0x9'));var ejs=require(_0xb3d8('0xa'));var fs=require('fs');var _=require(_0xb3d8('0xb'));var squel=require(_0xb3d8('0xc'));var crypto=require(_0xb3d8('0xd'));var jsforce=require(_0xb3d8('0xe'));var deskjs=require(_0xb3d8('0xf'));var toCsv=require(_0xb3d8('0x9'));var querystring=require(_0xb3d8('0x10'));var Papa=require(_0xb3d8('0x11'));var Redis=require(_0xb3d8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb3d8('0x13'));var hardwareService=require(_0xb3d8('0x14'));var logger=require(_0xb3d8('0x15'))(_0xb3d8('0x16'));var utils=require('../../config/utils');var config=require(_0xb3d8('0x17'));var db=require(_0xb3d8('0x18'))['db'];function respondWithStatusCode(_0x14e323,_0x5e2baf){_0x5e2baf=_0x5e2baf||0xcc;return function(_0x255cd1){if(_0x255cd1){return _0x14e323['sendStatus'](_0x5e2baf);}return _0x14e323['status'](_0x5e2baf)[_0xb3d8('0x19')]();};}function respondWithResult(_0x54162e,_0x18ee41){_0x18ee41=_0x18ee41||0xc8;return function(_0x1baa27){if(_0x1baa27){return _0x54162e[_0xb3d8('0x1a')](_0x18ee41)[_0xb3d8('0x1b')](_0x1baa27);}};}function respondWithFilteredResult(_0x19f009,_0x591fed){return function(_0x1359d5){if(_0x1359d5){var _0x4c7932=_0x1359d5['count'],_0x468451=_0x591fed[_0xb3d8('0x1c')],_0x34d55a=_0x591fed['offset']+_0x591fed['limit'],_0x5a5809;if(_0x34d55a>=_0x4c7932){_0x34d55a=_0x4c7932;_0x5a5809=0xc8;}else{_0x5a5809=0xce;}_0x19f009['status'](_0x5a5809);return _0x19f009[_0xb3d8('0x1d')](_0xb3d8('0x1e'),_0x468451+'-'+_0x34d55a+'/'+_0x4c7932)[_0xb3d8('0x1b')](_0x1359d5);}return null;};}function patchUpdates(_0x2a44a9){return function(_0x4cd3da){try{jsonpatch['apply'](_0x4cd3da,_0x2a44a9,!![]);}catch(_0x33b500){return BPromise[_0xb3d8('0x1f')](_0x33b500);}return _0x4cd3da[_0xb3d8('0x20')]();};}function saveUpdates(_0x5a3ef4,_0x2cf585){return function(_0x50d276){if(_0x50d276){return _0x50d276[_0xb3d8('0x21')](_0x5a3ef4)['then'](function(_0x464bc5){return _0x464bc5;});}return null;};}function removeEntity(_0x50eb09,_0xa6dd0f){return function(_0x657cb3){if(_0x657cb3){return _0x657cb3['destroy']()[_0xb3d8('0x22')](function(){_0x50eb09['status'](0xcc)[_0xb3d8('0x19')]();});}};}function handleEntityNotFound(_0x2de471,_0x5ce35d){return function(_0x27cd4d){if(!_0x27cd4d){_0x2de471['sendStatus'](0x194);}return _0x27cd4d;};}function handleError(_0x5211e7,_0x5a0461){_0x5a0461=_0x5a0461||0x1f4;return function(_0x37a8d9){logger[_0xb3d8('0x23')](_0x37a8d9[_0xb3d8('0x24')]);if(_0x37a8d9[_0xb3d8('0x25')]){delete _0x37a8d9['name'];}_0x5211e7['status'](_0x5a0461)[_0xb3d8('0x26')](_0x37a8d9);};}exports['index']=function(_0x567683,_0x301ab1){var _0x49a2a7={},_0x5c1098={},_0x54f611={'count':0x0,'rows':[]};var _0x5162c2=db['JscriptyAnswerReport'][_0xb3d8('0x27')];_0x5c1098[_0xb3d8('0x28')]=_[_0xb3d8('0x29')](_0x5162c2);_0x5c1098[_0xb3d8('0x2a')]=_[_0xb3d8('0x29')](_0x567683['query']);_0x5c1098[_0xb3d8('0x2b')]=_[_0xb3d8('0x2c')](_0x5c1098[_0xb3d8('0x28')],_0x5c1098[_0xb3d8('0x2a')]);_0x49a2a7[_0xb3d8('0x2d')]=_[_0xb3d8('0x2c')](_0x5c1098[_0xb3d8('0x28')],qs[_0xb3d8('0x2e')](_0x567683['query'][_0xb3d8('0x2e')]));_0x49a2a7['attributes']=_0x49a2a7['attributes'][_0xb3d8('0x2f')]?_0x49a2a7[_0xb3d8('0x2d')]:_0x5c1098[_0xb3d8('0x28')];if(!_0x567683['query'][_0xb3d8('0x30')](_0xb3d8('0x31'))){_0x49a2a7[_0xb3d8('0x32')]=qs[_0xb3d8('0x32')](_0x567683[_0xb3d8('0x2a')][_0xb3d8('0x32')]);_0x49a2a7[_0xb3d8('0x1c')]=qs[_0xb3d8('0x1c')](_0x567683['query']['offset']);}_0x49a2a7[_0xb3d8('0x33')]=qs[_0xb3d8('0x34')](_0x567683[_0xb3d8('0x2a')][_0xb3d8('0x34')]);_0x49a2a7['where']=qs[_0xb3d8('0x2b')](_[_0xb3d8('0x35')](_0x567683['query'],_0x5c1098[_0xb3d8('0x2b')]));if(_0x567683[_0xb3d8('0x2a')][_0xb3d8('0x36')]){_0x49a2a7[_0xb3d8('0x37')]=_[_0xb3d8('0x38')](_0x49a2a7[_0xb3d8('0x37')],{'$or':_[_0xb3d8('0x39')](_0x5162c2,function(_0x42abf8){if(_0x42abf8[_0xb3d8('0x3a')][_0xb3d8('0x3b')]!==_0xb3d8('0x3c')){var _0x23ec83={};_0x23ec83[_0x42abf8[_0xb3d8('0x3d')]]={'$like':'%'+_0x567683['query'][_0xb3d8('0x36')]+'%'};return _0x23ec83;}})});}_0x49a2a7=_[_0xb3d8('0x38')]({},_0x49a2a7,_0x567683['options']);var _0x17273b={'where':_0x49a2a7[_0xb3d8('0x37')]};return db[_0xb3d8('0x3e')][_0xb3d8('0x3f')](_0x17273b)[_0xb3d8('0x22')](function(_0x5e6634){_0x54f611[_0xb3d8('0x3f')]=_0x5e6634;if(_0x567683[_0xb3d8('0x2a')][_0xb3d8('0x40')]){_0x49a2a7[_0xb3d8('0x41')]=[{'all':!![]}];}return db[_0xb3d8('0x3e')]['findAll'](_0x49a2a7);})[_0xb3d8('0x22')](function(_0x1f44cc){_0x54f611['rows']=_0x1f44cc;return _0x54f611;})[_0xb3d8('0x22')](respondWithFilteredResult(_0x301ab1,_0x49a2a7))['catch'](handleError(_0x301ab1,null));};exports['show']=function(_0xde3e35,_0x314bfb){var _0x198d64={'raw':!![],'where':{'id':_0xde3e35[_0xb3d8('0x42')]['id']}},_0x1784e8={};_0x1784e8[_0xb3d8('0x28')]=_[_0xb3d8('0x29')](db[_0xb3d8('0x3e')][_0xb3d8('0x27')]);_0x1784e8[_0xb3d8('0x2a')]=_['keys'](_0xde3e35[_0xb3d8('0x2a')]);_0x1784e8[_0xb3d8('0x2b')]=_[_0xb3d8('0x2c')](_0x1784e8[_0xb3d8('0x28')],_0x1784e8[_0xb3d8('0x2a')]);_0x198d64[_0xb3d8('0x2d')]=_[_0xb3d8('0x2c')](_0x1784e8[_0xb3d8('0x28')],qs[_0xb3d8('0x2e')](_0xde3e35['query'][_0xb3d8('0x2e')]));_0x198d64[_0xb3d8('0x2d')]=_0x198d64['attributes'][_0xb3d8('0x2f')]?_0x198d64[_0xb3d8('0x2d')]:_0x1784e8[_0xb3d8('0x28')];if(_0xde3e35['query'][_0xb3d8('0x40')]){_0x198d64['include']=[{'all':!![]}];}_0x198d64=_[_0xb3d8('0x38')]({},_0x198d64,_0xde3e35[_0xb3d8('0x43')]);return db[_0xb3d8('0x3e')]['find'](_0x198d64)[_0xb3d8('0x22')](handleEntityNotFound(_0x314bfb,null))[_0xb3d8('0x22')](respondWithResult(_0x314bfb,null))[_0xb3d8('0x44')](handleError(_0x314bfb,null));};exports[_0xb3d8('0x45')]=function(_0x379ceb,_0x3e8328){return db[_0xb3d8('0x3e')][_0xb3d8('0x45')](_0x379ceb[_0xb3d8('0x46')],{})['then'](respondWithResult(_0x3e8328,0xc9))['catch'](handleError(_0x3e8328,null));};exports[_0xb3d8('0x21')]=function(_0x2dfa4a,_0x530528){if(_0x2dfa4a['body']['id']){delete _0x2dfa4a['body']['id'];}return db[_0xb3d8('0x3e')]['find']({'where':{'id':_0x2dfa4a['params']['id']}})[_0xb3d8('0x22')](handleEntityNotFound(_0x530528,null))[_0xb3d8('0x22')](saveUpdates(_0x2dfa4a[_0xb3d8('0x46')],null))[_0xb3d8('0x22')](respondWithResult(_0x530528,null))[_0xb3d8('0x44')](handleError(_0x530528,null));};exports[_0xb3d8('0x47')]=function(_0x27a8ce,_0x1e1437){return db[_0xb3d8('0x3e')][_0xb3d8('0x48')]({'where':{'id':_0x27a8ce[_0xb3d8('0x42')]['id']}})[_0xb3d8('0x22')](handleEntityNotFound(_0x1e1437,null))[_0xb3d8('0x22')](removeEntity(_0x1e1437,null))[_0xb3d8('0x44')](handleError(_0x1e1437,null));};exports[_0xb3d8('0x49')]=function(_0x116108,_0x17f4b3){return db[_0xb3d8('0x3e')]['describe']()[_0xb3d8('0x22')](respondWithResult(_0x17f4b3,null))[_0xb3d8('0x44')](handleError(_0x17f4b3,null));}; \ No newline at end of file +var _0xfb68=['destroy','end','sendStatus','error','stack','name','index','JscriptyAnswerReport','rawAttributes','model','keys','query','attributes','fields','hasOwnProperty','limit','order','where','filters','pick','merge','map','type','key','VIRTUAL','field','then','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','set','Content-Range','apply','save'];(function(_0x3f266c,_0x198483){var _0x4db3c2=function(_0x3f40df){while(--_0x3f40df){_0x3f266c['push'](_0x3f266c['shift']());}};_0x4db3c2(++_0x198483);}(_0xfb68,0x71));var _0x8fb6=function(_0x3da9cb,_0x6b11f0){_0x3da9cb=_0x3da9cb-0x0;var _0x2758fb=_0xfb68[_0x3da9cb];return _0x2758fb;};'use strict';var pdf=require(_0x8fb6('0x0'));var emlformat=require(_0x8fb6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8fb6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fb6('0x3'));var moment=require(_0x8fb6('0x4'));var BPromise=require(_0x8fb6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8fb6('0x6'));var sox=require(_0x8fb6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8fb6('0x8'));var crypto=require(_0x8fb6('0x9'));var jsforce=require(_0x8fb6('0xa'));var deskjs=require(_0x8fb6('0xb'));var toCsv=require(_0x8fb6('0xc'));var querystring=require(_0x8fb6('0xd'));var Papa=require(_0x8fb6('0xe'));var Redis=require(_0x8fb6('0xf'));var authService=require(_0x8fb6('0x10'));var qs=require(_0x8fb6('0x11'));var hardwareService=require(_0x8fb6('0x12'));var logger=require(_0x8fb6('0x13'))(_0x8fb6('0x14'));var utils=require(_0x8fb6('0x15'));var config=require('../../config/environment');var db=require(_0x8fb6('0x16'))['db'];function respondWithStatusCode(_0x19be69,_0x28d218){_0x28d218=_0x28d218||0xcc;return function(_0x16a4e7){if(_0x16a4e7){return _0x19be69['sendStatus'](_0x28d218);}return _0x19be69['status'](_0x28d218)['end']();};}function respondWithResult(_0x529210,_0x884cde){_0x884cde=_0x884cde||0xc8;return function(_0x2a93e4){if(_0x2a93e4){return _0x529210[_0x8fb6('0x17')](_0x884cde)[_0x8fb6('0x18')](_0x2a93e4);}};}function respondWithFilteredResult(_0x522545,_0x27f13e){return function(_0x45e8fa){if(_0x45e8fa){var _0x413948=_0x45e8fa[_0x8fb6('0x19')],_0x1b5b76=_0x27f13e[_0x8fb6('0x1a')],_0x377385=_0x27f13e[_0x8fb6('0x1a')]+_0x27f13e['limit'],_0x168e25;if(_0x377385>=_0x413948){_0x377385=_0x413948;_0x168e25=0xc8;}else{_0x168e25=0xce;}_0x522545['status'](_0x168e25);return _0x522545[_0x8fb6('0x1b')](_0x8fb6('0x1c'),_0x1b5b76+'-'+_0x377385+'/'+_0x413948)[_0x8fb6('0x18')](_0x45e8fa);}return null;};}function patchUpdates(_0x16cb31){return function(_0x1aa019){try{jsonpatch[_0x8fb6('0x1d')](_0x1aa019,_0x16cb31,!![]);}catch(_0x48d2f1){return BPromise['reject'](_0x48d2f1);}return _0x1aa019[_0x8fb6('0x1e')]();};}function saveUpdates(_0x11701f,_0x30167f){return function(_0x93be05){if(_0x93be05){return _0x93be05['update'](_0x11701f)['then'](function(_0x203b9a){return _0x203b9a;});}return null;};}function removeEntity(_0xe2a4a0,_0xfc1823){return function(_0x48a9a4){if(_0x48a9a4){return _0x48a9a4[_0x8fb6('0x1f')]()['then'](function(){_0xe2a4a0[_0x8fb6('0x17')](0xcc)[_0x8fb6('0x20')]();});}};}function handleEntityNotFound(_0x360003,_0x504f86){return function(_0x298271){if(!_0x298271){_0x360003[_0x8fb6('0x21')](0x194);}return _0x298271;};}function handleError(_0x4db2fd,_0x33f9a7){_0x33f9a7=_0x33f9a7||0x1f4;return function(_0x3e405a){logger[_0x8fb6('0x22')](_0x3e405a[_0x8fb6('0x23')]);if(_0x3e405a[_0x8fb6('0x24')]){delete _0x3e405a[_0x8fb6('0x24')];}_0x4db2fd['status'](_0x33f9a7)['send'](_0x3e405a);};}exports[_0x8fb6('0x25')]=function(_0x409cbe,_0x40a9a6){var _0xb1434={},_0x37a3e0={},_0x2351db={'count':0x0,'rows':[]};var _0x64b0f6=db[_0x8fb6('0x26')][_0x8fb6('0x27')];_0x37a3e0[_0x8fb6('0x28')]=_[_0x8fb6('0x29')](_0x64b0f6);_0x37a3e0[_0x8fb6('0x2a')]=_['keys'](_0x409cbe[_0x8fb6('0x2a')]);_0x37a3e0['filters']=_['intersection'](_0x37a3e0['model'],_0x37a3e0[_0x8fb6('0x2a')]);_0xb1434[_0x8fb6('0x2b')]=_['intersection'](_0x37a3e0[_0x8fb6('0x28')],qs[_0x8fb6('0x2c')](_0x409cbe['query'][_0x8fb6('0x2c')]));_0xb1434['attributes']=_0xb1434[_0x8fb6('0x2b')]['length']?_0xb1434[_0x8fb6('0x2b')]:_0x37a3e0['model'];if(!_0x409cbe[_0x8fb6('0x2a')][_0x8fb6('0x2d')]('nolimit')){_0xb1434[_0x8fb6('0x2e')]=qs[_0x8fb6('0x2e')](_0x409cbe[_0x8fb6('0x2a')]['limit']);_0xb1434[_0x8fb6('0x1a')]=qs['offset'](_0x409cbe[_0x8fb6('0x2a')]['offset']);}_0xb1434[_0x8fb6('0x2f')]=qs['sort'](_0x409cbe[_0x8fb6('0x2a')]['sort']);_0xb1434[_0x8fb6('0x30')]=qs[_0x8fb6('0x31')](_[_0x8fb6('0x32')](_0x409cbe['query'],_0x37a3e0['filters']));if(_0x409cbe[_0x8fb6('0x2a')]['filter']){_0xb1434['where']=_[_0x8fb6('0x33')](_0xb1434[_0x8fb6('0x30')],{'$or':_[_0x8fb6('0x34')](_0x64b0f6,function(_0x34281e){if(_0x34281e[_0x8fb6('0x35')][_0x8fb6('0x36')]!==_0x8fb6('0x37')){var _0x3d6948={};_0x3d6948[_0x34281e[_0x8fb6('0x38')]]={'$like':'%'+_0x409cbe['query']['filter']+'%'};return _0x3d6948;}})});}_0xb1434=_['merge']({},_0xb1434,_0x409cbe['options']);var _0x1d49a0={'where':_0xb1434['where']};return db['JscriptyAnswerReport'][_0x8fb6('0x19')](_0x1d49a0)[_0x8fb6('0x39')](function(_0x264148){_0x2351db['count']=_0x264148;if(_0x409cbe[_0x8fb6('0x2a')][_0x8fb6('0x3a')]){_0xb1434[_0x8fb6('0x3b')]=[{'all':!![]}];}return db[_0x8fb6('0x26')][_0x8fb6('0x3c')](_0xb1434);})[_0x8fb6('0x39')](function(_0x2dc462){_0x2351db[_0x8fb6('0x3d')]=_0x2dc462;return _0x2351db;})[_0x8fb6('0x39')](respondWithFilteredResult(_0x40a9a6,_0xb1434))[_0x8fb6('0x3e')](handleError(_0x40a9a6,null));};exports[_0x8fb6('0x3f')]=function(_0x34b180,_0x3d5c79){var _0x26e908={'raw':!![],'where':{'id':_0x34b180[_0x8fb6('0x40')]['id']}},_0x5ea583={};_0x5ea583['model']=_[_0x8fb6('0x29')](db[_0x8fb6('0x26')][_0x8fb6('0x27')]);_0x5ea583[_0x8fb6('0x2a')]=_[_0x8fb6('0x29')](_0x34b180[_0x8fb6('0x2a')]);_0x5ea583[_0x8fb6('0x31')]=_[_0x8fb6('0x41')](_0x5ea583['model'],_0x5ea583[_0x8fb6('0x2a')]);_0x26e908['attributes']=_['intersection'](_0x5ea583[_0x8fb6('0x28')],qs[_0x8fb6('0x2c')](_0x34b180[_0x8fb6('0x2a')][_0x8fb6('0x2c')]));_0x26e908['attributes']=_0x26e908[_0x8fb6('0x2b')][_0x8fb6('0x42')]?_0x26e908['attributes']:_0x5ea583['model'];if(_0x34b180[_0x8fb6('0x2a')][_0x8fb6('0x3a')]){_0x26e908[_0x8fb6('0x3b')]=[{'all':!![]}];}_0x26e908=_[_0x8fb6('0x33')]({},_0x26e908,_0x34b180[_0x8fb6('0x43')]);return db[_0x8fb6('0x26')]['find'](_0x26e908)[_0x8fb6('0x39')](handleEntityNotFound(_0x3d5c79,null))[_0x8fb6('0x39')](respondWithResult(_0x3d5c79,null))[_0x8fb6('0x3e')](handleError(_0x3d5c79,null));};exports[_0x8fb6('0x44')]=function(_0xfb2cbd,_0x294aaf){return db[_0x8fb6('0x26')][_0x8fb6('0x44')](_0xfb2cbd[_0x8fb6('0x45')],{})[_0x8fb6('0x39')](respondWithResult(_0x294aaf,0xc9))[_0x8fb6('0x3e')](handleError(_0x294aaf,null));};exports['update']=function(_0x3f9c2d,_0x5541ab){if(_0x3f9c2d[_0x8fb6('0x45')]['id']){delete _0x3f9c2d[_0x8fb6('0x45')]['id'];}return db[_0x8fb6('0x26')][_0x8fb6('0x46')]({'where':{'id':_0x3f9c2d['params']['id']}})['then'](handleEntityNotFound(_0x5541ab,null))[_0x8fb6('0x39')](saveUpdates(_0x3f9c2d[_0x8fb6('0x45')],null))[_0x8fb6('0x39')](respondWithResult(_0x5541ab,null))[_0x8fb6('0x3e')](handleError(_0x5541ab,null));};exports[_0x8fb6('0x1f')]=function(_0x589627,_0xa3569a){return db[_0x8fb6('0x26')][_0x8fb6('0x46')]({'where':{'id':_0x589627['params']['id']}})[_0x8fb6('0x39')](handleEntityNotFound(_0xa3569a,null))[_0x8fb6('0x39')](removeEntity(_0xa3569a,null))[_0x8fb6('0x3e')](handleError(_0xa3569a,null));};exports['describe']=function(_0x153b9f,_0x27480e){return db[_0x8fb6('0x26')][_0x8fb6('0x47')]()[_0x8fb6('0x39')](respondWithResult(_0x27480e,null))[_0x8fb6('0x3e')](handleError(_0x27480e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9ee79f3..853d2d7 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 _0x575b=['util','bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x5798d2,_0x2063cf){var _0x5d42fc=function(_0x496dda){while(--_0x496dda){_0x5798d2['push'](_0x5798d2['shift']());}};_0x5d42fc(++_0x2063cf);}(_0x575b,0x1b7));var _0xb575=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x575b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb575('0x0'));var util=require(_0xb575('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb575('0x2'));var rp=require(_0xb575('0x3'));var fs=require('fs');var path=require(_0xb575('0x4'));var rimraf=require(_0xb575('0x5'));var config=require(_0xb575('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xb575('0x7')]=function(_0x18ece6,_0x2d489e){return _0x18ece6['define'](_0xb575('0x8'),attributes,{'tableName':_0xb575('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3203=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x3a53dc,_0x26b3c1){var _0x3dfae4=function(_0x508c9e){while(--_0x508c9e){_0x3a53dc['push'](_0x3a53dc['shift']());}};_0x3dfae4(++_0x26b3c1);}(_0x3203,0x84));var _0x3320=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3203[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x3320('0x0'));var util=require(_0x3320('0x1'));var logger=require(_0x3320('0x2'))(_0x3320('0x3'));var moment=require(_0x3320('0x4'));var BPromise=require(_0x3320('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3320('0x6'));var rimraf=require(_0x3320('0x7'));var config=require('../../config/environment');var attributes=require(_0x3320('0x8'));module[_0x3320('0x9')]=function(_0x52eede,_0x327441){return _0x52eede[_0x3320('0xa')](_0x3320('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ca18691..ad6db03 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 _0x0ae6=['JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x0ae6,0x17e));var _0x60ae=function(_0xf61c1e,_0x509c96){_0xf61c1e=_0xf61c1e-0x0;var _0x1db0fa=_0x0ae6[_0xf61c1e];return _0x1db0fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60ae('0x0'));var BPromise=require(_0x60ae('0x1'));var rs=require(_0x60ae('0x2'));var fs=require('fs');var Redis=require(_0x60ae('0x3'));var db=require(_0x60ae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x60ae('0x5'))(_0x60ae('0x6'));var config=require(_0x60ae('0x7'));var jayson=require(_0x60ae('0x8'));var client=jayson[_0x60ae('0x9')][_0x60ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50010d,_0x4953c9,_0x242404){return new BPromise(function(_0xb8836b,_0x2498fe){return client[_0x60ae('0xb')](_0x50010d,_0x242404)[_0x60ae('0xc')](function(_0x492842){logger[_0x60ae('0xd')](_0x60ae('0xe'),_0x4953c9,'request\x20sent');logger[_0x60ae('0xf')](_0x60ae('0x10'),_0x4953c9,_0x60ae('0x11'),JSON[_0x60ae('0x12')](_0x492842));if(_0x492842[_0x60ae('0x13')]){if(_0x492842[_0x60ae('0x13')][_0x60ae('0x14')]===0x1f4){logger[_0x60ae('0x13')](_0x60ae('0xe'),_0x4953c9,_0x492842['error'][_0x60ae('0x15')]);return _0x2498fe(_0x492842[_0x60ae('0x13')][_0x60ae('0x15')]);}logger['error'](_0x60ae('0xe'),_0x4953c9,_0x492842[_0x60ae('0x13')][_0x60ae('0x15')]);return _0xb8836b(_0x492842['error'][_0x60ae('0x15')]);}else{logger[_0x60ae('0xd')](_0x60ae('0xe'),_0x4953c9,_0x60ae('0x11'));_0xb8836b(_0x492842['result'][_0x60ae('0x15')]);}})['catch'](function(_0x522db8){logger[_0x60ae('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4953c9,_0x522db8);_0x2498fe(_0x522db8);});});} \ No newline at end of file +var _0x2304=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis'];(function(_0x1b6bad,_0x25fcf2){var _0x19f321=function(_0x3230bd){while(--_0x3230bd){_0x1b6bad['push'](_0x1b6bad['shift']());}};_0x19f321(++_0x25fcf2);}(_0x2304,0x18b));var _0x4230=function(_0x175dda,_0x10e362){_0x175dda=_0x175dda-0x0;var _0x323c82=_0x2304[_0x175dda];return _0x323c82;};'use strict';var _=require('lodash');var util=require(_0x4230('0x0'));var moment=require('moment');var BPromise=require(_0x4230('0x1'));var rs=require(_0x4230('0x2'));var fs=require('fs');var Redis=require(_0x4230('0x3'));var db=require(_0x4230('0x4'))['db'];var utils=require(_0x4230('0x5'));var logger=require(_0x4230('0x6'))(_0x4230('0x7'));var config=require(_0x4230('0x8'));var jayson=require(_0x4230('0x9'));var client=jayson[_0x4230('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x64cd64,_0x1e650e,_0x1bcba2){return new BPromise(function(_0xc62bc3,_0x5ecf6a){return client[_0x4230('0xb')](_0x64cd64,_0x1bcba2)['then'](function(_0x5b3448){logger[_0x4230('0xc')](_0x4230('0xd'),_0x1e650e,_0x4230('0xe'));logger['debug'](_0x4230('0xf'),_0x1e650e,'request\x20sent',JSON[_0x4230('0x10')](_0x5b3448));if(_0x5b3448[_0x4230('0x11')]){if(_0x5b3448[_0x4230('0x11')][_0x4230('0x12')]===0x1f4){logger['error'](_0x4230('0xd'),_0x1e650e,_0x5b3448[_0x4230('0x11')][_0x4230('0x13')]);return _0x5ecf6a(_0x5b3448[_0x4230('0x11')][_0x4230('0x13')]);}logger[_0x4230('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e650e,_0x5b3448['error'][_0x4230('0x13')]);return _0xc62bc3(_0x5b3448[_0x4230('0x11')][_0x4230('0x13')]);}else{logger[_0x4230('0xc')](_0x4230('0xd'),_0x1e650e,_0x4230('0xe'));_0xc62bc3(_0x5b3448[_0x4230('0x14')][_0x4230('0x13')]);}})['catch'](function(_0x8ff0d0){logger[_0x4230('0x11')](_0x4230('0xd'),_0x1e650e,_0x8ff0d0);_0x5ecf6a(_0x8ff0d0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 25cbde2..cdbe971 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 _0xe6c5=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','index','/:id','isAuthenticated','show','get','/:id/sessions','getAnswers','/:id/summary','30s','getSummary','post','create','clone','update','delete','destroy','exports','multer','util'];(function(_0x1f97e0,_0x24f246){var _0xac45c0=function(_0x19c3fd){while(--_0x19c3fd){_0x1f97e0['push'](_0x1f97e0['shift']());}};_0xac45c0(++_0x24f246);}(_0xe6c5,0x11c));var _0x5e6c=function(_0x2ed97a,_0x186fb6){_0x2ed97a=_0x2ed97a-0x0;var _0x587589=_0xe6c5[_0x2ed97a];return _0x587589;};'use strict';var multer=require(_0x5e6c('0x0'));var util=require(_0x5e6c('0x1'));var path=require(_0x5e6c('0x2'));var timeout=require(_0x5e6c('0x3'));var express=require(_0x5e6c('0x4'));var router=express[_0x5e6c('0x5')]();var auth=require(_0x5e6c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5e6c('0x7'));var controller=require(_0x5e6c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5e6c('0x9')]);router['get'](_0x5e6c('0xa'),auth[_0x5e6c('0xb')](),controller[_0x5e6c('0xc')]);router[_0x5e6c('0xd')](_0x5e6c('0xe'),auth[_0x5e6c('0xb')](),controller['getSessions']);router[_0x5e6c('0xd')]('/:id/answers',auth['isAuthenticated'](),controller[_0x5e6c('0xf')]);router['get'](_0x5e6c('0x10'),auth['isAuthenticated'](),timeout(_0x5e6c('0x11')),controller[_0x5e6c('0x12')]);router[_0x5e6c('0x13')]('/',auth[_0x5e6c('0xb')](),controller[_0x5e6c('0x14')]);router[_0x5e6c('0x13')]('/:id/clone',auth[_0x5e6c('0xb')](),controller[_0x5e6c('0x15')]);router['put'](_0x5e6c('0xa'),auth[_0x5e6c('0xb')](),controller[_0x5e6c('0x16')]);router[_0x5e6c('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x5e6c('0x18')]);module[_0x5e6c('0x19')]=router; \ No newline at end of file +var _0x9df5=['getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers'];(function(_0x4d2cb0,_0x400ec3){var _0x9d464f=function(_0x1bf7ca){while(--_0x1bf7ca){_0x4d2cb0['push'](_0x4d2cb0['shift']());}};_0x9d464f(++_0x400ec3);}(_0x9df5,0x9b));var _0x59df=function(_0x442c68,_0x16805b){_0x442c68=_0x442c68-0x0;var _0x371d3a=_0x9df5[_0x442c68];return _0x371d3a;};'use strict';var multer=require(_0x59df('0x0'));var util=require(_0x59df('0x1'));var path=require(_0x59df('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59df('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x59df('0x4'));var config=require('../../config/environment');var controller=require(_0x59df('0x5'));router[_0x59df('0x6')]('/',auth[_0x59df('0x7')](),controller[_0x59df('0x8')]);router['get'](_0x59df('0x9'),auth[_0x59df('0x7')](),controller['show']);router[_0x59df('0x6')](_0x59df('0xa'),auth[_0x59df('0x7')](),controller[_0x59df('0xb')]);router[_0x59df('0x6')](_0x59df('0xc'),auth[_0x59df('0x7')](),controller[_0x59df('0xd')]);router[_0x59df('0x6')](_0x59df('0xe'),auth['isAuthenticated'](),timeout(_0x59df('0xf')),controller[_0x59df('0x10')]);router[_0x59df('0x11')]('/',auth[_0x59df('0x7')](),controller[_0x59df('0x12')]);router['post']('/:id/clone',auth[_0x59df('0x7')](),controller[_0x59df('0x13')]);router[_0x59df('0x14')](_0x59df('0x9'),auth[_0x59df('0x7')](),controller['update']);router[_0x59df('0x15')](_0x59df('0x9'),auth[_0x59df('0x7')](),controller[_0x59df('0x16')]);module[_0x59df('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 90fadab..9e7b2e3 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 _0xf8cc=['util','exports','STRING','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xf8cc,0x8e));var _0xcf8c=function(_0x2d40df,_0x55a997){_0x2d40df=_0x2d40df-0x0;var _0x1474a3=_0xf8cc[_0x2d40df];return _0x1474a3;};'use strict';var Sequelize=require(_0xcf8c('0x0'));var _=require(_0xcf8c('0x1'));var util=require(_0xcf8c('0x2'));module[_0xcf8c('0x3')]={'name':{'type':Sequelize[_0xcf8c('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xcf8c('0x5')](_0xcf8c('0x6')),'set':function(_0x2176a0){if(_[_0xcf8c('0x7')](_0x2176a0)){this[_0xcf8c('0x8')]('formData',JSON[_0xcf8c('0x9')](_0x2176a0));}else if(_[_0xcf8c('0xa')](_0x2176a0)){this['setDataValue']('formData',_0x2176a0);}else{this[_0xcf8c('0x8')](_0xcf8c('0xb'),util[_0xcf8c('0xc')](_0xcf8c('0xd'),this[_0xcf8c('0xe')](_0xcf8c('0xf'))||'',this[_0xcf8c('0xe')](_0xcf8c('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xcf8c('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcf8c('0x11')],'defaultValue':![]}}; \ No newline at end of file +var _0x92bb=['description','BOOLEAN','sequelize','lodash','exports','name','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x178cfd,_0x4da27a){var _0x5d110d=function(_0x342a7b){while(--_0x342a7b){_0x178cfd['push'](_0x178cfd['shift']());}};_0x5d110d(++_0x4da27a);}(_0x92bb,0xb2));var _0xb92b=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0x92bb[_0x219fa0];return _0xc603fb;};'use strict';var Sequelize=require(_0xb92b('0x0'));var _=require(_0xb92b('0x1'));var util=require('util');module[_0xb92b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xb92b('0x3')},'description':{'type':Sequelize[_0xb92b('0x4')]},'formData':{'type':Sequelize[_0xb92b('0x5')](_0xb92b('0x6')),'set':function(_0x13e5ea){if(_[_0xb92b('0x7')](_0x13e5ea)){this[_0xb92b('0x8')](_0xb92b('0x9'),JSON[_0xb92b('0xa')](_0x13e5ea));}else if(_['isString'](_0x13e5ea)){this[_0xb92b('0x8')](_0xb92b('0x9'),_0x13e5ea);}else{this[_0xb92b('0x8')]('formData',util[_0xb92b('0xb')](_0xb92b('0xc'),this[_0xb92b('0xd')](_0xb92b('0x3'))||'',this[_0xb92b('0xd')](_0xb92b('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb92b('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb92b('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0c3a683..41b676d 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 _0x25d4=['where','pick','map','type','key','field','filter','options','includeAll','JscriptyProject','findAll','rows','catch','show','params','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','apply','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','rawAttributes','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0x56d896,_0x3b4c9c){var _0x293639=function(_0x126c14){while(--_0x126c14){_0x56d896['push'](_0x56d896['shift']());}};_0x293639(++_0x3b4c9c);}(_0x25d4,0xb1));var _0x425d=function(_0x342abb,_0x3315bc){_0x342abb=_0x342abb-0x0;var _0x4028f1=_0x25d4[_0x342abb];return _0x4028f1;};'use strict';var pdf=require(_0x425d('0x0'));var emlformat=require(_0x425d('0x1'));var rimraf=require(_0x425d('0x2'));var zipdir=require(_0x425d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x425d('0x4'));var moment=require(_0x425d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x425d('0x6'));var util=require('util');var path=require(_0x425d('0x7'));var sox=require(_0x425d('0x8'));var csv=require(_0x425d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x425d('0xa'));var squel=require('squel');var crypto=require(_0x425d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x425d('0x9'));var querystring=require(_0x425d('0xc'));var Papa=require(_0x425d('0xd'));var Redis=require(_0x425d('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x425d('0xf'));var logger=require('../../config/logger')(_0x425d('0x10'));var utils=require('../../config/utils');var config=require(_0x425d('0x11'));var db=require(_0x425d('0x12'))['db'];function respondWithStatusCode(_0x194056,_0x299d14){_0x299d14=_0x299d14||0xcc;return function(_0x295a13){if(_0x295a13){return _0x194056[_0x425d('0x13')](_0x299d14);}return _0x194056[_0x425d('0x14')](_0x299d14)[_0x425d('0x15')]();};}function respondWithResult(_0x4b697c,_0x2729b8){_0x2729b8=_0x2729b8||0xc8;return function(_0x22a390){if(_0x22a390){return _0x4b697c[_0x425d('0x14')](_0x2729b8)[_0x425d('0x16')](_0x22a390);}};}function respondWithFilteredResult(_0x2573c3,_0x36b7eb){return function(_0x2fe443){if(_0x2fe443){var _0x10ea9c=_0x2fe443[_0x425d('0x17')],_0x359454=_0x36b7eb[_0x425d('0x18')],_0xb03bf=_0x36b7eb[_0x425d('0x18')]+_0x36b7eb[_0x425d('0x19')],_0x523a81;if(_0xb03bf>=_0x10ea9c){_0xb03bf=_0x10ea9c;_0x523a81=0xc8;}else{_0x523a81=0xce;}_0x2573c3[_0x425d('0x14')](_0x523a81);return _0x2573c3[_0x425d('0x1a')](_0x425d('0x1b'),_0x359454+'-'+_0xb03bf+'/'+_0x10ea9c)[_0x425d('0x16')](_0x2fe443);}return null;};}function patchUpdates(_0x1be86c){return function(_0x597c14){try{jsonpatch['apply'](_0x597c14,_0x1be86c,!![]);}catch(_0x98f68e){return BPromise[_0x425d('0x1c')](_0x98f68e);}return _0x597c14[_0x425d('0x1d')]();};}function saveUpdates(_0x4368ab,_0x402dec){return function(_0xd8765b){if(_0xd8765b){return _0xd8765b[_0x425d('0x1e')](_0x4368ab)[_0x425d('0x1f')](function(_0x2e0257){return _0x2e0257;});}return null;};}function removeEntity(_0x4fe28b,_0x2a2e22){return function(_0x3bd80c){if(_0x3bd80c){return _0x3bd80c[_0x425d('0x20')]()[_0x425d('0x1f')](function(){var _0x3cbb8e=_0x3bd80c[_0x425d('0x21')]({'plain':!![]});var _0xb63164=_0x425d('0x22');return db[_0x425d('0x23')][_0x425d('0x20')]({'where':{'type':_0xb63164,'resourceId':_0x3cbb8e['id']}})[_0x425d('0x1f')](function(){return _0x3bd80c;});})[_0x425d('0x1f')](function(){_0x4fe28b[_0x425d('0x14')](0xcc)[_0x425d('0x15')]();});}};}function handleEntityNotFound(_0x4aae3d,_0x2c409a){return function(_0xbe01d7){if(!_0xbe01d7){_0x4aae3d[_0x425d('0x13')](0x194);}return _0xbe01d7;};}function handleError(_0x265117,_0xad1ed7){_0xad1ed7=_0xad1ed7||0x1f4;return function(_0x434a62){logger[_0x425d('0x24')](_0x434a62[_0x425d('0x25')]);if(_0x434a62['name']){delete _0x434a62[_0x425d('0x26')];}_0x265117[_0x425d('0x14')](_0xad1ed7)['send'](_0x434a62);};}exports[_0x425d('0x27')]=function(_0x2f89b7,_0xd0cff2){var _0x2050ef={},_0x3e9c1f={},_0x24e671={'count':0x0,'rows':[]};var _0x746d1a=db['JscriptyProject'][_0x425d('0x28')];_0x3e9c1f[_0x425d('0x29')]=_[_0x425d('0x2a')](_0x746d1a);_0x3e9c1f[_0x425d('0x2b')]=_['keys'](_0x2f89b7[_0x425d('0x2b')]);_0x3e9c1f[_0x425d('0x2c')]=_['intersection'](_0x3e9c1f[_0x425d('0x29')],_0x3e9c1f['query']);_0x2050ef['attributes']=_[_0x425d('0x2d')](_0x3e9c1f[_0x425d('0x29')],qs['fields'](_0x2f89b7[_0x425d('0x2b')][_0x425d('0x2e')]));_0x2050ef['attributes']=_0x2050ef['attributes'][_0x425d('0x2f')]?_0x2050ef[_0x425d('0x30')]:_0x3e9c1f[_0x425d('0x29')];if(!_0x2f89b7[_0x425d('0x2b')][_0x425d('0x31')](_0x425d('0x32'))){_0x2050ef['limit']=qs['limit'](_0x2f89b7[_0x425d('0x2b')][_0x425d('0x19')]);_0x2050ef[_0x425d('0x18')]=qs[_0x425d('0x18')](_0x2f89b7[_0x425d('0x2b')][_0x425d('0x18')]);}_0x2050ef[_0x425d('0x33')]=qs[_0x425d('0x34')](_0x2f89b7[_0x425d('0x2b')][_0x425d('0x34')]);_0x2050ef[_0x425d('0x35')]=qs[_0x425d('0x2c')](_[_0x425d('0x36')](_0x2f89b7[_0x425d('0x2b')],_0x3e9c1f['filters']));if(_0x2f89b7[_0x425d('0x2b')]['filter']){_0x2050ef[_0x425d('0x35')]=_['merge'](_0x2050ef[_0x425d('0x35')],{'$or':_[_0x425d('0x37')](_0x746d1a,function(_0x545e6d){if(_0x545e6d[_0x425d('0x38')][_0x425d('0x39')]!=='VIRTUAL'){var _0x41e687={};_0x41e687[_0x545e6d[_0x425d('0x3a')]]={'$like':'%'+_0x2f89b7[_0x425d('0x2b')][_0x425d('0x3b')]+'%'};return _0x41e687;}})});}_0x2050ef=_['merge']({},_0x2050ef,_0x2f89b7[_0x425d('0x3c')]);var _0x76bd25={'where':_0x2050ef[_0x425d('0x35')]};return db['JscriptyProject'][_0x425d('0x17')](_0x76bd25)[_0x425d('0x1f')](function(_0x8a09cc){_0x24e671['count']=_0x8a09cc;if(_0x2f89b7['query'][_0x425d('0x3d')]){_0x2050ef['include']=[{'all':!![]}];}return db[_0x425d('0x3e')][_0x425d('0x3f')](_0x2050ef);})[_0x425d('0x1f')](function(_0x2c7afc){_0x24e671[_0x425d('0x40')]=_0x2c7afc;return _0x24e671;})['then'](respondWithFilteredResult(_0xd0cff2,_0x2050ef))[_0x425d('0x41')](handleError(_0xd0cff2,null));};exports[_0x425d('0x42')]=function(_0x17da2d,_0x4c0c0a){var _0x291b07={'raw':![],'where':{'id':_0x17da2d[_0x425d('0x43')]['id']}},_0x227c0f={};_0x227c0f['model']=_[_0x425d('0x2a')](db[_0x425d('0x3e')][_0x425d('0x28')]);_0x227c0f[_0x425d('0x2b')]=_[_0x425d('0x2a')](_0x17da2d['query']);_0x227c0f['filters']=_['intersection'](_0x227c0f['model'],_0x227c0f[_0x425d('0x2b')]);_0x291b07[_0x425d('0x30')]=_[_0x425d('0x2d')](_0x227c0f['model'],qs['fields'](_0x17da2d[_0x425d('0x2b')][_0x425d('0x2e')]));_0x291b07[_0x425d('0x30')]=_0x291b07[_0x425d('0x30')][_0x425d('0x2f')]?_0x291b07['attributes']:_0x227c0f[_0x425d('0x29')];if(_0x17da2d[_0x425d('0x2b')][_0x425d('0x3d')]){_0x291b07[_0x425d('0x44')]=[{'all':!![]}];}_0x291b07=_[_0x425d('0x45')]({},_0x291b07,_0x17da2d[_0x425d('0x3c')]);return db[_0x425d('0x3e')][_0x425d('0x46')](_0x291b07)[_0x425d('0x1f')](handleEntityNotFound(_0x4c0c0a,null))['then'](respondWithResult(_0x4c0c0a,null))[_0x425d('0x41')](handleError(_0x4c0c0a,null));};exports[_0x425d('0x47')]=function(_0x132cac,_0xfb0371){return db['JscriptyProject'][_0x425d('0x47')](_0x132cac[_0x425d('0x48')],{})[_0x425d('0x1f')](function(_0xed5bfb){var _0x35b2b1=_0x132cac['user'][_0x425d('0x21')]({'plain':!![]});if(!_0x35b2b1)throw new Error(_0x425d('0x49'));if(_0x35b2b1[_0x425d('0x4a')]==='user'){var _0x2dc5d0=_0xed5bfb[_0x425d('0x21')]({'plain':!![]});var _0x101fef=_0x425d('0x22');return db[_0x425d('0x4b')][_0x425d('0x46')]({'where':{'name':_0x101fef,'userProfileId':_0x35b2b1[_0x425d('0x4c')]},'raw':!![]})[_0x425d('0x1f')](function(_0x9686b8){if(_0x9686b8&&_0x9686b8[_0x425d('0x4d')]===0x0){return db[_0x425d('0x23')][_0x425d('0x47')]({'name':_0x2dc5d0[_0x425d('0x26')],'resourceId':_0x2dc5d0['id'],'type':_0x9686b8[_0x425d('0x26')],'sectionId':_0x9686b8['id']},{})[_0x425d('0x1f')](function(){return _0xed5bfb;});}else{return _0xed5bfb;}})[_0x425d('0x41')](function(_0x4a1480){logger['error'](_0x425d('0x4e'),_0x4a1480);throw _0x4a1480;});}return _0xed5bfb;})[_0x425d('0x1f')](respondWithResult(_0xfb0371,0xc9))['catch'](handleError(_0xfb0371,null));};exports[_0x425d('0x4f')]=function(_0x3c6210,_0x3fb407){var _0x44d339={'raw':![],'where':{'id':_0x3c6210[_0x425d('0x43')]['id']}},_0xf554cd={};_0xf554cd[_0x425d('0x29')]=_[_0x425d('0x2a')](db[_0x425d('0x3e')]['rawAttributes']);_0x44d339['attributes']=_[_0x425d('0x2d')](_0xf554cd[_0x425d('0x29')],qs[_0x425d('0x2e')](_0x3c6210[_0x425d('0x2b')][_0x425d('0x2e')]));_0x44d339[_0x425d('0x30')]=_0x44d339[_0x425d('0x30')][_0x425d('0x2f')]?_0x44d339[_0x425d('0x30')]:_0xf554cd[_0x425d('0x29')];if(_0x3c6210[_0x425d('0x2b')][_0x425d('0x3d')]){_0x44d339['include']=[{'all':!![]}];}_0x44d339=_['merge']({},_0x44d339,_0x3c6210['options']);return db[_0x425d('0x3e')][_0x425d('0x46')](_0x44d339)[_0x425d('0x1f')](handleEntityNotFound(_0x3fb407,null))[_0x425d('0x1f')](function(_0x4d8a94){if(_0x4d8a94){var _0x56aab2=_0x4d8a94[_0x425d('0x21')]({'plain':!![]});_0x56aab2=qs[_0x425d('0x50')](_0x56aab2,['id',_0x425d('0x51'),_0x425d('0x52')]);_0x3c6210[_0x425d('0x48')]=_[_0x425d('0x50')](_0x3c6210[_0x425d('0x48')],['id',_0x425d('0x51'),_0x425d('0x52')]);return db[_0x425d('0x3e')][_0x425d('0x47')](_[_0x425d('0x45')](_0x56aab2,_0x3c6210[_0x425d('0x48')]),{'include':_0x3c6210[_0x425d('0x2b')][_0x425d('0x3d')]?[{'all':!![]}]:undefined})['then'](function(_0x5d0a3f){var _0x577a72=_0x3c6210[_0x425d('0x53')][_0x425d('0x21')]({'plain':!![]});if(!_0x577a72)throw new Error(_0x425d('0x49'));if(_0x577a72[_0x425d('0x4a')]==='user'){var _0x360529=_0x5d0a3f['get']({'plain':!![]});var _0x10cad8='Projects';return db[_0x425d('0x4b')][_0x425d('0x46')]({'where':{'name':_0x10cad8,'userProfileId':_0x577a72['userProfileId']},'raw':!![]})[_0x425d('0x1f')](function(_0x2812ce){if(_0x2812ce&&_0x2812ce['autoAssociation']===0x0){return db[_0x425d('0x23')]['create']({'name':_0x360529['name'],'resourceId':_0x360529['id'],'type':_0x2812ce[_0x425d('0x26')],'sectionId':_0x2812ce['id']},{})[_0x425d('0x1f')](function(){return _0x5d0a3f;});}else{return _0x5d0a3f;}})['catch'](function(_0x5e95c5){logger[_0x425d('0x24')](_0x425d('0x4e'),_0x5e95c5);throw _0x5e95c5;});}return _0x5d0a3f;});}})[_0x425d('0x1f')](respondWithResult(_0x3fb407,0xc9))[_0x425d('0x41')](handleError(_0x3fb407,null));};exports[_0x425d('0x1e')]=function(_0x5d9bd,_0x4a78f9){if(_0x5d9bd[_0x425d('0x48')]['id']){delete _0x5d9bd[_0x425d('0x48')]['id'];}return db[_0x425d('0x3e')][_0x425d('0x46')]({'where':{'id':_0x5d9bd['params']['id']}})[_0x425d('0x1f')](handleEntityNotFound(_0x4a78f9,null))[_0x425d('0x1f')](saveUpdates(_0x5d9bd['body'],null))[_0x425d('0x1f')](respondWithResult(_0x4a78f9,null))[_0x425d('0x41')](handleError(_0x4a78f9,null));};exports[_0x425d('0x20')]=function(_0x311a70,_0x249c8a){return db[_0x425d('0x3e')]['find']({'where':{'id':_0x311a70[_0x425d('0x43')]['id']}})[_0x425d('0x1f')](handleEntityNotFound(_0x249c8a,null))[_0x425d('0x1f')](removeEntity(_0x249c8a,null))[_0x425d('0x41')](handleError(_0x249c8a,null));};exports[_0x425d('0x54')]=function(_0x7ede2a,_0x51e5f8,_0x5f0ff3){var _0x2d828b={'raw':!![],'where':{}};var _0x59204d={};var _0x9340ec={'count':0x0,'rows':[]};return db[_0x425d('0x3e')][_0x425d('0x55')]({'where':{'id':_0x7ede2a[_0x425d('0x43')]['id']}})[_0x425d('0x1f')](handleEntityNotFound(_0x51e5f8,null))[_0x425d('0x1f')](function(_0x3f7924){if(_0x3f7924){_0x59204d[_0x425d('0x29')]=_[_0x425d('0x2a')](db[_0x425d('0x56')][_0x425d('0x28')]);_0x59204d[_0x425d('0x2b')]=_['keys'](_0x7ede2a[_0x425d('0x2b')]);_0x59204d[_0x425d('0x2c')]=_['intersection'](_0x59204d[_0x425d('0x29')],_0x59204d['query']);_0x2d828b[_0x425d('0x30')]=_['intersection'](_0x59204d[_0x425d('0x29')],qs[_0x425d('0x2e')](_0x7ede2a['query']['fields']));_0x2d828b[_0x425d('0x30')]=_0x2d828b['attributes'][_0x425d('0x2f')]?_0x2d828b['attributes']:_0x59204d['model'];if(!_0x7ede2a[_0x425d('0x2b')]['hasOwnProperty'](_0x425d('0x32'))){_0x2d828b[_0x425d('0x19')]=qs['limit'](_0x7ede2a[_0x425d('0x2b')][_0x425d('0x19')]);_0x2d828b[_0x425d('0x18')]=qs[_0x425d('0x18')](_0x7ede2a[_0x425d('0x2b')]['offset']);}_0x2d828b['order']=qs[_0x425d('0x34')](_0x7ede2a['query'][_0x425d('0x34')]);_0x2d828b[_0x425d('0x35')]=qs[_0x425d('0x2c')](_['pick'](_0x7ede2a[_0x425d('0x2b')],_0x59204d[_0x425d('0x2c')]));_0x2d828b[_0x425d('0x35')]['ProjectId']=_0x3f7924['id'];if(_0x7ede2a[_0x425d('0x2b')][_0x425d('0x3b')]){_0x2d828b[_0x425d('0x35')]=_['merge'](_0x2d828b[_0x425d('0x35')],{'$or':_[_0x425d('0x37')](_0x2d828b[_0x425d('0x30')],function(_0x47e366){var _0x4d39f9={};_0x4d39f9[_0x47e366]={'$like':'%'+_0x7ede2a[_0x425d('0x2b')][_0x425d('0x3b')]+'%'};return _0x4d39f9;})});}_0x2d828b=_[_0x425d('0x45')]({},_0x2d828b,_0x7ede2a[_0x425d('0x3c')]);return db[_0x425d('0x56')]['count']({'where':_0x2d828b[_0x425d('0x35')]})[_0x425d('0x1f')](function(_0x35af8e){_0x9340ec[_0x425d('0x17')]=_0x35af8e;if(_0x7ede2a['query'][_0x425d('0x3d')]){_0x2d828b[_0x425d('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x2d828b);})[_0x425d('0x1f')](function(_0x1c3be4){_0x9340ec[_0x425d('0x40')]=_0x1c3be4;return _0x9340ec;});}})[_0x425d('0x1f')](respondWithFilteredResult(_0x51e5f8,_0x2d828b))[_0x425d('0x41')](handleError(_0x51e5f8,null));};exports[_0x425d('0x57')]=function(_0x2bff87,_0x5e3879,_0x26c9c9){var _0x69d868={'raw':!![],'where':{}};var _0x29a3b2={};var _0x2e6b09={'count':0x0,'rows':[]};return db[_0x425d('0x3e')][_0x425d('0x55')]({'where':{'id':_0x2bff87[_0x425d('0x43')]['id']}})[_0x425d('0x1f')](handleEntityNotFound(_0x5e3879,null))['then'](function(_0x338367){if(_0x338367){_0x29a3b2['model']=_[_0x425d('0x2a')](db[_0x425d('0x58')]['rawAttributes']);_0x29a3b2[_0x425d('0x2b')]=_[_0x425d('0x2a')](_0x2bff87[_0x425d('0x2b')]);_0x29a3b2['filters']=_[_0x425d('0x2d')](_0x29a3b2['model'],_0x29a3b2[_0x425d('0x2b')]);_0x69d868[_0x425d('0x30')]=_[_0x425d('0x2d')](_0x29a3b2[_0x425d('0x29')],qs[_0x425d('0x2e')](_0x2bff87[_0x425d('0x2b')][_0x425d('0x2e')]));_0x69d868[_0x425d('0x30')]=_0x69d868[_0x425d('0x30')][_0x425d('0x2f')]?_0x69d868['attributes']:_0x29a3b2[_0x425d('0x29')];if(!_0x2bff87[_0x425d('0x2b')][_0x425d('0x31')](_0x425d('0x32'))){_0x69d868[_0x425d('0x19')]=qs[_0x425d('0x19')](_0x2bff87[_0x425d('0x2b')][_0x425d('0x19')]);_0x69d868[_0x425d('0x18')]=qs['offset'](_0x2bff87['query'][_0x425d('0x18')]);}_0x69d868['order']=qs[_0x425d('0x34')](_0x2bff87['query'][_0x425d('0x34')]);_0x69d868[_0x425d('0x35')]=qs[_0x425d('0x2c')](_[_0x425d('0x36')](_0x2bff87[_0x425d('0x2b')],_0x29a3b2[_0x425d('0x2c')]));_0x69d868[_0x425d('0x35')][_0x425d('0x59')]=_0x338367['id'];if(_0x2bff87[_0x425d('0x2b')]['filter']){_0x69d868[_0x425d('0x35')]=_[_0x425d('0x45')](_0x69d868[_0x425d('0x35')],{'$or':_['map'](_0x69d868[_0x425d('0x30')],function(_0x4692c5){var _0x546fc7={};_0x546fc7[_0x4692c5]={'$like':'%'+_0x2bff87[_0x425d('0x2b')][_0x425d('0x3b')]+'%'};return _0x546fc7;})});}_0x69d868=_[_0x425d('0x45')]({},_0x69d868,_0x2bff87['options']);return db['JscriptyAnswerReport'][_0x425d('0x17')]({'where':_0x69d868[_0x425d('0x35')]})[_0x425d('0x1f')](function(_0x29a9ed){_0x2e6b09['count']=_0x29a9ed;if(_0x2bff87[_0x425d('0x2b')][_0x425d('0x3d')]){_0x69d868[_0x425d('0x44')]=[{'all':!![]}];}return db[_0x425d('0x58')]['findAll'](_0x69d868);})['then'](function(_0x1f9c14){_0x2e6b09[_0x425d('0x40')]=_0x1f9c14;return _0x2e6b09;});}})['then'](respondWithFilteredResult(_0x5e3879,_0x69d868))['catch'](handleError(_0x5e3879,null));};function char(_0xb201ba){return'number'===typeof _0xb201ba?String['fromCharCode'][_0x425d('0x5a')](null,arguments):_0xb201ba;}function needsEncapsulation(_0x65ae45){return!!_0x65ae45&&(_0x65ae45['toString']()[_0x425d('0x5b')](char(0xd))>=0x0||_0x65ae45[_0x425d('0x5c')]()[_0x425d('0x5b')](char(0xa))>=0x0||_0x65ae45['toString']()[_0x425d('0x5b')](char(0x2c))>=0x0||_0x65ae45[_0x425d('0x5c')]()[_0x425d('0x5b')](char(0x22))>=0x0);}function encapsulate(_0xdd49c8){var _0x2fb8b5=char(0x22),_0x103e5e='\x5c'+char(0x22),_0x486268=_0xdd49c8[_0x425d('0x5c')]()[_0x425d('0x5d')](new RegExp(_0x2fb8b5,'g'),_0x103e5e);return _0x2fb8b5+_0x486268+_0x2fb8b5;}exports[_0x425d('0x5e')]=function(_0x4eaf66,_0x495ad9,_0x301d13){var _0x295c3a,_0xdfcff4;var _0x395b3e={'where':{'ProjectId':_0x4eaf66[_0x425d('0x43')]['id']}};if(_0x4eaf66[_0x425d('0x2b')][_0x425d('0x5f')]){_0x395b3e[_0x425d('0x35')][_0x425d('0x60')]=JSON[_0x425d('0x61')](_0x4eaf66['query']['startTime']);}return db['JscriptySessionReport'][_0x425d('0x3f')](_0x395b3e)[_0x425d('0x1f')](handleEntityNotFound(_0x495ad9,null))['then'](function(_0xb6c69){if(_0xb6c69){_0x295c3a=_0xb6c69;return db[_0x425d('0x62')][_0x425d('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0x295c3a,'id')},'ProjectId':_0x4eaf66['params']['id']},'order':_0x425d('0x63')});}})['then'](handleEntityNotFound(_0x495ad9,null))['then'](function(_0x4b66a6){if(_0x4b66a6){_0xdfcff4=_0x4b66a6;var _0x1c152b={};for(var _0x13f0bd=0x0,_0x23a001=_0xdfcff4[_0x425d('0x2f')];_0x13f0bd<_0x23a001;_0x13f0bd++){if(!_0x1c152b[_0x425d('0x31')](_0xdfcff4[_0x13f0bd][_0x425d('0x64')])){_0x1c152b[_0xdfcff4[_0x13f0bd][_0x425d('0x64')]]=needsEncapsulation(_0xdfcff4[_0x13f0bd][_0x425d('0x65')])?encapsulate(_0xdfcff4[_0x13f0bd]['question']):_0xdfcff4[_0x13f0bd][_0x425d('0x65')];}}var _0x1b90a8=[],_0x2c40b7={};for(var _0x4bf657=0x0,_0x3859ab=_0x295c3a[_0x425d('0x2f')];_0x4bf657<_0x3859ab;_0x4bf657++){_0x2c40b7={'ProjectId':_0x4eaf66[_0x425d('0x43')]['id'],'SessionId':_0x295c3a[_0x4bf657]['id'],'StartTime':moment(_0x295c3a[_0x4bf657][_0x425d('0x60')])[_0x425d('0x66')](_0x425d('0x67'))};for(var _0xecd958=0x0,_0x378d0c=_0xdfcff4[_0x425d('0x2f')];_0xecd958<_0x378d0c;_0xecd958++){if(_0xdfcff4[_0xecd958][_0x425d('0x68')]==_0x295c3a[_0x4bf657]['id']&&_0x1c152b['hasOwnProperty'](_0xdfcff4[_0xecd958][_0x425d('0x64')])){_0x2c40b7[_0x1c152b[_0xdfcff4[_0xecd958][_0x425d('0x64')]]]=_0xdfcff4[_0xecd958][_0x425d('0x69')];}}for(var _0x455f60 in _0x1c152b){if(!_0x2c40b7[_0x425d('0x31')](_0x1c152b[_0x455f60])){_0x2c40b7[_0x1c152b[_0x455f60]]=null;}}_0x1b90a8[_0x425d('0x6a')](_0x2c40b7);}return _0x1b90a8;}})[_0x425d('0x1f')](function(_0x3d5953){if(!_[_0x425d('0x6b')](_0x3d5953)){var _0x4e2af2=toCsv(_0x3d5953);var _0x119495=Date[_0x425d('0x6c')]();fs['writeFileSync'](util[_0x425d('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4eaf66[_0x425d('0x43')]['id'],_0x119495),_0x4e2af2);_0x495ad9[_0x425d('0x6d')](_0x425d('0x6e'),'attachment;\x20filename='+util[_0x425d('0x66')](_0x425d('0x6f'),_0x4eaf66[_0x425d('0x43')]['id'],_0x119495));_0x495ad9[_0x425d('0x6d')](_0x425d('0x70'),_0x425d('0x71'));return _0x495ad9[_0x425d('0x72')](util[_0x425d('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4eaf66[_0x425d('0x43')]['id'],_0x119495));}else{return _0x495ad9[_0x425d('0x13')](0xcc);}})['catch'](handleError(_0x495ad9,null));}; \ No newline at end of file +var _0x6901=['toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','JscriptyProject','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','key','VIRTUAL','field','filter','count','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','ProjectId','map','rows','getAnswers','JscriptyAnswerReport','number','indexOf'];(function(_0x5ea8a5,_0x2c0375){var _0xf069eb=function(_0x40deb2){while(--_0x40deb2){_0x5ea8a5['push'](_0x5ea8a5['shift']());}};_0xf069eb(++_0x2c0375);}(_0x6901,0x100));var _0x1690=function(_0x97b34,_0x57a917){_0x97b34=_0x97b34-0x0;var _0x438757=_0x6901[_0x97b34];return _0x438757;};'use strict';var pdf=require(_0x1690('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1690('0x1'));var zipdir=require(_0x1690('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1690('0x3'));var BPromise=require(_0x1690('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1690('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1690('0x6'));var fs=require('fs');var _=require(_0x1690('0x7'));var squel=require(_0x1690('0x8'));var crypto=require(_0x1690('0x9'));var jsforce=require(_0x1690('0xa'));var deskjs=require(_0x1690('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1690('0xc'));var Papa=require(_0x1690('0xd'));var Redis=require(_0x1690('0xe'));var authService=require(_0x1690('0xf'));var qs=require(_0x1690('0x10'));var hardwareService=require(_0x1690('0x11'));var logger=require('../../config/logger')(_0x1690('0x12'));var utils=require(_0x1690('0x13'));var config=require('../../config/environment');var db=require(_0x1690('0x14'))['db'];function respondWithStatusCode(_0x318502,_0x34f797){_0x34f797=_0x34f797||0xcc;return function(_0x37114f){if(_0x37114f){return _0x318502[_0x1690('0x15')](_0x34f797);}return _0x318502[_0x1690('0x16')](_0x34f797)[_0x1690('0x17')]();};}function respondWithResult(_0x4686c1,_0x2811fc){_0x2811fc=_0x2811fc||0xc8;return function(_0x26b807){if(_0x26b807){return _0x4686c1['status'](_0x2811fc)[_0x1690('0x18')](_0x26b807);}};}function respondWithFilteredResult(_0x2d4e75,_0x11e9bf){return function(_0x5e0d7f){if(_0x5e0d7f){var _0x5ebc4c=_0x5e0d7f['count'],_0x2d5617=_0x11e9bf['offset'],_0x575010=_0x11e9bf[_0x1690('0x19')]+_0x11e9bf['limit'],_0x1e2061;if(_0x575010>=_0x5ebc4c){_0x575010=_0x5ebc4c;_0x1e2061=0xc8;}else{_0x1e2061=0xce;}_0x2d4e75[_0x1690('0x16')](_0x1e2061);return _0x2d4e75[_0x1690('0x1a')]('Content-Range',_0x2d5617+'-'+_0x575010+'/'+_0x5ebc4c)[_0x1690('0x18')](_0x5e0d7f);}return null;};}function patchUpdates(_0x2817a8){return function(_0x284f77){try{jsonpatch[_0x1690('0x1b')](_0x284f77,_0x2817a8,!![]);}catch(_0x4d06e7){return BPromise[_0x1690('0x1c')](_0x4d06e7);}return _0x284f77['save']();};}function saveUpdates(_0x3b5eb0,_0x2be44b){return function(_0x391581){if(_0x391581){return _0x391581[_0x1690('0x1d')](_0x3b5eb0)[_0x1690('0x1e')](function(_0x8f5ceb){return _0x8f5ceb;});}return null;};}function removeEntity(_0x3a6189,_0x3d1617){return function(_0x1a050b){if(_0x1a050b){return _0x1a050b[_0x1690('0x1f')]()[_0x1690('0x1e')](function(){var _0x44986d=_0x1a050b[_0x1690('0x20')]({'plain':!![]});var _0x3e24e5=_0x1690('0x21');return db[_0x1690('0x22')][_0x1690('0x1f')]({'where':{'type':_0x3e24e5,'resourceId':_0x44986d['id']}})[_0x1690('0x1e')](function(){return _0x1a050b;});})['then'](function(){_0x3a6189[_0x1690('0x16')](0xcc)[_0x1690('0x17')]();});}};}function handleEntityNotFound(_0x5c1cf8,_0x34a818){return function(_0x1c1b7b){if(!_0x1c1b7b){_0x5c1cf8[_0x1690('0x15')](0x194);}return _0x1c1b7b;};}function handleError(_0x136567,_0x5afcbb){_0x5afcbb=_0x5afcbb||0x1f4;return function(_0x30755f){logger[_0x1690('0x23')](_0x30755f[_0x1690('0x24')]);if(_0x30755f[_0x1690('0x25')]){delete _0x30755f[_0x1690('0x25')];}_0x136567[_0x1690('0x16')](_0x5afcbb)['send'](_0x30755f);};}exports['index']=function(_0x12961e,_0x536c54){var _0x486ec9={},_0x49bd71={},_0x197f60={'count':0x0,'rows':[]};var _0x40ee73=db[_0x1690('0x26')][_0x1690('0x27')];_0x49bd71[_0x1690('0x28')]=_[_0x1690('0x29')](_0x40ee73);_0x49bd71[_0x1690('0x2a')]=_['keys'](_0x12961e[_0x1690('0x2a')]);_0x49bd71[_0x1690('0x2b')]=_[_0x1690('0x2c')](_0x49bd71[_0x1690('0x28')],_0x49bd71[_0x1690('0x2a')]);_0x486ec9[_0x1690('0x2d')]=_[_0x1690('0x2c')](_0x49bd71['model'],qs[_0x1690('0x2e')](_0x12961e[_0x1690('0x2a')]['fields']));_0x486ec9[_0x1690('0x2d')]=_0x486ec9[_0x1690('0x2d')][_0x1690('0x2f')]?_0x486ec9[_0x1690('0x2d')]:_0x49bd71[_0x1690('0x28')];if(!_0x12961e[_0x1690('0x2a')][_0x1690('0x30')](_0x1690('0x31'))){_0x486ec9['limit']=qs[_0x1690('0x32')](_0x12961e[_0x1690('0x2a')][_0x1690('0x32')]);_0x486ec9[_0x1690('0x19')]=qs['offset'](_0x12961e['query'][_0x1690('0x19')]);}_0x486ec9[_0x1690('0x33')]=qs[_0x1690('0x34')](_0x12961e[_0x1690('0x2a')][_0x1690('0x34')]);_0x486ec9[_0x1690('0x35')]=qs['filters'](_[_0x1690('0x36')](_0x12961e[_0x1690('0x2a')],_0x49bd71['filters']));if(_0x12961e[_0x1690('0x2a')]['filter']){_0x486ec9['where']=_[_0x1690('0x37')](_0x486ec9[_0x1690('0x35')],{'$or':_['map'](_0x40ee73,function(_0x48747f){if(_0x48747f[_0x1690('0x38')][_0x1690('0x39')]!==_0x1690('0x3a')){var _0x14dc82={};_0x14dc82[_0x48747f[_0x1690('0x3b')]]={'$like':'%'+_0x12961e[_0x1690('0x2a')][_0x1690('0x3c')]+'%'};return _0x14dc82;}})});}_0x486ec9=_[_0x1690('0x37')]({},_0x486ec9,_0x12961e['options']);var _0x3d2104={'where':_0x486ec9['where']};return db[_0x1690('0x26')][_0x1690('0x3d')](_0x3d2104)[_0x1690('0x1e')](function(_0x483c15){_0x197f60[_0x1690('0x3d')]=_0x483c15;if(_0x12961e[_0x1690('0x2a')][_0x1690('0x3e')]){_0x486ec9['include']=[{'all':!![]}];}return db[_0x1690('0x26')][_0x1690('0x3f')](_0x486ec9);})[_0x1690('0x1e')](function(_0x37f620){_0x197f60['rows']=_0x37f620;return _0x197f60;})['then'](respondWithFilteredResult(_0x536c54,_0x486ec9))[_0x1690('0x40')](handleError(_0x536c54,null));};exports[_0x1690('0x41')]=function(_0x2a39c2,_0xd2acd1){var _0x4d17d8={'raw':![],'where':{'id':_0x2a39c2[_0x1690('0x42')]['id']}},_0x18f5be={};_0x18f5be[_0x1690('0x28')]=_[_0x1690('0x29')](db['JscriptyProject']['rawAttributes']);_0x18f5be['query']=_[_0x1690('0x29')](_0x2a39c2[_0x1690('0x2a')]);_0x18f5be[_0x1690('0x2b')]=_['intersection'](_0x18f5be[_0x1690('0x28')],_0x18f5be[_0x1690('0x2a')]);_0x4d17d8['attributes']=_[_0x1690('0x2c')](_0x18f5be[_0x1690('0x28')],qs['fields'](_0x2a39c2[_0x1690('0x2a')]['fields']));_0x4d17d8[_0x1690('0x2d')]=_0x4d17d8[_0x1690('0x2d')][_0x1690('0x2f')]?_0x4d17d8[_0x1690('0x2d')]:_0x18f5be[_0x1690('0x28')];if(_0x2a39c2[_0x1690('0x2a')][_0x1690('0x3e')]){_0x4d17d8[_0x1690('0x43')]=[{'all':!![]}];}_0x4d17d8=_[_0x1690('0x37')]({},_0x4d17d8,_0x2a39c2[_0x1690('0x44')]);return db[_0x1690('0x26')][_0x1690('0x45')](_0x4d17d8)[_0x1690('0x1e')](handleEntityNotFound(_0xd2acd1,null))[_0x1690('0x1e')](respondWithResult(_0xd2acd1,null))['catch'](handleError(_0xd2acd1,null));};exports['create']=function(_0x410fcb,_0x4bb656){return db[_0x1690('0x26')][_0x1690('0x46')](_0x410fcb[_0x1690('0x47')],{})[_0x1690('0x1e')](function(_0x4d73ef){var _0x454ba3=_0x410fcb[_0x1690('0x48')][_0x1690('0x20')]({'plain':!![]});if(!_0x454ba3)throw new Error(_0x1690('0x49'));if(_0x454ba3['role']===_0x1690('0x48')){var _0x537c58=_0x4d73ef[_0x1690('0x20')]({'plain':!![]});var _0x4b4314='Projects';return db[_0x1690('0x4a')]['find']({'where':{'name':_0x4b4314,'userProfileId':_0x454ba3[_0x1690('0x4b')]},'raw':!![]})[_0x1690('0x1e')](function(_0x37943b){if(_0x37943b&&_0x37943b[_0x1690('0x4c')]===0x0){return db[_0x1690('0x22')][_0x1690('0x46')]({'name':_0x537c58[_0x1690('0x25')],'resourceId':_0x537c58['id'],'type':_0x37943b[_0x1690('0x25')],'sectionId':_0x37943b['id']},{})['then'](function(){return _0x4d73ef;});}else{return _0x4d73ef;}})['catch'](function(_0x326a97){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x326a97);throw _0x326a97;});}return _0x4d73ef;})[_0x1690('0x1e')](respondWithResult(_0x4bb656,0xc9))[_0x1690('0x40')](handleError(_0x4bb656,null));};exports[_0x1690('0x4d')]=function(_0x4c57c2,_0x528461){var _0x506cd9={'raw':![],'where':{'id':_0x4c57c2['params']['id']}},_0x86486={};_0x86486[_0x1690('0x28')]=_[_0x1690('0x29')](db[_0x1690('0x26')][_0x1690('0x27')]);_0x506cd9[_0x1690('0x2d')]=_['intersection'](_0x86486[_0x1690('0x28')],qs[_0x1690('0x2e')](_0x4c57c2[_0x1690('0x2a')][_0x1690('0x2e')]));_0x506cd9[_0x1690('0x2d')]=_0x506cd9[_0x1690('0x2d')][_0x1690('0x2f')]?_0x506cd9['attributes']:_0x86486['model'];if(_0x4c57c2['query'][_0x1690('0x3e')]){_0x506cd9[_0x1690('0x43')]=[{'all':!![]}];}_0x506cd9=_['merge']({},_0x506cd9,_0x4c57c2['options']);return db[_0x1690('0x26')]['find'](_0x506cd9)[_0x1690('0x1e')](handleEntityNotFound(_0x528461,null))[_0x1690('0x1e')](function(_0x535c53){if(_0x535c53){var _0x1eb968=_0x535c53[_0x1690('0x20')]({'plain':!![]});_0x1eb968=qs['omit'](_0x1eb968,['id',_0x1690('0x4e'),_0x1690('0x4f')]);_0x4c57c2[_0x1690('0x47')]=_['omit'](_0x4c57c2[_0x1690('0x47')],['id',_0x1690('0x4e'),_0x1690('0x4f')]);return db['JscriptyProject'][_0x1690('0x46')](_['merge'](_0x1eb968,_0x4c57c2['body']),{'include':_0x4c57c2[_0x1690('0x2a')][_0x1690('0x3e')]?[{'all':!![]}]:undefined})[_0x1690('0x1e')](function(_0x2ff810){var _0x1e5f24=_0x4c57c2[_0x1690('0x48')][_0x1690('0x20')]({'plain':!![]});if(!_0x1e5f24)throw new Error(_0x1690('0x49'));if(_0x1e5f24['role']===_0x1690('0x48')){var _0x3d4c3d=_0x2ff810[_0x1690('0x20')]({'plain':!![]});var _0x174951='Projects';return db['UserProfileSection'][_0x1690('0x45')]({'where':{'name':_0x174951,'userProfileId':_0x1e5f24['userProfileId']},'raw':!![]})[_0x1690('0x1e')](function(_0x2d23a8){if(_0x2d23a8&&_0x2d23a8[_0x1690('0x4c')]===0x0){return db[_0x1690('0x22')]['create']({'name':_0x3d4c3d[_0x1690('0x25')],'resourceId':_0x3d4c3d['id'],'type':_0x2d23a8[_0x1690('0x25')],'sectionId':_0x2d23a8['id']},{})[_0x1690('0x1e')](function(){return _0x2ff810;});}else{return _0x2ff810;}})[_0x1690('0x40')](function(_0x4f279f){logger[_0x1690('0x23')](_0x1690('0x50'),_0x4f279f);throw _0x4f279f;});}return _0x2ff810;});}})['then'](respondWithResult(_0x528461,0xc9))[_0x1690('0x40')](handleError(_0x528461,null));};exports[_0x1690('0x1d')]=function(_0x315151,_0x5756ea){if(_0x315151[_0x1690('0x47')]['id']){delete _0x315151[_0x1690('0x47')]['id'];}return db[_0x1690('0x26')]['find']({'where':{'id':_0x315151[_0x1690('0x42')]['id']}})[_0x1690('0x1e')](handleEntityNotFound(_0x5756ea,null))[_0x1690('0x1e')](saveUpdates(_0x315151[_0x1690('0x47')],null))[_0x1690('0x1e')](respondWithResult(_0x5756ea,null))[_0x1690('0x40')](handleError(_0x5756ea,null));};exports['destroy']=function(_0x14b32a,_0x227729){return db[_0x1690('0x26')][_0x1690('0x45')]({'where':{'id':_0x14b32a[_0x1690('0x42')]['id']}})['then'](handleEntityNotFound(_0x227729,null))[_0x1690('0x1e')](removeEntity(_0x227729,null))['catch'](handleError(_0x227729,null));};exports['getSessions']=function(_0x11f464,_0x9c772d,_0x384c37){var _0x8b4e7e={'raw':!![],'where':{}};var _0x5d171a={};var _0x42feba={'count':0x0,'rows':[]};return db[_0x1690('0x26')][_0x1690('0x51')]({'where':{'id':_0x11f464[_0x1690('0x42')]['id']}})[_0x1690('0x1e')](handleEntityNotFound(_0x9c772d,null))['then'](function(_0x126f38){if(_0x126f38){_0x5d171a[_0x1690('0x28')]=_[_0x1690('0x29')](db['JscriptySessionReport']['rawAttributes']);_0x5d171a[_0x1690('0x2a')]=_['keys'](_0x11f464[_0x1690('0x2a')]);_0x5d171a['filters']=_['intersection'](_0x5d171a[_0x1690('0x28')],_0x5d171a[_0x1690('0x2a')]);_0x8b4e7e['attributes']=_['intersection'](_0x5d171a[_0x1690('0x28')],qs[_0x1690('0x2e')](_0x11f464[_0x1690('0x2a')][_0x1690('0x2e')]));_0x8b4e7e['attributes']=_0x8b4e7e['attributes'][_0x1690('0x2f')]?_0x8b4e7e[_0x1690('0x2d')]:_0x5d171a[_0x1690('0x28')];if(!_0x11f464['query'][_0x1690('0x30')]('nolimit')){_0x8b4e7e[_0x1690('0x32')]=qs[_0x1690('0x32')](_0x11f464[_0x1690('0x2a')][_0x1690('0x32')]);_0x8b4e7e[_0x1690('0x19')]=qs[_0x1690('0x19')](_0x11f464[_0x1690('0x2a')][_0x1690('0x19')]);}_0x8b4e7e[_0x1690('0x33')]=qs['sort'](_0x11f464[_0x1690('0x2a')][_0x1690('0x34')]);_0x8b4e7e['where']=qs[_0x1690('0x2b')](_['pick'](_0x11f464[_0x1690('0x2a')],_0x5d171a[_0x1690('0x2b')]));_0x8b4e7e[_0x1690('0x35')][_0x1690('0x52')]=_0x126f38['id'];if(_0x11f464[_0x1690('0x2a')][_0x1690('0x3c')]){_0x8b4e7e['where']=_[_0x1690('0x37')](_0x8b4e7e['where'],{'$or':_[_0x1690('0x53')](_0x8b4e7e[_0x1690('0x2d')],function(_0x2864e4){var _0x2bde92={};_0x2bde92[_0x2864e4]={'$like':'%'+_0x11f464['query'][_0x1690('0x3c')]+'%'};return _0x2bde92;})});}_0x8b4e7e=_[_0x1690('0x37')]({},_0x8b4e7e,_0x11f464['options']);return db['JscriptySessionReport'][_0x1690('0x3d')]({'where':_0x8b4e7e[_0x1690('0x35')]})[_0x1690('0x1e')](function(_0x472e01){_0x42feba[_0x1690('0x3d')]=_0x472e01;if(_0x11f464['query'][_0x1690('0x3e')]){_0x8b4e7e['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1690('0x3f')](_0x8b4e7e);})[_0x1690('0x1e')](function(_0x3b0305){_0x42feba[_0x1690('0x54')]=_0x3b0305;return _0x42feba;});}})[_0x1690('0x1e')](respondWithFilteredResult(_0x9c772d,_0x8b4e7e))[_0x1690('0x40')](handleError(_0x9c772d,null));};exports[_0x1690('0x55')]=function(_0xf0bb7,_0x11f99a,_0x44d162){var _0x283645={'raw':!![],'where':{}};var _0x250faf={};var _0x30fc79={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x1690('0x51')]({'where':{'id':_0xf0bb7['params']['id']}})[_0x1690('0x1e')](handleEntityNotFound(_0x11f99a,null))[_0x1690('0x1e')](function(_0x5becf6){if(_0x5becf6){_0x250faf[_0x1690('0x28')]=_[_0x1690('0x29')](db['JscriptyAnswerReport']['rawAttributes']);_0x250faf[_0x1690('0x2a')]=_[_0x1690('0x29')](_0xf0bb7['query']);_0x250faf[_0x1690('0x2b')]=_[_0x1690('0x2c')](_0x250faf[_0x1690('0x28')],_0x250faf[_0x1690('0x2a')]);_0x283645[_0x1690('0x2d')]=_[_0x1690('0x2c')](_0x250faf[_0x1690('0x28')],qs[_0x1690('0x2e')](_0xf0bb7[_0x1690('0x2a')]['fields']));_0x283645[_0x1690('0x2d')]=_0x283645[_0x1690('0x2d')][_0x1690('0x2f')]?_0x283645[_0x1690('0x2d')]:_0x250faf[_0x1690('0x28')];if(!_0xf0bb7[_0x1690('0x2a')][_0x1690('0x30')](_0x1690('0x31'))){_0x283645[_0x1690('0x32')]=qs[_0x1690('0x32')](_0xf0bb7[_0x1690('0x2a')][_0x1690('0x32')]);_0x283645[_0x1690('0x19')]=qs[_0x1690('0x19')](_0xf0bb7[_0x1690('0x2a')][_0x1690('0x19')]);}_0x283645['order']=qs[_0x1690('0x34')](_0xf0bb7['query'][_0x1690('0x34')]);_0x283645[_0x1690('0x35')]=qs[_0x1690('0x2b')](_[_0x1690('0x36')](_0xf0bb7[_0x1690('0x2a')],_0x250faf['filters']));_0x283645[_0x1690('0x35')]['ProjectId']=_0x5becf6['id'];if(_0xf0bb7[_0x1690('0x2a')][_0x1690('0x3c')]){_0x283645[_0x1690('0x35')]=_[_0x1690('0x37')](_0x283645[_0x1690('0x35')],{'$or':_[_0x1690('0x53')](_0x283645['attributes'],function(_0x576e9c){var _0x4da656={};_0x4da656[_0x576e9c]={'$like':'%'+_0xf0bb7[_0x1690('0x2a')][_0x1690('0x3c')]+'%'};return _0x4da656;})});}_0x283645=_[_0x1690('0x37')]({},_0x283645,_0xf0bb7[_0x1690('0x44')]);return db[_0x1690('0x56')][_0x1690('0x3d')]({'where':_0x283645['where']})[_0x1690('0x1e')](function(_0x239a67){_0x30fc79['count']=_0x239a67;if(_0xf0bb7[_0x1690('0x2a')][_0x1690('0x3e')]){_0x283645[_0x1690('0x43')]=[{'all':!![]}];}return db[_0x1690('0x56')][_0x1690('0x3f')](_0x283645);})[_0x1690('0x1e')](function(_0x16fc10){_0x30fc79[_0x1690('0x54')]=_0x16fc10;return _0x30fc79;});}})[_0x1690('0x1e')](respondWithFilteredResult(_0x11f99a,_0x283645))[_0x1690('0x40')](handleError(_0x11f99a,null));};function char(_0x335996){return _0x1690('0x57')===typeof _0x335996?String['fromCharCode'][_0x1690('0x1b')](null,arguments):_0x335996;}function needsEncapsulation(_0x1630da){return!!_0x1630da&&(_0x1630da['toString']()[_0x1690('0x58')](char(0xd))>=0x0||_0x1630da[_0x1690('0x59')]()['indexOf'](char(0xa))>=0x0||_0x1630da[_0x1690('0x59')]()[_0x1690('0x58')](char(0x2c))>=0x0||_0x1630da['toString']()[_0x1690('0x58')](char(0x22))>=0x0);}function encapsulate(_0x31c294){var _0x451dd5=char(0x22),_0x53758c='\x5c'+char(0x22),_0x3ad28b=_0x31c294[_0x1690('0x59')]()[_0x1690('0x5a')](new RegExp(_0x451dd5,'g'),_0x53758c);return _0x451dd5+_0x3ad28b+_0x451dd5;}exports[_0x1690('0x5b')]=function(_0x1cd811,_0xb9843f,_0x383e7e){var _0x3f259a,_0x2339b9;var _0x806f25={'where':{'ProjectId':_0x1cd811[_0x1690('0x42')]['id']}};if(_0x1cd811['query'][_0x1690('0x5c')]){_0x806f25[_0x1690('0x35')][_0x1690('0x5d')]=JSON[_0x1690('0x5e')](_0x1cd811[_0x1690('0x2a')][_0x1690('0x5c')]);}return db['JscriptySessionReport']['findAll'](_0x806f25)['then'](handleEntityNotFound(_0xb9843f,null))['then'](function(_0x33ba21){if(_0x33ba21){_0x3f259a=_0x33ba21;return db[_0x1690('0x5f')][_0x1690('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0x3f259a,'id')},'ProjectId':_0x1cd811[_0x1690('0x42')]['id']},'order':_0x1690('0x60')});}})[_0x1690('0x1e')](handleEntityNotFound(_0xb9843f,null))[_0x1690('0x1e')](function(_0x1b318b){if(_0x1b318b){_0x2339b9=_0x1b318b;var _0x3ee1b4={};for(var _0x230891=0x0,_0x42814a=_0x2339b9[_0x1690('0x2f')];_0x230891<_0x42814a;_0x230891++){if(!_0x3ee1b4[_0x1690('0x30')](_0x2339b9[_0x230891][_0x1690('0x61')])){_0x3ee1b4[_0x2339b9[_0x230891][_0x1690('0x61')]]=needsEncapsulation(_0x2339b9[_0x230891]['question'])?encapsulate(_0x2339b9[_0x230891][_0x1690('0x62')]):_0x2339b9[_0x230891][_0x1690('0x62')];}}var _0x4f01d8=[],_0x1ec09a={};for(var _0x5749c5=0x0,_0x1018a5=_0x3f259a[_0x1690('0x2f')];_0x5749c5<_0x1018a5;_0x5749c5++){_0x1ec09a={'ProjectId':_0x1cd811[_0x1690('0x42')]['id'],'SessionId':_0x3f259a[_0x5749c5]['id'],'StartTime':moment(_0x3f259a[_0x5749c5][_0x1690('0x5d')])[_0x1690('0x63')](_0x1690('0x64'))};for(var _0x5b0930=0x0,_0x2ab1f8=_0x2339b9['length'];_0x5b0930<_0x2ab1f8;_0x5b0930++){if(_0x2339b9[_0x5b0930][_0x1690('0x65')]==_0x3f259a[_0x5749c5]['id']&&_0x3ee1b4['hasOwnProperty'](_0x2339b9[_0x5b0930][_0x1690('0x61')])){_0x1ec09a[_0x3ee1b4[_0x2339b9[_0x5b0930][_0x1690('0x61')]]]=_0x2339b9[_0x5b0930][_0x1690('0x66')];}}for(var _0xd67b5b in _0x3ee1b4){if(!_0x1ec09a[_0x1690('0x30')](_0x3ee1b4[_0xd67b5b])){_0x1ec09a[_0x3ee1b4[_0xd67b5b]]=null;}}_0x4f01d8[_0x1690('0x67')](_0x1ec09a);}return _0x4f01d8;}})[_0x1690('0x1e')](function(_0xeecdb9){if(!_[_0x1690('0x68')](_0xeecdb9)){var _0xdf4422=toCsv(_0xeecdb9);var _0x109c1c=Date[_0x1690('0x69')]();fs[_0x1690('0x6a')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1cd811[_0x1690('0x42')]['id'],_0x109c1c),_0xdf4422);_0xb9843f[_0x1690('0x6b')](_0x1690('0x6c'),_0x1690('0x6d')+util[_0x1690('0x63')](_0x1690('0x6e'),_0x1cd811[_0x1690('0x42')]['id'],_0x109c1c));_0xb9843f[_0x1690('0x6b')](_0x1690('0x6f'),_0x1690('0x70'));return _0xb9843f[_0x1690('0x71')](util[_0x1690('0x63')](_0x1690('0x72'),_0x1cd811[_0x1690('0x42')]['id'],_0x109c1c));}else{return _0xb9843f[_0x1690('0x15')](0xcc);}})[_0x1690('0x40')](handleError(_0xb9843f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0075339..e3cef1f 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 _0x36fe=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','JscriptyProject','lodash','util'];(function(_0xc48c59,_0x12e124){var _0xa6abca=function(_0x5702cf){while(--_0x5702cf){_0xc48c59['push'](_0xc48c59['shift']());}};_0xa6abca(++_0x12e124);}(_0x36fe,0x1de));var _0xe36f=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x36fe[_0x1f6f84];return _0x177f40;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var logger=require(_0xe36f('0x2'))(_0xe36f('0x3'));var moment=require(_0xe36f('0x4'));var BPromise=require(_0xe36f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe36f('0x6'));var rimraf=require(_0xe36f('0x7'));var config=require(_0xe36f('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0xe36f('0x9')]=function(_0x4c2ab2,_0x362792){return _0x4c2ab2[_0xe36f('0xa')](_0xe36f('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb510=['api','moment','request-promise','path','rimraf','exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x1f7397,_0x13bae6){var _0x1cfcb0=function(_0x30e243){while(--_0x30e243){_0x1f7397['push'](_0x1f7397['shift']());}};_0x1cfcb0(++_0x13bae6);}(_0xb510,0x173));var _0x0b51=function(_0x2766a0,_0x112c40){_0x2766a0=_0x2766a0-0x0;var _0x233a07=_0xb510[_0x2766a0];return _0x233a07;};'use strict';var _=require(_0x0b51('0x0'));var util=require(_0x0b51('0x1'));var logger=require(_0x0b51('0x2'))(_0x0b51('0x3'));var moment=require(_0x0b51('0x4'));var BPromise=require('bluebird');var rp=require(_0x0b51('0x5'));var fs=require('fs');var path=require(_0x0b51('0x6'));var rimraf=require(_0x0b51('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x0b51('0x8')]=function(_0x574c82,_0x4c0bcf){return _0x574c82['define'](_0x0b51('0x9'),attributes,{'tableName':_0x0b51('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 5c0c9df..ebdb65e 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 _0xbdaf=['info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','JscriptyProject,\x20%s,\x20%s','message'];(function(_0x1b18c0,_0x34835b){var _0x123082=function(_0x5ce3bb){while(--_0x5ce3bb){_0x1b18c0['push'](_0x1b18c0['shift']());}};_0x123082(++_0x34835b);}(_0xbdaf,0xb5));var _0xfbda=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xbdaf[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xfbda('0x0'));var util=require('util');var moment=require(_0xfbda('0x1'));var BPromise=require(_0xfbda('0x2'));var rs=require(_0xfbda('0x3'));var fs=require('fs');var Redis=require(_0xfbda('0x4'));var db=require(_0xfbda('0x5'))['db'];var utils=require(_0xfbda('0x6'));var logger=require('../../config/logger')(_0xfbda('0x7'));var config=require(_0xfbda('0x8'));var jayson=require(_0xfbda('0x9'));var client=jayson[_0xfbda('0xa')][_0xfbda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11da28,_0x567e07,_0x810a32){return new BPromise(function(_0x9e5a02,_0x3befb1){return client['request'](_0x11da28,_0x810a32)[_0xfbda('0xc')](function(_0x32c236){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x567e07,_0xfbda('0xd'));logger['debug'](_0xfbda('0xe'),_0x567e07,_0xfbda('0xd'),JSON['stringify'](_0x32c236));if(_0x32c236[_0xfbda('0xf')]){if(_0x32c236[_0xfbda('0xf')][_0xfbda('0x10')]===0x1f4){logger['error'](_0xfbda('0x11'),_0x567e07,_0x32c236[_0xfbda('0xf')][_0xfbda('0x12')]);return _0x3befb1(_0x32c236[_0xfbda('0xf')][_0xfbda('0x12')]);}logger[_0xfbda('0xf')](_0xfbda('0x11'),_0x567e07,_0x32c236[_0xfbda('0xf')][_0xfbda('0x12')]);return _0x9e5a02(_0x32c236[_0xfbda('0xf')][_0xfbda('0x12')]);}else{logger[_0xfbda('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x567e07,_0xfbda('0xd'));_0x9e5a02(_0x32c236['result'][_0xfbda('0x12')]);}})['catch'](function(_0x5c9155){logger[_0xfbda('0xf')](_0xfbda('0x11'),_0x567e07,_0x5c9155);_0x3befb1(_0x5c9155);});});} \ No newline at end of file +var _0xc5d3=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info'];(function(_0x3123e6,_0x33bc74){var _0x28c544=function(_0x28e5d8){while(--_0x28e5d8){_0x3123e6['push'](_0x3123e6['shift']());}};_0x28c544(++_0x33bc74);}(_0xc5d3,0xe6));var _0x3c5d=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0xc5d3[_0x507c81];return _0x368a25;};'use strict';var _=require('lodash');var util=require(_0x3c5d('0x0'));var moment=require(_0x3c5d('0x1'));var BPromise=require(_0x3c5d('0x2'));var rs=require(_0x3c5d('0x3'));var fs=require('fs');var Redis=require(_0x3c5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c5d('0x5'));var logger=require(_0x3c5d('0x6'))(_0x3c5d('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c5d('0x8'));var client=jayson['client'][_0x3c5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39093d,_0x3e6bd3,_0x2dc041){return new BPromise(function(_0x5ad2dc,_0xd895d0){return client['request'](_0x39093d,_0x2dc041)[_0x3c5d('0xa')](function(_0x3ad9bf){logger[_0x3c5d('0xb')](_0x3c5d('0xc'),_0x3e6bd3,_0x3c5d('0xd'));logger[_0x3c5d('0xe')](_0x3c5d('0xf'),_0x3e6bd3,_0x3c5d('0xd'),JSON[_0x3c5d('0x10')](_0x3ad9bf));if(_0x3ad9bf[_0x3c5d('0x11')]){if(_0x3ad9bf['error'][_0x3c5d('0x12')]===0x1f4){logger[_0x3c5d('0x11')](_0x3c5d('0xc'),_0x3e6bd3,_0x3ad9bf[_0x3c5d('0x11')]['message']);return _0xd895d0(_0x3ad9bf[_0x3c5d('0x11')]['message']);}logger['error'](_0x3c5d('0xc'),_0x3e6bd3,_0x3ad9bf['error']['message']);return _0x5ad2dc(_0x3ad9bf['error'][_0x3c5d('0x13')]);}else{logger[_0x3c5d('0xb')](_0x3c5d('0xc'),_0x3e6bd3,_0x3c5d('0xd'));_0x5ad2dc(_0x3ad9bf[_0x3c5d('0x14')][_0x3c5d('0x13')]);}})[_0x3c5d('0x15')](function(_0xd06dc1){logger[_0x3c5d('0x11')](_0x3c5d('0xc'),_0x3e6bd3,_0xd06dc1);_0xd895d0(_0xd06dc1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2563f6d..0b57a74 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 _0x8fa6=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x32f0cb,_0x10bcec){var _0x23a38a=function(_0x580414){while(--_0x580414){_0x32f0cb['push'](_0x32f0cb['shift']());}};_0x23a38a(++_0x10bcec);}(_0x8fa6,0xfc));var _0x68fa=function(_0x48c35b,_0x20d700){_0x48c35b=_0x48c35b-0x0;var _0x5d15d1=_0x8fa6[_0x48c35b];return _0x5d15d1;};'use strict';var multer=require(_0x68fa('0x0'));var util=require(_0x68fa('0x1'));var path=require(_0x68fa('0x2'));var timeout=require('connect-timeout');var express=require(_0x68fa('0x3'));var router=express['Router']();var auth=require(_0x68fa('0x4'));var interaction=require(_0x68fa('0x5'));var config=require(_0x68fa('0x6'));var controller=require(_0x68fa('0x7'));router[_0x68fa('0x8')]('/',auth[_0x68fa('0x9')](),controller['index']);router[_0x68fa('0x8')](_0x68fa('0xa'),auth['isAuthenticated'](),controller[_0x68fa('0xb')]);router[_0x68fa('0x8')](_0x68fa('0xc'),auth['isAuthenticated'](),controller[_0x68fa('0xd')]);router[_0x68fa('0xe')]('/',auth[_0x68fa('0x9')](),controller[_0x68fa('0xf')]);router[_0x68fa('0x10')]('/:id',auth[_0x68fa('0x9')](),controller[_0x68fa('0x11')]);router[_0x68fa('0x12')](_0x68fa('0xc'),auth[_0x68fa('0x9')](),controller[_0x68fa('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd989=['delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update'];(function(_0x207d4e,_0x5158dc){var _0x24b6f4=function(_0x96ce36){while(--_0x96ce36){_0x207d4e['push'](_0x207d4e['shift']());}};_0x24b6f4(++_0x5158dc);}(_0xd989,0x86));var _0x9d98=function(_0x3b601a,_0x1fcc08){_0x3b601a=_0x3b601a-0x0;var _0x3b4d2b=_0xd989[_0x3b601a];return _0x3b4d2b;};'use strict';var multer=require('multer');var util=require(_0x9d98('0x0'));var path=require('path');var timeout=require(_0x9d98('0x1'));var express=require(_0x9d98('0x2'));var router=express[_0x9d98('0x3')]();var auth=require(_0x9d98('0x4'));var interaction=require(_0x9d98('0x5'));var config=require(_0x9d98('0x6'));var controller=require(_0x9d98('0x7'));router[_0x9d98('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d98('0x9')]);router['get'](_0x9d98('0xa'),auth[_0x9d98('0xb')](),controller[_0x9d98('0xc')]);router['get'](_0x9d98('0xd'),auth[_0x9d98('0xb')](),controller[_0x9d98('0xe')]);router[_0x9d98('0xf')]('/',auth['isAuthenticated'](),controller[_0x9d98('0x10')]);router['put'](_0x9d98('0xd'),auth[_0x9d98('0xb')](),controller[_0x9d98('0x11')]);router[_0x9d98('0x12')](_0x9d98('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index d734c91..67949b5 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 _0xad34=['long','STRING','sequelize','TEXT'];(function(_0x590454,_0x30c9cf){var _0x21cb88=function(_0xb039ac){while(--_0xb039ac){_0x590454['push'](_0x590454['shift']());}};_0x21cb88(++_0x30c9cf);}(_0xad34,0x192));var _0x4ad3=function(_0x1dac63,_0x389542){_0x1dac63=_0x1dac63-0x0;var _0x477513=_0xad34[_0x1dac63];return _0x477513;};'use strict';var Sequelize=require(_0x4ad3('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x4ad3('0x1')](_0x4ad3('0x2'))},'membername':{'type':Sequelize[_0x4ad3('0x3')]},'projectname':{'type':Sequelize[_0x4ad3('0x3')]},'queue':{'type':Sequelize[_0x4ad3('0x3')]},'uniqueid':{'type':Sequelize[_0x4ad3('0x3')]},'calleridname':{'type':Sequelize[_0x4ad3('0x3')]},'calleridnum':{'type':Sequelize[_0x4ad3('0x3')]},'questionId':{'type':Sequelize[_0x4ad3('0x3')]}}; \ No newline at end of file +var _0x27c4=['STRING','long','sequelize','exports'];(function(_0x4d0174,_0x235e03){var _0x14f56f=function(_0x131657){while(--_0x131657){_0x4d0174['push'](_0x4d0174['shift']());}};_0x14f56f(++_0x235e03);}(_0x27c4,0x102));var _0x427c=function(_0x513bee,_0x5e07e7){_0x513bee=_0x513bee-0x0;var _0x497f68=_0x27c4[_0x513bee];return _0x497f68;};'use strict';var Sequelize=require(_0x427c('0x0'));module[_0x427c('0x1')]={'question':{'type':Sequelize[_0x427c('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x427c('0x3'))},'membername':{'type':Sequelize[_0x427c('0x2')]},'projectname':{'type':Sequelize[_0x427c('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x427c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x427c('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 5578e3e..1bbc3dc 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 _0x1228=['sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','then','error','stack','name','index','JscriptyQuestionReport','rawAttributes','model','keys','query','attributes','fields','length','hasOwnProperty','filters','where','type','field','merge','options','include','findAll','rows','catch','show','intersection','includeAll','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x51a4ea,_0x2d908f){var _0x4f23f2=function(_0x25adbf){while(--_0x25adbf){_0x51a4ea['push'](_0x51a4ea['shift']());}};_0x4f23f2(++_0x2d908f);}(_0x1228,0x12f));var _0x8122=function(_0x1aa277,_0x1edd4f){_0x1aa277=_0x1aa277-0x0;var _0x2f21e5=_0x1228[_0x1aa277];return _0x2f21e5;};'use strict';var pdf=require(_0x8122('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8122('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8122('0x2'));var rp=require(_0x8122('0x3'));var moment=require(_0x8122('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8122('0x5'));var util=require(_0x8122('0x6'));var path=require('path');var sox=require(_0x8122('0x7'));var csv=require(_0x8122('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8122('0x9'));var squel=require(_0x8122('0xa'));var crypto=require('crypto');var jsforce=require(_0x8122('0xb'));var deskjs=require(_0x8122('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8122('0xd'));var Papa=require(_0x8122('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8122('0xf'))('api');var utils=require(_0x8122('0x10'));var config=require(_0x8122('0x11'));var db=require(_0x8122('0x12'))['db'];function respondWithStatusCode(_0x58f27c,_0x2e325f){_0x2e325f=_0x2e325f||0xcc;return function(_0x565f6e){if(_0x565f6e){return _0x58f27c[_0x8122('0x13')](_0x2e325f);}return _0x58f27c[_0x8122('0x14')](_0x2e325f)[_0x8122('0x15')]();};}function respondWithResult(_0x2d2560,_0x961f9d){_0x961f9d=_0x961f9d||0xc8;return function(_0x266feb){if(_0x266feb){return _0x2d2560[_0x8122('0x14')](_0x961f9d)[_0x8122('0x16')](_0x266feb);}};}function respondWithFilteredResult(_0x41d297,_0x41a217){return function(_0xfa15a2){if(_0xfa15a2){var _0x6baf37=_0xfa15a2[_0x8122('0x17')],_0x559256=_0x41a217['offset'],_0x3ed5d1=_0x41a217[_0x8122('0x18')]+_0x41a217[_0x8122('0x19')],_0x56179b;if(_0x3ed5d1>=_0x6baf37){_0x3ed5d1=_0x6baf37;_0x56179b=0xc8;}else{_0x56179b=0xce;}_0x41d297[_0x8122('0x14')](_0x56179b);return _0x41d297[_0x8122('0x1a')]('Content-Range',_0x559256+'-'+_0x3ed5d1+'/'+_0x6baf37)['json'](_0xfa15a2);}return null;};}function patchUpdates(_0x5c93f6){return function(_0x56a926){try{jsonpatch[_0x8122('0x1b')](_0x56a926,_0x5c93f6,!![]);}catch(_0x2511e9){return BPromise[_0x8122('0x1c')](_0x2511e9);}return _0x56a926['save']();};}function saveUpdates(_0x5df55f,_0x1162a8){return function(_0x174321){if(_0x174321){return _0x174321[_0x8122('0x1d')](_0x5df55f)['then'](function(_0x15e635){return _0x15e635;});}return null;};}function removeEntity(_0x1c0189,_0x27f204){return function(_0x988c0c){if(_0x988c0c){return _0x988c0c[_0x8122('0x1e')]()[_0x8122('0x1f')](function(){_0x1c0189[_0x8122('0x14')](0xcc)[_0x8122('0x15')]();});}};}function handleEntityNotFound(_0x4fc6af,_0x34c185){return function(_0x5cfa77){if(!_0x5cfa77){_0x4fc6af[_0x8122('0x13')](0x194);}return _0x5cfa77;};}function handleError(_0x45548d,_0x37baf3){_0x37baf3=_0x37baf3||0x1f4;return function(_0x2f04d5){logger[_0x8122('0x20')](_0x2f04d5[_0x8122('0x21')]);if(_0x2f04d5[_0x8122('0x22')]){delete _0x2f04d5[_0x8122('0x22')];}_0x45548d[_0x8122('0x14')](_0x37baf3)['send'](_0x2f04d5);};}exports[_0x8122('0x23')]=function(_0xa79602,_0x25cd87){var _0xc90a18={},_0x2f8d73={},_0x2eec0f={'count':0x0,'rows':[]};var _0x69dbf1=db[_0x8122('0x24')][_0x8122('0x25')];_0x2f8d73[_0x8122('0x26')]=_['keys'](_0x69dbf1);_0x2f8d73['query']=_[_0x8122('0x27')](_0xa79602[_0x8122('0x28')]);_0x2f8d73['filters']=_['intersection'](_0x2f8d73[_0x8122('0x26')],_0x2f8d73[_0x8122('0x28')]);_0xc90a18[_0x8122('0x29')]=_['intersection'](_0x2f8d73['model'],qs[_0x8122('0x2a')](_0xa79602[_0x8122('0x28')][_0x8122('0x2a')]));_0xc90a18[_0x8122('0x29')]=_0xc90a18[_0x8122('0x29')][_0x8122('0x2b')]?_0xc90a18[_0x8122('0x29')]:_0x2f8d73[_0x8122('0x26')];if(!_0xa79602[_0x8122('0x28')][_0x8122('0x2c')]('nolimit')){_0xc90a18[_0x8122('0x19')]=qs[_0x8122('0x19')](_0xa79602[_0x8122('0x28')][_0x8122('0x19')]);_0xc90a18[_0x8122('0x18')]=qs[_0x8122('0x18')](_0xa79602[_0x8122('0x28')][_0x8122('0x18')]);}_0xc90a18['order']=qs['sort'](_0xa79602[_0x8122('0x28')]['sort']);_0xc90a18['where']=qs[_0x8122('0x2d')](_['pick'](_0xa79602['query'],_0x2f8d73[_0x8122('0x2d')]));if(_0xa79602[_0x8122('0x28')]['filter']){_0xc90a18[_0x8122('0x2e')]=_['merge'](_0xc90a18[_0x8122('0x2e')],{'$or':_['map'](_0x69dbf1,function(_0x1fe9de){if(_0x1fe9de[_0x8122('0x2f')]['key']!=='VIRTUAL'){var _0x4ee8d0={};_0x4ee8d0[_0x1fe9de[_0x8122('0x30')]]={'$like':'%'+_0xa79602[_0x8122('0x28')]['filter']+'%'};return _0x4ee8d0;}})});}_0xc90a18=_[_0x8122('0x31')]({},_0xc90a18,_0xa79602[_0x8122('0x32')]);var _0x373b17={'where':_0xc90a18[_0x8122('0x2e')]};return db['JscriptyQuestionReport'][_0x8122('0x17')](_0x373b17)[_0x8122('0x1f')](function(_0x27cf4c){_0x2eec0f['count']=_0x27cf4c;if(_0xa79602[_0x8122('0x28')]['includeAll']){_0xc90a18[_0x8122('0x33')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8122('0x34')](_0xc90a18);})[_0x8122('0x1f')](function(_0x1e6c01){_0x2eec0f[_0x8122('0x35')]=_0x1e6c01;return _0x2eec0f;})['then'](respondWithFilteredResult(_0x25cd87,_0xc90a18))[_0x8122('0x36')](handleError(_0x25cd87,null));};exports[_0x8122('0x37')]=function(_0x565829,_0x32426a){var _0x438987={'raw':!![],'where':{'id':_0x565829['params']['id']}},_0x29fce6={};_0x29fce6[_0x8122('0x26')]=_['keys'](db[_0x8122('0x24')][_0x8122('0x25')]);_0x29fce6[_0x8122('0x28')]=_[_0x8122('0x27')](_0x565829[_0x8122('0x28')]);_0x29fce6['filters']=_[_0x8122('0x38')](_0x29fce6[_0x8122('0x26')],_0x29fce6['query']);_0x438987[_0x8122('0x29')]=_[_0x8122('0x38')](_0x29fce6[_0x8122('0x26')],qs[_0x8122('0x2a')](_0x565829[_0x8122('0x28')][_0x8122('0x2a')]));_0x438987[_0x8122('0x29')]=_0x438987['attributes'][_0x8122('0x2b')]?_0x438987[_0x8122('0x29')]:_0x29fce6[_0x8122('0x26')];if(_0x565829['query'][_0x8122('0x39')]){_0x438987[_0x8122('0x33')]=[{'all':!![]}];}_0x438987=_[_0x8122('0x31')]({},_0x438987,_0x565829['options']);return db['JscriptyQuestionReport'][_0x8122('0x3a')](_0x438987)['then'](handleEntityNotFound(_0x32426a,null))['then'](respondWithResult(_0x32426a,null))[_0x8122('0x36')](handleError(_0x32426a,null));};exports[_0x8122('0x3b')]=function(_0x106347,_0x497e30){return db[_0x8122('0x24')][_0x8122('0x3b')](_0x106347['body'],{})[_0x8122('0x1f')](respondWithResult(_0x497e30,0xc9))[_0x8122('0x36')](handleError(_0x497e30,null));};exports[_0x8122('0x1d')]=function(_0x215258,_0x5042dc){if(_0x215258[_0x8122('0x3c')]['id']){delete _0x215258['body']['id'];}return db[_0x8122('0x24')][_0x8122('0x3a')]({'where':{'id':_0x215258['params']['id']}})[_0x8122('0x1f')](handleEntityNotFound(_0x5042dc,null))[_0x8122('0x1f')](saveUpdates(_0x215258['body'],null))[_0x8122('0x1f')](respondWithResult(_0x5042dc,null))[_0x8122('0x36')](handleError(_0x5042dc,null));};exports[_0x8122('0x1e')]=function(_0x8c7e4f,_0x1d9ccf){return db[_0x8122('0x24')][_0x8122('0x3a')]({'where':{'id':_0x8c7e4f['params']['id']}})[_0x8122('0x1f')](handleEntityNotFound(_0x1d9ccf,null))[_0x8122('0x1f')](removeEntity(_0x1d9ccf,null))[_0x8122('0x36')](handleError(_0x1d9ccf,null));};exports[_0x8122('0x3d')]=function(_0x58b9cb,_0x2779ea){return db[_0x8122('0x24')][_0x8122('0x3d')]()['then'](respondWithResult(_0x2779ea,null))[_0x8122('0x36')](handleError(_0x2779ea,null));}; \ No newline at end of file +var _0x9f0e=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','map','type','VIRTUAL','field','options','includeAll','rows','catch','show','params','merge','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2f9355,_0x2bf9fe){var _0x40c1e2=function(_0x3beac7){while(--_0x3beac7){_0x2f9355['push'](_0x2f9355['shift']());}};_0x40c1e2(++_0x2bf9fe);}(_0x9f0e,0x116));var _0xe9f0=function(_0x9dbc17,_0x257c09){_0x9dbc17=_0x9dbc17-0x0;var _0x12cfed=_0x9f0e[_0x9dbc17];return _0x12cfed;};'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 hardwareService=require(_0xe9f0('0x14'));var logger=require(_0xe9f0('0x15'))('api');var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x4a82aa,_0x207fac){_0x207fac=_0x207fac||0xcc;return function(_0x586763){if(_0x586763){return _0x4a82aa[_0xe9f0('0x19')](_0x207fac);}return _0x4a82aa[_0xe9f0('0x1a')](_0x207fac)[_0xe9f0('0x1b')]();};}function respondWithResult(_0x216601,_0x55a388){_0x55a388=_0x55a388||0xc8;return function(_0x2cf75d){if(_0x2cf75d){return _0x216601['status'](_0x55a388)[_0xe9f0('0x1c')](_0x2cf75d);}};}function respondWithFilteredResult(_0x23914b,_0x3800e8){return function(_0x59320d){if(_0x59320d){var _0x28bfac=_0x59320d[_0xe9f0('0x1d')],_0x33e9e4=_0x3800e8[_0xe9f0('0x1e')],_0x2e68ef=_0x3800e8[_0xe9f0('0x1e')]+_0x3800e8[_0xe9f0('0x1f')],_0x598eee;if(_0x2e68ef>=_0x28bfac){_0x2e68ef=_0x28bfac;_0x598eee=0xc8;}else{_0x598eee=0xce;}_0x23914b[_0xe9f0('0x1a')](_0x598eee);return _0x23914b[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x33e9e4+'-'+_0x2e68ef+'/'+_0x28bfac)['json'](_0x59320d);}return null;};}function patchUpdates(_0x15a33b){return function(_0x19e090){try{jsonpatch[_0xe9f0('0x22')](_0x19e090,_0x15a33b,!![]);}catch(_0x5c4182){return BPromise[_0xe9f0('0x23')](_0x5c4182);}return _0x19e090[_0xe9f0('0x24')]();};}function saveUpdates(_0x1698cf,_0x43f399){return function(_0x5ba788){if(_0x5ba788){return _0x5ba788[_0xe9f0('0x25')](_0x1698cf)[_0xe9f0('0x26')](function(_0x583687){return _0x583687;});}return null;};}function removeEntity(_0x51e03f,_0x4cc403){return function(_0x12fe9f){if(_0x12fe9f){return _0x12fe9f[_0xe9f0('0x27')]()[_0xe9f0('0x26')](function(){_0x51e03f[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x1b')]();});}};}function handleEntityNotFound(_0x4a5c27,_0x229fe0){return function(_0x38b7ee){if(!_0x38b7ee){_0x4a5c27[_0xe9f0('0x19')](0x194);}return _0x38b7ee;};}function handleError(_0x10801b,_0x3ca991){_0x3ca991=_0x3ca991||0x1f4;return function(_0x372ffd){logger[_0xe9f0('0x28')](_0x372ffd[_0xe9f0('0x29')]);if(_0x372ffd[_0xe9f0('0x2a')]){delete _0x372ffd[_0xe9f0('0x2a')];}_0x10801b['status'](_0x3ca991)[_0xe9f0('0x2b')](_0x372ffd);};}exports[_0xe9f0('0x2c')]=function(_0x2ddfba,_0x1a8478){var _0x4cf1b1={},_0x212a38={},_0x2613fd={'count':0x0,'rows':[]};var _0x856ac8=db[_0xe9f0('0x2d')][_0xe9f0('0x2e')];_0x212a38['model']=_[_0xe9f0('0x2f')](_0x856ac8);_0x212a38[_0xe9f0('0x30')]=_[_0xe9f0('0x2f')](_0x2ddfba[_0xe9f0('0x30')]);_0x212a38[_0xe9f0('0x31')]=_[_0xe9f0('0x32')](_0x212a38[_0xe9f0('0x33')],_0x212a38[_0xe9f0('0x30')]);_0x4cf1b1[_0xe9f0('0x34')]=_[_0xe9f0('0x32')](_0x212a38[_0xe9f0('0x33')],qs[_0xe9f0('0x35')](_0x2ddfba[_0xe9f0('0x30')][_0xe9f0('0x35')]));_0x4cf1b1[_0xe9f0('0x34')]=_0x4cf1b1[_0xe9f0('0x34')][_0xe9f0('0x36')]?_0x4cf1b1[_0xe9f0('0x34')]:_0x212a38[_0xe9f0('0x33')];if(!_0x2ddfba[_0xe9f0('0x30')][_0xe9f0('0x37')](_0xe9f0('0x38'))){_0x4cf1b1[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x2ddfba['query']['limit']);_0x4cf1b1['offset']=qs[_0xe9f0('0x1e')](_0x2ddfba['query'][_0xe9f0('0x1e')]);}_0x4cf1b1[_0xe9f0('0x39')]=qs['sort'](_0x2ddfba[_0xe9f0('0x30')]['sort']);_0x4cf1b1['where']=qs['filters'](_[_0xe9f0('0x3a')](_0x2ddfba[_0xe9f0('0x30')],_0x212a38['filters']));if(_0x2ddfba[_0xe9f0('0x30')][_0xe9f0('0x3b')]){_0x4cf1b1[_0xe9f0('0x3c')]=_['merge'](_0x4cf1b1['where'],{'$or':_[_0xe9f0('0x3d')](_0x856ac8,function(_0x3ff42d){if(_0x3ff42d[_0xe9f0('0x3e')]['key']!==_0xe9f0('0x3f')){var _0x2e7997={};_0x2e7997[_0x3ff42d[_0xe9f0('0x40')]]={'$like':'%'+_0x2ddfba[_0xe9f0('0x30')][_0xe9f0('0x3b')]+'%'};return _0x2e7997;}})});}_0x4cf1b1=_['merge']({},_0x4cf1b1,_0x2ddfba[_0xe9f0('0x41')]);var _0x3a2b23={'where':_0x4cf1b1[_0xe9f0('0x3c')]};return db['JscriptyQuestionReport'][_0xe9f0('0x1d')](_0x3a2b23)[_0xe9f0('0x26')](function(_0x4825f2){_0x2613fd[_0xe9f0('0x1d')]=_0x4825f2;if(_0x2ddfba['query'][_0xe9f0('0x42')]){_0x4cf1b1['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x4cf1b1);})['then'](function(_0x5165f7){_0x2613fd[_0xe9f0('0x43')]=_0x5165f7;return _0x2613fd;})[_0xe9f0('0x26')](respondWithFilteredResult(_0x1a8478,_0x4cf1b1))[_0xe9f0('0x44')](handleError(_0x1a8478,null));};exports[_0xe9f0('0x45')]=function(_0x2560c6,_0xd9b61b){var _0x3d4eb7={'raw':!![],'where':{'id':_0x2560c6[_0xe9f0('0x46')]['id']}},_0x3e79c1={};_0x3e79c1['model']=_[_0xe9f0('0x2f')](db[_0xe9f0('0x2d')][_0xe9f0('0x2e')]);_0x3e79c1['query']=_['keys'](_0x2560c6[_0xe9f0('0x30')]);_0x3e79c1['filters']=_[_0xe9f0('0x32')](_0x3e79c1[_0xe9f0('0x33')],_0x3e79c1[_0xe9f0('0x30')]);_0x3d4eb7[_0xe9f0('0x34')]=_['intersection'](_0x3e79c1[_0xe9f0('0x33')],qs[_0xe9f0('0x35')](_0x2560c6[_0xe9f0('0x30')][_0xe9f0('0x35')]));_0x3d4eb7[_0xe9f0('0x34')]=_0x3d4eb7['attributes'][_0xe9f0('0x36')]?_0x3d4eb7[_0xe9f0('0x34')]:_0x3e79c1[_0xe9f0('0x33')];if(_0x2560c6[_0xe9f0('0x30')][_0xe9f0('0x42')]){_0x3d4eb7['include']=[{'all':!![]}];}_0x3d4eb7=_[_0xe9f0('0x47')]({},_0x3d4eb7,_0x2560c6['options']);return db['JscriptyQuestionReport'][_0xe9f0('0x48')](_0x3d4eb7)[_0xe9f0('0x26')](handleEntityNotFound(_0xd9b61b,null))['then'](respondWithResult(_0xd9b61b,null))[_0xe9f0('0x44')](handleError(_0xd9b61b,null));};exports[_0xe9f0('0x49')]=function(_0x42d859,_0x7b167b){return db[_0xe9f0('0x2d')][_0xe9f0('0x49')](_0x42d859[_0xe9f0('0x4a')],{})['then'](respondWithResult(_0x7b167b,0xc9))[_0xe9f0('0x44')](handleError(_0x7b167b,null));};exports['update']=function(_0x3b8712,_0x5a3488){if(_0x3b8712[_0xe9f0('0x4a')]['id']){delete _0x3b8712['body']['id'];}return db[_0xe9f0('0x2d')][_0xe9f0('0x48')]({'where':{'id':_0x3b8712[_0xe9f0('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a3488,null))[_0xe9f0('0x26')](saveUpdates(_0x3b8712[_0xe9f0('0x4a')],null))[_0xe9f0('0x26')](respondWithResult(_0x5a3488,null))[_0xe9f0('0x44')](handleError(_0x5a3488,null));};exports[_0xe9f0('0x27')]=function(_0x135175,_0x6ece3f){return db[_0xe9f0('0x2d')][_0xe9f0('0x48')]({'where':{'id':_0x135175[_0xe9f0('0x46')]['id']}})[_0xe9f0('0x26')](handleEntityNotFound(_0x6ece3f,null))[_0xe9f0('0x26')](removeEntity(_0x6ece3f,null))['catch'](handleError(_0x6ece3f,null));};exports['describe']=function(_0x31aa19,_0x1f0c8b){return db[_0xe9f0('0x2d')]['describe']()[_0xe9f0('0x26')](respondWithResult(_0x1f0c8b,null))['catch'](handleError(_0x1f0c8b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ed19eb1..4dec41b 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 _0xe99d=['path','rimraf','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe99d,0x196));var _0xde99=function(_0x596873,_0x2b408c){_0x596873=_0x596873-0x0;var _0x17d000=_0xe99d[_0x596873];return _0x17d000;};'use strict';var _=require('lodash');var util=require(_0xde99('0x0'));var logger=require(_0xde99('0x1'))('api');var moment=require(_0xde99('0x2'));var BPromise=require(_0xde99('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde99('0x4'));var rimraf=require(_0xde99('0x5'));var config=require('../../config/environment');var attributes=require(_0xde99('0x6'));module['exports']=function(_0x297b69,_0x249bbb){return _0x297b69[_0xde99('0x7')](_0xde99('0x8'),attributes,{'tableName':_0xde99('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15ad=['path','./jscriptyQuestionReport.attributes','exports','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x36ea5d,_0x3f4ed2){var _0x3d7fb3=function(_0x460aad){while(--_0x460aad){_0x36ea5d['push'](_0x36ea5d['shift']());}};_0x3d7fb3(++_0x3f4ed2);}(_0x15ad,0x88));var _0xd15a=function(_0x4f49e5,_0x598594){_0x4f49e5=_0x4f49e5-0x0;var _0x232c34=_0x15ad[_0x4f49e5];return _0x232c34;};'use strict';var _=require(_0xd15a('0x0'));var util=require(_0xd15a('0x1'));var logger=require(_0xd15a('0x2'))(_0xd15a('0x3'));var moment=require(_0xd15a('0x4'));var BPromise=require(_0xd15a('0x5'));var rp=require(_0xd15a('0x6'));var fs=require('fs');var path=require(_0xd15a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd15a('0x8'));module[_0xd15a('0x9')]=function(_0x5eb58c,_0x1afc8d){return _0x5eb58c['define']('JscriptyQuestionReport',attributes,{'tableName':_0xd15a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 0d0268d..84a13ad 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 _0x9661=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9661,0x1ea));var _0x1966=function(_0x4f454e,_0x3a5c76){_0x4f454e=_0x4f454e-0x0;var _0x2ec1d2=_0x9661[_0x4f454e];return _0x2ec1d2;};'use strict';var _=require(_0x1966('0x0'));var util=require(_0x1966('0x1'));var moment=require('moment');var BPromise=require(_0x1966('0x2'));var rs=require(_0x1966('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1966('0x4'))['db'];var utils=require(_0x1966('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1966('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1966('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f161b,_0x10f862,_0x46c85a){return new BPromise(function(_0x4f8012,_0x12e4b8){return client[_0x1966('0x8')](_0x5f161b,_0x46c85a)[_0x1966('0x9')](function(_0x48a1c7){logger[_0x1966('0xa')](_0x1966('0xb'),_0x10f862,_0x1966('0xc'));logger[_0x1966('0xd')](_0x1966('0xe'),_0x10f862,_0x1966('0xc'),JSON[_0x1966('0xf')](_0x48a1c7));if(_0x48a1c7['error']){if(_0x48a1c7[_0x1966('0x10')][_0x1966('0x11')]===0x1f4){logger[_0x1966('0x10')](_0x1966('0xb'),_0x10f862,_0x48a1c7[_0x1966('0x10')]['message']);return _0x12e4b8(_0x48a1c7[_0x1966('0x10')][_0x1966('0x12')]);}logger[_0x1966('0x10')](_0x1966('0xb'),_0x10f862,_0x48a1c7[_0x1966('0x10')][_0x1966('0x12')]);return _0x4f8012(_0x48a1c7['error']['message']);}else{logger[_0x1966('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x10f862,_0x1966('0xc'));_0x4f8012(_0x48a1c7[_0x1966('0x13')][_0x1966('0x12')]);}})[_0x1966('0x14')](function(_0x3f7110){logger[_0x1966('0x10')](_0x1966('0xb'),_0x10f862,_0x3f7110);_0x12e4b8(_0x3f7110);});});} \ No newline at end of file +var _0x5906=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x596c83,_0x4e4879){var _0x4492d7=function(_0x2ac277){while(--_0x2ac277){_0x596c83['push'](_0x596c83['shift']());}};_0x4492d7(++_0x4e4879);}(_0x5906,0x1a6));var _0x6590=function(_0x25ab50,_0x109456){_0x25ab50=_0x25ab50-0x0;var _0x4de849=_0x5906[_0x25ab50];return _0x4de849;};'use strict';var _=require(_0x6590('0x0'));var util=require(_0x6590('0x1'));var moment=require('moment');var BPromise=require(_0x6590('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6590('0x3'));var db=require(_0x6590('0x4'))['db'];var utils=require(_0x6590('0x5'));var logger=require('../../config/logger')(_0x6590('0x6'));var config=require('../../config/environment');var jayson=require(_0x6590('0x7'));var client=jayson[_0x6590('0x8')][_0x6590('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x565f2d,_0x5a2503,_0x139bc7){return new BPromise(function(_0x11abd4,_0x49307e){return client['request'](_0x565f2d,_0x139bc7)['then'](function(_0xe0157f){logger[_0x6590('0xa')](_0x6590('0xb'),_0x5a2503,_0x6590('0xc'));logger['debug'](_0x6590('0xd'),_0x5a2503,_0x6590('0xc'),JSON[_0x6590('0xe')](_0xe0157f));if(_0xe0157f[_0x6590('0xf')]){if(_0xe0157f[_0x6590('0xf')][_0x6590('0x10')]===0x1f4){logger['error'](_0x6590('0xb'),_0x5a2503,_0xe0157f[_0x6590('0xf')][_0x6590('0x11')]);return _0x49307e(_0xe0157f[_0x6590('0xf')]['message']);}logger[_0x6590('0xf')](_0x6590('0xb'),_0x5a2503,_0xe0157f[_0x6590('0xf')][_0x6590('0x11')]);return _0x11abd4(_0xe0157f['error'][_0x6590('0x11')]);}else{logger['info'](_0x6590('0xb'),_0x5a2503,_0x6590('0xc'));_0x11abd4(_0xe0157f[_0x6590('0x12')][_0x6590('0x11')]);}})[_0x6590('0x13')](function(_0x3a42ce){logger[_0x6590('0xf')](_0x6590('0xb'),_0x5a2503,_0x3a42ce);_0x49307e(_0x3a42ce);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f31f991..65b626a 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 _0xa630=['multer','util','express','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','post','create','put','delete','destroy'];(function(_0x10f57a,_0x27b8cc){var _0x4ad64f=function(_0x5bd953){while(--_0x5bd953){_0x10f57a['push'](_0x10f57a['shift']());}};_0x4ad64f(++_0x27b8cc);}(_0xa630,0xbe));var _0x0a63=function(_0x5b6e08,_0x849307){_0x5b6e08=_0x5b6e08-0x0;var _0x4600a6=_0xa630[_0x5b6e08];return _0x4600a6;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var auth=require(_0x0a63('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a63('0x4'));var controller=require(_0x0a63('0x5'));router[_0x0a63('0x6')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0x8')]);router['get'](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x6')](_0x0a63('0xb'),auth[_0x0a63('0x7')](),controller['show']);router[_0x0a63('0x6')](_0x0a63('0xc'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xd')]);router[_0x0a63('0xe')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0xf')]);router[_0x0a63('0x10')](_0x0a63('0xb'),auth[_0x0a63('0x7')](),controller['update']);router[_0x0a63('0x11')](_0x0a63('0xb'),auth[_0x0a63('0x7')](),controller[_0x0a63('0x12')]);module['exports']=router; \ No newline at end of file +var _0x089f=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','describe','show','/:id/questions','getQuestions','create','put','update','destroy','util'];(function(_0x332099,_0x4bc949){var _0x2e4026=function(_0x4243c7){while(--_0x4243c7){_0x332099['push'](_0x332099['shift']());}};_0x2e4026(++_0x4bc949);}(_0x089f,0x1c7));var _0xf089=function(_0x16ab43,_0x4d8561){_0x16ab43=_0x16ab43-0x0;var _0x2ff094=_0x089f[_0x16ab43];return _0x2ff094;};'use strict';var multer=require('multer');var util=require(_0xf089('0x0'));var path=require(_0xf089('0x1'));var timeout=require(_0xf089('0x2'));var express=require(_0xf089('0x3'));var router=express[_0xf089('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf089('0x5'));var config=require(_0xf089('0x6'));var controller=require(_0xf089('0x7'));router['get']('/',auth[_0xf089('0x8')](),controller[_0xf089('0x9')]);router[_0xf089('0xa')]('/describe',auth[_0xf089('0x8')](),controller[_0xf089('0xb')]);router[_0xf089('0xa')]('/:id',auth[_0xf089('0x8')](),controller[_0xf089('0xc')]);router[_0xf089('0xa')](_0xf089('0xd'),auth[_0xf089('0x8')](),controller[_0xf089('0xe')]);router['post']('/',auth[_0xf089('0x8')](),controller[_0xf089('0xf')]);router[_0xf089('0x10')]('/:id',auth[_0xf089('0x8')](),controller[_0xf089('0x11')]);router['delete']('/:id',auth[_0xf089('0x8')](),controller[_0xf089('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 01c1e74..7a99bd7 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 _0xacfd=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE','setDataValue','starttime'];(function(_0x552158,_0x29aff2){var _0x38a2df=function(_0x5dc31a){while(--_0x5dc31a){_0x552158['push'](_0x552158['shift']());}};_0x38a2df(++_0x29aff2);}(_0xacfd,0x8b));var _0xdacf=function(_0x3359fa,_0x2c05f5){_0x3359fa=_0x3359fa-0x0;var _0x15a3e6=_0xacfd[_0x3359fa];return _0x15a3e6;};'use strict';var moment=require(_0xdacf('0x0'));var Sequelize=require(_0xdacf('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xdacf('0x2')],'set':function(_0x5d08cc){this[_0xdacf('0x3')](_0xdacf('0x4'),_0x5d08cc);this[_0xdacf('0x3')](_0xdacf('0x5'),moment()[_0xdacf('0x6')](_0xdacf('0x7')));}},'endtime':{'type':Sequelize[_0xdacf('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdacf('0x8')]},'queue':{'type':Sequelize[_0xdacf('0x8')]},'uniqueid':{'type':Sequelize[_0xdacf('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0ef3=['STRING','BOOLEAN','moment','exports','DATE','setDataValue','starttime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x0ef3,0xaa));var _0x30ef=function(_0x2f7048,_0x27bf94){_0x2f7048=_0x2f7048-0x0;var _0x5e1499=_0x0ef3[_0x2f7048];return _0x5e1499;};'use strict';var moment=require(_0x30ef('0x0'));var Sequelize=require('sequelize');module[_0x30ef('0x1')]={'starttime':{'type':Sequelize[_0x30ef('0x2')],'set':function(_0x4d0809){this[_0x30ef('0x3')](_0x30ef('0x4'),_0x4d0809);this[_0x30ef('0x3')]('endtime',moment()['format'](_0x30ef('0x5')));}},'endtime':{'type':Sequelize[_0x30ef('0x2')]},'membername':{'type':Sequelize[_0x30ef('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x30ef('0x6')]},'uniqueid':{'type':Sequelize[_0x30ef('0x6')]},'calleridname':{'type':Sequelize[_0x30ef('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x30ef('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5b0740f..a7be73c 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 _0xc04f=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','JscriptySessionReport','rawAttributes','keys','filters','attributes','intersection','fields','model','query','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','length','find','update','body','params','describe','getQuestions','JscriptyQuestionReport','order','SessionId','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x52aed9,_0x3cfbf7){var _0x645c6f=function(_0x28b35e){while(--_0x28b35e){_0x52aed9['push'](_0x52aed9['shift']());}};_0x645c6f(++_0x3cfbf7);}(_0xc04f,0x125));var _0xfc04=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0xc04f[_0xe15270];return _0x1e813b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc04('0x0'));var rimraf=require(_0xfc04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc04('0x2'));var rp=require(_0xfc04('0x3'));var moment=require(_0xfc04('0x4'));var BPromise=require(_0xfc04('0x5'));var Mustache=require(_0xfc04('0x6'));var util=require(_0xfc04('0x7'));var path=require('path');var sox=require(_0xfc04('0x8'));var csv=require(_0xfc04('0x9'));var ejs=require(_0xfc04('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc04('0xb'));var crypto=require(_0xfc04('0xc'));var jsforce=require(_0xfc04('0xd'));var deskjs=require(_0xfc04('0xe'));var toCsv=require(_0xfc04('0x9'));var querystring=require('querystring');var Papa=require(_0xfc04('0xf'));var Redis=require(_0xfc04('0x10'));var authService=require(_0xfc04('0x11'));var qs=require(_0xfc04('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc04('0x13'))(_0xfc04('0x14'));var utils=require(_0xfc04('0x15'));var config=require(_0xfc04('0x16'));var db=require(_0xfc04('0x17'))['db'];function respondWithStatusCode(_0x4690fc,_0x14982){_0x14982=_0x14982||0xcc;return function(_0x2a25ae){if(_0x2a25ae){return _0x4690fc[_0xfc04('0x18')](_0x14982);}return _0x4690fc[_0xfc04('0x19')](_0x14982)[_0xfc04('0x1a')]();};}function respondWithResult(_0x439e90,_0x4566f8){_0x4566f8=_0x4566f8||0xc8;return function(_0x39e5eb){if(_0x39e5eb){return _0x439e90[_0xfc04('0x19')](_0x4566f8)['json'](_0x39e5eb);}};}function respondWithFilteredResult(_0x3cea75,_0x9dadb9){return function(_0x581ab6){if(_0x581ab6){var _0x35449c=_0x581ab6[_0xfc04('0x1b')],_0x4498a4=_0x9dadb9[_0xfc04('0x1c')],_0x2f9735=_0x9dadb9[_0xfc04('0x1c')]+_0x9dadb9[_0xfc04('0x1d')],_0x444d93;if(_0x2f9735>=_0x35449c){_0x2f9735=_0x35449c;_0x444d93=0xc8;}else{_0x444d93=0xce;}_0x3cea75[_0xfc04('0x19')](_0x444d93);return _0x3cea75[_0xfc04('0x1e')](_0xfc04('0x1f'),_0x4498a4+'-'+_0x2f9735+'/'+_0x35449c)[_0xfc04('0x20')](_0x581ab6);}return null;};}function patchUpdates(_0x487d35){return function(_0x5076f4){try{jsonpatch['apply'](_0x5076f4,_0x487d35,!![]);}catch(_0x1b852b){return BPromise[_0xfc04('0x21')](_0x1b852b);}return _0x5076f4[_0xfc04('0x22')]();};}function saveUpdates(_0x1bd683,_0x37e4cf){return function(_0x29bd74){if(_0x29bd74){return _0x29bd74['update'](_0x1bd683)['then'](function(_0x1629ae){return _0x1629ae;});}return null;};}function removeEntity(_0x323c94,_0x56c2b1){return function(_0x37bf29){if(_0x37bf29){return _0x37bf29[_0xfc04('0x23')]()[_0xfc04('0x24')](function(){_0x323c94[_0xfc04('0x19')](0xcc)[_0xfc04('0x1a')]();});}};}function handleEntityNotFound(_0x14e6c8,_0x1927f7){return function(_0x1d1499){if(!_0x1d1499){_0x14e6c8[_0xfc04('0x18')](0x194);}return _0x1d1499;};}function handleError(_0x897311,_0x10ec0f){_0x10ec0f=_0x10ec0f||0x1f4;return function(_0x1ec99c){logger[_0xfc04('0x25')](_0x1ec99c[_0xfc04('0x26')]);if(_0x1ec99c[_0xfc04('0x27')]){delete _0x1ec99c[_0xfc04('0x27')];}_0x897311[_0xfc04('0x19')](_0x10ec0f)[_0xfc04('0x28')](_0x1ec99c);};}exports[_0xfc04('0x29')]=function(_0x587201,_0x5b51c0){var _0x512f00={},_0x5ee8f4={},_0x40e16c={'count':0x0,'rows':[]};var _0x175c79=db[_0xfc04('0x2a')][_0xfc04('0x2b')];_0x5ee8f4['model']=_[_0xfc04('0x2c')](_0x175c79);_0x5ee8f4['query']=_[_0xfc04('0x2c')](_0x587201['query']);_0x5ee8f4[_0xfc04('0x2d')]=_['intersection'](_0x5ee8f4['model'],_0x5ee8f4['query']);_0x512f00[_0xfc04('0x2e')]=_[_0xfc04('0x2f')](_0x5ee8f4['model'],qs[_0xfc04('0x30')](_0x587201['query'][_0xfc04('0x30')]));_0x512f00[_0xfc04('0x2e')]=_0x512f00[_0xfc04('0x2e')]['length']?_0x512f00[_0xfc04('0x2e')]:_0x5ee8f4[_0xfc04('0x31')];if(!_0x587201[_0xfc04('0x32')][_0xfc04('0x33')](_0xfc04('0x34'))){_0x512f00['limit']=qs[_0xfc04('0x1d')](_0x587201[_0xfc04('0x32')]['limit']);_0x512f00[_0xfc04('0x1c')]=qs[_0xfc04('0x1c')](_0x587201[_0xfc04('0x32')][_0xfc04('0x1c')]);}_0x512f00['order']=qs[_0xfc04('0x35')](_0x587201['query'][_0xfc04('0x35')]);_0x512f00['where']=qs[_0xfc04('0x2d')](_[_0xfc04('0x36')](_0x587201['query'],_0x5ee8f4['filters']));if(_0x587201[_0xfc04('0x32')][_0xfc04('0x37')]){_0x512f00[_0xfc04('0x38')]=_[_0xfc04('0x39')](_0x512f00[_0xfc04('0x38')],{'$or':_[_0xfc04('0x3a')](_0x175c79,function(_0x29246c){if(_0x29246c[_0xfc04('0x3b')][_0xfc04('0x3c')]!==_0xfc04('0x3d')){var _0x57454b={};_0x57454b[_0x29246c['field']]={'$like':'%'+_0x587201[_0xfc04('0x32')][_0xfc04('0x37')]+'%'};return _0x57454b;}})});}_0x512f00=_['merge']({},_0x512f00,_0x587201[_0xfc04('0x3e')]);var _0x2d1f16={'where':_0x512f00[_0xfc04('0x38')]};return db[_0xfc04('0x2a')][_0xfc04('0x1b')](_0x2d1f16)[_0xfc04('0x24')](function(_0x448b78){_0x40e16c[_0xfc04('0x1b')]=_0x448b78;if(_0x587201[_0xfc04('0x32')][_0xfc04('0x3f')]){_0x512f00[_0xfc04('0x40')]=[{'all':!![]}];}return db[_0xfc04('0x2a')]['findAll'](_0x512f00);})[_0xfc04('0x24')](function(_0x51e01a){_0x40e16c[_0xfc04('0x41')]=_0x51e01a;return _0x40e16c;})['then'](respondWithFilteredResult(_0x5b51c0,_0x512f00))[_0xfc04('0x42')](handleError(_0x5b51c0,null));};exports[_0xfc04('0x43')]=function(_0xf3e251,_0x2012f4){var _0x53046b={'raw':!![],'where':{'id':_0xf3e251['params']['id']}},_0x3d0f83={};_0x3d0f83[_0xfc04('0x31')]=_['keys'](db[_0xfc04('0x2a')][_0xfc04('0x2b')]);_0x3d0f83[_0xfc04('0x32')]=_[_0xfc04('0x2c')](_0xf3e251[_0xfc04('0x32')]);_0x3d0f83[_0xfc04('0x2d')]=_[_0xfc04('0x2f')](_0x3d0f83[_0xfc04('0x31')],_0x3d0f83['query']);_0x53046b['attributes']=_[_0xfc04('0x2f')](_0x3d0f83['model'],qs['fields'](_0xf3e251[_0xfc04('0x32')][_0xfc04('0x30')]));_0x53046b['attributes']=_0x53046b[_0xfc04('0x2e')][_0xfc04('0x44')]?_0x53046b['attributes']:_0x3d0f83[_0xfc04('0x31')];if(_0xf3e251[_0xfc04('0x32')][_0xfc04('0x3f')]){_0x53046b['include']=[{'all':!![]}];}_0x53046b=_[_0xfc04('0x39')]({},_0x53046b,_0xf3e251[_0xfc04('0x3e')]);return db[_0xfc04('0x2a')][_0xfc04('0x45')](_0x53046b)[_0xfc04('0x24')](handleEntityNotFound(_0x2012f4,null))[_0xfc04('0x24')](respondWithResult(_0x2012f4,null))['catch'](handleError(_0x2012f4,null));};exports['create']=function(_0x93099d,_0x4f6a16){return db[_0xfc04('0x2a')]['create'](_0x93099d['body'],{})[_0xfc04('0x24')](respondWithResult(_0x4f6a16,0xc9))[_0xfc04('0x42')](handleError(_0x4f6a16,null));};exports[_0xfc04('0x46')]=function(_0x215115,_0x32a191){if(_0x215115[_0xfc04('0x47')]['id']){delete _0x215115[_0xfc04('0x47')]['id'];}return db[_0xfc04('0x2a')][_0xfc04('0x45')]({'where':{'id':_0x215115[_0xfc04('0x48')]['id']}})[_0xfc04('0x24')](handleEntityNotFound(_0x32a191,null))['then'](saveUpdates(_0x215115[_0xfc04('0x47')],null))[_0xfc04('0x24')](respondWithResult(_0x32a191,null))[_0xfc04('0x42')](handleError(_0x32a191,null));};exports['destroy']=function(_0x4df139,_0x1a9164){return db[_0xfc04('0x2a')]['find']({'where':{'id':_0x4df139['params']['id']}})[_0xfc04('0x24')](handleEntityNotFound(_0x1a9164,null))[_0xfc04('0x24')](removeEntity(_0x1a9164,null))[_0xfc04('0x42')](handleError(_0x1a9164,null));};exports[_0xfc04('0x49')]=function(_0x5e17a8,_0x411257){return db[_0xfc04('0x2a')][_0xfc04('0x49')]()['then'](respondWithResult(_0x411257,null))[_0xfc04('0x42')](handleError(_0x411257,null));};exports[_0xfc04('0x4a')]=function(_0x1ad907,_0x5f3a89,_0x4447cd){var _0x20ad60={'raw':!![],'where':{}};var _0xedd9df={};var _0x43c16f={'count':0x0,'rows':[]};return db[_0xfc04('0x2a')]['findOne']({'where':{'id':_0x1ad907['params']['id']}})[_0xfc04('0x24')](handleEntityNotFound(_0x5f3a89,null))[_0xfc04('0x24')](function(_0x1852bc){if(_0x1852bc){_0xedd9df['model']=_[_0xfc04('0x2c')](db[_0xfc04('0x4b')][_0xfc04('0x2b')]);_0xedd9df[_0xfc04('0x32')]=_[_0xfc04('0x2c')](_0x1ad907[_0xfc04('0x32')]);_0xedd9df[_0xfc04('0x2d')]=_[_0xfc04('0x2f')](_0xedd9df[_0xfc04('0x31')],_0xedd9df['query']);_0x20ad60[_0xfc04('0x2e')]=_[_0xfc04('0x2f')](_0xedd9df['model'],qs[_0xfc04('0x30')](_0x1ad907[_0xfc04('0x32')]['fields']));_0x20ad60[_0xfc04('0x2e')]=_0x20ad60[_0xfc04('0x2e')][_0xfc04('0x44')]?_0x20ad60['attributes']:_0xedd9df[_0xfc04('0x31')];if(!_0x1ad907[_0xfc04('0x32')]['hasOwnProperty'](_0xfc04('0x34'))){_0x20ad60[_0xfc04('0x1d')]=qs[_0xfc04('0x1d')](_0x1ad907[_0xfc04('0x32')][_0xfc04('0x1d')]);_0x20ad60['offset']=qs[_0xfc04('0x1c')](_0x1ad907['query'][_0xfc04('0x1c')]);}_0x20ad60[_0xfc04('0x4c')]=qs['sort'](_0x1ad907[_0xfc04('0x32')][_0xfc04('0x35')]);_0x20ad60[_0xfc04('0x38')]=qs[_0xfc04('0x2d')](_[_0xfc04('0x36')](_0x1ad907[_0xfc04('0x32')],_0xedd9df[_0xfc04('0x2d')]));_0x20ad60['where'][_0xfc04('0x4d')]=_0x1852bc['id'];if(_0x1ad907[_0xfc04('0x32')][_0xfc04('0x37')]){_0x20ad60['where']=_[_0xfc04('0x39')](_0x20ad60[_0xfc04('0x38')],{'$or':_[_0xfc04('0x3a')](_0x20ad60[_0xfc04('0x2e')],function(_0x140e5e){var _0x1c500f={};_0x1c500f[_0x140e5e]={'$like':'%'+_0x1ad907['query'][_0xfc04('0x37')]+'%'};return _0x1c500f;})});}_0x20ad60=_[_0xfc04('0x39')]({},_0x20ad60,_0x1ad907[_0xfc04('0x3e')]);return db[_0xfc04('0x4b')][_0xfc04('0x1b')]({'where':_0x20ad60[_0xfc04('0x38')]})[_0xfc04('0x24')](function(_0xc816f9){_0x43c16f[_0xfc04('0x1b')]=_0xc816f9;if(_0x1ad907[_0xfc04('0x32')][_0xfc04('0x3f')]){_0x20ad60[_0xfc04('0x40')]=[{'all':!![]}];}return db[_0xfc04('0x4b')][_0xfc04('0x4e')](_0x20ad60);})['then'](function(_0x158d94){_0x43c16f[_0xfc04('0x41')]=_0x158d94;return _0x43c16f;});}})['then'](respondWithFilteredResult(_0x5f3a89,_0x20ad60))[_0xfc04('0x42')](handleError(_0x5f3a89,null));}; \ No newline at end of file +var _0x331a=['type','key','VIRTUAL','field','merge','options','include','findAll','rows','show','params','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','includeAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','JscriptySessionReport','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x28c68a,_0x24e97e){var _0x307763=function(_0x45ed78){while(--_0x45ed78){_0x28c68a['push'](_0x28c68a['shift']());}};_0x307763(++_0x24e97e);}(_0x331a,0x65));var _0xa331=function(_0x1b1f60,_0x362a0b){_0x1b1f60=_0x1b1f60-0x0;var _0x1a0e79=_0x331a[_0x1b1f60];return _0x1a0e79;};'use strict';var pdf=require(_0xa331('0x0'));var emlformat=require(_0xa331('0x1'));var rimraf=require(_0xa331('0x2'));var zipdir=require(_0xa331('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa331('0x4'));var moment=require(_0xa331('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa331('0x6'));var util=require(_0xa331('0x7'));var path=require(_0xa331('0x8'));var sox=require(_0xa331('0x9'));var csv=require(_0xa331('0xa'));var ejs=require(_0xa331('0xb'));var fs=require('fs');var _=require(_0xa331('0xc'));var squel=require(_0xa331('0xd'));var crypto=require('crypto');var jsforce=require(_0xa331('0xe'));var deskjs=require(_0xa331('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa331('0x10'));var Papa=require(_0xa331('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa331('0x12'));var hardwareService=require(_0xa331('0x13'));var logger=require('../../config/logger')(_0xa331('0x14'));var utils=require(_0xa331('0x15'));var config=require('../../config/environment');var db=require(_0xa331('0x16'))['db'];function respondWithStatusCode(_0x39e0af,_0xeee470){_0xeee470=_0xeee470||0xcc;return function(_0x311afa){if(_0x311afa){return _0x39e0af[_0xa331('0x17')](_0xeee470);}return _0x39e0af[_0xa331('0x18')](_0xeee470)[_0xa331('0x19')]();};}function respondWithResult(_0x4f6723,_0x5a0ade){_0x5a0ade=_0x5a0ade||0xc8;return function(_0x361326){if(_0x361326){return _0x4f6723[_0xa331('0x18')](_0x5a0ade)[_0xa331('0x1a')](_0x361326);}};}function respondWithFilteredResult(_0x584fd8,_0x287ccf){return function(_0x38ebb4){if(_0x38ebb4){var _0x158c7c=_0x38ebb4[_0xa331('0x1b')],_0x291ea4=_0x287ccf[_0xa331('0x1c')],_0x5e9bc2=_0x287ccf[_0xa331('0x1c')]+_0x287ccf[_0xa331('0x1d')],_0x2108e9;if(_0x5e9bc2>=_0x158c7c){_0x5e9bc2=_0x158c7c;_0x2108e9=0xc8;}else{_0x2108e9=0xce;}_0x584fd8[_0xa331('0x18')](_0x2108e9);return _0x584fd8[_0xa331('0x1e')](_0xa331('0x1f'),_0x291ea4+'-'+_0x5e9bc2+'/'+_0x158c7c)[_0xa331('0x1a')](_0x38ebb4);}return null;};}function patchUpdates(_0x46632e){return function(_0x3c454d){try{jsonpatch[_0xa331('0x20')](_0x3c454d,_0x46632e,!![]);}catch(_0x383c25){return BPromise[_0xa331('0x21')](_0x383c25);}return _0x3c454d['save']();};}function saveUpdates(_0x1f991e,_0x21c48c){return function(_0x269fb7){if(_0x269fb7){return _0x269fb7[_0xa331('0x22')](_0x1f991e)[_0xa331('0x23')](function(_0x6c9348){return _0x6c9348;});}return null;};}function removeEntity(_0x59a15b,_0x20fb2c){return function(_0x265e14){if(_0x265e14){return _0x265e14[_0xa331('0x24')]()[_0xa331('0x23')](function(){_0x59a15b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5778a9,_0x471fdf){return function(_0x1dca2d){if(!_0x1dca2d){_0x5778a9[_0xa331('0x17')](0x194);}return _0x1dca2d;};}function handleError(_0x16dcd2,_0x383c39){_0x383c39=_0x383c39||0x1f4;return function(_0x13b8d8){logger[_0xa331('0x25')](_0x13b8d8[_0xa331('0x26')]);if(_0x13b8d8['name']){delete _0x13b8d8[_0xa331('0x27')];}_0x16dcd2[_0xa331('0x18')](_0x383c39)[_0xa331('0x28')](_0x13b8d8);};}exports[_0xa331('0x29')]=function(_0x471f24,_0xc60189){var _0xe8ee36={},_0x3ef98d={},_0x53fb62={'count':0x0,'rows':[]};var _0x53d62f=db[_0xa331('0x2a')][_0xa331('0x2b')];_0x3ef98d[_0xa331('0x2c')]=_['keys'](_0x53d62f);_0x3ef98d[_0xa331('0x2d')]=_[_0xa331('0x2e')](_0x471f24['query']);_0x3ef98d[_0xa331('0x2f')]=_[_0xa331('0x30')](_0x3ef98d[_0xa331('0x2c')],_0x3ef98d[_0xa331('0x2d')]);_0xe8ee36['attributes']=_[_0xa331('0x30')](_0x3ef98d['model'],qs[_0xa331('0x31')](_0x471f24[_0xa331('0x2d')]['fields']));_0xe8ee36[_0xa331('0x32')]=_0xe8ee36[_0xa331('0x32')][_0xa331('0x33')]?_0xe8ee36['attributes']:_0x3ef98d[_0xa331('0x2c')];if(!_0x471f24[_0xa331('0x2d')][_0xa331('0x34')](_0xa331('0x35'))){_0xe8ee36['limit']=qs['limit'](_0x471f24[_0xa331('0x2d')][_0xa331('0x1d')]);_0xe8ee36[_0xa331('0x1c')]=qs[_0xa331('0x1c')](_0x471f24['query'][_0xa331('0x1c')]);}_0xe8ee36[_0xa331('0x36')]=qs['sort'](_0x471f24[_0xa331('0x2d')][_0xa331('0x37')]);_0xe8ee36[_0xa331('0x38')]=qs[_0xa331('0x2f')](_[_0xa331('0x39')](_0x471f24[_0xa331('0x2d')],_0x3ef98d[_0xa331('0x2f')]));if(_0x471f24['query'][_0xa331('0x3a')]){_0xe8ee36[_0xa331('0x38')]=_['merge'](_0xe8ee36[_0xa331('0x38')],{'$or':_['map'](_0x53d62f,function(_0x4d4a50){if(_0x4d4a50[_0xa331('0x3b')][_0xa331('0x3c')]!==_0xa331('0x3d')){var _0x57dd88={};_0x57dd88[_0x4d4a50[_0xa331('0x3e')]]={'$like':'%'+_0x471f24[_0xa331('0x2d')][_0xa331('0x3a')]+'%'};return _0x57dd88;}})});}_0xe8ee36=_[_0xa331('0x3f')]({},_0xe8ee36,_0x471f24[_0xa331('0x40')]);var _0x4bbbf6={'where':_0xe8ee36['where']};return db[_0xa331('0x2a')][_0xa331('0x1b')](_0x4bbbf6)[_0xa331('0x23')](function(_0x30fd4a){_0x53fb62[_0xa331('0x1b')]=_0x30fd4a;if(_0x471f24[_0xa331('0x2d')]['includeAll']){_0xe8ee36[_0xa331('0x41')]=[{'all':!![]}];}return db[_0xa331('0x2a')][_0xa331('0x42')](_0xe8ee36);})[_0xa331('0x23')](function(_0x236374){_0x53fb62[_0xa331('0x43')]=_0x236374;return _0x53fb62;})[_0xa331('0x23')](respondWithFilteredResult(_0xc60189,_0xe8ee36))['catch'](handleError(_0xc60189,null));};exports[_0xa331('0x44')]=function(_0x266ae6,_0x37edde){var _0x28ab50={'raw':!![],'where':{'id':_0x266ae6[_0xa331('0x45')]['id']}},_0x5292fc={};_0x5292fc[_0xa331('0x2c')]=_[_0xa331('0x2e')](db[_0xa331('0x2a')][_0xa331('0x2b')]);_0x5292fc[_0xa331('0x2d')]=_[_0xa331('0x2e')](_0x266ae6[_0xa331('0x2d')]);_0x5292fc['filters']=_[_0xa331('0x30')](_0x5292fc[_0xa331('0x2c')],_0x5292fc['query']);_0x28ab50[_0xa331('0x32')]=_['intersection'](_0x5292fc[_0xa331('0x2c')],qs[_0xa331('0x31')](_0x266ae6[_0xa331('0x2d')]['fields']));_0x28ab50['attributes']=_0x28ab50[_0xa331('0x32')][_0xa331('0x33')]?_0x28ab50[_0xa331('0x32')]:_0x5292fc['model'];if(_0x266ae6[_0xa331('0x2d')]['includeAll']){_0x28ab50[_0xa331('0x41')]=[{'all':!![]}];}_0x28ab50=_[_0xa331('0x3f')]({},_0x28ab50,_0x266ae6[_0xa331('0x40')]);return db[_0xa331('0x2a')][_0xa331('0x46')](_0x28ab50)['then'](handleEntityNotFound(_0x37edde,null))[_0xa331('0x23')](respondWithResult(_0x37edde,null))[_0xa331('0x47')](handleError(_0x37edde,null));};exports[_0xa331('0x48')]=function(_0x286e78,_0x298b79){return db[_0xa331('0x2a')]['create'](_0x286e78['body'],{})['then'](respondWithResult(_0x298b79,0xc9))[_0xa331('0x47')](handleError(_0x298b79,null));};exports[_0xa331('0x22')]=function(_0x2ae35c,_0x64876e){if(_0x2ae35c['body']['id']){delete _0x2ae35c[_0xa331('0x49')]['id'];}return db[_0xa331('0x2a')][_0xa331('0x46')]({'where':{'id':_0x2ae35c[_0xa331('0x45')]['id']}})[_0xa331('0x23')](handleEntityNotFound(_0x64876e,null))[_0xa331('0x23')](saveUpdates(_0x2ae35c[_0xa331('0x49')],null))[_0xa331('0x23')](respondWithResult(_0x64876e,null))[_0xa331('0x47')](handleError(_0x64876e,null));};exports[_0xa331('0x24')]=function(_0x3afbbe,_0x38c87e){return db['JscriptySessionReport'][_0xa331('0x46')]({'where':{'id':_0x3afbbe[_0xa331('0x45')]['id']}})[_0xa331('0x23')](handleEntityNotFound(_0x38c87e,null))[_0xa331('0x23')](removeEntity(_0x38c87e,null))[_0xa331('0x47')](handleError(_0x38c87e,null));};exports[_0xa331('0x4a')]=function(_0x22c589,_0x5add68){return db[_0xa331('0x2a')][_0xa331('0x4a')]()['then'](respondWithResult(_0x5add68,null))[_0xa331('0x47')](handleError(_0x5add68,null));};exports[_0xa331('0x4b')]=function(_0x41bb0c,_0x3d6bee,_0x4fe8bd){var _0x2709be={'raw':!![],'where':{}};var _0x55804d={};var _0x4e5d9e={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xa331('0x4c')]({'where':{'id':_0x41bb0c['params']['id']}})[_0xa331('0x23')](handleEntityNotFound(_0x3d6bee,null))[_0xa331('0x23')](function(_0x234ef1){if(_0x234ef1){_0x55804d[_0xa331('0x2c')]=_['keys'](db[_0xa331('0x4d')]['rawAttributes']);_0x55804d[_0xa331('0x2d')]=_[_0xa331('0x2e')](_0x41bb0c['query']);_0x55804d['filters']=_[_0xa331('0x30')](_0x55804d[_0xa331('0x2c')],_0x55804d[_0xa331('0x2d')]);_0x2709be[_0xa331('0x32')]=_[_0xa331('0x30')](_0x55804d[_0xa331('0x2c')],qs['fields'](_0x41bb0c[_0xa331('0x2d')][_0xa331('0x31')]));_0x2709be[_0xa331('0x32')]=_0x2709be[_0xa331('0x32')][_0xa331('0x33')]?_0x2709be[_0xa331('0x32')]:_0x55804d[_0xa331('0x2c')];if(!_0x41bb0c[_0xa331('0x2d')][_0xa331('0x34')](_0xa331('0x35'))){_0x2709be[_0xa331('0x1d')]=qs[_0xa331('0x1d')](_0x41bb0c[_0xa331('0x2d')]['limit']);_0x2709be[_0xa331('0x1c')]=qs[_0xa331('0x1c')](_0x41bb0c[_0xa331('0x2d')][_0xa331('0x1c')]);}_0x2709be[_0xa331('0x36')]=qs[_0xa331('0x37')](_0x41bb0c[_0xa331('0x2d')][_0xa331('0x37')]);_0x2709be['where']=qs['filters'](_[_0xa331('0x39')](_0x41bb0c[_0xa331('0x2d')],_0x55804d['filters']));_0x2709be[_0xa331('0x38')][_0xa331('0x4e')]=_0x234ef1['id'];if(_0x41bb0c[_0xa331('0x2d')][_0xa331('0x3a')]){_0x2709be['where']=_[_0xa331('0x3f')](_0x2709be[_0xa331('0x38')],{'$or':_['map'](_0x2709be[_0xa331('0x32')],function(_0x3bc4f4){var _0x453e6c={};_0x453e6c[_0x3bc4f4]={'$like':'%'+_0x41bb0c['query'][_0xa331('0x3a')]+'%'};return _0x453e6c;})});}_0x2709be=_[_0xa331('0x3f')]({},_0x2709be,_0x41bb0c[_0xa331('0x40')]);return db['JscriptyQuestionReport'][_0xa331('0x1b')]({'where':_0x2709be[_0xa331('0x38')]})['then'](function(_0x5c3f03){_0x4e5d9e[_0xa331('0x1b')]=_0x5c3f03;if(_0x41bb0c[_0xa331('0x2d')][_0xa331('0x4f')]){_0x2709be[_0xa331('0x41')]=[{'all':!![]}];}return db[_0xa331('0x4d')][_0xa331('0x42')](_0x2709be);})[_0xa331('0x23')](function(_0x4bb681){_0x4e5d9e['rows']=_0x4bb681;return _0x4e5d9e;});}})['then'](respondWithFilteredResult(_0x3d6bee,_0x2709be))['catch'](handleError(_0x3d6bee,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a3b9b52..3f57f6b 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 _0x7809=['exports','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x1c9fee,_0x558750){var _0x14c82b=function(_0xeebefe){while(--_0xeebefe){_0x1c9fee['push'](_0x1c9fee['shift']());}};_0x14c82b(++_0x558750);}(_0x7809,0x92));var _0x9780=function(_0x4e734a,_0x4e07b8){_0x4e734a=_0x4e734a-0x0;var _0x34f5a2=_0x7809[_0x4e734a];return _0x34f5a2;};'use strict';var _=require(_0x9780('0x0'));var util=require(_0x9780('0x1'));var logger=require(_0x9780('0x2'))(_0x9780('0x3'));var moment=require(_0x9780('0x4'));var BPromise=require(_0x9780('0x5'));var rp=require(_0x9780('0x6'));var fs=require('fs');var path=require(_0x9780('0x7'));var rimraf=require('rimraf');var config=require(_0x9780('0x8'));var attributes=require(_0x9780('0x9'));module[_0x9780('0xa')]=function(_0x275cff,_0x30210f){return _0x275cff['define']('JscriptySessionReport',attributes,{'tableName':_0x9780('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d36=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','lodash'];(function(_0x5101f5,_0x16463e){var _0x56bf84=function(_0x321e63){while(--_0x321e63){_0x5101f5['push'](_0x5101f5['shift']());}};_0x56bf84(++_0x16463e);}(_0x7d36,0xfb));var _0x67d3=function(_0x56bcee,_0x2e97ea){_0x56bcee=_0x56bcee-0x0;var _0x5525a8=_0x7d36[_0x56bcee];return _0x5525a8;};'use strict';var _=require(_0x67d3('0x0'));var util=require(_0x67d3('0x1'));var logger=require(_0x67d3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x67d3('0x3'));var rp=require(_0x67d3('0x4'));var fs=require('fs');var path=require(_0x67d3('0x5'));var rimraf=require('rimraf');var config=require(_0x67d3('0x6'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x498299,_0x935d1d){return _0x498299['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 8e60d80..fe3548d 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 _0xfccf=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xfccf,0xaa));var _0xffcc=function(_0x56a31c,_0xd1b2e1){_0x56a31c=_0x56a31c-0x0;var _0x5a0a7b=_0xfccf[_0x56a31c];return _0x5a0a7b;};'use strict';var _=require(_0xffcc('0x0'));var util=require(_0xffcc('0x1'));var moment=require(_0xffcc('0x2'));var BPromise=require(_0xffcc('0x3'));var rs=require(_0xffcc('0x4'));var fs=require('fs');var Redis=require(_0xffcc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xffcc('0x6'))(_0xffcc('0x7'));var config=require(_0xffcc('0x8'));var jayson=require(_0xffcc('0x9'));var client=jayson[_0xffcc('0xa')][_0xffcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x229fe1,_0x3cf6b6,_0x5792b8){return new BPromise(function(_0x15e64c,_0x240dfe){return client['request'](_0x229fe1,_0x5792b8)[_0xffcc('0xc')](function(_0x3ceec5){logger['info'](_0xffcc('0xd'),_0x3cf6b6,_0xffcc('0xe'));logger[_0xffcc('0xf')](_0xffcc('0x10'),_0x3cf6b6,_0xffcc('0xe'),JSON[_0xffcc('0x11')](_0x3ceec5));if(_0x3ceec5[_0xffcc('0x12')]){if(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x13')]===0x1f4){logger[_0xffcc('0x12')](_0xffcc('0xd'),_0x3cf6b6,_0x3ceec5['error']['message']);return _0x240dfe(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x14')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x3cf6b6,_0x3ceec5[_0xffcc('0x12')]['message']);return _0x15e64c(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x14')]);}else{logger[_0xffcc('0x15')](_0xffcc('0xd'),_0x3cf6b6,'request\x20sent');_0x15e64c(_0x3ceec5[_0xffcc('0x16')][_0xffcc('0x14')]);}})[_0xffcc('0x17')](function(_0x1fc745){logger['error'](_0xffcc('0xd'),_0x3cf6b6,_0x1fc745);_0x240dfe(_0x1fc745);});});} \ No newline at end of file +var _0x2cbb=['../../config/logger','rpc','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x39cdb8,_0x15ee98){var _0x44bbc9=function(_0x395338){while(--_0x395338){_0x39cdb8['push'](_0x39cdb8['shift']());}};_0x44bbc9(++_0x15ee98);}(_0x2cbb,0x178));var _0xb2cb=function(_0x5167a4,_0x4ac437){_0x5167a4=_0x5167a4-0x0;var _0xba0081=_0x2cbb[_0x5167a4];return _0xba0081;};'use strict';var _=require(_0xb2cb('0x0'));var util=require(_0xb2cb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb2cb('0x2'));var fs=require('fs');var Redis=require(_0xb2cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb2cb('0x4'))(_0xb2cb('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2cb('0x6')][_0xb2cb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19e052,_0x4e4340,_0x3acf6c){return new BPromise(function(_0x44e7b1,_0x5577d3){return client['request'](_0x19e052,_0x3acf6c)[_0xb2cb('0x8')](function(_0x127fda){logger[_0xb2cb('0x9')](_0xb2cb('0xa'),_0x4e4340,_0xb2cb('0xb'));logger[_0xb2cb('0xc')](_0xb2cb('0xd'),_0x4e4340,_0xb2cb('0xb'),JSON[_0xb2cb('0xe')](_0x127fda));if(_0x127fda['error']){if(_0x127fda['error']['code']===0x1f4){logger[_0xb2cb('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x4e4340,_0x127fda[_0xb2cb('0xf')][_0xb2cb('0x10')]);return _0x5577d3(_0x127fda[_0xb2cb('0xf')][_0xb2cb('0x10')]);}logger[_0xb2cb('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x4e4340,_0x127fda[_0xb2cb('0xf')][_0xb2cb('0x10')]);return _0x44e7b1(_0x127fda[_0xb2cb('0xf')][_0xb2cb('0x10')]);}else{logger[_0xb2cb('0x9')](_0xb2cb('0xa'),_0x4e4340,_0xb2cb('0xb'));_0x44e7b1(_0x127fda[_0xb2cb('0x11')][_0xb2cb('0x10')]);}})[_0xb2cb('0x12')](function(_0x3982f9){logger[_0xb2cb('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x4e4340,_0x3982f9);_0x5577d3(_0x3982f9);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 356cff7..8aabe0b 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 _0x8d08=['index','put','isAuthenticated','update','path','express','Router','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x8d08,0xa9));var _0x88d0=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x8d08[_0x27bd2c];return _0x3784ea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x88d0('0x0'));var timeout=require('connect-timeout');var express=require(_0x88d0('0x1'));var router=express[_0x88d0('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x88d0('0x3'));var config=require(_0x88d0('0x4'));var controller=require(_0x88d0('0x5'));router[_0x88d0('0x6')]('/',controller[_0x88d0('0x7')]);router[_0x88d0('0x8')]('/:id',auth[_0x88d0('0x9')](),controller[_0x88d0('0xa')]);module['exports']=router; \ No newline at end of file +var _0xc1b5=['isAuthenticated','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc1b5,0x83));var _0x5c1b=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0xc1b5[_0x5e9876];return _0x576c48;};'use strict';var multer=require(_0x5c1b('0x0'));var util=require(_0x5c1b('0x1'));var path=require(_0x5c1b('0x2'));var timeout=require(_0x5c1b('0x3'));var express=require('express');var router=express[_0x5c1b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5c1b('0x5'));var config=require(_0x5c1b('0x6'));var controller=require(_0x5c1b('0x7'));router[_0x5c1b('0x8')]('/',controller[_0x5c1b('0x9')]);router[_0x5c1b('0xa')](_0x5c1b('0xb'),auth[_0x5c1b('0xc')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 72cc64b..b2c996e 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 _0xdc97=['exports','TEXT','STRING','sequelize'];(function(_0x2f11af,_0x2a1b3a){var _0x4b90e2=function(_0x2e9367){while(--_0x2e9367){_0x2f11af['push'](_0x2f11af['shift']());}};_0x4b90e2(++_0x2a1b3a);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1efa77,_0x49b9d3){_0x1efa77=_0x1efa77-0x0;var _0x513f03=_0xdc97[_0x1efa77];return _0x513f03;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'license':{'type':Sequelize[_0x7dc9('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7dc9('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f8a=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x4f2e75,_0x2d5cf3){var _0x816f18=function(_0xc9c670){while(--_0xc9c670){_0x4f2e75['push'](_0x4f2e75['shift']());}};_0x816f18(++_0x2d5cf3);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x53881f,_0x4f7cda){_0x53881f=_0x53881f-0x0;var _0x553a91=_0x3f8a[_0x53881f];return _0x553a91;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'license':{'type':Sequelize[_0xa3f8('0x2')]},'data1':{'type':Sequelize[_0xa3f8('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xa3f8('0x4')],'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 fa5aae0..d085f28 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 _0x39ec=['destroy','error','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','merge','options','getLicense','get','checkLicense','body','key','demo','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then'];(function(_0x150f93,_0x246337){var _0x187715=function(_0x27b999){while(--_0x27b999){_0x150f93['push'](_0x150f93['shift']());}};_0x187715(++_0x246337);}(_0x39ec,0x1b6));var _0xc39e=function(_0x405216,_0x20c30d){_0x405216=_0x405216-0x0;var _0x30ab0f=_0x39ec[_0x405216];return _0x30ab0f;};'use strict';var pdf=require(_0xc39e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc39e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc39e('0x2'));var rp=require(_0xc39e('0x3'));var moment=require(_0xc39e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc39e('0x5'));var util=require(_0xc39e('0x6'));var path=require('path');var sox=require(_0xc39e('0x7'));var csv=require(_0xc39e('0x8'));var ejs=require(_0xc39e('0x9'));var fs=require('fs');var _=require(_0xc39e('0xa'));var squel=require(_0xc39e('0xb'));var crypto=require(_0xc39e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc39e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc39e('0xe'));var Redis=require('ioredis');var authService=require(_0xc39e('0xf'));var qs=require(_0xc39e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc39e('0x11'))(_0xc39e('0x12'));var utils=require(_0xc39e('0x13'));var config=require('../../config/environment');var db=require(_0xc39e('0x14'))['db'];function respondWithStatusCode(_0x4f9209,_0x596083){_0x596083=_0x596083||0xcc;return function(_0x4dbad7){if(_0x4dbad7){return _0x4f9209[_0xc39e('0x15')](_0x596083);}return _0x4f9209[_0xc39e('0x16')](_0x596083)[_0xc39e('0x17')]();};}function respondWithResult(_0x280d2a,_0x6e9ce2){_0x6e9ce2=_0x6e9ce2||0xc8;return function(_0x4d18b2){if(_0x4d18b2){return _0x280d2a[_0xc39e('0x16')](_0x6e9ce2)['json'](_0x4d18b2);}};}function respondWithFilteredResult(_0xd833fa,_0x283c47){return function(_0x3c9f71){if(_0x3c9f71){var _0x1bba81=_0x3c9f71[_0xc39e('0x18')],_0x47d7a4=_0x283c47[_0xc39e('0x19')],_0x59236f=_0x283c47['offset']+_0x283c47[_0xc39e('0x1a')],_0x5b62e0;if(_0x59236f>=_0x1bba81){_0x59236f=_0x1bba81;_0x5b62e0=0xc8;}else{_0x5b62e0=0xce;}_0xd833fa['status'](_0x5b62e0);return _0xd833fa[_0xc39e('0x1b')](_0xc39e('0x1c'),_0x47d7a4+'-'+_0x59236f+'/'+_0x1bba81)[_0xc39e('0x1d')](_0x3c9f71);}return null;};}function patchUpdates(_0x551cfe){return function(_0x94cde9){try{jsonpatch[_0xc39e('0x1e')](_0x94cde9,_0x551cfe,!![]);}catch(_0x30b62f){return BPromise[_0xc39e('0x1f')](_0x30b62f);}return _0x94cde9['save']();};}function saveUpdates(_0x325a8f,_0x2ccfd0){return function(_0x57026f){if(_0x57026f){return _0x57026f[_0xc39e('0x20')](_0x325a8f)[_0xc39e('0x21')](function(_0x1947fd){return _0x1947fd;});}return null;};}function removeEntity(_0x2f96e8,_0x496215){return function(_0x6892a8){if(_0x6892a8){return _0x6892a8[_0xc39e('0x22')]()[_0xc39e('0x21')](function(){_0x2f96e8[_0xc39e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x200a78,_0x5cd563){return function(_0x408259){if(!_0x408259){_0x200a78[_0xc39e('0x15')](0x194);}return _0x408259;};}function handleError(_0x574f42,_0x479d1d){_0x479d1d=_0x479d1d||0x1f4;return function(_0x14d9f8){logger[_0xc39e('0x23')](_0x14d9f8[_0xc39e('0x24')]);if(_0x14d9f8[_0xc39e('0x25')]){delete _0x14d9f8[_0xc39e('0x25')];}_0x574f42['status'](_0x479d1d)[_0xc39e('0x26')](_0x14d9f8);};}var utilLicense=require(_0xc39e('0x27'));exports[_0xc39e('0x28')]=function(_0x3b9995,_0x220c1d){var _0x5aa2e9={'raw':!![],'where':{'id':0x1}},_0x405373={};_0x405373[_0xc39e('0x29')]=_[_0xc39e('0x2a')](db[_0xc39e('0x2b')][_0xc39e('0x2c')]);_0x405373[_0xc39e('0x2d')]=_[_0xc39e('0x2a')](_0x3b9995['query']);_0x405373[_0xc39e('0x2e')]=_['intersection'](_0x405373[_0xc39e('0x29')],_0x405373['query']);_0x5aa2e9[_0xc39e('0x2f')]=_[_0xc39e('0x30')](_0x405373['model'],qs[_0xc39e('0x31')](_0x3b9995['query'][_0xc39e('0x31')]));_0x5aa2e9[_0xc39e('0x2f')]=_0x5aa2e9[_0xc39e('0x2f')][_0xc39e('0x32')]?_0x5aa2e9[_0xc39e('0x2f')]:_0x405373[_0xc39e('0x29')];_0x5aa2e9=_[_0xc39e('0x33')]({},_0x5aa2e9,_0x3b9995[_0xc39e('0x34')]);return utilLicense[_0xc39e('0x35')](_0x5aa2e9)['then'](respondWithResult(_0x220c1d,null))['catch'](handleError(_0x220c1d,null));};exports[_0xc39e('0x20')]=function(_0x48c53f,_0x12cb52){if(_0x48c53f['body']['id']){delete _0x48c53f['body']['id'];}return db[_0xc39e('0x2b')]['find']({'where':{'id':_0x48c53f['params']['id']}})['then'](handleEntityNotFound(_0x12cb52,null))[_0xc39e('0x21')](function(_0x5574ad){var _0xdd78d2=_0x5574ad[_0xc39e('0x36')]({'plain':!![]});return utilLicense[_0xc39e('0x37')](_0xdd78d2,_0x48c53f[_0xc39e('0x38')][_0xc39e('0x39')]);})['then'](function(_0x506976){if(!_0x506976[_0xc39e('0x3a')]){return saveUpdates(_0x48c53f[_0xc39e('0x38')],null);}return _0x506976;})[_0xc39e('0x21')](respondWithResult(_0x12cb52,null))['catch'](handleError(_0x12cb52,null));}; \ No newline at end of file +var _0x33a7=['to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','getLicense','body','find','get','checkLicense','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','lodash','squel','crypto','desk.js'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x33a7,0x93));var _0x733a=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x33a7[_0x1deb72];return _0x18bbdf;};'use strict';var pdf=require(_0x733a('0x0'));var emlformat=require(_0x733a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x733a('0x2'));var jsonpatch=require(_0x733a('0x3'));var rp=require(_0x733a('0x4'));var moment=require('moment');var BPromise=require(_0x733a('0x5'));var Mustache=require(_0x733a('0x6'));var util=require('util');var path=require(_0x733a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x733a('0x8'));var squel=require(_0x733a('0x9'));var crypto=require(_0x733a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x733a('0xb'));var toCsv=require(_0x733a('0xc'));var querystring=require(_0x733a('0xd'));var Papa=require('papaparse');var Redis=require(_0x733a('0xe'));var authService=require(_0x733a('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x733a('0x10'));var logger=require('../../config/logger')(_0x733a('0x11'));var utils=require(_0x733a('0x12'));var config=require(_0x733a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43e9a6,_0x1bd26e){_0x1bd26e=_0x1bd26e||0xcc;return function(_0x228b0e){if(_0x228b0e){return _0x43e9a6[_0x733a('0x14')](_0x1bd26e);}return _0x43e9a6[_0x733a('0x15')](_0x1bd26e)['end']();};}function respondWithResult(_0x1c8311,_0x416266){_0x416266=_0x416266||0xc8;return function(_0x50102b){if(_0x50102b){return _0x1c8311[_0x733a('0x15')](_0x416266)[_0x733a('0x16')](_0x50102b);}};}function respondWithFilteredResult(_0x1857ca,_0x31d60c){return function(_0x2d8a08){if(_0x2d8a08){var _0x4d5a74=_0x2d8a08['count'],_0xec5aee=_0x31d60c[_0x733a('0x17')],_0x826da4=_0x31d60c['offset']+_0x31d60c[_0x733a('0x18')],_0x117ed4;if(_0x826da4>=_0x4d5a74){_0x826da4=_0x4d5a74;_0x117ed4=0xc8;}else{_0x117ed4=0xce;}_0x1857ca[_0x733a('0x15')](_0x117ed4);return _0x1857ca[_0x733a('0x19')](_0x733a('0x1a'),_0xec5aee+'-'+_0x826da4+'/'+_0x4d5a74)['json'](_0x2d8a08);}return null;};}function patchUpdates(_0x280e11){return function(_0x4ab0be){try{jsonpatch['apply'](_0x4ab0be,_0x280e11,!![]);}catch(_0x3d8c2d){return BPromise['reject'](_0x3d8c2d);}return _0x4ab0be[_0x733a('0x1b')]();};}function saveUpdates(_0x1aa565,_0x13d6a9){return function(_0xc6b9a1){if(_0xc6b9a1){return _0xc6b9a1[_0x733a('0x1c')](_0x1aa565)[_0x733a('0x1d')](function(_0x967cbe){return _0x967cbe;});}return null;};}function removeEntity(_0x33f68b,_0xb21295){return function(_0x2d1e14){if(_0x2d1e14){return _0x2d1e14[_0x733a('0x1e')]()['then'](function(){_0x33f68b[_0x733a('0x15')](0xcc)[_0x733a('0x1f')]();});}};}function handleEntityNotFound(_0x34852a,_0x3796f4){return function(_0x93c072){if(!_0x93c072){_0x34852a[_0x733a('0x14')](0x194);}return _0x93c072;};}function handleError(_0x379f61,_0x55a99f){_0x55a99f=_0x55a99f||0x1f4;return function(_0x3b2d58){logger[_0x733a('0x20')](_0x3b2d58[_0x733a('0x21')]);if(_0x3b2d58[_0x733a('0x22')]){delete _0x3b2d58[_0x733a('0x22')];}_0x379f61['status'](_0x55a99f)[_0x733a('0x23')](_0x3b2d58);};}var utilLicense=require(_0x733a('0x24'));exports[_0x733a('0x25')]=function(_0x3d0edd,_0xdce836){var _0x30fab6={'raw':!![],'where':{'id':0x1}},_0x1f0cd6={};_0x1f0cd6[_0x733a('0x26')]=_[_0x733a('0x27')](db[_0x733a('0x28')][_0x733a('0x29')]);_0x1f0cd6[_0x733a('0x2a')]=_[_0x733a('0x27')](_0x3d0edd[_0x733a('0x2a')]);_0x1f0cd6[_0x733a('0x2b')]=_[_0x733a('0x2c')](_0x1f0cd6[_0x733a('0x26')],_0x1f0cd6['query']);_0x30fab6[_0x733a('0x2d')]=_[_0x733a('0x2c')](_0x1f0cd6[_0x733a('0x26')],qs[_0x733a('0x2e')](_0x3d0edd[_0x733a('0x2a')][_0x733a('0x2e')]));_0x30fab6[_0x733a('0x2d')]=_0x30fab6[_0x733a('0x2d')]['length']?_0x30fab6[_0x733a('0x2d')]:_0x1f0cd6[_0x733a('0x26')];_0x30fab6=_[_0x733a('0x2f')]({},_0x30fab6,_0x3d0edd['options']);return utilLicense[_0x733a('0x30')](_0x30fab6)['then'](respondWithResult(_0xdce836,null))['catch'](handleError(_0xdce836,null));};exports[_0x733a('0x1c')]=function(_0x50e6f6,_0x285291){if(_0x50e6f6[_0x733a('0x31')]['id']){delete _0x50e6f6[_0x733a('0x31')]['id'];}return db['License'][_0x733a('0x32')]({'where':{'id':_0x50e6f6['params']['id']}})['then'](handleEntityNotFound(_0x285291,null))[_0x733a('0x1d')](function(_0x3d3fc6){var _0x2694d6=_0x3d3fc6[_0x733a('0x33')]({'plain':!![]});return utilLicense[_0x733a('0x34')](_0x2694d6,_0x50e6f6['body']['key']);})[_0x733a('0x1d')](function(_0x31f6be){if(!_0x31f6be['demo']){return saveUpdates(_0x50e6f6['body'],null);}return _0x31f6be;})[_0x733a('0x1d')](respondWithResult(_0x285291,null))['catch'](handleError(_0x285291,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index fa2ea9a..67fba2d 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 _0x40ea=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','../../config/logger'];(function(_0x585797,_0x58c919){var _0x43c8e8=function(_0x4952b2){while(--_0x4952b2){_0x585797['push'](_0x585797['shift']());}};_0x43c8e8(++_0x58c919);}(_0x40ea,0x99));var _0xa40e=function(_0x154c96,_0x53b99b){_0x154c96=_0x154c96-0x0;var _0x324d22=_0x40ea[_0x154c96];return _0x324d22;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa40e('0x0'))(_0xa40e('0x1'));var moment=require(_0xa40e('0x2'));var BPromise=require(_0xa40e('0x3'));var rp=require(_0xa40e('0x4'));var fs=require('fs');var path=require(_0xa40e('0x5'));var rimraf=require(_0xa40e('0x6'));var config=require(_0xa40e('0x7'));var attributes=require(_0xa40e('0x8'));module[_0xa40e('0x9')]=function(_0x5ebb2e,_0x209f86){return _0x5ebb2e[_0xa40e('0xa')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29a7=['License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x6dfd23,_0x3efb07){var _0xdd1055=function(_0x1f449d){while(--_0x1f449d){_0x6dfd23['push'](_0x6dfd23['shift']());}};_0xdd1055(++_0x3efb07);}(_0x29a7,0x1af));var _0x729a=function(_0x1f02bc,_0x4cdada){_0x1f02bc=_0x1f02bc-0x0;var _0x378387=_0x29a7[_0x1f02bc];return _0x378387;};'use strict';var _=require(_0x729a('0x0'));var util=require(_0x729a('0x1'));var logger=require(_0x729a('0x2'))(_0x729a('0x3'));var moment=require(_0x729a('0x4'));var BPromise=require(_0x729a('0x5'));var rp=require(_0x729a('0x6'));var fs=require('fs');var path=require(_0x729a('0x7'));var rimraf=require(_0x729a('0x8'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x729a('0x9')]=function(_0x4c745f,_0x2a7fb9){return _0x4c745f[_0x729a('0xa')](_0x729a('0xb'),attributes,{'tableName':_0x729a('0xc'),'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 8b81423..314d859 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 _0xd87e=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x3f2a44,_0xf70f4b){var _0x50d3cb=function(_0x4f896d){while(--_0x4f896d){_0x3f2a44['push'](_0x3f2a44['shift']());}};_0x50d3cb(++_0xf70f4b);}(_0xd87e,0x1bf));var _0xed87=function(_0x49b098,_0x467730){_0x49b098=_0x49b098-0x0;var _0xf6dce6=_0xd87e[_0x49b098];return _0xf6dce6;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da793,_0xa33c67,_0x42fef6){return new BPromise(function(_0x33e1c1,_0x2f348a){return client['request'](_0x5da793,_0x42fef6)[_0xed87('0x9')](function(_0x3dce4b){logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));logger[_0xed87('0xd')](_0xed87('0xe'),_0xa33c67,'request\x20sent',JSON[_0xed87('0xf')](_0x3dce4b));if(_0x3dce4b[_0xed87('0x10')]){if(_0x3dce4b['error'][_0xed87('0x11')]===0x1f4){logger[_0xed87('0x10')]('License,\x20%s,\x20%s',_0xa33c67,_0x3dce4b['error'][_0xed87('0x12')]);return _0x2f348a(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}logger[_0xed87('0x10')](_0xed87('0xb'),_0xa33c67,_0x3dce4b[_0xed87('0x10')]['message']);return _0x33e1c1(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}else{logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));_0x33e1c1(_0x3dce4b[_0xed87('0x13')][_0xed87('0x12')]);}})[_0xed87('0x14')](function(_0x385859){logger['error'](_0xed87('0xb'),_0xa33c67,_0x385859);_0x2f348a(_0x385859);});});} \ No newline at end of file +var _0x8e44=['License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x261e83,_0x359211){var _0x11dcd8=function(_0x1988b0){while(--_0x1988b0){_0x261e83['push'](_0x261e83['shift']());}};_0x11dcd8(++_0x359211);}(_0x8e44,0x1ac));var _0x48e4=function(_0x6c9997,_0x3c3b34){_0x6c9997=_0x6c9997-0x0;var _0x1cda26=_0x8e44[_0x6c9997];return _0x1cda26;};'use strict';var _=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var moment=require(_0x48e4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e4('0x3'));var db=require(_0x48e4('0x4'))['db'];var utils=require(_0x48e4('0x5'));var logger=require(_0x48e4('0x6'))('rpc');var config=require(_0x48e4('0x7'));var jayson=require(_0x48e4('0x8'));var client=jayson[_0x48e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2c12,_0x26c5de,_0xfd30df){return new BPromise(function(_0x552cb1,_0x1ae7a7){return client[_0x48e4('0xa')](_0x4e2c12,_0xfd30df)[_0x48e4('0xb')](function(_0x2ba319){logger[_0x48e4('0xc')](_0x48e4('0xd'),_0x26c5de,'request\x20sent');logger[_0x48e4('0xe')](_0x48e4('0xf'),_0x26c5de,_0x48e4('0x10'),JSON['stringify'](_0x2ba319));if(_0x2ba319['error']){if(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x12')]===0x1f4){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319['error'][_0x48e4('0x13')]);return _0x1ae7a7(_0x2ba319['error'][_0x48e4('0x13')]);}logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);return _0x552cb1(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);}else{logger['info'](_0x48e4('0xd'),_0x26c5de,_0x48e4('0x10'));_0x552cb1(_0x2ba319['result'][_0x48e4('0x13')]);}})[_0x48e4('0x14')](function(_0x4dc92e){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x4dc92e);_0x1ae7a7(_0x4dc92e);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9689d16..ed540a8 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 _0x17db=['removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','put','update','removeDispositions','delete','removeAnswers','destroy'];(function(_0x1b2ddd,_0x3c749f){var _0x36326f=function(_0x4fac48){while(--_0x4fac48){_0x1b2ddd['push'](_0x1b2ddd['shift']());}};_0x36326f(++_0x3c749f);}(_0x17db,0xe8));var _0xb17d=function(_0x2645c0,_0x5f2783){_0x2645c0=_0x2645c0-0x0;var _0x3cff8e=_0x17db[_0x2645c0];return _0x3cff8e;};'use strict';var multer=require(_0xb17d('0x0'));var util=require(_0xb17d('0x1'));var path=require(_0xb17d('0x2'));var timeout=require(_0xb17d('0x3'));var express=require(_0xb17d('0x4'));var router=express['Router']();var auth=require(_0xb17d('0x5'));var interaction=require(_0xb17d('0x6'));var config=require(_0xb17d('0x7'));var controller=require('./mailAccount.controller');router[_0xb17d('0x8')]('/',auth[_0xb17d('0x9')](),controller['index']);router[_0xb17d('0x8')](_0xb17d('0xa'),auth[_0xb17d('0x9')](),controller['describe']);router[_0xb17d('0x8')](_0xb17d('0xb'),auth[_0xb17d('0x9')](),controller[_0xb17d('0xc')]);router[_0xb17d('0x8')]('/:id/dispositions',auth[_0xb17d('0x9')](),controller[_0xb17d('0xd')]);router[_0xb17d('0x8')](_0xb17d('0xe'),auth[_0xb17d('0x9')](),controller[_0xb17d('0xf')]);router['get'](_0xb17d('0x10'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x11')]);router['get'](_0xb17d('0x12'),auth[_0xb17d('0x9')](),controller['getSmtp']);router[_0xb17d('0x8')](_0xb17d('0x13'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x14')]);router[_0xb17d('0x8')](_0xb17d('0x15'),auth['isAuthenticated'](),controller[_0xb17d('0x16')]);router[_0xb17d('0x8')](_0xb17d('0x17'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x18')]);router[_0xb17d('0x8')](_0xb17d('0x19'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x1a')]);router[_0xb17d('0x8')](_0xb17d('0x1b'),auth[_0xb17d('0x9')](),controller['getAgents']);router[_0xb17d('0x1c')]('/:id/dispositions',auth[_0xb17d('0x9')](),controller[_0xb17d('0x1d')]);router[_0xb17d('0x1c')](_0xb17d('0xe'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x1e')]);router[_0xb17d('0x1c')]('/',auth[_0xb17d('0x9')](),controller[_0xb17d('0x1f')]);router[_0xb17d('0x1c')](_0xb17d('0x10'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x20')]);router[_0xb17d('0x1c')]('/:id/out_servers',auth[_0xb17d('0x9')](),controller[_0xb17d('0x21')]);router[_0xb17d('0x1c')]('/:id/interactions',auth[_0xb17d('0x9')](),controller[_0xb17d('0x22')]);router['post'](_0xb17d('0x15'),auth['isAuthenticated'](),controller[_0xb17d('0x23')]);router[_0xb17d('0x1c')](_0xb17d('0x24'),auth['isAuthenticated'](),controller['send']);router['post'](_0xb17d('0x1b'),auth['isAuthenticated'](),controller[_0xb17d('0x25')]);router[_0xb17d('0x26')](_0xb17d('0xb'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x27')]);router['delete']('/:id/dispositions',auth[_0xb17d('0x9')](),controller[_0xb17d('0x28')]);router[_0xb17d('0x29')](_0xb17d('0xe'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x2a')]);router['delete'](_0xb17d('0x10'),auth[_0xb17d('0x9')](),controller['removeImap']);router['delete'](_0xb17d('0x12'),auth[_0xb17d('0x9')](),controller['removeSmtp']);router[_0xb17d('0x29')](_0xb17d('0xb'),auth[_0xb17d('0x9')](),controller[_0xb17d('0x2b')]);router['delete'](_0xb17d('0x1b'),auth['isAuthenticated'](),controller[_0xb17d('0x2c')]);module[_0xb17d('0x2d')]=router; \ No newline at end of file +var _0x68a8=['removeDispositions','removeImap','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','send','addAgents','put','update','delete'];(function(_0x886387,_0x2a003f){var _0x1ae161=function(_0x29d9aa){while(--_0x29d9aa){_0x886387['push'](_0x886387['shift']());}};_0x1ae161(++_0x2a003f);}(_0x68a8,0xda));var _0x868a=function(_0x4d662a,_0x45ea3a){_0x4d662a=_0x4d662a-0x0;var _0xd4565b=_0x68a8[_0x4d662a];return _0xd4565b;};'use strict';var multer=require(_0x868a('0x0'));var util=require(_0x868a('0x1'));var path=require(_0x868a('0x2'));var timeout=require(_0x868a('0x3'));var express=require(_0x868a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x868a('0x5'));var config=require(_0x868a('0x6'));var controller=require(_0x868a('0x7'));router[_0x868a('0x8')]('/',auth[_0x868a('0x9')](),controller['index']);router[_0x868a('0x8')](_0x868a('0xa'),auth[_0x868a('0x9')](),controller['describe']);router[_0x868a('0x8')](_0x868a('0xb'),auth[_0x868a('0x9')](),controller[_0x868a('0xc')]);router[_0x868a('0x8')](_0x868a('0xd'),auth['isAuthenticated'](),controller[_0x868a('0xe')]);router[_0x868a('0x8')](_0x868a('0xf'),auth[_0x868a('0x9')](),controller['getAnswers']);router[_0x868a('0x8')]('/:id/in_servers',auth[_0x868a('0x9')](),controller[_0x868a('0x10')]);router[_0x868a('0x8')](_0x868a('0x11'),auth[_0x868a('0x9')](),controller[_0x868a('0x12')]);router[_0x868a('0x8')](_0x868a('0x13'),auth[_0x868a('0x9')](),controller[_0x868a('0x14')]);router[_0x868a('0x8')](_0x868a('0x15'),auth[_0x868a('0x9')](),controller[_0x868a('0x16')]);router[_0x868a('0x8')](_0x868a('0x17'),auth[_0x868a('0x9')](),controller['getMessages']);router[_0x868a('0x8')]('/:id/verify',auth[_0x868a('0x9')](),controller[_0x868a('0x18')]);router[_0x868a('0x8')](_0x868a('0x19'),auth[_0x868a('0x9')](),controller['getAgents']);router[_0x868a('0x1a')](_0x868a('0xd'),auth['isAuthenticated'](),controller[_0x868a('0x1b')]);router[_0x868a('0x1a')](_0x868a('0xf'),auth[_0x868a('0x9')](),controller[_0x868a('0x1c')]);router[_0x868a('0x1a')]('/',auth[_0x868a('0x9')](),controller[_0x868a('0x1d')]);router['post'](_0x868a('0x1e'),auth[_0x868a('0x9')](),controller[_0x868a('0x1f')]);router[_0x868a('0x1a')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x868a('0x20')]);router[_0x868a('0x1a')](_0x868a('0x13'),auth['isAuthenticated'](),controller[_0x868a('0x21')]);router[_0x868a('0x1a')]('/:id/applications',auth[_0x868a('0x9')](),controller[_0x868a('0x22')]);router[_0x868a('0x1a')]('/:id/send',auth['isAuthenticated'](),controller[_0x868a('0x23')]);router[_0x868a('0x1a')](_0x868a('0x19'),auth[_0x868a('0x9')](),controller[_0x868a('0x24')]);router[_0x868a('0x25')]('/:id',auth['isAuthenticated'](),controller[_0x868a('0x26')]);router[_0x868a('0x27')](_0x868a('0xd'),auth[_0x868a('0x9')](),controller[_0x868a('0x28')]);router[_0x868a('0x27')](_0x868a('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x868a('0x29')]);router['delete']('/:id/out_servers',auth['isAuthenticated'](),controller['removeSmtp']);router[_0x868a('0x27')](_0x868a('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x868a('0x19'),auth[_0x868a('0x9')](),controller['removeAgents']);module[_0x868a('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 264fd67..dbe29c8 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 _0xc25c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0xc25c,0xe8));var _0xcc25=function(_0x271e8e,_0x495393){_0x271e8e=_0x271e8e-0x0;var _0x2c5eac=_0xc25c[_0x271e8e];return _0x2c5eac;};'use strict';var Sequelize=require(_0xcc25('0x0'));module['exports']={'description':{'type':Sequelize[_0xcc25('0x1')]},'name':{'type':Sequelize[_0xcc25('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xcc25('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcc25('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xcc25('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xcc25('0x3')]},'markAsUnread':{'type':Sequelize[_0xcc25('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcc25('0x1')],'allowNull':![],'defaultValue':_0xcc25('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xcc25('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcc25('0x3')],'defaultValue':function(){return _0xcc25('0x6');}},'notificationSound':{'type':Sequelize[_0xcc25('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcc25('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcc25('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcc25('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcc25('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcc25('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcc25('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcc25('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcc25('0x8'),'set':function(_0x15cace){if(!_0x15cace)this[_0xcc25('0x9')](_0xcc25('0xa'),null);this[_0xcc25('0x9')](_0xcc25('0xb'),_0x15cace);}}}; \ No newline at end of file +var _0x6ef8=['TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x11072a,_0x4f270d){var _0x95ffe3=function(_0x2648c7){while(--_0x2648c7){_0x11072a['push'](_0x11072a['shift']());}};_0x95ffe3(++_0x4f270d);}(_0x6ef8,0xcd));var _0x86ef=function(_0x2b1d88,_0x5da44c){_0x2b1d88=_0x2b1d88-0x0;var _0x171d1f=_0x6ef8[_0x2b1d88];return _0x171d1f;};'use strict';var Sequelize=require(_0x86ef('0x0'));module['exports']={'description':{'type':Sequelize[_0x86ef('0x1')]},'name':{'type':Sequelize[_0x86ef('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x86ef('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x86ef('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x86ef('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x86ef('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x86ef('0x1')],'allowNull':![],'defaultValue':_0x86ef('0x3')},'fontSize':{'type':Sequelize[_0x86ef('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x86ef('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x86ef('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x86ef('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x86ef('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x86ef('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x86ef('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x86ef('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x86ef('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x8e4939){if(!_0x8e4939)this[_0x86ef('0x7')](_0x86ef('0x8'),null);this[_0x86ef('0x7')](_0x86ef('0x9'),_0x8e4939);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 6fefd9e..43e5e44 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 _0xd5f6=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','rawAttributes','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','map','type','key','VIRTUAL','field','options','MailAccount','count','findAll','rows','show','params','length','includeAll','include','catch','body','find','addDisposition','Disposition','create','getDispositions','pick','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','transaction','bulkCreate','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','List','updatedAt','DESC','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','sendMail','Contacts','List\x20not\x20found','messageId','from','subject','out','YYYY-MM-DD\x20HH:mm:ss','VerifySmtp','verifySmtp','addAgents','emit','isArray','userMailAccount:remove','User','getAgents','html-pdf'];(function(_0x5038d1,_0x53e0be){var _0x57a22f=function(_0x454920){while(--_0x454920){_0x5038d1['push'](_0x5038d1['shift']());}};_0x57a22f(++_0x53e0be);}(_0xd5f6,0xc1));var _0x6d5f=function(_0x17ead3,_0x5267a9){_0x17ead3=_0x17ead3-0x0;var _0xc75a06=_0xd5f6[_0x17ead3];return _0xc75a06;};'use strict';var pdf=require(_0x6d5f('0x0'));var emlformat=require(_0x6d5f('0x1'));var rimraf=require(_0x6d5f('0x2'));var zipdir=require(_0x6d5f('0x3'));var jsonpatch=require(_0x6d5f('0x4'));var rp=require(_0x6d5f('0x5'));var moment=require(_0x6d5f('0x6'));var BPromise=require(_0x6d5f('0x7'));var Mustache=require('mustache');var util=require(_0x6d5f('0x8'));var path=require('path');var sox=require(_0x6d5f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6d5f('0xa'));var squel=require(_0x6d5f('0xb'));var crypto=require(_0x6d5f('0xc'));var jsforce=require(_0x6d5f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6d5f('0xe'));var Papa=require('papaparse');var Redis=require(_0x6d5f('0xf'));var authService=require(_0x6d5f('0x10'));var qs=require(_0x6d5f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d5f('0x12'));var utils=require(_0x6d5f('0x13'));var config=require(_0x6d5f('0x14'));var db=require(_0x6d5f('0x15'))['db'];config[_0x6d5f('0x16')]=_[_0x6d5f('0x17')](config['redis'],{'host':_0x6d5f('0x18'),'port':0x18eb});var socket=require(_0x6d5f('0x19'))(new Redis(config['redis']));require(_0x6d5f('0x1a'))[_0x6d5f('0x1b')](socket);var jayson=require(_0x6d5f('0x1c'));var client=jayson[_0x6d5f('0x1d')][_0x6d5f('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x18f55f,_0x25612d,_0x1dfe23){if(_0x1dfe23){var _0x2dd5f0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2dd5f0['test'](_0x25612d)){return _0x18f55f;}else{throw new db[(_0x6d5f('0x1f'))][(_0x6d5f('0x20'))](_0x6d5f('0x21'));}}else{return _0x18f55f;}}function respondWithRpcPromise(_0x5d048a,_0x4b6f9f,_0x2af9b1,_0xc1cec7){return new BPromise(function(_0x5047ff,_0x3aadab){var _0x530ec4=_0xc1cec7||client;return _0x530ec4[_0x6d5f('0x22')](_0x5d048a,_0x2af9b1)[_0x6d5f('0x23')](function(_0x4bc167){logger[_0x6d5f('0x24')](_0x6d5f('0x25'),_0x4b6f9f,_0x6d5f('0x26'));logger[_0x6d5f('0x27')](_0x6d5f('0x28'),_0x4b6f9f,_0x6d5f('0x26'),JSON[_0x6d5f('0x29')](_0x4bc167));if(_0x4bc167[_0x6d5f('0x2a')]){if(_0x4bc167[_0x6d5f('0x2a')][_0x6d5f('0x2b')]===0x1f4){logger[_0x6d5f('0x2a')](_0x6d5f('0x25'),_0x4b6f9f,_0x4bc167[_0x6d5f('0x2a')][_0x6d5f('0x2c')]);return _0x3aadab(_0x4bc167[_0x6d5f('0x2a')][_0x6d5f('0x2c')]);}logger[_0x6d5f('0x2a')](_0x6d5f('0x25'),_0x4b6f9f,_0x4bc167[_0x6d5f('0x2a')]['message']);return _0x5047ff(_0x4bc167[_0x6d5f('0x2a')]['message']);}else{logger[_0x6d5f('0x24')](_0x6d5f('0x25'),_0x4b6f9f,_0x6d5f('0x26'));_0x5047ff(_0x4bc167['result']['message']);}})['catch'](function(_0x38fd6f){logger[_0x6d5f('0x2a')](_0x6d5f('0x25'),_0x4b6f9f,_0x38fd6f);_0x3aadab(_0x38fd6f);});});}function respondWithStatusCode(_0x1d0489,_0x13b8f8){_0x13b8f8=_0x13b8f8||0xcc;return function(_0x581a1d){if(_0x581a1d){return _0x1d0489[_0x6d5f('0x2d')](_0x13b8f8);}return _0x1d0489[_0x6d5f('0x2e')](_0x13b8f8)[_0x6d5f('0x2f')]();};}function respondWithResult(_0x378c10,_0x4da33d){_0x4da33d=_0x4da33d||0xc8;return function(_0x45f9d0){if(_0x45f9d0){return _0x378c10[_0x6d5f('0x2e')](_0x4da33d)[_0x6d5f('0x30')](_0x45f9d0);}};}function respondWithFilteredResult(_0x51a934,_0x291b2b){return function(_0x661625){if(_0x661625){var _0x298b86=_0x661625['count'],_0xf7957b=_0x291b2b[_0x6d5f('0x31')],_0x8d49ea=_0x291b2b[_0x6d5f('0x31')]+_0x291b2b['limit'],_0x4d3561;if(_0x8d49ea>=_0x298b86){_0x8d49ea=_0x298b86;_0x4d3561=0xc8;}else{_0x4d3561=0xce;}_0x51a934[_0x6d5f('0x2e')](_0x4d3561);return _0x51a934['set'](_0x6d5f('0x32'),_0xf7957b+'-'+_0x8d49ea+'/'+_0x298b86)['json'](_0x661625);}return null;};}function patchUpdates(_0x4cbfa1){return function(_0x1ce9c5){try{jsonpatch[_0x6d5f('0x33')](_0x1ce9c5,_0x4cbfa1,!![]);}catch(_0x2d46e1){return BPromise[_0x6d5f('0x34')](_0x2d46e1);}return _0x1ce9c5[_0x6d5f('0x35')]();};}function saveUpdates(_0x45adfe,_0x43010d){return function(_0x1de1d2){if(_0x1de1d2){return _0x1de1d2[_0x6d5f('0x36')](_0x45adfe)[_0x6d5f('0x23')](function(_0x1e561d){return _0x1e561d;});}return null;};}function removeEntity(_0x5000f2,_0x2a40e9){return function(_0x46f7ee){if(_0x46f7ee){return _0x46f7ee[_0x6d5f('0x37')]()[_0x6d5f('0x23')](function(){var _0x4249ec=_0x46f7ee[_0x6d5f('0x38')]({'plain':!![]});var _0x41eea9=_0x6d5f('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x41eea9,'resourceId':_0x4249ec['id']}})[_0x6d5f('0x23')](function(){return _0x46f7ee;});})[_0x6d5f('0x23')](function(){_0x5000f2['status'](0xcc)[_0x6d5f('0x2f')]();});}};}function handleEntityNotFound(_0x55ddff,_0x4f4496){return function(_0x4cdb2a){if(!_0x4cdb2a){_0x55ddff[_0x6d5f('0x2d')](0x194);}return _0x4cdb2a;};}function handleError(_0x86f824,_0x19249c){_0x19249c=_0x19249c||0x1f4;return function(_0xd0cbad){logger[_0x6d5f('0x2a')](_0xd0cbad[_0x6d5f('0x3a')]);if(_0xd0cbad[_0x6d5f('0x3b')]){delete _0xd0cbad[_0x6d5f('0x3b')];}_0x86f824[_0x6d5f('0x2e')](_0x19249c)[_0x6d5f('0x3c')](_0xd0cbad);};}exports[_0x6d5f('0x3d')]=function(_0x2ec4ff,_0x33968f){var _0x5ca560={'include':[{'model':db[_0x6d5f('0x3e')],'as':_0x6d5f('0x3f')},{'model':db[_0x6d5f('0x40')],'as':_0x6d5f('0x41')},{'model':db[_0x6d5f('0x42')],'as':'mandatoryDispositionPause'}]},_0x36df81={},_0x4e0f5b={'count':0x0,'rows':[]};var _0x5b145c=db['MailAccount'][_0x6d5f('0x43')];_0x36df81[_0x6d5f('0x44')]=_['keys'](_0x5b145c);_0x36df81[_0x6d5f('0x45')]=_[_0x6d5f('0x46')](_0x2ec4ff[_0x6d5f('0x45')]);_0x36df81['filters']=_[_0x6d5f('0x47')](_0x36df81[_0x6d5f('0x44')],_0x36df81[_0x6d5f('0x45')]);_0x5ca560['attributes']=_[_0x6d5f('0x47')](_0x36df81[_0x6d5f('0x44')],qs[_0x6d5f('0x48')](_0x2ec4ff[_0x6d5f('0x45')][_0x6d5f('0x48')]));_0x5ca560[_0x6d5f('0x49')]=_0x5ca560[_0x6d5f('0x49')]['length']?_0x5ca560[_0x6d5f('0x49')]:_0x36df81[_0x6d5f('0x44')];if(!_0x2ec4ff['query'][_0x6d5f('0x4a')](_0x6d5f('0x4b'))){_0x5ca560[_0x6d5f('0x4c')]=qs[_0x6d5f('0x4c')](_0x2ec4ff[_0x6d5f('0x45')][_0x6d5f('0x4c')]);_0x5ca560['offset']=qs[_0x6d5f('0x31')](_0x2ec4ff[_0x6d5f('0x45')][_0x6d5f('0x31')]);}_0x5ca560[_0x6d5f('0x4d')]=qs[_0x6d5f('0x4e')](_0x2ec4ff[_0x6d5f('0x45')][_0x6d5f('0x4e')]);_0x5ca560[_0x6d5f('0x4f')]=qs[_0x6d5f('0x50')](_['pick'](_0x2ec4ff[_0x6d5f('0x45')],_0x36df81[_0x6d5f('0x50')]));if(_0x2ec4ff[_0x6d5f('0x45')][_0x6d5f('0x51')]){_0x5ca560[_0x6d5f('0x4f')]=_[_0x6d5f('0x52')](_0x5ca560['where'],{'$or':_[_0x6d5f('0x53')](_0x5b145c,function(_0x529e32){if(_0x529e32[_0x6d5f('0x54')][_0x6d5f('0x55')]!==_0x6d5f('0x56')){var _0x3e56ef={};_0x3e56ef[_0x529e32[_0x6d5f('0x57')]]={'$like':'%'+_0x2ec4ff[_0x6d5f('0x45')][_0x6d5f('0x51')]+'%'};return _0x3e56ef;}})});}_0x5ca560=_['merge']({},_0x5ca560,_0x2ec4ff[_0x6d5f('0x58')]);var _0x8338e1={'where':_0x5ca560[_0x6d5f('0x4f')]};return db[_0x6d5f('0x59')][_0x6d5f('0x5a')](_0x8338e1)[_0x6d5f('0x23')](function(_0x2ffc81){_0x4e0f5b[_0x6d5f('0x5a')]=_0x2ffc81;if(_0x2ec4ff['query']['includeAll']){_0x5ca560['include']=[{'all':!![]}];}return db[_0x6d5f('0x59')][_0x6d5f('0x5b')](_0x5ca560);})[_0x6d5f('0x23')](function(_0x4ba8d6){_0x4e0f5b[_0x6d5f('0x5c')]=_0x4ba8d6;return _0x4e0f5b;})[_0x6d5f('0x23')](respondWithFilteredResult(_0x33968f,_0x5ca560))['catch'](handleError(_0x33968f,null));};exports[_0x6d5f('0x5d')]=function(_0x4d9da9,_0x305fd2){var _0x36e2c4={'raw':![],'where':{'id':_0x4d9da9[_0x6d5f('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6d5f('0x3f')},{'model':db[_0x6d5f('0x40')],'as':_0x6d5f('0x41')},{'model':db[_0x6d5f('0x42')],'as':'mandatoryDispositionPause'}]},_0x5b064c={};_0x5b064c[_0x6d5f('0x44')]=_[_0x6d5f('0x46')](db[_0x6d5f('0x59')][_0x6d5f('0x43')]);_0x5b064c[_0x6d5f('0x45')]=_[_0x6d5f('0x46')](_0x4d9da9[_0x6d5f('0x45')]);_0x5b064c[_0x6d5f('0x50')]=_[_0x6d5f('0x47')](_0x5b064c[_0x6d5f('0x44')],_0x5b064c[_0x6d5f('0x45')]);_0x36e2c4['attributes']=_[_0x6d5f('0x47')](_0x5b064c[_0x6d5f('0x44')],qs[_0x6d5f('0x48')](_0x4d9da9['query'][_0x6d5f('0x48')]));_0x36e2c4[_0x6d5f('0x49')]=_0x36e2c4[_0x6d5f('0x49')][_0x6d5f('0x5f')]?_0x36e2c4[_0x6d5f('0x49')]:_0x5b064c['model'];if(_0x4d9da9[_0x6d5f('0x45')][_0x6d5f('0x60')]){_0x36e2c4[_0x6d5f('0x61')]=[{'all':!![]}];}_0x36e2c4=_[_0x6d5f('0x52')]({},_0x36e2c4,_0x4d9da9[_0x6d5f('0x58')]);return db['MailAccount']['find'](_0x36e2c4)['then'](handleEntityNotFound(_0x305fd2,null))[_0x6d5f('0x23')](respondWithResult(_0x305fd2,null))[_0x6d5f('0x62')](handleError(_0x305fd2,null));};exports[_0x6d5f('0x36')]=function(_0x269370,_0x3bed3c){if(_0x269370['body']['id']){delete _0x269370[_0x6d5f('0x63')]['id'];}return db['MailAccount'][_0x6d5f('0x64')]({'where':{'id':_0x269370[_0x6d5f('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6d5f('0x3f')},{'model':db[_0x6d5f('0x40')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x6d5f('0x23')](handleEntityNotFound(_0x3bed3c,null))[_0x6d5f('0x23')](saveUpdates(_0x269370[_0x6d5f('0x63')],null))[_0x6d5f('0x23')](function(_0x5b16f3){if(_0x5b16f3&&_0x269370[_0x6d5f('0x63')][_0x6d5f('0x3f')]){return db[_0x6d5f('0x3e')][_0x6d5f('0x36')](_0x269370[_0x6d5f('0x63')][_0x6d5f('0x3f')],{'where':{'MailAccountId':_0x5b16f3['id']}})[_0x6d5f('0x23')](function(){return _0x5b16f3;});}return _0x5b16f3;})[_0x6d5f('0x23')](function(_0x356dd7){if(_0x356dd7&&_0x269370['body']['Smtp']){return db[_0x6d5f('0x40')][_0x6d5f('0x36')](_0x269370[_0x6d5f('0x63')][_0x6d5f('0x41')],{'where':{'MailAccountId':_0x356dd7['id']}})[_0x6d5f('0x23')](function(){return _0x356dd7;});}return _0x356dd7;})[_0x6d5f('0x23')](respondWithResult(_0x3bed3c,null))[_0x6d5f('0x62')](handleError(_0x3bed3c,null));};exports['describe']=function(_0x2c4208,_0x5c6f99){return db[_0x6d5f('0x59')]['describe']()[_0x6d5f('0x23')](respondWithResult(_0x5c6f99,null))[_0x6d5f('0x62')](handleError(_0x5c6f99,null));};exports[_0x6d5f('0x65')]=function(_0x4079df,_0x17f82b,_0x1737e4){if(_0x4079df['body']['id']){delete _0x4079df[_0x6d5f('0x63')]['id'];}return db[_0x6d5f('0x59')][_0x6d5f('0x64')]({'where':{'id':_0x4079df[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x17f82b,null))[_0x6d5f('0x23')](function(_0x55ebe5){if(_0x55ebe5){_0x4079df[_0x6d5f('0x63')]['MailAccountId']=_0x55ebe5['id'];return db[_0x6d5f('0x66')][_0x6d5f('0x67')](_0x4079df[_0x6d5f('0x63')]);}})[_0x6d5f('0x23')](respondWithResult(_0x17f82b,null))['catch'](handleError(_0x17f82b,null));};exports[_0x6d5f('0x68')]=function(_0x402913,_0x296da6,_0x4d6bfe){var _0x211433={'raw':![],'where':{}};var _0x20e1fa={};var _0x2e5351={'count':0x0,'rows':[]};return db[_0x6d5f('0x59')]['findOne']({'where':{'id':_0x402913['params']['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x296da6,null))[_0x6d5f('0x23')](function(_0x12fbae){if(_0x12fbae){_0x20e1fa['model']=_['keys'](db[_0x6d5f('0x66')]['rawAttributes']);_0x20e1fa['query']=_['keys'](_0x402913[_0x6d5f('0x45')]);_0x20e1fa[_0x6d5f('0x50')]=_[_0x6d5f('0x47')](_0x20e1fa[_0x6d5f('0x44')],_0x20e1fa['query']);_0x211433[_0x6d5f('0x49')]=_[_0x6d5f('0x47')](_0x20e1fa['model'],qs[_0x6d5f('0x48')](_0x402913['query'][_0x6d5f('0x48')]));_0x211433[_0x6d5f('0x49')]=_0x211433[_0x6d5f('0x49')][_0x6d5f('0x5f')]?_0x211433[_0x6d5f('0x49')]:_0x20e1fa[_0x6d5f('0x44')];if(!_0x402913[_0x6d5f('0x45')][_0x6d5f('0x4a')]('nolimit')){_0x211433[_0x6d5f('0x4c')]=qs[_0x6d5f('0x4c')](_0x402913['query'][_0x6d5f('0x4c')]);_0x211433[_0x6d5f('0x31')]=qs[_0x6d5f('0x31')](_0x402913[_0x6d5f('0x45')][_0x6d5f('0x31')]);}_0x211433[_0x6d5f('0x4d')]=qs[_0x6d5f('0x4e')](_0x402913[_0x6d5f('0x45')][_0x6d5f('0x4e')]);_0x211433[_0x6d5f('0x4f')]=qs[_0x6d5f('0x50')](_[_0x6d5f('0x69')](_0x402913[_0x6d5f('0x45')],_0x20e1fa[_0x6d5f('0x50')]));_0x211433['where']['MailAccountId']=_0x12fbae['id'];if(_0x402913[_0x6d5f('0x45')][_0x6d5f('0x51')]){_0x211433['where']=_[_0x6d5f('0x52')](_0x211433['where'],{'$or':_[_0x6d5f('0x53')](_0x211433[_0x6d5f('0x49')],function(_0x1f7fd3){var _0x2b6910={};_0x2b6910[_0x1f7fd3]={'$like':'%'+_0x402913[_0x6d5f('0x45')]['filter']+'%'};return _0x2b6910;})});}_0x211433=_[_0x6d5f('0x52')]({},_0x211433,_0x402913[_0x6d5f('0x58')]);return db[_0x6d5f('0x66')][_0x6d5f('0x5a')]({'where':_0x211433[_0x6d5f('0x4f')]})[_0x6d5f('0x23')](function(_0x3d94fa){_0x2e5351[_0x6d5f('0x5a')]=_0x3d94fa;if(_0x402913[_0x6d5f('0x45')][_0x6d5f('0x60')]){_0x211433[_0x6d5f('0x61')]=[{'all':!![]}];}return db[_0x6d5f('0x66')][_0x6d5f('0x5b')](_0x211433);})[_0x6d5f('0x23')](function(_0x17fab9){_0x2e5351[_0x6d5f('0x5c')]=_0x17fab9;return _0x2e5351;});}})[_0x6d5f('0x23')](respondWithFilteredResult(_0x296da6,_0x211433))['catch'](handleError(_0x296da6,null));};exports[_0x6d5f('0x6a')]=function(_0x163e3a,_0x4be764,_0x4a3d71){return db['MailAccount']['find']({'where':{'id':_0x163e3a[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x4be764,null))[_0x6d5f('0x23')](function(_0x446c08){if(_0x446c08){return _0x446c08[_0x6d5f('0x6a')](_0x163e3a[_0x6d5f('0x45')][_0x6d5f('0x6b')]);}})[_0x6d5f('0x23')](respondWithStatusCode(_0x4be764,null))[_0x6d5f('0x62')](handleError(_0x4be764,null));};exports[_0x6d5f('0x6c')]=function(_0x3e0b5a,_0x3f24f5,_0x21b5a2){if(_0x3e0b5a['body']['id']){delete _0x3e0b5a[_0x6d5f('0x63')]['id'];}return db[_0x6d5f('0x59')][_0x6d5f('0x64')]({'where':{'id':_0x3e0b5a['params']['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x3f24f5,null))[_0x6d5f('0x23')](function(_0x35200b){if(_0x35200b){_0x3e0b5a[_0x6d5f('0x63')][_0x6d5f('0x6d')]=_0x35200b['id'];return db[_0x6d5f('0x6e')]['create'](_0x3e0b5a['body']);}})[_0x6d5f('0x23')](respondWithResult(_0x3f24f5,null))['catch'](handleError(_0x3f24f5,null));};exports[_0x6d5f('0x6f')]=function(_0x486b83,_0x23b71d,_0x293f1c){var _0x3470c0={'raw':![],'where':{}};var _0x5967c4={};var _0x22c995={'count':0x0,'rows':[]};return db[_0x6d5f('0x59')]['findOne']({'where':{'id':_0x486b83[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x23b71d,null))[_0x6d5f('0x23')](function(_0x2ef936){if(_0x2ef936){_0x5967c4[_0x6d5f('0x44')]=_[_0x6d5f('0x46')](db[_0x6d5f('0x6e')][_0x6d5f('0x43')]);_0x5967c4[_0x6d5f('0x45')]=_[_0x6d5f('0x46')](_0x486b83[_0x6d5f('0x45')]);_0x5967c4[_0x6d5f('0x50')]=_[_0x6d5f('0x47')](_0x5967c4[_0x6d5f('0x44')],_0x5967c4['query']);_0x3470c0['attributes']=_[_0x6d5f('0x47')](_0x5967c4[_0x6d5f('0x44')],qs[_0x6d5f('0x48')](_0x486b83[_0x6d5f('0x45')]['fields']));_0x3470c0[_0x6d5f('0x49')]=_0x3470c0[_0x6d5f('0x49')][_0x6d5f('0x5f')]?_0x3470c0['attributes']:_0x5967c4[_0x6d5f('0x44')];if(!_0x486b83['query'][_0x6d5f('0x4a')](_0x6d5f('0x4b'))){_0x3470c0[_0x6d5f('0x4c')]=qs[_0x6d5f('0x4c')](_0x486b83[_0x6d5f('0x45')][_0x6d5f('0x4c')]);_0x3470c0[_0x6d5f('0x31')]=qs[_0x6d5f('0x31')](_0x486b83[_0x6d5f('0x45')][_0x6d5f('0x31')]);}_0x3470c0[_0x6d5f('0x4d')]=qs[_0x6d5f('0x4e')](_0x486b83[_0x6d5f('0x45')][_0x6d5f('0x4e')]);_0x3470c0[_0x6d5f('0x4f')]=qs[_0x6d5f('0x50')](_[_0x6d5f('0x69')](_0x486b83[_0x6d5f('0x45')],_0x5967c4[_0x6d5f('0x50')]));_0x3470c0[_0x6d5f('0x4f')][_0x6d5f('0x6d')]=_0x2ef936['id'];if(_0x486b83[_0x6d5f('0x45')][_0x6d5f('0x51')]){_0x3470c0[_0x6d5f('0x4f')]=_[_0x6d5f('0x52')](_0x3470c0[_0x6d5f('0x4f')],{'$or':_[_0x6d5f('0x53')](_0x3470c0['attributes'],function(_0x236b60){var _0x292b30={};_0x292b30[_0x236b60]={'$like':'%'+_0x486b83[_0x6d5f('0x45')][_0x6d5f('0x51')]+'%'};return _0x292b30;})});}_0x3470c0=_[_0x6d5f('0x52')]({},_0x3470c0,_0x486b83[_0x6d5f('0x58')]);return db[_0x6d5f('0x6e')][_0x6d5f('0x5a')]({'where':_0x3470c0[_0x6d5f('0x4f')]})['then'](function(_0x88447b){_0x22c995[_0x6d5f('0x5a')]=_0x88447b;if(_0x486b83[_0x6d5f('0x45')][_0x6d5f('0x60')]){_0x3470c0['include']=[{'all':!![]}];}return db[_0x6d5f('0x6e')][_0x6d5f('0x5b')](_0x3470c0);})[_0x6d5f('0x23')](function(_0x29e3bb){_0x22c995['rows']=_0x29e3bb;return _0x22c995;});}})['then'](respondWithFilteredResult(_0x23b71d,_0x3470c0))[_0x6d5f('0x62')](handleError(_0x23b71d,null));};exports[_0x6d5f('0x70')]=function(_0x1484d1,_0x133cd2,_0xb6e8e9){return db['MailAccount'][_0x6d5f('0x64')]({'where':{'id':_0x1484d1['params']['id']}})['then'](handleEntityNotFound(_0x133cd2,null))[_0x6d5f('0x23')](function(_0x3a4d01){if(_0x3a4d01){return _0x3a4d01[_0x6d5f('0x70')](_0x1484d1[_0x6d5f('0x45')][_0x6d5f('0x6b')]);}})[_0x6d5f('0x23')](respondWithStatusCode(_0x133cd2,null))[_0x6d5f('0x62')](handleError(_0x133cd2,null));};exports[_0x6d5f('0x67')]=function(_0x3eb51a,_0x27d6e2){var _0x2cbe86={'name':_0x3eb51a['body']['name'],'key':_0x3eb51a[_0x6d5f('0x63')]['key'],'email':_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x71')],'ListId':_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x72')],'active':!_[_0x6d5f('0x73')](_0x3eb51a[_0x6d5f('0x63')]['active'])?_0x3eb51a['body'][_0x6d5f('0x74')]:!![],'description':_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x6d5f('0x73')](_0x3eb51a['body'][_0x6d5f('0x76')])){if(_0x3eb51a['body'][_0x6d5f('0x77')]){_0x2cbe86[_0x6d5f('0x3f')][_0x6d5f('0x78')]=_0x2cbe86[_0x6d5f('0x41')]['user']=_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x79')];_0x2cbe86[_0x6d5f('0x3f')][_0x6d5f('0x7a')]=_0x2cbe86[_0x6d5f('0x41')][_0x6d5f('0x7b')]=_0x3eb51a[_0x6d5f('0x63')]['cpassword'];}else{_0x2cbe86[_0x6d5f('0x3f')][_0x6d5f('0x7c')]=_0x2cbe86[_0x6d5f('0x41')][_0x6d5f('0x7c')]=![];}_0x2cbe86[_0x6d5f('0x3f')][_0x6d5f('0x7d')]=_0x3eb51a['body'][_0x6d5f('0x3f')][_0x6d5f('0x7d')];_0x2cbe86[_0x6d5f('0x3f')]['port']=_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x3f')][_0x6d5f('0x7e')];_0x2cbe86[_0x6d5f('0x41')][_0x6d5f('0x7d')]=_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x41')][_0x6d5f('0x7d')];_0x2cbe86[_0x6d5f('0x41')][_0x6d5f('0x7e')]=_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x41')]['port'];}else{_0x2cbe86[_0x6d5f('0x3f')][_0x6d5f('0x7f')]=_0x2cbe86[_0x6d5f('0x41')]['service']=_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x76')];_0x2cbe86['Imap']['user']=_0x2cbe86[_0x6d5f('0x41')][_0x6d5f('0x78')]=_0x3eb51a[_0x6d5f('0x63')]['cuser'];_0x2cbe86[_0x6d5f('0x3f')][_0x6d5f('0x7a')]=_0x2cbe86[_0x6d5f('0x41')][_0x6d5f('0x7b')]=_0x3eb51a[_0x6d5f('0x63')][_0x6d5f('0x80')];}return db[_0x6d5f('0x59')][_0x6d5f('0x67')](_0x2cbe86,{'include':[{'model':db['MailServerOut'],'as':_0x6d5f('0x41')},{'model':db[_0x6d5f('0x3e')],'as':_0x6d5f('0x3f')}]})[_0x6d5f('0x23')](function(_0xa405ec){var _0x1dcf39=_0x3eb51a['user'][_0x6d5f('0x38')]({'plain':!![]});if(!_0x1dcf39)throw new Error(_0x6d5f('0x81'));if(_0x1dcf39[_0x6d5f('0x82')]===_0x6d5f('0x78')){var _0x47d02c=_0xa405ec[_0x6d5f('0x38')]({'plain':!![]});return db[_0x6d5f('0x83')][_0x6d5f('0x64')]({'where':{'name':'MailAccounts','userProfileId':_0x1dcf39[_0x6d5f('0x84')]},'raw':!![]})[_0x6d5f('0x23')](function(_0xc0ef29){if(_0xc0ef29&&_0xc0ef29[_0x6d5f('0x85')]===0x0){return db[_0x6d5f('0x86')]['create']({'name':_0x47d02c['name'],'resourceId':_0x47d02c['id'],'type':_0xc0ef29[_0x6d5f('0x3b')],'sectionId':_0xc0ef29['id']},{})[_0x6d5f('0x23')](function(){return _0xa405ec;});}else{return _0xa405ec;}})[_0x6d5f('0x62')](function(_0x131b04){logger[_0x6d5f('0x2a')](_0x6d5f('0x87'),_0x131b04);throw _0x131b04;});}return _0xa405ec;})[_0x6d5f('0x23')](respondWithResult(_0x27d6e2,0xc9))[_0x6d5f('0x62')](handleError(_0x27d6e2,null));};exports['getImap']=function(_0x5e7a59,_0x5c6d63,_0x11e357){return db[_0x6d5f('0x59')][_0x6d5f('0x88')]({'where':{'id':_0x5e7a59[_0x6d5f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5c6d63,null))['then'](function(_0x26191e){if(_0x26191e){return _0x26191e[_0x6d5f('0x89')]();}return null;})[_0x6d5f('0x23')](respondWithResult(_0x5c6d63,null))['catch'](handleError(_0x5c6d63,null));};exports['addImap']=function(_0x28fa68,_0x4d1491,_0x5f05a5){if(_0x28fa68[_0x6d5f('0x63')]['id']){delete _0x28fa68[_0x6d5f('0x63')]['id'];}return db['MailAccount'][_0x6d5f('0x64')]({'where':{'id':_0x28fa68[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x4d1491,null))[_0x6d5f('0x23')](function(_0x907f18){if(_0x907f18){_0x28fa68[_0x6d5f('0x63')][_0x6d5f('0x6d')]=_0x907f18['id'];return db['MailServerIn'][_0x6d5f('0x67')](_0x28fa68[_0x6d5f('0x63')]);}})[_0x6d5f('0x23')](respondWithResult(_0x4d1491,null))[_0x6d5f('0x62')](handleError(_0x4d1491,null));};exports[_0x6d5f('0x8a')]=function(_0x32831b,_0x13afec,_0x1b7c20){return db['MailAccount']['findOne']({'where':{'id':_0x32831b[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x13afec,null))[_0x6d5f('0x23')](function(_0x1c767f){if(_0x1c767f){return _0x1c767f[_0x6d5f('0x8b')](null);}return null;})[_0x6d5f('0x23')](respondWithStatusCode(_0x13afec,null))[_0x6d5f('0x62')](handleError(_0x13afec,null));};exports[_0x6d5f('0x8c')]=function(_0xc762b7,_0x777b8f,_0xa7df54){return db[_0x6d5f('0x59')][_0x6d5f('0x88')]({'where':{'id':_0xc762b7[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x777b8f,null))[_0x6d5f('0x23')](function(_0x57a229){if(_0x57a229){return _0x57a229[_0x6d5f('0x8c')]();}return null;})[_0x6d5f('0x23')](respondWithResult(_0x777b8f,null))[_0x6d5f('0x62')](handleError(_0x777b8f,null));};exports[_0x6d5f('0x8d')]=function(_0x36403b,_0x341bad,_0x2fcb9b){if(_0x36403b[_0x6d5f('0x63')]['id']){delete _0x36403b[_0x6d5f('0x63')]['id'];}return db[_0x6d5f('0x59')][_0x6d5f('0x64')]({'where':{'id':_0x36403b['params']['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x341bad,null))[_0x6d5f('0x23')](function(_0x336f2f){if(_0x336f2f){_0x36403b['body'][_0x6d5f('0x6d')]=_0x336f2f['id'];return db['MailServerOut'][_0x6d5f('0x67')](_0x36403b['body']);}})[_0x6d5f('0x23')](respondWithResult(_0x341bad,null))[_0x6d5f('0x62')](handleError(_0x341bad,null));};exports[_0x6d5f('0x8e')]=function(_0x1c5783,_0x44ea03,_0x14c88c){return db['MailAccount']['findOne']({'where':{'id':_0x1c5783[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x44ea03,null))[_0x6d5f('0x23')](function(_0x242e49){if(_0x242e49){return _0x242e49[_0x6d5f('0x8f')](null);}return null;})[_0x6d5f('0x23')](respondWithStatusCode(_0x44ea03,null))[_0x6d5f('0x62')](handleError(_0x44ea03,null));};exports['addInteraction']=function(_0x4db03c,_0x5801af,_0x4dc141){return db[_0x6d5f('0x90')][_0x6d5f('0x64')]({'where':{'id':_0x4db03c[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x5801af,null))[_0x6d5f('0x23')](function(_0x854606){if(_0x854606){return _0x854606[_0x6d5f('0x91')](_0x4db03c['body'][_0x6d5f('0x6b')],_[_0x6d5f('0x92')](_0x4db03c['body'],[_0x6d5f('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x5801af,null))[_0x6d5f('0x62')](handleError(_0x5801af,null));};exports[_0x6d5f('0x93')]=function(_0x1ae9aa,_0x593d72,_0x10fcfa){var _0x476133={'raw':![],'where':{}};var _0x114e25={};var _0x4984c8={'count':0x0,'rows':[]};return db[_0x6d5f('0x59')][_0x6d5f('0x88')]({'where':{'id':_0x1ae9aa[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x593d72,null))[_0x6d5f('0x23')](function(_0x5887af){if(_0x5887af){_0x114e25['model']=_['keys'](db['MailInteraction']['rawAttributes']);_0x114e25[_0x6d5f('0x45')]=_[_0x6d5f('0x46')](_0x1ae9aa['query']);_0x114e25['filters']=_[_0x6d5f('0x47')](_0x114e25[_0x6d5f('0x44')],_0x114e25[_0x6d5f('0x45')]);_0x476133[_0x6d5f('0x49')]=_['intersection'](_0x114e25[_0x6d5f('0x44')],qs[_0x6d5f('0x48')](_0x1ae9aa[_0x6d5f('0x45')][_0x6d5f('0x48')]));_0x476133['attributes']=_0x476133['attributes']['length']?_0x476133['attributes']:_0x114e25[_0x6d5f('0x44')];if(!_0x1ae9aa[_0x6d5f('0x45')][_0x6d5f('0x4a')](_0x6d5f('0x4b'))){_0x476133['limit']=qs[_0x6d5f('0x4c')](_0x1ae9aa['query']['limit']);_0x476133['offset']=qs[_0x6d5f('0x31')](_0x1ae9aa['query'][_0x6d5f('0x31')]);}_0x476133[_0x6d5f('0x4d')]=qs[_0x6d5f('0x4e')](_0x1ae9aa[_0x6d5f('0x45')]['sort']);_0x476133['where']=qs[_0x6d5f('0x50')](_[_0x6d5f('0x69')](_0x1ae9aa['query'],_0x114e25['filters']));_0x476133[_0x6d5f('0x4f')][_0x6d5f('0x6d')]=_0x5887af['id'];if(_0x1ae9aa[_0x6d5f('0x45')][_0x6d5f('0x51')]){_0x476133[_0x6d5f('0x4f')]=_['merge'](_0x476133[_0x6d5f('0x4f')],{'$or':_[_0x6d5f('0x53')](_0x476133[_0x6d5f('0x49')],function(_0x366f88){var _0x56464d={};_0x56464d[_0x366f88]={'$like':'%'+_0x1ae9aa['query']['filter']+'%'};return _0x56464d;})});}_0x476133=_[_0x6d5f('0x52')]({},_0x476133,_0x1ae9aa['options']);return db['MailInteraction'][_0x6d5f('0x5a')]({'where':_0x476133['where']})['then'](function(_0x368b13){_0x4984c8[_0x6d5f('0x5a')]=_0x368b13;if(_0x1ae9aa[_0x6d5f('0x45')][_0x6d5f('0x60')]){_0x476133[_0x6d5f('0x61')]=[{'model':db[_0x6d5f('0x94')],'as':_0x6d5f('0x95'),'required':![]},{'model':db['User'],'as':_0x6d5f('0x96'),'attributes':[_0x6d5f('0x3b'),_0x6d5f('0x97'),_0x6d5f('0x98')],'required':![]},{'model':db[_0x6d5f('0x99')],'as':_0x6d5f('0x9a'),'attributes':['id',_0x6d5f('0x3b'),_0x6d5f('0x9b')],'where':_0x1ae9aa[_0x6d5f('0x45')][_0x6d5f('0x9c')]?{'id':_0x1ae9aa[_0x6d5f('0x45')][_0x6d5f('0x9c')]}:undefined,'required':_0x1ae9aa[_0x6d5f('0x45')]['tag']?!![]:![]}];}return db[_0x6d5f('0x90')]['findAll'](_0x476133);})['then'](function(_0xfe7251){_0x4984c8['rows']=_0xfe7251;return _0x4984c8;});}})[_0x6d5f('0x23')](respondWithFilteredResult(_0x593d72,_0x476133))['catch'](handleError(_0x593d72,null));};exports['addApplications']=function(_0x523720,_0x5a74ca,_0x370c6a){return db[_0x6d5f('0x59')][_0x6d5f('0x88')]({'where':{'id':_0x523720[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x5a74ca,null))[_0x6d5f('0x23')](function(_0x483509){if(_0x483509){return db['sequelize'][_0x6d5f('0x9d')](function(_0x1e8357){return db['MailApplication'][_0x6d5f('0x37')]({'where':{'MailAccountId':_0x523720[_0x6d5f('0x5e')]['id']},'transaction':_0x1e8357})[_0x6d5f('0x23')](function(_0x42ab55){var _0x19880d=_[_0x6d5f('0x53')](_0x523720[_0x6d5f('0x63')],function(_0x3e3eed){_0x3e3eed[_0x6d5f('0x6d')]=_0x523720[_0x6d5f('0x5e')]['id'];return _0x3e3eed;});return db['MailApplication'][_0x6d5f('0x9e')](_0x19880d,{'transaction':_0x1e8357});});})['then'](function(){return db[_0x6d5f('0x9f')][_0x6d5f('0xa0')]({'where':{'MailAccountId':_0x523720[_0x6d5f('0x5e')]['id']},'order':_0x6d5f('0xa1')});});}})[_0x6d5f('0x23')](respondWithResult(_0x5a74ca,null))['catch'](handleError(_0x5a74ca,null));};exports[_0x6d5f('0xa2')]=function(_0x251103,_0x1410c2,_0x3b1ef4){var _0x3b7d2a={};var _0x39bbae={};var _0x33f5c7;var _0x19c61e;return db[_0x6d5f('0x59')]['findOne']({'where':{'id':_0x251103[_0x6d5f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1410c2,null))[_0x6d5f('0x23')](function(_0x1ac28f){if(_0x1ac28f){_0x33f5c7=_0x1ac28f;_0x39bbae[_0x6d5f('0x44')]=_[_0x6d5f('0x46')](db[_0x6d5f('0x9f')][_0x6d5f('0x43')]);_0x39bbae[_0x6d5f('0x45')]=_[_0x6d5f('0x46')](_0x251103[_0x6d5f('0x45')]);_0x39bbae[_0x6d5f('0x50')]=_[_0x6d5f('0x47')](_0x39bbae['model'],_0x39bbae[_0x6d5f('0x45')]);_0x3b7d2a[_0x6d5f('0x49')]=_[_0x6d5f('0x47')](_0x39bbae[_0x6d5f('0x44')],qs[_0x6d5f('0x48')](_0x251103[_0x6d5f('0x45')][_0x6d5f('0x48')]));_0x3b7d2a[_0x6d5f('0x49')]=_0x3b7d2a[_0x6d5f('0x49')][_0x6d5f('0x5f')]?_0x3b7d2a[_0x6d5f('0x49')]:_0x39bbae[_0x6d5f('0x44')];_0x3b7d2a['order']=qs['sort'](_0x251103[_0x6d5f('0x45')][_0x6d5f('0x4e')]);_0x3b7d2a[_0x6d5f('0x4f')]=qs[_0x6d5f('0x50')](_[_0x6d5f('0x69')](_0x251103[_0x6d5f('0x45')],_0x39bbae[_0x6d5f('0x50')]));if(_0x251103[_0x6d5f('0x45')][_0x6d5f('0x51')]){_0x3b7d2a[_0x6d5f('0x4f')]=_[_0x6d5f('0x52')](_0x3b7d2a[_0x6d5f('0x4f')],{'$or':_[_0x6d5f('0x53')](_0x3b7d2a[_0x6d5f('0x49')],function(_0x39b1bd){var _0x3a285e={};_0x3a285e[_0x39b1bd]={'$like':'%'+_0x251103[_0x6d5f('0x45')][_0x6d5f('0x51')]+'%'};return _0x3a285e;})});}_0x3b7d2a=_[_0x6d5f('0x52')]({},_0x3b7d2a,_0x251103[_0x6d5f('0x58')]);return _0x33f5c7[_0x6d5f('0xa2')](_0x3b7d2a);}})['then'](function(_0x153655){if(_0x153655){_0x19c61e=_0x153655[_0x6d5f('0x5f')];if(!_0x251103[_0x6d5f('0x45')]['hasOwnProperty'](_0x6d5f('0x4b'))){_0x3b7d2a[_0x6d5f('0x4c')]=qs[_0x6d5f('0x4c')](_0x251103[_0x6d5f('0x45')][_0x6d5f('0x4c')]);_0x3b7d2a[_0x6d5f('0x31')]=qs[_0x6d5f('0x31')](_0x251103['query'][_0x6d5f('0x31')]);}return _0x33f5c7[_0x6d5f('0xa2')](_0x3b7d2a);}})[_0x6d5f('0x23')](function(_0x2a20fd){if(_0x2a20fd){return _0x2a20fd?{'count':_0x19c61e,'rows':_0x2a20fd}:null;}})[_0x6d5f('0x23')](respondWithResult(_0x1410c2,null))[_0x6d5f('0x62')](handleError(_0x1410c2,null));};exports[_0x6d5f('0xa3')]=function(_0x55f91b,_0x5db854,_0x18135b){var _0x7185f1={'raw':!![],'where':{}};var _0x1baab7={};var _0x1d6069={'count':0x0,'rows':[]};return db['MailAccount'][_0x6d5f('0x88')]({'where':{'id':_0x55f91b[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x5db854,null))[_0x6d5f('0x23')](function(_0x2b3fe8){if(_0x2b3fe8){_0x1baab7[_0x6d5f('0x44')]=_['keys'](db[_0x6d5f('0xa4')][_0x6d5f('0x43')]);_0x1baab7[_0x6d5f('0x45')]=_['keys'](_0x55f91b[_0x6d5f('0x45')]);_0x1baab7[_0x6d5f('0x50')]=_['intersection'](_0x1baab7[_0x6d5f('0x44')],_0x1baab7[_0x6d5f('0x45')]);_0x7185f1['attributes']=_[_0x6d5f('0x47')](_0x1baab7[_0x6d5f('0x44')],qs[_0x6d5f('0x48')](_0x55f91b[_0x6d5f('0x45')][_0x6d5f('0x48')]));_0x7185f1[_0x6d5f('0x49')]=_0x7185f1[_0x6d5f('0x49')]['length']?_0x7185f1[_0x6d5f('0x49')]:_0x1baab7[_0x6d5f('0x44')];if(!_0x55f91b[_0x6d5f('0x45')]['hasOwnProperty'](_0x6d5f('0x4b'))){_0x7185f1[_0x6d5f('0x4c')]=qs[_0x6d5f('0x4c')](_0x55f91b[_0x6d5f('0x45')][_0x6d5f('0x4c')]);_0x7185f1[_0x6d5f('0x31')]=qs['offset'](_0x55f91b[_0x6d5f('0x45')][_0x6d5f('0x31')]);}_0x7185f1[_0x6d5f('0x4d')]=qs['sort'](_0x55f91b['query'][_0x6d5f('0x4e')]);_0x7185f1[_0x6d5f('0x4f')]=qs[_0x6d5f('0x50')](_[_0x6d5f('0x69')](_0x55f91b[_0x6d5f('0x45')],_0x1baab7[_0x6d5f('0x50')]));_0x7185f1[_0x6d5f('0x4f')]['MailAccountId']=_0x2b3fe8['id'];if(_0x55f91b['query']['filter']){_0x7185f1[_0x6d5f('0x4f')]=_[_0x6d5f('0x52')](_0x7185f1[_0x6d5f('0x4f')],{'$or':_[_0x6d5f('0x53')](_0x7185f1['attributes'],function(_0x3ef839){var _0x56a8ee={};_0x56a8ee[_0x3ef839]={'$like':'%'+_0x55f91b[_0x6d5f('0x45')]['filter']+'%'};return _0x56a8ee;})});}if(_0x55f91b[_0x6d5f('0x45')]['$gte']){var _0x45d16b=_0x55f91b[_0x6d5f('0x45')][_0x6d5f('0xa5')][_0x6d5f('0xa6')](',');var _0x128373={};_0x128373[_0x45d16b[0x0]]={'$gte':moment(_0x45d16b[0x1])[_0x6d5f('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7185f1[_0x6d5f('0x4f')]=_[_0x6d5f('0x52')](_0x7185f1[_0x6d5f('0x4f')],_0x128373);}_0x7185f1=_['merge']({},_0x7185f1,_0x55f91b[_0x6d5f('0x58')]);return db['MailMessage'][_0x6d5f('0x5a')]({'where':_0x7185f1[_0x6d5f('0x4f')]})[_0x6d5f('0x23')](function(_0x1f9b36){_0x1d6069[_0x6d5f('0x5a')]=_0x1f9b36;if(_0x55f91b[_0x6d5f('0x45')][_0x6d5f('0x60')]){_0x7185f1['include']=[{'all':!![]}];}return db[_0x6d5f('0xa4')][_0x6d5f('0x5b')](_0x7185f1);})[_0x6d5f('0x23')](function(_0x5b5b63){_0x1d6069[_0x6d5f('0x5c')]=_0x5b5b63;return _0x1d6069;});}})[_0x6d5f('0x23')](respondWithFilteredResult(_0x5db854,_0x7185f1))[_0x6d5f('0x62')](handleError(_0x5db854,null));};exports[_0x6d5f('0x3c')]=function(_0x2c1404,_0x75e302,_0x2ec935){var _0x543b0a,_0x4af81e={},_0xb5394a;if(_0x2c1404['body']['to']){_0xb5394a=_0x2c1404[_0x6d5f('0x63')]['to'][_0x6d5f('0xa6')](',')[0x0];}return db[_0x6d5f('0x59')][_0x6d5f('0x64')]({'where':{'id':_0x2c1404['params']['id']},'include':[{'model':db['CmList'],'as':_0x6d5f('0xa8'),'include':[{'model':db[_0x6d5f('0x94')],'as':'Contacts','where':{'email':_0xb5394a},'limit':0x1,'order':[[_0x6d5f('0xa9'),_0x6d5f('0xaa')]]}]},{'model':db[_0x6d5f('0x40')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x75e302,null))[_0x6d5f('0x23')](function(_0x4a6bd5){if(_0x4a6bd5){_0x543b0a=_0x4a6bd5;if(_0x4a6bd5[_0x6d5f('0x41')]){if(_[_0x6d5f('0x73')](_0x2c1404[_0x6d5f('0x63')]['from'])){_0x2c1404[_0x6d5f('0x63')]['from']=util[_0x6d5f('0xa7')](_0x6d5f('0xab'),_0x4a6bd5[_0x6d5f('0x3b')],_0x4a6bd5[_0x6d5f('0x71')]||_0x4a6bd5[_0x6d5f('0x41')][_0x6d5f('0x78')]);}if(_0x2c1404[_0x6d5f('0x63')][_0x6d5f('0xac')]&&_0x2c1404['body']['attachments'][_0x6d5f('0x5f')]){for(var _0x105757=0x0;_0x105757<_0x2c1404[_0x6d5f('0x63')]['attachments']['length'];_0x105757+=0x1){_0x2c1404[_0x6d5f('0x63')]['attachments'][_0x105757]={'filename':_0x2c1404[_0x6d5f('0x63')]['attachments'][_0x105757][_0x6d5f('0x3b')],'path':path['join'](config[_0x6d5f('0xad')],_0x6d5f('0xae'),_0x2c1404[_0x6d5f('0x63')][_0x6d5f('0xac')][_0x105757][_0x6d5f('0xaf')])};}}var _0x3243fa={'tls':{'rejectUnauthorized':![]}};if(_[_0x6d5f('0x73')](_0x4a6bd5['Smtp']['service'])){if(_0x4a6bd5[_0x6d5f('0x41')][_0x6d5f('0x7c')]){_0x3243fa[_0x6d5f('0xb0')]={'user':_0x4a6bd5[_0x6d5f('0x41')][_0x6d5f('0x78')],'pass':_0x4a6bd5['Smtp'][_0x6d5f('0x7b')]};}_0x3243fa[_0x6d5f('0x7d')]=_0x4a6bd5['Smtp']['host'];_0x3243fa[_0x6d5f('0x7e')]=_0x4a6bd5[_0x6d5f('0x41')]['port'];_0x3243fa[_0x6d5f('0xb1')]=_0x4a6bd5[_0x6d5f('0x41')]['secure'];}else{_0x3243fa[_0x6d5f('0x7f')]=_0x4a6bd5[_0x6d5f('0x41')]['service'];_0x3243fa[_0x6d5f('0xb0')]={'user':_0x4a6bd5[_0x6d5f('0x41')][_0x6d5f('0x78')],'pass':_0x4a6bd5[_0x6d5f('0x41')][_0x6d5f('0x7b')]};}return respondWithRpcPromise('SendMail',_0x6d5f('0xb2'),{'account':_0x3243fa,'message':_0x2c1404[_0x6d5f('0x63')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x237bf4){if(_0x237bf4){_0x4af81e=_0x237bf4;if(_0x543b0a[_0x6d5f('0xa8')]){if(_0x543b0a[_0x6d5f('0xa8')]['Contacts'][_0x6d5f('0x5f')]){return _0x543b0a[_0x6d5f('0xa8')][_0x6d5f('0xb3')][0x0];}else{return db[_0x6d5f('0x94')][_0x6d5f('0x67')](_[_0x6d5f('0x17')](_0x2c1404[_0x6d5f('0x63')],{'firstName':_0x2c1404[_0x6d5f('0x63')]['to'],'email':_0x2c1404[_0x6d5f('0x63')]['to'],'phone':_0x2c1404[_0x6d5f('0x63')]['to'],'ListId':_0x543b0a['ListId']}));}}else{throw new Error(_0x6d5f('0xb4'));}}})[_0x6d5f('0x23')](function(_0x64d42){if(_0x64d42){var _0x1d704d={'UserId':_0x2c1404[_0x6d5f('0x78')]['id'],'ContactId':_0x64d42['id'],'MailAccountId':_0x543b0a['id'],'inReplyTo':_0x4af81e[_0x6d5f('0xb5')],'to':_0x2c1404['body'][_0x6d5f('0xb6')],'cc':_0x2c1404[_0x6d5f('0x63')]['cc'],'subject':_0x2c1404[_0x6d5f('0x63')][_0x6d5f('0xb7')],'attach':_0x2c1404[_0x6d5f('0x63')]['attach'],'firstMsgDirection':_0x6d5f('0xb8'),'lastMsgAt':moment()[_0x6d5f('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x6d5f('0xb8'),'lastMsgBody':_0x2c1404[_0x6d5f('0x63')][_0x6d5f('0x63')],'Messages':[_[_0x6d5f('0x52')](_0x2c1404['body'],{'messageId':_0x4af81e[_0x6d5f('0xb5')],'sentAt':moment()['format'](_0x6d5f('0xb9')),'read':!![],'MailAccountId':_0x543b0a['id'],'UserId':_0x2c1404[_0x6d5f('0x78')]['id'],'ContactId':_0x64d42['id']})]};if(_0x2c1404[_0x6d5f('0x63')]['Interaction']){_0x1d704d=_[_0x6d5f('0x52')](_0x1d704d,_0x2c1404['body']['Interaction']);}return db[_0x6d5f('0x90')]['create'](_0x1d704d,{'include':[{'model':db[_0x6d5f('0xa4')],'as':'Messages'}]});}})[_0x6d5f('0x23')](respondWithResult(_0x75e302,null))[_0x6d5f('0x62')](handleError(_0x75e302,null));};exports['verifySmtp']=function(_0x2d626d,_0x3862ff,_0x73a078){return db['MailAccount'][_0x6d5f('0x64')]({'where':{'id':_0x2d626d[_0x6d5f('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x6d5f('0x23')](handleEntityNotFound(_0x3862ff,null))[_0x6d5f('0x23')](function(_0x20666a){if(_0x20666a&&_0x20666a['Smtp']){var _0x7cf3fd={'id':_0x20666a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x20666a['Smtp'][_0x6d5f('0x7f')]){_0x7cf3fd['service']=_0x20666a[_0x6d5f('0x41')][_0x6d5f('0x7f')];}else{_0x7cf3fd[_0x6d5f('0x7d')]=_0x20666a[_0x6d5f('0x41')][_0x6d5f('0x7d')];_0x7cf3fd[_0x6d5f('0x7e')]=_0x20666a['Smtp'][_0x6d5f('0x7e')];_0x7cf3fd['secure']=_0x20666a['Smtp']['secure'];}if(_0x20666a[_0x6d5f('0x41')][_0x6d5f('0x7c')]){_0x7cf3fd[_0x6d5f('0xb0')]={'user':_0x20666a[_0x6d5f('0x41')][_0x6d5f('0x78')],'pass':_0x20666a['Smtp'][_0x6d5f('0x7b')]};}return respondWithRpcPromise(_0x6d5f('0xba'),_0x6d5f('0xbb'),{'account':_0x7cf3fd});}})[_0x6d5f('0x23')](respondWithResult(_0x3862ff,null))[_0x6d5f('0x62')](handleError(_0x3862ff,null));};exports[_0x6d5f('0x37')]=function(_0x18eac8,_0x32436c){return db[_0x6d5f('0x59')][_0x6d5f('0x64')]({'where':{'id':_0x18eac8[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x32436c,null))[_0x6d5f('0x23')](function(_0x6b2ea3){if(_0x6b2ea3&&_0x6b2ea3['service']){throw new db[(_0x6d5f('0x1f'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x6b2ea3;})[_0x6d5f('0x23')](removeEntity(_0x32436c,null))['catch'](handleError(_0x32436c,null));};exports[_0x6d5f('0xbc')]=function(_0x36bce2,_0x2b41f7,_0x36420f){return db[_0x6d5f('0x59')][_0x6d5f('0x64')]({'where':{'id':_0x36bce2[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x2b41f7,null))[_0x6d5f('0x23')](function(_0x5c612f){if(_0x5c612f){return _0x5c612f[_0x6d5f('0xbc')](_0x36bce2['body'][_0x6d5f('0x6b')],_[_0x6d5f('0x92')](_0x36bce2['body'],['ids','id'])||{})['spread'](function(_0x18a432){for(var _0x3912bf=0x0;_0x3912bf<_0x36bce2[_0x6d5f('0x63')][_0x6d5f('0x6b')][_0x6d5f('0x5f')];_0x3912bf+=0x1){socket[_0x6d5f('0xbd')]('userMailAccount:save',{'UserId':_0x36bce2['body'][_0x6d5f('0x6b')][_0x3912bf],'MailAccountId':_0x36bce2[_0x6d5f('0x5e')]['id']});}return _0x18a432;});}})['then'](respondWithResult(_0x2b41f7,null))[_0x6d5f('0x62')](handleError(_0x2b41f7,null));};exports['removeAgents']=function(_0x567dca,_0x5b0e2b,_0x402444){return db[_0x6d5f('0x59')][_0x6d5f('0x64')]({'where':{'id':_0x567dca[_0x6d5f('0x5e')]['id']}})[_0x6d5f('0x23')](handleEntityNotFound(_0x5b0e2b,null))['then'](function(_0xbe87f2){if(_0xbe87f2){return _0xbe87f2['removeAgents'](_0x567dca[_0x6d5f('0x45')][_0x6d5f('0x6b')])[_0x6d5f('0x23')](function(){if(_[_0x6d5f('0xbe')](_0x567dca['query'][_0x6d5f('0x6b')])){for(var _0x3acb9b=0x0;_0x3acb9b<_0x567dca[_0x6d5f('0x45')]['ids']['length'];_0x3acb9b+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x567dca[_0x6d5f('0x45')][_0x6d5f('0x6b')][_0x3acb9b]),'MailAccountId':Number(_0x567dca['params']['id'])});}}else{socket['emit'](_0x6d5f('0xbf'),{'UserId':Number(_0x567dca[_0x6d5f('0x45')][_0x6d5f('0x6b')]),'MailAccountId':Number(_0x567dca[_0x6d5f('0x5e')]['id'])});}});}})[_0x6d5f('0x23')](respondWithStatusCode(_0x5b0e2b,null))[_0x6d5f('0x62')](handleError(_0x5b0e2b,null));};exports['getAgents']=function(_0x550154,_0x539095,_0x5783c2){var _0x51d684={};var _0x3c75d1={};var _0xaa4fe3;var _0x254f80;return db[_0x6d5f('0x59')][_0x6d5f('0x88')]({'where':{'id':_0x550154[_0x6d5f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x539095,null))[_0x6d5f('0x23')](function(_0x46de99){if(_0x46de99){_0xaa4fe3=_0x46de99;_0x3c75d1['model']=_[_0x6d5f('0x46')](db[_0x6d5f('0xc0')]['rawAttributes']);_0x3c75d1['query']=_[_0x6d5f('0x46')](_0x550154[_0x6d5f('0x45')]);_0x3c75d1[_0x6d5f('0x50')]=_[_0x6d5f('0x47')](_0x3c75d1[_0x6d5f('0x44')],_0x3c75d1[_0x6d5f('0x45')]);_0x51d684['attributes']=_[_0x6d5f('0x47')](_0x3c75d1[_0x6d5f('0x44')],qs[_0x6d5f('0x48')](_0x550154[_0x6d5f('0x45')]['fields']));_0x51d684[_0x6d5f('0x49')]=_0x51d684[_0x6d5f('0x49')][_0x6d5f('0x5f')]?_0x51d684['attributes']:_0x3c75d1[_0x6d5f('0x44')];_0x51d684[_0x6d5f('0x4d')]=qs[_0x6d5f('0x4e')](_0x550154['query'][_0x6d5f('0x4e')]);_0x51d684['where']=qs[_0x6d5f('0x50')](_[_0x6d5f('0x69')](_0x550154[_0x6d5f('0x45')],_0x3c75d1['filters']));if(_0x550154['query']['filter']){_0x51d684[_0x6d5f('0x4f')]=_[_0x6d5f('0x52')](_0x51d684['where'],{'$or':_[_0x6d5f('0x53')](_0x51d684['attributes'],function(_0x217076){var _0x38f571={};_0x38f571[_0x217076]={'$like':'%'+_0x550154[_0x6d5f('0x45')][_0x6d5f('0x51')]+'%'};return _0x38f571;})});}_0x51d684=_['merge']({},_0x51d684,_0x550154[_0x6d5f('0x58')]);return _0xaa4fe3[_0x6d5f('0xc1')](_0x51d684);}})[_0x6d5f('0x23')](function(_0x4251a2){if(_0x4251a2){_0x254f80=_0x4251a2[_0x6d5f('0x5f')];if(!_0x550154['query'][_0x6d5f('0x4a')](_0x6d5f('0x4b'))){_0x51d684[_0x6d5f('0x4c')]=qs[_0x6d5f('0x4c')](_0x550154[_0x6d5f('0x45')]['limit']);_0x51d684[_0x6d5f('0x31')]=qs[_0x6d5f('0x31')](_0x550154[_0x6d5f('0x45')][_0x6d5f('0x31')]);}return _0xaa4fe3[_0x6d5f('0xc1')](_0x51d684);}})['then'](function(_0x49496a){if(_0x49496a){return _0x49496a?{'count':_0x254f80,'rows':_0x49496a}:null;}})[_0x6d5f('0x23')](respondWithResult(_0x539095,null))['catch'](handleError(_0x539095,null));}; \ No newline at end of file +var _0xa126=['query','model','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','params','Smtp','mandatoryDispositionPause','body','find','MailServerOut','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','order','findAll','removeDispositions','ids','MailAccountId','CannedAnswer','create','getAnswers','findOne','removeAnswers','key','email','ListId','isNil','active','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','cservice','password','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','secure','auth','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','count','offset','limit','status','Content-Range','save','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','name','send','index','MailServerIn','Imap','Pause','MailAccount','rawAttributes','keys'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xa126,0x78));var _0x6a12=function(_0x3c51b0,_0x3ffa0a){_0x3c51b0=_0x3c51b0-0x0;var _0x5c0473=_0xa126[_0x3c51b0];return _0x5c0473;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6a12('0x0'));var rimraf=require(_0x6a12('0x1'));var zipdir=require(_0x6a12('0x2'));var jsonpatch=require(_0x6a12('0x3'));var rp=require(_0x6a12('0x4'));var moment=require('moment');var BPromise=require(_0x6a12('0x5'));var Mustache=require(_0x6a12('0x6'));var util=require('util');var path=require(_0x6a12('0x7'));var sox=require(_0x6a12('0x8'));var csv=require(_0x6a12('0x9'));var ejs=require(_0x6a12('0xa'));var fs=require('fs');var _=require(_0x6a12('0xb'));var squel=require('squel');var crypto=require(_0x6a12('0xc'));var jsforce=require(_0x6a12('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6a12('0x9'));var querystring=require(_0x6a12('0xe'));var Papa=require('papaparse');var Redis=require(_0x6a12('0xf'));var authService=require(_0x6a12('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x6a12('0x11'));var logger=require(_0x6a12('0x12'))(_0x6a12('0x13'));var utils=require('../../config/utils');var config=require(_0x6a12('0x14'));var db=require(_0x6a12('0x15'))['db'];config[_0x6a12('0x16')]=_['defaults'](config['redis'],{'host':_0x6a12('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6a12('0x18'))[_0x6a12('0x19')](socket);var jayson=require(_0x6a12('0x1a'));var client=jayson['client'][_0x6a12('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x329738,_0x423f80,_0x42d650){if(_0x42d650){var _0x4aef8c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4aef8c[_0x6a12('0x1c')](_0x423f80)){return _0x329738;}else{throw new db[(_0x6a12('0x1d'))][(_0x6a12('0x1e'))](_0x6a12('0x1f'));}}else{return _0x329738;}}function respondWithRpcPromise(_0x5f34d8,_0x53af73,_0x511ac4,_0x190a49){return new BPromise(function(_0x427051,_0x1a2abd){var _0x28052a=_0x190a49||client;return _0x28052a[_0x6a12('0x20')](_0x5f34d8,_0x511ac4)[_0x6a12('0x21')](function(_0x5c101e){logger[_0x6a12('0x22')](_0x6a12('0x23'),_0x53af73,_0x6a12('0x24'));logger[_0x6a12('0x25')](_0x6a12('0x26'),_0x53af73,_0x6a12('0x24'),JSON[_0x6a12('0x27')](_0x5c101e));if(_0x5c101e[_0x6a12('0x28')]){if(_0x5c101e[_0x6a12('0x28')][_0x6a12('0x29')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x53af73,_0x5c101e[_0x6a12('0x28')]['message']);return _0x1a2abd(_0x5c101e[_0x6a12('0x28')][_0x6a12('0x2a')]);}logger[_0x6a12('0x28')]('MailAccount,\x20%s,\x20%s',_0x53af73,_0x5c101e['error'][_0x6a12('0x2a')]);return _0x427051(_0x5c101e[_0x6a12('0x28')][_0x6a12('0x2a')]);}else{logger[_0x6a12('0x22')]('MailAccount,\x20%s,\x20%s',_0x53af73,_0x6a12('0x24'));_0x427051(_0x5c101e[_0x6a12('0x2b')]['message']);}})[_0x6a12('0x2c')](function(_0x242bda){logger['error'](_0x6a12('0x23'),_0x53af73,_0x242bda);_0x1a2abd(_0x242bda);});});}function respondWithStatusCode(_0x5bc75d,_0x3eda87){_0x3eda87=_0x3eda87||0xcc;return function(_0x671202){if(_0x671202){return _0x5bc75d['sendStatus'](_0x3eda87);}return _0x5bc75d['status'](_0x3eda87)[_0x6a12('0x2d')]();};}function respondWithResult(_0x3a3af0,_0xae4859){_0xae4859=_0xae4859||0xc8;return function(_0x1ceb28){if(_0x1ceb28){return _0x3a3af0['status'](_0xae4859)[_0x6a12('0x2e')](_0x1ceb28);}};}function respondWithFilteredResult(_0xc8c4ef,_0x54e836){return function(_0x31c1a0){if(_0x31c1a0){var _0x4ff2a=_0x31c1a0[_0x6a12('0x2f')],_0x1dc9bd=_0x54e836['offset'],_0x584aac=_0x54e836[_0x6a12('0x30')]+_0x54e836[_0x6a12('0x31')],_0x14e054;if(_0x584aac>=_0x4ff2a){_0x584aac=_0x4ff2a;_0x14e054=0xc8;}else{_0x14e054=0xce;}_0xc8c4ef[_0x6a12('0x32')](_0x14e054);return _0xc8c4ef['set'](_0x6a12('0x33'),_0x1dc9bd+'-'+_0x584aac+'/'+_0x4ff2a)[_0x6a12('0x2e')](_0x31c1a0);}return null;};}function patchUpdates(_0x57c53e){return function(_0x2cd801){try{jsonpatch['apply'](_0x2cd801,_0x57c53e,!![]);}catch(_0x3dfc03){return BPromise['reject'](_0x3dfc03);}return _0x2cd801[_0x6a12('0x34')]();};}function saveUpdates(_0xf1bbd3,_0x401e71){return function(_0x5bfedf){if(_0x5bfedf){return _0x5bfedf[_0x6a12('0x35')](_0xf1bbd3)[_0x6a12('0x21')](function(_0x324cc8){return _0x324cc8;});}return null;};}function removeEntity(_0x1fddd8,_0x2334cd){return function(_0x5aa67c){if(_0x5aa67c){return _0x5aa67c[_0x6a12('0x36')]()[_0x6a12('0x21')](function(){var _0xc23b83=_0x5aa67c[_0x6a12('0x37')]({'plain':!![]});var _0x3a7175=_0x6a12('0x38');return db[_0x6a12('0x39')]['destroy']({'where':{'type':_0x3a7175,'resourceId':_0xc23b83['id']}})[_0x6a12('0x21')](function(){return _0x5aa67c;});})[_0x6a12('0x21')](function(){_0x1fddd8['status'](0xcc)[_0x6a12('0x2d')]();});}};}function handleEntityNotFound(_0x5b2369,_0x201c3c){return function(_0x3ec96f){if(!_0x3ec96f){_0x5b2369[_0x6a12('0x3a')](0x194);}return _0x3ec96f;};}function handleError(_0x514cc5,_0x356807){_0x356807=_0x356807||0x1f4;return function(_0x1c6e2b){logger[_0x6a12('0x28')](_0x1c6e2b['stack']);if(_0x1c6e2b[_0x6a12('0x3b')]){delete _0x1c6e2b['name'];}_0x514cc5['status'](_0x356807)[_0x6a12('0x3c')](_0x1c6e2b);};}exports[_0x6a12('0x3d')]=function(_0xc67ec4,_0x13ea77){var _0x2138c4={'include':[{'model':db[_0x6a12('0x3e')],'as':_0x6a12('0x3f')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x6a12('0x40')],'as':'mandatoryDispositionPause'}]},_0x38ea6a={},_0x50b8d1={'count':0x0,'rows':[]};var _0x163a68=db[_0x6a12('0x41')][_0x6a12('0x42')];_0x38ea6a['model']=_[_0x6a12('0x43')](_0x163a68);_0x38ea6a[_0x6a12('0x44')]=_['keys'](_0xc67ec4[_0x6a12('0x44')]);_0x38ea6a['filters']=_['intersection'](_0x38ea6a[_0x6a12('0x45')],_0x38ea6a[_0x6a12('0x44')]);_0x2138c4[_0x6a12('0x46')]=_[_0x6a12('0x47')](_0x38ea6a[_0x6a12('0x45')],qs[_0x6a12('0x48')](_0xc67ec4[_0x6a12('0x44')]['fields']));_0x2138c4['attributes']=_0x2138c4[_0x6a12('0x46')][_0x6a12('0x49')]?_0x2138c4[_0x6a12('0x46')]:_0x38ea6a['model'];if(!_0xc67ec4[_0x6a12('0x44')]['hasOwnProperty'](_0x6a12('0x4a'))){_0x2138c4['limit']=qs[_0x6a12('0x31')](_0xc67ec4['query'][_0x6a12('0x31')]);_0x2138c4[_0x6a12('0x30')]=qs[_0x6a12('0x30')](_0xc67ec4[_0x6a12('0x44')][_0x6a12('0x30')]);}_0x2138c4['order']=qs[_0x6a12('0x4b')](_0xc67ec4[_0x6a12('0x44')][_0x6a12('0x4b')]);_0x2138c4[_0x6a12('0x4c')]=qs[_0x6a12('0x4d')](_[_0x6a12('0x4e')](_0xc67ec4['query'],_0x38ea6a[_0x6a12('0x4d')]));if(_0xc67ec4[_0x6a12('0x44')][_0x6a12('0x4f')]){_0x2138c4['where']=_[_0x6a12('0x50')](_0x2138c4[_0x6a12('0x4c')],{'$or':_[_0x6a12('0x51')](_0x163a68,function(_0x17e944){if(_0x17e944['type']['key']!==_0x6a12('0x52')){var _0x3753ce={};_0x3753ce[_0x17e944['field']]={'$like':'%'+_0xc67ec4[_0x6a12('0x44')][_0x6a12('0x4f')]+'%'};return _0x3753ce;}})});}_0x2138c4=_[_0x6a12('0x50')]({},_0x2138c4,_0xc67ec4[_0x6a12('0x53')]);var _0x519676={'where':_0x2138c4[_0x6a12('0x4c')]};return db[_0x6a12('0x41')][_0x6a12('0x2f')](_0x519676)[_0x6a12('0x21')](function(_0x20b1fe){_0x50b8d1['count']=_0x20b1fe;if(_0xc67ec4[_0x6a12('0x44')][_0x6a12('0x54')]){_0x2138c4[_0x6a12('0x55')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x2138c4);})['then'](function(_0x237315){_0x50b8d1[_0x6a12('0x56')]=_0x237315;return _0x50b8d1;})[_0x6a12('0x21')](respondWithFilteredResult(_0x13ea77,_0x2138c4))[_0x6a12('0x2c')](handleError(_0x13ea77,null));};exports['show']=function(_0x56e193,_0x4b09dc){var _0x568c01={'raw':![],'where':{'id':_0x56e193[_0x6a12('0x57')]['id']},'include':[{'model':db[_0x6a12('0x3e')],'as':_0x6a12('0x3f')},{'model':db['MailServerOut'],'as':_0x6a12('0x58')},{'model':db[_0x6a12('0x40')],'as':_0x6a12('0x59')}]},_0x1ec971={};_0x1ec971[_0x6a12('0x45')]=_['keys'](db[_0x6a12('0x41')][_0x6a12('0x42')]);_0x1ec971['query']=_[_0x6a12('0x43')](_0x56e193[_0x6a12('0x44')]);_0x1ec971['filters']=_[_0x6a12('0x47')](_0x1ec971['model'],_0x1ec971[_0x6a12('0x44')]);_0x568c01[_0x6a12('0x46')]=_['intersection'](_0x1ec971['model'],qs[_0x6a12('0x48')](_0x56e193[_0x6a12('0x44')][_0x6a12('0x48')]));_0x568c01[_0x6a12('0x46')]=_0x568c01[_0x6a12('0x46')][_0x6a12('0x49')]?_0x568c01[_0x6a12('0x46')]:_0x1ec971['model'];if(_0x56e193[_0x6a12('0x44')][_0x6a12('0x54')]){_0x568c01[_0x6a12('0x55')]=[{'all':!![]}];}_0x568c01=_[_0x6a12('0x50')]({},_0x568c01,_0x56e193[_0x6a12('0x53')]);return db['MailAccount']['find'](_0x568c01)['then'](handleEntityNotFound(_0x4b09dc,null))['then'](respondWithResult(_0x4b09dc,null))[_0x6a12('0x2c')](handleError(_0x4b09dc,null));};exports[_0x6a12('0x35')]=function(_0x203871,_0x550d26){if(_0x203871[_0x6a12('0x5a')]['id']){delete _0x203871[_0x6a12('0x5a')]['id'];}return db[_0x6a12('0x41')][_0x6a12('0x5b')]({'where':{'id':_0x203871[_0x6a12('0x57')]['id']},'include':[{'model':db[_0x6a12('0x3e')],'as':_0x6a12('0x3f')},{'model':db[_0x6a12('0x5c')],'as':'Smtp'},{'model':db['Pause'],'as':_0x6a12('0x59')}]})['then'](handleEntityNotFound(_0x550d26,null))['then'](saveUpdates(_0x203871['body'],null))['then'](function(_0x55144e){if(_0x55144e&&_0x203871['body'][_0x6a12('0x3f')]){return db['MailServerIn'][_0x6a12('0x35')](_0x203871[_0x6a12('0x5a')]['Imap'],{'where':{'MailAccountId':_0x55144e['id']}})['then'](function(){return _0x55144e;});}return _0x55144e;})[_0x6a12('0x21')](function(_0x115344){if(_0x115344&&_0x203871[_0x6a12('0x5a')][_0x6a12('0x58')]){return db[_0x6a12('0x5c')]['update'](_0x203871[_0x6a12('0x5a')]['Smtp'],{'where':{'MailAccountId':_0x115344['id']}})['then'](function(){return _0x115344;});}return _0x115344;})[_0x6a12('0x21')](respondWithResult(_0x550d26,null))[_0x6a12('0x2c')](handleError(_0x550d26,null));};exports[_0x6a12('0x5d')]=function(_0x473ddf,_0x491d71){return db[_0x6a12('0x41')][_0x6a12('0x5d')]()['then'](respondWithResult(_0x491d71,null))[_0x6a12('0x2c')](handleError(_0x491d71,null));};exports[_0x6a12('0x5e')]=function(_0x30fff1,_0x2494b8,_0x27e058){if(_0x30fff1[_0x6a12('0x5a')]['id']){delete _0x30fff1['body']['id'];}return db['MailAccount'][_0x6a12('0x5b')]({'where':{'id':_0x30fff1[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x2494b8,null))[_0x6a12('0x21')](function(_0x1bf874){if(_0x1bf874){_0x30fff1[_0x6a12('0x5a')]['MailAccountId']=_0x1bf874['id'];return db[_0x6a12('0x5f')]['create'](_0x30fff1['body']);}})[_0x6a12('0x21')](respondWithResult(_0x2494b8,null))[_0x6a12('0x2c')](handleError(_0x2494b8,null));};exports[_0x6a12('0x60')]=function(_0x5e73d4,_0x367dbd,_0x3ff9bb){var _0x241238={'raw':![],'where':{}};var _0x198298={};var _0x21fe5c={'count':0x0,'rows':[]};return db[_0x6a12('0x41')]['findOne']({'where':{'id':_0x5e73d4['params']['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x367dbd,null))[_0x6a12('0x21')](function(_0x3dc551){if(_0x3dc551){_0x198298['model']=_['keys'](db[_0x6a12('0x5f')][_0x6a12('0x42')]);_0x198298[_0x6a12('0x44')]=_[_0x6a12('0x43')](_0x5e73d4['query']);_0x198298[_0x6a12('0x4d')]=_['intersection'](_0x198298[_0x6a12('0x45')],_0x198298[_0x6a12('0x44')]);_0x241238[_0x6a12('0x46')]=_['intersection'](_0x198298[_0x6a12('0x45')],qs[_0x6a12('0x48')](_0x5e73d4[_0x6a12('0x44')]['fields']));_0x241238['attributes']=_0x241238['attributes']['length']?_0x241238['attributes']:_0x198298['model'];if(!_0x5e73d4['query'][_0x6a12('0x61')](_0x6a12('0x4a'))){_0x241238[_0x6a12('0x31')]=qs[_0x6a12('0x31')](_0x5e73d4['query'][_0x6a12('0x31')]);_0x241238[_0x6a12('0x30')]=qs[_0x6a12('0x30')](_0x5e73d4[_0x6a12('0x44')][_0x6a12('0x30')]);}_0x241238[_0x6a12('0x62')]=qs[_0x6a12('0x4b')](_0x5e73d4[_0x6a12('0x44')][_0x6a12('0x4b')]);_0x241238[_0x6a12('0x4c')]=qs[_0x6a12('0x4d')](_[_0x6a12('0x4e')](_0x5e73d4[_0x6a12('0x44')],_0x198298[_0x6a12('0x4d')]));_0x241238[_0x6a12('0x4c')]['MailAccountId']=_0x3dc551['id'];if(_0x5e73d4[_0x6a12('0x44')]['filter']){_0x241238[_0x6a12('0x4c')]=_[_0x6a12('0x50')](_0x241238[_0x6a12('0x4c')],{'$or':_[_0x6a12('0x51')](_0x241238[_0x6a12('0x46')],function(_0x529d95){var _0x1f1a35={};_0x1f1a35[_0x529d95]={'$like':'%'+_0x5e73d4[_0x6a12('0x44')][_0x6a12('0x4f')]+'%'};return _0x1f1a35;})});}_0x241238=_[_0x6a12('0x50')]({},_0x241238,_0x5e73d4[_0x6a12('0x53')]);return db[_0x6a12('0x5f')][_0x6a12('0x2f')]({'where':_0x241238[_0x6a12('0x4c')]})['then'](function(_0xa0ff9c){_0x21fe5c[_0x6a12('0x2f')]=_0xa0ff9c;if(_0x5e73d4['query'][_0x6a12('0x54')]){_0x241238[_0x6a12('0x55')]=[{'all':!![]}];}return db[_0x6a12('0x5f')][_0x6a12('0x63')](_0x241238);})[_0x6a12('0x21')](function(_0x91b0f){_0x21fe5c[_0x6a12('0x56')]=_0x91b0f;return _0x21fe5c;});}})[_0x6a12('0x21')](respondWithFilteredResult(_0x367dbd,_0x241238))[_0x6a12('0x2c')](handleError(_0x367dbd,null));};exports[_0x6a12('0x64')]=function(_0x458300,_0x56b92f,_0x11b82d){return db[_0x6a12('0x41')][_0x6a12('0x5b')]({'where':{'id':_0x458300[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x56b92f,null))[_0x6a12('0x21')](function(_0x47b334){if(_0x47b334){return _0x47b334[_0x6a12('0x64')](_0x458300[_0x6a12('0x44')][_0x6a12('0x65')]);}})[_0x6a12('0x21')](respondWithStatusCode(_0x56b92f,null))[_0x6a12('0x2c')](handleError(_0x56b92f,null));};exports['addAnswer']=function(_0x17bdf0,_0x353e35,_0x345ec8){if(_0x17bdf0[_0x6a12('0x5a')]['id']){delete _0x17bdf0[_0x6a12('0x5a')]['id'];}return db['MailAccount'][_0x6a12('0x5b')]({'where':{'id':_0x17bdf0[_0x6a12('0x57')]['id']}})['then'](handleEntityNotFound(_0x353e35,null))[_0x6a12('0x21')](function(_0x4e7ee5){if(_0x4e7ee5){_0x17bdf0[_0x6a12('0x5a')][_0x6a12('0x66')]=_0x4e7ee5['id'];return db[_0x6a12('0x67')][_0x6a12('0x68')](_0x17bdf0[_0x6a12('0x5a')]);}})[_0x6a12('0x21')](respondWithResult(_0x353e35,null))[_0x6a12('0x2c')](handleError(_0x353e35,null));};exports[_0x6a12('0x69')]=function(_0x3bc499,_0x2a1f25,_0x118029){var _0x1d037c={'raw':![],'where':{}};var _0x1b513f={};var _0x389bc6={'count':0x0,'rows':[]};return db[_0x6a12('0x41')][_0x6a12('0x6a')]({'where':{'id':_0x3bc499[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x2a1f25,null))['then'](function(_0x63456c){if(_0x63456c){_0x1b513f[_0x6a12('0x45')]=_['keys'](db[_0x6a12('0x67')]['rawAttributes']);_0x1b513f['query']=_['keys'](_0x3bc499[_0x6a12('0x44')]);_0x1b513f[_0x6a12('0x4d')]=_[_0x6a12('0x47')](_0x1b513f[_0x6a12('0x45')],_0x1b513f['query']);_0x1d037c[_0x6a12('0x46')]=_[_0x6a12('0x47')](_0x1b513f[_0x6a12('0x45')],qs[_0x6a12('0x48')](_0x3bc499[_0x6a12('0x44')]['fields']));_0x1d037c[_0x6a12('0x46')]=_0x1d037c[_0x6a12('0x46')][_0x6a12('0x49')]?_0x1d037c[_0x6a12('0x46')]:_0x1b513f[_0x6a12('0x45')];if(!_0x3bc499[_0x6a12('0x44')]['hasOwnProperty'](_0x6a12('0x4a'))){_0x1d037c['limit']=qs[_0x6a12('0x31')](_0x3bc499[_0x6a12('0x44')][_0x6a12('0x31')]);_0x1d037c[_0x6a12('0x30')]=qs[_0x6a12('0x30')](_0x3bc499[_0x6a12('0x44')]['offset']);}_0x1d037c[_0x6a12('0x62')]=qs['sort'](_0x3bc499[_0x6a12('0x44')][_0x6a12('0x4b')]);_0x1d037c[_0x6a12('0x4c')]=qs[_0x6a12('0x4d')](_[_0x6a12('0x4e')](_0x3bc499[_0x6a12('0x44')],_0x1b513f[_0x6a12('0x4d')]));_0x1d037c[_0x6a12('0x4c')][_0x6a12('0x66')]=_0x63456c['id'];if(_0x3bc499[_0x6a12('0x44')]['filter']){_0x1d037c[_0x6a12('0x4c')]=_['merge'](_0x1d037c[_0x6a12('0x4c')],{'$or':_[_0x6a12('0x51')](_0x1d037c[_0x6a12('0x46')],function(_0x2ff244){var _0xb3ad33={};_0xb3ad33[_0x2ff244]={'$like':'%'+_0x3bc499[_0x6a12('0x44')][_0x6a12('0x4f')]+'%'};return _0xb3ad33;})});}_0x1d037c=_['merge']({},_0x1d037c,_0x3bc499[_0x6a12('0x53')]);return db[_0x6a12('0x67')]['count']({'where':_0x1d037c[_0x6a12('0x4c')]})[_0x6a12('0x21')](function(_0x4259dc){_0x389bc6['count']=_0x4259dc;if(_0x3bc499['query'][_0x6a12('0x54')]){_0x1d037c['include']=[{'all':!![]}];}return db[_0x6a12('0x67')][_0x6a12('0x63')](_0x1d037c);})[_0x6a12('0x21')](function(_0x4a6676){_0x389bc6[_0x6a12('0x56')]=_0x4a6676;return _0x389bc6;});}})[_0x6a12('0x21')](respondWithFilteredResult(_0x2a1f25,_0x1d037c))[_0x6a12('0x2c')](handleError(_0x2a1f25,null));};exports[_0x6a12('0x6b')]=function(_0x2c8cc6,_0x1d3432,_0x3258e5){return db['MailAccount']['find']({'where':{'id':_0x2c8cc6[_0x6a12('0x57')]['id']}})['then'](handleEntityNotFound(_0x1d3432,null))[_0x6a12('0x21')](function(_0x2857b9){if(_0x2857b9){return _0x2857b9[_0x6a12('0x6b')](_0x2c8cc6[_0x6a12('0x44')][_0x6a12('0x65')]);}})[_0x6a12('0x21')](respondWithStatusCode(_0x1d3432,null))[_0x6a12('0x2c')](handleError(_0x1d3432,null));};exports[_0x6a12('0x68')]=function(_0x4bbc00,_0x34cdef){var _0x55fc68={'name':_0x4bbc00[_0x6a12('0x5a')]['name'],'key':_0x4bbc00['body'][_0x6a12('0x6c')],'email':_0x4bbc00[_0x6a12('0x5a')][_0x6a12('0x6d')],'ListId':_0x4bbc00[_0x6a12('0x5a')][_0x6a12('0x6e')],'active':!_[_0x6a12('0x6f')](_0x4bbc00['body'][_0x6a12('0x70')])?_0x4bbc00[_0x6a12('0x5a')][_0x6a12('0x70')]:!![],'description':_0x4bbc00['body']['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x4bbc00[_0x6a12('0x5a')]['cservice'])){if(_0x4bbc00[_0x6a12('0x5a')][_0x6a12('0x71')]){_0x55fc68[_0x6a12('0x3f')][_0x6a12('0x72')]=_0x55fc68[_0x6a12('0x58')][_0x6a12('0x72')]=_0x4bbc00[_0x6a12('0x5a')][_0x6a12('0x73')];_0x55fc68[_0x6a12('0x3f')]['password']=_0x55fc68[_0x6a12('0x58')][_0x6a12('0x74')]=_0x4bbc00[_0x6a12('0x5a')][_0x6a12('0x75')];}else{_0x55fc68[_0x6a12('0x3f')]['authentication']=_0x55fc68[_0x6a12('0x58')][_0x6a12('0x76')]=![];}_0x55fc68[_0x6a12('0x3f')][_0x6a12('0x77')]=_0x4bbc00[_0x6a12('0x5a')]['Imap'][_0x6a12('0x77')];_0x55fc68[_0x6a12('0x3f')][_0x6a12('0x78')]=_0x4bbc00[_0x6a12('0x5a')][_0x6a12('0x3f')][_0x6a12('0x78')];_0x55fc68[_0x6a12('0x58')][_0x6a12('0x77')]=_0x4bbc00[_0x6a12('0x5a')][_0x6a12('0x58')][_0x6a12('0x77')];_0x55fc68[_0x6a12('0x58')][_0x6a12('0x78')]=_0x4bbc00['body'][_0x6a12('0x58')][_0x6a12('0x78')];}else{_0x55fc68[_0x6a12('0x3f')][_0x6a12('0x79')]=_0x55fc68[_0x6a12('0x58')][_0x6a12('0x79')]=_0x4bbc00['body'][_0x6a12('0x7a')];_0x55fc68[_0x6a12('0x3f')][_0x6a12('0x72')]=_0x55fc68[_0x6a12('0x58')]['user']=_0x4bbc00['body'][_0x6a12('0x73')];_0x55fc68[_0x6a12('0x3f')][_0x6a12('0x7b')]=_0x55fc68[_0x6a12('0x58')][_0x6a12('0x74')]=_0x4bbc00['body'][_0x6a12('0x75')];}return db[_0x6a12('0x41')][_0x6a12('0x68')](_0x55fc68,{'include':[{'model':db[_0x6a12('0x5c')],'as':_0x6a12('0x58')},{'model':db['MailServerIn'],'as':_0x6a12('0x3f')}]})['then'](function(_0x35b8b9){var _0x2d90c2=_0x4bbc00['user'][_0x6a12('0x37')]({'plain':!![]});if(!_0x2d90c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d90c2[_0x6a12('0x7c')]==='user'){var _0x9c5aab=_0x35b8b9[_0x6a12('0x37')]({'plain':!![]});return db['UserProfileSection'][_0x6a12('0x5b')]({'where':{'name':_0x6a12('0x38'),'userProfileId':_0x2d90c2['userProfileId']},'raw':!![]})[_0x6a12('0x21')](function(_0x41533f){if(_0x41533f&&_0x41533f[_0x6a12('0x7d')]===0x0){return db[_0x6a12('0x39')]['create']({'name':_0x9c5aab[_0x6a12('0x3b')],'resourceId':_0x9c5aab['id'],'type':_0x41533f['name'],'sectionId':_0x41533f['id']},{})['then'](function(){return _0x35b8b9;});}else{return _0x35b8b9;}})['catch'](function(_0x2096e9){logger[_0x6a12('0x28')](_0x6a12('0x7e'),_0x2096e9);throw _0x2096e9;});}return _0x35b8b9;})['then'](respondWithResult(_0x34cdef,0xc9))['catch'](handleError(_0x34cdef,null));};exports[_0x6a12('0x7f')]=function(_0x505458,_0x2d3b38,_0x550307){return db[_0x6a12('0x41')][_0x6a12('0x6a')]({'where':{'id':_0x505458[_0x6a12('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d3b38,null))[_0x6a12('0x21')](function(_0x56b50c){if(_0x56b50c){return _0x56b50c[_0x6a12('0x7f')]();}return null;})[_0x6a12('0x21')](respondWithResult(_0x2d3b38,null))[_0x6a12('0x2c')](handleError(_0x2d3b38,null));};exports['addImap']=function(_0x57afa9,_0x16c173,_0x4f056a){if(_0x57afa9[_0x6a12('0x5a')]['id']){delete _0x57afa9[_0x6a12('0x5a')]['id'];}return db['MailAccount'][_0x6a12('0x5b')]({'where':{'id':_0x57afa9[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x16c173,null))[_0x6a12('0x21')](function(_0x55b37a){if(_0x55b37a){_0x57afa9[_0x6a12('0x5a')]['MailAccountId']=_0x55b37a['id'];return db[_0x6a12('0x3e')][_0x6a12('0x68')](_0x57afa9[_0x6a12('0x5a')]);}})['then'](respondWithResult(_0x16c173,null))[_0x6a12('0x2c')](handleError(_0x16c173,null));};exports[_0x6a12('0x80')]=function(_0x1906b7,_0x1b61e3,_0x27bb4b){return db['MailAccount']['findOne']({'where':{'id':_0x1906b7[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x1b61e3,null))[_0x6a12('0x21')](function(_0x1d6c52){if(_0x1d6c52){return _0x1d6c52[_0x6a12('0x81')](null);}return null;})[_0x6a12('0x21')](respondWithStatusCode(_0x1b61e3,null))['catch'](handleError(_0x1b61e3,null));};exports[_0x6a12('0x82')]=function(_0x54a9ba,_0x5e37a0,_0x2c059e){return db['MailAccount'][_0x6a12('0x6a')]({'where':{'id':_0x54a9ba['params']['id']}})['then'](handleEntityNotFound(_0x5e37a0,null))[_0x6a12('0x21')](function(_0x249871){if(_0x249871){return _0x249871[_0x6a12('0x82')]();}return null;})[_0x6a12('0x21')](respondWithResult(_0x5e37a0,null))[_0x6a12('0x2c')](handleError(_0x5e37a0,null));};exports[_0x6a12('0x83')]=function(_0x3546b8,_0x630e6e,_0x152598){if(_0x3546b8[_0x6a12('0x5a')]['id']){delete _0x3546b8[_0x6a12('0x5a')]['id'];}return db[_0x6a12('0x41')][_0x6a12('0x5b')]({'where':{'id':_0x3546b8['params']['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x630e6e,null))[_0x6a12('0x21')](function(_0x50ba65){if(_0x50ba65){_0x3546b8[_0x6a12('0x5a')][_0x6a12('0x66')]=_0x50ba65['id'];return db[_0x6a12('0x5c')]['create'](_0x3546b8[_0x6a12('0x5a')]);}})['then'](respondWithResult(_0x630e6e,null))['catch'](handleError(_0x630e6e,null));};exports[_0x6a12('0x84')]=function(_0x3d1b6a,_0x152f37,_0x514af6){return db['MailAccount']['findOne']({'where':{'id':_0x3d1b6a[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x152f37,null))['then'](function(_0x353ade){if(_0x353ade){return _0x353ade[_0x6a12('0x85')](null);}return null;})[_0x6a12('0x21')](respondWithStatusCode(_0x152f37,null))[_0x6a12('0x2c')](handleError(_0x152f37,null));};exports[_0x6a12('0x86')]=function(_0x19681d,_0x599a99,_0x1ddcdf){return db[_0x6a12('0x87')]['find']({'where':{'id':_0x19681d[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x599a99,null))['then'](function(_0xaad74e){if(_0xaad74e){return _0xaad74e[_0x6a12('0x86')](_0x19681d[_0x6a12('0x5a')]['ids'],_[_0x6a12('0x88')](_0x19681d['body'],[_0x6a12('0x65'),'id'])||{});}})[_0x6a12('0x21')](respondWithResult(_0x599a99,null))[_0x6a12('0x2c')](handleError(_0x599a99,null));};exports[_0x6a12('0x89')]=function(_0xa7a400,_0x4b5c01,_0x49199e){var _0xe798={'raw':![],'where':{}};var _0x55e407={};var _0x274f8d={'count':0x0,'rows':[]};return db[_0x6a12('0x41')]['findOne']({'where':{'id':_0xa7a400['params']['id']}})['then'](handleEntityNotFound(_0x4b5c01,null))['then'](function(_0x124d75){if(_0x124d75){_0x55e407[_0x6a12('0x45')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x55e407[_0x6a12('0x44')]=_['keys'](_0xa7a400['query']);_0x55e407[_0x6a12('0x4d')]=_['intersection'](_0x55e407['model'],_0x55e407[_0x6a12('0x44')]);_0xe798[_0x6a12('0x46')]=_[_0x6a12('0x47')](_0x55e407[_0x6a12('0x45')],qs[_0x6a12('0x48')](_0xa7a400[_0x6a12('0x44')][_0x6a12('0x48')]));_0xe798[_0x6a12('0x46')]=_0xe798[_0x6a12('0x46')][_0x6a12('0x49')]?_0xe798[_0x6a12('0x46')]:_0x55e407[_0x6a12('0x45')];if(!_0xa7a400[_0x6a12('0x44')][_0x6a12('0x61')](_0x6a12('0x4a'))){_0xe798[_0x6a12('0x31')]=qs[_0x6a12('0x31')](_0xa7a400[_0x6a12('0x44')]['limit']);_0xe798[_0x6a12('0x30')]=qs[_0x6a12('0x30')](_0xa7a400['query'][_0x6a12('0x30')]);}_0xe798[_0x6a12('0x62')]=qs['sort'](_0xa7a400['query']['sort']);_0xe798[_0x6a12('0x4c')]=qs['filters'](_[_0x6a12('0x4e')](_0xa7a400[_0x6a12('0x44')],_0x55e407[_0x6a12('0x4d')]));_0xe798[_0x6a12('0x4c')]['MailAccountId']=_0x124d75['id'];if(_0xa7a400[_0x6a12('0x44')]['filter']){_0xe798[_0x6a12('0x4c')]=_[_0x6a12('0x50')](_0xe798['where'],{'$or':_['map'](_0xe798['attributes'],function(_0x2897a2){var _0x2d4e64={};_0x2d4e64[_0x2897a2]={'$like':'%'+_0xa7a400['query'][_0x6a12('0x4f')]+'%'};return _0x2d4e64;})});}_0xe798=_['merge']({},_0xe798,_0xa7a400[_0x6a12('0x53')]);return db['MailInteraction'][_0x6a12('0x2f')]({'where':_0xe798[_0x6a12('0x4c')]})[_0x6a12('0x21')](function(_0x6e475){_0x274f8d[_0x6a12('0x2f')]=_0x6e475;if(_0xa7a400[_0x6a12('0x44')][_0x6a12('0x54')]){_0xe798['include']=[{'model':db[_0x6a12('0x8a')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x6a12('0x8b'),'attributes':[_0x6a12('0x3b'),_0x6a12('0x8c'),_0x6a12('0x8d')],'required':![]},{'model':db[_0x6a12('0x8e')],'as':_0x6a12('0x8f'),'attributes':['id','name',_0x6a12('0x90')],'where':_0xa7a400[_0x6a12('0x44')][_0x6a12('0x91')]?{'id':_0xa7a400['query']['tag']}:undefined,'required':_0xa7a400['query'][_0x6a12('0x91')]?!![]:![]}];}return db[_0x6a12('0x87')][_0x6a12('0x63')](_0xe798);})['then'](function(_0x426281){_0x274f8d[_0x6a12('0x56')]=_0x426281;return _0x274f8d;});}})['then'](respondWithFilteredResult(_0x4b5c01,_0xe798))[_0x6a12('0x2c')](handleError(_0x4b5c01,null));};exports[_0x6a12('0x92')]=function(_0x1d11c8,_0x203bfd,_0x426a2f){return db[_0x6a12('0x41')]['findOne']({'where':{'id':_0x1d11c8[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x203bfd,null))[_0x6a12('0x21')](function(_0x413aa1){if(_0x413aa1){return db[_0x6a12('0x93')][_0x6a12('0x94')](function(_0x3be953){return db[_0x6a12('0x95')][_0x6a12('0x36')]({'where':{'MailAccountId':_0x1d11c8[_0x6a12('0x57')]['id']},'transaction':_0x3be953})[_0x6a12('0x21')](function(_0x1b157c){var _0x4498d1=_[_0x6a12('0x51')](_0x1d11c8['body'],function(_0x39ac1){_0x39ac1['MailAccountId']=_0x1d11c8['params']['id'];return _0x39ac1;});return db[_0x6a12('0x95')]['bulkCreate'](_0x4498d1,{'transaction':_0x3be953});});})[_0x6a12('0x21')](function(){return db[_0x6a12('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x1d11c8['params']['id']},'order':'priority'});});}})[_0x6a12('0x21')](respondWithResult(_0x203bfd,null))['catch'](handleError(_0x203bfd,null));};exports[_0x6a12('0x96')]=function(_0x50d6ba,_0x4be561,_0x24bb2a){var _0x216db9={};var _0x2b4ea2={};var _0x5e8726;var _0x38fe9c;return db['MailAccount'][_0x6a12('0x6a')]({'where':{'id':_0x50d6ba[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x4be561,null))[_0x6a12('0x21')](function(_0x2b7459){if(_0x2b7459){_0x5e8726=_0x2b7459;_0x2b4ea2[_0x6a12('0x45')]=_['keys'](db[_0x6a12('0x95')][_0x6a12('0x42')]);_0x2b4ea2[_0x6a12('0x44')]=_[_0x6a12('0x43')](_0x50d6ba[_0x6a12('0x44')]);_0x2b4ea2[_0x6a12('0x4d')]=_[_0x6a12('0x47')](_0x2b4ea2[_0x6a12('0x45')],_0x2b4ea2[_0x6a12('0x44')]);_0x216db9['attributes']=_[_0x6a12('0x47')](_0x2b4ea2['model'],qs[_0x6a12('0x48')](_0x50d6ba[_0x6a12('0x44')][_0x6a12('0x48')]));_0x216db9['attributes']=_0x216db9[_0x6a12('0x46')][_0x6a12('0x49')]?_0x216db9[_0x6a12('0x46')]:_0x2b4ea2[_0x6a12('0x45')];_0x216db9[_0x6a12('0x62')]=qs[_0x6a12('0x4b')](_0x50d6ba[_0x6a12('0x44')][_0x6a12('0x4b')]);_0x216db9[_0x6a12('0x4c')]=qs[_0x6a12('0x4d')](_[_0x6a12('0x4e')](_0x50d6ba[_0x6a12('0x44')],_0x2b4ea2[_0x6a12('0x4d')]));if(_0x50d6ba[_0x6a12('0x44')][_0x6a12('0x4f')]){_0x216db9[_0x6a12('0x4c')]=_[_0x6a12('0x50')](_0x216db9[_0x6a12('0x4c')],{'$or':_['map'](_0x216db9['attributes'],function(_0x336a12){var _0x5dd8c8={};_0x5dd8c8[_0x336a12]={'$like':'%'+_0x50d6ba['query'][_0x6a12('0x4f')]+'%'};return _0x5dd8c8;})});}_0x216db9=_[_0x6a12('0x50')]({},_0x216db9,_0x50d6ba[_0x6a12('0x53')]);return _0x5e8726[_0x6a12('0x96')](_0x216db9);}})[_0x6a12('0x21')](function(_0x2dd246){if(_0x2dd246){_0x38fe9c=_0x2dd246[_0x6a12('0x49')];if(!_0x50d6ba['query'][_0x6a12('0x61')]('nolimit')){_0x216db9[_0x6a12('0x31')]=qs[_0x6a12('0x31')](_0x50d6ba[_0x6a12('0x44')][_0x6a12('0x31')]);_0x216db9[_0x6a12('0x30')]=qs[_0x6a12('0x30')](_0x50d6ba['query'][_0x6a12('0x30')]);}return _0x5e8726['getApplications'](_0x216db9);}})[_0x6a12('0x21')](function(_0x36beb1){if(_0x36beb1){return _0x36beb1?{'count':_0x38fe9c,'rows':_0x36beb1}:null;}})[_0x6a12('0x21')](respondWithResult(_0x4be561,null))[_0x6a12('0x2c')](handleError(_0x4be561,null));};exports[_0x6a12('0x97')]=function(_0x1fc79f,_0x26f3d2,_0x3273e9){var _0x1a6e08={'raw':!![],'where':{}};var _0x25ddca={};var _0x32d387={'count':0x0,'rows':[]};return db[_0x6a12('0x41')]['findOne']({'where':{'id':_0x1fc79f[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x26f3d2,null))['then'](function(_0x5ef864){if(_0x5ef864){_0x25ddca['model']=_['keys'](db[_0x6a12('0x98')][_0x6a12('0x42')]);_0x25ddca[_0x6a12('0x44')]=_[_0x6a12('0x43')](_0x1fc79f[_0x6a12('0x44')]);_0x25ddca[_0x6a12('0x4d')]=_['intersection'](_0x25ddca[_0x6a12('0x45')],_0x25ddca[_0x6a12('0x44')]);_0x1a6e08['attributes']=_[_0x6a12('0x47')](_0x25ddca['model'],qs[_0x6a12('0x48')](_0x1fc79f[_0x6a12('0x44')]['fields']));_0x1a6e08['attributes']=_0x1a6e08['attributes']['length']?_0x1a6e08[_0x6a12('0x46')]:_0x25ddca[_0x6a12('0x45')];if(!_0x1fc79f[_0x6a12('0x44')][_0x6a12('0x61')](_0x6a12('0x4a'))){_0x1a6e08[_0x6a12('0x31')]=qs[_0x6a12('0x31')](_0x1fc79f['query'][_0x6a12('0x31')]);_0x1a6e08['offset']=qs['offset'](_0x1fc79f[_0x6a12('0x44')]['offset']);}_0x1a6e08['order']=qs[_0x6a12('0x4b')](_0x1fc79f[_0x6a12('0x44')][_0x6a12('0x4b')]);_0x1a6e08['where']=qs['filters'](_['pick'](_0x1fc79f[_0x6a12('0x44')],_0x25ddca[_0x6a12('0x4d')]));_0x1a6e08[_0x6a12('0x4c')]['MailAccountId']=_0x5ef864['id'];if(_0x1fc79f['query'][_0x6a12('0x4f')]){_0x1a6e08[_0x6a12('0x4c')]=_[_0x6a12('0x50')](_0x1a6e08['where'],{'$or':_[_0x6a12('0x51')](_0x1a6e08[_0x6a12('0x46')],function(_0x4c516b){var _0xba0d05={};_0xba0d05[_0x4c516b]={'$like':'%'+_0x1fc79f['query'][_0x6a12('0x4f')]+'%'};return _0xba0d05;})});}if(_0x1fc79f[_0x6a12('0x44')][_0x6a12('0x99')]){var _0x348444=_0x1fc79f[_0x6a12('0x44')][_0x6a12('0x99')][_0x6a12('0x9a')](',');var _0xce8f42={};_0xce8f42[_0x348444[0x0]]={'$gte':moment(_0x348444[0x1])[_0x6a12('0x9b')](_0x6a12('0x9c'))};_0x1a6e08[_0x6a12('0x4c')]=_[_0x6a12('0x50')](_0x1a6e08[_0x6a12('0x4c')],_0xce8f42);}_0x1a6e08=_[_0x6a12('0x50')]({},_0x1a6e08,_0x1fc79f[_0x6a12('0x53')]);return db[_0x6a12('0x98')][_0x6a12('0x2f')]({'where':_0x1a6e08[_0x6a12('0x4c')]})['then'](function(_0x331057){_0x32d387[_0x6a12('0x2f')]=_0x331057;if(_0x1fc79f[_0x6a12('0x44')][_0x6a12('0x54')]){_0x1a6e08[_0x6a12('0x55')]=[{'all':!![]}];}return db[_0x6a12('0x98')][_0x6a12('0x63')](_0x1a6e08);})[_0x6a12('0x21')](function(_0x45b8ab){_0x32d387[_0x6a12('0x56')]=_0x45b8ab;return _0x32d387;});}})[_0x6a12('0x21')](respondWithFilteredResult(_0x26f3d2,_0x1a6e08))[_0x6a12('0x2c')](handleError(_0x26f3d2,null));};exports[_0x6a12('0x3c')]=function(_0x3b2b6e,_0x4370a1,_0xcc77ad){var _0x45110d,_0x4586f1={},_0x230c24;if(_0x3b2b6e[_0x6a12('0x5a')]['to']){_0x230c24=_0x3b2b6e[_0x6a12('0x5a')]['to'][_0x6a12('0x9a')](',')[0x0];}return db[_0x6a12('0x41')][_0x6a12('0x5b')]({'where':{'id':_0x3b2b6e[_0x6a12('0x57')]['id']},'include':[{'model':db[_0x6a12('0x9d')],'as':_0x6a12('0x9e'),'include':[{'model':db[_0x6a12('0x8a')],'as':_0x6a12('0x9f'),'where':{'email':_0x230c24},'limit':0x1,'order':[['updatedAt',_0x6a12('0xa0')]]}]},{'model':db[_0x6a12('0x5c')],'as':_0x6a12('0x58'),'raw':!![]}]})[_0x6a12('0x21')](handleEntityNotFound(_0x4370a1,null))[_0x6a12('0x21')](function(_0x587527){if(_0x587527){_0x45110d=_0x587527;if(_0x587527['Smtp']){if(_[_0x6a12('0x6f')](_0x3b2b6e['body']['from'])){_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xa1')]=util[_0x6a12('0x9b')](_0x6a12('0xa2'),_0x587527[_0x6a12('0x3b')],_0x587527[_0x6a12('0x6d')]||_0x587527[_0x6a12('0x58')][_0x6a12('0x72')]);}if(_0x3b2b6e[_0x6a12('0x5a')]['attachments']&&_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xa3')][_0x6a12('0x49')]){for(var _0xa2c012=0x0;_0xa2c012<_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xa3')][_0x6a12('0x49')];_0xa2c012+=0x1){_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xa3')][_0xa2c012]={'filename':_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xa3')][_0xa2c012][_0x6a12('0x3b')],'path':path[_0x6a12('0xa4')](config[_0x6a12('0xa5')],_0x6a12('0xa6'),_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xa3')][_0xa2c012]['basename'])};}}var _0x1a3cec={'tls':{'rejectUnauthorized':![]}};if(_[_0x6a12('0x6f')](_0x587527[_0x6a12('0x58')][_0x6a12('0x79')])){if(_0x587527[_0x6a12('0x58')][_0x6a12('0x76')]){_0x1a3cec['auth']={'user':_0x587527[_0x6a12('0x58')][_0x6a12('0x72')],'pass':_0x587527[_0x6a12('0x58')][_0x6a12('0x74')]};}_0x1a3cec[_0x6a12('0x77')]=_0x587527[_0x6a12('0x58')][_0x6a12('0x77')];_0x1a3cec[_0x6a12('0x78')]=_0x587527['Smtp'][_0x6a12('0x78')];_0x1a3cec[_0x6a12('0xa7')]=_0x587527[_0x6a12('0x58')][_0x6a12('0xa7')];}else{_0x1a3cec[_0x6a12('0x79')]=_0x587527[_0x6a12('0x58')][_0x6a12('0x79')];_0x1a3cec[_0x6a12('0xa8')]={'user':_0x587527[_0x6a12('0x58')][_0x6a12('0x72')],'pass':_0x587527[_0x6a12('0x58')]['pass']};}return respondWithRpcPromise('SendMail',_0x6a12('0xa9'),{'account':_0x1a3cec,'message':_0x3b2b6e[_0x6a12('0x5a')]});}else{throw new Error(_0x6a12('0xaa'));}}})[_0x6a12('0x21')](function(_0x49436f){if(_0x49436f){_0x4586f1=_0x49436f;if(_0x45110d[_0x6a12('0x9e')]){if(_0x45110d[_0x6a12('0x9e')][_0x6a12('0x9f')][_0x6a12('0x49')]){return _0x45110d[_0x6a12('0x9e')][_0x6a12('0x9f')][0x0];}else{return db[_0x6a12('0x8a')][_0x6a12('0x68')](_['defaults'](_0x3b2b6e[_0x6a12('0x5a')],{'firstName':_0x3b2b6e[_0x6a12('0x5a')]['to'],'email':_0x3b2b6e[_0x6a12('0x5a')]['to'],'phone':_0x3b2b6e[_0x6a12('0x5a')]['to'],'ListId':_0x45110d[_0x6a12('0x6e')]}));}}else{throw new Error(_0x6a12('0xaa'));}}})['then'](function(_0x15b2f1){if(_0x15b2f1){var _0x5047d3={'UserId':_0x3b2b6e[_0x6a12('0x72')]['id'],'ContactId':_0x15b2f1['id'],'MailAccountId':_0x45110d['id'],'inReplyTo':_0x4586f1[_0x6a12('0xab')],'to':_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xa1')],'cc':_0x3b2b6e[_0x6a12('0x5a')]['cc'],'subject':_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xac')],'attach':_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xad')],'firstMsgDirection':_0x6a12('0xae'),'lastMsgAt':moment()['format'](_0x6a12('0x9c')),'lastMsgDirection':_0x6a12('0xae'),'lastMsgBody':_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0x5a')],'Messages':[_[_0x6a12('0x50')](_0x3b2b6e[_0x6a12('0x5a')],{'messageId':_0x4586f1[_0x6a12('0xab')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x45110d['id'],'UserId':_0x3b2b6e['user']['id'],'ContactId':_0x15b2f1['id']})]};if(_0x3b2b6e[_0x6a12('0x5a')]['Interaction']){_0x5047d3=_[_0x6a12('0x50')](_0x5047d3,_0x3b2b6e[_0x6a12('0x5a')][_0x6a12('0xaf')]);}return db[_0x6a12('0x87')][_0x6a12('0x68')](_0x5047d3,{'include':[{'model':db['MailMessage'],'as':_0x6a12('0xb0')}]});}})[_0x6a12('0x21')](respondWithResult(_0x4370a1,null))[_0x6a12('0x2c')](handleError(_0x4370a1,null));};exports['verifySmtp']=function(_0x66ce9c,_0x5432d0,_0x373c26){return db[_0x6a12('0x41')][_0x6a12('0x5b')]({'where':{'id':_0x66ce9c[_0x6a12('0x57')]['id']},'include':[{'model':db[_0x6a12('0x5c')],'as':_0x6a12('0x58'),'raw':!![]}]})[_0x6a12('0x21')](handleEntityNotFound(_0x5432d0,null))[_0x6a12('0x21')](function(_0x132c0e){if(_0x132c0e&&_0x132c0e[_0x6a12('0x58')]){var _0x219c2a={'id':_0x132c0e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x132c0e[_0x6a12('0x58')][_0x6a12('0x79')]){_0x219c2a[_0x6a12('0x79')]=_0x132c0e[_0x6a12('0x58')]['service'];}else{_0x219c2a[_0x6a12('0x77')]=_0x132c0e[_0x6a12('0x58')][_0x6a12('0x77')];_0x219c2a[_0x6a12('0x78')]=_0x132c0e[_0x6a12('0x58')][_0x6a12('0x78')];_0x219c2a[_0x6a12('0xa7')]=_0x132c0e[_0x6a12('0x58')][_0x6a12('0xa7')];}if(_0x132c0e[_0x6a12('0x58')]['authentication']){_0x219c2a['auth']={'user':_0x132c0e[_0x6a12('0x58')][_0x6a12('0x72')],'pass':_0x132c0e['Smtp'][_0x6a12('0x74')]};}return respondWithRpcPromise(_0x6a12('0xb1'),_0x6a12('0xb2'),{'account':_0x219c2a});}})[_0x6a12('0x21')](respondWithResult(_0x5432d0,null))[_0x6a12('0x2c')](handleError(_0x5432d0,null));};exports[_0x6a12('0x36')]=function(_0xdf78be,_0x2388b4){return db[_0x6a12('0x41')][_0x6a12('0x5b')]({'where':{'id':_0xdf78be[_0x6a12('0x57')]['id']}})['then'](handleEntityNotFound(_0x2388b4,null))[_0x6a12('0x21')](function(_0x5b8a69){if(_0x5b8a69&&_0x5b8a69[_0x6a12('0x79')]){throw new db[(_0x6a12('0x1d'))]['ValidationError'](_0x6a12('0xb3'));}return _0x5b8a69;})[_0x6a12('0x21')](removeEntity(_0x2388b4,null))['catch'](handleError(_0x2388b4,null));};exports[_0x6a12('0xb4')]=function(_0x191f76,_0x418ace,_0x770627){return db[_0x6a12('0x41')][_0x6a12('0x5b')]({'where':{'id':_0x191f76[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x418ace,null))[_0x6a12('0x21')](function(_0x1c88ac){if(_0x1c88ac){return _0x1c88ac['addAgents'](_0x191f76['body']['ids'],_[_0x6a12('0x88')](_0x191f76[_0x6a12('0x5a')],[_0x6a12('0x65'),'id'])||{})[_0x6a12('0xb5')](function(_0x5eac77){for(var _0x14d971=0x0;_0x14d971<_0x191f76[_0x6a12('0x5a')][_0x6a12('0x65')][_0x6a12('0x49')];_0x14d971+=0x1){socket['emit'](_0x6a12('0xb6'),{'UserId':_0x191f76[_0x6a12('0x5a')][_0x6a12('0x65')][_0x14d971],'MailAccountId':_0x191f76[_0x6a12('0x57')]['id']});}return _0x5eac77;});}})['then'](respondWithResult(_0x418ace,null))[_0x6a12('0x2c')](handleError(_0x418ace,null));};exports[_0x6a12('0xb7')]=function(_0x263509,_0x536260,_0x10f074){return db[_0x6a12('0x41')][_0x6a12('0x5b')]({'where':{'id':_0x263509[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x536260,null))['then'](function(_0x3c3b47){if(_0x3c3b47){return _0x3c3b47[_0x6a12('0xb7')](_0x263509[_0x6a12('0x44')][_0x6a12('0x65')])[_0x6a12('0x21')](function(){if(_['isArray'](_0x263509['query'][_0x6a12('0x65')])){for(var _0x307779=0x0;_0x307779<_0x263509[_0x6a12('0x44')][_0x6a12('0x65')][_0x6a12('0x49')];_0x307779+=0x1){socket[_0x6a12('0xb8')](_0x6a12('0xb9'),{'UserId':Number(_0x263509['query'][_0x6a12('0x65')][_0x307779]),'MailAccountId':Number(_0x263509[_0x6a12('0x57')]['id'])});}}else{socket['emit'](_0x6a12('0xb9'),{'UserId':Number(_0x263509[_0x6a12('0x44')]['ids']),'MailAccountId':Number(_0x263509['params']['id'])});}});}})['then'](respondWithStatusCode(_0x536260,null))['catch'](handleError(_0x536260,null));};exports[_0x6a12('0xba')]=function(_0x4bb855,_0x54ee01,_0x2a086d){var _0x3dd1da={};var _0xcbc92b={};var _0x17e057;var _0x1fd7de;return db[_0x6a12('0x41')][_0x6a12('0x6a')]({'where':{'id':_0x4bb855[_0x6a12('0x57')]['id']}})[_0x6a12('0x21')](handleEntityNotFound(_0x54ee01,null))['then'](function(_0x523141){if(_0x523141){_0x17e057=_0x523141;_0xcbc92b[_0x6a12('0x45')]=_[_0x6a12('0x43')](db[_0x6a12('0xbb')][_0x6a12('0x42')]);_0xcbc92b[_0x6a12('0x44')]=_[_0x6a12('0x43')](_0x4bb855['query']);_0xcbc92b[_0x6a12('0x4d')]=_[_0x6a12('0x47')](_0xcbc92b['model'],_0xcbc92b['query']);_0x3dd1da[_0x6a12('0x46')]=_[_0x6a12('0x47')](_0xcbc92b[_0x6a12('0x45')],qs['fields'](_0x4bb855['query'][_0x6a12('0x48')]));_0x3dd1da[_0x6a12('0x46')]=_0x3dd1da['attributes'][_0x6a12('0x49')]?_0x3dd1da['attributes']:_0xcbc92b[_0x6a12('0x45')];_0x3dd1da[_0x6a12('0x62')]=qs[_0x6a12('0x4b')](_0x4bb855[_0x6a12('0x44')][_0x6a12('0x4b')]);_0x3dd1da[_0x6a12('0x4c')]=qs['filters'](_[_0x6a12('0x4e')](_0x4bb855['query'],_0xcbc92b['filters']));if(_0x4bb855[_0x6a12('0x44')][_0x6a12('0x4f')]){_0x3dd1da[_0x6a12('0x4c')]=_[_0x6a12('0x50')](_0x3dd1da[_0x6a12('0x4c')],{'$or':_[_0x6a12('0x51')](_0x3dd1da[_0x6a12('0x46')],function(_0x4ee3e5){var _0x42784a={};_0x42784a[_0x4ee3e5]={'$like':'%'+_0x4bb855['query'][_0x6a12('0x4f')]+'%'};return _0x42784a;})});}_0x3dd1da=_[_0x6a12('0x50')]({},_0x3dd1da,_0x4bb855[_0x6a12('0x53')]);return _0x17e057[_0x6a12('0xba')](_0x3dd1da);}})[_0x6a12('0x21')](function(_0xdc9040){if(_0xdc9040){_0x1fd7de=_0xdc9040['length'];if(!_0x4bb855['query'][_0x6a12('0x61')](_0x6a12('0x4a'))){_0x3dd1da['limit']=qs[_0x6a12('0x31')](_0x4bb855[_0x6a12('0x44')][_0x6a12('0x31')]);_0x3dd1da[_0x6a12('0x30')]=qs['offset'](_0x4bb855[_0x6a12('0x44')]['offset']);}return _0x17e057['getAgents'](_0x3dd1da);}})[_0x6a12('0x21')](function(_0x34b3d3){if(_0x34b3d3){return _0x34b3d3?{'count':_0x1fd7de,'rows':_0x34b3d3}:null;}})[_0x6a12('0x21')](respondWithResult(_0x54ee01,null))[_0x6a12('0x2c')](handleError(_0x54ee01,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3ace7e1..ab8d9f1 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 _0xf836=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','MailAccount'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xf836,0x1be));var _0x6f83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf836[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x6f83('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x6f83('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6f83('0x2')](0x0);var events={'afterCreate':_0x6f83('0x3'),'afterUpdate':'update','afterDestroy':_0x6f83('0x4')};function emitEvent(_0x9a5f37){return function(_0x1f3575,_0x319096,_0x1712f9){MailAccountEvents[_0x6f83('0x5')](_0x9a5f37+':'+_0x1f3575['id'],_0x1f3575);MailAccountEvents[_0x6f83('0x5')](_0x9a5f37,_0x1f3575);_0x1712f9(null);};}for(var e in events){if(events[_0x6f83('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x6f83('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x16b0=['MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x315cb2,_0x125be9){var _0x4db4cd=function(_0x1e986b){while(--_0x1e986b){_0x315cb2['push'](_0x315cb2['shift']());}};_0x4db4cd(++_0x125be9);}(_0x16b0,0x1a3));var _0x016b=function(_0x585d34,_0x540190){_0x585d34=_0x585d34-0x0;var _0x470b12=_0x16b0[_0x585d34];return _0x470b12;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x016b('0x0'))['db'][_0x016b('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x016b('0x2')](0x0);var events={'afterCreate':_0x016b('0x3'),'afterUpdate':_0x016b('0x4'),'afterDestroy':_0x016b('0x5')};function emitEvent(_0x8e0b54){return function(_0x4db80a,_0x1ebbb1,_0x305abc){MailAccountEvents[_0x016b('0x6')](_0x8e0b54+':'+_0x4db80a['id'],_0x4db80a);MailAccountEvents[_0x016b('0x6')](_0x8e0b54,_0x4db80a);_0x305abc(null);};}for(var e in events){if(events[_0x016b('0x7')](e)){var event=events[e];MailAccount[_0x016b('0x8')](e,emitEvent(event));}}module[_0x016b('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index bcad1d6..6981df3 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 _0xd138=['lodash','util','../../config/logger','request-promise','../../config/environment','MailAccount','mail_accounts'];(function(_0x2cbe23,_0x37ab7d){var _0x4b5de0=function(_0x333e31){while(--_0x333e31){_0x2cbe23['push'](_0x2cbe23['shift']());}};_0x4b5de0(++_0x37ab7d);}(_0xd138,0x1dc));var _0x8d13=function(_0x128e19,_0x3c02d7){_0x128e19=_0x128e19-0x0;var _0x449ca0=_0xd138[_0x128e19];return _0x449ca0;};'use strict';var _=require(_0x8d13('0x0'));var util=require(_0x8d13('0x1'));var logger=require(_0x8d13('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8d13('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d13('0x4'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x5c1a82,_0x5a1efe){return _0x5c1a82['define'](_0x8d13('0x5'),attributes,{'tableName':_0x8d13('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb945=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts'];(function(_0x4812ce,_0x5e3d1d){var _0x5af421=function(_0x43f6ce){while(--_0x43f6ce){_0x4812ce['push'](_0x4812ce['shift']());}};_0x5af421(++_0x5e3d1d);}(_0xb945,0x120));var _0x5b94=function(_0x7e3da1,_0x292ddb){_0x7e3da1=_0x7e3da1-0x0;var _0x5c6ac9=_0xb945[_0x7e3da1];return _0x5c6ac9;};'use strict';var _=require(_0x5b94('0x0'));var util=require('util');var logger=require(_0x5b94('0x1'))(_0x5b94('0x2'));var moment=require('moment');var BPromise=require(_0x5b94('0x3'));var rp=require(_0x5b94('0x4'));var fs=require('fs');var path=require(_0x5b94('0x5'));var rimraf=require(_0x5b94('0x6'));var config=require(_0x5b94('0x7'));var attributes=require(_0x5b94('0x8'));module['exports']=function(_0x22b4bd,_0xea940c){return _0x22b4bd[_0x5b94('0x9')](_0x5b94('0xa'),attributes,{'tableName':_0x5b94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a5ae5fe..ed93409 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 _0x902b=['UserId','User','name','unshift','agent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','./mailAccount.socket','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowMailAccount','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','asc','autoclose','push','length','*,*,*,*','defaults','List\x20not\x20found','messageId','generate','subject','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','attach','format','interaction','contact','attachments','originTo','originCc','Attachment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x902b,0x6a));var _0xb902=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x902b[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0xb902('0x0'));var util=require('util');var moment=require(_0xb902('0x1'));var BPromise=require(_0xb902('0x2'));var rs=require(_0xb902('0x3'));var fs=require('fs');var Redis=require(_0xb902('0x4'));var db=require(_0xb902('0x5'))['db'];var utils=require(_0xb902('0x6'));var logger=require('../../config/logger')(_0xb902('0x7'));var config=require('../../config/environment');var jayson=require(_0xb902('0x8'));var client=jayson['client'][_0xb902('0x9')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb902('0xa')]));require(_0xb902('0xb'))['register'](socket);function respondWithRpcPromise(_0x5a4769,_0xf7d3da,_0x2cfedd){return new BPromise(function(_0x19ea79,_0x1cf8dd){return client[_0xb902('0xc')](_0x5a4769,_0x2cfedd)[_0xb902('0xd')](function(_0x550558){logger[_0xb902('0xe')]('MailAccount,\x20%s,\x20%s',_0xf7d3da,_0xb902('0xf'));logger[_0xb902('0x10')](_0xb902('0x11'),_0xf7d3da,_0xb902('0xf'),JSON['stringify'](_0x550558));if(_0x550558['error']){if(_0x550558[_0xb902('0x12')][_0xb902('0x13')]===0x1f4){logger['error'](_0xb902('0x14'),_0xf7d3da,_0x550558[_0xb902('0x12')][_0xb902('0x15')]);return _0x1cf8dd(_0x550558[_0xb902('0x12')][_0xb902('0x15')]);}logger[_0xb902('0x12')]('MailAccount,\x20%s,\x20%s',_0xf7d3da,_0x550558[_0xb902('0x12')][_0xb902('0x15')]);return _0x19ea79(_0x550558[_0xb902('0x12')][_0xb902('0x15')]);}else{logger[_0xb902('0xe')]('MailAccount,\x20%s,\x20%s',_0xf7d3da,_0xb902('0xf'));_0x19ea79(_0x550558[_0xb902('0x16')][_0xb902('0x15')]);}})[_0xb902('0x17')](function(_0x4a474e){logger[_0xb902('0x12')]('MailAccount,\x20%s,\x20%s',_0xf7d3da,_0x4a474e);_0x1cf8dd(_0x4a474e);});});}exports[_0xb902('0x18')]=function(_0x11bad2){var _0x13ca9e=this;return new Promise(function(_0x598441,_0x5531fa){return db[_0xb902('0x19')][_0xb902('0x1a')]({'raw':_0x11bad2[_0xb902('0x1b')]?_0x11bad2['options'][_0xb902('0x1c')]===undefined?!![]:![]:!![],'where':_0x11bad2[_0xb902('0x1b')]?_0x11bad2[_0xb902('0x1b')][_0xb902('0x1d')]||null:null,'attributes':_0x11bad2[_0xb902('0x1b')]?_0x11bad2[_0xb902('0x1b')][_0xb902('0x1e')]||null:null,'limit':_0x11bad2[_0xb902('0x1b')]?_0x11bad2[_0xb902('0x1b')][_0xb902('0x1f')]||null:null,'include':_0x11bad2['options']?_0x11bad2[_0xb902('0x1b')][_0xb902('0x20')]?_[_0xb902('0x21')](_0x11bad2['options'][_0xb902('0x20')],function(_0x5cc191){return{'model':db[_0x5cc191[_0xb902('0x22')]],'as':_0x5cc191['as'],'attributes':_0x5cc191[_0xb902('0x1e')],'include':_0x5cc191['include']?_[_0xb902('0x21')](_0x5cc191[_0xb902('0x20')],function(_0x18a74f){return{'model':db[_0x18a74f[_0xb902('0x22')]],'as':_0x18a74f['as'],'attributes':_0x18a74f['attributes'],'include':_0x18a74f[_0xb902('0x20')]?_[_0xb902('0x21')](_0x18a74f[_0xb902('0x20')],function(_0x54bcbd){return{'model':db[_0x54bcbd[_0xb902('0x22')]],'as':_0x54bcbd['as'],'attributes':_0x54bcbd[_0xb902('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb902('0xd')](function(_0x4e4810){logger['info'](_0xb902('0x18'),_0x11bad2);logger[_0xb902('0x10')](_0xb902('0x18'),_0x11bad2,JSON[_0xb902('0x23')](_0x4e4810));_0x598441(_0x4e4810);})[_0xb902('0x17')](function(_0x3ce95c){logger[_0xb902('0x12')]('GetMailAccount',_0x3ce95c[_0xb902('0x15')],_0x11bad2);_0x5531fa(_0x13ca9e[_0xb902('0x12')](0x1f4,_0x3ce95c[_0xb902('0x15')]));});});};exports['ShowMailAccount']=function(_0x9b17ef){var _0x24d361=this;return new Promise(function(_0x4978f1,_0xce9374){return db[_0xb902('0x19')][_0xb902('0x24')]({'raw':_0x9b17ef[_0xb902('0x1b')]?_0x9b17ef['options'][_0xb902('0x1c')]===undefined?!![]:![]:!![],'where':_0x9b17ef['options']?_0x9b17ef['options'][_0xb902('0x1d')]||null:null,'attributes':_0x9b17ef[_0xb902('0x1b')]?_0x9b17ef[_0xb902('0x1b')][_0xb902('0x1e')]||null:null,'include':_0x9b17ef['options']?_0x9b17ef[_0xb902('0x1b')]['include']?_[_0xb902('0x21')](_0x9b17ef[_0xb902('0x1b')]['include'],function(_0x35218c){return{'model':db[_0x35218c[_0xb902('0x22')]],'as':_0x35218c['as'],'attributes':_0x35218c['attributes'],'include':_0x35218c[_0xb902('0x20')]?_[_0xb902('0x21')](_0x35218c[_0xb902('0x20')],function(_0x2ad5e0){return{'model':db[_0x2ad5e0[_0xb902('0x22')]],'as':_0x2ad5e0['as'],'attributes':_0x2ad5e0[_0xb902('0x1e')],'include':_0x2ad5e0[_0xb902('0x20')]?_[_0xb902('0x21')](_0x2ad5e0['include'],function(_0x56b180){return{'model':db[_0x56b180[_0xb902('0x22')]],'as':_0x56b180['as'],'attributes':_0x56b180[_0xb902('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb902('0xd')](function(_0x35802){logger[_0xb902('0xe')](_0xb902('0x25'),_0x9b17ef);logger[_0xb902('0x10')](_0xb902('0x25'),_0x9b17ef,JSON[_0xb902('0x23')](_0x35802));_0x4978f1(_0x35802);})[_0xb902('0x17')](function(_0x1ed101){logger[_0xb902('0x12')](_0xb902('0x25'),_0x1ed101[_0xb902('0x15')],_0x9b17ef);_0xce9374(_0x24d361[_0xb902('0x12')](0x1f4,_0x1ed101[_0xb902('0x15')]));});});};exports['NotifyMailAccount']=function(_0x3e5542){var _0x41508d=this;return new Promise(function(_0x18c716,_0x1336c6){var _0x32b9e2={'body':_0x3e5542['body'],'channel':'mail'};var _0x582906=_['difference'](_[_0xb902('0x26')](db[_0xb902('0x27')][_0xb902('0x28')]),[_0xb902('0x29'),_0xb902('0x2a'),_0xb902('0x2b'),_0xb902('0x2c')]);var _0x5e54d4=![];if(_0x3e5542[_0xb902('0x2d')]['id']){delete _0x3e5542['body']['id'];}if(_['isNil'](_0x3e5542['body'][_0xb902('0x2e')])){return _0x1336c6(_0x41508d[_0xb902('0x12')](0x1f4,_0xb902('0x2f')));}if(_['isNil'](_0x3e5542[_0xb902('0x2d')][_0xb902('0x2d')])||_0x3e5542[_0xb902('0x2d')]['body']===''){return _0x1336c6(_0x41508d[_0xb902('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xb902('0x30')](_0x3e5542['body'][_0xb902('0x31')])){return _0x1336c6(_0x41508d[_0xb902('0x12')](0x1f4,_0xb902('0x32')+_0x582906));}if(!_['includes'](_0x582906,_0x3e5542[_0xb902('0x2d')]['mapKey'])){return _0x1336c6(_0x41508d[_0xb902('0x12')](0x1f4,_0xb902('0x33')+_0x582906));}var _0x447fbd={};_0x447fbd[_0x3e5542[_0xb902('0x2d')]['mapKey']]=_0x3e5542['body'][_0xb902('0x2e')];return db[_0xb902('0x19')][_0xb902('0x24')]({'where':{'id':_0x3e5542[_0xb902('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0xb902('0x35'),'include':[{'model':db['CmContact'],'as':_0xb902('0x36'),'where':_0x447fbd,'limit':0x1,'order':[['updatedAt',_0xb902('0x37')]]}]},{'model':db[_0xb902('0x38')],'as':_0xb902('0x39')},{'model':db[_0xb902('0x3a')],'as':_0xb902('0x3b')}]})[_0xb902('0xd')](function(_0x302e12){if(_0x302e12&&_0x302e12[_0xb902('0x35')]){var _0x179d80=_0x302e12[_0xb902('0x3c')]({'plain':!![]});_0x32b9e2[_0xb902('0x34')]=_[_0xb902('0x3d')](_0x179d80,[_0xb902('0x39'),_0xb902('0x35')]);_0x32b9e2[_0xb902('0x3e')]=_0x179d80['Applications'];_0x32b9e2[_0xb902('0x3f')]=_0x179d80[_0xb902('0x35')];_0x32b9e2[_0xb902('0x3e')]=_[_0xb902('0x40')](_0x32b9e2[_0xb902('0x3e')],['priority'],[_0xb902('0x41')]);if(_0x32b9e2[_0xb902('0x34')]&&_0x32b9e2['account'][_0xb902('0x42')]){_0x32b9e2['applications'][_0xb902('0x43')]({'id':0x0,'priority':_0x32b9e2[_0xb902('0x3e')][_0xb902('0x44')]+0x1,'app':'close','appdata':_0xb902('0x42'),'interval':_0xb902('0x45')});}if(_0x32b9e2[_0xb902('0x34')][_0xb902('0x39')]){delete _0x32b9e2[_0xb902('0x34')]['Applications'];}if(_0x32b9e2[_0xb902('0x34')][_0xb902('0x35')]){delete _0x32b9e2[_0xb902('0x34')][_0xb902('0x35')];}if(_0x179d80[_0xb902('0x35')][_0xb902('0x36')]['length']){return _0x179d80[_0xb902('0x35')]['Contacts'][0x0];}var _0x4b22e2=_[_0xb902('0x46')](_0x3e5542['body'],{'firstName':_0x3e5542['body'][_0xb902('0x2e')],'ListId':_0x179d80[_0xb902('0x2c')]});_0x4b22e2[_0x3e5542['body'][_0xb902('0x31')]]=_0x3e5542[_0xb902('0x2d')][_0xb902('0x2e')];return db[_0xb902('0x27')]['create'](_0x4b22e2);}else{throw new Error(_0xb902('0x47'));}})['then'](function(_0x306ddc){_0x32b9e2['contact']=_0x306ddc;if(_0x306ddc){if(!_0x3e5542['body'][_0xb902('0x15')][_0xb902('0x48')]){_0x3e5542[_0xb902('0x2d')]['message']['messageId']=rs[_0xb902('0x49')]()+'\x20'+_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')][_0xb902('0x2e')];}var _0xef616e={'ContactId':_0x306ddc['id'],'MailAccountId':_0x3e5542[_0xb902('0x34')]['id'],'inReplyTo':_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')][_0xb902('0x48')],'to':_0x3e5542['body'][_0xb902('0x15')][_0xb902('0x2e')],'cc':_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')]['cc'],'subject':_0x3e5542['body']['message'][_0xb902('0x4a')],'attach':_0x3e5542[_0xb902('0x2d')]['message']['attach'],'lastMsgAt':moment()['format'](_0xb902('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0x3e5542['body'][_0xb902('0x2d')]};return db[_0xb902('0x4c')][_0xb902('0x24')]({'where':{'closed':![],'MailAccountId':_0x3e5542['account']['id']},'include':[{'model':db[_0xb902('0x4d')],'as':_0xb902('0x4e'),'attributes':[_0xb902('0x48')],'where':{'messageId':_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')][_0xb902('0x4f')]}}]})[_0xb902('0xd')](function(_0x1b5bc4){if(_0x1b5bc4){return[_0x1b5bc4,![]];}return db[_0xb902('0x4c')][_0xb902('0x50')](_0xef616e)[_0xb902('0xd')](function(_0x312e75){return[_0x312e75,!![]];});});}else{throw new Error(_0xb902('0x51'));}})[_0xb902('0x52')](function(_0x1a6646,_0x2870fc){if(_0x1a6646){_0x5e54d4=_0x2870fc;if(!_0x2870fc){return _0x1a6646[_0xb902('0x53')]({'inReplyTo':_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')][_0xb902('0x48')],'to':_0x3e5542['body'][_0xb902('0x15')]['from'],'cc':_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')]['cc'],'subject':_0x3e5542['body'][_0xb902('0x15')]['subject'],'attach':_0x1a6646[_0xb902('0x54')]?_0x1a6646[_0xb902('0x54')]:_0x3e5542['body'][_0xb902('0x15')][_0xb902('0x54')],'substatus':null,'substatusAt':moment()[_0xb902('0x55')](_0xb902('0x4b')),'lastMsgAt':moment()[_0xb902('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x3e5542[_0xb902('0x2d')][_0xb902('0x2d')]});}else{return _0x1a6646;}}})['then'](function(_0x43267b){_0x32b9e2[_0xb902('0x56')]=_0x43267b[_0xb902('0x3c')]({'plain':!![]});_0x32b9e2[_0xb902('0x56')]['created']=_0x5e54d4;return db[_0xb902('0x4d')]['create']({'body':_0x3e5542[_0xb902('0x2d')][_0xb902('0x2d')],'MailAccountId':_0x3e5542[_0xb902('0x34')]['id'],'MailInteractionId':_0x43267b['id'],'direction':'in','ContactId':_0x32b9e2[_0xb902('0x57')]['id'],'messageId':_0x3e5542[_0xb902('0x2d')]['message'][_0xb902('0x48')],'from':_0x3e5542['body'][_0xb902('0x15')][_0xb902('0x2e')],'to':_0x3e5542['body'][_0xb902('0x15')]['to'],'cc':_0x3e5542['body'][_0xb902('0x15')]['cc'],'subject':_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')][_0xb902('0x4a')],'attach':_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')][_0xb902('0x54')],'Attachments':_0x3e5542[_0xb902('0x2d')]['message'][_0xb902('0x58')],'originTo':_0x3e5542['body'][_0xb902('0x15')][_0xb902('0x59')],'originCc':_0x3e5542[_0xb902('0x2d')][_0xb902('0x15')][_0xb902('0x5a')],'bcc':_0x3e5542['body']['message']['bcc']},{'include':[{'model':db[_0xb902('0x5b')],'as':'Attachments'}]});})[_0xb902('0xd')](function(_0x413456){_0x32b9e2[_0xb902('0x15')]=_0x413456;if(_0x32b9e2[_0xb902('0x56')][_0xb902('0x5c')]){return db[_0xb902('0x5d')][_0xb902('0x24')]({'attributes':['id',_0xb902('0x5e')],'where':{'id':_0x32b9e2['interaction'][_0xb902('0x5c')]}})[_0xb902('0xd')](function(_0x3f6b69){if(_0x3f6b69){_0x32b9e2[_0xb902('0x3e')][_0xb902('0x5f')]({'id':0x0,'priority':0x0,'app':_0xb902('0x60'),'appdata':_0x3f6b69[_0xb902('0x5e')]+','+(_0x32b9e2['account']['waitForTheAssignedAgent']||0xa),'interval':_0xb902('0x45')});}return respondWithRpcPromise(_0xb902('0x61'),'startRouting',_0x32b9e2);});}return respondWithRpcPromise(_0xb902('0x61'),_0xb902('0x62'),_0x32b9e2);})[_0xb902('0xd')](function(_0x244bc8){_0x18c716(_0x244bc8);})[_0xb902('0x17')](function(_0x2579c2){_0x1336c6(_0x41508d[_0xb902('0x12')](0x1f4,_0x2579c2[_0xb902('0x15')]));});});}; \ No newline at end of file +var _0x5b05=['request','then','info','request\x20sent','debug','stringify','error','message','MailAccount,\x20%s,\x20%s','result','findAll','options','raw','attributes','limit','include','model','map','GetMailAccount','catch','ShowMailAccount','MailAccount','where','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','omit','applications','list','priority','asc','push','length','autoclose','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','attach','interaction','created','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailAccount.socket','register'];(function(_0x293614,_0x2fa0cc){var _0x583a11=function(_0x555149){while(--_0x555149){_0x293614['push'](_0x293614['shift']());}};_0x583a11(++_0x2fa0cc);}(_0x5b05,0x190));var _0x55b0=function(_0x215ae1,_0x69674c){_0x215ae1=_0x215ae1-0x0;var _0x39a4d7=_0x5b05[_0x215ae1];return _0x39a4d7;};'use strict';var _=require('lodash');var util=require(_0x55b0('0x0'));var moment=require(_0x55b0('0x1'));var BPromise=require(_0x55b0('0x2'));var rs=require(_0x55b0('0x3'));var fs=require('fs');var Redis=require(_0x55b0('0x4'));var db=require(_0x55b0('0x5'))['db'];var utils=require(_0x55b0('0x6'));var logger=require(_0x55b0('0x7'))(_0x55b0('0x8'));var config=require(_0x55b0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55b0('0xa')]({'port':0x232c});config[_0x55b0('0xb')]=_[_0x55b0('0xc')](config[_0x55b0('0xb')],{'host':_0x55b0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55b0('0xb')]));require(_0x55b0('0xe'))[_0x55b0('0xf')](socket);function respondWithRpcPromise(_0x4cd5d3,_0x5891e7,_0x4fe38b){return new BPromise(function(_0x8e8bd5,_0x39b3ae){return client[_0x55b0('0x10')](_0x4cd5d3,_0x4fe38b)[_0x55b0('0x11')](function(_0x2a4431){logger[_0x55b0('0x12')]('MailAccount,\x20%s,\x20%s',_0x5891e7,_0x55b0('0x13'));logger[_0x55b0('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5891e7,_0x55b0('0x13'),JSON[_0x55b0('0x15')](_0x2a4431));if(_0x2a4431[_0x55b0('0x16')]){if(_0x2a4431[_0x55b0('0x16')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x5891e7,_0x2a4431[_0x55b0('0x16')]['message']);return _0x39b3ae(_0x2a4431[_0x55b0('0x16')][_0x55b0('0x17')]);}logger['error'](_0x55b0('0x18'),_0x5891e7,_0x2a4431[_0x55b0('0x16')][_0x55b0('0x17')]);return _0x8e8bd5(_0x2a4431[_0x55b0('0x16')][_0x55b0('0x17')]);}else{logger['info'](_0x55b0('0x18'),_0x5891e7,_0x55b0('0x13'));_0x8e8bd5(_0x2a4431[_0x55b0('0x19')]['message']);}})['catch'](function(_0x1927d1){logger[_0x55b0('0x16')](_0x55b0('0x18'),_0x5891e7,_0x1927d1);_0x39b3ae(_0x1927d1);});});}exports['GetMailAccount']=function(_0x278963){var _0x26e153=this;return new Promise(function(_0x36392e,_0x3ff56c){return db['MailAccount'][_0x55b0('0x1a')]({'raw':_0x278963[_0x55b0('0x1b')]?_0x278963[_0x55b0('0x1b')][_0x55b0('0x1c')]===undefined?!![]:![]:!![],'where':_0x278963['options']?_0x278963[_0x55b0('0x1b')]['where']||null:null,'attributes':_0x278963[_0x55b0('0x1b')]?_0x278963['options'][_0x55b0('0x1d')]||null:null,'limit':_0x278963[_0x55b0('0x1b')]?_0x278963[_0x55b0('0x1b')][_0x55b0('0x1e')]||null:null,'include':_0x278963[_0x55b0('0x1b')]?_0x278963[_0x55b0('0x1b')][_0x55b0('0x1f')]?_['map'](_0x278963[_0x55b0('0x1b')]['include'],function(_0x494092){return{'model':db[_0x494092[_0x55b0('0x20')]],'as':_0x494092['as'],'attributes':_0x494092[_0x55b0('0x1d')],'include':_0x494092['include']?_[_0x55b0('0x21')](_0x494092['include'],function(_0x586d1b){return{'model':db[_0x586d1b[_0x55b0('0x20')]],'as':_0x586d1b['as'],'attributes':_0x586d1b[_0x55b0('0x1d')],'include':_0x586d1b[_0x55b0('0x1f')]?_[_0x55b0('0x21')](_0x586d1b[_0x55b0('0x1f')],function(_0x20385f){return{'model':db[_0x20385f[_0x55b0('0x20')]],'as':_0x20385f['as'],'attributes':_0x20385f[_0x55b0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x55b0('0x11')](function(_0x443d20){logger[_0x55b0('0x12')](_0x55b0('0x22'),_0x278963);logger[_0x55b0('0x14')](_0x55b0('0x22'),_0x278963,JSON[_0x55b0('0x15')](_0x443d20));_0x36392e(_0x443d20);})[_0x55b0('0x23')](function(_0x564887){logger[_0x55b0('0x16')](_0x55b0('0x22'),_0x564887[_0x55b0('0x17')],_0x278963);_0x3ff56c(_0x26e153[_0x55b0('0x16')](0x1f4,_0x564887['message']));});});};exports[_0x55b0('0x24')]=function(_0x12f2c2){var _0x279a23=this;return new Promise(function(_0x426dd4,_0x470198){return db[_0x55b0('0x25')]['find']({'raw':_0x12f2c2[_0x55b0('0x1b')]?_0x12f2c2['options'][_0x55b0('0x1c')]===undefined?!![]:![]:!![],'where':_0x12f2c2[_0x55b0('0x1b')]?_0x12f2c2[_0x55b0('0x1b')][_0x55b0('0x26')]||null:null,'attributes':_0x12f2c2[_0x55b0('0x1b')]?_0x12f2c2[_0x55b0('0x1b')][_0x55b0('0x1d')]||null:null,'include':_0x12f2c2[_0x55b0('0x1b')]?_0x12f2c2[_0x55b0('0x1b')][_0x55b0('0x1f')]?_['map'](_0x12f2c2[_0x55b0('0x1b')][_0x55b0('0x1f')],function(_0x3df54f){return{'model':db[_0x3df54f[_0x55b0('0x20')]],'as':_0x3df54f['as'],'attributes':_0x3df54f[_0x55b0('0x1d')],'include':_0x3df54f[_0x55b0('0x1f')]?_[_0x55b0('0x21')](_0x3df54f[_0x55b0('0x1f')],function(_0x26ee74){return{'model':db[_0x26ee74['model']],'as':_0x26ee74['as'],'attributes':_0x26ee74['attributes'],'include':_0x26ee74[_0x55b0('0x1f')]?_['map'](_0x26ee74[_0x55b0('0x1f')],function(_0x592d6e){return{'model':db[_0x592d6e[_0x55b0('0x20')]],'as':_0x592d6e['as'],'attributes':_0x592d6e[_0x55b0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2534f4){logger[_0x55b0('0x12')](_0x55b0('0x24'),_0x12f2c2);logger['debug']('ShowMailAccount',_0x12f2c2,JSON['stringify'](_0x2534f4));_0x426dd4(_0x2534f4);})[_0x55b0('0x23')](function(_0x48e18c){logger['error'](_0x55b0('0x24'),_0x48e18c[_0x55b0('0x17')],_0x12f2c2);_0x470198(_0x279a23['error'](0x1f4,_0x48e18c[_0x55b0('0x17')]));});});};exports[_0x55b0('0x27')]=function(_0x4a70c5){var _0x5ccbad=this;return new Promise(function(_0x330992,_0xea1bcb){var _0x3b5ac3={'body':_0x4a70c5['body'],'channel':_0x55b0('0x28')};var _0x13a158=_[_0x55b0('0x29')](_[_0x55b0('0x2a')](db[_0x55b0('0x2b')][_0x55b0('0x2c')]),[_0x55b0('0x2d'),_0x55b0('0x2e'),_0x55b0('0x2f'),'ListId']);var _0x4a76ff=![];if(_0x4a70c5[_0x55b0('0x30')]['id']){delete _0x4a70c5[_0x55b0('0x30')]['id'];}if(_[_0x55b0('0x31')](_0x4a70c5[_0x55b0('0x30')]['from'])){return _0xea1bcb(_0x5ccbad['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x55b0('0x31')](_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x30')])||_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x30')]===''){return _0xea1bcb(_0x5ccbad[_0x55b0('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x55b0('0x31')](_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x32')])){return _0xea1bcb(_0x5ccbad['error'](0x1f4,_0x55b0('0x33')+_0x13a158));}if(!_[_0x55b0('0x34')](_0x13a158,_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x32')])){return _0xea1bcb(_0x5ccbad[_0x55b0('0x16')](0x1f4,_0x55b0('0x35')+_0x13a158));}var _0x5c25ec={};_0x5c25ec[_0x4a70c5[_0x55b0('0x30')]['mapKey']]=_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x36')];return db[_0x55b0('0x25')][_0x55b0('0x37')]({'where':{'id':_0x4a70c5[_0x55b0('0x38')]['id']},'include':[{'model':db[_0x55b0('0x39')],'as':_0x55b0('0x3a'),'include':[{'model':db[_0x55b0('0x2b')],'as':'Contacts','where':_0x5c25ec,'limit':0x1,'order':[['updatedAt',_0x55b0('0x3b')]]}]},{'model':db[_0x55b0('0x3c')],'as':_0x55b0('0x3d')},{'model':db[_0x55b0('0x3e')],'as':'Smtp'}]})['then'](function(_0x171f99){if(_0x171f99&&_0x171f99[_0x55b0('0x3a')]){var _0x11b36e=_0x171f99['get']({'plain':!![]});_0x3b5ac3['account']=_[_0x55b0('0x3f')](_0x11b36e,['Applications',_0x55b0('0x3a')]);_0x3b5ac3[_0x55b0('0x40')]=_0x11b36e[_0x55b0('0x3d')];_0x3b5ac3[_0x55b0('0x41')]=_0x11b36e['List'];_0x3b5ac3[_0x55b0('0x40')]=_['orderBy'](_0x3b5ac3[_0x55b0('0x40')],[_0x55b0('0x42')],[_0x55b0('0x43')]);if(_0x3b5ac3[_0x55b0('0x38')]&&_0x3b5ac3[_0x55b0('0x38')]['autoclose']){_0x3b5ac3[_0x55b0('0x40')][_0x55b0('0x44')]({'id':0x0,'priority':_0x3b5ac3[_0x55b0('0x40')][_0x55b0('0x45')]+0x1,'app':'close','appdata':_0x55b0('0x46'),'interval':_0x55b0('0x47')});}if(_0x3b5ac3[_0x55b0('0x38')][_0x55b0('0x3d')]){delete _0x3b5ac3[_0x55b0('0x38')]['Applications'];}if(_0x3b5ac3[_0x55b0('0x38')][_0x55b0('0x3a')]){delete _0x3b5ac3[_0x55b0('0x38')]['List'];}if(_0x11b36e[_0x55b0('0x3a')][_0x55b0('0x48')][_0x55b0('0x45')]){return _0x11b36e[_0x55b0('0x3a')][_0x55b0('0x48')][0x0];}var _0x555c0f=_[_0x55b0('0xc')](_0x4a70c5[_0x55b0('0x30')],{'firstName':_0x4a70c5[_0x55b0('0x30')]['from'],'ListId':_0x11b36e[_0x55b0('0x49')]});_0x555c0f[_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x32')]]=_0x4a70c5['body'][_0x55b0('0x36')];return db['CmContact'][_0x55b0('0x4a')](_0x555c0f);}else{throw new Error(_0x55b0('0x4b'));}})['then'](function(_0x58f641){_0x3b5ac3[_0x55b0('0x4c')]=_0x58f641;if(_0x58f641){if(!_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x4d')]){_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x4d')]=rs[_0x55b0('0x4e')]()+'\x20'+_0x4a70c5['body']['message']['from'];}var _0x5294a7={'ContactId':_0x58f641['id'],'MailAccountId':_0x4a70c5[_0x55b0('0x38')]['id'],'inReplyTo':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x4d')],'to':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x36')],'cc':_0x4a70c5['body'][_0x55b0('0x17')]['cc'],'subject':_0x4a70c5[_0x55b0('0x30')]['message'][_0x55b0('0x4f')],'attach':_0x4a70c5['body'][_0x55b0('0x17')]['attach'],'lastMsgAt':moment()[_0x55b0('0x50')](_0x55b0('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x4a70c5[_0x55b0('0x30')]['body']};return db[_0x55b0('0x52')][_0x55b0('0x37')]({'where':{'closed':![],'MailAccountId':_0x4a70c5['account']['id']},'include':[{'model':db[_0x55b0('0x53')],'as':_0x55b0('0x54'),'attributes':[_0x55b0('0x4d')],'where':{'messageId':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x55')]}}]})[_0x55b0('0x11')](function(_0x2aeff5){if(_0x2aeff5){return[_0x2aeff5,![]];}return db[_0x55b0('0x52')][_0x55b0('0x4a')](_0x5294a7)[_0x55b0('0x11')](function(_0x581cc9){return[_0x581cc9,!![]];});});}else{throw new Error(_0x55b0('0x56'));}})['spread'](function(_0x3ca1a8,_0x31b489){if(_0x3ca1a8){_0x4a76ff=_0x31b489;if(!_0x31b489){return _0x3ca1a8[_0x55b0('0x57')]({'inReplyTo':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x4d')],'to':_0x4a70c5[_0x55b0('0x30')]['message'][_0x55b0('0x36')],'cc':_0x4a70c5['body']['message']['cc'],'subject':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x4f')],'attach':_0x3ca1a8[_0x55b0('0x58')]?_0x3ca1a8[_0x55b0('0x58')]:_0x4a70c5['body']['message'][_0x55b0('0x58')],'substatus':null,'substatusAt':moment()[_0x55b0('0x50')](_0x55b0('0x51')),'lastMsgAt':moment()[_0x55b0('0x50')](_0x55b0('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x30')]});}else{return _0x3ca1a8;}}})['then'](function(_0x4dc720){_0x3b5ac3[_0x55b0('0x59')]=_0x4dc720['get']({'plain':!![]});_0x3b5ac3['interaction'][_0x55b0('0x5a')]=_0x4a76ff;return db['MailMessage'][_0x55b0('0x4a')]({'body':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x30')],'MailAccountId':_0x4a70c5[_0x55b0('0x38')]['id'],'MailInteractionId':_0x4dc720['id'],'direction':'in','ContactId':_0x3b5ac3[_0x55b0('0x4c')]['id'],'messageId':_0x4a70c5['body'][_0x55b0('0x17')][_0x55b0('0x4d')],'from':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x36')],'to':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')]['to'],'cc':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')]['cc'],'subject':_0x4a70c5[_0x55b0('0x30')]['message'][_0x55b0('0x4f')],'attach':_0x4a70c5['body'][_0x55b0('0x17')][_0x55b0('0x58')],'Attachments':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x5b')],'originTo':_0x4a70c5['body'][_0x55b0('0x17')][_0x55b0('0x5c')],'originCc':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x5d')],'bcc':_0x4a70c5[_0x55b0('0x30')][_0x55b0('0x17')][_0x55b0('0x5e')]},{'include':[{'model':db[_0x55b0('0x5f')],'as':_0x55b0('0x60')}]});})[_0x55b0('0x11')](function(_0x147163){_0x3b5ac3[_0x55b0('0x17')]=_0x147163;if(_0x3b5ac3['interaction'][_0x55b0('0x61')]){return db[_0x55b0('0x62')][_0x55b0('0x37')]({'attributes':['id',_0x55b0('0x63')],'where':{'id':_0x3b5ac3[_0x55b0('0x59')]['UserId']}})[_0x55b0('0x11')](function(_0x2703e3){if(_0x2703e3){_0x3b5ac3['applications'][_0x55b0('0x64')]({'id':0x0,'priority':0x0,'app':_0x55b0('0x65'),'appdata':_0x2703e3[_0x55b0('0x63')]+','+(_0x3b5ac3[_0x55b0('0x38')][_0x55b0('0x66')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x55b0('0x67'),'startRouting',_0x3b5ac3);});}return respondWithRpcPromise(_0x55b0('0x67'),'startRouting',_0x3b5ac3);})[_0x55b0('0x11')](function(_0x4332bb){_0x330992(_0x4332bb);})['catch'](function(_0x379f38){_0xea1bcb(_0x5ccbad['error'](0x1f4,_0x379f38['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5064387..a71874f 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 _0xfb8f=['mailAccount:','save','emit','removeListener','register'];(function(_0x428202,_0x40a85d){var _0x5ae0e5=function(_0xc403b1){while(--_0xc403b1){_0x428202['push'](_0x428202['shift']());}};_0x5ae0e5(++_0x40a85d);}(_0xfb8f,0x18c));var _0xffb8=function(_0x38dbf0,_0x4f8a7f){_0x38dbf0=_0x38dbf0-0x0;var _0x1eb9df=_0xfb8f[_0x38dbf0];return _0x1eb9df;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xffb8('0x0'),'remove','update'];function createListener(_0x3d06ed,_0x3150d6){return function(_0x10a287){_0x3150d6[_0xffb8('0x1')](_0x3d06ed,_0x10a287);};}function removeListener(_0x1bc8f6,_0x502eca){return function(){MailAccountEvents[_0xffb8('0x2')](_0x1bc8f6,_0x502eca);};}exports[_0xffb8('0x3')]=function(_0x463cfb){for(var _0x47b1e5=0x0,_0x5a70ab=events['length'];_0x47b1e5<_0x5a70ab;_0x47b1e5++){var _0x33495b=events[_0x47b1e5];var _0xb71c21=createListener(_0xffb8('0x4')+_0x33495b,_0x463cfb);MailAccountEvents['on'](_0x33495b,_0xb71c21);}}; \ No newline at end of file +var _0xfd7b=['removeListener','register','length','save','remove','update','emit'];(function(_0x27a59e,_0x53151f){var _0x1acec0=function(_0xaf381d){while(--_0xaf381d){_0x27a59e['push'](_0x27a59e['shift']());}};_0x1acec0(++_0x53151f);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xfd7b[_0x4953da];return _0x2d3780;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xbfd7('0x0'),_0xbfd7('0x1'),_0xbfd7('0x2')];function createListener(_0x27db01,_0x1ea39e){return function(_0x1f9ae1){_0x1ea39e[_0xbfd7('0x3')](_0x27db01,_0x1f9ae1);};}function removeListener(_0x221ad1,_0x249e59){return function(){MailAccountEvents[_0xbfd7('0x4')](_0x221ad1,_0x249e59);};}exports[_0xbfd7('0x5')]=function(_0x2ad158){for(var _0x639dd4=0x0,_0x5f3067=events[_0xbfd7('0x6')];_0x639dd4<_0x5f3067;_0x639dd4++){var _0x48f2aa=events[_0x639dd4];var _0x33dab1=createListener('mailAccount:'+_0x48f2aa,_0x2ad158);MailAccountEvents['on'](_0x48f2aa,_0x33dab1);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6604500..924b53c 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 _0x58a4=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','update','delete','exports','multer'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x58a4,0xbf));var _0x458a=function(_0x2157ab,_0x379b9d){_0x2157ab=_0x2157ab-0x0;var _0x4d1011=_0x58a4[_0x2157ab];return _0x4d1011;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var auth=require(_0x458a('0x6'));var interaction=require(_0x458a('0x7'));var config=require(_0x458a('0x8'));var controller=require(_0x458a('0x9'));router[_0x458a('0xa')](_0x458a('0xb'),auth[_0x458a('0xc')](),controller['show']);router['put'](_0x458a('0xb'),auth[_0x458a('0xc')](),controller[_0x458a('0xd')]);router[_0x458a('0xe')](_0x458a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x458a('0xf')]=router; \ No newline at end of file +var _0x087b=['./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x483c3f,_0x56b1e2){var _0x1a97d3=function(_0x17d5c7){while(--_0x17d5c7){_0x483c3f['push'](_0x483c3f['shift']());}};_0x1a97d3(++_0x56b1e2);}(_0x087b,0x11a));var _0xb087=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x087b[_0x39e84d];return _0x1991bc;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var auth=require(_0xb087('0x3'));var interaction=require(_0xb087('0x4'));var config=require(_0xb087('0x5'));var controller=require(_0xb087('0x6'));router[_0xb087('0x7')](_0xb087('0x8'),auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0xb')](_0xb087('0x8'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0xd')](_0xb087('0x8'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);module[_0xb087('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index cfb37e3..a1bc166 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 _0xd3a6=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd3a6,0x19a));var _0x6d3a=function(_0x38f1a9,_0x59881d){_0x38f1a9=_0x38f1a9-0x0;var _0x3f715c=_0xd3a6[_0x38f1a9];return _0x3f715c;};'use strict';var Sequelize=require(_0x6d3a('0x0'));module[_0x6d3a('0x1')]={'priority':{'type':Sequelize[_0x6d3a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6d3a('0x3')},'appdata':{'type':Sequelize[_0x6d3a('0x4')]()},'description':{'type':Sequelize[_0x6d3a('0x5')]},'interval':{'type':Sequelize[_0x6d3a('0x5')],'defaultValue':_0x6d3a('0x6')}}; \ No newline at end of file +var _0x705c=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x2d3923,_0x1a9946){var _0x10d3e7=function(_0x1fa72d){while(--_0x1fa72d){_0x2d3923['push'](_0x2d3923['shift']());}};_0x10d3e7(++_0x1a9946);}(_0x705c,0x1a3));var _0xc705=function(_0x2d46ef,_0x3bc440){_0x2d46ef=_0x2d46ef-0x0;var _0xe744fc=_0x705c[_0x2d46ef];return _0xe744fc;};'use strict';var Sequelize=require(_0xc705('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc705('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc705('0x2')],'allowNull':![],'defaultValue':_0xc705('0x3')},'appdata':{'type':Sequelize[_0xc705('0x4')]()},'description':{'type':Sequelize[_0xc705('0x2')]},'interval':{'type':Sequelize[_0xc705('0x2')],'defaultValue':_0xc705('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7bd24eb..e526b2e 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 _0x008c=['send','show','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','model','includeAll','include','merge','options','find','catch','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','apply','destroy','then','end','error'];(function(_0x9b15fd,_0x4725e3){var _0x110d9e=function(_0x41deed){while(--_0x41deed){_0x9b15fd['push'](_0x9b15fd['shift']());}};_0x110d9e(++_0x4725e3);}(_0x008c,0x188));var _0xc008=function(_0x4da690,_0x12d136){_0x4da690=_0x4da690-0x0;var _0x263c53=_0x008c[_0x4da690];return _0x263c53;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc008('0x12'))(_0xc008('0x13'));var utils=require('../../config/utils');var config=require(_0xc008('0x14'));var db=require(_0xc008('0x15'))['db'];function respondWithStatusCode(_0x2ea200,_0x2a5b4e){_0x2a5b4e=_0x2a5b4e||0xcc;return function(_0x9ffa93){if(_0x9ffa93){return _0x2ea200[_0xc008('0x16')](_0x2a5b4e);}return _0x2ea200[_0xc008('0x17')](_0x2a5b4e)['end']();};}function respondWithResult(_0x560e28,_0x33f44c){_0x33f44c=_0x33f44c||0xc8;return function(_0x50c1ab){if(_0x50c1ab){return _0x560e28[_0xc008('0x17')](_0x33f44c)[_0xc008('0x18')](_0x50c1ab);}};}function respondWithFilteredResult(_0x2073ef,_0x339ffc){return function(_0x3f0ecf){if(_0x3f0ecf){var _0x5ee00b=_0x3f0ecf[_0xc008('0x19')],_0x5e894e=_0x339ffc[_0xc008('0x1a')],_0x4bd0f4=_0x339ffc[_0xc008('0x1a')]+_0x339ffc['limit'],_0x11ef38;if(_0x4bd0f4>=_0x5ee00b){_0x4bd0f4=_0x5ee00b;_0x11ef38=0xc8;}else{_0x11ef38=0xce;}_0x2073ef['status'](_0x11ef38);return _0x2073ef['set']('Content-Range',_0x5e894e+'-'+_0x4bd0f4+'/'+_0x5ee00b)[_0xc008('0x18')](_0x3f0ecf);}return null;};}function patchUpdates(_0x462af5){return function(_0x501137){try{jsonpatch[_0xc008('0x1b')](_0x501137,_0x462af5,!![]);}catch(_0x5906e6){return BPromise['reject'](_0x5906e6);}return _0x501137['save']();};}function saveUpdates(_0x50261c,_0x5754a0){return function(_0x4b9726){if(_0x4b9726){return _0x4b9726['update'](_0x50261c)['then'](function(_0x4a582d){return _0x4a582d;});}return null;};}function removeEntity(_0x5a58bd,_0x13a263){return function(_0x4777a6){if(_0x4777a6){return _0x4777a6[_0xc008('0x1c')]()[_0xc008('0x1d')](function(){_0x5a58bd[_0xc008('0x17')](0xcc)[_0xc008('0x1e')]();});}};}function handleEntityNotFound(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(!_0x5c85f2){_0x4f43e2['sendStatus'](0x194);}return _0x5c85f2;};}function handleError(_0x218599,_0x36f358){_0x36f358=_0x36f358||0x1f4;return function(_0x2e3cfb){logger[_0xc008('0x1f')](_0x2e3cfb['stack']);if(_0x2e3cfb['name']){delete _0x2e3cfb['name'];}_0x218599[_0xc008('0x17')](_0x36f358)[_0xc008('0x20')](_0x2e3cfb);};}exports[_0xc008('0x21')]=function(_0x2e31c2,_0x5bebd9){var _0x5e2aca={'raw':!![],'where':{'id':_0x2e31c2['params']['id']}},_0x4fce9c={};_0x4fce9c['model']=_[_0xc008('0x22')](db[_0xc008('0x23')][_0xc008('0x24')]);_0x4fce9c['query']=_[_0xc008('0x22')](_0x2e31c2[_0xc008('0x25')]);_0x4fce9c[_0xc008('0x26')]=_[_0xc008('0x27')](_0x4fce9c['model'],_0x4fce9c[_0xc008('0x25')]);_0x5e2aca[_0xc008('0x28')]=_['intersection'](_0x4fce9c['model'],qs['fields'](_0x2e31c2[_0xc008('0x25')][_0xc008('0x29')]));_0x5e2aca[_0xc008('0x28')]=_0x5e2aca[_0xc008('0x28')][_0xc008('0x2a')]?_0x5e2aca[_0xc008('0x28')]:_0x4fce9c[_0xc008('0x2b')];if(_0x2e31c2[_0xc008('0x25')][_0xc008('0x2c')]){_0x5e2aca[_0xc008('0x2d')]=[{'all':!![]}];}_0x5e2aca=_[_0xc008('0x2e')]({},_0x5e2aca,_0x2e31c2[_0xc008('0x2f')]);return db['MailApplication'][_0xc008('0x30')](_0x5e2aca)[_0xc008('0x1d')](handleEntityNotFound(_0x5bebd9,null))['then'](respondWithResult(_0x5bebd9,null))[_0xc008('0x31')](handleError(_0x5bebd9,null));};exports[_0xc008('0x32')]=function(_0x383be7,_0xca0520){if(_0x383be7[_0xc008('0x33')]['id']){delete _0x383be7[_0xc008('0x33')]['id'];}return db[_0xc008('0x23')][_0xc008('0x30')]({'where':{'id':_0x383be7[_0xc008('0x34')]['id']}})['then'](handleEntityNotFound(_0xca0520,null))[_0xc008('0x1d')](saveUpdates(_0x383be7[_0xc008('0x33')],null))[_0xc008('0x1d')](respondWithResult(_0xca0520,null))[_0xc008('0x31')](handleError(_0xca0520,null));};exports[_0xc008('0x1c')]=function(_0x315562,_0x1667a0){return db['MailApplication'][_0xc008('0x30')]({'where':{'id':_0x315562[_0xc008('0x34')]['id']}})['then'](handleEntityNotFound(_0x1667a0,null))[_0xc008('0x1d')](removeEntity(_0x1667a0,null))[_0xc008('0x31')](handleError(_0x1667a0,null));}; \ No newline at end of file +var _0x9c5e=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','error','name','send','show','model','MailApplication','rawAttributes','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x31c351,_0x2c7bc1){_0x31c351=_0x31c351-0x0;var _0x1a1c6d=_0x9c5e[_0x31c351];return _0x1a1c6d;};'use strict';var pdf=require(_0xe9c5('0x0'));var emlformat=require(_0xe9c5('0x1'));var rimraf=require(_0xe9c5('0x2'));var zipdir=require(_0xe9c5('0x3'));var jsonpatch=require(_0xe9c5('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9c5('0x5'));var util=require(_0xe9c5('0x6'));var path=require('path');var sox=require(_0xe9c5('0x7'));var csv=require(_0xe9c5('0x8'));var ejs=require(_0xe9c5('0x9'));var fs=require('fs');var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var hardwareService=require(_0xe9c5('0x11'));var logger=require(_0xe9c5('0x12'))(_0xe9c5('0x13'));var utils=require(_0xe9c5('0x14'));var config=require(_0xe9c5('0x15'));var db=require(_0xe9c5('0x16'))['db'];function respondWithStatusCode(_0xd643f2,_0x46dc68){_0x46dc68=_0x46dc68||0xcc;return function(_0x27f3e1){if(_0x27f3e1){return _0xd643f2[_0xe9c5('0x17')](_0x46dc68);}return _0xd643f2[_0xe9c5('0x18')](_0x46dc68)[_0xe9c5('0x19')]();};}function respondWithResult(_0x409f65,_0x509978){_0x509978=_0x509978||0xc8;return function(_0x3cce36){if(_0x3cce36){return _0x409f65[_0xe9c5('0x18')](_0x509978)[_0xe9c5('0x1a')](_0x3cce36);}};}function respondWithFilteredResult(_0x3bbd96,_0x211eec){return function(_0x232584){if(_0x232584){var _0x5d8236=_0x232584[_0xe9c5('0x1b')],_0x163253=_0x211eec[_0xe9c5('0x1c')],_0x14eb41=_0x211eec[_0xe9c5('0x1c')]+_0x211eec[_0xe9c5('0x1d')],_0x5d5fb4;if(_0x14eb41>=_0x5d8236){_0x14eb41=_0x5d8236;_0x5d5fb4=0xc8;}else{_0x5d5fb4=0xce;}_0x3bbd96[_0xe9c5('0x18')](_0x5d5fb4);return _0x3bbd96['set'](_0xe9c5('0x1e'),_0x163253+'-'+_0x14eb41+'/'+_0x5d8236)[_0xe9c5('0x1a')](_0x232584);}return null;};}function patchUpdates(_0x2f050b){return function(_0x32061f){try{jsonpatch['apply'](_0x32061f,_0x2f050b,!![]);}catch(_0x26492a){return BPromise[_0xe9c5('0x1f')](_0x26492a);}return _0x32061f[_0xe9c5('0x20')]();};}function saveUpdates(_0x355442,_0x59a8c5){return function(_0x58fbad){if(_0x58fbad){return _0x58fbad['update'](_0x355442)[_0xe9c5('0x21')](function(_0x57818d){return _0x57818d;});}return null;};}function removeEntity(_0x3c3d53,_0xc4d208){return function(_0x21b02a){if(_0x21b02a){return _0x21b02a[_0xe9c5('0x22')]()['then'](function(){_0x3c3d53[_0xe9c5('0x18')](0xcc)[_0xe9c5('0x19')]();});}};}function handleEntityNotFound(_0x37fb90,_0x189a13){return function(_0x34a7c8){if(!_0x34a7c8){_0x37fb90[_0xe9c5('0x17')](0x194);}return _0x34a7c8;};}function handleError(_0x44ba59,_0x155066){_0x155066=_0x155066||0x1f4;return function(_0x1cd9c4){logger[_0xe9c5('0x23')](_0x1cd9c4['stack']);if(_0x1cd9c4['name']){delete _0x1cd9c4[_0xe9c5('0x24')];}_0x44ba59[_0xe9c5('0x18')](_0x155066)[_0xe9c5('0x25')](_0x1cd9c4);};}exports[_0xe9c5('0x26')]=function(_0x33fe71,_0x100eda){var _0x493108={'raw':!![],'where':{'id':_0x33fe71['params']['id']}},_0x2c3fcb={};_0x2c3fcb[_0xe9c5('0x27')]=_['keys'](db[_0xe9c5('0x28')][_0xe9c5('0x29')]);_0x2c3fcb['query']=_[_0xe9c5('0x2a')](_0x33fe71[_0xe9c5('0x2b')]);_0x2c3fcb[_0xe9c5('0x2c')]=_[_0xe9c5('0x2d')](_0x2c3fcb[_0xe9c5('0x27')],_0x2c3fcb['query']);_0x493108[_0xe9c5('0x2e')]=_['intersection'](_0x2c3fcb[_0xe9c5('0x27')],qs['fields'](_0x33fe71[_0xe9c5('0x2b')][_0xe9c5('0x2f')]));_0x493108[_0xe9c5('0x2e')]=_0x493108[_0xe9c5('0x2e')][_0xe9c5('0x30')]?_0x493108['attributes']:_0x2c3fcb[_0xe9c5('0x27')];if(_0x33fe71[_0xe9c5('0x2b')][_0xe9c5('0x31')]){_0x493108[_0xe9c5('0x32')]=[{'all':!![]}];}_0x493108=_[_0xe9c5('0x33')]({},_0x493108,_0x33fe71['options']);return db['MailApplication'][_0xe9c5('0x34')](_0x493108)[_0xe9c5('0x21')](handleEntityNotFound(_0x100eda,null))[_0xe9c5('0x21')](respondWithResult(_0x100eda,null))[_0xe9c5('0x35')](handleError(_0x100eda,null));};exports[_0xe9c5('0x36')]=function(_0x96753,_0x414738){if(_0x96753[_0xe9c5('0x37')]['id']){delete _0x96753['body']['id'];}return db[_0xe9c5('0x28')][_0xe9c5('0x34')]({'where':{'id':_0x96753['params']['id']}})[_0xe9c5('0x21')](handleEntityNotFound(_0x414738,null))['then'](saveUpdates(_0x96753[_0xe9c5('0x37')],null))[_0xe9c5('0x21')](respondWithResult(_0x414738,null))[_0xe9c5('0x35')](handleError(_0x414738,null));};exports[_0xe9c5('0x22')]=function(_0x258528,_0x18e617){return db[_0xe9c5('0x28')][_0xe9c5('0x34')]({'where':{'id':_0x258528[_0xe9c5('0x38')]['id']}})[_0xe9c5('0x21')](handleEntityNotFound(_0x18e617,null))[_0xe9c5('0x21')](removeEntity(_0x18e617,null))[_0xe9c5('0x35')](handleError(_0x18e617,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index d419058..c8feaca 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 _0x676c=['../../config/environment','exports','define','MailApplication','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d0242,_0x515fbb){var _0x4c12d3=function(_0x25d4ee){while(--_0x25d4ee){_0x2d0242['push'](_0x2d0242['shift']());}};_0x4c12d3(++_0x515fbb);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc676('0x0'));var util=require(_0xc676('0x1'));var logger=require(_0xc676('0x2'))('api');var moment=require(_0xc676('0x3'));var BPromise=require(_0xc676('0x4'));var rp=require(_0xc676('0x5'));var fs=require('fs');var path=require(_0xc676('0x6'));var rimraf=require(_0xc676('0x7'));var config=require(_0xc676('0x8'));var attributes=require('./mailApplication.attributes');module[_0xc676('0x9')]=function(_0x228e07,_0x13c5a7){return _0x228e07[_0xc676('0xa')](_0xc676('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc676('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0598=['path','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise'];(function(_0x389162,_0x1772e6){var _0x1de795=function(_0x203df6){while(--_0x203df6){_0x389162['push'](_0x389162['shift']());}};_0x1de795(++_0x1772e6);}(_0x0598,0x92));var _0x8059=function(_0x2d711b,_0x3a9fa3){_0x2d711b=_0x2d711b-0x0;var _0x376887=_0x0598[_0x2d711b];return _0x376887;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8059('0x8'),'collate':_0x8059('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index bad0ed1..e824a00 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 _0x4991=['stringify','error','message','result','UpdateMailApplication','update','body','options','raw','where','attributes','limit','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4991,0x12d));var _0x1499=function(_0x529db9,_0x3db307){_0x529db9=_0x529db9-0x0;var _0x4ce957=_0x4991[_0x529db9];return _0x4ce957;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1499('0x0'));var BPromise=require(_0x1499('0x1'));var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson[_0x1499('0xa')][_0x1499('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x507d55,_0x44b7a6,_0x2a6660){return new BPromise(function(_0x51ded,_0x48c442){return client[_0x1499('0xc')](_0x507d55,_0x2a6660)[_0x1499('0xd')](function(_0x568b44){logger[_0x1499('0xe')](_0x1499('0xf'),_0x44b7a6,_0x1499('0x10'));logger[_0x1499('0x11')](_0x1499('0x12'),_0x44b7a6,_0x1499('0x10'),JSON[_0x1499('0x13')](_0x568b44));if(_0x568b44[_0x1499('0x14')]){if(_0x568b44[_0x1499('0x14')]['code']===0x1f4){logger[_0x1499('0x14')](_0x1499('0xf'),_0x44b7a6,_0x568b44[_0x1499('0x14')][_0x1499('0x15')]);return _0x48c442(_0x568b44[_0x1499('0x14')]['message']);}logger[_0x1499('0x14')]('MailApplication,\x20%s,\x20%s',_0x44b7a6,_0x568b44[_0x1499('0x14')][_0x1499('0x15')]);return _0x51ded(_0x568b44['error']['message']);}else{logger[_0x1499('0xe')](_0x1499('0xf'),_0x44b7a6,_0x1499('0x10'));_0x51ded(_0x568b44[_0x1499('0x16')][_0x1499('0x15')]);}})['catch'](function(_0x2b6c5d){logger[_0x1499('0x14')](_0x1499('0xf'),_0x44b7a6,_0x2b6c5d);_0x48c442(_0x2b6c5d);});});}exports[_0x1499('0x17')]=function(_0x5698db){var _0x579bcc=this;return new Promise(function(_0x521f2b,_0x1f4569){return db['MailApplication'][_0x1499('0x18')](_0x5698db[_0x1499('0x19')],{'raw':_0x5698db[_0x1499('0x1a')]?_0x5698db['options'][_0x1499('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5698db[_0x1499('0x1a')]?_0x5698db[_0x1499('0x1a')][_0x1499('0x1c')]||null:null,'attributes':_0x5698db[_0x1499('0x1a')]?_0x5698db[_0x1499('0x1a')][_0x1499('0x1d')]||null:null,'limit':_0x5698db['options']?_0x5698db[_0x1499('0x1a')][_0x1499('0x1e')]||null:null})[_0x1499('0xd')](function(_0x2cfa96){logger[_0x1499('0xe')](_0x1499('0x17'),_0x5698db);logger[_0x1499('0x11')](_0x1499('0x17'),_0x5698db,JSON[_0x1499('0x13')](_0x2cfa96));_0x521f2b(_0x2cfa96);})[_0x1499('0x1f')](function(_0x34056a){logger[_0x1499('0x14')](_0x1499('0x17'),_0x34056a[_0x1499('0x15')],_0x5698db);_0x1f4569(_0x579bcc[_0x1499('0x14')](0x1f4,_0x34056a[_0x1499('0x15')]));});});}; \ No newline at end of file +var _0xaa46=['debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','update','body','options','raw','where','limit','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x3f5dd3,_0x171037){var _0x3cb003=function(_0x3115e4){while(--_0x3115e4){_0x3f5dd3['push'](_0x3f5dd3['shift']());}};_0x3cb003(++_0x171037);}(_0xaa46,0xd6));var _0x6aa4=function(_0xcb3eb3,_0x4b2bed){_0xcb3eb3=_0xcb3eb3-0x0;var _0x7bbcb6=_0xaa46[_0xcb3eb3];return _0x7bbcb6;};'use strict';var _=require(_0x6aa4('0x0'));var util=require(_0x6aa4('0x1'));var moment=require('moment');var BPromise=require(_0x6aa4('0x2'));var rs=require(_0x6aa4('0x3'));var fs=require('fs');var Redis=require(_0x6aa4('0x4'));var db=require(_0x6aa4('0x5'))['db'];var utils=require(_0x6aa4('0x6'));var logger=require(_0x6aa4('0x7'))(_0x6aa4('0x8'));var config=require(_0x6aa4('0x9'));var jayson=require(_0x6aa4('0xa'));var client=jayson[_0x6aa4('0xb')][_0x6aa4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57bc64,_0x34bf08,_0x2daa51){return new BPromise(function(_0x38dfd9,_0x2f6d38){return client[_0x6aa4('0xd')](_0x57bc64,_0x2daa51)['then'](function(_0x5be616){logger[_0x6aa4('0xe')](_0x6aa4('0xf'),_0x34bf08,_0x6aa4('0x10'));logger[_0x6aa4('0x11')](_0x6aa4('0x12'),_0x34bf08,_0x6aa4('0x10'),JSON[_0x6aa4('0x13')](_0x5be616));if(_0x5be616[_0x6aa4('0x14')]){if(_0x5be616['error'][_0x6aa4('0x15')]===0x1f4){logger[_0x6aa4('0x14')]('MailApplication,\x20%s,\x20%s',_0x34bf08,_0x5be616['error'][_0x6aa4('0x16')]);return _0x2f6d38(_0x5be616[_0x6aa4('0x14')][_0x6aa4('0x16')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x34bf08,_0x5be616['error'][_0x6aa4('0x16')]);return _0x38dfd9(_0x5be616[_0x6aa4('0x14')]['message']);}else{logger[_0x6aa4('0xe')]('MailApplication,\x20%s,\x20%s',_0x34bf08,_0x6aa4('0x10'));_0x38dfd9(_0x5be616[_0x6aa4('0x17')][_0x6aa4('0x16')]);}})['catch'](function(_0x18f6f1){logger['error'](_0x6aa4('0xf'),_0x34bf08,_0x18f6f1);_0x2f6d38(_0x18f6f1);});});}exports[_0x6aa4('0x18')]=function(_0x45bce9){var _0x1f06eb=this;return new Promise(function(_0x366f4b,_0x1fac60){return db['MailApplication'][_0x6aa4('0x19')](_0x45bce9[_0x6aa4('0x1a')],{'raw':_0x45bce9['options']?_0x45bce9[_0x6aa4('0x1b')][_0x6aa4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45bce9['options']?_0x45bce9[_0x6aa4('0x1b')][_0x6aa4('0x1d')]||null:null,'attributes':_0x45bce9[_0x6aa4('0x1b')]?_0x45bce9[_0x6aa4('0x1b')]['attributes']||null:null,'limit':_0x45bce9[_0x6aa4('0x1b')]?_0x45bce9['options'][_0x6aa4('0x1e')]||null:null})[_0x6aa4('0x1f')](function(_0x2496fc){logger['info'](_0x6aa4('0x18'),_0x45bce9);logger[_0x6aa4('0x11')](_0x6aa4('0x18'),_0x45bce9,JSON[_0x6aa4('0x13')](_0x2496fc));_0x366f4b(_0x2496fc);})[_0x6aa4('0x20')](function(_0x3535aa){logger[_0x6aa4('0x14')](_0x6aa4('0x18'),_0x3535aa['message'],_0x45bce9);_0x1fac60(_0x1f06eb['error'](0x1f4,_0x3535aa[_0x6aa4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3314661..d4d0a77 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 _0xc9b0=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0xc9b0,0x143));var _0x0c9b=function(_0x3192d2,_0x5043eb){_0x3192d2=_0x3192d2-0x0;var _0x481a7d=_0xc9b0[_0x3192d2];return _0x481a7d;};'use strict';var multer=require(_0x0c9b('0x0'));var util=require(_0x0c9b('0x1'));var path=require(_0x0c9b('0x2'));var timeout=require(_0x0c9b('0x3'));var express=require(_0x0c9b('0x4'));var router=express[_0x0c9b('0x5')]();var auth=require(_0x0c9b('0x6'));var interaction=require(_0x0c9b('0x7'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x0c9b('0x8')]('/',auth[_0x0c9b('0x9')](),controller[_0x0c9b('0xa')]);router[_0x0c9b('0x8')](_0x0c9b('0xb'),auth[_0x0c9b('0x9')](),controller[_0x0c9b('0xc')]);router[_0x0c9b('0x8')](_0x0c9b('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0c9b('0xe'),auth[_0x0c9b('0x9')](),controller[_0x0c9b('0xf')]);router[_0x0c9b('0x8')](_0x0c9b('0x10'),auth[_0x0c9b('0x9')](),controller['download']);router[_0x0c9b('0x11')]('/',auth[_0x0c9b('0x9')](),controller['create']);router[_0x0c9b('0x11')]('/:id/messages',auth[_0x0c9b('0x9')](),controller[_0x0c9b('0x12')]);router[_0x0c9b('0x11')](_0x0c9b('0x13'),auth[_0x0c9b('0x9')](),interaction[_0x0c9b('0x14')](_0x0c9b('0x15'),_0x0c9b('0x16')),controller[_0x0c9b('0x17')]);router[_0x0c9b('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x0c9b('0x15'),_0x0c9b('0x19')),controller['update']);router[_0x0c9b('0x1a')](_0x0c9b('0xd'),auth[_0x0c9b('0x9')](),interaction[_0x0c9b('0x14')](_0x0c9b('0x15'),_0x0c9b('0x1b')),controller[_0x0c9b('0x1c')]);router['delete']('/:id/tags',auth[_0x0c9b('0x9')](),controller['removeTags']);module[_0x0c9b('0x1d')]=router; \ No newline at end of file +var _0x307e=['/:id','/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','mail','update','delete','mailinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x2ac798,_0x25a0de){var _0x49d72b=function(_0x38cd83){while(--_0x38cd83){_0x2ac798['push'](_0x2ac798['shift']());}};_0x49d72b(++_0x25a0de);}(_0x307e,0x1ec));var _0xe307=function(_0x529cc5,_0x31b4d7){_0x529cc5=_0x529cc5-0x0;var _0x1e471e=_0x307e[_0x529cc5];return _0x1e471e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe307('0x0'));var timeout=require(_0xe307('0x1'));var express=require(_0xe307('0x2'));var router=express[_0xe307('0x3')]();var auth=require(_0xe307('0x4'));var interaction=require(_0xe307('0x5'));var config=require(_0xe307('0x6'));var controller=require('./mailInteraction.controller');router[_0xe307('0x7')]('/',auth['isAuthenticated'](),controller[_0xe307('0x8')]);router[_0xe307('0x7')](_0xe307('0x9'),auth[_0xe307('0xa')](),controller[_0xe307('0xb')]);router[_0xe307('0x7')](_0xe307('0xc'),auth[_0xe307('0xa')](),controller['show']);router[_0xe307('0x7')](_0xe307('0xd'),auth[_0xe307('0xa')](),controller['getMessages']);router[_0xe307('0x7')](_0xe307('0xe'),auth[_0xe307('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe307('0xf')]('/:id/messages',auth[_0xe307('0xa')](),controller[_0xe307('0x10')]);router['post'](_0xe307('0x11'),auth[_0xe307('0xa')](),interaction[_0xe307('0x12')]('mail',_0xe307('0x13')),controller[_0xe307('0x14')]);router['put'](_0xe307('0xc'),auth[_0xe307('0xa')](),interaction[_0xe307('0x12')](_0xe307('0x15'),'mailinteraction:update'),controller[_0xe307('0x16')]);router[_0xe307('0x17')]('/:id',auth[_0xe307('0xa')](),interaction[_0xe307('0x12')](_0xe307('0x15'),_0xe307('0x18')),controller[_0xe307('0x19')]);router['delete'](_0xe307('0x11'),auth[_0xe307('0xa')](),controller[_0xe307('0x1a')]);module[_0xe307('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 2f1b27c..f27bab1 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 _0x7cca=['sequelize','exports','BOOLEAN','STRING','TEXT','long','DATE','out','ENUM'];(function(_0x1056c0,_0x5757a7){var _0x4d1b97=function(_0x5d2cae){while(--_0x5d2cae){_0x1056c0['push'](_0x1056c0['shift']());}};_0x4d1b97(++_0x5757a7);}(_0x7cca,0x1cb));var _0xa7cc=function(_0x358673,_0x3c6e95){_0x358673=_0x358673-0x0;var _0x20c6c8=_0x7cca[_0x358673];return _0x20c6c8;};'use strict';var Sequelize=require(_0xa7cc('0x0'));var iconv=require('iconv');module[_0xa7cc('0x1')]={'closed':{'type':Sequelize[_0xa7cc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa7cc('0x3')]},'inReplyTo':{'type':Sequelize[_0xa7cc('0x3')](0x1fe)},'to':{'type':Sequelize[_0xa7cc('0x3')]},'cc':{'type':Sequelize[_0xa7cc('0x4')](_0xa7cc('0x5'))},'subject':{'type':Sequelize[_0xa7cc('0x4')]()},'attach':{'type':Sequelize[_0xa7cc('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa7cc('0x6')]},'substatus':{'type':Sequelize[_0xa7cc('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xa7cc('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa7cc('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa7cc('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xa7cc('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xa7cc('0x4')]('long')},'lastMsgText':{'type':Sequelize[_0xa7cc('0x4')](_0xa7cc('0x5'))}}; \ No newline at end of file +var _0x6f6c=['out','sequelize','iconv','exports','STRING','TEXT','long','BOOLEAN','DATE','ENUM'];(function(_0x4baa14,_0x4d45d2){var _0x3af1f7=function(_0x36ca7e){while(--_0x36ca7e){_0x4baa14['push'](_0x4baa14['shift']());}};_0x3af1f7(++_0x4d45d2);}(_0x6f6c,0x19b));var _0xc6f6=function(_0x1ed3e4,_0x196e27){_0x1ed3e4=_0x1ed3e4-0x0;var _0x22f9d2=_0x6f6c[_0x1ed3e4];return _0x22f9d2;};'use strict';var Sequelize=require(_0xc6f6('0x0'));var iconv=require(_0xc6f6('0x1'));module[_0xc6f6('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc6f6('0x3')]},'note':{'type':Sequelize[_0xc6f6('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xc6f6('0x3')]},'cc':{'type':Sequelize[_0xc6f6('0x4')](_0xc6f6('0x5'))},'subject':{'type':Sequelize[_0xc6f6('0x4')]()},'attach':{'type':Sequelize[_0xc6f6('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc6f6('0x7')]},'substatus':{'type':Sequelize[_0xc6f6('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xc6f6('0x7')]},'firstMsgDirection':{'type':Sequelize[_0xc6f6('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc6f6('0x8')]('in',_0xc6f6('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xc6f6('0x4')]('long')},'lastMsgText':{'type':Sequelize[_0xc6f6('0x4')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3022e01..7f02640 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 _0x8b00=['expr','advancedFilter','createdAt','value','dateStart','startOf','day','utc','format','condition','TagId','isArray','length','and','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','c.firstName','\x20LIKE\x20?','c.email','\x20>\x20?','\x20<\x20?','unreadMessages','ContactId','c.lastName','map','hasOwnProperty','filter','isNil','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','push','toString','join','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','order','group','i.id','Sequelize','QueryTypes','SELECT','clone','COUNT(me.id)','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20IN\x20?','t.id\x20=\x20it.TagId','sequelize','keyBy','Account.key','a.mandatoryDisposition','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','show','fields','includeAll','find','body','params','describe','addMessage','ids','omit','getMessages','MailMessage','merge','split','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','emit','mailInteractionTags:save','removeTags','download','unix','root','server','files','attachments','tmp','interaction-%s.zip','Attachment','Attachments','mkdirSync','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','readFileSync','build','message%d.eml','log','err','unlinkSync','sendStatus','html-pdf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','count','offset','limit','set','Content-Range','reject','update','then','destroy','name','send','Tags','TagIds','forEach','MailInteraction','lastMsgText','trimStart','fromString','catch','index','rawAttributes','query','keys','filters','intersection','model','attributes','nolimit','sort','pick','select','field','color','from','tools_tags','COUNT(*)','mail_messages','where','me.direction\x20=\x20\x27in\x27','u.id','ui.MailInteractionId','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false'];(function(_0x388186,_0x49fa51){var _0x37e742=function(_0x4b2740){while(--_0x4b2740){_0x388186['push'](_0x388186['shift']());}};_0x37e742(++_0x49fa51);}(_0x8b00,0x171));var _0x08b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b00[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x08b0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x08b0('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x08b0('0x2'));var Mustache=require(_0x08b0('0x3'));var util=require(_0x08b0('0x4'));var path=require(_0x08b0('0x5'));var sox=require(_0x08b0('0x6'));var csv=require(_0x08b0('0x7'));var ejs=require(_0x08b0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x08b0('0x9'));var jsforce=require(_0x08b0('0xa'));var deskjs=require(_0x08b0('0xb'));var toCsv=require(_0x08b0('0x7'));var querystring=require(_0x08b0('0xc'));var Papa=require(_0x08b0('0xd'));var htmlToText=require(_0x08b0('0xe'));var Redis=require(_0x08b0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x08b0('0x10'));var logger=require(_0x08b0('0x11'))(_0x08b0('0x12'));var utils=require(_0x08b0('0x13'));var config=require(_0x08b0('0x14'));var db=require(_0x08b0('0x15'))['db'];config['redis']=_[_0x08b0('0x16')](config[_0x08b0('0x17')],{'host':_0x08b0('0x18'),'port':0x18eb});var socket=require(_0x08b0('0x19'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x08b0('0x1a')](socket);function respondWithStatusCode(_0x21ccd7,_0x519b86){_0x519b86=_0x519b86||0xcc;return function(_0x418112){if(_0x418112){return _0x21ccd7['sendStatus'](_0x519b86);}return _0x21ccd7[_0x08b0('0x1b')](_0x519b86)[_0x08b0('0x1c')]();};}function respondWithResult(_0x2cc369,_0x18c886){_0x18c886=_0x18c886||0xc8;return function(_0x2338ec){if(_0x2338ec){return _0x2cc369['status'](_0x18c886)['json'](_0x2338ec);}};}function respondWithFilteredResult(_0x57ba0b,_0x3cbef7){return function(_0x38e4a9){if(_0x38e4a9){var _0x561c8d=_0x38e4a9[_0x08b0('0x1d')],_0x9704ac=_0x3cbef7[_0x08b0('0x1e')],_0x2f1678=_0x3cbef7[_0x08b0('0x1e')]+_0x3cbef7[_0x08b0('0x1f')],_0x2ebbbd;if(_0x2f1678>=_0x561c8d){_0x2f1678=_0x561c8d;_0x2ebbbd=0xc8;}else{_0x2ebbbd=0xce;}_0x57ba0b[_0x08b0('0x1b')](_0x2ebbbd);return _0x57ba0b[_0x08b0('0x20')](_0x08b0('0x21'),_0x9704ac+'-'+_0x2f1678+'/'+_0x561c8d)['json'](_0x38e4a9);}return null;};}function patchUpdates(_0xaf2797){return function(_0x5e3d98){try{jsonpatch['apply'](_0x5e3d98,_0xaf2797,!![]);}catch(_0x596129){return BPromise[_0x08b0('0x22')](_0x596129);}return _0x5e3d98['save']();};}function saveUpdates(_0x5be8f5,_0x111739){return function(_0x580628){if(_0x580628){return _0x580628[_0x08b0('0x23')](_0x5be8f5)[_0x08b0('0x24')](function(_0x423013){return _0x423013;});}return null;};}function removeEntity(_0x42a6a2,_0x1f5da4){return function(_0x4803e3){if(_0x4803e3){return _0x4803e3[_0x08b0('0x25')]()[_0x08b0('0x24')](function(){_0x42a6a2[_0x08b0('0x1b')](0xcc)[_0x08b0('0x1c')]();});}};}function handleEntityNotFound(_0x1f4ff2,_0x434243){return function(_0x4ed1fc){if(!_0x4ed1fc){_0x1f4ff2['sendStatus'](0x194);}return _0x4ed1fc;};}function handleError(_0x10fb2d,_0x4915b7){_0x4915b7=_0x4915b7||0x1f4;return function(_0x3b7022){logger['error'](_0x3b7022['stack']);if(_0x3b7022[_0x08b0('0x26')]){delete _0x3b7022[_0x08b0('0x26')];}_0x10fb2d[_0x08b0('0x1b')](_0x4915b7)[_0x08b0('0x27')](_0x3b7022);};}function getInteractionUsers(_0x388fbd,_0xe59e76){return new BPromise(function(_0x273fe7,_0x1bbbb2){try{if(_0xe59e76[_0x388fbd['id']]){_0x388fbd['Users']=_['map'](_0xe59e76[_0x388fbd['id']],function(_0x57c80f){return{'id':_0x57c80f['id']};});}}catch(_0xb27de8){_0x1bbbb2(_0xb27de8);}_0x273fe7(_0x388fbd);});}function getInteractionTags(_0x42d107,_0x35e231){return new BPromise(function(_0x167bb4,_0x3f86d5){try{if(_0x42d107['TagIds']){_0x42d107[_0x08b0('0x28')]=[];_0x42d107[_0x08b0('0x29')]['split'](',')[_0x08b0('0x2a')](function(_0x119d34){_0x42d107[_0x08b0('0x28')]['push'](_0x35e231[_0x119d34]);});}delete _0x42d107[_0x08b0('0x29')];}catch(_0x493c34){_0x3f86d5(_0x493c34);}_0x167bb4(_0x42d107);});}function getLastMessageText(_0x246660){return new BPromise(function(_0x52230c,_0x4c7bd8){return db[_0x08b0('0x2b')]['findOne']({'where':{'id':_0x246660['id']},'attributes':['lastMsgBody',_0x08b0('0x2c')],'raw':!![]})['then'](function(_0x144b65){if(!_0x144b65[_0x08b0('0x2c')]){_0x246660[_0x08b0('0x2c')]=_[_0x08b0('0x2d')](htmlToText[_0x08b0('0x2e')](_0x144b65['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x246660[_0x08b0('0x2c')]=_0x144b65[_0x08b0('0x2c')];}_0x52230c(_0x246660);})[_0x08b0('0x2f')](function(_0x12292a){_0x4c7bd8(_0x12292a);});});}function updateMailInteraction(_0x22259f,_0x32795e,_0x791aab,_0x2939ea){return new BPromise(function(_0xad82e9,_0x57fe88){return getInteractionUsers(_0x22259f,_0x791aab)['then'](function(_0x363a54){return getInteractionTags(_0x363a54,_0x32795e);})[_0x08b0('0x24')](function(_0x4b3387){if(_0x2939ea){_0xad82e9(getLastMessageText(_0x4b3387));}else{_0xad82e9(_0x4b3387);}})['catch'](function(_0x2a901a){_0x57fe88(_0x2a901a);});});}exports[_0x08b0('0x30')]=function(_0x1b0baa,_0xb94336){var _0xb9224d={},_0x526a95={},_0x5ef710={'count':0x0,'rows':[]};var _0x2b94e6=db['MailInteraction'][_0x08b0('0x31')];_0x526a95['model']=_['keys'](_0x2b94e6);_0x526a95[_0x08b0('0x32')]=_[_0x08b0('0x33')](_0x1b0baa['query']);_0x526a95[_0x08b0('0x34')]=_[_0x08b0('0x35')](_0x526a95[_0x08b0('0x36')],_0x526a95['query']);_0xb9224d[_0x08b0('0x37')]=_[_0x08b0('0x35')](_0x526a95['model'],qs['fields'](_0x1b0baa[_0x08b0('0x32')]['fields']));_0xb9224d[_0x08b0('0x37')]=_0xb9224d[_0x08b0('0x37')]['length']?_0xb9224d[_0x08b0('0x37')]:_0x526a95['model'];if(!_0x1b0baa[_0x08b0('0x32')]['hasOwnProperty'](_0x08b0('0x38'))){_0xb9224d[_0x08b0('0x1f')]=qs[_0x08b0('0x1f')](_0x1b0baa[_0x08b0('0x32')][_0x08b0('0x1f')]);_0xb9224d['offset']=qs[_0x08b0('0x1e')](_0x1b0baa[_0x08b0('0x32')][_0x08b0('0x1e')]);}_0xb9224d['order']=qs[_0x08b0('0x39')](_0x1b0baa['query'][_0x08b0('0x39')]);_0xb9224d['where']=qs[_0x08b0('0x34')](_[_0x08b0('0x3a')](_0x1b0baa[_0x08b0('0x32')],_0x526a95['filters']));var _0x2983d8=[];var _0x6ff3cc=squel[_0x08b0('0x3b')]()[_0x08b0('0x3c')]('id')[_0x08b0('0x3c')](_0x08b0('0x26'))['field'](_0x08b0('0x3d'))[_0x08b0('0x3e')](_0x08b0('0x3f'));var _0x5b20a1=squel[_0x08b0('0x3b')]()['field'](_0x08b0('0x40'))[_0x08b0('0x3e')](_0x08b0('0x41'),'me')[_0x08b0('0x42')]('me.MailInteractionId\x20=\x20i.id')[_0x08b0('0x42')](_0x08b0('0x43'))['where']('me.read\x20=\x20false');var _0x5b01c6=squel[_0x08b0('0x3b')]()[_0x08b0('0x3c')](_0x08b0('0x44'))[_0x08b0('0x3c')](_0x08b0('0x45'))['from']('user_has_mail_interactions','ui')['left_join'](_0x08b0('0x46'),'u',_0x08b0('0x47'));var _0x3aa177=squel[_0x08b0('0x3b')]()['from']('mail_interactions','i')[_0x08b0('0x48')](_0x08b0('0x49'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x08b0('0x46'),'o','o.id\x20=\x20i.UserId')[_0x08b0('0x48')](_0x08b0('0x4a'),'a',_0x08b0('0x4b'))['left_join'](_0x08b0('0x41'),'me',_0x08b0('0x4c'));var _0x4ef0ba=squel[_0x08b0('0x4d')]();if(_0x1b0baa['query'][_0x08b0('0x4e')]){var _0x16bf10=JSON['parse'](_0x1b0baa['query'][_0x08b0('0x4e')]);_[_0x08b0('0x33')](_0x16bf10)[_0x08b0('0x2a')](function(_0x36da26){var _0x26088d=_0x16bf10[_0x36da26];if(_0x36da26===_0x08b0('0x4f')){var _0x3d4c39=moment(_0x26088d[_0x08b0('0x50')][_0x08b0('0x51')])[_0x08b0('0x52')](_0x08b0('0x53'))[_0x08b0('0x54')]()[_0x08b0('0x55')]();var _0x10b56b=moment(_0x10b56b)[_0x08b0('0x54')]()['endOf']('day')[_0x08b0('0x55')]();_0x4ef0ba['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3d4c39,_0x10b56b);}else{if(_['isArray'](_0x26088d['condition'])){_0x26088d[_0x08b0('0x56')][_0x08b0('0x2a')](function(_0x35db64){switch(_0x26088d[_0x08b0('0x56')]['value']){case'IS':if(_0x36da26!==_0x08b0('0x57')&&_0x36da26!=='unreadMessages'){if(_[_0x08b0('0x58')](_0x26088d['value'])&&_0x26088d['value'][_0x08b0('0x59')]>0x1){_0x4ef0ba[_0x08b0('0x5a')](_0x26088d[_0x08b0('0x5b')]+'.'+_0x36da26+_0x08b0('0x5c'),_0x26088d[_0x08b0('0x50')]);}else{_0x4ef0ba[_0x08b0('0x5a')](_0x26088d['tableAlias']+'.'+_0x36da26+_0x08b0('0x5d'),_0x26088d[_0x08b0('0x50')][0x0]);}}break;case'=':_0x4ef0ba[_0x08b0('0x5a')](_0x26088d['tableAlias']+'.'+_0x36da26+_0x08b0('0x5d'),_0x26088d[_0x08b0('0x50')]);break;case _0x08b0('0x5e'):if(_0x36da26==='ContactId'){_0x4ef0ba['and'](_0x08b0('0x5f')+_0x08b0('0x60'),'%'+_0x26088d[_0x08b0('0x50')]+'%');_0x4ef0ba['or']('c.lastName'+_0x08b0('0x60'),'%'+_0x26088d[_0x08b0('0x50')]+'%');_0x4ef0ba['or'](_0x08b0('0x61')+_0x08b0('0x60'),'%'+_0x26088d['value']+'%');}else{_0x4ef0ba[_0x08b0('0x5a')](_0x26088d[_0x08b0('0x5b')]+'.'+_0x36da26+'\x20LIKE\x20?','%'+_0x26088d[_0x08b0('0x50')]+'%');}break;case'>':_0x4ef0ba[_0x08b0('0x5a')](_0x26088d[_0x08b0('0x5b')]+'.'+_0x36da26+_0x08b0('0x62'),_0x26088d['value']);break;case'<':_0x4ef0ba[_0x08b0('0x5a')](_0x26088d['tableAlias']+'.'+_0x36da26+_0x08b0('0x63'),_0x26088d[_0x08b0('0x50')]);break;}});}else{switch(_0x26088d['condition']['value']){case'IS':if(_0x36da26!==_0x08b0('0x57')&&_0x36da26!==_0x08b0('0x64')){if(_[_0x08b0('0x58')](_0x26088d[_0x08b0('0x50')])&&_0x26088d['value']['length']>0x1){_0x4ef0ba[_0x08b0('0x5a')](_0x26088d['tableAlias']+'.'+_0x36da26+_0x08b0('0x5c'),_0x26088d[_0x08b0('0x50')]);}else{_0x4ef0ba['and'](_0x26088d[_0x08b0('0x5b')]+'.'+_0x36da26+_0x08b0('0x5d'),_0x26088d['value'][0x0]);}}break;case'=':_0x4ef0ba[_0x08b0('0x5a')](_0x26088d[_0x08b0('0x5b')]+'.'+_0x36da26+_0x08b0('0x5d'),_0x26088d[_0x08b0('0x50')]);break;case'LIKE':if(_0x36da26===_0x08b0('0x65')){_0x4ef0ba['and']('c.firstName'+_0x08b0('0x60'),'%'+_0x26088d[_0x08b0('0x50')]+'%');_0x4ef0ba['or'](_0x08b0('0x66')+_0x08b0('0x60'),'%'+_0x26088d[_0x08b0('0x50')]+'%');_0x4ef0ba['or'](_0x08b0('0x61')+_0x08b0('0x60'),'%'+_0x26088d['value']+'%');}else{_0x4ef0ba['and'](_0x26088d['tableAlias']+'.'+_0x36da26+_0x08b0('0x60'),'%'+_0x26088d['value']+'%');}break;case'>':_0x4ef0ba[_0x08b0('0x5a')](_0x26088d['tableAlias']+'.'+_0x36da26+_0x08b0('0x62'),_0x26088d[_0x08b0('0x50')]);break;case'<':_0x4ef0ba['and'](_0x26088d[_0x08b0('0x5b')]+'.'+_0x36da26+'\x20<\x20?',_0x26088d[_0x08b0('0x50')]);break;}}}});}else{var _0x33cdbc=_(Object['keys'](_0x1b0baa[_0x08b0('0x32')]))[_0x08b0('0x67')](function(_0x1f8ac5){return _0x2b94e6[_0x08b0('0x68')](_0x1f8ac5)?_0x1f8ac5:undefined;})[_0x08b0('0x69')](function(_0x4b758c){return!_[_0x08b0('0x6a')](_0x4b758c);})['value']();if(!_['isEmpty'](_0x33cdbc)){_0x33cdbc['forEach'](function(_0xa523b1){if(_0xa523b1===_0x08b0('0x6b')){_0x3aa177[_0x08b0('0x42')](_0x08b0('0x6c'),[][_0x08b0('0x6d')](_0x1b0baa[_0x08b0('0x32')][_0xa523b1]));}else if(_0xa523b1==='createdAt'){var _0x133fe7=JSON[_0x08b0('0x6e')](_0x1b0baa[_0x08b0('0x32')][_0xa523b1])[_0x08b0('0x6f')];var _0x1bf681=JSON[_0x08b0('0x6e')](_0x1b0baa[_0x08b0('0x32')][_0xa523b1])['$lte'];_0x3aa177[_0x08b0('0x42')](_0x08b0('0x70'),_0x133fe7,_0x1bf681);}else{if(_0x1b0baa[_0x08b0('0x32')][_0xa523b1]===_0x08b0('0x71')){_0x3aa177['where']('i.'+_0xa523b1+_0x08b0('0x72'));}else{_0x3aa177[_0x08b0('0x42')]('i.'+_0xa523b1+'\x20=\x20?',_0x1b0baa[_0x08b0('0x32')][_0xa523b1]);}}});}if(_0x1b0baa[_0x08b0('0x32')][_0x08b0('0x69')]){var _0x6428e0=_0x1b0baa['query'][_0x08b0('0x69')][_0x08b0('0x73')]('\x5c','\x5c\x5c')[_0x08b0('0x73')]('\x27\x27',_0x08b0('0x74'));if(qs[_0x08b0('0x75')](_0x6428e0)){_0x4ef0ba['or'](_0x08b0('0x76'),_0x6428e0+'%');}else if(qs[_0x08b0('0x77')](_0x6428e0)){_0x4ef0ba['or']('c.email\x20LIKE\x20?',_0x6428e0+'%');}else{var _0x44b103=[];_0x6428e0['split']('\x20')['forEach'](function(_0x5005cf){_0x44b103[_0x08b0('0x78')]('+'+_0x5005cf[_0x08b0('0x79')]());});var _0x19854a=_0x44b103[_0x08b0('0x7a')]('\x20');_0x4ef0ba['or'](_0x08b0('0x7b'),_0x19854a)['or'](_0x08b0('0x7c'),_0x19854a);}}}_0x3aa177[_0x08b0('0x42')](_0x4ef0ba);if(_0xb9224d[_0x08b0('0x7d')]){_0xb9224d['order'][_0x08b0('0x2a')](function(_0x1005b8){_0x3aa177[_0x08b0('0x7d')]('i.'+_0x1005b8[0x0],_0x1005b8[0x1]==='DESC'?![]:!![]);});}_0x3aa177[_0x08b0('0x7e')](_0x08b0('0x7f'));var _0x554205={'type':db[_0x08b0('0x80')][_0x08b0('0x81')][_0x08b0('0x82')],'raw':!![]};var _0x20e016=_0x3aa177[_0x08b0('0x83')]()['field'](_0x08b0('0x40'))[_0x08b0('0x3c')](_0x08b0('0x84'),_0x08b0('0x64'));if(!_0x1b0baa['query'][_0x08b0('0x4e')]){if(_0x1b0baa['query'][_0x08b0('0x85')]){if(_0x1b0baa[_0x08b0('0x32')]['read']==0x1){_0x20e016[_0x08b0('0x86')](_0x08b0('0x87'));_0x3aa177[_0x08b0('0x86')]('`unreadMessages`\x20=\x200');}else{_0x20e016[_0x08b0('0x86')]('`unreadMessages`\x20>\x200');_0x3aa177[_0x08b0('0x86')](_0x08b0('0x88'));}}if(_0x1b0baa['query'][_0x08b0('0x89')]){var _0x29e398=_['isArray'](_0x1b0baa['query'][_0x08b0('0x89')])?_0x1b0baa['query'][_0x08b0('0x89')]:new Array(_0x1b0baa[_0x08b0('0x32')][_0x08b0('0x89')]);var _0x16f3ef=squel['expr']();_0x29e398['forEach'](function(_0x74473b){_0x16f3ef['or'](_0x08b0('0x8a'),'%,'+_0x74473b+',%');});_0x3aa177['having'](_0x16f3ef);_0x20e016['left_join'](_0x08b0('0x8b'),'it',_0x08b0('0x8c'));_0x20e016[_0x08b0('0x48')](_0x08b0('0x3f'),'t','t.id\x20=\x20it.TagId');_0x20e016[_0x08b0('0x42')](_0x08b0('0x8d'),_0x29e398);}}else{var _0x16bf10=JSON[_0x08b0('0x6e')](_0x1b0baa[_0x08b0('0x32')][_0x08b0('0x4e')]);_['keys'](_0x16bf10)['forEach'](function(_0x583090){var _0x2deac3=_0x16bf10[_0x583090];if(_0x583090===_0x08b0('0x57')){var _0x24756f=_0x2deac3[_0x08b0('0x50')];var _0x51ea27=squel[_0x08b0('0x4d')]();_0x24756f[_0x08b0('0x2a')](function(_0x391954){_0x51ea27['or'](_0x08b0('0x8a'),'%,'+_0x391954+',%');});_0x3aa177[_0x08b0('0x86')](_0x51ea27);_0x20e016['left_join'](_0x08b0('0x8b'),'it',_0x08b0('0x8c'));_0x20e016['left_join'](_0x08b0('0x3f'),'t',_0x08b0('0x8e'));_0x20e016[_0x08b0('0x42')](_0x08b0('0x8d'),_0x24756f);}else if(_0x583090===_0x08b0('0x64')){if(_0x2deac3[_0x08b0('0x50')]['length']===0x1){if(_0x2deac3[_0x08b0('0x50')][0x0]===0x1){_0x20e016[_0x08b0('0x86')](_0x08b0('0x87'));_0x3aa177[_0x08b0('0x86')](_0x08b0('0x87'));}else{_0x20e016[_0x08b0('0x86')](_0x08b0('0x88'));_0x3aa177['having'](_0x08b0('0x88'));}}}});}db[_0x08b0('0x8f')]['query'](_0x20e016[_0x08b0('0x79')](),_0x554205)[_0x08b0('0x24')](function(_0x2ebc02){_0x5ef710[_0x08b0('0x1d')]=_0x2ebc02[_0x08b0('0x59')];if(_0x5ef710[_0x08b0('0x1d')]===0x0)return[];return db[_0x08b0('0x8f')][_0x08b0('0x32')](_0x6ff3cc['toString'](),_0x554205)['then'](function(_0x322a67){_0x2983d8=_[_0x08b0('0x90')](_0x322a67,'id');_0x554205=_['merge'](_0x554205,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x84'),_0x08b0('0x64'));_0x3aa177[_0x08b0('0x3c')]('a.key',_0x08b0('0x91'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x92'),'Account.mandatoryDisposition');_0x3aa177[_0x08b0('0x3c')]('i.id');_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x93'));_0x3aa177['field']('i.updatedAt');_0x3aa177['field'](_0x08b0('0x94'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x95'));_0x3aa177['field'](_0x08b0('0x96'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x97'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x98'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x99'));_0x3aa177[_0x08b0('0x3c')]('i.disposition');_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x9a'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x9b'));_0x3aa177[_0x08b0('0x3c')]('i.ContactId');_0x3aa177['field'](_0x08b0('0x9c'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x9d'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x5f'),_0x08b0('0x9e'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x66'),_0x08b0('0x9f'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0x61'),_0x08b0('0xa0'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0xa1'),_0x08b0('0xa2'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0xa3'),_0x08b0('0xa4'));_0x3aa177[_0x08b0('0x3c')](_0x08b0('0xa5'),_0x08b0('0xa6'));_0x3aa177['field'](_0x08b0('0xa7'),_0x08b0('0x29'));_0x3aa177[_0x08b0('0x48')](_0x08b0('0x8b'),'it',_0x08b0('0x8c'));_0x3aa177[_0x08b0('0x48')](_0x08b0('0x3f'),'t','t.id\x20=\x20it.TagId');_0x3aa177['limit'](_0xb9224d[_0x08b0('0x1f')]);_0x3aa177[_0x08b0('0x1e')](_0xb9224d[_0x08b0('0x1e')]);return db[_0x08b0('0x8f')][_0x08b0('0x32')](_0x3aa177['toString'](),_0x554205);})[_0x08b0('0x24')](function(_0x555db1){_0x5b01c6[_0x08b0('0x42')](_0x08b0('0xa8'),_[_0x08b0('0x67')](_0x555db1,'id'));return db[_0x08b0('0x8f')][_0x08b0('0x32')](_0x5b01c6[_0x08b0('0x79')](),_0x554205)[_0x08b0('0x24')](function(_0x47ae05){var _0x323cd9=_[_0x08b0('0xa9')](_0x47ae05,_0x08b0('0xaa'));var _0x54eabf=[];return db[_0x08b0('0xab')][_0x08b0('0xac')]({'attributes':[_0x08b0('0xad')],'raw':!![]})[_0x08b0('0x24')](function(_0x57aa21){var _0x2882ba=_0x57aa21[_0x08b0('0xad')];_0x555db1[_0x08b0('0x2a')](function(_0x1cfa42){_0x54eabf['push'](updateMailInteraction(_0x1cfa42,_0x2983d8,_0x323cd9,_0x2882ba));});return BPromise[_0x08b0('0xae')](_0x54eabf);});});});})[_0x08b0('0x24')](function(_0x4bb470){_0x5ef710[_0x08b0('0xaf')]=_0x4bb470;return _0x5ef710;})['then'](respondWithFilteredResult(_0xb94336,_0xb9224d))[_0x08b0('0x2f')](handleError(_0xb94336,null));};exports[_0x08b0('0xb0')]=function(_0x222cb6,_0x214d6a){var _0x5c16c4={'raw':![],'where':{'id':_0x222cb6['params']['id']}},_0x422f45={};_0x422f45['model']=_[_0x08b0('0x33')](db[_0x08b0('0x2b')][_0x08b0('0x31')]);_0x422f45['query']=_[_0x08b0('0x33')](_0x222cb6['query']);_0x422f45[_0x08b0('0x34')]=_[_0x08b0('0x35')](_0x422f45[_0x08b0('0x36')],_0x422f45[_0x08b0('0x32')]);_0x5c16c4[_0x08b0('0x37')]=_[_0x08b0('0x35')](_0x422f45['model'],qs[_0x08b0('0xb1')](_0x222cb6['query'][_0x08b0('0xb1')]));_0x5c16c4[_0x08b0('0x37')]=_0x5c16c4[_0x08b0('0x37')][_0x08b0('0x59')]?_0x5c16c4[_0x08b0('0x37')]:_0x422f45[_0x08b0('0x36')];if(_0x222cb6[_0x08b0('0x32')][_0x08b0('0xb2')]){_0x5c16c4['include']=[{'all':!![]}];}_0x5c16c4=_['merge']({},_0x5c16c4,_0x222cb6['options']);return db['MailInteraction'][_0x08b0('0xb3')](_0x5c16c4)['then'](handleEntityNotFound(_0x214d6a,null))[_0x08b0('0x24')](respondWithResult(_0x214d6a,null))['catch'](handleError(_0x214d6a,null));};exports['create']=function(_0xdf5ce,_0x56a5d6){return db[_0x08b0('0x2b')]['create'](_0xdf5ce['body'],{})['then'](respondWithResult(_0x56a5d6,0xc9))['catch'](handleError(_0x56a5d6,null));};exports[_0x08b0('0x23')]=function(_0x290c1a,_0xabd9d9){if(_0x290c1a['body']['id']){delete _0x290c1a[_0x08b0('0xb4')]['id'];}return db[_0x08b0('0x2b')][_0x08b0('0xb3')]({'where':{'id':_0x290c1a[_0x08b0('0xb5')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0xabd9d9,null))[_0x08b0('0x24')](saveUpdates(_0x290c1a[_0x08b0('0xb4')],null))[_0x08b0('0x24')](respondWithResult(_0xabd9d9,null))[_0x08b0('0x2f')](handleError(_0xabd9d9,null));};exports[_0x08b0('0x25')]=function(_0x11646f,_0xc79492){return db[_0x08b0('0x2b')][_0x08b0('0xb3')]({'where':{'id':_0x11646f[_0x08b0('0xb5')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0xc79492,null))['then'](removeEntity(_0xc79492,null))[_0x08b0('0x2f')](handleError(_0xc79492,null));};exports['describe']=function(_0x5dc773,_0x3486e0){return db['MailInteraction'][_0x08b0('0xb6')]()[_0x08b0('0x24')](respondWithResult(_0x3486e0,null))[_0x08b0('0x2f')](handleError(_0x3486e0,null));};exports['addMessage']=function(_0x877208,_0x21cf2c,_0x273356){return db['MailMessage'][_0x08b0('0xb3')]({'where':{'id':_0x877208['params']['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x21cf2c,null))[_0x08b0('0x24')](function(_0x1d713e){if(_0x1d713e){return _0x1d713e[_0x08b0('0xb7')](_0x877208[_0x08b0('0xb4')][_0x08b0('0xb8')],_[_0x08b0('0xb9')](_0x877208['body'],[_0x08b0('0xb8'),'id'])||{});}})[_0x08b0('0x24')](respondWithResult(_0x21cf2c,null))[_0x08b0('0x2f')](handleError(_0x21cf2c,null));};exports[_0x08b0('0xba')]=function(_0x28f2da,_0x481bbb,_0xe62a5d){var _0x41b0df={'raw':![],'where':{}};var _0x2d2314={};var _0x31e22c={'count':0x0,'rows':[]};return db[_0x08b0('0x2b')][_0x08b0('0xac')]({'where':{'id':_0x28f2da[_0x08b0('0xb5')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x481bbb,null))[_0x08b0('0x24')](function(_0x28b1ca){if(_0x28b1ca){_0x2d2314[_0x08b0('0x36')]=_[_0x08b0('0x33')](db[_0x08b0('0xbb')][_0x08b0('0x31')]);_0x2d2314['query']=_[_0x08b0('0x33')](_0x28f2da[_0x08b0('0x32')]);_0x2d2314[_0x08b0('0x34')]=_['intersection'](_0x2d2314[_0x08b0('0x36')],_0x2d2314[_0x08b0('0x32')]);_0x41b0df['attributes']=_[_0x08b0('0x35')](_0x2d2314[_0x08b0('0x36')],qs[_0x08b0('0xb1')](_0x28f2da[_0x08b0('0x32')][_0x08b0('0xb1')]));_0x41b0df[_0x08b0('0x37')]=_0x41b0df[_0x08b0('0x37')]['length']?_0x41b0df[_0x08b0('0x37')]:_0x2d2314['model'];if(!_0x28f2da[_0x08b0('0x32')][_0x08b0('0x68')](_0x08b0('0x38'))){_0x41b0df['limit']=qs[_0x08b0('0x1f')](_0x28f2da[_0x08b0('0x32')][_0x08b0('0x1f')]);_0x41b0df[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x28f2da[_0x08b0('0x32')][_0x08b0('0x1e')]);}_0x41b0df[_0x08b0('0x7d')]=qs[_0x08b0('0x39')](_0x28f2da[_0x08b0('0x32')][_0x08b0('0x39')]);_0x41b0df[_0x08b0('0x42')]=qs[_0x08b0('0x34')](_[_0x08b0('0x3a')](_0x28f2da[_0x08b0('0x32')],_0x2d2314[_0x08b0('0x34')]));_0x41b0df[_0x08b0('0x42')]['MailInteractionId']=_0x28b1ca['id'];if(_0x28f2da['query'][_0x08b0('0x69')]){_0x41b0df[_0x08b0('0x42')]=_[_0x08b0('0xbc')](_0x41b0df[_0x08b0('0x42')],{'$or':_['map'](_0x41b0df[_0x08b0('0x37')],function(_0x35a280){var _0x468ed2={};_0x468ed2[_0x35a280]={'$like':'%'+_0x28f2da[_0x08b0('0x32')][_0x08b0('0x69')]+'%'};return _0x468ed2;})});}if(_0x28f2da['query'][_0x08b0('0x6f')]){var _0x5ebf97=_0x28f2da[_0x08b0('0x32')][_0x08b0('0x6f')][_0x08b0('0xbd')](',');var _0x32a090={};_0x32a090[_0x5ebf97[0x0]]={'$gte':moment(_0x5ebf97[0x1])[_0x08b0('0x55')](_0x08b0('0xbe'))};_0x41b0df[_0x08b0('0x42')]=_[_0x08b0('0xbc')](_0x41b0df['where'],_0x32a090);}_0x41b0df=_[_0x08b0('0xbc')]({},_0x41b0df,_0x28f2da[_0x08b0('0xbf')]);return db['MailMessage'][_0x08b0('0x1d')]({'where':_0x41b0df['where']})[_0x08b0('0x24')](function(_0x24fe9a){_0x31e22c[_0x08b0('0x1d')]=_0x24fe9a;if(_0x28f2da[_0x08b0('0x32')][_0x08b0('0xb2')]){_0x41b0df[_0x08b0('0xc0')]=[{'all':!![]}];}return db[_0x08b0('0xbb')][_0x08b0('0xc1')](_0x41b0df);})[_0x08b0('0x24')](function(_0x57cd03){_0x31e22c[_0x08b0('0xaf')]=_0x57cd03;return _0x31e22c;});}})[_0x08b0('0x24')](respondWithFilteredResult(_0x481bbb,_0x41b0df))[_0x08b0('0x2f')](handleError(_0x481bbb,null));};exports[_0x08b0('0xc2')]=function(_0x5aff87,_0x46c001,_0x35b002){return db[_0x08b0('0x2b')][_0x08b0('0xb3')]({'where':{'id':_0x5aff87[_0x08b0('0xb5')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x46c001,null))[_0x08b0('0x24')](function(_0x419455){if(_0x419455){return _0x419455['setTags'](_0x5aff87[_0x08b0('0xb4')][_0x08b0('0xb8')],_[_0x08b0('0xb9')](_0x5aff87[_0x08b0('0xb4')],[_0x08b0('0xb8'),'id'])||{})['spread'](function(){return db['Tag'][_0x08b0('0xc1')]({'attributes':['id',_0x08b0('0x26'),'color'],'where':{'id':_0x5aff87[_0x08b0('0xb4')][_0x08b0('0xb8')]}});})[_0x08b0('0x24')](function(_0x59d0dc){socket[_0x08b0('0xc3')](_0x08b0('0xc4'),{'id':Number(_0x5aff87[_0x08b0('0xb5')]['id']),'tags':_0x59d0dc||[]});return{'id':Number(_0x5aff87[_0x08b0('0xb5')]['id']),'tags':_0x59d0dc||[]};});}})[_0x08b0('0x24')](respondWithResult(_0x46c001,null))[_0x08b0('0x2f')](handleError(_0x46c001,null));};exports[_0x08b0('0xc5')]=function(_0x4ce7cf,_0x2718aa,_0x2d1ad2){return db[_0x08b0('0x2b')]['find']({'where':{'id':_0x4ce7cf[_0x08b0('0xb5')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x2718aa,null))[_0x08b0('0x24')](function(_0x47cc58){if(_0x47cc58){return _0x47cc58[_0x08b0('0xc5')](_0x4ce7cf[_0x08b0('0x32')][_0x08b0('0xb8')]);}})[_0x08b0('0x24')](respondWithStatusCode(_0x2718aa,null))[_0x08b0('0x2f')](handleError(_0x2718aa,null));};exports[_0x08b0('0xc6')]=function(_0x2187ec,_0x47ded7){var _0x408512=moment()[_0x08b0('0xc7')]()['toString']();var _0x23d2c3=path[_0x08b0('0x7a')](config[_0x08b0('0xc8')],_0x08b0('0xc9'),_0x08b0('0xca'),_0x08b0('0xcb'));var _0x3a31a1=path['join'](config[_0x08b0('0xc8')],_0x08b0('0xc9'),_0x08b0('0xca'),_0x08b0('0xcc'));var _0x397834=path[_0x08b0('0x7a')](_0x3a31a1,_0x408512);var _0xd6101e=util['format'](_0x08b0('0xcd'),_0x408512);var _0x436a32=path[_0x08b0('0x7a')](_0x3a31a1,_0xd6101e);var _0x5df940=![];return db['MailInteraction'][_0x08b0('0xb3')]({'where':{'id':_0x2187ec[_0x08b0('0xb5')]['id']}})[_0x08b0('0x24')](handleEntityNotFound(_0x47ded7,null))[_0x08b0('0x24')](function(_0x444263){if(_0x444263){return _0x444263[_0x08b0('0xba')]({'attributes':['id',_0x08b0('0xb4'),_0x08b0('0x3e'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'include':_0x2187ec[_0x08b0('0x32')]['attachments']?[{'model':db[_0x08b0('0xce')],'as':_0x08b0('0xcf')}]:undefined,'order':qs['sort']('id')});}return[];})[_0x08b0('0x24')](function(_0x27cf3e){_0x5df940=_0x27cf3e[_0x08b0('0x59')];if(_0x27cf3e[_0x08b0('0x59')]){fs[_0x08b0('0xd0')](_0x397834);return BPromise[_0x08b0('0xd1')](_0x27cf3e,function(_0x8a179,_0xb6d414){var _0x19db2f=_0x8a179;var _0x3fc058={'from':_0x19db2f[_0x08b0('0x3e')],'to':_0x19db2f['to'],'subject':_0x19db2f[_0x08b0('0xd2')],'html':_0x19db2f[_0x08b0('0xb4')],'headers':{'Date':moment(_0x19db2f[_0x08b0('0x4f')])[_0x08b0('0x55')](_0x08b0('0xd3'))},'attachments':[]};if(_0x8a179['cc']){_0x3fc058[_0x08b0('0xd4')]['Cc']=_0x8a179['cc'];}if(_0x8a179['bcc']){_0x3fc058[_0x08b0('0xd4')]['Bcc']=_0x8a179[_0x08b0('0xd5')];}return new BPromise(function(_0x540728,_0x4c68a6){if(_0x8a179[_0x08b0('0xcf')]){for(var _0x361b19=0x0;_0x361b19<_0x8a179[_0x08b0('0xcf')][_0x08b0('0x59')];_0x361b19++){var _0x469e0b=_0x8a179['Attachments'][_0x361b19];var _0x4bb659=path[_0x08b0('0x7a')](_0x23d2c3,_0x469e0b[_0x08b0('0xd6')]);if(fs[_0x08b0('0xd7')](_0x4bb659)){_0x3fc058['attachments']['push']({'name':_0x469e0b[_0x08b0('0x26')],'contentType':_0x469e0b['type'],'data':fs[_0x08b0('0xd8')](_0x4bb659)});}}}emlformat[_0x08b0('0xd9')](_0x3fc058,function(_0x4fd209,_0x2c72ee){if(_0x4fd209)return _0x4c68a6(_0x4fd209);fs['writeFileSync'](path[_0x08b0('0x7a')](_0x397834,util[_0x08b0('0x55')](_0x08b0('0xda'),_0xb6d414)),_0x2c72ee);return _0x540728(_0x2c72ee);});});});}})[_0x08b0('0x24')](function(){if(_0x5df940){return new BPromise(function(_0x597768,_0x50884f){zipdir(_0x397834,{'saveTo':_0x436a32},function(_0x1ba4e1,_0x1259b2){if(_0x1ba4e1)return _0x50884f(_0x1ba4e1);return _0x597768(_0x1259b2);});});}})[_0x08b0('0x24')](function(){if(_0x5df940){return new BPromise(function(_0x5cdfc2,_0x59d7f2){rimraf(_0x397834,function(_0xcd8901){if(_0xcd8901)_0x59d7f2(_0xcd8901);return _0x5cdfc2();});});}})[_0x08b0('0x24')](function(){if(_0x5df940){return _0x47ded7[_0x08b0('0xc6')](_0x436a32,_0xd6101e,function(_0x54dcee){if(_0x54dcee){console[_0x08b0('0xdb')](_0x08b0('0xdc'),_0x54dcee);}else{fs[_0x08b0('0xdd')](_0x436a32);}});}else{return _0x47ded7[_0x08b0('0xde')](0xc8);}})['catch'](handleError(_0x47ded7,null));}; \ No newline at end of file +var _0x57e2=['i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.substatus','i.to','i.UserId','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','push','all','rows','show','merge','options','create','body','find','params','addMessage','ids','omit','getMessages','hasOwnProperty','MailInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','MailMessage','count','includeAll','include','findAll','addTags','setTags','Tag','mailInteractionTags:save','removeTags','download','unix','root','files','attachments','server','tmp','bcc','subject','Attachment','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','type','readFileSync','build','writeFileSync','message%d.eml','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Users','map','Tags','TagIds','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','select','field','color','from','tools_tags','COUNT(*)','mail_messages','where','me.MailInteractionId\x20=\x20i.id','me.read\x20=\x20false','ui.MailInteractionId','user_has_mail_interactions','users','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false','expr','advancedFilter','parse','forEach','value','dateStart','startOf','day','utc','format','endOf','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','TagId','unreadMessages','tableAlias','\x20IN\x20?','\x20=\x20?','c.firstName','c.lastName','\x20LIKE\x20?','c.email','\x20<\x20?','LIKE','ContactId','filter','isNil','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','$lte','null','\x20IS\x20NULL','replace','isEmail','c.email\x20LIKE\x20?','split','join','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','order','DESC','group','i.id','SELECT','clone','COUNT(me.id)','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','sequelize','toString','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x57e2,0x123));var _0x257e=function(_0x496c45,_0x1d1ee2){_0x496c45=_0x496c45-0x0;var _0x1b5ea5=_0x57e2[_0x496c45];return _0x1b5ea5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x257e('0x0'));var zipdir=require(_0x257e('0x1'));var jsonpatch=require(_0x257e('0x2'));var rp=require(_0x257e('0x3'));var moment=require(_0x257e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x257e('0x5'));var path=require(_0x257e('0x6'));var sox=require(_0x257e('0x7'));var csv=require(_0x257e('0x8'));var ejs=require(_0x257e('0x9'));var fs=require('fs');var _=require(_0x257e('0xa'));var squel=require('squel');var crypto=require(_0x257e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x257e('0xc'));var toCsv=require(_0x257e('0x8'));var querystring=require(_0x257e('0xd'));var Papa=require('papaparse');var htmlToText=require('html-to-text');var Redis=require('ioredis');var authService=require(_0x257e('0xe'));var qs=require(_0x257e('0xf'));var hardwareService=require(_0x257e('0x10'));var logger=require(_0x257e('0x11'))('api');var utils=require(_0x257e('0x12'));var config=require(_0x257e('0x13'));var db=require(_0x257e('0x14'))['db'];config['redis']=_['defaults'](config[_0x257e('0x15')],{'host':_0x257e('0x16'),'port':0x18eb});var socket=require(_0x257e('0x17'))(new Redis(config[_0x257e('0x15')]));require(_0x257e('0x18'))[_0x257e('0x19')](socket);function respondWithStatusCode(_0x4acc17,_0xb4bf8f){_0xb4bf8f=_0xb4bf8f||0xcc;return function(_0x4138ba){if(_0x4138ba){return _0x4acc17[_0x257e('0x1a')](_0xb4bf8f);}return _0x4acc17[_0x257e('0x1b')](_0xb4bf8f)[_0x257e('0x1c')]();};}function respondWithResult(_0x24f1a7,_0x4183d0){_0x4183d0=_0x4183d0||0xc8;return function(_0x2cc6eb){if(_0x2cc6eb){return _0x24f1a7[_0x257e('0x1b')](_0x4183d0)[_0x257e('0x1d')](_0x2cc6eb);}};}function respondWithFilteredResult(_0x5542bc,_0x35bff9){return function(_0x2950db){if(_0x2950db){var _0x140891=_0x2950db['count'],_0x36b487=_0x35bff9[_0x257e('0x1e')],_0x1d21b8=_0x35bff9[_0x257e('0x1e')]+_0x35bff9[_0x257e('0x1f')],_0xd3fb85;if(_0x1d21b8>=_0x140891){_0x1d21b8=_0x140891;_0xd3fb85=0xc8;}else{_0xd3fb85=0xce;}_0x5542bc[_0x257e('0x1b')](_0xd3fb85);return _0x5542bc[_0x257e('0x20')](_0x257e('0x21'),_0x36b487+'-'+_0x1d21b8+'/'+_0x140891)[_0x257e('0x1d')](_0x2950db);}return null;};}function patchUpdates(_0x4f8057){return function(_0x3273a7){try{jsonpatch[_0x257e('0x22')](_0x3273a7,_0x4f8057,!![]);}catch(_0x318c0c){return BPromise[_0x257e('0x23')](_0x318c0c);}return _0x3273a7[_0x257e('0x24')]();};}function saveUpdates(_0x5131d2,_0x424853){return function(_0x11d394){if(_0x11d394){return _0x11d394[_0x257e('0x25')](_0x5131d2)[_0x257e('0x26')](function(_0x194088){return _0x194088;});}return null;};}function removeEntity(_0x46ed33,_0x56546b){return function(_0x49df67){if(_0x49df67){return _0x49df67[_0x257e('0x27')]()[_0x257e('0x26')](function(){_0x46ed33[_0x257e('0x1b')](0xcc)[_0x257e('0x1c')]();});}};}function handleEntityNotFound(_0x3eb15e,_0x58b848){return function(_0x47eecc){if(!_0x47eecc){_0x3eb15e['sendStatus'](0x194);}return _0x47eecc;};}function handleError(_0x5bc33a,_0x556574){_0x556574=_0x556574||0x1f4;return function(_0x6e9b9a){logger['error'](_0x6e9b9a[_0x257e('0x28')]);if(_0x6e9b9a[_0x257e('0x29')]){delete _0x6e9b9a[_0x257e('0x29')];}_0x5bc33a[_0x257e('0x1b')](_0x556574)[_0x257e('0x2a')](_0x6e9b9a);};}function getInteractionUsers(_0x37d769,_0x2965a3){return new BPromise(function(_0x56bc25,_0x3f1e59){try{if(_0x2965a3[_0x37d769['id']]){_0x37d769[_0x257e('0x2b')]=_[_0x257e('0x2c')](_0x2965a3[_0x37d769['id']],function(_0x16bb81){return{'id':_0x16bb81['id']};});}}catch(_0xe1670b){_0x3f1e59(_0xe1670b);}_0x56bc25(_0x37d769);});}function getInteractionTags(_0x27b7f9,_0x16fa13){return new BPromise(function(_0x229db1,_0x29f62d){try{if(_0x27b7f9['TagIds']){_0x27b7f9[_0x257e('0x2d')]=[];_0x27b7f9[_0x257e('0x2e')]['split'](',')['forEach'](function(_0x335b03){_0x27b7f9['Tags']['push'](_0x16fa13[_0x335b03]);});}delete _0x27b7f9[_0x257e('0x2e')];}catch(_0x575b4f){_0x29f62d(_0x575b4f);}_0x229db1(_0x27b7f9);});}function getLastMessageText(_0x2a0df9){return new BPromise(function(_0x33aa0d,_0x197d31){return db[_0x257e('0x2f')][_0x257e('0x30')]({'where':{'id':_0x2a0df9['id']},'attributes':[_0x257e('0x31'),_0x257e('0x32')],'raw':!![]})[_0x257e('0x26')](function(_0x2229ba){if(!_0x2229ba[_0x257e('0x32')]){_0x2a0df9[_0x257e('0x32')]=_[_0x257e('0x33')](htmlToText[_0x257e('0x34')](_0x2229ba[_0x257e('0x31')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2a0df9[_0x257e('0x32')]=_0x2229ba[_0x257e('0x32')];}_0x33aa0d(_0x2a0df9);})[_0x257e('0x35')](function(_0x50982e){_0x197d31(_0x50982e);});});}function updateMailInteraction(_0x3500de,_0x84ed26,_0x5614c6,_0x3a06cb){return new BPromise(function(_0xe2e210,_0x184f4b){return getInteractionUsers(_0x3500de,_0x5614c6)[_0x257e('0x26')](function(_0x5a0d70){return getInteractionTags(_0x5a0d70,_0x84ed26);})[_0x257e('0x26')](function(_0x3c36bd){if(_0x3a06cb){_0xe2e210(getLastMessageText(_0x3c36bd));}else{_0xe2e210(_0x3c36bd);}})[_0x257e('0x35')](function(_0x1ab891){_0x184f4b(_0x1ab891);});});}exports[_0x257e('0x36')]=function(_0x918147,_0x3cd2b2){var _0x4c432b={},_0x8d359d={},_0x540430={'count':0x0,'rows':[]};var _0x4143c4=db[_0x257e('0x2f')][_0x257e('0x37')];_0x8d359d[_0x257e('0x38')]=_[_0x257e('0x39')](_0x4143c4);_0x8d359d[_0x257e('0x3a')]=_[_0x257e('0x39')](_0x918147[_0x257e('0x3a')]);_0x8d359d[_0x257e('0x3b')]=_[_0x257e('0x3c')](_0x8d359d[_0x257e('0x38')],_0x8d359d[_0x257e('0x3a')]);_0x4c432b[_0x257e('0x3d')]=_[_0x257e('0x3c')](_0x8d359d[_0x257e('0x38')],qs[_0x257e('0x3e')](_0x918147[_0x257e('0x3a')]['fields']));_0x4c432b['attributes']=_0x4c432b['attributes'][_0x257e('0x3f')]?_0x4c432b[_0x257e('0x3d')]:_0x8d359d[_0x257e('0x38')];if(!_0x918147[_0x257e('0x3a')]['hasOwnProperty'](_0x257e('0x40'))){_0x4c432b['limit']=qs[_0x257e('0x1f')](_0x918147[_0x257e('0x3a')]['limit']);_0x4c432b[_0x257e('0x1e')]=qs['offset'](_0x918147['query'][_0x257e('0x1e')]);}_0x4c432b['order']=qs[_0x257e('0x41')](_0x918147[_0x257e('0x3a')]['sort']);_0x4c432b['where']=qs[_0x257e('0x3b')](_[_0x257e('0x42')](_0x918147[_0x257e('0x3a')],_0x8d359d['filters']));var _0x8f2064=[];var _0x45974f=squel[_0x257e('0x43')]()[_0x257e('0x44')]('id')[_0x257e('0x44')](_0x257e('0x29'))[_0x257e('0x44')](_0x257e('0x45'))[_0x257e('0x46')](_0x257e('0x47'));var _0x48744b=squel['select']()[_0x257e('0x44')](_0x257e('0x48'))[_0x257e('0x46')](_0x257e('0x49'),'me')[_0x257e('0x4a')](_0x257e('0x4b'))[_0x257e('0x4a')]('me.direction\x20=\x20\x27in\x27')[_0x257e('0x4a')](_0x257e('0x4c'));var _0x5542a9=squel[_0x257e('0x43')]()[_0x257e('0x44')]('u.id')[_0x257e('0x44')](_0x257e('0x4d'))[_0x257e('0x46')](_0x257e('0x4e'),'ui')['left_join'](_0x257e('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x1bb273=squel[_0x257e('0x43')]()[_0x257e('0x46')](_0x257e('0x50'),'i')[_0x257e('0x51')](_0x257e('0x52'),'c',_0x257e('0x53'))[_0x257e('0x51')](_0x257e('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x257e('0x51')]('mail_accounts','a',_0x257e('0x54'))['left_join'](_0x257e('0x49'),'me',_0x257e('0x55'));var _0x5634f9=squel[_0x257e('0x56')]();if(_0x918147[_0x257e('0x3a')][_0x257e('0x57')]){var _0xc0faef=JSON[_0x257e('0x58')](_0x918147[_0x257e('0x3a')]['advancedFilter']);_['keys'](_0xc0faef)[_0x257e('0x59')](function(_0x49465f){var _0x486797=_0xc0faef[_0x49465f];if(_0x49465f==='createdAt'){var _0x43b7c9=moment(_0x486797[_0x257e('0x5a')][_0x257e('0x5b')])[_0x257e('0x5c')](_0x257e('0x5d'))[_0x257e('0x5e')]()[_0x257e('0x5f')]();var _0x2a7bc7=moment(_0x2a7bc7)[_0x257e('0x5e')]()[_0x257e('0x60')](_0x257e('0x5d'))[_0x257e('0x5f')]();_0x5634f9[_0x257e('0x61')](_0x257e('0x62'),_0x43b7c9,_0x2a7bc7);}else{if(_[_0x257e('0x63')](_0x486797[_0x257e('0x64')])){_0x486797[_0x257e('0x64')][_0x257e('0x59')](function(_0x418697){switch(_0x486797[_0x257e('0x64')][_0x257e('0x5a')]){case'IS':if(_0x49465f!==_0x257e('0x65')&&_0x49465f!==_0x257e('0x66')){if(_[_0x257e('0x63')](_0x486797['value'])&&_0x486797[_0x257e('0x5a')][_0x257e('0x3f')]>0x1){_0x5634f9[_0x257e('0x61')](_0x486797[_0x257e('0x67')]+'.'+_0x49465f+_0x257e('0x68'),_0x486797[_0x257e('0x5a')]);}else{_0x5634f9[_0x257e('0x61')](_0x486797['tableAlias']+'.'+_0x49465f+_0x257e('0x69'),_0x486797['value'][0x0]);}}break;case'=':_0x5634f9[_0x257e('0x61')](_0x486797[_0x257e('0x67')]+'.'+_0x49465f+'\x20=\x20?',_0x486797[_0x257e('0x5a')]);break;case'LIKE':if(_0x49465f==='ContactId'){_0x5634f9[_0x257e('0x61')](_0x257e('0x6a')+'\x20LIKE\x20?','%'+_0x486797[_0x257e('0x5a')]+'%');_0x5634f9['or'](_0x257e('0x6b')+_0x257e('0x6c'),'%'+_0x486797[_0x257e('0x5a')]+'%');_0x5634f9['or'](_0x257e('0x6d')+_0x257e('0x6c'),'%'+_0x486797['value']+'%');}else{_0x5634f9[_0x257e('0x61')](_0x486797['tableAlias']+'.'+_0x49465f+_0x257e('0x6c'),'%'+_0x486797[_0x257e('0x5a')]+'%');}break;case'>':_0x5634f9['and'](_0x486797['tableAlias']+'.'+_0x49465f+'\x20>\x20?',_0x486797[_0x257e('0x5a')]);break;case'<':_0x5634f9[_0x257e('0x61')](_0x486797[_0x257e('0x67')]+'.'+_0x49465f+_0x257e('0x6e'),_0x486797[_0x257e('0x5a')]);break;}});}else{switch(_0x486797['condition'][_0x257e('0x5a')]){case'IS':if(_0x49465f!==_0x257e('0x65')&&_0x49465f!=='unreadMessages'){if(_[_0x257e('0x63')](_0x486797[_0x257e('0x5a')])&&_0x486797['value'][_0x257e('0x3f')]>0x1){_0x5634f9[_0x257e('0x61')](_0x486797[_0x257e('0x67')]+'.'+_0x49465f+_0x257e('0x68'),_0x486797[_0x257e('0x5a')]);}else{_0x5634f9[_0x257e('0x61')](_0x486797[_0x257e('0x67')]+'.'+_0x49465f+'\x20=\x20?',_0x486797[_0x257e('0x5a')][0x0]);}}break;case'=':_0x5634f9[_0x257e('0x61')](_0x486797[_0x257e('0x67')]+'.'+_0x49465f+_0x257e('0x69'),_0x486797[_0x257e('0x5a')]);break;case _0x257e('0x6f'):if(_0x49465f===_0x257e('0x70')){_0x5634f9['and'](_0x257e('0x6a')+_0x257e('0x6c'),'%'+_0x486797[_0x257e('0x5a')]+'%');_0x5634f9['or'](_0x257e('0x6b')+_0x257e('0x6c'),'%'+_0x486797[_0x257e('0x5a')]+'%');_0x5634f9['or'](_0x257e('0x6d')+_0x257e('0x6c'),'%'+_0x486797[_0x257e('0x5a')]+'%');}else{_0x5634f9[_0x257e('0x61')](_0x486797['tableAlias']+'.'+_0x49465f+_0x257e('0x6c'),'%'+_0x486797[_0x257e('0x5a')]+'%');}break;case'>':_0x5634f9['and'](_0x486797[_0x257e('0x67')]+'.'+_0x49465f+'\x20>\x20?',_0x486797[_0x257e('0x5a')]);break;case'<':_0x5634f9[_0x257e('0x61')](_0x486797['tableAlias']+'.'+_0x49465f+_0x257e('0x6e'),_0x486797['value']);break;}}}});}else{var _0x18216c=_(Object[_0x257e('0x39')](_0x918147[_0x257e('0x3a')]))[_0x257e('0x2c')](function(_0x468cc6){return _0x4143c4['hasOwnProperty'](_0x468cc6)?_0x468cc6:undefined;})[_0x257e('0x71')](function(_0x4f4795){return!_[_0x257e('0x72')](_0x4f4795);})[_0x257e('0x5a')]();if(!_[_0x257e('0x73')](_0x18216c)){_0x18216c[_0x257e('0x59')](function(_0x340c54){if(_0x340c54===_0x257e('0x74')){_0x1bb273[_0x257e('0x4a')](_0x257e('0x75'),[][_0x257e('0x76')](_0x918147[_0x257e('0x3a')][_0x340c54]));}else if(_0x340c54===_0x257e('0x77')){var _0x35c999=JSON[_0x257e('0x58')](_0x918147[_0x257e('0x3a')][_0x340c54])['$gte'];var _0x662976=JSON[_0x257e('0x58')](_0x918147[_0x257e('0x3a')][_0x340c54])[_0x257e('0x78')];_0x1bb273[_0x257e('0x4a')](_0x257e('0x62'),_0x35c999,_0x662976);}else{if(_0x918147[_0x257e('0x3a')][_0x340c54]===_0x257e('0x79')){_0x1bb273[_0x257e('0x4a')]('i.'+_0x340c54+_0x257e('0x7a'));}else{_0x1bb273[_0x257e('0x4a')]('i.'+_0x340c54+_0x257e('0x69'),_0x918147['query'][_0x340c54]);}}});}if(_0x918147['query'][_0x257e('0x71')]){var _0x9b38b6=_0x918147[_0x257e('0x3a')][_0x257e('0x71')][_0x257e('0x7b')]('\x5c','\x5c\x5c')[_0x257e('0x7b')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x9b38b6)){_0x5634f9['or']('i.id\x20LIKE\x20?',_0x9b38b6+'%');}else if(qs[_0x257e('0x7c')](_0x9b38b6)){_0x5634f9['or'](_0x257e('0x7d'),_0x9b38b6+'%');}else{var _0x4fb19c=[];_0x9b38b6[_0x257e('0x7e')]('\x20')[_0x257e('0x59')](function(_0x4a0f5e){_0x4fb19c['push']('+'+_0x4a0f5e['toString']());});var _0x164e8b=_0x4fb19c[_0x257e('0x7f')]('\x20');_0x5634f9['or'](_0x257e('0x80'),_0x164e8b)['or'](_0x257e('0x81'),_0x164e8b);}}}_0x1bb273[_0x257e('0x4a')](_0x5634f9);if(_0x4c432b[_0x257e('0x82')]){_0x4c432b[_0x257e('0x82')][_0x257e('0x59')](function(_0x281a97){_0x1bb273['order']('i.'+_0x281a97[0x0],_0x281a97[0x1]===_0x257e('0x83')?![]:!![]);});}_0x1bb273[_0x257e('0x84')](_0x257e('0x85'));var _0x279845={'type':db['Sequelize']['QueryTypes'][_0x257e('0x86')],'raw':!![]};var _0x408eda=_0x1bb273[_0x257e('0x87')]()['field']('COUNT(*)')[_0x257e('0x44')](_0x257e('0x88'),_0x257e('0x66'));if(!_0x918147['query'][_0x257e('0x57')]){if(_0x918147[_0x257e('0x3a')][_0x257e('0x89')]){if(_0x918147['query'][_0x257e('0x89')]==0x1){_0x408eda[_0x257e('0x8a')](_0x257e('0x8b'));_0x1bb273[_0x257e('0x8a')](_0x257e('0x8b'));}else{_0x408eda[_0x257e('0x8a')](_0x257e('0x8c'));_0x1bb273[_0x257e('0x8a')](_0x257e('0x8c'));}}if(_0x918147[_0x257e('0x3a')][_0x257e('0x8d')]){var _0x25c94a=_[_0x257e('0x63')](_0x918147[_0x257e('0x3a')][_0x257e('0x8d')])?_0x918147['query']['tag']:new Array(_0x918147['query'][_0x257e('0x8d')]);var _0x2a336b=squel[_0x257e('0x56')]();_0x25c94a['forEach'](function(_0x22b19d){_0x2a336b['or'](_0x257e('0x8e'),'%,'+_0x22b19d+',%');});_0x1bb273[_0x257e('0x8a')](_0x2a336b);_0x408eda[_0x257e('0x51')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id');_0x408eda[_0x257e('0x51')](_0x257e('0x47'),'t',_0x257e('0x8f'));_0x408eda['where'](_0x257e('0x90'),_0x25c94a);}}else{var _0xc0faef=JSON[_0x257e('0x58')](_0x918147[_0x257e('0x3a')][_0x257e('0x57')]);_[_0x257e('0x39')](_0xc0faef)[_0x257e('0x59')](function(_0x517f2d){var _0x36c5cc=_0xc0faef[_0x517f2d];if(_0x517f2d==='TagId'){var _0x2db08a=_0x36c5cc['value'];var _0x4a1ffd=squel[_0x257e('0x56')]();_0x2db08a[_0x257e('0x59')](function(_0x2855c1){_0x4a1ffd['or'](_0x257e('0x8e'),'%,'+_0x2855c1+',%');});_0x1bb273['having'](_0x4a1ffd);_0x408eda[_0x257e('0x51')](_0x257e('0x91'),'it',_0x257e('0x92'));_0x408eda[_0x257e('0x51')](_0x257e('0x47'),'t',_0x257e('0x8f'));_0x408eda[_0x257e('0x4a')](_0x257e('0x90'),_0x2db08a);}else if(_0x517f2d===_0x257e('0x66')){if(_0x36c5cc['value']['length']===0x1){if(_0x36c5cc[_0x257e('0x5a')][0x0]===0x1){_0x408eda[_0x257e('0x8a')](_0x257e('0x8b'));_0x1bb273['having']('`unreadMessages`\x20=\x200');}else{_0x408eda[_0x257e('0x8a')](_0x257e('0x8c'));_0x1bb273[_0x257e('0x8a')]('`unreadMessages`\x20>\x200');}}}});}db[_0x257e('0x93')][_0x257e('0x3a')](_0x408eda[_0x257e('0x94')](),_0x279845)[_0x257e('0x26')](function(_0x43f10c){_0x540430['count']=_0x43f10c[_0x257e('0x3f')];if(_0x540430['count']===0x0)return[];return db[_0x257e('0x93')]['query'](_0x45974f[_0x257e('0x94')](),_0x279845)[_0x257e('0x26')](function(_0x315066){_0x8f2064=_['keyBy'](_0x315066,'id');_0x279845=_['merge'](_0x279845,{'model':db[_0x257e('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x1bb273[_0x257e('0x44')](_0x257e('0x88'),_0x257e('0x66'));_0x1bb273[_0x257e('0x44')](_0x257e('0x95'),'Account.key');_0x1bb273[_0x257e('0x44')](_0x257e('0x96'),_0x257e('0x97'));_0x1bb273[_0x257e('0x44')](_0x257e('0x85'));_0x1bb273['field'](_0x257e('0x98'));_0x1bb273[_0x257e('0x44')](_0x257e('0x99'));_0x1bb273['field'](_0x257e('0x9a'));_0x1bb273[_0x257e('0x44')](_0x257e('0x9b'));_0x1bb273[_0x257e('0x44')]('i.attach');_0x1bb273[_0x257e('0x44')](_0x257e('0x9c'));_0x1bb273[_0x257e('0x44')](_0x257e('0x9d'));_0x1bb273[_0x257e('0x44')](_0x257e('0x9e'));_0x1bb273[_0x257e('0x44')](_0x257e('0x9f'));_0x1bb273[_0x257e('0x44')](_0x257e('0xa0'));_0x1bb273[_0x257e('0x44')](_0x257e('0xa1'));_0x1bb273[_0x257e('0x44')]('i.ContactId');_0x1bb273[_0x257e('0x44')]('i.MailAccountId');_0x1bb273[_0x257e('0x44')](_0x257e('0xa2'));_0x1bb273['field'](_0x257e('0x6a'),'Contact.firstName');_0x1bb273[_0x257e('0x44')](_0x257e('0x6b'),'Contact.lastName');_0x1bb273[_0x257e('0x44')](_0x257e('0x6d'),_0x257e('0xa3'));_0x1bb273['field']('c.phone',_0x257e('0xa4'));_0x1bb273['field'](_0x257e('0xa5'),_0x257e('0xa6'));_0x1bb273[_0x257e('0x44')]('c.fax',_0x257e('0xa7'));_0x1bb273['field'](_0x257e('0xa8'),_0x257e('0x2e'));_0x1bb273[_0x257e('0x51')]('mail_interaction_has_tags','it',_0x257e('0x92'));_0x1bb273[_0x257e('0x51')](_0x257e('0x47'),'t',_0x257e('0x8f'));_0x1bb273['limit'](_0x4c432b['limit']);_0x1bb273['offset'](_0x4c432b['offset']);return db[_0x257e('0x93')][_0x257e('0x3a')](_0x1bb273[_0x257e('0x94')](),_0x279845);})[_0x257e('0x26')](function(_0x70bbfe){_0x5542a9[_0x257e('0x4a')](_0x257e('0xa9'),_['map'](_0x70bbfe,'id'));return db[_0x257e('0x93')][_0x257e('0x3a')](_0x5542a9[_0x257e('0x94')](),_0x279845)['then'](function(_0x343bf0){var _0x28df6d=_[_0x257e('0xaa')](_0x343bf0,'MailInteractionId');var _0x39865=[];return db[_0x257e('0xab')][_0x257e('0x30')]({'attributes':[_0x257e('0xac')],'raw':!![]})[_0x257e('0x26')](function(_0x2c008b){var _0x48c62e=_0x2c008b[_0x257e('0xac')];_0x70bbfe[_0x257e('0x59')](function(_0x1700e5){_0x39865[_0x257e('0xad')](updateMailInteraction(_0x1700e5,_0x8f2064,_0x28df6d,_0x48c62e));});return BPromise[_0x257e('0xae')](_0x39865);});});});})['then'](function(_0x306543){_0x540430[_0x257e('0xaf')]=_0x306543;return _0x540430;})[_0x257e('0x26')](respondWithFilteredResult(_0x3cd2b2,_0x4c432b))[_0x257e('0x35')](handleError(_0x3cd2b2,null));};exports[_0x257e('0xb0')]=function(_0x53dcbb,_0x38cc5f){var _0x385ca3={'raw':![],'where':{'id':_0x53dcbb['params']['id']}},_0x2435c6={};_0x2435c6[_0x257e('0x38')]=_[_0x257e('0x39')](db['MailInteraction'][_0x257e('0x37')]);_0x2435c6[_0x257e('0x3a')]=_['keys'](_0x53dcbb[_0x257e('0x3a')]);_0x2435c6[_0x257e('0x3b')]=_[_0x257e('0x3c')](_0x2435c6[_0x257e('0x38')],_0x2435c6[_0x257e('0x3a')]);_0x385ca3[_0x257e('0x3d')]=_[_0x257e('0x3c')](_0x2435c6[_0x257e('0x38')],qs[_0x257e('0x3e')](_0x53dcbb[_0x257e('0x3a')][_0x257e('0x3e')]));_0x385ca3[_0x257e('0x3d')]=_0x385ca3[_0x257e('0x3d')]['length']?_0x385ca3[_0x257e('0x3d')]:_0x2435c6[_0x257e('0x38')];if(_0x53dcbb[_0x257e('0x3a')]['includeAll']){_0x385ca3['include']=[{'all':!![]}];}_0x385ca3=_[_0x257e('0xb1')]({},_0x385ca3,_0x53dcbb[_0x257e('0xb2')]);return db['MailInteraction']['find'](_0x385ca3)[_0x257e('0x26')](handleEntityNotFound(_0x38cc5f,null))[_0x257e('0x26')](respondWithResult(_0x38cc5f,null))[_0x257e('0x35')](handleError(_0x38cc5f,null));};exports[_0x257e('0xb3')]=function(_0x55686b,_0x56c80c){return db[_0x257e('0x2f')][_0x257e('0xb3')](_0x55686b[_0x257e('0xb4')],{})[_0x257e('0x26')](respondWithResult(_0x56c80c,0xc9))[_0x257e('0x35')](handleError(_0x56c80c,null));};exports[_0x257e('0x25')]=function(_0x5b581f,_0xa6078e){if(_0x5b581f[_0x257e('0xb4')]['id']){delete _0x5b581f[_0x257e('0xb4')]['id'];}return db[_0x257e('0x2f')][_0x257e('0xb5')]({'where':{'id':_0x5b581f[_0x257e('0xb6')]['id']}})['then'](handleEntityNotFound(_0xa6078e,null))[_0x257e('0x26')](saveUpdates(_0x5b581f[_0x257e('0xb4')],null))[_0x257e('0x26')](respondWithResult(_0xa6078e,null))[_0x257e('0x35')](handleError(_0xa6078e,null));};exports[_0x257e('0x27')]=function(_0x4e1ea5,_0x25a437){return db[_0x257e('0x2f')]['find']({'where':{'id':_0x4e1ea5['params']['id']}})[_0x257e('0x26')](handleEntityNotFound(_0x25a437,null))[_0x257e('0x26')](removeEntity(_0x25a437,null))[_0x257e('0x35')](handleError(_0x25a437,null));};exports['describe']=function(_0xca5038,_0x250af2){return db[_0x257e('0x2f')]['describe']()['then'](respondWithResult(_0x250af2,null))['catch'](handleError(_0x250af2,null));};exports[_0x257e('0xb7')]=function(_0x23ff20,_0x810971,_0x509580){return db['MailMessage'][_0x257e('0xb5')]({'where':{'id':_0x23ff20['params']['id']}})['then'](handleEntityNotFound(_0x810971,null))['then'](function(_0x2059bf){if(_0x2059bf){return _0x2059bf[_0x257e('0xb7')](_0x23ff20[_0x257e('0xb4')][_0x257e('0xb8')],_[_0x257e('0xb9')](_0x23ff20[_0x257e('0xb4')],['ids','id'])||{});}})[_0x257e('0x26')](respondWithResult(_0x810971,null))['catch'](handleError(_0x810971,null));};exports[_0x257e('0xba')]=function(_0x5e1e93,_0x18333b,_0x328b63){var _0x44cab0={'raw':![],'where':{}};var _0x2af939={};var _0x1368c5={'count':0x0,'rows':[]};return db[_0x257e('0x2f')]['findOne']({'where':{'id':_0x5e1e93[_0x257e('0xb6')]['id']}})['then'](handleEntityNotFound(_0x18333b,null))[_0x257e('0x26')](function(_0x2bb419){if(_0x2bb419){_0x2af939[_0x257e('0x38')]=_[_0x257e('0x39')](db['MailMessage']['rawAttributes']);_0x2af939[_0x257e('0x3a')]=_['keys'](_0x5e1e93[_0x257e('0x3a')]);_0x2af939[_0x257e('0x3b')]=_[_0x257e('0x3c')](_0x2af939['model'],_0x2af939[_0x257e('0x3a')]);_0x44cab0['attributes']=_[_0x257e('0x3c')](_0x2af939[_0x257e('0x38')],qs[_0x257e('0x3e')](_0x5e1e93[_0x257e('0x3a')][_0x257e('0x3e')]));_0x44cab0[_0x257e('0x3d')]=_0x44cab0[_0x257e('0x3d')][_0x257e('0x3f')]?_0x44cab0['attributes']:_0x2af939[_0x257e('0x38')];if(!_0x5e1e93['query'][_0x257e('0xbb')](_0x257e('0x40'))){_0x44cab0['limit']=qs['limit'](_0x5e1e93[_0x257e('0x3a')][_0x257e('0x1f')]);_0x44cab0[_0x257e('0x1e')]=qs[_0x257e('0x1e')](_0x5e1e93[_0x257e('0x3a')][_0x257e('0x1e')]);}_0x44cab0['order']=qs[_0x257e('0x41')](_0x5e1e93[_0x257e('0x3a')]['sort']);_0x44cab0[_0x257e('0x4a')]=qs['filters'](_[_0x257e('0x42')](_0x5e1e93['query'],_0x2af939[_0x257e('0x3b')]));_0x44cab0[_0x257e('0x4a')][_0x257e('0xbc')]=_0x2bb419['id'];if(_0x5e1e93['query'][_0x257e('0x71')]){_0x44cab0[_0x257e('0x4a')]=_[_0x257e('0xb1')](_0x44cab0['where'],{'$or':_[_0x257e('0x2c')](_0x44cab0['attributes'],function(_0x519ebf){var _0x4d17ec={};_0x4d17ec[_0x519ebf]={'$like':'%'+_0x5e1e93[_0x257e('0x3a')][_0x257e('0x71')]+'%'};return _0x4d17ec;})});}if(_0x5e1e93['query'][_0x257e('0xbd')]){var _0x74b98d=_0x5e1e93[_0x257e('0x3a')][_0x257e('0xbd')][_0x257e('0x7e')](',');var _0x18d278={};_0x18d278[_0x74b98d[0x0]]={'$gte':moment(_0x74b98d[0x1])[_0x257e('0x5f')](_0x257e('0xbe'))};_0x44cab0[_0x257e('0x4a')]=_[_0x257e('0xb1')](_0x44cab0['where'],_0x18d278);}_0x44cab0=_[_0x257e('0xb1')]({},_0x44cab0,_0x5e1e93[_0x257e('0xb2')]);return db[_0x257e('0xbf')][_0x257e('0xc0')]({'where':_0x44cab0[_0x257e('0x4a')]})['then'](function(_0x2c8eda){_0x1368c5[_0x257e('0xc0')]=_0x2c8eda;if(_0x5e1e93[_0x257e('0x3a')][_0x257e('0xc1')]){_0x44cab0[_0x257e('0xc2')]=[{'all':!![]}];}return db[_0x257e('0xbf')][_0x257e('0xc3')](_0x44cab0);})[_0x257e('0x26')](function(_0x1d64d6){_0x1368c5[_0x257e('0xaf')]=_0x1d64d6;return _0x1368c5;});}})[_0x257e('0x26')](respondWithFilteredResult(_0x18333b,_0x44cab0))[_0x257e('0x35')](handleError(_0x18333b,null));};exports[_0x257e('0xc4')]=function(_0x55ec54,_0x3b845d,_0x5c60f3){return db[_0x257e('0x2f')][_0x257e('0xb5')]({'where':{'id':_0x55ec54[_0x257e('0xb6')]['id']}})[_0x257e('0x26')](handleEntityNotFound(_0x3b845d,null))[_0x257e('0x26')](function(_0x59854f){if(_0x59854f){return _0x59854f[_0x257e('0xc5')](_0x55ec54[_0x257e('0xb4')][_0x257e('0xb8')],_[_0x257e('0xb9')](_0x55ec54[_0x257e('0xb4')],[_0x257e('0xb8'),'id'])||{})['spread'](function(){return db[_0x257e('0xc6')][_0x257e('0xc3')]({'attributes':['id','name',_0x257e('0x45')],'where':{'id':_0x55ec54[_0x257e('0xb4')][_0x257e('0xb8')]}});})[_0x257e('0x26')](function(_0x56c633){socket['emit'](_0x257e('0xc7'),{'id':Number(_0x55ec54[_0x257e('0xb6')]['id']),'tags':_0x56c633||[]});return{'id':Number(_0x55ec54[_0x257e('0xb6')]['id']),'tags':_0x56c633||[]};});}})[_0x257e('0x26')](respondWithResult(_0x3b845d,null))['catch'](handleError(_0x3b845d,null));};exports['removeTags']=function(_0x247561,_0x4d62db,_0x14429f){return db[_0x257e('0x2f')]['find']({'where':{'id':_0x247561['params']['id']}})[_0x257e('0x26')](handleEntityNotFound(_0x4d62db,null))['then'](function(_0x4a9e4f){if(_0x4a9e4f){return _0x4a9e4f[_0x257e('0xc8')](_0x247561[_0x257e('0x3a')][_0x257e('0xb8')]);}})[_0x257e('0x26')](respondWithStatusCode(_0x4d62db,null))['catch'](handleError(_0x4d62db,null));};exports[_0x257e('0xc9')]=function(_0x52edd8,_0x241d9b){var _0x1c2023=moment()[_0x257e('0xca')]()['toString']();var _0x2b96b7=path['join'](config[_0x257e('0xcb')],'server',_0x257e('0xcc'),_0x257e('0xcd'));var _0x39fa7d=path[_0x257e('0x7f')](config[_0x257e('0xcb')],_0x257e('0xce'),_0x257e('0xcc'),_0x257e('0xcf'));var _0x2fec8a=path[_0x257e('0x7f')](_0x39fa7d,_0x1c2023);var _0x1615aa=util[_0x257e('0x5f')]('interaction-%s.zip',_0x1c2023);var _0x379831=path[_0x257e('0x7f')](_0x39fa7d,_0x1615aa);var _0x32fc52=![];return db[_0x257e('0x2f')][_0x257e('0xb5')]({'where':{'id':_0x52edd8[_0x257e('0xb6')]['id']}})[_0x257e('0x26')](handleEntityNotFound(_0x241d9b,null))[_0x257e('0x26')](function(_0x486ea2){if(_0x486ea2){return _0x486ea2[_0x257e('0xba')]({'attributes':['id',_0x257e('0xb4'),_0x257e('0x46'),'to','cc',_0x257e('0xd0'),_0x257e('0xd1'),_0x257e('0x77')],'where':{'secret':![]},'include':_0x52edd8[_0x257e('0x3a')][_0x257e('0xcd')]?[{'model':db[_0x257e('0xd2')],'as':'Attachments'}]:undefined,'order':qs[_0x257e('0x41')]('id')});}return[];})['then'](function(_0x574021){_0x32fc52=_0x574021[_0x257e('0x3f')];if(_0x574021[_0x257e('0x3f')]){fs[_0x257e('0xd3')](_0x2fec8a);return BPromise['each'](_0x574021,function(_0x353e8d,_0x181706){var _0x166bb5=_0x353e8d;var _0x5d5e6c={'from':_0x166bb5[_0x257e('0x46')],'to':_0x166bb5['to'],'subject':_0x166bb5['subject'],'html':_0x166bb5[_0x257e('0xb4')],'headers':{'Date':moment(_0x166bb5[_0x257e('0x77')])['format'](_0x257e('0xd4'))},'attachments':[]};if(_0x353e8d['cc']){_0x5d5e6c[_0x257e('0xd5')]['Cc']=_0x353e8d['cc'];}if(_0x353e8d['bcc']){_0x5d5e6c[_0x257e('0xd5')]['Bcc']=_0x353e8d[_0x257e('0xd0')];}return new BPromise(function(_0x467bdb,_0x4e5324){if(_0x353e8d[_0x257e('0xd6')]){for(var _0x39fe25=0x0;_0x39fe25<_0x353e8d[_0x257e('0xd6')][_0x257e('0x3f')];_0x39fe25++){var _0x3b1a1b=_0x353e8d[_0x257e('0xd6')][_0x39fe25];var _0x5bd83c=path[_0x257e('0x7f')](_0x2b96b7,_0x3b1a1b['basename']);if(fs[_0x257e('0xd7')](_0x5bd83c)){_0x5d5e6c['attachments'][_0x257e('0xad')]({'name':_0x3b1a1b[_0x257e('0x29')],'contentType':_0x3b1a1b[_0x257e('0xd8')],'data':fs[_0x257e('0xd9')](_0x5bd83c)});}}}emlformat[_0x257e('0xda')](_0x5d5e6c,function(_0x41139e,_0x574698){if(_0x41139e)return _0x4e5324(_0x41139e);fs[_0x257e('0xdb')](path[_0x257e('0x7f')](_0x2fec8a,util['format'](_0x257e('0xdc'),_0x181706)),_0x574698);return _0x467bdb(_0x574698);});});});}})[_0x257e('0x26')](function(){if(_0x32fc52){return new BPromise(function(_0x2f5ccb,_0x1c9c85){zipdir(_0x2fec8a,{'saveTo':_0x379831},function(_0x3d6bc9,_0x4ce62e){if(_0x3d6bc9)return _0x1c9c85(_0x3d6bc9);return _0x2f5ccb(_0x4ce62e);});});}})[_0x257e('0x26')](function(){if(_0x32fc52){return new BPromise(function(_0x157d8a,_0x487859){rimraf(_0x2fec8a,function(_0x10e62b){if(_0x10e62b)_0x487859(_0x10e62b);return _0x157d8a();});});}})['then'](function(){if(_0x32fc52){return _0x241d9b[_0x257e('0xc9')](_0x379831,_0x1615aa,function(_0x3d9d6f){if(_0x3d9d6f){console['log'](_0x257e('0xdd'),_0x3d9d6f);}else{fs[_0x257e('0xde')](_0x379831);}});}else{return _0x241d9b[_0x257e('0x1a')](0xc8);}})[_0x257e('0x35')](handleError(_0x241d9b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 62e8c19..c393444 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 _0x240a=['findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','then','setDataValue','Users','map'];(function(_0x34e55,_0x56bb3d){var _0x3b92d5=function(_0x2a978e){while(--_0x2a978e){_0x34e55['push'](_0x34e55['shift']());}};_0x3b92d5(++_0x56bb3d);}(_0x240a,0x1c1));var _0xa240=function(_0x543fb6,_0x35342d){_0x543fb6=_0x543fb6-0x0;var _0x2ea1e7=_0x240a[_0x543fb6];return _0x2ea1e7;};'use strict';var EventEmitter=require(_0xa240('0x0'));var MailInteraction=require(_0xa240('0x1'))['db'][_0xa240('0x2')];var MailMessage=require(_0xa240('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa240('0x3')](0x0);var events={'afterCreate':_0xa240('0x4'),'afterUpdate':_0xa240('0x5'),'afterDestroy':'remove'};function emitEvent(_0x422733){return function(_0x1e20a1,_0xe43d88,_0x81e709){_0x1e20a1['getUsers']({'attributes':['id'],'raw':!![]})[_0xa240('0x6')](function(_0x2677c3){_0x1e20a1[_0xa240('0x7')](_0xa240('0x8'),_0x2677c3[_0xa240('0x9')](function(_0x4a425e){return{'id':_0x4a425e['id']};}));return MailMessage[_0xa240('0xa')]({'where':{'MailInteractionId':_0x1e20a1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa240('0x6')](function(_0x5431ae){_0x1e20a1[_0xa240('0x7')](_0xa240('0xb'),_0x5431ae[_0xa240('0xc')]);MailInteractionEvents['emit'](_0x422733+':'+_0x1e20a1['id'],_0x1e20a1);MailInteractionEvents[_0xa240('0xd')](_0x422733,_0x1e20a1);_0x81e709(null);})[_0xa240('0xe')](_0x81e709(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa240('0xf')](e,emitEvent(event));}}module[_0xa240('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xa1c9=['setMaxListeners','save','remove','then','setDataValue','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0xa1c9,0xb3));var _0x9a1c=function(_0x281aa2,_0x55282c){_0x281aa2=_0x281aa2-0x0;var _0x5475d2=_0xa1c9[_0x281aa2];return _0x5475d2;};'use strict';var EventEmitter=require(_0x9a1c('0x0'));var MailInteraction=require(_0x9a1c('0x1'))['db'][_0x9a1c('0x2')];var MailMessage=require(_0x9a1c('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9a1c('0x3')](0x0);var events={'afterCreate':_0x9a1c('0x4'),'afterUpdate':'update','afterDestroy':_0x9a1c('0x5')};function emitEvent(_0x12dc83){return function(_0x46d0b4,_0x3e1eed,_0x208c53){_0x46d0b4['getUsers']({'attributes':['id'],'raw':!![]})[_0x9a1c('0x6')](function(_0x8c48ae){_0x46d0b4[_0x9a1c('0x7')]('Users',_0x8c48ae['map'](function(_0x871455){return{'id':_0x871455['id']};}));return MailMessage[_0x9a1c('0x8')]({'where':{'MailInteractionId':_0x46d0b4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a1c('0x6')](function(_0x299873){_0x46d0b4[_0x9a1c('0x7')]('unreadMessages',_0x299873[_0x9a1c('0x9')]);MailInteractionEvents[_0x9a1c('0xa')](_0x12dc83+':'+_0x46d0b4['id'],_0x46d0b4);MailInteractionEvents['emit'](_0x12dc83,_0x46d0b4);_0x208c53(null);})[_0x9a1c('0xb')](_0x208c53(null));};}for(var e in events){if(events[_0x9a1c('0xc')](e)){var event=events[e];MailInteraction[_0x9a1c('0xd')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 087a521..b23bdf9 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 _0xf33c=['closed','closedAt','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0xf33c,0x159));var _0xcf33=function(_0x820f9b,_0x42e954){_0x820f9b=_0x820f9b-0x0;var _0x50a3ea=_0xf33c[_0x820f9b];return _0x50a3ea;};'use strict';var _=require('lodash');var util=require(_0xcf33('0x0'));var logger=require('../../config/logger')(_0xcf33('0x1'));var moment=require('moment');var BPromise=require(_0xcf33('0x2'));var rp=require(_0xcf33('0x3'));var fs=require('fs');var path=require(_0xcf33('0x4'));var rimraf=require(_0xcf33('0x5'));var config=require(_0xcf33('0x6'));var attributes=require(_0xcf33('0x7'));module['exports']=function(_0x378b66,_0x3d414a){return _0x378b66[_0xcf33('0x8')](_0xcf33('0x9'),attributes,{'tableName':_0xcf33('0xa'),'paranoid':![],'indexes':[{'name':_0xcf33('0xb'),'fields':[_0xcf33('0xc'),'to'],'type':_0xcf33('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5dba63,_0x3af17d,_0x464a72){if(_0x5dba63[_0xcf33('0xe')]){_0x5dba63['substatusAt']=moment()[_0xcf33('0xf')](_0xcf33('0x10'));}if(_0x5dba63['closed']){_0x5dba63['closedAt']=moment()[_0xcf33('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x464a72(null,_0x3af17d);},'beforeUpdate':function(_0x35a8ba,_0x2f0f76,_0x295ec3){if(_0x35a8ba[_0xcf33('0x11')]('substatus')){_0x35a8ba[_0xcf33('0x12')]=moment()[_0xcf33('0xf')](_0xcf33('0x10'));}if(_0x35a8ba[_0xcf33('0x11')](_0xcf33('0x13'))){_0x35a8ba[_0xcf33('0x14')]=moment()['format'](_0xcf33('0x10'));}_0x295ec3(null,_0x35a8ba);},'afterUpdate':function(_0x56da0c,_0x4bac75,_0x4e3778){var _0x20b6bb=_0x378b66['models'];var _0x384aa4=_0x56da0c[_0xcf33('0x15')]({'plain':!![]});if(_0x384aa4[_0xcf33('0x13')]){return _0x20b6bb[_0xcf33('0x16')][_0xcf33('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x384aa4['id']}})[_0xcf33('0x18')](function(){_0x4e3778();})[_0xcf33('0x19')](function(_0x572616){_0x4e3778(_0x572616);});}else{_0x4e3778();}}},'charset':_0xcf33('0x1a'),'collate':_0xcf33('0x1b')});}; \ No newline at end of file +var _0x54c7=['changed','MailMessage','update','catch','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','define','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x54c7,0x1a3));var _0x754c=function(_0x4f2911,_0x3cd473){_0x4f2911=_0x4f2911-0x0;var _0x446e0a=_0x54c7[_0x4f2911];return _0x446e0a;};'use strict';var _=require(_0x754c('0x0'));var util=require(_0x754c('0x1'));var logger=require('../../config/logger')(_0x754c('0x2'));var moment=require(_0x754c('0x3'));var BPromise=require(_0x754c('0x4'));var rp=require(_0x754c('0x5'));var fs=require('fs');var path=require(_0x754c('0x6'));var rimraf=require(_0x754c('0x7'));var config=require('../../config/environment');var attributes=require(_0x754c('0x8'));module['exports']=function(_0x3ef835,_0x49e4e8){return _0x3ef835[_0x754c('0x9')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x754c('0xa'),'fields':[_0x754c('0xb'),'to'],'type':_0x754c('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45be93,_0xfef60c,_0x26706e){if(_0x45be93[_0x754c('0xd')]){_0x45be93[_0x754c('0xe')]=moment()[_0x754c('0xf')](_0x754c('0x10'));}if(_0x45be93['closed']){_0x45be93[_0x754c('0x11')]=moment()[_0x754c('0xf')](_0x754c('0x10'));}_0x26706e(null,_0xfef60c);},'beforeUpdate':function(_0x3cdd37,_0x2eecf4,_0x441fdf){if(_0x3cdd37[_0x754c('0x12')](_0x754c('0xd'))){_0x3cdd37[_0x754c('0xe')]=moment()[_0x754c('0xf')](_0x754c('0x10'));}if(_0x3cdd37[_0x754c('0x12')]('closed')){_0x3cdd37[_0x754c('0x11')]=moment()[_0x754c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x441fdf(null,_0x3cdd37);},'afterUpdate':function(_0x2c2b47,_0x567221,_0x4ac1c2){var _0x38a536=_0x3ef835['models'];var _0x49ee23=_0x2c2b47['get']({'plain':!![]});if(_0x49ee23['closed']){return _0x38a536[_0x754c('0x13')][_0x754c('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x49ee23['id']}})['then'](function(){_0x4ac1c2();})[_0x754c('0x15')](function(_0x4dc0b9){_0x4ac1c2(_0x4dc0b9);});}else{_0x4ac1c2();}}},'charset':_0x754c('0x16'),'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 f2c458a..9023a3e 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 _0x6e16=['body','options','raw','where','attributes','limit','catch','find','addTags','ids','AddTags','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','UpdateMailInteraction','MailInteraction','update'];(function(_0x185250,_0x51eedb){var _0x263e7e=function(_0x3f72f6){while(--_0x3f72f6){_0x185250['push'](_0x185250['shift']());}};_0x263e7e(++_0x51eedb);}(_0x6e16,0x1d3));var _0x66e1=function(_0x14d261,_0x17230a){_0x14d261=_0x14d261-0x0;var _0x311b24=_0x6e16[_0x14d261];return _0x311b24;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66e1('0x0'));var BPromise=require('bluebird');var rs=require(_0x66e1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e1('0x2'))['db'];var utils=require(_0x66e1('0x3'));var logger=require('../../config/logger')(_0x66e1('0x4'));var config=require('../../config/environment');var jayson=require(_0x66e1('0x5'));var client=jayson[_0x66e1('0x6')][_0x66e1('0x7')]({'port':0x232a});config['redis']=_[_0x66e1('0x8')](config[_0x66e1('0x9')],{'host':_0x66e1('0xa'),'port':0x18eb});var socket=require(_0x66e1('0xb'))(new Redis(config[_0x66e1('0x9')]));require(_0x66e1('0xc'))[_0x66e1('0xd')](socket);function respondWithRpcPromise(_0x216b29,_0x9cba7,_0x162838){return new BPromise(function(_0x1534f5,_0x912641){return client[_0x66e1('0xe')](_0x216b29,_0x162838)[_0x66e1('0xf')](function(_0x4dbc4f){logger['info'](_0x66e1('0x10'),_0x9cba7,_0x66e1('0x11'));logger[_0x66e1('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x9cba7,'request\x20sent',JSON[_0x66e1('0x13')](_0x4dbc4f));if(_0x4dbc4f['error']){if(_0x4dbc4f[_0x66e1('0x14')][_0x66e1('0x15')]===0x1f4){logger['error'](_0x66e1('0x10'),_0x9cba7,_0x4dbc4f[_0x66e1('0x14')]['message']);return _0x912641(_0x4dbc4f[_0x66e1('0x14')][_0x66e1('0x16')]);}logger[_0x66e1('0x14')](_0x66e1('0x10'),_0x9cba7,_0x4dbc4f['error'][_0x66e1('0x16')]);return _0x1534f5(_0x4dbc4f[_0x66e1('0x14')][_0x66e1('0x16')]);}else{logger[_0x66e1('0x17')](_0x66e1('0x10'),_0x9cba7,'request\x20sent');_0x1534f5(_0x4dbc4f['result'][_0x66e1('0x16')]);}})['catch'](function(_0x3bf67d){logger[_0x66e1('0x14')](_0x66e1('0x10'),_0x9cba7,_0x3bf67d);_0x912641(_0x3bf67d);});});}exports[_0x66e1('0x18')]=function(_0x1e6a2f){var _0x5cb071=this;return new Promise(function(_0x57b2f1,_0x23c6ce){return db[_0x66e1('0x19')][_0x66e1('0x1a')](_0x1e6a2f[_0x66e1('0x1b')],{'raw':_0x1e6a2f[_0x66e1('0x1c')]?_0x1e6a2f[_0x66e1('0x1c')][_0x66e1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6a2f[_0x66e1('0x1c')]?_0x1e6a2f[_0x66e1('0x1c')][_0x66e1('0x1e')]||null:null,'attributes':_0x1e6a2f[_0x66e1('0x1c')]?_0x1e6a2f[_0x66e1('0x1c')][_0x66e1('0x1f')]||null:null,'limit':_0x1e6a2f[_0x66e1('0x1c')]?_0x1e6a2f[_0x66e1('0x1c')][_0x66e1('0x20')]||null:null})['then'](function(_0xca80e3){logger['info'](_0x66e1('0x18'),_0x1e6a2f);logger[_0x66e1('0x12')](_0x66e1('0x18'),_0x1e6a2f,JSON[_0x66e1('0x13')](_0xca80e3));_0x57b2f1(_0xca80e3);})[_0x66e1('0x21')](function(_0x4f500e){logger[_0x66e1('0x14')](_0x66e1('0x18'),_0x4f500e[_0x66e1('0x16')],_0x1e6a2f);_0x23c6ce(_0x5cb071['error'](0x1f4,_0x4f500e[_0x66e1('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0x5e1e87){return new Promise(function(_0x21fd24,_0x3fcc99){return db[_0x66e1('0x19')][_0x66e1('0x22')]({'where':_0x5e1e87[_0x66e1('0x1c')]?_0x5e1e87[_0x66e1('0x1c')][_0x66e1('0x1e')]||null:null})[_0x66e1('0xf')](function(_0xc6e6ed){if(_0xc6e6ed){return _0xc6e6ed[_0x66e1('0x23')](_0x5e1e87[_0x66e1('0x1b')][_0x66e1('0x24')],_['omit'](_0x5e1e87[_0x66e1('0x1b')],[_0x66e1('0x24'),'id'])||{});}})['spread'](function(_0xe80e00){logger[_0x66e1('0x17')](_0x66e1('0x25'),_0x5e1e87);logger[_0x66e1('0x12')]('AddTags',_0x5e1e87,JSON[_0x66e1('0x13')](_0xe80e00));_0x21fd24(_0xe80e00);})[_0x66e1('0x21')](function(_0x23e4ff){logger['error'](_0x66e1('0x25'),_0x23e4ff['message'],_0x5e1e87);_0x3fcc99(_this['error'](0x1f4,_0x23e4ff['message']));});});}; \ No newline at end of file +var _0x1491=['omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','info','result','catch','MailInteraction','body','options','where','attributes','limit','then','UpdateMailInteraction','debug','AddTagsToMailInteraction','ids'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1491,0x1b1));var _0x1149=function(_0x121e47,_0x53cdbc){_0x121e47=_0x121e47-0x0;var _0x4c1495=_0x1491[_0x121e47];return _0x4c1495;};'use strict';var _=require(_0x1149('0x0'));var util=require(_0x1149('0x1'));var moment=require(_0x1149('0x2'));var BPromise=require(_0x1149('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1149('0x4'));var db=require(_0x1149('0x5'))['db'];var utils=require(_0x1149('0x6'));var logger=require(_0x1149('0x7'))(_0x1149('0x8'));var config=require(_0x1149('0x9'));var jayson=require(_0x1149('0xa'));var client=jayson[_0x1149('0xb')][_0x1149('0xc')]({'port':0x232a});config[_0x1149('0xd')]=_[_0x1149('0xe')](config[_0x1149('0xd')],{'host':_0x1149('0xf'),'port':0x18eb});var socket=require(_0x1149('0x10'))(new Redis(config[_0x1149('0xd')]));require(_0x1149('0x11'))[_0x1149('0x12')](socket);function respondWithRpcPromise(_0x449487,_0x82dd3f,_0x4f0bb6){return new BPromise(function(_0xea86b8,_0x54e748){return client['request'](_0x449487,_0x4f0bb6)['then'](function(_0x45e302){logger['info']('MailInteraction,\x20%s,\x20%s',_0x82dd3f,_0x1149('0x13'));logger['debug'](_0x1149('0x14'),_0x82dd3f,_0x1149('0x13'),JSON[_0x1149('0x15')](_0x45e302));if(_0x45e302[_0x1149('0x16')]){if(_0x45e302[_0x1149('0x16')][_0x1149('0x17')]===0x1f4){logger['error'](_0x1149('0x18'),_0x82dd3f,_0x45e302['error']['message']);return _0x54e748(_0x45e302[_0x1149('0x16')][_0x1149('0x19')]);}logger['error'](_0x1149('0x18'),_0x82dd3f,_0x45e302[_0x1149('0x16')][_0x1149('0x19')]);return _0xea86b8(_0x45e302[_0x1149('0x16')][_0x1149('0x19')]);}else{logger[_0x1149('0x1a')](_0x1149('0x18'),_0x82dd3f,_0x1149('0x13'));_0xea86b8(_0x45e302[_0x1149('0x1b')][_0x1149('0x19')]);}})[_0x1149('0x1c')](function(_0x4147a8){logger[_0x1149('0x16')]('MailInteraction,\x20%s,\x20%s',_0x82dd3f,_0x4147a8);_0x54e748(_0x4147a8);});});}exports['UpdateMailInteraction']=function(_0x31acc1){var _0x2b85f9=this;return new Promise(function(_0x3a9337,_0x4781b8){return db[_0x1149('0x1d')]['update'](_0x31acc1[_0x1149('0x1e')],{'raw':_0x31acc1[_0x1149('0x1f')]?_0x31acc1[_0x1149('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31acc1[_0x1149('0x1f')]?_0x31acc1[_0x1149('0x1f')][_0x1149('0x20')]||null:null,'attributes':_0x31acc1['options']?_0x31acc1[_0x1149('0x1f')][_0x1149('0x21')]||null:null,'limit':_0x31acc1[_0x1149('0x1f')]?_0x31acc1['options'][_0x1149('0x22')]||null:null})[_0x1149('0x23')](function(_0x1f36ff){logger[_0x1149('0x1a')](_0x1149('0x24'),_0x31acc1);logger[_0x1149('0x25')](_0x1149('0x24'),_0x31acc1,JSON[_0x1149('0x15')](_0x1f36ff));_0x3a9337(_0x1f36ff);})[_0x1149('0x1c')](function(_0x2b754d){logger['error'](_0x1149('0x24'),_0x2b754d[_0x1149('0x19')],_0x31acc1);_0x4781b8(_0x2b85f9['error'](0x1f4,_0x2b754d[_0x1149('0x19')]));});});};exports[_0x1149('0x26')]=function(_0x4dc164){return new Promise(function(_0x593df7,_0x1b633a){return db[_0x1149('0x1d')]['find']({'where':_0x4dc164[_0x1149('0x1f')]?_0x4dc164[_0x1149('0x1f')][_0x1149('0x20')]||null:null})[_0x1149('0x23')](function(_0x5b9f9c){if(_0x5b9f9c){return _0x5b9f9c['addTags'](_0x4dc164['body'][_0x1149('0x27')],_[_0x1149('0x28')](_0x4dc164[_0x1149('0x1e')],['ids','id'])||{});}})[_0x1149('0x29')](function(_0x1a8cdb){logger[_0x1149('0x1a')](_0x1149('0x2a'),_0x4dc164);logger['debug'](_0x1149('0x2a'),_0x4dc164,JSON[_0x1149('0x15')](_0x1a8cdb));_0x593df7(_0x1a8cdb);})['catch'](function(_0x4971f7){logger[_0x1149('0x16')]('AddTags',_0x4971f7['message'],_0x4dc164);_0x1b633a(_this['error'](0x1f4,_0x4971f7['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 3a3092e..8e0d424 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 _0xcfb3=['update','emit','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x19c64a,_0x5de14e){var _0x1b1a06=function(_0x5dd104){while(--_0x5dd104){_0x19c64a['push'](_0x19c64a['shift']());}};_0x1b1a06(++_0x5de14e);}(_0xcfb3,0x171));var _0x3cfb=function(_0xadec4e,_0x35639e){_0xadec4e=_0xadec4e-0x0;var _0x3655ae=_0xcfb3[_0xadec4e];return _0x3655ae;};'use strict';var MailInteractionEvents=require(_0x3cfb('0x0'));var events=[_0x3cfb('0x1'),'remove',_0x3cfb('0x2')];function createListener(_0x1a255b,_0x18548f){return function(_0x3a960d){_0x18548f[_0x3cfb('0x3')](_0x1a255b,_0x3a960d);};}function removeListener(_0x5e6cf3,_0x4deccc){return function(){MailInteractionEvents['removeListener'](_0x5e6cf3,_0x4deccc);};}exports[_0x3cfb('0x4')]=function(_0x5c23df){for(var _0x2d2ea8=0x0,_0x420070=events[_0x3cfb('0x5')];_0x2d2ea8<_0x420070;_0x2d2ea8++){var _0x2fa1dc=events[_0x2d2ea8];var _0x4fc140=createListener(_0x3cfb('0x6')+_0x2fa1dc,_0x5c23df);MailInteractionEvents['on'](_0x2fa1dc,_0x4fc140);}}; \ No newline at end of file +var _0xd84a=['update','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xd84a,0xbd));var _0xad84=function(_0x55e17a,_0xd28c33){_0x55e17a=_0x55e17a-0x0;var _0x722ec7=_0xd84a[_0x55e17a];return _0x722ec7;};'use strict';var MailInteractionEvents=require(_0xad84('0x0'));var events=[_0xad84('0x1'),_0xad84('0x2'),_0xad84('0x3')];function createListener(_0x3b695d,_0x1e6a65){return function(_0x13a3a6){_0x1e6a65['emit'](_0x3b695d,_0x13a3a6);};}function removeListener(_0x39ea2b,_0xb7fc46){return function(){MailInteractionEvents[_0xad84('0x4')](_0x39ea2b,_0xb7fc46);};}exports[_0xad84('0x5')]=function(_0x3cd7d9){for(var _0x1ab363=0x0,_0x40bdc9=events[_0xad84('0x6')];_0x1ab363<_0x40bdc9;_0x1ab363++){var _0x3c423b=events[_0x1ab363];var _0x72b495=createListener(_0xad84('0x7')+_0x3c423b,_0x3cd7d9);MailInteractionEvents['on'](_0x3c423b,_0x72b495);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 277858c..c2dbce5 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 _0xe5b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','mail','create','put','update','/:id/accept','accept','reject','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x5f20e0,_0x3c15bc){var _0x2dbb44=function(_0xb5cbc5){while(--_0xb5cbc5){_0x5f20e0['push'](_0x5f20e0['shift']());}};_0x2dbb44(++_0x3c15bc);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5ec48a,_0x4d3fa8){_0x5ec48a=_0x5ec48a-0x0;var _0x23bf04=_0xe5b3[_0x5ec48a];return _0x23bf04;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0x9')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller['show']);router['get'](_0x3e5b('0xe'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x10')]('/',auth[_0x3e5b('0xa')](),interaction['tracked'](_0x3e5b('0x11'),'mailmessage:create'),controller[_0x3e5b('0x12')]);router[_0x3e5b('0x13')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0x14')]);router[_0x3e5b('0x13')](_0x3e5b('0x15'),auth['isAuthenticated'](),controller[_0x3e5b('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x3e5b('0x17')]);router[_0x3e5b('0x18')](_0x3e5b('0xd'),auth['isAuthenticated'](),controller[_0x3e5b('0x19')]);module['exports']=router; \ No newline at end of file +var _0x81bd=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x250599,_0x22787a){var _0x2f88a7=function(_0x3e3d4e){while(--_0x3e3d4e){_0x250599['push'](_0x250599['shift']());}};_0x2f88a7(++_0x22787a);}(_0x81bd,0x7c));var _0xd81b=function(_0x3cc563,_0x1598d3){_0x3cc563=_0x3cc563-0x0;var _0x11c044=_0x81bd[_0x3cc563];return _0x11c044;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd81b('0x9')]('/:id',auth[_0xd81b('0xc')](),controller[_0xd81b('0xd')]);router[_0xd81b('0x9')](_0xd81b('0xe'),auth[_0xd81b('0xc')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')]('/',auth[_0xd81b('0xc')](),interaction[_0xd81b('0x11')](_0xd81b('0x12'),_0xd81b('0x13')),controller[_0xd81b('0x14')]);router[_0xd81b('0x15')]('/:id',auth[_0xd81b('0xc')](),controller['update']);router[_0xd81b('0x15')](_0xd81b('0x16'),auth['isAuthenticated'](),controller[_0xd81b('0x17')]);router['put'](_0xd81b('0x18'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x19')]);router[_0xd81b('0x1a')](_0xd81b('0x1b'),auth['isAuthenticated'](),controller[_0xd81b('0x1c')]);module[_0xd81b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fc3cc2b..93708b4 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 _0xf277=['medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','sequelize','lodash','TEXT'];(function(_0x2b1bc8,_0x36c41f){var _0x112de1=function(_0x2db122){while(--_0x2db122){_0x2b1bc8['push'](_0x2b1bc8['shift']());}};_0x112de1(++_0x36c41f);}(_0xf277,0x1e1));var _0x7f27=function(_0x3ce20e,_0x80c3ed){_0x3ce20e=_0x3ce20e-0x0;var _0x4308bb=_0xf277[_0x3ce20e];return _0x4308bb;};'use strict';var Sequelize=require(_0x7f27('0x0'));var _=require(_0x7f27('0x1'));module['exports']={'body':{'type':Sequelize[_0x7f27('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7f27('0x2')](_0x7f27('0x3'))},'read':{'type':Sequelize[_0x7f27('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f27('0x5')]('in',_0x7f27('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7f27('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x7f27('0x2')](_0x7f27('0x8'))},'cc':{'type':Sequelize['TEXT'](_0x7f27('0x8'))},'bcc':{'type':Sequelize[_0x7f27('0x2')]('long')},'subject':{'type':Sequelize[_0x7f27('0x2')]},'sentAt':{'type':Sequelize[_0x7f27('0x9')]},'attach':{'type':Sequelize[_0x7f27('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7f27('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x7f27('0x8'))},'originCc':{'type':Sequelize['TEXT'](_0x7f27('0x8'))}}; \ No newline at end of file +var _0x078a=['DATE','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING'];(function(_0x5deebd,_0x552756){var _0x563008=function(_0x3c256b){while(--_0x3c256b){_0x5deebd['push'](_0x5deebd['shift']());}};_0x563008(++_0x552756);}(_0x078a,0x12d));var _0xa078=function(_0x597f48,_0x59856a){_0x597f48=_0x597f48-0x0;var _0x1cea6c=_0x078a[_0x597f48];return _0x1cea6c;};'use strict';var Sequelize=require(_0xa078('0x0'));var _=require(_0xa078('0x1'));module[_0xa078('0x2')]={'body':{'type':Sequelize[_0xa078('0x3')](_0xa078('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa078('0x3')]('medium')},'read':{'type':Sequelize[_0xa078('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa078('0x6')]('in',_0xa078('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa078('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa078('0x3')](_0xa078('0x4'))},'cc':{'type':Sequelize[_0xa078('0x3')](_0xa078('0x4'))},'bcc':{'type':Sequelize[_0xa078('0x3')](_0xa078('0x4'))},'subject':{'type':Sequelize[_0xa078('0x3')]},'sentAt':{'type':Sequelize[_0xa078('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa078('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa078('0x9')]},'originTo':{'type':Sequelize[_0xa078('0x3')](_0xa078('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xa078('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index bcdd2b7..c82ff03 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 _0x8eac=['rawAttributes','includeAll','options','find','body','describe','create','direction','secret','MailAccount','findOne','MailServerOut','Smtp','service','host','port','secure','auth','user','pass','attachments','length','join','root','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','read','readAt','UserId','CmContact','Contact','get','isNil','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','mail','agent','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','files','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','build','log','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','request','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','stack','name','send','index','MailMessage','model','keys','query','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','count','include','findAll','rows','catch','show','params'];(function(_0x48a1c1,_0x1165da){var _0x2b3292=function(_0x4f2034){while(--_0x4f2034){_0x48a1c1['push'](_0x48a1c1['shift']());}};_0x2b3292(++_0x1165da);}(_0x8eac,0x198));var _0xc8ea=function(_0x225815,_0x5db310){_0x225815=_0x225815-0x0;var _0x47a32e=_0x8eac[_0x225815];return _0x47a32e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc8ea('0x0'));var rimraf=require(_0xc8ea('0x1'));var zipdir=require(_0xc8ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8ea('0x3'));var moment=require(_0xc8ea('0x4'));var BPromise=require(_0xc8ea('0x5'));var Mustache=require(_0xc8ea('0x6'));var util=require(_0xc8ea('0x7'));var path=require(_0xc8ea('0x8'));var sox=require(_0xc8ea('0x9'));var csv=require(_0xc8ea('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc8ea('0xb'));var squel=require('squel');var crypto=require(_0xc8ea('0xc'));var jsforce=require(_0xc8ea('0xd'));var deskjs=require(_0xc8ea('0xe'));var toCsv=require(_0xc8ea('0xa'));var querystring=require('querystring');var Papa=require(_0xc8ea('0xf'));var Redis=require(_0xc8ea('0x10'));var authService=require(_0xc8ea('0x11'));var qs=require(_0xc8ea('0x12'));var hardwareService=require(_0xc8ea('0x13'));var logger=require(_0xc8ea('0x14'))(_0xc8ea('0x15'));var utils=require(_0xc8ea('0x16'));var config=require('../../config/environment');var db=require(_0xc8ea('0x17'))['db'];config[_0xc8ea('0x18')]=_[_0xc8ea('0x19')](config[_0xc8ea('0x18')],{'host':_0xc8ea('0x1a'),'port':0x18eb});var socket=require(_0xc8ea('0x1b'))(new Redis(config[_0xc8ea('0x18')]));require(_0xc8ea('0x1c'))[_0xc8ea('0x1d')](socket);var jayson=require(_0xc8ea('0x1e'));var client=jayson[_0xc8ea('0x1f')][_0xc8ea('0x20')]({'port':0x232c});var client9003=jayson[_0xc8ea('0x1f')][_0xc8ea('0x20')]({'port':0x232b});var client9002=jayson[_0xc8ea('0x1f')][_0xc8ea('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1e342e,_0x52d98a,_0x1e770e){if(_0x1e770e){var _0x7af15c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7af15c['test'](_0x52d98a)){return _0x1e342e;}else{throw new db[(_0xc8ea('0x21'))][(_0xc8ea('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1e342e;}}function respondWithRpcPromise(_0x39523d,_0x41206c,_0xd584d,_0x22d236){return new BPromise(function(_0x23d96c,_0x19d941){var _0x3482f1=_0x22d236||client;return _0x3482f1[_0xc8ea('0x23')](_0x39523d,_0xd584d)['then'](function(_0x2a3b61){logger['info'](_0xc8ea('0x24'),_0x41206c,'request\x20sent');logger['debug'](_0xc8ea('0x25'),_0x41206c,_0xc8ea('0x26'),JSON[_0xc8ea('0x27')](_0x2a3b61));if(_0x2a3b61[_0xc8ea('0x28')]){if(_0x2a3b61['error'][_0xc8ea('0x29')]===0x1f4){logger[_0xc8ea('0x28')](_0xc8ea('0x24'),_0x41206c,_0x2a3b61[_0xc8ea('0x28')][_0xc8ea('0x2a')]);return _0x19d941(_0x2a3b61[_0xc8ea('0x28')][_0xc8ea('0x2a')]);}logger[_0xc8ea('0x28')](_0xc8ea('0x24'),_0x41206c,_0x2a3b61[_0xc8ea('0x28')][_0xc8ea('0x2a')]);return _0x23d96c(_0x2a3b61[_0xc8ea('0x28')][_0xc8ea('0x2a')]);}else{logger['info'](_0xc8ea('0x24'),_0x41206c,_0xc8ea('0x26'));_0x23d96c(_0x2a3b61[_0xc8ea('0x2b')][_0xc8ea('0x2a')]);}})['catch'](function(_0x4197d1){logger['error'](_0xc8ea('0x24'),_0x41206c,_0x4197d1);_0x19d941(_0x4197d1);});});}function respondWithStatusCode(_0x3b5bc3,_0x180d6d){_0x180d6d=_0x180d6d||0xcc;return function(_0x222eb0){if(_0x222eb0){return _0x3b5bc3['sendStatus'](_0x180d6d);}return _0x3b5bc3['status'](_0x180d6d)['end']();};}function respondWithResult(_0x520481,_0x3b7d2e){_0x3b7d2e=_0x3b7d2e||0xc8;return function(_0x50f22b){if(_0x50f22b){return _0x520481[_0xc8ea('0x2c')](_0x3b7d2e)['json'](_0x50f22b);}};}function respondWithFilteredResult(_0x295a98,_0x17dade){return function(_0x37f513){if(_0x37f513){var _0x2e64d5=_0x37f513['count'],_0x42ca07=_0x17dade['offset'],_0x924ba2=_0x17dade[_0xc8ea('0x2d')]+_0x17dade[_0xc8ea('0x2e')],_0x20f1c6;if(_0x924ba2>=_0x2e64d5){_0x924ba2=_0x2e64d5;_0x20f1c6=0xc8;}else{_0x20f1c6=0xce;}_0x295a98[_0xc8ea('0x2c')](_0x20f1c6);return _0x295a98[_0xc8ea('0x2f')](_0xc8ea('0x30'),_0x42ca07+'-'+_0x924ba2+'/'+_0x2e64d5)[_0xc8ea('0x31')](_0x37f513);}return null;};}function patchUpdates(_0x4ce78f){return function(_0x1aff0b){try{jsonpatch[_0xc8ea('0x32')](_0x1aff0b,_0x4ce78f,!![]);}catch(_0x4f6802){return BPromise['reject'](_0x4f6802);}return _0x1aff0b[_0xc8ea('0x33')]();};}function saveUpdates(_0x776aa8,_0x5519ec){return function(_0x218aa7){if(_0x218aa7){return _0x218aa7[_0xc8ea('0x34')](_0x776aa8)['then'](function(_0x52c9a2){return _0x52c9a2;});}return null;};}function removeEntity(_0x1b70e1,_0x4b07ff){return function(_0x44ecda){if(_0x44ecda){return _0x44ecda[_0xc8ea('0x35')]()[_0xc8ea('0x36')](function(){_0x1b70e1[_0xc8ea('0x2c')](0xcc)[_0xc8ea('0x37')]();});}};}function handleEntityNotFound(_0x5382fe,_0x4d32a0){return function(_0x1b77e3){if(!_0x1b77e3){_0x5382fe[_0xc8ea('0x38')](0x194);}return _0x1b77e3;};}function handleError(_0xd0669f,_0x4ff1f4){_0x4ff1f4=_0x4ff1f4||0x1f4;return function(_0x289cb9){logger['error'](_0x289cb9[_0xc8ea('0x39')]);if(_0x289cb9['name']){delete _0x289cb9[_0xc8ea('0x3a')];}_0xd0669f[_0xc8ea('0x2c')](_0x4ff1f4)[_0xc8ea('0x3b')](_0x289cb9);};}exports[_0xc8ea('0x3c')]=function(_0x4c14ae,_0x4b0720){var _0x266607={},_0x38f249={},_0x1573b5={'count':0x0,'rows':[]};var _0x25929d=db[_0xc8ea('0x3d')]['rawAttributes'];_0x38f249[_0xc8ea('0x3e')]=_[_0xc8ea('0x3f')](_0x25929d);_0x38f249['query']=_[_0xc8ea('0x3f')](_0x4c14ae[_0xc8ea('0x40')]);_0x38f249[_0xc8ea('0x41')]=_[_0xc8ea('0x42')](_0x38f249['model'],_0x38f249[_0xc8ea('0x40')]);_0x266607[_0xc8ea('0x43')]=_[_0xc8ea('0x42')](_0x38f249[_0xc8ea('0x3e')],qs[_0xc8ea('0x44')](_0x4c14ae[_0xc8ea('0x40')][_0xc8ea('0x44')]));_0x266607[_0xc8ea('0x43')]=_0x266607[_0xc8ea('0x43')]['length']?_0x266607[_0xc8ea('0x43')]:_0x38f249['model'];if(!_0x4c14ae['query']['hasOwnProperty']('nolimit')){_0x266607[_0xc8ea('0x2e')]=qs[_0xc8ea('0x2e')](_0x4c14ae[_0xc8ea('0x40')][_0xc8ea('0x2e')]);_0x266607[_0xc8ea('0x2d')]=qs[_0xc8ea('0x2d')](_0x4c14ae[_0xc8ea('0x40')][_0xc8ea('0x2d')]);}_0x266607[_0xc8ea('0x45')]=qs[_0xc8ea('0x46')](_0x4c14ae[_0xc8ea('0x40')][_0xc8ea('0x46')]);_0x266607['where']=qs[_0xc8ea('0x41')](_[_0xc8ea('0x47')](_0x4c14ae[_0xc8ea('0x40')],_0x38f249[_0xc8ea('0x41')]));if(_0x4c14ae['query'][_0xc8ea('0x48')]){_0x266607[_0xc8ea('0x49')]=_[_0xc8ea('0x4a')](_0x266607[_0xc8ea('0x49')],{'$or':_[_0xc8ea('0x4b')](_0x25929d,function(_0x9fc748){if(_0x9fc748[_0xc8ea('0x4c')][_0xc8ea('0x4d')]!==_0xc8ea('0x4e')){var _0x3d64e0={};_0x3d64e0[_0x9fc748[_0xc8ea('0x4f')]]={'$like':'%'+_0x4c14ae[_0xc8ea('0x40')]['filter']+'%'};return _0x3d64e0;}})});}_0x266607=_[_0xc8ea('0x4a')]({},_0x266607,_0x4c14ae['options']);var _0x2c9fda={'where':_0x266607['where']};return db[_0xc8ea('0x3d')][_0xc8ea('0x50')](_0x2c9fda)['then'](function(_0x47ee67){_0x1573b5[_0xc8ea('0x50')]=_0x47ee67;if(_0x4c14ae[_0xc8ea('0x40')]['includeAll']){_0x266607[_0xc8ea('0x51')]=[{'all':!![]}];}return db['MailMessage'][_0xc8ea('0x52')](_0x266607);})[_0xc8ea('0x36')](function(_0x3f347e){_0x1573b5[_0xc8ea('0x53')]=_0x3f347e;return _0x1573b5;})['then'](respondWithFilteredResult(_0x4b0720,_0x266607))[_0xc8ea('0x54')](handleError(_0x4b0720,null));};exports[_0xc8ea('0x55')]=function(_0x378ff7,_0xcc98f6){var _0x5bf107={'raw':!![],'where':{'id':_0x378ff7[_0xc8ea('0x56')]['id']}},_0x99c946={};_0x99c946[_0xc8ea('0x3e')]=_[_0xc8ea('0x3f')](db[_0xc8ea('0x3d')][_0xc8ea('0x57')]);_0x99c946[_0xc8ea('0x40')]=_[_0xc8ea('0x3f')](_0x378ff7[_0xc8ea('0x40')]);_0x99c946[_0xc8ea('0x41')]=_['intersection'](_0x99c946[_0xc8ea('0x3e')],_0x99c946[_0xc8ea('0x40')]);_0x5bf107['attributes']=_[_0xc8ea('0x42')](_0x99c946[_0xc8ea('0x3e')],qs[_0xc8ea('0x44')](_0x378ff7[_0xc8ea('0x40')][_0xc8ea('0x44')]));_0x5bf107[_0xc8ea('0x43')]=_0x5bf107[_0xc8ea('0x43')]['length']?_0x5bf107[_0xc8ea('0x43')]:_0x99c946['model'];if(_0x378ff7['query'][_0xc8ea('0x58')]){_0x5bf107['include']=[{'all':!![]}];}_0x5bf107=_[_0xc8ea('0x4a')]({},_0x5bf107,_0x378ff7[_0xc8ea('0x59')]);return db['MailMessage'][_0xc8ea('0x5a')](_0x5bf107)[_0xc8ea('0x36')](handleEntityNotFound(_0xcc98f6,null))[_0xc8ea('0x36')](respondWithResult(_0xcc98f6,null))[_0xc8ea('0x54')](handleError(_0xcc98f6,null));};exports[_0xc8ea('0x34')]=function(_0x49266d,_0x1bdaeb){if(_0x49266d['body']['id']){delete _0x49266d[_0xc8ea('0x5b')]['id'];}return db[_0xc8ea('0x3d')][_0xc8ea('0x5a')]({'where':{'id':_0x49266d[_0xc8ea('0x56')]['id']}})[_0xc8ea('0x36')](handleEntityNotFound(_0x1bdaeb,null))[_0xc8ea('0x36')](saveUpdates(_0x49266d['body'],null))[_0xc8ea('0x36')](respondWithResult(_0x1bdaeb,null))['catch'](handleError(_0x1bdaeb,null));};exports[_0xc8ea('0x35')]=function(_0x36659a,_0x4b7219){return db[_0xc8ea('0x3d')]['find']({'where':{'id':_0x36659a[_0xc8ea('0x56')]['id']}})[_0xc8ea('0x36')](handleEntityNotFound(_0x4b7219,null))[_0xc8ea('0x36')](removeEntity(_0x4b7219,null))[_0xc8ea('0x54')](handleError(_0x4b7219,null));};exports[_0xc8ea('0x5c')]=function(_0x3fc2b6,_0x3ed715){return db[_0xc8ea('0x3d')][_0xc8ea('0x5c')]()[_0xc8ea('0x36')](respondWithResult(_0x3ed715,null))[_0xc8ea('0x54')](handleError(_0x3ed715,null));};exports[_0xc8ea('0x5d')]=function(_0x33a61a,_0xb5a410){return db['MailMessage'][_0xc8ea('0x5d')](_0x33a61a['body'])[_0xc8ea('0x36')](function(_0x2fc907){if(_0x2fc907){if(_0x2fc907[_0xc8ea('0x5e')]==='out'&&!_0x2fc907[_0xc8ea('0x5f')]){return db[_0xc8ea('0x60')][_0xc8ea('0x61')]({'where':{'id':_0x2fc907['MailAccountId']},'include':[{'model':db[_0xc8ea('0x62')],'as':_0xc8ea('0x63'),'raw':!![]}]})[_0xc8ea('0x36')](function(_0xdd42f3){if(_0xdd42f3&&_0xdd42f3[_0xc8ea('0x63')]){var _0x286a75={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0xdd42f3[_0xc8ea('0x63')][_0xc8ea('0x64')])){_0x286a75[_0xc8ea('0x65')]=_0xdd42f3[_0xc8ea('0x63')][_0xc8ea('0x65')];_0x286a75[_0xc8ea('0x66')]=_0xdd42f3[_0xc8ea('0x63')]['port'];_0x286a75[_0xc8ea('0x67')]=_0xdd42f3['Smtp'][_0xc8ea('0x67')];if(_0xdd42f3[_0xc8ea('0x63')]['authentication']){_0x286a75[_0xc8ea('0x68')]={'user':_0xdd42f3[_0xc8ea('0x63')][_0xc8ea('0x69')],'pass':_0xdd42f3[_0xc8ea('0x63')][_0xc8ea('0x6a')]};}}else{_0x286a75[_0xc8ea('0x64')]=_0xdd42f3[_0xc8ea('0x63')]['service'];_0x286a75[_0xc8ea('0x68')]={'user':_0xdd42f3[_0xc8ea('0x63')][_0xc8ea('0x69')],'pass':_0xdd42f3[_0xc8ea('0x63')][_0xc8ea('0x6a')]};_0x286a75[_0xc8ea('0x67')]=_0xdd42f3[_0xc8ea('0x63')][_0xc8ea('0x67')];}if(_0x33a61a['body'][_0xc8ea('0x6b')]&&_0x33a61a[_0xc8ea('0x5b')]['attachments']['length']){for(var _0xd3cc66=0x0;_0xd3cc66<_0x33a61a[_0xc8ea('0x5b')][_0xc8ea('0x6b')][_0xc8ea('0x6c')];_0xd3cc66+=0x1){_0x33a61a[_0xc8ea('0x5b')]['attachments'][_0xd3cc66]={'filename':_0x33a61a[_0xc8ea('0x5b')][_0xc8ea('0x6b')][_0xd3cc66][_0xc8ea('0x3a')],'path':path[_0xc8ea('0x6d')](config[_0xc8ea('0x6e')],'server/files/attachments',_0x33a61a['body']['attachments'][_0xd3cc66]['basename'])};}}return{'account':_0x286a75,'message':_0x33a61a['body']};}})[_0xc8ea('0x36')](function(_0x2496f9){if(_0x2496f9){return respondWithRpcPromise(_0xc8ea('0x6f'),'sendMail',_0x2496f9,client9003)[_0xc8ea('0x36')](function(_0x173f0d){return _0x2fc907[_0xc8ea('0x34')]({'read':!![],'messageId':_0x173f0d[_0xc8ea('0x70')],'sentAt':moment()[_0xc8ea('0x71')](_0xc8ea('0x72'))});})['catch'](function(_0x80b6d7){logger['error']('%s',JSON['stringify'](_0x80b6d7));return _0x2fc907;});}return _0x2fc907;});}return _0x2fc907;}})[_0xc8ea('0x36')](respondWithResult(_0xb5a410,0xc9))[_0xc8ea('0x54')](handleError(_0xb5a410,null));};var interaction_log=require(_0xc8ea('0x14'))(_0xc8ea('0x73'));exports['accept']=function(_0x444448,_0x26b6eb,_0x7fb53f){var _0x10c474={'channel':'mail'};if(_0x444448['body']['id']){delete _0x444448[_0xc8ea('0x5b')]['id'];}_0x444448[_0xc8ea('0x5b')][_0xc8ea('0x74')]=!![];_0x444448[_0xc8ea('0x5b')][_0xc8ea('0x75')]=moment()[_0xc8ea('0x71')](_0xc8ea('0x72'));_0x444448[_0xc8ea('0x5b')]['UserId']=_0x444448[_0xc8ea('0x5b')][_0xc8ea('0x76')]||_0x444448[_0xc8ea('0x69')]['id'];return db['MailMessage'][_0xc8ea('0x5a')]({'where':{'id':_0x444448[_0xc8ea('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xc8ea('0x77')],'as':_0xc8ea('0x78')}]})[_0xc8ea('0x36')](handleEntityNotFound(_0x26b6eb,null))[_0xc8ea('0x36')](saveUpdates(_0x444448[_0xc8ea('0x5b')],null))[_0xc8ea('0x36')](function(_0x5b6c87){if(_0x5b6c87){_0x10c474[_0xc8ea('0x2a')]=_0x5b6c87[_0xc8ea('0x79')]({'plain':!![]});return db['MailInteraction'][_0xc8ea('0x5a')]({'where':{'id':_0x5b6c87['MailInteractionId']}});}return null;})[_0xc8ea('0x36')](handleEntityNotFound(_0x26b6eb,null))[_0xc8ea('0x36')](function(_0x1e0d90){if(_0x1e0d90){return _0x1e0d90[_0xc8ea('0x34')]({'UserId':_0x444448[_0xc8ea('0x5b')][_0xc8ea('0x76')],'read1stAt':_[_0xc8ea('0x7a')](_0x1e0d90['read1stAt'])?moment()[_0xc8ea('0x71')](_0xc8ea('0x72')):undefined});}return null;})[_0xc8ea('0x36')](function(_0x423b5a){if(_0x423b5a){_0x10c474[_0xc8ea('0x7b')]=_0x423b5a[_0xc8ea('0x79')]({'plain':!![]});interaction_log[_0xc8ea('0x7c')](_0xc8ea('0x7d'),_0x444448['user']['id'],_0x444448['user'][_0xc8ea('0x3a')],_0x444448[_0xc8ea('0x69')]['role'],_0x10c474[_0xc8ea('0x7b')]['id'],_0x444448[_0xc8ea('0x5b')]?JSON[_0xc8ea('0x27')](_0x444448['body']):_0xc8ea('0x7e'));return respondWithRpcPromise(_0xc8ea('0x7f'),_0xc8ea('0x80'),_0x10c474);}return null;})[_0xc8ea('0x36')](function(_0x1193ec){if(_0x1193ec){if(_0x444448[_0xc8ea('0x5b')]['manual']){_0x10c474['message'][_0xc8ea('0x81')]=util['format'](_0xc8ea('0x82'),_0x444448['user'][_0xc8ea('0x3a')]);_0x10c474['message'][_0xc8ea('0x83')]=_0x10c474['channel'];_0x10c474[_0xc8ea('0x2a')][_0xc8ea('0x84')]=_0xc8ea('0x85');return respondWithRpcPromise('EventManager',_0xc8ea('0x86'),{'event':_0xc8ea('0x87'),'message':_0x10c474[_0xc8ea('0x2a')]},client9002)[_0xc8ea('0x36')](function(){return _0x10c474;});}return _0x10c474;}return null;})[_0xc8ea('0x36')](respondWithResult(_0x26b6eb,null))[_0xc8ea('0x54')](handleError(_0x26b6eb,null));};var interaction_log=require(_0xc8ea('0x14'))(_0xc8ea('0x73'));exports[_0xc8ea('0x88')]=function(_0x3581cb,_0x3df46a,_0x3bd815){var _0x2c8df1={'agent':{},'channel':_0xc8ea('0x89')};if(_0x3581cb[_0xc8ea('0x5b')]['id']){delete _0x3581cb['body']['id'];}_0x3581cb[_0xc8ea('0x5b')][_0xc8ea('0x76')]=_0x3581cb[_0xc8ea('0x5b')][_0xc8ea('0x76')]||_0x3581cb['user']['id'];_0x2c8df1[_0xc8ea('0x8a')]['id']=_0x3581cb[_0xc8ea('0x5b')][_0xc8ea('0x76')];return db[_0xc8ea('0x3d')][_0xc8ea('0x5a')]({'where':{'id':_0x3581cb['params']['id'],'UserId':null}})[_0xc8ea('0x36')](handleEntityNotFound(_0x3df46a,null))[_0xc8ea('0x36')](function(_0x516093){if(_0x516093){_0x2c8df1['message']=_0x516093[_0xc8ea('0x79')]({'plain':!![]});return db[_0xc8ea('0x8b')][_0xc8ea('0x5a')]({'where':{'id':_0x516093[_0xc8ea('0x8c')]}});}return null;})[_0xc8ea('0x36')](handleEntityNotFound(_0x3df46a,null))['then'](function(_0x374b8d){if(_0x374b8d){_0x2c8df1[_0xc8ea('0x7b')]=_0x374b8d[_0xc8ea('0x79')]({'plain':!![]});interaction_log[_0xc8ea('0x7c')](_0xc8ea('0x8d'),_0x3581cb[_0xc8ea('0x69')]['id'],_0x3581cb[_0xc8ea('0x69')]['name'],_0x3581cb[_0xc8ea('0x69')][_0xc8ea('0x8e')],_0x2c8df1[_0xc8ea('0x7b')]['id'],_0x3581cb['body']?JSON[_0xc8ea('0x27')](_0x3581cb['body']):_0xc8ea('0x7e'));return respondWithRpcPromise(_0xc8ea('0x8f'),_0xc8ea('0x90'),_0x2c8df1);}return null;})[_0xc8ea('0x36')](function(_0x5d5e66){if(_0x5d5e66){_0x5d5e66['message'][_0xc8ea('0x81')]=util[_0xc8ea('0x71')](_0xc8ea('0x82'),_0x3581cb[_0xc8ea('0x69')][_0xc8ea('0x3a')]);_0x5d5e66[_0xc8ea('0x2a')][_0xc8ea('0x83')]=_0x2c8df1[_0xc8ea('0x83')];_0x5d5e66[_0xc8ea('0x2a')][_0xc8ea('0x84')]='reject';respondWithRpcPromise(_0xc8ea('0x86'),_0xc8ea('0x86'),{'event':_0xc8ea('0x91'),'message':_0x5d5e66[_0xc8ea('0x2a')]},client9002);return _0x2c8df1;}return null;})[_0xc8ea('0x36')](respondWithResult(_0x3df46a,null))['catch'](handleError(_0x3df46a,null));};exports[_0xc8ea('0x92')]=function(_0x3e3e30,_0x2eca31){var _0x40353b=moment()[_0xc8ea('0x93')]()[_0xc8ea('0x94')]();var _0x11ed38=path['join'](config[_0xc8ea('0x6e')],'server',_0xc8ea('0x95'),'tmp');var _0x4b6e9f=path[_0xc8ea('0x6d')](config[_0xc8ea('0x6e')],_0xc8ea('0x96'),_0xc8ea('0x95'),_0xc8ea('0x6b'));var _0x31f40a=util[_0xc8ea('0x71')](_0xc8ea('0x97'),_0x40353b);return db[_0xc8ea('0x3d')]['find']({'where':{'id':_0x3e3e30[_0xc8ea('0x56')]['id']},'attributes':['id',_0xc8ea('0x5b'),_0xc8ea('0x98'),'to','cc',_0xc8ea('0x99'),_0xc8ea('0x9a'),_0xc8ea('0x9b')],'include':_0x3e3e30[_0xc8ea('0x40')]['attachments']?[{'model':db[_0xc8ea('0x9c')],'as':'Attachments'}]:undefined})[_0xc8ea('0x36')](handleEntityNotFound(_0x2eca31,null))[_0xc8ea('0x36')](function(_0x52f81a){if(_0x52f81a){var _0xbcafbd=_0x52f81a;var _0x429088={'from':_0xbcafbd[_0xc8ea('0x98')],'to':_0xbcafbd['to'],'subject':_0xbcafbd[_0xc8ea('0x9a')],'html':_0xbcafbd[_0xc8ea('0x5b')],'headers':{'Date':moment(_0xbcafbd[_0xc8ea('0x9b')])[_0xc8ea('0x71')](_0xc8ea('0x9d'))},'attachments':[]};if(_0x52f81a['cc']){_0x429088[_0xc8ea('0x9e')]['Cc']=_0x52f81a['cc'];}if(_0x52f81a['bcc']){_0x429088[_0xc8ea('0x9e')][_0xc8ea('0x9f')]=_0x52f81a[_0xc8ea('0x99')];}return new BPromise(function(_0xc040c9,_0xd7087b){if(_0x52f81a['Attachments']){for(var _0x217eb0=0x0;_0x217eb0<_0x52f81a[_0xc8ea('0xa0')][_0xc8ea('0x6c')];_0x217eb0++){var _0x1cc63a=_0x52f81a[_0xc8ea('0xa0')][_0x217eb0];var _0x1ec0a9=path['join'](_0x4b6e9f,_0x1cc63a['basename']);if(fs[_0xc8ea('0xa1')](_0x1ec0a9)){_0x429088[_0xc8ea('0x6b')]['push']({'name':_0x1cc63a[_0xc8ea('0x3a')],'contentType':_0x1cc63a[_0xc8ea('0x4c')],'data':fs['readFileSync'](_0x1ec0a9)});}}}emlformat[_0xc8ea('0xa2')](_0x429088,function(_0x109be2,_0x252be6){if(_0x109be2)return _0xd7087b(_0x109be2);fs['writeFileSync'](path[_0xc8ea('0x6d')](_0x11ed38,_0x31f40a),_0x252be6);return _0xc040c9(_0x252be6);});});}})['then'](function(_0x58d4a6){if(_0x58d4a6){return _0x2eca31[_0xc8ea('0x92')](path[_0xc8ea('0x6d')](_0x11ed38,_0x31f40a),_0x31f40a,function(_0x5ac07d){if(_0x5ac07d){console[_0xc8ea('0xa3')]('err',_0x5ac07d);}else{fs[_0xc8ea('0xa4')](path[_0xc8ea('0x6d')](_0x11ed38,_0x31f40a));}});}})[_0xc8ea('0x54')](handleError(_0x2eca31,null));}; \ No newline at end of file +var _0xdbd6=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','end','sendStatus','stack','name','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','map','key','field','options','MailMessage','findAll','rows','show','params','includeAll','include','merge','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','messageId','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','accept','mail','read','readAt','Contact','get','MailInteractionId','read1stAt','format','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','SIP/%s','channel','event','EventManager','UserId','interaction','null','RejectMessage','rejectmessage','download','toString','root','files','tmp','from','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','existsSync','push','type','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test'];(function(_0x12d91e,_0x24fa73){var _0x253500=function(_0x49e49a){while(--_0x49e49a){_0x12d91e['push'](_0x12d91e['shift']());}};_0x253500(++_0x24fa73);}(_0xdbd6,0x1c5));var _0x6dbd=function(_0x95da8b,_0x2c349f){_0x95da8b=_0x95da8b-0x0;var _0x476b38=_0xdbd6[_0x95da8b];return _0x476b38;};'use strict';var pdf=require(_0x6dbd('0x0'));var emlformat=require(_0x6dbd('0x1'));var rimraf=require(_0x6dbd('0x2'));var zipdir=require(_0x6dbd('0x3'));var jsonpatch=require(_0x6dbd('0x4'));var rp=require('request-promise');var moment=require(_0x6dbd('0x5'));var BPromise=require(_0x6dbd('0x6'));var Mustache=require('mustache');var util=require(_0x6dbd('0x7'));var path=require(_0x6dbd('0x8'));var sox=require(_0x6dbd('0x9'));var csv=require(_0x6dbd('0xa'));var ejs=require(_0x6dbd('0xb'));var fs=require('fs');var _=require(_0x6dbd('0xc'));var squel=require(_0x6dbd('0xd'));var crypto=require(_0x6dbd('0xe'));var jsforce=require(_0x6dbd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6dbd('0xa'));var querystring=require(_0x6dbd('0x10'));var Papa=require(_0x6dbd('0x11'));var Redis=require(_0x6dbd('0x12'));var authService=require(_0x6dbd('0x13'));var qs=require(_0x6dbd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6dbd('0x15'));var config=require(_0x6dbd('0x16'));var db=require(_0x6dbd('0x17'))['db'];config['redis']=_[_0x6dbd('0x18')](config[_0x6dbd('0x19')],{'host':_0x6dbd('0x1a'),'port':0x18eb});var socket=require(_0x6dbd('0x1b'))(new Redis(config[_0x6dbd('0x19')]));require('./mailMessage.socket')[_0x6dbd('0x1c')](socket);var jayson=require(_0x6dbd('0x1d'));var client=jayson[_0x6dbd('0x1e')][_0x6dbd('0x1f')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x6dbd('0x1e')][_0x6dbd('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x5eeaee,_0x35177b,_0x36035d){if(_0x36035d){var _0x48db8c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x48db8c[_0x6dbd('0x20')](_0x35177b)){return _0x5eeaee;}else{throw new db['Sequelize'][(_0x6dbd('0x21'))](_0x6dbd('0x22'));}}else{return _0x5eeaee;}}function respondWithRpcPromise(_0x39069f,_0x4c9b66,_0x73a32,_0x2c0ae1){return new BPromise(function(_0x417be5,_0x50ccfe){var _0xe60bdf=_0x2c0ae1||client;return _0xe60bdf[_0x6dbd('0x23')](_0x39069f,_0x73a32)[_0x6dbd('0x24')](function(_0x7e4077){logger[_0x6dbd('0x25')](_0x6dbd('0x26'),_0x4c9b66,_0x6dbd('0x27'));logger[_0x6dbd('0x28')](_0x6dbd('0x29'),_0x4c9b66,_0x6dbd('0x27'),JSON[_0x6dbd('0x2a')](_0x7e4077));if(_0x7e4077['error']){if(_0x7e4077['error']['code']===0x1f4){logger['error'](_0x6dbd('0x26'),_0x4c9b66,_0x7e4077[_0x6dbd('0x2b')][_0x6dbd('0x2c')]);return _0x50ccfe(_0x7e4077[_0x6dbd('0x2b')][_0x6dbd('0x2c')]);}logger[_0x6dbd('0x2b')](_0x6dbd('0x26'),_0x4c9b66,_0x7e4077[_0x6dbd('0x2b')][_0x6dbd('0x2c')]);return _0x417be5(_0x7e4077[_0x6dbd('0x2b')][_0x6dbd('0x2c')]);}else{logger[_0x6dbd('0x25')](_0x6dbd('0x26'),_0x4c9b66,'request\x20sent');_0x417be5(_0x7e4077[_0x6dbd('0x2d')][_0x6dbd('0x2c')]);}})[_0x6dbd('0x2e')](function(_0x43bdf5){logger[_0x6dbd('0x2b')]('MailMessage,\x20%s,\x20%s',_0x4c9b66,_0x43bdf5);_0x50ccfe(_0x43bdf5);});});}function respondWithStatusCode(_0x20ffe1,_0x284a3e){_0x284a3e=_0x284a3e||0xcc;return function(_0x5d0c5a){if(_0x5d0c5a){return _0x20ffe1['sendStatus'](_0x284a3e);}return _0x20ffe1[_0x6dbd('0x2f')](_0x284a3e)['end']();};}function respondWithResult(_0xc2a434,_0x2830de){_0x2830de=_0x2830de||0xc8;return function(_0x291403){if(_0x291403){return _0xc2a434[_0x6dbd('0x2f')](_0x2830de)['json'](_0x291403);}};}function respondWithFilteredResult(_0x2b0052,_0x4ff9fd){return function(_0x3b6046){if(_0x3b6046){var _0x2a6fe5=_0x3b6046[_0x6dbd('0x30')],_0x14d37a=_0x4ff9fd[_0x6dbd('0x31')],_0x1d784c=_0x4ff9fd[_0x6dbd('0x31')]+_0x4ff9fd[_0x6dbd('0x32')],_0x4decaf;if(_0x1d784c>=_0x2a6fe5){_0x1d784c=_0x2a6fe5;_0x4decaf=0xc8;}else{_0x4decaf=0xce;}_0x2b0052[_0x6dbd('0x2f')](_0x4decaf);return _0x2b0052[_0x6dbd('0x33')](_0x6dbd('0x34'),_0x14d37a+'-'+_0x1d784c+'/'+_0x2a6fe5)[_0x6dbd('0x35')](_0x3b6046);}return null;};}function patchUpdates(_0x2fd45f){return function(_0x19f09a){try{jsonpatch[_0x6dbd('0x36')](_0x19f09a,_0x2fd45f,!![]);}catch(_0x26c761){return BPromise[_0x6dbd('0x37')](_0x26c761);}return _0x19f09a['save']();};}function saveUpdates(_0x1465fd,_0x2d4163){return function(_0xa15d06){if(_0xa15d06){return _0xa15d06[_0x6dbd('0x38')](_0x1465fd)[_0x6dbd('0x24')](function(_0x266d6d){return _0x266d6d;});}return null;};}function removeEntity(_0x580ae3,_0x549fee){return function(_0x291621){if(_0x291621){return _0x291621[_0x6dbd('0x39')]()[_0x6dbd('0x24')](function(){_0x580ae3[_0x6dbd('0x2f')](0xcc)[_0x6dbd('0x3a')]();});}};}function handleEntityNotFound(_0x47e162,_0x42d1d0){return function(_0x5d19ee){if(!_0x5d19ee){_0x47e162[_0x6dbd('0x3b')](0x194);}return _0x5d19ee;};}function handleError(_0x4056b7,_0xf1aee4){_0xf1aee4=_0xf1aee4||0x1f4;return function(_0xa336b5){logger[_0x6dbd('0x2b')](_0xa336b5[_0x6dbd('0x3c')]);if(_0xa336b5[_0x6dbd('0x3d')]){delete _0xa336b5[_0x6dbd('0x3d')];}_0x4056b7[_0x6dbd('0x2f')](_0xf1aee4)['send'](_0xa336b5);};}exports['index']=function(_0x46b614,_0x191805){var _0x1f22db={},_0x5d9c49={},_0x312915={'count':0x0,'rows':[]};var _0x5184da=db['MailMessage'][_0x6dbd('0x3e')];_0x5d9c49[_0x6dbd('0x3f')]=_[_0x6dbd('0x40')](_0x5184da);_0x5d9c49[_0x6dbd('0x41')]=_[_0x6dbd('0x40')](_0x46b614['query']);_0x5d9c49['filters']=_[_0x6dbd('0x42')](_0x5d9c49[_0x6dbd('0x3f')],_0x5d9c49['query']);_0x1f22db[_0x6dbd('0x43')]=_[_0x6dbd('0x42')](_0x5d9c49[_0x6dbd('0x3f')],qs[_0x6dbd('0x44')](_0x46b614['query'][_0x6dbd('0x44')]));_0x1f22db[_0x6dbd('0x43')]=_0x1f22db[_0x6dbd('0x43')][_0x6dbd('0x45')]?_0x1f22db['attributes']:_0x5d9c49[_0x6dbd('0x3f')];if(!_0x46b614[_0x6dbd('0x41')][_0x6dbd('0x46')]('nolimit')){_0x1f22db[_0x6dbd('0x32')]=qs['limit'](_0x46b614[_0x6dbd('0x41')][_0x6dbd('0x32')]);_0x1f22db[_0x6dbd('0x31')]=qs['offset'](_0x46b614['query'][_0x6dbd('0x31')]);}_0x1f22db[_0x6dbd('0x47')]=qs[_0x6dbd('0x48')](_0x46b614[_0x6dbd('0x41')]['sort']);_0x1f22db['where']=qs[_0x6dbd('0x49')](_[_0x6dbd('0x4a')](_0x46b614['query'],_0x5d9c49['filters']));if(_0x46b614['query']['filter']){_0x1f22db[_0x6dbd('0x4b')]=_['merge'](_0x1f22db[_0x6dbd('0x4b')],{'$or':_[_0x6dbd('0x4c')](_0x5184da,function(_0x52ed7c){if(_0x52ed7c['type'][_0x6dbd('0x4d')]!=='VIRTUAL'){var _0x229d41={};_0x229d41[_0x52ed7c[_0x6dbd('0x4e')]]={'$like':'%'+_0x46b614[_0x6dbd('0x41')]['filter']+'%'};return _0x229d41;}})});}_0x1f22db=_['merge']({},_0x1f22db,_0x46b614[_0x6dbd('0x4f')]);var _0x4206cb={'where':_0x1f22db['where']};return db[_0x6dbd('0x50')]['count'](_0x4206cb)[_0x6dbd('0x24')](function(_0x59d1e5){_0x312915[_0x6dbd('0x30')]=_0x59d1e5;if(_0x46b614['query']['includeAll']){_0x1f22db['include']=[{'all':!![]}];}return db[_0x6dbd('0x50')][_0x6dbd('0x51')](_0x1f22db);})['then'](function(_0x3a2a54){_0x312915[_0x6dbd('0x52')]=_0x3a2a54;return _0x312915;})[_0x6dbd('0x24')](respondWithFilteredResult(_0x191805,_0x1f22db))[_0x6dbd('0x2e')](handleError(_0x191805,null));};exports[_0x6dbd('0x53')]=function(_0x2081be,_0x2c7396){var _0x4f926f={'raw':!![],'where':{'id':_0x2081be[_0x6dbd('0x54')]['id']}},_0xf3857={};_0xf3857[_0x6dbd('0x3f')]=_['keys'](db[_0x6dbd('0x50')][_0x6dbd('0x3e')]);_0xf3857['query']=_[_0x6dbd('0x40')](_0x2081be[_0x6dbd('0x41')]);_0xf3857[_0x6dbd('0x49')]=_[_0x6dbd('0x42')](_0xf3857['model'],_0xf3857[_0x6dbd('0x41')]);_0x4f926f[_0x6dbd('0x43')]=_[_0x6dbd('0x42')](_0xf3857[_0x6dbd('0x3f')],qs[_0x6dbd('0x44')](_0x2081be['query'][_0x6dbd('0x44')]));_0x4f926f[_0x6dbd('0x43')]=_0x4f926f[_0x6dbd('0x43')][_0x6dbd('0x45')]?_0x4f926f['attributes']:_0xf3857['model'];if(_0x2081be['query'][_0x6dbd('0x55')]){_0x4f926f[_0x6dbd('0x56')]=[{'all':!![]}];}_0x4f926f=_[_0x6dbd('0x57')]({},_0x4f926f,_0x2081be[_0x6dbd('0x4f')]);return db['MailMessage'][_0x6dbd('0x58')](_0x4f926f)[_0x6dbd('0x24')](handleEntityNotFound(_0x2c7396,null))[_0x6dbd('0x24')](respondWithResult(_0x2c7396,null))[_0x6dbd('0x2e')](handleError(_0x2c7396,null));};exports[_0x6dbd('0x38')]=function(_0x4eaa66,_0x8a578d){if(_0x4eaa66['body']['id']){delete _0x4eaa66[_0x6dbd('0x59')]['id'];}return db['MailMessage'][_0x6dbd('0x58')]({'where':{'id':_0x4eaa66[_0x6dbd('0x54')]['id']}})[_0x6dbd('0x24')](handleEntityNotFound(_0x8a578d,null))[_0x6dbd('0x24')](saveUpdates(_0x4eaa66[_0x6dbd('0x59')],null))[_0x6dbd('0x24')](respondWithResult(_0x8a578d,null))[_0x6dbd('0x2e')](handleError(_0x8a578d,null));};exports[_0x6dbd('0x39')]=function(_0x12684a,_0x531d93){return db[_0x6dbd('0x50')][_0x6dbd('0x58')]({'where':{'id':_0x12684a[_0x6dbd('0x54')]['id']}})['then'](handleEntityNotFound(_0x531d93,null))[_0x6dbd('0x24')](removeEntity(_0x531d93,null))[_0x6dbd('0x2e')](handleError(_0x531d93,null));};exports[_0x6dbd('0x5a')]=function(_0x1285fa,_0xc14011){return db['MailMessage'][_0x6dbd('0x5a')]()[_0x6dbd('0x24')](respondWithResult(_0xc14011,null))['catch'](handleError(_0xc14011,null));};exports[_0x6dbd('0x5b')]=function(_0x1397e0,_0x1a733f){return db[_0x6dbd('0x50')][_0x6dbd('0x5b')](_0x1397e0[_0x6dbd('0x59')])[_0x6dbd('0x24')](function(_0x5b12fb){if(_0x5b12fb){if(_0x5b12fb[_0x6dbd('0x5c')]===_0x6dbd('0x5d')&&!_0x5b12fb[_0x6dbd('0x5e')]){return db[_0x6dbd('0x5f')][_0x6dbd('0x60')]({'where':{'id':_0x5b12fb[_0x6dbd('0x61')]},'include':[{'model':db[_0x6dbd('0x62')],'as':'Smtp','raw':!![]}]})[_0x6dbd('0x24')](function(_0x21fa49){if(_0x21fa49&&_0x21fa49[_0x6dbd('0x63')]){var _0x36bd8f={'tls':{'rejectUnauthorized':![]}};if(_[_0x6dbd('0x64')](_0x21fa49['Smtp'][_0x6dbd('0x65')])){_0x36bd8f[_0x6dbd('0x66')]=_0x21fa49[_0x6dbd('0x63')][_0x6dbd('0x66')];_0x36bd8f[_0x6dbd('0x67')]=_0x21fa49[_0x6dbd('0x63')][_0x6dbd('0x67')];_0x36bd8f[_0x6dbd('0x68')]=_0x21fa49[_0x6dbd('0x63')][_0x6dbd('0x68')];if(_0x21fa49[_0x6dbd('0x63')][_0x6dbd('0x69')]){_0x36bd8f[_0x6dbd('0x6a')]={'user':_0x21fa49[_0x6dbd('0x63')][_0x6dbd('0x6b')],'pass':_0x21fa49[_0x6dbd('0x63')]['pass']};}}else{_0x36bd8f[_0x6dbd('0x65')]=_0x21fa49[_0x6dbd('0x63')][_0x6dbd('0x65')];_0x36bd8f[_0x6dbd('0x6a')]={'user':_0x21fa49[_0x6dbd('0x63')]['user'],'pass':_0x21fa49[_0x6dbd('0x63')][_0x6dbd('0x6c')]};_0x36bd8f[_0x6dbd('0x68')]=_0x21fa49['Smtp'][_0x6dbd('0x68')];}if(_0x1397e0[_0x6dbd('0x59')][_0x6dbd('0x6d')]&&_0x1397e0[_0x6dbd('0x59')][_0x6dbd('0x6d')][_0x6dbd('0x45')]){for(var _0x145b55=0x0;_0x145b55<_0x1397e0[_0x6dbd('0x59')][_0x6dbd('0x6d')][_0x6dbd('0x45')];_0x145b55+=0x1){_0x1397e0[_0x6dbd('0x59')][_0x6dbd('0x6d')][_0x145b55]={'filename':_0x1397e0[_0x6dbd('0x59')][_0x6dbd('0x6d')][_0x145b55][_0x6dbd('0x3d')],'path':path[_0x6dbd('0x6e')](config['root'],_0x6dbd('0x6f'),_0x1397e0[_0x6dbd('0x59')][_0x6dbd('0x6d')][_0x145b55][_0x6dbd('0x70')])};}}return{'account':_0x36bd8f,'message':_0x1397e0[_0x6dbd('0x59')]};}})[_0x6dbd('0x24')](function(_0x118b82){if(_0x118b82){return respondWithRpcPromise('SendMail','sendMail',_0x118b82,client9003)['then'](function(_0x169abe){return _0x5b12fb[_0x6dbd('0x38')]({'read':!![],'messageId':_0x169abe[_0x6dbd('0x71')],'sentAt':moment()['format'](_0x6dbd('0x72'))});})['catch'](function(_0x465536){logger[_0x6dbd('0x2b')]('%s',JSON['stringify'](_0x465536));return _0x5b12fb;});}return _0x5b12fb;});}return _0x5b12fb;}})[_0x6dbd('0x24')](respondWithResult(_0x1a733f,0xc9))[_0x6dbd('0x2e')](handleError(_0x1a733f,null));};var interaction_log=require(_0x6dbd('0x73'))(_0x6dbd('0x74'));exports[_0x6dbd('0x75')]=function(_0x2f6c91,_0x18623c,_0x460a9a){var _0x9f1e7={'channel':_0x6dbd('0x76')};if(_0x2f6c91[_0x6dbd('0x59')]['id']){delete _0x2f6c91[_0x6dbd('0x59')]['id'];}_0x2f6c91[_0x6dbd('0x59')][_0x6dbd('0x77')]=!![];_0x2f6c91[_0x6dbd('0x59')][_0x6dbd('0x78')]=moment()['format'](_0x6dbd('0x72'));_0x2f6c91[_0x6dbd('0x59')]['UserId']=_0x2f6c91[_0x6dbd('0x59')]['UserId']||_0x2f6c91[_0x6dbd('0x6b')]['id'];return db[_0x6dbd('0x50')][_0x6dbd('0x58')]({'where':{'id':_0x2f6c91['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6dbd('0x79')}]})[_0x6dbd('0x24')](handleEntityNotFound(_0x18623c,null))[_0x6dbd('0x24')](saveUpdates(_0x2f6c91[_0x6dbd('0x59')],null))['then'](function(_0x169c3e){if(_0x169c3e){_0x9f1e7[_0x6dbd('0x2c')]=_0x169c3e[_0x6dbd('0x7a')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x169c3e[_0x6dbd('0x7b')]}});}return null;})[_0x6dbd('0x24')](handleEntityNotFound(_0x18623c,null))[_0x6dbd('0x24')](function(_0x50c6da){if(_0x50c6da){return _0x50c6da[_0x6dbd('0x38')]({'UserId':_0x2f6c91[_0x6dbd('0x59')]['UserId'],'read1stAt':_[_0x6dbd('0x64')](_0x50c6da[_0x6dbd('0x7c')])?moment()[_0x6dbd('0x7d')](_0x6dbd('0x72')):undefined});}return null;})[_0x6dbd('0x24')](function(_0x34acf3){if(_0x34acf3){_0x9f1e7['interaction']=_0x34acf3[_0x6dbd('0x7a')]({'plain':!![]});interaction_log[_0x6dbd('0x25')](_0x6dbd('0x7e'),_0x2f6c91[_0x6dbd('0x6b')]['id'],_0x2f6c91[_0x6dbd('0x6b')]['name'],_0x2f6c91[_0x6dbd('0x6b')][_0x6dbd('0x7f')],_0x9f1e7['interaction']['id'],_0x2f6c91[_0x6dbd('0x59')]?JSON[_0x6dbd('0x2a')](_0x2f6c91[_0x6dbd('0x59')]):'null');return respondWithRpcPromise(_0x6dbd('0x80'),'acceptMessage',_0x9f1e7);}return null;})[_0x6dbd('0x24')](function(_0x3cfe64){if(_0x3cfe64){if(_0x2f6c91['body'][_0x6dbd('0x81')]){_0x9f1e7['message']['interface']=util['format'](_0x6dbd('0x82'),_0x2f6c91['user'][_0x6dbd('0x3d')]);_0x9f1e7[_0x6dbd('0x2c')][_0x6dbd('0x83')]=_0x9f1e7[_0x6dbd('0x83')];_0x9f1e7[_0x6dbd('0x2c')][_0x6dbd('0x84')]=_0x6dbd('0x75');return respondWithRpcPromise(_0x6dbd('0x85'),_0x6dbd('0x85'),{'event':'acceptmessage','message':_0x9f1e7[_0x6dbd('0x2c')]},client9002)[_0x6dbd('0x24')](function(){return _0x9f1e7;});}return _0x9f1e7;}return null;})[_0x6dbd('0x24')](respondWithResult(_0x18623c,null))[_0x6dbd('0x2e')](handleError(_0x18623c,null));};var interaction_log=require(_0x6dbd('0x73'))(_0x6dbd('0x74'));exports['reject']=function(_0x3bfaad,_0x31e6b0,_0x44eb16){var _0x47c9a9={'agent':{},'channel':_0x6dbd('0x76')};if(_0x3bfaad['body']['id']){delete _0x3bfaad['body']['id'];}_0x3bfaad['body']['UserId']=_0x3bfaad[_0x6dbd('0x59')][_0x6dbd('0x86')]||_0x3bfaad['user']['id'];_0x47c9a9['agent']['id']=_0x3bfaad['body']['UserId'];return db['MailMessage'][_0x6dbd('0x58')]({'where':{'id':_0x3bfaad[_0x6dbd('0x54')]['id'],'UserId':null}})[_0x6dbd('0x24')](handleEntityNotFound(_0x31e6b0,null))[_0x6dbd('0x24')](function(_0x55b5c1){if(_0x55b5c1){_0x47c9a9[_0x6dbd('0x2c')]=_0x55b5c1['get']({'plain':!![]});return db['MailInteraction'][_0x6dbd('0x58')]({'where':{'id':_0x55b5c1[_0x6dbd('0x7b')]}});}return null;})[_0x6dbd('0x24')](handleEntityNotFound(_0x31e6b0,null))[_0x6dbd('0x24')](function(_0x64dda0){if(_0x64dda0){_0x47c9a9[_0x6dbd('0x87')]=_0x64dda0['get']({'plain':!![]});interaction_log[_0x6dbd('0x25')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3bfaad[_0x6dbd('0x6b')]['id'],_0x3bfaad['user'][_0x6dbd('0x3d')],_0x3bfaad[_0x6dbd('0x6b')]['role'],_0x47c9a9['interaction']['id'],_0x3bfaad[_0x6dbd('0x59')]?JSON[_0x6dbd('0x2a')](_0x3bfaad[_0x6dbd('0x59')]):_0x6dbd('0x88'));return respondWithRpcPromise(_0x6dbd('0x89'),'rejectMessage',_0x47c9a9);}return null;})[_0x6dbd('0x24')](function(_0x21ee00){if(_0x21ee00){_0x21ee00[_0x6dbd('0x2c')]['interface']=util[_0x6dbd('0x7d')](_0x6dbd('0x82'),_0x3bfaad[_0x6dbd('0x6b')][_0x6dbd('0x3d')]);_0x21ee00['message']['channel']=_0x47c9a9[_0x6dbd('0x83')];_0x21ee00[_0x6dbd('0x2c')][_0x6dbd('0x84')]=_0x6dbd('0x37');respondWithRpcPromise(_0x6dbd('0x85'),_0x6dbd('0x85'),{'event':_0x6dbd('0x8a'),'message':_0x21ee00[_0x6dbd('0x2c')]},client9002);return _0x47c9a9;}return null;})[_0x6dbd('0x24')](respondWithResult(_0x31e6b0,null))[_0x6dbd('0x2e')](handleError(_0x31e6b0,null));};exports[_0x6dbd('0x8b')]=function(_0x205414,_0x51829c){var _0x4b8485=moment()['unix']()[_0x6dbd('0x8c')]();var _0x14d1cb=path[_0x6dbd('0x6e')](config[_0x6dbd('0x8d')],'server',_0x6dbd('0x8e'),_0x6dbd('0x8f'));var _0x41b804=path['join'](config[_0x6dbd('0x8d')],'server',_0x6dbd('0x8e'),_0x6dbd('0x6d'));var _0x1357fd=util['format']('message-%s.eml',_0x4b8485);return db['MailMessage'][_0x6dbd('0x58')]({'where':{'id':_0x205414[_0x6dbd('0x54')]['id']},'attributes':['id',_0x6dbd('0x59'),_0x6dbd('0x90'),'to','cc','bcc',_0x6dbd('0x91'),_0x6dbd('0x92')],'include':_0x205414[_0x6dbd('0x41')][_0x6dbd('0x6d')]?[{'model':db[_0x6dbd('0x93')],'as':_0x6dbd('0x94')}]:undefined})['then'](handleEntityNotFound(_0x51829c,null))[_0x6dbd('0x24')](function(_0x1730f5){if(_0x1730f5){var _0x5388cb=_0x1730f5;var _0x10bbd3={'from':_0x5388cb['from'],'to':_0x5388cb['to'],'subject':_0x5388cb[_0x6dbd('0x91')],'html':_0x5388cb[_0x6dbd('0x59')],'headers':{'Date':moment(_0x5388cb[_0x6dbd('0x92')])[_0x6dbd('0x7d')](_0x6dbd('0x95'))},'attachments':[]};if(_0x1730f5['cc']){_0x10bbd3[_0x6dbd('0x96')]['Cc']=_0x1730f5['cc'];}if(_0x1730f5['bcc']){_0x10bbd3[_0x6dbd('0x96')][_0x6dbd('0x97')]=_0x1730f5[_0x6dbd('0x98')];}return new BPromise(function(_0x22704c,_0x591ff6){if(_0x1730f5[_0x6dbd('0x94')]){for(var _0x394b58=0x0;_0x394b58<_0x1730f5[_0x6dbd('0x94')]['length'];_0x394b58++){var _0x46f84f=_0x1730f5[_0x6dbd('0x94')][_0x394b58];var _0x488754=path[_0x6dbd('0x6e')](_0x41b804,_0x46f84f[_0x6dbd('0x70')]);if(fs[_0x6dbd('0x99')](_0x488754)){_0x10bbd3[_0x6dbd('0x6d')][_0x6dbd('0x9a')]({'name':_0x46f84f[_0x6dbd('0x3d')],'contentType':_0x46f84f[_0x6dbd('0x9b')],'data':fs[_0x6dbd('0x9c')](_0x488754)});}}}emlformat[_0x6dbd('0x9d')](_0x10bbd3,function(_0x3033f3,_0x3b65c5){if(_0x3033f3)return _0x591ff6(_0x3033f3);fs[_0x6dbd('0x9e')](path['join'](_0x14d1cb,_0x1357fd),_0x3b65c5);return _0x22704c(_0x3b65c5);});});}})[_0x6dbd('0x24')](function(_0x32f7b7){if(_0x32f7b7){return _0x51829c['download'](path[_0x6dbd('0x6e')](_0x14d1cb,_0x1357fd),_0x1357fd,function(_0x307a9b){if(_0x307a9b){console[_0x6dbd('0x9f')](_0x6dbd('0xa0'),_0x307a9b);}else{fs[_0x6dbd('0xa1')](path[_0x6dbd('0x6e')](_0x14d1cb,_0x1357fd));}});}})['catch'](handleError(_0x51829c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 78063a3..6bfbbe5 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 _0x460f=['hasOwnProperty','hook','events','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4d3dc0,_0x117b6b){var _0x3e57cb=function(_0x2fa259){while(--_0x2fa259){_0x4d3dc0['push'](_0x4d3dc0['shift']());}};_0x3e57cb(++_0x117b6b);}(_0x460f,0x173));var _0xf460=function(_0x1bae0d,_0x1b4554){_0x1bae0d=_0x1bae0d-0x0;var _0x2823bb=_0x460f[_0x1bae0d];return _0x2823bb;};'use strict';var EventEmitter=require(_0xf460('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xf460('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf460('0x2')](0x0);var events={'afterCreate':_0xf460('0x3'),'afterUpdate':_0xf460('0x4'),'afterDestroy':_0xf460('0x5')};function emitEvent(_0x13333c){return function(_0x533cc2,_0x4edd57,_0x152d7d){MailMessageEvents[_0xf460('0x6')](_0x13333c+':'+_0x533cc2['id'],_0x533cc2);MailMessageEvents[_0xf460('0x6')](_0x13333c,_0x533cc2);_0x152d7d(null);};}for(var e in events){if(events[_0xf460('0x7')](e)){var event=events[e];MailMessage[_0xf460('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x5c60=['save','update','remove','emit','hasOwnProperty','hook','exports','MailMessage','setMaxListeners'];(function(_0x48a335,_0x128c6d){var _0x5900e8=function(_0x7a69f){while(--_0x7a69f){_0x48a335['push'](_0x48a335['shift']());}};_0x5900e8(++_0x128c6d);}(_0x5c60,0x127));var _0x05c6=function(_0x243892,_0x5f4161){_0x243892=_0x243892-0x0;var _0x240b5f=_0x5c60[_0x243892];return _0x240b5f;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x05c6('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x05c6('0x1')](0x0);var events={'afterCreate':_0x05c6('0x2'),'afterUpdate':_0x05c6('0x3'),'afterDestroy':_0x05c6('0x4')};function emitEvent(_0x499b13){return function(_0x579c54,_0x12985f,_0x27c3f0){MailMessageEvents[_0x05c6('0x5')](_0x499b13+':'+_0x579c54['id'],_0x579c54);MailMessageEvents[_0x05c6('0x5')](_0x499b13,_0x579c54);_0x27c3f0(null);};}for(var e in events){if(events[_0x05c6('0x6')](e)){var event=events[e];MailMessage[_0x05c6('0x7')](e,emitEvent(event));}}module[_0x05c6('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 61ad45b..950b84f 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 _0x7028=['subject','FULLTEXT','plainBody','fromString','body','get','direction','toLowerCase','out','secret','isNil','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','messageId','fti_mail_messages'];(function(_0x3f9a88,_0x7637f3){var _0xbc040d=function(_0x3df6c3){while(--_0x3df6c3){_0x3f9a88['push'](_0x3f9a88['shift']());}};_0xbc040d(++_0x7637f3);}(_0x7028,0x192));var _0x8702=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7028[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x8702('0x0'));var util=require(_0x8702('0x1'));var logger=require(_0x8702('0x2'))(_0x8702('0x3'));var moment=require('moment');var BPromise=require(_0x8702('0x4'));var rp=require(_0x8702('0x5'));var htmlToText=require(_0x8702('0x6'));var fs=require('fs');var path=require(_0x8702('0x7'));var rimraf=require(_0x8702('0x8'));var config=require('../../config/environment');var attributes=require(_0x8702('0x9'));module[_0x8702('0xa')]=function(_0x36376d,_0x4da643){return _0x36376d[_0x8702('0xb')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x8702('0xc'),'fields':[_0x8702('0xc')]},{'name':_0x8702('0xd'),'fields':['plainBody',_0x8702('0xe')],'type':_0x8702('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x37ebb0,_0x2a994a,_0x2c4fa8){if(_0x37ebb0['body']){_0x37ebb0[_0x8702('0x10')]=htmlToText[_0x8702('0x11')](_0x37ebb0[_0x8702('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2c4fa8(null,_0x2a994a);},'afterCreate':function(_0x3316aa,_0x18a22e,_0x29ebea){var _0xbd3fb4=_0x36376d['models'];var _0x35ce3f=_0x3316aa[_0x8702('0x13')]({'plain':!![]});if(_0x35ce3f[_0x8702('0x14')][_0x8702('0x15')]()==='in'||_0x35ce3f[_0x8702('0x14')][_0x8702('0x15')]()===_0x8702('0x16')&&!_0x35ce3f[_0x8702('0x17')]&&!_[_0x8702('0x18')](_0x35ce3f['UserId'])){_0xbd3fb4['MailInteraction'][_0x8702('0x19')]({'where':{'id':_0x35ce3f[_0x8702('0x1a')]}})[_0x8702('0x1b')](function(_0x120052){if(_0x120052){_0x120052['update']({'lastMsgAt':_0x35ce3f[_0x8702('0x1c')],'lastMsgDirection':_0x35ce3f[_0x8702('0x14')][_0x8702('0x15')](),'lastMsgBody':_0x35ce3f[_0x8702('0x12')]});}})[_0x8702('0x1d')](function(_0x496e0f){console['error'](_0x496e0f);});}_0x29ebea();}},'charset':_0x8702('0x1e'),'collate':_0x8702('0x1f')});}; \ No newline at end of file +var _0xc004=['update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','html-to-text','rimraf','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteractionId','then'];(function(_0x2b9316,_0x26a84f){var _0x27fc1d=function(_0x18ca01){while(--_0x18ca01){_0x2b9316['push'](_0x2b9316['shift']());}};_0x27fc1d(++_0x26a84f);}(_0xc004,0xbf));var _0x4c00=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0xc004[_0x5a4b42];return _0x5e81d6;};'use strict';var _=require(_0x4c00('0x0'));var util=require(_0x4c00('0x1'));var logger=require(_0x4c00('0x2'))('api');var moment=require(_0x4c00('0x3'));var BPromise=require(_0x4c00('0x4'));var rp=require('request-promise');var htmlToText=require(_0x4c00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c00('0x6'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x4c00('0x7')]=function(_0x466833,_0x185f23){return _0x466833[_0x4c00('0x8')]('MailMessage',attributes,{'tableName':_0x4c00('0x9'),'paranoid':![],'indexes':[{'name':_0x4c00('0xa'),'fields':['messageId']},{'name':_0x4c00('0xb'),'fields':[_0x4c00('0xc'),_0x4c00('0xd')],'type':_0x4c00('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4330d5,_0xafc64f,_0x147cf8){if(_0x4330d5[_0x4c00('0xf')]){_0x4330d5['plainBody']=htmlToText[_0x4c00('0x10')](_0x4330d5[_0x4c00('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x147cf8(null,_0xafc64f);},'afterCreate':function(_0x4b0b4e,_0x57e4ce,_0x40a3c9){var _0x1dacf7=_0x466833[_0x4c00('0x11')];var _0x14e759=_0x4b0b4e[_0x4c00('0x12')]({'plain':!![]});if(_0x14e759[_0x4c00('0x13')][_0x4c00('0x14')]()==='in'||_0x14e759[_0x4c00('0x13')][_0x4c00('0x14')]()==='out'&&!_0x14e759[_0x4c00('0x15')]&&!_[_0x4c00('0x16')](_0x14e759[_0x4c00('0x17')])){_0x1dacf7['MailInteraction']['findOne']({'where':{'id':_0x14e759[_0x4c00('0x18')]}})[_0x4c00('0x19')](function(_0x479bc3){if(_0x479bc3){_0x479bc3[_0x4c00('0x1a')]({'lastMsgAt':_0x14e759[_0x4c00('0x1b')],'lastMsgDirection':_0x14e759[_0x4c00('0x13')]['toLowerCase'](),'lastMsgBody':_0x14e759[_0x4c00('0xf')]});}})['catch'](function(_0x18af39){console[_0x4c00('0x1c')](_0x18af39);});}_0x40a3c9();}},'charset':_0x4c00('0x1d'),'collate':_0x4c00('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index abee29f..64c1ac4 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 _0x8ce1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','options','raw','lodash','util','moment'];(function(_0x44403b,_0x181dda){var _0x30d810=function(_0x2e5c6a){while(--_0x2e5c6a){_0x44403b['push'](_0x44403b['shift']());}};_0x30d810(++_0x181dda);}(_0x8ce1,0x152));var _0x18ce=function(_0x44f58e,_0x56de80){_0x44f58e=_0x44f58e-0x0;var _0x408545=_0x8ce1[_0x44f58e];return _0x408545;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var moment=require(_0x18ce('0x2'));var BPromise=require(_0x18ce('0x3'));var rs=require(_0x18ce('0x4'));var fs=require('fs');var Redis=require(_0x18ce('0x5'));var db=require(_0x18ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x18ce('0x7'))(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var jayson=require(_0x18ce('0xa'));var client=jayson['client'][_0x18ce('0xb')]({'port':0x232a});config[_0x18ce('0xc')]=_['defaults'](config[_0x18ce('0xc')],{'host':_0x18ce('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18ce('0xc')]));require('./mailMessage.socket')[_0x18ce('0xe')](socket);function respondWithRpcPromise(_0x21e931,_0x3f43d6,_0x1596ec){return new BPromise(function(_0x42cbc6,_0x59b4f2){return client['request'](_0x21e931,_0x1596ec)[_0x18ce('0xf')](function(_0x48c5f4){logger['info'](_0x18ce('0x10'),_0x3f43d6,_0x18ce('0x11'));logger[_0x18ce('0x12')](_0x18ce('0x13'),_0x3f43d6,_0x18ce('0x11'),JSON[_0x18ce('0x14')](_0x48c5f4));if(_0x48c5f4['error']){if(_0x48c5f4[_0x18ce('0x15')][_0x18ce('0x16')]===0x1f4){logger[_0x18ce('0x15')](_0x18ce('0x10'),_0x3f43d6,_0x48c5f4[_0x18ce('0x15')][_0x18ce('0x17')]);return _0x59b4f2(_0x48c5f4[_0x18ce('0x15')]['message']);}logger[_0x18ce('0x15')]('MailMessage,\x20%s,\x20%s',_0x3f43d6,_0x48c5f4['error']['message']);return _0x42cbc6(_0x48c5f4['error'][_0x18ce('0x17')]);}else{logger[_0x18ce('0x18')](_0x18ce('0x10'),_0x3f43d6,'request\x20sent');_0x42cbc6(_0x48c5f4[_0x18ce('0x19')][_0x18ce('0x17')]);}})[_0x18ce('0x1a')](function(_0x293979){logger['error'](_0x18ce('0x10'),_0x3f43d6,_0x293979);_0x59b4f2(_0x293979);});});}exports[_0x18ce('0x1b')]=function(_0x49615e){var _0x381699=this;return new Promise(function(_0x466c1a,_0x43ff5e){return db[_0x18ce('0x1c')]['create'](_0x49615e['body'],{'raw':_0x49615e[_0x18ce('0x1d')]?_0x49615e[_0x18ce('0x1d')][_0x18ce('0x1e')]===undefined?!![]:![]:!![]})[_0x18ce('0xf')](function(_0x387110){logger[_0x18ce('0x18')]('CreateMailMessage',_0x49615e);logger['debug']('CreateMailMessage',_0x49615e,JSON[_0x18ce('0x14')](_0x387110));_0x466c1a(_0x387110);})[_0x18ce('0x1a')](function(_0x29a581){logger[_0x18ce('0x15')](_0x18ce('0x1b'),_0x29a581['message'],_0x49615e);_0x43ff5e(_0x381699[_0x18ce('0x15')](0x1f4,_0x29a581[_0x18ce('0x17')]));});});}; \ No newline at end of file +var _0xdbb1=['lodash','randomstring','../../config/utils','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0xdbb1,0x105));var _0x1dbb=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xdbb1[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x1dbb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1dbb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1dbb('0x2'));var logger=require('../../config/logger')(_0x1dbb('0x3'));var config=require(_0x1dbb('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1dbb('0x5')]({'port':0x232a});config[_0x1dbb('0x6')]=_[_0x1dbb('0x7')](config[_0x1dbb('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x1dbb('0x8'))(new Redis(config[_0x1dbb('0x6')]));require('./mailMessage.socket')[_0x1dbb('0x9')](socket);function respondWithRpcPromise(_0x232c1c,_0x1e7ac5,_0x3ce7e9){return new BPromise(function(_0x40b115,_0x183120){return client[_0x1dbb('0xa')](_0x232c1c,_0x3ce7e9)[_0x1dbb('0xb')](function(_0x3e71bd){logger[_0x1dbb('0xc')](_0x1dbb('0xd'),_0x1e7ac5,'request\x20sent');logger[_0x1dbb('0xe')](_0x1dbb('0xf'),_0x1e7ac5,_0x1dbb('0x10'),JSON[_0x1dbb('0x11')](_0x3e71bd));if(_0x3e71bd['error']){if(_0x3e71bd['error'][_0x1dbb('0x12')]===0x1f4){logger[_0x1dbb('0x13')](_0x1dbb('0xd'),_0x1e7ac5,_0x3e71bd[_0x1dbb('0x13')][_0x1dbb('0x14')]);return _0x183120(_0x3e71bd['error'][_0x1dbb('0x14')]);}logger[_0x1dbb('0x13')](_0x1dbb('0xd'),_0x1e7ac5,_0x3e71bd['error'][_0x1dbb('0x14')]);return _0x40b115(_0x3e71bd[_0x1dbb('0x13')]['message']);}else{logger[_0x1dbb('0xc')](_0x1dbb('0xd'),_0x1e7ac5,_0x1dbb('0x10'));_0x40b115(_0x3e71bd[_0x1dbb('0x15')][_0x1dbb('0x14')]);}})[_0x1dbb('0x16')](function(_0x2ae3f2){logger[_0x1dbb('0x13')]('MailMessage,\x20%s,\x20%s',_0x1e7ac5,_0x2ae3f2);_0x183120(_0x2ae3f2);});});}exports['CreateMailMessage']=function(_0x4802ba){var _0x4248d7=this;return new Promise(function(_0x1568e4,_0x570896){return db[_0x1dbb('0x17')][_0x1dbb('0x18')](_0x4802ba[_0x1dbb('0x19')],{'raw':_0x4802ba[_0x1dbb('0x1a')]?_0x4802ba[_0x1dbb('0x1a')][_0x1dbb('0x1b')]===undefined?!![]:![]:!![]})[_0x1dbb('0xb')](function(_0x4b206d){logger[_0x1dbb('0xc')](_0x1dbb('0x1c'),_0x4802ba);logger[_0x1dbb('0xe')](_0x1dbb('0x1c'),_0x4802ba,JSON[_0x1dbb('0x11')](_0x4b206d));_0x1568e4(_0x4b206d);})[_0x1dbb('0x16')](function(_0x1e1918){logger[_0x1dbb('0x13')](_0x1dbb('0x1c'),_0x1e1918[_0x1dbb('0x14')],_0x4802ba);_0x570896(_0x4248d7[_0x1dbb('0x13')](0x1f4,_0x1e1918['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 44e53d1..c3c00bf 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 _0xec48=['removeListener','register','length','mailMessage:','save','remove','update','emit'];(function(_0x53a7eb,_0x39c8a1){var _0x40b239=function(_0x526d6c){while(--_0x526d6c){_0x53a7eb['push'](_0x53a7eb['shift']());}};_0x40b239(++_0x39c8a1);}(_0xec48,0x194));var _0x8ec4=function(_0x1f38c6,_0x428650){_0x1f38c6=_0x1f38c6-0x0;var _0x259367=_0xec48[_0x1f38c6];return _0x259367;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x8ec4('0x0'),_0x8ec4('0x1'),_0x8ec4('0x2')];function createListener(_0x2c15eb,_0x350a93){return function(_0x4e8e4c){_0x350a93[_0x8ec4('0x3')](_0x2c15eb,_0x4e8e4c);};}function removeListener(_0x4171af,_0x103b3d){return function(){MailMessageEvents[_0x8ec4('0x4')](_0x4171af,_0x103b3d);};}exports[_0x8ec4('0x5')]=function(_0x4df8d9){for(var _0x415c59=0x0,_0x1832bb=events[_0x8ec4('0x6')];_0x415c59<_0x1832bb;_0x415c59++){var _0x4b98b0=events[_0x415c59];var _0x1d960b=createListener(_0x8ec4('0x7')+_0x4b98b0,_0x4df8d9);MailMessageEvents['on'](_0x4b98b0,_0x1d960b);}}; \ No newline at end of file +var _0x88fa=['register','length','./mailMessage.events','save','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x88fa,0x19f));var _0xa88f=function(_0x178b4e,_0x3810c2){_0x178b4e=_0x178b4e-0x0;var _0x176a81=_0x88fa[_0x178b4e];return _0x176a81;};'use strict';var MailMessageEvents=require(_0xa88f('0x0'));var events=[_0xa88f('0x1'),_0xa88f('0x2'),_0xa88f('0x3')];function createListener(_0x3240bf,_0x5632bb){return function(_0x2464e1){_0x5632bb[_0xa88f('0x4')](_0x3240bf,_0x2464e1);};}function removeListener(_0x575ab2,_0x16ea05){return function(){MailMessageEvents['removeListener'](_0x575ab2,_0x16ea05);};}exports[_0xa88f('0x5')]=function(_0x259f67){for(var _0x253405=0x0,_0x5c6e4d=events[_0xa88f('0x6')];_0x253405<_0x5c6e4d;_0x253405++){var _0x3d0c6f=events[_0x253405];var _0x16b49d=createListener('mailMessage:'+_0x3d0c6f,_0x259f67);MailMessageEvents['on'](_0x3d0c6f,_0x16b49d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 596a392..5504fe9 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 _0x33d8=['/:id/members','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','update','/:id','destroy','removeTeams','delete','removeAgents','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x368f92,_0x232fda){var _0x3d4e62=function(_0x3e163b){while(--_0x3e163b){_0x368f92['push'](_0x368f92['shift']());}};_0x3d4e62(++_0x232fda);}(_0x33d8,0x97));var _0x833d=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x33d8[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x833d('0x0'));var timeout=require(_0x833d('0x1'));var express=require('express');var router=express[_0x833d('0x2')]();var auth=require(_0x833d('0x3'));var interaction=require(_0x833d('0x4'));var config=require('../../config/environment');var controller=require(_0x833d('0x5'));router[_0x833d('0x6')]('/',auth[_0x833d('0x7')](),controller['index']);router[_0x833d('0x6')](_0x833d('0x8'),auth[_0x833d('0x7')](),controller[_0x833d('0x9')]);router[_0x833d('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x833d('0xa')]);router[_0x833d('0x6')](_0x833d('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0x833d('0x6')](_0x833d('0xc'),auth[_0x833d('0x7')](),controller[_0x833d('0xd')]);router[_0x833d('0x6')]('/:id/users',auth[_0x833d('0x7')](),controller[_0x833d('0xe')]);router[_0x833d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x833d('0xf')](_0x833d('0xc'),auth[_0x833d('0x7')](),controller[_0x833d('0x10')]);router[_0x833d('0xf')](_0x833d('0x11'),auth[_0x833d('0x7')](),controller[_0x833d('0x12')]);router[_0x833d('0x13')]('/:id',auth[_0x833d('0x7')](),controller[_0x833d('0x14')]);router['delete'](_0x833d('0x15'),auth['isAuthenticated'](),controller[_0x833d('0x16')]);router['delete'](_0x833d('0xc'),auth['isAuthenticated'](),controller[_0x833d('0x17')]);router[_0x833d('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x833d('0x19')]);module[_0x833d('0x1a')]=router; \ No newline at end of file +var _0xc8fa=['destroy','removeTeams','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete'];(function(_0x447283,_0x2469b2){var _0xff038=function(_0x5ee3f6){while(--_0x5ee3f6){_0x447283['push'](_0x447283['shift']());}};_0xff038(++_0x2469b2);}(_0xc8fa,0x155));var _0xac8f=function(_0x3ba7ef,_0x30e182){_0x3ba7ef=_0x3ba7ef-0x0;var _0x27343f=_0xc8fa[_0x3ba7ef];return _0x27343f;};'use strict';var multer=require(_0xac8f('0x0'));var util=require('util');var path=require(_0xac8f('0x1'));var timeout=require(_0xac8f('0x2'));var express=require('express');var router=express[_0xac8f('0x3')]();var auth=require(_0xac8f('0x4'));var interaction=require(_0xac8f('0x5'));var config=require('../../config/environment');var controller=require(_0xac8f('0x6'));router[_0xac8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xac8f('0x8')]);router[_0xac8f('0x7')](_0xac8f('0x9'),auth[_0xac8f('0xa')](),controller[_0xac8f('0xb')]);router[_0xac8f('0x7')](_0xac8f('0xc'),auth[_0xac8f('0xa')](),controller['show']);router[_0xac8f('0x7')]('/:id/members',auth[_0xac8f('0xa')](),controller[_0xac8f('0xd')]);router[_0xac8f('0x7')](_0xac8f('0xe'),auth[_0xac8f('0xa')](),controller['getTeams']);router[_0xac8f('0x7')](_0xac8f('0xf'),auth[_0xac8f('0xa')](),controller[_0xac8f('0x10')]);router[_0xac8f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xac8f('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xac8f('0x12')]);router[_0xac8f('0x11')](_0xac8f('0xf'),auth[_0xac8f('0xa')](),controller[_0xac8f('0x13')]);router[_0xac8f('0x14')](_0xac8f('0xc'),auth[_0xac8f('0xa')](),controller[_0xac8f('0x15')]);router[_0xac8f('0x16')](_0xac8f('0xc'),auth[_0xac8f('0xa')](),controller[_0xac8f('0x17')]);router[_0xac8f('0x16')](_0xac8f('0xe'),auth['isAuthenticated'](),controller[_0xac8f('0x18')]);router[_0xac8f('0x16')](_0xac8f('0xf'),auth[_0xac8f('0xa')](),controller['removeAgents']);module[_0xac8f('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 55f274a..efaa9a9 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 _0x98ae=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x98ae,0x142));var _0xe98a=function(_0x2fc961,_0x39a3da){_0x2fc961=_0x2fc961-0x0;var _0x54356f=_0x98ae[_0x2fc961];return _0x54356f;};'use strict';var Sequelize=require(_0xe98a('0x0'));module[_0xe98a('0x1')]={'name':{'type':Sequelize[_0xe98a('0x2')],'unique':_0xe98a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe98a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe98a('0x5')](_0xe98a('0x6'),'beepall',_0xe98a('0x7'))}}; \ No newline at end of file +var _0x2da6=['rrmemory','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xb499da,_0x2e8849){var _0x482dd6=function(_0x2b86ca){while(--_0x2b86ca){_0xb499da['push'](_0xb499da['shift']());}};_0x482dd6(++_0x2e8849);}(_0x2da6,0x1dd));var _0x62da=function(_0x12b136,_0x424501){_0x12b136=_0x12b136-0x0;var _0x1af188=_0x2da6[_0x12b136];return _0x1af188;};'use strict';var Sequelize=require(_0x62da('0x0'));module[_0x62da('0x1')]={'name':{'type':Sequelize[_0x62da('0x2')],'unique':_0x62da('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x62da('0x2')]},'timeout':{'type':Sequelize[_0x62da('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x62da('0x5')](_0x62da('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b6a8376..cf6428b 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 _0xc263=['../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','destroy','then','MailQueues','UserProfileResource','error','stack','name','send','index','MailQueue','rawAttributes','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','include','findAll','rows','show','params','find','create','body','get','role','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserMailQueue','User','findAndCountAll','agent','mailPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','online','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','ids','Agents','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','union','compact','value','forEach','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x2a6940,_0x1ba3c6){var _0x348c6c=function(_0x1432be){while(--_0x1432be){_0x2a6940['push'](_0x2a6940['shift']());}};_0x348c6c(++_0x1ba3c6);}(_0xc263,0xfd));var _0x3c26=function(_0x32c507,_0xfb8db){_0x32c507=_0x32c507-0x0;var _0x18e456=_0xc263[_0x32c507];return _0x18e456;};'use strict';var pdf=require(_0x3c26('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3c26('0x1'));var zipdir=require(_0x3c26('0x2'));var jsonpatch=require(_0x3c26('0x3'));var rp=require(_0x3c26('0x4'));var moment=require(_0x3c26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c26('0x6'));var util=require(_0x3c26('0x7'));var path=require(_0x3c26('0x8'));var sox=require(_0x3c26('0x9'));var csv=require(_0x3c26('0xa'));var ejs=require(_0x3c26('0xb'));var fs=require('fs');var _=require(_0x3c26('0xc'));var squel=require(_0x3c26('0xd'));var crypto=require(_0x3c26('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c26('0xa'));var querystring=require(_0x3c26('0xf'));var Papa=require(_0x3c26('0x10'));var Redis=require(_0x3c26('0x11'));var authService=require(_0x3c26('0x12'));var qs=require(_0x3c26('0x13'));var hardwareService=require(_0x3c26('0x14'));var logger=require(_0x3c26('0x15'))(_0x3c26('0x16'));var utils=require(_0x3c26('0x17'));var config=require('../../config/environment');var db=require(_0x3c26('0x18'))['db'];config[_0x3c26('0x19')]=_['defaults'](config[_0x3c26('0x19')],{'host':_0x3c26('0x1a'),'port':0x18eb});var socket=require(_0x3c26('0x1b'))(new Redis(config[_0x3c26('0x19')]));require(_0x3c26('0x1c'))['register'](socket);function respondWithStatusCode(_0x42698b,_0x47e1bf){_0x47e1bf=_0x47e1bf||0xcc;return function(_0x178ca4){if(_0x178ca4){return _0x42698b[_0x3c26('0x1d')](_0x47e1bf);}return _0x42698b['status'](_0x47e1bf)[_0x3c26('0x1e')]();};}function respondWithResult(_0x350a3c,_0x4ca4ae){_0x4ca4ae=_0x4ca4ae||0xc8;return function(_0x332275){if(_0x332275){return _0x350a3c[_0x3c26('0x1f')](_0x4ca4ae)[_0x3c26('0x20')](_0x332275);}};}function respondWithFilteredResult(_0x197ee3,_0x20a814){return function(_0x4dcf12){if(_0x4dcf12){var _0xec903=_0x4dcf12[_0x3c26('0x21')],_0x104a7e=_0x20a814[_0x3c26('0x22')],_0x4851e5=_0x20a814[_0x3c26('0x22')]+_0x20a814[_0x3c26('0x23')],_0x139a6f;if(_0x4851e5>=_0xec903){_0x4851e5=_0xec903;_0x139a6f=0xc8;}else{_0x139a6f=0xce;}_0x197ee3['status'](_0x139a6f);return _0x197ee3[_0x3c26('0x24')]('Content-Range',_0x104a7e+'-'+_0x4851e5+'/'+_0xec903)[_0x3c26('0x20')](_0x4dcf12);}return null;};}function patchUpdates(_0x9ac05b){return function(_0x16f987){try{jsonpatch[_0x3c26('0x25')](_0x16f987,_0x9ac05b,!![]);}catch(_0x263c05){return BPromise[_0x3c26('0x26')](_0x263c05);}return _0x16f987['save']();};}function saveUpdates(_0x1be04d,_0x5891d0){return function(_0x288c58){if(_0x288c58){return _0x288c58[_0x3c26('0x27')](_0x1be04d)['then'](function(_0x4d5dac){return _0x4d5dac;});}return null;};}function removeEntity(_0x198a10,_0x5566f6){return function(_0x1b5d9e){if(_0x1b5d9e){return _0x1b5d9e[_0x3c26('0x28')]()[_0x3c26('0x29')](function(){var _0x5ac77c=_0x1b5d9e['get']({'plain':!![]});var _0x43e0d6=_0x3c26('0x2a');return db[_0x3c26('0x2b')][_0x3c26('0x28')]({'where':{'type':_0x43e0d6,'resourceId':_0x5ac77c['id']}})[_0x3c26('0x29')](function(){return _0x1b5d9e;});})[_0x3c26('0x29')](function(){_0x198a10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff9fd,_0x1af1c4){return function(_0x26980c){if(!_0x26980c){_0x2ff9fd['sendStatus'](0x194);}return _0x26980c;};}function handleError(_0x367dbd,_0x2160c3){_0x2160c3=_0x2160c3||0x1f4;return function(_0x1bc112){logger[_0x3c26('0x2c')](_0x1bc112[_0x3c26('0x2d')]);if(_0x1bc112[_0x3c26('0x2e')]){delete _0x1bc112[_0x3c26('0x2e')];}_0x367dbd[_0x3c26('0x1f')](_0x2160c3)[_0x3c26('0x2f')](_0x1bc112);};}exports[_0x3c26('0x30')]=function(_0x291242,_0x28f59d){var _0x3194df={},_0x5c890a={},_0x2399d9={'count':0x0,'rows':[]};var _0x217e1b=db[_0x3c26('0x31')][_0x3c26('0x32')];_0x5c890a[_0x3c26('0x33')]=_[_0x3c26('0x34')](_0x217e1b);_0x5c890a['query']=_['keys'](_0x291242['query']);_0x5c890a[_0x3c26('0x35')]=_[_0x3c26('0x36')](_0x5c890a[_0x3c26('0x33')],_0x5c890a['query']);_0x3194df[_0x3c26('0x37')]=_['intersection'](_0x5c890a[_0x3c26('0x33')],qs[_0x3c26('0x38')](_0x291242[_0x3c26('0x39')][_0x3c26('0x38')]));_0x3194df['attributes']=_0x3194df[_0x3c26('0x37')][_0x3c26('0x3a')]?_0x3194df[_0x3c26('0x37')]:_0x5c890a[_0x3c26('0x33')];if(!_0x291242[_0x3c26('0x39')][_0x3c26('0x3b')](_0x3c26('0x3c'))){_0x3194df['limit']=qs[_0x3c26('0x23')](_0x291242[_0x3c26('0x39')][_0x3c26('0x23')]);_0x3194df['offset']=qs[_0x3c26('0x22')](_0x291242[_0x3c26('0x39')]['offset']);}_0x3194df[_0x3c26('0x3d')]=qs[_0x3c26('0x3e')](_0x291242['query'][_0x3c26('0x3e')]);_0x3194df[_0x3c26('0x3f')]=qs[_0x3c26('0x35')](_[_0x3c26('0x40')](_0x291242[_0x3c26('0x39')],_0x5c890a[_0x3c26('0x35')]));if(_0x291242[_0x3c26('0x39')][_0x3c26('0x41')]){_0x3194df[_0x3c26('0x3f')]=_[_0x3c26('0x42')](_0x3194df[_0x3c26('0x3f')],{'$or':_[_0x3c26('0x43')](_0x217e1b,function(_0x43f1c2){if(_0x43f1c2[_0x3c26('0x44')]['key']!==_0x3c26('0x45')){var _0x370732={};_0x370732[_0x43f1c2[_0x3c26('0x46')]]={'$like':'%'+_0x291242['query']['filter']+'%'};return _0x370732;}})});}_0x3194df=_[_0x3c26('0x42')]({},_0x3194df,_0x291242[_0x3c26('0x47')]);var _0x4120a5={'where':_0x3194df['where']};return db[_0x3c26('0x31')][_0x3c26('0x21')](_0x4120a5)[_0x3c26('0x29')](function(_0x26710f){_0x2399d9[_0x3c26('0x21')]=_0x26710f;if(_0x291242[_0x3c26('0x39')]['includeAll']){_0x3194df[_0x3c26('0x48')]=[{'all':!![]}];}return db[_0x3c26('0x31')][_0x3c26('0x49')](_0x3194df);})[_0x3c26('0x29')](function(_0x41a74a){_0x2399d9[_0x3c26('0x4a')]=_0x41a74a;return _0x2399d9;})[_0x3c26('0x29')](respondWithFilteredResult(_0x28f59d,_0x3194df))['catch'](handleError(_0x28f59d,null));};exports[_0x3c26('0x4b')]=function(_0x14be08,_0x2e187b){var _0x2effc1={'raw':!![],'where':{'id':_0x14be08[_0x3c26('0x4c')]['id']}},_0x15cd4b={};_0x15cd4b[_0x3c26('0x33')]=_[_0x3c26('0x34')](db[_0x3c26('0x31')][_0x3c26('0x32')]);_0x15cd4b['query']=_['keys'](_0x14be08['query']);_0x15cd4b[_0x3c26('0x35')]=_['intersection'](_0x15cd4b[_0x3c26('0x33')],_0x15cd4b[_0x3c26('0x39')]);_0x2effc1[_0x3c26('0x37')]=_['intersection'](_0x15cd4b[_0x3c26('0x33')],qs[_0x3c26('0x38')](_0x14be08[_0x3c26('0x39')][_0x3c26('0x38')]));_0x2effc1['attributes']=_0x2effc1[_0x3c26('0x37')][_0x3c26('0x3a')]?_0x2effc1[_0x3c26('0x37')]:_0x15cd4b[_0x3c26('0x33')];if(_0x14be08[_0x3c26('0x39')]['includeAll']){_0x2effc1[_0x3c26('0x48')]=[{'all':!![]}];}_0x2effc1=_[_0x3c26('0x42')]({},_0x2effc1,_0x14be08[_0x3c26('0x47')]);return db[_0x3c26('0x31')][_0x3c26('0x4d')](_0x2effc1)[_0x3c26('0x29')](handleEntityNotFound(_0x2e187b,null))['then'](respondWithResult(_0x2e187b,null))['catch'](handleError(_0x2e187b,null));};exports['create']=function(_0x2d6042,_0x379348){return db['MailQueue'][_0x3c26('0x4e')](_0x2d6042[_0x3c26('0x4f')],{})[_0x3c26('0x29')](function(_0x31e092){var _0x1a134e=_0x2d6042['user'][_0x3c26('0x50')]({'plain':!![]});if(!_0x1a134e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a134e[_0x3c26('0x51')]===_0x3c26('0x52')){var _0x3d1b93=_0x31e092['get']({'plain':!![]});var _0x22806b=_0x3c26('0x2a');return db[_0x3c26('0x53')][_0x3c26('0x4d')]({'where':{'name':_0x22806b,'userProfileId':_0x1a134e[_0x3c26('0x54')]},'raw':!![]})['then'](function(_0x3e7824){if(_0x3e7824&&_0x3e7824['autoAssociation']===0x0){return db[_0x3c26('0x2b')][_0x3c26('0x4e')]({'name':_0x3d1b93[_0x3c26('0x2e')],'resourceId':_0x3d1b93['id'],'type':_0x3e7824['name'],'sectionId':_0x3e7824['id']},{})['then'](function(){return _0x31e092;});}else{return _0x31e092;}})[_0x3c26('0x55')](function(_0x5ad152){logger[_0x3c26('0x2c')](_0x3c26('0x56'),_0x5ad152);throw _0x5ad152;});}return _0x31e092;})[_0x3c26('0x29')](respondWithResult(_0x379348,0xc9))[_0x3c26('0x55')](handleError(_0x379348,null));};exports[_0x3c26('0x27')]=function(_0x2de67f,_0x45a929){if(_0x2de67f[_0x3c26('0x4f')]['id']){delete _0x2de67f[_0x3c26('0x4f')]['id'];}return db[_0x3c26('0x31')][_0x3c26('0x4d')]({'where':{'id':_0x2de67f[_0x3c26('0x4c')]['id']}})[_0x3c26('0x29')](handleEntityNotFound(_0x45a929,null))[_0x3c26('0x29')](saveUpdates(_0x2de67f[_0x3c26('0x4f')],null))[_0x3c26('0x29')](respondWithResult(_0x45a929,null))[_0x3c26('0x55')](handleError(_0x45a929,null));};exports[_0x3c26('0x28')]=function(_0x310a8a,_0x2ddcee){return db[_0x3c26('0x31')][_0x3c26('0x4d')]({'where':{'id':_0x310a8a[_0x3c26('0x4c')]['id']}})[_0x3c26('0x29')](handleEntityNotFound(_0x2ddcee,null))[_0x3c26('0x29')](removeEntity(_0x2ddcee,null))[_0x3c26('0x55')](handleError(_0x2ddcee,null));};exports['describe']=function(_0x55a3bd,_0x539dfd){return db[_0x3c26('0x31')]['describe']()[_0x3c26('0x29')](respondWithResult(_0x539dfd,null))['catch'](handleError(_0x539dfd,null));};exports[_0x3c26('0x57')]=function(_0x1e76f6,_0x1ac180,_0x2ccd6b){var _0x5278d7={'raw':!![],'where':{}},_0x40dd6e={},_0x2a316b;return db['MailQueue'][_0x3c26('0x58')]({'where':{'id':_0x1e76f6['params']['id']}})[_0x3c26('0x29')](handleEntityNotFound(_0x1ac180,null))[_0x3c26('0x29')](function(_0x2581cf){if(_0x2581cf){_0x2a316b=_0x2581cf[_0x3c26('0x50')]({'plain':!![]});_0x40dd6e[_0x3c26('0x33')]=_[_0x3c26('0x34')](db[_0x3c26('0x59')]['rawAttributes']);_0x40dd6e[_0x3c26('0x39')]=_[_0x3c26('0x34')](_0x1e76f6[_0x3c26('0x39')]);_0x40dd6e[_0x3c26('0x35')]=_[_0x3c26('0x36')](_0x40dd6e[_0x3c26('0x33')],_0x40dd6e[_0x3c26('0x39')]);_0x5278d7['attributes']=_[_0x3c26('0x36')](_0x40dd6e[_0x3c26('0x33')],qs[_0x3c26('0x38')](_0x1e76f6[_0x3c26('0x39')][_0x3c26('0x38')]));_0x5278d7['attributes']=_0x5278d7[_0x3c26('0x37')][_0x3c26('0x3a')]?_0x5278d7[_0x3c26('0x37')]:_0x40dd6e[_0x3c26('0x33')];if(!_0x1e76f6[_0x3c26('0x39')][_0x3c26('0x3b')]('nolimit')){_0x5278d7[_0x3c26('0x23')]=qs['limit'](_0x1e76f6[_0x3c26('0x39')][_0x3c26('0x23')]);_0x5278d7[_0x3c26('0x22')]=qs[_0x3c26('0x22')](_0x1e76f6[_0x3c26('0x39')][_0x3c26('0x22')]);}_0x5278d7[_0x3c26('0x3d')]=qs[_0x3c26('0x3e')](_0x1e76f6[_0x3c26('0x39')]['sort']);_0x5278d7['where']=qs['filters'](_[_0x3c26('0x40')](_0x1e76f6[_0x3c26('0x39')],_0x40dd6e['filters']));_0x5278d7[_0x3c26('0x3f')]['MailQueueId']=_0x2581cf['id'];if(_0x1e76f6[_0x3c26('0x39')][_0x3c26('0x41')]){_0x5278d7[_0x3c26('0x3f')]=_[_0x3c26('0x42')](_0x5278d7[_0x3c26('0x3f')],{'$or':_[_0x3c26('0x43')](_0x5278d7[_0x3c26('0x37')],function(_0xfa33ac){var _0x56dbe5={};_0x56dbe5[_0xfa33ac]={'$like':'%'+_0x1e76f6['query'][_0x3c26('0x41')]+'%'};return _0x56dbe5;})});}_0x5278d7=_['merge']({},_0x5278d7,_0x1e76f6[_0x3c26('0x47')]);return db['UserMailQueue']['findAll'](_0x5278d7);}})[_0x3c26('0x29')](function(_0x3b9fad){if(_0x3b9fad){return db[_0x3c26('0x5a')][_0x3c26('0x5b')]({'where':{'id':_[_0x3c26('0x43')](_0x3b9fad,'UserId'),'role':_0x3c26('0x5c')},'attributes':['id','name',_0x3c26('0x5d'),'updatedAt',_0x3c26('0x5e')]});}})[_0x3c26('0x29')](function(_0x2003f7){if(_0x2003f7){return{'count':_0x2003f7[_0x3c26('0x21')],'rows':_[_0x3c26('0x43')](_0x2003f7[_0x3c26('0x4a')],function(_0x5ae588){return{'membername':_0x5ae588[_0x3c26('0x2e')],'UserId':_0x5ae588['id'],'queue_name':_0x2a316b['name'],'MailQueueId':_0x2a316b['id'],'interface':util['format'](_0x3c26('0x5f'),_0x3c26('0x60'),_0x5ae588[_0x3c26('0x2e')]),'penalty':0x0,'paused':_0x5ae588[_0x3c26('0x5d')],'createdAt':_0x5ae588[_0x3c26('0x5e')],'updatedAt':_0x5ae588[_0x3c26('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3c26('0x29')](respondWithFilteredResult(_0x1ac180,_0x5278d7))[_0x3c26('0x55')](handleError(_0x1ac180,null));};exports[_0x3c26('0x62')]=function(_0x81aca0,_0x223aed,_0x283065){var _0x20ba84={};var _0x5cc6cc={};var _0x33d2dc;var _0x4e9d89;return db[_0x3c26('0x31')][_0x3c26('0x58')]({'where':{'id':_0x81aca0[_0x3c26('0x4c')]['id']}})[_0x3c26('0x29')](handleEntityNotFound(_0x223aed,null))[_0x3c26('0x29')](function(_0x58c82a){if(_0x58c82a){_0x33d2dc=_0x58c82a;_0x5cc6cc[_0x3c26('0x33')]=_['keys'](db[_0x3c26('0x63')]['rawAttributes']);_0x5cc6cc[_0x3c26('0x39')]=_[_0x3c26('0x34')](_0x81aca0[_0x3c26('0x39')]);_0x5cc6cc[_0x3c26('0x35')]=_['intersection'](_0x5cc6cc['model'],_0x5cc6cc[_0x3c26('0x39')]);_0x20ba84[_0x3c26('0x37')]=_[_0x3c26('0x36')](_0x5cc6cc[_0x3c26('0x33')],qs[_0x3c26('0x38')](_0x81aca0[_0x3c26('0x39')][_0x3c26('0x38')]));_0x20ba84['attributes']=_0x20ba84['attributes']['length']?_0x20ba84['attributes']:_0x5cc6cc[_0x3c26('0x33')];_0x20ba84['order']=qs[_0x3c26('0x3e')](_0x81aca0[_0x3c26('0x39')]['sort']);_0x20ba84['where']=qs[_0x3c26('0x35')](_[_0x3c26('0x40')](_0x81aca0['query'],_0x5cc6cc[_0x3c26('0x35')]));if(_0x81aca0['query']['filter']){_0x20ba84[_0x3c26('0x3f')]=_['merge'](_0x20ba84[_0x3c26('0x3f')],{'$or':_[_0x3c26('0x43')](_0x20ba84[_0x3c26('0x37')],function(_0xd1a6fe){var _0x42ac64={};_0x42ac64[_0xd1a6fe]={'$like':'%'+_0x81aca0[_0x3c26('0x39')][_0x3c26('0x41')]+'%'};return _0x42ac64;})});}_0x20ba84=_[_0x3c26('0x42')]({},_0x20ba84,_0x81aca0[_0x3c26('0x47')]);return _0x33d2dc[_0x3c26('0x62')](_0x20ba84);}})[_0x3c26('0x29')](function(_0x3d5e02){if(_0x3d5e02){_0x4e9d89=_0x3d5e02[_0x3c26('0x3a')];if(!_0x81aca0[_0x3c26('0x39')]['hasOwnProperty']('nolimit')){_0x20ba84['limit']=qs[_0x3c26('0x23')](_0x81aca0[_0x3c26('0x39')][_0x3c26('0x23')]);_0x20ba84['offset']=qs[_0x3c26('0x22')](_0x81aca0[_0x3c26('0x39')][_0x3c26('0x22')]);}return _0x33d2dc['getTeams'](_0x20ba84);}})['then'](function(_0x89acc4){if(_0x89acc4){return _0x89acc4?{'count':_0x4e9d89,'rows':_0x89acc4}:null;}})[_0x3c26('0x29')](respondWithResult(_0x223aed,null))[_0x3c26('0x55')](handleError(_0x223aed,null));};exports[_0x3c26('0x64')]=function(_0x3bdcec,_0x10978f,_0x242899){var _0x1d9d4e=_0x3bdcec['body']['ids'];return db[_0x3c26('0x63')][_0x3c26('0x49')]({'where':{'id':_0x1d9d4e},'attributes':['id'],'include':[{'model':db[_0x3c26('0x5a')],'as':'Agents','attributes':['id',_0x3c26('0x2e'),_0x3c26('0x65'),_0x3c26('0x66'),_0x3c26('0x67')],'raw':!![]}]})['then'](function(_0x37da5c){if(_0x37da5c){var _0x2c3955=_['flatMap'](_0x37da5c,function(_0x3d2121){var _0x117ca2=_0x3d2121[_0x3c26('0x50')]({'plain':!![]});return _0x117ca2['Agents'];});return db['MailQueue'][_0x3c26('0x4d')]({'where':{'id':_0x3bdcec[_0x3c26('0x4c')]['id']}})[_0x3c26('0x29')](function(_0x43ffe9){return db[_0x3c26('0x68')][_0x3c26('0x69')](function(_0x347f8b){return _0x43ffe9[_0x3c26('0x64')](_0x1d9d4e,{'transaction':_0x347f8b})[_0x3c26('0x29')](function(){return BPromise[_0x3c26('0x6a')](_0x2c3955,function(_0x53f511){return db[_0x3c26('0x59')][_0x3c26('0x6b')]({'where':{'UserId':_0x53f511['id'],'MailQueueId':_0x3bdcec['params']['id']},'transaction':_0x347f8b});});})['then'](function(){_0x2c3955['forEach'](function(_0x50ae36){socket[_0x3c26('0x6c')](_0x3c26('0x6d'),{'UserId':_0x50ae36['id'],'MailQueueId':_0x43ffe9['id']});});});});});}})['then'](respondWithStatusCode(_0x10978f,null))['catch'](handleError(_0x10978f,null));};exports[_0x3c26('0x6e')]=function(_0x4b7c39,_0x23d77b,_0x1b3b48){return db[_0x3c26('0x63')][_0x3c26('0x49')]({'where':{'id':_0x4b7c39['query'][_0x3c26('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x3c26('0x5a')],'as':_0x3c26('0x70'),'attributes':['id'],'raw':!![]}]})[_0x3c26('0x29')](handleEntityNotFound(_0x23d77b,null))[_0x3c26('0x29')](function(_0x55c52a){var _0x2da4e4=_[_0x3c26('0x43')](_0x55c52a,'id');var _0x361d1c=[];var _0x45ff8b=[];var _0x3574cc=squel[_0x3c26('0x71')]();_0x3574cc[_0x3c26('0x46')](_0x3c26('0x72'))[_0x3c26('0x73')](_0x3c26('0x74'),'tq')['join'](_0x3c26('0x75'),'ut',_0x3c26('0x76'))[_0x3c26('0x3f')](_0x3c26('0x77'),_0x4b7c39[_0x3c26('0x4c')]['id']);for(var _0x4d00cd=0x0;_0x4d00cd<_0x55c52a[_0x3c26('0x3a')];_0x4d00cd+=0x1){let _0x4a434a=_0x55c52a[_0x4d00cd];for(var _0x4637ab=0x0;_0x4637ab<_0x4a434a[_0x3c26('0x70')][_0x3c26('0x3a')];_0x4637ab+=0x1){let _0x49d401=_0x4a434a['Agents'][_0x4637ab];var _0x5e7fbe=_0x3574cc[_0x3c26('0x78')]();_0x5e7fbe[_0x3c26('0x3f')](_0x3c26('0x79'),_0x49d401['id']);_0x45ff8b[_0x3c26('0x7a')](db['sequelize']['query'](_0x5e7fbe['toString'](),{'type':db['sequelize'][_0x3c26('0x7b')][_0x3c26('0x7c')]})[_0x3c26('0x29')](function(_0x47f469){if(_0x47f469[_0x3c26('0x3a')]===0x1){return _0x49d401['id'];}else{var _0x145459=_['every'](_[_0x3c26('0x43')](_0x47f469,_0x3c26('0x7d')),function(_0x12af12){return _['includes'](_0x2da4e4,_0x12af12);});if(_0x145459){return _0x49d401['id'];}}}));}}return BPromise[_0x3c26('0x7e')](_0x45ff8b)['then'](function(_0x56deea){_0x361d1c=_(_0x361d1c)[_0x3c26('0x7f')](_0x56deea)[_0x3c26('0x80')]()[_0x3c26('0x81')]();return db[_0x3c26('0x31')][_0x3c26('0x4d')]({'where':{'id':_0x4b7c39['params']['id']}})[_0x3c26('0x29')](function(_0x27b20b){return db[_0x3c26('0x68')]['transaction'](function(_0x5b9b64){return _0x27b20b[_0x3c26('0x6e')](_0x4b7c39['query'][_0x3c26('0x6f')],{'transaction':_0x5b9b64})[_0x3c26('0x29')](function(){if(!_['isEmpty'](_0x361d1c)){return _0x27b20b['removeAgents'](_0x361d1c,{'transaction':_0x5b9b64});}})['then'](function(){_0x361d1c[_0x3c26('0x82')](function(_0x12fb39){socket['emit'](_0x3c26('0x83'),{'UserId':_0x12fb39,'MailQueueId':_0x27b20b['id']});});});});});});})[_0x3c26('0x29')](respondWithStatusCode(_0x23d77b,null))['catch'](handleError(_0x23d77b,null));};exports[_0x3c26('0x84')]=function(_0x520016,_0x1e595d,_0x5b2d01){return db[_0x3c26('0x31')][_0x3c26('0x4d')]({'where':{'id':_0x520016[_0x3c26('0x4c')]['id']}})[_0x3c26('0x29')](handleEntityNotFound(_0x1e595d,null))[_0x3c26('0x29')](function(_0x54a187){if(_0x54a187){return _0x54a187[_0x3c26('0x84')](_0x520016['body']['ids'],_[_0x3c26('0x85')](_0x520016[_0x3c26('0x4f')],['ids','id'])||{})[_0x3c26('0x86')](function(_0x29f4ac){for(var _0x311784=0x0;_0x311784<_0x520016[_0x3c26('0x4f')][_0x3c26('0x6f')][_0x3c26('0x3a')];_0x311784+=0x1){socket[_0x3c26('0x6c')](_0x3c26('0x6d'),{'UserId':_0x520016['body'][_0x3c26('0x6f')][_0x311784],'MailQueueId':_0x520016[_0x3c26('0x4c')]['id']});}return _0x29f4ac;});}})[_0x3c26('0x29')](respondWithResult(_0x1e595d,null))[_0x3c26('0x55')](handleError(_0x1e595d,null));};exports['removeAgents']=function(_0x5545d6,_0x3a90cd,_0x988643){return db[_0x3c26('0x31')][_0x3c26('0x4d')]({'where':{'id':_0x5545d6[_0x3c26('0x4c')]['id']}})[_0x3c26('0x29')](handleEntityNotFound(_0x3a90cd,null))[_0x3c26('0x29')](function(_0x5c74f2){if(_0x5c74f2){return _0x5c74f2[_0x3c26('0x87')](_0x5545d6[_0x3c26('0x39')]['ids'])[_0x3c26('0x29')](function(){if(_[_0x3c26('0x88')](_0x5545d6[_0x3c26('0x39')]['ids'])){for(var _0x244003=0x0;_0x244003<_0x5545d6[_0x3c26('0x39')][_0x3c26('0x6f')][_0x3c26('0x3a')];_0x244003+=0x1){socket[_0x3c26('0x6c')](_0x3c26('0x83'),{'UserId':Number(_0x5545d6[_0x3c26('0x39')][_0x3c26('0x6f')][_0x244003]),'MailQueueId':Number(_0x5545d6[_0x3c26('0x4c')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x5545d6[_0x3c26('0x39')]['ids']),'MailQueueId':Number(_0x5545d6[_0x3c26('0x4c')]['id'])});}});}})[_0x3c26('0x29')](respondWithStatusCode(_0x3a90cd,null))[_0x3c26('0x55')](handleError(_0x3a90cd,null));};exports[_0x3c26('0x89')]=function(_0x58d999,_0x1aeded,_0x1377d6){var _0x499491={};var _0x57c4bb={};var _0x3427f1;var _0x3acfbb;return db[_0x3c26('0x31')][_0x3c26('0x58')]({'where':{'id':_0x58d999['params']['id']}})['then'](handleEntityNotFound(_0x1aeded,null))[_0x3c26('0x29')](function(_0x2d8e92){if(_0x2d8e92){_0x3427f1=_0x2d8e92;_0x57c4bb[_0x3c26('0x33')]=_['keys'](db[_0x3c26('0x5a')][_0x3c26('0x32')]);_0x57c4bb[_0x3c26('0x39')]=_['keys'](_0x58d999[_0x3c26('0x39')]);_0x57c4bb[_0x3c26('0x35')]=_[_0x3c26('0x36')](_0x57c4bb[_0x3c26('0x33')],_0x57c4bb[_0x3c26('0x39')]);_0x499491[_0x3c26('0x37')]=_[_0x3c26('0x36')](_0x57c4bb[_0x3c26('0x33')],qs[_0x3c26('0x38')](_0x58d999['query'][_0x3c26('0x38')]));_0x499491[_0x3c26('0x37')]=_0x499491[_0x3c26('0x37')][_0x3c26('0x3a')]?_0x499491[_0x3c26('0x37')]:_0x57c4bb[_0x3c26('0x33')];_0x499491['order']=qs[_0x3c26('0x3e')](_0x58d999[_0x3c26('0x39')]['sort']);_0x499491[_0x3c26('0x3f')]=qs[_0x3c26('0x35')](_['pick'](_0x58d999[_0x3c26('0x39')],_0x57c4bb[_0x3c26('0x35')]));if(_0x58d999['query'][_0x3c26('0x41')]){_0x499491[_0x3c26('0x3f')]=_[_0x3c26('0x42')](_0x499491[_0x3c26('0x3f')],{'$or':_[_0x3c26('0x43')](_0x499491[_0x3c26('0x37')],function(_0x1f652a){var _0x5ed2c9={};_0x5ed2c9[_0x1f652a]={'$like':'%'+_0x58d999[_0x3c26('0x39')][_0x3c26('0x41')]+'%'};return _0x5ed2c9;})});}_0x499491=_['merge']({},_0x499491,_0x58d999[_0x3c26('0x47')]);return _0x3427f1[_0x3c26('0x89')](_0x499491);}})[_0x3c26('0x29')](function(_0x256623){if(_0x256623){_0x3acfbb=_0x256623['length'];if(!_0x58d999['query']['hasOwnProperty'](_0x3c26('0x3c'))){_0x499491[_0x3c26('0x23')]=qs[_0x3c26('0x23')](_0x58d999[_0x3c26('0x39')][_0x3c26('0x23')]);_0x499491[_0x3c26('0x22')]=qs[_0x3c26('0x22')](_0x58d999[_0x3c26('0x39')]['offset']);}return _0x3427f1[_0x3c26('0x89')](_0x499491);}})[_0x3c26('0x29')](function(_0x3068e2){if(_0x3068e2){return _0x3068e2?{'count':_0x3acfbb,'rows':_0x3068e2}:null;}})[_0x3c26('0x29')](respondWithResult(_0x1aeded,null))['catch'](handleError(_0x1aeded,null));}; \ No newline at end of file +var _0x5e12=['ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./mailQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','then','stack','name','index','MailQueue','model','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','pick','filter','where','merge','map','key','VIRTUAL','field','count','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','length','hasOwnProperty','MailQueueId','User','UserId','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','forEach','emit','userMailQueue:save','tq.TeamId','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x444d49,_0x15a282){var _0x5c99b3=function(_0x3d2d0a){while(--_0x3d2d0a){_0x444d49['push'](_0x444d49['shift']());}};_0x5c99b3(++_0x15a282);}(_0x5e12,0x193));var _0x25e1=function(_0x2ebd0b,_0xf5f5e3){_0x2ebd0b=_0x2ebd0b-0x0;var _0xc8127b=_0x5e12[_0x2ebd0b];return _0xc8127b;};'use strict';var pdf=require(_0x25e1('0x0'));var emlformat=require(_0x25e1('0x1'));var rimraf=require(_0x25e1('0x2'));var zipdir=require(_0x25e1('0x3'));var jsonpatch=require(_0x25e1('0x4'));var rp=require(_0x25e1('0x5'));var moment=require(_0x25e1('0x6'));var BPromise=require(_0x25e1('0x7'));var Mustache=require('mustache');var util=require(_0x25e1('0x8'));var path=require('path');var sox=require(_0x25e1('0x9'));var csv=require(_0x25e1('0xa'));var ejs=require(_0x25e1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x25e1('0xc'));var crypto=require('crypto');var jsforce=require(_0x25e1('0xd'));var deskjs=require(_0x25e1('0xe'));var toCsv=require(_0x25e1('0xa'));var querystring=require(_0x25e1('0xf'));var Papa=require(_0x25e1('0x10'));var Redis=require(_0x25e1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x25e1('0x12'));var hardwareService=require(_0x25e1('0x13'));var logger=require(_0x25e1('0x14'))(_0x25e1('0x15'));var utils=require('../../config/utils');var config=require(_0x25e1('0x16'));var db=require(_0x25e1('0x17'))['db'];config[_0x25e1('0x18')]=_[_0x25e1('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25e1('0x18')]));require(_0x25e1('0x1a'))[_0x25e1('0x1b')](socket);function respondWithStatusCode(_0x40ed6e,_0xf5a70e){_0xf5a70e=_0xf5a70e||0xcc;return function(_0x5b4be0){if(_0x5b4be0){return _0x40ed6e[_0x25e1('0x1c')](_0xf5a70e);}return _0x40ed6e[_0x25e1('0x1d')](_0xf5a70e)['end']();};}function respondWithResult(_0x6e2555,_0x26dac2){_0x26dac2=_0x26dac2||0xc8;return function(_0x4639db){if(_0x4639db){return _0x6e2555['status'](_0x26dac2)[_0x25e1('0x1e')](_0x4639db);}};}function respondWithFilteredResult(_0x501b1c,_0x394bbf){return function(_0x10075d){if(_0x10075d){var _0x3e56b3=_0x10075d['count'],_0x59d0b6=_0x394bbf['offset'],_0x4f4e80=_0x394bbf[_0x25e1('0x1f')]+_0x394bbf[_0x25e1('0x20')],_0x231428;if(_0x4f4e80>=_0x3e56b3){_0x4f4e80=_0x3e56b3;_0x231428=0xc8;}else{_0x231428=0xce;}_0x501b1c[_0x25e1('0x1d')](_0x231428);return _0x501b1c[_0x25e1('0x21')](_0x25e1('0x22'),_0x59d0b6+'-'+_0x4f4e80+'/'+_0x3e56b3)[_0x25e1('0x1e')](_0x10075d);}return null;};}function patchUpdates(_0x11e040){return function(_0xa29a65){try{jsonpatch[_0x25e1('0x23')](_0xa29a65,_0x11e040,!![]);}catch(_0x4b1a8e){return BPromise['reject'](_0x4b1a8e);}return _0xa29a65[_0x25e1('0x24')]();};}function saveUpdates(_0x4209c1,_0x1e4112){return function(_0x4e3ce2){if(_0x4e3ce2){return _0x4e3ce2[_0x25e1('0x25')](_0x4209c1)['then'](function(_0xa36ff){return _0xa36ff;});}return null;};}function removeEntity(_0x20c5b8,_0x4dc265){return function(_0x4c11c7){if(_0x4c11c7){return _0x4c11c7[_0x25e1('0x26')]()['then'](function(){var _0x19cff2=_0x4c11c7[_0x25e1('0x27')]({'plain':!![]});var _0x26b399='MailQueues';return db[_0x25e1('0x28')][_0x25e1('0x26')]({'where':{'type':_0x26b399,'resourceId':_0x19cff2['id']}})[_0x25e1('0x29')](function(){return _0x4c11c7;});})[_0x25e1('0x29')](function(){_0x20c5b8[_0x25e1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481523,_0x56926f){return function(_0x44c949){if(!_0x44c949){_0x481523[_0x25e1('0x1c')](0x194);}return _0x44c949;};}function handleError(_0x2121ae,_0xc2934b){_0xc2934b=_0xc2934b||0x1f4;return function(_0x353fe2){logger['error'](_0x353fe2[_0x25e1('0x2a')]);if(_0x353fe2[_0x25e1('0x2b')]){delete _0x353fe2['name'];}_0x2121ae[_0x25e1('0x1d')](_0xc2934b)['send'](_0x353fe2);};}exports[_0x25e1('0x2c')]=function(_0x1ef101,_0x82dd18){var _0x59abc3={},_0x1c835c={},_0x581ca9={'count':0x0,'rows':[]};var _0x338694=db[_0x25e1('0x2d')]['rawAttributes'];_0x1c835c[_0x25e1('0x2e')]=_[_0x25e1('0x2f')](_0x338694);_0x1c835c['query']=_[_0x25e1('0x2f')](_0x1ef101['query']);_0x1c835c[_0x25e1('0x30')]=_[_0x25e1('0x31')](_0x1c835c[_0x25e1('0x2e')],_0x1c835c['query']);_0x59abc3['attributes']=_['intersection'](_0x1c835c['model'],qs['fields'](_0x1ef101[_0x25e1('0x32')][_0x25e1('0x33')]));_0x59abc3[_0x25e1('0x34')]=_0x59abc3['attributes']['length']?_0x59abc3[_0x25e1('0x34')]:_0x1c835c['model'];if(!_0x1ef101[_0x25e1('0x32')]['hasOwnProperty'](_0x25e1('0x35'))){_0x59abc3['limit']=qs[_0x25e1('0x20')](_0x1ef101[_0x25e1('0x32')][_0x25e1('0x20')]);_0x59abc3[_0x25e1('0x1f')]=qs[_0x25e1('0x1f')](_0x1ef101[_0x25e1('0x32')][_0x25e1('0x1f')]);}_0x59abc3[_0x25e1('0x36')]=qs['sort'](_0x1ef101[_0x25e1('0x32')][_0x25e1('0x37')]);_0x59abc3['where']=qs[_0x25e1('0x30')](_[_0x25e1('0x38')](_0x1ef101[_0x25e1('0x32')],_0x1c835c[_0x25e1('0x30')]));if(_0x1ef101[_0x25e1('0x32')][_0x25e1('0x39')]){_0x59abc3[_0x25e1('0x3a')]=_[_0x25e1('0x3b')](_0x59abc3[_0x25e1('0x3a')],{'$or':_[_0x25e1('0x3c')](_0x338694,function(_0x4b54cd){if(_0x4b54cd['type'][_0x25e1('0x3d')]!==_0x25e1('0x3e')){var _0x347cf9={};_0x347cf9[_0x4b54cd[_0x25e1('0x3f')]]={'$like':'%'+_0x1ef101[_0x25e1('0x32')]['filter']+'%'};return _0x347cf9;}})});}_0x59abc3=_[_0x25e1('0x3b')]({},_0x59abc3,_0x1ef101['options']);var _0x40ad77={'where':_0x59abc3['where']};return db['MailQueue'][_0x25e1('0x40')](_0x40ad77)[_0x25e1('0x29')](function(_0x38a371){_0x581ca9[_0x25e1('0x40')]=_0x38a371;if(_0x1ef101[_0x25e1('0x32')][_0x25e1('0x41')]){_0x59abc3[_0x25e1('0x42')]=[{'all':!![]}];}return db[_0x25e1('0x2d')][_0x25e1('0x43')](_0x59abc3);})[_0x25e1('0x29')](function(_0xbe998){_0x581ca9[_0x25e1('0x44')]=_0xbe998;return _0x581ca9;})[_0x25e1('0x29')](respondWithFilteredResult(_0x82dd18,_0x59abc3))['catch'](handleError(_0x82dd18,null));};exports[_0x25e1('0x45')]=function(_0x34f286,_0x28cf1d){var _0x185103={'raw':!![],'where':{'id':_0x34f286[_0x25e1('0x46')]['id']}},_0x1cfd89={};_0x1cfd89[_0x25e1('0x2e')]=_[_0x25e1('0x2f')](db[_0x25e1('0x2d')][_0x25e1('0x47')]);_0x1cfd89[_0x25e1('0x32')]=_[_0x25e1('0x2f')](_0x34f286[_0x25e1('0x32')]);_0x1cfd89[_0x25e1('0x30')]=_[_0x25e1('0x31')](_0x1cfd89[_0x25e1('0x2e')],_0x1cfd89['query']);_0x185103[_0x25e1('0x34')]=_[_0x25e1('0x31')](_0x1cfd89['model'],qs[_0x25e1('0x33')](_0x34f286[_0x25e1('0x32')]['fields']));_0x185103[_0x25e1('0x34')]=_0x185103[_0x25e1('0x34')]['length']?_0x185103[_0x25e1('0x34')]:_0x1cfd89['model'];if(_0x34f286[_0x25e1('0x32')]['includeAll']){_0x185103[_0x25e1('0x42')]=[{'all':!![]}];}_0x185103=_[_0x25e1('0x3b')]({},_0x185103,_0x34f286[_0x25e1('0x48')]);return db['MailQueue'][_0x25e1('0x49')](_0x185103)[_0x25e1('0x29')](handleEntityNotFound(_0x28cf1d,null))[_0x25e1('0x29')](respondWithResult(_0x28cf1d,null))[_0x25e1('0x4a')](handleError(_0x28cf1d,null));};exports[_0x25e1('0x4b')]=function(_0x3b0985,_0x1a0e29){return db['MailQueue'][_0x25e1('0x4b')](_0x3b0985[_0x25e1('0x4c')],{})[_0x25e1('0x29')](function(_0x4625be){var _0x78a95e=_0x3b0985[_0x25e1('0x4d')][_0x25e1('0x27')]({'plain':!![]});if(!_0x78a95e)throw new Error(_0x25e1('0x4e'));if(_0x78a95e['role']===_0x25e1('0x4d')){var _0x391808=_0x4625be[_0x25e1('0x27')]({'plain':!![]});var _0x2b2781=_0x25e1('0x4f');return db[_0x25e1('0x50')]['find']({'where':{'name':_0x2b2781,'userProfileId':_0x78a95e[_0x25e1('0x51')]},'raw':!![]})[_0x25e1('0x29')](function(_0x232e41){if(_0x232e41&&_0x232e41['autoAssociation']===0x0){return db[_0x25e1('0x28')]['create']({'name':_0x391808[_0x25e1('0x2b')],'resourceId':_0x391808['id'],'type':_0x232e41[_0x25e1('0x2b')],'sectionId':_0x232e41['id']},{})[_0x25e1('0x29')](function(){return _0x4625be;});}else{return _0x4625be;}})['catch'](function(_0x101de0){logger['error'](_0x25e1('0x52'),_0x101de0);throw _0x101de0;});}return _0x4625be;})['then'](respondWithResult(_0x1a0e29,0xc9))[_0x25e1('0x4a')](handleError(_0x1a0e29,null));};exports[_0x25e1('0x25')]=function(_0x15690b,_0x269a9f){if(_0x15690b[_0x25e1('0x4c')]['id']){delete _0x15690b[_0x25e1('0x4c')]['id'];}return db['MailQueue'][_0x25e1('0x49')]({'where':{'id':_0x15690b[_0x25e1('0x46')]['id']}})['then'](handleEntityNotFound(_0x269a9f,null))['then'](saveUpdates(_0x15690b['body'],null))[_0x25e1('0x29')](respondWithResult(_0x269a9f,null))[_0x25e1('0x4a')](handleError(_0x269a9f,null));};exports[_0x25e1('0x26')]=function(_0x2e69ae,_0x20007f){return db['MailQueue'][_0x25e1('0x49')]({'where':{'id':_0x2e69ae[_0x25e1('0x46')]['id']}})['then'](handleEntityNotFound(_0x20007f,null))[_0x25e1('0x29')](removeEntity(_0x20007f,null))[_0x25e1('0x4a')](handleError(_0x20007f,null));};exports[_0x25e1('0x53')]=function(_0x4bc4b3,_0x311f45){return db[_0x25e1('0x2d')][_0x25e1('0x53')]()[_0x25e1('0x29')](respondWithResult(_0x311f45,null))[_0x25e1('0x4a')](handleError(_0x311f45,null));};exports[_0x25e1('0x54')]=function(_0x337669,_0x248393,_0x482ebc){var _0x207ef5={'raw':!![],'where':{}},_0x5a32a5={},_0x4ee11f;return db['MailQueue'][_0x25e1('0x55')]({'where':{'id':_0x337669[_0x25e1('0x46')]['id']}})['then'](handleEntityNotFound(_0x248393,null))[_0x25e1('0x29')](function(_0x146832){if(_0x146832){_0x4ee11f=_0x146832['get']({'plain':!![]});_0x5a32a5[_0x25e1('0x2e')]=_[_0x25e1('0x2f')](db[_0x25e1('0x56')]['rawAttributes']);_0x5a32a5['query']=_['keys'](_0x337669[_0x25e1('0x32')]);_0x5a32a5[_0x25e1('0x30')]=_[_0x25e1('0x31')](_0x5a32a5['model'],_0x5a32a5[_0x25e1('0x32')]);_0x207ef5[_0x25e1('0x34')]=_[_0x25e1('0x31')](_0x5a32a5[_0x25e1('0x2e')],qs[_0x25e1('0x33')](_0x337669[_0x25e1('0x32')][_0x25e1('0x33')]));_0x207ef5['attributes']=_0x207ef5[_0x25e1('0x34')][_0x25e1('0x57')]?_0x207ef5[_0x25e1('0x34')]:_0x5a32a5[_0x25e1('0x2e')];if(!_0x337669[_0x25e1('0x32')][_0x25e1('0x58')](_0x25e1('0x35'))){_0x207ef5['limit']=qs['limit'](_0x337669[_0x25e1('0x32')]['limit']);_0x207ef5[_0x25e1('0x1f')]=qs[_0x25e1('0x1f')](_0x337669[_0x25e1('0x32')][_0x25e1('0x1f')]);}_0x207ef5[_0x25e1('0x36')]=qs[_0x25e1('0x37')](_0x337669[_0x25e1('0x32')]['sort']);_0x207ef5['where']=qs[_0x25e1('0x30')](_['pick'](_0x337669[_0x25e1('0x32')],_0x5a32a5[_0x25e1('0x30')]));_0x207ef5[_0x25e1('0x3a')][_0x25e1('0x59')]=_0x146832['id'];if(_0x337669['query'][_0x25e1('0x39')]){_0x207ef5[_0x25e1('0x3a')]=_[_0x25e1('0x3b')](_0x207ef5[_0x25e1('0x3a')],{'$or':_['map'](_0x207ef5[_0x25e1('0x34')],function(_0x460f33){var _0x5670dc={};_0x5670dc[_0x460f33]={'$like':'%'+_0x337669[_0x25e1('0x32')]['filter']+'%'};return _0x5670dc;})});}_0x207ef5=_[_0x25e1('0x3b')]({},_0x207ef5,_0x337669[_0x25e1('0x48')]);return db[_0x25e1('0x56')][_0x25e1('0x43')](_0x207ef5);}})['then'](function(_0x13424f){if(_0x13424f){return db[_0x25e1('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x13424f,_0x25e1('0x5b')),'role':'agent'},'attributes':['id',_0x25e1('0x2b'),_0x25e1('0x5c'),_0x25e1('0x5d'),'createdAt']});}})[_0x25e1('0x29')](function(_0x21e94f){if(_0x21e94f){return{'count':_0x21e94f[_0x25e1('0x40')],'rows':_[_0x25e1('0x3c')](_0x21e94f[_0x25e1('0x44')],function(_0x444b24){return{'membername':_0x444b24[_0x25e1('0x2b')],'UserId':_0x444b24['id'],'queue_name':_0x4ee11f[_0x25e1('0x2b')],'MailQueueId':_0x4ee11f['id'],'interface':util[_0x25e1('0x5e')](_0x25e1('0x5f'),_0x25e1('0x60'),_0x444b24[_0x25e1('0x2b')]),'penalty':0x0,'paused':_0x444b24[_0x25e1('0x5c')],'createdAt':_0x444b24[_0x25e1('0x61')],'updatedAt':_0x444b24[_0x25e1('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x25e1('0x29')](respondWithFilteredResult(_0x248393,_0x207ef5))[_0x25e1('0x4a')](handleError(_0x248393,null));};exports[_0x25e1('0x62')]=function(_0x28bb75,_0x5b689c,_0x6644c9){var _0x4899d0={};var _0x1cb0d8={};var _0xe7fcdc;var _0x36ce30;return db['MailQueue'][_0x25e1('0x55')]({'where':{'id':_0x28bb75[_0x25e1('0x46')]['id']}})[_0x25e1('0x29')](handleEntityNotFound(_0x5b689c,null))[_0x25e1('0x29')](function(_0xe2ccf9){if(_0xe2ccf9){_0xe7fcdc=_0xe2ccf9;_0x1cb0d8[_0x25e1('0x2e')]=_[_0x25e1('0x2f')](db[_0x25e1('0x63')]['rawAttributes']);_0x1cb0d8[_0x25e1('0x32')]=_[_0x25e1('0x2f')](_0x28bb75[_0x25e1('0x32')]);_0x1cb0d8[_0x25e1('0x30')]=_['intersection'](_0x1cb0d8['model'],_0x1cb0d8[_0x25e1('0x32')]);_0x4899d0[_0x25e1('0x34')]=_['intersection'](_0x1cb0d8['model'],qs[_0x25e1('0x33')](_0x28bb75['query'][_0x25e1('0x33')]));_0x4899d0[_0x25e1('0x34')]=_0x4899d0[_0x25e1('0x34')][_0x25e1('0x57')]?_0x4899d0[_0x25e1('0x34')]:_0x1cb0d8[_0x25e1('0x2e')];_0x4899d0[_0x25e1('0x36')]=qs[_0x25e1('0x37')](_0x28bb75[_0x25e1('0x32')][_0x25e1('0x37')]);_0x4899d0['where']=qs[_0x25e1('0x30')](_[_0x25e1('0x38')](_0x28bb75['query'],_0x1cb0d8[_0x25e1('0x30')]));if(_0x28bb75[_0x25e1('0x32')]['filter']){_0x4899d0[_0x25e1('0x3a')]=_[_0x25e1('0x3b')](_0x4899d0['where'],{'$or':_[_0x25e1('0x3c')](_0x4899d0[_0x25e1('0x34')],function(_0x5377c7){var _0x59ff1d={};_0x59ff1d[_0x5377c7]={'$like':'%'+_0x28bb75[_0x25e1('0x32')]['filter']+'%'};return _0x59ff1d;})});}_0x4899d0=_[_0x25e1('0x3b')]({},_0x4899d0,_0x28bb75[_0x25e1('0x48')]);return _0xe7fcdc[_0x25e1('0x62')](_0x4899d0);}})[_0x25e1('0x29')](function(_0x368b21){if(_0x368b21){_0x36ce30=_0x368b21[_0x25e1('0x57')];if(!_0x28bb75[_0x25e1('0x32')][_0x25e1('0x58')](_0x25e1('0x35'))){_0x4899d0[_0x25e1('0x20')]=qs['limit'](_0x28bb75[_0x25e1('0x32')][_0x25e1('0x20')]);_0x4899d0[_0x25e1('0x1f')]=qs['offset'](_0x28bb75[_0x25e1('0x32')][_0x25e1('0x1f')]);}return _0xe7fcdc[_0x25e1('0x62')](_0x4899d0);}})['then'](function(_0x35420e){if(_0x35420e){return _0x35420e?{'count':_0x36ce30,'rows':_0x35420e}:null;}})[_0x25e1('0x29')](respondWithResult(_0x5b689c,null))[_0x25e1('0x4a')](handleError(_0x5b689c,null));};exports['addTeams']=function(_0x45c361,_0x38665c,_0x467819){var _0x2e4ea6=_0x45c361[_0x25e1('0x4c')][_0x25e1('0x64')];return db[_0x25e1('0x63')][_0x25e1('0x43')]({'where':{'id':_0x2e4ea6},'attributes':['id'],'include':[{'model':db[_0x25e1('0x5a')],'as':_0x25e1('0x65'),'attributes':['id','name',_0x25e1('0x66'),_0x25e1('0x67'),_0x25e1('0x68')],'raw':!![]}]})['then'](function(_0x288a7a){if(_0x288a7a){var _0x3048af=_[_0x25e1('0x69')](_0x288a7a,function(_0x5b8a7c){var _0x4c782e=_0x5b8a7c[_0x25e1('0x27')]({'plain':!![]});return _0x4c782e[_0x25e1('0x65')];});return db['MailQueue'][_0x25e1('0x49')]({'where':{'id':_0x45c361[_0x25e1('0x46')]['id']}})['then'](function(_0x1a723d){return db['sequelize'][_0x25e1('0x6a')](function(_0x143ff9){return _0x1a723d[_0x25e1('0x6b')](_0x2e4ea6,{'transaction':_0x143ff9})[_0x25e1('0x29')](function(){return BPromise[_0x25e1('0x6c')](_0x3048af,function(_0x53a364){return db[_0x25e1('0x56')]['findOrCreate']({'where':{'UserId':_0x53a364['id'],'MailQueueId':_0x45c361[_0x25e1('0x46')]['id']},'transaction':_0x143ff9});});})[_0x25e1('0x29')](function(){_0x3048af[_0x25e1('0x6d')](function(_0x5d2e8b){socket[_0x25e1('0x6e')](_0x25e1('0x6f'),{'UserId':_0x5d2e8b['id'],'MailQueueId':_0x1a723d['id']});});});});});}})[_0x25e1('0x29')](respondWithStatusCode(_0x38665c,null))[_0x25e1('0x4a')](handleError(_0x38665c,null));};exports['removeTeams']=function(_0x112791,_0x30fe93,_0x597aa4){return db['Team'][_0x25e1('0x43')]({'where':{'id':_0x112791[_0x25e1('0x32')][_0x25e1('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x25e1('0x29')](handleEntityNotFound(_0x30fe93,null))[_0x25e1('0x29')](function(_0x207402){var _0x6d8c4d=_[_0x25e1('0x3c')](_0x207402,'id');var _0x174ae2=[];var _0x4cf3b9=[];var _0x2f285d=squel['select']();_0x2f285d['field'](_0x25e1('0x70'))['from'](_0x25e1('0x71'),'tq')[_0x25e1('0x72')]('user_has_teams','ut',_0x25e1('0x73'))[_0x25e1('0x3a')](_0x25e1('0x74'),_0x112791[_0x25e1('0x46')]['id']);for(var _0x2dc349=0x0;_0x2dc349<_0x207402[_0x25e1('0x57')];_0x2dc349+=0x1){let _0x56233f=_0x207402[_0x2dc349];for(var _0x10ec97=0x0;_0x10ec97<_0x56233f[_0x25e1('0x65')]['length'];_0x10ec97+=0x1){let _0x36dfdd=_0x56233f[_0x25e1('0x65')][_0x10ec97];var _0x27301a=_0x2f285d[_0x25e1('0x75')]();_0x27301a[_0x25e1('0x3a')](_0x25e1('0x76'),_0x36dfdd['id']);_0x4cf3b9[_0x25e1('0x77')](db[_0x25e1('0x78')]['query'](_0x27301a[_0x25e1('0x79')](),{'type':db[_0x25e1('0x78')][_0x25e1('0x7a')][_0x25e1('0x7b')]})[_0x25e1('0x29')](function(_0x2cbfba){if(_0x2cbfba[_0x25e1('0x57')]===0x1){return _0x36dfdd['id'];}else{var _0x571e6a=_[_0x25e1('0x7c')](_[_0x25e1('0x3c')](_0x2cbfba,_0x25e1('0x7d')),function(_0x20d95d){return _[_0x25e1('0x7e')](_0x6d8c4d,_0x20d95d);});if(_0x571e6a){return _0x36dfdd['id'];}}}));}}return BPromise[_0x25e1('0x7f')](_0x4cf3b9)[_0x25e1('0x29')](function(_0x1f2885){_0x174ae2=_(_0x174ae2)[_0x25e1('0x80')](_0x1f2885)[_0x25e1('0x81')]()[_0x25e1('0x82')]();return db[_0x25e1('0x2d')][_0x25e1('0x49')]({'where':{'id':_0x112791[_0x25e1('0x46')]['id']}})[_0x25e1('0x29')](function(_0x5a58d4){return db['sequelize'][_0x25e1('0x6a')](function(_0x45b381){return _0x5a58d4[_0x25e1('0x83')](_0x112791[_0x25e1('0x32')]['ids'],{'transaction':_0x45b381})[_0x25e1('0x29')](function(){if(!_[_0x25e1('0x84')](_0x174ae2)){return _0x5a58d4[_0x25e1('0x85')](_0x174ae2,{'transaction':_0x45b381});}})[_0x25e1('0x29')](function(){_0x174ae2[_0x25e1('0x6d')](function(_0x186be1){socket[_0x25e1('0x6e')](_0x25e1('0x86'),{'UserId':_0x186be1,'MailQueueId':_0x5a58d4['id']});});});});});});})['then'](respondWithStatusCode(_0x30fe93,null))['catch'](handleError(_0x30fe93,null));};exports[_0x25e1('0x87')]=function(_0x17396e,_0x178c8c,_0xf507a9){return db[_0x25e1('0x2d')][_0x25e1('0x49')]({'where':{'id':_0x17396e[_0x25e1('0x46')]['id']}})[_0x25e1('0x29')](handleEntityNotFound(_0x178c8c,null))[_0x25e1('0x29')](function(_0x56bc40){if(_0x56bc40){return _0x56bc40[_0x25e1('0x87')](_0x17396e[_0x25e1('0x4c')][_0x25e1('0x64')],_[_0x25e1('0x88')](_0x17396e[_0x25e1('0x4c')],[_0x25e1('0x64'),'id'])||{})['spread'](function(_0x24a5c4){for(var _0x1e2cba=0x0;_0x1e2cba<_0x17396e[_0x25e1('0x4c')][_0x25e1('0x64')]['length'];_0x1e2cba+=0x1){socket[_0x25e1('0x6e')](_0x25e1('0x6f'),{'UserId':_0x17396e[_0x25e1('0x4c')][_0x25e1('0x64')][_0x1e2cba],'MailQueueId':_0x17396e['params']['id']});}return _0x24a5c4;});}})[_0x25e1('0x29')](respondWithResult(_0x178c8c,null))[_0x25e1('0x4a')](handleError(_0x178c8c,null));};exports['removeAgents']=function(_0x5e128f,_0x7fed35,_0x21df57){return db[_0x25e1('0x2d')][_0x25e1('0x49')]({'where':{'id':_0x5e128f[_0x25e1('0x46')]['id']}})[_0x25e1('0x29')](handleEntityNotFound(_0x7fed35,null))['then'](function(_0x6c3232){if(_0x6c3232){return _0x6c3232[_0x25e1('0x85')](_0x5e128f[_0x25e1('0x32')][_0x25e1('0x64')])[_0x25e1('0x29')](function(){if(_['isArray'](_0x5e128f[_0x25e1('0x32')][_0x25e1('0x64')])){for(var _0x46b7ae=0x0;_0x46b7ae<_0x5e128f[_0x25e1('0x32')][_0x25e1('0x64')][_0x25e1('0x57')];_0x46b7ae+=0x1){socket[_0x25e1('0x6e')](_0x25e1('0x86'),{'UserId':Number(_0x5e128f[_0x25e1('0x32')][_0x25e1('0x64')][_0x46b7ae]),'MailQueueId':Number(_0x5e128f[_0x25e1('0x46')]['id'])});}}else{socket[_0x25e1('0x6e')](_0x25e1('0x86'),{'UserId':Number(_0x5e128f[_0x25e1('0x32')][_0x25e1('0x64')]),'MailQueueId':Number(_0x5e128f[_0x25e1('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x7fed35,null))[_0x25e1('0x4a')](handleError(_0x7fed35,null));};exports['getAgents']=function(_0x775f70,_0x1a8a3b,_0x578e65){var _0x54fc2e={};var _0x539f25={};var _0x326cab;var _0x4b75ff;return db[_0x25e1('0x2d')]['findOne']({'where':{'id':_0x775f70['params']['id']}})[_0x25e1('0x29')](handleEntityNotFound(_0x1a8a3b,null))[_0x25e1('0x29')](function(_0x282a20){if(_0x282a20){_0x326cab=_0x282a20;_0x539f25['model']=_['keys'](db[_0x25e1('0x5a')]['rawAttributes']);_0x539f25[_0x25e1('0x32')]=_[_0x25e1('0x2f')](_0x775f70[_0x25e1('0x32')]);_0x539f25[_0x25e1('0x30')]=_[_0x25e1('0x31')](_0x539f25[_0x25e1('0x2e')],_0x539f25['query']);_0x54fc2e['attributes']=_[_0x25e1('0x31')](_0x539f25[_0x25e1('0x2e')],qs['fields'](_0x775f70['query'][_0x25e1('0x33')]));_0x54fc2e[_0x25e1('0x34')]=_0x54fc2e['attributes'][_0x25e1('0x57')]?_0x54fc2e[_0x25e1('0x34')]:_0x539f25['model'];_0x54fc2e[_0x25e1('0x36')]=qs[_0x25e1('0x37')](_0x775f70[_0x25e1('0x32')][_0x25e1('0x37')]);_0x54fc2e[_0x25e1('0x3a')]=qs[_0x25e1('0x30')](_['pick'](_0x775f70[_0x25e1('0x32')],_0x539f25[_0x25e1('0x30')]));if(_0x775f70['query']['filter']){_0x54fc2e[_0x25e1('0x3a')]=_[_0x25e1('0x3b')](_0x54fc2e[_0x25e1('0x3a')],{'$or':_[_0x25e1('0x3c')](_0x54fc2e[_0x25e1('0x34')],function(_0x1b3864){var _0x3b521b={};_0x3b521b[_0x1b3864]={'$like':'%'+_0x775f70['query'][_0x25e1('0x39')]+'%'};return _0x3b521b;})});}_0x54fc2e=_[_0x25e1('0x3b')]({},_0x54fc2e,_0x775f70[_0x25e1('0x48')]);return _0x326cab[_0x25e1('0x89')](_0x54fc2e);}})[_0x25e1('0x29')](function(_0x2473cf){if(_0x2473cf){_0x4b75ff=_0x2473cf[_0x25e1('0x57')];if(!_0x775f70['query'][_0x25e1('0x58')](_0x25e1('0x35'))){_0x54fc2e[_0x25e1('0x20')]=qs[_0x25e1('0x20')](_0x775f70[_0x25e1('0x32')][_0x25e1('0x20')]);_0x54fc2e[_0x25e1('0x1f')]=qs[_0x25e1('0x1f')](_0x775f70[_0x25e1('0x32')][_0x25e1('0x1f')]);}return _0x326cab['getAgents'](_0x54fc2e);}})[_0x25e1('0x29')](function(_0x3dc3a3){if(_0x3dc3a3){return _0x3dc3a3?{'count':_0x4b75ff,'rows':_0x3dc3a3}:null;}})['then'](respondWithResult(_0x1a8a3b,null))[_0x25e1('0x4a')](handleError(_0x1a8a3b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3403314..748339c 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 _0x3727=['MailQueue','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x2b1d7a,_0x1a3366){var _0x53d27f=function(_0x1649eb){while(--_0x1649eb){_0x2b1d7a['push'](_0x2b1d7a['shift']());}};_0x53d27f(++_0x1a3366);}(_0x3727,0x198));var _0x7372=function(_0x2e23db,_0xbdc5cf){_0x2e23db=_0x2e23db-0x0;var _0x5236fe=_0x3727[_0x2e23db];return _0x5236fe;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x7372('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7372('0x1')](0x0);var events={'afterCreate':_0x7372('0x2'),'afterUpdate':_0x7372('0x3'),'afterDestroy':_0x7372('0x4')};function emitEvent(_0x23b4a5){return function(_0x5a16af,_0x2db9c8,_0xa46677){MailQueueEvents['emit'](_0x23b4a5+':'+_0x5a16af['id'],_0x5a16af);MailQueueEvents['emit'](_0x23b4a5,_0x5a16af);_0xa46677(null);};}for(var e in events){if(events[_0x7372('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x0120=['exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x541a8f,_0x169504){var _0x16872f=function(_0x2e8ee9){while(--_0x2e8ee9){_0x541a8f['push'](_0x541a8f['shift']());}};_0x16872f(++_0x169504);}(_0x0120,0x14b));var _0x0012=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0120[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x0012('0x0'));var MailQueue=require(_0x0012('0x1'))['db'][_0x0012('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0012('0x3')](0x0);var events={'afterCreate':_0x0012('0x4'),'afterUpdate':_0x0012('0x5'),'afterDestroy':_0x0012('0x6')};function emitEvent(_0x30298a){return function(_0x142c07,_0x10f2b2,_0x311954){MailQueueEvents[_0x0012('0x7')](_0x30298a+':'+_0x142c07['id'],_0x142c07);MailQueueEvents[_0x0012('0x7')](_0x30298a,_0x142c07);_0x311954(null);};}for(var e in events){if(events[_0x0012('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x0012('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8efe165..345c732 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 _0x6ad2=['api','moment','path','./mailQueue.attributes','exports','define','MailQueue','lodash','../../config/logger'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x6ad2,0x142));var _0x26ad=function(_0xb7bd46,_0x941298){_0xb7bd46=_0xb7bd46-0x0;var _0x2abe45=_0x6ad2[_0xb7bd46];return _0x2abe45;};'use strict';var _=require(_0x26ad('0x0'));var util=require('util');var logger=require(_0x26ad('0x1'))(_0x26ad('0x2'));var moment=require(_0x26ad('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x26ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26ad('0x5'));module[_0x26ad('0x6')]=function(_0x136308,_0x252ac0){return _0x136308[_0x26ad('0x7')](_0x26ad('0x8'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5b1=['define','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x36f8c4,_0x1906b0){var _0x1b6857=function(_0x4d9fd2){while(--_0x4d9fd2){_0x36f8c4['push'](_0x36f8c4['shift']());}};_0x1b6857(++_0x1906b0);}(_0xb5b1,0x1a6));var _0x1b5b=function(_0x31f85c,_0x13dbef){_0x31f85c=_0x31f85c-0x0;var _0x3d057f=_0xb5b1[_0x31f85c];return _0x3d057f;};'use strict';var _=require(_0x1b5b('0x0'));var util=require(_0x1b5b('0x1'));var logger=require(_0x1b5b('0x2'))(_0x1b5b('0x3'));var moment=require(_0x1b5b('0x4'));var BPromise=require(_0x1b5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b5b('0x6'));var rimraf=require(_0x1b5b('0x7'));var config=require(_0x1b5b('0x8'));var attributes=require('./mailQueue.attributes');module[_0x1b5b('0x9')]=function(_0x4173f7,_0x1ccd21){return _0x4173f7[_0x1b5b('0xa')](_0x1b5b('0xb'),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 c1390fd..c20f6cc 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 _0xccf0=['findAll','options','raw','attributes','limit','include','map','model','GetMailQueue','stringify','catch','ShowMailQueue','MailQueue','find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message','result'];(function(_0xa5c505,_0x313bbe){var _0x56fc6c=function(_0x2065f8){while(--_0x2065f8){_0xa5c505['push'](_0xa5c505['shift']());}};_0x56fc6c(++_0x313bbe);}(_0xccf0,0x1bc));var _0x0ccf=function(_0x4241b3,_0x5c08fe){_0x4241b3=_0x4241b3-0x0;var _0xdcfd2=_0xccf0[_0x4241b3];return _0xdcfd2;};'use strict';var _=require(_0x0ccf('0x0'));var util=require(_0x0ccf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0ccf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ccf('0x3'))['db'];var utils=require(_0x0ccf('0x4'));var logger=require(_0x0ccf('0x5'))('rpc');var config=require(_0x0ccf('0x6'));var jayson=require(_0x0ccf('0x7'));var client=jayson['client'][_0x0ccf('0x8')]({'port':0x232a});config[_0x0ccf('0x9')]=_[_0x0ccf('0xa')](config['redis'],{'host':_0x0ccf('0xb'),'port':0x18eb});var socket=require(_0x0ccf('0xc'))(new Redis(config[_0x0ccf('0x9')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x243b25,_0xcdc7f9,_0x4be3b3){return new BPromise(function(_0x2d4f92,_0x3d19e7){return client[_0x0ccf('0xd')](_0x243b25,_0x4be3b3)[_0x0ccf('0xe')](function(_0x5724f1){logger[_0x0ccf('0xf')]('MailQueue,\x20%s,\x20%s',_0xcdc7f9,_0x0ccf('0x10'));logger[_0x0ccf('0x11')](_0x0ccf('0x12'),_0xcdc7f9,_0x0ccf('0x10'),JSON['stringify'](_0x5724f1));if(_0x5724f1[_0x0ccf('0x13')]){if(_0x5724f1[_0x0ccf('0x13')][_0x0ccf('0x14')]===0x1f4){logger[_0x0ccf('0x13')](_0x0ccf('0x15'),_0xcdc7f9,_0x5724f1[_0x0ccf('0x13')][_0x0ccf('0x16')]);return _0x3d19e7(_0x5724f1['error'][_0x0ccf('0x16')]);}logger[_0x0ccf('0x13')](_0x0ccf('0x15'),_0xcdc7f9,_0x5724f1[_0x0ccf('0x13')][_0x0ccf('0x16')]);return _0x2d4f92(_0x5724f1['error'][_0x0ccf('0x16')]);}else{logger['info'](_0x0ccf('0x15'),_0xcdc7f9,_0x0ccf('0x10'));_0x2d4f92(_0x5724f1[_0x0ccf('0x17')][_0x0ccf('0x16')]);}})['catch'](function(_0x19f962){logger[_0x0ccf('0x13')](_0x0ccf('0x15'),_0xcdc7f9,_0x19f962);_0x3d19e7(_0x19f962);});});}exports['GetMailQueue']=function(_0x2c5df6){var _0x46c299=this;return new Promise(function(_0x11fa35,_0x3bc211){return db['MailQueue'][_0x0ccf('0x18')]({'raw':_0x2c5df6[_0x0ccf('0x19')]?_0x2c5df6[_0x0ccf('0x19')][_0x0ccf('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c5df6[_0x0ccf('0x19')]?_0x2c5df6[_0x0ccf('0x19')]['where']||null:null,'attributes':_0x2c5df6[_0x0ccf('0x19')]?_0x2c5df6[_0x0ccf('0x19')][_0x0ccf('0x1b')]||null:null,'limit':_0x2c5df6[_0x0ccf('0x19')]?_0x2c5df6[_0x0ccf('0x19')][_0x0ccf('0x1c')]||null:null,'include':_0x2c5df6['options']?_0x2c5df6['options'][_0x0ccf('0x1d')]?_[_0x0ccf('0x1e')](_0x2c5df6['options'][_0x0ccf('0x1d')],function(_0x25e0b6){return{'model':db[_0x25e0b6[_0x0ccf('0x1f')]],'as':_0x25e0b6['as'],'attributes':_0x25e0b6[_0x0ccf('0x1b')],'include':_0x25e0b6[_0x0ccf('0x1d')]?_[_0x0ccf('0x1e')](_0x25e0b6[_0x0ccf('0x1d')],function(_0x3bc16c){return{'model':db[_0x3bc16c['model']],'as':_0x3bc16c['as'],'attributes':_0x3bc16c[_0x0ccf('0x1b')],'include':_0x3bc16c[_0x0ccf('0x1d')]?_[_0x0ccf('0x1e')](_0x3bc16c[_0x0ccf('0x1d')],function(_0x4ae0af){return{'model':db[_0x4ae0af[_0x0ccf('0x1f')]],'as':_0x4ae0af['as'],'attributes':_0x4ae0af['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ccf('0xe')](function(_0x25a1f9){logger[_0x0ccf('0xf')](_0x0ccf('0x20'),_0x2c5df6);logger[_0x0ccf('0x11')]('GetMailQueue',_0x2c5df6,JSON[_0x0ccf('0x21')](_0x25a1f9));_0x11fa35(_0x25a1f9);})[_0x0ccf('0x22')](function(_0x67c2d7){logger['error'](_0x0ccf('0x20'),_0x67c2d7[_0x0ccf('0x16')],_0x2c5df6);_0x3bc211(_0x46c299[_0x0ccf('0x13')](0x1f4,_0x67c2d7[_0x0ccf('0x16')]));});});};exports[_0x0ccf('0x23')]=function(_0x377567){var _0x104549=this;return new Promise(function(_0x306a32,_0x251647){return db[_0x0ccf('0x24')][_0x0ccf('0x25')]({'raw':_0x377567[_0x0ccf('0x19')]?_0x377567[_0x0ccf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x377567[_0x0ccf('0x19')]?_0x377567[_0x0ccf('0x19')][_0x0ccf('0x26')]||null:null,'attributes':_0x377567[_0x0ccf('0x19')]?_0x377567[_0x0ccf('0x19')]['attributes']||null:null,'include':_0x377567[_0x0ccf('0x19')]?_0x377567[_0x0ccf('0x19')][_0x0ccf('0x1d')]?_[_0x0ccf('0x1e')](_0x377567['options'][_0x0ccf('0x1d')],function(_0x4d4185){return{'model':db[_0x4d4185['model']],'as':_0x4d4185['as'],'attributes':_0x4d4185['attributes'],'include':_0x4d4185[_0x0ccf('0x1d')]?_[_0x0ccf('0x1e')](_0x4d4185[_0x0ccf('0x1d')],function(_0xe74f9e){return{'model':db[_0xe74f9e['model']],'as':_0xe74f9e['as'],'attributes':_0xe74f9e[_0x0ccf('0x1b')],'include':_0xe74f9e['include']?_[_0x0ccf('0x1e')](_0xe74f9e[_0x0ccf('0x1d')],function(_0x7202b9){return{'model':db[_0x7202b9[_0x0ccf('0x1f')]],'as':_0x7202b9['as'],'attributes':_0x7202b9[_0x0ccf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0ccf('0xe')](function(_0x5df6e2){logger[_0x0ccf('0xf')]('ShowMailQueue',_0x377567);logger[_0x0ccf('0x11')](_0x0ccf('0x23'),_0x377567,JSON[_0x0ccf('0x21')](_0x5df6e2));_0x306a32(_0x5df6e2);})[_0x0ccf('0x22')](function(_0x1b7eda){logger[_0x0ccf('0x13')](_0x0ccf('0x23'),_0x1b7eda[_0x0ccf('0x16')],_0x377567);_0x251647(_0x104549[_0x0ccf('0x13')](0x1f4,_0x1b7eda[_0x0ccf('0x16')]));});});}; \ No newline at end of file +var _0x898d=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','info','ShowMailQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x59e1d0,_0x1e10d6){var _0x290073=function(_0x41b9f5){while(--_0x41b9f5){_0x59e1d0['push'](_0x59e1d0['shift']());}};_0x290073(++_0x1e10d6);}(_0x898d,0x73));var _0xd898=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x898d[_0x155c64];return _0x1f154a;};'use strict';var _=require('lodash');var util=require(_0xd898('0x0'));var moment=require('moment');var BPromise=require(_0xd898('0x1'));var rs=require(_0xd898('0x2'));var fs=require('fs');var Redis=require(_0xd898('0x3'));var db=require(_0xd898('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd898('0x5'))(_0xd898('0x6'));var config=require(_0xd898('0x7'));var jayson=require(_0xd898('0x8'));var client=jayson[_0xd898('0x9')][_0xd898('0xa')]({'port':0x232a});config[_0xd898('0xb')]=_[_0xd898('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd898('0xd'))(new Redis(config[_0xd898('0xb')]));require(_0xd898('0xe'))[_0xd898('0xf')](socket);function respondWithRpcPromise(_0x4a17b9,_0xdb0e18,_0x43029e){return new BPromise(function(_0x55de2a,_0x5040ce){return client[_0xd898('0x10')](_0x4a17b9,_0x43029e)[_0xd898('0x11')](function(_0x31967a){logger['info'](_0xd898('0x12'),_0xdb0e18,_0xd898('0x13'));logger[_0xd898('0x14')](_0xd898('0x15'),_0xdb0e18,_0xd898('0x13'),JSON['stringify'](_0x31967a));if(_0x31967a['error']){if(_0x31967a[_0xd898('0x16')][_0xd898('0x17')]===0x1f4){logger[_0xd898('0x16')]('MailQueue,\x20%s,\x20%s',_0xdb0e18,_0x31967a['error']['message']);return _0x5040ce(_0x31967a[_0xd898('0x16')][_0xd898('0x18')]);}logger[_0xd898('0x16')](_0xd898('0x12'),_0xdb0e18,_0x31967a[_0xd898('0x16')]['message']);return _0x55de2a(_0x31967a['error']['message']);}else{logger['info'](_0xd898('0x12'),_0xdb0e18,_0xd898('0x13'));_0x55de2a(_0x31967a['result'][_0xd898('0x18')]);}})[_0xd898('0x19')](function(_0x78bba6){logger[_0xd898('0x16')](_0xd898('0x12'),_0xdb0e18,_0x78bba6);_0x5040ce(_0x78bba6);});});}exports[_0xd898('0x1a')]=function(_0x4f7c52){var _0x5d2b00=this;return new Promise(function(_0x3c6981,_0x42e0bd){return db[_0xd898('0x1b')][_0xd898('0x1c')]({'raw':_0x4f7c52[_0xd898('0x1d')]?_0x4f7c52[_0xd898('0x1d')][_0xd898('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f7c52['options']?_0x4f7c52[_0xd898('0x1d')][_0xd898('0x1f')]||null:null,'attributes':_0x4f7c52[_0xd898('0x1d')]?_0x4f7c52[_0xd898('0x1d')][_0xd898('0x20')]||null:null,'limit':_0x4f7c52[_0xd898('0x1d')]?_0x4f7c52[_0xd898('0x1d')][_0xd898('0x21')]||null:null,'include':_0x4f7c52[_0xd898('0x1d')]?_0x4f7c52['options'][_0xd898('0x22')]?_[_0xd898('0x23')](_0x4f7c52[_0xd898('0x1d')]['include'],function(_0x269c59){return{'model':db[_0x269c59['model']],'as':_0x269c59['as'],'attributes':_0x269c59[_0xd898('0x20')],'include':_0x269c59[_0xd898('0x22')]?_[_0xd898('0x23')](_0x269c59[_0xd898('0x22')],function(_0x5d6d69){return{'model':db[_0x5d6d69['model']],'as':_0x5d6d69['as'],'attributes':_0x5d6d69['attributes'],'include':_0x5d6d69['include']?_[_0xd898('0x23')](_0x5d6d69[_0xd898('0x22')],function(_0x164f0e){return{'model':db[_0x164f0e[_0xd898('0x24')]],'as':_0x164f0e['as'],'attributes':_0x164f0e[_0xd898('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd898('0x11')](function(_0x3c3776){logger['info'](_0xd898('0x1a'),_0x4f7c52);logger['debug'](_0xd898('0x1a'),_0x4f7c52,JSON[_0xd898('0x25')](_0x3c3776));_0x3c6981(_0x3c3776);})[_0xd898('0x19')](function(_0x5c5a35){logger[_0xd898('0x16')](_0xd898('0x1a'),_0x5c5a35['message'],_0x4f7c52);_0x42e0bd(_0x5d2b00[_0xd898('0x16')](0x1f4,_0x5c5a35[_0xd898('0x18')]));});});};exports['ShowMailQueue']=function(_0x4820af){var _0x41d3b3=this;return new Promise(function(_0x5de233,_0x20e9e6){return db[_0xd898('0x1b')][_0xd898('0x26')]({'raw':_0x4820af[_0xd898('0x1d')]?_0x4820af[_0xd898('0x1d')][_0xd898('0x1e')]===undefined?!![]:![]:!![],'where':_0x4820af[_0xd898('0x1d')]?_0x4820af[_0xd898('0x1d')][_0xd898('0x1f')]||null:null,'attributes':_0x4820af[_0xd898('0x1d')]?_0x4820af[_0xd898('0x1d')][_0xd898('0x20')]||null:null,'include':_0x4820af['options']?_0x4820af[_0xd898('0x1d')][_0xd898('0x22')]?_['map'](_0x4820af[_0xd898('0x1d')][_0xd898('0x22')],function(_0x7c9840){return{'model':db[_0x7c9840[_0xd898('0x24')]],'as':_0x7c9840['as'],'attributes':_0x7c9840[_0xd898('0x20')],'include':_0x7c9840[_0xd898('0x22')]?_[_0xd898('0x23')](_0x7c9840[_0xd898('0x22')],function(_0x20e6c8){return{'model':db[_0x20e6c8['model']],'as':_0x20e6c8['as'],'attributes':_0x20e6c8[_0xd898('0x20')],'include':_0x20e6c8[_0xd898('0x22')]?_['map'](_0x20e6c8[_0xd898('0x22')],function(_0x26c148){return{'model':db[_0x26c148[_0xd898('0x24')]],'as':_0x26c148['as'],'attributes':_0x26c148['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5af7fc){logger[_0xd898('0x27')](_0xd898('0x28'),_0x4820af);logger[_0xd898('0x14')]('ShowMailQueue',_0x4820af,JSON[_0xd898('0x25')](_0x5af7fc));_0x5de233(_0x5af7fc);})[_0xd898('0x19')](function(_0x355320){logger[_0xd898('0x16')](_0xd898('0x28'),_0x355320[_0xd898('0x18')],_0x4820af);_0x20e9e6(_0x41d3b3[_0xd898('0x16')](0x1f4,_0x355320[_0xd898('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c506ecc..47424d3 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 _0x68c9=['emit','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0x68c9,0xe4));var _0x968c=function(_0x17b97a,_0xcf4206){_0x17b97a=_0x17b97a-0x0;var _0x4541ee=_0x68c9[_0x17b97a];return _0x4541ee;};'use strict';var MailQueueEvents=require(_0x968c('0x0'));var events=[_0x968c('0x1'),_0x968c('0x2'),_0x968c('0x3')];function createListener(_0x40f22b,_0x15107f){return function(_0x190f88){_0x15107f[_0x968c('0x4')](_0x40f22b,_0x190f88);};}function removeListener(_0x574e3c,_0x13c3d7){return function(){MailQueueEvents['removeListener'](_0x574e3c,_0x13c3d7);};}exports[_0x968c('0x5')]=function(_0x19eb68){for(var _0x34145b=0x0,_0x48d09a=events[_0x968c('0x6')];_0x34145b<_0x48d09a;_0x34145b++){var _0x20be94=events[_0x34145b];var _0x12699c=createListener(_0x968c('0x7')+_0x20be94,_0x19eb68);MailQueueEvents['on'](_0x20be94,_0x12699c);}}; \ No newline at end of file +var _0x262f=['removeListener','register','length','./mailQueue.events','remove','update','emit'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x262f,0x1d1));var _0xf262=function(_0x176867,_0x527724){_0x176867=_0x176867-0x0;var _0x1d1dce=_0x262f[_0x176867];return _0x1d1dce;};'use strict';var MailQueueEvents=require(_0xf262('0x0'));var events=['save',_0xf262('0x1'),_0xf262('0x2')];function createListener(_0x5c25be,_0x4a0aa8){return function(_0x38b07e){_0x4a0aa8[_0xf262('0x3')](_0x5c25be,_0x38b07e);};}function removeListener(_0x1c672f,_0x5076c2){return function(){MailQueueEvents[_0xf262('0x4')](_0x1c672f,_0x5076c2);};}exports[_0xf262('0x5')]=function(_0x28fc95){for(var _0x5ceb27=0x0,_0x41f9a0=events[_0xf262('0x6')];_0x5ceb27<_0x41f9a0;_0x5ceb27++){var _0x253ba5=events[_0x5ceb27];var _0x56df5e=createListener('mailQueue:'+_0x253ba5,_0x28fc95);MailQueueEvents['on'](_0x253ba5,_0x56df5e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d3e4623..b7e0c95 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 _0xe13e=['get','index','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','multer','util','express','Router','./mailQueueReport.controller'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xe13e,0x15b));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee13('0x0'));var util=require(_0xee13('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee13('0x2'));var router=express[_0xee13('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xee13('0x4'));router[_0xee13('0x5')]('/',auth['isAuthenticated'](),controller[_0xee13('0x6')]);router[_0xee13('0x5')]('/describe',auth[_0xee13('0x7')](),controller[_0xee13('0x8')]);router['get'](_0xee13('0x9'),auth[_0xee13('0x7')](),controller[_0xee13('0xa')]);router[_0xee13('0xb')]('/',auth['isAuthenticated'](),controller[_0xee13('0xc')]);router[_0xee13('0xd')](_0xee13('0x9'),auth[_0xee13('0x7')](),controller['update']);router[_0xee13('0xe')]('/:id',auth[_0xee13('0x7')](),controller[_0xee13('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfef1=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x279ab1,_0x527374){var _0x8ba87c=function(_0x2c0898){while(--_0x2c0898){_0x279ab1['push'](_0x279ab1['shift']());}};_0x8ba87c(++_0x527374);}(_0xfef1,0xab));var _0x1fef=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xfef1[_0x37c22c];return _0x119d79;};'use strict';var multer=require('multer');var util=require(_0x1fef('0x0'));var path=require(_0x1fef('0x1'));var timeout=require(_0x1fef('0x2'));var express=require(_0x1fef('0x3'));var router=express['Router']();var auth=require(_0x1fef('0x4'));var interaction=require(_0x1fef('0x5'));var config=require('../../config/environment');var controller=require(_0x1fef('0x6'));router[_0x1fef('0x7')]('/',auth[_0x1fef('0x8')](),controller[_0x1fef('0x9')]);router[_0x1fef('0x7')](_0x1fef('0xa'),auth[_0x1fef('0x8')](),controller[_0x1fef('0xb')]);router[_0x1fef('0x7')](_0x1fef('0xc'),auth[_0x1fef('0x8')](),controller[_0x1fef('0xd')]);router['post']('/',auth[_0x1fef('0x8')](),controller['create']);router[_0x1fef('0xe')](_0x1fef('0xc'),auth[_0x1fef('0x8')](),controller[_0x1fef('0xf')]);router[_0x1fef('0x10')](_0x1fef('0xc'),auth['isAuthenticated'](),controller[_0x1fef('0x11')]);module[_0x1fef('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index fa31865..26774c2 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 _0x50aa=['exports','STRING','DATE','moment','sequelize'];(function(_0x5ea94a,_0x208bbe){var _0x27cece=function(_0x53f0db){while(--_0x53f0db){_0x5ea94a['push'](_0x5ea94a['shift']());}};_0x27cece(++_0x208bbe);}(_0x50aa,0x193));var _0xa50a=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x50aa[_0x457b64];return _0x437111;};'use strict';var moment=require(_0xa50a('0x0'));var Sequelize=require(_0xa50a('0x1'));module[_0xa50a('0x2')]={'uniqueid':{'type':Sequelize[_0xa50a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa50a('0x3')]},'joinAt':{'type':Sequelize[_0xa50a('0x4')]},'leaveAt':{'type':Sequelize[_0xa50a('0x4')]},'acceptAt':{'type':Sequelize[_0xa50a('0x4')]},'exitAt':{'type':Sequelize[_0xa50a('0x4')]},'reason':{'type':Sequelize[_0xa50a('0x3')]}}; \ No newline at end of file +var _0x0961=['exports','STRING','DATE','moment'];(function(_0x534aa2,_0x1f530c){var _0x28d1c2=function(_0x5539c3){while(--_0x5539c3){_0x534aa2['push'](_0x534aa2['shift']());}};_0x28d1c2(++_0x1f530c);}(_0x0961,0x14f));var _0x1096=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x0961[_0xe4bb3d];return _0xd9e51;};'use strict';var moment=require(_0x1096('0x0'));var Sequelize=require('sequelize');module[_0x1096('0x1')]={'uniqueid':{'type':Sequelize[_0x1096('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1096('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 05fb84a..0e96c21 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 _0xa8d2=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','key','field','merge','options','count','includeAll','include','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','MailQueueReport','rawAttributes','keys','query'];(function(_0x2d3acf,_0x254c0e){var _0x268e64=function(_0x40a23f){while(--_0x40a23f){_0x2d3acf['push'](_0x2d3acf['shift']());}};_0x268e64(++_0x254c0e);}(_0xa8d2,0x11d));var _0x2a8d=function(_0xc93c3e,_0x295690){_0xc93c3e=_0xc93c3e-0x0;var _0xc8b94b=_0xa8d2[_0xc93c3e];return _0xc8b94b;};'use strict';var pdf=require(_0x2a8d('0x0'));var emlformat=require(_0x2a8d('0x1'));var rimraf=require(_0x2a8d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a8d('0x3'));var rp=require(_0x2a8d('0x4'));var moment=require('moment');var BPromise=require(_0x2a8d('0x5'));var Mustache=require(_0x2a8d('0x6'));var util=require(_0x2a8d('0x7'));var path=require(_0x2a8d('0x8'));var sox=require(_0x2a8d('0x9'));var csv=require(_0x2a8d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a8d('0xb'));var squel=require(_0x2a8d('0xc'));var crypto=require(_0x2a8d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a8d('0xe'));var Redis=require(_0x2a8d('0xf'));var authService=require(_0x2a8d('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x2a8d('0x11'));var logger=require('../../config/logger')(_0x2a8d('0x12'));var utils=require('../../config/utils');var config=require(_0x2a8d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e3e94,_0xd1c2a9){_0xd1c2a9=_0xd1c2a9||0xcc;return function(_0x376a65){if(_0x376a65){return _0x3e3e94['sendStatus'](_0xd1c2a9);}return _0x3e3e94[_0x2a8d('0x14')](_0xd1c2a9)[_0x2a8d('0x15')]();};}function respondWithResult(_0x281a64,_0x5cc0da){_0x5cc0da=_0x5cc0da||0xc8;return function(_0x4a2679){if(_0x4a2679){return _0x281a64[_0x2a8d('0x14')](_0x5cc0da)[_0x2a8d('0x16')](_0x4a2679);}};}function respondWithFilteredResult(_0x3d88db,_0x16df08){return function(_0x299033){if(_0x299033){var _0x27bf09=_0x299033['count'],_0x2b90ec=_0x16df08[_0x2a8d('0x17')],_0x29054f=_0x16df08[_0x2a8d('0x17')]+_0x16df08[_0x2a8d('0x18')],_0x2d3ab0;if(_0x29054f>=_0x27bf09){_0x29054f=_0x27bf09;_0x2d3ab0=0xc8;}else{_0x2d3ab0=0xce;}_0x3d88db['status'](_0x2d3ab0);return _0x3d88db[_0x2a8d('0x19')](_0x2a8d('0x1a'),_0x2b90ec+'-'+_0x29054f+'/'+_0x27bf09)[_0x2a8d('0x16')](_0x299033);}return null;};}function patchUpdates(_0x2becf3){return function(_0x3a02ee){try{jsonpatch[_0x2a8d('0x1b')](_0x3a02ee,_0x2becf3,!![]);}catch(_0x18afa7){return BPromise[_0x2a8d('0x1c')](_0x18afa7);}return _0x3a02ee[_0x2a8d('0x1d')]();};}function saveUpdates(_0x41956b,_0x5bcdab){return function(_0x2d90ba){if(_0x2d90ba){return _0x2d90ba['update'](_0x41956b)['then'](function(_0x8984a8){return _0x8984a8;});}return null;};}function removeEntity(_0x27ecff,_0x37a4ca){return function(_0x1ab0c0){if(_0x1ab0c0){return _0x1ab0c0[_0x2a8d('0x1e')]()[_0x2a8d('0x1f')](function(){_0x27ecff[_0x2a8d('0x14')](0xcc)[_0x2a8d('0x15')]();});}};}function handleEntityNotFound(_0x52adb6,_0x3d509c){return function(_0x3323b5){if(!_0x3323b5){_0x52adb6[_0x2a8d('0x20')](0x194);}return _0x3323b5;};}function handleError(_0x52702a,_0x3bd81a){_0x3bd81a=_0x3bd81a||0x1f4;return function(_0x57c24a){logger[_0x2a8d('0x21')](_0x57c24a[_0x2a8d('0x22')]);if(_0x57c24a[_0x2a8d('0x23')]){delete _0x57c24a[_0x2a8d('0x23')];}_0x52702a[_0x2a8d('0x14')](_0x3bd81a)['send'](_0x57c24a);};}exports['index']=function(_0x49b2dc,_0x54d3d1){var _0x4af68e={},_0x3c57fb={},_0x2b886e={'count':0x0,'rows':[]};var _0xe4f253=db[_0x2a8d('0x24')][_0x2a8d('0x25')];_0x3c57fb['model']=_[_0x2a8d('0x26')](_0xe4f253);_0x3c57fb[_0x2a8d('0x27')]=_[_0x2a8d('0x26')](_0x49b2dc[_0x2a8d('0x27')]);_0x3c57fb[_0x2a8d('0x28')]=_[_0x2a8d('0x29')](_0x3c57fb[_0x2a8d('0x2a')],_0x3c57fb[_0x2a8d('0x27')]);_0x4af68e[_0x2a8d('0x2b')]=_[_0x2a8d('0x29')](_0x3c57fb[_0x2a8d('0x2a')],qs[_0x2a8d('0x2c')](_0x49b2dc[_0x2a8d('0x27')][_0x2a8d('0x2c')]));_0x4af68e[_0x2a8d('0x2b')]=_0x4af68e[_0x2a8d('0x2b')]['length']?_0x4af68e[_0x2a8d('0x2b')]:_0x3c57fb[_0x2a8d('0x2a')];if(!_0x49b2dc[_0x2a8d('0x27')][_0x2a8d('0x2d')](_0x2a8d('0x2e'))){_0x4af68e['limit']=qs['limit'](_0x49b2dc[_0x2a8d('0x27')][_0x2a8d('0x18')]);_0x4af68e[_0x2a8d('0x17')]=qs['offset'](_0x49b2dc[_0x2a8d('0x27')]['offset']);}_0x4af68e[_0x2a8d('0x2f')]=qs['sort'](_0x49b2dc[_0x2a8d('0x27')]['sort']);_0x4af68e[_0x2a8d('0x30')]=qs[_0x2a8d('0x28')](_[_0x2a8d('0x31')](_0x49b2dc['query'],_0x3c57fb[_0x2a8d('0x28')]));if(_0x49b2dc[_0x2a8d('0x27')][_0x2a8d('0x32')]){_0x4af68e[_0x2a8d('0x30')]=_['merge'](_0x4af68e[_0x2a8d('0x30')],{'$or':_['map'](_0xe4f253,function(_0x19cac9){if(_0x19cac9['type'][_0x2a8d('0x33')]!=='VIRTUAL'){var _0x295293={};_0x295293[_0x19cac9[_0x2a8d('0x34')]]={'$like':'%'+_0x49b2dc[_0x2a8d('0x27')][_0x2a8d('0x32')]+'%'};return _0x295293;}})});}_0x4af68e=_[_0x2a8d('0x35')]({},_0x4af68e,_0x49b2dc[_0x2a8d('0x36')]);var _0x28b466={'where':_0x4af68e[_0x2a8d('0x30')]};return db['MailQueueReport'][_0x2a8d('0x37')](_0x28b466)['then'](function(_0x18c762){_0x2b886e[_0x2a8d('0x37')]=_0x18c762;if(_0x49b2dc[_0x2a8d('0x27')][_0x2a8d('0x38')]){_0x4af68e[_0x2a8d('0x39')]=[{'all':!![]}];}return db[_0x2a8d('0x24')]['findAll'](_0x4af68e);})['then'](function(_0x3d47b9){_0x2b886e['rows']=_0x3d47b9;return _0x2b886e;})[_0x2a8d('0x1f')](respondWithFilteredResult(_0x54d3d1,_0x4af68e))[_0x2a8d('0x3a')](handleError(_0x54d3d1,null));};exports[_0x2a8d('0x3b')]=function(_0x5408a8,_0x3fbb00){var _0x4ad13f={'raw':!![],'where':{'id':_0x5408a8[_0x2a8d('0x3c')]['id']}},_0x388fed={};_0x388fed[_0x2a8d('0x2a')]=_[_0x2a8d('0x26')](db[_0x2a8d('0x24')][_0x2a8d('0x25')]);_0x388fed[_0x2a8d('0x27')]=_[_0x2a8d('0x26')](_0x5408a8[_0x2a8d('0x27')]);_0x388fed[_0x2a8d('0x28')]=_[_0x2a8d('0x29')](_0x388fed[_0x2a8d('0x2a')],_0x388fed[_0x2a8d('0x27')]);_0x4ad13f['attributes']=_[_0x2a8d('0x29')](_0x388fed[_0x2a8d('0x2a')],qs[_0x2a8d('0x2c')](_0x5408a8[_0x2a8d('0x27')]['fields']));_0x4ad13f[_0x2a8d('0x2b')]=_0x4ad13f[_0x2a8d('0x2b')]['length']?_0x4ad13f[_0x2a8d('0x2b')]:_0x388fed[_0x2a8d('0x2a')];if(_0x5408a8['query'][_0x2a8d('0x38')]){_0x4ad13f['include']=[{'all':!![]}];}_0x4ad13f=_[_0x2a8d('0x35')]({},_0x4ad13f,_0x5408a8[_0x2a8d('0x36')]);return db[_0x2a8d('0x24')][_0x2a8d('0x3d')](_0x4ad13f)['then'](handleEntityNotFound(_0x3fbb00,null))[_0x2a8d('0x1f')](respondWithResult(_0x3fbb00,null))[_0x2a8d('0x3a')](handleError(_0x3fbb00,null));};exports['create']=function(_0x5a00ad,_0x320863){return db[_0x2a8d('0x24')][_0x2a8d('0x3e')](_0x5a00ad['body'],{})[_0x2a8d('0x1f')](respondWithResult(_0x320863,0xc9))[_0x2a8d('0x3a')](handleError(_0x320863,null));};exports['update']=function(_0xd08330,_0x3b8570){if(_0xd08330[_0x2a8d('0x3f')]['id']){delete _0xd08330['body']['id'];}return db[_0x2a8d('0x24')][_0x2a8d('0x3d')]({'where':{'id':_0xd08330[_0x2a8d('0x3c')]['id']}})[_0x2a8d('0x1f')](handleEntityNotFound(_0x3b8570,null))['then'](saveUpdates(_0xd08330[_0x2a8d('0x3f')],null))['then'](respondWithResult(_0x3b8570,null))[_0x2a8d('0x3a')](handleError(_0x3b8570,null));};exports[_0x2a8d('0x1e')]=function(_0x33ac41,_0x5a7a7b){return db[_0x2a8d('0x24')][_0x2a8d('0x3d')]({'where':{'id':_0x33ac41[_0x2a8d('0x3c')]['id']}})[_0x2a8d('0x1f')](handleEntityNotFound(_0x5a7a7b,null))['then'](removeEntity(_0x5a7a7b,null))[_0x2a8d('0x3a')](handleError(_0x5a7a7b,null));};exports[_0x2a8d('0x40')]=function(_0x425279,_0x191f3c){return db[_0x2a8d('0x24')][_0x2a8d('0x40')]()[_0x2a8d('0x1f')](respondWithResult(_0x191f3c,null))[_0x2a8d('0x3a')](handleError(_0x191f3c,null));}; \ No newline at end of file +var _0x7081=['reject','save','update','then','destroy','stack','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','options','MailQueueReport','includeAll','include','findAll','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x5d27c3,_0x5ac158){var _0xed73f8=function(_0xc9c3d2){while(--_0xc9c3d2){_0x5d27c3['push'](_0x5d27c3['shift']());}};_0xed73f8(++_0x5ac158);}(_0x7081,0x68));var _0x1708=function(_0x1559a0,_0x9b8fd7){_0x1559a0=_0x1559a0-0x0;var _0x37e36f=_0x7081[_0x1559a0];return _0x37e36f;};'use strict';var pdf=require(_0x1708('0x0'));var emlformat=require(_0x1708('0x1'));var rimraf=require(_0x1708('0x2'));var zipdir=require(_0x1708('0x3'));var jsonpatch=require(_0x1708('0x4'));var rp=require('request-promise');var moment=require(_0x1708('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1708('0x6'));var path=require(_0x1708('0x7'));var sox=require(_0x1708('0x8'));var csv=require('to-csv');var ejs=require(_0x1708('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1708('0xa'));var crypto=require(_0x1708('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1708('0xc'));var Papa=require(_0x1708('0xd'));var Redis=require(_0x1708('0xe'));var authService=require(_0x1708('0xf'));var qs=require(_0x1708('0x10'));var hardwareService=require(_0x1708('0x11'));var logger=require(_0x1708('0x12'))('api');var utils=require(_0x1708('0x13'));var config=require(_0x1708('0x14'));var db=require(_0x1708('0x15'))['db'];function respondWithStatusCode(_0x3a87da,_0x5a11b4){_0x5a11b4=_0x5a11b4||0xcc;return function(_0x1cca05){if(_0x1cca05){return _0x3a87da[_0x1708('0x16')](_0x5a11b4);}return _0x3a87da[_0x1708('0x17')](_0x5a11b4)[_0x1708('0x18')]();};}function respondWithResult(_0x51ceaa,_0x2d4aed){_0x2d4aed=_0x2d4aed||0xc8;return function(_0x2b54fe){if(_0x2b54fe){return _0x51ceaa[_0x1708('0x17')](_0x2d4aed)[_0x1708('0x19')](_0x2b54fe);}};}function respondWithFilteredResult(_0x236a88,_0xc2e087){return function(_0x262fcd){if(_0x262fcd){var _0x4af681=_0x262fcd[_0x1708('0x1a')],_0x55e45c=_0xc2e087['offset'],_0x3febab=_0xc2e087[_0x1708('0x1b')]+_0xc2e087['limit'],_0x1fb1fc;if(_0x3febab>=_0x4af681){_0x3febab=_0x4af681;_0x1fb1fc=0xc8;}else{_0x1fb1fc=0xce;}_0x236a88[_0x1708('0x17')](_0x1fb1fc);return _0x236a88['set']('Content-Range',_0x55e45c+'-'+_0x3febab+'/'+_0x4af681)[_0x1708('0x19')](_0x262fcd);}return null;};}function patchUpdates(_0x722af9){return function(_0xfe741f){try{jsonpatch['apply'](_0xfe741f,_0x722af9,!![]);}catch(_0x1bff8f){return BPromise[_0x1708('0x1c')](_0x1bff8f);}return _0xfe741f[_0x1708('0x1d')]();};}function saveUpdates(_0x3e5847,_0x366d1b){return function(_0x23cd25){if(_0x23cd25){return _0x23cd25[_0x1708('0x1e')](_0x3e5847)[_0x1708('0x1f')](function(_0x37966b){return _0x37966b;});}return null;};}function removeEntity(_0x2b771a,_0x2faf40){return function(_0x400fa1){if(_0x400fa1){return _0x400fa1[_0x1708('0x20')]()[_0x1708('0x1f')](function(){_0x2b771a[_0x1708('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e62c6,_0x4a748c){return function(_0x583d03){if(!_0x583d03){_0x5e62c6[_0x1708('0x16')](0x194);}return _0x583d03;};}function handleError(_0x29ddf3,_0x3ec1d4){_0x3ec1d4=_0x3ec1d4||0x1f4;return function(_0x2d439b){logger['error'](_0x2d439b[_0x1708('0x21')]);if(_0x2d439b['name']){delete _0x2d439b['name'];}_0x29ddf3[_0x1708('0x17')](_0x3ec1d4)['send'](_0x2d439b);};}exports['index']=function(_0x2d8d36,_0x2c0337){var _0x3e0b80={},_0x1f5675={},_0x27b890={'count':0x0,'rows':[]};var _0x598d1f=db['MailQueueReport'][_0x1708('0x22')];_0x1f5675[_0x1708('0x23')]=_['keys'](_0x598d1f);_0x1f5675[_0x1708('0x24')]=_[_0x1708('0x25')](_0x2d8d36[_0x1708('0x24')]);_0x1f5675[_0x1708('0x26')]=_['intersection'](_0x1f5675[_0x1708('0x23')],_0x1f5675[_0x1708('0x24')]);_0x3e0b80[_0x1708('0x27')]=_[_0x1708('0x28')](_0x1f5675[_0x1708('0x23')],qs['fields'](_0x2d8d36[_0x1708('0x24')][_0x1708('0x29')]));_0x3e0b80[_0x1708('0x27')]=_0x3e0b80[_0x1708('0x27')][_0x1708('0x2a')]?_0x3e0b80[_0x1708('0x27')]:_0x1f5675[_0x1708('0x23')];if(!_0x2d8d36[_0x1708('0x24')][_0x1708('0x2b')](_0x1708('0x2c'))){_0x3e0b80[_0x1708('0x2d')]=qs[_0x1708('0x2d')](_0x2d8d36[_0x1708('0x24')][_0x1708('0x2d')]);_0x3e0b80[_0x1708('0x1b')]=qs[_0x1708('0x1b')](_0x2d8d36[_0x1708('0x24')][_0x1708('0x1b')]);}_0x3e0b80[_0x1708('0x2e')]=qs['sort'](_0x2d8d36[_0x1708('0x24')][_0x1708('0x2f')]);_0x3e0b80[_0x1708('0x30')]=qs[_0x1708('0x26')](_[_0x1708('0x31')](_0x2d8d36[_0x1708('0x24')],_0x1f5675[_0x1708('0x26')]));if(_0x2d8d36['query'][_0x1708('0x32')]){_0x3e0b80[_0x1708('0x30')]=_[_0x1708('0x33')](_0x3e0b80[_0x1708('0x30')],{'$or':_['map'](_0x598d1f,function(_0xf816f5){if(_0xf816f5[_0x1708('0x34')][_0x1708('0x35')]!==_0x1708('0x36')){var _0x3554b3={};_0x3554b3[_0xf816f5['field']]={'$like':'%'+_0x2d8d36['query'][_0x1708('0x32')]+'%'};return _0x3554b3;}})});}_0x3e0b80=_[_0x1708('0x33')]({},_0x3e0b80,_0x2d8d36[_0x1708('0x37')]);var _0x5eea9c={'where':_0x3e0b80[_0x1708('0x30')]};return db[_0x1708('0x38')]['count'](_0x5eea9c)[_0x1708('0x1f')](function(_0x3c3abc){_0x27b890[_0x1708('0x1a')]=_0x3c3abc;if(_0x2d8d36[_0x1708('0x24')][_0x1708('0x39')]){_0x3e0b80[_0x1708('0x3a')]=[{'all':!![]}];}return db['MailQueueReport'][_0x1708('0x3b')](_0x3e0b80);})['then'](function(_0x21e5a1){_0x27b890['rows']=_0x21e5a1;return _0x27b890;})['then'](respondWithFilteredResult(_0x2c0337,_0x3e0b80))['catch'](handleError(_0x2c0337,null));};exports['show']=function(_0x2f3390,_0x1ce89d){var _0x9010cb={'raw':!![],'where':{'id':_0x2f3390[_0x1708('0x3c')]['id']}},_0x44f9c2={};_0x44f9c2[_0x1708('0x23')]=_[_0x1708('0x25')](db[_0x1708('0x38')]['rawAttributes']);_0x44f9c2['query']=_[_0x1708('0x25')](_0x2f3390[_0x1708('0x24')]);_0x44f9c2[_0x1708('0x26')]=_[_0x1708('0x28')](_0x44f9c2[_0x1708('0x23')],_0x44f9c2[_0x1708('0x24')]);_0x9010cb[_0x1708('0x27')]=_[_0x1708('0x28')](_0x44f9c2[_0x1708('0x23')],qs[_0x1708('0x29')](_0x2f3390[_0x1708('0x24')]['fields']));_0x9010cb[_0x1708('0x27')]=_0x9010cb['attributes']['length']?_0x9010cb[_0x1708('0x27')]:_0x44f9c2[_0x1708('0x23')];if(_0x2f3390[_0x1708('0x24')][_0x1708('0x39')]){_0x9010cb[_0x1708('0x3a')]=[{'all':!![]}];}_0x9010cb=_['merge']({},_0x9010cb,_0x2f3390[_0x1708('0x37')]);return db[_0x1708('0x38')][_0x1708('0x3d')](_0x9010cb)[_0x1708('0x1f')](handleEntityNotFound(_0x1ce89d,null))['then'](respondWithResult(_0x1ce89d,null))[_0x1708('0x3e')](handleError(_0x1ce89d,null));};exports[_0x1708('0x3f')]=function(_0x46eae6,_0x436514){return db[_0x1708('0x38')]['create'](_0x46eae6[_0x1708('0x40')],{})[_0x1708('0x1f')](respondWithResult(_0x436514,0xc9))[_0x1708('0x3e')](handleError(_0x436514,null));};exports[_0x1708('0x1e')]=function(_0x345d1b,_0x4e85c0){if(_0x345d1b[_0x1708('0x40')]['id']){delete _0x345d1b['body']['id'];}return db[_0x1708('0x38')][_0x1708('0x3d')]({'where':{'id':_0x345d1b['params']['id']}})[_0x1708('0x1f')](handleEntityNotFound(_0x4e85c0,null))['then'](saveUpdates(_0x345d1b[_0x1708('0x40')],null))[_0x1708('0x1f')](respondWithResult(_0x4e85c0,null))[_0x1708('0x3e')](handleError(_0x4e85c0,null));};exports[_0x1708('0x20')]=function(_0x181542,_0x22ca82){return db['MailQueueReport']['find']({'where':{'id':_0x181542[_0x1708('0x3c')]['id']}})[_0x1708('0x1f')](handleEntityNotFound(_0x22ca82,null))['then'](removeEntity(_0x22ca82,null))['catch'](handleError(_0x22ca82,null));};exports['describe']=function(_0x4930c9,_0x312b90){return db['MailQueueReport'][_0x1708('0x41')]()[_0x1708('0x1f')](respondWithResult(_0x312b90,null))['catch'](handleError(_0x312b90,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2ff5363..1682fdb 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 _0x8331=['bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x8331,0x196));var _0x1833=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x8331[_0xc8db6b];return _0x12cb81;};'use strict';var _=require(_0x1833('0x0'));var util=require('util');var logger=require(_0x1833('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1833('0x2'));var rp=require(_0x1833('0x3'));var fs=require('fs');var path=require(_0x1833('0x4'));var rimraf=require(_0x1833('0x5'));var config=require('../../config/environment');var attributes=require(_0x1833('0x6'));module[_0x1833('0x7')]=function(_0x3c202c,_0x1796aa){return _0x3c202c[_0x1833('0x8')](_0x1833('0x9'),attributes,{'tableName':_0x1833('0xa'),'paranoid':![],'indexes':[{'name':_0x1833('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd77a=['bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','report_mail_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xd77a,0x104));var _0xad77=function(_0x465120,_0x196644){_0x465120=_0x465120-0x0;var _0x24ee76=_0xd77a[_0x465120];return _0x24ee76;};'use strict';var _=require(_0xad77('0x0'));var util=require(_0xad77('0x1'));var logger=require(_0xad77('0x2'))(_0xad77('0x3'));var moment=require('moment');var BPromise=require(_0xad77('0x4'));var rp=require(_0xad77('0x5'));var fs=require('fs');var path=require(_0xad77('0x6'));var rimraf=require(_0xad77('0x7'));var config=require('../../config/environment');var attributes=require(_0xad77('0x8'));module['exports']=function(_0x2ada15,_0x16817c){return _0x2ada15['define']('MailQueueReport',attributes,{'tableName':_0xad77('0x9'),'paranoid':![],'indexes':[{'name':_0xad77('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 1ebe304..c0f9ac9 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 _0xfcf0=['MailQueueReport','update','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','CreateMailQueueReport','create','body','options','then','catch','UpdateMailQueueReport'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xfcf0[_0x3e8270];return _0x1ccde9;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['MailQueueReport'][_0x0fcf('0x16')](_0x19cfbd[_0x0fcf('0x17')],{'raw':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0fcf('0x19')](function(_0x13454e){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON['stringify'](_0x13454e));_0x18ea32(_0x13454e);})[_0x0fcf('0x1a')](function(_0x1dafc8){logger[_0x0fcf('0x12')](_0x0fcf('0x15'),_0x1dafc8[_0x0fcf('0x13')],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x1dafc8['message']));});});};exports[_0x0fcf('0x1b')]=function(_0x253641){var _0x6021b4=this;return new Promise(function(_0xd6f8b5,_0x233ac9){return db[_0x0fcf('0x1c')][_0x0fcf('0x1d')](_0x253641[_0x0fcf('0x17')],{'raw':_0x253641[_0x0fcf('0x18')]?_0x253641['options'][_0x0fcf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x253641[_0x0fcf('0x18')]?_0x253641[_0x0fcf('0x18')][_0x0fcf('0x1f')]||null:null,'attributes':_0x253641[_0x0fcf('0x18')]?_0x253641[_0x0fcf('0x18')][_0x0fcf('0x20')]||null:null,'limit':_0x253641['options']?_0x253641[_0x0fcf('0x18')][_0x0fcf('0x21')]||null:null})[_0x0fcf('0x19')](function(_0x35180d){logger['info']('UpdateMailQueueReport',_0x253641);logger['debug'](_0x0fcf('0x1b'),_0x253641,JSON['stringify'](_0x35180d));_0xd6f8b5(_0x35180d);})[_0x0fcf('0x1a')](function(_0x9ccae3){logger['error'](_0x0fcf('0x1b'),_0x9ccae3[_0x0fcf('0x13')],_0x253641);_0x233ac9(_0x6021b4[_0x0fcf('0x12')](0x1f4,_0x9ccae3[_0x0fcf('0x13')]));});});}; \ No newline at end of file +var _0x4137=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','CreateMailQueueReport','create','body','options','then','catch','UpdateMailQueueReport','MailQueueReport','update'];(function(_0x262b56,_0x489281){var _0x106c6e=function(_0x42dd25){while(--_0x42dd25){_0x262b56['push'](_0x262b56['shift']());}};_0x106c6e(++_0x489281);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['MailQueueReport'][_0x7413('0x18')](_0x19157f[_0x7413('0x19')],{'raw':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7413('0x1b')](function(_0x12d94d){logger[_0x7413('0xe')](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON[_0x7413('0x12')](_0x12d94d));_0x2a3417(_0x12d94d);})[_0x7413('0x1c')](function(_0x56a06a){logger['error'](_0x7413('0x17'),_0x56a06a['message'],_0x19157f);_0x26dafe(_0x12a01e[_0x7413('0x13')](0x1f4,_0x56a06a[_0x7413('0x16')]));});});};exports[_0x7413('0x1d')]=function(_0x2fc0f4){var _0x1d46e9=this;return new Promise(function(_0x346ce8,_0x1d97fd){return db[_0x7413('0x1e')][_0x7413('0x1f')](_0x2fc0f4['body'],{'raw':_0x2fc0f4['options']?_0x2fc0f4[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fc0f4[_0x7413('0x1a')]?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x20')]||null:null,'attributes':_0x2fc0f4['options']?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x21')]||null:null,'limit':_0x2fc0f4[_0x7413('0x1a')]?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x22')]||null:null})[_0x7413('0x1b')](function(_0x5eb4d9){logger[_0x7413('0xe')]('UpdateMailQueueReport',_0x2fc0f4);logger[_0x7413('0x10')](_0x7413('0x1d'),_0x2fc0f4,JSON[_0x7413('0x12')](_0x5eb4d9));_0x346ce8(_0x5eb4d9);})[_0x7413('0x1c')](function(_0x25fa52){logger[_0x7413('0x13')]('UpdateMailQueueReport',_0x25fa52[_0x7413('0x16')],_0x2fc0f4);_0x1d97fd(_0x1d46e9[_0x7413('0x13')](0x1f4,_0x25fa52[_0x7413('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 384972d..61b2084 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 _0x17c7=['express','../../components/interaction/service','../../config/environment','multer','path','connect-timeout'];(function(_0x2862b1,_0x2f818c){var _0x1deb09=function(_0x421992){while(--_0x421992){_0x2862b1['push'](_0x2862b1['shift']());}};_0x1deb09(++_0x2f818c);}(_0x17c7,0x117));var _0x717c=function(_0x9dcebf,_0x19de64){_0x9dcebf=_0x9dcebf-0x0;var _0x2cf73e=_0x17c7[_0x9dcebf];return _0x2cf73e;};'use strict';var multer=require(_0x717c('0x0'));var util=require('util');var path=require(_0x717c('0x1'));var timeout=require(_0x717c('0x2'));var express=require(_0x717c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x717c('0x4'));var config=require(_0x717c('0x5'));module['exports']=router; \ No newline at end of file +var _0x2cd9=['../../components/interaction/service','../../config/environment','exports','util','connect-timeout','../../components/auth/service'];(function(_0x14bbd1,_0x4660d6){var _0x43c338=function(_0x25eecf){while(--_0x25eecf){_0x14bbd1['push'](_0x14bbd1['shift']());}};_0x43c338(++_0x4660d6);}(_0x2cd9,0x1e3));var _0x92cd=function(_0x3817ed,_0x49bc38){_0x3817ed=_0x3817ed-0x0;var _0x1cf61f=_0x2cd9[_0x3817ed];return _0x1cf61f;};'use strict';var multer=require('multer');var util=require(_0x92cd('0x0'));var path=require('path');var timeout=require(_0x92cd('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x92cd('0x2'));var interaction=require(_0x92cd('0x3'));var config=require(_0x92cd('0x4'));module[_0x92cd('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 efce62c..03447c9 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 _0xf56f=['exports','STRING','BOOLEAN','username','INTEGER','INBOX'];(function(_0x59f5a5,_0x595f3d){var _0x18249a=function(_0x370503){while(--_0x370503){_0x59f5a5['push'](_0x59f5a5['shift']());}};_0x18249a(++_0x595f3d);}(_0xf56f,0x7e));var _0xff56=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xf56f[_0x1e4150];return _0x1ce3ee;};'use strict';var Sequelize=require('sequelize');module[_0xff56('0x0')]={'description':{'type':Sequelize[_0xff56('0x1')]},'host':{'type':Sequelize[_0xff56('0x1')]},'authentication':{'type':Sequelize[_0xff56('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xff56('0x1')],'unique':_0xff56('0x3')},'password':{'type':Sequelize[_0xff56('0x1')]},'port':{'type':Sequelize[_0xff56('0x4')]},'tls':{'type':Sequelize[_0xff56('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xff56('0x1')],'defaultValue':_0xff56('0x5')},'connTimeout':{'type':Sequelize[_0xff56('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xff56('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xff56('0x1')]}}; \ No newline at end of file +var _0xa368=['STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x156a77,_0x522c13){var _0x32398a=function(_0x55a47a){while(--_0x55a47a){_0x156a77['push'](_0x156a77['shift']());}};_0x32398a(++_0x522c13);}(_0xa368,0x12b));var _0x8a36=function(_0x2f11b4,_0x3ef9ad){_0x2f11b4=_0x2f11b4-0x0;var _0x5e2acb=_0xa368[_0x2f11b4];return _0x5e2acb;};'use strict';var Sequelize=require(_0x8a36('0x0'));module['exports']={'description':{'type':Sequelize[_0x8a36('0x1')]},'host':{'type':Sequelize[_0x8a36('0x1')]},'authentication':{'type':Sequelize[_0x8a36('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8a36('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x8a36('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x8a36('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8a36('0x1')],'defaultValue':_0x8a36('0x3')},'connTimeout':{'type':Sequelize[_0x8a36('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8a36('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2d92315..e0872fd 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 _0x9861=['MailServerIn','mail_servers_in','lodash','api','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports','define'];(function(_0x297b5a,_0x5b36bb){var _0x3c7ebd=function(_0x541fab){while(--_0x541fab){_0x297b5a['push'](_0x297b5a['shift']());}};_0x3c7ebd(++_0x5b36bb);}(_0x9861,0x176));var _0x1986=function(_0x1f7222,_0x5cf814){_0x1f7222=_0x1f7222-0x0;var _0x510a31=_0x9861[_0x1f7222];return _0x510a31;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d3=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x01d3,0xa2));var _0x301d=function(_0x128664,_0x1c9225){_0x128664=_0x128664-0x0;var _0x4e7bd9=_0x01d3[_0x128664];return _0x4e7bd9;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var logger=require(_0x301d('0x2'))(_0x301d('0x3'));var moment=require('moment');var BPromise=require(_0x301d('0x4'));var rp=require(_0x301d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x301d('0x6'));var config=require(_0x301d('0x7'));var attributes=require(_0x301d('0x8'));module[_0x301d('0x9')]=function(_0x5d1462,_0x318074){return _0x5d1462[_0x301d('0xa')](_0x301d('0xb'),attributes,{'tableName':_0x301d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 9721eb7..b48ae68 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 _0xa673=['attributes','limit','map','include','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where'];(function(_0xdc34d8,_0x176848){var _0xada5cd=function(_0x4f3643){while(--_0x4f3643){_0xdc34d8['push'](_0xdc34d8['shift']());}};_0xada5cd(++_0x176848);}(_0xa673,0x17b));var _0x3a67=function(_0x38bb06,_0x3561d8){_0x38bb06=_0x38bb06-0x0;var _0x189afd=_0xa673[_0x38bb06];return _0x189afd;};'use strict';var _=require(_0x3a67('0x0'));var util=require(_0x3a67('0x1'));var moment=require(_0x3a67('0x2'));var BPromise=require(_0x3a67('0x3'));var rs=require(_0x3a67('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a67('0x5'))['db'];var utils=require(_0x3a67('0x6'));var logger=require(_0x3a67('0x7'))('rpc');var config=require(_0x3a67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a67('0x9')][_0x3a67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ebb80,_0x4cfa1c,_0x360452){return new BPromise(function(_0x4ad037,_0x4606e0){return client[_0x3a67('0xb')](_0x5ebb80,_0x360452)[_0x3a67('0xc')](function(_0x5b9382){logger['info'](_0x3a67('0xd'),_0x4cfa1c,_0x3a67('0xe'));logger[_0x3a67('0xf')](_0x3a67('0x10'),_0x4cfa1c,_0x3a67('0xe'),JSON[_0x3a67('0x11')](_0x5b9382));if(_0x5b9382['error']){if(_0x5b9382['error'][_0x3a67('0x12')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x4cfa1c,_0x5b9382[_0x3a67('0x13')][_0x3a67('0x14')]);return _0x4606e0(_0x5b9382['error'][_0x3a67('0x14')]);}logger['error'](_0x3a67('0xd'),_0x4cfa1c,_0x5b9382[_0x3a67('0x13')][_0x3a67('0x14')]);return _0x4ad037(_0x5b9382['error'][_0x3a67('0x14')]);}else{logger[_0x3a67('0x15')](_0x3a67('0xd'),_0x4cfa1c,_0x3a67('0xe'));_0x4ad037(_0x5b9382['result']['message']);}})[_0x3a67('0x16')](function(_0x2a930a){logger[_0x3a67('0x13')](_0x3a67('0xd'),_0x4cfa1c,_0x2a930a);_0x4606e0(_0x2a930a);});});}exports[_0x3a67('0x17')]=function(_0x14bd27){var _0x3a8ac5=this;return new Promise(function(_0x11ff72,_0x1b7403){return db[_0x3a67('0x18')][_0x3a67('0x19')]({'raw':_0x14bd27[_0x3a67('0x1a')]?_0x14bd27[_0x3a67('0x1a')][_0x3a67('0x1b')]===undefined?!![]:![]:!![],'where':_0x14bd27[_0x3a67('0x1a')]?_0x14bd27[_0x3a67('0x1a')][_0x3a67('0x1c')]||null:null,'attributes':_0x14bd27['options']?_0x14bd27[_0x3a67('0x1a')][_0x3a67('0x1d')]||null:null,'limit':_0x14bd27[_0x3a67('0x1a')]?_0x14bd27[_0x3a67('0x1a')][_0x3a67('0x1e')]||null:null,'include':_0x14bd27['options']?_0x14bd27[_0x3a67('0x1a')]['include']?_[_0x3a67('0x1f')](_0x14bd27[_0x3a67('0x1a')][_0x3a67('0x20')],function(_0x20472f){return{'model':db[_0x20472f[_0x3a67('0x21')]],'as':_0x20472f['as'],'attributes':_0x20472f[_0x3a67('0x1d')],'include':_0x20472f[_0x3a67('0x20')]?_['map'](_0x20472f[_0x3a67('0x20')],function(_0x3f265f){return{'model':db[_0x3f265f['model']],'as':_0x3f265f['as'],'attributes':_0x3f265f['attributes'],'include':_0x3f265f['include']?_[_0x3a67('0x1f')](_0x3f265f[_0x3a67('0x20')],function(_0x2a3182){return{'model':db[_0x2a3182[_0x3a67('0x21')]],'as':_0x2a3182['as'],'attributes':_0x2a3182[_0x3a67('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4992c0){logger[_0x3a67('0x15')]('GetMailServerIn',_0x14bd27);logger['debug'](_0x3a67('0x17'),_0x14bd27,JSON['stringify'](_0x4992c0));_0x11ff72(_0x4992c0);})['catch'](function(_0x2b72ad){logger['error'](_0x3a67('0x17'),_0x2b72ad['message'],_0x14bd27);_0x1b7403(_0x3a8ac5[_0x3a67('0x13')](0x1f4,_0x2b72ad[_0x3a67('0x14')]));});});}; \ No newline at end of file +var _0x28ee=['rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x28ee,0x13c));var _0xe28e=function(_0x4c6ad2,_0x51092b){_0x4c6ad2=_0x4c6ad2-0x0;var _0x215c13=_0x28ee[_0x4c6ad2];return _0x215c13;};'use strict';var _=require(_0xe28e('0x0'));var util=require(_0xe28e('0x1'));var moment=require(_0xe28e('0x2'));var BPromise=require(_0xe28e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe28e('0x4'));var db=require(_0xe28e('0x5'))['db'];var utils=require(_0xe28e('0x6'));var logger=require(_0xe28e('0x7'))(_0xe28e('0x8'));var config=require(_0xe28e('0x9'));var jayson=require(_0xe28e('0xa'));var client=jayson[_0xe28e('0xb')][_0xe28e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bef22,_0x4eac52,_0xc6f861){return new BPromise(function(_0x37f600,_0x307fd9){return client[_0xe28e('0xd')](_0x2bef22,_0xc6f861)['then'](function(_0x3458b4){logger[_0xe28e('0xe')](_0xe28e('0xf'),_0x4eac52,_0xe28e('0x10'));logger[_0xe28e('0x11')](_0xe28e('0x12'),_0x4eac52,_0xe28e('0x10'),JSON['stringify'](_0x3458b4));if(_0x3458b4[_0xe28e('0x13')]){if(_0x3458b4[_0xe28e('0x13')]['code']===0x1f4){logger[_0xe28e('0x13')](_0xe28e('0xf'),_0x4eac52,_0x3458b4[_0xe28e('0x13')][_0xe28e('0x14')]);return _0x307fd9(_0x3458b4[_0xe28e('0x13')][_0xe28e('0x14')]);}logger[_0xe28e('0x13')](_0xe28e('0xf'),_0x4eac52,_0x3458b4[_0xe28e('0x13')][_0xe28e('0x14')]);return _0x37f600(_0x3458b4[_0xe28e('0x13')]['message']);}else{logger[_0xe28e('0xe')]('MailServerIn,\x20%s,\x20%s',_0x4eac52,_0xe28e('0x10'));_0x37f600(_0x3458b4[_0xe28e('0x15')][_0xe28e('0x14')]);}})[_0xe28e('0x16')](function(_0x1e1ad4){logger[_0xe28e('0x13')]('MailServerIn,\x20%s,\x20%s',_0x4eac52,_0x1e1ad4);_0x307fd9(_0x1e1ad4);});});}exports[_0xe28e('0x17')]=function(_0x4a01f8){var _0x47e64c=this;return new Promise(function(_0x2ad11e,_0xc2ee9){return db[_0xe28e('0x18')][_0xe28e('0x19')]({'raw':_0x4a01f8[_0xe28e('0x1a')]?_0x4a01f8['options'][_0xe28e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a01f8[_0xe28e('0x1a')]?_0x4a01f8['options'][_0xe28e('0x1c')]||null:null,'attributes':_0x4a01f8[_0xe28e('0x1a')]?_0x4a01f8[_0xe28e('0x1a')][_0xe28e('0x1d')]||null:null,'limit':_0x4a01f8[_0xe28e('0x1a')]?_0x4a01f8[_0xe28e('0x1a')][_0xe28e('0x1e')]||null:null,'include':_0x4a01f8[_0xe28e('0x1a')]?_0x4a01f8[_0xe28e('0x1a')][_0xe28e('0x1f')]?_['map'](_0x4a01f8[_0xe28e('0x1a')][_0xe28e('0x1f')],function(_0x4d688f){return{'model':db[_0x4d688f['model']],'as':_0x4d688f['as'],'attributes':_0x4d688f[_0xe28e('0x1d')],'include':_0x4d688f['include']?_['map'](_0x4d688f[_0xe28e('0x1f')],function(_0x413b8b){return{'model':db[_0x413b8b[_0xe28e('0x20')]],'as':_0x413b8b['as'],'attributes':_0x413b8b[_0xe28e('0x1d')],'include':_0x413b8b['include']?_[_0xe28e('0x21')](_0x413b8b[_0xe28e('0x1f')],function(_0x1a1ac7){return{'model':db[_0x1a1ac7['model']],'as':_0x1a1ac7['as'],'attributes':_0x1a1ac7[_0xe28e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe28e('0x22')](function(_0x261856){logger[_0xe28e('0xe')](_0xe28e('0x17'),_0x4a01f8);logger['debug'](_0xe28e('0x17'),_0x4a01f8,JSON[_0xe28e('0x23')](_0x261856));_0x2ad11e(_0x261856);})[_0xe28e('0x16')](function(_0x3e98fe){logger['error'](_0xe28e('0x17'),_0x3e98fe[_0xe28e('0x14')],_0x4a01f8);_0xc2ee9(_0x47e64c[_0xe28e('0x13')](0x1f4,_0x3e98fe[_0xe28e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c073df6..d056a71 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 _0xd7b3=['show','post','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x4b4987,_0x3d34e1){var _0x2488d2=function(_0xec1417){while(--_0xec1417){_0x4b4987['push'](_0x4b4987['shift']());}};_0x2488d2(++_0x3d34e1);}(_0xd7b3,0x15c));var _0x3d7b=function(_0x591db7,_0x150445){_0x591db7=_0x591db7-0x0;var _0x4ad760=_0xd7b3[_0x591db7];return _0x4ad760;};'use strict';var multer=require(_0x3d7b('0x0'));var util=require(_0x3d7b('0x1'));var path=require(_0x3d7b('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d7b('0x3'));var router=express[_0x3d7b('0x4')]();var auth=require(_0x3d7b('0x5'));var interaction=require(_0x3d7b('0x6'));var config=require(_0x3d7b('0x7'));var controller=require('./mailServerOut.controller');router[_0x3d7b('0x8')]('/',auth['isAuthenticated'](),controller[_0x3d7b('0x9')]);router[_0x3d7b('0x8')](_0x3d7b('0xa'),auth[_0x3d7b('0xb')](),controller[_0x3d7b('0xc')]);router[_0x3d7b('0xd')]('/',auth[_0x3d7b('0xb')](),controller['create']);router['put'](_0x3d7b('0xa'),auth['isAuthenticated'](),controller[_0x3d7b('0xe')]);router[_0x3d7b('0xf')](_0x3d7b('0xa'),auth[_0x3d7b('0xb')](),controller[_0x3d7b('0x10')]);module[_0x3d7b('0x11')]=router; \ No newline at end of file +var _0x533f=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id'];(function(_0x3bc47a,_0xeb4400){var _0x4b542f=function(_0x8e2d6a){while(--_0x8e2d6a){_0x3bc47a['push'](_0x3bc47a['shift']());}};_0x4b542f(++_0xeb4400);}(_0x533f,0x1ac));var _0xf533=function(_0x4e0359,_0x205155){_0x4e0359=_0x4e0359-0x0;var _0x450f0a=_0x533f[_0x4e0359];return _0x450f0a;};'use strict';var multer=require(_0xf533('0x0'));var util=require(_0xf533('0x1'));var path=require(_0xf533('0x2'));var timeout=require('connect-timeout');var express=require(_0xf533('0x3'));var router=express[_0xf533('0x4')]();var auth=require(_0xf533('0x5'));var interaction=require(_0xf533('0x6'));var config=require(_0xf533('0x7'));var controller=require(_0xf533('0x8'));router[_0xf533('0x9')]('/',auth[_0xf533('0xa')](),controller[_0xf533('0xb')]);router['get'](_0xf533('0xc'),auth[_0xf533('0xa')](),controller[_0xf533('0xd')]);router[_0xf533('0xe')]('/',auth['isAuthenticated'](),controller[_0xf533('0xf')]);router[_0xf533('0x10')](_0xf533('0xc'),auth[_0xf533('0xa')](),controller[_0xf533('0x11')]);router[_0xf533('0x12')](_0xf533('0xc'),auth[_0xf533('0xa')](),controller[_0xf533('0x13')]);module[_0xf533('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 015cfaa..22633e4 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 _0x543b=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb543('0x0'));module[_0xb543('0x1')]={'description':{'type':Sequelize[_0xb543('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xb543('0x2')]},'pass':{'type':Sequelize[_0xb543('0x2')]},'port':{'type':Sequelize[_0xb543('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xb543('0x2')]},'authentication':{'type':Sequelize[_0xb543('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7b84,0x17c));var _0x47b8=function(_0x4048a1,_0x29a3b2){_0x4048a1=_0x4048a1-0x0;var _0x37adb3=_0x7b84[_0x4048a1];return _0x37adb3;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'description':{'type':Sequelize[_0x47b8('0x2')]},'host':{'type':Sequelize[_0x47b8('0x2')]},'user':{'type':Sequelize[_0x47b8('0x2')]},'pass':{'type':Sequelize[_0x47b8('0x2')]},'port':{'type':Sequelize[_0x47b8('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x47b8('0x2')]},'authentication':{'type':Sequelize[_0x47b8('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 47237c1..a7e4fcc 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 _0xc592=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','key','VIRTUAL','MailServerOut','count','includeAll','include','findAll','catch','params','options','find','create','body','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel'];(function(_0x34f270,_0x26851b){var _0x172825=function(_0x12b1a1){while(--_0x12b1a1){_0x34f270['push'](_0x34f270['shift']());}};_0x172825(++_0x26851b);}(_0xc592,0x18c));var _0x2c59=function(_0xd8021e,_0x3a243b){_0xd8021e=_0xd8021e-0x0;var _0x441967=_0xc592[_0xd8021e];return _0x441967;};'use strict';var pdf=require(_0x2c59('0x0'));var emlformat=require(_0x2c59('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2c59('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c59('0x3'));var moment=require(_0x2c59('0x4'));var BPromise=require(_0x2c59('0x5'));var Mustache=require(_0x2c59('0x6'));var util=require(_0x2c59('0x7'));var path=require(_0x2c59('0x8'));var sox=require('sox');var csv=require(_0x2c59('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c59('0xa'));var squel=require(_0x2c59('0xb'));var crypto=require(_0x2c59('0xc'));var jsforce=require(_0x2c59('0xd'));var deskjs=require(_0x2c59('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2c59('0xf'));var Redis=require(_0x2c59('0x10'));var authService=require(_0x2c59('0x11'));var qs=require(_0x2c59('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c59('0x13'))(_0x2c59('0x14'));var utils=require('../../config/utils');var config=require(_0x2c59('0x15'));var db=require(_0x2c59('0x16'))['db'];function respondWithStatusCode(_0xe5641f,_0x2e181e){_0x2e181e=_0x2e181e||0xcc;return function(_0x14f73d){if(_0x14f73d){return _0xe5641f['sendStatus'](_0x2e181e);}return _0xe5641f['status'](_0x2e181e)[_0x2c59('0x17')]();};}function respondWithResult(_0x575534,_0x355316){_0x355316=_0x355316||0xc8;return function(_0x3d7710){if(_0x3d7710){return _0x575534[_0x2c59('0x18')](_0x355316)[_0x2c59('0x19')](_0x3d7710);}};}function respondWithFilteredResult(_0x48ba4b,_0x325e5b){return function(_0x1c5a6e){if(_0x1c5a6e){var _0x14bdb9=_0x1c5a6e['count'],_0xb6ff7a=_0x325e5b[_0x2c59('0x1a')],_0x30036a=_0x325e5b[_0x2c59('0x1a')]+_0x325e5b[_0x2c59('0x1b')],_0x15ab47;if(_0x30036a>=_0x14bdb9){_0x30036a=_0x14bdb9;_0x15ab47=0xc8;}else{_0x15ab47=0xce;}_0x48ba4b[_0x2c59('0x18')](_0x15ab47);return _0x48ba4b['set'](_0x2c59('0x1c'),_0xb6ff7a+'-'+_0x30036a+'/'+_0x14bdb9)[_0x2c59('0x19')](_0x1c5a6e);}return null;};}function patchUpdates(_0x28df72){return function(_0x2f958f){try{jsonpatch[_0x2c59('0x1d')](_0x2f958f,_0x28df72,!![]);}catch(_0x1ad12b){return BPromise[_0x2c59('0x1e')](_0x1ad12b);}return _0x2f958f[_0x2c59('0x1f')]();};}function saveUpdates(_0x280a3d,_0x4a142e){return function(_0x1ef071){if(_0x1ef071){return _0x1ef071[_0x2c59('0x20')](_0x280a3d)[_0x2c59('0x21')](function(_0x15598a){return _0x15598a;});}return null;};}function removeEntity(_0x1e0f3c,_0x721825){return function(_0x35825c){if(_0x35825c){return _0x35825c['destroy']()[_0x2c59('0x21')](function(){_0x1e0f3c[_0x2c59('0x18')](0xcc)[_0x2c59('0x17')]();});}};}function handleEntityNotFound(_0x1d42b3,_0x4ddb97){return function(_0x6e653d){if(!_0x6e653d){_0x1d42b3['sendStatus'](0x194);}return _0x6e653d;};}function handleError(_0x4a09c3,_0x45cb05){_0x45cb05=_0x45cb05||0x1f4;return function(_0x340936){logger[_0x2c59('0x22')](_0x340936[_0x2c59('0x23')]);if(_0x340936['name']){delete _0x340936[_0x2c59('0x24')];}_0x4a09c3[_0x2c59('0x18')](_0x45cb05)[_0x2c59('0x25')](_0x340936);};}exports['index']=function(_0x33b8f3,_0x35a2e8){var _0x3a0333={},_0x12fb73={},_0x2b1709={'count':0x0,'rows':[]};var _0x3d5a67=db['MailServerOut'][_0x2c59('0x26')];_0x12fb73[_0x2c59('0x27')]=_[_0x2c59('0x28')](_0x3d5a67);_0x12fb73[_0x2c59('0x29')]=_[_0x2c59('0x28')](_0x33b8f3[_0x2c59('0x29')]);_0x12fb73[_0x2c59('0x2a')]=_[_0x2c59('0x2b')](_0x12fb73[_0x2c59('0x27')],_0x12fb73[_0x2c59('0x29')]);_0x3a0333[_0x2c59('0x2c')]=_[_0x2c59('0x2b')](_0x12fb73[_0x2c59('0x27')],qs[_0x2c59('0x2d')](_0x33b8f3['query'][_0x2c59('0x2d')]));_0x3a0333[_0x2c59('0x2c')]=_0x3a0333['attributes'][_0x2c59('0x2e')]?_0x3a0333[_0x2c59('0x2c')]:_0x12fb73['model'];if(!_0x33b8f3[_0x2c59('0x29')][_0x2c59('0x2f')](_0x2c59('0x30'))){_0x3a0333[_0x2c59('0x1b')]=qs[_0x2c59('0x1b')](_0x33b8f3[_0x2c59('0x29')]['limit']);_0x3a0333[_0x2c59('0x1a')]=qs['offset'](_0x33b8f3[_0x2c59('0x29')][_0x2c59('0x1a')]);}_0x3a0333[_0x2c59('0x31')]=qs[_0x2c59('0x32')](_0x33b8f3[_0x2c59('0x29')][_0x2c59('0x32')]);_0x3a0333['where']=qs[_0x2c59('0x2a')](_[_0x2c59('0x33')](_0x33b8f3['query'],_0x12fb73[_0x2c59('0x2a')]));if(_0x33b8f3[_0x2c59('0x29')][_0x2c59('0x34')]){_0x3a0333[_0x2c59('0x35')]=_[_0x2c59('0x36')](_0x3a0333['where'],{'$or':_['map'](_0x3d5a67,function(_0x11fd44){if(_0x11fd44['type'][_0x2c59('0x37')]!==_0x2c59('0x38')){var _0x4524d7={};_0x4524d7[_0x11fd44['field']]={'$like':'%'+_0x33b8f3[_0x2c59('0x29')][_0x2c59('0x34')]+'%'};return _0x4524d7;}})});}_0x3a0333=_[_0x2c59('0x36')]({},_0x3a0333,_0x33b8f3['options']);var _0x557c89={'where':_0x3a0333[_0x2c59('0x35')]};return db[_0x2c59('0x39')]['count'](_0x557c89)[_0x2c59('0x21')](function(_0x3094df){_0x2b1709[_0x2c59('0x3a')]=_0x3094df;if(_0x33b8f3[_0x2c59('0x29')][_0x2c59('0x3b')]){_0x3a0333[_0x2c59('0x3c')]=[{'all':!![]}];}return db[_0x2c59('0x39')][_0x2c59('0x3d')](_0x3a0333);})[_0x2c59('0x21')](function(_0x3e5e83){_0x2b1709['rows']=_0x3e5e83;return _0x2b1709;})[_0x2c59('0x21')](respondWithFilteredResult(_0x35a2e8,_0x3a0333))[_0x2c59('0x3e')](handleError(_0x35a2e8,null));};exports['show']=function(_0x2d734b,_0x1034ec){var _0x49bec4={'raw':!![],'where':{'id':_0x2d734b[_0x2c59('0x3f')]['id']}},_0xf6c60e={};_0xf6c60e[_0x2c59('0x27')]=_[_0x2c59('0x28')](db[_0x2c59('0x39')][_0x2c59('0x26')]);_0xf6c60e[_0x2c59('0x29')]=_[_0x2c59('0x28')](_0x2d734b[_0x2c59('0x29')]);_0xf6c60e[_0x2c59('0x2a')]=_[_0x2c59('0x2b')](_0xf6c60e['model'],_0xf6c60e['query']);_0x49bec4['attributes']=_[_0x2c59('0x2b')](_0xf6c60e[_0x2c59('0x27')],qs[_0x2c59('0x2d')](_0x2d734b[_0x2c59('0x29')][_0x2c59('0x2d')]));_0x49bec4[_0x2c59('0x2c')]=_0x49bec4[_0x2c59('0x2c')][_0x2c59('0x2e')]?_0x49bec4['attributes']:_0xf6c60e['model'];if(_0x2d734b[_0x2c59('0x29')][_0x2c59('0x3b')]){_0x49bec4[_0x2c59('0x3c')]=[{'all':!![]}];}_0x49bec4=_[_0x2c59('0x36')]({},_0x49bec4,_0x2d734b[_0x2c59('0x40')]);return db['MailServerOut'][_0x2c59('0x41')](_0x49bec4)[_0x2c59('0x21')](handleEntityNotFound(_0x1034ec,null))[_0x2c59('0x21')](respondWithResult(_0x1034ec,null))['catch'](handleError(_0x1034ec,null));};exports['create']=function(_0x45a132,_0x33e3c4){return db[_0x2c59('0x39')][_0x2c59('0x42')](_0x45a132[_0x2c59('0x43')],{})[_0x2c59('0x21')](respondWithResult(_0x33e3c4,0xc9))[_0x2c59('0x3e')](handleError(_0x33e3c4,null));};exports[_0x2c59('0x20')]=function(_0x536b6d,_0x478f5d){if(_0x536b6d[_0x2c59('0x43')]['id']){delete _0x536b6d['body']['id'];}return db['MailServerOut'][_0x2c59('0x41')]({'where':{'id':_0x536b6d['params']['id']}})['then'](handleEntityNotFound(_0x478f5d,null))[_0x2c59('0x21')](saveUpdates(_0x536b6d['body'],null))[_0x2c59('0x21')](respondWithResult(_0x478f5d,null))[_0x2c59('0x3e')](handleError(_0x478f5d,null));};exports['destroy']=function(_0x1d2f74,_0x37020c){return db[_0x2c59('0x39')][_0x2c59('0x41')]({'where':{'id':_0x1d2f74['params']['id']}})[_0x2c59('0x21')](handleEntityNotFound(_0x37020c,null))[_0x2c59('0x21')](removeEntity(_0x37020c,null))[_0x2c59('0x3e')](handleError(_0x37020c,null));}; \ No newline at end of file +var _0x38c7=['sendStatus','status','end','count','offset','json','apply','reject','save','update','destroy','then','error','name','send','MailServerOut','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','merge','where','type','key','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0x38c7,0x111));var _0x738c=function(_0x518576,_0x3624fc){_0x518576=_0x518576-0x0;var _0xbf4d12=_0x38c7[_0x518576];return _0xbf4d12;};'use strict';var pdf=require(_0x738c('0x0'));var emlformat=require(_0x738c('0x1'));var rimraf=require(_0x738c('0x2'));var zipdir=require(_0x738c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x738c('0x4'));var moment=require(_0x738c('0x5'));var BPromise=require(_0x738c('0x6'));var Mustache=require(_0x738c('0x7'));var util=require(_0x738c('0x8'));var path=require(_0x738c('0x9'));var sox=require(_0x738c('0xa'));var csv=require(_0x738c('0xb'));var ejs=require(_0x738c('0xc'));var fs=require('fs');var _=require(_0x738c('0xd'));var squel=require(_0x738c('0xe'));var crypto=require(_0x738c('0xf'));var jsforce=require(_0x738c('0x10'));var deskjs=require(_0x738c('0x11'));var toCsv=require(_0x738c('0xb'));var querystring=require(_0x738c('0x12'));var Papa=require(_0x738c('0x13'));var Redis=require('ioredis');var authService=require(_0x738c('0x14'));var qs=require(_0x738c('0x15'));var hardwareService=require(_0x738c('0x16'));var logger=require(_0x738c('0x17'))('api');var utils=require(_0x738c('0x18'));var config=require(_0x738c('0x19'));var db=require(_0x738c('0x1a'))['db'];function respondWithStatusCode(_0x39f943,_0x5d913f){_0x5d913f=_0x5d913f||0xcc;return function(_0x4a3766){if(_0x4a3766){return _0x39f943[_0x738c('0x1b')](_0x5d913f);}return _0x39f943[_0x738c('0x1c')](_0x5d913f)[_0x738c('0x1d')]();};}function respondWithResult(_0x630bc,_0x5c791a){_0x5c791a=_0x5c791a||0xc8;return function(_0x32cbb7){if(_0x32cbb7){return _0x630bc[_0x738c('0x1c')](_0x5c791a)['json'](_0x32cbb7);}};}function respondWithFilteredResult(_0x4b0bab,_0x40cc26){return function(_0x5a6cd8){if(_0x5a6cd8){var _0x20bb49=_0x5a6cd8[_0x738c('0x1e')],_0x3b31c7=_0x40cc26['offset'],_0x487d3d=_0x40cc26[_0x738c('0x1f')]+_0x40cc26['limit'],_0x2c9887;if(_0x487d3d>=_0x20bb49){_0x487d3d=_0x20bb49;_0x2c9887=0xc8;}else{_0x2c9887=0xce;}_0x4b0bab[_0x738c('0x1c')](_0x2c9887);return _0x4b0bab['set']('Content-Range',_0x3b31c7+'-'+_0x487d3d+'/'+_0x20bb49)[_0x738c('0x20')](_0x5a6cd8);}return null;};}function patchUpdates(_0x1422d9){return function(_0xc2deba){try{jsonpatch[_0x738c('0x21')](_0xc2deba,_0x1422d9,!![]);}catch(_0x280d31){return BPromise[_0x738c('0x22')](_0x280d31);}return _0xc2deba[_0x738c('0x23')]();};}function saveUpdates(_0x301563,_0x21bb21){return function(_0x3285a2){if(_0x3285a2){return _0x3285a2[_0x738c('0x24')](_0x301563)['then'](function(_0x3065b1){return _0x3065b1;});}return null;};}function removeEntity(_0x5c4ddf,_0x390b48){return function(_0x390895){if(_0x390895){return _0x390895[_0x738c('0x25')]()[_0x738c('0x26')](function(){_0x5c4ddf[_0x738c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e5d5,_0x4f9fcc){return function(_0x4d3cf1){if(!_0x4d3cf1){_0x51e5d5[_0x738c('0x1b')](0x194);}return _0x4d3cf1;};}function handleError(_0x1cec0f,_0x38f4d4){_0x38f4d4=_0x38f4d4||0x1f4;return function(_0x205ef1){logger[_0x738c('0x27')](_0x205ef1['stack']);if(_0x205ef1[_0x738c('0x28')]){delete _0x205ef1[_0x738c('0x28')];}_0x1cec0f[_0x738c('0x1c')](_0x38f4d4)[_0x738c('0x29')](_0x205ef1);};}exports['index']=function(_0x4e059d,_0x57b009){var _0x2924b2={},_0x374324={},_0x4fe817={'count':0x0,'rows':[]};var _0x39927c=db[_0x738c('0x2a')][_0x738c('0x2b')];_0x374324[_0x738c('0x2c')]=_[_0x738c('0x2d')](_0x39927c);_0x374324['query']=_[_0x738c('0x2d')](_0x4e059d[_0x738c('0x2e')]);_0x374324['filters']=_[_0x738c('0x2f')](_0x374324[_0x738c('0x2c')],_0x374324['query']);_0x2924b2['attributes']=_[_0x738c('0x2f')](_0x374324[_0x738c('0x2c')],qs[_0x738c('0x30')](_0x4e059d[_0x738c('0x2e')]['fields']));_0x2924b2[_0x738c('0x31')]=_0x2924b2[_0x738c('0x31')][_0x738c('0x32')]?_0x2924b2[_0x738c('0x31')]:_0x374324[_0x738c('0x2c')];if(!_0x4e059d[_0x738c('0x2e')][_0x738c('0x33')](_0x738c('0x34'))){_0x2924b2[_0x738c('0x35')]=qs[_0x738c('0x35')](_0x4e059d['query'][_0x738c('0x35')]);_0x2924b2[_0x738c('0x1f')]=qs[_0x738c('0x1f')](_0x4e059d[_0x738c('0x2e')][_0x738c('0x1f')]);}_0x2924b2[_0x738c('0x36')]=qs[_0x738c('0x37')](_0x4e059d[_0x738c('0x2e')][_0x738c('0x37')]);_0x2924b2['where']=qs[_0x738c('0x38')](_[_0x738c('0x39')](_0x4e059d[_0x738c('0x2e')],_0x374324[_0x738c('0x38')]));if(_0x4e059d[_0x738c('0x2e')]['filter']){_0x2924b2['where']=_[_0x738c('0x3a')](_0x2924b2[_0x738c('0x3b')],{'$or':_['map'](_0x39927c,function(_0x229adf){if(_0x229adf[_0x738c('0x3c')][_0x738c('0x3d')]!==_0x738c('0x3e')){var _0x24aba2={};_0x24aba2[_0x229adf['field']]={'$like':'%'+_0x4e059d['query'][_0x738c('0x3f')]+'%'};return _0x24aba2;}})});}_0x2924b2=_['merge']({},_0x2924b2,_0x4e059d[_0x738c('0x40')]);var _0x2b0152={'where':_0x2924b2[_0x738c('0x3b')]};return db['MailServerOut'][_0x738c('0x1e')](_0x2b0152)['then'](function(_0x30d1f0){_0x4fe817['count']=_0x30d1f0;if(_0x4e059d['query'][_0x738c('0x41')]){_0x2924b2[_0x738c('0x42')]=[{'all':!![]}];}return db[_0x738c('0x2a')][_0x738c('0x43')](_0x2924b2);})[_0x738c('0x26')](function(_0x15f9e1){_0x4fe817[_0x738c('0x44')]=_0x15f9e1;return _0x4fe817;})[_0x738c('0x26')](respondWithFilteredResult(_0x57b009,_0x2924b2))[_0x738c('0x45')](handleError(_0x57b009,null));};exports[_0x738c('0x46')]=function(_0x7701a,_0x75920b){var _0x45f6a7={'raw':!![],'where':{'id':_0x7701a['params']['id']}},_0x2d7d5c={};_0x2d7d5c[_0x738c('0x2c')]=_[_0x738c('0x2d')](db[_0x738c('0x2a')][_0x738c('0x2b')]);_0x2d7d5c['query']=_[_0x738c('0x2d')](_0x7701a[_0x738c('0x2e')]);_0x2d7d5c[_0x738c('0x38')]=_['intersection'](_0x2d7d5c['model'],_0x2d7d5c['query']);_0x45f6a7['attributes']=_[_0x738c('0x2f')](_0x2d7d5c[_0x738c('0x2c')],qs[_0x738c('0x30')](_0x7701a[_0x738c('0x2e')][_0x738c('0x30')]));_0x45f6a7[_0x738c('0x31')]=_0x45f6a7['attributes'][_0x738c('0x32')]?_0x45f6a7['attributes']:_0x2d7d5c['model'];if(_0x7701a[_0x738c('0x2e')]['includeAll']){_0x45f6a7[_0x738c('0x42')]=[{'all':!![]}];}_0x45f6a7=_[_0x738c('0x3a')]({},_0x45f6a7,_0x7701a[_0x738c('0x40')]);return db[_0x738c('0x2a')][_0x738c('0x47')](_0x45f6a7)[_0x738c('0x26')](handleEntityNotFound(_0x75920b,null))[_0x738c('0x26')](respondWithResult(_0x75920b,null))['catch'](handleError(_0x75920b,null));};exports[_0x738c('0x48')]=function(_0x1e2968,_0x1941e8){return db[_0x738c('0x2a')][_0x738c('0x48')](_0x1e2968[_0x738c('0x49')],{})[_0x738c('0x26')](respondWithResult(_0x1941e8,0xc9))[_0x738c('0x45')](handleError(_0x1941e8,null));};exports[_0x738c('0x24')]=function(_0x4a68fd,_0x16c531){if(_0x4a68fd[_0x738c('0x49')]['id']){delete _0x4a68fd['body']['id'];}return db['MailServerOut'][_0x738c('0x47')]({'where':{'id':_0x4a68fd[_0x738c('0x4a')]['id']}})[_0x738c('0x26')](handleEntityNotFound(_0x16c531,null))[_0x738c('0x26')](saveUpdates(_0x4a68fd[_0x738c('0x49')],null))[_0x738c('0x26')](respondWithResult(_0x16c531,null))[_0x738c('0x45')](handleError(_0x16c531,null));};exports[_0x738c('0x25')]=function(_0x5ebc60,_0x46395f){return db['MailServerOut'][_0x738c('0x47')]({'where':{'id':_0x5ebc60[_0x738c('0x4a')]['id']}})[_0x738c('0x26')](handleEntityNotFound(_0x46395f,null))[_0x738c('0x26')](removeEntity(_0x46395f,null))[_0x738c('0x45')](handleError(_0x46395f,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1294dca..c333845 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 _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x46bb87,_0x5a88fa){var _0x304cdc=function(_0x277021){while(--_0x277021){_0x46bb87['push'](_0x46bb87['shift']());}};_0x304cdc(++_0x5a88fa);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x54b694,_0x2b890e){_0x54b694=_0x54b694-0x0;var _0x4dc96f=_0xdbf5[_0x54b694];return _0x4dc96f;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util'];(function(_0x277102,_0x335a58){var _0x1407c4=function(_0x4dc4d5){while(--_0x4dc4d5){_0x277102['push'](_0x277102['shift']());}};_0x1407c4(++_0x335a58);}(_0xf494,0x1c6));var _0x4f49=function(_0x2fd8dc,_0x5bc26e){_0x2fd8dc=_0x2fd8dc-0x0;var _0x287a19=_0xf494[_0x2fd8dc];return _0x287a19;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2058ebf..5b45524 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 _0xceee=['MailServerOut,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','MailServerOut,\x20%s,\x20%s','request\x20sent'];(function(_0x2a880e,_0x405b8c){var _0x4526dc=function(_0x421d06){while(--_0x421d06){_0x2a880e['push'](_0x2a880e['shift']());}};_0x4526dc(++_0x405b8c);}(_0xceee,0x83));var _0xecee=function(_0x499f07,_0x5d38f2){_0x499f07=_0x499f07-0x0;var _0x373bc3=_0xceee[_0x499f07];return _0x373bc3;};'use strict';var _=require(_0xecee('0x0'));var util=require('util');var moment=require(_0xecee('0x1'));var BPromise=require(_0xecee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xecee('0x4'));var logger=require('../../config/logger')(_0xecee('0x5'));var config=require(_0xecee('0x6'));var jayson=require(_0xecee('0x7'));var client=jayson[_0xecee('0x8')][_0xecee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58d580,_0x5b359a,_0x52a1fb){return new BPromise(function(_0x146280,_0x4cf443){return client['request'](_0x58d580,_0x52a1fb)[_0xecee('0xa')](function(_0x416501){logger['info'](_0xecee('0xb'),_0x5b359a,_0xecee('0xc'));logger['debug'](_0xecee('0xd'),_0x5b359a,_0xecee('0xc'),JSON['stringify'](_0x416501));if(_0x416501['error']){if(_0x416501['error']['code']===0x1f4){logger[_0xecee('0xe')]('MailServerOut,\x20%s,\x20%s',_0x5b359a,_0x416501['error'][_0xecee('0xf')]);return _0x4cf443(_0x416501[_0xecee('0xe')][_0xecee('0xf')]);}logger[_0xecee('0xe')](_0xecee('0xb'),_0x5b359a,_0x416501[_0xecee('0xe')][_0xecee('0xf')]);return _0x146280(_0x416501[_0xecee('0xe')][_0xecee('0xf')]);}else{logger['info'](_0xecee('0xb'),_0x5b359a,_0xecee('0xc'));_0x146280(_0x416501[_0xecee('0x10')][_0xecee('0xf')]);}})[_0xecee('0x11')](function(_0x45db46){logger[_0xecee('0xe')](_0xecee('0xb'),_0x5b359a,_0x45db46);_0x4cf443(_0x45db46);});});} \ No newline at end of file +var _0x6584=['../../config/environment','client','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x39eaf1,_0x56f6b9){var _0x116705=function(_0x242c21){while(--_0x242c21){_0x39eaf1['push'](_0x39eaf1['shift']());}};_0x116705(++_0x56f6b9);}(_0x6584,0xc0));var _0x4658=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x6584[_0x266618];return _0x54dbf5;};'use strict';var _=require('lodash');var util=require(_0x4658('0x0'));var moment=require(_0x4658('0x1'));var BPromise=require(_0x4658('0x2'));var rs=require(_0x4658('0x3'));var fs=require('fs');var Redis=require(_0x4658('0x4'));var db=require(_0x4658('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4658('0x6'))(_0x4658('0x7'));var config=require(_0x4658('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4658('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x519c65,_0x2d9273,_0x3ac98b){return new BPromise(function(_0x20c669,_0x505bd4){return client['request'](_0x519c65,_0x3ac98b)[_0x4658('0xa')](function(_0x4b27da){logger[_0x4658('0xb')](_0x4658('0xc'),_0x2d9273,'request\x20sent');logger['debug'](_0x4658('0xd'),_0x2d9273,_0x4658('0xe'),JSON[_0x4658('0xf')](_0x4b27da));if(_0x4b27da[_0x4658('0x10')]){if(_0x4b27da['error'][_0x4658('0x11')]===0x1f4){logger[_0x4658('0x10')](_0x4658('0xc'),_0x2d9273,_0x4b27da[_0x4658('0x10')][_0x4658('0x12')]);return _0x505bd4(_0x4b27da['error']['message']);}logger[_0x4658('0x10')]('MailServerOut,\x20%s,\x20%s',_0x2d9273,_0x4b27da[_0x4658('0x10')][_0x4658('0x12')]);return _0x20c669(_0x4b27da['error'][_0x4658('0x12')]);}else{logger[_0x4658('0xb')](_0x4658('0xc'),_0x2d9273,'request\x20sent');_0x20c669(_0x4b27da['result']['message']);}})[_0x4658('0x13')](function(_0x399866){logger[_0x4658('0x10')](_0x4658('0xc'),_0x2d9273,_0x399866);_0x505bd4(_0x399866);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 4ec7dcc..d7b1262 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 _0xbd77=['show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x274706,_0x1c29ca){var _0xf2dac6=function(_0x29f15f){while(--_0x29f15f){_0x274706['push'](_0x274706['shift']());}};_0xf2dac6(++_0x1c29ca);}(_0xbd77,0x1ab));var _0x7bd7=function(_0x457bc8,_0x1a2868){_0x457bc8=_0x457bc8-0x0;var _0x43ecb7=_0xbd77[_0x457bc8];return _0x43ecb7;};'use strict';var multer=require(_0x7bd7('0x0'));var util=require(_0x7bd7('0x1'));var path=require(_0x7bd7('0x2'));var timeout=require(_0x7bd7('0x3'));var express=require(_0x7bd7('0x4'));var router=express[_0x7bd7('0x5')]();var auth=require(_0x7bd7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7bd7('0x7'));var controller=require('./mailSubstatus.controller');router[_0x7bd7('0x8')]('/',auth[_0x7bd7('0x9')](),controller[_0x7bd7('0xa')]);router[_0x7bd7('0x8')](_0x7bd7('0xb'),auth[_0x7bd7('0x9')](),controller[_0x7bd7('0xc')]);router['get']('/:id',auth[_0x7bd7('0x9')](),controller[_0x7bd7('0xd')]);router['post']('/',auth[_0x7bd7('0x9')](),controller[_0x7bd7('0xe')]);router['put'](_0x7bd7('0xf'),auth[_0x7bd7('0x9')](),controller[_0x7bd7('0x10')]);router[_0x7bd7('0x11')](_0x7bd7('0xf'),auth['isAuthenticated'](),controller[_0x7bd7('0x12')]);module[_0x7bd7('0x13')]=router; \ No newline at end of file +var _0x2fe7=['util','path','express','Router','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x278031,_0x57fb38){var _0x4b7332=function(_0x5e2dd3){while(--_0x5e2dd3){_0x278031['push'](_0x278031['shift']());}};_0x4b7332(++_0x57fb38);}(_0x2fe7,0x1ee));var _0x72fe=function(_0x1e9cf2,_0x2d9f09){_0x1e9cf2=_0x1e9cf2-0x0;var _0x5c8d6a=_0x2fe7[_0x1e9cf2];return _0x5c8d6a;};'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');var controller=require(_0x72fe('0x5'));router[_0x72fe('0x6')]('/',auth[_0x72fe('0x7')](),controller[_0x72fe('0x8')]);router[_0x72fe('0x6')](_0x72fe('0x9'),auth[_0x72fe('0x7')](),controller[_0x72fe('0xa')]);router[_0x72fe('0x6')]('/:id',auth[_0x72fe('0x7')](),controller[_0x72fe('0xb')]);router[_0x72fe('0xc')]('/',auth[_0x72fe('0x7')](),controller[_0x72fe('0xd')]);router[_0x72fe('0xe')](_0x72fe('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x72fe('0x10')](_0x72fe('0xf'),auth['isAuthenticated'](),controller[_0x72fe('0x11')]);module[_0x72fe('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 28d2d40..fe8cb5c 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 _0x9851=['STRING','name','sequelize'];(function(_0x1aad8c,_0x3d2f6c){var _0x425bd6=function(_0x4bf857){while(--_0x4bf857){_0x1aad8c['push'](_0x1aad8c['shift']());}};_0x425bd6(++_0x3d2f6c);}(_0x9851,0x1f1));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1985('0x0'));module['exports']={'name':{'type':Sequelize[_0x1985('0x1')],'unique':_0x1985('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1985('0x1')]}}; \ No newline at end of file +var _0xa1c5=['sequelize','exports','STRING'];(function(_0x36bdef,_0x57df5a){var _0xaf83fa=function(_0x47e894){while(--_0x47e894){_0x36bdef['push'](_0x36bdef['shift']());}};_0xaf83fa(++_0x57df5a);}(_0xa1c5,0x96));var _0x5a1c=function(_0x483339,_0x2afea9){_0x483339=_0x483339-0x0;var _0x271f5f=_0xa1c5[_0x483339];return _0x271f5f;};'use strict';var Sequelize=require(_0x5a1c('0x0'));module[_0x5a1c('0x1')]={'name':{'type':Sequelize[_0x5a1c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 9a4e7a5..651f9da 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 _0xfada=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','type','key','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','MailSubstatus','model'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfada,0xa6));var _0xafad=function(_0x497acd,_0x5452b5){_0x497acd=_0x497acd-0x0;var _0x2f94db=_0xfada[_0x497acd];return _0x2f94db;};'use strict';var pdf=require(_0xafad('0x0'));var emlformat=require(_0xafad('0x1'));var rimraf=require(_0xafad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xafad('0x3'));var rp=require('request-promise');var moment=require(_0xafad('0x4'));var BPromise=require(_0xafad('0x5'));var Mustache=require(_0xafad('0x6'));var util=require(_0xafad('0x7'));var path=require(_0xafad('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xafad('0x9'));var fs=require('fs');var _=require(_0xafad('0xa'));var squel=require(_0xafad('0xb'));var crypto=require(_0xafad('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xafad('0xd'));var toCsv=require(_0xafad('0xe'));var querystring=require('querystring');var Papa=require(_0xafad('0xf'));var Redis=require('ioredis');var authService=require(_0xafad('0x10'));var qs=require(_0xafad('0x11'));var hardwareService=require(_0xafad('0x12'));var logger=require(_0xafad('0x13'))(_0xafad('0x14'));var utils=require(_0xafad('0x15'));var config=require(_0xafad('0x16'));var db=require(_0xafad('0x17'))['db'];function respondWithStatusCode(_0x2f2636,_0xb8714e){_0xb8714e=_0xb8714e||0xcc;return function(_0x4fe785){if(_0x4fe785){return _0x2f2636[_0xafad('0x18')](_0xb8714e);}return _0x2f2636['status'](_0xb8714e)[_0xafad('0x19')]();};}function respondWithResult(_0x36c027,_0xf27d0b){_0xf27d0b=_0xf27d0b||0xc8;return function(_0x56c842){if(_0x56c842){return _0x36c027[_0xafad('0x1a')](_0xf27d0b)[_0xafad('0x1b')](_0x56c842);}};}function respondWithFilteredResult(_0x3049a6,_0x10a74){return function(_0xcb923e){if(_0xcb923e){var _0x24fb4e=_0xcb923e[_0xafad('0x1c')],_0x109541=_0x10a74[_0xafad('0x1d')],_0x1a2e9f=_0x10a74[_0xafad('0x1d')]+_0x10a74[_0xafad('0x1e')],_0x43ed0e;if(_0x1a2e9f>=_0x24fb4e){_0x1a2e9f=_0x24fb4e;_0x43ed0e=0xc8;}else{_0x43ed0e=0xce;}_0x3049a6[_0xafad('0x1a')](_0x43ed0e);return _0x3049a6['set'](_0xafad('0x1f'),_0x109541+'-'+_0x1a2e9f+'/'+_0x24fb4e)[_0xafad('0x1b')](_0xcb923e);}return null;};}function patchUpdates(_0x216b4d){return function(_0x45f8a4){try{jsonpatch['apply'](_0x45f8a4,_0x216b4d,!![]);}catch(_0x4f2349){return BPromise[_0xafad('0x20')](_0x4f2349);}return _0x45f8a4[_0xafad('0x21')]();};}function saveUpdates(_0x359c8d,_0x448e3b){return function(_0x48af60){if(_0x48af60){return _0x48af60[_0xafad('0x22')](_0x359c8d)[_0xafad('0x23')](function(_0x19d07f){return _0x19d07f;});}return null;};}function removeEntity(_0x2ea1c0,_0x739a36){return function(_0x4fe920){if(_0x4fe920){return _0x4fe920[_0xafad('0x24')]()[_0xafad('0x23')](function(){_0x2ea1c0['status'](0xcc)[_0xafad('0x19')]();});}};}function handleEntityNotFound(_0x321dfe,_0x5f987c){return function(_0xfd3994){if(!_0xfd3994){_0x321dfe[_0xafad('0x18')](0x194);}return _0xfd3994;};}function handleError(_0x5c8939,_0x3d302e){_0x3d302e=_0x3d302e||0x1f4;return function(_0x2d8538){logger[_0xafad('0x25')](_0x2d8538[_0xafad('0x26')]);if(_0x2d8538[_0xafad('0x27')]){delete _0x2d8538[_0xafad('0x27')];}_0x5c8939[_0xafad('0x1a')](_0x3d302e)[_0xafad('0x28')](_0x2d8538);};}exports[_0xafad('0x29')]=function(_0xd64c51,_0x3a5abf){var _0xec20f0={},_0x1d0f8a={},_0x5dc8e1={'count':0x0,'rows':[]};var _0x809c5c=db[_0xafad('0x2a')]['rawAttributes'];_0x1d0f8a[_0xafad('0x2b')]=_['keys'](_0x809c5c);_0x1d0f8a[_0xafad('0x2c')]=_[_0xafad('0x2d')](_0xd64c51[_0xafad('0x2c')]);_0x1d0f8a[_0xafad('0x2e')]=_[_0xafad('0x2f')](_0x1d0f8a[_0xafad('0x2b')],_0x1d0f8a[_0xafad('0x2c')]);_0xec20f0[_0xafad('0x30')]=_[_0xafad('0x2f')](_0x1d0f8a[_0xafad('0x2b')],qs[_0xafad('0x31')](_0xd64c51[_0xafad('0x2c')]['fields']));_0xec20f0['attributes']=_0xec20f0[_0xafad('0x30')]['length']?_0xec20f0['attributes']:_0x1d0f8a['model'];if(!_0xd64c51[_0xafad('0x2c')][_0xafad('0x32')](_0xafad('0x33'))){_0xec20f0[_0xafad('0x1e')]=qs[_0xafad('0x1e')](_0xd64c51[_0xafad('0x2c')][_0xafad('0x1e')]);_0xec20f0[_0xafad('0x1d')]=qs[_0xafad('0x1d')](_0xd64c51['query'][_0xafad('0x1d')]);}_0xec20f0['order']=qs['sort'](_0xd64c51[_0xafad('0x2c')]['sort']);_0xec20f0[_0xafad('0x34')]=qs['filters'](_[_0xafad('0x35')](_0xd64c51[_0xafad('0x2c')],_0x1d0f8a[_0xafad('0x2e')]));if(_0xd64c51['query'][_0xafad('0x36')]){_0xec20f0[_0xafad('0x34')]=_[_0xafad('0x37')](_0xec20f0[_0xafad('0x34')],{'$or':_['map'](_0x809c5c,function(_0x4ba005){if(_0x4ba005[_0xafad('0x38')][_0xafad('0x39')]!==_0xafad('0x3a')){var _0x41db4e={};_0x41db4e[_0x4ba005['field']]={'$like':'%'+_0xd64c51[_0xafad('0x2c')]['filter']+'%'};return _0x41db4e;}})});}_0xec20f0=_[_0xafad('0x37')]({},_0xec20f0,_0xd64c51[_0xafad('0x3b')]);var _0x34404f={'where':_0xec20f0[_0xafad('0x34')]};return db[_0xafad('0x2a')][_0xafad('0x1c')](_0x34404f)[_0xafad('0x23')](function(_0x524af1){_0x5dc8e1[_0xafad('0x1c')]=_0x524af1;if(_0xd64c51[_0xafad('0x2c')][_0xafad('0x3c')]){_0xec20f0[_0xafad('0x3d')]=[{'all':!![]}];}return db[_0xafad('0x2a')][_0xafad('0x3e')](_0xec20f0);})[_0xafad('0x23')](function(_0x12379f){_0x5dc8e1['rows']=_0x12379f;return _0x5dc8e1;})[_0xafad('0x23')](respondWithFilteredResult(_0x3a5abf,_0xec20f0))['catch'](handleError(_0x3a5abf,null));};exports[_0xafad('0x3f')]=function(_0xe011b6,_0x4951bd){var _0x19e272={'raw':!![],'where':{'id':_0xe011b6[_0xafad('0x40')]['id']}},_0x1a3b74={};_0x1a3b74[_0xafad('0x2b')]=_[_0xafad('0x2d')](db[_0xafad('0x2a')]['rawAttributes']);_0x1a3b74['query']=_[_0xafad('0x2d')](_0xe011b6['query']);_0x1a3b74[_0xafad('0x2e')]=_[_0xafad('0x2f')](_0x1a3b74[_0xafad('0x2b')],_0x1a3b74[_0xafad('0x2c')]);_0x19e272[_0xafad('0x30')]=_[_0xafad('0x2f')](_0x1a3b74['model'],qs[_0xafad('0x31')](_0xe011b6['query'][_0xafad('0x31')]));_0x19e272[_0xafad('0x30')]=_0x19e272[_0xafad('0x30')][_0xafad('0x41')]?_0x19e272[_0xafad('0x30')]:_0x1a3b74[_0xafad('0x2b')];if(_0xe011b6[_0xafad('0x2c')][_0xafad('0x3c')]){_0x19e272['include']=[{'all':!![]}];}_0x19e272=_[_0xafad('0x37')]({},_0x19e272,_0xe011b6[_0xafad('0x3b')]);return db[_0xafad('0x2a')][_0xafad('0x42')](_0x19e272)[_0xafad('0x23')](handleEntityNotFound(_0x4951bd,null))[_0xafad('0x23')](respondWithResult(_0x4951bd,null))[_0xafad('0x43')](handleError(_0x4951bd,null));};exports[_0xafad('0x44')]=function(_0x3e0ff9,_0x4dd0ed){return db['MailSubstatus']['create'](_0x3e0ff9[_0xafad('0x45')],{})[_0xafad('0x23')](respondWithResult(_0x4dd0ed,0xc9))[_0xafad('0x43')](handleError(_0x4dd0ed,null));};exports[_0xafad('0x22')]=function(_0x1ec8d9,_0xb708b4){if(_0x1ec8d9[_0xafad('0x45')]['id']){delete _0x1ec8d9[_0xafad('0x45')]['id'];}return db[_0xafad('0x2a')][_0xafad('0x42')]({'where':{'id':_0x1ec8d9[_0xafad('0x40')]['id']}})['then'](handleEntityNotFound(_0xb708b4,null))[_0xafad('0x23')](saveUpdates(_0x1ec8d9[_0xafad('0x45')],null))[_0xafad('0x23')](respondWithResult(_0xb708b4,null))[_0xafad('0x43')](handleError(_0xb708b4,null));};exports[_0xafad('0x24')]=function(_0x6633b4,_0x3eaa1f){return db[_0xafad('0x2a')]['find']({'where':{'id':_0x6633b4[_0xafad('0x40')]['id']}})[_0xafad('0x23')](handleEntityNotFound(_0x3eaa1f,null))['then'](removeEntity(_0x3eaa1f,null))['catch'](handleError(_0x3eaa1f,null));};exports['describe']=function(_0x453040,_0x1888df){return db[_0xafad('0x2a')]['describe']()[_0xafad('0x23')](respondWithResult(_0x1888df,null))['catch'](handleError(_0x1888df,null));}; \ No newline at end of file +var _0x7a4c=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','type','VIRTUAL','field','options','where','MailSubstatus','includeAll','include','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','status'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a4c,0x73));var _0xc7a4=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x7a4c[_0x26fc81];return _0x9feece;};'use strict';var pdf=require(_0xc7a4('0x0'));var emlformat=require(_0xc7a4('0x1'));var rimraf=require(_0xc7a4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc7a4('0x3'));var moment=require('moment');var BPromise=require(_0xc7a4('0x4'));var Mustache=require(_0xc7a4('0x5'));var util=require(_0xc7a4('0x6'));var path=require(_0xc7a4('0x7'));var sox=require(_0xc7a4('0x8'));var csv=require(_0xc7a4('0x9'));var ejs=require(_0xc7a4('0xa'));var fs=require('fs');var _=require(_0xc7a4('0xb'));var squel=require(_0xc7a4('0xc'));var crypto=require(_0xc7a4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc7a4('0x9'));var querystring=require('querystring');var Papa=require(_0xc7a4('0xe'));var Redis=require('ioredis');var authService=require(_0xc7a4('0xf'));var qs=require(_0xc7a4('0x10'));var hardwareService=require(_0xc7a4('0x11'));var logger=require(_0xc7a4('0x12'))(_0xc7a4('0x13'));var utils=require(_0xc7a4('0x14'));var config=require('../../config/environment');var db=require(_0xc7a4('0x15'))['db'];function respondWithStatusCode(_0x24c9f1,_0x13a2eb){_0x13a2eb=_0x13a2eb||0xcc;return function(_0x88f8a9){if(_0x88f8a9){return _0x24c9f1[_0xc7a4('0x16')](_0x13a2eb);}return _0x24c9f1['status'](_0x13a2eb)[_0xc7a4('0x17')]();};}function respondWithResult(_0xc41c2,_0x497761){_0x497761=_0x497761||0xc8;return function(_0x258197){if(_0x258197){return _0xc41c2['status'](_0x497761)[_0xc7a4('0x18')](_0x258197);}};}function respondWithFilteredResult(_0x51b646,_0x2e6eb0){return function(_0xc4aaf9){if(_0xc4aaf9){var _0x3bc399=_0xc4aaf9[_0xc7a4('0x19')],_0x1e6540=_0x2e6eb0[_0xc7a4('0x1a')],_0x1b455a=_0x2e6eb0[_0xc7a4('0x1a')]+_0x2e6eb0[_0xc7a4('0x1b')],_0x6f84c5;if(_0x1b455a>=_0x3bc399){_0x1b455a=_0x3bc399;_0x6f84c5=0xc8;}else{_0x6f84c5=0xce;}_0x51b646[_0xc7a4('0x1c')](_0x6f84c5);return _0x51b646['set'](_0xc7a4('0x1d'),_0x1e6540+'-'+_0x1b455a+'/'+_0x3bc399)['json'](_0xc4aaf9);}return null;};}function patchUpdates(_0x4ca77c){return function(_0x347ba7){try{jsonpatch[_0xc7a4('0x1e')](_0x347ba7,_0x4ca77c,!![]);}catch(_0xc59584){return BPromise[_0xc7a4('0x1f')](_0xc59584);}return _0x347ba7[_0xc7a4('0x20')]();};}function saveUpdates(_0x352b18,_0x2d88e7){return function(_0x460375){if(_0x460375){return _0x460375[_0xc7a4('0x21')](_0x352b18)[_0xc7a4('0x22')](function(_0x13a43a){return _0x13a43a;});}return null;};}function removeEntity(_0x537421,_0x38d973){return function(_0x529a49){if(_0x529a49){return _0x529a49[_0xc7a4('0x23')]()[_0xc7a4('0x22')](function(){_0x537421[_0xc7a4('0x1c')](0xcc)[_0xc7a4('0x17')]();});}};}function handleEntityNotFound(_0x32c077,_0x171c51){return function(_0x4c3dd1){if(!_0x4c3dd1){_0x32c077[_0xc7a4('0x16')](0x194);}return _0x4c3dd1;};}function handleError(_0x4d24fd,_0x223a89){_0x223a89=_0x223a89||0x1f4;return function(_0x4723e9){logger[_0xc7a4('0x24')](_0x4723e9[_0xc7a4('0x25')]);if(_0x4723e9[_0xc7a4('0x26')]){delete _0x4723e9[_0xc7a4('0x26')];}_0x4d24fd['status'](_0x223a89)[_0xc7a4('0x27')](_0x4723e9);};}exports[_0xc7a4('0x28')]=function(_0x161757,_0x16e0a8){var _0x41342f={},_0x4aa1e0={},_0x47a452={'count':0x0,'rows':[]};var _0x51650e=db['MailSubstatus'][_0xc7a4('0x29')];_0x4aa1e0[_0xc7a4('0x2a')]=_['keys'](_0x51650e);_0x4aa1e0[_0xc7a4('0x2b')]=_[_0xc7a4('0x2c')](_0x161757[_0xc7a4('0x2b')]);_0x4aa1e0[_0xc7a4('0x2d')]=_[_0xc7a4('0x2e')](_0x4aa1e0[_0xc7a4('0x2a')],_0x4aa1e0[_0xc7a4('0x2b')]);_0x41342f[_0xc7a4('0x2f')]=_[_0xc7a4('0x2e')](_0x4aa1e0['model'],qs[_0xc7a4('0x30')](_0x161757[_0xc7a4('0x2b')]['fields']));_0x41342f[_0xc7a4('0x2f')]=_0x41342f[_0xc7a4('0x2f')][_0xc7a4('0x31')]?_0x41342f[_0xc7a4('0x2f')]:_0x4aa1e0['model'];if(!_0x161757[_0xc7a4('0x2b')][_0xc7a4('0x32')](_0xc7a4('0x33'))){_0x41342f[_0xc7a4('0x1b')]=qs['limit'](_0x161757[_0xc7a4('0x2b')][_0xc7a4('0x1b')]);_0x41342f['offset']=qs[_0xc7a4('0x1a')](_0x161757['query'][_0xc7a4('0x1a')]);}_0x41342f[_0xc7a4('0x34')]=qs['sort'](_0x161757['query'][_0xc7a4('0x35')]);_0x41342f['where']=qs[_0xc7a4('0x2d')](_[_0xc7a4('0x36')](_0x161757['query'],_0x4aa1e0[_0xc7a4('0x2d')]));if(_0x161757[_0xc7a4('0x2b')]['filter']){_0x41342f['where']=_[_0xc7a4('0x37')](_0x41342f['where'],{'$or':_['map'](_0x51650e,function(_0x40d466){if(_0x40d466[_0xc7a4('0x38')]['key']!==_0xc7a4('0x39')){var _0x1b4703={};_0x1b4703[_0x40d466[_0xc7a4('0x3a')]]={'$like':'%'+_0x161757['query']['filter']+'%'};return _0x1b4703;}})});}_0x41342f=_[_0xc7a4('0x37')]({},_0x41342f,_0x161757[_0xc7a4('0x3b')]);var _0x20390b={'where':_0x41342f[_0xc7a4('0x3c')]};return db[_0xc7a4('0x3d')][_0xc7a4('0x19')](_0x20390b)['then'](function(_0x1be39f){_0x47a452['count']=_0x1be39f;if(_0x161757['query'][_0xc7a4('0x3e')]){_0x41342f[_0xc7a4('0x3f')]=[{'all':!![]}];}return db[_0xc7a4('0x3d')]['findAll'](_0x41342f);})[_0xc7a4('0x22')](function(_0x35c9d8){_0x47a452[_0xc7a4('0x40')]=_0x35c9d8;return _0x47a452;})['then'](respondWithFilteredResult(_0x16e0a8,_0x41342f))[_0xc7a4('0x41')](handleError(_0x16e0a8,null));};exports[_0xc7a4('0x42')]=function(_0x16fdcf,_0x1d977){var _0x1db339={'raw':!![],'where':{'id':_0x16fdcf['params']['id']}},_0x26a918={};_0x26a918[_0xc7a4('0x2a')]=_[_0xc7a4('0x2c')](db[_0xc7a4('0x3d')][_0xc7a4('0x29')]);_0x26a918[_0xc7a4('0x2b')]=_[_0xc7a4('0x2c')](_0x16fdcf[_0xc7a4('0x2b')]);_0x26a918['filters']=_[_0xc7a4('0x2e')](_0x26a918[_0xc7a4('0x2a')],_0x26a918[_0xc7a4('0x2b')]);_0x1db339[_0xc7a4('0x2f')]=_[_0xc7a4('0x2e')](_0x26a918['model'],qs['fields'](_0x16fdcf[_0xc7a4('0x2b')][_0xc7a4('0x30')]));_0x1db339['attributes']=_0x1db339[_0xc7a4('0x2f')][_0xc7a4('0x31')]?_0x1db339[_0xc7a4('0x2f')]:_0x26a918[_0xc7a4('0x2a')];if(_0x16fdcf[_0xc7a4('0x2b')]['includeAll']){_0x1db339[_0xc7a4('0x3f')]=[{'all':!![]}];}_0x1db339=_[_0xc7a4('0x37')]({},_0x1db339,_0x16fdcf[_0xc7a4('0x3b')]);return db[_0xc7a4('0x3d')][_0xc7a4('0x43')](_0x1db339)['then'](handleEntityNotFound(_0x1d977,null))[_0xc7a4('0x22')](respondWithResult(_0x1d977,null))[_0xc7a4('0x41')](handleError(_0x1d977,null));};exports[_0xc7a4('0x44')]=function(_0x6dda46,_0x1a2f7c){return db[_0xc7a4('0x3d')][_0xc7a4('0x44')](_0x6dda46[_0xc7a4('0x45')],{})[_0xc7a4('0x22')](respondWithResult(_0x1a2f7c,0xc9))[_0xc7a4('0x41')](handleError(_0x1a2f7c,null));};exports[_0xc7a4('0x21')]=function(_0x556bc3,_0x4c9b12){if(_0x556bc3['body']['id']){delete _0x556bc3[_0xc7a4('0x45')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x556bc3[_0xc7a4('0x46')]['id']}})[_0xc7a4('0x22')](handleEntityNotFound(_0x4c9b12,null))[_0xc7a4('0x22')](saveUpdates(_0x556bc3['body'],null))[_0xc7a4('0x22')](respondWithResult(_0x4c9b12,null))[_0xc7a4('0x41')](handleError(_0x4c9b12,null));};exports[_0xc7a4('0x23')]=function(_0x1caa94,_0x20ec75){return db['MailSubstatus'][_0xc7a4('0x43')]({'where':{'id':_0x1caa94['params']['id']}})['then'](handleEntityNotFound(_0x20ec75,null))[_0xc7a4('0x22')](removeEntity(_0x20ec75,null))[_0xc7a4('0x41')](handleError(_0x20ec75,null));};exports[_0xc7a4('0x47')]=function(_0x28eced,_0x538f65){return db[_0xc7a4('0x3d')]['describe']()[_0xc7a4('0x22')](respondWithResult(_0x538f65,null))[_0xc7a4('0x41')](handleError(_0x538f65,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 055c3c5..708047f 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 _0x88c3=['../../config/logger','bluebird','rimraf','../../config/environment','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash'];(function(_0x3d2ae4,_0x482ad9){var _0x51ba61=function(_0x9d24aa){while(--_0x9d24aa){_0x3d2ae4['push'](_0x3d2ae4['shift']());}};_0x51ba61(++_0x482ad9);}(_0x88c3,0x1ee));var _0x388c=function(_0x3c8d12,_0x2027d1){_0x3c8d12=_0x3c8d12-0x0;var _0x5e04de=_0x88c3[_0x3c8d12];return _0x5e04de;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var logger=require(_0x388c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x388c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x388c('0x3'));var config=require(_0x388c('0x4'));var attributes=require(_0x388c('0x5'));module[_0x388c('0x6')]=function(_0x28ed4d,_0x23199c){return _0x28ed4d['define'](_0x388c('0x7'),attributes,{'tableName':_0x388c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81b7=['api','moment','request-promise','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','util','../../config/logger'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x81b7,0x1f2));var _0x781b=function(_0x30ace3,_0x599e70){_0x30ace3=_0x30ace3-0x0;var _0x4c76a3=_0x81b7[_0x30ace3];return _0x4c76a3;};'use strict';var _=require('lodash');var util=require(_0x781b('0x0'));var logger=require(_0x781b('0x1'))(_0x781b('0x2'));var moment=require(_0x781b('0x3'));var BPromise=require('bluebird');var rp=require(_0x781b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x781b('0x5'));var config=require(_0x781b('0x6'));var attributes=require(_0x781b('0x7'));module[_0x781b('0x8')]=function(_0x5eed8e,_0x3d9d36){return _0x5eed8e[_0x781b('0x9')]('MailSubstatus',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 541d47e..e6e95f3 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 _0x2750=['jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x197972,_0x50410e){var _0x2ab28e=function(_0xbd69d6){while(--_0xbd69d6){_0x197972['push'](_0x197972['shift']());}};_0x2ab28e(++_0x50410e);}(_0x2750,0x13b));var _0x0275=function(_0x38570f,_0x573cae){_0x38570f=_0x38570f-0x0;var _0x8cdea0=_0x2750[_0x38570f];return _0x8cdea0;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('MailSubstatus,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x42d5d1,_0x469e4e){var _0x3d65d2=function(_0x48ab88){while(--_0x48ab88){_0x42d5d1['push'](_0x42d5d1['shift']());}};_0x3d65d2(++_0x469e4e);}(_0xe706,0xa3));var _0x6e70=function(_0x1e668a,_0x3ee7ed){_0x1e668a=_0x1e668a-0x0;var _0xc5dbb1=_0xe706[_0x1e668a];return _0xc5dbb1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 815010a..fd9b6bd 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 _0x2193=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','describe','isAuthenticated','show','post','create','put','/:id','destroy','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x46afd0,_0x1e5ae9){var _0x1b4406=function(_0x288e96){while(--_0x288e96){_0x46afd0['push'](_0x46afd0['shift']());}};_0x1b4406(++_0x1e5ae9);}(_0x2193,0x19d));var _0x3219=function(_0x4edd03,_0xa12e2d){_0x4edd03=_0x4edd03-0x0;var _0x333ae8=_0x2193[_0x4edd03];return _0x333ae8;};'use strict';var multer=require('multer');var util=require(_0x3219('0x0'));var path=require(_0x3219('0x1'));var timeout=require(_0x3219('0x2'));var express=require('express');var router=express[_0x3219('0x3')]();var auth=require(_0x3219('0x4'));var interaction=require(_0x3219('0x5'));var config=require(_0x3219('0x6'));var controller=require(_0x3219('0x7'));router[_0x3219('0x8')]('/',auth['isAuthenticated'](),controller[_0x3219('0x9')]);router['get'](_0x3219('0xa'),auth['isAuthenticated'](),controller[_0x3219('0xb')]);router[_0x3219('0x8')]('/:id',auth[_0x3219('0xc')](),controller[_0x3219('0xd')]);router[_0x3219('0xe')]('/',auth[_0x3219('0xc')](),controller[_0x3219('0xf')]);router[_0x3219('0x10')](_0x3219('0x11'),auth[_0x3219('0xc')](),controller['update']);router['delete'](_0x3219('0x11'),auth[_0x3219('0xc')](),controller[_0x3219('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb65e=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','show','post','isAuthenticated','create','put','update','delete','destroy'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xb65e,0x17b));var _0xeb65=function(_0x17b86a,_0x412dce){_0x17b86a=_0x17b86a-0x0;var _0x48f15b=_0xb65e[_0x17b86a];return _0x48f15b;};'use strict';var multer=require(_0xeb65('0x0'));var util=require(_0xeb65('0x1'));var path=require(_0xeb65('0x2'));var timeout=require(_0xeb65('0x3'));var express=require(_0xeb65('0x4'));var router=express[_0xeb65('0x5')]();var auth=require(_0xeb65('0x6'));var interaction=require(_0xeb65('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xeb65('0x8')]('/',auth['isAuthenticated'](),controller[_0xeb65('0x9')]);router[_0xeb65('0x8')](_0xeb65('0xa'),auth['isAuthenticated'](),controller[_0xeb65('0xb')]);router[_0xeb65('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xeb65('0xc')]);router[_0xeb65('0xd')]('/',auth[_0xeb65('0xe')](),controller[_0xeb65('0xf')]);router[_0xeb65('0x10')]('/:id',auth[_0xeb65('0xe')](),controller[_0xeb65('0x11')]);router[_0xeb65('0x12')]('/:id',auth[_0xeb65('0xe')](),controller[_0xeb65('0x13')]);module[_0xeb65('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 2b520b5..8af52bc 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 _0x1c44=['DATE','NOW','sequelize','STRING','account','queue'];(function(_0xee122e,_0x58ef2e){var _0x34f98a=function(_0x18163e){while(--_0x18163e){_0xee122e['push'](_0xee122e['shift']());}};_0x34f98a(++_0x58ef2e);}(_0x1c44,0x1b8));var _0x41c4=function(_0x144953,_0x2fe553){_0x144953=_0x144953-0x0;var _0x38d94b=_0x1c44[_0x144953];return _0x38d94b;};'use strict';var moment=require('moment');var Sequelize=require(_0x41c4('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x41c4('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x41c4('0x2'),'agent',_0x41c4('0x3')),'allowNull':![],'defaultValue':_0x41c4('0x3')},'transferredAt':{'type':Sequelize[_0x41c4('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x41c4('0x5')]}}; \ No newline at end of file +var _0x1478=['ENUM','account','DATE','NOW','exports','STRING'];(function(_0x57d44f,_0x45cc49){var _0x4ef927=function(_0x4b4f91){while(--_0x4b4f91){_0x57d44f['push'](_0x57d44f['shift']());}};_0x4ef927(++_0x45cc49);}(_0x1478,0x1d2));var _0x8147=function(_0x4737a0,_0x36520e){_0x4737a0=_0x4737a0-0x0;var _0x4d558b=_0x1478[_0x4737a0];return _0x4d558b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8147('0x0')]={'uniqueid':{'type':Sequelize[_0x8147('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8147('0x2')](_0x8147('0x3'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x8147('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x8147('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 20d4536..40f7690 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 _0xc99a=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','name','index','MailTransferReport','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse'];(function(_0xaa54f6,_0x32ae68){var _0x4d0d75=function(_0x303b86){while(--_0x303b86){_0xaa54f6['push'](_0xaa54f6['shift']());}};_0x4d0d75(++_0x32ae68);}(_0xc99a,0xcb));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xac99('0x0'));var emlformat=require(_0xac99('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xac99('0x2'));var jsonpatch=require(_0xac99('0x3'));var rp=require(_0xac99('0x4'));var moment=require(_0xac99('0x5'));var BPromise=require(_0xac99('0x6'));var Mustache=require(_0xac99('0x7'));var util=require('util');var path=require(_0xac99('0x8'));var sox=require(_0xac99('0x9'));var csv=require('to-csv');var ejs=require(_0xac99('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xac99('0xb'));var crypto=require(_0xac99('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xac99('0xd'));var toCsv=require(_0xac99('0xe'));var querystring=require('querystring');var Papa=require(_0xac99('0xf'));var Redis=require('ioredis');var authService=require(_0xac99('0x10'));var qs=require(_0xac99('0x11'));var hardwareService=require(_0xac99('0x12'));var logger=require(_0xac99('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xac99('0x14'));var db=require(_0xac99('0x15'))['db'];function respondWithStatusCode(_0x5af122,_0x44cd9f){_0x44cd9f=_0x44cd9f||0xcc;return function(_0x403134){if(_0x403134){return _0x5af122['sendStatus'](_0x44cd9f);}return _0x5af122[_0xac99('0x16')](_0x44cd9f)['end']();};}function respondWithResult(_0x5ef319,_0x4b536c){_0x4b536c=_0x4b536c||0xc8;return function(_0x67bdba){if(_0x67bdba){return _0x5ef319['status'](_0x4b536c)['json'](_0x67bdba);}};}function respondWithFilteredResult(_0x3cac73,_0x3a4f73){return function(_0x20a47a){if(_0x20a47a){var _0x255151=_0x20a47a[_0xac99('0x17')],_0x544bfd=_0x3a4f73[_0xac99('0x18')],_0x5dc2c4=_0x3a4f73[_0xac99('0x18')]+_0x3a4f73['limit'],_0x1314be;if(_0x5dc2c4>=_0x255151){_0x5dc2c4=_0x255151;_0x1314be=0xc8;}else{_0x1314be=0xce;}_0x3cac73['status'](_0x1314be);return _0x3cac73[_0xac99('0x19')](_0xac99('0x1a'),_0x544bfd+'-'+_0x5dc2c4+'/'+_0x255151)[_0xac99('0x1b')](_0x20a47a);}return null;};}function patchUpdates(_0xb9628){return function(_0x2f9191){try{jsonpatch[_0xac99('0x1c')](_0x2f9191,_0xb9628,!![]);}catch(_0x40752d){return BPromise[_0xac99('0x1d')](_0x40752d);}return _0x2f9191[_0xac99('0x1e')]();};}function saveUpdates(_0x284500,_0x362302){return function(_0x51f085){if(_0x51f085){return _0x51f085['update'](_0x284500)[_0xac99('0x1f')](function(_0x261cb3){return _0x261cb3;});}return null;};}function removeEntity(_0x18bda4,_0x179fd8){return function(_0x4256dd){if(_0x4256dd){return _0x4256dd[_0xac99('0x20')]()[_0xac99('0x1f')](function(){_0x18bda4[_0xac99('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45e8a,_0x3d4482){return function(_0x2f78c2){if(!_0x2f78c2){_0x45e8a[_0xac99('0x21')](0x194);}return _0x2f78c2;};}function handleError(_0x15f27b,_0x4b6735){_0x4b6735=_0x4b6735||0x1f4;return function(_0x3de13d){logger[_0xac99('0x22')](_0x3de13d['stack']);if(_0x3de13d[_0xac99('0x23')]){delete _0x3de13d['name'];}_0x15f27b[_0xac99('0x16')](_0x4b6735)['send'](_0x3de13d);};}exports[_0xac99('0x24')]=function(_0x4aaabc,_0x439a59){var _0x1478c6={},_0x5b88a6={},_0x22ed90={'count':0x0,'rows':[]};var _0x4502b6=db[_0xac99('0x25')][_0xac99('0x26')];_0x5b88a6[_0xac99('0x27')]=_['keys'](_0x4502b6);_0x5b88a6['query']=_[_0xac99('0x28')](_0x4aaabc[_0xac99('0x29')]);_0x5b88a6['filters']=_[_0xac99('0x2a')](_0x5b88a6[_0xac99('0x27')],_0x5b88a6[_0xac99('0x29')]);_0x1478c6[_0xac99('0x2b')]=_[_0xac99('0x2a')](_0x5b88a6[_0xac99('0x27')],qs[_0xac99('0x2c')](_0x4aaabc[_0xac99('0x29')][_0xac99('0x2c')]));_0x1478c6[_0xac99('0x2b')]=_0x1478c6['attributes'][_0xac99('0x2d')]?_0x1478c6[_0xac99('0x2b')]:_0x5b88a6[_0xac99('0x27')];if(!_0x4aaabc[_0xac99('0x29')][_0xac99('0x2e')](_0xac99('0x2f'))){_0x1478c6[_0xac99('0x30')]=qs[_0xac99('0x30')](_0x4aaabc[_0xac99('0x29')]['limit']);_0x1478c6[_0xac99('0x18')]=qs[_0xac99('0x18')](_0x4aaabc[_0xac99('0x29')]['offset']);}_0x1478c6[_0xac99('0x31')]=qs[_0xac99('0x32')](_0x4aaabc[_0xac99('0x29')][_0xac99('0x32')]);_0x1478c6[_0xac99('0x33')]=qs[_0xac99('0x34')](_[_0xac99('0x35')](_0x4aaabc['query'],_0x5b88a6[_0xac99('0x34')]));if(_0x4aaabc[_0xac99('0x29')][_0xac99('0x36')]){_0x1478c6[_0xac99('0x33')]=_[_0xac99('0x37')](_0x1478c6[_0xac99('0x33')],{'$or':_[_0xac99('0x38')](_0x4502b6,function(_0x12a8d2){if(_0x12a8d2['type'][_0xac99('0x39')]!==_0xac99('0x3a')){var _0xa7055e={};_0xa7055e[_0x12a8d2[_0xac99('0x3b')]]={'$like':'%'+_0x4aaabc[_0xac99('0x29')][_0xac99('0x36')]+'%'};return _0xa7055e;}})});}_0x1478c6=_[_0xac99('0x37')]({},_0x1478c6,_0x4aaabc[_0xac99('0x3c')]);var _0x4ae42c={'where':_0x1478c6[_0xac99('0x33')]};return db['MailTransferReport']['count'](_0x4ae42c)[_0xac99('0x1f')](function(_0x32faa7){_0x22ed90[_0xac99('0x17')]=_0x32faa7;if(_0x4aaabc['query'][_0xac99('0x3d')]){_0x1478c6['include']=[{'all':!![]}];}return db[_0xac99('0x25')][_0xac99('0x3e')](_0x1478c6);})[_0xac99('0x1f')](function(_0x651738){_0x22ed90[_0xac99('0x3f')]=_0x651738;return _0x22ed90;})[_0xac99('0x1f')](respondWithFilteredResult(_0x439a59,_0x1478c6))[_0xac99('0x40')](handleError(_0x439a59,null));};exports[_0xac99('0x41')]=function(_0x2cccc6,_0x20cb65){var _0x47db44={'raw':!![],'where':{'id':_0x2cccc6[_0xac99('0x42')]['id']}},_0x5a3f3b={};_0x5a3f3b[_0xac99('0x27')]=_[_0xac99('0x28')](db[_0xac99('0x25')][_0xac99('0x26')]);_0x5a3f3b[_0xac99('0x29')]=_[_0xac99('0x28')](_0x2cccc6['query']);_0x5a3f3b[_0xac99('0x34')]=_['intersection'](_0x5a3f3b[_0xac99('0x27')],_0x5a3f3b[_0xac99('0x29')]);_0x47db44['attributes']=_[_0xac99('0x2a')](_0x5a3f3b[_0xac99('0x27')],qs[_0xac99('0x2c')](_0x2cccc6[_0xac99('0x29')]['fields']));_0x47db44[_0xac99('0x2b')]=_0x47db44['attributes']['length']?_0x47db44[_0xac99('0x2b')]:_0x5a3f3b['model'];if(_0x2cccc6[_0xac99('0x29')][_0xac99('0x3d')]){_0x47db44[_0xac99('0x43')]=[{'all':!![]}];}_0x47db44=_[_0xac99('0x37')]({},_0x47db44,_0x2cccc6[_0xac99('0x3c')]);return db[_0xac99('0x25')][_0xac99('0x44')](_0x47db44)[_0xac99('0x1f')](handleEntityNotFound(_0x20cb65,null))['then'](respondWithResult(_0x20cb65,null))['catch'](handleError(_0x20cb65,null));};exports[_0xac99('0x45')]=function(_0x31bf02,_0x15281f){return db[_0xac99('0x25')][_0xac99('0x45')](_0x31bf02[_0xac99('0x46')],{})[_0xac99('0x1f')](respondWithResult(_0x15281f,0xc9))[_0xac99('0x40')](handleError(_0x15281f,null));};exports[_0xac99('0x47')]=function(_0x3b2735,_0x4ea098){if(_0x3b2735[_0xac99('0x46')]['id']){delete _0x3b2735[_0xac99('0x46')]['id'];}return db[_0xac99('0x25')][_0xac99('0x44')]({'where':{'id':_0x3b2735['params']['id']}})[_0xac99('0x1f')](handleEntityNotFound(_0x4ea098,null))[_0xac99('0x1f')](saveUpdates(_0x3b2735[_0xac99('0x46')],null))['then'](respondWithResult(_0x4ea098,null))['catch'](handleError(_0x4ea098,null));};exports[_0xac99('0x20')]=function(_0x34a124,_0x3fd963){return db['MailTransferReport'][_0xac99('0x44')]({'where':{'id':_0x34a124[_0xac99('0x42')]['id']}})[_0xac99('0x1f')](handleEntityNotFound(_0x3fd963,null))['then'](removeEntity(_0x3fd963,null))[_0xac99('0x40')](handleError(_0x3fd963,null));};exports[_0xac99('0x48')]=function(_0x477824,_0x536185){return db[_0xac99('0x25')]['describe']()[_0xac99('0x1f')](respondWithResult(_0x536185,null))[_0xac99('0x40')](handleError(_0x536185,null));}; \ No newline at end of file +var _0x0807=['intersection','attributes','fields','length','nolimit','limit','order','sort','filter','where','map','key','VIRTUAL','field','merge','options','count','includeAll','rows','show','params','include','find','catch','create','body','describe','eml-format','fast-json-patch','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','MailTransferReport','rawAttributes','model','keys','query','filters'];(function(_0x356875,_0x51add2){var _0x3cfd3d=function(_0x3ebf5b){while(--_0x3ebf5b){_0x356875['push'](_0x356875['shift']());}};_0x3cfd3d(++_0x51add2);}(_0x0807,0x13b));var _0x7080=function(_0xb74dee,_0x54855b){_0xb74dee=_0xb74dee-0x0;var _0x5d599c=_0x0807[_0xb74dee];return _0x5d599c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7080('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7080('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7080('0x2'));var Mustache=require(_0x7080('0x3'));var util=require('util');var path=require(_0x7080('0x4'));var sox=require(_0x7080('0x5'));var csv=require('to-csv');var ejs=require(_0x7080('0x6'));var fs=require('fs');var _=require(_0x7080('0x7'));var squel=require(_0x7080('0x8'));var crypto=require(_0x7080('0x9'));var jsforce=require(_0x7080('0xa'));var deskjs=require(_0x7080('0xb'));var toCsv=require(_0x7080('0xc'));var querystring=require('querystring');var Papa=require(_0x7080('0xd'));var Redis=require(_0x7080('0xe'));var authService=require(_0x7080('0xf'));var qs=require(_0x7080('0x10'));var hardwareService=require(_0x7080('0x11'));var logger=require('../../config/logger')(_0x7080('0x12'));var utils=require(_0x7080('0x13'));var config=require(_0x7080('0x14'));var db=require(_0x7080('0x15'))['db'];function respondWithStatusCode(_0x1dee0f,_0x14860f){_0x14860f=_0x14860f||0xcc;return function(_0x4acfbf){if(_0x4acfbf){return _0x1dee0f[_0x7080('0x16')](_0x14860f);}return _0x1dee0f[_0x7080('0x17')](_0x14860f)[_0x7080('0x18')]();};}function respondWithResult(_0x163685,_0x596530){_0x596530=_0x596530||0xc8;return function(_0x23634d){if(_0x23634d){return _0x163685[_0x7080('0x17')](_0x596530)[_0x7080('0x19')](_0x23634d);}};}function respondWithFilteredResult(_0x3169b4,_0x3e5dce){return function(_0x2180e9){if(_0x2180e9){var _0x13e258=_0x2180e9['count'],_0x15fa01=_0x3e5dce['offset'],_0x3f9cf2=_0x3e5dce[_0x7080('0x1a')]+_0x3e5dce['limit'],_0x3d1f24;if(_0x3f9cf2>=_0x13e258){_0x3f9cf2=_0x13e258;_0x3d1f24=0xc8;}else{_0x3d1f24=0xce;}_0x3169b4[_0x7080('0x17')](_0x3d1f24);return _0x3169b4[_0x7080('0x1b')](_0x7080('0x1c'),_0x15fa01+'-'+_0x3f9cf2+'/'+_0x13e258)[_0x7080('0x19')](_0x2180e9);}return null;};}function patchUpdates(_0x5877c0){return function(_0x36f106){try{jsonpatch[_0x7080('0x1d')](_0x36f106,_0x5877c0,!![]);}catch(_0x584cd7){return BPromise[_0x7080('0x1e')](_0x584cd7);}return _0x36f106[_0x7080('0x1f')]();};}function saveUpdates(_0x354810,_0x378fa6){return function(_0x49d18b){if(_0x49d18b){return _0x49d18b[_0x7080('0x20')](_0x354810)[_0x7080('0x21')](function(_0x60202){return _0x60202;});}return null;};}function removeEntity(_0x289b61,_0x1de0d1){return function(_0x37eada){if(_0x37eada){return _0x37eada[_0x7080('0x22')]()[_0x7080('0x21')](function(){_0x289b61[_0x7080('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a54bd,_0x323b76){return function(_0x4e3172){if(!_0x4e3172){_0x3a54bd[_0x7080('0x16')](0x194);}return _0x4e3172;};}function handleError(_0x1b7ad8,_0x4f8fcd){_0x4f8fcd=_0x4f8fcd||0x1f4;return function(_0x379171){logger[_0x7080('0x23')](_0x379171[_0x7080('0x24')]);if(_0x379171['name']){delete _0x379171[_0x7080('0x25')];}_0x1b7ad8['status'](_0x4f8fcd)[_0x7080('0x26')](_0x379171);};}exports['index']=function(_0x59588e,_0x570a24){var _0x22b0a6={},_0x2a4dc5={},_0x26de6d={'count':0x0,'rows':[]};var _0x2c4bff=db[_0x7080('0x27')][_0x7080('0x28')];_0x2a4dc5[_0x7080('0x29')]=_['keys'](_0x2c4bff);_0x2a4dc5['query']=_[_0x7080('0x2a')](_0x59588e[_0x7080('0x2b')]);_0x2a4dc5[_0x7080('0x2c')]=_[_0x7080('0x2d')](_0x2a4dc5[_0x7080('0x29')],_0x2a4dc5[_0x7080('0x2b')]);_0x22b0a6[_0x7080('0x2e')]=_[_0x7080('0x2d')](_0x2a4dc5['model'],qs['fields'](_0x59588e[_0x7080('0x2b')][_0x7080('0x2f')]));_0x22b0a6[_0x7080('0x2e')]=_0x22b0a6[_0x7080('0x2e')][_0x7080('0x30')]?_0x22b0a6['attributes']:_0x2a4dc5[_0x7080('0x29')];if(!_0x59588e[_0x7080('0x2b')]['hasOwnProperty'](_0x7080('0x31'))){_0x22b0a6[_0x7080('0x32')]=qs[_0x7080('0x32')](_0x59588e[_0x7080('0x2b')]['limit']);_0x22b0a6['offset']=qs[_0x7080('0x1a')](_0x59588e[_0x7080('0x2b')][_0x7080('0x1a')]);}_0x22b0a6[_0x7080('0x33')]=qs[_0x7080('0x34')](_0x59588e[_0x7080('0x2b')][_0x7080('0x34')]);_0x22b0a6['where']=qs[_0x7080('0x2c')](_['pick'](_0x59588e[_0x7080('0x2b')],_0x2a4dc5[_0x7080('0x2c')]));if(_0x59588e[_0x7080('0x2b')][_0x7080('0x35')]){_0x22b0a6[_0x7080('0x36')]=_['merge'](_0x22b0a6[_0x7080('0x36')],{'$or':_[_0x7080('0x37')](_0x2c4bff,function(_0x4f5f55){if(_0x4f5f55['type'][_0x7080('0x38')]!==_0x7080('0x39')){var _0x338dbc={};_0x338dbc[_0x4f5f55[_0x7080('0x3a')]]={'$like':'%'+_0x59588e['query'][_0x7080('0x35')]+'%'};return _0x338dbc;}})});}_0x22b0a6=_[_0x7080('0x3b')]({},_0x22b0a6,_0x59588e[_0x7080('0x3c')]);var _0x6d0573={'where':_0x22b0a6[_0x7080('0x36')]};return db[_0x7080('0x27')]['count'](_0x6d0573)[_0x7080('0x21')](function(_0x1946ec){_0x26de6d[_0x7080('0x3d')]=_0x1946ec;if(_0x59588e[_0x7080('0x2b')][_0x7080('0x3e')]){_0x22b0a6['include']=[{'all':!![]}];}return db[_0x7080('0x27')]['findAll'](_0x22b0a6);})[_0x7080('0x21')](function(_0xd5569){_0x26de6d[_0x7080('0x3f')]=_0xd5569;return _0x26de6d;})[_0x7080('0x21')](respondWithFilteredResult(_0x570a24,_0x22b0a6))['catch'](handleError(_0x570a24,null));};exports[_0x7080('0x40')]=function(_0x28e51c,_0x5006b7){var _0x104b1f={'raw':!![],'where':{'id':_0x28e51c[_0x7080('0x41')]['id']}},_0x1d8c5f={};_0x1d8c5f[_0x7080('0x29')]=_['keys'](db['MailTransferReport']['rawAttributes']);_0x1d8c5f['query']=_[_0x7080('0x2a')](_0x28e51c[_0x7080('0x2b')]);_0x1d8c5f[_0x7080('0x2c')]=_[_0x7080('0x2d')](_0x1d8c5f[_0x7080('0x29')],_0x1d8c5f[_0x7080('0x2b')]);_0x104b1f[_0x7080('0x2e')]=_[_0x7080('0x2d')](_0x1d8c5f[_0x7080('0x29')],qs[_0x7080('0x2f')](_0x28e51c['query'][_0x7080('0x2f')]));_0x104b1f[_0x7080('0x2e')]=_0x104b1f['attributes'][_0x7080('0x30')]?_0x104b1f[_0x7080('0x2e')]:_0x1d8c5f[_0x7080('0x29')];if(_0x28e51c[_0x7080('0x2b')][_0x7080('0x3e')]){_0x104b1f[_0x7080('0x42')]=[{'all':!![]}];}_0x104b1f=_[_0x7080('0x3b')]({},_0x104b1f,_0x28e51c[_0x7080('0x3c')]);return db['MailTransferReport'][_0x7080('0x43')](_0x104b1f)[_0x7080('0x21')](handleEntityNotFound(_0x5006b7,null))[_0x7080('0x21')](respondWithResult(_0x5006b7,null))[_0x7080('0x44')](handleError(_0x5006b7,null));};exports[_0x7080('0x45')]=function(_0x332cdf,_0x52bc99){return db[_0x7080('0x27')][_0x7080('0x45')](_0x332cdf[_0x7080('0x46')],{})[_0x7080('0x21')](respondWithResult(_0x52bc99,0xc9))[_0x7080('0x44')](handleError(_0x52bc99,null));};exports[_0x7080('0x20')]=function(_0x1b9715,_0x2f2e9a){if(_0x1b9715['body']['id']){delete _0x1b9715[_0x7080('0x46')]['id'];}return db['MailTransferReport'][_0x7080('0x43')]({'where':{'id':_0x1b9715['params']['id']}})[_0x7080('0x21')](handleEntityNotFound(_0x2f2e9a,null))['then'](saveUpdates(_0x1b9715['body'],null))[_0x7080('0x21')](respondWithResult(_0x2f2e9a,null))[_0x7080('0x44')](handleError(_0x2f2e9a,null));};exports[_0x7080('0x22')]=function(_0x3ae662,_0x4ab467){return db['MailTransferReport']['find']({'where':{'id':_0x3ae662[_0x7080('0x41')]['id']}})[_0x7080('0x21')](handleEntityNotFound(_0x4ab467,null))[_0x7080('0x21')](removeEntity(_0x4ab467,null))[_0x7080('0x44')](handleError(_0x4ab467,null));};exports[_0x7080('0x47')]=function(_0x376529,_0x424fdd){return db[_0x7080('0x27')][_0x7080('0x47')]()[_0x7080('0x21')](respondWithResult(_0x424fdd,null))[_0x7080('0x44')](handleError(_0x424fdd,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8315870..bff9c1c 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 _0x0ac7=['moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5a82fe,_0x20828f){var _0x38e974=function(_0x286003){while(--_0x286003){_0x5a82fe['push'](_0x5a82fe['shift']());}};_0x38e974(++_0x20828f);}(_0x0ac7,0xfb));var _0x70ac=function(_0xedf900,_0x1185d5){_0xedf900=_0xedf900-0x0;var _0x1e02ba=_0x0ac7[_0xedf900];return _0x1e02ba;};'use strict';var _=require(_0x70ac('0x0'));var util=require(_0x70ac('0x1'));var logger=require(_0x70ac('0x2'))(_0x70ac('0x3'));var moment=require(_0x70ac('0x4'));var BPromise=require(_0x70ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70ac('0x6'));var rimraf=require(_0x70ac('0x7'));var config=require(_0x70ac('0x8'));var attributes=require(_0x70ac('0x9'));module[_0x70ac('0xa')]=function(_0x48a535,_0xf6c734){return _0x48a535[_0x70ac('0xb')](_0x70ac('0xc'),attributes,{'tableName':_0x70ac('0xd'),'paranoid':![],'indexes':[{'name':_0x70ac('0xe'),'fields':[_0x70ac('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa84f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x4db4a9,_0x49285e){var _0x4610d2=function(_0x34016b){while(--_0x34016b){_0x4db4a9['push'](_0x4db4a9['shift']());}};_0x4610d2(++_0x49285e);}(_0xa84f,0x1dd));var _0xfa84=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0xa84f[_0x3c8832];return _0xacf303;};'use strict';var _=require(_0xfa84('0x0'));var util=require(_0xfa84('0x1'));var logger=require(_0xfa84('0x2'))(_0xfa84('0x3'));var moment=require(_0xfa84('0x4'));var BPromise=require(_0xfa84('0x5'));var rp=require(_0xfa84('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa84('0x7'));var config=require(_0xfa84('0x8'));var attributes=require(_0xfa84('0x9'));module[_0xfa84('0xa')]=function(_0x206295,_0x262c2d){return _0x206295[_0xfa84('0xb')](_0xfa84('0xc'),attributes,{'tableName':_0xfa84('0xd'),'paranoid':![],'indexes':[{'name':_0xfa84('0xe'),'fields':[_0xfa84('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7bc725d..2e5359c 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 _0x5466=['../../config/logger','rpc','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5466,0x93));var _0x6546=function(_0xd7ec24,_0x5e14b5){_0xd7ec24=_0xd7ec24-0x0;var _0x33020d=_0x5466[_0xd7ec24];return _0x33020d;};'use strict';var _=require(_0x6546('0x0'));var util=require(_0x6546('0x1'));var moment=require(_0x6546('0x2'));var BPromise=require('bluebird');var rs=require(_0x6546('0x3'));var fs=require('fs');var Redis=require(_0x6546('0x4'));var db=require(_0x6546('0x5'))['db'];var utils=require(_0x6546('0x6'));var logger=require(_0x6546('0x7'))(_0x6546('0x8'));var config=require('../../config/environment');var jayson=require(_0x6546('0x9'));var client=jayson[_0x6546('0xa')][_0x6546('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x383f9f,_0x111025,_0x1a98ce){return new BPromise(function(_0x3b0e18,_0x2b5872){return client['request'](_0x383f9f,_0x1a98ce)[_0x6546('0xc')](function(_0x4fd64c){logger[_0x6546('0xd')](_0x6546('0xe'),_0x111025,_0x6546('0xf'));logger['debug'](_0x6546('0x10'),_0x111025,'request\x20sent',JSON[_0x6546('0x11')](_0x4fd64c));if(_0x4fd64c[_0x6546('0x12')]){if(_0x4fd64c[_0x6546('0x12')][_0x6546('0x13')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x111025,_0x4fd64c[_0x6546('0x12')]['message']);return _0x2b5872(_0x4fd64c[_0x6546('0x12')][_0x6546('0x14')]);}logger[_0x6546('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x111025,_0x4fd64c[_0x6546('0x12')][_0x6546('0x14')]);return _0x3b0e18(_0x4fd64c['error'][_0x6546('0x14')]);}else{logger['info'](_0x6546('0xe'),_0x111025,_0x6546('0xf'));_0x3b0e18(_0x4fd64c['result']['message']);}})[_0x6546('0x15')](function(_0xee3317){logger['error'](_0x6546('0xe'),_0x111025,_0xee3317);_0x2b5872(_0xee3317);});});} \ No newline at end of file +var _0xcc27=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x451a76,_0x361436){var _0xf80865=function(_0x278516){while(--_0x278516){_0x451a76['push'](_0x451a76['shift']());}};_0xf80865(++_0x361436);}(_0xcc27,0x10c));var _0x7cc2=function(_0x1381ad,_0x153441){_0x1381ad=_0x1381ad-0x0;var _0x7f4eec=_0xcc27[_0x1381ad];return _0x7f4eec;};'use strict';var _=require(_0x7cc2('0x0'));var util=require(_0x7cc2('0x1'));var moment=require(_0x7cc2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cc2('0x3'));var db=require(_0x7cc2('0x4'))['db'];var utils=require(_0x7cc2('0x5'));var logger=require(_0x7cc2('0x6'))(_0x7cc2('0x7'));var config=require(_0x7cc2('0x8'));var jayson=require(_0x7cc2('0x9'));var client=jayson[_0x7cc2('0xa')][_0x7cc2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc9e7d9,_0x3d7bdd,_0x1da6e9){return new BPromise(function(_0x5ceb56,_0x43187e){return client[_0x7cc2('0xc')](_0xc9e7d9,_0x1da6e9)['then'](function(_0xc303ee){logger[_0x7cc2('0xd')](_0x7cc2('0xe'),_0x3d7bdd,'request\x20sent');logger[_0x7cc2('0xf')](_0x7cc2('0x10'),_0x3d7bdd,_0x7cc2('0x11'),JSON[_0x7cc2('0x12')](_0xc303ee));if(_0xc303ee[_0x7cc2('0x13')]){if(_0xc303ee[_0x7cc2('0x13')][_0x7cc2('0x14')]===0x1f4){logger[_0x7cc2('0x13')](_0x7cc2('0xe'),_0x3d7bdd,_0xc303ee[_0x7cc2('0x13')][_0x7cc2('0x15')]);return _0x43187e(_0xc303ee[_0x7cc2('0x13')][_0x7cc2('0x15')]);}logger[_0x7cc2('0x13')](_0x7cc2('0xe'),_0x3d7bdd,_0xc303ee['error']['message']);return _0x5ceb56(_0xc303ee[_0x7cc2('0x13')][_0x7cc2('0x15')]);}else{logger[_0x7cc2('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x3d7bdd,_0x7cc2('0x11'));_0x5ceb56(_0xc303ee[_0x7cc2('0x16')][_0x7cc2('0x15')]);}})[_0x7cc2('0x17')](function(_0x44c951){logger['error'](_0x7cc2('0xe'),_0x3d7bdd,_0x44c951);_0x43187e(_0x44c951);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0e770c7..4ef3fe7 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 _0x0bcc=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x0bcc,0x12d));var _0xc0bc=function(_0x273a74,_0x60b699){_0x273a74=_0x273a74-0x0;var _0x2dec64=_0x0bcc[_0x273a74];return _0x2dec64;};'use strict';var multer=require(_0xc0bc('0x0'));var util=require(_0xc0bc('0x1'));var path=require(_0xc0bc('0x2'));var timeout=require(_0xc0bc('0x3'));var express=require(_0xc0bc('0x4'));var router=express[_0xc0bc('0x5')]();var auth=require(_0xc0bc('0x6'));var interaction=require(_0xc0bc('0x7'));var config=require('../../config/environment');var controller=require(_0xc0bc('0x8'));router[_0xc0bc('0x9')]('/',auth[_0xc0bc('0xa')](),controller[_0xc0bc('0xb')]);router[_0xc0bc('0x9')](_0xc0bc('0xc'),auth[_0xc0bc('0xa')](),controller[_0xc0bc('0xd')]);router[_0xc0bc('0x9')](_0xc0bc('0xe'),auth['isAuthenticated'](),controller[_0xc0bc('0xf')]);router[_0xc0bc('0x10')]('/',auth[_0xc0bc('0xa')](),controller[_0xc0bc('0x11')]);router[_0xc0bc('0x12')]('/:id',auth[_0xc0bc('0xa')](),controller[_0xc0bc('0x13')]);router[_0xc0bc('0x14')](_0xc0bc('0xe'),auth['isAuthenticated'](),controller[_0xc0bc('0x15')]);module[_0xc0bc('0x16')]=router; \ No newline at end of file +var _0xfb75=['index','get','/describe','isAuthenticated','show','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./memberReport.controller'];(function(_0x33a6c5,_0x1fd1c0){var _0xd3a636=function(_0x3d0286){while(--_0x3d0286){_0x33a6c5['push'](_0x33a6c5['shift']());}};_0xd3a636(++_0x1fd1c0);}(_0xfb75,0x16a));var _0x5fb7=function(_0x3d9101,_0x18eeb3){_0x3d9101=_0x3d9101-0x0;var _0x20fd15=_0xfb75[_0x3d9101];return _0x20fd15;};'use strict';var multer=require(_0x5fb7('0x0'));var util=require(_0x5fb7('0x1'));var path=require('path');var timeout=require(_0x5fb7('0x2'));var express=require(_0x5fb7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5fb7('0x4'));var config=require('../../config/environment');var controller=require(_0x5fb7('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x5fb7('0x6')]);router[_0x5fb7('0x7')](_0x5fb7('0x8'),auth[_0x5fb7('0x9')](),controller['describe']);router[_0x5fb7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5fb7('0xa')]);router['post']('/',auth[_0x5fb7('0x9')](),controller['create']);router[_0x5fb7('0xb')](_0x5fb7('0xc'),auth[_0x5fb7('0x9')](),controller[_0x5fb7('0xd')]);router['delete'](_0x5fb7('0xc'),auth[_0x5fb7('0x9')](),controller[_0x5fb7('0xe')]);module[_0x5fb7('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 1b5df76..53d7631 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 _0x4d7a=['seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','INTEGER','sequelize','moment','STRING','DATE','getDataValue','enterAt','diff'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4d7a,0x117));var _0xa4d7=function(_0x1d5b31,_0x10e36b){_0x1d5b31=_0x1d5b31-0x0;var _0xcfbb9b=_0x4d7a[_0x1d5b31];return _0xcfbb9b;};'use strict';var Sequelize=require(_0xa4d7('0x0'));var moment=require(_0xa4d7('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa4d7('0x2')]},'interface':{'type':Sequelize[_0xa4d7('0x2')]},'type':{'type':Sequelize[_0xa4d7('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xa4d7('0x3')]},'exitAt':{'type':Sequelize[_0xa4d7('0x3')],'set':function(_0x1915c3){var _0x22550d=moment(_0x1915c3);var _0x15d5dd=moment(this[_0xa4d7('0x4')](_0xa4d7('0x5')));var _0x3f30e7=_0x22550d[_0xa4d7('0x6')](_0x15d5dd,_0xa4d7('0x7'));this[_0xa4d7('0x8')]('exitAt',_0x1915c3);this[_0xa4d7('0x8')]('duration',_0x3f30e7||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xa4d7('0x9')},'data2':{'type':Sequelize[_0xa4d7('0x2')],'comment':_0xa4d7('0xa')},'data3':{'type':Sequelize[_0xa4d7('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xa4d7('0x2')],'comment':_0xa4d7('0xb')},'data5':{'type':Sequelize[_0xa4d7('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xa4d7('0x2')]},'internal':{'type':Sequelize[_0xa4d7('0xc')]},'uniqueid':{'type':Sequelize[_0xa4d7('0x2')]}}; \ No newline at end of file +var _0xe008=['enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x3b54d6,_0x24737b){var _0x4974ce=function(_0x379978){while(--_0x379978){_0x3b54d6['push'](_0x3b54d6['shift']());}};_0x4974ce(++_0x24737b);}(_0xe008,0x1e5));var _0x8e00=function(_0x333c71,_0x4b6c31){_0x333c71=_0x333c71-0x0;var _0x5ef39e=_0xe008[_0x333c71];return _0x5ef39e;};'use strict';var Sequelize=require(_0x8e00('0x0'));var moment=require(_0x8e00('0x1'));module[_0x8e00('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8e00('0x3')]},'type':{'type':Sequelize[_0x8e00('0x3')],'defaultValue':_0x8e00('0x4'),'comment':_0x8e00('0x5')},'duration':{'type':Sequelize[_0x8e00('0x6')]},'enterAt':{'type':Sequelize[_0x8e00('0x7')]},'exitAt':{'type':Sequelize[_0x8e00('0x7')],'set':function(_0xf79890){var _0x4d8241=moment(_0xf79890);var _0x3b57ce=moment(this[_0x8e00('0x8')](_0x8e00('0x9')));var _0x5a1008=_0x4d8241[_0x8e00('0xa')](_0x3b57ce,_0x8e00('0xb'));this[_0x8e00('0xc')](_0x8e00('0xd'),_0xf79890);this['setDataValue'](_0x8e00('0xe'),_0x5a1008||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x8e00('0xf')},'data2':{'type':Sequelize['STRING'],'comment':_0x8e00('0x10')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x8e00('0x3')],'comment':_0x8e00('0x11')},'data5':{'type':Sequelize[_0x8e00('0x3')],'comment':_0x8e00('0x12')},'role':{'type':Sequelize[_0x8e00('0x3')]},'internal':{'type':Sequelize[_0x8e00('0x6')]},'uniqueid':{'type':Sequelize[_0x8e00('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8e3019d..eab62ab 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 _0x008c=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','apply','destroy','then','end','error','send','index','MemberReport','rawAttributes','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x008c,0x188));var _0xc008=function(_0x7cdaf1,_0x40e620){_0x7cdaf1=_0x7cdaf1-0x0;var _0xf58e9a=_0x008c[_0x7cdaf1];return _0xf58e9a;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc008('0x12'))(_0xc008('0x13'));var utils=require('../../config/utils');var config=require(_0xc008('0x14'));var db=require(_0xc008('0x15'))['db'];function respondWithStatusCode(_0x2ea200,_0x2a5b4e){_0x2a5b4e=_0x2a5b4e||0xcc;return function(_0x9ffa93){if(_0x9ffa93){return _0x2ea200[_0xc008('0x16')](_0x2a5b4e);}return _0x2ea200[_0xc008('0x17')](_0x2a5b4e)['end']();};}function respondWithResult(_0x560e28,_0x33f44c){_0x33f44c=_0x33f44c||0xc8;return function(_0x50c1ab){if(_0x50c1ab){return _0x560e28[_0xc008('0x17')](_0x33f44c)[_0xc008('0x18')](_0x50c1ab);}};}function respondWithFilteredResult(_0x2073ef,_0x339ffc){return function(_0x3f0ecf){if(_0x3f0ecf){var _0x5ee00b=_0x3f0ecf[_0xc008('0x19')],_0x5e894e=_0x339ffc[_0xc008('0x1a')],_0x4bd0f4=_0x339ffc[_0xc008('0x1a')]+_0x339ffc['limit'],_0x11ef38;if(_0x4bd0f4>=_0x5ee00b){_0x4bd0f4=_0x5ee00b;_0x11ef38=0xc8;}else{_0x11ef38=0xce;}_0x2073ef['status'](_0x11ef38);return _0x2073ef['set']('Content-Range',_0x5e894e+'-'+_0x4bd0f4+'/'+_0x5ee00b)[_0xc008('0x18')](_0x3f0ecf);}return null;};}function patchUpdates(_0x462af5){return function(_0x501137){try{jsonpatch[_0xc008('0x1b')](_0x501137,_0x462af5,!![]);}catch(_0x5906e6){return BPromise['reject'](_0x5906e6);}return _0x501137['save']();};}function saveUpdates(_0x50261c,_0x5754a0){return function(_0x4b9726){if(_0x4b9726){return _0x4b9726['update'](_0x50261c)['then'](function(_0x4a582d){return _0x4a582d;});}return null;};}function removeEntity(_0x5a58bd,_0x13a263){return function(_0x4777a6){if(_0x4777a6){return _0x4777a6[_0xc008('0x1c')]()[_0xc008('0x1d')](function(){_0x5a58bd[_0xc008('0x17')](0xcc)[_0xc008('0x1e')]();});}};}function handleEntityNotFound(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(!_0x5c85f2){_0x4f43e2['sendStatus'](0x194);}return _0x5c85f2;};}function handleError(_0x218599,_0x36f358){_0x36f358=_0x36f358||0x1f4;return function(_0x2e3cfb){logger[_0xc008('0x1f')](_0x2e3cfb['stack']);if(_0x2e3cfb['name']){delete _0x2e3cfb['name'];}_0x218599[_0xc008('0x17')](_0x36f358)[_0xc008('0x20')](_0x2e3cfb);};}exports[_0xc008('0x21')]=function(_0x2e31c2,_0x5bebd9){var _0x5e2aca={},_0x4fce9c={},_0x4adbab={'count':0x0,'rows':[]};var _0x4caaf4=db[_0xc008('0x22')][_0xc008('0x23')];_0x4fce9c[_0xc008('0x24')]=_['keys'](_0x4caaf4);_0x4fce9c[_0xc008('0x25')]=_[_0xc008('0x26')](_0x2e31c2[_0xc008('0x25')]);_0x4fce9c[_0xc008('0x27')]=_['intersection'](_0x4fce9c[_0xc008('0x24')],_0x4fce9c[_0xc008('0x25')]);_0x5e2aca['attributes']=_['intersection'](_0x4fce9c['model'],qs[_0xc008('0x28')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x28')]));_0x5e2aca[_0xc008('0x29')]=_0x5e2aca[_0xc008('0x29')][_0xc008('0x2a')]?_0x5e2aca[_0xc008('0x29')]:_0x4fce9c[_0xc008('0x24')];if(!_0x2e31c2[_0xc008('0x25')][_0xc008('0x2b')](_0xc008('0x2c'))){_0x5e2aca[_0xc008('0x2d')]=qs['limit'](_0x2e31c2[_0xc008('0x25')][_0xc008('0x2d')]);_0x5e2aca['offset']=qs[_0xc008('0x1a')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x1a')]);}_0x5e2aca[_0xc008('0x2e')]=qs[_0xc008('0x2f')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x2f')]);_0x5e2aca[_0xc008('0x30')]=qs[_0xc008('0x27')](_['pick'](_0x2e31c2[_0xc008('0x25')],_0x4fce9c[_0xc008('0x27')]));if(_0x2e31c2[_0xc008('0x25')][_0xc008('0x31')]){_0x5e2aca[_0xc008('0x30')]=_[_0xc008('0x32')](_0x5e2aca[_0xc008('0x30')],{'$or':_['map'](_0x4caaf4,function(_0x35f360){if(_0x35f360[_0xc008('0x33')]['key']!==_0xc008('0x34')){var _0x15453c={};_0x15453c[_0x35f360['field']]={'$like':'%'+_0x2e31c2[_0xc008('0x25')][_0xc008('0x31')]+'%'};return _0x15453c;}})});}_0x5e2aca=_[_0xc008('0x32')]({},_0x5e2aca,_0x2e31c2['options']);var _0x53b353={'where':_0x5e2aca['where']};return db[_0xc008('0x22')]['count'](_0x53b353)[_0xc008('0x1d')](function(_0x3884dd){_0x4adbab[_0xc008('0x19')]=_0x3884dd;if(_0x2e31c2[_0xc008('0x25')][_0xc008('0x35')]){_0x5e2aca[_0xc008('0x36')]=[{'all':!![]}];}return db[_0xc008('0x22')][_0xc008('0x37')](_0x5e2aca);})[_0xc008('0x1d')](function(_0x387dfd){_0x4adbab[_0xc008('0x38')]=_0x387dfd;return _0x4adbab;})[_0xc008('0x1d')](respondWithFilteredResult(_0x5bebd9,_0x5e2aca))[_0xc008('0x39')](handleError(_0x5bebd9,null));};exports[_0xc008('0x3a')]=function(_0x4cace5,_0x3238b4){var _0x23c4db={'raw':!![],'where':{'id':_0x4cace5[_0xc008('0x3b')]['id']}},_0x30b7df={};_0x30b7df['model']=_[_0xc008('0x26')](db[_0xc008('0x22')][_0xc008('0x23')]);_0x30b7df[_0xc008('0x25')]=_[_0xc008('0x26')](_0x4cace5['query']);_0x30b7df[_0xc008('0x27')]=_[_0xc008('0x3c')](_0x30b7df[_0xc008('0x24')],_0x30b7df[_0xc008('0x25')]);_0x23c4db[_0xc008('0x29')]=_['intersection'](_0x30b7df[_0xc008('0x24')],qs[_0xc008('0x28')](_0x4cace5[_0xc008('0x25')][_0xc008('0x28')]));_0x23c4db['attributes']=_0x23c4db[_0xc008('0x29')][_0xc008('0x2a')]?_0x23c4db[_0xc008('0x29')]:_0x30b7df['model'];if(_0x4cace5[_0xc008('0x25')]['includeAll']){_0x23c4db[_0xc008('0x36')]=[{'all':!![]}];}_0x23c4db=_['merge']({},_0x23c4db,_0x4cace5[_0xc008('0x3d')]);return db[_0xc008('0x22')]['find'](_0x23c4db)[_0xc008('0x1d')](handleEntityNotFound(_0x3238b4,null))[_0xc008('0x1d')](respondWithResult(_0x3238b4,null))[_0xc008('0x39')](handleError(_0x3238b4,null));};exports['create']=function(_0x1cec64,_0x2a9b5c){return db[_0xc008('0x22')][_0xc008('0x3e')](_0x1cec64[_0xc008('0x3f')],{})[_0xc008('0x1d')](respondWithResult(_0x2a9b5c,0xc9))['catch'](handleError(_0x2a9b5c,null));};exports['update']=function(_0x5283a8,_0x4552ed){if(_0x5283a8[_0xc008('0x3f')]['id']){delete _0x5283a8[_0xc008('0x3f')]['id'];}return db[_0xc008('0x22')][_0xc008('0x40')]({'where':{'id':_0x5283a8[_0xc008('0x3b')]['id']}})[_0xc008('0x1d')](handleEntityNotFound(_0x4552ed,null))[_0xc008('0x1d')](saveUpdates(_0x5283a8['body'],null))['then'](respondWithResult(_0x4552ed,null))['catch'](handleError(_0x4552ed,null));};exports[_0xc008('0x1c')]=function(_0x2651cf,_0x158eae){return db['MemberReport'][_0xc008('0x40')]({'where':{'id':_0x2651cf[_0xc008('0x3b')]['id']}})[_0xc008('0x1d')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x1d')](removeEntity(_0x158eae,null))[_0xc008('0x39')](handleError(_0x158eae,null));};exports[_0xc008('0x41')]=function(_0x17ec90,_0x405e87){return db[_0xc008('0x22')][_0xc008('0x41')]()['then'](respondWithResult(_0x405e87,null))['catch'](handleError(_0x405e87,null));}; \ No newline at end of file +var _0x008c=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','apply','destroy','then','end','error','send','index','MemberReport','rawAttributes','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x008c,0x188));var _0xc008=function(_0x513119,_0x425e6f){_0x513119=_0x513119-0x0;var _0x587511=_0x008c[_0x513119];return _0x587511;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc008('0x12'))(_0xc008('0x13'));var utils=require('../../config/utils');var config=require(_0xc008('0x14'));var db=require(_0xc008('0x15'))['db'];function respondWithStatusCode(_0x2ea200,_0x2a5b4e){_0x2a5b4e=_0x2a5b4e||0xcc;return function(_0x9ffa93){if(_0x9ffa93){return _0x2ea200[_0xc008('0x16')](_0x2a5b4e);}return _0x2ea200[_0xc008('0x17')](_0x2a5b4e)['end']();};}function respondWithResult(_0x560e28,_0x33f44c){_0x33f44c=_0x33f44c||0xc8;return function(_0x50c1ab){if(_0x50c1ab){return _0x560e28[_0xc008('0x17')](_0x33f44c)[_0xc008('0x18')](_0x50c1ab);}};}function respondWithFilteredResult(_0x2073ef,_0x339ffc){return function(_0x3f0ecf){if(_0x3f0ecf){var _0x5ee00b=_0x3f0ecf[_0xc008('0x19')],_0x5e894e=_0x339ffc[_0xc008('0x1a')],_0x4bd0f4=_0x339ffc[_0xc008('0x1a')]+_0x339ffc['limit'],_0x11ef38;if(_0x4bd0f4>=_0x5ee00b){_0x4bd0f4=_0x5ee00b;_0x11ef38=0xc8;}else{_0x11ef38=0xce;}_0x2073ef['status'](_0x11ef38);return _0x2073ef['set']('Content-Range',_0x5e894e+'-'+_0x4bd0f4+'/'+_0x5ee00b)[_0xc008('0x18')](_0x3f0ecf);}return null;};}function patchUpdates(_0x462af5){return function(_0x501137){try{jsonpatch[_0xc008('0x1b')](_0x501137,_0x462af5,!![]);}catch(_0x5906e6){return BPromise['reject'](_0x5906e6);}return _0x501137['save']();};}function saveUpdates(_0x50261c,_0x5754a0){return function(_0x4b9726){if(_0x4b9726){return _0x4b9726['update'](_0x50261c)['then'](function(_0x4a582d){return _0x4a582d;});}return null;};}function removeEntity(_0x5a58bd,_0x13a263){return function(_0x4777a6){if(_0x4777a6){return _0x4777a6[_0xc008('0x1c')]()[_0xc008('0x1d')](function(){_0x5a58bd[_0xc008('0x17')](0xcc)[_0xc008('0x1e')]();});}};}function handleEntityNotFound(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(!_0x5c85f2){_0x4f43e2['sendStatus'](0x194);}return _0x5c85f2;};}function handleError(_0x218599,_0x36f358){_0x36f358=_0x36f358||0x1f4;return function(_0x2e3cfb){logger[_0xc008('0x1f')](_0x2e3cfb['stack']);if(_0x2e3cfb['name']){delete _0x2e3cfb['name'];}_0x218599[_0xc008('0x17')](_0x36f358)[_0xc008('0x20')](_0x2e3cfb);};}exports[_0xc008('0x21')]=function(_0x2e31c2,_0x5bebd9){var _0x5e2aca={},_0x4fce9c={},_0x4adbab={'count':0x0,'rows':[]};var _0x4caaf4=db[_0xc008('0x22')][_0xc008('0x23')];_0x4fce9c[_0xc008('0x24')]=_['keys'](_0x4caaf4);_0x4fce9c[_0xc008('0x25')]=_[_0xc008('0x26')](_0x2e31c2[_0xc008('0x25')]);_0x4fce9c[_0xc008('0x27')]=_['intersection'](_0x4fce9c[_0xc008('0x24')],_0x4fce9c[_0xc008('0x25')]);_0x5e2aca['attributes']=_['intersection'](_0x4fce9c['model'],qs[_0xc008('0x28')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x28')]));_0x5e2aca[_0xc008('0x29')]=_0x5e2aca[_0xc008('0x29')][_0xc008('0x2a')]?_0x5e2aca[_0xc008('0x29')]:_0x4fce9c[_0xc008('0x24')];if(!_0x2e31c2[_0xc008('0x25')][_0xc008('0x2b')](_0xc008('0x2c'))){_0x5e2aca[_0xc008('0x2d')]=qs['limit'](_0x2e31c2[_0xc008('0x25')][_0xc008('0x2d')]);_0x5e2aca['offset']=qs[_0xc008('0x1a')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x1a')]);}_0x5e2aca[_0xc008('0x2e')]=qs[_0xc008('0x2f')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x2f')]);_0x5e2aca[_0xc008('0x30')]=qs[_0xc008('0x27')](_['pick'](_0x2e31c2[_0xc008('0x25')],_0x4fce9c[_0xc008('0x27')]));if(_0x2e31c2[_0xc008('0x25')][_0xc008('0x31')]){_0x5e2aca[_0xc008('0x30')]=_[_0xc008('0x32')](_0x5e2aca[_0xc008('0x30')],{'$or':_['map'](_0x4caaf4,function(_0x35f360){if(_0x35f360[_0xc008('0x33')]['key']!==_0xc008('0x34')){var _0x15453c={};_0x15453c[_0x35f360['field']]={'$like':'%'+_0x2e31c2[_0xc008('0x25')][_0xc008('0x31')]+'%'};return _0x15453c;}})});}_0x5e2aca=_[_0xc008('0x32')]({},_0x5e2aca,_0x2e31c2['options']);var _0x53b353={'where':_0x5e2aca['where']};return db[_0xc008('0x22')]['count'](_0x53b353)[_0xc008('0x1d')](function(_0x3884dd){_0x4adbab[_0xc008('0x19')]=_0x3884dd;if(_0x2e31c2[_0xc008('0x25')][_0xc008('0x35')]){_0x5e2aca[_0xc008('0x36')]=[{'all':!![]}];}return db[_0xc008('0x22')][_0xc008('0x37')](_0x5e2aca);})[_0xc008('0x1d')](function(_0x387dfd){_0x4adbab[_0xc008('0x38')]=_0x387dfd;return _0x4adbab;})[_0xc008('0x1d')](respondWithFilteredResult(_0x5bebd9,_0x5e2aca))[_0xc008('0x39')](handleError(_0x5bebd9,null));};exports[_0xc008('0x3a')]=function(_0x4cace5,_0x3238b4){var _0x23c4db={'raw':!![],'where':{'id':_0x4cace5[_0xc008('0x3b')]['id']}},_0x30b7df={};_0x30b7df['model']=_[_0xc008('0x26')](db[_0xc008('0x22')][_0xc008('0x23')]);_0x30b7df[_0xc008('0x25')]=_[_0xc008('0x26')](_0x4cace5['query']);_0x30b7df[_0xc008('0x27')]=_[_0xc008('0x3c')](_0x30b7df[_0xc008('0x24')],_0x30b7df[_0xc008('0x25')]);_0x23c4db[_0xc008('0x29')]=_['intersection'](_0x30b7df[_0xc008('0x24')],qs[_0xc008('0x28')](_0x4cace5[_0xc008('0x25')][_0xc008('0x28')]));_0x23c4db['attributes']=_0x23c4db[_0xc008('0x29')][_0xc008('0x2a')]?_0x23c4db[_0xc008('0x29')]:_0x30b7df['model'];if(_0x4cace5[_0xc008('0x25')]['includeAll']){_0x23c4db[_0xc008('0x36')]=[{'all':!![]}];}_0x23c4db=_['merge']({},_0x23c4db,_0x4cace5[_0xc008('0x3d')]);return db[_0xc008('0x22')]['find'](_0x23c4db)[_0xc008('0x1d')](handleEntityNotFound(_0x3238b4,null))[_0xc008('0x1d')](respondWithResult(_0x3238b4,null))[_0xc008('0x39')](handleError(_0x3238b4,null));};exports['create']=function(_0x1cec64,_0x2a9b5c){return db[_0xc008('0x22')][_0xc008('0x3e')](_0x1cec64[_0xc008('0x3f')],{})[_0xc008('0x1d')](respondWithResult(_0x2a9b5c,0xc9))['catch'](handleError(_0x2a9b5c,null));};exports['update']=function(_0x5283a8,_0x4552ed){if(_0x5283a8[_0xc008('0x3f')]['id']){delete _0x5283a8[_0xc008('0x3f')]['id'];}return db[_0xc008('0x22')][_0xc008('0x40')]({'where':{'id':_0x5283a8[_0xc008('0x3b')]['id']}})[_0xc008('0x1d')](handleEntityNotFound(_0x4552ed,null))[_0xc008('0x1d')](saveUpdates(_0x5283a8['body'],null))['then'](respondWithResult(_0x4552ed,null))['catch'](handleError(_0x4552ed,null));};exports[_0xc008('0x1c')]=function(_0x2651cf,_0x158eae){return db['MemberReport'][_0xc008('0x40')]({'where':{'id':_0x2651cf[_0xc008('0x3b')]['id']}})[_0xc008('0x1d')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x1d')](removeEntity(_0x158eae,null))[_0xc008('0x39')](handleError(_0x158eae,null));};exports[_0xc008('0x41')]=function(_0x17ec90,_0x405e87){return db[_0xc008('0x22')][_0xc008('0x41')]()['then'](respondWithResult(_0x405e87,null))['catch'](handleError(_0x405e87,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ca9bdcd..8d687e6 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 _0xaf56=['interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','membername_interface'];(function(_0x29e8f7,_0x2dd440){var _0x444f60=function(_0x3d4a3){while(--_0x3d4a3){_0x29e8f7['push'](_0x29e8f7['shift']());}};_0x444f60(++_0x2dd440);}(_0xaf56,0x18d));var _0x6af5=function(_0x19cae9,_0xd6039b){_0x19cae9=_0x19cae9-0x0;var _0x163452=_0xaf56[_0x19cae9];return _0x163452;};'use strict';var _=require(_0x6af5('0x0'));var util=require(_0x6af5('0x1'));var logger=require(_0x6af5('0x2'))(_0x6af5('0x3'));var moment=require('moment');var BPromise=require(_0x6af5('0x4'));var rp=require(_0x6af5('0x5'));var fs=require('fs');var path=require(_0x6af5('0x6'));var rimraf=require(_0x6af5('0x7'));var config=require(_0x6af5('0x8'));var attributes=require(_0x6af5('0x9'));module['exports']=function(_0x400d81,_0xc3daa8){return _0x400d81['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x6af5('0xa'),'fields':['membername',_0x6af5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xedc1=['../../config/environment','exports','define','report_member','membername','interface','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2f8262,_0x4bfc95){var _0x525963=function(_0x2317eb){while(--_0x2317eb){_0x2f8262['push'](_0x2f8262['shift']());}};_0x525963(++_0x4bfc95);}(_0xedc1,0xd2));var _0x1edc=function(_0x32814c,_0x2a68f5){_0x32814c=_0x32814c-0x0;var _0x394c8d=_0xedc1[_0x32814c];return _0x394c8d;};'use strict';var _=require(_0x1edc('0x0'));var util=require('util');var logger=require(_0x1edc('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1edc('0x2'));var rp=require(_0x1edc('0x3'));var fs=require('fs');var path=require(_0x1edc('0x4'));var rimraf=require(_0x1edc('0x5'));var config=require(_0x1edc('0x6'));var attributes=require('./memberReport.attributes');module[_0x1edc('0x7')]=function(_0xa36d11,_0x2d45e6){return _0xa36d11[_0x1edc('0x8')]('MemberReport',attributes,{'tableName':_0x1edc('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x1edc('0xa'),_0x1edc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d09224d..1ffd444 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 _0xfc19=['create','body','UpdateMemberReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','findAll','options','raw','include','attributes','map','model','then','debug','GetMemberReport','catch','CreateMemberReport','MemberReport'];(function(_0x4d2ed7,_0x1999e5){var _0x12af27=function(_0x28e2d4){while(--_0x28e2d4){_0x4d2ed7['push'](_0x4d2ed7['shift']());}};_0x12af27(++_0x1999e5);}(_0xfc19,0x181));var _0x9fc1=function(_0x462448,_0x15e5d4){_0x462448=_0x462448-0x0;var _0x1b9817=_0xfc19[_0x462448];return _0x1b9817;};'use strict';var _=require(_0x9fc1('0x0'));var util=require(_0x9fc1('0x1'));var moment=require('moment');var BPromise=require(_0x9fc1('0x2'));var rs=require(_0x9fc1('0x3'));var fs=require('fs');var Redis=require(_0x9fc1('0x4'));var db=require(_0x9fc1('0x5'))['db'];var utils=require(_0x9fc1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fc1('0x7'));var jayson=require(_0x9fc1('0x8'));var client=jayson[_0x9fc1('0x9')][_0x9fc1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32aba2,_0x145fd6,_0x4a8d11){return new BPromise(function(_0x1562c4,_0x55e951){return client[_0x9fc1('0xb')](_0x32aba2,_0x4a8d11)['then'](function(_0x1f4b2a){logger[_0x9fc1('0xc')]('MemberReport,\x20%s,\x20%s',_0x145fd6,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x145fd6,_0x9fc1('0xd'),JSON[_0x9fc1('0xe')](_0x1f4b2a));if(_0x1f4b2a['error']){if(_0x1f4b2a[_0x9fc1('0xf')][_0x9fc1('0x10')]===0x1f4){logger[_0x9fc1('0xf')](_0x9fc1('0x11'),_0x145fd6,_0x1f4b2a[_0x9fc1('0xf')][_0x9fc1('0x12')]);return _0x55e951(_0x1f4b2a[_0x9fc1('0xf')][_0x9fc1('0x12')]);}logger[_0x9fc1('0xf')](_0x9fc1('0x11'),_0x145fd6,_0x1f4b2a['error'][_0x9fc1('0x12')]);return _0x1562c4(_0x1f4b2a[_0x9fc1('0xf')]['message']);}else{logger['info'](_0x9fc1('0x11'),_0x145fd6,_0x9fc1('0xd'));_0x1562c4(_0x1f4b2a[_0x9fc1('0x13')][_0x9fc1('0x12')]);}})['catch'](function(_0x2c418b){logger['error'](_0x9fc1('0x11'),_0x145fd6,_0x2c418b);_0x55e951(_0x2c418b);});});}exports['GetMemberReport']=function(_0x10233a){var _0x37a4a5=this;return new Promise(function(_0x5842bb,_0x3cee6a){return db['MemberReport'][_0x9fc1('0x14')]({'raw':_0x10233a[_0x9fc1('0x15')]?_0x10233a[_0x9fc1('0x15')][_0x9fc1('0x16')]===undefined?!![]:![]:!![],'where':_0x10233a['options']?_0x10233a[_0x9fc1('0x15')]['where']||null:null,'attributes':_0x10233a[_0x9fc1('0x15')]?_0x10233a[_0x9fc1('0x15')]['attributes']||null:null,'limit':_0x10233a['options']?_0x10233a[_0x9fc1('0x15')]['limit']||null:null,'include':_0x10233a[_0x9fc1('0x15')]?_0x10233a[_0x9fc1('0x15')]['include']?_['map'](_0x10233a[_0x9fc1('0x15')][_0x9fc1('0x17')],function(_0x2a9896){return{'model':db[_0x2a9896['model']],'as':_0x2a9896['as'],'attributes':_0x2a9896[_0x9fc1('0x18')],'include':_0x2a9896['include']?_[_0x9fc1('0x19')](_0x2a9896['include'],function(_0x57d2d7){return{'model':db[_0x57d2d7[_0x9fc1('0x1a')]],'as':_0x57d2d7['as'],'attributes':_0x57d2d7[_0x9fc1('0x18')],'include':_0x57d2d7[_0x9fc1('0x17')]?_['map'](_0x57d2d7[_0x9fc1('0x17')],function(_0x171eb4){return{'model':db[_0x171eb4[_0x9fc1('0x1a')]],'as':_0x171eb4['as'],'attributes':_0x171eb4['attributes']};}):[]};}):[]};}):[]:[]})[_0x9fc1('0x1b')](function(_0x1bb22d){logger['info']('GetMemberReport',_0x10233a);logger[_0x9fc1('0x1c')](_0x9fc1('0x1d'),_0x10233a,JSON[_0x9fc1('0xe')](_0x1bb22d));_0x5842bb(_0x1bb22d);})[_0x9fc1('0x1e')](function(_0x22843a){logger[_0x9fc1('0xf')]('GetMemberReport',_0x22843a['message'],_0x10233a);_0x3cee6a(_0x37a4a5[_0x9fc1('0xf')](0x1f4,_0x22843a[_0x9fc1('0x12')]));});});};exports[_0x9fc1('0x1f')]=function(_0x32d886){var _0x26541d=this;return new Promise(function(_0x8d9eb3,_0x5528d3){return db[_0x9fc1('0x20')][_0x9fc1('0x21')](_0x32d886[_0x9fc1('0x22')],{'raw':_0x32d886[_0x9fc1('0x15')]?_0x32d886['options']['raw']===undefined?!![]:![]:!![]})[_0x9fc1('0x1b')](function(_0x272b7a){logger['info'](_0x9fc1('0x1f'),_0x32d886);logger['debug'](_0x9fc1('0x1f'),_0x32d886,JSON[_0x9fc1('0xe')](_0x272b7a));_0x8d9eb3(_0x272b7a);})[_0x9fc1('0x1e')](function(_0x4a86f5){logger[_0x9fc1('0xf')]('CreateMemberReport',_0x4a86f5[_0x9fc1('0x12')],_0x32d886);_0x5528d3(_0x26541d['error'](0x1f4,_0x4a86f5[_0x9fc1('0x12')]));});});};exports[_0x9fc1('0x23')]=function(_0x4ea63e){var _0x26e276=this;return new Promise(function(_0x5c5c59,_0x174a0a){return db[_0x9fc1('0x20')][_0x9fc1('0x24')](_0x4ea63e[_0x9fc1('0x22')],{'raw':_0x4ea63e['options']?_0x4ea63e[_0x9fc1('0x15')][_0x9fc1('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ea63e[_0x9fc1('0x15')]?_0x4ea63e[_0x9fc1('0x15')][_0x9fc1('0x25')]||null:null,'attributes':_0x4ea63e['options']?_0x4ea63e[_0x9fc1('0x15')]['attributes']||null:null,'limit':_0x4ea63e['options']?_0x4ea63e[_0x9fc1('0x15')]['limit']||null:null})['then'](function(_0x238b36){logger['info'](_0x9fc1('0x23'),_0x4ea63e);logger[_0x9fc1('0x1c')](_0x9fc1('0x23'),_0x4ea63e,JSON[_0x9fc1('0xe')](_0x238b36));_0x5c5c59(_0x238b36);})[_0x9fc1('0x1e')](function(_0x42bfdd){logger[_0x9fc1('0xf')](_0x9fc1('0x23'),_0x42bfdd[_0x9fc1('0x12')],_0x4ea63e);_0x174a0a(_0x26e276[_0x9fc1('0xf')](0x1f4,_0x42bfdd[_0x9fc1('0x12')]));});});}; \ No newline at end of file +var _0xa89d=['debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','info','result','findAll','options','raw','include','model','attributes','map','GetMemberReport','stringify','CreateMemberReport','MemberReport','create','body','update','where','limit','UpdateMemberReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','then','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x21e71a,_0xf0b818){var _0x174f46=function(_0x2dd53e){while(--_0x2dd53e){_0x21e71a['push'](_0x21e71a['shift']());}};_0x174f46(++_0xf0b818);}(_0xa89d,0xf6));var _0xda89=function(_0x20dc3e,_0x27e9b0){_0x20dc3e=_0x20dc3e-0x0;var _0x2ebc91=_0xa89d[_0x20dc3e];return _0x2ebc91;};'use strict';var _=require(_0xda89('0x0'));var util=require(_0xda89('0x1'));var moment=require(_0xda89('0x2'));var BPromise=require(_0xda89('0x3'));var rs=require(_0xda89('0x4'));var fs=require('fs');var Redis=require(_0xda89('0x5'));var db=require(_0xda89('0x6'))['db'];var utils=require(_0xda89('0x7'));var logger=require(_0xda89('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda89('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a4451,_0x551a2a,_0x11236b){return new BPromise(function(_0x358aa3,_0x388428){return client['request'](_0x2a4451,_0x11236b)[_0xda89('0xa')](function(_0x4124bd){logger['info'](_0xda89('0xb'),_0x551a2a,_0xda89('0xc'));logger[_0xda89('0xd')](_0xda89('0xe'),_0x551a2a,_0xda89('0xc'),JSON['stringify'](_0x4124bd));if(_0x4124bd[_0xda89('0xf')]){if(_0x4124bd[_0xda89('0xf')]['code']===0x1f4){logger[_0xda89('0xf')](_0xda89('0xb'),_0x551a2a,_0x4124bd[_0xda89('0xf')][_0xda89('0x10')]);return _0x388428(_0x4124bd[_0xda89('0xf')][_0xda89('0x10')]);}logger[_0xda89('0xf')](_0xda89('0xb'),_0x551a2a,_0x4124bd['error'][_0xda89('0x10')]);return _0x358aa3(_0x4124bd[_0xda89('0xf')][_0xda89('0x10')]);}else{logger[_0xda89('0x11')]('MemberReport,\x20%s,\x20%s',_0x551a2a,_0xda89('0xc'));_0x358aa3(_0x4124bd[_0xda89('0x12')][_0xda89('0x10')]);}})['catch'](function(_0x275bf7){logger[_0xda89('0xf')](_0xda89('0xb'),_0x551a2a,_0x275bf7);_0x388428(_0x275bf7);});});}exports['GetMemberReport']=function(_0x413dfc){var _0x1eeff0=this;return new Promise(function(_0xe89788,_0x2d15c0){return db['MemberReport'][_0xda89('0x13')]({'raw':_0x413dfc[_0xda89('0x14')]?_0x413dfc[_0xda89('0x14')][_0xda89('0x15')]===undefined?!![]:![]:!![],'where':_0x413dfc[_0xda89('0x14')]?_0x413dfc[_0xda89('0x14')]['where']||null:null,'attributes':_0x413dfc[_0xda89('0x14')]?_0x413dfc['options']['attributes']||null:null,'limit':_0x413dfc[_0xda89('0x14')]?_0x413dfc['options']['limit']||null:null,'include':_0x413dfc[_0xda89('0x14')]?_0x413dfc[_0xda89('0x14')][_0xda89('0x16')]?_['map'](_0x413dfc['options']['include'],function(_0x331566){return{'model':db[_0x331566[_0xda89('0x17')]],'as':_0x331566['as'],'attributes':_0x331566[_0xda89('0x18')],'include':_0x331566[_0xda89('0x16')]?_[_0xda89('0x19')](_0x331566[_0xda89('0x16')],function(_0x2bab13){return{'model':db[_0x2bab13[_0xda89('0x17')]],'as':_0x2bab13['as'],'attributes':_0x2bab13[_0xda89('0x18')],'include':_0x2bab13[_0xda89('0x16')]?_[_0xda89('0x19')](_0x2bab13[_0xda89('0x16')],function(_0x3bcf38){return{'model':db[_0x3bcf38[_0xda89('0x17')]],'as':_0x3bcf38['as'],'attributes':_0x3bcf38[_0xda89('0x18')]};}):[]};}):[]};}):[]:[]})[_0xda89('0xa')](function(_0x9e608c){logger['info'](_0xda89('0x1a'),_0x413dfc);logger['debug'](_0xda89('0x1a'),_0x413dfc,JSON[_0xda89('0x1b')](_0x9e608c));_0xe89788(_0x9e608c);})['catch'](function(_0x2b3a05){logger['error'](_0xda89('0x1a'),_0x2b3a05[_0xda89('0x10')],_0x413dfc);_0x2d15c0(_0x1eeff0['error'](0x1f4,_0x2b3a05['message']));});});};exports[_0xda89('0x1c')]=function(_0x1362a6){var _0x31f328=this;return new Promise(function(_0x38d0c7,_0x5b71d6){return db[_0xda89('0x1d')][_0xda89('0x1e')](_0x1362a6[_0xda89('0x1f')],{'raw':_0x1362a6[_0xda89('0x14')]?_0x1362a6[_0xda89('0x14')][_0xda89('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4f925e){logger[_0xda89('0x11')]('CreateMemberReport',_0x1362a6);logger[_0xda89('0xd')](_0xda89('0x1c'),_0x1362a6,JSON[_0xda89('0x1b')](_0x4f925e));_0x38d0c7(_0x4f925e);})['catch'](function(_0x5bc246){logger[_0xda89('0xf')](_0xda89('0x1c'),_0x5bc246[_0xda89('0x10')],_0x1362a6);_0x5b71d6(_0x31f328['error'](0x1f4,_0x5bc246['message']));});});};exports['UpdateMemberReport']=function(_0x230a20){var _0x6d51da=this;return new Promise(function(_0x39c920,_0x5de5f4){return db['MemberReport'][_0xda89('0x20')](_0x230a20[_0xda89('0x1f')],{'raw':_0x230a20[_0xda89('0x14')]?_0x230a20[_0xda89('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x230a20[_0xda89('0x14')]?_0x230a20[_0xda89('0x14')][_0xda89('0x21')]||null:null,'attributes':_0x230a20[_0xda89('0x14')]?_0x230a20['options'][_0xda89('0x18')]||null:null,'limit':_0x230a20[_0xda89('0x14')]?_0x230a20['options'][_0xda89('0x22')]||null:null})[_0xda89('0xa')](function(_0x1d83fe){logger[_0xda89('0x11')](_0xda89('0x23'),_0x230a20);logger[_0xda89('0xd')](_0xda89('0x23'),_0x230a20,JSON['stringify'](_0x1d83fe));_0x39c920(_0x1d83fe);})[_0xda89('0x24')](function(_0x28e772){logger[_0xda89('0xf')](_0xda89('0x23'),_0x28e772[_0xda89('0x10')],_0x230a20);_0x5de5f4(_0x6d51da[_0xda89('0xf')](0x1f4,_0x28e772[_0xda89('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index db25111..620e54d 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 _0x4cf8=['index','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x197771,_0x2dafb5){var _0x40c0a0=function(_0x9c5d93){while(--_0x9c5d93){_0x197771['push'](_0x197771['shift']());}};_0x40c0a0(++_0x2dafb5);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x4cf8[_0x4828b1];return _0x1fec1b;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var auth=require(_0x84cf('0x6'));var interaction=require(_0x84cf('0x7'));var config=require(_0x84cf('0x8'));var controller=require(_0x84cf('0x9'));router[_0x84cf('0xa')]('/',controller[_0x84cf('0xb')]);module['exports']=router; \ No newline at end of file +var _0xd914=['../../config/environment','get','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xd914,0x17f));var _0x4d91=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0xd914[_0x59162a];return _0x35e50d;};'use strict';var multer=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var path=require('path');var timeout=require(_0x4d91('0x2'));var express=require(_0x4d91('0x3'));var router=express[_0x4d91('0x4')]();var auth=require(_0x4d91('0x5'));var interaction=require(_0x4d91('0x6'));var config=require(_0x4d91('0x7'));var controller=require('./migration.controller');router[_0x4d91('0x8')]('/',controller['index']);module[_0x4d91('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index da42d3b..23df218 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 _0xc23c=['sequelize','version'];(function(_0x2925c6,_0x2a37ee){var _0x60a38a=function(_0x26f855){while(--_0x26f855){_0x2925c6['push'](_0x2925c6['shift']());}};_0x60a38a(++_0x2a37ee);}(_0xc23c,0x194));var _0xcc23=function(_0x953a55,_0x736d43){_0x953a55=_0x953a55-0x0;var _0x43fa9a=_0xc23c[_0x953a55];return _0x43fa9a;};'use strict';var Sequelize=require(_0xcc23('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xcc23('0x1')}}; \ No newline at end of file +var _0xbfac=['STRING','version','exports'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xbfac,0x86));var _0xcbfa=function(_0x1f6760,_0x2379fb){_0x1f6760=_0x1f6760-0x0;var _0x3e1c9f=_0xbfac[_0x1f6760];return _0x3e1c9f;};'use strict';var Sequelize=require('sequelize');module[_0xcbfa('0x0')]={'version':{'type':Sequelize[_0xcbfa('0x1')],'unique':_0xcbfa('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9f82a82..2ab9224 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 _0x28f2=['pick','filter','where','merge','type','key','VIRTUAL','field','options','count','includeAll','include','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','reject','update','then','error','stack','name','index','Migration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x50428b,_0x49b399){var _0x3a2705=function(_0x5a2ef6){while(--_0x5a2ef6){_0x50428b['push'](_0x50428b['shift']());}};_0x3a2705(++_0x49b399);}(_0x28f2,0x193));var _0x228f=function(_0x4cf07a,_0x58e8f0){_0x4cf07a=_0x4cf07a-0x0;var _0x2c6c8a=_0x28f2[_0x4cf07a];return _0x2c6c8a;};'use strict';var pdf=require(_0x228f('0x0'));var emlformat=require(_0x228f('0x1'));var rimraf=require(_0x228f('0x2'));var zipdir=require(_0x228f('0x3'));var jsonpatch=require(_0x228f('0x4'));var rp=require('request-promise');var moment=require(_0x228f('0x5'));var BPromise=require(_0x228f('0x6'));var Mustache=require(_0x228f('0x7'));var util=require(_0x228f('0x8'));var path=require(_0x228f('0x9'));var sox=require(_0x228f('0xa'));var csv=require(_0x228f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x228f('0x13'));var logger=require(_0x228f('0x14'))(_0x228f('0x15'));var utils=require(_0x228f('0x16'));var config=require(_0x228f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39616d,_0x3e3047){_0x3e3047=_0x3e3047||0xcc;return function(_0x24f69c){if(_0x24f69c){return _0x39616d[_0x228f('0x18')](_0x3e3047);}return _0x39616d[_0x228f('0x19')](_0x3e3047)[_0x228f('0x1a')]();};}function respondWithResult(_0x18a0cd,_0x116d3d){_0x116d3d=_0x116d3d||0xc8;return function(_0x572535){if(_0x572535){return _0x18a0cd[_0x228f('0x19')](_0x116d3d)[_0x228f('0x1b')](_0x572535);}};}function respondWithFilteredResult(_0x14d6fc,_0x31dc9e){return function(_0x2a4d87){if(_0x2a4d87){var _0x21a913=_0x2a4d87['count'],_0x272723=_0x31dc9e[_0x228f('0x1c')],_0x5b5abb=_0x31dc9e[_0x228f('0x1c')]+_0x31dc9e[_0x228f('0x1d')],_0x5e4d20;if(_0x5b5abb>=_0x21a913){_0x5b5abb=_0x21a913;_0x5e4d20=0xc8;}else{_0x5e4d20=0xce;}_0x14d6fc['status'](_0x5e4d20);return _0x14d6fc[_0x228f('0x1e')]('Content-Range',_0x272723+'-'+_0x5b5abb+'/'+_0x21a913)[_0x228f('0x1b')](_0x2a4d87);}return null;};}function patchUpdates(_0x5b33a6){return function(_0x30cbc2){try{jsonpatch['apply'](_0x30cbc2,_0x5b33a6,!![]);}catch(_0x5aa203){return BPromise[_0x228f('0x1f')](_0x5aa203);}return _0x30cbc2['save']();};}function saveUpdates(_0x302d54,_0x139373){return function(_0x1294a8){if(_0x1294a8){return _0x1294a8[_0x228f('0x20')](_0x302d54)[_0x228f('0x21')](function(_0x313cf2){return _0x313cf2;});}return null;};}function removeEntity(_0x5468ed,_0x3f7b96){return function(_0x15d54f){if(_0x15d54f){return _0x15d54f['destroy']()[_0x228f('0x21')](function(){_0x5468ed[_0x228f('0x19')](0xcc)[_0x228f('0x1a')]();});}};}function handleEntityNotFound(_0x3c00ad,_0x1dad27){return function(_0x194d1a){if(!_0x194d1a){_0x3c00ad[_0x228f('0x18')](0x194);}return _0x194d1a;};}function handleError(_0x20c111,_0x2dcf68){_0x2dcf68=_0x2dcf68||0x1f4;return function(_0x56fbc2){logger[_0x228f('0x22')](_0x56fbc2[_0x228f('0x23')]);if(_0x56fbc2[_0x228f('0x24')]){delete _0x56fbc2[_0x228f('0x24')];}_0x20c111[_0x228f('0x19')](_0x2dcf68)['send'](_0x56fbc2);};}exports[_0x228f('0x25')]=function(_0x49efe9,_0xb23f40){var _0x5afa52={},_0x58a151={},_0x2b9802={'count':0x0,'rows':[]};var _0x160f68=db[_0x228f('0x26')][_0x228f('0x27')];_0x58a151[_0x228f('0x28')]=_[_0x228f('0x29')](_0x160f68);_0x58a151[_0x228f('0x2a')]=_[_0x228f('0x29')](_0x49efe9[_0x228f('0x2a')]);_0x58a151[_0x228f('0x2b')]=_[_0x228f('0x2c')](_0x58a151[_0x228f('0x28')],_0x58a151[_0x228f('0x2a')]);_0x5afa52[_0x228f('0x2d')]=_[_0x228f('0x2c')](_0x58a151['model'],qs[_0x228f('0x2e')](_0x49efe9[_0x228f('0x2a')][_0x228f('0x2e')]));_0x5afa52['attributes']=_0x5afa52[_0x228f('0x2d')][_0x228f('0x2f')]?_0x5afa52['attributes']:_0x58a151[_0x228f('0x28')];if(!_0x49efe9[_0x228f('0x2a')][_0x228f('0x30')](_0x228f('0x31'))){_0x5afa52['limit']=qs[_0x228f('0x1d')](_0x49efe9['query'][_0x228f('0x1d')]);_0x5afa52[_0x228f('0x1c')]=qs[_0x228f('0x1c')](_0x49efe9[_0x228f('0x2a')]['offset']);}_0x5afa52[_0x228f('0x32')]=qs[_0x228f('0x33')](_0x49efe9['query']['sort']);_0x5afa52['where']=qs[_0x228f('0x2b')](_[_0x228f('0x34')](_0x49efe9[_0x228f('0x2a')],_0x58a151[_0x228f('0x2b')]));if(_0x49efe9[_0x228f('0x2a')][_0x228f('0x35')]){_0x5afa52[_0x228f('0x36')]=_[_0x228f('0x37')](_0x5afa52[_0x228f('0x36')],{'$or':_['map'](_0x160f68,function(_0x5754f9){if(_0x5754f9[_0x228f('0x38')][_0x228f('0x39')]!==_0x228f('0x3a')){var _0x367a37={};_0x367a37[_0x5754f9[_0x228f('0x3b')]]={'$like':'%'+_0x49efe9[_0x228f('0x2a')][_0x228f('0x35')]+'%'};return _0x367a37;}})});}_0x5afa52=_[_0x228f('0x37')]({},_0x5afa52,_0x49efe9[_0x228f('0x3c')]);var _0x4015da={'where':_0x5afa52['where']};return db['Migration'][_0x228f('0x3d')](_0x4015da)[_0x228f('0x21')](function(_0x161ea7){_0x2b9802[_0x228f('0x3d')]=_0x161ea7;if(_0x49efe9['query'][_0x228f('0x3e')]){_0x5afa52[_0x228f('0x3f')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x5afa52);})[_0x228f('0x21')](function(_0x2f6f54){_0x2b9802['rows']=_0x2f6f54;return _0x2b9802;})[_0x228f('0x21')](respondWithFilteredResult(_0xb23f40,_0x5afa52))[_0x228f('0x40')](handleError(_0xb23f40,null));}; \ No newline at end of file +var _0xc429=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','type','key','field','options','includeAll','include','findAll','rows','catch','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','end','count','offset','reject','then','sendStatus','error','stack','name','send','index','Migration','rawAttributes','model','keys','query'];(function(_0x555d87,_0x207a9c){var _0x47a78e=function(_0x20691b){while(--_0x20691b){_0x555d87['push'](_0x555d87['shift']());}};_0x47a78e(++_0x207a9c);}(_0xc429,0x1ba));var _0x9c42=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0xc429[_0x224f65];return _0x3f921c;};'use strict';var pdf=require(_0x9c42('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9c42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c42('0x2'));var moment=require(_0x9c42('0x3'));var BPromise=require(_0x9c42('0x4'));var Mustache=require(_0x9c42('0x5'));var util=require(_0x9c42('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9c42('0x7'));var ejs=require(_0x9c42('0x8'));var fs=require('fs');var _=require(_0x9c42('0x9'));var squel=require(_0x9c42('0xa'));var crypto=require(_0x9c42('0xb'));var jsforce=require(_0x9c42('0xc'));var deskjs=require(_0x9c42('0xd'));var toCsv=require(_0x9c42('0x7'));var querystring=require(_0x9c42('0xe'));var Papa=require(_0x9c42('0xf'));var Redis=require(_0x9c42('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9c42('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c42('0x12'))('api');var utils=require(_0x9c42('0x13'));var config=require(_0x9c42('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xce23e5,_0x433d9f){_0x433d9f=_0x433d9f||0xcc;return function(_0x2979ce){if(_0x2979ce){return _0xce23e5['sendStatus'](_0x433d9f);}return _0xce23e5[_0x9c42('0x15')](_0x433d9f)[_0x9c42('0x16')]();};}function respondWithResult(_0x35c8aa,_0x5b3fa9){_0x5b3fa9=_0x5b3fa9||0xc8;return function(_0x3af9ae){if(_0x3af9ae){return _0x35c8aa['status'](_0x5b3fa9)['json'](_0x3af9ae);}};}function respondWithFilteredResult(_0x44e8ff,_0x1d4208){return function(_0x5ec8b1){if(_0x5ec8b1){var _0x1f484b=_0x5ec8b1[_0x9c42('0x17')],_0xc6a1f3=_0x1d4208[_0x9c42('0x18')],_0x33f8ca=_0x1d4208[_0x9c42('0x18')]+_0x1d4208['limit'],_0x1a2fba;if(_0x33f8ca>=_0x1f484b){_0x33f8ca=_0x1f484b;_0x1a2fba=0xc8;}else{_0x1a2fba=0xce;}_0x44e8ff[_0x9c42('0x15')](_0x1a2fba);return _0x44e8ff['set']('Content-Range',_0xc6a1f3+'-'+_0x33f8ca+'/'+_0x1f484b)['json'](_0x5ec8b1);}return null;};}function patchUpdates(_0x1ab506){return function(_0x286e4e){try{jsonpatch['apply'](_0x286e4e,_0x1ab506,!![]);}catch(_0x229288){return BPromise[_0x9c42('0x19')](_0x229288);}return _0x286e4e['save']();};}function saveUpdates(_0xc9b5c7,_0x8055d0){return function(_0x51aff6){if(_0x51aff6){return _0x51aff6['update'](_0xc9b5c7)[_0x9c42('0x1a')](function(_0x4a0492){return _0x4a0492;});}return null;};}function removeEntity(_0x206e39,_0x10f2db){return function(_0x2804a2){if(_0x2804a2){return _0x2804a2['destroy']()[_0x9c42('0x1a')](function(){_0x206e39[_0x9c42('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f3a5,_0x544d2d){return function(_0x138d5b){if(!_0x138d5b){_0x13f3a5[_0x9c42('0x1b')](0x194);}return _0x138d5b;};}function handleError(_0x2613f9,_0x2477b3){_0x2477b3=_0x2477b3||0x1f4;return function(_0xec4f0a){logger[_0x9c42('0x1c')](_0xec4f0a[_0x9c42('0x1d')]);if(_0xec4f0a[_0x9c42('0x1e')]){delete _0xec4f0a['name'];}_0x2613f9['status'](_0x2477b3)[_0x9c42('0x1f')](_0xec4f0a);};}exports[_0x9c42('0x20')]=function(_0x285398,_0x2dc26c){var _0x4282d5={},_0x5405c2={},_0x17f3f7={'count':0x0,'rows':[]};var _0x4ef94d=db[_0x9c42('0x21')][_0x9c42('0x22')];_0x5405c2[_0x9c42('0x23')]=_[_0x9c42('0x24')](_0x4ef94d);_0x5405c2['query']=_[_0x9c42('0x24')](_0x285398[_0x9c42('0x25')]);_0x5405c2[_0x9c42('0x26')]=_[_0x9c42('0x27')](_0x5405c2[_0x9c42('0x23')],_0x5405c2[_0x9c42('0x25')]);_0x4282d5[_0x9c42('0x28')]=_[_0x9c42('0x27')](_0x5405c2[_0x9c42('0x23')],qs['fields'](_0x285398['query'][_0x9c42('0x29')]));_0x4282d5[_0x9c42('0x28')]=_0x4282d5[_0x9c42('0x28')][_0x9c42('0x2a')]?_0x4282d5[_0x9c42('0x28')]:_0x5405c2['model'];if(!_0x285398[_0x9c42('0x25')][_0x9c42('0x2b')](_0x9c42('0x2c'))){_0x4282d5[_0x9c42('0x2d')]=qs[_0x9c42('0x2d')](_0x285398[_0x9c42('0x25')][_0x9c42('0x2d')]);_0x4282d5[_0x9c42('0x18')]=qs[_0x9c42('0x18')](_0x285398[_0x9c42('0x25')][_0x9c42('0x18')]);}_0x4282d5[_0x9c42('0x2e')]=qs[_0x9c42('0x2f')](_0x285398[_0x9c42('0x25')][_0x9c42('0x2f')]);_0x4282d5[_0x9c42('0x30')]=qs[_0x9c42('0x26')](_['pick'](_0x285398[_0x9c42('0x25')],_0x5405c2[_0x9c42('0x26')]));if(_0x285398[_0x9c42('0x25')][_0x9c42('0x31')]){_0x4282d5[_0x9c42('0x30')]=_['merge'](_0x4282d5[_0x9c42('0x30')],{'$or':_[_0x9c42('0x32')](_0x4ef94d,function(_0x57585b){if(_0x57585b[_0x9c42('0x33')][_0x9c42('0x34')]!=='VIRTUAL'){var _0x448e70={};_0x448e70[_0x57585b[_0x9c42('0x35')]]={'$like':'%'+_0x285398[_0x9c42('0x25')]['filter']+'%'};return _0x448e70;}})});}_0x4282d5=_['merge']({},_0x4282d5,_0x285398[_0x9c42('0x36')]);var _0x592930={'where':_0x4282d5[_0x9c42('0x30')]};return db[_0x9c42('0x21')][_0x9c42('0x17')](_0x592930)[_0x9c42('0x1a')](function(_0x3cf6be){_0x17f3f7[_0x9c42('0x17')]=_0x3cf6be;if(_0x285398[_0x9c42('0x25')][_0x9c42('0x37')]){_0x4282d5[_0x9c42('0x38')]=[{'all':!![]}];}return db[_0x9c42('0x21')][_0x9c42('0x39')](_0x4282d5);})['then'](function(_0x341066){_0x17f3f7[_0x9c42('0x3a')]=_0x341066;return _0x17f3f7;})[_0x9c42('0x1a')](respondWithFilteredResult(_0x2dc26c,_0x4282d5))[_0x9c42('0x3b')](handleError(_0x2dc26c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index bb6ef14..c46572d 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 _0x9245=['lodash','api','moment','bluebird','path','rimraf','./migration.attributes','exports','Migration'];(function(_0x4581e8,_0x15b174){var _0x57cc07=function(_0x58d8ab){while(--_0x58d8ab){_0x4581e8['push'](_0x4581e8['shift']());}};_0x57cc07(++_0x15b174);}(_0x9245,0x99));var _0x5924=function(_0x41443f,_0x90389a){_0x41443f=_0x41443f-0x0;var _0x2b6c89=_0x9245[_0x41443f];return _0x2b6c89;};'use strict';var _=require(_0x5924('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5924('0x1'));var moment=require(_0x5924('0x2'));var BPromise=require(_0x5924('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5924('0x4'));var rimraf=require(_0x5924('0x5'));var config=require('../../config/environment');var attributes=require(_0x5924('0x6'));module[_0x5924('0x7')]=function(_0x13c041,_0x2d7a89){return _0x13c041['define'](_0x5924('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68b3=['Migration','util','../../config/logger','bluebird','path','../../config/environment','exports','define'];(function(_0x417100,_0xbb639){var _0x471378=function(_0x502c08){while(--_0x502c08){_0x417100['push'](_0x417100['shift']());}};_0x471378(++_0xbb639);}(_0x68b3,0x111));var _0x368b=function(_0x1e62e1,_0x3f2f0d){_0x1e62e1=_0x1e62e1-0x0;var _0x5a2ac1=_0x68b3[_0x1e62e1];return _0x5a2ac1;};'use strict';var _=require('lodash');var util=require(_0x368b('0x0'));var logger=require(_0x368b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x368b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x368b('0x3'));var rimraf=require('rimraf');var config=require(_0x368b('0x4'));var attributes=require('./migration.attributes');module[_0x368b('0x5')]=function(_0x3db4b3,_0x28e901){return _0x3db4b3[_0x368b('0x6')](_0x368b('0x7'),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 20386c1..12f2d79 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 _0x322b=['rpc','../../config/environment','client','http','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','../../config/utils'];(function(_0x597cf5,_0xddcf49){var _0x52b829=function(_0x53a315){while(--_0x53a315){_0x597cf5['push'](_0x597cf5['shift']());}};_0x52b829(++_0xddcf49);}(_0x322b,0x106));var _0xb322=function(_0x4368e5,_0x484e93){_0x4368e5=_0x4368e5-0x0;var _0x718239=_0x322b[_0x4368e5];return _0x718239;};'use strict';var _=require(_0xb322('0x0'));var util=require('util');var moment=require(_0xb322('0x1'));var BPromise=require(_0xb322('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb322('0x3'));var logger=require('../../config/logger')(_0xb322('0x4'));var config=require(_0xb322('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb322('0x6')][_0xb322('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x485131,_0x401cce,_0x2a2513){return new BPromise(function(_0x24c03e,_0x2d58d6){return client[_0xb322('0x8')](_0x485131,_0x2a2513)[_0xb322('0x9')](function(_0xf56a3f){logger[_0xb322('0xa')](_0xb322('0xb'),_0x401cce,'request\x20sent');logger[_0xb322('0xc')](_0xb322('0xd'),_0x401cce,_0xb322('0xe'),JSON['stringify'](_0xf56a3f));if(_0xf56a3f[_0xb322('0xf')]){if(_0xf56a3f['error']['code']===0x1f4){logger[_0xb322('0xf')]('Migration,\x20%s,\x20%s',_0x401cce,_0xf56a3f['error'][_0xb322('0x10')]);return _0x2d58d6(_0xf56a3f['error']['message']);}logger['error'](_0xb322('0xb'),_0x401cce,_0xf56a3f[_0xb322('0xf')][_0xb322('0x10')]);return _0x24c03e(_0xf56a3f[_0xb322('0xf')][_0xb322('0x10')]);}else{logger[_0xb322('0xa')](_0xb322('0xb'),_0x401cce,_0xb322('0xe'));_0x24c03e(_0xf56a3f[_0xb322('0x11')][_0xb322('0x10')]);}})[_0xb322('0x12')](function(_0x313923){logger[_0xb322('0xf')]('Migration,\x20%s,\x20%s',_0x401cce,_0x313923);_0x2d58d6(_0x313923);});});} \ No newline at end of file +var _0x7854=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x328ce3,_0x26dafb){var _0xb08597=function(_0x1ede19){while(--_0x1ede19){_0x328ce3['push'](_0x328ce3['shift']());}};_0xb08597(++_0x26dafb);}(_0x7854,0x189));var _0x4785=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x7854[_0x2d0d9f];return _0x30243d;};'use strict';var _=require(_0x4785('0x0'));var util=require(_0x4785('0x1'));var moment=require('moment');var BPromise=require(_0x4785('0x2'));var rs=require(_0x4785('0x3'));var fs=require('fs');var Redis=require(_0x4785('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4785('0x5'));var logger=require(_0x4785('0x6'))(_0x4785('0x7'));var config=require(_0x4785('0x8'));var jayson=require(_0x4785('0x9'));var client=jayson[_0x4785('0xa')][_0x4785('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e8ec3,_0x19551a,_0x747087){return new BPromise(function(_0x57d2a8,_0x3ee4cf){return client['request'](_0x2e8ec3,_0x747087)['then'](function(_0x579848){logger[_0x4785('0xc')](_0x4785('0xd'),_0x19551a,_0x4785('0xe'));logger[_0x4785('0xf')](_0x4785('0x10'),_0x19551a,'request\x20sent',JSON[_0x4785('0x11')](_0x579848));if(_0x579848[_0x4785('0x12')]){if(_0x579848['error'][_0x4785('0x13')]===0x1f4){logger[_0x4785('0x12')](_0x4785('0xd'),_0x19551a,_0x579848[_0x4785('0x12')]['message']);return _0x3ee4cf(_0x579848[_0x4785('0x12')][_0x4785('0x14')]);}logger[_0x4785('0x12')]('Migration,\x20%s,\x20%s',_0x19551a,_0x579848['error'][_0x4785('0x14')]);return _0x57d2a8(_0x579848[_0x4785('0x12')]['message']);}else{logger[_0x4785('0xc')](_0x4785('0xd'),_0x19551a,_0x4785('0xe'));_0x57d2a8(_0x579848[_0x4785('0x15')][_0x4785('0x14')]);}})[_0x4785('0x16')](function(_0x1a72b1){logger[_0x4785('0x12')](_0x4785('0xd'),_0x19551a,_0x1a72b1);_0x3ee4cf(_0x1a72b1);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 1e5d3ae..7074aee 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 _0x9fee=['/:id','post','create','put','update','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0xc3b15a,_0x43de18){var _0x3396e5=function(_0x26cd7a){while(--_0x26cd7a){_0xc3b15a['push'](_0xc3b15a['shift']());}};_0x3396e5(++_0x43de18);}(_0x9fee,0x1e7));var _0xe9fe=function(_0x21c6cd,_0x4dec51){_0x21c6cd=_0x21c6cd-0x0;var _0x48714d=_0x9fee[_0x21c6cd];return _0x48714d;};'use strict';var multer=require('multer');var util=require(_0xe9fe('0x0'));var path=require(_0xe9fe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe9fe('0x2')]();var auth=require(_0xe9fe('0x3'));var interaction=require(_0xe9fe('0x4'));var config=require(_0xe9fe('0x5'));var controller=require(_0xe9fe('0x6'));router[_0xe9fe('0x7')]('/',auth[_0xe9fe('0x8')](),controller['index']);router[_0xe9fe('0x7')](_0xe9fe('0x9'),auth[_0xe9fe('0x8')](),controller['show']);router[_0xe9fe('0xa')]('/',auth[_0xe9fe('0x8')](),controller[_0xe9fe('0xb')]);router[_0xe9fe('0xc')](_0xe9fe('0x9'),auth[_0xe9fe('0x8')](),controller[_0xe9fe('0xd')]);router[_0xe9fe('0xe')]('/:id',auth[_0xe9fe('0x8')](),controller[_0xe9fe('0xf')]);module['exports']=router; \ No newline at end of file +var _0x52a8=['exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy'];(function(_0x5a78d6,_0x359621){var _0x3721fc=function(_0x48cd11){while(--_0x48cd11){_0x5a78d6['push'](_0x5a78d6['shift']());}};_0x3721fc(++_0x359621);}(_0x52a8,0x141));var _0x852a=function(_0x20f3b1,_0x5d41ef){_0x20f3b1=_0x20f3b1-0x0;var _0x5b1e07=_0x52a8[_0x20f3b1];return _0x5b1e07;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x852a('0x0'));var express=require('express');var router=express[_0x852a('0x1')]();var auth=require(_0x852a('0x2'));var interaction=require(_0x852a('0x3'));var config=require(_0x852a('0x4'));var controller=require(_0x852a('0x5'));router[_0x852a('0x6')]('/',auth[_0x852a('0x7')](),controller[_0x852a('0x8')]);router[_0x852a('0x6')](_0x852a('0x9'),auth[_0x852a('0x7')](),controller[_0x852a('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x852a('0xb')]);router['put'](_0x852a('0x9'),auth[_0x852a('0x7')](),controller[_0x852a('0xc')]);router[_0x852a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x852a('0xe')]);module[_0x852a('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 49d057a..9f3e28a 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 _0xa9eb=['STRING','sequelize','exports','ENUM','externip'];(function(_0x4beaf1,_0x4131a7){var _0x5bbbd5=function(_0x4d5edc){while(--_0x4d5edc){_0x4beaf1['push'](_0x4beaf1['shift']());}};_0x5bbbd5(++_0x4131a7);}(_0xa9eb,0x105));var _0xba9e=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xa9eb[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0xba9e('0x0'));module[_0xba9e('0x1')]={'type':{'type':Sequelize[_0xba9e('0x2')]('localnet',_0xba9e('0x3'))},'value':{'type':Sequelize[_0xba9e('0x4')]}}; \ No newline at end of file +var _0x7319=['sequelize','exports','localnet','STRING'];(function(_0x624824,_0x51df53){var _0x3e2d11=function(_0x3e8259){while(--_0x3e8259){_0x624824['push'](_0x624824['shift']());}};_0x3e2d11(++_0x51df53);}(_0x7319,0x110));var _0x9731=function(_0x33b370,_0x556568){_0x33b370=_0x33b370-0x0;var _0x474978=_0x7319[_0x33b370];return _0x474978;};'use strict';var Sequelize=require(_0x9731('0x0'));module[_0x9731('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9731('0x2'),'externip')},'value':{'type':Sequelize[_0x9731('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 02b6a3f..835784d 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 _0x8ba0=['order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','length','find','create','sequelize','transaction','body','readFileSync','server/files/templates/network.ejs','utf8','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','join','root','writeFileSync','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','client','http','test','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','catch','status','end','count','offset','limit','apply','update','sendStatus','stack','name','Network','rawAttributes','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty'];(function(_0x9c227e,_0x3d111c){var _0x25d4e2=function(_0x5526d1){while(--_0x5526d1){_0x9c227e['push'](_0x9c227e['shift']());}};_0x25d4e2(++_0x3d111c);}(_0x8ba0,0x133));var _0x08ba=function(_0x4b946f,_0x53288e){_0x4b946f=_0x4b946f-0x0;var _0x446dc6=_0x8ba0[_0x4b946f];return _0x446dc6;};'use strict';var pdf=require(_0x08ba('0x0'));var emlformat=require(_0x08ba('0x1'));var rimraf=require(_0x08ba('0x2'));var zipdir=require(_0x08ba('0x3'));var jsonpatch=require(_0x08ba('0x4'));var rp=require(_0x08ba('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x08ba('0x6'));var util=require('util');var path=require('path');var sox=require(_0x08ba('0x7'));var csv=require(_0x08ba('0x8'));var ejs=require(_0x08ba('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x08ba('0xa'));var crypto=require('crypto');var jsforce=require(_0x08ba('0xb'));var deskjs=require(_0x08ba('0xc'));var toCsv=require(_0x08ba('0x8'));var querystring=require('querystring');var Papa=require(_0x08ba('0xd'));var Redis=require(_0x08ba('0xe'));var authService=require(_0x08ba('0xf'));var qs=require(_0x08ba('0x10'));var hardwareService=require(_0x08ba('0x11'));var logger=require('../../config/logger')(_0x08ba('0x12'));var utils=require('../../config/utils');var config=require(_0x08ba('0x13'));var db=require(_0x08ba('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x08ba('0x15')][_0x08ba('0x16')]({'port':0x232a});function checkPasswordPattern(_0x1e3a6d,_0x309fdb,_0x23830f){if(_0x23830f){var _0x22507b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22507b[_0x08ba('0x17')](_0x309fdb)){return _0x1e3a6d;}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 _0x1e3a6d;}}function respondWithRpcPromise(_0x26d0e1,_0x148938,_0x31059a,_0x42d52e){return new BPromise(function(_0x1e06a1,_0x11774a){var _0x55afc8=_0x42d52e||client;return _0x55afc8['request'](_0x26d0e1,_0x31059a)[_0x08ba('0x18')](function(_0x3c5c4e){logger[_0x08ba('0x19')]('Network,\x20%s,\x20%s',_0x148938,_0x08ba('0x1a'));logger['debug'](_0x08ba('0x1b'),_0x148938,_0x08ba('0x1a'),JSON['stringify'](_0x3c5c4e));if(_0x3c5c4e['error']){if(_0x3c5c4e[_0x08ba('0x1c')][_0x08ba('0x1d')]===0x1f4){logger[_0x08ba('0x1c')](_0x08ba('0x1e'),_0x148938,_0x3c5c4e[_0x08ba('0x1c')][_0x08ba('0x1f')]);return _0x11774a(_0x3c5c4e[_0x08ba('0x1c')]['message']);}logger[_0x08ba('0x1c')]('Network,\x20%s,\x20%s',_0x148938,_0x3c5c4e[_0x08ba('0x1c')][_0x08ba('0x1f')]);return _0x1e06a1(_0x3c5c4e['error']['message']);}else{logger[_0x08ba('0x19')]('Network,\x20%s,\x20%s',_0x148938,_0x08ba('0x1a'));_0x1e06a1(_0x3c5c4e['result'][_0x08ba('0x1f')]);}})[_0x08ba('0x20')](function(_0x3de774){logger[_0x08ba('0x1c')](_0x08ba('0x1e'),_0x148938,_0x3de774);_0x11774a(_0x3de774);});});}function respondWithStatusCode(_0x59b965,_0x329c38){_0x329c38=_0x329c38||0xcc;return function(_0x192250){if(_0x192250){return _0x59b965['sendStatus'](_0x329c38);}return _0x59b965[_0x08ba('0x21')](_0x329c38)[_0x08ba('0x22')]();};}function respondWithResult(_0x50a46b,_0x3b7126){_0x3b7126=_0x3b7126||0xc8;return function(_0x2f6c4a){if(_0x2f6c4a){return _0x50a46b[_0x08ba('0x21')](_0x3b7126)['json'](_0x2f6c4a);}};}function respondWithFilteredResult(_0xa06c86,_0x2664e3){return function(_0xc72d21){if(_0xc72d21){var _0x1de181=_0xc72d21[_0x08ba('0x23')],_0x5c0586=_0x2664e3[_0x08ba('0x24')],_0x1838d4=_0x2664e3[_0x08ba('0x24')]+_0x2664e3[_0x08ba('0x25')],_0x4be395;if(_0x1838d4>=_0x1de181){_0x1838d4=_0x1de181;_0x4be395=0xc8;}else{_0x4be395=0xce;}_0xa06c86[_0x08ba('0x21')](_0x4be395);return _0xa06c86['set']('Content-Range',_0x5c0586+'-'+_0x1838d4+'/'+_0x1de181)['json'](_0xc72d21);}return null;};}function patchUpdates(_0x5791cf){return function(_0x20c84d){try{jsonpatch[_0x08ba('0x26')](_0x20c84d,_0x5791cf,!![]);}catch(_0x115981){return BPromise['reject'](_0x115981);}return _0x20c84d['save']();};}function saveUpdates(_0x57ef39,_0x3a6749){return function(_0x4ee58a){if(_0x4ee58a){return _0x4ee58a[_0x08ba('0x27')](_0x57ef39)[_0x08ba('0x18')](function(_0x1d9dbf){return _0x1d9dbf;});}return null;};}function removeEntity(_0xdf055e,_0x18fd14){return function(_0x41437f){if(_0x41437f){return _0x41437f['destroy']()['then'](function(){_0xdf055e['status'](0xcc)[_0x08ba('0x22')]();});}};}function handleEntityNotFound(_0x3c69cc,_0x558000){return function(_0x4d2b03){if(!_0x4d2b03){_0x3c69cc[_0x08ba('0x28')](0x194);}return _0x4d2b03;};}function handleError(_0x403350,_0x589816){_0x589816=_0x589816||0x1f4;return function(_0x55ea3b){logger[_0x08ba('0x1c')](_0x55ea3b[_0x08ba('0x29')]);if(_0x55ea3b[_0x08ba('0x2a')]){delete _0x55ea3b[_0x08ba('0x2a')];}_0x403350[_0x08ba('0x21')](_0x589816)['send'](_0x55ea3b);};}exports['index']=function(_0x5b87f6,_0x14859c){var _0x429a6b={},_0x53b037={},_0x22edad={'count':0x0,'rows':[]};var _0x458988=db[_0x08ba('0x2b')][_0x08ba('0x2c')];_0x53b037['model']=_[_0x08ba('0x2d')](_0x458988);_0x53b037[_0x08ba('0x2e')]=_[_0x08ba('0x2d')](_0x5b87f6['query']);_0x53b037[_0x08ba('0x2f')]=_[_0x08ba('0x30')](_0x53b037[_0x08ba('0x31')],_0x53b037[_0x08ba('0x2e')]);_0x429a6b['attributes']=_[_0x08ba('0x30')](_0x53b037[_0x08ba('0x31')],qs[_0x08ba('0x32')](_0x5b87f6[_0x08ba('0x2e')][_0x08ba('0x32')]));_0x429a6b[_0x08ba('0x33')]=_0x429a6b['attributes']['length']?_0x429a6b['attributes']:_0x53b037[_0x08ba('0x31')];if(!_0x5b87f6[_0x08ba('0x2e')][_0x08ba('0x34')]('nolimit')){_0x429a6b[_0x08ba('0x25')]=qs['limit'](_0x5b87f6[_0x08ba('0x2e')][_0x08ba('0x25')]);_0x429a6b[_0x08ba('0x24')]=qs[_0x08ba('0x24')](_0x5b87f6[_0x08ba('0x2e')][_0x08ba('0x24')]);}_0x429a6b[_0x08ba('0x35')]=qs['sort'](_0x5b87f6[_0x08ba('0x2e')][_0x08ba('0x36')]);_0x429a6b['where']=qs['filters'](_[_0x08ba('0x37')](_0x5b87f6[_0x08ba('0x2e')],_0x53b037[_0x08ba('0x2f')]));if(_0x5b87f6['query'][_0x08ba('0x38')]){_0x429a6b[_0x08ba('0x39')]=_[_0x08ba('0x3a')](_0x429a6b[_0x08ba('0x39')],{'$or':_[_0x08ba('0x3b')](_0x458988,function(_0x491259){if(_0x491259[_0x08ba('0x3c')][_0x08ba('0x3d')]!==_0x08ba('0x3e')){var _0x352853={};_0x352853[_0x491259[_0x08ba('0x3f')]]={'$like':'%'+_0x5b87f6[_0x08ba('0x2e')][_0x08ba('0x38')]+'%'};return _0x352853;}})});}_0x429a6b=_[_0x08ba('0x3a')]({},_0x429a6b,_0x5b87f6[_0x08ba('0x40')]);var _0x598e75={'where':_0x429a6b[_0x08ba('0x39')]};return db['Network'][_0x08ba('0x23')](_0x598e75)[_0x08ba('0x18')](function(_0x417c2c){_0x22edad[_0x08ba('0x23')]=_0x417c2c;if(_0x5b87f6[_0x08ba('0x2e')][_0x08ba('0x41')]){_0x429a6b[_0x08ba('0x42')]=[{'all':!![]}];}return db[_0x08ba('0x2b')][_0x08ba('0x43')](_0x429a6b);})[_0x08ba('0x18')](function(_0x5260c0){_0x22edad[_0x08ba('0x44')]=_0x5260c0;return _0x22edad;})[_0x08ba('0x18')](respondWithFilteredResult(_0x14859c,_0x429a6b))[_0x08ba('0x20')](handleError(_0x14859c,null));};exports[_0x08ba('0x45')]=function(_0x18b992,_0x367e70){var _0x2dc476={'raw':!![],'where':{'id':_0x18b992[_0x08ba('0x46')]['id']}},_0x3a1af0={};_0x3a1af0[_0x08ba('0x31')]=_[_0x08ba('0x2d')](db[_0x08ba('0x2b')][_0x08ba('0x2c')]);_0x3a1af0[_0x08ba('0x2e')]=_[_0x08ba('0x2d')](_0x18b992[_0x08ba('0x2e')]);_0x3a1af0[_0x08ba('0x2f')]=_[_0x08ba('0x30')](_0x3a1af0[_0x08ba('0x31')],_0x3a1af0[_0x08ba('0x2e')]);_0x2dc476[_0x08ba('0x33')]=_['intersection'](_0x3a1af0[_0x08ba('0x31')],qs[_0x08ba('0x32')](_0x18b992[_0x08ba('0x2e')][_0x08ba('0x32')]));_0x2dc476[_0x08ba('0x33')]=_0x2dc476['attributes'][_0x08ba('0x47')]?_0x2dc476[_0x08ba('0x33')]:_0x3a1af0[_0x08ba('0x31')];if(_0x18b992[_0x08ba('0x2e')]['includeAll']){_0x2dc476[_0x08ba('0x42')]=[{'all':!![]}];}_0x2dc476=_[_0x08ba('0x3a')]({},_0x2dc476,_0x18b992[_0x08ba('0x40')]);return db[_0x08ba('0x2b')][_0x08ba('0x48')](_0x2dc476)[_0x08ba('0x18')](handleEntityNotFound(_0x367e70,null))['then'](respondWithResult(_0x367e70,null))[_0x08ba('0x20')](handleError(_0x367e70,null));};exports[_0x08ba('0x49')]=function(_0x99dcb3,_0x6ef758,_0x965ad6){var _0x2876f9;return db[_0x08ba('0x4a')][_0x08ba('0x4b')](function(_0x367b78){return db['Network']['create'](_0x99dcb3[_0x08ba('0x4c')],{'raw':!![]})['then'](function(_0xd8a206){_0x2876f9=_0xd8a206;return db[_0x08ba('0x2b')][_0x08ba('0x43')]({'where':{'type':_0x99dcb3[_0x08ba('0x4c')][_0x08ba('0x3c')]},'raw':!![]});})[_0x08ba('0x18')](function(_0x5ff065){var _0x1d528c=fs[_0x08ba('0x4d')](path['join'](config['root'],_0x08ba('0x4e')),_0x08ba('0x4f'));var _0x16fd12=ejs[_0x08ba('0x50')](_0x1d528c,{'networks':_0x5ff065||[]});fs['writeFileSync'](util[_0x08ba('0x51')](_0x08ba('0x52'),_0x99dcb3[_0x08ba('0x4c')][_0x08ba('0x3c')][_0x08ba('0x53')]()),_0x16fd12);})['then'](function(){return respondWithRpcPromise(_0x08ba('0x54'),_0x08ba('0x49'),{'module':_0x08ba('0x55')});})[_0x08ba('0x18')](function(){return _0x2876f9;});})[_0x08ba('0x18')](respondWithResult(_0x6ef758,0xc9))[_0x08ba('0x20')](handleError(_0x6ef758,null));};exports[_0x08ba('0x27')]=function(_0x14a046,_0x5ba112,_0x298fd4){var _0x1b6973;return db[_0x08ba('0x4a')][_0x08ba('0x4b')](function(_0x4f3c9d){return db[_0x08ba('0x2b')][_0x08ba('0x48')]({'where':{'id':_0x14a046[_0x08ba('0x46')]['id']}})[_0x08ba('0x18')](handleEntityNotFound(_0x5ba112,null))[_0x08ba('0x18')](saveUpdates(_0x14a046['body'],null))[_0x08ba('0x18')](function(_0x5ba385){if(_0x5ba385){_0x1b6973=_0x5ba385;return db['Network'][_0x08ba('0x43')]({'where':{'type':_0x1b6973[_0x08ba('0x3c')]},'raw':!![]});}return null;})[_0x08ba('0x18')](function(_0x2c6e09){if(_0x2c6e09){var _0x208f29=fs[_0x08ba('0x4d')](path[_0x08ba('0x56')](config[_0x08ba('0x57')],'server/files/templates/network.ejs'),'utf8');var _0x578e38=ejs[_0x08ba('0x50')](_0x208f29,{'networks':_0x2c6e09||[]});fs[_0x08ba('0x58')](util[_0x08ba('0x51')](_0x08ba('0x52'),_0x1b6973[_0x08ba('0x3c')][_0x08ba('0x53')]()),_0x578e38);return respondWithRpcPromise(_0x08ba('0x54'),_0x08ba('0x27'),{'module':_0x08ba('0x55')});}return null;})['then'](function(_0x446af2){if(_0x446af2){return _0x1b6973;}return null;});})[_0x08ba('0x18')](respondWithResult(_0x5ba112,null))['catch'](handleError(_0x5ba112,null));};exports[_0x08ba('0x59')]=function(_0x2bbc8a,_0x42b075,_0x37d97d){var _0x5a9d9d;return db[_0x08ba('0x2b')][_0x08ba('0x48')]({'where':{'id':_0x2bbc8a['params']['id']}})[_0x08ba('0x18')](function(_0x2cbb87){_0x5a9d9d=_0x2cbb87;return _0x2cbb87;})[_0x08ba('0x18')](handleEntityNotFound(_0x42b075,null))[_0x08ba('0x18')](removeEntity(_0x42b075,null))['then'](function(){if(_0x5a9d9d){return db[_0x08ba('0x2b')]['findAll']({'where':{'type':_0x5a9d9d[_0x08ba('0x3c')]},'raw':!![]});}})['then'](function(_0x13ca86){if(_0x13ca86){var _0x3cf3fb=fs[_0x08ba('0x4d')](path['join'](config['root'],_0x08ba('0x4e')),'utf8');var _0x64e6b9=ejs[_0x08ba('0x50')](_0x3cf3fb,{'networks':_0x13ca86||[]});fs[_0x08ba('0x58')](util['format'](_0x08ba('0x52'),_0x5a9d9d[_0x08ba('0x3c')][_0x08ba('0x53')]()),_0x64e6b9);return respondWithRpcPromise('Reload','destroy',{'module':_0x08ba('0x55')});}})['catch'](handleError(_0x42b075,null));}; \ No newline at end of file +var _0x62e0=['json','count','offset','set','save','update','then','name','send','index','Network','rawAttributes','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','key','options','includeAll','include','findAll','show','fields','sequelize','body','type','join','server/files/templates/network.ejs','utf8','render','writeFileSync','format','toLowerCase','create','chan_sip.so','transaction','params','readFileSync','/etc/asterisk/sip_xcally_%s.conf','Reload','destroy','find','root','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','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','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end'];(function(_0x4abbed,_0x1d3b16){var _0x2940e2=function(_0x47149b){while(--_0x47149b){_0x4abbed['push'](_0x4abbed['shift']());}};_0x2940e2(++_0x1d3b16);}(_0x62e0,0x98));var _0x062e=function(_0x47428c,_0x47b7cb){_0x47428c=_0x47428c-0x0;var _0x283869=_0x62e0[_0x47428c];return _0x283869;};'use strict';var pdf=require(_0x062e('0x0'));var emlformat=require(_0x062e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x062e('0x2'));var jsonpatch=require(_0x062e('0x3'));var rp=require(_0x062e('0x4'));var moment=require(_0x062e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x062e('0x6'));var util=require('util');var path=require(_0x062e('0x7'));var sox=require(_0x062e('0x8'));var csv=require(_0x062e('0x9'));var ejs=require(_0x062e('0xa'));var fs=require('fs');var _=require(_0x062e('0xb'));var squel=require(_0x062e('0xc'));var crypto=require(_0x062e('0xd'));var jsforce=require(_0x062e('0xe'));var deskjs=require(_0x062e('0xf'));var toCsv=require(_0x062e('0x9'));var querystring=require(_0x062e('0x10'));var Papa=require(_0x062e('0x11'));var Redis=require(_0x062e('0x12'));var authService=require(_0x062e('0x13'));var qs=require(_0x062e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x062e('0x15'))(_0x062e('0x16'));var utils=require('../../config/utils');var config=require(_0x062e('0x17'));var db=require(_0x062e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x062e('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x1765e6,_0x14a9ce,_0x20f953){if(_0x20f953){var _0x36702b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36702b['test'](_0x14a9ce)){return _0x1765e6;}else{throw new db[(_0x062e('0x1a'))]['ValidationError'](_0x062e('0x1b'));}}else{return _0x1765e6;}}function respondWithRpcPromise(_0x377114,_0x14281,_0x2023ec,_0x4d69bf){return new BPromise(function(_0xf287b2,_0xb281e4){var _0x4a9ba7=_0x4d69bf||client;return _0x4a9ba7[_0x062e('0x1c')](_0x377114,_0x2023ec)['then'](function(_0x5a7a2d){logger['info'](_0x062e('0x1d'),_0x14281,_0x062e('0x1e'));logger['debug'](_0x062e('0x1f'),_0x14281,_0x062e('0x1e'),JSON[_0x062e('0x20')](_0x5a7a2d));if(_0x5a7a2d[_0x062e('0x21')]){if(_0x5a7a2d[_0x062e('0x21')]['code']===0x1f4){logger[_0x062e('0x21')](_0x062e('0x1d'),_0x14281,_0x5a7a2d['error'][_0x062e('0x22')]);return _0xb281e4(_0x5a7a2d[_0x062e('0x21')][_0x062e('0x22')]);}logger['error'](_0x062e('0x1d'),_0x14281,_0x5a7a2d['error'][_0x062e('0x22')]);return _0xf287b2(_0x5a7a2d['error'][_0x062e('0x22')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x14281,'request\x20sent');_0xf287b2(_0x5a7a2d[_0x062e('0x23')][_0x062e('0x22')]);}})[_0x062e('0x24')](function(_0x5b0a84){logger['error'](_0x062e('0x1d'),_0x14281,_0x5b0a84);_0xb281e4(_0x5b0a84);});});}function respondWithStatusCode(_0x39c3f9,_0x488959){_0x488959=_0x488959||0xcc;return function(_0x467731){if(_0x467731){return _0x39c3f9[_0x062e('0x25')](_0x488959);}return _0x39c3f9[_0x062e('0x26')](_0x488959)[_0x062e('0x27')]();};}function respondWithResult(_0x5163ee,_0x3eaf1a){_0x3eaf1a=_0x3eaf1a||0xc8;return function(_0x206580){if(_0x206580){return _0x5163ee['status'](_0x3eaf1a)[_0x062e('0x28')](_0x206580);}};}function respondWithFilteredResult(_0x25ab6d,_0x385cf5){return function(_0x16ed20){if(_0x16ed20){var _0x47beae=_0x16ed20[_0x062e('0x29')],_0x430f4=_0x385cf5[_0x062e('0x2a')],_0x109fb3=_0x385cf5[_0x062e('0x2a')]+_0x385cf5['limit'],_0x4924c5;if(_0x109fb3>=_0x47beae){_0x109fb3=_0x47beae;_0x4924c5=0xc8;}else{_0x4924c5=0xce;}_0x25ab6d[_0x062e('0x26')](_0x4924c5);return _0x25ab6d[_0x062e('0x2b')]('Content-Range',_0x430f4+'-'+_0x109fb3+'/'+_0x47beae)[_0x062e('0x28')](_0x16ed20);}return null;};}function patchUpdates(_0x4ce312){return function(_0x45800a){try{jsonpatch['apply'](_0x45800a,_0x4ce312,!![]);}catch(_0x4802c5){return BPromise['reject'](_0x4802c5);}return _0x45800a[_0x062e('0x2c')]();};}function saveUpdates(_0x2f3913,_0x552cb5){return function(_0x496ac8){if(_0x496ac8){return _0x496ac8[_0x062e('0x2d')](_0x2f3913)[_0x062e('0x2e')](function(_0x200349){return _0x200349;});}return null;};}function removeEntity(_0x25740f,_0x1df589){return function(_0x3d03d4){if(_0x3d03d4){return _0x3d03d4['destroy']()[_0x062e('0x2e')](function(){_0x25740f[_0x062e('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e613,_0x568a2b){return function(_0x4511d0){if(!_0x4511d0){_0x38e613['sendStatus'](0x194);}return _0x4511d0;};}function handleError(_0xf8ba55,_0x497780){_0x497780=_0x497780||0x1f4;return function(_0x18bc96){logger[_0x062e('0x21')](_0x18bc96['stack']);if(_0x18bc96['name']){delete _0x18bc96[_0x062e('0x2f')];}_0xf8ba55[_0x062e('0x26')](_0x497780)[_0x062e('0x30')](_0x18bc96);};}exports[_0x062e('0x31')]=function(_0x1e0e9a,_0x179ec4){var _0x36d644={},_0x24f014={},_0xed508f={'count':0x0,'rows':[]};var _0x495b8f=db[_0x062e('0x32')][_0x062e('0x33')];_0x24f014[_0x062e('0x34')]=_[_0x062e('0x35')](_0x495b8f);_0x24f014[_0x062e('0x36')]=_['keys'](_0x1e0e9a[_0x062e('0x36')]);_0x24f014[_0x062e('0x37')]=_['intersection'](_0x24f014[_0x062e('0x34')],_0x24f014['query']);_0x36d644[_0x062e('0x38')]=_[_0x062e('0x39')](_0x24f014[_0x062e('0x34')],qs['fields'](_0x1e0e9a['query']['fields']));_0x36d644[_0x062e('0x38')]=_0x36d644[_0x062e('0x38')][_0x062e('0x3a')]?_0x36d644['attributes']:_0x24f014[_0x062e('0x34')];if(!_0x1e0e9a[_0x062e('0x36')][_0x062e('0x3b')](_0x062e('0x3c'))){_0x36d644['limit']=qs[_0x062e('0x3d')](_0x1e0e9a['query'][_0x062e('0x3d')]);_0x36d644['offset']=qs['offset'](_0x1e0e9a[_0x062e('0x36')][_0x062e('0x2a')]);}_0x36d644[_0x062e('0x3e')]=qs[_0x062e('0x3f')](_0x1e0e9a[_0x062e('0x36')][_0x062e('0x3f')]);_0x36d644[_0x062e('0x40')]=qs[_0x062e('0x37')](_[_0x062e('0x41')](_0x1e0e9a[_0x062e('0x36')],_0x24f014[_0x062e('0x37')]));if(_0x1e0e9a[_0x062e('0x36')][_0x062e('0x42')]){_0x36d644[_0x062e('0x40')]=_[_0x062e('0x43')](_0x36d644['where'],{'$or':_[_0x062e('0x44')](_0x495b8f,function(_0x4aa6d1){if(_0x4aa6d1['type'][_0x062e('0x45')]!=='VIRTUAL'){var _0x346d13={};_0x346d13[_0x4aa6d1['field']]={'$like':'%'+_0x1e0e9a[_0x062e('0x36')][_0x062e('0x42')]+'%'};return _0x346d13;}})});}_0x36d644=_[_0x062e('0x43')]({},_0x36d644,_0x1e0e9a[_0x062e('0x46')]);var _0x326702={'where':_0x36d644[_0x062e('0x40')]};return db[_0x062e('0x32')][_0x062e('0x29')](_0x326702)['then'](function(_0x33307d){_0xed508f[_0x062e('0x29')]=_0x33307d;if(_0x1e0e9a['query'][_0x062e('0x47')]){_0x36d644[_0x062e('0x48')]=[{'all':!![]}];}return db['Network'][_0x062e('0x49')](_0x36d644);})['then'](function(_0x417ec2){_0xed508f['rows']=_0x417ec2;return _0xed508f;})[_0x062e('0x2e')](respondWithFilteredResult(_0x179ec4,_0x36d644))[_0x062e('0x24')](handleError(_0x179ec4,null));};exports[_0x062e('0x4a')]=function(_0x259477,_0x398f7d){var _0x259b5d={'raw':!![],'where':{'id':_0x259477['params']['id']}},_0x46d608={};_0x46d608['model']=_[_0x062e('0x35')](db[_0x062e('0x32')][_0x062e('0x33')]);_0x46d608['query']=_[_0x062e('0x35')](_0x259477[_0x062e('0x36')]);_0x46d608['filters']=_[_0x062e('0x39')](_0x46d608[_0x062e('0x34')],_0x46d608[_0x062e('0x36')]);_0x259b5d[_0x062e('0x38')]=_[_0x062e('0x39')](_0x46d608['model'],qs[_0x062e('0x4b')](_0x259477[_0x062e('0x36')][_0x062e('0x4b')]));_0x259b5d[_0x062e('0x38')]=_0x259b5d['attributes'][_0x062e('0x3a')]?_0x259b5d[_0x062e('0x38')]:_0x46d608['model'];if(_0x259477[_0x062e('0x36')]['includeAll']){_0x259b5d[_0x062e('0x48')]=[{'all':!![]}];}_0x259b5d=_['merge']({},_0x259b5d,_0x259477['options']);return db[_0x062e('0x32')]['find'](_0x259b5d)[_0x062e('0x2e')](handleEntityNotFound(_0x398f7d,null))[_0x062e('0x2e')](respondWithResult(_0x398f7d,null))['catch'](handleError(_0x398f7d,null));};exports['create']=function(_0x5f825f,_0x17c7ee,_0x4fbe6a){var _0x1174c3;return db[_0x062e('0x4c')]['transaction'](function(_0x4426c5){return db[_0x062e('0x32')]['create'](_0x5f825f[_0x062e('0x4d')],{'raw':!![]})['then'](function(_0x28a8eb){_0x1174c3=_0x28a8eb;return db[_0x062e('0x32')][_0x062e('0x49')]({'where':{'type':_0x5f825f[_0x062e('0x4d')][_0x062e('0x4e')]},'raw':!![]});})['then'](function(_0x3e661d){var _0x21648d=fs['readFileSync'](path[_0x062e('0x4f')](config['root'],_0x062e('0x50')),_0x062e('0x51'));var _0x59e3dd=ejs[_0x062e('0x52')](_0x21648d,{'networks':_0x3e661d||[]});fs[_0x062e('0x53')](util[_0x062e('0x54')]('/etc/asterisk/sip_xcally_%s.conf',_0x5f825f[_0x062e('0x4d')][_0x062e('0x4e')][_0x062e('0x55')]()),_0x59e3dd);})[_0x062e('0x2e')](function(){return respondWithRpcPromise('Reload',_0x062e('0x56'),{'module':_0x062e('0x57')});})['then'](function(){return _0x1174c3;});})['then'](respondWithResult(_0x17c7ee,0xc9))[_0x062e('0x24')](handleError(_0x17c7ee,null));};exports[_0x062e('0x2d')]=function(_0x1a6efe,_0x527c76,_0x24a07e){var _0xd220c7;return db['sequelize'][_0x062e('0x58')](function(_0x4e677a){return db[_0x062e('0x32')]['find']({'where':{'id':_0x1a6efe[_0x062e('0x59')]['id']}})[_0x062e('0x2e')](handleEntityNotFound(_0x527c76,null))[_0x062e('0x2e')](saveUpdates(_0x1a6efe[_0x062e('0x4d')],null))[_0x062e('0x2e')](function(_0xba0f65){if(_0xba0f65){_0xd220c7=_0xba0f65;return db[_0x062e('0x32')][_0x062e('0x49')]({'where':{'type':_0xd220c7[_0x062e('0x4e')]},'raw':!![]});}return null;})[_0x062e('0x2e')](function(_0x4f6ed9){if(_0x4f6ed9){var _0x1323be=fs[_0x062e('0x5a')](path[_0x062e('0x4f')](config['root'],_0x062e('0x50')),_0x062e('0x51'));var _0x10f912=ejs[_0x062e('0x52')](_0x1323be,{'networks':_0x4f6ed9||[]});fs[_0x062e('0x53')](util[_0x062e('0x54')](_0x062e('0x5b'),_0xd220c7[_0x062e('0x4e')][_0x062e('0x55')]()),_0x10f912);return respondWithRpcPromise(_0x062e('0x5c'),_0x062e('0x2d'),{'module':_0x062e('0x57')});}return null;})[_0x062e('0x2e')](function(_0x18c11f){if(_0x18c11f){return _0xd220c7;}return null;});})[_0x062e('0x2e')](respondWithResult(_0x527c76,null))[_0x062e('0x24')](handleError(_0x527c76,null));};exports[_0x062e('0x5d')]=function(_0x34bd29,_0x38b377,_0x5cedd0){var _0x5b25f9;return db['Network'][_0x062e('0x5e')]({'where':{'id':_0x34bd29[_0x062e('0x59')]['id']}})[_0x062e('0x2e')](function(_0x244177){_0x5b25f9=_0x244177;return _0x244177;})[_0x062e('0x2e')](handleEntityNotFound(_0x38b377,null))['then'](removeEntity(_0x38b377,null))[_0x062e('0x2e')](function(){if(_0x5b25f9){return db[_0x062e('0x32')][_0x062e('0x49')]({'where':{'type':_0x5b25f9['type']},'raw':!![]});}})[_0x062e('0x2e')](function(_0x5d3c33){if(_0x5d3c33){var _0x2feadf=fs[_0x062e('0x5a')](path[_0x062e('0x4f')](config[_0x062e('0x5f')],_0x062e('0x50')),_0x062e('0x51'));var _0x1fc709=ejs[_0x062e('0x52')](_0x2feadf,{'networks':_0x5d3c33||[]});fs['writeFileSync'](util['format'](_0x062e('0x5b'),_0x5b25f9[_0x062e('0x4e')][_0x062e('0x55')]()),_0x1fc709);return respondWithRpcPromise(_0x062e('0x5c'),_0x062e('0x5d'),{'module':_0x062e('0x57')});}})[_0x062e('0x24')](handleError(_0x38b377,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 384bb43..e2c1e13 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 _0xc1ca=['moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','Network','network','lodash','api'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0xc1ca,0xf8));var _0xac1c=function(_0x4d08ae,_0x54793a){_0x4d08ae=_0x4d08ae-0x0;var _0x193124=_0xc1ca[_0x4d08ae];return _0x193124;};'use strict';var _=require(_0xac1c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xac1c('0x1'));var moment=require(_0xac1c('0x2'));var BPromise=require(_0xac1c('0x3'));var rp=require(_0xac1c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac1c('0x5'));var attributes=require(_0xac1c('0x6'));module[_0xac1c('0x7')]=function(_0xcecce8,_0x48dac){return _0xcecce8['define'](_0xac1c('0x8'),attributes,{'tableName':_0xac1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cb9=['moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','define','network','lodash','util','../../config/logger','api'];(function(_0x111e1a,_0x85c307){var _0x448ed7=function(_0x3eaa81){while(--_0x3eaa81){_0x111e1a['push'](_0x111e1a['shift']());}};_0x448ed7(++_0x85c307);}(_0x2cb9,0x74));var _0x92cb=function(_0x41c908,_0x1ed60b){_0x41c908=_0x41c908-0x0;var _0x40f090=_0x2cb9[_0x41c908];return _0x40f090;};'use strict';var _=require(_0x92cb('0x0'));var util=require(_0x92cb('0x1'));var logger=require(_0x92cb('0x2'))(_0x92cb('0x3'));var moment=require(_0x92cb('0x4'));var BPromise=require(_0x92cb('0x5'));var rp=require(_0x92cb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x92cb('0x7'));var attributes=require(_0x92cb('0x8'));module[_0x92cb('0x9')]=function(_0x2c8920,_0x366c33){return _0x2c8920[_0x92cb('0xa')]('Network',attributes,{'tableName':_0x92cb('0xb'),'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 51fb1b5..a50a917 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 _0xecb3=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xecb3,0x6a));var _0x3ecb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xecb3[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3ecb('0x0'));var util=require(_0x3ecb('0x1'));var moment=require(_0x3ecb('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ecb('0x3'));var fs=require('fs');var Redis=require(_0x3ecb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ecb('0x5'))(_0x3ecb('0x6'));var config=require(_0x3ecb('0x7'));var jayson=require(_0x3ecb('0x8'));var client=jayson[_0x3ecb('0x9')][_0x3ecb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13edc2,_0x9364f7,_0x3fb391){return new BPromise(function(_0x21b8ca,_0x5c2b66){return client['request'](_0x13edc2,_0x3fb391)[_0x3ecb('0xb')](function(_0x2d0a73){logger['info'](_0x3ecb('0xc'),_0x9364f7,_0x3ecb('0xd'));logger[_0x3ecb('0xe')](_0x3ecb('0xf'),_0x9364f7,'request\x20sent',JSON[_0x3ecb('0x10')](_0x2d0a73));if(_0x2d0a73[_0x3ecb('0x11')]){if(_0x2d0a73[_0x3ecb('0x11')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x9364f7,_0x2d0a73['error'][_0x3ecb('0x12')]);return _0x5c2b66(_0x2d0a73['error'][_0x3ecb('0x12')]);}logger[_0x3ecb('0x11')](_0x3ecb('0xc'),_0x9364f7,_0x2d0a73[_0x3ecb('0x11')][_0x3ecb('0x12')]);return _0x21b8ca(_0x2d0a73[_0x3ecb('0x11')][_0x3ecb('0x12')]);}else{logger[_0x3ecb('0x13')]('Network,\x20%s,\x20%s',_0x9364f7,_0x3ecb('0xd'));_0x21b8ca(_0x2d0a73[_0x3ecb('0x14')][_0x3ecb('0x12')]);}})[_0x3ecb('0x15')](function(_0x118d81){logger['error'](_0x3ecb('0xc'),_0x9364f7,_0x118d81);_0x5c2b66(_0x118d81);});});} \ No newline at end of file +var _0x2842=['info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x2842,0x16f));var _0x2284=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2842[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x2284('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2284('0x1'));var rs=require(_0x2284('0x2'));var fs=require('fs');var Redis=require(_0x2284('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2284('0x4'))(_0x2284('0x5'));var config=require(_0x2284('0x6'));var jayson=require(_0x2284('0x7'));var client=jayson[_0x2284('0x8')][_0x2284('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x376e0b,_0x1aafa5,_0x1bed9b){return new BPromise(function(_0xc76c70,_0xdb8903){return client[_0x2284('0xa')](_0x376e0b,_0x1bed9b)['then'](function(_0x4a63ec){logger[_0x2284('0xb')](_0x2284('0xc'),_0x1aafa5,_0x2284('0xd'));logger[_0x2284('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x1aafa5,_0x2284('0xd'),JSON[_0x2284('0xf')](_0x4a63ec));if(_0x4a63ec[_0x2284('0x10')]){if(_0x4a63ec[_0x2284('0x10')][_0x2284('0x11')]===0x1f4){logger[_0x2284('0x10')]('Network,\x20%s,\x20%s',_0x1aafa5,_0x4a63ec[_0x2284('0x10')]['message']);return _0xdb8903(_0x4a63ec[_0x2284('0x10')][_0x2284('0x12')]);}logger['error'](_0x2284('0xc'),_0x1aafa5,_0x4a63ec[_0x2284('0x10')][_0x2284('0x12')]);return _0xc76c70(_0x4a63ec[_0x2284('0x10')][_0x2284('0x12')]);}else{logger['info'](_0x2284('0xc'),_0x1aafa5,'request\x20sent');_0xc76c70(_0x4a63ec[_0x2284('0x13')]['message']);}})[_0x2284('0x14')](function(_0x4b3323){logger['error'](_0x2284('0xc'),_0x1aafa5,_0x4b3323);_0xdb8903(_0x4b3323);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index dcc19dd..1ed8ba7 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 _0x6ba5=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents','send','update','delete','removeAnswers','removeAgents','exports','util','path'];(function(_0x142f50,_0x4783fd){var _0x45f540=function(_0x24429f){while(--_0x24429f){_0x142f50['push'](_0x142f50['shift']());}};_0x45f540(++_0x4783fd);}(_0x6ba5,0x17f));var _0x56ba=function(_0x14ced0,_0x202111){_0x14ced0=_0x14ced0-0x0;var _0x44d579=_0x6ba5[_0x14ced0];return _0x44d579;};'use strict';var multer=require('multer');var util=require(_0x56ba('0x0'));var path=require(_0x56ba('0x1'));var timeout=require(_0x56ba('0x2'));var express=require(_0x56ba('0x3'));var router=express[_0x56ba('0x4')]();var auth=require(_0x56ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x56ba('0x6'));var controller=require(_0x56ba('0x7'));router[_0x56ba('0x8')]('/',auth[_0x56ba('0x9')](),controller[_0x56ba('0xa')]);router[_0x56ba('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x56ba('0xb')]);router['get'](_0x56ba('0xc'),auth[_0x56ba('0x9')](),controller['show']);router[_0x56ba('0x8')](_0x56ba('0xd'),auth[_0x56ba('0x9')](),controller[_0x56ba('0xe')]);router[_0x56ba('0x8')](_0x56ba('0xf'),auth[_0x56ba('0x9')](),controller[_0x56ba('0x10')]);router['get'](_0x56ba('0x11'),auth[_0x56ba('0x9')](),controller[_0x56ba('0x12')]);router[_0x56ba('0x8')](_0x56ba('0x13'),auth[_0x56ba('0x9')](),controller[_0x56ba('0x14')]);router[_0x56ba('0x8')](_0x56ba('0x15'),auth[_0x56ba('0x9')](),controller['getAgents']);router[_0x56ba('0x16')]('/',auth[_0x56ba('0x9')](),controller[_0x56ba('0x17')]);router[_0x56ba('0x16')]('/:id/dispositions',auth[_0x56ba('0x9')](),controller[_0x56ba('0x18')]);router[_0x56ba('0x16')](_0x56ba('0xf'),auth[_0x56ba('0x9')](),controller['addAnswer']);router[_0x56ba('0x16')](_0x56ba('0x19'),controller[_0x56ba('0x1a')]);router[_0x56ba('0x16')](_0x56ba('0x11'),auth[_0x56ba('0x9')](),controller[_0x56ba('0x1b')]);router[_0x56ba('0x16')](_0x56ba('0x15'),auth[_0x56ba('0x9')](),controller[_0x56ba('0x1c')]);router['post']('/:id/send',auth[_0x56ba('0x9')](),controller[_0x56ba('0x1d')]);router['put'](_0x56ba('0xc'),auth[_0x56ba('0x9')](),controller[_0x56ba('0x1e')]);router[_0x56ba('0x1f')](_0x56ba('0xc'),auth[_0x56ba('0x9')](),controller['destroy']);router[_0x56ba('0x1f')](_0x56ba('0xd'),auth[_0x56ba('0x9')](),controller['removeDispositions']);router[_0x56ba('0x1f')](_0x56ba('0xf'),auth['isAuthenticated'](),controller[_0x56ba('0x20')]);router['delete'](_0x56ba('0x15'),auth[_0x56ba('0x9')](),controller[_0x56ba('0x21')]);module[_0x56ba('0x22')]=router; \ No newline at end of file +var _0xd86d=['update','delete','/:id/dispositions','removeAnswers','removeAgents','exports','multer','path','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','post','create','/:id/notify','notify','addApplications','/:id/send','send','put'];(function(_0x592757,_0x2734b5){var _0x57adfe=function(_0x5a603b){while(--_0x5a603b){_0x592757['push'](_0x592757['shift']());}};_0x57adfe(++_0x2734b5);}(_0xd86d,0xa6));var _0xdd86=function(_0x3208c0,_0x121596){_0x3208c0=_0x3208c0-0x0;var _0x5f05aa=_0xd86d[_0x3208c0];return _0x5f05aa;};'use strict';var multer=require(_0xdd86('0x0'));var util=require('util');var path=require(_0xdd86('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd86('0x2')]();var auth=require(_0xdd86('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdd86('0x4'));var controller=require(_0xdd86('0x5'));router['get']('/',auth[_0xdd86('0x6')](),controller[_0xdd86('0x7')]);router[_0xdd86('0x8')](_0xdd86('0x9'),auth[_0xdd86('0x6')](),controller['describe']);router[_0xdd86('0x8')](_0xdd86('0xa'),auth[_0xdd86('0x6')](),controller[_0xdd86('0xb')]);router[_0xdd86('0x8')]('/:id/dispositions',auth[_0xdd86('0x6')](),controller[_0xdd86('0xc')]);router[_0xdd86('0x8')](_0xdd86('0xd'),auth[_0xdd86('0x6')](),controller['getAnswers']);router[_0xdd86('0x8')](_0xdd86('0xe'),auth['isAuthenticated'](),controller[_0xdd86('0xf')]);router[_0xdd86('0x8')]('/:id/interactions',auth[_0xdd86('0x6')](),controller[_0xdd86('0x10')]);router['get'](_0xdd86('0x11'),auth[_0xdd86('0x6')](),controller['getAgents']);router[_0xdd86('0x12')]('/',auth['isAuthenticated'](),controller[_0xdd86('0x13')]);router[_0xdd86('0x12')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xdd86('0x12')](_0xdd86('0xd'),auth[_0xdd86('0x6')](),controller['addAnswer']);router['post'](_0xdd86('0x14'),controller[_0xdd86('0x15')]);router[_0xdd86('0x12')](_0xdd86('0xe'),auth[_0xdd86('0x6')](),controller[_0xdd86('0x16')]);router[_0xdd86('0x12')]('/:id/users',auth[_0xdd86('0x6')](),controller['addAgents']);router[_0xdd86('0x12')](_0xdd86('0x17'),auth['isAuthenticated'](),controller[_0xdd86('0x18')]);router[_0xdd86('0x19')]('/:id',auth[_0xdd86('0x6')](),controller[_0xdd86('0x1a')]);router[_0xdd86('0x1b')](_0xdd86('0xa'),auth[_0xdd86('0x6')](),controller['destroy']);router['delete'](_0xdd86('0x1c'),auth[_0xdd86('0x6')](),controller['removeDispositions']);router[_0xdd86('0x1b')](_0xdd86('0xd'),auth['isAuthenticated'](),controller[_0xdd86('0x1d')]);router['delete'](_0xdd86('0x11'),auth[_0xdd86('0x6')](),controller[_0xdd86('0x1e')]);module[_0xdd86('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c713bf4..3a6b5c1 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 _0xdc4d=['STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports'];(function(_0x22ec42,_0x2fab8f){var _0x9f083e=function(_0x13b90d){while(--_0x13b90d){_0x22ec42['push'](_0x22ec42['shift']());}};_0x9f083e(++_0x2fab8f);}(_0xdc4d,0x15d));var _0xddc4=function(_0x2db7c7,_0x9d6e68){_0x2db7c7=_0x2db7c7-0x0;var _0x196913=_0xdc4d[_0x2db7c7];return _0x196913;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xddc4('0x0'));module[_0xddc4('0x1')]={'name':{'type':Sequelize[_0xddc4('0x2')],'unique':_0xddc4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xddc4('0x2')]},'token':{'type':Sequelize[_0xddc4('0x2')],'defaultValue':function(){return rs[_0xddc4('0x4')]();}},'replyUri':{'type':Sequelize[_0xddc4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xddc4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xddc4('0x5')],'defaultValue':function(){return _0xddc4('0x6');}},'notificationSound':{'type':Sequelize[_0xddc4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xddc4('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xddc4('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xddc4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xddc4('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xddc4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xddc4('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xddc4('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xddc4('0xa'),'set':function(_0x143890){if(!_0x143890)this[_0xddc4('0xb')](_0xddc4('0xc'),null);this[_0xddc4('0xb')]('mandatoryDisposition',_0x143890);}}}; \ No newline at end of file +var _0x3b88=['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','sequelize','randomstring','exports','STRING','name','generate','TEXT'];(function(_0xdbe14f,_0x1020e3){var _0x1d0618=function(_0x22b955){while(--_0x22b955){_0xdbe14f['push'](_0xdbe14f['shift']());}};_0x1d0618(++_0x1020e3);}(_0x3b88,0x7b));var _0x83b8=function(_0x30ffbb,_0x255080){_0x30ffbb=_0x30ffbb-0x0;var _0x3758f9=_0x3b88[_0x30ffbb];return _0x3758f9;};'use strict';var Sequelize=require(_0x83b8('0x0'));var rs=require(_0x83b8('0x1'));module[_0x83b8('0x2')]={'name':{'type':Sequelize[_0x83b8('0x3')],'unique':_0x83b8('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x83b8('0x3')]},'token':{'type':Sequelize[_0x83b8('0x3')],'defaultValue':function(){return rs[_0x83b8('0x5')]();}},'replyUri':{'type':Sequelize[_0x83b8('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x83b8('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x83b8('0x6')],'defaultValue':function(){return _0x83b8('0x7');}},'notificationSound':{'type':Sequelize[_0x83b8('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x83b8('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x83b8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x83b8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x83b8('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x83b8('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x83b8('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x83b8('0xb'),'set':function(_0x1f0896){if(!_0x1f0896)this['setDataValue'](_0x83b8('0xc'),null);this['setDataValue']('mandatoryDisposition',_0x1f0896);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 122be52..84b196b 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 _0xec1d=['offset','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','map','type','key','VIRTUAL','field','options','OpenchannelAccount','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','describe','addDisposition','OpnechannelAccountId','Disposition','hasOwnProperty','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','created','interaction','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','EventManager','OpenchannelAccountId','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','Messages','dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','client','test','Sequelize','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','count'];(function(_0x3bfa4b,_0x130beb){var _0xde29e2=function(_0x14dec7){while(--_0x14dec7){_0x3bfa4b['push'](_0x3bfa4b['shift']());}};_0xde29e2(++_0x130beb);}(_0xec1d,0x148));var _0xdec1=function(_0x299bb9,_0x3e122f){_0x299bb9=_0x299bb9-0x0;var _0x1aa16b=_0xec1d[_0x299bb9];return _0x1aa16b;};'use strict';var pdf=require(_0xdec1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdec1('0x1'));var zipdir=require(_0xdec1('0x2'));var jsonpatch=require(_0xdec1('0x3'));var rp=require(_0xdec1('0x4'));var moment=require(_0xdec1('0x5'));var BPromise=require(_0xdec1('0x6'));var Mustache=require('mustache');var util=require(_0xdec1('0x7'));var path=require(_0xdec1('0x8'));var sox=require('sox');var csv=require(_0xdec1('0x9'));var ejs=require(_0xdec1('0xa'));var fs=require('fs');var _=require(_0xdec1('0xb'));var squel=require('squel');var crypto=require(_0xdec1('0xc'));var jsforce=require(_0xdec1('0xd'));var deskjs=require(_0xdec1('0xe'));var toCsv=require(_0xdec1('0x9'));var querystring=require(_0xdec1('0xf'));var Papa=require('papaparse');var Redis=require(_0xdec1('0x10'));var authService=require(_0xdec1('0x11'));var qs=require(_0xdec1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdec1('0x13'))(_0xdec1('0x14'));var utils=require(_0xdec1('0x15'));var config=require('../../config/environment');var db=require(_0xdec1('0x16'))['db'];config['redis']=_[_0xdec1('0x17')](config[_0xdec1('0x18')],{'host':_0xdec1('0x19'),'port':0x18eb});var socket=require(_0xdec1('0x1a'))(new Redis(config[_0xdec1('0x18')]));require(_0xdec1('0x1b'))[_0xdec1('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xdec1('0x1d')]({'port':0x232c});var client9002=jayson[_0xdec1('0x1e')][_0xdec1('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x304914,_0x22bd31,_0xa22ca4){if(_0xa22ca4){var _0x594a26=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x594a26[_0xdec1('0x1f')](_0x22bd31)){return _0x304914;}else{throw new db[(_0xdec1('0x20'))]['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 _0x304914;}}function respondWithRpcPromise(_0x48b106,_0x123aeb,_0x335555,_0x3f0b37){return new BPromise(function(_0xa8e969,_0x871e01){var _0x38bfdd=_0x3f0b37||client;return _0x38bfdd[_0xdec1('0x21')](_0x48b106,_0x335555)[_0xdec1('0x22')](function(_0x5b10e2){logger[_0xdec1('0x23')](_0xdec1('0x24'),_0x123aeb,_0xdec1('0x25'));logger[_0xdec1('0x26')](_0xdec1('0x27'),_0x123aeb,'request\x20sent',JSON[_0xdec1('0x28')](_0x5b10e2));if(_0x5b10e2['error']){if(_0x5b10e2['error'][_0xdec1('0x29')]===0x1f4){logger[_0xdec1('0x2a')](_0xdec1('0x24'),_0x123aeb,_0x5b10e2[_0xdec1('0x2a')]['message']);return _0x871e01(_0x5b10e2[_0xdec1('0x2a')]['message']);}logger['error'](_0xdec1('0x24'),_0x123aeb,_0x5b10e2['error'][_0xdec1('0x2b')]);return _0xa8e969(_0x5b10e2[_0xdec1('0x2a')][_0xdec1('0x2b')]);}else{logger[_0xdec1('0x23')](_0xdec1('0x24'),_0x123aeb,'request\x20sent');_0xa8e969(_0x5b10e2[_0xdec1('0x2c')][_0xdec1('0x2b')]);}})[_0xdec1('0x2d')](function(_0x44aa16){logger[_0xdec1('0x2a')](_0xdec1('0x24'),_0x123aeb,_0x44aa16);_0x871e01(_0x44aa16);});});}function respondWithStatusCode(_0x2b3402,_0x32b2de){_0x32b2de=_0x32b2de||0xcc;return function(_0x280f8f){if(_0x280f8f){return _0x2b3402[_0xdec1('0x2e')](_0x32b2de);}return _0x2b3402[_0xdec1('0x2f')](_0x32b2de)['end']();};}function respondWithResult(_0x23ba19,_0x56818e){_0x56818e=_0x56818e||0xc8;return function(_0x5b2cc5){if(_0x5b2cc5){return _0x23ba19[_0xdec1('0x2f')](_0x56818e)[_0xdec1('0x30')](_0x5b2cc5);}};}function respondWithFilteredResult(_0x22a5bd,_0x5c01b3){return function(_0x593ee6){if(_0x593ee6){var _0x4c1751=_0x593ee6[_0xdec1('0x31')],_0x269936=_0x5c01b3['offset'],_0x3aad62=_0x5c01b3[_0xdec1('0x32')]+_0x5c01b3['limit'],_0x2d1b2f;if(_0x3aad62>=_0x4c1751){_0x3aad62=_0x4c1751;_0x2d1b2f=0xc8;}else{_0x2d1b2f=0xce;}_0x22a5bd[_0xdec1('0x2f')](_0x2d1b2f);return _0x22a5bd[_0xdec1('0x33')](_0xdec1('0x34'),_0x269936+'-'+_0x3aad62+'/'+_0x4c1751)['json'](_0x593ee6);}return null;};}function patchUpdates(_0x4c5c22){return function(_0x499850){try{jsonpatch[_0xdec1('0x35')](_0x499850,_0x4c5c22,!![]);}catch(_0x1dc7d5){return BPromise['reject'](_0x1dc7d5);}return _0x499850[_0xdec1('0x36')]();};}function saveUpdates(_0x4f20cb,_0x228b6e){return function(_0x17e9d4){if(_0x17e9d4){return _0x17e9d4[_0xdec1('0x37')](_0x4f20cb)[_0xdec1('0x22')](function(_0x5371bd){return _0x5371bd;});}return null;};}function removeEntity(_0x2487f1,_0x1e45e7){return function(_0xb806c0){if(_0xb806c0){return _0xb806c0[_0xdec1('0x38')]()[_0xdec1('0x22')](function(){var _0x5607c6=_0xb806c0[_0xdec1('0x39')]({'plain':!![]});var _0x23f7f7='OpenchannelAccounts';return db[_0xdec1('0x3a')][_0xdec1('0x38')]({'where':{'type':_0x23f7f7,'resourceId':_0x5607c6['id']}})[_0xdec1('0x22')](function(){return _0xb806c0;});})['then'](function(){_0x2487f1[_0xdec1('0x2f')](0xcc)[_0xdec1('0x3b')]();});}};}function handleEntityNotFound(_0x4a6712,_0x68755f){return function(_0x46c1a0){if(!_0x46c1a0){_0x4a6712[_0xdec1('0x2e')](0x194);}return _0x46c1a0;};}function handleError(_0x41411,_0xcc0b78){_0xcc0b78=_0xcc0b78||0x1f4;return function(_0x15ec7d){logger[_0xdec1('0x2a')](_0x15ec7d[_0xdec1('0x3c')]);if(_0x15ec7d[_0xdec1('0x3d')]){delete _0x15ec7d[_0xdec1('0x3d')];}_0x41411[_0xdec1('0x2f')](_0xcc0b78)[_0xdec1('0x3e')](_0x15ec7d);};}exports[_0xdec1('0x3f')]=function(_0x23df5c,_0x39d4ea){var _0x4b3a10={'include':[{'model':db[_0xdec1('0x40')],'as':'mandatoryDispositionPause'}]},_0x15bf0e={},_0x465cc7={'count':0x0,'rows':[]};var _0x118c76=db['OpenchannelAccount'][_0xdec1('0x41')];_0x15bf0e[_0xdec1('0x42')]=_[_0xdec1('0x43')](_0x118c76);_0x15bf0e['query']=_['keys'](_0x23df5c[_0xdec1('0x44')]);_0x15bf0e[_0xdec1('0x45')]=_[_0xdec1('0x46')](_0x15bf0e[_0xdec1('0x42')],_0x15bf0e[_0xdec1('0x44')]);_0x4b3a10[_0xdec1('0x47')]=_['intersection'](_0x15bf0e[_0xdec1('0x42')],qs[_0xdec1('0x48')](_0x23df5c['query'][_0xdec1('0x48')]));_0x4b3a10[_0xdec1('0x47')]=_0x4b3a10[_0xdec1('0x47')][_0xdec1('0x49')]?_0x4b3a10['attributes']:_0x15bf0e[_0xdec1('0x42')];if(!_0x23df5c[_0xdec1('0x44')]['hasOwnProperty'](_0xdec1('0x4a'))){_0x4b3a10[_0xdec1('0x4b')]=qs['limit'](_0x23df5c[_0xdec1('0x44')][_0xdec1('0x4b')]);_0x4b3a10[_0xdec1('0x32')]=qs[_0xdec1('0x32')](_0x23df5c[_0xdec1('0x44')][_0xdec1('0x32')]);}_0x4b3a10[_0xdec1('0x4c')]=qs[_0xdec1('0x4d')](_0x23df5c[_0xdec1('0x44')][_0xdec1('0x4d')]);_0x4b3a10['where']=qs['filters'](_['pick'](_0x23df5c['query'],_0x15bf0e['filters']));if(_0x23df5c[_0xdec1('0x44')][_0xdec1('0x4e')]){_0x4b3a10[_0xdec1('0x4f')]=_[_0xdec1('0x50')](_0x4b3a10[_0xdec1('0x4f')],{'$or':_[_0xdec1('0x51')](_0x118c76,function(_0x5be1ca){if(_0x5be1ca[_0xdec1('0x52')][_0xdec1('0x53')]!==_0xdec1('0x54')){var _0x439829={};_0x439829[_0x5be1ca[_0xdec1('0x55')]]={'$like':'%'+_0x23df5c[_0xdec1('0x44')][_0xdec1('0x4e')]+'%'};return _0x439829;}})});}_0x4b3a10=_[_0xdec1('0x50')]({},_0x4b3a10,_0x23df5c[_0xdec1('0x56')]);var _0x117ff2={'where':_0x4b3a10[_0xdec1('0x4f')]};return db[_0xdec1('0x57')]['count'](_0x117ff2)[_0xdec1('0x22')](function(_0x4285fb){_0x465cc7[_0xdec1('0x31')]=_0x4285fb;if(_0x23df5c[_0xdec1('0x44')][_0xdec1('0x58')]){_0x4b3a10[_0xdec1('0x59')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xdec1('0x5a')](_0x4b3a10);})[_0xdec1('0x22')](function(_0xa5fe98){_0x465cc7['rows']=_0xa5fe98;return _0x465cc7;})['then'](respondWithFilteredResult(_0x39d4ea,_0x4b3a10))[_0xdec1('0x2d')](handleError(_0x39d4ea,null));};exports[_0xdec1('0x5b')]=function(_0x62b7a9,_0xb6e7d7){var _0x148145={'raw':![],'where':{'id':_0x62b7a9[_0xdec1('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xdec1('0x5d')}]},_0x26149b={};_0x26149b[_0xdec1('0x42')]=_[_0xdec1('0x43')](db['OpenchannelAccount'][_0xdec1('0x41')]);_0x26149b['query']=_[_0xdec1('0x43')](_0x62b7a9[_0xdec1('0x44')]);_0x26149b['filters']=_[_0xdec1('0x46')](_0x26149b['model'],_0x26149b[_0xdec1('0x44')]);_0x148145[_0xdec1('0x47')]=_[_0xdec1('0x46')](_0x26149b[_0xdec1('0x42')],qs['fields'](_0x62b7a9[_0xdec1('0x44')][_0xdec1('0x48')]));_0x148145['attributes']=_0x148145['attributes'][_0xdec1('0x49')]?_0x148145[_0xdec1('0x47')]:_0x26149b[_0xdec1('0x42')];if(_0x62b7a9[_0xdec1('0x44')][_0xdec1('0x58')]){_0x148145['include']=[{'all':!![]}];}_0x148145=_[_0xdec1('0x50')]({},_0x148145,_0x62b7a9['options']);return db[_0xdec1('0x57')][_0xdec1('0x5e')](_0x148145)['then'](handleEntityNotFound(_0xb6e7d7,null))[_0xdec1('0x22')](respondWithResult(_0xb6e7d7,null))[_0xdec1('0x2d')](handleError(_0xb6e7d7,null));};exports[_0xdec1('0x5f')]=function(_0xcfdb22,_0x11cd0a){return db[_0xdec1('0x57')][_0xdec1('0x5f')](_0xcfdb22[_0xdec1('0x60')],{})[_0xdec1('0x22')](function(_0x422897){var _0x3bf400=_0xcfdb22['user'][_0xdec1('0x39')]({'plain':!![]});if(!_0x3bf400)throw new Error(_0xdec1('0x61'));if(_0x3bf400[_0xdec1('0x62')]===_0xdec1('0x63')){var _0x23db30=_0x422897['get']({'plain':!![]});var _0x2c0f25='OpenchannelAccounts';return db[_0xdec1('0x64')][_0xdec1('0x5e')]({'where':{'name':_0x2c0f25,'userProfileId':_0x3bf400[_0xdec1('0x65')]},'raw':!![]})[_0xdec1('0x22')](function(_0x487d66){if(_0x487d66&&_0x487d66['autoAssociation']===0x0){return db[_0xdec1('0x3a')]['create']({'name':_0x23db30[_0xdec1('0x3d')],'resourceId':_0x23db30['id'],'type':_0x487d66[_0xdec1('0x3d')],'sectionId':_0x487d66['id']},{})[_0xdec1('0x22')](function(){return _0x422897;});}else{return _0x422897;}})[_0xdec1('0x2d')](function(_0xbeebe6){logger[_0xdec1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbeebe6);throw _0xbeebe6;});}return _0x422897;})[_0xdec1('0x22')](respondWithResult(_0x11cd0a,0xc9))['catch'](handleError(_0x11cd0a,null));};exports['update']=function(_0x6da437,_0x3f3fdb){if(_0x6da437[_0xdec1('0x60')]['id']){delete _0x6da437[_0xdec1('0x60')]['id'];}return db['OpenchannelAccount'][_0xdec1('0x5e')]({'where':{'id':_0x6da437[_0xdec1('0x5c')]['id']},'include':[{'model':db[_0xdec1('0x40')],'as':_0xdec1('0x5d')}]})[_0xdec1('0x22')](handleEntityNotFound(_0x3f3fdb,null))['then'](saveUpdates(_0x6da437[_0xdec1('0x60')],null))[_0xdec1('0x22')](respondWithResult(_0x3f3fdb,null))['catch'](handleError(_0x3f3fdb,null));};exports[_0xdec1('0x38')]=function(_0x33e811,_0x50706d){return db[_0xdec1('0x57')]['find']({'where':{'id':_0x33e811[_0xdec1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x50706d,null))[_0xdec1('0x22')](removeEntity(_0x50706d,null))[_0xdec1('0x2d')](handleError(_0x50706d,null));};exports[_0xdec1('0x66')]=function(_0xef645c,_0xa654dc){return db[_0xdec1('0x57')][_0xdec1('0x66')]()['then'](respondWithResult(_0xa654dc,null))[_0xdec1('0x2d')](handleError(_0xa654dc,null));};exports[_0xdec1('0x67')]=function(_0x143b85,_0x3e4b38,_0xc43c30){if(_0x143b85[_0xdec1('0x60')]['id']){delete _0x143b85[_0xdec1('0x60')]['id'];}return db['OpenchannelAccount'][_0xdec1('0x5e')]({'where':{'id':_0x143b85[_0xdec1('0x5c')]['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x3e4b38,null))[_0xdec1('0x22')](function(_0x1c2fe9){if(_0x1c2fe9){_0x143b85[_0xdec1('0x60')][_0xdec1('0x68')]=_0x1c2fe9['id'];return db['Disposition'][_0xdec1('0x5f')](_0x143b85['body']);}})[_0xdec1('0x22')](respondWithResult(_0x3e4b38,null))[_0xdec1('0x2d')](handleError(_0x3e4b38,null));};exports['getDispositions']=function(_0x2213e6,_0x21a1ba,_0x2dc673){var _0x4daf50={'raw':![],'where':{}};var _0x19ad40={};var _0x1bd117={'count':0x0,'rows':[]};return db[_0xdec1('0x57')]['findOne']({'where':{'id':_0x2213e6['params']['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x21a1ba,null))[_0xdec1('0x22')](function(_0x2a25ce){if(_0x2a25ce){_0x19ad40[_0xdec1('0x42')]=_[_0xdec1('0x43')](db[_0xdec1('0x69')]['rawAttributes']);_0x19ad40[_0xdec1('0x44')]=_[_0xdec1('0x43')](_0x2213e6['query']);_0x19ad40[_0xdec1('0x45')]=_[_0xdec1('0x46')](_0x19ad40[_0xdec1('0x42')],_0x19ad40[_0xdec1('0x44')]);_0x4daf50[_0xdec1('0x47')]=_['intersection'](_0x19ad40[_0xdec1('0x42')],qs[_0xdec1('0x48')](_0x2213e6['query'][_0xdec1('0x48')]));_0x4daf50[_0xdec1('0x47')]=_0x4daf50['attributes'][_0xdec1('0x49')]?_0x4daf50[_0xdec1('0x47')]:_0x19ad40[_0xdec1('0x42')];if(!_0x2213e6[_0xdec1('0x44')][_0xdec1('0x6a')](_0xdec1('0x4a'))){_0x4daf50[_0xdec1('0x4b')]=qs[_0xdec1('0x4b')](_0x2213e6['query']['limit']);_0x4daf50[_0xdec1('0x32')]=qs[_0xdec1('0x32')](_0x2213e6[_0xdec1('0x44')]['offset']);}_0x4daf50['order']=qs[_0xdec1('0x4d')](_0x2213e6[_0xdec1('0x44')][_0xdec1('0x4d')]);_0x4daf50[_0xdec1('0x4f')]=qs[_0xdec1('0x45')](_[_0xdec1('0x6b')](_0x2213e6['query'],_0x19ad40[_0xdec1('0x45')]));_0x4daf50['where']['OpenchannelAccountId']=_0x2a25ce['id'];if(_0x2213e6[_0xdec1('0x44')][_0xdec1('0x4e')]){_0x4daf50[_0xdec1('0x4f')]=_['merge'](_0x4daf50[_0xdec1('0x4f')],{'$or':_[_0xdec1('0x51')](_0x4daf50[_0xdec1('0x47')],function(_0x187404){var _0x36874c={};_0x36874c[_0x187404]={'$like':'%'+_0x2213e6[_0xdec1('0x44')][_0xdec1('0x4e')]+'%'};return _0x36874c;})});}_0x4daf50=_['merge']({},_0x4daf50,_0x2213e6[_0xdec1('0x56')]);return db[_0xdec1('0x69')]['count']({'where':_0x4daf50[_0xdec1('0x4f')]})[_0xdec1('0x22')](function(_0x58bd3d){_0x1bd117['count']=_0x58bd3d;if(_0x2213e6[_0xdec1('0x44')][_0xdec1('0x58')]){_0x4daf50[_0xdec1('0x59')]=[{'all':!![]}];}return db[_0xdec1('0x69')]['findAll'](_0x4daf50);})[_0xdec1('0x22')](function(_0x3fb6e8){_0x1bd117[_0xdec1('0x6c')]=_0x3fb6e8;return _0x1bd117;});}})[_0xdec1('0x22')](respondWithFilteredResult(_0x21a1ba,_0x4daf50))[_0xdec1('0x2d')](handleError(_0x21a1ba,null));};exports[_0xdec1('0x6d')]=function(_0x4c2ecb,_0x33dde2,_0x289a03){return db[_0xdec1('0x57')][_0xdec1('0x5e')]({'where':{'id':_0x4c2ecb[_0xdec1('0x5c')]['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x33dde2,null))[_0xdec1('0x22')](function(_0x538e24){if(_0x538e24){return _0x538e24[_0xdec1('0x6d')](_0x4c2ecb[_0xdec1('0x44')][_0xdec1('0x6e')]);}})[_0xdec1('0x22')](respondWithStatusCode(_0x33dde2,null))[_0xdec1('0x2d')](handleError(_0x33dde2,null));};exports['addAnswer']=function(_0x3c7253,_0x187432,_0xe86317){if(_0x3c7253[_0xdec1('0x60')]['id']){delete _0x3c7253[_0xdec1('0x60')]['id'];}return db[_0xdec1('0x57')][_0xdec1('0x5e')]({'where':{'id':_0x3c7253[_0xdec1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x187432,null))[_0xdec1('0x22')](function(_0x489671){if(_0x489671){_0x3c7253['body']['OpenchannelAccountId']=_0x489671['id'];return db[_0xdec1('0x6f')]['create'](_0x3c7253[_0xdec1('0x60')]);}})[_0xdec1('0x22')](respondWithResult(_0x187432,null))[_0xdec1('0x2d')](handleError(_0x187432,null));};exports[_0xdec1('0x70')]=function(_0x177b0c,_0x3e64b0,_0x221a73){var _0x249686={'raw':![],'where':{}};var _0x22b563={};var _0x34710b={'count':0x0,'rows':[]};return db[_0xdec1('0x57')][_0xdec1('0x71')]({'where':{'id':_0x177b0c['params']['id']}})['then'](handleEntityNotFound(_0x3e64b0,null))[_0xdec1('0x22')](function(_0x283a8){if(_0x283a8){_0x22b563['model']=_[_0xdec1('0x43')](db[_0xdec1('0x6f')]['rawAttributes']);_0x22b563[_0xdec1('0x44')]=_[_0xdec1('0x43')](_0x177b0c[_0xdec1('0x44')]);_0x22b563[_0xdec1('0x45')]=_[_0xdec1('0x46')](_0x22b563[_0xdec1('0x42')],_0x22b563[_0xdec1('0x44')]);_0x249686[_0xdec1('0x47')]=_[_0xdec1('0x46')](_0x22b563[_0xdec1('0x42')],qs[_0xdec1('0x48')](_0x177b0c[_0xdec1('0x44')][_0xdec1('0x48')]));_0x249686['attributes']=_0x249686[_0xdec1('0x47')][_0xdec1('0x49')]?_0x249686[_0xdec1('0x47')]:_0x22b563[_0xdec1('0x42')];if(!_0x177b0c[_0xdec1('0x44')]['hasOwnProperty'](_0xdec1('0x4a'))){_0x249686[_0xdec1('0x4b')]=qs[_0xdec1('0x4b')](_0x177b0c['query']['limit']);_0x249686[_0xdec1('0x32')]=qs[_0xdec1('0x32')](_0x177b0c[_0xdec1('0x44')]['offset']);}_0x249686['order']=qs[_0xdec1('0x4d')](_0x177b0c[_0xdec1('0x44')][_0xdec1('0x4d')]);_0x249686[_0xdec1('0x4f')]=qs[_0xdec1('0x45')](_['pick'](_0x177b0c['query'],_0x22b563['filters']));_0x249686[_0xdec1('0x4f')]['OpenchannelAccountId']=_0x283a8['id'];if(_0x177b0c['query'][_0xdec1('0x4e')]){_0x249686['where']=_[_0xdec1('0x50')](_0x249686[_0xdec1('0x4f')],{'$or':_['map'](_0x249686[_0xdec1('0x47')],function(_0x1ad168){var _0xb36ada={};_0xb36ada[_0x1ad168]={'$like':'%'+_0x177b0c[_0xdec1('0x44')]['filter']+'%'};return _0xb36ada;})});}_0x249686=_[_0xdec1('0x50')]({},_0x249686,_0x177b0c[_0xdec1('0x56')]);return db[_0xdec1('0x6f')][_0xdec1('0x31')]({'where':_0x249686[_0xdec1('0x4f')]})['then'](function(_0x52343f){_0x34710b[_0xdec1('0x31')]=_0x52343f;if(_0x177b0c[_0xdec1('0x44')][_0xdec1('0x58')]){_0x249686[_0xdec1('0x59')]=[{'all':!![]}];}return db[_0xdec1('0x6f')][_0xdec1('0x5a')](_0x249686);})[_0xdec1('0x22')](function(_0xa12485){_0x34710b['rows']=_0xa12485;return _0x34710b;});}})['then'](respondWithFilteredResult(_0x3e64b0,_0x249686))[_0xdec1('0x2d')](handleError(_0x3e64b0,null));};exports[_0xdec1('0x72')]=function(_0x1c2a6b,_0x336920,_0x1556f6){return db[_0xdec1('0x57')]['find']({'where':{'id':_0x1c2a6b['params']['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x336920,null))['then'](function(_0x4614cb){if(_0x4614cb){return _0x4614cb[_0xdec1('0x72')](_0x1c2a6b['query']['ids']);}})[_0xdec1('0x22')](respondWithStatusCode(_0x336920,null))[_0xdec1('0x2d')](handleError(_0x336920,null));};exports[_0xdec1('0x73')]=function(_0x5ecf42,_0x285ef1,_0x246c62){var _0x32767b={'body':_0x5ecf42[_0xdec1('0x60')],'channel':_0xdec1('0x74')};var _0x5e2026=[];var _0xa44b69=[];var _0x50cd97={};var _0x1ca017=![];return db[_0xdec1('0x75')][_0xdec1('0x66')]()[_0xdec1('0x22')](function(_0x390898){if(!_0x390898){throw new db[(_0xdec1('0x20'))][(_0xdec1('0x76'))](_0xdec1('0x77'));}_0x5e2026=_[_0xdec1('0x78')](_[_0xdec1('0x43')](_0x390898),[_0xdec1('0x79'),_0xdec1('0x7a')]);_0xa44b69=_[_0xdec1('0x78')](_[_0xdec1('0x43')](_0x390898),[_0xdec1('0x79'),_0xdec1('0x7a'),_0xdec1('0x7b'),_0xdec1('0x7c')]);if(_0x5ecf42['body']['id']){delete _0x5ecf42[_0xdec1('0x60')]['id'];}if(_[_0xdec1('0x7d')](_0x5ecf42['body'][_0xdec1('0x7e')])){throw new db[(_0xdec1('0x20'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xdec1('0x7d')](_0x5ecf42[_0xdec1('0x60')]['body'])||_0x5ecf42['body'][_0xdec1('0x60')]===''){throw new db[(_0xdec1('0x20'))][(_0xdec1('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdec1('0x7d')](_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x7f')])){throw new db[(_0xdec1('0x20'))][(_0xdec1('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa44b69);}if(!_[_0xdec1('0x80')](_0xa44b69,_0x5ecf42['body']['mapKey'])){throw new db[(_0xdec1('0x20'))][(_0xdec1('0x76'))](_0xdec1('0x81')+_0xa44b69);}_0x50cd97[_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x7f')]]=_0x5ecf42['body'][_0xdec1('0x7e')];})['then'](function(){return db[_0xdec1('0x57')][_0xdec1('0x5e')]({'where':{'id':_0x5ecf42[_0xdec1('0x5c')]['id']},'include':[{'model':db[_0xdec1('0x82')],'as':'List','include':[{'model':db[_0xdec1('0x75')],'as':_0xdec1('0x83'),'where':_0x50cd97,'limit':0x1,'order':[[_0xdec1('0x7a'),'DESC']]}]},{'model':db[_0xdec1('0x84')],'as':_0xdec1('0x85')}]});})[_0xdec1('0x22')](handleEntityNotFound(_0x285ef1,null))[_0xdec1('0x22')](function(_0x4bdad7){if(_0x4bdad7&&_0x4bdad7[_0xdec1('0x86')]){_0x32767b[_0xdec1('0x87')]=_0x4bdad7;_0x32767b[_0xdec1('0x88')]=_0x4bdad7[_0xdec1('0x85')];_0x32767b[_0xdec1('0x89')]=_0x4bdad7[_0xdec1('0x86')];_0x32767b[_0xdec1('0x88')]=_[_0xdec1('0x8a')](_0x32767b[_0xdec1('0x88')],[_0xdec1('0x8b')],[_0xdec1('0x8c')]);if(_0x32767b['account'][_0xdec1('0x85')]){delete _0x32767b[_0xdec1('0x87')][_0xdec1('0x85')];}if(_0x32767b['account'][_0xdec1('0x86')]&&_0x32767b[_0xdec1('0x87')][_0xdec1('0x86')][_0xdec1('0x83')][_0xdec1('0x49')]){return _0x32767b[_0xdec1('0x87')][_0xdec1('0x86')]['Contacts'][0x0];}var _0x477105=_[_0xdec1('0x17')](_0x5ecf42[_0xdec1('0x60')],{'firstName':_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x7e')],'ListId':_0x4bdad7[_0xdec1('0x7c')]});_0x477105[_0x5ecf42[_0xdec1('0x60')]['mapKey']]=_0x5ecf42['body'][_0xdec1('0x7e')];return db[_0xdec1('0x75')][_0xdec1('0x5f')](_0x477105,{'fields':_0x5e2026,'raw':!![]});}})[_0xdec1('0x22')](handleEntityNotFound(_0x285ef1,null))[_0xdec1('0x22')](function(_0x4462a9){_0x32767b['contact']=_0x4462a9;if(_0x4462a9){var _0x51dcaa={'ContactId':_0x4462a9['id'],'OpenchannelAccountId':_0x5ecf42[_0xdec1('0x5c')]['id'],'from':(_0x4462a9[_0xdec1('0x8d')]||'')+'\x20'+(_0x4462a9[_0xdec1('0x8e')]||'')};var _0x488240={'OpenchannelAccountId':_0x5ecf42[_0xdec1('0x5c')]['id'],'closed':![]};if(_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x8f')]){_0x488240[_0xdec1('0x8f')]=_0x5ecf42['body'][_0xdec1('0x8f')];return db['OpenchannelInteraction'][_0xdec1('0x5e')]({'where':_0x488240})[_0xdec1('0x22')](function(_0x3181a7){if(_0x3181a7){return[_0x3181a7,![]];}_0x51dcaa[_0xdec1('0x8f')]=_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x8f')];_0x51dcaa[_0xdec1('0x90')]=_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x90')];return db[_0xdec1('0x91')][_0xdec1('0x5f')](_0x51dcaa)[_0xdec1('0x22')](function(_0x556fd5){return[_0x556fd5,!![]];});});}else{_0x488240['threadId']=null;}_0x488240[_0xdec1('0x92')]=_0x4462a9['id'];return db[_0xdec1('0x91')]['find']({'where':_0x488240})['then'](function(_0x34b1a4){if(_0x34b1a4){return[_0x34b1a4,![]];}return db[_0xdec1('0x91')]['create'](_0x51dcaa)[_0xdec1('0x22')](function(_0x4386e9){return[_0x4386e9,!![]];});});}})[_0xdec1('0x93')](function(_0x2b786e,_0x2a6e88){if(_0x2b786e){_0x1ca017=_0x2a6e88;if(!_0x2a6e88){var _0x1248c0={'from':(_0x32767b['contact'][_0xdec1('0x8d')]||'')+'\x20'+(_0x32767b['contact']['lastName']||'')};if(_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x8f')]&&_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x94')]&&_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x8f')]!=_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x94')]){_0x1248c0[_0xdec1('0x8f')]=_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x94')];}return _0x2b786e[_0xdec1('0x37')](_0x1248c0);}else{return _0x2b786e;}}})[_0xdec1('0x22')](function(_0xdeb499){_0x32767b['interaction']=_0xdeb499[_0xdec1('0x39')]({'plain':!![]});_0x32767b['interaction'][_0xdec1('0x95')]=_0x1ca017;if(_0x32767b[_0xdec1('0x96')]['created']){if(_0x32767b[_0xdec1('0x87')][_0xdec1('0x97')]){_0x32767b[_0xdec1('0x88')][_0xdec1('0x98')]({'id':0x0,'priority':_0x32767b[_0xdec1('0x88')][_0xdec1('0x49')]+0x1,'app':_0xdec1('0x99'),'appdata':_0xdec1('0x9a'),'interval':'*,*,*,*'});}}return db[_0xdec1('0x9b')][_0xdec1('0x5f')]({'body':_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x60')],'OpenchannelAccountId':_0x5ecf42[_0xdec1('0x5c')]['id'],'OpenchannelInteractionId':_0xdeb499['id'],'direction':'in','ContactId':_0x32767b['contact']['id'],'AttachmentId':_0x5ecf42[_0xdec1('0x60')][_0xdec1('0x9c')]});})['then'](function(_0x154d01){_0x32767b[_0xdec1('0x2b')]=_0x154d01;if(_0x32767b['interaction'][_0xdec1('0x9d')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x32767b[_0xdec1('0x96')]['UserId']}})[_0xdec1('0x22')](function(_0x12552c){if(_0x12552c){_0x32767b[_0xdec1('0x88')][_0xdec1('0x9e')]({'id':0x0,'priority':0x0,'app':_0xdec1('0x9f'),'appdata':_0x12552c['name']+','+(_0x32767b['account'][_0xdec1('0xa0')]||0xa),'interval':_0xdec1('0xa1')});_0x32767b[_0xdec1('0xa2')]=![];}return respondWithRpcPromise(_0xdec1('0xa3'),'startRouting',_0x32767b);});}return respondWithRpcPromise(_0xdec1('0xa3'),'startRouting',_0x32767b);})[_0xdec1('0x22')](function(_0x2df9d0){respondWithRpcPromise(_0xdec1('0xa4'),_0xdec1('0xa4'),{'event':_0xdec1('0x73'),'message':_0x2df9d0},client9002);return _0x2df9d0;})['then'](respondWithResult(_0x285ef1,null))['catch'](handleError(_0x285ef1,null));};exports['addApplications']=function(_0x1bd5d9,_0x5f19fd,_0x5f2b93){return db[_0xdec1('0x57')][_0xdec1('0x71')]({'where':{'id':_0x1bd5d9[_0xdec1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5f19fd,null))['then'](function(_0x8d943b){if(_0x8d943b){return db['sequelize']['transaction'](function(_0x464ea3){return db[_0xdec1('0x84')][_0xdec1('0x38')]({'where':{'OpenchannelAccountId':_0x1bd5d9[_0xdec1('0x5c')]['id']},'transaction':_0x464ea3})[_0xdec1('0x22')](function(_0x57aeb1){var _0x1df539=_[_0xdec1('0x51')](_0x1bd5d9['body'],function(_0x30a196){_0x30a196[_0xdec1('0xa5')]=_0x1bd5d9['params']['id'];return _0x30a196;});return db[_0xdec1('0x84')][_0xdec1('0xa6')](_0x1df539,{'transaction':_0x464ea3});});})[_0xdec1('0x22')](function(){return db['OpenchannelApplication'][_0xdec1('0xa7')]({'where':{'OpenchannelAccountId':_0x1bd5d9[_0xdec1('0x5c')]['id']},'order':'priority'});});}})[_0xdec1('0x22')](respondWithResult(_0x5f19fd,null))[_0xdec1('0x2d')](handleError(_0x5f19fd,null));};exports[_0xdec1('0xa8')]=function(_0x8ed7ff,_0x56651c,_0x274a9f){var _0x48063={};var _0x5c7089={};var _0x248e22;var _0x25305a;return db[_0xdec1('0x57')][_0xdec1('0x71')]({'where':{'id':_0x8ed7ff[_0xdec1('0x5c')]['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x56651c,null))[_0xdec1('0x22')](function(_0x331ffd){if(_0x331ffd){_0x248e22=_0x331ffd;_0x5c7089['model']=_['keys'](db[_0xdec1('0x84')][_0xdec1('0x41')]);_0x5c7089['query']=_[_0xdec1('0x43')](_0x8ed7ff['query']);_0x5c7089[_0xdec1('0x45')]=_[_0xdec1('0x46')](_0x5c7089[_0xdec1('0x42')],_0x5c7089['query']);_0x48063['attributes']=_[_0xdec1('0x46')](_0x5c7089[_0xdec1('0x42')],qs[_0xdec1('0x48')](_0x8ed7ff[_0xdec1('0x44')][_0xdec1('0x48')]));_0x48063[_0xdec1('0x47')]=_0x48063['attributes']['length']?_0x48063[_0xdec1('0x47')]:_0x5c7089['model'];_0x48063['order']=qs['sort'](_0x8ed7ff[_0xdec1('0x44')][_0xdec1('0x4d')]);_0x48063[_0xdec1('0x4f')]=qs[_0xdec1('0x45')](_['pick'](_0x8ed7ff[_0xdec1('0x44')],_0x5c7089['filters']));if(_0x8ed7ff[_0xdec1('0x44')]['filter']){_0x48063[_0xdec1('0x4f')]=_[_0xdec1('0x50')](_0x48063[_0xdec1('0x4f')],{'$or':_[_0xdec1('0x51')](_0x48063['attributes'],function(_0x496779){var _0xd4e952={};_0xd4e952[_0x496779]={'$like':'%'+_0x8ed7ff['query'][_0xdec1('0x4e')]+'%'};return _0xd4e952;})});}_0x48063=_[_0xdec1('0x50')]({},_0x48063,_0x8ed7ff[_0xdec1('0x56')]);return _0x248e22['getApplications'](_0x48063);}})[_0xdec1('0x22')](function(_0x2e3b6c){if(_0x2e3b6c){_0x25305a=_0x2e3b6c[_0xdec1('0x49')];if(!_0x8ed7ff[_0xdec1('0x44')]['hasOwnProperty'](_0xdec1('0x4a'))){_0x48063['limit']=qs['limit'](_0x8ed7ff[_0xdec1('0x44')]['limit']);_0x48063['offset']=qs[_0xdec1('0x32')](_0x8ed7ff[_0xdec1('0x44')][_0xdec1('0x32')]);}return _0x248e22['getApplications'](_0x48063);}})[_0xdec1('0x22')](function(_0x48d684){if(_0x48d684){return _0x48d684?{'count':_0x25305a,'rows':_0x48d684}:null;}})['then'](respondWithResult(_0x56651c,null))[_0xdec1('0x2d')](handleError(_0x56651c,null));};exports['getInteractions']=function(_0x2f5cd4,_0x31bb3c,_0x2bd1c9){var _0x3f9ee1={'raw':![],'where':{}};var _0x32a416={};var _0x4b248d={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2f5cd4[_0xdec1('0x5c')]['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x31bb3c,null))[_0xdec1('0x22')](function(_0x2d2fe7){if(_0x2d2fe7){_0x32a416['model']=_[_0xdec1('0x43')](db[_0xdec1('0x91')][_0xdec1('0x41')]);_0x32a416[_0xdec1('0x44')]=_[_0xdec1('0x43')](_0x2f5cd4[_0xdec1('0x44')]);_0x32a416[_0xdec1('0x45')]=_[_0xdec1('0x46')](_0x32a416[_0xdec1('0x42')],_0x32a416[_0xdec1('0x44')]);_0x3f9ee1[_0xdec1('0x47')]=_[_0xdec1('0x46')](_0x32a416['model'],qs[_0xdec1('0x48')](_0x2f5cd4[_0xdec1('0x44')][_0xdec1('0x48')]));_0x3f9ee1[_0xdec1('0x47')]=_0x3f9ee1[_0xdec1('0x47')][_0xdec1('0x49')]?_0x3f9ee1['attributes']:_0x32a416[_0xdec1('0x42')];if(!_0x2f5cd4[_0xdec1('0x44')][_0xdec1('0x6a')](_0xdec1('0x4a'))){_0x3f9ee1[_0xdec1('0x4b')]=qs['limit'](_0x2f5cd4[_0xdec1('0x44')][_0xdec1('0x4b')]);_0x3f9ee1[_0xdec1('0x32')]=qs['offset'](_0x2f5cd4[_0xdec1('0x44')][_0xdec1('0x32')]);}_0x3f9ee1[_0xdec1('0x4c')]=qs[_0xdec1('0x4d')](_0x2f5cd4['query']['sort']);_0x3f9ee1[_0xdec1('0x4f')]=qs['filters'](_[_0xdec1('0x6b')](_0x2f5cd4[_0xdec1('0x44')],_0x32a416[_0xdec1('0x45')]));_0x3f9ee1[_0xdec1('0x4f')]['OpenchannelAccountId']=_0x2d2fe7['id'];if(_0x2f5cd4[_0xdec1('0x44')][_0xdec1('0x4e')]){_0x3f9ee1[_0xdec1('0x4f')]=_['merge'](_0x3f9ee1[_0xdec1('0x4f')],{'$or':_[_0xdec1('0x51')](_0x3f9ee1[_0xdec1('0x47')],function(_0x381189){var _0xd70b3b={};_0xd70b3b[_0x381189]={'$like':'%'+_0x2f5cd4['query'][_0xdec1('0x4e')]+'%'};return _0xd70b3b;})});}_0x3f9ee1=_['merge']({},_0x3f9ee1,_0x2f5cd4[_0xdec1('0x56')]);return db[_0xdec1('0x91')][_0xdec1('0x31')]({'where':_0x3f9ee1['where']})['then'](function(_0x2d785e){_0x4b248d[_0xdec1('0x31')]=_0x2d785e;if(_0x2f5cd4[_0xdec1('0x44')]['includeAll']){_0x3f9ee1['include']=[{'model':db['CmContact'],'as':_0xdec1('0xa9'),'required':![]},{'model':db[_0xdec1('0xaa')],'as':_0xdec1('0xab'),'attributes':[_0xdec1('0x3d'),'fullname',_0xdec1('0xac')],'required':![]},{'model':db[_0xdec1('0xad')],'as':_0xdec1('0xae'),'attributes':['id','name',_0xdec1('0xaf')],'where':_0x2f5cd4[_0xdec1('0x44')][_0xdec1('0xb0')]?{'id':_0x2f5cd4[_0xdec1('0x44')][_0xdec1('0xb0')]}:undefined,'required':_0x2f5cd4[_0xdec1('0x44')][_0xdec1('0xb0')]?!![]:![]}];}return db[_0xdec1('0x91')][_0xdec1('0x5a')](_0x3f9ee1);})[_0xdec1('0x22')](function(_0x24064b){_0x4b248d[_0xdec1('0x6c')]=_0x24064b;return _0x4b248d;});}})[_0xdec1('0x22')](respondWithFilteredResult(_0x31bb3c,_0x3f9ee1))[_0xdec1('0x2d')](handleError(_0x31bb3c,null));};exports[_0xdec1('0xb1')]=function(_0x15dff4,_0x46adb2,_0x1d3c99){return db[_0xdec1('0x57')][_0xdec1('0x5e')]({'where':{'id':_0x15dff4[_0xdec1('0x5c')]['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x46adb2,null))[_0xdec1('0x22')](function(_0xc57c7c){if(_0xc57c7c){return _0xc57c7c[_0xdec1('0xb1')](_0x15dff4[_0xdec1('0x60')][_0xdec1('0x6e')],_[_0xdec1('0xb2')](_0x15dff4[_0xdec1('0x60')],[_0xdec1('0x6e'),'id'])||{})['spread'](function(_0x13a05c){for(var _0x42af43=0x0;_0x42af43<_0x15dff4[_0xdec1('0x60')][_0xdec1('0x6e')]['length'];_0x42af43+=0x1){socket[_0xdec1('0xb3')]('userOpenchannelAccount:save',{'UserId':_0x15dff4[_0xdec1('0x60')]['ids'][_0x42af43],'OpenchannelAccountId':_0x15dff4[_0xdec1('0x5c')]['id']});}return _0x13a05c;});}})[_0xdec1('0x22')](respondWithResult(_0x46adb2,null))[_0xdec1('0x2d')](handleError(_0x46adb2,null));};exports[_0xdec1('0xb4')]=function(_0x358ec0,_0x334164,_0x1be5c7){return db[_0xdec1('0x57')][_0xdec1('0x5e')]({'where':{'id':_0x358ec0[_0xdec1('0x5c')]['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x334164,null))[_0xdec1('0x22')](function(_0x326a19){if(_0x326a19){return _0x326a19['removeAgents'](_0x358ec0[_0xdec1('0x44')][_0xdec1('0x6e')])[_0xdec1('0x22')](function(){if(_[_0xdec1('0xb5')](_0x358ec0[_0xdec1('0x44')][_0xdec1('0x6e')])){for(var _0x49ec4d=0x0;_0x49ec4d<_0x358ec0[_0xdec1('0x44')][_0xdec1('0x6e')][_0xdec1('0x49')];_0x49ec4d+=0x1){socket[_0xdec1('0xb3')](_0xdec1('0xb6'),{'UserId':Number(_0x358ec0[_0xdec1('0x44')][_0xdec1('0x6e')][_0x49ec4d]),'OpenchannelAccountId':Number(_0x358ec0['params']['id'])});}}else{socket[_0xdec1('0xb3')](_0xdec1('0xb6'),{'UserId':Number(_0x358ec0['query'][_0xdec1('0x6e')]),'OpenchannelAccountId':Number(_0x358ec0['params']['id'])});}});}})[_0xdec1('0x22')](respondWithStatusCode(_0x334164,null))[_0xdec1('0x2d')](handleError(_0x334164,null));};exports[_0xdec1('0xb7')]=function(_0x2b72c3,_0x242b49,_0x372427){var _0xd7d71d={};var _0x23f416={};var _0x28d806;var _0x8a25b3;return db[_0xdec1('0x57')]['findOne']({'where':{'id':_0x2b72c3[_0xdec1('0x5c')]['id']}})[_0xdec1('0x22')](handleEntityNotFound(_0x242b49,null))[_0xdec1('0x22')](function(_0x4abc09){if(_0x4abc09){_0x28d806=_0x4abc09;_0x23f416[_0xdec1('0x42')]=_[_0xdec1('0x43')](db[_0xdec1('0xaa')][_0xdec1('0x41')]);_0x23f416[_0xdec1('0x44')]=_[_0xdec1('0x43')](_0x2b72c3[_0xdec1('0x44')]);_0x23f416[_0xdec1('0x45')]=_[_0xdec1('0x46')](_0x23f416[_0xdec1('0x42')],_0x23f416[_0xdec1('0x44')]);_0xd7d71d[_0xdec1('0x47')]=_[_0xdec1('0x46')](_0x23f416[_0xdec1('0x42')],qs[_0xdec1('0x48')](_0x2b72c3[_0xdec1('0x44')][_0xdec1('0x48')]));_0xd7d71d['attributes']=_0xd7d71d['attributes']['length']?_0xd7d71d[_0xdec1('0x47')]:_0x23f416[_0xdec1('0x42')];_0xd7d71d[_0xdec1('0x4c')]=qs[_0xdec1('0x4d')](_0x2b72c3[_0xdec1('0x44')][_0xdec1('0x4d')]);_0xd7d71d[_0xdec1('0x4f')]=qs[_0xdec1('0x45')](_[_0xdec1('0x6b')](_0x2b72c3[_0xdec1('0x44')],_0x23f416['filters']));if(_0x2b72c3[_0xdec1('0x44')][_0xdec1('0x4e')]){_0xd7d71d['where']=_[_0xdec1('0x50')](_0xd7d71d['where'],{'$or':_[_0xdec1('0x51')](_0xd7d71d[_0xdec1('0x47')],function(_0x1e4c94){var _0x202a29={};_0x202a29[_0x1e4c94]={'$like':'%'+_0x2b72c3['query'][_0xdec1('0x4e')]+'%'};return _0x202a29;})});}_0xd7d71d=_[_0xdec1('0x50')]({},_0xd7d71d,_0x2b72c3[_0xdec1('0x56')]);return _0x28d806[_0xdec1('0xb7')](_0xd7d71d);}})[_0xdec1('0x22')](function(_0x777964){if(_0x777964){_0x8a25b3=_0x777964[_0xdec1('0x49')];if(!_0x2b72c3[_0xdec1('0x44')][_0xdec1('0x6a')](_0xdec1('0x4a'))){_0xd7d71d[_0xdec1('0x4b')]=qs[_0xdec1('0x4b')](_0x2b72c3[_0xdec1('0x44')][_0xdec1('0x4b')]);_0xd7d71d[_0xdec1('0x32')]=qs[_0xdec1('0x32')](_0x2b72c3[_0xdec1('0x44')][_0xdec1('0x32')]);}return _0x28d806['getAgents'](_0xd7d71d);}})[_0xdec1('0x22')](function(_0x40c785){if(_0x40c785){return _0x40c785?{'count':_0x8a25b3,'rows':_0x40c785}:null;}})[_0xdec1('0x22')](respondWithResult(_0x242b49,null))[_0xdec1('0x2d')](handleError(_0x242b49,null));};exports[_0xdec1('0x3e')]=function(_0x5de985,_0x944997,_0xab4528){var _0x58b374,_0x320431,_0x54894c;if(_[_0xdec1('0x7d')](_0x5de985[_0xdec1('0x60')][_0xdec1('0x60')])||_0x5de985[_0xdec1('0x60')][_0xdec1('0x60')]===''){throw new db[(_0xdec1('0x20'))][(_0xdec1('0x76'))](_0xdec1('0xb8'));}if(_[_0xdec1('0x7d')](_0x5de985[_0xdec1('0x60')]['to'])){}_0x58b374=_0x5de985[_0xdec1('0x60')]['to'];return db[_0xdec1('0x57')][_0xdec1('0x71')]({'where':{'id':_0x5de985['params']['id']}})['then'](handleEntityNotFound(_0x944997,null))[_0xdec1('0x22')](function(_0x24315c){if(_0x24315c){return db[_0xdec1('0x57')][_0xdec1('0x5e')]({'where':{'id':_0x24315c['id']},'include':[{'model':db[_0xdec1('0x82')],'as':_0xdec1('0x86'),'include':[{'model':db[_0xdec1('0x75')],'as':_0xdec1('0x83'),'where':{[_0x24315c[_0xdec1('0x7f')]]:_0x58b374},'limit':0x1,'order':[[_0xdec1('0x7a'),_0xdec1('0xb9')]]}]}]})[_0xdec1('0x22')](handleEntityNotFound(_0x944997,null))[_0xdec1('0x22')](function(_0x45edd8){if(_0x45edd8&&_0x45edd8[_0xdec1('0x86')]){_0x320431=_0x45edd8['get']({'plain':!![]});if(_0x320431[_0xdec1('0x86')]&&_0x320431['List'][_0xdec1('0x83')]['length']){return _0x320431[_0xdec1('0x86')][_0xdec1('0x83')][0x0];}return db['CmContact']['create'](_[_0xdec1('0x17')](_0x5de985[_0xdec1('0x60')],{'firstName':_0x58b374,[_0x45edd8['mapKey']]:_0x58b374,'phone':_0x58b374,'ListId':_0x320431[_0xdec1('0x7c')]}));}})[_0xdec1('0x22')](handleEntityNotFound(_0x944997,null))['then'](function(_0x50c3cc){if(_0x50c3cc){_0x54894c=_0x50c3cc;return db[_0xdec1('0x91')][_0xdec1('0x5e')]({'where':{'ContactId':_0x54894c['id'],'closed':![],'OpenchannelAccountId':_0x320431['id']}})[_0xdec1('0x22')](function(_0x2e168b){if(_0x2e168b){return[_0x2e168b,![]];}return db['OpenchannelInteraction'][_0xdec1('0x5f')]({'UserId':_0x5de985[_0xdec1('0x63')]['id'],'ContactId':_0x54894c['id'],'OpenchannelAccountId':_0x320431['id'],'lastMsgDirection':_0xdec1('0xba'),'Messages':[_['merge'](_0x5de985[_0xdec1('0x60')],{'read':![],'body':_0x5de985[_0xdec1('0x60')][_0xdec1('0x60')],'OpenchannelAccountId':_0x320431['id'],'UserId':_0x5de985['user']['id'],'ContactId':_0x54894c['id']})]},{'include':[{'model':db[_0xdec1('0x9b')],'as':_0xdec1('0xbb')}]})[_0xdec1('0x22')](function(_0x4ddc77){return[_0x4ddc77,!![]];});});}})['spread'](function(_0x25ddb0,_0x2bf976){if(_0x2bf976){return _0x25ddb0;}return db[_0xdec1('0x9b')][_0xdec1('0x5f')](_['merge'](_0x5de985[_0xdec1('0x60')],{'read':![],'body':_0x5de985[_0xdec1('0x60')][_0xdec1('0x60')],'OpenchannelAccountId':_0x320431['id'],'OpenchannelInteractionId':_0x25ddb0['id'],'UserId':_0x5de985['user']['id'],'ContactId':_0x54894c['id']}))[_0xdec1('0x22')](function(_0x77b799){_0x25ddb0['dataValues'][_0xdec1('0xbb')]=[];_0x25ddb0[_0xdec1('0xbc')][_0xdec1('0xbb')]['push'](_0x77b799['dataValues']);return _0x25ddb0;});});}})[_0xdec1('0x22')](respondWithResult(_0x944997,null))[_0xdec1('0x2d')](handleError(_0x944997,null));}; \ No newline at end of file +var _0x49cc=['intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','map','key','VIRTUAL','options','count','findAll','rows','show','params','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Pause','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','nolimit','OpenchannelAccountId','filter','removeDispositions','addAnswer','CannedAnswer','findOne','removeAnswers','notify','openchannel','CmContact','createdAt','updatedAt','difference','CompanyId','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','account','applications','Applications','list','orderBy','priority','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','forcedOwnership','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','findAndCountAll','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','send','isNil','DESC','ListId','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','OpenchannelAccounts','stack','name','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','model','keys','query','filters'];(function(_0x4565d4,_0x4c790b){var _0x289f7c=function(_0x52d857){while(--_0x52d857){_0x4565d4['push'](_0x4565d4['shift']());}};_0x289f7c(++_0x4c790b);}(_0x49cc,0x121));var _0xc49c=function(_0x50204e,_0x731d94){_0x50204e=_0x50204e-0x0;var _0x67cc32=_0x49cc[_0x50204e];return _0x67cc32;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc49c('0x0'));var rimraf=require(_0xc49c('0x1'));var zipdir=require(_0xc49c('0x2'));var jsonpatch=require(_0xc49c('0x3'));var rp=require(_0xc49c('0x4'));var moment=require(_0xc49c('0x5'));var BPromise=require(_0xc49c('0x6'));var Mustache=require(_0xc49c('0x7'));var util=require(_0xc49c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc49c('0x9'));var ejs=require(_0xc49c('0xa'));var fs=require('fs');var _=require(_0xc49c('0xb'));var squel=require('squel');var crypto=require(_0xc49c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc49c('0x9'));var querystring=require(_0xc49c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xc49c('0xe'));var logger=require(_0xc49c('0xf'))(_0xc49c('0x10'));var utils=require(_0xc49c('0x11'));var config=require('../../config/environment');var db=require(_0xc49c('0x12'))['db'];config[_0xc49c('0x13')]=_[_0xc49c('0x14')](config[_0xc49c('0x13')],{'host':_0xc49c('0x15'),'port':0x18eb});var socket=require(_0xc49c('0x16'))(new Redis(config['redis']));require(_0xc49c('0x17'))[_0xc49c('0x18')](socket);var jayson=require(_0xc49c('0x19'));var client=jayson[_0xc49c('0x1a')][_0xc49c('0x1b')]({'port':0x232c});var client9002=jayson[_0xc49c('0x1a')][_0xc49c('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x367e2b,_0x182651,_0x33fde2){if(_0x33fde2){var _0x4d8524=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d8524[_0xc49c('0x1c')](_0x182651)){return _0x367e2b;}else{throw new db[(_0xc49c('0x1d'))][(_0xc49c('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 _0x367e2b;}}function respondWithRpcPromise(_0x362f11,_0x5969a3,_0x5b097f,_0xe4fe05){return new BPromise(function(_0x5b440a,_0x39a3db){var _0x39c3c8=_0xe4fe05||client;return _0x39c3c8[_0xc49c('0x1f')](_0x362f11,_0x5b097f)[_0xc49c('0x20')](function(_0x284bec){logger[_0xc49c('0x21')](_0xc49c('0x22'),_0x5969a3,_0xc49c('0x23'));logger[_0xc49c('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5969a3,_0xc49c('0x23'),JSON[_0xc49c('0x25')](_0x284bec));if(_0x284bec[_0xc49c('0x26')]){if(_0x284bec[_0xc49c('0x26')][_0xc49c('0x27')]===0x1f4){logger[_0xc49c('0x26')](_0xc49c('0x22'),_0x5969a3,_0x284bec['error'][_0xc49c('0x28')]);return _0x39a3db(_0x284bec[_0xc49c('0x26')][_0xc49c('0x28')]);}logger[_0xc49c('0x26')](_0xc49c('0x22'),_0x5969a3,_0x284bec['error'][_0xc49c('0x28')]);return _0x5b440a(_0x284bec[_0xc49c('0x26')][_0xc49c('0x28')]);}else{logger[_0xc49c('0x21')](_0xc49c('0x22'),_0x5969a3,_0xc49c('0x23'));_0x5b440a(_0x284bec['result'][_0xc49c('0x28')]);}})[_0xc49c('0x29')](function(_0x1adcf1){logger['error'](_0xc49c('0x22'),_0x5969a3,_0x1adcf1);_0x39a3db(_0x1adcf1);});});}function respondWithStatusCode(_0x3d43f7,_0x5b37ad){_0x5b37ad=_0x5b37ad||0xcc;return function(_0x1e8374){if(_0x1e8374){return _0x3d43f7[_0xc49c('0x2a')](_0x5b37ad);}return _0x3d43f7[_0xc49c('0x2b')](_0x5b37ad)[_0xc49c('0x2c')]();};}function respondWithResult(_0x353f4f,_0x33d542){_0x33d542=_0x33d542||0xc8;return function(_0x4c7fdf){if(_0x4c7fdf){return _0x353f4f[_0xc49c('0x2b')](_0x33d542)[_0xc49c('0x2d')](_0x4c7fdf);}};}function respondWithFilteredResult(_0x322e45,_0x9baa75){return function(_0x8e44ab){if(_0x8e44ab){var _0x12df6d=_0x8e44ab['count'],_0x3f9b6b=_0x9baa75['offset'],_0x20e6a0=_0x9baa75[_0xc49c('0x2e')]+_0x9baa75[_0xc49c('0x2f')],_0x5042a0;if(_0x20e6a0>=_0x12df6d){_0x20e6a0=_0x12df6d;_0x5042a0=0xc8;}else{_0x5042a0=0xce;}_0x322e45[_0xc49c('0x2b')](_0x5042a0);return _0x322e45[_0xc49c('0x30')](_0xc49c('0x31'),_0x3f9b6b+'-'+_0x20e6a0+'/'+_0x12df6d)[_0xc49c('0x2d')](_0x8e44ab);}return null;};}function patchUpdates(_0x53f8d0){return function(_0x2bf986){try{jsonpatch[_0xc49c('0x32')](_0x2bf986,_0x53f8d0,!![]);}catch(_0x5e72ea){return BPromise['reject'](_0x5e72ea);}return _0x2bf986[_0xc49c('0x33')]();};}function saveUpdates(_0x2bb84a,_0x77a532){return function(_0x4ad040){if(_0x4ad040){return _0x4ad040[_0xc49c('0x34')](_0x2bb84a)['then'](function(_0x3ab8fe){return _0x3ab8fe;});}return null;};}function removeEntity(_0x31853a,_0x101342){return function(_0x39fb87){if(_0x39fb87){return _0x39fb87[_0xc49c('0x35')]()['then'](function(){var _0x39c785=_0x39fb87['get']({'plain':!![]});var _0x29a703=_0xc49c('0x36');return db['UserProfileResource'][_0xc49c('0x35')]({'where':{'type':_0x29a703,'resourceId':_0x39c785['id']}})['then'](function(){return _0x39fb87;});})[_0xc49c('0x20')](function(){_0x31853a[_0xc49c('0x2b')](0xcc)[_0xc49c('0x2c')]();});}};}function handleEntityNotFound(_0x1232fa,_0x258a44){return function(_0x1cc2d0){if(!_0x1cc2d0){_0x1232fa['sendStatus'](0x194);}return _0x1cc2d0;};}function handleError(_0x3396f3,_0x122f8a){_0x122f8a=_0x122f8a||0x1f4;return function(_0x338984){logger[_0xc49c('0x26')](_0x338984[_0xc49c('0x37')]);if(_0x338984[_0xc49c('0x38')]){delete _0x338984[_0xc49c('0x38')];}_0x3396f3[_0xc49c('0x2b')](_0x122f8a)['send'](_0x338984);};}exports[_0xc49c('0x39')]=function(_0x5bd687,_0xe550da){var _0x2225f6={'include':[{'model':db['Pause'],'as':_0xc49c('0x3a')}]},_0x59348f={},_0x125c1a={'count':0x0,'rows':[]};var _0xc226ec=db[_0xc49c('0x3b')][_0xc49c('0x3c')];_0x59348f[_0xc49c('0x3d')]=_[_0xc49c('0x3e')](_0xc226ec);_0x59348f[_0xc49c('0x3f')]=_['keys'](_0x5bd687[_0xc49c('0x3f')]);_0x59348f[_0xc49c('0x40')]=_[_0xc49c('0x41')](_0x59348f[_0xc49c('0x3d')],_0x59348f[_0xc49c('0x3f')]);_0x2225f6[_0xc49c('0x42')]=_[_0xc49c('0x41')](_0x59348f['model'],qs[_0xc49c('0x43')](_0x5bd687[_0xc49c('0x3f')][_0xc49c('0x43')]));_0x2225f6[_0xc49c('0x42')]=_0x2225f6['attributes']['length']?_0x2225f6['attributes']:_0x59348f['model'];if(!_0x5bd687[_0xc49c('0x3f')][_0xc49c('0x44')]('nolimit')){_0x2225f6[_0xc49c('0x2f')]=qs[_0xc49c('0x2f')](_0x5bd687[_0xc49c('0x3f')]['limit']);_0x2225f6['offset']=qs[_0xc49c('0x2e')](_0x5bd687[_0xc49c('0x3f')][_0xc49c('0x2e')]);}_0x2225f6[_0xc49c('0x45')]=qs[_0xc49c('0x46')](_0x5bd687[_0xc49c('0x3f')][_0xc49c('0x46')]);_0x2225f6[_0xc49c('0x47')]=qs[_0xc49c('0x40')](_[_0xc49c('0x48')](_0x5bd687['query'],_0x59348f[_0xc49c('0x40')]));if(_0x5bd687['query']['filter']){_0x2225f6['where']=_[_0xc49c('0x49')](_0x2225f6['where'],{'$or':_[_0xc49c('0x4a')](_0xc226ec,function(_0x5bf3c5){if(_0x5bf3c5['type'][_0xc49c('0x4b')]!==_0xc49c('0x4c')){var _0xc511d7={};_0xc511d7[_0x5bf3c5['field']]={'$like':'%'+_0x5bd687[_0xc49c('0x3f')]['filter']+'%'};return _0xc511d7;}})});}_0x2225f6=_['merge']({},_0x2225f6,_0x5bd687[_0xc49c('0x4d')]);var _0x331a53={'where':_0x2225f6[_0xc49c('0x47')]};return db[_0xc49c('0x3b')][_0xc49c('0x4e')](_0x331a53)[_0xc49c('0x20')](function(_0xab7de0){_0x125c1a[_0xc49c('0x4e')]=_0xab7de0;if(_0x5bd687[_0xc49c('0x3f')]['includeAll']){_0x2225f6['include']=[{'all':!![]}];}return db[_0xc49c('0x3b')][_0xc49c('0x4f')](_0x2225f6);})[_0xc49c('0x20')](function(_0x1e5a43){_0x125c1a[_0xc49c('0x50')]=_0x1e5a43;return _0x125c1a;})[_0xc49c('0x20')](respondWithFilteredResult(_0xe550da,_0x2225f6))[_0xc49c('0x29')](handleError(_0xe550da,null));};exports[_0xc49c('0x51')]=function(_0x31e1f9,_0x656eea){var _0x3548a1={'raw':![],'where':{'id':_0x31e1f9[_0xc49c('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xc49c('0x3a')}]},_0x4c6b8a={};_0x4c6b8a[_0xc49c('0x3d')]=_[_0xc49c('0x3e')](db[_0xc49c('0x3b')][_0xc49c('0x3c')]);_0x4c6b8a[_0xc49c('0x3f')]=_['keys'](_0x31e1f9[_0xc49c('0x3f')]);_0x4c6b8a[_0xc49c('0x40')]=_['intersection'](_0x4c6b8a[_0xc49c('0x3d')],_0x4c6b8a[_0xc49c('0x3f')]);_0x3548a1[_0xc49c('0x42')]=_['intersection'](_0x4c6b8a['model'],qs[_0xc49c('0x43')](_0x31e1f9[_0xc49c('0x3f')][_0xc49c('0x43')]));_0x3548a1[_0xc49c('0x42')]=_0x3548a1[_0xc49c('0x42')][_0xc49c('0x53')]?_0x3548a1[_0xc49c('0x42')]:_0x4c6b8a[_0xc49c('0x3d')];if(_0x31e1f9['query'][_0xc49c('0x54')]){_0x3548a1[_0xc49c('0x55')]=[{'all':!![]}];}_0x3548a1=_['merge']({},_0x3548a1,_0x31e1f9[_0xc49c('0x4d')]);return db[_0xc49c('0x3b')][_0xc49c('0x56')](_0x3548a1)[_0xc49c('0x20')](handleEntityNotFound(_0x656eea,null))[_0xc49c('0x20')](respondWithResult(_0x656eea,null))['catch'](handleError(_0x656eea,null));};exports[_0xc49c('0x57')]=function(_0x583893,_0x4d3708){return db['OpenchannelAccount'][_0xc49c('0x57')](_0x583893[_0xc49c('0x58')],{})['then'](function(_0xfb5e0c){var _0x801ea3=_0x583893[_0xc49c('0x59')][_0xc49c('0x5a')]({'plain':!![]});if(!_0x801ea3)throw new Error(_0xc49c('0x5b'));if(_0x801ea3['role']==='user'){var _0x2712fc=_0xfb5e0c['get']({'plain':!![]});var _0x1b076e=_0xc49c('0x36');return db['UserProfileSection'][_0xc49c('0x56')]({'where':{'name':_0x1b076e,'userProfileId':_0x801ea3['userProfileId']},'raw':!![]})[_0xc49c('0x20')](function(_0x21e66b){if(_0x21e66b&&_0x21e66b[_0xc49c('0x5c')]===0x0){return db['UserProfileResource'][_0xc49c('0x57')]({'name':_0x2712fc['name'],'resourceId':_0x2712fc['id'],'type':_0x21e66b['name'],'sectionId':_0x21e66b['id']},{})[_0xc49c('0x20')](function(){return _0xfb5e0c;});}else{return _0xfb5e0c;}})[_0xc49c('0x29')](function(_0x2324a6){logger[_0xc49c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2324a6);throw _0x2324a6;});}return _0xfb5e0c;})[_0xc49c('0x20')](respondWithResult(_0x4d3708,0xc9))['catch'](handleError(_0x4d3708,null));};exports[_0xc49c('0x34')]=function(_0x3dbf35,_0x2c6b4f){if(_0x3dbf35[_0xc49c('0x58')]['id']){delete _0x3dbf35[_0xc49c('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x3dbf35['params']['id']},'include':[{'model':db[_0xc49c('0x5d')],'as':_0xc49c('0x3a')}]})[_0xc49c('0x20')](handleEntityNotFound(_0x2c6b4f,null))['then'](saveUpdates(_0x3dbf35[_0xc49c('0x58')],null))['then'](respondWithResult(_0x2c6b4f,null))[_0xc49c('0x29')](handleError(_0x2c6b4f,null));};exports['destroy']=function(_0x40be11,_0x2ea2bf){return db[_0xc49c('0x3b')]['find']({'where':{'id':_0x40be11[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x2ea2bf,null))[_0xc49c('0x20')](removeEntity(_0x2ea2bf,null))[_0xc49c('0x29')](handleError(_0x2ea2bf,null));};exports['describe']=function(_0x15a920,_0x39cc17){return db[_0xc49c('0x3b')][_0xc49c('0x5e')]()[_0xc49c('0x20')](respondWithResult(_0x39cc17,null))[_0xc49c('0x29')](handleError(_0x39cc17,null));};exports[_0xc49c('0x5f')]=function(_0x381cb4,_0x59ae40,_0x3e9d22){if(_0x381cb4[_0xc49c('0x58')]['id']){delete _0x381cb4['body']['id'];}return db[_0xc49c('0x3b')][_0xc49c('0x56')]({'where':{'id':_0x381cb4[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x59ae40,null))[_0xc49c('0x20')](function(_0x34b76a){if(_0x34b76a){_0x381cb4[_0xc49c('0x58')][_0xc49c('0x60')]=_0x34b76a['id'];return db[_0xc49c('0x61')][_0xc49c('0x57')](_0x381cb4['body']);}})[_0xc49c('0x20')](respondWithResult(_0x59ae40,null))[_0xc49c('0x29')](handleError(_0x59ae40,null));};exports[_0xc49c('0x62')]=function(_0x2228a6,_0x3bf7b4,_0x7baeb6){var _0x1ab0a0={'raw':![],'where':{}};var _0xee86f9={};var _0xe7205f={'count':0x0,'rows':[]};return db[_0xc49c('0x3b')]['findOne']({'where':{'id':_0x2228a6[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x3bf7b4,null))[_0xc49c('0x20')](function(_0x895d70){if(_0x895d70){_0xee86f9[_0xc49c('0x3d')]=_[_0xc49c('0x3e')](db[_0xc49c('0x61')][_0xc49c('0x3c')]);_0xee86f9['query']=_[_0xc49c('0x3e')](_0x2228a6[_0xc49c('0x3f')]);_0xee86f9[_0xc49c('0x40')]=_[_0xc49c('0x41')](_0xee86f9['model'],_0xee86f9[_0xc49c('0x3f')]);_0x1ab0a0[_0xc49c('0x42')]=_[_0xc49c('0x41')](_0xee86f9['model'],qs[_0xc49c('0x43')](_0x2228a6[_0xc49c('0x3f')]['fields']));_0x1ab0a0[_0xc49c('0x42')]=_0x1ab0a0['attributes']['length']?_0x1ab0a0[_0xc49c('0x42')]:_0xee86f9['model'];if(!_0x2228a6[_0xc49c('0x3f')][_0xc49c('0x44')](_0xc49c('0x63'))){_0x1ab0a0[_0xc49c('0x2f')]=qs['limit'](_0x2228a6[_0xc49c('0x3f')][_0xc49c('0x2f')]);_0x1ab0a0['offset']=qs[_0xc49c('0x2e')](_0x2228a6[_0xc49c('0x3f')][_0xc49c('0x2e')]);}_0x1ab0a0[_0xc49c('0x45')]=qs[_0xc49c('0x46')](_0x2228a6[_0xc49c('0x3f')][_0xc49c('0x46')]);_0x1ab0a0[_0xc49c('0x47')]=qs['filters'](_[_0xc49c('0x48')](_0x2228a6[_0xc49c('0x3f')],_0xee86f9[_0xc49c('0x40')]));_0x1ab0a0[_0xc49c('0x47')][_0xc49c('0x64')]=_0x895d70['id'];if(_0x2228a6[_0xc49c('0x3f')][_0xc49c('0x65')]){_0x1ab0a0[_0xc49c('0x47')]=_[_0xc49c('0x49')](_0x1ab0a0[_0xc49c('0x47')],{'$or':_[_0xc49c('0x4a')](_0x1ab0a0[_0xc49c('0x42')],function(_0x40ccdf){var _0x295c9a={};_0x295c9a[_0x40ccdf]={'$like':'%'+_0x2228a6[_0xc49c('0x3f')][_0xc49c('0x65')]+'%'};return _0x295c9a;})});}_0x1ab0a0=_[_0xc49c('0x49')]({},_0x1ab0a0,_0x2228a6[_0xc49c('0x4d')]);return db['Disposition']['count']({'where':_0x1ab0a0['where']})['then'](function(_0x5ec024){_0xe7205f[_0xc49c('0x4e')]=_0x5ec024;if(_0x2228a6[_0xc49c('0x3f')][_0xc49c('0x54')]){_0x1ab0a0['include']=[{'all':!![]}];}return db[_0xc49c('0x61')][_0xc49c('0x4f')](_0x1ab0a0);})[_0xc49c('0x20')](function(_0xfc1380){_0xe7205f[_0xc49c('0x50')]=_0xfc1380;return _0xe7205f;});}})[_0xc49c('0x20')](respondWithFilteredResult(_0x3bf7b4,_0x1ab0a0))[_0xc49c('0x29')](handleError(_0x3bf7b4,null));};exports[_0xc49c('0x66')]=function(_0x5616f3,_0xd32d50,_0x53c162){return db[_0xc49c('0x3b')][_0xc49c('0x56')]({'where':{'id':_0x5616f3[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0xd32d50,null))[_0xc49c('0x20')](function(_0x28c252){if(_0x28c252){return _0x28c252[_0xc49c('0x66')](_0x5616f3[_0xc49c('0x3f')]['ids']);}})[_0xc49c('0x20')](respondWithStatusCode(_0xd32d50,null))['catch'](handleError(_0xd32d50,null));};exports[_0xc49c('0x67')]=function(_0x4754aa,_0x1ef5fd,_0x4a6a98){if(_0x4754aa['body']['id']){delete _0x4754aa['body']['id'];}return db[_0xc49c('0x3b')]['find']({'where':{'id':_0x4754aa[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x1ef5fd,null))[_0xc49c('0x20')](function(_0x1b068b){if(_0x1b068b){_0x4754aa['body'][_0xc49c('0x64')]=_0x1b068b['id'];return db[_0xc49c('0x68')][_0xc49c('0x57')](_0x4754aa[_0xc49c('0x58')]);}})['then'](respondWithResult(_0x1ef5fd,null))[_0xc49c('0x29')](handleError(_0x1ef5fd,null));};exports['getAnswers']=function(_0x56ea9b,_0x35dfe4,_0x1c5b84){var _0x24648b={'raw':![],'where':{}};var _0x209d4e={};var _0x491396={'count':0x0,'rows':[]};return db[_0xc49c('0x3b')][_0xc49c('0x69')]({'where':{'id':_0x56ea9b[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x35dfe4,null))[_0xc49c('0x20')](function(_0x43af18){if(_0x43af18){_0x209d4e[_0xc49c('0x3d')]=_['keys'](db['CannedAnswer'][_0xc49c('0x3c')]);_0x209d4e[_0xc49c('0x3f')]=_[_0xc49c('0x3e')](_0x56ea9b[_0xc49c('0x3f')]);_0x209d4e[_0xc49c('0x40')]=_[_0xc49c('0x41')](_0x209d4e[_0xc49c('0x3d')],_0x209d4e[_0xc49c('0x3f')]);_0x24648b[_0xc49c('0x42')]=_[_0xc49c('0x41')](_0x209d4e[_0xc49c('0x3d')],qs[_0xc49c('0x43')](_0x56ea9b[_0xc49c('0x3f')][_0xc49c('0x43')]));_0x24648b[_0xc49c('0x42')]=_0x24648b[_0xc49c('0x42')][_0xc49c('0x53')]?_0x24648b[_0xc49c('0x42')]:_0x209d4e[_0xc49c('0x3d')];if(!_0x56ea9b['query']['hasOwnProperty']('nolimit')){_0x24648b[_0xc49c('0x2f')]=qs[_0xc49c('0x2f')](_0x56ea9b[_0xc49c('0x3f')][_0xc49c('0x2f')]);_0x24648b['offset']=qs[_0xc49c('0x2e')](_0x56ea9b['query'][_0xc49c('0x2e')]);}_0x24648b[_0xc49c('0x45')]=qs[_0xc49c('0x46')](_0x56ea9b[_0xc49c('0x3f')][_0xc49c('0x46')]);_0x24648b['where']=qs[_0xc49c('0x40')](_[_0xc49c('0x48')](_0x56ea9b[_0xc49c('0x3f')],_0x209d4e[_0xc49c('0x40')]));_0x24648b[_0xc49c('0x47')][_0xc49c('0x64')]=_0x43af18['id'];if(_0x56ea9b[_0xc49c('0x3f')][_0xc49c('0x65')]){_0x24648b[_0xc49c('0x47')]=_[_0xc49c('0x49')](_0x24648b['where'],{'$or':_['map'](_0x24648b['attributes'],function(_0x20aab8){var _0x22c21c={};_0x22c21c[_0x20aab8]={'$like':'%'+_0x56ea9b['query'][_0xc49c('0x65')]+'%'};return _0x22c21c;})});}_0x24648b=_[_0xc49c('0x49')]({},_0x24648b,_0x56ea9b[_0xc49c('0x4d')]);return db['CannedAnswer'][_0xc49c('0x4e')]({'where':_0x24648b['where']})[_0xc49c('0x20')](function(_0x24ddd9){_0x491396['count']=_0x24ddd9;if(_0x56ea9b[_0xc49c('0x3f')]['includeAll']){_0x24648b['include']=[{'all':!![]}];}return db[_0xc49c('0x68')][_0xc49c('0x4f')](_0x24648b);})['then'](function(_0x1b7f8f){_0x491396['rows']=_0x1b7f8f;return _0x491396;});}})['then'](respondWithFilteredResult(_0x35dfe4,_0x24648b))[_0xc49c('0x29')](handleError(_0x35dfe4,null));};exports[_0xc49c('0x6a')]=function(_0x466cf2,_0x34118a,_0x21deb3){return db[_0xc49c('0x3b')]['find']({'where':{'id':_0x466cf2[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x34118a,null))[_0xc49c('0x20')](function(_0x50ba6a){if(_0x50ba6a){return _0x50ba6a[_0xc49c('0x6a')](_0x466cf2['query']['ids']);}})['then'](respondWithStatusCode(_0x34118a,null))[_0xc49c('0x29')](handleError(_0x34118a,null));};exports[_0xc49c('0x6b')]=function(_0x2efbe6,_0x5f5dfc,_0x1e74bf){var _0x1512d6={'body':_0x2efbe6[_0xc49c('0x58')],'channel':_0xc49c('0x6c')};var _0x578f29=[];var _0x5d4841=[];var _0x9010fe={};var _0x4b5b48=![];return db[_0xc49c('0x6d')][_0xc49c('0x5e')]()[_0xc49c('0x20')](function(_0x26b3e8){if(!_0x26b3e8){throw new db[(_0xc49c('0x1d'))][(_0xc49c('0x1e'))]('no\x20available\x20attributes');}_0x578f29=_['difference'](_['keys'](_0x26b3e8),[_0xc49c('0x6e'),_0xc49c('0x6f')]);_0x5d4841=_[_0xc49c('0x70')](_[_0xc49c('0x3e')](_0x26b3e8),['createdAt',_0xc49c('0x6f'),_0xc49c('0x71'),'ListId']);if(_0x2efbe6[_0xc49c('0x58')]['id']){delete _0x2efbe6['body']['id'];}if(_['isNil'](_0x2efbe6['body'][_0xc49c('0x72')])){throw new db[(_0xc49c('0x1d'))][(_0xc49c('0x1e'))](_0xc49c('0x73'));}if(_['isNil'](_0x2efbe6['body'][_0xc49c('0x58')])||_0x2efbe6[_0xc49c('0x58')][_0xc49c('0x58')]===''){throw new db[(_0xc49c('0x1d'))][(_0xc49c('0x1e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2efbe6[_0xc49c('0x58')][_0xc49c('0x74')])){throw new db[(_0xc49c('0x1d'))][(_0xc49c('0x1e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d4841);}if(!_['includes'](_0x5d4841,_0x2efbe6[_0xc49c('0x58')][_0xc49c('0x74')])){throw new db[(_0xc49c('0x1d'))][(_0xc49c('0x1e'))](_0xc49c('0x75')+_0x5d4841);}_0x9010fe[_0x2efbe6['body'][_0xc49c('0x74')]]=_0x2efbe6[_0xc49c('0x58')]['from'];})[_0xc49c('0x20')](function(){return db[_0xc49c('0x3b')][_0xc49c('0x56')]({'where':{'id':_0x2efbe6['params']['id']},'include':[{'model':db[_0xc49c('0x76')],'as':_0xc49c('0x77'),'include':[{'model':db[_0xc49c('0x6d')],'as':_0xc49c('0x78'),'where':_0x9010fe,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xc49c('0x20')](handleEntityNotFound(_0x5f5dfc,null))['then'](function(_0x3aba3d){if(_0x3aba3d&&_0x3aba3d[_0xc49c('0x77')]){_0x1512d6[_0xc49c('0x79')]=_0x3aba3d;_0x1512d6[_0xc49c('0x7a')]=_0x3aba3d[_0xc49c('0x7b')];_0x1512d6[_0xc49c('0x7c')]=_0x3aba3d['List'];_0x1512d6[_0xc49c('0x7a')]=_[_0xc49c('0x7d')](_0x1512d6[_0xc49c('0x7a')],[_0xc49c('0x7e')],['asc']);if(_0x1512d6[_0xc49c('0x79')][_0xc49c('0x7b')]){delete _0x1512d6[_0xc49c('0x79')]['Applications'];}if(_0x1512d6[_0xc49c('0x79')]['List']&&_0x1512d6[_0xc49c('0x79')][_0xc49c('0x77')][_0xc49c('0x78')]['length']){return _0x1512d6[_0xc49c('0x79')]['List'][_0xc49c('0x78')][0x0];}var _0x144621=_[_0xc49c('0x14')](_0x2efbe6[_0xc49c('0x58')],{'firstName':_0x2efbe6['body'][_0xc49c('0x72')],'ListId':_0x3aba3d['ListId']});_0x144621[_0x2efbe6[_0xc49c('0x58')][_0xc49c('0x74')]]=_0x2efbe6[_0xc49c('0x58')][_0xc49c('0x72')];return db[_0xc49c('0x6d')][_0xc49c('0x57')](_0x144621,{'fields':_0x578f29,'raw':!![]});}})['then'](handleEntityNotFound(_0x5f5dfc,null))['then'](function(_0x2db4f6){_0x1512d6[_0xc49c('0x7f')]=_0x2db4f6;if(_0x2db4f6){var _0x4519c5={'ContactId':_0x2db4f6['id'],'OpenchannelAccountId':_0x2efbe6[_0xc49c('0x52')]['id'],'from':(_0x2db4f6[_0xc49c('0x80')]||'')+'\x20'+(_0x2db4f6['lastName']||'')};var _0x35f9d2={'OpenchannelAccountId':_0x2efbe6[_0xc49c('0x52')]['id'],'closed':![]};if(_0x2efbe6['body'][_0xc49c('0x81')]){_0x35f9d2[_0xc49c('0x81')]=_0x2efbe6['body'][_0xc49c('0x81')];return db[_0xc49c('0x82')][_0xc49c('0x56')]({'where':_0x35f9d2})[_0xc49c('0x20')](function(_0x1cf1c2){if(_0x1cf1c2){return[_0x1cf1c2,![]];}_0x4519c5[_0xc49c('0x81')]=_0x2efbe6[_0xc49c('0x58')]['threadId'];_0x4519c5[_0xc49c('0x83')]=_0x2efbe6[_0xc49c('0x58')]['externalUrl'];return db[_0xc49c('0x82')][_0xc49c('0x57')](_0x4519c5)['then'](function(_0x42fddb){return[_0x42fddb,!![]];});});}else{_0x35f9d2[_0xc49c('0x81')]=null;}_0x35f9d2['ContactId']=_0x2db4f6['id'];return db[_0xc49c('0x82')][_0xc49c('0x56')]({'where':_0x35f9d2})['then'](function(_0x2a4b96){if(_0x2a4b96){return[_0x2a4b96,![]];}return db[_0xc49c('0x82')][_0xc49c('0x57')](_0x4519c5)[_0xc49c('0x20')](function(_0x5ceb28){return[_0x5ceb28,!![]];});});}})[_0xc49c('0x84')](function(_0xe32a5d,_0x79ab9d){if(_0xe32a5d){_0x4b5b48=_0x79ab9d;if(!_0x79ab9d){var _0x28ce4a={'from':(_0x1512d6[_0xc49c('0x7f')][_0xc49c('0x80')]||'')+'\x20'+(_0x1512d6[_0xc49c('0x7f')][_0xc49c('0x85')]||'')};if(_0x2efbe6[_0xc49c('0x58')][_0xc49c('0x81')]&&_0x2efbe6[_0xc49c('0x58')][_0xc49c('0x86')]&&_0x2efbe6[_0xc49c('0x58')]['threadId']!=_0x2efbe6['body']['messageId']){_0x28ce4a[_0xc49c('0x81')]=_0x2efbe6[_0xc49c('0x58')][_0xc49c('0x86')];}return _0xe32a5d['update'](_0x28ce4a);}else{return _0xe32a5d;}}})[_0xc49c('0x20')](function(_0x6de9d){_0x1512d6[_0xc49c('0x87')]=_0x6de9d[_0xc49c('0x5a')]({'plain':!![]});_0x1512d6[_0xc49c('0x87')][_0xc49c('0x88')]=_0x4b5b48;if(_0x1512d6['interaction'][_0xc49c('0x88')]){if(_0x1512d6[_0xc49c('0x79')][_0xc49c('0x89')]){_0x1512d6[_0xc49c('0x7a')][_0xc49c('0x8a')]({'id':0x0,'priority':_0x1512d6[_0xc49c('0x7a')][_0xc49c('0x53')]+0x1,'app':'close','appdata':_0xc49c('0x8b'),'interval':_0xc49c('0x8c')});}}return db[_0xc49c('0x8d')]['create']({'body':_0x2efbe6['body'][_0xc49c('0x58')],'OpenchannelAccountId':_0x2efbe6[_0xc49c('0x52')]['id'],'OpenchannelInteractionId':_0x6de9d['id'],'direction':'in','ContactId':_0x1512d6['contact']['id'],'AttachmentId':_0x2efbe6['body'][_0xc49c('0x8e')]});})[_0xc49c('0x20')](function(_0x4cb029){_0x1512d6[_0xc49c('0x28')]=_0x4cb029;if(_0x1512d6[_0xc49c('0x87')][_0xc49c('0x8f')]){return db[_0xc49c('0x90')][_0xc49c('0x56')]({'attributes':['id',_0xc49c('0x38')],'where':{'id':_0x1512d6['interaction'][_0xc49c('0x8f')]}})[_0xc49c('0x20')](function(_0x41aa47){if(_0x41aa47){_0x1512d6[_0xc49c('0x7a')][_0xc49c('0x91')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x41aa47[_0xc49c('0x38')]+','+(_0x1512d6[_0xc49c('0x79')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x1512d6[_0xc49c('0x92')]=![];}return respondWithRpcPromise('Start',_0xc49c('0x93'),_0x1512d6);});}return respondWithRpcPromise('Start',_0xc49c('0x93'),_0x1512d6);})[_0xc49c('0x20')](function(_0x877e00){respondWithRpcPromise(_0xc49c('0x94'),_0xc49c('0x94'),{'event':_0xc49c('0x6b'),'message':_0x877e00},client9002);return _0x877e00;})[_0xc49c('0x20')](respondWithResult(_0x5f5dfc,null))[_0xc49c('0x29')](handleError(_0x5f5dfc,null));};exports[_0xc49c('0x95')]=function(_0x1c2169,_0x1484e1,_0x4855ab){return db[_0xc49c('0x3b')]['findOne']({'where':{'id':_0x1c2169['params']['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x1484e1,null))[_0xc49c('0x20')](function(_0x332e3d){if(_0x332e3d){return db[_0xc49c('0x96')][_0xc49c('0x97')](function(_0x3c35d2){return db[_0xc49c('0x98')][_0xc49c('0x35')]({'where':{'OpenchannelAccountId':_0x1c2169[_0xc49c('0x52')]['id']},'transaction':_0x3c35d2})[_0xc49c('0x20')](function(_0x56ce5d){var _0x579aeb=_['map'](_0x1c2169[_0xc49c('0x58')],function(_0x13dfdc){_0x13dfdc[_0xc49c('0x64')]=_0x1c2169[_0xc49c('0x52')]['id'];return _0x13dfdc;});return db['OpenchannelApplication']['bulkCreate'](_0x579aeb,{'transaction':_0x3c35d2});});})['then'](function(){return db['OpenchannelApplication'][_0xc49c('0x99')]({'where':{'OpenchannelAccountId':_0x1c2169[_0xc49c('0x52')]['id']},'order':_0xc49c('0x7e')});});}})['then'](respondWithResult(_0x1484e1,null))[_0xc49c('0x29')](handleError(_0x1484e1,null));};exports[_0xc49c('0x9a')]=function(_0x35b879,_0x28b4f2,_0x1764b0){var _0x478ca3={};var _0xea81d6={};var _0x3f7c48;var _0x3d45fd;return db[_0xc49c('0x3b')][_0xc49c('0x69')]({'where':{'id':_0x35b879[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x28b4f2,null))[_0xc49c('0x20')](function(_0x6f4cb2){if(_0x6f4cb2){_0x3f7c48=_0x6f4cb2;_0xea81d6[_0xc49c('0x3d')]=_[_0xc49c('0x3e')](db[_0xc49c('0x98')][_0xc49c('0x3c')]);_0xea81d6[_0xc49c('0x3f')]=_[_0xc49c('0x3e')](_0x35b879[_0xc49c('0x3f')]);_0xea81d6['filters']=_[_0xc49c('0x41')](_0xea81d6[_0xc49c('0x3d')],_0xea81d6[_0xc49c('0x3f')]);_0x478ca3[_0xc49c('0x42')]=_[_0xc49c('0x41')](_0xea81d6[_0xc49c('0x3d')],qs[_0xc49c('0x43')](_0x35b879[_0xc49c('0x3f')][_0xc49c('0x43')]));_0x478ca3[_0xc49c('0x42')]=_0x478ca3['attributes']['length']?_0x478ca3[_0xc49c('0x42')]:_0xea81d6[_0xc49c('0x3d')];_0x478ca3[_0xc49c('0x45')]=qs[_0xc49c('0x46')](_0x35b879[_0xc49c('0x3f')][_0xc49c('0x46')]);_0x478ca3[_0xc49c('0x47')]=qs['filters'](_[_0xc49c('0x48')](_0x35b879[_0xc49c('0x3f')],_0xea81d6[_0xc49c('0x40')]));if(_0x35b879['query']['filter']){_0x478ca3[_0xc49c('0x47')]=_[_0xc49c('0x49')](_0x478ca3[_0xc49c('0x47')],{'$or':_[_0xc49c('0x4a')](_0x478ca3['attributes'],function(_0x23bef3){var _0x332eec={};_0x332eec[_0x23bef3]={'$like':'%'+_0x35b879['query']['filter']+'%'};return _0x332eec;})});}_0x478ca3=_[_0xc49c('0x49')]({},_0x478ca3,_0x35b879[_0xc49c('0x4d')]);return _0x3f7c48['getApplications'](_0x478ca3);}})[_0xc49c('0x20')](function(_0x5200f6){if(_0x5200f6){_0x3d45fd=_0x5200f6[_0xc49c('0x53')];if(!_0x35b879['query'][_0xc49c('0x44')]('nolimit')){_0x478ca3[_0xc49c('0x2f')]=qs[_0xc49c('0x2f')](_0x35b879[_0xc49c('0x3f')][_0xc49c('0x2f')]);_0x478ca3[_0xc49c('0x2e')]=qs[_0xc49c('0x2e')](_0x35b879[_0xc49c('0x3f')][_0xc49c('0x2e')]);}return _0x3f7c48[_0xc49c('0x9a')](_0x478ca3);}})[_0xc49c('0x20')](function(_0x23e852){if(_0x23e852){return _0x23e852?{'count':_0x3d45fd,'rows':_0x23e852}:null;}})[_0xc49c('0x20')](respondWithResult(_0x28b4f2,null))['catch'](handleError(_0x28b4f2,null));};exports[_0xc49c('0x9b')]=function(_0x28ec17,_0x5cc0c0,_0x40fd9e){var _0x418873={'raw':![],'where':{}};var _0x157253={};var _0x3f634c={'count':0x0,'rows':[]};return db[_0xc49c('0x3b')][_0xc49c('0x69')]({'where':{'id':_0x28ec17[_0xc49c('0x52')]['id']}})['then'](handleEntityNotFound(_0x5cc0c0,null))[_0xc49c('0x20')](function(_0x2cdb43){if(_0x2cdb43){_0x157253[_0xc49c('0x3d')]=_[_0xc49c('0x3e')](db[_0xc49c('0x82')]['rawAttributes']);_0x157253[_0xc49c('0x3f')]=_[_0xc49c('0x3e')](_0x28ec17[_0xc49c('0x3f')]);_0x157253[_0xc49c('0x40')]=_[_0xc49c('0x41')](_0x157253[_0xc49c('0x3d')],_0x157253[_0xc49c('0x3f')]);_0x418873['attributes']=_[_0xc49c('0x41')](_0x157253[_0xc49c('0x3d')],qs[_0xc49c('0x43')](_0x28ec17[_0xc49c('0x3f')]['fields']));_0x418873[_0xc49c('0x42')]=_0x418873[_0xc49c('0x42')]['length']?_0x418873[_0xc49c('0x42')]:_0x157253[_0xc49c('0x3d')];if(!_0x28ec17['query'][_0xc49c('0x44')](_0xc49c('0x63'))){_0x418873[_0xc49c('0x2f')]=qs['limit'](_0x28ec17[_0xc49c('0x3f')][_0xc49c('0x2f')]);_0x418873['offset']=qs['offset'](_0x28ec17[_0xc49c('0x3f')][_0xc49c('0x2e')]);}_0x418873[_0xc49c('0x45')]=qs[_0xc49c('0x46')](_0x28ec17['query'][_0xc49c('0x46')]);_0x418873[_0xc49c('0x47')]=qs[_0xc49c('0x40')](_[_0xc49c('0x48')](_0x28ec17[_0xc49c('0x3f')],_0x157253[_0xc49c('0x40')]));_0x418873[_0xc49c('0x47')][_0xc49c('0x64')]=_0x2cdb43['id'];if(_0x28ec17[_0xc49c('0x3f')]['filter']){_0x418873['where']=_[_0xc49c('0x49')](_0x418873[_0xc49c('0x47')],{'$or':_[_0xc49c('0x4a')](_0x418873[_0xc49c('0x42')],function(_0x2f7a3b){var _0x39b363={};_0x39b363[_0x2f7a3b]={'$like':'%'+_0x28ec17[_0xc49c('0x3f')]['filter']+'%'};return _0x39b363;})});}_0x418873=_[_0xc49c('0x49')]({},_0x418873,_0x28ec17[_0xc49c('0x4d')]);return db[_0xc49c('0x82')][_0xc49c('0x4e')]({'where':_0x418873[_0xc49c('0x47')]})[_0xc49c('0x20')](function(_0x1fe837){_0x3f634c[_0xc49c('0x4e')]=_0x1fe837;if(_0x28ec17[_0xc49c('0x3f')]['includeAll']){_0x418873[_0xc49c('0x55')]=[{'model':db[_0xc49c('0x6d')],'as':'Contact','required':![]},{'model':db[_0xc49c('0x90')],'as':_0xc49c('0x9c'),'attributes':[_0xc49c('0x38'),'fullname',_0xc49c('0x9d')],'required':![]},{'model':db[_0xc49c('0x9e')],'as':_0xc49c('0x9f'),'attributes':['id','name',_0xc49c('0xa0')],'where':_0x28ec17[_0xc49c('0x3f')][_0xc49c('0xa1')]?{'id':_0x28ec17['query'][_0xc49c('0xa1')]}:undefined,'required':_0x28ec17[_0xc49c('0x3f')]['tag']?!![]:![]}];}return db[_0xc49c('0x82')][_0xc49c('0x4f')](_0x418873);})['then'](function(_0x3b71ff){_0x3f634c['rows']=_0x3b71ff;return _0x3f634c;});}})[_0xc49c('0x20')](respondWithFilteredResult(_0x5cc0c0,_0x418873))[_0xc49c('0x29')](handleError(_0x5cc0c0,null));};exports[_0xc49c('0xa2')]=function(_0x5d51b3,_0x3ff3be,_0x1aeee7){return db['OpenchannelAccount'][_0xc49c('0x56')]({'where':{'id':_0x5d51b3['params']['id']}})['then'](handleEntityNotFound(_0x3ff3be,null))[_0xc49c('0x20')](function(_0x5c67ee){if(_0x5c67ee){return _0x5c67ee[_0xc49c('0xa2')](_0x5d51b3[_0xc49c('0x58')][_0xc49c('0xa3')],_[_0xc49c('0xa4')](_0x5d51b3[_0xc49c('0x58')],[_0xc49c('0xa3'),'id'])||{})[_0xc49c('0x84')](function(_0x5e384d){for(var _0x549f8a=0x0;_0x549f8a<_0x5d51b3[_0xc49c('0x58')][_0xc49c('0xa3')][_0xc49c('0x53')];_0x549f8a+=0x1){socket[_0xc49c('0xa5')](_0xc49c('0xa6'),{'UserId':_0x5d51b3[_0xc49c('0x58')][_0xc49c('0xa3')][_0x549f8a],'OpenchannelAccountId':_0x5d51b3[_0xc49c('0x52')]['id']});}return _0x5e384d;});}})[_0xc49c('0x20')](respondWithResult(_0x3ff3be,null))[_0xc49c('0x29')](handleError(_0x3ff3be,null));};exports['removeAgents']=function(_0x2c138a,_0x40306b,_0x540281){return db[_0xc49c('0x3b')][_0xc49c('0x56')]({'where':{'id':_0x2c138a['params']['id']}})['then'](handleEntityNotFound(_0x40306b,null))[_0xc49c('0x20')](function(_0x5a6e5b){if(_0x5a6e5b){return _0x5a6e5b['removeAgents'](_0x2c138a[_0xc49c('0x3f')][_0xc49c('0xa3')])[_0xc49c('0x20')](function(){if(_[_0xc49c('0xa7')](_0x2c138a[_0xc49c('0x3f')][_0xc49c('0xa3')])){for(var _0x240c7e=0x0;_0x240c7e<_0x2c138a['query'][_0xc49c('0xa3')][_0xc49c('0x53')];_0x240c7e+=0x1){socket[_0xc49c('0xa5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2c138a[_0xc49c('0x3f')][_0xc49c('0xa3')][_0x240c7e]),'OpenchannelAccountId':Number(_0x2c138a[_0xc49c('0x52')]['id'])});}}else{socket['emit'](_0xc49c('0xa8'),{'UserId':Number(_0x2c138a[_0xc49c('0x3f')]['ids']),'OpenchannelAccountId':Number(_0x2c138a[_0xc49c('0x52')]['id'])});}});}})[_0xc49c('0x20')](respondWithStatusCode(_0x40306b,null))[_0xc49c('0x29')](handleError(_0x40306b,null));};exports[_0xc49c('0xa9')]=function(_0x31b9c8,_0x500230,_0x11c105){var _0x5b5a4c={};var _0x1d56b4={};var _0x554dd3;var _0x229b5f;return db[_0xc49c('0x3b')][_0xc49c('0x69')]({'where':{'id':_0x31b9c8[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x500230,null))[_0xc49c('0x20')](function(_0x4a4557){if(_0x4a4557){_0x554dd3=_0x4a4557;_0x1d56b4[_0xc49c('0x3d')]=_[_0xc49c('0x3e')](db[_0xc49c('0x90')]['rawAttributes']);_0x1d56b4['query']=_[_0xc49c('0x3e')](_0x31b9c8['query']);_0x1d56b4[_0xc49c('0x40')]=_[_0xc49c('0x41')](_0x1d56b4[_0xc49c('0x3d')],_0x1d56b4[_0xc49c('0x3f')]);_0x5b5a4c['attributes']=_['intersection'](_0x1d56b4[_0xc49c('0x3d')],qs[_0xc49c('0x43')](_0x31b9c8[_0xc49c('0x3f')][_0xc49c('0x43')]));_0x5b5a4c[_0xc49c('0x42')]=_0x5b5a4c['attributes']['length']?_0x5b5a4c[_0xc49c('0x42')]:_0x1d56b4['model'];_0x5b5a4c['order']=qs[_0xc49c('0x46')](_0x31b9c8[_0xc49c('0x3f')][_0xc49c('0x46')]);_0x5b5a4c['where']=qs[_0xc49c('0x40')](_[_0xc49c('0x48')](_0x31b9c8[_0xc49c('0x3f')],_0x1d56b4[_0xc49c('0x40')]));if(_0x31b9c8[_0xc49c('0x3f')][_0xc49c('0x65')]){_0x5b5a4c['where']=_[_0xc49c('0x49')](_0x5b5a4c['where'],{'$or':_[_0xc49c('0x4a')](_0x5b5a4c[_0xc49c('0x42')],function(_0x1f7059){var _0x143db4={};_0x143db4[_0x1f7059]={'$like':'%'+_0x31b9c8[_0xc49c('0x3f')][_0xc49c('0x65')]+'%'};return _0x143db4;})});}_0x5b5a4c=_[_0xc49c('0x49')]({},_0x5b5a4c,_0x31b9c8['options']);return _0x554dd3[_0xc49c('0xa9')](_0x5b5a4c);}})[_0xc49c('0x20')](function(_0x2c847d){if(_0x2c847d){_0x229b5f=_0x2c847d[_0xc49c('0x53')];if(!_0x31b9c8['query'][_0xc49c('0x44')](_0xc49c('0x63'))){_0x5b5a4c[_0xc49c('0x2f')]=qs['limit'](_0x31b9c8['query'][_0xc49c('0x2f')]);_0x5b5a4c[_0xc49c('0x2e')]=qs['offset'](_0x31b9c8[_0xc49c('0x3f')][_0xc49c('0x2e')]);}return _0x554dd3[_0xc49c('0xa9')](_0x5b5a4c);}})[_0xc49c('0x20')](function(_0x56204e){if(_0x56204e){return _0x56204e?{'count':_0x229b5f,'rows':_0x56204e}:null;}})['then'](respondWithResult(_0x500230,null))[_0xc49c('0x29')](handleError(_0x500230,null));};exports[_0xc49c('0xaa')]=function(_0x11be85,_0x453535,_0x4cc0c8){var _0xad95df,_0x34085a,_0x31045a;if(_['isNil'](_0x11be85['body'][_0xc49c('0x58')])||_0x11be85[_0xc49c('0x58')][_0xc49c('0x58')]===''){throw new db[(_0xc49c('0x1d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc49c('0xab')](_0x11be85['body']['to'])){}_0xad95df=_0x11be85['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x11be85[_0xc49c('0x52')]['id']}})[_0xc49c('0x20')](handleEntityNotFound(_0x453535,null))[_0xc49c('0x20')](function(_0x5d9f10){if(_0x5d9f10){return db[_0xc49c('0x3b')][_0xc49c('0x56')]({'where':{'id':_0x5d9f10['id']},'include':[{'model':db[_0xc49c('0x76')],'as':_0xc49c('0x77'),'include':[{'model':db['CmContact'],'as':_0xc49c('0x78'),'where':{[_0x5d9f10[_0xc49c('0x74')]]:_0xad95df},'limit':0x1,'order':[[_0xc49c('0x6f'),_0xc49c('0xac')]]}]}]})[_0xc49c('0x20')](handleEntityNotFound(_0x453535,null))[_0xc49c('0x20')](function(_0x17635a){if(_0x17635a&&_0x17635a[_0xc49c('0x77')]){_0x34085a=_0x17635a[_0xc49c('0x5a')]({'plain':!![]});if(_0x34085a['List']&&_0x34085a[_0xc49c('0x77')][_0xc49c('0x78')]['length']){return _0x34085a[_0xc49c('0x77')][_0xc49c('0x78')][0x0];}return db[_0xc49c('0x6d')][_0xc49c('0x57')](_[_0xc49c('0x14')](_0x11be85['body'],{'firstName':_0xad95df,[_0x17635a['mapKey']]:_0xad95df,'phone':_0xad95df,'ListId':_0x34085a[_0xc49c('0xad')]}));}})['then'](handleEntityNotFound(_0x453535,null))[_0xc49c('0x20')](function(_0x280324){if(_0x280324){_0x31045a=_0x280324;return db[_0xc49c('0x82')][_0xc49c('0x56')]({'where':{'ContactId':_0x31045a['id'],'closed':![],'OpenchannelAccountId':_0x34085a['id']}})[_0xc49c('0x20')](function(_0x4b66de){if(_0x4b66de){return[_0x4b66de,![]];}return db[_0xc49c('0x82')][_0xc49c('0x57')]({'UserId':_0x11be85[_0xc49c('0x59')]['id'],'ContactId':_0x31045a['id'],'OpenchannelAccountId':_0x34085a['id'],'lastMsgDirection':_0xc49c('0xae'),'Messages':[_[_0xc49c('0x49')](_0x11be85[_0xc49c('0x58')],{'read':![],'body':_0x11be85[_0xc49c('0x58')][_0xc49c('0x58')],'OpenchannelAccountId':_0x34085a['id'],'UserId':_0x11be85['user']['id'],'ContactId':_0x31045a['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xc49c('0xaf')}]})['then'](function(_0x394301){return[_0x394301,!![]];});});}})[_0xc49c('0x84')](function(_0x53fd83,_0x1fa1fa){if(_0x1fa1fa){return _0x53fd83;}return db[_0xc49c('0x8d')]['create'](_['merge'](_0x11be85[_0xc49c('0x58')],{'read':![],'body':_0x11be85[_0xc49c('0x58')][_0xc49c('0x58')],'OpenchannelAccountId':_0x34085a['id'],'OpenchannelInteractionId':_0x53fd83['id'],'UserId':_0x11be85[_0xc49c('0x59')]['id'],'ContactId':_0x31045a['id']}))[_0xc49c('0x20')](function(_0xbb6992){_0x53fd83[_0xc49c('0xb0')][_0xc49c('0xaf')]=[];_0x53fd83[_0xc49c('0xb0')][_0xc49c('0xaf')][_0xc49c('0x8a')](_0xbb6992[_0xc49c('0xb0')]);return _0x53fd83;});});}})['then'](respondWithResult(_0x453535,null))[_0xc49c('0x29')](handleError(_0x453535,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index aa30c27..206b8b4 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 _0xe641=['update','remove','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xe641,0x125));var _0x1e64=function(_0x4d7285,_0x49c65f){_0x4d7285=_0x4d7285-0x0;var _0x2dac6c=_0xe641[_0x4d7285];return _0x2dac6c;};'use strict';var EventEmitter=require(_0x1e64('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x1e64('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1e64('0x2')](0x0);var events={'afterCreate':_0x1e64('0x3'),'afterUpdate':_0x1e64('0x4'),'afterDestroy':_0x1e64('0x5')};function emitEvent(_0x577bea){return function(_0x2eef33,_0x26a548,_0x1e1a94){OpenchannelAccountEvents['emit'](_0x577bea+':'+_0x2eef33['id'],_0x2eef33);OpenchannelAccountEvents['emit'](_0x577bea,_0x2eef33);_0x1e1a94(null);};}for(var e in events){if(events[_0x1e64('0x6')](e)){var event=events[e];OpenchannelAccount[_0x1e64('0x7')](e,emitEvent(event));}}module[_0x1e64('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x37f3=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit'];(function(_0x5480fd,_0x46600d){var _0x2ec312=function(_0x32797c){while(--_0x32797c){_0x5480fd['push'](_0x5480fd['shift']());}};_0x2ec312(++_0x46600d);}(_0x37f3,0x173));var _0x337f=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x37f3[_0x4bf96c];return _0x281d09;};'use strict';var EventEmitter=require(_0x337f('0x0'));var OpenchannelAccount=require(_0x337f('0x1'))['db'][_0x337f('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x337f('0x3')](0x0);var events={'afterCreate':_0x337f('0x4'),'afterUpdate':_0x337f('0x5'),'afterDestroy':'remove'};function emitEvent(_0xec1840){return function(_0xf4991f,_0xe7cba8,_0x29d64d){OpenchannelAccountEvents['emit'](_0xec1840+':'+_0xf4991f['id'],_0xf4991f);OpenchannelAccountEvents[_0x337f('0x6')](_0xec1840,_0xf4991f);_0x29d64d(null);};}for(var e in events){if(events[_0x337f('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x337f('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 506fbfb..edc4288 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 _0xeb5e=['exports','OpenchannelAccount','openchannel_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes'];(function(_0x53a11c,_0x393441){var _0x2680d5=function(_0xd3d1e2){while(--_0xd3d1e2){_0x53a11c['push'](_0x53a11c['shift']());}};_0x2680d5(++_0x393441);}(_0xeb5e,0x17c));var _0xeeb5=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xeb5e[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0xeeb5('0x0'));var util=require('util');var logger=require(_0xeeb5('0x1'))(_0xeeb5('0x2'));var moment=require(_0xeeb5('0x3'));var BPromise=require(_0xeeb5('0x4'));var rp=require(_0xeeb5('0x5'));var fs=require('fs');var path=require(_0xeeb5('0x6'));var rimraf=require(_0xeeb5('0x7'));var config=require(_0xeeb5('0x8'));var attributes=require(_0xeeb5('0x9'));module[_0xeeb5('0xa')]=function(_0x571898,_0x3b7a2c){return _0x571898['define'](_0xeeb5('0xb'),attributes,{'tableName':_0xeeb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x712e=['moment','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','api'];(function(_0x6694e5,_0x447705){var _0x45c2ab=function(_0x3d743f){while(--_0x3d743f){_0x6694e5['push'](_0x6694e5['shift']());}};_0x45c2ab(++_0x447705);}(_0x712e,0x169));var _0xe712=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x712e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe712('0x0'));var util=require(_0xe712('0x1'));var logger=require('../../config/logger')(_0xe712('0x2'));var moment=require(_0xe712('0x3'));var BPromise=require('bluebird');var rp=require(_0xe712('0x4'));var fs=require('fs');var path=require(_0xe712('0x5'));var rimraf=require(_0xe712('0x6'));var config=require(_0xe712('0x7'));var attributes=require(_0xe712('0x8'));module[_0xe712('0x9')]=function(_0x4a739b,_0x1d9510){return _0x4a739b[_0xe712('0xa')](_0xe712('0xb'),attributes,{'tableName':_0xe712('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index ffdb1bf..008602d 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 _0xca13=['error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xca13,0x148));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3ca1('0x0'));var util=require('util');var moment=require(_0x3ca1('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ca1('0x2'));var fs=require('fs');var Redis=require(_0x3ca1('0x3'));var db=require(_0x3ca1('0x4'))['db'];var utils=require(_0x3ca1('0x5'));var logger=require(_0x3ca1('0x6'))(_0x3ca1('0x7'));var config=require(_0x3ca1('0x8'));var jayson=require(_0x3ca1('0x9'));var client=jayson[_0x3ca1('0xa')][_0x3ca1('0xb')]({'port':0x232a});config[_0x3ca1('0xc')]=_['defaults'](config[_0x3ca1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ca1('0xd'))(new Redis(config[_0x3ca1('0xc')]));require('./openchannelAccount.socket')[_0x3ca1('0xe')](socket);function respondWithRpcPromise(_0x577109,_0x256f3f,_0x210b29){return new BPromise(function(_0x18fcea,_0x2aa56b){return client[_0x3ca1('0xf')](_0x577109,_0x210b29)[_0x3ca1('0x10')](function(_0x158a7a){logger[_0x3ca1('0x11')](_0x3ca1('0x12'),_0x256f3f,'request\x20sent');logger[_0x3ca1('0x13')](_0x3ca1('0x14'),_0x256f3f,_0x3ca1('0x15'),JSON[_0x3ca1('0x16')](_0x158a7a));if(_0x158a7a['error']){if(_0x158a7a[_0x3ca1('0x17')][_0x3ca1('0x18')]===0x1f4){logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x256f3f,_0x158a7a[_0x3ca1('0x17')][_0x3ca1('0x19')]);return _0x2aa56b(_0x158a7a[_0x3ca1('0x17')]['message']);}logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x256f3f,_0x158a7a[_0x3ca1('0x17')][_0x3ca1('0x19')]);return _0x18fcea(_0x158a7a[_0x3ca1('0x17')][_0x3ca1('0x19')]);}else{logger[_0x3ca1('0x11')](_0x3ca1('0x12'),_0x256f3f,_0x3ca1('0x15'));_0x18fcea(_0x158a7a[_0x3ca1('0x1a')][_0x3ca1('0x19')]);}})['catch'](function(_0x60c9d8){logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x256f3f,_0x60c9d8);_0x2aa56b(_0x60c9d8);});});} \ No newline at end of file +var _0x83ce=['stringify','error','code','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x83ce,0x17d));var _0xe83c=function(_0xa60ba0,_0x592015){_0xa60ba0=_0xa60ba0-0x0;var _0x35523c=_0x83ce[_0xa60ba0];return _0x35523c;};'use strict';var _=require('lodash');var util=require(_0xe83c('0x0'));var moment=require('moment');var BPromise=require(_0xe83c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe83c('0x2'))['db'];var utils=require(_0xe83c('0x3'));var logger=require(_0xe83c('0x4'))(_0xe83c('0x5'));var config=require(_0xe83c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe83c('0x7')]['http']({'port':0x232a});config['redis']=_[_0xe83c('0x8')](config['redis'],{'host':_0xe83c('0x9'),'port':0x18eb});var socket=require(_0xe83c('0xa'))(new Redis(config[_0xe83c('0xb')]));require(_0xe83c('0xc'))[_0xe83c('0xd')](socket);function respondWithRpcPromise(_0x24d450,_0x426815,_0x242f3d){return new BPromise(function(_0xc3e5ab,_0x3339f3){return client[_0xe83c('0xe')](_0x24d450,_0x242f3d)[_0xe83c('0xf')](function(_0xf51f7b){logger['info'](_0xe83c('0x10'),_0x426815,_0xe83c('0x11'));logger['debug'](_0xe83c('0x12'),_0x426815,_0xe83c('0x11'),JSON[_0xe83c('0x13')](_0xf51f7b));if(_0xf51f7b[_0xe83c('0x14')]){if(_0xf51f7b['error'][_0xe83c('0x15')]===0x1f4){logger[_0xe83c('0x14')](_0xe83c('0x10'),_0x426815,_0xf51f7b[_0xe83c('0x14')][_0xe83c('0x16')]);return _0x3339f3(_0xf51f7b['error'][_0xe83c('0x16')]);}logger[_0xe83c('0x14')](_0xe83c('0x10'),_0x426815,_0xf51f7b[_0xe83c('0x14')][_0xe83c('0x16')]);return _0xc3e5ab(_0xf51f7b['error'][_0xe83c('0x16')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x426815,_0xe83c('0x11'));_0xc3e5ab(_0xf51f7b[_0xe83c('0x17')]['message']);}})[_0xe83c('0x18')](function(_0x44fed8){logger[_0xe83c('0x14')](_0xe83c('0x10'),_0x426815,_0x44fed8);_0x3339f3(_0x44fed8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 6792c35..888c9c9 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 _0xd511=['remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x47b9fb,_0x18441f){var _0x2f61a1=function(_0x52c3c3){while(--_0x52c3c3){_0x47b9fb['push'](_0x47b9fb['shift']());}};_0x2f61a1(++_0x18441f);}(_0xd511,0xa8));var _0x1d51=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd511[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x1d51('0x0'),_0x1d51('0x1')];function createListener(_0x305a6a,_0x3a948a){return function(_0x54c504){_0x3a948a[_0x1d51('0x2')](_0x305a6a,_0x54c504);};}function removeListener(_0x141731,_0x4485ba){return function(){OpenchannelAccountEvents[_0x1d51('0x3')](_0x141731,_0x4485ba);};}exports[_0x1d51('0x4')]=function(_0x44bd10){for(var _0x2a6b9a=0x0,_0x16ebb2=events[_0x1d51('0x5')];_0x2a6b9a<_0x16ebb2;_0x2a6b9a++){var _0x735856=events[_0x2a6b9a];var _0x32accc=createListener(_0x1d51('0x6')+_0x735856,_0x44bd10);OpenchannelAccountEvents['on'](_0x735856,_0x32accc);}}; \ No newline at end of file +var _0x3157=['emit','register','openchannelAccount:','./openchannelAccount.events','remove','update'];(function(_0x21510d,_0x3246c0){var _0x5b07a3=function(_0x21e31a){while(--_0x21e31a){_0x21510d['push'](_0x21510d['shift']());}};_0x5b07a3(++_0x3246c0);}(_0x3157,0xff));var _0x7315=function(_0xa1453e,_0x26ac48){_0xa1453e=_0xa1453e-0x0;var _0x9304ac=_0x3157[_0xa1453e];return _0x9304ac;};'use strict';var OpenchannelAccountEvents=require(_0x7315('0x0'));var events=['save',_0x7315('0x1'),_0x7315('0x2')];function createListener(_0x2c8a97,_0x1dbe81){return function(_0x517d13){_0x1dbe81[_0x7315('0x3')](_0x2c8a97,_0x517d13);};}function removeListener(_0x5cccf7,_0x451544){return function(){OpenchannelAccountEvents['removeListener'](_0x5cccf7,_0x451544);};}exports[_0x7315('0x4')]=function(_0x3093ce){for(var _0x271994=0x0,_0xe7c67d=events['length'];_0x271994<_0xe7c67d;_0x271994++){var _0x5a9e5c=events[_0x271994];var _0x4cc89e=createListener(_0x7315('0x5')+_0x5a9e5c,_0x3093ce);OpenchannelAccountEvents['on'](_0x5a9e5c,_0x4cc89e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2456ef5..9fcec7b 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 _0x81c6=['multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','show','post','create','/:id','delete','exports'];(function(_0x7e6f22,_0x47271a){var _0x4d7dec=function(_0x2a0e46){while(--_0x2a0e46){_0x7e6f22['push'](_0x7e6f22['shift']());}};_0x4d7dec(++_0x47271a);}(_0x81c6,0x150));var _0x681c=function(_0x13062b,_0x285d7d){_0x13062b=_0x13062b-0x0;var _0x564586=_0x81c6[_0x13062b];return _0x564586;};'use strict';var multer=require(_0x681c('0x0'));var util=require('util');var path=require(_0x681c('0x1'));var timeout=require('connect-timeout');var express=require(_0x681c('0x2'));var router=express['Router']();var auth=require(_0x681c('0x3'));var interaction=require(_0x681c('0x4'));var config=require(_0x681c('0x5'));var controller=require(_0x681c('0x6'));router[_0x681c('0x7')]('/',auth['isAuthenticated'](),controller[_0x681c('0x8')]);router[_0x681c('0x7')]('/:id',auth[_0x681c('0x9')](),controller[_0x681c('0xa')]);router[_0x681c('0xb')]('/',auth['isAuthenticated'](),controller[_0x681c('0xc')]);router['put'](_0x681c('0xd'),auth[_0x681c('0x9')](),controller['update']);router[_0x681c('0xe')](_0x681c('0xd'),auth[_0x681c('0x9')](),controller['destroy']);module[_0x681c('0xf')]=router; \ No newline at end of file +var _0x35d9=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','util'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x35d9,0x164));var _0x935d=function(_0x2f9ae8,_0x4b8e27){_0x2f9ae8=_0x2f9ae8-0x0;var _0x25cf4a=_0x35d9[_0x2f9ae8];return _0x25cf4a;};'use strict';var multer=require('multer');var util=require(_0x935d('0x0'));var path=require(_0x935d('0x1'));var timeout=require(_0x935d('0x2'));var express=require('express');var router=express[_0x935d('0x3')]();var auth=require(_0x935d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x935d('0x5'));var controller=require(_0x935d('0x6'));router[_0x935d('0x7')]('/',auth[_0x935d('0x8')](),controller[_0x935d('0x9')]);router[_0x935d('0x7')](_0x935d('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x935d('0xb')]('/',auth[_0x935d('0x8')](),controller[_0x935d('0xc')]);router['put'](_0x935d('0xa'),auth[_0x935d('0x8')](),controller[_0x935d('0xd')]);router[_0x935d('0xe')](_0x935d('0xa'),auth[_0x935d('0x8')](),controller[_0x935d('0xf')]);module[_0x935d('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 87842eb..b3f967b 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 _0xe8c5=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xe8c5,0x112));var _0x5e8c=function(_0x3a467a,_0x5edbfb){_0x3a467a=_0x3a467a-0x0;var _0x55874d=_0xe8c5[_0x3a467a];return _0x55874d;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x5e8c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x5e8c('0x1')],'allowNull':![],'defaultValue':_0x5e8c('0x2')},'appdata':{'type':Sequelize[_0x5e8c('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5e8c('0x1')],'defaultValue':_0x5e8c('0x4')}}; \ No newline at end of file +var _0xa8ea=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x40b66c,_0x578758){var _0x2fd22b=function(_0x3b721b){while(--_0x3b721b){_0x40b66c['push'](_0x40b66c['shift']());}};_0x2fd22b(++_0x578758);}(_0xa8ea,0xfb));var _0xaa8e=function(_0x14b0e3,_0xfc2e74){_0x14b0e3=_0x14b0e3-0x0;var _0x105940=_0xa8ea[_0x14b0e3];return _0x105940;};'use strict';var Sequelize=require(_0xaa8e('0x0'));module[_0xaa8e('0x1')]={'priority':{'type':Sequelize[_0xaa8e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xaa8e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xaa8e('0x4')]()},'description':{'type':Sequelize[_0xaa8e('0x3')]},'interval':{'type':Sequelize[_0xaa8e('0x3')],'defaultValue':_0xaa8e('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 57d259c..d429d03 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 _0xdfc4=['util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','sort','pick','filter','where','merge','map','type','VIRTUAL','field','options','OpenchannelApplication','include','catch','show','params','fields','includeAll','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x8aa601,_0x4685a2){var _0x209a98=function(_0x494898){while(--_0x494898){_0x8aa601['push'](_0x8aa601['shift']());}};_0x209a98(++_0x4685a2);}(_0xdfc4,0x128));var _0x4dfc=function(_0x272227,_0x5d56ff){_0x272227=_0x272227-0x0;var _0x4d0090=_0xdfc4[_0x272227];return _0x4d0090;};'use strict';var pdf=require(_0x4dfc('0x0'));var emlformat=require(_0x4dfc('0x1'));var rimraf=require(_0x4dfc('0x2'));var zipdir=require(_0x4dfc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4dfc('0x4'));var moment=require(_0x4dfc('0x5'));var BPromise=require(_0x4dfc('0x6'));var Mustache=require(_0x4dfc('0x7'));var util=require(_0x4dfc('0x8'));var path=require(_0x4dfc('0x9'));var sox=require(_0x4dfc('0xa'));var csv=require('to-csv');var ejs=require(_0x4dfc('0xb'));var fs=require('fs');var _=require(_0x4dfc('0xc'));var squel=require(_0x4dfc('0xd'));var crypto=require('crypto');var jsforce=require(_0x4dfc('0xe'));var deskjs=require(_0x4dfc('0xf'));var toCsv=require(_0x4dfc('0x10'));var querystring=require(_0x4dfc('0x11'));var Papa=require(_0x4dfc('0x12'));var Redis=require(_0x4dfc('0x13'));var authService=require(_0x4dfc('0x14'));var qs=require(_0x4dfc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4dfc('0x16'))(_0x4dfc('0x17'));var utils=require(_0x4dfc('0x18'));var config=require(_0x4dfc('0x19'));var db=require(_0x4dfc('0x1a'))['db'];function respondWithStatusCode(_0xf00d4d,_0x518fd4){_0x518fd4=_0x518fd4||0xcc;return function(_0x5fb096){if(_0x5fb096){return _0xf00d4d[_0x4dfc('0x1b')](_0x518fd4);}return _0xf00d4d[_0x4dfc('0x1c')](_0x518fd4)[_0x4dfc('0x1d')]();};}function respondWithResult(_0x151905,_0xde8c9c){_0xde8c9c=_0xde8c9c||0xc8;return function(_0x28a7aa){if(_0x28a7aa){return _0x151905[_0x4dfc('0x1c')](_0xde8c9c)[_0x4dfc('0x1e')](_0x28a7aa);}};}function respondWithFilteredResult(_0x34917d,_0x544918){return function(_0x28b57e){if(_0x28b57e){var _0x396381=_0x28b57e[_0x4dfc('0x1f')],_0x1eec38=_0x544918[_0x4dfc('0x20')],_0x5725ec=_0x544918[_0x4dfc('0x20')]+_0x544918[_0x4dfc('0x21')],_0x38830d;if(_0x5725ec>=_0x396381){_0x5725ec=_0x396381;_0x38830d=0xc8;}else{_0x38830d=0xce;}_0x34917d[_0x4dfc('0x1c')](_0x38830d);return _0x34917d[_0x4dfc('0x22')](_0x4dfc('0x23'),_0x1eec38+'-'+_0x5725ec+'/'+_0x396381)[_0x4dfc('0x1e')](_0x28b57e);}return null;};}function patchUpdates(_0x4cd027){return function(_0xeeb361){try{jsonpatch[_0x4dfc('0x24')](_0xeeb361,_0x4cd027,!![]);}catch(_0x5e3bcf){return BPromise[_0x4dfc('0x25')](_0x5e3bcf);}return _0xeeb361[_0x4dfc('0x26')]();};}function saveUpdates(_0x556848,_0x26702c){return function(_0x172556){if(_0x172556){return _0x172556['update'](_0x556848)['then'](function(_0x383127){return _0x383127;});}return null;};}function removeEntity(_0x52a079,_0x367486){return function(_0x2e2a49){if(_0x2e2a49){return _0x2e2a49[_0x4dfc('0x27')]()[_0x4dfc('0x28')](function(){_0x52a079[_0x4dfc('0x1c')](0xcc)[_0x4dfc('0x1d')]();});}};}function handleEntityNotFound(_0xa4fd9a,_0x112f82){return function(_0xe8d6a4){if(!_0xe8d6a4){_0xa4fd9a[_0x4dfc('0x1b')](0x194);}return _0xe8d6a4;};}function handleError(_0x20b447,_0x5e24e3){_0x5e24e3=_0x5e24e3||0x1f4;return function(_0x233b62){logger[_0x4dfc('0x29')](_0x233b62[_0x4dfc('0x2a')]);if(_0x233b62[_0x4dfc('0x2b')]){delete _0x233b62[_0x4dfc('0x2b')];}_0x20b447[_0x4dfc('0x1c')](_0x5e24e3)[_0x4dfc('0x2c')](_0x233b62);};}exports[_0x4dfc('0x2d')]=function(_0x24b422,_0x498219){var _0x1261e9={},_0x2800d0={},_0x531007={'count':0x0,'rows':[]};var _0x3ea011=db['OpenchannelApplication'][_0x4dfc('0x2e')];_0x2800d0[_0x4dfc('0x2f')]=_[_0x4dfc('0x30')](_0x3ea011);_0x2800d0['query']=_[_0x4dfc('0x30')](_0x24b422[_0x4dfc('0x31')]);_0x2800d0[_0x4dfc('0x32')]=_['intersection'](_0x2800d0[_0x4dfc('0x2f')],_0x2800d0[_0x4dfc('0x31')]);_0x1261e9[_0x4dfc('0x33')]=_[_0x4dfc('0x34')](_0x2800d0[_0x4dfc('0x2f')],qs['fields'](_0x24b422[_0x4dfc('0x31')]['fields']));_0x1261e9[_0x4dfc('0x33')]=_0x1261e9[_0x4dfc('0x33')][_0x4dfc('0x35')]?_0x1261e9['attributes']:_0x2800d0['model'];if(!_0x24b422[_0x4dfc('0x31')][_0x4dfc('0x36')]('nolimit')){_0x1261e9['limit']=qs[_0x4dfc('0x21')](_0x24b422[_0x4dfc('0x31')][_0x4dfc('0x21')]);_0x1261e9['offset']=qs[_0x4dfc('0x20')](_0x24b422['query'][_0x4dfc('0x20')]);}_0x1261e9['order']=qs[_0x4dfc('0x37')](_0x24b422['query'][_0x4dfc('0x37')]);_0x1261e9['where']=qs[_0x4dfc('0x32')](_[_0x4dfc('0x38')](_0x24b422[_0x4dfc('0x31')],_0x2800d0['filters']));if(_0x24b422[_0x4dfc('0x31')][_0x4dfc('0x39')]){_0x1261e9[_0x4dfc('0x3a')]=_[_0x4dfc('0x3b')](_0x1261e9[_0x4dfc('0x3a')],{'$or':_[_0x4dfc('0x3c')](_0x3ea011,function(_0x3765dc){if(_0x3765dc[_0x4dfc('0x3d')]['key']!==_0x4dfc('0x3e')){var _0x5439ad={};_0x5439ad[_0x3765dc[_0x4dfc('0x3f')]]={'$like':'%'+_0x24b422[_0x4dfc('0x31')][_0x4dfc('0x39')]+'%'};return _0x5439ad;}})});}_0x1261e9=_[_0x4dfc('0x3b')]({},_0x1261e9,_0x24b422[_0x4dfc('0x40')]);var _0x10999a={'where':_0x1261e9[_0x4dfc('0x3a')]};return db[_0x4dfc('0x41')][_0x4dfc('0x1f')](_0x10999a)['then'](function(_0x5a095e){_0x531007[_0x4dfc('0x1f')]=_0x5a095e;if(_0x24b422['query']['includeAll']){_0x1261e9[_0x4dfc('0x42')]=[{'all':!![]}];}return db[_0x4dfc('0x41')]['findAll'](_0x1261e9);})[_0x4dfc('0x28')](function(_0x224d02){_0x531007['rows']=_0x224d02;return _0x531007;})['then'](respondWithFilteredResult(_0x498219,_0x1261e9))[_0x4dfc('0x43')](handleError(_0x498219,null));};exports[_0x4dfc('0x44')]=function(_0x9f7c0a,_0xc1ab77){var _0x4e79a9={'raw':!![],'where':{'id':_0x9f7c0a[_0x4dfc('0x45')]['id']}},_0x5b2cd3={};_0x5b2cd3[_0x4dfc('0x2f')]=_[_0x4dfc('0x30')](db[_0x4dfc('0x41')][_0x4dfc('0x2e')]);_0x5b2cd3[_0x4dfc('0x31')]=_['keys'](_0x9f7c0a[_0x4dfc('0x31')]);_0x5b2cd3['filters']=_['intersection'](_0x5b2cd3[_0x4dfc('0x2f')],_0x5b2cd3[_0x4dfc('0x31')]);_0x4e79a9['attributes']=_[_0x4dfc('0x34')](_0x5b2cd3[_0x4dfc('0x2f')],qs[_0x4dfc('0x46')](_0x9f7c0a[_0x4dfc('0x31')][_0x4dfc('0x46')]));_0x4e79a9[_0x4dfc('0x33')]=_0x4e79a9['attributes']['length']?_0x4e79a9[_0x4dfc('0x33')]:_0x5b2cd3[_0x4dfc('0x2f')];if(_0x9f7c0a[_0x4dfc('0x31')][_0x4dfc('0x47')]){_0x4e79a9[_0x4dfc('0x42')]=[{'all':!![]}];}_0x4e79a9=_['merge']({},_0x4e79a9,_0x9f7c0a['options']);return db[_0x4dfc('0x41')][_0x4dfc('0x48')](_0x4e79a9)[_0x4dfc('0x28')](handleEntityNotFound(_0xc1ab77,null))[_0x4dfc('0x28')](respondWithResult(_0xc1ab77,null))['catch'](handleError(_0xc1ab77,null));};exports[_0x4dfc('0x49')]=function(_0x5092c0,_0x24aa97){return db['OpenchannelApplication'][_0x4dfc('0x49')](_0x5092c0[_0x4dfc('0x4a')],{})[_0x4dfc('0x28')](respondWithResult(_0x24aa97,0xc9))[_0x4dfc('0x43')](handleError(_0x24aa97,null));};exports[_0x4dfc('0x4b')]=function(_0x4d67ce,_0x33eebe){if(_0x4d67ce['body']['id']){delete _0x4d67ce['body']['id'];}return db[_0x4dfc('0x41')][_0x4dfc('0x48')]({'where':{'id':_0x4d67ce[_0x4dfc('0x45')]['id']}})['then'](handleEntityNotFound(_0x33eebe,null))['then'](saveUpdates(_0x4d67ce[_0x4dfc('0x4a')],null))['then'](respondWithResult(_0x33eebe,null))['catch'](handleError(_0x33eebe,null));};exports[_0x4dfc('0x27')]=function(_0x3d31e7,_0x395999){return db[_0x4dfc('0x41')]['find']({'where':{'id':_0x3d31e7[_0x4dfc('0x45')]['id']}})[_0x4dfc('0x28')](handleEntityNotFound(_0x395999,null))[_0x4dfc('0x28')](removeEntity(_0x395999,null))[_0x4dfc('0x43')](handleError(_0x395999,null));}; \ No newline at end of file +var _0xc177=['keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','rows','show','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','OpenchannelApplication','rawAttributes','model'];(function(_0xac87b3,_0x4e030a){var _0x2a54ee=function(_0x396e96){while(--_0x396e96){_0xac87b3['push'](_0xac87b3['shift']());}};_0x2a54ee(++_0x4e030a);}(_0xc177,0x151));var _0x7c17=function(_0x2a3c1d,_0x275cdf){_0x2a3c1d=_0x2a3c1d-0x0;var _0x351b21=_0xc177[_0x2a3c1d];return _0x351b21;};'use strict';var pdf=require(_0x7c17('0x0'));var emlformat=require(_0x7c17('0x1'));var rimraf=require(_0x7c17('0x2'));var zipdir=require(_0x7c17('0x3'));var jsonpatch=require(_0x7c17('0x4'));var rp=require(_0x7c17('0x5'));var moment=require(_0x7c17('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7c17('0x7'));var util=require(_0x7c17('0x8'));var path=require('path');var sox=require(_0x7c17('0x9'));var csv=require(_0x7c17('0xa'));var ejs=require(_0x7c17('0xb'));var fs=require('fs');var _=require(_0x7c17('0xc'));var squel=require(_0x7c17('0xd'));var crypto=require(_0x7c17('0xe'));var jsforce=require(_0x7c17('0xf'));var deskjs=require(_0x7c17('0x10'));var toCsv=require(_0x7c17('0xa'));var querystring=require('querystring');var Papa=require(_0x7c17('0x11'));var Redis=require(_0x7c17('0x12'));var authService=require(_0x7c17('0x13'));var qs=require(_0x7c17('0x14'));var hardwareService=require(_0x7c17('0x15'));var logger=require(_0x7c17('0x16'))(_0x7c17('0x17'));var utils=require(_0x7c17('0x18'));var config=require(_0x7c17('0x19'));var db=require(_0x7c17('0x1a'))['db'];function respondWithStatusCode(_0x1923ca,_0x385fcc){_0x385fcc=_0x385fcc||0xcc;return function(_0x2c02f3){if(_0x2c02f3){return _0x1923ca[_0x7c17('0x1b')](_0x385fcc);}return _0x1923ca['status'](_0x385fcc)[_0x7c17('0x1c')]();};}function respondWithResult(_0x1caf27,_0x5d8f8d){_0x5d8f8d=_0x5d8f8d||0xc8;return function(_0x107a73){if(_0x107a73){return _0x1caf27[_0x7c17('0x1d')](_0x5d8f8d)['json'](_0x107a73);}};}function respondWithFilteredResult(_0x3a404b,_0x211a0a){return function(_0x4aa60a){if(_0x4aa60a){var _0x1b9888=_0x4aa60a[_0x7c17('0x1e')],_0x23457b=_0x211a0a[_0x7c17('0x1f')],_0x2c7ae9=_0x211a0a[_0x7c17('0x1f')]+_0x211a0a[_0x7c17('0x20')],_0x5b4347;if(_0x2c7ae9>=_0x1b9888){_0x2c7ae9=_0x1b9888;_0x5b4347=0xc8;}else{_0x5b4347=0xce;}_0x3a404b['status'](_0x5b4347);return _0x3a404b[_0x7c17('0x21')](_0x7c17('0x22'),_0x23457b+'-'+_0x2c7ae9+'/'+_0x1b9888)['json'](_0x4aa60a);}return null;};}function patchUpdates(_0x4e0255){return function(_0x384472){try{jsonpatch[_0x7c17('0x23')](_0x384472,_0x4e0255,!![]);}catch(_0x193cba){return BPromise[_0x7c17('0x24')](_0x193cba);}return _0x384472[_0x7c17('0x25')]();};}function saveUpdates(_0x2ad4f6,_0x162ec1){return function(_0x31b814){if(_0x31b814){return _0x31b814['update'](_0x2ad4f6)[_0x7c17('0x26')](function(_0x2eec7e){return _0x2eec7e;});}return null;};}function removeEntity(_0x3ca72b,_0x130933){return function(_0x40da93){if(_0x40da93){return _0x40da93[_0x7c17('0x27')]()[_0x7c17('0x26')](function(){_0x3ca72b[_0x7c17('0x1d')](0xcc)[_0x7c17('0x1c')]();});}};}function handleEntityNotFound(_0x3538b3,_0x423e4e){return function(_0x12118d){if(!_0x12118d){_0x3538b3[_0x7c17('0x1b')](0x194);}return _0x12118d;};}function handleError(_0x3c9fa3,_0x4e0374){_0x4e0374=_0x4e0374||0x1f4;return function(_0x5b7815){logger[_0x7c17('0x28')](_0x5b7815[_0x7c17('0x29')]);if(_0x5b7815[_0x7c17('0x2a')]){delete _0x5b7815['name'];}_0x3c9fa3['status'](_0x4e0374)[_0x7c17('0x2b')](_0x5b7815);};}exports[_0x7c17('0x2c')]=function(_0x5a109a,_0x4893a4){var _0x1f663a={},_0x1c2675={},_0x139835={'count':0x0,'rows':[]};var _0x5ebbbd=db[_0x7c17('0x2d')][_0x7c17('0x2e')];_0x1c2675[_0x7c17('0x2f')]=_[_0x7c17('0x30')](_0x5ebbbd);_0x1c2675[_0x7c17('0x31')]=_[_0x7c17('0x30')](_0x5a109a[_0x7c17('0x31')]);_0x1c2675['filters']=_[_0x7c17('0x32')](_0x1c2675['model'],_0x1c2675[_0x7c17('0x31')]);_0x1f663a[_0x7c17('0x33')]=_[_0x7c17('0x32')](_0x1c2675[_0x7c17('0x2f')],qs[_0x7c17('0x34')](_0x5a109a[_0x7c17('0x31')]['fields']));_0x1f663a[_0x7c17('0x33')]=_0x1f663a[_0x7c17('0x33')][_0x7c17('0x35')]?_0x1f663a['attributes']:_0x1c2675['model'];if(!_0x5a109a[_0x7c17('0x31')][_0x7c17('0x36')](_0x7c17('0x37'))){_0x1f663a[_0x7c17('0x20')]=qs[_0x7c17('0x20')](_0x5a109a['query'][_0x7c17('0x20')]);_0x1f663a[_0x7c17('0x1f')]=qs[_0x7c17('0x1f')](_0x5a109a[_0x7c17('0x31')]['offset']);}_0x1f663a[_0x7c17('0x38')]=qs[_0x7c17('0x39')](_0x5a109a[_0x7c17('0x31')][_0x7c17('0x39')]);_0x1f663a[_0x7c17('0x3a')]=qs[_0x7c17('0x3b')](_['pick'](_0x5a109a[_0x7c17('0x31')],_0x1c2675[_0x7c17('0x3b')]));if(_0x5a109a[_0x7c17('0x31')][_0x7c17('0x3c')]){_0x1f663a[_0x7c17('0x3a')]=_[_0x7c17('0x3d')](_0x1f663a[_0x7c17('0x3a')],{'$or':_[_0x7c17('0x3e')](_0x5ebbbd,function(_0x571151){if(_0x571151[_0x7c17('0x3f')][_0x7c17('0x40')]!==_0x7c17('0x41')){var _0x3fbfa8={};_0x3fbfa8[_0x571151[_0x7c17('0x42')]]={'$like':'%'+_0x5a109a[_0x7c17('0x31')][_0x7c17('0x3c')]+'%'};return _0x3fbfa8;}})});}_0x1f663a=_[_0x7c17('0x3d')]({},_0x1f663a,_0x5a109a[_0x7c17('0x43')]);var _0x590d4d={'where':_0x1f663a[_0x7c17('0x3a')]};return db[_0x7c17('0x2d')][_0x7c17('0x1e')](_0x590d4d)[_0x7c17('0x26')](function(_0x2fbff1){_0x139835[_0x7c17('0x1e')]=_0x2fbff1;if(_0x5a109a[_0x7c17('0x31')][_0x7c17('0x44')]){_0x1f663a[_0x7c17('0x45')]=[{'all':!![]}];}return db[_0x7c17('0x2d')]['findAll'](_0x1f663a);})[_0x7c17('0x26')](function(_0x18b6e4){_0x139835[_0x7c17('0x46')]=_0x18b6e4;return _0x139835;})['then'](respondWithFilteredResult(_0x4893a4,_0x1f663a))['catch'](handleError(_0x4893a4,null));};exports[_0x7c17('0x47')]=function(_0xb3f509,_0x2e92d8){var _0x352a5f={'raw':!![],'where':{'id':_0xb3f509[_0x7c17('0x48')]['id']}},_0x21d235={};_0x21d235[_0x7c17('0x2f')]=_[_0x7c17('0x30')](db[_0x7c17('0x2d')][_0x7c17('0x2e')]);_0x21d235[_0x7c17('0x31')]=_[_0x7c17('0x30')](_0xb3f509['query']);_0x21d235[_0x7c17('0x3b')]=_['intersection'](_0x21d235[_0x7c17('0x2f')],_0x21d235[_0x7c17('0x31')]);_0x352a5f[_0x7c17('0x33')]=_[_0x7c17('0x32')](_0x21d235['model'],qs[_0x7c17('0x34')](_0xb3f509[_0x7c17('0x31')][_0x7c17('0x34')]));_0x352a5f[_0x7c17('0x33')]=_0x352a5f[_0x7c17('0x33')][_0x7c17('0x35')]?_0x352a5f[_0x7c17('0x33')]:_0x21d235[_0x7c17('0x2f')];if(_0xb3f509[_0x7c17('0x31')][_0x7c17('0x44')]){_0x352a5f[_0x7c17('0x45')]=[{'all':!![]}];}_0x352a5f=_[_0x7c17('0x3d')]({},_0x352a5f,_0xb3f509[_0x7c17('0x43')]);return db[_0x7c17('0x2d')][_0x7c17('0x49')](_0x352a5f)['then'](handleEntityNotFound(_0x2e92d8,null))[_0x7c17('0x26')](respondWithResult(_0x2e92d8,null))[_0x7c17('0x4a')](handleError(_0x2e92d8,null));};exports['create']=function(_0x5b7480,_0x428016){return db[_0x7c17('0x2d')][_0x7c17('0x4b')](_0x5b7480[_0x7c17('0x4c')],{})[_0x7c17('0x26')](respondWithResult(_0x428016,0xc9))[_0x7c17('0x4a')](handleError(_0x428016,null));};exports['update']=function(_0x590f7b,_0x5504a3){if(_0x590f7b[_0x7c17('0x4c')]['id']){delete _0x590f7b[_0x7c17('0x4c')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x590f7b[_0x7c17('0x48')]['id']}})[_0x7c17('0x26')](handleEntityNotFound(_0x5504a3,null))[_0x7c17('0x26')](saveUpdates(_0x590f7b[_0x7c17('0x4c')],null))[_0x7c17('0x26')](respondWithResult(_0x5504a3,null))[_0x7c17('0x4a')](handleError(_0x5504a3,null));};exports[_0x7c17('0x27')]=function(_0x1199d6,_0x7c3d43){return db[_0x7c17('0x2d')][_0x7c17('0x49')]({'where':{'id':_0x1199d6['params']['id']}})[_0x7c17('0x26')](handleEntityNotFound(_0x7c3d43,null))[_0x7c17('0x26')](removeEntity(_0x7c3d43,null))[_0x7c17('0x4a')](handleError(_0x7c3d43,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3daf703..c0b8e16 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 _0x68e4=['./openchannelApplication.attributes','exports','define','utf8mb4','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x73ff24,_0x4c3252){var _0xe5794=function(_0x31a8cd){while(--_0x31a8cd){_0x73ff24['push'](_0x73ff24['shift']());}};_0xe5794(++_0x4c3252);}(_0x68e4,0x9a));var _0x468e=function(_0x5482a,_0x39e092){_0x5482a=_0x5482a-0x0;var _0x5323dc=_0x68e4[_0x5482a];return _0x5323dc;};'use strict';var _=require(_0x468e('0x0'));var util=require('util');var logger=require(_0x468e('0x1'))(_0x468e('0x2'));var moment=require('moment');var BPromise=require(_0x468e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x468e('0x4'));var config=require(_0x468e('0x5'));var attributes=require(_0x468e('0x6'));module[_0x468e('0x7')]=function(_0x5eb898,_0x242648){return _0x5eb898[_0x468e('0x8')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x468e('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x42a3=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x42a3,0x11d));var _0x342a=function(_0x5c9d48,_0x3f7d2a){_0x5c9d48=_0x5c9d48-0x0;var _0x3c7506=_0x42a3[_0x5c9d48];return _0x3c7506;};'use strict';var _=require(_0x342a('0x0'));var util=require(_0x342a('0x1'));var logger=require(_0x342a('0x2'))(_0x342a('0x3'));var moment=require(_0x342a('0x4'));var BPromise=require(_0x342a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x342a('0x6'));var config=require(_0x342a('0x7'));var attributes=require(_0x342a('0x8'));module[_0x342a('0x9')]=function(_0x581ba3,_0x1a29d7){return _0x581ba3[_0x342a('0xa')](_0x342a('0xb'),attributes,{'tableName':_0x342a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x342a('0xd'),'collate':_0x342a('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index c8273dd..3c27068 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(_0x406626,_0x10928e){var _0x4dc453=function(_0x35b495){while(--_0x35b495){_0x406626['push'](_0x406626['shift']());}};_0x4dc453(++_0x10928e);}(_0xb10b,0x12a));var _0xbb10=function(_0x110924,_0x1374bb){_0x110924=_0x110924-0x0;var _0x12905b=_0xb10b[_0x110924];return _0x12905b;};'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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 552724b..6852b3c 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 _0x00f2=['/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages'];(function(_0x1cb067,_0x1230d0){var _0x58de05=function(_0x4766fd){while(--_0x4766fd){_0x1cb067['push'](_0x1cb067['shift']());}};_0x58de05(++_0x1230d0);}(_0x00f2,0x1df));var _0x200f=function(_0x52fbf7,_0x460c94){_0x52fbf7=_0x52fbf7-0x0;var _0x1d6f1e=_0x00f2[_0x52fbf7];return _0x1d6f1e;};'use strict';var multer=require('multer');var util=require(_0x200f('0x0'));var path=require(_0x200f('0x1'));var timeout=require('connect-timeout');var express=require(_0x200f('0x2'));var router=express['Router']();var auth=require(_0x200f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x200f('0x4'));var controller=require(_0x200f('0x5'));router[_0x200f('0x6')]('/',auth[_0x200f('0x7')](),controller[_0x200f('0x8')]);router['get']('/describe',auth[_0x200f('0x7')](),controller[_0x200f('0x9')]);router[_0x200f('0x6')](_0x200f('0xa'),auth[_0x200f('0x7')](),controller[_0x200f('0xb')]);router['get'](_0x200f('0xc'),auth[_0x200f('0x7')](),controller[_0x200f('0xd')]);router[_0x200f('0x6')](_0x200f('0xe'),auth[_0x200f('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x200f('0xf')]);router[_0x200f('0x10')](_0x200f('0xc'),auth[_0x200f('0x7')](),controller[_0x200f('0x11')]);router[_0x200f('0x10')](_0x200f('0x12'),auth['isAuthenticated'](),interaction[_0x200f('0x13')](_0x200f('0x14'),_0x200f('0x15')),controller[_0x200f('0x16')]);router[_0x200f('0x17')](_0x200f('0xa'),auth['isAuthenticated'](),interaction[_0x200f('0x13')](_0x200f('0x14'),_0x200f('0x18')),controller['update']);router[_0x200f('0x19')](_0x200f('0xa'),auth['isAuthenticated'](),interaction[_0x200f('0x13')]('openchannel',_0x200f('0x1a')),controller[_0x200f('0x1b')]);router[_0x200f('0x19')]('/:id/tags',auth[_0x200f('0x7')](),controller['removeTags']);module[_0x200f('0x1c')]=router; \ No newline at end of file +var _0x58b3=['../../config/environment','./openchannelInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','download','post','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','../../components/interaction/service'];(function(_0x213819,_0x59f97c){var _0x3b43bd=function(_0x50a75e){while(--_0x50a75e){_0x213819['push'](_0x213819['shift']());}};_0x3b43bd(++_0x59f97c);}(_0x58b3,0x1f0));var _0x358b=function(_0x54c111,_0x2dfbbf){_0x54c111=_0x54c111-0x0;var _0x3f954f=_0x58b3[_0x54c111];return _0x3f954f;};'use strict';var multer=require(_0x358b('0x0'));var util=require('util');var path=require(_0x358b('0x1'));var timeout=require(_0x358b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x358b('0x3'));var config=require(_0x358b('0x4'));var controller=require(_0x358b('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x358b('0x6')]);router[_0x358b('0x7')](_0x358b('0x8'),auth['isAuthenticated'](),controller[_0x358b('0x9')]);router['get'](_0x358b('0xa'),auth[_0x358b('0xb')](),controller[_0x358b('0xc')]);router[_0x358b('0x7')](_0x358b('0xd'),auth[_0x358b('0xb')](),controller[_0x358b('0xe')]);router[_0x358b('0x7')]('/:id/download',auth[_0x358b('0xb')](),controller[_0x358b('0xf')]);router[_0x358b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x358b('0xd'),auth[_0x358b('0xb')](),controller['addMessage']);router[_0x358b('0x10')]('/:id/tags',auth[_0x358b('0xb')](),interaction[_0x358b('0x11')](_0x358b('0x12'),_0x358b('0x13')),controller[_0x358b('0x14')]);router[_0x358b('0x15')]('/:id',auth[_0x358b('0xb')](),interaction[_0x358b('0x11')](_0x358b('0x12'),'openchannelinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x358b('0x11')]('openchannel',_0x358b('0x16')),controller[_0x358b('0x17')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x358b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 3124920..55fbe9e 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 _0x3291=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3291,0x16c));var _0x1329=function(_0x6c52f4,_0x29cbf6){_0x6c52f4=_0x6c52f4-0x0;var _0x282445=_0x3291[_0x6c52f4];return _0x282445;};'use strict';var Sequelize=require(_0x1329('0x0'));module[_0x1329('0x1')]={'closed':{'type':Sequelize[_0x1329('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1329('0x3')]},'disposition':{'type':Sequelize[_0x1329('0x4')]},'note':{'type':Sequelize[_0x1329('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x1329('0x4')]},'externalUrl':{'type':Sequelize[_0x1329('0x4')]},'lastMsgAt':{'type':Sequelize[_0x1329('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1329('0x5')]('in',_0x1329('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1329('0x4')]}}; \ No newline at end of file +var _0x0ffa=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x5edcbc,_0x4a611c){var _0x10a1c1=function(_0xa17df6){while(--_0xa17df6){_0x5edcbc['push'](_0x5edcbc['shift']());}};_0x10a1c1(++_0x4a611c);}(_0x0ffa,0x12f));var _0xa0ff=function(_0x39ff9c,_0x35d13a){_0x39ff9c=_0x39ff9c-0x0;var _0x4ff2d2=_0x0ffa[_0x39ff9c];return _0x4ff2d2;};'use strict';var Sequelize=require(_0xa0ff('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa0ff('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa0ff('0x2')]},'disposition':{'type':Sequelize[_0xa0ff('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa0ff('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xa0ff('0x3')]},'lastMsgAt':{'type':Sequelize[_0xa0ff('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa0ff('0x4')]('in',_0xa0ff('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa0ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index b5d772f..71f03b1 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 _0x8446=['YYYY-MM-DD','mkdirSync','Openchannel','N.A.','closed','disposition','Public','Private','basename','existsSync','pipe','createWriteStream','out','System','renderFile','root','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','catch','index','OpenchannelInteraction','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','select','field','from','tools_tags','COUNT(*)','openchannel_messages','where','me.OpenchannelInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false','expr','advancedFilter','forEach','value','startOf','day','utc','format','endOf','and','condition','TagId','unreadMessages','isArray','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','ContactId','c.firstName','\x20LIKE\x20?','c.lastName','c.email','\x20>\x20?','\x20<\x20?','filter','isNil','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','split','toString','join','DESC','group','i.id','Sequelize','QueryTypes','SELECT','COUNT(me.id)','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','keys','mail_interaction_has_tags','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.lastName','Contact.phone','Contact.mobile','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','show','params','include','create','body','find','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','setTags','ids','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','server','tmp','attachments','createdAt','direction','secret','User','fullname','CmContact','Contact','firstName','lastName','Attachment','OpenchannelAccount','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20','30px'];(function(_0x217852,_0x363a8c){var _0x32934c=function(_0x2ed32f){while(--_0x2ed32f){_0x217852['push'](_0x217852['shift']());}};_0x32934c(++_0x363a8c);}(_0x8446,0x1de));var _0x6844=function(_0x3d6d80,_0x1689b7){_0x3d6d80=_0x3d6d80-0x0;var _0x30712a=_0x8446[_0x3d6d80];return _0x30712a;};'use strict';var pdf=require(_0x6844('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6844('0x1'));var zipdir=require(_0x6844('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6844('0x3'));var moment=require(_0x6844('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6844('0x5'));var path=require(_0x6844('0x6'));var sox=require(_0x6844('0x7'));var csv=require(_0x6844('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6844('0x9'));var squel=require('squel');var crypto=require(_0x6844('0xa'));var jsforce=require(_0x6844('0xb'));var deskjs=require(_0x6844('0xc'));var toCsv=require(_0x6844('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6844('0xd'));var qs=require(_0x6844('0xe'));var hardwareService=require(_0x6844('0xf'));var logger=require(_0x6844('0x10'))(_0x6844('0x11'));var utils=require(_0x6844('0x12'));var config=require('../../config/environment');var db=require(_0x6844('0x13'))['db'];config[_0x6844('0x14')]=_[_0x6844('0x15')](config[_0x6844('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6844('0x14')]));require(_0x6844('0x16'))[_0x6844('0x17')](socket);function respondWithStatusCode(_0x37697f,_0x33af09){_0x33af09=_0x33af09||0xcc;return function(_0xf9a0cc){if(_0xf9a0cc){return _0x37697f[_0x6844('0x18')](_0x33af09);}return _0x37697f[_0x6844('0x19')](_0x33af09)[_0x6844('0x1a')]();};}function respondWithResult(_0x13c3f7,_0x451db2){_0x451db2=_0x451db2||0xc8;return function(_0x4eb322){if(_0x4eb322){return _0x13c3f7[_0x6844('0x19')](_0x451db2)[_0x6844('0x1b')](_0x4eb322);}};}function respondWithFilteredResult(_0x4c913c,_0x23470d){return function(_0x1dfdbc){if(_0x1dfdbc){var _0x58ccfa=_0x1dfdbc[_0x6844('0x1c')],_0x48eec9=_0x23470d['offset'],_0x287745=_0x23470d[_0x6844('0x1d')]+_0x23470d[_0x6844('0x1e')],_0x5a08af;if(_0x287745>=_0x58ccfa){_0x287745=_0x58ccfa;_0x5a08af=0xc8;}else{_0x5a08af=0xce;}_0x4c913c[_0x6844('0x19')](_0x5a08af);return _0x4c913c[_0x6844('0x1f')](_0x6844('0x20'),_0x48eec9+'-'+_0x287745+'/'+_0x58ccfa)[_0x6844('0x1b')](_0x1dfdbc);}return null;};}function patchUpdates(_0x49e8a3){return function(_0x52c6d8){try{jsonpatch['apply'](_0x52c6d8,_0x49e8a3,!![]);}catch(_0xb17649){return BPromise[_0x6844('0x21')](_0xb17649);}return _0x52c6d8['save']();};}function saveUpdates(_0xa5fa72,_0x51e82e){return function(_0x416f5e){if(_0x416f5e){return _0x416f5e[_0x6844('0x22')](_0xa5fa72)[_0x6844('0x23')](function(_0x488a04){return _0x488a04;});}return null;};}function removeEntity(_0x11fd0e,_0x3c13c3){return function(_0x41cbe2){if(_0x41cbe2){return _0x41cbe2[_0x6844('0x24')]()[_0x6844('0x23')](function(){_0x11fd0e[_0x6844('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba2d1,_0x5b59ec){return function(_0x5ecff2){if(!_0x5ecff2){_0x3ba2d1['sendStatus'](0x194);}return _0x5ecff2;};}function handleError(_0x133e21,_0x5ece99){_0x5ece99=_0x5ece99||0x1f4;return function(_0x31696a){logger[_0x6844('0x25')](_0x31696a[_0x6844('0x26')]);if(_0x31696a[_0x6844('0x27')]){delete _0x31696a[_0x6844('0x27')];}_0x133e21[_0x6844('0x19')](_0x5ece99)[_0x6844('0x28')](_0x31696a);};}function getInteractionUsers(_0x236a1b,_0x4d1b18){return new BPromise(function(_0x540e90,_0x44a62b){try{if(_0x4d1b18[_0x236a1b['id']]){_0x236a1b[_0x6844('0x29')]=_[_0x6844('0x2a')](_0x4d1b18[_0x236a1b['id']],function(_0x31f7e8){return{'id':_0x31f7e8['id']};});}}catch(_0x5c1ab8){_0x44a62b(_0x5c1ab8);}_0x540e90(_0x236a1b);});}function getInteractionTags(_0x5db77c,_0x40b792){return new BPromise(function(_0x4207b5,_0x361a62){try{if(_0x5db77c[_0x6844('0x2b')]){_0x5db77c[_0x6844('0x2c')]=[];_0x5db77c['TagIds']['split'](',')['forEach'](function(_0x14d673){_0x5db77c[_0x6844('0x2c')]['push'](_0x40b792[_0x14d673]);});}delete _0x5db77c[_0x6844('0x2b')];}catch(_0x4b8c79){_0x361a62(_0x4b8c79);}_0x4207b5(_0x5db77c);});}function updateOpenchannelInteraction(_0x684037,_0x1aef87,_0x2fafd9){return new BPromise(function(_0x5ba101,_0x32d31b){return getInteractionUsers(_0x684037,_0x2fafd9)[_0x6844('0x23')](function(_0x11730c){return getInteractionTags(_0x11730c,_0x1aef87);})[_0x6844('0x23')](function(_0x566ca5){_0x5ba101(_0x566ca5);})[_0x6844('0x2d')](function(_0x5817f1){_0x32d31b(_0x5817f1);});});}exports[_0x6844('0x2e')]=function(_0x4f8156,_0x4f74af){var _0x333ac6={},_0x2b4b20={},_0xbd0f7d={'count':0x0,'rows':[]};var _0x2cdc92=db[_0x6844('0x2f')][_0x6844('0x30')];_0x2b4b20[_0x6844('0x31')]=_['keys'](_0x2cdc92);_0x2b4b20[_0x6844('0x32')]=_['keys'](_0x4f8156[_0x6844('0x32')]);_0x2b4b20[_0x6844('0x33')]=_['intersection'](_0x2b4b20[_0x6844('0x31')],_0x2b4b20[_0x6844('0x32')]);_0x333ac6[_0x6844('0x34')]=_[_0x6844('0x35')](_0x2b4b20['model'],qs[_0x6844('0x36')](_0x4f8156[_0x6844('0x32')]['fields']));_0x333ac6['attributes']=_0x333ac6[_0x6844('0x34')][_0x6844('0x37')]?_0x333ac6[_0x6844('0x34')]:_0x2b4b20[_0x6844('0x31')];if(!_0x4f8156[_0x6844('0x32')][_0x6844('0x38')](_0x6844('0x39'))){_0x333ac6['limit']=qs[_0x6844('0x1e')](_0x4f8156[_0x6844('0x32')]['limit']);_0x333ac6[_0x6844('0x1d')]=qs[_0x6844('0x1d')](_0x4f8156['query'][_0x6844('0x1d')]);}_0x333ac6[_0x6844('0x3a')]=qs[_0x6844('0x3b')](_0x4f8156[_0x6844('0x32')][_0x6844('0x3b')]);_0x333ac6['where']=qs[_0x6844('0x33')](_['pick'](_0x4f8156['query'],_0x2b4b20[_0x6844('0x33')]));var _0x160335=[];var _0x1ae0b7=squel[_0x6844('0x3c')]()[_0x6844('0x3d')]('id')['field']('name')[_0x6844('0x3d')]('color')[_0x6844('0x3e')](_0x6844('0x3f'));var _0x4a4403=squel[_0x6844('0x3c')]()[_0x6844('0x3d')](_0x6844('0x40'))[_0x6844('0x3e')](_0x6844('0x41'),'me')[_0x6844('0x42')](_0x6844('0x43'))[_0x6844('0x42')](_0x6844('0x44'))[_0x6844('0x42')](_0x6844('0x45'));var _0x5ddf8b=squel[_0x6844('0x3c')]()['field'](_0x6844('0x46'))['field'](_0x6844('0x47'))['from'](_0x6844('0x48'),'ui')['left_join'](_0x6844('0x49'),'u','u.id\x20=\x20ui.UserId');var _0x5a7029=squel['select']()[_0x6844('0x3e')](_0x6844('0x4a'),'i')[_0x6844('0x4b')](_0x6844('0x4c'),'c',_0x6844('0x4d'))[_0x6844('0x4b')](_0x6844('0x49'),'o',_0x6844('0x4e'))[_0x6844('0x4b')](_0x6844('0x4f'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x6844('0x4b')](_0x6844('0x41'),'me',_0x6844('0x50'));var _0x16a24a=squel[_0x6844('0x51')]();if(_0x4f8156[_0x6844('0x32')][_0x6844('0x52')]){var _0x117e5d=JSON['parse'](_0x4f8156[_0x6844('0x32')]['advancedFilter']);_['keys'](_0x117e5d)[_0x6844('0x53')](function(_0x1e66f4){var _0x55058e=_0x117e5d[_0x1e66f4];if(_0x1e66f4==='createdAt'){var _0x203619=moment(_0x55058e[_0x6844('0x54')]['dateStart'])[_0x6844('0x55')](_0x6844('0x56'))[_0x6844('0x57')]()[_0x6844('0x58')]();var _0x4ec1fd=moment(_0x4ec1fd)[_0x6844('0x57')]()[_0x6844('0x59')]('day')[_0x6844('0x58')]();_0x16a24a[_0x6844('0x5a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x203619,_0x4ec1fd);}else{if(_['isArray'](_0x55058e[_0x6844('0x5b')])){_0x55058e[_0x6844('0x5b')][_0x6844('0x53')](function(_0x54f23c){switch(_0x55058e[_0x6844('0x5b')][_0x6844('0x54')]){case'IS':if(_0x1e66f4!==_0x6844('0x5c')&&_0x1e66f4!==_0x6844('0x5d')){if(_[_0x6844('0x5e')](_0x55058e['value'])&&_0x55058e[_0x6844('0x54')]['length']>0x1){_0x16a24a[_0x6844('0x5a')](_0x55058e[_0x6844('0x5f')]+'.'+_0x1e66f4+_0x6844('0x60'),_0x55058e[_0x6844('0x54')]);}else{_0x16a24a[_0x6844('0x5a')](_0x55058e[_0x6844('0x5f')]+'.'+_0x1e66f4+_0x6844('0x61'),_0x55058e['value'][0x0]);}}break;case'=':_0x16a24a[_0x6844('0x5a')](_0x55058e['tableAlias']+'.'+_0x1e66f4+_0x6844('0x61'),_0x55058e[_0x6844('0x54')]);break;case _0x6844('0x62'):if(_0x1e66f4===_0x6844('0x63')){_0x16a24a[_0x6844('0x5a')](_0x6844('0x64')+_0x6844('0x65'),'%'+_0x55058e[_0x6844('0x54')]+'%');_0x16a24a['or'](_0x6844('0x66')+_0x6844('0x65'),'%'+_0x55058e[_0x6844('0x54')]+'%');_0x16a24a['or'](_0x6844('0x67')+_0x6844('0x65'),'%'+_0x55058e[_0x6844('0x54')]+'%');}else{_0x16a24a['and'](_0x55058e['tableAlias']+'.'+_0x1e66f4+'\x20LIKE\x20?','%'+_0x55058e['value']+'%');}break;case'>':_0x16a24a[_0x6844('0x5a')](_0x55058e[_0x6844('0x5f')]+'.'+_0x1e66f4+_0x6844('0x68'),_0x55058e['value']);break;case'<':_0x16a24a['and'](_0x55058e[_0x6844('0x5f')]+'.'+_0x1e66f4+_0x6844('0x69'),_0x55058e[_0x6844('0x54')]);break;}});}else{switch(_0x55058e[_0x6844('0x5b')][_0x6844('0x54')]){case'IS':if(_0x1e66f4!==_0x6844('0x5c')&&_0x1e66f4!=='unreadMessages'){if(_['isArray'](_0x55058e[_0x6844('0x54')])&&_0x55058e[_0x6844('0x54')]['length']>0x1){_0x16a24a['and'](_0x55058e[_0x6844('0x5f')]+'.'+_0x1e66f4+_0x6844('0x60'),_0x55058e[_0x6844('0x54')]);}else{_0x16a24a[_0x6844('0x5a')](_0x55058e['tableAlias']+'.'+_0x1e66f4+_0x6844('0x61'),_0x55058e[_0x6844('0x54')][0x0]);}}break;case'=':_0x16a24a['and'](_0x55058e[_0x6844('0x5f')]+'.'+_0x1e66f4+_0x6844('0x61'),_0x55058e['value']);break;case'LIKE':if(_0x1e66f4===_0x6844('0x63')){_0x16a24a[_0x6844('0x5a')](_0x6844('0x64')+_0x6844('0x65'),'%'+_0x55058e['value']+'%');_0x16a24a['or'](_0x6844('0x66')+_0x6844('0x65'),'%'+_0x55058e[_0x6844('0x54')]+'%');_0x16a24a['or']('c.email'+_0x6844('0x65'),'%'+_0x55058e[_0x6844('0x54')]+'%');}else{_0x16a24a['and'](_0x55058e['tableAlias']+'.'+_0x1e66f4+_0x6844('0x65'),'%'+_0x55058e['value']+'%');}break;case'>':_0x16a24a[_0x6844('0x5a')](_0x55058e[_0x6844('0x5f')]+'.'+_0x1e66f4+'\x20>\x20?',_0x55058e[_0x6844('0x54')]);break;case'<':_0x16a24a['and'](_0x55058e[_0x6844('0x5f')]+'.'+_0x1e66f4+_0x6844('0x69'),_0x55058e[_0x6844('0x54')]);break;}}}});}else{var _0x48ed0c=_(Object['keys'](_0x4f8156[_0x6844('0x32')]))['map'](function(_0x5a9478){return _0x2cdc92[_0x6844('0x38')](_0x5a9478)?_0x5a9478:undefined;})[_0x6844('0x6a')](function(_0x484249){return!_[_0x6844('0x6b')](_0x484249);})[_0x6844('0x54')]();if(!_[_0x6844('0x6c')](_0x48ed0c)){_0x48ed0c[_0x6844('0x53')](function(_0x33ab84){if(_0x33ab84===_0x6844('0x6d')){_0x5a7029['where'](_0x6844('0x6e'),[][_0x6844('0x6f')](_0x4f8156[_0x6844('0x32')][_0x33ab84]));}else if(_0x33ab84==='createdAt'){var _0x5574fb=JSON[_0x6844('0x70')](_0x4f8156[_0x6844('0x32')][_0x33ab84])[_0x6844('0x71')];var _0xc16f94=JSON[_0x6844('0x70')](_0x4f8156['query'][_0x33ab84])['$lte'];_0x5a7029[_0x6844('0x42')](_0x6844('0x72'),_0x5574fb,_0xc16f94);}else{if(_0x4f8156[_0x6844('0x32')][_0x33ab84]==='null'){_0x5a7029[_0x6844('0x42')]('i.'+_0x33ab84+_0x6844('0x73'));}else{_0x5a7029[_0x6844('0x42')]('i.'+_0x33ab84+_0x6844('0x61'),_0x4f8156['query'][_0x33ab84]);}}});}if(_0x4f8156[_0x6844('0x32')][_0x6844('0x6a')]){var _0x1819c=_0x4f8156['query'][_0x6844('0x6a')][_0x6844('0x74')]('\x5c','\x5c\x5c')[_0x6844('0x74')]('\x27\x27',_0x6844('0x75'));if(qs[_0x6844('0x76')](_0x1819c)){_0x16a24a['or'](_0x6844('0x77'),_0x1819c+'%');}else{var _0x3e8e00=[];_0x1819c[_0x6844('0x78')]('\x20')['forEach'](function(_0x2c11b8){_0x3e8e00['push']('+'+_0x2c11b8[_0x6844('0x79')]());});var _0x23273d=_0x3e8e00[_0x6844('0x7a')]('\x20');_0x16a24a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',_0x23273d)['or']('i.from\x20LIKE\x20?',_0x1819c+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1819c+'%');}}}_0x5a7029[_0x6844('0x42')](_0x16a24a);if(_0x333ac6[_0x6844('0x3a')]){_0x333ac6[_0x6844('0x3a')]['forEach'](function(_0x59c4e1){_0x5a7029['order']('i.'+_0x59c4e1[0x0],_0x59c4e1[0x1]===_0x6844('0x7b')?![]:!![]);});}_0x5a7029[_0x6844('0x7c')](_0x6844('0x7d'));var _0x4fb030={'type':db[_0x6844('0x7e')][_0x6844('0x7f')][_0x6844('0x80')],'raw':!![]};var _0x3a898e=_0x5a7029['clone']()[_0x6844('0x3d')](_0x6844('0x40'))[_0x6844('0x3d')](_0x6844('0x81'),_0x6844('0x5d'));if(!_0x4f8156[_0x6844('0x32')][_0x6844('0x52')]){if(_0x4f8156[_0x6844('0x32')][_0x6844('0x82')]){if(_0x4f8156[_0x6844('0x32')][_0x6844('0x82')]==0x1){_0x3a898e[_0x6844('0x83')](_0x6844('0x84'));_0x5a7029['having'](_0x6844('0x84'));}else{_0x3a898e['having'](_0x6844('0x85'));_0x5a7029[_0x6844('0x83')](_0x6844('0x85'));}}if(_0x4f8156[_0x6844('0x32')]['tag']){var _0x9c382b=_[_0x6844('0x5e')](_0x4f8156['query'][_0x6844('0x86')])?_0x4f8156[_0x6844('0x32')]['tag']:new Array(_0x4f8156[_0x6844('0x32')][_0x6844('0x86')]);var _0x10e21b=squel['expr']();_0x9c382b[_0x6844('0x53')](function(_0x443da4){_0x10e21b['or'](_0x6844('0x87'),'%,'+_0x443da4+',%');});_0x5a7029[_0x6844('0x83')](_0x10e21b);_0x3a898e[_0x6844('0x4b')](_0x6844('0x88'),'it',_0x6844('0x89'));_0x3a898e[_0x6844('0x4b')](_0x6844('0x3f'),'t',_0x6844('0x8a'));_0x3a898e[_0x6844('0x42')](_0x6844('0x8b'),_0x9c382b);}}else{var _0x117e5d=JSON[_0x6844('0x70')](_0x4f8156[_0x6844('0x32')][_0x6844('0x52')]);_[_0x6844('0x8c')](_0x117e5d)['forEach'](function(_0x1cc752){var _0x15d867=_0x117e5d[_0x1cc752];if(_0x1cc752==='TagId'){var _0x2ac435=_0x15d867[_0x6844('0x54')];var _0x5e6a52=squel[_0x6844('0x51')]();_0x2ac435[_0x6844('0x53')](function(_0x31a855){_0x5e6a52['or'](_0x6844('0x87'),'%,'+_0x31a855+',%');});_0x5a7029['having'](_0x5e6a52);_0x3a898e[_0x6844('0x4b')](_0x6844('0x8d'),'it','it.MailInteractionId\x20=\x20i.id');_0x3a898e[_0x6844('0x4b')](_0x6844('0x3f'),'t',_0x6844('0x8a'));_0x3a898e[_0x6844('0x42')](_0x6844('0x8b'),_0x2ac435);}else if(_0x1cc752===_0x6844('0x5d')){if(_0x15d867[_0x6844('0x54')]['length']===0x1){if(_0x15d867['value'][0x0]===0x1){_0x3a898e[_0x6844('0x83')](_0x6844('0x84'));_0x5a7029[_0x6844('0x83')](_0x6844('0x84'));}else{_0x3a898e['having']('`unreadMessages`\x20>\x200');_0x5a7029[_0x6844('0x83')](_0x6844('0x85'));}}}});}db[_0x6844('0x8e')][_0x6844('0x32')](_0x3a898e[_0x6844('0x79')](),_0x4fb030)['then'](function(_0x41a76b){_0xbd0f7d[_0x6844('0x1c')]=_0x41a76b[_0x6844('0x37')];if(_0xbd0f7d[_0x6844('0x1c')]===0x0)return[];return db[_0x6844('0x8e')]['query'](_0x1ae0b7[_0x6844('0x79')](),_0x4fb030)[_0x6844('0x23')](function(_0x761d0f){_0x160335=_[_0x6844('0x8f')](_0x761d0f,'id');_0x4fb030=_[_0x6844('0x90')](_0x4fb030,{'model':db[_0x6844('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x5a7029[_0x6844('0x3d')](_0x6844('0x81'),_0x6844('0x5d'));_0x5a7029[_0x6844('0x3d')](_0x6844('0x91'),_0x6844('0x92'));_0x5a7029[_0x6844('0x3d')](_0x6844('0x93'),_0x6844('0x94'));_0x5a7029[_0x6844('0x3d')](_0x6844('0x95'));_0x5a7029['field'](_0x6844('0x64'),'Contact.firstName');_0x5a7029[_0x6844('0x3d')](_0x6844('0x66'),_0x6844('0x96'));_0x5a7029[_0x6844('0x3d')]('c.email','Contact.email');_0x5a7029['field']('c.phone',_0x6844('0x97'));_0x5a7029[_0x6844('0x3d')]('c.mobile',_0x6844('0x98'));_0x5a7029['field']('c.fax',_0x6844('0x99'));_0x5a7029['field'](_0x6844('0x9a'),_0x6844('0x2b'));_0x5a7029[_0x6844('0x4b')](_0x6844('0x88'),'it',_0x6844('0x89'));_0x5a7029['left_join'](_0x6844('0x3f'),'t',_0x6844('0x8a'));_0x5a7029['limit'](_0x333ac6[_0x6844('0x1e')]);_0x5a7029['offset'](_0x333ac6['offset']);return db['sequelize'][_0x6844('0x32')](_0x5a7029[_0x6844('0x79')](),_0x4fb030);})[_0x6844('0x23')](function(_0x1cef89){_0x5ddf8b[_0x6844('0x42')](_0x6844('0x9b'),_[_0x6844('0x2a')](_0x1cef89,'id'));return db[_0x6844('0x8e')][_0x6844('0x32')](_0x5ddf8b['toString'](),_0x4fb030)['then'](function(_0x261ab1){var _0x4dda44=_[_0x6844('0x9c')](_0x261ab1,_0x6844('0x9d'));var _0x37818d=[];_0x1cef89[_0x6844('0x53')](function(_0x4153f3){_0x37818d[_0x6844('0x9e')](updateOpenchannelInteraction(_0x4153f3,_0x160335,_0x4dda44));});return BPromise[_0x6844('0x9f')](_0x37818d);});});})[_0x6844('0x23')](function(_0xb2bd07){_0xbd0f7d['rows']=_0xb2bd07;return _0xbd0f7d;})[_0x6844('0x23')](respondWithFilteredResult(_0x4f74af,_0x333ac6))[_0x6844('0x2d')](handleError(_0x4f74af,null));};exports[_0x6844('0xa0')]=function(_0x500248,_0x4aae45){var _0xa6f2a={'raw':![],'where':{'id':_0x500248[_0x6844('0xa1')]['id']}},_0x5645df={};_0x5645df[_0x6844('0x31')]=_[_0x6844('0x8c')](db[_0x6844('0x2f')]['rawAttributes']);_0x5645df[_0x6844('0x32')]=_[_0x6844('0x8c')](_0x500248[_0x6844('0x32')]);_0x5645df[_0x6844('0x33')]=_[_0x6844('0x35')](_0x5645df[_0x6844('0x31')],_0x5645df['query']);_0xa6f2a[_0x6844('0x34')]=_[_0x6844('0x35')](_0x5645df['model'],qs[_0x6844('0x36')](_0x500248[_0x6844('0x32')][_0x6844('0x36')]));_0xa6f2a[_0x6844('0x34')]=_0xa6f2a[_0x6844('0x34')]['length']?_0xa6f2a[_0x6844('0x34')]:_0x5645df[_0x6844('0x31')];if(_0x500248[_0x6844('0x32')]['includeAll']){_0xa6f2a[_0x6844('0xa2')]=[{'all':!![]}];}_0xa6f2a=_[_0x6844('0x90')]({},_0xa6f2a,_0x500248['options']);return db['OpenchannelInteraction']['find'](_0xa6f2a)['then'](handleEntityNotFound(_0x4aae45,null))[_0x6844('0x23')](respondWithResult(_0x4aae45,null))[_0x6844('0x2d')](handleError(_0x4aae45,null));};exports[_0x6844('0xa3')]=function(_0x2eb46f,_0x372ef4){return db[_0x6844('0x2f')][_0x6844('0xa3')](_0x2eb46f[_0x6844('0xa4')],{})[_0x6844('0x23')](respondWithResult(_0x372ef4,0xc9))['catch'](handleError(_0x372ef4,null));};exports[_0x6844('0x22')]=function(_0x55e0a9,_0x56a1cb){if(_0x55e0a9[_0x6844('0xa4')]['id']){delete _0x55e0a9['body']['id'];}return db[_0x6844('0x2f')][_0x6844('0xa5')]({'where':{'id':_0x55e0a9['params']['id']}})[_0x6844('0x23')](handleEntityNotFound(_0x56a1cb,null))[_0x6844('0x23')](saveUpdates(_0x55e0a9[_0x6844('0xa4')],null))['then'](respondWithResult(_0x56a1cb,null))[_0x6844('0x2d')](handleError(_0x56a1cb,null));};exports['destroy']=function(_0x2a78da,_0x14083d){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2a78da[_0x6844('0xa1')]['id']}})['then'](handleEntityNotFound(_0x14083d,null))[_0x6844('0x23')](removeEntity(_0x14083d,null))[_0x6844('0x2d')](handleError(_0x14083d,null));};exports[_0x6844('0xa6')]=function(_0x4ac93d,_0x16e9c4){return db[_0x6844('0x2f')][_0x6844('0xa6')]()[_0x6844('0x23')](respondWithResult(_0x16e9c4,null))['catch'](handleError(_0x16e9c4,null));};exports[_0x6844('0xa7')]=function(_0xd356b9,_0x5ef698,_0x26a0e7){return db[_0x6844('0xa8')][_0x6844('0xa5')]({'where':{'id':_0xd356b9[_0x6844('0xa1')]['id']}})[_0x6844('0x23')](handleEntityNotFound(_0x5ef698,null))[_0x6844('0x23')](function(_0x287060){if(_0x287060){return _0x287060['addMessage'](_0xd356b9[_0x6844('0xa4')]['ids'],_[_0x6844('0xa9')](_0xd356b9[_0x6844('0xa4')],['ids','id'])||{});}})[_0x6844('0x23')](respondWithResult(_0x5ef698,null))['catch'](handleError(_0x5ef698,null));};exports[_0x6844('0xaa')]=function(_0x9bbcd7,_0x387320,_0x267e8c){var _0x4cfebd={'raw':![],'where':{}};var _0x31fe7c={};var _0x5d55ee={'count':0x0,'rows':[]};return db[_0x6844('0x2f')][_0x6844('0xab')]({'where':{'id':_0x9bbcd7[_0x6844('0xa1')]['id']}})[_0x6844('0x23')](handleEntityNotFound(_0x387320,null))[_0x6844('0x23')](function(_0x66de66){if(_0x66de66){_0x31fe7c[_0x6844('0x31')]=_[_0x6844('0x8c')](db[_0x6844('0xa8')][_0x6844('0x30')]);_0x31fe7c[_0x6844('0x32')]=_[_0x6844('0x8c')](_0x9bbcd7[_0x6844('0x32')]);_0x31fe7c[_0x6844('0x33')]=_[_0x6844('0x35')](_0x31fe7c[_0x6844('0x31')],_0x31fe7c[_0x6844('0x32')]);_0x4cfebd['attributes']=_[_0x6844('0x35')](_0x31fe7c[_0x6844('0x31')],qs[_0x6844('0x36')](_0x9bbcd7[_0x6844('0x32')][_0x6844('0x36')]));_0x4cfebd[_0x6844('0x34')]=_0x4cfebd[_0x6844('0x34')][_0x6844('0x37')]?_0x4cfebd[_0x6844('0x34')]:_0x31fe7c[_0x6844('0x31')];if(!_0x9bbcd7[_0x6844('0x32')][_0x6844('0x38')](_0x6844('0x39'))){_0x4cfebd['limit']=qs[_0x6844('0x1e')](_0x9bbcd7[_0x6844('0x32')][_0x6844('0x1e')]);_0x4cfebd[_0x6844('0x1d')]=qs['offset'](_0x9bbcd7[_0x6844('0x32')]['offset']);}_0x4cfebd['order']=qs[_0x6844('0x3b')](_0x9bbcd7[_0x6844('0x32')][_0x6844('0x3b')]);_0x4cfebd[_0x6844('0x42')]=qs[_0x6844('0x33')](_['pick'](_0x9bbcd7[_0x6844('0x32')],_0x31fe7c[_0x6844('0x33')]));_0x4cfebd[_0x6844('0x42')]['OpenchannelInteractionId']=_0x66de66['id'];if(_0x9bbcd7[_0x6844('0x32')][_0x6844('0x6a')]){_0x4cfebd[_0x6844('0x42')]=_['merge'](_0x4cfebd['where'],{'$or':_['map'](_0x4cfebd[_0x6844('0x34')],function(_0x22b0b9){var _0x373b04={};_0x373b04[_0x22b0b9]={'$like':'%'+_0x9bbcd7[_0x6844('0x32')][_0x6844('0x6a')]+'%'};return _0x373b04;})});}if(_0x9bbcd7[_0x6844('0x32')][_0x6844('0x71')]){var _0x507689=_0x9bbcd7[_0x6844('0x32')][_0x6844('0x71')][_0x6844('0x78')](',');var _0x3e7a2d={};_0x3e7a2d[_0x507689[0x0]]={'$gte':moment(_0x507689[0x1])['format'](_0x6844('0xac'))};_0x4cfebd[_0x6844('0x42')]=_[_0x6844('0x90')](_0x4cfebd['where'],_0x3e7a2d);}_0x4cfebd=_[_0x6844('0x90')]({},_0x4cfebd,_0x9bbcd7[_0x6844('0xad')]);return db[_0x6844('0xa8')]['count']({'where':_0x4cfebd['where']})[_0x6844('0x23')](function(_0x4232d4){_0x5d55ee[_0x6844('0x1c')]=_0x4232d4;if(_0x9bbcd7[_0x6844('0x32')]['includeAll']){_0x4cfebd[_0x6844('0xa2')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x6844('0xae')](_0x4cfebd);})['then'](function(_0xcd908a){_0x5d55ee[_0x6844('0xaf')]=_0xcd908a;return _0x5d55ee;});}})[_0x6844('0x23')](respondWithFilteredResult(_0x387320,_0x4cfebd))[_0x6844('0x2d')](handleError(_0x387320,null));};exports['addTags']=function(_0x2b0056,_0x179a09,_0x4fb181){return db[_0x6844('0x2f')][_0x6844('0xa5')]({'where':{'id':_0x2b0056[_0x6844('0xa1')]['id']}})[_0x6844('0x23')](handleEntityNotFound(_0x179a09,null))[_0x6844('0x23')](function(_0x3077de){if(_0x3077de){return _0x3077de[_0x6844('0xb0')](_0x2b0056[_0x6844('0xa4')][_0x6844('0xb1')],_[_0x6844('0xa9')](_0x2b0056['body'],[_0x6844('0xb1'),'id'])||{})[_0x6844('0xb2')](function(){return db[_0x6844('0xb3')][_0x6844('0xae')]({'attributes':['id',_0x6844('0x27'),_0x6844('0xb4')],'where':{'id':_0x2b0056['body']['ids']}});})[_0x6844('0x23')](function(_0x2eba16){socket['emit'](_0x6844('0xb5'),{'id':Number(_0x2b0056[_0x6844('0xa1')]['id']),'tags':_0x2eba16||[]});return{'id':Number(_0x2b0056['params']['id']),'tags':_0x2eba16||[]};});}})[_0x6844('0x23')](respondWithResult(_0x179a09,null))[_0x6844('0x2d')](handleError(_0x179a09,null));};exports[_0x6844('0xb6')]=function(_0x3dbd1c,_0x405609,_0x3b0461){return db[_0x6844('0x2f')][_0x6844('0xa5')]({'where':{'id':_0x3dbd1c['params']['id']}})[_0x6844('0x23')](handleEntityNotFound(_0x405609,null))[_0x6844('0x23')](function(_0x23aab4){if(_0x23aab4){return _0x23aab4['removeTags'](_0x3dbd1c[_0x6844('0x32')][_0x6844('0xb1')]);}})[_0x6844('0x23')](respondWithStatusCode(_0x405609,null))['catch'](handleError(_0x405609,null));};exports[_0x6844('0xb7')]=function(_0x513251,_0x1d9c3b){var _0x4f0238=moment()[_0x6844('0xb8')]()[_0x6844('0x79')]();var _0x2f39c6=path['join'](config['root'],_0x6844('0xb9'),'files',_0x6844('0xba'));var _0x5527d1=path['join'](config['root'],_0x6844('0xb9'),'files',_0x6844('0xbb'));var _0x1fe2dd=path['join'](_0x2f39c6,_0x4f0238);var _0x125e96=util[_0x6844('0x58')]('transcript-%d-%s.zip',_0x513251[_0x6844('0xa1')]['id'],_0x4f0238);var _0xf0d645=path[_0x6844('0x7a')](_0x2f39c6,_0x125e96);var _0x3e7c14=![];return db['OpenchannelInteraction']['find']({'where':{'id':_0x513251[_0x6844('0xa1')]['id']},'include':[{'model':db[_0x6844('0xa8')],'as':'Messages','attributes':['id',_0x6844('0xa4'),_0x6844('0xbc'),_0x6844('0xbd'),_0x6844('0xbe'),_0x6844('0x82')],'include':[{'model':db[_0x6844('0xbf')],'as':'User','attributes':['id',_0x6844('0xc0')],'raw':!![]},{'model':db[_0x6844('0xc1')],'as':_0x6844('0xc2'),'attributes':['id',_0x6844('0xc3'),_0x6844('0xc4')],'raw':!![]},{'model':db['Attachment'],'as':_0x6844('0xc5'),'raw':!![]}]},{'model':db[_0x6844('0xc6')],'as':_0x6844('0xc7'),'attributes':['id',_0x6844('0x27')]},{'model':db[_0x6844('0xbf')],'as':_0x6844('0xc8'),'attributes':['id',_0x6844('0xc0')]}]})['then'](handleEntityNotFound(_0x1d9c3b,null))['then'](function(_0x52da3f){if(_0x52da3f){var _0x201ad6=_0x52da3f[_0x6844('0xc9')]({'plain':!![]});_0x3e7c14=!![];var _0x4e2e8f={'format':'A4','border':_0x6844('0xca'),'header':{'height':_0x6844('0xcb'),'contents':{'first':_0x6844('0xcc')}},'footer':{'height':_0x6844('0xcd'),'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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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[_0x6844('0x58')]('%s\x20#%d','Openchannel',_0x201ad6['id']),moment()['format'](_0x6844('0xce'))['toString']())}}};fs[_0x6844('0xcf')](_0x1fe2dd);var _0xf4aca5={'channel':_0x6844('0xd0'),'account':_0x201ad6['Account'][_0x6844('0x27')],'agent':_0x201ad6[_0x6844('0xc8')]?_0x201ad6[_0x6844('0xc8')][_0x6844('0xc0')]:_0x6844('0xd1'),'createdAt':moment(_0x201ad6[_0x6844('0xbc')])[_0x6844('0x58')](_0x6844('0xac'))['toString'](),'closedAt':_0x201ad6[_0x6844('0xd2')]?moment(_0x201ad6['closedAt'])[_0x6844('0x58')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x201ad6[_0x6844('0xd3')],'visibility':_0x201ad6['threadId']?_0x6844('0xd4'):_0x6844('0xd5'),'messages':_(_0x201ad6['Messages'])['filter']({'secret':![]})[_0x6844('0x2a')](function(_0x3035a9){if(_0x3035a9[_0x6844('0xc5')]){var _0x1983b5=path[_0x6844('0x7a')](_0x5527d1,_0x3035a9[_0x6844('0xc5')][_0x6844('0xd6')]);if(fs[_0x6844('0xd7')](_0x1983b5)){fs['createReadStream'](_0x1983b5)[_0x6844('0xd8')](fs[_0x6844('0xd9')](path['join'](_0x1fe2dd,_0x3035a9[_0x6844('0xc5')][_0x6844('0xd6')])));}}return{'date':moment(_0x3035a9[_0x6844('0xbc')])['format'](_0x6844('0xac'))[_0x6844('0x79')](),'sender':_0x3035a9['direction']===_0x6844('0xda')?_0x3035a9[_0x6844('0xbf')]?_0x3035a9['User']['fullname']:_0x6844('0xdb'):_0x3035a9['Contact'][_0x6844('0xc3')]+(_0x3035a9[_0x6844('0xc2')][_0x6844('0xc4')]?'\x20'+_0x3035a9[_0x6844('0xc2')][_0x6844('0xc4')]:''),'body':_0x3035a9[_0x6844('0xc5')]?_0x3035a9[_0x6844('0xc5')]['basename']:_0x3035a9[_0x6844('0xa4')],'direction':_0x3035a9['direction']===_0x6844('0xda')?'A':'C','secret':_0x3035a9[_0x6844('0xbe')],'read':_0x3035a9['read'],'attachment':_0x3035a9[_0x6844('0xc5')]};})[_0x6844('0x54')]()};return ejs[_0x6844('0xdc')](path[_0x6844('0x7a')](config[_0x6844('0xdd')],_0x6844('0xb9'),'views',_0x6844('0xde')),{'interaction':_0xf4aca5})[_0x6844('0x23')](function(_0x1d7af3){return new BPromise(function(_0x1eb761,_0x433027){pdf[_0x6844('0xa3')](_0x1d7af3,_0x4e2e8f)[_0x6844('0xdf')](path[_0x6844('0x7a')](_0x1fe2dd,_0x6844('0xe0')+_0x201ad6['id']+'-'+_0x4f0238+_0x6844('0xe1')),function(_0x183bc3,_0x2c6a49){if(_0x183bc3)return _0x433027(_0x183bc3);_0x1eb761(_0x2c6a49);});});});}})[_0x6844('0x23')](function(){if(_0x3e7c14){return new BPromise(function(_0x1dd136,_0x32b261){zipdir(_0x1fe2dd,{'saveTo':_0xf0d645},function(_0x8eb3cc,_0xdb8b14){if(_0x8eb3cc)return _0x32b261(_0x8eb3cc);return _0x1dd136(_0xdb8b14);});})[_0x6844('0x23')](function(){return new BPromise(function(_0x5ba282,_0x418729){rimraf(_0x1fe2dd,function(_0x3ea6e4){if(_0x3ea6e4)_0x418729(_0x3ea6e4);return _0x5ba282();});});})['then'](function(){return _0x1d9c3b[_0x6844('0xb7')](_0xf0d645,_0x125e96,function(_0x52a501){if(_0x52a501){console['log'](_0x6844('0xe2'),_0x52a501);}else{fs[_0x6844('0xe3')](_0xf0d645);}});});}else{return _0x1d9c3b['sendStatus'](0xc8);}})[_0x6844('0x2d')](handleError(_0x1d9c3b,null));}; \ No newline at end of file +var _0x3aaa=['tools_tags','select','COUNT(*)','me.OpenchannelInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','ui.OpenchannelInteractionId','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','expr','advancedFilter','parse','value','dateStart','startOf','day','utc','format','endOf','isArray','condition','TagId','unreadMessages','length','and','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','ContactId','c.firstName','\x20LIKE\x20?','\x20>\x20?','\x20<\x20?','c.email','filter','isNil','isEmpty','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','join','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','DESC','group','QueryTypes','SELECT','clone','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','sequelize','toString','merge','a.mandatoryDisposition','i.*','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','rows','params','includeAll','include','options','find','create','body','describe','addMessage','getMessages','findOne','OpenchannelMessage','rawAttributes','findAll','addTags','setTags','ids','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','files','tmp','server','attachments','Messages','direction','secret','User','fullname','Contact','lastName','Attachment','OpenchannelAccount','Account','Owner','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\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\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','mkdirSync','N.A.','closed','threadId','Public','basename','createReadStream','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','System','firstName','views','transcript-','.pdf','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','catch','OpenchannelInteraction','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0x3aaa,0x9b));var _0xa3aa=function(_0x4b46fd,_0x172722){_0x4b46fd=_0x4b46fd-0x0;var _0x5e8a81=_0x3aaa[_0x4b46fd];return _0x5e8a81;};'use strict';var pdf=require(_0xa3aa('0x0'));var emlformat=require(_0xa3aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa3aa('0x2'));var jsonpatch=require(_0xa3aa('0x3'));var rp=require(_0xa3aa('0x4'));var moment=require(_0xa3aa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa3aa('0x6'));var util=require(_0xa3aa('0x7'));var path=require(_0xa3aa('0x8'));var sox=require(_0xa3aa('0x9'));var csv=require(_0xa3aa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa3aa('0xb'));var jsforce=require(_0xa3aa('0xc'));var deskjs=require(_0xa3aa('0xd'));var toCsv=require(_0xa3aa('0xa'));var querystring=require(_0xa3aa('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa3aa('0xf'));var qs=require(_0xa3aa('0x10'));var hardwareService=require(_0xa3aa('0x11'));var logger=require(_0xa3aa('0x12'))(_0xa3aa('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa3aa('0x14'))['db'];config[_0xa3aa('0x15')]=_[_0xa3aa('0x16')](config[_0xa3aa('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xa3aa('0x17'))(new Redis(config[_0xa3aa('0x15')]));require(_0xa3aa('0x18'))[_0xa3aa('0x19')](socket);function respondWithStatusCode(_0x5b3f56,_0x4b96d8){_0x4b96d8=_0x4b96d8||0xcc;return function(_0x16c33b){if(_0x16c33b){return _0x5b3f56[_0xa3aa('0x1a')](_0x4b96d8);}return _0x5b3f56[_0xa3aa('0x1b')](_0x4b96d8)['end']();};}function respondWithResult(_0x42ff87,_0x54f3aa){_0x54f3aa=_0x54f3aa||0xc8;return function(_0x2757b0){if(_0x2757b0){return _0x42ff87['status'](_0x54f3aa)[_0xa3aa('0x1c')](_0x2757b0);}};}function respondWithFilteredResult(_0x2db5c1,_0x1c76a2){return function(_0x421284){if(_0x421284){var _0x452a6d=_0x421284[_0xa3aa('0x1d')],_0x2833a5=_0x1c76a2[_0xa3aa('0x1e')],_0x3b16a8=_0x1c76a2[_0xa3aa('0x1e')]+_0x1c76a2[_0xa3aa('0x1f')],_0x1420f5;if(_0x3b16a8>=_0x452a6d){_0x3b16a8=_0x452a6d;_0x1420f5=0xc8;}else{_0x1420f5=0xce;}_0x2db5c1[_0xa3aa('0x1b')](_0x1420f5);return _0x2db5c1['set'](_0xa3aa('0x20'),_0x2833a5+'-'+_0x3b16a8+'/'+_0x452a6d)['json'](_0x421284);}return null;};}function patchUpdates(_0x594c2e){return function(_0xf6b384){try{jsonpatch[_0xa3aa('0x21')](_0xf6b384,_0x594c2e,!![]);}catch(_0x215145){return BPromise[_0xa3aa('0x22')](_0x215145);}return _0xf6b384[_0xa3aa('0x23')]();};}function saveUpdates(_0x1f671f,_0x53d815){return function(_0x594929){if(_0x594929){return _0x594929[_0xa3aa('0x24')](_0x1f671f)['then'](function(_0x421c21){return _0x421c21;});}return null;};}function removeEntity(_0xb570f2,_0x1dddbf){return function(_0x159357){if(_0x159357){return _0x159357['destroy']()[_0xa3aa('0x25')](function(){_0xb570f2['status'](0xcc)[_0xa3aa('0x26')]();});}};}function handleEntityNotFound(_0x5620dc,_0x39c0ab){return function(_0x909886){if(!_0x909886){_0x5620dc[_0xa3aa('0x1a')](0x194);}return _0x909886;};}function handleError(_0xc7eeb6,_0x42cd67){_0x42cd67=_0x42cd67||0x1f4;return function(_0x1e1658){logger[_0xa3aa('0x27')](_0x1e1658[_0xa3aa('0x28')]);if(_0x1e1658[_0xa3aa('0x29')]){delete _0x1e1658[_0xa3aa('0x29')];}_0xc7eeb6[_0xa3aa('0x1b')](_0x42cd67)[_0xa3aa('0x2a')](_0x1e1658);};}function getInteractionUsers(_0x478cd2,_0x37a6d2){return new BPromise(function(_0x957102,_0x5f3423){try{if(_0x37a6d2[_0x478cd2['id']]){_0x478cd2[_0xa3aa('0x2b')]=_[_0xa3aa('0x2c')](_0x37a6d2[_0x478cd2['id']],function(_0x4d00af){return{'id':_0x4d00af['id']};});}}catch(_0x215906){_0x5f3423(_0x215906);}_0x957102(_0x478cd2);});}function getInteractionTags(_0x29aa1b,_0x251e09){return new BPromise(function(_0x1db8e3,_0x534d85){try{if(_0x29aa1b[_0xa3aa('0x2d')]){_0x29aa1b['Tags']=[];_0x29aa1b[_0xa3aa('0x2d')][_0xa3aa('0x2e')](',')[_0xa3aa('0x2f')](function(_0x21356c){_0x29aa1b[_0xa3aa('0x30')][_0xa3aa('0x31')](_0x251e09[_0x21356c]);});}delete _0x29aa1b[_0xa3aa('0x2d')];}catch(_0x37a574){_0x534d85(_0x37a574);}_0x1db8e3(_0x29aa1b);});}function updateOpenchannelInteraction(_0x19323d,_0x3e9a45,_0x37cd0a){return new BPromise(function(_0x2e48e3,_0x5b59cb){return getInteractionUsers(_0x19323d,_0x37cd0a)[_0xa3aa('0x25')](function(_0x468a68){return getInteractionTags(_0x468a68,_0x3e9a45);})[_0xa3aa('0x25')](function(_0x533941){_0x2e48e3(_0x533941);})[_0xa3aa('0x32')](function(_0x2f0ac1){_0x5b59cb(_0x2f0ac1);});});}exports['index']=function(_0x3d246d,_0x31bb8d){var _0x16ed96={},_0x90a278={},_0x420020={'count':0x0,'rows':[]};var _0x56fa10=db[_0xa3aa('0x33')]['rawAttributes'];_0x90a278[_0xa3aa('0x34')]=_[_0xa3aa('0x35')](_0x56fa10);_0x90a278[_0xa3aa('0x36')]=_[_0xa3aa('0x35')](_0x3d246d[_0xa3aa('0x36')]);_0x90a278[_0xa3aa('0x37')]=_[_0xa3aa('0x38')](_0x90a278[_0xa3aa('0x34')],_0x90a278[_0xa3aa('0x36')]);_0x16ed96[_0xa3aa('0x39')]=_['intersection'](_0x90a278[_0xa3aa('0x34')],qs[_0xa3aa('0x3a')](_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x3a')]));_0x16ed96[_0xa3aa('0x39')]=_0x16ed96[_0xa3aa('0x39')]['length']?_0x16ed96['attributes']:_0x90a278['model'];if(!_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x3b')](_0xa3aa('0x3c'))){_0x16ed96['limit']=qs[_0xa3aa('0x1f')](_0x3d246d['query']['limit']);_0x16ed96[_0xa3aa('0x1e')]=qs['offset'](_0x3d246d['query']['offset']);}_0x16ed96[_0xa3aa('0x3d')]=qs[_0xa3aa('0x3e')](_0x3d246d[_0xa3aa('0x36')]['sort']);_0x16ed96[_0xa3aa('0x3f')]=qs[_0xa3aa('0x37')](_[_0xa3aa('0x40')](_0x3d246d[_0xa3aa('0x36')],_0x90a278[_0xa3aa('0x37')]));var _0x5e583b=[];var _0x178b17=squel['select']()[_0xa3aa('0x41')]('id')[_0xa3aa('0x41')](_0xa3aa('0x29'))['field'](_0xa3aa('0x42'))[_0xa3aa('0x43')](_0xa3aa('0x44'));var _0x54e28d=squel[_0xa3aa('0x45')]()[_0xa3aa('0x41')](_0xa3aa('0x46'))['from']('openchannel_messages','me')[_0xa3aa('0x3f')](_0xa3aa('0x47'))[_0xa3aa('0x3f')](_0xa3aa('0x48'))['where'](_0xa3aa('0x49'));var _0x13da7d=squel[_0xa3aa('0x45')]()[_0xa3aa('0x41')](_0xa3aa('0x4a'))['field'](_0xa3aa('0x4b'))[_0xa3aa('0x43')]('user_has_openchannel_interactions','ui')[_0xa3aa('0x4c')](_0xa3aa('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x47106d=squel[_0xa3aa('0x45')]()[_0xa3aa('0x43')](_0xa3aa('0x4e'),'i')['left_join'](_0xa3aa('0x4f'),'c',_0xa3aa('0x50'))['left_join']('users','o',_0xa3aa('0x51'))[_0xa3aa('0x4c')](_0xa3aa('0x52'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xa3aa('0x4c')](_0xa3aa('0x53'),'me','me.OpenchannelInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false');var _0x490e3a=squel[_0xa3aa('0x54')]();if(_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x55')]){var _0xd41a9e=JSON[_0xa3aa('0x56')](_0x3d246d[_0xa3aa('0x36')]['advancedFilter']);_[_0xa3aa('0x35')](_0xd41a9e)['forEach'](function(_0x5c2bbf){var _0x1168e6=_0xd41a9e[_0x5c2bbf];if(_0x5c2bbf==='createdAt'){var _0x226f69=moment(_0x1168e6[_0xa3aa('0x57')][_0xa3aa('0x58')])[_0xa3aa('0x59')](_0xa3aa('0x5a'))[_0xa3aa('0x5b')]()[_0xa3aa('0x5c')]();var _0x3b51af=moment(_0x3b51af)['utc']()[_0xa3aa('0x5d')](_0xa3aa('0x5a'))[_0xa3aa('0x5c')]();_0x490e3a['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x226f69,_0x3b51af);}else{if(_[_0xa3aa('0x5e')](_0x1168e6[_0xa3aa('0x5f')])){_0x1168e6['condition'][_0xa3aa('0x2f')](function(_0x694edd){switch(_0x1168e6[_0xa3aa('0x5f')][_0xa3aa('0x57')]){case'IS':if(_0x5c2bbf!==_0xa3aa('0x60')&&_0x5c2bbf!==_0xa3aa('0x61')){if(_['isArray'](_0x1168e6[_0xa3aa('0x57')])&&_0x1168e6[_0xa3aa('0x57')][_0xa3aa('0x62')]>0x1){_0x490e3a[_0xa3aa('0x63')](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+_0xa3aa('0x65'),_0x1168e6[_0xa3aa('0x57')]);}else{_0x490e3a['and'](_0x1168e6['tableAlias']+'.'+_0x5c2bbf+_0xa3aa('0x66'),_0x1168e6[_0xa3aa('0x57')][0x0]);}}break;case'=':_0x490e3a[_0xa3aa('0x63')](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+_0xa3aa('0x66'),_0x1168e6[_0xa3aa('0x57')]);break;case _0xa3aa('0x67'):if(_0x5c2bbf===_0xa3aa('0x68')){_0x490e3a[_0xa3aa('0x63')](_0xa3aa('0x69')+'\x20LIKE\x20?','%'+_0x1168e6[_0xa3aa('0x57')]+'%');_0x490e3a['or']('c.lastName'+_0xa3aa('0x6a'),'%'+_0x1168e6[_0xa3aa('0x57')]+'%');_0x490e3a['or']('c.email'+_0xa3aa('0x6a'),'%'+_0x1168e6['value']+'%');}else{_0x490e3a['and'](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+_0xa3aa('0x6a'),'%'+_0x1168e6[_0xa3aa('0x57')]+'%');}break;case'>':_0x490e3a[_0xa3aa('0x63')](_0x1168e6['tableAlias']+'.'+_0x5c2bbf+_0xa3aa('0x6b'),_0x1168e6['value']);break;case'<':_0x490e3a[_0xa3aa('0x63')](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+_0xa3aa('0x6c'),_0x1168e6[_0xa3aa('0x57')]);break;}});}else{switch(_0x1168e6[_0xa3aa('0x5f')][_0xa3aa('0x57')]){case'IS':if(_0x5c2bbf!==_0xa3aa('0x60')&&_0x5c2bbf!==_0xa3aa('0x61')){if(_['isArray'](_0x1168e6[_0xa3aa('0x57')])&&_0x1168e6[_0xa3aa('0x57')][_0xa3aa('0x62')]>0x1){_0x490e3a['and'](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+_0xa3aa('0x65'),_0x1168e6[_0xa3aa('0x57')]);}else{_0x490e3a['and'](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+'\x20=\x20?',_0x1168e6[_0xa3aa('0x57')][0x0]);}}break;case'=':_0x490e3a[_0xa3aa('0x63')](_0x1168e6['tableAlias']+'.'+_0x5c2bbf+_0xa3aa('0x66'),_0x1168e6['value']);break;case _0xa3aa('0x67'):if(_0x5c2bbf===_0xa3aa('0x68')){_0x490e3a[_0xa3aa('0x63')](_0xa3aa('0x69')+'\x20LIKE\x20?','%'+_0x1168e6[_0xa3aa('0x57')]+'%');_0x490e3a['or']('c.lastName'+_0xa3aa('0x6a'),'%'+_0x1168e6['value']+'%');_0x490e3a['or'](_0xa3aa('0x6d')+_0xa3aa('0x6a'),'%'+_0x1168e6[_0xa3aa('0x57')]+'%');}else{_0x490e3a[_0xa3aa('0x63')](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+_0xa3aa('0x6a'),'%'+_0x1168e6[_0xa3aa('0x57')]+'%');}break;case'>':_0x490e3a[_0xa3aa('0x63')](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+_0xa3aa('0x6b'),_0x1168e6[_0xa3aa('0x57')]);break;case'<':_0x490e3a[_0xa3aa('0x63')](_0x1168e6[_0xa3aa('0x64')]+'.'+_0x5c2bbf+_0xa3aa('0x6c'),_0x1168e6['value']);break;}}}});}else{var _0x27f3b5=_(Object['keys'](_0x3d246d['query']))[_0xa3aa('0x2c')](function(_0x28a098){return _0x56fa10[_0xa3aa('0x3b')](_0x28a098)?_0x28a098:undefined;})[_0xa3aa('0x6e')](function(_0x401b67){return!_[_0xa3aa('0x6f')](_0x401b67);})[_0xa3aa('0x57')]();if(!_[_0xa3aa('0x70')](_0x27f3b5)){_0x27f3b5['forEach'](function(_0x21acfb){if(_0x21acfb==='OpenchannelAccountId'){_0x47106d[_0xa3aa('0x3f')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x3d246d['query'][_0x21acfb]));}else if(_0x21acfb===_0xa3aa('0x71')){var _0x1d7f79=JSON[_0xa3aa('0x56')](_0x3d246d[_0xa3aa('0x36')][_0x21acfb])[_0xa3aa('0x72')];var _0x3a556f=JSON[_0xa3aa('0x56')](_0x3d246d['query'][_0x21acfb])[_0xa3aa('0x73')];_0x47106d['where'](_0xa3aa('0x74'),_0x1d7f79,_0x3a556f);}else{if(_0x3d246d[_0xa3aa('0x36')][_0x21acfb]==='null'){_0x47106d[_0xa3aa('0x3f')]('i.'+_0x21acfb+_0xa3aa('0x75'));}else{_0x47106d[_0xa3aa('0x3f')]('i.'+_0x21acfb+_0xa3aa('0x66'),_0x3d246d['query'][_0x21acfb]);}}});}if(_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x6e')]){var _0x518d44=_0x3d246d[_0xa3aa('0x36')]['filter'][_0xa3aa('0x76')]('\x5c','\x5c\x5c')[_0xa3aa('0x76')]('\x27\x27',_0xa3aa('0x77'));if(qs[_0xa3aa('0x78')](_0x518d44)){_0x490e3a['or'](_0xa3aa('0x79'),_0x518d44+'%');}else{var _0x1b1158=[];_0x518d44[_0xa3aa('0x2e')]('\x20')['forEach'](function(_0x3d45f9){_0x1b1158['push']('+'+_0x3d45f9['toString']());});var _0x508752=_0x1b1158[_0xa3aa('0x7a')]('\x20');_0x490e3a['or'](_0xa3aa('0x7b'),_0x508752)['or']('i.from\x20LIKE\x20?',_0x518d44+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x518d44+'%');}}}_0x47106d[_0xa3aa('0x3f')](_0x490e3a);if(_0x16ed96[_0xa3aa('0x3d')]){_0x16ed96['order']['forEach'](function(_0x190d9f){_0x47106d[_0xa3aa('0x3d')]('i.'+_0x190d9f[0x0],_0x190d9f[0x1]===_0xa3aa('0x7c')?![]:!![]);});}_0x47106d[_0xa3aa('0x7d')]('i.id');var _0x4471c5={'type':db['Sequelize'][_0xa3aa('0x7e')][_0xa3aa('0x7f')],'raw':!![]};var _0x2827d2=_0x47106d[_0xa3aa('0x80')]()['field'](_0xa3aa('0x46'))[_0xa3aa('0x41')]('COUNT(me.id)',_0xa3aa('0x61'));if(!_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x55')]){if(_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x81')]){if(_0x3d246d['query'][_0xa3aa('0x81')]==0x1){_0x2827d2[_0xa3aa('0x82')](_0xa3aa('0x83'));_0x47106d[_0xa3aa('0x82')](_0xa3aa('0x83'));}else{_0x2827d2[_0xa3aa('0x82')](_0xa3aa('0x84'));_0x47106d[_0xa3aa('0x82')](_0xa3aa('0x84'));}}if(_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x85')]){var _0x29decb=_[_0xa3aa('0x5e')](_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x85')])?_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x85')]:new Array(_0x3d246d['query'][_0xa3aa('0x85')]);var _0x5c8fb3=squel[_0xa3aa('0x54')]();_0x29decb[_0xa3aa('0x2f')](function(_0x1ffa36){_0x5c8fb3['or'](_0xa3aa('0x86'),'%,'+_0x1ffa36+',%');});_0x47106d['having'](_0x5c8fb3);_0x2827d2['left_join'](_0xa3aa('0x87'),'it',_0xa3aa('0x88'));_0x2827d2['left_join'](_0xa3aa('0x44'),'t',_0xa3aa('0x89'));_0x2827d2[_0xa3aa('0x3f')](_0xa3aa('0x8a'),_0x29decb);}}else{var _0xd41a9e=JSON[_0xa3aa('0x56')](_0x3d246d[_0xa3aa('0x36')][_0xa3aa('0x55')]);_[_0xa3aa('0x35')](_0xd41a9e)[_0xa3aa('0x2f')](function(_0x4eb745){var _0x58c867=_0xd41a9e[_0x4eb745];if(_0x4eb745===_0xa3aa('0x60')){var _0x19bf0b=_0x58c867[_0xa3aa('0x57')];var _0x76e733=squel[_0xa3aa('0x54')]();_0x19bf0b[_0xa3aa('0x2f')](function(_0x5c80b6){_0x76e733['or'](_0xa3aa('0x86'),'%,'+_0x5c80b6+',%');});_0x47106d['having'](_0x76e733);_0x2827d2[_0xa3aa('0x4c')](_0xa3aa('0x8b'),'it',_0xa3aa('0x8c'));_0x2827d2['left_join'](_0xa3aa('0x44'),'t','t.id\x20=\x20it.TagId');_0x2827d2[_0xa3aa('0x3f')]('t.id\x20IN\x20?',_0x19bf0b);}else if(_0x4eb745===_0xa3aa('0x61')){if(_0x58c867[_0xa3aa('0x57')]['length']===0x1){if(_0x58c867['value'][0x0]===0x1){_0x2827d2[_0xa3aa('0x82')](_0xa3aa('0x83'));_0x47106d[_0xa3aa('0x82')]('`unreadMessages`\x20=\x200');}else{_0x2827d2[_0xa3aa('0x82')](_0xa3aa('0x84'));_0x47106d[_0xa3aa('0x82')](_0xa3aa('0x84'));}}}});}db[_0xa3aa('0x8d')][_0xa3aa('0x36')](_0x2827d2[_0xa3aa('0x8e')](),_0x4471c5)[_0xa3aa('0x25')](function(_0x55f514){_0x420020[_0xa3aa('0x1d')]=_0x55f514['length'];if(_0x420020[_0xa3aa('0x1d')]===0x0)return[];return db[_0xa3aa('0x8d')]['query'](_0x178b17[_0xa3aa('0x8e')](),_0x4471c5)[_0xa3aa('0x25')](function(_0x1c258b){_0x5e583b=_['keyBy'](_0x1c258b,'id');_0x4471c5=_[_0xa3aa('0x8f')](_0x4471c5,{'model':db[_0xa3aa('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x47106d[_0xa3aa('0x41')]('COUNT(me.id)','unreadMessages');_0x47106d[_0xa3aa('0x41')]('a.key','Account.key');_0x47106d[_0xa3aa('0x41')](_0xa3aa('0x90'),'Account.mandatoryDisposition');_0x47106d['field'](_0xa3aa('0x91'));_0x47106d['field']('c.firstName','Contact.firstName');_0x47106d['field'](_0xa3aa('0x92'),_0xa3aa('0x93'));_0x47106d[_0xa3aa('0x41')](_0xa3aa('0x6d'),_0xa3aa('0x94'));_0x47106d[_0xa3aa('0x41')](_0xa3aa('0x95'),_0xa3aa('0x96'));_0x47106d['field']('c.mobile',_0xa3aa('0x97'));_0x47106d[_0xa3aa('0x41')](_0xa3aa('0x98'),_0xa3aa('0x99'));_0x47106d['field'](_0xa3aa('0x9a'),_0xa3aa('0x2d'));_0x47106d[_0xa3aa('0x4c')]('openchannel_interaction_has_tags','it',_0xa3aa('0x88'));_0x47106d[_0xa3aa('0x4c')](_0xa3aa('0x44'),'t',_0xa3aa('0x89'));_0x47106d['limit'](_0x16ed96[_0xa3aa('0x1f')]);_0x47106d['offset'](_0x16ed96[_0xa3aa('0x1e')]);return db['sequelize'][_0xa3aa('0x36')](_0x47106d['toString'](),_0x4471c5);})[_0xa3aa('0x25')](function(_0x175b48){_0x13da7d['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xa3aa('0x2c')](_0x175b48,'id'));return db[_0xa3aa('0x8d')][_0xa3aa('0x36')](_0x13da7d['toString'](),_0x4471c5)[_0xa3aa('0x25')](function(_0x3c5430){var _0x5ad617=_[_0xa3aa('0x9b')](_0x3c5430,_0xa3aa('0x9c'));var _0x277439=[];_0x175b48[_0xa3aa('0x2f')](function(_0x39e1bf){_0x277439['push'](updateOpenchannelInteraction(_0x39e1bf,_0x5e583b,_0x5ad617));});return BPromise[_0xa3aa('0x9d')](_0x277439);});});})['then'](function(_0x31de20){_0x420020[_0xa3aa('0x9e')]=_0x31de20;return _0x420020;})[_0xa3aa('0x25')](respondWithFilteredResult(_0x31bb8d,_0x16ed96))['catch'](handleError(_0x31bb8d,null));};exports['show']=function(_0x363a30,_0x5d5b82){var _0x43eb0f={'raw':![],'where':{'id':_0x363a30[_0xa3aa('0x9f')]['id']}},_0x565c1f={};_0x565c1f[_0xa3aa('0x34')]=_[_0xa3aa('0x35')](db[_0xa3aa('0x33')]['rawAttributes']);_0x565c1f[_0xa3aa('0x36')]=_[_0xa3aa('0x35')](_0x363a30[_0xa3aa('0x36')]);_0x565c1f[_0xa3aa('0x37')]=_[_0xa3aa('0x38')](_0x565c1f[_0xa3aa('0x34')],_0x565c1f[_0xa3aa('0x36')]);_0x43eb0f[_0xa3aa('0x39')]=_[_0xa3aa('0x38')](_0x565c1f['model'],qs[_0xa3aa('0x3a')](_0x363a30[_0xa3aa('0x36')]['fields']));_0x43eb0f[_0xa3aa('0x39')]=_0x43eb0f[_0xa3aa('0x39')][_0xa3aa('0x62')]?_0x43eb0f['attributes']:_0x565c1f['model'];if(_0x363a30['query'][_0xa3aa('0xa0')]){_0x43eb0f[_0xa3aa('0xa1')]=[{'all':!![]}];}_0x43eb0f=_[_0xa3aa('0x8f')]({},_0x43eb0f,_0x363a30[_0xa3aa('0xa2')]);return db[_0xa3aa('0x33')][_0xa3aa('0xa3')](_0x43eb0f)[_0xa3aa('0x25')](handleEntityNotFound(_0x5d5b82,null))[_0xa3aa('0x25')](respondWithResult(_0x5d5b82,null))['catch'](handleError(_0x5d5b82,null));};exports[_0xa3aa('0xa4')]=function(_0x38b03c,_0x490d53){return db[_0xa3aa('0x33')][_0xa3aa('0xa4')](_0x38b03c[_0xa3aa('0xa5')],{})['then'](respondWithResult(_0x490d53,0xc9))[_0xa3aa('0x32')](handleError(_0x490d53,null));};exports['update']=function(_0x376099,_0x31c530){if(_0x376099[_0xa3aa('0xa5')]['id']){delete _0x376099[_0xa3aa('0xa5')]['id'];}return db[_0xa3aa('0x33')][_0xa3aa('0xa3')]({'where':{'id':_0x376099[_0xa3aa('0x9f')]['id']}})[_0xa3aa('0x25')](handleEntityNotFound(_0x31c530,null))[_0xa3aa('0x25')](saveUpdates(_0x376099[_0xa3aa('0xa5')],null))[_0xa3aa('0x25')](respondWithResult(_0x31c530,null))[_0xa3aa('0x32')](handleError(_0x31c530,null));};exports['destroy']=function(_0x3b5bd8,_0x47e795){return db[_0xa3aa('0x33')][_0xa3aa('0xa3')]({'where':{'id':_0x3b5bd8['params']['id']}})[_0xa3aa('0x25')](handleEntityNotFound(_0x47e795,null))[_0xa3aa('0x25')](removeEntity(_0x47e795,null))[_0xa3aa('0x32')](handleError(_0x47e795,null));};exports[_0xa3aa('0xa6')]=function(_0x437b61,_0x238734){return db[_0xa3aa('0x33')][_0xa3aa('0xa6')]()[_0xa3aa('0x25')](respondWithResult(_0x238734,null))[_0xa3aa('0x32')](handleError(_0x238734,null));};exports[_0xa3aa('0xa7')]=function(_0x123ad4,_0x3d8eb5,_0x58bb79){return db['OpenchannelMessage']['find']({'where':{'id':_0x123ad4[_0xa3aa('0x9f')]['id']}})[_0xa3aa('0x25')](handleEntityNotFound(_0x3d8eb5,null))[_0xa3aa('0x25')](function(_0x20d30b){if(_0x20d30b){return _0x20d30b['addMessage'](_0x123ad4[_0xa3aa('0xa5')]['ids'],_['omit'](_0x123ad4[_0xa3aa('0xa5')],['ids','id'])||{});}})['then'](respondWithResult(_0x3d8eb5,null))[_0xa3aa('0x32')](handleError(_0x3d8eb5,null));};exports[_0xa3aa('0xa8')]=function(_0x28d00f,_0x332770,_0x691c0e){var _0x49986e={'raw':![],'where':{}};var _0x333540={};var _0x30bdbc={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xa3aa('0xa9')]({'where':{'id':_0x28d00f['params']['id']}})['then'](handleEntityNotFound(_0x332770,null))[_0xa3aa('0x25')](function(_0x1accfd){if(_0x1accfd){_0x333540[_0xa3aa('0x34')]=_[_0xa3aa('0x35')](db[_0xa3aa('0xaa')][_0xa3aa('0xab')]);_0x333540[_0xa3aa('0x36')]=_[_0xa3aa('0x35')](_0x28d00f[_0xa3aa('0x36')]);_0x333540[_0xa3aa('0x37')]=_[_0xa3aa('0x38')](_0x333540['model'],_0x333540[_0xa3aa('0x36')]);_0x49986e[_0xa3aa('0x39')]=_[_0xa3aa('0x38')](_0x333540['model'],qs[_0xa3aa('0x3a')](_0x28d00f['query'][_0xa3aa('0x3a')]));_0x49986e[_0xa3aa('0x39')]=_0x49986e[_0xa3aa('0x39')][_0xa3aa('0x62')]?_0x49986e[_0xa3aa('0x39')]:_0x333540['model'];if(!_0x28d00f[_0xa3aa('0x36')][_0xa3aa('0x3b')](_0xa3aa('0x3c'))){_0x49986e[_0xa3aa('0x1f')]=qs[_0xa3aa('0x1f')](_0x28d00f[_0xa3aa('0x36')]['limit']);_0x49986e[_0xa3aa('0x1e')]=qs['offset'](_0x28d00f[_0xa3aa('0x36')][_0xa3aa('0x1e')]);}_0x49986e[_0xa3aa('0x3d')]=qs[_0xa3aa('0x3e')](_0x28d00f['query']['sort']);_0x49986e[_0xa3aa('0x3f')]=qs[_0xa3aa('0x37')](_['pick'](_0x28d00f[_0xa3aa('0x36')],_0x333540[_0xa3aa('0x37')]));_0x49986e[_0xa3aa('0x3f')][_0xa3aa('0x9c')]=_0x1accfd['id'];if(_0x28d00f['query'][_0xa3aa('0x6e')]){_0x49986e[_0xa3aa('0x3f')]=_[_0xa3aa('0x8f')](_0x49986e[_0xa3aa('0x3f')],{'$or':_[_0xa3aa('0x2c')](_0x49986e[_0xa3aa('0x39')],function(_0x2f1e92){var _0xee0d17={};_0xee0d17[_0x2f1e92]={'$like':'%'+_0x28d00f[_0xa3aa('0x36')][_0xa3aa('0x6e')]+'%'};return _0xee0d17;})});}if(_0x28d00f[_0xa3aa('0x36')][_0xa3aa('0x72')]){var _0x8098ca=_0x28d00f[_0xa3aa('0x36')]['$gte'][_0xa3aa('0x2e')](',');var _0x382935={};_0x382935[_0x8098ca[0x0]]={'$gte':moment(_0x8098ca[0x1])[_0xa3aa('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49986e[_0xa3aa('0x3f')]=_[_0xa3aa('0x8f')](_0x49986e[_0xa3aa('0x3f')],_0x382935);}_0x49986e=_[_0xa3aa('0x8f')]({},_0x49986e,_0x28d00f['options']);return db['OpenchannelMessage']['count']({'where':_0x49986e[_0xa3aa('0x3f')]})[_0xa3aa('0x25')](function(_0x542e46){_0x30bdbc[_0xa3aa('0x1d')]=_0x542e46;if(_0x28d00f[_0xa3aa('0x36')][_0xa3aa('0xa0')]){_0x49986e[_0xa3aa('0xa1')]=[{'all':!![]}];}return db[_0xa3aa('0xaa')][_0xa3aa('0xac')](_0x49986e);})[_0xa3aa('0x25')](function(_0x397f56){_0x30bdbc[_0xa3aa('0x9e')]=_0x397f56;return _0x30bdbc;});}})['then'](respondWithFilteredResult(_0x332770,_0x49986e))[_0xa3aa('0x32')](handleError(_0x332770,null));};exports[_0xa3aa('0xad')]=function(_0x5494fe,_0xa02ff2,_0x42aa24){return db[_0xa3aa('0x33')][_0xa3aa('0xa3')]({'where':{'id':_0x5494fe['params']['id']}})[_0xa3aa('0x25')](handleEntityNotFound(_0xa02ff2,null))['then'](function(_0x45c658){if(_0x45c658){return _0x45c658[_0xa3aa('0xae')](_0x5494fe[_0xa3aa('0xa5')][_0xa3aa('0xaf')],_[_0xa3aa('0xb0')](_0x5494fe['body'],[_0xa3aa('0xaf'),'id'])||{})[_0xa3aa('0xb1')](function(){return db['Tag'][_0xa3aa('0xac')]({'attributes':['id','name',_0xa3aa('0x42')],'where':{'id':_0x5494fe[_0xa3aa('0xa5')][_0xa3aa('0xaf')]}});})[_0xa3aa('0x25')](function(_0x437ee9){socket[_0xa3aa('0xb2')](_0xa3aa('0xb3'),{'id':Number(_0x5494fe[_0xa3aa('0x9f')]['id']),'tags':_0x437ee9||[]});return{'id':Number(_0x5494fe[_0xa3aa('0x9f')]['id']),'tags':_0x437ee9||[]};});}})[_0xa3aa('0x25')](respondWithResult(_0xa02ff2,null))[_0xa3aa('0x32')](handleError(_0xa02ff2,null));};exports[_0xa3aa('0xb4')]=function(_0x14c3de,_0x572f88,_0x2b9e49){return db[_0xa3aa('0x33')][_0xa3aa('0xa3')]({'where':{'id':_0x14c3de[_0xa3aa('0x9f')]['id']}})['then'](handleEntityNotFound(_0x572f88,null))['then'](function(_0x17f187){if(_0x17f187){return _0x17f187['removeTags'](_0x14c3de[_0xa3aa('0x36')][_0xa3aa('0xaf')]);}})[_0xa3aa('0x25')](respondWithStatusCode(_0x572f88,null))['catch'](handleError(_0x572f88,null));};exports[_0xa3aa('0xb5')]=function(_0x5738d3,_0x22413d){var _0x732637=moment()[_0xa3aa('0xb6')]()[_0xa3aa('0x8e')]();var _0x11dfe6=path[_0xa3aa('0x7a')](config[_0xa3aa('0xb7')],'server',_0xa3aa('0xb8'),_0xa3aa('0xb9'));var _0x3822b5=path[_0xa3aa('0x7a')](config[_0xa3aa('0xb7')],_0xa3aa('0xba'),'files',_0xa3aa('0xbb'));var _0x2ea898=path[_0xa3aa('0x7a')](_0x11dfe6,_0x732637);var _0x129228=util[_0xa3aa('0x5c')]('transcript-%d-%s.zip',_0x5738d3[_0xa3aa('0x9f')]['id'],_0x732637);var _0x1423e5=path[_0xa3aa('0x7a')](_0x11dfe6,_0x129228);var _0x236946=![];return db['OpenchannelInteraction'][_0xa3aa('0xa3')]({'where':{'id':_0x5738d3[_0xa3aa('0x9f')]['id']},'include':[{'model':db[_0xa3aa('0xaa')],'as':_0xa3aa('0xbc'),'attributes':['id',_0xa3aa('0xa5'),_0xa3aa('0x71'),_0xa3aa('0xbd'),_0xa3aa('0xbe'),_0xa3aa('0x81')],'include':[{'model':db[_0xa3aa('0xbf')],'as':'User','attributes':['id',_0xa3aa('0xc0')],'raw':!![]},{'model':db['CmContact'],'as':_0xa3aa('0xc1'),'attributes':['id','firstName',_0xa3aa('0xc2')],'raw':!![]},{'model':db[_0xa3aa('0xc3')],'as':_0xa3aa('0xc3'),'raw':!![]}]},{'model':db[_0xa3aa('0xc4')],'as':_0xa3aa('0xc5'),'attributes':['id',_0xa3aa('0x29')]},{'model':db[_0xa3aa('0xbf')],'as':_0xa3aa('0xc6'),'attributes':['id',_0xa3aa('0xc0')]}]})['then'](handleEntityNotFound(_0x22413d,null))[_0xa3aa('0x25')](function(_0x10b6c0){if(_0x10b6c0){var _0x148255=_0x10b6c0['get']({'plain':!![]});_0x236946=!![];var _0x80c801={'format':'A4','border':_0xa3aa('0xc7'),'header':{'height':_0xa3aa('0xc8'),'contents':{'first':_0xa3aa('0xc9')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xa3aa('0xca'),util[_0xa3aa('0x5c')](_0xa3aa('0xcb'),_0xa3aa('0xcc'),_0x148255['id']),moment()['format'](_0xa3aa('0xcd'))['toString']())}}};fs[_0xa3aa('0xce')](_0x2ea898);var _0x1e002f={'channel':_0xa3aa('0xcc'),'account':_0x148255[_0xa3aa('0xc5')][_0xa3aa('0x29')],'agent':_0x148255[_0xa3aa('0xc6')]?_0x148255[_0xa3aa('0xc6')][_0xa3aa('0xc0')]:_0xa3aa('0xcf'),'createdAt':moment(_0x148255['createdAt'])[_0xa3aa('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa3aa('0x8e')](),'closedAt':_0x148255[_0xa3aa('0xd0')]?moment(_0x148255['closedAt'])[_0xa3aa('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa3aa('0x8e')]():'','disposition':_0x148255['disposition'],'visibility':_0x148255[_0xa3aa('0xd1')]?_0xa3aa('0xd2'):'Private','messages':_(_0x148255[_0xa3aa('0xbc')])[_0xa3aa('0x6e')]({'secret':![]})[_0xa3aa('0x2c')](function(_0x216fbf){if(_0x216fbf[_0xa3aa('0xc3')]){var _0x4d0140=path[_0xa3aa('0x7a')](_0x3822b5,_0x216fbf['Attachment'][_0xa3aa('0xd3')]);if(fs['existsSync'](_0x4d0140)){fs[_0xa3aa('0xd4')](_0x4d0140)['pipe'](fs[_0xa3aa('0xd5')](path['join'](_0x2ea898,_0x216fbf[_0xa3aa('0xc3')][_0xa3aa('0xd3')])));}}return{'date':moment(_0x216fbf['createdAt'])['format'](_0xa3aa('0xd6'))[_0xa3aa('0x8e')](),'sender':_0x216fbf[_0xa3aa('0xbd')]===_0xa3aa('0xd7')?_0x216fbf[_0xa3aa('0xbf')]?_0x216fbf['User'][_0xa3aa('0xc0')]:_0xa3aa('0xd8'):_0x216fbf[_0xa3aa('0xc1')][_0xa3aa('0xd9')]+(_0x216fbf[_0xa3aa('0xc1')][_0xa3aa('0xc2')]?'\x20'+_0x216fbf['Contact'][_0xa3aa('0xc2')]:''),'body':_0x216fbf[_0xa3aa('0xc3')]?_0x216fbf[_0xa3aa('0xc3')][_0xa3aa('0xd3')]:_0x216fbf[_0xa3aa('0xa5')],'direction':_0x216fbf['direction']==='out'?'A':'C','secret':_0x216fbf[_0xa3aa('0xbe')],'read':_0x216fbf[_0xa3aa('0x81')],'attachment':_0x216fbf['Attachment']};})['value']()};return ejs['renderFile'](path[_0xa3aa('0x7a')](config['root'],'server',_0xa3aa('0xda'),'downloadInteraction.html'),{'interaction':_0x1e002f})[_0xa3aa('0x25')](function(_0x135c7b){return new BPromise(function(_0x5e7129,_0xc41188){pdf['create'](_0x135c7b,_0x80c801)['toFile'](path[_0xa3aa('0x7a')](_0x2ea898,_0xa3aa('0xdb')+_0x148255['id']+'-'+_0x732637+_0xa3aa('0xdc')),function(_0x289dd8,_0x11e1d5){if(_0x289dd8)return _0xc41188(_0x289dd8);_0x5e7129(_0x11e1d5);});});});}})[_0xa3aa('0x25')](function(){if(_0x236946){return new BPromise(function(_0x2e8ea8,_0x32ea16){zipdir(_0x2ea898,{'saveTo':_0x1423e5},function(_0x152e27,_0x25dcef){if(_0x152e27)return _0x32ea16(_0x152e27);return _0x2e8ea8(_0x25dcef);});})[_0xa3aa('0x25')](function(){return new BPromise(function(_0x6c1c51,_0x3bec6a){rimraf(_0x2ea898,function(_0x4fbadb){if(_0x4fbadb)_0x3bec6a(_0x4fbadb);return _0x6c1c51();});});})['then'](function(){return _0x22413d[_0xa3aa('0xb5')](_0x1423e5,_0x129228,function(_0x5cd4d7){if(_0x5cd4d7){console[_0xa3aa('0xdd')](_0xa3aa('0xde'),_0x5cd4d7);}else{fs['unlinkSync'](_0x1423e5);}});});}else{return _0x22413d[_0xa3aa('0x1a')](0xc8);}})[_0xa3aa('0x32')](handleError(_0x22413d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e15152e..be6dda3 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 _0x434e=['save','update','getUsers','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners'];(function(_0x946288,_0x23ece9){var _0x16bc4b=function(_0x1ae9e6){while(--_0x1ae9e6){_0x946288['push'](_0x946288['shift']());}};_0x16bc4b(++_0x23ece9);}(_0x434e,0xfc));var _0xe434=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x434e[_0xd2d54];return _0x78b113;};'use strict';var EventEmitter=require(_0xe434('0x0'));var OpenchannelInteraction=require(_0xe434('0x1'))['db'][_0xe434('0x2')];var OpenchannelMessage=require(_0xe434('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe434('0x3')](0x0);var events={'afterCreate':_0xe434('0x4'),'afterUpdate':_0xe434('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5ad689){return function(_0x3385af,_0x575d33,_0x5910b2){_0x3385af[_0xe434('0x6')]({'attributes':['id'],'raw':!![]})[_0xe434('0x7')](function(_0x2a0b44){_0x3385af[_0xe434('0x8')]('Users',_0x2a0b44['map'](function(_0xb109e7){return{'id':_0xb109e7['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3385af['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe434('0x7')](function(_0x538835){_0x3385af['setDataValue'](_0xe434('0x9'),_0x538835[_0xe434('0xa')]);OpenchannelInteractionEvents['emit'](_0x5ad689+':'+_0x3385af['id'],_0x3385af);OpenchannelInteractionEvents[_0xe434('0xb')](_0x5ad689,_0x3385af);_0x5910b2(null);})[_0xe434('0xc')](_0x5910b2(null));};}for(var e in events){if(events[_0xe434('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xe434('0xe')](e,emitEvent(event));}}module[_0xe434('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x9641=['OpenchannelMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction'];(function(_0x355179,_0x5eb568){var _0x5c705b=function(_0x578dd6){while(--_0x578dd6){_0x355179['push'](_0x355179['shift']());}};_0x5c705b(++_0x5eb568);}(_0x9641,0x1ea));var _0x1964=function(_0x49194a,_0x4ac29e){_0x49194a=_0x49194a-0x0;var _0x277427=_0x9641[_0x49194a];return _0x277427;};'use strict';var EventEmitter=require(_0x1964('0x0'));var OpenchannelInteraction=require(_0x1964('0x1'))['db'][_0x1964('0x2')];var OpenchannelMessage=require(_0x1964('0x1'))['db'][_0x1964('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1964('0x4')](0x0);var events={'afterCreate':_0x1964('0x5'),'afterUpdate':_0x1964('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2e9184){return function(_0xf4bb42,_0x3f0c0f,_0x1fd437){_0xf4bb42['getUsers']({'attributes':['id'],'raw':!![]})[_0x1964('0x7')](function(_0x2e5217){_0xf4bb42[_0x1964('0x8')](_0x1964('0x9'),_0x2e5217[_0x1964('0xa')](function(_0x32e731){return{'id':_0x32e731['id']};}));return OpenchannelMessage[_0x1964('0xb')]({'where':{'OpenchannelInteractionId':_0xf4bb42['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1964('0x7')](function(_0x167cf3){_0xf4bb42[_0x1964('0x8')]('unreadMessages',_0x167cf3['length']);OpenchannelInteractionEvents['emit'](_0x2e9184+':'+_0xf4bb42['id'],_0xf4bb42);OpenchannelInteractionEvents[_0x1964('0xc')](_0x2e9184,_0xf4bb42);_0x1fd437(null);})[_0x1964('0xd')](_0x1fd437(null));};}for(var e in events){if(events[_0x1964('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x1964('0xf')](e,emitEvent(event));}}module[_0x1964('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 54627de..ba36e78 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 _0x8098=['../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4565b7,_0x5aadc8){var _0x56d0c1=function(_0x2f78df){while(--_0x2f78df){_0x4565b7['push'](_0x4565b7['shift']());}};_0x56d0c1(++_0x5aadc8);}(_0x8098,0x1ba));var _0x8809=function(_0x46511e,_0x44d3fa){_0x46511e=_0x46511e-0x0;var _0x436d92=_0x8098[_0x46511e];return _0x436d92;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8809('0x0'))(_0x8809('0x1'));var moment=require(_0x8809('0x2'));var BPromise=require(_0x8809('0x3'));var rp=require(_0x8809('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8809('0x5'));var config=require(_0x8809('0x6'));var attributes=require(_0x8809('0x7'));module[_0x8809('0x8')]=function(_0x5804f0,_0xeb811){return _0x5804f0[_0x8809('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x8809('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fd084,_0x181e8b,_0x2477aa){if(_0x3fd084[_0x8809('0xb')](_0x8809('0xc'))){_0x3fd084[_0x8809('0xd')]=moment()[_0x8809('0xe')](_0x8809('0xf'));}_0x2477aa(null,_0x3fd084);}}});}; \ No newline at end of file +var _0xab86=['path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird'];(function(_0x55a328,_0x5b0da9){var _0x1e6d21=function(_0x4850c0){while(--_0x4850c0){_0x55a328['push'](_0x55a328['shift']());}};_0x1e6d21(++_0x5b0da9);}(_0xab86,0x13e));var _0x6ab8=function(_0x1ae152,_0x21f035){_0x1ae152=_0x1ae152-0x0;var _0x265ede=_0xab86[_0x1ae152];return _0x265ede;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var logger=require(_0x6ab8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ab8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ab8('0x4'));var rimraf=require('rimraf');var config=require(_0x6ab8('0x5'));var attributes=require(_0x6ab8('0x6'));module[_0x6ab8('0x7')]=function(_0x154d17,_0x6f41f){return _0x154d17[_0x6ab8('0x8')](_0x6ab8('0x9'),attributes,{'tableName':_0x6ab8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x363c5e,_0x42c273,_0x2b429d){if(_0x363c5e[_0x6ab8('0xb')](_0x6ab8('0xc'))){_0x363c5e['closedAt']=moment()['format'](_0x6ab8('0xd'));}_0x2b429d(null,_0x363c5e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 14ebf98..4b77186 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 _0x13cf=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','OpenchannelInteraction','update','body','options','where','attributes','UpdateOpenchannelInteraction','stringify','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x13cf,0x11d));var _0xf13c=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x13cf[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xf13c('0x0'));var util=require(_0xf13c('0x1'));var moment=require(_0xf13c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf13c('0x3'));var fs=require('fs');var Redis=require(_0xf13c('0x4'));var db=require(_0xf13c('0x5'))['db'];var utils=require(_0xf13c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf13c('0x7'));var jayson=require(_0xf13c('0x8'));var client=jayson[_0xf13c('0x9')]['http']({'port':0x232a});config[_0xf13c('0xa')]=_[_0xf13c('0xb')](config[_0xf13c('0xa')],{'host':_0xf13c('0xc'),'port':0x18eb});var socket=require(_0xf13c('0xd'))(new Redis(config[_0xf13c('0xa')]));require(_0xf13c('0xe'))['register'](socket);function respondWithRpcPromise(_0x5a685d,_0x2835c2,_0x529748){return new BPromise(function(_0x184012,_0x571009){return client[_0xf13c('0xf')](_0x5a685d,_0x529748)[_0xf13c('0x10')](function(_0xe09725){logger[_0xf13c('0x11')](_0xf13c('0x12'),_0x2835c2,'request\x20sent');logger[_0xf13c('0x13')](_0xf13c('0x14'),_0x2835c2,_0xf13c('0x15'),JSON['stringify'](_0xe09725));if(_0xe09725[_0xf13c('0x16')]){if(_0xe09725[_0xf13c('0x16')]['code']===0x1f4){logger[_0xf13c('0x16')](_0xf13c('0x12'),_0x2835c2,_0xe09725[_0xf13c('0x16')]['message']);return _0x571009(_0xe09725[_0xf13c('0x16')][_0xf13c('0x17')]);}logger[_0xf13c('0x16')](_0xf13c('0x12'),_0x2835c2,_0xe09725[_0xf13c('0x16')][_0xf13c('0x17')]);return _0x184012(_0xe09725[_0xf13c('0x16')]['message']);}else{logger['info'](_0xf13c('0x12'),_0x2835c2,_0xf13c('0x15'));_0x184012(_0xe09725[_0xf13c('0x18')][_0xf13c('0x17')]);}})['catch'](function(_0x5f4c95){logger[_0xf13c('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2835c2,_0x5f4c95);_0x571009(_0x5f4c95);});});}exports['UpdateOpenchannelInteraction']=function(_0x4caea1){var _0x42ff01=this;return new Promise(function(_0x548bcd,_0x2d4b84){return db[_0xf13c('0x19')][_0xf13c('0x1a')](_0x4caea1[_0xf13c('0x1b')],{'raw':_0x4caea1['options']?_0x4caea1[_0xf13c('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4caea1[_0xf13c('0x1c')]?_0x4caea1['options'][_0xf13c('0x1d')]||null:null,'attributes':_0x4caea1[_0xf13c('0x1c')]?_0x4caea1[_0xf13c('0x1c')][_0xf13c('0x1e')]||null:null,'limit':_0x4caea1[_0xf13c('0x1c')]?_0x4caea1['options']['limit']||null:null})['then'](function(_0xe60ca8){logger[_0xf13c('0x11')](_0xf13c('0x1f'),_0x4caea1);logger['debug'](_0xf13c('0x1f'),_0x4caea1,JSON[_0xf13c('0x20')](_0xe60ca8));_0x548bcd(_0xe60ca8);})[_0xf13c('0x21')](function(_0x378aba){logger[_0xf13c('0x16')](_0xf13c('0x1f'),_0x378aba[_0xf13c('0x17')],_0x4caea1);_0x2d4b84(_0x42ff01[_0xf13c('0x16')](0x1f4,_0x378aba[_0xf13c('0x17')]));});});};exports[_0xf13c('0x22')]=function(_0x2145a3){return new Promise(function(_0x16b956,_0x2365dc){return db[_0xf13c('0x19')][_0xf13c('0x23')]({'where':_0x2145a3[_0xf13c('0x1c')]?_0x2145a3[_0xf13c('0x1c')][_0xf13c('0x1d')]||null:null})['then'](function(_0x49af0f){if(_0x49af0f){return _0x49af0f[_0xf13c('0x24')](_0x2145a3['body'][_0xf13c('0x25')],_[_0xf13c('0x26')](_0x2145a3[_0xf13c('0x1b')],[_0xf13c('0x25'),'id'])||{});}})[_0xf13c('0x27')](function(_0x2ccd5b){logger[_0xf13c('0x11')](_0xf13c('0x28'),_0x2145a3);logger[_0xf13c('0x13')](_0xf13c('0x28'),_0x2145a3,JSON[_0xf13c('0x20')](_0x2ccd5b));_0x16b956(_0x2ccd5b);})[_0xf13c('0x21')](function(_0x111fb1){logger['error'](_0xf13c('0x28'),_0x111fb1[_0xf13c('0x17')],_0x2145a3);_0x2365dc(_this['error'](0x1f4,_0x111fb1[_0xf13c('0x17')]));});});}; \ No newline at end of file +var _0xf127=['raw','where','attributes','limit','stringify','catch','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options'];(function(_0xb60322,_0x13c8de){var _0x3fcbb7=function(_0x23bf71){while(--_0x23bf71){_0xb60322['push'](_0xb60322['shift']());}};_0x3fcbb7(++_0x13c8de);}(_0xf127,0x1da));var _0x7f12=function(_0x282891,_0x302b11){_0x282891=_0x282891-0x0;var _0x1e024a=_0xf127[_0x282891];return _0x1e024a;};'use strict';var _=require(_0x7f12('0x0'));var util=require(_0x7f12('0x1'));var moment=require(_0x7f12('0x2'));var BPromise=require(_0x7f12('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f12('0x4'))['db'];var utils=require(_0x7f12('0x5'));var logger=require(_0x7f12('0x6'))('rpc');var config=require(_0x7f12('0x7'));var jayson=require(_0x7f12('0x8'));var client=jayson['client'][_0x7f12('0x9')]({'port':0x232a});config[_0x7f12('0xa')]=_[_0x7f12('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7f12('0xc'))(new Redis(config[_0x7f12('0xa')]));require(_0x7f12('0xd'))[_0x7f12('0xe')](socket);function respondWithRpcPromise(_0x382904,_0x5d622,_0x3f5db8){return new BPromise(function(_0xc1917c,_0x4ec614){return client[_0x7f12('0xf')](_0x382904,_0x3f5db8)[_0x7f12('0x10')](function(_0x19c367){logger[_0x7f12('0x11')](_0x7f12('0x12'),_0x5d622,'request\x20sent');logger[_0x7f12('0x13')](_0x7f12('0x14'),_0x5d622,_0x7f12('0x15'),JSON['stringify'](_0x19c367));if(_0x19c367['error']){if(_0x19c367['error'][_0x7f12('0x16')]===0x1f4){logger[_0x7f12('0x17')](_0x7f12('0x12'),_0x5d622,_0x19c367['error']['message']);return _0x4ec614(_0x19c367[_0x7f12('0x17')][_0x7f12('0x18')]);}logger[_0x7f12('0x17')](_0x7f12('0x12'),_0x5d622,_0x19c367['error'][_0x7f12('0x18')]);return _0xc1917c(_0x19c367[_0x7f12('0x17')][_0x7f12('0x18')]);}else{logger[_0x7f12('0x11')](_0x7f12('0x12'),_0x5d622,_0x7f12('0x15'));_0xc1917c(_0x19c367[_0x7f12('0x19')][_0x7f12('0x18')]);}})['catch'](function(_0x45b616){logger[_0x7f12('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5d622,_0x45b616);_0x4ec614(_0x45b616);});});}exports[_0x7f12('0x1a')]=function(_0x23202f){var _0x257f9c=this;return new Promise(function(_0x5a89c0,_0x583bcd){return db[_0x7f12('0x1b')][_0x7f12('0x1c')](_0x23202f['body'],{'raw':_0x23202f[_0x7f12('0x1d')]?_0x23202f['options'][_0x7f12('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23202f[_0x7f12('0x1d')]?_0x23202f['options'][_0x7f12('0x1f')]||null:null,'attributes':_0x23202f[_0x7f12('0x1d')]?_0x23202f[_0x7f12('0x1d')][_0x7f12('0x20')]||null:null,'limit':_0x23202f[_0x7f12('0x1d')]?_0x23202f[_0x7f12('0x1d')][_0x7f12('0x21')]||null:null})[_0x7f12('0x10')](function(_0x276bee){logger[_0x7f12('0x11')]('UpdateOpenchannelInteraction',_0x23202f);logger[_0x7f12('0x13')](_0x7f12('0x1a'),_0x23202f,JSON[_0x7f12('0x22')](_0x276bee));_0x5a89c0(_0x276bee);})[_0x7f12('0x23')](function(_0x2ca50f){logger['error'](_0x7f12('0x1a'),_0x2ca50f[_0x7f12('0x18')],_0x23202f);_0x583bcd(_0x257f9c[_0x7f12('0x17')](0x1f4,_0x2ca50f[_0x7f12('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x345eba){return new Promise(function(_0x4b7672,_0x1f2af4){return db[_0x7f12('0x1b')][_0x7f12('0x24')]({'where':_0x345eba[_0x7f12('0x1d')]?_0x345eba[_0x7f12('0x1d')][_0x7f12('0x1f')]||null:null})[_0x7f12('0x10')](function(_0x323888){if(_0x323888){return _0x323888[_0x7f12('0x25')](_0x345eba[_0x7f12('0x26')][_0x7f12('0x27')],_['omit'](_0x345eba[_0x7f12('0x26')],[_0x7f12('0x27'),'id'])||{});}})[_0x7f12('0x28')](function(_0xea06b1){logger['info']('AddTags',_0x345eba);logger[_0x7f12('0x13')]('AddTags',_0x345eba,JSON[_0x7f12('0x22')](_0xea06b1));_0x4b7672(_0xea06b1);})['catch'](function(_0x5c787a){logger[_0x7f12('0x17')](_0x7f12('0x29'),_0x5c787a['message'],_0x345eba);_0x1f2af4(_this['error'](0x1f4,_0x5c787a[_0x7f12('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3a23da4..5abe589 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 _0x4013=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','update','emit'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4013,0x115));var _0x3401=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4013[_0x502c7d];return _0x30b7ed;};'use strict';var OpenchannelInteractionEvents=require(_0x3401('0x0'));var events=['save','remove',_0x3401('0x1')];function createListener(_0x510cb8,_0x505218){return function(_0x3a19a8){_0x505218[_0x3401('0x2')](_0x510cb8,_0x3a19a8);};}function removeListener(_0x1ad3e2,_0xa3b310){return function(){OpenchannelInteractionEvents[_0x3401('0x3')](_0x1ad3e2,_0xa3b310);};}exports[_0x3401('0x4')]=function(_0x5c673a){for(var _0x3719ae=0x0,_0x598f48=events[_0x3401('0x5')];_0x3719ae<_0x598f48;_0x3719ae++){var _0x1a7b75=events[_0x3719ae];var _0x4f9cae=createListener(_0x3401('0x6')+_0x1a7b75,_0x5c673a);OpenchannelInteractionEvents['on'](_0x1a7b75,_0x4f9cae);}}; \ No newline at end of file +var _0xaa55=['remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xaa55,0x1ed));var _0x5aa5=function(_0xb2e129,_0x2f8af0){_0xb2e129=_0xb2e129-0x0;var _0x6090bd=_0xaa55[_0xb2e129];return _0x6090bd;};'use strict';var OpenchannelInteractionEvents=require(_0x5aa5('0x0'));var events=[_0x5aa5('0x1'),_0x5aa5('0x2'),_0x5aa5('0x3')];function createListener(_0x56939e,_0x562380){return function(_0x550689){_0x562380[_0x5aa5('0x4')](_0x56939e,_0x550689);};}function removeListener(_0x2abe6c,_0x2c6a4e){return function(){OpenchannelInteractionEvents[_0x5aa5('0x5')](_0x2abe6c,_0x2c6a4e);};}exports[_0x5aa5('0x6')]=function(_0x2df9ea){for(var _0x57ac23=0x0,_0xe1c250=events[_0x5aa5('0x7')];_0x57ac23<_0xe1c250;_0x57ac23++){var _0x5f31a1=events[_0x57ac23];var _0x3ae045=createListener(_0x5aa5('0x8')+_0x5f31a1,_0x2df9ea);OpenchannelInteractionEvents['on'](_0x5f31a1,_0x3ae045);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 2555006..0ee7f81 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 _0x4bcd=['accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','openchannelmessage:create','create','put','update','/:id/accept'];(function(_0x3f70af,_0x1df3dc){var _0x54ab77=function(_0x30ea5a){while(--_0x30ea5a){_0x3f70af['push'](_0x3f70af['shift']());}};_0x54ab77(++_0x1df3dc);}(_0x4bcd,0x14a));var _0xd4bc=function(_0x4001ed,_0x25e14e){_0x4001ed=_0x4001ed-0x0;var _0x328613=_0x4bcd[_0x4001ed];return _0x328613;};'use strict';var multer=require(_0xd4bc('0x0'));var util=require(_0xd4bc('0x1'));var path=require(_0xd4bc('0x2'));var timeout=require(_0xd4bc('0x3'));var express=require(_0xd4bc('0x4'));var router=express['Router']();var auth=require(_0xd4bc('0x5'));var interaction=require(_0xd4bc('0x6'));var config=require('../../config/environment');var controller=require(_0xd4bc('0x7'));router[_0xd4bc('0x8')]('/',auth[_0xd4bc('0x9')](),controller[_0xd4bc('0xa')]);router[_0xd4bc('0x8')](_0xd4bc('0xb'),auth['isAuthenticated'](),controller[_0xd4bc('0xc')]);router[_0xd4bc('0x8')](_0xd4bc('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xd4bc('0xe')]('/',auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xd4bc('0xf')),controller[_0xd4bc('0x10')]);router[_0xd4bc('0x11')]('/:id',auth[_0xd4bc('0x9')](),controller[_0xd4bc('0x12')]);router[_0xd4bc('0x11')](_0xd4bc('0x13'),auth[_0xd4bc('0x9')](),controller[_0xd4bc('0x14')]);router[_0xd4bc('0x11')]('/:id/reject',auth[_0xd4bc('0x9')](),controller[_0xd4bc('0x15')]);router[_0xd4bc('0x16')](_0xd4bc('0xd'),auth[_0xd4bc('0x9')](),controller[_0xd4bc('0x17')]);module[_0xd4bc('0x18')]=router; \ No newline at end of file +var _0x25c6=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','describe','show','tracked','openchannelmessage:create','create','put','/:id','update','accept','/:id/reject','reject'];(function(_0x3c6d17,_0x31ed24){var _0x77ea4=function(_0x20baeb){while(--_0x20baeb){_0x3c6d17['push'](_0x3c6d17['shift']());}};_0x77ea4(++_0x31ed24);}(_0x25c6,0x1ab));var _0x625c=function(_0x1cf1c6,_0x378916){_0x1cf1c6=_0x1cf1c6-0x0;var _0x2e08af=_0x25c6[_0x1cf1c6];return _0x2e08af;};'use strict';var multer=require(_0x625c('0x0'));var util=require('util');var path=require(_0x625c('0x1'));var timeout=require(_0x625c('0x2'));var express=require(_0x625c('0x3'));var router=express[_0x625c('0x4')]();var auth=require(_0x625c('0x5'));var interaction=require(_0x625c('0x6'));var config=require(_0x625c('0x7'));var controller=require(_0x625c('0x8'));router[_0x625c('0x9')]('/',auth[_0x625c('0xa')](),controller[_0x625c('0xb')]);router[_0x625c('0x9')]('/describe',auth[_0x625c('0xa')](),controller[_0x625c('0xc')]);router[_0x625c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x625c('0xd')]);router['post']('/',auth[_0x625c('0xa')](),interaction[_0x625c('0xe')]('openchannel',_0x625c('0xf')),controller[_0x625c('0x10')]);router[_0x625c('0x11')](_0x625c('0x12'),auth[_0x625c('0xa')](),controller[_0x625c('0x13')]);router[_0x625c('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x625c('0x14')]);router[_0x625c('0x11')](_0x625c('0x15'),auth['isAuthenticated'](),controller[_0x625c('0x16')]);router[_0x625c('0x17')](_0x625c('0x12'),auth[_0x625c('0xa')](),controller['destroy']);module[_0x625c('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c307220..052f2af 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 _0xd1a7=['out','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x2f8018,_0xd3e9ee){var _0x60cd05=function(_0x35fef0){while(--_0x35fef0){_0x2f8018['push'](_0x2f8018['shift']());}};_0x60cd05(++_0xd3e9ee);}(_0xd1a7,0xd9));var _0x7d1a=function(_0x6a782,_0xaf4907){_0x6a782=_0x6a782-0x0;var _0x58b3e9=_0xd1a7[_0x6a782];return _0x58b3e9;};'use strict';var Sequelize=require(_0x7d1a('0x0'));module[_0x7d1a('0x1')]={'body':{'type':Sequelize[_0x7d1a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x7d1a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7d1a('0x4')]('in',_0x7d1a('0x5')),'defaultValue':_0x7d1a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x4c2e=['BOOLEAN','ENUM','TEXT','medium'];(function(_0x2a94cf,_0x2b970d){var _0x22147f=function(_0xfc71ab){while(--_0xfc71ab){_0x2a94cf['push'](_0x2a94cf['shift']());}};_0x22147f(++_0x2b970d);}(_0x4c2e,0x19a));var _0xe4c2=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x4c2e[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe4c2('0x0')](_0xe4c2('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xe4c2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe4c2('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6445cb2..6d13641 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 _0x5070=['../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','reject','save','update','then','destroy','stack','name','index','OpenchannelMessage','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','count','includeAll','include','findAll','rows','show','fields','options','find','catch','create','body','params','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','get','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x55744f,_0x3224b8){var _0x3ff355=function(_0xb70bb2){while(--_0xb70bb2){_0x55744f['push'](_0x55744f['shift']());}};_0x3ff355(++_0x3224b8);}(_0x5070,0x1d1));var _0x0507=function(_0x124190,_0xa52bea){_0x124190=_0x124190-0x0;var _0x56c018=_0x5070[_0x124190];return _0x56c018;};'use strict';var pdf=require(_0x0507('0x0'));var emlformat=require(_0x0507('0x1'));var rimraf=require(_0x0507('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0507('0x3'));var rp=require('request-promise');var moment=require(_0x0507('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0507('0x5'));var util=require(_0x0507('0x6'));var path=require(_0x0507('0x7'));var sox=require(_0x0507('0x8'));var csv=require(_0x0507('0x9'));var ejs=require(_0x0507('0xa'));var fs=require('fs');var _=require(_0x0507('0xb'));var squel=require(_0x0507('0xc'));var crypto=require(_0x0507('0xd'));var jsforce=require(_0x0507('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0507('0x9'));var querystring=require(_0x0507('0xf'));var Papa=require('papaparse');var Redis=require(_0x0507('0x10'));var authService=require(_0x0507('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x0507('0x12'));var logger=require(_0x0507('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0507('0x14'));var db=require(_0x0507('0x15'))['db'];config['redis']=_[_0x0507('0x16')](config[_0x0507('0x17')],{'host':_0x0507('0x18'),'port':0x18eb});var socket=require(_0x0507('0x19'))(new Redis(config[_0x0507('0x17')]));require(_0x0507('0x1a'))[_0x0507('0x1b')](socket);var jayson=require(_0x0507('0x1c'));var client=jayson[_0x0507('0x1d')][_0x0507('0x1e')]({'port':0x232c});var client9002=jayson[_0x0507('0x1d')][_0x0507('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x13bb64,_0x555c48,_0x159d89){if(_0x159d89){var _0x4fb9d7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fb9d7['test'](_0x555c48)){return _0x13bb64;}else{throw new db[(_0x0507('0x1f'))][(_0x0507('0x20'))](_0x0507('0x21'));}}else{return _0x13bb64;}}function respondWithRpcPromise(_0x4096d7,_0x144cd9,_0x2a5b4e,_0x55e4c6){return new BPromise(function(_0x29d2ce,_0x243202){var _0x57a61d=_0x55e4c6||client;return _0x57a61d[_0x0507('0x22')](_0x4096d7,_0x2a5b4e)['then'](function(_0x3efabc){logger[_0x0507('0x23')](_0x0507('0x24'),_0x144cd9,'request\x20sent');logger[_0x0507('0x25')](_0x0507('0x26'),_0x144cd9,_0x0507('0x27'),JSON[_0x0507('0x28')](_0x3efabc));if(_0x3efabc[_0x0507('0x29')]){if(_0x3efabc[_0x0507('0x29')][_0x0507('0x2a')]===0x1f4){logger['error'](_0x0507('0x24'),_0x144cd9,_0x3efabc[_0x0507('0x29')]['message']);return _0x243202(_0x3efabc[_0x0507('0x29')][_0x0507('0x2b')]);}logger[_0x0507('0x29')](_0x0507('0x24'),_0x144cd9,_0x3efabc[_0x0507('0x29')]['message']);return _0x29d2ce(_0x3efabc[_0x0507('0x29')][_0x0507('0x2b')]);}else{logger[_0x0507('0x23')](_0x0507('0x24'),_0x144cd9,_0x0507('0x27'));_0x29d2ce(_0x3efabc[_0x0507('0x2c')][_0x0507('0x2b')]);}})['catch'](function(_0x42b028){logger[_0x0507('0x29')](_0x0507('0x24'),_0x144cd9,_0x42b028);_0x243202(_0x42b028);});});}function respondWithStatusCode(_0x48bb1f,_0x3e5ccd){_0x3e5ccd=_0x3e5ccd||0xcc;return function(_0x56d009){if(_0x56d009){return _0x48bb1f[_0x0507('0x2d')](_0x3e5ccd);}return _0x48bb1f[_0x0507('0x2e')](_0x3e5ccd)[_0x0507('0x2f')]();};}function respondWithResult(_0x6b8bd9,_0x212fda){_0x212fda=_0x212fda||0xc8;return function(_0x358dff){if(_0x358dff){return _0x6b8bd9[_0x0507('0x2e')](_0x212fda)[_0x0507('0x30')](_0x358dff);}};}function respondWithFilteredResult(_0xd023ab,_0x4ef048){return function(_0x577719){if(_0x577719){var _0x12ea3a=_0x577719['count'],_0xeb04f=_0x4ef048[_0x0507('0x31')],_0x1a3357=_0x4ef048[_0x0507('0x31')]+_0x4ef048[_0x0507('0x32')],_0x21aca8;if(_0x1a3357>=_0x12ea3a){_0x1a3357=_0x12ea3a;_0x21aca8=0xc8;}else{_0x21aca8=0xce;}_0xd023ab['status'](_0x21aca8);return _0xd023ab['set']('Content-Range',_0xeb04f+'-'+_0x1a3357+'/'+_0x12ea3a)[_0x0507('0x30')](_0x577719);}return null;};}function patchUpdates(_0x5258ff){return function(_0x3ff71){try{jsonpatch['apply'](_0x3ff71,_0x5258ff,!![]);}catch(_0x4c76ad){return BPromise[_0x0507('0x33')](_0x4c76ad);}return _0x3ff71[_0x0507('0x34')]();};}function saveUpdates(_0x468654,_0x21f746){return function(_0x145772){if(_0x145772){return _0x145772[_0x0507('0x35')](_0x468654)[_0x0507('0x36')](function(_0x22d172){return _0x22d172;});}return null;};}function removeEntity(_0x215cbd,_0x92d735){return function(_0x35e1d6){if(_0x35e1d6){return _0x35e1d6[_0x0507('0x37')]()[_0x0507('0x36')](function(){_0x215cbd[_0x0507('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18300c,_0x13af55){return function(_0xbe21cc){if(!_0xbe21cc){_0x18300c['sendStatus'](0x194);}return _0xbe21cc;};}function handleError(_0x22a672,_0x52c485){_0x52c485=_0x52c485||0x1f4;return function(_0x1c58bb){logger[_0x0507('0x29')](_0x1c58bb[_0x0507('0x38')]);if(_0x1c58bb['name']){delete _0x1c58bb[_0x0507('0x39')];}_0x22a672[_0x0507('0x2e')](_0x52c485)['send'](_0x1c58bb);};}exports[_0x0507('0x3a')]=function(_0x5525c4,_0x4fd97b){var _0x2e378b={},_0x565496={},_0x5ed539={'count':0x0,'rows':[]};var _0x4687e9=db[_0x0507('0x3b')][_0x0507('0x3c')];_0x565496[_0x0507('0x3d')]=_[_0x0507('0x3e')](_0x4687e9);_0x565496[_0x0507('0x3f')]=_[_0x0507('0x3e')](_0x5525c4[_0x0507('0x3f')]);_0x565496[_0x0507('0x40')]=_[_0x0507('0x41')](_0x565496[_0x0507('0x3d')],_0x565496[_0x0507('0x3f')]);_0x2e378b[_0x0507('0x42')]=_[_0x0507('0x41')](_0x565496['model'],qs['fields'](_0x5525c4[_0x0507('0x3f')]['fields']));_0x2e378b['attributes']=_0x2e378b[_0x0507('0x42')][_0x0507('0x43')]?_0x2e378b[_0x0507('0x42')]:_0x565496[_0x0507('0x3d')];if(!_0x5525c4['query'][_0x0507('0x44')](_0x0507('0x45'))){_0x2e378b[_0x0507('0x32')]=qs['limit'](_0x5525c4[_0x0507('0x3f')][_0x0507('0x32')]);_0x2e378b[_0x0507('0x31')]=qs['offset'](_0x5525c4[_0x0507('0x3f')][_0x0507('0x31')]);}_0x2e378b[_0x0507('0x46')]=qs[_0x0507('0x47')](_0x5525c4[_0x0507('0x3f')][_0x0507('0x47')]);_0x2e378b[_0x0507('0x48')]=qs[_0x0507('0x40')](_[_0x0507('0x49')](_0x5525c4['query'],_0x565496[_0x0507('0x40')]));if(_0x5525c4[_0x0507('0x3f')][_0x0507('0x4a')]){_0x2e378b[_0x0507('0x48')]=_[_0x0507('0x4b')](_0x2e378b[_0x0507('0x48')],{'$or':_[_0x0507('0x4c')](_0x4687e9,function(_0x39cea0){if(_0x39cea0['type'][_0x0507('0x4d')]!==_0x0507('0x4e')){var _0x43fee2={};_0x43fee2[_0x39cea0['field']]={'$like':'%'+_0x5525c4[_0x0507('0x3f')][_0x0507('0x4a')]+'%'};return _0x43fee2;}})});}_0x2e378b=_[_0x0507('0x4b')]({},_0x2e378b,_0x5525c4['options']);var _0x3c87a0={'where':_0x2e378b['where']};return db[_0x0507('0x3b')][_0x0507('0x4f')](_0x3c87a0)[_0x0507('0x36')](function(_0x2524bd){_0x5ed539['count']=_0x2524bd;if(_0x5525c4[_0x0507('0x3f')][_0x0507('0x50')]){_0x2e378b[_0x0507('0x51')]=[{'all':!![]}];}return db[_0x0507('0x3b')][_0x0507('0x52')](_0x2e378b);})['then'](function(_0x4d73d5){_0x5ed539[_0x0507('0x53')]=_0x4d73d5;return _0x5ed539;})[_0x0507('0x36')](respondWithFilteredResult(_0x4fd97b,_0x2e378b))['catch'](handleError(_0x4fd97b,null));};exports[_0x0507('0x54')]=function(_0x4cf7be,_0x57f5a3){var _0x172e26={'raw':!![],'where':{'id':_0x4cf7be['params']['id']}},_0x35bf40={};_0x35bf40[_0x0507('0x3d')]=_['keys'](db[_0x0507('0x3b')][_0x0507('0x3c')]);_0x35bf40['query']=_[_0x0507('0x3e')](_0x4cf7be[_0x0507('0x3f')]);_0x35bf40[_0x0507('0x40')]=_[_0x0507('0x41')](_0x35bf40[_0x0507('0x3d')],_0x35bf40[_0x0507('0x3f')]);_0x172e26['attributes']=_[_0x0507('0x41')](_0x35bf40[_0x0507('0x3d')],qs[_0x0507('0x55')](_0x4cf7be[_0x0507('0x3f')][_0x0507('0x55')]));_0x172e26[_0x0507('0x42')]=_0x172e26[_0x0507('0x42')][_0x0507('0x43')]?_0x172e26['attributes']:_0x35bf40[_0x0507('0x3d')];if(_0x4cf7be['query'][_0x0507('0x50')]){_0x172e26[_0x0507('0x51')]=[{'all':!![]}];}_0x172e26=_[_0x0507('0x4b')]({},_0x172e26,_0x4cf7be[_0x0507('0x56')]);return db[_0x0507('0x3b')][_0x0507('0x57')](_0x172e26)['then'](handleEntityNotFound(_0x57f5a3,null))[_0x0507('0x36')](respondWithResult(_0x57f5a3,null))[_0x0507('0x58')](handleError(_0x57f5a3,null));};exports[_0x0507('0x59')]=function(_0x30a5e7,_0x39bbfa){return db['OpenchannelMessage']['create'](_0x30a5e7[_0x0507('0x5a')],{})[_0x0507('0x36')](respondWithResult(_0x39bbfa,0xc9))[_0x0507('0x58')](handleError(_0x39bbfa,null));};exports[_0x0507('0x35')]=function(_0x5b1f43,_0x2f37ed){if(_0x5b1f43[_0x0507('0x5a')]['id']){delete _0x5b1f43[_0x0507('0x5a')]['id'];}return db[_0x0507('0x3b')][_0x0507('0x57')]({'where':{'id':_0x5b1f43[_0x0507('0x5b')]['id']}})[_0x0507('0x36')](handleEntityNotFound(_0x2f37ed,null))[_0x0507('0x36')](saveUpdates(_0x5b1f43[_0x0507('0x5a')],null))[_0x0507('0x36')](respondWithResult(_0x2f37ed,null))['catch'](handleError(_0x2f37ed,null));};exports[_0x0507('0x37')]=function(_0x443ddc,_0x313980){return db[_0x0507('0x3b')]['find']({'where':{'id':_0x443ddc[_0x0507('0x5b')]['id']}})['then'](handleEntityNotFound(_0x313980,null))['then'](removeEntity(_0x313980,null))[_0x0507('0x58')](handleError(_0x313980,null));};exports['describe']=function(_0x2b8825,_0x3380d7){return db[_0x0507('0x3b')]['describe']()['then'](respondWithResult(_0x3380d7,null))[_0x0507('0x58')](handleError(_0x3380d7,null));};var interaction_log=require(_0x0507('0x13'))(_0x0507('0x5c'));exports[_0x0507('0x5d')]=function(_0xea526b,_0x574814,_0x40deb1){var _0x2df3ff={'channel':_0x0507('0x5e')};if(_0xea526b[_0x0507('0x5a')]['id']){delete _0xea526b[_0x0507('0x5a')]['id'];}_0xea526b[_0x0507('0x5a')][_0x0507('0x5f')]=!![];_0xea526b[_0x0507('0x5a')][_0x0507('0x60')]=moment()[_0x0507('0x61')](_0x0507('0x62'));_0xea526b[_0x0507('0x5a')][_0x0507('0x63')]=_0xea526b[_0x0507('0x5a')][_0x0507('0x63')]||_0xea526b[_0x0507('0x64')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0xea526b['params']['id'],'UserId':null},'include':[{'model':db[_0x0507('0x65')],'as':_0x0507('0x66')}]})[_0x0507('0x36')](handleEntityNotFound(_0x574814,null))[_0x0507('0x36')](saveUpdates(_0xea526b['body'],null))[_0x0507('0x36')](function(_0x5c3e81){if(_0x5c3e81){_0x2df3ff[_0x0507('0x2b')]=_0x5c3e81['get']({'plain':!![]});return db[_0x0507('0x67')][_0x0507('0x57')]({'where':{'id':_0x5c3e81[_0x0507('0x68')]}});}return null;})[_0x0507('0x36')](handleEntityNotFound(_0x574814,null))[_0x0507('0x36')](function(_0x59e5d8){if(_0x59e5d8){return _0x59e5d8[_0x0507('0x35')]({'UserId':_0xea526b[_0x0507('0x5a')][_0x0507('0x63')],'read1stAt':_['isNil'](_0x59e5d8['read1stAt'])?moment()[_0x0507('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1eb0d2){if(_0x1eb0d2){_0x2df3ff['interaction']=_0x1eb0d2['get']({'plain':!![]});interaction_log['info'](_0x0507('0x69'),_0xea526b['user']['id'],_0xea526b[_0x0507('0x64')][_0x0507('0x39')],_0xea526b['user'][_0x0507('0x6a')],_0x2df3ff['interaction']['id'],_0xea526b[_0x0507('0x5a')]?JSON[_0x0507('0x28')](_0xea526b[_0x0507('0x5a')]):_0x0507('0x6b'));return respondWithRpcPromise(_0x0507('0x6c'),'acceptMessage',_0x2df3ff);}return null;})[_0x0507('0x36')](function(_0x58bf23){if(_0x58bf23){if(_0xea526b[_0x0507('0x5a')]['manual']){_0x2df3ff[_0x0507('0x2b')]['interface']=util['format'](_0x0507('0x6d'),_0xea526b[_0x0507('0x64')][_0x0507('0x39')]);_0x2df3ff[_0x0507('0x2b')]['channel']=_0x2df3ff[_0x0507('0x6e')];_0x2df3ff[_0x0507('0x2b')][_0x0507('0x6f')]=_0x0507('0x5d');return respondWithRpcPromise(_0x0507('0x70'),'EventManager',{'event':_0x0507('0x71'),'message':_0x2df3ff['message']},client9002)[_0x0507('0x36')](function(){return _0x2df3ff;});}return _0x2df3ff;}return null;})[_0x0507('0x36')](respondWithResult(_0x574814,null))['catch'](handleError(_0x574814,null));};var interaction_log=require(_0x0507('0x13'))(_0x0507('0x5c'));exports[_0x0507('0x33')]=function(_0xa3c625,_0x3e86b4,_0x5bf9f4){var _0x28567d={'agent':{},'channel':_0x0507('0x5e')};if(_0xa3c625[_0x0507('0x5a')]['id']){delete _0xa3c625[_0x0507('0x5a')]['id'];}_0xa3c625[_0x0507('0x5a')][_0x0507('0x63')]=_0xa3c625[_0x0507('0x5a')]['UserId']||_0xa3c625[_0x0507('0x64')]['id'];_0x28567d['agent']['id']=_0xa3c625['body'][_0x0507('0x63')];return db['OpenchannelMessage'][_0x0507('0x57')]({'where':{'id':_0xa3c625['params']['id'],'UserId':null}})[_0x0507('0x36')](handleEntityNotFound(_0x3e86b4,null))['then'](function(_0x2bc8f9){if(_0x2bc8f9){_0x28567d[_0x0507('0x2b')]=_0x2bc8f9[_0x0507('0x72')]({'plain':!![]});return db[_0x0507('0x67')]['find']({'where':{'id':_0x2bc8f9['OpenchannelInteractionId']}});}return null;})[_0x0507('0x36')](handleEntityNotFound(_0x3e86b4,null))[_0x0507('0x36')](function(_0x202c60){if(_0x202c60){_0x28567d[_0x0507('0x73')]=_0x202c60[_0x0507('0x72')]({'plain':!![]});interaction_log[_0x0507('0x23')](_0x0507('0x74'),_0xa3c625['user']['id'],_0xa3c625[_0x0507('0x64')][_0x0507('0x39')],_0xa3c625[_0x0507('0x64')][_0x0507('0x6a')],_0x28567d[_0x0507('0x73')]['id'],_0xa3c625[_0x0507('0x5a')]?JSON['stringify'](_0xa3c625[_0x0507('0x5a')]):_0x0507('0x6b'));return respondWithRpcPromise(_0x0507('0x75'),_0x0507('0x76'),_0x28567d);}return null;})[_0x0507('0x36')](function(_0x382c6c){if(_0x382c6c){_0x382c6c[_0x0507('0x2b')][_0x0507('0x77')]=util['format'](_0x0507('0x6d'),_0xa3c625['user'][_0x0507('0x39')]);_0x382c6c['message']['channel']=_0x28567d['channel'];_0x382c6c[_0x0507('0x2b')]['event']=_0x0507('0x33');respondWithRpcPromise(_0x0507('0x70'),_0x0507('0x70'),{'event':_0x0507('0x78'),'message':_0x382c6c[_0x0507('0x2b')]},client9002);return _0x28567d;}return null;})[_0x0507('0x36')](respondWithResult(_0x3e86b4,null))[_0x0507('0x58')](handleError(_0x3e86b4,null));}; \ No newline at end of file +var _0xea5e=['role','interaction','AcceptMessage','manual','interface','channel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','test','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','OpenchannelMessage','rawAttributes','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','type','key','field','options','count','findAll','rows','show','params','includeAll','include','find','create','body','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xea5e,0x1e0));var _0xeea5=function(_0x4ac955,_0x2a43ef){_0x4ac955=_0x4ac955-0x0;var _0x37d97a=_0xea5e[_0x4ac955];return _0x37d97a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeea5('0x0'));var rimraf=require(_0xeea5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeea5('0x2'));var moment=require(_0xeea5('0x3'));var BPromise=require(_0xeea5('0x4'));var Mustache=require(_0xeea5('0x5'));var util=require(_0xeea5('0x6'));var path=require(_0xeea5('0x7'));var sox=require(_0xeea5('0x8'));var csv=require(_0xeea5('0x9'));var ejs=require(_0xeea5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeea5('0xb'));var crypto=require(_0xeea5('0xc'));var jsforce=require(_0xeea5('0xd'));var deskjs=require(_0xeea5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeea5('0xf'));var Papa=require(_0xeea5('0x10'));var Redis=require(_0xeea5('0x11'));var authService=require(_0xeea5('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xeea5('0x13'));var logger=require(_0xeea5('0x14'))(_0xeea5('0x15'));var utils=require(_0xeea5('0x16'));var config=require(_0xeea5('0x17'));var db=require(_0xeea5('0x18'))['db'];config['redis']=_[_0xeea5('0x19')](config[_0xeea5('0x1a')],{'host':_0xeea5('0x1b'),'port':0x18eb});var socket=require(_0xeea5('0x1c'))(new Redis(config[_0xeea5('0x1a')]));require(_0xeea5('0x1d'))['register'](socket);var jayson=require(_0xeea5('0x1e'));var client=jayson[_0xeea5('0x1f')][_0xeea5('0x20')]({'port':0x232c});var client9002=jayson[_0xeea5('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x50de51,_0x446a45,_0x3169e9){if(_0x3169e9){var _0x5b318e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b318e[_0xeea5('0x21')](_0x446a45)){return _0x50de51;}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 _0x50de51;}}function respondWithRpcPromise(_0x3f9f26,_0xc2579a,_0x2d5ed9,_0xd7ea75){return new BPromise(function(_0x2c7a3c,_0x3b2b05){var _0x207ce0=_0xd7ea75||client;return _0x207ce0['request'](_0x3f9f26,_0x2d5ed9)['then'](function(_0x88a7c7){logger[_0xeea5('0x22')](_0xeea5('0x23'),_0xc2579a,_0xeea5('0x24'));logger[_0xeea5('0x25')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xc2579a,'request\x20sent',JSON[_0xeea5('0x26')](_0x88a7c7));if(_0x88a7c7[_0xeea5('0x27')]){if(_0x88a7c7[_0xeea5('0x27')][_0xeea5('0x28')]===0x1f4){logger[_0xeea5('0x27')](_0xeea5('0x23'),_0xc2579a,_0x88a7c7['error'][_0xeea5('0x29')]);return _0x3b2b05(_0x88a7c7['error']['message']);}logger['error'](_0xeea5('0x23'),_0xc2579a,_0x88a7c7['error'][_0xeea5('0x29')]);return _0x2c7a3c(_0x88a7c7[_0xeea5('0x27')]['message']);}else{logger['info'](_0xeea5('0x23'),_0xc2579a,'request\x20sent');_0x2c7a3c(_0x88a7c7['result'][_0xeea5('0x29')]);}})[_0xeea5('0x2a')](function(_0x33b3ad){logger[_0xeea5('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xc2579a,_0x33b3ad);_0x3b2b05(_0x33b3ad);});});}function respondWithStatusCode(_0x5d77a3,_0x2ca07a){_0x2ca07a=_0x2ca07a||0xcc;return function(_0x3d67df){if(_0x3d67df){return _0x5d77a3[_0xeea5('0x2b')](_0x2ca07a);}return _0x5d77a3[_0xeea5('0x2c')](_0x2ca07a)['end']();};}function respondWithResult(_0x400538,_0x481b4a){_0x481b4a=_0x481b4a||0xc8;return function(_0xbb7dff){if(_0xbb7dff){return _0x400538[_0xeea5('0x2c')](_0x481b4a)[_0xeea5('0x2d')](_0xbb7dff);}};}function respondWithFilteredResult(_0x44be5b,_0x3ca57f){return function(_0x1123ae){if(_0x1123ae){var _0x5f310b=_0x1123ae['count'],_0x395c87=_0x3ca57f[_0xeea5('0x2e')],_0x5705cd=_0x3ca57f[_0xeea5('0x2e')]+_0x3ca57f[_0xeea5('0x2f')],_0x2c1ab;if(_0x5705cd>=_0x5f310b){_0x5705cd=_0x5f310b;_0x2c1ab=0xc8;}else{_0x2c1ab=0xce;}_0x44be5b[_0xeea5('0x2c')](_0x2c1ab);return _0x44be5b['set'](_0xeea5('0x30'),_0x395c87+'-'+_0x5705cd+'/'+_0x5f310b)[_0xeea5('0x2d')](_0x1123ae);}return null;};}function patchUpdates(_0xa603a0){return function(_0x433fd1){try{jsonpatch[_0xeea5('0x31')](_0x433fd1,_0xa603a0,!![]);}catch(_0x2597c8){return BPromise[_0xeea5('0x32')](_0x2597c8);}return _0x433fd1[_0xeea5('0x33')]();};}function saveUpdates(_0x2db50e,_0x5ca25b){return function(_0x59a726){if(_0x59a726){return _0x59a726[_0xeea5('0x34')](_0x2db50e)[_0xeea5('0x35')](function(_0x277875){return _0x277875;});}return null;};}function removeEntity(_0x26ca0a,_0x1c7fa9){return function(_0x48e3e3){if(_0x48e3e3){return _0x48e3e3[_0xeea5('0x36')]()[_0xeea5('0x35')](function(){_0x26ca0a[_0xeea5('0x2c')](0xcc)[_0xeea5('0x37')]();});}};}function handleEntityNotFound(_0x5214db,_0x73ad50){return function(_0x4b3041){if(!_0x4b3041){_0x5214db[_0xeea5('0x2b')](0x194);}return _0x4b3041;};}function handleError(_0x1b73a5,_0x314c3c){_0x314c3c=_0x314c3c||0x1f4;return function(_0x17bed5){logger['error'](_0x17bed5[_0xeea5('0x38')]);if(_0x17bed5[_0xeea5('0x39')]){delete _0x17bed5['name'];}_0x1b73a5[_0xeea5('0x2c')](_0x314c3c)[_0xeea5('0x3a')](_0x17bed5);};}exports['index']=function(_0x3e8f12,_0x5a39d4){var _0x157bc1={},_0x1c10ea={},_0x369391={'count':0x0,'rows':[]};var _0x2b8b6a=db[_0xeea5('0x3b')][_0xeea5('0x3c')];_0x1c10ea['model']=_[_0xeea5('0x3d')](_0x2b8b6a);_0x1c10ea[_0xeea5('0x3e')]=_[_0xeea5('0x3d')](_0x3e8f12[_0xeea5('0x3e')]);_0x1c10ea['filters']=_[_0xeea5('0x3f')](_0x1c10ea[_0xeea5('0x40')],_0x1c10ea[_0xeea5('0x3e')]);_0x157bc1['attributes']=_[_0xeea5('0x3f')](_0x1c10ea[_0xeea5('0x40')],qs[_0xeea5('0x41')](_0x3e8f12['query'][_0xeea5('0x41')]));_0x157bc1['attributes']=_0x157bc1[_0xeea5('0x42')]['length']?_0x157bc1[_0xeea5('0x42')]:_0x1c10ea[_0xeea5('0x40')];if(!_0x3e8f12[_0xeea5('0x3e')][_0xeea5('0x43')](_0xeea5('0x44'))){_0x157bc1[_0xeea5('0x2f')]=qs[_0xeea5('0x2f')](_0x3e8f12['query'][_0xeea5('0x2f')]);_0x157bc1[_0xeea5('0x2e')]=qs[_0xeea5('0x2e')](_0x3e8f12[_0xeea5('0x3e')][_0xeea5('0x2e')]);}_0x157bc1['order']=qs[_0xeea5('0x45')](_0x3e8f12[_0xeea5('0x3e')][_0xeea5('0x45')]);_0x157bc1[_0xeea5('0x46')]=qs[_0xeea5('0x47')](_[_0xeea5('0x48')](_0x3e8f12[_0xeea5('0x3e')],_0x1c10ea['filters']));if(_0x3e8f12[_0xeea5('0x3e')][_0xeea5('0x49')]){_0x157bc1[_0xeea5('0x46')]=_[_0xeea5('0x4a')](_0x157bc1['where'],{'$or':_[_0xeea5('0x4b')](_0x2b8b6a,function(_0x19aa0e){if(_0x19aa0e[_0xeea5('0x4c')][_0xeea5('0x4d')]!=='VIRTUAL'){var _0x3f579d={};_0x3f579d[_0x19aa0e[_0xeea5('0x4e')]]={'$like':'%'+_0x3e8f12[_0xeea5('0x3e')][_0xeea5('0x49')]+'%'};return _0x3f579d;}})});}_0x157bc1=_[_0xeea5('0x4a')]({},_0x157bc1,_0x3e8f12[_0xeea5('0x4f')]);var _0x59d431={'where':_0x157bc1[_0xeea5('0x46')]};return db[_0xeea5('0x3b')]['count'](_0x59d431)['then'](function(_0x21a0da){_0x369391[_0xeea5('0x50')]=_0x21a0da;if(_0x3e8f12[_0xeea5('0x3e')]['includeAll']){_0x157bc1['include']=[{'all':!![]}];}return db[_0xeea5('0x3b')][_0xeea5('0x51')](_0x157bc1);})[_0xeea5('0x35')](function(_0x22ef7d){_0x369391[_0xeea5('0x52')]=_0x22ef7d;return _0x369391;})[_0xeea5('0x35')](respondWithFilteredResult(_0x5a39d4,_0x157bc1))[_0xeea5('0x2a')](handleError(_0x5a39d4,null));};exports[_0xeea5('0x53')]=function(_0x436071,_0x52996b){var _0x4c2419={'raw':!![],'where':{'id':_0x436071[_0xeea5('0x54')]['id']}},_0x377e77={};_0x377e77[_0xeea5('0x40')]=_[_0xeea5('0x3d')](db[_0xeea5('0x3b')][_0xeea5('0x3c')]);_0x377e77['query']=_[_0xeea5('0x3d')](_0x436071['query']);_0x377e77['filters']=_[_0xeea5('0x3f')](_0x377e77['model'],_0x377e77[_0xeea5('0x3e')]);_0x4c2419[_0xeea5('0x42')]=_[_0xeea5('0x3f')](_0x377e77['model'],qs['fields'](_0x436071[_0xeea5('0x3e')][_0xeea5('0x41')]));_0x4c2419[_0xeea5('0x42')]=_0x4c2419[_0xeea5('0x42')]['length']?_0x4c2419[_0xeea5('0x42')]:_0x377e77['model'];if(_0x436071[_0xeea5('0x3e')][_0xeea5('0x55')]){_0x4c2419[_0xeea5('0x56')]=[{'all':!![]}];}_0x4c2419=_[_0xeea5('0x4a')]({},_0x4c2419,_0x436071[_0xeea5('0x4f')]);return db[_0xeea5('0x3b')][_0xeea5('0x57')](_0x4c2419)[_0xeea5('0x35')](handleEntityNotFound(_0x52996b,null))[_0xeea5('0x35')](respondWithResult(_0x52996b,null))[_0xeea5('0x2a')](handleError(_0x52996b,null));};exports[_0xeea5('0x58')]=function(_0x4b2d0b,_0x4b899f){return db[_0xeea5('0x3b')][_0xeea5('0x58')](_0x4b2d0b[_0xeea5('0x59')],{})[_0xeea5('0x35')](respondWithResult(_0x4b899f,0xc9))[_0xeea5('0x2a')](handleError(_0x4b899f,null));};exports[_0xeea5('0x34')]=function(_0x593afb,_0x26b7bb){if(_0x593afb['body']['id']){delete _0x593afb[_0xeea5('0x59')]['id'];}return db[_0xeea5('0x3b')][_0xeea5('0x57')]({'where':{'id':_0x593afb['params']['id']}})['then'](handleEntityNotFound(_0x26b7bb,null))[_0xeea5('0x35')](saveUpdates(_0x593afb['body'],null))['then'](respondWithResult(_0x26b7bb,null))[_0xeea5('0x2a')](handleError(_0x26b7bb,null));};exports['destroy']=function(_0x340822,_0x4b4537){return db[_0xeea5('0x3b')][_0xeea5('0x57')]({'where':{'id':_0x340822[_0xeea5('0x54')]['id']}})[_0xeea5('0x35')](handleEntityNotFound(_0x4b4537,null))[_0xeea5('0x35')](removeEntity(_0x4b4537,null))['catch'](handleError(_0x4b4537,null));};exports[_0xeea5('0x5a')]=function(_0x5565f4,_0xa6e790){return db[_0xeea5('0x3b')][_0xeea5('0x5a')]()[_0xeea5('0x35')](respondWithResult(_0xa6e790,null))[_0xeea5('0x2a')](handleError(_0xa6e790,null));};var interaction_log=require(_0xeea5('0x14'))(_0xeea5('0x5b'));exports[_0xeea5('0x5c')]=function(_0x4559fe,_0x55e5b6,_0x10aaf2){var _0x5e41ad={'channel':_0xeea5('0x5d')};if(_0x4559fe[_0xeea5('0x59')]['id']){delete _0x4559fe['body']['id'];}_0x4559fe['body']['read']=!![];_0x4559fe['body']['readAt']=moment()[_0xeea5('0x5e')](_0xeea5('0x5f'));_0x4559fe['body']['UserId']=_0x4559fe[_0xeea5('0x59')][_0xeea5('0x60')]||_0x4559fe[_0xeea5('0x61')]['id'];return db[_0xeea5('0x3b')]['find']({'where':{'id':_0x4559fe[_0xeea5('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xeea5('0x62')}]})[_0xeea5('0x35')](handleEntityNotFound(_0x55e5b6,null))[_0xeea5('0x35')](saveUpdates(_0x4559fe[_0xeea5('0x59')],null))['then'](function(_0x328e35){if(_0x328e35){_0x5e41ad['message']=_0x328e35[_0xeea5('0x63')]({'plain':!![]});return db[_0xeea5('0x64')][_0xeea5('0x57')]({'where':{'id':_0x328e35[_0xeea5('0x65')]}});}return null;})[_0xeea5('0x35')](handleEntityNotFound(_0x55e5b6,null))['then'](function(_0x373d22){if(_0x373d22){return _0x373d22[_0xeea5('0x34')]({'UserId':_0x4559fe[_0xeea5('0x59')][_0xeea5('0x60')],'read1stAt':_[_0xeea5('0x66')](_0x373d22[_0xeea5('0x67')])?moment()[_0xeea5('0x5e')](_0xeea5('0x5f')):undefined});}return null;})['then'](function(_0x33ca00){if(_0x33ca00){_0x5e41ad['interaction']=_0x33ca00[_0xeea5('0x63')]({'plain':!![]});interaction_log['info'](_0xeea5('0x68'),_0x4559fe[_0xeea5('0x61')]['id'],_0x4559fe[_0xeea5('0x61')][_0xeea5('0x39')],_0x4559fe[_0xeea5('0x61')][_0xeea5('0x69')],_0x5e41ad[_0xeea5('0x6a')]['id'],_0x4559fe[_0xeea5('0x59')]?JSON[_0xeea5('0x26')](_0x4559fe['body']):'null');return respondWithRpcPromise(_0xeea5('0x6b'),'acceptMessage',_0x5e41ad);}return null;})[_0xeea5('0x35')](function(_0x2e57e7){if(_0x2e57e7){if(_0x4559fe[_0xeea5('0x59')][_0xeea5('0x6c')]){_0x5e41ad[_0xeea5('0x29')][_0xeea5('0x6d')]=util[_0xeea5('0x5e')]('SIP/%s',_0x4559fe['user']['name']);_0x5e41ad[_0xeea5('0x29')][_0xeea5('0x6e')]=_0x5e41ad[_0xeea5('0x6e')];_0x5e41ad[_0xeea5('0x29')][_0xeea5('0x6f')]=_0xeea5('0x5c');return respondWithRpcPromise(_0xeea5('0x70'),_0xeea5('0x70'),{'event':'acceptmessage','message':_0x5e41ad['message']},client9002)[_0xeea5('0x35')](function(){return _0x5e41ad;});}return _0x5e41ad;}return null;})['then'](respondWithResult(_0x55e5b6,null))[_0xeea5('0x2a')](handleError(_0x55e5b6,null));};var interaction_log=require(_0xeea5('0x14'))(_0xeea5('0x5b'));exports['reject']=function(_0xda6d7e,_0x430af6,_0x510708){var _0x4ca2c9={'agent':{},'channel':_0xeea5('0x5d')};if(_0xda6d7e['body']['id']){delete _0xda6d7e[_0xeea5('0x59')]['id'];}_0xda6d7e[_0xeea5('0x59')][_0xeea5('0x60')]=_0xda6d7e[_0xeea5('0x59')]['UserId']||_0xda6d7e[_0xeea5('0x61')]['id'];_0x4ca2c9['agent']['id']=_0xda6d7e[_0xeea5('0x59')]['UserId'];return db[_0xeea5('0x3b')][_0xeea5('0x57')]({'where':{'id':_0xda6d7e[_0xeea5('0x54')]['id'],'UserId':null}})[_0xeea5('0x35')](handleEntityNotFound(_0x430af6,null))[_0xeea5('0x35')](function(_0x164cdf){if(_0x164cdf){_0x4ca2c9[_0xeea5('0x29')]=_0x164cdf[_0xeea5('0x63')]({'plain':!![]});return db[_0xeea5('0x64')][_0xeea5('0x57')]({'where':{'id':_0x164cdf[_0xeea5('0x65')]}});}return null;})[_0xeea5('0x35')](handleEntityNotFound(_0x430af6,null))[_0xeea5('0x35')](function(_0x1dd5c1){if(_0x1dd5c1){_0x4ca2c9[_0xeea5('0x6a')]=_0x1dd5c1[_0xeea5('0x63')]({'plain':!![]});interaction_log[_0xeea5('0x22')](_0xeea5('0x71'),_0xda6d7e[_0xeea5('0x61')]['id'],_0xda6d7e[_0xeea5('0x61')][_0xeea5('0x39')],_0xda6d7e[_0xeea5('0x61')]['role'],_0x4ca2c9['interaction']['id'],_0xda6d7e[_0xeea5('0x59')]?JSON['stringify'](_0xda6d7e[_0xeea5('0x59')]):'null');return respondWithRpcPromise(_0xeea5('0x72'),_0xeea5('0x73'),_0x4ca2c9);}return null;})[_0xeea5('0x35')](function(_0x164603){if(_0x164603){_0x164603['message'][_0xeea5('0x6d')]=util['format'](_0xeea5('0x74'),_0xda6d7e[_0xeea5('0x61')][_0xeea5('0x39')]);_0x164603[_0xeea5('0x29')][_0xeea5('0x6e')]=_0x4ca2c9['channel'];_0x164603[_0xeea5('0x29')][_0xeea5('0x6f')]='reject';respondWithRpcPromise('EventManager',_0xeea5('0x70'),{'event':'rejectmessage','message':_0x164603['message']},client9002);return _0x4ca2c9;}return null;})['then'](respondWithResult(_0x430af6,null))[_0xeea5('0x2a')](handleError(_0x430af6,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5cf1ab4..07017a9 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 _0x6fc8=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6fc8,0x1c7));var _0x86fc=function(_0x371b18,_0x4048c0){_0x371b18=_0x371b18-0x0;var _0x48e1be=_0x6fc8[_0x371b18];return _0x48e1be;};'use strict';var EventEmitter=require(_0x86fc('0x0'));var OpenchannelMessage=require(_0x86fc('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x86fc('0x2')](0x0);var events={'afterCreate':_0x86fc('0x3'),'afterUpdate':_0x86fc('0x4'),'afterDestroy':_0x86fc('0x5')};function emitEvent(_0x29b60d){return function(_0x582fe1,_0x14fb5c,_0xcf116f){OpenchannelMessageEvents[_0x86fc('0x6')](_0x29b60d+':'+_0x582fe1['id'],_0x582fe1);OpenchannelMessageEvents['emit'](_0x29b60d,_0x582fe1);_0xcf116f(null);};}for(var e in events){if(events[_0x86fc('0x7')](e)){var event=events[e];OpenchannelMessage[_0x86fc('0x8')](e,emitEvent(event));}}module[_0x86fc('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xf49d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','remove'];(function(_0x199c38,_0x28c9a9){var _0x1aea68=function(_0x280f1b){while(--_0x280f1b){_0x199c38['push'](_0x199c38['shift']());}};_0x1aea68(++_0x28c9a9);}(_0xf49d,0x1ec));var _0xdf49=function(_0x4af37e,_0x46bea7){_0x4af37e=_0x4af37e-0x0;var _0x1a2777=_0xf49d[_0x4af37e];return _0x1a2777;};'use strict';var EventEmitter=require(_0xdf49('0x0'));var OpenchannelMessage=require(_0xdf49('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdf49('0x2'),'afterUpdate':'update','afterDestroy':_0xdf49('0x3')};function emitEvent(_0x116b38){return function(_0x270479,_0x540f90,_0x4df716){OpenchannelMessageEvents[_0xdf49('0x4')](_0x116b38+':'+_0x270479['id'],_0x270479);OpenchannelMessageEvents[_0xdf49('0x4')](_0x116b38,_0x270479);_0x4df716(null);};}for(var e in events){if(events[_0xdf49('0x5')](e)){var event=events[e];OpenchannelMessage[_0xdf49('0x6')](e,emitEvent(event));}}module[_0xdf49('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 a307a72..5b60fa8 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 _0x4483=['./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x407403,_0x4137fe){var _0x43e2dd=function(_0x3cff05){while(--_0x3cff05){_0x407403['push'](_0x407403['shift']());}};_0x43e2dd(++_0x4137fe);}(_0x4483,0x110));var _0x3448=function(_0x33c32a,_0x2143db){_0x33c32a=_0x33c32a-0x0;var _0x221571=_0x4483[_0x33c32a];return _0x221571;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require('../../config/logger')(_0x3448('0x2'));var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3448('0x5'));var rimraf=require(_0x3448('0x6'));var config=require(_0x3448('0x7'));var attributes=require(_0x3448('0x8'));module[_0x3448('0x9')]=function(_0x2b5e94,_0x1e099d){return _0x2b5e94[_0x3448('0xa')](_0x3448('0xb'),attributes,{'tableName':_0x3448('0xc'),'paranoid':![],'indexes':[{'name':_0x3448('0xd'),'fields':[_0x3448('0xe')],'type':_0x3448('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10c475,_0x58f960,_0x2c81bd){var _0x477f30=_0x2b5e94[_0x3448('0x10')];var _0x20e446=_0x10c475[_0x3448('0x11')]({'plain':!![]});if(_0x20e446[_0x3448('0x12')][_0x3448('0x13')]()==='in'||_0x20e446[_0x3448('0x12')]['toLowerCase']()===_0x3448('0x14')&&!_0x20e446[_0x3448('0x15')]&&!_[_0x3448('0x16')](_0x20e446[_0x3448('0x17')])){_0x477f30[_0x3448('0x18')][_0x3448('0x19')]({'where':{'id':_0x20e446[_0x3448('0x1a')]}})[_0x3448('0x1b')](function(_0x3caf7a){if(_0x3caf7a){_0x3caf7a[_0x3448('0x1c')]({'lastMsgAt':_0x20e446[_0x3448('0x1d')],'lastMsgDirection':_0x20e446[_0x3448('0x12')][_0x3448('0x13')]()});}})[_0x3448('0x1e')](function(_0x1328e9){console[_0x3448('0x1f')](_0x1328e9);});}if(_0x20e446[_0x3448('0x12')]===_0x3448('0x14')&&!_0x20e446['secret']){var _0xdeba28;_0x477f30[_0x3448('0x20')][_0x3448('0x21')]()[_0x3448('0x1b')](function(_0x83c0bd){return _0x477f30[_0x3448('0x22')][_0x3448('0x23')]({'where':{'id':_0x20e446['OpenchannelAccountId']},'include':[{'model':_0x477f30[_0x3448('0x18')],'as':_0x3448('0x24'),'where':{'id':_0x20e446['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x477f30[_0x3448('0x20')],'as':_0x3448('0x25'),'attributes':_[_0x3448('0x26')](_0x83c0bd)}]}]});})[_0x3448('0x1b')](function(_0x55e510){_0xdeba28=_0x55e510[_0x3448('0x11')]({'plain':!![]});if(_0xdeba28&&_0xdeba28['replyUri']){logger[_0x3448('0x27')](_0x3448('0x28'),_0x3448('0x29'),util[_0x3448('0x2a')](_0x3448('0x2b'),_0x20e446['id'],_0xdeba28[_0x3448('0x2c')]));if(_0xdeba28[_0x3448('0x24')]&&_0xdeba28[_0x3448('0x24')][_0x3448('0x2d')]){_0x20e446[_0x3448('0x2e')]=_[_0x3448('0x2f')](_0xdeba28['Interactions'][0x0],'Contact');_0x20e446[_0x3448('0x25')]=_0xdeba28['Interactions'][0x0][_0x3448('0x25')];}var _0x58f960={'method':_0x3448('0x30'),'uri':encodeURI(_0xdeba28[_0x3448('0x2c')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x58f960[_0x3448('0x31')]){case _0x3448('0x32'):_0x58f960['qs']=_0x20e446;break;case _0x3448('0x30'):_0x58f960['body']=_0x20e446;break;}return rp(_0x58f960)['then'](function(_0x319575){logger[_0x3448('0x27')](_0x3448('0x28'),_0x3448('0x29'),util[_0x3448('0x2a')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x20e446['id'],_0xdeba28[_0x3448('0x2c')]));if(_0x319575[_0x3448('0xe')][_0x3448('0x33')]&&_0x319575[_0x3448('0xe')][_0x3448('0x33')]!=_0x20e446[_0x3448('0x2e')]['threadId']){return _0x477f30[_0x3448('0x18')]['update']({'threadId':_0x319575[_0x3448('0xe')][_0x3448('0x33')]},{'logging':!![],'where':{'id':_0x20e446[_0x3448('0x2e')]['id']}});}else{return;}})[_0x3448('0x1b')](function(){return _0x10c475[_0x3448('0x1c')]({'read':!![]});})[_0x3448('0x1e')](function(_0x23e611){logger[_0x3448('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x3448('0x29'),util[_0x3448('0x34')](_0x23e611,{'showHidden':![],'depth':null}));_0x2c81bd();});}else{_0x2c81bd();}})[_0x3448('0x35')](function(){_0x2c81bd();});}else{_0x2c81bd();}}},'charset':_0x3448('0x36'),'collate':_0x3448('0x37')});}; \ No newline at end of file +var _0x4aba=['omit','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','out','describe','then','OpenchannelAccount','find','Interactions','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction'];(function(_0x5d589e,_0xcf71f0){var _0x5062a6=function(_0x4db521){while(--_0x4db521){_0x5d589e['push'](_0x5d589e['shift']());}};_0x5062a6(++_0xcf71f0);}(_0x4aba,0xda));var _0xa4ab=function(_0x2c50a4,_0x492921){_0x2c50a4=_0x2c50a4-0x0;var _0x5a251e=_0x4aba[_0x2c50a4];return _0x5a251e;};'use strict';var _=require(_0xa4ab('0x0'));var util=require('util');var logger=require(_0xa4ab('0x1'))(_0xa4ab('0x2'));var moment=require(_0xa4ab('0x3'));var BPromise=require(_0xa4ab('0x4'));var rp=require(_0xa4ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4ab('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4ab('0x7'));module[_0xa4ab('0x8')]=function(_0x8122a,_0x3ae69f){return _0x8122a['define'](_0xa4ab('0x9'),attributes,{'tableName':_0xa4ab('0xa'),'paranoid':![],'indexes':[{'name':_0xa4ab('0xb'),'fields':[_0xa4ab('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ae73e,_0x5616cc,_0x5ced8b){var _0xb353a6=_0x8122a[_0xa4ab('0xd')];var _0x5e0b37=_0x5ae73e[_0xa4ab('0xe')]({'plain':!![]});if(_0x5e0b37[_0xa4ab('0xf')][_0xa4ab('0x10')]()==='in'||_0x5e0b37[_0xa4ab('0xf')]['toLowerCase']()==='out'&&!_0x5e0b37[_0xa4ab('0x11')]&&!_['isNil'](_0x5e0b37[_0xa4ab('0x12')])){_0xb353a6[_0xa4ab('0x13')][_0xa4ab('0x14')]({'where':{'id':_0x5e0b37[_0xa4ab('0x15')]}})['then'](function(_0x4e07b9){if(_0x4e07b9){_0x4e07b9[_0xa4ab('0x16')]({'lastMsgAt':_0x5e0b37[_0xa4ab('0x17')],'lastMsgDirection':_0x5e0b37[_0xa4ab('0xf')][_0xa4ab('0x10')]()});}})[_0xa4ab('0x18')](function(_0xc1f45a){console[_0xa4ab('0x19')](_0xc1f45a);});}if(_0x5e0b37['direction']===_0xa4ab('0x1a')&&!_0x5e0b37[_0xa4ab('0x11')]){var _0x26748e;_0xb353a6['CmContact'][_0xa4ab('0x1b')]()[_0xa4ab('0x1c')](function(_0x4a4d03){return _0xb353a6[_0xa4ab('0x1d')][_0xa4ab('0x1e')]({'where':{'id':_0x5e0b37['OpenchannelAccountId']},'include':[{'model':_0xb353a6[_0xa4ab('0x13')],'as':_0xa4ab('0x1f'),'where':{'id':_0x5e0b37['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xb353a6[_0xa4ab('0x20')],'as':_0xa4ab('0x21'),'attributes':_[_0xa4ab('0x22')](_0x4a4d03)}]}]});})['then'](function(_0xf37b3b){_0x26748e=_0xf37b3b['get']({'plain':!![]});if(_0x26748e&&_0x26748e[_0xa4ab('0x23')]){logger['info'](_0xa4ab('0x24'),_0xa4ab('0x25'),util[_0xa4ab('0x26')](_0xa4ab('0x27'),_0x5e0b37['id'],_0x26748e[_0xa4ab('0x23')]));if(_0x26748e['Interactions']&&_0x26748e[_0xa4ab('0x1f')][_0xa4ab('0x28')]){_0x5e0b37[_0xa4ab('0x29')]=_[_0xa4ab('0x2a')](_0x26748e[_0xa4ab('0x1f')][0x0],'Contact');_0x5e0b37[_0xa4ab('0x21')]=_0x26748e[_0xa4ab('0x1f')][0x0][_0xa4ab('0x21')];}var _0x5616cc={'method':_0xa4ab('0x2b'),'uri':encodeURI(_0x26748e[_0xa4ab('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5616cc[_0xa4ab('0x2c')]){case _0xa4ab('0x2d'):_0x5616cc['qs']=_0x5e0b37;break;case _0xa4ab('0x2b'):_0x5616cc['body']=_0x5e0b37;break;}return rp(_0x5616cc)[_0xa4ab('0x1c')](function(_0x2fd73d){logger[_0xa4ab('0x2e')](_0xa4ab('0x24'),_0xa4ab('0x25'),util[_0xa4ab('0x26')](_0xa4ab('0x2f'),_0x5e0b37['id'],_0x26748e[_0xa4ab('0x23')]));if(_0x2fd73d[_0xa4ab('0xc')][_0xa4ab('0x30')]&&_0x2fd73d['body'][_0xa4ab('0x30')]!=_0x5e0b37['Interaction'][_0xa4ab('0x30')]){return _0xb353a6[_0xa4ab('0x13')][_0xa4ab('0x16')]({'threadId':_0x2fd73d[_0xa4ab('0xc')][_0xa4ab('0x30')]},{'logging':!![],'where':{'id':_0x5e0b37[_0xa4ab('0x29')]['id']}});}else{return;}})[_0xa4ab('0x1c')](function(){return _0x5ae73e['update']({'read':!![]});})['catch'](function(_0x3e3da7){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xa4ab('0x25'),util['inspect'](_0x3e3da7,{'showHidden':![],'depth':null}));_0x5ced8b();});}else{_0x5ced8b();}})[_0xa4ab('0x31')](function(){_0x5ced8b();});}else{_0x5ced8b();}}},'charset':_0xa4ab('0x32'),'collate':_0xa4ab('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 31a881b..363e251 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3d236a,_0x368b79){var _0x332b9a=function(_0xbe5c35){while(--_0xbe5c35){_0x3d236a['push'](_0x3d236a['shift']());}};_0x332b9a(++_0x368b79);}(_0xadb5,0xad));var _0x5adb=function(_0xe920dc,_0x4efca5){_0xe920dc=_0xe920dc-0x0;var _0x78c34c=_0xadb5[_0xe920dc];return _0x78c34c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x0324=['http','defaults','redis','./openchannelMessage.socket','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0324,0x90));var _0x4032=function(_0x338164,_0x3dfbc2){_0x338164=_0x338164-0x0;var _0x3bc821=_0x0324[_0x338164];return _0x3bc821;};'use strict';var _=require('lodash');var util=require(_0x4032('0x0'));var moment=require(_0x4032('0x1'));var BPromise=require(_0x4032('0x2'));var rs=require(_0x4032('0x3'));var fs=require('fs');var Redis=require(_0x4032('0x4'));var db=require(_0x4032('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4032('0x6'))(_0x4032('0x7'));var config=require(_0x4032('0x8'));var jayson=require(_0x4032('0x9'));var client=jayson[_0x4032('0xa')][_0x4032('0xb')]({'port':0x232a});config['redis']=_[_0x4032('0xc')](config[_0x4032('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4032('0xd')]));require(_0x4032('0xe'))['register'](socket);function respondWithRpcPromise(_0x35d7fd,_0x2940da,_0x3bc38e){return new BPromise(function(_0x3d38aa,_0x561064){return client[_0x4032('0xf')](_0x35d7fd,_0x3bc38e)[_0x4032('0x10')](function(_0x5e9430){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2940da,_0x4032('0x11'));logger[_0x4032('0x12')](_0x4032('0x13'),_0x2940da,_0x4032('0x11'),JSON[_0x4032('0x14')](_0x5e9430));if(_0x5e9430[_0x4032('0x15')]){if(_0x5e9430[_0x4032('0x15')][_0x4032('0x16')]===0x1f4){logger[_0x4032('0x15')](_0x4032('0x17'),_0x2940da,_0x5e9430['error']['message']);return _0x561064(_0x5e9430[_0x4032('0x15')][_0x4032('0x18')]);}logger[_0x4032('0x15')](_0x4032('0x17'),_0x2940da,_0x5e9430[_0x4032('0x15')][_0x4032('0x18')]);return _0x3d38aa(_0x5e9430['error'][_0x4032('0x18')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2940da,_0x4032('0x11'));_0x3d38aa(_0x5e9430[_0x4032('0x19')][_0x4032('0x18')]);}})[_0x4032('0x1a')](function(_0x194abb){logger[_0x4032('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x2940da,_0x194abb);_0x561064(_0x194abb);});});}exports[_0x4032('0x1b')]=function(_0x4ffcda){var _0x5bb9f5=this;return new Promise(function(_0x29f244,_0x4ce170){return db[_0x4032('0x1c')][_0x4032('0x1d')](_0x4ffcda['body'],{'raw':_0x4ffcda[_0x4032('0x1e')]?_0x4ffcda[_0x4032('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x4032('0x10')](function(_0x288125){logger['info'](_0x4032('0x1b'),_0x4ffcda);logger[_0x4032('0x12')]('CreateOpenchannelMessage',_0x4ffcda,JSON[_0x4032('0x14')](_0x288125));_0x29f244(_0x288125);})[_0x4032('0x1a')](function(_0x3165bb){logger[_0x4032('0x15')](_0x4032('0x1b'),_0x3165bb['message'],_0x4ffcda);_0x4ce170(_0x5bb9f5['error'](0x1f4,_0x3165bb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8c99176..f076370 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 _0xd8b0=['save','emit','./openchannelMessage.events'];(function(_0x140c9d,_0x173b2b){var _0x32c21d=function(_0x21e3d8){while(--_0x21e3d8){_0x140c9d['push'](_0x140c9d['shift']());}};_0x32c21d(++_0x173b2b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelMessageEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){OpenchannelMessageEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('openchannelMessage:'+_0x413284,_0x3f8b6f);OpenchannelMessageEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file +var _0xd8b0=['save','emit','./openchannelMessage.events'];(function(_0x3d13c4,_0x7f9da8){var _0x5f09e1=function(_0x38a185){while(--_0x38a185){_0x3d13c4['push'](_0x3d13c4['shift']());}};_0x5f09e1(++_0x7f9da8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelMessageEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){OpenchannelMessageEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('openchannelMessage:'+_0x413284,_0x3f8b6f);OpenchannelMessageEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ffddc5e..4605524 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 _0x6dac=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy'];(function(_0x430649,_0x5c8c37){var _0x31e3f9=function(_0x15d045){while(--_0x15d045){_0x430649['push'](_0x430649['shift']());}};_0x31e3f9(++_0x5c8c37);}(_0x6dac,0x16e));var _0xc6da=function(_0x3d8ace,_0x33e71d){_0x3d8ace=_0x3d8ace-0x0;var _0x52f54c=_0x6dac[_0x3d8ace];return _0x52f54c;};'use strict';var multer=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var path=require(_0xc6da('0x2'));var timeout=require(_0xc6da('0x3'));var express=require(_0xc6da('0x4'));var router=express[_0xc6da('0x5')]();var auth=require(_0xc6da('0x6'));var interaction=require(_0xc6da('0x7'));var config=require(_0xc6da('0x8'));var controller=require(_0xc6da('0x9'));router[_0xc6da('0xa')]('/',auth[_0xc6da('0xb')](),controller[_0xc6da('0xc')]);router['get'](_0xc6da('0xd'),auth[_0xc6da('0xb')](),controller[_0xc6da('0xe')]);router[_0xc6da('0xa')](_0xc6da('0xf'),auth[_0xc6da('0xb')](),controller[_0xc6da('0x10')]);router[_0xc6da('0xa')](_0xc6da('0x11'),auth['isAuthenticated'](),controller[_0xc6da('0x12')]);router[_0xc6da('0xa')](_0xc6da('0x13'),auth[_0xc6da('0xb')](),controller[_0xc6da('0x14')]);router[_0xc6da('0xa')](_0xc6da('0x15'),auth[_0xc6da('0xb')](),controller[_0xc6da('0x16')]);router[_0xc6da('0x17')]('/',auth[_0xc6da('0xb')](),controller[_0xc6da('0x18')]);router[_0xc6da('0x17')]('/:id/teams',auth[_0xc6da('0xb')](),controller[_0xc6da('0x19')]);router[_0xc6da('0x17')](_0xc6da('0x15'),auth[_0xc6da('0xb')](),controller[_0xc6da('0x1a')]);router['put'](_0xc6da('0xf'),auth[_0xc6da('0xb')](),controller[_0xc6da('0x1b')]);router[_0xc6da('0x1c')](_0xc6da('0xf'),auth['isAuthenticated'](),controller[_0xc6da('0x1d')]);router['delete'](_0xc6da('0x13'),auth[_0xc6da('0xb')](),controller[_0xc6da('0x1e')]);router[_0xc6da('0x1c')]('/:id/users',auth[_0xc6da('0xb')](),controller[_0xc6da('0x1f')]);module[_0xc6da('0x20')]=router; \ No newline at end of file +var _0x4312=['get','index','/describe','isAuthenticated','/:id','/:id/members','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0x54faff,_0x9a3b5e){var _0x5a784c=function(_0x3d1147){while(--_0x3d1147){_0x54faff['push'](_0x54faff['shift']());}};_0x5a784c(++_0x9a3b5e);}(_0x4312,0xaf));var _0x2431=function(_0x44799b,_0x269c0d){_0x44799b=_0x44799b-0x0;var _0x4b16e7=_0x4312[_0x44799b];return _0x4b16e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2431('0x0'));var timeout=require(_0x2431('0x1'));var express=require('express');var router=express[_0x2431('0x2')]();var auth=require(_0x2431('0x3'));var interaction=require(_0x2431('0x4'));var config=require(_0x2431('0x5'));var controller=require(_0x2431('0x6'));router[_0x2431('0x7')]('/',auth['isAuthenticated'](),controller[_0x2431('0x8')]);router['get'](_0x2431('0x9'),auth[_0x2431('0xa')](),controller['describe']);router[_0x2431('0x7')](_0x2431('0xb'),auth[_0x2431('0xa')](),controller['show']);router[_0x2431('0x7')](_0x2431('0xc'),auth[_0x2431('0xa')](),controller['getMembers']);router[_0x2431('0x7')]('/:id/teams',auth[_0x2431('0xa')](),controller[_0x2431('0xd')]);router[_0x2431('0x7')]('/:id/users',auth[_0x2431('0xa')](),controller[_0x2431('0xe')]);router[_0x2431('0xf')]('/',auth[_0x2431('0xa')](),controller['create']);router[_0x2431('0xf')](_0x2431('0x10'),auth[_0x2431('0xa')](),controller[_0x2431('0x11')]);router[_0x2431('0xf')](_0x2431('0x12'),auth[_0x2431('0xa')](),controller[_0x2431('0x13')]);router[_0x2431('0x14')]('/:id',auth[_0x2431('0xa')](),controller[_0x2431('0x15')]);router[_0x2431('0x16')](_0x2431('0xb'),auth[_0x2431('0xa')](),controller[_0x2431('0x17')]);router[_0x2431('0x16')](_0x2431('0x10'),auth[_0x2431('0xa')](),controller[_0x2431('0x18')]);router[_0x2431('0x16')](_0x2431('0x12'),auth[_0x2431('0xa')](),controller[_0x2431('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 31c0b49..68a9e11 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 _0x51d7=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x1cbcdf,_0x237b40){var _0x513b1f=function(_0x5b0da6){while(--_0x5b0da6){_0x1cbcdf['push'](_0x1cbcdf['shift']());}};_0x513b1f(++_0x237b40);}(_0x51d7,0xcf));var _0x751d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x51d7[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x751d('0x0'));module[_0x751d('0x1')]={'name':{'type':Sequelize[_0x751d('0x2')],'unique':_0x751d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x751d('0x2')]},'timeout':{'type':Sequelize[_0x751d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x751d('0x5')](_0x751d('0x6'),_0x751d('0x7'),_0x751d('0x8'))}}; \ No newline at end of file +var _0xe296=['INTEGER','ENUM','beepall','sequelize','exports','STRING','name'];(function(_0x38ab55,_0x312314){var _0x3bd11a=function(_0x47671e){while(--_0x47671e){_0x38ab55['push'](_0x38ab55['shift']());}};_0x3bd11a(++_0x312314);}(_0xe296,0x1d1));var _0x6e29=function(_0x52b37a,_0x100dee){_0x52b37a=_0x52b37a-0x0;var _0x2c1790=_0xe296[_0x52b37a];return _0x2c1790;};'use strict';var Sequelize=require(_0x6e29('0x0'));module[_0x6e29('0x1')]={'name':{'type':Sequelize[_0x6e29('0x2')],'unique':_0x6e29('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6e29('0x2')]},'timeout':{'type':Sequelize[_0x6e29('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6e29('0x5')]('rrmemory',_0x6e29('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 50c354f..2cb4e2d 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 _0xda19=['filter','merge','map','key','options','includeAll','include','rows','catch','show','params','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','sort','pick','findAll','User','UserId','agent','openchannelPause','updatedAt','count','createdAt','getTeams','Team','rawAttributes','addTeams','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','userOpenchannelQueue:save','ids','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','all','union','compact','value','transaction','removeTeams','addAgents','omit','emit','removeAgents','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','OpenchannelQueue','model','keys','query','intersection','attributes','fields','length','nolimit','order','where'];(function(_0xeaff16,_0x2208ea){var _0x56b1a4=function(_0x2d0283){while(--_0x2d0283){_0xeaff16['push'](_0xeaff16['shift']());}};_0x56b1a4(++_0x2208ea);}(_0xda19,0xd5));var _0x9da1=function(_0x356294,_0x3fdd67){_0x356294=_0x356294-0x0;var _0x596c56=_0xda19[_0x356294];return _0x596c56;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9da1('0x0'));var rimraf=require(_0x9da1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9da1('0x2'));var rp=require('request-promise');var moment=require(_0x9da1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9da1('0x4'));var util=require(_0x9da1('0x5'));var path=require(_0x9da1('0x6'));var sox=require(_0x9da1('0x7'));var csv=require(_0x9da1('0x8'));var ejs=require(_0x9da1('0x9'));var fs=require('fs');var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var hardwareService=require(_0x9da1('0x11'));var logger=require(_0x9da1('0x12'))(_0x9da1('0x13'));var utils=require(_0x9da1('0x14'));var config=require(_0x9da1('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9da1('0x16')](config['redis'],{'host':_0x9da1('0x17'),'port':0x18eb});var socket=require(_0x9da1('0x18'))(new Redis(config[_0x9da1('0x19')]));require(_0x9da1('0x1a'))['register'](socket);function respondWithStatusCode(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0xcc;return function(_0x4d17e1){if(_0x4d17e1){return _0x2837e3[_0x9da1('0x1b')](_0x535a13);}return _0x2837e3['status'](_0x535a13)[_0x9da1('0x1c')]();};}function respondWithResult(_0x43c093,_0x37653d){_0x37653d=_0x37653d||0xc8;return function(_0x1a1a6b){if(_0x1a1a6b){return _0x43c093[_0x9da1('0x1d')](_0x37653d)['json'](_0x1a1a6b);}};}function respondWithFilteredResult(_0x16f75a,_0x116a76){return function(_0xf83bf8){if(_0xf83bf8){var _0x77347a=_0xf83bf8['count'],_0xfb278d=_0x116a76[_0x9da1('0x1e')],_0x42a9c7=_0x116a76[_0x9da1('0x1e')]+_0x116a76[_0x9da1('0x1f')],_0x497676;if(_0x42a9c7>=_0x77347a){_0x42a9c7=_0x77347a;_0x497676=0xc8;}else{_0x497676=0xce;}_0x16f75a[_0x9da1('0x1d')](_0x497676);return _0x16f75a[_0x9da1('0x20')](_0x9da1('0x21'),_0xfb278d+'-'+_0x42a9c7+'/'+_0x77347a)[_0x9da1('0x22')](_0xf83bf8);}return null;};}function patchUpdates(_0x47e5cf){return function(_0x1a459c){try{jsonpatch[_0x9da1('0x23')](_0x1a459c,_0x47e5cf,!![]);}catch(_0x9c3b37){return BPromise[_0x9da1('0x24')](_0x9c3b37);}return _0x1a459c[_0x9da1('0x25')]();};}function saveUpdates(_0x4e9d7d,_0x5454d3){return function(_0x14793b){if(_0x14793b){return _0x14793b[_0x9da1('0x26')](_0x4e9d7d)[_0x9da1('0x27')](function(_0x330219){return _0x330219;});}return null;};}function removeEntity(_0x32eb55,_0x165b73){return function(_0x4c60aa){if(_0x4c60aa){return _0x4c60aa[_0x9da1('0x28')]()[_0x9da1('0x27')](function(){var _0x4fd25a=_0x4c60aa[_0x9da1('0x29')]({'plain':!![]});var _0x3f5680='OpenchannelQueues';return db[_0x9da1('0x2a')][_0x9da1('0x28')]({'where':{'type':_0x3f5680,'resourceId':_0x4fd25a['id']}})['then'](function(){return _0x4c60aa;});})[_0x9da1('0x27')](function(){_0x32eb55[_0x9da1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c09ed,_0x67dbc8){return function(_0x47055e){if(!_0x47055e){_0x5c09ed['sendStatus'](0x194);}return _0x47055e;};}function handleError(_0x27c6e2,_0x5db5c2){_0x5db5c2=_0x5db5c2||0x1f4;return function(_0x5a6f2d){logger['error'](_0x5a6f2d[_0x9da1('0x2b')]);if(_0x5a6f2d[_0x9da1('0x2c')]){delete _0x5a6f2d[_0x9da1('0x2c')];}_0x27c6e2[_0x9da1('0x1d')](_0x5db5c2)[_0x9da1('0x2d')](_0x5a6f2d);};}exports['index']=function(_0x269628,_0x4e6083){var _0x1feae0={},_0x235ced={},_0x5b38b3={'count':0x0,'rows':[]};var _0xc29ba8=db[_0x9da1('0x2e')]['rawAttributes'];_0x235ced[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8);_0x235ced[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0x269628['query']);_0x235ced['filters']=_[_0x9da1('0x32')](_0x235ced[_0x9da1('0x2f')],_0x235ced[_0x9da1('0x31')]);_0x1feae0[_0x9da1('0x33')]=_[_0x9da1('0x32')](_0x235ced['model'],qs[_0x9da1('0x34')](_0x269628[_0x9da1('0x31')][_0x9da1('0x34')]));_0x1feae0[_0x9da1('0x33')]=_0x1feae0[_0x9da1('0x33')][_0x9da1('0x35')]?_0x1feae0['attributes']:_0x235ced[_0x9da1('0x2f')];if(!_0x269628['query']['hasOwnProperty'](_0x9da1('0x36'))){_0x1feae0['limit']=qs[_0x9da1('0x1f')](_0x269628[_0x9da1('0x31')][_0x9da1('0x1f')]);_0x1feae0[_0x9da1('0x1e')]=qs[_0x9da1('0x1e')](_0x269628[_0x9da1('0x31')][_0x9da1('0x1e')]);}_0x1feae0[_0x9da1('0x37')]=qs['sort'](_0x269628[_0x9da1('0x31')]['sort']);_0x1feae0[_0x9da1('0x38')]=qs['filters'](_['pick'](_0x269628[_0x9da1('0x31')],_0x235ced['filters']));if(_0x269628[_0x9da1('0x31')][_0x9da1('0x39')]){_0x1feae0['where']=_[_0x9da1('0x3a')](_0x1feae0[_0x9da1('0x38')],{'$or':_[_0x9da1('0x3b')](_0xc29ba8,function(_0x468d91){if(_0x468d91['type'][_0x9da1('0x3c')]!=='VIRTUAL'){var _0x2bb9e4={};_0x2bb9e4[_0x468d91['field']]={'$like':'%'+_0x269628[_0x9da1('0x31')][_0x9da1('0x39')]+'%'};return _0x2bb9e4;}})});}_0x1feae0=_['merge']({},_0x1feae0,_0x269628[_0x9da1('0x3d')]);var _0xca8d9b={'where':_0x1feae0[_0x9da1('0x38')]};return db['OpenchannelQueue']['count'](_0xca8d9b)['then'](function(_0x27e78c){_0x5b38b3['count']=_0x27e78c;if(_0x269628[_0x9da1('0x31')][_0x9da1('0x3e')]){_0x1feae0[_0x9da1('0x3f')]=[{'all':!![]}];}return db[_0x9da1('0x2e')]['findAll'](_0x1feae0);})[_0x9da1('0x27')](function(_0x2e1b8b){_0x5b38b3[_0x9da1('0x40')]=_0x2e1b8b;return _0x5b38b3;})[_0x9da1('0x27')](respondWithFilteredResult(_0x4e6083,_0x1feae0))[_0x9da1('0x41')](handleError(_0x4e6083,null));};exports[_0x9da1('0x42')]=function(_0x28e0b2,_0x4f78b1){var _0x467350={'raw':!![],'where':{'id':_0x28e0b2[_0x9da1('0x43')]['id']}},_0x515f3f={};_0x515f3f['model']=_[_0x9da1('0x30')](db[_0x9da1('0x2e')]['rawAttributes']);_0x515f3f[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0x28e0b2['query']);_0x515f3f[_0x9da1('0x44')]=_['intersection'](_0x515f3f[_0x9da1('0x2f')],_0x515f3f[_0x9da1('0x31')]);_0x467350['attributes']=_['intersection'](_0x515f3f[_0x9da1('0x2f')],qs[_0x9da1('0x34')](_0x28e0b2[_0x9da1('0x31')][_0x9da1('0x34')]));_0x467350[_0x9da1('0x33')]=_0x467350[_0x9da1('0x33')][_0x9da1('0x35')]?_0x467350[_0x9da1('0x33')]:_0x515f3f['model'];if(_0x28e0b2[_0x9da1('0x31')][_0x9da1('0x3e')]){_0x467350[_0x9da1('0x3f')]=[{'all':!![]}];}_0x467350=_['merge']({},_0x467350,_0x28e0b2[_0x9da1('0x3d')]);return db[_0x9da1('0x2e')][_0x9da1('0x45')](_0x467350)['then'](handleEntityNotFound(_0x4f78b1,null))[_0x9da1('0x27')](respondWithResult(_0x4f78b1,null))[_0x9da1('0x41')](handleError(_0x4f78b1,null));};exports[_0x9da1('0x46')]=function(_0x516bdd,_0xd243a4){return db['OpenchannelQueue']['create'](_0x516bdd[_0x9da1('0x47')],{})[_0x9da1('0x27')](function(_0x5afbc7){var _0x712d10=_0x516bdd[_0x9da1('0x48')]['get']({'plain':!![]});if(!_0x712d10)throw new Error(_0x9da1('0x49'));if(_0x712d10[_0x9da1('0x4a')]===_0x9da1('0x48')){var _0x3a529d=_0x5afbc7[_0x9da1('0x29')]({'plain':!![]});var _0x39ca29=_0x9da1('0x4b');return db[_0x9da1('0x4c')][_0x9da1('0x45')]({'where':{'name':_0x39ca29,'userProfileId':_0x712d10['userProfileId']},'raw':!![]})[_0x9da1('0x27')](function(_0xe6c667){if(_0xe6c667&&_0xe6c667[_0x9da1('0x4d')]===0x0){return db[_0x9da1('0x2a')]['create']({'name':_0x3a529d['name'],'resourceId':_0x3a529d['id'],'type':_0xe6c667[_0x9da1('0x2c')],'sectionId':_0xe6c667['id']},{})[_0x9da1('0x27')](function(){return _0x5afbc7;});}else{return _0x5afbc7;}})[_0x9da1('0x41')](function(_0x1f11c5){logger[_0x9da1('0x4e')](_0x9da1('0x4f'),_0x1f11c5);throw _0x1f11c5;});}return _0x5afbc7;})[_0x9da1('0x27')](respondWithResult(_0xd243a4,0xc9))[_0x9da1('0x41')](handleError(_0xd243a4,null));};exports[_0x9da1('0x26')]=function(_0x444a2a,_0x868167){if(_0x444a2a[_0x9da1('0x47')]['id']){delete _0x444a2a[_0x9da1('0x47')]['id'];}return db[_0x9da1('0x2e')]['find']({'where':{'id':_0x444a2a[_0x9da1('0x43')]['id']}})[_0x9da1('0x27')](handleEntityNotFound(_0x868167,null))['then'](saveUpdates(_0x444a2a[_0x9da1('0x47')],null))['then'](respondWithResult(_0x868167,null))[_0x9da1('0x41')](handleError(_0x868167,null));};exports['destroy']=function(_0x5df0d8,_0x5472e3){return db[_0x9da1('0x2e')][_0x9da1('0x45')]({'where':{'id':_0x5df0d8[_0x9da1('0x43')]['id']}})[_0x9da1('0x27')](handleEntityNotFound(_0x5472e3,null))[_0x9da1('0x27')](removeEntity(_0x5472e3,null))[_0x9da1('0x41')](handleError(_0x5472e3,null));};exports[_0x9da1('0x50')]=function(_0x17fe14,_0x53cdc3){return db[_0x9da1('0x2e')][_0x9da1('0x50')]()[_0x9da1('0x27')](respondWithResult(_0x53cdc3,null))[_0x9da1('0x41')](handleError(_0x53cdc3,null));};exports[_0x9da1('0x51')]=function(_0x4607a9,_0x2020d0,_0x3c01c3){var _0xfa8d3f={'raw':!![],'where':{}},_0x3f52c9={},_0x5bd8e0;return db[_0x9da1('0x2e')][_0x9da1('0x52')]({'where':{'id':_0x4607a9['params']['id']}})[_0x9da1('0x27')](handleEntityNotFound(_0x2020d0,null))[_0x9da1('0x27')](function(_0x1eeece){if(_0x1eeece){_0x5bd8e0=_0x1eeece[_0x9da1('0x29')]({'plain':!![]});_0x3f52c9[_0x9da1('0x2f')]=_[_0x9da1('0x30')](db[_0x9da1('0x53')]['rawAttributes']);_0x3f52c9[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0x4607a9[_0x9da1('0x31')]);_0x3f52c9[_0x9da1('0x44')]=_['intersection'](_0x3f52c9[_0x9da1('0x2f')],_0x3f52c9['query']);_0xfa8d3f[_0x9da1('0x33')]=_[_0x9da1('0x32')](_0x3f52c9[_0x9da1('0x2f')],qs[_0x9da1('0x34')](_0x4607a9[_0x9da1('0x31')][_0x9da1('0x34')]));_0xfa8d3f['attributes']=_0xfa8d3f['attributes'][_0x9da1('0x35')]?_0xfa8d3f['attributes']:_0x3f52c9['model'];if(!_0x4607a9['query'][_0x9da1('0x54')]('nolimit')){_0xfa8d3f[_0x9da1('0x1f')]=qs['limit'](_0x4607a9[_0x9da1('0x31')][_0x9da1('0x1f')]);_0xfa8d3f['offset']=qs[_0x9da1('0x1e')](_0x4607a9[_0x9da1('0x31')]['offset']);}_0xfa8d3f[_0x9da1('0x37')]=qs[_0x9da1('0x55')](_0x4607a9['query']['sort']);_0xfa8d3f[_0x9da1('0x38')]=qs[_0x9da1('0x44')](_[_0x9da1('0x56')](_0x4607a9[_0x9da1('0x31')],_0x3f52c9[_0x9da1('0x44')]));_0xfa8d3f[_0x9da1('0x38')]['OpenchannelQueueId']=_0x1eeece['id'];if(_0x4607a9[_0x9da1('0x31')]['filter']){_0xfa8d3f['where']=_[_0x9da1('0x3a')](_0xfa8d3f[_0x9da1('0x38')],{'$or':_[_0x9da1('0x3b')](_0xfa8d3f[_0x9da1('0x33')],function(_0x3382b1){var _0x2cdea1={};_0x2cdea1[_0x3382b1]={'$like':'%'+_0x4607a9[_0x9da1('0x31')][_0x9da1('0x39')]+'%'};return _0x2cdea1;})});}_0xfa8d3f=_[_0x9da1('0x3a')]({},_0xfa8d3f,_0x4607a9['options']);return db[_0x9da1('0x53')][_0x9da1('0x57')](_0xfa8d3f);}})[_0x9da1('0x27')](function(_0xc0cd5f){if(_0xc0cd5f){return db[_0x9da1('0x58')]['findAndCountAll']({'where':{'id':_[_0x9da1('0x3b')](_0xc0cd5f,_0x9da1('0x59')),'role':_0x9da1('0x5a')},'attributes':['id',_0x9da1('0x2c'),_0x9da1('0x5b'),_0x9da1('0x5c'),'createdAt']});}})[_0x9da1('0x27')](function(_0x559c10){if(_0x559c10){return{'count':_0x559c10[_0x9da1('0x5d')],'rows':_['map'](_0x559c10[_0x9da1('0x40')],function(_0xdd3997){return{'membername':_0xdd3997[_0x9da1('0x2c')],'UserId':_0xdd3997['id'],'queue_name':_0x5bd8e0[_0x9da1('0x2c')],'OpenchannelQueueId':_0x5bd8e0['id'],'interface':util['format']('%s/%s','SIP',_0xdd3997[_0x9da1('0x2c')]),'penalty':0x0,'paused':_0xdd3997[_0x9da1('0x5b')],'createdAt':_0xdd3997[_0x9da1('0x5e')],'updatedAt':_0xdd3997[_0x9da1('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2020d0,_0xfa8d3f))['catch'](handleError(_0x2020d0,null));};exports[_0x9da1('0x5f')]=function(_0x327bb4,_0x3ed43e,_0x5d0e05){var _0x5b3114={};var _0x343d6d={};var _0x1deb93;var _0x114093;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x327bb4[_0x9da1('0x43')]['id']}})[_0x9da1('0x27')](handleEntityNotFound(_0x3ed43e,null))[_0x9da1('0x27')](function(_0x273719){if(_0x273719){_0x1deb93=_0x273719;_0x343d6d[_0x9da1('0x2f')]=_['keys'](db[_0x9da1('0x60')][_0x9da1('0x61')]);_0x343d6d[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0x327bb4['query']);_0x343d6d[_0x9da1('0x44')]=_[_0x9da1('0x32')](_0x343d6d[_0x9da1('0x2f')],_0x343d6d['query']);_0x5b3114[_0x9da1('0x33')]=_[_0x9da1('0x32')](_0x343d6d[_0x9da1('0x2f')],qs['fields'](_0x327bb4[_0x9da1('0x31')][_0x9da1('0x34')]));_0x5b3114['attributes']=_0x5b3114[_0x9da1('0x33')]['length']?_0x5b3114[_0x9da1('0x33')]:_0x343d6d['model'];_0x5b3114[_0x9da1('0x37')]=qs[_0x9da1('0x55')](_0x327bb4[_0x9da1('0x31')][_0x9da1('0x55')]);_0x5b3114[_0x9da1('0x38')]=qs[_0x9da1('0x44')](_[_0x9da1('0x56')](_0x327bb4[_0x9da1('0x31')],_0x343d6d[_0x9da1('0x44')]));if(_0x327bb4[_0x9da1('0x31')][_0x9da1('0x39')]){_0x5b3114[_0x9da1('0x38')]=_[_0x9da1('0x3a')](_0x5b3114['where'],{'$or':_[_0x9da1('0x3b')](_0x5b3114[_0x9da1('0x33')],function(_0x27cec6){var _0x890b14={};_0x890b14[_0x27cec6]={'$like':'%'+_0x327bb4[_0x9da1('0x31')]['filter']+'%'};return _0x890b14;})});}_0x5b3114=_[_0x9da1('0x3a')]({},_0x5b3114,_0x327bb4[_0x9da1('0x3d')]);return _0x1deb93['getTeams'](_0x5b3114);}})['then'](function(_0x84f8d8){if(_0x84f8d8){_0x114093=_0x84f8d8[_0x9da1('0x35')];if(!_0x327bb4[_0x9da1('0x31')][_0x9da1('0x54')](_0x9da1('0x36'))){_0x5b3114[_0x9da1('0x1f')]=qs[_0x9da1('0x1f')](_0x327bb4[_0x9da1('0x31')][_0x9da1('0x1f')]);_0x5b3114[_0x9da1('0x1e')]=qs[_0x9da1('0x1e')](_0x327bb4[_0x9da1('0x31')][_0x9da1('0x1e')]);}return _0x1deb93['getTeams'](_0x5b3114);}})[_0x9da1('0x27')](function(_0x3a0a84){if(_0x3a0a84){return _0x3a0a84?{'count':_0x114093,'rows':_0x3a0a84}:null;}})[_0x9da1('0x27')](respondWithResult(_0x3ed43e,null))[_0x9da1('0x41')](handleError(_0x3ed43e,null));};exports[_0x9da1('0x62')]=function(_0x5e6b67,_0x3db75f,_0x354c5a){var _0x53ab6a=_0x5e6b67[_0x9da1('0x47')]['ids'];return db[_0x9da1('0x60')]['findAll']({'where':{'id':_0x53ab6a},'attributes':['id'],'include':[{'model':db[_0x9da1('0x58')],'as':_0x9da1('0x63'),'attributes':['id',_0x9da1('0x2c'),_0x9da1('0x64'),_0x9da1('0x65'),_0x9da1('0x66')],'raw':!![]}]})[_0x9da1('0x27')](function(_0x1fa9c5){if(_0x1fa9c5){var _0x118e26=_[_0x9da1('0x67')](_0x1fa9c5,function(_0xbd3a16){var _0x109676=_0xbd3a16['get']({'plain':!![]});return _0x109676[_0x9da1('0x63')];});return db[_0x9da1('0x2e')][_0x9da1('0x45')]({'where':{'id':_0x5e6b67[_0x9da1('0x43')]['id']}})[_0x9da1('0x27')](function(_0x1dd479){return db['sequelize']['transaction'](function(_0x3d0544){return _0x1dd479[_0x9da1('0x62')](_0x53ab6a,{'transaction':_0x3d0544})[_0x9da1('0x27')](function(){return BPromise['each'](_0x118e26,function(_0x4bf74c){return db[_0x9da1('0x53')][_0x9da1('0x68')]({'where':{'UserId':_0x4bf74c['id'],'OpenchannelQueueId':_0x5e6b67[_0x9da1('0x43')]['id']},'transaction':_0x3d0544});});})[_0x9da1('0x27')](function(){_0x118e26[_0x9da1('0x69')](function(_0x2bfd0b){socket['emit'](_0x9da1('0x6a'),{'UserId':_0x2bfd0b['id'],'OpenchannelQueueId':_0x1dd479['id']});});});});});}})[_0x9da1('0x27')](respondWithStatusCode(_0x3db75f,null))['catch'](handleError(_0x3db75f,null));};exports['removeTeams']=function(_0x392d19,_0x5df5f7,_0x496ccd){return db[_0x9da1('0x60')][_0x9da1('0x57')]({'where':{'id':_0x392d19[_0x9da1('0x31')][_0x9da1('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x9da1('0x58')],'as':_0x9da1('0x63'),'attributes':['id'],'raw':!![]}]})[_0x9da1('0x27')](handleEntityNotFound(_0x5df5f7,null))[_0x9da1('0x27')](function(_0x5e9bfc){var _0x5569d5=_[_0x9da1('0x3b')](_0x5e9bfc,'id');var _0x3bfb3f=[];var _0x22196d=[];var _0x33fdd0=squel[_0x9da1('0x6c')]();_0x33fdd0[_0x9da1('0x6d')](_0x9da1('0x6e'))[_0x9da1('0x6f')]('team_has_openchannel_queues','tq')[_0x9da1('0x70')]('user_has_teams','ut',_0x9da1('0x71'))[_0x9da1('0x38')](_0x9da1('0x72'),_0x392d19[_0x9da1('0x43')]['id']);for(var _0x4b4418=0x0;_0x4b4418<_0x5e9bfc[_0x9da1('0x35')];_0x4b4418+=0x1){let _0xe59156=_0x5e9bfc[_0x4b4418];for(var _0x4d9788=0x0;_0x4d9788<_0xe59156[_0x9da1('0x63')]['length'];_0x4d9788+=0x1){let _0x174d15=_0xe59156[_0x9da1('0x63')][_0x4d9788];var _0x3441d7=_0x33fdd0[_0x9da1('0x73')]();_0x3441d7['where'](_0x9da1('0x74'),_0x174d15['id']);_0x22196d[_0x9da1('0x75')](db[_0x9da1('0x76')][_0x9da1('0x31')](_0x3441d7[_0x9da1('0x77')](),{'type':db[_0x9da1('0x76')][_0x9da1('0x78')][_0x9da1('0x79')]})[_0x9da1('0x27')](function(_0x1faea5){if(_0x1faea5[_0x9da1('0x35')]===0x1){return _0x174d15['id'];}else{var _0x26f4fb=_[_0x9da1('0x7a')](_[_0x9da1('0x3b')](_0x1faea5,'TeamId'),function(_0x3a592e){return _['includes'](_0x5569d5,_0x3a592e);});if(_0x26f4fb){return _0x174d15['id'];}}}));}}return BPromise[_0x9da1('0x7b')](_0x22196d)['then'](function(_0x72c442){_0x3bfb3f=_(_0x3bfb3f)[_0x9da1('0x7c')](_0x72c442)[_0x9da1('0x7d')]()[_0x9da1('0x7e')]();return db[_0x9da1('0x2e')][_0x9da1('0x45')]({'where':{'id':_0x392d19[_0x9da1('0x43')]['id']}})[_0x9da1('0x27')](function(_0x5e71f5){return db[_0x9da1('0x76')][_0x9da1('0x7f')](function(_0x4fe1ff){return _0x5e71f5[_0x9da1('0x80')](_0x392d19[_0x9da1('0x31')][_0x9da1('0x6b')],{'transaction':_0x4fe1ff})['then'](function(){if(!_['isEmpty'](_0x3bfb3f)){return _0x5e71f5['removeAgents'](_0x3bfb3f,{'transaction':_0x4fe1ff});}})[_0x9da1('0x27')](function(){_0x3bfb3f[_0x9da1('0x69')](function(_0x79461c){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x79461c,'OpenchannelQueueId':_0x5e71f5['id']});});});});});});})[_0x9da1('0x27')](respondWithStatusCode(_0x5df5f7,null))[_0x9da1('0x41')](handleError(_0x5df5f7,null));};exports['addAgents']=function(_0x391252,_0x4c65d0,_0x4a83d1){return db['OpenchannelQueue'][_0x9da1('0x45')]({'where':{'id':_0x391252[_0x9da1('0x43')]['id']}})[_0x9da1('0x27')](handleEntityNotFound(_0x4c65d0,null))[_0x9da1('0x27')](function(_0xec68c6){if(_0xec68c6){return _0xec68c6[_0x9da1('0x81')](_0x391252[_0x9da1('0x47')][_0x9da1('0x6b')],_[_0x9da1('0x82')](_0x391252[_0x9da1('0x47')],[_0x9da1('0x6b'),'id'])||{})['spread'](function(_0x57d67b){for(var _0x589a40=0x0;_0x589a40<_0x391252[_0x9da1('0x47')][_0x9da1('0x6b')]['length'];_0x589a40+=0x1){socket[_0x9da1('0x83')](_0x9da1('0x6a'),{'UserId':_0x391252[_0x9da1('0x47')][_0x9da1('0x6b')][_0x589a40],'OpenchannelQueueId':_0x391252[_0x9da1('0x43')]['id']});}return _0x57d67b;});}})[_0x9da1('0x27')](respondWithResult(_0x4c65d0,null))[_0x9da1('0x41')](handleError(_0x4c65d0,null));};exports[_0x9da1('0x84')]=function(_0x515b4c,_0xd62883,_0x25fd3d){return db[_0x9da1('0x2e')][_0x9da1('0x45')]({'where':{'id':_0x515b4c[_0x9da1('0x43')]['id']}})['then'](handleEntityNotFound(_0xd62883,null))[_0x9da1('0x27')](function(_0x5cc8eb){if(_0x5cc8eb){return _0x5cc8eb[_0x9da1('0x84')](_0x515b4c[_0x9da1('0x31')][_0x9da1('0x6b')])['then'](function(){if(_['isArray'](_0x515b4c[_0x9da1('0x31')][_0x9da1('0x6b')])){for(var _0xb0c775=0x0;_0xb0c775<_0x515b4c['query'][_0x9da1('0x6b')][_0x9da1('0x35')];_0xb0c775+=0x1){socket['emit'](_0x9da1('0x85'),{'UserId':Number(_0x515b4c[_0x9da1('0x31')]['ids'][_0xb0c775]),'OpenchannelQueueId':Number(_0x515b4c['params']['id'])});}}else{socket['emit'](_0x9da1('0x85'),{'UserId':Number(_0x515b4c['query'][_0x9da1('0x6b')]),'OpenchannelQueueId':Number(_0x515b4c[_0x9da1('0x43')]['id'])});}});}})[_0x9da1('0x27')](respondWithStatusCode(_0xd62883,null))[_0x9da1('0x41')](handleError(_0xd62883,null));};exports[_0x9da1('0x86')]=function(_0x14acb4,_0x53412e,_0x355a71){var _0x4c299e={};var _0x492e1a={};var _0x449a17;var _0x45f9eb;return db[_0x9da1('0x2e')][_0x9da1('0x52')]({'where':{'id':_0x14acb4['params']['id']}})[_0x9da1('0x27')](handleEntityNotFound(_0x53412e,null))[_0x9da1('0x27')](function(_0x1554ba){if(_0x1554ba){_0x449a17=_0x1554ba;_0x492e1a[_0x9da1('0x2f')]=_[_0x9da1('0x30')](db[_0x9da1('0x58')][_0x9da1('0x61')]);_0x492e1a[_0x9da1('0x31')]=_['keys'](_0x14acb4[_0x9da1('0x31')]);_0x492e1a['filters']=_[_0x9da1('0x32')](_0x492e1a[_0x9da1('0x2f')],_0x492e1a[_0x9da1('0x31')]);_0x4c299e[_0x9da1('0x33')]=_[_0x9da1('0x32')](_0x492e1a[_0x9da1('0x2f')],qs[_0x9da1('0x34')](_0x14acb4[_0x9da1('0x31')]['fields']));_0x4c299e[_0x9da1('0x33')]=_0x4c299e[_0x9da1('0x33')][_0x9da1('0x35')]?_0x4c299e['attributes']:_0x492e1a['model'];_0x4c299e[_0x9da1('0x37')]=qs['sort'](_0x14acb4['query']['sort']);_0x4c299e['where']=qs['filters'](_[_0x9da1('0x56')](_0x14acb4[_0x9da1('0x31')],_0x492e1a[_0x9da1('0x44')]));if(_0x14acb4[_0x9da1('0x31')]['filter']){_0x4c299e[_0x9da1('0x38')]=_[_0x9da1('0x3a')](_0x4c299e[_0x9da1('0x38')],{'$or':_[_0x9da1('0x3b')](_0x4c299e[_0x9da1('0x33')],function(_0xd43b16){var _0x3ff89b={};_0x3ff89b[_0xd43b16]={'$like':'%'+_0x14acb4[_0x9da1('0x31')][_0x9da1('0x39')]+'%'};return _0x3ff89b;})});}_0x4c299e=_[_0x9da1('0x3a')]({},_0x4c299e,_0x14acb4[_0x9da1('0x3d')]);return _0x449a17['getAgents'](_0x4c299e);}})[_0x9da1('0x27')](function(_0x458384){if(_0x458384){_0x45f9eb=_0x458384['length'];if(!_0x14acb4['query'][_0x9da1('0x54')](_0x9da1('0x36'))){_0x4c299e[_0x9da1('0x1f')]=qs[_0x9da1('0x1f')](_0x14acb4[_0x9da1('0x31')]['limit']);_0x4c299e[_0x9da1('0x1e')]=qs['offset'](_0x14acb4[_0x9da1('0x31')][_0x9da1('0x1e')]);}return _0x449a17['getAgents'](_0x4c299e);}})[_0x9da1('0x27')](function(_0xe54678){if(_0xe54678){return _0xe54678?{'count':_0x45f9eb,'rows':_0xe54678}:null;}})[_0x9da1('0x27')](respondWithResult(_0x53412e,null))[_0x9da1('0x41')](handleError(_0x53412e,null));}; \ No newline at end of file +var _0xef17=['getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','TeamId','includes','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','offset','limit','json','apply','reject','save','then','destroy','OpenchannelQueues','UserProfileResource','end','error','name','index','OpenchannelQueue','rawAttributes','query','filters','model','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','map','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP'];(function(_0x2540a6,_0x1842d2){var _0x196805=function(_0x14c826){while(--_0x14c826){_0x2540a6['push'](_0x2540a6['shift']());}};_0x196805(++_0x1842d2);}(_0xef17,0x136));var _0x7ef1=function(_0x5b7c69,_0x45e577){_0x5b7c69=_0x5b7c69-0x0;var _0x219a75=_0xef17[_0x5b7c69];return _0x219a75;};'use strict';var pdf=require(_0x7ef1('0x0'));var emlformat=require(_0x7ef1('0x1'));var rimraf=require(_0x7ef1('0x2'));var zipdir=require(_0x7ef1('0x3'));var jsonpatch=require(_0x7ef1('0x4'));var rp=require(_0x7ef1('0x5'));var moment=require(_0x7ef1('0x6'));var BPromise=require(_0x7ef1('0x7'));var Mustache=require(_0x7ef1('0x8'));var util=require('util');var path=require(_0x7ef1('0x9'));var sox=require('sox');var csv=require(_0x7ef1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ef1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ef1('0xc'));var deskjs=require(_0x7ef1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7ef1('0xe'));var Papa=require(_0x7ef1('0xf'));var Redis=require(_0x7ef1('0x10'));var authService=require(_0x7ef1('0x11'));var qs=require(_0x7ef1('0x12'));var hardwareService=require(_0x7ef1('0x13'));var logger=require(_0x7ef1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7ef1('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x7ef1('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7ef1('0x17'))(new Redis(config[_0x7ef1('0x16')]));require(_0x7ef1('0x18'))[_0x7ef1('0x19')](socket);function respondWithStatusCode(_0x39ea9c,_0x317125){_0x317125=_0x317125||0xcc;return function(_0x26e9fb){if(_0x26e9fb){return _0x39ea9c[_0x7ef1('0x1a')](_0x317125);}return _0x39ea9c['status'](_0x317125)['end']();};}function respondWithResult(_0x267f0e,_0x5d0499){_0x5d0499=_0x5d0499||0xc8;return function(_0x20b843){if(_0x20b843){return _0x267f0e[_0x7ef1('0x1b')](_0x5d0499)['json'](_0x20b843);}};}function respondWithFilteredResult(_0x4e26d1,_0x5d269a){return function(_0x300645){if(_0x300645){var _0x4da0fa=_0x300645['count'],_0x3a5835=_0x5d269a[_0x7ef1('0x1c')],_0x5c6333=_0x5d269a['offset']+_0x5d269a[_0x7ef1('0x1d')],_0x5a7b2b;if(_0x5c6333>=_0x4da0fa){_0x5c6333=_0x4da0fa;_0x5a7b2b=0xc8;}else{_0x5a7b2b=0xce;}_0x4e26d1[_0x7ef1('0x1b')](_0x5a7b2b);return _0x4e26d1['set']('Content-Range',_0x3a5835+'-'+_0x5c6333+'/'+_0x4da0fa)[_0x7ef1('0x1e')](_0x300645);}return null;};}function patchUpdates(_0x5490b9){return function(_0x458459){try{jsonpatch[_0x7ef1('0x1f')](_0x458459,_0x5490b9,!![]);}catch(_0x2f8164){return BPromise[_0x7ef1('0x20')](_0x2f8164);}return _0x458459[_0x7ef1('0x21')]();};}function saveUpdates(_0xf24942,_0x20887b){return function(_0xd71594){if(_0xd71594){return _0xd71594['update'](_0xf24942)[_0x7ef1('0x22')](function(_0x3b118f){return _0x3b118f;});}return null;};}function removeEntity(_0x3f26fb,_0x3324d4){return function(_0x31b5bf){if(_0x31b5bf){return _0x31b5bf[_0x7ef1('0x23')]()[_0x7ef1('0x22')](function(){var _0x144e74=_0x31b5bf['get']({'plain':!![]});var _0x4b1ace=_0x7ef1('0x24');return db[_0x7ef1('0x25')][_0x7ef1('0x23')]({'where':{'type':_0x4b1ace,'resourceId':_0x144e74['id']}})[_0x7ef1('0x22')](function(){return _0x31b5bf;});})[_0x7ef1('0x22')](function(){_0x3f26fb['status'](0xcc)[_0x7ef1('0x26')]();});}};}function handleEntityNotFound(_0x9eca93,_0x445902){return function(_0x4af5f5){if(!_0x4af5f5){_0x9eca93[_0x7ef1('0x1a')](0x194);}return _0x4af5f5;};}function handleError(_0x238fdc,_0x21e8c5){_0x21e8c5=_0x21e8c5||0x1f4;return function(_0x58e7ee){logger[_0x7ef1('0x27')](_0x58e7ee['stack']);if(_0x58e7ee[_0x7ef1('0x28')]){delete _0x58e7ee[_0x7ef1('0x28')];}_0x238fdc['status'](_0x21e8c5)['send'](_0x58e7ee);};}exports[_0x7ef1('0x29')]=function(_0x1136dc,_0x5ab3a5){var _0xbf918d={},_0x56fe40={},_0x3aa113={'count':0x0,'rows':[]};var _0x47d6eb=db[_0x7ef1('0x2a')][_0x7ef1('0x2b')];_0x56fe40['model']=_['keys'](_0x47d6eb);_0x56fe40['query']=_['keys'](_0x1136dc[_0x7ef1('0x2c')]);_0x56fe40[_0x7ef1('0x2d')]=_['intersection'](_0x56fe40[_0x7ef1('0x2e')],_0x56fe40['query']);_0xbf918d['attributes']=_[_0x7ef1('0x2f')](_0x56fe40['model'],qs[_0x7ef1('0x30')](_0x1136dc[_0x7ef1('0x2c')][_0x7ef1('0x30')]));_0xbf918d[_0x7ef1('0x31')]=_0xbf918d['attributes'][_0x7ef1('0x32')]?_0xbf918d[_0x7ef1('0x31')]:_0x56fe40['model'];if(!_0x1136dc['query']['hasOwnProperty']('nolimit')){_0xbf918d[_0x7ef1('0x1d')]=qs['limit'](_0x1136dc[_0x7ef1('0x2c')][_0x7ef1('0x1d')]);_0xbf918d[_0x7ef1('0x1c')]=qs[_0x7ef1('0x1c')](_0x1136dc[_0x7ef1('0x2c')][_0x7ef1('0x1c')]);}_0xbf918d[_0x7ef1('0x33')]=qs[_0x7ef1('0x34')](_0x1136dc[_0x7ef1('0x2c')][_0x7ef1('0x34')]);_0xbf918d[_0x7ef1('0x35')]=qs['filters'](_[_0x7ef1('0x36')](_0x1136dc[_0x7ef1('0x2c')],_0x56fe40['filters']));if(_0x1136dc[_0x7ef1('0x2c')][_0x7ef1('0x37')]){_0xbf918d[_0x7ef1('0x35')]=_[_0x7ef1('0x38')](_0xbf918d[_0x7ef1('0x35')],{'$or':_['map'](_0x47d6eb,function(_0xd89a7c){if(_0xd89a7c[_0x7ef1('0x39')][_0x7ef1('0x3a')]!==_0x7ef1('0x3b')){var _0x3a317e={};_0x3a317e[_0xd89a7c[_0x7ef1('0x3c')]]={'$like':'%'+_0x1136dc[_0x7ef1('0x2c')][_0x7ef1('0x37')]+'%'};return _0x3a317e;}})});}_0xbf918d=_[_0x7ef1('0x38')]({},_0xbf918d,_0x1136dc[_0x7ef1('0x3d')]);var _0x252176={'where':_0xbf918d[_0x7ef1('0x35')]};return db[_0x7ef1('0x2a')][_0x7ef1('0x3e')](_0x252176)[_0x7ef1('0x22')](function(_0x565d83){_0x3aa113[_0x7ef1('0x3e')]=_0x565d83;if(_0x1136dc[_0x7ef1('0x2c')][_0x7ef1('0x3f')]){_0xbf918d[_0x7ef1('0x40')]=[{'all':!![]}];}return db[_0x7ef1('0x2a')][_0x7ef1('0x41')](_0xbf918d);})[_0x7ef1('0x22')](function(_0xa2693b){_0x3aa113[_0x7ef1('0x42')]=_0xa2693b;return _0x3aa113;})[_0x7ef1('0x22')](respondWithFilteredResult(_0x5ab3a5,_0xbf918d))[_0x7ef1('0x43')](handleError(_0x5ab3a5,null));};exports[_0x7ef1('0x44')]=function(_0x2fb6c4,_0x56036d){var _0x1b21a8={'raw':!![],'where':{'id':_0x2fb6c4[_0x7ef1('0x45')]['id']}},_0x2645d6={};_0x2645d6[_0x7ef1('0x2e')]=_[_0x7ef1('0x46')](db[_0x7ef1('0x2a')]['rawAttributes']);_0x2645d6[_0x7ef1('0x2c')]=_[_0x7ef1('0x46')](_0x2fb6c4[_0x7ef1('0x2c')]);_0x2645d6[_0x7ef1('0x2d')]=_[_0x7ef1('0x2f')](_0x2645d6[_0x7ef1('0x2e')],_0x2645d6['query']);_0x1b21a8[_0x7ef1('0x31')]=_[_0x7ef1('0x2f')](_0x2645d6[_0x7ef1('0x2e')],qs[_0x7ef1('0x30')](_0x2fb6c4['query'][_0x7ef1('0x30')]));_0x1b21a8['attributes']=_0x1b21a8['attributes'][_0x7ef1('0x32')]?_0x1b21a8['attributes']:_0x2645d6[_0x7ef1('0x2e')];if(_0x2fb6c4['query'][_0x7ef1('0x3f')]){_0x1b21a8[_0x7ef1('0x40')]=[{'all':!![]}];}_0x1b21a8=_[_0x7ef1('0x38')]({},_0x1b21a8,_0x2fb6c4[_0x7ef1('0x3d')]);return db[_0x7ef1('0x2a')][_0x7ef1('0x47')](_0x1b21a8)[_0x7ef1('0x22')](handleEntityNotFound(_0x56036d,null))[_0x7ef1('0x22')](respondWithResult(_0x56036d,null))['catch'](handleError(_0x56036d,null));};exports['create']=function(_0x245379,_0x2d4398){return db['OpenchannelQueue'][_0x7ef1('0x48')](_0x245379[_0x7ef1('0x49')],{})[_0x7ef1('0x22')](function(_0x5ce876){var _0x495691=_0x245379[_0x7ef1('0x4a')]['get']({'plain':!![]});if(!_0x495691)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x495691[_0x7ef1('0x4b')]===_0x7ef1('0x4a')){var _0x254c97=_0x5ce876[_0x7ef1('0x4c')]({'plain':!![]});var _0x2f6d0f='OpenchannelQueues';return db[_0x7ef1('0x4d')]['find']({'where':{'name':_0x2f6d0f,'userProfileId':_0x495691[_0x7ef1('0x4e')]},'raw':!![]})['then'](function(_0x28a1c6){if(_0x28a1c6&&_0x28a1c6['autoAssociation']===0x0){return db['UserProfileResource'][_0x7ef1('0x48')]({'name':_0x254c97['name'],'resourceId':_0x254c97['id'],'type':_0x28a1c6[_0x7ef1('0x28')],'sectionId':_0x28a1c6['id']},{})[_0x7ef1('0x22')](function(){return _0x5ce876;});}else{return _0x5ce876;}})['catch'](function(_0xf2e252){logger[_0x7ef1('0x27')](_0x7ef1('0x4f'),_0xf2e252);throw _0xf2e252;});}return _0x5ce876;})['then'](respondWithResult(_0x2d4398,0xc9))[_0x7ef1('0x43')](handleError(_0x2d4398,null));};exports[_0x7ef1('0x50')]=function(_0x5102f3,_0x2906b2){if(_0x5102f3[_0x7ef1('0x49')]['id']){delete _0x5102f3[_0x7ef1('0x49')]['id'];}return db[_0x7ef1('0x2a')][_0x7ef1('0x47')]({'where':{'id':_0x5102f3[_0x7ef1('0x45')]['id']}})[_0x7ef1('0x22')](handleEntityNotFound(_0x2906b2,null))['then'](saveUpdates(_0x5102f3['body'],null))[_0x7ef1('0x22')](respondWithResult(_0x2906b2,null))[_0x7ef1('0x43')](handleError(_0x2906b2,null));};exports[_0x7ef1('0x23')]=function(_0xa38413,_0x129ed9){return db[_0x7ef1('0x2a')][_0x7ef1('0x47')]({'where':{'id':_0xa38413[_0x7ef1('0x45')]['id']}})[_0x7ef1('0x22')](handleEntityNotFound(_0x129ed9,null))[_0x7ef1('0x22')](removeEntity(_0x129ed9,null))[_0x7ef1('0x43')](handleError(_0x129ed9,null));};exports['describe']=function(_0x44ca8b,_0x37dc45){return db[_0x7ef1('0x2a')][_0x7ef1('0x51')]()[_0x7ef1('0x22')](respondWithResult(_0x37dc45,null))['catch'](handleError(_0x37dc45,null));};exports[_0x7ef1('0x52')]=function(_0x32ef05,_0x3c176e,_0x4806d6){var _0xfa8316={'raw':!![],'where':{}},_0x3e054e={},_0x5bbcfb;return db[_0x7ef1('0x2a')][_0x7ef1('0x53')]({'where':{'id':_0x32ef05[_0x7ef1('0x45')]['id']}})[_0x7ef1('0x22')](handleEntityNotFound(_0x3c176e,null))[_0x7ef1('0x22')](function(_0x2bf639){if(_0x2bf639){_0x5bbcfb=_0x2bf639[_0x7ef1('0x4c')]({'plain':!![]});_0x3e054e[_0x7ef1('0x2e')]=_[_0x7ef1('0x46')](db[_0x7ef1('0x54')][_0x7ef1('0x2b')]);_0x3e054e['query']=_[_0x7ef1('0x46')](_0x32ef05[_0x7ef1('0x2c')]);_0x3e054e['filters']=_[_0x7ef1('0x2f')](_0x3e054e[_0x7ef1('0x2e')],_0x3e054e[_0x7ef1('0x2c')]);_0xfa8316['attributes']=_[_0x7ef1('0x2f')](_0x3e054e[_0x7ef1('0x2e')],qs['fields'](_0x32ef05[_0x7ef1('0x2c')][_0x7ef1('0x30')]));_0xfa8316[_0x7ef1('0x31')]=_0xfa8316['attributes'][_0x7ef1('0x32')]?_0xfa8316[_0x7ef1('0x31')]:_0x3e054e[_0x7ef1('0x2e')];if(!_0x32ef05['query'][_0x7ef1('0x55')](_0x7ef1('0x56'))){_0xfa8316[_0x7ef1('0x1d')]=qs['limit'](_0x32ef05[_0x7ef1('0x2c')][_0x7ef1('0x1d')]);_0xfa8316['offset']=qs[_0x7ef1('0x1c')](_0x32ef05[_0x7ef1('0x2c')][_0x7ef1('0x1c')]);}_0xfa8316[_0x7ef1('0x33')]=qs[_0x7ef1('0x34')](_0x32ef05[_0x7ef1('0x2c')][_0x7ef1('0x34')]);_0xfa8316[_0x7ef1('0x35')]=qs[_0x7ef1('0x2d')](_['pick'](_0x32ef05[_0x7ef1('0x2c')],_0x3e054e['filters']));_0xfa8316[_0x7ef1('0x35')]['OpenchannelQueueId']=_0x2bf639['id'];if(_0x32ef05[_0x7ef1('0x2c')][_0x7ef1('0x37')]){_0xfa8316[_0x7ef1('0x35')]=_[_0x7ef1('0x38')](_0xfa8316['where'],{'$or':_[_0x7ef1('0x57')](_0xfa8316[_0x7ef1('0x31')],function(_0x346ae0){var _0x3a8d2b={};_0x3a8d2b[_0x346ae0]={'$like':'%'+_0x32ef05[_0x7ef1('0x2c')]['filter']+'%'};return _0x3a8d2b;})});}_0xfa8316=_[_0x7ef1('0x38')]({},_0xfa8316,_0x32ef05['options']);return db['UserOpenchannelQueue'][_0x7ef1('0x41')](_0xfa8316);}})[_0x7ef1('0x22')](function(_0x152b8c){if(_0x152b8c){return db[_0x7ef1('0x58')][_0x7ef1('0x59')]({'where':{'id':_['map'](_0x152b8c,_0x7ef1('0x5a')),'role':_0x7ef1('0x5b')},'attributes':['id','name',_0x7ef1('0x5c'),_0x7ef1('0x5d'),_0x7ef1('0x5e')]});}})[_0x7ef1('0x22')](function(_0x588e49){if(_0x588e49){return{'count':_0x588e49[_0x7ef1('0x3e')],'rows':_[_0x7ef1('0x57')](_0x588e49[_0x7ef1('0x42')],function(_0x2975e4){return{'membername':_0x2975e4['name'],'UserId':_0x2975e4['id'],'queue_name':_0x5bbcfb['name'],'OpenchannelQueueId':_0x5bbcfb['id'],'interface':util[_0x7ef1('0x5f')](_0x7ef1('0x60'),_0x7ef1('0x61'),_0x2975e4[_0x7ef1('0x28')]),'penalty':0x0,'paused':_0x2975e4[_0x7ef1('0x5c')],'createdAt':_0x2975e4[_0x7ef1('0x5e')],'updatedAt':_0x2975e4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c176e,_0xfa8316))['catch'](handleError(_0x3c176e,null));};exports[_0x7ef1('0x62')]=function(_0x52593d,_0x47b495,_0xbf256a){var _0x24f3ed={};var _0x5a38b6={};var _0x1de963;var _0x989610;return db[_0x7ef1('0x2a')][_0x7ef1('0x53')]({'where':{'id':_0x52593d[_0x7ef1('0x45')]['id']}})[_0x7ef1('0x22')](handleEntityNotFound(_0x47b495,null))[_0x7ef1('0x22')](function(_0x337518){if(_0x337518){_0x1de963=_0x337518;_0x5a38b6[_0x7ef1('0x2e')]=_[_0x7ef1('0x46')](db[_0x7ef1('0x63')][_0x7ef1('0x2b')]);_0x5a38b6['query']=_[_0x7ef1('0x46')](_0x52593d['query']);_0x5a38b6[_0x7ef1('0x2d')]=_['intersection'](_0x5a38b6['model'],_0x5a38b6[_0x7ef1('0x2c')]);_0x24f3ed[_0x7ef1('0x31')]=_[_0x7ef1('0x2f')](_0x5a38b6[_0x7ef1('0x2e')],qs[_0x7ef1('0x30')](_0x52593d[_0x7ef1('0x2c')]['fields']));_0x24f3ed[_0x7ef1('0x31')]=_0x24f3ed[_0x7ef1('0x31')][_0x7ef1('0x32')]?_0x24f3ed[_0x7ef1('0x31')]:_0x5a38b6[_0x7ef1('0x2e')];_0x24f3ed[_0x7ef1('0x33')]=qs[_0x7ef1('0x34')](_0x52593d['query']['sort']);_0x24f3ed[_0x7ef1('0x35')]=qs[_0x7ef1('0x2d')](_[_0x7ef1('0x36')](_0x52593d[_0x7ef1('0x2c')],_0x5a38b6[_0x7ef1('0x2d')]));if(_0x52593d[_0x7ef1('0x2c')][_0x7ef1('0x37')]){_0x24f3ed['where']=_[_0x7ef1('0x38')](_0x24f3ed[_0x7ef1('0x35')],{'$or':_[_0x7ef1('0x57')](_0x24f3ed['attributes'],function(_0x549d49){var _0x42b4a8={};_0x42b4a8[_0x549d49]={'$like':'%'+_0x52593d[_0x7ef1('0x2c')][_0x7ef1('0x37')]+'%'};return _0x42b4a8;})});}_0x24f3ed=_[_0x7ef1('0x38')]({},_0x24f3ed,_0x52593d['options']);return _0x1de963[_0x7ef1('0x62')](_0x24f3ed);}})[_0x7ef1('0x22')](function(_0x33c1b8){if(_0x33c1b8){_0x989610=_0x33c1b8['length'];if(!_0x52593d['query']['hasOwnProperty']('nolimit')){_0x24f3ed[_0x7ef1('0x1d')]=qs[_0x7ef1('0x1d')](_0x52593d[_0x7ef1('0x2c')][_0x7ef1('0x1d')]);_0x24f3ed[_0x7ef1('0x1c')]=qs[_0x7ef1('0x1c')](_0x52593d[_0x7ef1('0x2c')]['offset']);}return _0x1de963[_0x7ef1('0x62')](_0x24f3ed);}})[_0x7ef1('0x22')](function(_0x4ec546){if(_0x4ec546){return _0x4ec546?{'count':_0x989610,'rows':_0x4ec546}:null;}})['then'](respondWithResult(_0x47b495,null))[_0x7ef1('0x43')](handleError(_0x47b495,null));};exports[_0x7ef1('0x64')]=function(_0x4785fa,_0x478d2a,_0x1ba4e5){var _0x2c8d9f=_0x4785fa[_0x7ef1('0x49')][_0x7ef1('0x65')];return db[_0x7ef1('0x63')][_0x7ef1('0x41')]({'where':{'id':_0x2c8d9f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7ef1('0x28'),_0x7ef1('0x66'),_0x7ef1('0x67'),_0x7ef1('0x68')],'raw':!![]}]})[_0x7ef1('0x22')](function(_0x374617){if(_0x374617){var _0x20a84b=_[_0x7ef1('0x69')](_0x374617,function(_0x2f40e2){var _0x6fc955=_0x2f40e2[_0x7ef1('0x4c')]({'plain':!![]});return _0x6fc955[_0x7ef1('0x6a')];});return db[_0x7ef1('0x2a')]['find']({'where':{'id':_0x4785fa[_0x7ef1('0x45')]['id']}})[_0x7ef1('0x22')](function(_0x20dde3){return db[_0x7ef1('0x6b')][_0x7ef1('0x6c')](function(_0x3df2e5){return _0x20dde3[_0x7ef1('0x64')](_0x2c8d9f,{'transaction':_0x3df2e5})[_0x7ef1('0x22')](function(){return BPromise[_0x7ef1('0x6d')](_0x20a84b,function(_0x3b9e84){return db[_0x7ef1('0x54')][_0x7ef1('0x6e')]({'where':{'UserId':_0x3b9e84['id'],'OpenchannelQueueId':_0x4785fa[_0x7ef1('0x45')]['id']},'transaction':_0x3df2e5});});})['then'](function(){_0x20a84b[_0x7ef1('0x6f')](function(_0x95771d){socket[_0x7ef1('0x70')]('userOpenchannelQueue:save',{'UserId':_0x95771d['id'],'OpenchannelQueueId':_0x20dde3['id']});});});});});}})[_0x7ef1('0x22')](respondWithStatusCode(_0x478d2a,null))[_0x7ef1('0x43')](handleError(_0x478d2a,null));};exports[_0x7ef1('0x71')]=function(_0x2ab54b,_0x3cf485,_0x4d13af){return db[_0x7ef1('0x63')][_0x7ef1('0x41')]({'where':{'id':_0x2ab54b[_0x7ef1('0x2c')][_0x7ef1('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7ef1('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x7ef1('0x22')](handleEntityNotFound(_0x3cf485,null))[_0x7ef1('0x22')](function(_0x6698b0){var _0x360b1a=_['map'](_0x6698b0,'id');var _0x281d82=[];var _0x2d8f54=[];var _0x100069=squel[_0x7ef1('0x72')]();_0x100069[_0x7ef1('0x3c')]('tq.TeamId')[_0x7ef1('0x73')](_0x7ef1('0x74'),'tq')[_0x7ef1('0x75')](_0x7ef1('0x76'),'ut',_0x7ef1('0x77'))[_0x7ef1('0x35')](_0x7ef1('0x78'),_0x2ab54b['params']['id']);for(var _0x5c1082=0x0;_0x5c1082<_0x6698b0[_0x7ef1('0x32')];_0x5c1082+=0x1){let _0x58366d=_0x6698b0[_0x5c1082];for(var _0x1fa9ee=0x0;_0x1fa9ee<_0x58366d[_0x7ef1('0x6a')][_0x7ef1('0x32')];_0x1fa9ee+=0x1){let _0x4aab34=_0x58366d['Agents'][_0x1fa9ee];var _0x53d9a6=_0x100069['clone']();_0x53d9a6[_0x7ef1('0x35')](_0x7ef1('0x79'),_0x4aab34['id']);_0x2d8f54[_0x7ef1('0x7a')](db[_0x7ef1('0x6b')][_0x7ef1('0x2c')](_0x53d9a6[_0x7ef1('0x7b')](),{'type':db[_0x7ef1('0x6b')]['QueryTypes']['SELECT']})[_0x7ef1('0x22')](function(_0x5b0110){if(_0x5b0110[_0x7ef1('0x32')]===0x1){return _0x4aab34['id'];}else{var _0x3fd4b0=_['every'](_['map'](_0x5b0110,_0x7ef1('0x7c')),function(_0x1519ee){return _[_0x7ef1('0x7d')](_0x360b1a,_0x1519ee);});if(_0x3fd4b0){return _0x4aab34['id'];}}}));}}return BPromise['all'](_0x2d8f54)[_0x7ef1('0x22')](function(_0x5cff12){_0x281d82=_(_0x281d82)['union'](_0x5cff12)[_0x7ef1('0x7e')]()[_0x7ef1('0x7f')]();return db[_0x7ef1('0x2a')]['find']({'where':{'id':_0x2ab54b['params']['id']}})['then'](function(_0x1bcb58){return db[_0x7ef1('0x6b')][_0x7ef1('0x6c')](function(_0x4a70ed){return _0x1bcb58[_0x7ef1('0x71')](_0x2ab54b[_0x7ef1('0x2c')][_0x7ef1('0x65')],{'transaction':_0x4a70ed})[_0x7ef1('0x22')](function(){if(!_[_0x7ef1('0x80')](_0x281d82)){return _0x1bcb58['removeAgents'](_0x281d82,{'transaction':_0x4a70ed});}})[_0x7ef1('0x22')](function(){_0x281d82[_0x7ef1('0x6f')](function(_0x2f285e){socket[_0x7ef1('0x70')](_0x7ef1('0x81'),{'UserId':_0x2f285e,'OpenchannelQueueId':_0x1bcb58['id']});});});});});});})[_0x7ef1('0x22')](respondWithStatusCode(_0x3cf485,null))[_0x7ef1('0x43')](handleError(_0x3cf485,null));};exports[_0x7ef1('0x82')]=function(_0x51c8ca,_0x71eb1b,_0x14920f){return db[_0x7ef1('0x2a')][_0x7ef1('0x47')]({'where':{'id':_0x51c8ca[_0x7ef1('0x45')]['id']}})[_0x7ef1('0x22')](handleEntityNotFound(_0x71eb1b,null))[_0x7ef1('0x22')](function(_0x24cc65){if(_0x24cc65){return _0x24cc65['addAgents'](_0x51c8ca[_0x7ef1('0x49')]['ids'],_[_0x7ef1('0x83')](_0x51c8ca['body'],[_0x7ef1('0x65'),'id'])||{})[_0x7ef1('0x84')](function(_0x2e98a3){for(var _0xfb87bd=0x0;_0xfb87bd<_0x51c8ca['body']['ids']['length'];_0xfb87bd+=0x1){socket[_0x7ef1('0x70')]('userOpenchannelQueue:save',{'UserId':_0x51c8ca[_0x7ef1('0x49')][_0x7ef1('0x65')][_0xfb87bd],'OpenchannelQueueId':_0x51c8ca[_0x7ef1('0x45')]['id']});}return _0x2e98a3;});}})['then'](respondWithResult(_0x71eb1b,null))[_0x7ef1('0x43')](handleError(_0x71eb1b,null));};exports[_0x7ef1('0x85')]=function(_0x1ba785,_0x2eb8f9,_0xae57ee){return db['OpenchannelQueue']['find']({'where':{'id':_0x1ba785['params']['id']}})[_0x7ef1('0x22')](handleEntityNotFound(_0x2eb8f9,null))[_0x7ef1('0x22')](function(_0x2204f4){if(_0x2204f4){return _0x2204f4['removeAgents'](_0x1ba785[_0x7ef1('0x2c')][_0x7ef1('0x65')])[_0x7ef1('0x22')](function(){if(_[_0x7ef1('0x86')](_0x1ba785[_0x7ef1('0x2c')][_0x7ef1('0x65')])){for(var _0x3f9fb1=0x0;_0x3f9fb1<_0x1ba785[_0x7ef1('0x2c')][_0x7ef1('0x65')][_0x7ef1('0x32')];_0x3f9fb1+=0x1){socket[_0x7ef1('0x70')](_0x7ef1('0x81'),{'UserId':Number(_0x1ba785[_0x7ef1('0x2c')][_0x7ef1('0x65')][_0x3f9fb1]),'OpenchannelQueueId':Number(_0x1ba785[_0x7ef1('0x45')]['id'])});}}else{socket[_0x7ef1('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x1ba785['query'][_0x7ef1('0x65')]),'OpenchannelQueueId':Number(_0x1ba785['params']['id'])});}});}})[_0x7ef1('0x22')](respondWithStatusCode(_0x2eb8f9,null))[_0x7ef1('0x43')](handleError(_0x2eb8f9,null));};exports['getAgents']=function(_0x17e5b6,_0x39c0e3,_0x2c9d20){var _0x5ddf2c={};var _0x2ce8ac={};var _0x13092c;var _0x13d51a;return db[_0x7ef1('0x2a')][_0x7ef1('0x53')]({'where':{'id':_0x17e5b6[_0x7ef1('0x45')]['id']}})[_0x7ef1('0x22')](handleEntityNotFound(_0x39c0e3,null))[_0x7ef1('0x22')](function(_0x477d3d){if(_0x477d3d){_0x13092c=_0x477d3d;_0x2ce8ac[_0x7ef1('0x2e')]=_[_0x7ef1('0x46')](db['User']['rawAttributes']);_0x2ce8ac['query']=_[_0x7ef1('0x46')](_0x17e5b6['query']);_0x2ce8ac['filters']=_['intersection'](_0x2ce8ac[_0x7ef1('0x2e')],_0x2ce8ac[_0x7ef1('0x2c')]);_0x5ddf2c[_0x7ef1('0x31')]=_[_0x7ef1('0x2f')](_0x2ce8ac['model'],qs[_0x7ef1('0x30')](_0x17e5b6[_0x7ef1('0x2c')]['fields']));_0x5ddf2c['attributes']=_0x5ddf2c[_0x7ef1('0x31')][_0x7ef1('0x32')]?_0x5ddf2c[_0x7ef1('0x31')]:_0x2ce8ac[_0x7ef1('0x2e')];_0x5ddf2c['order']=qs[_0x7ef1('0x34')](_0x17e5b6[_0x7ef1('0x2c')][_0x7ef1('0x34')]);_0x5ddf2c[_0x7ef1('0x35')]=qs[_0x7ef1('0x2d')](_[_0x7ef1('0x36')](_0x17e5b6[_0x7ef1('0x2c')],_0x2ce8ac[_0x7ef1('0x2d')]));if(_0x17e5b6[_0x7ef1('0x2c')][_0x7ef1('0x37')]){_0x5ddf2c[_0x7ef1('0x35')]=_['merge'](_0x5ddf2c[_0x7ef1('0x35')],{'$or':_[_0x7ef1('0x57')](_0x5ddf2c['attributes'],function(_0x54e816){var _0x2fefc6={};_0x2fefc6[_0x54e816]={'$like':'%'+_0x17e5b6[_0x7ef1('0x2c')]['filter']+'%'};return _0x2fefc6;})});}_0x5ddf2c=_[_0x7ef1('0x38')]({},_0x5ddf2c,_0x17e5b6[_0x7ef1('0x3d')]);return _0x13092c[_0x7ef1('0x87')](_0x5ddf2c);}})['then'](function(_0x313e89){if(_0x313e89){_0x13d51a=_0x313e89[_0x7ef1('0x32')];if(!_0x17e5b6['query'][_0x7ef1('0x55')](_0x7ef1('0x56'))){_0x5ddf2c[_0x7ef1('0x1d')]=qs[_0x7ef1('0x1d')](_0x17e5b6[_0x7ef1('0x2c')][_0x7ef1('0x1d')]);_0x5ddf2c[_0x7ef1('0x1c')]=qs[_0x7ef1('0x1c')](_0x17e5b6[_0x7ef1('0x2c')][_0x7ef1('0x1c')]);}return _0x13092c[_0x7ef1('0x87')](_0x5ddf2c);}})[_0x7ef1('0x22')](function(_0x323770){if(_0x323770){return _0x323770?{'count':_0x13d51a,'rows':_0x323770}:null;}})[_0x7ef1('0x22')](respondWithResult(_0x39c0e3,null))['catch'](handleError(_0x39c0e3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 3739101..167aeef 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 _0x0bcf=['save','update','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x14e096,_0x345573){var _0x12d2f7=function(_0x5d5c06){while(--_0x5d5c06){_0x14e096['push'](_0x14e096['shift']());}};_0x12d2f7(++_0x345573);}(_0x0bcf,0x19e));var _0xf0bc=function(_0x15aef6,_0x25345c){_0x15aef6=_0x15aef6-0x0;var _0x422f3d=_0x0bcf[_0x15aef6];return _0x422f3d;};'use strict';var EventEmitter=require(_0xf0bc('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf0bc('0x1')](0x0);var events={'afterCreate':_0xf0bc('0x2'),'afterUpdate':_0xf0bc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5ec640){return function(_0x110c9d,_0x5a9aeb,_0x3fc15c){OpenchannelQueueEvents[_0xf0bc('0x4')](_0x5ec640+':'+_0x110c9d['id'],_0x110c9d);OpenchannelQueueEvents[_0xf0bc('0x4')](_0x5ec640,_0x110c9d);_0x3fc15c(null);};}for(var e in events){if(events[_0xf0bc('0x5')](e)){var event=events[e];OpenchannelQueue[_0xf0bc('0x6')](e,emitEvent(event));}}module[_0xf0bc('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x84d8=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x3360a2,_0x2f1dce){var _0xebde2c=function(_0x1f7f4e){while(--_0x1f7f4e){_0x3360a2['push'](_0x3360a2['shift']());}};_0xebde2c(++_0x2f1dce);}(_0x84d8,0x1d0));var _0x884d=function(_0x31d2a7,_0x524eb2){_0x31d2a7=_0x31d2a7-0x0;var _0x36984d=_0x84d8[_0x31d2a7];return _0x36984d;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x884d('0x0'))['db'][_0x884d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x884d('0x2'),'afterUpdate':_0x884d('0x3'),'afterDestroy':_0x884d('0x4')};function emitEvent(_0x2be88d){return function(_0x20cbd4,_0x4d61fe,_0x1b2a5e){OpenchannelQueueEvents['emit'](_0x2be88d+':'+_0x20cbd4['id'],_0x20cbd4);OpenchannelQueueEvents[_0x884d('0x5')](_0x2be88d,_0x20cbd4);_0x1b2a5e(null);};}for(var e in events){if(events[_0x884d('0x6')](e)){var event=events[e];OpenchannelQueue[_0x884d('0x7')](e,emitEvent(event));}}module[_0x884d('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 405c111..a6ef13f 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 _0x3d93=['../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d93,0x74));var _0x33d9=function(_0x5048a3,_0x4c96d0){_0x5048a3=_0x5048a3-0x0;var _0x26307c=_0x3d93[_0x5048a3];return _0x26307c;};'use strict';var _=require('lodash');var util=require(_0x33d9('0x0'));var logger=require(_0x33d9('0x1'))(_0x33d9('0x2'));var moment=require('moment');var BPromise=require(_0x33d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33d9('0x4'));var rimraf=require('rimraf');var config=require(_0x33d9('0x5'));var attributes=require(_0x33d9('0x6'));module[_0x33d9('0x7')]=function(_0x2aaf08,_0x88f837){return _0x2aaf08[_0x33d9('0x8')](_0x33d9('0x9'),attributes,{'tableName':_0x33d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d2=['openchannel_queues','lodash','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0xa5d2,0xe7));var _0x2a5d=function(_0x1333e7,_0x2394a6){_0x1333e7=_0x1333e7-0x0;var _0x534594=_0xa5d2[_0x1333e7];return _0x534594;};'use strict';var _=require(_0x2a5d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a5d('0x1'));var rp=require(_0x2a5d('0x2'));var fs=require('fs');var path=require(_0x2a5d('0x3'));var rimraf=require(_0x2a5d('0x4'));var config=require(_0x2a5d('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0x2a5d('0x6')]=function(_0x23cda1,_0x37ad86){return _0x23cda1[_0x2a5d('0x7')](_0x2a5d('0x8'),attributes,{'tableName':_0x2a5d('0x9'),'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 3a00d93..f9aa055 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 _0x7ac5=['find','where','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','stringify','code','error','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','raw','options','attributes','limit','include','map','model','debug'];(function(_0x56ec4b,_0x26e171){var _0x165bf6=function(_0x481725){while(--_0x481725){_0x56ec4b['push'](_0x56ec4b['shift']());}};_0x165bf6(++_0x26e171);}(_0x7ac5,0x18f));var _0x57ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ac5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x57ac('0x0'));var util=require(_0x57ac('0x1'));var moment=require(_0x57ac('0x2'));var BPromise=require(_0x57ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57ac('0x4'));var db=require(_0x57ac('0x5'))['db'];var utils=require(_0x57ac('0x6'));var logger=require(_0x57ac('0x7'))(_0x57ac('0x8'));var config=require(_0x57ac('0x9'));var jayson=require(_0x57ac('0xa'));var client=jayson[_0x57ac('0xb')][_0x57ac('0xc')]({'port':0x232a});config[_0x57ac('0xd')]=_[_0x57ac('0xe')](config[_0x57ac('0xd')],{'host':_0x57ac('0xf'),'port':0x18eb});var socket=require(_0x57ac('0x10'))(new Redis(config['redis']));require(_0x57ac('0x11'))[_0x57ac('0x12')](socket);function respondWithRpcPromise(_0x3e4d59,_0x29c9ce,_0x3ffd36){return new BPromise(function(_0x1abb47,_0x3afe14){return client[_0x57ac('0x13')](_0x3e4d59,_0x3ffd36)[_0x57ac('0x14')](function(_0x10f7dd){logger[_0x57ac('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x29c9ce,'request\x20sent');logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x29c9ce,_0x57ac('0x16'),JSON[_0x57ac('0x17')](_0x10f7dd));if(_0x10f7dd['error']){if(_0x10f7dd['error'][_0x57ac('0x18')]===0x1f4){logger[_0x57ac('0x19')](_0x57ac('0x1a'),_0x29c9ce,_0x10f7dd[_0x57ac('0x19')]['message']);return _0x3afe14(_0x10f7dd['error'][_0x57ac('0x1b')]);}logger['error'](_0x57ac('0x1a'),_0x29c9ce,_0x10f7dd[_0x57ac('0x19')][_0x57ac('0x1b')]);return _0x1abb47(_0x10f7dd[_0x57ac('0x19')][_0x57ac('0x1b')]);}else{logger['info'](_0x57ac('0x1a'),_0x29c9ce,_0x57ac('0x16'));_0x1abb47(_0x10f7dd[_0x57ac('0x1c')]['message']);}})[_0x57ac('0x1d')](function(_0x527988){logger[_0x57ac('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x29c9ce,_0x527988);_0x3afe14(_0x527988);});});}exports[_0x57ac('0x1e')]=function(_0x2c6d6e){var _0x353428=this;return new Promise(function(_0x408e5f,_0x1dec8b){return db[_0x57ac('0x1f')][_0x57ac('0x20')]({'raw':_0x2c6d6e['options']?_0x2c6d6e['options'][_0x57ac('0x21')]===undefined?!![]:![]:!![],'where':_0x2c6d6e[_0x57ac('0x22')]?_0x2c6d6e[_0x57ac('0x22')]['where']||null:null,'attributes':_0x2c6d6e[_0x57ac('0x22')]?_0x2c6d6e['options'][_0x57ac('0x23')]||null:null,'limit':_0x2c6d6e[_0x57ac('0x22')]?_0x2c6d6e['options'][_0x57ac('0x24')]||null:null,'include':_0x2c6d6e[_0x57ac('0x22')]?_0x2c6d6e['options'][_0x57ac('0x25')]?_[_0x57ac('0x26')](_0x2c6d6e['options'][_0x57ac('0x25')],function(_0x187224){return{'model':db[_0x187224[_0x57ac('0x27')]],'as':_0x187224['as'],'attributes':_0x187224[_0x57ac('0x23')],'include':_0x187224['include']?_[_0x57ac('0x26')](_0x187224['include'],function(_0x2eef8b){return{'model':db[_0x2eef8b[_0x57ac('0x27')]],'as':_0x2eef8b['as'],'attributes':_0x2eef8b[_0x57ac('0x23')],'include':_0x2eef8b['include']?_['map'](_0x2eef8b[_0x57ac('0x25')],function(_0x5dae66){return{'model':db[_0x5dae66[_0x57ac('0x27')]],'as':_0x5dae66['as'],'attributes':_0x5dae66[_0x57ac('0x23')]};}):[]};}):[]};}):[]:[]})[_0x57ac('0x14')](function(_0x409434){logger[_0x57ac('0x15')]('GetOpenchannelQueue',_0x2c6d6e);logger[_0x57ac('0x28')](_0x57ac('0x1e'),_0x2c6d6e,JSON['stringify'](_0x409434));_0x408e5f(_0x409434);})['catch'](function(_0x5e8b2a){logger[_0x57ac('0x19')](_0x57ac('0x1e'),_0x5e8b2a['message'],_0x2c6d6e);_0x1dec8b(_0x353428[_0x57ac('0x19')](0x1f4,_0x5e8b2a[_0x57ac('0x1b')]));});});};exports['ShowOpenchannelQueue']=function(_0x2de11f){var _0x5dfee0=this;return new Promise(function(_0x376a19,_0x55522){return db['OpenchannelQueue'][_0x57ac('0x29')]({'raw':_0x2de11f[_0x57ac('0x22')]?_0x2de11f[_0x57ac('0x22')][_0x57ac('0x21')]===undefined?!![]:![]:!![],'where':_0x2de11f[_0x57ac('0x22')]?_0x2de11f[_0x57ac('0x22')][_0x57ac('0x2a')]||null:null,'attributes':_0x2de11f[_0x57ac('0x22')]?_0x2de11f[_0x57ac('0x22')][_0x57ac('0x23')]||null:null,'include':_0x2de11f[_0x57ac('0x22')]?_0x2de11f[_0x57ac('0x22')][_0x57ac('0x25')]?_[_0x57ac('0x26')](_0x2de11f[_0x57ac('0x22')][_0x57ac('0x25')],function(_0x359d15){return{'model':db[_0x359d15['model']],'as':_0x359d15['as'],'attributes':_0x359d15['attributes'],'include':_0x359d15['include']?_[_0x57ac('0x26')](_0x359d15[_0x57ac('0x25')],function(_0x51fc32){return{'model':db[_0x51fc32[_0x57ac('0x27')]],'as':_0x51fc32['as'],'attributes':_0x51fc32[_0x57ac('0x23')],'include':_0x51fc32[_0x57ac('0x25')]?_['map'](_0x51fc32['include'],function(_0x1e1946){return{'model':db[_0x1e1946[_0x57ac('0x27')]],'as':_0x1e1946['as'],'attributes':_0x1e1946[_0x57ac('0x23')]};}):[]};}):[]};}):[]:[]})[_0x57ac('0x14')](function(_0x1005b8){logger['info'](_0x57ac('0x2b'),_0x2de11f);logger[_0x57ac('0x28')](_0x57ac('0x2b'),_0x2de11f,JSON[_0x57ac('0x17')](_0x1005b8));_0x376a19(_0x1005b8);})['catch'](function(_0x4235e1){logger[_0x57ac('0x19')](_0x57ac('0x2b'),_0x4235e1['message'],_0x2de11f);_0x55522(_0x5dfee0[_0x57ac('0x19')](0x1f4,_0x4235e1[_0x57ac('0x1b')]));});});}; \ No newline at end of file +var _0x8f75=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','findAll','options','raw','where','attributes','include','map','model','GetOpenchannelQueue','catch','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0xf760e6,_0x5587dc){var _0x54cc83=function(_0x45384f){while(--_0x45384f){_0xf760e6['push'](_0xf760e6['shift']());}};_0x54cc83(++_0x5587dc);}(_0x8f75,0x136));var _0x58f7=function(_0x1ca2af,_0x46a74b){_0x1ca2af=_0x1ca2af-0x0;var _0x311095=_0x8f75[_0x1ca2af];return _0x311095;};'use strict';var _=require(_0x58f7('0x0'));var util=require(_0x58f7('0x1'));var moment=require(_0x58f7('0x2'));var BPromise=require(_0x58f7('0x3'));var rs=require(_0x58f7('0x4'));var fs=require('fs');var Redis=require(_0x58f7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x58f7('0x6'))(_0x58f7('0x7'));var config=require(_0x58f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x58f7('0x9')][_0x58f7('0xa')]({'port':0x232a});config[_0x58f7('0xb')]=_[_0x58f7('0xc')](config[_0x58f7('0xb')],{'host':_0x58f7('0xd'),'port':0x18eb});var socket=require(_0x58f7('0xe'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x58f7('0xf')](socket);function respondWithRpcPromise(_0x814897,_0x925798,_0x13c34e){return new BPromise(function(_0x332e37,_0x255096){return client[_0x58f7('0x10')](_0x814897,_0x13c34e)[_0x58f7('0x11')](function(_0x3f615a){logger[_0x58f7('0x12')](_0x58f7('0x13'),_0x925798,_0x58f7('0x14'));logger[_0x58f7('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x925798,'request\x20sent',JSON[_0x58f7('0x16')](_0x3f615a));if(_0x3f615a[_0x58f7('0x17')]){if(_0x3f615a[_0x58f7('0x17')][_0x58f7('0x18')]===0x1f4){logger[_0x58f7('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x925798,_0x3f615a['error'][_0x58f7('0x19')]);return _0x255096(_0x3f615a['error'][_0x58f7('0x19')]);}logger[_0x58f7('0x17')](_0x58f7('0x13'),_0x925798,_0x3f615a[_0x58f7('0x17')][_0x58f7('0x19')]);return _0x332e37(_0x3f615a[_0x58f7('0x17')][_0x58f7('0x19')]);}else{logger[_0x58f7('0x12')](_0x58f7('0x13'),_0x925798,_0x58f7('0x14'));_0x332e37(_0x3f615a[_0x58f7('0x1a')][_0x58f7('0x19')]);}})['catch'](function(_0xe29be4){logger['error'](_0x58f7('0x13'),_0x925798,_0xe29be4);_0x255096(_0xe29be4);});});}exports['GetOpenchannelQueue']=function(_0x2660cc){var _0x58192d=this;return new Promise(function(_0x43dbce,_0x55f04c){return db['OpenchannelQueue'][_0x58f7('0x1b')]({'raw':_0x2660cc[_0x58f7('0x1c')]?_0x2660cc['options'][_0x58f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x2660cc[_0x58f7('0x1c')]?_0x2660cc[_0x58f7('0x1c')][_0x58f7('0x1e')]||null:null,'attributes':_0x2660cc['options']?_0x2660cc[_0x58f7('0x1c')][_0x58f7('0x1f')]||null:null,'limit':_0x2660cc[_0x58f7('0x1c')]?_0x2660cc['options']['limit']||null:null,'include':_0x2660cc[_0x58f7('0x1c')]?_0x2660cc[_0x58f7('0x1c')][_0x58f7('0x20')]?_[_0x58f7('0x21')](_0x2660cc[_0x58f7('0x1c')][_0x58f7('0x20')],function(_0x4de57e){return{'model':db[_0x4de57e['model']],'as':_0x4de57e['as'],'attributes':_0x4de57e[_0x58f7('0x1f')],'include':_0x4de57e[_0x58f7('0x20')]?_['map'](_0x4de57e['include'],function(_0x23bdfe){return{'model':db[_0x23bdfe['model']],'as':_0x23bdfe['as'],'attributes':_0x23bdfe[_0x58f7('0x1f')],'include':_0x23bdfe[_0x58f7('0x20')]?_[_0x58f7('0x21')](_0x23bdfe['include'],function(_0x2f3813){return{'model':db[_0x2f3813[_0x58f7('0x22')]],'as':_0x2f3813['as'],'attributes':_0x2f3813[_0x58f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x58f7('0x11')](function(_0x5703fe){logger[_0x58f7('0x12')](_0x58f7('0x23'),_0x2660cc);logger[_0x58f7('0x15')](_0x58f7('0x23'),_0x2660cc,JSON[_0x58f7('0x16')](_0x5703fe));_0x43dbce(_0x5703fe);})[_0x58f7('0x24')](function(_0x4e8a9e){logger[_0x58f7('0x17')](_0x58f7('0x23'),_0x4e8a9e['message'],_0x2660cc);_0x55f04c(_0x58192d[_0x58f7('0x17')](0x1f4,_0x4e8a9e[_0x58f7('0x19')]));});});};exports[_0x58f7('0x25')]=function(_0x3650e9){var _0x3fc70a=this;return new Promise(function(_0x51ebb2,_0xb13b36){return db[_0x58f7('0x26')][_0x58f7('0x27')]({'raw':_0x3650e9[_0x58f7('0x1c')]?_0x3650e9[_0x58f7('0x1c')][_0x58f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x3650e9['options']?_0x3650e9[_0x58f7('0x1c')][_0x58f7('0x1e')]||null:null,'attributes':_0x3650e9['options']?_0x3650e9['options'][_0x58f7('0x1f')]||null:null,'include':_0x3650e9[_0x58f7('0x1c')]?_0x3650e9[_0x58f7('0x1c')][_0x58f7('0x20')]?_[_0x58f7('0x21')](_0x3650e9[_0x58f7('0x1c')]['include'],function(_0x67a895){return{'model':db[_0x67a895[_0x58f7('0x22')]],'as':_0x67a895['as'],'attributes':_0x67a895[_0x58f7('0x1f')],'include':_0x67a895[_0x58f7('0x20')]?_['map'](_0x67a895['include'],function(_0x5f1264){return{'model':db[_0x5f1264[_0x58f7('0x22')]],'as':_0x5f1264['as'],'attributes':_0x5f1264['attributes'],'include':_0x5f1264[_0x58f7('0x20')]?_[_0x58f7('0x21')](_0x5f1264[_0x58f7('0x20')],function(_0x3348d6){return{'model':db[_0x3348d6['model']],'as':_0x3348d6['as'],'attributes':_0x3348d6[_0x58f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x58f7('0x11')](function(_0xfd849d){logger[_0x58f7('0x12')](_0x58f7('0x25'),_0x3650e9);logger[_0x58f7('0x15')](_0x58f7('0x25'),_0x3650e9,JSON[_0x58f7('0x16')](_0xfd849d));_0x51ebb2(_0xfd849d);})[_0x58f7('0x24')](function(_0x5cc5ed){logger['error'](_0x58f7('0x25'),_0x5cc5ed[_0x58f7('0x19')],_0x3650e9);_0xb13b36(_0x3fc70a['error'](0x1f4,_0x5cc5ed[_0x58f7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 2e416ae..d34dab9 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 _0xdb37=['openchannelQueue:','./openchannelQueue.events','update','removeListener','register'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xdb37,0xce));var _0x7db3=function(_0x3ad74d,_0x164c43){_0x3ad74d=_0x3ad74d-0x0;var _0x38db23=_0xdb37[_0x3ad74d];return _0x38db23;};'use strict';var OpenchannelQueueEvents=require(_0x7db3('0x0'));var events=['save','remove',_0x7db3('0x1')];function createListener(_0x3bebb4,_0x410980){return function(_0xf03160){_0x410980['emit'](_0x3bebb4,_0xf03160);};}function removeListener(_0x4bb3d1,_0x531d68){return function(){OpenchannelQueueEvents[_0x7db3('0x2')](_0x4bb3d1,_0x531d68);};}exports[_0x7db3('0x3')]=function(_0x20af2d){for(var _0x732e95=0x0,_0x51bc9b=events['length'];_0x732e95<_0x51bc9b;_0x732e95++){var _0x55011d=events[_0x732e95];var _0xf4122f=createListener(_0x7db3('0x4')+_0x55011d,_0x20af2d);OpenchannelQueueEvents['on'](_0x55011d,_0xf4122f);}}; \ No newline at end of file +var _0x501a=['length','openchannelQueue:','./openchannelQueue.events','remove','update','emit','register'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x501a,0xfe));var _0xa501=function(_0x34533,_0x531aeb){_0x34533=_0x34533-0x0;var _0x5810ff=_0x501a[_0x34533];return _0x5810ff;};'use strict';var OpenchannelQueueEvents=require(_0xa501('0x0'));var events=['save',_0xa501('0x1'),_0xa501('0x2')];function createListener(_0x180f88,_0x4c29a7){return function(_0x458268){_0x4c29a7[_0xa501('0x3')](_0x180f88,_0x458268);};}function removeListener(_0x588949,_0x530796){return function(){OpenchannelQueueEvents['removeListener'](_0x588949,_0x530796);};}exports[_0xa501('0x4')]=function(_0x416b09){for(var _0x115702=0x0,_0x79f36a=events[_0xa501('0x5')];_0x115702<_0x79f36a;_0x115702++){var _0x45eca7=events[_0x115702];var _0x17b1cc=createListener(_0xa501('0x6')+_0x45eca7,_0x416b09);OpenchannelQueueEvents['on'](_0x45eca7,_0x17b1cc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 6c50357..d38777f 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 _0x19c5=['index','/describe','describe','/:id','show','create','put','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated'];(function(_0x16d389,_0x2cdefc){var _0xa28d44=function(_0x4c9166){while(--_0x4c9166){_0x16d389['push'](_0x16d389['shift']());}};_0xa28d44(++_0x2cdefc);}(_0x19c5,0x6c));var _0x519c=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x19c5[_0x4953da];return _0x2d3780;};'use strict';var multer=require(_0x519c('0x0'));var util=require(_0x519c('0x1'));var path=require(_0x519c('0x2'));var timeout=require(_0x519c('0x3'));var express=require(_0x519c('0x4'));var router=express[_0x519c('0x5')]();var auth=require(_0x519c('0x6'));var interaction=require(_0x519c('0x7'));var config=require(_0x519c('0x8'));var controller=require(_0x519c('0x9'));router[_0x519c('0xa')]('/',auth[_0x519c('0xb')](),controller[_0x519c('0xc')]);router['get'](_0x519c('0xd'),auth[_0x519c('0xb')](),controller[_0x519c('0xe')]);router[_0x519c('0xa')](_0x519c('0xf'),auth[_0x519c('0xb')](),controller[_0x519c('0x10')]);router['post']('/',auth[_0x519c('0xb')](),controller[_0x519c('0x11')]);router[_0x519c('0x12')]('/:id',auth[_0x519c('0xb')](),controller['update']);router[_0x519c('0x13')](_0x519c('0xf'),auth[_0x519c('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xec4a=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x895560,_0xd6eb61){var _0x505853=function(_0x25ae33){while(--_0x25ae33){_0x895560['push'](_0x895560['shift']());}};_0x505853(++_0xd6eb61);}(_0xec4a,0x8e));var _0xaec4=function(_0x2cf48c,_0x4672a5){_0x2cf48c=_0x2cf48c-0x0;var _0x9a6ed9=_0xec4a[_0x2cf48c];return _0x9a6ed9;};'use strict';var multer=require(_0xaec4('0x0'));var util=require(_0xaec4('0x1'));var path=require('path');var timeout=require(_0xaec4('0x2'));var express=require(_0xaec4('0x3'));var router=express[_0xaec4('0x4')]();var auth=require(_0xaec4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaec4('0x6'));var controller=require(_0xaec4('0x7'));router[_0xaec4('0x8')]('/',auth['isAuthenticated'](),controller[_0xaec4('0x9')]);router['get'](_0xaec4('0xa'),auth['isAuthenticated'](),controller[_0xaec4('0xb')]);router[_0xaec4('0x8')](_0xaec4('0xc'),auth['isAuthenticated'](),controller[_0xaec4('0xd')]);router[_0xaec4('0xe')]('/',auth['isAuthenticated'](),controller[_0xaec4('0xf')]);router['put'](_0xaec4('0xc'),auth['isAuthenticated'](),controller[_0xaec4('0x10')]);router[_0xaec4('0x11')](_0xaec4('0xc'),auth['isAuthenticated'](),controller[_0xaec4('0x12')]);module[_0xaec4('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index af9d4ad..dea85b8 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 _0xe38d=['DATE','moment','sequelize','exports','STRING'];(function(_0x366202,_0x230fd1){var _0x4cea09=function(_0x911761){while(--_0x911761){_0x366202['push'](_0x366202['shift']());}};_0x4cea09(++_0x230fd1);}(_0xe38d,0x1b9));var _0xde38=function(_0x24e090,_0x33010c){_0x24e090=_0x24e090-0x0;var _0x24575e=_0xe38d[_0x24e090];return _0x24575e;};'use strict';var moment=require(_0xde38('0x0'));var Sequelize=require(_0xde38('0x1'));module[_0xde38('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xde38('0x3')]},'joinAt':{'type':Sequelize[_0xde38('0x4')]},'leaveAt':{'type':Sequelize[_0xde38('0x4')]},'acceptAt':{'type':Sequelize[_0xde38('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xde38('0x3')]}}; \ No newline at end of file +var _0x4556=['sequelize','exports','STRING','DATE','moment'];(function(_0x41adef,_0x1f40f1){var _0x49dbe1=function(_0x48f051){while(--_0x48f051){_0x41adef['push'](_0x41adef['shift']());}};_0x49dbe1(++_0x1f40f1);}(_0x4556,0xdb));var _0x6455=function(_0x246730,_0xcfba2c){_0x246730=_0x246730-0x0;var _0x7f4125=_0x4556[_0x246730];return _0x7f4125;};'use strict';var moment=require(_0x6455('0x0'));var Sequelize=require(_0x6455('0x1'));module[_0x6455('0x2')]={'uniqueid':{'type':Sequelize[_0x6455('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6455('0x4')]},'leaveAt':{'type':Sequelize[_0x6455('0x4')]},'acceptAt':{'type':Sequelize[_0x6455('0x4')]},'exitAt':{'type':Sequelize[_0x6455('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 650163a..8092033 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 _0xb559=['rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','OpenchannelQueueReport','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','map','type','key','VIRTUAL','field','merge','options','rows','catch','show','params'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0xb559,0xdb));var _0x9b55=function(_0x5a5c6b,_0x5baa12){_0x5a5c6b=_0x5a5c6b-0x0;var _0x5e24fc=_0xb559[_0x5a5c6b];return _0x5e24fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9b55('0x0'));var rimraf=require(_0x9b55('0x1'));var zipdir=require(_0x9b55('0x2'));var jsonpatch=require(_0x9b55('0x3'));var rp=require(_0x9b55('0x4'));var moment=require(_0x9b55('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9b55('0x6'));var util=require(_0x9b55('0x7'));var path=require('path');var sox=require(_0x9b55('0x8'));var csv=require(_0x9b55('0x9'));var ejs=require(_0x9b55('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9b55('0xb'));var crypto=require(_0x9b55('0xc'));var jsforce=require(_0x9b55('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9b55('0x9'));var querystring=require(_0x9b55('0xe'));var Papa=require(_0x9b55('0xf'));var Redis=require(_0x9b55('0x10'));var authService=require(_0x9b55('0x11'));var qs=require(_0x9b55('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9b55('0x13'));var utils=require('../../config/utils');var config=require(_0x9b55('0x14'));var db=require(_0x9b55('0x15'))['db'];function respondWithStatusCode(_0xaf3bf9,_0x5d5a8c){_0x5d5a8c=_0x5d5a8c||0xcc;return function(_0x17e209){if(_0x17e209){return _0xaf3bf9[_0x9b55('0x16')](_0x5d5a8c);}return _0xaf3bf9[_0x9b55('0x17')](_0x5d5a8c)[_0x9b55('0x18')]();};}function respondWithResult(_0x56212b,_0x3d097a){_0x3d097a=_0x3d097a||0xc8;return function(_0x21cbe1){if(_0x21cbe1){return _0x56212b['status'](_0x3d097a)[_0x9b55('0x19')](_0x21cbe1);}};}function respondWithFilteredResult(_0x5ef27c,_0x502cde){return function(_0x488b93){if(_0x488b93){var _0x2c2005=_0x488b93['count'],_0x22e4b9=_0x502cde[_0x9b55('0x1a')],_0x25e359=_0x502cde[_0x9b55('0x1a')]+_0x502cde['limit'],_0x54be6d;if(_0x25e359>=_0x2c2005){_0x25e359=_0x2c2005;_0x54be6d=0xc8;}else{_0x54be6d=0xce;}_0x5ef27c[_0x9b55('0x17')](_0x54be6d);return _0x5ef27c[_0x9b55('0x1b')](_0x9b55('0x1c'),_0x22e4b9+'-'+_0x25e359+'/'+_0x2c2005)[_0x9b55('0x19')](_0x488b93);}return null;};}function patchUpdates(_0x5f1686){return function(_0x45f501){try{jsonpatch[_0x9b55('0x1d')](_0x45f501,_0x5f1686,!![]);}catch(_0xfc188e){return BPromise['reject'](_0xfc188e);}return _0x45f501[_0x9b55('0x1e')]();};}function saveUpdates(_0x30f4a4,_0x2465ed){return function(_0x54a69e){if(_0x54a69e){return _0x54a69e[_0x9b55('0x1f')](_0x30f4a4)[_0x9b55('0x20')](function(_0x7e131d){return _0x7e131d;});}return null;};}function removeEntity(_0x599868,_0x5314c3){return function(_0x91e495){if(_0x91e495){return _0x91e495[_0x9b55('0x21')]()[_0x9b55('0x20')](function(){_0x599868['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8e2986,_0x481260){return function(_0x4f89c6){if(!_0x4f89c6){_0x8e2986[_0x9b55('0x16')](0x194);}return _0x4f89c6;};}function handleError(_0x29afd0,_0x2634ea){_0x2634ea=_0x2634ea||0x1f4;return function(_0x4b9a68){logger[_0x9b55('0x22')](_0x4b9a68[_0x9b55('0x23')]);if(_0x4b9a68[_0x9b55('0x24')]){delete _0x4b9a68[_0x9b55('0x24')];}_0x29afd0[_0x9b55('0x17')](_0x2634ea)[_0x9b55('0x25')](_0x4b9a68);};}exports['index']=function(_0x15a363,_0x19dac2){var _0x52f4a5={},_0x530f06={},_0x366e0e={'count':0x0,'rows':[]};var _0x31c0ab=db[_0x9b55('0x26')]['rawAttributes'];_0x530f06[_0x9b55('0x27')]=_['keys'](_0x31c0ab);_0x530f06[_0x9b55('0x28')]=_[_0x9b55('0x29')](_0x15a363[_0x9b55('0x28')]);_0x530f06['filters']=_[_0x9b55('0x2a')](_0x530f06[_0x9b55('0x27')],_0x530f06[_0x9b55('0x28')]);_0x52f4a5[_0x9b55('0x2b')]=_[_0x9b55('0x2a')](_0x530f06[_0x9b55('0x27')],qs[_0x9b55('0x2c')](_0x15a363['query'][_0x9b55('0x2c')]));_0x52f4a5['attributes']=_0x52f4a5['attributes'][_0x9b55('0x2d')]?_0x52f4a5[_0x9b55('0x2b')]:_0x530f06[_0x9b55('0x27')];if(!_0x15a363[_0x9b55('0x28')]['hasOwnProperty'](_0x9b55('0x2e'))){_0x52f4a5[_0x9b55('0x2f')]=qs['limit'](_0x15a363[_0x9b55('0x28')]['limit']);_0x52f4a5[_0x9b55('0x1a')]=qs[_0x9b55('0x1a')](_0x15a363[_0x9b55('0x28')][_0x9b55('0x1a')]);}_0x52f4a5[_0x9b55('0x30')]=qs['sort'](_0x15a363[_0x9b55('0x28')][_0x9b55('0x31')]);_0x52f4a5[_0x9b55('0x32')]=qs[_0x9b55('0x33')](_[_0x9b55('0x34')](_0x15a363['query'],_0x530f06[_0x9b55('0x33')]));if(_0x15a363[_0x9b55('0x28')][_0x9b55('0x35')]){_0x52f4a5['where']=_['merge'](_0x52f4a5['where'],{'$or':_[_0x9b55('0x36')](_0x31c0ab,function(_0x45721c){if(_0x45721c[_0x9b55('0x37')][_0x9b55('0x38')]!==_0x9b55('0x39')){var _0x4e0587={};_0x4e0587[_0x45721c[_0x9b55('0x3a')]]={'$like':'%'+_0x15a363[_0x9b55('0x28')][_0x9b55('0x35')]+'%'};return _0x4e0587;}})});}_0x52f4a5=_[_0x9b55('0x3b')]({},_0x52f4a5,_0x15a363[_0x9b55('0x3c')]);var _0x3142b2={'where':_0x52f4a5[_0x9b55('0x32')]};return db[_0x9b55('0x26')]['count'](_0x3142b2)[_0x9b55('0x20')](function(_0x13d0e1){_0x366e0e['count']=_0x13d0e1;if(_0x15a363[_0x9b55('0x28')]['includeAll']){_0x52f4a5['include']=[{'all':!![]}];}return db[_0x9b55('0x26')]['findAll'](_0x52f4a5);})[_0x9b55('0x20')](function(_0x4a12fb){_0x366e0e[_0x9b55('0x3d')]=_0x4a12fb;return _0x366e0e;})['then'](respondWithFilteredResult(_0x19dac2,_0x52f4a5))[_0x9b55('0x3e')](handleError(_0x19dac2,null));};exports[_0x9b55('0x3f')]=function(_0x5c17bf,_0x16aab7){var _0x512692={'raw':!![],'where':{'id':_0x5c17bf[_0x9b55('0x40')]['id']}},_0x571c99={};_0x571c99[_0x9b55('0x27')]=_[_0x9b55('0x29')](db[_0x9b55('0x26')][_0x9b55('0x41')]);_0x571c99[_0x9b55('0x28')]=_[_0x9b55('0x29')](_0x5c17bf['query']);_0x571c99['filters']=_[_0x9b55('0x2a')](_0x571c99[_0x9b55('0x27')],_0x571c99['query']);_0x512692[_0x9b55('0x2b')]=_['intersection'](_0x571c99[_0x9b55('0x27')],qs[_0x9b55('0x2c')](_0x5c17bf[_0x9b55('0x28')][_0x9b55('0x2c')]));_0x512692[_0x9b55('0x2b')]=_0x512692[_0x9b55('0x2b')][_0x9b55('0x2d')]?_0x512692[_0x9b55('0x2b')]:_0x571c99['model'];if(_0x5c17bf[_0x9b55('0x28')]['includeAll']){_0x512692[_0x9b55('0x42')]=[{'all':!![]}];}_0x512692=_[_0x9b55('0x3b')]({},_0x512692,_0x5c17bf[_0x9b55('0x3c')]);return db['OpenchannelQueueReport']['find'](_0x512692)['then'](handleEntityNotFound(_0x16aab7,null))[_0x9b55('0x20')](respondWithResult(_0x16aab7,null))[_0x9b55('0x3e')](handleError(_0x16aab7,null));};exports[_0x9b55('0x43')]=function(_0x51faa0,_0x17f6bb){return db[_0x9b55('0x26')]['create'](_0x51faa0[_0x9b55('0x44')],{})['then'](respondWithResult(_0x17f6bb,0xc9))[_0x9b55('0x3e')](handleError(_0x17f6bb,null));};exports[_0x9b55('0x1f')]=function(_0x170ade,_0x5126c4){if(_0x170ade[_0x9b55('0x44')]['id']){delete _0x170ade[_0x9b55('0x44')]['id'];}return db[_0x9b55('0x26')][_0x9b55('0x45')]({'where':{'id':_0x170ade[_0x9b55('0x40')]['id']}})[_0x9b55('0x20')](handleEntityNotFound(_0x5126c4,null))[_0x9b55('0x20')](saveUpdates(_0x170ade['body'],null))['then'](respondWithResult(_0x5126c4,null))['catch'](handleError(_0x5126c4,null));};exports[_0x9b55('0x21')]=function(_0x1bd1d8,_0x39d25c){return db[_0x9b55('0x26')][_0x9b55('0x45')]({'where':{'id':_0x1bd1d8[_0x9b55('0x40')]['id']}})[_0x9b55('0x20')](handleEntityNotFound(_0x39d25c,null))[_0x9b55('0x20')](removeEntity(_0x39d25c,null))[_0x9b55('0x3e')](handleError(_0x39d25c,null));};exports[_0x9b55('0x46')]=function(_0x1d041e,_0x1a2185){return db[_0x9b55('0x26')][_0x9b55('0x46')]()['then'](respondWithResult(_0x1a2185,null))[_0x9b55('0x3e')](handleError(_0x1a2185,null));}; \ No newline at end of file +var _0x4065=['body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','field','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x1dcaad,_0x480d9d){var _0x2cd711=function(_0x37a33c){while(--_0x37a33c){_0x1dcaad['push'](_0x1dcaad['shift']());}};_0x2cd711(++_0x480d9d);}(_0x4065,0x8a));var _0x5406=function(_0x2f8719,_0x3d7f28){_0x2f8719=_0x2f8719-0x0;var _0x14a72a=_0x4065[_0x2f8719];return _0x14a72a;};'use strict';var pdf=require(_0x5406('0x0'));var emlformat=require(_0x5406('0x1'));var rimraf=require(_0x5406('0x2'));var zipdir=require(_0x5406('0x3'));var jsonpatch=require(_0x5406('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5406('0x5'));var util=require(_0x5406('0x6'));var path=require(_0x5406('0x7'));var sox=require(_0x5406('0x8'));var csv=require(_0x5406('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5406('0xa'));var crypto=require(_0x5406('0xb'));var jsforce=require(_0x5406('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5406('0x9'));var querystring=require('querystring');var Papa=require(_0x5406('0xd'));var Redis=require(_0x5406('0xe'));var authService=require(_0x5406('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5406('0x10'))(_0x5406('0x11'));var utils=require('../../config/utils');var config=require(_0x5406('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b5353,_0x1b28b0){_0x1b28b0=_0x1b28b0||0xcc;return function(_0x212e7a){if(_0x212e7a){return _0x3b5353['sendStatus'](_0x1b28b0);}return _0x3b5353[_0x5406('0x13')](_0x1b28b0)[_0x5406('0x14')]();};}function respondWithResult(_0x331cb0,_0x1ee708){_0x1ee708=_0x1ee708||0xc8;return function(_0x194081){if(_0x194081){return _0x331cb0[_0x5406('0x13')](_0x1ee708)[_0x5406('0x15')](_0x194081);}};}function respondWithFilteredResult(_0x455767,_0x852a4d){return function(_0x2f0505){if(_0x2f0505){var _0x5d3c8d=_0x2f0505[_0x5406('0x16')],_0x3ae726=_0x852a4d[_0x5406('0x17')],_0x681444=_0x852a4d[_0x5406('0x17')]+_0x852a4d[_0x5406('0x18')],_0x3841b0;if(_0x681444>=_0x5d3c8d){_0x681444=_0x5d3c8d;_0x3841b0=0xc8;}else{_0x3841b0=0xce;}_0x455767[_0x5406('0x13')](_0x3841b0);return _0x455767[_0x5406('0x19')](_0x5406('0x1a'),_0x3ae726+'-'+_0x681444+'/'+_0x5d3c8d)[_0x5406('0x15')](_0x2f0505);}return null;};}function patchUpdates(_0xaaa99e){return function(_0x54a971){try{jsonpatch[_0x5406('0x1b')](_0x54a971,_0xaaa99e,!![]);}catch(_0x33717a){return BPromise[_0x5406('0x1c')](_0x33717a);}return _0x54a971[_0x5406('0x1d')]();};}function saveUpdates(_0x5cd695,_0x6a8b83){return function(_0xe580d4){if(_0xe580d4){return _0xe580d4[_0x5406('0x1e')](_0x5cd695)[_0x5406('0x1f')](function(_0x11e038){return _0x11e038;});}return null;};}function removeEntity(_0x541544,_0x3242ae){return function(_0x4a195b){if(_0x4a195b){return _0x4a195b[_0x5406('0x20')]()[_0x5406('0x1f')](function(){_0x541544[_0x5406('0x13')](0xcc)[_0x5406('0x14')]();});}};}function handleEntityNotFound(_0x881fbb,_0x2e2a39){return function(_0x582908){if(!_0x582908){_0x881fbb[_0x5406('0x21')](0x194);}return _0x582908;};}function handleError(_0xa92db7,_0x32f390){_0x32f390=_0x32f390||0x1f4;return function(_0x4d353a){logger['error'](_0x4d353a[_0x5406('0x22')]);if(_0x4d353a['name']){delete _0x4d353a['name'];}_0xa92db7['status'](_0x32f390)[_0x5406('0x23')](_0x4d353a);};}exports['index']=function(_0x39d061,_0xd8f8c9){var _0x4c159f={},_0x5788bd={},_0xcd8627={'count':0x0,'rows':[]};var _0x318bfd=db['OpenchannelQueueReport']['rawAttributes'];_0x5788bd['model']=_['keys'](_0x318bfd);_0x5788bd[_0x5406('0x24')]=_['keys'](_0x39d061[_0x5406('0x24')]);_0x5788bd['filters']=_[_0x5406('0x25')](_0x5788bd[_0x5406('0x26')],_0x5788bd[_0x5406('0x24')]);_0x4c159f[_0x5406('0x27')]=_[_0x5406('0x25')](_0x5788bd[_0x5406('0x26')],qs[_0x5406('0x28')](_0x39d061[_0x5406('0x24')][_0x5406('0x28')]));_0x4c159f[_0x5406('0x27')]=_0x4c159f['attributes'][_0x5406('0x29')]?_0x4c159f[_0x5406('0x27')]:_0x5788bd['model'];if(!_0x39d061[_0x5406('0x24')][_0x5406('0x2a')](_0x5406('0x2b'))){_0x4c159f[_0x5406('0x18')]=qs[_0x5406('0x18')](_0x39d061[_0x5406('0x24')][_0x5406('0x18')]);_0x4c159f['offset']=qs['offset'](_0x39d061['query']['offset']);}_0x4c159f[_0x5406('0x2c')]=qs[_0x5406('0x2d')](_0x39d061[_0x5406('0x24')][_0x5406('0x2d')]);_0x4c159f['where']=qs[_0x5406('0x2e')](_['pick'](_0x39d061[_0x5406('0x24')],_0x5788bd[_0x5406('0x2e')]));if(_0x39d061[_0x5406('0x24')][_0x5406('0x2f')]){_0x4c159f['where']=_[_0x5406('0x30')](_0x4c159f[_0x5406('0x31')],{'$or':_[_0x5406('0x32')](_0x318bfd,function(_0x5aa66f){if(_0x5aa66f[_0x5406('0x33')][_0x5406('0x34')]!==_0x5406('0x35')){var _0x37d70c={};_0x37d70c[_0x5aa66f[_0x5406('0x36')]]={'$like':'%'+_0x39d061['query'][_0x5406('0x2f')]+'%'};return _0x37d70c;}})});}_0x4c159f=_[_0x5406('0x30')]({},_0x4c159f,_0x39d061[_0x5406('0x37')]);var _0x5b7796={'where':_0x4c159f[_0x5406('0x31')]};return db[_0x5406('0x38')][_0x5406('0x16')](_0x5b7796)[_0x5406('0x1f')](function(_0x427e64){_0xcd8627[_0x5406('0x16')]=_0x427e64;if(_0x39d061[_0x5406('0x24')][_0x5406('0x39')]){_0x4c159f[_0x5406('0x3a')]=[{'all':!![]}];}return db[_0x5406('0x38')][_0x5406('0x3b')](_0x4c159f);})[_0x5406('0x1f')](function(_0x3b8562){_0xcd8627[_0x5406('0x3c')]=_0x3b8562;return _0xcd8627;})['then'](respondWithFilteredResult(_0xd8f8c9,_0x4c159f))[_0x5406('0x3d')](handleError(_0xd8f8c9,null));};exports[_0x5406('0x3e')]=function(_0x5856f2,_0x29ae9b){var _0xa7fe0a={'raw':!![],'where':{'id':_0x5856f2[_0x5406('0x3f')]['id']}},_0x2d4e26={};_0x2d4e26[_0x5406('0x26')]=_['keys'](db[_0x5406('0x38')]['rawAttributes']);_0x2d4e26[_0x5406('0x24')]=_[_0x5406('0x40')](_0x5856f2[_0x5406('0x24')]);_0x2d4e26['filters']=_[_0x5406('0x25')](_0x2d4e26[_0x5406('0x26')],_0x2d4e26['query']);_0xa7fe0a['attributes']=_[_0x5406('0x25')](_0x2d4e26[_0x5406('0x26')],qs[_0x5406('0x28')](_0x5856f2['query']['fields']));_0xa7fe0a[_0x5406('0x27')]=_0xa7fe0a['attributes'][_0x5406('0x29')]?_0xa7fe0a[_0x5406('0x27')]:_0x2d4e26[_0x5406('0x26')];if(_0x5856f2[_0x5406('0x24')][_0x5406('0x39')]){_0xa7fe0a[_0x5406('0x3a')]=[{'all':!![]}];}_0xa7fe0a=_[_0x5406('0x30')]({},_0xa7fe0a,_0x5856f2['options']);return db['OpenchannelQueueReport'][_0x5406('0x41')](_0xa7fe0a)[_0x5406('0x1f')](handleEntityNotFound(_0x29ae9b,null))[_0x5406('0x1f')](respondWithResult(_0x29ae9b,null))['catch'](handleError(_0x29ae9b,null));};exports['create']=function(_0x2e1733,_0x323ea4){return db[_0x5406('0x38')]['create'](_0x2e1733[_0x5406('0x42')],{})[_0x5406('0x1f')](respondWithResult(_0x323ea4,0xc9))['catch'](handleError(_0x323ea4,null));};exports[_0x5406('0x1e')]=function(_0x234755,_0x16427f){if(_0x234755['body']['id']){delete _0x234755[_0x5406('0x42')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x234755[_0x5406('0x3f')]['id']}})[_0x5406('0x1f')](handleEntityNotFound(_0x16427f,null))[_0x5406('0x1f')](saveUpdates(_0x234755['body'],null))['then'](respondWithResult(_0x16427f,null))[_0x5406('0x3d')](handleError(_0x16427f,null));};exports['destroy']=function(_0x3af7f9,_0x1fd18a){return db[_0x5406('0x38')][_0x5406('0x41')]({'where':{'id':_0x3af7f9[_0x5406('0x3f')]['id']}})[_0x5406('0x1f')](handleEntityNotFound(_0x1fd18a,null))[_0x5406('0x1f')](removeEntity(_0x1fd18a,null))[_0x5406('0x3d')](handleError(_0x1fd18a,null));};exports[_0x5406('0x43')]=function(_0x1a6e7c,_0x3cdfcd){return db[_0x5406('0x38')]['describe']()['then'](respondWithResult(_0x3cdfcd,null))[_0x5406('0x3d')](handleError(_0x3cdfcd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index f74771e..d84c145 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 _0x106f=['../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash','util','api','moment','request-promise','rimraf'];(function(_0x2ecb8b,_0x4d2942){var _0x4769c5=function(_0x159613){while(--_0x159613){_0x2ecb8b['push'](_0x2ecb8b['shift']());}};_0x4769c5(++_0x4d2942);}(_0x106f,0x162));var _0xf106=function(_0x2ad7f3,_0x2c4327){_0x2ad7f3=_0x2ad7f3-0x0;var _0x12be0e=_0x106f[_0x2ad7f3];return _0x12be0e;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var logger=require('../../config/logger')(_0xf106('0x2'));var moment=require(_0xf106('0x3'));var BPromise=require('bluebird');var rp=require(_0xf106('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var attributes=require(_0xf106('0x7'));module[_0xf106('0x8')]=function(_0x253f6d,_0x282fd4){return _0x253f6d[_0xf106('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0xf106('0xa'),'paranoid':![],'indexes':[{'name':_0xf106('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7f=['OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelQueueReport.attributes','exports'];(function(_0x5cf154,_0x50d686){var _0x3aacb3=function(_0x3234b5){while(--_0x3234b5){_0x5cf154['push'](_0x5cf154['shift']());}};_0x3aacb3(++_0x50d686);}(_0x6f7f,0x177));var _0xf6f7=function(_0x39e32c,_0x1d357d){_0x39e32c=_0x39e32c-0x0;var _0x4e5747=_0x6f7f[_0x39e32c];return _0x4e5747;};'use strict';var _=require('lodash');var util=require(_0xf6f7('0x0'));var logger=require(_0xf6f7('0x1'))(_0xf6f7('0x2'));var moment=require(_0xf6f7('0x3'));var BPromise=require(_0xf6f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6f7('0x5'));var rimraf=require('rimraf');var config=require(_0xf6f7('0x6'));var attributes=require(_0xf6f7('0x7'));module[_0xf6f7('0x8')]=function(_0x5495b9,_0x2f6df9){return _0x5495b9['define'](_0xf6f7('0x9'),attributes,{'tableName':_0xf6f7('0xa'),'paranoid':![],'indexes':[{'name':_0xf6f7('0xb'),'fields':[_0xf6f7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 15027b4..e493215 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 _0xb7f0=['info','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message'];(function(_0x1ca6c3,_0x203d3c){var _0x1f874b=function(_0x11b032){while(--_0x11b032){_0x1ca6c3['push'](_0x1ca6c3['shift']());}};_0x1f874b(++_0x203d3c);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x1146f7,_0x475356){_0x1146f7=_0x1146f7-0x0;var _0x2e5725=_0xb7f0[_0x1146f7];return _0x2e5725;};'use strict';var _=require(_0x0b7f('0x0'));var util=require(_0x0b7f('0x1'));var moment=require(_0x0b7f('0x2'));var BPromise=require(_0x0b7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b7f('0x4'))['db'];var utils=require(_0x0b7f('0x5'));var logger=require(_0x0b7f('0x6'))(_0x0b7f('0x7'));var config=require(_0x0b7f('0x8'));var jayson=require(_0x0b7f('0x9'));var client=jayson[_0x0b7f('0xa')][_0x0b7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10dc6c,_0x36ff5c,_0x53f9a5){return new BPromise(function(_0x98065a,_0x65287){return client['request'](_0x10dc6c,_0x53f9a5)[_0x0b7f('0xc')](function(_0x3b44bd){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x36ff5c,'request\x20sent');logger[_0x0b7f('0xd')](_0x0b7f('0xe'),_0x36ff5c,_0x0b7f('0xf'),JSON[_0x0b7f('0x10')](_0x3b44bd));if(_0x3b44bd[_0x0b7f('0x11')]){if(_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x12')]===0x1f4){logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);return _0x65287(_0x3b44bd['error'][_0x0b7f('0x14')]);}logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);return _0x98065a(_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);}else{logger[_0x0b7f('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36ff5c,_0x0b7f('0xf'));_0x98065a(_0x3b44bd[_0x0b7f('0x16')][_0x0b7f('0x14')]);}})[_0x0b7f('0x17')](function(_0x58c901){logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x58c901);_0x65287(_0x58c901);});});}exports[_0x0b7f('0x18')]=function(_0x168e7e){var _0x166520=this;return new Promise(function(_0x50cee2,_0x4545aa){return db['OpenchannelQueueReport']['create'](_0x168e7e[_0x0b7f('0x19')],{'raw':_0x168e7e[_0x0b7f('0x1a')]?_0x168e7e[_0x0b7f('0x1a')][_0x0b7f('0x1b')]===undefined?!![]:![]:!![]})[_0x0b7f('0xc')](function(_0x52abc6){logger['info'](_0x0b7f('0x18'),_0x168e7e);logger[_0x0b7f('0xd')](_0x0b7f('0x18'),_0x168e7e,JSON['stringify'](_0x52abc6));_0x50cee2(_0x52abc6);})[_0x0b7f('0x17')](function(_0x1ec1d3){logger[_0x0b7f('0x11')](_0x0b7f('0x18'),_0x1ec1d3[_0x0b7f('0x14')],_0x168e7e);_0x4545aa(_0x166520[_0x0b7f('0x11')](0x1f4,_0x1ec1d3[_0x0b7f('0x14')]));});});};exports[_0x0b7f('0x1c')]=function(_0xc74a5d){var _0x4c9237=this;return new Promise(function(_0x1ad2f4,_0x2ce9fa){return db['OpenchannelQueueReport']['update'](_0xc74a5d['body'],{'raw':_0xc74a5d[_0x0b7f('0x1a')]?_0xc74a5d[_0x0b7f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc74a5d[_0x0b7f('0x1a')]?_0xc74a5d[_0x0b7f('0x1a')][_0x0b7f('0x1d')]||null:null,'attributes':_0xc74a5d[_0x0b7f('0x1a')]?_0xc74a5d[_0x0b7f('0x1a')][_0x0b7f('0x1e')]||null:null,'limit':_0xc74a5d[_0x0b7f('0x1a')]?_0xc74a5d[_0x0b7f('0x1a')][_0x0b7f('0x1f')]||null:null})['then'](function(_0x599bae){logger['info'](_0x0b7f('0x1c'),_0xc74a5d);logger['debug'](_0x0b7f('0x1c'),_0xc74a5d,JSON[_0x0b7f('0x10')](_0x599bae));_0x1ad2f4(_0x599bae);})[_0x0b7f('0x17')](function(_0xe06fa9){logger[_0x0b7f('0x11')](_0x0b7f('0x1c'),_0xe06fa9[_0x0b7f('0x14')],_0xc74a5d);_0x2ce9fa(_0x4c9237['error'](0x1f4,_0xe06fa9['message']));});});}; \ No newline at end of file +var _0xf65d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','stringify','UpdateOpenchannelQueueReport','update','raw','attributes','limit','lodash'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf65d,0x9f));var _0xdf65=function(_0x4debdd,_0x114aab){_0x4debdd=_0x4debdd-0x0;var _0x4a83e6=_0xf65d[_0x4debdd];return _0x4a83e6;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var moment=require(_0xdf65('0x1'));var BPromise=require(_0xdf65('0x2'));var rs=require(_0xdf65('0x3'));var fs=require('fs');var Redis=require(_0xdf65('0x4'));var db=require(_0xdf65('0x5'))['db'];var utils=require(_0xdf65('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdf65('0x7'));var client=jayson['client'][_0xdf65('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33efa2,_0x4c4054,_0x40cc08){return new BPromise(function(_0x3f5cae,_0x97292b){return client[_0xdf65('0x9')](_0x33efa2,_0x40cc08)[_0xdf65('0xa')](function(_0x46a70d){logger['info'](_0xdf65('0xb'),_0x4c4054,'request\x20sent');logger[_0xdf65('0xc')](_0xdf65('0xd'),_0x4c4054,_0xdf65('0xe'),JSON['stringify'](_0x46a70d));if(_0x46a70d['error']){if(_0x46a70d[_0xdf65('0xf')][_0xdf65('0x10')]===0x1f4){logger[_0xdf65('0xf')](_0xdf65('0xb'),_0x4c4054,_0x46a70d[_0xdf65('0xf')][_0xdf65('0x11')]);return _0x97292b(_0x46a70d['error'][_0xdf65('0x11')]);}logger[_0xdf65('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c4054,_0x46a70d['error']['message']);return _0x3f5cae(_0x46a70d[_0xdf65('0xf')][_0xdf65('0x11')]);}else{logger[_0xdf65('0x12')](_0xdf65('0xb'),_0x4c4054,_0xdf65('0xe'));_0x3f5cae(_0x46a70d[_0xdf65('0x13')][_0xdf65('0x11')]);}})[_0xdf65('0x14')](function(_0x208b93){logger[_0xdf65('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c4054,_0x208b93);_0x97292b(_0x208b93);});});}exports[_0xdf65('0x15')]=function(_0x532215){var _0x28fcd1=this;return new Promise(function(_0x3a175b,_0x2337da){return db[_0xdf65('0x16')][_0xdf65('0x17')](_0x532215[_0xdf65('0x18')],{'raw':_0x532215['options']?_0x532215[_0xdf65('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xdf65('0xa')](function(_0x299ed3){logger[_0xdf65('0x12')](_0xdf65('0x15'),_0x532215);logger[_0xdf65('0xc')]('CreateOpenchannelQueueReport',_0x532215,JSON[_0xdf65('0x1a')](_0x299ed3));_0x3a175b(_0x299ed3);})[_0xdf65('0x14')](function(_0x5ee78d){logger[_0xdf65('0xf')](_0xdf65('0x15'),_0x5ee78d[_0xdf65('0x11')],_0x532215);_0x2337da(_0x28fcd1[_0xdf65('0xf')](0x1f4,_0x5ee78d['message']));});});};exports[_0xdf65('0x1b')]=function(_0x2eff40){var _0x5cfe90=this;return new Promise(function(_0x5ae6a3,_0x14a54c){return db[_0xdf65('0x16')][_0xdf65('0x1c')](_0x2eff40['body'],{'raw':_0x2eff40['options']?_0x2eff40[_0xdf65('0x19')][_0xdf65('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eff40['options']?_0x2eff40['options']['where']||null:null,'attributes':_0x2eff40[_0xdf65('0x19')]?_0x2eff40['options'][_0xdf65('0x1e')]||null:null,'limit':_0x2eff40['options']?_0x2eff40[_0xdf65('0x19')][_0xdf65('0x1f')]||null:null})[_0xdf65('0xa')](function(_0x2cca76){logger[_0xdf65('0x12')](_0xdf65('0x1b'),_0x2eff40);logger[_0xdf65('0xc')](_0xdf65('0x1b'),_0x2eff40,JSON[_0xdf65('0x1a')](_0x2cca76));_0x5ae6a3(_0x2cca76);})[_0xdf65('0x14')](function(_0x4507f1){logger['error']('UpdateOpenchannelQueueReport',_0x4507f1[_0xdf65('0x11')],_0x2eff40);_0x14a54c(_0x5cfe90[_0xdf65('0xf')](0x1f4,_0x4507f1[_0xdf65('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index eca40f1..b963f1f 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(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 373af17..6fcf486 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 _0x7bd0=['STRING','ENUM','account','queue','NOW','moment','sequelize','exports'];(function(_0x4f1713,_0x4abfb7){var _0x4726f6=function(_0x357997){while(--_0x357997){_0x4f1713['push'](_0x4f1713['shift']());}};_0x4726f6(++_0x4abfb7);}(_0x7bd0,0xa5));var _0x07bd=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0x7bd0[_0x533132];return _0x1a7447;};'use strict';var moment=require(_0x07bd('0x0'));var Sequelize=require(_0x07bd('0x1'));module[_0x07bd('0x2')]={'uniqueid':{'type':Sequelize[_0x07bd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x07bd('0x4')](_0x07bd('0x5'),'agent',_0x07bd('0x6')),'allowNull':![],'defaultValue':_0x07bd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x07bd('0x7')]}}; \ No newline at end of file +var _0x93b6=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x3e8da2,_0x16d3ac){var _0x34d3d6=function(_0x3941c9){while(--_0x3941c9){_0x3e8da2['push'](_0x3e8da2['shift']());}};_0x34d3d6(++_0x16d3ac);}(_0x93b6,0x124));var _0x693b=function(_0x3942da,_0x292e90){_0x3942da=_0x3942da-0x0;var _0x5bf000=_0x93b6[_0x3942da];return _0x5bf000;};'use strict';var moment=require(_0x693b('0x0'));var Sequelize=require(_0x693b('0x1'));module[_0x693b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x693b('0x3')](_0x693b('0x4'),_0x693b('0x5'),_0x693b('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x693b('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x693b('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 3758b43..4215ad4 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 _0xee2c=['findAll','rows','show','params','fields','includeAll','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','map','type','VIRTUAL','field','filter','include'];(function(_0x4d8b1a,_0x5cfc03){var _0x174301=function(_0x2b992d){while(--_0x2b992d){_0x4d8b1a['push'](_0x4d8b1a['shift']());}};_0x174301(++_0x5cfc03);}(_0xee2c,0x1c7));var _0xcee2=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xee2c[_0x500419];return _0x241c1a;};'use strict';var pdf=require(_0xcee2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcee2('0x1'));var zipdir=require(_0xcee2('0x2'));var jsonpatch=require(_0xcee2('0x3'));var rp=require(_0xcee2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcee2('0x5'));var util=require(_0xcee2('0x6'));var path=require('path');var sox=require(_0xcee2('0x7'));var csv=require(_0xcee2('0x8'));var ejs=require(_0xcee2('0x9'));var fs=require('fs');var _=require(_0xcee2('0xa'));var squel=require(_0xcee2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcee2('0xc'));var toCsv=require(_0xcee2('0x8'));var querystring=require(_0xcee2('0xd'));var Papa=require(_0xcee2('0xe'));var Redis=require(_0xcee2('0xf'));var authService=require(_0xcee2('0x10'));var qs=require(_0xcee2('0x11'));var hardwareService=require(_0xcee2('0x12'));var logger=require('../../config/logger')(_0xcee2('0x13'));var utils=require(_0xcee2('0x14'));var config=require(_0xcee2('0x15'));var db=require(_0xcee2('0x16'))['db'];function respondWithStatusCode(_0x23661f,_0x4b97dd){_0x4b97dd=_0x4b97dd||0xcc;return function(_0x25d11e){if(_0x25d11e){return _0x23661f['sendStatus'](_0x4b97dd);}return _0x23661f['status'](_0x4b97dd)['end']();};}function respondWithResult(_0xfa663a,_0x34cc92){_0x34cc92=_0x34cc92||0xc8;return function(_0x2afc56){if(_0x2afc56){return _0xfa663a[_0xcee2('0x17')](_0x34cc92)['json'](_0x2afc56);}};}function respondWithFilteredResult(_0x1cf4bb,_0x818e13){return function(_0x393761){if(_0x393761){var _0x238da0=_0x393761[_0xcee2('0x18')],_0x1787ec=_0x818e13[_0xcee2('0x19')],_0x21a182=_0x818e13['offset']+_0x818e13[_0xcee2('0x1a')],_0x25bdcf;if(_0x21a182>=_0x238da0){_0x21a182=_0x238da0;_0x25bdcf=0xc8;}else{_0x25bdcf=0xce;}_0x1cf4bb['status'](_0x25bdcf);return _0x1cf4bb[_0xcee2('0x1b')](_0xcee2('0x1c'),_0x1787ec+'-'+_0x21a182+'/'+_0x238da0)[_0xcee2('0x1d')](_0x393761);}return null;};}function patchUpdates(_0x2a52b4){return function(_0x5bb46f){try{jsonpatch[_0xcee2('0x1e')](_0x5bb46f,_0x2a52b4,!![]);}catch(_0x317659){return BPromise[_0xcee2('0x1f')](_0x317659);}return _0x5bb46f[_0xcee2('0x20')]();};}function saveUpdates(_0x3395b1,_0x223f98){return function(_0x42e222){if(_0x42e222){return _0x42e222[_0xcee2('0x21')](_0x3395b1)[_0xcee2('0x22')](function(_0x148023){return _0x148023;});}return null;};}function removeEntity(_0x3e3f75,_0x5d42aa){return function(_0x3f4f92){if(_0x3f4f92){return _0x3f4f92[_0xcee2('0x23')]()['then'](function(){_0x3e3f75['status'](0xcc)[_0xcee2('0x24')]();});}};}function handleEntityNotFound(_0x4fa083,_0x31b2c8){return function(_0x1a935a){if(!_0x1a935a){_0x4fa083[_0xcee2('0x25')](0x194);}return _0x1a935a;};}function handleError(_0x53bd9f,_0x49b1a8){_0x49b1a8=_0x49b1a8||0x1f4;return function(_0x20a6de){logger[_0xcee2('0x26')](_0x20a6de[_0xcee2('0x27')]);if(_0x20a6de['name']){delete _0x20a6de[_0xcee2('0x28')];}_0x53bd9f['status'](_0x49b1a8)[_0xcee2('0x29')](_0x20a6de);};}exports[_0xcee2('0x2a')]=function(_0x14615a,_0x21bc84){var _0x84d7c={},_0x31618c={},_0xbc2b2e={'count':0x0,'rows':[]};var _0x29be38=db[_0xcee2('0x2b')][_0xcee2('0x2c')];_0x31618c[_0xcee2('0x2d')]=_['keys'](_0x29be38);_0x31618c[_0xcee2('0x2e')]=_[_0xcee2('0x2f')](_0x14615a[_0xcee2('0x2e')]);_0x31618c['filters']=_[_0xcee2('0x30')](_0x31618c[_0xcee2('0x2d')],_0x31618c['query']);_0x84d7c[_0xcee2('0x31')]=_[_0xcee2('0x30')](_0x31618c['model'],qs['fields'](_0x14615a[_0xcee2('0x2e')]['fields']));_0x84d7c['attributes']=_0x84d7c[_0xcee2('0x31')][_0xcee2('0x32')]?_0x84d7c['attributes']:_0x31618c[_0xcee2('0x2d')];if(!_0x14615a[_0xcee2('0x2e')][_0xcee2('0x33')](_0xcee2('0x34'))){_0x84d7c[_0xcee2('0x1a')]=qs[_0xcee2('0x1a')](_0x14615a[_0xcee2('0x2e')][_0xcee2('0x1a')]);_0x84d7c[_0xcee2('0x19')]=qs[_0xcee2('0x19')](_0x14615a[_0xcee2('0x2e')][_0xcee2('0x19')]);}_0x84d7c['order']=qs[_0xcee2('0x35')](_0x14615a[_0xcee2('0x2e')]['sort']);_0x84d7c[_0xcee2('0x36')]=qs[_0xcee2('0x37')](_['pick'](_0x14615a[_0xcee2('0x2e')],_0x31618c[_0xcee2('0x37')]));if(_0x14615a[_0xcee2('0x2e')]['filter']){_0x84d7c[_0xcee2('0x36')]=_[_0xcee2('0x38')](_0x84d7c[_0xcee2('0x36')],{'$or':_[_0xcee2('0x39')](_0x29be38,function(_0x352df6){if(_0x352df6[_0xcee2('0x3a')]['key']!==_0xcee2('0x3b')){var _0x355f13={};_0x355f13[_0x352df6[_0xcee2('0x3c')]]={'$like':'%'+_0x14615a['query'][_0xcee2('0x3d')]+'%'};return _0x355f13;}})});}_0x84d7c=_['merge']({},_0x84d7c,_0x14615a['options']);var _0x42c307={'where':_0x84d7c[_0xcee2('0x36')]};return db[_0xcee2('0x2b')][_0xcee2('0x18')](_0x42c307)[_0xcee2('0x22')](function(_0x2eb529){_0xbc2b2e['count']=_0x2eb529;if(_0x14615a['query']['includeAll']){_0x84d7c[_0xcee2('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xcee2('0x3f')](_0x84d7c);})[_0xcee2('0x22')](function(_0x5ad17c){_0xbc2b2e[_0xcee2('0x40')]=_0x5ad17c;return _0xbc2b2e;})['then'](respondWithFilteredResult(_0x21bc84,_0x84d7c))['catch'](handleError(_0x21bc84,null));};exports[_0xcee2('0x41')]=function(_0x46880b,_0x5be207){var _0x480e54={'raw':!![],'where':{'id':_0x46880b[_0xcee2('0x42')]['id']}},_0x208139={};_0x208139[_0xcee2('0x2d')]=_[_0xcee2('0x2f')](db[_0xcee2('0x2b')][_0xcee2('0x2c')]);_0x208139[_0xcee2('0x2e')]=_[_0xcee2('0x2f')](_0x46880b[_0xcee2('0x2e')]);_0x208139['filters']=_[_0xcee2('0x30')](_0x208139[_0xcee2('0x2d')],_0x208139[_0xcee2('0x2e')]);_0x480e54[_0xcee2('0x31')]=_['intersection'](_0x208139[_0xcee2('0x2d')],qs[_0xcee2('0x43')](_0x46880b[_0xcee2('0x2e')][_0xcee2('0x43')]));_0x480e54[_0xcee2('0x31')]=_0x480e54[_0xcee2('0x31')][_0xcee2('0x32')]?_0x480e54[_0xcee2('0x31')]:_0x208139[_0xcee2('0x2d')];if(_0x46880b['query'][_0xcee2('0x44')]){_0x480e54[_0xcee2('0x3e')]=[{'all':!![]}];}_0x480e54=_[_0xcee2('0x38')]({},_0x480e54,_0x46880b['options']);return db[_0xcee2('0x2b')][_0xcee2('0x45')](_0x480e54)[_0xcee2('0x22')](handleEntityNotFound(_0x5be207,null))[_0xcee2('0x22')](respondWithResult(_0x5be207,null))[_0xcee2('0x46')](handleError(_0x5be207,null));};exports[_0xcee2('0x47')]=function(_0x2f3cdd,_0x3af08a){return db[_0xcee2('0x2b')][_0xcee2('0x47')](_0x2f3cdd[_0xcee2('0x48')],{})[_0xcee2('0x22')](respondWithResult(_0x3af08a,0xc9))[_0xcee2('0x46')](handleError(_0x3af08a,null));};exports[_0xcee2('0x21')]=function(_0x48455e,_0xb6c95f){if(_0x48455e['body']['id']){delete _0x48455e['body']['id'];}return db[_0xcee2('0x2b')][_0xcee2('0x45')]({'where':{'id':_0x48455e[_0xcee2('0x42')]['id']}})[_0xcee2('0x22')](handleEntityNotFound(_0xb6c95f,null))[_0xcee2('0x22')](saveUpdates(_0x48455e['body'],null))[_0xcee2('0x22')](respondWithResult(_0xb6c95f,null))['catch'](handleError(_0xb6c95f,null));};exports[_0xcee2('0x23')]=function(_0x209877,_0x465e9a){return db[_0xcee2('0x2b')][_0xcee2('0x45')]({'where':{'id':_0x209877[_0xcee2('0x42')]['id']}})[_0xcee2('0x22')](handleEntityNotFound(_0x465e9a,null))['then'](removeEntity(_0x465e9a,null))[_0xcee2('0x46')](handleError(_0x465e9a,null));};exports[_0xcee2('0x49')]=function(_0xb533cc,_0x8a8f4f){return db[_0xcee2('0x2b')][_0xcee2('0x49')]()[_0xcee2('0x22')](respondWithResult(_0x8a8f4f,null))[_0xcee2('0x46')](handleError(_0x8a8f4f,null));}; \ No newline at end of file +var _0xbbbc=['name','OpenchannelTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','map','type','key','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5c0f34,_0x886be2){_0x5c0f34=_0x5c0f34-0x0;var _0x576e65=_0xbbbc[_0x5c0f34];return _0x576e65;};'use strict';var pdf=require(_0xcbbb('0x0'));var emlformat=require(_0xcbbb('0x1'));var rimraf=require(_0xcbbb('0x2'));var zipdir=require(_0xcbbb('0x3'));var jsonpatch=require(_0xcbbb('0x4'));var rp=require(_0xcbbb('0x5'));var moment=require(_0xcbbb('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xcbbb('0x7'));var util=require(_0xcbbb('0x8'));var path=require(_0xcbbb('0x9'));var sox=require(_0xcbbb('0xa'));var csv=require(_0xcbbb('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xb'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xcbbb('0x13'));var logger=require('../../config/logger')(_0xcbbb('0x14'));var utils=require('../../config/utils');var config=require(_0xcbbb('0x15'));var db=require(_0xcbbb('0x16'))['db'];function respondWithStatusCode(_0x572e50,_0x631188){_0x631188=_0x631188||0xcc;return function(_0x53e651){if(_0x53e651){return _0x572e50[_0xcbbb('0x17')](_0x631188);}return _0x572e50['status'](_0x631188)[_0xcbbb('0x18')]();};}function respondWithResult(_0x15ba43,_0x1cece7){_0x1cece7=_0x1cece7||0xc8;return function(_0x47ea6a){if(_0x47ea6a){return _0x15ba43[_0xcbbb('0x19')](_0x1cece7)[_0xcbbb('0x1a')](_0x47ea6a);}};}function respondWithFilteredResult(_0x8a325c,_0x273e13){return function(_0x47e679){if(_0x47e679){var _0x5af226=_0x47e679[_0xcbbb('0x1b')],_0x1bba39=_0x273e13['offset'],_0x30297d=_0x273e13[_0xcbbb('0x1c')]+_0x273e13['limit'],_0xf76038;if(_0x30297d>=_0x5af226){_0x30297d=_0x5af226;_0xf76038=0xc8;}else{_0xf76038=0xce;}_0x8a325c[_0xcbbb('0x19')](_0xf76038);return _0x8a325c[_0xcbbb('0x1d')](_0xcbbb('0x1e'),_0x1bba39+'-'+_0x30297d+'/'+_0x5af226)['json'](_0x47e679);}return null;};}function patchUpdates(_0x57c5e9){return function(_0x4bcd9a){try{jsonpatch[_0xcbbb('0x1f')](_0x4bcd9a,_0x57c5e9,!![]);}catch(_0x3ae91b){return BPromise[_0xcbbb('0x20')](_0x3ae91b);}return _0x4bcd9a[_0xcbbb('0x21')]();};}function saveUpdates(_0x658337,_0x1cca90){return function(_0x45de5f){if(_0x45de5f){return _0x45de5f[_0xcbbb('0x22')](_0x658337)[_0xcbbb('0x23')](function(_0x2d4335){return _0x2d4335;});}return null;};}function removeEntity(_0x594b3f,_0x44a568){return function(_0xe07b0){if(_0xe07b0){return _0xe07b0[_0xcbbb('0x24')]()[_0xcbbb('0x23')](function(){_0x594b3f[_0xcbbb('0x19')](0xcc)[_0xcbbb('0x18')]();});}};}function handleEntityNotFound(_0x297eae,_0xabb565){return function(_0x3ca570){if(!_0x3ca570){_0x297eae['sendStatus'](0x194);}return _0x3ca570;};}function handleError(_0xf39ddd,_0x4490c1){_0x4490c1=_0x4490c1||0x1f4;return function(_0x4c543a){logger[_0xcbbb('0x25')](_0x4c543a['stack']);if(_0x4c543a['name']){delete _0x4c543a[_0xcbbb('0x26')];}_0xf39ddd[_0xcbbb('0x19')](_0x4490c1)['send'](_0x4c543a);};}exports['index']=function(_0x5499a1,_0x4439ea){var _0x55e1d8={},_0x4da775={},_0x21e3b1={'count':0x0,'rows':[]};var _0x2902c6=db[_0xcbbb('0x27')][_0xcbbb('0x28')];_0x4da775[_0xcbbb('0x29')]=_[_0xcbbb('0x2a')](_0x2902c6);_0x4da775[_0xcbbb('0x2b')]=_[_0xcbbb('0x2a')](_0x5499a1[_0xcbbb('0x2b')]);_0x4da775[_0xcbbb('0x2c')]=_[_0xcbbb('0x2d')](_0x4da775[_0xcbbb('0x29')],_0x4da775[_0xcbbb('0x2b')]);_0x55e1d8[_0xcbbb('0x2e')]=_[_0xcbbb('0x2d')](_0x4da775[_0xcbbb('0x29')],qs[_0xcbbb('0x2f')](_0x5499a1[_0xcbbb('0x2b')]['fields']));_0x55e1d8[_0xcbbb('0x2e')]=_0x55e1d8[_0xcbbb('0x2e')]['length']?_0x55e1d8[_0xcbbb('0x2e')]:_0x4da775['model'];if(!_0x5499a1[_0xcbbb('0x2b')][_0xcbbb('0x30')](_0xcbbb('0x31'))){_0x55e1d8['limit']=qs[_0xcbbb('0x32')](_0x5499a1[_0xcbbb('0x2b')][_0xcbbb('0x32')]);_0x55e1d8[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x5499a1[_0xcbbb('0x2b')][_0xcbbb('0x1c')]);}_0x55e1d8[_0xcbbb('0x33')]=qs[_0xcbbb('0x34')](_0x5499a1[_0xcbbb('0x2b')]['sort']);_0x55e1d8['where']=qs['filters'](_['pick'](_0x5499a1[_0xcbbb('0x2b')],_0x4da775[_0xcbbb('0x2c')]));if(_0x5499a1[_0xcbbb('0x2b')][_0xcbbb('0x35')]){_0x55e1d8[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0x55e1d8[_0xcbbb('0x36')],{'$or':_[_0xcbbb('0x38')](_0x2902c6,function(_0x1ef121){if(_0x1ef121[_0xcbbb('0x39')][_0xcbbb('0x3a')]!==_0xcbbb('0x3b')){var _0x5b62f0={};_0x5b62f0[_0x1ef121['field']]={'$like':'%'+_0x5499a1[_0xcbbb('0x2b')]['filter']+'%'};return _0x5b62f0;}})});}_0x55e1d8=_['merge']({},_0x55e1d8,_0x5499a1['options']);var _0x3c1fb2={'where':_0x55e1d8[_0xcbbb('0x36')]};return db[_0xcbbb('0x27')][_0xcbbb('0x1b')](_0x3c1fb2)[_0xcbbb('0x23')](function(_0x2727f5){_0x21e3b1[_0xcbbb('0x1b')]=_0x2727f5;if(_0x5499a1[_0xcbbb('0x2b')][_0xcbbb('0x3c')]){_0x55e1d8[_0xcbbb('0x3d')]=[{'all':!![]}];}return db[_0xcbbb('0x27')]['findAll'](_0x55e1d8);})[_0xcbbb('0x23')](function(_0x55d349){_0x21e3b1[_0xcbbb('0x3e')]=_0x55d349;return _0x21e3b1;})[_0xcbbb('0x23')](respondWithFilteredResult(_0x4439ea,_0x55e1d8))[_0xcbbb('0x3f')](handleError(_0x4439ea,null));};exports[_0xcbbb('0x40')]=function(_0x433065,_0x3107a6){var _0x5651fd={'raw':!![],'where':{'id':_0x433065['params']['id']}},_0x4d31d2={};_0x4d31d2[_0xcbbb('0x29')]=_[_0xcbbb('0x2a')](db[_0xcbbb('0x27')][_0xcbbb('0x28')]);_0x4d31d2[_0xcbbb('0x2b')]=_[_0xcbbb('0x2a')](_0x433065[_0xcbbb('0x2b')]);_0x4d31d2['filters']=_[_0xcbbb('0x2d')](_0x4d31d2[_0xcbbb('0x29')],_0x4d31d2['query']);_0x5651fd[_0xcbbb('0x2e')]=_[_0xcbbb('0x2d')](_0x4d31d2[_0xcbbb('0x29')],qs[_0xcbbb('0x2f')](_0x433065[_0xcbbb('0x2b')]['fields']));_0x5651fd[_0xcbbb('0x2e')]=_0x5651fd['attributes']['length']?_0x5651fd[_0xcbbb('0x2e')]:_0x4d31d2[_0xcbbb('0x29')];if(_0x433065[_0xcbbb('0x2b')][_0xcbbb('0x3c')]){_0x5651fd[_0xcbbb('0x3d')]=[{'all':!![]}];}_0x5651fd=_[_0xcbbb('0x37')]({},_0x5651fd,_0x433065[_0xcbbb('0x41')]);return db[_0xcbbb('0x27')][_0xcbbb('0x42')](_0x5651fd)[_0xcbbb('0x23')](handleEntityNotFound(_0x3107a6,null))[_0xcbbb('0x23')](respondWithResult(_0x3107a6,null))[_0xcbbb('0x3f')](handleError(_0x3107a6,null));};exports[_0xcbbb('0x43')]=function(_0x667db6,_0x5d1c68){return db[_0xcbbb('0x27')][_0xcbbb('0x43')](_0x667db6[_0xcbbb('0x44')],{})[_0xcbbb('0x23')](respondWithResult(_0x5d1c68,0xc9))['catch'](handleError(_0x5d1c68,null));};exports['update']=function(_0x58ba49,_0x225b58){if(_0x58ba49[_0xcbbb('0x44')]['id']){delete _0x58ba49[_0xcbbb('0x44')]['id'];}return db[_0xcbbb('0x27')][_0xcbbb('0x42')]({'where':{'id':_0x58ba49[_0xcbbb('0x45')]['id']}})[_0xcbbb('0x23')](handleEntityNotFound(_0x225b58,null))['then'](saveUpdates(_0x58ba49[_0xcbbb('0x44')],null))[_0xcbbb('0x23')](respondWithResult(_0x225b58,null))[_0xcbbb('0x3f')](handleError(_0x225b58,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){return db[_0xcbbb('0x27')][_0xcbbb('0x42')]({'where':{'id':_0x478c22[_0xcbbb('0x45')]['id']}})['then'](handleEntityNotFound(_0x3378cd,null))['then'](removeEntity(_0x3378cd,null))[_0xcbbb('0x3f')](handleError(_0x3378cd,null));};exports[_0xcbbb('0x46')]=function(_0x3dc052,_0x4bf633){return db['OpenchannelTransferReport']['describe']()[_0xcbbb('0x23')](respondWithResult(_0x4bf633,null))[_0xcbbb('0x3f')](handleError(_0x4bf633,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0104dad..a1bc96e 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 _0x6217=['api','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x6217,0xd9));var _0x7621=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0x6217[_0x223c0d];return _0x207827;};'use strict';var _=require(_0x7621('0x0'));var util=require(_0x7621('0x1'));var logger=require(_0x7621('0x2'))(_0x7621('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7621('0x4'));var rimraf=require('rimraf');var config=require(_0x7621('0x5'));var attributes=require(_0x7621('0x6'));module[_0x7621('0x7')]=function(_0x39c639,_0x7fb811){return _0x39c639[_0x7621('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x7621('0x9'),'paranoid':![],'indexes':[{'name':_0x7621('0xa'),'fields':[_0x7621('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81ec=['moment','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api'];(function(_0x5abba1,_0x3153d3){var _0x2ffbb0=function(_0x26bf94){while(--_0x26bf94){_0x5abba1['push'](_0x5abba1['shift']());}};_0x2ffbb0(++_0x3153d3);}(_0x81ec,0x1a5));var _0xc81e=function(_0x471505,_0x41030d){_0x471505=_0x471505-0x0;var _0x4cdf42=_0x81ec[_0x471505];return _0x4cdf42;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc81e('0x0'))(_0xc81e('0x1'));var moment=require(_0xc81e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc81e('0x3'));var attributes=require('./openchannelTransferReport.attributes');module[_0xc81e('0x4')]=function(_0x2d80be,_0x27e53c){return _0x2d80be[_0xc81e('0x5')](_0xc81e('0x6'),attributes,{'tableName':_0xc81e('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc81e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index daded16..b5c99c3 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 _0x723e=['OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x2082af,_0xb25312){var _0x1d82b6=function(_0x44ffd5){while(--_0x44ffd5){_0x2082af['push'](_0x2082af['shift']());}};_0x1d82b6(++_0xb25312);}(_0x723e,0x179));var _0xe723=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x723e[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));var BPromise=require(_0xe723('0x2'));var rs=require(_0xe723('0x3'));var fs=require('fs');var Redis=require(_0xe723('0x4'));var db=require(_0xe723('0x5'))['db'];var utils=require(_0xe723('0x6'));var logger=require(_0xe723('0x7'))(_0xe723('0x8'));var config=require(_0xe723('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe723('0xa')][_0xe723('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1335cd,_0x3bf082,_0x2aebbd){return new BPromise(function(_0xe50f7,_0x1b46e0){return client[_0xe723('0xc')](_0x1335cd,_0x2aebbd)['then'](function(_0x380444){logger[_0xe723('0xd')](_0xe723('0xe'),_0x3bf082,'request\x20sent');logger[_0xe723('0xf')](_0xe723('0x10'),_0x3bf082,_0xe723('0x11'),JSON['stringify'](_0x380444));if(_0x380444[_0xe723('0x12')]){if(_0x380444[_0xe723('0x12')][_0xe723('0x13')]===0x1f4){logger[_0xe723('0x12')](_0xe723('0xe'),_0x3bf082,_0x380444['error'][_0xe723('0x14')]);return _0x1b46e0(_0x380444['error']['message']);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3bf082,_0x380444[_0xe723('0x12')][_0xe723('0x14')]);return _0xe50f7(_0x380444[_0xe723('0x12')][_0xe723('0x14')]);}else{logger[_0xe723('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3bf082,_0xe723('0x11'));_0xe50f7(_0x380444[_0xe723('0x15')][_0xe723('0x14')]);}})[_0xe723('0x16')](function(_0x347fa0){logger[_0xe723('0x12')](_0xe723('0xe'),_0x3bf082,_0x347fa0);_0x1b46e0(_0x347fa0);});});} \ No newline at end of file +var _0x88c6=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x3d71d3,_0x11caf1){var _0x30ec87=function(_0x308f30){while(--_0x308f30){_0x3d71d3['push'](_0x3d71d3['shift']());}};_0x30ec87(++_0x11caf1);}(_0x88c6,0x163));var _0x688c=function(_0x580907,_0xbde208){_0x580907=_0x580907-0x0;var _0x50ab75=_0x88c6[_0x580907];return _0x50ab75;};'use strict';var _=require(_0x688c('0x0'));var util=require(_0x688c('0x1'));var moment=require(_0x688c('0x2'));var BPromise=require(_0x688c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x688c('0x4'))['db'];var utils=require(_0x688c('0x5'));var logger=require(_0x688c('0x6'))('rpc');var config=require(_0x688c('0x7'));var jayson=require(_0x688c('0x8'));var client=jayson[_0x688c('0x9')][_0x688c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1be494,_0x44bf8b,_0x4cd706){return new BPromise(function(_0x9f8059,_0xec2731){return client[_0x688c('0xb')](_0x1be494,_0x4cd706)['then'](function(_0x30ab68){logger[_0x688c('0xc')](_0x688c('0xd'),_0x44bf8b,'request\x20sent');logger[_0x688c('0xe')](_0x688c('0xf'),_0x44bf8b,'request\x20sent',JSON[_0x688c('0x10')](_0x30ab68));if(_0x30ab68[_0x688c('0x11')]){if(_0x30ab68['error'][_0x688c('0x12')]===0x1f4){logger[_0x688c('0x11')](_0x688c('0xd'),_0x44bf8b,_0x30ab68['error']['message']);return _0xec2731(_0x30ab68[_0x688c('0x11')]['message']);}logger['error'](_0x688c('0xd'),_0x44bf8b,_0x30ab68['error']['message']);return _0x9f8059(_0x30ab68[_0x688c('0x11')][_0x688c('0x13')]);}else{logger[_0x688c('0xc')](_0x688c('0xd'),_0x44bf8b,'request\x20sent');_0x9f8059(_0x30ab68['result'][_0x688c('0x13')]);}})[_0x688c('0x14')](function(_0x470b8f){logger['error'](_0x688c('0xd'),_0x44bf8b,_0x470b8f);_0xec2731(_0x470b8f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6292e7a..cca15d4 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 _0xbebf=['create','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x24d560,_0x2e0e7b){var _0x18f7b3=function(_0x564a93){while(--_0x564a93){_0x24d560['push'](_0x24d560['shift']());}};_0x18f7b3(++_0x2e0e7b);}(_0xbebf,0xbe));var _0xfbeb=function(_0x520c2d,_0x294cf0){_0x520c2d=_0x520c2d-0x0;var _0x23f7ba=_0xbebf[_0x520c2d];return _0x23f7ba;};'use strict';var multer=require('multer');var util=require(_0xfbeb('0x0'));var path=require(_0xfbeb('0x1'));var timeout=require(_0xfbeb('0x2'));var express=require('express');var router=express[_0xfbeb('0x3')]();var auth=require(_0xfbeb('0x4'));var interaction=require(_0xfbeb('0x5'));var config=require(_0xfbeb('0x6'));var controller=require(_0xfbeb('0x7'));router[_0xfbeb('0x8')]('/',auth['isAuthenticated'](),controller[_0xfbeb('0x9')]);router[_0xfbeb('0x8')](_0xfbeb('0xa'),auth[_0xfbeb('0xb')](),controller[_0xfbeb('0xc')]);router[_0xfbeb('0xd')]('/',auth[_0xfbeb('0xb')](),controller[_0xfbeb('0xe')]);router['put'](_0xfbeb('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xfbeb('0xf')]('/:id',auth[_0xfbeb('0xb')](),controller['destroy']);module[_0xfbeb('0x10')]=router; \ No newline at end of file +var _0x1760=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','show','post','put','/:id','update'];(function(_0x151b3a,_0x23599f){var _0x2b79bc=function(_0x5b40e7){while(--_0x5b40e7){_0x151b3a['push'](_0x151b3a['shift']());}};_0x2b79bc(++_0x23599f);}(_0x1760,0x16b));var _0x0176=function(_0xfc8ee6,_0x17a18d){_0xfc8ee6=_0xfc8ee6-0x0;var _0x3d615d=_0x1760[_0xfc8ee6];return _0x3d615d;};'use strict';var multer=require(_0x0176('0x0'));var util=require(_0x0176('0x1'));var path=require('path');var timeout=require(_0x0176('0x2'));var express=require(_0x0176('0x3'));var router=express[_0x0176('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0176('0x5'));var config=require(_0x0176('0x6'));var controller=require(_0x0176('0x7'));router[_0x0176('0x8')]('/',auth[_0x0176('0x9')](),controller['index']);router['get']('/:id',auth[_0x0176('0x9')](),controller[_0x0176('0xa')]);router[_0x0176('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0176('0xc')](_0x0176('0xd'),auth[_0x0176('0x9')](),controller[_0x0176('0xe')]);router[_0x0176('0xf')]('/:id',auth[_0x0176('0x9')](),controller[_0x0176('0x10')]);module[_0x0176('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4744d69..6c7f5c0 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 _0xc54a=['name','sequelize','STRING'];(function(_0x20bc56,_0x352c6f){var _0xce1709=function(_0x480a7d){while(--_0x480a7d){_0x20bc56['push'](_0x20bc56['shift']());}};_0xce1709(++_0x352c6f);}(_0xc54a,0x130));var _0xac54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc54a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac54('0x0'));module['exports']={'name':{'type':Sequelize[_0xac54('0x1')],'unique':_0xac54('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xac54('0x1')]}}; \ No newline at end of file +var _0x3a28=['sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a28,0x138));var _0x83a2=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x3a28[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require(_0x83a2('0x0'));module[_0x83a2('0x1')]={'name':{'type':Sequelize[_0x83a2('0x2')],'unique':_0x83a2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x83a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f414234..00e3b50 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 _0xa5f4=['hasOwnProperty','nolimit','where','pick','filter','merge','map','type','key','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','save','update','then','get','Pauses','UserProfileResource','end','sendStatus','error','stack','name','index','Pause','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x49b446,_0x2e7a57){var _0x41875c=function(_0x548626){while(--_0x548626){_0x49b446['push'](_0x49b446['shift']());}};_0x41875c(++_0x2e7a57);}(_0xa5f4,0x112));var _0x4a5f=function(_0x3166c2,_0x480b51){_0x3166c2=_0x3166c2-0x0;var _0x2407fa=_0xa5f4[_0x3166c2];return _0x2407fa;};'use strict';var pdf=require(_0x4a5f('0x0'));var emlformat=require(_0x4a5f('0x1'));var rimraf=require(_0x4a5f('0x2'));var zipdir=require(_0x4a5f('0x3'));var jsonpatch=require(_0x4a5f('0x4'));var rp=require(_0x4a5f('0x5'));var moment=require(_0x4a5f('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4a5f('0x7'));var sox=require(_0x4a5f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a5f('0x9'));var squel=require(_0x4a5f('0xa'));var crypto=require(_0x4a5f('0xb'));var jsforce=require(_0x4a5f('0xc'));var deskjs=require(_0x4a5f('0xd'));var toCsv=require(_0x4a5f('0xe'));var querystring=require(_0x4a5f('0xf'));var Papa=require(_0x4a5f('0x10'));var Redis=require(_0x4a5f('0x11'));var authService=require(_0x4a5f('0x12'));var qs=require(_0x4a5f('0x13'));var hardwareService=require(_0x4a5f('0x14'));var logger=require('../../config/logger')(_0x4a5f('0x15'));var utils=require(_0x4a5f('0x16'));var config=require(_0x4a5f('0x17'));var db=require(_0x4a5f('0x18'))['db'];function respondWithStatusCode(_0x475a13,_0x566769){_0x566769=_0x566769||0xcc;return function(_0x21a7ee){if(_0x21a7ee){return _0x475a13['sendStatus'](_0x566769);}return _0x475a13[_0x4a5f('0x19')](_0x566769)['end']();};}function respondWithResult(_0x4e5e6a,_0x3c6801){_0x3c6801=_0x3c6801||0xc8;return function(_0x59424b){if(_0x59424b){return _0x4e5e6a[_0x4a5f('0x19')](_0x3c6801)[_0x4a5f('0x1a')](_0x59424b);}};}function respondWithFilteredResult(_0x41bb76,_0x6a9115){return function(_0x2e344f){if(_0x2e344f){var _0x3cf56e=_0x2e344f[_0x4a5f('0x1b')],_0x2bc9bc=_0x6a9115[_0x4a5f('0x1c')],_0x326aa1=_0x6a9115[_0x4a5f('0x1c')]+_0x6a9115[_0x4a5f('0x1d')],_0x22a434;if(_0x326aa1>=_0x3cf56e){_0x326aa1=_0x3cf56e;_0x22a434=0xc8;}else{_0x22a434=0xce;}_0x41bb76['status'](_0x22a434);return _0x41bb76['set'](_0x4a5f('0x1e'),_0x2bc9bc+'-'+_0x326aa1+'/'+_0x3cf56e)['json'](_0x2e344f);}return null;};}function patchUpdates(_0x3096ad){return function(_0x3b2789){try{jsonpatch[_0x4a5f('0x1f')](_0x3b2789,_0x3096ad,!![]);}catch(_0x47bd60){return BPromise['reject'](_0x47bd60);}return _0x3b2789[_0x4a5f('0x20')]();};}function saveUpdates(_0x385133,_0xa36731){return function(_0x5624f8){if(_0x5624f8){return _0x5624f8[_0x4a5f('0x21')](_0x385133)[_0x4a5f('0x22')](function(_0x529138){return _0x529138;});}return null;};}function removeEntity(_0x4c8401,_0x40929d){return function(_0x452bf2){if(_0x452bf2){return _0x452bf2['destroy']()['then'](function(){var _0x17103d=_0x452bf2[_0x4a5f('0x23')]({'plain':!![]});var _0x5111dd=_0x4a5f('0x24');return db[_0x4a5f('0x25')]['destroy']({'where':{'type':_0x5111dd,'resourceId':_0x17103d['id']}})[_0x4a5f('0x22')](function(){return _0x452bf2;});})['then'](function(){_0x4c8401[_0x4a5f('0x19')](0xcc)[_0x4a5f('0x26')]();});}};}function handleEntityNotFound(_0x37eefa,_0x1629a3){return function(_0x4706c7){if(!_0x4706c7){_0x37eefa[_0x4a5f('0x27')](0x194);}return _0x4706c7;};}function handleError(_0x41afc7,_0x5a4b8f){_0x5a4b8f=_0x5a4b8f||0x1f4;return function(_0x301e72){logger[_0x4a5f('0x28')](_0x301e72[_0x4a5f('0x29')]);if(_0x301e72[_0x4a5f('0x2a')]){delete _0x301e72['name'];}_0x41afc7[_0x4a5f('0x19')](_0x5a4b8f)['send'](_0x301e72);};}exports[_0x4a5f('0x2b')]=function(_0x1f1b37,_0x4f7e10){var _0x34241b={},_0x3737e2={},_0x358b6c={'count':0x0,'rows':[]};var _0x1917ea=db[_0x4a5f('0x2c')][_0x4a5f('0x2d')];_0x3737e2[_0x4a5f('0x2e')]=_[_0x4a5f('0x2f')](_0x1917ea);_0x3737e2['query']=_[_0x4a5f('0x2f')](_0x1f1b37[_0x4a5f('0x30')]);_0x3737e2[_0x4a5f('0x31')]=_[_0x4a5f('0x32')](_0x3737e2[_0x4a5f('0x2e')],_0x3737e2['query']);_0x34241b[_0x4a5f('0x33')]=_[_0x4a5f('0x32')](_0x3737e2[_0x4a5f('0x2e')],qs[_0x4a5f('0x34')](_0x1f1b37['query'][_0x4a5f('0x34')]));_0x34241b[_0x4a5f('0x33')]=_0x34241b[_0x4a5f('0x33')][_0x4a5f('0x35')]?_0x34241b[_0x4a5f('0x33')]:_0x3737e2['model'];if(!_0x1f1b37['query'][_0x4a5f('0x36')](_0x4a5f('0x37'))){_0x34241b[_0x4a5f('0x1d')]=qs[_0x4a5f('0x1d')](_0x1f1b37['query'][_0x4a5f('0x1d')]);_0x34241b[_0x4a5f('0x1c')]=qs[_0x4a5f('0x1c')](_0x1f1b37[_0x4a5f('0x30')][_0x4a5f('0x1c')]);}_0x34241b['order']=qs['sort'](_0x1f1b37[_0x4a5f('0x30')]['sort']);_0x34241b[_0x4a5f('0x38')]=qs[_0x4a5f('0x31')](_[_0x4a5f('0x39')](_0x1f1b37[_0x4a5f('0x30')],_0x3737e2[_0x4a5f('0x31')]));if(_0x1f1b37[_0x4a5f('0x30')][_0x4a5f('0x3a')]){_0x34241b[_0x4a5f('0x38')]=_[_0x4a5f('0x3b')](_0x34241b[_0x4a5f('0x38')],{'$or':_[_0x4a5f('0x3c')](_0x1917ea,function(_0x3125a6){if(_0x3125a6[_0x4a5f('0x3d')][_0x4a5f('0x3e')]!==_0x4a5f('0x3f')){var _0x5dbcb8={};_0x5dbcb8[_0x3125a6['field']]={'$like':'%'+_0x1f1b37[_0x4a5f('0x30')][_0x4a5f('0x3a')]+'%'};return _0x5dbcb8;}})});}_0x34241b=_[_0x4a5f('0x3b')]({},_0x34241b,_0x1f1b37['options']);var _0x4bb0f4={'where':_0x34241b[_0x4a5f('0x38')]};return db[_0x4a5f('0x2c')]['count'](_0x4bb0f4)['then'](function(_0x641acf){_0x358b6c['count']=_0x641acf;if(_0x1f1b37[_0x4a5f('0x30')]['includeAll']){_0x34241b[_0x4a5f('0x40')]=[{'all':!![]}];}return db[_0x4a5f('0x2c')]['findAll'](_0x34241b);})[_0x4a5f('0x22')](function(_0xd9a2e9){_0x358b6c[_0x4a5f('0x41')]=_0xd9a2e9;return _0x358b6c;})[_0x4a5f('0x22')](respondWithFilteredResult(_0x4f7e10,_0x34241b))[_0x4a5f('0x42')](handleError(_0x4f7e10,null));};exports[_0x4a5f('0x43')]=function(_0x2a417f,_0x24a915){var _0x424752={'raw':!![],'where':{'id':_0x2a417f[_0x4a5f('0x44')]['id']}},_0x2584c7={};_0x2584c7[_0x4a5f('0x2e')]=_[_0x4a5f('0x2f')](db[_0x4a5f('0x2c')][_0x4a5f('0x2d')]);_0x2584c7['query']=_[_0x4a5f('0x2f')](_0x2a417f[_0x4a5f('0x30')]);_0x2584c7[_0x4a5f('0x31')]=_[_0x4a5f('0x32')](_0x2584c7[_0x4a5f('0x2e')],_0x2584c7[_0x4a5f('0x30')]);_0x424752[_0x4a5f('0x33')]=_[_0x4a5f('0x32')](_0x2584c7[_0x4a5f('0x2e')],qs['fields'](_0x2a417f['query'][_0x4a5f('0x34')]));_0x424752[_0x4a5f('0x33')]=_0x424752[_0x4a5f('0x33')]['length']?_0x424752[_0x4a5f('0x33')]:_0x2584c7['model'];if(_0x2a417f[_0x4a5f('0x30')][_0x4a5f('0x45')]){_0x424752['include']=[{'all':!![]}];}_0x424752=_['merge']({},_0x424752,_0x2a417f[_0x4a5f('0x46')]);return db[_0x4a5f('0x2c')][_0x4a5f('0x47')](_0x424752)[_0x4a5f('0x22')](handleEntityNotFound(_0x24a915,null))['then'](respondWithResult(_0x24a915,null))['catch'](handleError(_0x24a915,null));};exports['create']=function(_0x76efc2,_0x4b15aa){return db[_0x4a5f('0x2c')][_0x4a5f('0x48')](_0x76efc2[_0x4a5f('0x49')],{})[_0x4a5f('0x22')](function(_0x22e46f){var _0x378b17=_0x76efc2[_0x4a5f('0x4a')][_0x4a5f('0x23')]({'plain':!![]});if(!_0x378b17)throw new Error(_0x4a5f('0x4b'));if(_0x378b17[_0x4a5f('0x4c')]===_0x4a5f('0x4a')){var _0x383e5d=_0x22e46f[_0x4a5f('0x23')]({'plain':!![]});var _0x5eb7d2=_0x4a5f('0x24');return db[_0x4a5f('0x4d')][_0x4a5f('0x47')]({'where':{'name':_0x5eb7d2,'userProfileId':_0x378b17[_0x4a5f('0x4e')]},'raw':!![]})[_0x4a5f('0x22')](function(_0x7685ce){if(_0x7685ce&&_0x7685ce[_0x4a5f('0x4f')]===0x0){return db['UserProfileResource'][_0x4a5f('0x48')]({'name':_0x383e5d[_0x4a5f('0x2a')],'resourceId':_0x383e5d['id'],'type':_0x7685ce[_0x4a5f('0x2a')],'sectionId':_0x7685ce['id']},{})[_0x4a5f('0x22')](function(){return _0x22e46f;});}else{return _0x22e46f;}})['catch'](function(_0x48d24a){logger[_0x4a5f('0x28')](_0x4a5f('0x50'),_0x48d24a);throw _0x48d24a;});}return _0x22e46f;})[_0x4a5f('0x22')](respondWithResult(_0x4b15aa,0xc9))[_0x4a5f('0x42')](handleError(_0x4b15aa,null));};exports[_0x4a5f('0x21')]=function(_0x970725,_0x2e976c){if(_0x970725['body']['id']){delete _0x970725[_0x4a5f('0x49')]['id'];}return db['Pause']['find']({'where':{'id':_0x970725['params']['id']}})[_0x4a5f('0x22')](handleEntityNotFound(_0x2e976c,null))['then'](saveUpdates(_0x970725[_0x4a5f('0x49')],null))[_0x4a5f('0x22')](respondWithResult(_0x2e976c,null))[_0x4a5f('0x42')](handleError(_0x2e976c,null));};exports[_0x4a5f('0x51')]=function(_0x3fd739,_0x428cfd){return db[_0x4a5f('0x2c')][_0x4a5f('0x47')]({'where':{'id':_0x3fd739[_0x4a5f('0x44')]['id']}})['then'](handleEntityNotFound(_0x428cfd,null))[_0x4a5f('0x22')](removeEntity(_0x428cfd,null))[_0x4a5f('0x42')](handleError(_0x428cfd,null));}; \ No newline at end of file +var _0xc3e7=['then','error','stack','name','send','index','Pause','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','key','VIRTUAL','field','options','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','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','Content-Range','json','apply','reject','save','update','Pauses','UserProfileResource','destroy'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xc3e7,0x178));var _0x7c3e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xc3e7[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x7c3e('0x0'));var emlformat=require(_0x7c3e('0x1'));var rimraf=require(_0x7c3e('0x2'));var zipdir=require(_0x7c3e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c3e('0x4'));var moment=require(_0x7c3e('0x5'));var BPromise=require(_0x7c3e('0x6'));var Mustache=require('mustache');var util=require(_0x7c3e('0x7'));var path=require(_0x7c3e('0x8'));var sox=require(_0x7c3e('0x9'));var csv=require(_0x7c3e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c3e('0xb'));var squel=require(_0x7c3e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c3e('0xa'));var querystring=require(_0x7c3e('0xd'));var Papa=require(_0x7c3e('0xe'));var Redis=require(_0x7c3e('0xf'));var authService=require(_0x7c3e('0x10'));var qs=require(_0x7c3e('0x11'));var hardwareService=require(_0x7c3e('0x12'));var logger=require(_0x7c3e('0x13'))(_0x7c3e('0x14'));var utils=require(_0x7c3e('0x15'));var config=require(_0x7c3e('0x16'));var db=require(_0x7c3e('0x17'))['db'];function respondWithStatusCode(_0x3aa267,_0x2cca39){_0x2cca39=_0x2cca39||0xcc;return function(_0x13cb8a){if(_0x13cb8a){return _0x3aa267[_0x7c3e('0x18')](_0x2cca39);}return _0x3aa267[_0x7c3e('0x19')](_0x2cca39)[_0x7c3e('0x1a')]();};}function respondWithResult(_0x58ee9c,_0x33aeb8){_0x33aeb8=_0x33aeb8||0xc8;return function(_0x3c0fb3){if(_0x3c0fb3){return _0x58ee9c[_0x7c3e('0x19')](_0x33aeb8)['json'](_0x3c0fb3);}};}function respondWithFilteredResult(_0x1ae23f,_0x11d65c){return function(_0x219752){if(_0x219752){var _0x229630=_0x219752[_0x7c3e('0x1b')],_0x3249eb=_0x11d65c['offset'],_0x1d4aaa=_0x11d65c[_0x7c3e('0x1c')]+_0x11d65c[_0x7c3e('0x1d')],_0x25ffea;if(_0x1d4aaa>=_0x229630){_0x1d4aaa=_0x229630;_0x25ffea=0xc8;}else{_0x25ffea=0xce;}_0x1ae23f[_0x7c3e('0x19')](_0x25ffea);return _0x1ae23f['set'](_0x7c3e('0x1e'),_0x3249eb+'-'+_0x1d4aaa+'/'+_0x229630)[_0x7c3e('0x1f')](_0x219752);}return null;};}function patchUpdates(_0x5ae391){return function(_0x282d7d){try{jsonpatch[_0x7c3e('0x20')](_0x282d7d,_0x5ae391,!![]);}catch(_0x2c0cd1){return BPromise[_0x7c3e('0x21')](_0x2c0cd1);}return _0x282d7d[_0x7c3e('0x22')]();};}function saveUpdates(_0x525be1,_0x5d59de){return function(_0x5a8273){if(_0x5a8273){return _0x5a8273[_0x7c3e('0x23')](_0x525be1)['then'](function(_0x457a24){return _0x457a24;});}return null;};}function removeEntity(_0x4bf699,_0x1f3ce4){return function(_0x3f2f29){if(_0x3f2f29){return _0x3f2f29['destroy']()['then'](function(){var _0xa7ac18=_0x3f2f29['get']({'plain':!![]});var _0x2c25e8=_0x7c3e('0x24');return db[_0x7c3e('0x25')][_0x7c3e('0x26')]({'where':{'type':_0x2c25e8,'resourceId':_0xa7ac18['id']}})[_0x7c3e('0x27')](function(){return _0x3f2f29;});})[_0x7c3e('0x27')](function(){_0x4bf699[_0x7c3e('0x19')](0xcc)[_0x7c3e('0x1a')]();});}};}function handleEntityNotFound(_0x59c2e2,_0x3e89a1){return function(_0x1ceae8){if(!_0x1ceae8){_0x59c2e2[_0x7c3e('0x18')](0x194);}return _0x1ceae8;};}function handleError(_0x2344cc,_0x3659ff){_0x3659ff=_0x3659ff||0x1f4;return function(_0x38183c){logger[_0x7c3e('0x28')](_0x38183c[_0x7c3e('0x29')]);if(_0x38183c[_0x7c3e('0x2a')]){delete _0x38183c[_0x7c3e('0x2a')];}_0x2344cc[_0x7c3e('0x19')](_0x3659ff)[_0x7c3e('0x2b')](_0x38183c);};}exports[_0x7c3e('0x2c')]=function(_0xf3c96e,_0x16899f){var _0x5b4c66={},_0x32bd97={},_0x6ce511={'count':0x0,'rows':[]};var _0x1af03b=db[_0x7c3e('0x2d')]['rawAttributes'];_0x32bd97[_0x7c3e('0x2e')]=_[_0x7c3e('0x2f')](_0x1af03b);_0x32bd97[_0x7c3e('0x30')]=_[_0x7c3e('0x2f')](_0xf3c96e[_0x7c3e('0x30')]);_0x32bd97[_0x7c3e('0x31')]=_[_0x7c3e('0x32')](_0x32bd97[_0x7c3e('0x2e')],_0x32bd97[_0x7c3e('0x30')]);_0x5b4c66[_0x7c3e('0x33')]=_[_0x7c3e('0x32')](_0x32bd97[_0x7c3e('0x2e')],qs[_0x7c3e('0x34')](_0xf3c96e[_0x7c3e('0x30')][_0x7c3e('0x34')]));_0x5b4c66['attributes']=_0x5b4c66['attributes'][_0x7c3e('0x35')]?_0x5b4c66[_0x7c3e('0x33')]:_0x32bd97[_0x7c3e('0x2e')];if(!_0xf3c96e[_0x7c3e('0x30')][_0x7c3e('0x36')](_0x7c3e('0x37'))){_0x5b4c66[_0x7c3e('0x1d')]=qs[_0x7c3e('0x1d')](_0xf3c96e['query'][_0x7c3e('0x1d')]);_0x5b4c66[_0x7c3e('0x1c')]=qs['offset'](_0xf3c96e['query'][_0x7c3e('0x1c')]);}_0x5b4c66[_0x7c3e('0x38')]=qs[_0x7c3e('0x39')](_0xf3c96e['query'][_0x7c3e('0x39')]);_0x5b4c66[_0x7c3e('0x3a')]=qs[_0x7c3e('0x31')](_['pick'](_0xf3c96e[_0x7c3e('0x30')],_0x32bd97[_0x7c3e('0x31')]));if(_0xf3c96e[_0x7c3e('0x30')][_0x7c3e('0x3b')]){_0x5b4c66[_0x7c3e('0x3a')]=_[_0x7c3e('0x3c')](_0x5b4c66[_0x7c3e('0x3a')],{'$or':_[_0x7c3e('0x3d')](_0x1af03b,function(_0x40fc66){if(_0x40fc66['type'][_0x7c3e('0x3e')]!==_0x7c3e('0x3f')){var _0x9b4a8e={};_0x9b4a8e[_0x40fc66[_0x7c3e('0x40')]]={'$like':'%'+_0xf3c96e[_0x7c3e('0x30')]['filter']+'%'};return _0x9b4a8e;}})});}_0x5b4c66=_[_0x7c3e('0x3c')]({},_0x5b4c66,_0xf3c96e[_0x7c3e('0x41')]);var _0x5e6e5c={'where':_0x5b4c66['where']};return db[_0x7c3e('0x2d')][_0x7c3e('0x1b')](_0x5e6e5c)['then'](function(_0x23efb7){_0x6ce511[_0x7c3e('0x1b')]=_0x23efb7;if(_0xf3c96e[_0x7c3e('0x30')]['includeAll']){_0x5b4c66[_0x7c3e('0x42')]=[{'all':!![]}];}return db[_0x7c3e('0x2d')][_0x7c3e('0x43')](_0x5b4c66);})['then'](function(_0x18d9a0){_0x6ce511[_0x7c3e('0x44')]=_0x18d9a0;return _0x6ce511;})['then'](respondWithFilteredResult(_0x16899f,_0x5b4c66))[_0x7c3e('0x45')](handleError(_0x16899f,null));};exports[_0x7c3e('0x46')]=function(_0x505848,_0x4c2280){var _0x2b75c2={'raw':!![],'where':{'id':_0x505848['params']['id']}},_0x3e10fe={};_0x3e10fe[_0x7c3e('0x2e')]=_['keys'](db[_0x7c3e('0x2d')][_0x7c3e('0x47')]);_0x3e10fe['query']=_['keys'](_0x505848[_0x7c3e('0x30')]);_0x3e10fe['filters']=_['intersection'](_0x3e10fe[_0x7c3e('0x2e')],_0x3e10fe[_0x7c3e('0x30')]);_0x2b75c2[_0x7c3e('0x33')]=_['intersection'](_0x3e10fe[_0x7c3e('0x2e')],qs['fields'](_0x505848[_0x7c3e('0x30')]['fields']));_0x2b75c2[_0x7c3e('0x33')]=_0x2b75c2[_0x7c3e('0x33')][_0x7c3e('0x35')]?_0x2b75c2['attributes']:_0x3e10fe[_0x7c3e('0x2e')];if(_0x505848[_0x7c3e('0x30')][_0x7c3e('0x48')]){_0x2b75c2[_0x7c3e('0x42')]=[{'all':!![]}];}_0x2b75c2=_[_0x7c3e('0x3c')]({},_0x2b75c2,_0x505848[_0x7c3e('0x41')]);return db['Pause']['find'](_0x2b75c2)[_0x7c3e('0x27')](handleEntityNotFound(_0x4c2280,null))[_0x7c3e('0x27')](respondWithResult(_0x4c2280,null))['catch'](handleError(_0x4c2280,null));};exports[_0x7c3e('0x49')]=function(_0xa72ed7,_0x2e4435){return db['Pause']['create'](_0xa72ed7[_0x7c3e('0x4a')],{})[_0x7c3e('0x27')](function(_0x18d727){var _0x3f5155=_0xa72ed7['user'][_0x7c3e('0x4b')]({'plain':!![]});if(!_0x3f5155)throw new Error(_0x7c3e('0x4c'));if(_0x3f5155[_0x7c3e('0x4d')]===_0x7c3e('0x4e')){var _0x328bb3=_0x18d727[_0x7c3e('0x4b')]({'plain':!![]});var _0x5a2660='Pauses';return db[_0x7c3e('0x4f')][_0x7c3e('0x50')]({'where':{'name':_0x5a2660,'userProfileId':_0x3f5155[_0x7c3e('0x51')]},'raw':!![]})[_0x7c3e('0x27')](function(_0x147ee5){if(_0x147ee5&&_0x147ee5['autoAssociation']===0x0){return db[_0x7c3e('0x25')][_0x7c3e('0x49')]({'name':_0x328bb3[_0x7c3e('0x2a')],'resourceId':_0x328bb3['id'],'type':_0x147ee5[_0x7c3e('0x2a')],'sectionId':_0x147ee5['id']},{})[_0x7c3e('0x27')](function(){return _0x18d727;});}else{return _0x18d727;}})[_0x7c3e('0x45')](function(_0xeb299f){logger[_0x7c3e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeb299f);throw _0xeb299f;});}return _0x18d727;})['then'](respondWithResult(_0x2e4435,0xc9))[_0x7c3e('0x45')](handleError(_0x2e4435,null));};exports[_0x7c3e('0x23')]=function(_0x23f695,_0x4965c0){if(_0x23f695[_0x7c3e('0x4a')]['id']){delete _0x23f695['body']['id'];}return db[_0x7c3e('0x2d')][_0x7c3e('0x50')]({'where':{'id':_0x23f695['params']['id']}})[_0x7c3e('0x27')](handleEntityNotFound(_0x4965c0,null))[_0x7c3e('0x27')](saveUpdates(_0x23f695[_0x7c3e('0x4a')],null))[_0x7c3e('0x27')](respondWithResult(_0x4965c0,null))[_0x7c3e('0x45')](handleError(_0x4965c0,null));};exports[_0x7c3e('0x26')]=function(_0x419163,_0x1cd7d6){return db[_0x7c3e('0x2d')][_0x7c3e('0x50')]({'where':{'id':_0x419163[_0x7c3e('0x52')]['id']}})[_0x7c3e('0x27')](handleEntityNotFound(_0x1cd7d6,null))[_0x7c3e('0x27')](removeEntity(_0x1cd7d6,null))['catch'](handleError(_0x1cd7d6,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 73c3eae..b3e517c 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 _0x48ac=['../../config/environment','./pause.attributes','exports','tools_pauses','util','api','moment','bluebird','path','rimraf'];(function(_0x43df87,_0x59bac7){var _0x49caaf=function(_0x3d356c){while(--_0x3d356c){_0x43df87['push'](_0x43df87['shift']());}};_0x49caaf(++_0x59bac7);}(_0x48ac,0xe0));var _0xc48a=function(_0x9e2c55,_0x4d94c8){_0x9e2c55=_0x9e2c55-0x0;var _0x5c62b6=_0x48ac[_0x9e2c55];return _0x5c62b6;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var logger=require('../../config/logger')(_0xc48a('0x1'));var moment=require(_0xc48a('0x2'));var BPromise=require(_0xc48a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc48a('0x4'));var rimraf=require(_0xc48a('0x5'));var config=require(_0xc48a('0x6'));var attributes=require(_0xc48a('0x7'));module[_0xc48a('0x8')]=function(_0x499749,_0x48205f){return _0x499749['define']('Pause',attributes,{'tableName':_0xc48a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f83=['bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','util','../../config/logger','moment'];(function(_0x4fbcae,_0x22b1e3){var _0x1eba41=function(_0x5bcf9e){while(--_0x5bcf9e){_0x4fbcae['push'](_0x4fbcae['shift']());}};_0x1eba41(++_0x22b1e3);}(_0x6f83,0x72));var _0x36f8=function(_0x518a1f,_0x13dea4){_0x518a1f=_0x518a1f-0x0;var _0x81524a=_0x6f83[_0x518a1f];return _0x81524a;};'use strict';var _=require('lodash');var util=require(_0x36f8('0x0'));var logger=require(_0x36f8('0x1'))('api');var moment=require(_0x36f8('0x2'));var BPromise=require(_0x36f8('0x3'));var rp=require(_0x36f8('0x4'));var fs=require('fs');var path=require(_0x36f8('0x5'));var rimraf=require(_0x36f8('0x6'));var config=require(_0x36f8('0x7'));var attributes=require(_0x36f8('0x8'));module[_0x36f8('0x9')]=function(_0x31ff95,_0x3b9620){return _0x31ff95[_0x36f8('0xa')](_0x36f8('0xb'),attributes,{'tableName':_0x36f8('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 5d6a675..c81ef13 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 _0xfc02=['http','then','info','Pause,\x20%s,\x20%s','debug','stringify','error','message','result','catch','ShowPause','options','raw','where','attributes','include','map','model','lodash','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x123092,_0x4655bc){var _0x2816cc=function(_0x106014){while(--_0x106014){_0x123092['push'](_0x123092['shift']());}};_0x2816cc(++_0x4655bc);}(_0xfc02,0x1da));var _0x2fc0=function(_0x590066,_0xec971c){_0x590066=_0x590066-0x0;var _0x5c4ce7=_0xfc02[_0x590066];return _0x5c4ce7;};'use strict';var _=require(_0x2fc0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2fc0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fc0('0x2'));var db=require(_0x2fc0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2fc0('0x4'));var jayson=require(_0x2fc0('0x5'));var client=jayson['client'][_0x2fc0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x33ef35,_0x5ee286,_0x48f48c){return new BPromise(function(_0x563ba7,_0xb724f8){return client['request'](_0x33ef35,_0x48f48c)[_0x2fc0('0x7')](function(_0x3cf0b0){logger[_0x2fc0('0x8')](_0x2fc0('0x9'),_0x5ee286,'request\x20sent');logger[_0x2fc0('0xa')]('Pause,\x20%s,\x20%s,\x20%s',_0x5ee286,'request\x20sent',JSON[_0x2fc0('0xb')](_0x3cf0b0));if(_0x3cf0b0[_0x2fc0('0xc')]){if(_0x3cf0b0[_0x2fc0('0xc')]['code']===0x1f4){logger[_0x2fc0('0xc')](_0x2fc0('0x9'),_0x5ee286,_0x3cf0b0[_0x2fc0('0xc')][_0x2fc0('0xd')]);return _0xb724f8(_0x3cf0b0[_0x2fc0('0xc')]['message']);}logger['error'](_0x2fc0('0x9'),_0x5ee286,_0x3cf0b0[_0x2fc0('0xc')][_0x2fc0('0xd')]);return _0x563ba7(_0x3cf0b0[_0x2fc0('0xc')][_0x2fc0('0xd')]);}else{logger[_0x2fc0('0x8')]('Pause,\x20%s,\x20%s',_0x5ee286,'request\x20sent');_0x563ba7(_0x3cf0b0[_0x2fc0('0xe')][_0x2fc0('0xd')]);}})[_0x2fc0('0xf')](function(_0x4a36cc){logger['error']('Pause,\x20%s,\x20%s',_0x5ee286,_0x4a36cc);_0xb724f8(_0x4a36cc);});});}exports[_0x2fc0('0x10')]=function(_0x3b43f4){var _0x2f1702=this;return new Promise(function(_0x4a6ef4,_0x231a84){return db['Pause']['find']({'raw':_0x3b43f4['options']?_0x3b43f4[_0x2fc0('0x11')][_0x2fc0('0x12')]===undefined?!![]:![]:!![],'where':_0x3b43f4['options']?_0x3b43f4[_0x2fc0('0x11')][_0x2fc0('0x13')]||null:null,'attributes':_0x3b43f4[_0x2fc0('0x11')]?_0x3b43f4[_0x2fc0('0x11')][_0x2fc0('0x14')]||null:null,'include':_0x3b43f4[_0x2fc0('0x11')]?_0x3b43f4[_0x2fc0('0x11')][_0x2fc0('0x15')]?_[_0x2fc0('0x16')](_0x3b43f4[_0x2fc0('0x11')][_0x2fc0('0x15')],function(_0x573ae2){return{'model':db[_0x573ae2['model']],'as':_0x573ae2['as'],'attributes':_0x573ae2[_0x2fc0('0x14')],'include':_0x573ae2[_0x2fc0('0x15')]?_[_0x2fc0('0x16')](_0x573ae2[_0x2fc0('0x15')],function(_0x57d8cc){return{'model':db[_0x57d8cc['model']],'as':_0x57d8cc['as'],'attributes':_0x57d8cc[_0x2fc0('0x14')],'include':_0x57d8cc[_0x2fc0('0x15')]?_[_0x2fc0('0x16')](_0x57d8cc[_0x2fc0('0x15')],function(_0x5bfe0a){return{'model':db[_0x5bfe0a[_0x2fc0('0x17')]],'as':_0x5bfe0a['as'],'attributes':_0x5bfe0a[_0x2fc0('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x559f35){logger[_0x2fc0('0x8')](_0x2fc0('0x10'),_0x3b43f4);logger[_0x2fc0('0xa')](_0x2fc0('0x10'),_0x3b43f4,JSON[_0x2fc0('0xb')](_0x559f35));_0x4a6ef4(_0x559f35);})[_0x2fc0('0xf')](function(_0x1245ee){logger['error'](_0x2fc0('0x10'),_0x1245ee['message'],_0x3b43f4);_0x231a84(_0x2f1702[_0x2fc0('0xc')](0x1f4,_0x1245ee[_0x2fc0('0xd')]));});});}; \ No newline at end of file +var _0x45c9=['../../config/utils','rpc','jayson/promise','client','http','request','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowPause','find','options','raw','where','attributes','include','map','model','then','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4bab67,_0x2fb577){var _0x1ab1a5=function(_0x1e0125){while(--_0x1e0125){_0x4bab67['push'](_0x4bab67['shift']());}};_0x1ab1a5(++_0x2fb577);}(_0x45c9,0x96));var _0x945c=function(_0x5773eb,_0x519f0b){_0x5773eb=_0x5773eb-0x0;var _0x2fcbe5=_0x45c9[_0x5773eb];return _0x2fcbe5;};'use strict';var _=require('lodash');var util=require(_0x945c('0x0'));var moment=require('moment');var BPromise=require(_0x945c('0x1'));var rs=require(_0x945c('0x2'));var fs=require('fs');var Redis=require(_0x945c('0x3'));var db=require(_0x945c('0x4'))['db'];var utils=require(_0x945c('0x5'));var logger=require('../../config/logger')(_0x945c('0x6'));var config=require('../../config/environment');var jayson=require(_0x945c('0x7'));var client=jayson[_0x945c('0x8')][_0x945c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5c07,_0x265b02,_0x9a988b){return new BPromise(function(_0x4253bf,_0x56c700){return client[_0x945c('0xa')](_0x3c5c07,_0x9a988b)['then'](function(_0x439b59){logger['info'](_0x945c('0xb'),_0x265b02,'request\x20sent');logger[_0x945c('0xc')](_0x945c('0xd'),_0x265b02,_0x945c('0xe'),JSON[_0x945c('0xf')](_0x439b59));if(_0x439b59[_0x945c('0x10')]){if(_0x439b59[_0x945c('0x10')][_0x945c('0x11')]===0x1f4){logger[_0x945c('0x10')](_0x945c('0xb'),_0x265b02,_0x439b59[_0x945c('0x10')][_0x945c('0x12')]);return _0x56c700(_0x439b59[_0x945c('0x10')][_0x945c('0x12')]);}logger[_0x945c('0x10')]('Pause,\x20%s,\x20%s',_0x265b02,_0x439b59[_0x945c('0x10')][_0x945c('0x12')]);return _0x4253bf(_0x439b59[_0x945c('0x10')][_0x945c('0x12')]);}else{logger[_0x945c('0x13')](_0x945c('0xb'),_0x265b02,_0x945c('0xe'));_0x4253bf(_0x439b59['result'][_0x945c('0x12')]);}})[_0x945c('0x14')](function(_0x3bfb01){logger['error'](_0x945c('0xb'),_0x265b02,_0x3bfb01);_0x56c700(_0x3bfb01);});});}exports[_0x945c('0x15')]=function(_0x314d7a){var _0xbc5e03=this;return new Promise(function(_0x828fb9,_0x27a48f){return db['Pause'][_0x945c('0x16')]({'raw':_0x314d7a[_0x945c('0x17')]?_0x314d7a[_0x945c('0x17')][_0x945c('0x18')]===undefined?!![]:![]:!![],'where':_0x314d7a[_0x945c('0x17')]?_0x314d7a['options'][_0x945c('0x19')]||null:null,'attributes':_0x314d7a['options']?_0x314d7a[_0x945c('0x17')][_0x945c('0x1a')]||null:null,'include':_0x314d7a[_0x945c('0x17')]?_0x314d7a['options'][_0x945c('0x1b')]?_['map'](_0x314d7a[_0x945c('0x17')][_0x945c('0x1b')],function(_0x30ac5f){return{'model':db[_0x30ac5f['model']],'as':_0x30ac5f['as'],'attributes':_0x30ac5f[_0x945c('0x1a')],'include':_0x30ac5f[_0x945c('0x1b')]?_[_0x945c('0x1c')](_0x30ac5f[_0x945c('0x1b')],function(_0xa64f4){return{'model':db[_0xa64f4[_0x945c('0x1d')]],'as':_0xa64f4['as'],'attributes':_0xa64f4[_0x945c('0x1a')],'include':_0xa64f4[_0x945c('0x1b')]?_[_0x945c('0x1c')](_0xa64f4[_0x945c('0x1b')],function(_0xc06694){return{'model':db[_0xc06694[_0x945c('0x1d')]],'as':_0xc06694['as'],'attributes':_0xc06694['attributes']};}):[]};}):[]};}):[]:[]})[_0x945c('0x1e')](function(_0x2b5cd1){logger[_0x945c('0x13')](_0x945c('0x15'),_0x314d7a);logger[_0x945c('0xc')]('ShowPause',_0x314d7a,JSON['stringify'](_0x2b5cd1));_0x828fb9(_0x2b5cd1);})[_0x945c('0x14')](function(_0x19d9bb){logger[_0x945c('0x10')](_0x945c('0x15'),_0x19d9bb[_0x945c('0x12')],_0x314d7a);_0x27a48f(_0xbc5e03[_0x945c('0x10')](0x1f4,_0x19d9bb[_0x945c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 5f489db..6f9f8ba 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 _0x80e8=['extname','now','single','upload','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x80e8,0x1a1));var _0x880e=function(_0x454571,_0x41f0da){_0x454571=_0x454571-0x0;var _0x5b652c=_0x80e8[_0x454571];return _0x5b652c;};'use strict';var multer=require('multer');var util=require(_0x880e('0x0'));var path=require(_0x880e('0x1'));var timeout=require(_0x880e('0x2'));var express=require(_0x880e('0x3'));var router=express[_0x880e('0x4')]();var auth=require(_0x880e('0x5'));var interaction=require(_0x880e('0x6'));var config=require(_0x880e('0x7'));var controller=require(_0x880e('0x8'));router[_0x880e('0x9')]('/',auth[_0x880e('0xa')](),controller['index']);router['get'](_0x880e('0xb'),controller[_0x880e('0xc')]);router[_0x880e('0x9')](_0x880e('0xd'),auth['isAuthenticated'](),controller[_0x880e('0xe')]);router['get'](_0x880e('0xf'),auth[_0x880e('0xa')](),controller[_0x880e('0x10')]);var upload=multer({'storage':multer[_0x880e('0x11')]({'destination':function(_0x3b9b89,_0x4a7a1f,_0x4cb11a){_0x4cb11a(null,path[_0x880e('0x12')](config[_0x880e('0x13')],_0x880e('0x14')));},'filename':function(_0x3d84ac,_0x2412db,_0x6840aa){_0x2412db[_0x880e('0x15')]=_0x2412db[_0x880e('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6840aa(null,util[_0x880e('0x16')](_0x880e('0x17'),path[_0x880e('0x18')](_0x2412db['originalname'],path[_0x880e('0x19')](_0x2412db[_0x880e('0x15')])),Date[_0x880e('0x1a')](),path['extname'](_0x2412db[_0x880e('0x15')])));}})});router['post']('/',upload[_0x880e('0x1b')]('file'),controller[_0x880e('0x1c')]);router['post'](_0x880e('0xb'),controller[_0x880e('0x1d')]);router[_0x880e('0x1e')](_0x880e('0xd'),auth[_0x880e('0xa')](),controller[_0x880e('0x1f')]);router[_0x880e('0x20')](_0x880e('0xd'),auth[_0x880e('0xa')](),controller[_0x880e('0x20')]);module[_0x880e('0x21')]=router; \ No newline at end of file +var _0xfad3=['now','extname','post','single','file','webhookPost','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','/:id/download','diskStorage','root','originalname','format','%s-%s%s','basename'];(function(_0x1ddc6c,_0x45f13c){var _0x3bbc00=function(_0x4dfc85){while(--_0x4dfc85){_0x1ddc6c['push'](_0x1ddc6c['shift']());}};_0x3bbc00(++_0x45f13c);}(_0xfad3,0xf9));var _0x3fad=function(_0xe525c9,_0x5c612d){_0xe525c9=_0xe525c9-0x0;var _0x5dc0d9=_0xfad3[_0xe525c9];return _0x5dc0d9;};'use strict';var multer=require(_0x3fad('0x0'));var util=require(_0x3fad('0x1'));var path=require(_0x3fad('0x2'));var timeout=require(_0x3fad('0x3'));var express=require('express');var router=express[_0x3fad('0x4')]();var auth=require(_0x3fad('0x5'));var interaction=require(_0x3fad('0x6'));var config=require(_0x3fad('0x7'));var controller=require(_0x3fad('0x8'));router[_0x3fad('0x9')]('/',auth[_0x3fad('0xa')](),controller[_0x3fad('0xb')]);router[_0x3fad('0x9')](_0x3fad('0xc'),controller['webhookGet']);router[_0x3fad('0x9')](_0x3fad('0xd'),auth[_0x3fad('0xa')](),controller['show']);router['get'](_0x3fad('0xe'),auth[_0x3fad('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x3fad('0xf')]({'destination':function(_0x14c4d2,_0x359459,_0x4157d5){_0x4157d5(null,path['join'](config[_0x3fad('0x10')],'server/files/plugins'));},'filename':function(_0x51213a,_0x20043b,_0x2d314b){_0x20043b[_0x3fad('0x11')]=_0x20043b[_0x3fad('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d314b(null,util[_0x3fad('0x12')](_0x3fad('0x13'),path[_0x3fad('0x14')](_0x20043b[_0x3fad('0x11')],path['extname'](_0x20043b[_0x3fad('0x11')])),Date[_0x3fad('0x15')](),path[_0x3fad('0x16')](_0x20043b['originalname'])));}})});router[_0x3fad('0x17')]('/',upload[_0x3fad('0x18')](_0x3fad('0x19')),controller['upload']);router[_0x3fad('0x17')]('/webhook',controller[_0x3fad('0x1a')]);router[_0x3fad('0x1b')](_0x3fad('0xd'),auth[_0x3fad('0xa')](),controller['update']);router['delete']('/:id',auth[_0x3fad('0xa')](),controller[_0x3fad('0x1c')]);module[_0x3fad('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 2329ae8..ea763c0 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 _0x6c2c=['always','never','sequelize','exports','STRING','ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x6c2c,0x188));var _0xc6c2=function(_0x33342e,_0x5d3a7f){_0x33342e=_0x33342e-0x0;var _0x3eb080=_0x6c2c[_0x33342e];return _0x3eb080;};'use strict';var Sequelize=require(_0xc6c2('0x0'));module[_0xc6c2('0x1')]={'name':{'type':Sequelize[_0xc6c2('0x2')]},'type':{'type':Sequelize[_0xc6c2('0x3')]('html','script')},'description':{'type':Sequelize[_0xc6c2('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xc6c2('0x2')],'comment':_0xc6c2('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc6c2('0x6')},'sidebar':{'type':Sequelize[_0xc6c2('0x3')](_0xc6c2('0x7'),'agentOnly',_0xc6c2('0x8'),_0xc6c2('0x9')),'defaultValue':_0xc6c2('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xc6c2('0x2')]},'adminUrl':{'type':Sequelize[_0xc6c2('0x2')]},'agentUrl':{'type':Sequelize[_0xc6c2('0x2')]},'scriptName':{'type':Sequelize[_0xc6c2('0x2')]},'scriptPath':{'type':Sequelize[_0xc6c2('0x2')]}}; \ No newline at end of file +var _0xb135=['sequelize','exports','ENUM','script','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xb135,0x15c));var _0x5b13=function(_0x33121c,_0x1cde5){_0x33121c=_0x33121c-0x0;var _0x3ff844=_0xb135[_0x33121c];return _0x3ff844;};'use strict';var Sequelize=require(_0x5b13('0x0'));module[_0x5b13('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5b13('0x2')]('html',_0x5b13('0x3'))},'description':{'type':Sequelize[_0x5b13('0x4')]},'version':{'type':Sequelize[_0x5b13('0x4')]},'path':{'type':Sequelize[_0x5b13('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5b13('0x6')},'sidebar':{'type':Sequelize[_0x5b13('0x2')](_0x5b13('0x7'),_0x5b13('0x8'),_0x5b13('0x9'),_0x5b13('0xa')),'defaultValue':'always','comment':_0x5b13('0xb')},'icon':{'type':Sequelize[_0x5b13('0x5')]},'adminUrl':{'type':Sequelize[_0x5b13('0x5')]},'agentUrl':{'type':Sequelize[_0x5b13('0x5')]},'scriptName':{'type':Sequelize[_0x5b13('0x5')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 55ce01a..af03bff 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 _0x719f=['socket.io-emitter','./plugin.socket','register','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','Plugins','sendStatus','error','send','Plugin','rawAttributes','keys','query','filters','intersection','model','fields','attributes','sort','where','pick','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','params','length','find','download','name','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','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','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','http://localhost:','%s%s','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults'];(function(_0x1dacd4,_0x4259f7){var _0x5c29c5=function(_0x388498){while(--_0x388498){_0x1dacd4['push'](_0x1dacd4['shift']());}};_0x5c29c5(++_0x4259f7);}(_0x719f,0x1df));var _0xf719=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x719f[_0x5b3950];return _0x41e436;};'use strict';var pdf=require(_0xf719('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf719('0x1'));var zipdir=require(_0xf719('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf719('0x3'));var moment=require(_0xf719('0x4'));var BPromise=require(_0xf719('0x5'));var Mustache=require(_0xf719('0x6'));var util=require(_0xf719('0x7'));var path=require(_0xf719('0x8'));var sox=require(_0xf719('0x9'));var csv=require(_0xf719('0xa'));var ejs=require(_0xf719('0xb'));var fs=require('fs');var _=require(_0xf719('0xc'));var squel=require(_0xf719('0xd'));var crypto=require(_0xf719('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf719('0xf'));var toCsv=require(_0xf719('0xa'));var querystring=require(_0xf719('0x10'));var Papa=require(_0xf719('0x11'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0xf719('0x12'));var Redis=require(_0xf719('0x13'));var authService=require(_0xf719('0x14'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xf719('0x15'));var logger=require(_0xf719('0x16'))(_0xf719('0x17'));var utils=require(_0xf719('0x18'));var config=require(_0xf719('0x19'));var db=require(_0xf719('0x1a'))['db'];config['redis']=_[_0xf719('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf719('0x1c'))(new Redis(config['redis']));require(_0xf719('0x1d'))[_0xf719('0x1e')](socket);function respondWithStatusCode(_0x104266,_0x2c018e){_0x2c018e=_0x2c018e||0xcc;return function(_0x7b4b1f){if(_0x7b4b1f){return _0x104266['sendStatus'](_0x2c018e);}return _0x104266['status'](_0x2c018e)[_0xf719('0x1f')]();};}function respondWithResult(_0x135f1a,_0x13ae51){_0x13ae51=_0x13ae51||0xc8;return function(_0x5a6191){if(_0x5a6191){return _0x135f1a[_0xf719('0x20')](_0x13ae51)[_0xf719('0x21')](_0x5a6191);}};}function respondWithFilteredResult(_0x38cc05,_0x149bd3){return function(_0x4b7e61){if(_0x4b7e61){var _0x46ff4e=_0x4b7e61[_0xf719('0x22')],_0x23e231=_0x149bd3[_0xf719('0x23')],_0x545a97=_0x149bd3['offset']+_0x149bd3[_0xf719('0x24')],_0x35373a;if(_0x545a97>=_0x46ff4e){_0x545a97=_0x46ff4e;_0x35373a=0xc8;}else{_0x35373a=0xce;}_0x38cc05[_0xf719('0x20')](_0x35373a);return _0x38cc05['set'](_0xf719('0x25'),_0x23e231+'-'+_0x545a97+'/'+_0x46ff4e)[_0xf719('0x21')](_0x4b7e61);}return null;};}function patchUpdates(_0x4a7ba3){return function(_0x40aca3){try{jsonpatch[_0xf719('0x26')](_0x40aca3,_0x4a7ba3,!![]);}catch(_0x219421){return BPromise['reject'](_0x219421);}return _0x40aca3[_0xf719('0x27')]();};}function saveUpdates(_0x257dfe,_0x2e2327){return function(_0x1decd3){if(_0x1decd3){return _0x1decd3[_0xf719('0x28')](_0x257dfe)[_0xf719('0x29')](function(_0x49cf24){return _0x49cf24;});}return null;};}function removeEntity(_0x19bd6a,_0xfd78b2){return function(_0x319117){if(_0x319117){return _0x319117[_0xf719('0x2a')]()[_0xf719('0x29')](function(){var _0x5e537b=_0x319117[_0xf719('0x2b')]({'plain':!![]});var _0x351b82=_0xf719('0x2c');return db['UserProfileResource'][_0xf719('0x2a')]({'where':{'type':_0x351b82,'resourceId':_0x5e537b['id']}})[_0xf719('0x29')](function(){return _0x319117;});})[_0xf719('0x29')](function(){_0x19bd6a[_0xf719('0x20')](0xcc)[_0xf719('0x1f')]();});}};}function handleEntityNotFound(_0x27ad58,_0x373425){return function(_0xfb6132){if(!_0xfb6132){_0x27ad58[_0xf719('0x2d')](0x194);}return _0xfb6132;};}function handleError(_0x286c32,_0x160bf6){_0x160bf6=_0x160bf6||0x1f4;return function(_0x125ddc){logger[_0xf719('0x2e')](_0x125ddc['stack']);if(_0x125ddc['name']){delete _0x125ddc['name'];}_0x286c32[_0xf719('0x20')](_0x160bf6)[_0xf719('0x2f')](_0x125ddc);};}exports['index']=function(_0x2eab34,_0x283822){var _0x2c15be={},_0x3d3998={},_0x239102={'count':0x0,'rows':[]};var _0x191462=db[_0xf719('0x30')][_0xf719('0x31')];_0x3d3998['model']=_[_0xf719('0x32')](_0x191462);_0x3d3998[_0xf719('0x33')]=_[_0xf719('0x32')](_0x2eab34[_0xf719('0x33')]);_0x3d3998[_0xf719('0x34')]=_[_0xf719('0x35')](_0x3d3998[_0xf719('0x36')],_0x3d3998[_0xf719('0x33')]);_0x2c15be['attributes']=_['intersection'](_0x3d3998[_0xf719('0x36')],qs[_0xf719('0x37')](_0x2eab34[_0xf719('0x33')][_0xf719('0x37')]));_0x2c15be[_0xf719('0x38')]=_0x2c15be[_0xf719('0x38')]['length']?_0x2c15be[_0xf719('0x38')]:_0x3d3998[_0xf719('0x36')];if(!_0x2eab34[_0xf719('0x33')]['hasOwnProperty']('nolimit')){_0x2c15be['limit']=qs[_0xf719('0x24')](_0x2eab34[_0xf719('0x33')]['limit']);_0x2c15be[_0xf719('0x23')]=qs[_0xf719('0x23')](_0x2eab34['query'][_0xf719('0x23')]);}_0x2c15be['order']=qs['sort'](_0x2eab34[_0xf719('0x33')][_0xf719('0x39')]);_0x2c15be[_0xf719('0x3a')]=qs[_0xf719('0x34')](_[_0xf719('0x3b')](_0x2eab34['query'],_0x3d3998[_0xf719('0x34')]));if(_0x2eab34[_0xf719('0x33')]['filter']){_0x2c15be['where']=_[_0xf719('0x3c')](_0x2c15be[_0xf719('0x3a')],{'$or':_[_0xf719('0x3d')](_0x191462,function(_0x1adc5d){if(_0x1adc5d[_0xf719('0x3e')][_0xf719('0x3f')]!==_0xf719('0x40')){var _0x70ae6e={};_0x70ae6e[_0x1adc5d[_0xf719('0x41')]]={'$like':'%'+_0x2eab34['query']['filter']+'%'};return _0x70ae6e;}})});}_0x2c15be=_[_0xf719('0x3c')]({},_0x2c15be,_0x2eab34[_0xf719('0x42')]);var _0x388be2={'where':_0x2c15be[_0xf719('0x3a')]};return db[_0xf719('0x30')][_0xf719('0x22')](_0x388be2)[_0xf719('0x29')](function(_0x4c0eca){_0x239102[_0xf719('0x22')]=_0x4c0eca;if(_0x2eab34[_0xf719('0x33')][_0xf719('0x43')]){_0x2c15be[_0xf719('0x44')]=[{'all':!![]}];}return db['Plugin'][_0xf719('0x45')](_0x2c15be);})[_0xf719('0x29')](function(_0x447998){_0x239102[_0xf719('0x46')]=_0x447998;return _0x239102;})[_0xf719('0x29')](respondWithFilteredResult(_0x283822,_0x2c15be))[_0xf719('0x47')](handleError(_0x283822,null));};exports['show']=function(_0x387d84,_0x5e7c6a){var _0x58bf27={'raw':!![],'where':{'id':_0x387d84[_0xf719('0x48')]['id']}},_0x42c448={};_0x42c448['model']=_[_0xf719('0x32')](db[_0xf719('0x30')][_0xf719('0x31')]);_0x42c448['query']=_['keys'](_0x387d84[_0xf719('0x33')]);_0x42c448[_0xf719('0x34')]=_[_0xf719('0x35')](_0x42c448['model'],_0x42c448[_0xf719('0x33')]);_0x58bf27[_0xf719('0x38')]=_['intersection'](_0x42c448[_0xf719('0x36')],qs[_0xf719('0x37')](_0x387d84[_0xf719('0x33')][_0xf719('0x37')]));_0x58bf27[_0xf719('0x38')]=_0x58bf27['attributes'][_0xf719('0x49')]?_0x58bf27['attributes']:_0x42c448[_0xf719('0x36')];if(_0x387d84[_0xf719('0x33')][_0xf719('0x43')]){_0x58bf27[_0xf719('0x44')]=[{'all':!![]}];}_0x58bf27=_[_0xf719('0x3c')]({},_0x58bf27,_0x387d84[_0xf719('0x42')]);return db['Plugin'][_0xf719('0x4a')](_0x58bf27)['then'](handleEntityNotFound(_0x5e7c6a,null))[_0xf719('0x29')](respondWithResult(_0x5e7c6a,null))[_0xf719('0x47')](handleError(_0x5e7c6a,null));};exports[_0xf719('0x4b')]=function(_0x2b64c4,_0x2d65ce,_0x12b0a8){return db[_0xf719('0x30')][_0xf719('0x4a')]({'where':{'id':_0x2b64c4[_0xf719('0x48')]['id']},'attributes':[_0xf719('0x4c'),_0xf719('0x8')],'raw':!![]})[_0xf719('0x29')](handleEntityNotFound(_0x2d65ce,null))[_0xf719('0x29')](function(_0x5a9e64){if(_0x5a9e64){var _0x2d6513=path[_0xf719('0x4d')](config[_0xf719('0x4e')],_0xf719('0x4f'),util[_0xf719('0x50')](_0xf719('0x51'),path[_0xf719('0x52')](_0x5a9e64[_0xf719('0x8')])));var _0x43d2a5=fs[_0xf719('0x53')](_0x2d6513);var _0x4ad794=archiver(_0xf719('0x54'),{'zlib':{'level':0x9}});_0x4ad794['on'](_0xf719('0x55'),function(_0x5cecb6){if(_0x5cecb6[_0xf719('0x56')]===_0xf719('0x57')){logger[_0xf719('0x2e')](_0x5cecb6);}else{throw new db[(_0xf719('0x58'))][(_0xf719('0x59'))](_0xf719('0x5a'));}});_0x4ad794['on'](_0xf719('0x2e'),function(_0x4d9bdd){throw new db[(_0xf719('0x58'))][(_0xf719('0x59'))](_0xf719('0x5a'));});_0x4ad794['pipe'](_0x43d2a5);_0x4ad794[_0xf719('0x5b')]('**/*',{'cwd':path[_0xf719('0x4d')](config['root'],_0xf719('0x4f'),path[_0xf719('0x5c')](_0x5a9e64[_0xf719('0x8')])),'ignore':[path['join'](path['basename'](_0x5a9e64['path']),_0xf719('0x5d')),path[_0xf719('0x4d')](path[_0xf719('0x52')](_0x5a9e64[_0xf719('0x8')]),_0xf719('0x5e'))],'nodir':!![]})[_0xf719('0x5f')]();_0x43d2a5['on'](_0xf719('0x60'),function(){if(!fs[_0xf719('0x61')](_0x2d6513)){throw new db['Sequelize']['Error'](_0xf719('0x62'));}return _0x2d65ce[_0xf719('0x4b')](_0x2d6513,util[_0xf719('0x50')]('%s.zip',path[_0xf719('0x52')](_0x5a9e64['path'])),function(_0x1ceb30){if(_0x1ceb30){throw new db[(_0xf719('0x58'))][(_0xf719('0x59'))](_0xf719('0x63'));}fs['unlinkSync'](_0x2d6513);logger[_0xf719('0x64')](_0xf719('0x65'));logger[_0xf719('0x64')](_0xf719('0x66'));});});}return null;})[_0xf719('0x47')](handleError(_0x2d65ce,null));};exports[_0xf719('0x67')]=function(_0x3eb541,_0x5915e2,_0x567fa5){var _0x3b750f=path[_0xf719('0x52')](_0x3eb541[_0xf719('0x68')][_0xf719('0x69')],path['extname'](_0x3eb541[_0xf719('0x68')][_0xf719('0x69')]));var _0x1a48a5=path[_0xf719('0x4d')](config[_0xf719('0x4e')],'server/files/plugins',_0x3eb541['file']['filename']);var _0x5b43b9=path['join'](config[_0xf719('0x4e')],'server/files/plugins',_0x3b750f);logger[_0xf719('0x64')](_0xf719('0x6a'),_0x1a48a5);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x5b43b9);try{fs[_0xf719('0x6b')](_0x1a48a5,parseInt(_0xf719('0x6c'),0x8));extract(_0x1a48a5,{'dir':_0x5b43b9},function(_0x25b4a6){if(_0x25b4a6){logger['error'](_0x25b4a6);handleError(_0x25b4a6,!![]);};var _0x21dd88=fs[_0xf719('0x6d')](_0x5b43b9);if(_0x21dd88[_0xf719('0x49')]>0x1){removeReferences(_0x1a48a5,_0x5b43b9);logger['error']('Invalid\x20plugin\x20structure');return _0x567fa5(new Error(_0xf719('0x6e')));}var _0xdbdafb=fs[_0xf719('0x6f')](path[_0xf719('0x4d')](_0x5b43b9,_0x21dd88[0x0]));if(_0xdbdafb['isFile']()){removeReferences(_0x1a48a5,_0x5b43b9);logger['error'](_0xf719('0x6e'));return _0x567fa5(new Error('Invalid\x20plugin\x20structure'));}if(_0xdbdafb[_0xf719('0x70')]()){var _0x5ab523=fs['readdirSync'](path['join'](_0x5b43b9,_0x21dd88[0x0]));if(_0x5ab523['length']===0x0){removeReferences(_0x1a48a5,_0x5b43b9);logger[_0xf719('0x2e')](_0xf719('0x6e'));return _0x567fa5(new Error('Invalid\x20plugin\x20structure'));}var _0x2e5f2f=_0x5ab523[_0xf719('0x71')](function(_0x30b95b){return _0x30b95b===_0xf719('0x72');});if(!_0x2e5f2f){return _0x567fa5(new Error(_0xf719('0x73')));}var _0x2a7e32=fs[_0xf719('0x74')](path[_0xf719('0x4d')](_0x5b43b9,_0x21dd88[0x0],_0xf719('0x72')));var _0x345f4d=JSON[_0xf719('0x75')](_0x2a7e32);if(_0xf719('0x76')==typeof _0x345f4d[_0xf719('0x4c')]){return _0x567fa5(new Error(_0xf719('0x77')));}if(_0xf719('0x76')==typeof _0x345f4d['type']){return _0x567fa5(new Error(_0xf719('0x78')));}if(_0xf719('0x76')==typeof _0x345f4d[_0xf719('0x79')]){return _0x567fa5(new Error(_0xf719('0x7a')));}if(_0xf719('0x76')==typeof _0x345f4d[_0xf719('0x7b')]){return _0x567fa5(new Error(_0xf719('0x7c')));}if(_0x345f4d[_0xf719('0x3e')]===_0xf719('0x7d')){if('undefined'==typeof _0x345f4d['parameters'][_0xf719('0x7e')]){return _0x567fa5(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x345f4d[_0xf719('0x7b')][_0xf719('0x7e')][_0xf719('0x7f')]&&_0xf719('0x76')==typeof _0x345f4d['parameters'][_0xf719('0x7e')][_0xf719('0x80')]){return _0x567fa5(new Error(_0xf719('0x81')));}}else if(_0x345f4d['type']===_0xf719('0x82')){if(_0xf719('0x76')==typeof _0x345f4d[_0xf719('0x7b')][_0xf719('0x83')]){return _0x567fa5(new Error(_0xf719('0x84')));}if('undefined'==typeof _0x345f4d['parameters'][_0xf719('0x85')]){return _0x567fa5(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x567fa5(new Error(_0xf719('0x86')));}var _0x39796d=_0x345f4d[_0xf719('0x4c')];var _0x45c467=_0x345f4d[_0xf719('0x87')];var _0x4566d7=_0x345f4d[_0xf719('0x3e')];var _0x1b225f=_0x345f4d['sidebar']?_0x345f4d['sidebar']:_0xf719('0x88');var _0x4c4d3e=_0x345f4d[_0xf719('0x89')]?_0x345f4d[_0xf719('0x89')]:'icon-apps';var _0x3c04d5='';var _0x304fa4='';var _0x3ee81b='';var _0x83635e='';var _0x555d3e=_0x345f4d['version'];if(_0x4566d7==='html'){if(_0xf719('0x76')!=typeof _0x345f4d[_0xf719('0x7b')][_0xf719('0x7e')][_0xf719('0x7f')]){var _0x312302=_0x345f4d[_0xf719('0x7b')][_0xf719('0x7e')][_0xf719('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xf719('0x8a')](_0x312302)){_0x3c04d5=path[_0xf719('0x4d')](_0xf719('0x8b'),_0x3b750f,_0x21dd88[0x0],_0x312302);}else{_0x3c04d5=_0x312302;}}else{logger[_0xf719('0x64')](_0xf719('0x8c'));}if(_0xf719('0x76')!=typeof _0x345f4d[_0xf719('0x7b')]['views']['agent']){var _0x31df9e=_0x345f4d[_0xf719('0x7b')]['views'][_0xf719('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x31df9e)){_0x304fa4=path[_0xf719('0x4d')](_0xf719('0x8b'),_0x3b750f,_0x21dd88[0x0],_0x31df9e);}else{_0x304fa4=_0x31df9e;}}else{logger[_0xf719('0x64')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4566d7===_0xf719('0x82')){_0x3ee81b=_0x345f4d['parameters'][_0xf719('0x83')];_0x83635e=_0x345f4d[_0xf719('0x7b')]['scriptPath'];if(_0xf719('0x76')!=typeof _0x345f4d[_0xf719('0x7b')][_0xf719('0x7e')]){if('undefined'!=typeof _0x345f4d[_0xf719('0x7b')][_0xf719('0x7e')]['admin']){var _0x312302=_0x345f4d[_0xf719('0x7b')][_0xf719('0x7e')][_0xf719('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xf719('0x8a')](_0x312302)){_0x3c04d5=path[_0xf719('0x4d')](_0xf719('0x8b'),_0x3b750f,_0x21dd88[0x0],_0x312302);}else{_0x3c04d5=_0x312302;}}if(_0xf719('0x76')!=typeof _0x345f4d[_0xf719('0x7b')][_0xf719('0x7e')][_0xf719('0x80')]){var _0x31df9e=_0x345f4d[_0xf719('0x7b')][_0xf719('0x7e')][_0xf719('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xf719('0x8a')](_0x31df9e)){_0x304fa4=path[_0xf719('0x4d')]('plugins',_0x3b750f,_0x21dd88[0x0],_0x31df9e);}else{_0x304fa4=_0x31df9e;}}}}var _0x4d5ff0={'name':_0x39796d,'description':_0x45c467,'path':path['join'](_0x3b750f,_0x21dd88[0x0]),'type':_0x4566d7,'sidebar':_0x1b225f,'icon':_0x4c4d3e,'adminUrl':_0x3c04d5,'agentUrl':_0x304fa4,'scriptName':_0x3ee81b,'scriptPath':_0x83635e,'version':_0x555d3e};removeReferences(_0x1a48a5,null);return db['Plugin']['create'](_0x4d5ff0)[_0xf719('0x29')](function(_0xdce73a){var _0x221933={'role':_0x3eb541[_0xf719('0x8d')][_0xf719('0x8e')],'userProfileId':_0x3eb541['body']['userProfileId']};if(!_0x221933)throw new Error(_0xf719('0x8f'));if(_0x221933[_0xf719('0x8e')]===_0xf719('0x90')){var _0xefbed9=_0xdce73a[_0xf719('0x2b')]({'plain':!![]});return db[_0xf719('0x91')]['find']({'where':{'name':'Plugins','userProfileId':_0x221933[_0xf719('0x92')]},'raw':!![]})[_0xf719('0x29')](function(_0x2c6eef){if(_0x2c6eef&&_0x2c6eef[_0xf719('0x93')]===0x0){return db[_0xf719('0x94')][_0xf719('0x95')]({'name':_0xefbed9[_0xf719('0x4c')],'resourceId':_0xefbed9['id'],'type':_0x2c6eef['name'],'sectionId':_0x2c6eef['id']},{})[_0xf719('0x29')](function(){return _0xdce73a;});}else{return _0xdce73a;}})[_0xf719('0x47')](function(_0x133290){logger[_0xf719('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x133290);throw _0x133290;});}return _0xdce73a;})['then'](respondWithResult(_0x5915e2,null))[_0xf719('0x47')](handleError(_0x5915e2,null));}});}catch(_0x26e89d){_0x5915e2[_0xf719('0x20')](0x1f4)[_0xf719('0x2f')](_0x26e89d);}};function removeReferences(_0x286fc1,_0x5ddf4c){try{if(_0x286fc1){fs['unlinkSync'](_0x286fc1);logger[_0xf719('0x64')](_0xf719('0x96'));}if(_0x5ddf4c){rimraf(_0x5ddf4c,function(){});logger[_0xf719('0x64')](_0xf719('0x97'));}}catch(_0x5d9b27){logger[_0xf719('0x2e')](_0x5d9b27);}}exports[_0xf719('0x28')]=function(_0x5cd6a0,_0x11a2af,_0xc9ee88){return db['Plugin'][_0xf719('0x4a')]({'where':{'id':_0x5cd6a0[_0xf719('0x48')]['id']}})[_0xf719('0x29')](handleEntityNotFound(_0x11a2af,null))[_0xf719('0x29')](saveUpdates(_0x5cd6a0[_0xf719('0x8d')],null))[_0xf719('0x29')](respondWithResult(_0x11a2af,null))['catch'](handleError(_0x11a2af,null));};exports[_0xf719('0x98')]=function(_0x4edb00,_0x28ad29,_0x5df39b){return db['Plugin']['find']({'where':{'id':_0x4edb00[_0xf719('0x48')]['id']}})[_0xf719('0x29')](function(_0x1efacc){if(_0x1efacc){return _0x1efacc[_0xf719('0x2a')]();}})['then'](function(_0x43453e){rimraf(path['join'](config[_0xf719('0x4e')],_0xf719('0x4f'),path[_0xf719('0x5c')](_0x43453e['path'])),function(){});return _0x43453e;})[_0xf719('0x29')](handleEntityNotFound(_0x28ad29,null))[_0xf719('0x29')](respondWithStatusCode(_0x28ad29,null))[_0xf719('0x47')](handleError(_0x28ad29,null));};exports[_0xf719('0x99')]=function(_0x2dc497,_0x47a749,_0x35466b){return BPromise[_0xf719('0x9a')]()[_0xf719('0x29')](function(){if(!_0x2dc497['query'][_0xf719('0x8')]){throw new Error(_0xf719('0x9b'));}if(!_0x2dc497[_0xf719('0x33')][_0xf719('0x9c')]){throw new Error(_0xf719('0x9d'));}var _0x4d877a=_0x2dc497[_0xf719('0x33')]['hostname']?_0x2dc497[_0xf719('0x33')][_0xf719('0x9e')]+':'+_0x2dc497[_0xf719('0x33')][_0xf719('0x9c')]:'http://localhost:'+_0x2dc497['query'][_0xf719('0x9c')];var _0x8ac248=_0x2dc497[_0xf719('0x33')][_0xf719('0x21')]?_0x2dc497[_0xf719('0x33')][_0xf719('0x21')]:!![];var _0x36d4d1=_0x2dc497[_0xf719('0x33')][_0xf719('0x9f')]?_0x2dc497[_0xf719('0x33')][_0xf719('0x9f')]:null;var _0x1b5e39={'method':_0x2dc497[_0xf719('0xa0')],'uri':util[_0xf719('0x50')]('%s%s',_0x4d877a,_0x2dc497[_0xf719('0x33')][_0xf719('0x8')]),'json':_0x8ac248,'resolveWithFullResponse':!![],'encoding':_0x36d4d1,'qs':_0x2dc497[_0xf719('0x33')]};if(_0x2dc497[_0xf719('0xa1')]){_0x1b5e39[_0xf719('0xa1')]=_0x2dc497[_0xf719('0xa1')];if(_0x1b5e39[_0xf719('0xa1')][_0xf719('0xa2')]){delete _0x1b5e39[_0xf719('0xa1')][_0xf719('0xa2')];}}if(_0x1b5e39['headers']['content-type']){delete _0x1b5e39[_0xf719('0xa1')][_0xf719('0xa3')];}return rp(_0x1b5e39);})[_0xf719('0x29')](function(_0x469dd2){if(_0x469dd2){_0x47a749[_0xf719('0xa4')](_0x469dd2[_0xf719('0xa1')]);logger[_0xf719('0x64')](_0x469dd2[_0xf719('0x8d')]);if(_[_0xf719('0xa5')](_0x2dc497['query'][_0xf719('0x8')],'download')&&_0x469dd2[_0xf719('0xa6')]==0x1f4){return _0x47a749[_0xf719('0x2d')](_0x469dd2[_0xf719('0xa6')]);}else{return _0x47a749[_0xf719('0x20')](_0x469dd2['statusCode'])[_0xf719('0x2f')](_0x469dd2[_0xf719('0x8d')]);}}else{return _0x47a749[_0xf719('0x2d')](0xc8);}})['catch'](handleError(_0x47a749,null));};exports['webhookPost']=function(_0x436cf2,_0x582d65,_0x125634){return BPromise[_0xf719('0x9a')]()[_0xf719('0x29')](function(){if(!_0x436cf2[_0xf719('0x33')][_0xf719('0x8')]){throw new Error(_0xf719('0x9b'));}if(!_0x436cf2[_0xf719('0x33')][_0xf719('0x9c')]){throw new Error(_0xf719('0x9d'));}var _0xa9b64f=_0x436cf2[_0xf719('0x33')][_0xf719('0x9e')]?_0x436cf2[_0xf719('0x33')][_0xf719('0x9e')]+':'+_0x436cf2['query'][_0xf719('0x9c')]:_0xf719('0xa7')+_0x436cf2[_0xf719('0x33')]['port'];var _0x5b82c8=_0x436cf2['query'][_0xf719('0x21')]?_0x436cf2[_0xf719('0x33')][_0xf719('0x21')]:!![];var _0x86b93a=_0x436cf2[_0xf719('0x33')]['encoding']?_0x436cf2[_0xf719('0x33')][_0xf719('0x9f')]:null;var _0x5a4d55={'method':_0x436cf2[_0xf719('0xa0')],'uri':util[_0xf719('0x50')](_0xf719('0xa8'),_0xa9b64f,_0x436cf2[_0xf719('0x33')][_0xf719('0x8')]),'json':_0x5b82c8,'resolveWithFullResponse':!![],'encoding':_0x86b93a,'body':_0x436cf2[_0xf719('0x8d')]};if(_0x436cf2['headers']){_0x5a4d55[_0xf719('0xa1')]=_0x436cf2['headers'];if(_0x5a4d55[_0xf719('0xa1')][_0xf719('0xa2')]){delete _0x5a4d55['headers']['content-length'];}}if(_0x5a4d55[_0xf719('0xa1')][_0xf719('0xa3')]){delete _0x5a4d55['headers']['content-type'];}return rp(_0x5a4d55);})[_0xf719('0x29')](function(_0x3f3399){if(_0x3f3399){_0x582d65[_0xf719('0xa4')](_0x3f3399[_0xf719('0xa1')]);logger[_0xf719('0x64')](_0x3f3399[_0xf719('0x8d')]);return _0x582d65[_0xf719('0x20')](_0x3f3399['statusCode'])[_0xf719('0x2f')](_0x3f3399[_0xf719('0x8d')]);}else{return _0x582d65[_0xf719('0x2d')](0xc8);}})['catch'](handleError(_0x582d65,null));}; \ No newline at end of file +var _0x7b69=['where','pick','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','includeAll','find','download','path','join','root','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','basename','file','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','json','encoding','method','format','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','name','send','index','Plugin','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x587553,_0x1c6084){var _0x1af129=function(_0x124406){while(--_0x124406){_0x587553['push'](_0x587553['shift']());}};_0x1af129(++_0x1c6084);}(_0x7b69,0x121));var _0x97b6=function(_0x59c278,_0x359357){_0x59c278=_0x59c278-0x0;var _0xa60287=_0x7b69[_0x59c278];return _0xa60287;};'use strict';var pdf=require(_0x97b6('0x0'));var emlformat=require(_0x97b6('0x1'));var rimraf=require(_0x97b6('0x2'));var zipdir=require(_0x97b6('0x3'));var jsonpatch=require(_0x97b6('0x4'));var rp=require(_0x97b6('0x5'));var moment=require('moment');var BPromise=require(_0x97b6('0x6'));var Mustache=require(_0x97b6('0x7'));var util=require(_0x97b6('0x8'));var path=require('path');var sox=require(_0x97b6('0x9'));var csv=require(_0x97b6('0xa'));var ejs=require(_0x97b6('0xb'));var fs=require('fs');var _=require(_0x97b6('0xc'));var squel=require(_0x97b6('0xd'));var crypto=require('crypto');var jsforce=require(_0x97b6('0xe'));var deskjs=require(_0x97b6('0xf'));var toCsv=require(_0x97b6('0xa'));var querystring=require(_0x97b6('0x10'));var Papa=require(_0x97b6('0x11'));var extract=require(_0x97b6('0x12'));var rimraf=require(_0x97b6('0x2'));var archiver=require(_0x97b6('0x13'));var Redis=require(_0x97b6('0x14'));var authService=require(_0x97b6('0x15'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x97b6('0x16'));var logger=require(_0x97b6('0x17'))(_0x97b6('0x18'));var utils=require('../../config/utils');var config=require(_0x97b6('0x19'));var db=require(_0x97b6('0x1a'))['db'];config[_0x97b6('0x1b')]=_[_0x97b6('0x1c')](config[_0x97b6('0x1b')],{'host':_0x97b6('0x1d'),'port':0x18eb});var socket=require(_0x97b6('0x1e'))(new Redis(config[_0x97b6('0x1b')]));require(_0x97b6('0x1f'))[_0x97b6('0x20')](socket);function respondWithStatusCode(_0x44a97c,_0x1079ec){_0x1079ec=_0x1079ec||0xcc;return function(_0x3c687d){if(_0x3c687d){return _0x44a97c[_0x97b6('0x21')](_0x1079ec);}return _0x44a97c[_0x97b6('0x22')](_0x1079ec)[_0x97b6('0x23')]();};}function respondWithResult(_0x4c144b,_0x3d7346){_0x3d7346=_0x3d7346||0xc8;return function(_0x18db1b){if(_0x18db1b){return _0x4c144b['status'](_0x3d7346)['json'](_0x18db1b);}};}function respondWithFilteredResult(_0x147aab,_0x1a25a8){return function(_0xe7a10){if(_0xe7a10){var _0x138e8d=_0xe7a10[_0x97b6('0x24')],_0x3fdfff=_0x1a25a8[_0x97b6('0x25')],_0x5342d6=_0x1a25a8['offset']+_0x1a25a8[_0x97b6('0x26')],_0x393ca5;if(_0x5342d6>=_0x138e8d){_0x5342d6=_0x138e8d;_0x393ca5=0xc8;}else{_0x393ca5=0xce;}_0x147aab[_0x97b6('0x22')](_0x393ca5);return _0x147aab[_0x97b6('0x27')](_0x97b6('0x28'),_0x3fdfff+'-'+_0x5342d6+'/'+_0x138e8d)['json'](_0xe7a10);}return null;};}function patchUpdates(_0x50e054){return function(_0x21c134){try{jsonpatch['apply'](_0x21c134,_0x50e054,!![]);}catch(_0x218b2f){return BPromise[_0x97b6('0x29')](_0x218b2f);}return _0x21c134[_0x97b6('0x2a')]();};}function saveUpdates(_0x86a453,_0x448b1e){return function(_0x41bbb0){if(_0x41bbb0){return _0x41bbb0[_0x97b6('0x2b')](_0x86a453)[_0x97b6('0x2c')](function(_0x1ae937){return _0x1ae937;});}return null;};}function removeEntity(_0xab0473,_0x5898d3){return function(_0x54ba79){if(_0x54ba79){return _0x54ba79[_0x97b6('0x2d')]()[_0x97b6('0x2c')](function(){var _0x2e9596=_0x54ba79[_0x97b6('0x2e')]({'plain':!![]});var _0x1c6b6d=_0x97b6('0x2f');return db[_0x97b6('0x30')][_0x97b6('0x2d')]({'where':{'type':_0x1c6b6d,'resourceId':_0x2e9596['id']}})[_0x97b6('0x2c')](function(){return _0x54ba79;});})[_0x97b6('0x2c')](function(){_0xab0473[_0x97b6('0x22')](0xcc)[_0x97b6('0x23')]();});}};}function handleEntityNotFound(_0x22ab38,_0x5f290d){return function(_0xe78250){if(!_0xe78250){_0x22ab38[_0x97b6('0x21')](0x194);}return _0xe78250;};}function handleError(_0x21ee6b,_0x3a1a4){_0x3a1a4=_0x3a1a4||0x1f4;return function(_0x73cb95){logger[_0x97b6('0x31')](_0x73cb95['stack']);if(_0x73cb95[_0x97b6('0x32')]){delete _0x73cb95[_0x97b6('0x32')];}_0x21ee6b['status'](_0x3a1a4)[_0x97b6('0x33')](_0x73cb95);};}exports[_0x97b6('0x34')]=function(_0x5ed86e,_0x529b3b){var _0x4c60ce={},_0x5a129b={},_0x368fbe={'count':0x0,'rows':[]};var _0x400988=db[_0x97b6('0x35')][_0x97b6('0x36')];_0x5a129b['model']=_[_0x97b6('0x37')](_0x400988);_0x5a129b['query']=_[_0x97b6('0x37')](_0x5ed86e[_0x97b6('0x38')]);_0x5a129b[_0x97b6('0x39')]=_[_0x97b6('0x3a')](_0x5a129b[_0x97b6('0x3b')],_0x5a129b[_0x97b6('0x38')]);_0x4c60ce[_0x97b6('0x3c')]=_['intersection'](_0x5a129b[_0x97b6('0x3b')],qs[_0x97b6('0x3d')](_0x5ed86e['query']['fields']));_0x4c60ce[_0x97b6('0x3c')]=_0x4c60ce[_0x97b6('0x3c')][_0x97b6('0x3e')]?_0x4c60ce[_0x97b6('0x3c')]:_0x5a129b[_0x97b6('0x3b')];if(!_0x5ed86e[_0x97b6('0x38')][_0x97b6('0x3f')](_0x97b6('0x40'))){_0x4c60ce['limit']=qs[_0x97b6('0x26')](_0x5ed86e[_0x97b6('0x38')][_0x97b6('0x26')]);_0x4c60ce[_0x97b6('0x25')]=qs[_0x97b6('0x25')](_0x5ed86e[_0x97b6('0x38')][_0x97b6('0x25')]);}_0x4c60ce[_0x97b6('0x41')]=qs[_0x97b6('0x42')](_0x5ed86e[_0x97b6('0x38')][_0x97b6('0x42')]);_0x4c60ce[_0x97b6('0x43')]=qs[_0x97b6('0x39')](_[_0x97b6('0x44')](_0x5ed86e['query'],_0x5a129b[_0x97b6('0x39')]));if(_0x5ed86e[_0x97b6('0x38')][_0x97b6('0x45')]){_0x4c60ce[_0x97b6('0x43')]=_[_0x97b6('0x46')](_0x4c60ce['where'],{'$or':_[_0x97b6('0x47')](_0x400988,function(_0x8d8126){if(_0x8d8126[_0x97b6('0x48')][_0x97b6('0x49')]!==_0x97b6('0x4a')){var _0x9fb1c3={};_0x9fb1c3[_0x8d8126[_0x97b6('0x4b')]]={'$like':'%'+_0x5ed86e[_0x97b6('0x38')][_0x97b6('0x45')]+'%'};return _0x9fb1c3;}})});}_0x4c60ce=_['merge']({},_0x4c60ce,_0x5ed86e[_0x97b6('0x4c')]);var _0x39593f={'where':_0x4c60ce[_0x97b6('0x43')]};return db[_0x97b6('0x35')][_0x97b6('0x24')](_0x39593f)[_0x97b6('0x2c')](function(_0x5b236f){_0x368fbe[_0x97b6('0x24')]=_0x5b236f;if(_0x5ed86e[_0x97b6('0x38')]['includeAll']){_0x4c60ce[_0x97b6('0x4d')]=[{'all':!![]}];}return db[_0x97b6('0x35')]['findAll'](_0x4c60ce);})[_0x97b6('0x2c')](function(_0x49cd27){_0x368fbe[_0x97b6('0x4e')]=_0x49cd27;return _0x368fbe;})['then'](respondWithFilteredResult(_0x529b3b,_0x4c60ce))[_0x97b6('0x4f')](handleError(_0x529b3b,null));};exports[_0x97b6('0x50')]=function(_0x2e1e9e,_0x3a166f){var _0x496d50={'raw':!![],'where':{'id':_0x2e1e9e[_0x97b6('0x51')]['id']}},_0x3271e8={};_0x3271e8[_0x97b6('0x3b')]=_['keys'](db[_0x97b6('0x35')][_0x97b6('0x36')]);_0x3271e8[_0x97b6('0x38')]=_[_0x97b6('0x37')](_0x2e1e9e[_0x97b6('0x38')]);_0x3271e8[_0x97b6('0x39')]=_[_0x97b6('0x3a')](_0x3271e8['model'],_0x3271e8[_0x97b6('0x38')]);_0x496d50[_0x97b6('0x3c')]=_[_0x97b6('0x3a')](_0x3271e8[_0x97b6('0x3b')],qs[_0x97b6('0x3d')](_0x2e1e9e[_0x97b6('0x38')]['fields']));_0x496d50[_0x97b6('0x3c')]=_0x496d50['attributes'][_0x97b6('0x3e')]?_0x496d50[_0x97b6('0x3c')]:_0x3271e8[_0x97b6('0x3b')];if(_0x2e1e9e[_0x97b6('0x38')][_0x97b6('0x52')]){_0x496d50['include']=[{'all':!![]}];}_0x496d50=_['merge']({},_0x496d50,_0x2e1e9e[_0x97b6('0x4c')]);return db[_0x97b6('0x35')][_0x97b6('0x53')](_0x496d50)[_0x97b6('0x2c')](handleEntityNotFound(_0x3a166f,null))[_0x97b6('0x2c')](respondWithResult(_0x3a166f,null))[_0x97b6('0x4f')](handleError(_0x3a166f,null));};exports[_0x97b6('0x54')]=function(_0x4fd57b,_0x5d5b1f,_0x3819b1){return db['Plugin'][_0x97b6('0x53')]({'where':{'id':_0x4fd57b[_0x97b6('0x51')]['id']},'attributes':[_0x97b6('0x32'),_0x97b6('0x55')],'raw':!![]})[_0x97b6('0x2c')](handleEntityNotFound(_0x5d5b1f,null))[_0x97b6('0x2c')](function(_0x729e5b){if(_0x729e5b){var _0xdddb26=path[_0x97b6('0x56')](config[_0x97b6('0x57')],'server/files/plugins',util['format']('%s.zip',path['basename'](_0x729e5b[_0x97b6('0x55')])));var _0x4e749e=fs['createWriteStream'](_0xdddb26);var _0x103c79=archiver(_0x97b6('0x58'),{'zlib':{'level':0x9}});_0x103c79['on']('warning',function(_0x2fa84e){if(_0x2fa84e[_0x97b6('0x59')]===_0x97b6('0x5a')){logger['error'](_0x2fa84e);}else{throw new db[(_0x97b6('0x5b'))]['Error'](_0x97b6('0x5c'));}});_0x103c79['on']('error',function(_0x3dad6f){throw new db[(_0x97b6('0x5b'))][(_0x97b6('0x5d'))](_0x97b6('0x5c'));});_0x103c79[_0x97b6('0x5e')](_0x4e749e);_0x103c79['glob'](_0x97b6('0x5f'),{'cwd':path[_0x97b6('0x56')](config['root'],_0x97b6('0x60'),path[_0x97b6('0x61')](_0x729e5b[_0x97b6('0x55')])),'ignore':[path[_0x97b6('0x56')](path['basename'](_0x729e5b[_0x97b6('0x55')]),_0x97b6('0x62')),path[_0x97b6('0x56')](path['basename'](_0x729e5b[_0x97b6('0x55')]),_0x97b6('0x63'))],'nodir':!![]})[_0x97b6('0x64')]();_0x4e749e['on'](_0x97b6('0x65'),function(){if(!fs['existsSync'](_0xdddb26)){throw new db[(_0x97b6('0x5b'))][(_0x97b6('0x5d'))](_0x97b6('0x66'));}return _0x5d5b1f[_0x97b6('0x54')](_0xdddb26,util['format'](_0x97b6('0x67'),path['basename'](_0x729e5b[_0x97b6('0x55')])),function(_0x1f8282){if(_0x1f8282){throw new db[(_0x97b6('0x5b'))][(_0x97b6('0x5d'))](_0x97b6('0x68'));}fs[_0x97b6('0x69')](_0xdddb26);logger[_0x97b6('0x6a')](_0x97b6('0x6b'));logger[_0x97b6('0x6a')](_0x97b6('0x6c'));});});}return null;})[_0x97b6('0x4f')](handleError(_0x5d5b1f,null));};exports['upload']=function(_0x4d6bfa,_0xea2c89,_0xf2271a){var _0x5a2c96=path[_0x97b6('0x6d')](_0x4d6bfa[_0x97b6('0x6e')]['filename'],path[_0x97b6('0x6f')](_0x4d6bfa[_0x97b6('0x6e')]['filename']));var _0x4da86b=path[_0x97b6('0x56')](config[_0x97b6('0x57')],_0x97b6('0x60'),_0x4d6bfa[_0x97b6('0x6e')]['filename']);var _0x912fb3=path[_0x97b6('0x56')](config[_0x97b6('0x57')],_0x97b6('0x60'),_0x5a2c96);logger[_0x97b6('0x6a')](_0x97b6('0x70'),_0x4da86b);logger[_0x97b6('0x6a')](_0x97b6('0x71'),_0x912fb3);try{fs['chmodSync'](_0x4da86b,parseInt(_0x97b6('0x72'),0x8));extract(_0x4da86b,{'dir':_0x912fb3},function(_0x446496){if(_0x446496){logger['error'](_0x446496);handleError(_0x446496,!![]);};var _0x5dcbe7=fs[_0x97b6('0x73')](_0x912fb3);if(_0x5dcbe7['length']>0x1){removeReferences(_0x4da86b,_0x912fb3);logger['error'](_0x97b6('0x74'));return _0xf2271a(new Error(_0x97b6('0x74')));}var _0x2c5cac=fs[_0x97b6('0x75')](path[_0x97b6('0x56')](_0x912fb3,_0x5dcbe7[0x0]));if(_0x2c5cac[_0x97b6('0x76')]()){removeReferences(_0x4da86b,_0x912fb3);logger[_0x97b6('0x31')](_0x97b6('0x74'));return _0xf2271a(new Error('Invalid\x20plugin\x20structure'));}if(_0x2c5cac[_0x97b6('0x77')]()){var _0xc55710=fs[_0x97b6('0x73')](path['join'](_0x912fb3,_0x5dcbe7[0x0]));if(_0xc55710['length']===0x0){removeReferences(_0x4da86b,_0x912fb3);logger[_0x97b6('0x31')](_0x97b6('0x74'));return _0xf2271a(new Error('Invalid\x20plugin\x20structure'));}var _0x51778d=_0xc55710[_0x97b6('0x78')](function(_0x275e52){return _0x275e52===_0x97b6('0x79');});if(!_0x51778d){return _0xf2271a(new Error(_0x97b6('0x7a')));}var _0x1a8196=fs[_0x97b6('0x7b')](path[_0x97b6('0x56')](_0x912fb3,_0x5dcbe7[0x0],_0x97b6('0x79')));var _0x4fbf2d=JSON['parse'](_0x1a8196);if('undefined'==typeof _0x4fbf2d['name']){return _0xf2271a(new Error(_0x97b6('0x7c')));}if(_0x97b6('0x7d')==typeof _0x4fbf2d[_0x97b6('0x48')]){return _0xf2271a(new Error(_0x97b6('0x7e')));}if(_0x97b6('0x7d')==typeof _0x4fbf2d['version']){return _0xf2271a(new Error(_0x97b6('0x7f')));}if(_0x97b6('0x7d')==typeof _0x4fbf2d[_0x97b6('0x80')]){return _0xf2271a(new Error(_0x97b6('0x81')));}if(_0x4fbf2d[_0x97b6('0x48')]==='html'){if('undefined'==typeof _0x4fbf2d[_0x97b6('0x80')][_0x97b6('0x82')]){return _0xf2271a(new Error(_0x97b6('0x83')));}if(_0x97b6('0x7d')==typeof _0x4fbf2d[_0x97b6('0x80')][_0x97b6('0x82')][_0x97b6('0x84')]&&_0x97b6('0x7d')==typeof _0x4fbf2d['parameters'][_0x97b6('0x82')][_0x97b6('0x85')]){return _0xf2271a(new Error(_0x97b6('0x86')));}}else if(_0x4fbf2d[_0x97b6('0x48')]===_0x97b6('0x87')){if('undefined'==typeof _0x4fbf2d[_0x97b6('0x80')][_0x97b6('0x88')]){return _0xf2271a(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x97b6('0x7d')==typeof _0x4fbf2d[_0x97b6('0x80')][_0x97b6('0x89')]){return _0xf2271a(new Error(_0x97b6('0x8a')));}}else{return _0xf2271a(new Error(_0x97b6('0x8b')));}var _0x1f7abd=_0x4fbf2d[_0x97b6('0x32')];var _0x1b25fa=_0x4fbf2d[_0x97b6('0x8c')];var _0x392b68=_0x4fbf2d[_0x97b6('0x48')];var _0x1977ed=_0x4fbf2d['sidebar']?_0x4fbf2d[_0x97b6('0x8d')]:_0x97b6('0x8e');var _0x5d0506=_0x4fbf2d[_0x97b6('0x8f')]?_0x4fbf2d[_0x97b6('0x8f')]:_0x97b6('0x90');var _0x166299='';var _0x21cc0c='';var _0x549eaa='';var _0xc39a28='';var _0x15293d=_0x4fbf2d[_0x97b6('0x91')];if(_0x392b68===_0x97b6('0x92')){if(_0x97b6('0x7d')!=typeof _0x4fbf2d[_0x97b6('0x80')]['views'][_0x97b6('0x84')]){var _0x1e33dc=_0x4fbf2d[_0x97b6('0x80')]['views'][_0x97b6('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x97b6('0x93')](_0x1e33dc)){_0x166299=path[_0x97b6('0x56')](_0x97b6('0x94'),_0x5a2c96,_0x5dcbe7[0x0],_0x1e33dc);}else{_0x166299=_0x1e33dc;}}else{logger[_0x97b6('0x6a')](_0x97b6('0x95'));}if(_0x97b6('0x7d')!=typeof _0x4fbf2d[_0x97b6('0x80')][_0x97b6('0x82')][_0x97b6('0x85')]){var _0x274dcf=_0x4fbf2d['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x97b6('0x93')](_0x274dcf)){_0x21cc0c=path[_0x97b6('0x56')](_0x97b6('0x94'),_0x5a2c96,_0x5dcbe7[0x0],_0x274dcf);}else{_0x21cc0c=_0x274dcf;}}else{logger[_0x97b6('0x6a')](_0x97b6('0x96'));}}else if(_0x392b68==='script'){_0x549eaa=_0x4fbf2d['parameters'][_0x97b6('0x88')];_0xc39a28=_0x4fbf2d[_0x97b6('0x80')][_0x97b6('0x89')];if(_0x97b6('0x7d')!=typeof _0x4fbf2d['parameters'][_0x97b6('0x82')]){if('undefined'!=typeof _0x4fbf2d[_0x97b6('0x80')][_0x97b6('0x82')][_0x97b6('0x84')]){var _0x1e33dc=_0x4fbf2d[_0x97b6('0x80')][_0x97b6('0x82')][_0x97b6('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x97b6('0x93')](_0x1e33dc)){_0x166299=path[_0x97b6('0x56')](_0x97b6('0x94'),_0x5a2c96,_0x5dcbe7[0x0],_0x1e33dc);}else{_0x166299=_0x1e33dc;}}if('undefined'!=typeof _0x4fbf2d[_0x97b6('0x80')]['views']['agent']){var _0x274dcf=_0x4fbf2d['parameters'][_0x97b6('0x82')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x274dcf)){_0x21cc0c=path[_0x97b6('0x56')](_0x97b6('0x94'),_0x5a2c96,_0x5dcbe7[0x0],_0x274dcf);}else{_0x21cc0c=_0x274dcf;}}}}var _0x335e37={'name':_0x1f7abd,'description':_0x1b25fa,'path':path[_0x97b6('0x56')](_0x5a2c96,_0x5dcbe7[0x0]),'type':_0x392b68,'sidebar':_0x1977ed,'icon':_0x5d0506,'adminUrl':_0x166299,'agentUrl':_0x21cc0c,'scriptName':_0x549eaa,'scriptPath':_0xc39a28,'version':_0x15293d};removeReferences(_0x4da86b,null);return db['Plugin']['create'](_0x335e37)[_0x97b6('0x2c')](function(_0x4108bf){var _0x3501b1={'role':_0x4d6bfa[_0x97b6('0x97')][_0x97b6('0x98')],'userProfileId':_0x4d6bfa[_0x97b6('0x97')]['userProfileId']};if(!_0x3501b1)throw new Error(_0x97b6('0x99'));if(_0x3501b1[_0x97b6('0x98')]===_0x97b6('0x9a')){var _0x3caebd=_0x4108bf[_0x97b6('0x2e')]({'plain':!![]});return db[_0x97b6('0x9b')]['find']({'where':{'name':_0x97b6('0x2f'),'userProfileId':_0x3501b1[_0x97b6('0x9c')]},'raw':!![]})[_0x97b6('0x2c')](function(_0x39fce8){if(_0x39fce8&&_0x39fce8[_0x97b6('0x9d')]===0x0){return db[_0x97b6('0x30')][_0x97b6('0x9e')]({'name':_0x3caebd[_0x97b6('0x32')],'resourceId':_0x3caebd['id'],'type':_0x39fce8[_0x97b6('0x32')],'sectionId':_0x39fce8['id']},{})[_0x97b6('0x2c')](function(){return _0x4108bf;});}else{return _0x4108bf;}})['catch'](function(_0x595d66){logger[_0x97b6('0x31')](_0x97b6('0x9f'),_0x595d66);throw _0x595d66;});}return _0x4108bf;})[_0x97b6('0x2c')](respondWithResult(_0xea2c89,null))['catch'](handleError(_0xea2c89,null));}});}catch(_0x26838c){_0xea2c89[_0x97b6('0x22')](0x1f4)[_0x97b6('0x33')](_0x26838c);}};function removeReferences(_0xba7bd2,_0x3aba27){try{if(_0xba7bd2){fs[_0x97b6('0x69')](_0xba7bd2);logger['info'](_0x97b6('0xa0'));}if(_0x3aba27){rimraf(_0x3aba27,function(){});logger[_0x97b6('0x6a')](_0x97b6('0xa1'));}}catch(_0x3a46ca){logger[_0x97b6('0x31')](_0x3a46ca);}}exports[_0x97b6('0x2b')]=function(_0x34bc79,_0x13114d,_0x1d215e){return db[_0x97b6('0x35')]['find']({'where':{'id':_0x34bc79[_0x97b6('0x51')]['id']}})[_0x97b6('0x2c')](handleEntityNotFound(_0x13114d,null))[_0x97b6('0x2c')](saveUpdates(_0x34bc79[_0x97b6('0x97')],null))['then'](respondWithResult(_0x13114d,null))[_0x97b6('0x4f')](handleError(_0x13114d,null));};exports[_0x97b6('0xa2')]=function(_0x21837d,_0x19c94e,_0x576bf4){return db['Plugin'][_0x97b6('0x53')]({'where':{'id':_0x21837d[_0x97b6('0x51')]['id']}})[_0x97b6('0x2c')](function(_0x14f288){if(_0x14f288){return _0x14f288[_0x97b6('0x2d')]();}})[_0x97b6('0x2c')](function(_0x25508d){rimraf(path['join'](config[_0x97b6('0x57')],_0x97b6('0x60'),path['dirname'](_0x25508d[_0x97b6('0x55')])),function(){});return _0x25508d;})[_0x97b6('0x2c')](handleEntityNotFound(_0x19c94e,null))[_0x97b6('0x2c')](respondWithStatusCode(_0x19c94e,null))[_0x97b6('0x4f')](handleError(_0x19c94e,null));};exports['webhookGet']=function(_0x10f1dd,_0x1b61f3,_0x5dcd54){return BPromise[_0x97b6('0xa3')]()['then'](function(){if(!_0x10f1dd[_0x97b6('0x38')][_0x97b6('0x55')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x10f1dd[_0x97b6('0x38')][_0x97b6('0xa4')]){throw new Error(_0x97b6('0xa5'));}var _0xeb189b=_0x10f1dd['query'][_0x97b6('0xa6')]?_0x10f1dd[_0x97b6('0x38')][_0x97b6('0xa6')]+':'+_0x10f1dd[_0x97b6('0x38')][_0x97b6('0xa4')]:'http://localhost:'+_0x10f1dd[_0x97b6('0x38')]['port'];var _0xbe0d13=_0x10f1dd[_0x97b6('0x38')][_0x97b6('0xa7')]?_0x10f1dd['query'][_0x97b6('0xa7')]:!![];var _0x20eb3b=_0x10f1dd[_0x97b6('0x38')][_0x97b6('0xa8')]?_0x10f1dd['query']['encoding']:null;var _0x591d99={'method':_0x10f1dd[_0x97b6('0xa9')],'uri':util[_0x97b6('0xaa')]('%s%s',_0xeb189b,_0x10f1dd[_0x97b6('0x38')]['path']),'json':_0xbe0d13,'resolveWithFullResponse':!![],'encoding':_0x20eb3b,'qs':_0x10f1dd[_0x97b6('0x38')]};if(_0x10f1dd['headers']){_0x591d99[_0x97b6('0xab')]=_0x10f1dd[_0x97b6('0xab')];if(_0x591d99[_0x97b6('0xab')][_0x97b6('0xac')]){delete _0x591d99[_0x97b6('0xab')]['content-length'];}}if(_0x591d99['headers'][_0x97b6('0xad')]){delete _0x591d99[_0x97b6('0xab')][_0x97b6('0xad')];}return rp(_0x591d99);})[_0x97b6('0x2c')](function(_0x3408af){if(_0x3408af){_0x1b61f3[_0x97b6('0x27')](_0x3408af['headers']);logger[_0x97b6('0x6a')](_0x3408af[_0x97b6('0x97')]);if(_[_0x97b6('0xae')](_0x10f1dd[_0x97b6('0x38')][_0x97b6('0x55')],_0x97b6('0x54'))&&_0x3408af[_0x97b6('0xaf')]==0x1f4){return _0x1b61f3[_0x97b6('0x21')](_0x3408af[_0x97b6('0xaf')]);}else{return _0x1b61f3['status'](_0x3408af['statusCode'])[_0x97b6('0x33')](_0x3408af[_0x97b6('0x97')]);}}else{return _0x1b61f3['sendStatus'](0xc8);}})[_0x97b6('0x4f')](handleError(_0x1b61f3,null));};exports[_0x97b6('0xb0')]=function(_0x34ee98,_0x42c7df,_0x2a600a){return BPromise['resolve']()[_0x97b6('0x2c')](function(){if(!_0x34ee98['query']['path']){throw new Error(_0x97b6('0xb1'));}if(!_0x34ee98[_0x97b6('0x38')][_0x97b6('0xa4')]){throw new Error(_0x97b6('0xa5'));}var _0x409f89=_0x34ee98[_0x97b6('0x38')][_0x97b6('0xa6')]?_0x34ee98[_0x97b6('0x38')]['hostname']+':'+_0x34ee98[_0x97b6('0x38')][_0x97b6('0xa4')]:'http://localhost:'+_0x34ee98[_0x97b6('0x38')][_0x97b6('0xa4')];var _0x216f09=_0x34ee98[_0x97b6('0x38')][_0x97b6('0xa7')]?_0x34ee98[_0x97b6('0x38')][_0x97b6('0xa7')]:!![];var _0x24d93a=_0x34ee98[_0x97b6('0x38')][_0x97b6('0xa8')]?_0x34ee98[_0x97b6('0x38')]['encoding']:null;var _0x286a40={'method':_0x34ee98[_0x97b6('0xa9')],'uri':util['format']('%s%s',_0x409f89,_0x34ee98[_0x97b6('0x38')][_0x97b6('0x55')]),'json':_0x216f09,'resolveWithFullResponse':!![],'encoding':_0x24d93a,'body':_0x34ee98[_0x97b6('0x97')]};if(_0x34ee98[_0x97b6('0xab')]){_0x286a40[_0x97b6('0xab')]=_0x34ee98[_0x97b6('0xab')];if(_0x286a40[_0x97b6('0xab')]['content-length']){delete _0x286a40['headers']['content-length'];}}if(_0x286a40['headers'][_0x97b6('0xad')]){delete _0x286a40[_0x97b6('0xab')][_0x97b6('0xad')];}return rp(_0x286a40);})[_0x97b6('0x2c')](function(_0x427464){if(_0x427464){_0x42c7df[_0x97b6('0x27')](_0x427464[_0x97b6('0xab')]);logger[_0x97b6('0x6a')](_0x427464[_0x97b6('0x97')]);return _0x42c7df[_0x97b6('0x22')](_0x427464['statusCode'])['send'](_0x427464['body']);}else{return _0x42c7df[_0x97b6('0x21')](0xc8);}})[_0x97b6('0x4f')](handleError(_0x42c7df,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index aee8be2..229d598 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 _0x8952=['save','update','emit','hasOwnProperty','../../mysqldb','Plugin','setMaxListeners'];(function(_0x187684,_0x131dd4){var _0x393c49=function(_0x5e21c7){while(--_0x5e21c7){_0x187684['push'](_0x187684['shift']());}};_0x393c49(++_0x131dd4);}(_0x8952,0x17e));var _0x2895=function(_0x4ecb7f,_0x56a574){_0x4ecb7f=_0x4ecb7f-0x0;var _0x413749=_0x8952[_0x4ecb7f];return _0x413749;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x2895('0x0'))['db'][_0x2895('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x2895('0x2')](0x0);var events={'afterCreate':_0x2895('0x3'),'afterUpdate':_0x2895('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15beea){return function(_0xb5afd9,_0x1f69f6,_0x5b28c6){PluginEvents[_0x2895('0x5')](_0x15beea+':'+_0xb5afd9['id'],_0xb5afd9);PluginEvents[_0x2895('0x5')](_0x15beea,_0xb5afd9);_0x5b28c6(null);};}for(var e in events){if(events[_0x2895('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xa456=['Plugin','setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0xfa8570,_0x446de9){var _0x12e9a0=function(_0x75b70a){while(--_0x75b70a){_0xfa8570['push'](_0xfa8570['shift']());}};_0x12e9a0(++_0x446de9);}(_0xa456,0x142));var _0x6a45=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xa456[_0x45b034];return _0x509cb0;};'use strict';var EventEmitter=require(_0x6a45('0x0'));var Plugin=require(_0x6a45('0x1'))['db'][_0x6a45('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6a45('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6a45('0x4'),'afterDestroy':_0x6a45('0x5')};function emitEvent(_0x3f7448){return function(_0x500c72,_0x1f0701,_0x40acad){PluginEvents[_0x6a45('0x6')](_0x3f7448+':'+_0x500c72['id'],_0x500c72);PluginEvents[_0x6a45('0x6')](_0x3f7448,_0x500c72);_0x40acad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x6a45('0x7')](e,emitEvent(event));}}module[_0x6a45('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 41e37ab..e12d14f 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 _0x3e74=['exports','Plugin','plugins','lodash','../../config/logger','api','moment','path','../../config/environment','./plugin.attributes'];(function(_0x5e75ef,_0x4ce765){var _0x3c28b2=function(_0x29a66c){while(--_0x29a66c){_0x5e75ef['push'](_0x5e75ef['shift']());}};_0x3c28b2(++_0x4ce765);}(_0x3e74,0x175));var _0x43e7=function(_0x457d2c,_0x40b31f){_0x457d2c=_0x457d2c-0x0;var _0x553aea=_0x3e74[_0x457d2c];return _0x553aea;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','util'];(function(_0x221402,_0x3b1c1a){var _0x488e6d=function(_0x15aafc){while(--_0x15aafc){_0x221402['push'](_0x221402['shift']());}};_0x488e6d(++_0x3b1c1a);}(_0x9f62,0x154));var _0x29f6=function(_0x53a66c,_0x46a5dd){_0x53a66c=_0x53a66c-0x0;var _0x599691=_0x9f62[_0x53a66c];return _0x599691;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'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 0d511f9..6d37989 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 _0x9e02=['raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','localhost','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreatePlugin','Plugin','create','options'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x9e02,0xb7));var _0x29e0=function(_0x35ab80,_0x4b0c88){_0x35ab80=_0x35ab80-0x0;var _0x2e02f1=_0x9e02[_0x35ab80];return _0x2e02f1;};'use strict';var _=require(_0x29e0('0x0'));var util=require(_0x29e0('0x1'));var moment=require(_0x29e0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29e0('0x3'));var db=require(_0x29e0('0x4'))['db'];var utils=require(_0x29e0('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x29e0('0x6'));var client=jayson[_0x29e0('0x7')][_0x29e0('0x8')]({'port':0x232a});config[_0x29e0('0x9')]=_['defaults'](config[_0x29e0('0x9')],{'host':_0x29e0('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0xdc855d,_0x34dbbf,_0x3bdcdf){return new BPromise(function(_0x1be9c8,_0x1257df){return client['request'](_0xdc855d,_0x3bdcdf)[_0x29e0('0xb')](function(_0x406894){logger['info'](_0x29e0('0xc'),_0x34dbbf,_0x29e0('0xd'));logger[_0x29e0('0xe')](_0x29e0('0xf'),_0x34dbbf,_0x29e0('0xd'),JSON['stringify'](_0x406894));if(_0x406894[_0x29e0('0x10')]){if(_0x406894[_0x29e0('0x10')]['code']===0x1f4){logger[_0x29e0('0x10')](_0x29e0('0xc'),_0x34dbbf,_0x406894['error']['message']);return _0x1257df(_0x406894[_0x29e0('0x10')][_0x29e0('0x11')]);}logger[_0x29e0('0x10')](_0x29e0('0xc'),_0x34dbbf,_0x406894[_0x29e0('0x10')][_0x29e0('0x11')]);return _0x1be9c8(_0x406894['error'][_0x29e0('0x11')]);}else{logger[_0x29e0('0x12')]('Plugin,\x20%s,\x20%s',_0x34dbbf,_0x29e0('0xd'));_0x1be9c8(_0x406894[_0x29e0('0x13')]['message']);}})[_0x29e0('0x14')](function(_0x3c02c5){logger[_0x29e0('0x10')]('Plugin,\x20%s,\x20%s',_0x34dbbf,_0x3c02c5);_0x1257df(_0x3c02c5);});});}exports[_0x29e0('0x15')]=function(_0x1b11b1){var _0x3fa648=this;return new Promise(function(_0x65ef30,_0x38ff65){return db[_0x29e0('0x16')][_0x29e0('0x17')](_0x1b11b1['body'],{'raw':_0x1b11b1[_0x29e0('0x18')]?_0x1b11b1[_0x29e0('0x18')][_0x29e0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1021f6){logger['info'](_0x29e0('0x15'),_0x1b11b1);logger[_0x29e0('0xe')](_0x29e0('0x15'),_0x1b11b1,JSON['stringify'](_0x1021f6));_0x65ef30(_0x1021f6);})['catch'](function(_0x130df6){logger[_0x29e0('0x10')](_0x29e0('0x15'),_0x130df6[_0x29e0('0x11')],_0x1b11b1);_0x38ff65(_0x3fa648[_0x29e0('0x10')](0x1f4,_0x130df6['message']));});});}; \ No newline at end of file +var _0x9593=['./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','Plugin','create','options','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter'];(function(_0x14b0db,_0x1da66d){var _0x289651=function(_0x521112){while(--_0x521112){_0x14b0db['push'](_0x14b0db['shift']());}};_0x289651(++_0x1da66d);}(_0x9593,0x17c));var _0x3959=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x9593[_0x5eb22e];return _0x27fed5;};'use strict';var _=require(_0x3959('0x0'));var util=require(_0x3959('0x1'));var moment=require(_0x3959('0x2'));var BPromise=require(_0x3959('0x3'));var rs=require(_0x3959('0x4'));var fs=require('fs');var Redis=require(_0x3959('0x5'));var db=require(_0x3959('0x6'))['db'];var utils=require(_0x3959('0x7'));var logger=require(_0x3959('0x8'))(_0x3959('0x9'));var config=require(_0x3959('0xa'));var jayson=require(_0x3959('0xb'));var client=jayson[_0x3959('0xc')][_0x3959('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3959('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3959('0xf'))(new Redis(config[_0x3959('0xe')]));require(_0x3959('0x10'))[_0x3959('0x11')](socket);function respondWithRpcPromise(_0x5b1c1c,_0x17bc49,_0x464f6c){return new BPromise(function(_0x172bc8,_0x80db0f){return client['request'](_0x5b1c1c,_0x464f6c)[_0x3959('0x12')](function(_0x4136a8){logger[_0x3959('0x13')](_0x3959('0x14'),_0x17bc49,'request\x20sent');logger[_0x3959('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x17bc49,_0x3959('0x16'),JSON[_0x3959('0x17')](_0x4136a8));if(_0x4136a8[_0x3959('0x18')]){if(_0x4136a8[_0x3959('0x18')][_0x3959('0x19')]===0x1f4){logger[_0x3959('0x18')](_0x3959('0x14'),_0x17bc49,_0x4136a8[_0x3959('0x18')][_0x3959('0x1a')]);return _0x80db0f(_0x4136a8[_0x3959('0x18')][_0x3959('0x1a')]);}logger[_0x3959('0x18')](_0x3959('0x14'),_0x17bc49,_0x4136a8[_0x3959('0x18')][_0x3959('0x1a')]);return _0x172bc8(_0x4136a8['error']['message']);}else{logger[_0x3959('0x13')](_0x3959('0x14'),_0x17bc49,'request\x20sent');_0x172bc8(_0x4136a8[_0x3959('0x1b')][_0x3959('0x1a')]);}})[_0x3959('0x1c')](function(_0x4f6783){logger[_0x3959('0x18')]('Plugin,\x20%s,\x20%s',_0x17bc49,_0x4f6783);_0x80db0f(_0x4f6783);});});}exports['CreatePlugin']=function(_0x1caa73){var _0x43cc00=this;return new Promise(function(_0x11c382,_0x421e1b){return db[_0x3959('0x1d')][_0x3959('0x1e')](_0x1caa73['body'],{'raw':_0x1caa73[_0x3959('0x1f')]?_0x1caa73[_0x3959('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x3959('0x12')](function(_0x1e3599){logger[_0x3959('0x13')](_0x3959('0x20'),_0x1caa73);logger[_0x3959('0x15')](_0x3959('0x20'),_0x1caa73,JSON[_0x3959('0x17')](_0x1e3599));_0x11c382(_0x1e3599);})[_0x3959('0x1c')](function(_0x1c63df){logger['error'](_0x3959('0x20'),_0x1c63df[_0x3959('0x1a')],_0x1caa73);_0x421e1b(_0x43cc00[_0x3959('0x18')](0x1f4,_0x1c63df[_0x3959('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 204040c..794e015 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 _0xaf6e=['plugin:','./plugin.events','update','removeListener','register'];(function(_0x4679c0,_0x1d2d3a){var _0x18a1a1=function(_0x340964){while(--_0x340964){_0x4679c0['push'](_0x4679c0['shift']());}};_0x18a1a1(++_0x1d2d3a);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x217aa8,_0x63267b){_0x217aa8=_0x217aa8-0x0;var _0x4a810c=_0xaf6e[_0x217aa8];return _0x4a810c;};'use strict';var PluginEvents=require(_0xeaf6('0x0'));var events=['save','remove',_0xeaf6('0x1')];function createListener(_0xd55872,_0x2e542b){return function(_0x2e528){_0x2e542b['emit'](_0xd55872,_0x2e528);};}function removeListener(_0x393d52,_0x391385){return function(){PluginEvents[_0xeaf6('0x2')](_0x393d52,_0x391385);};}exports[_0xeaf6('0x3')]=function(_0x284ffc){for(var _0x4c8814=0x0,_0x595fc8=events['length'];_0x4c8814<_0x595fc8;_0x4c8814++){var _0xfa0e5d=events[_0x4c8814];var _0x4b55e6=createListener(_0xeaf6('0x4')+_0xfa0e5d,_0x284ffc);PluginEvents['on'](_0xfa0e5d,_0x4b55e6);}}; \ No newline at end of file +var _0x58c8=['update','emit','removeListener','register','plugin:','save'];(function(_0x1dbbf6,_0x3f26c9){var _0x27c7d2=function(_0x781452){while(--_0x781452){_0x1dbbf6['push'](_0x1dbbf6['shift']());}};_0x27c7d2(++_0x3f26c9);}(_0x58c8,0x1d9));var _0x858c=function(_0x59d2a3,_0x4e8480){_0x59d2a3=_0x59d2a3-0x0;var _0x3aa0de=_0x58c8[_0x59d2a3];return _0x3aa0de;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x858c('0x0'),'remove',_0x858c('0x1')];function createListener(_0x5ae0f2,_0xbdb7cb){return function(_0x34f238){_0xbdb7cb[_0x858c('0x2')](_0x5ae0f2,_0x34f238);};}function removeListener(_0x2654c0,_0xa78afa){return function(){PluginEvents[_0x858c('0x3')](_0x2654c0,_0xa78afa);};}exports[_0x858c('0x4')]=function(_0xe7d1f){for(var _0x159b6d=0x0,_0x44ea8e=events['length'];_0x159b6d<_0x44ea8e;_0x159b6d++){var _0x54e592=events[_0x159b6d];var _0xa04765=createListener(_0x858c('0x5')+_0x54e592,_0xe7d1f);PluginEvents['on'](_0x54e592,_0xa04765);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f9915a7..788d381 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 _0x1cc6=['index','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','express','Router','./pm2.controller'];(function(_0x4f5103,_0x52a9b3){var _0x585c60=function(_0x31b228){while(--_0x31b228){_0x4f5103['push'](_0x4f5103['shift']());}};_0x585c60(++_0x52a9b3);}(_0x1cc6,0x6d));var _0x61cc=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x1cc6[_0x207811];return _0x170d56;};'use strict';var express=require(_0x61cc('0x0'));var router=express[_0x61cc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x61cc('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x61cc('0x3')]);router[_0x61cc('0x4')](_0x61cc('0x5'),auth[_0x61cc('0x6')](),controller[_0x61cc('0x7')]);router[_0x61cc('0x8')]('/',auth['isAuthenticated'](),controller[_0x61cc('0x9')]);router[_0x61cc('0xa')](_0x61cc('0x5'),auth[_0x61cc('0x6')](),controller[_0x61cc('0xb')]);router['delete'](_0x61cc('0x5'),auth[_0x61cc('0x6')](),controller[_0x61cc('0xc')]);module[_0x61cc('0xd')]=router; \ No newline at end of file +var _0x8538=['create','put','update','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2f1d2f,_0x527d85){var _0x2874cf=function(_0x3203df){while(--_0x3203df){_0x2f1d2f['push'](_0x2f1d2f['shift']());}};_0x2874cf(++_0x527d85);}(_0x8538,0xd7));var _0x8853=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8538[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x8853('0x0'));var router=express[_0x8853('0x1')]();var auth=require(_0x8853('0x2'));var controller=require(_0x8853('0x3'));router[_0x8853('0x4')]('/',auth[_0x8853('0x5')](),controller[_0x8853('0x6')]);router[_0x8853('0x4')](_0x8853('0x7'),auth[_0x8853('0x5')](),controller[_0x8853('0x8')]);router[_0x8853('0x9')]('/',auth['isAuthenticated'](),controller[_0x8853('0xa')]);router[_0x8853('0xb')](_0x8853('0x7'),auth[_0x8853('0x5')](),controller[_0x8853('0xc')]);router['delete'](_0x8853('0x7'),auth[_0x8853('0x5')](),controller[_0x8853('0xd')]);module[_0x8853('0xe')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 8dc7e2d..267cadc 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 _0xb24c=['index','list','then','reject','express','motion2','length','show','describe','params','catch','create','body','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','json','error','stack','name','status','send','npm\x20install','info'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0xb24c,0xf2));var _0xcb24=function(_0x4d4d02,_0x5e2988){_0x4d4d02=_0x4d4d02-0x0;var _0x3b1df4=_0xb24c[_0x4d4d02];return _0x3b1df4;};'use strict';var _=require(_0xcb24('0x0'));var pm2=require(_0xcb24('0x1'));var logger=require(_0xcb24('0x2'))(_0xcb24('0x3'));var path=require(_0xcb24('0x4'));var exec=require('child_process')[_0xcb24('0x5')];var BPromise=require(_0xcb24('0x6'));function handleEntityNotFound(_0x4161ef,_0x1293fb){return function(_0x28be1f){if(!_0x28be1f){_0x4161ef[_0xcb24('0x7')](0x194);;}return _0x28be1f;};}function respondWithResult(_0x2bed40,_0x5a37cf){_0x5a37cf=_0x5a37cf||0xc8;return function(_0x297e01){if(_0x297e01){return _0x2bed40['status'](_0x5a37cf)[_0xcb24('0x8')](_0x297e01);}return null;};}function handleError(_0x21dbcb,_0x171984){_0x171984=_0x171984||0x1f4;return function(_0x585da2){logger[_0xcb24('0x9')](_0x585da2[_0xcb24('0xa')]);if(_0x585da2['name']){delete _0x585da2[_0xcb24('0xb')];}_0x21dbcb[_0xcb24('0xc')](_0x171984)[_0xcb24('0xd')](_0x585da2);};}function execChildProcess(){return new BPromise(function(_0x1b26f6,_0x122c4f){exec(_0xcb24('0xe'),function(_0x46a5f4,_0x263421,_0x4227f3){logger[_0xcb24('0xf')](_0x263421);logger[_0xcb24('0xf')](_0x4227f3);if(_0x46a5f4){logger[_0xcb24('0x9')](_0x46a5f4);return _0x122c4f(_0x46a5f4);}return _0x1b26f6(_0x263421);});});}exports[_0xcb24('0x10')]=function(_0x1ecee3,_0x4ac90b){return pm2[_0xcb24('0x11')]()[_0xcb24('0x12')](function(_0x2e7835){if(_0x2e7835){var _0x4cdd0a=_[_0xcb24('0x13')](_0x2e7835,function(_0x1cd7fe){return _0x1cd7fe[_0xcb24('0xb')]===_0xcb24('0x14')||_0x1cd7fe[_0xcb24('0xb')]===_0xcb24('0x15');});return{'rows':_0x4cdd0a,'count':_0x4cdd0a[_0xcb24('0x16')]};}return null;})[_0xcb24('0x12')](respondWithResult(_0x4ac90b,null))['catch'](handleError(_0x4ac90b,null));};exports[_0xcb24('0x17')]=function(_0x272333,_0x45c37c){return pm2[_0xcb24('0x18')](_0x272333[_0xcb24('0x19')]['id'])[_0xcb24('0x12')](respondWithResult(_0x45c37c,null))[_0xcb24('0x12')](handleEntityNotFound(_0x45c37c,null))[_0xcb24('0x1a')](handleError(_0x45c37c,null));};exports[_0xcb24('0x1b')]=function(_0x44e7b6,_0x15e112){if(_0x44e7b6['body'][_0xcb24('0xb')]&&_0x44e7b6[_0xcb24('0x1c')]['script']){var _0x23c58b=path[_0xcb24('0x1d')](__dirname,_0xcb24('0x1e'),_0x44e7b6[_0xcb24('0x1c')]['script']);var _0x3d2a37=process[_0xcb24('0x1f')]();process[_0xcb24('0x20')](path[_0xcb24('0x21')](_0x23c58b));return execChildProcess()[_0xcb24('0x12')](function(_0xda288a){process['chdir'](_0x3d2a37);return pm2[_0xcb24('0x22')]({'name':_0x44e7b6[_0xcb24('0x1c')][_0xcb24('0xb')],'script':_0x23c58b});})['then'](function(_0x591602){pm2[_0xcb24('0x23')]();return _0x591602[0x0];})['then'](respondWithResult(_0x15e112,0xc9))[_0xcb24('0x1a')](handleError(_0x15e112,null));}else{return _0x15e112['status'](0x1f4)[_0xcb24('0xd')]({'message':_0xcb24('0x24')});}};exports[_0xcb24('0x25')]=function(_0x13edce,_0x4be750){if(_0x13edce['body']['id']){delete _0x13edce[_0xcb24('0x1c')]['id'];}var _0x5eea3e={'online':'restart','stopped':_0xcb24('0x26')};if(_0x5eea3e[_0xcb24('0x27')](_0x13edce[_0xcb24('0x1c')][_0xcb24('0xc')])){return pm2[_0x5eea3e[_0x13edce[_0xcb24('0x1c')][_0xcb24('0xc')]]](_0x13edce['params']['id'])[_0xcb24('0x12')](respondWithResult(_0x4be750,0xc8))['catch'](handleError(_0x4be750,null));}else{return _0x4be750[_0xcb24('0xc')](0x1f4)[_0xcb24('0xd')]({'message':'Unknown\x20status'});}};exports[_0xcb24('0x28')]=function(_0xe46cdd,_0x566a80){if(_0xe46cdd[_0xcb24('0x1c')]['id']){delete _0xe46cdd[_0xcb24('0x1c')]['id'];}if(_0xe46cdd['params']['id']){return pm2[_0xcb24('0x29')](_0xe46cdd[_0xcb24('0x19')]['id'])[_0xcb24('0x12')](function(_0xa00c95){pm2[_0xcb24('0x23')]();return _0xa00c95[0x0];})[_0xcb24('0x12')](respondWithResult(_0x566a80,null))[_0xcb24('0x1a')](handleError(_0x566a80,null));}else{return _0x566a80[_0xcb24('0xc')](0x1f4)[_0xcb24('0xd')]({'message':_0xcb24('0x2a')});}}; \ No newline at end of file +var _0x5caf=['start','dump','status','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','error','stack','name','send','info','index','then','motion2','length','catch','show','describe','params','create','body','script','join','cwd','chdir','dirname'];(function(_0x1af530,_0x188062){var _0x1aeb5e=function(_0x167fc3){while(--_0x167fc3){_0x1af530['push'](_0x1af530['shift']());}};_0x1aeb5e(++_0x188062);}(_0x5caf,0x71));var _0xf5ca=function(_0x168e62,_0x1b7fd5){_0x168e62=_0x168e62-0x0;var _0x164f49=_0x5caf[_0x168e62];return _0x164f49;};'use strict';var _=require(_0xf5ca('0x0'));var pm2=require(_0xf5ca('0x1'));var logger=require(_0xf5ca('0x2'))(_0xf5ca('0x3'));var path=require('path');var exec=require(_0xf5ca('0x4'))['exec'];var BPromise=require(_0xf5ca('0x5'));function handleEntityNotFound(_0x2f0da4,_0x53fe91){return function(_0x42bfde){if(!_0x42bfde){_0x2f0da4[_0xf5ca('0x6')](0x194);;}return _0x42bfde;};}function respondWithResult(_0x5ae50e,_0x12cf29){_0x12cf29=_0x12cf29||0xc8;return function(_0x520f59){if(_0x520f59){return _0x5ae50e['status'](_0x12cf29)['json'](_0x520f59);}return null;};}function handleError(_0x5eab0e,_0x5cf152){_0x5cf152=_0x5cf152||0x1f4;return function(_0x3e63d8){logger[_0xf5ca('0x7')](_0x3e63d8[_0xf5ca('0x8')]);if(_0x3e63d8[_0xf5ca('0x9')]){delete _0x3e63d8[_0xf5ca('0x9')];}_0x5eab0e['status'](_0x5cf152)[_0xf5ca('0xa')](_0x3e63d8);};}function execChildProcess(){return new BPromise(function(_0x27cf90,_0x3661ee){exec('npm\x20install',function(_0x153333,_0x4253ea,_0x3116a5){logger['info'](_0x4253ea);logger[_0xf5ca('0xb')](_0x3116a5);if(_0x153333){logger['error'](_0x153333);return _0x3661ee(_0x153333);}return _0x27cf90(_0x4253ea);});});}exports[_0xf5ca('0xc')]=function(_0x42614d,_0x3dacd8){return pm2['list']()[_0xf5ca('0xd')](function(_0x4fcde0){if(_0x4fcde0){var _0x518736=_['reject'](_0x4fcde0,function(_0x3c5f52){return _0x3c5f52['name']==='express'||_0x3c5f52[_0xf5ca('0x9')]===_0xf5ca('0xe');});return{'rows':_0x518736,'count':_0x518736[_0xf5ca('0xf')]};}return null;})[_0xf5ca('0xd')](respondWithResult(_0x3dacd8,null))[_0xf5ca('0x10')](handleError(_0x3dacd8,null));};exports[_0xf5ca('0x11')]=function(_0x523a3a,_0x42e27f){return pm2[_0xf5ca('0x12')](_0x523a3a[_0xf5ca('0x13')]['id'])['then'](respondWithResult(_0x42e27f,null))[_0xf5ca('0xd')](handleEntityNotFound(_0x42e27f,null))[_0xf5ca('0x10')](handleError(_0x42e27f,null));};exports[_0xf5ca('0x14')]=function(_0x2ac6e4,_0x192c7a){if(_0x2ac6e4['body'][_0xf5ca('0x9')]&&_0x2ac6e4[_0xf5ca('0x15')][_0xf5ca('0x16')]){var _0xcf95c8=path[_0xf5ca('0x17')](__dirname,'../../files/plugins',_0x2ac6e4[_0xf5ca('0x15')][_0xf5ca('0x16')]);var _0x357e6b=process[_0xf5ca('0x18')]();process[_0xf5ca('0x19')](path[_0xf5ca('0x1a')](_0xcf95c8));return execChildProcess()[_0xf5ca('0xd')](function(_0x31643f){process[_0xf5ca('0x19')](_0x357e6b);return pm2[_0xf5ca('0x1b')]({'name':_0x2ac6e4[_0xf5ca('0x15')]['name'],'script':_0xcf95c8});})['then'](function(_0x429933){pm2[_0xf5ca('0x1c')]();return _0x429933[0x0];})[_0xf5ca('0xd')](respondWithResult(_0x192c7a,0xc9))[_0xf5ca('0x10')](handleError(_0x192c7a,null));}else{return _0x192c7a[_0xf5ca('0x1d')](0x1f4)[_0xf5ca('0xa')]({'message':_0xf5ca('0x1e')});}};exports['update']=function(_0x2064d6,_0x5705b7){if(_0x2064d6[_0xf5ca('0x15')]['id']){delete _0x2064d6[_0xf5ca('0x15')]['id'];}var _0x3ded00={'online':_0xf5ca('0x1f'),'stopped':_0xf5ca('0x20')};if(_0x3ded00['hasOwnProperty'](_0x2064d6[_0xf5ca('0x15')][_0xf5ca('0x1d')])){return pm2[_0x3ded00[_0x2064d6[_0xf5ca('0x15')][_0xf5ca('0x1d')]]](_0x2064d6[_0xf5ca('0x13')]['id'])[_0xf5ca('0xd')](respondWithResult(_0x5705b7,0xc8))['catch'](handleError(_0x5705b7,null));}else{return _0x5705b7[_0xf5ca('0x1d')](0x1f4)[_0xf5ca('0xa')]({'message':_0xf5ca('0x21')});}};exports['destroy']=function(_0x25daae,_0x413082){if(_0x25daae['body']['id']){delete _0x25daae[_0xf5ca('0x15')]['id'];}if(_0x25daae[_0xf5ca('0x13')]['id']){return pm2['delete'](_0x25daae[_0xf5ca('0x13')]['id'])[_0xf5ca('0xd')](function(_0x326849){pm2['dump']();return _0x326849[0x0];})[_0xf5ca('0xd')](respondWithResult(_0x413082,null))[_0xf5ca('0x10')](handleError(_0x413082,null));}else{return _0x413082[_0xf5ca('0x1d')](0x1f4)[_0xf5ca('0xa')]({'message':_0xf5ca('0x22')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4b959c6..65c99e1 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 _0x6cf9=['path','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x6cf9,0x192));var _0x96cf=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x6cf9[_0x4392af];return _0x9fa8eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x96cf('0x0'));var timeout=require('connect-timeout');var express=require(_0x96cf('0x1'));var router=express[_0x96cf('0x2')]();var auth=require(_0x96cf('0x3'));var interaction=require(_0x96cf('0x4'));var config=require('../../config/environment');module[_0x96cf('0x5')]=router; \ No newline at end of file +var _0xfba5=['../../config/environment','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2bfa96,_0x50df39){var _0x79827a=function(_0x520f32){while(--_0x520f32){_0x2bfa96['push'](_0x2bfa96['shift']());}};_0x79827a(++_0x50df39);}(_0xfba5,0x1e9));var _0x5fba=function(_0x5aa5aa,_0x57ed29){_0x5aa5aa=_0x5aa5aa-0x0;var _0x490cda=_0xfba5[_0x5aa5aa];return _0x490cda;};'use strict';var multer=require(_0x5fba('0x0'));var util=require(_0x5fba('0x1'));var path=require(_0x5fba('0x2'));var timeout=require(_0x5fba('0x3'));var express=require(_0x5fba('0x4'));var router=express['Router']();var auth=require(_0x5fba('0x5'));var interaction=require(_0x5fba('0x6'));var config=require(_0x5fba('0x7'));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 9fcb175..e6a50a6 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 _0x1008=['DATE','exports','INTEGER','STRING'];(function(_0x21f575,_0x2005e7){var _0x187247=function(_0x1674f3){while(--_0x1674f3){_0x21f575['push'](_0x21f575['shift']());}};_0x187247(++_0x2005e7);}(_0x1008,0x115));var _0x8100=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x1008[_0xfd495c];return _0x561dd8;};'use strict';var Sequelize=require('sequelize');module[_0x8100('0x0')]={'state':{'type':Sequelize[_0x8100('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8100('0x2')]},'scheduledat':{'type':Sequelize[_0x8100('0x3')]},'uniqueid':{'type':Sequelize[_0x8100('0x2')]},'starttime':{'type':Sequelize[_0x8100('0x3')]},'responsetime':{'type':Sequelize[_0x8100('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8100('0x2')]},'campaigntype':{'type':Sequelize[_0x8100('0x2')]},'membername':{'type':Sequelize[_0x8100('0x2')]}}; \ No newline at end of file +var _0xafbf=['STRING','DATE','exports','INTEGER'];(function(_0x248456,_0x1e5e93){var _0x2b91ea=function(_0x156f14){while(--_0x156f14){_0x248456['push'](_0x248456['shift']());}};_0x2b91ea(++_0x1e5e93);}(_0xafbf,0x10e));var _0xfafb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xafbf[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0xfafb('0x0')]={'state':{'type':Sequelize[_0xfafb('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xfafb('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xfafb('0x2')]},'starttime':{'type':Sequelize[_0xfafb('0x3')]},'responsetime':{'type':Sequelize[_0xfafb('0x3')]},'ringtime':{'type':Sequelize[_0xfafb('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xfafb('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfafb('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 2ffb6fb..874d506 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 _0xb37c=['define','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4a6c36,_0x5aa4c5){var _0x50c02b=function(_0x359159){while(--_0x359159){_0x4a6c36['push'](_0x4a6c36['shift']());}};_0x50c02b(++_0x5aa4c5);}(_0xb37c,0xd3));var _0xcb37=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb37c[_0x432682];return _0x463d05;};'use strict';var _=require(_0xcb37('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcb37('0x1'));var moment=require(_0xcb37('0x2'));var BPromise=require(_0xcb37('0x3'));var rp=require(_0xcb37('0x4'));var fs=require('fs');var path=require(_0xcb37('0x5'));var rimraf=require(_0xcb37('0x6'));var config=require(_0xcb37('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0xcb37('0x8')]=function(_0x39a4ba,_0x51913f){return _0x39a4ba[_0xcb37('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc192=['../../config/logger','moment','path','rimraf','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x3fc903,_0xa527a2){var _0x163ca6=function(_0x3e8f01){while(--_0x3e8f01){_0x3fc903['push'](_0x3fc903['shift']());}};_0x163ca6(++_0xa527a2);}(_0xc192,0x103));var _0x2c19=function(_0x1cd755,_0x48fb9c){_0x1cd755=_0x1cd755-0x0;var _0x7d9599=_0xc192[_0x1cd755];return _0x7d9599;};'use strict';var _=require(_0x2c19('0x0'));var util=require(_0x2c19('0x1'));var logger=require(_0x2c19('0x2'))('api');var moment=require(_0x2c19('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c19('0x4'));var rimraf=require(_0x2c19('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c19('0x6'));module['exports']=function(_0x36ae11,_0x4a44c5){return _0x36ae11['define'](_0x2c19('0x7'),attributes,{'tableName':_0x2c19('0x8'),'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 0cf7440..c1f1e78 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 _0x7f36=['request\x20sent','debug','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','ReportAgentPreview','create','body','options','raw','then','CreateReportAgentPreview','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7f36,0x17d));var _0x67f3=function(_0xace829,_0x21fd06){_0xace829=_0xace829-0x0;var _0x5da31a=_0x7f36[_0xace829];return _0x5da31a;};'use strict';var _=require(_0x67f3('0x0'));var util=require(_0x67f3('0x1'));var moment=require(_0x67f3('0x2'));var BPromise=require('bluebird');var rs=require(_0x67f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67f3('0x4'))['db'];var utils=require(_0x67f3('0x5'));var logger=require(_0x67f3('0x6'))('rpc');var config=require(_0x67f3('0x7'));var jayson=require(_0x67f3('0x8'));var client=jayson['client'][_0x67f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38cddc,_0x4123dd,_0x2ad4d0){return new BPromise(function(_0x316ddc,_0x513da8){return client[_0x67f3('0xa')](_0x38cddc,_0x2ad4d0)['then'](function(_0x362c98){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x4123dd,_0x67f3('0xb'));logger[_0x67f3('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x4123dd,_0x67f3('0xb'),JSON[_0x67f3('0xd')](_0x362c98));if(_0x362c98['error']){if(_0x362c98[_0x67f3('0xe')][_0x67f3('0xf')]===0x1f4){logger[_0x67f3('0xe')](_0x67f3('0x10'),_0x4123dd,_0x362c98[_0x67f3('0xe')][_0x67f3('0x11')]);return _0x513da8(_0x362c98[_0x67f3('0xe')]['message']);}logger['error'](_0x67f3('0x10'),_0x4123dd,_0x362c98['error'][_0x67f3('0x11')]);return _0x316ddc(_0x362c98[_0x67f3('0xe')][_0x67f3('0x11')]);}else{logger[_0x67f3('0x12')](_0x67f3('0x10'),_0x4123dd,_0x67f3('0xb'));_0x316ddc(_0x362c98[_0x67f3('0x13')][_0x67f3('0x11')]);}})['catch'](function(_0x875f7a){logger[_0x67f3('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x4123dd,_0x875f7a);_0x513da8(_0x875f7a);});});}exports['CreateReportAgentPreview']=function(_0x4926e2){var _0x17637b=this;return new Promise(function(_0x550105,_0x2982c4){return db[_0x67f3('0x14')][_0x67f3('0x15')](_0x4926e2[_0x67f3('0x16')],{'raw':_0x4926e2[_0x67f3('0x17')]?_0x4926e2[_0x67f3('0x17')][_0x67f3('0x18')]===undefined?!![]:![]:!![]})[_0x67f3('0x19')](function(_0x7d0bd3){logger[_0x67f3('0x12')](_0x67f3('0x1a'),_0x4926e2);logger[_0x67f3('0xc')](_0x67f3('0x1a'),_0x4926e2,JSON[_0x67f3('0xd')](_0x7d0bd3));_0x550105(_0x7d0bd3);})[_0x67f3('0x1b')](function(_0x3e03a7){logger[_0x67f3('0xe')](_0x67f3('0x1a'),_0x3e03a7[_0x67f3('0x11')],_0x4926e2);_0x2982c4(_0x17637b[_0x67f3('0xe')](0x1f4,_0x3e03a7[_0x67f3('0x11')]));});});}; \ No newline at end of file +var _0xb971=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x1739c8,_0x39daa7){var _0x3a7698=function(_0x56a221){while(--_0x56a221){_0x1739c8['push'](_0x1739c8['shift']());}};_0x3a7698(++_0x39daa7);}(_0xb971,0x1df));var _0x1b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb971[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1b97('0x0'));var util=require(_0x1b97('0x1'));var moment=require('moment');var BPromise=require(_0x1b97('0x2'));var rs=require(_0x1b97('0x3'));var fs=require('fs');var Redis=require(_0x1b97('0x4'));var db=require(_0x1b97('0x5'))['db'];var utils=require(_0x1b97('0x6'));var logger=require('../../config/logger')(_0x1b97('0x7'));var config=require(_0x1b97('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1b97('0x9')][_0x1b97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x98264a,_0x4f5bab,_0x47f7ba){return new BPromise(function(_0x345b12,_0x244246){return client[_0x1b97('0xb')](_0x98264a,_0x47f7ba)[_0x1b97('0xc')](function(_0x5626a){logger[_0x1b97('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f5bab,'request\x20sent');logger[_0x1b97('0xe')](_0x1b97('0xf'),_0x4f5bab,_0x1b97('0x10'),JSON['stringify'](_0x5626a));if(_0x5626a['error']){if(_0x5626a[_0x1b97('0x11')]['code']===0x1f4){logger[_0x1b97('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f5bab,_0x5626a[_0x1b97('0x11')][_0x1b97('0x12')]);return _0x244246(_0x5626a['error'][_0x1b97('0x12')]);}logger[_0x1b97('0x11')](_0x1b97('0x13'),_0x4f5bab,_0x5626a[_0x1b97('0x11')][_0x1b97('0x12')]);return _0x345b12(_0x5626a[_0x1b97('0x11')]['message']);}else{logger[_0x1b97('0xd')](_0x1b97('0x13'),_0x4f5bab,_0x1b97('0x10'));_0x345b12(_0x5626a[_0x1b97('0x14')]['message']);}})[_0x1b97('0x15')](function(_0x396a9b){logger[_0x1b97('0x11')](_0x1b97('0x13'),_0x4f5bab,_0x396a9b);_0x244246(_0x396a9b);});});}exports[_0x1b97('0x16')]=function(_0x3ae978){var _0x230789=this;return new Promise(function(_0x53c03d,_0x2de3f8){return db[_0x1b97('0x17')][_0x1b97('0x18')](_0x3ae978[_0x1b97('0x19')],{'raw':_0x3ae978[_0x1b97('0x1a')]?_0x3ae978[_0x1b97('0x1a')][_0x1b97('0x1b')]===undefined?!![]:![]:!![]})[_0x1b97('0xc')](function(_0x55996d){logger[_0x1b97('0xd')](_0x1b97('0x16'),_0x3ae978);logger[_0x1b97('0xe')](_0x1b97('0x16'),_0x3ae978,JSON[_0x1b97('0x1c')](_0x55996d));_0x53c03d(_0x55996d);})['catch'](function(_0x34280b){logger[_0x1b97('0x11')](_0x1b97('0x16'),_0x34280b[_0x1b97('0x12')],_0x3ae978);_0x2de3f8(_0x230789['error'](0x1f4,_0x34280b[_0x1b97('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 5a4db34..a872d24 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 _0x4813=['smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','/chat/queues/:id/notify','chat','showChatQueues','post','/fax/queues/:id/notify','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','path','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions'];(function(_0x38b605,_0x9eaf4a){var _0x5dda85=function(_0xf82f4){while(--_0xf82f4){_0x38b605['push'](_0x38b605['shift']());}};_0x5dda85(++_0x9eaf4a);}(_0x4813,0xdc));var _0x3481=function(_0x130b7b,_0x19877a){_0x130b7b=_0x130b7b-0x0;var _0x3446a2=_0x4813[_0x130b7b];return _0x3446a2;};'use strict';var multer=require(_0x3481('0x0'));var util=require('util');var path=require(_0x3481('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x3481('0x2'));var controller=require(_0x3481('0x3'));router['get'](_0x3481('0x4'),auth[_0x3481('0x5')](),controller[_0x3481('0x6')]);router[_0x3481('0x7')](_0x3481('0x8'),auth[_0x3481('0x5')](),controller[_0x3481('0x9')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x3481('0x5')](),controller['voiceChannelStopMixMonitor']);router[_0x3481('0x7')](_0x3481('0xa'),auth[_0x3481('0x5')](),controller[_0x3481('0xb')]);router[_0x3481('0x7')](_0x3481('0xc'),auth[_0x3481('0x5')](),controller['chatQueues']);router['get'](_0x3481('0xd'),auth[_0x3481('0x5')](),controller[_0x3481('0xe')]);router[_0x3481('0x7')](_0x3481('0xf'),auth['isAuthenticated'](),controller[_0x3481('0x10')]);router[_0x3481('0x7')](_0x3481('0x11'),auth[_0x3481('0x5')](),controller[_0x3481('0x12')]);router['get']('/sms/queues',auth[_0x3481('0x5')](),controller[_0x3481('0x13')]);router['get'](_0x3481('0x14'),auth[_0x3481('0x5')](),controller[_0x3481('0x15')]);router[_0x3481('0x7')](_0x3481('0x16'),auth[_0x3481('0x5')](),controller[_0x3481('0x17')]);router['get'](_0x3481('0x18'),auth[_0x3481('0x5')](),controller[_0x3481('0x19')]);router[_0x3481('0x7')](_0x3481('0x1a'),auth[_0x3481('0x5')](),controller[_0x3481('0x1b')]);router[_0x3481('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x3481('0x5')](),controller['voiceQueuesChannelHangup']);router[_0x3481('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x3481('0x5')](),controller[_0x3481('0x1c')]);router[_0x3481('0x7')](_0x3481('0x1d'),auth[_0x3481('0x5')](),controller['showVoiceQueues']);router[_0x3481('0x7')](_0x3481('0x1e'),auth[_0x3481('0x5')](),controller[_0x3481('0x1f')]);router[_0x3481('0x7')]('/outbound/channels',auth[_0x3481('0x5')](),controller[_0x3481('0x20')]);router['get'](_0x3481('0x21'),auth[_0x3481('0x5')](),controller['agents']);router[_0x3481('0x22')](_0x3481('0x23'),auth[_0x3481('0x5')](),controller[_0x3481('0x24')]);router[_0x3481('0x7')](_0x3481('0x25'),auth[_0x3481('0x5')](),controller['telephones']);router[_0x3481('0x7')](_0x3481('0x26'),auth[_0x3481('0x5')](),controller[_0x3481('0x27')]);router[_0x3481('0x7')]('/campaigns',auth[_0x3481('0x5')](),controller[_0x3481('0x28')]);router[_0x3481('0x7')](_0x3481('0x29'),auth[_0x3481('0x5')](),controller[_0x3481('0x2a')]);router['get'](_0x3481('0x2b'),auth[_0x3481('0x5')](),controller[_0x3481('0x2c')]);router['get']('/mail/queues/waitinginteractions',auth[_0x3481('0x5')](),controller[_0x3481('0x2d')]);router[_0x3481('0x7')](_0x3481('0x2e'),auth[_0x3481('0x5')](),controller['openchannelQueuesWaitingInteractions']);router[_0x3481('0x7')](_0x3481('0x2f'),auth['isAuthenticated'](),controller[_0x3481('0x30')]);router[_0x3481('0x7')](_0x3481('0x31'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router['post'](_0x3481('0x32'),auth[_0x3481('0x5')](),controller[_0x3481('0x33')]('mail'));router['get']('/mail/queues/:id',auth[_0x3481('0x5')](),controller['showMailQueues']);router['post'](_0x3481('0x34'),auth[_0x3481('0x5')](),controller[_0x3481('0x33')](_0x3481('0x35')));router[_0x3481('0x7')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x3481('0x36')]);router[_0x3481('0x37')](_0x3481('0x38'),auth['isAuthenticated'](),controller['queueNotify']('fax'));router[_0x3481('0x7')](_0x3481('0x39'),auth[_0x3481('0x5')](),controller['showFaxQueues']);router[_0x3481('0x37')]('/openchannel/queues/:id/notify',auth[_0x3481('0x5')](),controller[_0x3481('0x33')](_0x3481('0x3a')));router['get'](_0x3481('0x3b'),auth['isAuthenticated'](),controller[_0x3481('0x3c')]);router[_0x3481('0x37')](_0x3481('0x3d'),auth[_0x3481('0x5')](),controller['queueNotify'](_0x3481('0x3e')));router[_0x3481('0x7')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x3481('0x3f')]);router[_0x3481('0x37')](_0x3481('0x40'),auth[_0x3481('0x5')](),controller[_0x3481('0x41')]);module[_0x3481('0x42')]=router; \ No newline at end of file +var _0x5b94=['/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','trunks','faxAccounts','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','/agents/:id/notify','exports','util','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x5b94,0x12a));var _0x45b9=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x5b94[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require('multer');var util=require(_0x45b9('0x0'));var path=require(_0x45b9('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x45b9('0x2'));var controller=require(_0x45b9('0x3'));router[_0x45b9('0x4')](_0x45b9('0x5'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x7')]);router[_0x45b9('0x4')](_0x45b9('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x45b9('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x45b9('0x6')](),controller[_0x45b9('0x9')]);router[_0x45b9('0x4')](_0x45b9('0xa'),auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0x45b9('0xb'),auth[_0x45b9('0x6')](),controller[_0x45b9('0xc')]);router[_0x45b9('0x4')](_0x45b9('0xd'),auth[_0x45b9('0x6')](),controller['mailQueues']);router[_0x45b9('0x4')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x45b9('0xe')]);router[_0x45b9('0x4')](_0x45b9('0xf'),auth['isAuthenticated'](),controller[_0x45b9('0x10')]);router[_0x45b9('0x4')](_0x45b9('0x11'),auth['isAuthenticated'](),controller[_0x45b9('0x12')]);router[_0x45b9('0x4')](_0x45b9('0x13'),auth['isAuthenticated'](),controller[_0x45b9('0x14')]);router[_0x45b9('0x4')](_0x45b9('0x15'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x16')]);router['get'](_0x45b9('0x17'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x45b9('0x4')](_0x45b9('0x18'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x19')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x45b9('0x1a')]);router[_0x45b9('0x4')](_0x45b9('0x1b'),auth['isAuthenticated'](),controller[_0x45b9('0x1c')]);router['get'](_0x45b9('0x1d'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x1e')]);router['get'](_0x45b9('0x1f'),auth['isAuthenticated'](),controller[_0x45b9('0x20')]);router['get'](_0x45b9('0x21'),auth[_0x45b9('0x6')](),controller['outboundChannels']);router['get'](_0x45b9('0x22'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x23')]);router[_0x45b9('0x24')]('/agents/:id/capacity',auth[_0x45b9('0x6')](),controller[_0x45b9('0x25')]);router['get'](_0x45b9('0x26'),auth[_0x45b9('0x6')](),controller['telephones']);router[_0x45b9('0x4')]('/trunks',auth['isAuthenticated'](),controller[_0x45b9('0x27')]);router[_0x45b9('0x4')]('/campaigns',auth[_0x45b9('0x6')](),controller['campaigns']);router[_0x45b9('0x4')]('/fax/accounts',auth[_0x45b9('0x6')](),controller[_0x45b9('0x28')]);router[_0x45b9('0x4')]('/chat/queues/waitinginteractions',auth[_0x45b9('0x6')](),controller[_0x45b9('0x29')]);router['get']('/mail/queues/waitinginteractions',auth[_0x45b9('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x45b9('0x4')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x45b9('0x2a')]);router[_0x45b9('0x4')](_0x45b9('0x2b'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x2c')]);router['get'](_0x45b9('0x2d'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x2e')]);router[_0x45b9('0x2f')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x45b9('0x30')](_0x45b9('0x31')));router[_0x45b9('0x4')](_0x45b9('0x32'),auth['isAuthenticated'](),controller[_0x45b9('0x33')]);router[_0x45b9('0x2f')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x45b9('0x30')](_0x45b9('0x34')));router['get'](_0x45b9('0x35'),auth['isAuthenticated'](),controller[_0x45b9('0x36')]);router['post'](_0x45b9('0x37'),auth['isAuthenticated'](),controller[_0x45b9('0x30')](_0x45b9('0x38')));router[_0x45b9('0x4')](_0x45b9('0x39'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x3a')]);router[_0x45b9('0x2f')]('/openchannel/queues/:id/notify',auth[_0x45b9('0x6')](),controller[_0x45b9('0x30')]('openchannel'));router[_0x45b9('0x4')](_0x45b9('0x3b'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x45b9('0x2f')](_0x45b9('0x3c'),auth[_0x45b9('0x6')](),controller[_0x45b9('0x30')](_0x45b9('0x3d')));router[_0x45b9('0x4')](_0x45b9('0x3e'),auth[_0x45b9('0x6')](),controller['showSmsQueues']);router[_0x45b9('0x2f')](_0x45b9('0x3f'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x45b9('0x40')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 29fd608..0ceacb4 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 _0x3f65=['outboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','SIP/%s','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','agentNotify','channel','capitalize','User','update','From','agentTransferTimeout','bluebird','moment','util','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','json','stack','name','isNil','find','rows','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3f65,0x138));var _0x53f6=function(_0x1c8341,_0x1bb90b){_0x1c8341=_0x1c8341-0x0;var _0x32ef74=_0x3f65[_0x1c8341];return _0x32ef74;};'use strict';var BPromise=require(_0x53f6('0x0'));var moment=require(_0x53f6('0x1'));var _=require('lodash');var util=require(_0x53f6('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x53f6('0x3'))('api');var jayson=require(_0x53f6('0x4'));var amiClient=jayson[_0x53f6('0x5')][_0x53f6('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x53f6('0x6')]({'port':0x232b});var routingClient=jayson[_0x53f6('0x5')][_0x53f6('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x31253c,_0x4cb9e3,_0x57a1a){return new BPromise(function(_0xff1898,_0x512867){var _0xc225e7=_0x57a1a?_0x57a1a:amiClient;return _0xc225e7[_0x53f6('0x7')](_0x31253c,_0x4cb9e3)['then'](function(_0x194abd){if(_0x194abd['error']){if(_0x194abd[_0x53f6('0x8')][_0x53f6('0x9')]===0x1f4){return _0x512867(_0x194abd[_0x53f6('0x8')][_0x53f6('0xa')]);}return _0xff1898(_0x194abd[_0x53f6('0x8')][_0x53f6('0xa')]);}else{_0xff1898(_0x194abd[_0x53f6('0xb')]);}})['catch'](function(_0x513b0c){_0x512867(_0x513b0c);});});}function respondWithResult(_0x174b07,_0x5bcbf9){_0x5bcbf9=_0x5bcbf9||0xc8;return function(_0x65f78e){if(_0x65f78e){return _0x174b07[_0x53f6('0xc')](_0x5bcbf9)[_0x53f6('0xd')](_0x65f78e);}return _0x174b07['sendStatus'](0x194);};}function handleError(_0x21cf44,_0x3f93c4){_0x3f93c4=_0x3f93c4||0x1f4;return function(_0x2ab9e8){logger[_0x53f6('0x8')](_0x2ab9e8[_0x53f6('0xe')]);if(_0x2ab9e8[_0x53f6('0xf')]){delete _0x2ab9e8[_0x53f6('0xf')];}_0x21cf44[_0x53f6('0xc')](_0x3f93c4)['send'](_0x2ab9e8);};}function findById(_0x5e7cf5){return function(_0x19f0cc){if(!_[_0x53f6('0x10')](_0x5e7cf5)&&!_[_0x53f6('0x10')](_0x19f0cc)&&!_[_0x53f6('0x10')](_0x19f0cc['rows'])){return _[_0x53f6('0x11')](_0x19f0cc[_0x53f6('0x12')],function(_0x503971){return _0x503971['id']==_0x5e7cf5;});}return null;};}exports['voiceChannels']=function(_0x4bb7d4,_0x2da042){return respondWithRpcPromise('VoiceChannels',_0x4bb7d4[_0x53f6('0x13')])[_0x53f6('0x14')](respondWithResult(_0x2da042,null))['catch'](handleError(_0x2da042,null));};exports[_0x53f6('0x15')]=function(_0xe9cea3,_0x42973c){return respondWithRpcPromise(_0x53f6('0x16'),_[_0x53f6('0x17')](_0xe9cea3[_0x53f6('0x13')],_0xe9cea3[_0x53f6('0x18')]))['then'](respondWithResult(_0x42973c,null))[_0x53f6('0x19')](handleError(_0x42973c,null));};exports[_0x53f6('0x1a')]=function(_0x25443c,_0x3f4b93){return respondWithRpcPromise(_0x53f6('0x1b'),_['merge'](_0x25443c[_0x53f6('0x13')],_0x25443c[_0x53f6('0x18')]))[_0x53f6('0x14')](respondWithResult(_0x3f4b93,null))[_0x53f6('0x19')](handleError(_0x3f4b93,null));};exports[_0x53f6('0x1c')]=function(_0x33d539,_0x3046c5){return respondWithRpcPromise(_0x53f6('0x1d'),_0x33d539[_0x53f6('0x13')])[_0x53f6('0x14')](respondWithResult(_0x3046c5,null))[_0x53f6('0x19')](handleError(_0x3046c5,null));};exports[_0x53f6('0x1e')]=function(_0x295f12,_0x1f319d){return respondWithRpcPromise(_0x53f6('0x1d'),_0x295f12[_0x53f6('0x13')])[_0x53f6('0x14')](findById(_0x295f12['params']['id']))[_0x53f6('0x14')](respondWithResult(_0x1f319d,null))[_0x53f6('0x19')](handleError(_0x1f319d,null));};exports[_0x53f6('0x1f')]=function(_0x454c79,_0x1d13f4){return respondWithRpcPromise(_0x53f6('0x20'),_[_0x53f6('0x17')](_0x454c79[_0x53f6('0x13')],_0x454c79[_0x53f6('0x18')]))['then'](respondWithResult(_0x1d13f4,null))['catch'](handleError(_0x1d13f4,null));};exports[_0x53f6('0x21')]=function(_0x111b2e,_0x38e72a){return respondWithRpcPromise(_0x53f6('0x22'),_0x111b2e[_0x53f6('0x13')])[_0x53f6('0x14')](respondWithResult(_0x38e72a,null))[_0x53f6('0x19')](handleError(_0x38e72a,null));};exports[_0x53f6('0x23')]=function(_0x4d1630,_0x2001c4){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x53f6('0x17')](_0x4d1630['query'],_0x4d1630['params']))[_0x53f6('0x14')](respondWithResult(_0x2001c4,null))[_0x53f6('0x19')](handleError(_0x2001c4,null));};exports['voiceQueuesChannelHangup']=function(_0x2294e7,_0x32ea88){return respondWithRpcPromise(_0x53f6('0x24'),_['merge'](_0x2294e7[_0x53f6('0x13')],_0x2294e7[_0x53f6('0x18')]))[_0x53f6('0x14')](respondWithResult(_0x32ea88,null))[_0x53f6('0x19')](handleError(_0x32ea88,null));};exports[_0x53f6('0x25')]=function(_0x4ccdcc,_0x433198){return respondWithRpcPromise(_0x53f6('0x26'),_[_0x53f6('0x17')](_0x4ccdcc[_0x53f6('0x13')],_0x4ccdcc[_0x53f6('0x18')]))[_0x53f6('0x14')](respondWithResult(_0x433198,null))[_0x53f6('0x19')](handleError(_0x433198,null));};exports['outbound']=function(_0x38461f,_0x3b7f9f){return respondWithRpcPromise('Outbound',_0x38461f[_0x53f6('0x13')])['then'](respondWithResult(_0x3b7f9f,null))[_0x53f6('0x19')](handleError(_0x3b7f9f,null));};exports[_0x53f6('0x27')]=function(_0x22779a,_0x4da45b){return respondWithRpcPromise('OutboundChannels',_0x22779a[_0x53f6('0x13')])[_0x53f6('0x14')](respondWithResult(_0x4da45b,null))[_0x53f6('0x19')](handleError(_0x4da45b,null));};exports[_0x53f6('0x28')]=function(_0x12cdda,_0x1a0be9){var _0x29c30d;return respondWithRpcPromise(_0x53f6('0x29'),_0x12cdda[_0x53f6('0x13')])[_0x53f6('0x14')](function(_0x41e01b){_0x29c30d=_0x41e01b;return respondWithRpcPromise('Agents',_0x12cdda['query'],routingClient);})['then'](function(_0x34d316){return _['merge']({},_0x34d316,_0x29c30d);})[_0x53f6('0x14')](respondWithResult(_0x1a0be9,null))[_0x53f6('0x19')](handleError(_0x1a0be9,null));};exports[_0x53f6('0x2a')]=function(_0x414757,_0x47f152){if(_0x414757[_0x53f6('0x2b')]&&_0x414757[_0x53f6('0x2b')][_0x53f6('0x2c')]&&_0x414757['user']&&_0x414757[_0x53f6('0x2d')][_0x53f6('0xf')]){for(var _0x5e1cb7 in _0x414757[_0x53f6('0x2b')][_0x53f6('0x2c')]){if(_0x414757[_0x53f6('0x2b')]['interaction'][_0x53f6('0x2e')](_0x5e1cb7)){db[_0x53f6('0x2f')][_0x53f6('0x30')]({'where':{'channel':_0x5e1cb7,'membername':_0x414757[_0x53f6('0x2d')][_0x53f6('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x414757['body']['interaction'][_0x5e1cb7]&&_0x414757['body'][_0x53f6('0x2c')][_0x5e1cb7][_0x53f6('0x31')]?{'$notIn':_0x414757[_0x53f6('0x2b')][_0x53f6('0x2c')][_0x5e1cb7]}:{'$ne':null}}})['then'](function(_0x453d4c){var _0x395f7e=moment()[_0x53f6('0x32')](_0x53f6('0x33'));for(var _0x105dce=0x0,_0x118e3c=_0x453d4c[_0x53f6('0x31')];_0x105dce<_0x118e3c;_0x105dce+=0x1){_0x453d4c[_0x105dce][_0x53f6('0x34')]({'exitAt':_0x395f7e});}});for(var _0x4c9135=0x0;_0x4c9135<_0x414757[_0x53f6('0x2b')]['interaction'][_0x5e1cb7][_0x53f6('0x31')];_0x4c9135+=0x1){db[_0x53f6('0x2f')][_0x53f6('0x35')]({'where':{'channel':_0x5e1cb7,'membername':_0x414757[_0x53f6('0x2d')][_0x53f6('0xf')],'type':_0x53f6('0x36'),'uniqueid':_0x414757['body']['interaction'][_0x5e1cb7][_0x4c9135],'exitAt':null},'defaults':{'channel':_0x5e1cb7,'membername':_0x414757['user'][_0x53f6('0xf')],'interface':_[_0x53f6('0x10')](_0x414757['user']['interface'])?util['format'](_0x53f6('0x37'),_0x414757['user'][_0x53f6('0xf')]):_0x414757[_0x53f6('0x2d')][_0x53f6('0x38')],'type':_0x53f6('0x36'),'enterAt':moment()[_0x53f6('0x32')](_0x53f6('0x33')),'role':_0x53f6('0x39'),'internal':_0x414757[_0x53f6('0x2d')][_0x53f6('0x3a')],'uniqueid':_0x414757[_0x53f6('0x2b')]['interaction'][_0x5e1cb7][_0x4c9135]}});}}}}return respondWithRpcPromise(_0x53f6('0x3b'),{'id':_0x414757[_0x53f6('0x18')]['id'],'capacity':_0x414757[_0x53f6('0x2b')][_0x53f6('0x3c')]},routingClient)[_0x53f6('0x14')](respondWithResult(_0x47f152,null))[_0x53f6('0x19')](handleError(_0x47f152,null));};exports[_0x53f6('0x3d')]=function(_0x39e7bb,_0x519af2){return respondWithRpcPromise(_0x53f6('0x3e'),_0x39e7bb[_0x53f6('0x13')])[_0x53f6('0x14')](respondWithResult(_0x519af2,null))[_0x53f6('0x19')](handleError(_0x519af2,null));};exports[_0x53f6('0x3f')]=function(_0xe485b5,_0x4d90d4){return respondWithRpcPromise(_0x53f6('0x40'),_0xe485b5[_0x53f6('0x13')])[_0x53f6('0x14')](respondWithResult(_0x4d90d4,null))[_0x53f6('0x19')](handleError(_0x4d90d4,null));};exports[_0x53f6('0x41')]=function(_0x3101bd,_0x55d72a){return respondWithRpcPromise(_0x53f6('0x42'),_0x3101bd[_0x53f6('0x13')])[_0x53f6('0x14')](respondWithResult(_0x55d72a,null))[_0x53f6('0x19')](handleError(_0x55d72a,null));};exports[_0x53f6('0x43')]=function(_0x651c14,_0x129a98){return respondWithRpcPromise(_0x53f6('0x44'),_0x651c14[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](respondWithResult(_0x129a98,null))['catch'](handleError(_0x129a98,null));};exports[_0x53f6('0x45')]=function(_0x20c8f0,_0x5c2069){return respondWithRpcPromise('ChatQueues',_0x20c8f0[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](findById(_0x20c8f0[_0x53f6('0x18')]['id']))[_0x53f6('0x14')](respondWithResult(_0x5c2069,null))['catch'](handleError(_0x5c2069,null));};exports[_0x53f6('0x46')]=function(_0x40c9c6,_0x4ee265){return respondWithRpcPromise(_0x53f6('0x47'),_0x40c9c6[_0x53f6('0x13')],routingClient)['then'](respondWithResult(_0x4ee265,null))[_0x53f6('0x19')](handleError(_0x4ee265,null));};exports[_0x53f6('0x48')]=function(_0x18757f,_0x1e117e){return respondWithRpcPromise(_0x53f6('0x47'),_0x18757f['query'],routingClient)[_0x53f6('0x14')](findById(_0x18757f[_0x53f6('0x18')]['id']))[_0x53f6('0x14')](respondWithResult(_0x1e117e,null))[_0x53f6('0x19')](handleError(_0x1e117e,null));};exports['mailAccounts']=function(_0x197633,_0x4cf44d){return respondWithRpcPromise('MailAccounts',_0x197633[_0x53f6('0x13')],mailClient)[_0x53f6('0x14')](respondWithResult(_0x4cf44d,null))[_0x53f6('0x19')](handleError(_0x4cf44d,null));};exports[_0x53f6('0x49')]=function(_0xa65b1a,_0x160485){return respondWithRpcPromise(_0x53f6('0x4a'),_0xa65b1a[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](respondWithResult(_0x160485,null))[_0x53f6('0x19')](handleError(_0x160485,null));};exports[_0x53f6('0x4b')]=function(_0x5e0c6f,_0x2ab457){return respondWithRpcPromise('OpenchannelQueues',_0x5e0c6f[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](findById(_0x5e0c6f['params']['id']))[_0x53f6('0x14')](respondWithResult(_0x2ab457,null))['catch'](handleError(_0x2ab457,null));};exports[_0x53f6('0x4c')]=function(_0x33ab4a,_0x205b51){return respondWithRpcPromise(_0x53f6('0x4d'),_0x33ab4a['query'],routingClient)[_0x53f6('0x14')](respondWithResult(_0x205b51,null))[_0x53f6('0x19')](handleError(_0x205b51,null));};exports[_0x53f6('0x4e')]=function(_0x5a8a61,_0x1ae51e){return respondWithRpcPromise(_0x53f6('0x4d'),_0x5a8a61[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](findById(_0x5a8a61[_0x53f6('0x18')]['id']))[_0x53f6('0x14')](respondWithResult(_0x1ae51e,null))[_0x53f6('0x19')](handleError(_0x1ae51e,null));};exports[_0x53f6('0x4f')]=function(_0x418554,_0x3853be){return respondWithRpcPromise(_0x53f6('0x50'),_0x418554[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](respondWithResult(_0x3853be,null))['catch'](handleError(_0x3853be,null));};exports[_0x53f6('0x51')]=function(_0x3f80ec,_0x4d1637){return respondWithRpcPromise(_0x53f6('0x50'),_0x3f80ec[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](findById(_0x3f80ec[_0x53f6('0x18')]['id']))['then'](respondWithResult(_0x4d1637,null))[_0x53f6('0x19')](handleError(_0x4d1637,null));};exports['faxAccounts']=function(_0x365211,_0x266dbf){return respondWithRpcPromise('FaxAccounts',_0x365211[_0x53f6('0x13')])[_0x53f6('0x14')](respondWithResult(_0x266dbf,null))['catch'](handleError(_0x266dbf,null));};exports[_0x53f6('0x52')]=function(_0x238a32,_0xa7135b){return respondWithRpcPromise(_0x53f6('0x53'),_0x238a32[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](respondWithResult(_0xa7135b,null))[_0x53f6('0x19')](handleError(_0xa7135b,null));};exports[_0x53f6('0x54')]=function(_0x430495,_0x554c69){return respondWithRpcPromise(_0x53f6('0x55'),_0x430495[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](respondWithResult(_0x554c69,null))[_0x53f6('0x19')](handleError(_0x554c69,null));};exports[_0x53f6('0x56')]=function(_0xb13603,_0x4994c8){return respondWithRpcPromise(_0x53f6('0x57'),_0xb13603[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](respondWithResult(_0x4994c8,null))[_0x53f6('0x19')](handleError(_0x4994c8,null));};exports[_0x53f6('0x58')]=function(_0x27ca71,_0x442fbc){return respondWithRpcPromise(_0x53f6('0x59'),_0x27ca71[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](respondWithResult(_0x442fbc,null))[_0x53f6('0x19')](handleError(_0x442fbc,null));};exports[_0x53f6('0x5a')]=function(_0x30c6a4,_0x74db19){return respondWithRpcPromise(_0x53f6('0x5b'),_0x30c6a4[_0x53f6('0x13')],routingClient)[_0x53f6('0x14')](respondWithResult(_0x74db19,null))['catch'](handleError(_0x74db19,null));};exports['queueNotify']=function(_0x3baab4){return function(_0x58ae4e,_0x4ed739){var _0x1f5b12,_0x25f8b7;var _0xa776e6=_['capitalize'](_0x3baab4);var _0xf0f535=_0x3baab4===_0x53f6('0x5c')?_0x53f6('0x5d'):_0x53f6('0x5e');return db[_0xa776e6+_0x53f6('0x5f')]['findOne']({'raw':!![],'where':{'id':_0x58ae4e[_0x53f6('0x18')]['id']}})[_0x53f6('0x14')](function(_0x4376ef){if(_[_0x53f6('0x10')](_0x4376ef)){throw new Error(_0xa776e6+_0x53f6('0x60'));}_0x1f5b12=_0x4376ef;return db[_0xa776e6+_0x53f6('0x61')][_0x53f6('0x62')]({'where':{'id':_0x58ae4e['body'][_0x53f6('0x63')]},'include':[{'model':db[_0xa776e6+_0x53f6('0x64')],'as':_0x53f6('0x64')},{'model':db[_0xa776e6+_0xf0f535],'as':_0x53f6('0x5e')}]});})['then'](function(_0xa04fbb){if(_[_0x53f6('0x10')](_0xa04fbb)){throw new Error(_0xa776e6+_0x53f6('0x65'));}_0x25f8b7=_0xa04fbb;return _0xa04fbb['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x53f6('0x14')](function(){var _0x7f38d7={'uniqueid':_0x3baab4+'.'+_0x25f8b7['id']+'.'+_0x25f8b7[_0x53f6('0x64')]['id'],'FromUserId':_0x58ae4e[_0x53f6('0x2d')]['id'],'type':'queue'};_0x7f38d7[_0xa776e6+_0x53f6('0x66')]=_0x25f8b7['id'];_0x7f38d7[_0xa776e6+_0x53f6('0x67')]=_0x25f8b7[_0x53f6('0x64')]['id'];_0x7f38d7['From'+_0xa776e6+_0xf0f535+'Id']=_0x25f8b7[_0x53f6('0x5e')]['id'];_0x7f38d7['To'+_0xa776e6+_0x53f6('0x68')]=_0x1f5b12['id'];return db[_0xa776e6+_0x53f6('0x69')][_0x53f6('0x6a')](_0x7f38d7);})[_0x53f6('0x14')](function(){return respondWithRpcPromise(_0x53f6('0x6b'),{'channel':_0x3baab4,'interaction':_0x25f8b7[_0x53f6('0x64')],'message':_0x25f8b7,'account':_0x25f8b7[_0x53f6('0x5e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x53f6('0x6c'),'appdata':_0x1f5b12[_0x53f6('0xf')]+','+(_0x25f8b7[_0x53f6('0x5e')][_0x53f6('0x6d')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x4ed739,null))['catch'](handleError(_0x4ed739,null));};};exports[_0x53f6('0x6e')]=function(_0x219638,_0x3ab6d2){var _0x20132b,_0x22fbb1;if(_[_0x53f6('0x10')](_0x219638[_0x53f6('0x2b')][_0x53f6('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1e7abf=_0x219638[_0x53f6('0x2b')][_0x53f6('0x6f')];var _0x52c7c3=_[_0x53f6('0x70')](_0x1e7abf);var _0x55c176=_0x1e7abf===_0x53f6('0x5c')?_0x53f6('0x5d'):'Account';return db[_0x53f6('0x71')][_0x53f6('0x62')]({'raw':!![],'where':{'id':_0x219638['params']['id'],'role':_0x53f6('0x39')}})[_0x53f6('0x14')](function(_0x2014a3){if(_[_0x53f6('0x10')](_0x2014a3)){throw new Error('Agent\x20not\x20found');}_0x20132b=_0x2014a3;return db[_0x52c7c3+'Message'][_0x53f6('0x62')]({'where':{'id':_0x219638[_0x53f6('0x2b')][_0x53f6('0x63')]},'include':[{'model':db[_0x52c7c3+'Interaction'],'as':'Interaction'},{'model':db[_0x52c7c3+_0x55c176],'as':_0x53f6('0x5e')}]});})[_0x53f6('0x14')](function(_0x4a4c35){if(_[_0x53f6('0x10')](_0x4a4c35)){throw new Error(_0x52c7c3+_0x53f6('0x65'));}_0x22fbb1=_0x4a4c35;return _0x4a4c35[_0x53f6('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x53f6('0x14')](function(){var _0x2e6bd7={'uniqueid':_0x1e7abf+'.'+_0x22fbb1['id']+'.'+_0x22fbb1[_0x53f6('0x64')]['id'],'FromUserId':_0x219638[_0x53f6('0x2d')]['id'],'type':_0x53f6('0x6c'),'ToUserId':_0x20132b['id']};_0x2e6bd7[_0x52c7c3+'MessageId']=_0x22fbb1['id'];_0x2e6bd7[_0x52c7c3+_0x53f6('0x67')]=_0x22fbb1[_0x53f6('0x64')]['id'];_0x2e6bd7[_0x53f6('0x73')+_0x52c7c3+_0x55c176+'Id']=_0x22fbb1[_0x53f6('0x5e')]['id'];return db[_0x52c7c3+_0x53f6('0x69')]['create'](_0x2e6bd7);})[_0x53f6('0x14')](function(){return respondWithRpcPromise('Start',{'channel':_0x1e7abf,'interaction':_0x22fbb1[_0x53f6('0x64')],'message':_0x22fbb1,'account':_0x22fbb1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x53f6('0x39'),'appdata':_0x20132b[_0x53f6('0xf')]+','+(_0x22fbb1[_0x53f6('0x5e')][_0x53f6('0x74')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x53f6('0x14')](respondWithResult(_0x3ab6d2,null))['catch'](handleError(_0x3ab6d2,null));}; \ No newline at end of file +var _0x60a4=['MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','InteractionId','bluebird','moment','util','../../mysqldb','api','client','http','request','message','result','catch','status','json','sendStatus','stack','name','send','isNil','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','then','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','params','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','user','interaction','hasOwnProperty'];(function(_0x3dd90a,_0x6a02e5){var _0xed78d8=function(_0x13c3cd){while(--_0x13c3cd){_0x3dd90a['push'](_0x3dd90a['shift']());}};_0xed78d8(++_0x6a02e5);}(_0x60a4,0x129));var _0x460a=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x60a4[_0x527824];return _0xc8b8ed;};'use strict';var BPromise=require(_0x460a('0x0'));var moment=require(_0x460a('0x1'));var _=require('lodash');var util=require(_0x460a('0x2'));var db=require(_0x460a('0x3'))['db'];var logger=require('../../config/logger')(_0x460a('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x460a('0x5')][_0x460a('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x460a('0x5')][_0x460a('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x5871d2,_0x41c3be,_0x22f0ae){return new BPromise(function(_0x248c9e,_0x30fbf6){var _0x198f43=_0x22f0ae?_0x22f0ae:amiClient;return _0x198f43[_0x460a('0x7')](_0x5871d2,_0x41c3be)['then'](function(_0x22a858){if(_0x22a858['error']){if(_0x22a858['error']['code']===0x1f4){return _0x30fbf6(_0x22a858['error'][_0x460a('0x8')]);}return _0x248c9e(_0x22a858['error'][_0x460a('0x8')]);}else{_0x248c9e(_0x22a858[_0x460a('0x9')]);}})[_0x460a('0xa')](function(_0x97552a){_0x30fbf6(_0x97552a);});});}function respondWithResult(_0x4fa6c3,_0x4cdd82){_0x4cdd82=_0x4cdd82||0xc8;return function(_0x8773b5){if(_0x8773b5){return _0x4fa6c3[_0x460a('0xb')](_0x4cdd82)[_0x460a('0xc')](_0x8773b5);}return _0x4fa6c3[_0x460a('0xd')](0x194);};}function handleError(_0x128b8a,_0x43c35b){_0x43c35b=_0x43c35b||0x1f4;return function(_0x3b0f79){logger['error'](_0x3b0f79[_0x460a('0xe')]);if(_0x3b0f79[_0x460a('0xf')]){delete _0x3b0f79['name'];}_0x128b8a['status'](_0x43c35b)[_0x460a('0x10')](_0x3b0f79);};}function findById(_0x2185ce){return function(_0x3b4c67){if(!_[_0x460a('0x11')](_0x2185ce)&&!_['isNil'](_0x3b4c67)&&!_['isNil'](_0x3b4c67['rows'])){return _['find'](_0x3b4c67['rows'],function(_0x148d9f){return _0x148d9f['id']==_0x2185ce;});}return null;};}exports[_0x460a('0x12')]=function(_0x9973c6,_0x129744){return respondWithRpcPromise(_0x460a('0x13'),_0x9973c6[_0x460a('0x14')])['then'](respondWithResult(_0x129744,null))[_0x460a('0xa')](handleError(_0x129744,null));};exports[_0x460a('0x15')]=function(_0x578aee,_0x523eb7){return respondWithRpcPromise(_0x460a('0x16'),_[_0x460a('0x17')](_0x578aee['query'],_0x578aee['params']))[_0x460a('0x18')](respondWithResult(_0x523eb7,null))[_0x460a('0xa')](handleError(_0x523eb7,null));};exports[_0x460a('0x19')]=function(_0x1c3379,_0x18248a){return respondWithRpcPromise(_0x460a('0x1a'),_[_0x460a('0x17')](_0x1c3379[_0x460a('0x14')],_0x1c3379['params']))[_0x460a('0x18')](respondWithResult(_0x18248a,null))[_0x460a('0xa')](handleError(_0x18248a,null));};exports[_0x460a('0x1b')]=function(_0x18a2fd,_0x2e284e){return respondWithRpcPromise('VoiceQueues',_0x18a2fd[_0x460a('0x14')])[_0x460a('0x18')](respondWithResult(_0x2e284e,null))['catch'](handleError(_0x2e284e,null));};exports[_0x460a('0x1c')]=function(_0x30d9eb,_0x198afa){return respondWithRpcPromise('VoiceQueues',_0x30d9eb[_0x460a('0x14')])[_0x460a('0x18')](findById(_0x30d9eb['params']['id']))[_0x460a('0x18')](respondWithResult(_0x198afa,null))['catch'](handleError(_0x198afa,null));};exports[_0x460a('0x1d')]=function(_0x48a357,_0x133f7f){return respondWithRpcPromise(_0x460a('0x1e'),_['merge'](_0x48a357[_0x460a('0x14')],_0x48a357[_0x460a('0x1f')]))['then'](respondWithResult(_0x133f7f,null))[_0x460a('0xa')](handleError(_0x133f7f,null));};exports[_0x460a('0x20')]=function(_0x2c2b65,_0xc3116a){return respondWithRpcPromise('VoiceQueuesChannels',_0x2c2b65[_0x460a('0x14')])[_0x460a('0x18')](respondWithResult(_0xc3116a,null))[_0x460a('0xa')](handleError(_0xc3116a,null));};exports[_0x460a('0x21')]=function(_0x3ec726,_0x56f286){return respondWithRpcPromise(_0x460a('0x22'),_[_0x460a('0x17')](_0x3ec726[_0x460a('0x14')],_0x3ec726[_0x460a('0x1f')]))[_0x460a('0x18')](respondWithResult(_0x56f286,null))[_0x460a('0xa')](handleError(_0x56f286,null));};exports[_0x460a('0x23')]=function(_0x196927,_0x16c11e){return respondWithRpcPromise(_0x460a('0x24'),_[_0x460a('0x17')](_0x196927['query'],_0x196927[_0x460a('0x1f')]))[_0x460a('0x18')](respondWithResult(_0x16c11e,null))[_0x460a('0xa')](handleError(_0x16c11e,null));};exports['voiceQueuesChannelRedirect']=function(_0x22011b,_0x1aa3d5){return respondWithRpcPromise(_0x460a('0x25'),_['merge'](_0x22011b[_0x460a('0x14')],_0x22011b[_0x460a('0x1f')]))['then'](respondWithResult(_0x1aa3d5,null))[_0x460a('0xa')](handleError(_0x1aa3d5,null));};exports[_0x460a('0x26')]=function(_0x3bd939,_0x13dd4c){return respondWithRpcPromise(_0x460a('0x27'),_0x3bd939['query'])[_0x460a('0x18')](respondWithResult(_0x13dd4c,null))['catch'](handleError(_0x13dd4c,null));};exports[_0x460a('0x28')]=function(_0x41ba33,_0x2c2114){return respondWithRpcPromise(_0x460a('0x29'),_0x41ba33[_0x460a('0x14')])[_0x460a('0x18')](respondWithResult(_0x2c2114,null))[_0x460a('0xa')](handleError(_0x2c2114,null));};exports['agents']=function(_0x1bd2d2,_0x2f8223){var _0x2d6252;return respondWithRpcPromise(_0x460a('0x2a'),_0x1bd2d2[_0x460a('0x14')])['then'](function(_0x49183a){_0x2d6252=_0x49183a;return respondWithRpcPromise(_0x460a('0x2a'),_0x1bd2d2[_0x460a('0x14')],routingClient);})[_0x460a('0x18')](function(_0xe95077){return _[_0x460a('0x17')]({},_0xe95077,_0x2d6252);})[_0x460a('0x18')](respondWithResult(_0x2f8223,null))[_0x460a('0xa')](handleError(_0x2f8223,null));};exports[_0x460a('0x2b')]=function(_0x538506,_0x52d8bf){if(_0x538506['body']&&_0x538506[_0x460a('0x2c')]['interaction']&&_0x538506[_0x460a('0x2d')]&&_0x538506[_0x460a('0x2d')][_0x460a('0xf')]){for(var _0x6a140a in _0x538506[_0x460a('0x2c')]['interaction']){if(_0x538506[_0x460a('0x2c')][_0x460a('0x2e')][_0x460a('0x2f')](_0x6a140a)){db[_0x460a('0x30')][_0x460a('0x31')]({'where':{'channel':_0x6a140a,'membername':_0x538506[_0x460a('0x2d')][_0x460a('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x538506[_0x460a('0x2c')][_0x460a('0x2e')][_0x6a140a]&&_0x538506[_0x460a('0x2c')][_0x460a('0x2e')][_0x6a140a]['length']?{'$notIn':_0x538506['body'][_0x460a('0x2e')][_0x6a140a]}:{'$ne':null}}})[_0x460a('0x18')](function(_0x4599bf){var _0x112c12=moment()[_0x460a('0x32')](_0x460a('0x33'));for(var _0x20e653=0x0,_0xee37f0=_0x4599bf[_0x460a('0x34')];_0x20e653<_0xee37f0;_0x20e653+=0x1){_0x4599bf[_0x20e653]['updateAttributes']({'exitAt':_0x112c12});}});for(var _0x47c617=0x0;_0x47c617<_0x538506[_0x460a('0x2c')][_0x460a('0x2e')][_0x6a140a][_0x460a('0x34')];_0x47c617+=0x1){db[_0x460a('0x30')][_0x460a('0x35')]({'where':{'channel':_0x6a140a,'membername':_0x538506[_0x460a('0x2d')][_0x460a('0xf')],'type':_0x460a('0x36'),'uniqueid':_0x538506[_0x460a('0x2c')]['interaction'][_0x6a140a][_0x47c617],'exitAt':null},'defaults':{'channel':_0x6a140a,'membername':_0x538506['user']['name'],'interface':_['isNil'](_0x538506[_0x460a('0x2d')][_0x460a('0x37')])?util[_0x460a('0x32')](_0x460a('0x38'),_0x538506['user'][_0x460a('0xf')]):_0x538506['user'][_0x460a('0x37')],'type':_0x460a('0x36'),'enterAt':moment()[_0x460a('0x32')](_0x460a('0x33')),'role':_0x460a('0x39'),'internal':_0x538506[_0x460a('0x2d')][_0x460a('0x3a')],'uniqueid':_0x538506['body'][_0x460a('0x2e')][_0x6a140a][_0x47c617]}});}}}}return respondWithRpcPromise(_0x460a('0x3b'),{'id':_0x538506[_0x460a('0x1f')]['id'],'capacity':_0x538506['body'][_0x460a('0x3c')]},routingClient)[_0x460a('0x18')](respondWithResult(_0x52d8bf,null))[_0x460a('0xa')](handleError(_0x52d8bf,null));};exports[_0x460a('0x3d')]=function(_0x4036a2,_0xab2a2c){return respondWithRpcPromise(_0x460a('0x3e'),_0x4036a2['query'])[_0x460a('0x18')](respondWithResult(_0xab2a2c,null))[_0x460a('0xa')](handleError(_0xab2a2c,null));};exports[_0x460a('0x3f')]=function(_0x524089,_0x4fa530){return respondWithRpcPromise('Trunks',_0x524089[_0x460a('0x14')])[_0x460a('0x18')](respondWithResult(_0x4fa530,null))[_0x460a('0xa')](handleError(_0x4fa530,null));};exports[_0x460a('0x40')]=function(_0x713cbe,_0x553b65){return respondWithRpcPromise(_0x460a('0x41'),_0x713cbe[_0x460a('0x14')])['then'](respondWithResult(_0x553b65,null))[_0x460a('0xa')](handleError(_0x553b65,null));};exports[_0x460a('0x42')]=function(_0x40a8fa,_0x3ca834){return respondWithRpcPromise(_0x460a('0x43'),_0x40a8fa['query'],routingClient)['then'](respondWithResult(_0x3ca834,null))[_0x460a('0xa')](handleError(_0x3ca834,null));};exports[_0x460a('0x44')]=function(_0x2d8ac4,_0x984097){return respondWithRpcPromise(_0x460a('0x43'),_0x2d8ac4[_0x460a('0x14')],routingClient)[_0x460a('0x18')](findById(_0x2d8ac4[_0x460a('0x1f')]['id']))[_0x460a('0x18')](respondWithResult(_0x984097,null))[_0x460a('0xa')](handleError(_0x984097,null));};exports[_0x460a('0x45')]=function(_0x1c3812,_0x1f6669){return respondWithRpcPromise(_0x460a('0x46'),_0x1c3812[_0x460a('0x14')],routingClient)['then'](respondWithResult(_0x1f6669,null))[_0x460a('0xa')](handleError(_0x1f6669,null));};exports['showMailQueues']=function(_0x42380c,_0xa77d95){return respondWithRpcPromise('MailQueues',_0x42380c[_0x460a('0x14')],routingClient)[_0x460a('0x18')](findById(_0x42380c[_0x460a('0x1f')]['id']))[_0x460a('0x18')](respondWithResult(_0xa77d95,null))[_0x460a('0xa')](handleError(_0xa77d95,null));};exports[_0x460a('0x47')]=function(_0x378520,_0x3f4a04){return respondWithRpcPromise('MailAccounts',_0x378520[_0x460a('0x14')],mailClient)[_0x460a('0x18')](respondWithResult(_0x3f4a04,null))['catch'](handleError(_0x3f4a04,null));};exports['openchannelQueues']=function(_0x5311c8,_0x30226c){return respondWithRpcPromise(_0x460a('0x48'),_0x5311c8[_0x460a('0x14')],routingClient)[_0x460a('0x18')](respondWithResult(_0x30226c,null))['catch'](handleError(_0x30226c,null));};exports[_0x460a('0x49')]=function(_0x3e785b,_0x4b526e){return respondWithRpcPromise(_0x460a('0x48'),_0x3e785b[_0x460a('0x14')],routingClient)[_0x460a('0x18')](findById(_0x3e785b['params']['id']))[_0x460a('0x18')](respondWithResult(_0x4b526e,null))[_0x460a('0xa')](handleError(_0x4b526e,null));};exports[_0x460a('0x4a')]=function(_0x379132,_0x3af45e){return respondWithRpcPromise('SmsQueues',_0x379132[_0x460a('0x14')],routingClient)['then'](respondWithResult(_0x3af45e,null))[_0x460a('0xa')](handleError(_0x3af45e,null));};exports[_0x460a('0x4b')]=function(_0x1bae8d,_0x2ce2da){return respondWithRpcPromise(_0x460a('0x4c'),_0x1bae8d[_0x460a('0x14')],routingClient)[_0x460a('0x18')](findById(_0x1bae8d['params']['id']))[_0x460a('0x18')](respondWithResult(_0x2ce2da,null))[_0x460a('0xa')](handleError(_0x2ce2da,null));};exports['faxQueues']=function(_0x4559e3,_0x667c76){return respondWithRpcPromise('FaxQueues',_0x4559e3[_0x460a('0x14')],routingClient)[_0x460a('0x18')](respondWithResult(_0x667c76,null))[_0x460a('0xa')](handleError(_0x667c76,null));};exports[_0x460a('0x4d')]=function(_0x147050,_0x30bfd8){return respondWithRpcPromise(_0x460a('0x4e'),_0x147050[_0x460a('0x14')],routingClient)[_0x460a('0x18')](findById(_0x147050['params']['id']))[_0x460a('0x18')](respondWithResult(_0x30bfd8,null))[_0x460a('0xa')](handleError(_0x30bfd8,null));};exports[_0x460a('0x4f')]=function(_0x299941,_0x1a1ab3){return respondWithRpcPromise(_0x460a('0x50'),_0x299941[_0x460a('0x14')])[_0x460a('0x18')](respondWithResult(_0x1a1ab3,null))[_0x460a('0xa')](handleError(_0x1a1ab3,null));};exports['chatQueuesWaitingInteractions']=function(_0x2d615e,_0x34e22c){return respondWithRpcPromise(_0x460a('0x51'),_0x2d615e['query'],routingClient)[_0x460a('0x18')](respondWithResult(_0x34e22c,null))['catch'](handleError(_0x34e22c,null));};exports[_0x460a('0x52')]=function(_0x3698a2,_0x2f062a){return respondWithRpcPromise(_0x460a('0x53'),_0x3698a2[_0x460a('0x14')],routingClient)[_0x460a('0x18')](respondWithResult(_0x2f062a,null))['catch'](handleError(_0x2f062a,null));};exports[_0x460a('0x54')]=function(_0x1a8eaf,_0x1fa0e9){return respondWithRpcPromise(_0x460a('0x55'),_0x1a8eaf['query'],routingClient)[_0x460a('0x18')](respondWithResult(_0x1fa0e9,null))[_0x460a('0xa')](handleError(_0x1fa0e9,null));};exports[_0x460a('0x56')]=function(_0x90daea,_0x53f4c1){return respondWithRpcPromise(_0x460a('0x57'),_0x90daea[_0x460a('0x14')],routingClient)[_0x460a('0x18')](respondWithResult(_0x53f4c1,null))[_0x460a('0xa')](handleError(_0x53f4c1,null));};exports[_0x460a('0x58')]=function(_0x96ff7,_0x5be65f){return respondWithRpcPromise(_0x460a('0x59'),_0x96ff7['query'],routingClient)[_0x460a('0x18')](respondWithResult(_0x5be65f,null))[_0x460a('0xa')](handleError(_0x5be65f,null));};exports[_0x460a('0x5a')]=function(_0x2b2cd1){return function(_0x54b4cc,_0x36a954){var _0x5c5f97,_0x47beac;var _0x21e39f=_[_0x460a('0x5b')](_0x2b2cd1);var _0x3f9fb2=_0x2b2cd1===_0x460a('0x5c')?_0x460a('0x5d'):_0x460a('0x5e');return db[_0x21e39f+'Queue'][_0x460a('0x5f')]({'raw':!![],'where':{'id':_0x54b4cc[_0x460a('0x1f')]['id']}})[_0x460a('0x18')](function(_0x1fea3f){if(_[_0x460a('0x11')](_0x1fea3f)){throw new Error(_0x21e39f+_0x460a('0x60'));}_0x5c5f97=_0x1fea3f;return db[_0x21e39f+'Message'][_0x460a('0x5f')]({'where':{'id':_0x54b4cc[_0x460a('0x2c')][_0x460a('0x61')]},'include':[{'model':db[_0x21e39f+_0x460a('0x62')],'as':_0x460a('0x62')},{'model':db[_0x21e39f+_0x3f9fb2],'as':_0x460a('0x5e')}]});})[_0x460a('0x18')](function(_0x3104b9){if(_['isNil'](_0x3104b9)){throw new Error(_0x21e39f+_0x460a('0x63'));}_0x47beac=_0x3104b9;return _0x3104b9[_0x460a('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0x460a('0x18')](function(){var _0x4af156={'uniqueid':_0x2b2cd1+'.'+_0x47beac['id']+'.'+_0x47beac[_0x460a('0x62')]['id'],'FromUserId':_0x54b4cc['user']['id'],'type':_0x460a('0x65')};_0x4af156[_0x21e39f+_0x460a('0x66')]=_0x47beac['id'];_0x4af156[_0x21e39f+'InteractionId']=_0x47beac[_0x460a('0x62')]['id'];_0x4af156[_0x460a('0x67')+_0x21e39f+_0x3f9fb2+'Id']=_0x47beac[_0x460a('0x5e')]['id'];_0x4af156['To'+_0x21e39f+_0x460a('0x68')]=_0x5c5f97['id'];return db[_0x21e39f+_0x460a('0x69')][_0x460a('0x6a')](_0x4af156);})[_0x460a('0x18')](function(){return respondWithRpcPromise(_0x460a('0x6b'),{'channel':_0x2b2cd1,'interaction':_0x47beac[_0x460a('0x62')],'message':_0x47beac,'account':_0x47beac['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x460a('0x65'),'appdata':_0x5c5f97[_0x460a('0xf')]+','+(_0x47beac[_0x460a('0x5e')]['queueTransferTimeout']||0x12c),'interval':_0x460a('0x6c')}]},routingClient);})[_0x460a('0x18')](respondWithResult(_0x36a954,null))[_0x460a('0xa')](handleError(_0x36a954,null));};};exports[_0x460a('0x6d')]=function(_0x576fcd,_0xebfa34){var _0x82ed7c,_0x1cf114;if(_['isNil'](_0x576fcd[_0x460a('0x2c')][_0x460a('0x6e')])){throw new Error(_0x460a('0x6f'));}var _0x3098b9=_0x576fcd[_0x460a('0x2c')][_0x460a('0x6e')];var _0x554e54=_['capitalize'](_0x3098b9);var _0x1d2acb=_0x3098b9===_0x460a('0x5c')?_0x460a('0x5d'):'Account';return db[_0x460a('0x70')]['findOne']({'raw':!![],'where':{'id':_0x576fcd[_0x460a('0x1f')]['id'],'role':_0x460a('0x39')}})[_0x460a('0x18')](function(_0x5a0047){if(_['isNil'](_0x5a0047)){throw new Error(_0x460a('0x71'));}_0x82ed7c=_0x5a0047;return db[_0x554e54+'Message'][_0x460a('0x5f')]({'where':{'id':_0x576fcd['body'][_0x460a('0x61')]},'include':[{'model':db[_0x554e54+_0x460a('0x62')],'as':_0x460a('0x62')},{'model':db[_0x554e54+_0x1d2acb],'as':_0x460a('0x5e')}]});})['then'](function(_0x54adfb){if(_[_0x460a('0x11')](_0x54adfb)){throw new Error(_0x554e54+_0x460a('0x63'));}_0x1cf114=_0x54adfb;return _0x54adfb[_0x460a('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0x460a('0x18')](function(){var _0xbb92ef={'uniqueid':_0x3098b9+'.'+_0x1cf114['id']+'.'+_0x1cf114['Interaction']['id'],'FromUserId':_0x576fcd[_0x460a('0x2d')]['id'],'type':_0x460a('0x65'),'ToUserId':_0x82ed7c['id']};_0xbb92ef[_0x554e54+_0x460a('0x66')]=_0x1cf114['id'];_0xbb92ef[_0x554e54+_0x460a('0x72')]=_0x1cf114[_0x460a('0x62')]['id'];_0xbb92ef['From'+_0x554e54+_0x1d2acb+'Id']=_0x1cf114[_0x460a('0x5e')]['id'];return db[_0x554e54+'TransferReport'][_0x460a('0x6a')](_0xbb92ef);})[_0x460a('0x18')](function(){return respondWithRpcPromise(_0x460a('0x6b'),{'channel':_0x3098b9,'interaction':_0x1cf114[_0x460a('0x62')],'message':_0x1cf114,'account':_0x1cf114[_0x460a('0x5e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x460a('0x39'),'appdata':_0x82ed7c['name']+','+(_0x1cf114['Account']['agentTransferTimeout']||0x12c),'interval':_0x460a('0x6c')}]},routingClient);})[_0x460a('0x18')](respondWithResult(_0xebfa34,null))[_0x460a('0xa')](handleError(_0xebfa34,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0da9304..872aac6 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 _0x2a0b=['index','/:id','show','/:id/run','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated'];(function(_0x584fec,_0x5d7620){var _0x41ca85=function(_0x1aa465){while(--_0x1aa465){_0x584fec['push'](_0x584fec['shift']());}};_0x41ca85(++_0x5d7620);}(_0x2a0b,0x13b));var _0xb2a0=function(_0x5f0f2f,_0x4a31d4){_0x5f0f2f=_0x5f0f2f-0x0;var _0x169ed6=_0x2a0b[_0x5f0f2f];return _0x169ed6;};'use strict';var multer=require(_0xb2a0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb2a0('0x1'));var express=require(_0xb2a0('0x2'));var router=express[_0xb2a0('0x3')]();var auth=require(_0xb2a0('0x4'));var interaction=require(_0xb2a0('0x5'));var config=require('../../config/environment');var controller=require(_0xb2a0('0x6'));router[_0xb2a0('0x7')]('/',auth[_0xb2a0('0x8')](),controller[_0xb2a0('0x9')]);router[_0xb2a0('0x7')](_0xb2a0('0xa'),auth[_0xb2a0('0x8')](),controller[_0xb2a0('0xb')]);router[_0xb2a0('0x7')](_0xb2a0('0xc'),auth['isAuthenticated'](),controller['run']);router['post']('/',auth[_0xb2a0('0x8')](),controller[_0xb2a0('0xd')]);router[_0xb2a0('0xe')](_0xb2a0('0xa'),auth['isAuthenticated'](),controller[_0xb2a0('0xf')]);router['delete'](_0xb2a0('0xa'),auth[_0xb2a0('0x8')](),controller[_0xb2a0('0x10')]);module[_0xb2a0('0x11')]=router; \ No newline at end of file +var _0xc128=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post','create','put','destroy'];(function(_0x30780e,_0x537b34){var _0x5b9129=function(_0xcf4cd1){while(--_0xcf4cd1){_0x30780e['push'](_0x30780e['shift']());}};_0x5b9129(++_0x537b34);}(_0xc128,0x19e));var _0x8c12=function(_0x234656,_0xe4af1f){_0x234656=_0x234656-0x0;var _0x2a8cea=_0xc128[_0x234656];return _0x2a8cea;};'use strict';var multer=require(_0x8c12('0x0'));var util=require(_0x8c12('0x1'));var path=require('path');var timeout=require(_0x8c12('0x2'));var express=require(_0x8c12('0x3'));var router=express['Router']();var auth=require(_0x8c12('0x4'));var interaction=require(_0x8c12('0x5'));var config=require(_0x8c12('0x6'));var controller=require(_0x8c12('0x7'));router[_0x8c12('0x8')]('/',auth[_0x8c12('0x9')](),controller['index']);router[_0x8c12('0x8')](_0x8c12('0xa'),auth[_0x8c12('0x9')](),controller[_0x8c12('0xb')]);router[_0x8c12('0x8')](_0x8c12('0xc'),auth[_0x8c12('0x9')](),controller[_0x8c12('0xd')]);router[_0x8c12('0xe')]('/',auth['isAuthenticated'](),controller[_0x8c12('0xf')]);router[_0x8c12('0x10')](_0x8c12('0xa'),auth[_0x8c12('0x9')](),controller['update']);router['delete'](_0x8c12('0xa'),auth[_0x8c12('0x9')](),controller[_0x8c12('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 8e084ba..8fd4f9f 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 _0x13c5=['hours','minutes','days','csv','pdf','xlsx','custom','default','STRING','TEXT','sequelize','DATE','ENUM','years','quarters','months'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x13c5,0x7a));var _0x513c=function(_0x50f066,_0x3e884c){_0x50f066=_0x50f066-0x0;var _0x501a58=_0x13c5[_0x50f066];return _0x501a58;};'use strict';var Sequelize=require(_0x513c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x513c('0x1')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x513c('0x2')](_0x513c('0x3'),_0x513c('0x4'),_0x513c('0x5'),'weeks','days',_0x513c('0x6'),_0x513c('0x7')),'allowNull':![],'defaultValue':_0x513c('0x8')},'output':{'type':Sequelize[_0x513c('0x2')](_0x513c('0x9'),_0x513c('0xa'),_0x513c('0xb')),'allowNull':![],'defaultValue':_0x513c('0x9')},'type':{'type':Sequelize['ENUM'](_0x513c('0xc'),_0x513c('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x513c('0xe')]},'cc':{'type':Sequelize[_0x513c('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x26d1=['BOOLEAN','DATE','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','sequelize','STRING'];(function(_0x2d8864,_0x34171a){var _0x435a6a=function(_0x3deecd){while(--_0x3deecd){_0x2d8864['push'](_0x2d8864['shift']());}};_0x435a6a(++_0x34171a);}(_0x26d1,0x8e));var _0x126d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x26d1[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x126d('0x0'));module['exports']={'name':{'type':Sequelize[_0x126d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x126d('0x1')]},'active':{'type':Sequelize[_0x126d('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x126d('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x126d('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x126d('0x4')](_0x126d('0x5'),_0x126d('0x6'),_0x126d('0x7'),_0x126d('0x8'),'days',_0x126d('0x9'),_0x126d('0xa')),'allowNull':![],'defaultValue':_0x126d('0xb')},'output':{'type':Sequelize[_0x126d('0x4')](_0x126d('0xc'),_0x126d('0xd'),_0x126d('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x126d('0x4')](_0x126d('0xf'),_0x126d('0x10')),'allowNull':![],'defaultValue':_0x126d('0xf')},'sendMail':{'type':Sequelize[_0x126d('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x126d('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x126d('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 84f9773..000c9c6 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 _0x757a=['../../config/utils','sendStatus','status','json','count','offset','limit','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','Schedule','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','type','key','VIRTUAL','field','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0xb11f29,_0x49556b){var _0x18c309=function(_0x273ab3){while(--_0x273ab3){_0xb11f29['push'](_0xb11f29['shift']());}};_0x18c309(++_0x49556b);}(_0x757a,0xde));var _0xa757=function(_0x440429,_0x3dcebe){_0x440429=_0x440429-0x0;var _0x626684=_0x757a[_0x440429];return _0x626684;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require(_0xa757('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5958c2,_0x56acfb){_0x56acfb=_0x56acfb||0xcc;return function(_0x4db68e){if(_0x4db68e){return _0x5958c2[_0xa757('0x16')](_0x56acfb);}return _0x5958c2['status'](_0x56acfb)['end']();};}function respondWithResult(_0x2ed0d2,_0x513b1f){_0x513b1f=_0x513b1f||0xc8;return function(_0x481508){if(_0x481508){return _0x2ed0d2[_0xa757('0x17')](_0x513b1f)[_0xa757('0x18')](_0x481508);}};}function respondWithFilteredResult(_0x355f0a,_0x4a0c38){return function(_0x86abd){if(_0x86abd){var _0x31cfd2=_0x86abd[_0xa757('0x19')],_0xf12b68=_0x4a0c38['offset'],_0x2f7947=_0x4a0c38[_0xa757('0x1a')]+_0x4a0c38[_0xa757('0x1b')],_0x185011;if(_0x2f7947>=_0x31cfd2){_0x2f7947=_0x31cfd2;_0x185011=0xc8;}else{_0x185011=0xce;}_0x355f0a[_0xa757('0x17')](_0x185011);return _0x355f0a['set']('Content-Range',_0xf12b68+'-'+_0x2f7947+'/'+_0x31cfd2)[_0xa757('0x18')](_0x86abd);}return null;};}function patchUpdates(_0x468d45){return function(_0x1bd14c){try{jsonpatch[_0xa757('0x1c')](_0x1bd14c,_0x468d45,!![]);}catch(_0x27f4ba){return BPromise[_0xa757('0x1d')](_0x27f4ba);}return _0x1bd14c['save']();};}function saveUpdates(_0x58954,_0x4fec52){return function(_0x32c2a1){if(_0x32c2a1){return _0x32c2a1[_0xa757('0x1e')](_0x58954)[_0xa757('0x1f')](function(_0x2c9ec6){return _0x2c9ec6;});}return null;};}function removeEntity(_0x4d598c,_0x5638c7){return function(_0x40ec48){if(_0x40ec48){return _0x40ec48[_0xa757('0x20')]()[_0xa757('0x1f')](function(){var _0x8d121f=_0x40ec48[_0xa757('0x21')]({'plain':!![]});var _0x40562f=_0xa757('0x22');return db[_0xa757('0x23')][_0xa757('0x20')]({'where':{'type':_0x40562f,'resourceId':_0x8d121f['id']}})['then'](function(){return _0x40ec48;});})[_0xa757('0x1f')](function(){_0x4d598c['status'](0xcc)[_0xa757('0x24')]();});}};}function handleEntityNotFound(_0x47903b,_0x40551d){return function(_0x3859ce){if(!_0x3859ce){_0x47903b[_0xa757('0x16')](0x194);}return _0x3859ce;};}function handleError(_0x4d58a4,_0x2b19d5){_0x2b19d5=_0x2b19d5||0x1f4;return function(_0xcd98bd){logger[_0xa757('0x25')](_0xcd98bd[_0xa757('0x26')]);if(_0xcd98bd['name']){delete _0xcd98bd[_0xa757('0x27')];}_0x4d58a4['status'](_0x2b19d5)['send'](_0xcd98bd);};}exports['index']=function(_0x4f8de2,_0xfdf69d){var _0x596ae2={},_0x2208f9={},_0x3bc24c={'count':0x0,'rows':[]};var _0x55c5f8=db[_0xa757('0x28')]['rawAttributes'];_0x2208f9[_0xa757('0x29')]=_[_0xa757('0x2a')](_0x55c5f8);_0x2208f9['query']=_[_0xa757('0x2a')](_0x4f8de2['query']);_0x2208f9[_0xa757('0x2b')]=_[_0xa757('0x2c')](_0x2208f9[_0xa757('0x29')],_0x2208f9[_0xa757('0x2d')]);_0x596ae2[_0xa757('0x2e')]=_[_0xa757('0x2c')](_0x2208f9[_0xa757('0x29')],qs[_0xa757('0x2f')](_0x4f8de2[_0xa757('0x2d')][_0xa757('0x2f')]));_0x596ae2[_0xa757('0x2e')]=_0x596ae2[_0xa757('0x2e')][_0xa757('0x30')]?_0x596ae2[_0xa757('0x2e')]:_0x2208f9[_0xa757('0x29')];if(!_0x4f8de2[_0xa757('0x2d')][_0xa757('0x31')](_0xa757('0x32'))){_0x596ae2[_0xa757('0x1b')]=qs[_0xa757('0x1b')](_0x4f8de2[_0xa757('0x2d')][_0xa757('0x1b')]);_0x596ae2[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x4f8de2['query'][_0xa757('0x1a')]);}_0x596ae2[_0xa757('0x33')]=qs[_0xa757('0x34')](_0x4f8de2[_0xa757('0x2d')][_0xa757('0x34')]);_0x596ae2['where']=qs[_0xa757('0x2b')](_[_0xa757('0x35')](_0x4f8de2[_0xa757('0x2d')],_0x2208f9[_0xa757('0x2b')]));if(_0x4f8de2[_0xa757('0x2d')][_0xa757('0x36')]){_0x596ae2['where']=_[_0xa757('0x37')](_0x596ae2[_0xa757('0x38')],{'$or':_[_0xa757('0x39')](_0x55c5f8,function(_0xc34409){if(_0xc34409[_0xa757('0x3a')][_0xa757('0x3b')]!==_0xa757('0x3c')){var _0x3e12a5={};_0x3e12a5[_0xc34409[_0xa757('0x3d')]]={'$like':'%'+_0x4f8de2['query'][_0xa757('0x36')]+'%'};return _0x3e12a5;}})});}_0x596ae2=_[_0xa757('0x37')]({},_0x596ae2,_0x4f8de2[_0xa757('0x3e')]);var _0x35c15a={'where':_0x596ae2[_0xa757('0x38')]};return db[_0xa757('0x28')]['count'](_0x35c15a)[_0xa757('0x1f')](function(_0x6d77ed){_0x3bc24c['count']=_0x6d77ed;if(_0x4f8de2['query'][_0xa757('0x3f')]){_0x596ae2[_0xa757('0x40')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x596ae2);})[_0xa757('0x1f')](function(_0x1725a2){_0x3bc24c[_0xa757('0x41')]=_0x1725a2;return _0x3bc24c;})['then'](respondWithFilteredResult(_0xfdf69d,_0x596ae2))[_0xa757('0x42')](handleError(_0xfdf69d,null));};exports[_0xa757('0x43')]=function(_0x26802c,_0x1ba399){var _0x104e6b={'raw':![],'where':{'id':_0x26802c[_0xa757('0x44')]['id']}},_0x4c6639={};_0x4c6639['model']=_['keys'](db[_0xa757('0x28')][_0xa757('0x45')]);_0x4c6639[_0xa757('0x2d')]=_[_0xa757('0x2a')](_0x26802c[_0xa757('0x2d')]);_0x4c6639['filters']=_['intersection'](_0x4c6639[_0xa757('0x29')],_0x4c6639[_0xa757('0x2d')]);_0x104e6b[_0xa757('0x2e')]=_[_0xa757('0x2c')](_0x4c6639[_0xa757('0x29')],qs[_0xa757('0x2f')](_0x26802c['query'][_0xa757('0x2f')]));_0x104e6b[_0xa757('0x2e')]=_0x104e6b['attributes'][_0xa757('0x30')]?_0x104e6b['attributes']:_0x4c6639[_0xa757('0x29')];if(_0x26802c[_0xa757('0x2d')]['includeAll']){_0x104e6b[_0xa757('0x40')]=[{'all':!![]}];}_0x104e6b=_[_0xa757('0x37')]({},_0x104e6b,_0x26802c['options']);return db[_0xa757('0x28')][_0xa757('0x46')](_0x104e6b)[_0xa757('0x1f')](handleEntityNotFound(_0x1ba399,null))[_0xa757('0x1f')](respondWithResult(_0x1ba399,null))['catch'](handleError(_0x1ba399,null));};exports[_0xa757('0x47')]=function(_0x1be3bb,_0x450815){return db[_0xa757('0x28')]['create'](_0x1be3bb[_0xa757('0x48')],{})['then'](function(_0x50c131){var _0x2acf88=_0x1be3bb[_0xa757('0x49')][_0xa757('0x21')]({'plain':!![]});if(!_0x2acf88)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2acf88[_0xa757('0x4a')]==='user'){var _0x2ed63f=_0x50c131[_0xa757('0x21')]({'plain':!![]});var _0x265793=_0xa757('0x22');return db[_0xa757('0x4b')][_0xa757('0x46')]({'where':{'name':_0x265793,'userProfileId':_0x2acf88[_0xa757('0x4c')]},'raw':!![]})[_0xa757('0x1f')](function(_0x581e95){if(_0x581e95&&_0x581e95[_0xa757('0x4d')]===0x0){return db[_0xa757('0x23')][_0xa757('0x47')]({'name':_0x2ed63f[_0xa757('0x27')],'resourceId':_0x2ed63f['id'],'type':_0x581e95[_0xa757('0x27')],'sectionId':_0x581e95['id']},{})[_0xa757('0x1f')](function(){return _0x50c131;});}else{return _0x50c131;}})[_0xa757('0x42')](function(_0x2c5b3c){logger[_0xa757('0x25')](_0xa757('0x4e'),_0x2c5b3c);throw _0x2c5b3c;});}return _0x50c131;})[_0xa757('0x1f')](respondWithResult(_0x450815,0xc9))[_0xa757('0x42')](handleError(_0x450815,null));};exports[_0xa757('0x1e')]=function(_0x354ad5,_0x388573){if(_0x354ad5[_0xa757('0x48')]['id']){delete _0x354ad5['body']['id'];}return db[_0xa757('0x28')]['find']({'where':{'id':_0x354ad5[_0xa757('0x44')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x388573,null))[_0xa757('0x1f')](saveUpdates(_0x354ad5[_0xa757('0x48')],null))['then'](respondWithResult(_0x388573,null))[_0xa757('0x42')](handleError(_0x388573,null));};exports[_0xa757('0x20')]=function(_0x8614f9,_0x980e1){return db['Schedule'][_0xa757('0x46')]({'where':{'id':_0x8614f9[_0xa757('0x44')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x980e1,null))[_0xa757('0x1f')](removeEntity(_0x980e1,null))[_0xa757('0x42')](handleError(_0x980e1,null));};exports[_0xa757('0x4f')]=function(_0x55ad28,_0x485100,_0x5d21c1){var _0x5a49d0=require(_0xa757('0x50'));return db[_0xa757('0x28')][_0xa757('0x46')]({'where':{'id':_0x55ad28[_0xa757('0x44')]['id']},'raw':!![]})[_0xa757('0x1f')](handleEntityNotFound(_0x485100,null))[_0xa757('0x1f')](function(){_0x5a49d0['run'](_0x55ad28[_0xa757('0x44')]['id']);})[_0xa757('0x1f')](respondWithStatusCode(_0x485100,null))[_0xa757('0x42')](handleError(_0x485100,null));}; \ No newline at end of file +var _0x9ffd=['show','params','keys','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','name','send','Schedule','rawAttributes','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch'];(function(_0x406b82,_0x2447bb){var _0x44437e=function(_0x457456){while(--_0x457456){_0x406b82['push'](_0x406b82['shift']());}};_0x44437e(++_0x2447bb);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xe6ac9c,_0x48c2ca){_0xe6ac9c=_0xe6ac9c-0x0;var _0x5905f9=_0x9ffd[_0xe6ac9c];return _0x5905f9;};'use strict';var pdf=require(_0xd9ff('0x0'));var emlformat=require(_0xd9ff('0x1'));var rimraf=require(_0xd9ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9ff('0x3'));var rp=require(_0xd9ff('0x4'));var moment=require(_0xd9ff('0x5'));var BPromise=require(_0xd9ff('0x6'));var Mustache=require('mustache');var util=require(_0xd9ff('0x7'));var path=require(_0xd9ff('0x8'));var sox=require('sox');var csv=require(_0xd9ff('0x9'));var ejs=require(_0xd9ff('0xa'));var fs=require('fs');var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x9'));var querystring=require(_0xd9ff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xd9ff('0x11'));var logger=require(_0xd9ff('0x12'))(_0xd9ff('0x13'));var utils=require(_0xd9ff('0x14'));var config=require(_0xd9ff('0x15'));var db=require(_0xd9ff('0x16'))['db'];function respondWithStatusCode(_0x1885da,_0x1c2a16){_0x1c2a16=_0x1c2a16||0xcc;return function(_0x47d842){if(_0x47d842){return _0x1885da['sendStatus'](_0x1c2a16);}return _0x1885da[_0xd9ff('0x17')](_0x1c2a16)[_0xd9ff('0x18')]();};}function respondWithResult(_0x415c58,_0x350a5d){_0x350a5d=_0x350a5d||0xc8;return function(_0x12c39a){if(_0x12c39a){return _0x415c58['status'](_0x350a5d)[_0xd9ff('0x19')](_0x12c39a);}};}function respondWithFilteredResult(_0x3c9ace,_0x5c1a28){return function(_0xf14c9f){if(_0xf14c9f){var _0x5db010=_0xf14c9f[_0xd9ff('0x1a')],_0x4ffe54=_0x5c1a28['offset'],_0x547e28=_0x5c1a28[_0xd9ff('0x1b')]+_0x5c1a28[_0xd9ff('0x1c')],_0x4c5718;if(_0x547e28>=_0x5db010){_0x547e28=_0x5db010;_0x4c5718=0xc8;}else{_0x4c5718=0xce;}_0x3c9ace[_0xd9ff('0x17')](_0x4c5718);return _0x3c9ace[_0xd9ff('0x1d')](_0xd9ff('0x1e'),_0x4ffe54+'-'+_0x547e28+'/'+_0x5db010)[_0xd9ff('0x19')](_0xf14c9f);}return null;};}function patchUpdates(_0x3ccf15){return function(_0x128588){try{jsonpatch[_0xd9ff('0x1f')](_0x128588,_0x3ccf15,!![]);}catch(_0x1f028f){return BPromise[_0xd9ff('0x20')](_0x1f028f);}return _0x128588[_0xd9ff('0x21')]();};}function saveUpdates(_0x46a6ab,_0x4c8740){return function(_0x4cf8ec){if(_0x4cf8ec){return _0x4cf8ec[_0xd9ff('0x22')](_0x46a6ab)[_0xd9ff('0x23')](function(_0x4eea4d){return _0x4eea4d;});}return null;};}function removeEntity(_0x588151,_0x5ab7b6){return function(_0x4b1477){if(_0x4b1477){return _0x4b1477[_0xd9ff('0x24')]()['then'](function(){var _0x4c486a=_0x4b1477[_0xd9ff('0x25')]({'plain':!![]});var _0x291f52=_0xd9ff('0x26');return db[_0xd9ff('0x27')][_0xd9ff('0x24')]({'where':{'type':_0x291f52,'resourceId':_0x4c486a['id']}})['then'](function(){return _0x4b1477;});})['then'](function(){_0x588151[_0xd9ff('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca906,_0x4d86fe){return function(_0x285002){if(!_0x285002){_0x3ca906['sendStatus'](0x194);}return _0x285002;};}function handleError(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0x1f4;return function(_0x2138b4){logger[_0xd9ff('0x28')](_0x2138b4['stack']);if(_0x2138b4[_0xd9ff('0x29')]){delete _0x2138b4[_0xd9ff('0x29')];}_0x10cbdd[_0xd9ff('0x17')](_0x159e56)[_0xd9ff('0x2a')](_0x2138b4);};}exports['index']=function(_0x1d3684,_0x3792d9){var _0x44b5a7={},_0x45fb63={},_0x263d3a={'count':0x0,'rows':[]};var _0xe516e2=db[_0xd9ff('0x2b')][_0xd9ff('0x2c')];_0x45fb63[_0xd9ff('0x2d')]=_['keys'](_0xe516e2);_0x45fb63[_0xd9ff('0x2e')]=_['keys'](_0x1d3684[_0xd9ff('0x2e')]);_0x45fb63[_0xd9ff('0x2f')]=_[_0xd9ff('0x30')](_0x45fb63['model'],_0x45fb63[_0xd9ff('0x2e')]);_0x44b5a7[_0xd9ff('0x31')]=_[_0xd9ff('0x30')](_0x45fb63[_0xd9ff('0x2d')],qs['fields'](_0x1d3684[_0xd9ff('0x2e')]['fields']));_0x44b5a7[_0xd9ff('0x31')]=_0x44b5a7[_0xd9ff('0x31')][_0xd9ff('0x32')]?_0x44b5a7[_0xd9ff('0x31')]:_0x45fb63[_0xd9ff('0x2d')];if(!_0x1d3684[_0xd9ff('0x2e')][_0xd9ff('0x33')](_0xd9ff('0x34'))){_0x44b5a7[_0xd9ff('0x1c')]=qs[_0xd9ff('0x1c')](_0x1d3684[_0xd9ff('0x2e')][_0xd9ff('0x1c')]);_0x44b5a7[_0xd9ff('0x1b')]=qs[_0xd9ff('0x1b')](_0x1d3684['query'][_0xd9ff('0x1b')]);}_0x44b5a7[_0xd9ff('0x35')]=qs[_0xd9ff('0x36')](_0x1d3684['query'][_0xd9ff('0x36')]);_0x44b5a7['where']=qs[_0xd9ff('0x2f')](_['pick'](_0x1d3684[_0xd9ff('0x2e')],_0x45fb63['filters']));if(_0x1d3684[_0xd9ff('0x2e')][_0xd9ff('0x37')]){_0x44b5a7[_0xd9ff('0x38')]=_['merge'](_0x44b5a7['where'],{'$or':_['map'](_0xe516e2,function(_0x7ac3d1){if(_0x7ac3d1[_0xd9ff('0x39')][_0xd9ff('0x3a')]!==_0xd9ff('0x3b')){var _0x39f079={};_0x39f079[_0x7ac3d1[_0xd9ff('0x3c')]]={'$like':'%'+_0x1d3684['query']['filter']+'%'};return _0x39f079;}})});}_0x44b5a7=_['merge']({},_0x44b5a7,_0x1d3684[_0xd9ff('0x3d')]);var _0x252edc={'where':_0x44b5a7[_0xd9ff('0x38')]};return db[_0xd9ff('0x2b')]['count'](_0x252edc)[_0xd9ff('0x23')](function(_0x5b8e17){_0x263d3a[_0xd9ff('0x1a')]=_0x5b8e17;if(_0x1d3684[_0xd9ff('0x2e')][_0xd9ff('0x3e')]){_0x44b5a7[_0xd9ff('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0xd9ff('0x40')](_0x44b5a7);})[_0xd9ff('0x23')](function(_0x4961a7){_0x263d3a[_0xd9ff('0x41')]=_0x4961a7;return _0x263d3a;})[_0xd9ff('0x23')](respondWithFilteredResult(_0x3792d9,_0x44b5a7))[_0xd9ff('0x42')](handleError(_0x3792d9,null));};exports[_0xd9ff('0x43')]=function(_0x1fe44d,_0x1cc848){var _0x57c496={'raw':![],'where':{'id':_0x1fe44d[_0xd9ff('0x44')]['id']}},_0x294c89={};_0x294c89[_0xd9ff('0x2d')]=_[_0xd9ff('0x45')](db[_0xd9ff('0x2b')]['rawAttributes']);_0x294c89[_0xd9ff('0x2e')]=_[_0xd9ff('0x45')](_0x1fe44d[_0xd9ff('0x2e')]);_0x294c89['filters']=_['intersection'](_0x294c89[_0xd9ff('0x2d')],_0x294c89[_0xd9ff('0x2e')]);_0x57c496[_0xd9ff('0x31')]=_[_0xd9ff('0x30')](_0x294c89[_0xd9ff('0x2d')],qs[_0xd9ff('0x46')](_0x1fe44d['query'][_0xd9ff('0x46')]));_0x57c496[_0xd9ff('0x31')]=_0x57c496['attributes'][_0xd9ff('0x32')]?_0x57c496[_0xd9ff('0x31')]:_0x294c89[_0xd9ff('0x2d')];if(_0x1fe44d[_0xd9ff('0x2e')][_0xd9ff('0x3e')]){_0x57c496['include']=[{'all':!![]}];}_0x57c496=_['merge']({},_0x57c496,_0x1fe44d['options']);return db[_0xd9ff('0x2b')]['find'](_0x57c496)[_0xd9ff('0x23')](handleEntityNotFound(_0x1cc848,null))[_0xd9ff('0x23')](respondWithResult(_0x1cc848,null))[_0xd9ff('0x42')](handleError(_0x1cc848,null));};exports['create']=function(_0x396736,_0x153f09){return db['Schedule'][_0xd9ff('0x47')](_0x396736[_0xd9ff('0x48')],{})[_0xd9ff('0x23')](function(_0x316854){var _0x559101=_0x396736[_0xd9ff('0x49')]['get']({'plain':!![]});if(!_0x559101)throw new Error(_0xd9ff('0x4a'));if(_0x559101['role']===_0xd9ff('0x49')){var _0x3d91e6=_0x316854[_0xd9ff('0x25')]({'plain':!![]});var _0x1760c3=_0xd9ff('0x26');return db['UserProfileSection'][_0xd9ff('0x4b')]({'where':{'name':_0x1760c3,'userProfileId':_0x559101[_0xd9ff('0x4c')]},'raw':!![]})[_0xd9ff('0x23')](function(_0xa3f86d){if(_0xa3f86d&&_0xa3f86d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3d91e6[_0xd9ff('0x29')],'resourceId':_0x3d91e6['id'],'type':_0xa3f86d[_0xd9ff('0x29')],'sectionId':_0xa3f86d['id']},{})[_0xd9ff('0x23')](function(){return _0x316854;});}else{return _0x316854;}})['catch'](function(_0x136bac){logger[_0xd9ff('0x28')](_0xd9ff('0x4d'),_0x136bac);throw _0x136bac;});}return _0x316854;})[_0xd9ff('0x23')](respondWithResult(_0x153f09,0xc9))[_0xd9ff('0x42')](handleError(_0x153f09,null));};exports[_0xd9ff('0x22')]=function(_0x43a8ae,_0x1e1364){if(_0x43a8ae[_0xd9ff('0x48')]['id']){delete _0x43a8ae[_0xd9ff('0x48')]['id'];}return db[_0xd9ff('0x2b')][_0xd9ff('0x4b')]({'where':{'id':_0x43a8ae[_0xd9ff('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e1364,null))[_0xd9ff('0x23')](saveUpdates(_0x43a8ae['body'],null))[_0xd9ff('0x23')](respondWithResult(_0x1e1364,null))['catch'](handleError(_0x1e1364,null));};exports[_0xd9ff('0x24')]=function(_0x49623d,_0xc82610){return db['Schedule'][_0xd9ff('0x4b')]({'where':{'id':_0x49623d['params']['id']}})[_0xd9ff('0x23')](handleEntityNotFound(_0xc82610,null))['then'](removeEntity(_0xc82610,null))[_0xd9ff('0x42')](handleError(_0xc82610,null));};exports['run']=function(_0x3eb87b,_0x103c99,_0x122c9d){var _0x35bd9a=require('../../config/schedule');return db[_0xd9ff('0x2b')][_0xd9ff('0x4b')]({'where':{'id':_0x3eb87b[_0xd9ff('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x103c99,null))[_0xd9ff('0x23')](function(){_0x35bd9a[_0xd9ff('0x4e')](_0x3eb87b[_0xd9ff('0x44')]['id']);})[_0xd9ff('0x23')](respondWithStatusCode(_0x103c99,null))[_0xd9ff('0x42')](handleError(_0x103c99,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 2571cb1..cb357cc 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 _0x5c5c=['exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1b54cc,_0x842121){var _0x349717=function(_0x472a76){while(--_0x472a76){_0x1b54cc['push'](_0x1b54cc['shift']());}};_0x349717(++_0x842121);}(_0x5c5c,0x1b4));var _0xc5c5=function(_0x24a66a,_0xba9d6f){_0x24a66a=_0x24a66a-0x0;var _0x19a92e=_0x5c5c[_0x24a66a];return _0x19a92e;};'use strict';var _=require(_0xc5c5('0x0'));var util=require(_0xc5c5('0x1'));var logger=require(_0xc5c5('0x2'))(_0xc5c5('0x3'));var moment=require(_0xc5c5('0x4'));var BPromise=require(_0xc5c5('0x5'));var rp=require(_0xc5c5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5c5('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xc5c5('0x8')]=function(_0x385e2e,_0x477091){return _0x385e2e[_0xc5c5('0x9')](_0xc5c5('0xa'),attributes,{'tableName':_0xc5c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6774=['exports','Schedule','tools_schedules','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./schedule.attributes'];(function(_0x3f1b45,_0x3eced7){var _0x2d7590=function(_0x5b8605){while(--_0x5b8605){_0x3f1b45['push'](_0x3f1b45['shift']());}};_0x2d7590(++_0x3eced7);}(_0x6774,0x1dc));var _0x4677=function(_0x2c41f4,_0x1c63bc){_0x2c41f4=_0x2c41f4-0x0;var _0xcf1d07=_0x6774[_0x2c41f4];return _0xcf1d07;};'use strict';var _=require(_0x4677('0x0'));var util=require(_0x4677('0x1'));var logger=require(_0x4677('0x2'))(_0x4677('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4677('0x4'));var fs=require('fs');var path=require(_0x4677('0x5'));var rimraf=require('rimraf');var config=require(_0x4677('0x6'));var attributes=require(_0x4677('0x7'));module[_0x4677('0x8')]=function(_0xe2b365,_0x1bd6e0){return _0xe2b365['define'](_0x4677('0x9'),attributes,{'tableName':_0x4677('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b604bdd..4f38f39 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 _0x9d3d=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x48b737,_0x1ff6fd){var _0x19be61=function(_0x1309ed){while(--_0x1309ed){_0x48b737['push'](_0x48b737['shift']());}};_0x19be61(++_0x1ff6fd);}(_0x9d3d,0x196));var _0xd9d3=function(_0x2bf898,_0x292429){_0x2bf898=_0x2bf898-0x0;var _0x5aa72e=_0x9d3d[_0x2bf898];return _0x5aa72e;};'use strict';var _=require(_0xd9d3('0x0'));var util=require(_0xd9d3('0x1'));var moment=require(_0xd9d3('0x2'));var BPromise=require(_0xd9d3('0x3'));var rs=require(_0xd9d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd9d3('0x5'));var logger=require(_0xd9d3('0x6'))(_0xd9d3('0x7'));var config=require(_0xd9d3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd9d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30a582,_0x58048a,_0x5053c1){return new BPromise(function(_0x6ec080,_0x351251){return client[_0xd9d3('0xa')](_0x30a582,_0x5053c1)['then'](function(_0x3e2d55){logger[_0xd9d3('0xb')](_0xd9d3('0xc'),_0x58048a,'request\x20sent');logger['debug'](_0xd9d3('0xd'),_0x58048a,_0xd9d3('0xe'),JSON[_0xd9d3('0xf')](_0x3e2d55));if(_0x3e2d55[_0xd9d3('0x10')]){if(_0x3e2d55['error'][_0xd9d3('0x11')]===0x1f4){logger[_0xd9d3('0x10')](_0xd9d3('0xc'),_0x58048a,_0x3e2d55[_0xd9d3('0x10')][_0xd9d3('0x12')]);return _0x351251(_0x3e2d55['error']['message']);}logger['error'](_0xd9d3('0xc'),_0x58048a,_0x3e2d55[_0xd9d3('0x10')]['message']);return _0x6ec080(_0x3e2d55['error']['message']);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x58048a,'request\x20sent');_0x6ec080(_0x3e2d55[_0xd9d3('0x13')][_0xd9d3('0x12')]);}})[_0xd9d3('0x14')](function(_0xf146bd){logger['error'](_0xd9d3('0xc'),_0x58048a,_0xf146bd);_0x351251(_0xf146bd);});});} \ No newline at end of file +var _0x5e5b=['code','message','request\x20sent','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','stringify','error'];(function(_0x44d85d,_0x477ae2){var _0x55f365=function(_0x84b597){while(--_0x84b597){_0x44d85d['push'](_0x44d85d['shift']());}};_0x55f365(++_0x477ae2);}(_0x5e5b,0x17e));var _0xb5e5=function(_0x32d54e,_0x42e0c2){_0x32d54e=_0x32d54e-0x0;var _0x293913=_0x5e5b[_0x32d54e];return _0x293913;};'use strict';var _=require(_0xb5e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5e5('0x1'));var fs=require('fs');var Redis=require(_0xb5e5('0x2'));var db=require(_0xb5e5('0x3'))['db'];var utils=require(_0xb5e5('0x4'));var logger=require(_0xb5e5('0x5'))(_0xb5e5('0x6'));var config=require(_0xb5e5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb5e5('0x8')][_0xb5e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b98cb,_0x29d719,_0x37dba7){return new BPromise(function(_0x3fd743,_0x2704a2){return client[_0xb5e5('0xa')](_0x5b98cb,_0x37dba7)[_0xb5e5('0xb')](function(_0xd592f0){logger[_0xb5e5('0xc')](_0xb5e5('0xd'),_0x29d719,'request\x20sent');logger[_0xb5e5('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x29d719,'request\x20sent',JSON[_0xb5e5('0xf')](_0xd592f0));if(_0xd592f0['error']){if(_0xd592f0[_0xb5e5('0x10')][_0xb5e5('0x11')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x29d719,_0xd592f0['error'][_0xb5e5('0x12')]);return _0x2704a2(_0xd592f0[_0xb5e5('0x10')]['message']);}logger[_0xb5e5('0x10')](_0xb5e5('0xd'),_0x29d719,_0xd592f0[_0xb5e5('0x10')]['message']);return _0x3fd743(_0xd592f0[_0xb5e5('0x10')][_0xb5e5('0x12')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x29d719,_0xb5e5('0x13'));_0x3fd743(_0xd592f0[_0xb5e5('0x14')][_0xb5e5('0x12')]);}})['catch'](function(_0x52dc11){logger['error'](_0xb5e5('0xd'),_0x29d719,_0x52dc11);_0x2704a2(_0x52dc11);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 72f888b..68a4b27 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 _0x4458=['describe','/:id','show','/:id/download','download','post','create','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated'];(function(_0x3c4433,_0x40c93b){var _0x1ca64c=function(_0x15fea4){while(--_0x15fea4){_0x3c4433['push'](_0x3c4433['shift']());}};_0x1ca64c(++_0x40c93b);}(_0x4458,0xe6));var _0x8445=function(_0x3a5e31,_0x3fdf58){_0x3a5e31=_0x3a5e31-0x0;var _0x4d4d79=_0x4458[_0x3a5e31];return _0x4d4d79;};'use strict';var multer=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var path=require(_0x8445('0x2'));var timeout=require(_0x8445('0x3'));var express=require(_0x8445('0x4'));var router=express['Router']();var auth=require(_0x8445('0x5'));var interaction=require(_0x8445('0x6'));var config=require(_0x8445('0x7'));var controller=require(_0x8445('0x8'));router[_0x8445('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8445('0x9')](_0x8445('0xa'),auth[_0x8445('0xb')](),controller[_0x8445('0xc')]);router['get'](_0x8445('0xd'),auth[_0x8445('0xb')](),controller[_0x8445('0xe')]);router[_0x8445('0x9')](_0x8445('0xf'),auth[_0x8445('0xb')](),controller[_0x8445('0x10')]);router[_0x8445('0x11')]('/',auth[_0x8445('0xb')](),controller[_0x8445('0x12')]);router[_0x8445('0x13')](_0x8445('0xd'),auth[_0x8445('0xb')](),controller[_0x8445('0x14')]);router['delete'](_0x8445('0xd'),auth[_0x8445('0xb')](),controller['destroy']);module[_0x8445('0x15')]=router; \ No newline at end of file +var _0xcc0d=['create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','/describe','get','/:id','show','download','post'];(function(_0x4874b5,_0x39555b){var _0x5ac2e4=function(_0x1e462c){while(--_0x1e462c){_0x4874b5['push'](_0x4874b5['shift']());}};_0x5ac2e4(++_0x39555b);}(_0xcc0d,0x193));var _0xdcc0=function(_0x53ccf4,_0x4487bb){_0x53ccf4=_0x53ccf4-0x0;var _0x481149=_0xcc0d[_0x53ccf4];return _0x481149;};'use strict';var multer=require(_0xdcc0('0x0'));var util=require(_0xdcc0('0x1'));var path=require(_0xdcc0('0x2'));var timeout=require(_0xdcc0('0x3'));var express=require(_0xdcc0('0x4'));var router=express[_0xdcc0('0x5')]();var auth=require(_0xdcc0('0x6'));var interaction=require(_0xdcc0('0x7'));var config=require(_0xdcc0('0x8'));var controller=require(_0xdcc0('0x9'));router['get']('/',auth[_0xdcc0('0xa')](),controller['index']);router['get'](_0xdcc0('0xb'),auth[_0xdcc0('0xa')](),controller['describe']);router[_0xdcc0('0xc')](_0xdcc0('0xd'),auth[_0xdcc0('0xa')](),controller[_0xdcc0('0xe')]);router[_0xdcc0('0xc')]('/:id/download',auth[_0xdcc0('0xa')](),controller[_0xdcc0('0xf')]);router[_0xdcc0('0x10')]('/',auth[_0xdcc0('0xa')](),controller[_0xdcc0('0x11')]);router[_0xdcc0('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdcc0('0x13')]);router[_0xdcc0('0x14')](_0xdcc0('0xd'),auth[_0xdcc0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c74ee93..d436f45 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 _0xf2ca=['format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0xf2ca[_0x528575];return _0x3063b7;};'use strict';var Sequelize=require(_0xaf2c('0x0'));var moment=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var config=require('../../config/environment');module[_0xaf2c('0x3')]={'format':{'type':Sequelize[_0xaf2c('0x4')],'get':function(){return this[_0xaf2c('0x5')](_0xaf2c('0x6'))?path[_0xaf2c('0x7')](this[_0xaf2c('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xaf2c('0x8')]},'channel':{'type':Sequelize[_0xaf2c('0x8')]},'value':{'type':Sequelize[_0xaf2c('0x8')],'set':function(_0x1f9531){var _0x58351f=_0x1f9531[_0xaf2c('0x9')](/\\/g,'/');this[_0xaf2c('0xa')]('value',_0x58351f);}},'rating':{'type':Sequelize[_0xaf2c('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x439ca3){this['setDataValue'](_0xaf2c('0xc'),moment()[_0xaf2c('0xd')](_0x439ca3,'ms'));this[_0xaf2c('0xa')](_0xaf2c('0xe'),moment());this['setDataValue']('duration',_0x439ca3);}},'startedAt':{'type':Sequelize[_0xaf2c('0xf')],'get':function(){return moment(this[_0xaf2c('0x5')](_0xaf2c('0xc')))[_0xaf2c('0x10')](_0xaf2c('0x11'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xaf2c('0x5')](_0xaf2c('0xe')))[_0xaf2c('0x10')](_0xaf2c('0x11'))[_0xaf2c('0x12')]();}},'createdAt':{'type':Sequelize[_0xaf2c('0xf')],'get':function(){return moment(this[_0xaf2c('0x5')](_0xaf2c('0x13')))[_0xaf2c('0x10')](_0xaf2c('0x11'))[_0xaf2c('0x12')]();}},'updatedAt':{'type':Sequelize[_0xaf2c('0xf')],'get':function(){return moment(this[_0xaf2c('0x5')](_0xaf2c('0x14')))[_0xaf2c('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xaf2c('0x12')]();}}}; \ No newline at end of file +var _0x17ba=['MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format'];(function(_0x40d54d,_0x48c413){var _0x1a2751=function(_0x16e9bd){while(--_0x16e9bd){_0x40d54d['push'](_0x40d54d['shift']());}};_0x1a2751(++_0x48c413);}(_0x17ba,0xab));var _0xa17b=function(_0x48bb1b,_0x176240){_0x48bb1b=_0x48bb1b-0x0;var _0x2c5cd1=_0x17ba[_0x48bb1b];return _0x2c5cd1;};'use strict';var Sequelize=require(_0xa17b('0x0'));var moment=require(_0xa17b('0x1'));var path=require('path');var config=require(_0xa17b('0x2'));module[_0xa17b('0x3')]={'format':{'type':Sequelize[_0xa17b('0x4')],'get':function(){return this[_0xa17b('0x5')](_0xa17b('0x6'))?path[_0xa17b('0x7')](this[_0xa17b('0x5')](_0xa17b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa17b('0x8')]},'channel':{'type':Sequelize[_0xa17b('0x8')]},'value':{'type':Sequelize[_0xa17b('0x8')],'set':function(_0x2e3d43){var _0x1957be=_0x2e3d43[_0xa17b('0x9')](/\\/g,'/');this[_0xa17b('0xa')](_0xa17b('0x6'),_0x1957be);}},'rating':{'type':Sequelize[_0xa17b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa17b('0xb')],'set':function(_0x15bdfc){this['setDataValue'](_0xa17b('0xc'),moment()[_0xa17b('0xd')](_0x15bdfc,'ms'));this[_0xa17b('0xa')](_0xa17b('0xe'),moment());this[_0xa17b('0xa')](_0xa17b('0xf'),_0x15bdfc);}},'startedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this['getDataValue'](_0xa17b('0xc')))[_0xa17b('0x11')](_0xa17b('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0xe')))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xa17b('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0x14')))['format'](_0xa17b('0x12'))[_0xa17b('0x13')]();}},'updatedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')]('updatedAt'))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 006d86d..5718f9d 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 _0x0611=['Not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','ScreenRecording','rawAttributes','model','differenceBy','keys','format','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','key','VIRTUAL','merge','includeAll','include','show','options','find','create','catch','body','duration','createdAt','closedAt','params','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','ScreenRecording\x20not\x20found','filename','extname','unlink','message'];(function(_0x1d1a72,_0x592116){var _0x3c790a=function(_0x20abe7){while(--_0x20abe7){_0x1d1a72['push'](_0x1d1a72['shift']());}};_0x3c790a(++_0x592116);}(_0x0611,0x11e));var _0x1061=function(_0x133eb4,_0x2cf8ca){_0x133eb4=_0x133eb4-0x0;var _0x3d54d8=_0x0611[_0x133eb4];return _0x3d54d8;};'use strict';var pdf=require(_0x1061('0x0'));var emlformat=require(_0x1061('0x1'));var rimraf=require(_0x1061('0x2'));var zipdir=require(_0x1061('0x3'));var jsonpatch=require(_0x1061('0x4'));var rp=require(_0x1061('0x5'));var moment=require(_0x1061('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1061('0x7'));var util=require(_0x1061('0x8'));var path=require(_0x1061('0x9'));var sox=require(_0x1061('0xa'));var csv=require(_0x1061('0xb'));var ejs=require(_0x1061('0xc'));var fs=require('fs');var _=require(_0x1061('0xd'));var squel=require(_0x1061('0xe'));var crypto=require(_0x1061('0xf'));var jsforce=require(_0x1061('0x10'));var deskjs=require(_0x1061('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1061('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1061('0x13'));var hardwareService=require(_0x1061('0x14'));var logger=require(_0x1061('0x15'))(_0x1061('0x16'));var utils=require(_0x1061('0x17'));var config=require(_0x1061('0x18'));var db=require(_0x1061('0x19'))['db'];function respondWithStatusCode(_0x472019,_0x31cb83){_0x31cb83=_0x31cb83||0xcc;return function(_0x3e56e3){if(_0x3e56e3){return _0x472019[_0x1061('0x1a')](_0x31cb83);}return _0x472019[_0x1061('0x1b')](_0x31cb83)[_0x1061('0x1c')]();};}function respondWithResult(_0x3a2658,_0x2bcb52){_0x2bcb52=_0x2bcb52||0xc8;return function(_0x464b3a){if(_0x464b3a){return _0x3a2658[_0x1061('0x1b')](_0x2bcb52)[_0x1061('0x1d')](_0x464b3a);}};}function respondWithFilteredResult(_0x59049b,_0x3fb03e){return function(_0x1329c5){if(_0x1329c5){var _0x6a9949=_0x1329c5[_0x1061('0x1e')],_0x59d514=_0x3fb03e['offset'],_0x39b59a=_0x3fb03e[_0x1061('0x1f')]+_0x3fb03e[_0x1061('0x20')],_0x4bbacf;if(_0x39b59a>=_0x6a9949){_0x39b59a=_0x6a9949;_0x4bbacf=0xc8;}else{_0x4bbacf=0xce;}_0x59049b[_0x1061('0x1b')](_0x4bbacf);return _0x59049b[_0x1061('0x21')](_0x1061('0x22'),_0x59d514+'-'+_0x39b59a+'/'+_0x6a9949)['json'](_0x1329c5);}return null;};}function patchUpdates(_0x5724ab){return function(_0x28d673){try{jsonpatch[_0x1061('0x23')](_0x28d673,_0x5724ab,!![]);}catch(_0x402fdf){return BPromise['reject'](_0x402fdf);}return _0x28d673[_0x1061('0x24')]();};}function saveUpdates(_0x5a8115,_0x159e0c){return function(_0x1a0df2){if(_0x1a0df2){return _0x1a0df2[_0x1061('0x25')](_0x5a8115)[_0x1061('0x26')](function(_0x4b0e52){return _0x4b0e52;});}return null;};}function removeEntity(_0x5d35ca,_0x57612c){return function(_0x177997){if(_0x177997){return _0x177997[_0x1061('0x27')]()['then'](function(){_0x5d35ca[_0x1061('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e7f5,_0x24c7f6){return function(_0x28d3cc){if(!_0x28d3cc){_0x18e7f5[_0x1061('0x1a')](0x194);}return _0x28d3cc;};}function handleError(_0x10354e,_0x5f8281){_0x5f8281=_0x5f8281||0x1f4;return function(_0x13d6c1){logger[_0x1061('0x28')](_0x13d6c1[_0x1061('0x29')]);if(_0x13d6c1['name']){delete _0x13d6c1[_0x1061('0x2a')];}_0x10354e[_0x1061('0x1b')](_0x5f8281)[_0x1061('0x2b')](_0x13d6c1);};}exports[_0x1061('0x2c')]=function(_0x22c8ac,_0x16306c){var _0x9eea26={},_0x2f6c16={},_0x4afb31={'count':0x0,'rows':[]};var _0x3ae005=db[_0x1061('0x2d')][_0x1061('0x2e')];_0x2f6c16[_0x1061('0x2f')]=_[_0x1061('0x30')](_[_0x1061('0x31')](_0x3ae005),[_0x1061('0x32')]);_0x2f6c16['query']=_[_0x1061('0x31')](_0x22c8ac['query']);_0x2f6c16[_0x1061('0x33')]=_[_0x1061('0x34')](_0x2f6c16[_0x1061('0x2f')],_0x2f6c16[_0x1061('0x35')]);_0x9eea26[_0x1061('0x36')]=_[_0x1061('0x34')](_0x2f6c16[_0x1061('0x2f')],qs[_0x1061('0x37')](_0x22c8ac[_0x1061('0x35')][_0x1061('0x37')]));_0x9eea26[_0x1061('0x36')]=_0x9eea26['attributes'][_0x1061('0x38')]?_0x9eea26[_0x1061('0x36')]:_0x2f6c16[_0x1061('0x2f')];if(!_0x22c8ac['query'][_0x1061('0x39')]('nolimit')){_0x9eea26[_0x1061('0x20')]=qs[_0x1061('0x20')](_0x22c8ac[_0x1061('0x35')][_0x1061('0x20')]);_0x9eea26['offset']=qs[_0x1061('0x1f')](_0x22c8ac[_0x1061('0x35')][_0x1061('0x1f')]);}_0x9eea26['order']=qs[_0x1061('0x3a')](_0x22c8ac[_0x1061('0x35')][_0x1061('0x3a')]);_0x9eea26[_0x1061('0x3b')]=qs[_0x1061('0x33')](_[_0x1061('0x3c')](_0x22c8ac[_0x1061('0x35')],_0x2f6c16[_0x1061('0x33')]));if(_0x22c8ac['query'][_0x1061('0x3d')]){_0x9eea26[_0x1061('0x3b')]=_['merge'](_0x9eea26['where'],{'$or':_['map'](_0x3ae005,function(_0x18d7f1){if(_0x18d7f1[_0x1061('0x3e')][_0x1061('0x3f')]!==_0x1061('0x40')){var _0x578b62={};_0x578b62[_0x18d7f1['field']]={'$like':'%'+_0x22c8ac[_0x1061('0x35')][_0x1061('0x3d')]+'%'};return _0x578b62;}})});}_0x9eea26=_[_0x1061('0x41')]({},_0x9eea26,_0x22c8ac['options']);var _0x5d7a8e={'where':_0x9eea26[_0x1061('0x3b')]};return db[_0x1061('0x2d')][_0x1061('0x1e')](_0x5d7a8e)['then'](function(_0x2fbd3a){_0x4afb31[_0x1061('0x1e')]=_0x2fbd3a;if(_0x22c8ac[_0x1061('0x35')][_0x1061('0x42')]){_0x9eea26[_0x1061('0x43')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x9eea26);})[_0x1061('0x26')](function(_0x2adf3a){_0x4afb31['rows']=_0x2adf3a;return _0x4afb31;})[_0x1061('0x26')](respondWithFilteredResult(_0x16306c,_0x9eea26))['catch'](handleError(_0x16306c,null));};exports[_0x1061('0x44')]=function(_0x47caf4,_0x4adbd9){var _0x133d46={'raw':![],'where':{'id':_0x47caf4['params']['id']}},_0x24a9fe={};_0x24a9fe[_0x1061('0x2f')]=_[_0x1061('0x31')](db[_0x1061('0x2d')][_0x1061('0x2e')]);_0x24a9fe['query']=_[_0x1061('0x31')](_0x47caf4[_0x1061('0x35')]);_0x24a9fe['filters']=_[_0x1061('0x34')](_0x24a9fe['model'],_0x24a9fe[_0x1061('0x35')]);_0x133d46['attributes']=_[_0x1061('0x34')](_0x24a9fe[_0x1061('0x2f')],qs[_0x1061('0x37')](_0x47caf4[_0x1061('0x35')][_0x1061('0x37')]));_0x133d46[_0x1061('0x36')]=_0x133d46['attributes'][_0x1061('0x38')]?_0x133d46['attributes']:_0x24a9fe[_0x1061('0x2f')];if(_0x47caf4[_0x1061('0x35')][_0x1061('0x42')]){_0x133d46[_0x1061('0x43')]=[{'all':!![]}];}_0x133d46=_[_0x1061('0x41')]({},_0x133d46,_0x47caf4[_0x1061('0x45')]);return db[_0x1061('0x2d')][_0x1061('0x46')](_0x133d46)['then'](handleEntityNotFound(_0x4adbd9,null))[_0x1061('0x26')](respondWithResult(_0x4adbd9,null))['catch'](handleError(_0x4adbd9,null));};exports[_0x1061('0x47')]=function(_0x25d8a2,_0x3a9292){return db[_0x1061('0x2d')][_0x1061('0x47')](_0x25d8a2['body'],{})[_0x1061('0x26')](respondWithResult(_0x3a9292,0xc9))[_0x1061('0x48')](handleError(_0x3a9292,null));};exports[_0x1061('0x25')]=function(_0x1fc155,_0x5ab051){if(_0x1fc155[_0x1061('0x49')]['id']){delete _0x1fc155[_0x1061('0x49')]['id'];}delete _0x1fc155[_0x1061('0x49')][_0x1061('0x4a')];delete _0x1fc155[_0x1061('0x49')][_0x1061('0x4b')];delete _0x1fc155[_0x1061('0x49')][_0x1061('0x4c')];delete _0x1fc155[_0x1061('0x49')]['value'];return db[_0x1061('0x2d')][_0x1061('0x46')]({'where':{'id':_0x1fc155[_0x1061('0x4d')]['id']}})[_0x1061('0x26')](handleEntityNotFound(_0x5ab051,null))[_0x1061('0x26')](saveUpdates(_0x1fc155['body'],null))[_0x1061('0x26')](respondWithResult(_0x5ab051,null))[_0x1061('0x48')](handleError(_0x5ab051,null));};exports[_0x1061('0x27')]=function(_0x55ddcf,_0x18b220){return db[_0x1061('0x2d')]['find']({'where':{'id':_0x55ddcf[_0x1061('0x4d')]['id']}})[_0x1061('0x26')](handleEntityNotFound(_0x18b220,null))[_0x1061('0x26')](removeEntity(_0x18b220,null))[_0x1061('0x48')](handleError(_0x18b220,null));};exports[_0x1061('0x4e')]=function(_0x27cad2,_0x27dca3){return db[_0x1061('0x2d')]['describe']()[_0x1061('0x26')](respondWithResult(_0x27dca3,null))[_0x1061('0x48')](handleError(_0x27dca3,null));};exports[_0x1061('0x4f')]=function(_0xfdc0ff,_0x29044f,_0x3972e4){var _0x52af2b=require(_0x1061('0x50'));var _0x3b4a14=![];var _0x3d24c7={};if(_0xfdc0ff['query'][_0x1061('0x3e')]&&_0xfdc0ff['query'][_0x1061('0x3e')]===_0x1061('0x51')){_0x3d24c7[_0x1061('0x51')]=_0xfdc0ff[_0x1061('0x4d')]['id'];}else{_0x3d24c7['id']=_0xfdc0ff[_0x1061('0x4d')]['id'];}return db[_0x1061('0x2d')]['find']({'where':_0x3d24c7,'attributes':['id',_0x1061('0x52')],'raw':!![]})[_0x1061('0x26')](handleEntityNotFound(_0x29044f,null))[_0x1061('0x26')](function(_0x1c2847){if(_0x1c2847){var _0x37ea43=path[_0x1061('0x53')](config[_0x1061('0x54')],_0x1061('0x55'),_0x1c2847[_0x1061('0x52')]);var _0x3da4ca=util[_0x1061('0x32')]('%s.cypher',_0x37ea43);if(fs[_0x1061('0x56')](_0x3da4ca)){_0x3b4a14=!![];return _0x52af2b[_0x1061('0x57')](_0x3da4ca,_0x37ea43,config[_0x1061('0x58')]['recording'])[_0x1061('0x26')](function(){return _0x1c2847;});}return _0x1c2847;}})[_0x1061('0x26')](function(_0xacc430){if(_0xacc430){var _0x264a32=path['join'](config[_0x1061('0x54')],_0x1061('0x55'),_0xacc430['value']);if(!fs[_0x1061('0x56')](_0x264a32)){throw new db['Sequelize']['ValidationError'](_0x1061('0x59'));}if(_0xacc430['filename']){return _0x29044f[_0x1061('0x4f')](_0x264a32,_0xacc430[_0x1061('0x5a')]+path[_0x1061('0x5b')](_0x264a32),function(){if(_0x3b4a14){fs[_0x1061('0x5c')](_0x264a32);}});}else{return _0x29044f['download'](_0x264a32,function(_0x200607){if(_0x3b4a14){fs[_0x1061('0x5c')](_0x264a32);}});}}})[_0x1061('0x48')](function(_0x5b3fcc){if(_0x5b3fcc[_0x1061('0x5d')]===_0x1061('0x59')){_0x29044f['status'](0x194)[_0x1061('0x2b')](_0x1061('0x5e'));}else{return handleError(_0x29044f,null);}});}; \ No newline at end of file +var _0xba6e=['filter','where','map','type','key','VIRTUAL','merge','count','includeAll','include','rows','catch','show','params','options','find','create','body','duration','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','save','then','destroy','error','stack','name','ScreenRecording','rawAttributes','model','differenceBy','keys','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xba6e,0xe2));var _0xeba6=function(_0x38793a,_0x3cfba4){_0x38793a=_0x38793a-0x0;var _0x1c5f4d=_0xba6e[_0x38793a];return _0x1c5f4d;};'use strict';var pdf=require(_0xeba6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeba6('0x1'));var zipdir=require(_0xeba6('0x2'));var jsonpatch=require(_0xeba6('0x3'));var rp=require(_0xeba6('0x4'));var moment=require(_0xeba6('0x5'));var BPromise=require(_0xeba6('0x6'));var Mustache=require(_0xeba6('0x7'));var util=require(_0xeba6('0x8'));var path=require(_0xeba6('0x9'));var sox=require(_0xeba6('0xa'));var csv=require(_0xeba6('0xb'));var ejs=require(_0xeba6('0xc'));var fs=require('fs');var _=require(_0xeba6('0xd'));var squel=require('squel');var crypto=require(_0xeba6('0xe'));var jsforce=require(_0xeba6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeba6('0xb'));var querystring=require(_0xeba6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeba6('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xeba6('0x12'));var logger=require(_0xeba6('0x13'))('api');var utils=require(_0xeba6('0x14'));var config=require('../../config/environment');var db=require(_0xeba6('0x15'))['db'];function respondWithStatusCode(_0x4326ff,_0x50e65f){_0x50e65f=_0x50e65f||0xcc;return function(_0xfc5283){if(_0xfc5283){return _0x4326ff[_0xeba6('0x16')](_0x50e65f);}return _0x4326ff['status'](_0x50e65f)[_0xeba6('0x17')]();};}function respondWithResult(_0x116ec9,_0x29cf1f){_0x29cf1f=_0x29cf1f||0xc8;return function(_0x454e83){if(_0x454e83){return _0x116ec9[_0xeba6('0x18')](_0x29cf1f)[_0xeba6('0x19')](_0x454e83);}};}function respondWithFilteredResult(_0x2c2efa,_0x213c3c){return function(_0x313dc6){if(_0x313dc6){var _0x46e304=_0x313dc6['count'],_0x3a2556=_0x213c3c['offset'],_0x403f04=_0x213c3c[_0xeba6('0x1a')]+_0x213c3c[_0xeba6('0x1b')],_0x5b5c92;if(_0x403f04>=_0x46e304){_0x403f04=_0x46e304;_0x5b5c92=0xc8;}else{_0x5b5c92=0xce;}_0x2c2efa[_0xeba6('0x18')](_0x5b5c92);return _0x2c2efa[_0xeba6('0x1c')]('Content-Range',_0x3a2556+'-'+_0x403f04+'/'+_0x46e304)[_0xeba6('0x19')](_0x313dc6);}return null;};}function patchUpdates(_0x2fc1f2){return function(_0x19471e){try{jsonpatch['apply'](_0x19471e,_0x2fc1f2,!![]);}catch(_0x461cb4){return BPromise[_0xeba6('0x1d')](_0x461cb4);}return _0x19471e[_0xeba6('0x1e')]();};}function saveUpdates(_0x18721d,_0x55beae){return function(_0x407d02){if(_0x407d02){return _0x407d02['update'](_0x18721d)[_0xeba6('0x1f')](function(_0x5039e9){return _0x5039e9;});}return null;};}function removeEntity(_0x4d6a64,_0x5746a2){return function(_0xd5df99){if(_0xd5df99){return _0xd5df99[_0xeba6('0x20')]()[_0xeba6('0x1f')](function(){_0x4d6a64[_0xeba6('0x18')](0xcc)[_0xeba6('0x17')]();});}};}function handleEntityNotFound(_0x1756af,_0x2071da){return function(_0x17e5fa){if(!_0x17e5fa){_0x1756af[_0xeba6('0x16')](0x194);}return _0x17e5fa;};}function handleError(_0xce1e1c,_0x271b65){_0x271b65=_0x271b65||0x1f4;return function(_0xe49444){logger[_0xeba6('0x21')](_0xe49444[_0xeba6('0x22')]);if(_0xe49444[_0xeba6('0x23')]){delete _0xe49444['name'];}_0xce1e1c[_0xeba6('0x18')](_0x271b65)['send'](_0xe49444);};}exports['index']=function(_0x2edabc,_0x33b749){var _0x55c537={},_0x1146d8={},_0x278844={'count':0x0,'rows':[]};var _0x4d0d17=db[_0xeba6('0x24')][_0xeba6('0x25')];_0x1146d8[_0xeba6('0x26')]=_[_0xeba6('0x27')](_[_0xeba6('0x28')](_0x4d0d17),[_0xeba6('0x29')]);_0x1146d8[_0xeba6('0x2a')]=_[_0xeba6('0x28')](_0x2edabc[_0xeba6('0x2a')]);_0x1146d8[_0xeba6('0x2b')]=_[_0xeba6('0x2c')](_0x1146d8['model'],_0x1146d8[_0xeba6('0x2a')]);_0x55c537[_0xeba6('0x2d')]=_[_0xeba6('0x2c')](_0x1146d8[_0xeba6('0x26')],qs[_0xeba6('0x2e')](_0x2edabc[_0xeba6('0x2a')][_0xeba6('0x2e')]));_0x55c537[_0xeba6('0x2d')]=_0x55c537[_0xeba6('0x2d')][_0xeba6('0x2f')]?_0x55c537[_0xeba6('0x2d')]:_0x1146d8[_0xeba6('0x26')];if(!_0x2edabc[_0xeba6('0x2a')][_0xeba6('0x30')](_0xeba6('0x31'))){_0x55c537[_0xeba6('0x1b')]=qs[_0xeba6('0x1b')](_0x2edabc[_0xeba6('0x2a')][_0xeba6('0x1b')]);_0x55c537[_0xeba6('0x1a')]=qs['offset'](_0x2edabc[_0xeba6('0x2a')][_0xeba6('0x1a')]);}_0x55c537[_0xeba6('0x32')]=qs['sort'](_0x2edabc['query'][_0xeba6('0x33')]);_0x55c537['where']=qs['filters'](_[_0xeba6('0x34')](_0x2edabc[_0xeba6('0x2a')],_0x1146d8[_0xeba6('0x2b')]));if(_0x2edabc[_0xeba6('0x2a')][_0xeba6('0x35')]){_0x55c537[_0xeba6('0x36')]=_['merge'](_0x55c537[_0xeba6('0x36')],{'$or':_[_0xeba6('0x37')](_0x4d0d17,function(_0x8fbd30){if(_0x8fbd30[_0xeba6('0x38')][_0xeba6('0x39')]!==_0xeba6('0x3a')){var _0x41e820={};_0x41e820[_0x8fbd30['field']]={'$like':'%'+_0x2edabc[_0xeba6('0x2a')][_0xeba6('0x35')]+'%'};return _0x41e820;}})});}_0x55c537=_[_0xeba6('0x3b')]({},_0x55c537,_0x2edabc['options']);var _0x2ab773={'where':_0x55c537[_0xeba6('0x36')]};return db[_0xeba6('0x24')][_0xeba6('0x3c')](_0x2ab773)[_0xeba6('0x1f')](function(_0x14fce5){_0x278844['count']=_0x14fce5;if(_0x2edabc[_0xeba6('0x2a')][_0xeba6('0x3d')]){_0x55c537[_0xeba6('0x3e')]=[{'all':!![]}];}return db[_0xeba6('0x24')]['findAll'](_0x55c537);})[_0xeba6('0x1f')](function(_0x23cd2e){_0x278844[_0xeba6('0x3f')]=_0x23cd2e;return _0x278844;})[_0xeba6('0x1f')](respondWithFilteredResult(_0x33b749,_0x55c537))[_0xeba6('0x40')](handleError(_0x33b749,null));};exports[_0xeba6('0x41')]=function(_0x32c869,_0x302c85){var _0x41077d={'raw':![],'where':{'id':_0x32c869[_0xeba6('0x42')]['id']}},_0x3f3c1c={};_0x3f3c1c[_0xeba6('0x26')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f3c1c[_0xeba6('0x2a')]=_[_0xeba6('0x28')](_0x32c869[_0xeba6('0x2a')]);_0x3f3c1c[_0xeba6('0x2b')]=_['intersection'](_0x3f3c1c[_0xeba6('0x26')],_0x3f3c1c[_0xeba6('0x2a')]);_0x41077d[_0xeba6('0x2d')]=_[_0xeba6('0x2c')](_0x3f3c1c['model'],qs['fields'](_0x32c869['query'][_0xeba6('0x2e')]));_0x41077d['attributes']=_0x41077d[_0xeba6('0x2d')][_0xeba6('0x2f')]?_0x41077d[_0xeba6('0x2d')]:_0x3f3c1c[_0xeba6('0x26')];if(_0x32c869['query']['includeAll']){_0x41077d[_0xeba6('0x3e')]=[{'all':!![]}];}_0x41077d=_['merge']({},_0x41077d,_0x32c869[_0xeba6('0x43')]);return db[_0xeba6('0x24')][_0xeba6('0x44')](_0x41077d)[_0xeba6('0x1f')](handleEntityNotFound(_0x302c85,null))[_0xeba6('0x1f')](respondWithResult(_0x302c85,null))[_0xeba6('0x40')](handleError(_0x302c85,null));};exports[_0xeba6('0x45')]=function(_0x298126,_0x282c66){return db[_0xeba6('0x24')][_0xeba6('0x45')](_0x298126['body'],{})['then'](respondWithResult(_0x282c66,0xc9))[_0xeba6('0x40')](handleError(_0x282c66,null));};exports['update']=function(_0xa07feb,_0x4977e2){if(_0xa07feb[_0xeba6('0x46')]['id']){delete _0xa07feb[_0xeba6('0x46')]['id'];}delete _0xa07feb[_0xeba6('0x46')][_0xeba6('0x47')];delete _0xa07feb[_0xeba6('0x46')]['createdAt'];delete _0xa07feb[_0xeba6('0x46')]['closedAt'];delete _0xa07feb['body']['value'];return db[_0xeba6('0x24')][_0xeba6('0x44')]({'where':{'id':_0xa07feb[_0xeba6('0x42')]['id']}})[_0xeba6('0x1f')](handleEntityNotFound(_0x4977e2,null))[_0xeba6('0x1f')](saveUpdates(_0xa07feb[_0xeba6('0x46')],null))[_0xeba6('0x1f')](respondWithResult(_0x4977e2,null))[_0xeba6('0x40')](handleError(_0x4977e2,null));};exports['destroy']=function(_0x1b419a,_0x4e036f){return db['ScreenRecording'][_0xeba6('0x44')]({'where':{'id':_0x1b419a['params']['id']}})[_0xeba6('0x1f')](handleEntityNotFound(_0x4e036f,null))[_0xeba6('0x1f')](removeEntity(_0x4e036f,null))[_0xeba6('0x40')](handleError(_0x4e036f,null));};exports['describe']=function(_0x3f49a8,_0x3c00a4){return db[_0xeba6('0x24')][_0xeba6('0x48')]()[_0xeba6('0x1f')](respondWithResult(_0x3c00a4,null))[_0xeba6('0x40')](handleError(_0x3c00a4,null));};exports[_0xeba6('0x49')]=function(_0x1f6719,_0x9cb978,_0x42c7b3){var _0x2e2669=require(_0xeba6('0x4a'));var _0x163bf3=![];var _0x27f6ab={};if(_0x1f6719['query']['type']&&_0x1f6719[_0xeba6('0x2a')][_0xeba6('0x38')]===_0xeba6('0x4b')){_0x27f6ab[_0xeba6('0x4b')]=_0x1f6719[_0xeba6('0x42')]['id'];}else{_0x27f6ab['id']=_0x1f6719[_0xeba6('0x42')]['id'];}return db['ScreenRecording']['find']({'where':_0x27f6ab,'attributes':['id',_0xeba6('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x9cb978,null))[_0xeba6('0x1f')](function(_0x4351dc){if(_0x4351dc){var _0x1e27ec=path[_0xeba6('0x4d')](config[_0xeba6('0x4e')],_0xeba6('0x4f'),_0x4351dc[_0xeba6('0x4c')]);var _0x556e37=util[_0xeba6('0x29')](_0xeba6('0x50'),_0x1e27ec);if(fs['existsSync'](_0x556e37)){_0x163bf3=!![];return _0x2e2669[_0xeba6('0x51')](_0x556e37,_0x1e27ec,config[_0xeba6('0x52')][_0xeba6('0x53')])[_0xeba6('0x1f')](function(){return _0x4351dc;});}return _0x4351dc;}})[_0xeba6('0x1f')](function(_0x3ce286){if(_0x3ce286){var _0x1235aa=path[_0xeba6('0x4d')](config[_0xeba6('0x4e')],'server/files/screen_recordings',_0x3ce286[_0xeba6('0x4c')]);if(!fs['existsSync'](_0x1235aa)){throw new db[(_0xeba6('0x54'))][(_0xeba6('0x55'))](_0xeba6('0x56'));}if(_0x3ce286[_0xeba6('0x57')]){return _0x9cb978[_0xeba6('0x49')](_0x1235aa,_0x3ce286[_0xeba6('0x57')]+path[_0xeba6('0x58')](_0x1235aa),function(){if(_0x163bf3){fs[_0xeba6('0x59')](_0x1235aa);}});}else{return _0x9cb978[_0xeba6('0x49')](_0x1235aa,function(_0x515317){if(_0x163bf3){fs[_0xeba6('0x59')](_0x1235aa);}});}}})[_0xeba6('0x40')](function(_0x446077){if(_0x446077[_0xeba6('0x5a')]===_0xeba6('0x56')){_0x9cb978[_0xeba6('0x18')](0x194)[_0xeba6('0x5b')](_0xeba6('0x5c'));}else{return handleError(_0x9cb978,null);}});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a042c32..0592044 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 _0x438a=['finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid','isNil','value','root','files','existsSync','log','catch','resolve'];(function(_0xb8dae0,_0x317df1){var _0x3aba88=function(_0x1e6f9a){while(--_0x1e6f9a){_0xb8dae0['push'](_0xb8dae0['shift']());}};_0x3aba88(++_0x317df1);}(_0x438a,0xb9));var _0xa438=function(_0x1fbe05,_0x116284){_0x1fbe05=_0x1fbe05-0x0;var _0x49b5c3=_0x438a[_0x1fbe05];return _0x49b5c3;};'use strict';var _=require(_0xa438('0x0'));var util=require(_0xa438('0x1'));var logger=require(_0xa438('0x2'))(_0xa438('0x3'));var moment=require(_0xa438('0x4'));var BPromise=require(_0xa438('0x5'));var rp=require(_0xa438('0x6'));var fs=require('fs');var path=require(_0xa438('0x7'));var rimraf=require(_0xa438('0x8'));var config=require(_0xa438('0x9'));var attributes=require(_0xa438('0xa'));module[_0xa438('0xb')]=function(_0x14e5de,_0x3e7baf){return _0x14e5de['define']('ScreenRecording',attributes,{'tableName':_0xa438('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xa438('0xd')]}],'timestamps':!![],'hooks':{'afterDestroy':function(_0x33c9f2,_0x7b11e4,_0x243d74){return new BPromise(function(_0x12860e,_0x41ad8a){if(!_[_0xa438('0xe')](_0x33c9f2[_0xa438('0xf')])){var _0x5d3fdf=path['join'](config[_0xa438('0x10')],'server',_0xa438('0x11'),_0xa438('0xc'),_0x33c9f2[_0xa438('0xf')]);if(fs[_0xa438('0x12')](_0x5d3fdf)){rimraf(_0x5d3fdf,function(_0x4f3c4e){if(_0x4f3c4e){console[_0xa438('0x13')](_0x4f3c4e);}});}}_0x12860e();})[_0xa438('0x14')](function(_0xf3184c){BPromise[_0xa438('0x15')]();})[_0xa438('0x16')](function(){_0x243d74();});}}});}; \ No newline at end of file +var _0xb462=['finally','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','screen_recordings','interactionid','isNil','value','join','root','server','files','existsSync','catch','resolve'];(function(_0x588b0c,_0x3cad89){var _0x2cd1b2=function(_0x26ab82){while(--_0x26ab82){_0x588b0c['push'](_0x588b0c['shift']());}};_0x2cd1b2(++_0x3cad89);}(_0xb462,0xd0));var _0x2b46=function(_0x2abde0,_0x5c9d90){_0x2abde0=_0x2abde0-0x0;var _0x24ffb2=_0xb462[_0x2abde0];return _0x24ffb2;};'use strict';var _=require(_0x2b46('0x0'));var util=require(_0x2b46('0x1'));var logger=require(_0x2b46('0x2'))(_0x2b46('0x3'));var moment=require(_0x2b46('0x4'));var BPromise=require(_0x2b46('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b46('0x6'));var rimraf=require(_0x2b46('0x7'));var config=require(_0x2b46('0x8'));var attributes=require('./screenRecording.attributes');module[_0x2b46('0x9')]=function(_0x15c7a7,_0x579099){return _0x15c7a7[_0x2b46('0xa')]('ScreenRecording',attributes,{'tableName':_0x2b46('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x2b46('0xc')]}],'timestamps':!![],'hooks':{'afterDestroy':function(_0xfb4f8,_0x219bf6,_0x2e2b01){return new BPromise(function(_0x25c40c,_0x49bbd9){if(!_[_0x2b46('0xd')](_0xfb4f8[_0x2b46('0xe')])){var _0x2bdd23=path[_0x2b46('0xf')](config[_0x2b46('0x10')],_0x2b46('0x11'),_0x2b46('0x12'),'screen_recordings',_0xfb4f8['value']);if(fs[_0x2b46('0x13')](_0x2bdd23)){rimraf(_0x2bdd23,function(_0x217d11){if(_0x217d11){console['log'](_0x217d11);}});}}_0x25c40c();})[_0x2b46('0x14')](function(_0x2a8ac4){BPromise[_0x2b46('0x15')]();})[_0x2b46('0x16')](function(){_0x2e2b01();});}}});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index d4cdc91..6e28295 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(_0x5f2a18,_0x30eb4b){var _0x4d0454=function(_0x190ccf){while(--_0x190ccf){_0x5f2a18['push'](_0x5f2a18['shift']());}};_0x4d0454(++_0x30eb4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xb83ebc,_0x1105d8){var _0x264714=function(_0x15b40a){while(--_0x15b40a){_0xb83ebc['push'](_0xb83ebc['shift']());}};_0x264714(++_0x1105d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 ed17c82..068a48d 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 _0x0961=['getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','originalname','addLogoLogin','addPreferred','favicon','addFavicon','isAuthenticated','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','/:id','show','/:id/logo','getLogo','get','/:id/logo_login','getLogoLogin','gdpr'];(function(_0x4eaf06,_0x23b11b){var _0x428041=function(_0x15d502){while(--_0x15d502){_0x4eaf06['push'](_0x4eaf06['shift']());}};_0x428041(++_0x23b11b);}(_0x0961,0x100));var _0x1096=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0x0961[_0x4b26b5];return _0x4dec71;};'use strict';var multer=require(_0x1096('0x0'));var util=require(_0x1096('0x1'));var path=require(_0x1096('0x2'));var timeout=require(_0x1096('0x3'));var express=require('express');var router=express[_0x1096('0x4')]();var auth=require(_0x1096('0x5'));var interaction=require(_0x1096('0x6'));var config=require(_0x1096('0x7'));var controller=require(_0x1096('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1096('0x9'),controller[_0x1096('0xa')]);router['get'](_0x1096('0xb'),controller[_0x1096('0xc')]);router[_0x1096('0xd')](_0x1096('0xe'),controller[_0x1096('0xf')]);router[_0x1096('0xd')]('/:id/gdpr',controller[_0x1096('0x10')]);router['get']('/:id/preferred',controller[_0x1096('0x11')]);router[_0x1096('0xd')](_0x1096('0x12'),controller[_0x1096('0x13')]);var upload=multer({'storage':multer[_0x1096('0x14')]({'destination':function(_0x16559f,_0x4b7628,_0x371214){_0x371214(null,path[_0x1096('0x15')](config[_0x1096('0x16')],_0x1096('0x17')));},'filename':function(_0x25ead8,_0x4ae039,_0x482368){_0x482368(null,util[_0x1096('0x18')](_0x1096('0x19'),_0x1096('0x1a'),path[_0x1096('0x1b')](_0x4ae039['originalname'])));}})});router[_0x1096('0x1c')](_0x1096('0xb'),upload[_0x1096('0x1d')](_0x1096('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0x1096('0x14')]({'destination':function(_0x3db99b,_0x57bb3b,_0x5a7066){_0x5a7066(null,path[_0x1096('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0xfa5eed,_0x1c8048,_0x123b9c){_0x123b9c(null,util[_0x1096('0x18')]('%s%s','logologin',path[_0x1096('0x1b')](_0x1c8048[_0x1096('0x1f')])));}})});router['post'](_0x1096('0xe'),upload[_0x1096('0x1d')](_0x1096('0x1e')),controller[_0x1096('0x20')]);var upload=multer({'storage':multer[_0x1096('0x14')]({'destination':function(_0x3d29d6,_0x14f757,_0x1049de){_0x1049de(null,path['join'](config[_0x1096('0x16')],_0x1096('0x17')));},'filename':function(_0x5c97f6,_0x57e303,_0x2b126a){_0x2b126a(null,util['format']('%s%s','preferred',path[_0x1096('0x1b')](_0x57e303[_0x1096('0x1f')])));}})});router[_0x1096('0x1c')]('/:id/preferred',upload[_0x1096('0x1d')]('file'),controller[_0x1096('0x21')]);var upload=multer({'storage':multer[_0x1096('0x14')]({'destination':function(_0x395b80,_0x169589,_0x4ce3c4){_0x4ce3c4(null,path[_0x1096('0x15')](config[_0x1096('0x16')],_0x1096('0x17')));},'filename':function(_0x5f54af,_0x188a5c,_0x2e0283){_0x2e0283(null,util[_0x1096('0x18')](_0x1096('0x19'),_0x1096('0x22'),path[_0x1096('0x1b')](_0x188a5c[_0x1096('0x1f')])));}})});router[_0x1096('0x1c')](_0x1096('0x12'),upload[_0x1096('0x1d')](_0x1096('0x1e')),controller[_0x1096('0x23')]);router['put']('/:id',auth[_0x1096('0x24')](),controller[_0x1096('0x25')]);module[_0x1096('0x26')]=router; \ No newline at end of file +var _0xb192=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./setting.controller','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','join','root','server/files/images/logos/','%s%s','logo','originalname','post','file','addLogo','format','logologin','extname','single','addLogoLogin','diskStorage','preferred','addPreferred','favicon','/:id/favicon','addFavicon','isAuthenticated','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb192,0x190));var _0x2b19=function(_0x13cc6c,_0xb99ad4){_0x13cc6c=_0x13cc6c-0x0;var _0x1163e1=_0xb192[_0x13cc6c];return _0x1163e1;};'use strict';var multer=require(_0x2b19('0x0'));var util=require('util');var path=require(_0x2b19('0x1'));var timeout=require(_0x2b19('0x2'));var express=require(_0x2b19('0x3'));var router=express['Router']();var auth=require(_0x2b19('0x4'));var interaction=require(_0x2b19('0x5'));var config=require('../../config/environment');var controller=require(_0x2b19('0x6'));router[_0x2b19('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b19('0x7')](_0x2b19('0x8'),controller[_0x2b19('0x9')]);router['get'](_0x2b19('0xa'),controller[_0x2b19('0xb')]);router['get'](_0x2b19('0xc'),controller[_0x2b19('0xd')]);router['get'](_0x2b19('0xe'),controller[_0x2b19('0xf')]);router[_0x2b19('0x7')](_0x2b19('0x10'),controller['getPreferred']);router[_0x2b19('0x7')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27b0f5,_0x5291a2,_0xf6dac){_0xf6dac(null,path[_0x2b19('0x11')](config[_0x2b19('0x12')],_0x2b19('0x13')));},'filename':function(_0x2f6b99,_0x28bcd8,_0x29430f){_0x29430f(null,util['format'](_0x2b19('0x14'),_0x2b19('0x15'),path['extname'](_0x28bcd8[_0x2b19('0x16')])));}})});router[_0x2b19('0x17')](_0x2b19('0xa'),upload['single'](_0x2b19('0x18')),controller[_0x2b19('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46445c,_0x2bb5cd,_0x5b8c70){_0x5b8c70(null,path['join'](config[_0x2b19('0x12')],_0x2b19('0x13')));},'filename':function(_0x551a1b,_0x2b2915,_0x3b37bd){_0x3b37bd(null,util[_0x2b19('0x1a')]('%s%s',_0x2b19('0x1b'),path[_0x2b19('0x1c')](_0x2b2915[_0x2b19('0x16')])));}})});router['post'](_0x2b19('0xc'),upload[_0x2b19('0x1d')](_0x2b19('0x18')),controller[_0x2b19('0x1e')]);var upload=multer({'storage':multer[_0x2b19('0x1f')]({'destination':function(_0x2cce03,_0x5e6388,_0x4a1e88){_0x4a1e88(null,path['join'](config['root'],_0x2b19('0x13')));},'filename':function(_0x4d9268,_0x2c04ec,_0x26f57d){_0x26f57d(null,util[_0x2b19('0x1a')]('%s%s',_0x2b19('0x20'),path['extname'](_0x2c04ec[_0x2b19('0x16')])));}})});router[_0x2b19('0x17')](_0x2b19('0x10'),upload[_0x2b19('0x1d')](_0x2b19('0x18')),controller[_0x2b19('0x21')]);var upload=multer({'storage':multer[_0x2b19('0x1f')]({'destination':function(_0x2c6974,_0x29ae04,_0xbc41eb){_0xbc41eb(null,path[_0x2b19('0x11')](config[_0x2b19('0x12')],_0x2b19('0x13')));},'filename':function(_0x5090c0,_0x269167,_0x40e91d){_0x40e91d(null,util[_0x2b19('0x1a')](_0x2b19('0x14'),_0x2b19('0x22'),path[_0x2b19('0x1c')](_0x269167['originalname'])));}})});router['post'](_0x2b19('0x23'),upload[_0x2b19('0x1d')](_0x2b19('0x18')),controller[_0x2b19('0x24')]);router['put'](_0x2b19('0x8'),auth[_0x2b19('0x25')](),controller[_0x2b19('0x26')]);module[_0x2b19('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index af768dc..9d81b77 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 _0xb9db=['sequelize','min_internal','INTEGER','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x3b44e8,_0x446e09){var _0x55f589=function(_0x2b69b9){while(--_0x2b69b9){_0x3b44e8['push'](_0x3b44e8['shift']());}};_0x55f589(++_0x446e09);}(_0xb9db,0xb0));var _0xbb9d=function(_0x3e1496,_0x44188c){_0x3e1496=_0x3e1496-0x0;var _0x1bfb48=_0xb9db[_0x3e1496];return _0x1bfb48;};'use strict';var Sequelize=require(_0xbb9d('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xbb9d('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xbb9d('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xbb9d('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xbb9d('0x3')},'logo':{'type':Sequelize[_0xbb9d('0x4')]},'defaultLogo':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xbb9d('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xbb9d('0x4')]},'turnaddr':{'type':Sequelize[_0xbb9d('0x4')]},'turnusername':{'type':Sequelize[_0xbb9d('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xbb9d('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xbb9d('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xbb9d('0x4')],'defaultValue':_0xbb9d('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xbb9d('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xbb9d('0x4')],'defaultValue':_0xbb9d('0x7')},'chatTimeout':{'type':Sequelize[_0xbb9d('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xbb9d('0x4')]},'defaultPreferred':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xbb9d('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xbb9d('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xbb9d('0x4')]},'defaultFavicon':{'type':Sequelize[_0xbb9d('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xbb9d('0x2')],'defaultValue':0xa,'validate':{'min':0xa}}}; \ No newline at end of file +var _0xd206=['exports','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xd206,0x15e));var _0x6d20=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xd206[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require('sequelize');module[_0x6d20('0x0')]={'min_internal':{'type':Sequelize[_0x6d20('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6d20('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':_0x6d20('0x3')},'logo':{'type':Sequelize[_0x6d20('0x2')]},'defaultLogo':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6d20('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6d20('0x2')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x6d20('0x2')]},'turnpassword':{'type':Sequelize[_0x6d20('0x2')]},'pageTitle':{'type':Sequelize[_0x6d20('0x2')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':_0x6d20('0x5')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x6d20('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6d20('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6d20('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':_0x6d20('0x6')},'chatTimeout':{'type':Sequelize[_0x6d20('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x6d20('0x2')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6d20('0x2')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x6d20('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x6d20('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6d20('0x1')],'defaultValue':0xa,'validate':{'min':0xa}}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 2abaac8..a7cbdbc 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 _0x073d=['limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','rawAttributes','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','Setting','includeAll','include','findAll','rows','catch','show','fields','find','params','body','get','readFileSync','join','root','utf8','server/files/templates/turn.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','Reload','res_rtp_asterisk.so','addLogo','file','logo','filename','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','toLower','default_logo.png','default','upperFirst','custom','\x20not\x20found','download','../../config/license/util','getLogoLogin','loginLogo','default_loginLogo.png','gdpr','securePassword','addPreferred','defaultLogo','addFavicon','default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','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','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Setting,\x20%s,\x20%s','result','sendStatus','status','json','count','offset'];(function(_0x407e9c,_0x24c467){var _0x5d8d3e=function(_0x55f960){while(--_0x55f960){_0x407e9c['push'](_0x407e9c['shift']());}};_0x5d8d3e(++_0x24c467);}(_0x073d,0xd4));var _0xd073=function(_0x39ddd4,_0x38ce35){_0x39ddd4=_0x39ddd4-0x0;var _0x3d642a=_0x073d[_0x39ddd4];return _0x3d642a;};'use strict';var pdf=require(_0xd073('0x0'));var emlformat=require(_0xd073('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd073('0x2'));var jsonpatch=require(_0xd073('0x3'));var rp=require(_0xd073('0x4'));var moment=require(_0xd073('0x5'));var BPromise=require(_0xd073('0x6'));var Mustache=require(_0xd073('0x7'));var util=require('util');var path=require(_0xd073('0x8'));var sox=require(_0xd073('0x9'));var csv=require(_0xd073('0xa'));var ejs=require(_0xd073('0xb'));var fs=require('fs');var _=require(_0xd073('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd073('0xd'));var deskjs=require(_0xd073('0xe'));var toCsv=require(_0xd073('0xa'));var querystring=require(_0xd073('0xf'));var Papa=require('papaparse');var Redis=require(_0xd073('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd073('0x11'))(_0xd073('0x12'));var utils=require(_0xd073('0x13'));var config=require(_0xd073('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x43fce3,_0x419659,_0x5b6b80){if(_0x5b6b80){var _0x2b6107=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b6107[_0xd073('0x15')](_0x419659)){return _0x43fce3;}else{throw new db[(_0xd073('0x16'))][(_0xd073('0x17'))](_0xd073('0x18'));}}else{return _0x43fce3;}}function respondWithRpcPromise(_0x5caac9,_0x587731,_0x2b72a5,_0x174fcb){return new BPromise(function(_0x4b2b8c,_0x12b8d3){var _0x81a865=_0x174fcb||client;return _0x81a865[_0xd073('0x19')](_0x5caac9,_0x2b72a5)[_0xd073('0x1a')](function(_0x230c17){logger['info']('Setting,\x20%s,\x20%s',_0x587731,_0xd073('0x1b'));logger[_0xd073('0x1c')](_0xd073('0x1d'),_0x587731,_0xd073('0x1b'),JSON[_0xd073('0x1e')](_0x230c17));if(_0x230c17[_0xd073('0x1f')]){if(_0x230c17['error'][_0xd073('0x20')]===0x1f4){logger[_0xd073('0x1f')]('Setting,\x20%s,\x20%s',_0x587731,_0x230c17[_0xd073('0x1f')]['message']);return _0x12b8d3(_0x230c17[_0xd073('0x1f')][_0xd073('0x21')]);}logger[_0xd073('0x1f')]('Setting,\x20%s,\x20%s',_0x587731,_0x230c17[_0xd073('0x1f')][_0xd073('0x21')]);return _0x4b2b8c(_0x230c17['error'][_0xd073('0x21')]);}else{logger[_0xd073('0x22')](_0xd073('0x23'),_0x587731,_0xd073('0x1b'));_0x4b2b8c(_0x230c17[_0xd073('0x24')][_0xd073('0x21')]);}})['catch'](function(_0x185696){logger['error']('Setting,\x20%s,\x20%s',_0x587731,_0x185696);_0x12b8d3(_0x185696);});});}function respondWithStatusCode(_0x2d3cd6,_0x5b3b53){_0x5b3b53=_0x5b3b53||0xcc;return function(_0x266ed8){if(_0x266ed8){return _0x2d3cd6[_0xd073('0x25')](_0x5b3b53);}return _0x2d3cd6['status'](_0x5b3b53)['end']();};}function respondWithResult(_0x1ce91e,_0x364237){_0x364237=_0x364237||0xc8;return function(_0x249e34){if(_0x249e34){return _0x1ce91e[_0xd073('0x26')](_0x364237)[_0xd073('0x27')](_0x249e34);}};}function respondWithFilteredResult(_0x46bf85,_0x30dce9){return function(_0x54f3e8){if(_0x54f3e8){var _0x384ac3=_0x54f3e8[_0xd073('0x28')],_0x2dc4d9=_0x30dce9['offset'],_0xf387b7=_0x30dce9[_0xd073('0x29')]+_0x30dce9[_0xd073('0x2a')],_0x572cce;if(_0xf387b7>=_0x384ac3){_0xf387b7=_0x384ac3;_0x572cce=0xc8;}else{_0x572cce=0xce;}_0x46bf85[_0xd073('0x26')](_0x572cce);return _0x46bf85['set'](_0xd073('0x2b'),_0x2dc4d9+'-'+_0xf387b7+'/'+_0x384ac3)['json'](_0x54f3e8);}return null;};}function patchUpdates(_0x582152){return function(_0x362f7d){try{jsonpatch[_0xd073('0x2c')](_0x362f7d,_0x582152,!![]);}catch(_0x25625b){return BPromise[_0xd073('0x2d')](_0x25625b);}return _0x362f7d[_0xd073('0x2e')]();};}function saveUpdates(_0x452162,_0x268942){return function(_0x4056c6){if(_0x4056c6){return _0x4056c6[_0xd073('0x2f')](_0x452162)[_0xd073('0x1a')](function(_0x54246f){return _0x54246f;});}return null;};}function removeEntity(_0x15ea6e,_0x958edc){return function(_0x47ad70){if(_0x47ad70){return _0x47ad70[_0xd073('0x30')]()[_0xd073('0x1a')](function(){_0x15ea6e[_0xd073('0x26')](0xcc)[_0xd073('0x31')]();});}};}function handleEntityNotFound(_0x5bdb06,_0x771e47){return function(_0x21f6f2){if(!_0x21f6f2){_0x5bdb06[_0xd073('0x25')](0x194);}return _0x21f6f2;};}function handleError(_0x2a8ebe,_0x5e346a){_0x5e346a=_0x5e346a||0x1f4;return function(_0x5bf694){logger[_0xd073('0x1f')](_0x5bf694[_0xd073('0x32')]);if(_0x5bf694[_0xd073('0x33')]){delete _0x5bf694['name'];}_0x2a8ebe[_0xd073('0x26')](_0x5e346a)[_0xd073('0x34')](_0x5bf694);};}exports['index']=function(_0x2843da,_0x7a597){var _0x45afd7={},_0x538b0e={},_0x45e3ff={'count':0x0,'rows':[]};var _0x4a60f3=db['Setting'][_0xd073('0x35')];_0x538b0e[_0xd073('0x36')]=_['keys'](_0x4a60f3);_0x538b0e[_0xd073('0x37')]=_[_0xd073('0x38')](_0x2843da[_0xd073('0x37')]);_0x538b0e[_0xd073('0x39')]=_[_0xd073('0x3a')](_0x538b0e[_0xd073('0x36')],_0x538b0e[_0xd073('0x37')]);_0x45afd7[_0xd073('0x3b')]=_[_0xd073('0x3a')](_0x538b0e[_0xd073('0x36')],qs['fields'](_0x2843da['query']['fields']));_0x45afd7[_0xd073('0x3b')]=_0x45afd7['attributes'][_0xd073('0x3c')]?_0x45afd7['attributes']:_0x538b0e[_0xd073('0x36')];if(!_0x2843da[_0xd073('0x37')][_0xd073('0x3d')]('nolimit')){_0x45afd7[_0xd073('0x2a')]=qs[_0xd073('0x2a')](_0x2843da[_0xd073('0x37')]['limit']);_0x45afd7['offset']=qs[_0xd073('0x29')](_0x2843da[_0xd073('0x37')][_0xd073('0x29')]);}_0x45afd7[_0xd073('0x3e')]=qs['sort'](_0x2843da[_0xd073('0x37')][_0xd073('0x3f')]);_0x45afd7[_0xd073('0x40')]=qs[_0xd073('0x39')](_[_0xd073('0x41')](_0x2843da[_0xd073('0x37')],_0x538b0e[_0xd073('0x39')]));if(_0x2843da[_0xd073('0x37')][_0xd073('0x42')]){_0x45afd7['where']=_[_0xd073('0x43')](_0x45afd7[_0xd073('0x40')],{'$or':_[_0xd073('0x44')](_0x4a60f3,function(_0x109242){if(_0x109242[_0xd073('0x45')][_0xd073('0x46')]!==_0xd073('0x47')){var _0x17e9f7={};_0x17e9f7[_0x109242[_0xd073('0x48')]]={'$like':'%'+_0x2843da[_0xd073('0x37')]['filter']+'%'};return _0x17e9f7;}})});}_0x45afd7=_[_0xd073('0x43')]({},_0x45afd7,_0x2843da[_0xd073('0x49')]);var _0xcabaaf={'where':_0x45afd7[_0xd073('0x40')]};return db[_0xd073('0x4a')]['count'](_0xcabaaf)['then'](function(_0xae7bf7){_0x45e3ff[_0xd073('0x28')]=_0xae7bf7;if(_0x2843da[_0xd073('0x37')][_0xd073('0x4b')]){_0x45afd7[_0xd073('0x4c')]=[{'all':!![]}];}return db['Setting'][_0xd073('0x4d')](_0x45afd7);})[_0xd073('0x1a')](function(_0x3c8667){_0x45e3ff[_0xd073('0x4e')]=_0x3c8667;return _0x45e3ff;})['then'](respondWithFilteredResult(_0x7a597,_0x45afd7))[_0xd073('0x4f')](handleError(_0x7a597,null));};exports[_0xd073('0x50')]=function(_0x20f288,_0x4cf3cc){var _0x567ec7={'raw':![],'where':{'id':_0x20f288['params']['id']}},_0x1c0ff4={};_0x1c0ff4['model']=_['keys'](db[_0xd073('0x4a')][_0xd073('0x35')]);_0x1c0ff4[_0xd073('0x37')]=_[_0xd073('0x38')](_0x20f288[_0xd073('0x37')]);_0x1c0ff4[_0xd073('0x39')]=_[_0xd073('0x3a')](_0x1c0ff4[_0xd073('0x36')],_0x1c0ff4[_0xd073('0x37')]);_0x567ec7[_0xd073('0x3b')]=_[_0xd073('0x3a')](_0x1c0ff4['model'],qs[_0xd073('0x51')](_0x20f288[_0xd073('0x37')][_0xd073('0x51')]));_0x567ec7[_0xd073('0x3b')]=_0x567ec7[_0xd073('0x3b')][_0xd073('0x3c')]?_0x567ec7[_0xd073('0x3b')]:_0x1c0ff4[_0xd073('0x36')];if(_0x20f288[_0xd073('0x37')][_0xd073('0x4b')]){_0x567ec7['include']=[{'all':!![]}];}_0x567ec7=_['merge']({},_0x567ec7,_0x20f288[_0xd073('0x49')]);return db[_0xd073('0x4a')]['find'](_0x567ec7)['then'](handleEntityNotFound(_0x4cf3cc,null))['then'](respondWithResult(_0x4cf3cc,null))[_0xd073('0x4f')](handleError(_0x4cf3cc,null));};exports['update']=function(_0x1f7cb5,_0x20bffc,_0x3f6de0){var _0x4a02f3;return db['Setting'][_0xd073('0x52')]({'where':{'id':_0x1f7cb5[_0xd073('0x53')]['id']}})['then'](handleEntityNotFound(_0x20bffc,null))[_0xd073('0x1a')](saveUpdates(_0x1f7cb5[_0xd073('0x54')],null))['then'](function(_0x544b52){if(_0x544b52){_0x4a02f3=_0x544b52[_0xd073('0x55')]({'plain':!![]});var _0x4d9b52=fs[_0xd073('0x56')](path[_0xd073('0x57')](config[_0xd073('0x58')],'server/files/templates/stun.ejs'),_0xd073('0x59'));var _0xb05a1=ejs['render'](_0x4d9b52,_0x4a02f3);var _0x5e0171=fs[_0xd073('0x56')](path[_0xd073('0x57')](config[_0xd073('0x58')],_0xd073('0x5a')),_0xd073('0x59'));var _0x401006=ejs['render'](_0x5e0171,_0x4a02f3);fs[_0xd073('0x5b')](_0xd073('0x5c'),_0xb05a1);fs['writeFileSync'](_0xd073('0x5d'),_0x401006);return respondWithRpcPromise('Reload','update',{'module':_0xd073('0x5e')});}})[_0xd073('0x1a')](function(){return respondWithRpcPromise(_0xd073('0x5f'),_0xd073('0x2f'),{'module':_0xd073('0x60')});})['then'](function(){return _0x4a02f3||null;})[_0xd073('0x1a')](respondWithResult(_0x20bffc,null))[_0xd073('0x4f')](handleError(_0x20bffc,null));};exports[_0xd073('0x61')]=function(_0x5df345,_0x1c9fcc,_0x524a19){if(_0x5df345[_0xd073('0x62')]&&_0x5df345[_0xd073('0x62')]['filename']){_0x5df345[_0xd073('0x54')][_0xd073('0x63')]=_0x5df345[_0xd073('0x62')]['filename'];}return db[_0xd073('0x4a')]['find']({'where':{'id':_0x5df345[_0xd073('0x53')]['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x1c9fcc,null))[_0xd073('0x1a')](saveUpdates(_0x5df345[_0xd073('0x54')],null))['then'](respondWithResult(_0x1c9fcc,null))['catch'](handleError(_0x1c9fcc,null));};exports['addLogoLogin']=function(_0x1b1254,_0x1c825b,_0x45399b){if(_0x1b1254[_0xd073('0x62')]&&_0x1b1254[_0xd073('0x62')]['filename']){_0x1b1254['body']['loginLogo']=_0x1b1254[_0xd073('0x62')][_0xd073('0x64')];}return db[_0xd073('0x4a')][_0xd073('0x52')]({'where':{'id':_0x1b1254[_0xd073('0x53')]['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x1c825b,null))[_0xd073('0x1a')](saveUpdates(_0x1b1254[_0xd073('0x54')],null))[_0xd073('0x1a')](respondWithResult(_0x1c825b,null))[_0xd073('0x4f')](handleError(_0x1c825b,null));};var utilLicense=require('../../config/license/util');exports[_0xd073('0x65')]=function(_0x295ae0,_0x487c42,_0x361a70){var _0x392eba=_0xd073('0x66');var _0x2c44b9={'custom':![]};return utilLicense[_0xd073('0x67')]()[_0xd073('0x1a')](function(_0x1b4146){if(_0x1b4146){_0x2c44b9=_0x1b4146;}return db['Setting']['find']({'where':{'id':_0x295ae0[_0xd073('0x53')]['id']},'attributes':['logo','loginLogo',_0xd073('0x68'),_0xd073('0x69'),'defaultLogo',_0xd073('0x6a'),_0xd073('0x6b'),_0xd073('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0x487c42,null))['then'](function(_0x2bae5b){if(_0x2bae5b){var _0x2cda98=_0x2bae5b[_0xd073('0x63')]&&fs[_0xd073('0x6d')](path['join'](config[_0xd073('0x58')],_0x392eba,_[_0xd073('0x6e')](_0x2bae5b[_0xd073('0x63')])))?path[_0xd073('0x57')](config[_0xd073('0x58')],_0x392eba,_['toLower'](_0x2bae5b[_0xd073('0x63')])):path['join'](config[_0xd073('0x58')],_0x392eba,_[_0xd073('0x6e')](_0xd073('0x6f')));var _0x56ea26=_0xd073('0x70')+_[_0xd073('0x71')](_0xd073('0x63'));if(_0x2bae5b[_0x56ea26]||!_0x2c44b9[_0xd073('0x72')]){_0x2cda98=path[_0xd073('0x57')](config['root'],_0x392eba,_[_0xd073('0x6e')](_0xd073('0x6f')));}if(!fs[_0xd073('0x6d')](_0x2cda98)){throw new db[(_0xd073('0x16'))]['ValidationError'](_[_0xd073('0x71')]('logo')+_0xd073('0x73'));}return _0x487c42[_0xd073('0x74')](_0x2cda98);}})[_0xd073('0x4f')](handleError(_0x487c42,null));};var utilLicense=require(_0xd073('0x75'));exports[_0xd073('0x76')]=function(_0x28a1e7,_0xa0d12b,_0x302b6f){var _0x4dedcb='server/files/images/logos';var _0x4f6d4f={'custom':![]};return utilLicense[_0xd073('0x67')]()['then'](function(_0x46c630){if(_0x46c630){_0x4f6d4f=_0x46c630;}return db[_0xd073('0x4a')][_0xd073('0x52')]({'where':{'id':_0x28a1e7[_0xd073('0x53')]['id']},'attributes':[_0xd073('0x63'),'loginLogo',_0xd073('0x68'),_0xd073('0x69'),'defaultLogo',_0xd073('0x6a'),'defaultPreferred',_0xd073('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0xa0d12b,null))['then'](function(_0x3b8f2c){if(_0x3b8f2c){var _0x530063=_0x3b8f2c[_0xd073('0x77')]&&fs[_0xd073('0x6d')](path[_0xd073('0x57')](config['root'],_0x4dedcb,_[_0xd073('0x6e')](_0x3b8f2c[_0xd073('0x77')])))?path[_0xd073('0x57')](config[_0xd073('0x58')],_0x4dedcb,_[_0xd073('0x6e')](_0x3b8f2c[_0xd073('0x77')])):path['join'](config['root'],_0x4dedcb,_['toLower'](_0xd073('0x78')));var _0x3221e6='default'+_[_0xd073('0x71')](_0xd073('0x77'));if(_0x3b8f2c[_0x3221e6]||!_0x4f6d4f[_0xd073('0x72')]){_0x530063=path[_0xd073('0x57')](config[_0xd073('0x58')],_0x4dedcb,_[_0xd073('0x6e')](_0xd073('0x78')));}if(!fs[_0xd073('0x6d')](_0x530063)){throw new db[(_0xd073('0x16'))][(_0xd073('0x17'))](_[_0xd073('0x71')](_0xd073('0x77'))+_0xd073('0x73'));}return _0xa0d12b[_0xd073('0x74')](_0x530063);}})[_0xd073('0x4f')](handleError(_0xa0d12b,null));};exports[_0xd073('0x79')]=function(_0x4a1d04,_0x32bb67){return db[_0xd073('0x4a')]['find']({'where':{'id':_0x4a1d04['params']['id']},'attributes':[_0xd073('0x7a')]})[_0xd073('0x1a')](respondWithResult(_0x32bb67,null))[_0xd073('0x4f')](handleError(_0x32bb67,null));};exports[_0xd073('0x7b')]=function(_0x2b08ff,_0x24f0a8,_0xac60de){if(_0x2b08ff[_0xd073('0x62')]&&_0x2b08ff[_0xd073('0x62')][_0xd073('0x64')]){_0x2b08ff[_0xd073('0x54')]['preferred']=_0x2b08ff['file'][_0xd073('0x64')];}return db[_0xd073('0x4a')][_0xd073('0x52')]({'where':{'id':_0x2b08ff[_0xd073('0x53')]['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x24f0a8,null))[_0xd073('0x1a')](saveUpdates(_0x2b08ff[_0xd073('0x54')],null))[_0xd073('0x1a')](respondWithResult(_0x24f0a8,null))[_0xd073('0x4f')](handleError(_0x24f0a8,null));};var utilLicense=require(_0xd073('0x75'));exports['getPreferred']=function(_0x975de5,_0x343cfe,_0x3bfc63){var _0x4d8665=_0xd073('0x66');var _0xc97a71={'custom':![]};return utilLicense[_0xd073('0x67')]()[_0xd073('0x1a')](function(_0x2669b5){if(_0x2669b5){_0xc97a71=_0x2669b5;}return db['Setting']['find']({'where':{'id':_0x975de5[_0xd073('0x53')]['id']},'attributes':[_0xd073('0x63'),'loginLogo',_0xd073('0x68'),'favicon',_0xd073('0x7c'),_0xd073('0x6a'),_0xd073('0x6b'),_0xd073('0x6c')],'raw':!![]});})[_0xd073('0x1a')](handleEntityNotFound(_0x343cfe,null))['then'](function(_0x3b6b26){if(_0x3b6b26){var _0x188ff1=_0x3b6b26[_0xd073('0x68')]&&fs[_0xd073('0x6d')](path[_0xd073('0x57')](config['root'],_0x4d8665,_[_0xd073('0x6e')](_0x3b6b26[_0xd073('0x68')])))?path[_0xd073('0x57')](config[_0xd073('0x58')],_0x4d8665,_[_0xd073('0x6e')](_0x3b6b26[_0xd073('0x68')])):path[_0xd073('0x57')](config[_0xd073('0x58')],_0x4d8665,_['toLower']('default_preferred.png'));var _0x5aaf8a=_0xd073('0x70')+_[_0xd073('0x71')]('preferred');if(_0x3b6b26[_0x5aaf8a]||!_0xc97a71[_0xd073('0x72')]||!_0xc97a71[_0xd073('0x68')]){_0x188ff1=path[_0xd073('0x57')](config['root'],_0x4d8665,_['toLower']('default_preferred.png'));}if(!fs[_0xd073('0x6d')](_0x188ff1)){throw new db[(_0xd073('0x16'))]['ValidationError'](_['upperFirst'](_0xd073('0x68'))+_0xd073('0x73'));}return _0x343cfe[_0xd073('0x74')](_0x188ff1);}})[_0xd073('0x4f')](handleError(_0x343cfe,null));};exports[_0xd073('0x7d')]=function(_0x5d4a3a,_0x993822,_0x9a4a50){if(_0x5d4a3a[_0xd073('0x62')]&&_0x5d4a3a[_0xd073('0x62')]['filename']){_0x5d4a3a[_0xd073('0x54')]['favicon']=_0x5d4a3a[_0xd073('0x62')][_0xd073('0x64')];}return db[_0xd073('0x4a')][_0xd073('0x52')]({'where':{'id':_0x5d4a3a[_0xd073('0x53')]['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x993822,null))[_0xd073('0x1a')](saveUpdates(_0x5d4a3a[_0xd073('0x54')],null))[_0xd073('0x1a')](respondWithResult(_0x993822,null))[_0xd073('0x4f')](handleError(_0x993822,null));};var utilLicense=require(_0xd073('0x75'));exports['getFavicon']=function(_0x3dc747,_0x291560,_0x49904a){var _0x4cff34='server/files/images/logos';var _0x19db86={'custom':![]};return utilLicense[_0xd073('0x67')]()[_0xd073('0x1a')](function(_0x287c5b){if(_0x287c5b){_0x19db86=_0x287c5b;}return db[_0xd073('0x4a')]['find']({'where':{'id':_0x3dc747[_0xd073('0x53')]['id']},'attributes':[_0xd073('0x63'),_0xd073('0x77'),'preferred',_0xd073('0x69'),'defaultLogo',_0xd073('0x6a'),_0xd073('0x6b'),_0xd073('0x6c')],'raw':!![]});})[_0xd073('0x1a')](handleEntityNotFound(_0x291560,null))['then'](function(_0x416e59){if(_0x416e59){var _0x4f8ef1=_0x416e59[_0xd073('0x69')]&&fs[_0xd073('0x6d')](path[_0xd073('0x57')](config[_0xd073('0x58')],_0x4cff34,_['toLower'](_0x416e59[_0xd073('0x69')])))?path[_0xd073('0x57')](config[_0xd073('0x58')],_0x4cff34,_[_0xd073('0x6e')](_0x416e59[_0xd073('0x69')])):path[_0xd073('0x57')](config['root'],_0x4cff34,_[_0xd073('0x6e')](_0xd073('0x7e')));var _0x5d1e95=_0xd073('0x70')+_[_0xd073('0x71')](_0xd073('0x69'));if(_0x416e59[_0x5d1e95]||!_0x19db86[_0xd073('0x72')]){_0x4f8ef1=path['join'](config['root'],_0x4cff34,_[_0xd073('0x6e')](_0xd073('0x7e')));}if(!fs['existsSync'](_0x4f8ef1)){throw new db[(_0xd073('0x16'))][(_0xd073('0x17'))](_[_0xd073('0x71')](_0xd073('0x69'))+'\x20not\x20found');}return _0x291560['download'](_0x4f8ef1);}})['catch'](handleError(_0x291560,null));}; \ No newline at end of file +var _0xedd5=['name','index','Setting','rawAttributes','query','filters','intersection','model','attributes','length','nolimit','sort','pick','filter','where','merge','map','type','key','field','options','findAll','rows','catch','show','params','keys','fields','body','get','readFileSync','join','root','server/files/templates/stun.ejs','utf8','render','server/files/templates/turn.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','logo','filename','addLogoLogin','find','getLogo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','toLower','default_logo.png','custom','ValidationError','upperFirst','\x20not\x20found','../../config/license/util','getLogoLogin','defaultLoginLogo','default_loginLogo.png','default','gdpr','securePassword','preferred','getPreferred','default_preferred.png','download','addFavicon','default_favicon.ico','html-pdf','eml-format','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','sendStatus'];(function(_0x4f13f8,_0x5e13c5){var _0x1e6b83=function(_0x26e15b){while(--_0x26e15b){_0x4f13f8['push'](_0x4f13f8['shift']());}};_0x1e6b83(++_0x5e13c5);}(_0xedd5,0x1d0));var _0x5edd=function(_0x7b28fe,_0x14b077){_0x7b28fe=_0x7b28fe-0x0;var _0x3eea1b=_0xedd5[_0x7b28fe];return _0x3eea1b;};'use strict';var pdf=require(_0x5edd('0x0'));var emlformat=require(_0x5edd('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5edd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5edd('0x3'));var Mustache=require(_0x5edd('0x4'));var util=require('util');var path=require(_0x5edd('0x5'));var sox=require(_0x5edd('0x6'));var csv=require(_0x5edd('0x7'));var ejs=require(_0x5edd('0x8'));var fs=require('fs');var _=require(_0x5edd('0x9'));var squel=require(_0x5edd('0xa'));var crypto=require(_0x5edd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5edd('0xc'));var toCsv=require(_0x5edd('0x7'));var querystring=require(_0x5edd('0xd'));var Papa=require(_0x5edd('0xe'));var Redis=require(_0x5edd('0xf'));var authService=require(_0x5edd('0x10'));var qs=require(_0x5edd('0x11'));var hardwareService=require(_0x5edd('0x12'));var logger=require(_0x5edd('0x13'))(_0x5edd('0x14'));var utils=require(_0x5edd('0x15'));var config=require(_0x5edd('0x16'));var db=require(_0x5edd('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5edd('0x18')][_0x5edd('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2cb0f9,_0x14cded,_0x5240c3){if(_0x5240c3){var _0x1f98ec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f98ec[_0x5edd('0x1a')](_0x14cded)){return _0x2cb0f9;}else{throw new db[(_0x5edd('0x1b'))]['ValidationError'](_0x5edd('0x1c'));}}else{return _0x2cb0f9;}}function respondWithRpcPromise(_0x4d573b,_0x166e30,_0x6ab665,_0x5d67bb){return new BPromise(function(_0x2c3aed,_0x3b2fe8){var _0x36adce=_0x5d67bb||client;return _0x36adce[_0x5edd('0x1d')](_0x4d573b,_0x6ab665)['then'](function(_0xd18d54){logger['info'](_0x5edd('0x1e'),_0x166e30,'request\x20sent');logger[_0x5edd('0x1f')](_0x5edd('0x20'),_0x166e30,_0x5edd('0x21'),JSON[_0x5edd('0x22')](_0xd18d54));if(_0xd18d54[_0x5edd('0x23')]){if(_0xd18d54['error']['code']===0x1f4){logger[_0x5edd('0x23')]('Setting,\x20%s,\x20%s',_0x166e30,_0xd18d54[_0x5edd('0x23')][_0x5edd('0x24')]);return _0x3b2fe8(_0xd18d54[_0x5edd('0x23')][_0x5edd('0x24')]);}logger['error'](_0x5edd('0x1e'),_0x166e30,_0xd18d54[_0x5edd('0x23')][_0x5edd('0x24')]);return _0x2c3aed(_0xd18d54[_0x5edd('0x23')][_0x5edd('0x24')]);}else{logger[_0x5edd('0x25')](_0x5edd('0x1e'),_0x166e30,_0x5edd('0x21'));_0x2c3aed(_0xd18d54[_0x5edd('0x26')][_0x5edd('0x24')]);}})['catch'](function(_0x1cc49c){logger['error'](_0x5edd('0x1e'),_0x166e30,_0x1cc49c);_0x3b2fe8(_0x1cc49c);});});}function respondWithStatusCode(_0x3fe10b,_0x589cf3){_0x589cf3=_0x589cf3||0xcc;return function(_0x5db877){if(_0x5db877){return _0x3fe10b['sendStatus'](_0x589cf3);}return _0x3fe10b[_0x5edd('0x27')](_0x589cf3)[_0x5edd('0x28')]();};}function respondWithResult(_0x4ac269,_0xb58750){_0xb58750=_0xb58750||0xc8;return function(_0xd2668a){if(_0xd2668a){return _0x4ac269[_0x5edd('0x27')](_0xb58750)[_0x5edd('0x29')](_0xd2668a);}};}function respondWithFilteredResult(_0x5d9285,_0x5e51a3){return function(_0x3a5167){if(_0x3a5167){var _0x25b68a=_0x3a5167[_0x5edd('0x2a')],_0x5647c8=_0x5e51a3[_0x5edd('0x2b')],_0xcd2876=_0x5e51a3[_0x5edd('0x2b')]+_0x5e51a3[_0x5edd('0x2c')],_0x5ed2db;if(_0xcd2876>=_0x25b68a){_0xcd2876=_0x25b68a;_0x5ed2db=0xc8;}else{_0x5ed2db=0xce;}_0x5d9285[_0x5edd('0x27')](_0x5ed2db);return _0x5d9285['set'](_0x5edd('0x2d'),_0x5647c8+'-'+_0xcd2876+'/'+_0x25b68a)[_0x5edd('0x29')](_0x3a5167);}return null;};}function patchUpdates(_0x2cf657){return function(_0x40cd7f){try{jsonpatch['apply'](_0x40cd7f,_0x2cf657,!![]);}catch(_0x59df92){return BPromise[_0x5edd('0x2e')](_0x59df92);}return _0x40cd7f[_0x5edd('0x2f')]();};}function saveUpdates(_0x57e140,_0x59247f){return function(_0xc81054){if(_0xc81054){return _0xc81054[_0x5edd('0x30')](_0x57e140)[_0x5edd('0x31')](function(_0xee28b1){return _0xee28b1;});}return null;};}function removeEntity(_0x22b450,_0x4258cf){return function(_0x276f89){if(_0x276f89){return _0x276f89[_0x5edd('0x32')]()['then'](function(){_0x22b450['status'](0xcc)[_0x5edd('0x28')]();});}};}function handleEntityNotFound(_0x3c989e,_0x1b08e1){return function(_0xe73346){if(!_0xe73346){_0x3c989e[_0x5edd('0x33')](0x194);}return _0xe73346;};}function handleError(_0x358e08,_0x4b0c5b){_0x4b0c5b=_0x4b0c5b||0x1f4;return function(_0x5d36b8){logger[_0x5edd('0x23')](_0x5d36b8['stack']);if(_0x5d36b8[_0x5edd('0x34')]){delete _0x5d36b8[_0x5edd('0x34')];}_0x358e08[_0x5edd('0x27')](_0x4b0c5b)['send'](_0x5d36b8);};}exports[_0x5edd('0x35')]=function(_0xcd54ef,_0x307b92){var _0x52ed0d={},_0x23ea11={},_0x3f39c0={'count':0x0,'rows':[]};var _0x27b739=db[_0x5edd('0x36')][_0x5edd('0x37')];_0x23ea11['model']=_['keys'](_0x27b739);_0x23ea11[_0x5edd('0x38')]=_['keys'](_0xcd54ef[_0x5edd('0x38')]);_0x23ea11[_0x5edd('0x39')]=_[_0x5edd('0x3a')](_0x23ea11[_0x5edd('0x3b')],_0x23ea11[_0x5edd('0x38')]);_0x52ed0d[_0x5edd('0x3c')]=_[_0x5edd('0x3a')](_0x23ea11[_0x5edd('0x3b')],qs['fields'](_0xcd54ef['query']['fields']));_0x52ed0d['attributes']=_0x52ed0d[_0x5edd('0x3c')][_0x5edd('0x3d')]?_0x52ed0d[_0x5edd('0x3c')]:_0x23ea11[_0x5edd('0x3b')];if(!_0xcd54ef[_0x5edd('0x38')]['hasOwnProperty'](_0x5edd('0x3e'))){_0x52ed0d[_0x5edd('0x2c')]=qs['limit'](_0xcd54ef[_0x5edd('0x38')][_0x5edd('0x2c')]);_0x52ed0d['offset']=qs[_0x5edd('0x2b')](_0xcd54ef[_0x5edd('0x38')][_0x5edd('0x2b')]);}_0x52ed0d['order']=qs[_0x5edd('0x3f')](_0xcd54ef[_0x5edd('0x38')][_0x5edd('0x3f')]);_0x52ed0d['where']=qs[_0x5edd('0x39')](_[_0x5edd('0x40')](_0xcd54ef[_0x5edd('0x38')],_0x23ea11['filters']));if(_0xcd54ef[_0x5edd('0x38')][_0x5edd('0x41')]){_0x52ed0d[_0x5edd('0x42')]=_[_0x5edd('0x43')](_0x52ed0d[_0x5edd('0x42')],{'$or':_[_0x5edd('0x44')](_0x27b739,function(_0x350cbe){if(_0x350cbe[_0x5edd('0x45')][_0x5edd('0x46')]!=='VIRTUAL'){var _0x4e99c8={};_0x4e99c8[_0x350cbe[_0x5edd('0x47')]]={'$like':'%'+_0xcd54ef['query'][_0x5edd('0x41')]+'%'};return _0x4e99c8;}})});}_0x52ed0d=_[_0x5edd('0x43')]({},_0x52ed0d,_0xcd54ef[_0x5edd('0x48')]);var _0x26c4c2={'where':_0x52ed0d['where']};return db[_0x5edd('0x36')][_0x5edd('0x2a')](_0x26c4c2)[_0x5edd('0x31')](function(_0x3c445c){_0x3f39c0[_0x5edd('0x2a')]=_0x3c445c;if(_0xcd54ef[_0x5edd('0x38')]['includeAll']){_0x52ed0d['include']=[{'all':!![]}];}return db[_0x5edd('0x36')][_0x5edd('0x49')](_0x52ed0d);})[_0x5edd('0x31')](function(_0x467af6){_0x3f39c0[_0x5edd('0x4a')]=_0x467af6;return _0x3f39c0;})[_0x5edd('0x31')](respondWithFilteredResult(_0x307b92,_0x52ed0d))[_0x5edd('0x4b')](handleError(_0x307b92,null));};exports[_0x5edd('0x4c')]=function(_0x3a6790,_0x1e2857){var _0x314c89={'raw':![],'where':{'id':_0x3a6790[_0x5edd('0x4d')]['id']}},_0x3b2032={};_0x3b2032[_0x5edd('0x3b')]=_[_0x5edd('0x4e')](db[_0x5edd('0x36')]['rawAttributes']);_0x3b2032['query']=_['keys'](_0x3a6790[_0x5edd('0x38')]);_0x3b2032[_0x5edd('0x39')]=_[_0x5edd('0x3a')](_0x3b2032['model'],_0x3b2032[_0x5edd('0x38')]);_0x314c89['attributes']=_[_0x5edd('0x3a')](_0x3b2032['model'],qs[_0x5edd('0x4f')](_0x3a6790[_0x5edd('0x38')]['fields']));_0x314c89['attributes']=_0x314c89[_0x5edd('0x3c')][_0x5edd('0x3d')]?_0x314c89['attributes']:_0x3b2032[_0x5edd('0x3b')];if(_0x3a6790[_0x5edd('0x38')]['includeAll']){_0x314c89['include']=[{'all':!![]}];}_0x314c89=_[_0x5edd('0x43')]({},_0x314c89,_0x3a6790['options']);return db[_0x5edd('0x36')]['find'](_0x314c89)['then'](handleEntityNotFound(_0x1e2857,null))['then'](respondWithResult(_0x1e2857,null))['catch'](handleError(_0x1e2857,null));};exports[_0x5edd('0x30')]=function(_0x3ad856,_0x5a69d0,_0x2207d0){var _0x435f94;return db[_0x5edd('0x36')]['find']({'where':{'id':_0x3ad856['params']['id']}})[_0x5edd('0x31')](handleEntityNotFound(_0x5a69d0,null))[_0x5edd('0x31')](saveUpdates(_0x3ad856[_0x5edd('0x50')],null))[_0x5edd('0x31')](function(_0x5435be){if(_0x5435be){_0x435f94=_0x5435be[_0x5edd('0x51')]({'plain':!![]});var _0x179ff3=fs[_0x5edd('0x52')](path[_0x5edd('0x53')](config[_0x5edd('0x54')],_0x5edd('0x55')),_0x5edd('0x56'));var _0x482630=ejs[_0x5edd('0x57')](_0x179ff3,_0x435f94);var _0x58da9e=fs[_0x5edd('0x52')](path[_0x5edd('0x53')](config[_0x5edd('0x54')],_0x5edd('0x58')),_0x5edd('0x56'));var _0x1a5609=ejs['render'](_0x58da9e,_0x435f94);fs[_0x5edd('0x59')](_0x5edd('0x5a'),_0x482630);fs[_0x5edd('0x59')](_0x5edd('0x5b'),_0x1a5609);return respondWithRpcPromise(_0x5edd('0x5c'),_0x5edd('0x30'),{'module':_0x5edd('0x5d')});}})['then'](function(){return respondWithRpcPromise(_0x5edd('0x5c'),'update',{'module':_0x5edd('0x5e')});})[_0x5edd('0x31')](function(){return _0x435f94||null;})[_0x5edd('0x31')](respondWithResult(_0x5a69d0,null))[_0x5edd('0x4b')](handleError(_0x5a69d0,null));};exports[_0x5edd('0x5f')]=function(_0x3aec26,_0xf22a23,_0x27cd61){if(_0x3aec26[_0x5edd('0x60')]&&_0x3aec26[_0x5edd('0x60')]['filename']){_0x3aec26[_0x5edd('0x50')][_0x5edd('0x61')]=_0x3aec26[_0x5edd('0x60')][_0x5edd('0x62')];}return db['Setting']['find']({'where':{'id':_0x3aec26['params']['id']}})[_0x5edd('0x31')](handleEntityNotFound(_0xf22a23,null))[_0x5edd('0x31')](saveUpdates(_0x3aec26[_0x5edd('0x50')],null))[_0x5edd('0x31')](respondWithResult(_0xf22a23,null))[_0x5edd('0x4b')](handleError(_0xf22a23,null));};exports[_0x5edd('0x63')]=function(_0x3bcad1,_0x5d9b4a,_0x1a9387){if(_0x3bcad1[_0x5edd('0x60')]&&_0x3bcad1[_0x5edd('0x60')][_0x5edd('0x62')]){_0x3bcad1[_0x5edd('0x50')]['loginLogo']=_0x3bcad1[_0x5edd('0x60')][_0x5edd('0x62')];}return db[_0x5edd('0x36')][_0x5edd('0x64')]({'where':{'id':_0x3bcad1[_0x5edd('0x4d')]['id']}})[_0x5edd('0x31')](handleEntityNotFound(_0x5d9b4a,null))['then'](saveUpdates(_0x3bcad1['body'],null))['then'](respondWithResult(_0x5d9b4a,null))['catch'](handleError(_0x5d9b4a,null));};var utilLicense=require('../../config/license/util');exports[_0x5edd('0x65')]=function(_0x10de81,_0x115a89,_0x6442ef){var _0x3ccf65=_0x5edd('0x66');var _0x290c4e={'custom':![]};return utilLicense[_0x5edd('0x67')]()[_0x5edd('0x31')](function(_0x1cb560){if(_0x1cb560){_0x290c4e=_0x1cb560;}return db[_0x5edd('0x36')][_0x5edd('0x64')]({'where':{'id':_0x10de81[_0x5edd('0x4d')]['id']},'attributes':['logo',_0x5edd('0x68'),'preferred',_0x5edd('0x69'),_0x5edd('0x6a'),'defaultLoginLogo',_0x5edd('0x6b'),_0x5edd('0x6c')],'raw':!![]});})[_0x5edd('0x31')](handleEntityNotFound(_0x115a89,null))['then'](function(_0x388adb){if(_0x388adb){var _0x1eebee=_0x388adb[_0x5edd('0x61')]&&fs[_0x5edd('0x6d')](path[_0x5edd('0x53')](config['root'],_0x3ccf65,_[_0x5edd('0x6e')](_0x388adb[_0x5edd('0x61')])))?path[_0x5edd('0x53')](config[_0x5edd('0x54')],_0x3ccf65,_[_0x5edd('0x6e')](_0x388adb[_0x5edd('0x61')])):path[_0x5edd('0x53')](config[_0x5edd('0x54')],_0x3ccf65,_[_0x5edd('0x6e')](_0x5edd('0x6f')));var _0x6ca983='default'+_['upperFirst']('logo');if(_0x388adb[_0x6ca983]||!_0x290c4e[_0x5edd('0x70')]){_0x1eebee=path[_0x5edd('0x53')](config[_0x5edd('0x54')],_0x3ccf65,_[_0x5edd('0x6e')](_0x5edd('0x6f')));}if(!fs[_0x5edd('0x6d')](_0x1eebee)){throw new db['Sequelize'][(_0x5edd('0x71'))](_[_0x5edd('0x72')](_0x5edd('0x61'))+_0x5edd('0x73'));}return _0x115a89['download'](_0x1eebee);}})[_0x5edd('0x4b')](handleError(_0x115a89,null));};var utilLicense=require(_0x5edd('0x74'));exports[_0x5edd('0x75')]=function(_0x1621c7,_0x444b1e,_0x53b293){var _0x113460='server/files/images/logos';var _0x22b691={'custom':![]};return utilLicense[_0x5edd('0x67')]()[_0x5edd('0x31')](function(_0x317393){if(_0x317393){_0x22b691=_0x317393;}return db[_0x5edd('0x36')]['find']({'where':{'id':_0x1621c7[_0x5edd('0x4d')]['id']},'attributes':[_0x5edd('0x61'),_0x5edd('0x68'),'preferred','favicon',_0x5edd('0x6a'),_0x5edd('0x76'),_0x5edd('0x6b'),_0x5edd('0x6c')],'raw':!![]});})[_0x5edd('0x31')](handleEntityNotFound(_0x444b1e,null))[_0x5edd('0x31')](function(_0x5a843c){if(_0x5a843c){var _0x4fe535=_0x5a843c[_0x5edd('0x68')]&&fs[_0x5edd('0x6d')](path['join'](config[_0x5edd('0x54')],_0x113460,_['toLower'](_0x5a843c[_0x5edd('0x68')])))?path[_0x5edd('0x53')](config[_0x5edd('0x54')],_0x113460,_[_0x5edd('0x6e')](_0x5a843c[_0x5edd('0x68')])):path['join'](config['root'],_0x113460,_[_0x5edd('0x6e')](_0x5edd('0x77')));var _0x596d3a=_0x5edd('0x78')+_[_0x5edd('0x72')](_0x5edd('0x68'));if(_0x5a843c[_0x596d3a]||!_0x22b691[_0x5edd('0x70')]){_0x4fe535=path[_0x5edd('0x53')](config['root'],_0x113460,_[_0x5edd('0x6e')](_0x5edd('0x77')));}if(!fs[_0x5edd('0x6d')](_0x4fe535)){throw new db[(_0x5edd('0x1b'))][(_0x5edd('0x71'))](_[_0x5edd('0x72')]('loginLogo')+_0x5edd('0x73'));}return _0x444b1e['download'](_0x4fe535);}})[_0x5edd('0x4b')](handleError(_0x444b1e,null));};exports[_0x5edd('0x79')]=function(_0x1d5642,_0x4a17b6){return db[_0x5edd('0x36')][_0x5edd('0x64')]({'where':{'id':_0x1d5642['params']['id']},'attributes':[_0x5edd('0x7a')]})[_0x5edd('0x31')](respondWithResult(_0x4a17b6,null))['catch'](handleError(_0x4a17b6,null));};exports['addPreferred']=function(_0x4f3c91,_0x284126,_0x4ecdd6){if(_0x4f3c91[_0x5edd('0x60')]&&_0x4f3c91[_0x5edd('0x60')][_0x5edd('0x62')]){_0x4f3c91[_0x5edd('0x50')][_0x5edd('0x7b')]=_0x4f3c91[_0x5edd('0x60')][_0x5edd('0x62')];}return db['Setting'][_0x5edd('0x64')]({'where':{'id':_0x4f3c91[_0x5edd('0x4d')]['id']}})[_0x5edd('0x31')](handleEntityNotFound(_0x284126,null))['then'](saveUpdates(_0x4f3c91[_0x5edd('0x50')],null))[_0x5edd('0x31')](respondWithResult(_0x284126,null))[_0x5edd('0x4b')](handleError(_0x284126,null));};var utilLicense=require(_0x5edd('0x74'));exports[_0x5edd('0x7c')]=function(_0x5c5529,_0x4b73fb,_0x25fa71){var _0x430e5b=_0x5edd('0x66');var _0x28abc8={'custom':![]};return utilLicense[_0x5edd('0x67')]()[_0x5edd('0x31')](function(_0x47e862){if(_0x47e862){_0x28abc8=_0x47e862;}return db[_0x5edd('0x36')][_0x5edd('0x64')]({'where':{'id':_0x5c5529[_0x5edd('0x4d')]['id']},'attributes':[_0x5edd('0x61'),_0x5edd('0x68'),_0x5edd('0x7b'),'favicon',_0x5edd('0x6a'),_0x5edd('0x76'),_0x5edd('0x6b'),_0x5edd('0x6c')],'raw':!![]});})[_0x5edd('0x31')](handleEntityNotFound(_0x4b73fb,null))['then'](function(_0x12faa0){if(_0x12faa0){var _0x4fd129=_0x12faa0[_0x5edd('0x7b')]&&fs[_0x5edd('0x6d')](path[_0x5edd('0x53')](config[_0x5edd('0x54')],_0x430e5b,_[_0x5edd('0x6e')](_0x12faa0[_0x5edd('0x7b')])))?path['join'](config[_0x5edd('0x54')],_0x430e5b,_['toLower'](_0x12faa0[_0x5edd('0x7b')])):path[_0x5edd('0x53')](config['root'],_0x430e5b,_[_0x5edd('0x6e')](_0x5edd('0x7d')));var _0x5d7bef=_0x5edd('0x78')+_[_0x5edd('0x72')](_0x5edd('0x7b'));if(_0x12faa0[_0x5d7bef]||!_0x28abc8[_0x5edd('0x70')]||!_0x28abc8['preferred']){_0x4fd129=path[_0x5edd('0x53')](config['root'],_0x430e5b,_[_0x5edd('0x6e')](_0x5edd('0x7d')));}if(!fs[_0x5edd('0x6d')](_0x4fd129)){throw new db[(_0x5edd('0x1b'))][(_0x5edd('0x71'))](_[_0x5edd('0x72')](_0x5edd('0x7b'))+'\x20not\x20found');}return _0x4b73fb[_0x5edd('0x7e')](_0x4fd129);}})[_0x5edd('0x4b')](handleError(_0x4b73fb,null));};exports[_0x5edd('0x7f')]=function(_0x5c0df5,_0x49d3a5,_0x4b1b2f){if(_0x5c0df5[_0x5edd('0x60')]&&_0x5c0df5[_0x5edd('0x60')][_0x5edd('0x62')]){_0x5c0df5[_0x5edd('0x50')][_0x5edd('0x69')]=_0x5c0df5[_0x5edd('0x60')]['filename'];}return db['Setting']['find']({'where':{'id':_0x5c0df5[_0x5edd('0x4d')]['id']}})[_0x5edd('0x31')](handleEntityNotFound(_0x49d3a5,null))['then'](saveUpdates(_0x5c0df5[_0x5edd('0x50')],null))['then'](respondWithResult(_0x49d3a5,null))['catch'](handleError(_0x49d3a5,null));};var utilLicense=require(_0x5edd('0x74'));exports['getFavicon']=function(_0x19eee7,_0x13ce1b,_0xc10e66){var _0xbecec7=_0x5edd('0x66');var _0x159f53={'custom':![]};return utilLicense[_0x5edd('0x67')]()[_0x5edd('0x31')](function(_0xac68c2){if(_0xac68c2){_0x159f53=_0xac68c2;}return db[_0x5edd('0x36')]['find']({'where':{'id':_0x19eee7[_0x5edd('0x4d')]['id']},'attributes':[_0x5edd('0x61'),'loginLogo',_0x5edd('0x7b'),_0x5edd('0x69'),_0x5edd('0x6a'),_0x5edd('0x76'),_0x5edd('0x6b'),'defaultFavicon'],'raw':!![]});})[_0x5edd('0x31')](handleEntityNotFound(_0x13ce1b,null))[_0x5edd('0x31')](function(_0x50358e){if(_0x50358e){var _0x46d955=_0x50358e[_0x5edd('0x69')]&&fs[_0x5edd('0x6d')](path[_0x5edd('0x53')](config[_0x5edd('0x54')],_0xbecec7,_[_0x5edd('0x6e')](_0x50358e['favicon'])))?path['join'](config[_0x5edd('0x54')],_0xbecec7,_['toLower'](_0x50358e[_0x5edd('0x69')])):path[_0x5edd('0x53')](config['root'],_0xbecec7,_[_0x5edd('0x6e')](_0x5edd('0x80')));var _0x35cd82='default'+_[_0x5edd('0x72')](_0x5edd('0x69'));if(_0x50358e[_0x35cd82]||!_0x159f53['custom']){_0x46d955=path['join'](config[_0x5edd('0x54')],_0xbecec7,_[_0x5edd('0x6e')](_0x5edd('0x80')));}if(!fs[_0x5edd('0x6d')](_0x46d955)){throw new db[(_0x5edd('0x1b'))][(_0x5edd('0x71'))](_[_0x5edd('0x72')](_0x5edd('0x69'))+'\x20not\x20found');}return _0x13ce1b[_0x5edd('0x7e')](_0x46d955);}})[_0x5edd('0x4b')](handleError(_0x13ce1b,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 23e5bb0..289f9d7 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 _0x82d3=['rimraf','../../config/environment','exports','define','util','../../config/logger','api','path'];(function(_0x3a2201,_0x50243f){var _0x406da4=function(_0x265adf){while(--_0x265adf){_0x3a2201['push'](_0x3a2201['shift']());}};_0x406da4(++_0x50243f);}(_0x82d3,0xa4));var _0x382d=function(_0x11e031,_0x52ce0e){_0x11e031=_0x11e031-0x0;var _0xa8cf0b=_0x82d3[_0x11e031];return _0xa8cf0b;};'use strict';var _=require('lodash');var util=require(_0x382d('0x0'));var logger=require(_0x382d('0x1'))(_0x382d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x382d('0x3'));var rimraf=require(_0x382d('0x4'));var config=require(_0x382d('0x5'));var attributes=require('./setting.attributes');module[_0x382d('0x6')]=function(_0xebe77d,_0x1429f1){return _0xebe77d[_0x382d('0x7')]('Setting',attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd03a=['./setting.attributes','define','Setting','settings','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd03a,0x13c));var _0xad03=function(_0xf62d6d,_0x219cf7){_0xf62d6d=_0xf62d6d-0x0;var _0x54fab8=_0xd03a[_0xf62d6d];return _0x54fab8;};'use strict';var _=require(_0xad03('0x0'));var util=require('util');var logger=require(_0xad03('0x1'))('api');var moment=require(_0xad03('0x2'));var BPromise=require(_0xad03('0x3'));var rp=require(_0xad03('0x4'));var fs=require('fs');var path=require(_0xad03('0x5'));var rimraf=require(_0xad03('0x6'));var config=require(_0xad03('0x7'));var attributes=require(_0xad03('0x8'));module['exports']=function(_0x2cdd81,_0x18f692){return _0x2cdd81[_0xad03('0x9')](_0xad03('0xa'),attributes,{'tableName':_0xad03('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 9f118a5..13dc864 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 _0x08a4=['info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','Setting,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x391430,_0x4544b0){var _0x174eef=function(_0x7ffcca){while(--_0x7ffcca){_0x391430['push'](_0x391430['shift']());}};_0x174eef(++_0x4544b0);}(_0x08a4,0xda));var _0x408a=function(_0x44c236,_0x4ed5a1){_0x44c236=_0x44c236-0x0;var _0x39fbb7=_0x08a4[_0x44c236];return _0x39fbb7;};'use strict';var _=require(_0x408a('0x0'));var util=require(_0x408a('0x1'));var moment=require(_0x408a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x408a('0x3'));var db=require(_0x408a('0x4'))['db'];var utils=require(_0x408a('0x5'));var logger=require(_0x408a('0x6'))(_0x408a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x408a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26a801,_0x3987fd,_0x16e665){return new BPromise(function(_0x2354b4,_0x2f8703){return client[_0x408a('0x9')](_0x26a801,_0x16e665)['then'](function(_0x104932){logger[_0x408a('0xa')]('Setting,\x20%s,\x20%s',_0x3987fd,_0x408a('0xb'));logger['debug'](_0x408a('0xc'),_0x3987fd,_0x408a('0xb'),JSON[_0x408a('0xd')](_0x104932));if(_0x104932['error']){if(_0x104932['error'][_0x408a('0xe')]===0x1f4){logger[_0x408a('0xf')](_0x408a('0x10'),_0x3987fd,_0x104932[_0x408a('0xf')]['message']);return _0x2f8703(_0x104932[_0x408a('0xf')][_0x408a('0x11')]);}logger[_0x408a('0xf')](_0x408a('0x10'),_0x3987fd,_0x104932[_0x408a('0xf')]['message']);return _0x2354b4(_0x104932[_0x408a('0xf')][_0x408a('0x11')]);}else{logger[_0x408a('0xa')](_0x408a('0x10'),_0x3987fd,_0x408a('0xb'));_0x2354b4(_0x104932[_0x408a('0x12')][_0x408a('0x11')]);}})['catch'](function(_0x4473cf){logger[_0x408a('0xf')](_0x408a('0x10'),_0x3987fd,_0x4473cf);_0x2f8703(_0x4473cf);});});} \ No newline at end of file +var _0xe799=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xe799,0x1d4));var _0x9e79=function(_0x347a46,_0x3f8c53){_0x347a46=_0x347a46-0x0;var _0x3d7a1b=_0xe799[_0x347a46];return _0x3d7a1b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9e79('0x0'));var BPromise=require('bluebird');var rs=require(_0x9e79('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e79('0x2'));var logger=require(_0x9e79('0x3'))('rpc');var config=require(_0x9e79('0x4'));var jayson=require(_0x9e79('0x5'));var client=jayson['client'][_0x9e79('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1a8446,_0x199a3a,_0x53a189){return new BPromise(function(_0x51e147,_0x1ffdc0){return client[_0x9e79('0x7')](_0x1a8446,_0x53a189)[_0x9e79('0x8')](function(_0x4cce15){logger[_0x9e79('0x9')](_0x9e79('0xa'),_0x199a3a,_0x9e79('0xb'));logger[_0x9e79('0xc')](_0x9e79('0xd'),_0x199a3a,'request\x20sent',JSON[_0x9e79('0xe')](_0x4cce15));if(_0x4cce15[_0x9e79('0xf')]){if(_0x4cce15[_0x9e79('0xf')][_0x9e79('0x10')]===0x1f4){logger[_0x9e79('0xf')]('Setting,\x20%s,\x20%s',_0x199a3a,_0x4cce15[_0x9e79('0xf')]['message']);return _0x1ffdc0(_0x4cce15[_0x9e79('0xf')][_0x9e79('0x11')]);}logger[_0x9e79('0xf')](_0x9e79('0xa'),_0x199a3a,_0x4cce15['error'][_0x9e79('0x11')]);return _0x51e147(_0x4cce15[_0x9e79('0xf')][_0x9e79('0x11')]);}else{logger['info'](_0x9e79('0xa'),_0x199a3a,_0x9e79('0xb'));_0x51e147(_0x4cce15['result'][_0x9e79('0x11')]);}})[_0x9e79('0x12')](function(_0x3cc621){logger[_0x9e79('0xf')](_0x9e79('0xa'),_0x199a3a,_0x3cc621);_0x1ffdc0(_0x3cc621);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 40e9c41..39a3bd4 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 _0x5fe0=['../../config/environment','./smsAccount.controller','get','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','/:id/send','send','/:id/status','addAgents','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','util','path','express','Router','../../components/auth/service'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x5fe0,0x70));var _0x05fe=function(_0x32fc64,_0x177670){_0x32fc64=_0x32fc64-0x0;var _0x5b9285=_0x5fe0[_0x32fc64];return _0x5b9285;};'use strict';var multer=require('multer');var util=require(_0x05fe('0x0'));var path=require(_0x05fe('0x1'));var timeout=require('connect-timeout');var express=require(_0x05fe('0x2'));var router=express[_0x05fe('0x3')]();var auth=require(_0x05fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x05fe('0x5'));var controller=require(_0x05fe('0x6'));router[_0x05fe('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x05fe('0x7')](_0x05fe('0x8'),auth['isAuthenticated'](),controller[_0x05fe('0x9')]);router[_0x05fe('0x7')](_0x05fe('0xa'),auth['isAuthenticated'](),controller[_0x05fe('0xb')]);router[_0x05fe('0x7')](_0x05fe('0xc'),auth[_0x05fe('0xd')](),controller[_0x05fe('0xe')]);router[_0x05fe('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x05fe('0xf')]);router[_0x05fe('0x7')](_0x05fe('0x10'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x11')]);router[_0x05fe('0x7')](_0x05fe('0x12'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x13')]);router['get']('/:id/status',controller[_0x05fe('0x14')]);router[_0x05fe('0x7')](_0x05fe('0x15'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x16')]);router[_0x05fe('0x17')]('/',auth[_0x05fe('0xd')](),controller[_0x05fe('0x18')]);router['post'](_0x05fe('0xc'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x19')]);router[_0x05fe('0x17')]('/:id/canned_answers',auth[_0x05fe('0xd')](),controller['addAnswer']);router[_0x05fe('0x17')](_0x05fe('0x1a'),controller[_0x05fe('0x1b')]);router[_0x05fe('0x17')]('/:id/applications',auth[_0x05fe('0xd')](),controller[_0x05fe('0x1c')]);router[_0x05fe('0x17')](_0x05fe('0x1d'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x1e')]);router[_0x05fe('0x17')](_0x05fe('0x1f'),controller['status']);router['post'](_0x05fe('0x15'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x20')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x05fe('0x21')]);router[_0x05fe('0x22')](_0x05fe('0xa'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x23')]);router['delete'](_0x05fe('0xc'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x24')]);router['delete'](_0x05fe('0x25'),auth[_0x05fe('0xd')](),controller[_0x05fe('0x26')]);router['delete']('/:id/users',auth[_0x05fe('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xb50c=['create','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','put','/:id','destroy','removeDispositions','delete','removeAnswers','exports','multer','path','connect-timeout','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb50c,0x1f1));var _0xcb50=function(_0x4fc333,_0xd957db){_0x4fc333=_0x4fc333-0x0;var _0x3a93f3=_0xb50c[_0x4fc333];return _0x3a93f3;};'use strict';var multer=require(_0xcb50('0x0'));var util=require('util');var path=require(_0xcb50('0x1'));var timeout=require(_0xcb50('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcb50('0x3'));var config=require('../../config/environment');var controller=require('./smsAccount.controller');router[_0xcb50('0x4')]('/',auth[_0xcb50('0x5')](),controller[_0xcb50('0x6')]);router[_0xcb50('0x4')](_0xcb50('0x7'),auth[_0xcb50('0x5')](),controller[_0xcb50('0x8')]);router[_0xcb50('0x4')]('/:id',auth[_0xcb50('0x5')](),controller[_0xcb50('0x9')]);router['get'](_0xcb50('0xa'),auth[_0xcb50('0x5')](),controller['getDispositions']);router[_0xcb50('0x4')](_0xcb50('0xb'),auth[_0xcb50('0x5')](),controller[_0xcb50('0xc')]);router[_0xcb50('0x4')](_0xcb50('0xd'),auth[_0xcb50('0x5')](),controller[_0xcb50('0xe')]);router[_0xcb50('0x4')](_0xcb50('0xf'),auth[_0xcb50('0x5')](),controller[_0xcb50('0x10')]);router[_0xcb50('0x4')](_0xcb50('0x11'),controller[_0xcb50('0x12')]);router[_0xcb50('0x4')](_0xcb50('0x13'),auth[_0xcb50('0x5')](),controller[_0xcb50('0x14')]);router['post']('/',auth[_0xcb50('0x5')](),controller[_0xcb50('0x15')]);router[_0xcb50('0x16')](_0xcb50('0xa'),auth[_0xcb50('0x5')](),controller[_0xcb50('0x17')]);router[_0xcb50('0x16')](_0xcb50('0xb'),auth[_0xcb50('0x5')](),controller[_0xcb50('0x18')]);router['post'](_0xcb50('0x19'),controller[_0xcb50('0x1a')]);router[_0xcb50('0x16')](_0xcb50('0xd'),auth['isAuthenticated'](),controller[_0xcb50('0x1b')]);router[_0xcb50('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0xcb50('0x1c')]);router[_0xcb50('0x16')](_0xcb50('0x11'),controller[_0xcb50('0x1d')]);router[_0xcb50('0x16')](_0xcb50('0x13'),auth[_0xcb50('0x5')](),controller['addAgents']);router[_0xcb50('0x1e')](_0xcb50('0x1f'),auth[_0xcb50('0x5')](),controller['update']);router['delete'](_0xcb50('0x1f'),auth[_0xcb50('0x5')](),controller[_0xcb50('0x20')]);router['delete'](_0xcb50('0xa'),auth[_0xcb50('0x5')](),controller[_0xcb50('0x21')]);router[_0xcb50('0x22')](_0xcb50('0xb'),auth['isAuthenticated'](),controller[_0xcb50('0x23')]);router[_0xcb50('0x22')]('/:id/users',auth[_0xcb50('0x5')](),controller['removeAgents']);module[_0xcb50('0x24')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 21460af..eb49228 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 _0x6f7a=['infobip','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','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo'];(function(_0x12309b,_0x59dd8c){var _0x482e4d=function(_0x308407){while(--_0x308407){_0x12309b['push'](_0x12309b['shift']());}};_0x482e4d(++_0x59dd8c);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1f21c5,_0x54d366){_0x1f21c5=_0x1f21c5-0x0;var _0x99ed09=_0x6f7a[_0x1f21c5];return _0x99ed09;};'use strict';var Sequelize=require(_0xa6f7('0x0'));var rs=require(_0xa6f7('0x1'));module[_0xa6f7('0x2')]={'name':{'type':Sequelize[_0xa6f7('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xa6f7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa6f7('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa6f7('0x3')],'defaultValue':function(){return rs[_0xa6f7('0x4')]();}},'phone':{'type':Sequelize[_0xa6f7('0x3')]},'type':{'type':Sequelize[_0xa6f7('0x5')](_0xa6f7('0x6'),_0xa6f7('0x7'),_0xa6f7('0x8'),_0xa6f7('0x9'),_0xa6f7('0xa'),'clickatell','csc',_0xa6f7('0xb'),_0xa6f7('0xc'))},'accountSid':{'type':Sequelize[_0xa6f7('0x3')]},'authId':{'type':Sequelize[_0xa6f7('0x3')]},'authToken':{'type':Sequelize[_0xa6f7('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa6f7('0x3')]},'apiKey':{'type':Sequelize[_0xa6f7('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xa6f7('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa6f7('0xe')],'defaultValue':function(){return _0xa6f7('0xf');}},'notificationSound':{'type':Sequelize[_0xa6f7('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa6f7('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa6f7('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa6f7('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa6f7('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa6f7('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa6f7('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa6f7('0x12'),'set':function(_0x57308a){if(!_0x57308a)this[_0xa6f7('0x13')](_0xa6f7('0x14'),null);this[_0xa6f7('0x13')]('mandatoryDisposition',_0x57308a);}}}; \ No newline at end of file +var _0xa8a8=['twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2a4ebf,_0x1466ea){_0x2a4ebf=_0x2a4ebf-0x0;var _0x1baefc=_0xa8a8[_0x2a4ebf];return _0x1baefc;};'use strict';var Sequelize=require(_0x8a8a('0x0'));var rs=require(_0x8a8a('0x1'));module[_0x8a8a('0x2')]={'name':{'type':Sequelize[_0x8a8a('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8a8a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8a8a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x8a8a('0x3')],'defaultValue':function(){return rs[_0x8a8a('0x4')]();}},'phone':{'type':Sequelize[_0x8a8a('0x3')]},'type':{'type':Sequelize[_0x8a8a('0x5')](_0x8a8a('0x6'),_0x8a8a('0x7'),_0x8a8a('0x8'),_0x8a8a('0x9'),_0x8a8a('0xa'),_0x8a8a('0xb'),_0x8a8a('0xc'),_0x8a8a('0xd'),_0x8a8a('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8a8a('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x8a8a('0x3')]},'password':{'type':Sequelize[_0x8a8a('0x3')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x8a8a('0x3')]},'deliveryReport':{'type':Sequelize[_0x8a8a('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x8a8a('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8a8a('0x10');}},'notificationSound':{'type':Sequelize[_0x8a8a('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8a8a('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8a8a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8a8a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8a8a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8a8a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8a8a('0x11')],'comment':_0x8a8a('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x8a8a('0xf')],'defaultValue':![],'comment':_0x8a8a('0x13'),'set':function(_0x16d38d){if(!_0x16d38d)this['setDataValue'](_0x8a8a('0x14'),null);this['setDataValue'](_0x8a8a('0x15'),_0x16d38d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1eea3c6..f520a64 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 _0xa4a6=['keys','filters','intersection','attributes','fields','length','query','nolimit','order','sort','where','filter','map','type','key','VIRTUAL','field','options','SmsAccount','include','rows','params','rawAttributes','merge','find','create','user','role','UserProfileSection','autoAssociation','UserProfileResource','update','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','sms','Applications','account','applications','orderBy','asc','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','From','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','sequelize','SmsApplication','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','message_id','status_code','groupName','DELIVERED','clickatell','redif','error_code','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../config/utils','../../config/environment','redis','localhost','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~!@#$%^&-_=+[{]}.','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','destroy','get','SmsAccounts','end','name','send','Pause','mandatoryDispositionPause','model'];(function(_0x42acf7,_0x31ba83){var _0x4bff7a=function(_0x173da4){while(--_0x173da4){_0x42acf7['push'](_0x42acf7['shift']());}};_0x4bff7a(++_0x31ba83);}(_0xa4a6,0xa0));var _0x6a4a=function(_0x59faba,_0x684598){_0x59faba=_0x59faba-0x0;var _0x1fa72f=_0xa4a6[_0x59faba];return _0x1fa72f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6a4a('0x0'));var rimraf=require(_0x6a4a('0x1'));var zipdir=require(_0x6a4a('0x2'));var jsonpatch=require(_0x6a4a('0x3'));var rp=require(_0x6a4a('0x4'));var moment=require(_0x6a4a('0x5'));var BPromise=require(_0x6a4a('0x6'));var Mustache=require(_0x6a4a('0x7'));var util=require(_0x6a4a('0x8'));var path=require(_0x6a4a('0x9'));var sox=require(_0x6a4a('0xa'));var csv=require(_0x6a4a('0xb'));var ejs=require(_0x6a4a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a4a('0xd'));var crypto=require(_0x6a4a('0xe'));var jsforce=require(_0x6a4a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6a4a('0xb'));var querystring=require('querystring');var Papa=require(_0x6a4a('0x10'));var Redis=require(_0x6a4a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6a4a('0x12'));var config=require(_0x6a4a('0x13'));var db=require('../../mysqldb')['db'];config[_0x6a4a('0x14')]=_['defaults'](config[_0x6a4a('0x14')],{'host':_0x6a4a('0x15'),'port':0x18eb});var socket=require(_0x6a4a('0x16'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x6a4a('0x17')](socket);var jayson=require(_0x6a4a('0x18'));var client=jayson[_0x6a4a('0x19')][_0x6a4a('0x1a')]({'port':0x232c});function checkPasswordPattern(_0xeea76a,_0x2e4abf,_0x145fb1){if(_0x145fb1){var _0x18f851=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18f851[_0x6a4a('0x1b')](_0x2e4abf)){return _0xeea76a;}else{throw new db[(_0x6a4a('0x1c'))]['ValidationError'](_0x6a4a('0x1d'));}}else{return _0xeea76a;}}function respondWithRpcPromise(_0x1654a6,_0x3a3c3a,_0x65e8f2,_0x2ecfa6){return new BPromise(function(_0x421daf,_0x5c7de1){var _0x18ca77=_0x2ecfa6||client;return _0x18ca77['request'](_0x1654a6,_0x65e8f2)[_0x6a4a('0x1e')](function(_0x345016){logger[_0x6a4a('0x1f')](_0x6a4a('0x20'),_0x3a3c3a,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3a3c3a,_0x6a4a('0x21'),JSON[_0x6a4a('0x22')](_0x345016));if(_0x345016['error']){if(_0x345016['error'][_0x6a4a('0x23')]===0x1f4){logger['error'](_0x6a4a('0x20'),_0x3a3c3a,_0x345016['error'][_0x6a4a('0x24')]);return _0x5c7de1(_0x345016[_0x6a4a('0x25')]['message']);}logger[_0x6a4a('0x25')](_0x6a4a('0x20'),_0x3a3c3a,_0x345016[_0x6a4a('0x25')][_0x6a4a('0x24')]);return _0x421daf(_0x345016[_0x6a4a('0x25')][_0x6a4a('0x24')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x3a3c3a,'request\x20sent');_0x421daf(_0x345016[_0x6a4a('0x26')][_0x6a4a('0x24')]);}})[_0x6a4a('0x27')](function(_0x21ea17){logger['error'](_0x6a4a('0x20'),_0x3a3c3a,_0x21ea17);_0x5c7de1(_0x21ea17);});});}function respondWithStatusCode(_0x3a2156,_0xe89df3){_0xe89df3=_0xe89df3||0xcc;return function(_0x5da798){if(_0x5da798){return _0x3a2156[_0x6a4a('0x28')](_0xe89df3);}return _0x3a2156[_0x6a4a('0x29')](_0xe89df3)['end']();};}function respondWithResult(_0xac6b33,_0x25d45c){_0x25d45c=_0x25d45c||0xc8;return function(_0x1f2602){if(_0x1f2602){return _0xac6b33['status'](_0x25d45c)[_0x6a4a('0x2a')](_0x1f2602);}};}function respondWithFilteredResult(_0x4957bf,_0x595a55){return function(_0x4ffdd2){if(_0x4ffdd2){var _0x5d0cba=_0x4ffdd2[_0x6a4a('0x2b')],_0x2b48ec=_0x595a55['offset'],_0x3bf76a=_0x595a55[_0x6a4a('0x2c')]+_0x595a55[_0x6a4a('0x2d')],_0x19e1c1;if(_0x3bf76a>=_0x5d0cba){_0x3bf76a=_0x5d0cba;_0x19e1c1=0xc8;}else{_0x19e1c1=0xce;}_0x4957bf[_0x6a4a('0x29')](_0x19e1c1);return _0x4957bf['set'](_0x6a4a('0x2e'),_0x2b48ec+'-'+_0x3bf76a+'/'+_0x5d0cba)['json'](_0x4ffdd2);}return null;};}function patchUpdates(_0x456b79){return function(_0x808429){try{jsonpatch[_0x6a4a('0x2f')](_0x808429,_0x456b79,!![]);}catch(_0x189508){return BPromise['reject'](_0x189508);}return _0x808429[_0x6a4a('0x30')]();};}function saveUpdates(_0x4cf85c,_0x46f655){return function(_0x15dec2){if(_0x15dec2){return _0x15dec2['update'](_0x4cf85c)[_0x6a4a('0x1e')](function(_0x2b6c67){return _0x2b6c67;});}return null;};}function removeEntity(_0x3e32f9,_0x501498){return function(_0x4feba3){if(_0x4feba3){return _0x4feba3[_0x6a4a('0x31')]()['then'](function(){var _0x2ab370=_0x4feba3[_0x6a4a('0x32')]({'plain':!![]});var _0x595de4=_0x6a4a('0x33');return db['UserProfileResource'][_0x6a4a('0x31')]({'where':{'type':_0x595de4,'resourceId':_0x2ab370['id']}})[_0x6a4a('0x1e')](function(){return _0x4feba3;});})[_0x6a4a('0x1e')](function(){_0x3e32f9['status'](0xcc)[_0x6a4a('0x34')]();});}};}function handleEntityNotFound(_0x44ddbe,_0x82879d){return function(_0x1819c4){if(!_0x1819c4){_0x44ddbe['sendStatus'](0x194);}return _0x1819c4;};}function handleError(_0xa767e,_0xb201e8){_0xb201e8=_0xb201e8||0x1f4;return function(_0x3a395c){logger[_0x6a4a('0x25')](_0x3a395c['stack']);if(_0x3a395c[_0x6a4a('0x35')]){delete _0x3a395c[_0x6a4a('0x35')];}_0xa767e[_0x6a4a('0x29')](_0xb201e8)[_0x6a4a('0x36')](_0x3a395c);};}exports['index']=function(_0x6527d5,_0x1cfb98){var _0x3c7a77={'include':[{'model':db[_0x6a4a('0x37')],'as':_0x6a4a('0x38')}]},_0x1e5d08={},_0x155bb9={'count':0x0,'rows':[]};var _0x147e83=db['SmsAccount']['rawAttributes'];_0x1e5d08[_0x6a4a('0x39')]=_[_0x6a4a('0x3a')](_0x147e83);_0x1e5d08['query']=_[_0x6a4a('0x3a')](_0x6527d5['query']);_0x1e5d08[_0x6a4a('0x3b')]=_[_0x6a4a('0x3c')](_0x1e5d08[_0x6a4a('0x39')],_0x1e5d08['query']);_0x3c7a77[_0x6a4a('0x3d')]=_['intersection'](_0x1e5d08['model'],qs[_0x6a4a('0x3e')](_0x6527d5['query'][_0x6a4a('0x3e')]));_0x3c7a77[_0x6a4a('0x3d')]=_0x3c7a77[_0x6a4a('0x3d')][_0x6a4a('0x3f')]?_0x3c7a77[_0x6a4a('0x3d')]:_0x1e5d08[_0x6a4a('0x39')];if(!_0x6527d5[_0x6a4a('0x40')]['hasOwnProperty'](_0x6a4a('0x41'))){_0x3c7a77[_0x6a4a('0x2d')]=qs['limit'](_0x6527d5[_0x6a4a('0x40')][_0x6a4a('0x2d')]);_0x3c7a77['offset']=qs[_0x6a4a('0x2c')](_0x6527d5[_0x6a4a('0x40')][_0x6a4a('0x2c')]);}_0x3c7a77[_0x6a4a('0x42')]=qs[_0x6a4a('0x43')](_0x6527d5[_0x6a4a('0x40')][_0x6a4a('0x43')]);_0x3c7a77[_0x6a4a('0x44')]=qs[_0x6a4a('0x3b')](_['pick'](_0x6527d5[_0x6a4a('0x40')],_0x1e5d08[_0x6a4a('0x3b')]));if(_0x6527d5['query'][_0x6a4a('0x45')]){_0x3c7a77['where']=_['merge'](_0x3c7a77[_0x6a4a('0x44')],{'$or':_[_0x6a4a('0x46')](_0x147e83,function(_0xe499d){if(_0xe499d[_0x6a4a('0x47')][_0x6a4a('0x48')]!==_0x6a4a('0x49')){var _0x2f5282={};_0x2f5282[_0xe499d[_0x6a4a('0x4a')]]={'$like':'%'+_0x6527d5['query'][_0x6a4a('0x45')]+'%'};return _0x2f5282;}})});}_0x3c7a77=_['merge']({},_0x3c7a77,_0x6527d5[_0x6a4a('0x4b')]);var _0xa1ef06={'where':_0x3c7a77['where']};return db[_0x6a4a('0x4c')][_0x6a4a('0x2b')](_0xa1ef06)[_0x6a4a('0x1e')](function(_0x68e741){_0x155bb9['count']=_0x68e741;if(_0x6527d5[_0x6a4a('0x40')]['includeAll']){_0x3c7a77[_0x6a4a('0x4d')]=[{'all':!![]}];}return db[_0x6a4a('0x4c')]['findAll'](_0x3c7a77);})[_0x6a4a('0x1e')](function(_0x5081b8){_0x155bb9[_0x6a4a('0x4e')]=_0x5081b8;return _0x155bb9;})[_0x6a4a('0x1e')](respondWithFilteredResult(_0x1cfb98,_0x3c7a77))[_0x6a4a('0x27')](handleError(_0x1cfb98,null));};exports['show']=function(_0x4e05f6,_0x3ccb5a){var _0x3e92db={'raw':![],'where':{'id':_0x4e05f6[_0x6a4a('0x4f')]['id']},'include':[{'model':db[_0x6a4a('0x37')],'as':_0x6a4a('0x38')}]},_0x2cf8cd={};_0x2cf8cd[_0x6a4a('0x39')]=_[_0x6a4a('0x3a')](db[_0x6a4a('0x4c')][_0x6a4a('0x50')]);_0x2cf8cd[_0x6a4a('0x40')]=_[_0x6a4a('0x3a')](_0x4e05f6['query']);_0x2cf8cd[_0x6a4a('0x3b')]=_['intersection'](_0x2cf8cd[_0x6a4a('0x39')],_0x2cf8cd[_0x6a4a('0x40')]);_0x3e92db[_0x6a4a('0x3d')]=_['intersection'](_0x2cf8cd['model'],qs[_0x6a4a('0x3e')](_0x4e05f6[_0x6a4a('0x40')][_0x6a4a('0x3e')]));_0x3e92db[_0x6a4a('0x3d')]=_0x3e92db['attributes'][_0x6a4a('0x3f')]?_0x3e92db[_0x6a4a('0x3d')]:_0x2cf8cd[_0x6a4a('0x39')];if(_0x4e05f6[_0x6a4a('0x40')]['includeAll']){_0x3e92db[_0x6a4a('0x4d')]=[{'all':!![]}];}_0x3e92db=_[_0x6a4a('0x51')]({},_0x3e92db,_0x4e05f6[_0x6a4a('0x4b')]);return db[_0x6a4a('0x4c')][_0x6a4a('0x52')](_0x3e92db)[_0x6a4a('0x1e')](handleEntityNotFound(_0x3ccb5a,null))['then'](respondWithResult(_0x3ccb5a,null))[_0x6a4a('0x27')](handleError(_0x3ccb5a,null));};exports[_0x6a4a('0x53')]=function(_0x38ff60,_0x4b147a){return db['SmsAccount'][_0x6a4a('0x53')](_0x38ff60['body'],{})[_0x6a4a('0x1e')](function(_0x498850){var _0x285750=_0x38ff60[_0x6a4a('0x54')][_0x6a4a('0x32')]({'plain':!![]});if(!_0x285750)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x285750[_0x6a4a('0x55')]===_0x6a4a('0x54')){var _0x26668e=_0x498850[_0x6a4a('0x32')]({'plain':!![]});var _0xa8a155='SmsAccounts';return db[_0x6a4a('0x56')]['find']({'where':{'name':_0xa8a155,'userProfileId':_0x285750['userProfileId']},'raw':!![]})[_0x6a4a('0x1e')](function(_0x26c0e5){if(_0x26c0e5&&_0x26c0e5[_0x6a4a('0x57')]===0x0){return db[_0x6a4a('0x58')][_0x6a4a('0x53')]({'name':_0x26668e[_0x6a4a('0x35')],'resourceId':_0x26668e['id'],'type':_0x26c0e5[_0x6a4a('0x35')],'sectionId':_0x26c0e5['id']},{})[_0x6a4a('0x1e')](function(){return _0x498850;});}else{return _0x498850;}})[_0x6a4a('0x27')](function(_0x30b88a){logger[_0x6a4a('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30b88a);throw _0x30b88a;});}return _0x498850;})[_0x6a4a('0x1e')](respondWithResult(_0x4b147a,0xc9))[_0x6a4a('0x27')](handleError(_0x4b147a,null));};exports[_0x6a4a('0x59')]=function(_0x382725,_0x33c957){if(_0x382725[_0x6a4a('0x5a')]['id']){delete _0x382725[_0x6a4a('0x5a')]['id'];}return db['SmsAccount'][_0x6a4a('0x52')]({'where':{'id':_0x382725['params']['id']},'include':[{'model':db[_0x6a4a('0x37')],'as':_0x6a4a('0x38')}]})[_0x6a4a('0x1e')](handleEntityNotFound(_0x33c957,null))[_0x6a4a('0x1e')](saveUpdates(_0x382725[_0x6a4a('0x5a')],null))[_0x6a4a('0x1e')](respondWithResult(_0x33c957,null))[_0x6a4a('0x27')](handleError(_0x33c957,null));};exports['destroy']=function(_0x52a10d,_0x24f988){return db[_0x6a4a('0x4c')]['find']({'where':{'id':_0x52a10d[_0x6a4a('0x4f')]['id']}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x24f988,null))[_0x6a4a('0x1e')](removeEntity(_0x24f988,null))[_0x6a4a('0x27')](handleError(_0x24f988,null));};exports['describe']=function(_0x3bca37,_0x47801b){return db[_0x6a4a('0x4c')][_0x6a4a('0x5b')]()['then'](respondWithResult(_0x47801b,null))['catch'](handleError(_0x47801b,null));};exports[_0x6a4a('0x5c')]=function(_0x68ee8f,_0x31a5e5,_0x4e6b04){if(_0x68ee8f[_0x6a4a('0x5a')]['id']){delete _0x68ee8f[_0x6a4a('0x5a')]['id'];}return db[_0x6a4a('0x4c')][_0x6a4a('0x52')]({'where':{'id':_0x68ee8f[_0x6a4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x31a5e5,null))[_0x6a4a('0x1e')](function(_0x1780c4){if(_0x1780c4){_0x68ee8f[_0x6a4a('0x5a')][_0x6a4a('0x5d')]=_0x1780c4['id'];return db[_0x6a4a('0x5e')][_0x6a4a('0x53')](_0x68ee8f[_0x6a4a('0x5a')]);}})[_0x6a4a('0x1e')](respondWithResult(_0x31a5e5,null))[_0x6a4a('0x27')](handleError(_0x31a5e5,null));};exports[_0x6a4a('0x5f')]=function(_0x2359f6,_0xba9e6d,_0x4b6abc){var _0x136f77={'raw':![],'where':{}};var _0x193d62={};var _0x1daefc={'count':0x0,'rows':[]};return db[_0x6a4a('0x4c')][_0x6a4a('0x60')]({'where':{'id':_0x2359f6[_0x6a4a('0x4f')]['id']}})[_0x6a4a('0x1e')](handleEntityNotFound(_0xba9e6d,null))['then'](function(_0x5dde1e){if(_0x5dde1e){_0x193d62[_0x6a4a('0x39')]=_[_0x6a4a('0x3a')](db[_0x6a4a('0x5e')][_0x6a4a('0x50')]);_0x193d62[_0x6a4a('0x40')]=_[_0x6a4a('0x3a')](_0x2359f6[_0x6a4a('0x40')]);_0x193d62[_0x6a4a('0x3b')]=_[_0x6a4a('0x3c')](_0x193d62[_0x6a4a('0x39')],_0x193d62[_0x6a4a('0x40')]);_0x136f77[_0x6a4a('0x3d')]=_['intersection'](_0x193d62[_0x6a4a('0x39')],qs[_0x6a4a('0x3e')](_0x2359f6[_0x6a4a('0x40')]['fields']));_0x136f77['attributes']=_0x136f77[_0x6a4a('0x3d')]['length']?_0x136f77[_0x6a4a('0x3d')]:_0x193d62[_0x6a4a('0x39')];if(!_0x2359f6['query'][_0x6a4a('0x61')](_0x6a4a('0x41'))){_0x136f77[_0x6a4a('0x2d')]=qs[_0x6a4a('0x2d')](_0x2359f6[_0x6a4a('0x40')]['limit']);_0x136f77['offset']=qs[_0x6a4a('0x2c')](_0x2359f6['query'][_0x6a4a('0x2c')]);}_0x136f77['order']=qs[_0x6a4a('0x43')](_0x2359f6[_0x6a4a('0x40')]['sort']);_0x136f77[_0x6a4a('0x44')]=qs[_0x6a4a('0x3b')](_[_0x6a4a('0x62')](_0x2359f6['query'],_0x193d62[_0x6a4a('0x3b')]));_0x136f77[_0x6a4a('0x44')][_0x6a4a('0x5d')]=_0x5dde1e['id'];if(_0x2359f6[_0x6a4a('0x40')]['filter']){_0x136f77[_0x6a4a('0x44')]=_['merge'](_0x136f77['where'],{'$or':_[_0x6a4a('0x46')](_0x136f77[_0x6a4a('0x3d')],function(_0x59b984){var _0x4a14b3={};_0x4a14b3[_0x59b984]={'$like':'%'+_0x2359f6[_0x6a4a('0x40')]['filter']+'%'};return _0x4a14b3;})});}_0x136f77=_[_0x6a4a('0x51')]({},_0x136f77,_0x2359f6['options']);return db['Disposition'][_0x6a4a('0x2b')]({'where':_0x136f77[_0x6a4a('0x44')]})[_0x6a4a('0x1e')](function(_0x1fd23f){_0x1daefc[_0x6a4a('0x2b')]=_0x1fd23f;if(_0x2359f6['query'][_0x6a4a('0x63')]){_0x136f77[_0x6a4a('0x4d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x136f77);})[_0x6a4a('0x1e')](function(_0x406855){_0x1daefc['rows']=_0x406855;return _0x1daefc;});}})[_0x6a4a('0x1e')](respondWithFilteredResult(_0xba9e6d,_0x136f77))[_0x6a4a('0x27')](handleError(_0xba9e6d,null));};exports[_0x6a4a('0x64')]=function(_0x6fc6bf,_0x6bf1e1,_0x57c6fe){return db['SmsAccount'][_0x6a4a('0x52')]({'where':{'id':_0x6fc6bf['params']['id']}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x6bf1e1,null))[_0x6a4a('0x1e')](function(_0x31d889){if(_0x31d889){return _0x31d889[_0x6a4a('0x64')](_0x6fc6bf[_0x6a4a('0x40')][_0x6a4a('0x65')]);}})[_0x6a4a('0x1e')](respondWithStatusCode(_0x6bf1e1,null))[_0x6a4a('0x27')](handleError(_0x6bf1e1,null));};exports[_0x6a4a('0x66')]=function(_0x324ddd,_0x504013,_0x7862e4){if(_0x324ddd[_0x6a4a('0x5a')]['id']){delete _0x324ddd[_0x6a4a('0x5a')]['id'];}return db[_0x6a4a('0x4c')][_0x6a4a('0x52')]({'where':{'id':_0x324ddd[_0x6a4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x504013,null))[_0x6a4a('0x1e')](function(_0x53fb58){if(_0x53fb58){_0x324ddd[_0x6a4a('0x5a')][_0x6a4a('0x5d')]=_0x53fb58['id'];return db[_0x6a4a('0x67')][_0x6a4a('0x53')](_0x324ddd[_0x6a4a('0x5a')]);}})[_0x6a4a('0x1e')](respondWithResult(_0x504013,null))[_0x6a4a('0x27')](handleError(_0x504013,null));};exports[_0x6a4a('0x68')]=function(_0x157b6d,_0x1afbdd,_0x19a737){var _0x44d413={'raw':![],'where':{}};var _0x225f4b={};var _0x1fa854={'count':0x0,'rows':[]};return db[_0x6a4a('0x4c')][_0x6a4a('0x60')]({'where':{'id':_0x157b6d[_0x6a4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1afbdd,null))[_0x6a4a('0x1e')](function(_0x5c5a29){if(_0x5c5a29){_0x225f4b[_0x6a4a('0x39')]=_[_0x6a4a('0x3a')](db['CannedAnswer'][_0x6a4a('0x50')]);_0x225f4b[_0x6a4a('0x40')]=_[_0x6a4a('0x3a')](_0x157b6d[_0x6a4a('0x40')]);_0x225f4b['filters']=_[_0x6a4a('0x3c')](_0x225f4b[_0x6a4a('0x39')],_0x225f4b[_0x6a4a('0x40')]);_0x44d413[_0x6a4a('0x3d')]=_[_0x6a4a('0x3c')](_0x225f4b[_0x6a4a('0x39')],qs[_0x6a4a('0x3e')](_0x157b6d[_0x6a4a('0x40')]['fields']));_0x44d413[_0x6a4a('0x3d')]=_0x44d413[_0x6a4a('0x3d')][_0x6a4a('0x3f')]?_0x44d413[_0x6a4a('0x3d')]:_0x225f4b['model'];if(!_0x157b6d['query'][_0x6a4a('0x61')](_0x6a4a('0x41'))){_0x44d413[_0x6a4a('0x2d')]=qs[_0x6a4a('0x2d')](_0x157b6d[_0x6a4a('0x40')][_0x6a4a('0x2d')]);_0x44d413['offset']=qs[_0x6a4a('0x2c')](_0x157b6d[_0x6a4a('0x40')][_0x6a4a('0x2c')]);}_0x44d413[_0x6a4a('0x42')]=qs[_0x6a4a('0x43')](_0x157b6d['query'][_0x6a4a('0x43')]);_0x44d413[_0x6a4a('0x44')]=qs[_0x6a4a('0x3b')](_[_0x6a4a('0x62')](_0x157b6d['query'],_0x225f4b['filters']));_0x44d413['where'][_0x6a4a('0x5d')]=_0x5c5a29['id'];if(_0x157b6d[_0x6a4a('0x40')][_0x6a4a('0x45')]){_0x44d413['where']=_[_0x6a4a('0x51')](_0x44d413[_0x6a4a('0x44')],{'$or':_[_0x6a4a('0x46')](_0x44d413[_0x6a4a('0x3d')],function(_0x2a89b5){var _0x3e6311={};_0x3e6311[_0x2a89b5]={'$like':'%'+_0x157b6d[_0x6a4a('0x40')][_0x6a4a('0x45')]+'%'};return _0x3e6311;})});}_0x44d413=_['merge']({},_0x44d413,_0x157b6d[_0x6a4a('0x4b')]);return db['CannedAnswer']['count']({'where':_0x44d413[_0x6a4a('0x44')]})['then'](function(_0x3da129){_0x1fa854[_0x6a4a('0x2b')]=_0x3da129;if(_0x157b6d[_0x6a4a('0x40')][_0x6a4a('0x63')]){_0x44d413[_0x6a4a('0x4d')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6a4a('0x69')](_0x44d413);})[_0x6a4a('0x1e')](function(_0x15a031){_0x1fa854[_0x6a4a('0x4e')]=_0x15a031;return _0x1fa854;});}})[_0x6a4a('0x1e')](respondWithFilteredResult(_0x1afbdd,_0x44d413))[_0x6a4a('0x27')](handleError(_0x1afbdd,null));};exports[_0x6a4a('0x6a')]=function(_0x4408b4,_0x496c14,_0x17006f){return db[_0x6a4a('0x4c')]['find']({'where':{'id':_0x4408b4[_0x6a4a('0x4f')]['id']}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x496c14,null))[_0x6a4a('0x1e')](function(_0x4e1c9d){if(_0x4e1c9d){return _0x4e1c9d[_0x6a4a('0x6a')](_0x4408b4[_0x6a4a('0x40')][_0x6a4a('0x65')]);}})[_0x6a4a('0x1e')](respondWithStatusCode(_0x496c14,null))['catch'](handleError(_0x496c14,null));};exports['notify']=function(_0x712e92,_0x4fa080,_0x475c55){var _0x4d18d0={'channel':_0x6a4a('0x6b')};var _0x40f049=[];var _0x4888ec=[];var _0x8814b2={};return db['SmsAccount'][_0x6a4a('0x52')]({'where':{'id':_0x712e92[_0x6a4a('0x4f')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x6a4a('0x6c')}]})[_0x6a4a('0x1e')](handleEntityNotFound(_0x4fa080,null))[_0x6a4a('0x1e')](function(_0x5e06d5){_0x4d18d0[_0x6a4a('0x6d')]=_0x5e06d5;_0x4d18d0[_0x6a4a('0x6e')]=_[_0x6a4a('0x6f')](_0x5e06d5[_0x6a4a('0x6c')],['priority'],[_0x6a4a('0x70')]);if(_0x4d18d0[_0x6a4a('0x6d')][_0x6a4a('0x6c')]){delete _0x4d18d0[_0x6a4a('0x6d')][_0x6a4a('0x6c')];}return db['CmContact']['describe']();})[_0x6a4a('0x1e')](function(_0x180011){if(!_0x180011){throw new db[(_0x6a4a('0x1c'))][(_0x6a4a('0x71'))]('no\x20available\x20attributes');}_0x40f049=_[_0x6a4a('0x72')](_[_0x6a4a('0x3a')](_0x180011),['createdAt','updatedAt']);_0x4888ec=_[_0x6a4a('0x72')](_[_0x6a4a('0x3a')](_0x180011),[_0x6a4a('0x73'),_0x6a4a('0x74'),_0x6a4a('0x75'),_0x6a4a('0x76')]);_0x4d18d0[_0x6a4a('0x5a')]={'mapKey':_0x6a4a('0x77')};if(_0x4d18d0['account'][_0x6a4a('0x47')]){switch(_0x4d18d0['account'][_0x6a4a('0x47')]){case _0x6a4a('0x78'):_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')]=_0x712e92[_0x6a4a('0x5a')]['From'];_0x4d18d0[_0x6a4a('0x5a')]['body']=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x7a')];_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x7b')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x7c')];break;case _0x6a4a('0x7d'):_0x4d18d0[_0x6a4a('0x5a')]['from']='+'+_0x712e92['body'][_0x6a4a('0x7e')];_0x4d18d0[_0x6a4a('0x5a')]['body']=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x7f')];break;case _0x6a4a('0x80'):_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')]=_0x712e92[_0x6a4a('0x5a')]['from'];_0x4d18d0['body']['body']=_0x712e92['body']['message'];break;case _0x6a4a('0x81'):_0x4d18d0[_0x6a4a('0x5a')]['from']=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x79')];_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x5a')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x5a')];_0x4d18d0['body'][_0x6a4a('0x7b')]=_0x712e92[_0x6a4a('0x5a')]['message_id'];break;case'plivo':_0x4d18d0['body'][_0x6a4a('0x79')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x82')];_0x4d18d0[_0x6a4a('0x5a')]['body']=_0x712e92[_0x6a4a('0x5a')]['Text'];_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x7b')]=_0x712e92['body'][_0x6a4a('0x83')];break;case _0x6a4a('0x84'):_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')]='+'+_0x712e92['body'][_0x6a4a('0x85')][0x0]['from'];_0x4d18d0['body'][_0x6a4a('0x5a')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x85')][0x0][_0x6a4a('0x7f')];_0x4d18d0['body'][_0x6a4a('0x7b')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x85')][0x0][_0x6a4a('0x7b')];break;case _0x6a4a('0x86'):_0x4d18d0[_0x6a4a('0x5a')]['from']=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x87')];_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x5a')]=_0x712e92['body'][_0x6a4a('0x88')][_0x6a4a('0x24')];break;case'clickatell':_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x89')];_0x4d18d0['body'][_0x6a4a('0x5a')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x7f')];_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x7b')]=_0x712e92[_0x6a4a('0x5a')]['replyMessageId'];break;case _0x6a4a('0x8a'):_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x79')];_0x4d18d0['body'][_0x6a4a('0x5a')]=_0x712e92[_0x6a4a('0x5a')][_0x6a4a('0x24')];_0x4d18d0[_0x6a4a('0x5a')]['messageId']=_0x712e92['body'][_0x6a4a('0x8b')];break;}}if(_0x4d18d0[_0x6a4a('0x5a')]['id']){delete _0x4d18d0['body']['id'];}if(_['isNil'](_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')])){throw new db['Sequelize'][(_0x6a4a('0x71'))](_0x6a4a('0x8c'));}if(_[_0x6a4a('0x8d')](_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x5a')])||_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x5a')]===''){throw new db[(_0x6a4a('0x1c'))]['ValidationError'](_0x6a4a('0x8e'));}if(_[_0x6a4a('0x8d')](_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x8f')])){throw new db[(_0x6a4a('0x1c'))][(_0x6a4a('0x71'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4888ec);}if(!_['includes'](_0x4888ec,_0x4d18d0['body'][_0x6a4a('0x8f')])){throw new db['Sequelize'][(_0x6a4a('0x71'))](_0x6a4a('0x90')+_0x4888ec);}_0x8814b2[_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x8f')]]=_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')];return db[_0x6a4a('0x91')]['find']({'where':{'id':_0x4d18d0[_0x6a4a('0x6d')][_0x6a4a('0x76')]},'include':[{'model':db[_0x6a4a('0x92')],'as':'Contacts','where':_0x8814b2,'limit':0x1,'order':[[_0x6a4a('0x74'),_0x6a4a('0x93')]]}]});})['then'](handleEntityNotFound(_0x4fa080,null))[_0x6a4a('0x1e')](function(_0x1ab014){if(_0x1ab014){_0x4d18d0[_0x6a4a('0x94')]=_[_0x6a4a('0x95')](_0x1ab014,[_0x6a4a('0x96')]);if(_0x1ab014[_0x6a4a('0x96')][_0x6a4a('0x3f')]){return _0x1ab014[_0x6a4a('0x96')][0x0];}var _0x33237e=_[_0x6a4a('0x97')](_0x4d18d0['body'],{'firstName':_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')],'ListId':_0x1ab014['id']});_0x33237e[_0x4d18d0['body']['mapKey']]=_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0x79')];return db[_0x6a4a('0x92')][_0x6a4a('0x53')](_0x33237e,{'fields':_0x40f049,'raw':!![]});}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x4fa080,null))[_0x6a4a('0x1e')](function(_0x3fa227){if(_0x3fa227){_0x4d18d0[_0x6a4a('0x98')]=_0x3fa227;var _0x1d48d7={'ContactId':_0x3fa227['id'],'phone':_0x4d18d0['body'][_0x6a4a('0x79')],'SmsAccountId':_0x712e92[_0x6a4a('0x4f')]['id']};var _0x2db92f={'ContactId':_0x3fa227['id'],'SmsAccountId':_0x712e92['params']['id'],'closed':![]};return db[_0x6a4a('0x99')][_0x6a4a('0x52')]({'where':_0x2db92f})['then'](function(_0x15035a){if(_0x15035a){return[_0x15035a,![]];}return db[_0x6a4a('0x99')][_0x6a4a('0x53')](_0x1d48d7)[_0x6a4a('0x1e')](function(_0x8f1cb8){return[_0x8f1cb8,!![]];});});}})[_0x6a4a('0x9a')](function(_0x229dfb,_0x5c02f9){_0x4d18d0[_0x6a4a('0x9b')]=_0x229dfb[_0x6a4a('0x32')]({'plain':!![]});_0x4d18d0['interaction'][_0x6a4a('0x9c')]=![];if(_0x5c02f9){if(_0x4d18d0[_0x6a4a('0x6d')]['autoclose']){_0x4d18d0[_0x6a4a('0x6e')][_0x6a4a('0x9d')]({'id':0x0,'priority':_0x4d18d0[_0x6a4a('0x6e')]['length']+0x1,'app':_0x6a4a('0x9e'),'appdata':_0x6a4a('0x9f'),'interval':'*,*,*,*'});}_0x4d18d0[_0x6a4a('0x9b')][_0x6a4a('0x9c')]=!![];}return db['SmsMessage'][_0x6a4a('0x53')]({'phone':_0x4d18d0[_0x6a4a('0x5a')]['from'],'messageId':_0x4d18d0[_0x6a4a('0x5a')]['messageId'],'body':_0x4d18d0['body']['body'],'SmsAccountId':_0x712e92[_0x6a4a('0x4f')]['id'],'SmsInteractionId':_0x229dfb['id'],'direction':'in','ContactId':_0x229dfb['ContactId'],'AttachmentId':_0x4d18d0[_0x6a4a('0x5a')][_0x6a4a('0xa0')]});})[_0x6a4a('0x1e')](function(_0x4e0b21){_0x4d18d0[_0x6a4a('0x24')]=_0x4e0b21;if(_0x4d18d0[_0x6a4a('0x9b')][_0x6a4a('0xa1')]){return db[_0x6a4a('0xa2')][_0x6a4a('0x52')]({'attributes':['id',_0x6a4a('0x35')],'where':{'id':_0x4d18d0[_0x6a4a('0x9b')][_0x6a4a('0xa1')]}})['then'](function(_0x3ff5f9){if(_0x3ff5f9){_0x4d18d0['applications'][_0x6a4a('0xa3')]({'id':0x0,'priority':0x0,'app':_0x6a4a('0xa4'),'appdata':_0x3ff5f9[_0x6a4a('0x35')]+','+(_0x4d18d0[_0x6a4a('0x6d')][_0x6a4a('0xa5')]||0xa),'interval':_0x6a4a('0xa6')});}return respondWithRpcPromise(_0x6a4a('0xa7'),_0x6a4a('0xa8'),_0x4d18d0);});}return respondWithRpcPromise(_0x6a4a('0xa7'),_0x6a4a('0xa8'),_0x4d18d0);})['then'](function(_0x65e37){if(_0x65e37){var _0x4ee5d5=0xc8;var _0x26c874='receiveMessage';logger[_0x6a4a('0x1f')](_0x6a4a('0xa9'),_0x26c874,_0x4ee5d5,_0x6a4a('0xaa'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x26c874,_0x4ee5d5,_0x6a4a('0xaa'),JSON[_0x6a4a('0x22')](_0x65e37));if(_0x4d18d0['account']['type']===_0x6a4a('0x78')){return _0x4fa080[_0x6a4a('0x29')](_0x4ee5d5)[_0x6a4a('0xab')](_0x6a4a('0xac'),'text/xml')[_0x6a4a('0x36')]('\x0a');}else{return _0x4fa080[_0x6a4a('0x29')](_0x4ee5d5)[_0x6a4a('0x2a')](_0x65e37);}}})['catch'](handleError(_0x4fa080,null));};exports['addApplications']=function(_0x2d79ee,_0x17dbe6,_0x338c6e){return db['SmsAccount']['findOne']({'where':{'id':_0x2d79ee[_0x6a4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x17dbe6,null))[_0x6a4a('0x1e')](function(_0x55e032){if(_0x55e032){return db[_0x6a4a('0xad')]['transaction'](function(_0x6ddaf9){return db[_0x6a4a('0xae')]['destroy']({'where':{'SmsAccountId':_0x2d79ee['params']['id']},'transaction':_0x6ddaf9})[_0x6a4a('0x1e')](function(_0x1286b4){var _0x4ee81e=_[_0x6a4a('0x46')](_0x2d79ee['body'],function(_0x52c462){_0x52c462[_0x6a4a('0x5d')]=_0x2d79ee['params']['id'];return _0x52c462;});return db[_0x6a4a('0xae')]['bulkCreate'](_0x4ee81e,{'transaction':_0x6ddaf9});});})[_0x6a4a('0x1e')](function(){return db[_0x6a4a('0xae')][_0x6a4a('0xaf')]({'where':{'SmsAccountId':_0x2d79ee[_0x6a4a('0x4f')]['id']},'order':_0x6a4a('0xb0')});});}})[_0x6a4a('0x1e')](respondWithResult(_0x17dbe6,null))['catch'](handleError(_0x17dbe6,null));};exports[_0x6a4a('0xb1')]=function(_0x109ff9,_0x2b2736,_0x463dea){var _0x18b1c8={};var _0x200120={};var _0x229a3a;var _0xf1b0a4;return db['SmsAccount'][_0x6a4a('0x60')]({'where':{'id':_0x109ff9[_0x6a4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2b2736,null))[_0x6a4a('0x1e')](function(_0x4d67da){if(_0x4d67da){_0x229a3a=_0x4d67da;_0x200120[_0x6a4a('0x39')]=_[_0x6a4a('0x3a')](db[_0x6a4a('0xae')][_0x6a4a('0x50')]);_0x200120[_0x6a4a('0x40')]=_[_0x6a4a('0x3a')](_0x109ff9['query']);_0x200120[_0x6a4a('0x3b')]=_['intersection'](_0x200120[_0x6a4a('0x39')],_0x200120['query']);_0x18b1c8[_0x6a4a('0x3d')]=_[_0x6a4a('0x3c')](_0x200120[_0x6a4a('0x39')],qs[_0x6a4a('0x3e')](_0x109ff9[_0x6a4a('0x40')]['fields']));_0x18b1c8[_0x6a4a('0x3d')]=_0x18b1c8['attributes'][_0x6a4a('0x3f')]?_0x18b1c8['attributes']:_0x200120['model'];_0x18b1c8[_0x6a4a('0x42')]=qs['sort'](_0x109ff9[_0x6a4a('0x40')][_0x6a4a('0x43')]);_0x18b1c8[_0x6a4a('0x44')]=qs['filters'](_[_0x6a4a('0x62')](_0x109ff9[_0x6a4a('0x40')],_0x200120[_0x6a4a('0x3b')]));if(_0x109ff9[_0x6a4a('0x40')]['filter']){_0x18b1c8['where']=_[_0x6a4a('0x51')](_0x18b1c8[_0x6a4a('0x44')],{'$or':_['map'](_0x18b1c8[_0x6a4a('0x3d')],function(_0x3f25ac){var _0x262434={};_0x262434[_0x3f25ac]={'$like':'%'+_0x109ff9[_0x6a4a('0x40')][_0x6a4a('0x45')]+'%'};return _0x262434;})});}_0x18b1c8=_[_0x6a4a('0x51')]({},_0x18b1c8,_0x109ff9[_0x6a4a('0x4b')]);return _0x229a3a[_0x6a4a('0xb1')](_0x18b1c8);}})['then'](function(_0x23b536){if(_0x23b536){_0xf1b0a4=_0x23b536[_0x6a4a('0x3f')];if(!_0x109ff9[_0x6a4a('0x40')][_0x6a4a('0x61')](_0x6a4a('0x41'))){_0x18b1c8[_0x6a4a('0x2d')]=qs['limit'](_0x109ff9['query'][_0x6a4a('0x2d')]);_0x18b1c8[_0x6a4a('0x2c')]=qs['offset'](_0x109ff9[_0x6a4a('0x40')][_0x6a4a('0x2c')]);}return _0x229a3a['getApplications'](_0x18b1c8);}})[_0x6a4a('0x1e')](function(_0x49d7f8){if(_0x49d7f8){return _0x49d7f8?{'count':_0xf1b0a4,'rows':_0x49d7f8}:null;}})[_0x6a4a('0x1e')](respondWithResult(_0x2b2736,null))['catch'](handleError(_0x2b2736,null));};exports[_0x6a4a('0xb2')]=function(_0x522eeb,_0x42208b,_0x29b7ce){var _0xbe87ed={'raw':![],'where':{}};var _0x2ed120={};var _0x4e9b68={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6a4a('0x60')]({'where':{'id':_0x522eeb[_0x6a4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x42208b,null))[_0x6a4a('0x1e')](function(_0x45a758){if(_0x45a758){_0x2ed120[_0x6a4a('0x39')]=_[_0x6a4a('0x3a')](db[_0x6a4a('0x99')][_0x6a4a('0x50')]);_0x2ed120[_0x6a4a('0x40')]=_[_0x6a4a('0x3a')](_0x522eeb[_0x6a4a('0x40')]);_0x2ed120[_0x6a4a('0x3b')]=_['intersection'](_0x2ed120[_0x6a4a('0x39')],_0x2ed120[_0x6a4a('0x40')]);_0xbe87ed[_0x6a4a('0x3d')]=_[_0x6a4a('0x3c')](_0x2ed120[_0x6a4a('0x39')],qs[_0x6a4a('0x3e')](_0x522eeb[_0x6a4a('0x40')][_0x6a4a('0x3e')]));_0xbe87ed[_0x6a4a('0x3d')]=_0xbe87ed[_0x6a4a('0x3d')][_0x6a4a('0x3f')]?_0xbe87ed[_0x6a4a('0x3d')]:_0x2ed120['model'];if(!_0x522eeb['query'][_0x6a4a('0x61')](_0x6a4a('0x41'))){_0xbe87ed['limit']=qs['limit'](_0x522eeb[_0x6a4a('0x40')][_0x6a4a('0x2d')]);_0xbe87ed['offset']=qs['offset'](_0x522eeb[_0x6a4a('0x40')][_0x6a4a('0x2c')]);}_0xbe87ed[_0x6a4a('0x42')]=qs['sort'](_0x522eeb[_0x6a4a('0x40')]['sort']);_0xbe87ed[_0x6a4a('0x44')]=qs[_0x6a4a('0x3b')](_[_0x6a4a('0x62')](_0x522eeb['query'],_0x2ed120[_0x6a4a('0x3b')]));_0xbe87ed[_0x6a4a('0x44')][_0x6a4a('0x5d')]=_0x45a758['id'];if(_0x522eeb[_0x6a4a('0x40')]['filter']){_0xbe87ed[_0x6a4a('0x44')]=_['merge'](_0xbe87ed[_0x6a4a('0x44')],{'$or':_['map'](_0xbe87ed['attributes'],function(_0x485122){var _0x40081d={};_0x40081d[_0x485122]={'$like':'%'+_0x522eeb['query'][_0x6a4a('0x45')]+'%'};return _0x40081d;})});}_0xbe87ed=_['merge']({},_0xbe87ed,_0x522eeb['options']);return db['SmsInteraction'][_0x6a4a('0x2b')]({'where':_0xbe87ed[_0x6a4a('0x44')]})[_0x6a4a('0x1e')](function(_0x4d7643){_0x4e9b68[_0x6a4a('0x2b')]=_0x4d7643;if(_0x522eeb[_0x6a4a('0x40')]['includeAll']){_0xbe87ed[_0x6a4a('0x4d')]=[{'model':db[_0x6a4a('0x92')],'as':_0x6a4a('0xb3'),'required':![]},{'model':db[_0x6a4a('0xa2')],'as':_0x6a4a('0xb4'),'attributes':[_0x6a4a('0x35'),_0x6a4a('0xb5'),'internal'],'required':![]},{'model':db[_0x6a4a('0xb6')],'as':_0x6a4a('0xb7'),'attributes':['id',_0x6a4a('0x35'),_0x6a4a('0xb8')],'where':_0x522eeb[_0x6a4a('0x40')][_0x6a4a('0xb9')]?{'id':_0x522eeb[_0x6a4a('0x40')][_0x6a4a('0xb9')]}:undefined,'required':_0x522eeb['query'][_0x6a4a('0xb9')]?!![]:![]}];}return db['SmsInteraction'][_0x6a4a('0x69')](_0xbe87ed);})[_0x6a4a('0x1e')](function(_0x284444){_0x4e9b68[_0x6a4a('0x4e')]=_0x284444;return _0x4e9b68;});}})[_0x6a4a('0x1e')](respondWithFilteredResult(_0x42208b,_0xbe87ed))[_0x6a4a('0x27')](handleError(_0x42208b,null));};exports['send']=function(_0x51fa06,_0x3e31f7,_0x1594c5){var _0x1c48c6,_0x544c92,_0x50740f;if(_['isNil'](_0x51fa06[_0x6a4a('0x5a')]['body'])||_0x51fa06[_0x6a4a('0x5a')][_0x6a4a('0x5a')]===''){throw new db[(_0x6a4a('0x1c'))]['ValidationError'](_0x6a4a('0x8e'));}if(_[_0x6a4a('0x8d')](_0x51fa06['body']['to'])){throw new db[(_0x6a4a('0x1c'))]['ValidationError'](_0x6a4a('0xba'));}_0x1c48c6=_0x51fa06[_0x6a4a('0x5a')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x51fa06['params']['id']},'include':[{'model':db[_0x6a4a('0x91')],'as':'List','include':[{'model':db[_0x6a4a('0x92')],'as':_0x6a4a('0x96'),'where':{'mobile':_0x1c48c6},'limit':0x1,'order':[[_0x6a4a('0x74'),'DESC']]}]}]})[_0x6a4a('0x1e')](handleEntityNotFound(_0x3e31f7,null))['then'](function(_0x164c18){if(_0x164c18&&_0x164c18['List']){_0x544c92=_0x164c18[_0x6a4a('0x32')]({'plain':!![]});if(_0x544c92[_0x6a4a('0xbb')]&&_0x544c92[_0x6a4a('0xbb')][_0x6a4a('0x96')]['length']){return _0x544c92[_0x6a4a('0xbb')]['Contacts'][0x0];}return db[_0x6a4a('0x92')][_0x6a4a('0x53')](_[_0x6a4a('0x97')](_0x51fa06[_0x6a4a('0x5a')],{'firstName':_0x1c48c6,'mobile':_0x1c48c6,'phone':_0x1c48c6,'ListId':_0x544c92[_0x6a4a('0x76')]}));}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x3e31f7,null))[_0x6a4a('0x1e')](function(_0x4df58e){if(_0x4df58e){_0x50740f=_0x4df58e;return db[_0x6a4a('0x99')]['find']({'where':{'ContactId':_0x50740f['id'],'closed':![],'SmsAccountId':_0x544c92['id']}})['then'](function(_0x243469){if(_0x243469){return[_0x243469,![]];}return db[_0x6a4a('0x99')][_0x6a4a('0x53')]({'UserId':_0x51fa06[_0x6a4a('0x54')]['id'],'ContactId':_0x50740f['id'],'SmsAccountId':_0x544c92['id'],'phone':_0x1c48c6,'firstMsgDirection':_0x6a4a('0xbc'),'Messages':[_[_0x6a4a('0x51')](_0x51fa06[_0x6a4a('0x5a')],{'read':![],'body':_0x51fa06[_0x6a4a('0x5a')][_0x6a4a('0x5a')],'phone':_0x1c48c6,'SmsAccountId':_0x544c92['id'],'UserId':_0x51fa06['user']['id'],'ContactId':_0x50740f['id']})]},{'include':[{'model':db[_0x6a4a('0xbd')],'as':'Messages'}]})['then'](function(_0x25a010){return[_0x25a010,!![]];});});}})[_0x6a4a('0x9a')](function(_0x358f6f,_0x4c26af){if(_0x4c26af){return _0x358f6f;}return db[_0x6a4a('0xbd')]['create'](_[_0x6a4a('0x51')](_0x51fa06[_0x6a4a('0x5a')],{'read':![],'body':_0x51fa06[_0x6a4a('0x5a')]['body'],'phone':_0x1c48c6,'SmsAccountId':_0x544c92['id'],'SmsInteractionId':_0x358f6f['id'],'UserId':_0x51fa06['user']['id'],'ContactId':_0x50740f['id']}))[_0x6a4a('0x1e')](function(_0x5885dd){_0x358f6f[_0x6a4a('0xbe')][_0x6a4a('0xbf')]=[];_0x358f6f[_0x6a4a('0xbe')]['Messages']['push'](_0x5885dd['dataValues']);return _0x358f6f;});})[_0x6a4a('0x1e')](respondWithResult(_0x3e31f7,null))[_0x6a4a('0x27')](handleError(_0x3e31f7,null));};exports['status']=function(_0x20bef5,_0x4b8931,_0x486306){if(_0x20bef5[_0x6a4a('0x5a')]['id']){delete _0x20bef5[_0x6a4a('0x5a')]['id'];}console[_0x6a4a('0xc0')](_0x6a4a('0xc1'),_0x20bef5[_0x6a4a('0x5a')]);var _0x13eb00,_0x230fad,_0x50ab1b;return db[_0x6a4a('0x4c')][_0x6a4a('0x52')]({'where':{'id':_0x20bef5['params']['id']}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x4b8931,null))[_0x6a4a('0x1e')](function(_0x630815){if(_0x630815){_0x50ab1b=_0x630815;logger[_0x6a4a('0xc2')](_0x6a4a('0xa9'),_0x6a4a('0x29'),_0x6a4a('0xc3'),_0x630815['type'],util[_0x6a4a('0xc4')](_0x20bef5[_0x6a4a('0x5a')],{'showHidden':![],'depth':null}));switch(_0x630815['type']){case _0x6a4a('0x7d'):if(_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0xc5')]&&_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0x29')]){_0x230fad=_0x20bef5[_0x6a4a('0x5a')]['status'];return db['SmsMessage'][_0x6a4a('0x52')]({'where':{'messageId':_0x20bef5['body'][_0x6a4a('0xc5')]}});}break;case _0x6a4a('0x80'):if(_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0xc6')]&&_0x20bef5['body']['statusInt']){_0x230fad=_0x20bef5[_0x6a4a('0x5a')]['statusInt'];return db[_0x6a4a('0xbd')][_0x6a4a('0x52')]({'where':{'messageId':_0x20bef5[_0x6a4a('0x5a')]['requestid']}});}break;case _0x6a4a('0x81'):if(_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0xc7')]&&_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0xc8')]){_0x230fad=_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0xc8')];return db[_0x6a4a('0xbd')][_0x6a4a('0x52')]({'where':{'messageId':_0x20bef5['body'][_0x6a4a('0xc7')]}});}break;case'infobip':var _0x284f54=_0x20bef5['body'][_0x6a4a('0x85')][0x0];if(_0x284f54['messageId']&&_0x284f54[_0x6a4a('0x29')][_0x6a4a('0xc9')]===_0x6a4a('0xca')){_0x230fad=_0x284f54['status'][_0x6a4a('0xc9')];return db[_0x6a4a('0xbd')]['find']({'where':{'messageId':_0x284f54[_0x6a4a('0x7b')]}});}break;case _0x6a4a('0xcb'):if(_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0x7b')]&&_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0x29')]){_0x230fad=_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0x29')];return db['SmsMessage']['find']({'where':{'messageId':_0x20bef5['body'][_0x6a4a('0x7b')]}});}break;case _0x6a4a('0x8a'):if(_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0xcc')]&&_0x20bef5['body'][_0x6a4a('0x29')]){_0x230fad=_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0x29')];return db[_0x6a4a('0xbd')][_0x6a4a('0x52')]({'where':{'messageId':_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0xcc')]}});}break;}}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x4b8931,null))[_0x6a4a('0x1e')](function(_0x87d8d1){if(_0x87d8d1){_0x13eb00=_0x87d8d1;switch(_0x50ab1b[_0x6a4a('0x47')]){case _0x6a4a('0x7d'):if(_0x230fad===_0x6a4a('0xca')){return _0x13eb00[_0x6a4a('0x59')]({'read':!![]});}else{logger[_0x6a4a('0x25')](_0x6a4a('0xa9'),_0x6a4a('0x29'),_0x6a4a('0x7d'),util[_0x6a4a('0xc4')](_0x20bef5[_0x6a4a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6a4a('0x80'):if(_0x230fad==='1'){return _0x13eb00['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6a4a('0x29'),_0x6a4a('0x7d'),util['inspect'](_0x20bef5[_0x6a4a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6a4a('0x81'):if(!_0x20bef5['body'][_0x6a4a('0xcd')]&&_0x230fad>=0xc8&&_0x230fad<=0xce){return _0x13eb00['update']({'read':!![]});}else{logger[_0x6a4a('0x25')](_0x6a4a('0xa9'),_0x6a4a('0x29'),_0x6a4a('0x81'),util[_0x6a4a('0xc4')](_0x20bef5[_0x6a4a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6a4a('0x84'):var _0x4aafc5=_0x20bef5[_0x6a4a('0x5a')][_0x6a4a('0x85')][0x0];if(_0x4aafc5['status'][_0x6a4a('0xc9')]===_0x6a4a('0xca')){return _0x13eb00[_0x6a4a('0x59')]({'read':!![]});}else{logger[_0x6a4a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6a4a('0x29'),_0x6a4a('0x84'),util[_0x6a4a('0xc4')](_0x20bef5[_0x6a4a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6a4a('0xcb'):if(_0x230fad=='DELIVERED_TO_GATEWAY'||_0x230fad=='RECEIVED_BY_RECIPIENT'){return _0x13eb00[_0x6a4a('0x59')]({'read':!![]});}else{logger[_0x6a4a('0x25')](_0x6a4a('0xa9'),_0x6a4a('0x29'),_0x6a4a('0xcb'),util['inspect'](_0x20bef5[_0x6a4a('0x5a')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x230fad===_0x6a4a('0xce')||_0x230fad===_0x6a4a('0xcf')){return _0x13eb00[_0x6a4a('0x59')]({'read':!![]});}else{logger[_0x6a4a('0x25')](_0x6a4a('0xa9'),_0x6a4a('0x29'),_0x6a4a('0x8a'),util['inspect'](_0x20bef5['body'],{'showHidden':![],'depth':null}));}break;}return _0x13eb00;}})[_0x6a4a('0x1e')](respondWithResult(_0x4b8931,null))[_0x6a4a('0x27')](handleError(_0x4b8931,null));};exports[_0x6a4a('0xd0')]=function(_0x300300,_0x2fd424,_0x419824){var _0x1e0498,_0x504a8b,_0xfe044e;return db[_0x6a4a('0x4c')][_0x6a4a('0x52')]({'where':{'id':_0x300300['params']['id']}})['then'](handleEntityNotFound(_0x2fd424,null))['then'](function(_0x2032bb){if(_0x2032bb){_0xfe044e=_0x2032bb;logger['debug'](_0x6a4a('0xa9'),_0x6a4a('0x29'),_0x6a4a('0xc3'),_0x2032bb['type'],util['inspect'](_0x300300['query'],{'showHidden':![],'depth':null}));switch(_0x2032bb[_0x6a4a('0x47')]){case _0x6a4a('0x86'):if(_0x300300[_0x6a4a('0x40')]['message-id']&&_0x300300['query'][_0x6a4a('0xd1')]){_0x504a8b=_0x300300[_0x6a4a('0x40')][_0x6a4a('0xd1')];return db[_0x6a4a('0xbd')][_0x6a4a('0x52')]({'where':{'messageId':_0x300300['query'][_0x6a4a('0xd2')]}});}break;}}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x2fd424,null))[_0x6a4a('0x1e')](function(_0x2241ca){if(_0x2241ca){_0x1e0498=_0x2241ca;switch(_0xfe044e[_0x6a4a('0x47')]){case _0x6a4a('0x86'):if(_0x504a8b==='2'||_0x504a8b==='6'){return _0x1e0498[_0x6a4a('0x59')]({'read':!![]});}else{logger[_0x6a4a('0x25')](_0x6a4a('0xa9'),_0x6a4a('0x29'),_0x6a4a('0x86'),util[_0x6a4a('0xc4')](_0x300300[_0x6a4a('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x1e0498;}})[_0x6a4a('0x1e')](respondWithResult(_0x2fd424,null))[_0x6a4a('0x27')](handleError(_0x2fd424,null));};exports['addAgents']=function(_0x5ea14d,_0x3f3a56,_0x3d8d91){return db[_0x6a4a('0x4c')][_0x6a4a('0x52')]({'where':{'id':_0x5ea14d[_0x6a4a('0x4f')]['id']}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x3f3a56,null))[_0x6a4a('0x1e')](function(_0x4c681d){if(_0x4c681d){return _0x4c681d[_0x6a4a('0xd3')](_0x5ea14d['body'][_0x6a4a('0x65')],_[_0x6a4a('0x95')](_0x5ea14d['body'],[_0x6a4a('0x65'),'id'])||{})[_0x6a4a('0x9a')](function(_0x13ea0b){for(var _0x26f4c4=0x0;_0x26f4c4<_0x5ea14d[_0x6a4a('0x5a')][_0x6a4a('0x65')][_0x6a4a('0x3f')];_0x26f4c4+=0x1){socket[_0x6a4a('0xd4')](_0x6a4a('0xd5'),{'UserId':_0x5ea14d[_0x6a4a('0x5a')][_0x6a4a('0x65')][_0x26f4c4],'SmsAccountId':_0x5ea14d[_0x6a4a('0x4f')]['id']});}return _0x13ea0b;});}})[_0x6a4a('0x1e')](respondWithResult(_0x3f3a56,null))['catch'](handleError(_0x3f3a56,null));};exports['removeAgents']=function(_0x165c23,_0x289f9b,_0x1d3fa9){return db[_0x6a4a('0x4c')][_0x6a4a('0x52')]({'where':{'id':_0x165c23['params']['id']}})['then'](handleEntityNotFound(_0x289f9b,null))['then'](function(_0x3a6e8b){if(_0x3a6e8b){return _0x3a6e8b[_0x6a4a('0xd6')](_0x165c23[_0x6a4a('0x40')][_0x6a4a('0x65')])['then'](function(){if(_[_0x6a4a('0xd7')](_0x165c23[_0x6a4a('0x40')]['ids'])){for(var _0x59ffb2=0x0;_0x59ffb2<_0x165c23[_0x6a4a('0x40')]['ids'][_0x6a4a('0x3f')];_0x59ffb2+=0x1){socket[_0x6a4a('0xd4')](_0x6a4a('0xd8'),{'UserId':Number(_0x165c23['query']['ids'][_0x59ffb2]),'SmsAccountId':Number(_0x165c23[_0x6a4a('0x4f')]['id'])});}}else{socket[_0x6a4a('0xd4')](_0x6a4a('0xd8'),{'UserId':Number(_0x165c23[_0x6a4a('0x40')][_0x6a4a('0x65')]),'SmsAccountId':Number(_0x165c23[_0x6a4a('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x289f9b,null))[_0x6a4a('0x27')](handleError(_0x289f9b,null));};exports[_0x6a4a('0xd9')]=function(_0x22e874,_0x26f842,_0x5efbdc){var _0x29c66a={};var _0x320af5={};var _0x10d60b;var _0x29faaa;return db['SmsAccount'][_0x6a4a('0x60')]({'where':{'id':_0x22e874[_0x6a4a('0x4f')]['id']}})[_0x6a4a('0x1e')](handleEntityNotFound(_0x26f842,null))[_0x6a4a('0x1e')](function(_0x1d6842){if(_0x1d6842){_0x10d60b=_0x1d6842;_0x320af5['model']=_[_0x6a4a('0x3a')](db['User'][_0x6a4a('0x50')]);_0x320af5['query']=_['keys'](_0x22e874[_0x6a4a('0x40')]);_0x320af5['filters']=_['intersection'](_0x320af5[_0x6a4a('0x39')],_0x320af5[_0x6a4a('0x40')]);_0x29c66a['attributes']=_['intersection'](_0x320af5[_0x6a4a('0x39')],qs[_0x6a4a('0x3e')](_0x22e874['query']['fields']));_0x29c66a[_0x6a4a('0x3d')]=_0x29c66a[_0x6a4a('0x3d')][_0x6a4a('0x3f')]?_0x29c66a[_0x6a4a('0x3d')]:_0x320af5[_0x6a4a('0x39')];_0x29c66a[_0x6a4a('0x42')]=qs[_0x6a4a('0x43')](_0x22e874[_0x6a4a('0x40')][_0x6a4a('0x43')]);_0x29c66a['where']=qs[_0x6a4a('0x3b')](_['pick'](_0x22e874[_0x6a4a('0x40')],_0x320af5['filters']));if(_0x22e874[_0x6a4a('0x40')]['filter']){_0x29c66a[_0x6a4a('0x44')]=_[_0x6a4a('0x51')](_0x29c66a[_0x6a4a('0x44')],{'$or':_[_0x6a4a('0x46')](_0x29c66a[_0x6a4a('0x3d')],function(_0x4d9d32){var _0x4ad62f={};_0x4ad62f[_0x4d9d32]={'$like':'%'+_0x22e874[_0x6a4a('0x40')][_0x6a4a('0x45')]+'%'};return _0x4ad62f;})});}_0x29c66a=_[_0x6a4a('0x51')]({},_0x29c66a,_0x22e874[_0x6a4a('0x4b')]);return _0x10d60b[_0x6a4a('0xd9')](_0x29c66a);}})[_0x6a4a('0x1e')](function(_0x459ea7){if(_0x459ea7){_0x29faaa=_0x459ea7['length'];if(!_0x22e874[_0x6a4a('0x40')][_0x6a4a('0x61')]('nolimit')){_0x29c66a[_0x6a4a('0x2d')]=qs[_0x6a4a('0x2d')](_0x22e874[_0x6a4a('0x40')][_0x6a4a('0x2d')]);_0x29c66a['offset']=qs[_0x6a4a('0x2c')](_0x22e874[_0x6a4a('0x40')][_0x6a4a('0x2c')]);}return _0x10d60b[_0x6a4a('0xd9')](_0x29c66a);}})[_0x6a4a('0x1e')](function(_0x280166){if(_0x280166){return _0x280166?{'count':_0x29faaa,'rows':_0x280166}:null;}})['then'](respondWithResult(_0x26f842,null))['catch'](handleError(_0x26f842,null));}; \ No newline at end of file +var _0x203f=['error','code','SmsAccount,\x20%s,\x20%s','message','result','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','model','keys','query','intersection','fields','attributes','length','nolimit','order','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','options','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','getDispositions','findOne','hasOwnProperty','sort','SmsAccountId','Disposition','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','findAll','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','From','Body','MessageSid','skebby','text','connectel','messageId','message_id','plivo','MessageUUID','infobip','results','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','autoclose','push','*,*,*,*','created','ContactId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','SmsApplication','findAndCountAll','getApplications','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','log','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','DELIVERED','clicksend','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify'];(function(_0x595a72,_0x55efb9){var _0x586b9b=function(_0xea0e29){while(--_0xea0e29){_0x595a72['push'](_0x595a72['shift']());}};_0x586b9b(++_0x55efb9);}(_0x203f,0x194));var _0xf203=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x203f[_0x18a436];return _0x5c2cf8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf203('0x0'));var zipdir=require(_0xf203('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf203('0x2'));var moment=require(_0xf203('0x3'));var BPromise=require(_0xf203('0x4'));var Mustache=require(_0xf203('0x5'));var util=require('util');var path=require(_0xf203('0x6'));var sox=require('sox');var csv=require(_0xf203('0x7'));var ejs=require(_0xf203('0x8'));var fs=require('fs');var _=require(_0xf203('0x9'));var squel=require(_0xf203('0xa'));var crypto=require(_0xf203('0xb'));var jsforce=require(_0xf203('0xc'));var deskjs=require(_0xf203('0xd'));var toCsv=require(_0xf203('0x7'));var querystring=require('querystring');var Papa=require(_0xf203('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf203('0xf'));var hardwareService=require(_0xf203('0x10'));var logger=require(_0xf203('0x11'))(_0xf203('0x12'));var utils=require('../../config/utils');var config=require(_0xf203('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf203('0x14')](config[_0xf203('0x15')],{'host':_0xf203('0x16'),'port':0x18eb});var socket=require(_0xf203('0x17'))(new Redis(config[_0xf203('0x15')]));require('./smsAccount.socket')[_0xf203('0x18')](socket);var jayson=require(_0xf203('0x19'));var client=jayson['client'][_0xf203('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x290819,_0x49bf61,_0x2fdfc0){if(_0x2fdfc0){var _0x3ecd68=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ecd68[_0xf203('0x1b')](_0x49bf61)){return _0x290819;}else{throw new db['Sequelize'][(_0xf203('0x1c'))](_0xf203('0x1d'));}}else{return _0x290819;}}function respondWithRpcPromise(_0x53d4b9,_0x13b56,_0x29be63,_0x3be742){return new BPromise(function(_0xd95f5b,_0x833036){var _0x419ee9=_0x3be742||client;return _0x419ee9[_0xf203('0x1e')](_0x53d4b9,_0x29be63)[_0xf203('0x1f')](function(_0x2664c3){logger[_0xf203('0x20')]('SmsAccount,\x20%s,\x20%s',_0x13b56,_0xf203('0x21'));logger[_0xf203('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x13b56,'request\x20sent',JSON[_0xf203('0x23')](_0x2664c3));if(_0x2664c3[_0xf203('0x24')]){if(_0x2664c3[_0xf203('0x24')][_0xf203('0x25')]===0x1f4){logger[_0xf203('0x24')](_0xf203('0x26'),_0x13b56,_0x2664c3['error'][_0xf203('0x27')]);return _0x833036(_0x2664c3[_0xf203('0x24')][_0xf203('0x27')]);}logger[_0xf203('0x24')]('SmsAccount,\x20%s,\x20%s',_0x13b56,_0x2664c3[_0xf203('0x24')]['message']);return _0xd95f5b(_0x2664c3['error'][_0xf203('0x27')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x13b56,_0xf203('0x21'));_0xd95f5b(_0x2664c3[_0xf203('0x28')][_0xf203('0x27')]);}})['catch'](function(_0x2c965a){logger[_0xf203('0x24')](_0xf203('0x26'),_0x13b56,_0x2c965a);_0x833036(_0x2c965a);});});}function respondWithStatusCode(_0x55a6dd,_0x53bb92){_0x53bb92=_0x53bb92||0xcc;return function(_0x3e0606){if(_0x3e0606){return _0x55a6dd['sendStatus'](_0x53bb92);}return _0x55a6dd['status'](_0x53bb92)[_0xf203('0x29')]();};}function respondWithResult(_0x55c20c,_0x4a169b){_0x4a169b=_0x4a169b||0xc8;return function(_0x44ac07){if(_0x44ac07){return _0x55c20c['status'](_0x4a169b)[_0xf203('0x2a')](_0x44ac07);}};}function respondWithFilteredResult(_0x1ca205,_0x63e428){return function(_0x19fcd2){if(_0x19fcd2){var _0x27eaaa=_0x19fcd2[_0xf203('0x2b')],_0x16b665=_0x63e428[_0xf203('0x2c')],_0x511970=_0x63e428[_0xf203('0x2c')]+_0x63e428[_0xf203('0x2d')],_0x95693e;if(_0x511970>=_0x27eaaa){_0x511970=_0x27eaaa;_0x95693e=0xc8;}else{_0x95693e=0xce;}_0x1ca205[_0xf203('0x2e')](_0x95693e);return _0x1ca205[_0xf203('0x2f')](_0xf203('0x30'),_0x16b665+'-'+_0x511970+'/'+_0x27eaaa)[_0xf203('0x2a')](_0x19fcd2);}return null;};}function patchUpdates(_0x4cf608){return function(_0xd2e7cc){try{jsonpatch[_0xf203('0x31')](_0xd2e7cc,_0x4cf608,!![]);}catch(_0x2b6bed){return BPromise['reject'](_0x2b6bed);}return _0xd2e7cc[_0xf203('0x32')]();};}function saveUpdates(_0x31a382,_0x94e9ba){return function(_0x125331){if(_0x125331){return _0x125331[_0xf203('0x33')](_0x31a382)[_0xf203('0x1f')](function(_0x56690b){return _0x56690b;});}return null;};}function removeEntity(_0x412e7e,_0x17c04b){return function(_0xe5e536){if(_0xe5e536){return _0xe5e536[_0xf203('0x34')]()['then'](function(){var _0x563944=_0xe5e536[_0xf203('0x35')]({'plain':!![]});var _0xab35bb=_0xf203('0x36');return db[_0xf203('0x37')][_0xf203('0x34')]({'where':{'type':_0xab35bb,'resourceId':_0x563944['id']}})[_0xf203('0x1f')](function(){return _0xe5e536;});})['then'](function(){_0x412e7e['status'](0xcc)[_0xf203('0x29')]();});}};}function handleEntityNotFound(_0x5e9ea2,_0x45d884){return function(_0x38a75c){if(!_0x38a75c){_0x5e9ea2[_0xf203('0x38')](0x194);}return _0x38a75c;};}function handleError(_0x1be267,_0x3f371a){_0x3f371a=_0x3f371a||0x1f4;return function(_0x287b17){logger[_0xf203('0x24')](_0x287b17[_0xf203('0x39')]);if(_0x287b17[_0xf203('0x3a')]){delete _0x287b17['name'];}_0x1be267[_0xf203('0x2e')](_0x3f371a)[_0xf203('0x3b')](_0x287b17);};}exports[_0xf203('0x3c')]=function(_0x5ca074,_0x284258){var _0x31f05f={'include':[{'model':db[_0xf203('0x3d')],'as':_0xf203('0x3e')}]},_0x7be401={},_0x26e3b1={'count':0x0,'rows':[]};var _0x2200fa=db[_0xf203('0x3f')][_0xf203('0x40')];_0x7be401[_0xf203('0x41')]=_[_0xf203('0x42')](_0x2200fa);_0x7be401[_0xf203('0x43')]=_['keys'](_0x5ca074[_0xf203('0x43')]);_0x7be401['filters']=_[_0xf203('0x44')](_0x7be401[_0xf203('0x41')],_0x7be401[_0xf203('0x43')]);_0x31f05f['attributes']=_[_0xf203('0x44')](_0x7be401['model'],qs[_0xf203('0x45')](_0x5ca074[_0xf203('0x43')][_0xf203('0x45')]));_0x31f05f['attributes']=_0x31f05f[_0xf203('0x46')][_0xf203('0x47')]?_0x31f05f['attributes']:_0x7be401[_0xf203('0x41')];if(!_0x5ca074[_0xf203('0x43')]['hasOwnProperty'](_0xf203('0x48'))){_0x31f05f[_0xf203('0x2d')]=qs['limit'](_0x5ca074[_0xf203('0x43')][_0xf203('0x2d')]);_0x31f05f[_0xf203('0x2c')]=qs[_0xf203('0x2c')](_0x5ca074[_0xf203('0x43')][_0xf203('0x2c')]);}_0x31f05f[_0xf203('0x49')]=qs['sort'](_0x5ca074[_0xf203('0x43')]['sort']);_0x31f05f[_0xf203('0x4a')]=qs[_0xf203('0x4b')](_[_0xf203('0x4c')](_0x5ca074[_0xf203('0x43')],_0x7be401[_0xf203('0x4b')]));if(_0x5ca074[_0xf203('0x43')][_0xf203('0x4d')]){_0x31f05f[_0xf203('0x4a')]=_[_0xf203('0x4e')](_0x31f05f[_0xf203('0x4a')],{'$or':_[_0xf203('0x4f')](_0x2200fa,function(_0x1a4ffe){if(_0x1a4ffe[_0xf203('0x50')][_0xf203('0x51')]!==_0xf203('0x52')){var _0xa4573f={};_0xa4573f[_0x1a4ffe[_0xf203('0x53')]]={'$like':'%'+_0x5ca074[_0xf203('0x43')]['filter']+'%'};return _0xa4573f;}})});}_0x31f05f=_[_0xf203('0x4e')]({},_0x31f05f,_0x5ca074[_0xf203('0x54')]);var _0x39fcdb={'where':_0x31f05f['where']};return db[_0xf203('0x3f')][_0xf203('0x2b')](_0x39fcdb)['then'](function(_0x4f0a4a){_0x26e3b1[_0xf203('0x2b')]=_0x4f0a4a;if(_0x5ca074[_0xf203('0x43')]['includeAll']){_0x31f05f['include']=[{'all':!![]}];}return db[_0xf203('0x3f')]['findAll'](_0x31f05f);})[_0xf203('0x1f')](function(_0x505677){_0x26e3b1['rows']=_0x505677;return _0x26e3b1;})[_0xf203('0x1f')](respondWithFilteredResult(_0x284258,_0x31f05f))['catch'](handleError(_0x284258,null));};exports['show']=function(_0x4e8006,_0x1a8126){var _0x1721c0={'raw':![],'where':{'id':_0x4e8006['params']['id']},'include':[{'model':db[_0xf203('0x3d')],'as':_0xf203('0x3e')}]},_0x5f2024={};_0x5f2024[_0xf203('0x41')]=_[_0xf203('0x42')](db[_0xf203('0x3f')][_0xf203('0x40')]);_0x5f2024[_0xf203('0x43')]=_[_0xf203('0x42')](_0x4e8006[_0xf203('0x43')]);_0x5f2024[_0xf203('0x4b')]=_[_0xf203('0x44')](_0x5f2024[_0xf203('0x41')],_0x5f2024['query']);_0x1721c0[_0xf203('0x46')]=_[_0xf203('0x44')](_0x5f2024[_0xf203('0x41')],qs[_0xf203('0x45')](_0x4e8006[_0xf203('0x43')][_0xf203('0x45')]));_0x1721c0[_0xf203('0x46')]=_0x1721c0[_0xf203('0x46')][_0xf203('0x47')]?_0x1721c0[_0xf203('0x46')]:_0x5f2024[_0xf203('0x41')];if(_0x4e8006[_0xf203('0x43')]['includeAll']){_0x1721c0[_0xf203('0x55')]=[{'all':!![]}];}_0x1721c0=_['merge']({},_0x1721c0,_0x4e8006[_0xf203('0x54')]);return db[_0xf203('0x3f')]['find'](_0x1721c0)[_0xf203('0x1f')](handleEntityNotFound(_0x1a8126,null))[_0xf203('0x1f')](respondWithResult(_0x1a8126,null))[_0xf203('0x56')](handleError(_0x1a8126,null));};exports[_0xf203('0x57')]=function(_0x5d269f,_0xe6e3f2){return db[_0xf203('0x3f')]['create'](_0x5d269f[_0xf203('0x58')],{})[_0xf203('0x1f')](function(_0x4aeb5a){var _0x4c8526=_0x5d269f['user'][_0xf203('0x35')]({'plain':!![]});if(!_0x4c8526)throw new Error(_0xf203('0x59'));if(_0x4c8526[_0xf203('0x5a')]===_0xf203('0x5b')){var _0x124fbf=_0x4aeb5a['get']({'plain':!![]});var _0x3b204e='SmsAccounts';return db[_0xf203('0x5c')]['find']({'where':{'name':_0x3b204e,'userProfileId':_0x4c8526['userProfileId']},'raw':!![]})[_0xf203('0x1f')](function(_0x3bc0b3){if(_0x3bc0b3&&_0x3bc0b3[_0xf203('0x5d')]===0x0){return db[_0xf203('0x37')]['create']({'name':_0x124fbf[_0xf203('0x3a')],'resourceId':_0x124fbf['id'],'type':_0x3bc0b3[_0xf203('0x3a')],'sectionId':_0x3bc0b3['id']},{})[_0xf203('0x1f')](function(){return _0x4aeb5a;});}else{return _0x4aeb5a;}})['catch'](function(_0x4666d8){logger[_0xf203('0x24')](_0xf203('0x5e'),_0x4666d8);throw _0x4666d8;});}return _0x4aeb5a;})['then'](respondWithResult(_0xe6e3f2,0xc9))[_0xf203('0x56')](handleError(_0xe6e3f2,null));};exports[_0xf203('0x33')]=function(_0x2426a2,_0x1e8e1d){if(_0x2426a2[_0xf203('0x58')]['id']){delete _0x2426a2[_0xf203('0x58')]['id'];}return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0x2426a2['params']['id']},'include':[{'model':db['Pause'],'as':_0xf203('0x3e')}]})[_0xf203('0x1f')](handleEntityNotFound(_0x1e8e1d,null))[_0xf203('0x1f')](saveUpdates(_0x2426a2[_0xf203('0x58')],null))[_0xf203('0x1f')](respondWithResult(_0x1e8e1d,null))[_0xf203('0x56')](handleError(_0x1e8e1d,null));};exports[_0xf203('0x34')]=function(_0x223e72,_0x177b90){return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0x223e72[_0xf203('0x60')]['id']}})['then'](handleEntityNotFound(_0x177b90,null))['then'](removeEntity(_0x177b90,null))[_0xf203('0x56')](handleError(_0x177b90,null));};exports['describe']=function(_0x18cbfa,_0x521433){return db[_0xf203('0x3f')]['describe']()[_0xf203('0x1f')](respondWithResult(_0x521433,null))[_0xf203('0x56')](handleError(_0x521433,null));};exports['addDisposition']=function(_0x403e33,_0x4c43e6,_0x3dfefb){if(_0x403e33[_0xf203('0x58')]['id']){delete _0x403e33[_0xf203('0x58')]['id'];}return db['SmsAccount'][_0xf203('0x5f')]({'where':{'id':_0x403e33[_0xf203('0x60')]['id']}})['then'](handleEntityNotFound(_0x4c43e6,null))[_0xf203('0x1f')](function(_0x40faf9){if(_0x40faf9){_0x403e33['body']['SmsAccountId']=_0x40faf9['id'];return db['Disposition'][_0xf203('0x57')](_0x403e33[_0xf203('0x58')]);}})[_0xf203('0x1f')](respondWithResult(_0x4c43e6,null))['catch'](handleError(_0x4c43e6,null));};exports[_0xf203('0x61')]=function(_0x3babc9,_0x51df3f,_0x43065e){var _0x57b478={'raw':![],'where':{}};var _0x4da0fd={};var _0x1a3ecb={'count':0x0,'rows':[]};return db[_0xf203('0x3f')][_0xf203('0x62')]({'where':{'id':_0x3babc9[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0x51df3f,null))[_0xf203('0x1f')](function(_0x2bc993){if(_0x2bc993){_0x4da0fd[_0xf203('0x41')]=_['keys'](db['Disposition'][_0xf203('0x40')]);_0x4da0fd[_0xf203('0x43')]=_[_0xf203('0x42')](_0x3babc9[_0xf203('0x43')]);_0x4da0fd[_0xf203('0x4b')]=_['intersection'](_0x4da0fd[_0xf203('0x41')],_0x4da0fd[_0xf203('0x43')]);_0x57b478[_0xf203('0x46')]=_['intersection'](_0x4da0fd[_0xf203('0x41')],qs[_0xf203('0x45')](_0x3babc9[_0xf203('0x43')][_0xf203('0x45')]));_0x57b478['attributes']=_0x57b478[_0xf203('0x46')][_0xf203('0x47')]?_0x57b478[_0xf203('0x46')]:_0x4da0fd[_0xf203('0x41')];if(!_0x3babc9['query'][_0xf203('0x63')]('nolimit')){_0x57b478[_0xf203('0x2d')]=qs[_0xf203('0x2d')](_0x3babc9['query'][_0xf203('0x2d')]);_0x57b478[_0xf203('0x2c')]=qs['offset'](_0x3babc9[_0xf203('0x43')]['offset']);}_0x57b478[_0xf203('0x49')]=qs[_0xf203('0x64')](_0x3babc9[_0xf203('0x43')]['sort']);_0x57b478[_0xf203('0x4a')]=qs[_0xf203('0x4b')](_['pick'](_0x3babc9[_0xf203('0x43')],_0x4da0fd['filters']));_0x57b478[_0xf203('0x4a')][_0xf203('0x65')]=_0x2bc993['id'];if(_0x3babc9['query'][_0xf203('0x4d')]){_0x57b478[_0xf203('0x4a')]=_[_0xf203('0x4e')](_0x57b478[_0xf203('0x4a')],{'$or':_[_0xf203('0x4f')](_0x57b478[_0xf203('0x46')],function(_0x89b6ed){var _0x2c634c={};_0x2c634c[_0x89b6ed]={'$like':'%'+_0x3babc9[_0xf203('0x43')]['filter']+'%'};return _0x2c634c;})});}_0x57b478=_[_0xf203('0x4e')]({},_0x57b478,_0x3babc9[_0xf203('0x54')]);return db[_0xf203('0x66')]['count']({'where':_0x57b478[_0xf203('0x4a')]})[_0xf203('0x1f')](function(_0x32aeab){_0x1a3ecb[_0xf203('0x2b')]=_0x32aeab;if(_0x3babc9[_0xf203('0x43')][_0xf203('0x67')]){_0x57b478[_0xf203('0x55')]=[{'all':!![]}];}return db[_0xf203('0x66')]['findAll'](_0x57b478);})[_0xf203('0x1f')](function(_0x381579){_0x1a3ecb[_0xf203('0x68')]=_0x381579;return _0x1a3ecb;});}})[_0xf203('0x1f')](respondWithFilteredResult(_0x51df3f,_0x57b478))[_0xf203('0x56')](handleError(_0x51df3f,null));};exports[_0xf203('0x69')]=function(_0x1d0e2a,_0xc05f73,_0x46b82e){return db[_0xf203('0x3f')]['find']({'where':{'id':_0x1d0e2a[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0xc05f73,null))[_0xf203('0x1f')](function(_0x4a9126){if(_0x4a9126){return _0x4a9126[_0xf203('0x69')](_0x1d0e2a['query'][_0xf203('0x6a')]);}})['then'](respondWithStatusCode(_0xc05f73,null))[_0xf203('0x56')](handleError(_0xc05f73,null));};exports[_0xf203('0x6b')]=function(_0x2a63e4,_0x4d54d6,_0x4dfe71){if(_0x2a63e4[_0xf203('0x58')]['id']){delete _0x2a63e4[_0xf203('0x58')]['id'];}return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0x2a63e4[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0x4d54d6,null))[_0xf203('0x1f')](function(_0x2190e2){if(_0x2190e2){_0x2a63e4[_0xf203('0x58')][_0xf203('0x65')]=_0x2190e2['id'];return db['CannedAnswer'][_0xf203('0x57')](_0x2a63e4[_0xf203('0x58')]);}})['then'](respondWithResult(_0x4d54d6,null))[_0xf203('0x56')](handleError(_0x4d54d6,null));};exports['getAnswers']=function(_0x303c12,_0x4ec8b6,_0x2c6bd2){var _0x47346e={'raw':![],'where':{}};var _0x42809d={};var _0x1f26c0={'count':0x0,'rows':[]};return db[_0xf203('0x3f')]['findOne']({'where':{'id':_0x303c12[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0x4ec8b6,null))['then'](function(_0x5be373){if(_0x5be373){_0x42809d[_0xf203('0x41')]=_['keys'](db[_0xf203('0x6c')][_0xf203('0x40')]);_0x42809d[_0xf203('0x43')]=_[_0xf203('0x42')](_0x303c12[_0xf203('0x43')]);_0x42809d[_0xf203('0x4b')]=_[_0xf203('0x44')](_0x42809d['model'],_0x42809d[_0xf203('0x43')]);_0x47346e[_0xf203('0x46')]=_[_0xf203('0x44')](_0x42809d[_0xf203('0x41')],qs[_0xf203('0x45')](_0x303c12['query']['fields']));_0x47346e[_0xf203('0x46')]=_0x47346e[_0xf203('0x46')][_0xf203('0x47')]?_0x47346e['attributes']:_0x42809d[_0xf203('0x41')];if(!_0x303c12[_0xf203('0x43')][_0xf203('0x63')](_0xf203('0x48'))){_0x47346e[_0xf203('0x2d')]=qs[_0xf203('0x2d')](_0x303c12['query'][_0xf203('0x2d')]);_0x47346e[_0xf203('0x2c')]=qs[_0xf203('0x2c')](_0x303c12[_0xf203('0x43')]['offset']);}_0x47346e[_0xf203('0x49')]=qs[_0xf203('0x64')](_0x303c12['query']['sort']);_0x47346e['where']=qs['filters'](_[_0xf203('0x4c')](_0x303c12[_0xf203('0x43')],_0x42809d[_0xf203('0x4b')]));_0x47346e[_0xf203('0x4a')][_0xf203('0x65')]=_0x5be373['id'];if(_0x303c12[_0xf203('0x43')]['filter']){_0x47346e['where']=_[_0xf203('0x4e')](_0x47346e[_0xf203('0x4a')],{'$or':_[_0xf203('0x4f')](_0x47346e[_0xf203('0x46')],function(_0x55c9fb){var _0x4ed4f7={};_0x4ed4f7[_0x55c9fb]={'$like':'%'+_0x303c12[_0xf203('0x43')][_0xf203('0x4d')]+'%'};return _0x4ed4f7;})});}_0x47346e=_[_0xf203('0x4e')]({},_0x47346e,_0x303c12[_0xf203('0x54')]);return db[_0xf203('0x6c')]['count']({'where':_0x47346e[_0xf203('0x4a')]})[_0xf203('0x1f')](function(_0x3425da){_0x1f26c0[_0xf203('0x2b')]=_0x3425da;if(_0x303c12[_0xf203('0x43')][_0xf203('0x67')]){_0x47346e[_0xf203('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf203('0x6d')](_0x47346e);})[_0xf203('0x1f')](function(_0x2b2da0){_0x1f26c0[_0xf203('0x68')]=_0x2b2da0;return _0x1f26c0;});}})[_0xf203('0x1f')](respondWithFilteredResult(_0x4ec8b6,_0x47346e))[_0xf203('0x56')](handleError(_0x4ec8b6,null));};exports[_0xf203('0x6e')]=function(_0xe5f2c7,_0xd42728,_0x854ba9){return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0xe5f2c7[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0xd42728,null))[_0xf203('0x1f')](function(_0x56c54b){if(_0x56c54b){return _0x56c54b[_0xf203('0x6e')](_0xe5f2c7[_0xf203('0x43')][_0xf203('0x6a')]);}})['then'](respondWithStatusCode(_0xd42728,null))[_0xf203('0x56')](handleError(_0xd42728,null));};exports[_0xf203('0x6f')]=function(_0x2c7940,_0x1abf6e,_0x185279){var _0x1c0d15={'channel':_0xf203('0x70')};var _0x1a1ffb=[];var _0x5b992c=[];var _0x4b70a0={};return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0x2c7940[_0xf203('0x60')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xf203('0x71')}]})[_0xf203('0x1f')](handleEntityNotFound(_0x1abf6e,null))[_0xf203('0x1f')](function(_0x894cfb){_0x1c0d15[_0xf203('0x72')]=_0x894cfb;_0x1c0d15[_0xf203('0x73')]=_[_0xf203('0x74')](_0x894cfb[_0xf203('0x71')],[_0xf203('0x75')],[_0xf203('0x76')]);if(_0x1c0d15[_0xf203('0x72')][_0xf203('0x71')]){delete _0x1c0d15[_0xf203('0x72')][_0xf203('0x71')];}return db[_0xf203('0x77')][_0xf203('0x78')]();})['then'](function(_0x38e78a){if(!_0x38e78a){throw new db[(_0xf203('0x79'))][(_0xf203('0x1c'))](_0xf203('0x7a'));}_0x1a1ffb=_[_0xf203('0x7b')](_[_0xf203('0x42')](_0x38e78a),[_0xf203('0x7c'),_0xf203('0x7d')]);_0x5b992c=_[_0xf203('0x7b')](_[_0xf203('0x42')](_0x38e78a),[_0xf203('0x7c'),'updatedAt','CompanyId',_0xf203('0x7e')]);_0x1c0d15[_0xf203('0x58')]={'mapKey':'mobile'};if(_0x1c0d15[_0xf203('0x72')][_0xf203('0x50')]){switch(_0x1c0d15[_0xf203('0x72')]['type']){case _0xf203('0x7f'):_0x1c0d15[_0xf203('0x58')][_0xf203('0x80')]=_0x2c7940['body'][_0xf203('0x81')];_0x1c0d15['body'][_0xf203('0x58')]=_0x2c7940[_0xf203('0x58')][_0xf203('0x82')];_0x1c0d15['body']['messageId']=_0x2c7940[_0xf203('0x58')][_0xf203('0x83')];break;case _0xf203('0x84'):_0x1c0d15[_0xf203('0x58')][_0xf203('0x80')]='+'+_0x2c7940[_0xf203('0x58')]['sender'];_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')]=_0x2c7940[_0xf203('0x58')][_0xf203('0x85')];break;case _0xf203('0x86'):_0x1c0d15[_0xf203('0x58')]['from']=_0x2c7940[_0xf203('0x58')][_0xf203('0x80')];_0x1c0d15['body'][_0xf203('0x58')]=_0x2c7940['body'][_0xf203('0x27')];break;case'clicksend':_0x1c0d15[_0xf203('0x58')][_0xf203('0x80')]=_0x2c7940[_0xf203('0x58')][_0xf203('0x80')];_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')]=_0x2c7940[_0xf203('0x58')]['body'];_0x1c0d15[_0xf203('0x58')][_0xf203('0x87')]=_0x2c7940[_0xf203('0x58')][_0xf203('0x88')];break;case _0xf203('0x89'):_0x1c0d15[_0xf203('0x58')][_0xf203('0x80')]=_0x2c7940[_0xf203('0x58')][_0xf203('0x81')];_0x1c0d15[_0xf203('0x58')]['body']=_0x2c7940[_0xf203('0x58')]['Text'];_0x1c0d15[_0xf203('0x58')]['messageId']=_0x2c7940[_0xf203('0x58')][_0xf203('0x8a')];break;case _0xf203('0x8b'):_0x1c0d15[_0xf203('0x58')][_0xf203('0x80')]='+'+_0x2c7940['body']['results'][0x0][_0xf203('0x80')];_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')]=_0x2c7940[_0xf203('0x58')][_0xf203('0x8c')][0x0]['text'];_0x1c0d15['body'][_0xf203('0x87')]=_0x2c7940[_0xf203('0x58')][_0xf203('0x8c')][0x0][_0xf203('0x87')];break;case'csc':_0x1c0d15['body'][_0xf203('0x80')]=_0x2c7940[_0xf203('0x58')]['originatingAddress'];_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')]=_0x2c7940['body'][_0xf203('0x8d')]['message'];break;case _0xf203('0x8e'):_0x1c0d15[_0xf203('0x58')]['from']=_0x2c7940[_0xf203('0x58')][_0xf203('0x8f')];_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')]=_0x2c7940['body'][_0xf203('0x85')];_0x1c0d15['body'][_0xf203('0x87')]=_0x2c7940['body'][_0xf203('0x90')];break;case _0xf203('0x91'):_0x1c0d15[_0xf203('0x58')]['from']=_0x2c7940['body'][_0xf203('0x80')];_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')]=_0x2c7940[_0xf203('0x58')][_0xf203('0x27')];_0x1c0d15[_0xf203('0x58')]['messageId']=_0x2c7940[_0xf203('0x58')]['refid'];break;}}if(_0x1c0d15[_0xf203('0x58')]['id']){delete _0x1c0d15[_0xf203('0x58')]['id'];}if(_[_0xf203('0x92')](_0x1c0d15[_0xf203('0x58')]['from'])){throw new db[(_0xf203('0x79'))][(_0xf203('0x1c'))]('from\x20is\x20mandatory');}if(_[_0xf203('0x92')](_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')])||_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')]===''){throw new db[(_0xf203('0x79'))][(_0xf203('0x1c'))](_0xf203('0x93'));}if(_['isNil'](_0x1c0d15[_0xf203('0x58')][_0xf203('0x94')])){throw new db['Sequelize'][(_0xf203('0x1c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b992c);}if(!_[_0xf203('0x95')](_0x5b992c,_0x1c0d15[_0xf203('0x58')]['mapKey'])){throw new db[(_0xf203('0x79'))]['ValidationError'](_0xf203('0x96')+_0x5b992c);}_0x4b70a0[_0x1c0d15[_0xf203('0x58')][_0xf203('0x94')]]=_0x1c0d15['body']['from'];return db[_0xf203('0x97')][_0xf203('0x5f')]({'where':{'id':_0x1c0d15['account'][_0xf203('0x7e')]},'include':[{'model':db[_0xf203('0x77')],'as':_0xf203('0x98'),'where':_0x4b70a0,'limit':0x1,'order':[[_0xf203('0x7d'),_0xf203('0x99')]]}]});})[_0xf203('0x1f')](handleEntityNotFound(_0x1abf6e,null))[_0xf203('0x1f')](function(_0x2d6c32){if(_0x2d6c32){_0x1c0d15[_0xf203('0x9a')]=_[_0xf203('0x9b')](_0x2d6c32,['Contacts']);if(_0x2d6c32[_0xf203('0x98')][_0xf203('0x47')]){return _0x2d6c32[_0xf203('0x98')][0x0];}var _0x67ea59=_['defaults'](_0x1c0d15['body'],{'firstName':_0x1c0d15[_0xf203('0x58')]['from'],'ListId':_0x2d6c32['id']});_0x67ea59[_0x1c0d15[_0xf203('0x58')]['mapKey']]=_0x1c0d15[_0xf203('0x58')][_0xf203('0x80')];return db[_0xf203('0x77')][_0xf203('0x57')](_0x67ea59,{'fields':_0x1a1ffb,'raw':!![]});}})[_0xf203('0x1f')](handleEntityNotFound(_0x1abf6e,null))[_0xf203('0x1f')](function(_0x2b2192){if(_0x2b2192){_0x1c0d15['contact']=_0x2b2192;var _0x40e515={'ContactId':_0x2b2192['id'],'phone':_0x1c0d15['body']['from'],'SmsAccountId':_0x2c7940[_0xf203('0x60')]['id']};var _0x4bf904={'ContactId':_0x2b2192['id'],'SmsAccountId':_0x2c7940[_0xf203('0x60')]['id'],'closed':![]};return db['SmsInteraction'][_0xf203('0x5f')]({'where':_0x4bf904})[_0xf203('0x1f')](function(_0x5ce1c6){if(_0x5ce1c6){return[_0x5ce1c6,![]];}return db[_0xf203('0x9c')][_0xf203('0x57')](_0x40e515)[_0xf203('0x1f')](function(_0x32a419){return[_0x32a419,!![]];});});}})[_0xf203('0x9d')](function(_0x3c2f2c,_0x432ba5){_0x1c0d15[_0xf203('0x9e')]=_0x3c2f2c[_0xf203('0x35')]({'plain':!![]});_0x1c0d15[_0xf203('0x9e')]['created']=![];if(_0x432ba5){if(_0x1c0d15[_0xf203('0x72')][_0xf203('0x9f')]){_0x1c0d15[_0xf203('0x73')][_0xf203('0xa0')]({'id':0x0,'priority':_0x1c0d15[_0xf203('0x73')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xf203('0xa1')});}_0x1c0d15[_0xf203('0x9e')][_0xf203('0xa2')]=!![];}return db['SmsMessage'][_0xf203('0x57')]({'phone':_0x1c0d15[_0xf203('0x58')]['from'],'messageId':_0x1c0d15['body']['messageId'],'body':_0x1c0d15[_0xf203('0x58')][_0xf203('0x58')],'SmsAccountId':_0x2c7940[_0xf203('0x60')]['id'],'SmsInteractionId':_0x3c2f2c['id'],'direction':'in','ContactId':_0x3c2f2c[_0xf203('0xa3')],'AttachmentId':_0x1c0d15[_0xf203('0x58')]['AttachmentId']});})[_0xf203('0x1f')](function(_0x363f16){_0x1c0d15[_0xf203('0x27')]=_0x363f16;if(_0x1c0d15[_0xf203('0x9e')][_0xf203('0xa4')]){return db[_0xf203('0xa5')][_0xf203('0x5f')]({'attributes':['id',_0xf203('0x3a')],'where':{'id':_0x1c0d15[_0xf203('0x9e')][_0xf203('0xa4')]}})[_0xf203('0x1f')](function(_0xba0c1c){if(_0xba0c1c){_0x1c0d15[_0xf203('0x73')][_0xf203('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xba0c1c[_0xf203('0x3a')]+','+(_0x1c0d15[_0xf203('0x72')][_0xf203('0xa7')]||0xa),'interval':_0xf203('0xa1')});}return respondWithRpcPromise(_0xf203('0xa8'),_0xf203('0xa9'),_0x1c0d15);});}return respondWithRpcPromise(_0xf203('0xa8'),_0xf203('0xa9'),_0x1c0d15);})[_0xf203('0x1f')](function(_0x15cf18){if(_0x15cf18){var _0x1eb802=0xc8;var _0x3cfe2e=_0xf203('0xaa');logger['info'](_0xf203('0xab'),_0x3cfe2e,_0x1eb802,'entity\x20found');logger[_0xf203('0x22')](_0xf203('0xac'),_0x3cfe2e,_0x1eb802,_0xf203('0xad'),JSON[_0xf203('0x23')](_0x15cf18));if(_0x1c0d15[_0xf203('0x72')][_0xf203('0x50')]===_0xf203('0x7f')){return _0x1abf6e['status'](_0x1eb802)[_0xf203('0x2f')](_0xf203('0xae'),_0xf203('0xaf'))['send'](_0xf203('0xb0'));}else{return _0x1abf6e['status'](_0x1eb802)[_0xf203('0x2a')](_0x15cf18);}}})['catch'](handleError(_0x1abf6e,null));};exports[_0xf203('0xb1')]=function(_0x31fec9,_0x5a56aa,_0x401420){return db[_0xf203('0x3f')][_0xf203('0x62')]({'where':{'id':_0x31fec9[_0xf203('0x60')]['id']}})['then'](handleEntityNotFound(_0x5a56aa,null))[_0xf203('0x1f')](function(_0x5151d0){if(_0x5151d0){return db[_0xf203('0xb2')][_0xf203('0xb3')](function(_0x22881d){return db[_0xf203('0xb4')][_0xf203('0x34')]({'where':{'SmsAccountId':_0x31fec9[_0xf203('0x60')]['id']},'transaction':_0x22881d})['then'](function(_0x382b8d){var _0x355b09=_[_0xf203('0x4f')](_0x31fec9[_0xf203('0x58')],function(_0x18cad6){_0x18cad6[_0xf203('0x65')]=_0x31fec9['params']['id'];return _0x18cad6;});return db[_0xf203('0xb4')]['bulkCreate'](_0x355b09,{'transaction':_0x22881d});});})[_0xf203('0x1f')](function(){return db[_0xf203('0xb4')][_0xf203('0xb5')]({'where':{'SmsAccountId':_0x31fec9[_0xf203('0x60')]['id']},'order':_0xf203('0x75')});});}})['then'](respondWithResult(_0x5a56aa,null))[_0xf203('0x56')](handleError(_0x5a56aa,null));};exports['getApplications']=function(_0x2af9bc,_0x5d1fb5,_0x28a06a){var _0x160306={};var _0x70ca19={};var _0x494990;var _0x2d3d09;return db['SmsAccount'][_0xf203('0x62')]({'where':{'id':_0x2af9bc[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0x5d1fb5,null))[_0xf203('0x1f')](function(_0x566878){if(_0x566878){_0x494990=_0x566878;_0x70ca19[_0xf203('0x41')]=_[_0xf203('0x42')](db[_0xf203('0xb4')][_0xf203('0x40')]);_0x70ca19[_0xf203('0x43')]=_[_0xf203('0x42')](_0x2af9bc['query']);_0x70ca19[_0xf203('0x4b')]=_[_0xf203('0x44')](_0x70ca19['model'],_0x70ca19[_0xf203('0x43')]);_0x160306['attributes']=_['intersection'](_0x70ca19[_0xf203('0x41')],qs[_0xf203('0x45')](_0x2af9bc[_0xf203('0x43')][_0xf203('0x45')]));_0x160306[_0xf203('0x46')]=_0x160306[_0xf203('0x46')]['length']?_0x160306['attributes']:_0x70ca19[_0xf203('0x41')];_0x160306[_0xf203('0x49')]=qs[_0xf203('0x64')](_0x2af9bc[_0xf203('0x43')][_0xf203('0x64')]);_0x160306[_0xf203('0x4a')]=qs[_0xf203('0x4b')](_[_0xf203('0x4c')](_0x2af9bc[_0xf203('0x43')],_0x70ca19[_0xf203('0x4b')]));if(_0x2af9bc[_0xf203('0x43')]['filter']){_0x160306[_0xf203('0x4a')]=_[_0xf203('0x4e')](_0x160306[_0xf203('0x4a')],{'$or':_[_0xf203('0x4f')](_0x160306[_0xf203('0x46')],function(_0x551bac){var _0x50010e={};_0x50010e[_0x551bac]={'$like':'%'+_0x2af9bc[_0xf203('0x43')][_0xf203('0x4d')]+'%'};return _0x50010e;})});}_0x160306=_[_0xf203('0x4e')]({},_0x160306,_0x2af9bc[_0xf203('0x54')]);return _0x494990['getApplications'](_0x160306);}})['then'](function(_0x57157e){if(_0x57157e){_0x2d3d09=_0x57157e['length'];if(!_0x2af9bc[_0xf203('0x43')]['hasOwnProperty']('nolimit')){_0x160306[_0xf203('0x2d')]=qs['limit'](_0x2af9bc[_0xf203('0x43')][_0xf203('0x2d')]);_0x160306[_0xf203('0x2c')]=qs[_0xf203('0x2c')](_0x2af9bc[_0xf203('0x43')][_0xf203('0x2c')]);}return _0x494990[_0xf203('0xb6')](_0x160306);}})[_0xf203('0x1f')](function(_0x225ef8){if(_0x225ef8){return _0x225ef8?{'count':_0x2d3d09,'rows':_0x225ef8}:null;}})['then'](respondWithResult(_0x5d1fb5,null))[_0xf203('0x56')](handleError(_0x5d1fb5,null));};exports['getInteractions']=function(_0x4d95f7,_0x57cecc,_0x4e8489){var _0x306433={'raw':![],'where':{}};var _0x1d38f6={};var _0x1dcfda={'count':0x0,'rows':[]};return db[_0xf203('0x3f')][_0xf203('0x62')]({'where':{'id':_0x4d95f7[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0x57cecc,null))[_0xf203('0x1f')](function(_0x3230c1){if(_0x3230c1){_0x1d38f6[_0xf203('0x41')]=_[_0xf203('0x42')](db['SmsInteraction'][_0xf203('0x40')]);_0x1d38f6[_0xf203('0x43')]=_['keys'](_0x4d95f7[_0xf203('0x43')]);_0x1d38f6[_0xf203('0x4b')]=_[_0xf203('0x44')](_0x1d38f6['model'],_0x1d38f6[_0xf203('0x43')]);_0x306433[_0xf203('0x46')]=_[_0xf203('0x44')](_0x1d38f6[_0xf203('0x41')],qs[_0xf203('0x45')](_0x4d95f7[_0xf203('0x43')][_0xf203('0x45')]));_0x306433[_0xf203('0x46')]=_0x306433['attributes'][_0xf203('0x47')]?_0x306433[_0xf203('0x46')]:_0x1d38f6['model'];if(!_0x4d95f7['query']['hasOwnProperty'](_0xf203('0x48'))){_0x306433[_0xf203('0x2d')]=qs[_0xf203('0x2d')](_0x4d95f7['query'][_0xf203('0x2d')]);_0x306433[_0xf203('0x2c')]=qs[_0xf203('0x2c')](_0x4d95f7[_0xf203('0x43')][_0xf203('0x2c')]);}_0x306433[_0xf203('0x49')]=qs[_0xf203('0x64')](_0x4d95f7[_0xf203('0x43')][_0xf203('0x64')]);_0x306433[_0xf203('0x4a')]=qs[_0xf203('0x4b')](_['pick'](_0x4d95f7['query'],_0x1d38f6['filters']));_0x306433[_0xf203('0x4a')][_0xf203('0x65')]=_0x3230c1['id'];if(_0x4d95f7[_0xf203('0x43')][_0xf203('0x4d')]){_0x306433[_0xf203('0x4a')]=_[_0xf203('0x4e')](_0x306433[_0xf203('0x4a')],{'$or':_[_0xf203('0x4f')](_0x306433[_0xf203('0x46')],function(_0x5bc3f8){var _0x3609f6={};_0x3609f6[_0x5bc3f8]={'$like':'%'+_0x4d95f7['query']['filter']+'%'};return _0x3609f6;})});}_0x306433=_[_0xf203('0x4e')]({},_0x306433,_0x4d95f7[_0xf203('0x54')]);return db[_0xf203('0x9c')]['count']({'where':_0x306433[_0xf203('0x4a')]})[_0xf203('0x1f')](function(_0x3e8a02){_0x1dcfda[_0xf203('0x2b')]=_0x3e8a02;if(_0x4d95f7['query'][_0xf203('0x67')]){_0x306433[_0xf203('0x55')]=[{'model':db[_0xf203('0x77')],'as':_0xf203('0xb7'),'required':![]},{'model':db[_0xf203('0xa5')],'as':'Owner','attributes':[_0xf203('0x3a'),_0xf203('0xb8'),_0xf203('0xb9')],'required':![]},{'model':db[_0xf203('0xba')],'as':'Tags','attributes':['id',_0xf203('0x3a'),_0xf203('0xbb')],'where':_0x4d95f7[_0xf203('0x43')][_0xf203('0xbc')]?{'id':_0x4d95f7[_0xf203('0x43')]['tag']}:undefined,'required':_0x4d95f7['query'][_0xf203('0xbc')]?!![]:![]}];}return db[_0xf203('0x9c')][_0xf203('0x6d')](_0x306433);})[_0xf203('0x1f')](function(_0x8c8ec5){_0x1dcfda[_0xf203('0x68')]=_0x8c8ec5;return _0x1dcfda;});}})[_0xf203('0x1f')](respondWithFilteredResult(_0x57cecc,_0x306433))[_0xf203('0x56')](handleError(_0x57cecc,null));};exports[_0xf203('0x3b')]=function(_0x116ee8,_0x5a1953,_0x36ca5c){var _0x6884d6,_0x18bd72,_0x42f419;if(_[_0xf203('0x92')](_0x116ee8[_0xf203('0x58')][_0xf203('0x58')])||_0x116ee8[_0xf203('0x58')][_0xf203('0x58')]===''){throw new db[(_0xf203('0x79'))]['ValidationError'](_0xf203('0x93'));}if(_['isNil'](_0x116ee8['body']['to'])){throw new db[(_0xf203('0x79'))][(_0xf203('0x1c'))](_0xf203('0xbd'));}_0x6884d6=_0x116ee8['body']['to'];return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0x116ee8['params']['id']},'include':[{'model':db[_0xf203('0x97')],'as':_0xf203('0xbe'),'include':[{'model':db['CmContact'],'as':_0xf203('0x98'),'where':{'mobile':_0x6884d6},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xf203('0x1f')](handleEntityNotFound(_0x5a1953,null))['then'](function(_0x24298c){if(_0x24298c&&_0x24298c[_0xf203('0xbe')]){_0x18bd72=_0x24298c[_0xf203('0x35')]({'plain':!![]});if(_0x18bd72['List']&&_0x18bd72[_0xf203('0xbe')][_0xf203('0x98')][_0xf203('0x47')]){return _0x18bd72[_0xf203('0xbe')][_0xf203('0x98')][0x0];}return db[_0xf203('0x77')][_0xf203('0x57')](_[_0xf203('0x14')](_0x116ee8[_0xf203('0x58')],{'firstName':_0x6884d6,'mobile':_0x6884d6,'phone':_0x6884d6,'ListId':_0x18bd72[_0xf203('0x7e')]}));}})[_0xf203('0x1f')](handleEntityNotFound(_0x5a1953,null))[_0xf203('0x1f')](function(_0x4a270b){if(_0x4a270b){_0x42f419=_0x4a270b;return db['SmsInteraction'][_0xf203('0x5f')]({'where':{'ContactId':_0x42f419['id'],'closed':![],'SmsAccountId':_0x18bd72['id']}})[_0xf203('0x1f')](function(_0x227368){if(_0x227368){return[_0x227368,![]];}return db[_0xf203('0x9c')][_0xf203('0x57')]({'UserId':_0x116ee8[_0xf203('0x5b')]['id'],'ContactId':_0x42f419['id'],'SmsAccountId':_0x18bd72['id'],'phone':_0x6884d6,'firstMsgDirection':_0xf203('0xbf'),'Messages':[_['merge'](_0x116ee8[_0xf203('0x58')],{'read':![],'body':_0x116ee8[_0xf203('0x58')]['body'],'phone':_0x6884d6,'SmsAccountId':_0x18bd72['id'],'UserId':_0x116ee8[_0xf203('0x5b')]['id'],'ContactId':_0x42f419['id']})]},{'include':[{'model':db[_0xf203('0xc0')],'as':_0xf203('0xc1')}]})['then'](function(_0x13a81f){return[_0x13a81f,!![]];});});}})[_0xf203('0x9d')](function(_0x4edbd6,_0x4db9a0){if(_0x4db9a0){return _0x4edbd6;}return db[_0xf203('0xc0')]['create'](_[_0xf203('0x4e')](_0x116ee8[_0xf203('0x58')],{'read':![],'body':_0x116ee8[_0xf203('0x58')]['body'],'phone':_0x6884d6,'SmsAccountId':_0x18bd72['id'],'SmsInteractionId':_0x4edbd6['id'],'UserId':_0x116ee8[_0xf203('0x5b')]['id'],'ContactId':_0x42f419['id']}))[_0xf203('0x1f')](function(_0x5142d5){_0x4edbd6[_0xf203('0xc2')][_0xf203('0xc1')]=[];_0x4edbd6[_0xf203('0xc2')][_0xf203('0xc1')][_0xf203('0xa0')](_0x5142d5['dataValues']);return _0x4edbd6;});})[_0xf203('0x1f')](respondWithResult(_0x5a1953,null))['catch'](handleError(_0x5a1953,null));};exports[_0xf203('0x2e')]=function(_0xc4d3a0,_0xe1a53,_0x24af37){if(_0xc4d3a0['body']['id']){delete _0xc4d3a0[_0xf203('0x58')]['id'];}console[_0xf203('0xc3')]('endpoint\x20/status\x20POST\x20/',_0xc4d3a0['body']);var _0xa7277c,_0x183da4,_0x2327ec;return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0xc4d3a0[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0xe1a53,null))[_0xf203('0x1f')](function(_0x58d9a2){if(_0x58d9a2){_0x2327ec=_0x58d9a2;logger[_0xf203('0x22')](_0xf203('0xab'),'status','received\x20delivery\x20report\x20from',_0x58d9a2[_0xf203('0x50')],util[_0xf203('0xc4')](_0xc4d3a0[_0xf203('0x58')],{'showHidden':![],'depth':null}));switch(_0x58d9a2[_0xf203('0x50')]){case _0xf203('0x84'):if(_0xc4d3a0[_0xf203('0x58')]['skebby_dispatch_id']&&_0xc4d3a0['body'][_0xf203('0x2e')]){_0x183da4=_0xc4d3a0[_0xf203('0x58')]['status'];return db[_0xf203('0xc0')][_0xf203('0x5f')]({'where':{'messageId':_0xc4d3a0[_0xf203('0x58')][_0xf203('0xc5')]}});}break;case _0xf203('0x86'):if(_0xc4d3a0[_0xf203('0x58')][_0xf203('0xc6')]&&_0xc4d3a0[_0xf203('0x58')][_0xf203('0xc7')]){_0x183da4=_0xc4d3a0[_0xf203('0x58')]['statusInt'];return db[_0xf203('0xc0')][_0xf203('0x5f')]({'where':{'messageId':_0xc4d3a0[_0xf203('0x58')]['requestid']}});}break;case'clicksend':if(_0xc4d3a0['body'][_0xf203('0x88')]&&_0xc4d3a0[_0xf203('0x58')]['status_code']){_0x183da4=_0xc4d3a0[_0xf203('0x58')][_0xf203('0xc8')];return db[_0xf203('0xc0')][_0xf203('0x5f')]({'where':{'messageId':_0xc4d3a0[_0xf203('0x58')][_0xf203('0x88')]}});}break;case _0xf203('0x8b'):var _0x36a556=_0xc4d3a0[_0xf203('0x58')][_0xf203('0x8c')][0x0];if(_0x36a556[_0xf203('0x87')]&&_0x36a556[_0xf203('0x2e')][_0xf203('0xc9')]==='DELIVERED'){_0x183da4=_0x36a556[_0xf203('0x2e')][_0xf203('0xc9')];return db['SmsMessage'][_0xf203('0x5f')]({'where':{'messageId':_0x36a556[_0xf203('0x87')]}});}break;case _0xf203('0x8e'):if(_0xc4d3a0[_0xf203('0x58')][_0xf203('0x87')]&&_0xc4d3a0[_0xf203('0x58')]['status']){_0x183da4=_0xc4d3a0[_0xf203('0x58')][_0xf203('0x2e')];return db[_0xf203('0xc0')][_0xf203('0x5f')]({'where':{'messageId':_0xc4d3a0[_0xf203('0x58')][_0xf203('0x87')]}});}break;case _0xf203('0x91'):if(_0xc4d3a0['body'][_0xf203('0xca')]&&_0xc4d3a0[_0xf203('0x58')][_0xf203('0x2e')]){_0x183da4=_0xc4d3a0['body']['status'];return db['SmsMessage']['find']({'where':{'messageId':_0xc4d3a0[_0xf203('0x58')][_0xf203('0xca')]}});}break;}}})['then'](handleEntityNotFound(_0xe1a53,null))[_0xf203('0x1f')](function(_0x451d5b){if(_0x451d5b){_0xa7277c=_0x451d5b;switch(_0x2327ec['type']){case _0xf203('0x84'):if(_0x183da4===_0xf203('0xcb')){return _0xa7277c[_0xf203('0x33')]({'read':!![]});}else{logger[_0xf203('0x24')](_0xf203('0xab'),'status',_0xf203('0x84'),util['inspect'](_0xc4d3a0['body'],{'showHidden':![],'depth':null}));}break;case _0xf203('0x86'):if(_0x183da4==='1'){return _0xa7277c[_0xf203('0x33')]({'read':!![]});}else{logger[_0xf203('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf203('0x2e'),'skebby',util[_0xf203('0xc4')](_0xc4d3a0['body'],{'showHidden':![],'depth':null}));}break;case _0xf203('0xcc'):if(!_0xc4d3a0[_0xf203('0x58')][_0xf203('0xcd')]&&_0x183da4>=0xc8&&_0x183da4<=0xce){return _0xa7277c[_0xf203('0x33')]({'read':!![]});}else{logger[_0xf203('0x24')](_0xf203('0xab'),_0xf203('0x2e'),_0xf203('0xcc'),util[_0xf203('0xc4')](_0xc4d3a0[_0xf203('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x30e934=_0xc4d3a0[_0xf203('0x58')][_0xf203('0x8c')][0x0];if(_0x30e934[_0xf203('0x2e')][_0xf203('0xc9')]===_0xf203('0xcb')){return _0xa7277c[_0xf203('0x33')]({'read':!![]});}else{logger[_0xf203('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf203('0x2e'),_0xf203('0x8b'),util[_0xf203('0xc4')](_0xc4d3a0[_0xf203('0x58')],{'showHidden':![],'depth':null}));}break;case _0xf203('0x8e'):if(_0x183da4==_0xf203('0xce')||_0x183da4=='RECEIVED_BY_RECIPIENT'){return _0xa7277c[_0xf203('0x33')]({'read':!![]});}else{logger[_0xf203('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf203('0x2e'),_0xf203('0x8e'),util[_0xf203('0xc4')](_0xc4d3a0[_0xf203('0x58')],{'showHidden':![],'depth':null}));}break;case _0xf203('0x91'):if(_0x183da4===_0xf203('0xcf')||_0x183da4===_0xf203('0xd0')){return _0xa7277c[_0xf203('0x33')]({'read':!![]});}else{logger[_0xf203('0x24')](_0xf203('0xab'),_0xf203('0x2e'),_0xf203('0x91'),util[_0xf203('0xc4')](_0xc4d3a0[_0xf203('0x58')],{'showHidden':![],'depth':null}));}break;}return _0xa7277c;}})[_0xf203('0x1f')](respondWithResult(_0xe1a53,null))[_0xf203('0x56')](handleError(_0xe1a53,null));};exports[_0xf203('0xd1')]=function(_0x12b153,_0x3999da,_0x5d80d4){var _0x1ee993,_0xe6e163,_0x265575;return db[_0xf203('0x3f')]['find']({'where':{'id':_0x12b153[_0xf203('0x60')]['id']}})['then'](handleEntityNotFound(_0x3999da,null))[_0xf203('0x1f')](function(_0x1bd62a){if(_0x1bd62a){_0x265575=_0x1bd62a;logger[_0xf203('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xf203('0xd2'),_0x1bd62a['type'],util[_0xf203('0xc4')](_0x12b153['query'],{'showHidden':![],'depth':null}));switch(_0x1bd62a['type']){case _0xf203('0xd3'):if(_0x12b153['query'][_0xf203('0xd4')]&&_0x12b153[_0xf203('0x43')]['state']){_0xe6e163=_0x12b153[_0xf203('0x43')]['state'];return db['SmsMessage'][_0xf203('0x5f')]({'where':{'messageId':_0x12b153[_0xf203('0x43')][_0xf203('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x3999da,null))[_0xf203('0x1f')](function(_0x2d961d){if(_0x2d961d){_0x1ee993=_0x2d961d;switch(_0x265575[_0xf203('0x50')]){case _0xf203('0xd3'):if(_0xe6e163==='2'||_0xe6e163==='6'){return _0x1ee993[_0xf203('0x33')]({'read':!![]});}else{logger[_0xf203('0x24')](_0xf203('0xab'),'status',_0xf203('0xd3'),util[_0xf203('0xc4')](_0x12b153['query'],{'showHidden':![],'depth':null}));};break;}return _0x1ee993;}})[_0xf203('0x1f')](respondWithResult(_0x3999da,null))[_0xf203('0x56')](handleError(_0x3999da,null));};exports[_0xf203('0xd5')]=function(_0x4fba20,_0x11bab2,_0x58c86a){return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0x4fba20[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0x11bab2,null))['then'](function(_0x58fb24){if(_0x58fb24){return _0x58fb24[_0xf203('0xd5')](_0x4fba20[_0xf203('0x58')][_0xf203('0x6a')],_[_0xf203('0x9b')](_0x4fba20[_0xf203('0x58')],[_0xf203('0x6a'),'id'])||{})[_0xf203('0x9d')](function(_0x5748d9){for(var _0xe8e458=0x0;_0xe8e458<_0x4fba20[_0xf203('0x58')][_0xf203('0x6a')][_0xf203('0x47')];_0xe8e458+=0x1){socket['emit'](_0xf203('0xd6'),{'UserId':_0x4fba20['body'][_0xf203('0x6a')][_0xe8e458],'SmsAccountId':_0x4fba20['params']['id']});}return _0x5748d9;});}})[_0xf203('0x1f')](respondWithResult(_0x11bab2,null))['catch'](handleError(_0x11bab2,null));};exports[_0xf203('0xd7')]=function(_0x10c138,_0x55c2d5,_0x1f0d64){return db[_0xf203('0x3f')][_0xf203('0x5f')]({'where':{'id':_0x10c138[_0xf203('0x60')]['id']}})['then'](handleEntityNotFound(_0x55c2d5,null))[_0xf203('0x1f')](function(_0x1c7725){if(_0x1c7725){return _0x1c7725[_0xf203('0xd7')](_0x10c138[_0xf203('0x43')]['ids'])[_0xf203('0x1f')](function(){if(_[_0xf203('0xd8')](_0x10c138['query'][_0xf203('0x6a')])){for(var _0x3cfd31=0x0;_0x3cfd31<_0x10c138[_0xf203('0x43')][_0xf203('0x6a')][_0xf203('0x47')];_0x3cfd31+=0x1){socket[_0xf203('0xd9')](_0xf203('0xda'),{'UserId':Number(_0x10c138[_0xf203('0x43')][_0xf203('0x6a')][_0x3cfd31]),'SmsAccountId':Number(_0x10c138['params']['id'])});}}else{socket['emit'](_0xf203('0xda'),{'UserId':Number(_0x10c138['query'][_0xf203('0x6a')]),'SmsAccountId':Number(_0x10c138[_0xf203('0x60')]['id'])});}});}})[_0xf203('0x1f')](respondWithStatusCode(_0x55c2d5,null))['catch'](handleError(_0x55c2d5,null));};exports[_0xf203('0xdb')]=function(_0x56178,_0x1f0572,_0x485ca6){var _0x47501c={};var _0x39d3af={};var _0x2068a1;var _0x4d16ad;return db['SmsAccount'][_0xf203('0x62')]({'where':{'id':_0x56178[_0xf203('0x60')]['id']}})[_0xf203('0x1f')](handleEntityNotFound(_0x1f0572,null))[_0xf203('0x1f')](function(_0x31a40a){if(_0x31a40a){_0x2068a1=_0x31a40a;_0x39d3af[_0xf203('0x41')]=_[_0xf203('0x42')](db[_0xf203('0xa5')][_0xf203('0x40')]);_0x39d3af[_0xf203('0x43')]=_[_0xf203('0x42')](_0x56178[_0xf203('0x43')]);_0x39d3af[_0xf203('0x4b')]=_[_0xf203('0x44')](_0x39d3af[_0xf203('0x41')],_0x39d3af[_0xf203('0x43')]);_0x47501c[_0xf203('0x46')]=_[_0xf203('0x44')](_0x39d3af[_0xf203('0x41')],qs[_0xf203('0x45')](_0x56178[_0xf203('0x43')][_0xf203('0x45')]));_0x47501c[_0xf203('0x46')]=_0x47501c[_0xf203('0x46')]['length']?_0x47501c[_0xf203('0x46')]:_0x39d3af[_0xf203('0x41')];_0x47501c[_0xf203('0x49')]=qs[_0xf203('0x64')](_0x56178[_0xf203('0x43')][_0xf203('0x64')]);_0x47501c[_0xf203('0x4a')]=qs[_0xf203('0x4b')](_['pick'](_0x56178['query'],_0x39d3af[_0xf203('0x4b')]));if(_0x56178[_0xf203('0x43')][_0xf203('0x4d')]){_0x47501c[_0xf203('0x4a')]=_[_0xf203('0x4e')](_0x47501c[_0xf203('0x4a')],{'$or':_[_0xf203('0x4f')](_0x47501c['attributes'],function(_0x58b30a){var _0x284655={};_0x284655[_0x58b30a]={'$like':'%'+_0x56178[_0xf203('0x43')][_0xf203('0x4d')]+'%'};return _0x284655;})});}_0x47501c=_[_0xf203('0x4e')]({},_0x47501c,_0x56178[_0xf203('0x54')]);return _0x2068a1['getAgents'](_0x47501c);}})[_0xf203('0x1f')](function(_0x87d61d){if(_0x87d61d){_0x4d16ad=_0x87d61d[_0xf203('0x47')];if(!_0x56178[_0xf203('0x43')][_0xf203('0x63')](_0xf203('0x48'))){_0x47501c[_0xf203('0x2d')]=qs[_0xf203('0x2d')](_0x56178['query'][_0xf203('0x2d')]);_0x47501c[_0xf203('0x2c')]=qs[_0xf203('0x2c')](_0x56178['query'][_0xf203('0x2c')]);}return _0x2068a1[_0xf203('0xdb')](_0x47501c);}})[_0xf203('0x1f')](function(_0x4ab2cd){if(_0x4ab2cd){return _0x4ab2cd?{'count':_0x4d16ad,'rows':_0x4ab2cd}:null;}})[_0xf203('0x1f')](respondWithResult(_0x1f0572,null))[_0xf203('0x56')](handleError(_0x1f0572,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f806787..53d2af9 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 _0xc623=['setMaxListeners','save','update','remove','emit','events','../../mysqldb','SmsAccount'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0xc623,0xcd));var _0x3c62=function(_0x3275bc,_0x38d993){_0x3275bc=_0x3275bc-0x0;var _0x2c0dc7=_0xc623[_0x3275bc];return _0x2c0dc7;};'use strict';var EventEmitter=require(_0x3c62('0x0'));var SmsAccount=require(_0x3c62('0x1'))['db'][_0x3c62('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3c62('0x3')](0x0);var events={'afterCreate':_0x3c62('0x4'),'afterUpdate':_0x3c62('0x5'),'afterDestroy':_0x3c62('0x6')};function emitEvent(_0x41b976){return function(_0x156701,_0x10a429,_0x533d03){SmsAccountEvents[_0x3c62('0x7')](_0x41b976+':'+_0x156701['id'],_0x156701);SmsAccountEvents[_0x3c62('0x7')](_0x41b976,_0x156701);_0x533d03(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x4f11=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0x4f11,0xb4));var _0x14f1=function(_0x2aa3ae,_0x26f1f1){_0x2aa3ae=_0x2aa3ae-0x0;var _0xe4a535=_0x4f11[_0x2aa3ae];return _0xe4a535;};'use strict';var EventEmitter=require(_0x14f1('0x0'));var SmsAccount=require(_0x14f1('0x1'))['db'][_0x14f1('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x14f1('0x3')](0x0);var events={'afterCreate':_0x14f1('0x4'),'afterUpdate':_0x14f1('0x5'),'afterDestroy':_0x14f1('0x6')};function emitEvent(_0x410397){return function(_0x264ca2,_0x160200,_0x5bbe26){SmsAccountEvents[_0x14f1('0x7')](_0x410397+':'+_0x264ca2['id'],_0x264ca2);SmsAccountEvents[_0x14f1('0x7')](_0x410397,_0x264ca2);_0x5bbe26(null);};}for(var e in events){if(events[_0x14f1('0x8')](e)){var event=events[e];SmsAccount[_0x14f1('0x9')](e,emitEvent(event));}}module[_0x14f1('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index c599266..a347db6 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 _0x1982=['./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1f4441,_0x480e67){var _0x5fe64a=function(_0x487f16){while(--_0x487f16){_0x1f4441['push'](_0x1f4441['shift']());}};_0x5fe64a(++_0x480e67);}(_0x1982,0x1f3));var _0x2198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1982[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2198('0x0'));var util=require(_0x2198('0x1'));var logger=require(_0x2198('0x2'))(_0x2198('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2198('0x4'));var fs=require('fs');var path=require(_0x2198('0x5'));var rimraf=require(_0x2198('0x6'));var config=require(_0x2198('0x7'));var attributes=require(_0x2198('0x8'));module[_0x2198('0x9')]=function(_0x56a977,_0x15a441){return _0x56a977[_0x2198('0xa')](_0x2198('0xb'),attributes,{'tableName':_0x2198('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d99=['api','moment','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x4c23cc,_0x46193e){var _0x1b1dc2=function(_0x359f0d){while(--_0x359f0d){_0x4c23cc['push'](_0x4c23cc['shift']());}};_0x1b1dc2(++_0x46193e);}(_0x4d99,0xc4));var _0x94d9=function(_0x426a78,_0xab2d3e){_0x426a78=_0x426a78-0x0;var _0x2acdfb=_0x4d99[_0x426a78];return _0x2acdfb;};'use strict';var _=require(_0x94d9('0x0'));var util=require(_0x94d9('0x1'));var logger=require('../../config/logger')(_0x94d9('0x2'));var moment=require(_0x94d9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x94d9('0x4'));var rimraf=require(_0x94d9('0x5'));var config=require(_0x94d9('0x6'));var attributes=require('./smsAccount.attributes');module[_0x94d9('0x7')]=function(_0x362b38,_0x129a15){return _0x362b38[_0x94d9('0x8')](_0x94d9('0x9'),attributes,{'tableName':_0x94d9('0xa'),'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 e3373d7..4cabab8 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 _0xa64d=['then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSmsAccount','SmsAccount','options','raw','attributes','include','map','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./smsAccount.socket','register','request'];(function(_0xe8ecb4,_0x497433){var _0x27dfe3=function(_0x5ca522){while(--_0x5ca522){_0xe8ecb4['push'](_0xe8ecb4['shift']());}};_0x27dfe3(++_0x497433);}(_0xa64d,0x14e));var _0xda64=function(_0xdaec34,_0x35aca7){_0xdaec34=_0xdaec34-0x0;var _0x52c61f=_0xa64d[_0xdaec34];return _0x52c61f;};'use strict';var _=require(_0xda64('0x0'));var util=require('util');var moment=require(_0xda64('0x1'));var BPromise=require(_0xda64('0x2'));var rs=require(_0xda64('0x3'));var fs=require('fs');var Redis=require(_0xda64('0x4'));var db=require(_0xda64('0x5'))['db'];var utils=require(_0xda64('0x6'));var logger=require(_0xda64('0x7'))(_0xda64('0x8'));var config=require(_0xda64('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xda64('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xda64('0xb')],{'host':_0xda64('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda64('0xb')]));require(_0xda64('0xd'))[_0xda64('0xe')](socket);function respondWithRpcPromise(_0x10a1ff,_0x1c3c3f,_0x2c66df){return new BPromise(function(_0x550495,_0x299573){return client[_0xda64('0xf')](_0x10a1ff,_0x2c66df)[_0xda64('0x10')](function(_0x15758a){logger['info'](_0xda64('0x11'),_0x1c3c3f,_0xda64('0x12'));logger[_0xda64('0x13')](_0xda64('0x14'),_0x1c3c3f,_0xda64('0x12'),JSON[_0xda64('0x15')](_0x15758a));if(_0x15758a[_0xda64('0x16')]){if(_0x15758a[_0xda64('0x16')][_0xda64('0x17')]===0x1f4){logger[_0xda64('0x16')](_0xda64('0x11'),_0x1c3c3f,_0x15758a[_0xda64('0x16')][_0xda64('0x18')]);return _0x299573(_0x15758a['error'][_0xda64('0x18')]);}logger[_0xda64('0x16')]('SmsAccount,\x20%s,\x20%s',_0x1c3c3f,_0x15758a[_0xda64('0x16')][_0xda64('0x18')]);return _0x550495(_0x15758a[_0xda64('0x16')][_0xda64('0x18')]);}else{logger[_0xda64('0x19')]('SmsAccount,\x20%s,\x20%s',_0x1c3c3f,_0xda64('0x12'));_0x550495(_0x15758a['result'][_0xda64('0x18')]);}})['catch'](function(_0x33f64b){logger[_0xda64('0x16')]('SmsAccount,\x20%s,\x20%s',_0x1c3c3f,_0x33f64b);_0x299573(_0x33f64b);});});}exports[_0xda64('0x1a')]=function(_0x389ebf){var _0x1b4212=this;return new Promise(function(_0x2298cd,_0x545439){return db[_0xda64('0x1b')]['find']({'raw':_0x389ebf[_0xda64('0x1c')]?_0x389ebf[_0xda64('0x1c')][_0xda64('0x1d')]===undefined?!![]:![]:!![],'where':_0x389ebf[_0xda64('0x1c')]?_0x389ebf[_0xda64('0x1c')]['where']||null:null,'attributes':_0x389ebf[_0xda64('0x1c')]?_0x389ebf[_0xda64('0x1c')][_0xda64('0x1e')]||null:null,'include':_0x389ebf[_0xda64('0x1c')]?_0x389ebf[_0xda64('0x1c')][_0xda64('0x1f')]?_[_0xda64('0x20')](_0x389ebf[_0xda64('0x1c')]['include'],function(_0x232b89){return{'model':db[_0x232b89[_0xda64('0x21')]],'as':_0x232b89['as'],'attributes':_0x232b89['attributes'],'include':_0x232b89[_0xda64('0x1f')]?_[_0xda64('0x20')](_0x232b89[_0xda64('0x1f')],function(_0x2c502b){return{'model':db[_0x2c502b['model']],'as':_0x2c502b['as'],'attributes':_0x2c502b[_0xda64('0x1e')],'include':_0x2c502b[_0xda64('0x1f')]?_['map'](_0x2c502b[_0xda64('0x1f')],function(_0x2e32d6){return{'model':db[_0x2e32d6[_0xda64('0x21')]],'as':_0x2e32d6['as'],'attributes':_0x2e32d6[_0xda64('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xda64('0x10')](function(_0x133a0b){logger[_0xda64('0x19')](_0xda64('0x1a'),_0x389ebf);logger[_0xda64('0x13')](_0xda64('0x1a'),_0x389ebf,JSON[_0xda64('0x15')](_0x133a0b));_0x2298cd(_0x133a0b);})[_0xda64('0x22')](function(_0x39f8dd){logger[_0xda64('0x16')](_0xda64('0x1a'),_0x39f8dd[_0xda64('0x18')],_0x389ebf);_0x545439(_0x1b4212[_0xda64('0x16')](0x1f4,_0x39f8dd[_0xda64('0x18')]));});});}; \ No newline at end of file +var _0x0bfd=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','socket.io-emitter','then','info','request\x20sent','debug'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x0bfd,0xc1));var _0xd0bf=function(_0x233b65,_0x438922){_0x233b65=_0x233b65-0x0;var _0xcc12a0=_0x0bfd[_0x233b65];return _0xcc12a0;};'use strict';var _=require(_0xd0bf('0x0'));var util=require(_0xd0bf('0x1'));var moment=require(_0xd0bf('0x2'));var BPromise=require(_0xd0bf('0x3'));var rs=require(_0xd0bf('0x4'));var fs=require('fs');var Redis=require(_0xd0bf('0x5'));var db=require(_0xd0bf('0x6'))['db'];var utils=require(_0xd0bf('0x7'));var logger=require(_0xd0bf('0x8'))(_0xd0bf('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd0bf('0xa')]=_[_0xd0bf('0xb')](config[_0xd0bf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0bf('0xc'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x504c15,_0x26ed65,_0x5bcb33){return new BPromise(function(_0x1d96b6,_0x4a1c16){return client['request'](_0x504c15,_0x5bcb33)[_0xd0bf('0xd')](function(_0x1c7de0){logger[_0xd0bf('0xe')]('SmsAccount,\x20%s,\x20%s',_0x26ed65,_0xd0bf('0xf'));logger[_0xd0bf('0x10')](_0xd0bf('0x11'),_0x26ed65,'request\x20sent',JSON[_0xd0bf('0x12')](_0x1c7de0));if(_0x1c7de0[_0xd0bf('0x13')]){if(_0x1c7de0['error'][_0xd0bf('0x14')]===0x1f4){logger[_0xd0bf('0x13')](_0xd0bf('0x15'),_0x26ed65,_0x1c7de0[_0xd0bf('0x13')][_0xd0bf('0x16')]);return _0x4a1c16(_0x1c7de0['error'][_0xd0bf('0x16')]);}logger[_0xd0bf('0x13')](_0xd0bf('0x15'),_0x26ed65,_0x1c7de0[_0xd0bf('0x13')][_0xd0bf('0x16')]);return _0x1d96b6(_0x1c7de0['error'][_0xd0bf('0x16')]);}else{logger[_0xd0bf('0xe')](_0xd0bf('0x15'),_0x26ed65,_0xd0bf('0xf'));_0x1d96b6(_0x1c7de0[_0xd0bf('0x17')]['message']);}})[_0xd0bf('0x18')](function(_0x1f0fc7){logger[_0xd0bf('0x13')]('SmsAccount,\x20%s,\x20%s',_0x26ed65,_0x1f0fc7);_0x4a1c16(_0x1f0fc7);});});}exports[_0xd0bf('0x19')]=function(_0x11a3f7){var _0x2127f2=this;return new Promise(function(_0x5e091f,_0x1a14b1){return db[_0xd0bf('0x1a')][_0xd0bf('0x1b')]({'raw':_0x11a3f7[_0xd0bf('0x1c')]?_0x11a3f7[_0xd0bf('0x1c')][_0xd0bf('0x1d')]===undefined?!![]:![]:!![],'where':_0x11a3f7[_0xd0bf('0x1c')]?_0x11a3f7['options'][_0xd0bf('0x1e')]||null:null,'attributes':_0x11a3f7[_0xd0bf('0x1c')]?_0x11a3f7['options'][_0xd0bf('0x1f')]||null:null,'include':_0x11a3f7[_0xd0bf('0x1c')]?_0x11a3f7[_0xd0bf('0x1c')]['include']?_['map'](_0x11a3f7['options'][_0xd0bf('0x20')],function(_0x36e126){return{'model':db[_0x36e126[_0xd0bf('0x21')]],'as':_0x36e126['as'],'attributes':_0x36e126['attributes'],'include':_0x36e126[_0xd0bf('0x20')]?_[_0xd0bf('0x22')](_0x36e126['include'],function(_0x53283c){return{'model':db[_0x53283c['model']],'as':_0x53283c['as'],'attributes':_0x53283c[_0xd0bf('0x1f')],'include':_0x53283c[_0xd0bf('0x20')]?_[_0xd0bf('0x22')](_0x53283c[_0xd0bf('0x20')],function(_0x29e75d){return{'model':db[_0x29e75d[_0xd0bf('0x21')]],'as':_0x29e75d['as'],'attributes':_0x29e75d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd0bf('0xd')](function(_0x18bf50){logger[_0xd0bf('0xe')]('ShowSmsAccount',_0x11a3f7);logger[_0xd0bf('0x10')](_0xd0bf('0x19'),_0x11a3f7,JSON[_0xd0bf('0x12')](_0x18bf50));_0x5e091f(_0x18bf50);})[_0xd0bf('0x18')](function(_0x4e4aec){logger['error'](_0xd0bf('0x19'),_0x4e4aec[_0xd0bf('0x16')],_0x11a3f7);_0x1a14b1(_0x2127f2[_0xd0bf('0x13')](0x1f4,_0x4e4aec['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 96b3d30..5cf80b3 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 _0x1a4d=['smsAccount:','./smsAccount.events','save','update','emit','removeListener','length'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1a4d,0x189));var _0xd1a4=function(_0x47b51e,_0x564589){_0x47b51e=_0x47b51e-0x0;var _0x32a974=_0x1a4d[_0x47b51e];return _0x32a974;};'use strict';var SmsAccountEvents=require(_0xd1a4('0x0'));var events=[_0xd1a4('0x1'),'remove',_0xd1a4('0x2')];function createListener(_0x462d40,_0x1f9c64){return function(_0x3fc02f){_0x1f9c64[_0xd1a4('0x3')](_0x462d40,_0x3fc02f);};}function removeListener(_0x262fed,_0x38c852){return function(){SmsAccountEvents[_0xd1a4('0x4')](_0x262fed,_0x38c852);};}exports['register']=function(_0x273f84){for(var _0x439cdb=0x0,_0x29010f=events[_0xd1a4('0x5')];_0x439cdb<_0x29010f;_0x439cdb++){var _0x238061=events[_0x439cdb];var _0x86c4e4=createListener(_0xd1a4('0x6')+_0x238061,_0x273f84);SmsAccountEvents['on'](_0x238061,_0x86c4e4);}}; \ No newline at end of file +var _0xb5d4=['removeListener','register','length','smsAccount:','./smsAccount.events','save','remove','update'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb5d4,0xcc));var _0x4b5d=function(_0x44067c,_0x5a2285){_0x44067c=_0x44067c-0x0;var _0x423094=_0xb5d4[_0x44067c];return _0x423094;};'use strict';var SmsAccountEvents=require(_0x4b5d('0x0'));var events=[_0x4b5d('0x1'),_0x4b5d('0x2'),_0x4b5d('0x3')];function createListener(_0x303b50,_0x436b1e){return function(_0x9093ce){_0x436b1e['emit'](_0x303b50,_0x9093ce);};}function removeListener(_0xaa360d,_0x40cf8f){return function(){SmsAccountEvents[_0x4b5d('0x4')](_0xaa360d,_0x40cf8f);};}exports[_0x4b5d('0x5')]=function(_0x2aa5a7){for(var _0x431e9d=0x0,_0x40ecc=events[_0x4b5d('0x6')];_0x431e9d<_0x40ecc;_0x431e9d++){var _0xa6102d=events[_0x431e9d];var _0x53c70d=createListener(_0x4b5d('0x7')+_0xa6102d,_0x2aa5a7);SmsAccountEvents['on'](_0xa6102d,_0x53c70d);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 7309cf4..10398ba 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 _0xed6a=['put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','post','create'];(function(_0x234bcb,_0x49d618){var _0x4f807c=function(_0x131cfa){while(--_0x131cfa){_0x234bcb['push'](_0x234bcb['shift']());}};_0x4f807c(++_0x49d618);}(_0xed6a,0x1e9));var _0xaed6=function(_0x52dc53,_0x104380){_0x52dc53=_0x52dc53-0x0;var _0x2bc442=_0xed6a[_0x52dc53];return _0x2bc442;};'use strict';var multer=require(_0xaed6('0x0'));var util=require('util');var path=require(_0xaed6('0x1'));var timeout=require(_0xaed6('0x2'));var express=require(_0xaed6('0x3'));var router=express[_0xaed6('0x4')]();var auth=require(_0xaed6('0x5'));var interaction=require(_0xaed6('0x6'));var config=require(_0xaed6('0x7'));var controller=require(_0xaed6('0x8'));router[_0xaed6('0x9')]('/',auth[_0xaed6('0xa')](),controller[_0xaed6('0xb')]);router['get']('/:id',auth[_0xaed6('0xa')](),controller[_0xaed6('0xc')]);router[_0xaed6('0xd')]('/',auth[_0xaed6('0xa')](),controller[_0xaed6('0xe')]);router[_0xaed6('0xf')]('/:id',auth[_0xaed6('0xa')](),controller[_0xaed6('0x10')]);router[_0xaed6('0x11')](_0xaed6('0x12'),auth[_0xaed6('0xa')](),controller[_0xaed6('0x13')]);module[_0xaed6('0x14')]=router; \ No newline at end of file +var _0x8311=['post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x40b329,_0x37b413){var _0x37b4ae=function(_0x29613e){while(--_0x29613e){_0x40b329['push'](_0x40b329['shift']());}};_0x37b4ae(++_0x37b413);}(_0x8311,0x17c));var _0x1831=function(_0x209787,_0x58616a){_0x209787=_0x209787-0x0;var _0x26d73e=_0x8311[_0x209787];return _0x26d73e;};'use strict';var multer=require(_0x1831('0x0'));var util=require(_0x1831('0x1'));var path=require(_0x1831('0x2'));var timeout=require(_0x1831('0x3'));var express=require('express');var router=express[_0x1831('0x4')]();var auth=require(_0x1831('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1831('0x6'));var controller=require(_0x1831('0x7'));router[_0x1831('0x8')]('/',auth[_0x1831('0x9')](),controller[_0x1831('0xa')]);router[_0x1831('0x8')]('/:id',auth[_0x1831('0x9')](),controller['show']);router[_0x1831('0xb')]('/',auth['isAuthenticated'](),controller[_0x1831('0xc')]);router[_0x1831('0xd')](_0x1831('0xe'),auth[_0x1831('0x9')](),controller['update']);router[_0x1831('0xf')](_0x1831('0xe'),auth[_0x1831('0x9')](),controller['destroy']);module[_0x1831('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f85f8a8..9321f9d 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 _0x5980=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x540d4c,_0x3d9cd4){var _0x3c4de8=function(_0x4f318a){while(--_0x4f318a){_0x540d4c['push'](_0x540d4c['shift']());}};_0x3c4de8(++_0x3d9cd4);}(_0x5980,0xda));var _0x0598=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x5980[_0x1af5b2];return _0xf1aa2d;};'use strict';var Sequelize=require(_0x0598('0x0'));module[_0x0598('0x1')]={'priority':{'type':Sequelize[_0x0598('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0598('0x3')],'allowNull':![],'defaultValue':_0x0598('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0598('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0598('0x5')}}; \ No newline at end of file +var _0x2d1b=['STRING','exports','INTEGER','TEXT'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x2d1b,0x6d));var _0xb2d1=function(_0x240ade,_0x436586){_0x240ade=_0x240ade-0x0;var _0x5c7dcf=_0x2d1b[_0x240ade];return _0x5c7dcf;};'use strict';var Sequelize=require('sequelize');module[_0xb2d1('0x0')]={'priority':{'type':Sequelize[_0xb2d1('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb2d1('0x2')]()},'description':{'type':Sequelize[_0xb2d1('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4f0e410..55fb5ff 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 _0xc996=['model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','SmsApplication','rawAttributes'];(function(_0x5b7696,_0x3ebd92){var _0x42d7b9=function(_0x8afd44){while(--_0x8afd44){_0x5b7696['push'](_0x5b7696['shift']());}};_0x42d7b9(++_0x3ebd92);}(_0xc996,0x178));var _0x6c99=function(_0x5676e9,_0x32f061){_0x5676e9=_0x5676e9-0x0;var _0x45a324=_0xc996[_0x5676e9];return _0x45a324;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6c99('0x0'));var zipdir=require(_0x6c99('0x1'));var jsonpatch=require(_0x6c99('0x2'));var rp=require(_0x6c99('0x3'));var moment=require('moment');var BPromise=require(_0x6c99('0x4'));var Mustache=require('mustache');var util=require(_0x6c99('0x5'));var path=require(_0x6c99('0x6'));var sox=require(_0x6c99('0x7'));var csv=require('to-csv');var ejs=require(_0x6c99('0x8'));var fs=require('fs');var _=require(_0x6c99('0x9'));var squel=require(_0x6c99('0xa'));var crypto=require(_0x6c99('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c99('0xc'));var querystring=require(_0x6c99('0xd'));var Papa=require('papaparse');var Redis=require(_0x6c99('0xe'));var authService=require(_0x6c99('0xf'));var qs=require(_0x6c99('0x10'));var hardwareService=require(_0x6c99('0x11'));var logger=require('../../config/logger')(_0x6c99('0x12'));var utils=require(_0x6c99('0x13'));var config=require('../../config/environment');var db=require(_0x6c99('0x14'))['db'];function respondWithStatusCode(_0x2ca4e2,_0x32f84a){_0x32f84a=_0x32f84a||0xcc;return function(_0x316cad){if(_0x316cad){return _0x2ca4e2['sendStatus'](_0x32f84a);}return _0x2ca4e2[_0x6c99('0x15')](_0x32f84a)[_0x6c99('0x16')]();};}function respondWithResult(_0x4ed7b0,_0x4bf622){_0x4bf622=_0x4bf622||0xc8;return function(_0x38da47){if(_0x38da47){return _0x4ed7b0['status'](_0x4bf622)['json'](_0x38da47);}};}function respondWithFilteredResult(_0x5ceb48,_0x3aef49){return function(_0x3dba7b){if(_0x3dba7b){var _0x62d303=_0x3dba7b['count'],_0x1f45fa=_0x3aef49['offset'],_0x11f05b=_0x3aef49[_0x6c99('0x17')]+_0x3aef49[_0x6c99('0x18')],_0x9708cb;if(_0x11f05b>=_0x62d303){_0x11f05b=_0x62d303;_0x9708cb=0xc8;}else{_0x9708cb=0xce;}_0x5ceb48['status'](_0x9708cb);return _0x5ceb48[_0x6c99('0x19')](_0x6c99('0x1a'),_0x1f45fa+'-'+_0x11f05b+'/'+_0x62d303)['json'](_0x3dba7b);}return null;};}function patchUpdates(_0x8e7844){return function(_0xcf6104){try{jsonpatch[_0x6c99('0x1b')](_0xcf6104,_0x8e7844,!![]);}catch(_0x3f2a73){return BPromise[_0x6c99('0x1c')](_0x3f2a73);}return _0xcf6104[_0x6c99('0x1d')]();};}function saveUpdates(_0x592218,_0x20d2d1){return function(_0x4f80d3){if(_0x4f80d3){return _0x4f80d3[_0x6c99('0x1e')](_0x592218)[_0x6c99('0x1f')](function(_0x31f2eb){return _0x31f2eb;});}return null;};}function removeEntity(_0xc93060,_0x917ade){return function(_0x4cc0e0){if(_0x4cc0e0){return _0x4cc0e0[_0x6c99('0x20')]()[_0x6c99('0x1f')](function(){_0xc93060['status'](0xcc)[_0x6c99('0x16')]();});}};}function handleEntityNotFound(_0x4b19df,_0x558654){return function(_0x574c0e){if(!_0x574c0e){_0x4b19df[_0x6c99('0x21')](0x194);}return _0x574c0e;};}function handleError(_0x5e3832,_0x61f3d2){_0x61f3d2=_0x61f3d2||0x1f4;return function(_0x3a4066){logger[_0x6c99('0x22')](_0x3a4066['stack']);if(_0x3a4066[_0x6c99('0x23')]){delete _0x3a4066[_0x6c99('0x23')];}_0x5e3832[_0x6c99('0x15')](_0x61f3d2)['send'](_0x3a4066);};}exports['index']=function(_0x3cea81,_0x570b23){var _0x30a996={},_0x15858a={},_0x5c1797={'count':0x0,'rows':[]};var _0x38f7df=db[_0x6c99('0x24')][_0x6c99('0x25')];_0x15858a[_0x6c99('0x26')]=_[_0x6c99('0x27')](_0x38f7df);_0x15858a[_0x6c99('0x28')]=_[_0x6c99('0x27')](_0x3cea81[_0x6c99('0x28')]);_0x15858a[_0x6c99('0x29')]=_['intersection'](_0x15858a['model'],_0x15858a['query']);_0x30a996['attributes']=_[_0x6c99('0x2a')](_0x15858a[_0x6c99('0x26')],qs[_0x6c99('0x2b')](_0x3cea81[_0x6c99('0x28')][_0x6c99('0x2b')]));_0x30a996[_0x6c99('0x2c')]=_0x30a996[_0x6c99('0x2c')][_0x6c99('0x2d')]?_0x30a996[_0x6c99('0x2c')]:_0x15858a[_0x6c99('0x26')];if(!_0x3cea81[_0x6c99('0x28')][_0x6c99('0x2e')](_0x6c99('0x2f'))){_0x30a996[_0x6c99('0x18')]=qs['limit'](_0x3cea81[_0x6c99('0x28')][_0x6c99('0x18')]);_0x30a996[_0x6c99('0x17')]=qs[_0x6c99('0x17')](_0x3cea81[_0x6c99('0x28')][_0x6c99('0x17')]);}_0x30a996['order']=qs[_0x6c99('0x30')](_0x3cea81['query']['sort']);_0x30a996['where']=qs[_0x6c99('0x29')](_[_0x6c99('0x31')](_0x3cea81[_0x6c99('0x28')],_0x15858a['filters']));if(_0x3cea81['query'][_0x6c99('0x32')]){_0x30a996[_0x6c99('0x33')]=_[_0x6c99('0x34')](_0x30a996[_0x6c99('0x33')],{'$or':_[_0x6c99('0x35')](_0x38f7df,function(_0x518ba2){if(_0x518ba2[_0x6c99('0x36')]['key']!==_0x6c99('0x37')){var _0x273664={};_0x273664[_0x518ba2[_0x6c99('0x38')]]={'$like':'%'+_0x3cea81[_0x6c99('0x28')][_0x6c99('0x32')]+'%'};return _0x273664;}})});}_0x30a996=_[_0x6c99('0x34')]({},_0x30a996,_0x3cea81[_0x6c99('0x39')]);var _0x92c84d={'where':_0x30a996[_0x6c99('0x33')]};return db[_0x6c99('0x24')][_0x6c99('0x3a')](_0x92c84d)['then'](function(_0xa90665){_0x5c1797[_0x6c99('0x3a')]=_0xa90665;if(_0x3cea81[_0x6c99('0x28')][_0x6c99('0x3b')]){_0x30a996[_0x6c99('0x3c')]=[{'all':!![]}];}return db['SmsApplication'][_0x6c99('0x3d')](_0x30a996);})[_0x6c99('0x1f')](function(_0x277cd0){_0x5c1797[_0x6c99('0x3e')]=_0x277cd0;return _0x5c1797;})[_0x6c99('0x1f')](respondWithFilteredResult(_0x570b23,_0x30a996))[_0x6c99('0x3f')](handleError(_0x570b23,null));};exports[_0x6c99('0x40')]=function(_0x157671,_0x2aaca1){var _0x24bca7={'raw':!![],'where':{'id':_0x157671['params']['id']}},_0xdfe690={};_0xdfe690['model']=_[_0x6c99('0x27')](db['SmsApplication'][_0x6c99('0x25')]);_0xdfe690['query']=_[_0x6c99('0x27')](_0x157671['query']);_0xdfe690[_0x6c99('0x29')]=_[_0x6c99('0x2a')](_0xdfe690[_0x6c99('0x26')],_0xdfe690[_0x6c99('0x28')]);_0x24bca7[_0x6c99('0x2c')]=_[_0x6c99('0x2a')](_0xdfe690[_0x6c99('0x26')],qs[_0x6c99('0x2b')](_0x157671[_0x6c99('0x28')][_0x6c99('0x2b')]));_0x24bca7[_0x6c99('0x2c')]=_0x24bca7[_0x6c99('0x2c')][_0x6c99('0x2d')]?_0x24bca7[_0x6c99('0x2c')]:_0xdfe690['model'];if(_0x157671[_0x6c99('0x28')][_0x6c99('0x3b')]){_0x24bca7[_0x6c99('0x3c')]=[{'all':!![]}];}_0x24bca7=_['merge']({},_0x24bca7,_0x157671[_0x6c99('0x39')]);return db[_0x6c99('0x24')][_0x6c99('0x41')](_0x24bca7)[_0x6c99('0x1f')](handleEntityNotFound(_0x2aaca1,null))[_0x6c99('0x1f')](respondWithResult(_0x2aaca1,null))[_0x6c99('0x3f')](handleError(_0x2aaca1,null));};exports[_0x6c99('0x42')]=function(_0x212f87,_0x3ca74d){return db[_0x6c99('0x24')][_0x6c99('0x42')](_0x212f87[_0x6c99('0x43')],{})[_0x6c99('0x1f')](respondWithResult(_0x3ca74d,0xc9))['catch'](handleError(_0x3ca74d,null));};exports[_0x6c99('0x1e')]=function(_0x584fe5,_0x3c2ded){if(_0x584fe5[_0x6c99('0x43')]['id']){delete _0x584fe5['body']['id'];}return db['SmsApplication'][_0x6c99('0x41')]({'where':{'id':_0x584fe5[_0x6c99('0x44')]['id']}})[_0x6c99('0x1f')](handleEntityNotFound(_0x3c2ded,null))[_0x6c99('0x1f')](saveUpdates(_0x584fe5['body'],null))[_0x6c99('0x1f')](respondWithResult(_0x3c2ded,null))[_0x6c99('0x3f')](handleError(_0x3c2ded,null));};exports[_0x6c99('0x20')]=function(_0x46e1ce,_0x1aae86){return db[_0x6c99('0x24')][_0x6c99('0x41')]({'where':{'id':_0x46e1ce[_0x6c99('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aae86,null))[_0x6c99('0x1f')](removeEntity(_0x1aae86,null))[_0x6c99('0x3f')](handleError(_0x1aae86,null));}; \ No newline at end of file +var _0x2256=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','index','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','type','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2256,0x1f2));var _0x6225=function(_0x5bf4bc,_0x503342){_0x5bf4bc=_0x5bf4bc-0x0;var _0x231aef=_0x2256[_0x5bf4bc];return _0x231aef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6225('0x0'));var rimraf=require(_0x6225('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6225('0x2'));var rp=require(_0x6225('0x3'));var moment=require(_0x6225('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6225('0x5'));var util=require(_0x6225('0x6'));var path=require(_0x6225('0x7'));var sox=require('sox');var csv=require(_0x6225('0x8'));var ejs=require(_0x6225('0x9'));var fs=require('fs');var _=require(_0x6225('0xa'));var squel=require(_0x6225('0xb'));var crypto=require(_0x6225('0xc'));var jsforce=require(_0x6225('0xd'));var deskjs=require(_0x6225('0xe'));var toCsv=require(_0x6225('0x8'));var querystring=require(_0x6225('0xf'));var Papa=require('papaparse');var Redis=require(_0x6225('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6225('0x11'));var hardwareService=require(_0x6225('0x12'));var logger=require(_0x6225('0x13'))(_0x6225('0x14'));var utils=require(_0x6225('0x15'));var config=require('../../config/environment');var db=require(_0x6225('0x16'))['db'];function respondWithStatusCode(_0x261802,_0x2542e0){_0x2542e0=_0x2542e0||0xcc;return function(_0x5731ab){if(_0x5731ab){return _0x261802[_0x6225('0x17')](_0x2542e0);}return _0x261802[_0x6225('0x18')](_0x2542e0)['end']();};}function respondWithResult(_0x485569,_0x507c66){_0x507c66=_0x507c66||0xc8;return function(_0x502f3f){if(_0x502f3f){return _0x485569[_0x6225('0x18')](_0x507c66)['json'](_0x502f3f);}};}function respondWithFilteredResult(_0x33e76d,_0x22cbf3){return function(_0x179216){if(_0x179216){var _0x3c7949=_0x179216[_0x6225('0x19')],_0xa4cde4=_0x22cbf3[_0x6225('0x1a')],_0x40e1b5=_0x22cbf3[_0x6225('0x1a')]+_0x22cbf3[_0x6225('0x1b')],_0x2c1e4b;if(_0x40e1b5>=_0x3c7949){_0x40e1b5=_0x3c7949;_0x2c1e4b=0xc8;}else{_0x2c1e4b=0xce;}_0x33e76d[_0x6225('0x18')](_0x2c1e4b);return _0x33e76d['set'](_0x6225('0x1c'),_0xa4cde4+'-'+_0x40e1b5+'/'+_0x3c7949)[_0x6225('0x1d')](_0x179216);}return null;};}function patchUpdates(_0x11c437){return function(_0xa0697d){try{jsonpatch[_0x6225('0x1e')](_0xa0697d,_0x11c437,!![]);}catch(_0x3d2989){return BPromise[_0x6225('0x1f')](_0x3d2989);}return _0xa0697d[_0x6225('0x20')]();};}function saveUpdates(_0x32c1f8,_0x555c87){return function(_0x1de809){if(_0x1de809){return _0x1de809[_0x6225('0x21')](_0x32c1f8)['then'](function(_0x58d0dc){return _0x58d0dc;});}return null;};}function removeEntity(_0x295997,_0x39fa07){return function(_0x5c7620){if(_0x5c7620){return _0x5c7620['destroy']()[_0x6225('0x22')](function(){_0x295997[_0x6225('0x18')](0xcc)[_0x6225('0x23')]();});}};}function handleEntityNotFound(_0x205db2,_0x51f5e1){return function(_0x11de4e){if(!_0x11de4e){_0x205db2[_0x6225('0x17')](0x194);}return _0x11de4e;};}function handleError(_0x219700,_0x2354f9){_0x2354f9=_0x2354f9||0x1f4;return function(_0x459bef){logger[_0x6225('0x24')](_0x459bef[_0x6225('0x25')]);if(_0x459bef['name']){delete _0x459bef[_0x6225('0x26')];}_0x219700[_0x6225('0x18')](_0x2354f9)['send'](_0x459bef);};}exports[_0x6225('0x27')]=function(_0x58cb11,_0x478b3a){var _0x1f1d14={},_0x52c2e2={},_0x4aff18={'count':0x0,'rows':[]};var _0x33e823=db['SmsApplication'][_0x6225('0x28')];_0x52c2e2[_0x6225('0x29')]=_[_0x6225('0x2a')](_0x33e823);_0x52c2e2['query']=_[_0x6225('0x2a')](_0x58cb11[_0x6225('0x2b')]);_0x52c2e2[_0x6225('0x2c')]=_['intersection'](_0x52c2e2[_0x6225('0x29')],_0x52c2e2[_0x6225('0x2b')]);_0x1f1d14[_0x6225('0x2d')]=_['intersection'](_0x52c2e2[_0x6225('0x29')],qs[_0x6225('0x2e')](_0x58cb11[_0x6225('0x2b')]['fields']));_0x1f1d14[_0x6225('0x2d')]=_0x1f1d14[_0x6225('0x2d')][_0x6225('0x2f')]?_0x1f1d14[_0x6225('0x2d')]:_0x52c2e2['model'];if(!_0x58cb11[_0x6225('0x2b')][_0x6225('0x30')](_0x6225('0x31'))){_0x1f1d14['limit']=qs[_0x6225('0x1b')](_0x58cb11[_0x6225('0x2b')][_0x6225('0x1b')]);_0x1f1d14['offset']=qs[_0x6225('0x1a')](_0x58cb11[_0x6225('0x2b')]['offset']);}_0x1f1d14[_0x6225('0x32')]=qs[_0x6225('0x33')](_0x58cb11[_0x6225('0x2b')][_0x6225('0x33')]);_0x1f1d14['where']=qs['filters'](_['pick'](_0x58cb11[_0x6225('0x2b')],_0x52c2e2[_0x6225('0x2c')]));if(_0x58cb11['query'][_0x6225('0x34')]){_0x1f1d14[_0x6225('0x35')]=_[_0x6225('0x36')](_0x1f1d14[_0x6225('0x35')],{'$or':_[_0x6225('0x37')](_0x33e823,function(_0xd110ce){if(_0xd110ce[_0x6225('0x38')]['key']!==_0x6225('0x39')){var _0x3e9d5f={};_0x3e9d5f[_0xd110ce['field']]={'$like':'%'+_0x58cb11[_0x6225('0x2b')][_0x6225('0x34')]+'%'};return _0x3e9d5f;}})});}_0x1f1d14=_[_0x6225('0x36')]({},_0x1f1d14,_0x58cb11[_0x6225('0x3a')]);var _0x114bdc={'where':_0x1f1d14[_0x6225('0x35')]};return db[_0x6225('0x3b')][_0x6225('0x19')](_0x114bdc)[_0x6225('0x22')](function(_0x4eddb6){_0x4aff18['count']=_0x4eddb6;if(_0x58cb11[_0x6225('0x2b')][_0x6225('0x3c')]){_0x1f1d14[_0x6225('0x3d')]=[{'all':!![]}];}return db[_0x6225('0x3b')][_0x6225('0x3e')](_0x1f1d14);})['then'](function(_0x28544d){_0x4aff18[_0x6225('0x3f')]=_0x28544d;return _0x4aff18;})[_0x6225('0x22')](respondWithFilteredResult(_0x478b3a,_0x1f1d14))['catch'](handleError(_0x478b3a,null));};exports[_0x6225('0x40')]=function(_0x2c02c4,_0x19b914){var _0x1c1636={'raw':!![],'where':{'id':_0x2c02c4[_0x6225('0x41')]['id']}},_0x496160={};_0x496160[_0x6225('0x29')]=_[_0x6225('0x2a')](db[_0x6225('0x3b')][_0x6225('0x28')]);_0x496160[_0x6225('0x2b')]=_[_0x6225('0x2a')](_0x2c02c4[_0x6225('0x2b')]);_0x496160['filters']=_[_0x6225('0x42')](_0x496160[_0x6225('0x29')],_0x496160[_0x6225('0x2b')]);_0x1c1636[_0x6225('0x2d')]=_[_0x6225('0x42')](_0x496160[_0x6225('0x29')],qs[_0x6225('0x2e')](_0x2c02c4[_0x6225('0x2b')][_0x6225('0x2e')]));_0x1c1636[_0x6225('0x2d')]=_0x1c1636[_0x6225('0x2d')][_0x6225('0x2f')]?_0x1c1636[_0x6225('0x2d')]:_0x496160[_0x6225('0x29')];if(_0x2c02c4[_0x6225('0x2b')][_0x6225('0x3c')]){_0x1c1636[_0x6225('0x3d')]=[{'all':!![]}];}_0x1c1636=_[_0x6225('0x36')]({},_0x1c1636,_0x2c02c4[_0x6225('0x3a')]);return db['SmsApplication'][_0x6225('0x43')](_0x1c1636)[_0x6225('0x22')](handleEntityNotFound(_0x19b914,null))[_0x6225('0x22')](respondWithResult(_0x19b914,null))[_0x6225('0x44')](handleError(_0x19b914,null));};exports[_0x6225('0x45')]=function(_0x2d709d,_0x495982){return db['SmsApplication'][_0x6225('0x45')](_0x2d709d['body'],{})[_0x6225('0x22')](respondWithResult(_0x495982,0xc9))['catch'](handleError(_0x495982,null));};exports[_0x6225('0x21')]=function(_0x437c8e,_0x4c5498){if(_0x437c8e['body']['id']){delete _0x437c8e[_0x6225('0x46')]['id'];}return db['SmsApplication'][_0x6225('0x43')]({'where':{'id':_0x437c8e[_0x6225('0x41')]['id']}})['then'](handleEntityNotFound(_0x4c5498,null))['then'](saveUpdates(_0x437c8e[_0x6225('0x46')],null))[_0x6225('0x22')](respondWithResult(_0x4c5498,null))[_0x6225('0x44')](handleError(_0x4c5498,null));};exports[_0x6225('0x47')]=function(_0x46eb7f,_0x1008e5){return db[_0x6225('0x3b')]['find']({'where':{'id':_0x46eb7f['params']['id']}})[_0x6225('0x22')](handleEntityNotFound(_0x1008e5,null))['then'](removeEntity(_0x1008e5,null))[_0x6225('0x44')](handleError(_0x1008e5,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 2c11294..5108d4c 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 _0x9ec3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x56ed01,_0x119299){var _0x4dae67=function(_0x1d547b){while(--_0x1d547b){_0x56ed01['push'](_0x56ed01['shift']());}};_0x4dae67(++_0x119299);}(_0x9ec3,0xb3));var _0x39ec=function(_0x1ba2e5,_0xbcc3fb){_0x1ba2e5=_0x1ba2e5-0x0;var _0x2b8957=_0x9ec3[_0x1ba2e5];return _0x2b8957;};'use strict';var _=require(_0x39ec('0x0'));var util=require('util');var logger=require(_0x39ec('0x1'))('api');var moment=require(_0x39ec('0x2'));var BPromise=require(_0x39ec('0x3'));var rp=require(_0x39ec('0x4'));var fs=require('fs');var path=require(_0x39ec('0x5'));var rimraf=require(_0x39ec('0x6'));var config=require(_0x39ec('0x7'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0xc9add2,_0xaaee33){return _0xc9add2[_0x39ec('0x8')]('SmsApplication',attributes,{'tableName':_0x39ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x39ec('0xa'),'collate':_0x39ec('0xb')});}; \ No newline at end of file +var _0x3690=['../../config/environment','./smsApplication.attributes','exports','SmsApplication','utf8mb4_unicode_ci','util','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3690,0xd5));var _0x0369=function(_0x59e35e,_0x173a40){_0x59e35e=_0x59e35e-0x0;var _0x546e14=_0x3690[_0x59e35e];return _0x546e14;};'use strict';var _=require('lodash');var util=require(_0x0369('0x0'));var logger=require('../../config/logger')(_0x0369('0x1'));var moment=require(_0x0369('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0369('0x3'));var attributes=require(_0x0369('0x4'));module[_0x0369('0x5')]=function(_0x458ab4,_0x519cba){return _0x458ab4['define'](_0x0369('0x6'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0369('0x7')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3610c5b..1777a99 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 _0xe5d5=['request\x20sent','result','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xe5d5,0x156));var _0x5e5d=function(_0x12849e,_0x5aa1d6){_0x12849e=_0x12849e-0x0;var _0x3d69f5=_0xe5d5[_0x12849e];return _0x3d69f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e5d('0x0'));var BPromise=require('bluebird');var rs=require(_0x5e5d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e5d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e5d('0x3'))(_0x5e5d('0x4'));var config=require(_0x5e5d('0x5'));var jayson=require(_0x5e5d('0x6'));var client=jayson[_0x5e5d('0x7')][_0x5e5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3200d5,_0xab446c,_0x23de8d){return new BPromise(function(_0x131a59,_0x11973c){return client[_0x5e5d('0x9')](_0x3200d5,_0x23de8d)[_0x5e5d('0xa')](function(_0x5d3a3b){logger['info'](_0x5e5d('0xb'),_0xab446c,'request\x20sent');logger[_0x5e5d('0xc')](_0x5e5d('0xd'),_0xab446c,'request\x20sent',JSON[_0x5e5d('0xe')](_0x5d3a3b));if(_0x5d3a3b[_0x5e5d('0xf')]){if(_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x10')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0xab446c,_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x11')]);return _0x11973c(_0x5d3a3b['error'][_0x5e5d('0x11')]);}logger[_0x5e5d('0xf')]('SmsApplication,\x20%s,\x20%s',_0xab446c,_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x11')]);return _0x131a59(_0x5d3a3b['error']['message']);}else{logger['info'](_0x5e5d('0xb'),_0xab446c,_0x5e5d('0x12'));_0x131a59(_0x5d3a3b[_0x5e5d('0x13')][_0x5e5d('0x11')]);}})['catch'](function(_0x132532){logger[_0x5e5d('0xf')](_0x5e5d('0xb'),_0xab446c,_0x132532);_0x11973c(_0x132532);});});} \ No newline at end of file +var _0x0fda=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x3afe11,_0x14adbc){_0x3afe11=_0x3afe11-0x0;var _0x5e2667=_0x0fda[_0x3afe11];return _0x5e2667;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var rs=require(_0xa0fd('0x3'));var fs=require('fs');var Redis=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];var utils=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0fd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x868183,_0x62b109,_0x1aab41){return new BPromise(function(_0x248cca,_0x5d996b){return client[_0xa0fd('0x9')](_0x868183,_0x1aab41)[_0xa0fd('0xa')](function(_0x231ca4){logger[_0xa0fd('0xb')]('SmsApplication,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));logger[_0xa0fd('0xd')](_0xa0fd('0xe'),_0x62b109,'request\x20sent',JSON[_0xa0fd('0xf')](_0x231ca4));if(_0x231ca4[_0xa0fd('0x10')]){if(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x11')]===0x1f4){logger[_0xa0fd('0x10')]('SmsApplication,\x20%s,\x20%s',_0x62b109,_0x231ca4['error'][_0xa0fd('0x12')]);return _0x5d996b(_0x231ca4[_0xa0fd('0x10')]['message']);}logger[_0xa0fd('0x10')](_0xa0fd('0x13'),_0x62b109,_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);return _0x248cca(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);}else{logger[_0xa0fd('0xb')]('SmsApplication,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));_0x248cca(_0x231ca4[_0xa0fd('0x14')]['message']);}})['catch'](function(_0x205506){logger[_0xa0fd('0x10')]('SmsApplication,\x20%s,\x20%s',_0x62b109,_0x205506);_0x5d996b(_0x205506);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 8abbd2d..e398c5a 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 _0xbe9d=['index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated'];(function(_0x45ce90,_0x114609){var _0x313c45=function(_0x55102a){while(--_0x55102a){_0x45ce90['push'](_0x45ce90['shift']());}};_0x313c45(++_0x114609);}(_0xbe9d,0x99));var _0xdbe9=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xbe9d[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0xdbe9('0x0'));var util=require(_0xdbe9('0x1'));var path=require(_0xdbe9('0x2'));var timeout=require(_0xdbe9('0x3'));var express=require(_0xdbe9('0x4'));var router=express[_0xdbe9('0x5')]();var auth=require(_0xdbe9('0x6'));var interaction=require(_0xdbe9('0x7'));var config=require(_0xdbe9('0x8'));var controller=require(_0xdbe9('0x9'));router[_0xdbe9('0xa')]('/',auth[_0xdbe9('0xb')](),controller[_0xdbe9('0xc')]);router['get']('/describe',auth[_0xdbe9('0xb')](),controller[_0xdbe9('0xd')]);router['get'](_0xdbe9('0xe'),auth[_0xdbe9('0xb')](),controller[_0xdbe9('0xf')]);router['get']('/:id/messages',auth[_0xdbe9('0xb')](),controller[_0xdbe9('0x10')]);router[_0xdbe9('0xa')](_0xdbe9('0x11'),auth['isAuthenticated'](),controller[_0xdbe9('0x12')]);router[_0xdbe9('0x13')]('/',auth[_0xdbe9('0xb')](),controller[_0xdbe9('0x14')]);router['post'](_0xdbe9('0x15'),auth['isAuthenticated'](),controller[_0xdbe9('0x16')]);router[_0xdbe9('0x13')](_0xdbe9('0x17'),auth['isAuthenticated'](),interaction[_0xdbe9('0x18')](_0xdbe9('0x19'),_0xdbe9('0x1a')),controller['addTags']);router[_0xdbe9('0x1b')]('/:id',auth[_0xdbe9('0xb')](),interaction[_0xdbe9('0x18')](_0xdbe9('0x19'),'smsinteraction:update'),controller[_0xdbe9('0x1c')]);router[_0xdbe9('0x1d')](_0xdbe9('0xe'),auth['isAuthenticated'](),interaction[_0xdbe9('0x18')](_0xdbe9('0x19'),'smsinteraction:destroy'),controller[_0xdbe9('0x1e')]);router[_0xdbe9('0x1d')](_0xdbe9('0x17'),auth[_0xdbe9('0xb')](),controller[_0xdbe9('0x1f')]);module[_0xdbe9('0x20')]=router; \ No newline at end of file +var _0x5eed=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','addTags','put','tracked','sms','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x20225e,_0xb3d1e5){var _0x3e69ed=function(_0x2e4c64){while(--_0x2e4c64){_0x20225e['push'](_0x20225e['shift']());}};_0x3e69ed(++_0xb3d1e5);}(_0x5eed,0x10a));var _0xd5ee=function(_0x28c40e,_0x431202){_0x28c40e=_0x28c40e-0x0;var _0x1f1254=_0x5eed[_0x28c40e];return _0x1f1254;};'use strict';var multer=require(_0xd5ee('0x0'));var util=require(_0xd5ee('0x1'));var path=require(_0xd5ee('0x2'));var timeout=require(_0xd5ee('0x3'));var express=require(_0xd5ee('0x4'));var router=express[_0xd5ee('0x5')]();var auth=require(_0xd5ee('0x6'));var interaction=require(_0xd5ee('0x7'));var config=require(_0xd5ee('0x8'));var controller=require(_0xd5ee('0x9'));router['get']('/',auth[_0xd5ee('0xa')](),controller[_0xd5ee('0xb')]);router[_0xd5ee('0xc')](_0xd5ee('0xd'),auth[_0xd5ee('0xa')](),controller[_0xd5ee('0xe')]);router[_0xd5ee('0xc')](_0xd5ee('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd5ee('0x10'),auth[_0xd5ee('0xa')](),controller[_0xd5ee('0x11')]);router[_0xd5ee('0xc')](_0xd5ee('0x12'),auth[_0xd5ee('0xa')](),controller[_0xd5ee('0x13')]);router[_0xd5ee('0x14')]('/',auth['isAuthenticated'](),controller[_0xd5ee('0x15')]);router[_0xd5ee('0x14')]('/:id/messages',auth[_0xd5ee('0xa')](),controller[_0xd5ee('0x16')]);router[_0xd5ee('0x14')](_0xd5ee('0x17'),auth[_0xd5ee('0xa')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0xd5ee('0x18')]);router[_0xd5ee('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0xd5ee('0x1a')](_0xd5ee('0x1b'),'smsinteraction:update'),controller[_0xd5ee('0x1c')]);router[_0xd5ee('0x1d')](_0xd5ee('0xf'),auth[_0xd5ee('0xa')](),interaction[_0xd5ee('0x1a')](_0xd5ee('0x1b'),_0xd5ee('0x1e')),controller[_0xd5ee('0x1f')]);router[_0xd5ee('0x1d')](_0xd5ee('0x17'),auth['isAuthenticated'](),controller[_0xd5ee('0x20')]);module[_0xd5ee('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1cefded..8b94d8c 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(_0x4cc974,_0x2bbe51){var _0x351738=function(_0x10d399){while(--_0x10d399){_0x4cc974['push'](_0x4cc974['shift']());}};_0x351738(++_0x2bbe51);}(_0xb10b,0x12a));var _0xbb10=function(_0xb8111f,_0x2b0a3b){_0xb8111f=_0xb8111f-0x0;var _0x233d1b=_0xb10b[_0xb8111f];return _0x233d1b;};'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 _0xb7e7=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x459345,_0x5a3126){var _0x9f1a8a=function(_0x406cf0){while(--_0x406cf0){_0x459345['push'](_0x459345['shift']());}};_0x9f1a8a(++_0x5a3126);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7b7e('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7b7e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7b7e('0x4')]('in',_0x7b7e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b7e('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 9907b9b..46ea669 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 _0x42d0=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','condition','TagId','unreadMessages','isArray','tableAlias','\x20=\x20?','LIKE','ContactId','c.firstName','\x20LIKE\x20?','c.lastName','c.email','\x20>\x20?','\x20<\x20?','\x20IN\x20?','isNil','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20IS\x20NULL','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','toString','DESC','group','QueryTypes','SELECT','clone','COUNT(me.id)','read','having','`unreadMessages`\x20=\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','sms_interaction_has_tags','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','mail_interaction_has_tags','`unreadMessages`\x20>\x200','sequelize','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.lastName','c.phone','c.mobile','Contact.mobile','c.fax','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','rawAttributes','include','find','create','body','describe','SmsMessage','omit','ids','findOne','nolimit','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','join','root','tmp','server','files','transcript-%d-%s.zip','Messages','secret','User','fullname','CmContact','Contact','firstName','lastName','SmsAccount','Account','Owner','get','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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','mkdirSync','N.A.','closedAt','disposition','direction','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','eml-format','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/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','COUNT(*)','sms_messages','me.SmsInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','me.SmsInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false','expr','advancedFilter','createdAt','value','dateStart','startOf','day','format','utc','and'];(function(_0x5afc18,_0x14f356){var _0x9129e2=function(_0x42ad7e){while(--_0x42ad7e){_0x5afc18['push'](_0x5afc18['shift']());}};_0x9129e2(++_0x14f356);}(_0x42d0,0x167));var _0x042d=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x42d0[_0x18a79d];return _0x4f8848;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x042d('0x0'));var rimraf=require(_0x042d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x042d('0x2'));var rp=require(_0x042d('0x3'));var moment=require(_0x042d('0x4'));var BPromise=require(_0x042d('0x5'));var Mustache=require(_0x042d('0x6'));var util=require(_0x042d('0x7'));var path=require(_0x042d('0x8'));var sox=require(_0x042d('0x9'));var csv=require(_0x042d('0xa'));var ejs=require(_0x042d('0xb'));var fs=require('fs');var _=require(_0x042d('0xc'));var squel=require(_0x042d('0xd'));var crypto=require(_0x042d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x042d('0xf'));var toCsv=require(_0x042d('0xa'));var querystring=require(_0x042d('0x10'));var Papa=require(_0x042d('0x11'));var Redis=require(_0x042d('0x12'));var authService=require(_0x042d('0x13'));var qs=require(_0x042d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x042d('0x15'))('api');var utils=require(_0x042d('0x16'));var config=require(_0x042d('0x17'));var db=require(_0x042d('0x18'))['db'];config[_0x042d('0x19')]=_[_0x042d('0x1a')](config['redis'],{'host':_0x042d('0x1b'),'port':0x18eb});var socket=require(_0x042d('0x1c'))(new Redis(config['redis']));require(_0x042d('0x1d'))[_0x042d('0x1e')](socket);function respondWithStatusCode(_0x5f06e4,_0x5c4359){_0x5c4359=_0x5c4359||0xcc;return function(_0x43cd28){if(_0x43cd28){return _0x5f06e4[_0x042d('0x1f')](_0x5c4359);}return _0x5f06e4[_0x042d('0x20')](_0x5c4359)['end']();};}function respondWithResult(_0x478cd4,_0x163235){_0x163235=_0x163235||0xc8;return function(_0x4fee64){if(_0x4fee64){return _0x478cd4['status'](_0x163235)['json'](_0x4fee64);}};}function respondWithFilteredResult(_0x3008fb,_0x2a64a8){return function(_0x295396){if(_0x295396){var _0x53f869=_0x295396[_0x042d('0x21')],_0x13a4c3=_0x2a64a8['offset'],_0x26eef7=_0x2a64a8[_0x042d('0x22')]+_0x2a64a8[_0x042d('0x23')],_0x11479a;if(_0x26eef7>=_0x53f869){_0x26eef7=_0x53f869;_0x11479a=0xc8;}else{_0x11479a=0xce;}_0x3008fb[_0x042d('0x20')](_0x11479a);return _0x3008fb['set'](_0x042d('0x24'),_0x13a4c3+'-'+_0x26eef7+'/'+_0x53f869)[_0x042d('0x25')](_0x295396);}return null;};}function patchUpdates(_0x5d3e00){return function(_0x4c063a){try{jsonpatch[_0x042d('0x26')](_0x4c063a,_0x5d3e00,!![]);}catch(_0x326bd9){return BPromise[_0x042d('0x27')](_0x326bd9);}return _0x4c063a['save']();};}function saveUpdates(_0x1d8a03,_0x4e8e81){return function(_0x1130fd){if(_0x1130fd){return _0x1130fd[_0x042d('0x28')](_0x1d8a03)[_0x042d('0x29')](function(_0x293778){return _0x293778;});}return null;};}function removeEntity(_0x25b897,_0x31daf9){return function(_0x3f4af4){if(_0x3f4af4){return _0x3f4af4[_0x042d('0x2a')]()[_0x042d('0x29')](function(){_0x25b897[_0x042d('0x20')](0xcc)[_0x042d('0x2b')]();});}};}function handleEntityNotFound(_0x22efd4,_0x3e67){return function(_0xae80f2){if(!_0xae80f2){_0x22efd4[_0x042d('0x1f')](0x194);}return _0xae80f2;};}function handleError(_0x1a22da,_0xf7cd0){_0xf7cd0=_0xf7cd0||0x1f4;return function(_0x46d81e){logger[_0x042d('0x2c')](_0x46d81e[_0x042d('0x2d')]);if(_0x46d81e[_0x042d('0x2e')]){delete _0x46d81e[_0x042d('0x2e')];}_0x1a22da[_0x042d('0x20')](_0xf7cd0)[_0x042d('0x2f')](_0x46d81e);};}function getInteractionUsers(_0x2e88de,_0x558454){return new BPromise(function(_0x3f21fd,_0x30c3b8){try{if(_0x558454[_0x2e88de['id']]){_0x2e88de[_0x042d('0x30')]=_[_0x042d('0x31')](_0x558454[_0x2e88de['id']],function(_0x2c6436){return{'id':_0x2c6436['id']};});}}catch(_0x3ed686){_0x30c3b8(_0x3ed686);}_0x3f21fd(_0x2e88de);});}function getInteractionTags(_0x1a5545,_0x21cfe5){return new BPromise(function(_0x5b02f7,_0x1f6ff1){try{if(_0x1a5545[_0x042d('0x32')]){_0x1a5545[_0x042d('0x33')]=[];_0x1a5545[_0x042d('0x32')][_0x042d('0x34')](',')[_0x042d('0x35')](function(_0x3c4a89){_0x1a5545[_0x042d('0x33')][_0x042d('0x36')](_0x21cfe5[_0x3c4a89]);});}delete _0x1a5545[_0x042d('0x32')];}catch(_0x1e4774){_0x1f6ff1(_0x1e4774);}_0x5b02f7(_0x1a5545);});}function updateSmsInteraction(_0x3c192a,_0xdd92ca,_0x2f6af9){return new BPromise(function(_0xce1a58,_0x24dd19){return getInteractionUsers(_0x3c192a,_0x2f6af9)['then'](function(_0x43ad2){return getInteractionTags(_0x43ad2,_0xdd92ca);})['then'](function(_0xe9244f){_0xce1a58(_0xe9244f);})[_0x042d('0x37')](function(_0x51a2df){_0x24dd19(_0x51a2df);});});}exports['index']=function(_0x1df3d6,_0x56936b){var _0x5f4ee3={},_0x3a44d6={},_0xfc175f={'count':0x0,'rows':[]};var _0x21556c=db['SmsInteraction']['rawAttributes'];_0x3a44d6[_0x042d('0x38')]=_['keys'](_0x21556c);_0x3a44d6[_0x042d('0x39')]=_[_0x042d('0x3a')](_0x1df3d6[_0x042d('0x39')]);_0x3a44d6[_0x042d('0x3b')]=_['intersection'](_0x3a44d6[_0x042d('0x38')],_0x3a44d6['query']);_0x5f4ee3['attributes']=_[_0x042d('0x3c')](_0x3a44d6[_0x042d('0x38')],qs[_0x042d('0x3d')](_0x1df3d6[_0x042d('0x39')]['fields']));_0x5f4ee3['attributes']=_0x5f4ee3[_0x042d('0x3e')][_0x042d('0x3f')]?_0x5f4ee3[_0x042d('0x3e')]:_0x3a44d6[_0x042d('0x38')];if(!_0x1df3d6[_0x042d('0x39')][_0x042d('0x40')]('nolimit')){_0x5f4ee3['limit']=qs[_0x042d('0x23')](_0x1df3d6[_0x042d('0x39')]['limit']);_0x5f4ee3[_0x042d('0x22')]=qs[_0x042d('0x22')](_0x1df3d6['query'][_0x042d('0x22')]);}_0x5f4ee3[_0x042d('0x41')]=qs[_0x042d('0x42')](_0x1df3d6[_0x042d('0x39')][_0x042d('0x42')]);_0x5f4ee3[_0x042d('0x43')]=qs[_0x042d('0x3b')](_[_0x042d('0x44')](_0x1df3d6['query'],_0x3a44d6['filters']));var _0x5b0a64=[];var _0x18e6a3=squel[_0x042d('0x45')]()[_0x042d('0x46')]('id')[_0x042d('0x46')]('name')[_0x042d('0x46')](_0x042d('0x47'))[_0x042d('0x48')](_0x042d('0x49'));var _0x52dbf4=squel[_0x042d('0x45')]()[_0x042d('0x46')](_0x042d('0x4a'))[_0x042d('0x48')](_0x042d('0x4b'),'me')[_0x042d('0x43')](_0x042d('0x4c'))[_0x042d('0x43')](_0x042d('0x4d'))[_0x042d('0x43')](_0x042d('0x4e'));var _0x495b3b=squel[_0x042d('0x45')]()[_0x042d('0x46')]('u.id')[_0x042d('0x46')](_0x042d('0x4f'))[_0x042d('0x48')](_0x042d('0x50'),'ui')['left_join'](_0x042d('0x51'),'u',_0x042d('0x52'));var _0xcdc0c3=squel['select']()[_0x042d('0x48')](_0x042d('0x53'),'i')[_0x042d('0x54')](_0x042d('0x55'),'c',_0x042d('0x56'))[_0x042d('0x54')](_0x042d('0x51'),'o','o.id\x20=\x20i.UserId')[_0x042d('0x54')](_0x042d('0x57'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x042d('0x4b'),'me',_0x042d('0x58'));var _0x5e482d=squel[_0x042d('0x59')]();if(_0x1df3d6['query'][_0x042d('0x5a')]){var _0x593bfb=JSON['parse'](_0x1df3d6['query'][_0x042d('0x5a')]);_[_0x042d('0x3a')](_0x593bfb)['forEach'](function(_0x21540e){var _0x22cc68=_0x593bfb[_0x21540e];if(_0x21540e===_0x042d('0x5b')){var _0x170e99=moment(_0x22cc68[_0x042d('0x5c')][_0x042d('0x5d')])[_0x042d('0x5e')](_0x042d('0x5f'))['utc']()[_0x042d('0x60')]();var _0x3ebf0b=moment(_0x3ebf0b)[_0x042d('0x61')]()['endOf'](_0x042d('0x5f'))[_0x042d('0x60')]();_0x5e482d[_0x042d('0x62')](_0x042d('0x63'),_0x170e99,_0x3ebf0b);}else{if(_['isArray'](_0x22cc68[_0x042d('0x64')])){_0x22cc68['condition'][_0x042d('0x35')](function(_0x2d2694){switch(_0x22cc68[_0x042d('0x64')]['value']){case'IS':if(_0x21540e!==_0x042d('0x65')&&_0x21540e!==_0x042d('0x66')){if(_[_0x042d('0x67')](_0x22cc68[_0x042d('0x5c')])&&_0x22cc68[_0x042d('0x5c')][_0x042d('0x3f')]>0x1){_0x5e482d[_0x042d('0x62')](_0x22cc68[_0x042d('0x68')]+'.'+_0x21540e+'\x20IN\x20?',_0x22cc68['value']);}else{_0x5e482d['and'](_0x22cc68[_0x042d('0x68')]+'.'+_0x21540e+_0x042d('0x69'),_0x22cc68['value'][0x0]);}}break;case'=':_0x5e482d[_0x042d('0x62')](_0x22cc68['tableAlias']+'.'+_0x21540e+'\x20=\x20?',_0x22cc68['value']);break;case _0x042d('0x6a'):if(_0x21540e===_0x042d('0x6b')){_0x5e482d['and'](_0x042d('0x6c')+_0x042d('0x6d'),'%'+_0x22cc68['value']+'%');_0x5e482d['or'](_0x042d('0x6e')+_0x042d('0x6d'),'%'+_0x22cc68[_0x042d('0x5c')]+'%');_0x5e482d['or'](_0x042d('0x6f')+_0x042d('0x6d'),'%'+_0x22cc68['value']+'%');}else{_0x5e482d['and'](_0x22cc68['tableAlias']+'.'+_0x21540e+_0x042d('0x6d'),'%'+_0x22cc68[_0x042d('0x5c')]+'%');}break;case'>':_0x5e482d[_0x042d('0x62')](_0x22cc68['tableAlias']+'.'+_0x21540e+_0x042d('0x70'),_0x22cc68[_0x042d('0x5c')]);break;case'<':_0x5e482d[_0x042d('0x62')](_0x22cc68[_0x042d('0x68')]+'.'+_0x21540e+_0x042d('0x71'),_0x22cc68[_0x042d('0x5c')]);break;}});}else{switch(_0x22cc68['condition'][_0x042d('0x5c')]){case'IS':if(_0x21540e!==_0x042d('0x65')&&_0x21540e!=='unreadMessages'){if(_[_0x042d('0x67')](_0x22cc68['value'])&&_0x22cc68[_0x042d('0x5c')][_0x042d('0x3f')]>0x1){_0x5e482d[_0x042d('0x62')](_0x22cc68['tableAlias']+'.'+_0x21540e+_0x042d('0x72'),_0x22cc68[_0x042d('0x5c')]);}else{_0x5e482d['and'](_0x22cc68['tableAlias']+'.'+_0x21540e+_0x042d('0x69'),_0x22cc68[_0x042d('0x5c')][0x0]);}}break;case'=':_0x5e482d[_0x042d('0x62')](_0x22cc68[_0x042d('0x68')]+'.'+_0x21540e+'\x20=\x20?',_0x22cc68[_0x042d('0x5c')]);break;case _0x042d('0x6a'):if(_0x21540e===_0x042d('0x6b')){_0x5e482d[_0x042d('0x62')]('c.firstName'+_0x042d('0x6d'),'%'+_0x22cc68[_0x042d('0x5c')]+'%');_0x5e482d['or'](_0x042d('0x6e')+_0x042d('0x6d'),'%'+_0x22cc68[_0x042d('0x5c')]+'%');_0x5e482d['or'](_0x042d('0x6f')+'\x20LIKE\x20?','%'+_0x22cc68[_0x042d('0x5c')]+'%');}else{_0x5e482d[_0x042d('0x62')](_0x22cc68[_0x042d('0x68')]+'.'+_0x21540e+_0x042d('0x6d'),'%'+_0x22cc68[_0x042d('0x5c')]+'%');}break;case'>':_0x5e482d['and'](_0x22cc68[_0x042d('0x68')]+'.'+_0x21540e+_0x042d('0x70'),_0x22cc68[_0x042d('0x5c')]);break;case'<':_0x5e482d[_0x042d('0x62')](_0x22cc68['tableAlias']+'.'+_0x21540e+_0x042d('0x71'),_0x22cc68[_0x042d('0x5c')]);break;}}}});}else{var _0x1eb58c=_(Object[_0x042d('0x3a')](_0x1df3d6['query']))[_0x042d('0x31')](function(_0x589ddf){return _0x21556c[_0x042d('0x40')](_0x589ddf)?_0x589ddf:undefined;})['filter'](function(_0x35d392){return!_[_0x042d('0x73')](_0x35d392);})[_0x042d('0x5c')]();if(!_[_0x042d('0x74')](_0x1eb58c)){_0x1eb58c[_0x042d('0x35')](function(_0x21a01a){if(_0x21a01a===_0x042d('0x75')){_0xcdc0c3[_0x042d('0x43')](_0x042d('0x76'),[][_0x042d('0x77')](_0x1df3d6[_0x042d('0x39')][_0x21a01a]));}else if(_0x21a01a===_0x042d('0x5b')){var _0xe73eb2=JSON[_0x042d('0x78')](_0x1df3d6[_0x042d('0x39')][_0x21a01a])[_0x042d('0x79')];var _0x1f3d07=JSON[_0x042d('0x78')](_0x1df3d6[_0x042d('0x39')][_0x21a01a])[_0x042d('0x7a')];_0xcdc0c3[_0x042d('0x43')](_0x042d('0x63'),_0xe73eb2,_0x1f3d07);}else{if(_0x1df3d6[_0x042d('0x39')][_0x21a01a]===_0x042d('0x7b')){_0xcdc0c3[_0x042d('0x43')]('i.'+_0x21a01a+_0x042d('0x7c'));}else{_0xcdc0c3[_0x042d('0x43')]('i.'+_0x21a01a+'\x20=\x20?',_0x1df3d6[_0x042d('0x39')][_0x21a01a]);}}});}if(_0x1df3d6[_0x042d('0x39')]['filter']){var _0xa47d00=_0x1df3d6[_0x042d('0x39')][_0x042d('0x7d')][_0x042d('0x7e')]('\x5c','\x5c\x5c')[_0x042d('0x7e')]('\x27\x27',_0x042d('0x7f'));if(qs[_0x042d('0x80')](_0xa47d00)){_0x5e482d['or'](_0x042d('0x81'),_0xa47d00+'%')['or'](_0x042d('0x82'),_0xa47d00+'%');}else{var _0xedb9b9=[];_0xa47d00[_0x042d('0x34')]('\x20')[_0x042d('0x35')](function(_0x2d9384){_0xedb9b9[_0x042d('0x36')]('+'+_0x2d9384[_0x042d('0x83')]());});var _0x9b8853=_0xedb9b9['join']('\x20');_0x5e482d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',_0x9b8853)['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xa47d00+'%');}}}_0xcdc0c3[_0x042d('0x43')](_0x5e482d);if(_0x5f4ee3['order']){_0x5f4ee3[_0x042d('0x41')][_0x042d('0x35')](function(_0x20900f){_0xcdc0c3[_0x042d('0x41')]('i.'+_0x20900f[0x0],_0x20900f[0x1]===_0x042d('0x84')?![]:!![]);});}_0xcdc0c3[_0x042d('0x85')]('i.id');var _0x1fa744={'type':db['Sequelize'][_0x042d('0x86')][_0x042d('0x87')],'raw':!![]};var _0x4a43fe=_0xcdc0c3[_0x042d('0x88')]()['field'](_0x042d('0x4a'))[_0x042d('0x46')](_0x042d('0x89'),'unreadMessages');if(!_0x1df3d6[_0x042d('0x39')][_0x042d('0x5a')]){if(_0x1df3d6[_0x042d('0x39')][_0x042d('0x8a')]){if(_0x1df3d6['query'][_0x042d('0x8a')]==0x1){_0x4a43fe[_0x042d('0x8b')](_0x042d('0x8c'));_0xcdc0c3[_0x042d('0x8b')](_0x042d('0x8c'));}else{_0x4a43fe[_0x042d('0x8b')]('`unreadMessages`\x20>\x200');_0xcdc0c3['having']('`unreadMessages`\x20>\x200');}}if(_0x1df3d6[_0x042d('0x39')]['tag']){var _0xddb844=_['isArray'](_0x1df3d6[_0x042d('0x39')]['tag'])?_0x1df3d6['query'][_0x042d('0x8d')]:new Array(_0x1df3d6['query']['tag']);var _0x3395a5=squel[_0x042d('0x59')]();_0xddb844['forEach'](function(_0xac36a4){_0x3395a5['or'](_0x042d('0x8e'),'%,'+_0xac36a4+',%');});_0xcdc0c3[_0x042d('0x8b')](_0x3395a5);_0x4a43fe[_0x042d('0x54')](_0x042d('0x8f'),'it','it.SmsInteractionId\x20=\x20i.id');_0x4a43fe['left_join'](_0x042d('0x49'),'t',_0x042d('0x90'));_0x4a43fe[_0x042d('0x43')](_0x042d('0x91'),_0xddb844);}}else{var _0x593bfb=JSON[_0x042d('0x78')](_0x1df3d6[_0x042d('0x39')][_0x042d('0x5a')]);_[_0x042d('0x3a')](_0x593bfb)[_0x042d('0x35')](function(_0x5994a8){var _0x1f763c=_0x593bfb[_0x5994a8];if(_0x5994a8===_0x042d('0x65')){var _0x1d43a5=_0x1f763c[_0x042d('0x5c')];var _0x29daeb=squel[_0x042d('0x59')]();_0x1d43a5['forEach'](function(_0x4bda7e){_0x29daeb['or'](_0x042d('0x8e'),'%,'+_0x4bda7e+',%');});_0xcdc0c3[_0x042d('0x8b')](_0x29daeb);_0x4a43fe['left_join'](_0x042d('0x92'),'it','it.MailInteractionId\x20=\x20i.id');_0x4a43fe[_0x042d('0x54')](_0x042d('0x49'),'t',_0x042d('0x90'));_0x4a43fe[_0x042d('0x43')](_0x042d('0x91'),_0x1d43a5);}else if(_0x5994a8===_0x042d('0x66')){if(_0x1f763c[_0x042d('0x5c')]['length']===0x1){if(_0x1f763c[_0x042d('0x5c')][0x0]===0x1){_0x4a43fe[_0x042d('0x8b')](_0x042d('0x8c'));_0xcdc0c3[_0x042d('0x8b')]('`unreadMessages`\x20=\x200');}else{_0x4a43fe[_0x042d('0x8b')](_0x042d('0x93'));_0xcdc0c3[_0x042d('0x8b')](_0x042d('0x93'));}}}});}db[_0x042d('0x94')][_0x042d('0x39')](_0x4a43fe[_0x042d('0x83')](),_0x1fa744)['then'](function(_0x31e41a){_0xfc175f[_0x042d('0x21')]=_0x31e41a[_0x042d('0x3f')];if(_0xfc175f[_0x042d('0x21')]===0x0)return[];return db[_0x042d('0x94')][_0x042d('0x39')](_0x18e6a3['toString'](),_0x1fa744)[_0x042d('0x29')](function(_0x33f086){_0x5b0a64=_[_0x042d('0x95')](_0x33f086,'id');_0x1fa744=_[_0x042d('0x96')](_0x1fa744,{'model':db[_0x042d('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});_0xcdc0c3['field']('COUNT(me.id)','unreadMessages');_0xcdc0c3['field'](_0x042d('0x98'),_0x042d('0x99'));_0xcdc0c3[_0x042d('0x46')](_0x042d('0x9a'),_0x042d('0x9b'));_0xcdc0c3[_0x042d('0x46')](_0x042d('0x9c'));_0xcdc0c3[_0x042d('0x46')](_0x042d('0x6c'),'Contact.firstName');_0xcdc0c3[_0x042d('0x46')](_0x042d('0x6e'),_0x042d('0x9d'));_0xcdc0c3['field'](_0x042d('0x6f'),'Contact.email');_0xcdc0c3[_0x042d('0x46')](_0x042d('0x9e'),'Contact.phone');_0xcdc0c3[_0x042d('0x46')](_0x042d('0x9f'),_0x042d('0xa0'));_0xcdc0c3['field'](_0x042d('0xa1'),'Contact.fax');_0xcdc0c3[_0x042d('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x042d('0x32'));_0xcdc0c3[_0x042d('0x54')](_0x042d('0x8f'),'it','it.SmsInteractionId\x20=\x20i.id');_0xcdc0c3[_0x042d('0x54')]('tools_tags','t',_0x042d('0x90'));_0xcdc0c3[_0x042d('0x23')](_0x5f4ee3[_0x042d('0x23')]);_0xcdc0c3['offset'](_0x5f4ee3[_0x042d('0x22')]);return db[_0x042d('0x94')][_0x042d('0x39')](_0xcdc0c3[_0x042d('0x83')](),_0x1fa744);})['then'](function(_0x202caf){_0x495b3b['where'](_0x042d('0xa2'),_[_0x042d('0x31')](_0x202caf,'id'));return db[_0x042d('0x94')][_0x042d('0x39')](_0x495b3b['toString'](),_0x1fa744)[_0x042d('0x29')](function(_0x2663c5){var _0x4d372a=_[_0x042d('0xa3')](_0x2663c5,_0x042d('0xa4'));var _0x140d68=[];_0x202caf[_0x042d('0x35')](function(_0x65df2c){_0x140d68[_0x042d('0x36')](updateSmsInteraction(_0x65df2c,_0x5b0a64,_0x4d372a));});return BPromise[_0x042d('0xa5')](_0x140d68);});});})[_0x042d('0x29')](function(_0x1eead8){_0xfc175f[_0x042d('0xa6')]=_0x1eead8;return _0xfc175f;})['then'](respondWithFilteredResult(_0x56936b,_0x5f4ee3))[_0x042d('0x37')](handleError(_0x56936b,null));};exports[_0x042d('0xa7')]=function(_0x5df99a,_0x182189){var _0x115b53={'raw':![],'where':{'id':_0x5df99a[_0x042d('0xa8')]['id']}},_0x2ee180={};_0x2ee180[_0x042d('0x38')]=_['keys'](db[_0x042d('0x97')][_0x042d('0xa9')]);_0x2ee180[_0x042d('0x39')]=_[_0x042d('0x3a')](_0x5df99a[_0x042d('0x39')]);_0x2ee180[_0x042d('0x3b')]=_[_0x042d('0x3c')](_0x2ee180['model'],_0x2ee180[_0x042d('0x39')]);_0x115b53['attributes']=_['intersection'](_0x2ee180['model'],qs['fields'](_0x5df99a[_0x042d('0x39')][_0x042d('0x3d')]));_0x115b53[_0x042d('0x3e')]=_0x115b53[_0x042d('0x3e')][_0x042d('0x3f')]?_0x115b53['attributes']:_0x2ee180[_0x042d('0x38')];if(_0x5df99a['query']['includeAll']){_0x115b53[_0x042d('0xaa')]=[{'all':!![]}];}_0x115b53=_[_0x042d('0x96')]({},_0x115b53,_0x5df99a['options']);return db[_0x042d('0x97')][_0x042d('0xab')](_0x115b53)['then'](handleEntityNotFound(_0x182189,null))[_0x042d('0x29')](respondWithResult(_0x182189,null))[_0x042d('0x37')](handleError(_0x182189,null));};exports[_0x042d('0xac')]=function(_0x1b62e6,_0x1ee3d3){return db[_0x042d('0x97')]['create'](_0x1b62e6['body'],{})[_0x042d('0x29')](respondWithResult(_0x1ee3d3,0xc9))[_0x042d('0x37')](handleError(_0x1ee3d3,null));};exports[_0x042d('0x28')]=function(_0x3b20ce,_0x25eaa9){if(_0x3b20ce[_0x042d('0xad')]['id']){delete _0x3b20ce[_0x042d('0xad')]['id'];}return db[_0x042d('0x97')][_0x042d('0xab')]({'where':{'id':_0x3b20ce[_0x042d('0xa8')]['id']}})[_0x042d('0x29')](handleEntityNotFound(_0x25eaa9,null))[_0x042d('0x29')](saveUpdates(_0x3b20ce[_0x042d('0xad')],null))[_0x042d('0x29')](respondWithResult(_0x25eaa9,null))[_0x042d('0x37')](handleError(_0x25eaa9,null));};exports[_0x042d('0x2a')]=function(_0x5e8c10,_0x1415f0){return db[_0x042d('0x97')][_0x042d('0xab')]({'where':{'id':_0x5e8c10[_0x042d('0xa8')]['id']}})['then'](handleEntityNotFound(_0x1415f0,null))[_0x042d('0x29')](removeEntity(_0x1415f0,null))[_0x042d('0x37')](handleError(_0x1415f0,null));};exports[_0x042d('0xae')]=function(_0x2b7f16,_0x4c5bf3){return db[_0x042d('0x97')][_0x042d('0xae')]()['then'](respondWithResult(_0x4c5bf3,null))[_0x042d('0x37')](handleError(_0x4c5bf3,null));};exports['addMessage']=function(_0x2b416f,_0x2a4ea8,_0x18d74a){return db[_0x042d('0xaf')][_0x042d('0xab')]({'where':{'id':_0x2b416f['params']['id']}})[_0x042d('0x29')](handleEntityNotFound(_0x2a4ea8,null))[_0x042d('0x29')](function(_0x5363fb){if(_0x5363fb){return _0x5363fb['addMessage'](_0x2b416f[_0x042d('0xad')]['ids'],_[_0x042d('0xb0')](_0x2b416f['body'],[_0x042d('0xb1'),'id'])||{});}})[_0x042d('0x29')](respondWithResult(_0x2a4ea8,null))[_0x042d('0x37')](handleError(_0x2a4ea8,null));};exports['getMessages']=function(_0x402ae9,_0x424ce4,_0x254c9b){var _0x3c056e={'raw':![],'where':{}};var _0x21d1f4={};var _0x474392={'count':0x0,'rows':[]};return db[_0x042d('0x97')][_0x042d('0xb2')]({'where':{'id':_0x402ae9[_0x042d('0xa8')]['id']}})[_0x042d('0x29')](handleEntityNotFound(_0x424ce4,null))[_0x042d('0x29')](function(_0x4ae602){if(_0x4ae602){_0x21d1f4[_0x042d('0x38')]=_[_0x042d('0x3a')](db[_0x042d('0xaf')][_0x042d('0xa9')]);_0x21d1f4[_0x042d('0x39')]=_[_0x042d('0x3a')](_0x402ae9[_0x042d('0x39')]);_0x21d1f4[_0x042d('0x3b')]=_[_0x042d('0x3c')](_0x21d1f4['model'],_0x21d1f4[_0x042d('0x39')]);_0x3c056e[_0x042d('0x3e')]=_['intersection'](_0x21d1f4[_0x042d('0x38')],qs[_0x042d('0x3d')](_0x402ae9['query'][_0x042d('0x3d')]));_0x3c056e[_0x042d('0x3e')]=_0x3c056e[_0x042d('0x3e')][_0x042d('0x3f')]?_0x3c056e['attributes']:_0x21d1f4[_0x042d('0x38')];if(!_0x402ae9[_0x042d('0x39')][_0x042d('0x40')](_0x042d('0xb3'))){_0x3c056e[_0x042d('0x23')]=qs[_0x042d('0x23')](_0x402ae9[_0x042d('0x39')][_0x042d('0x23')]);_0x3c056e[_0x042d('0x22')]=qs[_0x042d('0x22')](_0x402ae9[_0x042d('0x39')][_0x042d('0x22')]);}_0x3c056e['order']=qs[_0x042d('0x42')](_0x402ae9[_0x042d('0x39')][_0x042d('0x42')]);_0x3c056e[_0x042d('0x43')]=qs[_0x042d('0x3b')](_['pick'](_0x402ae9[_0x042d('0x39')],_0x21d1f4['filters']));_0x3c056e[_0x042d('0x43')][_0x042d('0xa4')]=_0x4ae602['id'];if(_0x402ae9[_0x042d('0x39')][_0x042d('0x7d')]){_0x3c056e[_0x042d('0x43')]=_[_0x042d('0x96')](_0x3c056e[_0x042d('0x43')],{'$or':_[_0x042d('0x31')](_0x3c056e[_0x042d('0x3e')],function(_0x270b33){var _0x3a1610={};_0x3a1610[_0x270b33]={'$like':'%'+_0x402ae9['query'][_0x042d('0x7d')]+'%'};return _0x3a1610;})});}if(_0x402ae9[_0x042d('0x39')][_0x042d('0x79')]){var _0x2f4f16=_0x402ae9[_0x042d('0x39')][_0x042d('0x79')]['split'](',');var _0x45a021={};_0x45a021[_0x2f4f16[0x0]]={'$gte':moment(_0x2f4f16[0x1])[_0x042d('0x60')](_0x042d('0xb4'))};_0x3c056e['where']=_[_0x042d('0x96')](_0x3c056e[_0x042d('0x43')],_0x45a021);}_0x3c056e=_[_0x042d('0x96')]({},_0x3c056e,_0x402ae9[_0x042d('0xb5')]);return db[_0x042d('0xaf')][_0x042d('0x21')]({'where':_0x3c056e[_0x042d('0x43')]})[_0x042d('0x29')](function(_0x4ad6c2){_0x474392[_0x042d('0x21')]=_0x4ad6c2;if(_0x402ae9[_0x042d('0x39')]['includeAll']){_0x3c056e[_0x042d('0xaa')]=[{'all':!![]}];}return db[_0x042d('0xaf')][_0x042d('0xb6')](_0x3c056e);})[_0x042d('0x29')](function(_0x534633){_0x474392['rows']=_0x534633;return _0x474392;});}})[_0x042d('0x29')](respondWithFilteredResult(_0x424ce4,_0x3c056e))[_0x042d('0x37')](handleError(_0x424ce4,null));};exports['addTags']=function(_0x37a20b,_0x468d28,_0x2b47e1){return db[_0x042d('0x97')]['find']({'where':{'id':_0x37a20b['params']['id']}})['then'](handleEntityNotFound(_0x468d28,null))[_0x042d('0x29')](function(_0x18eac4){if(_0x18eac4){return _0x18eac4[_0x042d('0xb7')](_0x37a20b[_0x042d('0xad')]['ids'],_['omit'](_0x37a20b[_0x042d('0xad')],[_0x042d('0xb1'),'id'])||{})[_0x042d('0xb8')](function(){return db[_0x042d('0xb9')][_0x042d('0xb6')]({'attributes':['id',_0x042d('0x2e'),_0x042d('0x47')],'where':{'id':_0x37a20b[_0x042d('0xad')][_0x042d('0xb1')]}});})[_0x042d('0x29')](function(_0x48e97c){socket[_0x042d('0xba')](_0x042d('0xbb'),{'id':Number(_0x37a20b['params']['id']),'tags':_0x48e97c||[]});return{'id':Number(_0x37a20b[_0x042d('0xa8')]['id']),'tags':_0x48e97c||[]};});}})[_0x042d('0x29')](respondWithResult(_0x468d28,null))['catch'](handleError(_0x468d28,null));};exports[_0x042d('0xbc')]=function(_0x583ac4,_0x4e56da,_0x3ec791){return db[_0x042d('0x97')][_0x042d('0xab')]({'where':{'id':_0x583ac4[_0x042d('0xa8')]['id']}})[_0x042d('0x29')](handleEntityNotFound(_0x4e56da,null))[_0x042d('0x29')](function(_0x21ec5b){if(_0x21ec5b){return _0x21ec5b[_0x042d('0xbc')](_0x583ac4['query']['ids']);}})[_0x042d('0x29')](respondWithStatusCode(_0x4e56da,null))[_0x042d('0x37')](handleError(_0x4e56da,null));};exports[_0x042d('0xbd')]=function(_0x4ba75e,_0x59c4e7){var _0x42b7af=moment()[_0x042d('0xbe')]()[_0x042d('0x83')]();var _0x2566d9=path[_0x042d('0xbf')](config[_0x042d('0xc0')],'server','files',_0x042d('0xc1'));var _0x2cc782=path[_0x042d('0xbf')](config[_0x042d('0xc0')],_0x042d('0xc2'),_0x042d('0xc3'),'attachments');var _0x408e81=path[_0x042d('0xbf')](_0x2566d9,_0x42b7af);var _0x483f55=util[_0x042d('0x60')](_0x042d('0xc4'),_0x4ba75e[_0x042d('0xa8')]['id'],_0x42b7af);var _0xff67cf=path[_0x042d('0xbf')](_0x2566d9,_0x483f55);var _0x464619=![];return db[_0x042d('0x97')][_0x042d('0xab')]({'where':{'id':_0x4ba75e[_0x042d('0xa8')]['id']},'include':[{'model':db['SmsMessage'],'as':_0x042d('0xc5'),'attributes':['id',_0x042d('0xad'),_0x042d('0x5b'),'direction',_0x042d('0xc6'),_0x042d('0x8a')],'include':[{'model':db[_0x042d('0xc7')],'as':'User','attributes':['id',_0x042d('0xc8')],'raw':!![]},{'model':db[_0x042d('0xc9')],'as':_0x042d('0xca'),'attributes':['id',_0x042d('0xcb'),_0x042d('0xcc')],'raw':!![]}]},{'model':db[_0x042d('0xcd')],'as':_0x042d('0xce'),'attributes':['id','name']},{'model':db[_0x042d('0xc7')],'as':_0x042d('0xcf'),'attributes':['id',_0x042d('0xc8')]}]})[_0x042d('0x29')](handleEntityNotFound(_0x59c4e7,null))[_0x042d('0x29')](function(_0xf75ffe){if(_0xf75ffe){var _0x26450a=_0xf75ffe[_0x042d('0xd0')]({'plain':!![]});_0x464619=!![];var _0x53b7b6={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x042d('0xd1')}},'footer':{'height':_0x042d('0xd2'),'contents':{'default':util[_0x042d('0x60')](_0x042d('0xd3'),util[_0x042d('0x60')](_0x042d('0xd4'),_0x042d('0xd5'),_0x26450a['id']),moment()[_0x042d('0x60')](_0x042d('0xd6'))[_0x042d('0x83')]())}}};fs[_0x042d('0xd7')](_0x408e81);var _0x2985e4={'channel':_0x042d('0xd5'),'account':_0x26450a['Account']['name'],'agent':_0x26450a[_0x042d('0xcf')]?_0x26450a[_0x042d('0xcf')][_0x042d('0xc8')]:_0x042d('0xd8'),'createdAt':moment(_0x26450a[_0x042d('0x5b')])[_0x042d('0x60')](_0x042d('0xb4'))['toString'](),'closedAt':_0x26450a['closed']?moment(_0x26450a[_0x042d('0xd9')])[_0x042d('0x60')](_0x042d('0xb4'))['toString']():'','disposition':_0x26450a[_0x042d('0xda')],'messages':_(_0x26450a[_0x042d('0xc5')])[_0x042d('0x7d')]({'secret':![]})['map'](function(_0xf9fcfd){return{'date':moment(_0xf9fcfd[_0x042d('0x5b')])[_0x042d('0x60')]('YYYY-MM-DD\x20HH:mm:ss')[_0x042d('0x83')](),'sender':_0xf9fcfd[_0x042d('0xdb')]===_0x042d('0xdc')?_0xf9fcfd[_0x042d('0xc7')]?_0xf9fcfd[_0x042d('0xc7')][_0x042d('0xc8')]:_0x042d('0xdd'):_0xf9fcfd[_0x042d('0xca')][_0x042d('0xcb')]+(_0xf9fcfd['Contact']['lastName']?'\x20'+_0xf9fcfd[_0x042d('0xca')]['lastName']:''),'body':_0xf9fcfd['body'],'direction':_0xf9fcfd['direction']===_0x042d('0xdc')?'A':'C','secret':_0xf9fcfd['secret'],'read':_0xf9fcfd['read']};})[_0x042d('0x5c')]()};return ejs[_0x042d('0xde')](path[_0x042d('0xbf')](config[_0x042d('0xc0')],_0x042d('0xc2'),'views',_0x042d('0xdf')),{'interaction':_0x2985e4})[_0x042d('0x29')](function(_0x34a454){return new BPromise(function(_0x236ba8,_0x3ca5dc){pdf[_0x042d('0xac')](_0x34a454,_0x53b7b6)[_0x042d('0xe0')](path[_0x042d('0xbf')](_0x408e81,_0x042d('0xe1')+_0x26450a['id']+'-'+_0x42b7af+_0x042d('0xe2')),function(_0x444e86,_0x14f209){if(_0x444e86)return _0x3ca5dc(_0x444e86);_0x236ba8(_0x14f209);});});});}})[_0x042d('0x29')](function(){if(_0x464619){return new BPromise(function(_0x11a366,_0x26d71a){zipdir(_0x408e81,{'saveTo':_0xff67cf},function(_0x52dcdd,_0x443e12){if(_0x52dcdd)return _0x26d71a(_0x52dcdd);return _0x11a366(_0x443e12);});})[_0x042d('0x29')](function(){return new BPromise(function(_0x4159c4,_0x5d2870){rimraf(_0x408e81,function(_0x48f52b){if(_0x48f52b)_0x5d2870(_0x48f52b);return _0x4159c4();});});})[_0x042d('0x29')](function(){return _0x59c4e7[_0x042d('0xbd')](_0xff67cf,_0x483f55,function(_0x2f6eb1){if(_0x2f6eb1){console[_0x042d('0xe3')]('err',_0x2f6eb1);}else{fs[_0x042d('0xe4')](_0xff67cf);}});});}else{return _0x59c4e7[_0x042d('0x1f')](0xc8);}})[_0x042d('0x37')](handleError(_0x59c4e7,null));}; \ No newline at end of file +var _0x0f1f=['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\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\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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','mkdirSync','closed','closedAt','disposition','out','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','register','sendStatus','status','end','json','offset','limit','set','Content-Range','update','destroy','then','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','SmsInteraction','rawAttributes','model','query','intersection','attributes','length','order','sort','where','pick','filters','select','field','color','from','tools_tags','COUNT(*)','sms_messages','me.SmsInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id\x20AND\x20me.direction\x20=\x20\x27in\x27\x20AND\x20me.read\x20=\x20false','expr','advancedFilter','parse','keys','createdAt','value','startOf','utc','format','endOf','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','unreadMessages','tableAlias','\x20IN\x20?','\x20=\x20?','ContactId','\x20LIKE\x20?','c.lastName','c.email','\x20>\x20?','\x20<\x20?','LIKE','hasOwnProperty','filter','concat','$gte','null','\x20IS\x20NULL','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','toString','join','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','DESC','group','Sequelize','QueryTypes','clone','COUNT(me.id)','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','TagId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','c.phone','c.mobile','Contact.mobile','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','show','params','fields','includeAll','include','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','YYYY-MM-DD\x20HH:mm:ss','options','count','findAll','addTags','setTags','Tag','emit','removeTags','unix','root','files','server','Messages','direction','User','fullname','CmContact','Contact','firstName','lastName','Account','Owner','get'];(function(_0x396055,_0x1ff938){var _0x276457=function(_0x61d643){while(--_0x61d643){_0x396055['push'](_0x396055['shift']());}};_0x276457(++_0x1ff938);}(_0x0f1f,0x1bb));var _0xf0f1=function(_0x5e7913,_0x3d4099){_0x5e7913=_0x5e7913-0x0;var _0x1d50a2=_0x0f1f[_0x5e7913];return _0x1d50a2;};'use strict';var pdf=require(_0xf0f1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0f1('0x1'));var rp=require(_0xf0f1('0x2'));var moment=require(_0xf0f1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0f1('0x4'));var util=require('util');var path=require(_0xf0f1('0x5'));var sox=require(_0xf0f1('0x6'));var csv=require('to-csv');var ejs=require(_0xf0f1('0x7'));var fs=require('fs');var _=require(_0xf0f1('0x8'));var squel=require(_0xf0f1('0x9'));var crypto=require(_0xf0f1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf0f1('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf0f1('0xc'));var Papa=require(_0xf0f1('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xf0f1('0xe'));var logger=require(_0xf0f1('0xf'))(_0xf0f1('0x10'));var utils=require(_0xf0f1('0x11'));var config=require(_0xf0f1('0x12'));var db=require(_0xf0f1('0x13'))['db'];config[_0xf0f1('0x14')]=_['defaults'](config[_0xf0f1('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0xf0f1('0x15')](socket);function respondWithStatusCode(_0x4be226,_0x1913ac){_0x1913ac=_0x1913ac||0xcc;return function(_0x1de972){if(_0x1de972){return _0x4be226[_0xf0f1('0x16')](_0x1913ac);}return _0x4be226[_0xf0f1('0x17')](_0x1913ac)[_0xf0f1('0x18')]();};}function respondWithResult(_0x555988,_0x360f48){_0x360f48=_0x360f48||0xc8;return function(_0x25f0d4){if(_0x25f0d4){return _0x555988[_0xf0f1('0x17')](_0x360f48)[_0xf0f1('0x19')](_0x25f0d4);}};}function respondWithFilteredResult(_0x31be65,_0x53987a){return function(_0x4eebe0){if(_0x4eebe0){var _0x511d02=_0x4eebe0['count'],_0x48c26f=_0x53987a[_0xf0f1('0x1a')],_0x4ce49c=_0x53987a[_0xf0f1('0x1a')]+_0x53987a[_0xf0f1('0x1b')],_0x36f0b7;if(_0x4ce49c>=_0x511d02){_0x4ce49c=_0x511d02;_0x36f0b7=0xc8;}else{_0x36f0b7=0xce;}_0x31be65[_0xf0f1('0x17')](_0x36f0b7);return _0x31be65[_0xf0f1('0x1c')](_0xf0f1('0x1d'),_0x48c26f+'-'+_0x4ce49c+'/'+_0x511d02)[_0xf0f1('0x19')](_0x4eebe0);}return null;};}function patchUpdates(_0xbb0b16){return function(_0x309b28){try{jsonpatch['apply'](_0x309b28,_0xbb0b16,!![]);}catch(_0x2187ec){return BPromise['reject'](_0x2187ec);}return _0x309b28['save']();};}function saveUpdates(_0x1f5dc4,_0x4e867e){return function(_0x309b7e){if(_0x309b7e){return _0x309b7e[_0xf0f1('0x1e')](_0x1f5dc4)['then'](function(_0x2a6b6d){return _0x2a6b6d;});}return null;};}function removeEntity(_0x50d73a,_0xc14333){return function(_0x30779d){if(_0x30779d){return _0x30779d[_0xf0f1('0x1f')]()[_0xf0f1('0x20')](function(){_0x50d73a['status'](0xcc)[_0xf0f1('0x18')]();});}};}function handleEntityNotFound(_0x36e6bb,_0x6e0fe3){return function(_0x583bd6){if(!_0x583bd6){_0x36e6bb[_0xf0f1('0x16')](0x194);}return _0x583bd6;};}function handleError(_0x4e1f8e,_0x5b1cc1){_0x5b1cc1=_0x5b1cc1||0x1f4;return function(_0x48e155){logger['error'](_0x48e155[_0xf0f1('0x21')]);if(_0x48e155[_0xf0f1('0x22')]){delete _0x48e155[_0xf0f1('0x22')];}_0x4e1f8e[_0xf0f1('0x17')](_0x5b1cc1)[_0xf0f1('0x23')](_0x48e155);};}function getInteractionUsers(_0x4b170c,_0xea31b6){return new BPromise(function(_0x3cba91,_0x48d218){try{if(_0xea31b6[_0x4b170c['id']]){_0x4b170c[_0xf0f1('0x24')]=_[_0xf0f1('0x25')](_0xea31b6[_0x4b170c['id']],function(_0x381a73){return{'id':_0x381a73['id']};});}}catch(_0x4ff076){_0x48d218(_0x4ff076);}_0x3cba91(_0x4b170c);});}function getInteractionTags(_0x52ba63,_0x256984){return new BPromise(function(_0x1a0c88,_0x3c9ec3){try{if(_0x52ba63[_0xf0f1('0x26')]){_0x52ba63[_0xf0f1('0x27')]=[];_0x52ba63['TagIds'][_0xf0f1('0x28')](',')[_0xf0f1('0x29')](function(_0x261175){_0x52ba63[_0xf0f1('0x27')][_0xf0f1('0x2a')](_0x256984[_0x261175]);});}delete _0x52ba63['TagIds'];}catch(_0x1aa5c8){_0x3c9ec3(_0x1aa5c8);}_0x1a0c88(_0x52ba63);});}function updateSmsInteraction(_0x2607c9,_0x20675f,_0x3e16e2){return new BPromise(function(_0x3be87e,_0x4a55ce){return getInteractionUsers(_0x2607c9,_0x3e16e2)[_0xf0f1('0x20')](function(_0x2c79d8){return getInteractionTags(_0x2c79d8,_0x20675f);})[_0xf0f1('0x20')](function(_0x35c1f9){_0x3be87e(_0x35c1f9);})[_0xf0f1('0x2b')](function(_0x1cf7d9){_0x4a55ce(_0x1cf7d9);});});}exports['index']=function(_0x2ee0b9,_0x56906b){var _0x291823={},_0x4d3a0b={},_0x4c35ec={'count':0x0,'rows':[]};var _0x18cad7=db[_0xf0f1('0x2c')][_0xf0f1('0x2d')];_0x4d3a0b[_0xf0f1('0x2e')]=_['keys'](_0x18cad7);_0x4d3a0b[_0xf0f1('0x2f')]=_['keys'](_0x2ee0b9[_0xf0f1('0x2f')]);_0x4d3a0b['filters']=_[_0xf0f1('0x30')](_0x4d3a0b['model'],_0x4d3a0b[_0xf0f1('0x2f')]);_0x291823['attributes']=_[_0xf0f1('0x30')](_0x4d3a0b['model'],qs['fields'](_0x2ee0b9[_0xf0f1('0x2f')]['fields']));_0x291823[_0xf0f1('0x31')]=_0x291823[_0xf0f1('0x31')][_0xf0f1('0x32')]?_0x291823[_0xf0f1('0x31')]:_0x4d3a0b[_0xf0f1('0x2e')];if(!_0x2ee0b9[_0xf0f1('0x2f')]['hasOwnProperty']('nolimit')){_0x291823['limit']=qs[_0xf0f1('0x1b')](_0x2ee0b9['query']['limit']);_0x291823[_0xf0f1('0x1a')]=qs[_0xf0f1('0x1a')](_0x2ee0b9['query'][_0xf0f1('0x1a')]);}_0x291823[_0xf0f1('0x33')]=qs['sort'](_0x2ee0b9[_0xf0f1('0x2f')][_0xf0f1('0x34')]);_0x291823[_0xf0f1('0x35')]=qs['filters'](_[_0xf0f1('0x36')](_0x2ee0b9[_0xf0f1('0x2f')],_0x4d3a0b[_0xf0f1('0x37')]));var _0x304846=[];var _0x4d32d6=squel[_0xf0f1('0x38')]()[_0xf0f1('0x39')]('id')[_0xf0f1('0x39')](_0xf0f1('0x22'))[_0xf0f1('0x39')](_0xf0f1('0x3a'))[_0xf0f1('0x3b')](_0xf0f1('0x3c'));var _0x45c77=squel[_0xf0f1('0x38')]()[_0xf0f1('0x39')](_0xf0f1('0x3d'))[_0xf0f1('0x3b')](_0xf0f1('0x3e'),'me')[_0xf0f1('0x35')](_0xf0f1('0x3f'))[_0xf0f1('0x35')](_0xf0f1('0x40'))['where'](_0xf0f1('0x41'));var _0x48ae9b=squel[_0xf0f1('0x38')]()[_0xf0f1('0x39')](_0xf0f1('0x42'))[_0xf0f1('0x39')]('ui.SmsInteractionId')[_0xf0f1('0x3b')]('user_has_sms_interactions','ui')[_0xf0f1('0x43')](_0xf0f1('0x44'),'u',_0xf0f1('0x45'));var _0x12d1c1=squel[_0xf0f1('0x38')]()[_0xf0f1('0x3b')](_0xf0f1('0x46'),'i')[_0xf0f1('0x43')](_0xf0f1('0x47'),'c',_0xf0f1('0x48'))[_0xf0f1('0x43')](_0xf0f1('0x44'),'o',_0xf0f1('0x49'))[_0xf0f1('0x43')](_0xf0f1('0x4a'),'a',_0xf0f1('0x4b'))[_0xf0f1('0x43')](_0xf0f1('0x3e'),'me',_0xf0f1('0x4c'));var _0x1d84c5=squel[_0xf0f1('0x4d')]();if(_0x2ee0b9[_0xf0f1('0x2f')][_0xf0f1('0x4e')]){var _0x2fe312=JSON[_0xf0f1('0x4f')](_0x2ee0b9['query'][_0xf0f1('0x4e')]);_[_0xf0f1('0x50')](_0x2fe312)[_0xf0f1('0x29')](function(_0x4c36f6){var _0x2eda9a=_0x2fe312[_0x4c36f6];if(_0x4c36f6===_0xf0f1('0x51')){var _0x8400b4=moment(_0x2eda9a[_0xf0f1('0x52')]['dateStart'])[_0xf0f1('0x53')]('day')[_0xf0f1('0x54')]()[_0xf0f1('0x55')]();var _0x154725=moment(_0x154725)[_0xf0f1('0x54')]()[_0xf0f1('0x56')]('day')[_0xf0f1('0x55')]();_0x1d84c5[_0xf0f1('0x57')](_0xf0f1('0x58'),_0x8400b4,_0x154725);}else{if(_[_0xf0f1('0x59')](_0x2eda9a[_0xf0f1('0x5a')])){_0x2eda9a['condition'][_0xf0f1('0x29')](function(_0x4a8e55){switch(_0x2eda9a[_0xf0f1('0x5a')][_0xf0f1('0x52')]){case'IS':if(_0x4c36f6!=='TagId'&&_0x4c36f6!==_0xf0f1('0x5b')){if(_[_0xf0f1('0x59')](_0x2eda9a[_0xf0f1('0x52')])&&_0x2eda9a[_0xf0f1('0x52')][_0xf0f1('0x32')]>0x1){_0x1d84c5[_0xf0f1('0x57')](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x5d'),_0x2eda9a[_0xf0f1('0x52')]);}else{_0x1d84c5['and'](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x5e'),_0x2eda9a[_0xf0f1('0x52')][0x0]);}}break;case'=':_0x1d84c5['and'](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+'\x20=\x20?',_0x2eda9a[_0xf0f1('0x52')]);break;case'LIKE':if(_0x4c36f6===_0xf0f1('0x5f')){_0x1d84c5['and']('c.firstName'+_0xf0f1('0x60'),'%'+_0x2eda9a['value']+'%');_0x1d84c5['or'](_0xf0f1('0x61')+'\x20LIKE\x20?','%'+_0x2eda9a['value']+'%');_0x1d84c5['or'](_0xf0f1('0x62')+_0xf0f1('0x60'),'%'+_0x2eda9a['value']+'%');}else{_0x1d84c5['and'](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x60'),'%'+_0x2eda9a[_0xf0f1('0x52')]+'%');}break;case'>':_0x1d84c5['and'](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x63'),_0x2eda9a[_0xf0f1('0x52')]);break;case'<':_0x1d84c5[_0xf0f1('0x57')](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x64'),_0x2eda9a[_0xf0f1('0x52')]);break;}});}else{switch(_0x2eda9a[_0xf0f1('0x5a')][_0xf0f1('0x52')]){case'IS':if(_0x4c36f6!=='TagId'&&_0x4c36f6!==_0xf0f1('0x5b')){if(_[_0xf0f1('0x59')](_0x2eda9a[_0xf0f1('0x52')])&&_0x2eda9a['value'][_0xf0f1('0x32')]>0x1){_0x1d84c5[_0xf0f1('0x57')](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x5d'),_0x2eda9a['value']);}else{_0x1d84c5[_0xf0f1('0x57')](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x5e'),_0x2eda9a[_0xf0f1('0x52')][0x0]);}}break;case'=':_0x1d84c5['and'](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x5e'),_0x2eda9a['value']);break;case _0xf0f1('0x65'):if(_0x4c36f6===_0xf0f1('0x5f')){_0x1d84c5['and']('c.firstName'+'\x20LIKE\x20?','%'+_0x2eda9a[_0xf0f1('0x52')]+'%');_0x1d84c5['or'](_0xf0f1('0x61')+_0xf0f1('0x60'),'%'+_0x2eda9a[_0xf0f1('0x52')]+'%');_0x1d84c5['or']('c.email'+'\x20LIKE\x20?','%'+_0x2eda9a[_0xf0f1('0x52')]+'%');}else{_0x1d84c5[_0xf0f1('0x57')](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x60'),'%'+_0x2eda9a[_0xf0f1('0x52')]+'%');}break;case'>':_0x1d84c5[_0xf0f1('0x57')](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+'\x20>\x20?',_0x2eda9a[_0xf0f1('0x52')]);break;case'<':_0x1d84c5['and'](_0x2eda9a[_0xf0f1('0x5c')]+'.'+_0x4c36f6+_0xf0f1('0x64'),_0x2eda9a['value']);break;}}}});}else{var _0x1f54e1=_(Object[_0xf0f1('0x50')](_0x2ee0b9['query']))[_0xf0f1('0x25')](function(_0x1e4b1f){return _0x18cad7[_0xf0f1('0x66')](_0x1e4b1f)?_0x1e4b1f:undefined;})[_0xf0f1('0x67')](function(_0x498503){return!_['isNil'](_0x498503);})[_0xf0f1('0x52')]();if(!_['isEmpty'](_0x1f54e1)){_0x1f54e1['forEach'](function(_0x531644){if(_0x531644==='SmsAccountId'){_0x12d1c1[_0xf0f1('0x35')]('i.SmsAccountId\x20IN\x20?',[][_0xf0f1('0x68')](_0x2ee0b9[_0xf0f1('0x2f')][_0x531644]));}else if(_0x531644===_0xf0f1('0x51')){var _0x3d589c=JSON[_0xf0f1('0x4f')](_0x2ee0b9[_0xf0f1('0x2f')][_0x531644])[_0xf0f1('0x69')];var _0x4789ac=JSON[_0xf0f1('0x4f')](_0x2ee0b9[_0xf0f1('0x2f')][_0x531644])['$lte'];_0x12d1c1[_0xf0f1('0x35')](_0xf0f1('0x58'),_0x3d589c,_0x4789ac);}else{if(_0x2ee0b9[_0xf0f1('0x2f')][_0x531644]===_0xf0f1('0x6a')){_0x12d1c1[_0xf0f1('0x35')]('i.'+_0x531644+_0xf0f1('0x6b'));}else{_0x12d1c1['where']('i.'+_0x531644+_0xf0f1('0x5e'),_0x2ee0b9[_0xf0f1('0x2f')][_0x531644]);}}});}if(_0x2ee0b9[_0xf0f1('0x2f')][_0xf0f1('0x67')]){var _0x16c360=_0x2ee0b9[_0xf0f1('0x2f')]['filter'][_0xf0f1('0x6c')]('\x5c','\x5c\x5c')[_0xf0f1('0x6c')]('\x27\x27',_0xf0f1('0x6d'));if(qs[_0xf0f1('0x6e')](_0x16c360)){_0x1d84c5['or'](_0xf0f1('0x6f'),_0x16c360+'%')['or']('i.phone\x20LIKE\x20?',_0x16c360+'%');}else{var _0x2905e7=[];_0x16c360['split']('\x20')[_0xf0f1('0x29')](function(_0x188420){_0x2905e7[_0xf0f1('0x2a')]('+'+_0x188420[_0xf0f1('0x70')]());});var _0x462382=_0x2905e7[_0xf0f1('0x71')]('\x20');_0x1d84c5['or'](_0xf0f1('0x72'),_0x462382)['or'](_0xf0f1('0x73'),_0x16c360+'%');}}}_0x12d1c1[_0xf0f1('0x35')](_0x1d84c5);if(_0x291823[_0xf0f1('0x33')]){_0x291823[_0xf0f1('0x33')][_0xf0f1('0x29')](function(_0x1c207b){_0x12d1c1[_0xf0f1('0x33')]('i.'+_0x1c207b[0x0],_0x1c207b[0x1]===_0xf0f1('0x74')?![]:!![]);});}_0x12d1c1[_0xf0f1('0x75')]('i.id');var _0x35241f={'type':db[_0xf0f1('0x76')][_0xf0f1('0x77')]['SELECT'],'raw':!![]};var _0x1b16af=_0x12d1c1[_0xf0f1('0x78')]()[_0xf0f1('0x39')](_0xf0f1('0x3d'))[_0xf0f1('0x39')](_0xf0f1('0x79'),_0xf0f1('0x5b'));if(!_0x2ee0b9[_0xf0f1('0x2f')]['advancedFilter']){if(_0x2ee0b9[_0xf0f1('0x2f')]['read']){if(_0x2ee0b9[_0xf0f1('0x2f')][_0xf0f1('0x7a')]==0x1){_0x1b16af[_0xf0f1('0x7b')]('`unreadMessages`\x20=\x200');_0x12d1c1[_0xf0f1('0x7b')](_0xf0f1('0x7c'));}else{_0x1b16af[_0xf0f1('0x7b')](_0xf0f1('0x7d'));_0x12d1c1[_0xf0f1('0x7b')](_0xf0f1('0x7d'));}}if(_0x2ee0b9[_0xf0f1('0x2f')][_0xf0f1('0x7e')]){var _0x4ac590=_[_0xf0f1('0x59')](_0x2ee0b9[_0xf0f1('0x2f')]['tag'])?_0x2ee0b9[_0xf0f1('0x2f')]['tag']:new Array(_0x2ee0b9[_0xf0f1('0x2f')][_0xf0f1('0x7e')]);var _0x179bb8=squel[_0xf0f1('0x4d')]();_0x4ac590['forEach'](function(_0x39d0ab){_0x179bb8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x39d0ab+',%');});_0x12d1c1[_0xf0f1('0x7b')](_0x179bb8);_0x1b16af[_0xf0f1('0x43')]('sms_interaction_has_tags','it',_0xf0f1('0x7f'));_0x1b16af['left_join'](_0xf0f1('0x3c'),'t',_0xf0f1('0x80'));_0x1b16af['where']('t.id\x20IN\x20?',_0x4ac590);}}else{var _0x2fe312=JSON[_0xf0f1('0x4f')](_0x2ee0b9[_0xf0f1('0x2f')]['advancedFilter']);_[_0xf0f1('0x50')](_0x2fe312)[_0xf0f1('0x29')](function(_0x18421a){var _0x48036c=_0x2fe312[_0x18421a];if(_0x18421a===_0xf0f1('0x81')){var _0x341f29=_0x48036c[_0xf0f1('0x52')];var _0x20b250=squel[_0xf0f1('0x4d')]();_0x341f29['forEach'](function(_0x50c6fa){_0x20b250['or'](_0xf0f1('0x82'),'%,'+_0x50c6fa+',%');});_0x12d1c1[_0xf0f1('0x7b')](_0x20b250);_0x1b16af[_0xf0f1('0x43')](_0xf0f1('0x83'),'it',_0xf0f1('0x84'));_0x1b16af['left_join'](_0xf0f1('0x3c'),'t',_0xf0f1('0x80'));_0x1b16af[_0xf0f1('0x35')]('t.id\x20IN\x20?',_0x341f29);}else if(_0x18421a==='unreadMessages'){if(_0x48036c[_0xf0f1('0x52')][_0xf0f1('0x32')]===0x1){if(_0x48036c[_0xf0f1('0x52')][0x0]===0x1){_0x1b16af[_0xf0f1('0x7b')](_0xf0f1('0x7c'));_0x12d1c1[_0xf0f1('0x7b')](_0xf0f1('0x7c'));}else{_0x1b16af['having']('`unreadMessages`\x20>\x200');_0x12d1c1[_0xf0f1('0x7b')]('`unreadMessages`\x20>\x200');}}}});}db[_0xf0f1('0x85')][_0xf0f1('0x2f')](_0x1b16af[_0xf0f1('0x70')](),_0x35241f)[_0xf0f1('0x20')](function(_0x16e2be){_0x4c35ec['count']=_0x16e2be[_0xf0f1('0x32')];if(_0x4c35ec['count']===0x0)return[];return db[_0xf0f1('0x85')][_0xf0f1('0x2f')](_0x4d32d6['toString'](),_0x35241f)['then'](function(_0x29e016){_0x304846=_[_0xf0f1('0x86')](_0x29e016,'id');_0x35241f=_[_0xf0f1('0x87')](_0x35241f,{'model':db[_0xf0f1('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x12d1c1[_0xf0f1('0x39')](_0xf0f1('0x79'),'unreadMessages');_0x12d1c1[_0xf0f1('0x39')]('a.key',_0xf0f1('0x88'));_0x12d1c1[_0xf0f1('0x39')]('a.mandatoryDisposition',_0xf0f1('0x89'));_0x12d1c1[_0xf0f1('0x39')](_0xf0f1('0x8a'));_0x12d1c1['field']('c.firstName',_0xf0f1('0x8b'));_0x12d1c1[_0xf0f1('0x39')](_0xf0f1('0x61'),_0xf0f1('0x8c'));_0x12d1c1[_0xf0f1('0x39')]('c.email','Contact.email');_0x12d1c1['field'](_0xf0f1('0x8d'),'Contact.phone');_0x12d1c1[_0xf0f1('0x39')](_0xf0f1('0x8e'),_0xf0f1('0x8f'));_0x12d1c1[_0xf0f1('0x39')]('c.fax',_0xf0f1('0x90'));_0x12d1c1[_0xf0f1('0x39')](_0xf0f1('0x91'),_0xf0f1('0x26'));_0x12d1c1['left_join']('sms_interaction_has_tags','it',_0xf0f1('0x7f'));_0x12d1c1[_0xf0f1('0x43')]('tools_tags','t',_0xf0f1('0x80'));_0x12d1c1['limit'](_0x291823[_0xf0f1('0x1b')]);_0x12d1c1[_0xf0f1('0x1a')](_0x291823[_0xf0f1('0x1a')]);return db[_0xf0f1('0x85')][_0xf0f1('0x2f')](_0x12d1c1[_0xf0f1('0x70')](),_0x35241f);})[_0xf0f1('0x20')](function(_0x40032f){_0x48ae9b[_0xf0f1('0x35')](_0xf0f1('0x92'),_[_0xf0f1('0x25')](_0x40032f,'id'));return db[_0xf0f1('0x85')][_0xf0f1('0x2f')](_0x48ae9b['toString'](),_0x35241f)['then'](function(_0x426a7e){var _0x5ea1f6=_['groupBy'](_0x426a7e,_0xf0f1('0x93'));var _0x5b4717=[];_0x40032f[_0xf0f1('0x29')](function(_0x5b1faa){_0x5b4717['push'](updateSmsInteraction(_0x5b1faa,_0x304846,_0x5ea1f6));});return BPromise[_0xf0f1('0x94')](_0x5b4717);});});})['then'](function(_0x98e3b5){_0x4c35ec[_0xf0f1('0x95')]=_0x98e3b5;return _0x4c35ec;})[_0xf0f1('0x20')](respondWithFilteredResult(_0x56906b,_0x291823))['catch'](handleError(_0x56906b,null));};exports[_0xf0f1('0x96')]=function(_0x2a6d0d,_0x4d40e4){var _0x3e7742={'raw':![],'where':{'id':_0x2a6d0d[_0xf0f1('0x97')]['id']}},_0x48711a={};_0x48711a[_0xf0f1('0x2e')]=_['keys'](db[_0xf0f1('0x2c')][_0xf0f1('0x2d')]);_0x48711a['query']=_[_0xf0f1('0x50')](_0x2a6d0d[_0xf0f1('0x2f')]);_0x48711a[_0xf0f1('0x37')]=_[_0xf0f1('0x30')](_0x48711a[_0xf0f1('0x2e')],_0x48711a[_0xf0f1('0x2f')]);_0x3e7742[_0xf0f1('0x31')]=_[_0xf0f1('0x30')](_0x48711a[_0xf0f1('0x2e')],qs[_0xf0f1('0x98')](_0x2a6d0d[_0xf0f1('0x2f')][_0xf0f1('0x98')]));_0x3e7742[_0xf0f1('0x31')]=_0x3e7742[_0xf0f1('0x31')][_0xf0f1('0x32')]?_0x3e7742[_0xf0f1('0x31')]:_0x48711a[_0xf0f1('0x2e')];if(_0x2a6d0d[_0xf0f1('0x2f')][_0xf0f1('0x99')]){_0x3e7742[_0xf0f1('0x9a')]=[{'all':!![]}];}_0x3e7742=_[_0xf0f1('0x87')]({},_0x3e7742,_0x2a6d0d['options']);return db[_0xf0f1('0x2c')][_0xf0f1('0x9b')](_0x3e7742)[_0xf0f1('0x20')](handleEntityNotFound(_0x4d40e4,null))['then'](respondWithResult(_0x4d40e4,null))[_0xf0f1('0x2b')](handleError(_0x4d40e4,null));};exports['create']=function(_0x3316b9,_0x5c0641){return db['SmsInteraction'][_0xf0f1('0x9c')](_0x3316b9[_0xf0f1('0x9d')],{})[_0xf0f1('0x20')](respondWithResult(_0x5c0641,0xc9))['catch'](handleError(_0x5c0641,null));};exports['update']=function(_0x3ae09b,_0x1ae98d){if(_0x3ae09b[_0xf0f1('0x9d')]['id']){delete _0x3ae09b[_0xf0f1('0x9d')]['id'];}return db[_0xf0f1('0x2c')][_0xf0f1('0x9b')]({'where':{'id':_0x3ae09b['params']['id']}})[_0xf0f1('0x20')](handleEntityNotFound(_0x1ae98d,null))[_0xf0f1('0x20')](saveUpdates(_0x3ae09b[_0xf0f1('0x9d')],null))[_0xf0f1('0x20')](respondWithResult(_0x1ae98d,null))[_0xf0f1('0x2b')](handleError(_0x1ae98d,null));};exports['destroy']=function(_0x4b886e,_0x275513){return db[_0xf0f1('0x2c')]['find']({'where':{'id':_0x4b886e[_0xf0f1('0x97')]['id']}})[_0xf0f1('0x20')](handleEntityNotFound(_0x275513,null))[_0xf0f1('0x20')](removeEntity(_0x275513,null))[_0xf0f1('0x2b')](handleError(_0x275513,null));};exports[_0xf0f1('0x9e')]=function(_0x4a9d35,_0x1ffb79){return db['SmsInteraction'][_0xf0f1('0x9e')]()['then'](respondWithResult(_0x1ffb79,null))[_0xf0f1('0x2b')](handleError(_0x1ffb79,null));};exports[_0xf0f1('0x9f')]=function(_0x4b98ed,_0x5b5e22,_0x24a98c){return db[_0xf0f1('0xa0')][_0xf0f1('0x9b')]({'where':{'id':_0x4b98ed[_0xf0f1('0x97')]['id']}})['then'](handleEntityNotFound(_0x5b5e22,null))[_0xf0f1('0x20')](function(_0x3173ac){if(_0x3173ac){return _0x3173ac[_0xf0f1('0x9f')](_0x4b98ed[_0xf0f1('0x9d')][_0xf0f1('0xa1')],_[_0xf0f1('0xa2')](_0x4b98ed['body'],[_0xf0f1('0xa1'),'id'])||{});}})[_0xf0f1('0x20')](respondWithResult(_0x5b5e22,null))[_0xf0f1('0x2b')](handleError(_0x5b5e22,null));};exports[_0xf0f1('0xa3')]=function(_0xe3d510,_0x5324df,_0x3b2a70){var _0x15bf38={'raw':![],'where':{}};var _0x306099={};var _0x8aa7aa={'count':0x0,'rows':[]};return db[_0xf0f1('0x2c')][_0xf0f1('0xa4')]({'where':{'id':_0xe3d510[_0xf0f1('0x97')]['id']}})[_0xf0f1('0x20')](handleEntityNotFound(_0x5324df,null))[_0xf0f1('0x20')](function(_0x1482ae){if(_0x1482ae){_0x306099['model']=_[_0xf0f1('0x50')](db['SmsMessage'][_0xf0f1('0x2d')]);_0x306099[_0xf0f1('0x2f')]=_[_0xf0f1('0x50')](_0xe3d510[_0xf0f1('0x2f')]);_0x306099[_0xf0f1('0x37')]=_['intersection'](_0x306099[_0xf0f1('0x2e')],_0x306099[_0xf0f1('0x2f')]);_0x15bf38['attributes']=_[_0xf0f1('0x30')](_0x306099[_0xf0f1('0x2e')],qs['fields'](_0xe3d510[_0xf0f1('0x2f')][_0xf0f1('0x98')]));_0x15bf38[_0xf0f1('0x31')]=_0x15bf38[_0xf0f1('0x31')][_0xf0f1('0x32')]?_0x15bf38[_0xf0f1('0x31')]:_0x306099[_0xf0f1('0x2e')];if(!_0xe3d510['query'][_0xf0f1('0x66')](_0xf0f1('0xa5'))){_0x15bf38[_0xf0f1('0x1b')]=qs['limit'](_0xe3d510['query']['limit']);_0x15bf38[_0xf0f1('0x1a')]=qs[_0xf0f1('0x1a')](_0xe3d510[_0xf0f1('0x2f')][_0xf0f1('0x1a')]);}_0x15bf38[_0xf0f1('0x33')]=qs[_0xf0f1('0x34')](_0xe3d510[_0xf0f1('0x2f')][_0xf0f1('0x34')]);_0x15bf38[_0xf0f1('0x35')]=qs[_0xf0f1('0x37')](_['pick'](_0xe3d510[_0xf0f1('0x2f')],_0x306099[_0xf0f1('0x37')]));_0x15bf38[_0xf0f1('0x35')][_0xf0f1('0x93')]=_0x1482ae['id'];if(_0xe3d510[_0xf0f1('0x2f')][_0xf0f1('0x67')]){_0x15bf38[_0xf0f1('0x35')]=_[_0xf0f1('0x87')](_0x15bf38[_0xf0f1('0x35')],{'$or':_[_0xf0f1('0x25')](_0x15bf38[_0xf0f1('0x31')],function(_0x263587){var _0x140ae8={};_0x140ae8[_0x263587]={'$like':'%'+_0xe3d510[_0xf0f1('0x2f')][_0xf0f1('0x67')]+'%'};return _0x140ae8;})});}if(_0xe3d510[_0xf0f1('0x2f')][_0xf0f1('0x69')]){var _0x2b443e=_0xe3d510[_0xf0f1('0x2f')][_0xf0f1('0x69')]['split'](',');var _0x3d561a={};_0x3d561a[_0x2b443e[0x0]]={'$gte':moment(_0x2b443e[0x1])[_0xf0f1('0x55')](_0xf0f1('0xa6'))};_0x15bf38['where']=_[_0xf0f1('0x87')](_0x15bf38['where'],_0x3d561a);}_0x15bf38=_[_0xf0f1('0x87')]({},_0x15bf38,_0xe3d510[_0xf0f1('0xa7')]);return db['SmsMessage'][_0xf0f1('0xa8')]({'where':_0x15bf38['where']})['then'](function(_0x5ad089){_0x8aa7aa['count']=_0x5ad089;if(_0xe3d510[_0xf0f1('0x2f')][_0xf0f1('0x99')]){_0x15bf38[_0xf0f1('0x9a')]=[{'all':!![]}];}return db[_0xf0f1('0xa0')][_0xf0f1('0xa9')](_0x15bf38);})['then'](function(_0x23fc7a){_0x8aa7aa[_0xf0f1('0x95')]=_0x23fc7a;return _0x8aa7aa;});}})[_0xf0f1('0x20')](respondWithFilteredResult(_0x5324df,_0x15bf38))[_0xf0f1('0x2b')](handleError(_0x5324df,null));};exports[_0xf0f1('0xaa')]=function(_0x26e1c0,_0x13f622,_0x2e8805){return db['SmsInteraction'][_0xf0f1('0x9b')]({'where':{'id':_0x26e1c0['params']['id']}})['then'](handleEntityNotFound(_0x13f622,null))[_0xf0f1('0x20')](function(_0xe2fdd2){if(_0xe2fdd2){return _0xe2fdd2[_0xf0f1('0xab')](_0x26e1c0[_0xf0f1('0x9d')][_0xf0f1('0xa1')],_[_0xf0f1('0xa2')](_0x26e1c0[_0xf0f1('0x9d')],[_0xf0f1('0xa1'),'id'])||{})['spread'](function(){return db[_0xf0f1('0xac')][_0xf0f1('0xa9')]({'attributes':['id',_0xf0f1('0x22'),_0xf0f1('0x3a')],'where':{'id':_0x26e1c0[_0xf0f1('0x9d')][_0xf0f1('0xa1')]}});})[_0xf0f1('0x20')](function(_0x241f45){socket[_0xf0f1('0xad')]('smsInteractionTags:save',{'id':Number(_0x26e1c0[_0xf0f1('0x97')]['id']),'tags':_0x241f45||[]});return{'id':Number(_0x26e1c0[_0xf0f1('0x97')]['id']),'tags':_0x241f45||[]};});}})[_0xf0f1('0x20')](respondWithResult(_0x13f622,null))[_0xf0f1('0x2b')](handleError(_0x13f622,null));};exports[_0xf0f1('0xae')]=function(_0x515e1f,_0x578faf,_0xc946f9){return db[_0xf0f1('0x2c')][_0xf0f1('0x9b')]({'where':{'id':_0x515e1f[_0xf0f1('0x97')]['id']}})[_0xf0f1('0x20')](handleEntityNotFound(_0x578faf,null))[_0xf0f1('0x20')](function(_0x466527){if(_0x466527){return _0x466527['removeTags'](_0x515e1f[_0xf0f1('0x2f')][_0xf0f1('0xa1')]);}})[_0xf0f1('0x20')](respondWithStatusCode(_0x578faf,null))[_0xf0f1('0x2b')](handleError(_0x578faf,null));};exports['download']=function(_0x273f54,_0x32ff9e){var _0x221902=moment()[_0xf0f1('0xaf')]()[_0xf0f1('0x70')]();var _0x68311f=path[_0xf0f1('0x71')](config[_0xf0f1('0xb0')],'server',_0xf0f1('0xb1'),'tmp');var _0x1f2d18=path[_0xf0f1('0x71')](config[_0xf0f1('0xb0')],_0xf0f1('0xb2'),_0xf0f1('0xb1'),'attachments');var _0x1084ea=path[_0xf0f1('0x71')](_0x68311f,_0x221902);var _0x5257a7=util[_0xf0f1('0x55')]('transcript-%d-%s.zip',_0x273f54[_0xf0f1('0x97')]['id'],_0x221902);var _0x77a0f9=path[_0xf0f1('0x71')](_0x68311f,_0x5257a7);var _0x16c5b1=![];return db['SmsInteraction'][_0xf0f1('0x9b')]({'where':{'id':_0x273f54[_0xf0f1('0x97')]['id']},'include':[{'model':db[_0xf0f1('0xa0')],'as':_0xf0f1('0xb3'),'attributes':['id',_0xf0f1('0x9d'),'createdAt',_0xf0f1('0xb4'),'secret','read'],'include':[{'model':db[_0xf0f1('0xb5')],'as':_0xf0f1('0xb5'),'attributes':['id',_0xf0f1('0xb6')],'raw':!![]},{'model':db[_0xf0f1('0xb7')],'as':_0xf0f1('0xb8'),'attributes':['id',_0xf0f1('0xb9'),_0xf0f1('0xba')],'raw':!![]}]},{'model':db['SmsAccount'],'as':_0xf0f1('0xbb'),'attributes':['id',_0xf0f1('0x22')]},{'model':db[_0xf0f1('0xb5')],'as':_0xf0f1('0xbc'),'attributes':['id',_0xf0f1('0xb6')]}]})[_0xf0f1('0x20')](handleEntityNotFound(_0x32ff9e,null))['then'](function(_0x531287){if(_0x531287){var _0xced4a8=_0x531287[_0xf0f1('0xbd')]({'plain':!![]});_0x16c5b1=!![];var _0x3b3d0c={'format':'A4','border':_0xf0f1('0xbe'),'header':{'height':_0xf0f1('0xbf'),'contents':{'first':_0xf0f1('0xc0')}},'footer':{'height':_0xf0f1('0xc1'),'contents':{'default':util[_0xf0f1('0x55')](_0xf0f1('0xc2'),util['format'](_0xf0f1('0xc3'),_0xf0f1('0xc4'),_0xced4a8['id']),moment()[_0xf0f1('0x55')]('YYYY-MM-DD')[_0xf0f1('0x70')]())}}};fs[_0xf0f1('0xc5')](_0x1084ea);var _0x73872={'channel':_0xf0f1('0xc4'),'account':_0xced4a8[_0xf0f1('0xbb')][_0xf0f1('0x22')],'agent':_0xced4a8[_0xf0f1('0xbc')]?_0xced4a8[_0xf0f1('0xbc')][_0xf0f1('0xb6')]:'N.A.','createdAt':moment(_0xced4a8[_0xf0f1('0x51')])['format'](_0xf0f1('0xa6'))['toString'](),'closedAt':_0xced4a8[_0xf0f1('0xc6')]?moment(_0xced4a8[_0xf0f1('0xc7')])[_0xf0f1('0x55')](_0xf0f1('0xa6'))['toString']():'','disposition':_0xced4a8[_0xf0f1('0xc8')],'messages':_(_0xced4a8[_0xf0f1('0xb3')])['filter']({'secret':![]})[_0xf0f1('0x25')](function(_0x4bae9c){return{'date':moment(_0x4bae9c['createdAt'])[_0xf0f1('0x55')](_0xf0f1('0xa6'))[_0xf0f1('0x70')](),'sender':_0x4bae9c['direction']===_0xf0f1('0xc9')?_0x4bae9c[_0xf0f1('0xb5')]?_0x4bae9c[_0xf0f1('0xb5')][_0xf0f1('0xb6')]:'System':_0x4bae9c[_0xf0f1('0xb8')][_0xf0f1('0xb9')]+(_0x4bae9c[_0xf0f1('0xb8')]['lastName']?'\x20'+_0x4bae9c['Contact'][_0xf0f1('0xba')]:''),'body':_0x4bae9c[_0xf0f1('0x9d')],'direction':_0x4bae9c[_0xf0f1('0xb4')]==='out'?'A':'C','secret':_0x4bae9c[_0xf0f1('0xca')],'read':_0x4bae9c['read']};})[_0xf0f1('0x52')]()};return ejs[_0xf0f1('0xcb')](path[_0xf0f1('0x71')](config[_0xf0f1('0xb0')],'server',_0xf0f1('0xcc'),_0xf0f1('0xcd')),{'interaction':_0x73872})['then'](function(_0x5e4e3b){return new BPromise(function(_0x4f2a03,_0x97a88f){pdf[_0xf0f1('0x9c')](_0x5e4e3b,_0x3b3d0c)[_0xf0f1('0xce')](path['join'](_0x1084ea,_0xf0f1('0xcf')+_0xced4a8['id']+'-'+_0x221902+_0xf0f1('0xd0')),function(_0x2acf70,_0x5f5920){if(_0x2acf70)return _0x97a88f(_0x2acf70);_0x4f2a03(_0x5f5920);});});});}})[_0xf0f1('0x20')](function(){if(_0x16c5b1){return new BPromise(function(_0x56385d,_0x102d41){zipdir(_0x1084ea,{'saveTo':_0x77a0f9},function(_0x41f1eb,_0x494162){if(_0x41f1eb)return _0x102d41(_0x41f1eb);return _0x56385d(_0x494162);});})[_0xf0f1('0x20')](function(){return new BPromise(function(_0x51e2b0,_0x1909e8){rimraf(_0x1084ea,function(_0x8556ae){if(_0x8556ae)_0x1909e8(_0x8556ae);return _0x51e2b0();});});})[_0xf0f1('0x20')](function(){return _0x32ff9e['download'](_0x77a0f9,_0x5257a7,function(_0x589b4c){if(_0x589b4c){console[_0xf0f1('0xd1')]('err',_0x589b4c);}else{fs[_0xf0f1('0xd2')](_0x77a0f9);}});});}else{return _0x32ff9e[_0xf0f1('0x16')](0xc8);}})[_0xf0f1('0x2b')](handleError(_0x32ff9e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f1912ba..92a90ab 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac95=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','save','update','getUsers','then','Users','map','findAll','unreadMessages','length'];(function(_0x49cd8e,_0x3c745f){var _0x43f139=function(_0x40545c){while(--_0x40545c){_0x49cd8e['push'](_0x49cd8e['shift']());}};_0x43f139(++_0x3c745f);}(_0xac95,0xa8));var _0x5ac9=function(_0x2c9758,_0x48d9bc){_0x2c9758=_0x2c9758-0x0;var _0xe46f24=_0xac95[_0x2c9758];return _0xe46f24;};'use strict';var EventEmitter=require(_0x5ac9('0x0'));var SmsInteraction=require(_0x5ac9('0x1'))['db'][_0x5ac9('0x2')];var SmsMessage=require(_0x5ac9('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ac9('0x3'),'afterUpdate':_0x5ac9('0x4'),'afterDestroy':'remove'};function emitEvent(_0xafa08d){return function(_0x3790d1,_0x5b445a,_0x1dc09a){_0x3790d1[_0x5ac9('0x5')]({'attributes':['id'],'raw':!![]})[_0x5ac9('0x6')](function(_0x4bddcf){_0x3790d1['setDataValue'](_0x5ac9('0x7'),_0x4bddcf[_0x5ac9('0x8')](function(_0x28bc1f){return{'id':_0x28bc1f['id']};}));return SmsMessage[_0x5ac9('0x9')]({'where':{'SmsInteractionId':_0x3790d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5ac9('0x6')](function(_0x5da6fb){_0x3790d1['setDataValue'](_0x5ac9('0xa'),_0x5da6fb[_0x5ac9('0xb')]);SmsInteractionEvents['emit'](_0xafa08d+':'+_0x3790d1['id'],_0x3790d1);SmsInteractionEvents[_0x5ac9('0xc')](_0xafa08d,_0x3790d1);_0x1dc09a(null);})['catch'](_0x1dc09a(null));};}for(var e in events){if(events[_0x5ac9('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5ac9('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x02a7=['then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02a7,0x7a));var _0x702a=function(_0x105b21,_0x3e39e7){_0x105b21=_0x105b21-0x0;var _0x2301a6=_0x02a7[_0x105b21];return _0x2301a6;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x702a('0x0'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x702a('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x702a('0x2')](0x0);var events={'afterCreate':_0x702a('0x3'),'afterUpdate':_0x702a('0x4'),'afterDestroy':_0x702a('0x5')};function emitEvent(_0x1fc26b){return function(_0x3fb65a,_0x4a1d02,_0x1bcfe5){_0x3fb65a['getUsers']({'attributes':['id'],'raw':!![]})[_0x702a('0x6')](function(_0x1aa2c2){_0x3fb65a[_0x702a('0x7')](_0x702a('0x8'),_0x1aa2c2[_0x702a('0x9')](function(_0x20c009){return{'id':_0x20c009['id']};}));return SmsMessage[_0x702a('0xa')]({'where':{'SmsInteractionId':_0x3fb65a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x15acfb){_0x3fb65a['setDataValue']('unreadMessages',_0x15acfb[_0x702a('0xb')]);SmsInteractionEvents[_0x702a('0xc')](_0x1fc26b+':'+_0x3fb65a['id'],_0x3fb65a);SmsInteractionEvents[_0x702a('0xc')](_0x1fc26b,_0x3fb65a);_0x1bcfe5(null);})[_0x702a('0xd')](_0x1bcfe5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x702a('0xe')](e,emitEvent(event));}}module[_0x702a('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a934646..9a20777 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 _0xe0ad=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0xe0ad,0x195));var _0xde0a=function(_0x21b94c,_0xb98409){_0x21b94c=_0x21b94c-0x0;var _0x549792=_0xe0ad[_0x21b94c];return _0x549792;};'use strict';var _=require(_0xde0a('0x0'));var util=require('util');var logger=require(_0xde0a('0x1'))('api');var moment=require(_0xde0a('0x2'));var BPromise=require(_0xde0a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde0a('0x4'));var rimraf=require(_0xde0a('0x5'));var config=require(_0xde0a('0x6'));var attributes=require(_0xde0a('0x7'));module[_0xde0a('0x8')]=function(_0x1889fc,_0x597220){return _0x1889fc[_0xde0a('0x9')](_0xde0a('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x245a19,_0x177ec3,_0x191873){if(_0x245a19['changed'](_0xde0a('0xb'))){_0x245a19['closedAt']=moment()[_0xde0a('0xc')](_0xde0a('0xd'));}_0x191873(null,_0x245a19);}}});}; \ No newline at end of file +var _0xf58a=['define','SmsInteraction','changed','closedAt','format','util','bluebird','request-promise','./smsInteraction.attributes'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xf58a,0x1a3));var _0xaf58=function(_0x34966f,_0x132d0e){_0x34966f=_0x34966f-0x0;var _0x47db98=_0xf58a[_0x34966f];return _0x47db98;};'use strict';var _=require('lodash');var util=require(_0xaf58('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaf58('0x1'));var rp=require(_0xaf58('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaf58('0x3'));module['exports']=function(_0x198069,_0x5270cd){return _0x198069[_0xaf58('0x4')](_0xaf58('0x5'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d37ca,_0x4a2a0c,_0x93b0f2){if(_0x3d37ca[_0xaf58('0x6')]('closed')){_0x3d37ca[_0xaf58('0x7')]=moment()[_0xaf58('0x8')]('YYYY-MM-DD\x20HH:mm:ss');}_0x93b0f2(null,_0x3d37ca);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 33b50fd..93c5f67 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 _0xc2be=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','./smsInteraction.socket','register','then','info','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','ids','omit','spread','AddTags','lodash'];(function(_0x249d0a,_0x2da083){var _0x2182db=function(_0x1441cc){while(--_0x1441cc){_0x249d0a['push'](_0x249d0a['shift']());}};_0x2182db(++_0x2da083);}(_0xc2be,0x196));var _0xec2b=function(_0x1b3fb9,_0x3f4d2c){_0x1b3fb9=_0x1b3fb9-0x0;var _0x506898=_0xc2be[_0x1b3fb9];return _0x506898;};'use strict';var _=require(_0xec2b('0x0'));var util=require('util');var moment=require(_0xec2b('0x1'));var BPromise=require(_0xec2b('0x2'));var rs=require(_0xec2b('0x3'));var fs=require('fs');var Redis=require(_0xec2b('0x4'));var db=require(_0xec2b('0x5'))['db'];var utils=require(_0xec2b('0x6'));var logger=require(_0xec2b('0x7'))(_0xec2b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xec2b('0x9')]['http']({'port':0x232a});config['redis']=_[_0xec2b('0xa')](config[_0xec2b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec2b('0xb')]));require(_0xec2b('0xc'))[_0xec2b('0xd')](socket);function respondWithRpcPromise(_0x30923c,_0x419373,_0x2c53ad){return new BPromise(function(_0x47b2db,_0xbb82dc){return client['request'](_0x30923c,_0x2c53ad)[_0xec2b('0xe')](function(_0xd6bec5){logger[_0xec2b('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x419373,_0xec2b('0x10'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x419373,_0xec2b('0x10'),JSON[_0xec2b('0x11')](_0xd6bec5));if(_0xd6bec5[_0xec2b('0x12')]){if(_0xd6bec5[_0xec2b('0x12')][_0xec2b('0x13')]===0x1f4){logger[_0xec2b('0x12')](_0xec2b('0x14'),_0x419373,_0xd6bec5[_0xec2b('0x12')][_0xec2b('0x15')]);return _0xbb82dc(_0xd6bec5['error'][_0xec2b('0x15')]);}logger[_0xec2b('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x419373,_0xd6bec5[_0xec2b('0x12')][_0xec2b('0x15')]);return _0x47b2db(_0xd6bec5[_0xec2b('0x12')][_0xec2b('0x15')]);}else{logger['info'](_0xec2b('0x14'),_0x419373,_0xec2b('0x10'));_0x47b2db(_0xd6bec5['result'][_0xec2b('0x15')]);}})[_0xec2b('0x16')](function(_0x89eede){logger['error'](_0xec2b('0x14'),_0x419373,_0x89eede);_0xbb82dc(_0x89eede);});});}exports[_0xec2b('0x17')]=function(_0x3e6d07){var _0x41690c=this;return new Promise(function(_0x58ac5e,_0x4c0638){return db['SmsInteraction']['update'](_0x3e6d07[_0xec2b('0x18')],{'raw':_0x3e6d07[_0xec2b('0x19')]?_0x3e6d07['options'][_0xec2b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6d07[_0xec2b('0x19')]?_0x3e6d07[_0xec2b('0x19')][_0xec2b('0x1b')]||null:null,'attributes':_0x3e6d07[_0xec2b('0x19')]?_0x3e6d07['options'][_0xec2b('0x1c')]||null:null,'limit':_0x3e6d07[_0xec2b('0x19')]?_0x3e6d07['options'][_0xec2b('0x1d')]||null:null})[_0xec2b('0xe')](function(_0x398e5f){logger['info']('UpdateSmsInteraction',_0x3e6d07);logger['debug'](_0xec2b('0x17'),_0x3e6d07,JSON[_0xec2b('0x11')](_0x398e5f));_0x58ac5e(_0x398e5f);})[_0xec2b('0x16')](function(_0x1d7edd){logger['error'](_0xec2b('0x17'),_0x1d7edd[_0xec2b('0x15')],_0x3e6d07);_0x4c0638(_0x41690c['error'](0x1f4,_0x1d7edd[_0xec2b('0x15')]));});});};exports[_0xec2b('0x1e')]=function(_0x4616d5){return new Promise(function(_0x2dcefb,_0x5e8bd2){return db[_0xec2b('0x1f')][_0xec2b('0x20')]({'where':_0x4616d5[_0xec2b('0x19')]?_0x4616d5[_0xec2b('0x19')]['where']||null:null})['then'](function(_0x1f59d4){if(_0x1f59d4){return _0x1f59d4['addTags'](_0x4616d5['body'][_0xec2b('0x21')],_[_0xec2b('0x22')](_0x4616d5[_0xec2b('0x18')],[_0xec2b('0x21'),'id'])||{});}})[_0xec2b('0x23')](function(_0x343852){logger[_0xec2b('0xf')](_0xec2b('0x24'),_0x4616d5);logger['debug'](_0xec2b('0x24'),_0x4616d5,JSON[_0xec2b('0x11')](_0x343852));_0x2dcefb(_0x343852);})[_0xec2b('0x16')](function(_0x2e960c){logger[_0xec2b('0x12')](_0xec2b('0x24'),_0x2e960c['message'],_0x4616d5);_0x5e8bd2(_this[_0xec2b('0x12')](0x1f4,_0x2e960c[_0xec2b('0x15')]));});});}; \ No newline at end of file +var _0xcd4e=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','SmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x32f3fe,_0x24e232){var _0x16d4a5=function(_0x45aded){while(--_0x45aded){_0x32f3fe['push'](_0x32f3fe['shift']());}};_0x16d4a5(++_0x24e232);}(_0xcd4e,0x170));var _0xecd4=function(_0x4c5b1e,_0x535dc6){_0x4c5b1e=_0x4c5b1e-0x0;var _0x44f446=_0xcd4e[_0x4c5b1e];return _0x44f446;};'use strict';var _=require(_0xecd4('0x0'));var util=require(_0xecd4('0x1'));var moment=require(_0xecd4('0x2'));var BPromise=require(_0xecd4('0x3'));var rs=require(_0xecd4('0x4'));var fs=require('fs');var Redis=require(_0xecd4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xecd4('0x6'));var logger=require(_0xecd4('0x7'))(_0xecd4('0x8'));var config=require(_0xecd4('0x9'));var jayson=require(_0xecd4('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xecd4('0xb')](config['redis'],{'host':_0xecd4('0xc'),'port':0x18eb});var socket=require(_0xecd4('0xd'))(new Redis(config['redis']));require(_0xecd4('0xe'))[_0xecd4('0xf')](socket);function respondWithRpcPromise(_0x461f9d,_0x4163c2,_0xeb2f32){return new BPromise(function(_0x3c3540,_0x512fe8){return client[_0xecd4('0x10')](_0x461f9d,_0xeb2f32)[_0xecd4('0x11')](function(_0x3aebf3){logger[_0xecd4('0x12')](_0xecd4('0x13'),_0x4163c2,'request\x20sent');logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x4163c2,_0xecd4('0x14'),JSON[_0xecd4('0x15')](_0x3aebf3));if(_0x3aebf3[_0xecd4('0x16')]){if(_0x3aebf3[_0xecd4('0x16')]['code']===0x1f4){logger[_0xecd4('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x4163c2,_0x3aebf3[_0xecd4('0x16')]['message']);return _0x512fe8(_0x3aebf3[_0xecd4('0x16')][_0xecd4('0x17')]);}logger['error'](_0xecd4('0x13'),_0x4163c2,_0x3aebf3[_0xecd4('0x16')][_0xecd4('0x17')]);return _0x3c3540(_0x3aebf3[_0xecd4('0x16')]['message']);}else{logger[_0xecd4('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x4163c2,_0xecd4('0x14'));_0x3c3540(_0x3aebf3[_0xecd4('0x18')]['message']);}})[_0xecd4('0x19')](function(_0x4b6fe1){logger[_0xecd4('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x4163c2,_0x4b6fe1);_0x512fe8(_0x4b6fe1);});});}exports[_0xecd4('0x1a')]=function(_0x1bc232){var _0x367a03=this;return new Promise(function(_0x2953f5,_0x380fa7){return db['SmsInteraction'][_0xecd4('0x1b')](_0x1bc232[_0xecd4('0x1c')],{'raw':_0x1bc232[_0xecd4('0x1d')]?_0x1bc232[_0xecd4('0x1d')][_0xecd4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bc232['options']?_0x1bc232['options'][_0xecd4('0x1f')]||null:null,'attributes':_0x1bc232[_0xecd4('0x1d')]?_0x1bc232['options'][_0xecd4('0x20')]||null:null,'limit':_0x1bc232[_0xecd4('0x1d')]?_0x1bc232[_0xecd4('0x1d')][_0xecd4('0x21')]||null:null})[_0xecd4('0x11')](function(_0x323d00){logger[_0xecd4('0x12')](_0xecd4('0x1a'),_0x1bc232);logger['debug'](_0xecd4('0x1a'),_0x1bc232,JSON[_0xecd4('0x15')](_0x323d00));_0x2953f5(_0x323d00);})[_0xecd4('0x19')](function(_0x85c691){logger[_0xecd4('0x16')](_0xecd4('0x1a'),_0x85c691[_0xecd4('0x17')],_0x1bc232);_0x380fa7(_0x367a03[_0xecd4('0x16')](0x1f4,_0x85c691[_0xecd4('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x274bb3){return new Promise(function(_0x146dd3,_0x27ceb8){return db[_0xecd4('0x22')][_0xecd4('0x23')]({'where':_0x274bb3['options']?_0x274bb3[_0xecd4('0x1d')][_0xecd4('0x1f')]||null:null})['then'](function(_0xb88a25){if(_0xb88a25){return _0xb88a25[_0xecd4('0x24')](_0x274bb3['body'][_0xecd4('0x25')],_[_0xecd4('0x26')](_0x274bb3[_0xecd4('0x1c')],[_0xecd4('0x25'),'id'])||{});}})[_0xecd4('0x27')](function(_0x700976){logger[_0xecd4('0x12')]('AddTags',_0x274bb3);logger['debug'](_0xecd4('0x28'),_0x274bb3,JSON[_0xecd4('0x15')](_0x700976));_0x146dd3(_0x700976);})[_0xecd4('0x19')](function(_0x27a4fb){logger[_0xecd4('0x16')](_0xecd4('0x28'),_0x27a4fb[_0xecd4('0x17')],_0x274bb3);_0x27ceb8(_this[_0xecd4('0x16')](0x1f4,_0x27a4fb[_0xecd4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1a14267..02e10a6 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0xd2f4f5,_0x341930){var _0x41fc10=function(_0x496824){while(--_0x496824){_0xd2f4f5['push'](_0xd2f4f5['shift']());}};_0x41fc10(++_0x341930);}(_0xb10b,0x12a));var _0xbb10=function(_0x10b4b8,_0x450fea){_0x10b4b8=_0x10b4b8-0x0;var _0x424293=_0xb10b[_0x10b4b8];return _0x424293;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0xf5b6b7,_0x417fd9){var _0x5edd10=function(_0x171950){while(--_0x171950){_0xf5b6b7['push'](_0xf5b6b7['shift']());}};_0x5edd10(++_0x417fd9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index cb99233..bbd6631 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 _0xcb66=['show','post','tracked','sms','/:id/status','status','put','update','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path','express','../../components/auth/service','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x2a7275,_0x47799b){var _0x4e4b54=function(_0x5e320f){while(--_0x5e320f){_0x2a7275['push'](_0x2a7275['shift']());}};_0x4e4b54(++_0x47799b);}(_0xcb66,0xd5));var _0x6cb6=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0xcb66[_0x2ab365];return _0x49fef3;};'use strict';var multer=require(_0x6cb6('0x0'));var util=require(_0x6cb6('0x1'));var path=require(_0x6cb6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cb6('0x3'));var router=express['Router']();var auth=require(_0x6cb6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6cb6('0x5'));router[_0x6cb6('0x6')]('/',auth['isAuthenticated'](),controller[_0x6cb6('0x7')]);router[_0x6cb6('0x6')](_0x6cb6('0x8'),auth[_0x6cb6('0x9')](),controller[_0x6cb6('0xa')]);router[_0x6cb6('0x6')](_0x6cb6('0xb'),auth[_0x6cb6('0x9')](),controller[_0x6cb6('0xc')]);router[_0x6cb6('0xd')]('/',auth[_0x6cb6('0x9')](),interaction[_0x6cb6('0xe')](_0x6cb6('0xf'),'smsmessage:create'),controller['create']);router[_0x6cb6('0xd')](_0x6cb6('0x10'),controller[_0x6cb6('0x11')]);router[_0x6cb6('0x12')](_0x6cb6('0xb'),auth[_0x6cb6('0x9')](),controller[_0x6cb6('0x13')]);router[_0x6cb6('0x12')](_0x6cb6('0x14'),auth[_0x6cb6('0x9')](),controller['accept']);router['put'](_0x6cb6('0x15'),auth[_0x6cb6('0x9')](),controller['reject']);router[_0x6cb6('0x16')](_0x6cb6('0xb'),auth['isAuthenticated'](),controller[_0x6cb6('0x17')]);module[_0x6cb6('0x18')]=router; \ No newline at end of file +var _0xb567=['create','/:id/status','status','put','/:id','update','accept','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','/describe','describe','isAuthenticated','post','tracked'];(function(_0x28d4c7,_0x5ac333){var _0x2f376a=function(_0x10069e){while(--_0x10069e){_0x28d4c7['push'](_0x28d4c7['shift']());}};_0x2f376a(++_0x5ac333);}(_0xb567,0x129));var _0x7b56=function(_0x28203f,_0x3947c1){_0x28203f=_0x28203f-0x0;var _0x43b07b=_0xb567[_0x28203f];return _0x43b07b;};'use strict';var multer=require('multer');var util=require(_0x7b56('0x0'));var path=require(_0x7b56('0x1'));var timeout=require(_0x7b56('0x2'));var express=require(_0x7b56('0x3'));var router=express[_0x7b56('0x4')]();var auth=require(_0x7b56('0x5'));var interaction=require(_0x7b56('0x6'));var config=require(_0x7b56('0x7'));var controller=require(_0x7b56('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7b56('0x9')](_0x7b56('0xa'),auth['isAuthenticated'](),controller[_0x7b56('0xb')]);router[_0x7b56('0x9')]('/:id',auth[_0x7b56('0xc')](),controller['show']);router[_0x7b56('0xd')]('/',auth[_0x7b56('0xc')](),interaction[_0x7b56('0xe')]('sms','smsmessage:create'),controller[_0x7b56('0xf')]);router[_0x7b56('0xd')](_0x7b56('0x10'),controller[_0x7b56('0x11')]);router[_0x7b56('0x12')](_0x7b56('0x13'),auth[_0x7b56('0xc')](),controller[_0x7b56('0x14')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x7b56('0x15')]);router['put']('/:id/reject',auth[_0x7b56('0xc')](),controller['reject']);router[_0x7b56('0x16')](_0x7b56('0x13'),auth[_0x7b56('0xc')](),controller['destroy']);module[_0x7b56('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e65919a..f3eec5c 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 _0xbde8=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','medium'];(function(_0x34edf0,_0x4f4692){var _0x5488a8=function(_0x2a999f){while(--_0x2a999f){_0x34edf0['push'](_0x34edf0['shift']());}};_0x5488a8(++_0x4f4692);}(_0xbde8,0x155));var _0x8bde=function(_0x4fadb8,_0x11b539){_0x4fadb8=_0x4fadb8-0x0;var _0x3c9e20=_0xbde8[_0x4fadb8];return _0x3c9e20;};'use strict';var Sequelize=require(_0x8bde('0x0'));module[_0x8bde('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8bde('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8bde('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8bde('0x4')]('in','out'),'defaultValue':_0x8bde('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8bde('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8bde('0x6')]},'readAt':{'type':Sequelize[_0x8bde('0x7')]},'secret':{'type':Sequelize[_0x8bde('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x92aa=['medium','BOOLEAN','out','STRING','DATE','sequelize','TEXT'];(function(_0x31752d,_0x2efff8){var _0x29da67=function(_0x296d74){while(--_0x296d74){_0x31752d['push'](_0x31752d['shift']());}};_0x29da67(++_0x2efff8);}(_0x92aa,0x75));var _0xa92a=function(_0x3c6b61,_0x433170){_0x3c6b61=_0x3c6b61-0x0;var _0x4efc32=_0x92aa[_0x3c6b61];return _0x4efc32;};'use strict';var Sequelize=require(_0xa92a('0x0'));module['exports']={'body':{'type':Sequelize[_0xa92a('0x1')](_0xa92a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa92a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa92a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa92a('0x5')]},'readAt':{'type':Sequelize[_0xa92a('0x6')]},'secret':{'type':Sequelize[_0xa92a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index ea440df..3d3ec25 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 _0x6a48=['end','name','send','rawAttributes','model','keys','query','intersection','attributes','fields','nolimit','limit','sort','where','filters','merge','map','type','VIRTUAL','field','filter','options','SmsMessage','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','SmsInteraction','read1stAt','interaction','role','stringify','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','acceptmessage','get','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','destroy'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x6a48,0x163));var _0x86a4=function(_0x595fa6,_0x32951){_0x595fa6=_0x595fa6-0x0;var _0x378a2d=_0x6a48[_0x595fa6];return _0x378a2d;};'use strict';var pdf=require(_0x86a4('0x0'));var emlformat=require(_0x86a4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x86a4('0x2'));var jsonpatch=require(_0x86a4('0x3'));var rp=require(_0x86a4('0x4'));var moment=require(_0x86a4('0x5'));var BPromise=require(_0x86a4('0x6'));var Mustache=require(_0x86a4('0x7'));var util=require(_0x86a4('0x8'));var path=require(_0x86a4('0x9'));var sox=require(_0x86a4('0xa'));var csv=require(_0x86a4('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x86a4('0xc'));var squel=require(_0x86a4('0xd'));var crypto=require(_0x86a4('0xe'));var jsforce=require(_0x86a4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x86a4('0xb'));var querystring=require('querystring');var Papa=require(_0x86a4('0x10'));var Redis=require('ioredis');var authService=require(_0x86a4('0x11'));var qs=require(_0x86a4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86a4('0x13'))(_0x86a4('0x14'));var utils=require('../../config/utils');var config=require(_0x86a4('0x15'));var db=require(_0x86a4('0x16'))['db'];config[_0x86a4('0x17')]=_[_0x86a4('0x18')](config[_0x86a4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x86a4('0x19'))(new Redis(config[_0x86a4('0x17')]));require(_0x86a4('0x1a'))[_0x86a4('0x1b')](socket);var jayson=require(_0x86a4('0x1c'));var client=jayson['client'][_0x86a4('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x86a4('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x8bf79f,_0x4be825,_0x2912e5){if(_0x2912e5){var _0x265b67=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x265b67[_0x86a4('0x1e')](_0x4be825)){return _0x8bf79f;}else{throw new db[(_0x86a4('0x1f'))][(_0x86a4('0x20'))](_0x86a4('0x21'));}}else{return _0x8bf79f;}}function respondWithRpcPromise(_0xbfa55c,_0x9012e8,_0x50455f,_0x4e2f35){return new BPromise(function(_0x304f55,_0x5490d9){var _0x25cc34=_0x4e2f35||client;return _0x25cc34[_0x86a4('0x22')](_0xbfa55c,_0x50455f)[_0x86a4('0x23')](function(_0x3a4761){logger[_0x86a4('0x24')]('SmsMessage,\x20%s,\x20%s',_0x9012e8,_0x86a4('0x25'));logger[_0x86a4('0x26')](_0x86a4('0x27'),_0x9012e8,_0x86a4('0x25'),JSON['stringify'](_0x3a4761));if(_0x3a4761[_0x86a4('0x28')]){if(_0x3a4761['error'][_0x86a4('0x29')]===0x1f4){logger['error'](_0x86a4('0x2a'),_0x9012e8,_0x3a4761['error'][_0x86a4('0x2b')]);return _0x5490d9(_0x3a4761[_0x86a4('0x28')]['message']);}logger[_0x86a4('0x28')](_0x86a4('0x2a'),_0x9012e8,_0x3a4761[_0x86a4('0x28')]['message']);return _0x304f55(_0x3a4761[_0x86a4('0x28')][_0x86a4('0x2b')]);}else{logger[_0x86a4('0x24')](_0x86a4('0x2a'),_0x9012e8,_0x86a4('0x25'));_0x304f55(_0x3a4761[_0x86a4('0x2c')][_0x86a4('0x2b')]);}})['catch'](function(_0x55281d){logger[_0x86a4('0x28')](_0x86a4('0x2a'),_0x9012e8,_0x55281d);_0x5490d9(_0x55281d);});});}function respondWithStatusCode(_0x9e6343,_0x395a59){_0x395a59=_0x395a59||0xcc;return function(_0x320f99){if(_0x320f99){return _0x9e6343[_0x86a4('0x2d')](_0x395a59);}return _0x9e6343[_0x86a4('0x2e')](_0x395a59)['end']();};}function respondWithResult(_0x33043b,_0x55c43b){_0x55c43b=_0x55c43b||0xc8;return function(_0x262033){if(_0x262033){return _0x33043b['status'](_0x55c43b)[_0x86a4('0x2f')](_0x262033);}};}function respondWithFilteredResult(_0x21fbdf,_0x4b1c85){return function(_0x236a7a){if(_0x236a7a){var _0xc6ddc9=_0x236a7a[_0x86a4('0x30')],_0x3c9b5f=_0x4b1c85[_0x86a4('0x31')],_0x4c7eda=_0x4b1c85['offset']+_0x4b1c85['limit'],_0x44a372;if(_0x4c7eda>=_0xc6ddc9){_0x4c7eda=_0xc6ddc9;_0x44a372=0xc8;}else{_0x44a372=0xce;}_0x21fbdf[_0x86a4('0x2e')](_0x44a372);return _0x21fbdf[_0x86a4('0x32')](_0x86a4('0x33'),_0x3c9b5f+'-'+_0x4c7eda+'/'+_0xc6ddc9)[_0x86a4('0x2f')](_0x236a7a);}return null;};}function patchUpdates(_0x215bf2){return function(_0x2c0bdc){try{jsonpatch['apply'](_0x2c0bdc,_0x215bf2,!![]);}catch(_0x9d118c){return BPromise[_0x86a4('0x34')](_0x9d118c);}return _0x2c0bdc[_0x86a4('0x35')]();};}function saveUpdates(_0x54023b,_0x1c076e){return function(_0x381334){if(_0x381334){return _0x381334[_0x86a4('0x36')](_0x54023b)[_0x86a4('0x23')](function(_0x1b39a5){return _0x1b39a5;});}return null;};}function removeEntity(_0x4c8921,_0x75edc0){return function(_0x5d4740){if(_0x5d4740){return _0x5d4740[_0x86a4('0x37')]()[_0x86a4('0x23')](function(){_0x4c8921[_0x86a4('0x2e')](0xcc)[_0x86a4('0x38')]();});}};}function handleEntityNotFound(_0x279524,_0x43d7cb){return function(_0x1c5d51){if(!_0x1c5d51){_0x279524['sendStatus'](0x194);}return _0x1c5d51;};}function handleError(_0x30e4f8,_0x43b723){_0x43b723=_0x43b723||0x1f4;return function(_0x5134d2){logger[_0x86a4('0x28')](_0x5134d2['stack']);if(_0x5134d2[_0x86a4('0x39')]){delete _0x5134d2['name'];}_0x30e4f8['status'](_0x43b723)[_0x86a4('0x3a')](_0x5134d2);};}exports['index']=function(_0x3631bc,_0x38f7c3){var _0x3db9ca={},_0x46e5ee={},_0x4bb743={'count':0x0,'rows':[]};var _0x52a211=db['SmsMessage'][_0x86a4('0x3b')];_0x46e5ee[_0x86a4('0x3c')]=_[_0x86a4('0x3d')](_0x52a211);_0x46e5ee[_0x86a4('0x3e')]=_[_0x86a4('0x3d')](_0x3631bc[_0x86a4('0x3e')]);_0x46e5ee['filters']=_[_0x86a4('0x3f')](_0x46e5ee['model'],_0x46e5ee[_0x86a4('0x3e')]);_0x3db9ca[_0x86a4('0x40')]=_['intersection'](_0x46e5ee[_0x86a4('0x3c')],qs[_0x86a4('0x41')](_0x3631bc['query'][_0x86a4('0x41')]));_0x3db9ca[_0x86a4('0x40')]=_0x3db9ca['attributes']['length']?_0x3db9ca[_0x86a4('0x40')]:_0x46e5ee[_0x86a4('0x3c')];if(!_0x3631bc[_0x86a4('0x3e')]['hasOwnProperty'](_0x86a4('0x42'))){_0x3db9ca[_0x86a4('0x43')]=qs[_0x86a4('0x43')](_0x3631bc[_0x86a4('0x3e')][_0x86a4('0x43')]);_0x3db9ca[_0x86a4('0x31')]=qs[_0x86a4('0x31')](_0x3631bc['query'][_0x86a4('0x31')]);}_0x3db9ca['order']=qs['sort'](_0x3631bc[_0x86a4('0x3e')][_0x86a4('0x44')]);_0x3db9ca[_0x86a4('0x45')]=qs[_0x86a4('0x46')](_['pick'](_0x3631bc[_0x86a4('0x3e')],_0x46e5ee[_0x86a4('0x46')]));if(_0x3631bc[_0x86a4('0x3e')]['filter']){_0x3db9ca[_0x86a4('0x45')]=_[_0x86a4('0x47')](_0x3db9ca[_0x86a4('0x45')],{'$or':_[_0x86a4('0x48')](_0x52a211,function(_0x5b2f5f){if(_0x5b2f5f[_0x86a4('0x49')]['key']!==_0x86a4('0x4a')){var _0x268424={};_0x268424[_0x5b2f5f[_0x86a4('0x4b')]]={'$like':'%'+_0x3631bc[_0x86a4('0x3e')][_0x86a4('0x4c')]+'%'};return _0x268424;}})});}_0x3db9ca=_['merge']({},_0x3db9ca,_0x3631bc[_0x86a4('0x4d')]);var _0x345d88={'where':_0x3db9ca[_0x86a4('0x45')]};return db[_0x86a4('0x4e')][_0x86a4('0x30')](_0x345d88)[_0x86a4('0x23')](function(_0x2caa58){_0x4bb743['count']=_0x2caa58;if(_0x3631bc['query']['includeAll']){_0x3db9ca[_0x86a4('0x4f')]=[{'all':!![]}];}return db['SmsMessage'][_0x86a4('0x50')](_0x3db9ca);})[_0x86a4('0x23')](function(_0x5088c0){_0x4bb743[_0x86a4('0x51')]=_0x5088c0;return _0x4bb743;})[_0x86a4('0x23')](respondWithFilteredResult(_0x38f7c3,_0x3db9ca))['catch'](handleError(_0x38f7c3,null));};exports[_0x86a4('0x52')]=function(_0x30f102,_0x2b82bf){var _0x1c15d7={'raw':!![],'where':{'id':_0x30f102[_0x86a4('0x53')]['id']}},_0x1de520={};_0x1de520['model']=_['keys'](db[_0x86a4('0x4e')]['rawAttributes']);_0x1de520[_0x86a4('0x3e')]=_['keys'](_0x30f102[_0x86a4('0x3e')]);_0x1de520[_0x86a4('0x46')]=_[_0x86a4('0x3f')](_0x1de520[_0x86a4('0x3c')],_0x1de520[_0x86a4('0x3e')]);_0x1c15d7['attributes']=_[_0x86a4('0x3f')](_0x1de520[_0x86a4('0x3c')],qs['fields'](_0x30f102[_0x86a4('0x3e')]['fields']));_0x1c15d7[_0x86a4('0x40')]=_0x1c15d7[_0x86a4('0x40')]['length']?_0x1c15d7['attributes']:_0x1de520[_0x86a4('0x3c')];if(_0x30f102[_0x86a4('0x3e')][_0x86a4('0x54')]){_0x1c15d7[_0x86a4('0x4f')]=[{'all':!![]}];}_0x1c15d7=_[_0x86a4('0x47')]({},_0x1c15d7,_0x30f102[_0x86a4('0x4d')]);return db[_0x86a4('0x4e')][_0x86a4('0x55')](_0x1c15d7)[_0x86a4('0x23')](handleEntityNotFound(_0x2b82bf,null))[_0x86a4('0x23')](respondWithResult(_0x2b82bf,null))[_0x86a4('0x56')](handleError(_0x2b82bf,null));};exports[_0x86a4('0x57')]=function(_0x1edc47,_0x24513c){return db[_0x86a4('0x4e')][_0x86a4('0x57')](_0x1edc47[_0x86a4('0x58')],{})[_0x86a4('0x23')](respondWithResult(_0x24513c,0xc9))['catch'](handleError(_0x24513c,null));};exports[_0x86a4('0x36')]=function(_0x35f4e5,_0x7a9fbc){if(_0x35f4e5[_0x86a4('0x58')]['id']){delete _0x35f4e5['body']['id'];}return db[_0x86a4('0x4e')][_0x86a4('0x55')]({'where':{'id':_0x35f4e5['params']['id']}})[_0x86a4('0x23')](handleEntityNotFound(_0x7a9fbc,null))['then'](saveUpdates(_0x35f4e5['body'],null))['then'](respondWithResult(_0x7a9fbc,null))['catch'](handleError(_0x7a9fbc,null));};exports[_0x86a4('0x37')]=function(_0x167534,_0x37d149){return db[_0x86a4('0x4e')][_0x86a4('0x55')]({'where':{'id':_0x167534[_0x86a4('0x53')]['id']}})[_0x86a4('0x23')](handleEntityNotFound(_0x37d149,null))['then'](removeEntity(_0x37d149,null))['catch'](handleError(_0x37d149,null));};exports[_0x86a4('0x59')]=function(_0x7a459c,_0x425836){return db[_0x86a4('0x4e')]['describe']()[_0x86a4('0x23')](respondWithResult(_0x425836,null))[_0x86a4('0x56')](handleError(_0x425836,null));};var interaction_log=require(_0x86a4('0x13'))(_0x86a4('0x5a'));exports[_0x86a4('0x5b')]=function(_0x46751e,_0x54adc0,_0x13d392){var _0x5807fa={'channel':_0x86a4('0x5c')};if(_0x46751e[_0x86a4('0x58')]['id']){delete _0x46751e[_0x86a4('0x58')]['id'];}_0x46751e[_0x86a4('0x58')]['read']=!![];_0x46751e[_0x86a4('0x58')][_0x86a4('0x5d')]=moment()[_0x86a4('0x5e')](_0x86a4('0x5f'));_0x46751e[_0x86a4('0x58')][_0x86a4('0x60')]=_0x46751e['body'][_0x86a4('0x60')]||_0x46751e[_0x86a4('0x61')]['id'];return db['SmsMessage'][_0x86a4('0x55')]({'where':{'id':_0x46751e[_0x86a4('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x86a4('0x62')}]})['then'](handleEntityNotFound(_0x54adc0,null))[_0x86a4('0x23')](saveUpdates(_0x46751e['body'],null))[_0x86a4('0x23')](function(_0x6e29d4){if(_0x6e29d4){_0x5807fa[_0x86a4('0x2b')]=_0x6e29d4['get']({'plain':!![]});return db[_0x86a4('0x63')]['find']({'where':{'id':_0x6e29d4['SmsInteractionId']}});}return null;})[_0x86a4('0x23')](handleEntityNotFound(_0x54adc0,null))['then'](function(_0x44d40c){if(_0x44d40c){return _0x44d40c[_0x86a4('0x36')]({'UserId':_0x46751e[_0x86a4('0x58')][_0x86a4('0x60')],'read1stAt':_['isNil'](_0x44d40c[_0x86a4('0x64')])?moment()['format'](_0x86a4('0x5f')):undefined});}return null;})[_0x86a4('0x23')](function(_0x1bed6e){if(_0x1bed6e){_0x5807fa[_0x86a4('0x65')]=_0x1bed6e['get']({'plain':!![]});interaction_log[_0x86a4('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46751e[_0x86a4('0x61')]['id'],_0x46751e[_0x86a4('0x61')][_0x86a4('0x39')],_0x46751e[_0x86a4('0x61')][_0x86a4('0x66')],_0x5807fa['interaction']['id'],_0x46751e[_0x86a4('0x58')]?JSON[_0x86a4('0x67')](_0x46751e[_0x86a4('0x58')]):_0x86a4('0x68'));return respondWithRpcPromise(_0x86a4('0x69'),_0x86a4('0x6a'),_0x5807fa);}return null;})['then'](function(_0x5aa9a6){if(_0x5aa9a6){if(_0x46751e[_0x86a4('0x58')][_0x86a4('0x6b')]){_0x5807fa[_0x86a4('0x2b')]['interface']=util[_0x86a4('0x5e')]('SIP/%s',_0x46751e[_0x86a4('0x61')]['name']);_0x5807fa['message'][_0x86a4('0x6c')]=_0x5807fa[_0x86a4('0x6c')];_0x5807fa[_0x86a4('0x2b')][_0x86a4('0x6d')]='accept';return respondWithRpcPromise(_0x86a4('0x6e'),'EventManager',{'event':_0x86a4('0x6f'),'message':_0x5807fa[_0x86a4('0x2b')]},client9002)[_0x86a4('0x23')](function(){return _0x5807fa;});}return _0x5807fa;}return null;})[_0x86a4('0x23')](respondWithResult(_0x54adc0,null))[_0x86a4('0x56')](handleError(_0x54adc0,null));};var interaction_log=require(_0x86a4('0x13'))(_0x86a4('0x5a'));exports['reject']=function(_0x5352c1,_0x2139a1,_0x27a642){var _0x4016ac={'agent':{},'channel':_0x86a4('0x5c')};if(_0x5352c1[_0x86a4('0x58')]['id']){delete _0x5352c1[_0x86a4('0x58')]['id'];}_0x5352c1[_0x86a4('0x58')][_0x86a4('0x60')]=_0x5352c1[_0x86a4('0x58')][_0x86a4('0x60')]||_0x5352c1[_0x86a4('0x61')]['id'];_0x4016ac['agent']['id']=_0x5352c1[_0x86a4('0x58')][_0x86a4('0x60')];return db[_0x86a4('0x4e')]['find']({'where':{'id':_0x5352c1[_0x86a4('0x53')]['id'],'UserId':null}})[_0x86a4('0x23')](handleEntityNotFound(_0x2139a1,null))['then'](function(_0x44894b){if(_0x44894b){_0x4016ac[_0x86a4('0x2b')]=_0x44894b[_0x86a4('0x70')]({'plain':!![]});return db[_0x86a4('0x63')][_0x86a4('0x55')]({'where':{'id':_0x44894b[_0x86a4('0x71')]}});}return null;})['then'](handleEntityNotFound(_0x2139a1,null))['then'](function(_0x1a41b6){if(_0x1a41b6){_0x4016ac[_0x86a4('0x65')]=_0x1a41b6['get']({'plain':!![]});interaction_log['info'](_0x86a4('0x72'),_0x5352c1[_0x86a4('0x61')]['id'],_0x5352c1[_0x86a4('0x61')][_0x86a4('0x39')],_0x5352c1[_0x86a4('0x61')]['role'],_0x4016ac['interaction']['id'],_0x5352c1['body']?JSON['stringify'](_0x5352c1['body']):_0x86a4('0x68'));return respondWithRpcPromise(_0x86a4('0x73'),_0x86a4('0x74'),_0x4016ac);}return null;})[_0x86a4('0x23')](function(_0x2ceda1){if(_0x2ceda1){_0x2ceda1[_0x86a4('0x2b')][_0x86a4('0x75')]=util[_0x86a4('0x5e')]('SIP/%s',_0x5352c1[_0x86a4('0x61')][_0x86a4('0x39')]);_0x2ceda1[_0x86a4('0x2b')][_0x86a4('0x6c')]=_0x4016ac[_0x86a4('0x6c')];_0x2ceda1[_0x86a4('0x2b')]['event']=_0x86a4('0x34');respondWithRpcPromise(_0x86a4('0x6e'),_0x86a4('0x6e'),{'event':_0x86a4('0x76'),'message':_0x2ceda1[_0x86a4('0x2b')]},client9002);return _0x4016ac;}return null;})[_0x86a4('0x23')](respondWithResult(_0x2139a1,null))[_0x86a4('0x56')](handleError(_0x2139a1,null));};exports['status']=function(_0x2c08cb,_0x3a31ad,_0x320a8e){if(_0x2c08cb[_0x86a4('0x58')]['id']){delete _0x2c08cb[_0x86a4('0x58')]['id'];}var _0x4dc230;return db['SmsMessage'][_0x86a4('0x55')]({'where':{'id':_0x2c08cb[_0x86a4('0x53')]['id']}})['then'](handleEntityNotFound(_0x3a31ad,null))[_0x86a4('0x23')](function(_0x18cc48){if(_0x18cc48){_0x4dc230=_0x18cc48;return db[_0x86a4('0x77')][_0x86a4('0x55')]({'where':{'id':_0x18cc48['SmsAccountId']}});}})[_0x86a4('0x23')](handleEntityNotFound(_0x3a31ad,null))[_0x86a4('0x23')](function(_0x3282ae){if(_0x3282ae){logger['debug'](_0x86a4('0x27'),_0x86a4('0x2e'),_0x86a4('0x78'),_0x3282ae[_0x86a4('0x49')],util['inspect'](_0x2c08cb[_0x86a4('0x58')],{'showHidden':![],'depth':null}));switch(_0x3282ae[_0x86a4('0x49')]){case _0x86a4('0x79'):if(_0x2c08cb[_0x86a4('0x58')]['MessageSid']&&_0x2c08cb[_0x86a4('0x58')][_0x86a4('0x7a')]===_0x4dc230[_0x86a4('0x7b')]){return _0x4dc230[_0x86a4('0x36')]({'read':!![]});}else{logger[_0x86a4('0x28')](_0x86a4('0x7c'),_0x86a4('0x2e'),_0x86a4('0x79'),util[_0x86a4('0x7d')](_0x2c08cb[_0x86a4('0x58')],{'showHidden':![],'depth':null}));}break;case _0x86a4('0x7e'):if(_0x2c08cb[_0x86a4('0x58')]['MessageUUID']&&_0x2c08cb[_0x86a4('0x58')][_0x86a4('0x7f')]===_0x4dc230[_0x86a4('0x7b')]&&_[_0x86a4('0x80')]([_0x86a4('0x81'),_0x86a4('0x82')],_0x2c08cb[_0x86a4('0x58')][_0x86a4('0x83')])>=0x0){return _0x4dc230['update']({'read':!![]});}else{logger[_0x86a4('0x28')](_0x86a4('0x7c'),_0x86a4('0x2e'),_0x86a4('0x84'),util[_0x86a4('0x7d')](_0x2c08cb[_0x86a4('0x58')],{'showHidden':![],'depth':null}));}break;case _0x86a4('0x85'):var _0x4caee4=_0x2c08cb[_0x86a4('0x58')][_0x86a4('0x86')][0x0];if(_0x4caee4['status'][_0x86a4('0x87')]===_0x86a4('0x88')){return _0x4dc230[_0x86a4('0x36')]({'read':!![]});}else{logger[_0x86a4('0x28')](_0x86a4('0x7c'),_0x86a4('0x2e'),_0x86a4('0x85'),util[_0x86a4('0x7d')](_0x2c08cb[_0x86a4('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4dc230;}})[_0x86a4('0x23')](respondWithResult(_0x3a31ad,null))[_0x86a4('0x56')](handleError(_0x3a31ad,null));}; \ No newline at end of file +var _0x1fc1=['jsforce','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','destroy','stack','name','send','index','SmsMessage','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','field','count','includeAll','include','params','options','create','update','body','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','squel','crypto'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fc1,0x18f));var _0x11fc=function(_0x310bb5,_0x469aaf){_0x310bb5=_0x310bb5-0x0;var _0x1c2571=_0x1fc1[_0x310bb5];return _0x1c2571;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x11fc('0x0'));var rimraf=require(_0x11fc('0x1'));var zipdir=require(_0x11fc('0x2'));var jsonpatch=require(_0x11fc('0x3'));var rp=require(_0x11fc('0x4'));var moment=require(_0x11fc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x11fc('0x6'));var sox=require(_0x11fc('0x7'));var csv=require(_0x11fc('0x8'));var ejs=require(_0x11fc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x11fc('0xa'));var crypto=require(_0x11fc('0xb'));var jsforce=require(_0x11fc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x11fc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x11fc('0xd'));var qs=require(_0x11fc('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11fc('0xf'))(_0x11fc('0x10'));var utils=require(_0x11fc('0x11'));var config=require(_0x11fc('0x12'));var db=require(_0x11fc('0x13'))['db'];config[_0x11fc('0x14')]=_[_0x11fc('0x15')](config[_0x11fc('0x14')],{'host':_0x11fc('0x16'),'port':0x18eb});var socket=require(_0x11fc('0x17'))(new Redis(config['redis']));require(_0x11fc('0x18'))[_0x11fc('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x11fc('0x1a')][_0x11fc('0x1b')]({'port':0x232c});var client9002=jayson[_0x11fc('0x1a')][_0x11fc('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4aac6b,_0x1abb9a,_0xe5d8c8){if(_0xe5d8c8){var _0x532ea7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x532ea7[_0x11fc('0x1c')](_0x1abb9a)){return _0x4aac6b;}else{throw new db[(_0x11fc('0x1d'))]['ValidationError'](_0x11fc('0x1e'));}}else{return _0x4aac6b;}}function respondWithRpcPromise(_0x270e87,_0x4e30ee,_0x1ebd92,_0x4c1537){return new BPromise(function(_0x5da396,_0x66186f){var _0x13805a=_0x4c1537||client;return _0x13805a['request'](_0x270e87,_0x1ebd92)[_0x11fc('0x1f')](function(_0x2be20a){logger['info'](_0x11fc('0x20'),_0x4e30ee,_0x11fc('0x21'));logger['debug'](_0x11fc('0x22'),_0x4e30ee,_0x11fc('0x21'),JSON[_0x11fc('0x23')](_0x2be20a));if(_0x2be20a['error']){if(_0x2be20a['error'][_0x11fc('0x24')]===0x1f4){logger[_0x11fc('0x25')]('SmsMessage,\x20%s,\x20%s',_0x4e30ee,_0x2be20a['error'][_0x11fc('0x26')]);return _0x66186f(_0x2be20a[_0x11fc('0x25')][_0x11fc('0x26')]);}logger[_0x11fc('0x25')](_0x11fc('0x20'),_0x4e30ee,_0x2be20a['error'][_0x11fc('0x26')]);return _0x5da396(_0x2be20a[_0x11fc('0x25')]['message']);}else{logger[_0x11fc('0x27')](_0x11fc('0x20'),_0x4e30ee,_0x11fc('0x21'));_0x5da396(_0x2be20a[_0x11fc('0x28')][_0x11fc('0x26')]);}})[_0x11fc('0x29')](function(_0xa4420e){logger[_0x11fc('0x25')](_0x11fc('0x20'),_0x4e30ee,_0xa4420e);_0x66186f(_0xa4420e);});});}function respondWithStatusCode(_0x7d25dd,_0x48ac8a){_0x48ac8a=_0x48ac8a||0xcc;return function(_0x28d512){if(_0x28d512){return _0x7d25dd[_0x11fc('0x2a')](_0x48ac8a);}return _0x7d25dd[_0x11fc('0x2b')](_0x48ac8a)[_0x11fc('0x2c')]();};}function respondWithResult(_0x34763c,_0x114592){_0x114592=_0x114592||0xc8;return function(_0x14d465){if(_0x14d465){return _0x34763c[_0x11fc('0x2b')](_0x114592)['json'](_0x14d465);}};}function respondWithFilteredResult(_0x4905eb,_0x2f2026){return function(_0x5ec235){if(_0x5ec235){var _0x1b67be=_0x5ec235['count'],_0x1489ac=_0x2f2026[_0x11fc('0x2d')],_0x6d3079=_0x2f2026[_0x11fc('0x2d')]+_0x2f2026[_0x11fc('0x2e')],_0x1ab7cf;if(_0x6d3079>=_0x1b67be){_0x6d3079=_0x1b67be;_0x1ab7cf=0xc8;}else{_0x1ab7cf=0xce;}_0x4905eb[_0x11fc('0x2b')](_0x1ab7cf);return _0x4905eb[_0x11fc('0x2f')](_0x11fc('0x30'),_0x1489ac+'-'+_0x6d3079+'/'+_0x1b67be)[_0x11fc('0x31')](_0x5ec235);}return null;};}function patchUpdates(_0x2ead7f){return function(_0x590315){try{jsonpatch['apply'](_0x590315,_0x2ead7f,!![]);}catch(_0xfb5ade){return BPromise[_0x11fc('0x32')](_0xfb5ade);}return _0x590315[_0x11fc('0x33')]();};}function saveUpdates(_0x2f7580,_0xb8b393){return function(_0x17a561){if(_0x17a561){return _0x17a561['update'](_0x2f7580)['then'](function(_0x2ca871){return _0x2ca871;});}return null;};}function removeEntity(_0x5bb8b7,_0x121eb){return function(_0x3c2ece){if(_0x3c2ece){return _0x3c2ece[_0x11fc('0x34')]()[_0x11fc('0x1f')](function(){_0x5bb8b7[_0x11fc('0x2b')](0xcc)[_0x11fc('0x2c')]();});}};}function handleEntityNotFound(_0x9b0b22,_0x2cf7b4){return function(_0x3b8c95){if(!_0x3b8c95){_0x9b0b22[_0x11fc('0x2a')](0x194);}return _0x3b8c95;};}function handleError(_0x3bd483,_0x4cb364){_0x4cb364=_0x4cb364||0x1f4;return function(_0xf30ddd){logger[_0x11fc('0x25')](_0xf30ddd[_0x11fc('0x35')]);if(_0xf30ddd[_0x11fc('0x36')]){delete _0xf30ddd['name'];}_0x3bd483[_0x11fc('0x2b')](_0x4cb364)[_0x11fc('0x37')](_0xf30ddd);};}exports[_0x11fc('0x38')]=function(_0x531ec4,_0x4a2140){var _0x1df5aa={},_0x431723={},_0x2cb948={'count':0x0,'rows':[]};var _0x2d9868=db[_0x11fc('0x39')][_0x11fc('0x3a')];_0x431723[_0x11fc('0x3b')]=_[_0x11fc('0x3c')](_0x2d9868);_0x431723[_0x11fc('0x3d')]=_[_0x11fc('0x3c')](_0x531ec4[_0x11fc('0x3d')]);_0x431723[_0x11fc('0x3e')]=_[_0x11fc('0x3f')](_0x431723[_0x11fc('0x3b')],_0x431723[_0x11fc('0x3d')]);_0x1df5aa['attributes']=_['intersection'](_0x431723[_0x11fc('0x3b')],qs[_0x11fc('0x40')](_0x531ec4[_0x11fc('0x3d')][_0x11fc('0x40')]));_0x1df5aa[_0x11fc('0x41')]=_0x1df5aa[_0x11fc('0x41')][_0x11fc('0x42')]?_0x1df5aa['attributes']:_0x431723['model'];if(!_0x531ec4[_0x11fc('0x3d')][_0x11fc('0x43')](_0x11fc('0x44'))){_0x1df5aa[_0x11fc('0x2e')]=qs['limit'](_0x531ec4[_0x11fc('0x3d')]['limit']);_0x1df5aa[_0x11fc('0x2d')]=qs['offset'](_0x531ec4[_0x11fc('0x3d')][_0x11fc('0x2d')]);}_0x1df5aa[_0x11fc('0x45')]=qs[_0x11fc('0x46')](_0x531ec4[_0x11fc('0x3d')][_0x11fc('0x46')]);_0x1df5aa[_0x11fc('0x47')]=qs[_0x11fc('0x3e')](_[_0x11fc('0x48')](_0x531ec4[_0x11fc('0x3d')],_0x431723[_0x11fc('0x3e')]));if(_0x531ec4['query'][_0x11fc('0x49')]){_0x1df5aa[_0x11fc('0x47')]=_[_0x11fc('0x4a')](_0x1df5aa['where'],{'$or':_[_0x11fc('0x4b')](_0x2d9868,function(_0xc1ed74){if(_0xc1ed74[_0x11fc('0x4c')]['key']!=='VIRTUAL'){var _0xc42b45={};_0xc42b45[_0xc1ed74[_0x11fc('0x4d')]]={'$like':'%'+_0x531ec4[_0x11fc('0x3d')][_0x11fc('0x49')]+'%'};return _0xc42b45;}})});}_0x1df5aa=_[_0x11fc('0x4a')]({},_0x1df5aa,_0x531ec4['options']);var _0x9f8a13={'where':_0x1df5aa['where']};return db[_0x11fc('0x39')][_0x11fc('0x4e')](_0x9f8a13)[_0x11fc('0x1f')](function(_0x3f03c2){_0x2cb948[_0x11fc('0x4e')]=_0x3f03c2;if(_0x531ec4[_0x11fc('0x3d')][_0x11fc('0x4f')]){_0x1df5aa[_0x11fc('0x50')]=[{'all':!![]}];}return db[_0x11fc('0x39')]['findAll'](_0x1df5aa);})[_0x11fc('0x1f')](function(_0x269546){_0x2cb948['rows']=_0x269546;return _0x2cb948;})[_0x11fc('0x1f')](respondWithFilteredResult(_0x4a2140,_0x1df5aa))[_0x11fc('0x29')](handleError(_0x4a2140,null));};exports['show']=function(_0x3469e9,_0x3a6053){var _0x514533={'raw':!![],'where':{'id':_0x3469e9[_0x11fc('0x51')]['id']}},_0x221c64={};_0x221c64['model']=_[_0x11fc('0x3c')](db['SmsMessage']['rawAttributes']);_0x221c64[_0x11fc('0x3d')]=_[_0x11fc('0x3c')](_0x3469e9[_0x11fc('0x3d')]);_0x221c64[_0x11fc('0x3e')]=_[_0x11fc('0x3f')](_0x221c64[_0x11fc('0x3b')],_0x221c64[_0x11fc('0x3d')]);_0x514533[_0x11fc('0x41')]=_['intersection'](_0x221c64[_0x11fc('0x3b')],qs['fields'](_0x3469e9[_0x11fc('0x3d')]['fields']));_0x514533[_0x11fc('0x41')]=_0x514533['attributes']['length']?_0x514533[_0x11fc('0x41')]:_0x221c64[_0x11fc('0x3b')];if(_0x3469e9[_0x11fc('0x3d')][_0x11fc('0x4f')]){_0x514533[_0x11fc('0x50')]=[{'all':!![]}];}_0x514533=_['merge']({},_0x514533,_0x3469e9[_0x11fc('0x52')]);return db[_0x11fc('0x39')]['find'](_0x514533)[_0x11fc('0x1f')](handleEntityNotFound(_0x3a6053,null))[_0x11fc('0x1f')](respondWithResult(_0x3a6053,null))[_0x11fc('0x29')](handleError(_0x3a6053,null));};exports[_0x11fc('0x53')]=function(_0x3202f0,_0x18332e){return db['SmsMessage']['create'](_0x3202f0['body'],{})[_0x11fc('0x1f')](respondWithResult(_0x18332e,0xc9))[_0x11fc('0x29')](handleError(_0x18332e,null));};exports[_0x11fc('0x54')]=function(_0x19759b,_0x43e975){if(_0x19759b[_0x11fc('0x55')]['id']){delete _0x19759b[_0x11fc('0x55')]['id'];}return db[_0x11fc('0x39')][_0x11fc('0x56')]({'where':{'id':_0x19759b[_0x11fc('0x51')]['id']}})[_0x11fc('0x1f')](handleEntityNotFound(_0x43e975,null))['then'](saveUpdates(_0x19759b[_0x11fc('0x55')],null))[_0x11fc('0x1f')](respondWithResult(_0x43e975,null))['catch'](handleError(_0x43e975,null));};exports[_0x11fc('0x34')]=function(_0x23c641,_0x7f3186){return db[_0x11fc('0x39')][_0x11fc('0x56')]({'where':{'id':_0x23c641[_0x11fc('0x51')]['id']}})[_0x11fc('0x1f')](handleEntityNotFound(_0x7f3186,null))[_0x11fc('0x1f')](removeEntity(_0x7f3186,null))[_0x11fc('0x29')](handleError(_0x7f3186,null));};exports[_0x11fc('0x57')]=function(_0x31d902,_0x20daf6){return db[_0x11fc('0x39')][_0x11fc('0x57')]()['then'](respondWithResult(_0x20daf6,null))[_0x11fc('0x29')](handleError(_0x20daf6,null));};var interaction_log=require(_0x11fc('0xf'))(_0x11fc('0x58'));exports[_0x11fc('0x59')]=function(_0x276aac,_0x491128,_0x3cea39){var _0x48a07d={'channel':_0x11fc('0x5a')};if(_0x276aac[_0x11fc('0x55')]['id']){delete _0x276aac[_0x11fc('0x55')]['id'];}_0x276aac['body'][_0x11fc('0x5b')]=!![];_0x276aac[_0x11fc('0x55')][_0x11fc('0x5c')]=moment()[_0x11fc('0x5d')](_0x11fc('0x5e'));_0x276aac[_0x11fc('0x55')]['UserId']=_0x276aac[_0x11fc('0x55')][_0x11fc('0x5f')]||_0x276aac[_0x11fc('0x60')]['id'];return db[_0x11fc('0x39')][_0x11fc('0x56')]({'where':{'id':_0x276aac[_0x11fc('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x11fc('0x61')],'as':_0x11fc('0x62')}]})['then'](handleEntityNotFound(_0x491128,null))[_0x11fc('0x1f')](saveUpdates(_0x276aac[_0x11fc('0x55')],null))[_0x11fc('0x1f')](function(_0x150e5b){if(_0x150e5b){_0x48a07d[_0x11fc('0x26')]=_0x150e5b[_0x11fc('0x63')]({'plain':!![]});return db[_0x11fc('0x64')]['find']({'where':{'id':_0x150e5b[_0x11fc('0x65')]}});}return null;})[_0x11fc('0x1f')](handleEntityNotFound(_0x491128,null))['then'](function(_0x1c2db3){if(_0x1c2db3){return _0x1c2db3[_0x11fc('0x54')]({'UserId':_0x276aac[_0x11fc('0x55')][_0x11fc('0x5f')],'read1stAt':_[_0x11fc('0x66')](_0x1c2db3[_0x11fc('0x67')])?moment()[_0x11fc('0x5d')](_0x11fc('0x5e')):undefined});}return null;})[_0x11fc('0x1f')](function(_0x9fc5fe){if(_0x9fc5fe){_0x48a07d[_0x11fc('0x68')]=_0x9fc5fe[_0x11fc('0x63')]({'plain':!![]});interaction_log[_0x11fc('0x27')](_0x11fc('0x69'),_0x276aac['user']['id'],_0x276aac[_0x11fc('0x60')]['name'],_0x276aac[_0x11fc('0x60')][_0x11fc('0x6a')],_0x48a07d[_0x11fc('0x68')]['id'],_0x276aac['body']?JSON[_0x11fc('0x23')](_0x276aac[_0x11fc('0x55')]):'null');return respondWithRpcPromise(_0x11fc('0x6b'),_0x11fc('0x6c'),_0x48a07d);}return null;})[_0x11fc('0x1f')](function(_0x37a123){if(_0x37a123){if(_0x276aac[_0x11fc('0x55')][_0x11fc('0x6d')]){_0x48a07d[_0x11fc('0x26')][_0x11fc('0x6e')]=util[_0x11fc('0x5d')](_0x11fc('0x6f'),_0x276aac[_0x11fc('0x60')][_0x11fc('0x36')]);_0x48a07d[_0x11fc('0x26')][_0x11fc('0x70')]=_0x48a07d[_0x11fc('0x70')];_0x48a07d[_0x11fc('0x26')]['event']='accept';return respondWithRpcPromise(_0x11fc('0x71'),_0x11fc('0x71'),{'event':_0x11fc('0x72'),'message':_0x48a07d[_0x11fc('0x26')]},client9002)[_0x11fc('0x1f')](function(){return _0x48a07d;});}return _0x48a07d;}return null;})[_0x11fc('0x1f')](respondWithResult(_0x491128,null))[_0x11fc('0x29')](handleError(_0x491128,null));};var interaction_log=require(_0x11fc('0xf'))('sms-interactions');exports[_0x11fc('0x32')]=function(_0x56d5a1,_0x55d8ac,_0x11d2a6){var _0x7d8ca4={'agent':{},'channel':'sms'};if(_0x56d5a1['body']['id']){delete _0x56d5a1[_0x11fc('0x55')]['id'];}_0x56d5a1['body'][_0x11fc('0x5f')]=_0x56d5a1[_0x11fc('0x55')][_0x11fc('0x5f')]||_0x56d5a1['user']['id'];_0x7d8ca4[_0x11fc('0x73')]['id']=_0x56d5a1['body']['UserId'];return db[_0x11fc('0x39')]['find']({'where':{'id':_0x56d5a1[_0x11fc('0x51')]['id'],'UserId':null}})[_0x11fc('0x1f')](handleEntityNotFound(_0x55d8ac,null))[_0x11fc('0x1f')](function(_0x423b9b){if(_0x423b9b){_0x7d8ca4[_0x11fc('0x26')]=_0x423b9b[_0x11fc('0x63')]({'plain':!![]});return db[_0x11fc('0x64')][_0x11fc('0x56')]({'where':{'id':_0x423b9b[_0x11fc('0x65')]}});}return null;})[_0x11fc('0x1f')](handleEntityNotFound(_0x55d8ac,null))[_0x11fc('0x1f')](function(_0x24d398){if(_0x24d398){_0x7d8ca4[_0x11fc('0x68')]=_0x24d398[_0x11fc('0x63')]({'plain':!![]});interaction_log[_0x11fc('0x27')](_0x11fc('0x74'),_0x56d5a1[_0x11fc('0x60')]['id'],_0x56d5a1[_0x11fc('0x60')]['name'],_0x56d5a1[_0x11fc('0x60')][_0x11fc('0x6a')],_0x7d8ca4[_0x11fc('0x68')]['id'],_0x56d5a1[_0x11fc('0x55')]?JSON[_0x11fc('0x23')](_0x56d5a1[_0x11fc('0x55')]):_0x11fc('0x75'));return respondWithRpcPromise(_0x11fc('0x76'),'rejectMessage',_0x7d8ca4);}return null;})[_0x11fc('0x1f')](function(_0x3b272f){if(_0x3b272f){_0x3b272f[_0x11fc('0x26')][_0x11fc('0x6e')]=util[_0x11fc('0x5d')]('SIP/%s',_0x56d5a1[_0x11fc('0x60')]['name']);_0x3b272f[_0x11fc('0x26')][_0x11fc('0x70')]=_0x7d8ca4['channel'];_0x3b272f[_0x11fc('0x26')]['event']=_0x11fc('0x32');respondWithRpcPromise(_0x11fc('0x71'),_0x11fc('0x71'),{'event':_0x11fc('0x77'),'message':_0x3b272f[_0x11fc('0x26')]},client9002);return _0x7d8ca4;}return null;})[_0x11fc('0x1f')](respondWithResult(_0x55d8ac,null))['catch'](handleError(_0x55d8ac,null));};exports[_0x11fc('0x2b')]=function(_0x2e87ed,_0x532f26,_0x11d436){if(_0x2e87ed[_0x11fc('0x55')]['id']){delete _0x2e87ed[_0x11fc('0x55')]['id'];}var _0x389a10;return db[_0x11fc('0x39')][_0x11fc('0x56')]({'where':{'id':_0x2e87ed['params']['id']}})[_0x11fc('0x1f')](handleEntityNotFound(_0x532f26,null))[_0x11fc('0x1f')](function(_0x19b73a){if(_0x19b73a){_0x389a10=_0x19b73a;return db[_0x11fc('0x78')]['find']({'where':{'id':_0x19b73a[_0x11fc('0x79')]}});}})[_0x11fc('0x1f')](handleEntityNotFound(_0x532f26,null))[_0x11fc('0x1f')](function(_0x529cbd){if(_0x529cbd){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x11fc('0x2b'),_0x11fc('0x7a'),_0x529cbd[_0x11fc('0x4c')],util[_0x11fc('0x7b')](_0x2e87ed[_0x11fc('0x55')],{'showHidden':![],'depth':null}));switch(_0x529cbd[_0x11fc('0x4c')]){case _0x11fc('0x7c'):if(_0x2e87ed[_0x11fc('0x55')][_0x11fc('0x7d')]&&_0x2e87ed[_0x11fc('0x55')][_0x11fc('0x7d')]===_0x389a10['messageId']){return _0x389a10[_0x11fc('0x54')]({'read':!![]});}else{logger[_0x11fc('0x25')](_0x11fc('0x7e'),_0x11fc('0x2b'),_0x11fc('0x7c'),util[_0x11fc('0x7b')](_0x2e87ed[_0x11fc('0x55')],{'showHidden':![],'depth':null}));}break;case _0x11fc('0x7f'):if(_0x2e87ed[_0x11fc('0x55')][_0x11fc('0x80')]&&_0x2e87ed[_0x11fc('0x55')][_0x11fc('0x80')]===_0x389a10[_0x11fc('0x81')]&&_[_0x11fc('0x82')]([_0x11fc('0x83'),_0x11fc('0x84')],_0x2e87ed['body']['Status'])>=0x0){return _0x389a10[_0x11fc('0x54')]({'read':!![]});}else{logger[_0x11fc('0x25')](_0x11fc('0x7e'),_0x11fc('0x2b'),_0x11fc('0x85'),util[_0x11fc('0x7b')](_0x2e87ed['body'],{'showHidden':![],'depth':null}));}break;case _0x11fc('0x86'):var _0xadbe93=_0x2e87ed[_0x11fc('0x55')][_0x11fc('0x87')][0x0];if(_0xadbe93[_0x11fc('0x2b')][_0x11fc('0x88')]==='DELIVERED'){return _0x389a10[_0x11fc('0x54')]({'read':!![]});}else{logger[_0x11fc('0x25')](_0x11fc('0x7e'),_0x11fc('0x2b'),_0x11fc('0x86'),util[_0x11fc('0x7b')](_0x2e87ed[_0x11fc('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x389a10;}})[_0x11fc('0x1f')](respondWithResult(_0x532f26,null))[_0x11fc('0x29')](handleError(_0x532f26,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index dc7be2b..fb1bcda 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 _0x1db4=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x22cb5f,_0x2cdd63){var _0x274d36=function(_0x421472){while(--_0x421472){_0x22cb5f['push'](_0x22cb5f['shift']());}};_0x274d36(++_0x2cdd63);}(_0x1db4,0xae));var _0x41db=function(_0x20263b,_0x30a6d2){_0x20263b=_0x20263b-0x0;var _0x194e43=_0x1db4[_0x20263b];return _0x194e43;};'use strict';var EventEmitter=require(_0x41db('0x0'));var SmsMessage=require(_0x41db('0x1'))['db'][_0x41db('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x41db('0x3')](0x0);var events={'afterCreate':_0x41db('0x4'),'afterUpdate':_0x41db('0x5'),'afterDestroy':_0x41db('0x6')};function emitEvent(_0x361e6c){return function(_0x46675f,_0x469a5f,_0x519a7a){SmsMessageEvents[_0x41db('0x7')](_0x361e6c+':'+_0x46675f['id'],_0x46675f);SmsMessageEvents[_0x41db('0x7')](_0x361e6c,_0x46675f);_0x519a7a(null);};}for(var e in events){if(events[_0x41db('0x8')](e)){var event=events[e];SmsMessage[_0x41db('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x7725=['update','remove','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7725,0x6c));var _0x5772=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7725[_0x92c450];return _0x2a9599;};'use strict';var EventEmitter=require(_0x5772('0x0'));var SmsMessage=require(_0x5772('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5772('0x2')](0x0);var events={'afterCreate':_0x5772('0x3'),'afterUpdate':_0x5772('0x4'),'afterDestroy':_0x5772('0x5')};function emitEvent(_0x581c32){return function(_0x2c02eb,_0x3529a7,_0x2377f5){SmsMessageEvents['emit'](_0x581c32+':'+_0x2c02eb['id'],_0x2c02eb);SmsMessageEvents['emit'](_0x581c32,_0x2c02eb);_0x2377f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x5772('0x6')](e,emitEvent(event));}}module[_0x5772('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4cac769..08e26f8 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 _0x9da5=['clickatell','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','intelepeer','Token\x20not\x20received','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','out','SmsAccount','find','SmsAccountId','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','password','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','login','text','timestamp','sort','length','apiKey','createHash','digest','hex','signature=','https://sms.csc.lv/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9da5,0x85));var _0x59da=function(_0x232e7a,_0x19997){_0x232e7a=_0x232e7a-0x0;var _0x445ddd=_0x9da5[_0x232e7a];return _0x445ddd;};'use strict';var _=require(_0x59da('0x0'));var util=require('util');var logger=require(_0x59da('0x1'))(_0x59da('0x2'));var moment=require(_0x59da('0x3'));var BPromise=require(_0x59da('0x4'));var rp=require(_0x59da('0x5'));var fs=require('fs');var path=require(_0x59da('0x6'));var rimraf=require('rimraf');var config=require(_0x59da('0x7'));var attributes=require(_0x59da('0x8'));module['exports']=function(_0x5d9771,_0x1af415){return _0x5d9771[_0x59da('0x9')](_0x59da('0xa'),attributes,{'tableName':_0x59da('0xb'),'paranoid':![],'indexes':[{'name':_0x59da('0xc'),'fields':[_0x59da('0xc')]},{'name':'fti_sms_messages','fields':[_0x59da('0xd')],'type':_0x59da('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4db53e,_0x58dd08,_0x2a0521){var _0x3f4f72=_0x5d9771['models'];var _0x4ca643=_0x4db53e[_0x59da('0xf')]({'plain':!![]});if(_0x4ca643[_0x59da('0x10')][_0x59da('0x11')]()==='in'||_0x4ca643[_0x59da('0x10')][_0x59da('0x11')]()==='out'&&!_0x4ca643[_0x59da('0x12')]&&!_[_0x59da('0x13')](_0x4ca643[_0x59da('0x14')])){_0x3f4f72[_0x59da('0x15')][_0x59da('0x16')]({'where':{'id':_0x4ca643[_0x59da('0x17')]}})[_0x59da('0x18')](function(_0x390048){if(_0x390048){_0x390048[_0x59da('0x19')]({'lastMsgAt':_0x4ca643[_0x59da('0x1a')],'lastMsgDirection':_0x4ca643[_0x59da('0x10')][_0x59da('0x11')]()});}})[_0x59da('0x1b')](function(_0x24592e){console['error'](_0x24592e);});}if(_0x4ca643[_0x59da('0x10')]===_0x59da('0x1c')&&!_0x4ca643[_0x59da('0x12')]){var _0x3723f0;_0x3f4f72[_0x59da('0x1d')][_0x59da('0x1e')]({'where':{'id':_0x4ca643[_0x59da('0x1f')]},'raw':!![]})['then'](function(_0x32d1d9){_0x3723f0=_0x32d1d9;if(_0x3723f0&&_0x3723f0['type']){switch(_0x3723f0['type']){case _0x59da('0x20'):var _0x294ae2=require(_0x59da('0x20'));if(_0x3723f0[_0x59da('0x21')]&&_0x3723f0[_0x59da('0x22')]&&_0x3723f0[_0x59da('0x23')]){var _0x525b75=new _0x294ae2(_0x3723f0[_0x59da('0x21')],_0x3723f0[_0x59da('0x22')]);_0x525b75[_0x59da('0x24')][_0x59da('0x25')]({'body':_0x4ca643[_0x59da('0xd')],'to':_0x4ca643['phone'],'from':_0x3723f0[_0x59da('0x23')],'statusCallback':_0x3723f0[_0x59da('0x26')]+_0x59da('0x27')+_0x4ca643['id']+_0x59da('0x28')+_0x3723f0['token']})['then'](function(_0x5ead19){if(_0x5ead19[_0x59da('0x29')]){return _0x4db53e['update']({'messageId':_0x5ead19[_0x59da('0x29')]});}})[_0x59da('0x1b')](function(_0x28f78f){logger[_0x59da('0x2a')](_0x59da('0x2b'),'afterCreate',_0x59da('0x20'),util[_0x59da('0x2c')](_0x28f78f,{'showHidden':![],'depth':null}));});}else{logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x20'),_0x59da('0x2e'));}break;case _0x59da('0x2f'):var _0x2eb54b=_0x59da('0x30');if(_0x3723f0[_0x59da('0x31')]&&_0x3723f0['password']){var _0x14e1a8={'recipient':[_0x4ca643[_0x59da('0x23')]],'message':_0x4ca643[_0x59da('0xd')],'message_type':_0x3723f0[_0x59da('0x32')]};if(_0x3723f0['smsMethod']&&_0x3723f0['smsMethod']!=='SI'){_0x14e1a8[_0x59da('0x33')]=_0x3723f0[_0x59da('0x23')];}var _0x5889fb={'url':_0x2eb54b+_0x59da('0x34')+_0x3723f0[_0x59da('0x31')]+_0x59da('0x35')+_0x3723f0['password'],'method':_0x59da('0x36')};rp(_0x5889fb)['then'](function(_0x2c3457){var _0x406a71=_0x2c3457[_0x59da('0x37')](';');var _0x37b494={'user_key':_0x406a71[0x0],'session_key':_0x406a71[0x1]};_0x5889fb={'url':_0x2eb54b+_0x59da('0x38'),'method':_0x59da('0x39'),'headers':{'user_key':_0x37b494[_0x59da('0x3a')],'Session_key':_0x37b494[_0x59da('0x3b')]},'json':!![],'body':_0x14e1a8};return rp(_0x5889fb);})[_0x59da('0x18')](function(_0x2bc4e7){if(_0x2bc4e7[_0x59da('0x3c')]>=0x1){var _0x1f343d={'messageId':_0x2bc4e7[_0x59da('0x3d')]};if(_0x3723f0[_0x59da('0x32')]!=='GP'||!_0x3723f0[_0x59da('0x3e')]){_0x1f343d['read']=!![];}return _0x4db53e[_0x59da('0x19')](_0x1f343d);}else{return logger['error'](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x2f'),util[_0x59da('0x2c')](_0x2bc4e7,{'showHidden':![],'depth':null}));}})[_0x59da('0x1b')](function(_0x2c43d0){return logger[_0x59da('0x2a')](_0x59da('0x2b'),'afterCreate','skebby',util[_0x59da('0x2c')](_0x2c43d0,{'showHidden':![],'depth':null}));});}else{logger[_0x59da('0x2a')](_0x59da('0x2b'),'afterCreate',_0x59da('0x2f'),_0x59da('0x3f'));}break;case _0x59da('0x40'):if(_0x3723f0[_0x59da('0x22')]){var _0x3f5b0c={'recipient':_0x4ca643['phone'],'message':_0x4ca643[_0x59da('0xd')],'sender':_0x3723f0['senderString']||_0x3723f0[_0x59da('0x23')],'authorization':_0x3723f0['authToken']};var _0x58dd08={'method':_0x59da('0x39'),'uri':_0x59da('0x41'),'body':_0x3f5b0c,'json':!![]};rp(_0x58dd08)[_0x59da('0x18')](function(_0x5c5a20){var _0x4fd3b2={'messageId':_0x5c5a20[_0x59da('0x42')]};if(!_0x3723f0[_0x59da('0x3e')]){_0x4fd3b2[_0x59da('0x43')]=!![];}return _0x4db53e['update'](_0x4fd3b2);})[_0x59da('0x1b')](function(_0x4a178d){logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x40'),util['inspect'](_0x4a178d,{'showHidden':![],'depth':null}));});}else{logger[_0x59da('0x2a')](_0x59da('0x2b'),'afterCreate',_0x59da('0x40'),_0x59da('0x44'));}break;case _0x59da('0x45'):if(_0x3723f0[_0x59da('0x31')]&&_0x3723f0[_0x59da('0x46')]){var _0x3f5b0c={'messages':[{'source':'xCALLY\x20Motion','to':_0x4ca643[_0x59da('0x23')],'body':_0x4ca643['body'],'from':_0x3723f0[_0x59da('0x47')]||_0x3723f0[_0x59da('0x23')]}]};var _0xca5988=util[_0x59da('0x48')](_0x59da('0x49'),_0x3723f0[_0x59da('0x31')],_0x3723f0[_0x59da('0x46')]);var _0x58dd08={'method':_0x59da('0x39'),'uri':_0x59da('0x4a'),'body':_0x3f5b0c,'headers':{'Authorization':util['format'](_0x59da('0x4b'),new Buffer(_0xca5988)[_0x59da('0x4c')]('base64'))},'json':!![]};rp(_0x58dd08)['then'](function(_0x27e2f3){if(_0x27e2f3[_0x59da('0x4d')]>=0xc8&&_0x27e2f3[_0x59da('0x4d')]<=0xce){if(_0x27e2f3[_0x59da('0x4e')]&&_0x27e2f3[_0x59da('0x4e')][_0x59da('0x4f')]>0x0){var _0x485048=_[_0x59da('0x50')](_0x27e2f3[_0x59da('0x4e')][_0x59da('0x24')]);var _0x2adfeb={'messageId':_0x485048[_0x59da('0x51')]};if(!_0x3723f0[_0x59da('0x3e')]){_0x2adfeb['read']=!![];}return _0x4db53e[_0x59da('0x19')](_0x2adfeb);}else{logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x52'),util[_0x59da('0x2c')](_0x27e2f3,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59da('0x2d'),_0x59da('0x52'),util[_0x59da('0x2c')](_0x27e2f3,{'showHidden':![],'depth':null}));}})[_0x59da('0x1b')](function(_0xcb5dde){logger[_0x59da('0x2a')](_0x59da('0x2b'),'afterCreate',_0x59da('0x52'),util[_0x59da('0x2c')](_0xcb5dde,{'showHidden':![],'depth':null}));});}else{logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x59da('0x53'):if(_0x3723f0[_0x59da('0x54')]&&_0x3723f0['authToken']){var _0x3f5b0c={'dst':_0x4ca643[_0x59da('0x23')],'text':_0x4ca643['body'],'src':_0x3723f0[_0x59da('0x47')]||_0x3723f0[_0x59da('0x23')],'url':_0x3723f0[_0x59da('0x26')]+'/api/sms/messages/'+_0x4ca643['id']+_0x59da('0x28')+_0x3723f0['token']};var _0xca5988=util['format'](_0x59da('0x49'),_0x3723f0[_0x59da('0x54')],_0x3723f0[_0x59da('0x22')]);var _0x58dd08={'method':_0x59da('0x39'),'uri':util[_0x59da('0x48')](_0x59da('0x55'),_0x3723f0[_0x59da('0x54')]),'body':_0x3f5b0c,'headers':{'Authorization':util[_0x59da('0x48')]('Basic\x20%s',new Buffer(_0xca5988)[_0x59da('0x4c')](_0x59da('0x56')))},'json':!![]};rp(_0x58dd08)[_0x59da('0x18')](function(_0x3a118b){var _0x3fe9b9={'messageId':_0x3a118b[_0x59da('0x57')][0x0]};return _0x4db53e[_0x59da('0x19')](_0x3fe9b9);})[_0x59da('0x1b')](function(_0x44d534){logger[_0x59da('0x2a')](_0x59da('0x2b'),'afterCreate','plivo',util['inspect'](_0x44d534,{'showHidden':![],'depth':null}));});}else{logger[_0x59da('0x2a')](_0x59da('0x2b'),'afterCreate',_0x59da('0x53'),_0x59da('0x58'));}break;case _0x59da('0x59'):if(_0x3723f0[_0x59da('0x31')]&&_0x3723f0[_0x59da('0x46')]){if(_0x3723f0[_0x59da('0x5a')]){var _0x1d3422={'method':_0x59da('0x39'),'uri':_0x3723f0[_0x59da('0x5a')]+_0x59da('0x5b'),'body':{'username':_0x3723f0['username'],'password':_0x3723f0['password']},'json':!![]};return rp(_0x1d3422)[_0x59da('0x18')](function(_0x4d5645){var _0x4023dc={'method':_0x59da('0x39'),'uri':_0x3723f0['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3723f0[_0x59da('0x23')],'destinations':[{'to':_0x4ca643[_0x59da('0x23')]}],'text':_0x4ca643[_0x59da('0xd')],'notifyUrl':_0x3723f0[_0x59da('0x26')]+'/api/sms/messages/'+_0x4ca643['id']+_0x59da('0x28')+_0x3723f0[_0x59da('0x5c')],'notifyContentType':_0x59da('0x5d'),'callbackData':_0x3723f0[_0x59da('0x23')]+';'+_0x4ca643[_0x59da('0xd')]}]},'headers':{'Authorization':_0x59da('0x5e')+_0x4d5645['token']},'json':!![]};return rp(_0x4023dc)[_0x59da('0x18')](function(_0x3cbd2f){if(_0x3cbd2f[_0x59da('0x24')]){var _0x259612={'messageId':_0x3cbd2f['messages'][0x0]['messageId']};if(!_0x3723f0[_0x59da('0x3e')]){_0x259612[_0x59da('0x43')]=!![];}return _0x4db53e[_0x59da('0x19')](_0x259612);}else{return logger[_0x59da('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59da('0x2d'),_0x59da('0x59'),util['inspect'](_0x3cbd2f,{'showHidden':![],'depth':null}));}});})[_0x59da('0x1b')](function(_0x35908d){return logger['error'](_0x59da('0x2b'),'afterCreate',_0x59da('0x59'),util['inspect'](_0x35908d,{'showHidden':![],'depth':null}));});}else{logger[_0x59da('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59da('0x2d'),_0x59da('0x59'),_0x59da('0x5f'));}}else{logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x59'),_0x59da('0x3f'));}break;case'csc':var _0xc5d6f=require('crypto');if(_0x3723f0['apiKey']){var _0x1b6192={};_0x1b6192[_0x59da('0x60')]=_0x3723f0[_0x59da('0x31')];_0x1b6192[_0x59da('0x23')]=_0x4ca643[_0x59da('0x23')];_0x1b6192[_0x59da('0x33')]=_0x3723f0[_0x59da('0x23')];_0x1b6192[_0x59da('0x61')]=_0x4ca643[_0x59da('0xd')];_0x1b6192[_0x59da('0x62')]=+new Date();var _0x107490='';var _0x52abe0='';var _0x36120e=Object['keys'](_0x1b6192);_0x36120e[_0x59da('0x63')]();for(var _0x209a44=0x0;_0x209a44<_0x36120e[_0x59da('0x64')];_0x209a44++){if(_0x107490!=''){_0x107490+='&';}_0x107490+=_0x36120e[_0x209a44]+'='+encodeURIComponent(_0x1b6192[_0x36120e[_0x209a44]]);_0x52abe0+=_0x1b6192[_0x36120e[_0x209a44]];}_0x52abe0+=_0x3723f0[_0x59da('0x65')];_0x52abe0=_0xc5d6f[_0x59da('0x66')]('md5')[_0x59da('0x19')](_0x52abe0)[_0x59da('0x67')](_0x59da('0x68'));if(_0x107490!==''){_0x107490+='&';}_0x107490+=_0x59da('0x69')+_0x52abe0;var _0x5889fb={'method':'GET','uri':_0x59da('0x6a')+_0x107490,'json':!![]};return rp(_0x5889fb)['then'](function(_0x1c34a0){var _0x2dac68=Object[_0x59da('0x6b')](_0x1c34a0);if(_0x1c34a0[_0x2dac68[0x0]][_0x59da('0x2a')]&&parseInt(_0x1c34a0[_0x2dac68[0x0]][_0x59da('0x2a')])===0x0){var _0x17641d={'messageId':_0x1c34a0[_0x2dac68[0x0]][_0x59da('0x6c')]};if(!_0x3723f0[_0x59da('0x3e')]){_0x17641d['read']=!![];}return _0x4db53e[_0x59da('0x19')](_0x17641d);}else{return logger['error'](_0x59da('0x2b'),'afterCreate','csc',util[_0x59da('0x2c')](_0x1c34a0[_0x59da('0x2a')],{'showHidden':![],'depth':null}));}})[_0x59da('0x1b')](function(_0xfeb2a0){return logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),'csc',util[_0x59da('0x2c')](_0xfeb2a0,{'showHidden':![],'depth':null}));});}else{logger[_0x59da('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59da('0x2d'),_0x59da('0x6d'),_0x59da('0x6e'));}break;case'clickatell':if(_0x3723f0[_0x59da('0x65')]){var _0x393f53={'method':_0x59da('0x39'),'uri':_0x59da('0x6f'),'headers':{'Authorization':_0x3723f0[_0x59da('0x65')]},'body':{'content':_0x4ca643['body'],'to':[_0x4ca643[_0x59da('0x23')]],'from':_0x3723f0[_0x59da('0x23')],'binary':![],'clientMessageId':_0x59da('0x70'),'charset':_0x59da('0x71')},'json':!![]};rp(_0x393f53)[_0x59da('0x18')](function(_0x36cae2){if(!_0x36cae2[_0x59da('0x2a')]){var _0x4ed264={'messageId':_0x36cae2[_0x59da('0x24')][0x0][_0x59da('0x72')]};if(!_0x3723f0[_0x59da('0x3e')]){_0x4ed264['read']=!![];}return _0x4db53e[_0x59da('0x19')](_0x4ed264);}else{return logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x73'),util[_0x59da('0x2c')](_0x36cae2[_0x59da('0x2a')],{'showHidden':![],'depth':null}));}})[_0x59da('0x1b')](function(_0x28fbdf){return logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x73'),util['inspect'](_0x28fbdf,{'showHidden':![],'depth':null}));});}else{logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x73'),_0x59da('0x6e'));}break;case'intelepeer':if(_0x3723f0['apiKey']){var _0x20682b={};var _0x5889fb={'method':_0x59da('0x39'),'uri':_0x59da('0x74'),'headers':{'Authorization':_0x59da('0x75')+_0x3723f0['apiKey'],'Content-Type':_0x59da('0x5d')},'body':{'from':_0x3723f0['phone'],'to':_0x4ca643[_0x59da('0x23')],'text':_0x4ca643[_0x59da('0xd')]},'json':!![]};return rp(_0x5889fb)[_0x59da('0x18')](function(_0x2ad9aa){if(_0x2ad9aa['code']==0xca){_0x20682b[_0x59da('0x76')]=_0x2ad9aa;var _0x349a77={'method':_0x59da('0x39'),'uri':_0x59da('0x77'),'headers':{'Authorization':_0x59da('0x75')+_0x3723f0[_0x59da('0x65')],'Content-Type':'application/json'},'body':{'refid':_0x20682b[_0x59da('0x76')]['refid']},'json':!![]};return rp(_0x349a77)[_0x59da('0x18')](function(_0x414541){_0x20682b[_0x59da('0x78')]=_0x414541;var _0x1092f1={'messageId':_0x20682b[_0x59da('0x76')]['refid'],'read':!![]};return _0x4db53e[_0x59da('0x19')](_0x1092f1);});}else{return logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x79'),util[_0x59da('0x2c')](_0x2ad9aa,{'showHidden':![],'depth':null}));}})[_0x59da('0x1b')](function(_0x47ff1f){return logger[_0x59da('0x2a')](_0x59da('0x2b'),_0x59da('0x2d'),_0x59da('0x79'),util[_0x59da('0x2c')](_0x47ff1f,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x59da('0x2b'),'afterCreate',_0x59da('0x79'),_0x59da('0x7a'));}break;}}})['finally'](function(){_0x2a0521();});}else{_0x2a0521();}}},'charset':_0x59da('0x7b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x791b=['&password=','GET','split','sms','POST','user_key','internal_order_id','deliveryReport','read','skebby','connectel','senderString','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','csc','apiKey','text','timestamp','keys','sort','md5','digest','hex','signature=','https://sms.csc.lv/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','models','direction','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','toLowerCase','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x791b,0x12b));var _0xb791=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x791b[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xb791('0x0'));var util=require(_0xb791('0x1'));var logger=require(_0xb791('0x2'))(_0xb791('0x3'));var moment=require(_0xb791('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb791('0x5'));var rimraf=require(_0xb791('0x6'));var config=require(_0xb791('0x7'));var attributes=require(_0xb791('0x8'));module[_0xb791('0x9')]=function(_0x4d9ac2,_0x16ddb5){return _0x4d9ac2[_0xb791('0xa')](_0xb791('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xb791('0xc'),'fields':[_0xb791('0xc')]},{'name':_0xb791('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5adede,_0x47589a,_0x4db68b){var _0xaf1f23=_0x4d9ac2[_0xb791('0xe')];var _0x2819f5=_0x5adede['get']({'plain':!![]});if(_0x2819f5[_0xb791('0xf')]['toLowerCase']()==='in'||_0x2819f5[_0xb791('0xf')]['toLowerCase']()==='out'&&!_0x2819f5[_0xb791('0x10')]&&!_[_0xb791('0x11')](_0x2819f5[_0xb791('0x12')])){_0xaf1f23[_0xb791('0x13')][_0xb791('0x14')]({'where':{'id':_0x2819f5[_0xb791('0x15')]}})[_0xb791('0x16')](function(_0x399963){if(_0x399963){_0x399963[_0xb791('0x17')]({'lastMsgAt':_0x2819f5[_0xb791('0x18')],'lastMsgDirection':_0x2819f5[_0xb791('0xf')][_0xb791('0x19')]()});}})[_0xb791('0x1a')](function(_0x1280ee){console[_0xb791('0x1b')](_0x1280ee);});}if(_0x2819f5[_0xb791('0xf')]===_0xb791('0x1c')&&!_0x2819f5[_0xb791('0x10')]){var _0x11a3c2;_0xaf1f23[_0xb791('0x1d')][_0xb791('0x1e')]({'where':{'id':_0x2819f5[_0xb791('0x1f')]},'raw':!![]})[_0xb791('0x16')](function(_0x59add5){_0x11a3c2=_0x59add5;if(_0x11a3c2&&_0x11a3c2[_0xb791('0x20')]){switch(_0x11a3c2[_0xb791('0x20')]){case _0xb791('0x21'):var _0x28f8fc=require('twilio');if(_0x11a3c2[_0xb791('0x22')]&&_0x11a3c2[_0xb791('0x23')]&&_0x11a3c2['phone']){var _0x2a1028=new _0x28f8fc(_0x11a3c2[_0xb791('0x22')],_0x11a3c2[_0xb791('0x23')]);_0x2a1028[_0xb791('0x24')][_0xb791('0x25')]({'body':_0x2819f5[_0xb791('0x26')],'to':_0x2819f5[_0xb791('0x27')],'from':_0x11a3c2['phone'],'statusCallback':_0x11a3c2['remote']+_0xb791('0x28')+_0x2819f5['id']+_0xb791('0x29')+_0x11a3c2[_0xb791('0x2a')]})[_0xb791('0x16')](function(_0x233b83){if(_0x233b83[_0xb791('0x2b')]){return _0x5adede[_0xb791('0x17')]({'messageId':_0x233b83[_0xb791('0x2b')]});}})[_0xb791('0x1a')](function(_0x5a0733){logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),'twilio',util[_0xb791('0x2e')](_0x5a0733,{'showHidden':![],'depth':null}));});}else{logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x4f230b=_0xb791('0x2f');if(_0x11a3c2[_0xb791('0x30')]&&_0x11a3c2[_0xb791('0x31')]){var _0x3331be={'recipient':[_0x2819f5['phone']],'message':_0x2819f5['body'],'message_type':_0x11a3c2[_0xb791('0x32')]};if(_0x11a3c2[_0xb791('0x32')]&&_0x11a3c2[_0xb791('0x32')]!=='SI'){_0x3331be[_0xb791('0x33')]=_0x11a3c2[_0xb791('0x27')];}var _0xb5ea02={'url':_0x4f230b+'login?username='+_0x11a3c2[_0xb791('0x30')]+_0xb791('0x34')+_0x11a3c2['password'],'method':_0xb791('0x35')};rp(_0xb5ea02)[_0xb791('0x16')](function(_0x6f85c5){var _0x4787ca=_0x6f85c5[_0xb791('0x36')](';');var _0x5509b1={'user_key':_0x4787ca[0x0],'session_key':_0x4787ca[0x1]};_0xb5ea02={'url':_0x4f230b+_0xb791('0x37'),'method':_0xb791('0x38'),'headers':{'user_key':_0x5509b1[_0xb791('0x39')],'Session_key':_0x5509b1['session_key']},'json':!![],'body':_0x3331be};return rp(_0xb5ea02);})[_0xb791('0x16')](function(_0x36d2c9){if(_0x36d2c9['total_sent']>=0x1){var _0x2d676a={'messageId':_0x36d2c9[_0xb791('0x3a')]};if(_0x11a3c2[_0xb791('0x32')]!=='GP'||!_0x11a3c2[_0xb791('0x3b')]){_0x2d676a[_0xb791('0x3c')]=!![];}return _0x5adede[_0xb791('0x17')](_0x2d676a);}else{return logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x3d'),util[_0xb791('0x2e')](_0x36d2c9,{'showHidden':![],'depth':null}));}})[_0xb791('0x1a')](function(_0x176248){return logger['error'](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x3d'),util[_0xb791('0x2e')](_0x176248,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x3d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xb791('0x3e'):if(_0x11a3c2[_0xb791('0x23')]){var _0x9d60ec={'recipient':_0x2819f5[_0xb791('0x27')],'message':_0x2819f5[_0xb791('0x26')],'sender':_0x11a3c2[_0xb791('0x3f')]||_0x11a3c2['phone'],'authorization':_0x11a3c2[_0xb791('0x23')]};var _0x47589a={'method':'POST','uri':'https://smsapi.connectel.se/api/send/','body':_0x9d60ec,'json':!![]};rp(_0x47589a)[_0xb791('0x16')](function(_0x46f43c){var _0x2298ca={'messageId':_0x46f43c['requestid']};if(!_0x11a3c2[_0xb791('0x3b')]){_0x2298ca[_0xb791('0x3c')]=!![];}return _0x5adede[_0xb791('0x17')](_0x2298ca);})[_0xb791('0x1a')](function(_0x24a734){logger[_0xb791('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb791('0x2d'),_0xb791('0x3e'),util[_0xb791('0x2e')](_0x24a734,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x3e'),_0xb791('0x40'));}break;case _0xb791('0x41'):if(_0x11a3c2[_0xb791('0x30')]&&_0x11a3c2[_0xb791('0x31')]){var _0x9d60ec={'messages':[{'source':_0xb791('0x42'),'to':_0x2819f5[_0xb791('0x27')],'body':_0x2819f5[_0xb791('0x26')],'from':_0x11a3c2['senderString']||_0x11a3c2[_0xb791('0x27')]}]};var _0x2427e4=util[_0xb791('0x43')](_0xb791('0x44'),_0x11a3c2[_0xb791('0x30')],_0x11a3c2[_0xb791('0x31')]);var _0x47589a={'method':_0xb791('0x38'),'uri':_0xb791('0x45'),'body':_0x9d60ec,'headers':{'Authorization':util[_0xb791('0x43')](_0xb791('0x46'),new Buffer(_0x2427e4)[_0xb791('0x47')](_0xb791('0x48')))},'json':!![]};rp(_0x47589a)['then'](function(_0x5083df){if(_0x5083df[_0xb791('0x49')]>=0xc8&&_0x5083df[_0xb791('0x49')]<=0xce){if(_0x5083df[_0xb791('0x4a')]&&_0x5083df['data']['queued_count']>0x0){var _0x32886e=_[_0xb791('0x4b')](_0x5083df['data']['messages']);var _0x28c433={'messageId':_0x32886e[_0xb791('0x4c')]};if(!_0x11a3c2[_0xb791('0x3b')]){_0x28c433[_0xb791('0x3c')]=!![];}return _0x5adede[_0xb791('0x17')](_0x28c433);}else{logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x4d'),util[_0xb791('0x2e')](_0x5083df,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x4d'),util['inspect'](_0x5083df,{'showHidden':![],'depth':null}));}})[_0xb791('0x1a')](function(_0x333c7a){logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x4d'),util['inspect'](_0x333c7a,{'showHidden':![],'depth':null}));});}else{logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),'clickSend',_0xb791('0x4e'));}break;case _0xb791('0x4f'):if(_0x11a3c2[_0xb791('0x50')]&&_0x11a3c2[_0xb791('0x23')]){var _0x9d60ec={'dst':_0x2819f5['phone'],'text':_0x2819f5[_0xb791('0x26')],'src':_0x11a3c2[_0xb791('0x3f')]||_0x11a3c2[_0xb791('0x27')],'url':_0x11a3c2[_0xb791('0x51')]+'/api/sms/messages/'+_0x2819f5['id']+_0xb791('0x29')+_0x11a3c2[_0xb791('0x2a')]};var _0x2427e4=util['format'](_0xb791('0x44'),_0x11a3c2[_0xb791('0x50')],_0x11a3c2['authToken']);var _0x47589a={'method':_0xb791('0x38'),'uri':util['format'](_0xb791('0x52'),_0x11a3c2[_0xb791('0x50')]),'body':_0x9d60ec,'headers':{'Authorization':util[_0xb791('0x43')](_0xb791('0x46'),new Buffer(_0x2427e4)[_0xb791('0x47')](_0xb791('0x48')))},'json':!![]};rp(_0x47589a)[_0xb791('0x16')](function(_0xd6f9e5){var _0x4965e5={'messageId':_0xd6f9e5[_0xb791('0x53')][0x0]};return _0x5adede[_0xb791('0x17')](_0x4965e5);})[_0xb791('0x1a')](function(_0x27dbb5){logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x4f'),util[_0xb791('0x2e')](_0x27dbb5,{'showHidden':![],'depth':null}));});}else{logger[_0xb791('0x1b')](_0xb791('0x2c'),'afterCreate',_0xb791('0x4f'),_0xb791('0x54'));}break;case _0xb791('0x55'):if(_0x11a3c2[_0xb791('0x30')]&&_0x11a3c2['password']){if(_0x11a3c2[_0xb791('0x56')]){var _0x51f211={'method':_0xb791('0x38'),'uri':_0x11a3c2[_0xb791('0x56')]+'/auth/1/session','body':{'username':_0x11a3c2[_0xb791('0x30')],'password':_0x11a3c2[_0xb791('0x31')]},'json':!![]};return rp(_0x51f211)[_0xb791('0x16')](function(_0x28e31d){var _0x50ad94={'method':_0xb791('0x38'),'uri':_0x11a3c2[_0xb791('0x56')]+_0xb791('0x57'),'body':{'messages':[{'from':_0x11a3c2['phone'],'destinations':[{'to':_0x2819f5[_0xb791('0x27')]}],'text':_0x2819f5['body'],'notifyUrl':_0x11a3c2[_0xb791('0x51')]+_0xb791('0x28')+_0x2819f5['id']+_0xb791('0x29')+_0x11a3c2[_0xb791('0x2a')],'notifyContentType':_0xb791('0x58'),'callbackData':_0x11a3c2[_0xb791('0x27')]+';'+_0x2819f5[_0xb791('0x26')]}]},'headers':{'Authorization':_0xb791('0x59')+_0x28e31d['token']},'json':!![]};return rp(_0x50ad94)['then'](function(_0x894090){if(_0x894090[_0xb791('0x24')]){var _0x51d2d1={'messageId':_0x894090['messages'][0x0][_0xb791('0xc')]};if(!_0x11a3c2[_0xb791('0x3b')]){_0x51d2d1['read']=!![];}return _0x5adede['update'](_0x51d2d1);}else{return logger[_0xb791('0x1b')](_0xb791('0x2c'),'afterCreate',_0xb791('0x55'),util[_0xb791('0x2e')](_0x894090,{'showHidden':![],'depth':null}));}});})[_0xb791('0x1a')](function(_0x1539fd){return logger[_0xb791('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb791('0x2d'),'infobip',util[_0xb791('0x2e')](_0x1539fd,{'showHidden':![],'depth':null}));});}else{logger[_0xb791('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb791('0x2d'),_0xb791('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xb791('0x1b')](_0xb791('0x2c'),'afterCreate',_0xb791('0x55'),_0xb791('0x4e'));}break;case _0xb791('0x5a'):var _0x1a9d4f=require('crypto');if(_0x11a3c2[_0xb791('0x5b')]){var _0x1d615a={};_0x1d615a['login']=_0x11a3c2['username'];_0x1d615a[_0xb791('0x27')]=_0x2819f5[_0xb791('0x27')];_0x1d615a[_0xb791('0x33')]=_0x11a3c2[_0xb791('0x27')];_0x1d615a[_0xb791('0x5c')]=_0x2819f5[_0xb791('0x26')];_0x1d615a[_0xb791('0x5d')]=+new Date();var _0xb12eb2='';var _0x5e1eeb='';var _0x498e35=Object[_0xb791('0x5e')](_0x1d615a);_0x498e35[_0xb791('0x5f')]();for(var _0x3456f9=0x0;_0x3456f9<_0x498e35['length'];_0x3456f9++){if(_0xb12eb2!=''){_0xb12eb2+='&';}_0xb12eb2+=_0x498e35[_0x3456f9]+'='+encodeURIComponent(_0x1d615a[_0x498e35[_0x3456f9]]);_0x5e1eeb+=_0x1d615a[_0x498e35[_0x3456f9]];}_0x5e1eeb+=_0x11a3c2[_0xb791('0x5b')];_0x5e1eeb=_0x1a9d4f['createHash'](_0xb791('0x60'))['update'](_0x5e1eeb)[_0xb791('0x61')](_0xb791('0x62'));if(_0xb12eb2!==''){_0xb12eb2+='&';}_0xb12eb2+=_0xb791('0x63')+_0x5e1eeb;var _0xb5ea02={'method':_0xb791('0x35'),'uri':_0xb791('0x64')+_0xb12eb2,'json':!![]};return rp(_0xb5ea02)[_0xb791('0x16')](function(_0x324aa3){var _0x35e7de=Object[_0xb791('0x5e')](_0x324aa3);if(_0x324aa3[_0x35e7de[0x0]][_0xb791('0x1b')]&&parseInt(_0x324aa3[_0x35e7de[0x0]][_0xb791('0x1b')])===0x0){var _0x1e4451={'messageId':_0x324aa3[_0x35e7de[0x0]][_0xb791('0x65')]};if(!_0x11a3c2[_0xb791('0x3b')]){_0x1e4451[_0xb791('0x3c')]=!![];}return _0x5adede['update'](_0x1e4451);}else{return logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x5a'),util['inspect'](_0x324aa3[_0xb791('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x379fd5){return logger['error'](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x5a'),util[_0xb791('0x2e')](_0x379fd5,{'showHidden':![],'depth':null}));});}else{logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x5a'),_0xb791('0x66'));}break;case'clickatell':if(_0x11a3c2['apiKey']){var _0x33d359={'method':_0xb791('0x38'),'uri':_0xb791('0x67'),'headers':{'Authorization':_0x11a3c2[_0xb791('0x5b')]},'body':{'content':_0x2819f5[_0xb791('0x26')],'to':[_0x2819f5[_0xb791('0x27')]],'from':_0x11a3c2[_0xb791('0x27')],'binary':![],'clientMessageId':_0xb791('0x68'),'charset':_0xb791('0x69')},'json':!![]};rp(_0x33d359)[_0xb791('0x16')](function(_0x7050e1){if(!_0x7050e1[_0xb791('0x1b')]){var _0x100a08={'messageId':_0x7050e1['messages'][0x0][_0xb791('0x6a')]};if(!_0x11a3c2[_0xb791('0x3b')]){_0x100a08[_0xb791('0x3c')]=!![];}return _0x5adede[_0xb791('0x17')](_0x100a08);}else{return logger['error'](_0xb791('0x2c'),'afterCreate',_0xb791('0x6b'),util['inspect'](_0x7050e1[_0xb791('0x1b')],{'showHidden':![],'depth':null}));}})[_0xb791('0x1a')](function(_0x1c649a){return logger['error'](_0xb791('0x2c'),_0xb791('0x2d'),'clickatell',util[_0xb791('0x2e')](_0x1c649a,{'showHidden':![],'depth':null}));});}else{logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x6b'),_0xb791('0x66'));}break;case _0xb791('0x6c'):if(_0x11a3c2[_0xb791('0x5b')]){var _0x353929={};var _0xb5ea02={'method':_0xb791('0x38'),'uri':_0xb791('0x6d'),'headers':{'Authorization':_0xb791('0x6e')+_0x11a3c2['apiKey'],'Content-Type':_0xb791('0x58')},'body':{'from':_0x11a3c2[_0xb791('0x27')],'to':_0x2819f5[_0xb791('0x27')],'text':_0x2819f5[_0xb791('0x26')]},'json':!![]};return rp(_0xb5ea02)['then'](function(_0x316aef){if(_0x316aef[_0xb791('0x6f')]==0xca){_0x353929['message']=_0x316aef;var _0x2dda1e={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xb791('0x6e')+_0x11a3c2['apiKey'],'Content-Type':_0xb791('0x58')},'body':{'refid':_0x353929['message'][_0xb791('0x70')]},'json':!![]};return rp(_0x2dda1e)[_0xb791('0x16')](function(_0x2869fd){_0x353929[_0xb791('0x71')]=_0x2869fd;var _0x357e0a={'messageId':_0x353929['message'][_0xb791('0x70')],'read':!![]};return _0x5adede['update'](_0x357e0a);});}else{return logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x6c'),util[_0xb791('0x2e')](_0x316aef,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3fc5d3){return logger['error'](_0xb791('0x2c'),_0xb791('0x2d'),_0xb791('0x6c'),util['inspect'](_0x3fc5d3,{'showHidden':![],'depth':null}));});}else{return logger[_0xb791('0x1b')](_0xb791('0x2c'),_0xb791('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xb791('0x72')](function(){_0x4db68b();});}else{_0x4db68b();}}},'charset':_0xb791('0x73'),'collate':_0xb791('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b399720..02eab23 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 _0x0b0e=['message','result','SmsMessage','create','body','options','CreateSmsMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s'];(function(_0x102cd3,_0x586ce9){var _0x26ca3c=function(_0x28db7b){while(--_0x28db7b){_0x102cd3['push'](_0x102cd3['shift']());}};_0x26ca3c(++_0x586ce9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x343dfb,_0xed8587){_0x343dfb=_0x343dfb-0x0;var _0x297fe2=_0x0b0e[_0x343dfb];return _0x297fe2;};'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});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateSmsMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateSmsMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','body'];(function(_0x578489,_0x1ed3f0){var _0x41c634=function(_0x256b5d){while(--_0x256b5d){_0x578489['push'](_0x578489['shift']());}};_0x41c634(++_0x1ed3f0);}(_0xb10b,0x12a));var _0xbb10=function(_0x42bbd8,_0x32af99){_0x42bbd8=_0x42bbd8-0x0;var _0x2d4a1c=_0xb10b[_0x42bbd8];return _0x2d4a1c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7a2a553..22b7029 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 _0x690b=['save','remove','emit','removeListener','length','./smsMessage.events'];(function(_0x5c0a8c,_0x251f77){var _0x476570=function(_0x196bbf){while(--_0x196bbf){_0x5c0a8c['push'](_0x5c0a8c['shift']());}};_0x476570(++_0x251f77);}(_0x690b,0xd1));var _0xb690=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x690b[_0x2112d4];return _0x434972;};'use strict';var SmsMessageEvents=require(_0xb690('0x0'));var events=[_0xb690('0x1'),_0xb690('0x2'),'update'];function createListener(_0x3899b6,_0x58f8db){return function(_0x237b36){_0x58f8db[_0xb690('0x3')](_0x3899b6,_0x237b36);};}function removeListener(_0x19b014,_0x11771e){return function(){SmsMessageEvents[_0xb690('0x4')](_0x19b014,_0x11771e);};}exports['register']=function(_0x15f640){for(var _0x44e8b8=0x0,_0x5ddca8=events[_0xb690('0x5')];_0x44e8b8<_0x5ddca8;_0x44e8b8++){var _0x1fa3c2=events[_0x44e8b8];var _0x2b6b65=createListener('smsMessage:'+_0x1fa3c2,_0x15f640);SmsMessageEvents['on'](_0x1fa3c2,_0x2b6b65);}}; \ No newline at end of file +var _0x19ff=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19ff,0x1ec));var _0xf19f=function(_0x3d0084,_0x541dad){_0x3d0084=_0x3d0084-0x0;var _0x3efabb=_0x19ff[_0x3d0084];return _0x3efabb;};'use strict';var SmsMessageEvents=require(_0xf19f('0x0'));var events=[_0xf19f('0x1'),_0xf19f('0x2'),'update'];function createListener(_0x36874c,_0x4abaea){return function(_0x539e18){_0x4abaea[_0xf19f('0x3')](_0x36874c,_0x539e18);};}function removeListener(_0xf06acb,_0x4bf775){return function(){SmsMessageEvents[_0xf19f('0x4')](_0xf06acb,_0x4bf775);};}exports[_0xf19f('0x5')]=function(_0x5a4802){for(var _0x24afc0=0x0,_0x47f754=events[_0xf19f('0x6')];_0x24afc0<_0x47f754;_0x24afc0++){var _0x384e88=events[_0x24afc0];var _0x5b8a56=createListener(_0xf19f('0x7')+_0x384e88,_0x5a4802);SmsMessageEvents['on'](_0x384e88,_0x5b8a56);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 98fbe6e..acb1d3d 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 _0x1fcc=['/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','describe','/:id','getMembers'];(function(_0x3e82a0,_0x16e564){var _0x4ea8a7=function(_0x1bc288){while(--_0x1bc288){_0x3e82a0['push'](_0x3e82a0['shift']());}};_0x4ea8a7(++_0x16e564);}(_0x1fcc,0x125));var _0xc1fc=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x1fcc[_0x4d82ea];return _0x257f4a;};'use strict';var multer=require(_0xc1fc('0x0'));var util=require(_0xc1fc('0x1'));var path=require('path');var timeout=require(_0xc1fc('0x2'));var express=require(_0xc1fc('0x3'));var router=express[_0xc1fc('0x4')]();var auth=require(_0xc1fc('0x5'));var interaction=require(_0xc1fc('0x6'));var config=require(_0xc1fc('0x7'));var controller=require(_0xc1fc('0x8'));router['get']('/',auth[_0xc1fc('0x9')](),controller[_0xc1fc('0xa')]);router[_0xc1fc('0xb')]('/describe',auth[_0xc1fc('0x9')](),controller[_0xc1fc('0xc')]);router['get'](_0xc1fc('0xd'),auth[_0xc1fc('0x9')](),controller['show']);router[_0xc1fc('0xb')]('/:id/members',auth[_0xc1fc('0x9')](),controller[_0xc1fc('0xe')]);router['get'](_0xc1fc('0xf'),auth[_0xc1fc('0x9')](),controller[_0xc1fc('0x10')]);router[_0xc1fc('0xb')](_0xc1fc('0x11'),auth['isAuthenticated'](),controller[_0xc1fc('0x12')]);router[_0xc1fc('0x13')]('/',auth[_0xc1fc('0x9')](),controller['create']);router[_0xc1fc('0x13')](_0xc1fc('0xf'),auth[_0xc1fc('0x9')](),controller['addTeams']);router[_0xc1fc('0x13')](_0xc1fc('0x11'),auth[_0xc1fc('0x9')](),controller[_0xc1fc('0x14')]);router[_0xc1fc('0x15')](_0xc1fc('0xd'),auth[_0xc1fc('0x9')](),controller[_0xc1fc('0x16')]);router[_0xc1fc('0x17')](_0xc1fc('0xd'),auth['isAuthenticated'](),controller[_0xc1fc('0x18')]);router['delete']('/:id/teams',auth[_0xc1fc('0x9')](),controller[_0xc1fc('0x19')]);router[_0xc1fc('0x17')](_0xc1fc('0x11'),auth[_0xc1fc('0x9')](),controller[_0xc1fc('0x1a')]);module[_0xc1fc('0x1b')]=router; \ No newline at end of file +var _0x4489=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','index','/describe','describe','get','/:id','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x92bdac,_0x2ff233){var _0x3554b5=function(_0x20451f){while(--_0x20451f){_0x92bdac['push'](_0x92bdac['shift']());}};_0x3554b5(++_0x2ff233);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9448('0x0'));var util=require(_0x9448('0x1'));var path=require('path');var timeout=require(_0x9448('0x2'));var express=require(_0x9448('0x3'));var router=express[_0x9448('0x4')]();var auth=require(_0x9448('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9448('0x6')]);router['get'](_0x9448('0x7'),auth['isAuthenticated'](),controller[_0x9448('0x8')]);router[_0x9448('0x9')](_0x9448('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9448('0xb'),auth[_0x9448('0xc')](),controller[_0x9448('0xd')]);router[_0x9448('0x9')](_0x9448('0xe'),auth['isAuthenticated'](),controller[_0x9448('0xf')]);router[_0x9448('0x9')](_0x9448('0x10'),auth[_0x9448('0xc')](),controller[_0x9448('0x11')]);router[_0x9448('0x12')]('/',auth[_0x9448('0xc')](),controller[_0x9448('0x13')]);router['post'](_0x9448('0xe'),auth['isAuthenticated'](),controller[_0x9448('0x14')]);router[_0x9448('0x12')]('/:id/users',auth[_0x9448('0xc')](),controller[_0x9448('0x15')]);router[_0x9448('0x16')](_0x9448('0xa'),auth[_0x9448('0xc')](),controller[_0x9448('0x17')]);router[_0x9448('0x18')](_0x9448('0xa'),auth['isAuthenticated'](),controller[_0x9448('0x19')]);router['delete'](_0x9448('0xe'),auth[_0x9448('0xc')](),controller[_0x9448('0x1a')]);router[_0x9448('0x18')](_0x9448('0x10'),auth[_0x9448('0xc')](),controller[_0x9448('0x1b')]);module[_0x9448('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 87101a2..97938c1 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 _0x0df3=['sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0df3,0x1aa));var _0x30df=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x0df3[_0x547add];return _0x2ed1f3;};'use strict';var Sequelize=require(_0x30df('0x0'));module['exports']={'name':{'type':Sequelize[_0x30df('0x1')],'unique':_0x30df('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x30df('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x30df('0x4')]('rrmemory',_0x30df('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xc020=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc020,0x1cb));var _0x0c02=function(_0x1385f0,_0x5550bb){_0x1385f0=_0x1385f0-0x0;var _0x36ca00=_0xc020[_0x1385f0];return _0x36ca00;};'use strict';var Sequelize=require(_0x0c02('0x0'));module[_0x0c02('0x1')]={'name':{'type':Sequelize[_0x0c02('0x2')],'unique':_0x0c02('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0c02('0x2')]},'timeout':{'type':Sequelize[_0x0c02('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0c02('0x5')](_0x0c02('0x6'),_0x0c02('0x7'),_0x0c02('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2733b46..22d921a 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 _0x784a=['key','field','includeAll','rows','catch','show','params','length','options','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','sort','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','createdAt','%s/%s','updatedAt','getTeams','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','redis','localhost','./smsQueue.socket','register','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','SmsQueues','UserProfileResource','error','stack','name','send','SmsQueue','rawAttributes','keys','query','filters','model','attributes','intersection','fields','nolimit','limit','order','where','pick','filter','merge','map','type'];(function(_0x258d6e,_0x54387b){var _0x1654f2=function(_0x1d58a7){while(--_0x1d58a7){_0x258d6e['push'](_0x258d6e['shift']());}};_0x1654f2(++_0x54387b);}(_0x784a,0xd4));var _0xa784=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0x784a[_0x3e0dc4];return _0x586111;};'use strict';var pdf=require(_0xa784('0x0'));var emlformat=require(_0xa784('0x1'));var rimraf=require(_0xa784('0x2'));var zipdir=require(_0xa784('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa784('0x4'));var moment=require(_0xa784('0x5'));var BPromise=require(_0xa784('0x6'));var Mustache=require(_0xa784('0x7'));var util=require('util');var path=require(_0xa784('0x8'));var sox=require(_0xa784('0x9'));var csv=require(_0xa784('0xa'));var ejs=require(_0xa784('0xb'));var fs=require('fs');var _=require(_0xa784('0xc'));var squel=require(_0xa784('0xd'));var crypto=require(_0xa784('0xe'));var jsforce=require(_0xa784('0xf'));var deskjs=require(_0xa784('0x10'));var toCsv=require(_0xa784('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa784('0x11'));var authService=require(_0xa784('0x12'));var qs=require(_0xa784('0x13'));var hardwareService=require(_0xa784('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa784('0x15'));var config=require(_0xa784('0x16'));var db=require('../../mysqldb')['db'];config[_0xa784('0x17')]=_['defaults'](config[_0xa784('0x17')],{'host':_0xa784('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa784('0x17')]));require(_0xa784('0x19'))[_0xa784('0x1a')](socket);function respondWithStatusCode(_0x44a3f3,_0x192759){_0x192759=_0x192759||0xcc;return function(_0x40ba61){if(_0x40ba61){return _0x44a3f3[_0xa784('0x1b')](_0x192759);}return _0x44a3f3['status'](_0x192759)[_0xa784('0x1c')]();};}function respondWithResult(_0x3a57df,_0x4d246b){_0x4d246b=_0x4d246b||0xc8;return function(_0x20441a){if(_0x20441a){return _0x3a57df[_0xa784('0x1d')](_0x4d246b)[_0xa784('0x1e')](_0x20441a);}};}function respondWithFilteredResult(_0x5ba23a,_0x114074){return function(_0x2be4cf){if(_0x2be4cf){var _0x1f41bb=_0x2be4cf[_0xa784('0x1f')],_0x2f72cf=_0x114074['offset'],_0x137a50=_0x114074[_0xa784('0x20')]+_0x114074['limit'],_0x21ceb9;if(_0x137a50>=_0x1f41bb){_0x137a50=_0x1f41bb;_0x21ceb9=0xc8;}else{_0x21ceb9=0xce;}_0x5ba23a['status'](_0x21ceb9);return _0x5ba23a['set'](_0xa784('0x21'),_0x2f72cf+'-'+_0x137a50+'/'+_0x1f41bb)['json'](_0x2be4cf);}return null;};}function patchUpdates(_0xce024b){return function(_0xe1a720){try{jsonpatch[_0xa784('0x22')](_0xe1a720,_0xce024b,!![]);}catch(_0x3782d5){return BPromise[_0xa784('0x23')](_0x3782d5);}return _0xe1a720[_0xa784('0x24')]();};}function saveUpdates(_0x57c0fc,_0x3bb7c9){return function(_0x37b81d){if(_0x37b81d){return _0x37b81d[_0xa784('0x25')](_0x57c0fc)['then'](function(_0x530612){return _0x530612;});}return null;};}function removeEntity(_0x1c0168,_0xb55c99){return function(_0x37bb91){if(_0x37bb91){return _0x37bb91[_0xa784('0x26')]()[_0xa784('0x27')](function(){var _0xd65955=_0x37bb91['get']({'plain':!![]});var _0x3fe35d=_0xa784('0x28');return db[_0xa784('0x29')][_0xa784('0x26')]({'where':{'type':_0x3fe35d,'resourceId':_0xd65955['id']}})[_0xa784('0x27')](function(){return _0x37bb91;});})[_0xa784('0x27')](function(){_0x1c0168[_0xa784('0x1d')](0xcc)[_0xa784('0x1c')]();});}};}function handleEntityNotFound(_0x4d4cd9,_0x1f3973){return function(_0x1df7aa){if(!_0x1df7aa){_0x4d4cd9[_0xa784('0x1b')](0x194);}return _0x1df7aa;};}function handleError(_0x3a5ed8,_0x13fb7a){_0x13fb7a=_0x13fb7a||0x1f4;return function(_0x2dfe5e){logger[_0xa784('0x2a')](_0x2dfe5e[_0xa784('0x2b')]);if(_0x2dfe5e[_0xa784('0x2c')]){delete _0x2dfe5e[_0xa784('0x2c')];}_0x3a5ed8[_0xa784('0x1d')](_0x13fb7a)[_0xa784('0x2d')](_0x2dfe5e);};}exports['index']=function(_0x1e8d28,_0x1d1986){var _0x3f6fa2={},_0x635160={},_0x574963={'count':0x0,'rows':[]};var _0x5ece73=db[_0xa784('0x2e')][_0xa784('0x2f')];_0x635160['model']=_[_0xa784('0x30')](_0x5ece73);_0x635160[_0xa784('0x31')]=_['keys'](_0x1e8d28[_0xa784('0x31')]);_0x635160[_0xa784('0x32')]=_['intersection'](_0x635160[_0xa784('0x33')],_0x635160[_0xa784('0x31')]);_0x3f6fa2[_0xa784('0x34')]=_[_0xa784('0x35')](_0x635160[_0xa784('0x33')],qs[_0xa784('0x36')](_0x1e8d28[_0xa784('0x31')][_0xa784('0x36')]));_0x3f6fa2[_0xa784('0x34')]=_0x3f6fa2[_0xa784('0x34')]['length']?_0x3f6fa2['attributes']:_0x635160[_0xa784('0x33')];if(!_0x1e8d28[_0xa784('0x31')]['hasOwnProperty'](_0xa784('0x37'))){_0x3f6fa2[_0xa784('0x38')]=qs[_0xa784('0x38')](_0x1e8d28['query']['limit']);_0x3f6fa2[_0xa784('0x20')]=qs['offset'](_0x1e8d28[_0xa784('0x31')][_0xa784('0x20')]);}_0x3f6fa2[_0xa784('0x39')]=qs['sort'](_0x1e8d28[_0xa784('0x31')]['sort']);_0x3f6fa2[_0xa784('0x3a')]=qs['filters'](_[_0xa784('0x3b')](_0x1e8d28[_0xa784('0x31')],_0x635160[_0xa784('0x32')]));if(_0x1e8d28[_0xa784('0x31')][_0xa784('0x3c')]){_0x3f6fa2[_0xa784('0x3a')]=_[_0xa784('0x3d')](_0x3f6fa2[_0xa784('0x3a')],{'$or':_[_0xa784('0x3e')](_0x5ece73,function(_0x4a7e57){if(_0x4a7e57[_0xa784('0x3f')][_0xa784('0x40')]!=='VIRTUAL'){var _0x2f545d={};_0x2f545d[_0x4a7e57[_0xa784('0x41')]]={'$like':'%'+_0x1e8d28['query'][_0xa784('0x3c')]+'%'};return _0x2f545d;}})});}_0x3f6fa2=_[_0xa784('0x3d')]({},_0x3f6fa2,_0x1e8d28['options']);var _0x4f02c8={'where':_0x3f6fa2[_0xa784('0x3a')]};return db['SmsQueue']['count'](_0x4f02c8)[_0xa784('0x27')](function(_0x59b0ea){_0x574963[_0xa784('0x1f')]=_0x59b0ea;if(_0x1e8d28[_0xa784('0x31')][_0xa784('0x42')]){_0x3f6fa2['include']=[{'all':!![]}];}return db[_0xa784('0x2e')]['findAll'](_0x3f6fa2);})['then'](function(_0x55ae9a){_0x574963[_0xa784('0x43')]=_0x55ae9a;return _0x574963;})['then'](respondWithFilteredResult(_0x1d1986,_0x3f6fa2))[_0xa784('0x44')](handleError(_0x1d1986,null));};exports[_0xa784('0x45')]=function(_0x5d015c,_0x47a866){var _0x3182be={'raw':!![],'where':{'id':_0x5d015c[_0xa784('0x46')]['id']}},_0x55dc9f={};_0x55dc9f[_0xa784('0x33')]=_[_0xa784('0x30')](db['SmsQueue'][_0xa784('0x2f')]);_0x55dc9f['query']=_[_0xa784('0x30')](_0x5d015c['query']);_0x55dc9f[_0xa784('0x32')]=_['intersection'](_0x55dc9f[_0xa784('0x33')],_0x55dc9f[_0xa784('0x31')]);_0x3182be[_0xa784('0x34')]=_[_0xa784('0x35')](_0x55dc9f[_0xa784('0x33')],qs['fields'](_0x5d015c[_0xa784('0x31')][_0xa784('0x36')]));_0x3182be[_0xa784('0x34')]=_0x3182be['attributes'][_0xa784('0x47')]?_0x3182be['attributes']:_0x55dc9f['model'];if(_0x5d015c['query'][_0xa784('0x42')]){_0x3182be['include']=[{'all':!![]}];}_0x3182be=_[_0xa784('0x3d')]({},_0x3182be,_0x5d015c[_0xa784('0x48')]);return db[_0xa784('0x2e')][_0xa784('0x49')](_0x3182be)[_0xa784('0x27')](handleEntityNotFound(_0x47a866,null))['then'](respondWithResult(_0x47a866,null))[_0xa784('0x44')](handleError(_0x47a866,null));};exports['create']=function(_0x1ea746,_0x5beaf6){return db[_0xa784('0x2e')][_0xa784('0x4a')](_0x1ea746[_0xa784('0x4b')],{})[_0xa784('0x27')](function(_0x5a71e0){var _0xbc48f9=_0x1ea746[_0xa784('0x4c')]['get']({'plain':!![]});if(!_0xbc48f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbc48f9[_0xa784('0x4d')]===_0xa784('0x4c')){var _0x3b791b=_0x5a71e0[_0xa784('0x4e')]({'plain':!![]});var _0x3faef4=_0xa784('0x28');return db[_0xa784('0x4f')][_0xa784('0x49')]({'where':{'name':_0x3faef4,'userProfileId':_0xbc48f9[_0xa784('0x50')]},'raw':!![]})[_0xa784('0x27')](function(_0x4d6493){if(_0x4d6493&&_0x4d6493[_0xa784('0x51')]===0x0){return db[_0xa784('0x29')]['create']({'name':_0x3b791b['name'],'resourceId':_0x3b791b['id'],'type':_0x4d6493[_0xa784('0x2c')],'sectionId':_0x4d6493['id']},{})[_0xa784('0x27')](function(){return _0x5a71e0;});}else{return _0x5a71e0;}})[_0xa784('0x44')](function(_0x8395e2){logger[_0xa784('0x2a')](_0xa784('0x52'),_0x8395e2);throw _0x8395e2;});}return _0x5a71e0;})[_0xa784('0x27')](respondWithResult(_0x5beaf6,0xc9))[_0xa784('0x44')](handleError(_0x5beaf6,null));};exports[_0xa784('0x25')]=function(_0x2fba1b,_0x166071){if(_0x2fba1b['body']['id']){delete _0x2fba1b[_0xa784('0x4b')]['id'];}return db[_0xa784('0x2e')][_0xa784('0x49')]({'where':{'id':_0x2fba1b[_0xa784('0x46')]['id']}})[_0xa784('0x27')](handleEntityNotFound(_0x166071,null))[_0xa784('0x27')](saveUpdates(_0x2fba1b[_0xa784('0x4b')],null))[_0xa784('0x27')](respondWithResult(_0x166071,null))[_0xa784('0x44')](handleError(_0x166071,null));};exports[_0xa784('0x26')]=function(_0x2efbb9,_0x18b2c8){return db['SmsQueue'][_0xa784('0x49')]({'where':{'id':_0x2efbb9['params']['id']}})['then'](handleEntityNotFound(_0x18b2c8,null))[_0xa784('0x27')](removeEntity(_0x18b2c8,null))[_0xa784('0x44')](handleError(_0x18b2c8,null));};exports['describe']=function(_0x6fd1d0,_0x1ee252){return db[_0xa784('0x2e')][_0xa784('0x53')]()[_0xa784('0x27')](respondWithResult(_0x1ee252,null))[_0xa784('0x44')](handleError(_0x1ee252,null));};exports[_0xa784('0x54')]=function(_0xd0fa0f,_0x5e1638,_0x1681db){var _0x3d2b55={'raw':!![],'where':{}},_0x8e84ba={},_0x36b006;return db[_0xa784('0x2e')][_0xa784('0x55')]({'where':{'id':_0xd0fa0f[_0xa784('0x46')]['id']}})[_0xa784('0x27')](handleEntityNotFound(_0x5e1638,null))[_0xa784('0x27')](function(_0x451ebc){if(_0x451ebc){_0x36b006=_0x451ebc[_0xa784('0x4e')]({'plain':!![]});_0x8e84ba[_0xa784('0x33')]=_['keys'](db[_0xa784('0x56')][_0xa784('0x2f')]);_0x8e84ba[_0xa784('0x31')]=_['keys'](_0xd0fa0f[_0xa784('0x31')]);_0x8e84ba['filters']=_[_0xa784('0x35')](_0x8e84ba[_0xa784('0x33')],_0x8e84ba[_0xa784('0x31')]);_0x3d2b55[_0xa784('0x34')]=_[_0xa784('0x35')](_0x8e84ba[_0xa784('0x33')],qs['fields'](_0xd0fa0f[_0xa784('0x31')][_0xa784('0x36')]));_0x3d2b55[_0xa784('0x34')]=_0x3d2b55[_0xa784('0x34')][_0xa784('0x47')]?_0x3d2b55['attributes']:_0x8e84ba[_0xa784('0x33')];if(!_0xd0fa0f[_0xa784('0x31')]['hasOwnProperty'](_0xa784('0x37'))){_0x3d2b55[_0xa784('0x38')]=qs[_0xa784('0x38')](_0xd0fa0f[_0xa784('0x31')][_0xa784('0x38')]);_0x3d2b55[_0xa784('0x20')]=qs[_0xa784('0x20')](_0xd0fa0f[_0xa784('0x31')]['offset']);}_0x3d2b55[_0xa784('0x39')]=qs[_0xa784('0x57')](_0xd0fa0f['query'][_0xa784('0x57')]);_0x3d2b55[_0xa784('0x3a')]=qs[_0xa784('0x32')](_[_0xa784('0x3b')](_0xd0fa0f[_0xa784('0x31')],_0x8e84ba['filters']));_0x3d2b55[_0xa784('0x3a')][_0xa784('0x58')]=_0x451ebc['id'];if(_0xd0fa0f[_0xa784('0x31')][_0xa784('0x3c')]){_0x3d2b55['where']=_[_0xa784('0x3d')](_0x3d2b55['where'],{'$or':_[_0xa784('0x3e')](_0x3d2b55[_0xa784('0x34')],function(_0x613225){var _0x135f70={};_0x135f70[_0x613225]={'$like':'%'+_0xd0fa0f['query'][_0xa784('0x3c')]+'%'};return _0x135f70;})});}_0x3d2b55=_[_0xa784('0x3d')]({},_0x3d2b55,_0xd0fa0f[_0xa784('0x48')]);return db[_0xa784('0x56')][_0xa784('0x59')](_0x3d2b55);}})[_0xa784('0x27')](function(_0x1e5af6){if(_0x1e5af6){return db[_0xa784('0x5a')][_0xa784('0x5b')]({'where':{'id':_['map'](_0x1e5af6,_0xa784('0x5c')),'role':_0xa784('0x5d')},'attributes':['id','name',_0xa784('0x5e'),'updatedAt',_0xa784('0x5f')]});}})[_0xa784('0x27')](function(_0x3cb9ce){if(_0x3cb9ce){return{'count':_0x3cb9ce[_0xa784('0x1f')],'rows':_[_0xa784('0x3e')](_0x3cb9ce[_0xa784('0x43')],function(_0x1751dd){return{'membername':_0x1751dd[_0xa784('0x2c')],'UserId':_0x1751dd['id'],'queue_name':_0x36b006['name'],'SmsQueueId':_0x36b006['id'],'interface':util['format'](_0xa784('0x60'),'SIP',_0x1751dd[_0xa784('0x2c')]),'penalty':0x0,'paused':_0x1751dd[_0xa784('0x5e')],'createdAt':_0x1751dd[_0xa784('0x5f')],'updatedAt':_0x1751dd[_0xa784('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa784('0x27')](respondWithFilteredResult(_0x5e1638,_0x3d2b55))[_0xa784('0x44')](handleError(_0x5e1638,null));};exports[_0xa784('0x62')]=function(_0x4b970c,_0x78a8bc,_0x47e27e){var _0x265d09={};var _0x52b4ba={};var _0x41fd09;var _0xc91f64;return db[_0xa784('0x2e')][_0xa784('0x55')]({'where':{'id':_0x4b970c[_0xa784('0x46')]['id']}})[_0xa784('0x27')](handleEntityNotFound(_0x78a8bc,null))[_0xa784('0x27')](function(_0x47bc9d){if(_0x47bc9d){_0x41fd09=_0x47bc9d;_0x52b4ba['model']=_[_0xa784('0x30')](db['Team'][_0xa784('0x2f')]);_0x52b4ba[_0xa784('0x31')]=_['keys'](_0x4b970c[_0xa784('0x31')]);_0x52b4ba[_0xa784('0x32')]=_[_0xa784('0x35')](_0x52b4ba[_0xa784('0x33')],_0x52b4ba[_0xa784('0x31')]);_0x265d09[_0xa784('0x34')]=_['intersection'](_0x52b4ba[_0xa784('0x33')],qs['fields'](_0x4b970c[_0xa784('0x31')][_0xa784('0x36')]));_0x265d09[_0xa784('0x34')]=_0x265d09[_0xa784('0x34')][_0xa784('0x47')]?_0x265d09[_0xa784('0x34')]:_0x52b4ba[_0xa784('0x33')];_0x265d09[_0xa784('0x39')]=qs[_0xa784('0x57')](_0x4b970c[_0xa784('0x31')][_0xa784('0x57')]);_0x265d09[_0xa784('0x3a')]=qs['filters'](_[_0xa784('0x3b')](_0x4b970c[_0xa784('0x31')],_0x52b4ba['filters']));if(_0x4b970c[_0xa784('0x31')][_0xa784('0x3c')]){_0x265d09['where']=_['merge'](_0x265d09[_0xa784('0x3a')],{'$or':_[_0xa784('0x3e')](_0x265d09['attributes'],function(_0x23ddb5){var _0x28c75d={};_0x28c75d[_0x23ddb5]={'$like':'%'+_0x4b970c[_0xa784('0x31')][_0xa784('0x3c')]+'%'};return _0x28c75d;})});}_0x265d09=_[_0xa784('0x3d')]({},_0x265d09,_0x4b970c['options']);return _0x41fd09[_0xa784('0x62')](_0x265d09);}})[_0xa784('0x27')](function(_0x4e5a82){if(_0x4e5a82){_0xc91f64=_0x4e5a82[_0xa784('0x47')];if(!_0x4b970c[_0xa784('0x31')][_0xa784('0x63')](_0xa784('0x37'))){_0x265d09[_0xa784('0x38')]=qs[_0xa784('0x38')](_0x4b970c[_0xa784('0x31')][_0xa784('0x38')]);_0x265d09['offset']=qs['offset'](_0x4b970c[_0xa784('0x31')][_0xa784('0x20')]);}return _0x41fd09[_0xa784('0x62')](_0x265d09);}})[_0xa784('0x27')](function(_0x5dc2e7){if(_0x5dc2e7){return _0x5dc2e7?{'count':_0xc91f64,'rows':_0x5dc2e7}:null;}})[_0xa784('0x27')](respondWithResult(_0x78a8bc,null))[_0xa784('0x44')](handleError(_0x78a8bc,null));};exports[_0xa784('0x64')]=function(_0x5bfc66,_0x1d97a3,_0x36e60e){var _0x5bc3d8=_0x5bfc66[_0xa784('0x4b')][_0xa784('0x65')];return db[_0xa784('0x66')][_0xa784('0x59')]({'where':{'id':_0x5bc3d8},'attributes':['id'],'include':[{'model':db[_0xa784('0x5a')],'as':_0xa784('0x67'),'attributes':['id',_0xa784('0x2c'),_0xa784('0x68'),_0xa784('0x69'),_0xa784('0x6a')],'raw':!![]}]})['then'](function(_0xb1ca72){if(_0xb1ca72){var _0x2371d2=_[_0xa784('0x6b')](_0xb1ca72,function(_0x3162f0){var _0x3da92d=_0x3162f0[_0xa784('0x4e')]({'plain':!![]});return _0x3da92d[_0xa784('0x67')];});return db['SmsQueue'][_0xa784('0x49')]({'where':{'id':_0x5bfc66[_0xa784('0x46')]['id']}})[_0xa784('0x27')](function(_0x3622fe){return db['sequelize']['transaction'](function(_0x5317fb){return _0x3622fe['addTeams'](_0x5bc3d8,{'transaction':_0x5317fb})[_0xa784('0x27')](function(){return BPromise['each'](_0x2371d2,function(_0x382c2a){return db[_0xa784('0x56')][_0xa784('0x6c')]({'where':{'UserId':_0x382c2a['id'],'SmsQueueId':_0x5bfc66[_0xa784('0x46')]['id']},'transaction':_0x5317fb});});})[_0xa784('0x27')](function(){_0x2371d2[_0xa784('0x6d')](function(_0x2c38ef){socket[_0xa784('0x6e')](_0xa784('0x6f'),{'UserId':_0x2c38ef['id'],'SmsQueueId':_0x3622fe['id']});});});});});}})[_0xa784('0x27')](respondWithStatusCode(_0x1d97a3,null))[_0xa784('0x44')](handleError(_0x1d97a3,null));};exports['removeTeams']=function(_0x57a426,_0x692ace,_0x6237c5){return db[_0xa784('0x66')][_0xa784('0x59')]({'where':{'id':_0x57a426['query'][_0xa784('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa784('0x67'),'attributes':['id'],'raw':!![]}]})[_0xa784('0x27')](handleEntityNotFound(_0x692ace,null))[_0xa784('0x27')](function(_0x1093fd){var _0xf0d6f7=_[_0xa784('0x3e')](_0x1093fd,'id');var _0x555667=[];var _0x431e14=[];var _0x133807=squel['select']();_0x133807[_0xa784('0x41')](_0xa784('0x70'))['from']('team_has_sms_queues','tq')[_0xa784('0x71')](_0xa784('0x72'),'ut',_0xa784('0x73'))[_0xa784('0x3a')](_0xa784('0x74'),_0x57a426[_0xa784('0x46')]['id']);for(var _0x380df3=0x0;_0x380df3<_0x1093fd['length'];_0x380df3+=0x1){let _0x4f9f13=_0x1093fd[_0x380df3];for(var _0x469037=0x0;_0x469037<_0x4f9f13[_0xa784('0x67')]['length'];_0x469037+=0x1){let _0x2f913f=_0x4f9f13[_0xa784('0x67')][_0x469037];var _0x1f0df6=_0x133807[_0xa784('0x75')]();_0x1f0df6['where'](_0xa784('0x76'),_0x2f913f['id']);_0x431e14[_0xa784('0x77')](db[_0xa784('0x78')][_0xa784('0x31')](_0x1f0df6[_0xa784('0x79')](),{'type':db['sequelize'][_0xa784('0x7a')][_0xa784('0x7b')]})[_0xa784('0x27')](function(_0x5bfd2a){if(_0x5bfd2a['length']===0x1){return _0x2f913f['id'];}else{var _0x18ff0f=_[_0xa784('0x7c')](_['map'](_0x5bfd2a,'TeamId'),function(_0x4dd4de){return _[_0xa784('0x7d')](_0xf0d6f7,_0x4dd4de);});if(_0x18ff0f){return _0x2f913f['id'];}}}));}}return BPromise[_0xa784('0x7e')](_0x431e14)[_0xa784('0x27')](function(_0x25ab47){_0x555667=_(_0x555667)[_0xa784('0x7f')](_0x25ab47)[_0xa784('0x80')]()[_0xa784('0x81')]();return db['SmsQueue']['find']({'where':{'id':_0x57a426['params']['id']}})['then'](function(_0xb58155){return db[_0xa784('0x78')][_0xa784('0x82')](function(_0x42dcad){return _0xb58155['removeTeams'](_0x57a426[_0xa784('0x31')][_0xa784('0x65')],{'transaction':_0x42dcad})[_0xa784('0x27')](function(){if(!_[_0xa784('0x83')](_0x555667)){return _0xb58155[_0xa784('0x84')](_0x555667,{'transaction':_0x42dcad});}})[_0xa784('0x27')](function(){_0x555667[_0xa784('0x6d')](function(_0x459938){socket['emit'](_0xa784('0x85'),{'UserId':_0x459938,'SmsQueueId':_0xb58155['id']});});});});});});})[_0xa784('0x27')](respondWithStatusCode(_0x692ace,null))[_0xa784('0x44')](handleError(_0x692ace,null));};exports[_0xa784('0x86')]=function(_0x293926,_0x38e8b4,_0x54165f){return db[_0xa784('0x2e')]['find']({'where':{'id':_0x293926[_0xa784('0x46')]['id']}})[_0xa784('0x27')](handleEntityNotFound(_0x38e8b4,null))[_0xa784('0x27')](function(_0x2c2367){if(_0x2c2367){return _0x2c2367[_0xa784('0x86')](_0x293926[_0xa784('0x4b')]['ids'],_[_0xa784('0x87')](_0x293926[_0xa784('0x4b')],['ids','id'])||{})['spread'](function(_0x3794d6){for(var _0x30f3fe=0x0;_0x30f3fe<_0x293926['body'][_0xa784('0x65')][_0xa784('0x47')];_0x30f3fe+=0x1){socket[_0xa784('0x6e')](_0xa784('0x6f'),{'UserId':_0x293926[_0xa784('0x4b')][_0xa784('0x65')][_0x30f3fe],'SmsQueueId':_0x293926[_0xa784('0x46')]['id']});}return _0x3794d6;});}})[_0xa784('0x27')](respondWithResult(_0x38e8b4,null))[_0xa784('0x44')](handleError(_0x38e8b4,null));};exports[_0xa784('0x84')]=function(_0x23c781,_0x34ceaa,_0x34cdf4){return db[_0xa784('0x2e')]['find']({'where':{'id':_0x23c781[_0xa784('0x46')]['id']}})['then'](handleEntityNotFound(_0x34ceaa,null))['then'](function(_0x37bef4){if(_0x37bef4){return _0x37bef4[_0xa784('0x84')](_0x23c781['query'][_0xa784('0x65')])[_0xa784('0x27')](function(){if(_[_0xa784('0x88')](_0x23c781[_0xa784('0x31')][_0xa784('0x65')])){for(var _0x4c2039=0x0;_0x4c2039<_0x23c781[_0xa784('0x31')][_0xa784('0x65')][_0xa784('0x47')];_0x4c2039+=0x1){socket[_0xa784('0x6e')](_0xa784('0x85'),{'UserId':Number(_0x23c781['query']['ids'][_0x4c2039]),'SmsQueueId':Number(_0x23c781[_0xa784('0x46')]['id'])});}}else{socket[_0xa784('0x6e')]('userSmsQueue:remove',{'UserId':Number(_0x23c781['query'][_0xa784('0x65')]),'SmsQueueId':Number(_0x23c781[_0xa784('0x46')]['id'])});}});}})[_0xa784('0x27')](respondWithStatusCode(_0x34ceaa,null))[_0xa784('0x44')](handleError(_0x34ceaa,null));};exports['getAgents']=function(_0x2abae7,_0x566240,_0x7bb1fc){var _0x4f8904={};var _0x45e5e9={};var _0x2f1e21;var _0x1a75d5;return db[_0xa784('0x2e')][_0xa784('0x55')]({'where':{'id':_0x2abae7['params']['id']}})['then'](handleEntityNotFound(_0x566240,null))[_0xa784('0x27')](function(_0x454398){if(_0x454398){_0x2f1e21=_0x454398;_0x45e5e9['model']=_[_0xa784('0x30')](db[_0xa784('0x5a')]['rawAttributes']);_0x45e5e9['query']=_['keys'](_0x2abae7[_0xa784('0x31')]);_0x45e5e9[_0xa784('0x32')]=_[_0xa784('0x35')](_0x45e5e9[_0xa784('0x33')],_0x45e5e9['query']);_0x4f8904['attributes']=_[_0xa784('0x35')](_0x45e5e9[_0xa784('0x33')],qs[_0xa784('0x36')](_0x2abae7[_0xa784('0x31')][_0xa784('0x36')]));_0x4f8904[_0xa784('0x34')]=_0x4f8904[_0xa784('0x34')]['length']?_0x4f8904[_0xa784('0x34')]:_0x45e5e9['model'];_0x4f8904['order']=qs[_0xa784('0x57')](_0x2abae7['query']['sort']);_0x4f8904[_0xa784('0x3a')]=qs['filters'](_[_0xa784('0x3b')](_0x2abae7[_0xa784('0x31')],_0x45e5e9['filters']));if(_0x2abae7[_0xa784('0x31')][_0xa784('0x3c')]){_0x4f8904[_0xa784('0x3a')]=_[_0xa784('0x3d')](_0x4f8904[_0xa784('0x3a')],{'$or':_[_0xa784('0x3e')](_0x4f8904[_0xa784('0x34')],function(_0x2bbab4){var _0x48bad5={};_0x48bad5[_0x2bbab4]={'$like':'%'+_0x2abae7[_0xa784('0x31')][_0xa784('0x3c')]+'%'};return _0x48bad5;})});}_0x4f8904=_[_0xa784('0x3d')]({},_0x4f8904,_0x2abae7['options']);return _0x2f1e21['getAgents'](_0x4f8904);}})[_0xa784('0x27')](function(_0x4d419e){if(_0x4d419e){_0x1a75d5=_0x4d419e['length'];if(!_0x2abae7['query'][_0xa784('0x63')](_0xa784('0x37'))){_0x4f8904['limit']=qs[_0xa784('0x38')](_0x2abae7[_0xa784('0x31')][_0xa784('0x38')]);_0x4f8904[_0xa784('0x20')]=qs['offset'](_0x2abae7[_0xa784('0x31')][_0xa784('0x20')]);}return _0x2f1e21[_0xa784('0x89')](_0x4f8904);}})[_0xa784('0x27')](function(_0x2efa4e){if(_0x2efa4e){return _0x2efa4e?{'count':_0x1a75d5,'rows':_0x2efa4e}:null;}})[_0xa784('0x27')](respondWithResult(_0x566240,null))[_0xa784('0x44')](handleError(_0x566240,null));}; \ No newline at end of file +var _0xb39e=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','get','SmsQueues','UserProfileResource','destroy','then','stack','name','send','index','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','key','VIRTUAL','options','SmsQueue','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','SmsQueueId','map','UserSmsQueue','findAndCountAll','UserId','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','order','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x27ed2a,_0x20b936){var _0x1c97db=function(_0x36f83b){while(--_0x36f83b){_0x27ed2a['push'](_0x27ed2a['shift']());}};_0x1c97db(++_0x20b936);}(_0xb39e,0x196));var _0xeb39=function(_0x2778c6,_0x567ee9){_0x2778c6=_0x2778c6-0x0;var _0x30d7eb=_0xb39e[_0x2778c6];return _0x30d7eb;};'use strict';var pdf=require(_0xeb39('0x0'));var emlformat=require(_0xeb39('0x1'));var rimraf=require(_0xeb39('0x2'));var zipdir=require(_0xeb39('0x3'));var jsonpatch=require(_0xeb39('0x4'));var rp=require(_0xeb39('0x5'));var moment=require(_0xeb39('0x6'));var BPromise=require(_0xeb39('0x7'));var Mustache=require(_0xeb39('0x8'));var util=require(_0xeb39('0x9'));var path=require(_0xeb39('0xa'));var sox=require('sox');var csv=require(_0xeb39('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeb39('0xc'));var squel=require(_0xeb39('0xd'));var crypto=require(_0xeb39('0xe'));var jsforce=require(_0xeb39('0xf'));var deskjs=require(_0xeb39('0x10'));var toCsv=require(_0xeb39('0xb'));var querystring=require(_0xeb39('0x11'));var Papa=require(_0xeb39('0x12'));var Redis=require(_0xeb39('0x13'));var authService=require(_0xeb39('0x14'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb39('0x15'))(_0xeb39('0x16'));var utils=require(_0xeb39('0x17'));var config=require(_0xeb39('0x18'));var db=require(_0xeb39('0x19'))['db'];config[_0xeb39('0x1a')]=_[_0xeb39('0x1b')](config[_0xeb39('0x1a')],{'host':_0xeb39('0x1c'),'port':0x18eb});var socket=require(_0xeb39('0x1d'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x452cbd,_0x2939f6){_0x2939f6=_0x2939f6||0xcc;return function(_0x549e82){if(_0x549e82){return _0x452cbd[_0xeb39('0x1e')](_0x2939f6);}return _0x452cbd[_0xeb39('0x1f')](_0x2939f6)[_0xeb39('0x20')]();};}function respondWithResult(_0x4e34f6,_0x37dff4){_0x37dff4=_0x37dff4||0xc8;return function(_0x3a6786){if(_0x3a6786){return _0x4e34f6[_0xeb39('0x1f')](_0x37dff4)[_0xeb39('0x21')](_0x3a6786);}};}function respondWithFilteredResult(_0x19e6d8,_0x5f23ed){return function(_0x4017dc){if(_0x4017dc){var _0x580f3e=_0x4017dc[_0xeb39('0x22')],_0x147cad=_0x5f23ed['offset'],_0x55d282=_0x5f23ed[_0xeb39('0x23')]+_0x5f23ed[_0xeb39('0x24')],_0x41af02;if(_0x55d282>=_0x580f3e){_0x55d282=_0x580f3e;_0x41af02=0xc8;}else{_0x41af02=0xce;}_0x19e6d8['status'](_0x41af02);return _0x19e6d8[_0xeb39('0x25')](_0xeb39('0x26'),_0x147cad+'-'+_0x55d282+'/'+_0x580f3e)[_0xeb39('0x21')](_0x4017dc);}return null;};}function patchUpdates(_0x7b8cd7){return function(_0x291cf5){try{jsonpatch[_0xeb39('0x27')](_0x291cf5,_0x7b8cd7,!![]);}catch(_0x414d31){return BPromise[_0xeb39('0x28')](_0x414d31);}return _0x291cf5['save']();};}function saveUpdates(_0x1ef583,_0x1e32c6){return function(_0x194c2c){if(_0x194c2c){return _0x194c2c[_0xeb39('0x29')](_0x1ef583)['then'](function(_0x28a39f){return _0x28a39f;});}return null;};}function removeEntity(_0x1f210d,_0xbb67e5){return function(_0x3bc237){if(_0x3bc237){return _0x3bc237['destroy']()['then'](function(){var _0x3e36f2=_0x3bc237[_0xeb39('0x2a')]({'plain':!![]});var _0x4d183c=_0xeb39('0x2b');return db[_0xeb39('0x2c')][_0xeb39('0x2d')]({'where':{'type':_0x4d183c,'resourceId':_0x3e36f2['id']}})[_0xeb39('0x2e')](function(){return _0x3bc237;});})['then'](function(){_0x1f210d['status'](0xcc)[_0xeb39('0x20')]();});}};}function handleEntityNotFound(_0x459b2e,_0x2b7498){return function(_0x66b892){if(!_0x66b892){_0x459b2e[_0xeb39('0x1e')](0x194);}return _0x66b892;};}function handleError(_0x42f9a7,_0x5848c3){_0x5848c3=_0x5848c3||0x1f4;return function(_0x3d2760){logger['error'](_0x3d2760[_0xeb39('0x2f')]);if(_0x3d2760[_0xeb39('0x30')]){delete _0x3d2760[_0xeb39('0x30')];}_0x42f9a7[_0xeb39('0x1f')](_0x5848c3)[_0xeb39('0x31')](_0x3d2760);};}exports[_0xeb39('0x32')]=function(_0x220131,_0x5c6f70){var _0x115766={},_0x1fd2cb={},_0xe0aca4={'count':0x0,'rows':[]};var _0x380fca=db['SmsQueue']['rawAttributes'];_0x1fd2cb[_0xeb39('0x33')]=_['keys'](_0x380fca);_0x1fd2cb[_0xeb39('0x34')]=_['keys'](_0x220131[_0xeb39('0x34')]);_0x1fd2cb['filters']=_[_0xeb39('0x35')](_0x1fd2cb[_0xeb39('0x33')],_0x1fd2cb[_0xeb39('0x34')]);_0x115766[_0xeb39('0x36')]=_[_0xeb39('0x35')](_0x1fd2cb[_0xeb39('0x33')],qs[_0xeb39('0x37')](_0x220131[_0xeb39('0x34')][_0xeb39('0x37')]));_0x115766[_0xeb39('0x36')]=_0x115766[_0xeb39('0x36')][_0xeb39('0x38')]?_0x115766[_0xeb39('0x36')]:_0x1fd2cb[_0xeb39('0x33')];if(!_0x220131[_0xeb39('0x34')][_0xeb39('0x39')](_0xeb39('0x3a'))){_0x115766[_0xeb39('0x24')]=qs['limit'](_0x220131[_0xeb39('0x34')][_0xeb39('0x24')]);_0x115766[_0xeb39('0x23')]=qs[_0xeb39('0x23')](_0x220131[_0xeb39('0x34')][_0xeb39('0x23')]);}_0x115766['order']=qs[_0xeb39('0x3b')](_0x220131[_0xeb39('0x34')][_0xeb39('0x3b')]);_0x115766[_0xeb39('0x3c')]=qs['filters'](_[_0xeb39('0x3d')](_0x220131[_0xeb39('0x34')],_0x1fd2cb['filters']));if(_0x220131[_0xeb39('0x34')][_0xeb39('0x3e')]){_0x115766['where']=_[_0xeb39('0x3f')](_0x115766[_0xeb39('0x3c')],{'$or':_['map'](_0x380fca,function(_0x2aa612){if(_0x2aa612[_0xeb39('0x40')][_0xeb39('0x41')]!==_0xeb39('0x42')){var _0xedd270={};_0xedd270[_0x2aa612['field']]={'$like':'%'+_0x220131[_0xeb39('0x34')][_0xeb39('0x3e')]+'%'};return _0xedd270;}})});}_0x115766=_[_0xeb39('0x3f')]({},_0x115766,_0x220131[_0xeb39('0x43')]);var _0x1a36ae={'where':_0x115766[_0xeb39('0x3c')]};return db[_0xeb39('0x44')][_0xeb39('0x22')](_0x1a36ae)[_0xeb39('0x2e')](function(_0x3c2e97){_0xe0aca4[_0xeb39('0x22')]=_0x3c2e97;if(_0x220131[_0xeb39('0x34')][_0xeb39('0x45')]){_0x115766[_0xeb39('0x46')]=[{'all':!![]}];}return db[_0xeb39('0x44')][_0xeb39('0x47')](_0x115766);})[_0xeb39('0x2e')](function(_0x42fc5e){_0xe0aca4[_0xeb39('0x48')]=_0x42fc5e;return _0xe0aca4;})[_0xeb39('0x2e')](respondWithFilteredResult(_0x5c6f70,_0x115766))[_0xeb39('0x49')](handleError(_0x5c6f70,null));};exports[_0xeb39('0x4a')]=function(_0x187524,_0x5e6ed0){var _0x57f0e7={'raw':!![],'where':{'id':_0x187524[_0xeb39('0x4b')]['id']}},_0xb24478={};_0xb24478[_0xeb39('0x33')]=_[_0xeb39('0x4c')](db[_0xeb39('0x44')][_0xeb39('0x4d')]);_0xb24478[_0xeb39('0x34')]=_[_0xeb39('0x4c')](_0x187524[_0xeb39('0x34')]);_0xb24478[_0xeb39('0x4e')]=_[_0xeb39('0x35')](_0xb24478[_0xeb39('0x33')],_0xb24478['query']);_0x57f0e7[_0xeb39('0x36')]=_[_0xeb39('0x35')](_0xb24478[_0xeb39('0x33')],qs[_0xeb39('0x37')](_0x187524[_0xeb39('0x34')][_0xeb39('0x37')]));_0x57f0e7[_0xeb39('0x36')]=_0x57f0e7['attributes'][_0xeb39('0x38')]?_0x57f0e7['attributes']:_0xb24478['model'];if(_0x187524['query'][_0xeb39('0x45')]){_0x57f0e7[_0xeb39('0x46')]=[{'all':!![]}];}_0x57f0e7=_[_0xeb39('0x3f')]({},_0x57f0e7,_0x187524['options']);return db['SmsQueue'][_0xeb39('0x4f')](_0x57f0e7)[_0xeb39('0x2e')](handleEntityNotFound(_0x5e6ed0,null))[_0xeb39('0x2e')](respondWithResult(_0x5e6ed0,null))['catch'](handleError(_0x5e6ed0,null));};exports[_0xeb39('0x50')]=function(_0x548ad,_0x28d183){return db[_0xeb39('0x44')][_0xeb39('0x50')](_0x548ad[_0xeb39('0x51')],{})[_0xeb39('0x2e')](function(_0x15128a){var _0x1b166e=_0x548ad[_0xeb39('0x52')][_0xeb39('0x2a')]({'plain':!![]});if(!_0x1b166e)throw new Error(_0xeb39('0x53'));if(_0x1b166e[_0xeb39('0x54')]===_0xeb39('0x52')){var _0x8d113=_0x15128a[_0xeb39('0x2a')]({'plain':!![]});var _0x15c8ab=_0xeb39('0x2b');return db[_0xeb39('0x55')][_0xeb39('0x4f')]({'where':{'name':_0x15c8ab,'userProfileId':_0x1b166e[_0xeb39('0x56')]},'raw':!![]})[_0xeb39('0x2e')](function(_0x552783){if(_0x552783&&_0x552783[_0xeb39('0x57')]===0x0){return db[_0xeb39('0x2c')]['create']({'name':_0x8d113[_0xeb39('0x30')],'resourceId':_0x8d113['id'],'type':_0x552783['name'],'sectionId':_0x552783['id']},{})['then'](function(){return _0x15128a;});}else{return _0x15128a;}})['catch'](function(_0x555ff7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x555ff7);throw _0x555ff7;});}return _0x15128a;})[_0xeb39('0x2e')](respondWithResult(_0x28d183,0xc9))['catch'](handleError(_0x28d183,null));};exports[_0xeb39('0x29')]=function(_0x2ad98f,_0x167ac7){if(_0x2ad98f['body']['id']){delete _0x2ad98f[_0xeb39('0x51')]['id'];}return db[_0xeb39('0x44')][_0xeb39('0x4f')]({'where':{'id':_0x2ad98f['params']['id']}})[_0xeb39('0x2e')](handleEntityNotFound(_0x167ac7,null))[_0xeb39('0x2e')](saveUpdates(_0x2ad98f[_0xeb39('0x51')],null))['then'](respondWithResult(_0x167ac7,null))[_0xeb39('0x49')](handleError(_0x167ac7,null));};exports['destroy']=function(_0x13c52d,_0x589ec0){return db[_0xeb39('0x44')]['find']({'where':{'id':_0x13c52d[_0xeb39('0x4b')]['id']}})[_0xeb39('0x2e')](handleEntityNotFound(_0x589ec0,null))[_0xeb39('0x2e')](removeEntity(_0x589ec0,null))[_0xeb39('0x49')](handleError(_0x589ec0,null));};exports[_0xeb39('0x58')]=function(_0x25312f,_0x5193af){return db[_0xeb39('0x44')][_0xeb39('0x58')]()['then'](respondWithResult(_0x5193af,null))[_0xeb39('0x49')](handleError(_0x5193af,null));};exports[_0xeb39('0x59')]=function(_0x539880,_0x4988ee,_0x1e78e0){var _0xe71747={'raw':!![],'where':{}},_0x2382c1={},_0xd20da6;return db['SmsQueue']['findOne']({'where':{'id':_0x539880['params']['id']}})['then'](handleEntityNotFound(_0x4988ee,null))[_0xeb39('0x2e')](function(_0x10ceb6){if(_0x10ceb6){_0xd20da6=_0x10ceb6['get']({'plain':!![]});_0x2382c1['model']=_[_0xeb39('0x4c')](db['UserSmsQueue']['rawAttributes']);_0x2382c1[_0xeb39('0x34')]=_[_0xeb39('0x4c')](_0x539880[_0xeb39('0x34')]);_0x2382c1['filters']=_[_0xeb39('0x35')](_0x2382c1[_0xeb39('0x33')],_0x2382c1[_0xeb39('0x34')]);_0xe71747[_0xeb39('0x36')]=_['intersection'](_0x2382c1[_0xeb39('0x33')],qs[_0xeb39('0x37')](_0x539880[_0xeb39('0x34')][_0xeb39('0x37')]));_0xe71747[_0xeb39('0x36')]=_0xe71747['attributes'][_0xeb39('0x38')]?_0xe71747['attributes']:_0x2382c1[_0xeb39('0x33')];if(!_0x539880[_0xeb39('0x34')][_0xeb39('0x39')](_0xeb39('0x3a'))){_0xe71747['limit']=qs[_0xeb39('0x24')](_0x539880[_0xeb39('0x34')][_0xeb39('0x24')]);_0xe71747[_0xeb39('0x23')]=qs[_0xeb39('0x23')](_0x539880[_0xeb39('0x34')][_0xeb39('0x23')]);}_0xe71747['order']=qs['sort'](_0x539880[_0xeb39('0x34')][_0xeb39('0x3b')]);_0xe71747['where']=qs[_0xeb39('0x4e')](_[_0xeb39('0x3d')](_0x539880[_0xeb39('0x34')],_0x2382c1['filters']));_0xe71747[_0xeb39('0x3c')][_0xeb39('0x5a')]=_0x10ceb6['id'];if(_0x539880['query']['filter']){_0xe71747[_0xeb39('0x3c')]=_[_0xeb39('0x3f')](_0xe71747['where'],{'$or':_[_0xeb39('0x5b')](_0xe71747['attributes'],function(_0x389e41){var _0x545da0={};_0x545da0[_0x389e41]={'$like':'%'+_0x539880[_0xeb39('0x34')]['filter']+'%'};return _0x545da0;})});}_0xe71747=_[_0xeb39('0x3f')]({},_0xe71747,_0x539880['options']);return db[_0xeb39('0x5c')][_0xeb39('0x47')](_0xe71747);}})[_0xeb39('0x2e')](function(_0x3c7fec){if(_0x3c7fec){return db['User'][_0xeb39('0x5d')]({'where':{'id':_[_0xeb39('0x5b')](_0x3c7fec,_0xeb39('0x5e')),'role':_0xeb39('0x5f')},'attributes':['id',_0xeb39('0x30'),_0xeb39('0x60'),'updatedAt',_0xeb39('0x61')]});}})[_0xeb39('0x2e')](function(_0x29e5f0){if(_0x29e5f0){return{'count':_0x29e5f0[_0xeb39('0x22')],'rows':_['map'](_0x29e5f0['rows'],function(_0x2407f1){return{'membername':_0x2407f1[_0xeb39('0x30')],'UserId':_0x2407f1['id'],'queue_name':_0xd20da6[_0xeb39('0x30')],'SmsQueueId':_0xd20da6['id'],'interface':util[_0xeb39('0x62')](_0xeb39('0x63'),_0xeb39('0x64'),_0x2407f1[_0xeb39('0x30')]),'penalty':0x0,'paused':_0x2407f1[_0xeb39('0x60')],'createdAt':_0x2407f1[_0xeb39('0x61')],'updatedAt':_0x2407f1[_0xeb39('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4988ee,_0xe71747))[_0xeb39('0x49')](handleError(_0x4988ee,null));};exports[_0xeb39('0x66')]=function(_0x393864,_0x4fa9c6,_0x4bb053){var _0x323d00={};var _0x573aaf={};var _0x4616ef;var _0x192c7c;return db[_0xeb39('0x44')][_0xeb39('0x67')]({'where':{'id':_0x393864[_0xeb39('0x4b')]['id']}})[_0xeb39('0x2e')](handleEntityNotFound(_0x4fa9c6,null))[_0xeb39('0x2e')](function(_0x5add00){if(_0x5add00){_0x4616ef=_0x5add00;_0x573aaf[_0xeb39('0x33')]=_['keys'](db[_0xeb39('0x68')]['rawAttributes']);_0x573aaf[_0xeb39('0x34')]=_['keys'](_0x393864[_0xeb39('0x34')]);_0x573aaf[_0xeb39('0x4e')]=_[_0xeb39('0x35')](_0x573aaf['model'],_0x573aaf['query']);_0x323d00[_0xeb39('0x36')]=_[_0xeb39('0x35')](_0x573aaf[_0xeb39('0x33')],qs[_0xeb39('0x37')](_0x393864[_0xeb39('0x34')][_0xeb39('0x37')]));_0x323d00[_0xeb39('0x36')]=_0x323d00[_0xeb39('0x36')]['length']?_0x323d00[_0xeb39('0x36')]:_0x573aaf[_0xeb39('0x33')];_0x323d00[_0xeb39('0x69')]=qs[_0xeb39('0x3b')](_0x393864[_0xeb39('0x34')][_0xeb39('0x3b')]);_0x323d00['where']=qs[_0xeb39('0x4e')](_[_0xeb39('0x3d')](_0x393864[_0xeb39('0x34')],_0x573aaf['filters']));if(_0x393864[_0xeb39('0x34')]['filter']){_0x323d00[_0xeb39('0x3c')]=_[_0xeb39('0x3f')](_0x323d00['where'],{'$or':_['map'](_0x323d00[_0xeb39('0x36')],function(_0x4ab0d0){var _0x427630={};_0x427630[_0x4ab0d0]={'$like':'%'+_0x393864[_0xeb39('0x34')][_0xeb39('0x3e')]+'%'};return _0x427630;})});}_0x323d00=_['merge']({},_0x323d00,_0x393864['options']);return _0x4616ef['getTeams'](_0x323d00);}})[_0xeb39('0x2e')](function(_0x73f0d2){if(_0x73f0d2){_0x192c7c=_0x73f0d2[_0xeb39('0x38')];if(!_0x393864[_0xeb39('0x34')][_0xeb39('0x39')](_0xeb39('0x3a'))){_0x323d00[_0xeb39('0x24')]=qs[_0xeb39('0x24')](_0x393864['query'][_0xeb39('0x24')]);_0x323d00['offset']=qs[_0xeb39('0x23')](_0x393864[_0xeb39('0x34')][_0xeb39('0x23')]);}return _0x4616ef['getTeams'](_0x323d00);}})[_0xeb39('0x2e')](function(_0x2e7e4f){if(_0x2e7e4f){return _0x2e7e4f?{'count':_0x192c7c,'rows':_0x2e7e4f}:null;}})['then'](respondWithResult(_0x4fa9c6,null))[_0xeb39('0x49')](handleError(_0x4fa9c6,null));};exports[_0xeb39('0x6a')]=function(_0x363a83,_0x4cbb6b,_0x79b07){var _0x2c0627=_0x363a83[_0xeb39('0x51')]['ids'];return db[_0xeb39('0x68')][_0xeb39('0x47')]({'where':{'id':_0x2c0627},'attributes':['id'],'include':[{'model':db[_0xeb39('0x6b')],'as':_0xeb39('0x6c'),'attributes':['id',_0xeb39('0x30'),_0xeb39('0x6d'),_0xeb39('0x6e'),_0xeb39('0x6f')],'raw':!![]}]})[_0xeb39('0x2e')](function(_0x416e84){if(_0x416e84){var _0x207451=_[_0xeb39('0x70')](_0x416e84,function(_0x7c7bef){var _0x2af3ad=_0x7c7bef[_0xeb39('0x2a')]({'plain':!![]});return _0x2af3ad[_0xeb39('0x6c')];});return db[_0xeb39('0x44')]['find']({'where':{'id':_0x363a83[_0xeb39('0x4b')]['id']}})[_0xeb39('0x2e')](function(_0x54812b){return db[_0xeb39('0x71')][_0xeb39('0x72')](function(_0x1feef0){return _0x54812b[_0xeb39('0x6a')](_0x2c0627,{'transaction':_0x1feef0})[_0xeb39('0x2e')](function(){return BPromise['each'](_0x207451,function(_0x154722){return db[_0xeb39('0x5c')][_0xeb39('0x73')]({'where':{'UserId':_0x154722['id'],'SmsQueueId':_0x363a83['params']['id']},'transaction':_0x1feef0});});})['then'](function(){_0x207451[_0xeb39('0x74')](function(_0x1e9bdf){socket['emit'](_0xeb39('0x75'),{'UserId':_0x1e9bdf['id'],'SmsQueueId':_0x54812b['id']});});});});});}})[_0xeb39('0x2e')](respondWithStatusCode(_0x4cbb6b,null))['catch'](handleError(_0x4cbb6b,null));};exports[_0xeb39('0x76')]=function(_0x141904,_0x9d5818,_0x418eb2){return db[_0xeb39('0x68')]['findAll']({'where':{'id':_0x141904[_0xeb39('0x34')][_0xeb39('0x77')]},'attributes':['id'],'include':[{'model':db[_0xeb39('0x6b')],'as':_0xeb39('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x9d5818,null))[_0xeb39('0x2e')](function(_0x57a916){var _0x243609=_['map'](_0x57a916,'id');var _0x554d20=[];var _0x3f428f=[];var _0x530872=squel[_0xeb39('0x78')]();_0x530872['field']('tq.TeamId')[_0xeb39('0x79')](_0xeb39('0x7a'),'tq')[_0xeb39('0x7b')](_0xeb39('0x7c'),'ut',_0xeb39('0x7d'))[_0xeb39('0x3c')](_0xeb39('0x7e'),_0x141904[_0xeb39('0x4b')]['id']);for(var _0x522184=0x0;_0x522184<_0x57a916[_0xeb39('0x38')];_0x522184+=0x1){let _0x350c88=_0x57a916[_0x522184];for(var _0x453f70=0x0;_0x453f70<_0x350c88[_0xeb39('0x6c')][_0xeb39('0x38')];_0x453f70+=0x1){let _0x23dbc6=_0x350c88[_0xeb39('0x6c')][_0x453f70];var _0x39e114=_0x530872[_0xeb39('0x7f')]();_0x39e114[_0xeb39('0x3c')](_0xeb39('0x80'),_0x23dbc6['id']);_0x3f428f['push'](db[_0xeb39('0x71')]['query'](_0x39e114[_0xeb39('0x81')](),{'type':db[_0xeb39('0x71')][_0xeb39('0x82')][_0xeb39('0x83')]})[_0xeb39('0x2e')](function(_0x3941ee){if(_0x3941ee[_0xeb39('0x38')]===0x1){return _0x23dbc6['id'];}else{var _0x5311c9=_[_0xeb39('0x84')](_[_0xeb39('0x5b')](_0x3941ee,_0xeb39('0x85')),function(_0x5d1c73){return _['includes'](_0x243609,_0x5d1c73);});if(_0x5311c9){return _0x23dbc6['id'];}}}));}}return BPromise[_0xeb39('0x86')](_0x3f428f)[_0xeb39('0x2e')](function(_0x26045f){_0x554d20=_(_0x554d20)[_0xeb39('0x87')](_0x26045f)['compact']()['value']();return db[_0xeb39('0x44')]['find']({'where':{'id':_0x141904[_0xeb39('0x4b')]['id']}})[_0xeb39('0x2e')](function(_0x5515b4){return db[_0xeb39('0x71')][_0xeb39('0x72')](function(_0xfb6f3e){return _0x5515b4[_0xeb39('0x76')](_0x141904['query']['ids'],{'transaction':_0xfb6f3e})[_0xeb39('0x2e')](function(){if(!_[_0xeb39('0x88')](_0x554d20)){return _0x5515b4[_0xeb39('0x89')](_0x554d20,{'transaction':_0xfb6f3e});}})[_0xeb39('0x2e')](function(){_0x554d20[_0xeb39('0x74')](function(_0x5045a6){socket['emit'](_0xeb39('0x8a'),{'UserId':_0x5045a6,'SmsQueueId':_0x5515b4['id']});});});});});});})[_0xeb39('0x2e')](respondWithStatusCode(_0x9d5818,null))['catch'](handleError(_0x9d5818,null));};exports[_0xeb39('0x8b')]=function(_0x21112f,_0x4551d2,_0x15b776){return db[_0xeb39('0x44')][_0xeb39('0x4f')]({'where':{'id':_0x21112f[_0xeb39('0x4b')]['id']}})[_0xeb39('0x2e')](handleEntityNotFound(_0x4551d2,null))['then'](function(_0x36f21d){if(_0x36f21d){return _0x36f21d['addAgents'](_0x21112f[_0xeb39('0x51')][_0xeb39('0x77')],_[_0xeb39('0x8c')](_0x21112f['body'],[_0xeb39('0x77'),'id'])||{})[_0xeb39('0x8d')](function(_0x3a52f1){for(var _0x444227=0x0;_0x444227<_0x21112f[_0xeb39('0x51')][_0xeb39('0x77')]['length'];_0x444227+=0x1){socket[_0xeb39('0x8e')](_0xeb39('0x75'),{'UserId':_0x21112f[_0xeb39('0x51')][_0xeb39('0x77')][_0x444227],'SmsQueueId':_0x21112f['params']['id']});}return _0x3a52f1;});}})[_0xeb39('0x2e')](respondWithResult(_0x4551d2,null))['catch'](handleError(_0x4551d2,null));};exports[_0xeb39('0x89')]=function(_0x3d2a44,_0x26477a,_0x17a37e){return db[_0xeb39('0x44')][_0xeb39('0x4f')]({'where':{'id':_0x3d2a44['params']['id']}})[_0xeb39('0x2e')](handleEntityNotFound(_0x26477a,null))[_0xeb39('0x2e')](function(_0xbb7e1a){if(_0xbb7e1a){return _0xbb7e1a[_0xeb39('0x89')](_0x3d2a44[_0xeb39('0x34')][_0xeb39('0x77')])['then'](function(){if(_['isArray'](_0x3d2a44['query'][_0xeb39('0x77')])){for(var _0x1e9e34=0x0;_0x1e9e34<_0x3d2a44[_0xeb39('0x34')][_0xeb39('0x77')][_0xeb39('0x38')];_0x1e9e34+=0x1){socket[_0xeb39('0x8e')](_0xeb39('0x8a'),{'UserId':Number(_0x3d2a44[_0xeb39('0x34')]['ids'][_0x1e9e34]),'SmsQueueId':Number(_0x3d2a44[_0xeb39('0x4b')]['id'])});}}else{socket[_0xeb39('0x8e')](_0xeb39('0x8a'),{'UserId':Number(_0x3d2a44[_0xeb39('0x34')][_0xeb39('0x77')]),'SmsQueueId':Number(_0x3d2a44[_0xeb39('0x4b')]['id'])});}});}})[_0xeb39('0x2e')](respondWithStatusCode(_0x26477a,null))[_0xeb39('0x49')](handleError(_0x26477a,null));};exports[_0xeb39('0x8f')]=function(_0x5c4eb6,_0x3979d6,_0x145150){var _0x1cf99f={};var _0x2c8ea1={};var _0x4b4a11;var _0x28e140;return db[_0xeb39('0x44')][_0xeb39('0x67')]({'where':{'id':_0x5c4eb6['params']['id']}})[_0xeb39('0x2e')](handleEntityNotFound(_0x3979d6,null))['then'](function(_0x57f275){if(_0x57f275){_0x4b4a11=_0x57f275;_0x2c8ea1[_0xeb39('0x33')]=_[_0xeb39('0x4c')](db[_0xeb39('0x6b')][_0xeb39('0x4d')]);_0x2c8ea1[_0xeb39('0x34')]=_[_0xeb39('0x4c')](_0x5c4eb6['query']);_0x2c8ea1[_0xeb39('0x4e')]=_[_0xeb39('0x35')](_0x2c8ea1['model'],_0x2c8ea1[_0xeb39('0x34')]);_0x1cf99f['attributes']=_['intersection'](_0x2c8ea1['model'],qs['fields'](_0x5c4eb6['query']['fields']));_0x1cf99f[_0xeb39('0x36')]=_0x1cf99f['attributes'][_0xeb39('0x38')]?_0x1cf99f[_0xeb39('0x36')]:_0x2c8ea1[_0xeb39('0x33')];_0x1cf99f[_0xeb39('0x69')]=qs[_0xeb39('0x3b')](_0x5c4eb6[_0xeb39('0x34')]['sort']);_0x1cf99f[_0xeb39('0x3c')]=qs[_0xeb39('0x4e')](_[_0xeb39('0x3d')](_0x5c4eb6['query'],_0x2c8ea1['filters']));if(_0x5c4eb6['query']['filter']){_0x1cf99f['where']=_['merge'](_0x1cf99f['where'],{'$or':_['map'](_0x1cf99f[_0xeb39('0x36')],function(_0x2c1726){var _0x55dea9={};_0x55dea9[_0x2c1726]={'$like':'%'+_0x5c4eb6['query']['filter']+'%'};return _0x55dea9;})});}_0x1cf99f=_[_0xeb39('0x3f')]({},_0x1cf99f,_0x5c4eb6[_0xeb39('0x43')]);return _0x4b4a11[_0xeb39('0x8f')](_0x1cf99f);}})[_0xeb39('0x2e')](function(_0x265c3c){if(_0x265c3c){_0x28e140=_0x265c3c[_0xeb39('0x38')];if(!_0x5c4eb6[_0xeb39('0x34')][_0xeb39('0x39')](_0xeb39('0x3a'))){_0x1cf99f['limit']=qs['limit'](_0x5c4eb6[_0xeb39('0x34')][_0xeb39('0x24')]);_0x1cf99f[_0xeb39('0x23')]=qs[_0xeb39('0x23')](_0x5c4eb6['query']['offset']);}return _0x4b4a11['getAgents'](_0x1cf99f);}})[_0xeb39('0x2e')](function(_0x18a0e){if(_0x18a0e){return _0x18a0e?{'count':_0x28e140,'rows':_0x18a0e}:null;}})['then'](respondWithResult(_0x3979d6,null))[_0xeb39('0x49')](handleError(_0x3979d6,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 01479da..4cd0241 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 _0x3c00=['../../mysqldb','SmsQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x33276f,_0xa991d5){var _0x51213c=function(_0x3571fe){while(--_0x3571fe){_0x33276f['push'](_0x33276f['shift']());}};_0x51213c(++_0xa991d5);}(_0x3c00,0x149));var _0x03c0=function(_0x16313e,_0x56b1cc){_0x16313e=_0x16313e-0x0;var _0x30ae5e=_0x3c00[_0x16313e];return _0x30ae5e;};'use strict';var EventEmitter=require(_0x03c0('0x0'));var SmsQueue=require(_0x03c0('0x1'))['db'][_0x03c0('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x03c0('0x3')](0x0);var events={'afterCreate':_0x03c0('0x4'),'afterUpdate':'update','afterDestroy':_0x03c0('0x5')};function emitEvent(_0xb3c06f){return function(_0x1b4a6f,_0x2788af,_0x2edda7){SmsQueueEvents['emit'](_0xb3c06f+':'+_0x1b4a6f['id'],_0x1b4a6f);SmsQueueEvents[_0x03c0('0x6')](_0xb3c06f,_0x1b4a6f);_0x2edda7(null);};}for(var e in events){if(events[_0x03c0('0x7')](e)){var event=events[e];SmsQueue[_0x03c0('0x8')](e,emitEvent(event));}}module[_0x03c0('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xba31=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x184a95,_0x500731){var _0x55eadf=function(_0x49fcd7){while(--_0x49fcd7){_0x184a95['push'](_0x184a95['shift']());}};_0x55eadf(++_0x500731);}(_0xba31,0x139));var _0x1ba3=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xba31[_0x1db251];return _0x56685a;};'use strict';var EventEmitter=require(_0x1ba3('0x0'));var SmsQueue=require(_0x1ba3('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1ba3('0x2')](0x0);var events={'afterCreate':_0x1ba3('0x3'),'afterUpdate':'update','afterDestroy':_0x1ba3('0x4')};function emitEvent(_0x1b274c){return function(_0x2f2654,_0x1dbfd1,_0x59c83a){SmsQueueEvents['emit'](_0x1b274c+':'+_0x2f2654['id'],_0x2f2654);SmsQueueEvents[_0x1ba3('0x5')](_0x1b274c,_0x2f2654);_0x59c83a(null);};}for(var e in events){if(events[_0x1ba3('0x6')](e)){var event=events[e];SmsQueue[_0x1ba3('0x7')](e,emitEvent(event));}}module[_0x1ba3('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 134eef2..cd2ed0f 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 _0xd624=['./smsQueue.attributes','sms_queues','util','api','bluebird','path'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xd624,0x146));var _0x4d62=function(_0x46927f,_0x53390d){_0x46927f=_0x46927f-0x0;var _0x147fd1=_0xd624[_0x46927f];return _0x147fd1;};'use strict';var _=require('lodash');var util=require(_0x4d62('0x0'));var logger=require('../../config/logger')(_0x4d62('0x1'));var moment=require('moment');var BPromise=require(_0x4d62('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d62('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4d62('0x4'));module['exports']=function(_0x1b1ce4,_0x209754){return _0x1b1ce4['define']('SmsQueue',attributes,{'tableName':_0x4d62('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe7b=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','bluebird','path','./smsQueue.attributes'];(function(_0x7eb573,_0x14a0a2){var _0x50a1b7=function(_0xd93f43){while(--_0xd93f43){_0x7eb573['push'](_0x7eb573['shift']());}};_0x50a1b7(++_0x14a0a2);}(_0xbe7b,0x66));var _0xbbe7=function(_0x4b44ac,_0x84990a){_0x4b44ac=_0x4b44ac-0x0;var _0x1f3c0a=_0xbe7b[_0x4b44ac];return _0x1f3c0a;};'use strict';var _=require(_0xbbe7('0x0'));var util=require(_0xbbe7('0x1'));var logger=require(_0xbbe7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbbe7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbe7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbe7('0x5'));module['exports']=function(_0x5cf089,_0x34c713){return _0x5cf089[_0xbbe7('0x6')](_0xbbe7('0x7'),attributes,{'tableName':_0xbbe7('0x8'),'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 f35a94c..a44beef 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 _0x774f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsQueue.socket','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','model','map','then','ShowSmsQueue','find','lodash'];(function(_0x58a4f5,_0x265915){var _0x5218a1=function(_0x36edef){while(--_0x36edef){_0x58a4f5['push'](_0x58a4f5['shift']());}};_0x5218a1(++_0x265915);}(_0x774f,0x9b));var _0xf774=function(_0x2238f5,_0x3e0089){_0x2238f5=_0x2238f5-0x0;var _0x225e8b=_0x774f[_0x2238f5];return _0x225e8b;};'use strict';var _=require(_0xf774('0x0'));var util=require(_0xf774('0x1'));var moment=require(_0xf774('0x2'));var BPromise=require(_0xf774('0x3'));var rs=require(_0xf774('0x4'));var fs=require('fs');var Redis=require(_0xf774('0x5'));var db=require(_0xf774('0x6'))['db'];var utils=require(_0xf774('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf774('0x8'));var jayson=require(_0xf774('0x9'));var client=jayson[_0xf774('0xa')][_0xf774('0xb')]({'port':0x232a});config['redis']=_[_0xf774('0xc')](config[_0xf774('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf774('0xe'))(new Redis(config['redis']));require(_0xf774('0xf'))['register'](socket);function respondWithRpcPromise(_0x1b52a3,_0x4bfe0f,_0x1ad325){return new BPromise(function(_0x2fb690,_0x489854){return client[_0xf774('0x10')](_0x1b52a3,_0x1ad325)['then'](function(_0x311d4a){logger[_0xf774('0x11')](_0xf774('0x12'),_0x4bfe0f,_0xf774('0x13'));logger['debug'](_0xf774('0x14'),_0x4bfe0f,_0xf774('0x13'),JSON[_0xf774('0x15')](_0x311d4a));if(_0x311d4a['error']){if(_0x311d4a[_0xf774('0x16')]['code']===0x1f4){logger[_0xf774('0x16')]('SmsQueue,\x20%s,\x20%s',_0x4bfe0f,_0x311d4a[_0xf774('0x16')]['message']);return _0x489854(_0x311d4a['error'][_0xf774('0x17')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x4bfe0f,_0x311d4a[_0xf774('0x16')]['message']);return _0x2fb690(_0x311d4a[_0xf774('0x16')][_0xf774('0x17')]);}else{logger['info'](_0xf774('0x12'),_0x4bfe0f,_0xf774('0x13'));_0x2fb690(_0x311d4a[_0xf774('0x18')]['message']);}})[_0xf774('0x19')](function(_0x324a56){logger[_0xf774('0x16')]('SmsQueue,\x20%s,\x20%s',_0x4bfe0f,_0x324a56);_0x489854(_0x324a56);});});}exports[_0xf774('0x1a')]=function(_0x262877){var _0x38c4ae=this;return new Promise(function(_0x80b556,_0x64e26c){return db[_0xf774('0x1b')]['findAll']({'raw':_0x262877[_0xf774('0x1c')]?_0x262877[_0xf774('0x1c')][_0xf774('0x1d')]===undefined?!![]:![]:!![],'where':_0x262877[_0xf774('0x1c')]?_0x262877[_0xf774('0x1c')][_0xf774('0x1e')]||null:null,'attributes':_0x262877[_0xf774('0x1c')]?_0x262877[_0xf774('0x1c')][_0xf774('0x1f')]||null:null,'limit':_0x262877[_0xf774('0x1c')]?_0x262877[_0xf774('0x1c')][_0xf774('0x20')]||null:null,'include':_0x262877['options']?_0x262877[_0xf774('0x1c')][_0xf774('0x21')]?_['map'](_0x262877[_0xf774('0x1c')][_0xf774('0x21')],function(_0x2d15ba){return{'model':db[_0x2d15ba[_0xf774('0x22')]],'as':_0x2d15ba['as'],'attributes':_0x2d15ba[_0xf774('0x1f')],'include':_0x2d15ba[_0xf774('0x21')]?_[_0xf774('0x23')](_0x2d15ba['include'],function(_0x46ec31){return{'model':db[_0x46ec31[_0xf774('0x22')]],'as':_0x46ec31['as'],'attributes':_0x46ec31[_0xf774('0x1f')],'include':_0x46ec31[_0xf774('0x21')]?_[_0xf774('0x23')](_0x46ec31[_0xf774('0x21')],function(_0x369b72){return{'model':db[_0x369b72[_0xf774('0x22')]],'as':_0x369b72['as'],'attributes':_0x369b72[_0xf774('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf774('0x24')](function(_0x50971d){logger[_0xf774('0x11')]('GetSmsQueue',_0x262877);logger['debug']('GetSmsQueue',_0x262877,JSON[_0xf774('0x15')](_0x50971d));_0x80b556(_0x50971d);})[_0xf774('0x19')](function(_0x120661){logger['error']('GetSmsQueue',_0x120661[_0xf774('0x17')],_0x262877);_0x64e26c(_0x38c4ae[_0xf774('0x16')](0x1f4,_0x120661[_0xf774('0x17')]));});});};exports[_0xf774('0x25')]=function(_0x3063c0){var _0x5e1157=this;return new Promise(function(_0x40a099,_0x3dc3cf){return db[_0xf774('0x1b')][_0xf774('0x26')]({'raw':_0x3063c0[_0xf774('0x1c')]?_0x3063c0[_0xf774('0x1c')][_0xf774('0x1d')]===undefined?!![]:![]:!![],'where':_0x3063c0['options']?_0x3063c0['options'][_0xf774('0x1e')]||null:null,'attributes':_0x3063c0[_0xf774('0x1c')]?_0x3063c0[_0xf774('0x1c')][_0xf774('0x1f')]||null:null,'include':_0x3063c0['options']?_0x3063c0[_0xf774('0x1c')][_0xf774('0x21')]?_[_0xf774('0x23')](_0x3063c0[_0xf774('0x1c')][_0xf774('0x21')],function(_0x42bc24){return{'model':db[_0x42bc24['model']],'as':_0x42bc24['as'],'attributes':_0x42bc24[_0xf774('0x1f')],'include':_0x42bc24['include']?_[_0xf774('0x23')](_0x42bc24[_0xf774('0x21')],function(_0x2d20ed){return{'model':db[_0x2d20ed[_0xf774('0x22')]],'as':_0x2d20ed['as'],'attributes':_0x2d20ed[_0xf774('0x1f')],'include':_0x2d20ed[_0xf774('0x21')]?_['map'](_0x2d20ed[_0xf774('0x21')],function(_0x3e626c){return{'model':db[_0x3e626c['model']],'as':_0x3e626c['as'],'attributes':_0x3e626c[_0xf774('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf774('0x24')](function(_0x2516bf){logger[_0xf774('0x11')]('ShowSmsQueue',_0x3063c0);logger['debug'](_0xf774('0x25'),_0x3063c0,JSON['stringify'](_0x2516bf));_0x40a099(_0x2516bf);})[_0xf774('0x19')](function(_0x3e4f6d){logger['error']('ShowSmsQueue',_0x3e4f6d[_0xf774('0x17')],_0x3063c0);_0x3dc3cf(_0x5e1157[_0xf774('0x16')](0x1f4,_0x3e4f6d[_0xf774('0x17')]));});});}; \ No newline at end of file +var _0xeacd=['SmsQueue','findAll','options','raw','where','include','model','attributes','map','catch','ShowSmsQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetSmsQueue'];(function(_0x57de09,_0x4e88cf){var _0x2a9bc8=function(_0x4f8ece){while(--_0x4f8ece){_0x57de09['push'](_0x57de09['shift']());}};_0x2a9bc8(++_0x4e88cf);}(_0xeacd,0x1c4));var _0xdeac=function(_0x1c7c53,_0x314b12){_0x1c7c53=_0x1c7c53-0x0;var _0x1daa57=_0xeacd[_0x1c7c53];return _0x1daa57;};'use strict';var _=require('lodash');var util=require(_0xdeac('0x0'));var moment=require(_0xdeac('0x1'));var BPromise=require(_0xdeac('0x2'));var rs=require(_0xdeac('0x3'));var fs=require('fs');var Redis=require(_0xdeac('0x4'));var db=require(_0xdeac('0x5'))['db'];var utils=require(_0xdeac('0x6'));var logger=require(_0xdeac('0x7'))('rpc');var config=require(_0xdeac('0x8'));var jayson=require(_0xdeac('0x9'));var client=jayson[_0xdeac('0xa')][_0xdeac('0xb')]({'port':0x232a});config[_0xdeac('0xc')]=_[_0xdeac('0xd')](config[_0xdeac('0xc')],{'host':_0xdeac('0xe'),'port':0x18eb});var socket=require(_0xdeac('0xf'))(new Redis(config[_0xdeac('0xc')]));require('./smsQueue.socket')[_0xdeac('0x10')](socket);function respondWithRpcPromise(_0x5c9eaf,_0x180ad5,_0x462b8c){return new BPromise(function(_0x39178e,_0x541563){return client[_0xdeac('0x11')](_0x5c9eaf,_0x462b8c)[_0xdeac('0x12')](function(_0x4d37a5){logger[_0xdeac('0x13')](_0xdeac('0x14'),_0x180ad5,_0xdeac('0x15'));logger[_0xdeac('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x180ad5,_0xdeac('0x15'),JSON[_0xdeac('0x17')](_0x4d37a5));if(_0x4d37a5[_0xdeac('0x18')]){if(_0x4d37a5[_0xdeac('0x18')]['code']===0x1f4){logger[_0xdeac('0x18')]('SmsQueue,\x20%s,\x20%s',_0x180ad5,_0x4d37a5[_0xdeac('0x18')][_0xdeac('0x19')]);return _0x541563(_0x4d37a5[_0xdeac('0x18')][_0xdeac('0x19')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x180ad5,_0x4d37a5['error'][_0xdeac('0x19')]);return _0x39178e(_0x4d37a5['error'][_0xdeac('0x19')]);}else{logger[_0xdeac('0x13')](_0xdeac('0x14'),_0x180ad5,_0xdeac('0x15'));_0x39178e(_0x4d37a5[_0xdeac('0x1a')][_0xdeac('0x19')]);}})['catch'](function(_0x3ca399){logger[_0xdeac('0x18')]('SmsQueue,\x20%s,\x20%s',_0x180ad5,_0x3ca399);_0x541563(_0x3ca399);});});}exports[_0xdeac('0x1b')]=function(_0x2bdda4){var _0x58f51c=this;return new Promise(function(_0x4bf9ad,_0x41fb27){return db[_0xdeac('0x1c')][_0xdeac('0x1d')]({'raw':_0x2bdda4[_0xdeac('0x1e')]?_0x2bdda4[_0xdeac('0x1e')][_0xdeac('0x1f')]===undefined?!![]:![]:!![],'where':_0x2bdda4[_0xdeac('0x1e')]?_0x2bdda4['options'][_0xdeac('0x20')]||null:null,'attributes':_0x2bdda4[_0xdeac('0x1e')]?_0x2bdda4[_0xdeac('0x1e')]['attributes']||null:null,'limit':_0x2bdda4[_0xdeac('0x1e')]?_0x2bdda4['options']['limit']||null:null,'include':_0x2bdda4[_0xdeac('0x1e')]?_0x2bdda4[_0xdeac('0x1e')][_0xdeac('0x21')]?_['map'](_0x2bdda4[_0xdeac('0x1e')]['include'],function(_0x2af259){return{'model':db[_0x2af259[_0xdeac('0x22')]],'as':_0x2af259['as'],'attributes':_0x2af259['attributes'],'include':_0x2af259[_0xdeac('0x21')]?_['map'](_0x2af259[_0xdeac('0x21')],function(_0xc9b55c){return{'model':db[_0xc9b55c[_0xdeac('0x22')]],'as':_0xc9b55c['as'],'attributes':_0xc9b55c[_0xdeac('0x23')],'include':_0xc9b55c[_0xdeac('0x21')]?_[_0xdeac('0x24')](_0xc9b55c[_0xdeac('0x21')],function(_0x41c9e5){return{'model':db[_0x41c9e5[_0xdeac('0x22')]],'as':_0x41c9e5['as'],'attributes':_0x41c9e5[_0xdeac('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdeac('0x12')](function(_0x30cc3f){logger['info'](_0xdeac('0x1b'),_0x2bdda4);logger[_0xdeac('0x16')](_0xdeac('0x1b'),_0x2bdda4,JSON[_0xdeac('0x17')](_0x30cc3f));_0x4bf9ad(_0x30cc3f);})[_0xdeac('0x25')](function(_0x3da09a){logger[_0xdeac('0x18')]('GetSmsQueue',_0x3da09a['message'],_0x2bdda4);_0x41fb27(_0x58f51c[_0xdeac('0x18')](0x1f4,_0x3da09a[_0xdeac('0x19')]));});});};exports[_0xdeac('0x26')]=function(_0x32f7a0){var _0x1e49f3=this;return new Promise(function(_0xe9a3f1,_0x1846d3){return db[_0xdeac('0x1c')][_0xdeac('0x27')]({'raw':_0x32f7a0[_0xdeac('0x1e')]?_0x32f7a0[_0xdeac('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x32f7a0[_0xdeac('0x1e')]?_0x32f7a0['options'][_0xdeac('0x20')]||null:null,'attributes':_0x32f7a0[_0xdeac('0x1e')]?_0x32f7a0['options']['attributes']||null:null,'include':_0x32f7a0['options']?_0x32f7a0[_0xdeac('0x1e')][_0xdeac('0x21')]?_[_0xdeac('0x24')](_0x32f7a0[_0xdeac('0x1e')][_0xdeac('0x21')],function(_0x2a5f35){return{'model':db[_0x2a5f35[_0xdeac('0x22')]],'as':_0x2a5f35['as'],'attributes':_0x2a5f35['attributes'],'include':_0x2a5f35[_0xdeac('0x21')]?_['map'](_0x2a5f35['include'],function(_0x47d945){return{'model':db[_0x47d945[_0xdeac('0x22')]],'as':_0x47d945['as'],'attributes':_0x47d945[_0xdeac('0x23')],'include':_0x47d945[_0xdeac('0x21')]?_[_0xdeac('0x24')](_0x47d945[_0xdeac('0x21')],function(_0x4bcc62){return{'model':db[_0x4bcc62[_0xdeac('0x22')]],'as':_0x4bcc62['as'],'attributes':_0x4bcc62[_0xdeac('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdeac('0x12')](function(_0xcbb3c5){logger['info'](_0xdeac('0x26'),_0x32f7a0);logger['debug']('ShowSmsQueue',_0x32f7a0,JSON['stringify'](_0xcbb3c5));_0xe9a3f1(_0xcbb3c5);})['catch'](function(_0x1eba5e){logger[_0xdeac('0x18')]('ShowSmsQueue',_0x1eba5e['message'],_0x32f7a0);_0x1846d3(_0x1e49f3[_0xdeac('0x18')](0x1f4,_0x1eba5e[_0xdeac('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 493b444..516674c 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 _0x668b=['removeListener','length','smsQueue:','save','remove','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x668b,0xff));var _0xb668=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x668b[_0x27530d];return _0x59e561;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xb668('0x0'),_0xb668('0x1'),_0xb668('0x2')];function createListener(_0xd17bca,_0xe3c8fe){return function(_0x49353e){_0xe3c8fe['emit'](_0xd17bca,_0x49353e);};}function removeListener(_0x2f19cf,_0x2951fc){return function(){SmsQueueEvents[_0xb668('0x3')](_0x2f19cf,_0x2951fc);};}exports['register']=function(_0x51f80f){for(var _0x1c4bf6=0x0,_0x2d2f90=events[_0xb668('0x4')];_0x1c4bf6<_0x2d2f90;_0x1c4bf6++){var _0x5d915a=events[_0x1c4bf6];var _0x50d2e1=createListener(_0xb668('0x5')+_0x5d915a,_0x51f80f);SmsQueueEvents['on'](_0x5d915a,_0x50d2e1);}}; \ No newline at end of file +var _0x3a04=['register','smsQueue:','./smsQueue.events','remove','update'];(function(_0x5e0535,_0x32ed3d){var _0x5be75e=function(_0x3c1bc7){while(--_0x3c1bc7){_0x5e0535['push'](_0x5e0535['shift']());}};_0x5be75e(++_0x32ed3d);}(_0x3a04,0x17e));var _0x43a0=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x3a04[_0x40bffc];return _0x3007e9;};'use strict';var SmsQueueEvents=require(_0x43a0('0x0'));var events=['save',_0x43a0('0x1'),_0x43a0('0x2')];function createListener(_0x1093c8,_0x516e49){return function(_0x6f41a6){_0x516e49['emit'](_0x1093c8,_0x6f41a6);};}function removeListener(_0x583327,_0x309a78){return function(){SmsQueueEvents['removeListener'](_0x583327,_0x309a78);};}exports[_0x43a0('0x3')]=function(_0x327892){for(var _0x26c36b=0x0,_0x125260=events['length'];_0x26c36b<_0x125260;_0x26c36b++){var _0x15a4e5=events[_0x26c36b];var _0x5d799=createListener(_0x43a0('0x4')+_0x15a4e5,_0x327892);SmsQueueEvents['on'](_0x15a4e5,_0x5d799);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 384cb71..681a174 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 _0x2590=['index','get','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','isAuthenticated'];(function(_0x214b79,_0x2b7146){var _0x38bfdc=function(_0x3b1698){while(--_0x3b1698){_0x214b79['push'](_0x214b79['shift']());}};_0x38bfdc(++_0x2b7146);}(_0x2590,0x12c));var _0x0259=function(_0x235b5c,_0x2efe89){_0x235b5c=_0x235b5c-0x0;var _0x496694=_0x2590[_0x235b5c];return _0x496694;};'use strict';var multer=require(_0x0259('0x0'));var util=require(_0x0259('0x1'));var path=require('path');var timeout=require(_0x0259('0x2'));var express=require(_0x0259('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0259('0x4'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x0259('0x5')](),controller[_0x0259('0x6')]);router[_0x0259('0x7')](_0x0259('0x8'),auth[_0x0259('0x5')](),controller[_0x0259('0x9')]);router[_0x0259('0x7')](_0x0259('0xa'),auth[_0x0259('0x5')](),controller['show']);router[_0x0259('0xb')]('/',auth[_0x0259('0x5')](),controller[_0x0259('0xc')]);router[_0x0259('0xd')](_0x0259('0xa'),auth['isAuthenticated'](),controller[_0x0259('0xe')]);router['delete'](_0x0259('0xa'),auth['isAuthenticated'](),controller[_0x0259('0xf')]);module[_0x0259('0x10')]=router; \ No newline at end of file +var _0x8824=['get','index','/describe','isAuthenticated','describe','show','post','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./smsQueueReport.controller'];(function(_0x5e60d6,_0x26a5f9){var _0x1693c0=function(_0x51f9c7){while(--_0x51f9c7){_0x5e60d6['push'](_0x5e60d6['shift']());}};_0x1693c0(++_0x26a5f9);}(_0x8824,0x1b3));var _0x4882=function(_0xf5cb5a,_0x349068){_0xf5cb5a=_0xf5cb5a-0x0;var _0x5618c1=_0x8824[_0xf5cb5a];return _0x5618c1;};'use strict';var multer=require('multer');var util=require(_0x4882('0x0'));var path=require(_0x4882('0x1'));var timeout=require(_0x4882('0x2'));var express=require(_0x4882('0x3'));var router=express[_0x4882('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4882('0x5'));var controller=require(_0x4882('0x6'));router[_0x4882('0x7')]('/',auth['isAuthenticated'](),controller[_0x4882('0x8')]);router[_0x4882('0x7')](_0x4882('0x9'),auth[_0x4882('0xa')](),controller[_0x4882('0xb')]);router[_0x4882('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4882('0xc')]);router[_0x4882('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x4882('0xa')](),controller[_0x4882('0xe')]);router[_0x4882('0xf')]('/:id',auth[_0x4882('0xa')](),controller['destroy']);module[_0x4882('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index de9452b..dc5d6fe 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 _0xcfb3=['moment','sequelize','exports','STRING','DATE'];(function(_0x361a29,_0x37b723){var _0x7c7204=function(_0x1af5f1){while(--_0x1af5f1){_0x361a29['push'](_0x361a29['shift']());}};_0x7c7204(++_0x37b723);}(_0xcfb3,0x7d));var _0x3cfb=function(_0x48477b,_0x4b4a4d){_0x48477b=_0x48477b-0x0;var _0x422010=_0xcfb3[_0x48477b];return _0x422010;};'use strict';var moment=require(_0x3cfb('0x0'));var Sequelize=require(_0x3cfb('0x1'));module[_0x3cfb('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3cfb('0x3')]},'joinAt':{'type':Sequelize[_0x3cfb('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3cfb('0x4')]},'exitAt':{'type':Sequelize[_0x3cfb('0x4')]},'reason':{'type':Sequelize[_0x3cfb('0x3')]}}; \ No newline at end of file +var _0x7743=['moment','exports','STRING','DATE'];(function(_0x76c7c6,_0x3d13e7){var _0x593ff0=function(_0x436201){while(--_0x436201){_0x76c7c6['push'](_0x76c7c6['shift']());}};_0x593ff0(++_0x3d13e7);}(_0x7743,0x84));var _0x3774=function(_0xa6df52,_0x1b8584){_0xa6df52=_0xa6df52-0x0;var _0x5edd57=_0x7743[_0xa6df52];return _0x5edd57;};'use strict';var moment=require(_0x3774('0x0'));var Sequelize=require('sequelize');module[_0x3774('0x1')]={'uniqueid':{'type':Sequelize[_0x3774('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3774('0x2')]},'joinAt':{'type':Sequelize[_0x3774('0x3')]},'leaveAt':{'type':Sequelize[_0x3774('0x3')]},'acceptAt':{'type':Sequelize[_0x3774('0x3')]},'exitAt':{'type':Sequelize[_0x3774('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 76f804e..1a88f17 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 _0x7601=['SmsQueueReport','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','field','count','then','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','stack','send','index'];(function(_0x5544dd,_0x2ce682){var _0x46ab7f=function(_0x30ea8a){while(--_0x30ea8a){_0x5544dd['push'](_0x5544dd['shift']());}};_0x46ab7f(++_0x2ce682);}(_0x7601,0x65));var _0x1760=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0x7601[_0x17a32f];return _0x15a293;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1760('0x0'));var zipdir=require(_0x1760('0x1'));var jsonpatch=require(_0x1760('0x2'));var rp=require('request-promise');var moment=require(_0x1760('0x3'));var BPromise=require(_0x1760('0x4'));var Mustache=require(_0x1760('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1760('0x6'));var csv=require(_0x1760('0x7'));var ejs=require(_0x1760('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1760('0x9'));var crypto=require(_0x1760('0xa'));var jsforce=require(_0x1760('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1760('0x7'));var querystring=require('querystring');var Papa=require(_0x1760('0xc'));var Redis=require(_0x1760('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1760('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1760('0xf'))(_0x1760('0x10'));var utils=require('../../config/utils');var config=require(_0x1760('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2304ee,_0x2958f7){_0x2958f7=_0x2958f7||0xcc;return function(_0x2c5480){if(_0x2c5480){return _0x2304ee[_0x1760('0x12')](_0x2958f7);}return _0x2304ee[_0x1760('0x13')](_0x2958f7)[_0x1760('0x14')]();};}function respondWithResult(_0x428651,_0x325b60){_0x325b60=_0x325b60||0xc8;return function(_0x297a5f){if(_0x297a5f){return _0x428651['status'](_0x325b60)[_0x1760('0x15')](_0x297a5f);}};}function respondWithFilteredResult(_0x43c19b,_0x21411c){return function(_0xf7e481){if(_0xf7e481){var _0x1ef1e3=_0xf7e481['count'],_0x43f854=_0x21411c[_0x1760('0x16')],_0x40acf0=_0x21411c[_0x1760('0x16')]+_0x21411c[_0x1760('0x17')],_0x45e684;if(_0x40acf0>=_0x1ef1e3){_0x40acf0=_0x1ef1e3;_0x45e684=0xc8;}else{_0x45e684=0xce;}_0x43c19b[_0x1760('0x13')](_0x45e684);return _0x43c19b[_0x1760('0x18')](_0x1760('0x19'),_0x43f854+'-'+_0x40acf0+'/'+_0x1ef1e3)[_0x1760('0x15')](_0xf7e481);}return null;};}function patchUpdates(_0x4a277b){return function(_0x3c1399){try{jsonpatch[_0x1760('0x1a')](_0x3c1399,_0x4a277b,!![]);}catch(_0x490402){return BPromise['reject'](_0x490402);}return _0x3c1399[_0x1760('0x1b')]();};}function saveUpdates(_0x272443,_0x24c4c0){return function(_0x2555e3){if(_0x2555e3){return _0x2555e3[_0x1760('0x1c')](_0x272443)['then'](function(_0xf07acf){return _0xf07acf;});}return null;};}function removeEntity(_0x7f17df,_0x3eccbc){return function(_0x437f22){if(_0x437f22){return _0x437f22[_0x1760('0x1d')]()['then'](function(){_0x7f17df[_0x1760('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59998f,_0x35fad1){return function(_0x3a150e){if(!_0x3a150e){_0x59998f['sendStatus'](0x194);}return _0x3a150e;};}function handleError(_0x320ffa,_0x231510){_0x231510=_0x231510||0x1f4;return function(_0x370ca4){logger['error'](_0x370ca4[_0x1760('0x1e')]);if(_0x370ca4['name']){delete _0x370ca4['name'];}_0x320ffa[_0x1760('0x13')](_0x231510)[_0x1760('0x1f')](_0x370ca4);};}exports[_0x1760('0x20')]=function(_0x107c87,_0x2b06a2){var _0x3a5dba={},_0x466941={},_0x5eaa09={'count':0x0,'rows':[]};var _0x1b8364=db[_0x1760('0x21')][_0x1760('0x22')];_0x466941[_0x1760('0x23')]=_['keys'](_0x1b8364);_0x466941[_0x1760('0x24')]=_[_0x1760('0x25')](_0x107c87[_0x1760('0x24')]);_0x466941[_0x1760('0x26')]=_['intersection'](_0x466941['model'],_0x466941[_0x1760('0x24')]);_0x3a5dba['attributes']=_[_0x1760('0x27')](_0x466941[_0x1760('0x23')],qs[_0x1760('0x28')](_0x107c87['query']['fields']));_0x3a5dba[_0x1760('0x29')]=_0x3a5dba['attributes']['length']?_0x3a5dba[_0x1760('0x29')]:_0x466941[_0x1760('0x23')];if(!_0x107c87[_0x1760('0x24')][_0x1760('0x2a')](_0x1760('0x2b'))){_0x3a5dba[_0x1760('0x17')]=qs[_0x1760('0x17')](_0x107c87[_0x1760('0x24')][_0x1760('0x17')]);_0x3a5dba[_0x1760('0x16')]=qs[_0x1760('0x16')](_0x107c87[_0x1760('0x24')]['offset']);}_0x3a5dba['order']=qs['sort'](_0x107c87[_0x1760('0x24')][_0x1760('0x2c')]);_0x3a5dba[_0x1760('0x2d')]=qs['filters'](_[_0x1760('0x2e')](_0x107c87[_0x1760('0x24')],_0x466941[_0x1760('0x26')]));if(_0x107c87['query'][_0x1760('0x2f')]){_0x3a5dba[_0x1760('0x2d')]=_[_0x1760('0x30')](_0x3a5dba[_0x1760('0x2d')],{'$or':_[_0x1760('0x31')](_0x1b8364,function(_0x8efca2){if(_0x8efca2['type']['key']!==_0x1760('0x32')){var _0x4b0e79={};_0x4b0e79[_0x8efca2[_0x1760('0x33')]]={'$like':'%'+_0x107c87['query'][_0x1760('0x2f')]+'%'};return _0x4b0e79;}})});}_0x3a5dba=_['merge']({},_0x3a5dba,_0x107c87['options']);var _0x21826f={'where':_0x3a5dba[_0x1760('0x2d')]};return db[_0x1760('0x21')][_0x1760('0x34')](_0x21826f)[_0x1760('0x35')](function(_0x3e00b3){_0x5eaa09[_0x1760('0x34')]=_0x3e00b3;if(_0x107c87[_0x1760('0x24')][_0x1760('0x36')]){_0x3a5dba[_0x1760('0x37')]=[{'all':!![]}];}return db[_0x1760('0x21')][_0x1760('0x38')](_0x3a5dba);})['then'](function(_0x2ce433){_0x5eaa09[_0x1760('0x39')]=_0x2ce433;return _0x5eaa09;})['then'](respondWithFilteredResult(_0x2b06a2,_0x3a5dba))[_0x1760('0x3a')](handleError(_0x2b06a2,null));};exports[_0x1760('0x3b')]=function(_0x48d76d,_0x54f681){var _0x1bd4bc={'raw':!![],'where':{'id':_0x48d76d[_0x1760('0x3c')]['id']}},_0x494c06={};_0x494c06['model']=_['keys'](db[_0x1760('0x21')][_0x1760('0x22')]);_0x494c06[_0x1760('0x24')]=_['keys'](_0x48d76d[_0x1760('0x24')]);_0x494c06[_0x1760('0x26')]=_[_0x1760('0x27')](_0x494c06[_0x1760('0x23')],_0x494c06[_0x1760('0x24')]);_0x1bd4bc[_0x1760('0x29')]=_[_0x1760('0x27')](_0x494c06['model'],qs['fields'](_0x48d76d[_0x1760('0x24')][_0x1760('0x28')]));_0x1bd4bc['attributes']=_0x1bd4bc['attributes'][_0x1760('0x3d')]?_0x1bd4bc[_0x1760('0x29')]:_0x494c06[_0x1760('0x23')];if(_0x48d76d[_0x1760('0x24')][_0x1760('0x36')]){_0x1bd4bc[_0x1760('0x37')]=[{'all':!![]}];}_0x1bd4bc=_['merge']({},_0x1bd4bc,_0x48d76d[_0x1760('0x3e')]);return db[_0x1760('0x21')][_0x1760('0x3f')](_0x1bd4bc)[_0x1760('0x35')](handleEntityNotFound(_0x54f681,null))[_0x1760('0x35')](respondWithResult(_0x54f681,null))[_0x1760('0x3a')](handleError(_0x54f681,null));};exports[_0x1760('0x40')]=function(_0xe27dd0,_0x568098){return db['SmsQueueReport'][_0x1760('0x40')](_0xe27dd0[_0x1760('0x41')],{})[_0x1760('0x35')](respondWithResult(_0x568098,0xc9))[_0x1760('0x3a')](handleError(_0x568098,null));};exports[_0x1760('0x1c')]=function(_0xda391,_0x289a8d){if(_0xda391[_0x1760('0x41')]['id']){delete _0xda391['body']['id'];}return db[_0x1760('0x21')]['find']({'where':{'id':_0xda391[_0x1760('0x3c')]['id']}})[_0x1760('0x35')](handleEntityNotFound(_0x289a8d,null))[_0x1760('0x35')](saveUpdates(_0xda391[_0x1760('0x41')],null))[_0x1760('0x35')](respondWithResult(_0x289a8d,null))[_0x1760('0x3a')](handleError(_0x289a8d,null));};exports[_0x1760('0x1d')]=function(_0x1d3932,_0x386fb6){return db[_0x1760('0x21')][_0x1760('0x3f')]({'where':{'id':_0x1d3932[_0x1760('0x3c')]['id']}})[_0x1760('0x35')](handleEntityNotFound(_0x386fb6,null))['then'](removeEntity(_0x386fb6,null))[_0x1760('0x3a')](handleError(_0x386fb6,null));};exports[_0x1760('0x42')]=function(_0x36c1a9,_0x486a5a){return db[_0x1760('0x21')][_0x1760('0x42')]()[_0x1760('0x35')](respondWithResult(_0x486a5a,null))[_0x1760('0x3a')](handleError(_0x486a5a,null));}; \ No newline at end of file +var _0x1345=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','end','stack','name','send','index','SmsQueueReport','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','sort','where','filter','type','key','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x403f5f,_0x283f67){var _0x15b1cd=function(_0x238cab){while(--_0x238cab){_0x403f5f['push'](_0x403f5f['shift']());}};_0x15b1cd(++_0x283f67);}(_0x1345,0x103));var _0x5134=function(_0x2317af,_0x1332d3){_0x2317af=_0x2317af-0x0;var _0x3cb58d=_0x1345[_0x2317af];return _0x3cb58d;};'use strict';var pdf=require(_0x5134('0x0'));var emlformat=require(_0x5134('0x1'));var rimraf=require(_0x5134('0x2'));var zipdir=require(_0x5134('0x3'));var jsonpatch=require(_0x5134('0x4'));var rp=require(_0x5134('0x5'));var moment=require(_0x5134('0x6'));var BPromise=require(_0x5134('0x7'));var Mustache=require(_0x5134('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5134('0x9'));var ejs=require(_0x5134('0xa'));var fs=require('fs');var _=require(_0x5134('0xb'));var squel=require('squel');var crypto=require(_0x5134('0xc'));var jsforce=require(_0x5134('0xd'));var deskjs=require(_0x5134('0xe'));var toCsv=require(_0x5134('0x9'));var querystring=require(_0x5134('0xf'));var Papa=require('papaparse');var Redis=require(_0x5134('0x10'));var authService=require(_0x5134('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x5134('0x12'));var logger=require(_0x5134('0x13'))(_0x5134('0x14'));var utils=require(_0x5134('0x15'));var config=require(_0x5134('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a48e3,_0x24ba86){_0x24ba86=_0x24ba86||0xcc;return function(_0x3e4b08){if(_0x3e4b08){return _0x1a48e3[_0x5134('0x17')](_0x24ba86);}return _0x1a48e3[_0x5134('0x18')](_0x24ba86)['end']();};}function respondWithResult(_0x4b621b,_0x1dbb61){_0x1dbb61=_0x1dbb61||0xc8;return function(_0x56c241){if(_0x56c241){return _0x4b621b[_0x5134('0x18')](_0x1dbb61)['json'](_0x56c241);}};}function respondWithFilteredResult(_0x5f0337,_0x36454f){return function(_0x5201d8){if(_0x5201d8){var _0x34ca61=_0x5201d8[_0x5134('0x19')],_0x1f3845=_0x36454f['offset'],_0x47b587=_0x36454f[_0x5134('0x1a')]+_0x36454f[_0x5134('0x1b')],_0xdfd70a;if(_0x47b587>=_0x34ca61){_0x47b587=_0x34ca61;_0xdfd70a=0xc8;}else{_0xdfd70a=0xce;}_0x5f0337[_0x5134('0x18')](_0xdfd70a);return _0x5f0337[_0x5134('0x1c')](_0x5134('0x1d'),_0x1f3845+'-'+_0x47b587+'/'+_0x34ca61)[_0x5134('0x1e')](_0x5201d8);}return null;};}function patchUpdates(_0x4d9b14){return function(_0x3b83f5){try{jsonpatch[_0x5134('0x1f')](_0x3b83f5,_0x4d9b14,!![]);}catch(_0x17224b){return BPromise['reject'](_0x17224b);}return _0x3b83f5[_0x5134('0x20')]();};}function saveUpdates(_0x3204d0,_0x15dea7){return function(_0x6f5e57){if(_0x6f5e57){return _0x6f5e57[_0x5134('0x21')](_0x3204d0)['then'](function(_0x464a09){return _0x464a09;});}return null;};}function removeEntity(_0x124c59,_0x35db86){return function(_0x5d99ec){if(_0x5d99ec){return _0x5d99ec[_0x5134('0x22')]()[_0x5134('0x23')](function(){_0x124c59[_0x5134('0x18')](0xcc)[_0x5134('0x24')]();});}};}function handleEntityNotFound(_0x54661f,_0x5e40fe){return function(_0x1d6d86){if(!_0x1d6d86){_0x54661f['sendStatus'](0x194);}return _0x1d6d86;};}function handleError(_0x2fbce4,_0x1e11e8){_0x1e11e8=_0x1e11e8||0x1f4;return function(_0x3c387c){logger['error'](_0x3c387c[_0x5134('0x25')]);if(_0x3c387c[_0x5134('0x26')]){delete _0x3c387c[_0x5134('0x26')];}_0x2fbce4['status'](_0x1e11e8)[_0x5134('0x27')](_0x3c387c);};}exports[_0x5134('0x28')]=function(_0x347cd1,_0x2d487b){var _0x59c087={},_0x5309f3={},_0xaa499a={'count':0x0,'rows':[]};var _0x3ea168=db[_0x5134('0x29')][_0x5134('0x2a')];_0x5309f3[_0x5134('0x2b')]=_['keys'](_0x3ea168);_0x5309f3[_0x5134('0x2c')]=_[_0x5134('0x2d')](_0x347cd1[_0x5134('0x2c')]);_0x5309f3[_0x5134('0x2e')]=_[_0x5134('0x2f')](_0x5309f3['model'],_0x5309f3['query']);_0x59c087['attributes']=_[_0x5134('0x2f')](_0x5309f3[_0x5134('0x2b')],qs['fields'](_0x347cd1['query'][_0x5134('0x30')]));_0x59c087[_0x5134('0x31')]=_0x59c087['attributes'][_0x5134('0x32')]?_0x59c087[_0x5134('0x31')]:_0x5309f3[_0x5134('0x2b')];if(!_0x347cd1[_0x5134('0x2c')]['hasOwnProperty']('nolimit')){_0x59c087[_0x5134('0x1b')]=qs['limit'](_0x347cd1[_0x5134('0x2c')][_0x5134('0x1b')]);_0x59c087[_0x5134('0x1a')]=qs[_0x5134('0x1a')](_0x347cd1[_0x5134('0x2c')][_0x5134('0x1a')]);}_0x59c087['order']=qs[_0x5134('0x33')](_0x347cd1[_0x5134('0x2c')][_0x5134('0x33')]);_0x59c087[_0x5134('0x34')]=qs[_0x5134('0x2e')](_['pick'](_0x347cd1['query'],_0x5309f3[_0x5134('0x2e')]));if(_0x347cd1['query'][_0x5134('0x35')]){_0x59c087[_0x5134('0x34')]=_['merge'](_0x59c087[_0x5134('0x34')],{'$or':_['map'](_0x3ea168,function(_0xef94b9){if(_0xef94b9[_0x5134('0x36')][_0x5134('0x37')]!=='VIRTUAL'){var _0x405b83={};_0x405b83[_0xef94b9['field']]={'$like':'%'+_0x347cd1[_0x5134('0x2c')][_0x5134('0x35')]+'%'};return _0x405b83;}})});}_0x59c087=_[_0x5134('0x38')]({},_0x59c087,_0x347cd1[_0x5134('0x39')]);var _0x1381b8={'where':_0x59c087[_0x5134('0x34')]};return db['SmsQueueReport'][_0x5134('0x19')](_0x1381b8)[_0x5134('0x23')](function(_0x1e8225){_0xaa499a[_0x5134('0x19')]=_0x1e8225;if(_0x347cd1[_0x5134('0x2c')][_0x5134('0x3a')]){_0x59c087[_0x5134('0x3b')]=[{'all':!![]}];}return db[_0x5134('0x29')][_0x5134('0x3c')](_0x59c087);})[_0x5134('0x23')](function(_0x1b6d5){_0xaa499a[_0x5134('0x3d')]=_0x1b6d5;return _0xaa499a;})[_0x5134('0x23')](respondWithFilteredResult(_0x2d487b,_0x59c087))[_0x5134('0x3e')](handleError(_0x2d487b,null));};exports[_0x5134('0x3f')]=function(_0x39538f,_0x85f67c){var _0x1fa6ec={'raw':!![],'where':{'id':_0x39538f['params']['id']}},_0x55ea09={};_0x55ea09[_0x5134('0x2b')]=_[_0x5134('0x2d')](db['SmsQueueReport'][_0x5134('0x2a')]);_0x55ea09[_0x5134('0x2c')]=_[_0x5134('0x2d')](_0x39538f[_0x5134('0x2c')]);_0x55ea09[_0x5134('0x2e')]=_['intersection'](_0x55ea09[_0x5134('0x2b')],_0x55ea09[_0x5134('0x2c')]);_0x1fa6ec['attributes']=_['intersection'](_0x55ea09[_0x5134('0x2b')],qs[_0x5134('0x30')](_0x39538f[_0x5134('0x2c')][_0x5134('0x30')]));_0x1fa6ec[_0x5134('0x31')]=_0x1fa6ec[_0x5134('0x31')][_0x5134('0x32')]?_0x1fa6ec[_0x5134('0x31')]:_0x55ea09[_0x5134('0x2b')];if(_0x39538f['query'][_0x5134('0x3a')]){_0x1fa6ec[_0x5134('0x3b')]=[{'all':!![]}];}_0x1fa6ec=_['merge']({},_0x1fa6ec,_0x39538f[_0x5134('0x39')]);return db['SmsQueueReport'][_0x5134('0x40')](_0x1fa6ec)[_0x5134('0x23')](handleEntityNotFound(_0x85f67c,null))[_0x5134('0x23')](respondWithResult(_0x85f67c,null))[_0x5134('0x3e')](handleError(_0x85f67c,null));};exports[_0x5134('0x41')]=function(_0x5c8f56,_0x2edd89){return db[_0x5134('0x29')][_0x5134('0x41')](_0x5c8f56[_0x5134('0x42')],{})['then'](respondWithResult(_0x2edd89,0xc9))[_0x5134('0x3e')](handleError(_0x2edd89,null));};exports[_0x5134('0x21')]=function(_0x1108fb,_0x369612){if(_0x1108fb['body']['id']){delete _0x1108fb['body']['id'];}return db[_0x5134('0x29')]['find']({'where':{'id':_0x1108fb[_0x5134('0x43')]['id']}})['then'](handleEntityNotFound(_0x369612,null))[_0x5134('0x23')](saveUpdates(_0x1108fb['body'],null))['then'](respondWithResult(_0x369612,null))['catch'](handleError(_0x369612,null));};exports['destroy']=function(_0x402c69,_0x5b6c9d){return db[_0x5134('0x29')][_0x5134('0x40')]({'where':{'id':_0x402c69[_0x5134('0x43')]['id']}})[_0x5134('0x23')](handleEntityNotFound(_0x5b6c9d,null))['then'](removeEntity(_0x5b6c9d,null))[_0x5134('0x3e')](handleError(_0x5b6c9d,null));};exports['describe']=function(_0x1e5ad7,_0x2a8d23){return db[_0x5134('0x29')][_0x5134('0x44')]()[_0x5134('0x23')](respondWithResult(_0x2a8d23,null))[_0x5134('0x3e')](handleError(_0x2a8d23,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index bc2983d..1c401ef 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 _0xc426=['define','report_sms_queue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x592125,_0x3c3e4a){var _0x536040=function(_0x2325d1){while(--_0x2325d1){_0x592125['push'](_0x592125['shift']());}};_0x536040(++_0x3c3e4a);}(_0xc426,0xfe));var _0x6c42=function(_0x172f47,_0x23ee31){_0x172f47=_0x172f47-0x0;var _0x33293e=_0xc426[_0x172f47];return _0x33293e;};'use strict';var _=require(_0x6c42('0x0'));var util=require('util');var logger=require(_0x6c42('0x1'))(_0x6c42('0x2'));var moment=require(_0x6c42('0x3'));var BPromise=require(_0x6c42('0x4'));var rp=require(_0x6c42('0x5'));var fs=require('fs');var path=require(_0x6c42('0x6'));var rimraf=require(_0x6c42('0x7'));var config=require(_0x6c42('0x8'));var attributes=require(_0x6c42('0x9'));module['exports']=function(_0x12e7d6,_0x408c4a){return _0x12e7d6[_0x6c42('0xa')]('SmsQueueReport',attributes,{'tableName':_0x6c42('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6da5=['exports','define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x12919d,_0x3c219e){var _0x3c2937=function(_0x2fa0ed){while(--_0x2fa0ed){_0x12919d['push'](_0x12919d['shift']());}};_0x3c2937(++_0x3c219e);}(_0x6da5,0x104));var _0x56da=function(_0x3193d8,_0x2176d4){_0x3193d8=_0x3193d8-0x0;var _0x44e118=_0x6da5[_0x3193d8];return _0x44e118;};'use strict';var _=require('lodash');var util=require(_0x56da('0x0'));var logger=require(_0x56da('0x1'))(_0x56da('0x2'));var moment=require(_0x56da('0x3'));var BPromise=require(_0x56da('0x4'));var rp=require(_0x56da('0x5'));var fs=require('fs');var path=require(_0x56da('0x6'));var rimraf=require(_0x56da('0x7'));var config=require(_0x56da('0x8'));var attributes=require(_0x56da('0x9'));module[_0x56da('0xa')]=function(_0x51cf6a,_0x5ce6ec){return _0x51cf6a[_0x56da('0xb')](_0x56da('0xc'),attributes,{'tableName':_0x56da('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x56da('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 523b198..a88cbc9 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 _0x00b2=['stringify','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','body','options','raw'];(function(_0x12a06b,_0x417b51){var _0x5d0bb8=function(_0x41d3d0){while(--_0x41d3d0){_0x12a06b['push'](_0x12a06b['shift']());}};_0x5d0bb8(++_0x417b51);}(_0x00b2,0xa6));var _0x200b=function(_0x26d198,_0x1f3548){_0x26d198=_0x26d198-0x0;var _0x13f914=_0x00b2[_0x26d198];return _0x13f914;};'use strict';var _=require(_0x200b('0x0'));var util=require(_0x200b('0x1'));var moment=require(_0x200b('0x2'));var BPromise=require('bluebird');var rs=require(_0x200b('0x3'));var fs=require('fs');var Redis=require(_0x200b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x200b('0x5'));var logger=require(_0x200b('0x6'))(_0x200b('0x7'));var config=require(_0x200b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x200b('0x9')][_0x200b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ebd18,_0x18386e,_0x1f03b9){return new BPromise(function(_0x4ea4c4,_0x2eb047){return client[_0x200b('0xb')](_0x3ebd18,_0x1f03b9)[_0x200b('0xc')](function(_0x2fc4a5){logger[_0x200b('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x18386e,'request\x20sent');logger[_0x200b('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x18386e,_0x200b('0xf'),JSON['stringify'](_0x2fc4a5));if(_0x2fc4a5[_0x200b('0x10')]){if(_0x2fc4a5['error'][_0x200b('0x11')]===0x1f4){logger[_0x200b('0x10')](_0x200b('0x12'),_0x18386e,_0x2fc4a5[_0x200b('0x10')]['message']);return _0x2eb047(_0x2fc4a5['error'][_0x200b('0x13')]);}logger[_0x200b('0x10')](_0x200b('0x12'),_0x18386e,_0x2fc4a5['error'][_0x200b('0x13')]);return _0x4ea4c4(_0x2fc4a5[_0x200b('0x10')][_0x200b('0x13')]);}else{logger['info'](_0x200b('0x12'),_0x18386e,_0x200b('0xf'));_0x4ea4c4(_0x2fc4a5[_0x200b('0x14')][_0x200b('0x13')]);}})[_0x200b('0x15')](function(_0xe91ef4){logger[_0x200b('0x10')](_0x200b('0x12'),_0x18386e,_0xe91ef4);_0x2eb047(_0xe91ef4);});});}exports[_0x200b('0x16')]=function(_0x20aac7){var _0x59e34b=this;return new Promise(function(_0x4a3766,_0x11f869){return db['SmsQueueReport']['create'](_0x20aac7[_0x200b('0x17')],{'raw':_0x20aac7[_0x200b('0x18')]?_0x20aac7['options'][_0x200b('0x19')]===undefined?!![]:![]:!![]})[_0x200b('0xc')](function(_0x5b4508){logger[_0x200b('0xd')](_0x200b('0x16'),_0x20aac7);logger['debug'](_0x200b('0x16'),_0x20aac7,JSON[_0x200b('0x1a')](_0x5b4508));_0x4a3766(_0x5b4508);})[_0x200b('0x15')](function(_0xed2a99){logger[_0x200b('0x10')](_0x200b('0x16'),_0xed2a99[_0x200b('0x13')],_0x20aac7);_0x11f869(_0x59e34b['error'](0x1f4,_0xed2a99[_0x200b('0x13')]));});});};exports[_0x200b('0x1b')]=function(_0x272a84){var _0x4d7137=this;return new Promise(function(_0x33aeb1,_0x44540a){return db[_0x200b('0x1c')][_0x200b('0x1d')](_0x272a84[_0x200b('0x17')],{'raw':_0x272a84[_0x200b('0x18')]?_0x272a84['options'][_0x200b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272a84[_0x200b('0x18')]?_0x272a84['options'][_0x200b('0x1e')]||null:null,'attributes':_0x272a84[_0x200b('0x18')]?_0x272a84['options'][_0x200b('0x1f')]||null:null,'limit':_0x272a84[_0x200b('0x18')]?_0x272a84[_0x200b('0x18')]['limit']||null:null})['then'](function(_0x54fdf5){logger[_0x200b('0xd')]('UpdateSmsQueueReport',_0x272a84);logger[_0x200b('0xe')]('UpdateSmsQueueReport',_0x272a84,JSON['stringify'](_0x54fdf5));_0x33aeb1(_0x54fdf5);})[_0x200b('0x15')](function(_0x25a3bf){logger['error'](_0x200b('0x1b'),_0x25a3bf[_0x200b('0x13')],_0x272a84);_0x44540a(_0x4d7137['error'](0x1f4,_0x25a3bf[_0x200b('0x13')]));});});}; \ No newline at end of file +var _0xa98a=['result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','attributes','limit','UpdateSmsQueueReport','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message'];(function(_0x5dd1cc,_0x563c22){var _0x4e701a=function(_0x3c7846){while(--_0x3c7846){_0x5dd1cc['push'](_0x5dd1cc['shift']());}};_0x4e701a(++_0x563c22);}(_0xa98a,0x65));var _0xaa98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa98a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaa98('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa98('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa98('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa98('0x3'));var logger=require(_0xaa98('0x4'))(_0xaa98('0x5'));var config=require('../../config/environment');var jayson=require(_0xaa98('0x6'));var client=jayson[_0xaa98('0x7')][_0xaa98('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x324f80,_0x5204ea,_0x12f395){return new BPromise(function(_0x546b40,_0x876f87){return client[_0xaa98('0x9')](_0x324f80,_0x12f395)[_0xaa98('0xa')](function(_0x314a17){logger[_0xaa98('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x5204ea,_0xaa98('0xc'));logger[_0xaa98('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5204ea,_0xaa98('0xc'),JSON[_0xaa98('0xe')](_0x314a17));if(_0x314a17[_0xaa98('0xf')]){if(_0x314a17[_0xaa98('0xf')][_0xaa98('0x10')]===0x1f4){logger[_0xaa98('0xf')](_0xaa98('0x11'),_0x5204ea,_0x314a17['error'][_0xaa98('0x12')]);return _0x876f87(_0x314a17[_0xaa98('0xf')][_0xaa98('0x12')]);}logger[_0xaa98('0xf')](_0xaa98('0x11'),_0x5204ea,_0x314a17[_0xaa98('0xf')][_0xaa98('0x12')]);return _0x546b40(_0x314a17[_0xaa98('0xf')][_0xaa98('0x12')]);}else{logger[_0xaa98('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x5204ea,_0xaa98('0xc'));_0x546b40(_0x314a17[_0xaa98('0x13')][_0xaa98('0x12')]);}})[_0xaa98('0x14')](function(_0x2dddd7){logger[_0xaa98('0xf')](_0xaa98('0x11'),_0x5204ea,_0x2dddd7);_0x876f87(_0x2dddd7);});});}exports['CreateSmsQueueReport']=function(_0x58bb3d){var _0x35fbda=this;return new Promise(function(_0x9b3972,_0x3af393){return db[_0xaa98('0x15')][_0xaa98('0x16')](_0x58bb3d[_0xaa98('0x17')],{'raw':_0x58bb3d[_0xaa98('0x18')]?_0x58bb3d['options'][_0xaa98('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3af210){logger[_0xaa98('0xb')](_0xaa98('0x1a'),_0x58bb3d);logger['debug'](_0xaa98('0x1a'),_0x58bb3d,JSON[_0xaa98('0xe')](_0x3af210));_0x9b3972(_0x3af210);})[_0xaa98('0x14')](function(_0x2c7eae){logger[_0xaa98('0xf')](_0xaa98('0x1a'),_0x2c7eae[_0xaa98('0x12')],_0x58bb3d);_0x3af393(_0x35fbda[_0xaa98('0xf')](0x1f4,_0x2c7eae['message']));});});};exports['UpdateSmsQueueReport']=function(_0x9a2f1b){var _0x25892d=this;return new Promise(function(_0x2d8d85,_0x59d019){return db[_0xaa98('0x15')]['update'](_0x9a2f1b[_0xaa98('0x17')],{'raw':_0x9a2f1b[_0xaa98('0x18')]?_0x9a2f1b[_0xaa98('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9a2f1b[_0xaa98('0x18')]?_0x9a2f1b[_0xaa98('0x18')]['where']||null:null,'attributes':_0x9a2f1b[_0xaa98('0x18')]?_0x9a2f1b[_0xaa98('0x18')][_0xaa98('0x1b')]||null:null,'limit':_0x9a2f1b['options']?_0x9a2f1b[_0xaa98('0x18')][_0xaa98('0x1c')]||null:null})[_0xaa98('0xa')](function(_0x276926){logger['info']('UpdateSmsQueueReport',_0x9a2f1b);logger[_0xaa98('0xd')](_0xaa98('0x1d'),_0x9a2f1b,JSON['stringify'](_0x276926));_0x2d8d85(_0x276926);})['catch'](function(_0x582ae6){logger[_0xaa98('0xf')](_0xaa98('0x1d'),_0x582ae6[_0xaa98('0x12')],_0x9a2f1b);_0x59d019(_0x25892d['error'](0x1f4,_0x582ae6[_0xaa98('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f2d2ec7..b5773a3 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 _0xed3c=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x49c933,_0x37bbca){var _0x3e43b2=function(_0x140299){while(--_0x140299){_0x49c933['push'](_0x49c933['shift']());}};_0x3e43b2(++_0x37bbca);}(_0xed3c,0x1a6));var _0xced3=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0xed3c[_0x39bc44];return _0x2916d8;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var auth=require(_0xced3('0x5'));var interaction=require(_0xced3('0x6'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0xced3('0x7')]('/',auth[_0xced3('0x8')](),controller[_0xced3('0x9')]);router[_0xced3('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xced3('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xced3('0xa')]('/',auth[_0xced3('0x8')](),controller[_0xced3('0xb')]);router[_0xced3('0xc')](_0xced3('0xd'),auth['isAuthenticated'](),controller[_0xced3('0xe')]);router[_0xced3('0xf')](_0xced3('0xd'),auth['isAuthenticated'](),controller[_0xced3('0x10')]);module[_0xced3('0x11')]=router; \ No newline at end of file +var _0x96cc=['put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x3d25e6,_0x2e55a3){var _0x3639c0=function(_0x2ac5a4){while(--_0x2ac5a4){_0x3d25e6['push'](_0x3d25e6['shift']());}};_0x3639c0(++_0x2e55a3);}(_0x96cc,0x16c));var _0xc96c=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x96cc[_0x4b91c4];return _0x25cb80;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var auth=require(_0xc96c('0x4'));var interaction=require(_0xc96c('0x5'));var config=require(_0xc96c('0x6'));var controller=require(_0xc96c('0x7'));router[_0xc96c('0x8')]('/',auth[_0xc96c('0x9')](),controller[_0xc96c('0xa')]);router['get'](_0xc96c('0xb'),auth[_0xc96c('0x9')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x8')](_0xc96c('0xd'),auth[_0xc96c('0x9')](),controller[_0xc96c('0xe')]);router['post']('/',auth[_0xc96c('0x9')](),controller[_0xc96c('0xf')]);router[_0xc96c('0x10')]('/:id',auth[_0xc96c('0x9')](),controller['update']);router[_0xc96c('0x11')]('/:id',auth[_0xc96c('0x9')](),controller[_0xc96c('0x12')]);module[_0xc96c('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index c60f2f4..8e60037 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 _0xc151=['NOW','moment','sequelize','exports','queue','DATE'];(function(_0xa58031,_0x2276a3){var _0x48ced=function(_0x2b8034){while(--_0x2b8034){_0xa58031['push'](_0xa58031['shift']());}};_0x48ced(++_0x2276a3);}(_0xc151,0x79));var _0x1c15=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc151[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x1c15('0x0'));var Sequelize=require(_0x1c15('0x1'));module[_0x1c15('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0x1c15('0x3')),'allowNull':![],'defaultValue':_0x1c15('0x3')},'transferredAt':{'type':Sequelize[_0x1c15('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x1c15('0x5')]}}; \ No newline at end of file +var _0xd60b=['DATE','NOW','sequelize','exports','STRING','agent','queue'];(function(_0x1abfd7,_0x2113fe){var _0x463dcf=function(_0x2d224d){while(--_0x2d224d){_0x1abfd7['push'](_0x1abfd7['shift']());}};_0x463dcf(++_0x2113fe);}(_0xd60b,0xdb));var _0xbd60=function(_0x73af1d,_0xa1a781){_0x73af1d=_0x73af1d-0x0;var _0x45bfd0=_0xd60b[_0x73af1d];return _0x45bfd0;};'use strict';var moment=require('moment');var Sequelize=require(_0xbd60('0x0'));module[_0xbd60('0x1')]={'uniqueid':{'type':Sequelize[_0xbd60('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xbd60('0x3'),'queue'),'allowNull':![],'defaultValue':_0xbd60('0x4')},'transferredAt':{'type':Sequelize[_0xbd60('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xbd60('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4f86833..73b5abb 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 _0xedd9=['then','destroy','error','stack','name','send','index','SmsTransferReport','rawAttributes','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','field','options','includeAll','include','rows','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save'];(function(_0x1669cf,_0x4398ea){var _0x2a8e5a=function(_0x5f2ae8){while(--_0x5f2ae8){_0x1669cf['push'](_0x1669cf['shift']());}};_0x2a8e5a(++_0x4398ea);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e5581,_0x2dfc4d){_0x5e5581=_0x5e5581-0x0;var _0x55dd53=_0xedd9[_0x5e5581];return _0x55dd53;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var hardwareService=require(_0x9edd('0x12'));var logger=require('../../config/logger')(_0x9edd('0x13'));var utils=require(_0x9edd('0x14'));var config=require('../../config/environment');var db=require(_0x9edd('0x15'))['db'];function respondWithStatusCode(_0x1b73d1,_0x25e64c){_0x25e64c=_0x25e64c||0xcc;return function(_0xfd544a){if(_0xfd544a){return _0x1b73d1[_0x9edd('0x16')](_0x25e64c);}return _0x1b73d1[_0x9edd('0x17')](_0x25e64c)[_0x9edd('0x18')]();};}function respondWithResult(_0xef5498,_0x47eb64){_0x47eb64=_0x47eb64||0xc8;return function(_0x176bfa){if(_0x176bfa){return _0xef5498[_0x9edd('0x17')](_0x47eb64)[_0x9edd('0x19')](_0x176bfa);}};}function respondWithFilteredResult(_0x4d9a7,_0x13b6b6){return function(_0x338f3c){if(_0x338f3c){var _0x1042aa=_0x338f3c[_0x9edd('0x1a')],_0x75a4ab=_0x13b6b6[_0x9edd('0x1b')],_0x4ea60f=_0x13b6b6['offset']+_0x13b6b6[_0x9edd('0x1c')],_0x5f5bf4;if(_0x4ea60f>=_0x1042aa){_0x4ea60f=_0x1042aa;_0x5f5bf4=0xc8;}else{_0x5f5bf4=0xce;}_0x4d9a7[_0x9edd('0x17')](_0x5f5bf4);return _0x4d9a7[_0x9edd('0x1d')]('Content-Range',_0x75a4ab+'-'+_0x4ea60f+'/'+_0x1042aa)[_0x9edd('0x19')](_0x338f3c);}return null;};}function patchUpdates(_0x5d879c){return function(_0x2cdcef){try{jsonpatch[_0x9edd('0x1e')](_0x2cdcef,_0x5d879c,!![]);}catch(_0x4bdb88){return BPromise['reject'](_0x4bdb88);}return _0x2cdcef[_0x9edd('0x1f')]();};}function saveUpdates(_0x50338f,_0x27a95a){return function(_0x54a03f){if(_0x54a03f){return _0x54a03f['update'](_0x50338f)[_0x9edd('0x20')](function(_0x1c46a8){return _0x1c46a8;});}return null;};}function removeEntity(_0x4fb7bf,_0x5823bc){return function(_0x341d67){if(_0x341d67){return _0x341d67[_0x9edd('0x21')]()[_0x9edd('0x20')](function(){_0x4fb7bf['status'](0xcc)[_0x9edd('0x18')]();});}};}function handleEntityNotFound(_0x1dca43,_0x44a6c1){return function(_0x2ca65f){if(!_0x2ca65f){_0x1dca43[_0x9edd('0x16')](0x194);}return _0x2ca65f;};}function handleError(_0x4c75d2,_0x46c383){_0x46c383=_0x46c383||0x1f4;return function(_0xeaf55a){logger[_0x9edd('0x22')](_0xeaf55a[_0x9edd('0x23')]);if(_0xeaf55a[_0x9edd('0x24')]){delete _0xeaf55a['name'];}_0x4c75d2['status'](_0x46c383)[_0x9edd('0x25')](_0xeaf55a);};}exports[_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135){var _0x3c2227={},_0x4fe471={},_0x57a2cc={'count':0x0,'rows':[]};var _0x214d0a=db[_0x9edd('0x27')][_0x9edd('0x28')];_0x4fe471['model']=_[_0x9edd('0x29')](_0x214d0a);_0x4fe471[_0x9edd('0x2a')]=_[_0x9edd('0x29')](_0x8d67aa[_0x9edd('0x2a')]);_0x4fe471['filters']=_[_0x9edd('0x2b')](_0x4fe471[_0x9edd('0x2c')],_0x4fe471[_0x9edd('0x2a')]);_0x3c2227[_0x9edd('0x2d')]=_[_0x9edd('0x2b')](_0x4fe471[_0x9edd('0x2c')],qs[_0x9edd('0x2e')](_0x8d67aa[_0x9edd('0x2a')][_0x9edd('0x2e')]));_0x3c2227[_0x9edd('0x2d')]=_0x3c2227[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x3c2227[_0x9edd('0x2d')]:_0x4fe471[_0x9edd('0x2c')];if(!_0x8d67aa[_0x9edd('0x2a')]['hasOwnProperty'](_0x9edd('0x30'))){_0x3c2227[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x8d67aa['query'][_0x9edd('0x1c')]);_0x3c2227[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x8d67aa[_0x9edd('0x2a')][_0x9edd('0x1b')]);}_0x3c2227[_0x9edd('0x31')]=qs[_0x9edd('0x32')](_0x8d67aa[_0x9edd('0x2a')][_0x9edd('0x32')]);_0x3c2227[_0x9edd('0x33')]=qs[_0x9edd('0x34')](_[_0x9edd('0x35')](_0x8d67aa[_0x9edd('0x2a')],_0x4fe471[_0x9edd('0x34')]));if(_0x8d67aa['query'][_0x9edd('0x36')]){_0x3c2227['where']=_[_0x9edd('0x37')](_0x3c2227[_0x9edd('0x33')],{'$or':_[_0x9edd('0x38')](_0x214d0a,function(_0x434d26){if(_0x434d26[_0x9edd('0x39')]['key']!==_0x9edd('0x3a')){var _0x44dbfc={};_0x44dbfc[_0x434d26[_0x9edd('0x3b')]]={'$like':'%'+_0x8d67aa[_0x9edd('0x2a')][_0x9edd('0x36')]+'%'};return _0x44dbfc;}})});}_0x3c2227=_[_0x9edd('0x37')]({},_0x3c2227,_0x8d67aa[_0x9edd('0x3c')]);var _0x1cbbac={'where':_0x3c2227[_0x9edd('0x33')]};return db[_0x9edd('0x27')]['count'](_0x1cbbac)[_0x9edd('0x20')](function(_0x56a228){_0x57a2cc[_0x9edd('0x1a')]=_0x56a228;if(_0x8d67aa['query'][_0x9edd('0x3d')]){_0x3c2227[_0x9edd('0x3e')]=[{'all':!![]}];}return db[_0x9edd('0x27')]['findAll'](_0x3c2227);})[_0x9edd('0x20')](function(_0xcbd0ef){_0x57a2cc[_0x9edd('0x3f')]=_0xcbd0ef;return _0x57a2cc;})['then'](respondWithFilteredResult(_0x25e135,_0x3c2227))[_0x9edd('0x40')](handleError(_0x25e135,null));};exports['show']=function(_0x1fc4fb,_0xfbc492){var _0x50be2c={'raw':!![],'where':{'id':_0x1fc4fb[_0x9edd('0x41')]['id']}},_0x315f52={};_0x315f52[_0x9edd('0x2c')]=_[_0x9edd('0x29')](db['SmsTransferReport'][_0x9edd('0x28')]);_0x315f52['query']=_[_0x9edd('0x29')](_0x1fc4fb[_0x9edd('0x2a')]);_0x315f52['filters']=_[_0x9edd('0x2b')](_0x315f52['model'],_0x315f52['query']);_0x50be2c[_0x9edd('0x2d')]=_[_0x9edd('0x2b')](_0x315f52[_0x9edd('0x2c')],qs[_0x9edd('0x2e')](_0x1fc4fb[_0x9edd('0x2a')][_0x9edd('0x2e')]));_0x50be2c[_0x9edd('0x2d')]=_0x50be2c[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x50be2c[_0x9edd('0x2d')]:_0x315f52[_0x9edd('0x2c')];if(_0x1fc4fb[_0x9edd('0x2a')][_0x9edd('0x3d')]){_0x50be2c[_0x9edd('0x3e')]=[{'all':!![]}];}_0x50be2c=_[_0x9edd('0x37')]({},_0x50be2c,_0x1fc4fb['options']);return db[_0x9edd('0x27')][_0x9edd('0x42')](_0x50be2c)[_0x9edd('0x20')](handleEntityNotFound(_0xfbc492,null))[_0x9edd('0x20')](respondWithResult(_0xfbc492,null))[_0x9edd('0x40')](handleError(_0xfbc492,null));};exports[_0x9edd('0x43')]=function(_0x10d41e,_0x4e9ad1){return db['SmsTransferReport']['create'](_0x10d41e[_0x9edd('0x44')],{})['then'](respondWithResult(_0x4e9ad1,0xc9))[_0x9edd('0x40')](handleError(_0x4e9ad1,null));};exports[_0x9edd('0x45')]=function(_0x2b06d3,_0x8db801){if(_0x2b06d3[_0x9edd('0x44')]['id']){delete _0x2b06d3['body']['id'];}return db[_0x9edd('0x27')][_0x9edd('0x42')]({'where':{'id':_0x2b06d3[_0x9edd('0x41')]['id']}})['then'](handleEntityNotFound(_0x8db801,null))[_0x9edd('0x20')](saveUpdates(_0x2b06d3[_0x9edd('0x44')],null))[_0x9edd('0x20')](respondWithResult(_0x8db801,null))[_0x9edd('0x40')](handleError(_0x8db801,null));};exports[_0x9edd('0x21')]=function(_0x35bdec,_0x4d4f33){return db[_0x9edd('0x27')][_0x9edd('0x42')]({'where':{'id':_0x35bdec['params']['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x20')](removeEntity(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x46')]=function(_0x8134cd,_0x468239){return db['SmsTransferReport'][_0x9edd('0x46')]()[_0x9edd('0x20')](respondWithResult(_0x468239,null))[_0x9edd('0x40')](handleError(_0x468239,null));}; \ No newline at end of file +var _0xaa88=['rows','catch','show','params','rawAttributes','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','apply','reject','save','update','then','error','name','send','index','SmsTransferReport','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','map','key','VIRTUAL','field','includeAll','include','findAll'];(function(_0x5ea797,_0x2d39dd){var _0x500783=function(_0x4923f2){while(--_0x4923f2){_0x5ea797['push'](_0x5ea797['shift']());}};_0x500783(++_0x2d39dd);}(_0xaa88,0x137));var _0x8aa8=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0xaa88[_0x4a6cf8];return _0x22205e;};'use strict';var pdf=require(_0x8aa8('0x0'));var emlformat=require(_0x8aa8('0x1'));var rimraf=require(_0x8aa8('0x2'));var zipdir=require(_0x8aa8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8aa8('0x4'));var moment=require(_0x8aa8('0x5'));var BPromise=require(_0x8aa8('0x6'));var Mustache=require(_0x8aa8('0x7'));var util=require(_0x8aa8('0x8'));var path=require(_0x8aa8('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8aa8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var hardwareService=require(_0x8aa8('0x13'));var logger=require(_0x8aa8('0x14'))(_0x8aa8('0x15'));var utils=require('../../config/utils');var config=require(_0x8aa8('0x16'));var db=require(_0x8aa8('0x17'))['db'];function respondWithStatusCode(_0x50787d,_0x370b25){_0x370b25=_0x370b25||0xcc;return function(_0xa691d6){if(_0xa691d6){return _0x50787d[_0x8aa8('0x18')](_0x370b25);}return _0x50787d['status'](_0x370b25)[_0x8aa8('0x19')]();};}function respondWithResult(_0x179e33,_0x2fa66f){_0x2fa66f=_0x2fa66f||0xc8;return function(_0x4b686e){if(_0x4b686e){return _0x179e33[_0x8aa8('0x1a')](_0x2fa66f)['json'](_0x4b686e);}};}function respondWithFilteredResult(_0x4f3a2e,_0x433e95){return function(_0x200662){if(_0x200662){var _0xae81a0=_0x200662[_0x8aa8('0x1b')],_0xa6c2af=_0x433e95[_0x8aa8('0x1c')],_0x42a6a4=_0x433e95[_0x8aa8('0x1c')]+_0x433e95['limit'],_0x3778f4;if(_0x42a6a4>=_0xae81a0){_0x42a6a4=_0xae81a0;_0x3778f4=0xc8;}else{_0x3778f4=0xce;}_0x4f3a2e['status'](_0x3778f4);return _0x4f3a2e[_0x8aa8('0x1d')]('Content-Range',_0xa6c2af+'-'+_0x42a6a4+'/'+_0xae81a0)['json'](_0x200662);}return null;};}function patchUpdates(_0xab7af5){return function(_0x5ac0d9){try{jsonpatch[_0x8aa8('0x1e')](_0x5ac0d9,_0xab7af5,!![]);}catch(_0x41092b){return BPromise[_0x8aa8('0x1f')](_0x41092b);}return _0x5ac0d9[_0x8aa8('0x20')]();};}function saveUpdates(_0x502547,_0xcc2c19){return function(_0x36c445){if(_0x36c445){return _0x36c445[_0x8aa8('0x21')](_0x502547)[_0x8aa8('0x22')](function(_0x4c754e){return _0x4c754e;});}return null;};}function removeEntity(_0x34f1b7,_0x5d9b62){return function(_0x26cf63){if(_0x26cf63){return _0x26cf63['destroy']()[_0x8aa8('0x22')](function(){_0x34f1b7['status'](0xcc)[_0x8aa8('0x19')]();});}};}function handleEntityNotFound(_0x557e4e,_0x65945b){return function(_0x40adb5){if(!_0x40adb5){_0x557e4e[_0x8aa8('0x18')](0x194);}return _0x40adb5;};}function handleError(_0x5e5d91,_0x24f428){_0x24f428=_0x24f428||0x1f4;return function(_0xe978ab){logger[_0x8aa8('0x23')](_0xe978ab['stack']);if(_0xe978ab['name']){delete _0xe978ab[_0x8aa8('0x24')];}_0x5e5d91[_0x8aa8('0x1a')](_0x24f428)[_0x8aa8('0x25')](_0xe978ab);};}exports[_0x8aa8('0x26')]=function(_0x24143e,_0x4a8212){var _0x2bc34a={},_0x49d561={},_0x2a0ff2={'count':0x0,'rows':[]};var _0xe7768=db[_0x8aa8('0x27')]['rawAttributes'];_0x49d561['model']=_[_0x8aa8('0x28')](_0xe7768);_0x49d561['query']=_[_0x8aa8('0x28')](_0x24143e[_0x8aa8('0x29')]);_0x49d561[_0x8aa8('0x2a')]=_[_0x8aa8('0x2b')](_0x49d561[_0x8aa8('0x2c')],_0x49d561['query']);_0x2bc34a[_0x8aa8('0x2d')]=_[_0x8aa8('0x2b')](_0x49d561['model'],qs[_0x8aa8('0x2e')](_0x24143e[_0x8aa8('0x29')][_0x8aa8('0x2e')]));_0x2bc34a['attributes']=_0x2bc34a[_0x8aa8('0x2d')][_0x8aa8('0x2f')]?_0x2bc34a[_0x8aa8('0x2d')]:_0x49d561[_0x8aa8('0x2c')];if(!_0x24143e[_0x8aa8('0x29')][_0x8aa8('0x30')](_0x8aa8('0x31'))){_0x2bc34a[_0x8aa8('0x32')]=qs[_0x8aa8('0x32')](_0x24143e[_0x8aa8('0x29')][_0x8aa8('0x32')]);_0x2bc34a['offset']=qs['offset'](_0x24143e[_0x8aa8('0x29')][_0x8aa8('0x1c')]);}_0x2bc34a[_0x8aa8('0x33')]=qs[_0x8aa8('0x34')](_0x24143e[_0x8aa8('0x29')][_0x8aa8('0x34')]);_0x2bc34a['where']=qs['filters'](_[_0x8aa8('0x35')](_0x24143e['query'],_0x49d561[_0x8aa8('0x2a')]));if(_0x24143e[_0x8aa8('0x29')][_0x8aa8('0x36')]){_0x2bc34a['where']=_[_0x8aa8('0x37')](_0x2bc34a[_0x8aa8('0x38')],{'$or':_[_0x8aa8('0x39')](_0xe7768,function(_0x5c28fa){if(_0x5c28fa['type'][_0x8aa8('0x3a')]!==_0x8aa8('0x3b')){var _0x52f87d={};_0x52f87d[_0x5c28fa[_0x8aa8('0x3c')]]={'$like':'%'+_0x24143e[_0x8aa8('0x29')]['filter']+'%'};return _0x52f87d;}})});}_0x2bc34a=_[_0x8aa8('0x37')]({},_0x2bc34a,_0x24143e['options']);var _0x530a66={'where':_0x2bc34a[_0x8aa8('0x38')]};return db['SmsTransferReport'][_0x8aa8('0x1b')](_0x530a66)[_0x8aa8('0x22')](function(_0x926ff2){_0x2a0ff2[_0x8aa8('0x1b')]=_0x926ff2;if(_0x24143e['query'][_0x8aa8('0x3d')]){_0x2bc34a[_0x8aa8('0x3e')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x8aa8('0x3f')](_0x2bc34a);})[_0x8aa8('0x22')](function(_0x5ea57a){_0x2a0ff2[_0x8aa8('0x40')]=_0x5ea57a;return _0x2a0ff2;})[_0x8aa8('0x22')](respondWithFilteredResult(_0x4a8212,_0x2bc34a))[_0x8aa8('0x41')](handleError(_0x4a8212,null));};exports[_0x8aa8('0x42')]=function(_0x189d53,_0xea42cb){var _0x46711b={'raw':!![],'where':{'id':_0x189d53[_0x8aa8('0x43')]['id']}},_0x3fb265={};_0x3fb265[_0x8aa8('0x2c')]=_[_0x8aa8('0x28')](db[_0x8aa8('0x27')][_0x8aa8('0x44')]);_0x3fb265[_0x8aa8('0x29')]=_[_0x8aa8('0x28')](_0x189d53[_0x8aa8('0x29')]);_0x3fb265['filters']=_[_0x8aa8('0x2b')](_0x3fb265['model'],_0x3fb265['query']);_0x46711b['attributes']=_[_0x8aa8('0x2b')](_0x3fb265['model'],qs['fields'](_0x189d53[_0x8aa8('0x29')]['fields']));_0x46711b[_0x8aa8('0x2d')]=_0x46711b['attributes']['length']?_0x46711b[_0x8aa8('0x2d')]:_0x3fb265[_0x8aa8('0x2c')];if(_0x189d53[_0x8aa8('0x29')][_0x8aa8('0x3d')]){_0x46711b[_0x8aa8('0x3e')]=[{'all':!![]}];}_0x46711b=_[_0x8aa8('0x37')]({},_0x46711b,_0x189d53[_0x8aa8('0x45')]);return db['SmsTransferReport'][_0x8aa8('0x46')](_0x46711b)['then'](handleEntityNotFound(_0xea42cb,null))[_0x8aa8('0x22')](respondWithResult(_0xea42cb,null))[_0x8aa8('0x41')](handleError(_0xea42cb,null));};exports[_0x8aa8('0x47')]=function(_0x2bc6d3,_0x2a0a14){return db[_0x8aa8('0x27')]['create'](_0x2bc6d3['body'],{})[_0x8aa8('0x22')](respondWithResult(_0x2a0a14,0xc9))[_0x8aa8('0x41')](handleError(_0x2a0a14,null));};exports['update']=function(_0x35eeea,_0x25906d){if(_0x35eeea[_0x8aa8('0x48')]['id']){delete _0x35eeea['body']['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x35eeea['params']['id']}})[_0x8aa8('0x22')](handleEntityNotFound(_0x25906d,null))[_0x8aa8('0x22')](saveUpdates(_0x35eeea['body'],null))[_0x8aa8('0x22')](respondWithResult(_0x25906d,null))[_0x8aa8('0x41')](handleError(_0x25906d,null));};exports[_0x8aa8('0x49')]=function(_0x1aa1b6,_0x20384a){return db[_0x8aa8('0x27')]['find']({'where':{'id':_0x1aa1b6['params']['id']}})[_0x8aa8('0x22')](handleEntityNotFound(_0x20384a,null))['then'](removeEntity(_0x20384a,null))[_0x8aa8('0x41')](handleError(_0x20384a,null));};exports['describe']=function(_0x1b4843,_0x263620){return db[_0x8aa8('0x27')][_0x8aa8('0x4a')]()[_0x8aa8('0x22')](respondWithResult(_0x263620,null))[_0x8aa8('0x41')](handleError(_0x263620,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index c7574fc..d0b38fb 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 _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','report_sms_transfer','uniqueid','bluebird'];(function(_0x1932b6,_0x54531e){var _0x298f0d=function(_0x2af5f9){while(--_0x2af5f9){_0x1932b6['push'](_0x1932b6['shift']());}};_0x298f0d(++_0x54531e);}(_0x5d58,0x187));var _0x85d5=function(_0x2d7e6b,_0x273088){_0x2d7e6b=_0x2d7e6b-0x0;var _0x8e8f41=_0x5d58[_0x2d7e6b];return _0x8e8f41;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./smsTransferReport.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('SmsTransferReport',attributes,{'tableName':_0x85d5('0x6'),'paranoid':![],'indexes':[{'name':_0x85d5('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsTransferReport.attributes','define'];(function(_0x3fa267,_0x4d53ef){var _0x2531c9=function(_0x390dd6){while(--_0x390dd6){_0x3fa267['push'](_0x3fa267['shift']());}};_0x2531c9(++_0x4d53ef);}(_0x82c4,0x1ca));var _0x482c=function(_0x946156,_0x4902e0){_0x946156=_0x946156-0x0;var _0x5a7488=_0x82c4[_0x946156];return _0x5a7488;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index e024b3c..304a15d 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 _0xec21=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash'];(function(_0x447973,_0x564e31){var _0x3600d8=function(_0x386f58){while(--_0x386f58){_0x447973['push'](_0x447973['shift']());}};_0x3600d8(++_0x564e31);}(_0xec21,0x1a1));var _0x1ec2=function(_0x13e17f,_0x89b33c){_0x13e17f=_0x13e17f-0x0;var _0x1eaa46=_0xec21[_0x13e17f];return _0x1eaa46;};'use strict';var _=require(_0x1ec2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ec2('0x1'));var rs=require(_0x1ec2('0x2'));var fs=require('fs');var Redis=require(_0x1ec2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ec2('0x4'));var logger=require(_0x1ec2('0x5'))(_0x1ec2('0x6'));var config=require(_0x1ec2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ec2('0x8')][_0x1ec2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45cb81,_0x3e1ff3,_0x190a86){return new BPromise(function(_0x271b9f,_0x1c7868){return client[_0x1ec2('0xa')](_0x45cb81,_0x190a86)['then'](function(_0x2150c2){logger['info'](_0x1ec2('0xb'),_0x3e1ff3,_0x1ec2('0xc'));logger['debug'](_0x1ec2('0xd'),_0x3e1ff3,'request\x20sent',JSON[_0x1ec2('0xe')](_0x2150c2));if(_0x2150c2[_0x1ec2('0xf')]){if(_0x2150c2[_0x1ec2('0xf')]['code']===0x1f4){logger['error'](_0x1ec2('0xb'),_0x3e1ff3,_0x2150c2[_0x1ec2('0xf')][_0x1ec2('0x10')]);return _0x1c7868(_0x2150c2['error'][_0x1ec2('0x10')]);}logger[_0x1ec2('0xf')](_0x1ec2('0xb'),_0x3e1ff3,_0x2150c2[_0x1ec2('0xf')][_0x1ec2('0x10')]);return _0x271b9f(_0x2150c2[_0x1ec2('0xf')][_0x1ec2('0x10')]);}else{logger[_0x1ec2('0x11')](_0x1ec2('0xb'),_0x3e1ff3,'request\x20sent');_0x271b9f(_0x2150c2['result'][_0x1ec2('0x10')]);}})[_0x1ec2('0x12')](function(_0x53cb63){logger[_0x1ec2('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x3e1ff3,_0x53cb63);_0x1c7868(_0x53cb63);});});} \ No newline at end of file +var _0xbf7c=['../../config/environment','client','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xbf7c,0xa4));var _0xcbf7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbf7c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xcbf7('0x0'));var moment=require(_0xcbf7('0x1'));var BPromise=require('bluebird');var rs=require(_0xcbf7('0x2'));var fs=require('fs');var Redis=require(_0xcbf7('0x3'));var db=require(_0xcbf7('0x4'))['db'];var utils=require(_0xcbf7('0x5'));var logger=require('../../config/logger')(_0xcbf7('0x6'));var config=require(_0xcbf7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcbf7('0x8')][_0xcbf7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42a645,_0x44bd5d,_0x4f5c5f){return new BPromise(function(_0x3127aa,_0x49110d){return client['request'](_0x42a645,_0x4f5c5f)[_0xcbf7('0xa')](function(_0x45158f){logger['info'](_0xcbf7('0xb'),_0x44bd5d,_0xcbf7('0xc'));logger['debug'](_0xcbf7('0xd'),_0x44bd5d,_0xcbf7('0xc'),JSON[_0xcbf7('0xe')](_0x45158f));if(_0x45158f[_0xcbf7('0xf')]){if(_0x45158f[_0xcbf7('0xf')]['code']===0x1f4){logger['error'](_0xcbf7('0xb'),_0x44bd5d,_0x45158f['error'][_0xcbf7('0x10')]);return _0x49110d(_0x45158f['error'][_0xcbf7('0x10')]);}logger[_0xcbf7('0xf')](_0xcbf7('0xb'),_0x44bd5d,_0x45158f['error'][_0xcbf7('0x10')]);return _0x3127aa(_0x45158f[_0xcbf7('0xf')][_0xcbf7('0x10')]);}else{logger['info'](_0xcbf7('0xb'),_0x44bd5d,_0xcbf7('0xc'));_0x3127aa(_0x45158f[_0xcbf7('0x11')]['message']);}})[_0xcbf7('0x12')](function(_0x1a81ca){logger[_0xcbf7('0xf')](_0xcbf7('0xb'),_0x44bd5d,_0x1a81ca);_0x49110d(_0x1a81ca);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 349ae65..bb2eba9 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 _0x2fb6=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get','show','/:id/download','download','diskStorage','root','format','%s-%s%s','basename','originalname','now','extname','post','single','file','create','put','delete','exports','util','path'];(function(_0x2fd333,_0x1ee373){var _0x5f00b3=function(_0x5075a5){while(--_0x5075a5){_0x2fd333['push'](_0x2fd333['shift']());}};_0x5f00b3(++_0x1ee373);}(_0x2fb6,0x193));var _0x62fb=function(_0x49fd2b,_0x354087){_0x49fd2b=_0x49fd2b-0x0;var _0x202bdf=_0x2fb6[_0x49fd2b];return _0x202bdf;};'use strict';var multer=require('multer');var util=require(_0x62fb('0x0'));var path=require(_0x62fb('0x1'));var timeout=require(_0x62fb('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x62fb('0x3'));var interaction=require(_0x62fb('0x4'));var config=require(_0x62fb('0x5'));var controller=require(_0x62fb('0x6'));router['get']('/',auth[_0x62fb('0x7')](),controller['index']);router[_0x62fb('0x8')]('/:id',auth[_0x62fb('0x7')](),controller[_0x62fb('0x9')]);router[_0x62fb('0x8')](_0x62fb('0xa'),auth[_0x62fb('0x7')](),controller[_0x62fb('0xb')]);var upload=multer({'storage':multer[_0x62fb('0xc')]({'destination':function(_0x91fb91,_0x1ea55a,_0x2fe3e2){_0x2fe3e2(null,path['join'](config[_0x62fb('0xd')],'server/files/sounds/original/'));},'filename':function(_0x44bff5,_0x81b3a5,_0xa6fe30){_0x81b3a5['originalname']=_0x81b3a5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa6fe30(null,util[_0x62fb('0xe')](_0x62fb('0xf'),path[_0x62fb('0x10')](_0x81b3a5[_0x62fb('0x11')],path['extname'](_0x81b3a5[_0x62fb('0x11')])),Date[_0x62fb('0x12')](),path[_0x62fb('0x13')](_0x81b3a5[_0x62fb('0x11')])));}})});router[_0x62fb('0x14')]('/',upload[_0x62fb('0x15')](_0x62fb('0x16')),controller[_0x62fb('0x17')]);router[_0x62fb('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x62fb('0x7')](),controller[_0x62fb('0x19')]);module[_0x62fb('0x1a')]=router; \ No newline at end of file +var _0x33da=['update','delete','multer','util','path','connect-timeout','express','Router','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','join','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33da,0x18a));var _0xa33d=function(_0x378380,_0x31dba0){_0x378380=_0x378380-0x0;var _0x2a4744=_0x33da[_0x378380];return _0x2a4744;};'use strict';var multer=require(_0xa33d('0x0'));var util=require(_0xa33d('0x1'));var path=require(_0xa33d('0x2'));var timeout=require(_0xa33d('0x3'));var express=require(_0xa33d('0x4'));var router=express[_0xa33d('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa33d('0x6'));router[_0xa33d('0x7')]('/',auth[_0xa33d('0x8')](),controller[_0xa33d('0x9')]);router[_0xa33d('0x7')](_0xa33d('0xa'),auth[_0xa33d('0x8')](),controller[_0xa33d('0xb')]);router[_0xa33d('0x7')](_0xa33d('0xc'),auth[_0xa33d('0x8')](),controller[_0xa33d('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x26f2d6,_0x2f2f91,_0x28ef5a){_0x28ef5a(null,path[_0xa33d('0xe')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x31d9e5,_0x376a47,_0xb7f42d){_0x376a47[_0xa33d('0xf')]=_0x376a47[_0xa33d('0xf')][_0xa33d('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb7f42d(null,util[_0xa33d('0x11')](_0xa33d('0x12'),path[_0xa33d('0x13')](_0x376a47[_0xa33d('0xf')],path[_0xa33d('0x14')](_0x376a47['originalname'])),Date['now'](),path[_0xa33d('0x14')](_0x376a47[_0xa33d('0xf')])));}})});router[_0xa33d('0x15')]('/',upload[_0xa33d('0x16')](_0xa33d('0x17')),controller[_0xa33d('0x18')]);router[_0xa33d('0x19')](_0xa33d('0xa'),auth['isAuthenticated'](),controller[_0xa33d('0x1a')]);router[_0xa33d('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xa33d('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 4b2ec80..850c04a 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 _0x0a1f=['FLOAT','sequelize','STRING','name','BIGINT','INTEGER'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x0a1f,0x79));var _0xf0a1=function(_0x56c314,_0x5b4da4){_0x56c314=_0x56c314-0x0;var _0x5db88=_0x0a1f[_0x56c314];return _0x5db88;};'use strict';var Sequelize=require(_0xf0a1('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0a1('0x1')],'unique':_0xf0a1('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf0a1('0x1')]},'display_name':{'type':Sequelize[_0xf0a1('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xf0a1('0x1')]},'original_format':{'type':Sequelize[_0xf0a1('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xf0a1('0x3')]},'original_channelCount':{'type':Sequelize[_0xf0a1('0x4')]},'original_bitRate':{'type':Sequelize[_0xf0a1('0x3')]},'original_sampleRate':{'type':Sequelize[_0xf0a1('0x4')]},'converted_format':{'type':Sequelize[_0xf0a1('0x1')]},'converted_duration':{'type':Sequelize[_0xf0a1('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xf0a1('0x3')]},'converted_channelCount':{'type':Sequelize[_0xf0a1('0x4')]},'converted_bitRate':{'type':Sequelize[_0xf0a1('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xf0a1('0x4')]}}; \ No newline at end of file +var _0xf721=['name','FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0xa12939,_0x1852d3){var _0x1ba267=function(_0x494868){while(--_0x494868){_0xa12939['push'](_0xa12939['shift']());}};_0x1ba267(++_0x1852d3);}(_0xf721,0x6a));var _0x1f72=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xf721[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x1f72('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f72('0x1')],'unique':_0x1f72('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1f72('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x1f72('0x3')]},'original_sampleCount':{'type':Sequelize[_0x1f72('0x4')]},'original_channelCount':{'type':Sequelize[_0x1f72('0x5')]},'original_bitRate':{'type':Sequelize[_0x1f72('0x4')]},'original_sampleRate':{'type':Sequelize[_0x1f72('0x5')]},'converted_format':{'type':Sequelize[_0x1f72('0x1')]},'converted_duration':{'type':Sequelize[_0x1f72('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x1f72('0x4')]},'converted_channelCount':{'type':Sequelize[_0x1f72('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'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 8bfc4c9..c825735 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 _0xd798=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','reject','save','update','destroy','get','Sounds','UserProfileResource','then','sendStatus','stack','name','send','index','rawAttributes','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','map','key','field','merge','options','Sound','count','include','findAll','rows','show','params','length','includeAll','find','catch','download','save_name','join','root','converted_format','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','zip-dir','fast-json-patch','bluebird','mustache','util'];(function(_0x4ef03d,_0x4b8062){var _0x33cce1=function(_0x202041){while(--_0x202041){_0x4ef03d['push'](_0x4ef03d['shift']());}};_0x33cce1(++_0x4b8062);}(_0xd798,0x77));var _0x8d79=function(_0x3ca58d,_0x7660bc){_0x3ca58d=_0x3ca58d-0x0;var _0x4f42ff=_0xd798[_0x3ca58d];return _0x4f42ff;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8d79('0x0'));var jsonpatch=require(_0x8d79('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8d79('0x2'));var Mustache=require(_0x8d79('0x3'));var util=require(_0x8d79('0x4'));var path=require('path');var sox=require(_0x8d79('0x5'));var csv=require(_0x8d79('0x6'));var ejs=require(_0x8d79('0x7'));var fs=require('fs');var _=require(_0x8d79('0x8'));var squel=require(_0x8d79('0x9'));var crypto=require(_0x8d79('0xa'));var jsforce=require(_0x8d79('0xb'));var deskjs=require(_0x8d79('0xc'));var toCsv=require(_0x8d79('0x6'));var querystring=require(_0x8d79('0xd'));var Papa=require(_0x8d79('0xe'));var Redis=require(_0x8d79('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8d79('0x10'));var hardwareService=require(_0x8d79('0x11'));var logger=require(_0x8d79('0x12'))(_0x8d79('0x13'));var utils=require(_0x8d79('0x14'));var config=require(_0x8d79('0x15'));var db=require(_0x8d79('0x16'))['db'];function respondWithStatusCode(_0x1fd9c2,_0x714470){_0x714470=_0x714470||0xcc;return function(_0x21ecc4){if(_0x21ecc4){return _0x1fd9c2['sendStatus'](_0x714470);}return _0x1fd9c2[_0x8d79('0x17')](_0x714470)[_0x8d79('0x18')]();};}function respondWithResult(_0x2656ea,_0x4656e4){_0x4656e4=_0x4656e4||0xc8;return function(_0x6fb82d){if(_0x6fb82d){return _0x2656ea['status'](_0x4656e4)['json'](_0x6fb82d);}};}function respondWithFilteredResult(_0x230a58,_0x4009b4){return function(_0x547297){if(_0x547297){var _0x58d555=_0x547297['count'],_0x21349d=_0x4009b4[_0x8d79('0x19')],_0x23dc8e=_0x4009b4['offset']+_0x4009b4[_0x8d79('0x1a')],_0x8b9539;if(_0x23dc8e>=_0x58d555){_0x23dc8e=_0x58d555;_0x8b9539=0xc8;}else{_0x8b9539=0xce;}_0x230a58[_0x8d79('0x17')](_0x8b9539);return _0x230a58[_0x8d79('0x1b')](_0x8d79('0x1c'),_0x21349d+'-'+_0x23dc8e+'/'+_0x58d555)[_0x8d79('0x1d')](_0x547297);}return null;};}function patchUpdates(_0x58b010){return function(_0x490fc3){try{jsonpatch['apply'](_0x490fc3,_0x58b010,!![]);}catch(_0x405397){return BPromise[_0x8d79('0x1e')](_0x405397);}return _0x490fc3[_0x8d79('0x1f')]();};}function saveUpdates(_0x5087ad,_0x4b1ecc){return function(_0x536780){if(_0x536780){return _0x536780[_0x8d79('0x20')](_0x5087ad)['then'](function(_0x4d29d3){return _0x4d29d3;});}return null;};}function removeEntity(_0x1dd8ac,_0x5b3391){return function(_0x569e44){if(_0x569e44){return _0x569e44[_0x8d79('0x21')]()['then'](function(){var _0x215fd8=_0x569e44[_0x8d79('0x22')]({'plain':!![]});var _0x11b6ee=_0x8d79('0x23');return db[_0x8d79('0x24')]['destroy']({'where':{'type':_0x11b6ee,'resourceId':_0x215fd8['id']}})[_0x8d79('0x25')](function(){return _0x569e44;});})['then'](function(){_0x1dd8ac[_0x8d79('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ced4,_0x3435a2){return function(_0x1b1aef){if(!_0x1b1aef){_0x56ced4[_0x8d79('0x26')](0x194);}return _0x1b1aef;};}function handleError(_0x293715,_0x3ef4da){_0x3ef4da=_0x3ef4da||0x1f4;return function(_0x87fb0f){logger['error'](_0x87fb0f[_0x8d79('0x27')]);if(_0x87fb0f[_0x8d79('0x28')]){delete _0x87fb0f[_0x8d79('0x28')];}_0x293715[_0x8d79('0x17')](_0x3ef4da)[_0x8d79('0x29')](_0x87fb0f);};}exports[_0x8d79('0x2a')]=function(_0x20a220,_0x300375){var _0x5e4e8c={},_0x59107e={},_0x502322={'count':0x0,'rows':[]};var _0x3091f1=db['Sound'][_0x8d79('0x2b')];_0x59107e['model']=_[_0x8d79('0x2c')](_0x3091f1);_0x59107e[_0x8d79('0x2d')]=_[_0x8d79('0x2c')](_0x20a220['query']);_0x59107e[_0x8d79('0x2e')]=_[_0x8d79('0x2f')](_0x59107e[_0x8d79('0x30')],_0x59107e[_0x8d79('0x2d')]);_0x5e4e8c['attributes']=_['intersection'](_0x59107e[_0x8d79('0x30')],qs[_0x8d79('0x31')](_0x20a220[_0x8d79('0x2d')][_0x8d79('0x31')]));_0x5e4e8c[_0x8d79('0x32')]=_0x5e4e8c[_0x8d79('0x32')]['length']?_0x5e4e8c[_0x8d79('0x32')]:_0x59107e[_0x8d79('0x30')];if(!_0x20a220[_0x8d79('0x2d')][_0x8d79('0x33')](_0x8d79('0x34'))){_0x5e4e8c[_0x8d79('0x1a')]=qs[_0x8d79('0x1a')](_0x20a220[_0x8d79('0x2d')]['limit']);_0x5e4e8c[_0x8d79('0x19')]=qs[_0x8d79('0x19')](_0x20a220[_0x8d79('0x2d')][_0x8d79('0x19')]);}_0x5e4e8c[_0x8d79('0x35')]=qs['sort'](_0x20a220[_0x8d79('0x2d')]['sort']);_0x5e4e8c[_0x8d79('0x36')]=qs[_0x8d79('0x2e')](_[_0x8d79('0x37')](_0x20a220[_0x8d79('0x2d')],_0x59107e[_0x8d79('0x2e')]));if(_0x20a220['query'][_0x8d79('0x38')]){_0x5e4e8c['where']=_['merge'](_0x5e4e8c[_0x8d79('0x36')],{'$or':_[_0x8d79('0x39')](_0x3091f1,function(_0x684ab7){if(_0x684ab7['type'][_0x8d79('0x3a')]!=='VIRTUAL'){var _0x16bb56={};_0x16bb56[_0x684ab7[_0x8d79('0x3b')]]={'$like':'%'+_0x20a220[_0x8d79('0x2d')][_0x8d79('0x38')]+'%'};return _0x16bb56;}})});}_0x5e4e8c=_[_0x8d79('0x3c')]({},_0x5e4e8c,_0x20a220[_0x8d79('0x3d')]);var _0x4f3fe6={'where':_0x5e4e8c[_0x8d79('0x36')]};return db[_0x8d79('0x3e')]['count'](_0x4f3fe6)[_0x8d79('0x25')](function(_0x3c69d2){_0x502322[_0x8d79('0x3f')]=_0x3c69d2;if(_0x20a220[_0x8d79('0x2d')]['includeAll']){_0x5e4e8c[_0x8d79('0x40')]=[{'all':!![]}];}return db['Sound'][_0x8d79('0x41')](_0x5e4e8c);})[_0x8d79('0x25')](function(_0x162439){_0x502322[_0x8d79('0x42')]=_0x162439;return _0x502322;})[_0x8d79('0x25')](respondWithFilteredResult(_0x300375,_0x5e4e8c))['catch'](handleError(_0x300375,null));};exports[_0x8d79('0x43')]=function(_0x1980e0,_0x2d08e4){var _0x219af3={'raw':!![],'where':{'id':_0x1980e0[_0x8d79('0x44')]['id']}},_0x235a2e={};_0x235a2e['model']=_[_0x8d79('0x2c')](db[_0x8d79('0x3e')][_0x8d79('0x2b')]);_0x235a2e[_0x8d79('0x2d')]=_[_0x8d79('0x2c')](_0x1980e0[_0x8d79('0x2d')]);_0x235a2e[_0x8d79('0x2e')]=_[_0x8d79('0x2f')](_0x235a2e['model'],_0x235a2e[_0x8d79('0x2d')]);_0x219af3[_0x8d79('0x32')]=_[_0x8d79('0x2f')](_0x235a2e[_0x8d79('0x30')],qs['fields'](_0x1980e0[_0x8d79('0x2d')][_0x8d79('0x31')]));_0x219af3['attributes']=_0x219af3['attributes'][_0x8d79('0x45')]?_0x219af3[_0x8d79('0x32')]:_0x235a2e[_0x8d79('0x30')];if(_0x1980e0['query'][_0x8d79('0x46')]){_0x219af3[_0x8d79('0x40')]=[{'all':!![]}];}_0x219af3=_[_0x8d79('0x3c')]({},_0x219af3,_0x1980e0[_0x8d79('0x3d')]);return db[_0x8d79('0x3e')][_0x8d79('0x47')](_0x219af3)[_0x8d79('0x25')](handleEntityNotFound(_0x2d08e4,null))[_0x8d79('0x25')](respondWithResult(_0x2d08e4,null))[_0x8d79('0x48')](handleError(_0x2d08e4,null));};exports[_0x8d79('0x49')]=function(_0xf30ee1,_0x17de3c,_0x4055ce){return db[_0x8d79('0x3e')][_0x8d79('0x47')]({'where':{'id':_0xf30ee1['params']['id']},'attributes':['name',_0x8d79('0x4a'),'converted_format'],'raw':!![]})[_0x8d79('0x25')](handleEntityNotFound(_0x17de3c,null))['then'](function(_0xd6855a){if(_0xd6855a){if(!fs['existsSync'](path[_0x8d79('0x4b')](config[_0x8d79('0x4c')],'server/files/sounds/converted',_0xd6855a[_0x8d79('0x4a')]+'.'+_0xd6855a[_0x8d79('0x4d')]))){throw new db[(_0x8d79('0x4e'))]['ValidationError'](_0x8d79('0x4f'));}return _0x17de3c[_0x8d79('0x49')](path['join'](config[_0x8d79('0x4c')],_0x8d79('0x50'),util[_0x8d79('0x51')](_0x8d79('0x52'),_0xd6855a[_0x8d79('0x4a')],_0xd6855a['converted_format'])),util[_0x8d79('0x51')](_0x8d79('0x52'),_0xd6855a[_0x8d79('0x28')],_0xd6855a['converted_format']));}return null;})[_0x8d79('0x48')](handleError(_0x17de3c,null));};exports[_0x8d79('0x53')]=function(_0xdeb9d8,_0x4c1e57,_0x153f39){var _0xb0f392={'name':path[_0x8d79('0x54')](_0xdeb9d8[_0x8d79('0x55')][_0x8d79('0x56')],path[_0x8d79('0x57')](_0xdeb9d8[_0x8d79('0x55')][_0x8d79('0x56')])),'save_name':path[_0x8d79('0x54')](_0xdeb9d8[_0x8d79('0x55')][_0x8d79('0x58')],path[_0x8d79('0x57')](_0xdeb9d8['file'][_0x8d79('0x58')])),'original_format':path['extname'](_0xdeb9d8[_0x8d79('0x55')][_0x8d79('0x56')])[_0x8d79('0x59')](0x1),'converted_format':_0x8d79('0x5a')};var _0x5559bf=path['join'](config['root'],_0x8d79('0x5b'),_0xdeb9d8[_0x8d79('0x55')][_0x8d79('0x58')]);var _0x3db772=path[_0x8d79('0x4b')](config[_0x8d79('0x4c')],_0x8d79('0x50'),util['format'](_0x8d79('0x52'),path[_0x8d79('0x54')](_0xdeb9d8[_0x8d79('0x55')][_0x8d79('0x58')],path['extname'](_0xdeb9d8[_0x8d79('0x55')][_0x8d79('0x58')])),_0xb0f392['converted_format']));logger[_0x8d79('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x5559bf);logger[_0x8d79('0x5c')](_0x8d79('0x5d'),_0x3db772);try{fs[_0x8d79('0x5e')](_0x5559bf,parseInt(_0x8d79('0x5f'),0x8));var _0x46b776=sox['transcode'](_0x5559bf,_0x3db772,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x46b776['on'](_0x8d79('0x60'),function(_0x574b46){fs[_0x8d79('0x61')](_0x5559bf);_0x4c1e57['status'](0x1f4)['send'](_0x574b46);});_0x46b776['on'](_0x8d79('0x62'),function(_0x520e6c){_0xb0f392[_0x8d79('0x63')]=isNaN(_0x520e6c[_0x8d79('0x64')])?null:_0x520e6c[_0x8d79('0x64')]*0x3e8;_0xb0f392[_0x8d79('0x65')]=isNaN(_0x520e6c[_0x8d79('0x66')])?null:_0x520e6c['sampleCount'];_0xb0f392['original_channelCount']=isNaN(_0x520e6c[_0x8d79('0x67')])?null:_0x520e6c[_0x8d79('0x67')];_0xb0f392[_0x8d79('0x68')]=isNaN(_0x520e6c['bitRate'])?null:_0x520e6c[_0x8d79('0x69')];_0xb0f392['original_sampleRate']=isNaN(_0x520e6c[_0x8d79('0x6a')])?null:_0x520e6c['sampleRate'];});_0x46b776['on'](_0x8d79('0x6b'),function(_0x3aecf9){_0xb0f392[_0x8d79('0x6c')]=isNaN(_0x3aecf9[_0x8d79('0x64')])?null:_0x3aecf9[_0x8d79('0x64')]*0x3e8;_0xb0f392[_0x8d79('0x6d')]=isNaN(_0x3aecf9[_0x8d79('0x66')])?null:_0x3aecf9[_0x8d79('0x66')];_0xb0f392[_0x8d79('0x6e')]=isNaN(_0x3aecf9['channelCount'])?null:_0x3aecf9['channelCount'];_0xb0f392[_0x8d79('0x6f')]=isNaN(_0x3aecf9[_0x8d79('0x69')])?null:_0x3aecf9[_0x8d79('0x69')];_0xb0f392[_0x8d79('0x70')]=isNaN(_0x3aecf9[_0x8d79('0x6a')])?null:_0x3aecf9[_0x8d79('0x6a')];});_0x46b776['on'](_0x8d79('0x18'),function(){fs[_0x8d79('0x5e')](_0x3db772,parseInt(_0x8d79('0x5f'),0x8));return db[_0x8d79('0x3e')][_0x8d79('0x53')](_0xb0f392)[_0x8d79('0x25')](function(_0x3bee24){var _0x2ff77c={'role':_0xdeb9d8[_0x8d79('0x71')][_0x8d79('0x72')],'userProfileId':_0xdeb9d8[_0x8d79('0x71')][_0x8d79('0x73')]};if(!_0x2ff77c)throw new Error(_0x8d79('0x74'));if(_0x2ff77c[_0x8d79('0x72')]===_0x8d79('0x75')){var _0x1bcb86=_0x3bee24['get']({'plain':!![]});return db['UserProfileSection'][_0x8d79('0x47')]({'where':{'name':_0x8d79('0x23'),'userProfileId':_0x2ff77c[_0x8d79('0x73')]},'raw':!![]})[_0x8d79('0x25')](function(_0x21999f){if(_0x21999f&&_0x21999f[_0x8d79('0x76')]===0x0){return db[_0x8d79('0x24')][_0x8d79('0x53')]({'name':_0x1bcb86[_0x8d79('0x28')],'resourceId':_0x1bcb86['id'],'type':_0x21999f[_0x8d79('0x28')],'sectionId':_0x21999f['id']},{})[_0x8d79('0x25')](function(){return _0x3bee24;});}else{return _0x3bee24;}})[_0x8d79('0x48')](function(_0x4bb150){logger[_0x8d79('0x60')](_0x8d79('0x77'),_0x4bb150);throw _0x4bb150;});}return _0x3bee24;})['then'](respondWithResult(_0x4c1e57,null))[_0x8d79('0x48')](handleError(_0x4c1e57,null));});_0x46b776[_0x8d79('0x78')]();}catch(_0x522f5a){_0x4c1e57[_0x8d79('0x17')](0x1f4)[_0x8d79('0x29')](_0x522f5a);}};exports[_0x8d79('0x20')]=function(_0x2de85a,_0x541947,_0x1a3422){return db[_0x8d79('0x3e')][_0x8d79('0x47')]({'where':{'id':_0x2de85a[_0x8d79('0x44')]['id']}})[_0x8d79('0x25')](handleEntityNotFound(_0x541947,null))[_0x8d79('0x25')](saveUpdates(_[_0x8d79('0x37')](_0x2de85a[_0x8d79('0x71')],[_0x8d79('0x28'),_0x8d79('0x79')]),null))[_0x8d79('0x25')](respondWithResult(_0x541947,null))[_0x8d79('0x48')](handleError(_0x541947,null));};exports[_0x8d79('0x7a')]=function(_0x5d7bc8,_0x4cc4dc,_0x178ef6){return db[_0x8d79('0x3e')][_0x8d79('0x47')]({'where':{'id':_0x5d7bc8['params']['id']}})[_0x8d79('0x25')](function(_0x54eb00){if(_0x54eb00){return _0x54eb00['destroy']();}})[_0x8d79('0x25')](function(_0x55d08f){var _0x4ed71f=path[_0x8d79('0x4b')](config[_0x8d79('0x4c')],_0x8d79('0x5b'),util[_0x8d79('0x51')]('%s.%s',_0x55d08f[_0x8d79('0x4a')],_0x55d08f[_0x8d79('0x7b')]));var _0x5ae47c=path[_0x8d79('0x4b')](config[_0x8d79('0x4c')],'server/files/sounds/converted',util['format'](_0x8d79('0x52'),_0x55d08f[_0x8d79('0x4a')],_0x55d08f[_0x8d79('0x4d')]));fs[_0x8d79('0x61')](_0x4ed71f);fs[_0x8d79('0x61')](_0x5ae47c);return _0x55d08f;})['then'](function(_0x233f3f){if(_0x233f3f){return _0x4cc4dc[_0x8d79('0x17')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x4cc4dc,null))[_0x8d79('0x48')](handleError(_0x4cc4dc,null));}; \ No newline at end of file +var _0x55d4=['sampleRate','dest','converted_sampleCount','converted_bitRate','converted_sampleRate','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','delete','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','Sound','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','find','params','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','download','join','%s.%s','format','create','file','originalname','basename','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate'];(function(_0x2959f3,_0x2c2ebe){var _0x290b3a=function(_0x8ea139){while(--_0x8ea139){_0x2959f3['push'](_0x2959f3['shift']());}};_0x290b3a(++_0x2c2ebe);}(_0x55d4,0x195));var _0x455d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x55d4[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x455d('0x0'));var emlformat=require(_0x455d('0x1'));var rimraf=require(_0x455d('0x2'));var zipdir=require(_0x455d('0x3'));var jsonpatch=require(_0x455d('0x4'));var rp=require(_0x455d('0x5'));var moment=require('moment');var BPromise=require(_0x455d('0x6'));var Mustache=require(_0x455d('0x7'));var util=require(_0x455d('0x8'));var path=require(_0x455d('0x9'));var sox=require(_0x455d('0xa'));var csv=require(_0x455d('0xb'));var ejs=require(_0x455d('0xc'));var fs=require('fs');var _=require(_0x455d('0xd'));var squel=require(_0x455d('0xe'));var crypto=require(_0x455d('0xf'));var jsforce=require(_0x455d('0x10'));var deskjs=require(_0x455d('0x11'));var toCsv=require(_0x455d('0xb'));var querystring=require(_0x455d('0x12'));var Papa=require(_0x455d('0x13'));var Redis=require(_0x455d('0x14'));var authService=require(_0x455d('0x15'));var qs=require(_0x455d('0x16'));var hardwareService=require(_0x455d('0x17'));var logger=require(_0x455d('0x18'))(_0x455d('0x19'));var utils=require('../../config/utils');var config=require(_0x455d('0x1a'));var db=require(_0x455d('0x1b'))['db'];function respondWithStatusCode(_0x317595,_0x4ad6c7){_0x4ad6c7=_0x4ad6c7||0xcc;return function(_0x3cd548){if(_0x3cd548){return _0x317595[_0x455d('0x1c')](_0x4ad6c7);}return _0x317595[_0x455d('0x1d')](_0x4ad6c7)[_0x455d('0x1e')]();};}function respondWithResult(_0x1d2f93,_0x34a161){_0x34a161=_0x34a161||0xc8;return function(_0x27ca84){if(_0x27ca84){return _0x1d2f93[_0x455d('0x1d')](_0x34a161)[_0x455d('0x1f')](_0x27ca84);}};}function respondWithFilteredResult(_0x596e61,_0x128efd){return function(_0x5690b7){if(_0x5690b7){var _0x1d457f=_0x5690b7[_0x455d('0x20')],_0x93ae8c=_0x128efd[_0x455d('0x21')],_0x212aac=_0x128efd['offset']+_0x128efd[_0x455d('0x22')],_0x3fb2cc;if(_0x212aac>=_0x1d457f){_0x212aac=_0x1d457f;_0x3fb2cc=0xc8;}else{_0x3fb2cc=0xce;}_0x596e61['status'](_0x3fb2cc);return _0x596e61[_0x455d('0x23')](_0x455d('0x24'),_0x93ae8c+'-'+_0x212aac+'/'+_0x1d457f)[_0x455d('0x1f')](_0x5690b7);}return null;};}function patchUpdates(_0x33ed18){return function(_0x2be2b6){try{jsonpatch[_0x455d('0x25')](_0x2be2b6,_0x33ed18,!![]);}catch(_0x3a97f5){return BPromise[_0x455d('0x26')](_0x3a97f5);}return _0x2be2b6['save']();};}function saveUpdates(_0x39d2a4,_0x2cd54c){return function(_0x18d980){if(_0x18d980){return _0x18d980[_0x455d('0x27')](_0x39d2a4)[_0x455d('0x28')](function(_0x1c70bc){return _0x1c70bc;});}return null;};}function removeEntity(_0x59ce13,_0x4eef24){return function(_0x20c4ad){if(_0x20c4ad){return _0x20c4ad[_0x455d('0x29')]()[_0x455d('0x28')](function(){var _0x240867=_0x20c4ad[_0x455d('0x2a')]({'plain':!![]});var _0x34fd3c=_0x455d('0x2b');return db[_0x455d('0x2c')][_0x455d('0x29')]({'where':{'type':_0x34fd3c,'resourceId':_0x240867['id']}})[_0x455d('0x28')](function(){return _0x20c4ad;});})[_0x455d('0x28')](function(){_0x59ce13[_0x455d('0x1d')](0xcc)[_0x455d('0x1e')]();});}};}function handleEntityNotFound(_0x542452,_0x1799fe){return function(_0x2cb71d){if(!_0x2cb71d){_0x542452[_0x455d('0x1c')](0x194);}return _0x2cb71d;};}function handleError(_0x47917b,_0x48be3a){_0x48be3a=_0x48be3a||0x1f4;return function(_0x4ff2a9){logger[_0x455d('0x2d')](_0x4ff2a9[_0x455d('0x2e')]);if(_0x4ff2a9['name']){delete _0x4ff2a9[_0x455d('0x2f')];}_0x47917b[_0x455d('0x1d')](_0x48be3a)['send'](_0x4ff2a9);};}exports['index']=function(_0x40cffb,_0x23256d){var _0x39fd28={},_0x512e31={},_0x34c13b={'count':0x0,'rows':[]};var _0x4be07e=db[_0x455d('0x30')][_0x455d('0x31')];_0x512e31['model']=_[_0x455d('0x32')](_0x4be07e);_0x512e31['query']=_[_0x455d('0x32')](_0x40cffb[_0x455d('0x33')]);_0x512e31[_0x455d('0x34')]=_[_0x455d('0x35')](_0x512e31[_0x455d('0x36')],_0x512e31[_0x455d('0x33')]);_0x39fd28[_0x455d('0x37')]=_[_0x455d('0x35')](_0x512e31[_0x455d('0x36')],qs[_0x455d('0x38')](_0x40cffb[_0x455d('0x33')][_0x455d('0x38')]));_0x39fd28['attributes']=_0x39fd28[_0x455d('0x37')][_0x455d('0x39')]?_0x39fd28[_0x455d('0x37')]:_0x512e31['model'];if(!_0x40cffb[_0x455d('0x33')]['hasOwnProperty'](_0x455d('0x3a'))){_0x39fd28[_0x455d('0x22')]=qs[_0x455d('0x22')](_0x40cffb[_0x455d('0x33')]['limit']);_0x39fd28[_0x455d('0x21')]=qs[_0x455d('0x21')](_0x40cffb['query']['offset']);}_0x39fd28[_0x455d('0x3b')]=qs[_0x455d('0x3c')](_0x40cffb['query']['sort']);_0x39fd28[_0x455d('0x3d')]=qs[_0x455d('0x34')](_[_0x455d('0x3e')](_0x40cffb[_0x455d('0x33')],_0x512e31['filters']));if(_0x40cffb[_0x455d('0x33')][_0x455d('0x3f')]){_0x39fd28[_0x455d('0x3d')]=_[_0x455d('0x40')](_0x39fd28['where'],{'$or':_[_0x455d('0x41')](_0x4be07e,function(_0x5c6701){if(_0x5c6701[_0x455d('0x42')]['key']!==_0x455d('0x43')){var _0x1abe7a={};_0x1abe7a[_0x5c6701[_0x455d('0x44')]]={'$like':'%'+_0x40cffb[_0x455d('0x33')]['filter']+'%'};return _0x1abe7a;}})});}_0x39fd28=_[_0x455d('0x40')]({},_0x39fd28,_0x40cffb[_0x455d('0x45')]);var _0x58afea={'where':_0x39fd28[_0x455d('0x3d')]};return db['Sound'][_0x455d('0x20')](_0x58afea)['then'](function(_0x4534fa){_0x34c13b[_0x455d('0x20')]=_0x4534fa;if(_0x40cffb[_0x455d('0x33')][_0x455d('0x46')]){_0x39fd28[_0x455d('0x47')]=[{'all':!![]}];}return db[_0x455d('0x30')][_0x455d('0x48')](_0x39fd28);})['then'](function(_0x379655){_0x34c13b[_0x455d('0x49')]=_0x379655;return _0x34c13b;})[_0x455d('0x28')](respondWithFilteredResult(_0x23256d,_0x39fd28))[_0x455d('0x4a')](handleError(_0x23256d,null));};exports[_0x455d('0x4b')]=function(_0x4d11cd,_0x238573){var _0x277f70={'raw':!![],'where':{'id':_0x4d11cd['params']['id']}},_0x571781={};_0x571781[_0x455d('0x36')]=_[_0x455d('0x32')](db[_0x455d('0x30')][_0x455d('0x31')]);_0x571781[_0x455d('0x33')]=_[_0x455d('0x32')](_0x4d11cd[_0x455d('0x33')]);_0x571781[_0x455d('0x34')]=_[_0x455d('0x35')](_0x571781[_0x455d('0x36')],_0x571781['query']);_0x277f70[_0x455d('0x37')]=_[_0x455d('0x35')](_0x571781['model'],qs[_0x455d('0x38')](_0x4d11cd['query']['fields']));_0x277f70[_0x455d('0x37')]=_0x277f70[_0x455d('0x37')][_0x455d('0x39')]?_0x277f70['attributes']:_0x571781['model'];if(_0x4d11cd[_0x455d('0x33')][_0x455d('0x46')]){_0x277f70['include']=[{'all':!![]}];}_0x277f70=_['merge']({},_0x277f70,_0x4d11cd[_0x455d('0x45')]);return db[_0x455d('0x30')]['find'](_0x277f70)[_0x455d('0x28')](handleEntityNotFound(_0x238573,null))[_0x455d('0x28')](respondWithResult(_0x238573,null))[_0x455d('0x4a')](handleError(_0x238573,null));};exports['download']=function(_0x4bb9c5,_0x1794e1,_0x51c419){return db[_0x455d('0x30')][_0x455d('0x4c')]({'where':{'id':_0x4bb9c5[_0x455d('0x4d')]['id']},'attributes':['name','save_name','converted_format'],'raw':!![]})[_0x455d('0x28')](handleEntityNotFound(_0x1794e1,null))[_0x455d('0x28')](function(_0x4d6e87){if(_0x4d6e87){if(!fs['existsSync'](path['join'](config[_0x455d('0x4e')],_0x455d('0x4f'),_0x4d6e87[_0x455d('0x50')]+'.'+_0x4d6e87[_0x455d('0x51')]))){throw new db[(_0x455d('0x52'))][(_0x455d('0x53'))](_0x455d('0x54'));}return _0x1794e1[_0x455d('0x55')](path[_0x455d('0x56')](config[_0x455d('0x4e')],_0x455d('0x4f'),util['format'](_0x455d('0x57'),_0x4d6e87['save_name'],_0x4d6e87[_0x455d('0x51')])),util[_0x455d('0x58')](_0x455d('0x57'),_0x4d6e87['name'],_0x4d6e87['converted_format']));}return null;})[_0x455d('0x4a')](handleError(_0x1794e1,null));};exports[_0x455d('0x59')]=function(_0x4970a1,_0x245fd8,_0x102ec0){var _0x2b3e23={'name':path['basename'](_0x4970a1[_0x455d('0x5a')][_0x455d('0x5b')],path['extname'](_0x4970a1[_0x455d('0x5a')]['originalname'])),'save_name':path[_0x455d('0x5c')](_0x4970a1['file'][_0x455d('0x5d')],path[_0x455d('0x5e')](_0x4970a1[_0x455d('0x5a')][_0x455d('0x5d')])),'original_format':path[_0x455d('0x5e')](_0x4970a1[_0x455d('0x5a')][_0x455d('0x5b')])[_0x455d('0x5f')](0x1),'converted_format':_0x455d('0x60')};var _0x1983f9=path[_0x455d('0x56')](config[_0x455d('0x4e')],_0x455d('0x61'),_0x4970a1[_0x455d('0x5a')][_0x455d('0x5d')]);var _0x52fe7c=path['join'](config[_0x455d('0x4e')],_0x455d('0x4f'),util[_0x455d('0x58')](_0x455d('0x57'),path[_0x455d('0x5c')](_0x4970a1[_0x455d('0x5a')][_0x455d('0x5d')],path[_0x455d('0x5e')](_0x4970a1['file']['filename'])),_0x2b3e23[_0x455d('0x51')]));logger[_0x455d('0x62')](_0x455d('0x63'),_0x1983f9);logger['info'](_0x455d('0x64'),_0x52fe7c);try{fs[_0x455d('0x65')](_0x1983f9,parseInt(_0x455d('0x66'),0x8));var _0x27777b=sox[_0x455d('0x67')](_0x1983f9,_0x52fe7c,{'sampleRate':0x1f40,'format':_0x455d('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27777b['on']('error',function(_0x5843ff){fs[_0x455d('0x68')](_0x1983f9);_0x245fd8[_0x455d('0x1d')](0x1f4)[_0x455d('0x69')](_0x5843ff);});_0x27777b['on'](_0x455d('0x6a'),function(_0x281466){_0x2b3e23[_0x455d('0x6b')]=isNaN(_0x281466[_0x455d('0x6c')])?null:_0x281466[_0x455d('0x6c')]*0x3e8;_0x2b3e23[_0x455d('0x6d')]=isNaN(_0x281466['sampleCount'])?null:_0x281466[_0x455d('0x6e')];_0x2b3e23[_0x455d('0x6f')]=isNaN(_0x281466[_0x455d('0x70')])?null:_0x281466['channelCount'];_0x2b3e23['original_bitRate']=isNaN(_0x281466[_0x455d('0x71')])?null:_0x281466[_0x455d('0x71')];_0x2b3e23[_0x455d('0x72')]=isNaN(_0x281466[_0x455d('0x73')])?null:_0x281466['sampleRate'];});_0x27777b['on'](_0x455d('0x74'),function(_0x7f6443){_0x2b3e23['converted_duration']=isNaN(_0x7f6443['duration'])?null:_0x7f6443['duration']*0x3e8;_0x2b3e23[_0x455d('0x75')]=isNaN(_0x7f6443[_0x455d('0x6e')])?null:_0x7f6443['sampleCount'];_0x2b3e23['converted_channelCount']=isNaN(_0x7f6443[_0x455d('0x70')])?null:_0x7f6443[_0x455d('0x70')];_0x2b3e23[_0x455d('0x76')]=isNaN(_0x7f6443['bitRate'])?null:_0x7f6443[_0x455d('0x71')];_0x2b3e23[_0x455d('0x77')]=isNaN(_0x7f6443[_0x455d('0x73')])?null:_0x7f6443[_0x455d('0x73')];});_0x27777b['on']('end',function(){fs[_0x455d('0x65')](_0x52fe7c,parseInt(_0x455d('0x66'),0x8));return db[_0x455d('0x30')]['create'](_0x2b3e23)[_0x455d('0x28')](function(_0x371769){var _0x2ff501={'role':_0x4970a1['body'][_0x455d('0x78')],'userProfileId':_0x4970a1['body'][_0x455d('0x79')]};if(!_0x2ff501)throw new Error(_0x455d('0x7a'));if(_0x2ff501[_0x455d('0x78')]===_0x455d('0x7b')){var _0x3ae58c=_0x371769[_0x455d('0x2a')]({'plain':!![]});return db[_0x455d('0x7c')][_0x455d('0x4c')]({'where':{'name':_0x455d('0x2b'),'userProfileId':_0x2ff501['userProfileId']},'raw':!![]})[_0x455d('0x28')](function(_0x39171e){if(_0x39171e&&_0x39171e[_0x455d('0x7d')]===0x0){return db[_0x455d('0x2c')]['create']({'name':_0x3ae58c[_0x455d('0x2f')],'resourceId':_0x3ae58c['id'],'type':_0x39171e[_0x455d('0x2f')],'sectionId':_0x39171e['id']},{})[_0x455d('0x28')](function(){return _0x371769;});}else{return _0x371769;}})['catch'](function(_0x10f6c3){logger[_0x455d('0x2d')](_0x455d('0x7e'),_0x10f6c3);throw _0x10f6c3;});}return _0x371769;})['then'](respondWithResult(_0x245fd8,null))[_0x455d('0x4a')](handleError(_0x245fd8,null));});_0x27777b['start']();}catch(_0x1bd91f){_0x245fd8[_0x455d('0x1d')](0x1f4)['send'](_0x1bd91f);}};exports[_0x455d('0x27')]=function(_0x221035,_0x1b6439,_0x4bc62e){return db[_0x455d('0x30')][_0x455d('0x4c')]({'where':{'id':_0x221035[_0x455d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1b6439,null))[_0x455d('0x28')](saveUpdates(_['pick'](_0x221035[_0x455d('0x7f')],[_0x455d('0x2f'),'description']),null))[_0x455d('0x28')](respondWithResult(_0x1b6439,null))['catch'](handleError(_0x1b6439,null));};exports[_0x455d('0x80')]=function(_0x3be158,_0x284237,_0x3a4c1c){return db[_0x455d('0x30')][_0x455d('0x4c')]({'where':{'id':_0x3be158[_0x455d('0x4d')]['id']}})['then'](function(_0x315f47){if(_0x315f47){return _0x315f47[_0x455d('0x29')]();}})['then'](function(_0x6378be){var _0x2a3a33=path['join'](config[_0x455d('0x4e')],_0x455d('0x61'),util[_0x455d('0x58')]('%s.%s',_0x6378be['save_name'],_0x6378be[_0x455d('0x81')]));var _0x21da3e=path[_0x455d('0x56')](config['root'],_0x455d('0x4f'),util[_0x455d('0x58')](_0x455d('0x57'),_0x6378be[_0x455d('0x50')],_0x6378be[_0x455d('0x51')]));fs['unlinkSync'](_0x2a3a33);fs['unlinkSync'](_0x21da3e);return _0x6378be;})[_0x455d('0x28')](function(_0x39f63f){if(_0x39f63f){return _0x284237[_0x455d('0x1d')](0xcc)[_0x455d('0x1e')]();}})[_0x455d('0x28')](handleEntityNotFound(_0x284237,null))[_0x455d('0x4a')](handleError(_0x284237,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index fe96ba2..c770264 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 _0x822a=['util','../../config/logger','api','moment','bluebird','rimraf','exports','define','Sound','tools_sounds','lodash'];(function(_0x55805d,_0x3815b2){var _0x263d53=function(_0x997455){while(--_0x997455){_0x55805d['push'](_0x55805d['shift']());}};_0x263d53(++_0x3815b2);}(_0x822a,0x196));var _0xa822=function(_0x3fb166,_0x4eb985){_0x3fb166=_0x3fb166-0x0;var _0x5e91be=_0x822a[_0x3fb166];return _0x5e91be;};'use strict';var _=require(_0xa822('0x0'));var util=require(_0xa822('0x1'));var logger=require(_0xa822('0x2'))(_0xa822('0x3'));var moment=require(_0xa822('0x4'));var BPromise=require(_0xa822('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa822('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0xa822('0x7')]=function(_0x2d75dc,_0x2f1157){return _0x2d75dc[_0xa822('0x8')](_0xa822('0x9'),attributes,{'tableName':_0xa822('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc11=['./sound.attributes','exports','Sound','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x45aef3,_0x39ff43){var _0x42af96=function(_0x27af9e){while(--_0x27af9e){_0x45aef3['push'](_0x45aef3['shift']());}};_0x42af96(++_0x39ff43);}(_0xbc11,0x9d));var _0x1bc1=function(_0x9e8bdf,_0x1ca35a){_0x9e8bdf=_0x9e8bdf-0x0;var _0x4a76c6=_0xbc11[_0x9e8bdf];return _0x4a76c6;};'use strict';var _=require(_0x1bc1('0x0'));var util=require('util');var logger=require(_0x1bc1('0x1'))(_0x1bc1('0x2'));var moment=require('moment');var BPromise=require(_0x1bc1('0x3'));var rp=require(_0x1bc1('0x4'));var fs=require('fs');var path=require(_0x1bc1('0x5'));var rimraf=require(_0x1bc1('0x6'));var config=require(_0x1bc1('0x7'));var attributes=require(_0x1bc1('0x8'));module[_0x1bc1('0x9')]=function(_0x309596,_0x9c58c3){return _0x309596['define'](_0x1bc1('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 57af409..3ded7be 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 _0x47b3=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','moment','bluebird'];(function(_0x573002,_0x567b76){var _0x3c6669=function(_0x264690){while(--_0x264690){_0x573002['push'](_0x573002['shift']());}};_0x3c6669(++_0x567b76);}(_0x47b3,0x1ec));var _0x347b=function(_0x58b51e,_0x52f0b0){_0x58b51e=_0x58b51e-0x0;var _0x37d8ec=_0x47b3[_0x58b51e];return _0x37d8ec;};'use strict';var _=require(_0x347b('0x0'));var util=require('util');var moment=require(_0x347b('0x1'));var BPromise=require(_0x347b('0x2'));var rs=require(_0x347b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x347b('0x4'))['db'];var utils=require(_0x347b('0x5'));var logger=require(_0x347b('0x6'))(_0x347b('0x7'));var config=require(_0x347b('0x8'));var jayson=require(_0x347b('0x9'));var client=jayson[_0x347b('0xa')][_0x347b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xffc7b1,_0x357862,_0x4eff61){return new BPromise(function(_0x449990,_0xc04985){return client['request'](_0xffc7b1,_0x4eff61)[_0x347b('0xc')](function(_0x4d589d){logger['info'](_0x347b('0xd'),_0x357862,_0x347b('0xe'));logger[_0x347b('0xf')](_0x347b('0x10'),_0x357862,'request\x20sent',JSON[_0x347b('0x11')](_0x4d589d));if(_0x4d589d['error']){if(_0x4d589d[_0x347b('0x12')][_0x347b('0x13')]===0x1f4){logger['error'](_0x347b('0xd'),_0x357862,_0x4d589d['error'][_0x347b('0x14')]);return _0xc04985(_0x4d589d[_0x347b('0x12')][_0x347b('0x14')]);}logger[_0x347b('0x12')](_0x347b('0xd'),_0x357862,_0x4d589d[_0x347b('0x12')][_0x347b('0x14')]);return _0x449990(_0x4d589d[_0x347b('0x12')][_0x347b('0x14')]);}else{logger[_0x347b('0x15')]('Sound,\x20%s,\x20%s',_0x357862,_0x347b('0xe'));_0x449990(_0x4d589d[_0x347b('0x16')]['message']);}})['catch'](function(_0x3b4ef7){logger[_0x347b('0x12')](_0x347b('0xd'),_0x357862,_0x3b4ef7);_0xc04985(_0x3b4ef7);});});}exports['ShowSound']=function(_0x5eb487){var _0x1bae9a=this;return new Promise(function(_0x15c28f,_0x56b580){return db[_0x347b('0x17')][_0x347b('0x18')]({'raw':_0x5eb487[_0x347b('0x19')]?_0x5eb487[_0x347b('0x19')][_0x347b('0x1a')]===undefined?!![]:![]:!![],'where':_0x5eb487['options']?_0x5eb487['options'][_0x347b('0x1b')]||null:null,'attributes':_0x5eb487[_0x347b('0x19')]?_0x5eb487[_0x347b('0x19')][_0x347b('0x1c')]||null:null,'include':_0x5eb487['options']?_0x5eb487['options'][_0x347b('0x1d')]?_[_0x347b('0x1e')](_0x5eb487['options']['include'],function(_0x3e7ed0){return{'model':db[_0x3e7ed0[_0x347b('0x1f')]],'as':_0x3e7ed0['as'],'attributes':_0x3e7ed0[_0x347b('0x1c')],'include':_0x3e7ed0[_0x347b('0x1d')]?_[_0x347b('0x1e')](_0x3e7ed0[_0x347b('0x1d')],function(_0x3eb273){return{'model':db[_0x3eb273[_0x347b('0x1f')]],'as':_0x3eb273['as'],'attributes':_0x3eb273[_0x347b('0x1c')],'include':_0x3eb273[_0x347b('0x1d')]?_[_0x347b('0x1e')](_0x3eb273[_0x347b('0x1d')],function(_0x55de49){return{'model':db[_0x55de49[_0x347b('0x1f')]],'as':_0x55de49['as'],'attributes':_0x55de49[_0x347b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x347b('0xc')](function(_0x23007d){logger[_0x347b('0x15')](_0x347b('0x20'),_0x5eb487);logger['debug'](_0x347b('0x20'),_0x5eb487,JSON[_0x347b('0x11')](_0x23007d));_0x15c28f(_0x23007d);})['catch'](function(_0x2e00ee){logger[_0x347b('0x12')]('ShowSound',_0x2e00ee[_0x347b('0x14')],_0x5eb487);_0x56b580(_0x1bae9a[_0x347b('0x12')](0x1f4,_0x2e00ee[_0x347b('0x14')]));});});}; \ No newline at end of file +var _0xd81d=['rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','Sound','find','options','raw','attributes','map','model','include','ShowSound','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xd81d,0x1e8));var _0xdd81=function(_0x1817a2,_0x4eda4c){_0x1817a2=_0x1817a2-0x0;var _0x38b108=_0xd81d[_0x1817a2];return _0x38b108;};'use strict';var _=require('lodash');var util=require(_0xdd81('0x0'));var moment=require(_0xdd81('0x1'));var BPromise=require(_0xdd81('0x2'));var rs=require(_0xdd81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd81('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd81('0x5'));var config=require(_0xdd81('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdd81('0x7')][_0xdd81('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fa218,_0x2b3f1a,_0x42f9b1){return new BPromise(function(_0x4e413b,_0x270cae){return client[_0xdd81('0x9')](_0x2fa218,_0x42f9b1)[_0xdd81('0xa')](function(_0x5d3d09){logger[_0xdd81('0xb')](_0xdd81('0xc'),_0x2b3f1a,_0xdd81('0xd'));logger[_0xdd81('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x2b3f1a,_0xdd81('0xd'),JSON[_0xdd81('0xf')](_0x5d3d09));if(_0x5d3d09[_0xdd81('0x10')]){if(_0x5d3d09[_0xdd81('0x10')][_0xdd81('0x11')]===0x1f4){logger[_0xdd81('0x10')](_0xdd81('0xc'),_0x2b3f1a,_0x5d3d09['error'][_0xdd81('0x12')]);return _0x270cae(_0x5d3d09[_0xdd81('0x10')]['message']);}logger[_0xdd81('0x10')](_0xdd81('0xc'),_0x2b3f1a,_0x5d3d09[_0xdd81('0x10')]['message']);return _0x4e413b(_0x5d3d09[_0xdd81('0x10')][_0xdd81('0x12')]);}else{logger[_0xdd81('0xb')](_0xdd81('0xc'),_0x2b3f1a,_0xdd81('0xd'));_0x4e413b(_0x5d3d09['result'][_0xdd81('0x12')]);}})[_0xdd81('0x13')](function(_0x4d7754){logger[_0xdd81('0x10')](_0xdd81('0xc'),_0x2b3f1a,_0x4d7754);_0x270cae(_0x4d7754);});});}exports['ShowSound']=function(_0x45b4af){var _0xb67a49=this;return new Promise(function(_0x4e1fde,_0x35d613){return db[_0xdd81('0x14')][_0xdd81('0x15')]({'raw':_0x45b4af[_0xdd81('0x16')]?_0x45b4af['options'][_0xdd81('0x17')]===undefined?!![]:![]:!![],'where':_0x45b4af['options']?_0x45b4af[_0xdd81('0x16')]['where']||null:null,'attributes':_0x45b4af[_0xdd81('0x16')]?_0x45b4af[_0xdd81('0x16')][_0xdd81('0x18')]||null:null,'include':_0x45b4af[_0xdd81('0x16')]?_0x45b4af['options']['include']?_[_0xdd81('0x19')](_0x45b4af[_0xdd81('0x16')]['include'],function(_0x3b1d23){return{'model':db[_0x3b1d23[_0xdd81('0x1a')]],'as':_0x3b1d23['as'],'attributes':_0x3b1d23[_0xdd81('0x18')],'include':_0x3b1d23[_0xdd81('0x1b')]?_[_0xdd81('0x19')](_0x3b1d23[_0xdd81('0x1b')],function(_0x4186e6){return{'model':db[_0x4186e6[_0xdd81('0x1a')]],'as':_0x4186e6['as'],'attributes':_0x4186e6[_0xdd81('0x18')],'include':_0x4186e6['include']?_['map'](_0x4186e6[_0xdd81('0x1b')],function(_0x28d591){return{'model':db[_0x28d591['model']],'as':_0x28d591['as'],'attributes':_0x28d591[_0xdd81('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdd81('0xa')](function(_0x5a179e){logger[_0xdd81('0xb')](_0xdd81('0x1c'),_0x45b4af);logger[_0xdd81('0xe')]('ShowSound',_0x45b4af,JSON[_0xdd81('0xf')](_0x5a179e));_0x4e1fde(_0x5a179e);})[_0xdd81('0x13')](function(_0x2ff5c9){logger[_0xdd81('0x10')]('ShowSound',_0x2ff5c9[_0xdd81('0x12')],_0x45b4af);_0x35d613(_0xb67a49['error'](0x1f4,_0x2ff5c9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index f101673..3f467f4 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 _0x81ce=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','index','show','post','/:id'];(function(_0x3a0c4a,_0x33ef5c){var _0x2dde28=function(_0x391962){while(--_0x391962){_0x3a0c4a['push'](_0x3a0c4a['shift']());}};_0x2dde28(++_0x33ef5c);}(_0x81ce,0x93));var _0xe81c=function(_0x2ca0ef,_0x2343f2){_0x2ca0ef=_0x2ca0ef-0x0;var _0x3d3ca1=_0x81ce[_0x2ca0ef];return _0x3d3ca1;};'use strict';var multer=require(_0xe81c('0x0'));var util=require(_0xe81c('0x1'));var path=require(_0xe81c('0x2'));var timeout=require(_0xe81c('0x3'));var express=require(_0xe81c('0x4'));var router=express[_0xe81c('0x5')]();var auth=require(_0xe81c('0x6'));var interaction=require(_0xe81c('0x7'));var config=require('../../config/environment');var controller=require(_0xe81c('0x8'));router[_0xe81c('0x9')]('/',auth[_0xe81c('0xa')](),controller[_0xe81c('0xb')]);router[_0xe81c('0x9')]('/:id',auth[_0xe81c('0xa')](),controller[_0xe81c('0xc')]);router[_0xe81c('0xd')]('/',auth[_0xe81c('0xa')](),controller['create']);router['put'](_0xe81c('0xe'),auth[_0xe81c('0xa')](),controller[_0xe81c('0xf')]);router[_0xe81c('0x10')](_0xe81c('0xe'),auth[_0xe81c('0xa')](),controller['destroy']);module[_0xe81c('0x11')]=router; \ No newline at end of file +var _0x1c98=['delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','show','create','put'];(function(_0x39b55a,_0x59d19d){var _0x4047f7=function(_0x4384cc){while(--_0x4384cc){_0x39b55a['push'](_0x39b55a['shift']());}};_0x4047f7(++_0x59d19d);}(_0x1c98,0x81));var _0x81c9=function(_0x4a951f,_0x161a86){_0x4a951f=_0x4a951f-0x0;var _0x5150aa=_0x1c98[_0x4a951f];return _0x5150aa;};'use strict';var multer=require(_0x81c9('0x0'));var util=require(_0x81c9('0x1'));var path=require(_0x81c9('0x2'));var timeout=require(_0x81c9('0x3'));var express=require(_0x81c9('0x4'));var router=express[_0x81c9('0x5')]();var auth=require(_0x81c9('0x6'));var interaction=require(_0x81c9('0x7'));var config=require(_0x81c9('0x8'));var controller=require(_0x81c9('0x9'));router[_0x81c9('0xa')]('/',auth[_0x81c9('0xb')](),controller['index']);router['get']('/:id',auth[_0x81c9('0xb')](),controller[_0x81c9('0xc')]);router['post']('/',auth[_0x81c9('0xb')](),controller[_0x81c9('0xd')]);router[_0x81c9('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x81c9('0xf')](_0x81c9('0x10'),auth[_0x81c9('0xb')](),controller['destroy']);module[_0x81c9('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 680c00e..817a38a 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 _0x3899=['medium','ENUM','out'];(function(_0x3ed33d,_0x1ce8db){var _0xda88db=function(_0x329112){while(--_0x329112){_0x3ed33d['push'](_0x3ed33d['shift']());}};_0xda88db(++_0x1ce8db);}(_0x3899,0x162));var _0x9389=function(_0x4140cb,_0x447e67){_0x4140cb=_0x4140cb-0x0;var _0x2dbd21=_0x3899[_0x4140cb];return _0x2dbd21;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x9389('0x0')),'allowNull':![]},'direction':{'type':Sequelize[_0x9389('0x1')]('in',_0x9389('0x2')),'defaultValue':_0x9389('0x2'),'allowNull':![]}}; \ No newline at end of file +var _0x8b41=['exports','STRING','medium','ENUM','out','sequelize'];(function(_0x2610d7,_0x1e598e){var _0x602c08=function(_0x223409){while(--_0x223409){_0x2610d7['push'](_0x2610d7['shift']());}};_0x602c08(++_0x1e598e);}(_0x8b41,0x10d));var _0x18b4=function(_0x42c619,_0x581077){_0x42c619=_0x42c619-0x0;var _0x16bb7a=_0x8b41[_0x42c619];return _0x16bb7a;};'use strict';var Sequelize=require(_0x18b4('0x0'));module[_0x18b4('0x1')]={'uniqueid':{'type':Sequelize[_0x18b4('0x2')]},'body':{'type':Sequelize['TEXT'](_0x18b4('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x18b4('0x4')]('in',_0x18b4('0x5')),'defaultValue':_0x18b4('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index fe0fd17..7da12a3 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 _0x982e=['create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','send','index','SquareMessage','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','map','type','key','VIRTUAL','field','filter','merge','options','include','show','params','rawAttributes','length','includeAll','find','catch'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x982e,0x1b8));var _0xe982=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x982e[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0xe982('0x0'));var emlformat=require(_0xe982('0x1'));var rimraf=require(_0xe982('0x2'));var zipdir=require(_0xe982('0x3'));var jsonpatch=require(_0xe982('0x4'));var rp=require(_0xe982('0x5'));var moment=require(_0xe982('0x6'));var BPromise=require(_0xe982('0x7'));var Mustache=require('mustache');var util=require(_0xe982('0x8'));var path=require(_0xe982('0x9'));var sox=require(_0xe982('0xa'));var csv=require(_0xe982('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe982('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe982('0xd'));var deskjs=require(_0xe982('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe982('0xf'));var Papa=require('papaparse');var Redis=require(_0xe982('0x10'));var authService=require(_0xe982('0x11'));var qs=require(_0xe982('0x12'));var hardwareService=require(_0xe982('0x13'));var logger=require(_0xe982('0x14'))(_0xe982('0x15'));var utils=require(_0xe982('0x16'));var config=require(_0xe982('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e5b5d,_0x374288){_0x374288=_0x374288||0xcc;return function(_0x53aeec){if(_0x53aeec){return _0x4e5b5d['sendStatus'](_0x374288);}return _0x4e5b5d[_0xe982('0x18')](_0x374288)['end']();};}function respondWithResult(_0xae288a,_0x2f60ce){_0x2f60ce=_0x2f60ce||0xc8;return function(_0x48a26e){if(_0x48a26e){return _0xae288a[_0xe982('0x18')](_0x2f60ce)[_0xe982('0x19')](_0x48a26e);}};}function respondWithFilteredResult(_0x3a30ce,_0x16ad7a){return function(_0x489d07){if(_0x489d07){var _0x17eb75=_0x489d07[_0xe982('0x1a')],_0x551ce4=_0x16ad7a['offset'],_0x4357cc=_0x16ad7a[_0xe982('0x1b')]+_0x16ad7a[_0xe982('0x1c')],_0x5ef7fe;if(_0x4357cc>=_0x17eb75){_0x4357cc=_0x17eb75;_0x5ef7fe=0xc8;}else{_0x5ef7fe=0xce;}_0x3a30ce[_0xe982('0x18')](_0x5ef7fe);return _0x3a30ce[_0xe982('0x1d')](_0xe982('0x1e'),_0x551ce4+'-'+_0x4357cc+'/'+_0x17eb75)['json'](_0x489d07);}return null;};}function patchUpdates(_0x4e7cfb){return function(_0xf7d6b0){try{jsonpatch[_0xe982('0x1f')](_0xf7d6b0,_0x4e7cfb,!![]);}catch(_0x185cea){return BPromise[_0xe982('0x20')](_0x185cea);}return _0xf7d6b0[_0xe982('0x21')]();};}function saveUpdates(_0x4cb6f6,_0x3417d6){return function(_0x54dc15){if(_0x54dc15){return _0x54dc15[_0xe982('0x22')](_0x4cb6f6)[_0xe982('0x23')](function(_0x1a7136){return _0x1a7136;});}return null;};}function removeEntity(_0x20182d,_0x44a940){return function(_0x22eeae){if(_0x22eeae){return _0x22eeae[_0xe982('0x24')]()[_0xe982('0x23')](function(){_0x20182d[_0xe982('0x18')](0xcc)[_0xe982('0x25')]();});}};}function handleEntityNotFound(_0x306b7d,_0x5072a2){return function(_0x5e2251){if(!_0x5e2251){_0x306b7d[_0xe982('0x26')](0x194);}return _0x5e2251;};}function handleError(_0x2e1237,_0xda14d3){_0xda14d3=_0xda14d3||0x1f4;return function(_0x5d3818){logger[_0xe982('0x27')](_0x5d3818['stack']);if(_0x5d3818['name']){delete _0x5d3818['name'];}_0x2e1237[_0xe982('0x18')](_0xda14d3)[_0xe982('0x28')](_0x5d3818);};}exports[_0xe982('0x29')]=function(_0x1c8af5,_0x558bef){var _0x4b68be={},_0x4fc05a={},_0x1e9c66={'count':0x0,'rows':[]};var _0x33be87=db[_0xe982('0x2a')]['rawAttributes'];_0x4fc05a[_0xe982('0x2b')]=_['keys'](_0x33be87);_0x4fc05a[_0xe982('0x2c')]=_[_0xe982('0x2d')](_0x1c8af5[_0xe982('0x2c')]);_0x4fc05a['filters']=_['intersection'](_0x4fc05a['model'],_0x4fc05a[_0xe982('0x2c')]);_0x4b68be[_0xe982('0x2e')]=_[_0xe982('0x2f')](_0x4fc05a[_0xe982('0x2b')],qs['fields'](_0x1c8af5['query'][_0xe982('0x30')]));_0x4b68be[_0xe982('0x2e')]=_0x4b68be['attributes']['length']?_0x4b68be[_0xe982('0x2e')]:_0x4fc05a[_0xe982('0x2b')];if(!_0x1c8af5[_0xe982('0x2c')][_0xe982('0x31')](_0xe982('0x32'))){_0x4b68be[_0xe982('0x1c')]=qs[_0xe982('0x1c')](_0x1c8af5['query'][_0xe982('0x1c')]);_0x4b68be[_0xe982('0x1b')]=qs['offset'](_0x1c8af5['query'][_0xe982('0x1b')]);}_0x4b68be['order']=qs[_0xe982('0x33')](_0x1c8af5[_0xe982('0x2c')][_0xe982('0x33')]);_0x4b68be[_0xe982('0x34')]=qs[_0xe982('0x35')](_[_0xe982('0x36')](_0x1c8af5[_0xe982('0x2c')],_0x4fc05a[_0xe982('0x35')]));if(_0x1c8af5['query']['filter']){_0x4b68be[_0xe982('0x34')]=_['merge'](_0x4b68be[_0xe982('0x34')],{'$or':_[_0xe982('0x37')](_0x33be87,function(_0x1edafe){if(_0x1edafe[_0xe982('0x38')][_0xe982('0x39')]!==_0xe982('0x3a')){var _0x374f8e={};_0x374f8e[_0x1edafe[_0xe982('0x3b')]]={'$like':'%'+_0x1c8af5[_0xe982('0x2c')][_0xe982('0x3c')]+'%'};return _0x374f8e;}})});}_0x4b68be=_[_0xe982('0x3d')]({},_0x4b68be,_0x1c8af5[_0xe982('0x3e')]);var _0x1eeaae={'where':_0x4b68be['where']};return db[_0xe982('0x2a')][_0xe982('0x1a')](_0x1eeaae)[_0xe982('0x23')](function(_0x5506e2){_0x1e9c66[_0xe982('0x1a')]=_0x5506e2;if(_0x1c8af5[_0xe982('0x2c')]['includeAll']){_0x4b68be[_0xe982('0x3f')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x4b68be);})[_0xe982('0x23')](function(_0xc7eefa){_0x1e9c66['rows']=_0xc7eefa;return _0x1e9c66;})['then'](respondWithFilteredResult(_0x558bef,_0x4b68be))['catch'](handleError(_0x558bef,null));};exports[_0xe982('0x40')]=function(_0x4558f6,_0x2df04f){var _0x50edf4={'raw':!![],'where':{'id':_0x4558f6[_0xe982('0x41')]['id']}},_0x1caea2={};_0x1caea2[_0xe982('0x2b')]=_[_0xe982('0x2d')](db[_0xe982('0x2a')][_0xe982('0x42')]);_0x1caea2['query']=_['keys'](_0x4558f6[_0xe982('0x2c')]);_0x1caea2[_0xe982('0x35')]=_['intersection'](_0x1caea2[_0xe982('0x2b')],_0x1caea2[_0xe982('0x2c')]);_0x50edf4[_0xe982('0x2e')]=_[_0xe982('0x2f')](_0x1caea2['model'],qs[_0xe982('0x30')](_0x4558f6[_0xe982('0x2c')][_0xe982('0x30')]));_0x50edf4[_0xe982('0x2e')]=_0x50edf4['attributes'][_0xe982('0x43')]?_0x50edf4['attributes']:_0x1caea2[_0xe982('0x2b')];if(_0x4558f6[_0xe982('0x2c')][_0xe982('0x44')]){_0x50edf4[_0xe982('0x3f')]=[{'all':!![]}];}_0x50edf4=_[_0xe982('0x3d')]({},_0x50edf4,_0x4558f6[_0xe982('0x3e')]);return db[_0xe982('0x2a')][_0xe982('0x45')](_0x50edf4)[_0xe982('0x23')](handleEntityNotFound(_0x2df04f,null))[_0xe982('0x23')](respondWithResult(_0x2df04f,null))[_0xe982('0x46')](handleError(_0x2df04f,null));};exports[_0xe982('0x47')]=function(_0x3c5dff,_0x360286){return db[_0xe982('0x2a')]['create'](_0x3c5dff['body'],{})['then'](respondWithResult(_0x360286,0xc9))[_0xe982('0x46')](handleError(_0x360286,null));};exports[_0xe982('0x22')]=function(_0x399b32,_0x59231a){if(_0x399b32[_0xe982('0x48')]['id']){delete _0x399b32[_0xe982('0x48')]['id'];}return db[_0xe982('0x2a')][_0xe982('0x45')]({'where':{'id':_0x399b32[_0xe982('0x41')]['id']}})['then'](handleEntityNotFound(_0x59231a,null))['then'](saveUpdates(_0x399b32[_0xe982('0x48')],null))['then'](respondWithResult(_0x59231a,null))[_0xe982('0x46')](handleError(_0x59231a,null));};exports['destroy']=function(_0x207265,_0x4a26c6){return db[_0xe982('0x2a')][_0xe982('0x45')]({'where':{'id':_0x207265[_0xe982('0x41')]['id']}})['then'](handleEntityNotFound(_0x4a26c6,null))['then'](removeEntity(_0x4a26c6,null))[_0xe982('0x46')](handleError(_0x4a26c6,null));}; \ No newline at end of file +var _0xd029=['end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','filter','merge','map','type','key','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x243276,_0x2f1759){var _0x74767a=function(_0x1e1bcc){while(--_0x1e1bcc){_0x243276['push'](_0x243276['shift']());}};_0x74767a(++_0x2f1759);}(_0xd029,0xbb));var _0x9d02=function(_0x44ddc4,_0x101ca3){_0x44ddc4=_0x44ddc4-0x0;var _0x1e0f91=_0xd029[_0x44ddc4];return _0x1e0f91;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9d02('0x0'));var rimraf=require(_0x9d02('0x1'));var zipdir=require(_0x9d02('0x2'));var jsonpatch=require(_0x9d02('0x3'));var rp=require(_0x9d02('0x4'));var moment=require(_0x9d02('0x5'));var BPromise=require(_0x9d02('0x6'));var Mustache=require(_0x9d02('0x7'));var util=require(_0x9d02('0x8'));var path=require(_0x9d02('0x9'));var sox=require('sox');var csv=require(_0x9d02('0xa'));var ejs=require(_0x9d02('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9d02('0xc'));var crypto=require('crypto');var jsforce=require(_0x9d02('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9d02('0xa'));var querystring=require(_0x9d02('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9d02('0xf'));var hardwareService=require(_0x9d02('0x10'));var logger=require('../../config/logger')(_0x9d02('0x11'));var utils=require(_0x9d02('0x12'));var config=require(_0x9d02('0x13'));var db=require(_0x9d02('0x14'))['db'];function respondWithStatusCode(_0x17b40b,_0x415a14){_0x415a14=_0x415a14||0xcc;return function(_0x527a15){if(_0x527a15){return _0x17b40b[_0x9d02('0x15')](_0x415a14);}return _0x17b40b[_0x9d02('0x16')](_0x415a14)[_0x9d02('0x17')]();};}function respondWithResult(_0x310fe5,_0x5e488a){_0x5e488a=_0x5e488a||0xc8;return function(_0x14c812){if(_0x14c812){return _0x310fe5[_0x9d02('0x16')](_0x5e488a)[_0x9d02('0x18')](_0x14c812);}};}function respondWithFilteredResult(_0x544df3,_0x5ce2a4){return function(_0x266201){if(_0x266201){var _0x853d8f=_0x266201[_0x9d02('0x19')],_0x4f6a1e=_0x5ce2a4[_0x9d02('0x1a')],_0x48d0d3=_0x5ce2a4[_0x9d02('0x1a')]+_0x5ce2a4['limit'],_0x352cda;if(_0x48d0d3>=_0x853d8f){_0x48d0d3=_0x853d8f;_0x352cda=0xc8;}else{_0x352cda=0xce;}_0x544df3[_0x9d02('0x16')](_0x352cda);return _0x544df3[_0x9d02('0x1b')](_0x9d02('0x1c'),_0x4f6a1e+'-'+_0x48d0d3+'/'+_0x853d8f)[_0x9d02('0x18')](_0x266201);}return null;};}function patchUpdates(_0x1d49ba){return function(_0x444612){try{jsonpatch[_0x9d02('0x1d')](_0x444612,_0x1d49ba,!![]);}catch(_0x5b0cb5){return BPromise[_0x9d02('0x1e')](_0x5b0cb5);}return _0x444612[_0x9d02('0x1f')]();};}function saveUpdates(_0x30682a,_0x1aeb66){return function(_0x2c29ae){if(_0x2c29ae){return _0x2c29ae[_0x9d02('0x20')](_0x30682a)[_0x9d02('0x21')](function(_0x2d3bcf){return _0x2d3bcf;});}return null;};}function removeEntity(_0x420486,_0x1a4bac){return function(_0x185cc6){if(_0x185cc6){return _0x185cc6[_0x9d02('0x22')]()['then'](function(){_0x420486[_0x9d02('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2a19,_0x143848){return function(_0x27dad3){if(!_0x27dad3){_0x5e2a19['sendStatus'](0x194);}return _0x27dad3;};}function handleError(_0x29c7b7,_0x2aa513){_0x2aa513=_0x2aa513||0x1f4;return function(_0x14baae){logger[_0x9d02('0x23')](_0x14baae[_0x9d02('0x24')]);if(_0x14baae[_0x9d02('0x25')]){delete _0x14baae[_0x9d02('0x25')];}_0x29c7b7['status'](_0x2aa513)[_0x9d02('0x26')](_0x14baae);};}exports[_0x9d02('0x27')]=function(_0xfccd1,_0x59c455){var _0x3ef81b={},_0x48b373={},_0x28c680={'count':0x0,'rows':[]};var _0x323181=db[_0x9d02('0x28')][_0x9d02('0x29')];_0x48b373[_0x9d02('0x2a')]=_[_0x9d02('0x2b')](_0x323181);_0x48b373[_0x9d02('0x2c')]=_[_0x9d02('0x2b')](_0xfccd1[_0x9d02('0x2c')]);_0x48b373[_0x9d02('0x2d')]=_['intersection'](_0x48b373['model'],_0x48b373[_0x9d02('0x2c')]);_0x3ef81b[_0x9d02('0x2e')]=_[_0x9d02('0x2f')](_0x48b373[_0x9d02('0x2a')],qs['fields'](_0xfccd1[_0x9d02('0x2c')][_0x9d02('0x30')]));_0x3ef81b[_0x9d02('0x2e')]=_0x3ef81b[_0x9d02('0x2e')][_0x9d02('0x31')]?_0x3ef81b[_0x9d02('0x2e')]:_0x48b373['model'];if(!_0xfccd1[_0x9d02('0x2c')][_0x9d02('0x32')]('nolimit')){_0x3ef81b['limit']=qs[_0x9d02('0x33')](_0xfccd1[_0x9d02('0x2c')][_0x9d02('0x33')]);_0x3ef81b[_0x9d02('0x1a')]=qs[_0x9d02('0x1a')](_0xfccd1[_0x9d02('0x2c')][_0x9d02('0x1a')]);}_0x3ef81b['order']=qs[_0x9d02('0x34')](_0xfccd1['query'][_0x9d02('0x34')]);_0x3ef81b[_0x9d02('0x35')]=qs[_0x9d02('0x2d')](_['pick'](_0xfccd1[_0x9d02('0x2c')],_0x48b373['filters']));if(_0xfccd1[_0x9d02('0x2c')][_0x9d02('0x36')]){_0x3ef81b[_0x9d02('0x35')]=_[_0x9d02('0x37')](_0x3ef81b[_0x9d02('0x35')],{'$or':_[_0x9d02('0x38')](_0x323181,function(_0x509e6d){if(_0x509e6d[_0x9d02('0x39')][_0x9d02('0x3a')]!==_0x9d02('0x3b')){var _0x416351={};_0x416351[_0x509e6d['field']]={'$like':'%'+_0xfccd1[_0x9d02('0x2c')][_0x9d02('0x36')]+'%'};return _0x416351;}})});}_0x3ef81b=_[_0x9d02('0x37')]({},_0x3ef81b,_0xfccd1[_0x9d02('0x3c')]);var _0xf2d21f={'where':_0x3ef81b['where']};return db['SquareMessage'][_0x9d02('0x19')](_0xf2d21f)['then'](function(_0x58d69b){_0x28c680[_0x9d02('0x19')]=_0x58d69b;if(_0xfccd1[_0x9d02('0x2c')][_0x9d02('0x3d')]){_0x3ef81b['include']=[{'all':!![]}];}return db[_0x9d02('0x28')]['findAll'](_0x3ef81b);})['then'](function(_0x21bc6f){_0x28c680[_0x9d02('0x3e')]=_0x21bc6f;return _0x28c680;})[_0x9d02('0x21')](respondWithFilteredResult(_0x59c455,_0x3ef81b))[_0x9d02('0x3f')](handleError(_0x59c455,null));};exports[_0x9d02('0x40')]=function(_0x2f1dbf,_0x36d10d){var _0x5c3a48={'raw':!![],'where':{'id':_0x2f1dbf[_0x9d02('0x41')]['id']}},_0x5662c2={};_0x5662c2['model']=_[_0x9d02('0x2b')](db[_0x9d02('0x28')][_0x9d02('0x29')]);_0x5662c2[_0x9d02('0x2c')]=_[_0x9d02('0x2b')](_0x2f1dbf[_0x9d02('0x2c')]);_0x5662c2[_0x9d02('0x2d')]=_[_0x9d02('0x2f')](_0x5662c2[_0x9d02('0x2a')],_0x5662c2[_0x9d02('0x2c')]);_0x5c3a48['attributes']=_[_0x9d02('0x2f')](_0x5662c2[_0x9d02('0x2a')],qs['fields'](_0x2f1dbf[_0x9d02('0x2c')][_0x9d02('0x30')]));_0x5c3a48[_0x9d02('0x2e')]=_0x5c3a48['attributes']['length']?_0x5c3a48[_0x9d02('0x2e')]:_0x5662c2[_0x9d02('0x2a')];if(_0x2f1dbf[_0x9d02('0x2c')][_0x9d02('0x3d')]){_0x5c3a48[_0x9d02('0x42')]=[{'all':!![]}];}_0x5c3a48=_[_0x9d02('0x37')]({},_0x5c3a48,_0x2f1dbf[_0x9d02('0x3c')]);return db[_0x9d02('0x28')]['find'](_0x5c3a48)[_0x9d02('0x21')](handleEntityNotFound(_0x36d10d,null))[_0x9d02('0x21')](respondWithResult(_0x36d10d,null))[_0x9d02('0x3f')](handleError(_0x36d10d,null));};exports[_0x9d02('0x43')]=function(_0x481bd8,_0x58e146){return db[_0x9d02('0x28')][_0x9d02('0x43')](_0x481bd8[_0x9d02('0x44')],{})[_0x9d02('0x21')](respondWithResult(_0x58e146,0xc9))[_0x9d02('0x3f')](handleError(_0x58e146,null));};exports[_0x9d02('0x20')]=function(_0x337e09,_0x1f5d6a){if(_0x337e09[_0x9d02('0x44')]['id']){delete _0x337e09['body']['id'];}return db[_0x9d02('0x28')][_0x9d02('0x45')]({'where':{'id':_0x337e09['params']['id']}})[_0x9d02('0x21')](handleEntityNotFound(_0x1f5d6a,null))[_0x9d02('0x21')](saveUpdates(_0x337e09[_0x9d02('0x44')],null))['then'](respondWithResult(_0x1f5d6a,null))[_0x9d02('0x3f')](handleError(_0x1f5d6a,null));};exports['destroy']=function(_0x2ccc95,_0x383cf4){return db[_0x9d02('0x28')][_0x9d02('0x45')]({'where':{'id':_0x2ccc95[_0x9d02('0x41')]['id']}})[_0x9d02('0x21')](handleEntityNotFound(_0x383cf4,null))['then'](removeEntity(_0x383cf4,null))['catch'](handleError(_0x383cf4,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 906deb9..5a86a92 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 _0x2632=['moment','bluebird','request-promise','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x5be7a2,_0x18db77){var _0x268e29=function(_0xfc9eed){while(--_0xfc9eed){_0x5be7a2['push'](_0x5be7a2['shift']());}};_0x268e29(++_0x18db77);}(_0x2632,0x1dd));var _0x2263=function(_0x710f1,_0x3f2e82){_0x710f1=_0x710f1-0x0;var _0x481388=_0x2632[_0x710f1];return _0x481388;};'use strict';var _=require(_0x2263('0x0'));var util=require(_0x2263('0x1'));var logger=require(_0x2263('0x2'))('api');var moment=require(_0x2263('0x3'));var BPromise=require(_0x2263('0x4'));var rp=require(_0x2263('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2263('0x6'));module['exports']=function(_0x5db6e9,_0x11dcf9){return _0x5db6e9[_0x2263('0x7')](_0x2263('0x8'),attributes,{'tableName':_0x2263('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa24d=['define','SquareMessage','square_messages','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports'];(function(_0x28d2bf,_0x48b6f5){var _0x545236=function(_0x37b963){while(--_0x37b963){_0x28d2bf['push'](_0x28d2bf['shift']());}};_0x545236(++_0x48b6f5);}(_0xa24d,0x16b));var _0xda24=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa24d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xda24('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xda24('0x1'));var moment=require(_0xda24('0x2'));var BPromise=require(_0xda24('0x3'));var rp=require(_0xda24('0x4'));var fs=require('fs');var path=require(_0xda24('0x5'));var rimraf=require('rimraf');var config=require(_0xda24('0x6'));var attributes=require(_0xda24('0x7'));module[_0xda24('0x8')]=function(_0x23a38d,_0x382017){return _0x23a38d[_0xda24('0x9')](_0xda24('0xa'),attributes,{'tableName':_0xda24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index c9a5604..ff1dba0 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 _0x8506=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage','options','raw','info','stringify','util','bluebird'];(function(_0x2abb04,_0x32a9b7){var _0x7d635c=function(_0xc60bb3){while(--_0xc60bb3){_0x2abb04['push'](_0x2abb04['shift']());}};_0x7d635c(++_0x32a9b7);}(_0x8506,0xe8));var _0x6850=function(_0x18ed96,_0x3c72cd){_0x18ed96=_0x18ed96-0x0;var _0x2d3014=_0x8506[_0x18ed96];return _0x2d3014;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var moment=require('moment');var BPromise=require(_0x6850('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6850('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6850('0x3'));var logger=require(_0x6850('0x4'))(_0x6850('0x5'));var config=require('../../config/environment');var jayson=require(_0x6850('0x6'));var client=jayson[_0x6850('0x7')][_0x6850('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c301f,_0x5858ca,_0x51c0ad){return new BPromise(function(_0x5466ee,_0x117706){return client[_0x6850('0x9')](_0x3c301f,_0x51c0ad)[_0x6850('0xa')](function(_0x589417){logger['info'](_0x6850('0xb'),_0x5858ca,_0x6850('0xc'));logger[_0x6850('0xd')](_0x6850('0xe'),_0x5858ca,_0x6850('0xc'),JSON['stringify'](_0x589417));if(_0x589417[_0x6850('0xf')]){if(_0x589417[_0x6850('0xf')][_0x6850('0x10')]===0x1f4){logger[_0x6850('0xf')](_0x6850('0xb'),_0x5858ca,_0x589417[_0x6850('0xf')]['message']);return _0x117706(_0x589417[_0x6850('0xf')][_0x6850('0x11')]);}logger[_0x6850('0xf')](_0x6850('0xb'),_0x5858ca,_0x589417[_0x6850('0xf')][_0x6850('0x11')]);return _0x5466ee(_0x589417['error'][_0x6850('0x11')]);}else{logger['info'](_0x6850('0xb'),_0x5858ca,_0x6850('0xc'));_0x5466ee(_0x589417[_0x6850('0x12')][_0x6850('0x11')]);}})[_0x6850('0x13')](function(_0x32b9d3){logger[_0x6850('0xf')](_0x6850('0xb'),_0x5858ca,_0x32b9d3);_0x117706(_0x32b9d3);});});}exports[_0x6850('0x14')]=function(_0x441f79){var _0xeff8de=this;return new Promise(function(_0x145dbb,_0x44a5e4){return db[_0x6850('0x15')]['create'](_0x441f79['body'],{'raw':_0x441f79[_0x6850('0x16')]?_0x441f79[_0x6850('0x16')][_0x6850('0x17')]===undefined?!![]:![]:!![]})[_0x6850('0xa')](function(_0x12a15d){logger[_0x6850('0x18')]('CreateSquareMessage',_0x441f79);logger[_0x6850('0xd')](_0x6850('0x14'),_0x441f79,JSON[_0x6850('0x19')](_0x12a15d));_0x145dbb(_0x12a15d);})[_0x6850('0x13')](function(_0x2978a1){logger[_0x6850('0xf')](_0x6850('0x14'),_0x2978a1[_0x6850('0x11')],_0x441f79);_0x44a5e4(_0xeff8de[_0x6850('0xf')](0x1f4,_0x2978a1[_0x6850('0x11')]));});});}; \ No newline at end of file +var _0xbff5=['randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','create','options','raw','then','CreateSquareMessage','debug','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbff5,0x1bc));var _0x5bff=function(_0x157dd5,_0x184ebe){_0x157dd5=_0x157dd5-0x0;var _0x279a08=_0xbff5[_0x157dd5];return _0x279a08;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('SquareMessage,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['CreateSquareMessage']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['SquareMessage'][_0x5bff('0x15')](_0xc9fbc3['body'],{'raw':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3['options'][_0x5bff('0x17')]===undefined?!![]:![]:!![]})[_0x5bff('0x18')](function(_0x2a83ce){logger[_0x5bff('0x13')](_0x5bff('0x19'),_0xc9fbc3);logger[_0x5bff('0x1a')](_0x5bff('0x19'),_0xc9fbc3,JSON[_0x5bff('0xf')](_0x2a83ce));_0x36653b(_0x2a83ce);})[_0x5bff('0x1b')](function(_0x490bc1){logger[_0x5bff('0x10')](_0x5bff('0x19'),_0x490bc1[_0x5bff('0x12')],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x490bc1[_0x5bff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 602426d..93b5d15 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 _0xd260=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','15s','test','post','put','update','delete'];(function(_0x537cde,_0x455a62){var _0x24ac61=function(_0x19e8fd){while(--_0x19e8fd){_0x537cde['push'](_0x537cde['shift']());}};_0x24ac61(++_0x455a62);}(_0xd260,0x12c));var _0x0d26=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xd260[_0xa3c06b];return _0x33aa1d;};'use strict';var multer=require(_0x0d26('0x0'));var util=require(_0x0d26('0x1'));var path=require(_0x0d26('0x2'));var timeout=require(_0x0d26('0x3'));var express=require(_0x0d26('0x4'));var router=express[_0x0d26('0x5')]();var auth=require(_0x0d26('0x6'));var interaction=require(_0x0d26('0x7'));var config=require(_0x0d26('0x8'));var controller=require(_0x0d26('0x9'));router[_0x0d26('0xa')]('/',auth['isAuthenticated'](),controller[_0x0d26('0xb')]);router[_0x0d26('0xa')](_0x0d26('0xc'),auth[_0x0d26('0xd')](),controller[_0x0d26('0xe')]);router[_0x0d26('0xa')](_0x0d26('0xf'),auth[_0x0d26('0xd')](),timeout(_0x0d26('0x10')),controller[_0x0d26('0x11')]);router[_0x0d26('0x12')]('/',auth[_0x0d26('0xd')](),controller['create']);router[_0x0d26('0x13')](_0x0d26('0xc'),auth[_0x0d26('0xd')](),controller[_0x0d26('0x14')]);router[_0x0d26('0x15')](_0x0d26('0xc'),auth[_0x0d26('0xd')](),controller['destroy']);module[_0x0d26('0x16')]=router; \ No newline at end of file +var _0x6625=['get','isAuthenticated','show','/:id/test','test','post','create','put','/:id','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','./squareOdbc.controller'];(function(_0x4071b7,_0x4ff719){var _0x3d198b=function(_0x523374){while(--_0x523374){_0x4071b7['push'](_0x4071b7['shift']());}};_0x3d198b(++_0x4ff719);}(_0x6625,0x191));var _0x5662=function(_0x5c36fd,_0x19a113){_0x5c36fd=_0x5c36fd-0x0;var _0xdc6089=_0x6625[_0x5c36fd];return _0xdc6089;};'use strict';var multer=require('multer');var util=require(_0x5662('0x0'));var path=require(_0x5662('0x1'));var timeout=require(_0x5662('0x2'));var express=require(_0x5662('0x3'));var router=express[_0x5662('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5662('0x5'));var config=require('../../config/environment');var controller=require(_0x5662('0x6'));router[_0x5662('0x7')]('/',auth[_0x5662('0x8')](),controller['index']);router[_0x5662('0x7')]('/:id',auth[_0x5662('0x8')](),controller[_0x5662('0x9')]);router['get'](_0x5662('0xa'),auth[_0x5662('0x8')](),timeout('15s'),controller[_0x5662('0xb')]);router[_0x5662('0xc')]('/',auth['isAuthenticated'](),controller[_0x5662('0xd')]);router[_0x5662('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5662('0xf'),auth[_0x5662('0x8')](),controller[_0x5662('0x10')]);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 e5c53bf..f8babfb 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 _0x277e=['name','sequelize','exports','STRING'];(function(_0x383bb7,_0x4aeb32){var _0x2ef155=function(_0x34e0da){while(--_0x34e0da){_0x383bb7['push'](_0x383bb7['shift']());}};_0x2ef155(++_0x4aeb32);}(_0x277e,0x171));var _0xe277=function(_0x18979b,_0x1bc860){_0x18979b=_0x18979b-0x0;var _0x4364d1=_0x277e[_0x18979b];return _0x4364d1;};'use strict';var Sequelize=require(_0xe277('0x0'));module[_0xe277('0x1')]={'name':{'type':Sequelize[_0xe277('0x2')],'unique':_0xe277('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe277('0x2')]}}; \ No newline at end of file +var _0x1fc8=['name','STRING','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1fc8,0x136));var _0x81fc=function(_0x3bcf85,_0x2f9690){_0x3bcf85=_0x3bcf85-0x0;var _0x5afaca=_0x1fc8[_0x3bcf85];return _0x5afaca;};'use strict';var Sequelize=require(_0x81fc('0x0'));module[_0x81fc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x81fc('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x81fc('0x3')]},'description':{'type':Sequelize[_0x81fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b6d1c83..3b0da08 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 _0x9c23=['filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','show','params','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','save','update','destroy','then','ODBC','UserProfileResource','sendStatus','name','index','SquareOdbc','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x2fea4a,_0x30a962){var _0x15a69f=function(_0x5dcdb7){while(--_0x5dcdb7){_0x2fea4a['push'](_0x2fea4a['shift']());}};_0x15a69f(++_0x30a962);}(_0x9c23,0xc3));var _0x39c2=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0x9c23[_0x4d2f00];return _0x2d7b7f;};'use strict';var pdf=require(_0x39c2('0x0'));var emlformat=require(_0x39c2('0x1'));var rimraf=require(_0x39c2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39c2('0x3'));var moment=require(_0x39c2('0x4'));var BPromise=require(_0x39c2('0x5'));var Mustache=require('mustache');var util=require(_0x39c2('0x6'));var path=require(_0x39c2('0x7'));var sox=require(_0x39c2('0x8'));var csv=require('to-csv');var ejs=require(_0x39c2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x39c2('0xa'));var jsforce=require(_0x39c2('0xb'));var deskjs=require(_0x39c2('0xc'));var toCsv=require(_0x39c2('0xd'));var querystring=require(_0x39c2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x39c2('0xf'));var hardwareService=require(_0x39c2('0x10'));var logger=require(_0x39c2('0x11'))('api');var utils=require(_0x39c2('0x12'));var config=require(_0x39c2('0x13'));var db=require(_0x39c2('0x14'))['db'];function respondWithStatusCode(_0x2881e3,_0x4ae41d){_0x4ae41d=_0x4ae41d||0xcc;return function(_0x384cff){if(_0x384cff){return _0x2881e3['sendStatus'](_0x4ae41d);}return _0x2881e3[_0x39c2('0x15')](_0x4ae41d)[_0x39c2('0x16')]();};}function respondWithResult(_0x5472d7,_0x3a2937){_0x3a2937=_0x3a2937||0xc8;return function(_0x1dcd52){if(_0x1dcd52){return _0x5472d7['status'](_0x3a2937)[_0x39c2('0x17')](_0x1dcd52);}};}function respondWithFilteredResult(_0x2f9c77,_0x471940){return function(_0x33c39e){if(_0x33c39e){var _0x4a7a04=_0x33c39e['count'],_0x37bc86=_0x471940[_0x39c2('0x18')],_0x330694=_0x471940['offset']+_0x471940[_0x39c2('0x19')],_0x25f971;if(_0x330694>=_0x4a7a04){_0x330694=_0x4a7a04;_0x25f971=0xc8;}else{_0x25f971=0xce;}_0x2f9c77[_0x39c2('0x15')](_0x25f971);return _0x2f9c77[_0x39c2('0x1a')]('Content-Range',_0x37bc86+'-'+_0x330694+'/'+_0x4a7a04)[_0x39c2('0x17')](_0x33c39e);}return null;};}function patchUpdates(_0x2ed42e){return function(_0x5182ce){try{jsonpatch[_0x39c2('0x1b')](_0x5182ce,_0x2ed42e,!![]);}catch(_0x25a3cc){return BPromise['reject'](_0x25a3cc);}return _0x5182ce[_0x39c2('0x1c')]();};}function saveUpdates(_0x2c2509,_0x17dc99){return function(_0x3e351c){if(_0x3e351c){return _0x3e351c[_0x39c2('0x1d')](_0x2c2509)['then'](function(_0x59edd1){return _0x59edd1;});}return null;};}function removeEntity(_0x74af5d,_0x35df51){return function(_0x36ac59){if(_0x36ac59){return _0x36ac59[_0x39c2('0x1e')]()[_0x39c2('0x1f')](function(){var _0x4243cf=_0x36ac59['get']({'plain':!![]});var _0x48edc6=_0x39c2('0x20');return db[_0x39c2('0x21')]['destroy']({'where':{'type':_0x48edc6,'resourceId':_0x4243cf['id']}})[_0x39c2('0x1f')](function(){return _0x36ac59;});})['then'](function(){_0x74af5d[_0x39c2('0x15')](0xcc)[_0x39c2('0x16')]();});}};}function handleEntityNotFound(_0x55ab0c,_0x2c2098){return function(_0x276dce){if(!_0x276dce){_0x55ab0c[_0x39c2('0x22')](0x194);}return _0x276dce;};}function handleError(_0x872031,_0x4aba8b){_0x4aba8b=_0x4aba8b||0x1f4;return function(_0x20a7cc){logger['error'](_0x20a7cc['stack']);if(_0x20a7cc['name']){delete _0x20a7cc[_0x39c2('0x23')];}_0x872031[_0x39c2('0x15')](_0x4aba8b)['send'](_0x20a7cc);};}exports[_0x39c2('0x24')]=function(_0x38b9e7,_0x31d09b){var _0x24229a={},_0x5ab3f3={},_0x1f971a={'count':0x0,'rows':[]};var _0xfccd65=db[_0x39c2('0x25')][_0x39c2('0x26')];_0x5ab3f3[_0x39c2('0x27')]=_[_0x39c2('0x28')](_0xfccd65);_0x5ab3f3[_0x39c2('0x29')]=_[_0x39c2('0x28')](_0x38b9e7[_0x39c2('0x29')]);_0x5ab3f3[_0x39c2('0x2a')]=_['intersection'](_0x5ab3f3[_0x39c2('0x27')],_0x5ab3f3['query']);_0x24229a[_0x39c2('0x2b')]=_[_0x39c2('0x2c')](_0x5ab3f3[_0x39c2('0x27')],qs['fields'](_0x38b9e7[_0x39c2('0x29')][_0x39c2('0x2d')]));_0x24229a[_0x39c2('0x2b')]=_0x24229a['attributes'][_0x39c2('0x2e')]?_0x24229a[_0x39c2('0x2b')]:_0x5ab3f3[_0x39c2('0x27')];if(!_0x38b9e7[_0x39c2('0x29')][_0x39c2('0x2f')]('nolimit')){_0x24229a[_0x39c2('0x19')]=qs['limit'](_0x38b9e7[_0x39c2('0x29')][_0x39c2('0x19')]);_0x24229a[_0x39c2('0x18')]=qs[_0x39c2('0x18')](_0x38b9e7[_0x39c2('0x29')]['offset']);}_0x24229a['order']=qs[_0x39c2('0x30')](_0x38b9e7[_0x39c2('0x29')][_0x39c2('0x30')]);_0x24229a[_0x39c2('0x31')]=qs[_0x39c2('0x2a')](_[_0x39c2('0x32')](_0x38b9e7['query'],_0x5ab3f3['filters']));if(_0x38b9e7['query'][_0x39c2('0x33')]){_0x24229a[_0x39c2('0x31')]=_[_0x39c2('0x34')](_0x24229a[_0x39c2('0x31')],{'$or':_[_0x39c2('0x35')](_0xfccd65,function(_0x5165d0){if(_0x5165d0[_0x39c2('0x36')][_0x39c2('0x37')]!==_0x39c2('0x38')){var _0x1c21f8={};_0x1c21f8[_0x5165d0[_0x39c2('0x39')]]={'$like':'%'+_0x38b9e7[_0x39c2('0x29')]['filter']+'%'};return _0x1c21f8;}})});}_0x24229a=_[_0x39c2('0x34')]({},_0x24229a,_0x38b9e7[_0x39c2('0x3a')]);var _0xc9f3ae={'where':_0x24229a['where']};return db[_0x39c2('0x25')]['count'](_0xc9f3ae)[_0x39c2('0x1f')](function(_0x46e3c2){_0x1f971a[_0x39c2('0x3b')]=_0x46e3c2;if(_0x38b9e7[_0x39c2('0x29')][_0x39c2('0x3c')]){_0x24229a[_0x39c2('0x3d')]=[{'all':!![]}];}return db[_0x39c2('0x25')][_0x39c2('0x3e')](_0x24229a);})[_0x39c2('0x1f')](function(_0x3fca91){_0x1f971a['rows']=_0x3fca91;return _0x1f971a;})[_0x39c2('0x1f')](respondWithFilteredResult(_0x31d09b,_0x24229a))['catch'](handleError(_0x31d09b,null));};exports[_0x39c2('0x3f')]=function(_0x215dfa,_0x34a827){var _0x37d645={'raw':!![],'where':{'id':_0x215dfa[_0x39c2('0x40')]['id']}},_0x551279={};_0x551279['model']=_[_0x39c2('0x28')](db[_0x39c2('0x25')]['rawAttributes']);_0x551279[_0x39c2('0x29')]=_[_0x39c2('0x28')](_0x215dfa[_0x39c2('0x29')]);_0x551279['filters']=_['intersection'](_0x551279[_0x39c2('0x27')],_0x551279[_0x39c2('0x29')]);_0x37d645[_0x39c2('0x2b')]=_[_0x39c2('0x2c')](_0x551279['model'],qs['fields'](_0x215dfa[_0x39c2('0x29')][_0x39c2('0x2d')]));_0x37d645['attributes']=_0x37d645[_0x39c2('0x2b')]['length']?_0x37d645[_0x39c2('0x2b')]:_0x551279[_0x39c2('0x27')];if(_0x215dfa['query'][_0x39c2('0x3c')]){_0x37d645[_0x39c2('0x3d')]=[{'all':!![]}];}_0x37d645=_[_0x39c2('0x34')]({},_0x37d645,_0x215dfa[_0x39c2('0x3a')]);return db[_0x39c2('0x25')]['find'](_0x37d645)[_0x39c2('0x1f')](handleEntityNotFound(_0x34a827,null))['then'](respondWithResult(_0x34a827,null))[_0x39c2('0x41')](handleError(_0x34a827,null));};exports[_0x39c2('0x42')]=function(_0x1be9a3,_0x4aba42){return db[_0x39c2('0x25')][_0x39c2('0x42')](_0x1be9a3[_0x39c2('0x43')],{})[_0x39c2('0x1f')](function(_0x2c232c){var _0x161c7=_0x1be9a3[_0x39c2('0x44')][_0x39c2('0x45')]({'plain':!![]});if(!_0x161c7)throw new Error(_0x39c2('0x46'));if(_0x161c7[_0x39c2('0x47')]===_0x39c2('0x44')){var _0xb7421a=_0x2c232c['get']({'plain':!![]});var _0x44bbe4=_0x39c2('0x20');return db[_0x39c2('0x48')]['find']({'where':{'name':_0x44bbe4,'userProfileId':_0x161c7[_0x39c2('0x49')]},'raw':!![]})[_0x39c2('0x1f')](function(_0x374a39){if(_0x374a39&&_0x374a39[_0x39c2('0x4a')]===0x0){return db[_0x39c2('0x21')][_0x39c2('0x42')]({'name':_0xb7421a[_0x39c2('0x23')],'resourceId':_0xb7421a['id'],'type':_0x374a39[_0x39c2('0x23')],'sectionId':_0x374a39['id']},{})[_0x39c2('0x1f')](function(){return _0x2c232c;});}else{return _0x2c232c;}})['catch'](function(_0x4e66ea){logger[_0x39c2('0x4b')](_0x39c2('0x4c'),_0x4e66ea);throw _0x4e66ea;});}return _0x2c232c;})[_0x39c2('0x1f')](respondWithResult(_0x4aba42,0xc9))[_0x39c2('0x41')](handleError(_0x4aba42,null));};exports[_0x39c2('0x1d')]=function(_0x1c1b39,_0x135d44){if(_0x1c1b39[_0x39c2('0x43')]['id']){delete _0x1c1b39[_0x39c2('0x43')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x1c1b39[_0x39c2('0x40')]['id']}})[_0x39c2('0x1f')](handleEntityNotFound(_0x135d44,null))[_0x39c2('0x1f')](saveUpdates(_0x1c1b39[_0x39c2('0x43')],null))[_0x39c2('0x1f')](respondWithResult(_0x135d44,null))[_0x39c2('0x41')](handleError(_0x135d44,null));};exports[_0x39c2('0x1e')]=function(_0x4bc897,_0x39a19e){return db[_0x39c2('0x25')]['find']({'where':{'id':_0x4bc897['params']['id']}})[_0x39c2('0x1f')](handleEntityNotFound(_0x39a19e,null))[_0x39c2('0x1f')](removeEntity(_0x39a19e,null))[_0x39c2('0x41')](handleError(_0x39a19e,null));};exports[_0x39c2('0x4d')]=function(_0xea474,_0x25dffb,_0x5c7691){var _0x8a3625;return db[_0x39c2('0x25')]['find']({'where':{'id':_0xea474[_0x39c2('0x40')]['id']},'attributes':['id',_0x39c2('0x4e')]})[_0x39c2('0x1f')](handleEntityNotFound(_0x25dffb,null))[_0x39c2('0x1f')](function(_0x482db2){if(_0x482db2){var _0xd0f993=require(_0x39c2('0x4f'))();_0xd0f993[_0x39c2('0x50')](_0x482db2[_0x39c2('0x4e')]);_0xd0f993[_0x39c2('0x51')]();return _0x482db2;}})['then'](respondWithResult(_0x25dffb,null))[_0x39c2('0x41')](handleError(_0x25dffb,null));}; \ No newline at end of file +var _0xcebd=['merge','options','SquareOdbc','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','dsn','odbc','openSync','closeSync','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','stack','name','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','key','field'];(function(_0x1e47af,_0x5168e2){var _0x65b7c0=function(_0x55d490){while(--_0x55d490){_0x1e47af['push'](_0x1e47af['shift']());}};_0x65b7c0(++_0x5168e2);}(_0xcebd,0xc1));var _0xdceb=function(_0x218063,_0x5153b5){_0x218063=_0x218063-0x0;var _0x2a7e50=_0xcebd[_0x218063];return _0x2a7e50;};'use strict';var pdf=require(_0xdceb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdceb('0x1'));var zipdir=require(_0xdceb('0x2'));var jsonpatch=require(_0xdceb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdceb('0x4'));var Mustache=require(_0xdceb('0x5'));var util=require(_0xdceb('0x6'));var path=require(_0xdceb('0x7'));var sox=require(_0xdceb('0x8'));var csv=require(_0xdceb('0x9'));var ejs=require(_0xdceb('0xa'));var fs=require('fs');var _=require(_0xdceb('0xb'));var squel=require(_0xdceb('0xc'));var crypto=require(_0xdceb('0xd'));var jsforce=require(_0xdceb('0xe'));var deskjs=require(_0xdceb('0xf'));var toCsv=require(_0xdceb('0x9'));var querystring=require(_0xdceb('0x10'));var Papa=require(_0xdceb('0x11'));var Redis=require('ioredis');var authService=require(_0xdceb('0x12'));var qs=require(_0xdceb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdceb('0x14'))(_0xdceb('0x15'));var utils=require('../../config/utils');var config=require(_0xdceb('0x16'));var db=require(_0xdceb('0x17'))['db'];function respondWithStatusCode(_0x39b975,_0x20f1d2){_0x20f1d2=_0x20f1d2||0xcc;return function(_0x1a15f7){if(_0x1a15f7){return _0x39b975[_0xdceb('0x18')](_0x20f1d2);}return _0x39b975['status'](_0x20f1d2)['end']();};}function respondWithResult(_0x43a538,_0x22039e){_0x22039e=_0x22039e||0xc8;return function(_0x307f77){if(_0x307f77){return _0x43a538[_0xdceb('0x19')](_0x22039e)[_0xdceb('0x1a')](_0x307f77);}};}function respondWithFilteredResult(_0x4f28b7,_0x1d4b43){return function(_0x3129a8){if(_0x3129a8){var _0x36e3c8=_0x3129a8[_0xdceb('0x1b')],_0x1ac7ff=_0x1d4b43[_0xdceb('0x1c')],_0x2790b0=_0x1d4b43[_0xdceb('0x1c')]+_0x1d4b43[_0xdceb('0x1d')],_0x306d65;if(_0x2790b0>=_0x36e3c8){_0x2790b0=_0x36e3c8;_0x306d65=0xc8;}else{_0x306d65=0xce;}_0x4f28b7[_0xdceb('0x19')](_0x306d65);return _0x4f28b7[_0xdceb('0x1e')](_0xdceb('0x1f'),_0x1ac7ff+'-'+_0x2790b0+'/'+_0x36e3c8)[_0xdceb('0x1a')](_0x3129a8);}return null;};}function patchUpdates(_0x35849e){return function(_0x3b975f){try{jsonpatch[_0xdceb('0x20')](_0x3b975f,_0x35849e,!![]);}catch(_0x14bb61){return BPromise[_0xdceb('0x21')](_0x14bb61);}return _0x3b975f[_0xdceb('0x22')]();};}function saveUpdates(_0x21094f,_0x7bc1cd){return function(_0x58f4d8){if(_0x58f4d8){return _0x58f4d8[_0xdceb('0x23')](_0x21094f)[_0xdceb('0x24')](function(_0x2b8bf9){return _0x2b8bf9;});}return null;};}function removeEntity(_0x115092,_0x8c1732){return function(_0xeda16){if(_0xeda16){return _0xeda16[_0xdceb('0x25')]()[_0xdceb('0x24')](function(){var _0x3faa05=_0xeda16['get']({'plain':!![]});var _0x9d6a41=_0xdceb('0x26');return db[_0xdceb('0x27')][_0xdceb('0x25')]({'where':{'type':_0x9d6a41,'resourceId':_0x3faa05['id']}})[_0xdceb('0x24')](function(){return _0xeda16;});})['then'](function(){_0x115092[_0xdceb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7056,_0x543eba){return function(_0x115be7){if(!_0x115be7){_0x2f7056[_0xdceb('0x18')](0x194);}return _0x115be7;};}function handleError(_0x40d3bb,_0x4a6678){_0x4a6678=_0x4a6678||0x1f4;return function(_0x5e7510){logger['error'](_0x5e7510[_0xdceb('0x28')]);if(_0x5e7510[_0xdceb('0x29')]){delete _0x5e7510[_0xdceb('0x29')];}_0x40d3bb['status'](_0x4a6678)['send'](_0x5e7510);};}exports[_0xdceb('0x2a')]=function(_0x218e64,_0x558db8){var _0x45c415={},_0x2adbb4={},_0x433e94={'count':0x0,'rows':[]};var _0xf8e53b=db['SquareOdbc'][_0xdceb('0x2b')];_0x2adbb4[_0xdceb('0x2c')]=_[_0xdceb('0x2d')](_0xf8e53b);_0x2adbb4[_0xdceb('0x2e')]=_['keys'](_0x218e64[_0xdceb('0x2e')]);_0x2adbb4[_0xdceb('0x2f')]=_[_0xdceb('0x30')](_0x2adbb4[_0xdceb('0x2c')],_0x2adbb4[_0xdceb('0x2e')]);_0x45c415[_0xdceb('0x31')]=_[_0xdceb('0x30')](_0x2adbb4[_0xdceb('0x2c')],qs[_0xdceb('0x32')](_0x218e64[_0xdceb('0x2e')][_0xdceb('0x32')]));_0x45c415[_0xdceb('0x31')]=_0x45c415[_0xdceb('0x31')][_0xdceb('0x33')]?_0x45c415[_0xdceb('0x31')]:_0x2adbb4[_0xdceb('0x2c')];if(!_0x218e64[_0xdceb('0x2e')][_0xdceb('0x34')](_0xdceb('0x35'))){_0x45c415[_0xdceb('0x1d')]=qs[_0xdceb('0x1d')](_0x218e64[_0xdceb('0x2e')][_0xdceb('0x1d')]);_0x45c415[_0xdceb('0x1c')]=qs[_0xdceb('0x1c')](_0x218e64[_0xdceb('0x2e')]['offset']);}_0x45c415[_0xdceb('0x36')]=qs[_0xdceb('0x37')](_0x218e64['query'][_0xdceb('0x37')]);_0x45c415[_0xdceb('0x38')]=qs[_0xdceb('0x2f')](_[_0xdceb('0x39')](_0x218e64[_0xdceb('0x2e')],_0x2adbb4['filters']));if(_0x218e64['query'][_0xdceb('0x3a')]){_0x45c415[_0xdceb('0x38')]=_['merge'](_0x45c415[_0xdceb('0x38')],{'$or':_['map'](_0xf8e53b,function(_0x171e14){if(_0x171e14[_0xdceb('0x3b')][_0xdceb('0x3c')]!=='VIRTUAL'){var _0x419418={};_0x419418[_0x171e14[_0xdceb('0x3d')]]={'$like':'%'+_0x218e64[_0xdceb('0x2e')][_0xdceb('0x3a')]+'%'};return _0x419418;}})});}_0x45c415=_[_0xdceb('0x3e')]({},_0x45c415,_0x218e64[_0xdceb('0x3f')]);var _0x53d6d={'where':_0x45c415[_0xdceb('0x38')]};return db[_0xdceb('0x40')][_0xdceb('0x1b')](_0x53d6d)[_0xdceb('0x24')](function(_0x2e1b0c){_0x433e94['count']=_0x2e1b0c;if(_0x218e64['query']['includeAll']){_0x45c415[_0xdceb('0x41')]=[{'all':!![]}];}return db[_0xdceb('0x40')][_0xdceb('0x42')](_0x45c415);})[_0xdceb('0x24')](function(_0x473097){_0x433e94[_0xdceb('0x43')]=_0x473097;return _0x433e94;})[_0xdceb('0x24')](respondWithFilteredResult(_0x558db8,_0x45c415))[_0xdceb('0x44')](handleError(_0x558db8,null));};exports[_0xdceb('0x45')]=function(_0x422291,_0x32149b){var _0x53511e={'raw':!![],'where':{'id':_0x422291[_0xdceb('0x46')]['id']}},_0x5a1bf1={};_0x5a1bf1[_0xdceb('0x2c')]=_[_0xdceb('0x2d')](db[_0xdceb('0x40')]['rawAttributes']);_0x5a1bf1[_0xdceb('0x2e')]=_[_0xdceb('0x2d')](_0x422291[_0xdceb('0x2e')]);_0x5a1bf1[_0xdceb('0x2f')]=_[_0xdceb('0x30')](_0x5a1bf1['model'],_0x5a1bf1[_0xdceb('0x2e')]);_0x53511e[_0xdceb('0x31')]=_['intersection'](_0x5a1bf1[_0xdceb('0x2c')],qs[_0xdceb('0x32')](_0x422291[_0xdceb('0x2e')][_0xdceb('0x32')]));_0x53511e[_0xdceb('0x31')]=_0x53511e[_0xdceb('0x31')][_0xdceb('0x33')]?_0x53511e['attributes']:_0x5a1bf1['model'];if(_0x422291[_0xdceb('0x2e')]['includeAll']){_0x53511e[_0xdceb('0x41')]=[{'all':!![]}];}_0x53511e=_['merge']({},_0x53511e,_0x422291['options']);return db[_0xdceb('0x40')][_0xdceb('0x47')](_0x53511e)[_0xdceb('0x24')](handleEntityNotFound(_0x32149b,null))['then'](respondWithResult(_0x32149b,null))[_0xdceb('0x44')](handleError(_0x32149b,null));};exports[_0xdceb('0x48')]=function(_0x234034,_0x522b6e){return db['SquareOdbc'][_0xdceb('0x48')](_0x234034['body'],{})[_0xdceb('0x24')](function(_0x28961f){var _0x2e5044=_0x234034[_0xdceb('0x49')]['get']({'plain':!![]});if(!_0x2e5044)throw new Error(_0xdceb('0x4a'));if(_0x2e5044['role']===_0xdceb('0x49')){var _0x9ca19e=_0x28961f[_0xdceb('0x4b')]({'plain':!![]});var _0x4f96c5='ODBC';return db[_0xdceb('0x4c')][_0xdceb('0x47')]({'where':{'name':_0x4f96c5,'userProfileId':_0x2e5044['userProfileId']},'raw':!![]})[_0xdceb('0x24')](function(_0x2d59c0){if(_0x2d59c0&&_0x2d59c0[_0xdceb('0x4d')]===0x0){return db[_0xdceb('0x27')][_0xdceb('0x48')]({'name':_0x9ca19e[_0xdceb('0x29')],'resourceId':_0x9ca19e['id'],'type':_0x2d59c0['name'],'sectionId':_0x2d59c0['id']},{})[_0xdceb('0x24')](function(){return _0x28961f;});}else{return _0x28961f;}})['catch'](function(_0x13a87c){logger[_0xdceb('0x4e')](_0xdceb('0x4f'),_0x13a87c);throw _0x13a87c;});}return _0x28961f;})['then'](respondWithResult(_0x522b6e,0xc9))['catch'](handleError(_0x522b6e,null));};exports[_0xdceb('0x23')]=function(_0x158239,_0xfd4749){if(_0x158239[_0xdceb('0x50')]['id']){delete _0x158239['body']['id'];}return db[_0xdceb('0x40')][_0xdceb('0x47')]({'where':{'id':_0x158239['params']['id']}})['then'](handleEntityNotFound(_0xfd4749,null))[_0xdceb('0x24')](saveUpdates(_0x158239[_0xdceb('0x50')],null))[_0xdceb('0x24')](respondWithResult(_0xfd4749,null))[_0xdceb('0x44')](handleError(_0xfd4749,null));};exports['destroy']=function(_0x2cfcc8,_0x2dc0ad){return db[_0xdceb('0x40')]['find']({'where':{'id':_0x2cfcc8['params']['id']}})[_0xdceb('0x24')](handleEntityNotFound(_0x2dc0ad,null))['then'](removeEntity(_0x2dc0ad,null))[_0xdceb('0x44')](handleError(_0x2dc0ad,null));};exports['test']=function(_0x54ef58,_0x249c2a,_0x1bc2bb){var _0x36cfe7;return db['SquareOdbc'][_0xdceb('0x47')]({'where':{'id':_0x54ef58['params']['id']},'attributes':['id',_0xdceb('0x51')]})[_0xdceb('0x24')](handleEntityNotFound(_0x249c2a,null))[_0xdceb('0x24')](function(_0x49fd78){if(_0x49fd78){var _0x2300d6=require(_0xdceb('0x52'))();_0x2300d6[_0xdceb('0x53')](_0x49fd78[_0xdceb('0x51')]);_0x2300d6[_0xdceb('0x54')]();return _0x49fd78;}})[_0xdceb('0x24')](respondWithResult(_0x249c2a,null))[_0xdceb('0x44')](handleError(_0x249c2a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b93bc52..dcd4abc 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 _0x020c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x020c,0xf8));var _0xc020=function(_0x198e15,_0x5e4190){_0x198e15=_0x198e15-0x0;var _0x2e4c02=_0x020c[_0x198e15];return _0x2e4c02;};'use strict';var _=require(_0xc020('0x0'));var util=require(_0xc020('0x1'));var logger=require(_0xc020('0x2'))(_0xc020('0x3'));var moment=require(_0xc020('0x4'));var BPromise=require(_0xc020('0x5'));var rp=require(_0xc020('0x6'));var fs=require('fs');var path=require(_0xc020('0x7'));var rimraf=require(_0xc020('0x8'));var config=require(_0xc020('0x9'));var attributes=require(_0xc020('0xa'));module['exports']=function(_0x4b0adc,_0xb0d3a2){return _0x4b0adc[_0xc020('0xb')](_0xc020('0xc'),attributes,{'tableName':_0xc020('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbae8=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x5059be,_0x5daf8e){var _0x41a554=function(_0x34cc25){while(--_0x34cc25){_0x5059be['push'](_0x5059be['shift']());}};_0x41a554(++_0x5daf8e);}(_0xbae8,0x195));var _0x8bae=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0xbae8[_0x27530d];return _0x59e561;};'use strict';var _=require(_0x8bae('0x0'));var util=require(_0x8bae('0x1'));var logger=require(_0x8bae('0x2'))(_0x8bae('0x3'));var moment=require('moment');var BPromise=require(_0x8bae('0x4'));var rp=require(_0x8bae('0x5'));var fs=require('fs');var path=require(_0x8bae('0x6'));var rimraf=require(_0x8bae('0x7'));var config=require(_0x8bae('0x8'));var attributes=require(_0x8bae('0x9'));module[_0x8bae('0xa')]=function(_0x55c816,_0x4d13fa){return _0x55c816[_0x8bae('0xb')](_0x8bae('0xc'),attributes,{'tableName':_0x8bae('0xd'),'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 f92475c..f643389 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(_0x4756d5,_0x20560a){var _0xf834a8=function(_0x1ae08c){while(--_0x1ae08c){_0x4756d5['push'](_0x4756d5['shift']());}};_0xf834a8(++_0x20560a);}(_0xe14b,0x93));var _0xbe14=function(_0x54423b,_0x43381c){_0x54423b=_0x54423b-0x0;var _0x2184d9=_0xe14b[_0x54423b];return _0x2184d9;};'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 _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0x9d2bdc,_0x4f2b6a){var _0x410615=function(_0x56b661){while(--_0x56b661){_0x9d2bdc['push'](_0x9d2bdc['shift']());}};_0x410615(++_0x4f2b6a);}(_0x3e74,0x175));var _0x43e7=function(_0x1d216c,_0x82ccc4){_0x1d216c=_0x1d216c-0x0;var _0x364134=_0x3e74[_0x1d216c];return _0x364134;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d156c6b..1f432a8 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 _0xbdb7=['destroy','removeUsers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','/:id/users','post','isAuthenticated','create','addUsers','put','delete'];(function(_0x17eee2,_0x571fd4){var _0x481c6c=function(_0x59a1bb){while(--_0x59a1bb){_0x17eee2['push'](_0x17eee2['shift']());}};_0x481c6c(++_0x571fd4);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xb43d1b,_0x3935cf){_0xb43d1b=_0xb43d1b-0x0;var _0x4aafca=_0xbdb7[_0xb43d1b];return _0x4aafca;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./squareProject.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0x9')](_0x7bdb('0xb'),auth['isAuthenticated'](),controller['getUsers']);router[_0x7bdb('0xc')]('/',auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xe')]);router[_0x7bdb('0xc')](_0x7bdb('0xb'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xf')]);router[_0x7bdb('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7bdb('0x11')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller[_0x7bdb('0x12')]);router['delete']('/:id/users',auth[_0x7bdb('0xd')](),controller[_0x7bdb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1775=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','update','delete','destroy','removeUsers','exports','util','path','connect-timeout','express','Router'];(function(_0x51007a,_0x515893){var _0x12b1bd=function(_0x345826){while(--_0x345826){_0x51007a['push'](_0x51007a['shift']());}};_0x12b1bd(++_0x515893);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xb')]);router[_0x5177('0x9')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0xd')]);router[_0x5177('0x9')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0xf')]);router[_0x5177('0x10')]('/',auth[_0x5177('0xa')](),controller['create']);router['post'](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x11')]);router[_0x5177('0x12')](_0x5177('0xc'),auth['isAuthenticated'](),controller[_0x5177('0x13')]);router[_0x5177('0x14')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0x15')]);router[_0x5177('0x14')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x16')]);module[_0x5177('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0f625f1..16a762e 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 _0xb433=['STRING','name','TEXT','long','preproduction','getDataValue','toString','utf8','BLOB','production'];(function(_0x4d3d59,_0x388747){var _0xe9d36e=function(_0x489565){while(--_0x489565){_0x4d3d59['push'](_0x4d3d59['shift']());}};_0xe9d36e(++_0x388747);}(_0xb433,0x1a4));var _0x3b43=function(_0x209bbf,_0x2e2375){_0x209bbf=_0x209bbf-0x0;var _0x592d4b=_0xb433[_0x209bbf];return _0x592d4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3b43('0x0')],'unique':_0x3b43('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x3b43('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0x3b43('0x3')),'get':function(){if(this['getDataValue'](_0x3b43('0x4'))){return this[_0x3b43('0x5')](_0x3b43('0x4'))[_0x3b43('0x6')](_0x3b43('0x7'));}}},'production':{'type':Sequelize[_0x3b43('0x8')]('long'),'get':function(){if(this[_0x3b43('0x5')](_0x3b43('0x9'))){return this[_0x3b43('0x5')]('production')['toString'](_0x3b43('0x7'));}}}}; \ No newline at end of file +var _0xdd4b=['sequelize','exports','STRING','name','BLOB','preproduction','getDataValue','toString','utf8','long','production'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd4b,0xa5));var _0xbdd4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdd4b[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xbdd4('0x0'));module[_0xbdd4('0x1')]={'name':{'type':Sequelize[_0xbdd4('0x2')],'unique':_0xbdd4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbdd4('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xbdd4('0x4')]('long'),'get':function(){if(this['getDataValue'](_0xbdd4('0x5'))){return this[_0xbdd4('0x6')](_0xbdd4('0x5'))[_0xbdd4('0x7')](_0xbdd4('0x8'));}}},'production':{'type':Sequelize[_0xbdd4('0x4')](_0xbdd4('0x9')),'get':function(){if(this[_0xbdd4('0x6')](_0xbdd4('0xa'))){return this['getDataValue'](_0xbdd4('0xa'))[_0xbdd4('0x7')](_0xbdd4('0x8'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index a5b3854..4cd0dab 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 _0x7381=['include','rows','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','sendStatus','error','stack','name','SquareProject','rawAttributes','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','field','options','includeAll'];(function(_0xc9fc9b,_0xab6c6d){var _0x35c305=function(_0x3eb472){while(--_0x3eb472){_0xc9fc9b['push'](_0xc9fc9b['shift']());}};_0x35c305(++_0xab6c6d);}(_0x7381,0x196));var _0x1738=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0x7381[_0x32c012];return _0x48562e;};'use strict';var pdf=require(_0x1738('0x0'));var emlformat=require(_0x1738('0x1'));var rimraf=require(_0x1738('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1738('0x3'));var moment=require(_0x1738('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1738('0x5'));var util=require(_0x1738('0x6'));var path=require('path');var sox=require(_0x1738('0x7'));var csv=require('to-csv');var ejs=require(_0x1738('0x8'));var fs=require('fs');var _=require(_0x1738('0x9'));var squel=require(_0x1738('0xa'));var crypto=require(_0x1738('0xb'));var jsforce=require(_0x1738('0xc'));var deskjs=require(_0x1738('0xd'));var toCsv=require(_0x1738('0xe'));var querystring=require(_0x1738('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1738('0x10'));var qs=require(_0x1738('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1738('0x12'))(_0x1738('0x13'));var utils=require(_0x1738('0x14'));var config=require(_0x1738('0x15'));var db=require(_0x1738('0x16'))['db'];config[_0x1738('0x17')]=_[_0x1738('0x18')](config[_0x1738('0x17')],{'host':_0x1738('0x19'),'port':0x18eb});var socket=require(_0x1738('0x1a'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x1d0e0a,_0x28fbeb){_0x28fbeb=_0x28fbeb||0xcc;return function(_0x57a793){if(_0x57a793){return _0x1d0e0a['sendStatus'](_0x28fbeb);}return _0x1d0e0a[_0x1738('0x1b')](_0x28fbeb)[_0x1738('0x1c')]();};}function respondWithResult(_0x2f64ec,_0x1371fb){_0x1371fb=_0x1371fb||0xc8;return function(_0x431115){if(_0x431115){return _0x2f64ec[_0x1738('0x1b')](_0x1371fb)[_0x1738('0x1d')](_0x431115);}};}function respondWithFilteredResult(_0x3fd06d,_0x183204){return function(_0x4a8dc3){if(_0x4a8dc3){var _0x4384fa=_0x4a8dc3[_0x1738('0x1e')],_0x3a239c=_0x183204[_0x1738('0x1f')],_0x2c45a9=_0x183204[_0x1738('0x1f')]+_0x183204[_0x1738('0x20')],_0x9f65cb;if(_0x2c45a9>=_0x4384fa){_0x2c45a9=_0x4384fa;_0x9f65cb=0xc8;}else{_0x9f65cb=0xce;}_0x3fd06d[_0x1738('0x1b')](_0x9f65cb);return _0x3fd06d[_0x1738('0x21')](_0x1738('0x22'),_0x3a239c+'-'+_0x2c45a9+'/'+_0x4384fa)[_0x1738('0x1d')](_0x4a8dc3);}return null;};}function patchUpdates(_0x5f27ae){return function(_0x54e79f){try{jsonpatch[_0x1738('0x23')](_0x54e79f,_0x5f27ae,!![]);}catch(_0x467722){return BPromise[_0x1738('0x24')](_0x467722);}return _0x54e79f[_0x1738('0x25')]();};}function saveUpdates(_0x5926b0,_0x7e7812){return function(_0x2ab5dd){if(_0x2ab5dd){return _0x2ab5dd[_0x1738('0x26')](_0x5926b0)['then'](function(_0x9157c6){return _0x9157c6;});}return null;};}function removeEntity(_0x57eaf9,_0xd77446){return function(_0x156674){if(_0x156674){return _0x156674[_0x1738('0x27')]()['then'](function(){var _0x206b82=_0x156674['get']({'plain':!![]});var _0x40e712='SquareProjects';return db[_0x1738('0x28')][_0x1738('0x27')]({'where':{'type':_0x40e712,'resourceId':_0x206b82['id']}})[_0x1738('0x29')](function(){return _0x156674;});})['then'](function(){_0x57eaf9[_0x1738('0x1b')](0xcc)[_0x1738('0x1c')]();});}};}function handleEntityNotFound(_0x3b660f,_0x208658){return function(_0x393175){if(!_0x393175){_0x3b660f[_0x1738('0x2a')](0x194);}return _0x393175;};}function handleError(_0x5f2525,_0x3e48d7){_0x3e48d7=_0x3e48d7||0x1f4;return function(_0x473af4){logger[_0x1738('0x2b')](_0x473af4[_0x1738('0x2c')]);if(_0x473af4['name']){delete _0x473af4[_0x1738('0x2d')];}_0x5f2525[_0x1738('0x1b')](_0x3e48d7)['send'](_0x473af4);};}exports['index']=function(_0x2ea302,_0x18f9a8){var _0x3b18a0={},_0x32565c={},_0x2b83f4={'count':0x0,'rows':[]};var _0x30200d=db[_0x1738('0x2e')][_0x1738('0x2f')];_0x32565c[_0x1738('0x30')]=_[_0x1738('0x31')](_0x30200d);_0x32565c['query']=_[_0x1738('0x31')](_0x2ea302['query']);_0x32565c[_0x1738('0x32')]=_[_0x1738('0x33')](_0x32565c[_0x1738('0x30')],_0x32565c[_0x1738('0x34')]);_0x3b18a0['attributes']=_[_0x1738('0x33')](_0x32565c[_0x1738('0x30')],qs[_0x1738('0x35')](_0x2ea302[_0x1738('0x34')][_0x1738('0x35')]));_0x3b18a0['attributes']=_0x3b18a0[_0x1738('0x36')][_0x1738('0x37')]?_0x3b18a0[_0x1738('0x36')]:_0x32565c[_0x1738('0x30')];if(!_0x2ea302[_0x1738('0x34')][_0x1738('0x38')](_0x1738('0x39'))){_0x3b18a0[_0x1738('0x20')]=qs['limit'](_0x2ea302[_0x1738('0x34')]['limit']);_0x3b18a0['offset']=qs['offset'](_0x2ea302[_0x1738('0x34')][_0x1738('0x1f')]);}_0x3b18a0[_0x1738('0x3a')]=qs['sort'](_0x2ea302['query'][_0x1738('0x3b')]);_0x3b18a0['where']=qs[_0x1738('0x32')](_[_0x1738('0x3c')](_0x2ea302[_0x1738('0x34')],_0x32565c['filters']));if(_0x2ea302['query'][_0x1738('0x3d')]){_0x3b18a0[_0x1738('0x3e')]=_[_0x1738('0x3f')](_0x3b18a0[_0x1738('0x3e')],{'$or':_[_0x1738('0x40')](_0x30200d,function(_0x1f9240){if(_0x1f9240[_0x1738('0x41')]['key']!=='VIRTUAL'){var _0x80ac21={};_0x80ac21[_0x1f9240[_0x1738('0x42')]]={'$like':'%'+_0x2ea302[_0x1738('0x34')][_0x1738('0x3d')]+'%'};return _0x80ac21;}})});}_0x3b18a0=_['merge']({},_0x3b18a0,_0x2ea302[_0x1738('0x43')]);var _0x373f3c={'where':_0x3b18a0[_0x1738('0x3e')]};return db['SquareProject'][_0x1738('0x1e')](_0x373f3c)[_0x1738('0x29')](function(_0x3013a0){_0x2b83f4[_0x1738('0x1e')]=_0x3013a0;if(_0x2ea302['query'][_0x1738('0x44')]){_0x3b18a0[_0x1738('0x45')]=[{'all':!![]}];}return db[_0x1738('0x2e')]['findAll'](_0x3b18a0);})[_0x1738('0x29')](function(_0x33194e){_0x2b83f4[_0x1738('0x46')]=_0x33194e;return _0x2b83f4;})[_0x1738('0x29')](respondWithFilteredResult(_0x18f9a8,_0x3b18a0))[_0x1738('0x47')](handleError(_0x18f9a8,null));};exports[_0x1738('0x48')]=function(_0x592399,_0x19f403){var _0x447679={'raw':![],'where':{'id':_0x592399['params']['id']}},_0xfcb684={};_0xfcb684[_0x1738('0x30')]=_['keys'](db[_0x1738('0x2e')]['rawAttributes']);_0xfcb684[_0x1738('0x34')]=_[_0x1738('0x31')](_0x592399[_0x1738('0x34')]);_0xfcb684[_0x1738('0x32')]=_[_0x1738('0x33')](_0xfcb684[_0x1738('0x30')],_0xfcb684[_0x1738('0x34')]);_0x447679[_0x1738('0x36')]=_['intersection'](_0xfcb684[_0x1738('0x30')],qs[_0x1738('0x35')](_0x592399[_0x1738('0x34')]['fields']));_0x447679[_0x1738('0x36')]=_0x447679[_0x1738('0x36')]['length']?_0x447679[_0x1738('0x36')]:_0xfcb684['model'];if(_0x592399[_0x1738('0x34')]['includeAll']){_0x447679[_0x1738('0x45')]=[{'all':!![]}];}_0x447679=_['merge']({},_0x447679,_0x592399['options']);return db[_0x1738('0x2e')][_0x1738('0x49')](_0x447679)['then'](handleEntityNotFound(_0x19f403,null))[_0x1738('0x29')](respondWithResult(_0x19f403,null))[_0x1738('0x47')](handleError(_0x19f403,null));};exports[_0x1738('0x4a')]=function(_0x297afb,_0x3f57f6){return db[_0x1738('0x2e')][_0x1738('0x4a')](_0x297afb[_0x1738('0x4b')],{})[_0x1738('0x29')](function(_0x2aa851){var _0x517389=_0x297afb['user'][_0x1738('0x4c')]({'plain':!![]});if(!_0x517389)throw new Error(_0x1738('0x4d'));if(_0x517389[_0x1738('0x4e')]===_0x1738('0x4f')){var _0x247c4b=_0x2aa851[_0x1738('0x4c')]({'plain':!![]});var _0xf677ac=_0x1738('0x50');return db[_0x1738('0x51')][_0x1738('0x49')]({'where':{'name':_0xf677ac,'userProfileId':_0x517389[_0x1738('0x52')]},'raw':!![]})['then'](function(_0x472206){if(_0x472206&&_0x472206[_0x1738('0x53')]===0x0){return db[_0x1738('0x28')]['create']({'name':_0x247c4b[_0x1738('0x2d')],'resourceId':_0x247c4b['id'],'type':_0x472206['name'],'sectionId':_0x472206['id']},{})[_0x1738('0x29')](function(){return _0x2aa851;});}else{return _0x2aa851;}})['catch'](function(_0x2db5c2){logger['error'](_0x1738('0x54'),_0x2db5c2);throw _0x2db5c2;});}return _0x2aa851;})[_0x1738('0x29')](respondWithResult(_0x3f57f6,0xc9))[_0x1738('0x47')](handleError(_0x3f57f6,null));};exports[_0x1738('0x26')]=function(_0x122c78,_0x222327){if(_0x122c78['body']['id']){delete _0x122c78[_0x1738('0x4b')]['id'];}return db[_0x1738('0x2e')][_0x1738('0x49')]({'where':{'id':_0x122c78[_0x1738('0x55')]['id']}})['then'](handleEntityNotFound(_0x222327,null))[_0x1738('0x29')](saveUpdates(_0x122c78[_0x1738('0x4b')],null))[_0x1738('0x29')](respondWithResult(_0x222327,null))['catch'](handleError(_0x222327,null));};exports[_0x1738('0x27')]=function(_0x4b2250,_0x2d94bd){return db[_0x1738('0x2e')][_0x1738('0x49')]({'where':{'id':_0x4b2250[_0x1738('0x55')]['id']}})[_0x1738('0x29')](handleEntityNotFound(_0x2d94bd,null))[_0x1738('0x29')](removeEntity(_0x2d94bd,null))['catch'](handleError(_0x2d94bd,null));};exports[_0x1738('0x56')]=function(_0x561240,_0x4917d3,_0x484304){return db[_0x1738('0x2e')][_0x1738('0x49')]({'where':{'id':_0x561240[_0x1738('0x55')]['id']}})[_0x1738('0x29')](handleEntityNotFound(_0x4917d3,null))[_0x1738('0x29')](function(_0x3c6eb8){if(_0x3c6eb8){return _0x3c6eb8[_0x1738('0x56')](_0x561240[_0x1738('0x4b')]['ids'],_[_0x1738('0x57')](_0x561240[_0x1738('0x4b')],[_0x1738('0x58'),'id'])||{});}})[_0x1738('0x29')](respondWithResult(_0x4917d3,null))[_0x1738('0x47')](handleError(_0x4917d3,null));};exports['removeUsers']=function(_0xb333b2,_0x5be273,_0x3b13f1){return db[_0x1738('0x2e')][_0x1738('0x49')]({'where':{'id':_0xb333b2[_0x1738('0x55')]['id']}})[_0x1738('0x29')](handleEntityNotFound(_0x5be273,null))[_0x1738('0x29')](function(_0x3c8dc5){if(_0x3c8dc5){return _0x3c8dc5[_0x1738('0x59')](_0xb333b2[_0x1738('0x34')][_0x1738('0x58')])['then'](function(){if(_[_0x1738('0x5a')](_0xb333b2[_0x1738('0x34')][_0x1738('0x58')])){for(var _0x1df821=0x0;_0x1df821<_0xb333b2[_0x1738('0x34')][_0x1738('0x58')][_0x1738('0x37')];_0x1df821+=0x1){socket['emit'](_0x1738('0x5b'),{'UserId':Number(_0xb333b2[_0x1738('0x34')][_0x1738('0x58')][_0x1df821]),'SquareProjectId':Number(_0xb333b2[_0x1738('0x55')]['id'])});}}else{socket[_0x1738('0x5c')](_0x1738('0x5b'),{'UserId':Number(_0xb333b2[_0x1738('0x34')][_0x1738('0x58')]),'SquareProjectId':Number(_0xb333b2['params']['id'])});}});}})[_0x1738('0x29')](respondWithStatusCode(_0x5be273,null))[_0x1738('0x47')](handleError(_0x5be273,null));};exports[_0x1738('0x5d')]=function(_0x53ba0f,_0x2679de,_0x58771a){var _0x3c3cef={};var _0x3e9d38={};var _0x4c159f;var _0x2e719c;return db[_0x1738('0x2e')][_0x1738('0x5e')]({'where':{'id':_0x53ba0f[_0x1738('0x55')]['id']}})[_0x1738('0x29')](handleEntityNotFound(_0x2679de,null))['then'](function(_0x479d40){if(_0x479d40){_0x4c159f=_0x479d40;_0x3e9d38[_0x1738('0x30')]=_['keys'](db['User']['rawAttributes']);_0x3e9d38['query']=_['keys'](_0x53ba0f[_0x1738('0x34')]);_0x3e9d38['filters']=_[_0x1738('0x33')](_0x3e9d38[_0x1738('0x30')],_0x3e9d38[_0x1738('0x34')]);_0x3c3cef['attributes']=_[_0x1738('0x33')](_0x3e9d38[_0x1738('0x30')],qs[_0x1738('0x35')](_0x53ba0f['query'][_0x1738('0x35')]));_0x3c3cef[_0x1738('0x36')]=_0x3c3cef[_0x1738('0x36')]['length']?_0x3c3cef[_0x1738('0x36')]:_0x3e9d38[_0x1738('0x30')];_0x3c3cef[_0x1738('0x3a')]=qs[_0x1738('0x3b')](_0x53ba0f[_0x1738('0x34')][_0x1738('0x3b')]);_0x3c3cef['where']=qs[_0x1738('0x32')](_[_0x1738('0x3c')](_0x53ba0f[_0x1738('0x34')],_0x3e9d38[_0x1738('0x32')]));if(_0x53ba0f[_0x1738('0x34')][_0x1738('0x3d')]){_0x3c3cef[_0x1738('0x3e')]=_[_0x1738('0x3f')](_0x3c3cef['where'],{'$or':_[_0x1738('0x40')](_0x3c3cef[_0x1738('0x36')],function(_0x14afd9){var _0x3e530d={};_0x3e530d[_0x14afd9]={'$like':'%'+_0x53ba0f[_0x1738('0x34')][_0x1738('0x3d')]+'%'};return _0x3e530d;})});}_0x3c3cef=_['merge']({},_0x3c3cef,_0x53ba0f['options']);return _0x4c159f['getUsers'](_0x3c3cef);}})['then'](function(_0x12b513){if(_0x12b513){_0x2e719c=_0x12b513[_0x1738('0x37')];if(!_0x53ba0f[_0x1738('0x34')]['hasOwnProperty']('nolimit')){_0x3c3cef[_0x1738('0x20')]=qs[_0x1738('0x20')](_0x53ba0f[_0x1738('0x34')][_0x1738('0x20')]);_0x3c3cef[_0x1738('0x1f')]=qs[_0x1738('0x1f')](_0x53ba0f[_0x1738('0x34')]['offset']);}return _0x4c159f[_0x1738('0x5d')](_0x3c3cef);}})[_0x1738('0x29')](function(_0x4dfb37){if(_0x4dfb37){return _0x4dfb37?{'count':_0x2e719c,'rows':_0x4dfb37}:null;}})[_0x1738('0x29')](respondWithResult(_0x2679de,null))[_0x1738('0x47')](handleError(_0x2679de,null));}; \ No newline at end of file +var _0x1fa4=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','UserProfileResource','destroy','error','stack','name','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','key','merge','options','count','includeAll','include','SquareProject','findAll','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','omit','removeUsers','ids','isArray','emit','userSquareProject:remove','getUsers','findOne','User','html-pdf','eml-format'];(function(_0x3c19a8,_0x269a7){var _0x4bd599=function(_0x555c9b){while(--_0x555c9b){_0x3c19a8['push'](_0x3c19a8['shift']());}};_0x4bd599(++_0x269a7);}(_0x1fa4,0x16e));var _0x41fa=function(_0x49eb8d,_0x306fd3){_0x49eb8d=_0x49eb8d-0x0;var _0x5c26b9=_0x1fa4[_0x49eb8d];return _0x5c26b9;};'use strict';var pdf=require(_0x41fa('0x0'));var emlformat=require(_0x41fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x41fa('0x2'));var jsonpatch=require(_0x41fa('0x3'));var rp=require('request-promise');var moment=require(_0x41fa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x41fa('0x5'));var util=require(_0x41fa('0x6'));var path=require(_0x41fa('0x7'));var sox=require(_0x41fa('0x8'));var csv=require(_0x41fa('0x9'));var ejs=require(_0x41fa('0xa'));var fs=require('fs');var _=require(_0x41fa('0xb'));var squel=require(_0x41fa('0xc'));var crypto=require(_0x41fa('0xd'));var jsforce=require(_0x41fa('0xe'));var deskjs=require(_0x41fa('0xf'));var toCsv=require(_0x41fa('0x9'));var querystring=require('querystring');var Papa=require(_0x41fa('0x10'));var Redis=require(_0x41fa('0x11'));var authService=require(_0x41fa('0x12'));var qs=require(_0x41fa('0x13'));var hardwareService=require(_0x41fa('0x14'));var logger=require(_0x41fa('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x41fa('0x16'))['db'];config['redis']=_[_0x41fa('0x17')](config[_0x41fa('0x18')],{'host':_0x41fa('0x19'),'port':0x18eb});var socket=require(_0x41fa('0x1a'))(new Redis(config[_0x41fa('0x18')]));require(_0x41fa('0x1b'))[_0x41fa('0x1c')](socket);function respondWithStatusCode(_0x26d51b,_0x467c37){_0x467c37=_0x467c37||0xcc;return function(_0x17456d){if(_0x17456d){return _0x26d51b[_0x41fa('0x1d')](_0x467c37);}return _0x26d51b[_0x41fa('0x1e')](_0x467c37)[_0x41fa('0x1f')]();};}function respondWithResult(_0x38939c,_0xa779f5){_0xa779f5=_0xa779f5||0xc8;return function(_0x416f6a){if(_0x416f6a){return _0x38939c[_0x41fa('0x1e')](_0xa779f5)[_0x41fa('0x20')](_0x416f6a);}};}function respondWithFilteredResult(_0x58966e,_0x47fb83){return function(_0x347924){if(_0x347924){var _0xd049e8=_0x347924['count'],_0x2c6b4a=_0x47fb83[_0x41fa('0x21')],_0x49ad55=_0x47fb83[_0x41fa('0x21')]+_0x47fb83[_0x41fa('0x22')],_0x35a537;if(_0x49ad55>=_0xd049e8){_0x49ad55=_0xd049e8;_0x35a537=0xc8;}else{_0x35a537=0xce;}_0x58966e[_0x41fa('0x1e')](_0x35a537);return _0x58966e[_0x41fa('0x23')](_0x41fa('0x24'),_0x2c6b4a+'-'+_0x49ad55+'/'+_0xd049e8)[_0x41fa('0x20')](_0x347924);}return null;};}function patchUpdates(_0xbd4e56){return function(_0x282b6a){try{jsonpatch[_0x41fa('0x25')](_0x282b6a,_0xbd4e56,!![]);}catch(_0x507855){return BPromise['reject'](_0x507855);}return _0x282b6a[_0x41fa('0x26')]();};}function saveUpdates(_0x4504c6,_0x11ab7a){return function(_0x38056e){if(_0x38056e){return _0x38056e['update'](_0x4504c6)[_0x41fa('0x27')](function(_0x57db07){return _0x57db07;});}return null;};}function removeEntity(_0x55b5ff,_0x1c2b66){return function(_0x40525f){if(_0x40525f){return _0x40525f['destroy']()['then'](function(){var _0xe7a2d7=_0x40525f['get']({'plain':!![]});var _0x5ba442='SquareProjects';return db[_0x41fa('0x28')][_0x41fa('0x29')]({'where':{'type':_0x5ba442,'resourceId':_0xe7a2d7['id']}})[_0x41fa('0x27')](function(){return _0x40525f;});})[_0x41fa('0x27')](function(){_0x55b5ff[_0x41fa('0x1e')](0xcc)[_0x41fa('0x1f')]();});}};}function handleEntityNotFound(_0x13b97b,_0x2a15bb){return function(_0x56364d){if(!_0x56364d){_0x13b97b[_0x41fa('0x1d')](0x194);}return _0x56364d;};}function handleError(_0x1f9cde,_0x48c1df){_0x48c1df=_0x48c1df||0x1f4;return function(_0x111868){logger[_0x41fa('0x2a')](_0x111868[_0x41fa('0x2b')]);if(_0x111868['name']){delete _0x111868[_0x41fa('0x2c')];}_0x1f9cde[_0x41fa('0x1e')](_0x48c1df)['send'](_0x111868);};}exports['index']=function(_0x191caa,_0x2b5da8){var _0x5cf9d1={},_0x103d02={},_0x3e1463={'count':0x0,'rows':[]};var _0x7af99=db['SquareProject']['rawAttributes'];_0x103d02[_0x41fa('0x2d')]=_[_0x41fa('0x2e')](_0x7af99);_0x103d02['query']=_['keys'](_0x191caa[_0x41fa('0x2f')]);_0x103d02[_0x41fa('0x30')]=_[_0x41fa('0x31')](_0x103d02[_0x41fa('0x2d')],_0x103d02[_0x41fa('0x2f')]);_0x5cf9d1[_0x41fa('0x32')]=_[_0x41fa('0x31')](_0x103d02[_0x41fa('0x2d')],qs[_0x41fa('0x33')](_0x191caa[_0x41fa('0x2f')][_0x41fa('0x33')]));_0x5cf9d1['attributes']=_0x5cf9d1[_0x41fa('0x32')][_0x41fa('0x34')]?_0x5cf9d1[_0x41fa('0x32')]:_0x103d02[_0x41fa('0x2d')];if(!_0x191caa[_0x41fa('0x2f')][_0x41fa('0x35')]('nolimit')){_0x5cf9d1[_0x41fa('0x22')]=qs[_0x41fa('0x22')](_0x191caa[_0x41fa('0x2f')]['limit']);_0x5cf9d1[_0x41fa('0x21')]=qs[_0x41fa('0x21')](_0x191caa[_0x41fa('0x2f')][_0x41fa('0x21')]);}_0x5cf9d1[_0x41fa('0x36')]=qs[_0x41fa('0x37')](_0x191caa[_0x41fa('0x2f')][_0x41fa('0x37')]);_0x5cf9d1[_0x41fa('0x38')]=qs[_0x41fa('0x30')](_['pick'](_0x191caa['query'],_0x103d02['filters']));if(_0x191caa[_0x41fa('0x2f')][_0x41fa('0x39')]){_0x5cf9d1[_0x41fa('0x38')]=_['merge'](_0x5cf9d1[_0x41fa('0x38')],{'$or':_['map'](_0x7af99,function(_0x13dc71){if(_0x13dc71[_0x41fa('0x3a')][_0x41fa('0x3b')]!=='VIRTUAL'){var _0x2f4cde={};_0x2f4cde[_0x13dc71['field']]={'$like':'%'+_0x191caa[_0x41fa('0x2f')][_0x41fa('0x39')]+'%'};return _0x2f4cde;}})});}_0x5cf9d1=_[_0x41fa('0x3c')]({},_0x5cf9d1,_0x191caa[_0x41fa('0x3d')]);var _0x139b99={'where':_0x5cf9d1[_0x41fa('0x38')]};return db['SquareProject'][_0x41fa('0x3e')](_0x139b99)[_0x41fa('0x27')](function(_0x137bfa){_0x3e1463['count']=_0x137bfa;if(_0x191caa[_0x41fa('0x2f')][_0x41fa('0x3f')]){_0x5cf9d1[_0x41fa('0x40')]=[{'all':!![]}];}return db[_0x41fa('0x41')][_0x41fa('0x42')](_0x5cf9d1);})[_0x41fa('0x27')](function(_0x4f8ae6){_0x3e1463['rows']=_0x4f8ae6;return _0x3e1463;})[_0x41fa('0x27')](respondWithFilteredResult(_0x2b5da8,_0x5cf9d1))[_0x41fa('0x43')](handleError(_0x2b5da8,null));};exports['show']=function(_0x58277a,_0x3d510a){var _0x257036={'raw':![],'where':{'id':_0x58277a[_0x41fa('0x44')]['id']}},_0x23df2a={};_0x23df2a[_0x41fa('0x2d')]=_[_0x41fa('0x2e')](db[_0x41fa('0x41')][_0x41fa('0x45')]);_0x23df2a[_0x41fa('0x2f')]=_[_0x41fa('0x2e')](_0x58277a['query']);_0x23df2a['filters']=_[_0x41fa('0x31')](_0x23df2a['model'],_0x23df2a[_0x41fa('0x2f')]);_0x257036['attributes']=_[_0x41fa('0x31')](_0x23df2a[_0x41fa('0x2d')],qs[_0x41fa('0x33')](_0x58277a[_0x41fa('0x2f')][_0x41fa('0x33')]));_0x257036[_0x41fa('0x32')]=_0x257036['attributes'][_0x41fa('0x34')]?_0x257036[_0x41fa('0x32')]:_0x23df2a[_0x41fa('0x2d')];if(_0x58277a[_0x41fa('0x2f')]['includeAll']){_0x257036[_0x41fa('0x40')]=[{'all':!![]}];}_0x257036=_['merge']({},_0x257036,_0x58277a[_0x41fa('0x3d')]);return db['SquareProject'][_0x41fa('0x46')](_0x257036)[_0x41fa('0x27')](handleEntityNotFound(_0x3d510a,null))[_0x41fa('0x27')](respondWithResult(_0x3d510a,null))[_0x41fa('0x43')](handleError(_0x3d510a,null));};exports[_0x41fa('0x47')]=function(_0x36ed68,_0x178eb7){return db[_0x41fa('0x41')][_0x41fa('0x47')](_0x36ed68[_0x41fa('0x48')],{})[_0x41fa('0x27')](function(_0x549be2){var _0x5f2b2b=_0x36ed68[_0x41fa('0x49')][_0x41fa('0x4a')]({'plain':!![]});if(!_0x5f2b2b)throw new Error(_0x41fa('0x4b'));if(_0x5f2b2b[_0x41fa('0x4c')]===_0x41fa('0x49')){var _0x45bfc2=_0x549be2[_0x41fa('0x4a')]({'plain':!![]});var _0xbc3d93=_0x41fa('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0xbc3d93,'userProfileId':_0x5f2b2b[_0x41fa('0x4e')]},'raw':!![]})[_0x41fa('0x27')](function(_0x4d4625){if(_0x4d4625&&_0x4d4625[_0x41fa('0x4f')]===0x0){return db[_0x41fa('0x28')][_0x41fa('0x47')]({'name':_0x45bfc2[_0x41fa('0x2c')],'resourceId':_0x45bfc2['id'],'type':_0x4d4625[_0x41fa('0x2c')],'sectionId':_0x4d4625['id']},{})[_0x41fa('0x27')](function(){return _0x549be2;});}else{return _0x549be2;}})[_0x41fa('0x43')](function(_0x283d77){logger[_0x41fa('0x2a')](_0x41fa('0x50'),_0x283d77);throw _0x283d77;});}return _0x549be2;})[_0x41fa('0x27')](respondWithResult(_0x178eb7,0xc9))['catch'](handleError(_0x178eb7,null));};exports[_0x41fa('0x51')]=function(_0x49101d,_0x429c2c){if(_0x49101d['body']['id']){delete _0x49101d['body']['id'];}return db[_0x41fa('0x41')][_0x41fa('0x46')]({'where':{'id':_0x49101d[_0x41fa('0x44')]['id']}})[_0x41fa('0x27')](handleEntityNotFound(_0x429c2c,null))[_0x41fa('0x27')](saveUpdates(_0x49101d[_0x41fa('0x48')],null))['then'](respondWithResult(_0x429c2c,null))[_0x41fa('0x43')](handleError(_0x429c2c,null));};exports['destroy']=function(_0x5c9e4f,_0xd54984){return db['SquareProject'][_0x41fa('0x46')]({'where':{'id':_0x5c9e4f[_0x41fa('0x44')]['id']}})[_0x41fa('0x27')](handleEntityNotFound(_0xd54984,null))[_0x41fa('0x27')](removeEntity(_0xd54984,null))[_0x41fa('0x43')](handleError(_0xd54984,null));};exports[_0x41fa('0x52')]=function(_0x3a0362,_0xd34dc7,_0x39d919){return db[_0x41fa('0x41')][_0x41fa('0x46')]({'where':{'id':_0x3a0362[_0x41fa('0x44')]['id']}})[_0x41fa('0x27')](handleEntityNotFound(_0xd34dc7,null))['then'](function(_0x39e5fa){if(_0x39e5fa){return _0x39e5fa[_0x41fa('0x52')](_0x3a0362[_0x41fa('0x48')]['ids'],_[_0x41fa('0x53')](_0x3a0362['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xd34dc7,null))[_0x41fa('0x43')](handleError(_0xd34dc7,null));};exports[_0x41fa('0x54')]=function(_0x4afccb,_0x3588a2,_0x5e86d9){return db[_0x41fa('0x41')][_0x41fa('0x46')]({'where':{'id':_0x4afccb[_0x41fa('0x44')]['id']}})['then'](handleEntityNotFound(_0x3588a2,null))[_0x41fa('0x27')](function(_0x4b4464){if(_0x4b4464){return _0x4b4464[_0x41fa('0x54')](_0x4afccb[_0x41fa('0x2f')][_0x41fa('0x55')])[_0x41fa('0x27')](function(){if(_[_0x41fa('0x56')](_0x4afccb[_0x41fa('0x2f')]['ids'])){for(var _0x2a747=0x0;_0x2a747<_0x4afccb[_0x41fa('0x2f')][_0x41fa('0x55')]['length'];_0x2a747+=0x1){socket[_0x41fa('0x57')](_0x41fa('0x58'),{'UserId':Number(_0x4afccb[_0x41fa('0x2f')]['ids'][_0x2a747]),'SquareProjectId':Number(_0x4afccb['params']['id'])});}}else{socket['emit'](_0x41fa('0x58'),{'UserId':Number(_0x4afccb['query'][_0x41fa('0x55')]),'SquareProjectId':Number(_0x4afccb['params']['id'])});}});}})[_0x41fa('0x27')](respondWithStatusCode(_0x3588a2,null))[_0x41fa('0x43')](handleError(_0x3588a2,null));};exports[_0x41fa('0x59')]=function(_0x2f2c83,_0xe97aa1,_0x468e50){var _0x47ee6e={};var _0x3e8cc9={};var _0x101c74;var _0x5aee0b;return db[_0x41fa('0x41')][_0x41fa('0x5a')]({'where':{'id':_0x2f2c83[_0x41fa('0x44')]['id']}})[_0x41fa('0x27')](handleEntityNotFound(_0xe97aa1,null))[_0x41fa('0x27')](function(_0x59858e){if(_0x59858e){_0x101c74=_0x59858e;_0x3e8cc9[_0x41fa('0x2d')]=_[_0x41fa('0x2e')](db[_0x41fa('0x5b')][_0x41fa('0x45')]);_0x3e8cc9[_0x41fa('0x2f')]=_['keys'](_0x2f2c83[_0x41fa('0x2f')]);_0x3e8cc9[_0x41fa('0x30')]=_['intersection'](_0x3e8cc9[_0x41fa('0x2d')],_0x3e8cc9['query']);_0x47ee6e[_0x41fa('0x32')]=_['intersection'](_0x3e8cc9[_0x41fa('0x2d')],qs['fields'](_0x2f2c83['query'][_0x41fa('0x33')]));_0x47ee6e[_0x41fa('0x32')]=_0x47ee6e[_0x41fa('0x32')][_0x41fa('0x34')]?_0x47ee6e[_0x41fa('0x32')]:_0x3e8cc9['model'];_0x47ee6e[_0x41fa('0x36')]=qs['sort'](_0x2f2c83[_0x41fa('0x2f')][_0x41fa('0x37')]);_0x47ee6e['where']=qs[_0x41fa('0x30')](_['pick'](_0x2f2c83[_0x41fa('0x2f')],_0x3e8cc9[_0x41fa('0x30')]));if(_0x2f2c83['query'][_0x41fa('0x39')]){_0x47ee6e[_0x41fa('0x38')]=_[_0x41fa('0x3c')](_0x47ee6e[_0x41fa('0x38')],{'$or':_['map'](_0x47ee6e[_0x41fa('0x32')],function(_0x3abd22){var _0x35fc94={};_0x35fc94[_0x3abd22]={'$like':'%'+_0x2f2c83[_0x41fa('0x2f')][_0x41fa('0x39')]+'%'};return _0x35fc94;})});}_0x47ee6e=_[_0x41fa('0x3c')]({},_0x47ee6e,_0x2f2c83['options']);return _0x101c74[_0x41fa('0x59')](_0x47ee6e);}})[_0x41fa('0x27')](function(_0x309194){if(_0x309194){_0x5aee0b=_0x309194[_0x41fa('0x34')];if(!_0x2f2c83[_0x41fa('0x2f')][_0x41fa('0x35')]('nolimit')){_0x47ee6e[_0x41fa('0x22')]=qs[_0x41fa('0x22')](_0x2f2c83[_0x41fa('0x2f')][_0x41fa('0x22')]);_0x47ee6e[_0x41fa('0x21')]=qs[_0x41fa('0x21')](_0x2f2c83['query']['offset']);}return _0x101c74[_0x41fa('0x59')](_0x47ee6e);}})[_0x41fa('0x27')](function(_0xa56d12){if(_0xa56d12){return _0xa56d12?{'count':_0x5aee0b,'rows':_0xa56d12}:null;}})[_0x41fa('0x27')](respondWithResult(_0xe97aa1,null))['catch'](handleError(_0xe97aa1,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a2a60fd..5e1d9d1 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 _0xbaa8=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x485847,_0x3bf826){var _0x3a53bf=function(_0x20b5c1){while(--_0x20b5c1){_0x485847['push'](_0x485847['shift']());}};_0x3a53bf(++_0x3bf826);}(_0xbaa8,0x1a5));var _0x8baa=function(_0x53d9b0,_0x474980){_0x53d9b0=_0x53d9b0-0x0;var _0x35dd86=_0xbaa8[_0x53d9b0];return _0x35dd86;};'use strict';var EventEmitter=require(_0x8baa('0x0'));var SquareProject=require(_0x8baa('0x1'))['db'][_0x8baa('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8baa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8baa('0x4')};function emitEvent(_0x12ed3f){return function(_0x3fa162,_0x4510a3,_0x50dae1){SquareProjectEvents[_0x8baa('0x5')](_0x12ed3f+':'+_0x3fa162['id'],_0x3fa162);SquareProjectEvents[_0x8baa('0x5')](_0x12ed3f,_0x3fa162);_0x50dae1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8baa('0x6')](e,emitEvent(event));}}module[_0x8baa('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xc73e=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','events'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0xc73e,0x1e9));var _0xec73=function(_0x3255b3,_0x13eb37){_0x3255b3=_0x3255b3-0x0;var _0x258cfa=_0xc73e[_0x3255b3];return _0x258cfa;};'use strict';var EventEmitter=require(_0xec73('0x0'));var SquareProject=require(_0xec73('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xec73('0x2')](0x0);var events={'afterCreate':_0xec73('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x494c49){return function(_0x36ed48,_0x3b35a2,_0x4fbf12){SquareProjectEvents[_0xec73('0x4')](_0x494c49+':'+_0x36ed48['id'],_0x36ed48);SquareProjectEvents[_0xec73('0x4')](_0x494c49,_0x36ed48);_0x4fbf12(null);};}for(var e in events){if(events[_0xec73('0x5')](e)){var event=events[e];SquareProject[_0xec73('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 1589058..48eb48c 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 _0x9968=['define','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x4ab6dd,_0x3ec6ea){var _0x112226=function(_0x35e182){while(--_0x35e182){_0x4ab6dd['push'](_0x4ab6dd['shift']());}};_0x112226(++_0x3ec6ea);}(_0x9968,0x19b));var _0x8996=function(_0x3980d4,_0x42259e){_0x3980d4=_0x3980d4-0x0;var _0x3760d8=_0x9968[_0x3980d4];return _0x3760d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8996('0x0'))(_0x8996('0x1'));var moment=require(_0x8996('0x2'));var BPromise=require(_0x8996('0x3'));var rp=require(_0x8996('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8996('0x5'));var config=require(_0x8996('0x6'));var attributes=require(_0x8996('0x7'));module[_0x8996('0x8')]=function(_0x28b93f,_0xd50d0c){return _0x28b93f[_0x8996('0x9')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x544a=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareProject','square_projects','lodash','util'];(function(_0x5b3add,_0x1aaa1f){var _0x4229b6=function(_0x4328f9){while(--_0x4328f9){_0x5b3add['push'](_0x5b3add['shift']());}};_0x4229b6(++_0x1aaa1f);}(_0x544a,0x112));var _0xa544=function(_0x2afb08,_0x324211){_0x2afb08=_0x2afb08-0x0;var _0x38cc5a=_0x544a[_0x2afb08];return _0x38cc5a;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var logger=require('../../config/logger')(_0xa544('0x2'));var moment=require(_0xa544('0x3'));var BPromise=require(_0xa544('0x4'));var rp=require(_0xa544('0x5'));var fs=require('fs');var path=require(_0xa544('0x6'));var rimraf=require('rimraf');var config=require(_0xa544('0x7'));var attributes=require('./squareProject.attributes');module[_0xa544('0x8')]=function(_0x3779bb,_0x3ae02d){return _0x3779bb[_0xa544('0x9')](_0xa544('0xa'),attributes,{'tableName':_0xa544('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b14a95f..a0bc410 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 _0xc8e7=['request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','SquareProject,\x20%s,\x20%s','result','catch','ShowSquareProject','raw','options','attributes','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc8e7,0xd6));var _0x7c8e=function(_0x1de641,_0x44d464){_0x1de641=_0x1de641-0x0;var _0xccacbc=_0xc8e7[_0x1de641];return _0xccacbc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7c8e('0x0'));var BPromise=require(_0x7c8e('0x1'));var rs=require(_0x7c8e('0x2'));var fs=require('fs');var Redis=require(_0x7c8e('0x3'));var db=require(_0x7c8e('0x4'))['db'];var utils=require(_0x7c8e('0x5'));var logger=require('../../config/logger')(_0x7c8e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c8e('0x7')][_0x7c8e('0x8')]({'port':0x232a});config[_0x7c8e('0x9')]=_['defaults'](config[_0x7c8e('0x9')],{'host':_0x7c8e('0xa'),'port':0x18eb});var socket=require(_0x7c8e('0xb'))(new Redis(config[_0x7c8e('0x9')]));require(_0x7c8e('0xc'))[_0x7c8e('0xd')](socket);function respondWithRpcPromise(_0x375533,_0x335bc0,_0x6fb3a0){return new BPromise(function(_0x33be0a,_0x145bd5){return client[_0x7c8e('0xe')](_0x375533,_0x6fb3a0)[_0x7c8e('0xf')](function(_0x2fa659){logger[_0x7c8e('0x10')]('SquareProject,\x20%s,\x20%s',_0x335bc0,_0x7c8e('0x11'));logger[_0x7c8e('0x12')](_0x7c8e('0x13'),_0x335bc0,_0x7c8e('0x11'),JSON['stringify'](_0x2fa659));if(_0x2fa659['error']){if(_0x2fa659[_0x7c8e('0x14')][_0x7c8e('0x15')]===0x1f4){logger[_0x7c8e('0x14')]('SquareProject,\x20%s,\x20%s',_0x335bc0,_0x2fa659[_0x7c8e('0x14')][_0x7c8e('0x16')]);return _0x145bd5(_0x2fa659[_0x7c8e('0x14')][_0x7c8e('0x16')]);}logger[_0x7c8e('0x14')](_0x7c8e('0x17'),_0x335bc0,_0x2fa659[_0x7c8e('0x14')][_0x7c8e('0x16')]);return _0x33be0a(_0x2fa659[_0x7c8e('0x14')]['message']);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x335bc0,_0x7c8e('0x11'));_0x33be0a(_0x2fa659[_0x7c8e('0x18')][_0x7c8e('0x16')]);}})[_0x7c8e('0x19')](function(_0x2c36d7){logger[_0x7c8e('0x14')](_0x7c8e('0x17'),_0x335bc0,_0x2c36d7);_0x145bd5(_0x2c36d7);});});}exports[_0x7c8e('0x1a')]=function(_0x4dcfc1){var _0x4de297=this;return new Promise(function(_0x55e274,_0xdf852e){return db['SquareProject']['find']({'raw':_0x4dcfc1['options']?_0x4dcfc1['options'][_0x7c8e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4dcfc1['options']?_0x4dcfc1['options']['where']||null:null,'attributes':_0x4dcfc1['options']?_0x4dcfc1[_0x7c8e('0x1c')][_0x7c8e('0x1d')]||null:null,'include':_0x4dcfc1['options']?_0x4dcfc1[_0x7c8e('0x1c')][_0x7c8e('0x1e')]?_[_0x7c8e('0x1f')](_0x4dcfc1[_0x7c8e('0x1c')][_0x7c8e('0x1e')],function(_0x4553f2){return{'model':db[_0x4553f2[_0x7c8e('0x20')]],'as':_0x4553f2['as'],'attributes':_0x4553f2[_0x7c8e('0x1d')],'include':_0x4553f2['include']?_[_0x7c8e('0x1f')](_0x4553f2[_0x7c8e('0x1e')],function(_0x5088f5){return{'model':db[_0x5088f5[_0x7c8e('0x20')]],'as':_0x5088f5['as'],'attributes':_0x5088f5[_0x7c8e('0x1d')],'include':_0x5088f5['include']?_[_0x7c8e('0x1f')](_0x5088f5['include'],function(_0x1161cc){return{'model':db[_0x1161cc[_0x7c8e('0x20')]],'as':_0x1161cc['as'],'attributes':_0x1161cc[_0x7c8e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7c8e('0xf')](function(_0x44dcf9){logger[_0x7c8e('0x10')]('ShowSquareProject',_0x4dcfc1);logger[_0x7c8e('0x12')]('ShowSquareProject',_0x4dcfc1,JSON['stringify'](_0x44dcf9));_0x55e274(_0x44dcf9);})[_0x7c8e('0x19')](function(_0x10133e){logger[_0x7c8e('0x14')](_0x7c8e('0x1a'),_0x10133e[_0x7c8e('0x16')],_0x4dcfc1);_0xdf852e(_0x4de297['error'](0x1f4,_0x10133e[_0x7c8e('0x16')]));});});}; \ No newline at end of file +var _0x7866=['SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','SquareProject','find','options','where','include','map','model','attributes','debug','ShowSquareProject','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./squareProject.socket','register','request','then','info'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0x7866,0x169));var _0x6786=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x7866[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x6786('0x0'));var util=require(_0x6786('0x1'));var moment=require(_0x6786('0x2'));var BPromise=require(_0x6786('0x3'));var rs=require(_0x6786('0x4'));var fs=require('fs');var Redis=require(_0x6786('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6786('0x6'));var config=require(_0x6786('0x7'));var jayson=require(_0x6786('0x8'));var client=jayson[_0x6786('0x9')][_0x6786('0xa')]({'port':0x232a});config[_0x6786('0xb')]=_[_0x6786('0xc')](config[_0x6786('0xb')],{'host':_0x6786('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6786('0xe'))[_0x6786('0xf')](socket);function respondWithRpcPromise(_0x1664c3,_0x482e8e,_0x347fbb){return new BPromise(function(_0x3ef7f1,_0xf77b6e){return client[_0x6786('0x10')](_0x1664c3,_0x347fbb)[_0x6786('0x11')](function(_0x58e921){logger[_0x6786('0x12')](_0x6786('0x13'),_0x482e8e,'request\x20sent');logger['debug'](_0x6786('0x14'),_0x482e8e,'request\x20sent',JSON[_0x6786('0x15')](_0x58e921));if(_0x58e921['error']){if(_0x58e921[_0x6786('0x16')][_0x6786('0x17')]===0x1f4){logger[_0x6786('0x16')](_0x6786('0x13'),_0x482e8e,_0x58e921[_0x6786('0x16')]['message']);return _0xf77b6e(_0x58e921[_0x6786('0x16')][_0x6786('0x18')]);}logger['error'](_0x6786('0x13'),_0x482e8e,_0x58e921['error'][_0x6786('0x18')]);return _0x3ef7f1(_0x58e921[_0x6786('0x16')][_0x6786('0x18')]);}else{logger[_0x6786('0x12')]('SquareProject,\x20%s,\x20%s',_0x482e8e,_0x6786('0x19'));_0x3ef7f1(_0x58e921[_0x6786('0x1a')][_0x6786('0x18')]);}})[_0x6786('0x1b')](function(_0x3e794b){logger[_0x6786('0x16')](_0x6786('0x13'),_0x482e8e,_0x3e794b);_0xf77b6e(_0x3e794b);});});}exports['ShowSquareProject']=function(_0x3d80ef){var _0x12a30e=this;return new Promise(function(_0x5a97b9,_0x2b1d24){return db[_0x6786('0x1c')][_0x6786('0x1d')]({'raw':_0x3d80ef[_0x6786('0x1e')]?_0x3d80ef[_0x6786('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3d80ef[_0x6786('0x1e')]?_0x3d80ef[_0x6786('0x1e')][_0x6786('0x1f')]||null:null,'attributes':_0x3d80ef[_0x6786('0x1e')]?_0x3d80ef['options']['attributes']||null:null,'include':_0x3d80ef[_0x6786('0x1e')]?_0x3d80ef[_0x6786('0x1e')][_0x6786('0x20')]?_[_0x6786('0x21')](_0x3d80ef[_0x6786('0x1e')][_0x6786('0x20')],function(_0x6ebee0){return{'model':db[_0x6ebee0[_0x6786('0x22')]],'as':_0x6ebee0['as'],'attributes':_0x6ebee0[_0x6786('0x23')],'include':_0x6ebee0[_0x6786('0x20')]?_[_0x6786('0x21')](_0x6ebee0['include'],function(_0x2ff3e2){return{'model':db[_0x2ff3e2[_0x6786('0x22')]],'as':_0x2ff3e2['as'],'attributes':_0x2ff3e2[_0x6786('0x23')],'include':_0x2ff3e2[_0x6786('0x20')]?_[_0x6786('0x21')](_0x2ff3e2[_0x6786('0x20')],function(_0x2c9c27){return{'model':db[_0x2c9c27[_0x6786('0x22')]],'as':_0x2c9c27['as'],'attributes':_0x2c9c27[_0x6786('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6786('0x11')](function(_0x3a1f14){logger['info']('ShowSquareProject',_0x3d80ef);logger[_0x6786('0x24')](_0x6786('0x25'),_0x3d80ef,JSON[_0x6786('0x15')](_0x3a1f14));_0x5a97b9(_0x3a1f14);})[_0x6786('0x1b')](function(_0x1df742){logger[_0x6786('0x16')](_0x6786('0x25'),_0x1df742[_0x6786('0x18')],_0x3d80ef);_0x2b1d24(_0x12a30e['error'](0x1f4,_0x1df742['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 51528c0..0152c57 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 _0x814b=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x814b,0x1a2));var _0xb814=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x814b[_0xf26d40];return _0x50b68c;};'use strict';var SquareProjectEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){SquareProjectEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);SquareProjectEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0xb016=['register','./squareProject.events','save','emit'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0xb016,0x159));var _0x6b01=function(_0x3028cd,_0x5ca79a){_0x3028cd=_0x3028cd-0x0;var _0x46011a=_0xb016[_0x3028cd];return _0x46011a;};'use strict';var SquareProjectEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){SquareProjectEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('squareProject:'+_0x374aab,_0x65407a);SquareProjectEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1a2a30c..32b8dc0 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 _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','delete','exports'];(function(_0x3dd192,_0x11ddfe){var _0x1141a7=function(_0xbcd30c){while(--_0xbcd30c){_0x3dd192['push'](_0x3dd192['shift']());}};_0x1141a7(++_0x11ddfe);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0x0b0e[_0x34b6aa];return _0x3ead29;};'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['show']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xb'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xb'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4a1327,_0x3642ab){var _0x2fcd03=function(_0x58ba01){while(--_0x58ba01){_0x4a1327['push'](_0x4a1327['shift']());}};_0x2fcd03(++_0x3642ab);}(_0xb10b,0x12a));var _0xbb10=function(_0x392ec2,_0x4e9f85){_0x392ec2=_0x392ec2-0x0;var _0x16e517=_0xb10b[_0x392ec2];return _0x16e517;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0465d1f..c31e594 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 _0x2f92=['exports','STRING','sequelize'];(function(_0x3a0b05,_0x735f){var _0x1d27ad=function(_0xbc2b75){while(--_0xbc2b75){_0x3a0b05['push'](_0x3a0b05['shift']());}};_0x1d27ad(++_0x735f);}(_0x2f92,0x7d));var _0x22f9=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x2f92[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x22f9('0x0'));module[_0x22f9('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x22f9('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x22f9('0x2')]},'accountcode':{'type':Sequelize[_0x22f9('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x22f9('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x22f9('0x2')]},'savePath':{'type':Sequelize[_0x22f9('0x2')]}}; \ No newline at end of file +var _0x71e9=['STRING'];(function(_0x3a3c3d,_0x3b8542){var _0xf3142f=function(_0x479bb0){while(--_0x479bb0){_0x3a3c3d['push'](_0x3a3c3d['shift']());}};_0xf3142f(++_0x3b8542);}(_0x71e9,0xe4));var _0x971e=function(_0x1db427,_0x341919){_0x1db427=_0x1db427-0x0;var _0x277e8e=_0x71e9[_0x1db427];return _0x277e8e;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x971e('0x0')]},'calleridname':{'type':Sequelize[_0x971e('0x0')]},'context':{'type':Sequelize[_0x971e('0x0')]},'extension':{'type':Sequelize[_0x971e('0x0')]},'priority':{'type':Sequelize[_0x971e('0x0')]},'accountcode':{'type':Sequelize[_0x971e('0x0')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x971e('0x0')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x971e('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 72ec280..3e22e58 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 _0xaf80=['update','destroy','download','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','Not\x20found','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','Content-Range','reject','save','then','stack','name','SquareRecording','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','catch','show','params','find','create','body'];(function(_0x440c9d,_0x4ea95b){var _0x4a6c8a=function(_0x169b61){while(--_0x169b61){_0x440c9d['push'](_0x440c9d['shift']());}};_0x4a6c8a(++_0x4ea95b);}(_0xaf80,0x1ef));var _0x0af8=function(_0x3ee902,_0x54e404){_0x3ee902=_0x3ee902-0x0;var _0x41676c=_0xaf80[_0x3ee902];return _0x41676c;};'use strict';var pdf=require(_0x0af8('0x0'));var emlformat=require(_0x0af8('0x1'));var rimraf=require(_0x0af8('0x2'));var zipdir=require(_0x0af8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0af8('0x4'));var Mustache=require(_0x0af8('0x5'));var util=require(_0x0af8('0x6'));var path=require(_0x0af8('0x7'));var sox=require(_0x0af8('0x8'));var csv=require(_0x0af8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x9'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0af8('0x10'))(_0x0af8('0x11'));var utils=require(_0x0af8('0x12'));var config=require(_0x0af8('0x13'));var db=require(_0x0af8('0x14'))['db'];function respondWithStatusCode(_0x583902,_0xeb071d){_0xeb071d=_0xeb071d||0xcc;return function(_0x2d5892){if(_0x2d5892){return _0x583902[_0x0af8('0x15')](_0xeb071d);}return _0x583902[_0x0af8('0x16')](_0xeb071d)[_0x0af8('0x17')]();};}function respondWithResult(_0x10911f,_0xe51111){_0xe51111=_0xe51111||0xc8;return function(_0x58a9a8){if(_0x58a9a8){return _0x10911f['status'](_0xe51111)[_0x0af8('0x18')](_0x58a9a8);}};}function respondWithFilteredResult(_0xbfd057,_0x287cfc){return function(_0x216f0b){if(_0x216f0b){var _0x2a42a4=_0x216f0b['count'],_0x1997b8=_0x287cfc['offset'],_0x4755cb=_0x287cfc['offset']+_0x287cfc[_0x0af8('0x19')],_0x325b4c;if(_0x4755cb>=_0x2a42a4){_0x4755cb=_0x2a42a4;_0x325b4c=0xc8;}else{_0x325b4c=0xce;}_0xbfd057[_0x0af8('0x16')](_0x325b4c);return _0xbfd057['set'](_0x0af8('0x1a'),_0x1997b8+'-'+_0x4755cb+'/'+_0x2a42a4)[_0x0af8('0x18')](_0x216f0b);}return null;};}function patchUpdates(_0x38068d){return function(_0x4a5851){try{jsonpatch['apply'](_0x4a5851,_0x38068d,!![]);}catch(_0x50b8fa){return BPromise[_0x0af8('0x1b')](_0x50b8fa);}return _0x4a5851[_0x0af8('0x1c')]();};}function saveUpdates(_0x5626f8,_0x2baa24){return function(_0x4891e6){if(_0x4891e6){return _0x4891e6['update'](_0x5626f8)[_0x0af8('0x1d')](function(_0x2e0b36){return _0x2e0b36;});}return null;};}function removeEntity(_0x29cd4a,_0x5c0dd1){return function(_0x162e95){if(_0x162e95){return _0x162e95['destroy']()['then'](function(){_0x29cd4a[_0x0af8('0x16')](0xcc)[_0x0af8('0x17')]();});}};}function handleEntityNotFound(_0x4b0492,_0x300474){return function(_0x320d0c){if(!_0x320d0c){_0x4b0492[_0x0af8('0x15')](0x194);}return _0x320d0c;};}function handleError(_0x1b046b,_0x43e3d1){_0x43e3d1=_0x43e3d1||0x1f4;return function(_0x57e0a9){logger['error'](_0x57e0a9[_0x0af8('0x1e')]);if(_0x57e0a9[_0x0af8('0x1f')]){delete _0x57e0a9[_0x0af8('0x1f')];}_0x1b046b[_0x0af8('0x16')](_0x43e3d1)['send'](_0x57e0a9);};}exports['index']=function(_0x315ad,_0x142542){var _0x23a102={},_0x140104={},_0x2e8853={'count':0x0,'rows':[]};var _0x410216=db[_0x0af8('0x20')]['rawAttributes'];_0x140104[_0x0af8('0x21')]=_[_0x0af8('0x22')](_0x410216);_0x140104[_0x0af8('0x23')]=_[_0x0af8('0x22')](_0x315ad[_0x0af8('0x23')]);_0x140104[_0x0af8('0x24')]=_[_0x0af8('0x25')](_0x140104[_0x0af8('0x21')],_0x140104[_0x0af8('0x23')]);_0x23a102[_0x0af8('0x26')]=_[_0x0af8('0x25')](_0x140104['model'],qs[_0x0af8('0x27')](_0x315ad['query'][_0x0af8('0x27')]));_0x23a102['attributes']=_0x23a102[_0x0af8('0x26')][_0x0af8('0x28')]?_0x23a102['attributes']:_0x140104[_0x0af8('0x21')];if(!_0x315ad[_0x0af8('0x23')][_0x0af8('0x29')]('nolimit')){_0x23a102[_0x0af8('0x19')]=qs[_0x0af8('0x19')](_0x315ad[_0x0af8('0x23')]['limit']);_0x23a102[_0x0af8('0x2a')]=qs[_0x0af8('0x2a')](_0x315ad[_0x0af8('0x23')][_0x0af8('0x2a')]);}_0x23a102[_0x0af8('0x2b')]=qs[_0x0af8('0x2c')](_0x315ad['query'][_0x0af8('0x2c')]);_0x23a102[_0x0af8('0x2d')]=qs[_0x0af8('0x24')](_[_0x0af8('0x2e')](_0x315ad[_0x0af8('0x23')],_0x140104[_0x0af8('0x24')]));if(_0x315ad[_0x0af8('0x23')][_0x0af8('0x2f')]){_0x23a102[_0x0af8('0x2d')]=_[_0x0af8('0x30')](_0x23a102[_0x0af8('0x2d')],{'$or':_[_0x0af8('0x31')](_0x410216,function(_0x5bb0e7){if(_0x5bb0e7[_0x0af8('0x32')][_0x0af8('0x33')]!==_0x0af8('0x34')){var _0x1b843e={};_0x1b843e[_0x5bb0e7[_0x0af8('0x35')]]={'$like':'%'+_0x315ad[_0x0af8('0x23')][_0x0af8('0x2f')]+'%'};return _0x1b843e;}})});}_0x23a102=_['merge']({},_0x23a102,_0x315ad[_0x0af8('0x36')]);var _0x4537d9={'where':_0x23a102[_0x0af8('0x2d')]};return db['SquareRecording'][_0x0af8('0x37')](_0x4537d9)[_0x0af8('0x1d')](function(_0x2e1c37){_0x2e8853['count']=_0x2e1c37;if(_0x315ad[_0x0af8('0x23')][_0x0af8('0x38')]){_0x23a102[_0x0af8('0x39')]=[{'all':!![]}];}return db[_0x0af8('0x20')][_0x0af8('0x3a')](_0x23a102);})[_0x0af8('0x1d')](function(_0x258872){_0x2e8853['rows']=_0x258872;return _0x2e8853;})['then'](respondWithFilteredResult(_0x142542,_0x23a102))[_0x0af8('0x3b')](handleError(_0x142542,null));};exports[_0x0af8('0x3c')]=function(_0x5bc8f5,_0x1590bc){var _0x4486b8={'raw':!![],'where':{'id':_0x5bc8f5[_0x0af8('0x3d')]['id']}},_0x52b98b={};_0x52b98b['model']=_[_0x0af8('0x22')](db[_0x0af8('0x20')]['rawAttributes']);_0x52b98b[_0x0af8('0x23')]=_[_0x0af8('0x22')](_0x5bc8f5['query']);_0x52b98b[_0x0af8('0x24')]=_['intersection'](_0x52b98b[_0x0af8('0x21')],_0x52b98b[_0x0af8('0x23')]);_0x4486b8[_0x0af8('0x26')]=_['intersection'](_0x52b98b['model'],qs[_0x0af8('0x27')](_0x5bc8f5[_0x0af8('0x23')][_0x0af8('0x27')]));_0x4486b8[_0x0af8('0x26')]=_0x4486b8['attributes'][_0x0af8('0x28')]?_0x4486b8[_0x0af8('0x26')]:_0x52b98b[_0x0af8('0x21')];if(_0x5bc8f5['query'][_0x0af8('0x38')]){_0x4486b8[_0x0af8('0x39')]=[{'all':!![]}];}_0x4486b8=_['merge']({},_0x4486b8,_0x5bc8f5[_0x0af8('0x36')]);return db['SquareRecording'][_0x0af8('0x3e')](_0x4486b8)['then'](handleEntityNotFound(_0x1590bc,null))['then'](respondWithResult(_0x1590bc,null))['catch'](handleError(_0x1590bc,null));};exports[_0x0af8('0x3f')]=function(_0x5afb76,_0x4bc5f2){return db['SquareRecording'][_0x0af8('0x3f')](_0x5afb76[_0x0af8('0x40')],{})[_0x0af8('0x1d')](respondWithResult(_0x4bc5f2,0xc9))[_0x0af8('0x3b')](handleError(_0x4bc5f2,null));};exports[_0x0af8('0x41')]=function(_0x562f09,_0x5c1672){if(_0x562f09[_0x0af8('0x40')]['id']){delete _0x562f09[_0x0af8('0x40')]['id'];}return db[_0x0af8('0x20')][_0x0af8('0x3e')]({'where':{'id':_0x562f09[_0x0af8('0x3d')]['id']}})[_0x0af8('0x1d')](handleEntityNotFound(_0x5c1672,null))[_0x0af8('0x1d')](saveUpdates(_0x562f09['body'],null))['then'](respondWithResult(_0x5c1672,null))[_0x0af8('0x3b')](handleError(_0x5c1672,null));};exports[_0x0af8('0x42')]=function(_0x394525,_0x3c57dd){return db['SquareRecording'][_0x0af8('0x3e')]({'where':{'id':_0x394525[_0x0af8('0x3d')]['id']}})[_0x0af8('0x1d')](handleEntityNotFound(_0x3c57dd,null))[_0x0af8('0x1d')](removeEntity(_0x3c57dd,null))[_0x0af8('0x3b')](handleError(_0x3c57dd,null));};exports[_0x0af8('0x43')]=function(_0x4e7d6e,_0x2b7ada,_0x5042eb){var _0x407438=require('../../components/encryptor');var _0xeddce9=![];var _0x36ec9e={};if(_0x4e7d6e[_0x0af8('0x23')]['type']&&_0x4e7d6e[_0x0af8('0x23')][_0x0af8('0x32')]==='uniqueid'){_0x36ec9e[_0x0af8('0x44')]=_0x4e7d6e[_0x0af8('0x3d')]['id'];}else{_0x36ec9e['id']=_0x4e7d6e[_0x0af8('0x3d')]['id'];}return db[_0x0af8('0x20')][_0x0af8('0x3e')]({'where':_0x36ec9e,'attributes':['id',_0x0af8('0x45'),_0x0af8('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x2b7ada,null))[_0x0af8('0x1d')](function(_0x4535ea){if(_0x4535ea){var _0x49bd57=_0x4535ea['savePath'];var _0x3c3562=util[_0x0af8('0x47')]('%s.cypher',_0x49bd57);if(fs[_0x0af8('0x48')](_0x3c3562)){_0xeddce9=!![];return _0x407438[_0x0af8('0x49')](_0x3c3562,_0x49bd57,config['secrets'][_0x0af8('0x4a')])['then'](function(){return _0x4535ea;});}return _0x4535ea;}})['then'](function(_0x306a77){if(_0x306a77){var _0x1911cd=_0x306a77['savePath'];if(!fs[_0x0af8('0x48')](_0x1911cd)){throw new db[(_0x0af8('0x4b'))]['ValidationError'](_0x0af8('0x4c'));}if(_0x306a77['filename']){return _0x2b7ada[_0x0af8('0x43')](_0x1911cd,_0x306a77[_0x0af8('0x46')]+path['extname'](_0x1911cd),function(){if(_0xeddce9){fs['unlink'](_0x1911cd);}});}else{return _0x2b7ada[_0x0af8('0x43')](_0x1911cd,function(_0x18da9c){if(_0xeddce9){fs[_0x0af8('0x4d')](_0x1911cd);}});}}})[_0x0af8('0x3b')](function(_0x524f79){if(_0x524f79[_0x0af8('0x4e')]===_0x0af8('0x4c')){_0x2b7ada[_0x0af8('0x16')](0x194)['send'](_0x0af8('0x4f'));}else{return handleError(_0x2b7ada,null);}});}; \ No newline at end of file +var _0x340b=['params','rawAttributes','options','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','SquareRecording','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','map','type','key','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x340b,0x16a));var _0xb340=function(_0x5aa24e,_0x37ace1){_0x5aa24e=_0x5aa24e-0x0;var _0x5ad0ca=_0x340b[_0x5aa24e];return _0x5ad0ca;};'use strict';var pdf=require(_0xb340('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb340('0x1'));var zipdir=require(_0xb340('0x2'));var jsonpatch=require(_0xb340('0x3'));var rp=require('request-promise');var moment=require(_0xb340('0x4'));var BPromise=require(_0xb340('0x5'));var Mustache=require(_0xb340('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb340('0x7'));var csv=require('to-csv');var ejs=require(_0xb340('0x8'));var fs=require('fs');var _=require(_0xb340('0x9'));var squel=require('squel');var crypto=require(_0xb340('0xa'));var jsforce=require(_0xb340('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb340('0xc'));var Papa=require(_0xb340('0xd'));var Redis=require(_0xb340('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb340('0xf'))(_0xb340('0x10'));var utils=require(_0xb340('0x11'));var config=require(_0xb340('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4779ac,_0x5a79c8){_0x5a79c8=_0x5a79c8||0xcc;return function(_0x49cc02){if(_0x49cc02){return _0x4779ac[_0xb340('0x13')](_0x5a79c8);}return _0x4779ac[_0xb340('0x14')](_0x5a79c8)[_0xb340('0x15')]();};}function respondWithResult(_0x2adaf5,_0x221b3b){_0x221b3b=_0x221b3b||0xc8;return function(_0x424bcb){if(_0x424bcb){return _0x2adaf5[_0xb340('0x14')](_0x221b3b)['json'](_0x424bcb);}};}function respondWithFilteredResult(_0x54cfde,_0xf2ee43){return function(_0x1edbf3){if(_0x1edbf3){var _0x29c004=_0x1edbf3['count'],_0x214c28=_0xf2ee43['offset'],_0x1ab272=_0xf2ee43[_0xb340('0x16')]+_0xf2ee43['limit'],_0x49548d;if(_0x1ab272>=_0x29c004){_0x1ab272=_0x29c004;_0x49548d=0xc8;}else{_0x49548d=0xce;}_0x54cfde[_0xb340('0x14')](_0x49548d);return _0x54cfde[_0xb340('0x17')](_0xb340('0x18'),_0x214c28+'-'+_0x1ab272+'/'+_0x29c004)[_0xb340('0x19')](_0x1edbf3);}return null;};}function patchUpdates(_0x45b8ef){return function(_0x4d2af6){try{jsonpatch[_0xb340('0x1a')](_0x4d2af6,_0x45b8ef,!![]);}catch(_0x54fafc){return BPromise[_0xb340('0x1b')](_0x54fafc);}return _0x4d2af6['save']();};}function saveUpdates(_0x239674,_0x1a8d7b){return function(_0x3bda2a){if(_0x3bda2a){return _0x3bda2a[_0xb340('0x1c')](_0x239674)['then'](function(_0x282e89){return _0x282e89;});}return null;};}function removeEntity(_0x3e4b02,_0x3f8262){return function(_0xa41c56){if(_0xa41c56){return _0xa41c56[_0xb340('0x1d')]()[_0xb340('0x1e')](function(){_0x3e4b02['status'](0xcc)[_0xb340('0x15')]();});}};}function handleEntityNotFound(_0x3affec,_0x127956){return function(_0x20245b){if(!_0x20245b){_0x3affec[_0xb340('0x13')](0x194);}return _0x20245b;};}function handleError(_0x11e175,_0x51791c){_0x51791c=_0x51791c||0x1f4;return function(_0x5f53c2){logger[_0xb340('0x1f')](_0x5f53c2[_0xb340('0x20')]);if(_0x5f53c2[_0xb340('0x21')]){delete _0x5f53c2[_0xb340('0x21')];}_0x11e175[_0xb340('0x14')](_0x51791c)[_0xb340('0x22')](_0x5f53c2);};}exports[_0xb340('0x23')]=function(_0x5763fa,_0x5badaa){var _0x508d6f={},_0x5ac802={},_0x5772eb={'count':0x0,'rows':[]};var _0x46763e=db[_0xb340('0x24')]['rawAttributes'];_0x5ac802['model']=_[_0xb340('0x25')](_0x46763e);_0x5ac802['query']=_[_0xb340('0x25')](_0x5763fa[_0xb340('0x26')]);_0x5ac802['filters']=_[_0xb340('0x27')](_0x5ac802[_0xb340('0x28')],_0x5ac802[_0xb340('0x26')]);_0x508d6f[_0xb340('0x29')]=_[_0xb340('0x27')](_0x5ac802['model'],qs[_0xb340('0x2a')](_0x5763fa['query'][_0xb340('0x2a')]));_0x508d6f[_0xb340('0x29')]=_0x508d6f[_0xb340('0x29')][_0xb340('0x2b')]?_0x508d6f[_0xb340('0x29')]:_0x5ac802[_0xb340('0x28')];if(!_0x5763fa[_0xb340('0x26')][_0xb340('0x2c')](_0xb340('0x2d'))){_0x508d6f[_0xb340('0x2e')]=qs[_0xb340('0x2e')](_0x5763fa[_0xb340('0x26')][_0xb340('0x2e')]);_0x508d6f[_0xb340('0x16')]=qs['offset'](_0x5763fa[_0xb340('0x26')][_0xb340('0x16')]);}_0x508d6f['order']=qs['sort'](_0x5763fa[_0xb340('0x26')][_0xb340('0x2f')]);_0x508d6f[_0xb340('0x30')]=qs[_0xb340('0x31')](_['pick'](_0x5763fa[_0xb340('0x26')],_0x5ac802[_0xb340('0x31')]));if(_0x5763fa['query'][_0xb340('0x32')]){_0x508d6f['where']=_['merge'](_0x508d6f['where'],{'$or':_[_0xb340('0x33')](_0x46763e,function(_0x44ac42){if(_0x44ac42[_0xb340('0x34')][_0xb340('0x35')]!==_0xb340('0x36')){var _0x536dfc={};_0x536dfc[_0x44ac42['field']]={'$like':'%'+_0x5763fa['query'][_0xb340('0x32')]+'%'};return _0x536dfc;}})});}_0x508d6f=_[_0xb340('0x37')]({},_0x508d6f,_0x5763fa['options']);var _0x4a173c={'where':_0x508d6f[_0xb340('0x30')]};return db['SquareRecording'][_0xb340('0x38')](_0x4a173c)['then'](function(_0x4e1d33){_0x5772eb['count']=_0x4e1d33;if(_0x5763fa[_0xb340('0x26')][_0xb340('0x39')]){_0x508d6f[_0xb340('0x3a')]=[{'all':!![]}];}return db[_0xb340('0x24')][_0xb340('0x3b')](_0x508d6f);})[_0xb340('0x1e')](function(_0x4c2eb6){_0x5772eb[_0xb340('0x3c')]=_0x4c2eb6;return _0x5772eb;})[_0xb340('0x1e')](respondWithFilteredResult(_0x5badaa,_0x508d6f))[_0xb340('0x3d')](handleError(_0x5badaa,null));};exports[_0xb340('0x3e')]=function(_0x35d15a,_0x25f454){var _0x1c6a09={'raw':!![],'where':{'id':_0x35d15a[_0xb340('0x3f')]['id']}},_0x489c4b={};_0x489c4b[_0xb340('0x28')]=_['keys'](db[_0xb340('0x24')][_0xb340('0x40')]);_0x489c4b[_0xb340('0x26')]=_[_0xb340('0x25')](_0x35d15a[_0xb340('0x26')]);_0x489c4b['filters']=_[_0xb340('0x27')](_0x489c4b[_0xb340('0x28')],_0x489c4b[_0xb340('0x26')]);_0x1c6a09[_0xb340('0x29')]=_[_0xb340('0x27')](_0x489c4b[_0xb340('0x28')],qs['fields'](_0x35d15a[_0xb340('0x26')]['fields']));_0x1c6a09[_0xb340('0x29')]=_0x1c6a09[_0xb340('0x29')][_0xb340('0x2b')]?_0x1c6a09[_0xb340('0x29')]:_0x489c4b[_0xb340('0x28')];if(_0x35d15a['query'][_0xb340('0x39')]){_0x1c6a09[_0xb340('0x3a')]=[{'all':!![]}];}_0x1c6a09=_[_0xb340('0x37')]({},_0x1c6a09,_0x35d15a[_0xb340('0x41')]);return db[_0xb340('0x24')][_0xb340('0x42')](_0x1c6a09)[_0xb340('0x1e')](handleEntityNotFound(_0x25f454,null))[_0xb340('0x1e')](respondWithResult(_0x25f454,null))[_0xb340('0x3d')](handleError(_0x25f454,null));};exports[_0xb340('0x43')]=function(_0x55d77a,_0x2e71ea){return db[_0xb340('0x24')][_0xb340('0x43')](_0x55d77a[_0xb340('0x44')],{})[_0xb340('0x1e')](respondWithResult(_0x2e71ea,0xc9))[_0xb340('0x3d')](handleError(_0x2e71ea,null));};exports[_0xb340('0x1c')]=function(_0x2fa111,_0x495105){if(_0x2fa111['body']['id']){delete _0x2fa111['body']['id'];}return db[_0xb340('0x24')][_0xb340('0x42')]({'where':{'id':_0x2fa111['params']['id']}})[_0xb340('0x1e')](handleEntityNotFound(_0x495105,null))['then'](saveUpdates(_0x2fa111['body'],null))['then'](respondWithResult(_0x495105,null))[_0xb340('0x3d')](handleError(_0x495105,null));};exports['destroy']=function(_0x340a2c,_0x43deb5){return db[_0xb340('0x24')]['find']({'where':{'id':_0x340a2c[_0xb340('0x3f')]['id']}})['then'](handleEntityNotFound(_0x43deb5,null))[_0xb340('0x1e')](removeEntity(_0x43deb5,null))['catch'](handleError(_0x43deb5,null));};exports['download']=function(_0x22fa98,_0x5ea4b5,_0x4477db){var _0x453c50=require(_0xb340('0x45'));var _0x5bb1f8=![];var _0x1befaa={};if(_0x22fa98[_0xb340('0x26')][_0xb340('0x34')]&&_0x22fa98[_0xb340('0x26')][_0xb340('0x34')]===_0xb340('0x46')){_0x1befaa['uniqueid']=_0x22fa98['params']['id'];}else{_0x1befaa['id']=_0x22fa98[_0xb340('0x3f')]['id'];}return db['SquareRecording'][_0xb340('0x42')]({'where':_0x1befaa,'attributes':['id',_0xb340('0x47'),_0xb340('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x5ea4b5,null))[_0xb340('0x1e')](function(_0x4a1a10){if(_0x4a1a10){var _0x3a915=_0x4a1a10[_0xb340('0x47')];var _0x2ee906=util[_0xb340('0x49')]('%s.cypher',_0x3a915);if(fs[_0xb340('0x4a')](_0x2ee906)){_0x5bb1f8=!![];return _0x453c50[_0xb340('0x4b')](_0x2ee906,_0x3a915,config['secrets'][_0xb340('0x4c')])[_0xb340('0x1e')](function(){return _0x4a1a10;});}return _0x4a1a10;}})['then'](function(_0x30e107){if(_0x30e107){var _0x2cd246=_0x30e107[_0xb340('0x47')];if(!fs['existsSync'](_0x2cd246)){throw new db[(_0xb340('0x4d'))][(_0xb340('0x4e'))]('SquareRecording\x20not\x20found');}if(_0x30e107['filename']){return _0x5ea4b5[_0xb340('0x4f')](_0x2cd246,_0x30e107['filename']+path[_0xb340('0x50')](_0x2cd246),function(){if(_0x5bb1f8){fs['unlink'](_0x2cd246);}});}else{return _0x5ea4b5[_0xb340('0x4f')](_0x2cd246,function(_0xb70abd){if(_0x5bb1f8){fs[_0xb340('0x51')](_0x2cd246);}});}}})[_0xb340('0x3d')](function(_0xd4ce5e){if(_0xd4ce5e[_0xb340('0x52')]===_0xb340('0x53')){_0x5ea4b5['status'](0x194)[_0xb340('0x22')](_0xb340('0x54'));}else{return handleError(_0x5ea4b5,null);}});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8ad04d1..2a8aa25 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 _0x0570=['SquareRecording','util','../../config/logger','api','bluebird','path','../../config/environment','./squareRecording.attributes','exports'];(function(_0x1b27e2,_0x303764){var _0x51b712=function(_0x302c92){while(--_0x302c92){_0x1b27e2['push'](_0x1b27e2['shift']());}};_0x51b712(++_0x303764);}(_0x0570,0x172));var _0x0057=function(_0x4d1e58,_0x451d6f){_0x4d1e58=_0x4d1e58-0x0;var _0x164094=_0x0570[_0x4d1e58];return _0x164094;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var logger=require(_0x0057('0x1'))(_0x0057('0x2'));var moment=require('moment');var BPromise=require(_0x0057('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0057('0x4'));var rimraf=require('rimraf');var config=require(_0x0057('0x5'));var attributes=require(_0x0057('0x6'));module[_0x0057('0x7')]=function(_0x418a5a,_0xa651a4){return _0x418a5a['define'](_0x0057('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./squareRecording.attributes','define','SquareRecording','lodash'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x583c,0x12b));var _0xc583=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x583c[_0x354164];return _0x5db9a8;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 2225cfa..da6709d 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 _0xfe80=['create','options','raw','info','lodash','util','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','result','message','catch','CreateSquareRecording','SquareRecording'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe80,0xfe));var _0x0fe8=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0xfe80[_0x1b664d];return _0x43af6b;};'use strict';var _=require(_0x0fe8('0x0'));var util=require(_0x0fe8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0fe8('0x2'));var logger=require('../../config/logger')(_0x0fe8('0x3'));var config=require(_0x0fe8('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x0fe8('0x5')][_0x0fe8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x37ffaf,_0x5973ef,_0x464566){return new BPromise(function(_0x2d5b09,_0x22c5db){return client[_0x0fe8('0x7')](_0x37ffaf,_0x464566)[_0x0fe8('0x8')](function(_0x4da3cc){logger['info']('SquareRecording,\x20%s,\x20%s',_0x5973ef,_0x0fe8('0x9'));logger[_0x0fe8('0xa')](_0x0fe8('0xb'),_0x5973ef,_0x0fe8('0x9'),JSON[_0x0fe8('0xc')](_0x4da3cc));if(_0x4da3cc['error']){if(_0x4da3cc[_0x0fe8('0xd')][_0x0fe8('0xe')]===0x1f4){logger['error'](_0x0fe8('0xf'),_0x5973ef,_0x4da3cc[_0x0fe8('0xd')]['message']);return _0x22c5db(_0x4da3cc['error']['message']);}logger[_0x0fe8('0xd')](_0x0fe8('0xf'),_0x5973ef,_0x4da3cc[_0x0fe8('0xd')]['message']);return _0x2d5b09(_0x4da3cc[_0x0fe8('0xd')]['message']);}else{logger['info'](_0x0fe8('0xf'),_0x5973ef,_0x0fe8('0x9'));_0x2d5b09(_0x4da3cc[_0x0fe8('0x10')][_0x0fe8('0x11')]);}})[_0x0fe8('0x12')](function(_0x54a69a){logger[_0x0fe8('0xd')](_0x0fe8('0xf'),_0x5973ef,_0x54a69a);_0x22c5db(_0x54a69a);});});}exports[_0x0fe8('0x13')]=function(_0x188b93){var _0x3a2718=this;return new Promise(function(_0x2d288a,_0x3afdd0){return db[_0x0fe8('0x14')][_0x0fe8('0x15')](_0x188b93['body'],{'raw':_0x188b93['options']?_0x188b93[_0x0fe8('0x16')][_0x0fe8('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x425401){logger[_0x0fe8('0x18')](_0x0fe8('0x13'),_0x188b93);logger['debug'](_0x0fe8('0x13'),_0x188b93,JSON['stringify'](_0x425401));_0x2d288a(_0x425401);})[_0x0fe8('0x12')](function(_0x44850a){logger[_0x0fe8('0xd')]('CreateSquareRecording',_0x44850a[_0x0fe8('0x11')],_0x188b93);_0x3afdd0(_0x3a2718[_0x0fe8('0xd')](0x1f4,_0x44850a[_0x0fe8('0x11')]));});});}; \ No newline at end of file +var _0x2f79=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareRecording','body','options','raw','debug'];(function(_0x17ae95,_0x40cda7){var _0x2766f2=function(_0x50fc3f){while(--_0x50fc3f){_0x17ae95['push'](_0x17ae95['shift']());}};_0x2766f2(++_0x40cda7);}(_0x2f79,0x113));var _0x92f7=function(_0x4f203f,_0x1ea1b8){_0x4f203f=_0x4f203f-0x0;var _0x2722de=_0x2f79[_0x4f203f];return _0x2722de;};'use strict';var _=require(_0x92f7('0x0'));var util=require('util');var moment=require(_0x92f7('0x1'));var BPromise=require(_0x92f7('0x2'));var rs=require(_0x92f7('0x3'));var fs=require('fs');var Redis=require(_0x92f7('0x4'));var db=require(_0x92f7('0x5'))['db'];var utils=require(_0x92f7('0x6'));var logger=require(_0x92f7('0x7'))(_0x92f7('0x8'));var config=require(_0x92f7('0x9'));var jayson=require(_0x92f7('0xa'));var client=jayson['client'][_0x92f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd3b26,_0x4e9f90,_0x3211f4){return new BPromise(function(_0x227d85,_0x112c7){return client['request'](_0xfd3b26,_0x3211f4)[_0x92f7('0xc')](function(_0x1ae49d){logger[_0x92f7('0xd')](_0x92f7('0xe'),_0x4e9f90,'request\x20sent');logger['debug'](_0x92f7('0xf'),_0x4e9f90,'request\x20sent',JSON['stringify'](_0x1ae49d));if(_0x1ae49d[_0x92f7('0x10')]){if(_0x1ae49d[_0x92f7('0x10')][_0x92f7('0x11')]===0x1f4){logger[_0x92f7('0x10')](_0x92f7('0xe'),_0x4e9f90,_0x1ae49d[_0x92f7('0x10')]['message']);return _0x112c7(_0x1ae49d['error'][_0x92f7('0x12')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x4e9f90,_0x1ae49d[_0x92f7('0x10')]['message']);return _0x227d85(_0x1ae49d[_0x92f7('0x10')][_0x92f7('0x12')]);}else{logger[_0x92f7('0xd')](_0x92f7('0xe'),_0x4e9f90,'request\x20sent');_0x227d85(_0x1ae49d['result'][_0x92f7('0x12')]);}})[_0x92f7('0x13')](function(_0x239aaf){logger['error'](_0x92f7('0xe'),_0x4e9f90,_0x239aaf);_0x112c7(_0x239aaf);});});}exports[_0x92f7('0x14')]=function(_0x4d40ad){var _0x78bdce=this;return new Promise(function(_0x14b8c5,_0xedf1c4){return db['SquareRecording']['create'](_0x4d40ad[_0x92f7('0x15')],{'raw':_0x4d40ad[_0x92f7('0x16')]?_0x4d40ad[_0x92f7('0x16')][_0x92f7('0x17')]===undefined?!![]:![]:!![]})[_0x92f7('0xc')](function(_0x236470){logger['info'](_0x92f7('0x14'),_0x4d40ad);logger[_0x92f7('0x18')]('CreateSquareRecording',_0x4d40ad,JSON['stringify'](_0x236470));_0x14b8c5(_0x236470);})[_0x92f7('0x13')](function(_0x32412a){logger[_0x92f7('0x10')]('CreateSquareRecording',_0x32412a[_0x92f7('0x12')],_0x4d40ad);_0xedf1c4(_0x78bdce[_0x92f7('0x10')](0x1f4,_0x32412a[_0x92f7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 81eb07d..bd76761 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 _0x21b1=['show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4f25a3,_0x241289){var _0x316392=function(_0x1f2424){while(--_0x1f2424){_0x4f25a3['push'](_0x4f25a3['shift']());}};_0x316392(++_0x241289);}(_0x21b1,0x11d));var _0x121b=function(_0x46f3f4,_0x3721d5){_0x46f3f4=_0x46f3f4-0x0;var _0x5e0da5=_0x21b1[_0x46f3f4];return _0x5e0da5;};'use strict';var multer=require(_0x121b('0x0'));var util=require(_0x121b('0x1'));var path=require(_0x121b('0x2'));var timeout=require(_0x121b('0x3'));var express=require(_0x121b('0x4'));var router=express[_0x121b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x121b('0x6'));var config=require(_0x121b('0x7'));var controller=require(_0x121b('0x8'));router[_0x121b('0x9')]('/',auth[_0x121b('0xa')](),controller[_0x121b('0xb')]);router[_0x121b('0x9')](_0x121b('0xc'),auth[_0x121b('0xa')](),controller[_0x121b('0xd')]);router[_0x121b('0x9')](_0x121b('0xe'),auth['isAuthenticated'](),controller[_0x121b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x121b('0x10')]('/:id',auth[_0x121b('0xa')](),controller['update']);router[_0x121b('0x11')]('/:id',auth[_0x121b('0xa')](),controller[_0x121b('0x12')]);module[_0x121b('0x13')]=router; \ No newline at end of file +var _0x9c3c=['util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','exports','multer'];(function(_0xf249b9,_0x13c94e){var _0x47b45c=function(_0x17bd8f){while(--_0x17bd8f){_0xf249b9['push'](_0xf249b9['shift']());}};_0x47b45c(++_0x13c94e);}(_0x9c3c,0x179));var _0xc9c3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9c3c[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xc9c3('0x0'));var util=require(_0xc9c3('0x1'));var path=require(_0xc9c3('0x2'));var timeout=require(_0xc9c3('0x3'));var express=require(_0xc9c3('0x4'));var router=express[_0xc9c3('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc9c3('0x6'));var controller=require('./squareReport.controller');router[_0xc9c3('0x7')]('/',auth[_0xc9c3('0x8')](),controller[_0xc9c3('0x9')]);router[_0xc9c3('0x7')](_0xc9c3('0xa'),auth[_0xc9c3('0x8')](),controller[_0xc9c3('0xb')]);router[_0xc9c3('0x7')](_0xc9c3('0xc'),auth[_0xc9c3('0x8')](),controller['show']);router[_0xc9c3('0xd')]('/',auth['isAuthenticated'](),controller[_0xc9c3('0xe')]);router[_0xc9c3('0xf')](_0xc9c3('0xc'),auth[_0xc9c3('0x8')](),controller['update']);router[_0xc9c3('0x10')](_0xc9c3('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc9c3('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 b088bec..464a9a1 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 _0x7cb9=['DATE','BOOLEAN','exports','STRING'];(function(_0x19763b,_0x16e148){var _0x41d416=function(_0x12d91a){while(--_0x12d91a){_0x19763b['push'](_0x19763b['shift']());}};_0x41d416(++_0x16e148);}(_0x7cb9,0x72));var _0x97cb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7cb9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x97cb('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x97cb('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x97cb('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x97cb('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97cb('0x1')]},'callingpres':{'type':Sequelize[_0x97cb('0x1')]},'callingani2':{'type':Sequelize[_0x97cb('0x1')]},'callington':{'type':Sequelize[_0x97cb('0x1')]},'callingtns':{'type':Sequelize[_0x97cb('0x1')]},'dnid':{'type':Sequelize[_0x97cb('0x1')]},'rdnis':{'type':Sequelize[_0x97cb('0x1')]},'context':{'type':Sequelize[_0x97cb('0x1')]},'extension':{'type':Sequelize[_0x97cb('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x97cb('0x1')]},'accountcode':{'type':Sequelize[_0x97cb('0x1')]},'threadid':{'type':Sequelize[_0x97cb('0x1')]},'project_name':{'type':Sequelize[_0x97cb('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x97cb('0x2')]},'bot':{'type':Sequelize[_0x97cb('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x180d=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x153d6f,_0x53b98a){var _0x52502f=function(_0x48664c){while(--_0x48664c){_0x153d6f['push'](_0x153d6f['shift']());}};_0x52502f(++_0x53b98a);}(_0x180d,0x15c));var _0xd180=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x180d[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0xd180('0x0'));module[_0xd180('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd180('0x2')]},'language':{'type':Sequelize[_0xd180('0x2')]},'type':{'type':Sequelize[_0xd180('0x2')]},'uniqueid':{'type':Sequelize[_0xd180('0x2')]},'version':{'type':Sequelize[_0xd180('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd180('0x2')]},'callingpres':{'type':Sequelize[_0xd180('0x2')]},'callingani2':{'type':Sequelize[_0xd180('0x2')]},'callington':{'type':Sequelize[_0xd180('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xd180('0x2')]},'rdnis':{'type':Sequelize[_0xd180('0x2')]},'context':{'type':Sequelize[_0xd180('0x2')]},'extension':{'type':Sequelize[_0xd180('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xd180('0x2')]},'accountcode':{'type':Sequelize[_0xd180('0x2')]},'threadid':{'type':Sequelize[_0xd180('0x2')]},'project_name':{'type':Sequelize[_0xd180('0x2')]},'joinAt':{'type':Sequelize[_0xd180('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xd180('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 b58cd14..aef1426 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 _0x7dc3=['show','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','key','VIRTUAL','field','filter','options','includeAll','include','SquareReport','findAll','rows','catch'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x7dc3,0x133));var _0x37dc=function(_0x7a6d99,_0x3609d7){_0x7a6d99=_0x7a6d99-0x0;var _0x429cf1=_0x7dc3[_0x7a6d99];return _0x429cf1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x37dc('0x0'));var rimraf=require(_0x37dc('0x1'));var zipdir=require(_0x37dc('0x2'));var jsonpatch=require(_0x37dc('0x3'));var rp=require(_0x37dc('0x4'));var moment=require(_0x37dc('0x5'));var BPromise=require(_0x37dc('0x6'));var Mustache=require(_0x37dc('0x7'));var util=require(_0x37dc('0x8'));var path=require(_0x37dc('0x9'));var sox=require('sox');var csv=require(_0x37dc('0xa'));var ejs=require(_0x37dc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x37dc('0xc'));var crypto=require(_0x37dc('0xd'));var jsforce=require(_0x37dc('0xe'));var deskjs=require(_0x37dc('0xf'));var toCsv=require(_0x37dc('0xa'));var querystring=require(_0x37dc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37dc('0x11'));var qs=require(_0x37dc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37dc('0x13'))(_0x37dc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x37dc('0x15'))['db'];function respondWithStatusCode(_0x11465b,_0x2a0741){_0x2a0741=_0x2a0741||0xcc;return function(_0xd8500f){if(_0xd8500f){return _0x11465b[_0x37dc('0x16')](_0x2a0741);}return _0x11465b[_0x37dc('0x17')](_0x2a0741)[_0x37dc('0x18')]();};}function respondWithResult(_0x2c04a8,_0x187858){_0x187858=_0x187858||0xc8;return function(_0x5bed37){if(_0x5bed37){return _0x2c04a8[_0x37dc('0x17')](_0x187858)[_0x37dc('0x19')](_0x5bed37);}};}function respondWithFilteredResult(_0x1290f6,_0x297815){return function(_0x2d915e){if(_0x2d915e){var _0x4eba81=_0x2d915e[_0x37dc('0x1a')],_0x23459f=_0x297815[_0x37dc('0x1b')],_0x5dda2a=_0x297815['offset']+_0x297815[_0x37dc('0x1c')],_0x49573a;if(_0x5dda2a>=_0x4eba81){_0x5dda2a=_0x4eba81;_0x49573a=0xc8;}else{_0x49573a=0xce;}_0x1290f6[_0x37dc('0x17')](_0x49573a);return _0x1290f6['set'](_0x37dc('0x1d'),_0x23459f+'-'+_0x5dda2a+'/'+_0x4eba81)[_0x37dc('0x19')](_0x2d915e);}return null;};}function patchUpdates(_0x308d9c){return function(_0x15d3b6){try{jsonpatch[_0x37dc('0x1e')](_0x15d3b6,_0x308d9c,!![]);}catch(_0x2e7134){return BPromise[_0x37dc('0x1f')](_0x2e7134);}return _0x15d3b6[_0x37dc('0x20')]();};}function saveUpdates(_0x5be03a,_0x51a947){return function(_0x18d20f){if(_0x18d20f){return _0x18d20f['update'](_0x5be03a)[_0x37dc('0x21')](function(_0x72b41b){return _0x72b41b;});}return null;};}function removeEntity(_0xa6377b,_0x1704c9){return function(_0x371a6a){if(_0x371a6a){return _0x371a6a[_0x37dc('0x22')]()['then'](function(){_0xa6377b['status'](0xcc)[_0x37dc('0x18')]();});}};}function handleEntityNotFound(_0x4ee3d7,_0x21def7){return function(_0x3b7ede){if(!_0x3b7ede){_0x4ee3d7['sendStatus'](0x194);}return _0x3b7ede;};}function handleError(_0x30d0c4,_0x1a8b03){_0x1a8b03=_0x1a8b03||0x1f4;return function(_0x3f4076){logger[_0x37dc('0x23')](_0x3f4076[_0x37dc('0x24')]);if(_0x3f4076[_0x37dc('0x25')]){delete _0x3f4076[_0x37dc('0x25')];}_0x30d0c4[_0x37dc('0x17')](_0x1a8b03)[_0x37dc('0x26')](_0x3f4076);};}exports[_0x37dc('0x27')]=function(_0x13115c,_0x242884){var _0x9550af={},_0x3d0a77={},_0xe5fd81={'count':0x0,'rows':[]};var _0x17f480=db['SquareReport'][_0x37dc('0x28')];_0x3d0a77[_0x37dc('0x29')]=_[_0x37dc('0x2a')](_0x17f480);_0x3d0a77[_0x37dc('0x2b')]=_[_0x37dc('0x2a')](_0x13115c[_0x37dc('0x2b')]);_0x3d0a77[_0x37dc('0x2c')]=_[_0x37dc('0x2d')](_0x3d0a77[_0x37dc('0x29')],_0x3d0a77[_0x37dc('0x2b')]);_0x9550af[_0x37dc('0x2e')]=_[_0x37dc('0x2d')](_0x3d0a77[_0x37dc('0x29')],qs[_0x37dc('0x2f')](_0x13115c['query'][_0x37dc('0x2f')]));_0x9550af[_0x37dc('0x2e')]=_0x9550af[_0x37dc('0x2e')][_0x37dc('0x30')]?_0x9550af[_0x37dc('0x2e')]:_0x3d0a77['model'];if(!_0x13115c[_0x37dc('0x2b')][_0x37dc('0x31')](_0x37dc('0x32'))){_0x9550af[_0x37dc('0x1c')]=qs[_0x37dc('0x1c')](_0x13115c[_0x37dc('0x2b')][_0x37dc('0x1c')]);_0x9550af[_0x37dc('0x1b')]=qs[_0x37dc('0x1b')](_0x13115c[_0x37dc('0x2b')][_0x37dc('0x1b')]);}_0x9550af[_0x37dc('0x33')]=qs[_0x37dc('0x34')](_0x13115c[_0x37dc('0x2b')][_0x37dc('0x34')]);_0x9550af[_0x37dc('0x35')]=qs[_0x37dc('0x2c')](_[_0x37dc('0x36')](_0x13115c[_0x37dc('0x2b')],_0x3d0a77[_0x37dc('0x2c')]));if(_0x13115c[_0x37dc('0x2b')]['filter']){_0x9550af[_0x37dc('0x35')]=_[_0x37dc('0x37')](_0x9550af[_0x37dc('0x35')],{'$or':_['map'](_0x17f480,function(_0x11e510){if(_0x11e510[_0x37dc('0x38')][_0x37dc('0x39')]!==_0x37dc('0x3a')){var _0x45244d={};_0x45244d[_0x11e510[_0x37dc('0x3b')]]={'$like':'%'+_0x13115c[_0x37dc('0x2b')][_0x37dc('0x3c')]+'%'};return _0x45244d;}})});}_0x9550af=_[_0x37dc('0x37')]({},_0x9550af,_0x13115c[_0x37dc('0x3d')]);var _0x3ad54c={'where':_0x9550af[_0x37dc('0x35')]};return db['SquareReport'][_0x37dc('0x1a')](_0x3ad54c)[_0x37dc('0x21')](function(_0xc79d53){_0xe5fd81[_0x37dc('0x1a')]=_0xc79d53;if(_0x13115c[_0x37dc('0x2b')][_0x37dc('0x3e')]){_0x9550af[_0x37dc('0x3f')]=[{'all':!![]}];}return db[_0x37dc('0x40')][_0x37dc('0x41')](_0x9550af);})['then'](function(_0x2c198c){_0xe5fd81[_0x37dc('0x42')]=_0x2c198c;return _0xe5fd81;})[_0x37dc('0x21')](respondWithFilteredResult(_0x242884,_0x9550af))[_0x37dc('0x43')](handleError(_0x242884,null));};exports[_0x37dc('0x44')]=function(_0x370a86,_0x178ea2){var _0x10ddb0={'raw':!![],'where':{'id':_0x370a86['params']['id']}},_0x276d01={};_0x276d01[_0x37dc('0x29')]=_['keys'](db[_0x37dc('0x40')][_0x37dc('0x28')]);_0x276d01[_0x37dc('0x2b')]=_[_0x37dc('0x2a')](_0x370a86['query']);_0x276d01['filters']=_[_0x37dc('0x2d')](_0x276d01[_0x37dc('0x29')],_0x276d01[_0x37dc('0x2b')]);_0x10ddb0[_0x37dc('0x2e')]=_[_0x37dc('0x2d')](_0x276d01[_0x37dc('0x29')],qs['fields'](_0x370a86[_0x37dc('0x2b')][_0x37dc('0x2f')]));_0x10ddb0[_0x37dc('0x2e')]=_0x10ddb0['attributes']['length']?_0x10ddb0[_0x37dc('0x2e')]:_0x276d01[_0x37dc('0x29')];if(_0x370a86[_0x37dc('0x2b')][_0x37dc('0x3e')]){_0x10ddb0[_0x37dc('0x3f')]=[{'all':!![]}];}_0x10ddb0=_[_0x37dc('0x37')]({},_0x10ddb0,_0x370a86[_0x37dc('0x3d')]);return db[_0x37dc('0x40')][_0x37dc('0x45')](_0x10ddb0)[_0x37dc('0x21')](handleEntityNotFound(_0x178ea2,null))[_0x37dc('0x21')](respondWithResult(_0x178ea2,null))[_0x37dc('0x43')](handleError(_0x178ea2,null));};exports[_0x37dc('0x46')]=function(_0x17ebda,_0x4c1a76){return db[_0x37dc('0x40')]['create'](_0x17ebda[_0x37dc('0x47')],{})['then'](respondWithResult(_0x4c1a76,0xc9))['catch'](handleError(_0x4c1a76,null));};exports[_0x37dc('0x48')]=function(_0x1d7b49,_0x5992f9){if(_0x1d7b49[_0x37dc('0x47')]['id']){delete _0x1d7b49['body']['id'];}return db[_0x37dc('0x40')]['find']({'where':{'id':_0x1d7b49['params']['id']}})[_0x37dc('0x21')](handleEntityNotFound(_0x5992f9,null))[_0x37dc('0x21')](saveUpdates(_0x1d7b49[_0x37dc('0x47')],null))[_0x37dc('0x21')](respondWithResult(_0x5992f9,null))[_0x37dc('0x43')](handleError(_0x5992f9,null));};exports['destroy']=function(_0x5b5d45,_0x22b581){return db[_0x37dc('0x40')]['find']({'where':{'id':_0x5b5d45[_0x37dc('0x49')]['id']}})[_0x37dc('0x21')](handleEntityNotFound(_0x22b581,null))[_0x37dc('0x21')](removeEntity(_0x22b581,null))[_0x37dc('0x43')](handleError(_0x22b581,null));};exports[_0x37dc('0x4a')]=function(_0x4a3bad,_0xd8c396){return db[_0x37dc('0x40')][_0x37dc('0x4a')]()[_0x37dc('0x21')](respondWithResult(_0xd8c396,null))[_0x37dc('0x43')](handleError(_0xd8c396,null));}; \ No newline at end of file +var _0x1c0d=['rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','map','type','key','VIRTUAL','field','filter','options','include','rows','catch','show','params','find','create','body','update','describe','html-pdf'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x1c0d,0x91));var _0xd1c0=function(_0x269524,_0x1365b3){_0x269524=_0x269524-0x0;var _0x21def4=_0x1c0d[_0x269524];return _0x21def4;};'use strict';var pdf=require(_0xd1c0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd1c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1c0('0x2'));var rp=require('request-promise');var moment=require(_0xd1c0('0x3'));var BPromise=require(_0xd1c0('0x4'));var Mustache=require(_0xd1c0('0x5'));var util=require(_0xd1c0('0x6'));var path=require(_0xd1c0('0x7'));var sox=require(_0xd1c0('0x8'));var csv=require(_0xd1c0('0x9'));var ejs=require(_0xd1c0('0xa'));var fs=require('fs');var _=require(_0xd1c0('0xb'));var squel=require(_0xd1c0('0xc'));var crypto=require(_0xd1c0('0xd'));var jsforce=require(_0xd1c0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd1c0('0xf'));var Redis=require(_0xd1c0('0x10'));var authService=require(_0xd1c0('0x11'));var qs=require(_0xd1c0('0x12'));var hardwareService=require(_0xd1c0('0x13'));var logger=require(_0xd1c0('0x14'))('api');var utils=require(_0xd1c0('0x15'));var config=require(_0xd1c0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x192868,_0x593059){_0x593059=_0x593059||0xcc;return function(_0x214cef){if(_0x214cef){return _0x192868[_0xd1c0('0x17')](_0x593059);}return _0x192868[_0xd1c0('0x18')](_0x593059)[_0xd1c0('0x19')]();};}function respondWithResult(_0x3d492c,_0xc239de){_0xc239de=_0xc239de||0xc8;return function(_0x235f5a){if(_0x235f5a){return _0x3d492c[_0xd1c0('0x18')](_0xc239de)[_0xd1c0('0x1a')](_0x235f5a);}};}function respondWithFilteredResult(_0x3e2c93,_0x518054){return function(_0x3ef282){if(_0x3ef282){var _0x2fcf6b=_0x3ef282[_0xd1c0('0x1b')],_0x4c3be4=_0x518054[_0xd1c0('0x1c')],_0x9f9997=_0x518054[_0xd1c0('0x1c')]+_0x518054[_0xd1c0('0x1d')],_0x2c5f18;if(_0x9f9997>=_0x2fcf6b){_0x9f9997=_0x2fcf6b;_0x2c5f18=0xc8;}else{_0x2c5f18=0xce;}_0x3e2c93['status'](_0x2c5f18);return _0x3e2c93[_0xd1c0('0x1e')](_0xd1c0('0x1f'),_0x4c3be4+'-'+_0x9f9997+'/'+_0x2fcf6b)[_0xd1c0('0x1a')](_0x3ef282);}return null;};}function patchUpdates(_0x1ed623){return function(_0x3be563){try{jsonpatch[_0xd1c0('0x20')](_0x3be563,_0x1ed623,!![]);}catch(_0x177e20){return BPromise['reject'](_0x177e20);}return _0x3be563[_0xd1c0('0x21')]();};}function saveUpdates(_0x4339ea,_0x5e3aef){return function(_0x57e018){if(_0x57e018){return _0x57e018['update'](_0x4339ea)[_0xd1c0('0x22')](function(_0x3c512d){return _0x3c512d;});}return null;};}function removeEntity(_0x1a10d7,_0x4ef21a){return function(_0x37b661){if(_0x37b661){return _0x37b661[_0xd1c0('0x23')]()[_0xd1c0('0x22')](function(){_0x1a10d7[_0xd1c0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48b3aa,_0x4f2ae5){return function(_0x1d96cd){if(!_0x1d96cd){_0x48b3aa['sendStatus'](0x194);}return _0x1d96cd;};}function handleError(_0x52e1bb,_0xc48a88){_0xc48a88=_0xc48a88||0x1f4;return function(_0x42078e){logger[_0xd1c0('0x24')](_0x42078e[_0xd1c0('0x25')]);if(_0x42078e['name']){delete _0x42078e[_0xd1c0('0x26')];}_0x52e1bb['status'](_0xc48a88)[_0xd1c0('0x27')](_0x42078e);};}exports[_0xd1c0('0x28')]=function(_0x355332,_0x1aa9f0){var _0xd7a8d8={},_0x5a1ab0={},_0xfafc90={'count':0x0,'rows':[]};var _0x6e5bd5=db[_0xd1c0('0x29')][_0xd1c0('0x2a')];_0x5a1ab0[_0xd1c0('0x2b')]=_[_0xd1c0('0x2c')](_0x6e5bd5);_0x5a1ab0[_0xd1c0('0x2d')]=_[_0xd1c0('0x2c')](_0x355332[_0xd1c0('0x2d')]);_0x5a1ab0[_0xd1c0('0x2e')]=_['intersection'](_0x5a1ab0[_0xd1c0('0x2b')],_0x5a1ab0['query']);_0xd7a8d8['attributes']=_['intersection'](_0x5a1ab0[_0xd1c0('0x2b')],qs['fields'](_0x355332['query'][_0xd1c0('0x2f')]));_0xd7a8d8[_0xd1c0('0x30')]=_0xd7a8d8[_0xd1c0('0x30')][_0xd1c0('0x31')]?_0xd7a8d8[_0xd1c0('0x30')]:_0x5a1ab0[_0xd1c0('0x2b')];if(!_0x355332[_0xd1c0('0x2d')][_0xd1c0('0x32')](_0xd1c0('0x33'))){_0xd7a8d8[_0xd1c0('0x1d')]=qs['limit'](_0x355332[_0xd1c0('0x2d')][_0xd1c0('0x1d')]);_0xd7a8d8[_0xd1c0('0x1c')]=qs[_0xd1c0('0x1c')](_0x355332['query'][_0xd1c0('0x1c')]);}_0xd7a8d8[_0xd1c0('0x34')]=qs[_0xd1c0('0x35')](_0x355332[_0xd1c0('0x2d')][_0xd1c0('0x35')]);_0xd7a8d8['where']=qs[_0xd1c0('0x2e')](_['pick'](_0x355332[_0xd1c0('0x2d')],_0x5a1ab0[_0xd1c0('0x2e')]));if(_0x355332['query']['filter']){_0xd7a8d8[_0xd1c0('0x36')]=_[_0xd1c0('0x37')](_0xd7a8d8[_0xd1c0('0x36')],{'$or':_[_0xd1c0('0x38')](_0x6e5bd5,function(_0x15cdf8){if(_0x15cdf8[_0xd1c0('0x39')][_0xd1c0('0x3a')]!==_0xd1c0('0x3b')){var _0x31e567={};_0x31e567[_0x15cdf8[_0xd1c0('0x3c')]]={'$like':'%'+_0x355332[_0xd1c0('0x2d')][_0xd1c0('0x3d')]+'%'};return _0x31e567;}})});}_0xd7a8d8=_['merge']({},_0xd7a8d8,_0x355332[_0xd1c0('0x3e')]);var _0x2f7452={'where':_0xd7a8d8[_0xd1c0('0x36')]};return db[_0xd1c0('0x29')][_0xd1c0('0x1b')](_0x2f7452)['then'](function(_0x24ea15){_0xfafc90[_0xd1c0('0x1b')]=_0x24ea15;if(_0x355332['query']['includeAll']){_0xd7a8d8[_0xd1c0('0x3f')]=[{'all':!![]}];}return db[_0xd1c0('0x29')]['findAll'](_0xd7a8d8);})[_0xd1c0('0x22')](function(_0x2acf45){_0xfafc90[_0xd1c0('0x40')]=_0x2acf45;return _0xfafc90;})[_0xd1c0('0x22')](respondWithFilteredResult(_0x1aa9f0,_0xd7a8d8))[_0xd1c0('0x41')](handleError(_0x1aa9f0,null));};exports[_0xd1c0('0x42')]=function(_0x2c86d4,_0x281aa8){var _0x2f338a={'raw':!![],'where':{'id':_0x2c86d4[_0xd1c0('0x43')]['id']}},_0x357328={};_0x357328[_0xd1c0('0x2b')]=_[_0xd1c0('0x2c')](db[_0xd1c0('0x29')][_0xd1c0('0x2a')]);_0x357328[_0xd1c0('0x2d')]=_[_0xd1c0('0x2c')](_0x2c86d4['query']);_0x357328['filters']=_['intersection'](_0x357328[_0xd1c0('0x2b')],_0x357328[_0xd1c0('0x2d')]);_0x2f338a[_0xd1c0('0x30')]=_['intersection'](_0x357328[_0xd1c0('0x2b')],qs[_0xd1c0('0x2f')](_0x2c86d4[_0xd1c0('0x2d')][_0xd1c0('0x2f')]));_0x2f338a[_0xd1c0('0x30')]=_0x2f338a[_0xd1c0('0x30')][_0xd1c0('0x31')]?_0x2f338a[_0xd1c0('0x30')]:_0x357328['model'];if(_0x2c86d4['query']['includeAll']){_0x2f338a[_0xd1c0('0x3f')]=[{'all':!![]}];}_0x2f338a=_[_0xd1c0('0x37')]({},_0x2f338a,_0x2c86d4[_0xd1c0('0x3e')]);return db['SquareReport'][_0xd1c0('0x44')](_0x2f338a)[_0xd1c0('0x22')](handleEntityNotFound(_0x281aa8,null))[_0xd1c0('0x22')](respondWithResult(_0x281aa8,null))[_0xd1c0('0x41')](handleError(_0x281aa8,null));};exports[_0xd1c0('0x45')]=function(_0x49912,_0x55aac6){return db[_0xd1c0('0x29')][_0xd1c0('0x45')](_0x49912[_0xd1c0('0x46')],{})[_0xd1c0('0x22')](respondWithResult(_0x55aac6,0xc9))['catch'](handleError(_0x55aac6,null));};exports[_0xd1c0('0x47')]=function(_0x39fd84,_0x206b30){if(_0x39fd84['body']['id']){delete _0x39fd84['body']['id'];}return db[_0xd1c0('0x29')]['find']({'where':{'id':_0x39fd84['params']['id']}})[_0xd1c0('0x22')](handleEntityNotFound(_0x206b30,null))[_0xd1c0('0x22')](saveUpdates(_0x39fd84['body'],null))['then'](respondWithResult(_0x206b30,null))['catch'](handleError(_0x206b30,null));};exports[_0xd1c0('0x23')]=function(_0x4c65aa,_0x4adbb0){return db[_0xd1c0('0x29')][_0xd1c0('0x44')]({'where':{'id':_0x4c65aa[_0xd1c0('0x43')]['id']}})['then'](handleEntityNotFound(_0x4adbb0,null))['then'](removeEntity(_0x4adbb0,null))[_0xd1c0('0x41')](handleError(_0x4adbb0,null));};exports[_0xd1c0('0x48')]=function(_0x2b5c52,_0x5a926d){return db['SquareReport'][_0xd1c0('0x48')]()[_0xd1c0('0x22')](respondWithResult(_0x5a926d,null))['catch'](handleError(_0x5a926d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 41f7881..7f1518b 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 _0x09a2=['bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','api','moment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x09a2,0x129));var _0x209a=function(_0x22161f,_0x22229f){_0x22161f=_0x22161f-0x0;var _0x346d18=_0x09a2[_0x22161f];return _0x346d18;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x209a('0x0'))(_0x209a('0x1'));var moment=require(_0x209a('0x2'));var BPromise=require(_0x209a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x209a('0x4'));var rimraf=require(_0x209a('0x5'));var config=require(_0x209a('0x6'));var attributes=require(_0x209a('0x7'));module[_0x209a('0x8')]=function(_0x14ca04,_0x5d881e){return _0x14ca04[_0x209a('0x9')](_0x209a('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x209a('0xb'),'fields':[_0x209a('0xc'),_0x209a('0xd')]},{'name':_0x209a('0xe'),'fields':[_0x209a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc519=['define','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x36d47a,_0x351088){var _0x5d5388=function(_0x33fbcd){while(--_0x33fbcd){_0x36d47a['push'](_0x36d47a['shift']());}};_0x5d5388(++_0x351088);}(_0xc519,0x109));var _0x9c51=function(_0x5bc93d,_0x3a3ff7){_0x5bc93d=_0x5bc93d-0x0;var _0x57133b=_0xc519[_0x5bc93d];return _0x57133b;};'use strict';var _=require(_0x9c51('0x0'));var util=require(_0x9c51('0x1'));var logger=require('../../config/logger')(_0x9c51('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c51('0x3'));var fs=require('fs');var path=require(_0x9c51('0x4'));var rimraf=require(_0x9c51('0x5'));var config=require(_0x9c51('0x6'));var attributes=require('./squareReport.attributes');module[_0x9c51('0x7')]=function(_0x39aade,_0x14b7e5){return _0x39aade[_0x9c51('0x8')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x9c51('0x9'),'fields':[_0x9c51('0xa'),_0x9c51('0xb')]},{'name':_0x9c51('0xc'),'fields':[_0x9c51('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 b50df69..1ca0c99 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 _0x786d=['http','request','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','then','UpdateSquareReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x11376f,_0x3630aa){var _0x4ec55b=function(_0x157f19){while(--_0x157f19){_0x11376f['push'](_0x11376f['shift']());}};_0x4ec55b(++_0x3630aa);}(_0x786d,0x18e));var _0xd786=function(_0x2310a3,_0x4268a0){_0x2310a3=_0x2310a3-0x0;var _0x5262dc=_0x786d[_0x2310a3];return _0x5262dc;};'use strict';var _=require(_0xd786('0x0'));var util=require(_0xd786('0x1'));var moment=require(_0xd786('0x2'));var BPromise=require('bluebird');var rs=require(_0xd786('0x3'));var fs=require('fs');var Redis=require(_0xd786('0x4'));var db=require(_0xd786('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd786('0x6'));var config=require(_0xd786('0x7'));var jayson=require(_0xd786('0x8'));var client=jayson[_0xd786('0x9')][_0xd786('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58dbc9,_0x101237,_0x3eba4b){return new BPromise(function(_0x57a0e3,_0x53d882){return client[_0xd786('0xb')](_0x58dbc9,_0x3eba4b)['then'](function(_0x2f3bd2){logger[_0xd786('0xc')](_0xd786('0xd'),_0x101237,'request\x20sent');logger[_0xd786('0xe')](_0xd786('0xf'),_0x101237,_0xd786('0x10'),JSON[_0xd786('0x11')](_0x2f3bd2));if(_0x2f3bd2[_0xd786('0x12')]){if(_0x2f3bd2[_0xd786('0x12')][_0xd786('0x13')]===0x1f4){logger[_0xd786('0x12')](_0xd786('0xd'),_0x101237,_0x2f3bd2[_0xd786('0x12')][_0xd786('0x14')]);return _0x53d882(_0x2f3bd2['error']['message']);}logger[_0xd786('0x12')]('SquareReport,\x20%s,\x20%s',_0x101237,_0x2f3bd2[_0xd786('0x12')][_0xd786('0x14')]);return _0x57a0e3(_0x2f3bd2[_0xd786('0x12')][_0xd786('0x14')]);}else{logger[_0xd786('0xc')](_0xd786('0xd'),_0x101237,_0xd786('0x10'));_0x57a0e3(_0x2f3bd2[_0xd786('0x15')][_0xd786('0x14')]);}})[_0xd786('0x16')](function(_0x3e5391){logger['error'](_0xd786('0xd'),_0x101237,_0x3e5391);_0x53d882(_0x3e5391);});});}exports[_0xd786('0x17')]=function(_0x47c04a){var _0x2097be=this;return new Promise(function(_0x38e871,_0x5ab8ac){return db[_0xd786('0x18')][_0xd786('0x19')](_0x47c04a[_0xd786('0x1a')],{'raw':_0x47c04a['options']?_0x47c04a[_0xd786('0x1b')][_0xd786('0x1c')]===undefined?!![]:![]:!![]})[_0xd786('0x1d')](function(_0x2cb4ed){logger[_0xd786('0xc')](_0xd786('0x17'),_0x47c04a);logger['debug'](_0xd786('0x17'),_0x47c04a,JSON[_0xd786('0x11')](_0x2cb4ed));_0x38e871(_0x2cb4ed);})[_0xd786('0x16')](function(_0x177f34){logger['error'](_0xd786('0x17'),_0x177f34[_0xd786('0x14')],_0x47c04a);_0x5ab8ac(_0x2097be['error'](0x1f4,_0x177f34[_0xd786('0x14')]));});});};exports[_0xd786('0x1e')]=function(_0x41e659){var _0x453e15=this;return new Promise(function(_0x378456,_0x1bcb8e){return db[_0xd786('0x18')]['update'](_0x41e659['body'],{'raw':_0x41e659[_0xd786('0x1b')]?_0x41e659[_0xd786('0x1b')][_0xd786('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e659[_0xd786('0x1b')]?_0x41e659[_0xd786('0x1b')][_0xd786('0x1f')]||null:null,'attributes':_0x41e659['options']?_0x41e659[_0xd786('0x1b')][_0xd786('0x20')]||null:null,'limit':_0x41e659[_0xd786('0x1b')]?_0x41e659[_0xd786('0x1b')][_0xd786('0x21')]||null:null})[_0xd786('0x1d')](function(_0x3509a6){logger[_0xd786('0xc')](_0xd786('0x1e'),_0x41e659);logger[_0xd786('0xe')](_0xd786('0x1e'),_0x41e659,JSON[_0xd786('0x11')](_0x3509a6));_0x378456(_0x3509a6);})[_0xd786('0x16')](function(_0x2bd216){logger['error'](_0xd786('0x1e'),_0x2bd216[_0xd786('0x14')],_0x41e659);_0x1bcb8e(_0x453e15[_0xd786('0x12')](0x1f4,_0x2bd216['message']));});});}; \ No newline at end of file +var _0x1574=['request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','create','options','raw','UpdateSquareReport','update','body','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s'];(function(_0x66cb11,_0x4325ae){var _0x25e6e5=function(_0x5c0136){while(--_0x5c0136){_0x66cb11['push'](_0x66cb11['shift']());}};_0x25e6e5(++_0x4325ae);}(_0x1574,0x178));var _0x4157=function(_0x60ac32,_0x193b2f){_0x60ac32=_0x60ac32-0x0;var _0x47314a=_0x1574[_0x60ac32];return _0x47314a;};'use strict';var _=require('lodash');var util=require(_0x4157('0x0'));var moment=require(_0x4157('0x1'));var BPromise=require('bluebird');var rs=require(_0x4157('0x2'));var fs=require('fs');var Redis=require(_0x4157('0x3'));var db=require(_0x4157('0x4'))['db'];var utils=require(_0x4157('0x5'));var logger=require('../../config/logger')(_0x4157('0x6'));var config=require('../../config/environment');var jayson=require(_0x4157('0x7'));var client=jayson[_0x4157('0x8')][_0x4157('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a8f6c,_0xd95eb2,_0x3f83ad){return new BPromise(function(_0x3d5e37,_0x565c62){return client[_0x4157('0xa')](_0x1a8f6c,_0x3f83ad)[_0x4157('0xb')](function(_0xc6a60f){logger[_0x4157('0xc')](_0x4157('0xd'),_0xd95eb2,_0x4157('0xe'));logger['debug'](_0x4157('0xf'),_0xd95eb2,_0x4157('0xe'),JSON[_0x4157('0x10')](_0xc6a60f));if(_0xc6a60f['error']){if(_0xc6a60f[_0x4157('0x11')][_0x4157('0x12')]===0x1f4){logger[_0x4157('0x11')]('SquareReport,\x20%s,\x20%s',_0xd95eb2,_0xc6a60f[_0x4157('0x11')]['message']);return _0x565c62(_0xc6a60f[_0x4157('0x11')][_0x4157('0x13')]);}logger[_0x4157('0x11')](_0x4157('0xd'),_0xd95eb2,_0xc6a60f['error'][_0x4157('0x13')]);return _0x3d5e37(_0xc6a60f[_0x4157('0x11')]['message']);}else{logger['info'](_0x4157('0xd'),_0xd95eb2,_0x4157('0xe'));_0x3d5e37(_0xc6a60f['result']['message']);}})[_0x4157('0x14')](function(_0x4abd2e){logger[_0x4157('0x11')](_0x4157('0xd'),_0xd95eb2,_0x4abd2e);_0x565c62(_0x4abd2e);});});}exports[_0x4157('0x15')]=function(_0x366261){var _0x9f893=this;return new Promise(function(_0x3fe02d,_0x10ee72){return db['SquareReport'][_0x4157('0x16')](_0x366261['body'],{'raw':_0x366261[_0x4157('0x17')]?_0x366261['options'][_0x4157('0x18')]===undefined?!![]:![]:!![]})[_0x4157('0xb')](function(_0x43c000){logger[_0x4157('0xc')](_0x4157('0x15'),_0x366261);logger['debug'](_0x4157('0x15'),_0x366261,JSON[_0x4157('0x10')](_0x43c000));_0x3fe02d(_0x43c000);})[_0x4157('0x14')](function(_0x433f0d){logger['error']('CreateSquareReport',_0x433f0d[_0x4157('0x13')],_0x366261);_0x10ee72(_0x9f893[_0x4157('0x11')](0x1f4,_0x433f0d[_0x4157('0x13')]));});});};exports[_0x4157('0x19')]=function(_0x312d46){var _0x2b7f3e=this;return new Promise(function(_0x1d25d0,_0x295ef4){return db['SquareReport'][_0x4157('0x1a')](_0x312d46[_0x4157('0x1b')],{'raw':_0x312d46[_0x4157('0x17')]?_0x312d46[_0x4157('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x312d46['options']?_0x312d46[_0x4157('0x17')]['where']||null:null,'attributes':_0x312d46['options']?_0x312d46['options'][_0x4157('0x1c')]||null:null,'limit':_0x312d46['options']?_0x312d46[_0x4157('0x17')][_0x4157('0x1d')]||null:null})[_0x4157('0xb')](function(_0x445ea5){logger[_0x4157('0xc')](_0x4157('0x19'),_0x312d46);logger['debug'](_0x4157('0x19'),_0x312d46,JSON[_0x4157('0x10')](_0x445ea5));_0x1d25d0(_0x445ea5);})['catch'](function(_0x310440){logger[_0x4157('0x11')](_0x4157('0x19'),_0x310440[_0x4157('0x13')],_0x312d46);_0x295ef4(_0x2b7f3e[_0x4157('0x11')](0x1f4,_0x310440[_0x4157('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1b57b6f..4c3b003 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(_0x27a20b,_0x32fec3){var _0x638daf=function(_0x52cfd6){while(--_0x52cfd6){_0x27a20b['push'](_0x27a20b['shift']());}};_0x638daf(++_0x32fec3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32f250,_0x1fbca3){_0x32f250=_0x32f250-0x0;var _0x39ead3=_0x5f2f[_0x32f250];return _0x39ead3;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x814b,0x1a2));var _0xb814=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x814b[_0x296754];return _0x1d9f1d;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 76725d4..42f16f5 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 _0xf714=['sequelize','exports','STRING','TEXT'];(function(_0x2a036e,_0x4bf8e7){var _0xda43af=function(_0x598a95){while(--_0x598a95){_0x2a036e['push'](_0x2a036e['shift']());}};_0xda43af(++_0x4bf8e7);}(_0xf714,0x194));var _0x4f71=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0xf714[_0x52096b];return _0x2b1cc7;};'use strict';var Sequelize=require(_0x4f71('0x0'));module[_0x4f71('0x1')]={'uniqueid':{'type':Sequelize[_0x4f71('0x2')]},'node':{'type':Sequelize[_0x4f71('0x2')]},'application':{'type':Sequelize[_0x4f71('0x2')]},'data':{'type':Sequelize[_0x4f71('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4f71('0x2')]}}; \ No newline at end of file +var _0x0f9a=['TEXT','exports','STRING'];(function(_0x2dc11d,_0x571cd2){var _0xac1140=function(_0x39c9b1){while(--_0x39c9b1){_0x2dc11d['push'](_0x2dc11d['shift']());}};_0xac1140(++_0x571cd2);}(_0x0f9a,0xfd));var _0xa0f9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0f9a[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0xa0f9('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xa0f9('0x1')]},'application':{'type':Sequelize[_0xa0f9('0x1')]},'data':{'type':Sequelize[_0xa0f9('0x2')]},'project_name':{'type':Sequelize[_0xa0f9('0x1')]},'callerid':{'type':Sequelize[_0xa0f9('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e398db4..d58e31c 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 _0x2bfc=['status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','SquareDetailsReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','key','VIRTUAL','field','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2bfc,0x112));var _0xc2bf=function(_0x56000d,_0x5537f7){_0x56000d=_0x56000d-0x0;var _0x3283a9=_0x2bfc[_0x56000d];return _0x3283a9;};'use strict';var pdf=require(_0xc2bf('0x0'));var emlformat=require(_0xc2bf('0x1'));var rimraf=require(_0xc2bf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2bf('0x3'));var rp=require(_0xc2bf('0x4'));var moment=require(_0xc2bf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc2bf('0x6'));var sox=require(_0xc2bf('0x7'));var csv=require(_0xc2bf('0x8'));var ejs=require(_0xc2bf('0x9'));var fs=require('fs');var _=require(_0xc2bf('0xa'));var squel=require(_0xc2bf('0xb'));var crypto=require(_0xc2bf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc2bf('0xd'));var toCsv=require(_0xc2bf('0x8'));var querystring=require(_0xc2bf('0xe'));var Papa=require(_0xc2bf('0xf'));var Redis=require(_0xc2bf('0x10'));var authService=require(_0xc2bf('0x11'));var qs=require(_0xc2bf('0x12'));var hardwareService=require(_0xc2bf('0x13'));var logger=require(_0xc2bf('0x14'))(_0xc2bf('0x15'));var utils=require(_0xc2bf('0x16'));var config=require(_0xc2bf('0x17'));var db=require(_0xc2bf('0x18'))['db'];function respondWithStatusCode(_0x1474d9,_0x4926bd){_0x4926bd=_0x4926bd||0xcc;return function(_0x53a9f4){if(_0x53a9f4){return _0x1474d9[_0xc2bf('0x19')](_0x4926bd);}return _0x1474d9[_0xc2bf('0x1a')](_0x4926bd)[_0xc2bf('0x1b')]();};}function respondWithResult(_0x218a51,_0x29051c){_0x29051c=_0x29051c||0xc8;return function(_0x37ebbe){if(_0x37ebbe){return _0x218a51[_0xc2bf('0x1a')](_0x29051c)['json'](_0x37ebbe);}};}function respondWithFilteredResult(_0x5e4e2b,_0x24b78d){return function(_0x4c832b){if(_0x4c832b){var _0x22e98e=_0x4c832b['count'],_0x6ff33c=_0x24b78d['offset'],_0x321db4=_0x24b78d[_0xc2bf('0x1c')]+_0x24b78d['limit'],_0x1db561;if(_0x321db4>=_0x22e98e){_0x321db4=_0x22e98e;_0x1db561=0xc8;}else{_0x1db561=0xce;}_0x5e4e2b[_0xc2bf('0x1a')](_0x1db561);return _0x5e4e2b[_0xc2bf('0x1d')](_0xc2bf('0x1e'),_0x6ff33c+'-'+_0x321db4+'/'+_0x22e98e)[_0xc2bf('0x1f')](_0x4c832b);}return null;};}function patchUpdates(_0x240c9a){return function(_0x117483){try{jsonpatch[_0xc2bf('0x20')](_0x117483,_0x240c9a,!![]);}catch(_0x56de5d){return BPromise[_0xc2bf('0x21')](_0x56de5d);}return _0x117483[_0xc2bf('0x22')]();};}function saveUpdates(_0xcc313f,_0x468b57){return function(_0x449297){if(_0x449297){return _0x449297[_0xc2bf('0x23')](_0xcc313f)[_0xc2bf('0x24')](function(_0x895f2f){return _0x895f2f;});}return null;};}function removeEntity(_0x4ecebb,_0x34b903){return function(_0x17e455){if(_0x17e455){return _0x17e455[_0xc2bf('0x25')]()[_0xc2bf('0x24')](function(){_0x4ecebb['status'](0xcc)[_0xc2bf('0x1b')]();});}};}function handleEntityNotFound(_0x536761,_0x1fbf19){return function(_0x1cd3a0){if(!_0x1cd3a0){_0x536761[_0xc2bf('0x19')](0x194);}return _0x1cd3a0;};}function handleError(_0x16ea58,_0x373df2){_0x373df2=_0x373df2||0x1f4;return function(_0x1d936d){logger[_0xc2bf('0x26')](_0x1d936d['stack']);if(_0x1d936d[_0xc2bf('0x27')]){delete _0x1d936d[_0xc2bf('0x27')];}_0x16ea58[_0xc2bf('0x1a')](_0x373df2)[_0xc2bf('0x28')](_0x1d936d);};}exports['index']=function(_0x436cb0,_0x46da54){var _0x27f794={},_0x7612a9={},_0x2d7d84={'count':0x0,'rows':[]};var _0x388d6f=db[_0xc2bf('0x29')][_0xc2bf('0x2a')];_0x7612a9[_0xc2bf('0x2b')]=_['keys'](_0x388d6f);_0x7612a9[_0xc2bf('0x2c')]=_[_0xc2bf('0x2d')](_0x436cb0[_0xc2bf('0x2c')]);_0x7612a9[_0xc2bf('0x2e')]=_[_0xc2bf('0x2f')](_0x7612a9['model'],_0x7612a9[_0xc2bf('0x2c')]);_0x27f794[_0xc2bf('0x30')]=_[_0xc2bf('0x2f')](_0x7612a9['model'],qs[_0xc2bf('0x31')](_0x436cb0[_0xc2bf('0x2c')][_0xc2bf('0x31')]));_0x27f794[_0xc2bf('0x30')]=_0x27f794['attributes'][_0xc2bf('0x32')]?_0x27f794[_0xc2bf('0x30')]:_0x7612a9['model'];if(!_0x436cb0['query'][_0xc2bf('0x33')](_0xc2bf('0x34'))){_0x27f794['limit']=qs['limit'](_0x436cb0[_0xc2bf('0x2c')][_0xc2bf('0x35')]);_0x27f794[_0xc2bf('0x1c')]=qs[_0xc2bf('0x1c')](_0x436cb0[_0xc2bf('0x2c')][_0xc2bf('0x1c')]);}_0x27f794[_0xc2bf('0x36')]=qs['sort'](_0x436cb0[_0xc2bf('0x2c')][_0xc2bf('0x37')]);_0x27f794[_0xc2bf('0x38')]=qs['filters'](_[_0xc2bf('0x39')](_0x436cb0[_0xc2bf('0x2c')],_0x7612a9[_0xc2bf('0x2e')]));if(_0x436cb0['query']['filter']){_0x27f794[_0xc2bf('0x38')]=_[_0xc2bf('0x3a')](_0x27f794[_0xc2bf('0x38')],{'$or':_['map'](_0x388d6f,function(_0x2e00a8){if(_0x2e00a8[_0xc2bf('0x3b')][_0xc2bf('0x3c')]!==_0xc2bf('0x3d')){var _0xbfb470={};_0xbfb470[_0x2e00a8[_0xc2bf('0x3e')]]={'$like':'%'+_0x436cb0[_0xc2bf('0x2c')]['filter']+'%'};return _0xbfb470;}})});}_0x27f794=_[_0xc2bf('0x3a')]({},_0x27f794,_0x436cb0['options']);var _0x3161ab={'where':_0x27f794[_0xc2bf('0x38')]};return db[_0xc2bf('0x29')][_0xc2bf('0x3f')](_0x3161ab)[_0xc2bf('0x24')](function(_0xb785d1){_0x2d7d84[_0xc2bf('0x3f')]=_0xb785d1;if(_0x436cb0[_0xc2bf('0x2c')][_0xc2bf('0x40')]){_0x27f794[_0xc2bf('0x41')]=[{'all':!![]}];}return db[_0xc2bf('0x29')][_0xc2bf('0x42')](_0x27f794);})[_0xc2bf('0x24')](function(_0x72c990){_0x2d7d84[_0xc2bf('0x43')]=_0x72c990;return _0x2d7d84;})[_0xc2bf('0x24')](respondWithFilteredResult(_0x46da54,_0x27f794))[_0xc2bf('0x44')](handleError(_0x46da54,null));};exports[_0xc2bf('0x45')]=function(_0x245ffb,_0x1c2908){var _0x22897a={'raw':!![],'where':{'id':_0x245ffb[_0xc2bf('0x46')]['id']}},_0x31c865={};_0x31c865[_0xc2bf('0x2b')]=_[_0xc2bf('0x2d')](db[_0xc2bf('0x29')][_0xc2bf('0x2a')]);_0x31c865['query']=_[_0xc2bf('0x2d')](_0x245ffb[_0xc2bf('0x2c')]);_0x31c865[_0xc2bf('0x2e')]=_[_0xc2bf('0x2f')](_0x31c865['model'],_0x31c865[_0xc2bf('0x2c')]);_0x22897a[_0xc2bf('0x30')]=_['intersection'](_0x31c865['model'],qs[_0xc2bf('0x31')](_0x245ffb[_0xc2bf('0x2c')][_0xc2bf('0x31')]));_0x22897a[_0xc2bf('0x30')]=_0x22897a[_0xc2bf('0x30')][_0xc2bf('0x32')]?_0x22897a['attributes']:_0x31c865[_0xc2bf('0x2b')];if(_0x245ffb[_0xc2bf('0x2c')]['includeAll']){_0x22897a[_0xc2bf('0x41')]=[{'all':!![]}];}_0x22897a=_['merge']({},_0x22897a,_0x245ffb['options']);return db[_0xc2bf('0x29')]['find'](_0x22897a)[_0xc2bf('0x24')](handleEntityNotFound(_0x1c2908,null))['then'](respondWithResult(_0x1c2908,null))[_0xc2bf('0x44')](handleError(_0x1c2908,null));};exports[_0xc2bf('0x47')]=function(_0xff7faa,_0x159b82){return db[_0xc2bf('0x29')][_0xc2bf('0x47')](_0xff7faa[_0xc2bf('0x48')],{})[_0xc2bf('0x24')](respondWithResult(_0x159b82,0xc9))['catch'](handleError(_0x159b82,null));};exports['update']=function(_0x50774a,_0x520141){if(_0x50774a[_0xc2bf('0x48')]['id']){delete _0x50774a[_0xc2bf('0x48')]['id'];}return db[_0xc2bf('0x29')][_0xc2bf('0x49')]({'where':{'id':_0x50774a['params']['id']}})[_0xc2bf('0x24')](handleEntityNotFound(_0x520141,null))[_0xc2bf('0x24')](saveUpdates(_0x50774a[_0xc2bf('0x48')],null))[_0xc2bf('0x24')](respondWithResult(_0x520141,null))[_0xc2bf('0x44')](handleError(_0x520141,null));};exports[_0xc2bf('0x25')]=function(_0x41f98e,_0x25de39){return db[_0xc2bf('0x29')][_0xc2bf('0x49')]({'where':{'id':_0x41f98e[_0xc2bf('0x46')]['id']}})['then'](handleEntityNotFound(_0x25de39,null))[_0xc2bf('0x24')](removeEntity(_0x25de39,null))['catch'](handleError(_0x25de39,null));};exports[_0xc2bf('0x4a')]=function(_0x667bdf,_0x114b09){return db[_0xc2bf('0x29')]['describe']()['then'](respondWithResult(_0x114b09,null))[_0xc2bf('0x44')](handleError(_0x114b09,null));}; \ No newline at end of file +var _0x9a75=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','name','send','SquareDetailsReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','type','key','field','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a75,0xc5));var _0x59a7=function(_0x499463,_0x25969e){_0x499463=_0x499463-0x0;var _0xb5c5d6=_0x9a75[_0x499463];return _0xb5c5d6;};'use strict';var pdf=require(_0x59a7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x59a7('0x1'));var zipdir=require(_0x59a7('0x2'));var jsonpatch=require(_0x59a7('0x3'));var rp=require(_0x59a7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x59a7('0x5'));var util=require(_0x59a7('0x6'));var path=require('path');var sox=require(_0x59a7('0x7'));var csv=require(_0x59a7('0x8'));var ejs=require(_0x59a7('0x9'));var fs=require('fs');var _=require(_0x59a7('0xa'));var squel=require(_0x59a7('0xb'));var crypto=require(_0x59a7('0xc'));var jsforce=require(_0x59a7('0xd'));var deskjs=require(_0x59a7('0xe'));var toCsv=require(_0x59a7('0x8'));var querystring=require('querystring');var Papa=require(_0x59a7('0xf'));var Redis=require(_0x59a7('0x10'));var authService=require(_0x59a7('0x11'));var qs=require(_0x59a7('0x12'));var hardwareService=require(_0x59a7('0x13'));var logger=require('../../config/logger')(_0x59a7('0x14'));var utils=require('../../config/utils');var config=require(_0x59a7('0x15'));var db=require(_0x59a7('0x16'))['db'];function respondWithStatusCode(_0xa738e5,_0x3e8338){_0x3e8338=_0x3e8338||0xcc;return function(_0x4469bf){if(_0x4469bf){return _0xa738e5[_0x59a7('0x17')](_0x3e8338);}return _0xa738e5[_0x59a7('0x18')](_0x3e8338)[_0x59a7('0x19')]();};}function respondWithResult(_0x4afa98,_0x4b7c88){_0x4b7c88=_0x4b7c88||0xc8;return function(_0x1f5836){if(_0x1f5836){return _0x4afa98['status'](_0x4b7c88)[_0x59a7('0x1a')](_0x1f5836);}};}function respondWithFilteredResult(_0x49eb82,_0x109e08){return function(_0x408d69){if(_0x408d69){var _0x35e97a=_0x408d69[_0x59a7('0x1b')],_0x3ff2e5=_0x109e08[_0x59a7('0x1c')],_0x32d9b6=_0x109e08['offset']+_0x109e08['limit'],_0x5d41f2;if(_0x32d9b6>=_0x35e97a){_0x32d9b6=_0x35e97a;_0x5d41f2=0xc8;}else{_0x5d41f2=0xce;}_0x49eb82[_0x59a7('0x18')](_0x5d41f2);return _0x49eb82['set'](_0x59a7('0x1d'),_0x3ff2e5+'-'+_0x32d9b6+'/'+_0x35e97a)[_0x59a7('0x1a')](_0x408d69);}return null;};}function patchUpdates(_0x36b74b){return function(_0x4c4e6f){try{jsonpatch['apply'](_0x4c4e6f,_0x36b74b,!![]);}catch(_0x8b41ed){return BPromise[_0x59a7('0x1e')](_0x8b41ed);}return _0x4c4e6f[_0x59a7('0x1f')]();};}function saveUpdates(_0x267dc7,_0x17ceb1){return function(_0x20791e){if(_0x20791e){return _0x20791e[_0x59a7('0x20')](_0x267dc7)[_0x59a7('0x21')](function(_0x25c16f){return _0x25c16f;});}return null;};}function removeEntity(_0x2cd451,_0x2bd903){return function(_0x4b9897){if(_0x4b9897){return _0x4b9897['destroy']()[_0x59a7('0x21')](function(){_0x2cd451[_0x59a7('0x18')](0xcc)[_0x59a7('0x19')]();});}};}function handleEntityNotFound(_0xef050d,_0x5edb2a){return function(_0x301259){if(!_0x301259){_0xef050d[_0x59a7('0x17')](0x194);}return _0x301259;};}function handleError(_0x18f1a2,_0x21b8b2){_0x21b8b2=_0x21b8b2||0x1f4;return function(_0x170b37){logger['error'](_0x170b37['stack']);if(_0x170b37['name']){delete _0x170b37[_0x59a7('0x22')];}_0x18f1a2[_0x59a7('0x18')](_0x21b8b2)[_0x59a7('0x23')](_0x170b37);};}exports['index']=function(_0x1bdcaa,_0x460f22){var _0x4ce198={},_0x18e756={},_0xa78207={'count':0x0,'rows':[]};var _0x4efcb6=db[_0x59a7('0x24')][_0x59a7('0x25')];_0x18e756[_0x59a7('0x26')]=_['keys'](_0x4efcb6);_0x18e756['query']=_[_0x59a7('0x27')](_0x1bdcaa[_0x59a7('0x28')]);_0x18e756[_0x59a7('0x29')]=_['intersection'](_0x18e756[_0x59a7('0x26')],_0x18e756[_0x59a7('0x28')]);_0x4ce198['attributes']=_[_0x59a7('0x2a')](_0x18e756[_0x59a7('0x26')],qs[_0x59a7('0x2b')](_0x1bdcaa[_0x59a7('0x28')][_0x59a7('0x2b')]));_0x4ce198[_0x59a7('0x2c')]=_0x4ce198[_0x59a7('0x2c')][_0x59a7('0x2d')]?_0x4ce198[_0x59a7('0x2c')]:_0x18e756[_0x59a7('0x26')];if(!_0x1bdcaa[_0x59a7('0x28')]['hasOwnProperty'](_0x59a7('0x2e'))){_0x4ce198[_0x59a7('0x2f')]=qs[_0x59a7('0x2f')](_0x1bdcaa[_0x59a7('0x28')][_0x59a7('0x2f')]);_0x4ce198[_0x59a7('0x1c')]=qs[_0x59a7('0x1c')](_0x1bdcaa['query'][_0x59a7('0x1c')]);}_0x4ce198[_0x59a7('0x30')]=qs[_0x59a7('0x31')](_0x1bdcaa[_0x59a7('0x28')][_0x59a7('0x31')]);_0x4ce198[_0x59a7('0x32')]=qs[_0x59a7('0x29')](_[_0x59a7('0x33')](_0x1bdcaa[_0x59a7('0x28')],_0x18e756[_0x59a7('0x29')]));if(_0x1bdcaa[_0x59a7('0x28')][_0x59a7('0x34')]){_0x4ce198['where']=_['merge'](_0x4ce198[_0x59a7('0x32')],{'$or':_['map'](_0x4efcb6,function(_0x440a62){if(_0x440a62[_0x59a7('0x35')][_0x59a7('0x36')]!=='VIRTUAL'){var _0x334114={};_0x334114[_0x440a62[_0x59a7('0x37')]]={'$like':'%'+_0x1bdcaa['query'][_0x59a7('0x34')]+'%'};return _0x334114;}})});}_0x4ce198=_[_0x59a7('0x38')]({},_0x4ce198,_0x1bdcaa[_0x59a7('0x39')]);var _0x3bccff={'where':_0x4ce198['where']};return db[_0x59a7('0x24')][_0x59a7('0x1b')](_0x3bccff)['then'](function(_0x491ba0){_0xa78207[_0x59a7('0x1b')]=_0x491ba0;if(_0x1bdcaa['query'][_0x59a7('0x3a')]){_0x4ce198[_0x59a7('0x3b')]=[{'all':!![]}];}return db[_0x59a7('0x24')][_0x59a7('0x3c')](_0x4ce198);})[_0x59a7('0x21')](function(_0x301e92){_0xa78207[_0x59a7('0x3d')]=_0x301e92;return _0xa78207;})[_0x59a7('0x21')](respondWithFilteredResult(_0x460f22,_0x4ce198))['catch'](handleError(_0x460f22,null));};exports[_0x59a7('0x3e')]=function(_0x31b589,_0x26a541){var _0x1f33de={'raw':!![],'where':{'id':_0x31b589[_0x59a7('0x3f')]['id']}},_0x15abff={};_0x15abff[_0x59a7('0x26')]=_[_0x59a7('0x27')](db[_0x59a7('0x24')][_0x59a7('0x25')]);_0x15abff[_0x59a7('0x28')]=_['keys'](_0x31b589[_0x59a7('0x28')]);_0x15abff[_0x59a7('0x29')]=_['intersection'](_0x15abff[_0x59a7('0x26')],_0x15abff[_0x59a7('0x28')]);_0x1f33de['attributes']=_['intersection'](_0x15abff[_0x59a7('0x26')],qs['fields'](_0x31b589[_0x59a7('0x28')][_0x59a7('0x2b')]));_0x1f33de[_0x59a7('0x2c')]=_0x1f33de[_0x59a7('0x2c')][_0x59a7('0x2d')]?_0x1f33de[_0x59a7('0x2c')]:_0x15abff[_0x59a7('0x26')];if(_0x31b589[_0x59a7('0x28')]['includeAll']){_0x1f33de[_0x59a7('0x3b')]=[{'all':!![]}];}_0x1f33de=_[_0x59a7('0x38')]({},_0x1f33de,_0x31b589[_0x59a7('0x39')]);return db['SquareDetailsReport'][_0x59a7('0x40')](_0x1f33de)[_0x59a7('0x21')](handleEntityNotFound(_0x26a541,null))[_0x59a7('0x21')](respondWithResult(_0x26a541,null))[_0x59a7('0x41')](handleError(_0x26a541,null));};exports[_0x59a7('0x42')]=function(_0x2802e3,_0x3151d5){return db[_0x59a7('0x24')][_0x59a7('0x42')](_0x2802e3[_0x59a7('0x43')],{})[_0x59a7('0x21')](respondWithResult(_0x3151d5,0xc9))['catch'](handleError(_0x3151d5,null));};exports[_0x59a7('0x20')]=function(_0x2264be,_0x1ac0e4){if(_0x2264be['body']['id']){delete _0x2264be['body']['id'];}return db[_0x59a7('0x24')][_0x59a7('0x40')]({'where':{'id':_0x2264be[_0x59a7('0x3f')]['id']}})[_0x59a7('0x21')](handleEntityNotFound(_0x1ac0e4,null))['then'](saveUpdates(_0x2264be['body'],null))['then'](respondWithResult(_0x1ac0e4,null))[_0x59a7('0x41')](handleError(_0x1ac0e4,null));};exports[_0x59a7('0x44')]=function(_0x3391a9,_0x6e0264){return db[_0x59a7('0x24')][_0x59a7('0x40')]({'where':{'id':_0x3391a9[_0x59a7('0x3f')]['id']}})[_0x59a7('0x21')](handleEntityNotFound(_0x6e0264,null))['then'](removeEntity(_0x6e0264,null))[_0x59a7('0x41')](handleError(_0x6e0264,null));};exports['describe']=function(_0x541a20,_0x4bdd38){return db['SquareDetailsReport']['describe']()[_0x59a7('0x21')](respondWithResult(_0x4bdd38,null))['catch'](handleError(_0x4bdd38,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 5e207ca..fe6d9c5 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 _0x1cfc=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5bf0a1,_0x4ac790){var _0x314131=function(_0xa325e4){while(--_0xa325e4){_0x5bf0a1['push'](_0x5bf0a1['shift']());}};_0x314131(++_0x4ac790);}(_0x1cfc,0x85));var _0xc1cf=function(_0xf6b0bf,_0x27a86d){_0xf6b0bf=_0xf6b0bf-0x0;var _0x480812=_0x1cfc[_0xf6b0bf];return _0x480812;};'use strict';var _=require(_0xc1cf('0x0'));var util=require(_0xc1cf('0x1'));var logger=require(_0xc1cf('0x2'))(_0xc1cf('0x3'));var moment=require(_0xc1cf('0x4'));var BPromise=require(_0xc1cf('0x5'));var rp=require(_0xc1cf('0x6'));var fs=require('fs');var path=require(_0xc1cf('0x7'));var rimraf=require(_0xc1cf('0x8'));var config=require(_0xc1cf('0x9'));var attributes=require(_0xc1cf('0xa'));module[_0xc1cf('0xb')]=function(_0x213608,_0x57abb8){return _0x213608[_0xc1cf('0xc')]('SquareDetailsReport',attributes,{'tableName':_0xc1cf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x156d=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x15c9ec,_0x4505ca){var _0x619a88=function(_0xa9323b){while(--_0xa9323b){_0x15c9ec['push'](_0x15c9ec['shift']());}};_0x619a88(++_0x4505ca);}(_0x156d,0x162));var _0xd156=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x156d[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd156('0x0'))(_0xd156('0x1'));var moment=require(_0xd156('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd156('0x3'));var rimraf=require(_0xd156('0x4'));var config=require(_0xd156('0x5'));var attributes=require(_0xd156('0x6'));module['exports']=function(_0x1ee0ac,_0x3c21ca){return _0x1ee0ac[_0xd156('0x7')](_0xd156('0x8'),attributes,{'tableName':_0xd156('0x9'),'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 668485e..038c969 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 _0xc16e=['request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','SquareDetailsReport','create','options','raw','CreateSquareDetailsReport','catch','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc16e,0xb4));var _0xec16=function(_0x1e2fd7,_0x1e8c69){_0x1e2fd7=_0x1e2fd7-0x0;var _0xdc385d=_0xc16e[_0x1e2fd7];return _0xdc385d;};'use strict';var _=require(_0xec16('0x0'));var util=require(_0xec16('0x1'));var moment=require(_0xec16('0x2'));var BPromise=require('bluebird');var rs=require(_0xec16('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec16('0x4'))('rpc');var config=require(_0xec16('0x5'));var jayson=require(_0xec16('0x6'));var client=jayson[_0xec16('0x7')][_0xec16('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x250dd7,_0x1664ef,_0x244160){return new BPromise(function(_0x13db65,_0x25da4f){return client[_0xec16('0x9')](_0x250dd7,_0x244160)[_0xec16('0xa')](function(_0x54b591){logger[_0xec16('0xb')](_0xec16('0xc'),_0x1664ef,'request\x20sent');logger[_0xec16('0xd')](_0xec16('0xe'),_0x1664ef,'request\x20sent',JSON[_0xec16('0xf')](_0x54b591));if(_0x54b591[_0xec16('0x10')]){if(_0x54b591[_0xec16('0x10')][_0xec16('0x11')]===0x1f4){logger['error'](_0xec16('0xc'),_0x1664ef,_0x54b591[_0xec16('0x10')][_0xec16('0x12')]);return _0x25da4f(_0x54b591[_0xec16('0x10')][_0xec16('0x12')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1664ef,_0x54b591[_0xec16('0x10')][_0xec16('0x12')]);return _0x13db65(_0x54b591[_0xec16('0x10')][_0xec16('0x12')]);}else{logger[_0xec16('0xb')](_0xec16('0xc'),_0x1664ef,_0xec16('0x13'));_0x13db65(_0x54b591[_0xec16('0x14')][_0xec16('0x12')]);}})['catch'](function(_0x3a6b17){logger[_0xec16('0x10')](_0xec16('0xc'),_0x1664ef,_0x3a6b17);_0x25da4f(_0x3a6b17);});});}exports['CreateSquareDetailsReport']=function(_0x3bec5a){var _0x166be4=this;return new Promise(function(_0x57b2d8,_0xc849b4){return db[_0xec16('0x15')][_0xec16('0x16')](_0x3bec5a['body'],{'raw':_0x3bec5a[_0xec16('0x17')]?_0x3bec5a['options'][_0xec16('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x352354){logger[_0xec16('0xb')](_0xec16('0x19'),_0x3bec5a);logger['debug'](_0xec16('0x19'),_0x3bec5a,JSON[_0xec16('0xf')](_0x352354));_0x57b2d8(_0x352354);})[_0xec16('0x1a')](function(_0x140f55){logger[_0xec16('0x10')](_0xec16('0x19'),_0x140f55[_0xec16('0x12')],_0x3bec5a);_0xc849b4(_0x166be4[_0xec16('0x10')](0x1f4,_0x140f55[_0xec16('0x12')]));});});}; \ No newline at end of file +var _0x2571=['code','message','result','catch','create','body','options','raw','CreateSquareDetailsReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x248b77,_0x371d0f){var _0x97f1da=function(_0x59be52){while(--_0x59be52){_0x248b77['push'](_0x248b77['shift']());}};_0x97f1da(++_0x371d0f);}(_0x2571,0x1ad));var _0x1257=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x2571[_0x235f49];return _0x551139;};'use strict';var _=require('lodash');var util=require(_0x1257('0x0'));var moment=require(_0x1257('0x1'));var BPromise=require(_0x1257('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1257('0x3'));var db=require(_0x1257('0x4'))['db'];var utils=require(_0x1257('0x5'));var logger=require(_0x1257('0x6'))('rpc');var config=require(_0x1257('0x7'));var jayson=require(_0x1257('0x8'));var client=jayson[_0x1257('0x9')][_0x1257('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e80a,_0x441f57,_0x3af856){return new BPromise(function(_0x4e06bc,_0x1e5075){return client[_0x1257('0xb')](_0x32e80a,_0x3af856)['then'](function(_0x2e55e5){logger[_0x1257('0xc')](_0x1257('0xd'),_0x441f57,'request\x20sent');logger[_0x1257('0xe')](_0x1257('0xf'),_0x441f57,_0x1257('0x10'),JSON[_0x1257('0x11')](_0x2e55e5));if(_0x2e55e5[_0x1257('0x12')]){if(_0x2e55e5[_0x1257('0x12')][_0x1257('0x13')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x441f57,_0x2e55e5[_0x1257('0x12')]['message']);return _0x1e5075(_0x2e55e5['error'][_0x1257('0x14')]);}logger[_0x1257('0x12')](_0x1257('0xd'),_0x441f57,_0x2e55e5['error'][_0x1257('0x14')]);return _0x4e06bc(_0x2e55e5[_0x1257('0x12')][_0x1257('0x14')]);}else{logger[_0x1257('0xc')](_0x1257('0xd'),_0x441f57,_0x1257('0x10'));_0x4e06bc(_0x2e55e5[_0x1257('0x15')][_0x1257('0x14')]);}})[_0x1257('0x16')](function(_0x4c517b){logger[_0x1257('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x441f57,_0x4c517b);_0x1e5075(_0x4c517b);});});}exports['CreateSquareDetailsReport']=function(_0x26e4a2){var _0xe9f469=this;return new Promise(function(_0x16164b,_0x448491){return db['SquareDetailsReport'][_0x1257('0x17')](_0x26e4a2[_0x1257('0x18')],{'raw':_0x26e4a2[_0x1257('0x19')]?_0x26e4a2[_0x1257('0x19')][_0x1257('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x14061d){logger[_0x1257('0xc')](_0x1257('0x1b'),_0x26e4a2);logger['debug'](_0x1257('0x1b'),_0x26e4a2,JSON[_0x1257('0x11')](_0x14061d));_0x16164b(_0x14061d);})[_0x1257('0x16')](function(_0x4404a5){logger[_0x1257('0x12')](_0x1257('0x1b'),_0x4404a5[_0x1257('0x14')],_0x26e4a2);_0x448491(_0xe9f469['error'](0x1f4,_0x4404a5[_0x1257('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 20565f0..5eb3eae 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 _0x71e2=['index','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','./system.controller'];(function(_0x2064c8,_0x168039){var _0x23af73=function(_0x2a2d10){while(--_0x2a2d10){_0x2064c8['push'](_0x2064c8['shift']());}};_0x23af73(++_0x168039);}(_0x71e2,0x1d9));var _0x271e=function(_0x3fedac,_0x3ec6ef){_0x3fedac=_0x3fedac-0x0;var _0x4f3e1e=_0x71e2[_0x3fedac];return _0x4f3e1e;};'use strict';var express=require('express');var router=express[_0x271e('0x0')]();var auth=require(_0x271e('0x1'));var controller=require(_0x271e('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x271e('0x3')]);router['get'](_0x271e('0x4'),auth['isAuthenticated'](),controller[_0x271e('0x5')]);module[_0x271e('0x6')]=router; \ No newline at end of file +var _0xc801=['Router','./system.controller','isAuthenticated','index','/process/:pid/kill','exports','express'];(function(_0x278af1,_0x5916c6){var _0x30b8fc=function(_0x1478a6){while(--_0x1478a6){_0x278af1['push'](_0x278af1['shift']());}};_0x30b8fc(++_0x5916c6);}(_0xc801,0x195));var _0x1c80=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xc801[_0x43d11d];return _0x38cd08;};'use strict';var express=require(_0x1c80('0x0'));var router=express[_0x1c80('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x1c80('0x2'));router['get']('/',auth[_0x1c80('0x3')](),controller[_0x1c80('0x4')]);router['get'](_0x1c80('0x5'),auth[_0x1c80('0x3')](),controller['killProcess']);module[_0x1c80('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 716fdb0..63dbce9 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 _0xb261=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','getAllData','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb261,0x1b1));var _0x1b26=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0xb261[_0x120bc2];return _0x454a41;};'use strict';var info=require('systeminformation');var exec=require(_0x1b26('0x0'))[_0x1b26('0x1')];var logger=require(_0x1b26('0x2'))(_0x1b26('0x3'));var util=require(_0x1b26('0x4'));var BPromise=require(_0x1b26('0x5'));var _=require(_0x1b26('0x6'));function handleError(_0x99f483,_0x49581a,_0x125ee6){_0x49581a=_0x49581a||0x1f4;return function(_0x2f70ec){logger['error'](_0x1b26('0x7'),_0x125ee6,_0x49581a,util[_0x1b26('0x8')](_0x2f70ec,{'showHidden':![],'depth':null}));delete _0x2f70ec[_0x1b26('0x9')];_0x99f483[_0x1b26('0xa')](_0x49581a)['send'](_0x2f70ec);};}exports['index']=function(_0x3be9ff,_0x432480){return info[_0x1b26('0xb')]()[_0x1b26('0xc')](function(_0x5fee6a){return _0x432480['status'](0xc8)[_0x1b26('0xd')](_0x5fee6a);})[_0x1b26('0xe')](function(_0x1ee90c){return _0x432480[_0x1b26('0xa')](0x1f4)[_0x1b26('0xd')](_0x1ee90c);});};exports[_0x1b26('0xf')]=function(_0x252db4,_0x19f1db){var _0x46e968=[_0x1b26('0x10')];return new BPromise(function(_0x139732,_0x5749e5){return exec(util['format'](_0x1b26('0x11'),_0x252db4[_0x1b26('0x12')][_0x1b26('0x13')]),function(_0x319bdf,_0x498576,_0x5ef698){if(_0x319bdf){return _0x5749e5(_0x319bdf);}return _0x139732(_0x498576);});})[_0x1b26('0xc')](function(_0x58aaa0){var _0x493b30=![];var _0xf9fc34=_0x58aaa0[_0x1b26('0x14')](/\n/);for(var _0x4da060=0x0,_0x418040=_0x46e968['length'];_0x4da060<_0x418040,_0x493b30===![];_0x4da060+=0x1){if(_0x58aaa0[_0x1b26('0x15')](_0x46e968[_0x4da060])>=0x0){_0x493b30=!![];}}if(!_0x493b30){throw new Error(util[_0x1b26('0x16')](_0x1b26('0x17'),_0x252db4[_0x1b26('0x12')][_0x1b26('0x13')]));}process[_0x1b26('0x18')](_0x252db4[_0x1b26('0x12')][_0x1b26('0x13')],_0x1b26('0x19'));return _0x19f1db['status'](0xc8)[_0x1b26('0xd')]({'message':util[_0x1b26('0x16')](_0x1b26('0x1a'),_0x252db4[_0x1b26('0x12')][_0x1b26('0x13')])});})['catch'](handleError(_0x19f1db,null,'killProcess'));}; \ No newline at end of file +var _0x038a=['kill','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','status','send','index','getAllData','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x3aab9e,_0x346556){var _0x28db91=function(_0x27ea27){while(--_0x27ea27){_0x3aab9e['push'](_0x3aab9e['shift']());}};_0x28db91(++_0x346556);}(_0x038a,0x93));var _0xa038=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x038a[_0x5538d5];return _0x323b1a;};'use strict';var info=require(_0xa038('0x0'));var exec=require(_0xa038('0x1'))[_0xa038('0x2')];var logger=require(_0xa038('0x3'))(_0xa038('0x4'));var util=require(_0xa038('0x5'));var BPromise=require(_0xa038('0x6'));var _=require(_0xa038('0x7'));function handleError(_0xaf6060,_0x198820,_0x9b3176){_0x198820=_0x198820||0x1f4;return function(_0x129a96){logger[_0xa038('0x8')](_0xa038('0x9'),_0x9b3176,_0x198820,util['inspect'](_0x129a96,{'showHidden':![],'depth':null}));delete _0x129a96[_0xa038('0xa')];_0xaf6060[_0xa038('0xb')](_0x198820)[_0xa038('0xc')](_0x129a96);};}exports[_0xa038('0xd')]=function(_0x292401,_0x3cabdf){return info[_0xa038('0xe')]()['then'](function(_0x54c565){return _0x3cabdf[_0xa038('0xb')](0xc8)[_0xa038('0xf')](_0x54c565);})[_0xa038('0x10')](function(_0x3463a2){return _0x3cabdf[_0xa038('0xb')](0x1f4)[_0xa038('0xf')](_0x3463a2);});};exports[_0xa038('0x11')]=function(_0x2ff632,_0x2db3de){var _0x2323b9=['components/import/cm'];return new BPromise(function(_0x12eeec,_0x134a76){return exec(util[_0xa038('0x12')](_0xa038('0x13'),_0x2ff632[_0xa038('0x14')][_0xa038('0x15')]),function(_0x51cafd,_0x563084,_0x3c1e74){if(_0x51cafd){return _0x134a76(_0x51cafd);}return _0x12eeec(_0x563084);});})[_0xa038('0x16')](function(_0x1aa2cc){var _0x13ae58=![];var _0x1c9f36=_0x1aa2cc[_0xa038('0x17')](/\n/);for(var _0x50ed4d=0x0,_0xedc674=_0x2323b9[_0xa038('0x18')];_0x50ed4d<_0xedc674,_0x13ae58===![];_0x50ed4d+=0x1){if(_0x1aa2cc[_0xa038('0x19')](_0x2323b9[_0x50ed4d])>=0x0){_0x13ae58=!![];}}if(!_0x13ae58){throw new Error(util[_0xa038('0x12')](_0xa038('0x1a'),_0x2ff632[_0xa038('0x14')][_0xa038('0x15')]));}process[_0xa038('0x1b')](_0x2ff632[_0xa038('0x14')][_0xa038('0x15')],'SIGINT');return _0x2db3de['status'](0xc8)[_0xa038('0xf')]({'message':util[_0xa038('0x12')](_0xa038('0x1c'),_0x2ff632[_0xa038('0x14')][_0xa038('0x15')])});})['catch'](handleError(_0x2db3de,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c4ed3f5..b01b5d4 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 _0xdace=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','exports','multer'];(function(_0x1d35f7,_0x2bec06){var _0x5e63ec=function(_0x132d6e){while(--_0x132d6e){_0x1d35f7['push'](_0x1d35f7['shift']());}};_0x5e63ec(++_0x2bec06);}(_0xdace,0xc5));var _0xedac=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xdace[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var auth=require(_0xedac('0x4'));var interaction=require(_0xedac('0x5'));var config=require(_0xedac('0x6'));var controller=require(_0xedac('0x7'));router['get']('/',auth[_0xedac('0x8')](),controller[_0xedac('0x9')]);router[_0xedac('0xa')]('/:id',auth[_0xedac('0x8')](),controller[_0xedac('0xb')]);router[_0xedac('0xc')]('/',auth['isAuthenticated'](),controller[_0xedac('0xd')]);router[_0xedac('0xe')](_0xedac('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xedac('0x10')](_0xedac('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xedac('0x11')]=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x34e8,0x12c));var _0x834e=function(_0x4702f6,_0x9fc9e3){_0x4702f6=_0x4702f6-0x0;var _0x53a47d=_0x34e8[_0x4702f6];return _0x53a47d;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6a06f71..dd39b92 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['STRING','sequelize','exports'];(function(_0x44290c,_0x52a119){var _0x4042f0=function(_0x52570f){while(--_0x52570f){_0x44290c['push'](_0x44290c['shift']());}};_0x4042f0(++_0x52a119);}(_0x5c00,0x17e));var _0x05c0=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0x5c00[_0x5b8646];return _0x363e4c;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x14a0=['name','#0091EA','exports','STRING'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x14a0,0x8e));var _0x014a=function(_0xeaf22b,_0x4ef7ce){_0xeaf22b=_0xeaf22b-0x0;var _0x229395=_0x14a0[_0xeaf22b];return _0x229395;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')],'unique':_0x014a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x014a('0x1')],'defaultValue':_0x014a('0x3')},'description':{'type':Sequelize[_0x014a('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index b94502a..78142a3 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 _0xd353=['limit','set','Content-Range','update','destroy','then','get','Tags','UserProfileResource','status','stack','name','index','Tag','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','type','VIRTUAL','field','options','includeAll','findAll','rows','show','params','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','sendStatus','end','json','count','offset'];(function(_0x6c56e7,_0x3194c2){var _0x13a223=function(_0x58212c){while(--_0x58212c){_0x6c56e7['push'](_0x6c56e7['shift']());}};_0x13a223(++_0x3194c2);}(_0xd353,0x7e));var _0x3d35=function(_0x2e59a7,_0x3c6006){_0x2e59a7=_0x2e59a7-0x0;var _0x57f0a3=_0xd353[_0x2e59a7];return _0x57f0a3;};'use strict';var pdf=require(_0x3d35('0x0'));var emlformat=require(_0x3d35('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3d35('0x2'));var jsonpatch=require(_0x3d35('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d35('0x4'));var Mustache=require('mustache');var util=require(_0x3d35('0x5'));var path=require(_0x3d35('0x6'));var sox=require(_0x3d35('0x7'));var csv=require(_0x3d35('0x8'));var ejs=require(_0x3d35('0x9'));var fs=require('fs');var _=require(_0x3d35('0xa'));var squel=require(_0x3d35('0xb'));var crypto=require('crypto');var jsforce=require(_0x3d35('0xc'));var deskjs=require(_0x3d35('0xd'));var toCsv=require(_0x3d35('0x8'));var querystring=require(_0x3d35('0xe'));var Papa=require(_0x3d35('0xf'));var Redis=require(_0x3d35('0x10'));var authService=require(_0x3d35('0x11'));var qs=require(_0x3d35('0x12'));var hardwareService=require(_0x3d35('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3d35('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b03bc,_0x4bcce5){_0x4bcce5=_0x4bcce5||0xcc;return function(_0x5aafa1){if(_0x5aafa1){return _0x5b03bc[_0x3d35('0x15')](_0x4bcce5);}return _0x5b03bc['status'](_0x4bcce5)[_0x3d35('0x16')]();};}function respondWithResult(_0x677234,_0x209f89){_0x209f89=_0x209f89||0xc8;return function(_0x24cce9){if(_0x24cce9){return _0x677234['status'](_0x209f89)[_0x3d35('0x17')](_0x24cce9);}};}function respondWithFilteredResult(_0x2118cd,_0x5c0391){return function(_0x3037f1){if(_0x3037f1){var _0x1ec3db=_0x3037f1[_0x3d35('0x18')],_0x5c59a0=_0x5c0391[_0x3d35('0x19')],_0x2c5e9a=_0x5c0391[_0x3d35('0x19')]+_0x5c0391[_0x3d35('0x1a')],_0x2f3dfa;if(_0x2c5e9a>=_0x1ec3db){_0x2c5e9a=_0x1ec3db;_0x2f3dfa=0xc8;}else{_0x2f3dfa=0xce;}_0x2118cd['status'](_0x2f3dfa);return _0x2118cd[_0x3d35('0x1b')](_0x3d35('0x1c'),_0x5c59a0+'-'+_0x2c5e9a+'/'+_0x1ec3db)[_0x3d35('0x17')](_0x3037f1);}return null;};}function patchUpdates(_0x3c452a){return function(_0x4ffcf5){try{jsonpatch['apply'](_0x4ffcf5,_0x3c452a,!![]);}catch(_0x3daf7e){return BPromise['reject'](_0x3daf7e);}return _0x4ffcf5['save']();};}function saveUpdates(_0x20e461,_0x10e7b7){return function(_0x3dcdd5){if(_0x3dcdd5){return _0x3dcdd5[_0x3d35('0x1d')](_0x20e461)['then'](function(_0x2d7bda){return _0x2d7bda;});}return null;};}function removeEntity(_0x51445b,_0x409c17){return function(_0x34f516){if(_0x34f516){return _0x34f516[_0x3d35('0x1e')]()[_0x3d35('0x1f')](function(){var _0x23c1c8=_0x34f516[_0x3d35('0x20')]({'plain':!![]});var _0x13eb1d=_0x3d35('0x21');return db[_0x3d35('0x22')]['destroy']({'where':{'type':_0x13eb1d,'resourceId':_0x23c1c8['id']}})['then'](function(){return _0x34f516;});})['then'](function(){_0x51445b[_0x3d35('0x23')](0xcc)[_0x3d35('0x16')]();});}};}function handleEntityNotFound(_0xa9d142,_0x5ee1f3){return function(_0x2c7ca4){if(!_0x2c7ca4){_0xa9d142['sendStatus'](0x194);}return _0x2c7ca4;};}function handleError(_0x4b8fcb,_0x5323b8){_0x5323b8=_0x5323b8||0x1f4;return function(_0x5eacc0){logger['error'](_0x5eacc0[_0x3d35('0x24')]);if(_0x5eacc0[_0x3d35('0x25')]){delete _0x5eacc0['name'];}_0x4b8fcb['status'](_0x5323b8)['send'](_0x5eacc0);};}exports[_0x3d35('0x26')]=function(_0x190799,_0x381cec){var _0x46a63d={},_0x23c62a={},_0x5c6cfe={'count':0x0,'rows':[]};var _0x9b3b9f=db[_0x3d35('0x27')][_0x3d35('0x28')];_0x23c62a[_0x3d35('0x29')]=_[_0x3d35('0x2a')](_0x9b3b9f);_0x23c62a[_0x3d35('0x2b')]=_[_0x3d35('0x2a')](_0x190799['query']);_0x23c62a['filters']=_[_0x3d35('0x2c')](_0x23c62a[_0x3d35('0x29')],_0x23c62a[_0x3d35('0x2b')]);_0x46a63d[_0x3d35('0x2d')]=_[_0x3d35('0x2c')](_0x23c62a[_0x3d35('0x29')],qs[_0x3d35('0x2e')](_0x190799[_0x3d35('0x2b')][_0x3d35('0x2e')]));_0x46a63d['attributes']=_0x46a63d[_0x3d35('0x2d')]['length']?_0x46a63d['attributes']:_0x23c62a['model'];if(!_0x190799[_0x3d35('0x2b')][_0x3d35('0x2f')](_0x3d35('0x30'))){_0x46a63d[_0x3d35('0x1a')]=qs[_0x3d35('0x1a')](_0x190799['query'][_0x3d35('0x1a')]);_0x46a63d['offset']=qs[_0x3d35('0x19')](_0x190799[_0x3d35('0x2b')][_0x3d35('0x19')]);}_0x46a63d[_0x3d35('0x31')]=qs[_0x3d35('0x32')](_0x190799[_0x3d35('0x2b')][_0x3d35('0x32')]);_0x46a63d[_0x3d35('0x33')]=qs[_0x3d35('0x34')](_[_0x3d35('0x35')](_0x190799[_0x3d35('0x2b')],_0x23c62a[_0x3d35('0x34')]));if(_0x190799[_0x3d35('0x2b')]['filter']){_0x46a63d[_0x3d35('0x33')]=_['merge'](_0x46a63d[_0x3d35('0x33')],{'$or':_[_0x3d35('0x36')](_0x9b3b9f,function(_0x529bf1){if(_0x529bf1[_0x3d35('0x37')]['key']!==_0x3d35('0x38')){var _0x48c7dd={};_0x48c7dd[_0x529bf1[_0x3d35('0x39')]]={'$like':'%'+_0x190799[_0x3d35('0x2b')]['filter']+'%'};return _0x48c7dd;}})});}_0x46a63d=_['merge']({},_0x46a63d,_0x190799[_0x3d35('0x3a')]);var _0x1376f4={'where':_0x46a63d[_0x3d35('0x33')]};return db['Tag'][_0x3d35('0x18')](_0x1376f4)[_0x3d35('0x1f')](function(_0x4c89ad){_0x5c6cfe[_0x3d35('0x18')]=_0x4c89ad;if(_0x190799[_0x3d35('0x2b')][_0x3d35('0x3b')]){_0x46a63d['include']=[{'all':!![]}];}return db[_0x3d35('0x27')][_0x3d35('0x3c')](_0x46a63d);})[_0x3d35('0x1f')](function(_0x2995ed){_0x5c6cfe[_0x3d35('0x3d')]=_0x2995ed;return _0x5c6cfe;})[_0x3d35('0x1f')](respondWithFilteredResult(_0x381cec,_0x46a63d))['catch'](handleError(_0x381cec,null));};exports[_0x3d35('0x3e')]=function(_0x5cd93e,_0x3afc63){var _0x1511c7={'raw':!![],'where':{'id':_0x5cd93e[_0x3d35('0x3f')]['id']}},_0x20c32c={};_0x20c32c[_0x3d35('0x29')]=_[_0x3d35('0x2a')](db[_0x3d35('0x27')][_0x3d35('0x28')]);_0x20c32c[_0x3d35('0x2b')]=_[_0x3d35('0x2a')](_0x5cd93e[_0x3d35('0x2b')]);_0x20c32c[_0x3d35('0x34')]=_[_0x3d35('0x2c')](_0x20c32c[_0x3d35('0x29')],_0x20c32c['query']);_0x1511c7[_0x3d35('0x2d')]=_[_0x3d35('0x2c')](_0x20c32c[_0x3d35('0x29')],qs['fields'](_0x5cd93e[_0x3d35('0x2b')]['fields']));_0x1511c7[_0x3d35('0x2d')]=_0x1511c7[_0x3d35('0x2d')]['length']?_0x1511c7[_0x3d35('0x2d')]:_0x20c32c[_0x3d35('0x29')];if(_0x5cd93e['query'][_0x3d35('0x3b')]){_0x1511c7[_0x3d35('0x40')]=[{'all':!![]}];}_0x1511c7=_[_0x3d35('0x41')]({},_0x1511c7,_0x5cd93e['options']);return db[_0x3d35('0x27')][_0x3d35('0x42')](_0x1511c7)[_0x3d35('0x1f')](handleEntityNotFound(_0x3afc63,null))[_0x3d35('0x1f')](respondWithResult(_0x3afc63,null))[_0x3d35('0x43')](handleError(_0x3afc63,null));};exports[_0x3d35('0x44')]=function(_0x3ad6b4,_0x59520b){return db[_0x3d35('0x27')]['create'](_0x3ad6b4[_0x3d35('0x45')],{})['then'](function(_0x3ea610){var _0x2aba01=_0x3ad6b4[_0x3d35('0x46')][_0x3d35('0x20')]({'plain':!![]});if(!_0x2aba01)throw new Error(_0x3d35('0x47'));if(_0x2aba01[_0x3d35('0x48')]===_0x3d35('0x46')){var _0x25fa20=_0x3ea610[_0x3d35('0x20')]({'plain':!![]});var _0x2b3156=_0x3d35('0x21');return db[_0x3d35('0x49')][_0x3d35('0x42')]({'where':{'name':_0x2b3156,'userProfileId':_0x2aba01['userProfileId']},'raw':!![]})[_0x3d35('0x1f')](function(_0x571410){if(_0x571410&&_0x571410[_0x3d35('0x4a')]===0x0){return db[_0x3d35('0x22')][_0x3d35('0x44')]({'name':_0x25fa20['name'],'resourceId':_0x25fa20['id'],'type':_0x571410[_0x3d35('0x25')],'sectionId':_0x571410['id']},{})[_0x3d35('0x1f')](function(){return _0x3ea610;});}else{return _0x3ea610;}})['catch'](function(_0x38a84b){logger[_0x3d35('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38a84b);throw _0x38a84b;});}return _0x3ea610;})['then'](respondWithResult(_0x59520b,0xc9))[_0x3d35('0x43')](handleError(_0x59520b,null));};exports['update']=function(_0x1c2d98,_0x5486a5){if(_0x1c2d98[_0x3d35('0x45')]['id']){delete _0x1c2d98[_0x3d35('0x45')]['id'];}return db[_0x3d35('0x27')]['find']({'where':{'id':_0x1c2d98[_0x3d35('0x3f')]['id']}})[_0x3d35('0x1f')](handleEntityNotFound(_0x5486a5,null))[_0x3d35('0x1f')](saveUpdates(_0x1c2d98['body'],null))[_0x3d35('0x1f')](respondWithResult(_0x5486a5,null))[_0x3d35('0x43')](handleError(_0x5486a5,null));};exports[_0x3d35('0x1e')]=function(_0x50875f,_0x2bb40c){return db[_0x3d35('0x27')][_0x3d35('0x42')]({'where':{'id':_0x50875f['params']['id']}})[_0x3d35('0x1f')](handleEntityNotFound(_0x2bb40c,null))['then'](removeEntity(_0x2bb40c,null))[_0x3d35('0x43')](handleError(_0x2bb40c,null));}; \ No newline at end of file +var _0xcb10=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','type','key','VIRTUAL','includeAll','include','findAll','catch','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','index','Tag','rawAttributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcb10,0x104));var _0x0cb1=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xcb10[_0x173441];return _0x2423a8;};'use strict';var pdf=require(_0x0cb1('0x0'));var emlformat=require(_0x0cb1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0cb1('0x2'));var jsonpatch=require(_0x0cb1('0x3'));var rp=require('request-promise');var moment=require(_0x0cb1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0cb1('0x5'));var util=require(_0x0cb1('0x6'));var path=require(_0x0cb1('0x7'));var sox=require(_0x0cb1('0x8'));var csv=require(_0x0cb1('0x9'));var ejs=require(_0x0cb1('0xa'));var fs=require('fs');var _=require(_0x0cb1('0xb'));var squel=require(_0x0cb1('0xc'));var crypto=require('crypto');var jsforce=require(_0x0cb1('0xd'));var deskjs=require(_0x0cb1('0xe'));var toCsv=require(_0x0cb1('0x9'));var querystring=require(_0x0cb1('0xf'));var Papa=require(_0x0cb1('0x10'));var Redis=require(_0x0cb1('0x11'));var authService=require(_0x0cb1('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0cb1('0x13'));var utils=require(_0x0cb1('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x597a57,_0x3201b5){_0x3201b5=_0x3201b5||0xcc;return function(_0x5ab983){if(_0x5ab983){return _0x597a57[_0x0cb1('0x15')](_0x3201b5);}return _0x597a57[_0x0cb1('0x16')](_0x3201b5)[_0x0cb1('0x17')]();};}function respondWithResult(_0xdc3a39,_0x831933){_0x831933=_0x831933||0xc8;return function(_0x29ff45){if(_0x29ff45){return _0xdc3a39['status'](_0x831933)[_0x0cb1('0x18')](_0x29ff45);}};}function respondWithFilteredResult(_0x36181d,_0x49e6c7){return function(_0x1053f6){if(_0x1053f6){var _0x4eb8bc=_0x1053f6[_0x0cb1('0x19')],_0x3e6e6b=_0x49e6c7[_0x0cb1('0x1a')],_0x145cd4=_0x49e6c7[_0x0cb1('0x1a')]+_0x49e6c7[_0x0cb1('0x1b')],_0x50981a;if(_0x145cd4>=_0x4eb8bc){_0x145cd4=_0x4eb8bc;_0x50981a=0xc8;}else{_0x50981a=0xce;}_0x36181d['status'](_0x50981a);return _0x36181d[_0x0cb1('0x1c')](_0x0cb1('0x1d'),_0x3e6e6b+'-'+_0x145cd4+'/'+_0x4eb8bc)[_0x0cb1('0x18')](_0x1053f6);}return null;};}function patchUpdates(_0x5bd690){return function(_0x5a88b7){try{jsonpatch[_0x0cb1('0x1e')](_0x5a88b7,_0x5bd690,!![]);}catch(_0x109db9){return BPromise['reject'](_0x109db9);}return _0x5a88b7[_0x0cb1('0x1f')]();};}function saveUpdates(_0x5b587b,_0x63e5ef){return function(_0x5d77c2){if(_0x5d77c2){return _0x5d77c2[_0x0cb1('0x20')](_0x5b587b)[_0x0cb1('0x21')](function(_0x39c2bb){return _0x39c2bb;});}return null;};}function removeEntity(_0x49d570,_0x2ec66f){return function(_0x1f4702){if(_0x1f4702){return _0x1f4702[_0x0cb1('0x22')]()[_0x0cb1('0x21')](function(){var _0x5b16e5=_0x1f4702[_0x0cb1('0x23')]({'plain':!![]});var _0x5215d7=_0x0cb1('0x24');return db[_0x0cb1('0x25')][_0x0cb1('0x22')]({'where':{'type':_0x5215d7,'resourceId':_0x5b16e5['id']}})[_0x0cb1('0x21')](function(){return _0x1f4702;});})[_0x0cb1('0x21')](function(){_0x49d570[_0x0cb1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb9ac,_0x34289b){return function(_0x2cde9c){if(!_0x2cde9c){_0x2bb9ac[_0x0cb1('0x15')](0x194);}return _0x2cde9c;};}function handleError(_0x3db759,_0x421183){_0x421183=_0x421183||0x1f4;return function(_0x4a45b5){logger[_0x0cb1('0x26')](_0x4a45b5[_0x0cb1('0x27')]);if(_0x4a45b5[_0x0cb1('0x28')]){delete _0x4a45b5['name'];}_0x3db759[_0x0cb1('0x16')](_0x421183)['send'](_0x4a45b5);};}exports[_0x0cb1('0x29')]=function(_0x2fe61a,_0x2eea1a){var _0x46e244={},_0x3c6d11={},_0x4c61dd={'count':0x0,'rows':[]};var _0x38b859=db[_0x0cb1('0x2a')][_0x0cb1('0x2b')];_0x3c6d11[_0x0cb1('0x2c')]=_['keys'](_0x38b859);_0x3c6d11['query']=_[_0x0cb1('0x2d')](_0x2fe61a[_0x0cb1('0x2e')]);_0x3c6d11[_0x0cb1('0x2f')]=_[_0x0cb1('0x30')](_0x3c6d11[_0x0cb1('0x2c')],_0x3c6d11[_0x0cb1('0x2e')]);_0x46e244[_0x0cb1('0x31')]=_[_0x0cb1('0x30')](_0x3c6d11[_0x0cb1('0x2c')],qs[_0x0cb1('0x32')](_0x2fe61a['query'][_0x0cb1('0x32')]));_0x46e244['attributes']=_0x46e244['attributes'][_0x0cb1('0x33')]?_0x46e244[_0x0cb1('0x31')]:_0x3c6d11[_0x0cb1('0x2c')];if(!_0x2fe61a[_0x0cb1('0x2e')][_0x0cb1('0x34')](_0x0cb1('0x35'))){_0x46e244['limit']=qs[_0x0cb1('0x1b')](_0x2fe61a[_0x0cb1('0x2e')][_0x0cb1('0x1b')]);_0x46e244['offset']=qs[_0x0cb1('0x1a')](_0x2fe61a[_0x0cb1('0x2e')][_0x0cb1('0x1a')]);}_0x46e244[_0x0cb1('0x36')]=qs[_0x0cb1('0x37')](_0x2fe61a['query'][_0x0cb1('0x37')]);_0x46e244[_0x0cb1('0x38')]=qs['filters'](_['pick'](_0x2fe61a[_0x0cb1('0x2e')],_0x3c6d11[_0x0cb1('0x2f')]));if(_0x2fe61a['query']['filter']){_0x46e244['where']=_[_0x0cb1('0x39')](_0x46e244[_0x0cb1('0x38')],{'$or':_[_0x0cb1('0x3a')](_0x38b859,function(_0x368fff){if(_0x368fff[_0x0cb1('0x3b')][_0x0cb1('0x3c')]!==_0x0cb1('0x3d')){var _0x32b34c={};_0x32b34c[_0x368fff['field']]={'$like':'%'+_0x2fe61a['query']['filter']+'%'};return _0x32b34c;}})});}_0x46e244=_[_0x0cb1('0x39')]({},_0x46e244,_0x2fe61a['options']);var _0x3e2387={'where':_0x46e244[_0x0cb1('0x38')]};return db[_0x0cb1('0x2a')][_0x0cb1('0x19')](_0x3e2387)[_0x0cb1('0x21')](function(_0x3f4f25){_0x4c61dd['count']=_0x3f4f25;if(_0x2fe61a['query'][_0x0cb1('0x3e')]){_0x46e244[_0x0cb1('0x3f')]=[{'all':!![]}];}return db[_0x0cb1('0x2a')][_0x0cb1('0x40')](_0x46e244);})[_0x0cb1('0x21')](function(_0x5e5a8d){_0x4c61dd['rows']=_0x5e5a8d;return _0x4c61dd;})[_0x0cb1('0x21')](respondWithFilteredResult(_0x2eea1a,_0x46e244))[_0x0cb1('0x41')](handleError(_0x2eea1a,null));};exports['show']=function(_0x1516df,_0xe490c8){var _0xd4a85d={'raw':!![],'where':{'id':_0x1516df['params']['id']}},_0x295648={};_0x295648['model']=_[_0x0cb1('0x2d')](db[_0x0cb1('0x2a')][_0x0cb1('0x2b')]);_0x295648[_0x0cb1('0x2e')]=_[_0x0cb1('0x2d')](_0x1516df[_0x0cb1('0x2e')]);_0x295648[_0x0cb1('0x2f')]=_[_0x0cb1('0x30')](_0x295648[_0x0cb1('0x2c')],_0x295648[_0x0cb1('0x2e')]);_0xd4a85d['attributes']=_['intersection'](_0x295648['model'],qs[_0x0cb1('0x32')](_0x1516df[_0x0cb1('0x2e')][_0x0cb1('0x32')]));_0xd4a85d['attributes']=_0xd4a85d['attributes'][_0x0cb1('0x33')]?_0xd4a85d[_0x0cb1('0x31')]:_0x295648[_0x0cb1('0x2c')];if(_0x1516df[_0x0cb1('0x2e')][_0x0cb1('0x3e')]){_0xd4a85d[_0x0cb1('0x3f')]=[{'all':!![]}];}_0xd4a85d=_[_0x0cb1('0x39')]({},_0xd4a85d,_0x1516df[_0x0cb1('0x42')]);return db['Tag'][_0x0cb1('0x43')](_0xd4a85d)[_0x0cb1('0x21')](handleEntityNotFound(_0xe490c8,null))[_0x0cb1('0x21')](respondWithResult(_0xe490c8,null))[_0x0cb1('0x41')](handleError(_0xe490c8,null));};exports[_0x0cb1('0x44')]=function(_0x197601,_0x59f0df){return db[_0x0cb1('0x2a')][_0x0cb1('0x44')](_0x197601['body'],{})[_0x0cb1('0x21')](function(_0x344bfd){var _0x2ee5bb=_0x197601[_0x0cb1('0x45')]['get']({'plain':!![]});if(!_0x2ee5bb)throw new Error(_0x0cb1('0x46'));if(_0x2ee5bb['role']===_0x0cb1('0x45')){var _0x541fc0=_0x344bfd[_0x0cb1('0x23')]({'plain':!![]});var _0x59021f=_0x0cb1('0x24');return db['UserProfileSection'][_0x0cb1('0x43')]({'where':{'name':_0x59021f,'userProfileId':_0x2ee5bb[_0x0cb1('0x47')]},'raw':!![]})[_0x0cb1('0x21')](function(_0x30aafe){if(_0x30aafe&&_0x30aafe[_0x0cb1('0x48')]===0x0){return db[_0x0cb1('0x25')][_0x0cb1('0x44')]({'name':_0x541fc0['name'],'resourceId':_0x541fc0['id'],'type':_0x30aafe['name'],'sectionId':_0x30aafe['id']},{})[_0x0cb1('0x21')](function(){return _0x344bfd;});}else{return _0x344bfd;}})[_0x0cb1('0x41')](function(_0x1e620d){logger[_0x0cb1('0x26')](_0x0cb1('0x49'),_0x1e620d);throw _0x1e620d;});}return _0x344bfd;})[_0x0cb1('0x21')](respondWithResult(_0x59f0df,0xc9))[_0x0cb1('0x41')](handleError(_0x59f0df,null));};exports['update']=function(_0x4f0d23,_0x337d6d){if(_0x4f0d23[_0x0cb1('0x4a')]['id']){delete _0x4f0d23[_0x0cb1('0x4a')]['id'];}return db[_0x0cb1('0x2a')]['find']({'where':{'id':_0x4f0d23[_0x0cb1('0x4b')]['id']}})[_0x0cb1('0x21')](handleEntityNotFound(_0x337d6d,null))[_0x0cb1('0x21')](saveUpdates(_0x4f0d23[_0x0cb1('0x4a')],null))[_0x0cb1('0x21')](respondWithResult(_0x337d6d,null))[_0x0cb1('0x41')](handleError(_0x337d6d,null));};exports[_0x0cb1('0x22')]=function(_0x3f7eed,_0x2559b0){return db[_0x0cb1('0x2a')][_0x0cb1('0x43')]({'where':{'id':_0x3f7eed['params']['id']}})[_0x0cb1('0x21')](handleEntityNotFound(_0x2559b0,null))[_0x0cb1('0x21')](removeEntity(_0x2559b0,null))[_0x0cb1('0x41')](handleError(_0x2559b0,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 5e18a75..5e15efe 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 _0x347a=['tools_tags','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x347a,0x153));var _0xa347=function(_0x141310,_0x4fb243){_0x141310=_0x141310-0x0;var _0x4680ae=_0x347a[_0x141310];return _0x4680ae;};'use strict';var _=require(_0xa347('0x0'));var util=require(_0xa347('0x1'));var logger=require('../../config/logger')(_0xa347('0x2'));var moment=require('moment');var BPromise=require(_0xa347('0x3'));var rp=require(_0xa347('0x4'));var fs=require('fs');var path=require(_0xa347('0x5'));var rimraf=require(_0xa347('0x6'));var config=require(_0xa347('0x7'));var attributes=require(_0xa347('0x8'));module[_0xa347('0x9')]=function(_0x24bea9,_0x19ac84){return _0x24bea9[_0xa347('0xa')](_0xa347('0xb'),attributes,{'tableName':_0xa347('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b63=['rimraf','./tag.attributes','define','tools_tags','lodash','util','bluebird','path'];(function(_0x281492,_0x2f8eab){var _0x142f9f=function(_0x5c5414){while(--_0x5c5414){_0x281492['push'](_0x281492['shift']());}};_0x142f9f(++_0x2f8eab);}(_0x2b63,0x1d4));var _0x32b6=function(_0x5ea6e3,_0x80a96){_0x5ea6e3=_0x5ea6e3-0x0;var _0x1b005a=_0x2b63[_0x5ea6e3];return _0x1b005a;};'use strict';var _=require(_0x32b6('0x0'));var util=require(_0x32b6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x32b6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32b6('0x3'));var rimraf=require(_0x32b6('0x4'));var config=require('../../config/environment');var attributes=require(_0x32b6('0x5'));module['exports']=function(_0x155610,_0x163005){return _0x155610[_0x32b6('0x6')]('Tag',attributes,{'tableName':_0x32b6('0x7'),'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 7f9f571..c5fac91 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 _0x1339=['info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x14ecc3,_0x2e4c99){var _0x2787d3=function(_0x40e930){while(--_0x40e930){_0x14ecc3['push'](_0x14ecc3['shift']());}};_0x2787d3(++_0x2e4c99);}(_0x1339,0x1ed));var _0x9133=function(_0x1b03b5,_0x4b6c4f){_0x1b03b5=_0x1b03b5-0x0;var _0x220c26=_0x1339[_0x1b03b5];return _0x220c26;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('Tag,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});} \ No newline at end of file +var _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0xe5b5[_0x47623f];return _0x282ce8;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('Tag,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('Tag,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('Tag,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d598114..b04045a 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 _0x2e73=['destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put','update','delete'];(function(_0x48271f,_0xc4f6d3){var _0x13eb5c=function(_0x1a4acd){while(--_0x1a4acd){_0x48271f['push'](_0x48271f['shift']());}};_0x13eb5c(++_0xc4f6d3);}(_0x2e73,0xdc));var _0x32e7=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x2e73[_0x386525];return _0x14d015;};'use strict';var multer=require(_0x32e7('0x0'));var util=require(_0x32e7('0x1'));var path=require(_0x32e7('0x2'));var timeout=require(_0x32e7('0x3'));var express=require('express');var router=express[_0x32e7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x32e7('0x5'));var config=require(_0x32e7('0x6'));var controller=require(_0x32e7('0x7'));router[_0x32e7('0x8')]('/',auth[_0x32e7('0x9')](),controller[_0x32e7('0xa')]);router[_0x32e7('0x8')](_0x32e7('0xb'),auth['isAuthenticated'](),controller[_0x32e7('0xc')]);router[_0x32e7('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x32e7('0xd')]);router[_0x32e7('0x8')](_0x32e7('0xe'),auth[_0x32e7('0x9')](),controller[_0x32e7('0xf')]);router[_0x32e7('0x10')]('/',auth['isAuthenticated'](),controller[_0x32e7('0x11')]);router[_0x32e7('0x10')]('/:id/queues',auth[_0x32e7('0x9')](),controller[_0x32e7('0x12')]);router[_0x32e7('0x10')](_0x32e7('0xe'),auth[_0x32e7('0x9')](),controller[_0x32e7('0x13')]);router[_0x32e7('0x14')](_0x32e7('0xb'),auth['isAuthenticated'](),controller[_0x32e7('0x15')]);router[_0x32e7('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x32e7('0x17')]);router[_0x32e7('0x16')]('/:id/queues',auth[_0x32e7('0x9')](),controller[_0x32e7('0x18')]);router[_0x32e7('0x16')](_0x32e7('0xe'),auth[_0x32e7('0x9')](),controller[_0x32e7('0x19')]);module[_0x32e7('0x1a')]=router; \ No newline at end of file +var _0xac9e=['/:id/users','getAgents','post','create','addQueues','addAgents','put','update','destroy','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xac9e,0x177));var _0xeac9=function(_0x47d9d1,_0x3fa2ee){_0x47d9d1=_0x47d9d1-0x0;var _0x1462ba=_0xac9e[_0x47d9d1];return _0x1462ba;};'use strict';var multer=require(_0xeac9('0x0'));var util=require('util');var path=require(_0xeac9('0x1'));var timeout=require('connect-timeout');var express=require(_0xeac9('0x2'));var router=express[_0xeac9('0x3')]();var auth=require(_0xeac9('0x4'));var interaction=require(_0xeac9('0x5'));var config=require(_0xeac9('0x6'));var controller=require(_0xeac9('0x7'));router[_0xeac9('0x8')]('/',auth[_0xeac9('0x9')](),controller[_0xeac9('0xa')]);router['get'](_0xeac9('0xb'),auth['isAuthenticated'](),controller[_0xeac9('0xc')]);router[_0xeac9('0x8')](_0xeac9('0xd'),auth[_0xeac9('0x9')](),controller[_0xeac9('0xe')]);router[_0xeac9('0x8')](_0xeac9('0xf'),auth[_0xeac9('0x9')](),controller[_0xeac9('0x10')]);router[_0xeac9('0x11')]('/',auth['isAuthenticated'](),controller[_0xeac9('0x12')]);router[_0xeac9('0x11')](_0xeac9('0xd'),auth[_0xeac9('0x9')](),controller[_0xeac9('0x13')]);router['post'](_0xeac9('0xf'),auth[_0xeac9('0x9')](),controller[_0xeac9('0x14')]);router[_0xeac9('0x15')](_0xeac9('0xb'),auth[_0xeac9('0x9')](),controller[_0xeac9('0x16')]);router['delete'](_0xeac9('0xb'),auth['isAuthenticated'](),controller[_0xeac9('0x17')]);router['delete'](_0xeac9('0xd'),auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0xeac9('0xf'),auth['isAuthenticated'](),controller[_0xeac9('0x18')]);module[_0xeac9('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 5971a71..fb5ec63 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 _0x0e91=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e91,0xa4));var _0x10e9=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x0e91[_0x11946c];return _0x383935;};'use strict';var Sequelize=require(_0x10e9('0x0'));module[_0x10e9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x10e9('0x2')]}}; \ No newline at end of file +var _0x972b=['sequelize','STRING','name'];(function(_0x5d2587,_0x39738e){var _0x9f3b0e=function(_0x430918){while(--_0x430918){_0x5d2587['push'](_0x5d2587['shift']());}};_0x9f3b0e(++_0x39738e);}(_0x972b,0x153));var _0xb972=function(_0x4a5db4,_0x33eefe){_0x4a5db4=_0x4a5db4-0x0;var _0x1c0b1f=_0x972b[_0x4a5db4];return _0x1c0b1f;};'use strict';var Sequelize=require(_0xb972('0x0'));module['exports']={'name':{'type':Sequelize[_0xb972('0x1')],'allowNull':![],'unique':_0xb972('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 45a0124..31331d6 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 _0x54ef=['Mail','Sms','Openchannel','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','format','spread','emit','userTeam:save','removeAgents','voice','chat','mail','fax','openchannel','userTeam:remove','getAgents','map','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./team.socket','register','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','end','error','stack','name','Team','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','catch','show','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','getQueues','findOne','channel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','Queues','isValidChannel','add','ids','removeQueues','capitalize','addAgents','Voice','Chat'];(function(_0x46d887,_0x805012){var _0x51e4d0=function(_0x520811){while(--_0x520811){_0x46d887['push'](_0x46d887['shift']());}};_0x51e4d0(++_0x805012);}(_0x54ef,0x112));var _0xf54e=function(_0x1b0d06,_0x3f50e7){_0x1b0d06=_0x1b0d06-0x0;var _0x30d627=_0x54ef[_0x1b0d06];return _0x30d627;};'use strict';var pdf=require(_0xf54e('0x0'));var emlformat=require(_0xf54e('0x1'));var rimraf=require(_0xf54e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf54e('0x3'));var rp=require(_0xf54e('0x4'));var moment=require(_0xf54e('0x5'));var BPromise=require(_0xf54e('0x6'));var Mustache=require(_0xf54e('0x7'));var util=require(_0xf54e('0x8'));var path=require(_0xf54e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf54e('0xa'));var fs=require('fs');var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var hardwareService=require(_0xf54e('0x13'));var logger=require('../../config/logger')(_0xf54e('0x14'));var utils=require(_0xf54e('0x15'));var config=require(_0xf54e('0x16'));var db=require(_0xf54e('0x17'))['db'];config['redis']=_[_0xf54e('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf54e('0x19'))(new Redis(config[_0xf54e('0x1a')]));require(_0xf54e('0x1b'))[_0xf54e('0x1c')](socket);function respondWithStatusCode(_0x5644aa,_0x331732){_0x331732=_0x331732||0xcc;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1d')](_0x331732);}return _0x5644aa[_0xf54e('0x1e')](_0x331732)['end']();};}function respondWithResult(_0x2366ee,_0x389abc){_0x389abc=_0x389abc||0xc8;return function(_0x3eb415){if(_0x3eb415){return _0x2366ee['status'](_0x389abc)['json'](_0x3eb415);}};}function respondWithFilteredResult(_0xd87020,_0x41fb35){return function(_0x1c02e7){if(_0x1c02e7){var _0x9647f=_0x1c02e7[_0xf54e('0x1f')],_0x15cc48=_0x41fb35[_0xf54e('0x20')],_0x3e7d96=_0x41fb35[_0xf54e('0x20')]+_0x41fb35[_0xf54e('0x21')],_0x2e27b6;if(_0x3e7d96>=_0x9647f){_0x3e7d96=_0x9647f;_0x2e27b6=0xc8;}else{_0x2e27b6=0xce;}_0xd87020['status'](_0x2e27b6);return _0xd87020['set'](_0xf54e('0x22'),_0x15cc48+'-'+_0x3e7d96+'/'+_0x9647f)['json'](_0x1c02e7);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x23')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x24')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x25')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x26')](_0x388aa0)[_0xf54e('0x27')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x28')]()[_0xf54e('0x27')](function(){var _0x474b61=_0x264a8f[_0xf54e('0x29')]({'plain':!![]});var _0x160160=_0xf54e('0x2a');return db[_0xf54e('0x2b')][_0xf54e('0x28')]({'where':{'type':_0x160160,'resourceId':_0x474b61['id']}})[_0xf54e('0x27')](function(){return _0x264a8f;});})[_0xf54e('0x27')](function(){_0x6f6d29[_0xf54e('0x1e')](0xcc)[_0xf54e('0x2c')]();});}};}function handleEntityNotFound(_0x5390b8,_0xb3706e){return function(_0x4cbf7c){if(!_0x4cbf7c){_0x5390b8[_0xf54e('0x1d')](0x194);}return _0x4cbf7c;};}function handleError(_0x5e63f4,_0x15b888){_0x15b888=_0x15b888||0x1f4;return function(_0x269f47){logger[_0xf54e('0x2d')](_0x269f47[_0xf54e('0x2e')]);if(_0x269f47[_0xf54e('0x2f')]){delete _0x269f47[_0xf54e('0x2f')];}_0x5e63f4[_0xf54e('0x1e')](_0x15b888)['send'](_0x269f47);};}exports['index']=function(_0x2f96b1,_0x258d29){var _0x2ec92e={},_0x16d00f={},_0xb2d4c4={'count':0x0,'rows':[]};var _0x133cd7=db[_0xf54e('0x30')][_0xf54e('0x31')];_0x16d00f[_0xf54e('0x32')]=_[_0xf54e('0x33')](_0x133cd7);_0x16d00f['query']=_['keys'](_0x2f96b1[_0xf54e('0x34')]);_0x16d00f[_0xf54e('0x35')]=_['intersection'](_0x16d00f[_0xf54e('0x32')],_0x16d00f[_0xf54e('0x34')]);_0x2ec92e[_0xf54e('0x36')]=_[_0xf54e('0x37')](_0x16d00f['model'],qs['fields'](_0x2f96b1['query'][_0xf54e('0x38')]));_0x2ec92e[_0xf54e('0x36')]=_0x2ec92e[_0xf54e('0x36')][_0xf54e('0x39')]?_0x2ec92e[_0xf54e('0x36')]:_0x16d00f[_0xf54e('0x32')];if(!_0x2f96b1['query']['hasOwnProperty']('nolimit')){_0x2ec92e[_0xf54e('0x21')]=qs[_0xf54e('0x21')](_0x2f96b1['query']['limit']);_0x2ec92e[_0xf54e('0x20')]=qs[_0xf54e('0x20')](_0x2f96b1[_0xf54e('0x34')]['offset']);}_0x2ec92e[_0xf54e('0x3a')]=qs[_0xf54e('0x3b')](_0x2f96b1['query'][_0xf54e('0x3b')]);_0x2ec92e[_0xf54e('0x3c')]=qs[_0xf54e('0x35')](_[_0xf54e('0x3d')](_0x2f96b1[_0xf54e('0x34')],_0x16d00f[_0xf54e('0x35')]));if(_0x2f96b1['query']['filter']){_0x2ec92e[_0xf54e('0x3c')]=_[_0xf54e('0x3e')](_0x2ec92e[_0xf54e('0x3c')],{'$or':_['map'](_0x133cd7,function(_0x4533a2){if(_0x4533a2[_0xf54e('0x3f')][_0xf54e('0x40')]!==_0xf54e('0x41')){var _0x361e4c={};_0x361e4c[_0x4533a2[_0xf54e('0x42')]]={'$like':'%'+_0x2f96b1[_0xf54e('0x34')][_0xf54e('0x43')]+'%'};return _0x361e4c;}})});}_0x2ec92e=_[_0xf54e('0x3e')]({},_0x2ec92e,_0x2f96b1[_0xf54e('0x44')]);var _0x1c1f0d={'where':_0x2ec92e[_0xf54e('0x3c')]};return db[_0xf54e('0x30')][_0xf54e('0x1f')](_0x1c1f0d)[_0xf54e('0x27')](function(_0x5085c1){_0xb2d4c4['count']=_0x5085c1;if(_0x2f96b1['query'][_0xf54e('0x45')]){_0x2ec92e[_0xf54e('0x46')]=[{'all':!![]}];}return db['Team'][_0xf54e('0x47')](_0x2ec92e);})[_0xf54e('0x27')](function(_0x381c03){_0xb2d4c4['rows']=_0x381c03;return _0xb2d4c4;})[_0xf54e('0x27')](respondWithFilteredResult(_0x258d29,_0x2ec92e))[_0xf54e('0x48')](handleError(_0x258d29,null));};exports[_0xf54e('0x49')]=function(_0x794be7,_0x4b1931){var _0x143a39={'raw':![],'where':{'id':_0x794be7[_0xf54e('0x4a')]['id']}},_0x14ce90={};_0x14ce90[_0xf54e('0x32')]=_['keys'](db[_0xf54e('0x30')][_0xf54e('0x31')]);_0x14ce90[_0xf54e('0x34')]=_[_0xf54e('0x33')](_0x794be7[_0xf54e('0x34')]);_0x14ce90[_0xf54e('0x35')]=_['intersection'](_0x14ce90[_0xf54e('0x32')],_0x14ce90['query']);_0x143a39[_0xf54e('0x36')]=_['intersection'](_0x14ce90[_0xf54e('0x32')],qs[_0xf54e('0x38')](_0x794be7[_0xf54e('0x34')]['fields']));_0x143a39[_0xf54e('0x36')]=_0x143a39[_0xf54e('0x36')][_0xf54e('0x39')]?_0x143a39[_0xf54e('0x36')]:_0x14ce90[_0xf54e('0x32')];if(_0x794be7['query'][_0xf54e('0x45')]){_0x143a39[_0xf54e('0x46')]=[{'all':!![]}];}_0x143a39=_[_0xf54e('0x3e')]({},_0x143a39,_0x794be7[_0xf54e('0x44')]);return db['Team'][_0xf54e('0x4b')](_0x143a39)[_0xf54e('0x27')](handleEntityNotFound(_0x4b1931,null))['then'](respondWithResult(_0x4b1931,null))[_0xf54e('0x48')](handleError(_0x4b1931,null));};exports[_0xf54e('0x4c')]=function(_0x3d24c7,_0xca0141){return db['Team'][_0xf54e('0x4c')](_0x3d24c7[_0xf54e('0x4d')],{})[_0xf54e('0x27')](function(_0xb4654f){var _0x346fc9=_0x3d24c7[_0xf54e('0x4e')][_0xf54e('0x29')]({'plain':!![]});if(!_0x346fc9)throw new Error(_0xf54e('0x4f'));if(_0x346fc9[_0xf54e('0x50')]===_0xf54e('0x4e')){var _0xaf9bf0=_0xb4654f[_0xf54e('0x29')]({'plain':!![]});var _0x2deb0c=_0xf54e('0x2a');return db[_0xf54e('0x51')][_0xf54e('0x4b')]({'where':{'name':_0x2deb0c,'userProfileId':_0x346fc9[_0xf54e('0x52')]},'raw':!![]})[_0xf54e('0x27')](function(_0x21fd80){if(_0x21fd80&&_0x21fd80[_0xf54e('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0xaf9bf0[_0xf54e('0x2f')],'resourceId':_0xaf9bf0['id'],'type':_0x21fd80[_0xf54e('0x2f')],'sectionId':_0x21fd80['id']},{})[_0xf54e('0x27')](function(){return _0xb4654f;});}else{return _0xb4654f;}})[_0xf54e('0x48')](function(_0xba297c){logger[_0xf54e('0x2d')](_0xf54e('0x54'),_0xba297c);throw _0xba297c;});}return _0xb4654f;})[_0xf54e('0x27')](respondWithResult(_0xca0141,0xc9))[_0xf54e('0x48')](handleError(_0xca0141,null));};exports[_0xf54e('0x26')]=function(_0x1df308,_0x59c313){if(_0x1df308[_0xf54e('0x4d')]['id']){delete _0x1df308[_0xf54e('0x4d')]['id'];}return db[_0xf54e('0x30')][_0xf54e('0x4b')]({'where':{'id':_0x1df308[_0xf54e('0x4a')]['id']}})[_0xf54e('0x27')](handleEntityNotFound(_0x59c313,null))[_0xf54e('0x27')](saveUpdates(_0x1df308['body'],null))[_0xf54e('0x27')](respondWithResult(_0x59c313,null))[_0xf54e('0x48')](handleError(_0x59c313,null));};exports[_0xf54e('0x28')]=function(_0x48a5c8,_0x3ce832){return db['Team'][_0xf54e('0x4b')]({'where':{'id':_0x48a5c8[_0xf54e('0x4a')]['id']}})[_0xf54e('0x27')](handleEntityNotFound(_0x3ce832,null))['then'](removeEntity(_0x3ce832,null))[_0xf54e('0x48')](handleError(_0x3ce832,null));};exports[_0xf54e('0x55')]=function(_0x2096e5,_0x4e5059,_0x3744a4){return db[_0xf54e('0x30')][_0xf54e('0x56')]({'where':{'id':_0x2096e5['params']['id']}})['then'](handleEntityNotFound(_0x4e5059,null))[_0xf54e('0x27')](function(_0x9ab4c4){if(!_0x2096e5['query'][_0xf54e('0x57')]||!utils['isValidChannel'](_0x2096e5[_0xf54e('0x34')]['channel'])){throw new db[(_0xf54e('0x58'))][(_0xf54e('0x59'))](_0xf54e('0x5a'));}var _0x241198={};var _0x44f1de={};_0x44f1de[_0xf54e('0x32')]=_['keys'](db[_['capitalize'](_0x2096e5[_0xf54e('0x34')][_0xf54e('0x57')]['toLowerCase']())+'Queue'][_0xf54e('0x31')]);_0x44f1de['query']=_[_0xf54e('0x33')](_0x2096e5[_0xf54e('0x34')]);_0x44f1de[_0xf54e('0x35')]=_[_0xf54e('0x37')](_0x44f1de[_0xf54e('0x32')],_0x44f1de[_0xf54e('0x34')]);_0x241198[_0xf54e('0x36')]=_[_0xf54e('0x37')](_0x44f1de[_0xf54e('0x32')],qs[_0xf54e('0x38')](_0x2096e5[_0xf54e('0x34')][_0xf54e('0x38')]));_0x241198[_0xf54e('0x36')]=_0x241198[_0xf54e('0x36')]['length']?_0x241198[_0xf54e('0x36')]:_0x44f1de[_0xf54e('0x32')];_0x241198[_0xf54e('0x21')]=qs[_0xf54e('0x21')](_0x2096e5[_0xf54e('0x34')]['limit']);_0x241198[_0xf54e('0x20')]=qs[_0xf54e('0x20')](_0x2096e5['query']['offset']);_0x241198[_0xf54e('0x3a')]=qs['sort'](_0x2096e5[_0xf54e('0x34')][_0xf54e('0x3b')]);_0x241198[_0xf54e('0x3c')]=qs[_0xf54e('0x35')](_['pick'](_0x2096e5[_0xf54e('0x34')],_0x44f1de['filters']));_0x241198=_[_0xf54e('0x3e')]({},_0x241198,_0x2096e5[_0xf54e('0x44')]);return _0x9ab4c4[_0xf54e('0x29')+_['capitalize'](_0x2096e5[_0xf54e('0x34')]['channel'][_0xf54e('0x5b')]())+_0xf54e('0x5c')](_0x241198);})['then'](respondWithResult(_0x4e5059,null))[_0xf54e('0x48')](handleError(_0x4e5059,null));};exports['addQueues']=function(_0x3aa7e5,_0x2df028,_0x33acd3){return db[_0xf54e('0x30')][_0xf54e('0x56')]({'where':{'id':_0x3aa7e5['params']['id']}})[_0xf54e('0x27')](function(_0x1d18d3){if(_0x1d18d3){if(!_0x3aa7e5['body'][_0xf54e('0x57')]||!utils[_0xf54e('0x5d')](_0x3aa7e5['body'][_0xf54e('0x57')])){throw new db[(_0xf54e('0x58'))][(_0xf54e('0x59'))]('Unknown\x20channel');}return _0x1d18d3[_0xf54e('0x5e')+_['capitalize'](_0x3aa7e5[_0xf54e('0x4d')][_0xf54e('0x57')]['toLowerCase']())+_0xf54e('0x5c')](_0x3aa7e5[_0xf54e('0x4d')][_0xf54e('0x5f')]);}return null;})[_0xf54e('0x27')](handleEntityNotFound(_0x2df028,null))[_0xf54e('0x27')](respondWithStatusCode(_0x2df028,null))[_0xf54e('0x48')](handleError(_0x2df028,null));};exports[_0xf54e('0x60')]=function(_0x44b6e5,_0x451a1c,_0x10f6bb){return db[_0xf54e('0x30')]['findOne']({'where':{'id':_0x44b6e5[_0xf54e('0x4a')]['id']}})[_0xf54e('0x27')](function(_0x200a51){if(_0x200a51){if(!_0x44b6e5['query'][_0xf54e('0x57')]||!utils[_0xf54e('0x5d')](_0x44b6e5[_0xf54e('0x34')][_0xf54e('0x57')])){throw new db[(_0xf54e('0x58'))][(_0xf54e('0x59'))](_0xf54e('0x5a'));}return _0x200a51['remove'+_[_0xf54e('0x61')](_0x44b6e5[_0xf54e('0x34')][_0xf54e('0x57')]['toLowerCase']())+_0xf54e('0x5c')](_0x44b6e5[_0xf54e('0x34')][_0xf54e('0x5f')]);}return null;})[_0xf54e('0x27')](handleEntityNotFound(_0x451a1c,null))['then'](respondWithStatusCode(_0x451a1c,null))['catch'](handleError(_0x451a1c,null));};exports[_0xf54e('0x62')]=function(_0x45c5ff,_0x192d3b,_0x2e35a3){return db[_0xf54e('0x30')][_0xf54e('0x4b')]({'where':{'id':_0x45c5ff[_0xf54e('0x4a')]['id']}})[_0xf54e('0x27')](handleEntityNotFound(_0x192d3b,null))[_0xf54e('0x27')](function(_0x205b47){if(_0x205b47){var _0x4e6f8f=[_0xf54e('0x63'),_0xf54e('0x64'),_0xf54e('0x65'),_0xf54e('0x66'),'Fax',_0xf54e('0x67')];return BPromise[_0xf54e('0x68')](_0x4e6f8f,function(_0x2aab8b){return _0x205b47[_0xf54e('0x29')+_0x2aab8b+'Queues']({'attributes':['id',_0xf54e('0x2f')]})[_0xf54e('0x27')](function(_0x2c5a7a){return BPromise['each'](_0x2c5a7a,function(_0x4a6a8d){return _0x4a6a8d[_0xf54e('0x62')](_0x45c5ff[_0xf54e('0x4d')][_0xf54e('0x5f')])[_0xf54e('0x27')](function(){if(_0x2aab8b===_0xf54e('0x63')){return db[_0xf54e('0x69')][_0xf54e('0x47')]({'where':{'id':_0x45c5ff[_0xf54e('0x4d')][_0xf54e('0x5f')]},'attributes':['id','name',_0xf54e('0x6a'),_0xf54e('0x6b'),_0xf54e('0x6c')],'raw':!![]})[_0xf54e('0x27')](function(_0x395513){return BPromise[_0xf54e('0x68')](_[_0xf54e('0x43')](_0x395513,{'online':0x1}),function(_0x9a8f4f){return db[_0xf54e('0x6d')][_0xf54e('0x6e')]({'membername':_0x9a8f4f[_0xf54e('0x2f')],'UserId':_0x9a8f4f['id'],'queue_name':_0x4a6a8d[_0xf54e('0x2f')],'VoiceQueueId':_0x4a6a8d['id'],'interface':_['isNil'](_0x9a8f4f[_0xf54e('0x6c')])?util[_0xf54e('0x6f')]('SIP/%s',_0x9a8f4f['name']):_0x9a8f4f[_0xf54e('0x6c')],'paused':_0x9a8f4f[_0xf54e('0x6b')]||![],'penalty':0x0});});});}});});})[_0xf54e('0x27')](function(){return _0x205b47;});})[_0xf54e('0x27')](function(){return _0x205b47;});}})[_0xf54e('0x27')](function(_0x3c3a97){if(_0x3c3a97){return _0x3c3a97[_0xf54e('0x62')](_0x45c5ff[_0xf54e('0x4d')][_0xf54e('0x5f')],_['omit'](_0x45c5ff[_0xf54e('0x4d')],[_0xf54e('0x5f'),'id'])||{})[_0xf54e('0x70')](function(_0x5c8b6c){for(var _0x40f135=0x0;_0x40f135<_0x45c5ff['body'][_0xf54e('0x5f')]['length'];_0x40f135+=0x1){socket[_0xf54e('0x71')](_0xf54e('0x72'),{'UserId':_0x45c5ff['body']['ids'][_0x40f135],'TeamId':_0x45c5ff[_0xf54e('0x4a')]['id']});}return _0x5c8b6c;});}})[_0xf54e('0x27')](respondWithResult(_0x192d3b,null))[_0xf54e('0x48')](handleError(_0x192d3b,null));};exports[_0xf54e('0x73')]=function(_0x389f16,_0x486626,_0x5c008e){return db[_0xf54e('0x30')][_0xf54e('0x4b')]({'where':{'id':_0x389f16[_0xf54e('0x4a')]['id']}})[_0xf54e('0x27')](handleEntityNotFound(_0x486626,null))[_0xf54e('0x27')](function(_0xe1205){if(_0xe1205){return BPromise[_0xf54e('0x68')]([_0xf54e('0x74'),_0xf54e('0x75'),_0xf54e('0x76'),'sms',_0xf54e('0x77'),_0xf54e('0x78')],function(_0x4d4667){return _0xe1205['get'+_[_0xf54e('0x61')](_0x4d4667)+_0xf54e('0x5c')]({'attributes':['id',_0xf54e('0x2f')]})[_0xf54e('0x27')](function(_0x393156){return BPromise['each'](_0x393156,function(_0x230757){return _0x230757[_0xf54e('0x73')](_0x389f16[_0xf54e('0x34')][_0xf54e('0x5f')])['then'](function(){if(_0x4d4667===_0xf54e('0x74')){return db[_0xf54e('0x6d')][_0xf54e('0x28')]({'where':{'VoiceQueueId':_0x230757['id'],'UserId':_0x389f16[_0xf54e('0x34')]['ids']}});}});});})[_0xf54e('0x27')](function(){return _0xe1205;});})[_0xf54e('0x27')](function(){return _0xe1205;});}})[_0xf54e('0x27')](function(_0x402196){if(_0x402196){return _0x402196[_0xf54e('0x73')](_0x389f16['query'][_0xf54e('0x5f')])['then'](function(){if(_['isArray'](_0x389f16[_0xf54e('0x34')][_0xf54e('0x5f')])){for(var _0x242f5c=0x0;_0x242f5c<_0x389f16[_0xf54e('0x34')][_0xf54e('0x5f')][_0xf54e('0x39')];_0x242f5c+=0x1){socket[_0xf54e('0x71')](_0xf54e('0x79'),{'UserId':Number(_0x389f16[_0xf54e('0x34')]['ids'][_0x242f5c]),'TeamId':Number(_0x389f16[_0xf54e('0x4a')]['id'])});}}else{socket[_0xf54e('0x71')](_0xf54e('0x79'),{'UserId':Number(_0x389f16[_0xf54e('0x34')][_0xf54e('0x5f')]),'TeamId':Number(_0x389f16[_0xf54e('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x486626,null))[_0xf54e('0x48')](handleError(_0x486626,null));};exports[_0xf54e('0x7a')]=function(_0xd2c60d,_0x2b46d4,_0x436b99){var _0x596ea6={};var _0x57553f={};var _0x35b43e;var _0x3e897a;return db[_0xf54e('0x30')][_0xf54e('0x56')]({'where':{'id':_0xd2c60d['params']['id']}})['then'](handleEntityNotFound(_0x2b46d4,null))[_0xf54e('0x27')](function(_0x1a5050){if(_0x1a5050){_0x35b43e=_0x1a5050;_0x57553f[_0xf54e('0x32')]=_[_0xf54e('0x33')](db[_0xf54e('0x69')][_0xf54e('0x31')]);_0x57553f['query']=_[_0xf54e('0x33')](_0xd2c60d[_0xf54e('0x34')]);_0x57553f[_0xf54e('0x35')]=_[_0xf54e('0x37')](_0x57553f[_0xf54e('0x32')],_0x57553f[_0xf54e('0x34')]);_0x596ea6['attributes']=_[_0xf54e('0x37')](_0x57553f['model'],qs[_0xf54e('0x38')](_0xd2c60d['query'][_0xf54e('0x38')]));_0x596ea6[_0xf54e('0x36')]=_0x596ea6[_0xf54e('0x36')][_0xf54e('0x39')]?_0x596ea6[_0xf54e('0x36')]:_0x57553f['model'];_0x596ea6[_0xf54e('0x3a')]=qs[_0xf54e('0x3b')](_0xd2c60d['query'][_0xf54e('0x3b')]);_0x596ea6[_0xf54e('0x3c')]=qs[_0xf54e('0x35')](_[_0xf54e('0x3d')](_0xd2c60d['query'],_0x57553f[_0xf54e('0x35')]));if(_0xd2c60d[_0xf54e('0x34')]['filter']){_0x596ea6[_0xf54e('0x3c')]=_['merge'](_0x596ea6['where'],{'$or':_[_0xf54e('0x7b')](_0x596ea6['attributes'],function(_0x5fb5e3){var _0x28e406={};_0x28e406[_0x5fb5e3]={'$like':'%'+_0xd2c60d[_0xf54e('0x34')][_0xf54e('0x43')]+'%'};return _0x28e406;})});}_0x596ea6=_[_0xf54e('0x3e')]({},_0x596ea6,_0xd2c60d['options']);return _0x35b43e[_0xf54e('0x7a')](_0x596ea6);}})[_0xf54e('0x27')](function(_0x9f9b2d){if(_0x9f9b2d){_0x3e897a=_0x9f9b2d[_0xf54e('0x39')];if(!_0xd2c60d['query'][_0xf54e('0x7c')]('nolimit')){_0x596ea6[_0xf54e('0x21')]=qs[_0xf54e('0x21')](_0xd2c60d['query'][_0xf54e('0x21')]);_0x596ea6[_0xf54e('0x20')]=qs[_0xf54e('0x20')](_0xd2c60d[_0xf54e('0x34')]['offset']);}return _0x35b43e[_0xf54e('0x7a')](_0x596ea6);}})[_0xf54e('0x27')](function(_0x72535e){if(_0x72535e){return _0x72535e?{'count':_0x3e897a,'rows':_0x72535e}:null;}})['then'](respondWithResult(_0x2b46d4,null))['catch'](handleError(_0x2b46d4,null));}; \ No newline at end of file +var _0xb4e6=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','index','Team','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','type','key','VIRTUAL','field','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','ids','removeQueues','addAgents','Voice','Chat','Mail','Sms','each','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','omit','spread','userTeam:save','removeAgents','chat','mail','sms','isArray','emit','userTeam:remove','getAgents','User'];(function(_0x85a043,_0xc1e7fb){var _0x5a8512=function(_0x33915d){while(--_0x33915d){_0x85a043['push'](_0x85a043['shift']());}};_0x5a8512(++_0xc1e7fb);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0xb4e6[_0x5f1617];return _0x3af5da;};'use strict';var pdf=require(_0x6b4e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b4e('0x1'));var zipdir=require(_0x6b4e('0x2'));var jsonpatch=require(_0x6b4e('0x3'));var rp=require(_0x6b4e('0x4'));var moment=require(_0x6b4e('0x5'));var BPromise=require(_0x6b4e('0x6'));var Mustache=require(_0x6b4e('0x7'));var util=require('util');var path=require(_0x6b4e('0x8'));var sox=require(_0x6b4e('0x9'));var csv=require(_0x6b4e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6b4e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b4e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b4e('0xd'));var Papa=require(_0x6b4e('0xe'));var Redis=require(_0x6b4e('0xf'));var authService=require(_0x6b4e('0x10'));var qs=require(_0x6b4e('0x11'));var hardwareService=require(_0x6b4e('0x12'));var logger=require(_0x6b4e('0x13'))('api');var utils=require(_0x6b4e('0x14'));var config=require(_0x6b4e('0x15'));var db=require('../../mysqldb')['db'];config[_0x6b4e('0x16')]=_[_0x6b4e('0x17')](config[_0x6b4e('0x16')],{'host':_0x6b4e('0x18'),'port':0x18eb});var socket=require(_0x6b4e('0x19'))(new Redis(config[_0x6b4e('0x16')]));require(_0x6b4e('0x1a'))['register'](socket);function respondWithStatusCode(_0x36f8a5,_0x29bdee){_0x29bdee=_0x29bdee||0xcc;return function(_0x4788cf){if(_0x4788cf){return _0x36f8a5[_0x6b4e('0x1b')](_0x29bdee);}return _0x36f8a5['status'](_0x29bdee)[_0x6b4e('0x1c')]();};}function respondWithResult(_0x2195c1,_0x3ba513){_0x3ba513=_0x3ba513||0xc8;return function(_0x42e265){if(_0x42e265){return _0x2195c1[_0x6b4e('0x1d')](_0x3ba513)[_0x6b4e('0x1e')](_0x42e265);}};}function respondWithFilteredResult(_0x53a934,_0x5775f4){return function(_0x67496d){if(_0x67496d){var _0x1beb73=_0x67496d[_0x6b4e('0x1f')],_0x10d2b1=_0x5775f4[_0x6b4e('0x20')],_0x39c1b8=_0x5775f4[_0x6b4e('0x20')]+_0x5775f4[_0x6b4e('0x21')],_0x101d0a;if(_0x39c1b8>=_0x1beb73){_0x39c1b8=_0x1beb73;_0x101d0a=0xc8;}else{_0x101d0a=0xce;}_0x53a934[_0x6b4e('0x1d')](_0x101d0a);return _0x53a934[_0x6b4e('0x22')]('Content-Range',_0x10d2b1+'-'+_0x39c1b8+'/'+_0x1beb73)[_0x6b4e('0x1e')](_0x67496d);}return null;};}function patchUpdates(_0x248fea){return function(_0x31fb9d){try{jsonpatch[_0x6b4e('0x23')](_0x31fb9d,_0x248fea,!![]);}catch(_0x5e5dcd){return BPromise[_0x6b4e('0x24')](_0x5e5dcd);}return _0x31fb9d['save']();};}function saveUpdates(_0x2503a5,_0x163dea){return function(_0x165a99){if(_0x165a99){return _0x165a99[_0x6b4e('0x25')](_0x2503a5)[_0x6b4e('0x26')](function(_0x346566){return _0x346566;});}return null;};}function removeEntity(_0x3e636f,_0x5c33be){return function(_0x2e36db){if(_0x2e36db){return _0x2e36db['destroy']()[_0x6b4e('0x26')](function(){var _0x884b7e=_0x2e36db[_0x6b4e('0x27')]({'plain':!![]});var _0xdba4fe='Teams';return db[_0x6b4e('0x28')][_0x6b4e('0x29')]({'where':{'type':_0xdba4fe,'resourceId':_0x884b7e['id']}})['then'](function(){return _0x2e36db;});})[_0x6b4e('0x26')](function(){_0x3e636f[_0x6b4e('0x1d')](0xcc)[_0x6b4e('0x1c')]();});}};}function handleEntityNotFound(_0x44b399,_0x5bfe9e){return function(_0x2d42be){if(!_0x2d42be){_0x44b399[_0x6b4e('0x1b')](0x194);}return _0x2d42be;};}function handleError(_0x57650d,_0x130c21){_0x130c21=_0x130c21||0x1f4;return function(_0x453beb){logger[_0x6b4e('0x2a')](_0x453beb[_0x6b4e('0x2b')]);if(_0x453beb['name']){delete _0x453beb[_0x6b4e('0x2c')];}_0x57650d[_0x6b4e('0x1d')](_0x130c21)['send'](_0x453beb);};}exports[_0x6b4e('0x2d')]=function(_0x3f9868,_0x37b636){var _0x53c242={},_0x5c2200={},_0x11156e={'count':0x0,'rows':[]};var _0x2e6414=db[_0x6b4e('0x2e')]['rawAttributes'];_0x5c2200[_0x6b4e('0x2f')]=_[_0x6b4e('0x30')](_0x2e6414);_0x5c2200[_0x6b4e('0x31')]=_['keys'](_0x3f9868['query']);_0x5c2200[_0x6b4e('0x32')]=_['intersection'](_0x5c2200[_0x6b4e('0x2f')],_0x5c2200[_0x6b4e('0x31')]);_0x53c242['attributes']=_[_0x6b4e('0x33')](_0x5c2200[_0x6b4e('0x2f')],qs[_0x6b4e('0x34')](_0x3f9868[_0x6b4e('0x31')]['fields']));_0x53c242['attributes']=_0x53c242[_0x6b4e('0x35')][_0x6b4e('0x36')]?_0x53c242[_0x6b4e('0x35')]:_0x5c2200[_0x6b4e('0x2f')];if(!_0x3f9868[_0x6b4e('0x31')][_0x6b4e('0x37')](_0x6b4e('0x38'))){_0x53c242[_0x6b4e('0x21')]=qs[_0x6b4e('0x21')](_0x3f9868[_0x6b4e('0x31')][_0x6b4e('0x21')]);_0x53c242[_0x6b4e('0x20')]=qs[_0x6b4e('0x20')](_0x3f9868['query'][_0x6b4e('0x20')]);}_0x53c242[_0x6b4e('0x39')]=qs[_0x6b4e('0x3a')](_0x3f9868['query'][_0x6b4e('0x3a')]);_0x53c242['where']=qs[_0x6b4e('0x32')](_[_0x6b4e('0x3b')](_0x3f9868[_0x6b4e('0x31')],_0x5c2200['filters']));if(_0x3f9868['query'][_0x6b4e('0x3c')]){_0x53c242[_0x6b4e('0x3d')]=_['merge'](_0x53c242['where'],{'$or':_[_0x6b4e('0x3e')](_0x2e6414,function(_0xe125d7){if(_0xe125d7[_0x6b4e('0x3f')][_0x6b4e('0x40')]!==_0x6b4e('0x41')){var _0x408d66={};_0x408d66[_0xe125d7[_0x6b4e('0x42')]]={'$like':'%'+_0x3f9868[_0x6b4e('0x31')][_0x6b4e('0x3c')]+'%'};return _0x408d66;}})});}_0x53c242=_[_0x6b4e('0x43')]({},_0x53c242,_0x3f9868[_0x6b4e('0x44')]);var _0x5bbcfc={'where':_0x53c242[_0x6b4e('0x3d')]};return db[_0x6b4e('0x2e')]['count'](_0x5bbcfc)[_0x6b4e('0x26')](function(_0x29353b){_0x11156e[_0x6b4e('0x1f')]=_0x29353b;if(_0x3f9868[_0x6b4e('0x31')][_0x6b4e('0x45')]){_0x53c242['include']=[{'all':!![]}];}return db['Team'][_0x6b4e('0x46')](_0x53c242);})['then'](function(_0x274ed4){_0x11156e[_0x6b4e('0x47')]=_0x274ed4;return _0x11156e;})['then'](respondWithFilteredResult(_0x37b636,_0x53c242))[_0x6b4e('0x48')](handleError(_0x37b636,null));};exports['show']=function(_0x3dec0f,_0x4fbd96){var _0x230b93={'raw':![],'where':{'id':_0x3dec0f[_0x6b4e('0x49')]['id']}},_0x36d090={};_0x36d090[_0x6b4e('0x2f')]=_['keys'](db[_0x6b4e('0x2e')][_0x6b4e('0x4a')]);_0x36d090[_0x6b4e('0x31')]=_['keys'](_0x3dec0f[_0x6b4e('0x31')]);_0x36d090[_0x6b4e('0x32')]=_[_0x6b4e('0x33')](_0x36d090[_0x6b4e('0x2f')],_0x36d090[_0x6b4e('0x31')]);_0x230b93[_0x6b4e('0x35')]=_[_0x6b4e('0x33')](_0x36d090[_0x6b4e('0x2f')],qs[_0x6b4e('0x34')](_0x3dec0f['query'][_0x6b4e('0x34')]));_0x230b93[_0x6b4e('0x35')]=_0x230b93[_0x6b4e('0x35')][_0x6b4e('0x36')]?_0x230b93[_0x6b4e('0x35')]:_0x36d090['model'];if(_0x3dec0f[_0x6b4e('0x31')]['includeAll']){_0x230b93[_0x6b4e('0x4b')]=[{'all':!![]}];}_0x230b93=_[_0x6b4e('0x43')]({},_0x230b93,_0x3dec0f[_0x6b4e('0x44')]);return db[_0x6b4e('0x2e')]['find'](_0x230b93)[_0x6b4e('0x26')](handleEntityNotFound(_0x4fbd96,null))[_0x6b4e('0x26')](respondWithResult(_0x4fbd96,null))[_0x6b4e('0x48')](handleError(_0x4fbd96,null));};exports['create']=function(_0x2e91f9,_0x455afc){return db[_0x6b4e('0x2e')][_0x6b4e('0x4c')](_0x2e91f9[_0x6b4e('0x4d')],{})[_0x6b4e('0x26')](function(_0x289dfa){var _0x3e7186=_0x2e91f9[_0x6b4e('0x4e')][_0x6b4e('0x27')]({'plain':!![]});if(!_0x3e7186)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e7186[_0x6b4e('0x4f')]===_0x6b4e('0x4e')){var _0x1f691f=_0x289dfa['get']({'plain':!![]});var _0x390583=_0x6b4e('0x50');return db[_0x6b4e('0x51')][_0x6b4e('0x52')]({'where':{'name':_0x390583,'userProfileId':_0x3e7186[_0x6b4e('0x53')]},'raw':!![]})[_0x6b4e('0x26')](function(_0x29ea90){if(_0x29ea90&&_0x29ea90[_0x6b4e('0x54')]===0x0){return db[_0x6b4e('0x28')][_0x6b4e('0x4c')]({'name':_0x1f691f[_0x6b4e('0x2c')],'resourceId':_0x1f691f['id'],'type':_0x29ea90['name'],'sectionId':_0x29ea90['id']},{})['then'](function(){return _0x289dfa;});}else{return _0x289dfa;}})[_0x6b4e('0x48')](function(_0x2d5eda){logger[_0x6b4e('0x2a')](_0x6b4e('0x55'),_0x2d5eda);throw _0x2d5eda;});}return _0x289dfa;})['then'](respondWithResult(_0x455afc,0xc9))[_0x6b4e('0x48')](handleError(_0x455afc,null));};exports[_0x6b4e('0x25')]=function(_0xf2e6d5,_0x59db52){if(_0xf2e6d5[_0x6b4e('0x4d')]['id']){delete _0xf2e6d5[_0x6b4e('0x4d')]['id'];}return db[_0x6b4e('0x2e')][_0x6b4e('0x52')]({'where':{'id':_0xf2e6d5[_0x6b4e('0x49')]['id']}})['then'](handleEntityNotFound(_0x59db52,null))[_0x6b4e('0x26')](saveUpdates(_0xf2e6d5['body'],null))[_0x6b4e('0x26')](respondWithResult(_0x59db52,null))[_0x6b4e('0x48')](handleError(_0x59db52,null));};exports['destroy']=function(_0x2536e6,_0x553521){return db[_0x6b4e('0x2e')][_0x6b4e('0x52')]({'where':{'id':_0x2536e6[_0x6b4e('0x49')]['id']}})[_0x6b4e('0x26')](handleEntityNotFound(_0x553521,null))[_0x6b4e('0x26')](removeEntity(_0x553521,null))['catch'](handleError(_0x553521,null));};exports[_0x6b4e('0x56')]=function(_0x292e36,_0x9f8aab,_0x5906bf){return db['Team'][_0x6b4e('0x57')]({'where':{'id':_0x292e36[_0x6b4e('0x49')]['id']}})['then'](handleEntityNotFound(_0x9f8aab,null))[_0x6b4e('0x26')](function(_0x2cb4c){if(!_0x292e36[_0x6b4e('0x31')][_0x6b4e('0x58')]||!utils[_0x6b4e('0x59')](_0x292e36['query']['channel'])){throw new db[(_0x6b4e('0x5a'))][(_0x6b4e('0x5b'))](_0x6b4e('0x5c'));}var _0x2f1354={};var _0x2de829={};_0x2de829[_0x6b4e('0x2f')]=_[_0x6b4e('0x30')](db[_[_0x6b4e('0x5d')](_0x292e36[_0x6b4e('0x31')]['channel'][_0x6b4e('0x5e')]())+_0x6b4e('0x5f')][_0x6b4e('0x4a')]);_0x2de829['query']=_['keys'](_0x292e36[_0x6b4e('0x31')]);_0x2de829[_0x6b4e('0x32')]=_[_0x6b4e('0x33')](_0x2de829[_0x6b4e('0x2f')],_0x2de829[_0x6b4e('0x31')]);_0x2f1354['attributes']=_[_0x6b4e('0x33')](_0x2de829[_0x6b4e('0x2f')],qs[_0x6b4e('0x34')](_0x292e36['query'][_0x6b4e('0x34')]));_0x2f1354[_0x6b4e('0x35')]=_0x2f1354[_0x6b4e('0x35')]['length']?_0x2f1354[_0x6b4e('0x35')]:_0x2de829[_0x6b4e('0x2f')];_0x2f1354['limit']=qs[_0x6b4e('0x21')](_0x292e36[_0x6b4e('0x31')][_0x6b4e('0x21')]);_0x2f1354[_0x6b4e('0x20')]=qs[_0x6b4e('0x20')](_0x292e36[_0x6b4e('0x31')][_0x6b4e('0x20')]);_0x2f1354['order']=qs[_0x6b4e('0x3a')](_0x292e36[_0x6b4e('0x31')][_0x6b4e('0x3a')]);_0x2f1354[_0x6b4e('0x3d')]=qs[_0x6b4e('0x32')](_['pick'](_0x292e36[_0x6b4e('0x31')],_0x2de829[_0x6b4e('0x32')]));_0x2f1354=_[_0x6b4e('0x43')]({},_0x2f1354,_0x292e36[_0x6b4e('0x44')]);return _0x2cb4c[_0x6b4e('0x27')+_['capitalize'](_0x292e36[_0x6b4e('0x31')]['channel'][_0x6b4e('0x5e')]())+_0x6b4e('0x60')](_0x2f1354);})[_0x6b4e('0x26')](respondWithResult(_0x9f8aab,null))[_0x6b4e('0x48')](handleError(_0x9f8aab,null));};exports['addQueues']=function(_0x7d1ce,_0xb14e52,_0x329d25){return db[_0x6b4e('0x2e')][_0x6b4e('0x57')]({'where':{'id':_0x7d1ce[_0x6b4e('0x49')]['id']}})[_0x6b4e('0x26')](function(_0x5b26df){if(_0x5b26df){if(!_0x7d1ce['body']['channel']||!utils[_0x6b4e('0x59')](_0x7d1ce[_0x6b4e('0x4d')][_0x6b4e('0x58')])){throw new db[(_0x6b4e('0x5a'))][(_0x6b4e('0x5b'))](_0x6b4e('0x5c'));}return _0x5b26df['add'+_['capitalize'](_0x7d1ce[_0x6b4e('0x4d')][_0x6b4e('0x58')][_0x6b4e('0x5e')]())+_0x6b4e('0x60')](_0x7d1ce['body'][_0x6b4e('0x61')]);}return null;})['then'](handleEntityNotFound(_0xb14e52,null))[_0x6b4e('0x26')](respondWithStatusCode(_0xb14e52,null))[_0x6b4e('0x48')](handleError(_0xb14e52,null));};exports[_0x6b4e('0x62')]=function(_0x3bf4c9,_0x4bd8fb,_0x4a99bf){return db['Team'][_0x6b4e('0x57')]({'where':{'id':_0x3bf4c9['params']['id']}})[_0x6b4e('0x26')](function(_0x2c6f90){if(_0x2c6f90){if(!_0x3bf4c9['query'][_0x6b4e('0x58')]||!utils['isValidChannel'](_0x3bf4c9[_0x6b4e('0x31')][_0x6b4e('0x58')])){throw new db[(_0x6b4e('0x5a'))][(_0x6b4e('0x5b'))]('Unknown\x20channel');}return _0x2c6f90['remove'+_['capitalize'](_0x3bf4c9[_0x6b4e('0x31')][_0x6b4e('0x58')]['toLowerCase']())+_0x6b4e('0x60')](_0x3bf4c9[_0x6b4e('0x31')][_0x6b4e('0x61')]);}return null;})[_0x6b4e('0x26')](handleEntityNotFound(_0x4bd8fb,null))[_0x6b4e('0x26')](respondWithStatusCode(_0x4bd8fb,null))[_0x6b4e('0x48')](handleError(_0x4bd8fb,null));};exports[_0x6b4e('0x63')]=function(_0x24e893,_0x202efb,_0x45cb6b){return db[_0x6b4e('0x2e')]['find']({'where':{'id':_0x24e893[_0x6b4e('0x49')]['id']}})[_0x6b4e('0x26')](handleEntityNotFound(_0x202efb,null))[_0x6b4e('0x26')](function(_0x7692bc){if(_0x7692bc){var _0x24c2ca=[_0x6b4e('0x64'),_0x6b4e('0x65'),_0x6b4e('0x66'),_0x6b4e('0x67'),'Fax','Openchannel'];return BPromise['each'](_0x24c2ca,function(_0x5d8bb1){return _0x7692bc[_0x6b4e('0x27')+_0x5d8bb1+_0x6b4e('0x60')]({'attributes':['id',_0x6b4e('0x2c')]})[_0x6b4e('0x26')](function(_0x4e7b0f){return BPromise[_0x6b4e('0x68')](_0x4e7b0f,function(_0x349964){return _0x349964['addAgents'](_0x24e893[_0x6b4e('0x4d')][_0x6b4e('0x61')])[_0x6b4e('0x26')](function(){if(_0x5d8bb1===_0x6b4e('0x64')){return db['User'][_0x6b4e('0x46')]({'where':{'id':_0x24e893[_0x6b4e('0x4d')]['ids']},'attributes':['id','name',_0x6b4e('0x69'),'voicePause',_0x6b4e('0x6a')],'raw':!![]})[_0x6b4e('0x26')](function(_0x50b086){return BPromise[_0x6b4e('0x68')](_[_0x6b4e('0x3c')](_0x50b086,{'online':0x1}),function(_0x3b7c3c){return db[_0x6b4e('0x6b')][_0x6b4e('0x6c')]({'membername':_0x3b7c3c['name'],'UserId':_0x3b7c3c['id'],'queue_name':_0x349964['name'],'VoiceQueueId':_0x349964['id'],'interface':_[_0x6b4e('0x6d')](_0x3b7c3c[_0x6b4e('0x6a')])?util[_0x6b4e('0x6e')](_0x6b4e('0x6f'),_0x3b7c3c[_0x6b4e('0x2c')]):_0x3b7c3c[_0x6b4e('0x6a')],'paused':_0x3b7c3c[_0x6b4e('0x70')]||![],'penalty':0x0});});});}});});})[_0x6b4e('0x26')](function(){return _0x7692bc;});})[_0x6b4e('0x26')](function(){return _0x7692bc;});}})['then'](function(_0x397148){if(_0x397148){return _0x397148[_0x6b4e('0x63')](_0x24e893[_0x6b4e('0x4d')][_0x6b4e('0x61')],_[_0x6b4e('0x71')](_0x24e893[_0x6b4e('0x4d')],[_0x6b4e('0x61'),'id'])||{})[_0x6b4e('0x72')](function(_0x275b98){for(var _0x1e2607=0x0;_0x1e2607<_0x24e893[_0x6b4e('0x4d')][_0x6b4e('0x61')]['length'];_0x1e2607+=0x1){socket['emit'](_0x6b4e('0x73'),{'UserId':_0x24e893[_0x6b4e('0x4d')][_0x6b4e('0x61')][_0x1e2607],'TeamId':_0x24e893[_0x6b4e('0x49')]['id']});}return _0x275b98;});}})[_0x6b4e('0x26')](respondWithResult(_0x202efb,null))['catch'](handleError(_0x202efb,null));};exports[_0x6b4e('0x74')]=function(_0x3802ce,_0x310b9c,_0x53508a){return db[_0x6b4e('0x2e')][_0x6b4e('0x52')]({'where':{'id':_0x3802ce[_0x6b4e('0x49')]['id']}})[_0x6b4e('0x26')](handleEntityNotFound(_0x310b9c,null))[_0x6b4e('0x26')](function(_0x44737f){if(_0x44737f){return BPromise[_0x6b4e('0x68')](['voice',_0x6b4e('0x75'),_0x6b4e('0x76'),_0x6b4e('0x77'),'fax','openchannel'],function(_0x53b303){return _0x44737f[_0x6b4e('0x27')+_['capitalize'](_0x53b303)+_0x6b4e('0x60')]({'attributes':['id',_0x6b4e('0x2c')]})[_0x6b4e('0x26')](function(_0x45b79d){return BPromise[_0x6b4e('0x68')](_0x45b79d,function(_0x23b8f8){return _0x23b8f8[_0x6b4e('0x74')](_0x3802ce['query'][_0x6b4e('0x61')])['then'](function(){if(_0x53b303==='voice'){return db[_0x6b4e('0x6b')][_0x6b4e('0x29')]({'where':{'VoiceQueueId':_0x23b8f8['id'],'UserId':_0x3802ce[_0x6b4e('0x31')]['ids']}});}});});})[_0x6b4e('0x26')](function(){return _0x44737f;});})['then'](function(){return _0x44737f;});}})[_0x6b4e('0x26')](function(_0x985eb8){if(_0x985eb8){return _0x985eb8[_0x6b4e('0x74')](_0x3802ce[_0x6b4e('0x31')][_0x6b4e('0x61')])[_0x6b4e('0x26')](function(){if(_[_0x6b4e('0x78')](_0x3802ce[_0x6b4e('0x31')]['ids'])){for(var _0x1e622d=0x0;_0x1e622d<_0x3802ce['query'][_0x6b4e('0x61')]['length'];_0x1e622d+=0x1){socket[_0x6b4e('0x79')]('userTeam:remove',{'UserId':Number(_0x3802ce[_0x6b4e('0x31')][_0x6b4e('0x61')][_0x1e622d]),'TeamId':Number(_0x3802ce[_0x6b4e('0x49')]['id'])});}}else{socket[_0x6b4e('0x79')](_0x6b4e('0x7a'),{'UserId':Number(_0x3802ce[_0x6b4e('0x31')][_0x6b4e('0x61')]),'TeamId':Number(_0x3802ce[_0x6b4e('0x49')]['id'])});}});}})[_0x6b4e('0x26')](respondWithStatusCode(_0x310b9c,null))[_0x6b4e('0x48')](handleError(_0x310b9c,null));};exports[_0x6b4e('0x7b')]=function(_0x3bca59,_0x3da685,_0x3bf989){var _0x6648ca={};var _0x35bac1={};var _0x514f07;var _0xe833ac;return db['Team'][_0x6b4e('0x57')]({'where':{'id':_0x3bca59['params']['id']}})[_0x6b4e('0x26')](handleEntityNotFound(_0x3da685,null))[_0x6b4e('0x26')](function(_0x7500cb){if(_0x7500cb){_0x514f07=_0x7500cb;_0x35bac1[_0x6b4e('0x2f')]=_['keys'](db[_0x6b4e('0x7c')][_0x6b4e('0x4a')]);_0x35bac1[_0x6b4e('0x31')]=_[_0x6b4e('0x30')](_0x3bca59['query']);_0x35bac1[_0x6b4e('0x32')]=_['intersection'](_0x35bac1[_0x6b4e('0x2f')],_0x35bac1[_0x6b4e('0x31')]);_0x6648ca[_0x6b4e('0x35')]=_[_0x6b4e('0x33')](_0x35bac1[_0x6b4e('0x2f')],qs[_0x6b4e('0x34')](_0x3bca59[_0x6b4e('0x31')][_0x6b4e('0x34')]));_0x6648ca[_0x6b4e('0x35')]=_0x6648ca[_0x6b4e('0x35')][_0x6b4e('0x36')]?_0x6648ca[_0x6b4e('0x35')]:_0x35bac1[_0x6b4e('0x2f')];_0x6648ca[_0x6b4e('0x39')]=qs[_0x6b4e('0x3a')](_0x3bca59[_0x6b4e('0x31')]['sort']);_0x6648ca[_0x6b4e('0x3d')]=qs[_0x6b4e('0x32')](_[_0x6b4e('0x3b')](_0x3bca59[_0x6b4e('0x31')],_0x35bac1['filters']));if(_0x3bca59[_0x6b4e('0x31')][_0x6b4e('0x3c')]){_0x6648ca[_0x6b4e('0x3d')]=_['merge'](_0x6648ca[_0x6b4e('0x3d')],{'$or':_[_0x6b4e('0x3e')](_0x6648ca[_0x6b4e('0x35')],function(_0x44bfe1){var _0x4a864f={};_0x4a864f[_0x44bfe1]={'$like':'%'+_0x3bca59['query'][_0x6b4e('0x3c')]+'%'};return _0x4a864f;})});}_0x6648ca=_[_0x6b4e('0x43')]({},_0x6648ca,_0x3bca59['options']);return _0x514f07[_0x6b4e('0x7b')](_0x6648ca);}})[_0x6b4e('0x26')](function(_0x4307cb){if(_0x4307cb){_0xe833ac=_0x4307cb[_0x6b4e('0x36')];if(!_0x3bca59[_0x6b4e('0x31')][_0x6b4e('0x37')]('nolimit')){_0x6648ca[_0x6b4e('0x21')]=qs[_0x6b4e('0x21')](_0x3bca59[_0x6b4e('0x31')][_0x6b4e('0x21')]);_0x6648ca[_0x6b4e('0x20')]=qs[_0x6b4e('0x20')](_0x3bca59[_0x6b4e('0x31')][_0x6b4e('0x20')]);}return _0x514f07[_0x6b4e('0x7b')](_0x6648ca);}})[_0x6b4e('0x26')](function(_0x44c7bb){if(_0x44c7bb){return _0x44c7bb?{'count':_0xe833ac,'rows':_0x44c7bb}:null;}})['then'](respondWithResult(_0x3da685,null))[_0x6b4e('0x48')](handleError(_0x3da685,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index bb5162e..4065368 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 _0x4051=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dcee0,_0x336f62){var _0x56099e=function(_0x316308){while(--_0x316308){_0x3dcee0['push'](_0x3dcee0['shift']());}};_0x56099e(++_0x336f62);}(_0x4051,0x1cd));var _0x1405=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x4051[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require('events');var Team=require(_0x1405('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x1405('0x1')](0x0);var events={'afterCreate':_0x1405('0x2'),'afterUpdate':_0x1405('0x3'),'afterDestroy':_0x1405('0x4')};function emitEvent(_0x4b6d30){return function(_0x442c1f,_0x1042ef,_0x54992b){TeamEvents[_0x1405('0x5')](_0x4b6d30+':'+_0x442c1f['id'],_0x442c1f);TeamEvents[_0x1405('0x5')](_0x4b6d30,_0x442c1f);_0x54992b(null);};}for(var e in events){if(events[_0x1405('0x6')](e)){var event=events[e];Team[_0x1405('0x7')](e,emitEvent(event));}}module[_0x1405('0x8')]=TeamEvents; \ No newline at end of file +var _0xcee2=['events','../../mysqldb','save','update','remove','emit','hook'];(function(_0x3e4d5a,_0x610249){var _0x69cd72=function(_0x24bb05){while(--_0x24bb05){_0x3e4d5a['push'](_0x3e4d5a['shift']());}};_0x69cd72(++_0x610249);}(_0xcee2,0x12d));var _0x2cee=function(_0x110734,_0x4389ce){_0x110734=_0x110734-0x0;var _0x4e12ab=_0xcee2[_0x110734];return _0x4e12ab;};'use strict';var EventEmitter=require(_0x2cee('0x0'));var Team=require(_0x2cee('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2cee('0x2'),'afterUpdate':_0x2cee('0x3'),'afterDestroy':_0x2cee('0x4')};function emitEvent(_0x4f4c99){return function(_0x378382,_0x3a7548,_0x1c0ea6){TeamEvents[_0x2cee('0x5')](_0x4f4c99+':'+_0x378382['id'],_0x378382);TeamEvents[_0x2cee('0x5')](_0x4f4c99,_0x378382);_0x1c0ea6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x2cee('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 25608ee..af005d4 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 _0x865b=['Team','teams','lodash','util','../../config/logger','moment','request-promise','path','./team.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x865b,0xbd));var _0xb865=function(_0x221628,_0x1c3672){_0x221628=_0x221628-0x0;var _0x7b67e=_0x865b[_0x221628];return _0x7b67e;};'use strict';var _=require(_0xb865('0x0'));var util=require(_0xb865('0x1'));var logger=require(_0xb865('0x2'))('api');var moment=require(_0xb865('0x3'));var BPromise=require('bluebird');var rp=require(_0xb865('0x4'));var fs=require('fs');var path=require(_0xb865('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb865('0x6'));module[_0xb865('0x7')]=function(_0x9d8381,_0x30ad07){return _0x9d8381[_0xb865('0x8')](_0xb865('0x9'),attributes,{'tableName':_0xb865('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3edc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Team'];(function(_0x3229c6,_0x4f1334){var _0x5f551a=function(_0x565e62){while(--_0x565e62){_0x3229c6['push'](_0x3229c6['shift']());}};_0x5f551a(++_0x4f1334);}(_0x3edc,0x84));var _0xc3ed=function(_0x208af9,_0x428504){_0x208af9=_0x208af9-0x0;var _0x34e94b=_0x3edc[_0x208af9];return _0x34e94b;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require(_0xc3ed('0x5'));var rp=require(_0xc3ed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x7'));var config=require(_0xc3ed('0x8'));var attributes=require('./team.attributes');module[_0xc3ed('0x9')]=function(_0x4650cb,_0x39d553){return _0x4650cb[_0xc3ed('0xa')](_0xc3ed('0xb'),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 effd74b..93c4e89 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 _0x8ac8=['bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ac8,0x143));var _0x88ac=function(_0x107b28,_0x2f27c3){_0x107b28=_0x107b28-0x0;var _0x50e3ae=_0x8ac8[_0x107b28];return _0x50e3ae;};'use strict';var _=require('lodash');var util=require(_0x88ac('0x0'));var moment=require('moment');var BPromise=require(_0x88ac('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88ac('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x88ac('0x3'))(_0x88ac('0x4'));var config=require(_0x88ac('0x5'));var jayson=require(_0x88ac('0x6'));var client=jayson[_0x88ac('0x7')][_0x88ac('0x8')]({'port':0x232a});config[_0x88ac('0x9')]=_[_0x88ac('0xa')](config[_0x88ac('0x9')],{'host':_0x88ac('0xb'),'port':0x18eb});var socket=require(_0x88ac('0xc'))(new Redis(config[_0x88ac('0x9')]));require(_0x88ac('0xd'))[_0x88ac('0xe')](socket);function respondWithRpcPromise(_0x3fff78,_0x5f1a6e,_0x3273c){return new BPromise(function(_0x53eb3e,_0x3f5ece){return client[_0x88ac('0xf')](_0x3fff78,_0x3273c)[_0x88ac('0x10')](function(_0x4c7285){logger[_0x88ac('0x11')](_0x88ac('0x12'),_0x5f1a6e,'request\x20sent');logger[_0x88ac('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x5f1a6e,_0x88ac('0x14'),JSON[_0x88ac('0x15')](_0x4c7285));if(_0x4c7285['error']){if(_0x4c7285['error'][_0x88ac('0x16')]===0x1f4){logger[_0x88ac('0x17')](_0x88ac('0x12'),_0x5f1a6e,_0x4c7285[_0x88ac('0x17')][_0x88ac('0x18')]);return _0x3f5ece(_0x4c7285[_0x88ac('0x17')][_0x88ac('0x18')]);}logger[_0x88ac('0x17')](_0x88ac('0x12'),_0x5f1a6e,_0x4c7285[_0x88ac('0x17')][_0x88ac('0x18')]);return _0x53eb3e(_0x4c7285['error'][_0x88ac('0x18')]);}else{logger[_0x88ac('0x11')]('Team,\x20%s,\x20%s',_0x5f1a6e,_0x88ac('0x14'));_0x53eb3e(_0x4c7285[_0x88ac('0x19')][_0x88ac('0x18')]);}})[_0x88ac('0x1a')](function(_0x11914b){logger[_0x88ac('0x17')](_0x88ac('0x12'),_0x5f1a6e,_0x11914b);_0x3f5ece(_0x11914b);});});} \ No newline at end of file +var _0xa1c9=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x5e7d0c,_0x56ba7b){var _0xc24371=function(_0x1754d4){while(--_0x1754d4){_0x5e7d0c['push'](_0x5e7d0c['shift']());}};_0xc24371(++_0x56ba7b);}(_0xa1c9,0x1ec));var _0x9a1c=function(_0x559005,_0x200dc8){_0x559005=_0x559005-0x0;var _0x38a0ed=_0xa1c9[_0x559005];return _0x38a0ed;};'use strict';var _=require(_0x9a1c('0x0'));var util=require(_0x9a1c('0x1'));var moment=require(_0x9a1c('0x2'));var BPromise=require(_0x9a1c('0x3'));var rs=require(_0x9a1c('0x4'));var fs=require('fs');var Redis=require(_0x9a1c('0x5'));var db=require(_0x9a1c('0x6'))['db'];var utils=require(_0x9a1c('0x7'));var logger=require(_0x9a1c('0x8'))(_0x9a1c('0x9'));var config=require('../../config/environment');var jayson=require(_0x9a1c('0xa'));var client=jayson[_0x9a1c('0xb')][_0x9a1c('0xc')]({'port':0x232a});config['redis']=_[_0x9a1c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a1c('0xe')]));require('./team.socket')[_0x9a1c('0xf')](socket);function respondWithRpcPromise(_0x1f8601,_0x586d78,_0x5f00c3){return new BPromise(function(_0x51d4bf,_0x1f9820){return client[_0x9a1c('0x10')](_0x1f8601,_0x5f00c3)[_0x9a1c('0x11')](function(_0xdebba4){logger[_0x9a1c('0x12')](_0x9a1c('0x13'),_0x586d78,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x586d78,_0x9a1c('0x14'),JSON[_0x9a1c('0x15')](_0xdebba4));if(_0xdebba4[_0x9a1c('0x16')]){if(_0xdebba4[_0x9a1c('0x16')][_0x9a1c('0x17')]===0x1f4){logger[_0x9a1c('0x16')](_0x9a1c('0x13'),_0x586d78,_0xdebba4['error'][_0x9a1c('0x18')]);return _0x1f9820(_0xdebba4[_0x9a1c('0x16')][_0x9a1c('0x18')]);}logger[_0x9a1c('0x16')](_0x9a1c('0x13'),_0x586d78,_0xdebba4[_0x9a1c('0x16')][_0x9a1c('0x18')]);return _0x51d4bf(_0xdebba4[_0x9a1c('0x16')][_0x9a1c('0x18')]);}else{logger[_0x9a1c('0x12')](_0x9a1c('0x13'),_0x586d78,_0x9a1c('0x14'));_0x51d4bf(_0xdebba4[_0x9a1c('0x19')]['message']);}})[_0x9a1c('0x1a')](function(_0x295c1a){logger[_0x9a1c('0x16')](_0x9a1c('0x13'),_0x586d78,_0x295c1a);_0x1f9820(_0x295c1a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e3ce476..faa62f7 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 _0xb7ac=['save','remove','update','register','./team.events'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x274581,_0x3be242){_0x274581=_0x274581-0x0;var _0x201c2a=_0xb7ac[_0x274581];return _0x201c2a;};'use strict';var TeamEvents=require(_0xcb7a('0x0'));var events=[_0xcb7a('0x1'),_0xcb7a('0x2'),_0xcb7a('0x3')];function createListener(_0x296b98,_0x55c534){return function(_0x3dfd37){_0x55c534['emit'](_0x296b98,_0x3dfd37);};}function removeListener(_0x41408c,_0xaa5a21){return function(){TeamEvents['removeListener'](_0x41408c,_0xaa5a21);};}exports[_0xcb7a('0x4')]=function(_0x39e229){for(var _0x5dc16=0x0,_0x4fe4a9=events['length'];_0x5dc16<_0x4fe4a9;_0x5dc16++){var _0x2fb36a=events[_0x5dc16];var _0x170859=createListener('team:'+_0x2fb36a,_0x39e229);TeamEvents['on'](_0x2fb36a,_0x170859);}}; \ No newline at end of file +var _0x672a=['length','team:','./team.events','save','remove','update','emit','removeListener'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x672a,0x122));var _0xa672=function(_0x508ca9,_0x425e6d){_0x508ca9=_0x508ca9-0x0;var _0x249138=_0x672a[_0x508ca9];return _0x249138;};'use strict';var TeamEvents=require(_0xa672('0x0'));var events=[_0xa672('0x1'),_0xa672('0x2'),_0xa672('0x3')];function createListener(_0x154fad,_0x8c182b){return function(_0x39a367){_0x8c182b[_0xa672('0x4')](_0x154fad,_0x39a367);};}function removeListener(_0xa8b69a,_0x28670c){return function(){TeamEvents[_0xa672('0x5')](_0xa8b69a,_0x28670c);};}exports['register']=function(_0x272de8){for(var _0x3f37f0=0x0,_0x3a4797=events[_0xa672('0x6')];_0x3f37f0<_0x3a4797;_0x3f37f0++){var _0x13402c=events[_0x3f37f0];var _0x3f18d8=createListener(_0xa672('0x7')+_0x13402c,_0x272de8);TeamEvents['on'](_0x13402c,_0x3f18d8);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 356cf3f..4fd59e7 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 _0x4a82=['get','isAuthenticated','index','show','post','create','/:id','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x300760,_0x4c8a94){var _0x564937=function(_0x248d97){while(--_0x248d97){_0x300760['push'](_0x300760['shift']());}};_0x564937(++_0x4c8a94);}(_0x4a82,0x19f));var _0x24a8=function(_0x288945,_0x1bf9a2){_0x288945=_0x288945-0x0;var _0x399e8d=_0x4a82[_0x288945];return _0x399e8d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x24a8('0x0'));var timeout=require(_0x24a8('0x1'));var express=require('express');var router=express[_0x24a8('0x2')]();var auth=require(_0x24a8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x24a8('0x4'));var controller=require('./template.controller');router[_0x24a8('0x5')]('/',auth[_0x24a8('0x6')](),controller[_0x24a8('0x7')]);router[_0x24a8('0x5')]('/:id',auth[_0x24a8('0x6')](),controller[_0x24a8('0x8')]);router[_0x24a8('0x9')]('/',auth[_0x24a8('0x6')](),controller[_0x24a8('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x24a8('0xb'),auth['isAuthenticated'](),controller[_0x24a8('0xc')]);module[_0x24a8('0xd')]=router; \ No newline at end of file +var _0x3162=['show','isAuthenticated','put','update','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./template.controller','get','/:id'];(function(_0x2ed06f,_0x5b2875){var _0x4918c8=function(_0x762dd6){while(--_0x762dd6){_0x2ed06f['push'](_0x2ed06f['shift']());}};_0x4918c8(++_0x5b2875);}(_0x3162,0x101));var _0x2316=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0x3162[_0x51b80a];return _0x22fdf0;};'use strict';var multer=require('multer');var util=require(_0x2316('0x0'));var path=require(_0x2316('0x1'));var timeout=require(_0x2316('0x2'));var express=require(_0x2316('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2316('0x4'));var config=require(_0x2316('0x5'));var controller=require(_0x2316('0x6'));router[_0x2316('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2316('0x7')](_0x2316('0x8'),auth['isAuthenticated'](),controller[_0x2316('0x9')]);router['post']('/',auth[_0x2316('0xa')](),controller['create']);router[_0x2316('0xb')](_0x2316('0x8'),auth[_0x2316('0xa')](),controller[_0x2316('0xc')]);router['delete'](_0x2316('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x2316('0xd')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 447fd9c..ec4b58d 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 _0xd7cc=['TEXT','sequelize','exports','STRING'];(function(_0x2d332b,_0x29af08){var _0x45c814=function(_0x3ec631){while(--_0x3ec631){_0x2d332b['push'](_0x2d332b['shift']());}};_0x45c814(++_0x29af08);}(_0xd7cc,0x131));var _0xcd7c=function(_0x276f97,_0x1314ef){_0x276f97=_0x276f97-0x0;var _0xd38f8e=_0xd7cc[_0x276f97];return _0xd38f8e;};'use strict';var Sequelize=require(_0xcd7c('0x0'));module[_0xcd7c('0x1')]={'name':{'type':Sequelize[_0xcd7c('0x2')]},'description':{'type':Sequelize[_0xcd7c('0x2')]},'html':{'type':Sequelize[_0xcd7c('0x3')]}}; \ No newline at end of file +var _0x1df4=['sequelize','exports','STRING'];(function(_0x4ed4b6,_0x1b18ca){var _0x23e148=function(_0x3f14b8){while(--_0x3f14b8){_0x4ed4b6['push'](_0x4ed4b6['shift']());}};_0x23e148(++_0x1b18ca);}(_0x1df4,0x15f));var _0x41df=function(_0x22d803,_0x465ce7){_0x22d803=_0x22d803-0x0;var _0x42483e=_0x1df4[_0x22d803];return _0x42483e;};'use strict';var Sequelize=require(_0x41df('0x0'));module[_0x41df('0x1')]={'name':{'type':Sequelize[_0x41df('0x2')]},'description':{'type':Sequelize[_0x41df('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 9d38359..bcf4baf 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 _0xedd9=['catch','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','get','Templates','UserProfileResource','error','stack','send','index','Template','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','type','key','VIRTUAL','includeAll','findAll','rows'];(function(_0x55ba5d,_0x3584c4){var _0x23e23e=function(_0x1b5c05){while(--_0x1b5c05){_0x55ba5d['push'](_0x55ba5d['shift']());}};_0x23e23e(++_0x3584c4);}(_0xedd9,0xfc));var _0x9edd=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xedd9[_0x533e4e];return _0x1f14bb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var hardwareService=require(_0x9edd('0x12'));var logger=require('../../config/logger')(_0x9edd('0x13'));var utils=require(_0x9edd('0x14'));var config=require('../../config/environment');var db=require(_0x9edd('0x15'))['db'];function respondWithStatusCode(_0x1b73d1,_0x25e64c){_0x25e64c=_0x25e64c||0xcc;return function(_0xfd544a){if(_0xfd544a){return _0x1b73d1[_0x9edd('0x16')](_0x25e64c);}return _0x1b73d1[_0x9edd('0x17')](_0x25e64c)[_0x9edd('0x18')]();};}function respondWithResult(_0xef5498,_0x47eb64){_0x47eb64=_0x47eb64||0xc8;return function(_0x176bfa){if(_0x176bfa){return _0xef5498[_0x9edd('0x17')](_0x47eb64)[_0x9edd('0x19')](_0x176bfa);}};}function respondWithFilteredResult(_0x4d9a7,_0x13b6b6){return function(_0x338f3c){if(_0x338f3c){var _0x1042aa=_0x338f3c[_0x9edd('0x1a')],_0x75a4ab=_0x13b6b6[_0x9edd('0x1b')],_0x4ea60f=_0x13b6b6['offset']+_0x13b6b6[_0x9edd('0x1c')],_0x5f5bf4;if(_0x4ea60f>=_0x1042aa){_0x4ea60f=_0x1042aa;_0x5f5bf4=0xc8;}else{_0x5f5bf4=0xce;}_0x4d9a7[_0x9edd('0x17')](_0x5f5bf4);return _0x4d9a7[_0x9edd('0x1d')]('Content-Range',_0x75a4ab+'-'+_0x4ea60f+'/'+_0x1042aa)[_0x9edd('0x19')](_0x338f3c);}return null;};}function patchUpdates(_0x5d879c){return function(_0x2cdcef){try{jsonpatch[_0x9edd('0x1e')](_0x2cdcef,_0x5d879c,!![]);}catch(_0x4bdb88){return BPromise['reject'](_0x4bdb88);}return _0x2cdcef[_0x9edd('0x1f')]();};}function saveUpdates(_0x50338f,_0x27a95a){return function(_0x54a03f){if(_0x54a03f){return _0x54a03f['update'](_0x50338f)[_0x9edd('0x20')](function(_0x1c46a8){return _0x1c46a8;});}return null;};}function removeEntity(_0x4fb7bf,_0x5823bc){return function(_0x341d67){if(_0x341d67){return _0x341d67[_0x9edd('0x21')]()[_0x9edd('0x20')](function(){var _0x542172=_0x341d67[_0x9edd('0x22')]({'plain':!![]});var _0x1dca43=_0x9edd('0x23');return db[_0x9edd('0x24')][_0x9edd('0x21')]({'where':{'type':_0x1dca43,'resourceId':_0x542172['id']}})['then'](function(){return _0x341d67;});})[_0x9edd('0x20')](function(){_0x4fb7bf[_0x9edd('0x17')](0xcc)[_0x9edd('0x18')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x25')](_0x8d67aa[_0x9edd('0x26')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x17')](_0xfeca7b)[_0x9edd('0x27')](_0x8d67aa);};}exports[_0x9edd('0x28')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=db[_0x9edd('0x29')][_0x9edd('0x2a')];_0x2ae8dd[_0x9edd('0x2b')]=_[_0x9edd('0x2c')](_0x5eccfb);_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x2c')](_0x52746a[_0x9edd('0x2d')]);_0x2ae8dd[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x2ae8dd[_0x9edd('0x2b')],_0x2ae8dd[_0x9edd('0x2d')]);_0x28cfae[_0x9edd('0x30')]=_[_0x9edd('0x2f')](_0x2ae8dd[_0x9edd('0x2b')],qs[_0x9edd('0x31')](_0x52746a['query'][_0x9edd('0x31')]));_0x28cfae[_0x9edd('0x30')]=_0x28cfae[_0x9edd('0x30')]['length']?_0x28cfae[_0x9edd('0x30')]:_0x2ae8dd[_0x9edd('0x2b')];if(!_0x52746a[_0x9edd('0x2d')][_0x9edd('0x32')](_0x9edd('0x33'))){_0x28cfae[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x52746a[_0x9edd('0x2d')][_0x9edd('0x1c')]);_0x28cfae[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x52746a[_0x9edd('0x2d')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x34')]=qs['sort'](_0x52746a[_0x9edd('0x2d')]['sort']);_0x28cfae[_0x9edd('0x35')]=qs[_0x9edd('0x2e')](_[_0x9edd('0x36')](_0x52746a[_0x9edd('0x2d')],_0x2ae8dd[_0x9edd('0x2e')]));if(_0x52746a['query'][_0x9edd('0x37')]){_0x28cfae[_0x9edd('0x35')]=_[_0x9edd('0x38')](_0x28cfae[_0x9edd('0x35')],{'$or':_[_0x9edd('0x39')](_0x5eccfb,function(_0x337e6c){if(_0x337e6c[_0x9edd('0x3a')][_0x9edd('0x3b')]!==_0x9edd('0x3c')){var _0x35c16f={};_0x35c16f[_0x337e6c['field']]={'$like':'%'+_0x52746a[_0x9edd('0x2d')]['filter']+'%'};return _0x35c16f;}})});}_0x28cfae=_[_0x9edd('0x38')]({},_0x28cfae,_0x52746a['options']);var _0x30883e={'where':_0x28cfae[_0x9edd('0x35')]};return db[_0x9edd('0x29')]['count'](_0x30883e)[_0x9edd('0x20')](function(_0xcbd0ef){_0x41af53[_0x9edd('0x1a')]=_0xcbd0ef;if(_0x52746a['query'][_0x9edd('0x3d')]){_0x28cfae['include']=[{'all':!![]}];}return db[_0x9edd('0x29')][_0x9edd('0x3e')](_0x28cfae);})['then'](function(_0x315f52){_0x41af53[_0x9edd('0x3f')]=_0x315f52;return _0x41af53;})[_0x9edd('0x20')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x40')](handleError(_0x238b22,null));};exports['show']=function(_0x449f01,_0x5bbdf8){var _0x2bdb3f={'raw':!![],'where':{'id':_0x449f01['params']['id']}},_0xc1e657={};_0xc1e657[_0x9edd('0x2b')]=_['keys'](db['Template'][_0x9edd('0x2a')]);_0xc1e657[_0x9edd('0x2d')]=_[_0x9edd('0x2c')](_0x449f01[_0x9edd('0x2d')]);_0xc1e657[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0xc1e657[_0x9edd('0x2b')],_0xc1e657[_0x9edd('0x2d')]);_0x2bdb3f[_0x9edd('0x30')]=_[_0x9edd('0x2f')](_0xc1e657[_0x9edd('0x2b')],qs[_0x9edd('0x31')](_0x449f01[_0x9edd('0x2d')][_0x9edd('0x31')]));_0x2bdb3f[_0x9edd('0x30')]=_0x2bdb3f['attributes'][_0x9edd('0x41')]?_0x2bdb3f[_0x9edd('0x30')]:_0xc1e657[_0x9edd('0x2b')];if(_0x449f01[_0x9edd('0x2d')][_0x9edd('0x3d')]){_0x2bdb3f[_0x9edd('0x42')]=[{'all':!![]}];}_0x2bdb3f=_[_0x9edd('0x38')]({},_0x2bdb3f,_0x449f01['options']);return db['Template']['find'](_0x2bdb3f)[_0x9edd('0x20')](handleEntityNotFound(_0x5bbdf8,null))['then'](respondWithResult(_0x5bbdf8,null))[_0x9edd('0x40')](handleError(_0x5bbdf8,null));};exports[_0x9edd('0x43')]=function(_0x2b06d3,_0x8db801){return db[_0x9edd('0x29')]['create'](_0x2b06d3[_0x9edd('0x44')],{})[_0x9edd('0x20')](function(_0x40e33d){var _0x4a89ae=_0x2b06d3[_0x9edd('0x45')][_0x9edd('0x22')]({'plain':!![]});if(!_0x4a89ae)throw new Error(_0x9edd('0x46'));if(_0x4a89ae[_0x9edd('0x47')]===_0x9edd('0x45')){var _0x35bdec=_0x40e33d['get']({'plain':!![]});var _0x441e4a=_0x9edd('0x23');return db['UserProfileSection'][_0x9edd('0x48')]({'where':{'name':_0x441e4a,'userProfileId':_0x4a89ae[_0x9edd('0x49')]},'raw':!![]})['then'](function(_0x2bd089){if(_0x2bd089&&_0x2bd089[_0x9edd('0x4a')]===0x0){return db[_0x9edd('0x24')]['create']({'name':_0x35bdec[_0x9edd('0x4b')],'resourceId':_0x35bdec['id'],'type':_0x2bd089[_0x9edd('0x4b')],'sectionId':_0x2bd089['id']},{})[_0x9edd('0x20')](function(){return _0x40e33d;});}else{return _0x40e33d;}})[_0x9edd('0x40')](function(_0x53f6e3){logger[_0x9edd('0x25')](_0x9edd('0x4c'),_0x53f6e3);throw _0x53f6e3;});}return _0x40e33d;})[_0x9edd('0x20')](respondWithResult(_0x8db801,0xc9))['catch'](handleError(_0x8db801,null));};exports[_0x9edd('0x4d')]=function(_0x21f6ce,_0x57db43){if(_0x21f6ce[_0x9edd('0x44')]['id']){delete _0x21f6ce['body']['id'];}return db[_0x9edd('0x29')][_0x9edd('0x48')]({'where':{'id':_0x21f6ce[_0x9edd('0x4e')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x57db43,null))[_0x9edd('0x20')](saveUpdates(_0x21f6ce[_0x9edd('0x44')],null))[_0x9edd('0x20')](respondWithResult(_0x57db43,null))[_0x9edd('0x40')](handleError(_0x57db43,null));};exports[_0x9edd('0x21')]=function(_0x25d9cc,_0x31272d){return db['Template'][_0x9edd('0x48')]({'where':{'id':_0x25d9cc[_0x9edd('0x4e')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x31272d,null))['then'](removeEntity(_0x31272d,null))[_0x9edd('0x40')](handleError(_0x31272d,null));}; \ No newline at end of file +var _0x9c44=['sendStatus','status','json','count','offset','limit','save','update','then','Templates','UserProfileResource','destroy','end','stack','name','send','index','Template','rawAttributes','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x3cd336,_0x2fe53f){var _0x5e6421=function(_0x4dde3e){while(--_0x4dde3e){_0x3cd336['push'](_0x3cd336['shift']());}};_0x5e6421(++_0x2fe53f);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 hardwareService=require(_0x49c4('0x10'));var logger=require('../../config/logger')(_0x49c4('0x11'));var utils=require(_0x49c4('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d19bf,_0x6d1b08){_0x6d1b08=_0x6d1b08||0xcc;return function(_0x5487cd){if(_0x5487cd){return _0x1d19bf[_0x49c4('0x13')](_0x6d1b08);}return _0x1d19bf[_0x49c4('0x14')](_0x6d1b08)['end']();};}function respondWithResult(_0x1909fe,_0x280996){_0x280996=_0x280996||0xc8;return function(_0x21f15a){if(_0x21f15a){return _0x1909fe[_0x49c4('0x14')](_0x280996)[_0x49c4('0x15')](_0x21f15a);}};}function respondWithFilteredResult(_0x18211c,_0x75ea8){return function(_0x3de397){if(_0x3de397){var _0x58d177=_0x3de397[_0x49c4('0x16')],_0x3acd06=_0x75ea8[_0x49c4('0x17')],_0x141003=_0x75ea8['offset']+_0x75ea8[_0x49c4('0x18')],_0x13a2db;if(_0x141003>=_0x58d177){_0x141003=_0x58d177;_0x13a2db=0xc8;}else{_0x13a2db=0xce;}_0x18211c[_0x49c4('0x14')](_0x13a2db);return _0x18211c['set']('Content-Range',_0x3acd06+'-'+_0x141003+'/'+_0x58d177)[_0x49c4('0x15')](_0x3de397);}return null;};}function patchUpdates(_0x2f82d5){return function(_0x3addb2){try{jsonpatch['apply'](_0x3addb2,_0x2f82d5,!![]);}catch(_0x24856d){return BPromise['reject'](_0x24856d);}return _0x3addb2[_0x49c4('0x19')]();};}function saveUpdates(_0x1806c2,_0xe31fcc){return function(_0x291526){if(_0x291526){return _0x291526[_0x49c4('0x1a')](_0x1806c2)[_0x49c4('0x1b')](function(_0x280893){return _0x280893;});}return null;};}function removeEntity(_0x46e475,_0x2197d2){return function(_0x578447){if(_0x578447){return _0x578447['destroy']()['then'](function(){var _0x1c99b1=_0x578447['get']({'plain':!![]});var _0x592bb8=_0x49c4('0x1c');return db[_0x49c4('0x1d')][_0x49c4('0x1e')]({'where':{'type':_0x592bb8,'resourceId':_0x1c99b1['id']}})[_0x49c4('0x1b')](function(){return _0x578447;});})['then'](function(){_0x46e475['status'](0xcc)[_0x49c4('0x1f')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x13')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x20')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x21')];}_0x210159[_0x49c4('0x14')](_0xa7a826)[_0x49c4('0x22')](_0x531d92);};}exports[_0x49c4('0x23')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=db[_0x49c4('0x24')][_0x49c4('0x25')];_0x46e04d[_0x49c4('0x26')]=_[_0x49c4('0x27')](_0x6329b3);_0x46e04d[_0x49c4('0x28')]=_[_0x49c4('0x27')](_0x5987ae['query']);_0x46e04d['filters']=_['intersection'](_0x46e04d[_0x49c4('0x26')],_0x46e04d[_0x49c4('0x28')]);_0x2b2793[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x46e04d[_0x49c4('0x26')],qs['fields'](_0x5987ae[_0x49c4('0x28')][_0x49c4('0x2b')]));_0x2b2793[_0x49c4('0x29')]=_0x2b2793[_0x49c4('0x29')]['length']?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x26')];if(!_0x5987ae[_0x49c4('0x28')][_0x49c4('0x2c')](_0x49c4('0x2d'))){_0x2b2793[_0x49c4('0x18')]=qs['limit'](_0x5987ae[_0x49c4('0x28')][_0x49c4('0x18')]);_0x2b2793[_0x49c4('0x17')]=qs['offset'](_0x5987ae['query'][_0x49c4('0x17')]);}_0x2b2793[_0x49c4('0x2e')]=qs[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x28')][_0x49c4('0x2f')]);_0x2b2793[_0x49c4('0x30')]=qs[_0x49c4('0x31')](_[_0x49c4('0x32')](_0x5987ae[_0x49c4('0x28')],_0x46e04d['filters']));if(_0x5987ae[_0x49c4('0x28')]['filter']){_0x2b2793[_0x49c4('0x30')]=_[_0x49c4('0x33')](_0x2b2793[_0x49c4('0x30')],{'$or':_[_0x49c4('0x34')](_0x6329b3,function(_0x4ed4f8){if(_0x4ed4f8[_0x49c4('0x35')][_0x49c4('0x36')]!==_0x49c4('0x37')){var _0x4e913a={};_0x4e913a[_0x4ed4f8[_0x49c4('0x38')]]={'$like':'%'+_0x5987ae[_0x49c4('0x28')][_0x49c4('0x39')]+'%'};return _0x4e913a;}})});}_0x2b2793=_[_0x49c4('0x33')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3a')]);var _0x24c177={'where':_0x2b2793[_0x49c4('0x30')]};return db[_0x49c4('0x24')][_0x49c4('0x16')](_0x24c177)[_0x49c4('0x1b')](function(_0x1e506a){_0x4f28a2['count']=_0x1e506a;if(_0x5987ae[_0x49c4('0x28')][_0x49c4('0x3b')]){_0x2b2793[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x24')][_0x49c4('0x3d')](_0x2b2793);})[_0x49c4('0x1b')](function(_0x1be62d){_0x4f28a2[_0x49c4('0x3e')]=_0x1be62d;return _0x4f28a2;})[_0x49c4('0x1b')](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x3f')](handleError(_0x889909,null));};exports[_0x49c4('0x40')]=function(_0xa3d59e,_0x326142){var _0x4e38bc={'raw':!![],'where':{'id':_0xa3d59e['params']['id']}},_0x212366={};_0x212366[_0x49c4('0x26')]=_[_0x49c4('0x27')](db[_0x49c4('0x24')][_0x49c4('0x25')]);_0x212366[_0x49c4('0x28')]=_[_0x49c4('0x27')](_0xa3d59e['query']);_0x212366['filters']=_[_0x49c4('0x2a')](_0x212366[_0x49c4('0x26')],_0x212366[_0x49c4('0x28')]);_0x4e38bc[_0x49c4('0x29')]=_['intersection'](_0x212366[_0x49c4('0x26')],qs[_0x49c4('0x2b')](_0xa3d59e[_0x49c4('0x28')][_0x49c4('0x2b')]));_0x4e38bc[_0x49c4('0x29')]=_0x4e38bc[_0x49c4('0x29')][_0x49c4('0x41')]?_0x4e38bc[_0x49c4('0x29')]:_0x212366[_0x49c4('0x26')];if(_0xa3d59e['query'][_0x49c4('0x3b')]){_0x4e38bc['include']=[{'all':!![]}];}_0x4e38bc=_[_0x49c4('0x33')]({},_0x4e38bc,_0xa3d59e[_0x49c4('0x3a')]);return db[_0x49c4('0x24')][_0x49c4('0x42')](_0x4e38bc)[_0x49c4('0x1b')](handleEntityNotFound(_0x326142,null))['then'](respondWithResult(_0x326142,null))[_0x49c4('0x3f')](handleError(_0x326142,null));};exports[_0x49c4('0x43')]=function(_0x384862,_0x254d07){return db[_0x49c4('0x24')][_0x49c4('0x43')](_0x384862[_0x49c4('0x44')],{})['then'](function(_0x3bac1b){var _0x5cfff9=_0x384862[_0x49c4('0x45')][_0x49c4('0x46')]({'plain':!![]});if(!_0x5cfff9)throw new Error(_0x49c4('0x47'));if(_0x5cfff9[_0x49c4('0x48')]===_0x49c4('0x45')){var _0x30bea5=_0x3bac1b[_0x49c4('0x46')]({'plain':!![]});var _0x506c71=_0x49c4('0x1c');return db[_0x49c4('0x49')]['find']({'where':{'name':_0x506c71,'userProfileId':_0x5cfff9[_0x49c4('0x4a')]},'raw':!![]})[_0x49c4('0x1b')](function(_0xfbe179){if(_0xfbe179&&_0xfbe179[_0x49c4('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x30bea5[_0x49c4('0x21')],'resourceId':_0x30bea5['id'],'type':_0xfbe179['name'],'sectionId':_0xfbe179['id']},{})[_0x49c4('0x1b')](function(){return _0x3bac1b;});}else{return _0x3bac1b;}})[_0x49c4('0x3f')](function(_0x3811b2){logger[_0x49c4('0x4c')](_0x49c4('0x4d'),_0x3811b2);throw _0x3811b2;});}return _0x3bac1b;})[_0x49c4('0x1b')](respondWithResult(_0x254d07,0xc9))[_0x49c4('0x3f')](handleError(_0x254d07,null));};exports['update']=function(_0x1f26c2,_0x1550ce){if(_0x1f26c2[_0x49c4('0x44')]['id']){delete _0x1f26c2[_0x49c4('0x44')]['id'];}return db[_0x49c4('0x24')][_0x49c4('0x42')]({'where':{'id':_0x1f26c2[_0x49c4('0x4e')]['id']}})[_0x49c4('0x1b')](handleEntityNotFound(_0x1550ce,null))[_0x49c4('0x1b')](saveUpdates(_0x1f26c2[_0x49c4('0x44')],null))['then'](respondWithResult(_0x1550ce,null))['catch'](handleError(_0x1550ce,null));};exports[_0x49c4('0x1e')]=function(_0x3f9a9d,_0x527e74){return db['Template'][_0x49c4('0x42')]({'where':{'id':_0x3f9a9d['params']['id']}})['then'](handleEntityNotFound(_0x527e74,null))[_0x49c4('0x1b')](removeEntity(_0x527e74,null))[_0x49c4('0x3f')](handleError(_0x527e74,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9290d85..d8be3e9 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 _0x4095=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./template.attributes','exports','Template','tools_templates','lodash'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x4095,0xd0));var _0x5409=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x4095[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0x5409('0x0'));var util=require(_0x5409('0x1'));var logger=require(_0x5409('0x2'))('api');var moment=require(_0x5409('0x3'));var BPromise=require(_0x5409('0x4'));var rp=require(_0x5409('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5409('0x6'));var config=require('../../config/environment');var attributes=require(_0x5409('0x7'));module[_0x5409('0x8')]=function(_0x1d8535,_0x41b139){return _0x1d8535['define'](_0x5409('0x9'),attributes,{'tableName':_0x5409('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa06=['./template.attributes','exports','define','tools_templates','util','api','moment','request-promise','rimraf'];(function(_0x25cdc0,_0x76ef1){var _0x302fa4=function(_0x4b1f9a){while(--_0x4b1f9a){_0x25cdc0['push'](_0x25cdc0['shift']());}};_0x302fa4(++_0x76ef1);}(_0xaa06,0x1bd));var _0x6aa0=function(_0x9af8d6,_0x41b605){_0x9af8d6=_0x9af8d6-0x0;var _0x26a74e=_0xaa06[_0x9af8d6];return _0x26a74e;};'use strict';var _=require('lodash');var util=require(_0x6aa0('0x0'));var logger=require('../../config/logger')(_0x6aa0('0x1'));var moment=require(_0x6aa0('0x2'));var BPromise=require('bluebird');var rp=require(_0x6aa0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6aa0('0x4'));var config=require('../../config/environment');var attributes=require(_0x6aa0('0x5'));module[_0x6aa0('0x6')]=function(_0x37062a,_0x156cca){return _0x37062a[_0x6aa0('0x7')]('Template',attributes,{'tableName':_0x6aa0('0x8'),'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 5e62aef..600756a 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 _0xabe7=['GetTemplate','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template','options','raw','where','attributes','limit','include','map','model'];(function(_0x26fb85,_0x35576f){var _0x13e0f9=function(_0x40537f){while(--_0x40537f){_0x26fb85['push'](_0x26fb85['shift']());}};_0x13e0f9(++_0x35576f);}(_0xabe7,0xc2));var _0x7abe=function(_0x45f77d,_0x3c3ef9){_0x45f77d=_0x45f77d-0x0;var _0x5259b9=_0xabe7[_0x45f77d];return _0x5259b9;};'use strict';var _=require(_0x7abe('0x0'));var util=require('util');var moment=require(_0x7abe('0x1'));var BPromise=require(_0x7abe('0x2'));var rs=require(_0x7abe('0x3'));var fs=require('fs');var Redis=require(_0x7abe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7abe('0x5'));var logger=require(_0x7abe('0x6'))(_0x7abe('0x7'));var config=require(_0x7abe('0x8'));var jayson=require(_0x7abe('0x9'));var client=jayson['client'][_0x7abe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35f320,_0x515118,_0x59cd09){return new BPromise(function(_0x3c1370,_0x3005ae){return client['request'](_0x35f320,_0x59cd09)[_0x7abe('0xb')](function(_0x5a4976){logger[_0x7abe('0xc')](_0x7abe('0xd'),_0x515118,_0x7abe('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x515118,_0x7abe('0xe'),JSON[_0x7abe('0xf')](_0x5a4976));if(_0x5a4976['error']){if(_0x5a4976[_0x7abe('0x10')][_0x7abe('0x11')]===0x1f4){logger['error'](_0x7abe('0xd'),_0x515118,_0x5a4976['error']['message']);return _0x3005ae(_0x5a4976[_0x7abe('0x10')]['message']);}logger[_0x7abe('0x10')](_0x7abe('0xd'),_0x515118,_0x5a4976[_0x7abe('0x10')][_0x7abe('0x12')]);return _0x3c1370(_0x5a4976[_0x7abe('0x10')][_0x7abe('0x12')]);}else{logger[_0x7abe('0xc')](_0x7abe('0xd'),_0x515118,'request\x20sent');_0x3c1370(_0x5a4976[_0x7abe('0x13')][_0x7abe('0x12')]);}})[_0x7abe('0x14')](function(_0x412aa0){logger[_0x7abe('0x10')]('Template,\x20%s,\x20%s',_0x515118,_0x412aa0);_0x3005ae(_0x412aa0);});});}exports['GetTemplate']=function(_0x14261f){var _0x48350b=this;return new Promise(function(_0xdc8a59,_0x302f81){return db[_0x7abe('0x15')]['findAll']({'raw':_0x14261f[_0x7abe('0x16')]?_0x14261f[_0x7abe('0x16')][_0x7abe('0x17')]===undefined?!![]:![]:!![],'where':_0x14261f[_0x7abe('0x16')]?_0x14261f['options'][_0x7abe('0x18')]||null:null,'attributes':_0x14261f['options']?_0x14261f[_0x7abe('0x16')][_0x7abe('0x19')]||null:null,'limit':_0x14261f[_0x7abe('0x16')]?_0x14261f[_0x7abe('0x16')][_0x7abe('0x1a')]||null:null,'include':_0x14261f[_0x7abe('0x16')]?_0x14261f['options'][_0x7abe('0x1b')]?_[_0x7abe('0x1c')](_0x14261f[_0x7abe('0x16')][_0x7abe('0x1b')],function(_0x5b6cdf){return{'model':db[_0x5b6cdf['model']],'as':_0x5b6cdf['as'],'attributes':_0x5b6cdf[_0x7abe('0x19')],'include':_0x5b6cdf[_0x7abe('0x1b')]?_[_0x7abe('0x1c')](_0x5b6cdf[_0x7abe('0x1b')],function(_0x59a341){return{'model':db[_0x59a341[_0x7abe('0x1d')]],'as':_0x59a341['as'],'attributes':_0x59a341[_0x7abe('0x19')],'include':_0x59a341[_0x7abe('0x1b')]?_[_0x7abe('0x1c')](_0x59a341[_0x7abe('0x1b')],function(_0x17cb24){return{'model':db[_0x17cb24[_0x7abe('0x1d')]],'as':_0x17cb24['as'],'attributes':_0x17cb24[_0x7abe('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7abe('0xb')](function(_0x385578){logger[_0x7abe('0xc')](_0x7abe('0x1e'),_0x14261f);logger[_0x7abe('0x1f')](_0x7abe('0x1e'),_0x14261f,JSON[_0x7abe('0xf')](_0x385578));_0xdc8a59(_0x385578);})[_0x7abe('0x14')](function(_0x1e8554){logger[_0x7abe('0x10')]('GetTemplate',_0x1e8554[_0x7abe('0x12')],_0x14261f);_0x302f81(_0x48350b[_0x7abe('0x10')](0x1f4,_0x1e8554[_0x7abe('0x12')]));});});}; \ No newline at end of file +var _0xaff3=['stringify','error','message','result','catch','Template','findAll','options','raw','where','attributes','include','map','model','GetTemplate','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaff3,0xaa));var _0x3aff=function(_0x230bb0,_0x3636a6){_0x230bb0=_0x230bb0-0x0;var _0x4164d4=_0xaff3[_0x230bb0];return _0x4164d4;};'use strict';var _=require('lodash');var util=require(_0x3aff('0x0'));var moment=require(_0x3aff('0x1'));var BPromise=require('bluebird');var rs=require(_0x3aff('0x2'));var fs=require('fs');var Redis=require(_0x3aff('0x3'));var db=require(_0x3aff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3aff('0x5'))(_0x3aff('0x6'));var config=require('../../config/environment');var jayson=require(_0x3aff('0x7'));var client=jayson[_0x3aff('0x8')][_0x3aff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ec607,_0xcb68e4,_0x2cc102){return new BPromise(function(_0x4bfa3a,_0x5f4486){return client['request'](_0x4ec607,_0x2cc102)[_0x3aff('0xa')](function(_0x11d567){logger[_0x3aff('0xb')](_0x3aff('0xc'),_0xcb68e4,'request\x20sent');logger[_0x3aff('0xd')](_0x3aff('0xe'),_0xcb68e4,_0x3aff('0xf'),JSON[_0x3aff('0x10')](_0x11d567));if(_0x11d567[_0x3aff('0x11')]){if(_0x11d567[_0x3aff('0x11')]['code']===0x1f4){logger[_0x3aff('0x11')]('Template,\x20%s,\x20%s',_0xcb68e4,_0x11d567[_0x3aff('0x11')][_0x3aff('0x12')]);return _0x5f4486(_0x11d567[_0x3aff('0x11')][_0x3aff('0x12')]);}logger[_0x3aff('0x11')]('Template,\x20%s,\x20%s',_0xcb68e4,_0x11d567['error'][_0x3aff('0x12')]);return _0x4bfa3a(_0x11d567[_0x3aff('0x11')][_0x3aff('0x12')]);}else{logger[_0x3aff('0xb')](_0x3aff('0xc'),_0xcb68e4,'request\x20sent');_0x4bfa3a(_0x11d567[_0x3aff('0x13')]['message']);}})[_0x3aff('0x14')](function(_0x5b091d){logger[_0x3aff('0x11')](_0x3aff('0xc'),_0xcb68e4,_0x5b091d);_0x5f4486(_0x5b091d);});});}exports['GetTemplate']=function(_0x532a31){var _0x59e816=this;return new Promise(function(_0x4eef02,_0x4c5793){return db[_0x3aff('0x15')][_0x3aff('0x16')]({'raw':_0x532a31['options']?_0x532a31[_0x3aff('0x17')][_0x3aff('0x18')]===undefined?!![]:![]:!![],'where':_0x532a31[_0x3aff('0x17')]?_0x532a31[_0x3aff('0x17')][_0x3aff('0x19')]||null:null,'attributes':_0x532a31[_0x3aff('0x17')]?_0x532a31['options'][_0x3aff('0x1a')]||null:null,'limit':_0x532a31['options']?_0x532a31['options']['limit']||null:null,'include':_0x532a31[_0x3aff('0x17')]?_0x532a31['options'][_0x3aff('0x1b')]?_[_0x3aff('0x1c')](_0x532a31[_0x3aff('0x17')][_0x3aff('0x1b')],function(_0x258656){return{'model':db[_0x258656[_0x3aff('0x1d')]],'as':_0x258656['as'],'attributes':_0x258656[_0x3aff('0x1a')],'include':_0x258656[_0x3aff('0x1b')]?_['map'](_0x258656['include'],function(_0x13736c){return{'model':db[_0x13736c['model']],'as':_0x13736c['as'],'attributes':_0x13736c[_0x3aff('0x1a')],'include':_0x13736c['include']?_[_0x3aff('0x1c')](_0x13736c[_0x3aff('0x1b')],function(_0x5565de){return{'model':db[_0x5565de['model']],'as':_0x5565de['as'],'attributes':_0x5565de[_0x3aff('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3aff('0xa')](function(_0x40907f){logger[_0x3aff('0xb')](_0x3aff('0x1e'),_0x532a31);logger[_0x3aff('0xd')]('GetTemplate',_0x532a31,JSON[_0x3aff('0x10')](_0x40907f));_0x4eef02(_0x40907f);})[_0x3aff('0x14')](function(_0x42d3d2){logger[_0x3aff('0x11')](_0x3aff('0x1e'),_0x42d3d2[_0x3aff('0x12')],_0x532a31);_0x4c5793(_0x59e816[_0x3aff('0x11')](0x1f4,_0x42d3d2['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 98d7d8e..157f023 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 _0x316d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','get','show','getAllConditions','/:id/any_conditions','/:id/actions','post','create','addAllCondition','addAnyCondition','/:id','destroy','multer','util','connect-timeout','express','Router'];(function(_0x13a257,_0x1bd3c0){var _0x1ec3ff=function(_0x18a2fa){while(--_0x18a2fa){_0x13a257['push'](_0x13a257['shift']());}};_0x1ec3ff(++_0x1bd3c0);}(_0x316d,0x14b));var _0xd316=function(_0x414e75,_0x440af3){_0x414e75=_0x414e75-0x0;var _0x1dae24=_0x316d[_0x414e75];return _0x1dae24;};'use strict';var multer=require(_0xd316('0x0'));var util=require(_0xd316('0x1'));var path=require('path');var timeout=require(_0xd316('0x2'));var express=require(_0xd316('0x3'));var router=express[_0xd316('0x4')]();var auth=require(_0xd316('0x5'));var interaction=require(_0xd316('0x6'));var config=require(_0xd316('0x7'));var controller=require(_0xd316('0x8'));router['get']('/',auth[_0xd316('0x9')](),controller['index']);router[_0xd316('0xa')]('/:id',auth[_0xd316('0x9')](),controller[_0xd316('0xb')]);router[_0xd316('0xa')]('/:id/all_conditions',auth[_0xd316('0x9')](),controller[_0xd316('0xc')]);router['get'](_0xd316('0xd'),auth[_0xd316('0x9')](),controller['getAnyConditions']);router['get'](_0xd316('0xe'),auth[_0xd316('0x9')](),controller['getActions']);router[_0xd316('0xf')]('/',auth['isAuthenticated'](),controller[_0xd316('0x10')]);router[_0xd316('0xf')]('/:id/all_conditions',auth[_0xd316('0x9')](),controller[_0xd316('0x11')]);router[_0xd316('0xf')](_0xd316('0xd'),auth['isAuthenticated'](),controller[_0xd316('0x12')]);router[_0xd316('0xf')](_0xd316('0xe'),auth[_0xd316('0x9')](),controller['addAction']);router['put'](_0xd316('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd316('0x13'),auth[_0xd316('0x9')](),controller[_0xd316('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc2f4=['post','addAllCondition','/:id/any_conditions','addAction','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','show','/:id/all_conditions','getAnyConditions','/:id/actions','getActions'];(function(_0xeceed2,_0x1167ab){var _0x2ddb79=function(_0x4d5760){while(--_0x4d5760){_0xeceed2['push'](_0xeceed2['shift']());}};_0x2ddb79(++_0x1167ab);}(_0xc2f4,0x1ae));var _0x4c2f=function(_0x1a62bb,_0x157e87){_0x1a62bb=_0x1a62bb-0x0;var _0x4ade6f=_0xc2f4[_0x1a62bb];return _0x4ade6f;};'use strict';var multer=require(_0x4c2f('0x0'));var util=require(_0x4c2f('0x1'));var path=require(_0x4c2f('0x2'));var timeout=require(_0x4c2f('0x3'));var express=require(_0x4c2f('0x4'));var router=express[_0x4c2f('0x5')]();var auth=require(_0x4c2f('0x6'));var interaction=require(_0x4c2f('0x7'));var config=require(_0x4c2f('0x8'));var controller=require(_0x4c2f('0x9'));router['get']('/',auth[_0x4c2f('0xa')](),controller[_0x4c2f('0xb')]);router[_0x4c2f('0xc')]('/:id',auth[_0x4c2f('0xa')](),controller[_0x4c2f('0xd')]);router['get'](_0x4c2f('0xe'),auth[_0x4c2f('0xa')](),controller['getAllConditions']);router[_0x4c2f('0xc')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x4c2f('0xf')]);router['get'](_0x4c2f('0x10'),auth[_0x4c2f('0xa')](),controller[_0x4c2f('0x11')]);router[_0x4c2f('0x12')]('/',auth[_0x4c2f('0xa')](),controller['create']);router['post'](_0x4c2f('0xe'),auth[_0x4c2f('0xa')](),controller[_0x4c2f('0x13')]);router[_0x4c2f('0x12')](_0x4c2f('0x14'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x4c2f('0x12')](_0x4c2f('0x10'),auth[_0x4c2f('0xa')](),controller[_0x4c2f('0x15')]);router[_0x4c2f('0x16')](_0x4c2f('0x17'),auth[_0x4c2f('0xa')](),controller[_0x4c2f('0x18')]);router[_0x4c2f('0x19')](_0x4c2f('0x17'),auth['isAuthenticated'](),controller[_0x4c2f('0x1a')]);module[_0x4c2f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 48a7482..4a0804b 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 _0x0578=['STRING','BOOLEAN','sequelize','exports'];(function(_0x371187,_0xe7b303){var _0x37eaae=function(_0x51d843){while(--_0x51d843){_0x371187['push'](_0x371187['shift']());}};_0x37eaae(++_0xe7b303);}(_0x0578,0x126));var _0x8057=function(_0x451ba5,_0x2f3a05){_0x451ba5=_0x451ba5-0x0;var _0x4550fb=_0x0578[_0x451ba5];return _0x4550fb;};'use strict';var Sequelize=require(_0x8057('0x0'));module[_0x8057('0x1')]={'name':{'type':Sequelize[_0x8057('0x2')]},'channel':{'type':Sequelize[_0x8057('0x2')]},'description':{'type':Sequelize[_0x8057('0x2')]},'status':{'type':Sequelize[_0x8057('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x94e3=['STRING','sequelize','exports'];(function(_0x47a2f4,_0x17e3b2){var _0x3e6c85=function(_0x396d2f){while(--_0x396d2f){_0x47a2f4['push'](_0x47a2f4['shift']());}};_0x3e6c85(++_0x17e3b2);}(_0x94e3,0x1f3));var _0x394e=function(_0x2f8330,_0x3f902e){_0x2f8330=_0x2f8330-0x0;var _0x19d776=_0x94e3[_0x2f8330];return _0x19d776;};'use strict';var Sequelize=require(_0x394e('0x0'));module[_0x394e('0x1')]={'name':{'type':Sequelize[_0x394e('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x394e('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index f0ea043..0c16d61 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 _0x629e=['options','includeAll','include','Trigger','findAll','catch','show','params','keys','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','map','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','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','limit','set','apply','save','then','destroy','get','Triggers','UserProfileResource','stack','send','index','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field'];(function(_0x4bdff7,_0xaa1020){var _0xfb8f15=function(_0x37bdad){while(--_0x37bdad){_0x4bdff7['push'](_0x4bdff7['shift']());}};_0xfb8f15(++_0xaa1020);}(_0x629e,0x18f));var _0xe629=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x629e[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0xe629('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe629('0x1'));var rp=require(_0xe629('0x2'));var moment=require(_0xe629('0x3'));var BPromise=require(_0xe629('0x4'));var Mustache=require(_0xe629('0x5'));var util=require(_0xe629('0x6'));var path=require(_0xe629('0x7'));var sox=require('sox');var csv=require(_0xe629('0x8'));var ejs=require(_0xe629('0x9'));var fs=require('fs');var _=require(_0xe629('0xa'));var squel=require(_0xe629('0xb'));var crypto=require('crypto');var jsforce=require(_0xe629('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe629('0x8'));var querystring=require(_0xe629('0xd'));var Papa=require('papaparse');var Redis=require(_0xe629('0xe'));var authService=require(_0xe629('0xf'));var qs=require(_0xe629('0x10'));var hardwareService=require(_0xe629('0x11'));var logger=require(_0xe629('0x12'))(_0xe629('0x13'));var utils=require(_0xe629('0x14'));var config=require(_0xe629('0x15'));var db=require(_0xe629('0x16'))['db'];function respondWithStatusCode(_0x1eb632,_0x5a384d){_0x5a384d=_0x5a384d||0xcc;return function(_0x46535e){if(_0x46535e){return _0x1eb632[_0xe629('0x17')](_0x5a384d);}return _0x1eb632[_0xe629('0x18')](_0x5a384d)[_0xe629('0x19')]();};}function respondWithResult(_0x55bdaa,_0x5e3791){_0x5e3791=_0x5e3791||0xc8;return function(_0x421e72){if(_0x421e72){return _0x55bdaa[_0xe629('0x18')](_0x5e3791)[_0xe629('0x1a')](_0x421e72);}};}function respondWithFilteredResult(_0x35cdaa,_0x59e8a9){return function(_0x4efeb9){if(_0x4efeb9){var _0x4a0fe4=_0x4efeb9[_0xe629('0x1b')],_0x1aaf02=_0x59e8a9[_0xe629('0x1c')],_0x17e651=_0x59e8a9[_0xe629('0x1c')]+_0x59e8a9[_0xe629('0x1d')],_0x3208c2;if(_0x17e651>=_0x4a0fe4){_0x17e651=_0x4a0fe4;_0x3208c2=0xc8;}else{_0x3208c2=0xce;}_0x35cdaa[_0xe629('0x18')](_0x3208c2);return _0x35cdaa[_0xe629('0x1e')]('Content-Range',_0x1aaf02+'-'+_0x17e651+'/'+_0x4a0fe4)['json'](_0x4efeb9);}return null;};}function patchUpdates(_0x20af66){return function(_0x2b200a){try{jsonpatch[_0xe629('0x1f')](_0x2b200a,_0x20af66,!![]);}catch(_0x13f430){return BPromise['reject'](_0x13f430);}return _0x2b200a[_0xe629('0x20')]();};}function saveUpdates(_0x5736ef,_0x3de69e){return function(_0x2fd7ad){if(_0x2fd7ad){return _0x2fd7ad['update'](_0x5736ef)[_0xe629('0x21')](function(_0x43baae){return _0x43baae;});}return null;};}function removeEntity(_0x2af5bc,_0xb59849){return function(_0x219e6b){if(_0x219e6b){return _0x219e6b[_0xe629('0x22')]()[_0xe629('0x21')](function(){var _0x56a140=_0x219e6b[_0xe629('0x23')]({'plain':!![]});var _0x2a408a=_0xe629('0x24');return db[_0xe629('0x25')][_0xe629('0x22')]({'where':{'type':_0x2a408a,'resourceId':_0x56a140['id']}})[_0xe629('0x21')](function(){return _0x219e6b;});})['then'](function(){_0x2af5bc[_0xe629('0x18')](0xcc)[_0xe629('0x19')]();});}};}function handleEntityNotFound(_0x448ec2,_0xd0baa1){return function(_0x54398c){if(!_0x54398c){_0x448ec2[_0xe629('0x17')](0x194);}return _0x54398c;};}function handleError(_0x4226a6,_0x1c07e5){_0x1c07e5=_0x1c07e5||0x1f4;return function(_0x9e1906){logger['error'](_0x9e1906[_0xe629('0x26')]);if(_0x9e1906['name']){delete _0x9e1906['name'];}_0x4226a6[_0xe629('0x18')](_0x1c07e5)[_0xe629('0x27')](_0x9e1906);};}exports[_0xe629('0x28')]=function(_0x1b3337,_0x273627){var _0x439cb8={},_0xaddc08={},_0x162c2d={'count':0x0,'rows':[]};var _0x1954a4=db['Trigger'][_0xe629('0x29')];_0xaddc08[_0xe629('0x2a')]=_['keys'](_0x1954a4);_0xaddc08['query']=_['keys'](_0x1b3337[_0xe629('0x2b')]);_0xaddc08[_0xe629('0x2c')]=_['intersection'](_0xaddc08[_0xe629('0x2a')],_0xaddc08[_0xe629('0x2b')]);_0x439cb8[_0xe629('0x2d')]=_[_0xe629('0x2e')](_0xaddc08[_0xe629('0x2a')],qs['fields'](_0x1b3337[_0xe629('0x2b')][_0xe629('0x2f')]));_0x439cb8[_0xe629('0x2d')]=_0x439cb8[_0xe629('0x2d')][_0xe629('0x30')]?_0x439cb8[_0xe629('0x2d')]:_0xaddc08[_0xe629('0x2a')];if(!_0x1b3337[_0xe629('0x2b')][_0xe629('0x31')](_0xe629('0x32'))){_0x439cb8[_0xe629('0x1d')]=qs[_0xe629('0x1d')](_0x1b3337[_0xe629('0x2b')]['limit']);_0x439cb8[_0xe629('0x1c')]=qs[_0xe629('0x1c')](_0x1b3337[_0xe629('0x2b')][_0xe629('0x1c')]);}_0x439cb8[_0xe629('0x33')]=qs['sort'](_0x1b3337[_0xe629('0x2b')][_0xe629('0x34')]);_0x439cb8[_0xe629('0x35')]=qs[_0xe629('0x2c')](_[_0xe629('0x36')](_0x1b3337[_0xe629('0x2b')],_0xaddc08[_0xe629('0x2c')]));if(_0x1b3337[_0xe629('0x2b')][_0xe629('0x37')]){_0x439cb8[_0xe629('0x35')]=_[_0xe629('0x38')](_0x439cb8[_0xe629('0x35')],{'$or':_['map'](_0x1954a4,function(_0xc24601){if(_0xc24601[_0xe629('0x39')][_0xe629('0x3a')]!==_0xe629('0x3b')){var _0x49807d={};_0x49807d[_0xc24601[_0xe629('0x3c')]]={'$like':'%'+_0x1b3337['query'][_0xe629('0x37')]+'%'};return _0x49807d;}})});}_0x439cb8=_[_0xe629('0x38')]({},_0x439cb8,_0x1b3337[_0xe629('0x3d')]);var _0x53761e={'where':_0x439cb8[_0xe629('0x35')]};return db['Trigger']['count'](_0x53761e)[_0xe629('0x21')](function(_0x2ac049){_0x162c2d['count']=_0x2ac049;if(_0x1b3337[_0xe629('0x2b')][_0xe629('0x3e')]){_0x439cb8[_0xe629('0x3f')]=[{'all':!![]}];}return db[_0xe629('0x40')][_0xe629('0x41')](_0x439cb8);})['then'](function(_0x5ac65a){_0x162c2d['rows']=_0x5ac65a;return _0x162c2d;})['then'](respondWithFilteredResult(_0x273627,_0x439cb8))[_0xe629('0x42')](handleError(_0x273627,null));};exports[_0xe629('0x43')]=function(_0x367453,_0x13aeba){var _0x37ac7e={'raw':![],'where':{'id':_0x367453[_0xe629('0x44')]['id']}},_0xf2d899={};_0xf2d899[_0xe629('0x2a')]=_[_0xe629('0x45')](db[_0xe629('0x40')][_0xe629('0x29')]);_0xf2d899[_0xe629('0x2b')]=_['keys'](_0x367453[_0xe629('0x2b')]);_0xf2d899[_0xe629('0x2c')]=_[_0xe629('0x2e')](_0xf2d899[_0xe629('0x2a')],_0xf2d899[_0xe629('0x2b')]);_0x37ac7e[_0xe629('0x2d')]=_[_0xe629('0x2e')](_0xf2d899[_0xe629('0x2a')],qs['fields'](_0x367453[_0xe629('0x2b')][_0xe629('0x2f')]));_0x37ac7e[_0xe629('0x2d')]=_0x37ac7e[_0xe629('0x2d')][_0xe629('0x30')]?_0x37ac7e[_0xe629('0x2d')]:_0xf2d899[_0xe629('0x2a')];if(_0x367453['query']['includeAll']){_0x37ac7e['include']=[{'all':!![]}];}_0x37ac7e=_['merge']({},_0x37ac7e,_0x367453[_0xe629('0x3d')]);return db[_0xe629('0x40')]['find'](_0x37ac7e)['then'](handleEntityNotFound(_0x13aeba,null))[_0xe629('0x21')](respondWithResult(_0x13aeba,null))[_0xe629('0x42')](handleError(_0x13aeba,null));};exports[_0xe629('0x46')]=function(_0x3bf60c,_0xb33963){return db[_0xe629('0x40')][_0xe629('0x46')](_0x3bf60c['body'],{})[_0xe629('0x21')](function(_0x37b530){var _0x5e4863=_0x3bf60c['user'][_0xe629('0x23')]({'plain':!![]});if(!_0x5e4863)throw new Error(_0xe629('0x47'));if(_0x5e4863[_0xe629('0x48')]==='user'){var _0x18a29b=_0x37b530[_0xe629('0x23')]({'plain':!![]});var _0x1b2c5c='Triggers';return db[_0xe629('0x49')][_0xe629('0x4a')]({'where':{'name':_0x1b2c5c,'userProfileId':_0x5e4863[_0xe629('0x4b')]},'raw':!![]})['then'](function(_0x4a332f){if(_0x4a332f&&_0x4a332f[_0xe629('0x4c')]===0x0){return db[_0xe629('0x25')][_0xe629('0x46')]({'name':_0x18a29b[_0xe629('0x4d')],'resourceId':_0x18a29b['id'],'type':_0x4a332f[_0xe629('0x4d')],'sectionId':_0x4a332f['id']},{})[_0xe629('0x21')](function(){return _0x37b530;});}else{return _0x37b530;}})[_0xe629('0x42')](function(_0x6c2cf8){logger[_0xe629('0x4e')](_0xe629('0x4f'),_0x6c2cf8);throw _0x6c2cf8;});}return _0x37b530;})[_0xe629('0x21')](respondWithResult(_0xb33963,0xc9))[_0xe629('0x42')](handleError(_0xb33963,null));};exports['update']=function(_0x340714,_0x288ac2){if(_0x340714[_0xe629('0x50')]['id']){delete _0x340714[_0xe629('0x50')]['id'];}return db[_0xe629('0x40')][_0xe629('0x4a')]({'where':{'id':_0x340714['params']['id']}})['then'](handleEntityNotFound(_0x288ac2,null))[_0xe629('0x21')](saveUpdates(_0x340714[_0xe629('0x50')],null))[_0xe629('0x21')](respondWithResult(_0x288ac2,null))[_0xe629('0x42')](handleError(_0x288ac2,null));};exports['destroy']=function(_0x4e0df9,_0xdb7280){return db[_0xe629('0x40')]['find']({'where':{'id':_0x4e0df9[_0xe629('0x44')]['id']}})[_0xe629('0x21')](handleEntityNotFound(_0xdb7280,null))[_0xe629('0x21')](removeEntity(_0xdb7280,null))['catch'](handleError(_0xdb7280,null));};exports[_0xe629('0x51')]=function(_0x278aab,_0x1e8696,_0x349644){if(_0x278aab[_0xe629('0x50')]['id']){delete _0x278aab['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x278aab[_0xe629('0x44')]['id']}})[_0xe629('0x21')](handleEntityNotFound(_0x1e8696,null))[_0xe629('0x21')](function(_0x14d149){if(_0x14d149){_0x278aab[_0xe629('0x50')][_0xe629('0x52')]=_0x14d149['id'];return db[_0xe629('0x53')][_0xe629('0x46')](_0x278aab['body']);}})[_0xe629('0x21')](respondWithResult(_0x1e8696,null))[_0xe629('0x42')](handleError(_0x1e8696,null));};exports['addAnyCondition']=function(_0x19c2b6,_0x3e354b,_0x5bada4){if(_0x19c2b6[_0xe629('0x50')]['id']){delete _0x19c2b6[_0xe629('0x50')]['id'];}return db[_0xe629('0x40')][_0xe629('0x4a')]({'where':{'id':_0x19c2b6[_0xe629('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e354b,null))[_0xe629('0x21')](function(_0x52322b){if(_0x52322b){_0x19c2b6['body'][_0xe629('0x54')]=_0x52322b['id'];return db['Condition'][_0xe629('0x46')](_0x19c2b6[_0xe629('0x50')]);}})[_0xe629('0x21')](respondWithResult(_0x3e354b,null))[_0xe629('0x42')](handleError(_0x3e354b,null));};exports[_0xe629('0x55')]=function(_0x24aa67,_0x3db882,_0x5d526e){var _0x1055ea={};var _0x2349b9={};var _0x3e3936;var _0x1b03b1;return db['Trigger'][_0xe629('0x56')]({'where':{'id':_0x24aa67[_0xe629('0x44')]['id']}})['then'](handleEntityNotFound(_0x3db882,null))['then'](function(_0x41c5e2){if(_0x41c5e2){_0x3e3936=_0x41c5e2;_0x2349b9[_0xe629('0x2a')]=_[_0xe629('0x45')](db[_0xe629('0x53')][_0xe629('0x29')]);_0x2349b9['query']=_[_0xe629('0x45')](_0x24aa67[_0xe629('0x2b')]);_0x2349b9[_0xe629('0x2c')]=_[_0xe629('0x2e')](_0x2349b9['model'],_0x2349b9[_0xe629('0x2b')]);_0x1055ea[_0xe629('0x2d')]=_[_0xe629('0x2e')](_0x2349b9[_0xe629('0x2a')],qs[_0xe629('0x2f')](_0x24aa67[_0xe629('0x2b')]['fields']));_0x1055ea['attributes']=_0x1055ea['attributes']['length']?_0x1055ea['attributes']:_0x2349b9[_0xe629('0x2a')];_0x1055ea['order']=qs[_0xe629('0x34')](_0x24aa67[_0xe629('0x2b')][_0xe629('0x34')]);_0x1055ea[_0xe629('0x35')]=qs[_0xe629('0x2c')](_[_0xe629('0x36')](_0x24aa67['query'],_0x2349b9[_0xe629('0x2c')]));if(_0x24aa67[_0xe629('0x2b')][_0xe629('0x37')]){_0x1055ea[_0xe629('0x35')]=_[_0xe629('0x38')](_0x1055ea[_0xe629('0x35')],{'$or':_['map'](_0x1055ea[_0xe629('0x2d')],function(_0x51420d){var _0x4b41c4={};_0x4b41c4[_0x51420d]={'$like':'%'+_0x24aa67[_0xe629('0x2b')][_0xe629('0x37')]+'%'};return _0x4b41c4;})});}_0x1055ea=_[_0xe629('0x38')]({},_0x1055ea,_0x24aa67[_0xe629('0x3d')]);return _0x3e3936[_0xe629('0x55')](_0x1055ea);}})[_0xe629('0x21')](function(_0x578c8c){if(_0x578c8c){_0x1b03b1=_0x578c8c['length'];if(!_0x24aa67['query'][_0xe629('0x31')](_0xe629('0x32'))){_0x1055ea[_0xe629('0x1d')]=qs['limit'](_0x24aa67[_0xe629('0x2b')][_0xe629('0x1d')]);_0x1055ea['offset']=qs[_0xe629('0x1c')](_0x24aa67[_0xe629('0x2b')][_0xe629('0x1c')]);}return _0x3e3936[_0xe629('0x55')](_0x1055ea);}})[_0xe629('0x21')](function(_0x5050fb){if(_0x5050fb){return _0x5050fb?{'count':_0x1b03b1,'rows':_0x5050fb}:null;}})[_0xe629('0x21')](respondWithResult(_0x3db882,null))[_0xe629('0x42')](handleError(_0x3db882,null));};exports[_0xe629('0x57')]=function(_0x150c82,_0x506f08,_0x3c09d4){var _0x53431e={};var _0x577f75={};var _0x45bc41;var _0x5ea128;return db[_0xe629('0x40')][_0xe629('0x56')]({'where':{'id':_0x150c82['params']['id']}})[_0xe629('0x21')](handleEntityNotFound(_0x506f08,null))['then'](function(_0x344d50){if(_0x344d50){_0x45bc41=_0x344d50;_0x577f75[_0xe629('0x2a')]=_[_0xe629('0x45')](db[_0xe629('0x53')][_0xe629('0x29')]);_0x577f75[_0xe629('0x2b')]=_[_0xe629('0x45')](_0x150c82['query']);_0x577f75[_0xe629('0x2c')]=_[_0xe629('0x2e')](_0x577f75[_0xe629('0x2a')],_0x577f75[_0xe629('0x2b')]);_0x53431e[_0xe629('0x2d')]=_[_0xe629('0x2e')](_0x577f75[_0xe629('0x2a')],qs[_0xe629('0x2f')](_0x150c82[_0xe629('0x2b')]['fields']));_0x53431e['attributes']=_0x53431e[_0xe629('0x2d')][_0xe629('0x30')]?_0x53431e[_0xe629('0x2d')]:_0x577f75[_0xe629('0x2a')];_0x53431e[_0xe629('0x33')]=qs[_0xe629('0x34')](_0x150c82[_0xe629('0x2b')][_0xe629('0x34')]);_0x53431e['where']=qs['filters'](_['pick'](_0x150c82['query'],_0x577f75['filters']));if(_0x150c82[_0xe629('0x2b')][_0xe629('0x37')]){_0x53431e[_0xe629('0x35')]=_[_0xe629('0x38')](_0x53431e[_0xe629('0x35')],{'$or':_['map'](_0x53431e['attributes'],function(_0xd3d2d2){var _0x21e5a5={};_0x21e5a5[_0xd3d2d2]={'$like':'%'+_0x150c82[_0xe629('0x2b')]['filter']+'%'};return _0x21e5a5;})});}_0x53431e=_[_0xe629('0x38')]({},_0x53431e,_0x150c82[_0xe629('0x3d')]);return _0x45bc41['getAnyConditions'](_0x53431e);}})[_0xe629('0x21')](function(_0x3ed6ff){if(_0x3ed6ff){_0x5ea128=_0x3ed6ff[_0xe629('0x30')];if(!_0x150c82[_0xe629('0x2b')]['hasOwnProperty'](_0xe629('0x32'))){_0x53431e[_0xe629('0x1d')]=qs['limit'](_0x150c82[_0xe629('0x2b')][_0xe629('0x1d')]);_0x53431e['offset']=qs[_0xe629('0x1c')](_0x150c82['query'][_0xe629('0x1c')]);}return _0x45bc41['getAnyConditions'](_0x53431e);}})['then'](function(_0x2dc3f5){if(_0x2dc3f5){return _0x2dc3f5?{'count':_0x5ea128,'rows':_0x2dc3f5}:null;}})['then'](respondWithResult(_0x506f08,null))[_0xe629('0x42')](handleError(_0x506f08,null));};exports[_0xe629('0x58')]=function(_0x998cf,_0x2ac73e,_0x4bf018){if(_0x998cf[_0xe629('0x50')]['id']){delete _0x998cf[_0xe629('0x50')]['id'];}return db[_0xe629('0x40')][_0xe629('0x4a')]({'where':{'id':_0x998cf['params']['id']}})[_0xe629('0x21')](handleEntityNotFound(_0x2ac73e,null))[_0xe629('0x21')](function(_0x485a25){if(_0x485a25){_0x998cf[_0xe629('0x50')]['TriggerId']=_0x485a25['id'];return db[_0xe629('0x59')][_0xe629('0x46')](_0x998cf[_0xe629('0x50')]);}})[_0xe629('0x21')](respondWithResult(_0x2ac73e,null))[_0xe629('0x42')](handleError(_0x2ac73e,null));};exports[_0xe629('0x5a')]=function(_0x2ddcf4,_0x2afcce,_0xb2e1d2){var _0x4c43aa={};var _0x567858={};var _0xeaa0e6;var _0x1f4201;return db[_0xe629('0x40')][_0xe629('0x56')]({'where':{'id':_0x2ddcf4[_0xe629('0x44')]['id']}})['then'](handleEntityNotFound(_0x2afcce,null))[_0xe629('0x21')](function(_0x5e7169){if(_0x5e7169){_0xeaa0e6=_0x5e7169;_0x567858[_0xe629('0x2a')]=_[_0xe629('0x45')](db[_0xe629('0x59')][_0xe629('0x29')]);_0x567858['query']=_['keys'](_0x2ddcf4[_0xe629('0x2b')]);_0x567858[_0xe629('0x2c')]=_[_0xe629('0x2e')](_0x567858[_0xe629('0x2a')],_0x567858[_0xe629('0x2b')]);_0x4c43aa[_0xe629('0x2d')]=_[_0xe629('0x2e')](_0x567858[_0xe629('0x2a')],qs['fields'](_0x2ddcf4[_0xe629('0x2b')]['fields']));_0x4c43aa[_0xe629('0x2d')]=_0x4c43aa[_0xe629('0x2d')][_0xe629('0x30')]?_0x4c43aa[_0xe629('0x2d')]:_0x567858[_0xe629('0x2a')];_0x4c43aa['order']=qs[_0xe629('0x34')](_0x2ddcf4[_0xe629('0x2b')]['sort']);_0x4c43aa[_0xe629('0x35')]=qs[_0xe629('0x2c')](_['pick'](_0x2ddcf4[_0xe629('0x2b')],_0x567858[_0xe629('0x2c')]));if(_0x2ddcf4['query'][_0xe629('0x37')]){_0x4c43aa[_0xe629('0x35')]=_['merge'](_0x4c43aa[_0xe629('0x35')],{'$or':_[_0xe629('0x5b')](_0x4c43aa[_0xe629('0x2d')],function(_0x4a7bb4){var _0x5e5080={};_0x5e5080[_0x4a7bb4]={'$like':'%'+_0x2ddcf4['query'][_0xe629('0x37')]+'%'};return _0x5e5080;})});}_0x4c43aa=_[_0xe629('0x38')]({},_0x4c43aa,_0x2ddcf4[_0xe629('0x3d')]);return _0xeaa0e6[_0xe629('0x5a')](_0x4c43aa);}})[_0xe629('0x21')](function(_0x1c3f98){if(_0x1c3f98){_0x1f4201=_0x1c3f98[_0xe629('0x30')];if(!_0x2ddcf4[_0xe629('0x2b')][_0xe629('0x31')](_0xe629('0x32'))){_0x4c43aa[_0xe629('0x1d')]=qs[_0xe629('0x1d')](_0x2ddcf4['query']['limit']);_0x4c43aa[_0xe629('0x1c')]=qs[_0xe629('0x1c')](_0x2ddcf4[_0xe629('0x2b')][_0xe629('0x1c')]);}return _0xeaa0e6[_0xe629('0x5a')](_0x4c43aa);}})[_0xe629('0x21')](function(_0x45e4a6){if(_0x45e4a6){return _0x45e4a6?{'count':_0x1f4201,'rows':_0x45e4a6}:null;}})[_0xe629('0x21')](respondWithResult(_0x2afcce,null))[_0xe629('0x42')](handleError(_0x2afcce,null));}; \ No newline at end of file +var _0xa666=['options','count','includeAll','findAll','catch','params','rawAttributes','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','map','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','findOne','rimraf','fast-json-patch','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','set','apply','reject','update','then','destroy','Triggers','UserProfileResource','end','stack','name','send','index','Trigger','model','keys','query','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','pick','where','merge','key','field','filter'];(function(_0x573834,_0x5c8a99){var _0xd82d93=function(_0x46cee1){while(--_0x46cee1){_0x573834['push'](_0x573834['shift']());}};_0xd82d93(++_0x5c8a99);}(_0xa666,0xd7));var _0x6a66=function(_0x9dab88,_0x169f91){_0x9dab88=_0x9dab88-0x0;var _0x531e6a=_0xa666[_0x9dab88];return _0x531e6a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6a66('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a66('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6a66('0x2'));var Mustache=require('mustache');var util=require(_0x6a66('0x3'));var path=require(_0x6a66('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a66('0x5'));var fs=require('fs');var _=require(_0x6a66('0x6'));var squel=require(_0x6a66('0x7'));var crypto=require(_0x6a66('0x8'));var jsforce=require(_0x6a66('0x9'));var deskjs=require(_0x6a66('0xa'));var toCsv=require(_0x6a66('0xb'));var querystring=require('querystring');var Papa=require(_0x6a66('0xc'));var Redis=require(_0x6a66('0xd'));var authService=require(_0x6a66('0xe'));var qs=require(_0x6a66('0xf'));var hardwareService=require(_0x6a66('0x10'));var logger=require(_0x6a66('0x11'))(_0x6a66('0x12'));var utils=require(_0x6a66('0x13'));var config=require(_0x6a66('0x14'));var db=require(_0x6a66('0x15'))['db'];function respondWithStatusCode(_0x2d5e76,_0x1e3bf6){_0x1e3bf6=_0x1e3bf6||0xcc;return function(_0xffe659){if(_0xffe659){return _0x2d5e76[_0x6a66('0x16')](_0x1e3bf6);}return _0x2d5e76[_0x6a66('0x17')](_0x1e3bf6)['end']();};}function respondWithResult(_0xaf6291,_0xae4ab5){_0xae4ab5=_0xae4ab5||0xc8;return function(_0x2dd7c4){if(_0x2dd7c4){return _0xaf6291[_0x6a66('0x17')](_0xae4ab5)[_0x6a66('0x18')](_0x2dd7c4);}};}function respondWithFilteredResult(_0x18c211,_0x5bbaf7){return function(_0x1e6c97){if(_0x1e6c97){var _0x5d5095=_0x1e6c97['count'],_0x51bda8=_0x5bbaf7['offset'],_0x5dada5=_0x5bbaf7['offset']+_0x5bbaf7[_0x6a66('0x19')],_0x201d0b;if(_0x5dada5>=_0x5d5095){_0x5dada5=_0x5d5095;_0x201d0b=0xc8;}else{_0x201d0b=0xce;}_0x18c211[_0x6a66('0x17')](_0x201d0b);return _0x18c211[_0x6a66('0x1a')]('Content-Range',_0x51bda8+'-'+_0x5dada5+'/'+_0x5d5095)[_0x6a66('0x18')](_0x1e6c97);}return null;};}function patchUpdates(_0x5f4336){return function(_0x2afd86){try{jsonpatch[_0x6a66('0x1b')](_0x2afd86,_0x5f4336,!![]);}catch(_0xae8444){return BPromise[_0x6a66('0x1c')](_0xae8444);}return _0x2afd86['save']();};}function saveUpdates(_0x2f674f,_0x598a33){return function(_0x279c55){if(_0x279c55){return _0x279c55[_0x6a66('0x1d')](_0x2f674f)[_0x6a66('0x1e')](function(_0x1cf849){return _0x1cf849;});}return null;};}function removeEntity(_0x32a2d3,_0x1ae3c6){return function(_0x488bcf){if(_0x488bcf){return _0x488bcf[_0x6a66('0x1f')]()[_0x6a66('0x1e')](function(){var _0x30b63d=_0x488bcf['get']({'plain':!![]});var _0x20a512=_0x6a66('0x20');return db[_0x6a66('0x21')][_0x6a66('0x1f')]({'where':{'type':_0x20a512,'resourceId':_0x30b63d['id']}})[_0x6a66('0x1e')](function(){return _0x488bcf;});})[_0x6a66('0x1e')](function(){_0x32a2d3[_0x6a66('0x17')](0xcc)[_0x6a66('0x22')]();});}};}function handleEntityNotFound(_0x2b1f0a,_0x230522){return function(_0x4ebfb8){if(!_0x4ebfb8){_0x2b1f0a[_0x6a66('0x16')](0x194);}return _0x4ebfb8;};}function handleError(_0x31739d,_0x3228dc){_0x3228dc=_0x3228dc||0x1f4;return function(_0x5e7753){logger['error'](_0x5e7753[_0x6a66('0x23')]);if(_0x5e7753[_0x6a66('0x24')]){delete _0x5e7753[_0x6a66('0x24')];}_0x31739d[_0x6a66('0x17')](_0x3228dc)[_0x6a66('0x25')](_0x5e7753);};}exports[_0x6a66('0x26')]=function(_0x10d29b,_0x13ce81){var _0x30a8b4={},_0x43bbd3={},_0x55bba7={'count':0x0,'rows':[]};var _0x39af4e=db[_0x6a66('0x27')]['rawAttributes'];_0x43bbd3[_0x6a66('0x28')]=_[_0x6a66('0x29')](_0x39af4e);_0x43bbd3[_0x6a66('0x2a')]=_[_0x6a66('0x29')](_0x10d29b[_0x6a66('0x2a')]);_0x43bbd3[_0x6a66('0x2b')]=_['intersection'](_0x43bbd3[_0x6a66('0x28')],_0x43bbd3[_0x6a66('0x2a')]);_0x30a8b4[_0x6a66('0x2c')]=_[_0x6a66('0x2d')](_0x43bbd3[_0x6a66('0x28')],qs[_0x6a66('0x2e')](_0x10d29b['query'][_0x6a66('0x2e')]));_0x30a8b4[_0x6a66('0x2c')]=_0x30a8b4[_0x6a66('0x2c')][_0x6a66('0x2f')]?_0x30a8b4['attributes']:_0x43bbd3[_0x6a66('0x28')];if(!_0x10d29b[_0x6a66('0x2a')]['hasOwnProperty'](_0x6a66('0x30'))){_0x30a8b4[_0x6a66('0x19')]=qs['limit'](_0x10d29b[_0x6a66('0x2a')][_0x6a66('0x19')]);_0x30a8b4[_0x6a66('0x31')]=qs['offset'](_0x10d29b['query'][_0x6a66('0x31')]);}_0x30a8b4[_0x6a66('0x32')]=qs[_0x6a66('0x33')](_0x10d29b[_0x6a66('0x2a')][_0x6a66('0x33')]);_0x30a8b4['where']=qs[_0x6a66('0x2b')](_[_0x6a66('0x34')](_0x10d29b[_0x6a66('0x2a')],_0x43bbd3['filters']));if(_0x10d29b['query']['filter']){_0x30a8b4[_0x6a66('0x35')]=_[_0x6a66('0x36')](_0x30a8b4[_0x6a66('0x35')],{'$or':_['map'](_0x39af4e,function(_0x390f2f){if(_0x390f2f['type'][_0x6a66('0x37')]!=='VIRTUAL'){var _0x405fe1={};_0x405fe1[_0x390f2f[_0x6a66('0x38')]]={'$like':'%'+_0x10d29b[_0x6a66('0x2a')][_0x6a66('0x39')]+'%'};return _0x405fe1;}})});}_0x30a8b4=_[_0x6a66('0x36')]({},_0x30a8b4,_0x10d29b[_0x6a66('0x3a')]);var _0x296b8b={'where':_0x30a8b4[_0x6a66('0x35')]};return db[_0x6a66('0x27')][_0x6a66('0x3b')](_0x296b8b)['then'](function(_0x28e2bd){_0x55bba7[_0x6a66('0x3b')]=_0x28e2bd;if(_0x10d29b[_0x6a66('0x2a')][_0x6a66('0x3c')]){_0x30a8b4['include']=[{'all':!![]}];}return db[_0x6a66('0x27')][_0x6a66('0x3d')](_0x30a8b4);})[_0x6a66('0x1e')](function(_0x2e3796){_0x55bba7['rows']=_0x2e3796;return _0x55bba7;})['then'](respondWithFilteredResult(_0x13ce81,_0x30a8b4))[_0x6a66('0x3e')](handleError(_0x13ce81,null));};exports['show']=function(_0x22793a,_0xd8ff67){var _0x5405d5={'raw':![],'where':{'id':_0x22793a[_0x6a66('0x3f')]['id']}},_0x36018e={};_0x36018e[_0x6a66('0x28')]=_[_0x6a66('0x29')](db[_0x6a66('0x27')][_0x6a66('0x40')]);_0x36018e[_0x6a66('0x2a')]=_['keys'](_0x22793a[_0x6a66('0x2a')]);_0x36018e[_0x6a66('0x2b')]=_[_0x6a66('0x2d')](_0x36018e[_0x6a66('0x28')],_0x36018e[_0x6a66('0x2a')]);_0x5405d5[_0x6a66('0x2c')]=_[_0x6a66('0x2d')](_0x36018e['model'],qs['fields'](_0x22793a[_0x6a66('0x2a')][_0x6a66('0x2e')]));_0x5405d5[_0x6a66('0x2c')]=_0x5405d5[_0x6a66('0x2c')]['length']?_0x5405d5[_0x6a66('0x2c')]:_0x36018e[_0x6a66('0x28')];if(_0x22793a[_0x6a66('0x2a')][_0x6a66('0x3c')]){_0x5405d5[_0x6a66('0x41')]=[{'all':!![]}];}_0x5405d5=_[_0x6a66('0x36')]({},_0x5405d5,_0x22793a[_0x6a66('0x3a')]);return db[_0x6a66('0x27')][_0x6a66('0x42')](_0x5405d5)[_0x6a66('0x1e')](handleEntityNotFound(_0xd8ff67,null))[_0x6a66('0x1e')](respondWithResult(_0xd8ff67,null))[_0x6a66('0x3e')](handleError(_0xd8ff67,null));};exports[_0x6a66('0x43')]=function(_0x25d9f2,_0x774e09){return db['Trigger'][_0x6a66('0x43')](_0x25d9f2['body'],{})[_0x6a66('0x1e')](function(_0x114980){var _0x40a340=_0x25d9f2['user'][_0x6a66('0x44')]({'plain':!![]});if(!_0x40a340)throw new Error(_0x6a66('0x45'));if(_0x40a340[_0x6a66('0x46')]===_0x6a66('0x47')){var _0x3543f8=_0x114980[_0x6a66('0x44')]({'plain':!![]});var _0x41a97c=_0x6a66('0x20');return db[_0x6a66('0x48')]['find']({'where':{'name':_0x41a97c,'userProfileId':_0x40a340[_0x6a66('0x49')]},'raw':!![]})[_0x6a66('0x1e')](function(_0x29e21a){if(_0x29e21a&&_0x29e21a[_0x6a66('0x4a')]===0x0){return db[_0x6a66('0x21')][_0x6a66('0x43')]({'name':_0x3543f8[_0x6a66('0x24')],'resourceId':_0x3543f8['id'],'type':_0x29e21a['name'],'sectionId':_0x29e21a['id']},{})['then'](function(){return _0x114980;});}else{return _0x114980;}})[_0x6a66('0x3e')](function(_0x345395){logger[_0x6a66('0x4b')](_0x6a66('0x4c'),_0x345395);throw _0x345395;});}return _0x114980;})[_0x6a66('0x1e')](respondWithResult(_0x774e09,0xc9))[_0x6a66('0x3e')](handleError(_0x774e09,null));};exports[_0x6a66('0x1d')]=function(_0x1eb3a1,_0x4e504c){if(_0x1eb3a1['body']['id']){delete _0x1eb3a1[_0x6a66('0x4d')]['id'];}return db[_0x6a66('0x27')][_0x6a66('0x42')]({'where':{'id':_0x1eb3a1[_0x6a66('0x3f')]['id']}})[_0x6a66('0x1e')](handleEntityNotFound(_0x4e504c,null))[_0x6a66('0x1e')](saveUpdates(_0x1eb3a1[_0x6a66('0x4d')],null))[_0x6a66('0x1e')](respondWithResult(_0x4e504c,null))['catch'](handleError(_0x4e504c,null));};exports[_0x6a66('0x1f')]=function(_0x2dca6b,_0x3bbac0){return db[_0x6a66('0x27')]['find']({'where':{'id':_0x2dca6b[_0x6a66('0x3f')]['id']}})[_0x6a66('0x1e')](handleEntityNotFound(_0x3bbac0,null))['then'](removeEntity(_0x3bbac0,null))[_0x6a66('0x3e')](handleError(_0x3bbac0,null));};exports['addAllCondition']=function(_0xdc33c3,_0x44fd25,_0x24f13f){if(_0xdc33c3[_0x6a66('0x4d')]['id']){delete _0xdc33c3[_0x6a66('0x4d')]['id'];}return db[_0x6a66('0x27')]['find']({'where':{'id':_0xdc33c3[_0x6a66('0x3f')]['id']}})[_0x6a66('0x1e')](handleEntityNotFound(_0x44fd25,null))[_0x6a66('0x1e')](function(_0x2dcd08){if(_0x2dcd08){_0xdc33c3[_0x6a66('0x4d')][_0x6a66('0x4e')]=_0x2dcd08['id'];return db[_0x6a66('0x4f')][_0x6a66('0x43')](_0xdc33c3['body']);}})[_0x6a66('0x1e')](respondWithResult(_0x44fd25,null))['catch'](handleError(_0x44fd25,null));};exports[_0x6a66('0x50')]=function(_0x265cd8,_0x56a11b,_0x4c5f1b){if(_0x265cd8['body']['id']){delete _0x265cd8[_0x6a66('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x265cd8['params']['id']}})[_0x6a66('0x1e')](handleEntityNotFound(_0x56a11b,null))[_0x6a66('0x1e')](function(_0x4b0e8a){if(_0x4b0e8a){_0x265cd8[_0x6a66('0x4d')][_0x6a66('0x51')]=_0x4b0e8a['id'];return db['Condition'][_0x6a66('0x43')](_0x265cd8[_0x6a66('0x4d')]);}})[_0x6a66('0x1e')](respondWithResult(_0x56a11b,null))[_0x6a66('0x3e')](handleError(_0x56a11b,null));};exports[_0x6a66('0x52')]=function(_0x2c3888,_0x32255b,_0x18ef7a){var _0x57b51f={};var _0x331fc4={};var _0x556348;var _0x538efa;return db['Trigger']['findOne']({'where':{'id':_0x2c3888[_0x6a66('0x3f')]['id']}})[_0x6a66('0x1e')](handleEntityNotFound(_0x32255b,null))[_0x6a66('0x1e')](function(_0x48175b){if(_0x48175b){_0x556348=_0x48175b;_0x331fc4[_0x6a66('0x28')]=_[_0x6a66('0x29')](db[_0x6a66('0x4f')]['rawAttributes']);_0x331fc4['query']=_[_0x6a66('0x29')](_0x2c3888['query']);_0x331fc4[_0x6a66('0x2b')]=_[_0x6a66('0x2d')](_0x331fc4[_0x6a66('0x28')],_0x331fc4[_0x6a66('0x2a')]);_0x57b51f['attributes']=_[_0x6a66('0x2d')](_0x331fc4[_0x6a66('0x28')],qs[_0x6a66('0x2e')](_0x2c3888['query'][_0x6a66('0x2e')]));_0x57b51f['attributes']=_0x57b51f[_0x6a66('0x2c')][_0x6a66('0x2f')]?_0x57b51f[_0x6a66('0x2c')]:_0x331fc4[_0x6a66('0x28')];_0x57b51f[_0x6a66('0x32')]=qs[_0x6a66('0x33')](_0x2c3888[_0x6a66('0x2a')]['sort']);_0x57b51f[_0x6a66('0x35')]=qs['filters'](_['pick'](_0x2c3888[_0x6a66('0x2a')],_0x331fc4[_0x6a66('0x2b')]));if(_0x2c3888['query']['filter']){_0x57b51f[_0x6a66('0x35')]=_[_0x6a66('0x36')](_0x57b51f[_0x6a66('0x35')],{'$or':_[_0x6a66('0x53')](_0x57b51f['attributes'],function(_0xd0adf1){var _0x256839={};_0x256839[_0xd0adf1]={'$like':'%'+_0x2c3888['query'][_0x6a66('0x39')]+'%'};return _0x256839;})});}_0x57b51f=_[_0x6a66('0x36')]({},_0x57b51f,_0x2c3888[_0x6a66('0x3a')]);return _0x556348['getAllConditions'](_0x57b51f);}})[_0x6a66('0x1e')](function(_0x47c3f0){if(_0x47c3f0){_0x538efa=_0x47c3f0[_0x6a66('0x2f')];if(!_0x2c3888[_0x6a66('0x2a')][_0x6a66('0x54')](_0x6a66('0x30'))){_0x57b51f['limit']=qs[_0x6a66('0x19')](_0x2c3888[_0x6a66('0x2a')][_0x6a66('0x19')]);_0x57b51f['offset']=qs[_0x6a66('0x31')](_0x2c3888['query'][_0x6a66('0x31')]);}return _0x556348[_0x6a66('0x52')](_0x57b51f);}})[_0x6a66('0x1e')](function(_0x5e995b){if(_0x5e995b){return _0x5e995b?{'count':_0x538efa,'rows':_0x5e995b}:null;}})[_0x6a66('0x1e')](respondWithResult(_0x32255b,null))[_0x6a66('0x3e')](handleError(_0x32255b,null));};exports[_0x6a66('0x55')]=function(_0x3fff72,_0x1ef51c,_0x3f2c97){var _0x32f59c={};var _0x152443={};var _0x11d655;var _0x1fabc5;return db[_0x6a66('0x27')]['findOne']({'where':{'id':_0x3fff72[_0x6a66('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1ef51c,null))[_0x6a66('0x1e')](function(_0x52a5d7){if(_0x52a5d7){_0x11d655=_0x52a5d7;_0x152443[_0x6a66('0x28')]=_[_0x6a66('0x29')](db[_0x6a66('0x4f')][_0x6a66('0x40')]);_0x152443[_0x6a66('0x2a')]=_[_0x6a66('0x29')](_0x3fff72[_0x6a66('0x2a')]);_0x152443[_0x6a66('0x2b')]=_[_0x6a66('0x2d')](_0x152443[_0x6a66('0x28')],_0x152443[_0x6a66('0x2a')]);_0x32f59c[_0x6a66('0x2c')]=_[_0x6a66('0x2d')](_0x152443[_0x6a66('0x28')],qs[_0x6a66('0x2e')](_0x3fff72[_0x6a66('0x2a')][_0x6a66('0x2e')]));_0x32f59c[_0x6a66('0x2c')]=_0x32f59c[_0x6a66('0x2c')]['length']?_0x32f59c[_0x6a66('0x2c')]:_0x152443[_0x6a66('0x28')];_0x32f59c[_0x6a66('0x32')]=qs[_0x6a66('0x33')](_0x3fff72[_0x6a66('0x2a')][_0x6a66('0x33')]);_0x32f59c[_0x6a66('0x35')]=qs[_0x6a66('0x2b')](_[_0x6a66('0x34')](_0x3fff72[_0x6a66('0x2a')],_0x152443['filters']));if(_0x3fff72[_0x6a66('0x2a')][_0x6a66('0x39')]){_0x32f59c[_0x6a66('0x35')]=_[_0x6a66('0x36')](_0x32f59c[_0x6a66('0x35')],{'$or':_[_0x6a66('0x53')](_0x32f59c[_0x6a66('0x2c')],function(_0x179008){var _0x292bcf={};_0x292bcf[_0x179008]={'$like':'%'+_0x3fff72[_0x6a66('0x2a')][_0x6a66('0x39')]+'%'};return _0x292bcf;})});}_0x32f59c=_[_0x6a66('0x36')]({},_0x32f59c,_0x3fff72['options']);return _0x11d655[_0x6a66('0x55')](_0x32f59c);}})[_0x6a66('0x1e')](function(_0x502471){if(_0x502471){_0x1fabc5=_0x502471[_0x6a66('0x2f')];if(!_0x3fff72['query'][_0x6a66('0x54')](_0x6a66('0x30'))){_0x32f59c[_0x6a66('0x19')]=qs['limit'](_0x3fff72[_0x6a66('0x2a')]['limit']);_0x32f59c[_0x6a66('0x31')]=qs['offset'](_0x3fff72['query'][_0x6a66('0x31')]);}return _0x11d655[_0x6a66('0x55')](_0x32f59c);}})[_0x6a66('0x1e')](function(_0x148175){if(_0x148175){return _0x148175?{'count':_0x1fabc5,'rows':_0x148175}:null;}})[_0x6a66('0x1e')](respondWithResult(_0x1ef51c,null))['catch'](handleError(_0x1ef51c,null));};exports[_0x6a66('0x56')]=function(_0x1dde4e,_0x406d88,_0x9ccad8){if(_0x1dde4e['body']['id']){delete _0x1dde4e['body']['id'];}return db['Trigger'][_0x6a66('0x42')]({'where':{'id':_0x1dde4e[_0x6a66('0x3f')]['id']}})[_0x6a66('0x1e')](handleEntityNotFound(_0x406d88,null))[_0x6a66('0x1e')](function(_0x955912){if(_0x955912){_0x1dde4e['body'][_0x6a66('0x57')]=_0x955912['id'];return db[_0x6a66('0x58')][_0x6a66('0x43')](_0x1dde4e['body']);}})[_0x6a66('0x1e')](respondWithResult(_0x406d88,null))['catch'](handleError(_0x406d88,null));};exports[_0x6a66('0x59')]=function(_0x652cf5,_0x7ff966,_0x411947){var _0x5ea294={};var _0x2aa80d={};var _0x4d6404;var _0x33235f;return db[_0x6a66('0x27')][_0x6a66('0x5a')]({'where':{'id':_0x652cf5[_0x6a66('0x3f')]['id']}})[_0x6a66('0x1e')](handleEntityNotFound(_0x7ff966,null))[_0x6a66('0x1e')](function(_0x511caf){if(_0x511caf){_0x4d6404=_0x511caf;_0x2aa80d[_0x6a66('0x28')]=_['keys'](db[_0x6a66('0x58')][_0x6a66('0x40')]);_0x2aa80d[_0x6a66('0x2a')]=_[_0x6a66('0x29')](_0x652cf5['query']);_0x2aa80d[_0x6a66('0x2b')]=_[_0x6a66('0x2d')](_0x2aa80d['model'],_0x2aa80d[_0x6a66('0x2a')]);_0x5ea294[_0x6a66('0x2c')]=_[_0x6a66('0x2d')](_0x2aa80d[_0x6a66('0x28')],qs[_0x6a66('0x2e')](_0x652cf5[_0x6a66('0x2a')][_0x6a66('0x2e')]));_0x5ea294[_0x6a66('0x2c')]=_0x5ea294['attributes'][_0x6a66('0x2f')]?_0x5ea294[_0x6a66('0x2c')]:_0x2aa80d[_0x6a66('0x28')];_0x5ea294[_0x6a66('0x32')]=qs[_0x6a66('0x33')](_0x652cf5['query'][_0x6a66('0x33')]);_0x5ea294[_0x6a66('0x35')]=qs[_0x6a66('0x2b')](_['pick'](_0x652cf5[_0x6a66('0x2a')],_0x2aa80d[_0x6a66('0x2b')]));if(_0x652cf5['query']['filter']){_0x5ea294[_0x6a66('0x35')]=_[_0x6a66('0x36')](_0x5ea294[_0x6a66('0x35')],{'$or':_[_0x6a66('0x53')](_0x5ea294['attributes'],function(_0x4883fd){var _0x508d3c={};_0x508d3c[_0x4883fd]={'$like':'%'+_0x652cf5[_0x6a66('0x2a')][_0x6a66('0x39')]+'%'};return _0x508d3c;})});}_0x5ea294=_[_0x6a66('0x36')]({},_0x5ea294,_0x652cf5[_0x6a66('0x3a')]);return _0x4d6404[_0x6a66('0x59')](_0x5ea294);}})[_0x6a66('0x1e')](function(_0xbbc3fe){if(_0xbbc3fe){_0x33235f=_0xbbc3fe[_0x6a66('0x2f')];if(!_0x652cf5[_0x6a66('0x2a')][_0x6a66('0x54')](_0x6a66('0x30'))){_0x5ea294[_0x6a66('0x19')]=qs[_0x6a66('0x19')](_0x652cf5['query']['limit']);_0x5ea294['offset']=qs[_0x6a66('0x31')](_0x652cf5[_0x6a66('0x2a')][_0x6a66('0x31')]);}return _0x4d6404[_0x6a66('0x59')](_0x5ea294);}})[_0x6a66('0x1e')](function(_0x384268){if(_0x384268){return _0x384268?{'count':_0x33235f,'rows':_0x384268}:null;}})[_0x6a66('0x1e')](respondWithResult(_0x7ff966,null))['catch'](handleError(_0x7ff966,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index b542943..2712eca 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 _0xa96b=['moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','api'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa96b,0xfb));var _0xba96=function(_0x300e67,_0x220855){_0x300e67=_0x300e67-0x0;var _0x115ad7=_0xa96b[_0x300e67];return _0x115ad7;};'use strict';var _=require(_0xba96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba96('0x1'));var moment=require(_0xba96('0x2'));var BPromise=require('bluebird');var rp=require(_0xba96('0x3'));var fs=require('fs');var path=require(_0xba96('0x4'));var rimraf=require(_0xba96('0x5'));var config=require(_0xba96('0x6'));var attributes=require(_0xba96('0x7'));module[_0xba96('0x8')]=function(_0x58e122,_0x29ba50){return _0x58e122[_0xba96('0x9')]('Trigger',attributes,{'tableName':_0xba96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd397=['lodash','util','api','moment','bluebird','request-promise','rimraf','./trigger.attributes','exports','Trigger','tools_triggers'];(function(_0x5b66c7,_0x2d10c9){var _0x3c61cc=function(_0x80e7e6){while(--_0x80e7e6){_0x5b66c7['push'](_0x5b66c7['shift']());}};_0x3c61cc(++_0x2d10c9);}(_0xd397,0x113));var _0x7d39=function(_0x1f7bf0,_0x1c02b4){_0x1f7bf0=_0x1f7bf0-0x0;var _0xf0049c=_0xd397[_0x1f7bf0];return _0xf0049c;};'use strict';var _=require(_0x7d39('0x0'));var util=require(_0x7d39('0x1'));var logger=require('../../config/logger')(_0x7d39('0x2'));var moment=require(_0x7d39('0x3'));var BPromise=require(_0x7d39('0x4'));var rp=require(_0x7d39('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d39('0x6'));var config=require('../../config/environment');var attributes=require(_0x7d39('0x7'));module[_0x7d39('0x8')]=function(_0x2a7a8f,_0x362001){return _0x2a7a8f['define'](_0x7d39('0x9'),attributes,{'tableName':_0x7d39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 717fa73..677a5fd 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 _0xf45e=['options','raw','where','attributes','limit','include','model','map','Trigger','find','ShowTrigger','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll'];(function(_0x5337b9,_0x32ed34){var _0x448033=function(_0x184518){while(--_0x184518){_0x5337b9['push'](_0x5337b9['shift']());}};_0x448033(++_0x32ed34);}(_0xf45e,0x115));var _0xef45=function(_0x577b55,_0x38a861){_0x577b55=_0x577b55-0x0;var _0x224c94=_0xf45e[_0x577b55];return _0x224c94;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('Trigger,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['Trigger'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetTrigger',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetTrigger',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowTrigger']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file +var _0xe5b5=['GetTrigger','Trigger','options','where','attributes','include','map','model','debug','ShowTrigger','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch'];(function(_0x3a980f,_0x49e4d6){var _0x36010f=function(_0x2835e6){while(--_0x2835e6){_0x3a980f['push'](_0x3a980f['shift']());}};_0x36010f(++_0x49e4d6);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0xe5b5[_0x450bf9];return _0x268350;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('Trigger,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('Trigger,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('Trigger,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});}exports[_0x5e5b('0x19')]=function(_0x45a091){var _0x4c5f9a=this;return new Promise(function(_0xe5aa6b,_0x1560e1){return db[_0x5e5b('0x1a')]['findAll']({'raw':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1c')]||null:null,'attributes':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1d')]||null:null,'limit':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['limit']||null:null,'include':_0x45a091['options']?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x28cd95){return{'model':db[_0x28cd95[_0x5e5b('0x20')]],'as':_0x28cd95['as'],'attributes':_0x28cd95[_0x5e5b('0x1d')],'include':_0x28cd95[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x28cd95[_0x5e5b('0x1e')],function(_0x4da321){return{'model':db[_0x4da321[_0x5e5b('0x20')]],'as':_0x4da321['as'],'attributes':_0x4da321[_0x5e5b('0x1d')],'include':_0x4da321[_0x5e5b('0x1e')]?_['map'](_0x4da321[_0x5e5b('0x1e')],function(_0xdb2863){return{'model':db[_0xdb2863['model']],'as':_0xdb2863['as'],'attributes':_0xdb2863[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x39ce16){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x21')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x39ce16));_0xe5aa6b(_0x39ce16);})[_0x5e5b('0x18')](function(_0x42da3b){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x42da3b['message'],_0x45a091);_0x1560e1(_0x4c5f9a['error'](0x1f4,_0x42da3b[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x22')]=function(_0xb68419){var _0x3dcdab=this;return new Promise(function(_0x12f1ee,_0x4b9be8){return db[_0x5e5b('0x1a')]['find']({'raw':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1c')]||null:null,'attributes':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1d')]||null:null,'include':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x317451){return{'model':db[_0x317451['model']],'as':_0x317451['as'],'attributes':_0x317451[_0x5e5b('0x1d')],'include':_0x317451[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x317451[_0x5e5b('0x1e')],function(_0x7da7a5){return{'model':db[_0x7da7a5[_0x5e5b('0x20')]],'as':_0x7da7a5['as'],'attributes':_0x7da7a5['attributes'],'include':_0x7da7a5['include']?_[_0x5e5b('0x1f')](_0x7da7a5[_0x5e5b('0x1e')],function(_0x8ec651){return{'model':db[_0x8ec651['model']],'as':_0x8ec651['as'],'attributes':_0x8ec651[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x18f5ba){logger[_0x5e5b('0x10')]('ShowTrigger',_0xb68419);logger[_0x5e5b('0x21')](_0x5e5b('0x22'),_0xb68419,JSON['stringify'](_0x18f5ba));_0x12f1ee(_0x18f5ba);})['catch'](function(_0xe9c586){logger[_0x5e5b('0x14')](_0x5e5b('0x22'),_0xe9c586['message'],_0xb68419);_0x4b9be8(_0x3dcdab[_0x5e5b('0x14')](0x1f4,_0xe9c586['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 13e3116..461682a 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 _0xd0bb=['express','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','get','/:id','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path'];(function(_0x155add,_0x8ef80f){var _0x441ff2=function(_0x4ebced){while(--_0x4ebced){_0x155add['push'](_0x155add['shift']());}};_0x441ff2(++_0x8ef80f);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xed5729,_0x4979b1){_0xed5729=_0xed5729-0x0;var _0x4607e4=_0xd0bb[_0xed5729];return _0x4607e4;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var auth=require(_0xbd0b('0x4'));var interaction=require(_0xbd0b('0x5'));var config=require('../../config/environment');var controller=require(_0xbd0b('0x6'));router['get']('/',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x8')]);router[_0xbd0b('0x9')](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller['show']);router[_0xbd0b('0xb')](_0xbd0b('0xc'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xd')]);router[_0xbd0b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd0b('0xe')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xf')]);router[_0xbd0b('0x10')]('/:id',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file +var _0xe5b3=['post','/:id/clone','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show'];(function(_0x41e94c,_0x386a89){var _0x325eae=function(_0xc0b4aa){while(--_0xc0b4aa){_0x41e94c['push'](_0x41e94c['shift']());}};_0x325eae(++_0x386a89);}(_0xe5b3,0x133));var _0x3e5b=function(_0x18c607,_0x5ec75e){_0x18c607=_0x18c607-0x0;var _0x3d2d77=_0xe5b3[_0x18c607];return _0x3d2d77;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0xd')](_0x3e5b('0xe'),auth[_0x3e5b('0xa')](),controller['clone']);router['post']('/',auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x10')](_0x3e5b('0xb'),auth[_0x3e5b('0xa')](),controller['update']);router[_0x3e5b('0x11')]('/:id',auth[_0x3e5b('0xa')](),controller[_0x3e5b('0x12')]);module[_0x3e5b('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 f54c2c5..91202da 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 _0xd555=['update','outgoing','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat'];(function(_0x594380,_0x2e2b2d){var _0x387490=function(_0x556eb8){while(--_0x556eb8){_0x594380['push'](_0x594380['shift']());}};_0x387490(++_0x2e2b2d);}(_0xd555,0xb1));var _0x5d55=function(_0x1221e8,_0x2e7229){_0x1221e8=_0x1221e8-0x0;var _0x3f3041=_0xd555[_0x1221e8];return _0x3f3041;};'use strict';var Sequelize=require(_0x5d55('0x0'));module[_0x5d55('0x1')]={'name':{'type':Sequelize[_0x5d55('0x2')],'allowNull':![],'unique':_0x5d55('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5d55('0x4')]('friend','user',_0x5d55('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5d55('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x5d55('0x6'),_0x5d55('0x7'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x5d55('0x8'),_0x5d55('0x9'),_0x5d55('0xa'),_0x5d55('0xb'))},'deny':{'type':Sequelize[_0x5d55('0x2')]},'permit':{'type':Sequelize[_0x5d55('0x2')]},'secret':{'type':Sequelize[_0x5d55('0x2')]},'md5secret':{'type':Sequelize[_0x5d55('0x2')]},'remotesecret':{'type':Sequelize[_0x5d55('0x2')]},'transport':{'type':Sequelize[_0x5d55('0x2')],'defaultValue':'udp','set':function(_0x3b8c9d){this[_0x5d55('0xc')](_0x5d55('0xd'),_0x3b8c9d?_0x3b8c9d[_0x5d55('0xe')](','):null);},'get':function(){return this[_0x5d55('0xf')](_0x5d55('0xd'))?this[_0x5d55('0xf')]('transport')['split'](','):null;},'comment':_0x5d55('0x10')},'dtmfmode':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x11'),_0x5d55('0x12'),_0x5d55('0x13'),_0x5d55('0x14'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x5d55('0x15'),'no',_0x5d55('0x16'),_0x5d55('0x17'),_0x5d55('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x5d55('0x2')]},'nat':{'type':Sequelize[_0x5d55('0x2')],'defaultValue':_0x5d55('0x19'),'set':function(_0x65b93a){this[_0x5d55('0xc')](_0x5d55('0x1a'),_0x65b93a?_0x65b93a[_0x5d55('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x5d55('0x1a'))?this['getDataValue'](_0x5d55('0x1a'))[_0x5d55('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5d55('0x2')]},'namedcallgroup':{'type':Sequelize[_0x5d55('0x2')]},'pickupgroup':{'type':Sequelize[_0x5d55('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5d55('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5d55('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5d55('0x2')],'defaultValue':_0x5d55('0x1c')},'allow':{'type':Sequelize[_0x5d55('0x2')],'allowNull':![],'defaultValue':_0x5d55('0x1d'),'set':function(_0x3b3e17){this[_0x5d55('0xc')](_0x5d55('0x1e'),_0x3b3e17?_0x3b3e17['join'](';'):_0x5d55('0x1d'));},'get':function(){return this[_0x5d55('0xf')](_0x5d55('0x1e'))?this[_0x5d55('0xf')](_0x5d55('0x1e'))[_0x5d55('0x1b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x5d55('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x5d55('0x2')],'defaultValue':'port,invite','set':function(_0x57772c){this[_0x5d55('0xc')](_0x5d55('0x1f'),_0x57772c?_0x57772c[_0x5d55('0xe')](','):null);},'get':function(){return this[_0x5d55('0xf')]('insecure')?this['getDataValue'](_0x5d55('0x1f'))[_0x5d55('0x1b')](','):null;},'comment':_0x5d55('0x20')},'trustrpid':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no',_0x5d55('0x21'))},'promiscredir':{'type':Sequelize[_0x5d55('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no')},'accountcode':{'type':Sequelize[_0x5d55('0x22')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5d55('0x2')],'defaultValue':_0x5d55('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no'),'defaultValue':_0x5d55('0x15')},'busylevel':{'type':Sequelize[_0x5d55('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x5d55('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x5d55('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5d55('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x5d55('0x2')]},'template':{'type':Sequelize[_0x5d55('0x2')]},'videosupport':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no',_0x5d55('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x25'),_0x5d55('0x26'),_0x5d55('0x27'))},'session_expires':{'type':Sequelize[_0x5d55('0x22')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x28'),'uas'),'defaultValue':_0x5d55('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x5d55('0x2')]},'fromdomain':{'type':Sequelize[_0x5d55('0x2')]},'fromuser':{'type':Sequelize[_0x5d55('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no'),'defaultValue':_0x5d55('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x5d55('0x2')]},'defaultuser':{'type':Sequelize[_0x5d55('0x2')]},'rtptimeout':{'type':Sequelize[_0x5d55('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5d55('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5d55('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no',_0x5d55('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5d55('0x2')]},'callbackextension':{'type':Sequelize[_0x5d55('0x2')]},'timert1':{'type':Sequelize[_0x5d55('0x22')](0xb)},'timerb':{'type':Sequelize[_0x5d55('0x22')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x5d55('0x2')]},'contactdeny':{'type':Sequelize[_0x5d55('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x5d55('0x2')]},'use_q850_reason':{'type':Sequelize[_0x5d55('0x2')]},'maxforwards':{'type':Sequelize[_0x5d55('0x22')](0xb)},'encryption':{'type':Sequelize[_0x5d55('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no')},'force_avp':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x5d55('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x5d55('0x4')](_0x5d55('0x15'),'no',_0x5d55('0x2b'),_0x5d55('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x5d55('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x5d55('0x2')]},'dtlscipher':{'type':Sequelize[_0x5d55('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x5d55('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x5d55('0x2d'),_0x5d55('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5d55('0x2')]},'usereqphone':{'type':Sequelize[_0x5d55('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5d55('0x2')]},'recordofffeature':{'type':Sequelize[_0x5d55('0x2')]},'call_limit':{'type':Sequelize[_0x5d55('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5d55('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x5d55('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x5d55('0x2')]},'mohinterpret':{'type':Sequelize[_0x5d55('0x2')]},'mohsuggest':{'type':Sequelize[_0x5d55('0x2')]},'parkinglot':{'type':Sequelize[_0x5d55('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5d55('0x2')],'defaultValue':_0x5d55('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x5d55('0x15'),'no',_0x5d55('0x16'),_0x5d55('0x17'),_0x5d55('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x5d55('0x2')]},'active':{'type':Sequelize[_0x5d55('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5d55('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x942d=['passive','actpass','dynamic','update','update,nonat','BOOLEAN','exports','STRING','name','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','yes','nonat','outgoing','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uas','pai','active'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x942d,0x1a4));var _0xd942=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x942d[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xd942('0x0')]={'name':{'type':Sequelize[_0xd942('0x1')],'allowNull':![],'unique':_0xd942('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd942('0x3')]('friend',_0xd942('0x4'),_0xd942('0x5')),'allowNull':![],'defaultValue':_0xd942('0x6')},'context':{'type':Sequelize[_0xd942('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x7'),_0xd942('0x8'),_0xd942('0x9'),_0xd942('0xa'),'PROHIB_NOT_SCREENED',_0xd942('0xb'),_0xd942('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xd942('0x1')]},'permit':{'type':Sequelize[_0xd942('0x1')]},'secret':{'type':Sequelize[_0xd942('0x1')]},'md5secret':{'type':Sequelize[_0xd942('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xd942('0xd'),'set':function(_0x149a84){this[_0xd942('0xe')](_0xd942('0xf'),_0x149a84?_0x149a84['join'](','):null);},'get':function(){return this[_0xd942('0x10')](_0xd942('0xf'))?this[_0xd942('0x10')]('transport')[_0xd942('0x11')](','):null;},'comment':_0xd942('0x12')},'dtmfmode':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x13'),'info','shortinfo','inband','auto'),'defaultValue':_0xd942('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0xd942('0x14'),'no',_0xd942('0x15'),'update',_0xd942('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd942('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xd942('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x11fbb3){this[_0xd942('0xe')]('nat',_0x11fbb3?_0x11fbb3[_0xd942('0x17')](','):null);},'get':function(){return this[_0xd942('0x10')](_0xd942('0x18'))?this[_0xd942('0x10')](_0xd942('0x18'))[_0xd942('0x11')](','):null;},'comment':_0xd942('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xd942('0x1')]},'pickupgroup':{'type':Sequelize[_0xd942('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xd942('0x1')]},'language':{'type':Sequelize[_0xd942('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd942('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xd942('0x1a')},'allow':{'type':Sequelize[_0xd942('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2d3cbf){this[_0xd942('0xe')](_0xd942('0x1b'),_0x2d3cbf?_0x2d3cbf[_0xd942('0x17')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xd942('0x10')](_0xd942('0x1b'))?this['getDataValue'](_0xd942('0x1b'))['split'](';'):null;},'comment':_0xd942('0x1c')},'autoframing':{'type':Sequelize[_0xd942('0x3')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xd942('0x1d'),'set':function(_0xb52258){this[_0xd942('0xe')](_0xd942('0x1e'),_0xb52258?_0xb52258[_0xd942('0x17')](','):null);},'get':function(){return this[_0xd942('0x10')](_0xd942('0x1e'))?this['getDataValue']('insecure')['split'](','):null;},'comment':_0xd942('0x1f')},'trustrpid':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd942('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xd942('0x14'),'no','never')},'promiscredir':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'useclientcode':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'accountcode':{'type':Sequelize[_0xd942('0x20')](0xb)},'setvar':{'type':Sequelize[_0xd942('0x1')]},'callerid':{'type':Sequelize[_0xd942('0x1')],'defaultValue':_0xd942('0x21')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xd942('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd942('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xd942('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xd942('0x14'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd942('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'mailbox':{'type':Sequelize[_0xd942('0x1')]},'session_timers':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x22'),_0xd942('0x23'),_0xd942('0x24'))},'session_expires':{'type':Sequelize[_0xd942('0x20')](0xb)},'session_minse':{'type':Sequelize[_0xd942('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0xd942('0x3')]('uac',_0xd942('0x25')),'defaultValue':_0xd942('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0xd942('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xd942('0x1')]},'fromuser':{'type':Sequelize[_0xd942('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xd942('0x20')](0xb)},'defaultip':{'type':Sequelize[_0xd942('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xd942('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd942('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xd942('0x14'),'no',_0xd942('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xd942('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xd942('0x1')]},'contactacl':{'type':Sequelize[_0xd942('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xd942('0x1')]},'use_q850_reason':{'type':Sequelize[_0xd942('0x1')]},'maxforwards':{'type':Sequelize[_0xd942('0x20')](0xb)},'encryption':{'type':Sequelize[_0xd942('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'force_avp':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xd942('0x14'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xd942('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xd942('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd942('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xd942('0x1')]},'dtlscafile':{'type':Sequelize[_0xd942('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0xd942('0x27'),_0xd942('0x28'),_0xd942('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd942('0x1')]},'usereqphone':{'type':Sequelize[_0xd942('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xd942('0x1')]},'call_limit':{'type':Sequelize[_0xd942('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xd942('0x3')](_0xd942('0x14'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xd942('0x1')]},'parkinglot':{'type':Sequelize[_0xd942('0x1')]},'description':{'type':Sequelize[_0xd942('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xd942('0x2a')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xd942('0x15'),_0xd942('0x2b'),_0xd942('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd942('0x1')]},'otherFields':{'type':Sequelize[_0xd942('0x1')]},'active':{'type':Sequelize[_0xd942('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd942('0x1')],'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 eeecd76..d52d6b8 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 _0x151a=['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','code','error','message','catch','status','end','json','count','offset','limit','set','save','destroy','get','Trunks','UserProfileResource','sendStatus','stack','send','Trunk','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','keys','clone','find','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','name','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','user','role','update','params','readFileSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test'];(function(_0x17506e,_0x430120){var _0x512c20=function(_0x115ebe){while(--_0x115ebe){_0x17506e['push'](_0x17506e['shift']());}};_0x512c20(++_0x430120);}(_0x151a,0xcd));var _0xa151=function(_0x3add10,_0x457d16){_0x3add10=_0x3add10-0x0;var _0x2da348=_0x151a[_0x3add10];return _0x2da348;};'use strict';var pdf=require(_0xa151('0x0'));var emlformat=require(_0xa151('0x1'));var rimraf=require(_0xa151('0x2'));var zipdir=require(_0xa151('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa151('0x4'));var moment=require(_0xa151('0x5'));var BPromise=require(_0xa151('0x6'));var Mustache=require(_0xa151('0x7'));var util=require(_0xa151('0x8'));var path=require(_0xa151('0x9'));var sox=require(_0xa151('0xa'));var csv=require(_0xa151('0xb'));var ejs=require(_0xa151('0xc'));var fs=require('fs');var _=require(_0xa151('0xd'));var squel=require(_0xa151('0xe'));var crypto=require(_0xa151('0xf'));var jsforce=require(_0xa151('0x10'));var deskjs=require(_0xa151('0x11'));var toCsv=require(_0xa151('0xb'));var querystring=require(_0xa151('0x12'));var Papa=require(_0xa151('0x13'));var Redis=require(_0xa151('0x14'));var authService=require(_0xa151('0x15'));var qs=require(_0xa151('0x16'));var hardwareService=require(_0xa151('0x17'));var logger=require(_0xa151('0x18'))(_0xa151('0x19'));var utils=require(_0xa151('0x1a'));var config=require(_0xa151('0x1b'));var db=require(_0xa151('0x1c'))['db'];var jayson=require(_0xa151('0x1d'));var client=jayson[_0xa151('0x1e')][_0xa151('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x56f01b,_0x2075f8,_0x32e6b0){if(_0x32e6b0){var _0x26746a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26746a[_0xa151('0x20')](_0x2075f8)){return _0x56f01b;}else{throw new db['Sequelize'][(_0xa151('0x21'))](_0xa151('0x22'));}}else{return _0x56f01b;}}function respondWithRpcPromise(_0x2f5b0f,_0x5d3bcc,_0x28b4bc,_0x4ae66f){return new BPromise(function(_0x14deec,_0x5926cb){var _0x405c10=_0x4ae66f||client;return _0x405c10[_0xa151('0x23')](_0x2f5b0f,_0x28b4bc)[_0xa151('0x24')](function(_0x380bdd){logger[_0xa151('0x25')](_0xa151('0x26'),_0x5d3bcc,_0xa151('0x27'));logger[_0xa151('0x28')](_0xa151('0x29'),_0x5d3bcc,_0xa151('0x27'),JSON['stringify'](_0x380bdd));if(_0x380bdd['error']){if(_0x380bdd['error'][_0xa151('0x2a')]===0x1f4){logger[_0xa151('0x2b')](_0xa151('0x26'),_0x5d3bcc,_0x380bdd[_0xa151('0x2b')][_0xa151('0x2c')]);return _0x5926cb(_0x380bdd[_0xa151('0x2b')][_0xa151('0x2c')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5d3bcc,_0x380bdd[_0xa151('0x2b')]['message']);return _0x14deec(_0x380bdd['error'][_0xa151('0x2c')]);}else{logger[_0xa151('0x25')](_0xa151('0x26'),_0x5d3bcc,_0xa151('0x27'));_0x14deec(_0x380bdd['result'][_0xa151('0x2c')]);}})[_0xa151('0x2d')](function(_0x125a30){logger[_0xa151('0x2b')]('Trunk,\x20%s,\x20%s',_0x5d3bcc,_0x125a30);_0x5926cb(_0x125a30);});});}function respondWithStatusCode(_0x21f4b5,_0x5761c1){_0x5761c1=_0x5761c1||0xcc;return function(_0x4acc5c){if(_0x4acc5c){return _0x21f4b5['sendStatus'](_0x5761c1);}return _0x21f4b5[_0xa151('0x2e')](_0x5761c1)[_0xa151('0x2f')]();};}function respondWithResult(_0x414724,_0x5027f1){_0x5027f1=_0x5027f1||0xc8;return function(_0x247e54){if(_0x247e54){return _0x414724[_0xa151('0x2e')](_0x5027f1)[_0xa151('0x30')](_0x247e54);}};}function respondWithFilteredResult(_0x7fc27d,_0x4ba50d){return function(_0x44e8a7){if(_0x44e8a7){var _0x4dd9ea=_0x44e8a7[_0xa151('0x31')],_0x51486f=_0x4ba50d[_0xa151('0x32')],_0x4f4791=_0x4ba50d[_0xa151('0x32')]+_0x4ba50d[_0xa151('0x33')],_0x12ad6a;if(_0x4f4791>=_0x4dd9ea){_0x4f4791=_0x4dd9ea;_0x12ad6a=0xc8;}else{_0x12ad6a=0xce;}_0x7fc27d['status'](_0x12ad6a);return _0x7fc27d[_0xa151('0x34')]('Content-Range',_0x51486f+'-'+_0x4f4791+'/'+_0x4dd9ea)[_0xa151('0x30')](_0x44e8a7);}return null;};}function patchUpdates(_0x26a20){return function(_0x1d49d3){try{jsonpatch['apply'](_0x1d49d3,_0x26a20,!![]);}catch(_0x341546){return BPromise['reject'](_0x341546);}return _0x1d49d3[_0xa151('0x35')]();};}function saveUpdates(_0x372fcb,_0x423cbf){return function(_0x1b41bb){if(_0x1b41bb){return _0x1b41bb['update'](_0x372fcb)['then'](function(_0x40bc45){return _0x40bc45;});}return null;};}function removeEntity(_0x53450e,_0xc0a953){return function(_0xf2d945){if(_0xf2d945){return _0xf2d945[_0xa151('0x36')]()[_0xa151('0x24')](function(){var _0x2abcbe=_0xf2d945[_0xa151('0x37')]({'plain':!![]});var _0x189e0e=_0xa151('0x38');return db[_0xa151('0x39')][_0xa151('0x36')]({'where':{'type':_0x189e0e,'resourceId':_0x2abcbe['id']}})['then'](function(){return _0xf2d945;});})['then'](function(){_0x53450e[_0xa151('0x2e')](0xcc)[_0xa151('0x2f')]();});}};}function handleEntityNotFound(_0x56252d,_0xad875e){return function(_0x3d1a96){if(!_0x3d1a96){_0x56252d[_0xa151('0x3a')](0x194);}return _0x3d1a96;};}function handleError(_0x2c0193,_0x43eb8a){_0x43eb8a=_0x43eb8a||0x1f4;return function(_0x4d2167){logger['error'](_0x4d2167[_0xa151('0x3b')]);if(_0x4d2167['name']){delete _0x4d2167['name'];}_0x2c0193[_0xa151('0x2e')](_0x43eb8a)[_0xa151('0x3c')](_0x4d2167);};}exports['index']=function(_0x480f3f,_0x249e42){var _0x226a97={},_0x3566c0={},_0x5d3487={'count':0x0,'rows':[]};var _0x2dad13=db[_0xa151('0x3d')][_0xa151('0x3e')];_0x3566c0[_0xa151('0x3f')]=_['keys'](_0x2dad13);_0x3566c0['query']=_['keys'](_0x480f3f[_0xa151('0x40')]);_0x3566c0[_0xa151('0x41')]=_[_0xa151('0x42')](_0x3566c0[_0xa151('0x3f')],_0x3566c0['query']);_0x226a97[_0xa151('0x43')]=_[_0xa151('0x42')](_0x3566c0['model'],qs[_0xa151('0x44')](_0x480f3f['query']['fields']));_0x226a97['attributes']=_0x226a97[_0xa151('0x43')][_0xa151('0x45')]?_0x226a97[_0xa151('0x43')]:_0x3566c0['model'];if(!_0x480f3f['query'][_0xa151('0x46')](_0xa151('0x47'))){_0x226a97[_0xa151('0x33')]=qs[_0xa151('0x33')](_0x480f3f[_0xa151('0x40')][_0xa151('0x33')]);_0x226a97[_0xa151('0x32')]=qs[_0xa151('0x32')](_0x480f3f[_0xa151('0x40')][_0xa151('0x32')]);}_0x226a97[_0xa151('0x48')]=qs[_0xa151('0x49')](_0x480f3f['query'][_0xa151('0x49')]);_0x226a97[_0xa151('0x4a')]=qs['filters'](_[_0xa151('0x4b')](_0x480f3f['query'],_0x3566c0[_0xa151('0x41')]));if(_0x480f3f['query'][_0xa151('0x4c')]){_0x226a97[_0xa151('0x4a')]=_[_0xa151('0x4d')](_0x226a97[_0xa151('0x4a')],{'$or':_[_0xa151('0x4e')](_0x2dad13,function(_0x3ee592){if(_0x3ee592[_0xa151('0x4f')][_0xa151('0x50')]!==_0xa151('0x51')){var _0x25ab6b={};_0x25ab6b[_0x3ee592[_0xa151('0x52')]]={'$like':'%'+_0x480f3f[_0xa151('0x40')][_0xa151('0x4c')]+'%'};return _0x25ab6b;}})});}_0x226a97=_[_0xa151('0x4d')]({},_0x226a97,_0x480f3f[_0xa151('0x53')]);var _0x3a6f4b={'where':_0x226a97['where']};return db[_0xa151('0x3d')][_0xa151('0x31')](_0x3a6f4b)[_0xa151('0x24')](function(_0x1c25da){_0x5d3487[_0xa151('0x31')]=_0x1c25da;if(_0x480f3f[_0xa151('0x40')][_0xa151('0x54')]){_0x226a97[_0xa151('0x55')]=[{'all':!![]}];}return db[_0xa151('0x3d')][_0xa151('0x56')](_0x226a97);})[_0xa151('0x24')](function(_0xd6e438){_0x5d3487[_0xa151('0x57')]=_0xd6e438;return _0x5d3487;})['then'](respondWithFilteredResult(_0x249e42,_0x226a97))[_0xa151('0x2d')](handleError(_0x249e42,null));};exports[_0xa151('0x58')]=function(_0x17933b,_0x1406e4){var _0x24cd7d={'raw':![],'where':{'id':_0x17933b['params']['id']}},_0x42fe40={};_0x42fe40['model']=_[_0xa151('0x59')](db['Trunk'][_0xa151('0x3e')]);_0x42fe40['query']=_[_0xa151('0x59')](_0x17933b[_0xa151('0x40')]);_0x42fe40['filters']=_[_0xa151('0x42')](_0x42fe40[_0xa151('0x3f')],_0x42fe40[_0xa151('0x40')]);_0x24cd7d[_0xa151('0x43')]=_[_0xa151('0x42')](_0x42fe40[_0xa151('0x3f')],qs[_0xa151('0x44')](_0x17933b[_0xa151('0x40')][_0xa151('0x44')]));_0x24cd7d[_0xa151('0x43')]=_0x24cd7d[_0xa151('0x43')][_0xa151('0x45')]?_0x24cd7d[_0xa151('0x43')]:_0x42fe40[_0xa151('0x3f')];if(_0x17933b[_0xa151('0x40')][_0xa151('0x54')]){_0x24cd7d[_0xa151('0x55')]=[{'all':!![]}];}_0x24cd7d=_[_0xa151('0x4d')]({},_0x24cd7d,_0x17933b[_0xa151('0x53')]);return db['Trunk']['find'](_0x24cd7d)['then'](handleEntityNotFound(_0x1406e4,null))[_0xa151('0x24')](respondWithResult(_0x1406e4,null))[_0xa151('0x2d')](handleError(_0x1406e4,null));};exports[_0xa151('0x5a')]=function(_0x3d5e95,_0x3a6714){var _0x125a22={'raw':![],'where':{'id':_0x3d5e95['params']['id']}},_0x43b0eb={};_0x43b0eb['model']=_[_0xa151('0x59')](db[_0xa151('0x3d')][_0xa151('0x3e')]);_0x125a22['attributes']=_['intersection'](_0x43b0eb['model'],qs[_0xa151('0x44')](_0x3d5e95['query']['fields']));_0x125a22['attributes']=_0x125a22['attributes'][_0xa151('0x45')]?_0x125a22[_0xa151('0x43')]:_0x43b0eb[_0xa151('0x3f')];if(_0x3d5e95['query'][_0xa151('0x54')]){_0x125a22[_0xa151('0x55')]=[{'all':!![]}];}_0x125a22=_[_0xa151('0x4d')]({},_0x125a22,_0x3d5e95[_0xa151('0x53')]);return db['Trunk'][_0xa151('0x5b')](_0x125a22)[_0xa151('0x24')](handleEntityNotFound(_0x3a6714,null))['then'](function(_0x137a39){if(_0x137a39){var _0x82ad36=_0x137a39[_0xa151('0x37')]({'plain':!![]});_0x82ad36=qs[_0xa151('0x5c')](_0x82ad36,['id',_0xa151('0x5d'),_0xa151('0x5e')]);_0x3d5e95[_0xa151('0x5f')]=_[_0xa151('0x5c')](_0x3d5e95[_0xa151('0x5f')],['id',_0xa151('0x5d'),_0xa151('0x5e')]);return db[_0xa151('0x3d')][_0xa151('0x60')](_[_0xa151('0x4d')](_0x82ad36,_0x3d5e95['body']),{'include':_0x3d5e95[_0xa151('0x40')][_0xa151('0x54')]?[{'all':!![]}]:undefined})[_0xa151('0x24')](function(_0x6cece4){var _0x50f34b=_0x3d5e95['user']['get']({'plain':!![]});if(!_0x50f34b)throw new Error(_0xa151('0x61'));if(_0x50f34b['role']==='user'){var _0x3e6cbf=_0x6cece4[_0xa151('0x37')]({'plain':!![]});var _0x31867f=_0xa151('0x38');return db[_0xa151('0x62')][_0xa151('0x5b')]({'where':{'name':_0x31867f,'userProfileId':_0x50f34b[_0xa151('0x63')]},'raw':!![]})[_0xa151('0x24')](function(_0x69416){if(_0x69416&&_0x69416[_0xa151('0x64')]===0x0){return db[_0xa151('0x39')][_0xa151('0x60')]({'name':_0x3e6cbf[_0xa151('0x65')],'resourceId':_0x3e6cbf['id'],'type':_0x69416['name'],'sectionId':_0x69416['id']},{})[_0xa151('0x24')](function(){return _0x6cece4;});}else{return _0x6cece4;}})[_0xa151('0x2d')](function(_0x2ad5ae){logger[_0xa151('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ad5ae);throw _0x2ad5ae;});}return _0x6cece4;});}})[_0xa151('0x24')](respondWithResult(_0x3a6714,0xc9))['catch'](handleError(_0x3a6714,null));};exports[_0xa151('0x60')]=function(_0x22a8f5,_0x434ddf,_0x55a250){var _0x233219;return db['Trunk'][_0xa151('0x60')](_0x22a8f5[_0xa151('0x5f')],{'raw':!![]})[_0xa151('0x24')](function(_0x39fa84){_0x233219=_0x39fa84;return db[_0xa151('0x3d')]['findAll']({'raw':!![]});})[_0xa151('0x24')](function(_0x90ed26){var _0x4feeaf=fs['readFileSync'](path[_0xa151('0x66')](config[_0xa151('0x67')],_0xa151('0x68')),_0xa151('0x69'));var _0x33b5bf=fs['readFileSync'](path[_0xa151('0x66')](config[_0xa151('0x67')],_0xa151('0x6a')),'utf8');var _0x243c1d=ejs[_0xa151('0x6b')](_0x4feeaf,{'trunks':_0x90ed26||[]});fs['writeFileSync'](_0xa151('0x6c'),_0x243c1d);if(_0x233219[_0xa151('0x6d')]){var _0x51102e=ejs[_0xa151('0x6b')](_0x33b5bf,{'trunks':_0x90ed26||[]});fs[_0xa151('0x6e')](_0xa151('0x6f'),_0x51102e);}})[_0xa151('0x24')](function(){return respondWithRpcPromise(_0xa151('0x70'),_0xa151('0x60'),{'module':_0xa151('0x71')});})[_0xa151('0x24')](function(){var _0x378aa5=_0x22a8f5[_0xa151('0x72')][_0xa151('0x37')]({'plain':!![]});if(!_0x378aa5)throw new Error(_0xa151('0x61'));if(_0x378aa5[_0xa151('0x73')]===_0xa151('0x72')){var _0x256e5d=_0x233219['get']({'plain':!![]});return db[_0xa151('0x62')][_0xa151('0x5b')]({'where':{'name':_0xa151('0x38'),'userProfileId':_0x378aa5[_0xa151('0x63')]},'raw':!![]})[_0xa151('0x24')](function(_0x57b4c2){if(_0x57b4c2&&_0x57b4c2[_0xa151('0x64')]===0x0){return db['UserProfileResource'][_0xa151('0x60')]({'name':_0x256e5d[_0xa151('0x65')],'resourceId':_0x256e5d['id'],'type':_0x57b4c2[_0xa151('0x65')],'sectionId':_0x57b4c2['id']},{})[_0xa151('0x24')](function(){return _0x233219;});}else{return _0x233219;}})[_0xa151('0x2d')](function(_0xbf76b8){logger[_0xa151('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbf76b8);throw _0xbf76b8;});}return _0x233219;})['then'](respondWithResult(_0x434ddf,0xc9))[_0xa151('0x2d')](handleError(_0x434ddf,null));};exports[_0xa151('0x74')]=function(_0x3532be,_0x27e697,_0x3235d7){var _0x4a9388;return db[_0xa151('0x3d')][_0xa151('0x5b')]({'where':{'id':_0x3532be[_0xa151('0x75')]['id']}})[_0xa151('0x24')](handleEntityNotFound(_0x27e697,null))['then'](saveUpdates(_0x3532be['body'],null))[_0xa151('0x24')](function(_0x1a3bb5){if(_0x1a3bb5){_0x4a9388=_0x1a3bb5;return db[_0xa151('0x3d')][_0xa151('0x56')]({'raw':!![]});}})['then'](function(_0x308dd7){if(_0x308dd7){var _0x4a3962=fs[_0xa151('0x76')](path['join'](config['root'],_0xa151('0x68')),'utf8');var _0x3603e6=fs[_0xa151('0x76')](path[_0xa151('0x66')](config['root'],_0xa151('0x6a')),_0xa151('0x69'));var _0x19aee4=ejs[_0xa151('0x6b')](_0x4a3962,{'trunks':_0x308dd7||[]});fs[_0xa151('0x6e')](_0xa151('0x6c'),_0x19aee4);var _0x15fc6f=ejs[_0xa151('0x6b')](_0x3603e6,{'trunks':_0x308dd7||[]});fs['writeFileSync'](_0xa151('0x6f'),_0x15fc6f);return respondWithRpcPromise(_0xa151('0x70'),'update',{'module':_0xa151('0x71')});}return null;})[_0xa151('0x24')](function(_0x50dc01){if(_0x50dc01){return _0x4a9388;}})[_0xa151('0x24')](respondWithResult(_0x27e697,null))[_0xa151('0x2d')](handleError(_0x27e697,null));};exports[_0xa151('0x36')]=function(_0x2009ec,_0xf538a3,_0x135ed9){var _0x217f59;return db[_0xa151('0x3d')][_0xa151('0x5b')]({'where':{'id':_0x2009ec[_0xa151('0x75')]['id']}})['then'](handleEntityNotFound(_0xf538a3,null))[_0xa151('0x24')](removeEntity(_0xf538a3,null))['then'](function(){return db[_0xa151('0x3d')][_0xa151('0x56')]({'raw':!![]});})[_0xa151('0x24')](function(_0x17c217){var _0x5944c2=fs[_0xa151('0x76')](path[_0xa151('0x66')](config[_0xa151('0x67')],'server/files/templates/trunk.ejs'),_0xa151('0x69'));var _0x3b4954=fs[_0xa151('0x76')](path['join'](config[_0xa151('0x67')],_0xa151('0x6a')),'utf8');var _0x3a0c5e=ejs['render'](_0x5944c2,{'trunks':_0x17c217});var _0xc4e935=ejs['render'](_0x3b4954,{'trunks':_0x17c217});fs[_0xa151('0x6e')](_0xa151('0x6c'),_0x3a0c5e);fs['writeFileSync'](_0xa151('0x6f'),_0xc4e935);return respondWithRpcPromise(_0xa151('0x70'),_0xa151('0x36'),{'module':_0xa151('0x71')});})['catch'](handleError(_0xf538a3,null));}; \ No newline at end of file +var _0x1079=['/etc/asterisk/sip_xcally_trunks.conf','writeFileSync','Reload','chan_sip.so','UserProfileSection','join','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_registers.conf','html-pdf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','request','request\x20sent','debug','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','name','send','index','Trunk','rawAttributes','model','keys','filters','query','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','findAll','rows','params','include','clone','options','find','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','create','readFileSync','root','utf8','server/files/templates/registry.ejs','render'];(function(_0x119150,_0x454fa1){var _0x21f709=function(_0x311e54){while(--_0x311e54){_0x119150['push'](_0x119150['shift']());}};_0x21f709(++_0x454fa1);}(_0x1079,0xde));var _0x9107=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0x1079[_0x1a014b];return _0x462258;};'use strict';var pdf=require(_0x9107('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9107('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9107('0x2'));var BPromise=require(_0x9107('0x3'));var Mustache=require(_0x9107('0x4'));var util=require('util');var path=require(_0x9107('0x5'));var sox=require(_0x9107('0x6'));var csv=require(_0x9107('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9107('0x8'));var squel=require(_0x9107('0x9'));var crypto=require(_0x9107('0xa'));var jsforce=require(_0x9107('0xb'));var deskjs=require(_0x9107('0xc'));var toCsv=require(_0x9107('0x7'));var querystring=require(_0x9107('0xd'));var Papa=require(_0x9107('0xe'));var Redis=require('ioredis');var authService=require(_0x9107('0xf'));var qs=require(_0x9107('0x10'));var hardwareService=require(_0x9107('0x11'));var logger=require(_0x9107('0x12'))(_0x9107('0x13'));var utils=require(_0x9107('0x14'));var config=require(_0x9107('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9107('0x16'));var client=jayson[_0x9107('0x17')][_0x9107('0x18')]({'port':0x232a});function checkPasswordPattern(_0x43ba33,_0x4adf5a,_0x3df0b3){if(_0x3df0b3){var _0x89a47d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x89a47d[_0x9107('0x19')](_0x4adf5a)){return _0x43ba33;}else{throw new db[(_0x9107('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 _0x43ba33;}}function respondWithRpcPromise(_0x3d3b9c,_0x4285aa,_0x13b4bb,_0x4723bf){return new BPromise(function(_0x1f30d5,_0x5c9ce8){var _0x4601d9=_0x4723bf||client;return _0x4601d9[_0x9107('0x1b')](_0x3d3b9c,_0x13b4bb)['then'](function(_0xac0f9d){logger['info']('Trunk,\x20%s,\x20%s',_0x4285aa,_0x9107('0x1c'));logger[_0x9107('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4285aa,_0x9107('0x1c'),JSON[_0x9107('0x1e')](_0xac0f9d));if(_0xac0f9d['error']){if(_0xac0f9d[_0x9107('0x1f')][_0x9107('0x20')]===0x1f4){logger[_0x9107('0x1f')](_0x9107('0x21'),_0x4285aa,_0xac0f9d['error'][_0x9107('0x22')]);return _0x5c9ce8(_0xac0f9d['error'][_0x9107('0x22')]);}logger[_0x9107('0x1f')]('Trunk,\x20%s,\x20%s',_0x4285aa,_0xac0f9d[_0x9107('0x1f')][_0x9107('0x22')]);return _0x1f30d5(_0xac0f9d[_0x9107('0x1f')][_0x9107('0x22')]);}else{logger[_0x9107('0x23')]('Trunk,\x20%s,\x20%s',_0x4285aa,_0x9107('0x1c'));_0x1f30d5(_0xac0f9d['result'][_0x9107('0x22')]);}})[_0x9107('0x24')](function(_0x14b521){logger['error']('Trunk,\x20%s,\x20%s',_0x4285aa,_0x14b521);_0x5c9ce8(_0x14b521);});});}function respondWithStatusCode(_0x4c88ea,_0x1a0464){_0x1a0464=_0x1a0464||0xcc;return function(_0x2998f2){if(_0x2998f2){return _0x4c88ea[_0x9107('0x25')](_0x1a0464);}return _0x4c88ea[_0x9107('0x26')](_0x1a0464)[_0x9107('0x27')]();};}function respondWithResult(_0xf21086,_0x384831){_0x384831=_0x384831||0xc8;return function(_0x486aa8){if(_0x486aa8){return _0xf21086[_0x9107('0x26')](_0x384831)[_0x9107('0x28')](_0x486aa8);}};}function respondWithFilteredResult(_0x3a784a,_0x1d931a){return function(_0x2bde20){if(_0x2bde20){var _0x382737=_0x2bde20[_0x9107('0x29')],_0x41f2b9=_0x1d931a[_0x9107('0x2a')],_0x1b1eb3=_0x1d931a['offset']+_0x1d931a[_0x9107('0x2b')],_0x4c51e8;if(_0x1b1eb3>=_0x382737){_0x1b1eb3=_0x382737;_0x4c51e8=0xc8;}else{_0x4c51e8=0xce;}_0x3a784a[_0x9107('0x26')](_0x4c51e8);return _0x3a784a[_0x9107('0x2c')](_0x9107('0x2d'),_0x41f2b9+'-'+_0x1b1eb3+'/'+_0x382737)[_0x9107('0x28')](_0x2bde20);}return null;};}function patchUpdates(_0x42c814){return function(_0x567e39){try{jsonpatch[_0x9107('0x2e')](_0x567e39,_0x42c814,!![]);}catch(_0x31d27b){return BPromise['reject'](_0x31d27b);}return _0x567e39['save']();};}function saveUpdates(_0x47c189,_0x4357a8){return function(_0x51b684){if(_0x51b684){return _0x51b684[_0x9107('0x2f')](_0x47c189)[_0x9107('0x30')](function(_0x3b9f38){return _0x3b9f38;});}return null;};}function removeEntity(_0x5ef009,_0x1d09a2){return function(_0x30b48a){if(_0x30b48a){return _0x30b48a[_0x9107('0x31')]()[_0x9107('0x30')](function(){var _0x1d838f=_0x30b48a[_0x9107('0x32')]({'plain':!![]});var _0xa51481='Trunks';return db['UserProfileResource'][_0x9107('0x31')]({'where':{'type':_0xa51481,'resourceId':_0x1d838f['id']}})[_0x9107('0x30')](function(){return _0x30b48a;});})[_0x9107('0x30')](function(){_0x5ef009[_0x9107('0x26')](0xcc)[_0x9107('0x27')]();});}};}function handleEntityNotFound(_0x380a73,_0x2cb18d){return function(_0x546498){if(!_0x546498){_0x380a73['sendStatus'](0x194);}return _0x546498;};}function handleError(_0x14107f,_0x3a2236){_0x3a2236=_0x3a2236||0x1f4;return function(_0x49d302){logger[_0x9107('0x1f')](_0x49d302['stack']);if(_0x49d302[_0x9107('0x33')]){delete _0x49d302[_0x9107('0x33')];}_0x14107f['status'](_0x3a2236)[_0x9107('0x34')](_0x49d302);};}exports[_0x9107('0x35')]=function(_0x5d3eb6,_0x3589ad){var _0x207466={},_0x97b569={},_0x4ed448={'count':0x0,'rows':[]};var _0x1d6e5f=db[_0x9107('0x36')][_0x9107('0x37')];_0x97b569[_0x9107('0x38')]=_[_0x9107('0x39')](_0x1d6e5f);_0x97b569['query']=_['keys'](_0x5d3eb6['query']);_0x97b569[_0x9107('0x3a')]=_['intersection'](_0x97b569[_0x9107('0x38')],_0x97b569[_0x9107('0x3b')]);_0x207466[_0x9107('0x3c')]=_[_0x9107('0x3d')](_0x97b569[_0x9107('0x38')],qs[_0x9107('0x3e')](_0x5d3eb6[_0x9107('0x3b')][_0x9107('0x3e')]));_0x207466[_0x9107('0x3c')]=_0x207466[_0x9107('0x3c')][_0x9107('0x3f')]?_0x207466['attributes']:_0x97b569[_0x9107('0x38')];if(!_0x5d3eb6[_0x9107('0x3b')]['hasOwnProperty']('nolimit')){_0x207466[_0x9107('0x2b')]=qs[_0x9107('0x2b')](_0x5d3eb6[_0x9107('0x3b')][_0x9107('0x2b')]);_0x207466[_0x9107('0x2a')]=qs[_0x9107('0x2a')](_0x5d3eb6[_0x9107('0x3b')]['offset']);}_0x207466[_0x9107('0x40')]=qs[_0x9107('0x41')](_0x5d3eb6[_0x9107('0x3b')][_0x9107('0x41')]);_0x207466[_0x9107('0x42')]=qs[_0x9107('0x3a')](_[_0x9107('0x43')](_0x5d3eb6[_0x9107('0x3b')],_0x97b569[_0x9107('0x3a')]));if(_0x5d3eb6[_0x9107('0x3b')][_0x9107('0x44')]){_0x207466[_0x9107('0x42')]=_[_0x9107('0x45')](_0x207466[_0x9107('0x42')],{'$or':_[_0x9107('0x46')](_0x1d6e5f,function(_0x1caa6e){if(_0x1caa6e[_0x9107('0x47')][_0x9107('0x48')]!==_0x9107('0x49')){var _0x45a01a={};_0x45a01a[_0x1caa6e[_0x9107('0x4a')]]={'$like':'%'+_0x5d3eb6[_0x9107('0x3b')][_0x9107('0x44')]+'%'};return _0x45a01a;}})});}_0x207466=_[_0x9107('0x45')]({},_0x207466,_0x5d3eb6['options']);var _0x26200d={'where':_0x207466[_0x9107('0x42')]};return db['Trunk'][_0x9107('0x29')](_0x26200d)[_0x9107('0x30')](function(_0x38d9aa){_0x4ed448[_0x9107('0x29')]=_0x38d9aa;if(_0x5d3eb6[_0x9107('0x3b')][_0x9107('0x4b')]){_0x207466['include']=[{'all':!![]}];}return db[_0x9107('0x36')][_0x9107('0x4c')](_0x207466);})[_0x9107('0x30')](function(_0x6b9ad2){_0x4ed448[_0x9107('0x4d')]=_0x6b9ad2;return _0x4ed448;})[_0x9107('0x30')](respondWithFilteredResult(_0x3589ad,_0x207466))[_0x9107('0x24')](handleError(_0x3589ad,null));};exports['show']=function(_0xd1f113,_0x1277ef){var _0x4f65ce={'raw':![],'where':{'id':_0xd1f113[_0x9107('0x4e')]['id']}},_0x16959b={};_0x16959b[_0x9107('0x38')]=_[_0x9107('0x39')](db[_0x9107('0x36')]['rawAttributes']);_0x16959b['query']=_[_0x9107('0x39')](_0xd1f113[_0x9107('0x3b')]);_0x16959b[_0x9107('0x3a')]=_['intersection'](_0x16959b[_0x9107('0x38')],_0x16959b[_0x9107('0x3b')]);_0x4f65ce[_0x9107('0x3c')]=_[_0x9107('0x3d')](_0x16959b[_0x9107('0x38')],qs[_0x9107('0x3e')](_0xd1f113[_0x9107('0x3b')][_0x9107('0x3e')]));_0x4f65ce[_0x9107('0x3c')]=_0x4f65ce[_0x9107('0x3c')][_0x9107('0x3f')]?_0x4f65ce['attributes']:_0x16959b[_0x9107('0x38')];if(_0xd1f113[_0x9107('0x3b')][_0x9107('0x4b')]){_0x4f65ce[_0x9107('0x4f')]=[{'all':!![]}];}_0x4f65ce=_[_0x9107('0x45')]({},_0x4f65ce,_0xd1f113['options']);return db[_0x9107('0x36')]['find'](_0x4f65ce)[_0x9107('0x30')](handleEntityNotFound(_0x1277ef,null))[_0x9107('0x30')](respondWithResult(_0x1277ef,null))[_0x9107('0x24')](handleError(_0x1277ef,null));};exports[_0x9107('0x50')]=function(_0x39bcbf,_0x279a79){var _0x1adcde={'raw':![],'where':{'id':_0x39bcbf[_0x9107('0x4e')]['id']}},_0x4ea84b={};_0x4ea84b[_0x9107('0x38')]=_[_0x9107('0x39')](db[_0x9107('0x36')]['rawAttributes']);_0x1adcde['attributes']=_[_0x9107('0x3d')](_0x4ea84b[_0x9107('0x38')],qs[_0x9107('0x3e')](_0x39bcbf[_0x9107('0x3b')][_0x9107('0x3e')]));_0x1adcde[_0x9107('0x3c')]=_0x1adcde['attributes']['length']?_0x1adcde['attributes']:_0x4ea84b['model'];if(_0x39bcbf[_0x9107('0x3b')][_0x9107('0x4b')]){_0x1adcde[_0x9107('0x4f')]=[{'all':!![]}];}_0x1adcde=_[_0x9107('0x45')]({},_0x1adcde,_0x39bcbf[_0x9107('0x51')]);return db['Trunk'][_0x9107('0x52')](_0x1adcde)[_0x9107('0x30')](handleEntityNotFound(_0x279a79,null))['then'](function(_0xb9aec4){if(_0xb9aec4){var _0x42c539=_0xb9aec4[_0x9107('0x32')]({'plain':!![]});_0x42c539=qs[_0x9107('0x53')](_0x42c539,['id',_0x9107('0x54'),_0x9107('0x55')]);_0x39bcbf[_0x9107('0x56')]=_[_0x9107('0x53')](_0x39bcbf[_0x9107('0x56')],['id','createdAt','updatedAt']);return db['Trunk']['create'](_['merge'](_0x42c539,_0x39bcbf[_0x9107('0x56')]),{'include':_0x39bcbf[_0x9107('0x3b')][_0x9107('0x4b')]?[{'all':!![]}]:undefined})[_0x9107('0x30')](function(_0x579481){var _0x5f2865=_0x39bcbf[_0x9107('0x57')][_0x9107('0x32')]({'plain':!![]});if(!_0x5f2865)throw new Error(_0x9107('0x58'));if(_0x5f2865[_0x9107('0x59')]===_0x9107('0x57')){var _0x3337ad=_0x579481[_0x9107('0x32')]({'plain':!![]});var _0x20d91f='Trunks';return db['UserProfileSection']['find']({'where':{'name':_0x20d91f,'userProfileId':_0x5f2865[_0x9107('0x5a')]},'raw':!![]})[_0x9107('0x30')](function(_0x3e59e0){if(_0x3e59e0&&_0x3e59e0[_0x9107('0x5b')]===0x0){return db[_0x9107('0x5c')][_0x9107('0x5d')]({'name':_0x3337ad[_0x9107('0x33')],'resourceId':_0x3337ad['id'],'type':_0x3e59e0[_0x9107('0x33')],'sectionId':_0x3e59e0['id']},{})[_0x9107('0x30')](function(){return _0x579481;});}else{return _0x579481;}})[_0x9107('0x24')](function(_0x1fe21){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fe21);throw _0x1fe21;});}return _0x579481;});}})['then'](respondWithResult(_0x279a79,0xc9))[_0x9107('0x24')](handleError(_0x279a79,null));};exports[_0x9107('0x5d')]=function(_0x15985c,_0x57afe9,_0x457756){var _0x178883;return db[_0x9107('0x36')][_0x9107('0x5d')](_0x15985c[_0x9107('0x56')],{'raw':!![]})[_0x9107('0x30')](function(_0x40dbe2){_0x178883=_0x40dbe2;return db[_0x9107('0x36')]['findAll']({'raw':!![]});})[_0x9107('0x30')](function(_0x451db0){var _0x40a6a0=fs[_0x9107('0x5e')](path['join'](config[_0x9107('0x5f')],'server/files/templates/trunk.ejs'),_0x9107('0x60'));var _0xf1d9ad=fs[_0x9107('0x5e')](path['join'](config['root'],_0x9107('0x61')),_0x9107('0x60'));var _0x3147b5=ejs[_0x9107('0x62')](_0x40a6a0,{'trunks':_0x451db0||[]});fs['writeFileSync'](_0x9107('0x63'),_0x3147b5);if(_0x178883['registry']){var _0x558551=ejs[_0x9107('0x62')](_0xf1d9ad,{'trunks':_0x451db0||[]});fs[_0x9107('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x558551);}})[_0x9107('0x30')](function(){return respondWithRpcPromise(_0x9107('0x65'),_0x9107('0x5d'),{'module':_0x9107('0x66')});})[_0x9107('0x30')](function(){var _0x3e73a3=_0x15985c[_0x9107('0x57')][_0x9107('0x32')]({'plain':!![]});if(!_0x3e73a3)throw new Error(_0x9107('0x58'));if(_0x3e73a3[_0x9107('0x59')]==='user'){var _0x1a0e13=_0x178883['get']({'plain':!![]});return db[_0x9107('0x67')][_0x9107('0x52')]({'where':{'name':'Trunks','userProfileId':_0x3e73a3[_0x9107('0x5a')]},'raw':!![]})['then'](function(_0x2ad13b){if(_0x2ad13b&&_0x2ad13b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1a0e13[_0x9107('0x33')],'resourceId':_0x1a0e13['id'],'type':_0x2ad13b[_0x9107('0x33')],'sectionId':_0x2ad13b['id']},{})[_0x9107('0x30')](function(){return _0x178883;});}else{return _0x178883;}})[_0x9107('0x24')](function(_0x518e28){logger[_0x9107('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x518e28);throw _0x518e28;});}return _0x178883;})['then'](respondWithResult(_0x57afe9,0xc9))['catch'](handleError(_0x57afe9,null));};exports[_0x9107('0x2f')]=function(_0x245afe,_0x57b256,_0x2c5c12){var _0x381206;return db[_0x9107('0x36')][_0x9107('0x52')]({'where':{'id':_0x245afe[_0x9107('0x4e')]['id']}})['then'](handleEntityNotFound(_0x57b256,null))[_0x9107('0x30')](saveUpdates(_0x245afe[_0x9107('0x56')],null))['then'](function(_0xa08700){if(_0xa08700){_0x381206=_0xa08700;return db[_0x9107('0x36')][_0x9107('0x4c')]({'raw':!![]});}})[_0x9107('0x30')](function(_0x355256){if(_0x355256){var _0x36983b=fs['readFileSync'](path[_0x9107('0x68')](config[_0x9107('0x5f')],'server/files/templates/trunk.ejs'),'utf8');var _0x7004e7=fs[_0x9107('0x5e')](path[_0x9107('0x68')](config[_0x9107('0x5f')],_0x9107('0x61')),_0x9107('0x60'));var _0x3f9c6b=ejs['render'](_0x36983b,{'trunks':_0x355256||[]});fs[_0x9107('0x64')](_0x9107('0x63'),_0x3f9c6b);var _0x1a38b0=ejs[_0x9107('0x62')](_0x7004e7,{'trunks':_0x355256||[]});fs[_0x9107('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1a38b0);return respondWithRpcPromise(_0x9107('0x65'),_0x9107('0x2f'),{'module':_0x9107('0x66')});}return null;})[_0x9107('0x30')](function(_0x11e143){if(_0x11e143){return _0x381206;}})[_0x9107('0x30')](respondWithResult(_0x57b256,null))[_0x9107('0x24')](handleError(_0x57b256,null));};exports['destroy']=function(_0x498a0e,_0x27974d,_0x31692d){var _0x4488e5;return db[_0x9107('0x36')]['find']({'where':{'id':_0x498a0e[_0x9107('0x4e')]['id']}})[_0x9107('0x30')](handleEntityNotFound(_0x27974d,null))[_0x9107('0x30')](removeEntity(_0x27974d,null))[_0x9107('0x30')](function(){return db[_0x9107('0x36')][_0x9107('0x4c')]({'raw':!![]});})[_0x9107('0x30')](function(_0x2937d3){var _0x306920=fs['readFileSync'](path['join'](config['root'],_0x9107('0x69')),'utf8');var _0x17f74c=fs[_0x9107('0x5e')](path[_0x9107('0x68')](config[_0x9107('0x5f')],'server/files/templates/registry.ejs'),_0x9107('0x60'));var _0x38c66c=ejs[_0x9107('0x62')](_0x306920,{'trunks':_0x2937d3});var _0x3fa4c9=ejs[_0x9107('0x62')](_0x17f74c,{'trunks':_0x2937d3});fs[_0x9107('0x64')](_0x9107('0x63'),_0x38c66c);fs[_0x9107('0x64')](_0x9107('0x6a'),_0x3fa4c9);return respondWithRpcPromise(_0x9107('0x65'),'destroy',{'module':_0x9107('0x66')});})[_0x9107('0x24')](handleError(_0x27974d,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 9cf067c..55dc19f 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 _0x4365=['request-promise','path','../../config/environment','./trunk.attributes','exports','Trunk','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x370f6a,_0x36dc3b){var _0x22e380=function(_0x219a2c){while(--_0x219a2c){_0x370f6a['push'](_0x370f6a['shift']());}};_0x22e380(++_0x36dc3b);}(_0x4365,0x17a));var _0x5436=function(_0x269e6b,_0x5bf136){_0x269e6b=_0x269e6b-0x0;var _0x408b6d=_0x4365[_0x269e6b];return _0x408b6d;};'use strict';var _=require(_0x5436('0x0'));var util=require(_0x5436('0x1'));var logger=require(_0x5436('0x2'))(_0x5436('0x3'));var moment=require(_0x5436('0x4'));var BPromise=require(_0x5436('0x5'));var rp=require(_0x5436('0x6'));var fs=require('fs');var path=require(_0x5436('0x7'));var rimraf=require('rimraf');var config=require(_0x5436('0x8'));var attributes=require(_0x5436('0x9'));module[_0x5436('0xa')]=function(_0x5c72ec,_0x20bfe6){return _0x5c72ec['define'](_0x5436('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb745=['../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4169f1,_0x1a5ebc){var _0x3b2f26=function(_0x5a2197){while(--_0x5a2197){_0x4169f1['push'](_0x4169f1['shift']());}};_0x3b2f26(++_0x1a5ebc);}(_0xb745,0x1d9));var _0x5b74=function(_0x1c5bdb,_0x44bf0e){_0x1c5bdb=_0x1c5bdb-0x0;var _0x4988a1=_0xb745[_0x1c5bdb];return _0x4988a1;};'use strict';var _=require(_0x5b74('0x0'));var util=require('util');var logger=require(_0x5b74('0x1'))(_0x5b74('0x2'));var moment=require(_0x5b74('0x3'));var BPromise=require(_0x5b74('0x4'));var rp=require(_0x5b74('0x5'));var fs=require('fs');var path=require(_0x5b74('0x6'));var rimraf=require(_0x5b74('0x7'));var config=require(_0x5b74('0x8'));var attributes=require(_0x5b74('0x9'));module[_0x5b74('0xa')]=function(_0x34843f,_0x14d1da){return _0x34843f[_0x5b74('0xb')](_0x5b74('0xc'),attributes,{'tableName':'tools_trunks','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 3753c88..f0a6400 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 _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','Trunk','findAll','options','raw','limit','include','model','attributes','map','then','GetTrunk','stringify','ShowTrunk'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5eb8,0xb0));var _0x85eb=function(_0xe7d07d,_0x52e4e3){_0xe7d07d=_0xe7d07d-0x0;var _0x229e46=_0x5eb8[_0xe7d07d];return _0x229e46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrunk']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrunk',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrunk',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file +var _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','include','model','map','GetTrunk','Trunk','find','raw','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xd1bd2b,_0x43ead3){var _0x466676=function(_0x4062eb){while(--_0x4062eb){_0xd1bd2b['push'](_0xd1bd2b['shift']());}};_0x466676(++_0x43ead3);}(_0x4fc2,0x111));var _0x24fc=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x4fc2[_0x476b00];return _0x44ec8e;};'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});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('Trunk,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('Trunk,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['GetTrunk']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['Trunk'][_0x24fc('0x17')]({'raw':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x23873c[_0x24fc('0x18')]?_0x23873c['options'][_0x24fc('0x1a')]||null:null,'limit':_0x23873c['options']?_0x23873c[_0x24fc('0x18')]['limit']||null:null,'include':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x23873c[_0x24fc('0x18')]['include'],function(_0x35a9c7){return{'model':db[_0x35a9c7[_0x24fc('0x1c')]],'as':_0x35a9c7['as'],'attributes':_0x35a9c7[_0x24fc('0x1a')],'include':_0x35a9c7[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x35a9c7[_0x24fc('0x1b')],function(_0x3f0875){return{'model':db[_0x3f0875[_0x24fc('0x1c')]],'as':_0x3f0875['as'],'attributes':_0x3f0875[_0x24fc('0x1a')],'include':_0x3f0875[_0x24fc('0x1b')]?_['map'](_0x3f0875[_0x24fc('0x1b')],function(_0x16f27f){return{'model':db[_0x16f27f[_0x24fc('0x1c')]],'as':_0x16f27f['as'],'attributes':_0x16f27f['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x3d1ec8){logger[_0x24fc('0xd')](_0x24fc('0x1e'),_0x23873c);logger[_0x24fc('0x10')](_0x24fc('0x1e'),_0x23873c,JSON['stringify'](_0x3d1ec8));_0x6cfa0a(_0x3d1ec8);})[_0x24fc('0x16')](function(_0x29a461){logger[_0x24fc('0x13')](_0x24fc('0x1e'),_0x29a461[_0x24fc('0x15')],_0x23873c);_0x8ac114(_0x1cb3d0['error'](0x1f4,_0x29a461['message']));});});};exports['ShowTrunk']=function(_0x3df6f4){var _0x574ba3=this;return new Promise(function(_0x3f2464,_0x3e6389){return db[_0x24fc('0x1f')][_0x24fc('0x20')]({'raw':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x21')]===undefined?!![]:![]:!![],'where':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x3df6f4['options']?_0x3df6f4['options'][_0x24fc('0x1a')]||null:null,'include':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')],function(_0x3b2862){return{'model':db[_0x3b2862[_0x24fc('0x1c')]],'as':_0x3b2862['as'],'attributes':_0x3b2862[_0x24fc('0x1a')],'include':_0x3b2862[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x3b2862[_0x24fc('0x1b')],function(_0x379a4a){return{'model':db[_0x379a4a['model']],'as':_0x379a4a['as'],'attributes':_0x379a4a[_0x24fc('0x1a')],'include':_0x379a4a[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x379a4a[_0x24fc('0x1b')],function(_0x242bd5){return{'model':db[_0x242bd5['model']],'as':_0x242bd5['as'],'attributes':_0x242bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x5d48fe){logger[_0x24fc('0xd')](_0x24fc('0x22'),_0x3df6f4);logger[_0x24fc('0x10')](_0x24fc('0x22'),_0x3df6f4,JSON['stringify'](_0x5d48fe));_0x3f2464(_0x5d48fe);})[_0x24fc('0x16')](function(_0x4f4ec8){logger[_0x24fc('0x13')](_0x24fc('0x22'),_0x4f4ec8[_0x24fc('0x15')],_0x3df6f4);_0x3e6389(_0x574ba3[_0x24fc('0x13')](0x1f4,_0x4f4ec8[_0x24fc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 72104fc..b03c724 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 _0x2ef3=['getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/teams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','post','/create_many','bulkCreate','create','join','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/chat_websites','addChatWebsites','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/whoami','whoami','/:id','/:id/avatar'];(function(_0x33af77,_0x5d8c29){var _0x51a2c6=function(_0x427195){while(--_0x427195){_0x33af77['push'](_0x33af77['shift']());}};_0x51a2c6(++_0x5d8c29);}(_0x2ef3,0xba));var _0x32ef=function(_0x5b0701,_0x42a1f1){_0x5b0701=_0x5b0701-0x0;var _0xb77558=_0x2ef3[_0x5b0701];return _0xb77558;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./user.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0x8')](_0x32ef('0xc'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0x8')](_0x32ef('0xe'),auth[_0x32ef('0x9')](),controller['show']);router['get'](_0x32ef('0xf'),controller[_0x32ef('0x10')]);router[_0x32ef('0x8')](_0x32ef('0x11'),auth['isAuthenticated'](),controller[_0x32ef('0x12')]);router['get'](_0x32ef('0x13'),auth['isAuthenticated'](),controller[_0x32ef('0x14')]);router[_0x32ef('0x8')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x32ef('0x15')]);router['get'](_0x32ef('0x16'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x17')]);router[_0x32ef('0x8')]('/:id/recordings',auth['isAuthenticated'](),controller['getRecordings']);router[_0x32ef('0x8')](_0x32ef('0x18'),auth[_0x32ef('0x9')](),controller['getScreenRecordings']);router['get'](_0x32ef('0x19'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x1a')]);router['get'](_0x32ef('0x1b'),auth[_0x32ef('0x9')](),controller['getOpenchannelInteractions']);router[_0x32ef('0x8')](_0x32ef('0x1c'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x1d')]);router[_0x32ef('0x8')](_0x32ef('0x1e'),auth['isAuthenticated'](),controller[_0x32ef('0x1f')]);router['get'](_0x32ef('0x20'),auth[_0x32ef('0x9')](),controller['getFaxInteractions']);router[_0x32ef('0x8')](_0x32ef('0x21'),auth[_0x32ef('0x9')](),controller['getTeams']);router['get'](_0x32ef('0x22'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x23')]);router['get']('/:id/agents',auth[_0x32ef('0x9')](),controller['getAgents']);router['get'](_0x32ef('0x24'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x25')]);router[_0x32ef('0x8')](_0x32ef('0x26'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x27')]);router[_0x32ef('0x8')](_0x32ef('0x28'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x29')]);router[_0x32ef('0x8')]('/:id/openchannel_accounts',auth[_0x32ef('0x9')](),controller[_0x32ef('0x2a')]);router['get'](_0x32ef('0x2b'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x2c')]);router[_0x32ef('0x8')]('/:id/chat_websites',auth[_0x32ef('0x9')](),controller[_0x32ef('0x2d')]);router[_0x32ef('0x8')](_0x32ef('0x2e'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x2f')]);router[_0x32ef('0x8')]('/:id/scheduled_calls',auth[_0x32ef('0x9')](),controller['getScheduledCalls']);router[_0x32ef('0x8')](_0x32ef('0x30'),auth['isAuthenticated'](),controller[_0x32ef('0x31')]);router[_0x32ef('0x32')](_0x32ef('0x33'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x34')]);router['post']('/:id/contacts',auth[_0x32ef('0x9')](),controller['addContacts']);router[_0x32ef('0x32')]('/',auth[_0x32ef('0x9')](),controller[_0x32ef('0x35')]);router[_0x32ef('0x32')](_0x32ef('0x13'),auth[_0x32ef('0x9')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x484ad7,_0x2261a6,_0x3c4651){_0x3c4651(null,path[_0x32ef('0x36')](config['root'],'server/files/images/'));},'filename':function(_0x1c3633,_0x2bd8a9,_0x410334){_0x410334(null,util['format']('%s-%s',Date[_0x32ef('0x37')](),_0x2bd8a9[_0x32ef('0x38')]));}})});router[_0x32ef('0x32')](_0x32ef('0xf'),upload[_0x32ef('0x39')](_0x32ef('0x3a')),controller[_0x32ef('0x3b')]);router[_0x32ef('0x32')](_0x32ef('0x3c'),auth['isAuthenticated'](),controller[_0x32ef('0x3d')]);router[_0x32ef('0x32')](_0x32ef('0x3e'),auth['isAuthenticated'](),controller[_0x32ef('0x3f')]);router[_0x32ef('0x32')](_0x32ef('0x40'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x41')]);router[_0x32ef('0x32')](_0x32ef('0x42'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x43')]);router[_0x32ef('0x32')](_0x32ef('0x21'),auth[_0x32ef('0x9')](),controller['addTeams']);router[_0x32ef('0x32')](_0x32ef('0x44'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x45')]);router[_0x32ef('0x32')](_0x32ef('0x46'),auth[_0x32ef('0x9')](),controller['addMailInteractions']);router['post'](_0x32ef('0x47'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x48')]);router[_0x32ef('0x32')]('/:id/sms_interactions',auth[_0x32ef('0x9')](),controller[_0x32ef('0x49')]);router['post'](_0x32ef('0x4a'),auth['isAuthenticated'](),controller[_0x32ef('0x4b')]);router[_0x32ef('0x32')](_0x32ef('0x26'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x4c')]);router[_0x32ef('0x32')](_0x32ef('0x28'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x4d')]);router[_0x32ef('0x32')]('/:id/openchannel_accounts',auth[_0x32ef('0x9')](),controller['addOpenchannelAccounts']);router[_0x32ef('0x32')](_0x32ef('0x2b'),auth[_0x32ef('0x9')](),controller['addSmsAccounts']);router[_0x32ef('0x32')](_0x32ef('0x4e'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x4f')]);router[_0x32ef('0x32')](_0x32ef('0x2e'),auth[_0x32ef('0x9')](),controller['addSquareProjects']);router['post'](_0x32ef('0x30'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x50')]);router[_0x32ef('0x51')](_0x32ef('0xe'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x52')]);router[_0x32ef('0x51')](_0x32ef('0x53'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x54')]);router[_0x32ef('0x55')](_0x32ef('0x13'),auth['isAuthenticated'](),controller[_0x32ef('0x56')]);router[_0x32ef('0x55')](_0x32ef('0x21'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x57')]);router[_0x32ef('0x55')](_0x32ef('0xe'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x58')]);router[_0x32ef('0x55')](_0x32ef('0x44'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x59')]);router[_0x32ef('0x55')](_0x32ef('0x46'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x5a')]);router[_0x32ef('0x55')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x32ef('0x5b')]);router[_0x32ef('0x55')](_0x32ef('0x5c'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x5d')]);router[_0x32ef('0x55')](_0x32ef('0x4a'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x5e')]);router[_0x32ef('0x55')](_0x32ef('0x26'),auth['isAuthenticated'](),controller[_0x32ef('0x5f')]);router[_0x32ef('0x55')](_0x32ef('0x28'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x60')]);router[_0x32ef('0x55')]('/:id/openchannel_accounts',auth[_0x32ef('0x9')](),controller[_0x32ef('0x61')]);router[_0x32ef('0x55')]('/:id/sms_accounts',auth[_0x32ef('0x9')](),controller['removeSmsAccounts']);router[_0x32ef('0x55')](_0x32ef('0x4e'),auth['isAuthenticated'](),controller[_0x32ef('0x62')]);router['delete'](_0x32ef('0x2e'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x63')]);router[_0x32ef('0x55')](_0x32ef('0x30'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x64')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['createApiKey','update','/:id/password','changePassword','removeQueues','removeTeams','destroy','delete','removeFaxInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/whoami','/:id','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','join','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addSquareProjects'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x547e2d,_0x37d6bf){_0x547e2d=_0x547e2d-0x0;var _0xec6bbd=_0x5f2f[_0x547e2d];return _0xec6bbd;};'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('./user.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['whoami']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')]('/:id/avatar',controller['getAvatar']);router[_0xf5f2('0x8')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x8')](_0xf5f2('0x10'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x8')]('/:id/queues_rt',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x8')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['getGroups']);router[_0xf5f2('0x8')](_0xf5f2('0x14'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x8')](_0xf5f2('0x16'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x8')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x8')](_0xf5f2('0x1a'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1b')]);router[_0xf5f2('0x8')]('/:id/mail/interactions',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1c')]);router['get']('/:id/sms/interactions',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1d')]);router['get'](_0xf5f2('0x1e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1f')]);router[_0xf5f2('0x8')](_0xf5f2('0x20'),auth['isAuthenticated'](),controller[_0xf5f2('0x21')]);router[_0xf5f2('0x8')](_0xf5f2('0x22'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x23')]);router['get']('/:id/agents',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x24')]);router[_0xf5f2('0x8')](_0xf5f2('0x25'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x26')]);router[_0xf5f2('0x8')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller['getFaxAccounts']);router[_0xf5f2('0x8')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x29')]);router[_0xf5f2('0x8')](_0xf5f2('0x2a'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xf5f2('0x8')](_0xf5f2('0x2b'),auth[_0xf5f2('0x9')](),controller['getSmsAccounts']);router['get'](_0xf5f2('0x2c'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x2d')]);router[_0xf5f2('0x8')](_0xf5f2('0x2e'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xf5f2('0x8')]('/:id/scheduled_calls',auth[_0xf5f2('0x9')](),controller['getScheduledCalls']);router[_0xf5f2('0x8')](_0xf5f2('0x2f'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x30')]);router[_0xf5f2('0x31')](_0xf5f2('0x32'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x33')]);router['post'](_0xf5f2('0xe'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x34')]);router[_0xf5f2('0x31')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x35')]);router[_0xf5f2('0x31')]('/:id/queues',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fc168,_0x4b8c42,_0x18ae07){_0x18ae07(null,path[_0xf5f2('0x37')](config[_0xf5f2('0x38')],_0xf5f2('0x39')));},'filename':function(_0x59a6dd,_0x5a98d7,_0x41088b){_0x41088b(null,util[_0xf5f2('0x3a')](_0xf5f2('0x3b'),Date['now'](),_0x5a98d7[_0xf5f2('0x3c')]));}})});router['post'](_0xf5f2('0x3d'),upload['single'](_0xf5f2('0x3e')),controller[_0xf5f2('0x3f')]);router['post'](_0xf5f2('0x40'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x41')]);router[_0xf5f2('0x31')]('/:id/logout',auth['isAuthenticated'](),controller[_0xf5f2('0x42')]);router[_0xf5f2('0x31')](_0xf5f2('0x43'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x44')]);router[_0xf5f2('0x31')](_0xf5f2('0x45'),auth['isAuthenticated'](),controller[_0xf5f2('0x46')]);router[_0xf5f2('0x31')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x47')]);router[_0xf5f2('0x31')](_0xf5f2('0x48'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x49')]);router[_0xf5f2('0x31')](_0xf5f2('0x4a'),auth['isAuthenticated'](),controller[_0xf5f2('0x4b')]);router[_0xf5f2('0x31')](_0xf5f2('0x4c'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post'](_0xf5f2('0x4d'),auth[_0xf5f2('0x9')](),controller['addSmsInteractions']);router[_0xf5f2('0x31')](_0xf5f2('0x4e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x4f')]);router[_0xf5f2('0x31')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x50')]);router[_0xf5f2('0x31')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x51')]);router[_0xf5f2('0x31')](_0xf5f2('0x2a'),auth['isAuthenticated'](),controller[_0xf5f2('0x52')]);router['post'](_0xf5f2('0x2b'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x53')]);router[_0xf5f2('0x31')](_0xf5f2('0x2c'),auth[_0xf5f2('0x9')](),controller['addChatWebsites']);router[_0xf5f2('0x31')](_0xf5f2('0x2e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x54')]);router[_0xf5f2('0x31')](_0xf5f2('0x2f'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x55')]);router['put'](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x56')]);router['put'](_0xf5f2('0x57'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x58')]);router['delete']('/:id/queues',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x59')]);router['delete'](_0xf5f2('0x20'),auth['isAuthenticated'](),controller[_0xf5f2('0x5a')]);router['delete'](_0xf5f2('0xd'),auth['isAuthenticated'](),controller[_0xf5f2('0x5b')]);router[_0xf5f2('0x5c')](_0xf5f2('0x48'),auth[_0xf5f2('0x9')](),controller['removeChatInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x4a'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x4c'),auth['isAuthenticated'](),controller[_0xf5f2('0x5d')]);router[_0xf5f2('0x5c')](_0xf5f2('0x4d'),auth[_0xf5f2('0x9')](),controller['removeSmsInteractions']);router['delete'](_0xf5f2('0x4e'),auth[_0xf5f2('0x9')](),controller['removeOpenchannelInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x5e')]);router[_0xf5f2('0x5c')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller['removeMailAccounts']);router['delete'](_0xf5f2('0x2a'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x5f')]);router[_0xf5f2('0x5c')](_0xf5f2('0x2b'),auth['isAuthenticated'](),controller[_0xf5f2('0x60')]);router[_0xf5f2('0x5c')](_0xf5f2('0x2c'),auth['isAuthenticated'](),controller[_0xf5f2('0x61')]);router['delete'](_0xf5f2('0x2e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x62')]);router[_0xf5f2('0x5c')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xf5f2('0x63')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a37dd4f..6a023f6 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x3447eb,_0x28cb0f){var _0x7a9099=function(_0x242528){while(--_0x242528){_0x3447eb['push'](_0x3447eb['shift']());}};_0x7a9099(++_0x28cb0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x4f4579,_0x2ce3b3){var _0x4d49ed=function(_0x1ba3fe){while(--_0x1ba3fe){_0x4f4579['push'](_0x4f4579['shift']());}};_0x4d49ed(++_0x2ce3b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d48bd7d..fbbdd59 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 _0x277a=['token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','then','destroy','Users','agent','Telephones','telephone','filter','ignore','map','value','includes','role','find','name','UserProfileResource','stack','index','User','rawAttributes','model','differenceBy','password','salt','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','type','key','VIRTUAL','sequelize','lower','options','count','includeAll','findAll','rows','show','include','merge','body','update','params','describe','addContacts','ids','omit','agent\x20role','admin','../../config/license/util','telephones','users','isNil','License\x20limit\x20reached','format','internal','findById','securePassword','min_internal','max','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','email','permissions','103','110','104','105','106','107','100','111','create','VoiceMail','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Agents','userProfileId','autoAssociation','changePassword','findOne','oldPassword','newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','emit','Queue:save','voice','push','SIP/%s','each','UserVoiceQueueRt','upsert','removeQueues','remove','channel','Queue:remove','addAvatar','userpic','file','filename','root','server/files/images/logos/default_profile.png','download','join','server/files/images/','getContacts','CmContact','CmList','Tag','Tags','color','tag','nolimit','Unknown\x20role','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','LOGIN','device','LOGININPAUSE','bulkCreate','concat','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','resolve','logout','all','pause','QueuePause','PAUSE','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','smsPause','pauseType','lastPauseAt','manual','mail','chat','fax','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','Mail','getSmsQueues','Fax','getOpenchannelQueues','Openchannel','flatten','addAgent','getDataValue','QueueId','removeTeams','Sms','getFaxQueues','transaction','removeAgent','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','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','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gt','$gte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$any','firstName','dialActive','VoiceQueue','getApiKey','retrieveApiKey'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x277a,0x165));var _0xa277=function(_0x19ffe5,_0x549d03){_0x19ffe5=_0x19ffe5-0x0;var _0x2d5d12=_0x277a[_0x19ffe5];return _0x2d5d12;};'use strict';var pdf=require(_0xa277('0x0'));var emlformat=require(_0xa277('0x1'));var rimraf=require(_0xa277('0x2'));var zipdir=require(_0xa277('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa277('0x4'));var Mustache=require(_0xa277('0x5'));var util=require(_0xa277('0x6'));var path=require('path');var sox=require(_0xa277('0x7'));var csv=require(_0xa277('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa277('0x9'));var squel=require(_0xa277('0xa'));var crypto=require('crypto');var jsforce=require(_0xa277('0xb'));var deskjs=require(_0xa277('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa277('0xd'));var Redis=require('ioredis');var authService=require(_0xa277('0xe'));var qs=require(_0xa277('0xf'));var hardwareService=require(_0xa277('0x10'));var logger=require(_0xa277('0x11'))('api');var utils=require(_0xa277('0x12'));var config=require('../../config/environment');var db=require(_0xa277('0x13'))['db'];config[_0xa277('0x14')]=_[_0xa277('0x15')](config[_0xa277('0x14')],{'host':_0xa277('0x16'),'port':0x18eb});var socket=require(_0xa277('0x17'))(new Redis(config[_0xa277('0x14')]));require('./user.socket')[_0xa277('0x18')](socket);var jayson=require(_0xa277('0x19'));var client=jayson[_0xa277('0x1a')][_0xa277('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x360b8b,_0x75a11b,_0x2df7b1){if(_0x2df7b1){var _0x1f0f89=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f0f89[_0xa277('0x1c')](_0x75a11b)){return _0x360b8b;}else{throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))](_0xa277('0x1f'));}}else{return _0x360b8b;}}function respondWithRpcPromise(_0x20aaab,_0x1f8c23,_0x1c68ec,_0x86b7db){return new BPromise(function(_0x3794f2,_0xab386c){var _0x3c9a58=_0x86b7db||client;return _0x3c9a58[_0xa277('0x20')](_0x20aaab,_0x1c68ec)['then'](function(_0x1618f6){logger['info'](_0xa277('0x21'),_0x1f8c23,_0xa277('0x22'));logger[_0xa277('0x23')](_0xa277('0x24'),_0x1f8c23,_0xa277('0x22'),JSON['stringify'](_0x1618f6));if(_0x1618f6[_0xa277('0x25')]){if(_0x1618f6[_0xa277('0x25')]['code']===0x1f4){logger[_0xa277('0x25')]('User,\x20%s,\x20%s',_0x1f8c23,_0x1618f6[_0xa277('0x25')]['message']);return _0xab386c(_0x1618f6[_0xa277('0x25')][_0xa277('0x26')]);}logger[_0xa277('0x25')](_0xa277('0x21'),_0x1f8c23,_0x1618f6[_0xa277('0x25')][_0xa277('0x26')]);return _0x3794f2(_0x1618f6['error']['message']);}else{logger['info'](_0xa277('0x21'),_0x1f8c23,'request\x20sent');_0x3794f2(_0x1618f6[_0xa277('0x27')][_0xa277('0x26')]);}})[_0xa277('0x28')](function(_0x1b40d2){logger[_0xa277('0x25')](_0xa277('0x21'),_0x1f8c23,_0x1b40d2);_0xab386c(_0x1b40d2);});});}function respondWithStatusCode(_0x21dd7a,_0x45f02f){_0x45f02f=_0x45f02f||0xcc;return function(_0x458387){if(_0x458387){return _0x21dd7a[_0xa277('0x29')](_0x45f02f);}return _0x21dd7a[_0xa277('0x2a')](_0x45f02f)[_0xa277('0x2b')]();};}function respondWithResult(_0x1090e5,_0x48ae0d){_0x48ae0d=_0x48ae0d||0xc8;return function(_0x5668c2){if(_0x5668c2){return _0x1090e5['status'](_0x48ae0d)['json'](_0x5668c2);}};}function respondWithFilteredResult(_0x10fa8e,_0x48c4a7){return function(_0x12c45f){if(_0x12c45f){var _0x529bbc=_0x12c45f['count'],_0x2aaded=_0x48c4a7[_0xa277('0x2c')],_0x4c58a1=_0x48c4a7[_0xa277('0x2c')]+_0x48c4a7['limit'],_0x46303d;if(_0x4c58a1>=_0x529bbc){_0x4c58a1=_0x529bbc;_0x46303d=0xc8;}else{_0x46303d=0xce;}_0x10fa8e['status'](_0x46303d);return _0x10fa8e[_0xa277('0x2d')](_0xa277('0x2e'),_0x2aaded+'-'+_0x4c58a1+'/'+_0x529bbc)[_0xa277('0x2f')](_0x12c45f);}return null;};}function patchUpdates(_0xec51d4){return function(_0x469576){try{jsonpatch[_0xa277('0x30')](_0x469576,_0xec51d4,!![]);}catch(_0xb15b3a){return BPromise[_0xa277('0x31')](_0xb15b3a);}return _0x469576['save']();};}function saveUpdates(_0x3cfc53,_0x14c8bc){return function(_0x1570d3){if(_0x1570d3){return _0x1570d3['update'](_0x3cfc53)[_0xa277('0x32')](function(_0x2c243e){return _0x2c243e;});}return null;};}function removeEntity(_0x22ff37,_0x34e441){return function(_0x51a93d){if(_0x51a93d){return _0x51a93d[_0xa277('0x33')]()[_0xa277('0x32')](function(){var _0x47e9ee=_0x51a93d['get']({'plain':!![]});var _0x397827=[{'name':_0xa277('0x34'),'value':'user','ignore':!![]},{'name':'Agents','value':_0xa277('0x35'),'ignore':![]},{'name':_0xa277('0x36'),'value':_0xa277('0x37'),'ignore':![]}];var _0x577b77=_(_0x397827)[_0xa277('0x38')](_0xa277('0x39'))[_0xa277('0x3a')](_0xa277('0x3b'))[_0xa277('0x3b')]();if(_[_0xa277('0x3c')](_0x577b77,_0x47e9ee[_0xa277('0x3d')])){return;}var _0x2becc5=_[_0xa277('0x3e')](_0x397827,['value',_0x47e9ee[_0xa277('0x3d')]])[_0xa277('0x3f')];return db[_0xa277('0x40')][_0xa277('0x33')]({'where':{'type':_0x2becc5,'resourceId':_0x47e9ee['id']}})[_0xa277('0x32')](function(){return _0x51a93d;});})[_0xa277('0x32')](function(){_0x22ff37[_0xa277('0x2a')](0xcc)[_0xa277('0x2b')]();});}};}function handleEntityNotFound(_0x2c5082,_0x38c30d){return function(_0x5506c9){if(!_0x5506c9){_0x2c5082[_0xa277('0x29')](0x194);}return _0x5506c9;};}function handleError(_0x18a5c3,_0x30b4c4){_0x30b4c4=_0x30b4c4||0x1f4;return function(_0x2896ff){logger[_0xa277('0x25')](_0x2896ff[_0xa277('0x41')]);if(_0x2896ff['name']){delete _0x2896ff[_0xa277('0x3f')];}_0x18a5c3[_0xa277('0x2a')](_0x30b4c4)['send'](_0x2896ff);};}exports[_0xa277('0x42')]=function(_0x46a3e6,_0x4ea2cd){var _0x76d56d={},_0x85570f={},_0x163cd8={'count':0x0,'rows':[]};var _0x114a66=db[_0xa277('0x43')][_0xa277('0x44')];_0x85570f[_0xa277('0x45')]=_[_0xa277('0x46')](_['keys'](_0x114a66),[_0xa277('0x47'),_0xa277('0x48')]);_0x85570f[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x46a3e6[_0xa277('0x49')]);_0x85570f['filters']=_[_0xa277('0x4b')](_0x85570f[_0xa277('0x45')],_0x85570f['query']);_0x76d56d[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x85570f[_0xa277('0x45')],qs[_0xa277('0x4d')](_0x46a3e6[_0xa277('0x49')][_0xa277('0x4d')]));_0x76d56d[_0xa277('0x4c')]=_0x76d56d[_0xa277('0x4c')][_0xa277('0x4e')]?_0x76d56d[_0xa277('0x4c')]:_0x85570f[_0xa277('0x45')];if(!_0x46a3e6[_0xa277('0x49')][_0xa277('0x4f')]('nolimit')){_0x76d56d[_0xa277('0x50')]=qs[_0xa277('0x50')](_0x46a3e6[_0xa277('0x49')][_0xa277('0x50')]);_0x76d56d[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x46a3e6[_0xa277('0x49')]['offset']);}_0x76d56d[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x46a3e6[_0xa277('0x49')]['sort']);_0x76d56d[_0xa277('0x53')]=qs[_0xa277('0x54')](_[_0xa277('0x55')](_0x46a3e6[_0xa277('0x49')],_0x85570f['filters']));if(_0x46a3e6[_0xa277('0x49')]['filter']){_0x76d56d[_0xa277('0x53')]=_['merge'](_0x76d56d[_0xa277('0x53')],{'$or':_[_0xa277('0x3a')](_0x114a66,function(_0x5ee548){if(_0x5ee548[_0xa277('0x56')][_0xa277('0x57')]!==_0xa277('0x58')){return db[_0xa277('0x59')]['where'](db[_0xa277('0x59')]['fn'](_0xa277('0x5a'),db['sequelize']['col'](_0x5ee548['field'])),{'$like':db[_0xa277('0x59')]['fn'](_0xa277('0x5a'),'%'+_0x46a3e6['query']['filter']+'%')});}})});}_0x76d56d=_['merge']({},_0x76d56d,_0x46a3e6[_0xa277('0x5b')]);var _0x4e9e01={'where':_0x76d56d['where']};return db[_0xa277('0x43')][_0xa277('0x5c')](_0x4e9e01)[_0xa277('0x32')](function(_0x38666c){_0x163cd8[_0xa277('0x5c')]=_0x38666c;if(_0x46a3e6[_0xa277('0x49')][_0xa277('0x5d')]){_0x76d56d['include']=[{'all':!![]}];}return db[_0xa277('0x43')][_0xa277('0x5e')](_0x76d56d);})[_0xa277('0x32')](function(_0x4f44e7){_0x163cd8[_0xa277('0x5f')]=_0x4f44e7;return _0x163cd8;})['then'](respondWithFilteredResult(_0x4ea2cd,_0x76d56d))[_0xa277('0x28')](handleError(_0x4ea2cd,null));};exports[_0xa277('0x60')]=function(_0x536904,_0x4a8017){var _0x289677={'raw':![],'where':{'id':_0x536904['params']['id']}},_0xe97f17={};_0xe97f17[_0xa277('0x45')]=_[_0xa277('0x46')](_[_0xa277('0x4a')](db['User'][_0xa277('0x44')]),[_0xa277('0x47'),'salt']);_0xe97f17[_0xa277('0x49')]=_['keys'](_0x536904['query']);_0xe97f17[_0xa277('0x54')]=_[_0xa277('0x4b')](_0xe97f17[_0xa277('0x45')],_0xe97f17[_0xa277('0x49')]);_0x289677[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0xe97f17[_0xa277('0x45')],qs[_0xa277('0x4d')](_0x536904[_0xa277('0x49')][_0xa277('0x4d')]));_0x289677['attributes']=_0x289677[_0xa277('0x4c')][_0xa277('0x4e')]?_0x289677['attributes']:_0xe97f17[_0xa277('0x45')];if(_0x536904['query']['includeAll']){_0x289677[_0xa277('0x61')]=[{'all':!![]}];}_0x289677=_[_0xa277('0x62')]({},_0x289677,_0x536904[_0xa277('0x5b')]);return db[_0xa277('0x43')]['find'](_0x289677)[_0xa277('0x32')](handleEntityNotFound(_0x4a8017,null))[_0xa277('0x32')](respondWithResult(_0x4a8017,null))[_0xa277('0x28')](handleError(_0x4a8017,null));};exports['bulkCreate']=function(_0x4e62ea,_0x3247d2){return db['User']['bulkCreate'](_0x4e62ea[_0xa277('0x63')],{'raw':![],'individualHooks':!![]})[_0xa277('0x32')](respondWithResult(_0x3247d2,0xc9))['catch'](handleError(_0x3247d2,null));};exports[_0xa277('0x64')]=function(_0x4d3f53,_0x30cdc8){if(_0x4d3f53['body']['id']){delete _0x4d3f53['body']['id'];}delete _0x4d3f53[_0xa277('0x63')][_0xa277('0x3d')];return db[_0xa277('0x43')][_0xa277('0x3e')]({'where':{'id':_0x4d3f53[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x30cdc8,null))[_0xa277('0x32')](saveUpdates(_0x4d3f53[_0xa277('0x63')],null))['then'](respondWithResult(_0x30cdc8,null))['catch'](handleError(_0x30cdc8,null));};exports[_0xa277('0x66')]=function(_0xb775ba,_0x32c794){return db[_0xa277('0x43')][_0xa277('0x66')]()[_0xa277('0x32')](respondWithResult(_0x32c794,null))[_0xa277('0x28')](handleError(_0x32c794,null));};exports[_0xa277('0x67')]=function(_0x3c8ba2,_0x34d07e,_0x56a814){return db[_0xa277('0x43')][_0xa277('0x3e')]({'where':{'id':_0x3c8ba2[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x34d07e,null))[_0xa277('0x32')](function(_0x413c11){if(_0x413c11){return _0x413c11['addContacts'](_0x3c8ba2[_0xa277('0x63')][_0xa277('0x68')],_[_0xa277('0x69')](_0x3c8ba2[_0xa277('0x63')],[_0xa277('0x68'),'id'])||{});}})[_0xa277('0x32')](respondWithResult(_0x34d07e,null))['catch'](handleError(_0x34d07e,null));};var getLicense=function(_0x4ae2db){return new BPromise(function(_0x3256e7,_0x160b52){var _0x457363=0x0;_0x4ae2db['body']['role']===_0xa277('0x35')&&_0x3256e7(_0xa277('0x6a'));return db[_0xa277('0x43')][_0xa277('0x5c')]({'where':{'$or':[{'role':_0x4ae2db[_0xa277('0x63')][_0xa277('0x3d')]===_0xa277('0x37')?_0xa277('0x37'):[_0xa277('0x6b'),'user']}]}})[_0xa277('0x32')](function(_0x3f5bc9){_0x457363=_0x3f5bc9;return require(_0xa277('0x6c'))['getLicense']();})[_0xa277('0x32')](function(_0x402275){var _0x56d71b=_0x4ae2db['body'][_0xa277('0x3d')]==='telephone'?_0xa277('0x6d'):_0xa277('0x6e');if(!_[_0xa277('0x6f')](_0x402275[_0x56d71b])&&_0x457363>=_0x402275[_0x56d71b]){return _0x160b52({'message':_0xa277('0x70')});}return _0x3256e7(util[_0xa277('0x71')]('count\x20%s:\x20%s',_0x56d71b,_0x457363));})[_0xa277('0x28')](function(_0x65ee75){return _0x160b52(_0x65ee75);});});};exports['create']=function(_0x4e34ce,_0x97c40b){return getLicense(_0x4e34ce)[_0xa277('0x32')](function(_0xa3bebf){if(!_0x4e34ce[_0xa277('0x63')][_0xa277('0x72')]){var _0x23a80c;return db['Setting'][_0xa277('0x73')](0x1)[_0xa277('0x32')](function(_0x352879){return checkPasswordPattern(_0x352879,_0x4e34ce['body']['password'],_0x352879[_0xa277('0x74')]);})[_0xa277('0x32')](function(_0x3671fb){_0x23a80c=_0x3671fb[_0xa277('0x75')];return db[_0xa277('0x43')][_0xa277('0x76')](_0xa277('0x72'));})[_0xa277('0x32')](function(_0x1a2257){if(_[_0xa277('0x6f')](_0x1a2257)){if(_0x23a80c){_0x4e34ce[_0xa277('0x63')][_0xa277('0x72')]=_0x23a80c;}else{_0x4e34ce[_0xa277('0x63')][_0xa277('0x72')]=0x1;}}else{if(_[_0xa277('0x6f')](_0x23a80c)||_0x23a80c==_0x1a2257){_0x4e34ce[_0xa277('0x63')][_0xa277('0x72')]=_0x1a2257+0x1;}else if(_0x23a80c>_0x1a2257){_0x4e34ce['body']['internal']=_0x23a80c;}else{return db[_0xa277('0x59')][_0xa277('0x49')](_0xa277('0x77'),{'type':db[_0xa277('0x59')][_0xa277('0x78')]['SELECT']})[_0xa277('0x32')](function(_0x1c40d4){if(_0x1c40d4&&_0x1c40d4['length']){for(var _0x19d328=0x0,_0x5c7562=_0x1c40d4[_0xa277('0x4e')];_0x19d328<_0x5c7562&&_['isNil'](_0x4e34ce[_0xa277('0x63')]['internal']);_0x19d328++){if(_0x23a80c<=_0x1c40d4[_0x19d328][_0xa277('0x79')]){_0x4e34ce[_0xa277('0x63')][_0xa277('0x72')]=_0x1c40d4[_0x19d328][_0xa277('0x79')];}else if(_0x23a80c>_0x1c40d4[_0x19d328][_0xa277('0x79')]&&_0x23a80c<=_0x1c40d4[_0x19d328]['to']){_0x4e34ce[_0xa277('0x63')]['internal']=_0x23a80c;}}}if(_['isNil'](_0x4e34ce[_0xa277('0x63')]['internal'])){_0x4e34ce[_0xa277('0x63')][_0xa277('0x72')]=_0x1a2257+0x1;}});}}});}})[_0xa277('0x32')](function(){if(_0x4e34ce[_0xa277('0x63')][_0xa277('0x7a')]){_0x4e34ce['body'][_0xa277('0x7b')]=_0x4e34ce[_0xa277('0x63')][_0xa277('0x72')];_0x4e34ce[_0xa277('0x63')]['VoiceMail']={'mailbox':_0x4e34ce['body'][_0xa277('0x72')],'password':_0x4e34ce[_0xa277('0x63')]['password'],'fullname':_0x4e34ce[_0xa277('0x63')]['fullname'],'email':_0x4e34ce['body'][_0xa277('0x7c')]};}if(_0x4e34ce['body']&&_0x4e34ce['body'][_0xa277('0x3d')]===_0xa277('0x35')){_0x4e34ce[_0xa277('0x63')][_0xa277('0x7d')]=['101','102',_0xa277('0x7e'),_0xa277('0x7f'),_0xa277('0x80'),_0xa277('0x81'),_0xa277('0x82'),_0xa277('0x83'),'108','109',_0xa277('0x84'),_0xa277('0x85')];}return db['User'][_0xa277('0x86')](_0x4e34ce[_0xa277('0x63')],{'include':[{'model':db[_0xa277('0x87')],'as':_0xa277('0x87')}]});})['then'](function(_0x555d43){if(_0x4e34ce[_0xa277('0x63')][_0xa277('0x3d')]===_0xa277('0x88'))return _0x555d43;var _0xeef263=_0x4e34ce[_0xa277('0x88')]['get']({'plain':!![]});if(!_0xeef263)throw new Error(_0xa277('0x89'));if(_0xeef263[_0xa277('0x3d')]===_0xa277('0x88')){var _0x4ba3ac=_0x555d43[_0xa277('0x8a')]({'plain':!![]});var _0x4a71bc=[{'name':_0xa277('0x8b'),'value':_0xa277('0x35')},{'name':_0xa277('0x36'),'value':'telephone'}];var _0x5234bd=_[_0xa277('0x3e')](_0x4a71bc,[_0xa277('0x3b'),_0x4ba3ac['role']])[_0xa277('0x3f')];return db['UserProfileSection']['find']({'where':{'name':_0x5234bd,'userProfileId':_0xeef263[_0xa277('0x8c')]},'raw':!![]})[_0xa277('0x32')](function(_0x113ca0){if(_0x113ca0&&_0x113ca0[_0xa277('0x8d')]===0x0){return db[_0xa277('0x40')][_0xa277('0x86')]({'name':_0x4ba3ac[_0xa277('0x3f')],'resourceId':_0x4ba3ac['id'],'type':_0x113ca0[_0xa277('0x3f')],'sectionId':_0x113ca0['id']},{})[_0xa277('0x32')](function(){return _0x555d43;});}else{return _0x555d43;}})[_0xa277('0x28')](function(_0x532524){logger[_0xa277('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x532524);throw _0x532524;});}return _0x555d43;})[_0xa277('0x32')](respondWithResult(_0x97c40b,0xc9))[_0xa277('0x28')](handleError(_0x97c40b,null));};exports[_0xa277('0x8e')]=function(_0x295ef0,_0x197fc3,_0x407231){var _0x1eb0dc=![];if(_0x295ef0['body']['id']){delete _0x295ef0['body']['id'];}return db['Setting'][_0xa277('0x8f')]({'attributes':['id','securePassword']})['then'](function(_0x18dd3a){_0x1eb0dc=_0x18dd3a[_0xa277('0x74')];return db['User'][_0xa277('0x3e')]({'where':{'id':_0x295ef0[_0xa277('0x65')]['id']}});})[_0xa277('0x32')](function(_0x12a1d9){if(_0x12a1d9){if(_0x12a1d9['id']==_0x295ef0['user']['id']){if(!_0x295ef0[_0xa277('0x63')][_0xa277('0x90')]||!_0x295ef0[_0xa277('0x63')][_0xa277('0x91')]){throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x12a1d9[_0xa277('0x92')](_0x295ef0[_0xa277('0x63')][_0xa277('0x90')])){throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))](_0xa277('0x93'));}if(_0x295ef0[_0xa277('0x63')][_0xa277('0x90')]==_0x295ef0[_0xa277('0x63')][_0xa277('0x91')]){throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x12a1d9;}else if(_0x295ef0[_0xa277('0x88')][_0xa277('0x3d')]=='admin'){if(!_0x295ef0[_0xa277('0x63')][_0xa277('0x91')]){throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x12a1d9;}else if(_0x295ef0[_0xa277('0x88')][_0xa277('0x3d')]=='user'){if(!_0x295ef0[_0xa277('0x63')][_0xa277('0x91')]){throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))](_0xa277('0x94'));}if(_0x12a1d9[_0xa277('0x3d')]!='agent'){throw new db[(_0xa277('0x1d'))]['ValidationError'](_0xa277('0x95'));}return _0x12a1d9;}else{throw new db['Sequelize']['ValidationError'](_0xa277('0x95'));}}return null;})['then'](handleEntityNotFound(_0x197fc3,null))[_0xa277('0x32')](function(_0x1a5b5a){return checkPasswordPattern(_0x1a5b5a,_0x295ef0[_0xa277('0x63')][_0xa277('0x91')],_0x1eb0dc);})[_0xa277('0x32')](saveUpdates({'password':_0x295ef0['body']['newPassword'],'passwordResetAt':_0x295ef0['user']['id']==_0x295ef0[_0xa277('0x65')]['id']?moment():null},null))[_0xa277('0x32')](respondWithResult(_0x197fc3,null))[_0xa277('0x28')](handleError(_0x197fc3,null));};exports['addQueues']=function(_0x56082d,_0x8c9d58,_0x1066f4){var _0x398751=_0x56082d[_0xa277('0x63')]['channel'];return db['User'][_0xa277('0x3e')]({'where':{'id':_0x56082d[_0xa277('0x65')]['id']},'attributes':['id',_0xa277('0x3f'),_0xa277('0x3d'),_0xa277('0x96'),'loginInPause',_0xa277('0x97'),_0xa277('0x98')]})['then'](handleEntityNotFound(_0x8c9d58,null))['then'](function(_0x8fa92){if(_0x8fa92){if(!utils[_0xa277('0x99')](_0x398751)){throw new db[(_0xa277('0x1d'))]['ValidationError'](_0xa277('0x9a'));}return _0x8fa92[_0xa277('0x9b')+_[_0xa277('0x9c')](_0x398751[_0xa277('0x9d')]())+_0xa277('0x9e')](_0x56082d[_0xa277('0x63')]['ids'],{'penalty':_0x56082d[_0xa277('0x63')][_0xa277('0x9f')]||0x0})[_0xa277('0xa0')](function(_0x164ecd){for(var _0x4b24a6=0x0;_0x4b24a6<_0x56082d[_0xa277('0x63')]['ids']['length'];_0x4b24a6+=0x1){var _0x1789a0={'UserId':_0x56082d['params']['id']};_0x1789a0[_[_0xa277('0x9c')](_0x398751[_0xa277('0x9d')]())+'QueueId']=_0x56082d['body'][_0xa277('0x68')][_0x4b24a6];socket[_0xa277('0xa1')](_0xa277('0x88')+_['capitalize'](_0x398751[_0xa277('0x9d')]())+_0xa277('0xa2'),_0x1789a0);}return _0x164ecd;})[_0xa277('0x32')](function(){if(_0x398751===_0xa277('0xa3')){return db['VoiceQueue']['findAll']({'where':{'id':_0x56082d['body'][_0xa277('0x68')]||[]},'raw':!![],'attributes':['id',_0xa277('0x3f')]});}})[_0xa277('0x32')](function(_0x56e7e7){var _0x2dd16e=_0x8fa92[_0xa277('0x8a')]({'plain':!![]});var _0x4e3442=[];if(_0x398751===_0xa277('0xa3')&&_0x2dd16e[_0xa277('0x3d')]===_0xa277('0x35')&&_0x2dd16e['online']){for(var _0x2770e6=0x0;_0x2770e6<_0x56e7e7['length'];_0x2770e6+=0x1){_0x4e3442[_0xa277('0xa4')]({'membername':_0x2dd16e[_0xa277('0x3f')],'UserId':_0x2dd16e['id'],'queue_name':_0x56e7e7[_0x2770e6]['name'],'VoiceQueueId':_0x56e7e7[_0x2770e6]['id'],'interface':_[_0xa277('0x6f')](_0x2dd16e[_0xa277('0x98')])?util[_0xa277('0x71')](_0xa277('0xa5'),_0x2dd16e[_0xa277('0x3f')]):_0x2dd16e[_0xa277('0x98')],'paused':_0x2dd16e['voicePause']||![],'penalty':_0x56082d[_0xa277('0x63')][_0xa277('0x9f')]||0x0});}return BPromise[_0xa277('0xa6')](_0x4e3442,function(_0x38bdc3){return db[_0xa277('0xa7')][_0xa277('0xa8')](_0x38bdc3);});}return _0x8fa92;});}})[_0xa277('0x32')](respondWithStatusCode(_0x8c9d58,null))[_0xa277('0x28')](handleError(_0x8c9d58,null));};exports[_0xa277('0xa9')]=function(_0x28530f,_0x306e90,_0x28cf24){var _0x26f068;return db[_0xa277('0x43')]['find']({'where':{'id':_0x28530f[_0xa277('0x65')]['id']},'attributes':['id','name',_0xa277('0x3d')]})[_0xa277('0x32')](handleEntityNotFound(_0x306e90,null))[_0xa277('0x32')](function(_0x16a0c2){if(_0x16a0c2){_0x26f068=_0x16a0c2;if(!_0x28530f[_0xa277('0x49')]['channel']||!utils[_0xa277('0x99')](_0x28530f[_0xa277('0x49')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xa277('0x9a'));}return _0x16a0c2[_0xa277('0xaa')+_[_0xa277('0x9c')](_0x28530f[_0xa277('0x49')][_0xa277('0xab')][_0xa277('0x9d')]())+_0xa277('0x9e')](_0x28530f[_0xa277('0x49')]['ids']);}})[_0xa277('0x32')](function(_0xb474b3){for(var _0x22ed9e=0x0;_0x22ed9e<_0x28530f[_0xa277('0x49')][_0xa277('0x68')][_0xa277('0x4e')];_0x22ed9e+=0x1){var _0x5a97c7={'UserId':_0x28530f['params']['id']};_0x5a97c7[_['capitalize'](_0x28530f[_0xa277('0x49')][_0xa277('0xab')]['toLowerCase']())+'QueueId']=_0x28530f[_0xa277('0x49')][_0xa277('0x68')][_0x22ed9e];socket[_0xa277('0xa1')](_0xa277('0x88')+_[_0xa277('0x9c')](_0x28530f[_0xa277('0x49')][_0xa277('0xab')][_0xa277('0x9d')]())+_0xa277('0xac'),_0x5a97c7);}return _0xb474b3;})['then'](function(){if(_0x28530f['query']['channel']==='voice'){return db[_0xa277('0xa7')][_0xa277('0x33')]({'where':{'UserId':_0x28530f[_0xa277('0x65')]['id'],'VoiceQueueId':_0x28530f[_0xa277('0x49')]['ids']},'individualHooks':!![]})[_0xa277('0x32')](function(){return _0x26f068;});}return _0x26f068;})['then'](respondWithStatusCode(_0x306e90,null))[_0xa277('0x28')](handleError(_0x306e90,null));};exports[_0xa277('0xad')]=function(_0x3f1637,_0x5d5f1f,_0x2f9136){_0x3f1637[_0xa277('0x63')][_0xa277('0xae')]=_0x3f1637[_0xa277('0xaf')][_0xa277('0xb0')];return db[_0xa277('0x43')][_0xa277('0x3e')]({'where':{'id':_0x3f1637['params']['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x5d5f1f,null))[_0xa277('0x32')](saveUpdates(_0x3f1637['body'],null))['then'](respondWithResult(_0x5d5f1f,null))[_0xa277('0x28')](handleError(_0x5d5f1f,null));};exports['getAvatar']=function(_0x18d855,_0x535f70,_0x5a1b5d){var _0x10ce6a=path['join'](config[_0xa277('0xb1')],_0xa277('0xb2'));return db[_0xa277('0x43')][_0xa277('0x3e')]({'where':{'id':_0x18d855[_0xa277('0x65')]['id']},'attributes':['id',_0xa277('0xae')],'raw':!![]})[_0xa277('0x32')](handleEntityNotFound(_0x535f70,null))[_0xa277('0x32')](function(_0x25172b){if(_0x25172b){if(_[_0xa277('0x6f')](_0x25172b[_0xa277('0xae')])){return _0x535f70[_0xa277('0xb3')](_0x10ce6a);}else{if(!fs['existsSync'](path[_0xa277('0xb4')](config[_0xa277('0xb1')],_0xa277('0xb5'),_0x25172b[_0xa277('0xae')]))){return _0x535f70['download'](_0x10ce6a);}return _0x535f70[_0xa277('0xb3')](path[_0xa277('0xb4')](config['root'],_0xa277('0xb5'),_0x25172b['userpic']));}}})['catch'](handleError(_0x535f70,null));};exports[_0xa277('0xb6')]=function(_0x18171b,_0x493e8c,_0x463310){var _0x1a2363={};var _0x58358b={};var _0x13924b;var _0x2f0603;return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x18171b['params']['id']}})['then'](handleEntityNotFound(_0x493e8c,null))[_0xa277('0x32')](function(_0x35f136){if(_0x35f136){_0x13924b=_0x35f136;_0x58358b[_0xa277('0x45')]=_['keys'](db[_0xa277('0xb7')]['rawAttributes']);_0x58358b[_0xa277('0x49')]=_['keys'](_0x18171b[_0xa277('0x49')]);_0x58358b[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x58358b[_0xa277('0x45')],_0x58358b['query']);_0x1a2363['attributes']=_[_0xa277('0x4b')](_0x58358b['model'],qs[_0xa277('0x4d')](_0x18171b[_0xa277('0x49')][_0xa277('0x4d')]));_0x1a2363[_0xa277('0x4c')]=_0x1a2363[_0xa277('0x4c')][_0xa277('0x4e')]?_0x1a2363['attributes']:_0x58358b[_0xa277('0x45')];_0x1a2363[_0xa277('0x51')]=qs['sort'](_0x18171b[_0xa277('0x49')][_0xa277('0x52')]);_0x1a2363[_0xa277('0x53')]=qs[_0xa277('0x54')](_[_0xa277('0x55')](_0x18171b['query'],_0x58358b[_0xa277('0x54')]));if(_0x18171b[_0xa277('0x49')][_0xa277('0x38')]){_0x1a2363[_0xa277('0x53')]=_[_0xa277('0x62')](_0x1a2363[_0xa277('0x53')],{'$or':_['map'](_0x1a2363[_0xa277('0x4c')],function(_0x4b9d59){var _0xee227f={};_0xee227f[_0x4b9d59]={'$like':'%'+_0x18171b[_0xa277('0x49')][_0xa277('0x38')]+'%'};return _0xee227f;})});}_0x1a2363=_[_0xa277('0x62')]({},_0x1a2363,_0x18171b['options']);return _0x13924b[_0xa277('0xb6')](_0x1a2363);}})[_0xa277('0x32')](function(_0xaf5df4){if(_0xaf5df4){_0x2f0603=_0xaf5df4[_0xa277('0x4e')];if(_0x18171b['query'][_0xa277('0x4f')](_0xa277('0x5d'))){_0x1a2363[_0xa277('0x61')]=[{'model':db[_0xa277('0xb8')],'as':'List','required':![]},{'model':db[_0xa277('0xb9')],'as':_0xa277('0xba'),'attributes':['id','name',_0xa277('0xbb')],'where':_0x18171b[_0xa277('0x49')][_0xa277('0xbc')]?{'id':_0x18171b['query']['tag']}:undefined,'required':_0x18171b[_0xa277('0x49')]['tag']?!![]:![]}];}if(!_0x18171b[_0xa277('0x49')][_0xa277('0x4f')](_0xa277('0xbd'))){_0x1a2363[_0xa277('0x50')]=qs[_0xa277('0x50')](_0x18171b['query'][_0xa277('0x50')]);_0x1a2363[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x18171b[_0xa277('0x49')][_0xa277('0x2c')]);}return _0x13924b['getContacts'](_0x1a2363);}})['then'](function(_0x526514){if(_0x526514){return _0x526514?{'count':_0x2f0603,'rows':_0x526514}:null;}})[_0xa277('0x32')](respondWithResult(_0x493e8c,null))[_0xa277('0x28')](handleError(_0x493e8c,null));};exports['getQueues']=function(_0x45b484,_0x2d8867,_0x4277ff){var _0x5f4ba5;var _0x5be55c;var _0x322218={};var _0x34650b;return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x45b484[_0xa277('0x65')]['id']},'attributes':['id','name',_0xa277('0x3d')]})[_0xa277('0x32')](handleEntityNotFound(_0x2d8867,null))[_0xa277('0x32')](function(_0x4ce6d3){if(!utils[_0xa277('0x99')](_0x45b484[_0xa277('0x49')][_0xa277('0xab')])){throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))](_0xa277('0x9a'));}_0x5f4ba5=_0x4ce6d3;var _0x4708c0={};_0x4708c0[_0xa277('0x45')]=_[_0xa277('0x4a')](db[_[_0xa277('0x9c')](_0x45b484[_0xa277('0x49')]['channel'])+'Queue'][_0xa277('0x44')]);_0x4708c0[_0xa277('0x49')]=_['keys'](_0x45b484[_0xa277('0x49')]);_0x4708c0[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x4708c0[_0xa277('0x45')],_0x4708c0[_0xa277('0x49')]);_0x322218[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x4708c0['model'],qs['fields'](_0x45b484[_0xa277('0x49')][_0xa277('0x4d')]));_0x322218['attributes']=_0x322218[_0xa277('0x4c')]['length']?_0x322218[_0xa277('0x4c')]:_0x4708c0[_0xa277('0x45')];_0x322218[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x45b484['query']['sort']);_0x322218[_0xa277('0x53')]=qs['filters'](_[_0xa277('0x55')](_0x45b484[_0xa277('0x49')],_0x4708c0[_0xa277('0x54')]));if(_0x45b484['query'][_0xa277('0x38')]){_0x322218[_0xa277('0x53')]=_[_0xa277('0x62')](_0x322218[_0xa277('0x53')],{'$or':_['map'](_0x322218[_0xa277('0x4c')],function(_0x503a06){var _0xf9381={};_0xf9381[_0x503a06]={'$like':'%'+_0x45b484['query']['filter']+'%'};return _0xf9381;})});}_0x322218=_[_0xa277('0x62')]({},_0x322218,_0x45b484[_0xa277('0x5b')]);switch(_0x5f4ba5[_0xa277('0x3d')]){case _0xa277('0x6b'):return db[_[_0xa277('0x9c')](_0x45b484[_0xa277('0x49')][_0xa277('0xab')])+'Queue']['findAll'](_0x322218);case _0xa277('0x88'):case'agent':return _0x5f4ba5[_0xa277('0x8a')+_[_0xa277('0x9c')](_0x45b484[_0xa277('0x49')][_0xa277('0xab')])+_0xa277('0x9e')](_0x322218);default:throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))](_0xa277('0xbe'));}})[_0xa277('0x32')](function(_0x4be4e7){_0x34650b=_0x4be4e7[_0xa277('0x4e')];if(!_0x45b484[_0xa277('0x49')][_0xa277('0x4f')](_0xa277('0xbd'))){_0x322218[_0xa277('0x50')]=qs[_0xa277('0x50')](_0x45b484['query'][_0xa277('0x50')]);_0x322218[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x45b484[_0xa277('0x49')][_0xa277('0x2c')]);}switch(_0x5f4ba5[_0xa277('0x3d')]){case _0xa277('0x6b'):return db[_['capitalize'](_0x45b484[_0xa277('0x49')][_0xa277('0xab')])+_0xa277('0xbf')][_0xa277('0x5e')](_0x322218);case _0xa277('0x88'):case'agent':return _0x5f4ba5['get'+_[_0xa277('0x9c')](_0x45b484['query']['channel'])+_0xa277('0x9e')](_0x322218);}})['then'](function(_0x32e036){return{'count':_0x34650b,'rows':_0x32e036};})[_0xa277('0x32')](respondWithResult(_0x2d8867,null))[_0xa277('0x28')](handleError(_0x2d8867,null));};exports[_0xa277('0xc0')]=function(_0x31ab8e,_0x101f5a,_0x24a3d2){var _0x278a59={};var _0x3aba98={};var _0x50cbbb;var _0x512a22;return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x31ab8e[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x101f5a,null))['then'](function(_0x2cc2b2){if(_0x2cc2b2){_0x50cbbb=_0x2cc2b2;_0x3aba98[_0xa277('0x45')]=_[_0xa277('0x4a')](db[_0xa277('0xa7')]['rawAttributes']);_0x3aba98[_0xa277('0x49')]=_['keys'](_0x31ab8e[_0xa277('0x49')]);_0x3aba98[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x3aba98['model'],_0x3aba98['query']);_0x278a59[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x3aba98[_0xa277('0x45')],qs[_0xa277('0x4d')](_0x31ab8e[_0xa277('0x49')][_0xa277('0x4d')]));_0x278a59[_0xa277('0x4c')]=_0x278a59[_0xa277('0x4c')][_0xa277('0x4e')]?_0x278a59['attributes']:_0x3aba98[_0xa277('0x45')];_0x278a59[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x31ab8e[_0xa277('0x49')][_0xa277('0x52')]);_0x278a59[_0xa277('0x53')]=qs[_0xa277('0x54')](_['pick'](_0x31ab8e[_0xa277('0x49')],_0x3aba98[_0xa277('0x54')]));if(_0x31ab8e[_0xa277('0x49')][_0xa277('0x38')]){_0x278a59[_0xa277('0x53')]=_[_0xa277('0x62')](_0x278a59['where'],{'$or':_[_0xa277('0x3a')](_0x278a59['attributes'],function(_0x295b61){var _0x27bd20={};_0x27bd20[_0x295b61]={'$like':'%'+_0x31ab8e[_0xa277('0x49')]['filter']+'%'};return _0x27bd20;})});}_0x278a59=_[_0xa277('0x62')]({},_0x278a59,_0x31ab8e[_0xa277('0x5b')]);return _0x50cbbb['getVoiceQueuesRt'](_0x278a59);}})[_0xa277('0x32')](function(_0x35866b){if(_0x35866b){_0x512a22=_0x35866b['length'];if(!_0x31ab8e[_0xa277('0x49')][_0xa277('0x4f')](_0xa277('0xbd'))){_0x278a59[_0xa277('0x50')]=qs[_0xa277('0x50')](_0x31ab8e[_0xa277('0x49')][_0xa277('0x50')]);_0x278a59[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x31ab8e[_0xa277('0x49')][_0xa277('0x2c')]);}return _0x50cbbb[_0xa277('0xc0')](_0x278a59);}})['then'](function(_0x355f10){if(_0x355f10){return _0x355f10?{'count':_0x512a22,'rows':_0x355f10}:null;}})[_0xa277('0x32')](respondWithResult(_0x101f5a,null))['catch'](handleError(_0x101f5a,null));};exports[_0xa277('0xc1')]=function(_0x9c5432,_0x1a8df6,_0xf401ef){var _0x38fd62={};var _0x5810b8={};var _0x379ce1;var _0x3449a7;return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x9c5432[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x1a8df6,null))[_0xa277('0x32')](function(_0x2c44de){if(_0x2c44de){_0x379ce1=_0x2c44de;_0x5810b8['model']=_[_0xa277('0x4a')](db[_0xa277('0xc2')][_0xa277('0x44')]);_0x5810b8[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x9c5432[_0xa277('0x49')]);_0x5810b8[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x5810b8[_0xa277('0x45')],_0x5810b8[_0xa277('0x49')]);_0x38fd62[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x5810b8[_0xa277('0x45')],qs[_0xa277('0x4d')](_0x9c5432['query'][_0xa277('0x4d')]));_0x38fd62['attributes']=_0x38fd62[_0xa277('0x4c')]['length']?_0x38fd62[_0xa277('0x4c')]:_0x5810b8[_0xa277('0x45')];_0x38fd62[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x9c5432['query'][_0xa277('0x52')]);_0x38fd62[_0xa277('0x53')]=qs[_0xa277('0x54')](_[_0xa277('0x55')](_0x9c5432[_0xa277('0x49')],_0x5810b8['filters']));if(_0x9c5432[_0xa277('0x49')][_0xa277('0x38')]){_0x38fd62['where']=_[_0xa277('0x62')](_0x38fd62[_0xa277('0x53')],{'$or':_['map'](_0x38fd62[_0xa277('0x4c')],function(_0x2858c6){var _0x250c5e={};_0x250c5e[_0x2858c6]={'$like':'%'+_0x9c5432[_0xa277('0x49')][_0xa277('0x38')]+'%'};return _0x250c5e;})});}_0x38fd62=_['merge']({},_0x38fd62,_0x9c5432[_0xa277('0x5b')]);return _0x379ce1[_0xa277('0xc1')](_0x38fd62);}})[_0xa277('0x32')](function(_0x56cd52){if(_0x56cd52){_0x3449a7=_0x56cd52[_0xa277('0x4e')];if(!_0x9c5432[_0xa277('0x49')][_0xa277('0x4f')](_0xa277('0xbd'))){_0x38fd62['limit']=qs['limit'](_0x9c5432[_0xa277('0x49')][_0xa277('0x50')]);_0x38fd62[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x9c5432['query'][_0xa277('0x2c')]);}return _0x379ce1[_0xa277('0xc1')](_0x38fd62);}})[_0xa277('0x32')](function(_0x21d29b){if(_0x21d29b){return _0x21d29b?{'count':_0x3449a7,'rows':_0x21d29b}:null;}})[_0xa277('0x32')](respondWithResult(_0x1a8df6,null))['catch'](handleError(_0x1a8df6,null));};exports[_0xa277('0xc3')]=function(_0x3b22c3,_0x154127,_0x295ecf){var _0x558437={'raw':!![],'where':{}};var _0x121d36={};var _0x3496e5={'count':0x0,'rows':[]};return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x3b22c3[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x154127,null))[_0xa277('0x32')](function(_0x29eaef){if(_0x29eaef){_0x121d36[_0xa277('0x45')]=_[_0xa277('0x4a')](db[_0xa277('0xc4')][_0xa277('0x44')]);_0x121d36[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x3b22c3[_0xa277('0x49')]);_0x121d36[_0xa277('0x54')]=_['intersection'](_0x121d36[_0xa277('0x45')],_0x121d36[_0xa277('0x49')]);_0x558437[_0xa277('0x4c')]=_['intersection'](_0x121d36[_0xa277('0x45')],qs['fields'](_0x3b22c3[_0xa277('0x49')]['fields']));_0x558437[_0xa277('0x4c')]=_0x558437[_0xa277('0x4c')]['length']?_0x558437[_0xa277('0x4c')]:_0x121d36['model'];if(!_0x3b22c3[_0xa277('0x49')]['hasOwnProperty'](_0xa277('0xbd'))){_0x558437['limit']=qs[_0xa277('0x50')](_0x3b22c3['query'][_0xa277('0x50')]);_0x558437[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x3b22c3[_0xa277('0x49')][_0xa277('0x2c')]);}_0x558437[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x3b22c3['query'][_0xa277('0x52')]);_0x558437[_0xa277('0x53')]=qs['filters'](_[_0xa277('0x55')](_0x3b22c3['query'],_0x121d36[_0xa277('0x54')]));_0x558437[_0xa277('0x53')][_0xa277('0xc5')]=_0x29eaef['id'];if(_0x3b22c3[_0xa277('0x49')][_0xa277('0x38')]){_0x558437[_0xa277('0x53')]=_['merge'](_0x558437[_0xa277('0x53')],{'$or':_[_0xa277('0x3a')](_0x558437[_0xa277('0x4c')],function(_0x146816){var _0x763c88={};_0x763c88[_0x146816]={'$like':'%'+_0x3b22c3[_0xa277('0x49')]['filter']+'%'};return _0x763c88;})});}_0x558437=_[_0xa277('0x62')]({},_0x558437,_0x3b22c3['options']);return db[_0xa277('0xc4')][_0xa277('0x5c')]({'where':_0x558437[_0xa277('0x53')]})['then'](function(_0x9c056e){_0x3496e5[_0xa277('0x5c')]=_0x9c056e;if(_0x3b22c3[_0xa277('0x49')]['includeAll']){_0x558437[_0xa277('0x61')]=[{'all':!![]}];}return db[_0xa277('0xc4')][_0xa277('0x5e')](_0x558437);})[_0xa277('0x32')](function(_0xe11891){_0x3496e5[_0xa277('0x5f')]=_0xe11891;return _0x3496e5;});}})[_0xa277('0x32')](respondWithFilteredResult(_0x154127,_0x558437))[_0xa277('0x28')](handleError(_0x154127,null));};exports['getScreenRecordings']=function(_0x516be0,_0x4de6c2,_0x11a357){var _0x14e327={'raw':!![],'where':{}};var _0x18adf8={};var _0x2f8dd1={'count':0x0,'rows':[]};return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x516be0[_0xa277('0x65')]['id']}})['then'](handleEntityNotFound(_0x4de6c2,null))['then'](function(_0x39dbec){if(_0x39dbec){_0x18adf8[_0xa277('0x45')]=_[_0xa277('0x4a')](db[_0xa277('0xc6')][_0xa277('0x44')]);_0x18adf8[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x516be0[_0xa277('0x49')]);_0x18adf8[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x18adf8[_0xa277('0x45')],_0x18adf8[_0xa277('0x49')]);_0x14e327[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x18adf8['model'],qs['fields'](_0x516be0['query']['fields']));_0x14e327[_0xa277('0x4c')]=_0x14e327[_0xa277('0x4c')][_0xa277('0x4e')]?_0x14e327['attributes']:_0x18adf8[_0xa277('0x45')];if(!_0x516be0[_0xa277('0x49')][_0xa277('0x4f')](_0xa277('0xbd'))){_0x14e327[_0xa277('0x50')]=qs[_0xa277('0x50')](_0x516be0[_0xa277('0x49')][_0xa277('0x50')]);_0x14e327[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x516be0[_0xa277('0x49')][_0xa277('0x2c')]);}_0x14e327[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x516be0[_0xa277('0x49')][_0xa277('0x52')]);_0x14e327['where']=qs[_0xa277('0x54')](_[_0xa277('0x55')](_0x516be0[_0xa277('0x49')],_0x18adf8[_0xa277('0x54')]));_0x14e327['where']['UserId']=_0x39dbec['id'];if(_0x516be0[_0xa277('0x49')]['filter']){_0x14e327['where']=_[_0xa277('0x62')](_0x14e327[_0xa277('0x53')],{'$or':_[_0xa277('0x3a')](_0x14e327[_0xa277('0x4c')],function(_0x1d5ffc){var _0x105e60={};_0x105e60[_0x1d5ffc]={'$like':'%'+_0x516be0[_0xa277('0x49')]['filter']+'%'};return _0x105e60;})});}_0x14e327=_['merge']({},_0x14e327,_0x516be0['options']);return db['ScreenRecording'][_0xa277('0x5c')]({'where':_0x14e327[_0xa277('0x53')]})['then'](function(_0x119a54){_0x2f8dd1[_0xa277('0x5c')]=_0x119a54;if(_0x516be0[_0xa277('0x49')][_0xa277('0x5d')]){_0x14e327[_0xa277('0x61')]=[{'all':!![]}];}return db[_0xa277('0xc6')][_0xa277('0x5e')](_0x14e327);})[_0xa277('0x32')](function(_0x2b6423){_0x2f8dd1[_0xa277('0x5f')]=_0x2b6423;return _0x2f8dd1;});}})[_0xa277('0x32')](respondWithFilteredResult(_0x4de6c2,_0x14e327))[_0xa277('0x28')](handleError(_0x4de6c2,null));};exports[_0xa277('0xc7')]=function(_0x416301,_0x5258d5,_0x25208a){var _0x2b571e={};var _0x6c3ff1={};var _0x378e4d;var _0x18a72f;return db[_0xa277('0x43')]['findOne']({'where':{'id':_0x416301['params']['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x5258d5,null))[_0xa277('0x32')](function(_0x2a4ad7){if(_0x2a4ad7){_0x378e4d=_0x2a4ad7;_0x6c3ff1[_0xa277('0x45')]=_[_0xa277('0x4a')](db[_0xa277('0xc8')][_0xa277('0x44')]);_0x6c3ff1[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x416301['query']);_0x6c3ff1[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x6c3ff1[_0xa277('0x45')],_0x6c3ff1[_0xa277('0x49')]);_0x2b571e[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x6c3ff1['model'],qs['fields'](_0x416301[_0xa277('0x49')]['fields']));_0x2b571e[_0xa277('0x4c')]=_0x2b571e[_0xa277('0x4c')][_0xa277('0x4e')]?_0x2b571e[_0xa277('0x4c')]:_0x6c3ff1['model'];_0x2b571e[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x416301['query'][_0xa277('0x52')]);_0x2b571e[_0xa277('0x53')]=qs[_0xa277('0x54')](_['pick'](_0x416301['query'],_0x6c3ff1[_0xa277('0x54')]));if(_0x416301[_0xa277('0x49')][_0xa277('0x38')]){_0x2b571e[_0xa277('0x53')]=_[_0xa277('0x62')](_0x2b571e['where'],{'$or':_[_0xa277('0x3a')](_0x2b571e['attributes'],function(_0x394e54){var _0x25da28={};_0x25da28[_0x394e54]={'$like':'%'+_0x416301[_0xa277('0x49')][_0xa277('0x38')]+'%'};return _0x25da28;})});}_0x2b571e=_[_0xa277('0x62')]({},_0x2b571e,_0x416301[_0xa277('0x5b')]);return _0x378e4d['getChatInteractions'](_0x2b571e);}})['then'](function(_0x17272f){if(_0x17272f){_0x18a72f=_0x17272f['length'];if(!_0x416301[_0xa277('0x49')][_0xa277('0x4f')](_0xa277('0xbd'))){_0x2b571e[_0xa277('0x50')]=qs[_0xa277('0x50')](_0x416301[_0xa277('0x49')][_0xa277('0x50')]);_0x2b571e[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x416301[_0xa277('0x49')][_0xa277('0x2c')]);}return _0x378e4d[_0xa277('0xc7')](_0x2b571e);}})[_0xa277('0x32')](function(_0x1e9f60){if(_0x1e9f60){return _0x1e9f60?{'count':_0x18a72f,'rows':_0x1e9f60}:null;}})[_0xa277('0x32')](respondWithResult(_0x5258d5,null))[_0xa277('0x28')](handleError(_0x5258d5,null));};exports[_0xa277('0xc9')]=function(_0x4ba21d,_0x1a628e,_0x2362f7){var _0x4ecf1a={};var _0x330351={};var _0x317fc1;var _0x26f107;return db['User'][_0xa277('0x8f')]({'where':{'id':_0x4ba21d[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x1a628e,null))[_0xa277('0x32')](function(_0x3f6e74){if(_0x3f6e74){_0x317fc1=_0x3f6e74;_0x330351[_0xa277('0x45')]=_['keys'](db['OpenchannelInteraction'][_0xa277('0x44')]);_0x330351[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x4ba21d[_0xa277('0x49')]);_0x330351['filters']=_['intersection'](_0x330351[_0xa277('0x45')],_0x330351[_0xa277('0x49')]);_0x4ecf1a[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x330351[_0xa277('0x45')],qs[_0xa277('0x4d')](_0x4ba21d[_0xa277('0x49')][_0xa277('0x4d')]));_0x4ecf1a[_0xa277('0x4c')]=_0x4ecf1a[_0xa277('0x4c')][_0xa277('0x4e')]?_0x4ecf1a[_0xa277('0x4c')]:_0x330351['model'];_0x4ecf1a[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x4ba21d[_0xa277('0x49')][_0xa277('0x52')]);_0x4ecf1a[_0xa277('0x53')]=qs[_0xa277('0x54')](_[_0xa277('0x55')](_0x4ba21d[_0xa277('0x49')],_0x330351[_0xa277('0x54')]));if(_0x4ba21d[_0xa277('0x49')][_0xa277('0x38')]){_0x4ecf1a[_0xa277('0x53')]=_['merge'](_0x4ecf1a[_0xa277('0x53')],{'$or':_['map'](_0x4ecf1a[_0xa277('0x4c')],function(_0x495479){var _0x217311={};_0x217311[_0x495479]={'$like':'%'+_0x4ba21d['query'][_0xa277('0x38')]+'%'};return _0x217311;})});}_0x4ecf1a=_[_0xa277('0x62')]({},_0x4ecf1a,_0x4ba21d[_0xa277('0x5b')]);return _0x317fc1[_0xa277('0xc9')](_0x4ecf1a);}})['then'](function(_0x4c08f0){if(_0x4c08f0){_0x26f107=_0x4c08f0['length'];if(!_0x4ba21d[_0xa277('0x49')][_0xa277('0x4f')]('nolimit')){_0x4ecf1a['limit']=qs[_0xa277('0x50')](_0x4ba21d['query'][_0xa277('0x50')]);_0x4ecf1a[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x4ba21d[_0xa277('0x49')][_0xa277('0x2c')]);}return _0x317fc1['getOpenchannelInteractions'](_0x4ecf1a);}})[_0xa277('0x32')](function(_0x34508e){if(_0x34508e){return _0x34508e?{'count':_0x26f107,'rows':_0x34508e}:null;}})[_0xa277('0x32')](respondWithResult(_0x1a628e,null))[_0xa277('0x28')](handleError(_0x1a628e,null));};exports[_0xa277('0xca')]=function(_0x5a562b,_0x4516e5,_0x1ef1ae){var _0x2c609c={'raw':!![],'where':{}};var _0x1506c8={};var _0x30555e={'count':0x0,'rows':[]};return db[_0xa277('0x43')]['findOne']({'where':{'id':_0x5a562b[_0xa277('0x65')]['id']}})['then'](handleEntityNotFound(_0x4516e5,null))[_0xa277('0x32')](function(_0x5a9bd0){if(_0x5a9bd0){_0x1506c8[_0xa277('0x45')]=_[_0xa277('0x4a')](db[_0xa277('0xcb')][_0xa277('0x44')]);_0x1506c8[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x5a562b['query']);_0x1506c8[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x1506c8[_0xa277('0x45')],_0x1506c8[_0xa277('0x49')]);_0x2c609c['attributes']=_['intersection'](_0x1506c8[_0xa277('0x45')],qs[_0xa277('0x4d')](_0x5a562b[_0xa277('0x49')][_0xa277('0x4d')]));_0x2c609c[_0xa277('0x4c')]=_0x2c609c['attributes']['length']?_0x2c609c[_0xa277('0x4c')]:_0x1506c8[_0xa277('0x45')];if(!_0x5a562b[_0xa277('0x49')][_0xa277('0x4f')](_0xa277('0xbd'))){_0x2c609c['limit']=qs[_0xa277('0x50')](_0x5a562b[_0xa277('0x49')][_0xa277('0x50')]);_0x2c609c[_0xa277('0x2c')]=qs['offset'](_0x5a562b['query'][_0xa277('0x2c')]);}_0x2c609c['order']=qs['sort'](_0x5a562b[_0xa277('0x49')][_0xa277('0x52')]);_0x2c609c['where']=qs[_0xa277('0x54')](_[_0xa277('0x55')](_0x5a562b[_0xa277('0x49')],_0x1506c8[_0xa277('0x54')]));_0x2c609c['where'][_0xa277('0xc5')]=_0x5a9bd0['id'];if(_0x5a562b[_0xa277('0x49')][_0xa277('0x38')]){_0x2c609c[_0xa277('0x53')]=_[_0xa277('0x62')](_0x2c609c[_0xa277('0x53')],{'$or':_[_0xa277('0x3a')](_0x2c609c[_0xa277('0x4c')],function(_0xbc60c0){var _0xb02963={};_0xb02963[_0xbc60c0]={'$like':'%'+_0x5a562b[_0xa277('0x49')][_0xa277('0x38')]+'%'};return _0xb02963;})});}_0x2c609c=_[_0xa277('0x62')]({},_0x2c609c,_0x5a562b[_0xa277('0x5b')]);return db[_0xa277('0xcb')][_0xa277('0x5c')]({'where':_0x2c609c[_0xa277('0x53')]})[_0xa277('0x32')](function(_0x1ed6c3){_0x30555e[_0xa277('0x5c')]=_0x1ed6c3;if(_0x5a562b['query']['includeAll']){_0x2c609c[_0xa277('0x61')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x2c609c);})[_0xa277('0x32')](function(_0x163cd6){_0x30555e['rows']=_0x163cd6;return _0x30555e;});}})['then'](respondWithFilteredResult(_0x4516e5,_0x2c609c))[_0xa277('0x28')](handleError(_0x4516e5,null));};exports[_0xa277('0xcc')]=function(_0x13d777,_0x39a638,_0xca6798){var _0x55d350={};var _0x37728f={};var _0xf8730a;var _0xa0b613;return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x13d777[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x39a638,null))[_0xa277('0x32')](function(_0xe3b594){if(_0xe3b594){_0xf8730a=_0xe3b594;_0x37728f['model']=_[_0xa277('0x4a')](db[_0xa277('0xcd')][_0xa277('0x44')]);_0x37728f[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x13d777[_0xa277('0x49')]);_0x37728f['filters']=_[_0xa277('0x4b')](_0x37728f[_0xa277('0x45')],_0x37728f[_0xa277('0x49')]);_0x55d350[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x37728f['model'],qs[_0xa277('0x4d')](_0x13d777[_0xa277('0x49')]['fields']));_0x55d350[_0xa277('0x4c')]=_0x55d350[_0xa277('0x4c')][_0xa277('0x4e')]?_0x55d350[_0xa277('0x4c')]:_0x37728f[_0xa277('0x45')];_0x55d350[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x13d777[_0xa277('0x49')]['sort']);_0x55d350[_0xa277('0x53')]=qs['filters'](_[_0xa277('0x55')](_0x13d777[_0xa277('0x49')],_0x37728f[_0xa277('0x54')]));if(_0x13d777['query'][_0xa277('0x38')]){_0x55d350[_0xa277('0x53')]=_[_0xa277('0x62')](_0x55d350[_0xa277('0x53')],{'$or':_[_0xa277('0x3a')](_0x55d350[_0xa277('0x4c')],function(_0x2c4d9f){var _0x5d5b0b={};_0x5d5b0b[_0x2c4d9f]={'$like':'%'+_0x13d777[_0xa277('0x49')][_0xa277('0x38')]+'%'};return _0x5d5b0b;})});}_0x55d350=_[_0xa277('0x62')]({},_0x55d350,_0x13d777[_0xa277('0x5b')]);return _0xf8730a[_0xa277('0xcc')](_0x55d350);}})[_0xa277('0x32')](function(_0x348283){if(_0x348283){_0xa0b613=_0x348283['length'];if(!_0x13d777['query']['hasOwnProperty'](_0xa277('0xbd'))){_0x55d350[_0xa277('0x50')]=qs[_0xa277('0x50')](_0x13d777[_0xa277('0x49')][_0xa277('0x50')]);_0x55d350['offset']=qs[_0xa277('0x2c')](_0x13d777[_0xa277('0x49')][_0xa277('0x2c')]);}return _0xf8730a['getSmsInteractions'](_0x55d350);}})['then'](function(_0x4a5fdb){if(_0x4a5fdb){return _0x4a5fdb?{'count':_0xa0b613,'rows':_0x4a5fdb}:null;}})[_0xa277('0x32')](respondWithResult(_0x39a638,null))[_0xa277('0x28')](handleError(_0x39a638,null));};exports[_0xa277('0xce')]=function(_0x11da4d,_0x35c75b,_0x574625){var _0x3a24dc={};var _0x5cdd6c={};var _0xc75f19;var _0x5a3574;return db['User'][_0xa277('0x8f')]({'where':{'id':_0x11da4d['params']['id']}})['then'](handleEntityNotFound(_0x35c75b,null))[_0xa277('0x32')](function(_0x184355){if(_0x184355){_0xc75f19=_0x184355;_0x5cdd6c[_0xa277('0x45')]=_[_0xa277('0x4a')](db[_0xa277('0xcf')][_0xa277('0x44')]);_0x5cdd6c['query']=_[_0xa277('0x4a')](_0x11da4d[_0xa277('0x49')]);_0x5cdd6c[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x5cdd6c[_0xa277('0x45')],_0x5cdd6c[_0xa277('0x49')]);_0x3a24dc[_0xa277('0x4c')]=_['intersection'](_0x5cdd6c[_0xa277('0x45')],qs['fields'](_0x11da4d[_0xa277('0x49')][_0xa277('0x4d')]));_0x3a24dc[_0xa277('0x4c')]=_0x3a24dc[_0xa277('0x4c')][_0xa277('0x4e')]?_0x3a24dc[_0xa277('0x4c')]:_0x5cdd6c[_0xa277('0x45')];_0x3a24dc['order']=qs['sort'](_0x11da4d[_0xa277('0x49')][_0xa277('0x52')]);_0x3a24dc[_0xa277('0x53')]=qs[_0xa277('0x54')](_[_0xa277('0x55')](_0x11da4d[_0xa277('0x49')],_0x5cdd6c[_0xa277('0x54')]));if(_0x11da4d[_0xa277('0x49')][_0xa277('0x38')]){_0x3a24dc[_0xa277('0x53')]=_[_0xa277('0x62')](_0x3a24dc['where'],{'$or':_['map'](_0x3a24dc[_0xa277('0x4c')],function(_0x324f43){var _0x360cc9={};_0x360cc9[_0x324f43]={'$like':'%'+_0x11da4d['query'][_0xa277('0x38')]+'%'};return _0x360cc9;})});}_0x3a24dc=_[_0xa277('0x62')]({},_0x3a24dc,_0x11da4d[_0xa277('0x5b')]);return _0xc75f19[_0xa277('0xce')](_0x3a24dc);}})[_0xa277('0x32')](function(_0x5175a2){if(_0x5175a2){_0x5a3574=_0x5175a2[_0xa277('0x4e')];if(!_0x11da4d[_0xa277('0x49')][_0xa277('0x4f')]('nolimit')){_0x3a24dc[_0xa277('0x50')]=qs['limit'](_0x11da4d[_0xa277('0x49')]['limit']);_0x3a24dc[_0xa277('0x2c')]=qs['offset'](_0x11da4d[_0xa277('0x49')][_0xa277('0x2c')]);}return _0xc75f19['getFaxInteractions'](_0x3a24dc);}})[_0xa277('0x32')](function(_0x4422cf){if(_0x4422cf){return _0x4422cf?{'count':_0x5a3574,'rows':_0x4422cf}:null;}})['then'](respondWithResult(_0x35c75b,null))[_0xa277('0x28')](handleError(_0x35c75b,null));};exports[_0xa277('0xd0')]=function(_0x43324c,_0x454492,_0x252261){var _0x591098;var _0x1e227b;var _0x206b1e;var _0x17b387=!_[_0xa277('0x6f')](_0x43324c['params']['id'])?_0x43324c[_0xa277('0x65')]['id']:!_[_0xa277('0x6f')](_0x43324c[_0xa277('0x88')]['id'])?_0x43324c['user']['id']:null;return db[_0xa277('0x43')]['find']({'where':{'id':_0x17b387,'role':_0xa277('0x35')},'attributes':['id',_0xa277('0x3f'),_0xa277('0xd1'),_0xa277('0xd2'),_0xa277('0x3d'),_0xa277('0x72'),_0xa277('0xd3')]})['then'](handleEntityNotFound(_0x454492,null))[_0xa277('0x32')](function(_0x24697b){if(_0x24697b){_0x591098=_0x24697b;if(_0x43324c['body'][_0xa277('0x98')]){_0x206b1e=util[_0xa277('0x71')](_0xa277('0xd4'),_0x591098[_0x43324c[_0xa277('0x63')][_0xa277('0x98')]]);}else if(_0x43324c[_0xa277('0x63')][_0xa277('0xd5')]){_0x206b1e=util['format']('SIP/%s',_0x43324c[_0xa277('0x63')][_0xa277('0xd5')]);}else{_0x206b1e=util['format']('SIP/%s',_0x591098[_0xa277('0x3f')]);}socket['to'](util[_0xa277('0x71')]('user:%s',_0x591098['name']))[_0xa277('0xa1')](_0xa277('0xd6'),{'ip':_0x43324c['headers'][_0xa277('0xd7')]||_0x43324c[_0xa277('0xd8')]['remoteAddress']||_0x43324c['socket'][_0xa277('0xd9')]||_0x43324c[_0xa277('0xd8')][_0xa277('0xda')][_0xa277('0xd9')]});return db[_0xa277('0xa7')][_0xa277('0x33')]({'where':{'membername':_0x591098['name']},'individualHooks':!![]});}})[_0xa277('0x32')](function(_0x2461c6){if(_0x591098){return _0x591098[_0xa277('0xdb')]({'raw':!![]});}})[_0xa277('0x32')](function(_0x1a74fd){var _0x564f7d=[];if(_0x1a74fd){_0x1e227b=_0x1a74fd;if(_0x1e227b[_0xa277('0x4e')]){for(var _0x3da7fb=0x0;_0x3da7fb<_0x1e227b['length'];_0x3da7fb++){_0x564f7d[_0xa277('0xa4')]({'membername':_0x591098[_0xa277('0x3f')],'UserId':_0x591098['id'],'queue_name':_0x1e227b[_0x3da7fb]['name'],'VoiceQueueId':_0x1e227b[_0x3da7fb]['id'],'interface':_0x206b1e,'paused':_0x591098[_0xa277('0xd3')]||![],'penalty':_0x1e227b[_0x3da7fb][_0xa277('0xdc')]||0x0});}return BPromise[_0xa277('0xa6')](_0x564f7d,function(_0x20ceb7){return db['UserVoiceQueueRt']['upsert'](_0x20ceb7);});}}})[_0xa277('0x32')](function(){return db[_0xa277('0xdd')]['findAll']({'where':{'membername':_0x591098[_0xa277('0x3f')],'exitAt':null}});})[_0xa277('0x32')](function(_0x3b764c){var _0x5dea4d=[];_0x3b764c[_0xa277('0xde')](function(_0xd65ff4){_0x5dea4d[_0xa277('0xa4')](_0xd65ff4[_0xa277('0x64')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x5dea4d);})[_0xa277('0x32')](function(){var _0x2c8fba=[];var _0x268b8c=[];var _0x5420e8=utils[_0xa277('0xdf')]();var _0x1ec925={'membername':_0x591098['name'],'interface':_0x206b1e,'enterAt':moment()[_0xa277('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x591098[_0xa277('0x3d')],'internal':_0x591098[_0xa277('0x72')]};_0x5420e8[_0xa277('0xde')](function(_0x34535f){_0x2c8fba[_0xa277('0xa4')](_['merge']({'channel':_0x34535f,'type':_0xa277('0xe0'),'data1':_0x43324c[_0xa277('0x63')][_0xa277('0xe1')],'data2':_0x206b1e},_0x1ec925));if(_0x591098[_0xa277('0xd3')]){_0x268b8c[_0xa277('0xa4')](_[_0xa277('0x62')]({'channel':_0x34535f,'type':'PAUSE','data1':_0xa277('0xe2')},_0x1ec925));}});return db['MemberReport'][_0xa277('0xe3')](_0x2c8fba[_0xa277('0xe4')](_0x268b8c),{'individualHooks':!![]});})[_0xa277('0x32')](function(){return _0x591098[_0xa277('0x64')]({'online':!![],'lastLoginAt':moment()[_0xa277('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x591098[_0xa277('0xd3')]||![],'mailPause':_0x591098[_0xa277('0xd3')]||![],'chatPause':_0x591098[_0xa277('0xd3')]||![],'faxPause':_0x591098[_0xa277('0xd3')]||![],'smsPause':_0x591098['loginInPause']||![],'openchannelPause':_0x591098[_0xa277('0xd3')]||![],'pauseType':_0x591098[_0xa277('0xd3')]?_0xa277('0xe2'):null,'interface':_0x206b1e,'lastPauseAt':moment()[_0xa277('0x71')](_0xa277('0xe5'))});})['then'](function(_0x590f0b){if(_0x43324c[_0xa277('0xe6')]){return _0x252261();}else{return BPromise[_0xa277('0xe7')](_0x590f0b)[_0xa277('0x32')](respondWithResult(_0x454492,null));}})[_0xa277('0x28')](handleError(_0x454492,null));};exports[_0xa277('0xe8')]=function(_0x1a6d66,_0x3f8e50,_0x467e3f){var _0x17db57;return db['User'][_0xa277('0x3e')]({'where':{'id':_0x1a6d66['params']['id'],'role':_0xa277('0x35')},'attributes':['id',_0xa277('0x3f'),'role']})[_0xa277('0x32')](handleEntityNotFound(_0x3f8e50,null))['then'](function(_0xc1d8e6){if(_0xc1d8e6){_0x17db57=_0xc1d8e6;return db[_0xa277('0xa7')][_0xa277('0x33')]({'where':{'membername':_0x17db57['name']},'individualHooks':!![]});}})[_0xa277('0x32')](function(){return db[_0xa277('0xdd')]['findAll']({'where':{'membername':_0x17db57[_0xa277('0x3f')],'exitAt':null}});})['then'](function(_0x13f801){var _0x2c1039=[];_0x13f801[_0xa277('0xde')](function(_0x27bd72){_0x2c1039[_0xa277('0xa4')](_0x27bd72[_0xa277('0x64')]({'exitAt':moment()[_0xa277('0x71')](_0xa277('0xe5'))}));});return BPromise[_0xa277('0xe9')](_0x2c1039);})[_0xa277('0x32')](function(){return _0x17db57[_0xa277('0x64')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xa277('0x32')](respondWithResult(_0x3f8e50,null))[_0xa277('0x28')](handleError(_0x3f8e50,null));};exports[_0xa277('0xea')]=function(_0x317411,_0x51c5ab,_0x2b6849){var _0x435165;return db[_0xa277('0xa7')][_0xa277('0x64')]({'paused':0x1},{'where':{'UserId':_0x317411[_0xa277('0x65')]['id']},'individualHooks':!![]})[_0xa277('0x32')](function(){return db[_0xa277('0x43')][_0xa277('0x3e')]({'where':{'id':_0x317411[_0xa277('0x65')]['id'],'role':_0xa277('0x35')},'attributes':['id',_0xa277('0x3f'),'role',_0xa277('0x72'),_0xa277('0x98')]});})[_0xa277('0x32')](handleEntityNotFound(_0x51c5ab,null))['then'](function(_0x236bf8){if(_0x236bf8){_0x435165=_0x236bf8;return respondWithRpcPromise(_0xa277('0xeb'),_0xa277('0xea'),{'id':_0x435165['id'],'name':_0x435165[_0xa277('0x3f')],'pause':!![]});}})[_0xa277('0x32')](function(){if(_0x435165){return db[_0xa277('0xdd')][_0xa277('0x5e')]({'where':{'membername':_0x435165[_0xa277('0x3f')],'type':_0xa277('0xec'),'exitAt':null}});}})['then'](function(_0xd2f17c){if(_0xd2f17c[_0xa277('0x4e')]){var _0x1fc6ea=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2472f1=0x0,_0x56453c=_0xd2f17c[_0xa277('0x4e')];_0x2472f1<_0x56453c;_0x2472f1++){_0xd2f17c[_0x2472f1]['updateAttributes']({'exitAt':_0x1fc6ea});}}})[_0xa277('0x32')](function(){var _0xc02ee6=[];var _0x451d04=utils['getChannels']();_0x451d04[_0xa277('0xde')](function(_0xffa81b){_0xc02ee6[_0xa277('0xa4')]({'channel':_0xffa81b,'membername':_0x435165['name'],'interface':_['isNil'](_0x435165[_0xa277('0x98')])?util[_0xa277('0x71')](_0xa277('0xa5'),_0x435165[_0xa277('0x3f')]):_0x435165[_0xa277('0x98')],'type':'PAUSE','enterAt':moment()['format'](_0xa277('0xe5')),'data1':_0x317411[_0xa277('0x63')][_0xa277('0x56')]||_0xa277('0xed'),'role':_0x435165[_0xa277('0x3d')],'internal':_0x435165[_0xa277('0x72')]});});return db[_0xa277('0xdd')][_0xa277('0xe3')](_0xc02ee6,{'individualHooks':!![]});})[_0xa277('0x32')](function(){return _0x435165[_0xa277('0x64')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x317411[_0xa277('0x63')][_0xa277('0x56')]||_0xa277('0xed'),'lastPauseAt':moment()[_0xa277('0x71')](_0xa277('0xe5'))});})[_0xa277('0x32')](respondWithResult(_0x51c5ab,null))[_0xa277('0x28')](handleError(_0x51c5ab,null));};exports[_0xa277('0xee')]=function(_0x5c6d45,_0x3da75a,_0xcf97e0){var _0x2f78a3;return db[_0xa277('0x43')][_0xa277('0x3e')]({'where':{'id':_0x5c6d45[_0xa277('0x65')]['id']},'attributes':['id','name',_0xa277('0x3d'),'voicePause',_0xa277('0xef'),'chatPause',_0xa277('0xf0'),'openchannelPause',_0xa277('0xf1'),_0xa277('0xf2'),_0xa277('0xf3')]})[_0xa277('0x32')](handleEntityNotFound(_0x3da75a,null))[_0xa277('0x32')](function(_0x2c1d8d){if(_0x2c1d8d){_0x2f78a3=_0x2c1d8d;if(_0x5c6d45[_0xa277('0x63')][_0xa277('0xab')]&&!utils['isValidChannel'](_0x5c6d45[_0xa277('0x63')]['channel'])){throw new db[(_0xa277('0x1d'))][(_0xa277('0x1e'))](_0xa277('0x9a'));}switch(_0x5c6d45['body'][_0xa277('0xab')]){case'voice':return respondWithRpcPromise('QueuePause',_0xa277('0xee'),{'id':_0x2f78a3['id'],'name':_0x2f78a3[_0xa277('0x3f')],'pause':![]})[_0xa277('0x32')](function(){return db['UserVoiceQueueRt'][_0xa277('0x64')]({'paused':0x0},{'where':{'UserId':_0x2f78a3['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport']['find']({'where':{'channel':_0x5c6d45[_0xa277('0x63')]['channel'],'membername':_0x2f78a3['name'],'type':_0xa277('0xec'),'exitAt':null}});})[_0xa277('0x32')](function(_0x3a8555){if(_0x3a8555){return _0x3a8555[_0xa277('0x64')]({'exitAt':moment()[_0xa277('0x71')](_0xa277('0xe5')),'data2':_0xa277('0xf4')},{'individualHooks':!![]});}return null;})[_0xa277('0x32')](function(){return _0x2f78a3[_0xa277('0x64')]({'voicePause':![]});});case _0xa277('0xf5'):case _0xa277('0xf6'):case _0xa277('0xf7'):case'sms':case'openchannel':return db[_0xa277('0xdd')][_0xa277('0x3e')]({'where':{'channel':_0x5c6d45[_0xa277('0x63')][_0xa277('0xab')],'membername':_0x2f78a3[_0xa277('0x3f')],'type':_0xa277('0xec'),'exitAt':null}})['then'](function(_0x335d72){if(_0x335d72){return _0x335d72['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xa277('0x32')](function(){var _0x4b4965={};_[_0xa277('0x2d')](_0x4b4965,util[_0xa277('0x71')](_0xa277('0xf8'),_0x5c6d45[_0xa277('0x63')]['channel'],_0xa277('0xf9')),![]);return _0x2f78a3[_0xa277('0x64')](_0x4b4965);});default:return respondWithRpcPromise(_0xa277('0xeb'),_0xa277('0xee'),{'id':_0x2f78a3['id'],'name':_0x2f78a3[_0xa277('0x3f')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0xa277('0x64')]({'paused':0x0},{'where':{'UserId':_0x2f78a3['id']}});})[_0xa277('0x32')](function(){return db[_0xa277('0xdd')]['findAll']({'where':{'membername':_0x2f78a3[_0xa277('0x3f')],'type':'PAUSE','exitAt':null}});})[_0xa277('0x32')](function(_0x19de39){var _0x372e46=[];_0x19de39['forEach'](function(_0x3ccf9a){_0x372e46[_0xa277('0xa4')](_0x3ccf9a[_0xa277('0x64')]({'exitAt':moment()[_0xa277('0x71')](_0xa277('0xe5')),'data2':_0xa277('0xf4')}));});return BPromise[_0xa277('0xe9')](_0x372e46);})[_0xa277('0x32')](function(){return _0x2f78a3[_0xa277('0x64')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x3da75a,null))[_0xa277('0x28')](handleError(_0x3da75a,null));};exports[_0xa277('0xfa')]=function(_0x57bcd4,_0x46454a,_0x40fd90){var _0x1ddc1f={};var _0x3c52d1={};var _0x39d528;var _0x354351;return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x57bcd4['params']['id']}})['then'](handleEntityNotFound(_0x46454a,null))[_0xa277('0x32')](function(_0x683a1b){if(_0x683a1b){_0x39d528=_0x683a1b;_0x3c52d1[_0xa277('0x45')]=_['keys'](db['Team'][_0xa277('0x44')]);_0x3c52d1[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x57bcd4[_0xa277('0x49')]);_0x3c52d1[_0xa277('0x54')]=_['intersection'](_0x3c52d1[_0xa277('0x45')],_0x3c52d1[_0xa277('0x49')]);_0x1ddc1f[_0xa277('0x4c')]=_[_0xa277('0x4b')](_0x3c52d1[_0xa277('0x45')],qs[_0xa277('0x4d')](_0x57bcd4['query'][_0xa277('0x4d')]));_0x1ddc1f[_0xa277('0x4c')]=_0x1ddc1f['attributes'][_0xa277('0x4e')]?_0x1ddc1f[_0xa277('0x4c')]:_0x3c52d1[_0xa277('0x45')];_0x1ddc1f[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x57bcd4[_0xa277('0x49')][_0xa277('0x52')]);_0x1ddc1f[_0xa277('0x53')]=qs['filters'](_[_0xa277('0x55')](_0x57bcd4[_0xa277('0x49')],_0x3c52d1['filters']));if(_0x57bcd4[_0xa277('0x49')][_0xa277('0x38')]){_0x1ddc1f[_0xa277('0x53')]=_[_0xa277('0x62')](_0x1ddc1f[_0xa277('0x53')],{'$or':_[_0xa277('0x3a')](_0x1ddc1f[_0xa277('0x4c')],function(_0x5ccf8b){var _0x19b931={};_0x19b931[_0x5ccf8b]={'$like':'%'+_0x57bcd4[_0xa277('0x49')][_0xa277('0x38')]+'%'};return _0x19b931;})});}_0x1ddc1f=_['merge']({},_0x1ddc1f,_0x57bcd4[_0xa277('0x5b')]);return _0x39d528[_0xa277('0xfa')](_0x1ddc1f);}})[_0xa277('0x32')](function(_0xffc838){if(_0xffc838){_0x354351=_0xffc838[_0xa277('0x4e')];if(!_0x57bcd4['query'][_0xa277('0x4f')](_0xa277('0xbd'))){_0x1ddc1f['limit']=qs[_0xa277('0x50')](_0x57bcd4[_0xa277('0x49')][_0xa277('0x50')]);_0x1ddc1f[_0xa277('0x2c')]=qs['offset'](_0x57bcd4[_0xa277('0x49')][_0xa277('0x2c')]);}return _0x39d528[_0xa277('0xfa')](_0x1ddc1f);}})[_0xa277('0x32')](function(_0x3552c6){if(_0x3552c6){return _0x3552c6?{'count':_0x354351,'rows':_0x3552c6}:null;}})[_0xa277('0x32')](respondWithResult(_0x46454a,null))['catch'](handleError(_0x46454a,null));};exports[_0xa277('0xfb')]=function(_0x41b4b1,_0x3321f4){return db[_0xa277('0x43')][_0xa277('0x3e')]({'where':{'id':_0x41b4b1[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x3321f4,null))[_0xa277('0x32')](function(_0x25376c){if(_0x25376c){var _0xaf714f=_0x25376c[_0xa277('0x8a')]({'plain':!![]});return _0x25376c[_0xa277('0xfb')](_0x41b4b1['body'][_0xa277('0x68')],_[_0xa277('0x69')](_0x41b4b1[_0xa277('0x63')],[_0xa277('0x68'),'id'])||{})[_0xa277('0x32')](function(){for(var _0x83edd2=0x0;_0x83edd2<_0x41b4b1['body'][_0xa277('0x68')][_0xa277('0x4e')];_0x83edd2++){var _0x312ece=[];db[_0xa277('0xfc')][_0xa277('0x8f')]({'where':{'id':_0x41b4b1[_0xa277('0x63')]['ids'][_0x83edd2]}})[_0xa277('0x32')](function(_0x4d74ac){_0x312ece[_0xa277('0xa4')](_0x4d74ac[_0xa277('0xdb')]()[_0xa277('0x32')](function(_0xfd9040){for(var _0x44ec00=0x0;_0x44ec00<_0xfd9040['length'];_0x44ec00++){_0xfd9040[_0x44ec00][_0xa277('0xfd')](_0xa277('0xab'),_0xa277('0xfe'));}return _0xfd9040;}));_0x312ece[_0xa277('0xa4')](_0x4d74ac[_0xa277('0xff')]()['then'](function(_0x5a841b){for(var _0x11deea=0x0;_0x11deea<_0x5a841b[_0xa277('0x4e')];_0x11deea++){_0x5a841b[_0x11deea][_0xa277('0xfd')](_0xa277('0xab'),_0xa277('0x100'));}return _0x5a841b;}));_0x312ece[_0xa277('0xa4')](_0x4d74ac['getMailQueues']()[_0xa277('0x32')](function(_0x3daafc){for(var _0x55d3be=0x0;_0x55d3be<_0x3daafc[_0xa277('0x4e')];_0x55d3be++){_0x3daafc[_0x55d3be]['setDataValue'](_0xa277('0xab'),_0xa277('0x101'));}return _0x3daafc;}));_0x312ece[_0xa277('0xa4')](_0x4d74ac[_0xa277('0x102')]()[_0xa277('0x32')](function(_0x34c568){for(var _0x1bb1c9=0x0;_0x1bb1c9<_0x34c568[_0xa277('0x4e')];_0x1bb1c9++){_0x34c568[_0x1bb1c9]['setDataValue'](_0xa277('0xab'),'Sms');}return _0x34c568;}));_0x312ece[_0xa277('0xa4')](_0x4d74ac['getFaxQueues']()[_0xa277('0x32')](function(_0x5c6334){for(var _0x8a071e=0x0;_0x8a071e<_0x5c6334['length'];_0x8a071e++){_0x5c6334[_0x8a071e][_0xa277('0xfd')]('channel',_0xa277('0x103'));}return _0x5c6334;}));_0x312ece[_0xa277('0xa4')](_0x4d74ac[_0xa277('0x104')]()[_0xa277('0x32')](function(_0x10cbf4){for(var _0x54c09e=0x0;_0x54c09e<_0x10cbf4[_0xa277('0x4e')];_0x54c09e++){_0x10cbf4[_0x54c09e][_0xa277('0xfd')](_0xa277('0xab'),_0xa277('0x105'));}return _0x10cbf4;}));return BPromise[_0xa277('0xe9')](_0x312ece);})[_0xa277('0x32')](function(_0x553102){var _0x46b779=_[_0xa277('0x106')](_0x553102);_0x312ece=[];return db[_0xa277('0x59')]['transaction'](function(_0x361961){for(var _0x4ba734=0x0;_0x4ba734<_0x46b779['length'];_0x4ba734++){_0x312ece[_0xa277('0xa4')](_0x46b779[_0x4ba734][_0xa277('0x107')](_0xaf714f['id']),{'transaction':_0x361961});}return BPromise[_0xa277('0xe9')](_0x312ece)[_0xa277('0x32')](function(){if(_0xaf714f[_0xa277('0x96')]){return BPromise[_0xa277('0xa6')](_[_0xa277('0x38')](_0x46b779,function(_0x56c39f){return _0x56c39f[_0xa277('0x108')]('channel')==='Voice';}),function(_0x5872c4){return db[_0xa277('0xa7')]['upsert']({'membername':_0xaf714f[_0xa277('0x3f')],'UserId':_0xaf714f['id'],'queue_name':_0x5872c4[_0xa277('0x3f')],'VoiceQueueId':_0x5872c4['id'],'interface':_[_0xa277('0x6f')](_0xaf714f[_0xa277('0x98')])?util[_0xa277('0x71')]('SIP/%s',_0xaf714f[_0xa277('0x3f')]):_0xaf714f[_0xa277('0x98')],'paused':_0xaf714f[_0xa277('0x97')]||![],'penalty':_0xaf714f[_0xa277('0x9f')]},{'transaction':_0x361961});});}else{return;}})[_0xa277('0x32')](function(){for(var _0x2e9178=0x0;_0x2e9178<_0x46b779[_0xa277('0x4e')];_0x2e9178++){var _0x261ba5=_0x46b779[_0x2e9178]['getDataValue'](_0xa277('0xab'));var _0x18d6d5=_0x261ba5+_0xa277('0x109');socket[_0xa277('0xa1')](_0xa277('0x88')+_0x261ba5+_0xa277('0xa2'),{'UserId':_0xaf714f['id'],['queueField']:_0x46b779[_0x2e9178]['id']});}});});});}});}})[_0xa277('0x32')](respondWithStatusCode(_0x3321f4,null))['catch'](handleError(_0x3321f4,null));};exports[_0xa277('0x10a')]=function(_0x266d64,_0x54d087){return db['User'][_0xa277('0x8f')]({'where':{'id':_0x266d64[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x54d087,null))[_0xa277('0x32')](function(_0x42ea07){if(_0x42ea07){var _0x3c98d0=_0x42ea07[_0xa277('0x8a')]({'plain':!![]});var _0x2b6295=_0x266d64['query'][_0xa277('0x68')];return _0x42ea07[_0xa277('0x10a')](_0x2b6295)[_0xa277('0x32')](function(){for(var _0xb7a8da=0x0;_0xb7a8da<_0x2b6295['length'];_0xb7a8da++){var _0x5b4d8b=[];db['Team'][_0xa277('0x8f')]({'where':{'id':_0x2b6295[_0xb7a8da]}})[_0xa277('0x32')](function(_0x6e0f57){_0x5b4d8b['push'](_0x6e0f57['getVoiceQueues']()['then'](function(_0x117c4e){for(var _0x13a207=0x0;_0x13a207<_0x117c4e[_0xa277('0x4e')];_0x13a207++){_0x117c4e[_0x13a207][_0xa277('0xfd')](_0xa277('0xab'),_0xa277('0xfe'));}return _0x117c4e;}));_0x5b4d8b[_0xa277('0xa4')](_0x6e0f57[_0xa277('0xff')]()['then'](function(_0x1474f9){for(var _0x391b46=0x0;_0x391b46<_0x1474f9[_0xa277('0x4e')];_0x391b46++){_0x1474f9[_0x391b46][_0xa277('0xfd')](_0xa277('0xab'),'Chat');}return _0x1474f9;}));_0x5b4d8b[_0xa277('0xa4')](_0x6e0f57['getMailQueues']()[_0xa277('0x32')](function(_0x5ab8cd){for(var _0x3f7484=0x0;_0x3f7484<_0x5ab8cd[_0xa277('0x4e')];_0x3f7484++){_0x5ab8cd[_0x3f7484][_0xa277('0xfd')](_0xa277('0xab'),_0xa277('0x101'));}return _0x5ab8cd;}));_0x5b4d8b[_0xa277('0xa4')](_0x6e0f57[_0xa277('0x102')]()[_0xa277('0x32')](function(_0x4744c4){for(var _0x1e543a=0x0;_0x1e543a<_0x4744c4[_0xa277('0x4e')];_0x1e543a++){_0x4744c4[_0x1e543a][_0xa277('0xfd')](_0xa277('0xab'),_0xa277('0x10b'));}return _0x4744c4;}));_0x5b4d8b[_0xa277('0xa4')](_0x6e0f57[_0xa277('0x10c')]()[_0xa277('0x32')](function(_0x3b212c){for(var _0x4e15fc=0x0;_0x4e15fc<_0x3b212c['length'];_0x4e15fc++){_0x3b212c[_0x4e15fc]['setDataValue']('channel',_0xa277('0x103'));}return _0x3b212c;}));_0x5b4d8b[_0xa277('0xa4')](_0x6e0f57[_0xa277('0x104')]()['then'](function(_0x411763){for(var _0x563343=0x0;_0x563343<_0x411763[_0xa277('0x4e')];_0x563343++){_0x411763[_0x563343]['setDataValue'](_0xa277('0xab'),_0xa277('0x105'));}return _0x411763;}));return BPromise[_0xa277('0xe9')](_0x5b4d8b);})['then'](function(_0x286867){var _0x6532cf=_[_0xa277('0x106')](_0x286867);_0x5b4d8b=[];return db[_0xa277('0x59')][_0xa277('0x10d')](function(_0x36f90d){for(var _0x28bbd0=0x0;_0x28bbd0<_0x6532cf[_0xa277('0x4e')];_0x28bbd0++){_0x5b4d8b[_0xa277('0xa4')](_0x6532cf[_0x28bbd0][_0xa277('0x10e')](_0x3c98d0['id']),{'transaction':_0x36f90d});}return BPromise[_0xa277('0xe9')](_0x5b4d8b)['then'](function(){if(_0x3c98d0['online']){return BPromise[_0xa277('0xa6')](_[_0xa277('0x38')](_0x6532cf,function(_0x553823){return _0x553823[_0xa277('0x108')](_0xa277('0xab'))==='Voice';}),function(_0x3d2cfa){return db[_0xa277('0xa7')][_0xa277('0x33')]({'where':{'VoiceQueueId':_0x3d2cfa['id'],'UserId':_0x3c98d0['id']},'transaction':_0x36f90d});});}else{return;}})[_0xa277('0x32')](function(){for(var _0x441529=0x0;_0x441529<_0x6532cf['length'];_0x441529++){var _0x220f91=_0x6532cf[_0x441529][_0xa277('0x108')](_0xa277('0xab'));var _0x3b8a68=_0x220f91+_0xa277('0x109');socket[_0xa277('0xa1')](_0xa277('0x88')+_0x220f91+_0xa277('0xac'),{'UserId':_0x3c98d0['id'],['queueField']:_0x6532cf[_0x441529]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x54d087,null))[_0xa277('0x28')](handleError(_0x54d087,null));};exports['getLists']=function(_0x4d0256,_0x5b6156,_0x58e4b6){var _0xf5ed00={};var _0x380e85={};var _0x501a08;var _0x11e7d4;return db[_0xa277('0x43')][_0xa277('0x8f')]({'where':{'id':_0x4d0256[_0xa277('0x65')]['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x5b6156,null))[_0xa277('0x32')](function(_0x53a477){if(_0x53a477){_0x501a08=_0x53a477;_0x380e85[_0xa277('0x45')]=_['keys'](db[_0xa277('0xb8')]['rawAttributes']);_0x380e85[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x4d0256[_0xa277('0x49')]);_0x380e85[_0xa277('0x54')]=_[_0xa277('0x4b')](_0x380e85[_0xa277('0x45')],_0x380e85['query']);_0xf5ed00['attributes']=_[_0xa277('0x4b')](_0x380e85[_0xa277('0x45')],qs[_0xa277('0x4d')](_0x4d0256[_0xa277('0x49')][_0xa277('0x4d')]));_0xf5ed00['attributes']=_0xf5ed00[_0xa277('0x4c')][_0xa277('0x4e')]?_0xf5ed00[_0xa277('0x4c')]:_0x380e85['model'];_0xf5ed00[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x4d0256['query'][_0xa277('0x52')]);_0xf5ed00['where']=qs[_0xa277('0x54')](_[_0xa277('0x55')](_0x4d0256['query'],_0x380e85[_0xa277('0x54')]));if(_0x4d0256[_0xa277('0x49')][_0xa277('0x38')]){_0xf5ed00['where']=_['merge'](_0xf5ed00[_0xa277('0x53')],{'$or':_['map'](_0xf5ed00[_0xa277('0x4c')],function(_0x19c2cd){var _0x450093={};_0x450093[_0x19c2cd]={'$like':'%'+_0x4d0256['query']['filter']+'%'};return _0x450093;})});}_0xf5ed00=_[_0xa277('0x62')]({},_0xf5ed00,_0x4d0256['options']);return _0x501a08[_0xa277('0x10f')](_0xf5ed00);}})['then'](function(_0xf42b22){if(_0xf42b22){_0x11e7d4=_0xf42b22[_0xa277('0x4e')];if(!_0x4d0256[_0xa277('0x49')][_0xa277('0x4f')](_0xa277('0xbd'))){_0xf5ed00['limit']=qs[_0xa277('0x50')](_0x4d0256[_0xa277('0x49')][_0xa277('0x50')]);_0xf5ed00[_0xa277('0x2c')]=qs[_0xa277('0x2c')](_0x4d0256[_0xa277('0x49')][_0xa277('0x2c')]);}return _0x501a08['getLists'](_0xf5ed00);}})[_0xa277('0x32')](function(_0x160d94){if(_0x160d94){return _0x160d94?{'count':_0x11e7d4,'rows':_0x160d94}:null;}})[_0xa277('0x32')](respondWithResult(_0x5b6156,null))[_0xa277('0x28')](handleError(_0x5b6156,null));};exports[_0xa277('0x110')]=function(_0x5a630c,_0x4d4a83,_0xa12705){var _0x33cedc={};var _0x1e87c5={};var _0x332946;var _0x5bef1d;return db[_0xa277('0x43')]['findOne']({'where':{'id':_0x5a630c['params']['id']}})[_0xa277('0x32')](handleEntityNotFound(_0x4d4a83,null))[_0xa277('0x32')](function(_0x93b0c2){if(_0x93b0c2){_0x332946=_0x93b0c2;_0x1e87c5[_0xa277('0x45')]=_[_0xa277('0x4a')](db['User'][_0xa277('0x44')]);_0x1e87c5[_0xa277('0x49')]=_[_0xa277('0x4a')](_0x5a630c[_0xa277('0x49')]);_0x1e87c5['filters']=_[_0xa277('0x4b')](_0x1e87c5[_0xa277('0x45')],_0x1e87c5[_0xa277('0x49')]);_0x33cedc[_0xa277('0x4c')]=_['intersection'](_0x1e87c5['model'],qs[_0xa277('0x4d')](_0x5a630c['query'][_0xa277('0x4d')]));_0x33cedc[_0xa277('0x4c')]=_0x33cedc['attributes'][_0xa277('0x4e')]?_0x33cedc[_0xa277('0x4c')]:_0x1e87c5['model'];_0x33cedc[_0xa277('0x51')]=qs[_0xa277('0x52')](_0x5a630c[_0xa277('0x49')][_0xa277('0x52')]);_0x33cedc['where']=qs['filters'](_[_0xa277('0x55')](_0x5a630c[_0xa277('0x49')],_0x1e87c5[_0xa277('0x54')]));if(_0x5a630c[_0xa277('0x49')][_0xa277('0x38')]){_0x33cedc['where']=_[_0xa277('0x62')](_0x33cedc[_0xa277('0x53')],{'$or':_[_0xa277('0x3a')](_0x33cedc['attributes'],function(_0x50e342){var _0x274cbf={};_0x274cbf[_0x50e342]={'$like':'%'+_0x5a630c[_0xa277('0x49')]['filter']+'%'};return _0x274cbf;})});}_0x33cedc[_0xa277('0x45')]=db[_0xa277('0x43')];_0x33cedc['as']=_0xa277('0x8b');_0x33cedc=_[_0xa277('0x62')]({},_0x33cedc,_0x5a630c[_0xa277('0x5b')]);return _0x332946[_0xa277('0xdb')]({'include':[_0x33cedc]});}})[_0xa277('0x32')](function(_0x4fdfc5){if(_0x4fdfc5){var _0x309049={},_0x3d8d3a=[],_0x42347e=0x0;for(var _0x5e9f35=0x0;_0x5e9f35<_0x4fdfc5[_0xa277('0x4e')];_0x5e9f35+=0x1){for(var _0x170556=0x0,_0x4563be;_0x170556<_0x4fdfc5[_0x5e9f35]['Agents'][_0xa277('0x4e')];_0x170556+=0x1){_0x4563be=_0x4fdfc5[_0x5e9f35][_0xa277('0x8b')][_0x170556][_0xa277('0x8a')]({'plain':!![]});_0x309049[_0x4563be['id']]=_0x4563be;}}_0x309049=_[_0xa277('0x111')](_0x309049);for(var _0x145860=qs[_0xa277('0x2c')](_0x5a630c[_0xa277('0x49')][_0xa277('0x2c')]);_0x145860<_0x309049[_0xa277('0x4e')]&&_0x3d8d3a[_0xa277('0x4e')]=_0x43eccb){_0x5aeefb=_0x43eccb;_0x1e6db2=0xc8;}else{_0x1e6db2=0xce;}_0x3a1f09[_0x2ab5('0x2e')](_0x1e6db2);return _0x3a1f09[_0x2ab5('0x33')](_0x2ab5('0x34'),_0x36ec0e+'-'+_0x5aeefb+'/'+_0x43eccb)['json'](_0x2f4f34);}return null;};}function patchUpdates(_0xe5ec6d){return function(_0x4b1414){try{jsonpatch['apply'](_0x4b1414,_0xe5ec6d,!![]);}catch(_0x3eb74b){return BPromise[_0x2ab5('0x35')](_0x3eb74b);}return _0x4b1414[_0x2ab5('0x36')]();};}function saveUpdates(_0x1ea803,_0x211608){return function(_0x34380a){if(_0x34380a){return _0x34380a['update'](_0x1ea803)[_0x2ab5('0x22')](function(_0xf39e0f){return _0xf39e0f;});}return null;};}function removeEntity(_0x25ca08,_0x3621a0){return function(_0x3d6b09){if(_0x3d6b09){return _0x3d6b09[_0x2ab5('0x37')]()['then'](function(){var _0x172245=_0x3d6b09['get']({'plain':!![]});var _0x3977db=[{'name':_0x2ab5('0x38'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':'Telephones','value':_0x2ab5('0x39'),'ignore':![]}];var _0x2630b9=_(_0x3977db)[_0x2ab5('0x3a')](_0x2ab5('0x3b'))[_0x2ab5('0x3c')](_0x2ab5('0x3d'))['value']();if(_[_0x2ab5('0x3e')](_0x2630b9,_0x172245[_0x2ab5('0x3f')])){return;}var _0xe51d9e=_['find'](_0x3977db,[_0x2ab5('0x3d'),_0x172245['role']])['name'];return db[_0x2ab5('0x40')]['destroy']({'where':{'type':_0xe51d9e,'resourceId':_0x172245['id']}})[_0x2ab5('0x22')](function(){return _0x3d6b09;});})[_0x2ab5('0x22')](function(){_0x25ca08[_0x2ab5('0x2e')](0xcc)[_0x2ab5('0x2f')]();});}};}function handleEntityNotFound(_0x317073,_0x1c560e){return function(_0x59d422){if(!_0x59d422){_0x317073[_0x2ab5('0x2d')](0x194);}return _0x59d422;};}function handleError(_0x1594bd,_0x20a095){_0x20a095=_0x20a095||0x1f4;return function(_0x2e8178){logger[_0x2ab5('0x28')](_0x2e8178[_0x2ab5('0x41')]);if(_0x2e8178[_0x2ab5('0x42')]){delete _0x2e8178[_0x2ab5('0x42')];}_0x1594bd[_0x2ab5('0x2e')](_0x20a095)[_0x2ab5('0x43')](_0x2e8178);};}exports[_0x2ab5('0x44')]=function(_0xf06b07,_0x3fdceb){var _0x46a467={},_0x1037cc={},_0x4aad2b={'count':0x0,'rows':[]};var _0x129c3a=db[_0x2ab5('0x45')]['rawAttributes'];_0x1037cc[_0x2ab5('0x46')]=_[_0x2ab5('0x47')](_[_0x2ab5('0x48')](_0x129c3a),['password',_0x2ab5('0x49')]);_0x1037cc['query']=_[_0x2ab5('0x48')](_0xf06b07['query']);_0x1037cc['filters']=_[_0x2ab5('0x4a')](_0x1037cc[_0x2ab5('0x46')],_0x1037cc[_0x2ab5('0x4b')]);_0x46a467[_0x2ab5('0x4c')]=_['intersection'](_0x1037cc[_0x2ab5('0x46')],qs[_0x2ab5('0x4d')](_0xf06b07[_0x2ab5('0x4b')][_0x2ab5('0x4d')]));_0x46a467[_0x2ab5('0x4c')]=_0x46a467[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x46a467[_0x2ab5('0x4c')]:_0x1037cc[_0x2ab5('0x46')];if(!_0xf06b07['query']['hasOwnProperty']('nolimit')){_0x46a467['limit']=qs[_0x2ab5('0x32')](_0xf06b07[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x46a467[_0x2ab5('0x31')]=qs[_0x2ab5('0x31')](_0xf06b07[_0x2ab5('0x4b')][_0x2ab5('0x31')]);}_0x46a467[_0x2ab5('0x4f')]=qs[_0x2ab5('0x50')](_0xf06b07[_0x2ab5('0x4b')]['sort']);_0x46a467['where']=qs['filters'](_[_0x2ab5('0x51')](_0xf06b07[_0x2ab5('0x4b')],_0x1037cc[_0x2ab5('0x52')]));if(_0xf06b07[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x46a467[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x46a467[_0x2ab5('0x53')],{'$or':_[_0x2ab5('0x3c')](_0x129c3a,function(_0x47b631){if(_0x47b631[_0x2ab5('0x55')][_0x2ab5('0x56')]!=='VIRTUAL'){return db[_0x2ab5('0x57')]['where'](db['sequelize']['fn'](_0x2ab5('0x58'),db[_0x2ab5('0x57')][_0x2ab5('0x59')](_0x47b631[_0x2ab5('0x5a')])),{'$like':db[_0x2ab5('0x57')]['fn']('lower','%'+_0xf06b07['query'][_0x2ab5('0x3a')]+'%')});}})});}_0x46a467=_[_0x2ab5('0x54')]({},_0x46a467,_0xf06b07[_0x2ab5('0x5b')]);var _0x23ab44={'where':_0x46a467[_0x2ab5('0x53')]};return db[_0x2ab5('0x45')][_0x2ab5('0x5c')](_0x23ab44)['then'](function(_0x7f6c83){_0x4aad2b[_0x2ab5('0x5c')]=_0x7f6c83;if(_0xf06b07[_0x2ab5('0x4b')][_0x2ab5('0x5d')]){_0x46a467[_0x2ab5('0x5e')]=[{'all':!![]}];}return db[_0x2ab5('0x45')]['findAll'](_0x46a467);})[_0x2ab5('0x22')](function(_0x2ec7fe){_0x4aad2b[_0x2ab5('0x5f')]=_0x2ec7fe;return _0x4aad2b;})[_0x2ab5('0x22')](respondWithFilteredResult(_0x3fdceb,_0x46a467))[_0x2ab5('0x2c')](handleError(_0x3fdceb,null));};exports['show']=function(_0x5c5f23,_0x43d814){var _0x26bd9e={'raw':![],'where':{'id':_0x5c5f23['params']['id']}},_0x3446fa={};_0x3446fa[_0x2ab5('0x46')]=_[_0x2ab5('0x47')](_[_0x2ab5('0x48')](db[_0x2ab5('0x45')]['rawAttributes']),['password',_0x2ab5('0x49')]);_0x3446fa[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x5c5f23[_0x2ab5('0x4b')]);_0x3446fa[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x3446fa['model'],_0x3446fa[_0x2ab5('0x4b')]);_0x26bd9e[_0x2ab5('0x4c')]=_['intersection'](_0x3446fa['model'],qs[_0x2ab5('0x4d')](_0x5c5f23[_0x2ab5('0x4b')]['fields']));_0x26bd9e[_0x2ab5('0x4c')]=_0x26bd9e[_0x2ab5('0x4c')]['length']?_0x26bd9e['attributes']:_0x3446fa[_0x2ab5('0x46')];if(_0x5c5f23[_0x2ab5('0x4b')][_0x2ab5('0x5d')]){_0x26bd9e[_0x2ab5('0x5e')]=[{'all':!![]}];}_0x26bd9e=_[_0x2ab5('0x54')]({},_0x26bd9e,_0x5c5f23['options']);return db[_0x2ab5('0x45')]['find'](_0x26bd9e)[_0x2ab5('0x22')](handleEntityNotFound(_0x43d814,null))[_0x2ab5('0x22')](respondWithResult(_0x43d814,null))[_0x2ab5('0x2c')](handleError(_0x43d814,null));};exports[_0x2ab5('0x60')]=function(_0x1c5615,_0x227d27){return db['User'][_0x2ab5('0x60')](_0x1c5615['body'],{'raw':![],'individualHooks':!![]})[_0x2ab5('0x22')](respondWithResult(_0x227d27,0xc9))[_0x2ab5('0x2c')](handleError(_0x227d27,null));};exports[_0x2ab5('0x61')]=function(_0x1bd6ee,_0x5542f4){if(_0x1bd6ee['body']['id']){delete _0x1bd6ee['body']['id'];}delete _0x1bd6ee[_0x2ab5('0x62')][_0x2ab5('0x3f')];return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x1bd6ee[_0x2ab5('0x64')]['id']}})['then'](handleEntityNotFound(_0x5542f4,null))['then'](saveUpdates(_0x1bd6ee['body'],null))[_0x2ab5('0x22')](respondWithResult(_0x5542f4,null))[_0x2ab5('0x2c')](handleError(_0x5542f4,null));};exports['describe']=function(_0x526525,_0x106628){return db[_0x2ab5('0x45')][_0x2ab5('0x65')]()['then'](respondWithResult(_0x106628,null))[_0x2ab5('0x2c')](handleError(_0x106628,null));};exports['addContacts']=function(_0x443ba3,_0x5b16fa,_0x497a0d){return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x443ba3['params']['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x5b16fa,null))[_0x2ab5('0x22')](function(_0x47fa8a){if(_0x47fa8a){return _0x47fa8a[_0x2ab5('0x66')](_0x443ba3[_0x2ab5('0x62')]['ids'],_['omit'](_0x443ba3[_0x2ab5('0x62')],[_0x2ab5('0x67'),'id'])||{});}})[_0x2ab5('0x22')](respondWithResult(_0x5b16fa,null))[_0x2ab5('0x2c')](handleError(_0x5b16fa,null));};var getLicense=function(_0x432320){return new BPromise(function(_0xdd9b6f,_0x1f6f5a){var _0x43e936=0x0;_0x432320[_0x2ab5('0x62')][_0x2ab5('0x3f')]===_0x2ab5('0x68')&&_0xdd9b6f(_0x2ab5('0x69'));return db[_0x2ab5('0x45')][_0x2ab5('0x5c')]({'where':{'$or':[{'role':_0x432320[_0x2ab5('0x62')][_0x2ab5('0x3f')]==='telephone'?'telephone':[_0x2ab5('0x6a'),_0x2ab5('0x6b')]}]}})['then'](function(_0xa0d691){_0x43e936=_0xa0d691;return require(_0x2ab5('0x6c'))[_0x2ab5('0x6d')]();})[_0x2ab5('0x22')](function(_0x5c2dc0){var _0x57e68a=_0x432320[_0x2ab5('0x62')]['role']==='telephone'?_0x2ab5('0x6e'):_0x2ab5('0x6f');if(!_[_0x2ab5('0x70')](_0x5c2dc0[_0x57e68a])&&_0x43e936>=_0x5c2dc0[_0x57e68a]){return _0x1f6f5a({'message':_0x2ab5('0x71')});}return _0xdd9b6f(util['format'](_0x2ab5('0x72'),_0x57e68a,_0x43e936));})[_0x2ab5('0x2c')](function(_0x5e856d){return _0x1f6f5a(_0x5e856d);});});};exports['create']=function(_0x29a819,_0x9647cf){return getLicense(_0x29a819)[_0x2ab5('0x22')](function(_0x54926b){if(!_0x29a819[_0x2ab5('0x62')]['internal']){var _0x527775;return db['Setting']['findById'](0x1)[_0x2ab5('0x22')](function(_0x37d9b0){return checkPasswordPattern(_0x37d9b0,_0x29a819[_0x2ab5('0x62')]['password'],_0x37d9b0[_0x2ab5('0x73')]);})[_0x2ab5('0x22')](function(_0x106f79){_0x527775=_0x106f79[_0x2ab5('0x74')];return db[_0x2ab5('0x45')]['max'](_0x2ab5('0x75'));})['then'](function(_0x34f9c3){if(_['isNil'](_0x34f9c3)){if(_0x527775){_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x75')]=_0x527775;}else{_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x75')]=0x1;}}else{if(_[_0x2ab5('0x70')](_0x527775)||_0x527775==_0x34f9c3){_0x29a819['body']['internal']=_0x34f9c3+0x1;}else if(_0x527775>_0x34f9c3){_0x29a819[_0x2ab5('0x62')]['internal']=_0x527775;}else{return db[_0x2ab5('0x57')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x2ab5('0x57')]['QueryTypes'][_0x2ab5('0x76')]})['then'](function(_0x13fb13){if(_0x13fb13&&_0x13fb13[_0x2ab5('0x4e')]){for(var _0x33ba30=0x0,_0x9cd36d=_0x13fb13['length'];_0x33ba30<_0x9cd36d&&_['isNil'](_0x29a819['body']['internal']);_0x33ba30++){if(_0x527775<=_0x13fb13[_0x33ba30]['from']){_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x75')]=_0x13fb13[_0x33ba30][_0x2ab5('0x77')];}else if(_0x527775>_0x13fb13[_0x33ba30][_0x2ab5('0x77')]&&_0x527775<=_0x13fb13[_0x33ba30]['to']){_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x75')]=_0x527775;}}}if(_[_0x2ab5('0x70')](_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x75')])){_0x29a819[_0x2ab5('0x62')]['internal']=_0x34f9c3+0x1;}});}}});}})[_0x2ab5('0x22')](function(){if(_0x29a819['body'][_0x2ab5('0x78')]){_0x29a819['body'][_0x2ab5('0x79')]=_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x75')];_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x7a')]={'mailbox':_0x29a819['body'][_0x2ab5('0x75')],'password':_0x29a819[_0x2ab5('0x62')]['password'],'fullname':_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x7b')],'email':_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x7c')]};}if(_0x29a819[_0x2ab5('0x62')]&&_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x3f')]===_0x2ab5('0x68')){_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x7d')]=[_0x2ab5('0x7e'),_0x2ab5('0x7f'),_0x2ab5('0x80'),_0x2ab5('0x81'),'104',_0x2ab5('0x82'),'106',_0x2ab5('0x83'),_0x2ab5('0x84'),_0x2ab5('0x85'),_0x2ab5('0x86'),_0x2ab5('0x87')];}return db[_0x2ab5('0x45')][_0x2ab5('0x88')](_0x29a819[_0x2ab5('0x62')],{'include':[{'model':db[_0x2ab5('0x7a')],'as':'VoiceMail'}]});})[_0x2ab5('0x22')](function(_0x10cac0){if(_0x29a819[_0x2ab5('0x62')][_0x2ab5('0x3f')]==='user')return _0x10cac0;var _0x884082=_0x29a819[_0x2ab5('0x6b')][_0x2ab5('0x89')]({'plain':!![]});if(!_0x884082)throw new Error(_0x2ab5('0x8a'));if(_0x884082['role']==='user'){var _0x11323e=_0x10cac0[_0x2ab5('0x89')]({'plain':!![]});var _0x54f36b=[{'name':'Agents','value':_0x2ab5('0x68')},{'name':_0x2ab5('0x8b'),'value':_0x2ab5('0x39')}];var _0x34bbf5=_[_0x2ab5('0x63')](_0x54f36b,[_0x2ab5('0x3d'),_0x11323e[_0x2ab5('0x3f')]])[_0x2ab5('0x42')];return db['UserProfileSection'][_0x2ab5('0x63')]({'where':{'name':_0x34bbf5,'userProfileId':_0x884082[_0x2ab5('0x8c')]},'raw':!![]})[_0x2ab5('0x22')](function(_0x4f5a63){if(_0x4f5a63&&_0x4f5a63[_0x2ab5('0x8d')]===0x0){return db[_0x2ab5('0x40')][_0x2ab5('0x88')]({'name':_0x11323e[_0x2ab5('0x42')],'resourceId':_0x11323e['id'],'type':_0x4f5a63[_0x2ab5('0x42')],'sectionId':_0x4f5a63['id']},{})[_0x2ab5('0x22')](function(){return _0x10cac0;});}else{return _0x10cac0;}})[_0x2ab5('0x2c')](function(_0x30ea18){logger[_0x2ab5('0x28')](_0x2ab5('0x8e'),_0x30ea18);throw _0x30ea18;});}return _0x10cac0;})[_0x2ab5('0x22')](respondWithResult(_0x9647cf,0xc9))[_0x2ab5('0x2c')](handleError(_0x9647cf,null));};exports[_0x2ab5('0x8f')]=function(_0x9c9b53,_0x3e135f,_0x324c11){var _0x1aedd3=![];if(_0x9c9b53[_0x2ab5('0x62')]['id']){delete _0x9c9b53[_0x2ab5('0x62')]['id'];}return db[_0x2ab5('0x90')][_0x2ab5('0x91')]({'attributes':['id',_0x2ab5('0x73')]})[_0x2ab5('0x22')](function(_0x4639e8){_0x1aedd3=_0x4639e8['securePassword'];return db[_0x2ab5('0x45')]['find']({'where':{'id':_0x9c9b53['params']['id']}});})[_0x2ab5('0x22')](function(_0x1dc8a4){if(_0x1dc8a4){if(_0x1dc8a4['id']==_0x9c9b53[_0x2ab5('0x6b')]['id']){if(!_0x9c9b53[_0x2ab5('0x62')][_0x2ab5('0x92')]||!_0x9c9b53[_0x2ab5('0x62')][_0x2ab5('0x93')]){throw new db[(_0x2ab5('0x1e'))][(_0x2ab5('0x1f'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x1dc8a4[_0x2ab5('0x94')](_0x9c9b53[_0x2ab5('0x62')]['oldPassword'])){throw new db[(_0x2ab5('0x1e'))][(_0x2ab5('0x1f'))]('Wrong\x20credentials');}if(_0x9c9b53[_0x2ab5('0x62')][_0x2ab5('0x92')]==_0x9c9b53[_0x2ab5('0x62')][_0x2ab5('0x93')]){throw new db[(_0x2ab5('0x1e'))][(_0x2ab5('0x1f'))](_0x2ab5('0x95'));}return _0x1dc8a4;}else if(_0x9c9b53[_0x2ab5('0x6b')][_0x2ab5('0x3f')]==_0x2ab5('0x6a')){if(!_0x9c9b53['body']['newPassword']){throw new db[(_0x2ab5('0x1e'))]['ValidationError'](_0x2ab5('0x96'));}return _0x1dc8a4;}else if(_0x9c9b53[_0x2ab5('0x6b')]['role']==_0x2ab5('0x6b')){if(!_0x9c9b53['body'][_0x2ab5('0x93')]){throw new db[(_0x2ab5('0x1e'))][(_0x2ab5('0x1f'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1dc8a4['role']!='agent'){throw new db[(_0x2ab5('0x1e'))][(_0x2ab5('0x1f'))]('Unauthorized');}return _0x1dc8a4;}else{throw new db['Sequelize']['ValidationError'](_0x2ab5('0x97'));}}return null;})[_0x2ab5('0x22')](handleEntityNotFound(_0x3e135f,null))['then'](function(_0x4498de){return checkPasswordPattern(_0x4498de,_0x9c9b53[_0x2ab5('0x62')]['newPassword'],_0x1aedd3);})[_0x2ab5('0x22')](saveUpdates({'password':_0x9c9b53[_0x2ab5('0x62')][_0x2ab5('0x93')],'passwordResetAt':_0x9c9b53[_0x2ab5('0x6b')]['id']==_0x9c9b53['params']['id']?moment():null},null))[_0x2ab5('0x22')](respondWithResult(_0x3e135f,null))['catch'](handleError(_0x3e135f,null));};exports[_0x2ab5('0x98')]=function(_0x4c08b5,_0x5ad3d7,_0x3b3aea){var _0xeb70dd=_0x4c08b5['body'][_0x2ab5('0x99')];return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x4c08b5[_0x2ab5('0x64')]['id']},'attributes':['id','name',_0x2ab5('0x3f'),_0x2ab5('0x9a'),_0x2ab5('0x9b'),'voicePause','interface']})[_0x2ab5('0x22')](handleEntityNotFound(_0x5ad3d7,null))['then'](function(_0x5000eb){if(_0x5000eb){if(!utils[_0x2ab5('0x9c')](_0xeb70dd)){throw new db[(_0x2ab5('0x1e'))]['ValidationError'](_0x2ab5('0x9d'));}return _0x5000eb[_0x2ab5('0x9e')+_['capitalize'](_0xeb70dd[_0x2ab5('0x9f')]())+_0x2ab5('0xa0')](_0x4c08b5[_0x2ab5('0x62')][_0x2ab5('0x67')],{'penalty':_0x4c08b5[_0x2ab5('0x62')][_0x2ab5('0xa1')]||0x0})[_0x2ab5('0xa2')](function(_0x65cad9){for(var _0x4eb5fb=0x0;_0x4eb5fb<_0x4c08b5[_0x2ab5('0x62')][_0x2ab5('0x67')]['length'];_0x4eb5fb+=0x1){var _0x6781f3={'UserId':_0x4c08b5[_0x2ab5('0x64')]['id']};_0x6781f3[_[_0x2ab5('0xa3')](_0xeb70dd['toLowerCase']())+'QueueId']=_0x4c08b5['body'][_0x2ab5('0x67')][_0x4eb5fb];socket[_0x2ab5('0xa4')](_0x2ab5('0x6b')+_[_0x2ab5('0xa3')](_0xeb70dd[_0x2ab5('0x9f')]())+_0x2ab5('0xa5'),_0x6781f3);}return _0x65cad9;})[_0x2ab5('0x22')](function(){if(_0xeb70dd===_0x2ab5('0xa6')){return db[_0x2ab5('0xa7')]['findAll']({'where':{'id':_0x4c08b5[_0x2ab5('0x62')]['ids']||[]},'raw':!![],'attributes':['id',_0x2ab5('0x42')]});}})[_0x2ab5('0x22')](function(_0x551d8b){var _0x31a61c=_0x5000eb[_0x2ab5('0x89')]({'plain':!![]});var _0x4386c3=[];if(_0xeb70dd===_0x2ab5('0xa6')&&_0x31a61c[_0x2ab5('0x3f')]===_0x2ab5('0x68')&&_0x31a61c[_0x2ab5('0x9a')]){for(var _0x4191ea=0x0;_0x4191ea<_0x551d8b[_0x2ab5('0x4e')];_0x4191ea+=0x1){_0x4386c3[_0x2ab5('0xa8')]({'membername':_0x31a61c[_0x2ab5('0x42')],'UserId':_0x31a61c['id'],'queue_name':_0x551d8b[_0x4191ea]['name'],'VoiceQueueId':_0x551d8b[_0x4191ea]['id'],'interface':_[_0x2ab5('0x70')](_0x31a61c[_0x2ab5('0xa9')])?util[_0x2ab5('0xaa')](_0x2ab5('0xab'),_0x31a61c[_0x2ab5('0x42')]):_0x31a61c[_0x2ab5('0xa9')],'paused':_0x31a61c[_0x2ab5('0xac')]||![],'penalty':_0x4c08b5['body'][_0x2ab5('0xa1')]||0x0});}return BPromise[_0x2ab5('0xad')](_0x4386c3,function(_0x22bcb1){return db[_0x2ab5('0xae')][_0x2ab5('0xaf')](_0x22bcb1);});}return _0x5000eb;});}})[_0x2ab5('0x22')](respondWithStatusCode(_0x5ad3d7,null))[_0x2ab5('0x2c')](handleError(_0x5ad3d7,null));};exports['removeQueues']=function(_0x368d14,_0x30c39c,_0xa8e79d){var _0x14f6f8;return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x368d14[_0x2ab5('0x64')]['id']},'attributes':['id',_0x2ab5('0x42'),'role']})[_0x2ab5('0x22')](handleEntityNotFound(_0x30c39c,null))['then'](function(_0x36d910){if(_0x36d910){_0x14f6f8=_0x36d910;if(!_0x368d14[_0x2ab5('0x4b')][_0x2ab5('0x99')]||!utils[_0x2ab5('0x9c')](_0x368d14[_0x2ab5('0x4b')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x36d910['remove'+_[_0x2ab5('0xa3')](_0x368d14['query'][_0x2ab5('0x99')][_0x2ab5('0x9f')]())+'Queues'](_0x368d14[_0x2ab5('0x4b')][_0x2ab5('0x67')]);}})[_0x2ab5('0x22')](function(_0x27a2f0){for(var _0x3f85e5=0x0;_0x3f85e5<_0x368d14[_0x2ab5('0x4b')][_0x2ab5('0x67')]['length'];_0x3f85e5+=0x1){var _0x121365={'UserId':_0x368d14[_0x2ab5('0x64')]['id']};_0x121365[_[_0x2ab5('0xa3')](_0x368d14[_0x2ab5('0x4b')][_0x2ab5('0x99')]['toLowerCase']())+_0x2ab5('0xb0')]=_0x368d14[_0x2ab5('0x4b')][_0x2ab5('0x67')][_0x3f85e5];socket[_0x2ab5('0xa4')](_0x2ab5('0x6b')+_[_0x2ab5('0xa3')](_0x368d14[_0x2ab5('0x4b')][_0x2ab5('0x99')][_0x2ab5('0x9f')]())+_0x2ab5('0xb1'),_0x121365);}return _0x27a2f0;})[_0x2ab5('0x22')](function(){if(_0x368d14[_0x2ab5('0x4b')][_0x2ab5('0x99')]===_0x2ab5('0xa6')){return db[_0x2ab5('0xae')][_0x2ab5('0x37')]({'where':{'UserId':_0x368d14[_0x2ab5('0x64')]['id'],'VoiceQueueId':_0x368d14[_0x2ab5('0x4b')]['ids']},'individualHooks':!![]})[_0x2ab5('0x22')](function(){return _0x14f6f8;});}return _0x14f6f8;})[_0x2ab5('0x22')](respondWithStatusCode(_0x30c39c,null))[_0x2ab5('0x2c')](handleError(_0x30c39c,null));};exports[_0x2ab5('0xb2')]=function(_0x11d552,_0x5bcd18,_0x4f341e){_0x11d552['body'][_0x2ab5('0xb3')]=_0x11d552[_0x2ab5('0xb4')][_0x2ab5('0xb5')];return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x11d552[_0x2ab5('0x64')]['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x5bcd18,null))[_0x2ab5('0x22')](saveUpdates(_0x11d552['body'],null))['then'](respondWithResult(_0x5bcd18,null))[_0x2ab5('0x2c')](handleError(_0x5bcd18,null));};exports[_0x2ab5('0xb6')]=function(_0x269a8c,_0x217831,_0x521995){var _0x312bc7=path[_0x2ab5('0xb7')](config[_0x2ab5('0xb8')],_0x2ab5('0xb9'));return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x269a8c[_0x2ab5('0x64')]['id']},'attributes':['id',_0x2ab5('0xb3')],'raw':!![]})['then'](handleEntityNotFound(_0x217831,null))['then'](function(_0x14e2cc){if(_0x14e2cc){if(_['isNil'](_0x14e2cc[_0x2ab5('0xb3')])){return _0x217831['download'](_0x312bc7);}else{if(!fs[_0x2ab5('0xba')](path['join'](config[_0x2ab5('0xb8')],_0x2ab5('0xbb'),_0x14e2cc[_0x2ab5('0xb3')]))){return _0x217831['download'](_0x312bc7);}return _0x217831[_0x2ab5('0xbc')](path[_0x2ab5('0xb7')](config[_0x2ab5('0xb8')],_0x2ab5('0xbb'),_0x14e2cc['userpic']));}}})[_0x2ab5('0x2c')](handleError(_0x217831,null));};exports[_0x2ab5('0xbd')]=function(_0x3184d3,_0x227080,_0x5df206){var _0x584e84={};var _0x1b276b={};var _0x2a4e81;var _0x24fa8f;return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x3184d3[_0x2ab5('0x64')]['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x227080,null))[_0x2ab5('0x22')](function(_0x2148da){if(_0x2148da){_0x2a4e81=_0x2148da;_0x1b276b['model']=_[_0x2ab5('0x48')](db[_0x2ab5('0xbe')][_0x2ab5('0xbf')]);_0x1b276b[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x3184d3[_0x2ab5('0x4b')]);_0x1b276b['filters']=_[_0x2ab5('0x4a')](_0x1b276b[_0x2ab5('0x46')],_0x1b276b['query']);_0x584e84[_0x2ab5('0x4c')]=_['intersection'](_0x1b276b['model'],qs[_0x2ab5('0x4d')](_0x3184d3[_0x2ab5('0x4b')][_0x2ab5('0x4d')]));_0x584e84[_0x2ab5('0x4c')]=_0x584e84[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x584e84[_0x2ab5('0x4c')]:_0x1b276b[_0x2ab5('0x46')];_0x584e84[_0x2ab5('0x4f')]=qs[_0x2ab5('0x50')](_0x3184d3[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x584e84[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x3184d3[_0x2ab5('0x4b')],_0x1b276b['filters']));if(_0x3184d3['query'][_0x2ab5('0x3a')]){_0x584e84[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x584e84[_0x2ab5('0x53')],{'$or':_[_0x2ab5('0x3c')](_0x584e84['attributes'],function(_0xf786d5){var _0x3f028a={};_0x3f028a[_0xf786d5]={'$like':'%'+_0x3184d3[_0x2ab5('0x4b')]['filter']+'%'};return _0x3f028a;})});}_0x584e84=_[_0x2ab5('0x54')]({},_0x584e84,_0x3184d3[_0x2ab5('0x5b')]);return _0x2a4e81[_0x2ab5('0xbd')](_0x584e84);}})[_0x2ab5('0x22')](function(_0xaab9d5){if(_0xaab9d5){_0x24fa8f=_0xaab9d5['length'];if(_0x3184d3[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0x5d'))){_0x584e84[_0x2ab5('0x5e')]=[{'model':db[_0x2ab5('0xc1')],'as':_0x2ab5('0xc2'),'required':![]},{'model':db[_0x2ab5('0xc3')],'as':_0x2ab5('0xc4'),'attributes':['id',_0x2ab5('0x42'),_0x2ab5('0xc5')],'where':_0x3184d3['query'][_0x2ab5('0xc6')]?{'id':_0x3184d3[_0x2ab5('0x4b')]['tag']}:undefined,'required':_0x3184d3[_0x2ab5('0x4b')][_0x2ab5('0xc6')]?!![]:![]}];}if(!_0x3184d3[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x584e84[_0x2ab5('0x32')]=qs['limit'](_0x3184d3[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x584e84[_0x2ab5('0x31')]=qs[_0x2ab5('0x31')](_0x3184d3[_0x2ab5('0x4b')][_0x2ab5('0x31')]);}return _0x2a4e81['getContacts'](_0x584e84);}})['then'](function(_0x113210){if(_0x113210){return _0x113210?{'count':_0x24fa8f,'rows':_0x113210}:null;}})['then'](respondWithResult(_0x227080,null))['catch'](handleError(_0x227080,null));};exports[_0x2ab5('0xc8')]=function(_0x2c76f6,_0x55ae0f,_0x2c677d){var _0x1b83db;var _0x45d348;var _0x271946={};var _0x54561a;return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x2c76f6[_0x2ab5('0x64')]['id']},'attributes':['id','name','role']})[_0x2ab5('0x22')](handleEntityNotFound(_0x55ae0f,null))[_0x2ab5('0x22')](function(_0x7e9b6e){if(!utils[_0x2ab5('0x9c')](_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0x99')])){throw new db['Sequelize']['ValidationError'](_0x2ab5('0x9d'));}_0x1b83db=_0x7e9b6e;var _0x1c9993={};_0x1c9993['model']=_[_0x2ab5('0x48')](db[_[_0x2ab5('0xa3')](_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0x99')])+_0x2ab5('0xc9')]['rawAttributes']);_0x1c9993[_0x2ab5('0x4b')]=_['keys'](_0x2c76f6[_0x2ab5('0x4b')]);_0x1c9993['filters']=_[_0x2ab5('0x4a')](_0x1c9993[_0x2ab5('0x46')],_0x1c9993[_0x2ab5('0x4b')]);_0x271946[_0x2ab5('0x4c')]=_[_0x2ab5('0x4a')](_0x1c9993[_0x2ab5('0x46')],qs[_0x2ab5('0x4d')](_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0x4d')]));_0x271946[_0x2ab5('0x4c')]=_0x271946[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x271946[_0x2ab5('0x4c')]:_0x1c9993[_0x2ab5('0x46')];_0x271946[_0x2ab5('0x4f')]=qs['sort'](_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x271946[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x2c76f6[_0x2ab5('0x4b')],_0x1c9993['filters']));if(_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x271946[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x271946[_0x2ab5('0x53')],{'$or':_[_0x2ab5('0x3c')](_0x271946[_0x2ab5('0x4c')],function(_0x41e1c2){var _0x44cccc={};_0x44cccc[_0x41e1c2]={'$like':'%'+_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x44cccc;})});}_0x271946=_[_0x2ab5('0x54')]({},_0x271946,_0x2c76f6[_0x2ab5('0x5b')]);switch(_0x1b83db[_0x2ab5('0x3f')]){case _0x2ab5('0x6a'):return db[_[_0x2ab5('0xa3')](_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0x99')])+_0x2ab5('0xc9')][_0x2ab5('0xca')](_0x271946);case _0x2ab5('0x6b'):case _0x2ab5('0x68'):return _0x1b83db[_0x2ab5('0x89')+_['capitalize'](_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0x99')])+'Queues'](_0x271946);default:throw new db[(_0x2ab5('0x1e'))][(_0x2ab5('0x1f'))](_0x2ab5('0xcb'));}})[_0x2ab5('0x22')](function(_0x3055d0){_0x54561a=_0x3055d0[_0x2ab5('0x4e')];if(!_0x2c76f6[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x271946[_0x2ab5('0x32')]=qs[_0x2ab5('0x32')](_0x2c76f6[_0x2ab5('0x4b')]['limit']);_0x271946['offset']=qs['offset'](_0x2c76f6['query'][_0x2ab5('0x31')]);}switch(_0x1b83db['role']){case _0x2ab5('0x6a'):return db[_[_0x2ab5('0xa3')](_0x2c76f6[_0x2ab5('0x4b')]['channel'])+_0x2ab5('0xc9')][_0x2ab5('0xca')](_0x271946);case _0x2ab5('0x6b'):case _0x2ab5('0x68'):return _0x1b83db['get'+_[_0x2ab5('0xa3')](_0x2c76f6['query']['channel'])+'Queues'](_0x271946);}})[_0x2ab5('0x22')](function(_0x5f0c3f){return{'count':_0x54561a,'rows':_0x5f0c3f};})[_0x2ab5('0x22')](respondWithResult(_0x55ae0f,null))[_0x2ab5('0x2c')](handleError(_0x55ae0f,null));};exports[_0x2ab5('0xcc')]=function(_0x38a374,_0x16f763,_0x2fac9c){var _0x5f8305={};var _0x472a7a={};var _0x5a42c6;var _0x24d2f9;return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x38a374['params']['id']}})['then'](handleEntityNotFound(_0x16f763,null))[_0x2ab5('0x22')](function(_0x820216){if(_0x820216){_0x5a42c6=_0x820216;_0x472a7a['model']=_['keys'](db[_0x2ab5('0xae')][_0x2ab5('0xbf')]);_0x472a7a['query']=_[_0x2ab5('0x48')](_0x38a374[_0x2ab5('0x4b')]);_0x472a7a['filters']=_['intersection'](_0x472a7a[_0x2ab5('0x46')],_0x472a7a[_0x2ab5('0x4b')]);_0x5f8305['attributes']=_[_0x2ab5('0x4a')](_0x472a7a[_0x2ab5('0x46')],qs[_0x2ab5('0x4d')](_0x38a374[_0x2ab5('0x4b')][_0x2ab5('0x4d')]));_0x5f8305[_0x2ab5('0x4c')]=_0x5f8305[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x5f8305[_0x2ab5('0x4c')]:_0x472a7a[_0x2ab5('0x46')];_0x5f8305['order']=qs[_0x2ab5('0x50')](_0x38a374['query'][_0x2ab5('0x50')]);_0x5f8305[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x38a374[_0x2ab5('0x4b')],_0x472a7a['filters']));if(_0x38a374[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x5f8305[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x5f8305['where'],{'$or':_[_0x2ab5('0x3c')](_0x5f8305[_0x2ab5('0x4c')],function(_0x27a5f2){var _0x4f4954={};_0x4f4954[_0x27a5f2]={'$like':'%'+_0x38a374[_0x2ab5('0x4b')]['filter']+'%'};return _0x4f4954;})});}_0x5f8305=_[_0x2ab5('0x54')]({},_0x5f8305,_0x38a374[_0x2ab5('0x5b')]);return _0x5a42c6[_0x2ab5('0xcc')](_0x5f8305);}})[_0x2ab5('0x22')](function(_0x2bab0b){if(_0x2bab0b){_0x24d2f9=_0x2bab0b[_0x2ab5('0x4e')];if(!_0x38a374[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x5f8305[_0x2ab5('0x32')]=qs[_0x2ab5('0x32')](_0x38a374['query']['limit']);_0x5f8305['offset']=qs[_0x2ab5('0x31')](_0x38a374[_0x2ab5('0x4b')][_0x2ab5('0x31')]);}return _0x5a42c6['getVoiceQueuesRt'](_0x5f8305);}})['then'](function(_0x1e73ee){if(_0x1e73ee){return _0x1e73ee?{'count':_0x24d2f9,'rows':_0x1e73ee}:null;}})[_0x2ab5('0x22')](respondWithResult(_0x16f763,null))[_0x2ab5('0x2c')](handleError(_0x16f763,null));};exports['getGroups']=function(_0x5ee478,_0x818b0,_0x237f1c){var _0x52d91e={};var _0x48c410={};var _0x41ebbf;var _0x4a9dd2;return db['User'][_0x2ab5('0x91')]({'where':{'id':_0x5ee478['params']['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x818b0,null))[_0x2ab5('0x22')](function(_0x25b97a){if(_0x25b97a){_0x41ebbf=_0x25b97a;_0x48c410[_0x2ab5('0x46')]=_[_0x2ab5('0x48')](db[_0x2ab5('0xcd')][_0x2ab5('0xbf')]);_0x48c410[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x5ee478[_0x2ab5('0x4b')]);_0x48c410[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x48c410[_0x2ab5('0x46')],_0x48c410['query']);_0x52d91e[_0x2ab5('0x4c')]=_['intersection'](_0x48c410[_0x2ab5('0x46')],qs['fields'](_0x5ee478[_0x2ab5('0x4b')]['fields']));_0x52d91e['attributes']=_0x52d91e[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x52d91e[_0x2ab5('0x4c')]:_0x48c410['model'];_0x52d91e[_0x2ab5('0x4f')]=qs['sort'](_0x5ee478['query'][_0x2ab5('0x50')]);_0x52d91e[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x5ee478[_0x2ab5('0x4b')],_0x48c410['filters']));if(_0x5ee478[_0x2ab5('0x4b')]['filter']){_0x52d91e[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x52d91e[_0x2ab5('0x53')],{'$or':_[_0x2ab5('0x3c')](_0x52d91e[_0x2ab5('0x4c')],function(_0x596b1a){var _0x8bafd={};_0x8bafd[_0x596b1a]={'$like':'%'+_0x5ee478[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x8bafd;})});}_0x52d91e=_[_0x2ab5('0x54')]({},_0x52d91e,_0x5ee478['options']);return _0x41ebbf[_0x2ab5('0xce')](_0x52d91e);}})[_0x2ab5('0x22')](function(_0xde00f2){if(_0xde00f2){_0x4a9dd2=_0xde00f2[_0x2ab5('0x4e')];if(!_0x5ee478[_0x2ab5('0x4b')][_0x2ab5('0xc0')]('nolimit')){_0x52d91e[_0x2ab5('0x32')]=qs[_0x2ab5('0x32')](_0x5ee478[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x52d91e[_0x2ab5('0x31')]=qs[_0x2ab5('0x31')](_0x5ee478[_0x2ab5('0x4b')][_0x2ab5('0x31')]);}return _0x41ebbf[_0x2ab5('0xce')](_0x52d91e);}})['then'](function(_0x5ed162){if(_0x5ed162){return _0x5ed162?{'count':_0x4a9dd2,'rows':_0x5ed162}:null;}})[_0x2ab5('0x22')](respondWithResult(_0x818b0,null))[_0x2ab5('0x2c')](handleError(_0x818b0,null));};exports[_0x2ab5('0xcf')]=function(_0x4037fd,_0x4a1e46,_0x54b167){var _0x312e9c={'raw':!![],'where':{}};var _0x1bd440={};var _0xb2d7b0={'count':0x0,'rows':[]};return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x4037fd['params']['id']}})['then'](handleEntityNotFound(_0x4a1e46,null))['then'](function(_0x29ba3e){if(_0x29ba3e){_0x1bd440[_0x2ab5('0x46')]=_['keys'](db[_0x2ab5('0xd0')][_0x2ab5('0xbf')]);_0x1bd440[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x4037fd[_0x2ab5('0x4b')]);_0x1bd440[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x1bd440[_0x2ab5('0x46')],_0x1bd440['query']);_0x312e9c['attributes']=_[_0x2ab5('0x4a')](_0x1bd440[_0x2ab5('0x46')],qs[_0x2ab5('0x4d')](_0x4037fd[_0x2ab5('0x4b')]['fields']));_0x312e9c[_0x2ab5('0x4c')]=_0x312e9c[_0x2ab5('0x4c')]['length']?_0x312e9c['attributes']:_0x1bd440[_0x2ab5('0x46')];if(!_0x4037fd[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x312e9c[_0x2ab5('0x32')]=qs[_0x2ab5('0x32')](_0x4037fd[_0x2ab5('0x4b')]['limit']);_0x312e9c[_0x2ab5('0x31')]=qs['offset'](_0x4037fd[_0x2ab5('0x4b')][_0x2ab5('0x31')]);}_0x312e9c[_0x2ab5('0x4f')]=qs[_0x2ab5('0x50')](_0x4037fd[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x312e9c['where']=qs[_0x2ab5('0x52')](_['pick'](_0x4037fd[_0x2ab5('0x4b')],_0x1bd440[_0x2ab5('0x52')]));_0x312e9c[_0x2ab5('0x53')][_0x2ab5('0xd1')]=_0x29ba3e['id'];if(_0x4037fd[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x312e9c[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x312e9c[_0x2ab5('0x53')],{'$or':_['map'](_0x312e9c[_0x2ab5('0x4c')],function(_0x25980f){var _0x50c642={};_0x50c642[_0x25980f]={'$like':'%'+_0x4037fd[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x50c642;})});}_0x312e9c=_[_0x2ab5('0x54')]({},_0x312e9c,_0x4037fd[_0x2ab5('0x5b')]);return db[_0x2ab5('0xd0')][_0x2ab5('0x5c')]({'where':_0x312e9c[_0x2ab5('0x53')]})[_0x2ab5('0x22')](function(_0x3e4f87){_0xb2d7b0[_0x2ab5('0x5c')]=_0x3e4f87;if(_0x4037fd[_0x2ab5('0x4b')]['includeAll']){_0x312e9c[_0x2ab5('0x5e')]=[{'all':!![]}];}return db[_0x2ab5('0xd0')][_0x2ab5('0xca')](_0x312e9c);})[_0x2ab5('0x22')](function(_0x18fca5){_0xb2d7b0['rows']=_0x18fca5;return _0xb2d7b0;});}})[_0x2ab5('0x22')](respondWithFilteredResult(_0x4a1e46,_0x312e9c))['catch'](handleError(_0x4a1e46,null));};exports[_0x2ab5('0xd2')]=function(_0x2c6b9,_0x42dcc2,_0x1e4702){var _0x360229={'raw':!![],'where':{}};var _0x453548={};var _0x9a0a8c={'count':0x0,'rows':[]};return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x2c6b9[_0x2ab5('0x64')]['id']}})['then'](handleEntityNotFound(_0x42dcc2,null))[_0x2ab5('0x22')](function(_0x593dc5){if(_0x593dc5){_0x453548[_0x2ab5('0x46')]=_[_0x2ab5('0x48')](db[_0x2ab5('0xd3')]['rawAttributes']);_0x453548[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x2c6b9[_0x2ab5('0x4b')]);_0x453548[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x453548[_0x2ab5('0x46')],_0x453548[_0x2ab5('0x4b')]);_0x360229[_0x2ab5('0x4c')]=_[_0x2ab5('0x4a')](_0x453548[_0x2ab5('0x46')],qs['fields'](_0x2c6b9['query'][_0x2ab5('0x4d')]));_0x360229[_0x2ab5('0x4c')]=_0x360229[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x360229[_0x2ab5('0x4c')]:_0x453548[_0x2ab5('0x46')];if(!_0x2c6b9[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x360229[_0x2ab5('0x32')]=qs['limit'](_0x2c6b9[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x360229[_0x2ab5('0x31')]=qs[_0x2ab5('0x31')](_0x2c6b9[_0x2ab5('0x4b')]['offset']);}_0x360229['order']=qs[_0x2ab5('0x50')](_0x2c6b9['query']['sort']);_0x360229[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x2c6b9[_0x2ab5('0x4b')],_0x453548[_0x2ab5('0x52')]));_0x360229[_0x2ab5('0x53')]['UserId']=_0x593dc5['id'];if(_0x2c6b9[_0x2ab5('0x4b')]['filter']){_0x360229[_0x2ab5('0x53')]=_['merge'](_0x360229['where'],{'$or':_[_0x2ab5('0x3c')](_0x360229['attributes'],function(_0x20a217){var _0x113be8={};_0x113be8[_0x20a217]={'$like':'%'+_0x2c6b9[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x113be8;})});}_0x360229=_[_0x2ab5('0x54')]({},_0x360229,_0x2c6b9[_0x2ab5('0x5b')]);return db[_0x2ab5('0xd3')]['count']({'where':_0x360229[_0x2ab5('0x53')]})[_0x2ab5('0x22')](function(_0x131ece){_0x9a0a8c[_0x2ab5('0x5c')]=_0x131ece;if(_0x2c6b9[_0x2ab5('0x4b')][_0x2ab5('0x5d')]){_0x360229[_0x2ab5('0x5e')]=[{'all':!![]}];}return db['ScreenRecording'][_0x2ab5('0xca')](_0x360229);})['then'](function(_0x1a9931){_0x9a0a8c[_0x2ab5('0x5f')]=_0x1a9931;return _0x9a0a8c;});}})[_0x2ab5('0x22')](respondWithFilteredResult(_0x42dcc2,_0x360229))['catch'](handleError(_0x42dcc2,null));};exports[_0x2ab5('0xd4')]=function(_0x33da96,_0x2d94c6,_0x107001){var _0x5986bb={};var _0x329493={};var _0x192576;var _0x2a68b8;return db['User'][_0x2ab5('0x91')]({'where':{'id':_0x33da96['params']['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x2d94c6,null))[_0x2ab5('0x22')](function(_0x365392){if(_0x365392){_0x192576=_0x365392;_0x329493['model']=_[_0x2ab5('0x48')](db['ChatInteraction'][_0x2ab5('0xbf')]);_0x329493[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x33da96[_0x2ab5('0x4b')]);_0x329493[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x329493['model'],_0x329493[_0x2ab5('0x4b')]);_0x5986bb['attributes']=_['intersection'](_0x329493[_0x2ab5('0x46')],qs[_0x2ab5('0x4d')](_0x33da96[_0x2ab5('0x4b')][_0x2ab5('0x4d')]));_0x5986bb[_0x2ab5('0x4c')]=_0x5986bb['attributes']['length']?_0x5986bb[_0x2ab5('0x4c')]:_0x329493[_0x2ab5('0x46')];_0x5986bb[_0x2ab5('0x4f')]=qs[_0x2ab5('0x50')](_0x33da96[_0x2ab5('0x4b')]['sort']);_0x5986bb[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x33da96[_0x2ab5('0x4b')],_0x329493[_0x2ab5('0x52')]));if(_0x33da96['query'][_0x2ab5('0x3a')]){_0x5986bb[_0x2ab5('0x53')]=_['merge'](_0x5986bb['where'],{'$or':_[_0x2ab5('0x3c')](_0x5986bb[_0x2ab5('0x4c')],function(_0x534658){var _0x53fba2={};_0x53fba2[_0x534658]={'$like':'%'+_0x33da96[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x53fba2;})});}_0x5986bb=_['merge']({},_0x5986bb,_0x33da96['options']);return _0x192576[_0x2ab5('0xd4')](_0x5986bb);}})[_0x2ab5('0x22')](function(_0x2b62da){if(_0x2b62da){_0x2a68b8=_0x2b62da['length'];if(!_0x33da96[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x5986bb[_0x2ab5('0x32')]=qs['limit'](_0x33da96[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x5986bb['offset']=qs['offset'](_0x33da96['query'][_0x2ab5('0x31')]);}return _0x192576[_0x2ab5('0xd4')](_0x5986bb);}})[_0x2ab5('0x22')](function(_0x19d835){if(_0x19d835){return _0x19d835?{'count':_0x2a68b8,'rows':_0x19d835}:null;}})[_0x2ab5('0x22')](respondWithResult(_0x2d94c6,null))[_0x2ab5('0x2c')](handleError(_0x2d94c6,null));};exports['getOpenchannelInteractions']=function(_0x5c9e6f,_0x1fdfbd,_0x327164){var _0x5ffd75={};var _0x52b445={};var _0x40c88f;var _0x4c991b;return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x5c9e6f[_0x2ab5('0x64')]['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x1fdfbd,null))[_0x2ab5('0x22')](function(_0x16c1e0){if(_0x16c1e0){_0x40c88f=_0x16c1e0;_0x52b445['model']=_[_0x2ab5('0x48')](db[_0x2ab5('0xd5')][_0x2ab5('0xbf')]);_0x52b445[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x5c9e6f[_0x2ab5('0x4b')]);_0x52b445[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x52b445[_0x2ab5('0x46')],_0x52b445['query']);_0x5ffd75['attributes']=_[_0x2ab5('0x4a')](_0x52b445[_0x2ab5('0x46')],qs['fields'](_0x5c9e6f['query']['fields']));_0x5ffd75[_0x2ab5('0x4c')]=_0x5ffd75[_0x2ab5('0x4c')]['length']?_0x5ffd75[_0x2ab5('0x4c')]:_0x52b445[_0x2ab5('0x46')];_0x5ffd75['order']=qs[_0x2ab5('0x50')](_0x5c9e6f[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x5ffd75[_0x2ab5('0x53')]=qs['filters'](_[_0x2ab5('0x51')](_0x5c9e6f[_0x2ab5('0x4b')],_0x52b445[_0x2ab5('0x52')]));if(_0x5c9e6f[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x5ffd75[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x5ffd75['where'],{'$or':_[_0x2ab5('0x3c')](_0x5ffd75['attributes'],function(_0x1847b6){var _0x8ef6a0={};_0x8ef6a0[_0x1847b6]={'$like':'%'+_0x5c9e6f[_0x2ab5('0x4b')]['filter']+'%'};return _0x8ef6a0;})});}_0x5ffd75=_[_0x2ab5('0x54')]({},_0x5ffd75,_0x5c9e6f[_0x2ab5('0x5b')]);return _0x40c88f[_0x2ab5('0xd6')](_0x5ffd75);}})['then'](function(_0x4ca36e){if(_0x4ca36e){_0x4c991b=_0x4ca36e['length'];if(!_0x5c9e6f[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x5ffd75['limit']=qs[_0x2ab5('0x32')](_0x5c9e6f[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x5ffd75['offset']=qs[_0x2ab5('0x31')](_0x5c9e6f[_0x2ab5('0x4b')][_0x2ab5('0x31')]);}return _0x40c88f[_0x2ab5('0xd6')](_0x5ffd75);}})[_0x2ab5('0x22')](function(_0x31d7b3){if(_0x31d7b3){return _0x31d7b3?{'count':_0x4c991b,'rows':_0x31d7b3}:null;}})[_0x2ab5('0x22')](respondWithResult(_0x1fdfbd,null))[_0x2ab5('0x2c')](handleError(_0x1fdfbd,null));};exports[_0x2ab5('0xd7')]=function(_0x83cf1a,_0x255ad8,_0x284293){var _0x4179f9={'raw':!![],'where':{}};var _0x396a73={};var _0x48e3fb={'count':0x0,'rows':[]};return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x83cf1a[_0x2ab5('0x64')]['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x255ad8,null))[_0x2ab5('0x22')](function(_0x22a5dc){if(_0x22a5dc){_0x396a73['model']=_['keys'](db['MailInteraction'][_0x2ab5('0xbf')]);_0x396a73[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x83cf1a[_0x2ab5('0x4b')]);_0x396a73[_0x2ab5('0x52')]=_['intersection'](_0x396a73[_0x2ab5('0x46')],_0x396a73[_0x2ab5('0x4b')]);_0x4179f9[_0x2ab5('0x4c')]=_[_0x2ab5('0x4a')](_0x396a73[_0x2ab5('0x46')],qs['fields'](_0x83cf1a[_0x2ab5('0x4b')]['fields']));_0x4179f9['attributes']=_0x4179f9[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x4179f9[_0x2ab5('0x4c')]:_0x396a73[_0x2ab5('0x46')];if(!_0x83cf1a['query'][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x4179f9['limit']=qs[_0x2ab5('0x32')](_0x83cf1a[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x4179f9[_0x2ab5('0x31')]=qs[_0x2ab5('0x31')](_0x83cf1a['query'][_0x2ab5('0x31')]);}_0x4179f9[_0x2ab5('0x4f')]=qs[_0x2ab5('0x50')](_0x83cf1a[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x4179f9[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x83cf1a[_0x2ab5('0x4b')],_0x396a73['filters']));_0x4179f9[_0x2ab5('0x53')][_0x2ab5('0xd1')]=_0x22a5dc['id'];if(_0x83cf1a['query'][_0x2ab5('0x3a')]){_0x4179f9[_0x2ab5('0x53')]=_['merge'](_0x4179f9[_0x2ab5('0x53')],{'$or':_[_0x2ab5('0x3c')](_0x4179f9[_0x2ab5('0x4c')],function(_0x57a9d7){var _0x369812={};_0x369812[_0x57a9d7]={'$like':'%'+_0x83cf1a['query'][_0x2ab5('0x3a')]+'%'};return _0x369812;})});}_0x4179f9=_[_0x2ab5('0x54')]({},_0x4179f9,_0x83cf1a[_0x2ab5('0x5b')]);return db['MailInteraction'][_0x2ab5('0x5c')]({'where':_0x4179f9[_0x2ab5('0x53')]})[_0x2ab5('0x22')](function(_0x34d000){_0x48e3fb['count']=_0x34d000;if(_0x83cf1a[_0x2ab5('0x4b')][_0x2ab5('0x5d')]){_0x4179f9[_0x2ab5('0x5e')]=[{'all':!![]}];}return db['MailInteraction'][_0x2ab5('0xca')](_0x4179f9);})['then'](function(_0xdc7e3b){_0x48e3fb[_0x2ab5('0x5f')]=_0xdc7e3b;return _0x48e3fb;});}})[_0x2ab5('0x22')](respondWithFilteredResult(_0x255ad8,_0x4179f9))[_0x2ab5('0x2c')](handleError(_0x255ad8,null));};exports[_0x2ab5('0xd8')]=function(_0x2ae249,_0x2b27ac,_0x3ba1a6){var _0x101483={};var _0x7f3dfa={};var _0x579752;var _0x2365c8;return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x2ae249[_0x2ab5('0x64')]['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x2b27ac,null))[_0x2ab5('0x22')](function(_0x182dae){if(_0x182dae){_0x579752=_0x182dae;_0x7f3dfa[_0x2ab5('0x46')]=_[_0x2ab5('0x48')](db[_0x2ab5('0xd9')][_0x2ab5('0xbf')]);_0x7f3dfa[_0x2ab5('0x4b')]=_['keys'](_0x2ae249[_0x2ab5('0x4b')]);_0x7f3dfa[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x7f3dfa[_0x2ab5('0x46')],_0x7f3dfa['query']);_0x101483['attributes']=_[_0x2ab5('0x4a')](_0x7f3dfa['model'],qs[_0x2ab5('0x4d')](_0x2ae249['query'][_0x2ab5('0x4d')]));_0x101483[_0x2ab5('0x4c')]=_0x101483[_0x2ab5('0x4c')]['length']?_0x101483[_0x2ab5('0x4c')]:_0x7f3dfa['model'];_0x101483[_0x2ab5('0x4f')]=qs[_0x2ab5('0x50')](_0x2ae249['query']['sort']);_0x101483[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x2ae249['query'],_0x7f3dfa[_0x2ab5('0x52')]));if(_0x2ae249[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x101483['where']=_[_0x2ab5('0x54')](_0x101483[_0x2ab5('0x53')],{'$or':_[_0x2ab5('0x3c')](_0x101483['attributes'],function(_0x3307fd){var _0x3b0053={};_0x3b0053[_0x3307fd]={'$like':'%'+_0x2ae249[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x3b0053;})});}_0x101483=_['merge']({},_0x101483,_0x2ae249[_0x2ab5('0x5b')]);return _0x579752['getSmsInteractions'](_0x101483);}})[_0x2ab5('0x22')](function(_0x181caf){if(_0x181caf){_0x2365c8=_0x181caf[_0x2ab5('0x4e')];if(!_0x2ae249[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x101483[_0x2ab5('0x32')]=qs[_0x2ab5('0x32')](_0x2ae249['query'][_0x2ab5('0x32')]);_0x101483[_0x2ab5('0x31')]=qs[_0x2ab5('0x31')](_0x2ae249[_0x2ab5('0x4b')][_0x2ab5('0x31')]);}return _0x579752[_0x2ab5('0xd8')](_0x101483);}})[_0x2ab5('0x22')](function(_0x10c53d){if(_0x10c53d){return _0x10c53d?{'count':_0x2365c8,'rows':_0x10c53d}:null;}})[_0x2ab5('0x22')](respondWithResult(_0x2b27ac,null))[_0x2ab5('0x2c')](handleError(_0x2b27ac,null));};exports[_0x2ab5('0xda')]=function(_0x510a9f,_0x254bc0,_0x4c1a8e){var _0x109915={};var _0x5cd018={};var _0x1403e3;var _0xa14444;return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x510a9f[_0x2ab5('0x64')]['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x254bc0,null))[_0x2ab5('0x22')](function(_0xc2e6c4){if(_0xc2e6c4){_0x1403e3=_0xc2e6c4;_0x5cd018['model']=_[_0x2ab5('0x48')](db[_0x2ab5('0xdb')][_0x2ab5('0xbf')]);_0x5cd018[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x510a9f[_0x2ab5('0x4b')]);_0x5cd018[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x5cd018['model'],_0x5cd018[_0x2ab5('0x4b')]);_0x109915[_0x2ab5('0x4c')]=_['intersection'](_0x5cd018[_0x2ab5('0x46')],qs[_0x2ab5('0x4d')](_0x510a9f[_0x2ab5('0x4b')][_0x2ab5('0x4d')]));_0x109915[_0x2ab5('0x4c')]=_0x109915[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x109915[_0x2ab5('0x4c')]:_0x5cd018[_0x2ab5('0x46')];_0x109915[_0x2ab5('0x4f')]=qs['sort'](_0x510a9f[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x109915[_0x2ab5('0x53')]=qs['filters'](_[_0x2ab5('0x51')](_0x510a9f[_0x2ab5('0x4b')],_0x5cd018['filters']));if(_0x510a9f[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x109915[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x109915[_0x2ab5('0x53')],{'$or':_[_0x2ab5('0x3c')](_0x109915[_0x2ab5('0x4c')],function(_0x31bd04){var _0x905e17={};_0x905e17[_0x31bd04]={'$like':'%'+_0x510a9f['query'][_0x2ab5('0x3a')]+'%'};return _0x905e17;})});}_0x109915=_[_0x2ab5('0x54')]({},_0x109915,_0x510a9f[_0x2ab5('0x5b')]);return _0x1403e3[_0x2ab5('0xda')](_0x109915);}})[_0x2ab5('0x22')](function(_0x290125){if(_0x290125){_0xa14444=_0x290125[_0x2ab5('0x4e')];if(!_0x510a9f[_0x2ab5('0x4b')]['hasOwnProperty'](_0x2ab5('0xc7'))){_0x109915['limit']=qs[_0x2ab5('0x32')](_0x510a9f[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x109915['offset']=qs[_0x2ab5('0x31')](_0x510a9f[_0x2ab5('0x4b')]['offset']);}return _0x1403e3[_0x2ab5('0xda')](_0x109915);}})[_0x2ab5('0x22')](function(_0x163c58){if(_0x163c58){return _0x163c58?{'count':_0xa14444,'rows':_0x163c58}:null;}})[_0x2ab5('0x22')](respondWithResult(_0x254bc0,null))[_0x2ab5('0x2c')](handleError(_0x254bc0,null));};exports[_0x2ab5('0xdc')]=function(_0x303303,_0x532b13,_0xd9af2){var _0xfdf7ae;var _0x5ec3ae;var _0x36855d;var _0x12d155=!_[_0x2ab5('0x70')](_0x303303[_0x2ab5('0x64')]['id'])?_0x303303[_0x2ab5('0x64')]['id']:!_[_0x2ab5('0x70')](_0x303303[_0x2ab5('0x6b')]['id'])?_0x303303['user']['id']:null;return db['User'][_0x2ab5('0x63')]({'where':{'id':_0x12d155,'role':_0x2ab5('0x68')},'attributes':['id',_0x2ab5('0x42'),_0x2ab5('0xdd'),_0x2ab5('0xde'),'role',_0x2ab5('0x75'),_0x2ab5('0x9b')]})[_0x2ab5('0x22')](handleEntityNotFound(_0x532b13,null))[_0x2ab5('0x22')](function(_0x299e96){if(_0x299e96){_0xfdf7ae=_0x299e96;if(_0x303303[_0x2ab5('0x62')][_0x2ab5('0xa9')]){_0x36855d=util[_0x2ab5('0xaa')]('LOCAL/%s@from-sip/n',_0xfdf7ae[_0x303303['body'][_0x2ab5('0xa9')]]);}else if(_0x303303[_0x2ab5('0x62')]['intrf']){_0x36855d=util[_0x2ab5('0xaa')](_0x2ab5('0xab'),_0x303303[_0x2ab5('0x62')][_0x2ab5('0xdf')]);}else{_0x36855d=util[_0x2ab5('0xaa')]('SIP/%s',_0xfdf7ae[_0x2ab5('0x42')]);}socket['to'](util[_0x2ab5('0xaa')](_0x2ab5('0xe0'),_0xfdf7ae['name']))[_0x2ab5('0xa4')]('user:forcelogout',{'ip':_0x303303[_0x2ab5('0xe1')]['x-forwarded-for']||_0x303303[_0x2ab5('0xe2')][_0x2ab5('0xe3')]||_0x303303[_0x2ab5('0xe4')][_0x2ab5('0xe3')]||_0x303303[_0x2ab5('0xe2')][_0x2ab5('0xe4')][_0x2ab5('0xe3')]});return db[_0x2ab5('0xae')][_0x2ab5('0x37')]({'where':{'membername':_0xfdf7ae[_0x2ab5('0x42')]},'individualHooks':!![]});}})[_0x2ab5('0x22')](function(_0x5994a4){if(_0xfdf7ae){return _0xfdf7ae['getVoiceQueues']({'raw':!![]});}})[_0x2ab5('0x22')](function(_0x442bba){var _0x26042d=[];if(_0x442bba){_0x5ec3ae=_0x442bba;if(_0x5ec3ae[_0x2ab5('0x4e')]){for(var _0x288287=0x0;_0x288287<_0x5ec3ae[_0x2ab5('0x4e')];_0x288287++){_0x26042d[_0x2ab5('0xa8')]({'membername':_0xfdf7ae['name'],'UserId':_0xfdf7ae['id'],'queue_name':_0x5ec3ae[_0x288287][_0x2ab5('0x42')],'VoiceQueueId':_0x5ec3ae[_0x288287]['id'],'interface':_0x36855d,'paused':_0xfdf7ae[_0x2ab5('0x9b')]||![],'penalty':_0x5ec3ae[_0x288287][_0x2ab5('0xe5')]||0x0});}return BPromise[_0x2ab5('0xad')](_0x26042d,function(_0x327832){return db['UserVoiceQueueRt']['upsert'](_0x327832);});}}})['then'](function(){return db['MemberReport'][_0x2ab5('0xca')]({'where':{'membername':_0xfdf7ae[_0x2ab5('0x42')],'exitAt':null}});})[_0x2ab5('0x22')](function(_0x34157c){var _0x1d3de8=[];_0x34157c[_0x2ab5('0xe6')](function(_0x2ebdfe){_0x1d3de8[_0x2ab5('0xa8')](_0x2ebdfe[_0x2ab5('0x61')]({'exitAt':moment()[_0x2ab5('0xaa')](_0x2ab5('0xe7'))}));});return BPromise['all'](_0x1d3de8);})[_0x2ab5('0x22')](function(){var _0x54b7a3=[];var _0x4a324c=[];var _0x4a2ba7=utils[_0x2ab5('0xe8')]();var _0x61e8b4={'membername':_0xfdf7ae[_0x2ab5('0x42')],'interface':_0x36855d,'enterAt':moment()[_0x2ab5('0xaa')](_0x2ab5('0xe7')),'role':_0xfdf7ae[_0x2ab5('0x3f')],'internal':_0xfdf7ae[_0x2ab5('0x75')]};_0x4a2ba7[_0x2ab5('0xe6')](function(_0x92f3c2){_0x54b7a3[_0x2ab5('0xa8')](_[_0x2ab5('0x54')]({'channel':_0x92f3c2,'type':_0x2ab5('0xe9'),'data1':_0x303303[_0x2ab5('0x62')][_0x2ab5('0xea')],'data2':_0x36855d},_0x61e8b4));if(_0xfdf7ae['loginInPause']){_0x4a324c[_0x2ab5('0xa8')](_['merge']({'channel':_0x92f3c2,'type':_0x2ab5('0xeb'),'data1':_0x2ab5('0xec')},_0x61e8b4));}});return db[_0x2ab5('0xed')][_0x2ab5('0x60')](_0x54b7a3['concat'](_0x4a324c),{'individualHooks':!![]});})[_0x2ab5('0x22')](function(){return _0xfdf7ae[_0x2ab5('0x61')]({'online':!![],'lastLoginAt':moment()[_0x2ab5('0xaa')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xfdf7ae[_0x2ab5('0x9b')]||![],'mailPause':_0xfdf7ae['loginInPause']||![],'chatPause':_0xfdf7ae[_0x2ab5('0x9b')]||![],'faxPause':_0xfdf7ae[_0x2ab5('0x9b')]||![],'smsPause':_0xfdf7ae[_0x2ab5('0x9b')]||![],'openchannelPause':_0xfdf7ae[_0x2ab5('0x9b')]||![],'pauseType':_0xfdf7ae[_0x2ab5('0x9b')]?_0x2ab5('0xec'):null,'interface':_0x36855d,'lastPauseAt':moment()['format'](_0x2ab5('0xe7'))});})[_0x2ab5('0x22')](function(_0x13cf00){if(_0x303303['isMiddleware']){return _0xd9af2();}else{return BPromise[_0x2ab5('0xee')](_0x13cf00)[_0x2ab5('0x22')](respondWithResult(_0x532b13,null));}})['catch'](handleError(_0x532b13,null));};exports[_0x2ab5('0xef')]=function(_0x2ed445,_0x42d6b8,_0x4d45cd){var _0x24c606;return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x2ed445[_0x2ab5('0x64')]['id'],'role':_0x2ab5('0x68')},'attributes':['id','name',_0x2ab5('0x3f')]})[_0x2ab5('0x22')](handleEntityNotFound(_0x42d6b8,null))[_0x2ab5('0x22')](function(_0x56e551){if(_0x56e551){_0x24c606=_0x56e551;return db[_0x2ab5('0xae')][_0x2ab5('0x37')]({'where':{'membername':_0x24c606['name']},'individualHooks':!![]});}})[_0x2ab5('0x22')](function(){return db[_0x2ab5('0xed')]['findAll']({'where':{'membername':_0x24c606[_0x2ab5('0x42')],'exitAt':null}});})[_0x2ab5('0x22')](function(_0x8a5bf7){var _0x4b9197=[];_0x8a5bf7['forEach'](function(_0x11f551){_0x4b9197[_0x2ab5('0xa8')](_0x11f551[_0x2ab5('0x61')]({'exitAt':moment()[_0x2ab5('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2ab5('0xf0')](_0x4b9197);})['then'](function(){return _0x24c606[_0x2ab5('0x61')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x2ab5('0x22')](respondWithResult(_0x42d6b8,null))[_0x2ab5('0x2c')](handleError(_0x42d6b8,null));};exports[_0x2ab5('0xf1')]=function(_0x155c8c,_0x557568,_0x2b0426){var _0x21aca5;return db[_0x2ab5('0xae')][_0x2ab5('0x61')]({'paused':0x1},{'where':{'UserId':_0x155c8c[_0x2ab5('0x64')]['id']},'individualHooks':!![]})[_0x2ab5('0x22')](function(){return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x155c8c['params']['id'],'role':'agent'},'attributes':['id',_0x2ab5('0x42'),_0x2ab5('0x3f'),_0x2ab5('0x75'),_0x2ab5('0xa9')]});})[_0x2ab5('0x22')](handleEntityNotFound(_0x557568,null))[_0x2ab5('0x22')](function(_0x4d5661){if(_0x4d5661){_0x21aca5=_0x4d5661;return respondWithRpcPromise(_0x2ab5('0xf2'),_0x2ab5('0xf1'),{'id':_0x21aca5['id'],'name':_0x21aca5[_0x2ab5('0x42')],'pause':!![]});}})[_0x2ab5('0x22')](function(){if(_0x21aca5){return db['MemberReport'][_0x2ab5('0xca')]({'where':{'membername':_0x21aca5[_0x2ab5('0x42')],'type':_0x2ab5('0xeb'),'exitAt':null}});}})[_0x2ab5('0x22')](function(_0x5162a8){if(_0x5162a8[_0x2ab5('0x4e')]){var _0x1ed1fd=moment()['format'](_0x2ab5('0xe7'));for(var _0x110370=0x0,_0x2a506b=_0x5162a8[_0x2ab5('0x4e')];_0x110370<_0x2a506b;_0x110370++){_0x5162a8[_0x110370][_0x2ab5('0xf3')]({'exitAt':_0x1ed1fd});}}})[_0x2ab5('0x22')](function(){var _0x259242=[];var _0x1f05d7=utils[_0x2ab5('0xe8')]();_0x1f05d7['forEach'](function(_0x5c0dd6){_0x259242[_0x2ab5('0xa8')]({'channel':_0x5c0dd6,'membername':_0x21aca5[_0x2ab5('0x42')],'interface':_['isNil'](_0x21aca5[_0x2ab5('0xa9')])?util['format'](_0x2ab5('0xab'),_0x21aca5[_0x2ab5('0x42')]):_0x21aca5[_0x2ab5('0xa9')],'type':_0x2ab5('0xeb'),'enterAt':moment()[_0x2ab5('0xaa')](_0x2ab5('0xe7')),'data1':_0x155c8c[_0x2ab5('0x62')]['type']||'DEFAULT\x20PAUSE','role':_0x21aca5[_0x2ab5('0x3f')],'internal':_0x21aca5[_0x2ab5('0x75')]});});return db[_0x2ab5('0xed')][_0x2ab5('0x60')](_0x259242,{'individualHooks':!![]});})[_0x2ab5('0x22')](function(){return _0x21aca5[_0x2ab5('0x61')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x155c8c[_0x2ab5('0x62')]['type']||_0x2ab5('0xf4'),'lastPauseAt':moment()[_0x2ab5('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2ab5('0x22')](respondWithResult(_0x557568,null))['catch'](handleError(_0x557568,null));};exports[_0x2ab5('0xf5')]=function(_0x2a3cfa,_0x50c58a,_0x320237){var _0x6cebee;return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x2a3cfa[_0x2ab5('0x64')]['id']},'attributes':['id',_0x2ab5('0x42'),_0x2ab5('0x3f'),_0x2ab5('0xac'),_0x2ab5('0xf6'),_0x2ab5('0xf7'),'faxPause','openchannelPause',_0x2ab5('0xf8'),'pauseType',_0x2ab5('0xf9')]})[_0x2ab5('0x22')](handleEntityNotFound(_0x50c58a,null))['then'](function(_0x3138da){if(_0x3138da){_0x6cebee=_0x3138da;if(_0x2a3cfa['body']['channel']&&!utils[_0x2ab5('0x9c')](_0x2a3cfa[_0x2ab5('0x62')][_0x2ab5('0x99')])){throw new db['Sequelize'][(_0x2ab5('0x1f'))](_0x2ab5('0x9d'));}switch(_0x2a3cfa[_0x2ab5('0x62')]['channel']){case _0x2ab5('0xa6'):return respondWithRpcPromise('QueuePause',_0x2ab5('0xf5'),{'id':_0x6cebee['id'],'name':_0x6cebee[_0x2ab5('0x42')],'pause':![]})[_0x2ab5('0x22')](function(){return db[_0x2ab5('0xae')][_0x2ab5('0x61')]({'paused':0x0},{'where':{'UserId':_0x6cebee['id']},'individualHooks':!![]});})[_0x2ab5('0x22')](function(){return db['MemberReport'][_0x2ab5('0x63')]({'where':{'channel':_0x2a3cfa[_0x2ab5('0x62')][_0x2ab5('0x99')],'membername':_0x6cebee['name'],'type':_0x2ab5('0xeb'),'exitAt':null}});})[_0x2ab5('0x22')](function(_0x5d039f){if(_0x5d039f){return _0x5d039f[_0x2ab5('0x61')]({'exitAt':moment()['format'](_0x2ab5('0xe7')),'data2':_0x2ab5('0xfa')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x6cebee[_0x2ab5('0x61')]({'voicePause':![]});});case'mail':case'chat':case _0x2ab5('0xfb'):case _0x2ab5('0xfc'):case _0x2ab5('0xfd'):return db['MemberReport'][_0x2ab5('0x63')]({'where':{'channel':_0x2a3cfa['body']['channel'],'membername':_0x6cebee[_0x2ab5('0x42')],'type':_0x2ab5('0xeb'),'exitAt':null}})['then'](function(_0x1495ea){if(_0x1495ea){return _0x1495ea[_0x2ab5('0x61')]({'exitAt':moment()[_0x2ab5('0xaa')](_0x2ab5('0xe7')),'data2':_0x2ab5('0xfa')},{'individualHooks':!![]});}return null;})[_0x2ab5('0x22')](function(){var _0x199194={};_[_0x2ab5('0x33')](_0x199194,util[_0x2ab5('0xaa')](_0x2ab5('0xfe'),_0x2a3cfa[_0x2ab5('0x62')][_0x2ab5('0x99')],_0x2ab5('0xff')),![]);return _0x6cebee['update'](_0x199194);});default:return respondWithRpcPromise(_0x2ab5('0xf2'),_0x2ab5('0xf5'),{'id':_0x6cebee['id'],'name':_0x6cebee[_0x2ab5('0x42')],'pause':![]})[_0x2ab5('0x22')](function(){return db[_0x2ab5('0xae')][_0x2ab5('0x61')]({'paused':0x0},{'where':{'UserId':_0x6cebee['id']}});})[_0x2ab5('0x22')](function(){return db[_0x2ab5('0xed')]['findAll']({'where':{'membername':_0x6cebee[_0x2ab5('0x42')],'type':_0x2ab5('0xeb'),'exitAt':null}});})[_0x2ab5('0x22')](function(_0x23a1fd){var _0x312a6b=[];_0x23a1fd[_0x2ab5('0xe6')](function(_0x3797c5){_0x312a6b[_0x2ab5('0xa8')](_0x3797c5[_0x2ab5('0x61')]({'exitAt':moment()[_0x2ab5('0xaa')](_0x2ab5('0xe7')),'data2':_0x2ab5('0xfa')}));});return BPromise[_0x2ab5('0xf0')](_0x312a6b);})[_0x2ab5('0x22')](function(){return _0x6cebee[_0x2ab5('0x61')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x2ab5('0x22')](respondWithResult(_0x50c58a,null))['catch'](handleError(_0x50c58a,null));};exports[_0x2ab5('0x100')]=function(_0x2c7990,_0x81d0b0,_0xc0863f){var _0x47ced1={};var _0x3b9120={};var _0x1dfd02;var _0x1d1dee;return db[_0x2ab5('0x45')]['findOne']({'where':{'id':_0x2c7990[_0x2ab5('0x64')]['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x81d0b0,null))[_0x2ab5('0x22')](function(_0x1c6d40){if(_0x1c6d40){_0x1dfd02=_0x1c6d40;_0x3b9120[_0x2ab5('0x46')]=_[_0x2ab5('0x48')](db[_0x2ab5('0x101')][_0x2ab5('0xbf')]);_0x3b9120[_0x2ab5('0x4b')]=_[_0x2ab5('0x48')](_0x2c7990[_0x2ab5('0x4b')]);_0x3b9120[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x3b9120[_0x2ab5('0x46')],_0x3b9120[_0x2ab5('0x4b')]);_0x47ced1[_0x2ab5('0x4c')]=_[_0x2ab5('0x4a')](_0x3b9120[_0x2ab5('0x46')],qs['fields'](_0x2c7990['query']['fields']));_0x47ced1[_0x2ab5('0x4c')]=_0x47ced1[_0x2ab5('0x4c')]['length']?_0x47ced1[_0x2ab5('0x4c')]:_0x3b9120[_0x2ab5('0x46')];_0x47ced1[_0x2ab5('0x4f')]=qs[_0x2ab5('0x50')](_0x2c7990[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x47ced1[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x2c7990[_0x2ab5('0x4b')],_0x3b9120[_0x2ab5('0x52')]));if(_0x2c7990[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x47ced1['where']=_[_0x2ab5('0x54')](_0x47ced1[_0x2ab5('0x53')],{'$or':_[_0x2ab5('0x3c')](_0x47ced1[_0x2ab5('0x4c')],function(_0x518d44){var _0x530ab3={};_0x530ab3[_0x518d44]={'$like':'%'+_0x2c7990[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x530ab3;})});}_0x47ced1=_['merge']({},_0x47ced1,_0x2c7990[_0x2ab5('0x5b')]);return _0x1dfd02['getTeams'](_0x47ced1);}})[_0x2ab5('0x22')](function(_0x319ef0){if(_0x319ef0){_0x1d1dee=_0x319ef0['length'];if(!_0x2c7990[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x47ced1['limit']=qs['limit'](_0x2c7990[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x47ced1[_0x2ab5('0x31')]=qs[_0x2ab5('0x31')](_0x2c7990[_0x2ab5('0x4b')][_0x2ab5('0x31')]);}return _0x1dfd02['getTeams'](_0x47ced1);}})['then'](function(_0x3c08a1){if(_0x3c08a1){return _0x3c08a1?{'count':_0x1d1dee,'rows':_0x3c08a1}:null;}})[_0x2ab5('0x22')](respondWithResult(_0x81d0b0,null))['catch'](handleError(_0x81d0b0,null));};exports['addTeams']=function(_0x458f6f,_0x13a014){return db[_0x2ab5('0x45')][_0x2ab5('0x63')]({'where':{'id':_0x458f6f['params']['id']}})['then'](handleEntityNotFound(_0x13a014,null))[_0x2ab5('0x22')](function(_0x6ec43c){if(_0x6ec43c){var _0x13d459=_0x6ec43c[_0x2ab5('0x89')]({'plain':!![]});return _0x6ec43c[_0x2ab5('0x102')](_0x458f6f['body']['ids'],_[_0x2ab5('0x103')](_0x458f6f[_0x2ab5('0x62')],['ids','id'])||{})[_0x2ab5('0x22')](function(){for(var _0xbb8ee1=0x0;_0xbb8ee1<_0x458f6f[_0x2ab5('0x62')][_0x2ab5('0x67')][_0x2ab5('0x4e')];_0xbb8ee1++){var _0x13d1b1=[];db[_0x2ab5('0x101')][_0x2ab5('0x91')]({'where':{'id':_0x458f6f[_0x2ab5('0x62')]['ids'][_0xbb8ee1]}})[_0x2ab5('0x22')](function(_0x11d8d5){_0x13d1b1['push'](_0x11d8d5[_0x2ab5('0x104')]()['then'](function(_0x2e2d3e){for(var _0x24c856=0x0;_0x24c856<_0x2e2d3e[_0x2ab5('0x4e')];_0x24c856++){_0x2e2d3e[_0x24c856][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x106'));}return _0x2e2d3e;}));_0x13d1b1['push'](_0x11d8d5[_0x2ab5('0x107')]()['then'](function(_0x56bee9){for(var _0x5db5b2=0x0;_0x5db5b2<_0x56bee9[_0x2ab5('0x4e')];_0x5db5b2++){_0x56bee9[_0x5db5b2][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x108'));}return _0x56bee9;}));_0x13d1b1[_0x2ab5('0xa8')](_0x11d8d5[_0x2ab5('0x109')]()[_0x2ab5('0x22')](function(_0xe9a382){for(var _0x439b3c=0x0;_0x439b3c<_0xe9a382[_0x2ab5('0x4e')];_0x439b3c++){_0xe9a382[_0x439b3c][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x10a'));}return _0xe9a382;}));_0x13d1b1[_0x2ab5('0xa8')](_0x11d8d5['getSmsQueues']()['then'](function(_0x364871){for(var _0x8cd366=0x0;_0x8cd366<_0x364871['length'];_0x8cd366++){_0x364871[_0x8cd366][_0x2ab5('0x105')](_0x2ab5('0x99'),'Sms');}return _0x364871;}));_0x13d1b1[_0x2ab5('0xa8')](_0x11d8d5[_0x2ab5('0x10b')]()[_0x2ab5('0x22')](function(_0x4d9da8){for(var _0x2691d2=0x0;_0x2691d2<_0x4d9da8[_0x2ab5('0x4e')];_0x2691d2++){_0x4d9da8[_0x2691d2][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x10c'));}return _0x4d9da8;}));_0x13d1b1['push'](_0x11d8d5[_0x2ab5('0x10d')]()[_0x2ab5('0x22')](function(_0x2670db){for(var _0x257b93=0x0;_0x257b93<_0x2670db[_0x2ab5('0x4e')];_0x257b93++){_0x2670db[_0x257b93][_0x2ab5('0x105')]('channel',_0x2ab5('0x10e'));}return _0x2670db;}));return BPromise[_0x2ab5('0xf0')](_0x13d1b1);})[_0x2ab5('0x22')](function(_0x51a31b){var _0x5658eb=_[_0x2ab5('0x10f')](_0x51a31b);_0x13d1b1=[];return db[_0x2ab5('0x57')]['transaction'](function(_0xea1dc2){for(var _0x4bcb4d=0x0;_0x4bcb4d<_0x5658eb[_0x2ab5('0x4e')];_0x4bcb4d++){_0x13d1b1[_0x2ab5('0xa8')](_0x5658eb[_0x4bcb4d][_0x2ab5('0x110')](_0x13d459['id']),{'transaction':_0xea1dc2});}return BPromise[_0x2ab5('0xf0')](_0x13d1b1)[_0x2ab5('0x22')](function(){if(_0x13d459['online']){return BPromise[_0x2ab5('0xad')](_[_0x2ab5('0x3a')](_0x5658eb,function(_0x1784c8){return _0x1784c8[_0x2ab5('0x111')](_0x2ab5('0x99'))===_0x2ab5('0x106');}),function(_0x629fe4){return db[_0x2ab5('0xae')][_0x2ab5('0xaf')]({'membername':_0x13d459[_0x2ab5('0x42')],'UserId':_0x13d459['id'],'queue_name':_0x629fe4[_0x2ab5('0x42')],'VoiceQueueId':_0x629fe4['id'],'interface':_['isNil'](_0x13d459['interface'])?util[_0x2ab5('0xaa')](_0x2ab5('0xab'),_0x13d459[_0x2ab5('0x42')]):_0x13d459[_0x2ab5('0xa9')],'paused':_0x13d459['voicePause']||![],'penalty':_0x13d459[_0x2ab5('0xa1')]},{'transaction':_0xea1dc2});});}else{return;}})[_0x2ab5('0x22')](function(){for(var _0x3307f6=0x0;_0x3307f6<_0x5658eb['length'];_0x3307f6++){var _0x187ebf=_0x5658eb[_0x3307f6]['getDataValue'](_0x2ab5('0x99'));var _0x5b16e4=_0x187ebf+_0x2ab5('0xb0');socket[_0x2ab5('0xa4')](_0x2ab5('0x6b')+_0x187ebf+'Queue:save',{'UserId':_0x13d459['id'],['queueField']:_0x5658eb[_0x3307f6]['id']});}});});});}});}})[_0x2ab5('0x22')](respondWithStatusCode(_0x13a014,null))[_0x2ab5('0x2c')](handleError(_0x13a014,null));};exports[_0x2ab5('0x112')]=function(_0xad99b0,_0x4ceba3){return db[_0x2ab5('0x45')]['findOne']({'where':{'id':_0xad99b0['params']['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x4ceba3,null))['then'](function(_0x1150be){if(_0x1150be){var _0x4868e2=_0x1150be[_0x2ab5('0x89')]({'plain':!![]});var _0x3bc7c4=_0xad99b0[_0x2ab5('0x4b')][_0x2ab5('0x67')];return _0x1150be[_0x2ab5('0x112')](_0x3bc7c4)['then'](function(){for(var _0x2926c3=0x0;_0x2926c3<_0x3bc7c4['length'];_0x2926c3++){var _0xac1e39=[];db[_0x2ab5('0x101')][_0x2ab5('0x91')]({'where':{'id':_0x3bc7c4[_0x2926c3]}})[_0x2ab5('0x22')](function(_0x95f6b2){_0xac1e39[_0x2ab5('0xa8')](_0x95f6b2[_0x2ab5('0x104')]()['then'](function(_0x4bc0eb){for(var _0x316e19=0x0;_0x316e19<_0x4bc0eb['length'];_0x316e19++){_0x4bc0eb[_0x316e19][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x106'));}return _0x4bc0eb;}));_0xac1e39[_0x2ab5('0xa8')](_0x95f6b2[_0x2ab5('0x107')]()['then'](function(_0x4585b5){for(var _0x4ca478=0x0;_0x4ca478<_0x4585b5['length'];_0x4ca478++){_0x4585b5[_0x4ca478][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x108'));}return _0x4585b5;}));_0xac1e39[_0x2ab5('0xa8')](_0x95f6b2[_0x2ab5('0x109')]()[_0x2ab5('0x22')](function(_0x4f63cd){for(var _0x1a2e50=0x0;_0x1a2e50<_0x4f63cd[_0x2ab5('0x4e')];_0x1a2e50++){_0x4f63cd[_0x1a2e50][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x10a'));}return _0x4f63cd;}));_0xac1e39[_0x2ab5('0xa8')](_0x95f6b2[_0x2ab5('0x113')]()[_0x2ab5('0x22')](function(_0x1ce688){for(var _0x148b8c=0x0;_0x148b8c<_0x1ce688[_0x2ab5('0x4e')];_0x148b8c++){_0x1ce688[_0x148b8c][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x114'));}return _0x1ce688;}));_0xac1e39[_0x2ab5('0xa8')](_0x95f6b2[_0x2ab5('0x10b')]()[_0x2ab5('0x22')](function(_0x46cef0){for(var _0x46c3a2=0x0;_0x46c3a2<_0x46cef0['length'];_0x46c3a2++){_0x46cef0[_0x46c3a2][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x10c'));}return _0x46cef0;}));_0xac1e39[_0x2ab5('0xa8')](_0x95f6b2[_0x2ab5('0x10d')]()[_0x2ab5('0x22')](function(_0x329d4c){for(var _0x5e6d96=0x0;_0x5e6d96<_0x329d4c['length'];_0x5e6d96++){_0x329d4c[_0x5e6d96][_0x2ab5('0x105')](_0x2ab5('0x99'),_0x2ab5('0x10e'));}return _0x329d4c;}));return BPromise[_0x2ab5('0xf0')](_0xac1e39);})['then'](function(_0x3ac581){var _0x3a06cf=_['flatten'](_0x3ac581);_0xac1e39=[];return db[_0x2ab5('0x57')][_0x2ab5('0x115')](function(_0x4a7809){for(var _0x3e8f86=0x0;_0x3e8f86<_0x3a06cf[_0x2ab5('0x4e')];_0x3e8f86++){_0xac1e39[_0x2ab5('0xa8')](_0x3a06cf[_0x3e8f86]['removeAgent'](_0x4868e2['id']),{'transaction':_0x4a7809});}return BPromise[_0x2ab5('0xf0')](_0xac1e39)[_0x2ab5('0x22')](function(){if(_0x4868e2[_0x2ab5('0x9a')]){return BPromise[_0x2ab5('0xad')](_['filter'](_0x3a06cf,function(_0x30e12d){return _0x30e12d[_0x2ab5('0x111')]('channel')==='Voice';}),function(_0x285b8e){return db[_0x2ab5('0xae')][_0x2ab5('0x37')]({'where':{'VoiceQueueId':_0x285b8e['id'],'UserId':_0x4868e2['id']},'transaction':_0x4a7809});});}else{return;}})['then'](function(){for(var _0x13617e=0x0;_0x13617e<_0x3a06cf[_0x2ab5('0x4e')];_0x13617e++){var _0x26562d=_0x3a06cf[_0x13617e][_0x2ab5('0x111')](_0x2ab5('0x99'));var _0x3770b2=_0x26562d+_0x2ab5('0xb0');socket[_0x2ab5('0xa4')](_0x2ab5('0x6b')+_0x26562d+'Queue:remove',{'UserId':_0x4868e2['id'],['queueField']:_0x3a06cf[_0x13617e]['id']});}});});});}});}})[_0x2ab5('0x22')](respondWithStatusCode(_0x4ceba3,null))[_0x2ab5('0x2c')](handleError(_0x4ceba3,null));};exports[_0x2ab5('0x116')]=function(_0x409b98,_0x5c43f1,_0x557424){var _0x3b86b4={};var _0x3e1ac6={};var _0x3cf785;var _0x8e0ced;return db['User']['findOne']({'where':{'id':_0x409b98[_0x2ab5('0x64')]['id']}})['then'](handleEntityNotFound(_0x5c43f1,null))['then'](function(_0x1eea94){if(_0x1eea94){_0x3cf785=_0x1eea94;_0x3e1ac6['model']=_['keys'](db[_0x2ab5('0xc1')][_0x2ab5('0xbf')]);_0x3e1ac6[_0x2ab5('0x4b')]=_['keys'](_0x409b98[_0x2ab5('0x4b')]);_0x3e1ac6[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x3e1ac6[_0x2ab5('0x46')],_0x3e1ac6[_0x2ab5('0x4b')]);_0x3b86b4[_0x2ab5('0x4c')]=_[_0x2ab5('0x4a')](_0x3e1ac6['model'],qs['fields'](_0x409b98[_0x2ab5('0x4b')][_0x2ab5('0x4d')]));_0x3b86b4[_0x2ab5('0x4c')]=_0x3b86b4[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x3b86b4['attributes']:_0x3e1ac6['model'];_0x3b86b4[_0x2ab5('0x4f')]=qs['sort'](_0x409b98[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x3b86b4[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x409b98[_0x2ab5('0x4b')],_0x3e1ac6[_0x2ab5('0x52')]));if(_0x409b98[_0x2ab5('0x4b')]['filter']){_0x3b86b4[_0x2ab5('0x53')]=_['merge'](_0x3b86b4[_0x2ab5('0x53')],{'$or':_['map'](_0x3b86b4['attributes'],function(_0x441149){var _0x5eb14b={};_0x5eb14b[_0x441149]={'$like':'%'+_0x409b98[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x5eb14b;})});}_0x3b86b4=_[_0x2ab5('0x54')]({},_0x3b86b4,_0x409b98[_0x2ab5('0x5b')]);return _0x3cf785[_0x2ab5('0x116')](_0x3b86b4);}})[_0x2ab5('0x22')](function(_0x5f5b75){if(_0x5f5b75){_0x8e0ced=_0x5f5b75['length'];if(!_0x409b98[_0x2ab5('0x4b')][_0x2ab5('0xc0')](_0x2ab5('0xc7'))){_0x3b86b4[_0x2ab5('0x32')]=qs[_0x2ab5('0x32')](_0x409b98[_0x2ab5('0x4b')][_0x2ab5('0x32')]);_0x3b86b4['offset']=qs[_0x2ab5('0x31')](_0x409b98[_0x2ab5('0x4b')]['offset']);}return _0x3cf785[_0x2ab5('0x116')](_0x3b86b4);}})[_0x2ab5('0x22')](function(_0x27138b){if(_0x27138b){return _0x27138b?{'count':_0x8e0ced,'rows':_0x27138b}:null;}})[_0x2ab5('0x22')](respondWithResult(_0x5c43f1,null))['catch'](handleError(_0x5c43f1,null));};exports[_0x2ab5('0x117')]=function(_0x4f4c3a,_0x229f5c,_0xd386f6){var _0x2fcbbb={};var _0x1e9259={};var _0x3ba1b7;var _0x4b25f5;return db[_0x2ab5('0x45')][_0x2ab5('0x91')]({'where':{'id':_0x4f4c3a[_0x2ab5('0x64')]['id']}})[_0x2ab5('0x22')](handleEntityNotFound(_0x229f5c,null))[_0x2ab5('0x22')](function(_0x367265){if(_0x367265){_0x3ba1b7=_0x367265;_0x1e9259[_0x2ab5('0x46')]=_['keys'](db[_0x2ab5('0x45')][_0x2ab5('0xbf')]);_0x1e9259['query']=_[_0x2ab5('0x48')](_0x4f4c3a[_0x2ab5('0x4b')]);_0x1e9259[_0x2ab5('0x52')]=_[_0x2ab5('0x4a')](_0x1e9259[_0x2ab5('0x46')],_0x1e9259[_0x2ab5('0x4b')]);_0x2fcbbb[_0x2ab5('0x4c')]=_[_0x2ab5('0x4a')](_0x1e9259[_0x2ab5('0x46')],qs[_0x2ab5('0x4d')](_0x4f4c3a[_0x2ab5('0x4b')][_0x2ab5('0x4d')]));_0x2fcbbb[_0x2ab5('0x4c')]=_0x2fcbbb[_0x2ab5('0x4c')][_0x2ab5('0x4e')]?_0x2fcbbb[_0x2ab5('0x4c')]:_0x1e9259['model'];_0x2fcbbb[_0x2ab5('0x4f')]=qs[_0x2ab5('0x50')](_0x4f4c3a[_0x2ab5('0x4b')][_0x2ab5('0x50')]);_0x2fcbbb[_0x2ab5('0x53')]=qs[_0x2ab5('0x52')](_[_0x2ab5('0x51')](_0x4f4c3a[_0x2ab5('0x4b')],_0x1e9259[_0x2ab5('0x52')]));if(_0x4f4c3a[_0x2ab5('0x4b')][_0x2ab5('0x3a')]){_0x2fcbbb[_0x2ab5('0x53')]=_[_0x2ab5('0x54')](_0x2fcbbb['where'],{'$or':_[_0x2ab5('0x3c')](_0x2fcbbb[_0x2ab5('0x4c')],function(_0x499961){var _0x45957f={};_0x45957f[_0x499961]={'$like':'%'+_0x4f4c3a[_0x2ab5('0x4b')][_0x2ab5('0x3a')]+'%'};return _0x45957f;})});}_0x2fcbbb['model']=db[_0x2ab5('0x45')];_0x2fcbbb['as']=_0x2ab5('0x118');_0x2fcbbb=_['merge']({},_0x2fcbbb,_0x4f4c3a[_0x2ab5('0x5b')]);return _0x3ba1b7[_0x2ab5('0x104')]({'include':[_0x2fcbbb]});}})[_0x2ab5('0x22')](function(_0x51ac36){if(_0x51ac36){var _0x2452b={},_0xa4f566=[],_0x3ae457=0x0;for(var _0x5bf88c=0x0;_0x5bf88c<_0x51ac36[_0x2ab5('0x4e')];_0x5bf88c+=0x1){for(var _0x6b932=0x0,_0x4d4e15;_0x6b932<_0x51ac36[_0x5bf88c][_0x2ab5('0x118')][_0x2ab5('0x4e')];_0x6b932+=0x1){_0x4d4e15=_0x51ac36[_0x5bf88c][_0x2ab5('0x118')][_0x6b932][_0x2ab5('0x89')]({'plain':!![]});_0x2452b[_0x4d4e15['id']]=_0x4d4e15;}}_0x2452b=_[_0x2ab5('0x119')](_0x2452b);for(var _0x133c80=qs[_0x2ab5('0x31')](_0x4f4c3a['query']['offset']);_0x133c80<_0x2452b[_0x2ab5('0x4e')]&&_0xa4f566[_0x2ab5('0x4e')]=_0x62e6f1[_0x7b94('0x4f')]){throw new Error(_0x7b94('0x50'));}})['then'](function(){if(_0x271752){return db[_0x7b94('0x39')]['destroy']({'where':{'membername':_0x271752[_0x7b94('0x27')]},'individualHooks':!![]});}})[_0x7b94('0xf')](function(){if(_0x271752){return _0x271752[_0x7b94('0x51')]({'raw':!![]});}})[_0x7b94('0xf')](function(_0x4aaae4){if(_0x271752){if(_0x4aaae4){var _0x2ddc2f=[];_0x4f5ae4=_0x4aaae4;if(_0x4f5ae4[_0x7b94('0x2d')]){for(var _0x2529e5=0x0;_0x2529e5<_0x4f5ae4[_0x7b94('0x2d')];_0x2529e5++){_0x2ddc2f[_0x7b94('0x43')](db['UserVoiceQueueRt']['upsert']({'membername':_0x271752[_0x7b94('0x27')],'UserId':_0x271752['id'],'queue_name':_0x4f5ae4[_0x2529e5][_0x7b94('0x27')],'VoiceQueueId':_0x4f5ae4[_0x2529e5]['id'],'interface':_0x5ef012,'paused':_0x271752['loginInPause']||![],'penalty':_0x4f5ae4[_0x2529e5]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x7b94('0x46')](_0x2ddc2f);}}}})[_0x7b94('0xf')](function(){if(_0x271752){return db[_0x7b94('0x2b')][_0x7b94('0x1c')]({'where':{'membername':_0x271752[_0x7b94('0x27')],'exitAt':null}});}})[_0x7b94('0xf')](function(_0x1285bb){if(_0x271752){if(_0x1285bb&&_0x1285bb['length']){var _0x26558e=[];_0x1285bb[_0x7b94('0x42')](function(_0x143a85){_0x26558e['push'](_0x143a85[_0x7b94('0x33')]({'exitAt':moment()[_0x7b94('0x34')](_0x7b94('0x2e'))}));});return BPromise[_0x7b94('0x46')](_0x26558e);}}})[_0x7b94('0xf')](function(_0x1b5fd9){if(_0x271752){var _0xa71776=[];var _0x369196=[];var _0x3cda35=utils[_0x7b94('0x52')]();var _0x42b102={'membername':_0x271752['name'],'interface':_0x5ef012,'enterAt':moment()[_0x7b94('0x34')](_0x7b94('0x2e')),'role':_0x271752[_0x7b94('0x28')],'internal':_0x271752['internal']};_0x3cda35[_0x7b94('0x42')](function(_0x158649){_0xa71776[_0x7b94('0x43')](_['merge']({'channel':_0x158649,'type':'LOGIN','data1':_0x7b94('0x53'),'data2':_0x5ef012},_0x42b102));if(_0x271752[_0x7b94('0x4a')]){_0x369196['push'](_[_0x7b94('0x54')]({'channel':_0x158649,'type':_0x7b94('0x2c'),'data1':_0x7b94('0x55')},_0x42b102));}});return db[_0x7b94('0x2b')][_0x7b94('0x56')](_0xa71776[_0x7b94('0x57')](_0x369196),{'individualHooks':!![]});}})[_0x7b94('0xf')](function(){if(_0x271752){return _0x271752[_0x7b94('0x33')]({'online':!![],'lastLoginAt':moment()[_0x7b94('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x271752['loginInPause']||![],'mailPause':_0x271752['loginInPause']||![],'chatPause':_0x271752[_0x7b94('0x4a')]||![],'faxPause':_0x271752['loginInPause']||![],'smsPause':_0x271752[_0x7b94('0x4a')]||![],'openchannelPause':_0x271752[_0x7b94('0x4a')]||![],'pauseType':_0x271752['loginInPause']?_0x7b94('0x55'):null,'lastPauseAt':moment()[_0x7b94('0x34')](_0x7b94('0x2e')),'interface':_0x5ef012});}})[_0x7b94('0xf')](function(_0x5c2b04){_0xea2511(_0x5c2b04);})[_0x7b94('0x19')](function(_0x4032c5){_0x3c5f1a(_0x50bd0f[_0x7b94('0x16')](0x1f4,_0x4032c5[_0x7b94('0x18')]));});});}; \ No newline at end of file +var _0x498d=['options','raw','where','limit','map','include','model','attributes','then','ShowUser','User','find','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','voice','system','mail','chat','fax','sms','openchannel','set','%s%s','Pause','findAll','forEach','all','LogoutUser','LoginUser','mobile','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','UserVoiceQueue.penalty','getChannels','LOGIN','callysquare','merge','LOGININPAUSE','concat','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','User,\x20%s,\x20%s','result','catch','GetUser'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x498d,0xfe));var _0xd498=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x498d[_0x1bc0ae];return _0x501104;};'use strict';var _=require(_0xd498('0x0'));var util=require('util');var moment=require(_0xd498('0x1'));var BPromise=require('bluebird');var rs=require(_0xd498('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd498('0x3'))['db'];var utils=require(_0xd498('0x4'));var logger=require(_0xd498('0x5'))(_0xd498('0x6'));var config=require(_0xd498('0x7'));var jayson=require(_0xd498('0x8'));var client=jayson['client'][_0xd498('0x9')]({'port':0x232a});config[_0xd498('0xa')]=_[_0xd498('0xb')](config[_0xd498('0xa')],{'host':_0xd498('0xc'),'port':0x18eb});var socket=require(_0xd498('0xd'))(new Redis(config[_0xd498('0xa')]));require(_0xd498('0xe'))[_0xd498('0xf')](socket);function respondWithRpcPromise(_0x51174b,_0x3cd697,_0x44232a){return new BPromise(function(_0x3a6be4,_0x15636e){return client['request'](_0x51174b,_0x44232a)['then'](function(_0x3dc810){logger[_0xd498('0x10')]('User,\x20%s,\x20%s',_0x3cd697,_0xd498('0x11'));logger[_0xd498('0x12')](_0xd498('0x13'),_0x3cd697,_0xd498('0x11'),JSON[_0xd498('0x14')](_0x3dc810));if(_0x3dc810[_0xd498('0x15')]){if(_0x3dc810[_0xd498('0x15')][_0xd498('0x16')]===0x1f4){logger[_0xd498('0x15')]('User,\x20%s,\x20%s',_0x3cd697,_0x3dc810['error']['message']);return _0x15636e(_0x3dc810[_0xd498('0x15')][_0xd498('0x17')]);}logger['error']('User,\x20%s,\x20%s',_0x3cd697,_0x3dc810[_0xd498('0x15')][_0xd498('0x17')]);return _0x3a6be4(_0x3dc810['error'][_0xd498('0x17')]);}else{logger[_0xd498('0x10')](_0xd498('0x18'),_0x3cd697,_0xd498('0x11'));_0x3a6be4(_0x3dc810[_0xd498('0x19')]['message']);}})[_0xd498('0x1a')](function(_0x4438f4){logger[_0xd498('0x15')](_0xd498('0x18'),_0x3cd697,_0x4438f4);_0x15636e(_0x4438f4);});});}exports[_0xd498('0x1b')]=function(_0x1bb7d3){var _0x5bd295=this;return new Promise(function(_0x119070,_0x47c4fc){return db['User']['findAll']({'raw':_0x1bb7d3[_0xd498('0x1c')]?_0x1bb7d3[_0xd498('0x1c')][_0xd498('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bb7d3[_0xd498('0x1c')]?_0x1bb7d3[_0xd498('0x1c')][_0xd498('0x1e')]||null:null,'attributes':_0x1bb7d3[_0xd498('0x1c')]?_0x1bb7d3[_0xd498('0x1c')]['attributes']||null:null,'limit':_0x1bb7d3['options']?_0x1bb7d3[_0xd498('0x1c')][_0xd498('0x1f')]||null:null,'include':_0x1bb7d3[_0xd498('0x1c')]?_0x1bb7d3[_0xd498('0x1c')]['include']?_[_0xd498('0x20')](_0x1bb7d3['options'][_0xd498('0x21')],function(_0x1746b2){return{'model':db[_0x1746b2[_0xd498('0x22')]],'as':_0x1746b2['as'],'attributes':_0x1746b2[_0xd498('0x23')],'include':_0x1746b2[_0xd498('0x21')]?_['map'](_0x1746b2[_0xd498('0x21')],function(_0x425096){return{'model':db[_0x425096[_0xd498('0x22')]],'as':_0x425096['as'],'attributes':_0x425096[_0xd498('0x23')],'include':_0x425096[_0xd498('0x21')]?_[_0xd498('0x20')](_0x425096['include'],function(_0x13345d){return{'model':db[_0x13345d[_0xd498('0x22')]],'as':_0x13345d['as'],'attributes':_0x13345d[_0xd498('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd498('0x24')](function(_0x37c813){logger[_0xd498('0x10')](_0xd498('0x1b'),_0x1bb7d3);logger[_0xd498('0x12')](_0xd498('0x1b'),_0x1bb7d3,JSON[_0xd498('0x14')](_0x37c813));_0x119070(_0x37c813);})[_0xd498('0x1a')](function(_0x4d4a0b){logger[_0xd498('0x15')](_0xd498('0x1b'),_0x4d4a0b[_0xd498('0x17')],_0x1bb7d3);_0x47c4fc(_0x5bd295[_0xd498('0x15')](0x1f4,_0x4d4a0b[_0xd498('0x17')]));});});};exports[_0xd498('0x25')]=function(_0x3d8757){var _0x41d203=this;return new Promise(function(_0x51888f,_0x2ea309){return db[_0xd498('0x26')][_0xd498('0x27')]({'raw':_0x3d8757[_0xd498('0x1c')]?_0x3d8757[_0xd498('0x1c')][_0xd498('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d8757['options']?_0x3d8757[_0xd498('0x1c')][_0xd498('0x1e')]||null:null,'attributes':_0x3d8757['options']?_0x3d8757[_0xd498('0x1c')]['attributes']||null:null,'include':_0x3d8757[_0xd498('0x1c')]?_0x3d8757[_0xd498('0x1c')][_0xd498('0x21')]?_[_0xd498('0x20')](_0x3d8757[_0xd498('0x1c')]['include'],function(_0x34d2a6){return{'model':db[_0x34d2a6[_0xd498('0x22')]],'as':_0x34d2a6['as'],'attributes':_0x34d2a6[_0xd498('0x23')],'include':_0x34d2a6['include']?_[_0xd498('0x20')](_0x34d2a6['include'],function(_0x5da6b6){return{'model':db[_0x5da6b6[_0xd498('0x22')]],'as':_0x5da6b6['as'],'attributes':_0x5da6b6['attributes'],'include':_0x5da6b6[_0xd498('0x21')]?_['map'](_0x5da6b6['include'],function(_0x59e945){return{'model':db[_0x59e945[_0xd498('0x22')]],'as':_0x59e945['as'],'attributes':_0x59e945[_0xd498('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x439067){logger[_0xd498('0x10')](_0xd498('0x25'),_0x3d8757);logger[_0xd498('0x12')]('ShowUser',_0x3d8757,JSON[_0xd498('0x14')](_0x439067));_0x51888f(_0x439067);})[_0xd498('0x1a')](function(_0x48c3ad){logger[_0xd498('0x15')](_0xd498('0x25'),_0x48c3ad['message'],_0x3d8757);_0x2ea309(_0x41d203[_0xd498('0x15')](0x1f4,_0x48c3ad[_0xd498('0x17')]));});});};exports[_0xd498('0x28')]=function(_0x409730){var _0xab1e39=this;return new Promise(function(_0xbd0d7c,_0x87cc4){var _0x4cd721;return db[_0xd498('0x26')]['find']({'where':_0x409730[_0xd498('0x1c')][_0xd498('0x1e')]||{},'attributes':['id',_0xd498('0x29'),_0xd498('0x2a'),_0xd498('0x2b'),_0xd498('0x2c')]})[_0xd498('0x24')](function(_0x3da8a4){if(_0x3da8a4){_0x4cd721=_0x3da8a4;return db[_0xd498('0x2d')][_0xd498('0x2e')]({'paused':0x1},{'where':{'UserId':_0x4cd721['id']},'individualHooks':!![]});}})[_0xd498('0x24')](function(){if(_0x4cd721){return db[_0xd498('0x2f')]['findAll']({'where':{'membername':_0x4cd721[_0xd498('0x29')],'type':_0xd498('0x30'),'exitAt':null}});}})[_0xd498('0x24')](function(_0x2661c9){if(_0x4cd721){if(_0x2661c9&&_0x2661c9[_0xd498('0x31')]){var _0x26f6f5=moment()[_0xd498('0x32')](_0xd498('0x33'));for(var _0x205389=0x0,_0x4dd5d5=_0x2661c9[_0xd498('0x31')];_0x205389<_0x4dd5d5;_0x205389++){_0x2661c9[_0x205389][_0xd498('0x34')]({'exitAt':_0x26f6f5});}}}})[_0xd498('0x24')](function(){if(_0x4cd721){var _0x1e97b0=[];var _0x54fd95=utils['getChannels']();_0x54fd95['forEach'](function(_0x3e6d6a){_0x1e97b0[_0xd498('0x35')]({'channel':_0x3e6d6a,'membername':_0x4cd721['name'],'interface':_[_0xd498('0x36')](_0x4cd721['interface'])?util['format'](_0xd498('0x37'),_0x4cd721[_0xd498('0x29')]):_0x4cd721['interface'],'type':_0xd498('0x30'),'enterAt':moment()[_0xd498('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x409730[_0xd498('0x38')][_0xd498('0x39')]||_0xd498('0x3a'),'role':_0x4cd721[_0xd498('0x2a')],'internal':_0x4cd721['internal'],'uniqueid':_0x409730[_0xd498('0x38')]['uniqueid']||null});});return db[_0xd498('0x2f')][_0xd498('0x3b')](_0x1e97b0,{'individualHooks':!![]});}})[_0xd498('0x24')](function(){if(_0x4cd721){return _0x4cd721[_0xd498('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x409730[_0xd498('0x38')][_0xd498('0x39')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd498('0x32')](_0xd498('0x33'))});}})[_0xd498('0x24')](function(_0x23d447){_0xbd0d7c(_0x23d447);})[_0xd498('0x1a')](function(_0x5a49e9){_0x87cc4(_0xab1e39['error'](0x1f4,_0x5a49e9[_0xd498('0x17')]));});});};exports[_0xd498('0x3c')]=function(_0x29d89f){var _0x4650d8=this;return new Promise(function(_0x5018dd,_0x543314){var _0x1c8d8a;return db[_0xd498('0x26')][_0xd498('0x3d')]({'where':_0x29d89f[_0xd498('0x1c')]['where']||{},'attributes':['id',_0xd498('0x29')]})[_0xd498('0x24')](function(_0xe1cbc8){if(_0xe1cbc8){_0x1c8d8a=_0xe1cbc8;if(_0x29d89f[_0xd498('0x38')][_0xd498('0x3e')]&&!utils[_0xd498('0x3f')](_0x29d89f[_0xd498('0x38')][_0xd498('0x3e')])){throw new Error('Unknown\x20channel');}switch(_0x29d89f['body'][_0xd498('0x3e')]){case _0xd498('0x40'):return db[_0xd498('0x2d')][_0xd498('0x2e')]({'paused':0x0},{'where':{'UserId':_0x1c8d8a['id']}})[_0xd498('0x24')](function(){return db['MemberReport'][_0xd498('0x27')]({'where':{'channel':_0x29d89f[_0xd498('0x38')][_0xd498('0x3e')],'membername':_0x1c8d8a['name'],'type':_0xd498('0x30'),'exitAt':null}});})[_0xd498('0x24')](function(_0x2477fc){if(_0x2477fc){return _0x2477fc[_0xd498('0x2e')]({'exitAt':moment()[_0xd498('0x32')](_0xd498('0x33')),'data2':_0xd498('0x41')},{'individualHooks':!![]});}return null;})[_0xd498('0x24')](function(){return _0x1c8d8a['update']({'voicePause':![]});});case _0xd498('0x42'):case _0xd498('0x43'):case _0xd498('0x44'):case _0xd498('0x45'):case _0xd498('0x46'):return db[_0xd498('0x2f')]['find']({'where':{'channel':_0x29d89f[_0xd498('0x38')]['channel'],'membername':_0x1c8d8a['name'],'type':_0xd498('0x30'),'exitAt':null}})[_0xd498('0x24')](function(_0x371209){return _0x371209[_0xd498('0x2e')]({'exitAt':moment()[_0xd498('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd498('0x41')},{'individualHooks':!![]});})['then'](function(){var _0x4ab42a={};_[_0xd498('0x47')](_0x4ab42a,util[_0xd498('0x32')](_0xd498('0x48'),_0x29d89f[_0xd498('0x38')]['channel'],_0xd498('0x49')),![]);return _0x1c8d8a[_0xd498('0x2e')](_0x4ab42a);});default:return db[_0xd498('0x2d')][_0xd498('0x2e')]({'paused':0x0},{'where':{'UserId':_0x1c8d8a['id']}})[_0xd498('0x24')](function(){return db[_0xd498('0x2f')][_0xd498('0x4a')]({'where':{'membername':_0x1c8d8a[_0xd498('0x29')],'type':'PAUSE','exitAt':null}});})[_0xd498('0x24')](function(_0x23c097){var _0x590ec0=[];_0x23c097[_0xd498('0x4b')](function(_0xe86983){_0x590ec0[_0xd498('0x35')](_0xe86983[_0xd498('0x2e')]({'exitAt':moment()[_0xd498('0x32')](_0xd498('0x33')),'data2':_0xd498('0x41')}));});return BPromise[_0xd498('0x4c')](_0x590ec0);})[_0xd498('0x24')](function(){return _0x1c8d8a[_0xd498('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xd498('0x24')](function(_0x1edb92){_0x5018dd(_0x1edb92);})[_0xd498('0x1a')](function(_0x25fd0c){_0x543314(_0x4650d8['error'](0x1f4,_0x25fd0c['message']));});});};exports[_0xd498('0x4d')]=function(_0x151748){var _0x154479=this;return new Promise(function(_0x4d8a82,_0x6ec3){var _0x1a1258;return db['User'][_0xd498('0x3d')]({'where':_0x151748['options'][_0xd498('0x1e')]||{},'attributes':['id',_0xd498('0x29')]})[_0xd498('0x24')](function(_0x38839b){if(_0x38839b){_0x1a1258=_0x38839b;return db[_0xd498('0x2d')]['destroy']({'where':{'membername':_0x1a1258['name']},'individualHooks':!![]});}})['then'](function(){if(_0x1a1258){return db[_0xd498('0x2f')][_0xd498('0x4a')]({'where':{'membername':_0x1a1258[_0xd498('0x29')],'exitAt':null}});}})[_0xd498('0x24')](function(_0x201083){if(_0x1a1258){if(_0x201083&&_0x201083[_0xd498('0x31')]){var _0x51ce3b=[];_0x201083[_0xd498('0x4b')](function(_0xd75c71){_0x51ce3b[_0xd498('0x35')](_0xd75c71['update']({'exitAt':moment()[_0xd498('0x32')](_0xd498('0x33'))}));});return BPromise[_0xd498('0x4c')](_0x51ce3b);}}})[_0xd498('0x24')](function(){if(_0x1a1258){return _0x1a1258[_0xd498('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd498('0x24')](function(_0x43551c){_0x4d8a82(_0x43551c);})[_0xd498('0x1a')](function(_0x5ba60a){_0x6ec3(_0x154479[_0xd498('0x15')](0x1f4,_0x5ba60a[_0xd498('0x17')]));});});};exports[_0xd498('0x4e')]=function(_0x423682){var _0x108687=this;return new Promise(function(_0x4f2f2f,_0xe8facc){var _0x598351;var _0x4b03a6;var _0xe34932;var _0x32cfd2;return db[_0xd498('0x26')][_0xd498('0x3d')]({'where':_0x423682[_0xd498('0x1c')][_0xd498('0x1e')]||{},'attributes':['id',_0xd498('0x29'),'role',_0xd498('0x4f'),'phone',_0xd498('0x2b'),_0xd498('0x50'),_0xd498('0x2c')]})[_0xd498('0x24')](function(_0x23f13e){if(_0x23f13e){_0x598351=_0x23f13e;_0x32cfd2=_0x423682[_0xd498('0x38')][_0xd498('0x2c')]?_0x423682['body']['interface']:util[_0xd498('0x32')](_0xd498('0x37'),_0x598351[_0xd498('0x29')]);return db[_0xd498('0x26')][_0xd498('0x51')]({'where':{'role':_0xd498('0x52'),'online':!![],'id':{'$ne':_0x598351['id']}}});}})[_0xd498('0x24')](function(_0xc88b50){if(_0xc88b50){_0xe34932=_0xc88b50;return require('../../config/license/util')[_0xd498('0x53')]();}})[_0xd498('0x24')](function(_0x46ade3){if(_0x46ade3&&_0x46ade3[_0xd498('0x54')]&&_0xe34932>=_0x46ade3[_0xd498('0x54')]){throw new Error(_0xd498('0x55'));}})['then'](function(){if(_0x598351){return db[_0xd498('0x2d')]['destroy']({'where':{'membername':_0x598351['name']},'individualHooks':!![]});}})['then'](function(){if(_0x598351){return _0x598351[_0xd498('0x56')]({'raw':!![]});}})[_0xd498('0x24')](function(_0x5c60bf){if(_0x598351){if(_0x5c60bf){var _0x427ac3=[];_0x4b03a6=_0x5c60bf;if(_0x4b03a6['length']){for(var _0x431a3e=0x0;_0x431a3e<_0x4b03a6['length'];_0x431a3e++){_0x427ac3[_0xd498('0x35')](db[_0xd498('0x2d')]['upsert']({'membername':_0x598351[_0xd498('0x29')],'UserId':_0x598351['id'],'queue_name':_0x4b03a6[_0x431a3e][_0xd498('0x29')],'VoiceQueueId':_0x4b03a6[_0x431a3e]['id'],'interface':_0x32cfd2,'paused':_0x598351[_0xd498('0x50')]||![],'penalty':_0x4b03a6[_0x431a3e][_0xd498('0x57')]||0x0}));}return BPromise[_0xd498('0x4c')](_0x427ac3);}}}})[_0xd498('0x24')](function(){if(_0x598351){return db[_0xd498('0x2f')][_0xd498('0x4a')]({'where':{'membername':_0x598351[_0xd498('0x29')],'exitAt':null}});}})[_0xd498('0x24')](function(_0x539128){if(_0x598351){if(_0x539128&&_0x539128[_0xd498('0x31')]){var _0x418ec4=[];_0x539128[_0xd498('0x4b')](function(_0x4ca1f6){_0x418ec4['push'](_0x4ca1f6[_0xd498('0x2e')]({'exitAt':moment()[_0xd498('0x32')](_0xd498('0x33'))}));});return BPromise[_0xd498('0x4c')](_0x418ec4);}}})[_0xd498('0x24')](function(_0x2c14a6){if(_0x598351){var _0x5976e3=[];var _0x205380=[];var _0x40c72b=utils[_0xd498('0x58')]();var _0x580dc2={'membername':_0x598351['name'],'interface':_0x32cfd2,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x598351[_0xd498('0x2a')],'internal':_0x598351['internal']};_0x40c72b[_0xd498('0x4b')](function(_0x2263de){_0x5976e3[_0xd498('0x35')](_['merge']({'channel':_0x2263de,'type':_0xd498('0x59'),'data1':_0xd498('0x5a'),'data2':_0x32cfd2},_0x580dc2));if(_0x598351[_0xd498('0x50')]){_0x205380[_0xd498('0x35')](_[_0xd498('0x5b')]({'channel':_0x2263de,'type':_0xd498('0x30'),'data1':_0xd498('0x5c')},_0x580dc2));}});return db[_0xd498('0x2f')][_0xd498('0x3b')](_0x5976e3[_0xd498('0x5d')](_0x205380),{'individualHooks':!![]});}})[_0xd498('0x24')](function(){if(_0x598351){return _0x598351[_0xd498('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xd498('0x32')](_0xd498('0x33')),'voicePause':_0x598351['loginInPause']||![],'mailPause':_0x598351[_0xd498('0x50')]||![],'chatPause':_0x598351[_0xd498('0x50')]||![],'faxPause':_0x598351[_0xd498('0x50')]||![],'smsPause':_0x598351[_0xd498('0x50')]||![],'openchannelPause':_0x598351['loginInPause']||![],'pauseType':_0x598351[_0xd498('0x50')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xd498('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x32cfd2});}})['then'](function(_0x59f0b4){_0x4f2f2f(_0x59f0b4);})[_0xd498('0x1a')](function(_0x2bb42b){_0xe8facc(_0x108687['error'](0x1f4,_0x2bb42b[_0xd498('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index befe7c5..00a3a9a 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 _0x9625=['emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x9625,0x1bd));var _0x5962=function(_0x2b123f,_0x4e39b0){_0x2b123f=_0x2b123f-0x0;var _0x37e6d9=_0x9625[_0x2b123f];return _0x37e6d9;};'use strict';var UserEvents=require(_0x5962('0x0'));var events=[_0x5962('0x1'),_0x5962('0x2'),'update'];function createListener(_0x3b4f50,_0x5c48d6){return function(_0x4a25d5){_0x5c48d6[_0x5962('0x3')](_0x3b4f50,_0x4a25d5);};}function removeListener(_0x434994,_0x120acf){return function(){UserEvents[_0x5962('0x4')](_0x434994,_0x120acf);};}exports[_0x5962('0x5')]=function(_0xf0fa94){for(var _0x3d69ec=0x0,_0x4e740b=events[_0x5962('0x6')];_0x3d69ec<_0x4e740b;_0x3d69ec++){var _0x11f857=events[_0x3d69ec];var _0x4f46cb=createListener(_0x5962('0x7')+_0x11f857,_0xf0fa94);UserEvents['on'](_0x11f857,_0x4f46cb);}}; \ No newline at end of file +var _0x2002=['update','removeListener','register','length','./user.events','save'];(function(_0x4537c8,_0x503f54){var _0xee5519=function(_0x648f7a){while(--_0x648f7a){_0x4537c8['push'](_0x4537c8['shift']());}};_0xee5519(++_0x503f54);}(_0x2002,0x14e));var _0x2200=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x2002[_0x2d1971];return _0x4d7759;};'use strict';var UserEvents=require(_0x2200('0x0'));var events=[_0x2200('0x1'),'remove',_0x2200('0x2')];function createListener(_0x1cffc0,_0x17b9e9){return function(_0x4235ca){_0x17b9e9['emit'](_0x1cffc0,_0x4235ca);};}function removeListener(_0x13a1cd,_0x18555a){return function(){UserEvents[_0x2200('0x3')](_0x13a1cd,_0x18555a);};}exports[_0x2200('0x4')]=function(_0x5c4166){for(var _0x5e8c19=0x0,_0x1c477b=events[_0x2200('0x5')];_0x5e8c19<_0x1c477b;_0x5e8c19++){var _0x7415ff=events[_0x5e8c19];var _0x393b4f=createListener('user:'+_0x7415ff,_0x5c4166);UserEvents['on'](_0x7415ff,_0x393b4f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 65563ac..af6a47c 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 _0xa2ec=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','multer','util'];(function(_0x3cb465,_0x36d920){var _0x4e197b=function(_0x25fd7d){while(--_0x25fd7d){_0x3cb465['push'](_0x3cb465['shift']());}};_0x4e197b(++_0x36d920);}(_0xa2ec,0x100));var _0xca2e=function(_0x4668a6,_0x4e8a1f){_0x4668a6=_0x4668a6-0x0;var _0x23215d=_0xa2ec[_0x4668a6];return _0x23215d;};'use strict';var multer=require(_0xca2e('0x0'));var util=require(_0xca2e('0x1'));var path=require('path');var timeout=require(_0xca2e('0x2'));var express=require(_0xca2e('0x3'));var router=express['Router']();var auth=require(_0xca2e('0x4'));var interaction=require(_0xca2e('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x0057=['util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x71f449,_0x112c30){var _0x114ed5=function(_0x16486d){while(--_0x16486d){_0x71f449['push'](_0x71f449['shift']());}};_0x114ed5(++_0x112c30);}(_0x0057,0xb4));var _0x7005=function(_0x1ee3fc,_0x2cafd5){_0x1ee3fc=_0x1ee3fc-0x0;var _0x192369=_0x0057[_0x1ee3fc];return _0x192369;};'use strict';var multer=require('multer');var util=require(_0x7005('0x0'));var path=require(_0x7005('0x1'));var timeout=require('connect-timeout');var express=require(_0x7005('0x2'));var router=express[_0x7005('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7005('0x4'));var config=require(_0x7005('0x5'));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 3b972ac..7de51c9 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 _0xd8b0=['exports','sequelize'];(function(_0x9d2bb2,_0x1dde47){var _0x58d2cc=function(_0x5d09c5){while(--_0x5d09c5){_0x9d2bb2['push'](_0x9d2bb2['shift']());}};_0x58d2cc(++_0x1dde47);}(_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(_0x508767,_0x369e53){var _0x2480fe=function(_0x25957e){while(--_0x25957e){_0x508767['push'](_0x508767['shift']());}};_0x2480fe(++_0x369e53);}(_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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 607e87e..7478ae0 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 _0xd1f4=['util','moment','bluebird','path','./userChatQueue.attributes','exports','define','user_has_chat_queues'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0xd1f4,0xa8));var _0x4d1f=function(_0x417f5e,_0x451ee2){_0x417f5e=_0x417f5e-0x0;var _0x5e017c=_0xd1f4[_0x417f5e];return _0x5e017c;};'use strict';var _=require('lodash');var util=require(_0x4d1f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4d1f('0x1'));var BPromise=require(_0x4d1f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d1f('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4d1f('0x4'));module[_0x4d1f('0x5')]=function(_0x54b221,_0x1336af){return _0x54b221[_0x4d1f('0x6')]('UserChatQueue',attributes,{'tableName':_0x4d1f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e22=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','user_has_chat_queues','lodash'];(function(_0x1937c8,_0x5a1f28){var _0x48bedf=function(_0x8961e1){while(--_0x8961e1){_0x1937c8['push'](_0x1937c8['shift']());}};_0x48bedf(++_0x5a1f28);}(_0x7e22,0x1d8));var _0x27e2=function(_0x245aaf,_0x1f577d){_0x245aaf=_0x245aaf-0x0;var _0x23bdd4=_0x7e22[_0x245aaf];return _0x23bdd4;};'use strict';var _=require(_0x27e2('0x0'));var util=require('util');var logger=require(_0x27e2('0x1'))(_0x27e2('0x2'));var moment=require(_0x27e2('0x3'));var BPromise=require(_0x27e2('0x4'));var rp=require(_0x27e2('0x5'));var fs=require('fs');var path=require(_0x27e2('0x6'));var rimraf=require('rimraf');var config=require(_0x27e2('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x27e2('0x8')]=function(_0x350996,_0x3eb3cd){return _0x350996[_0x27e2('0x9')]('UserChatQueue',attributes,{'tableName':_0x27e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index d9c4edd..8bcae77 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 _0x0bdf=['http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3abce8,_0x33b988){var _0x4059b5=function(_0x363b84){while(--_0x363b84){_0x3abce8['push'](_0x3abce8['shift']());}};_0x4059b5(++_0x33b988);}(_0x0bdf,0x8a));var _0xf0bd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0bdf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf0bd('0x0'));var util=require(_0xf0bd('0x1'));var moment=require(_0xf0bd('0x2'));var BPromise=require(_0xf0bd('0x3'));var rs=require(_0xf0bd('0x4'));var fs=require('fs');var Redis=require(_0xf0bd('0x5'));var db=require(_0xf0bd('0x6'))['db'];var utils=require(_0xf0bd('0x7'));var logger=require('../../config/logger')(_0xf0bd('0x8'));var config=require(_0xf0bd('0x9'));var jayson=require(_0xf0bd('0xa'));var client=jayson[_0xf0bd('0xb')][_0xf0bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c98d5,_0x17763c,_0x418548){return new BPromise(function(_0x5761d3,_0x266cf6){return client[_0xf0bd('0xd')](_0x4c98d5,_0x418548)[_0xf0bd('0xe')](function(_0x450c2b){logger[_0xf0bd('0xf')](_0xf0bd('0x10'),_0x17763c,_0xf0bd('0x11'));logger[_0xf0bd('0x12')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x17763c,_0xf0bd('0x11'),JSON[_0xf0bd('0x13')](_0x450c2b));if(_0x450c2b[_0xf0bd('0x14')]){if(_0x450c2b[_0xf0bd('0x14')][_0xf0bd('0x15')]===0x1f4){logger[_0xf0bd('0x14')](_0xf0bd('0x10'),_0x17763c,_0x450c2b['error']['message']);return _0x266cf6(_0x450c2b['error'][_0xf0bd('0x16')]);}logger[_0xf0bd('0x14')](_0xf0bd('0x10'),_0x17763c,_0x450c2b['error'][_0xf0bd('0x16')]);return _0x5761d3(_0x450c2b['error']['message']);}else{logger['info'](_0xf0bd('0x10'),_0x17763c,'request\x20sent');_0x5761d3(_0x450c2b[_0xf0bd('0x17')]['message']);}})[_0xf0bd('0x18')](function(_0x4ee40e){logger[_0xf0bd('0x14')](_0xf0bd('0x10'),_0x17763c,_0x4ee40e);_0x266cf6(_0x4ee40e);});});} \ No newline at end of file +var _0x77ff=['stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3095a6,_0x1362cc){var _0x384e1a=function(_0x580023){while(--_0x580023){_0x3095a6['push'](_0x3095a6['shift']());}};_0x384e1a(++_0x1362cc);}(_0x77ff,0x1e7));var _0xf77f=function(_0x462c5d,_0x128b64){_0x462c5d=_0x462c5d-0x0;var _0x1282c8=_0x77ff[_0x462c5d];return _0x1282c8;};'use strict';var _=require('lodash');var util=require(_0xf77f('0x0'));var moment=require(_0xf77f('0x1'));var BPromise=require(_0xf77f('0x2'));var rs=require(_0xf77f('0x3'));var fs=require('fs');var Redis=require(_0xf77f('0x4'));var db=require(_0xf77f('0x5'))['db'];var utils=require(_0xf77f('0x6'));var logger=require(_0xf77f('0x7'))(_0xf77f('0x8'));var config=require(_0xf77f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf77f('0xa')][_0xf77f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25382f,_0x32327a,_0x40e656){return new BPromise(function(_0x373bf8,_0x18719f){return client[_0xf77f('0xc')](_0x25382f,_0x40e656)['then'](function(_0x360770){logger[_0xf77f('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x32327a,'request\x20sent');logger[_0xf77f('0xe')](_0xf77f('0xf'),_0x32327a,_0xf77f('0x10'),JSON[_0xf77f('0x11')](_0x360770));if(_0x360770[_0xf77f('0x12')]){if(_0x360770[_0xf77f('0x12')][_0xf77f('0x13')]===0x1f4){logger[_0xf77f('0x12')](_0xf77f('0x14'),_0x32327a,_0x360770[_0xf77f('0x12')]['message']);return _0x18719f(_0x360770[_0xf77f('0x12')][_0xf77f('0x15')]);}logger[_0xf77f('0x12')](_0xf77f('0x14'),_0x32327a,_0x360770['error'][_0xf77f('0x15')]);return _0x373bf8(_0x360770[_0xf77f('0x12')][_0xf77f('0x15')]);}else{logger[_0xf77f('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x32327a,'request\x20sent');_0x373bf8(_0x360770[_0xf77f('0x16')]['message']);}})[_0xf77f('0x17')](function(_0x45a017){logger[_0xf77f('0x12')](_0xf77f('0x14'),_0x32327a,_0x45a017);_0x18719f(_0x45a017);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 50937d6..9d0e51e 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 _0x3fc4=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x52e219,_0x1ef2f2){var _0x2c87dd=function(_0xc11b8c){while(--_0xc11b8c){_0x52e219['push'](_0x52e219['shift']());}};_0x2c87dd(++_0x1ef2f2);}(_0x3fc4,0x183));var _0x43fc=function(_0x5e9fb1,_0x435c52){_0x5e9fb1=_0x5e9fb1-0x0;var _0x2e7c8c=_0x3fc4[_0x5e9fb1];return _0x2e7c8c;};'use strict';var multer=require(_0x43fc('0x0'));var util=require(_0x43fc('0x1'));var path=require(_0x43fc('0x2'));var timeout=require(_0x43fc('0x3'));var express=require(_0x43fc('0x4'));var router=express[_0x43fc('0x5')]();var auth=require(_0x43fc('0x6'));var interaction=require(_0x43fc('0x7'));var config=require(_0x43fc('0x8'));module['exports']=router; \ No newline at end of file +var _0x5c50=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x57eb05,_0x1587c2){var _0x1e6488=function(_0x7485fa){while(--_0x7485fa){_0x57eb05['push'](_0x57eb05['shift']());}};_0x1e6488(++_0x1587c2);}(_0x5c50,0x11f));var _0x05c5=function(_0x2ec3aa,_0x29bd65){_0x2ec3aa=_0x2ec3aa-0x0;var _0x284ab2=_0x5c50[_0x2ec3aa];return _0x284ab2;};'use strict';var multer=require(_0x05c5('0x0'));var util=require(_0x05c5('0x1'));var path=require(_0x05c5('0x2'));var timeout=require(_0x05c5('0x3'));var express=require(_0x05c5('0x4'));var router=express[_0x05c5('0x5')]();var auth=require(_0x05c5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x05c5('0x7'));module[_0x05c5('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 93e4d81..8d18c7a 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 _0x4213=['exports','INTEGER','STRING','sequelize'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x4213,0x77));var _0x3421=function(_0x3a6978,_0x544a12){_0x3a6978=_0x3a6978-0x0;var _0x57e757=_0x4213[_0x3a6978];return _0x57e757;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'penalty':{'type':Sequelize[_0x3421('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3421('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3421('0x3')]}}; \ No newline at end of file +var _0xa571=['exports','INTEGER','sequelize'];(function(_0x2b757c,_0x22ba0f){var _0x9a1fff=function(_0x4e9bb7){while(--_0x4e9bb7){_0x2b757c['push'](_0x2b757c['shift']());}};_0x9a1fff(++_0x22ba0f);}(_0xa571,0x107));var _0x1a57=function(_0x3ca3ff,_0x507255){_0x3ca3ff=_0x3ca3ff-0x0;var _0x3900d3=_0xa571[_0x3ca3ff];return _0x3900d3;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'penalty':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ff67146..4926f42 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 _0xc0a1=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','UserFaxQueue'];(function(_0x44c5ed,_0x44a011){var _0x3d6cd4=function(_0x4651b9){while(--_0x4651b9){_0x44c5ed['push'](_0x44c5ed['shift']());}};_0x3d6cd4(++_0x44a011);}(_0xc0a1,0x172));var _0x1c0a=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0xc0a1[_0x32e649];return _0x14d386;};'use strict';var _=require(_0x1c0a('0x0'));var util=require(_0x1c0a('0x1'));var logger=require(_0x1c0a('0x2'))(_0x1c0a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1c0a('0x4'));var fs=require('fs');var path=require(_0x1c0a('0x5'));var rimraf=require(_0x1c0a('0x6'));var config=require(_0x1c0a('0x7'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x34ac1d,_0x56ca2b){return _0x34ac1d[_0x1c0a('0x8')](_0x1c0a('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee3a=['path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2caf41,_0x5b398e){var _0x5ca4de=function(_0x5ae652){while(--_0x5ae652){_0x2caf41['push'](_0x2caf41['shift']());}};_0x5ca4de(++_0x5b398e);}(_0xee3a,0x13f));var _0xaee3=function(_0x4c339e,_0x546e67){_0x4c339e=_0x4c339e-0x0;var _0x56b984=_0xee3a[_0x4c339e];return _0x56b984;};'use strict';var _=require(_0xaee3('0x0'));var util=require(_0xaee3('0x1'));var logger=require(_0xaee3('0x2'))('api');var moment=require(_0xaee3('0x3'));var BPromise=require(_0xaee3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaee3('0x5'));var rimraf=require(_0xaee3('0x6'));var config=require(_0xaee3('0x7'));var attributes=require(_0xaee3('0x8'));module[_0xaee3('0x9')]=function(_0x1b0a7b,_0x1b15ed){return _0x1b0a7b['define'](_0xaee3('0xa'),attributes,{'tableName':_0xaee3('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 954504b..a0cf863 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 _0x40f3=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x40f3,0x8b));var _0x340f=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x40f3[_0x30033a];return _0x5e3518;};'use strict';var _=require('lodash');var util=require(_0x340f('0x0'));var moment=require(_0x340f('0x1'));var BPromise=require('bluebird');var rs=require(_0x340f('0x2'));var fs=require('fs');var Redis=require(_0x340f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x340f('0x4'))(_0x340f('0x5'));var config=require('../../config/environment');var jayson=require(_0x340f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d92f2,_0x264754,_0x22dd4b){return new BPromise(function(_0x5af823,_0x4f1f9b){return client[_0x340f('0x7')](_0x2d92f2,_0x22dd4b)[_0x340f('0x8')](function(_0x112b1f){logger[_0x340f('0x9')](_0x340f('0xa'),_0x264754,_0x340f('0xb'));logger[_0x340f('0xc')](_0x340f('0xd'),_0x264754,_0x340f('0xb'),JSON[_0x340f('0xe')](_0x112b1f));if(_0x112b1f[_0x340f('0xf')]){if(_0x112b1f['error'][_0x340f('0x10')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x264754,_0x112b1f[_0x340f('0xf')][_0x340f('0x11')]);return _0x4f1f9b(_0x112b1f[_0x340f('0xf')]['message']);}logger[_0x340f('0xf')](_0x340f('0xa'),_0x264754,_0x112b1f[_0x340f('0xf')][_0x340f('0x11')]);return _0x5af823(_0x112b1f['error'][_0x340f('0x11')]);}else{logger[_0x340f('0x9')](_0x340f('0xa'),_0x264754,'request\x20sent');_0x5af823(_0x112b1f[_0x340f('0x12')][_0x340f('0x11')]);}})['catch'](function(_0x161c08){logger[_0x340f('0xf')](_0x340f('0xa'),_0x264754,_0x161c08);_0x4f1f9b(_0x161c08);});});} \ No newline at end of file +var _0x8165=['then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserFaxQueue,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request'];(function(_0x48043a,_0x2b99c1){var _0x7d92d2=function(_0xe18174){while(--_0xe18174){_0x48043a['push'](_0x48043a['shift']());}};_0x7d92d2(++_0x2b99c1);}(_0x8165,0x96));var _0x5816=function(_0x360195,_0x53f8d6){_0x360195=_0x360195-0x0;var _0x1126e3=_0x8165[_0x360195];return _0x1126e3;};'use strict';var _=require(_0x5816('0x0'));var util=require(_0x5816('0x1'));var moment=require(_0x5816('0x2'));var BPromise=require(_0x5816('0x3'));var rs=require(_0x5816('0x4'));var fs=require('fs');var Redis=require(_0x5816('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5816('0x6'));var logger=require(_0x5816('0x7'))(_0x5816('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d28cb,_0x47392f,_0x5a21cd){return new BPromise(function(_0x499f30,_0x5c5ae6){return client[_0x5816('0x9')](_0x2d28cb,_0x5a21cd)[_0x5816('0xa')](function(_0x45deb4){logger[_0x5816('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x47392f,_0x5816('0xc'));logger[_0x5816('0xd')](_0x5816('0xe'),_0x47392f,_0x5816('0xc'),JSON[_0x5816('0xf')](_0x45deb4));if(_0x45deb4['error']){if(_0x45deb4[_0x5816('0x10')]['code']===0x1f4){logger[_0x5816('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x47392f,_0x45deb4['error'][_0x5816('0x11')]);return _0x5c5ae6(_0x45deb4[_0x5816('0x10')]['message']);}logger[_0x5816('0x10')](_0x5816('0x12'),_0x47392f,_0x45deb4[_0x5816('0x10')][_0x5816('0x11')]);return _0x499f30(_0x45deb4[_0x5816('0x10')]['message']);}else{logger['info'](_0x5816('0x12'),_0x47392f,_0x5816('0xc'));_0x499f30(_0x45deb4['result'][_0x5816('0x11')]);}})[_0x5816('0x13')](function(_0x664b41){logger[_0x5816('0x10')](_0x5816('0x12'),_0x47392f,_0x664b41);_0x5c5ae6(_0x664b41);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f7694a5..36a1f12 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 _0xf962=['../../config/environment','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3a39cb,_0x2e1f16){var _0x40cc36=function(_0x9fc43e){while(--_0x9fc43e){_0x3a39cb['push'](_0x3a39cb['shift']());}};_0x40cc36(++_0x2e1f16);}(_0xf962,0x132));var _0x2f96=function(_0x2cea19,_0x4783f2){_0x2cea19=_0x2cea19-0x0;var _0x2c3733=_0xf962[_0x2cea19];return _0x2c3733;};'use strict';var multer=require(_0x2f96('0x0'));var util=require('util');var path=require(_0x2f96('0x1'));var timeout=require(_0x2f96('0x2'));var express=require(_0x2f96('0x3'));var router=express['Router']();var auth=require(_0x2f96('0x4'));var interaction=require(_0x2f96('0x5'));var config=require(_0x2f96('0x6'));module[_0x2f96('0x7')]=router; \ No newline at end of file +var _0xc7d3=['util','path','connect-timeout','Router','exports','multer'];(function(_0xb62003,_0x3f4add){var _0x50aeb5=function(_0x535ca1){while(--_0x535ca1){_0xb62003['push'](_0xb62003['shift']());}};_0x50aeb5(++_0x3f4add);}(_0xc7d3,0x17f));var _0x3c7d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc7d3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3c7d('0x0'));var util=require(_0x3c7d('0x1'));var path=require(_0x3c7d('0x2'));var timeout=require(_0x3c7d('0x3'));var express=require('express');var router=express[_0x3c7d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x3c7d('0x5')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9d8800a..cdde4ed 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x3220bb,_0x342a03){var _0x23415c=function(_0x56cc05){while(--_0x56cc05){_0x3220bb['push'](_0x3220bb['shift']());}};_0x23415c(++_0x342a03);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x1f227f,_0x58b6e3){var _0x3b827e=function(_0x277efb){while(--_0x277efb){_0x1f227f['push'](_0x1f227f['shift']());}};_0x3b827e(++_0x58b6e3);}(_0xb10b,0x12a));var _0xbb10=function(_0xc85513,_0x49e852){_0xc85513=_0xc85513-0x0;var _0x3e70be=_0xb10b[_0xc85513];return _0x3e70be;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index d13ebf1..ac6135e 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 _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0xd589bc,_0x329cef){var _0x36cf9f=function(_0x45f25f){while(--_0x45f25f){_0xd589bc['push'](_0xd589bc['shift']());}};_0x36cf9f(++_0x329cef);}(_0xb7e7,0x121));var _0x7b7e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xb7e7[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f5ac5,_0x526505){_0x5f5ac5=_0x5f5ac5-0x0;var _0x3697f2=_0xb10b[_0x5f5ac5];return _0x3697f2;};'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')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 95da508..4ee018c 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 _0xceae=['UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xceae,0x122));var _0xecea=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0xceae[_0x77d286];return _0x5446a5;};'use strict';var _=require(_0xecea('0x0'));var util=require(_0xecea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecea('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xecea('0x3'))(_0xecea('0x4'));var config=require(_0xecea('0x5'));var jayson=require(_0xecea('0x6'));var client=jayson[_0xecea('0x7')][_0xecea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a3f5b,_0x242ea0,_0x1663e2){return new BPromise(function(_0x46bb33,_0x4b973b){return client[_0xecea('0x9')](_0x2a3f5b,_0x1663e2)['then'](function(_0x379b2c){logger[_0xecea('0xa')](_0xecea('0xb'),_0x242ea0,_0xecea('0xc'));logger[_0xecea('0xd')](_0xecea('0xe'),_0x242ea0,_0xecea('0xc'),JSON[_0xecea('0xf')](_0x379b2c));if(_0x379b2c[_0xecea('0x10')]){if(_0x379b2c[_0xecea('0x10')][_0xecea('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x242ea0,_0x379b2c['error'][_0xecea('0x12')]);return _0x4b973b(_0x379b2c['error'][_0xecea('0x12')]);}logger[_0xecea('0x10')](_0xecea('0xb'),_0x242ea0,_0x379b2c[_0xecea('0x10')][_0xecea('0x12')]);return _0x46bb33(_0x379b2c[_0xecea('0x10')]['message']);}else{logger[_0xecea('0xa')](_0xecea('0xb'),_0x242ea0,_0xecea('0xc'));_0x46bb33(_0x379b2c['result'][_0xecea('0x12')]);}})['catch'](function(_0x308efc){logger['error'](_0xecea('0xb'),_0x242ea0,_0x308efc);_0x4b973b(_0x308efc);});});} \ No newline at end of file +var _0xccd4=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e08e4,_0x44301d){var _0x5878a4=function(_0x44c886){while(--_0x44c886){_0x3e08e4['push'](_0x3e08e4['shift']());}};_0x5878a4(++_0x44301d);}(_0xccd4,0xa4));var _0x4ccd=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xccd4[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x4ccd('0x0'));var util=require(_0x4ccd('0x1'));var moment=require(_0x4ccd('0x2'));var BPromise=require(_0x4ccd('0x3'));var rs=require(_0x4ccd('0x4'));var fs=require('fs');var Redis=require(_0x4ccd('0x5'));var db=require(_0x4ccd('0x6'))['db'];var utils=require(_0x4ccd('0x7'));var logger=require(_0x4ccd('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ccd('0x9')][_0x4ccd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe2e41a,_0x1f63b1,_0x37977b){return new BPromise(function(_0x3c5b28,_0x50ab0f){return client[_0x4ccd('0xb')](_0xe2e41a,_0x37977b)[_0x4ccd('0xc')](function(_0x4a242d){logger['info'](_0x4ccd('0xd'),_0x1f63b1,_0x4ccd('0xe'));logger['debug'](_0x4ccd('0xf'),_0x1f63b1,_0x4ccd('0xe'),JSON[_0x4ccd('0x10')](_0x4a242d));if(_0x4a242d[_0x4ccd('0x11')]){if(_0x4a242d[_0x4ccd('0x11')][_0x4ccd('0x12')]===0x1f4){logger[_0x4ccd('0x11')](_0x4ccd('0xd'),_0x1f63b1,_0x4a242d[_0x4ccd('0x11')][_0x4ccd('0x13')]);return _0x50ab0f(_0x4a242d[_0x4ccd('0x11')][_0x4ccd('0x13')]);}logger[_0x4ccd('0x11')](_0x4ccd('0xd'),_0x1f63b1,_0x4a242d[_0x4ccd('0x11')][_0x4ccd('0x13')]);return _0x3c5b28(_0x4a242d[_0x4ccd('0x11')][_0x4ccd('0x13')]);}else{logger[_0x4ccd('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x1f63b1,_0x4ccd('0xe'));_0x3c5b28(_0x4a242d[_0x4ccd('0x15')][_0x4ccd('0x13')]);}})[_0x4ccd('0x16')](function(_0x453b80){logger['error'](_0x4ccd('0xd'),_0x1f63b1,_0x453b80);_0x50ab0f(_0x453b80);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 781430e..46ade10 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 _0xdedf=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xdedf,0xb8));var _0xfded=function(_0x4559ad,_0x2eba0c){_0x4559ad=_0x4559ad-0x0;var _0x392de1=_0xdedf[_0x4559ad];return _0x392de1;};'use strict';var multer=require(_0xfded('0x0'));var util=require(_0xfded('0x1'));var path=require(_0xfded('0x2'));var timeout=require(_0xfded('0x3'));var express=require(_0xfded('0x4'));var router=express[_0xfded('0x5')]();var auth=require(_0xfded('0x6'));var interaction=require(_0xfded('0x7'));var config=require(_0xfded('0x8'));module[_0xfded('0x9')]=router; \ No newline at end of file +var _0x7592=['path','connect-timeout','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x43be21,_0x1a1140){var _0x535370=function(_0x5a8d39){while(--_0x5a8d39){_0x43be21['push'](_0x43be21['shift']());}};_0x535370(++_0x1a1140);}(_0x7592,0xe9));var _0x2759=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x7592[_0x2a1b33];return _0x4c50e7;};'use strict';var multer=require(_0x2759('0x0'));var util=require('util');var path=require(_0x2759('0x1'));var timeout=require(_0x2759('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2759('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2759('0x4'));module[_0x2759('0x5')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c13c947..82732db 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5cdddc,_0x52f0f8){var _0x27afb7=function(_0x36fe36){while(--_0x36fe36){_0x5cdddc['push'](_0x5cdddc['shift']());}};_0x27afb7(++_0x52f0f8);}(_0xe706,0xa3));var _0x6e70=function(_0x5bc27a,_0x32e2d1){_0x5bc27a=_0x5bc27a-0x0;var _0x2c8a4d=_0xe706[_0x5bc27a];return _0x2c8a4d;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x211907,_0x5486fe){var _0x2cc002=function(_0x51c5ca){while(--_0x51c5ca){_0x211907['push'](_0x211907['shift']());}};_0x2cc002(++_0x5486fe);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index e8a1e65..e9864cf 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 _0x8d33=['./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','moment','rimraf','../../config/environment'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x8d33,0x13c));var _0x38d3=function(_0x2b2178,_0x36eec2){_0x2b2178=_0x2b2178-0x0;var _0x267d9f=_0x8d33[_0x2b2178];return _0x267d9f;};'use strict';var _=require(_0x38d3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x38d3('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x38d3('0x2'));var config=require(_0x38d3('0x3'));var attributes=require(_0x38d3('0x4'));module[_0x38d3('0x5')]=function(_0x5017df,_0x53aeaa){return _0x5017df[_0x38d3('0x6')]('UserOpenchannelQueue',attributes,{'tableName':_0x38d3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31c3=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api'];(function(_0x44af81,_0x2e0305){var _0x3626e7=function(_0x56f9e7){while(--_0x56f9e7){_0x44af81['push'](_0x44af81['shift']());}};_0x3626e7(++_0x2e0305);}(_0x31c3,0x1a1));var _0x331c=function(_0x504651,_0xecda4e){_0x504651=_0x504651-0x0;var _0x377d7c=_0x31c3[_0x504651];return _0x377d7c;};'use strict';var _=require(_0x331c('0x0'));var util=require('util');var logger=require(_0x331c('0x1'))(_0x331c('0x2'));var moment=require(_0x331c('0x3'));var BPromise=require(_0x331c('0x4'));var rp=require(_0x331c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x331c('0x6'));var config=require(_0x331c('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x331c('0x8')]=function(_0x317851,_0x153572){return _0x317851[_0x331c('0x9')](_0x331c('0xa'),attributes,{'tableName':_0x331c('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 e2afba3..8780bab 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 _0xad11=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x388ccc,_0x2a24fd){var _0x570c20=function(_0x1addd1){while(--_0x1addd1){_0x388ccc['push'](_0x388ccc['shift']());}};_0x570c20(++_0x2a24fd);}(_0xad11,0xe2));var _0x1ad1=function(_0x3e6358,_0x4cc491){_0x3e6358=_0x3e6358-0x0;var _0x1ac275=_0xad11[_0x3e6358];return _0x1ac275;};'use strict';var _=require(_0x1ad1('0x0'));var util=require('util');var moment=require(_0x1ad1('0x1'));var BPromise=require(_0x1ad1('0x2'));var rs=require(_0x1ad1('0x3'));var fs=require('fs');var Redis=require(_0x1ad1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ad1('0x5'));var logger=require(_0x1ad1('0x6'))('rpc');var config=require(_0x1ad1('0x7'));var jayson=require(_0x1ad1('0x8'));var client=jayson['client'][_0x1ad1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x351007,_0x5c90e8,_0x422437){return new BPromise(function(_0x2837c0,_0xdd89a8){return client[_0x1ad1('0xa')](_0x351007,_0x422437)[_0x1ad1('0xb')](function(_0x4169ae){logger['info'](_0x1ad1('0xc'),_0x5c90e8,'request\x20sent');logger[_0x1ad1('0xd')](_0x1ad1('0xe'),_0x5c90e8,_0x1ad1('0xf'),JSON[_0x1ad1('0x10')](_0x4169ae));if(_0x4169ae[_0x1ad1('0x11')]){if(_0x4169ae[_0x1ad1('0x11')][_0x1ad1('0x12')]===0x1f4){logger[_0x1ad1('0x11')](_0x1ad1('0xc'),_0x5c90e8,_0x4169ae[_0x1ad1('0x11')]['message']);return _0xdd89a8(_0x4169ae[_0x1ad1('0x11')][_0x1ad1('0x13')]);}logger[_0x1ad1('0x11')](_0x1ad1('0xc'),_0x5c90e8,_0x4169ae['error'][_0x1ad1('0x13')]);return _0x2837c0(_0x4169ae[_0x1ad1('0x11')][_0x1ad1('0x13')]);}else{logger[_0x1ad1('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5c90e8,'request\x20sent');_0x2837c0(_0x4169ae[_0x1ad1('0x15')][_0x1ad1('0x13')]);}})[_0x1ad1('0x16')](function(_0x38d630){logger[_0x1ad1('0x11')](_0x1ad1('0xc'),_0x5c90e8,_0x38d630);_0xdd89a8(_0x38d630);});});} \ No newline at end of file +var _0xd3ef=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd3ef,0x71));var _0xfd3e=function(_0x406cf7,_0xe378a5){_0x406cf7=_0x406cf7-0x0;var _0x325d00=_0xd3ef[_0x406cf7];return _0x325d00;};'use strict';var _=require('lodash');var util=require(_0xfd3e('0x0'));var moment=require(_0xfd3e('0x1'));var BPromise=require(_0xfd3e('0x2'));var rs=require(_0xfd3e('0x3'));var fs=require('fs');var Redis=require(_0xfd3e('0x4'));var db=require(_0xfd3e('0x5'))['db'];var utils=require(_0xfd3e('0x6'));var logger=require(_0xfd3e('0x7'))(_0xfd3e('0x8'));var config=require(_0xfd3e('0x9'));var jayson=require(_0xfd3e('0xa'));var client=jayson[_0xfd3e('0xb')][_0xfd3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17e315,_0x2ffa23,_0x94fbaa){return new BPromise(function(_0x525906,_0x4a1003){return client[_0xfd3e('0xd')](_0x17e315,_0x94fbaa)['then'](function(_0x1d338f){logger['info'](_0xfd3e('0xe'),_0x2ffa23,_0xfd3e('0xf'));logger['debug'](_0xfd3e('0x10'),_0x2ffa23,'request\x20sent',JSON[_0xfd3e('0x11')](_0x1d338f));if(_0x1d338f[_0xfd3e('0x12')]){if(_0x1d338f[_0xfd3e('0x12')][_0xfd3e('0x13')]===0x1f4){logger['error'](_0xfd3e('0xe'),_0x2ffa23,_0x1d338f[_0xfd3e('0x12')][_0xfd3e('0x14')]);return _0x4a1003(_0x1d338f[_0xfd3e('0x12')][_0xfd3e('0x14')]);}logger['error'](_0xfd3e('0xe'),_0x2ffa23,_0x1d338f[_0xfd3e('0x12')][_0xfd3e('0x14')]);return _0x525906(_0x1d338f['error'][_0xfd3e('0x14')]);}else{logger[_0xfd3e('0x15')](_0xfd3e('0xe'),_0x2ffa23,'request\x20sent');_0x525906(_0x1d338f['result'][_0xfd3e('0x14')]);}})[_0xfd3e('0x16')](function(_0x27fe48){logger[_0xfd3e('0x12')](_0xfd3e('0xe'),_0x2ffa23,_0x27fe48);_0x4a1003(_0x27fe48);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7956385..461e5c1 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 _0x8ace=['/:id','show','/:id/resources','post','create','update','delete','destroy','removeSections','removeResources','exports','multer','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ace,0x137));var _0xe8ac=function(_0x16d1b6,_0x5912db){_0x16d1b6=_0x16d1b6-0x0;var _0x2ca1f5=_0x8ace[_0x16d1b6];return _0x2ca1f5;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require('util');var path=require(_0xe8ac('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8ac('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe8ac('0x3'));var config=require(_0xe8ac('0x4'));var controller=require('./userProfile.controller');router[_0xe8ac('0x5')]('/',auth[_0xe8ac('0x6')](),controller[_0xe8ac('0x7')]);router['get'](_0xe8ac('0x8'),auth[_0xe8ac('0x6')](),controller['describe']);router[_0xe8ac('0x5')](_0xe8ac('0x9'),auth[_0xe8ac('0x6')](),controller[_0xe8ac('0xa')]);router[_0xe8ac('0x5')]('/:id/sections',auth[_0xe8ac('0x6')](),controller['getSections']);router[_0xe8ac('0x5')](_0xe8ac('0xb'),auth[_0xe8ac('0x6')](),controller['getResources']);router[_0xe8ac('0xc')]('/',auth['isAuthenticated'](),controller[_0xe8ac('0xd')]);router['post']('/:id/clone',auth[_0xe8ac('0x6')](),controller['clone']);router[_0xe8ac('0xc')]('/:id/sections',auth[_0xe8ac('0x6')](),controller['addSections']);router[_0xe8ac('0xc')](_0xe8ac('0xb'),auth['isAuthenticated'](),controller['addResources']);router['put'](_0xe8ac('0x9'),auth[_0xe8ac('0x6')](),controller[_0xe8ac('0xe')]);router[_0xe8ac('0xf')](_0xe8ac('0x9'),auth[_0xe8ac('0x6')](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0xf')]('/:id/sections',auth[_0xe8ac('0x6')](),controller[_0xe8ac('0x11')]);router['delete'](_0xe8ac('0xb'),auth[_0xe8ac('0x6')](),controller[_0xe8ac('0x12')]);module[_0xe8ac('0x13')]=router; \ No newline at end of file +var _0x886a=['/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated'];(function(_0x276cd5,_0x3e7d72){var _0xa9c709=function(_0x2ec534){while(--_0x2ec534){_0x276cd5['push'](_0x276cd5['shift']());}};_0xa9c709(++_0x3e7d72);}(_0x886a,0xb5));var _0xa886=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x886a[_0x1b02bb];return _0x131245;};'use strict';var multer=require(_0xa886('0x0'));var util=require(_0xa886('0x1'));var path=require(_0xa886('0x2'));var timeout=require(_0xa886('0x3'));var express=require('express');var router=express[_0xa886('0x4')]();var auth=require(_0xa886('0x5'));var interaction=require(_0xa886('0x6'));var config=require(_0xa886('0x7'));var controller=require(_0xa886('0x8'));router[_0xa886('0x9')]('/',auth[_0xa886('0xa')](),controller['index']);router[_0xa886('0x9')]('/describe',auth[_0xa886('0xa')](),controller['describe']);router['get'](_0xa886('0xb'),auth[_0xa886('0xa')](),controller[_0xa886('0xc')]);router[_0xa886('0x9')](_0xa886('0xd'),auth[_0xa886('0xa')](),controller[_0xa886('0xe')]);router[_0xa886('0x9')](_0xa886('0xf'),auth[_0xa886('0xa')](),controller[_0xa886('0x10')]);router[_0xa886('0x11')]('/',auth[_0xa886('0xa')](),controller[_0xa886('0x12')]);router[_0xa886('0x11')](_0xa886('0x13'),auth[_0xa886('0xa')](),controller[_0xa886('0x14')]);router['post']('/:id/sections',auth[_0xa886('0xa')](),controller[_0xa886('0x15')]);router[_0xa886('0x11')](_0xa886('0xf'),auth['isAuthenticated'](),controller[_0xa886('0x16')]);router['put'](_0xa886('0xb'),auth[_0xa886('0xa')](),controller['update']);router['delete'](_0xa886('0xb'),auth[_0xa886('0xa')](),controller['destroy']);router[_0xa886('0x17')](_0xa886('0xd'),auth[_0xa886('0xa')](),controller['removeSections']);router[_0xa886('0x17')](_0xa886('0xf'),auth[_0xa886('0xa')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index def7090..89a6441 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 _0xc275=['getDataValue','split','STRING','exports','crudPermissions','join'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc275,0x1c5));var _0x5c27=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc275[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0x5c27('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4c4239){this['setDataValue'](_0x5c27('0x1'),_0x4c4239?_0x4c4239[_0x5c27('0x2')](''):[]);},'get':function(){return this[_0x5c27('0x3')](_0x5c27('0x1'))?this[_0x5c27('0x3')](_0x5c27('0x1'))[_0x5c27('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5c27('0x5')],'allowNull':!![]}}; \ No newline at end of file +var _0x1d07=['exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x277bf8,_0x136516){var _0x2f32d9=function(_0x144fb7){while(--_0x144fb7){_0x277bf8['push'](_0x277bf8['shift']());}};_0x2f32d9(++_0x136516);}(_0x1d07,0x100));var _0x71d0=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x1d07[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0x71d0('0x0')]={'name':{'type':Sequelize[_0x71d0('0x1')],'allowNull':![],'unique':_0x71d0('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x298e40){this[_0x71d0('0x3')](_0x71d0('0x4'),_0x298e40?_0x298e40[_0x71d0('0x5')](''):[]);},'get':function(){return this[_0x71d0('0x6')](_0x71d0('0x4'))?this[_0x71d0('0x6')](_0x71d0('0x4'))[_0x71d0('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 88055bd..96e7c94 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 _0x9acf=['sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','UserProfile','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','limit','offset','order','where','pick','filter','merge','map','type','key','field','includeAll','findAll','rows','rawAttributes','include','options','find','catch','create','body','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','params','destroy','describe','addSections','userProfileId','each','push','getSections','enabled','some','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','ids','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','isEmpty','all','ignore','childModel','sort','VIRTUAL','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','custom','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','SquareOdbc','parentSections','SquareProjects','projects','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','Team','voicequeues','users','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','cannedanswers','dispositions','customdashboards','intervals','Interval','pauses','Pause','Schedule','Sound','tags','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path'];(function(_0x219e9b,_0x295d91){var _0x332e80=function(_0x567792){while(--_0x567792){_0x219e9b['push'](_0x219e9b['shift']());}};_0x332e80(++_0x295d91);}(_0x9acf,0xdb));var _0xf9ac=function(_0x504aad,_0x503eda){_0x504aad=_0x504aad-0x0;var _0x1b1087=_0x9acf[_0x504aad];return _0x1b1087;};'use strict';var pdf=require(_0xf9ac('0x0'));var emlformat=require(_0xf9ac('0x1'));var rimraf=require(_0xf9ac('0x2'));var zipdir=require(_0xf9ac('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf9ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf9ac('0x5'));var util=require(_0xf9ac('0x6'));var path=require(_0xf9ac('0x7'));var sox=require(_0xf9ac('0x8'));var csv=require('to-csv');var ejs=require(_0xf9ac('0x9'));var fs=require('fs');var _=require(_0xf9ac('0xa'));var squel=require(_0xf9ac('0xb'));var crypto=require(_0xf9ac('0xc'));var jsforce=require(_0xf9ac('0xd'));var deskjs=require(_0xf9ac('0xe'));var toCsv=require(_0xf9ac('0xf'));var querystring=require(_0xf9ac('0x10'));var Papa=require(_0xf9ac('0x11'));var Redis=require(_0xf9ac('0x12'));var authService=require(_0xf9ac('0x13'));var qs=require(_0xf9ac('0x14'));var hardwareService=require(_0xf9ac('0x15'));var logger=require(_0xf9ac('0x16'))(_0xf9ac('0x17'));var utils=require(_0xf9ac('0x18'));var config=require('../../config/environment');var db=require(_0xf9ac('0x19'))['db'];config['redis']=_[_0xf9ac('0x1a')](config[_0xf9ac('0x1b')],{'host':_0xf9ac('0x1c'),'port':0x18eb});var socket=require(_0xf9ac('0x1d'))(new Redis(config[_0xf9ac('0x1b')]));require(_0xf9ac('0x1e'))[_0xf9ac('0x1f')](socket);function respondWithStatusCode(_0x5fbde9,_0x3df337){_0x3df337=_0x3df337||0xcc;return function(_0x11b8ce){if(_0x11b8ce){return _0x5fbde9[_0xf9ac('0x20')](_0x3df337);}return _0x5fbde9[_0xf9ac('0x21')](_0x3df337)['end']();};}function respondWithResult(_0x4f1775,_0x5192bd){_0x5192bd=_0x5192bd||0xc8;return function(_0x4a30d1){if(_0x4a30d1){return _0x4f1775[_0xf9ac('0x21')](_0x5192bd)[_0xf9ac('0x22')](_0x4a30d1);}};}function respondWithFilteredResult(_0x500a48,_0x440016){return function(_0x18880e){if(_0x18880e){var _0x7cbdc4=_0x18880e[_0xf9ac('0x23')],_0x11e04a=_0x440016['offset'],_0x5c8589=_0x440016['offset']+_0x440016['limit'],_0x2baf4a;if(_0x5c8589>=_0x7cbdc4){_0x5c8589=_0x7cbdc4;_0x2baf4a=0xc8;}else{_0x2baf4a=0xce;}_0x500a48['status'](_0x2baf4a);return _0x500a48[_0xf9ac('0x24')](_0xf9ac('0x25'),_0x11e04a+'-'+_0x5c8589+'/'+_0x7cbdc4)[_0xf9ac('0x22')](_0x18880e);}return null;};}function patchUpdates(_0x5a5364){return function(_0x426bc5){try{jsonpatch[_0xf9ac('0x26')](_0x426bc5,_0x5a5364,!![]);}catch(_0x4d91ac){return BPromise[_0xf9ac('0x27')](_0x4d91ac);}return _0x426bc5[_0xf9ac('0x28')]();};}function saveUpdates(_0x5c9339,_0x367511){return function(_0x733786){if(_0x733786){return _0x733786[_0xf9ac('0x29')](_0x5c9339)[_0xf9ac('0x2a')](function(_0x243e6c){return _0x243e6c;});}return null;};}function removeEntity(_0x1f601e,_0x15e1b4){return function(_0x353612){if(_0x353612){return _0x353612['destroy']()[_0xf9ac('0x2a')](function(){_0x1f601e[_0xf9ac('0x21')](0xcc)[_0xf9ac('0x2b')]();});}};}function handleEntityNotFound(_0x4c9a2e,_0x2c04a5){return function(_0x409a61){if(!_0x409a61){_0x4c9a2e[_0xf9ac('0x20')](0x194);}return _0x409a61;};}function handleError(_0x4e308e,_0x3f77ff){_0x3f77ff=_0x3f77ff||0x1f4;return function(_0x1fb0cc){logger[_0xf9ac('0x2c')](_0x1fb0cc[_0xf9ac('0x2d')]);if(_0x1fb0cc[_0xf9ac('0x2e')]){delete _0x1fb0cc[_0xf9ac('0x2e')];}_0x4e308e[_0xf9ac('0x21')](_0x3f77ff)[_0xf9ac('0x2f')](_0x1fb0cc);};}exports[_0xf9ac('0x30')]=function(_0x5ba6b4,_0x5d61b0){var _0x31586c={},_0xd241b1={},_0x324a4f={'count':0x0,'rows':[]};var _0x5d4449=db[_0xf9ac('0x31')]['rawAttributes'];_0xd241b1['model']=_[_0xf9ac('0x32')](_0x5d4449);_0xd241b1[_0xf9ac('0x33')]=_[_0xf9ac('0x32')](_0x5ba6b4[_0xf9ac('0x33')]);_0xd241b1[_0xf9ac('0x34')]=_['intersection'](_0xd241b1['model'],_0xd241b1[_0xf9ac('0x33')]);_0x31586c['attributes']=_[_0xf9ac('0x35')](_0xd241b1['model'],qs[_0xf9ac('0x36')](_0x5ba6b4[_0xf9ac('0x33')][_0xf9ac('0x36')]));_0x31586c[_0xf9ac('0x37')]=_0x31586c[_0xf9ac('0x37')][_0xf9ac('0x38')]?_0x31586c[_0xf9ac('0x37')]:_0xd241b1[_0xf9ac('0x39')];if(!_0x5ba6b4['query'][_0xf9ac('0x3a')](_0xf9ac('0x3b'))){_0x31586c['limit']=qs['limit'](_0x5ba6b4[_0xf9ac('0x33')][_0xf9ac('0x3c')]);_0x31586c[_0xf9ac('0x3d')]=qs[_0xf9ac('0x3d')](_0x5ba6b4[_0xf9ac('0x33')][_0xf9ac('0x3d')]);}_0x31586c[_0xf9ac('0x3e')]=qs['sort'](_0x5ba6b4['query']['sort']);_0x31586c[_0xf9ac('0x3f')]=qs[_0xf9ac('0x34')](_[_0xf9ac('0x40')](_0x5ba6b4[_0xf9ac('0x33')],_0xd241b1[_0xf9ac('0x34')]));if(_0x5ba6b4[_0xf9ac('0x33')][_0xf9ac('0x41')]){_0x31586c[_0xf9ac('0x3f')]=_[_0xf9ac('0x42')](_0x31586c[_0xf9ac('0x3f')],{'$or':_[_0xf9ac('0x43')](_0x5d4449,function(_0x5d7aaa){if(_0x5d7aaa[_0xf9ac('0x44')][_0xf9ac('0x45')]!=='VIRTUAL'){var _0x99145b={};_0x99145b[_0x5d7aaa[_0xf9ac('0x46')]]={'$like':'%'+_0x5ba6b4[_0xf9ac('0x33')]['filter']+'%'};return _0x99145b;}})});}_0x31586c=_['merge']({},_0x31586c,_0x5ba6b4['options']);var _0x26fa4e={'where':_0x31586c['where']};return db['UserProfile']['count'](_0x26fa4e)[_0xf9ac('0x2a')](function(_0x46dca6){_0x324a4f[_0xf9ac('0x23')]=_0x46dca6;if(_0x5ba6b4['query'][_0xf9ac('0x47')]){_0x31586c['include']=[{'all':!![]}];}return db['UserProfile'][_0xf9ac('0x48')](_0x31586c);})[_0xf9ac('0x2a')](function(_0x98c8f6){_0x324a4f[_0xf9ac('0x49')]=_0x98c8f6;return _0x324a4f;})[_0xf9ac('0x2a')](respondWithFilteredResult(_0x5d61b0,_0x31586c))['catch'](handleError(_0x5d61b0,null));};exports['show']=function(_0x4b28eb,_0x3c34ba){var _0x3a39d0={'raw':![],'where':{'id':_0x4b28eb['params']['id']}},_0xfe1e8={};_0xfe1e8['model']=_['keys'](db[_0xf9ac('0x31')][_0xf9ac('0x4a')]);_0xfe1e8[_0xf9ac('0x33')]=_['keys'](_0x4b28eb['query']);_0xfe1e8[_0xf9ac('0x34')]=_[_0xf9ac('0x35')](_0xfe1e8['model'],_0xfe1e8[_0xf9ac('0x33')]);_0x3a39d0[_0xf9ac('0x37')]=_[_0xf9ac('0x35')](_0xfe1e8[_0xf9ac('0x39')],qs['fields'](_0x4b28eb[_0xf9ac('0x33')]['fields']));_0x3a39d0['attributes']=_0x3a39d0['attributes']['length']?_0x3a39d0[_0xf9ac('0x37')]:_0xfe1e8[_0xf9ac('0x39')];if(_0x4b28eb[_0xf9ac('0x33')][_0xf9ac('0x47')]){_0x3a39d0[_0xf9ac('0x4b')]=[{'all':!![]}];}_0x3a39d0=_[_0xf9ac('0x42')]({},_0x3a39d0,_0x4b28eb[_0xf9ac('0x4c')]);return db[_0xf9ac('0x31')][_0xf9ac('0x4d')](_0x3a39d0)['then'](handleEntityNotFound(_0x3c34ba,null))[_0xf9ac('0x2a')](respondWithResult(_0x3c34ba,null))[_0xf9ac('0x4e')](handleError(_0x3c34ba,null));};exports[_0xf9ac('0x4f')]=function(_0x40137e,_0x5e488c){return db[_0xf9ac('0x31')]['create'](_0x40137e[_0xf9ac('0x50')],{})[_0xf9ac('0x2a')](respondWithResult(_0x5e488c,0xc9))[_0xf9ac('0x4e')](handleError(_0x5e488c,null));};exports['clone']=function(_0x538868,_0x255f36){var _0x8d4540={'raw':![],'where':{'id':_0x538868['params']['id']}},_0x4c7971={};_0x4c7971[_0xf9ac('0x39')]=_[_0xf9ac('0x32')](db['UserProfile']['rawAttributes']);_0x8d4540['attributes']=_[_0xf9ac('0x35')](_0x4c7971[_0xf9ac('0x39')],qs[_0xf9ac('0x36')](_0x538868['query'][_0xf9ac('0x36')]));_0x8d4540['attributes']=_0x8d4540[_0xf9ac('0x37')][_0xf9ac('0x38')]?_0x8d4540['attributes']:_0x4c7971['model'];if(_0x538868['query'][_0xf9ac('0x47')]){_0x8d4540[_0xf9ac('0x4b')]=[{'all':!![]}];}_0x8d4540=_[_0xf9ac('0x42')]({},_0x8d4540,_0x538868[_0xf9ac('0x4c')]);return db[_0xf9ac('0x31')][_0xf9ac('0x4d')](_0x8d4540)[_0xf9ac('0x2a')](handleEntityNotFound(_0x255f36,null))[_0xf9ac('0x2a')](function(_0x1a2675){if(_0x1a2675){var _0x31ff22=_0x1a2675[_0xf9ac('0x51')]({'plain':!![]});_0x31ff22=qs[_0xf9ac('0x52')](_0x31ff22,['id',_0xf9ac('0x53'),'updatedAt',_0xf9ac('0x54')]);_0x538868[_0xf9ac('0x50')]=_[_0xf9ac('0x52')](_0x538868['body'],['id',_0xf9ac('0x53'),_0xf9ac('0x55')]);return db[_0xf9ac('0x56')][_0xf9ac('0x57')](function(_0x29906a){return db[_0xf9ac('0x31')][_0xf9ac('0x4f')](_[_0xf9ac('0x42')](_0x31ff22,_0x538868[_0xf9ac('0x50')]),{'include':_0x538868['query'][_0xf9ac('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x29906a})[_0xf9ac('0x2a')](function(_0xb3157f){var _0x1b7d12=_0xb3157f[_0xf9ac('0x51')]({'plain':!![]});return db[_0xf9ac('0x58')][_0xf9ac('0x48')]({'where':{'userProfileId':_0x538868['params']['id']},'raw':!![]})['then'](function(_0x2d43d6){if(_0x2d43d6){return BPromise['each'](_0x2d43d6,function(_0x10c8a2){return new BPromise(function(_0x2ecac9,_0xe33ef7){if(_0x10c8a2['autoAssociation']===null||_0x10c8a2[_0xf9ac('0x59')]===0x1)_0x2ecac9(null);return db[_0xf9ac('0x5a')]['findAll']({'where':{'sectionId':_0x10c8a2['id']},'raw':!![]})[_0xf9ac('0x2a')](function(_0x36983b){var _0x3b211c=_[_0xf9ac('0x43')](_0x36983b,function(_0x5c4252){return qs['omit'](_0x5c4252,['id',_0xf9ac('0x53'),'updatedAt',_0xf9ac('0x5b')]);});_0x2ecac9(_0x3b211c);})['catch'](function(_0x4ca949){_0xe33ef7(_0x4ca949);});})['then'](function(_0x28c7df){var _0xf22459=qs[_0xf9ac('0x52')](_0x10c8a2,['id','createdAt',_0xf9ac('0x55')]);_0xf22459['userProfileId']=_0x1b7d12['id'];if(_0x28c7df)_0xf22459['Resources']=_0x28c7df;return _0xf22459;})[_0xf9ac('0x2a')](function(_0x5b1aa3){return db['UserProfileSection'][_0xf9ac('0x4f')](_0x5b1aa3,{'include':[{'model':db[_0xf9ac('0x5a')],'as':_0xf9ac('0x5c')}],'raw':!![],'transaction':_0x29906a});});})[_0xf9ac('0x2a')](function(){return _0x1b7d12;});}});});});}})[_0xf9ac('0x2a')](respondWithResult(_0x255f36,0xc9))[_0xf9ac('0x4e')](handleError(_0x255f36,null));};exports[_0xf9ac('0x29')]=function(_0x4ffe56,_0x1b7f40){if(_0x4ffe56[_0xf9ac('0x50')]['id']){delete _0x4ffe56[_0xf9ac('0x50')]['id'];}return db[_0xf9ac('0x31')][_0xf9ac('0x4d')]({'where':{'id':_0x4ffe56[_0xf9ac('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1b7f40,null))[_0xf9ac('0x2a')](saveUpdates(_0x4ffe56['body'],null))[_0xf9ac('0x2a')](respondWithResult(_0x1b7f40,null))['catch'](handleError(_0x1b7f40,null));};exports[_0xf9ac('0x5e')]=function(_0x2bc65a,_0xbfa688){return db['UserProfile'][_0xf9ac('0x4d')]({'where':{'id':_0x2bc65a[_0xf9ac('0x5d')]['id']}})[_0xf9ac('0x2a')](handleEntityNotFound(_0xbfa688,null))[_0xf9ac('0x2a')](removeEntity(_0xbfa688,null))[_0xf9ac('0x4e')](handleError(_0xbfa688,null));};exports['describe']=function(_0x3a68cd,_0x5ce930){return db[_0xf9ac('0x31')][_0xf9ac('0x5f')]()['then'](respondWithResult(_0x5ce930,null))[_0xf9ac('0x4e')](handleError(_0x5ce930,null));};exports[_0xf9ac('0x60')]=function(_0x53138b,_0x69b7ba){var _0x2e6d29=_0x53138b[_0xf9ac('0x50')];return db[_0xf9ac('0x31')]['find']({'where':{'id':_0x53138b[_0xf9ac('0x5d')]['id']}})[_0xf9ac('0x2a')](handleEntityNotFound(_0x69b7ba,null))['then'](function(_0x101ce1){if(_0x101ce1){return db[_0xf9ac('0x56')][_0xf9ac('0x57')](function(_0x5da59a){return db[_0xf9ac('0x58')][_0xf9ac('0x5e')]({'where':{'userProfileId':_0x53138b[_0xf9ac('0x5d')]['id'],'sectionId':_[_0xf9ac('0x43')](_0x2e6d29,function(_0x214ef9){return _0x214ef9[_0xf9ac('0x5b')];})},'transaction':_0x5da59a})['then'](function(){var _0x2fc3a1=_[_0xf9ac('0x43')](_0x2e6d29,function(_0x5cb2be){_0x5cb2be[_0xf9ac('0x61')]=_0x53138b[_0xf9ac('0x5d')]['id'];return _0x5cb2be;});var _0x56d7fd=[];return BPromise[_0xf9ac('0x62')](_0x2fc3a1,function(_0x23ad9c){return db[_0xf9ac('0x58')][_0xf9ac('0x4f')](_0x23ad9c,{'include':[{'model':db[_0xf9ac('0x5a')],'as':_0xf9ac('0x5c')}],'raw':!![],'transaction':_0x5da59a})[_0xf9ac('0x2a')](function(_0x4ab95e){_0x56d7fd[_0xf9ac('0x63')](_0x4ab95e[_0xf9ac('0x51')]({'plain':!![]}));});})[_0xf9ac('0x2a')](function(){return _0x56d7fd;});});});}})[_0xf9ac('0x2a')](function(_0x2cf04b){return _0x2cf04b;})[_0xf9ac('0x2a')](respondWithResult(_0x69b7ba,null))[_0xf9ac('0x4e')](handleError(_0x69b7ba,null));};exports['removeSections']=function(_0x4a1eff,_0x9b6edd){var _0x3a9872;return db[_0xf9ac('0x31')][_0xf9ac('0x4d')]({'where':{'id':_0x4a1eff[_0xf9ac('0x5d')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x9b6edd,null))[_0xf9ac('0x2a')](function(_0x250c15){if(_0x250c15){_0x3a9872=_0x250c15;return db[_0xf9ac('0x58')][_0xf9ac('0x5e')]({'where':{'userProfileId':_0x4a1eff[_0xf9ac('0x5d')]['id'],'sectionId':_0x4a1eff[_0xf9ac('0x33')]['ids']}});}})[_0xf9ac('0x2a')](function(){return _0x3a9872;})[_0xf9ac('0x2a')](respondWithStatusCode(_0x9b6edd,null))[_0xf9ac('0x4e')](handleError(_0x9b6edd,null));};exports[_0xf9ac('0x64')]=function(_0x14d514,_0x478808){var _0x27ccd4=[];var _0x1cb5e7=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x14d514[_0xf9ac('0x5d')]['id']},'raw':!![]})[_0xf9ac('0x2a')](function(_0x3c746e){_0x27ccd4=_[_0xf9ac('0x41')](_0x3c746e,function(_0x587944){return _0x587944[_0xf9ac('0x65')]===0x1;});if(!_['isEmpty'](_0x27ccd4)){return _[_0xf9ac('0x43')](_0x27ccd4,function(_0x6c1f83){return _0x6c1f83[_0xf9ac('0x5b')];});}else{return;}})[_0xf9ac('0x2a')](function(_0x1b2117){if(_0x1b2117)_0x1cb5e7=_0x1b2117;if(_['includes'](_0x1cb5e7,0x64)){var _0x11600f=_[_0xf9ac('0x4d')](_0x27ccd4,{'sectionId':0x64});return hasDefaultDashboard(_0x11600f)[_0xf9ac('0x2a')](function(_0x52ca08){return _[_0xf9ac('0x43')](_0x27ccd4,function(_0x1c1409){if(_0x1c1409['sectionId']===0x64){_0x1c1409['subsections']=_0x52ca08;}return _0x1c1409;});});}else{return;}})['then'](function(_0x539b5f){if(_0x539b5f)_0x27ccd4=_0x539b5f;if(_['includes'](_0x1cb5e7,0x3eb)||_[_0xf9ac('0x66')](_0x27ccd4,{'enabled':![],'sectionId':0x3eb})){var _0x3827d1=_[_0xf9ac('0x4d')](_0x27ccd4,{'sectionId':0x3eb});return getCustomDashboards(_0x3827d1)[_0xf9ac('0x2a')](function(_0xb29064){return _[_0xf9ac('0x43')](_0x27ccd4,function(_0x679b3b){if(_0x679b3b[_0xf9ac('0x5b')]===0x3eb){_0x679b3b['subsections']=_0xb29064;}return _0x679b3b;});});}else{return;}})[_0xf9ac('0x2a')](function(_0x4aeaa5){if(_0x4aeaa5)_0x27ccd4=_0x4aeaa5;if(_['includes'](_0x1cb5e7,0x709)||_['some'](_0x27ccd4,{'enabled':![],'sectionId':0x709})){var _0x3a3247=_[_0xf9ac('0x4d')](_0x27ccd4,{'sectionId':0x709});return getPlugins(_0x3a3247)[_0xf9ac('0x2a')](function(_0x3b4421){return _['map'](_0x27ccd4,function(_0x5f241d){if(_0x5f241d[_0xf9ac('0x5b')]===0x709){_0x5f241d[_0xf9ac('0x67')]=_0x3b4421;}return _0x5f241d;});});}else{return;}})['then'](function(_0x447e0b){if(_0x447e0b)_0x27ccd4=_0x447e0b;return _0x27ccd4;})[_0xf9ac('0x2a')](respondWithResult(_0x478808,null))[_0xf9ac('0x4e')](handleError(_0x478808,null));};function hasDefaultDashboard(_0x2ce9df){var _0x4cdcd9=[0x65];return new BPromise(function(_0x15304b,_0x57b924){try{if(_0x2ce9df[_0xf9ac('0x59')]){_0x15304b(_0x4cdcd9);}else{return db['UserProfileResource'][_0xf9ac('0x68')]({'where':{'sectionId':_0x2ce9df['id']},'raw':!![]})[_0xf9ac('0x2a')](function(_0x186ff8){if(_0x186ff8){_0x15304b(_0x4cdcd9);}});}}catch(_0x49ca96){_0x57b924(_0x49ca96);}});}function getCustomDashboards(_0x3bc675){var _0x13625f=[];return new BPromise(function(_0xf630f7,_0xd8e4b6){try{if(_0x3bc675[_0xf9ac('0x59')]){return db[_0xf9ac('0x69')]['findAll']({'raw':!![]})[_0xf9ac('0x2a')](function(_0x2ddb48){_0x2ddb48[_0xf9ac('0x6a')](function(_0x5b54b8){_0x13625f['push'](_0x5b54b8['id']+0x1869f);});_0xf630f7(_0x13625f);});}else{return db[_0xf9ac('0x5a')]['findAll']({'where':{'sectionId':_0x3bc675['id']},'raw':!![]})[_0xf9ac('0x2a')](function(_0x36e0cd){_0x36e0cd['forEach'](function(_0x3f4592){_0x13625f['push'](_0x3f4592[_0xf9ac('0x6b')]+0x1869f);});_0xf630f7(_0x13625f);});}}catch(_0x2ff5d1){_0xd8e4b6(_0x2ff5d1);}});}function getPlugins(_0x1e8bd4){var _0x53fbb6=[];return new BPromise(function(_0x469d3a,_0x2f5c4c){try{if(_0x1e8bd4[_0xf9ac('0x59')]){return db[_0xf9ac('0x6c')][_0xf9ac('0x48')]({'raw':!![]})[_0xf9ac('0x2a')](function(_0x3f074d){_0x3f074d[_0xf9ac('0x6a')](function(_0x21b038){_0x53fbb6[_0xf9ac('0x63')](_0x21b038['id']+0x15b38);});_0x469d3a(_0x53fbb6);});}else{return db[_0xf9ac('0x5a')][_0xf9ac('0x48')]({'where':{'sectionId':_0x1e8bd4['id']},'raw':!![]})[_0xf9ac('0x2a')](function(_0x260a9b){_0x260a9b[_0xf9ac('0x6a')](function(_0x1dcc3c){_0x53fbb6[_0xf9ac('0x63')](_0x1dcc3c[_0xf9ac('0x6b')]+0x15b38);});_0x469d3a(_0x53fbb6);});}}catch(_0x101b42){_0x2f5c4c(_0x101b42);}});}exports['addResources']=function(_0x5e24b4,_0x113620){return db['UserProfile'][_0xf9ac('0x4d')]({'where':{'id':_0x5e24b4['params']['id']}})[_0xf9ac('0x2a')](handleEntityNotFound(_0x113620,null))['then'](function(_0x7b1153){if(_0x7b1153){return db[_0xf9ac('0x56')][_0xf9ac('0x57')](function(_0x5467c2){return db[_0xf9ac('0x58')][_0xf9ac('0x48')]({'where':{'userProfileId':_0x5e24b4[_0xf9ac('0x5d')]['id']},'attributes':['id'],'raw':!![]})[_0xf9ac('0x2a')](function(_0x178542){if(_0x178542){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5e24b4['params']['id'],'id':_[_0xf9ac('0x43')](_0x178542,function(_0x5dcd2d){return _0x5dcd2d['id'];})},'transaction':_0x5467c2});}})[_0xf9ac('0x2a')](function(_0x3af768){var _0x28746b=_[_0xf9ac('0x43')](_0x5e24b4[_0xf9ac('0x50')],function(_0x5af579){_0x5af579['userProfileId']=_0x5e24b4['params']['id'];return _0x5af579;});return db[_0xf9ac('0x58')][_0xf9ac('0x6d')](_0x28746b,{'raw':!![],'transaction':_0x5467c2});})[_0xf9ac('0x2a')](function(_0x3ca637){var _0x3c9e9a=_[_0xf9ac('0x41')](_[_0xf9ac('0x43')](_0x3ca637,function(_0x343d6c){return _0x343d6c[_0xf9ac('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x3c9e9a){return db[_0xf9ac('0x58')][_0xf9ac('0x48')]({'where':{'userProfileId':_0x5e24b4[_0xf9ac('0x5d')]['id'],'sectionId':_[_0xf9ac('0x43')](_0x3c9e9a,function(_0x40e216){return _0x40e216[_0xf9ac('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x2c2e42){var _0x47973c=_[_0xf9ac('0x43')](_0x5e24b4[_0xf9ac('0x50')],function(_0x26bdec){_0x26bdec[_0xf9ac('0x61')]=_0x5e24b4[_0xf9ac('0x5d')]['id'];return _0x26bdec;});return db[_0xf9ac('0x5a')]['bulkCreate'](_0x47973c,{'raw':!![],'transaction':_0x5467c2});});}})[_0xf9ac('0x4e')](handleError(_0x113620,null));});}})[_0xf9ac('0x2a')](function(_0x452327){var _0x32ff3d=_[_0xf9ac('0x43')](_0x452327,function(_0x25a974){return _0x25a974[_0xf9ac('0x51')]({'plain':!![]});});})[_0xf9ac('0x2a')](respondWithResult(_0x113620,null))[_0xf9ac('0x4e')](handleError(_0x113620,null));};exports['removeResources']=function(_0x5d6d08,_0x2781fb,_0x4447a6){return db[_0xf9ac('0x31')][_0xf9ac('0x4d')]({'where':{'id':_0x5d6d08[_0xf9ac('0x5d')]['id']}})[_0xf9ac('0x2a')](handleEntityNotFound(_0x2781fb,null))['then'](function(_0x529c23){if(_0x529c23){return _0x529c23['removeResources'](_0x5d6d08['query'][_0xf9ac('0x6e')]);}})[_0xf9ac('0x2a')](respondWithStatusCode(_0x2781fb,null))[_0xf9ac('0x4e')](handleError(_0x2781fb,null));};exports[_0xf9ac('0x6f')]=function(_0x39b67e,_0x569d2a){var _0x3e9879={'raw':![],'where':{}};var _0xc9adda={};var _0x2de819={'count':0x0,'rows':[]};var _0x503d34=_0x39b67e['query']['section'];if(typeof _0x503d34===_0xf9ac('0x70')){throw new db[(_0xf9ac('0x71'))][(_0xf9ac('0x72'))](_0xf9ac('0x73'));}var _0x769d6a=_0x39b67e[_0xf9ac('0x33')][_0xf9ac('0x74')]||![];var _0x5de903=getQueryModels(_0x503d34,_0x769d6a);if(typeof _0x5de903['childModel']===_0xf9ac('0x70')){throw new db[(_0xf9ac('0x71'))][(_0xf9ac('0x72'))](_0xf9ac('0x75')+_0x503d34+'\x27');}var _0x54ab95=[];if(!_[_0xf9ac('0x76')](_0x5de903['parentSections'])){_0x54ab95=_0x5de903['parentSections'];}else{_0x54ab95=[{'name':_0x503d34}];}return db[_0xf9ac('0x31')]['findOne']({'where':{'id':_0x39b67e[_0xf9ac('0x5d')]['id']}})[_0xf9ac('0x2a')](handleEntityNotFound(_0x569d2a,null))[_0xf9ac('0x2a')](function(_0x81dbe){if(_0x81dbe){var _0x197cb0=[];for(var _0x206783=0x0;_0x206783<_0x54ab95[_0xf9ac('0x38')];_0x206783++){_0x197cb0[_0xf9ac('0x63')](db['UserProfileSection']['findOne']({'where':{'userProfileId':_0x81dbe['id'],'name':_0x54ab95[_0x206783][_0xf9ac('0x2e')]},'raw':!![]}));}return BPromise[_0xf9ac('0x77')](_0x197cb0);}})[_0xf9ac('0x2a')](function(_0x2232f7){var _0x1d86cf=_[_0xf9ac('0x41')](_0x2232f7,function(_0x3423ec){return _0x3423ec?_0x3423ec:undefined;});var _0x196e2e=_[_0xf9ac('0x41')](_0x54ab95,[_0xf9ac('0x78'),!![]]);var _0x1dd00b=_[_0xf9ac('0x76')](_0x1d86cf)&&_['isEmpty'](_0x196e2e)?null:_['union'](_0x196e2e,_0x1d86cf);if(_0x1dd00b){var _0x3dbcce=[];for(var _0xa9cc9d=0x0;_0xa9cc9d<_0x1dd00b[_0xf9ac('0x38')];_0xa9cc9d++){var _0x1e1aff=_[_0xf9ac('0x4d')](_0x54ab95,function(_0x863171){return _0x1dd00b[_0xa9cc9d]?_0x863171[_0xf9ac('0x2e')]===_0x1dd00b[_0xa9cc9d][_0xf9ac('0x2e')]:null;});if(_0x1e1aff){if(_0x1dd00b[_0xa9cc9d][_0xf9ac('0x78')]){_0x3dbcce[_0xf9ac('0x63')](getAllResources(_0x5de903[_0xf9ac('0x79')],_0x1dd00b[_0xa9cc9d]));}else{if(!_0x1dd00b[_0xa9cc9d][_0xf9ac('0x59')]){_0x3dbcce[_0xf9ac('0x63')](getAllowedResources(_0x1e1aff,_0x1dd00b[_0xa9cc9d],_0x5de903[_0xf9ac('0x79')]));}else{if(_0x1e1aff[_0xf9ac('0x39')]){_0x3dbcce['push'](getAllFilteredResources(_0x1e1aff,_0x1dd00b[_0xa9cc9d]));}}}}}return BPromise['all'](_0x3dbcce);}else{return null;}})[_0xf9ac('0x2a')](function(_0x4e262a){var _0x3ac597=_0x4e262a;var _0x14c75d=null;if(_0x3ac597){_0x14c75d=_0x3ac597[_0xf9ac('0x38')]===0x1?_0x3ac597[0x0]:null;}if(_0x14c75d||_0x3ac597){var _0x13f6c6=db[_0x5de903[_0xf9ac('0x79')]]['rawAttributes'];_0xc9adda[_0xf9ac('0x39')]=_[_0xf9ac('0x32')](_0x13f6c6);_0xc9adda[_0xf9ac('0x33')]=_[_0xf9ac('0x32')](_0x39b67e[_0xf9ac('0x33')]);_0xc9adda[_0xf9ac('0x34')]=_[_0xf9ac('0x35')](_0xc9adda[_0xf9ac('0x39')],_0xc9adda[_0xf9ac('0x33')]);_0x3e9879[_0xf9ac('0x37')]=_[_0xf9ac('0x35')](_0xc9adda['model'],qs['fields'](_0x39b67e[_0xf9ac('0x33')]['fields']));_0x3e9879['attributes']=_0x3e9879[_0xf9ac('0x37')][_0xf9ac('0x38')]?_0x3e9879[_0xf9ac('0x37')]:_0xc9adda[_0xf9ac('0x39')];if(!_0x39b67e[_0xf9ac('0x33')][_0xf9ac('0x3a')](_0xf9ac('0x3b'))){_0x3e9879[_0xf9ac('0x3c')]=qs[_0xf9ac('0x3c')](_0x39b67e['query'][_0xf9ac('0x3c')]);_0x3e9879[_0xf9ac('0x3d')]=qs[_0xf9ac('0x3d')](_0x39b67e['query'][_0xf9ac('0x3d')]);}_0x3e9879[_0xf9ac('0x3e')]=qs[_0xf9ac('0x7a')](_0x39b67e[_0xf9ac('0x33')][_0xf9ac('0x7a')]);_0x3e9879[_0xf9ac('0x3f')]=qs[_0xf9ac('0x34')](_['pick'](_0x39b67e[_0xf9ac('0x33')],_0xc9adda[_0xf9ac('0x34')]));if(_0x39b67e['query'][_0xf9ac('0x41')]){_0x3e9879[_0xf9ac('0x3f')]=_[_0xf9ac('0x42')](_0x3e9879[_0xf9ac('0x3f')],{'$or':_[_0xf9ac('0x43')](_0x13f6c6,function(_0x4b8363){if(_0x4b8363[_0xf9ac('0x44')][_0xf9ac('0x45')]!==_0xf9ac('0x7b')){var _0x32f758={};_0x32f758[_0x4b8363[_0xf9ac('0x46')]]={'$like':'%'+_0x39b67e[_0xf9ac('0x33')][_0xf9ac('0x41')]+'%'};return _0x32f758;}})});}var _0x381d2a=[];if(_0x14c75d){var _0x1bbc1e=_['find'](_0x54ab95,[_0xf9ac('0x2e'),_0x14c75d['name']]);if(_0x1bbc1e[_0xf9ac('0x46')]){var _0x361da3={};if(_0x5de903[_0xf9ac('0x79')]===_0xf9ac('0x7c')){_0x361da3[_0x1bbc1e[_0xf9ac('0x7d')]]=_['map'](_0x14c75d['associatedResources'],'id');}else{_0x361da3[_0x1bbc1e[_0xf9ac('0x7d')]]=_0x14c75d[_0xf9ac('0x7e')];}_0x381d2a[_0xf9ac('0x63')](_0x361da3);}else{_0x3e9879[_0xf9ac('0x3f')]['id']=_0x14c75d[_0xf9ac('0x7e')];}}else{for(var _0x5d6081=0x0;_0x5d6081<_0x3ac597[_0xf9ac('0x38')];_0x5d6081++){var _0x1bbc1e=_['find'](_0x54ab95,[_0xf9ac('0x2e'),_0x3ac597[_0x5d6081]['name']]);if(_0x1bbc1e[_0xf9ac('0x46')]){var _0x361da3={};_0x361da3[_0x1bbc1e[_0xf9ac('0x7d')]]=_0x3ac597[_0x5d6081][_0xf9ac('0x7e')];_0x381d2a[_0xf9ac('0x63')](_0x361da3);}else{if(!_0x3e9879[_0xf9ac('0x3f')]['id'])_0x3e9879[_0xf9ac('0x3f')]['id']=[];_0x3ac597[_0x5d6081][_0xf9ac('0x7e')][_0xf9ac('0x6a')](function(_0x40c47d){_0x3e9879['where']['id'][_0xf9ac('0x63')](_0x40c47d);});}}}if(!_[_0xf9ac('0x76')](_0x381d2a)){_0x3e9879[_0xf9ac('0x3f')]=_[_0xf9ac('0x42')](_0x3e9879[_0xf9ac('0x3f')],{'$and':{'$or':_0x381d2a}});}_0x3e9879=_[_0xf9ac('0x42')]({},_0x3e9879,_0x39b67e[_0xf9ac('0x4c')]);if(_0x14c75d&&!_0x14c75d[_0xf9ac('0x59')]&&_0x5de903[_0xf9ac('0x79')]===_0xf9ac('0x7c')){if(_0x39b67e[_0xf9ac('0x33')]['includeAll']){_0x3e9879[_0xf9ac('0x4b')]=[{'all':!![]}];}return db[_0x5de903[_0xf9ac('0x79')]][_0xf9ac('0x48')](_0x3e9879)['then'](function(_0x395015){var _0x17bf8d=[];_0x395015[_0xf9ac('0x6a')](function(_0x4627c3){var _0x598ac2;switch(_0x4627c3['reportType']){case _0xf9ac('0x7f'):_0x598ac2=_[_0xf9ac('0x4d')](_0x14c75d['associatedResources'],function(_0x1bc442){return _0x1bc442['id']===_0x4627c3[_0xf9ac('0x80')]&&_0x1bc442[_0xf9ac('0x44')]==='DefaultReports';});break;case _0xf9ac('0x81'):_0x598ac2=_[_0xf9ac('0x4d')](_0x14c75d[_0xf9ac('0x7e')],function(_0x1ff478){return _0x1ff478['id']===_0x4627c3[_0xf9ac('0x80')]&&_0x1ff478['type']==='CustomReports';});break;}if(_0x598ac2)_0x17bf8d['push'](_0x4627c3);});_0x2de819[_0xf9ac('0x23')]=_0x17bf8d[_0xf9ac('0x38')];_0x2de819[_0xf9ac('0x49')]=_0x17bf8d;return _0x2de819;});}else{return db[_0x5de903[_0xf9ac('0x79')]][_0xf9ac('0x23')]({'where':_0x3e9879['where']})[_0xf9ac('0x2a')](function(_0x1fd282){_0x2de819[_0xf9ac('0x23')]=_0x1fd282;if(_0x39b67e[_0xf9ac('0x33')][_0xf9ac('0x47')]){if(_0x5de903[_0xf9ac('0x79')]===_0xf9ac('0x82')){_0x3e9879[_0xf9ac('0x4b')]=[{'model':db[_0xf9ac('0x83')],'as':_0xf9ac('0x84'),'attributes':['id',_0xf9ac('0x2e'),_0xf9ac('0x85')],'required':_0x39b67e[_0xf9ac('0x33')][_0xf9ac('0x86')]?!![]:![]},{'model':db[_0xf9ac('0x83')],'as':_0xf9ac('0x87'),'attributes':['id',_0xf9ac('0x2e'),_0xf9ac('0x85')],'through':_0x39b67e[_0xf9ac('0x33')]['tag']?{'attributes':[],'where':{'TagId':_0x39b67e[_0xf9ac('0x33')]['tag']||undefined}}:{},'required':_0x39b67e['query'][_0xf9ac('0x86')]?!![]:![]}];}else{_0x3e9879[_0xf9ac('0x4b')]=[{'all':!![]}];}}return db[_0x5de903['childModel']]['findAll'](_0x3e9879);})[_0xf9ac('0x2a')](function(_0x318813){_0x2de819['rows']=_0x318813;return _0x2de819;});}}else{return _0x2de819;}})['then'](respondWithFilteredResult(_0x569d2a,_0x3e9879))['catch'](handleError(_0x569d2a,null));};function getAllResources(_0x26fcb6,_0x4c5521){return new BPromise(function(_0x2716da,_0x35db5d){if(_0x4c5521){var _0x56a198=_0x4c5521['filter']?{[_0x4c5521[_0xf9ac('0x41')][_0xf9ac('0x46')]]:_0x4c5521[_0xf9ac('0x41')][_0xf9ac('0x88')]}:undefined;return db[_0x26fcb6][_0xf9ac('0x48')]({'where':_0x56a198,'raw':!![]})[_0xf9ac('0x2a')](function(_0x4e01ec){_0x4c5521[_0xf9ac('0x7e')]=_[_0xf9ac('0x43')](_0x4e01ec,'id');_0x2716da(_0x4c5521);})[_0xf9ac('0x4e')](function(_0x33018d){_0x35db5d(_0x33018d);});}else{_0x2716da(null);}});}function getAllFilteredResources(_0x516d87,_0x33189c){return new BPromise(function(_0x842898,_0x31d828){var _0x23c4ff=_0x516d87[_0xf9ac('0x41')]?{[_0x516d87[_0xf9ac('0x41')][_0xf9ac('0x46')]]:_0x516d87[_0xf9ac('0x41')][_0xf9ac('0x88')]}:undefined;return db[_0x516d87[_0xf9ac('0x39')]]['findAll']({'where':_0x23c4ff,'raw':!![]})[_0xf9ac('0x2a')](function(_0x54f3da){_0x33189c['associatedResources']=_[_0xf9ac('0x43')](_0x54f3da,function(_0x306df0){return _0x306df0[_0xf9ac('0x2e')];});_0x842898(_0x33189c);})[_0xf9ac('0x4e')](function(_0x38c1b1){_0x31d828(_0x38c1b1);});});}function getAllowedResources(_0x40a52a,_0x265ced,_0xe7d6fa){return new BPromise(function(_0x255cb8,_0x16df5a){if(_0x265ced){return db['UserProfileResource'][_0xf9ac('0x48')]({'where':{'sectionId':_0x265ced['id']},'raw':!![]})['then'](function(_0x2bb542){if(_0x40a52a[_0xf9ac('0x46')]&&_0x40a52a[_0xf9ac('0x46')]!=='id'){_0x265ced[_0xf9ac('0x7e')]=_['map'](_0x2bb542,function(_0x151e1b){return _0x151e1b[_0x40a52a['field']];});}else{if(_0xe7d6fa===_0xf9ac('0x7c')){_0x265ced[_0xf9ac('0x7e')]=_['map'](_0x2bb542,function(_0x44c5a1){return{'id':_0x44c5a1['resourceId'],'type':_0x44c5a1[_0xf9ac('0x44')]};});}else{_0x265ced[_0xf9ac('0x7e')]=_['map'](_0x2bb542,function(_0x47e064){return _0x47e064[_0xf9ac('0x6b')];});}}_0x255cb8(_0x265ced);})[_0xf9ac('0x4e')](function(_0x34b074){_0x16df5a(_0x34b074);});}else{_0x255cb8(null);}});}function getQueryModels(_0x28449f,_0x2adeb9){var _0x251264=_0x28449f[_0xf9ac('0x89')]();var _0x4d4c8a={'childModel':undefined,'parentSections':[]};switch(_0x251264){case _0xf9ac('0x8a'):_0x4d4c8a['childModel']=_0xf9ac('0x8b');break;case'odbc':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x8c');break;case'squarerecordings':_0x4d4c8a['childModel']='SquareRecording';_0x4d4c8a[_0xf9ac('0x8d')]=[{'name':_0xf9ac('0x8e'),'field':_0xf9ac('0x2e'),'foreignKey':'projectName'}];break;case _0xf9ac('0x8f'):_0x4d4c8a['childModel']='JscriptyProject';break;case'contacts':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x82');_0x4d4c8a['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xf9ac('0x90')}];break;case _0xf9ac('0x91'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x92');break;case _0xf9ac('0x93'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x94');break;case _0xf9ac('0x95'):_0x4d4c8a[_0xf9ac('0x79')]='CmCustomField';break;case _0xf9ac('0x96'):_0x4d4c8a[_0xf9ac('0x79')]='ChatQueue';break;case'chatwebsites':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x97');break;case _0xf9ac('0x98'):_0x4d4c8a['childModel']='FaxQueue';break;case _0xf9ac('0x99'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x9a');break;case _0xf9ac('0x9b'):case _0xf9ac('0x9c'):case'outboundroutes':_0x4d4c8a['childModel']=_0xf9ac('0x9d');break;case _0xf9ac('0x9e'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x9f');break;case _0xf9ac('0xa0'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xa1');break;case _0xf9ac('0xa2'):_0x4d4c8a[_0xf9ac('0x79')]='VoiceRecording';_0x4d4c8a['parentSections']=[{'name':_0xf9ac('0xa3'),'field':_0xf9ac('0x2e'),'foreignKey':'membername','model':_0xf9ac('0xa4'),'filter':{'field':_0xf9ac('0xa5'),'value':[_0xf9ac('0xa6')]}},{'name':_0xf9ac('0xa7'),'field':_0xf9ac('0x2e'),'foreignKey':_0xf9ac('0xa8'),'model':_0xf9ac('0xa4'),'filter':{'field':_0xf9ac('0xa5'),'value':[_0xf9ac('0xa9')]}},{'name':_0xf9ac('0xaa'),'field':'name','foreignKey':_0xf9ac('0xab'),'model':_0xf9ac('0xac'),'filter':{'field':_0xf9ac('0x44'),'value':['inbound']}},{'name':_0xf9ac('0xad'),'field':_0xf9ac('0x2e'),'foreignKey':_0xf9ac('0xab'),'model':_0xf9ac('0xac'),'filter':{'field':_0xf9ac('0x44'),'value':[_0xf9ac('0xae')]}}];break;case _0xf9ac('0xaf'):_0x4d4c8a[_0xf9ac('0x79')]='VoiceMusicOnHold';break;case _0xf9ac('0xb0'):_0x4d4c8a[_0xf9ac('0x79')]='VoiceChanSpy';break;case _0xf9ac('0xb1'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xb2');break;case _0xf9ac('0xb3'):_0x4d4c8a['childModel']=_0xf9ac('0xb4');break;case _0xf9ac('0xb5'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xb6');break;case'mailaccounts':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xb7');break;case _0xf9ac('0xb8'):_0x4d4c8a['childModel']=_0xf9ac('0xb9');break;case _0xf9ac('0xba'):_0x4d4c8a['childModel']=_0xf9ac('0xbb');break;case _0xf9ac('0xbc'):_0x4d4c8a[_0xf9ac('0x79')]='OpenchannelAccount';break;case _0xf9ac('0xbd'):_0x4d4c8a[_0xf9ac('0x79')]='SmsQueue';break;case _0xf9ac('0xbe'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xbf');break;case'teams':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xc0');break;case _0xf9ac('0xc1'):case'queuecampaigns':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xac');if(_0x2adeb9){_0x4d4c8a['parentSections']=[{'name':_0xf9ac('0xaa')},{'name':_0xf9ac('0xad')}];}break;case _0xf9ac('0xc2'):case'agents':case _0xf9ac('0xc3'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xa4');if(_0x2adeb9){_0x4d4c8a[_0xf9ac('0x8d')]=[{'name':_0xf9ac('0xc4'),'filter':{'field':_0xf9ac('0xa5'),'value':[_0xf9ac('0xc5'),_0xf9ac('0xc6')]},'ignore':!![]},{'name':'Agents'},{'name':_0xf9ac('0xa7')}];}break;case _0xf9ac('0xc7'):_0x4d4c8a['childModel']='ZendeskAccount';break;case _0xf9ac('0xc8'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xc9');break;case'freshdeskaccounts':_0x4d4c8a[_0xf9ac('0x79')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x4d4c8a['childModel']=_0xf9ac('0xca');break;case _0xf9ac('0xcb'):_0x4d4c8a[_0xf9ac('0x79')]='DeskAccount';break;case _0xf9ac('0xcc'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xcd');break;case'vtigeraccounts':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xa4');break;case _0xf9ac('0xce'):_0x4d4c8a[_0xf9ac('0x79')]='CannedAnswer';break;case _0xf9ac('0xcf'):_0x4d4c8a['childModel']='Disposition';break;case _0xf9ac('0xd0'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x69');break;case _0xf9ac('0xd1'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xd2');break;case _0xf9ac('0xd3'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xd4');break;case'scheduler':_0x4d4c8a['childModel']=_0xf9ac('0xd5');break;case'sounds':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xd6');break;case _0xf9ac('0xd7'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0x83');break;case _0xf9ac('0xd8'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xd9');break;case _0xf9ac('0xda'):_0x4d4c8a['childModel']=_0xf9ac('0xdb');break;case'trunks':_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xdc');break;case _0xf9ac('0xdd'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xde');break;case _0xf9ac('0xdf'):_0x4d4c8a['childModel']=_0xf9ac('0x6c');break;case'extractedreports':_0x4d4c8a[_0xf9ac('0x79')]='AnalyticExtractedReport';_0x4d4c8a[_0xf9ac('0x8d')]=[{'name':_0xf9ac('0xe0'),'field':'id','foreignKey':_0xf9ac('0x80')}];break;case _0xf9ac('0xe1'):_0x4d4c8a[_0xf9ac('0x79')]=_0xf9ac('0xe2');break;default:return _0x4d4c8a;}return _0x4d4c8a;} \ No newline at end of file +var _0x90a0=['Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','union','ignore','all','AnalyticExtractedReport','associatedResources','foreignKey','default','reportId','DefaultReports','custom','CustomReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','odbc','SquareOdbc','squarerecordings','projectName','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','contexts','VoiceContext','VoiceMail','voicerecordings','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','deskaccounts','ZohoAccount','dispositions','Disposition','intervals','Interval','scheduler','sounds','Sound','tags','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','set','json','apply','reject','save','destroy','then','error','stack','name','send','index','UserProfile','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','show','params','length','find','create','body','clone','include','get','createdAt','crudPermissions','omit','updatedAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','catch','userProfileId','Resources','update','describe','addSections','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','some','findOne'];(function(_0xf73390,_0x14c109){var _0x4b212f=function(_0x3e2b63){while(--_0x3e2b63){_0xf73390['push'](_0xf73390['shift']());}};_0x4b212f(++_0x14c109);}(_0x90a0,0x166));var _0x090a=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x90a0[_0x1562a2];return _0x39a636;};'use strict';var pdf=require(_0x090a('0x0'));var emlformat=require(_0x090a('0x1'));var rimraf=require(_0x090a('0x2'));var zipdir=require(_0x090a('0x3'));var jsonpatch=require(_0x090a('0x4'));var rp=require(_0x090a('0x5'));var moment=require(_0x090a('0x6'));var BPromise=require(_0x090a('0x7'));var Mustache=require(_0x090a('0x8'));var util=require(_0x090a('0x9'));var path=require(_0x090a('0xa'));var sox=require(_0x090a('0xb'));var csv=require(_0x090a('0xc'));var ejs=require(_0x090a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x090a('0xe'));var crypto=require('crypto');var jsforce=require(_0x090a('0xf'));var deskjs=require(_0x090a('0x10'));var toCsv=require(_0x090a('0xc'));var querystring=require(_0x090a('0x11'));var Papa=require(_0x090a('0x12'));var Redis=require(_0x090a('0x13'));var authService=require(_0x090a('0x14'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x090a('0x15'));var logger=require(_0x090a('0x16'))(_0x090a('0x17'));var utils=require(_0x090a('0x18'));var config=require('../../config/environment');var db=require(_0x090a('0x19'))['db'];config[_0x090a('0x1a')]=_[_0x090a('0x1b')](config['redis'],{'host':_0x090a('0x1c'),'port':0x18eb});var socket=require(_0x090a('0x1d'))(new Redis(config[_0x090a('0x1a')]));require('./userProfile.socket')[_0x090a('0x1e')](socket);function respondWithStatusCode(_0x57c336,_0x279449){_0x279449=_0x279449||0xcc;return function(_0x12a418){if(_0x12a418){return _0x57c336[_0x090a('0x1f')](_0x279449);}return _0x57c336[_0x090a('0x20')](_0x279449)[_0x090a('0x21')]();};}function respondWithResult(_0x249dee,_0x513cb9){_0x513cb9=_0x513cb9||0xc8;return function(_0x519813){if(_0x519813){return _0x249dee['status'](_0x513cb9)['json'](_0x519813);}};}function respondWithFilteredResult(_0x6d30d5,_0x3b3581){return function(_0x288522){if(_0x288522){var _0x3dfbac=_0x288522[_0x090a('0x22')],_0x133b60=_0x3b3581[_0x090a('0x23')],_0x2024a0=_0x3b3581[_0x090a('0x23')]+_0x3b3581['limit'],_0x40881a;if(_0x2024a0>=_0x3dfbac){_0x2024a0=_0x3dfbac;_0x40881a=0xc8;}else{_0x40881a=0xce;}_0x6d30d5['status'](_0x40881a);return _0x6d30d5[_0x090a('0x24')]('Content-Range',_0x133b60+'-'+_0x2024a0+'/'+_0x3dfbac)[_0x090a('0x25')](_0x288522);}return null;};}function patchUpdates(_0x492ba3){return function(_0x5bc57a){try{jsonpatch[_0x090a('0x26')](_0x5bc57a,_0x492ba3,!![]);}catch(_0x49b3cb){return BPromise[_0x090a('0x27')](_0x49b3cb);}return _0x5bc57a[_0x090a('0x28')]();};}function saveUpdates(_0x154d54,_0x19f0dc){return function(_0x372429){if(_0x372429){return _0x372429['update'](_0x154d54)['then'](function(_0x833f03){return _0x833f03;});}return null;};}function removeEntity(_0x2a4d06,_0x5ba94a){return function(_0x135684){if(_0x135684){return _0x135684[_0x090a('0x29')]()[_0x090a('0x2a')](function(){_0x2a4d06[_0x090a('0x20')](0xcc)[_0x090a('0x21')]();});}};}function handleEntityNotFound(_0x37d2e6,_0x472ae8){return function(_0x517ea8){if(!_0x517ea8){_0x37d2e6[_0x090a('0x1f')](0x194);}return _0x517ea8;};}function handleError(_0x18e567,_0x1d4b18){_0x1d4b18=_0x1d4b18||0x1f4;return function(_0x3ee8db){logger[_0x090a('0x2b')](_0x3ee8db[_0x090a('0x2c')]);if(_0x3ee8db[_0x090a('0x2d')]){delete _0x3ee8db[_0x090a('0x2d')];}_0x18e567[_0x090a('0x20')](_0x1d4b18)[_0x090a('0x2e')](_0x3ee8db);};}exports[_0x090a('0x2f')]=function(_0x2af5c2,_0x27b6ff){var _0x2c0d7f={},_0x124756={},_0x176825={'count':0x0,'rows':[]};var _0x589758=db[_0x090a('0x30')][_0x090a('0x31')];_0x124756[_0x090a('0x32')]=_[_0x090a('0x33')](_0x589758);_0x124756[_0x090a('0x34')]=_[_0x090a('0x33')](_0x2af5c2[_0x090a('0x34')]);_0x124756['filters']=_[_0x090a('0x35')](_0x124756[_0x090a('0x32')],_0x124756[_0x090a('0x34')]);_0x2c0d7f[_0x090a('0x36')]=_[_0x090a('0x35')](_0x124756['model'],qs[_0x090a('0x37')](_0x2af5c2[_0x090a('0x34')]['fields']));_0x2c0d7f[_0x090a('0x36')]=_0x2c0d7f[_0x090a('0x36')]['length']?_0x2c0d7f['attributes']:_0x124756['model'];if(!_0x2af5c2['query'][_0x090a('0x38')](_0x090a('0x39'))){_0x2c0d7f[_0x090a('0x3a')]=qs[_0x090a('0x3a')](_0x2af5c2[_0x090a('0x34')][_0x090a('0x3a')]);_0x2c0d7f[_0x090a('0x23')]=qs[_0x090a('0x23')](_0x2af5c2['query']['offset']);}_0x2c0d7f[_0x090a('0x3b')]=qs[_0x090a('0x3c')](_0x2af5c2[_0x090a('0x34')][_0x090a('0x3c')]);_0x2c0d7f[_0x090a('0x3d')]=qs[_0x090a('0x3e')](_[_0x090a('0x3f')](_0x2af5c2[_0x090a('0x34')],_0x124756[_0x090a('0x3e')]));if(_0x2af5c2[_0x090a('0x34')][_0x090a('0x40')]){_0x2c0d7f['where']=_[_0x090a('0x41')](_0x2c0d7f['where'],{'$or':_[_0x090a('0x42')](_0x589758,function(_0x106e0b){if(_0x106e0b[_0x090a('0x43')][_0x090a('0x44')]!==_0x090a('0x45')){var _0x4bd757={};_0x4bd757[_0x106e0b[_0x090a('0x46')]]={'$like':'%'+_0x2af5c2[_0x090a('0x34')][_0x090a('0x40')]+'%'};return _0x4bd757;}})});}_0x2c0d7f=_['merge']({},_0x2c0d7f,_0x2af5c2[_0x090a('0x47')]);var _0x5cdf0b={'where':_0x2c0d7f[_0x090a('0x3d')]};return db['UserProfile'][_0x090a('0x22')](_0x5cdf0b)[_0x090a('0x2a')](function(_0x2fdd11){_0x176825[_0x090a('0x22')]=_0x2fdd11;if(_0x2af5c2[_0x090a('0x34')][_0x090a('0x48')]){_0x2c0d7f['include']=[{'all':!![]}];}return db[_0x090a('0x30')]['findAll'](_0x2c0d7f);})[_0x090a('0x2a')](function(_0x35e0d1){_0x176825['rows']=_0x35e0d1;return _0x176825;})[_0x090a('0x2a')](respondWithFilteredResult(_0x27b6ff,_0x2c0d7f))['catch'](handleError(_0x27b6ff,null));};exports[_0x090a('0x49')]=function(_0x7cd069,_0x283eea){var _0x16ad32={'raw':![],'where':{'id':_0x7cd069[_0x090a('0x4a')]['id']}},_0x31ddea={};_0x31ddea['model']=_[_0x090a('0x33')](db[_0x090a('0x30')][_0x090a('0x31')]);_0x31ddea[_0x090a('0x34')]=_[_0x090a('0x33')](_0x7cd069[_0x090a('0x34')]);_0x31ddea[_0x090a('0x3e')]=_[_0x090a('0x35')](_0x31ddea[_0x090a('0x32')],_0x31ddea['query']);_0x16ad32[_0x090a('0x36')]=_[_0x090a('0x35')](_0x31ddea[_0x090a('0x32')],qs[_0x090a('0x37')](_0x7cd069[_0x090a('0x34')][_0x090a('0x37')]));_0x16ad32[_0x090a('0x36')]=_0x16ad32[_0x090a('0x36')][_0x090a('0x4b')]?_0x16ad32['attributes']:_0x31ddea[_0x090a('0x32')];if(_0x7cd069['query'][_0x090a('0x48')]){_0x16ad32['include']=[{'all':!![]}];}_0x16ad32=_[_0x090a('0x41')]({},_0x16ad32,_0x7cd069[_0x090a('0x47')]);return db[_0x090a('0x30')][_0x090a('0x4c')](_0x16ad32)['then'](handleEntityNotFound(_0x283eea,null))[_0x090a('0x2a')](respondWithResult(_0x283eea,null))['catch'](handleError(_0x283eea,null));};exports[_0x090a('0x4d')]=function(_0x280fb3,_0x2bd854){return db[_0x090a('0x30')][_0x090a('0x4d')](_0x280fb3[_0x090a('0x4e')],{})[_0x090a('0x2a')](respondWithResult(_0x2bd854,0xc9))['catch'](handleError(_0x2bd854,null));};exports[_0x090a('0x4f')]=function(_0x519a93,_0x316800){var _0x4ed02e={'raw':![],'where':{'id':_0x519a93[_0x090a('0x4a')]['id']}},_0x36c517={};_0x36c517[_0x090a('0x32')]=_[_0x090a('0x33')](db['UserProfile'][_0x090a('0x31')]);_0x4ed02e[_0x090a('0x36')]=_[_0x090a('0x35')](_0x36c517[_0x090a('0x32')],qs[_0x090a('0x37')](_0x519a93[_0x090a('0x34')][_0x090a('0x37')]));_0x4ed02e[_0x090a('0x36')]=_0x4ed02e['attributes']['length']?_0x4ed02e[_0x090a('0x36')]:_0x36c517[_0x090a('0x32')];if(_0x519a93['query'][_0x090a('0x48')]){_0x4ed02e[_0x090a('0x50')]=[{'all':!![]}];}_0x4ed02e=_[_0x090a('0x41')]({},_0x4ed02e,_0x519a93[_0x090a('0x47')]);return db[_0x090a('0x30')][_0x090a('0x4c')](_0x4ed02e)[_0x090a('0x2a')](handleEntityNotFound(_0x316800,null))[_0x090a('0x2a')](function(_0x271d72){if(_0x271d72){var _0x2fb925=_0x271d72[_0x090a('0x51')]({'plain':!![]});_0x2fb925=qs['omit'](_0x2fb925,['id',_0x090a('0x52'),'updatedAt',_0x090a('0x53')]);_0x519a93[_0x090a('0x4e')]=_[_0x090a('0x54')](_0x519a93[_0x090a('0x4e')],['id',_0x090a('0x52'),_0x090a('0x55')]);return db[_0x090a('0x56')][_0x090a('0x57')](function(_0x2e6e65){return db['UserProfile'][_0x090a('0x4d')](_['merge'](_0x2fb925,_0x519a93[_0x090a('0x4e')]),{'include':_0x519a93[_0x090a('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2e6e65})[_0x090a('0x2a')](function(_0x52a2ce){var _0x212e5d=_0x52a2ce[_0x090a('0x51')]({'plain':!![]});return db[_0x090a('0x58')][_0x090a('0x59')]({'where':{'userProfileId':_0x519a93['params']['id']},'raw':!![]})[_0x090a('0x2a')](function(_0x5a374e){if(_0x5a374e){return BPromise[_0x090a('0x5a')](_0x5a374e,function(_0x772ae9){return new BPromise(function(_0x5079bd,_0x4dcb81){if(_0x772ae9['autoAssociation']===null||_0x772ae9[_0x090a('0x5b')]===0x1)_0x5079bd(null);return db[_0x090a('0x5c')][_0x090a('0x59')]({'where':{'sectionId':_0x772ae9['id']},'raw':!![]})['then'](function(_0x5336a3){var _0xb67638=_[_0x090a('0x42')](_0x5336a3,function(_0x3a9bb2){return qs['omit'](_0x3a9bb2,['id','createdAt','updatedAt',_0x090a('0x5d')]);});_0x5079bd(_0xb67638);})[_0x090a('0x5e')](function(_0x29373d){_0x4dcb81(_0x29373d);});})[_0x090a('0x2a')](function(_0x45e1d9){var _0x48bcb8=qs[_0x090a('0x54')](_0x772ae9,['id','createdAt',_0x090a('0x55')]);_0x48bcb8[_0x090a('0x5f')]=_0x212e5d['id'];if(_0x45e1d9)_0x48bcb8[_0x090a('0x60')]=_0x45e1d9;return _0x48bcb8;})[_0x090a('0x2a')](function(_0x450744){return db['UserProfileSection'][_0x090a('0x4d')](_0x450744,{'include':[{'model':db['UserProfileResource'],'as':_0x090a('0x60')}],'raw':!![],'transaction':_0x2e6e65});});})[_0x090a('0x2a')](function(){return _0x212e5d;});}});});});}})['then'](respondWithResult(_0x316800,0xc9))[_0x090a('0x5e')](handleError(_0x316800,null));};exports[_0x090a('0x61')]=function(_0x9e995e,_0x125cbf){if(_0x9e995e[_0x090a('0x4e')]['id']){delete _0x9e995e[_0x090a('0x4e')]['id'];}return db[_0x090a('0x30')][_0x090a('0x4c')]({'where':{'id':_0x9e995e[_0x090a('0x4a')]['id']}})[_0x090a('0x2a')](handleEntityNotFound(_0x125cbf,null))[_0x090a('0x2a')](saveUpdates(_0x9e995e[_0x090a('0x4e')],null))[_0x090a('0x2a')](respondWithResult(_0x125cbf,null))[_0x090a('0x5e')](handleError(_0x125cbf,null));};exports[_0x090a('0x29')]=function(_0x1a134d,_0x5ac582){return db[_0x090a('0x30')]['find']({'where':{'id':_0x1a134d[_0x090a('0x4a')]['id']}})[_0x090a('0x2a')](handleEntityNotFound(_0x5ac582,null))[_0x090a('0x2a')](removeEntity(_0x5ac582,null))['catch'](handleError(_0x5ac582,null));};exports[_0x090a('0x62')]=function(_0x21ab64,_0x16d268){return db[_0x090a('0x30')]['describe']()[_0x090a('0x2a')](respondWithResult(_0x16d268,null))[_0x090a('0x5e')](handleError(_0x16d268,null));};exports[_0x090a('0x63')]=function(_0x4f0d94,_0x3cfe4e){var _0x31ada9=_0x4f0d94[_0x090a('0x4e')];return db[_0x090a('0x30')][_0x090a('0x4c')]({'where':{'id':_0x4f0d94[_0x090a('0x4a')]['id']}})[_0x090a('0x2a')](handleEntityNotFound(_0x3cfe4e,null))[_0x090a('0x2a')](function(_0x5ea90b){if(_0x5ea90b){return db[_0x090a('0x56')][_0x090a('0x57')](function(_0x13b0c7){return db[_0x090a('0x58')][_0x090a('0x29')]({'where':{'userProfileId':_0x4f0d94[_0x090a('0x4a')]['id'],'sectionId':_['map'](_0x31ada9,function(_0x543e99){return _0x543e99[_0x090a('0x5d')];})},'transaction':_0x13b0c7})[_0x090a('0x2a')](function(){var _0x2cd6ac=_['map'](_0x31ada9,function(_0x369008){_0x369008[_0x090a('0x5f')]=_0x4f0d94['params']['id'];return _0x369008;});var _0x240af4=[];return BPromise['each'](_0x2cd6ac,function(_0x1eda27){return db[_0x090a('0x58')][_0x090a('0x4d')](_0x1eda27,{'include':[{'model':db[_0x090a('0x5c')],'as':_0x090a('0x60')}],'raw':!![],'transaction':_0x13b0c7})[_0x090a('0x2a')](function(_0x5e7bef){_0x240af4[_0x090a('0x64')](_0x5e7bef[_0x090a('0x51')]({'plain':!![]}));});})['then'](function(){return _0x240af4;});});});}})[_0x090a('0x2a')](function(_0x653e2){return _0x653e2;})[_0x090a('0x2a')](respondWithResult(_0x3cfe4e,null))[_0x090a('0x5e')](handleError(_0x3cfe4e,null));};exports[_0x090a('0x65')]=function(_0x52cad0,_0x5a4d9c){var _0x44acf8;return db[_0x090a('0x30')][_0x090a('0x4c')]({'where':{'id':_0x52cad0[_0x090a('0x4a')]['id']},'attributes':['id',_0x090a('0x2d')]})[_0x090a('0x2a')](handleEntityNotFound(_0x5a4d9c,null))['then'](function(_0x4d6a45){if(_0x4d6a45){_0x44acf8=_0x4d6a45;return db[_0x090a('0x58')][_0x090a('0x29')]({'where':{'userProfileId':_0x52cad0['params']['id'],'sectionId':_0x52cad0['query'][_0x090a('0x66')]}});}})[_0x090a('0x2a')](function(){return _0x44acf8;})[_0x090a('0x2a')](respondWithStatusCode(_0x5a4d9c,null))[_0x090a('0x5e')](handleError(_0x5a4d9c,null));};exports[_0x090a('0x67')]=function(_0x39d460,_0x13bd76){var _0x56fa50=[];var _0x87e5dd=[];return db['UserProfileSection'][_0x090a('0x59')]({'where':{'userProfileId':_0x39d460['params']['id']},'raw':!![]})[_0x090a('0x2a')](function(_0x104b8e){_0x56fa50=_[_0x090a('0x40')](_0x104b8e,function(_0x54131e){return _0x54131e[_0x090a('0x68')]===0x1;});if(!_[_0x090a('0x69')](_0x56fa50)){return _['map'](_0x56fa50,function(_0x184b4c){return _0x184b4c[_0x090a('0x5d')];});}else{return;}})[_0x090a('0x2a')](function(_0x47b4da){if(_0x47b4da)_0x87e5dd=_0x47b4da;if(_[_0x090a('0x6a')](_0x87e5dd,0x64)){var _0x5a92a7=_['find'](_0x56fa50,{'sectionId':0x64});return hasDefaultDashboard(_0x5a92a7)[_0x090a('0x2a')](function(_0x4bf0d2){return _[_0x090a('0x42')](_0x56fa50,function(_0x31a733){if(_0x31a733[_0x090a('0x5d')]===0x64){_0x31a733[_0x090a('0x6b')]=_0x4bf0d2;}return _0x31a733;});});}else{return;}})[_0x090a('0x2a')](function(_0x4d4172){if(_0x4d4172)_0x56fa50=_0x4d4172;if(_[_0x090a('0x6a')](_0x87e5dd,0x3eb)||_[_0x090a('0x6c')](_0x56fa50,{'enabled':![],'sectionId':0x3eb})){var _0x3eb011=_['find'](_0x56fa50,{'sectionId':0x3eb});return getCustomDashboards(_0x3eb011)[_0x090a('0x2a')](function(_0x474290){return _[_0x090a('0x42')](_0x56fa50,function(_0x4391bf){if(_0x4391bf[_0x090a('0x5d')]===0x3eb){_0x4391bf[_0x090a('0x6b')]=_0x474290;}return _0x4391bf;});});}else{return;}})[_0x090a('0x2a')](function(_0x131ef2){if(_0x131ef2)_0x56fa50=_0x131ef2;if(_[_0x090a('0x6a')](_0x87e5dd,0x709)||_[_0x090a('0x6c')](_0x56fa50,{'enabled':![],'sectionId':0x709})){var _0x250c64=_[_0x090a('0x4c')](_0x56fa50,{'sectionId':0x709});return getPlugins(_0x250c64)[_0x090a('0x2a')](function(_0x23a497){return _[_0x090a('0x42')](_0x56fa50,function(_0x4db2d9){if(_0x4db2d9[_0x090a('0x5d')]===0x709){_0x4db2d9[_0x090a('0x6b')]=_0x23a497;}return _0x4db2d9;});});}else{return;}})[_0x090a('0x2a')](function(_0x3aeabe){if(_0x3aeabe)_0x56fa50=_0x3aeabe;return _0x56fa50;})['then'](respondWithResult(_0x13bd76,null))[_0x090a('0x5e')](handleError(_0x13bd76,null));};function hasDefaultDashboard(_0x1d89b4){var _0x1d14b5=[0x65];return new BPromise(function(_0x17cef4,_0x173969){try{if(_0x1d89b4[_0x090a('0x5b')]){_0x17cef4(_0x1d14b5);}else{return db[_0x090a('0x5c')][_0x090a('0x6d')]({'where':{'sectionId':_0x1d89b4['id']},'raw':!![]})[_0x090a('0x2a')](function(_0x14f497){if(_0x14f497){_0x17cef4(_0x1d14b5);}});}}catch(_0x559aea){_0x173969(_0x559aea);}});}function getCustomDashboards(_0x49c8c9){var _0x1db35a=[];return new BPromise(function(_0x5714cf,_0x54f364){try{if(_0x49c8c9['autoAssociation']){return db[_0x090a('0x6e')][_0x090a('0x59')]({'raw':!![]})[_0x090a('0x2a')](function(_0x3437b2){_0x3437b2[_0x090a('0x6f')](function(_0x73716c){_0x1db35a[_0x090a('0x64')](_0x73716c['id']+0x1869f);});_0x5714cf(_0x1db35a);});}else{return db[_0x090a('0x5c')][_0x090a('0x59')]({'where':{'sectionId':_0x49c8c9['id']},'raw':!![]})[_0x090a('0x2a')](function(_0x12ff5e){_0x12ff5e[_0x090a('0x6f')](function(_0x230839){_0x1db35a[_0x090a('0x64')](_0x230839['resourceId']+0x1869f);});_0x5714cf(_0x1db35a);});}}catch(_0x1bcd7d){_0x54f364(_0x1bcd7d);}});}function getPlugins(_0x5d7fce){var _0x582924=[];return new BPromise(function(_0x1ba1fe,_0x5acd71){try{if(_0x5d7fce[_0x090a('0x5b')]){return db[_0x090a('0x70')][_0x090a('0x59')]({'raw':!![]})[_0x090a('0x2a')](function(_0x50a2ba){_0x50a2ba['forEach'](function(_0x1ce4f1){_0x582924[_0x090a('0x64')](_0x1ce4f1['id']+0x15b38);});_0x1ba1fe(_0x582924);});}else{return db[_0x090a('0x5c')][_0x090a('0x59')]({'where':{'sectionId':_0x5d7fce['id']},'raw':!![]})[_0x090a('0x2a')](function(_0x8fb035){_0x8fb035['forEach'](function(_0x5b4ef7){_0x582924['push'](_0x5b4ef7[_0x090a('0x71')]+0x15b38);});_0x1ba1fe(_0x582924);});}}catch(_0x647134){_0x5acd71(_0x647134);}});}exports[_0x090a('0x72')]=function(_0x5e3e50,_0x5a9d10){return db[_0x090a('0x30')]['find']({'where':{'id':_0x5e3e50[_0x090a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5a9d10,null))[_0x090a('0x2a')](function(_0x2cb866){if(_0x2cb866){return db[_0x090a('0x56')][_0x090a('0x57')](function(_0x357ad9){return db['UserProfileSection'][_0x090a('0x59')]({'where':{'userProfileId':_0x5e3e50[_0x090a('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x090a('0x2a')](function(_0x3f78c2){if(_0x3f78c2){return db[_0x090a('0x58')][_0x090a('0x29')]({'where':{'userProfileId':_0x5e3e50[_0x090a('0x4a')]['id'],'id':_[_0x090a('0x42')](_0x3f78c2,function(_0x5518f8){return _0x5518f8['id'];})},'transaction':_0x357ad9});}})[_0x090a('0x2a')](function(_0xa6384){var _0x2564dd=_[_0x090a('0x42')](_0x5e3e50[_0x090a('0x4e')],function(_0x364968){_0x364968[_0x090a('0x5f')]=_0x5e3e50['params']['id'];return _0x364968;});return db[_0x090a('0x58')][_0x090a('0x73')](_0x2564dd,{'raw':!![],'transaction':_0x357ad9});})[_0x090a('0x2a')](function(_0x3c65b3){var _0x4f3f49=_[_0x090a('0x40')](_[_0x090a('0x42')](_0x3c65b3,function(_0x5b620f){return _0x5b620f[_0x090a('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x4f3f49){return db['UserProfileSection'][_0x090a('0x59')]({'where':{'userProfileId':_0x5e3e50['params']['id'],'sectionId':_[_0x090a('0x42')](_0x4f3f49,function(_0x353ece){return _0x353ece[_0x090a('0x5d')];})},'attributes':['id',_0x090a('0x5d')],'raw':!![]})[_0x090a('0x2a')](function(_0x24be72){var _0x2f792a=_[_0x090a('0x42')](_0x5e3e50[_0x090a('0x4e')],function(_0x4e79fe){_0x4e79fe['userProfileId']=_0x5e3e50[_0x090a('0x4a')]['id'];return _0x4e79fe;});return db[_0x090a('0x5c')]['bulkCreate'](_0x2f792a,{'raw':!![],'transaction':_0x357ad9});});}})[_0x090a('0x5e')](handleError(_0x5a9d10,null));});}})[_0x090a('0x2a')](function(_0x283073){var _0x4d53b2=_[_0x090a('0x42')](_0x283073,function(_0x52acaa){return _0x52acaa[_0x090a('0x51')]({'plain':!![]});});})[_0x090a('0x2a')](respondWithResult(_0x5a9d10,null))['catch'](handleError(_0x5a9d10,null));};exports[_0x090a('0x74')]=function(_0x28a198,_0x5b0be7,_0x4d491f){return db[_0x090a('0x30')][_0x090a('0x4c')]({'where':{'id':_0x28a198[_0x090a('0x4a')]['id']}})[_0x090a('0x2a')](handleEntityNotFound(_0x5b0be7,null))[_0x090a('0x2a')](function(_0xa89548){if(_0xa89548){return _0xa89548[_0x090a('0x74')](_0x28a198[_0x090a('0x34')]['ids']);}})[_0x090a('0x2a')](respondWithStatusCode(_0x5b0be7,null))[_0x090a('0x5e')](handleError(_0x5b0be7,null));};exports[_0x090a('0x75')]=function(_0x1f44c5,_0x1963a8){var _0x5232cd={'raw':![],'where':{}};var _0x1631e7={};var _0x405b24={'count':0x0,'rows':[]};var _0x2851de=_0x1f44c5[_0x090a('0x34')][_0x090a('0x76')];if(typeof _0x2851de===_0x090a('0x77')){throw new db[(_0x090a('0x78'))][(_0x090a('0x79'))](_0x090a('0x7a'));}var _0x134c45=_0x1f44c5[_0x090a('0x34')][_0x090a('0x7b')]||![];var _0x93ca1c=getQueryModels(_0x2851de,_0x134c45);if(typeof _0x93ca1c[_0x090a('0x7c')]==='undefined'){throw new db[(_0x090a('0x78'))][(_0x090a('0x79'))]('Invalid\x20section\x20\x27'+_0x2851de+'\x27');}var _0x86beb0=[];if(!_['isEmpty'](_0x93ca1c[_0x090a('0x7d')])){_0x86beb0=_0x93ca1c[_0x090a('0x7d')];}else{_0x86beb0=[{'name':_0x2851de}];}return db[_0x090a('0x30')]['findOne']({'where':{'id':_0x1f44c5[_0x090a('0x4a')]['id']}})[_0x090a('0x2a')](handleEntityNotFound(_0x1963a8,null))[_0x090a('0x2a')](function(_0x4adef6){if(_0x4adef6){var _0x36ebfc=[];for(var _0x3128ef=0x0;_0x3128ef<_0x86beb0[_0x090a('0x4b')];_0x3128ef++){_0x36ebfc[_0x090a('0x64')](db['UserProfileSection'][_0x090a('0x6d')]({'where':{'userProfileId':_0x4adef6['id'],'name':_0x86beb0[_0x3128ef][_0x090a('0x2d')]},'raw':!![]}));}return BPromise['all'](_0x36ebfc);}})[_0x090a('0x2a')](function(_0x59c4a9){var _0x208765=_[_0x090a('0x40')](_0x59c4a9,function(_0x5e6fae){return _0x5e6fae?_0x5e6fae:undefined;});var _0x5f022a=_[_0x090a('0x40')](_0x86beb0,['ignore',!![]]);var _0x308eb5=_[_0x090a('0x69')](_0x208765)&&_['isEmpty'](_0x5f022a)?null:_[_0x090a('0x7e')](_0x5f022a,_0x208765);if(_0x308eb5){var _0x354079=[];for(var _0x3276a5=0x0;_0x3276a5<_0x308eb5['length'];_0x3276a5++){var _0x4eaefe=_['find'](_0x86beb0,function(_0x837976){return _0x308eb5[_0x3276a5]?_0x837976[_0x090a('0x2d')]===_0x308eb5[_0x3276a5][_0x090a('0x2d')]:null;});if(_0x4eaefe){if(_0x308eb5[_0x3276a5][_0x090a('0x7f')]){_0x354079[_0x090a('0x64')](getAllResources(_0x93ca1c[_0x090a('0x7c')],_0x308eb5[_0x3276a5]));}else{if(!_0x308eb5[_0x3276a5][_0x090a('0x5b')]){_0x354079[_0x090a('0x64')](getAllowedResources(_0x4eaefe,_0x308eb5[_0x3276a5],_0x93ca1c[_0x090a('0x7c')]));}else{if(_0x4eaefe[_0x090a('0x32')]){_0x354079[_0x090a('0x64')](getAllFilteredResources(_0x4eaefe,_0x308eb5[_0x3276a5]));}}}}}return BPromise[_0x090a('0x80')](_0x354079);}else{return null;}})['then'](function(_0x31253a){var _0x4fe7b1=_0x31253a;var _0xdee3bc=null;if(_0x4fe7b1){_0xdee3bc=_0x4fe7b1['length']===0x1?_0x4fe7b1[0x0]:null;}if(_0xdee3bc||_0x4fe7b1){var _0x3cc6b3=db[_0x93ca1c[_0x090a('0x7c')]][_0x090a('0x31')];_0x1631e7[_0x090a('0x32')]=_['keys'](_0x3cc6b3);_0x1631e7[_0x090a('0x34')]=_[_0x090a('0x33')](_0x1f44c5['query']);_0x1631e7[_0x090a('0x3e')]=_[_0x090a('0x35')](_0x1631e7[_0x090a('0x32')],_0x1631e7[_0x090a('0x34')]);_0x5232cd[_0x090a('0x36')]=_[_0x090a('0x35')](_0x1631e7[_0x090a('0x32')],qs[_0x090a('0x37')](_0x1f44c5['query']['fields']));_0x5232cd[_0x090a('0x36')]=_0x5232cd['attributes'][_0x090a('0x4b')]?_0x5232cd[_0x090a('0x36')]:_0x1631e7[_0x090a('0x32')];if(!_0x1f44c5[_0x090a('0x34')][_0x090a('0x38')](_0x090a('0x39'))){_0x5232cd[_0x090a('0x3a')]=qs[_0x090a('0x3a')](_0x1f44c5[_0x090a('0x34')][_0x090a('0x3a')]);_0x5232cd[_0x090a('0x23')]=qs['offset'](_0x1f44c5[_0x090a('0x34')][_0x090a('0x23')]);}_0x5232cd[_0x090a('0x3b')]=qs['sort'](_0x1f44c5[_0x090a('0x34')][_0x090a('0x3c')]);_0x5232cd[_0x090a('0x3d')]=qs[_0x090a('0x3e')](_[_0x090a('0x3f')](_0x1f44c5[_0x090a('0x34')],_0x1631e7[_0x090a('0x3e')]));if(_0x1f44c5[_0x090a('0x34')][_0x090a('0x40')]){_0x5232cd[_0x090a('0x3d')]=_['merge'](_0x5232cd[_0x090a('0x3d')],{'$or':_[_0x090a('0x42')](_0x3cc6b3,function(_0x4c8038){if(_0x4c8038[_0x090a('0x43')][_0x090a('0x44')]!==_0x090a('0x45')){var _0x531cdf={};_0x531cdf[_0x4c8038[_0x090a('0x46')]]={'$like':'%'+_0x1f44c5[_0x090a('0x34')][_0x090a('0x40')]+'%'};return _0x531cdf;}})});}var _0x32adcd=[];if(_0xdee3bc){var _0xf7c2ba=_['find'](_0x86beb0,['name',_0xdee3bc[_0x090a('0x2d')]]);if(_0xf7c2ba['field']){var _0x1b6a19={};if(_0x93ca1c['childModel']===_0x090a('0x81')){_0x1b6a19[_0xf7c2ba['foreignKey']]=_[_0x090a('0x42')](_0xdee3bc[_0x090a('0x82')],'id');}else{_0x1b6a19[_0xf7c2ba['foreignKey']]=_0xdee3bc[_0x090a('0x82')];}_0x32adcd[_0x090a('0x64')](_0x1b6a19);}else{_0x5232cd[_0x090a('0x3d')]['id']=_0xdee3bc[_0x090a('0x82')];}}else{for(var _0x3889a5=0x0;_0x3889a5<_0x4fe7b1[_0x090a('0x4b')];_0x3889a5++){var _0xf7c2ba=_[_0x090a('0x4c')](_0x86beb0,[_0x090a('0x2d'),_0x4fe7b1[_0x3889a5][_0x090a('0x2d')]]);if(_0xf7c2ba[_0x090a('0x46')]){var _0x1b6a19={};_0x1b6a19[_0xf7c2ba[_0x090a('0x83')]]=_0x4fe7b1[_0x3889a5][_0x090a('0x82')];_0x32adcd[_0x090a('0x64')](_0x1b6a19);}else{if(!_0x5232cd['where']['id'])_0x5232cd[_0x090a('0x3d')]['id']=[];_0x4fe7b1[_0x3889a5][_0x090a('0x82')][_0x090a('0x6f')](function(_0x45f5ff){_0x5232cd[_0x090a('0x3d')]['id'][_0x090a('0x64')](_0x45f5ff);});}}}if(!_[_0x090a('0x69')](_0x32adcd)){_0x5232cd[_0x090a('0x3d')]=_[_0x090a('0x41')](_0x5232cd[_0x090a('0x3d')],{'$and':{'$or':_0x32adcd}});}_0x5232cd=_[_0x090a('0x41')]({},_0x5232cd,_0x1f44c5[_0x090a('0x47')]);if(_0xdee3bc&&!_0xdee3bc[_0x090a('0x5b')]&&_0x93ca1c[_0x090a('0x7c')]===_0x090a('0x81')){if(_0x1f44c5[_0x090a('0x34')][_0x090a('0x48')]){_0x5232cd[_0x090a('0x50')]=[{'all':!![]}];}return db[_0x93ca1c[_0x090a('0x7c')]][_0x090a('0x59')](_0x5232cd)['then'](function(_0x84a59){var _0x38f917=[];_0x84a59['forEach'](function(_0x420085){var _0x6cc3d3;switch(_0x420085['reportType']){case _0x090a('0x84'):_0x6cc3d3=_[_0x090a('0x4c')](_0xdee3bc[_0x090a('0x82')],function(_0x3ff016){return _0x3ff016['id']===_0x420085[_0x090a('0x85')]&&_0x3ff016[_0x090a('0x43')]===_0x090a('0x86');});break;case _0x090a('0x87'):_0x6cc3d3=_[_0x090a('0x4c')](_0xdee3bc[_0x090a('0x82')],function(_0x1f31ad){return _0x1f31ad['id']===_0x420085['reportId']&&_0x1f31ad[_0x090a('0x43')]===_0x090a('0x88');});break;}if(_0x6cc3d3)_0x38f917['push'](_0x420085);});_0x405b24[_0x090a('0x22')]=_0x38f917[_0x090a('0x4b')];_0x405b24[_0x090a('0x89')]=_0x38f917;return _0x405b24;});}else{return db[_0x93ca1c[_0x090a('0x7c')]][_0x090a('0x22')]({'where':_0x5232cd[_0x090a('0x3d')]})[_0x090a('0x2a')](function(_0x200d2b){_0x405b24[_0x090a('0x22')]=_0x200d2b;if(_0x1f44c5[_0x090a('0x34')][_0x090a('0x48')]){if(_0x93ca1c['childModel']===_0x090a('0x8a')){_0x5232cd[_0x090a('0x50')]=[{'model':db[_0x090a('0x8b')],'as':_0x090a('0x8c'),'attributes':['id',_0x090a('0x2d'),_0x090a('0x8d')],'required':_0x1f44c5[_0x090a('0x34')][_0x090a('0x8e')]?!![]:![]},{'model':db[_0x090a('0x8b')],'as':_0x090a('0x8f'),'attributes':['id',_0x090a('0x2d'),_0x090a('0x8d')],'through':_0x1f44c5[_0x090a('0x34')][_0x090a('0x8e')]?{'attributes':[],'where':{'TagId':_0x1f44c5[_0x090a('0x34')][_0x090a('0x8e')]||undefined}}:{},'required':_0x1f44c5[_0x090a('0x34')][_0x090a('0x8e')]?!![]:![]}];}else{_0x5232cd['include']=[{'all':!![]}];}}return db[_0x93ca1c[_0x090a('0x7c')]][_0x090a('0x59')](_0x5232cd);})['then'](function(_0x544811){_0x405b24[_0x090a('0x89')]=_0x544811;return _0x405b24;});}}else{return _0x405b24;}})[_0x090a('0x2a')](respondWithFilteredResult(_0x1963a8,_0x5232cd))['catch'](handleError(_0x1963a8,null));};function getAllResources(_0x13553,_0x2e4047){return new BPromise(function(_0x58d621,_0x51ab18){if(_0x2e4047){var _0x2a8a38=_0x2e4047['filter']?{[_0x2e4047[_0x090a('0x40')][_0x090a('0x46')]]:_0x2e4047[_0x090a('0x40')]['value']}:undefined;return db[_0x13553][_0x090a('0x59')]({'where':_0x2a8a38,'raw':!![]})[_0x090a('0x2a')](function(_0x24f573){_0x2e4047[_0x090a('0x82')]=_[_0x090a('0x42')](_0x24f573,'id');_0x58d621(_0x2e4047);})[_0x090a('0x5e')](function(_0x39659b){_0x51ab18(_0x39659b);});}else{_0x58d621(null);}});}function getAllFilteredResources(_0x17bd92,_0xc29b16){return new BPromise(function(_0x3d2d31,_0xcad094){var _0x485614=_0x17bd92[_0x090a('0x40')]?{[_0x17bd92[_0x090a('0x40')][_0x090a('0x46')]]:_0x17bd92[_0x090a('0x40')][_0x090a('0x90')]}:undefined;return db[_0x17bd92['model']][_0x090a('0x59')]({'where':_0x485614,'raw':!![]})[_0x090a('0x2a')](function(_0x36bd4b){_0xc29b16[_0x090a('0x82')]=_[_0x090a('0x42')](_0x36bd4b,function(_0x152422){return _0x152422[_0x090a('0x2d')];});_0x3d2d31(_0xc29b16);})[_0x090a('0x5e')](function(_0x512274){_0xcad094(_0x512274);});});}function getAllowedResources(_0x4d20df,_0x3323e6,_0x35db04){return new BPromise(function(_0x4861fb,_0x5221a9){if(_0x3323e6){return db[_0x090a('0x5c')]['findAll']({'where':{'sectionId':_0x3323e6['id']},'raw':!![]})[_0x090a('0x2a')](function(_0x2b96b8){if(_0x4d20df[_0x090a('0x46')]&&_0x4d20df[_0x090a('0x46')]!=='id'){_0x3323e6[_0x090a('0x82')]=_[_0x090a('0x42')](_0x2b96b8,function(_0x5d8e0a){return _0x5d8e0a[_0x4d20df['field']];});}else{if(_0x35db04===_0x090a('0x81')){_0x3323e6[_0x090a('0x82')]=_[_0x090a('0x42')](_0x2b96b8,function(_0x659fc5){return{'id':_0x659fc5[_0x090a('0x71')],'type':_0x659fc5[_0x090a('0x43')]};});}else{_0x3323e6['associatedResources']=_['map'](_0x2b96b8,function(_0x1c5526){return _0x1c5526['resourceId'];});}}_0x4861fb(_0x3323e6);})['catch'](function(_0x58b469){_0x5221a9(_0x58b469);});}else{_0x4861fb(null);}});}function getQueryModels(_0x1f563f,_0x3d4e92){var _0x3b8b2b=_0x1f563f[_0x090a('0x91')]();var _0x4b8aba={'childModel':undefined,'parentSections':[]};switch(_0x3b8b2b){case'squareprojects':_0x4b8aba[_0x090a('0x7c')]='SquareProject';break;case _0x090a('0x92'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0x93');break;case _0x090a('0x94'):_0x4b8aba[_0x090a('0x7c')]='SquareRecording';_0x4b8aba['parentSections']=[{'name':'SquareProjects','field':_0x090a('0x2d'),'foreignKey':_0x090a('0x95')}];break;case'projects':_0x4b8aba['childModel']=_0x090a('0x96');break;case _0x090a('0x97'):_0x4b8aba[_0x090a('0x7c')]='CmContact';_0x4b8aba['parentSections']=[{'name':_0x090a('0x98'),'field':'id','foreignKey':_0x090a('0x99')}];break;case _0x090a('0x9a'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0x9b');break;case _0x090a('0x9c'):_0x4b8aba[_0x090a('0x7c')]='CmCompany';break;case'globalcustomfields':_0x4b8aba[_0x090a('0x7c')]=_0x090a('0x9d');break;case'chatqueues':_0x4b8aba[_0x090a('0x7c')]=_0x090a('0x9e');break;case'chatwebsites':_0x4b8aba[_0x090a('0x7c')]=_0x090a('0x9f');break;case _0x090a('0xa0'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xa1');break;case _0x090a('0xa2'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xa3');break;case'inboundroutes':case'internalroutes':case'outboundroutes':_0x4b8aba[_0x090a('0x7c')]='VoiceExtension';break;case _0x090a('0xa4'):_0x4b8aba['childModel']=_0x090a('0xa5');break;case'voicemails':_0x4b8aba['childModel']=_0x090a('0xa6');break;case _0x090a('0xa7'):_0x4b8aba['childModel']='VoiceRecording';_0x4b8aba[_0x090a('0x7d')]=[{'name':'Agents','field':_0x090a('0x2d'),'foreignKey':_0x090a('0xa8'),'model':_0x090a('0xa9'),'filter':{'field':_0x090a('0xaa'),'value':[_0x090a('0xab')]}},{'name':_0x090a('0xac'),'field':'name','foreignKey':_0x090a('0xa8'),'model':_0x090a('0xa9'),'filter':{'field':_0x090a('0xaa'),'value':[_0x090a('0xad')]}},{'name':_0x090a('0xae'),'field':_0x090a('0x2d'),'foreignKey':_0x090a('0xaf'),'model':_0x090a('0xb0'),'filter':{'field':_0x090a('0x43'),'value':[_0x090a('0xb1')]}},{'name':_0x090a('0xb2'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x090a('0x43'),'value':[_0x090a('0xb3')]}}];break;case _0x090a('0xb4'):_0x4b8aba[_0x090a('0x7c')]='VoiceMusicOnHold';break;case _0x090a('0xb5'):_0x4b8aba['childModel']=_0x090a('0xb6');break;case _0x090a('0xb7'):_0x4b8aba['childModel']=_0x090a('0xb8');break;case _0x090a('0xb9'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xba');break;case _0x090a('0xbb'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xbc');break;case _0x090a('0xbd'):_0x4b8aba['childModel']=_0x090a('0xbe');break;case _0x090a('0xbf'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xc0');break;case'openchannelqueues':_0x4b8aba['childModel']=_0x090a('0xc1');break;case _0x090a('0xc2'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xc3');break;case _0x090a('0xc4'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xc5');break;case _0x090a('0xc6'):_0x4b8aba['childModel']=_0x090a('0xc7');break;case _0x090a('0xc8'):_0x4b8aba['childModel']=_0x090a('0xc9');break;case _0x090a('0xca'):case _0x090a('0xcb'):_0x4b8aba[_0x090a('0x7c')]='VoiceQueue';if(_0x3d4e92){_0x4b8aba['parentSections']=[{'name':'VoiceQueues'},{'name':_0x090a('0xb2')}];}break;case _0x090a('0xcc'):case'agents':case _0x090a('0xcd'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xa9');if(_0x3d4e92){_0x4b8aba[_0x090a('0x7d')]=[{'name':_0x090a('0xce'),'filter':{'field':'role','value':['admin',_0x090a('0xcf')]},'ignore':!![]},{'name':_0x090a('0xd0')},{'name':_0x090a('0xac')}];}break;case _0x090a('0xd1'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xd2');break;case _0x090a('0xd3'):_0x4b8aba[_0x090a('0x7c')]='SalesforceAccount';break;case _0x090a('0xd4'):_0x4b8aba['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x4b8aba['childModel']='SugarcrmAccount';break;case _0x090a('0xd5'):_0x4b8aba[_0x090a('0x7c')]='DeskAccount';break;case'zohoaccounts':_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xd6');break;case'vtigeraccounts':_0x4b8aba['childModel']=_0x090a('0xa9');break;case'cannedanswers':_0x4b8aba[_0x090a('0x7c')]='CannedAnswer';break;case _0x090a('0xd7'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xd8');break;case'customdashboards':_0x4b8aba['childModel']=_0x090a('0x6e');break;case _0x090a('0xd9'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xda');break;case'pauses':_0x4b8aba[_0x090a('0x7c')]='Pause';break;case _0x090a('0xdb'):_0x4b8aba[_0x090a('0x7c')]='Schedule';break;case _0x090a('0xdc'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xdd');break;case _0x090a('0xde'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0x8b');break;case _0x090a('0xdf'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xe0');break;case _0x090a('0xe1'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xe2');break;case'trunks':_0x4b8aba[_0x090a('0x7c')]=_0x090a('0xe3');break;case _0x090a('0xe4'):_0x4b8aba['childModel']=_0x090a('0xe5');break;case _0x090a('0xe6'):_0x4b8aba['childModel']=_0x090a('0x70');break;case _0x090a('0xe7'):_0x4b8aba[_0x090a('0x7c')]=_0x090a('0x81');_0x4b8aba[_0x090a('0x7d')]=[{'name':_0x090a('0xe8'),'field':'id','foreignKey':_0x090a('0x85')}];break;case _0x090a('0xe9'):_0x4b8aba['childModel']='AnalyticMetric';break;default:return _0x4b8aba;}return _0x4b8aba;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e8a39de..8a1c1c5 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 _0x79fb=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x590b71,_0xf2162b){var _0x4bbc59=function(_0x34fe71){while(--_0x34fe71){_0x590b71['push'](_0x590b71['shift']());}};_0x4bbc59(++_0xf2162b);}(_0x79fb,0x168));var _0xb79f=function(_0x4b8d83,_0x6b4241){_0x4b8d83=_0x4b8d83-0x0;var _0x19c19b=_0x79fb[_0x4b8d83];return _0x19c19b;};'use strict';var EventEmitter=require(_0xb79f('0x0'));var UserProfile=require(_0xb79f('0x1'))['db'][_0xb79f('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb79f('0x3')](0x0);var events={'afterCreate':_0xb79f('0x4'),'afterUpdate':_0xb79f('0x5'),'afterDestroy':_0xb79f('0x6')};function emitEvent(_0x5d29a7){return function(_0x2b526e,_0x1a640f,_0x25aadd){UserProfileEvents[_0xb79f('0x7')](_0x5d29a7+':'+_0x2b526e['id'],_0x2b526e);UserProfileEvents['emit'](_0x5d29a7,_0x2b526e);_0x25aadd(null);};}for(var e in events){if(events[_0xb79f('0x8')](e)){var event=events[e];UserProfile[_0xb79f('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x5017=['remove','emit','exports','events','../../mysqldb','UserProfile','setMaxListeners','update'];(function(_0x21485d,_0x391b33){var _0x3b0968=function(_0x54a604){while(--_0x54a604){_0x21485d['push'](_0x21485d['shift']());}};_0x3b0968(++_0x391b33);}(_0x5017,0x143));var _0x7501=function(_0x9e55b5,_0x81fe4e){_0x9e55b5=_0x9e55b5-0x0;var _0xe8eae3=_0x5017[_0x9e55b5];return _0xe8eae3;};'use strict';var EventEmitter=require(_0x7501('0x0'));var UserProfile=require(_0x7501('0x1'))['db'][_0x7501('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7501('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7501('0x4'),'afterDestroy':_0x7501('0x5')};function emitEvent(_0x4072cf){return function(_0x467b75,_0x3059f8,_0xa16367){UserProfileEvents['emit'](_0x4072cf+':'+_0x467b75['id'],_0x467b75);UserProfileEvents[_0x7501('0x6')](_0x4072cf,_0x467b75);_0xa16367(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x7501('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 8466121..aa4969e 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 _0xe4fd=['../../config/environment','./userProfile.attributes','define','UserProfile','user_profiles','lodash','util','api','moment','request-promise','rimraf'];(function(_0x2dfffc,_0x3411af){var _0xf9d20d=function(_0x137b78){while(--_0x137b78){_0x2dfffc['push'](_0x2dfffc['shift']());}};_0xf9d20d(++_0x3411af);}(_0xe4fd,0x1c8));var _0xde4f=function(_0x559037,_0x2f0624){_0x559037=_0x559037-0x0;var _0x3825ac=_0xe4fd[_0x559037];return _0x3825ac;};'use strict';var _=require(_0xde4f('0x0'));var util=require(_0xde4f('0x1'));var logger=require('../../config/logger')(_0xde4f('0x2'));var moment=require(_0xde4f('0x3'));var BPromise=require('bluebird');var rp=require(_0xde4f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde4f('0x5'));var config=require(_0xde4f('0x6'));var attributes=require(_0xde4f('0x7'));module['exports']=function(_0x11c3a9,_0x313346){return _0x11c3a9[_0xde4f('0x8')](_0xde4f('0x9'),attributes,{'tableName':_0xde4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d78=['../../config/environment','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x4c7c97,_0x28b534){var _0x1c2eef=function(_0x2d3ac2){while(--_0x2d3ac2){_0x4c7c97['push'](_0x4c7c97['shift']());}};_0x1c2eef(++_0x28b534);}(_0x6d78,0x123));var _0x86d7=function(_0x20a84b,_0x34649e){_0x20a84b=_0x20a84b-0x0;var _0x238e17=_0x6d78[_0x20a84b];return _0x238e17;};'use strict';var _=require(_0x86d7('0x0'));var util=require(_0x86d7('0x1'));var logger=require(_0x86d7('0x2'))(_0x86d7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x86d7('0x4'));var rimraf=require(_0x86d7('0x5'));var config=require(_0x86d7('0x6'));var attributes=require('./userProfile.attributes');module[_0x86d7('0x7')]=function(_0x17a8d9,_0x2c9435){return _0x17a8d9[_0x86d7('0x8')](_0x86d7('0x9'),attributes,{'tableName':_0x86d7('0xa'),'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 7c3c8dd..c8ae582 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeda8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xeda8,0x104));var _0x8eda=function(_0x10ffbb,_0x494808){_0x10ffbb=_0x10ffbb-0x0;var _0x24fa7e=_0xeda8[_0x10ffbb];return _0x24fa7e;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});config[_0x8eda('0xd')]=_['defaults'](config[_0x8eda('0xd')],{'host':_0x8eda('0xe'),'port':0x18eb});var socket=require(_0x8eda('0xf'))(new Redis(config[_0x8eda('0xd')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x488849,_0x4fbf0a,_0xe69181){return new BPromise(function(_0x2d3739,_0x41442d){return client['request'](_0x488849,_0xe69181)[_0x8eda('0x10')](function(_0x5a80ca){logger[_0x8eda('0x11')](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));logger[_0x8eda('0x14')](_0x8eda('0x15'),_0x4fbf0a,_0x8eda('0x13'),JSON[_0x8eda('0x16')](_0x5a80ca));if(_0x5a80ca[_0x8eda('0x17')]){if(_0x5a80ca['error']['code']===0x1f4){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x41442d(_0x5a80ca[_0x8eda('0x17')][_0x8eda('0x18')]);}logger['error'](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x2d3739(_0x5a80ca['error'][_0x8eda('0x18')]);}else{logger['info'](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));_0x2d3739(_0x5a80ca['result']['message']);}})[_0x8eda('0x19')](function(_0x1b7e94){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x1b7e94);_0x41442d(_0x1b7e94);});});} \ No newline at end of file +var _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x194986,_0x49a03f){var _0x330721=function(_0x349460){while(--_0x349460){_0x194986['push'](_0x194986['shift']());}};_0x330721(++_0x49a03f);}(_0x814b,0x1a2));var _0xb814=function(_0x2c944e,_0x26f659){_0x2c944e=_0x2c944e-0x0;var _0x2cc529=_0x814b[_0x2c944e];return _0x2cc529;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});config[_0xb814('0xc')]=_[_0xb814('0xd')](config['redis'],{'host':_0xb814('0xe'),'port':0x18eb});var socket=require(_0xb814('0xf'))(new Redis(config[_0xb814('0xc')]));require(_0xb814('0x10'))[_0xb814('0x11')](socket);function respondWithRpcPromise(_0x21d4a5,_0x1086f8,_0x19aad8){return new BPromise(function(_0x207dbc,_0x3450f2){return client[_0xb814('0x12')](_0x21d4a5,_0x19aad8)['then'](function(_0x43dfe6){logger['info'](_0xb814('0x13'),_0x1086f8,_0xb814('0x14'));logger[_0xb814('0x15')](_0xb814('0x16'),_0x1086f8,_0xb814('0x14'),JSON[_0xb814('0x17')](_0x43dfe6));if(_0x43dfe6[_0xb814('0x18')]){if(_0x43dfe6[_0xb814('0x18')][_0xb814('0x19')]===0x1f4){logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x3450f2(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x207dbc(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}else{logger['info'](_0xb814('0x13'),_0x1086f8,'request\x20sent');_0x207dbc(_0x43dfe6[_0xb814('0x1b')][_0xb814('0x1a')]);}})['catch'](function(_0x4b55a7){logger['error'](_0xb814('0x13'),_0x1086f8,_0x4b55a7);_0x3450f2(_0x4b55a7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 12a9549..808e9b5 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 _0x035f=['save','remove','removeListener','register','userProfile:','./userProfile.events'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0x035f,0x8f));var _0xf035=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0x035f[_0x4c2dfc];return _0xfd728d;};'use strict';var UserProfileEvents=require(_0xf035('0x0'));var events=[_0xf035('0x1'),_0xf035('0x2'),'update'];function createListener(_0x512cc6,_0x27d413){return function(_0x536c00){_0x27d413['emit'](_0x512cc6,_0x536c00);};}function removeListener(_0x477436,_0x3bddb0){return function(){UserProfileEvents[_0xf035('0x3')](_0x477436,_0x3bddb0);};}exports[_0xf035('0x4')]=function(_0xbcc1){for(var _0x504237=0x0,_0x3b055a=events['length'];_0x504237<_0x3b055a;_0x504237++){var _0x463933=events[_0x504237];var _0x19740a=createListener(_0xf035('0x5')+_0x463933,_0xbcc1);UserProfileEvents['on'](_0x463933,_0x19740a);}}; \ No newline at end of file +var _0x8ab7=['./userProfile.events','save','register','length','userProfile:'];(function(_0x5ec7bd,_0x3ece6d){var _0x5da6ec=function(_0x75ad39){while(--_0x75ad39){_0x5ec7bd['push'](_0x5ec7bd['shift']());}};_0x5da6ec(++_0x3ece6d);}(_0x8ab7,0x7d));var _0x78ab=function(_0x200aee,_0x2624c4){_0x200aee=_0x200aee-0x0;var _0x371825=_0x8ab7[_0x200aee];return _0x371825;};'use strict';var UserProfileEvents=require(_0x78ab('0x0'));var events=[_0x78ab('0x1'),'remove','update'];function createListener(_0x1c6400,_0x1eb27c){return function(_0x2522c3){_0x1eb27c['emit'](_0x1c6400,_0x2522c3);};}function removeListener(_0x20b312,_0x59ed72){return function(){UserProfileEvents['removeListener'](_0x20b312,_0x59ed72);};}exports[_0x78ab('0x2')]=function(_0x3bd55b){for(var _0x36d35e=0x0,_0x3aa5a4=events[_0x78ab('0x3')];_0x36d35e<_0x3aa5a4;_0x36d35e++){var _0x3621c5=events[_0x36d35e];var _0x222062=createListener(_0x78ab('0x4')+_0x3621c5,_0x3bd55b);UserProfileEvents['on'](_0x3621c5,_0x222062);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 50eff28..75f6b56 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 _0x2e32=['./userProfileResource.controller','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29bb4b,_0x42924a){var _0x3ffbd4=function(_0x4d6a95){while(--_0x4d6a95){_0x29bb4b['push'](_0x29bb4b['shift']());}};_0x3ffbd4(++_0x42924a);}(_0x2e32,0x186));var _0x22e3=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x2e32[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x22e3('0x0'));var util=require(_0x22e3('0x1'));var path=require(_0x22e3('0x2'));var timeout=require(_0x22e3('0x3'));var express=require(_0x22e3('0x4'));var router=express[_0x22e3('0x5')]();var auth=require(_0x22e3('0x6'));var interaction=require(_0x22e3('0x7'));var config=require(_0x22e3('0x8'));var controller=require(_0x22e3('0x9'));router[_0x22e3('0xa')]('/',auth[_0x22e3('0xb')](),controller['index']);router[_0x22e3('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x22e3('0xc')]);router[_0x22e3('0xa')](_0x22e3('0xd'),auth[_0x22e3('0xb')](),controller[_0x22e3('0xe')]);router[_0x22e3('0xf')]('/',auth[_0x22e3('0xb')](),controller[_0x22e3('0x10')]);router['put'](_0x22e3('0xd'),auth[_0x22e3('0xb')](),controller['update']);router[_0x22e3('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x22e3('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe533=['post','put','update','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x4029d5,_0x9ceea7){var _0x7f9b25=function(_0x3af7c1){while(--_0x3af7c1){_0x4029d5['push'](_0x4029d5['shift']());}};_0x7f9b25(++_0x9ceea7);}(_0xe533,0x181));var _0x3e53=function(_0x4252c5,_0x1ee779){_0x4252c5=_0x4252c5-0x0;var _0x198b06=_0xe533[_0x4252c5];return _0x198b06;};'use strict';var multer=require(_0x3e53('0x0'));var util=require(_0x3e53('0x1'));var path=require('path');var timeout=require(_0x3e53('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3e53('0x3'));var interaction=require(_0x3e53('0x4'));var config=require(_0x3e53('0x5'));var controller=require(_0x3e53('0x6'));router['get']('/',auth[_0x3e53('0x7')](),controller[_0x3e53('0x8')]);router['get'](_0x3e53('0x9'),auth[_0x3e53('0x7')](),controller[_0x3e53('0xa')]);router[_0x3e53('0xb')](_0x3e53('0xc'),auth[_0x3e53('0x7')](),controller[_0x3e53('0xd')]);router[_0x3e53('0xe')]('/',auth[_0x3e53('0x7')](),controller['create']);router[_0x3e53('0xf')]('/:id',auth[_0x3e53('0x7')](),controller[_0x3e53('0x10')]);router['delete'](_0x3e53('0xc'),auth[_0x3e53('0x7')](),controller[_0x3e53('0x11')]);module[_0x3e53('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a11d50f..9c1f8ce 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 _0x86fc=['exports','STRING','INTEGER','sequelize'];(function(_0x508564,_0x23c709){var _0x35e8c9=function(_0x17b1a8){while(--_0x17b1a8){_0x508564['push'](_0x508564['shift']());}};_0x35e8c9(++_0x23c709);}(_0x86fc,0x73));var _0xc86f=function(_0xe2e5a7,_0x213d71){_0xe2e5a7=_0xe2e5a7-0x0;var _0x1658e5=_0x86fc[_0xe2e5a7];return _0x1658e5;};'use strict';var Sequelize=require(_0xc86f('0x0'));module[_0xc86f('0x1')]={'name':{'type':Sequelize[_0xc86f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc86f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc86f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd514=['sequelize','STRING'];(function(_0x121a66,_0x2f8676){var _0x242338=function(_0x26ef90){while(--_0x26ef90){_0x121a66['push'](_0x121a66['shift']());}};_0x242338(++_0x2f8676);}(_0xd514,0xb2));var _0x4d51=function(_0x476eae,_0x1600dc){_0x476eae=_0x476eae-0x0;var _0x8b7f0a=_0xd514[_0x476eae];return _0x8b7f0a;};'use strict';var Sequelize=require(_0x4d51('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x4d51('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index e41c624..2149eed 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 _0xe0c3=['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','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','then','error','stack','name','send','index','UserProfileResource','rawAttributes','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','key','VIRTUAL','field','includeAll','include','findAll','show','params','options','find','create','body','catch','update','destroy','describe'];(function(_0x59c217,_0x33e0a2){var _0x1121d3=function(_0x1ea350){while(--_0x1ea350){_0x59c217['push'](_0x59c217['shift']());}};_0x1121d3(++_0x33e0a2);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x3e0c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3e0c('0x1'));var zipdir=require(_0x3e0c('0x2'));var jsonpatch=require(_0x3e0c('0x3'));var rp=require(_0x3e0c('0x4'));var moment=require(_0x3e0c('0x5'));var BPromise=require(_0x3e0c('0x6'));var Mustache=require(_0x3e0c('0x7'));var util=require(_0x3e0c('0x8'));var path=require(_0x3e0c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e0c('0xa'));var fs=require('fs');var _=require(_0x3e0c('0xb'));var squel=require(_0x3e0c('0xc'));var crypto=require(_0x3e0c('0xd'));var jsforce=require(_0x3e0c('0xe'));var deskjs=require(_0x3e0c('0xf'));var toCsv=require(_0x3e0c('0x10'));var querystring=require(_0x3e0c('0x11'));var Papa=require(_0x3e0c('0x12'));var Redis=require(_0x3e0c('0x13'));var authService=require(_0x3e0c('0x14'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e0c('0x15'))(_0x3e0c('0x16'));var utils=require(_0x3e0c('0x17'));var config=require(_0x3e0c('0x18'));var db=require(_0x3e0c('0x19'))['db'];function respondWithStatusCode(_0xb334fd,_0x5fe775){_0x5fe775=_0x5fe775||0xcc;return function(_0x5dc732){if(_0x5dc732){return _0xb334fd[_0x3e0c('0x1a')](_0x5fe775);}return _0xb334fd['status'](_0x5fe775)[_0x3e0c('0x1b')]();};}function respondWithResult(_0x23a6a8,_0x5d0ab7){_0x5d0ab7=_0x5d0ab7||0xc8;return function(_0x5f2654){if(_0x5f2654){return _0x23a6a8[_0x3e0c('0x1c')](_0x5d0ab7)[_0x3e0c('0x1d')](_0x5f2654);}};}function respondWithFilteredResult(_0x40e308,_0xea4ed){return function(_0x15a269){if(_0x15a269){var _0x24fcf9=_0x15a269[_0x3e0c('0x1e')],_0x1947c2=_0xea4ed[_0x3e0c('0x1f')],_0x274d75=_0xea4ed['offset']+_0xea4ed['limit'],_0x42b1bd;if(_0x274d75>=_0x24fcf9){_0x274d75=_0x24fcf9;_0x42b1bd=0xc8;}else{_0x42b1bd=0xce;}_0x40e308[_0x3e0c('0x1c')](_0x42b1bd);return _0x40e308[_0x3e0c('0x20')](_0x3e0c('0x21'),_0x1947c2+'-'+_0x274d75+'/'+_0x24fcf9)[_0x3e0c('0x1d')](_0x15a269);}return null;};}function patchUpdates(_0x108d4a){return function(_0x8825b7){try{jsonpatch['apply'](_0x8825b7,_0x108d4a,!![]);}catch(_0x2e4a4a){return BPromise[_0x3e0c('0x22')](_0x2e4a4a);}return _0x8825b7[_0x3e0c('0x23')]();};}function saveUpdates(_0x4cee28,_0x60c48c){return function(_0x5e3a93){if(_0x5e3a93){return _0x5e3a93['update'](_0x4cee28)[_0x3e0c('0x24')](function(_0x1f3bad){return _0x1f3bad;});}return null;};}function removeEntity(_0x6fa8f9,_0x410b09){return function(_0x4f8d38){if(_0x4f8d38){return _0x4f8d38['destroy']()[_0x3e0c('0x24')](function(){_0x6fa8f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fd7de,_0x1769b1){return function(_0x44ce68){if(!_0x44ce68){_0x3fd7de['sendStatus'](0x194);}return _0x44ce68;};}function handleError(_0x4272ee,_0x39223a){_0x39223a=_0x39223a||0x1f4;return function(_0x5182fd){logger[_0x3e0c('0x25')](_0x5182fd[_0x3e0c('0x26')]);if(_0x5182fd[_0x3e0c('0x27')]){delete _0x5182fd[_0x3e0c('0x27')];}_0x4272ee['status'](_0x39223a)[_0x3e0c('0x28')](_0x5182fd);};}exports[_0x3e0c('0x29')]=function(_0x2c5fba,_0x26e01f){var _0x4c4bc3={},_0x15c294={},_0x47b15d={'count':0x0,'rows':[]};var _0x50de5c=db[_0x3e0c('0x2a')][_0x3e0c('0x2b')];_0x15c294['model']=_[_0x3e0c('0x2c')](_0x50de5c);_0x15c294[_0x3e0c('0x2d')]=_[_0x3e0c('0x2c')](_0x2c5fba['query']);_0x15c294[_0x3e0c('0x2e')]=_[_0x3e0c('0x2f')](_0x15c294['model'],_0x15c294[_0x3e0c('0x2d')]);_0x4c4bc3[_0x3e0c('0x30')]=_[_0x3e0c('0x2f')](_0x15c294[_0x3e0c('0x31')],qs['fields'](_0x2c5fba[_0x3e0c('0x2d')][_0x3e0c('0x32')]));_0x4c4bc3[_0x3e0c('0x30')]=_0x4c4bc3['attributes'][_0x3e0c('0x33')]?_0x4c4bc3[_0x3e0c('0x30')]:_0x15c294[_0x3e0c('0x31')];if(!_0x2c5fba['query'][_0x3e0c('0x34')](_0x3e0c('0x35'))){_0x4c4bc3[_0x3e0c('0x36')]=qs[_0x3e0c('0x36')](_0x2c5fba[_0x3e0c('0x2d')][_0x3e0c('0x36')]);_0x4c4bc3[_0x3e0c('0x1f')]=qs[_0x3e0c('0x1f')](_0x2c5fba[_0x3e0c('0x2d')][_0x3e0c('0x1f')]);}_0x4c4bc3[_0x3e0c('0x37')]=qs[_0x3e0c('0x38')](_0x2c5fba[_0x3e0c('0x2d')][_0x3e0c('0x38')]);_0x4c4bc3['where']=qs[_0x3e0c('0x2e')](_[_0x3e0c('0x39')](_0x2c5fba[_0x3e0c('0x2d')],_0x15c294[_0x3e0c('0x2e')]));if(_0x2c5fba[_0x3e0c('0x2d')][_0x3e0c('0x3a')]){_0x4c4bc3[_0x3e0c('0x3b')]=_[_0x3e0c('0x3c')](_0x4c4bc3['where'],{'$or':_['map'](_0x50de5c,function(_0x12b8b9){if(_0x12b8b9[_0x3e0c('0x3d')][_0x3e0c('0x3e')]!==_0x3e0c('0x3f')){var _0xa942a5={};_0xa942a5[_0x12b8b9[_0x3e0c('0x40')]]={'$like':'%'+_0x2c5fba['query'][_0x3e0c('0x3a')]+'%'};return _0xa942a5;}})});}_0x4c4bc3=_[_0x3e0c('0x3c')]({},_0x4c4bc3,_0x2c5fba['options']);var _0x48dd24={'where':_0x4c4bc3['where']};return db[_0x3e0c('0x2a')][_0x3e0c('0x1e')](_0x48dd24)[_0x3e0c('0x24')](function(_0x43fc69){_0x47b15d[_0x3e0c('0x1e')]=_0x43fc69;if(_0x2c5fba[_0x3e0c('0x2d')][_0x3e0c('0x41')]){_0x4c4bc3[_0x3e0c('0x42')]=[{'all':!![]}];}return db[_0x3e0c('0x2a')][_0x3e0c('0x43')](_0x4c4bc3);})[_0x3e0c('0x24')](function(_0x20135d){_0x47b15d['rows']=_0x20135d;return _0x47b15d;})['then'](respondWithFilteredResult(_0x26e01f,_0x4c4bc3))['catch'](handleError(_0x26e01f,null));};exports[_0x3e0c('0x44')]=function(_0x22fcd8,_0x52aafb){var _0x5e9590={'raw':![],'where':{'id':_0x22fcd8[_0x3e0c('0x45')]['id']}},_0x2344c8={};_0x2344c8[_0x3e0c('0x31')]=_[_0x3e0c('0x2c')](db['UserProfileResource'][_0x3e0c('0x2b')]);_0x2344c8[_0x3e0c('0x2d')]=_[_0x3e0c('0x2c')](_0x22fcd8[_0x3e0c('0x2d')]);_0x2344c8[_0x3e0c('0x2e')]=_['intersection'](_0x2344c8[_0x3e0c('0x31')],_0x2344c8['query']);_0x5e9590[_0x3e0c('0x30')]=_[_0x3e0c('0x2f')](_0x2344c8['model'],qs['fields'](_0x22fcd8[_0x3e0c('0x2d')][_0x3e0c('0x32')]));_0x5e9590['attributes']=_0x5e9590[_0x3e0c('0x30')][_0x3e0c('0x33')]?_0x5e9590[_0x3e0c('0x30')]:_0x2344c8[_0x3e0c('0x31')];if(_0x22fcd8[_0x3e0c('0x2d')][_0x3e0c('0x41')]){_0x5e9590['include']=[{'all':!![]}];}_0x5e9590=_[_0x3e0c('0x3c')]({},_0x5e9590,_0x22fcd8[_0x3e0c('0x46')]);return db[_0x3e0c('0x2a')][_0x3e0c('0x47')](_0x5e9590)[_0x3e0c('0x24')](handleEntityNotFound(_0x52aafb,null))[_0x3e0c('0x24')](respondWithResult(_0x52aafb,null))['catch'](handleError(_0x52aafb,null));};exports[_0x3e0c('0x48')]=function(_0x21b96a,_0x323246){return db['UserProfileResource'][_0x3e0c('0x48')](_0x21b96a[_0x3e0c('0x49')],{})['then'](respondWithResult(_0x323246,0xc9))[_0x3e0c('0x4a')](handleError(_0x323246,null));};exports[_0x3e0c('0x4b')]=function(_0x2fe20f,_0x4fdb60){if(_0x2fe20f[_0x3e0c('0x49')]['id']){delete _0x2fe20f[_0x3e0c('0x49')]['id'];}return db[_0x3e0c('0x2a')][_0x3e0c('0x47')]({'where':{'id':_0x2fe20f[_0x3e0c('0x45')]['id']}})[_0x3e0c('0x24')](handleEntityNotFound(_0x4fdb60,null))[_0x3e0c('0x24')](saveUpdates(_0x2fe20f[_0x3e0c('0x49')],null))[_0x3e0c('0x24')](respondWithResult(_0x4fdb60,null))[_0x3e0c('0x4a')](handleError(_0x4fdb60,null));};exports[_0x3e0c('0x4c')]=function(_0x4efbf2,_0x20c9df){return db['UserProfileResource']['find']({'where':{'id':_0x4efbf2[_0x3e0c('0x45')]['id']}})['then'](handleEntityNotFound(_0x20c9df,null))[_0x3e0c('0x24')](removeEntity(_0x20c9df,null))[_0x3e0c('0x4a')](handleError(_0x20c9df,null));};exports['describe']=function(_0x36f8d6,_0x14b718){return db['UserProfileResource'][_0x3e0c('0x4d')]()[_0x3e0c('0x24')](respondWithResult(_0x14b718,null))[_0x3e0c('0x4a')](handleError(_0x14b718,null));}; \ No newline at end of file +var _0x689c=['merge','map','filter','options','includeAll','include','rows','show','params','length','catch','create','update','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','UserProfileResource','rawAttributes','keys','filters','intersection','attributes','model','fields','query','nolimit','limit','sort','where','pick'];(function(_0x27af38,_0x2a9cc0){var _0x6ed713=function(_0x1cbe05){while(--_0x1cbe05){_0x27af38['push'](_0x27af38['shift']());}};_0x6ed713(++_0x2a9cc0);}(_0x689c,0x9e));var _0xc689=function(_0x18245c,_0x228475){_0x18245c=_0x18245c-0x0;var _0x17aaf7=_0x689c[_0x18245c];return _0x17aaf7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc689('0x0'));var zipdir=require(_0xc689('0x1'));var jsonpatch=require(_0xc689('0x2'));var rp=require(_0xc689('0x3'));var moment=require(_0xc689('0x4'));var BPromise=require(_0xc689('0x5'));var Mustache=require('mustache');var util=require(_0xc689('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc689('0x7'));var ejs=require(_0xc689('0x8'));var fs=require('fs');var _=require(_0xc689('0x9'));var squel=require(_0xc689('0xa'));var crypto=require(_0xc689('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc689('0xc'));var toCsv=require(_0xc689('0x7'));var querystring=require(_0xc689('0xd'));var Papa=require('papaparse');var Redis=require(_0xc689('0xe'));var authService=require(_0xc689('0xf'));var qs=require(_0xc689('0x10'));var hardwareService=require(_0xc689('0x11'));var logger=require(_0xc689('0x12'))(_0xc689('0x13'));var utils=require(_0xc689('0x14'));var config=require(_0xc689('0x15'));var db=require(_0xc689('0x16'))['db'];function respondWithStatusCode(_0x387410,_0x2f18fe){_0x2f18fe=_0x2f18fe||0xcc;return function(_0x4d6f8d){if(_0x4d6f8d){return _0x387410[_0xc689('0x17')](_0x2f18fe);}return _0x387410['status'](_0x2f18fe)[_0xc689('0x18')]();};}function respondWithResult(_0x4135a2,_0x22a72c){_0x22a72c=_0x22a72c||0xc8;return function(_0x511b0c){if(_0x511b0c){return _0x4135a2[_0xc689('0x19')](_0x22a72c)[_0xc689('0x1a')](_0x511b0c);}};}function respondWithFilteredResult(_0x4fd3fc,_0x3a40c6){return function(_0x11eb20){if(_0x11eb20){var _0x3b5862=_0x11eb20[_0xc689('0x1b')],_0x335e3e=_0x3a40c6[_0xc689('0x1c')],_0x5ec591=_0x3a40c6[_0xc689('0x1c')]+_0x3a40c6['limit'],_0x5b7eea;if(_0x5ec591>=_0x3b5862){_0x5ec591=_0x3b5862;_0x5b7eea=0xc8;}else{_0x5b7eea=0xce;}_0x4fd3fc['status'](_0x5b7eea);return _0x4fd3fc[_0xc689('0x1d')](_0xc689('0x1e'),_0x335e3e+'-'+_0x5ec591+'/'+_0x3b5862)[_0xc689('0x1a')](_0x11eb20);}return null;};}function patchUpdates(_0x38665c){return function(_0xea568f){try{jsonpatch[_0xc689('0x1f')](_0xea568f,_0x38665c,!![]);}catch(_0x4fa3ce){return BPromise[_0xc689('0x20')](_0x4fa3ce);}return _0xea568f[_0xc689('0x21')]();};}function saveUpdates(_0x4bf5ca,_0x4d0309){return function(_0x48c789){if(_0x48c789){return _0x48c789['update'](_0x4bf5ca)['then'](function(_0x3666e9){return _0x3666e9;});}return null;};}function removeEntity(_0x40aeb4,_0x1c41c2){return function(_0x98d077){if(_0x98d077){return _0x98d077[_0xc689('0x22')]()[_0xc689('0x23')](function(){_0x40aeb4[_0xc689('0x19')](0xcc)[_0xc689('0x18')]();});}};}function handleEntityNotFound(_0x1b9f12,_0x2efdec){return function(_0x8215e5){if(!_0x8215e5){_0x1b9f12[_0xc689('0x17')](0x194);}return _0x8215e5;};}function handleError(_0x154d1e,_0x466cb8){_0x466cb8=_0x466cb8||0x1f4;return function(_0x2f10c4){logger[_0xc689('0x24')](_0x2f10c4[_0xc689('0x25')]);if(_0x2f10c4[_0xc689('0x26')]){delete _0x2f10c4[_0xc689('0x26')];}_0x154d1e[_0xc689('0x19')](_0x466cb8)[_0xc689('0x27')](_0x2f10c4);};}exports[_0xc689('0x28')]=function(_0x47ab9e,_0x4b3791){var _0xb3c5b4={},_0x1c01a4={},_0x35b570={'count':0x0,'rows':[]};var _0x4644ae=db[_0xc689('0x29')][_0xc689('0x2a')];_0x1c01a4['model']=_[_0xc689('0x2b')](_0x4644ae);_0x1c01a4['query']=_[_0xc689('0x2b')](_0x47ab9e['query']);_0x1c01a4[_0xc689('0x2c')]=_[_0xc689('0x2d')](_0x1c01a4['model'],_0x1c01a4['query']);_0xb3c5b4[_0xc689('0x2e')]=_[_0xc689('0x2d')](_0x1c01a4[_0xc689('0x2f')],qs[_0xc689('0x30')](_0x47ab9e[_0xc689('0x31')][_0xc689('0x30')]));_0xb3c5b4[_0xc689('0x2e')]=_0xb3c5b4[_0xc689('0x2e')]['length']?_0xb3c5b4[_0xc689('0x2e')]:_0x1c01a4['model'];if(!_0x47ab9e['query']['hasOwnProperty'](_0xc689('0x32'))){_0xb3c5b4[_0xc689('0x33')]=qs[_0xc689('0x33')](_0x47ab9e[_0xc689('0x31')][_0xc689('0x33')]);_0xb3c5b4['offset']=qs[_0xc689('0x1c')](_0x47ab9e[_0xc689('0x31')][_0xc689('0x1c')]);}_0xb3c5b4['order']=qs[_0xc689('0x34')](_0x47ab9e[_0xc689('0x31')][_0xc689('0x34')]);_0xb3c5b4[_0xc689('0x35')]=qs['filters'](_[_0xc689('0x36')](_0x47ab9e[_0xc689('0x31')],_0x1c01a4[_0xc689('0x2c')]));if(_0x47ab9e[_0xc689('0x31')]['filter']){_0xb3c5b4[_0xc689('0x35')]=_[_0xc689('0x37')](_0xb3c5b4['where'],{'$or':_[_0xc689('0x38')](_0x4644ae,function(_0x5dae66){if(_0x5dae66['type']['key']!=='VIRTUAL'){var _0x4d5c82={};_0x4d5c82[_0x5dae66['field']]={'$like':'%'+_0x47ab9e[_0xc689('0x31')][_0xc689('0x39')]+'%'};return _0x4d5c82;}})});}_0xb3c5b4=_[_0xc689('0x37')]({},_0xb3c5b4,_0x47ab9e[_0xc689('0x3a')]);var _0x576151={'where':_0xb3c5b4[_0xc689('0x35')]};return db[_0xc689('0x29')]['count'](_0x576151)['then'](function(_0xae0b2d){_0x35b570[_0xc689('0x1b')]=_0xae0b2d;if(_0x47ab9e[_0xc689('0x31')][_0xc689('0x3b')]){_0xb3c5b4[_0xc689('0x3c')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0xb3c5b4);})[_0xc689('0x23')](function(_0x189124){_0x35b570[_0xc689('0x3d')]=_0x189124;return _0x35b570;})['then'](respondWithFilteredResult(_0x4b3791,_0xb3c5b4))['catch'](handleError(_0x4b3791,null));};exports[_0xc689('0x3e')]=function(_0x1d445e,_0xc116e4){var _0x4e3806={'raw':![],'where':{'id':_0x1d445e[_0xc689('0x3f')]['id']}},_0x30f5e7={};_0x30f5e7[_0xc689('0x2f')]=_[_0xc689('0x2b')](db['UserProfileResource']['rawAttributes']);_0x30f5e7['query']=_['keys'](_0x1d445e[_0xc689('0x31')]);_0x30f5e7[_0xc689('0x2c')]=_['intersection'](_0x30f5e7[_0xc689('0x2f')],_0x30f5e7[_0xc689('0x31')]);_0x4e3806[_0xc689('0x2e')]=_[_0xc689('0x2d')](_0x30f5e7[_0xc689('0x2f')],qs[_0xc689('0x30')](_0x1d445e[_0xc689('0x31')][_0xc689('0x30')]));_0x4e3806['attributes']=_0x4e3806[_0xc689('0x2e')][_0xc689('0x40')]?_0x4e3806[_0xc689('0x2e')]:_0x30f5e7[_0xc689('0x2f')];if(_0x1d445e['query'][_0xc689('0x3b')]){_0x4e3806[_0xc689('0x3c')]=[{'all':!![]}];}_0x4e3806=_['merge']({},_0x4e3806,_0x1d445e[_0xc689('0x3a')]);return db[_0xc689('0x29')]['find'](_0x4e3806)[_0xc689('0x23')](handleEntityNotFound(_0xc116e4,null))['then'](respondWithResult(_0xc116e4,null))[_0xc689('0x41')](handleError(_0xc116e4,null));};exports['create']=function(_0xbc826e,_0x4bc43c){return db[_0xc689('0x29')][_0xc689('0x42')](_0xbc826e['body'],{})[_0xc689('0x23')](respondWithResult(_0x4bc43c,0xc9))[_0xc689('0x41')](handleError(_0x4bc43c,null));};exports[_0xc689('0x43')]=function(_0x356472,_0x4d939d){if(_0x356472[_0xc689('0x44')]['id']){delete _0x356472['body']['id'];}return db[_0xc689('0x29')]['find']({'where':{'id':_0x356472[_0xc689('0x3f')]['id']}})[_0xc689('0x23')](handleEntityNotFound(_0x4d939d,null))[_0xc689('0x23')](saveUpdates(_0x356472['body'],null))[_0xc689('0x23')](respondWithResult(_0x4d939d,null))[_0xc689('0x41')](handleError(_0x4d939d,null));};exports[_0xc689('0x22')]=function(_0x2bd467,_0x26615e){return db[_0xc689('0x29')][_0xc689('0x45')]({'where':{'id':_0x2bd467[_0xc689('0x3f')]['id']}})[_0xc689('0x23')](handleEntityNotFound(_0x26615e,null))[_0xc689('0x23')](removeEntity(_0x26615e,null))['catch'](handleError(_0x26615e,null));};exports['describe']=function(_0xb4438,_0x3ab8c0){return db[_0xc689('0x29')][_0xc689('0x46')]()[_0xc689('0x23')](respondWithResult(_0x3ab8c0,null))[_0xc689('0x41')](handleError(_0x3ab8c0,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 653d0b8..78bc5e2 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 _0xa18b=['define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0xa18b,0x95));var _0xba18=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xa18b[_0x4c6d6f];return _0x2d4478;};'use strict';var _=require(_0xba18('0x0'));var util=require('util');var logger=require(_0xba18('0x1'))(_0xba18('0x2'));var moment=require(_0xba18('0x3'));var BPromise=require(_0xba18('0x4'));var rp=require(_0xba18('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba18('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x200155,_0x3b0115){return _0x200155[_0xba18('0x7')](_0xba18('0x8'),attributes,{'tableName':_0xba18('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xba18('0xa'),_0xba18('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f8b=['sectionId','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','resourceId'];(function(_0x42e435,_0x27dc76){var _0x12608d=function(_0x1513b1){while(--_0x1513b1){_0x42e435['push'](_0x42e435['shift']());}};_0x12608d(++_0x27dc76);}(_0x8f8b,0x1e2));var _0xb8f8=function(_0x38c167,_0x5d7e7a){_0x38c167=_0x38c167-0x0;var _0xe3756f=_0x8f8b[_0x38c167];return _0xe3756f;};'use strict';var _=require(_0xb8f8('0x0'));var util=require(_0xb8f8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb8f8('0x2'));var BPromise=require(_0xb8f8('0x3'));var rp=require(_0xb8f8('0x4'));var fs=require('fs');var path=require(_0xb8f8('0x5'));var rimraf=require('rimraf');var config=require(_0xb8f8('0x6'));var attributes=require(_0xb8f8('0x7'));module[_0xb8f8('0x8')]=function(_0x2869f0,_0x838152){return _0x2869f0[_0xb8f8('0x9')](_0xb8f8('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xb8f8('0xb'),_0xb8f8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e151041..adfca7b 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 _0x1666=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x30cc80,_0xf1b9f){var _0x478d83=function(_0x391bd7){while(--_0x391bd7){_0x30cc80['push'](_0x30cc80['shift']());}};_0x478d83(++_0xf1b9f);}(_0x1666,0x75));var _0x6166=function(_0x1f403e,_0x1dfb0f){_0x1f403e=_0x1f403e-0x0;var _0x22ccae=_0x1666[_0x1f403e];return _0x22ccae;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require('moment');var BPromise=require(_0x6166('0x2'));var rs=require(_0x6166('0x3'));var fs=require('fs');var Redis=require(_0x6166('0x4'));var db=require(_0x6166('0x5'))['db'];var utils=require(_0x6166('0x6'));var logger=require(_0x6166('0x7'))(_0x6166('0x8'));var config=require(_0x6166('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6166('0xa')][_0x6166('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x211a92,_0x1a61d0,_0x3a29ca){return new BPromise(function(_0x4873da,_0x51b51f){return client['request'](_0x211a92,_0x3a29ca)[_0x6166('0xc')](function(_0x5ee7b3){logger[_0x6166('0xd')](_0x6166('0xe'),_0x1a61d0,_0x6166('0xf'));logger[_0x6166('0x10')](_0x6166('0x11'),_0x1a61d0,_0x6166('0xf'),JSON[_0x6166('0x12')](_0x5ee7b3));if(_0x5ee7b3['error']){if(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x14')]===0x1f4){logger[_0x6166('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x51b51f(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}logger['error'](_0x6166('0xe'),_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x4873da(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}else{logger[_0x6166('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x1a61d0,_0x6166('0xf'));_0x4873da(_0x5ee7b3[_0x6166('0x16')][_0x6166('0x15')]);}})[_0x6166('0x17')](function(_0x24bdf3){logger[_0x6166('0x13')](_0x6166('0xe'),_0x1a61d0,_0x24bdf3);_0x51b51f(_0x24bdf3);});});} \ No newline at end of file +var _0xa884=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','request\x20sent','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xa884,0xc6));var _0x4a88=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0xa884[_0x5f3905];return _0x2923b1;};'use strict';var _=require(_0x4a88('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a88('0x1'));var rs=require(_0x4a88('0x2'));var fs=require('fs');var Redis=require(_0x4a88('0x3'));var db=require(_0x4a88('0x4'))['db'];var utils=require(_0x4a88('0x5'));var logger=require(_0x4a88('0x6'))(_0x4a88('0x7'));var config=require(_0x4a88('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a88('0x9')][_0x4a88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a4bdf,_0x10caee,_0x668a1f){return new BPromise(function(_0x5b471c,_0x4f0e77){return client[_0x4a88('0xb')](_0x2a4bdf,_0x668a1f)['then'](function(_0x68516b){logger[_0x4a88('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x10caee,'request\x20sent');logger[_0x4a88('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x10caee,_0x4a88('0xe'),JSON[_0x4a88('0xf')](_0x68516b));if(_0x68516b[_0x4a88('0x10')]){if(_0x68516b['error'][_0x4a88('0x11')]===0x1f4){logger['error'](_0x4a88('0x12'),_0x10caee,_0x68516b[_0x4a88('0x10')][_0x4a88('0x13')]);return _0x4f0e77(_0x68516b[_0x4a88('0x10')][_0x4a88('0x13')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x10caee,_0x68516b[_0x4a88('0x10')][_0x4a88('0x13')]);return _0x5b471c(_0x68516b[_0x4a88('0x10')]['message']);}else{logger[_0x4a88('0xc')](_0x4a88('0x12'),_0x10caee,_0x4a88('0xe'));_0x5b471c(_0x68516b[_0x4a88('0x14')]['message']);}})[_0x4a88('0x15')](function(_0x56359e){logger[_0x4a88('0x10')](_0x4a88('0x12'),_0x10caee,_0x56359e);_0x4f0e77(_0x56359e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c0e32bb..3ed3916 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 _0xabf2=['update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x4f773d,_0x292b52){var _0x5064c1=function(_0x3a98cc){while(--_0x3a98cc){_0x4f773d['push'](_0x4f773d['shift']());}};_0x5064c1(++_0x292b52);}(_0xabf2,0xe6));var _0x2abf=function(_0x4a611b,_0x29431e){_0x4a611b=_0x4a611b-0x0;var _0x31b514=_0xabf2[_0x4a611b];return _0x31b514;};'use strict';var multer=require(_0x2abf('0x0'));var util=require(_0x2abf('0x1'));var path=require('path');var timeout=require(_0x2abf('0x2'));var express=require(_0x2abf('0x3'));var router=express[_0x2abf('0x4')]();var auth=require(_0x2abf('0x5'));var interaction=require(_0x2abf('0x6'));var config=require(_0x2abf('0x7'));var controller=require('./userProfileSection.controller');router[_0x2abf('0x8')]('/',auth[_0x2abf('0x9')](),controller[_0x2abf('0xa')]);router[_0x2abf('0x8')](_0x2abf('0xb'),auth[_0x2abf('0x9')](),controller[_0x2abf('0xc')]);router[_0x2abf('0x8')](_0x2abf('0xd'),auth[_0x2abf('0x9')](),controller['show']);router[_0x2abf('0xe')]('/',auth[_0x2abf('0x9')](),controller[_0x2abf('0xf')]);router[_0x2abf('0x10')](_0x2abf('0xd'),auth[_0x2abf('0x9')](),controller[_0x2abf('0x11')]);router['delete'](_0x2abf('0xd'),auth[_0x2abf('0x9')](),controller[_0x2abf('0x12')]);module['exports']=router; \ No newline at end of file +var _0x372a=['express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0xd9c7d3,_0x478e9b){var _0x55e790=function(_0xc4cbd1){while(--_0xc4cbd1){_0xd9c7d3['push'](_0xd9c7d3['shift']());}};_0x55e790(++_0x478e9b);}(_0x372a,0x177));var _0xa372=function(_0xfd4477,_0x13c229){_0xfd4477=_0xfd4477-0x0;var _0x34f3bf=_0x372a[_0xfd4477];return _0x34f3bf;};'use strict';var multer=require(_0xa372('0x0'));var util=require('util');var path=require(_0xa372('0x1'));var timeout=require(_0xa372('0x2'));var express=require(_0xa372('0x3'));var router=express[_0xa372('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa372('0x5'));var config=require(_0xa372('0x6'));var controller=require(_0xa372('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa372('0x8')]);router['get'](_0xa372('0x9'),auth[_0xa372('0xa')](),controller[_0xa372('0xb')]);router[_0xa372('0xc')](_0xa372('0xd'),auth[_0xa372('0xa')](),controller[_0xa372('0xe')]);router[_0xa372('0xf')]('/',auth['isAuthenticated'](),controller[_0xa372('0x10')]);router['put'](_0xa372('0xd'),auth['isAuthenticated'](),controller[_0xa372('0x11')]);router[_0xa372('0x12')](_0xa372('0xd'),auth['isAuthenticated'](),controller[_0xa372('0x13')]);module[_0xa372('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index c438a6d..92e9410 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 _0x5a8c=['join','getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x4383e9,_0xa4b307){var _0x355405=function(_0x545b5b){while(--_0x545b5b){_0x4383e9['push'](_0x4383e9['shift']());}};_0x355405(++_0xa4b307);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x551ece,_0x23d845){_0x551ece=_0x551ece-0x0;var _0x24ac88=_0x5a8c[_0x551ece];return _0x24ac88;};'use strict';var Sequelize=require(_0xc5a8('0x0'));module[_0xc5a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xc5a8('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc5a8('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc5a8('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xc5a8('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2d862c){this[_0xc5a8('0x5')]('crudPermissions',_0x2d862c?_0x2d862c[_0xc5a8('0x6')](''):[]);},'get':function(){return this[_0xc5a8('0x7')](_0xc5a8('0x8'))?this[_0xc5a8('0x7')](_0xc5a8('0x8'))[_0xc5a8('0x9')](''):[];}}}; \ No newline at end of file +var _0x05dc=['BOOLEAN','STRING','setDataValue','crudPermissions','join','getDataValue','split','exports','INTEGER'];(function(_0x409c52,_0x2df480){var _0x23b2cf=function(_0x2e7899){while(--_0x2e7899){_0x409c52['push'](_0x409c52['shift']());}};_0x23b2cf(++_0x2df480);}(_0x05dc,0x178));var _0xc05d=function(_0x8666ec,_0x34fb14){_0x8666ec=_0x8666ec-0x0;var _0x496fe8=_0x05dc[_0x8666ec];return _0x496fe8;};'use strict';var Sequelize=require('sequelize');module[_0xc05d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc05d('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc05d('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xc05d('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc05d('0x3')],'set':function(_0x3fe971){this[_0xc05d('0x4')](_0xc05d('0x5'),_0x3fe971?_0x3fe971[_0xc05d('0x6')](''):[]);},'get':function(){return this[_0xc05d('0x7')](_0xc05d('0x5'))?this[_0xc05d('0x7')]('crudPermissions')[_0xc05d('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9cd28ae..d2ddab9 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 _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','stack','name','send','index','UserProfileSection','rawAttributes','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','key','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','html-pdf'];(function(_0x506cbf,_0xb7e1d8){var _0x5513f1=function(_0x25a9c4){while(--_0x25a9c4){_0x506cbf['push'](_0x506cbf['shift']());}};_0x5513f1(++_0xb7e1d8);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 hardwareService=require(_0x7995('0x15'));var logger=require(_0x7995('0x16'))('api');var utils=require(_0x7995('0x17'));var config=require(_0x7995('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb0c872,_0x2cb37a){_0x2cb37a=_0x2cb37a||0xcc;return function(_0x19a27e){if(_0x19a27e){return _0xb0c872[_0x7995('0x19')](_0x2cb37a);}return _0xb0c872[_0x7995('0x1a')](_0x2cb37a)[_0x7995('0x1b')]();};}function respondWithResult(_0x2bbe7a,_0x4cc004){_0x4cc004=_0x4cc004||0xc8;return function(_0x58f5ad){if(_0x58f5ad){return _0x2bbe7a[_0x7995('0x1a')](_0x4cc004)[_0x7995('0x1c')](_0x58f5ad);}};}function respondWithFilteredResult(_0x24b5bb,_0x321ae8){return function(_0x3f1d3e){if(_0x3f1d3e){var _0x1a5310=_0x3f1d3e[_0x7995('0x1d')],_0x2202ce=_0x321ae8['offset'],_0x41cbf0=_0x321ae8[_0x7995('0x1e')]+_0x321ae8[_0x7995('0x1f')],_0x5377e5;if(_0x41cbf0>=_0x1a5310){_0x41cbf0=_0x1a5310;_0x5377e5=0xc8;}else{_0x5377e5=0xce;}_0x24b5bb[_0x7995('0x1a')](_0x5377e5);return _0x24b5bb[_0x7995('0x20')](_0x7995('0x21'),_0x2202ce+'-'+_0x41cbf0+'/'+_0x1a5310)[_0x7995('0x1c')](_0x3f1d3e);}return null;};}function patchUpdates(_0x4faa60){return function(_0x54c9ae){try{jsonpatch[_0x7995('0x22')](_0x54c9ae,_0x4faa60,!![]);}catch(_0x5e6f90){return BPromise['reject'](_0x5e6f90);}return _0x54c9ae[_0x7995('0x23')]();};}function saveUpdates(_0x3d463e,_0x4cbe10){return function(_0x3a9b54){if(_0x3a9b54){return _0x3a9b54['update'](_0x3d463e)['then'](function(_0x3e4c54){return _0x3e4c54;});}return null;};}function removeEntity(_0x327b1f,_0x350fd9){return function(_0x1a8568){if(_0x1a8568){return _0x1a8568[_0x7995('0x24')]()[_0x7995('0x25')](function(){_0x327b1f['status'](0xcc)[_0x7995('0x1b')]();});}};}function handleEntityNotFound(_0x46ee4b,_0x204507){return function(_0x285437){if(!_0x285437){_0x46ee4b[_0x7995('0x19')](0x194);}return _0x285437;};}function handleError(_0x13bc35,_0x475351){_0x475351=_0x475351||0x1f4;return function(_0x472195){logger['error'](_0x472195[_0x7995('0x26')]);if(_0x472195[_0x7995('0x27')]){delete _0x472195[_0x7995('0x27')];}_0x13bc35[_0x7995('0x1a')](_0x475351)[_0x7995('0x28')](_0x472195);};}exports[_0x7995('0x29')]=function(_0x56691a,_0x47625f){var _0x5911c3={},_0x229742={},_0x49bc7e={'count':0x0,'rows':[]};var _0xf16cc2=db[_0x7995('0x2a')][_0x7995('0x2b')];_0x229742['model']=_[_0x7995('0x2c')](_0xf16cc2);_0x229742['query']=_[_0x7995('0x2c')](_0x56691a[_0x7995('0x2d')]);_0x229742[_0x7995('0x2e')]=_['intersection'](_0x229742['model'],_0x229742['query']);_0x5911c3[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x229742[_0x7995('0x31')],qs[_0x7995('0x32')](_0x56691a[_0x7995('0x2d')][_0x7995('0x32')]));_0x5911c3['attributes']=_0x5911c3['attributes'][_0x7995('0x33')]?_0x5911c3['attributes']:_0x229742[_0x7995('0x31')];if(!_0x56691a[_0x7995('0x2d')][_0x7995('0x34')](_0x7995('0x35'))){_0x5911c3[_0x7995('0x1f')]=qs['limit'](_0x56691a[_0x7995('0x2d')][_0x7995('0x1f')]);_0x5911c3['offset']=qs['offset'](_0x56691a['query'][_0x7995('0x1e')]);}_0x5911c3[_0x7995('0x36')]=qs['sort'](_0x56691a[_0x7995('0x2d')]['sort']);_0x5911c3[_0x7995('0x37')]=qs[_0x7995('0x2e')](_[_0x7995('0x38')](_0x56691a['query'],_0x229742['filters']));if(_0x56691a[_0x7995('0x2d')]['filter']){_0x5911c3['where']=_[_0x7995('0x39')](_0x5911c3[_0x7995('0x37')],{'$or':_['map'](_0xf16cc2,function(_0x1baa15){if(_0x1baa15[_0x7995('0x3a')][_0x7995('0x3b')]!==_0x7995('0x3c')){var _0x1e3dbf={};_0x1e3dbf[_0x1baa15['field']]={'$like':'%'+_0x56691a[_0x7995('0x2d')][_0x7995('0x3d')]+'%'};return _0x1e3dbf;}})});}_0x5911c3=_[_0x7995('0x39')]({},_0x5911c3,_0x56691a[_0x7995('0x3e')]);var _0x4b1541={'where':_0x5911c3[_0x7995('0x37')]};return db[_0x7995('0x2a')][_0x7995('0x1d')](_0x4b1541)[_0x7995('0x25')](function(_0x1f5bee){_0x49bc7e[_0x7995('0x1d')]=_0x1f5bee;if(_0x56691a['query'][_0x7995('0x3f')]){_0x5911c3[_0x7995('0x40')]=[{'all':!![]}];}return db[_0x7995('0x2a')][_0x7995('0x41')](_0x5911c3);})[_0x7995('0x25')](function(_0x298fc2){_0x49bc7e[_0x7995('0x42')]=_0x298fc2;return _0x49bc7e;})[_0x7995('0x25')](respondWithFilteredResult(_0x47625f,_0x5911c3))[_0x7995('0x43')](handleError(_0x47625f,null));};exports[_0x7995('0x44')]=function(_0x6fe77b,_0x270d52){var _0x7b4e67={'raw':![],'where':{'id':_0x6fe77b['params']['id']}},_0x53cda2={};_0x53cda2[_0x7995('0x31')]=_[_0x7995('0x2c')](db['UserProfileSection']['rawAttributes']);_0x53cda2[_0x7995('0x2d')]=_['keys'](_0x6fe77b['query']);_0x53cda2[_0x7995('0x2e')]=_[_0x7995('0x30')](_0x53cda2[_0x7995('0x31')],_0x53cda2['query']);_0x7b4e67[_0x7995('0x2f')]=_['intersection'](_0x53cda2[_0x7995('0x31')],qs['fields'](_0x6fe77b['query'][_0x7995('0x32')]));_0x7b4e67[_0x7995('0x2f')]=_0x7b4e67[_0x7995('0x2f')][_0x7995('0x33')]?_0x7b4e67['attributes']:_0x53cda2[_0x7995('0x31')];if(_0x6fe77b[_0x7995('0x2d')][_0x7995('0x3f')]){_0x7b4e67[_0x7995('0x40')]=[{'all':!![]}];}_0x7b4e67=_['merge']({},_0x7b4e67,_0x6fe77b['options']);return db[_0x7995('0x2a')]['find'](_0x7b4e67)[_0x7995('0x25')](handleEntityNotFound(_0x270d52,null))['then'](respondWithResult(_0x270d52,null))[_0x7995('0x43')](handleError(_0x270d52,null));};exports['create']=function(_0x1e795e,_0x1b0373){return db['UserProfileSection'][_0x7995('0x45')](_0x1e795e[_0x7995('0x46')],{})[_0x7995('0x25')](respondWithResult(_0x1b0373,0xc9))[_0x7995('0x43')](handleError(_0x1b0373,null));};exports['update']=function(_0x2458cb,_0x3e787d){if(_0x2458cb[_0x7995('0x46')]['id']){delete _0x2458cb['body']['id'];}return db[_0x7995('0x2a')][_0x7995('0x47')]({'where':{'id':_0x2458cb[_0x7995('0x48')]['id']}})[_0x7995('0x25')](handleEntityNotFound(_0x3e787d,null))[_0x7995('0x25')](saveUpdates(_0x2458cb['body'],null))[_0x7995('0x25')](respondWithResult(_0x3e787d,null))[_0x7995('0x43')](handleError(_0x3e787d,null));};exports['destroy']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x2a')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x48')]['id']}})[_0x7995('0x25')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x25')](removeEntity(_0x5843ba,null))[_0x7995('0x43')](handleError(_0x5843ba,null));};exports[_0x7995('0x49')]=function(_0x4d46bc,_0x427dcf){return db[_0x7995('0x2a')][_0x7995('0x49')]()['then'](respondWithResult(_0x427dcf,null))[_0x7995('0x43')](handleError(_0x427dcf,null));}; \ No newline at end of file +var _0x7217=['query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','type','key','VIRTUAL','field','includeAll','findAll','rows','catch','show','params','include','merge','options','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','UserProfileSection','rawAttributes','model','keys'];(function(_0x7ab25,_0x1bf947){var _0x580f59=function(_0x4a3813){while(--_0x4a3813){_0x7ab25['push'](_0x7ab25['shift']());}};_0x580f59(++_0x1bf947);}(_0x7217,0x19e));var _0x7721=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7217[_0x4baae2];return _0x1a2285;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x7721('0x14'));var logger=require(_0x7721('0x15'))(_0x7721('0x16'));var utils=require(_0x7721('0x17'));var config=require(_0x7721('0x18'));var db=require(_0x7721('0x19'))['db'];function respondWithStatusCode(_0x1e7fd7,_0x27b36b){_0x27b36b=_0x27b36b||0xcc;return function(_0x55b4ca){if(_0x55b4ca){return _0x1e7fd7[_0x7721('0x1a')](_0x27b36b);}return _0x1e7fd7[_0x7721('0x1b')](_0x27b36b)['end']();};}function respondWithResult(_0x109900,_0x30da54){_0x30da54=_0x30da54||0xc8;return function(_0x3f01c5){if(_0x3f01c5){return _0x109900[_0x7721('0x1b')](_0x30da54)['json'](_0x3f01c5);}};}function respondWithFilteredResult(_0x3cbce8,_0x25b1c0){return function(_0x534f1b){if(_0x534f1b){var _0x4e199a=_0x534f1b[_0x7721('0x1c')],_0x4b183e=_0x25b1c0[_0x7721('0x1d')],_0x5ed54=_0x25b1c0['offset']+_0x25b1c0[_0x7721('0x1e')],_0x25a628;if(_0x5ed54>=_0x4e199a){_0x5ed54=_0x4e199a;_0x25a628=0xc8;}else{_0x25a628=0xce;}_0x3cbce8['status'](_0x25a628);return _0x3cbce8[_0x7721('0x1f')]('Content-Range',_0x4b183e+'-'+_0x5ed54+'/'+_0x4e199a)[_0x7721('0x20')](_0x534f1b);}return null;};}function patchUpdates(_0x4e96fb){return function(_0x3ab5a5){try{jsonpatch[_0x7721('0x21')](_0x3ab5a5,_0x4e96fb,!![]);}catch(_0x2286e5){return BPromise[_0x7721('0x22')](_0x2286e5);}return _0x3ab5a5[_0x7721('0x23')]();};}function saveUpdates(_0x413263,_0x3b29ac){return function(_0xaeccc4){if(_0xaeccc4){return _0xaeccc4['update'](_0x413263)[_0x7721('0x24')](function(_0x2c1583){return _0x2c1583;});}return null;};}function removeEntity(_0x3a053f,_0xd8ad3c){return function(_0x57140c){if(_0x57140c){return _0x57140c[_0x7721('0x25')]()['then'](function(){_0x3a053f[_0x7721('0x1b')](0xcc)[_0x7721('0x26')]();});}};}function handleEntityNotFound(_0x3e8a4e,_0x1caad8){return function(_0x121cc4){if(!_0x121cc4){_0x3e8a4e[_0x7721('0x1a')](0x194);}return _0x121cc4;};}function handleError(_0x2c6b7b,_0x5b4d74){_0x5b4d74=_0x5b4d74||0x1f4;return function(_0x216f20){logger[_0x7721('0x27')](_0x216f20[_0x7721('0x28')]);if(_0x216f20[_0x7721('0x29')]){delete _0x216f20[_0x7721('0x29')];}_0x2c6b7b[_0x7721('0x1b')](_0x5b4d74)[_0x7721('0x2a')](_0x216f20);};}exports[_0x7721('0x2b')]=function(_0x40f367,_0x52316e){var _0x258ddf={},_0x5b0551={},_0x499b87={'count':0x0,'rows':[]};var _0x315202=db[_0x7721('0x2c')][_0x7721('0x2d')];_0x5b0551[_0x7721('0x2e')]=_[_0x7721('0x2f')](_0x315202);_0x5b0551[_0x7721('0x30')]=_[_0x7721('0x2f')](_0x40f367[_0x7721('0x30')]);_0x5b0551['filters']=_[_0x7721('0x31')](_0x5b0551[_0x7721('0x2e')],_0x5b0551['query']);_0x258ddf['attributes']=_[_0x7721('0x31')](_0x5b0551[_0x7721('0x2e')],qs['fields'](_0x40f367[_0x7721('0x30')][_0x7721('0x32')]));_0x258ddf[_0x7721('0x33')]=_0x258ddf['attributes'][_0x7721('0x34')]?_0x258ddf[_0x7721('0x33')]:_0x5b0551[_0x7721('0x2e')];if(!_0x40f367[_0x7721('0x30')][_0x7721('0x35')]('nolimit')){_0x258ddf[_0x7721('0x1e')]=qs[_0x7721('0x1e')](_0x40f367[_0x7721('0x30')]['limit']);_0x258ddf[_0x7721('0x1d')]=qs[_0x7721('0x1d')](_0x40f367['query'][_0x7721('0x1d')]);}_0x258ddf['order']=qs[_0x7721('0x36')](_0x40f367[_0x7721('0x30')][_0x7721('0x36')]);_0x258ddf[_0x7721('0x37')]=qs[_0x7721('0x38')](_[_0x7721('0x39')](_0x40f367[_0x7721('0x30')],_0x5b0551[_0x7721('0x38')]));if(_0x40f367[_0x7721('0x30')][_0x7721('0x3a')]){_0x258ddf[_0x7721('0x37')]=_['merge'](_0x258ddf[_0x7721('0x37')],{'$or':_['map'](_0x315202,function(_0x212384){if(_0x212384[_0x7721('0x3b')][_0x7721('0x3c')]!==_0x7721('0x3d')){var _0x3968f3={};_0x3968f3[_0x212384[_0x7721('0x3e')]]={'$like':'%'+_0x40f367['query']['filter']+'%'};return _0x3968f3;}})});}_0x258ddf=_['merge']({},_0x258ddf,_0x40f367['options']);var _0x18001c={'where':_0x258ddf[_0x7721('0x37')]};return db[_0x7721('0x2c')][_0x7721('0x1c')](_0x18001c)['then'](function(_0xa389fa){_0x499b87['count']=_0xa389fa;if(_0x40f367[_0x7721('0x30')][_0x7721('0x3f')]){_0x258ddf['include']=[{'all':!![]}];}return db[_0x7721('0x2c')][_0x7721('0x40')](_0x258ddf);})['then'](function(_0x4d0111){_0x499b87[_0x7721('0x41')]=_0x4d0111;return _0x499b87;})[_0x7721('0x24')](respondWithFilteredResult(_0x52316e,_0x258ddf))[_0x7721('0x42')](handleError(_0x52316e,null));};exports[_0x7721('0x43')]=function(_0x577af9,_0x2db173){var _0x120de9={'raw':![],'where':{'id':_0x577af9[_0x7721('0x44')]['id']}},_0x40ce8c={};_0x40ce8c[_0x7721('0x2e')]=_['keys'](db[_0x7721('0x2c')]['rawAttributes']);_0x40ce8c[_0x7721('0x30')]=_['keys'](_0x577af9[_0x7721('0x30')]);_0x40ce8c[_0x7721('0x38')]=_[_0x7721('0x31')](_0x40ce8c['model'],_0x40ce8c[_0x7721('0x30')]);_0x120de9[_0x7721('0x33')]=_[_0x7721('0x31')](_0x40ce8c['model'],qs[_0x7721('0x32')](_0x577af9[_0x7721('0x30')][_0x7721('0x32')]));_0x120de9[_0x7721('0x33')]=_0x120de9[_0x7721('0x33')][_0x7721('0x34')]?_0x120de9[_0x7721('0x33')]:_0x40ce8c['model'];if(_0x577af9['query'][_0x7721('0x3f')]){_0x120de9[_0x7721('0x45')]=[{'all':!![]}];}_0x120de9=_[_0x7721('0x46')]({},_0x120de9,_0x577af9[_0x7721('0x47')]);return db[_0x7721('0x2c')][_0x7721('0x48')](_0x120de9)[_0x7721('0x24')](handleEntityNotFound(_0x2db173,null))[_0x7721('0x24')](respondWithResult(_0x2db173,null))[_0x7721('0x42')](handleError(_0x2db173,null));};exports[_0x7721('0x49')]=function(_0x5460cd,_0x578867){return db[_0x7721('0x2c')][_0x7721('0x49')](_0x5460cd[_0x7721('0x4a')],{})[_0x7721('0x24')](respondWithResult(_0x578867,0xc9))['catch'](handleError(_0x578867,null));};exports[_0x7721('0x4b')]=function(_0x2d5a88,_0x56c3d9){if(_0x2d5a88[_0x7721('0x4a')]['id']){delete _0x2d5a88['body']['id'];}return db[_0x7721('0x2c')]['find']({'where':{'id':_0x2d5a88[_0x7721('0x44')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x56c3d9,null))[_0x7721('0x24')](saveUpdates(_0x2d5a88['body'],null))[_0x7721('0x24')](respondWithResult(_0x56c3d9,null))[_0x7721('0x42')](handleError(_0x56c3d9,null));};exports['destroy']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x2c')]['find']({'where':{'id':_0x223d93[_0x7721('0x44')]['id']}})['then'](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x24')](removeEntity(_0x1196c2,null))[_0x7721('0x42')](handleError(_0x1196c2,null));};exports[_0x7721('0x4c')]=function(_0x443503,_0x1c95d8){return db[_0x7721('0x2c')][_0x7721('0x4c')]()[_0x7721('0x24')](respondWithResult(_0x1c95d8,null))[_0x7721('0x42')](handleError(_0x1c95d8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 05d9dc8..a88aa7c 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 _0xea77=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash'];(function(_0xc808c2,_0x429955){var _0x513145=function(_0x5efd36){while(--_0x5efd36){_0xc808c2['push'](_0xc808c2['shift']());}};_0x513145(++_0x429955);}(_0xea77,0xd1));var _0x7ea7=function(_0x48cdd7,_0x35736d){_0x48cdd7=_0x48cdd7-0x0;var _0x368692=_0xea77[_0x48cdd7];return _0x368692;};'use strict';var _=require(_0x7ea7('0x0'));var util=require(_0x7ea7('0x1'));var logger=require(_0x7ea7('0x2'))(_0x7ea7('0x3'));var moment=require(_0x7ea7('0x4'));var BPromise=require(_0x7ea7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ea7('0x6'));var rimraf=require(_0x7ea7('0x7'));var config=require(_0x7ea7('0x8'));var attributes=require(_0x7ea7('0x9'));module['exports']=function(_0x54e587,_0x54c26a){return _0x54e587[_0x7ea7('0xa')](_0x7ea7('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x7ea7('0xc'),'fields':[_0x7ea7('0xd'),_0x7ea7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f7e=['request-promise','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','lodash','../../config/logger','api','moment','bluebird'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3f7e,0x1c3));var _0xe3f7=function(_0x2c13cc,_0x2ba4bc){_0x2c13cc=_0x2c13cc-0x0;var _0x13e5f1=_0x3f7e[_0x2c13cc];return _0x13e5f1;};'use strict';var _=require(_0xe3f7('0x0'));var util=require('util');var logger=require(_0xe3f7('0x1'))(_0xe3f7('0x2'));var moment=require(_0xe3f7('0x3'));var BPromise=require(_0xe3f7('0x4'));var rp=require(_0xe3f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3f7('0x6'));var config=require('../../config/environment');var attributes=require(_0xe3f7('0x7'));module[_0xe3f7('0x8')]=function(_0x324f84,_0x2991a6){return _0x324f84[_0xe3f7('0x9')](_0xe3f7('0xa'),attributes,{'tableName':_0xe3f7('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e2bc7d2..bf8c902 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 _0x08bb=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','message','UserProfileSection,\x20%s,\x20%s','info','result','catch','lodash','moment'];(function(_0x1d533b,_0x5d5961){var _0x2eac2a=function(_0x49a983){while(--_0x49a983){_0x1d533b['push'](_0x1d533b['shift']());}};_0x2eac2a(++_0x5d5961);}(_0x08bb,0x6c));var _0xb08b=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x08bb[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xb08b('0x0'));var util=require('util');var moment=require(_0xb08b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb08b('0x2'));var fs=require('fs');var Redis=require(_0xb08b('0x3'));var db=require(_0xb08b('0x4'))['db'];var utils=require(_0xb08b('0x5'));var logger=require('../../config/logger')(_0xb08b('0x6'));var config=require(_0xb08b('0x7'));var jayson=require(_0xb08b('0x8'));var client=jayson[_0xb08b('0x9')][_0xb08b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd4e08,_0x38115d,_0x441bff){return new BPromise(function(_0x5b0994,_0x335de9){return client[_0xb08b('0xb')](_0xdd4e08,_0x441bff)[_0xb08b('0xc')](function(_0x3a451b){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x38115d,_0xb08b('0xd'));logger[_0xb08b('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x38115d,'request\x20sent',JSON['stringify'](_0x3a451b));if(_0x3a451b[_0xb08b('0xf')]){if(_0x3a451b['error'][_0xb08b('0x10')]===0x1f4){logger[_0xb08b('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x38115d,_0x3a451b[_0xb08b('0xf')]['message']);return _0x335de9(_0x3a451b[_0xb08b('0xf')][_0xb08b('0x11')]);}logger['error'](_0xb08b('0x12'),_0x38115d,_0x3a451b[_0xb08b('0xf')]['message']);return _0x5b0994(_0x3a451b[_0xb08b('0xf')][_0xb08b('0x11')]);}else{logger[_0xb08b('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x38115d,_0xb08b('0xd'));_0x5b0994(_0x3a451b[_0xb08b('0x14')][_0xb08b('0x11')]);}})[_0xb08b('0x15')](function(_0x50a419){logger[_0xb08b('0xf')](_0xb08b('0x12'),_0x38115d,_0x50a419);_0x335de9(_0x50a419);});});} \ No newline at end of file +var _0xd3c7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird'];(function(_0x517395,_0x256a0d){var _0x420a21=function(_0x4571ef){while(--_0x4571ef){_0x517395['push'](_0x517395['shift']());}};_0x420a21(++_0x256a0d);}(_0xd3c7,0x9d));var _0x7d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d3c('0x0'));var util=require('util');var moment=require(_0x7d3c('0x1'));var BPromise=require(_0x7d3c('0x2'));var rs=require(_0x7d3c('0x3'));var fs=require('fs');var Redis=require(_0x7d3c('0x4'));var db=require(_0x7d3c('0x5'))['db'];var utils=require(_0x7d3c('0x6'));var logger=require(_0x7d3c('0x7'))('rpc');var config=require(_0x7d3c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7d3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x378c5d,_0x20a797,_0x1b2935){return new BPromise(function(_0x2b8487,_0x323345){return client['request'](_0x378c5d,_0x1b2935)[_0x7d3c('0xa')](function(_0x5e2314){logger[_0x7d3c('0xb')](_0x7d3c('0xc'),_0x20a797,_0x7d3c('0xd'));logger[_0x7d3c('0xe')](_0x7d3c('0xf'),_0x20a797,'request\x20sent',JSON[_0x7d3c('0x10')](_0x5e2314));if(_0x5e2314[_0x7d3c('0x11')]){if(_0x5e2314['error']['code']===0x1f4){logger[_0x7d3c('0x11')](_0x7d3c('0xc'),_0x20a797,_0x5e2314[_0x7d3c('0x11')]['message']);return _0x323345(_0x5e2314['error'][_0x7d3c('0x12')]);}logger[_0x7d3c('0x11')](_0x7d3c('0xc'),_0x20a797,_0x5e2314[_0x7d3c('0x11')]['message']);return _0x2b8487(_0x5e2314[_0x7d3c('0x11')][_0x7d3c('0x12')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x20a797,'request\x20sent');_0x2b8487(_0x5e2314[_0x7d3c('0x13')][_0x7d3c('0x12')]);}})['catch'](function(_0x65857b){logger[_0x7d3c('0x11')](_0x7d3c('0xc'),_0x20a797,_0x65857b);_0x323345(_0x65857b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 8cadb8e..f667fe8 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 _0x87dd=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x5be53d,_0x113d4b){var _0x352e62=function(_0x4ed0c8){while(--_0x4ed0c8){_0x5be53d['push'](_0x5be53d['shift']());}};_0x352e62(++_0x113d4b);}(_0x87dd,0x139));var _0xd87d=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x87dd[_0x580647];return _0x5f0792;};'use strict';var multer=require(_0xd87d('0x0'));var util=require(_0xd87d('0x1'));var path=require(_0xd87d('0x2'));var timeout=require(_0xd87d('0x3'));var express=require(_0xd87d('0x4'));var router=express['Router']();var auth=require(_0xd87d('0x5'));var interaction=require(_0xd87d('0x6'));var config=require(_0xd87d('0x7'));module[_0xd87d('0x8')]=router; \ No newline at end of file +var _0x6c73=['../../components/auth/service','exports','util','path','connect-timeout','express','Router'];(function(_0x5744b5,_0x325462){var _0x3042d8=function(_0x1e64ad){while(--_0x1e64ad){_0x5744b5['push'](_0x5744b5['shift']());}};_0x3042d8(++_0x325462);}(_0x6c73,0x10c));var _0x36c7=function(_0x34af74,_0x59ab9d){_0x34af74=_0x34af74-0x0;var _0x12d74b=_0x6c73[_0x34af74];return _0x12d74b;};'use strict';var multer=require('multer');var util=require(_0x36c7('0x0'));var path=require(_0x36c7('0x1'));var timeout=require(_0x36c7('0x2'));var express=require(_0x36c7('0x3'));var router=express[_0x36c7('0x4')]();var auth=require(_0x36c7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x36c7('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 455de81..3814b6b 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x43a939,_0x4c1077){var _0x2348e8=function(_0xadabcd){while(--_0xadabcd){_0x43a939['push'](_0x43a939['shift']());}};_0x2348e8(++_0x4c1077);}(_0xe706,0xa3));var _0x6e70=function(_0x18e0bf,_0x2b3088){_0x18e0bf=_0x18e0bf-0x0;var _0x13c438=_0xe706[_0x18e0bf];return _0x13c438;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 5c7344b..020941f 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 _0xd740=['rimraf','../../config/environment','user_has_sms_queues','util','../../config/logger','moment','bluebird','path'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0xd740,0x10b));var _0x0d74=function(_0x1be790,_0x112549){_0x1be790=_0x1be790-0x0;var _0x7668c8=_0xd740[_0x1be790];return _0x7668c8;};'use strict';var _=require('lodash');var util=require(_0x0d74('0x0'));var logger=require(_0x0d74('0x1'))('api');var moment=require(_0x0d74('0x2'));var BPromise=require(_0x0d74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d74('0x4'));var rimraf=require(_0x0d74('0x5'));var config=require(_0x0d74('0x6'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x47fdc0,_0x4c5080){return _0x47fdc0['define']('UserSmsQueue',attributes,{'tableName':_0x0d74('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf378=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','user_has_sms_queues','lodash'];(function(_0x2cf1cc,_0x1b08ee){var _0x5cdb17=function(_0x4f58bf){while(--_0x4f58bf){_0x2cf1cc['push'](_0x2cf1cc['shift']());}};_0x5cdb17(++_0x1b08ee);}(_0xf378,0x1d5));var _0x8f37=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xf378[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x8f37('0x0'));var util=require(_0x8f37('0x1'));var logger=require(_0x8f37('0x2'))(_0x8f37('0x3'));var moment=require(_0x8f37('0x4'));var BPromise=require('bluebird');var rp=require(_0x8f37('0x5'));var fs=require('fs');var path=require(_0x8f37('0x6'));var rimraf=require(_0x8f37('0x7'));var config=require(_0x8f37('0x8'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x2562dd,_0x27078f){return _0x2562dd['define']('UserSmsQueue',attributes,{'tableName':_0x8f37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index f019783..43c8b63 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 _0x99f3=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s'];(function(_0x3b8f19,_0x38b5d5){var _0x439c84=function(_0x4fd293){while(--_0x4fd293){_0x3b8f19['push'](_0x3b8f19['shift']());}};_0x439c84(++_0x38b5d5);}(_0x99f3,0xd5));var _0x399f=function(_0x5d4db8,_0x4ad01b){_0x5d4db8=_0x5d4db8-0x0;var _0x415548=_0x99f3[_0x5d4db8];return _0x415548;};'use strict';var _=require(_0x399f('0x0'));var util=require(_0x399f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x399f('0x2'));var fs=require('fs');var Redis=require(_0x399f('0x3'));var db=require(_0x399f('0x4'))['db'];var utils=require(_0x399f('0x5'));var logger=require(_0x399f('0x6'))(_0x399f('0x7'));var config=require(_0x399f('0x8'));var jayson=require(_0x399f('0x9'));var client=jayson['client'][_0x399f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x243162,_0x546d78,_0x38ecf8){return new BPromise(function(_0x297596,_0x11603b){return client[_0x399f('0xb')](_0x243162,_0x38ecf8)['then'](function(_0x31fff7){logger[_0x399f('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x546d78,_0x399f('0xd'));logger['debug'](_0x399f('0xe'),_0x546d78,_0x399f('0xd'),JSON['stringify'](_0x31fff7));if(_0x31fff7[_0x399f('0xf')]){if(_0x31fff7[_0x399f('0xf')][_0x399f('0x10')]===0x1f4){logger[_0x399f('0xf')](_0x399f('0x11'),_0x546d78,_0x31fff7[_0x399f('0xf')][_0x399f('0x12')]);return _0x11603b(_0x31fff7[_0x399f('0xf')][_0x399f('0x12')]);}logger[_0x399f('0xf')](_0x399f('0x11'),_0x546d78,_0x31fff7['error'][_0x399f('0x12')]);return _0x297596(_0x31fff7['error'][_0x399f('0x12')]);}else{logger[_0x399f('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x546d78,_0x399f('0xd'));_0x297596(_0x31fff7[_0x399f('0x13')][_0x399f('0x12')]);}})[_0x399f('0x14')](function(_0x47d009){logger[_0x399f('0xf')](_0x399f('0x11'),_0x546d78,_0x47d009);_0x11603b(_0x47d009);});});} \ No newline at end of file +var _0x2f20=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','code','message','error','result','lodash','util','moment'];(function(_0x419d63,_0x445639){var _0x2139b6=function(_0x3ff2e4){while(--_0x3ff2e4){_0x419d63['push'](_0x419d63['shift']());}};_0x2139b6(++_0x445639);}(_0x2f20,0xb1));var _0x02f2=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x2f20[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x02f2('0x0'));var util=require(_0x02f2('0x1'));var moment=require(_0x02f2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02f2('0x3'));var db=require(_0x02f2('0x4'))['db'];var utils=require(_0x02f2('0x5'));var logger=require('../../config/logger')(_0x02f2('0x6'));var config=require(_0x02f2('0x7'));var jayson=require(_0x02f2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb5aa94,_0x3b5090,_0x3ed50a){return new BPromise(function(_0xfd98f5,_0x171cfd){return client[_0x02f2('0x9')](_0xb5aa94,_0x3ed50a)[_0x02f2('0xa')](function(_0x2e2393){logger[_0x02f2('0xb')](_0x02f2('0xc'),_0x3b5090,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x3b5090,_0x02f2('0xd'),JSON['stringify'](_0x2e2393));if(_0x2e2393['error']){if(_0x2e2393['error'][_0x02f2('0xe')]===0x1f4){logger['error'](_0x02f2('0xc'),_0x3b5090,_0x2e2393['error'][_0x02f2('0xf')]);return _0x171cfd(_0x2e2393[_0x02f2('0x10')]['message']);}logger[_0x02f2('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x3b5090,_0x2e2393[_0x02f2('0x10')]['message']);return _0xfd98f5(_0x2e2393[_0x02f2('0x10')][_0x02f2('0xf')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x3b5090,_0x02f2('0xd'));_0xfd98f5(_0x2e2393[_0x02f2('0x11')]['message']);}})['catch'](function(_0x15de12){logger[_0x02f2('0x10')](_0x02f2('0xc'),_0x3b5090,_0x15de12);_0x171cfd(_0x15de12);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 35fabed..2b4fab1 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 _0xb087=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb087,0x13c));var _0x7b08=function(_0x823832,_0x1f84d7){_0x823832=_0x823832-0x0;var _0x16ab05=_0xb087[_0x823832];return _0x16ab05;};'use strict';var multer=require(_0x7b08('0x0'));var util=require(_0x7b08('0x1'));var path=require(_0x7b08('0x2'));var timeout=require(_0x7b08('0x3'));var express=require(_0x7b08('0x4'));var router=express[_0x7b08('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7b08('0x6'));var config=require(_0x7b08('0x7'));module[_0x7b08('0x8')]=router; \ No newline at end of file +var _0x134d=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x134d,0x1c0));var _0xd134=function(_0x552537,_0x524201){_0x552537=_0x552537-0x0;var _0x1d16b8=_0x134d[_0x552537];return _0x1d16b8;};'use strict';var multer=require(_0xd134('0x0'));var util=require(_0xd134('0x1'));var path=require(_0xd134('0x2'));var timeout=require(_0xd134('0x3'));var express=require(_0xd134('0x4'));var router=express[_0xd134('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd134('0x6'));var config=require(_0xd134('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f669592..1eeb4c9 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(_0x5c1b69,_0x6868f6){var _0x191c50=function(_0x412a20){while(--_0x412a20){_0x5c1b69['push'](_0x5c1b69['shift']());}};_0x191c50(++_0x6868f6);}(_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(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'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 92aa8df..96bdda2 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 _0x0c02=['./userVoiceQueue.attributes','exports','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e45c8,_0x590d7b){var _0x338a71=function(_0x2da041){while(--_0x2da041){_0x2e45c8['push'](_0x2e45c8['shift']());}};_0x338a71(++_0x590d7b);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var logger=require(_0x20c0('0x1'))('api');var moment=require(_0x20c0('0x2'));var BPromise=require(_0x20c0('0x3'));var rp=require(_0x20c0('0x4'));var fs=require('fs');var path=require(_0x20c0('0x5'));var rimraf=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var attributes=require(_0x20c0('0x8'));module[_0x20c0('0x9')]=function(_0x13312d,_0xd25ee8){return _0x13312d['define']('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81bd=['../../config/environment','./userVoiceQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5b53e9,_0x31cfe5){var _0x4b22dd=function(_0x1f4e4c){while(--_0x1f4e4c){_0x5b53e9['push'](_0x5b53e9['shift']());}};_0x4b22dd(++_0x31cfe5);}(_0x81bd,0x7c));var _0xd81b=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x81bd[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','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 5d22dd2..c98935f 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 _0x2f79=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','bluebird','../../mysqldb'];(function(_0x5a5af7,_0x42c29f){var _0x3b9911=function(_0x39eeb3){while(--_0x39eeb3){_0x5a5af7['push'](_0x5a5af7['shift']());}};_0x3b9911(++_0x42c29f);}(_0x2f79,0x1ac));var _0x92f7=function(_0x15e304,_0x54bf7a){_0x15e304=_0x15e304-0x0;var _0x453e6f=_0x2f79[_0x15e304];return _0x453e6f;};'use strict';var _=require(_0x92f7('0x0'));var util=require(_0x92f7('0x1'));var moment=require('moment');var BPromise=require(_0x92f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92f7('0x3'))['db'];var utils=require(_0x92f7('0x4'));var logger=require(_0x92f7('0x5'))(_0x92f7('0x6'));var config=require(_0x92f7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5382f3,_0x39ce7d,_0x208559){return new BPromise(function(_0x4f8e1e,_0x5a0943){return client[_0x92f7('0x8')](_0x5382f3,_0x208559)[_0x92f7('0x9')](function(_0x12d478){logger[_0x92f7('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x39ce7d,'request\x20sent');logger[_0x92f7('0xb')](_0x92f7('0xc'),_0x39ce7d,_0x92f7('0xd'),JSON['stringify'](_0x12d478));if(_0x12d478[_0x92f7('0xe')]){if(_0x12d478['error']['code']===0x1f4){logger[_0x92f7('0xe')](_0x92f7('0xf'),_0x39ce7d,_0x12d478[_0x92f7('0xe')][_0x92f7('0x10')]);return _0x5a0943(_0x12d478[_0x92f7('0xe')][_0x92f7('0x10')]);}logger['error'](_0x92f7('0xf'),_0x39ce7d,_0x12d478[_0x92f7('0xe')][_0x92f7('0x10')]);return _0x4f8e1e(_0x12d478[_0x92f7('0xe')][_0x92f7('0x10')]);}else{logger[_0x92f7('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x39ce7d,'request\x20sent');_0x4f8e1e(_0x12d478[_0x92f7('0x11')][_0x92f7('0x10')]);}})['catch'](function(_0x30300d){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x39ce7d,_0x30300d);_0x5a0943(_0x30300d);});});} \ No newline at end of file +var _0x1755=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x1755,0xb9));var _0x5175=function(_0x1c0bcc,_0x4ba59b){_0x1c0bcc=_0x1c0bcc-0x0;var _0x514b15=_0x1755[_0x1c0bcc];return _0x514b15;};'use strict';var _=require(_0x5175('0x0'));var util=require(_0x5175('0x1'));var moment=require(_0x5175('0x2'));var BPromise=require(_0x5175('0x3'));var rs=require(_0x5175('0x4'));var fs=require('fs');var Redis=require(_0x5175('0x5'));var db=require(_0x5175('0x6'))['db'];var utils=require(_0x5175('0x7'));var logger=require(_0x5175('0x8'))('rpc');var config=require(_0x5175('0x9'));var jayson=require(_0x5175('0xa'));var client=jayson[_0x5175('0xb')][_0x5175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cb4e9,_0x57b0e5,_0x4e630e){return new BPromise(function(_0x949a4f,_0xccadee){return client['request'](_0x4cb4e9,_0x4e630e)[_0x5175('0xd')](function(_0x3dbeea){logger[_0x5175('0xe')](_0x5175('0xf'),_0x57b0e5,_0x5175('0x10'));logger[_0x5175('0x11')](_0x5175('0x12'),_0x57b0e5,_0x5175('0x10'),JSON['stringify'](_0x3dbeea));if(_0x3dbeea[_0x5175('0x13')]){if(_0x3dbeea['error'][_0x5175('0x14')]===0x1f4){logger[_0x5175('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x57b0e5,_0x3dbeea['error'][_0x5175('0x15')]);return _0xccadee(_0x3dbeea[_0x5175('0x13')][_0x5175('0x15')]);}logger[_0x5175('0x13')](_0x5175('0xf'),_0x57b0e5,_0x3dbeea[_0x5175('0x13')][_0x5175('0x15')]);return _0x949a4f(_0x3dbeea[_0x5175('0x13')][_0x5175('0x15')]);}else{logger[_0x5175('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x57b0e5,'request\x20sent');_0x949a4f(_0x3dbeea[_0x5175('0x16')][_0x5175('0x15')]);}})['catch'](function(_0x4d4a9b){logger[_0x5175('0x13')](_0x5175('0xf'),_0x57b0e5,_0x4d4a9b);_0xccadee(_0x4d4a9b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0378835..721823a 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 _0xdc7e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x248abf,_0x41fc15){var _0x39fdf2=function(_0x53583f){while(--_0x53583f){_0x248abf['push'](_0x248abf['shift']());}};_0x39fdf2(++_0x41fc15);}(_0xdc7e,0x1b5));var _0xedc7=function(_0x142e37,_0x4ff08c){_0x142e37=_0x142e37-0x0;var _0x59cbe4=_0xdc7e[_0x142e37];return _0x59cbe4;};'use strict';var multer=require(_0xedc7('0x0'));var util=require(_0xedc7('0x1'));var path=require(_0xedc7('0x2'));var timeout=require(_0xedc7('0x3'));var express=require(_0xedc7('0x4'));var router=express[_0xedc7('0x5')]();var auth=require(_0xedc7('0x6'));var interaction=require(_0xedc7('0x7'));var config=require(_0xedc7('0x8'));module['exports']=router; \ No newline at end of file +var _0x941b=['../../components/auth/service','../../components/interaction/service','exports','multer','util','Router'];(function(_0x4567a7,_0x5b747e){var _0x269628=function(_0x503ddb){while(--_0x503ddb){_0x4567a7['push'](_0x4567a7['shift']());}};_0x269628(++_0x5b747e);}(_0x941b,0xab));var _0xb941=function(_0x15b57d,_0x220389){_0x15b57d=_0x15b57d-0x0;var _0x15985b=_0x941b[_0x15b57d];return _0x15985b;};'use strict';var multer=require(_0xb941('0x0'));var util=require(_0xb941('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb941('0x2')]();var auth=require(_0xb941('0x3'));var interaction=require(_0xb941('0x4'));var config=require('../../config/environment');module[_0xb941('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 2bf5107..5a5bb44 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 _0x9fe4=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fe4,0x9c));var _0x49fe=function(_0x41cbdd,_0x93844e){_0x41cbdd=_0x41cbdd-0x0;var _0x262ee3=_0x9fe4[_0x41cbdd];return _0x262ee3;};'use strict';var Sequelize=require(_0x49fe('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x49fe('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x49fe('0x2')},'membername':{'type':Sequelize[_0x49fe('0x3')],'allowNull':![],'comment':_0x49fe('0x2')},'UserId':{'type':Sequelize[_0x49fe('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x49fe('0x3')],'allowNull':![],'unique':_0x49fe('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x49fe('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x49fe('0x3')],'allowNull':![],'unique':_0x49fe('0x4'),'comment':_0x49fe('0x2')},'penalty':{'type':Sequelize[_0x49fe('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x49fe('0x2')}}; \ No newline at end of file +var _0x4635=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x31df12,_0x388293){var _0x4288b0=function(_0x5306e8){while(--_0x5306e8){_0x31df12['push'](_0x31df12['shift']());}};_0x4288b0(++_0x388293);}(_0x4635,0x1b9));var _0x5463=function(_0x1fb897,_0x5af4a9){_0x1fb897=_0x1fb897-0x0;var _0x2d7b76=_0x4635[_0x1fb897];return _0x2d7b76;};'use strict';var Sequelize=require(_0x5463('0x0'));module[_0x5463('0x1')]={'uniqueid':{'type':Sequelize[_0x5463('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5463('0x3')},'membername':{'type':Sequelize[_0x5463('0x4')],'allowNull':![],'comment':_0x5463('0x3')},'UserId':{'type':Sequelize[_0x5463('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5463('0x5'),'comment':_0x5463('0x3')},'VoiceQueueId':{'type':Sequelize[_0x5463('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5463('0x4')],'allowNull':![],'unique':_0x5463('0x5'),'comment':_0x5463('0x3')},'penalty':{'type':Sequelize[_0x5463('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x5463('0x2')](0xb),'defaultValue':0x0,'comment':_0x5463('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f73c263..e2c8d30 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 _0xebbf=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hook'];(function(_0x41e2d2,_0x2a72b9){var _0x3945a3=function(_0x13b54d){while(--_0x13b54d){_0x41e2d2['push'](_0x41e2d2['shift']());}};_0x3945a3(++_0x2a72b9);}(_0xebbf,0x18d));var _0xfebb=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xebbf[_0x22c684];return _0x39fcbb;};'use strict';var EventEmitter=require(_0xfebb('0x0'));var UserVoiceQueueRt=require(_0xfebb('0x1'))['db'][_0xfebb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfebb('0x3')](0x0);var events={'afterCreate':_0xfebb('0x4'),'afterUpdate':_0xfebb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x24a38f){return function(_0x50a942,_0x2c56d4,_0x487364){UserVoiceQueueRtEvents[_0xfebb('0x6')](_0x24a38f+':'+_0x50a942['id'],_0x50a942);UserVoiceQueueRtEvents[_0xfebb('0x6')](_0x24a38f,_0x50a942);_0x487364(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xfebb('0x7')](e,emitEvent(event));}}module[_0xfebb('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xdccf=['remove','emit','hook','exports','UserVoiceQueueRt','save','update'];(function(_0x282a70,_0x38c07f){var _0x5139eb=function(_0x352a0e){while(--_0x352a0e){_0x282a70['push'](_0x282a70['shift']());}};_0x5139eb(++_0x38c07f);}(_0xdccf,0x6d));var _0xfdcc=function(_0x80b887,_0xce4ae6){_0x80b887=_0x80b887-0x0;var _0xa53029=_0xdccf[_0x80b887];return _0xa53029;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xfdcc('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfdcc('0x1'),'afterUpdate':_0xfdcc('0x2'),'afterDestroy':_0xfdcc('0x3')};function emitEvent(_0x749844){return function(_0x19b054,_0x487893,_0x2392d3){UserVoiceQueueRtEvents['emit'](_0x749844+':'+_0x19b054['id'],_0x19b054);UserVoiceQueueRtEvents[_0xfdcc('0x4')](_0x749844,_0x19b054);_0x2392d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xfdcc('0x5')](e,emitEvent(event));}}module[_0xfdcc('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 779b479..e6476ce 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 _0x1713=['bluebird','request-promise','path','rimraf','../../config/environment','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment'];(function(_0x73d857,_0x406e83){var _0x17be7e=function(_0x32e934){while(--_0x32e934){_0x73d857['push'](_0x73d857['shift']());}};_0x17be7e(++_0x406e83);}(_0x1713,0x13c));var _0x3171=function(_0x22d920,_0x14e105){_0x22d920=_0x22d920-0x0;var _0xb0ae1a=_0x1713[_0x22d920];return _0xb0ae1a;};'use strict';var _=require(_0x3171('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3171('0x1'));var moment=require(_0x3171('0x2'));var BPromise=require(_0x3171('0x3'));var rp=require(_0x3171('0x4'));var fs=require('fs');var path=require(_0x3171('0x5'));var rimraf=require(_0x3171('0x6'));var config=require(_0x3171('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x1a68cc,_0x9009e8){return _0x1a68cc[_0x3171('0x8')](_0x3171('0x9'),attributes,{'tableName':_0x3171('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1ce=['path','rimraf','../../config/environment','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','bluebird'];(function(_0x58d386,_0x4e234e){var _0x1afa87=function(_0x476ae6){while(--_0x476ae6){_0x58d386['push'](_0x58d386['shift']());}};_0x1afa87(++_0x4e234e);}(_0xb1ce,0xe2));var _0xeb1c=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0xb1ce[_0x154940];return _0x401409;};'use strict';var _=require('lodash');var util=require(_0xeb1c('0x0'));var logger=require(_0xeb1c('0x1'))(_0xeb1c('0x2'));var moment=require('moment');var BPromise=require(_0xeb1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb1c('0x4'));var rimraf=require(_0xeb1c('0x5'));var config=require(_0xeb1c('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x1ddf4a,_0x4d9739){return _0x1ddf4a[_0xeb1c('0x7')](_0xeb1c('0x8'),attributes,{'tableName':_0xeb1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 1ec5a4d..a4b930c 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 _0xfe18=['info','debug','request\x20sent','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./userVoiceQueueRt.socket','then'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0xfe18,0x1ac));var _0x8fe1=function(_0xc7144d,_0x5c332c){_0xc7144d=_0xc7144d-0x0;var _0x3a4323=_0xfe18[_0xc7144d];return _0x3a4323;};'use strict';var _=require(_0x8fe1('0x0'));var util=require(_0x8fe1('0x1'));var moment=require(_0x8fe1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fe1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fe1('0x4'));var logger=require(_0x8fe1('0x5'))(_0x8fe1('0x6'));var config=require(_0x8fe1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8fe1('0x8')][_0x8fe1('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8fe1('0xa')],{'host':_0x8fe1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8fe1('0xa')]));require(_0x8fe1('0xc'))['register'](socket);function respondWithRpcPromise(_0x3dc326,_0xfdbd7,_0x3bbcd3){return new BPromise(function(_0x1149f1,_0x7d07a4){return client['request'](_0x3dc326,_0x3bbcd3)[_0x8fe1('0xd')](function(_0x2bd3dd){logger[_0x8fe1('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xfdbd7,'request\x20sent');logger[_0x8fe1('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0xfdbd7,_0x8fe1('0x10'),JSON['stringify'](_0x2bd3dd));if(_0x2bd3dd[_0x8fe1('0x11')]){if(_0x2bd3dd[_0x8fe1('0x11')][_0x8fe1('0x12')]===0x1f4){logger[_0x8fe1('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xfdbd7,_0x2bd3dd[_0x8fe1('0x11')]['message']);return _0x7d07a4(_0x2bd3dd[_0x8fe1('0x11')]['message']);}logger[_0x8fe1('0x11')](_0x8fe1('0x13'),_0xfdbd7,_0x2bd3dd[_0x8fe1('0x11')]['message']);return _0x1149f1(_0x2bd3dd[_0x8fe1('0x11')][_0x8fe1('0x14')]);}else{logger[_0x8fe1('0xe')](_0x8fe1('0x13'),_0xfdbd7,'request\x20sent');_0x1149f1(_0x2bd3dd[_0x8fe1('0x15')][_0x8fe1('0x14')]);}})['catch'](function(_0x4f2527){logger[_0x8fe1('0x11')](_0x8fe1('0x13'),_0xfdbd7,_0x4f2527);_0x7d07a4(_0x4f2527);});});}exports[_0x8fe1('0x16')]=function(_0x59fce0){var _0x52d44c=this;return new Promise(function(_0x49cbd5,_0x35b243){return db[_0x8fe1('0x17')][_0x8fe1('0x18')]({'raw':_0x59fce0['options']?_0x59fce0['options'][_0x8fe1('0x19')]===undefined?!![]:![]:!![],'where':_0x59fce0[_0x8fe1('0x1a')]?_0x59fce0['options'][_0x8fe1('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8fe1('0x1c'),db[_0x8fe1('0x1d')]['fn']('IF',db[_0x8fe1('0x1d')]['literal'](_0x8fe1('0x1e')))),_0x8fe1('0x1f')]]})[_0x8fe1('0xd')](function(_0x59237e){logger[_0x8fe1('0xe')](_0x8fe1('0x16'),_0x59fce0);logger['debug']('GetVoiceQueueRtPauses',_0x59fce0,JSON[_0x8fe1('0x20')](_0x59237e));_0x49cbd5(_0x59237e);})[_0x8fe1('0x21')](function(_0x14e00e){logger[_0x8fe1('0x11')](_0x8fe1('0x16'),_0x14e00e[_0x8fe1('0x14')],_0x59fce0);_0x35b243(_0x52d44c[_0x8fe1('0x11')](0x1f4,_0x14e00e[_0x8fe1('0x14')]));});});}; \ No newline at end of file +var _0xda9c=['sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw'];(function(_0x4b0c37,_0x4cc3a8){var _0x58e950=function(_0x2588ce){while(--_0x2588ce){_0x4b0c37['push'](_0x4b0c37['shift']());}};_0x58e950(++_0x4cc3a8);}(_0xda9c,0x177));var _0xcda9=function(_0x872ce5,_0x44f4e9){_0x872ce5=_0x872ce5-0x0;var _0x5bc62c=_0xda9c[_0x872ce5];return _0x5bc62c;};'use strict';var _=require(_0xcda9('0x0'));var util=require('util');var moment=require(_0xcda9('0x1'));var BPromise=require(_0xcda9('0x2'));var rs=require(_0xcda9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcda9('0x4'))['db'];var utils=require(_0xcda9('0x5'));var logger=require('../../config/logger')(_0xcda9('0x6'));var config=require(_0xcda9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcda9('0x8')][_0xcda9('0x9')]({'port':0x232a});config['redis']=_[_0xcda9('0xa')](config[_0xcda9('0xb')],{'host':_0xcda9('0xc'),'port':0x18eb});var socket=require(_0xcda9('0xd'))(new Redis(config[_0xcda9('0xb')]));require(_0xcda9('0xe'))[_0xcda9('0xf')](socket);function respondWithRpcPromise(_0x4a1550,_0x29c8cf,_0x3f106a){return new BPromise(function(_0x59d4bd,_0xd4c939){return client[_0xcda9('0x10')](_0x4a1550,_0x3f106a)[_0xcda9('0x11')](function(_0xc8272){logger[_0xcda9('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x29c8cf,_0xcda9('0x13'));logger[_0xcda9('0x14')](_0xcda9('0x15'),_0x29c8cf,_0xcda9('0x13'),JSON['stringify'](_0xc8272));if(_0xc8272[_0xcda9('0x16')]){if(_0xc8272[_0xcda9('0x16')][_0xcda9('0x17')]===0x1f4){logger['error'](_0xcda9('0x18'),_0x29c8cf,_0xc8272[_0xcda9('0x16')][_0xcda9('0x19')]);return _0xd4c939(_0xc8272[_0xcda9('0x16')][_0xcda9('0x19')]);}logger[_0xcda9('0x16')](_0xcda9('0x18'),_0x29c8cf,_0xc8272[_0xcda9('0x16')]['message']);return _0x59d4bd(_0xc8272['error'][_0xcda9('0x19')]);}else{logger['info'](_0xcda9('0x18'),_0x29c8cf,'request\x20sent');_0x59d4bd(_0xc8272['result'][_0xcda9('0x19')]);}})[_0xcda9('0x1a')](function(_0x17247a){logger[_0xcda9('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x29c8cf,_0x17247a);_0xd4c939(_0x17247a);});});}exports[_0xcda9('0x1b')]=function(_0x9d916){var _0xe3ba1c=this;return new Promise(function(_0x6c80d4,_0x1be609){return db[_0xcda9('0x1c')][_0xcda9('0x1d')]({'raw':_0x9d916[_0xcda9('0x1e')]?_0x9d916['options'][_0xcda9('0x1f')]===undefined?!![]:![]:!![],'where':_0x9d916[_0xcda9('0x1e')]?_0x9d916['options']['where']||null:null,'attributes':[[db[_0xcda9('0x20')]['fn'](_0xcda9('0x21'),db[_0xcda9('0x20')]['fn']('IF',db[_0xcda9('0x20')]['literal'](_0xcda9('0x22')))),_0xcda9('0x23')]]})[_0xcda9('0x11')](function(_0x2a52ee){logger['info'](_0xcda9('0x1b'),_0x9d916);logger[_0xcda9('0x14')](_0xcda9('0x1b'),_0x9d916,JSON[_0xcda9('0x24')](_0x2a52ee));_0x6c80d4(_0x2a52ee);})[_0xcda9('0x1a')](function(_0x423d3c){logger[_0xcda9('0x16')]('GetVoiceQueueRtPauses',_0x423d3c[_0xcda9('0x19')],_0x9d916);_0x1be609(_0xe3ba1c['error'](0x1f4,_0x423d3c[_0xcda9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 00a4143..091ab52 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 _0xbf48=['remove','update','emit','removeListener','userVoiceQueueRt:','save'];(function(_0x19bbd4,_0x54d52e){var _0x54085=function(_0x231512){while(--_0x231512){_0x19bbd4['push'](_0x19bbd4['shift']());}};_0x54085(++_0x54d52e);}(_0xbf48,0x9b));var _0x8bf4=function(_0x475ff5,_0x564346){_0x475ff5=_0x475ff5-0x0;var _0x212cad=_0xbf48[_0x475ff5];return _0x212cad;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x8bf4('0x0'),_0x8bf4('0x1'),_0x8bf4('0x2')];function createListener(_0x570ea,_0x4b8992){return function(_0x5ae76a){_0x4b8992[_0x8bf4('0x3')](_0x570ea,_0x5ae76a);};}function removeListener(_0x25bea5,_0x241ba){return function(){UserVoiceQueueRtEvents[_0x8bf4('0x4')](_0x25bea5,_0x241ba);};}exports['register']=function(_0x2043e5){for(var _0x4c78b6=0x0,_0x494ce8=events['length'];_0x4c78b6<_0x494ce8;_0x4c78b6++){var _0x47277b=events[_0x4c78b6];var _0x58f8b=createListener(_0x8bf4('0x5')+_0x47277b,_0x2043e5);UserVoiceQueueRtEvents['on'](_0x47277b,_0x58f8b);}}; \ No newline at end of file +var _0xd240=['emit','userVoiceQueueRt:','remove','update'];(function(_0x1b1c33,_0x429996){var _0x25bb4f=function(_0x35c7de){while(--_0x35c7de){_0x1b1c33['push'](_0x1b1c33['shift']());}};_0x25bb4f(++_0x429996);}(_0xd240,0x9e));var _0x0d24=function(_0x15ba30,_0x19b4fd){_0x15ba30=_0x15ba30-0x0;var _0x5901b3=_0xd240[_0x15ba30];return _0x5901b3;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x0d24('0x0'),_0x0d24('0x1')];function createListener(_0x26dc93,_0x5af8e4){return function(_0xc180e6){_0x5af8e4[_0x0d24('0x2')](_0x26dc93,_0xc180e6);};}function removeListener(_0x124e3a,_0x5e8e80){return function(){UserVoiceQueueRtEvents['removeListener'](_0x124e3a,_0x5e8e80);};}exports['register']=function(_0x671ffb){for(var _0x419506=0x0,_0x30ae91=events['length'];_0x419506<_0x30ae91;_0x419506++){var _0x1a05cc=events[_0x419506];var _0x46209a=createListener(_0x0d24('0x3')+_0x1a05cc,_0x671ffb);UserVoiceQueueRtEvents['on'](_0x1a05cc,_0x46209a);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index dcd5b95..dcd974d 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 _0xa1a8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0xc036bb,_0x5cab81){var _0x523ab9=function(_0x2eed72){while(--_0x2eed72){_0xc036bb['push'](_0xc036bb['shift']());}};_0x523ab9(++_0x5cab81);}(_0xa1a8,0x13c));var _0x8a1a=function(_0x3e0e31,_0x3a5be7){_0x3e0e31=_0x3e0e31-0x0;var _0x558622=_0xa1a8[_0x3e0e31];return _0x558622;};'use strict';var multer=require(_0x8a1a('0x0'));var util=require(_0x8a1a('0x1'));var path=require(_0x8a1a('0x2'));var timeout=require(_0x8a1a('0x3'));var express=require(_0x8a1a('0x4'));var router=express[_0x8a1a('0x5')]();var auth=require(_0x8a1a('0x6'));var interaction=require(_0x8a1a('0x7'));var config=require(_0x8a1a('0x8'));var controller=require(_0x8a1a('0x9'));router[_0x8a1a('0xa')]('/',auth[_0x8a1a('0xb')](),controller[_0x8a1a('0xc')]);router['get'](_0x8a1a('0xd'),auth[_0x8a1a('0xb')](),controller[_0x8a1a('0xe')]);router[_0x8a1a('0xf')]('/',auth[_0x8a1a('0xb')](),controller[_0x8a1a('0x10')]);router[_0x8a1a('0x11')](_0x8a1a('0xd'),auth[_0x8a1a('0xb')](),controller['update']);router['delete'](_0x8a1a('0xd'),auth[_0x8a1a('0xb')](),controller[_0x8a1a('0x12')]);module[_0x8a1a('0x13')]=router; \ No newline at end of file +var _0xd9b0=['put','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','show','post','create'];(function(_0x3ce7da,_0x57b0bf){var _0x3455af=function(_0x4703e6){while(--_0x4703e6){_0x3ce7da['push'](_0x3ce7da['shift']());}};_0x3455af(++_0x57b0bf);}(_0xd9b0,0x179));var _0x0d9b=function(_0x495869,_0xee1079){_0x495869=_0x495869-0x0;var _0x3eb5f9=_0xd9b0[_0x495869];return _0x3eb5f9;};'use strict';var multer=require(_0x0d9b('0x0'));var util=require(_0x0d9b('0x1'));var path=require(_0x0d9b('0x2'));var timeout=require(_0x0d9b('0x3'));var express=require('express');var router=express[_0x0d9b('0x4')]();var auth=require(_0x0d9b('0x5'));var interaction=require(_0x0d9b('0x6'));var config=require(_0x0d9b('0x7'));var controller=require(_0x0d9b('0x8'));router['get']('/',auth[_0x0d9b('0x9')](),controller[_0x0d9b('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0d9b('0xb')]);router[_0x0d9b('0xc')]('/',auth[_0x0d9b('0x9')](),controller[_0x0d9b('0xd')]);router[_0x0d9b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0d9b('0xf')]);router[_0x0d9b('0x10')]('/:id',auth[_0x0d9b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index b16c724..f999515 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 _0x900a=['sequelize','STRING','name'];(function(_0x277c20,_0x5ee8f5){var _0x4a3de2=function(_0x5055c4){while(--_0x5055c4){_0x277c20['push'](_0x277c20['shift']());}};_0x4a3de2(++_0x5ee8f5);}(_0x900a,0xdb));var _0xa900=function(_0x460ee6,_0x3c8bcb){_0x460ee6=_0x460ee6-0x0;var _0x322258=_0x900a[_0x460ee6];return _0x322258;};'use strict';var Sequelize=require(_0xa900('0x0'));module['exports']={'name':{'type':Sequelize[_0xa900('0x1')],'unique':_0xa900('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa900('0x1')]}}; \ No newline at end of file +var _0xb279=['sequelize','exports','name'];(function(_0xab5f15,_0x5c1860){var _0x56290a=function(_0x226869){while(--_0x226869){_0xab5f15['push'](_0xab5f15['shift']());}};_0x56290a(++_0x5c1860);}(_0xb279,0x90));var _0x9b27=function(_0x3293f9,_0x14f201){_0x3293f9=_0x3293f9-0x0;var _0x55a0a9=_0xb279[_0x3293f9];return _0x55a0a9;};'use strict';var Sequelize=require(_0x9b27('0x0'));module[_0x9b27('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9b27('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 38b5948..06f46ac 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 _0x00fa=['../../config/logger','api','../../config/utils','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','index','model','keys','query','filters','intersection','attributes','fields','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','Variable','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x00fa,0x8b));var _0xa00f=function(_0xed1f2d,_0x1a2d6c){_0xed1f2d=_0xed1f2d-0x0;var _0x1fa702=_0x00fa[_0xed1f2d];return _0x1fa702;};'use strict';var pdf=require(_0xa00f('0x0'));var emlformat=require(_0xa00f('0x1'));var rimraf=require(_0xa00f('0x2'));var zipdir=require(_0xa00f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa00f('0x4'));var moment=require(_0xa00f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa00f('0x6'));var util=require(_0xa00f('0x7'));var path=require(_0xa00f('0x8'));var sox=require(_0xa00f('0x9'));var csv=require(_0xa00f('0xa'));var ejs=require(_0xa00f('0xb'));var fs=require('fs');var _=require(_0xa00f('0xc'));var squel=require(_0xa00f('0xd'));var crypto=require(_0xa00f('0xe'));var jsforce=require(_0xa00f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa00f('0xa'));var querystring=require('querystring');var Papa=require(_0xa00f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa00f('0x11'));var hardwareService=require(_0xa00f('0x12'));var logger=require(_0xa00f('0x13'))(_0xa00f('0x14'));var utils=require(_0xa00f('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21bbc9,_0x3648e2){_0x3648e2=_0x3648e2||0xcc;return function(_0x46c4ca){if(_0x46c4ca){return _0x21bbc9['sendStatus'](_0x3648e2);}return _0x21bbc9[_0xa00f('0x16')](_0x3648e2)[_0xa00f('0x17')]();};}function respondWithResult(_0x130d3a,_0x2a1d79){_0x2a1d79=_0x2a1d79||0xc8;return function(_0x34c5f6){if(_0x34c5f6){return _0x130d3a[_0xa00f('0x16')](_0x2a1d79)[_0xa00f('0x18')](_0x34c5f6);}};}function respondWithFilteredResult(_0x34b6ce,_0x5010aa){return function(_0x288c0c){if(_0x288c0c){var _0x391614=_0x288c0c['count'],_0x32fdbd=_0x5010aa[_0xa00f('0x19')],_0x35a45c=_0x5010aa['offset']+_0x5010aa[_0xa00f('0x1a')],_0x287223;if(_0x35a45c>=_0x391614){_0x35a45c=_0x391614;_0x287223=0xc8;}else{_0x287223=0xce;}_0x34b6ce[_0xa00f('0x16')](_0x287223);return _0x34b6ce['set'](_0xa00f('0x1b'),_0x32fdbd+'-'+_0x35a45c+'/'+_0x391614)['json'](_0x288c0c);}return null;};}function patchUpdates(_0x35accd){return function(_0x254bc1){try{jsonpatch[_0xa00f('0x1c')](_0x254bc1,_0x35accd,!![]);}catch(_0x5a012d){return BPromise[_0xa00f('0x1d')](_0x5a012d);}return _0x254bc1[_0xa00f('0x1e')]();};}function saveUpdates(_0x228e8,_0xcb1fe9){return function(_0x1cb770){if(_0x1cb770){return _0x1cb770[_0xa00f('0x1f')](_0x228e8)[_0xa00f('0x20')](function(_0x40e28d){return _0x40e28d;});}return null;};}function removeEntity(_0x41a0a2,_0x2dc376){return function(_0x597217){if(_0x597217){return _0x597217[_0xa00f('0x21')]()[_0xa00f('0x20')](function(){var _0x415feb=_0x597217[_0xa00f('0x22')]({'plain':!![]});var _0x5eff20=_0xa00f('0x23');return db[_0xa00f('0x24')]['destroy']({'where':{'type':_0x5eff20,'resourceId':_0x415feb['id']}})[_0xa00f('0x20')](function(){return _0x597217;});})[_0xa00f('0x20')](function(){_0x41a0a2[_0xa00f('0x16')](0xcc)[_0xa00f('0x17')]();});}};}function handleEntityNotFound(_0x45b89c,_0x3bfd10){return function(_0x37e92f){if(!_0x37e92f){_0x45b89c[_0xa00f('0x25')](0x194);}return _0x37e92f;};}function handleError(_0x23cecc,_0x28b41d){_0x28b41d=_0x28b41d||0x1f4;return function(_0x4deddc){logger[_0xa00f('0x26')](_0x4deddc[_0xa00f('0x27')]);if(_0x4deddc[_0xa00f('0x28')]){delete _0x4deddc[_0xa00f('0x28')];}_0x23cecc['status'](_0x28b41d)['send'](_0x4deddc);};}exports[_0xa00f('0x29')]=function(_0x9b986e,_0x17555c){var _0x4e0fb7={},_0x518780={},_0x264792={'count':0x0,'rows':[]};var _0x24e155=db['Variable']['rawAttributes'];_0x518780[_0xa00f('0x2a')]=_[_0xa00f('0x2b')](_0x24e155);_0x518780[_0xa00f('0x2c')]=_[_0xa00f('0x2b')](_0x9b986e[_0xa00f('0x2c')]);_0x518780[_0xa00f('0x2d')]=_[_0xa00f('0x2e')](_0x518780[_0xa00f('0x2a')],_0x518780[_0xa00f('0x2c')]);_0x4e0fb7[_0xa00f('0x2f')]=_[_0xa00f('0x2e')](_0x518780[_0xa00f('0x2a')],qs['fields'](_0x9b986e[_0xa00f('0x2c')][_0xa00f('0x30')]));_0x4e0fb7['attributes']=_0x4e0fb7[_0xa00f('0x2f')]['length']?_0x4e0fb7['attributes']:_0x518780[_0xa00f('0x2a')];if(!_0x9b986e[_0xa00f('0x2c')]['hasOwnProperty']('nolimit')){_0x4e0fb7[_0xa00f('0x1a')]=qs[_0xa00f('0x1a')](_0x9b986e[_0xa00f('0x2c')][_0xa00f('0x1a')]);_0x4e0fb7[_0xa00f('0x19')]=qs[_0xa00f('0x19')](_0x9b986e[_0xa00f('0x2c')]['offset']);}_0x4e0fb7['order']=qs['sort'](_0x9b986e[_0xa00f('0x2c')][_0xa00f('0x31')]);_0x4e0fb7[_0xa00f('0x32')]=qs[_0xa00f('0x2d')](_[_0xa00f('0x33')](_0x9b986e['query'],_0x518780[_0xa00f('0x2d')]));if(_0x9b986e[_0xa00f('0x2c')][_0xa00f('0x34')]){_0x4e0fb7['where']=_[_0xa00f('0x35')](_0x4e0fb7[_0xa00f('0x32')],{'$or':_[_0xa00f('0x36')](_0x24e155,function(_0x1a7c9c){if(_0x1a7c9c[_0xa00f('0x37')]['key']!==_0xa00f('0x38')){var _0x356462={};_0x356462[_0x1a7c9c[_0xa00f('0x39')]]={'$like':'%'+_0x9b986e[_0xa00f('0x2c')][_0xa00f('0x34')]+'%'};return _0x356462;}})});}_0x4e0fb7=_[_0xa00f('0x35')]({},_0x4e0fb7,_0x9b986e[_0xa00f('0x3a')]);var _0xe62fdf={'where':_0x4e0fb7[_0xa00f('0x32')]};return db[_0xa00f('0x3b')][_0xa00f('0x3c')](_0xe62fdf)[_0xa00f('0x20')](function(_0xacff11){_0x264792[_0xa00f('0x3c')]=_0xacff11;if(_0x9b986e['query'][_0xa00f('0x3d')]){_0x4e0fb7[_0xa00f('0x3e')]=[{'all':!![]}];}return db[_0xa00f('0x3b')][_0xa00f('0x3f')](_0x4e0fb7);})['then'](function(_0x375c7f){_0x264792[_0xa00f('0x40')]=_0x375c7f;return _0x264792;})[_0xa00f('0x20')](respondWithFilteredResult(_0x17555c,_0x4e0fb7))[_0xa00f('0x41')](handleError(_0x17555c,null));};exports[_0xa00f('0x42')]=function(_0x57235a,_0x53fc65){var _0x29ad21={'raw':!![],'where':{'id':_0x57235a[_0xa00f('0x43')]['id']}},_0x1b8774={};_0x1b8774[_0xa00f('0x2a')]=_['keys'](db[_0xa00f('0x3b')][_0xa00f('0x44')]);_0x1b8774['query']=_['keys'](_0x57235a[_0xa00f('0x2c')]);_0x1b8774['filters']=_['intersection'](_0x1b8774[_0xa00f('0x2a')],_0x1b8774[_0xa00f('0x2c')]);_0x29ad21['attributes']=_[_0xa00f('0x2e')](_0x1b8774[_0xa00f('0x2a')],qs[_0xa00f('0x30')](_0x57235a[_0xa00f('0x2c')][_0xa00f('0x30')]));_0x29ad21[_0xa00f('0x2f')]=_0x29ad21[_0xa00f('0x2f')][_0xa00f('0x45')]?_0x29ad21['attributes']:_0x1b8774['model'];if(_0x57235a[_0xa00f('0x2c')][_0xa00f('0x3d')]){_0x29ad21['include']=[{'all':!![]}];}_0x29ad21=_[_0xa00f('0x35')]({},_0x29ad21,_0x57235a[_0xa00f('0x3a')]);return db[_0xa00f('0x3b')][_0xa00f('0x46')](_0x29ad21)[_0xa00f('0x20')](handleEntityNotFound(_0x53fc65,null))['then'](respondWithResult(_0x53fc65,null))[_0xa00f('0x41')](handleError(_0x53fc65,null));};exports[_0xa00f('0x47')]=function(_0x648b83,_0xc01f27){return db[_0xa00f('0x3b')][_0xa00f('0x47')](_0x648b83[_0xa00f('0x48')],{})[_0xa00f('0x20')](function(_0x4bdbb9){var _0x2d37e7=_0x648b83[_0xa00f('0x49')]['get']({'plain':!![]});if(!_0x2d37e7)throw new Error(_0xa00f('0x4a'));if(_0x2d37e7[_0xa00f('0x4b')]===_0xa00f('0x49')){var _0x434b72=_0x4bdbb9[_0xa00f('0x22')]({'plain':!![]});var _0x1a288d=_0xa00f('0x23');return db[_0xa00f('0x4c')][_0xa00f('0x46')]({'where':{'name':_0x1a288d,'userProfileId':_0x2d37e7[_0xa00f('0x4d')]},'raw':!![]})[_0xa00f('0x20')](function(_0x527a3e){if(_0x527a3e&&_0x527a3e['autoAssociation']===0x0){return db[_0xa00f('0x24')][_0xa00f('0x47')]({'name':_0x434b72['name'],'resourceId':_0x434b72['id'],'type':_0x527a3e[_0xa00f('0x28')],'sectionId':_0x527a3e['id']},{})[_0xa00f('0x20')](function(){return _0x4bdbb9;});}else{return _0x4bdbb9;}})[_0xa00f('0x41')](function(_0x118ed3){logger['error'](_0xa00f('0x4e'),_0x118ed3);throw _0x118ed3;});}return _0x4bdbb9;})[_0xa00f('0x20')](respondWithResult(_0xc01f27,0xc9))[_0xa00f('0x41')](handleError(_0xc01f27,null));};exports[_0xa00f('0x1f')]=function(_0x3e6cd8,_0x496140){if(_0x3e6cd8[_0xa00f('0x48')]['id']){delete _0x3e6cd8['body']['id'];}return db[_0xa00f('0x3b')]['find']({'where':{'id':_0x3e6cd8[_0xa00f('0x43')]['id']}})[_0xa00f('0x20')](handleEntityNotFound(_0x496140,null))[_0xa00f('0x20')](saveUpdates(_0x3e6cd8[_0xa00f('0x48')],null))[_0xa00f('0x20')](respondWithResult(_0x496140,null))[_0xa00f('0x41')](handleError(_0x496140,null));};exports[_0xa00f('0x21')]=function(_0x369eb4,_0x4c5dd4){return db[_0xa00f('0x3b')]['find']({'where':{'id':_0x369eb4['params']['id']}})[_0xa00f('0x20')](handleEntityNotFound(_0x4c5dd4,null))[_0xa00f('0x20')](removeEntity(_0x4c5dd4,null))[_0xa00f('0x41')](handleError(_0x4c5dd4,null));}; \ No newline at end of file +var _0x0889=['length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','field','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','bluebird','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','Variable','rawAttributes','model','keys','query','filters','intersection','attributes'];(function(_0x177633,_0x50dc1d){var _0x30ea9f=function(_0x846015){while(--_0x846015){_0x177633['push'](_0x177633['shift']());}};_0x30ea9f(++_0x50dc1d);}(_0x0889,0x6a));var _0x9088=function(_0x5b9950,_0x4c27ac){_0x5b9950=_0x5b9950-0x0;var _0x1d7bfb=_0x0889[_0x5b9950];return _0x1d7bfb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9088('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9088('0x1'));var rp=require(_0x9088('0x2'));var moment=require('moment');var BPromise=require(_0x9088('0x3'));var Mustache=require('mustache');var util=require(_0x9088('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x9088('0x5'));var ejs=require(_0x9088('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9088('0x7'));var crypto=require(_0x9088('0x8'));var jsforce=require(_0x9088('0x9'));var deskjs=require(_0x9088('0xa'));var toCsv=require(_0x9088('0x5'));var querystring=require(_0x9088('0xb'));var Papa=require(_0x9088('0xc'));var Redis=require(_0x9088('0xd'));var authService=require(_0x9088('0xe'));var qs=require(_0x9088('0xf'));var hardwareService=require(_0x9088('0x10'));var logger=require(_0x9088('0x11'))('api');var utils=require(_0x9088('0x12'));var config=require(_0x9088('0x13'));var db=require(_0x9088('0x14'))['db'];function respondWithStatusCode(_0x226a4a,_0x2371f7){_0x2371f7=_0x2371f7||0xcc;return function(_0x476bdb){if(_0x476bdb){return _0x226a4a[_0x9088('0x15')](_0x2371f7);}return _0x226a4a[_0x9088('0x16')](_0x2371f7)[_0x9088('0x17')]();};}function respondWithResult(_0x1859d1,_0x20c9c5){_0x20c9c5=_0x20c9c5||0xc8;return function(_0x5f348d){if(_0x5f348d){return _0x1859d1[_0x9088('0x16')](_0x20c9c5)[_0x9088('0x18')](_0x5f348d);}};}function respondWithFilteredResult(_0x3c21d1,_0x4d10f0){return function(_0x1c1f03){if(_0x1c1f03){var _0x1e4a60=_0x1c1f03[_0x9088('0x19')],_0x3108fe=_0x4d10f0[_0x9088('0x1a')],_0x49f81e=_0x4d10f0[_0x9088('0x1a')]+_0x4d10f0[_0x9088('0x1b')],_0x22fea1;if(_0x49f81e>=_0x1e4a60){_0x49f81e=_0x1e4a60;_0x22fea1=0xc8;}else{_0x22fea1=0xce;}_0x3c21d1['status'](_0x22fea1);return _0x3c21d1[_0x9088('0x1c')](_0x9088('0x1d'),_0x3108fe+'-'+_0x49f81e+'/'+_0x1e4a60)[_0x9088('0x18')](_0x1c1f03);}return null;};}function patchUpdates(_0x406eea){return function(_0x4b858a){try{jsonpatch[_0x9088('0x1e')](_0x4b858a,_0x406eea,!![]);}catch(_0x5e944e){return BPromise[_0x9088('0x1f')](_0x5e944e);}return _0x4b858a[_0x9088('0x20')]();};}function saveUpdates(_0x38c171,_0x43ba40){return function(_0x3022cb){if(_0x3022cb){return _0x3022cb[_0x9088('0x21')](_0x38c171)[_0x9088('0x22')](function(_0x24b7ce){return _0x24b7ce;});}return null;};}function removeEntity(_0x3e4e7e,_0xfc146c){return function(_0x4aca0e){if(_0x4aca0e){return _0x4aca0e[_0x9088('0x23')]()[_0x9088('0x22')](function(){var _0x5b3cd3=_0x4aca0e[_0x9088('0x24')]({'plain':!![]});var _0x34131d=_0x9088('0x25');return db[_0x9088('0x26')][_0x9088('0x23')]({'where':{'type':_0x34131d,'resourceId':_0x5b3cd3['id']}})[_0x9088('0x22')](function(){return _0x4aca0e;});})['then'](function(){_0x3e4e7e[_0x9088('0x16')](0xcc)[_0x9088('0x17')]();});}};}function handleEntityNotFound(_0x1df119,_0x175e6d){return function(_0x17f229){if(!_0x17f229){_0x1df119[_0x9088('0x15')](0x194);}return _0x17f229;};}function handleError(_0x1b57b1,_0x29cc43){_0x29cc43=_0x29cc43||0x1f4;return function(_0x1a9631){logger[_0x9088('0x27')](_0x1a9631[_0x9088('0x28')]);if(_0x1a9631['name']){delete _0x1a9631[_0x9088('0x29')];}_0x1b57b1[_0x9088('0x16')](_0x29cc43)['send'](_0x1a9631);};}exports['index']=function(_0x48e5ed,_0x25d85f){var _0x3cb9e4={},_0x55dd88={},_0x433b8a={'count':0x0,'rows':[]};var _0x311ce5=db[_0x9088('0x2a')][_0x9088('0x2b')];_0x55dd88[_0x9088('0x2c')]=_[_0x9088('0x2d')](_0x311ce5);_0x55dd88[_0x9088('0x2e')]=_[_0x9088('0x2d')](_0x48e5ed[_0x9088('0x2e')]);_0x55dd88[_0x9088('0x2f')]=_[_0x9088('0x30')](_0x55dd88[_0x9088('0x2c')],_0x55dd88[_0x9088('0x2e')]);_0x3cb9e4['attributes']=_[_0x9088('0x30')](_0x55dd88[_0x9088('0x2c')],qs['fields'](_0x48e5ed[_0x9088('0x2e')]['fields']));_0x3cb9e4[_0x9088('0x31')]=_0x3cb9e4[_0x9088('0x31')][_0x9088('0x32')]?_0x3cb9e4['attributes']:_0x55dd88[_0x9088('0x2c')];if(!_0x48e5ed[_0x9088('0x2e')][_0x9088('0x33')]('nolimit')){_0x3cb9e4[_0x9088('0x1b')]=qs[_0x9088('0x1b')](_0x48e5ed[_0x9088('0x2e')][_0x9088('0x1b')]);_0x3cb9e4[_0x9088('0x1a')]=qs[_0x9088('0x1a')](_0x48e5ed['query'][_0x9088('0x1a')]);}_0x3cb9e4[_0x9088('0x34')]=qs['sort'](_0x48e5ed[_0x9088('0x2e')][_0x9088('0x35')]);_0x3cb9e4[_0x9088('0x36')]=qs[_0x9088('0x2f')](_[_0x9088('0x37')](_0x48e5ed[_0x9088('0x2e')],_0x55dd88['filters']));if(_0x48e5ed[_0x9088('0x2e')]['filter']){_0x3cb9e4['where']=_[_0x9088('0x38')](_0x3cb9e4['where'],{'$or':_[_0x9088('0x39')](_0x311ce5,function(_0x123192){if(_0x123192['type']['key']!==_0x9088('0x3a')){var _0x526281={};_0x526281[_0x123192[_0x9088('0x3b')]]={'$like':'%'+_0x48e5ed[_0x9088('0x2e')]['filter']+'%'};return _0x526281;}})});}_0x3cb9e4=_[_0x9088('0x38')]({},_0x3cb9e4,_0x48e5ed['options']);var _0x31a7e1={'where':_0x3cb9e4['where']};return db[_0x9088('0x2a')][_0x9088('0x19')](_0x31a7e1)[_0x9088('0x22')](function(_0x4941fb){_0x433b8a['count']=_0x4941fb;if(_0x48e5ed[_0x9088('0x2e')][_0x9088('0x3c')]){_0x3cb9e4[_0x9088('0x3d')]=[{'all':!![]}];}return db[_0x9088('0x2a')][_0x9088('0x3e')](_0x3cb9e4);})[_0x9088('0x22')](function(_0x30d8eb){_0x433b8a[_0x9088('0x3f')]=_0x30d8eb;return _0x433b8a;})[_0x9088('0x22')](respondWithFilteredResult(_0x25d85f,_0x3cb9e4))[_0x9088('0x40')](handleError(_0x25d85f,null));};exports[_0x9088('0x41')]=function(_0x52b18f,_0x451b3a){var _0xa57d0d={'raw':!![],'where':{'id':_0x52b18f[_0x9088('0x42')]['id']}},_0x3d3225={};_0x3d3225[_0x9088('0x2c')]=_['keys'](db[_0x9088('0x2a')][_0x9088('0x2b')]);_0x3d3225['query']=_['keys'](_0x52b18f[_0x9088('0x2e')]);_0x3d3225[_0x9088('0x2f')]=_[_0x9088('0x30')](_0x3d3225[_0x9088('0x2c')],_0x3d3225[_0x9088('0x2e')]);_0xa57d0d[_0x9088('0x31')]=_['intersection'](_0x3d3225['model'],qs[_0x9088('0x43')](_0x52b18f[_0x9088('0x2e')][_0x9088('0x43')]));_0xa57d0d[_0x9088('0x31')]=_0xa57d0d[_0x9088('0x31')]['length']?_0xa57d0d[_0x9088('0x31')]:_0x3d3225[_0x9088('0x2c')];if(_0x52b18f[_0x9088('0x2e')][_0x9088('0x3c')]){_0xa57d0d[_0x9088('0x3d')]=[{'all':!![]}];}_0xa57d0d=_[_0x9088('0x38')]({},_0xa57d0d,_0x52b18f[_0x9088('0x44')]);return db['Variable']['find'](_0xa57d0d)[_0x9088('0x22')](handleEntityNotFound(_0x451b3a,null))[_0x9088('0x22')](respondWithResult(_0x451b3a,null))[_0x9088('0x40')](handleError(_0x451b3a,null));};exports[_0x9088('0x45')]=function(_0x16644b,_0x56ff4f){return db['Variable'][_0x9088('0x45')](_0x16644b[_0x9088('0x46')],{})['then'](function(_0x1de6c8){var _0x176caa=_0x16644b[_0x9088('0x47')][_0x9088('0x24')]({'plain':!![]});if(!_0x176caa)throw new Error(_0x9088('0x48'));if(_0x176caa['role']===_0x9088('0x47')){var _0x2acf92=_0x1de6c8[_0x9088('0x24')]({'plain':!![]});var _0x45c24e=_0x9088('0x25');return db[_0x9088('0x49')][_0x9088('0x4a')]({'where':{'name':_0x45c24e,'userProfileId':_0x176caa[_0x9088('0x4b')]},'raw':!![]})[_0x9088('0x22')](function(_0xe0444e){if(_0xe0444e&&_0xe0444e[_0x9088('0x4c')]===0x0){return db[_0x9088('0x26')][_0x9088('0x45')]({'name':_0x2acf92[_0x9088('0x29')],'resourceId':_0x2acf92['id'],'type':_0xe0444e['name'],'sectionId':_0xe0444e['id']},{})['then'](function(){return _0x1de6c8;});}else{return _0x1de6c8;}})[_0x9088('0x40')](function(_0x76400e){logger[_0x9088('0x27')](_0x9088('0x4d'),_0x76400e);throw _0x76400e;});}return _0x1de6c8;})[_0x9088('0x22')](respondWithResult(_0x56ff4f,0xc9))[_0x9088('0x40')](handleError(_0x56ff4f,null));};exports[_0x9088('0x21')]=function(_0x457229,_0x133d30){if(_0x457229[_0x9088('0x46')]['id']){delete _0x457229[_0x9088('0x46')]['id'];}return db[_0x9088('0x2a')][_0x9088('0x4a')]({'where':{'id':_0x457229[_0x9088('0x42')]['id']}})[_0x9088('0x22')](handleEntityNotFound(_0x133d30,null))[_0x9088('0x22')](saveUpdates(_0x457229['body'],null))[_0x9088('0x22')](respondWithResult(_0x133d30,null))[_0x9088('0x40')](handleError(_0x133d30,null));};exports[_0x9088('0x23')]=function(_0x4828aa,_0x22aaa5){return db['Variable'][_0x9088('0x4a')]({'where':{'id':_0x4828aa[_0x9088('0x42')]['id']}})['then'](handleEntityNotFound(_0x22aaa5,null))[_0x9088('0x22')](removeEntity(_0x22aaa5,null))['catch'](handleError(_0x22aaa5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6d815af..ca06c42 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 _0x319c=['./variable.attributes','exports','define','Variable','tools_variables','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x319c,0x1d9));var _0xc319=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x319c[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xc319('0x0'));var util=require('util');var logger=require(_0xc319('0x1'))(_0xc319('0x2'));var moment=require(_0xc319('0x3'));var BPromise=require('bluebird');var rp=require(_0xc319('0x4'));var fs=require('fs');var path=require(_0xc319('0x5'));var rimraf=require(_0xc319('0x6'));var config=require(_0xc319('0x7'));var attributes=require(_0xc319('0x8'));module[_0xc319('0x9')]=function(_0xd892a7,_0x1c6cc6){return _0xd892a7[_0xc319('0xa')](_0xc319('0xb'),attributes,{'tableName':_0xc319('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1edd=['api','moment','bluebird','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0x1edd,0xcd));var _0xd1ed=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x1edd[_0x4664db];return _0x5615b4;};'use strict';var _=require(_0xd1ed('0x0'));var util=require(_0xd1ed('0x1'));var logger=require(_0xd1ed('0x2'))(_0xd1ed('0x3'));var moment=require(_0xd1ed('0x4'));var BPromise=require(_0xd1ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1ed('0x6'));var rimraf=require(_0xd1ed('0x7'));var config=require('../../config/environment');var attributes=require(_0xd1ed('0x8'));module[_0xd1ed('0x9')]=function(_0x59458c,_0x58283f){return _0x59458c[_0xd1ed('0xa')](_0xd1ed('0xb'),attributes,{'tableName':_0xd1ed('0xc'),'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 acb9d1b..bf95314 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 _0x0076=['error','code','message','result','ShowVariable','find','options','raw','where','attributes','map','include','model','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1ed4de,_0x43d1c2){var _0x3e9b85=function(_0x56b287){while(--_0x56b287){_0x1ed4de['push'](_0x1ed4de['shift']());}};_0x3e9b85(++_0x43d1c2);}(_0x0076,0x1ea));var _0x6007=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x0076[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x6007('0x0'));var util=require(_0x6007('0x1'));var moment=require(_0x6007('0x2'));var BPromise=require('bluebird');var rs=require(_0x6007('0x3'));var fs=require('fs');var Redis=require(_0x6007('0x4'));var db=require(_0x6007('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6007('0x6'))(_0x6007('0x7'));var config=require(_0x6007('0x8'));var jayson=require(_0x6007('0x9'));var client=jayson[_0x6007('0xa')][_0x6007('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e3590,_0x37a1f8,_0x2026f5){return new BPromise(function(_0x35e5b0,_0x391596){return client[_0x6007('0xc')](_0x3e3590,_0x2026f5)[_0x6007('0xd')](function(_0xa7f59d){logger[_0x6007('0xe')](_0x6007('0xf'),_0x37a1f8,'request\x20sent');logger[_0x6007('0x10')](_0x6007('0x11'),_0x37a1f8,_0x6007('0x12'),JSON[_0x6007('0x13')](_0xa7f59d));if(_0xa7f59d[_0x6007('0x14')]){if(_0xa7f59d[_0x6007('0x14')][_0x6007('0x15')]===0x1f4){logger[_0x6007('0x14')](_0x6007('0xf'),_0x37a1f8,_0xa7f59d[_0x6007('0x14')]['message']);return _0x391596(_0xa7f59d['error'][_0x6007('0x16')]);}logger[_0x6007('0x14')]('Variable,\x20%s,\x20%s',_0x37a1f8,_0xa7f59d[_0x6007('0x14')][_0x6007('0x16')]);return _0x35e5b0(_0xa7f59d['error'][_0x6007('0x16')]);}else{logger[_0x6007('0xe')](_0x6007('0xf'),_0x37a1f8,_0x6007('0x12'));_0x35e5b0(_0xa7f59d[_0x6007('0x17')]['message']);}})['catch'](function(_0x59808d){logger[_0x6007('0x14')](_0x6007('0xf'),_0x37a1f8,_0x59808d);_0x391596(_0x59808d);});});}exports[_0x6007('0x18')]=function(_0x10dc13){var _0x4d0ea1=this;return new Promise(function(_0x4cf4ff,_0x355566){return db['Variable'][_0x6007('0x19')]({'raw':_0x10dc13[_0x6007('0x1a')]?_0x10dc13[_0x6007('0x1a')][_0x6007('0x1b')]===undefined?!![]:![]:!![],'where':_0x10dc13[_0x6007('0x1a')]?_0x10dc13[_0x6007('0x1a')][_0x6007('0x1c')]||null:null,'attributes':_0x10dc13['options']?_0x10dc13[_0x6007('0x1a')][_0x6007('0x1d')]||null:null,'include':_0x10dc13[_0x6007('0x1a')]?_0x10dc13['options']['include']?_[_0x6007('0x1e')](_0x10dc13[_0x6007('0x1a')][_0x6007('0x1f')],function(_0x60a9c2){return{'model':db[_0x60a9c2[_0x6007('0x20')]],'as':_0x60a9c2['as'],'attributes':_0x60a9c2['attributes'],'include':_0x60a9c2[_0x6007('0x1f')]?_['map'](_0x60a9c2[_0x6007('0x1f')],function(_0x3d37e7){return{'model':db[_0x3d37e7[_0x6007('0x20')]],'as':_0x3d37e7['as'],'attributes':_0x3d37e7[_0x6007('0x1d')],'include':_0x3d37e7[_0x6007('0x1f')]?_['map'](_0x3d37e7['include'],function(_0x8e9fc4){return{'model':db[_0x8e9fc4['model']],'as':_0x8e9fc4['as'],'attributes':_0x8e9fc4[_0x6007('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13a163){logger['info'](_0x6007('0x18'),_0x10dc13);logger['debug'](_0x6007('0x18'),_0x10dc13,JSON[_0x6007('0x13')](_0x13a163));_0x4cf4ff(_0x13a163);})[_0x6007('0x21')](function(_0x3c0183){logger['error'](_0x6007('0x18'),_0x3c0183[_0x6007('0x16')],_0x10dc13);_0x355566(_0x4d0ea1[_0x6007('0x14')](0x1f4,_0x3c0183[_0x6007('0x16')]));});});}; \ No newline at end of file +var _0x2895=['stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','raw','where','include','attributes','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x2895,0x70));var _0x5289=function(_0x21027e,_0x46a44d){_0x21027e=_0x21027e-0x0;var _0x4c18c5=_0x2895[_0x21027e];return _0x4c18c5;};'use strict';var _=require(_0x5289('0x0'));var util=require(_0x5289('0x1'));var moment=require(_0x5289('0x2'));var BPromise=require(_0x5289('0x3'));var rs=require(_0x5289('0x4'));var fs=require('fs');var Redis=require(_0x5289('0x5'));var db=require(_0x5289('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5289('0x7'))('rpc');var config=require(_0x5289('0x8'));var jayson=require(_0x5289('0x9'));var client=jayson['client'][_0x5289('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eb13b,_0x5be94d,_0x37383b){return new BPromise(function(_0xdcc180,_0x17906a){return client['request'](_0x2eb13b,_0x37383b)[_0x5289('0xb')](function(_0x341afd){logger[_0x5289('0xc')]('Variable,\x20%s,\x20%s',_0x5be94d,'request\x20sent');logger[_0x5289('0xd')](_0x5289('0xe'),_0x5be94d,_0x5289('0xf'),JSON[_0x5289('0x10')](_0x341afd));if(_0x341afd['error']){if(_0x341afd[_0x5289('0x11')][_0x5289('0x12')]===0x1f4){logger[_0x5289('0x11')]('Variable,\x20%s,\x20%s',_0x5be94d,_0x341afd[_0x5289('0x11')][_0x5289('0x13')]);return _0x17906a(_0x341afd[_0x5289('0x11')][_0x5289('0x13')]);}logger['error'](_0x5289('0x14'),_0x5be94d,_0x341afd[_0x5289('0x11')][_0x5289('0x13')]);return _0xdcc180(_0x341afd[_0x5289('0x11')]['message']);}else{logger[_0x5289('0xc')](_0x5289('0x14'),_0x5be94d,'request\x20sent');_0xdcc180(_0x341afd[_0x5289('0x15')][_0x5289('0x13')]);}})[_0x5289('0x16')](function(_0x5f4d35){logger[_0x5289('0x11')](_0x5289('0x14'),_0x5be94d,_0x5f4d35);_0x17906a(_0x5f4d35);});});}exports[_0x5289('0x17')]=function(_0x3e634b){var _0x4ca178=this;return new Promise(function(_0x4a4c8f,_0x535962){return db['Variable'][_0x5289('0x18')]({'raw':_0x3e634b[_0x5289('0x19')]?_0x3e634b[_0x5289('0x19')][_0x5289('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e634b['options']?_0x3e634b['options'][_0x5289('0x1b')]||null:null,'attributes':_0x3e634b[_0x5289('0x19')]?_0x3e634b['options']['attributes']||null:null,'include':_0x3e634b[_0x5289('0x19')]?_0x3e634b[_0x5289('0x19')][_0x5289('0x1c')]?_['map'](_0x3e634b[_0x5289('0x19')]['include'],function(_0x24d5f1){return{'model':db[_0x24d5f1['model']],'as':_0x24d5f1['as'],'attributes':_0x24d5f1[_0x5289('0x1d')],'include':_0x24d5f1['include']?_[_0x5289('0x1e')](_0x24d5f1[_0x5289('0x1c')],function(_0x6a8f70){return{'model':db[_0x6a8f70[_0x5289('0x1f')]],'as':_0x6a8f70['as'],'attributes':_0x6a8f70[_0x5289('0x1d')],'include':_0x6a8f70[_0x5289('0x1c')]?_[_0x5289('0x1e')](_0x6a8f70[_0x5289('0x1c')],function(_0x463519){return{'model':db[_0x463519[_0x5289('0x1f')]],'as':_0x463519['as'],'attributes':_0x463519[_0x5289('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5289('0xb')](function(_0x599f19){logger['info'](_0x5289('0x17'),_0x3e634b);logger[_0x5289('0xd')](_0x5289('0x17'),_0x3e634b,JSON[_0x5289('0x10')](_0x599f19));_0x4a4c8f(_0x599f19);})['catch'](function(_0x325006){logger['error'](_0x5289('0x17'),_0x325006['message'],_0x3e634b);_0x535962(_0x4ca178[_0x5289('0x11')](0x1f4,_0x325006[_0x5289('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 6093b5a..49c7875 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 _0x6d98=['isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x43dc77,_0xf65a6a){var _0x4c60ee=function(_0x3b2aa6){while(--_0x3b2aa6){_0x43dc77['push'](_0x43dc77['shift']());}};_0x4c60ee(++_0xf65a6a);}(_0x6d98,0xf8));var _0x86d9=function(_0x5abfe9,_0x586fbc){_0x5abfe9=_0x5abfe9-0x0;var _0x170ba0=_0x6d98[_0x5abfe9];return _0x170ba0;};'use strict';var express=require(_0x86d9('0x0'));var router=express[_0x86d9('0x1')]();var auth=require(_0x86d9('0x2'));var controller=require(_0x86d9('0x3'));router[_0x86d9('0x4')]('/',controller[_0x86d9('0x5')]);router['get'](_0x86d9('0x6'),auth[_0x86d9('0x7')](),auth['canUpdate'](),controller[_0x86d9('0x8')]);router[_0x86d9('0x4')](_0x86d9('0x9'),auth[_0x86d9('0x7')](),auth[_0x86d9('0xa')](),controller[_0x86d9('0xb')]);router['get'](_0x86d9('0xc'),auth[_0x86d9('0x7')](),auth[_0x86d9('0xa')](),controller[_0x86d9('0xd')]);router[_0x86d9('0x4')]('/restart',auth[_0x86d9('0x7')](),controller[_0x86d9('0xe')]);router[_0x86d9('0x4')]('/migrations',controller[_0x86d9('0xf')]);module[_0x86d9('0x10')]=router; \ No newline at end of file +var _0x7bbd=['migrations','exports','express','Router','../../components/auth/service','./version.controller','isAuthenticated','canUpdate','get','/reset','reset','/pull','pull','/restart','restart'];(function(_0x4fe2cc,_0x386fa0){var _0x1ae15c=function(_0x142396){while(--_0x142396){_0x4fe2cc['push'](_0x4fe2cc['shift']());}};_0x1ae15c(++_0x386fa0);}(_0x7bbd,0x11f));var _0xd7bb=function(_0x49118a,_0x265504){_0x49118a=_0x49118a-0x0;var _0x56cccf=_0x7bbd[_0x49118a];return _0x56cccf;};'use strict';var express=require(_0xd7bb('0x0'));var router=express[_0xd7bb('0x1')]();var auth=require(_0xd7bb('0x2'));var controller=require(_0xd7bb('0x3'));router['get']('/',controller['index']);router['get']('/fetch',auth[_0xd7bb('0x4')](),auth[_0xd7bb('0x5')](),controller['fetch']);router[_0xd7bb('0x6')](_0xd7bb('0x7'),auth[_0xd7bb('0x4')](),auth[_0xd7bb('0x5')](),controller[_0xd7bb('0x8')]);router[_0xd7bb('0x6')](_0xd7bb('0x9'),auth[_0xd7bb('0x4')](),auth[_0xd7bb('0x5')](),controller[_0xd7bb('0xa')]);router['get'](_0xd7bb('0xb'),auth[_0xd7bb('0x4')](),controller[_0xd7bb('0xc')]);router[_0xd7bb('0x6')]('/migrations',controller[_0xd7bb('0xd')]);module[_0xd7bb('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index fc1315e..6b72e60 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 _0xc1d3=['sequelize','getQueryInterface','constructor','join','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','catch','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','json','status','origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','migrations','replace','.js','push','length','sort','Migration'];(function(_0x2218e0,_0x3cacf9){var _0x413392=function(_0x34b4a4){while(--_0x34b4a4){_0x2218e0['push'](_0x2218e0['shift']());}};_0x413392(++_0x3cacf9);}(_0xc1d3,0x147));var _0x3c1d=function(_0x45d85,_0x1ef203){_0x45d85=_0x45d85-0x0;var _0x2ca483=_0xc1d3[_0x45d85];return _0x2ca483;};'use strict';var Umzug=require(_0x3c1d('0x0'));var path=require(_0x3c1d('0x1'));var fs=require('fs');var _=require(_0x3c1d('0x2'));var pkginfo=require(_0x3c1d('0x3'))(module,_0x3c1d('0x4'));var compareVersions=require(_0x3c1d('0x5'));var exec=require(_0x3c1d('0x6'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x3c1d('0x7'));var pm2=require(_0x3c1d('0x8'));var logger=require(_0x3c1d('0x9'))('update');var git=require(_0x3c1d('0xa'))(config[_0x3c1d('0xb')]);exports[_0x3c1d('0xc')]=function(_0x28793c,_0x1796a0){var _0x58e08c={'current':module[_0x3c1d('0xd')][_0x3c1d('0x4')],'phonebar':0x2};if(_0x28793c[_0x3c1d('0xe')]&&_0x28793c[_0x3c1d('0xe')][_0x3c1d('0xf')]){return git[_0x3c1d('0x10')]()[_0x3c1d('0x11')](function(_0x20458f,_0x54f12b){_0x58e08c[_0x3c1d('0xf')]=(_0x20458f?module[_0x3c1d('0xd')][_0x3c1d('0x4')]:_0x54f12b[_0x3c1d('0xf')])||_0x3c1d('0x12');return _0x1796a0['status'](0xc8)[_0x3c1d('0x13')](_0x58e08c);});}else{return _0x1796a0[_0x3c1d('0x14')](0xc8)['json'](_0x58e08c);}};exports[_0x3c1d('0x10')]=function(_0x5731c9,_0x4ed530){return git['fetch']([_0x3c1d('0x15'),_0x3c1d('0x16')],function(_0x1a5da1){if(_0x1a5da1){logger[_0x3c1d('0x17')](_0x1a5da1);return _0x4ed530[_0x3c1d('0x14')](0x1f4)[_0x3c1d('0x13')](_0x1a5da1);}logger['info']('git\x20fetch');return _0x4ed530[_0x3c1d('0x14')](0xc8)['json']({'output':_0x3c1d('0x18')});});};exports[_0x3c1d('0x19')]=function(_0x4af234,_0x4a7e42){return git['reset']([_0x3c1d('0x1a'),_0x3c1d('0x1b')],function(_0x14c64b){if(_0x14c64b){logger[_0x3c1d('0x17')](_0x14c64b);return _0x4a7e42[_0x3c1d('0x14')](0x1f4)['json'](_0x14c64b);}logger['info'](_0x3c1d('0x1c'));return _0x4a7e42[_0x3c1d('0x14')](0xc8)[_0x3c1d('0x13')]({'output':_0x3c1d('0x1d')});});};exports[_0x3c1d('0x1e')]=function(_0x5b2720,_0x129be7){exec(_0x3c1d('0x1f'),function(_0xa5fd81,_0x5211d7,_0x129497){logger[_0x3c1d('0x20')](_0x5211d7);logger[_0x3c1d('0x20')](_0x129497);if(_0xa5fd81){logger[_0x3c1d('0x17')](_0xa5fd81);return _0x129be7[_0x3c1d('0x14')](0x1f4)[_0x3c1d('0x13')](_0xa5fd81);}return _0x129be7[_0x3c1d('0x14')](0xc8)[_0x3c1d('0x13')]({'output':_0x5211d7});});};exports[_0x3c1d('0x21')]=function(_0x5bc22d,_0x2c0132){return pm2[_0x3c1d('0x21')](_0x3c1d('0x22'))['then'](function(_0x2d1694){logger[_0x3c1d('0x20')]('pm2\x20restart\x20motion\x20%s',_0x2d1694);return _0x2c0132[_0x3c1d('0x14')](0xc8)[_0x3c1d('0x13')]({'output':_0x3c1d('0x23')});})['catch'](function(_0x23e5a0){logger['error'](_0x23e5a0);return _0x2c0132[_0x3c1d('0x14')](0x1f4)[_0x3c1d('0x13')](_0x23e5a0);});};exports['migrations']=function(_0x4ff12a,_0x356f61){var _0x2f7af9=fs[_0x3c1d('0x24')](path['join'](config[_0x3c1d('0xb')],'server',_0x3c1d('0x25')));var _0x438b09=[];for(var _0x1296ed=0x0;_0x1296ed<_0x2f7af9['length'];_0x1296ed++){var _0x147523=_0x2f7af9[_0x1296ed][_0x3c1d('0x26')](_0x3c1d('0x27'),'');if(compareVersions(module[_0x3c1d('0xd')][_0x3c1d('0x4')],_0x147523)===-0x1){_0x438b09[_0x3c1d('0x28')](_0x147523);}}if(_0x438b09[_0x3c1d('0x29')]){var _0x19154d=_0x438b09[_0x3c1d('0x2a')](compareVersions);var _0x5c18e2=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x3c1d('0x2b')],'modelName':'Migration','columnName':_0x3c1d('0x4')},'migrations':{'params':[db[_0x3c1d('0x2c')][_0x3c1d('0x2d')](),db[_0x3c1d('0x2c')][_0x3c1d('0x2e')],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[_0x3c1d('0x2f')](config[_0x3c1d('0xb')],'server','migrations'),'pattern':/\.js$/}});_0x5c18e2['up']({'migrations':_[_0x3c1d('0x30')](_0x19154d,function(_0x152b8e){return _0x152b8e+_0x3c1d('0x27');})})[_0x3c1d('0x31')](function(){return _0x356f61[_0x3c1d('0x14')](0xc8)['json']({'output':_0x3c1d('0x32')+module[_0x3c1d('0xd')]['version']+'\x20to\x20'+_['last'](_0x19154d),'migrations':_[_0x3c1d('0x2f')](_0x19154d)});})[_0x3c1d('0x33')](function(_0x2fbba1){if(_0x2fbba1 instanceof db[_0x3c1d('0x2c')]['UniqueConstraintError']){return _0x356f61[_0x3c1d('0x14')](0xc8)['json']({'output':_0x3c1d('0x34')});}else{return _0x356f61[_0x3c1d('0x14')](0x1f4)[_0x3c1d('0x13')](_0x2fbba1);}});}else{return _0x356f61[_0x3c1d('0x14')](0xc8)[_0x3c1d('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xd906=['Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','query','latest','fetch','tags','exports','status','json','master','error','git\x20fetch','reset','git\x20reset\x20--hard','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','.js','push','sort','Migration','sequelize','getQueryInterface','constructor'];(function(_0x1f2cd3,_0x4951bd){var _0x4e3d2c=function(_0x3c96ae){while(--_0x3c96ae){_0x1f2cd3['push'](_0x1f2cd3['shift']());}};_0x4e3d2c(++_0x4951bd);}(_0xd906,0x6b));var _0x6d90=function(_0x183f92,_0x13326f){_0x183f92=_0x183f92-0x0;var _0x2be6f2=_0xd906[_0x183f92];return _0x2be6f2;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x6d90('0x0'));var pkginfo=require(_0x6d90('0x1'))(module,_0x6d90('0x2'));var compareVersions=require(_0x6d90('0x3'));var exec=require(_0x6d90('0x4'))['exec'];var db=require(_0x6d90('0x5'))['db'];var config=require(_0x6d90('0x6'));var pm2=require(_0x6d90('0x7'));var logger=require(_0x6d90('0x8'))('update');var git=require(_0x6d90('0x9'))(config[_0x6d90('0xa')]);exports[_0x6d90('0xb')]=function(_0x160c7d,_0x219737){var _0x5d0ed4={'current':module['exports']['version'],'phonebar':0x2};if(_0x160c7d[_0x6d90('0xc')]&&_0x160c7d[_0x6d90('0xc')][_0x6d90('0xd')]){return git[_0x6d90('0xe')]()[_0x6d90('0xf')](function(_0x187a03,_0x243b3a){_0x5d0ed4['latest']=(_0x187a03?module[_0x6d90('0x10')]['version']:_0x243b3a[_0x6d90('0xd')])||'2.0.0';return _0x219737[_0x6d90('0x11')](0xc8)[_0x6d90('0x12')](_0x5d0ed4);});}else{return _0x219737[_0x6d90('0x11')](0xc8)[_0x6d90('0x12')](_0x5d0ed4);}};exports[_0x6d90('0xe')]=function(_0x579908,_0x9c7ac9){return git[_0x6d90('0xe')](['origin',_0x6d90('0x13')],function(_0x513417){if(_0x513417){logger[_0x6d90('0x14')](_0x513417);return _0x9c7ac9[_0x6d90('0x11')](0x1f4)[_0x6d90('0x12')](_0x513417);}logger['info'](_0x6d90('0x15'));return _0x9c7ac9['status'](0xc8)[_0x6d90('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x6d90('0x16')]=function(_0xeb9d15,_0x352736){return git[_0x6d90('0x16')](['--hard','FETCH_HEAD'],function(_0x4079c9){if(_0x4079c9){logger['error'](_0x4079c9);return _0x352736[_0x6d90('0x11')](0x1f4)[_0x6d90('0x12')](_0x4079c9);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x352736[_0x6d90('0x11')](0xc8)[_0x6d90('0x12')]({'output':_0x6d90('0x17')});});};exports['pull']=function(_0x5cf8dc,_0x48e63c){exec('npm\x20install\x20--production',function(_0x2d07f9,_0x5703e6,_0x19eb9d){logger[_0x6d90('0x18')](_0x5703e6);logger[_0x6d90('0x18')](_0x19eb9d);if(_0x2d07f9){logger[_0x6d90('0x14')](_0x2d07f9);return _0x48e63c[_0x6d90('0x11')](0x1f4)[_0x6d90('0x12')](_0x2d07f9);}return _0x48e63c[_0x6d90('0x11')](0xc8)[_0x6d90('0x12')]({'output':_0x5703e6});});};exports[_0x6d90('0x19')]=function(_0x3b62da,_0x1cf729){return pm2['restart'](_0x6d90('0x1a'))[_0x6d90('0x1b')](function(_0x447070){logger['info'](_0x6d90('0x1c'),_0x447070);return _0x1cf729[_0x6d90('0x11')](0xc8)[_0x6d90('0x12')]({'output':_0x6d90('0x1d')});})[_0x6d90('0x1e')](function(_0x41cdfc){logger[_0x6d90('0x14')](_0x41cdfc);return _0x1cf729[_0x6d90('0x11')](0x1f4)[_0x6d90('0x12')](_0x41cdfc);});};exports[_0x6d90('0x1f')]=function(_0x5eea54,_0x5ec50d){var _0x5e1ab7=fs[_0x6d90('0x20')](path['join'](config[_0x6d90('0xa')],_0x6d90('0x21'),_0x6d90('0x1f')));var _0x3802fb=[];for(var _0x2cfc62=0x0;_0x2cfc62<_0x5e1ab7[_0x6d90('0x22')];_0x2cfc62++){var _0x196da5=_0x5e1ab7[_0x2cfc62][_0x6d90('0x23')](_0x6d90('0x24'),'');if(compareVersions(module[_0x6d90('0x10')][_0x6d90('0x2')],_0x196da5)===-0x1){_0x3802fb[_0x6d90('0x25')](_0x196da5);}}if(_0x3802fb[_0x6d90('0x22')]){var _0x4da0ec=_0x3802fb[_0x6d90('0x26')](compareVersions);var _0x56384d=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6d90('0x27')],'modelName':_0x6d90('0x27'),'columnName':'version'},'migrations':{'params':[db[_0x6d90('0x28')][_0x6d90('0x29')](),db[_0x6d90('0x28')][_0x6d90('0x2a')],function(){throw new Error(_0x6d90('0x2b'));}],'path':path[_0x6d90('0x2c')](config[_0x6d90('0xa')],_0x6d90('0x21'),_0x6d90('0x1f')),'pattern':/\.js$/}});_0x56384d['up']({'migrations':_[_0x6d90('0x2d')](_0x4da0ec,function(_0xf09c63){return _0xf09c63+_0x6d90('0x24');})})[_0x6d90('0x1b')](function(){return _0x5ec50d[_0x6d90('0x11')](0xc8)[_0x6d90('0x12')]({'output':_0x6d90('0x2e')+module[_0x6d90('0x10')][_0x6d90('0x2')]+'\x20to\x20'+_[_0x6d90('0x2f')](_0x4da0ec),'migrations':_['join'](_0x4da0ec)});})[_0x6d90('0x1e')](function(_0x903285){if(_0x903285 instanceof db['sequelize'][_0x6d90('0x30')]){return _0x5ec50d[_0x6d90('0x11')](0xc8)['json']({'output':_0x6d90('0x31')});}else{return _0x5ec50d[_0x6d90('0x11')](0x1f4)[_0x6d90('0x12')](_0x903285);}});}else{return _0x5ec50d[_0x6d90('0x11')](0xc8)[_0x6d90('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index cff3e2b..cb828b0 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 _0x2f4d=['isAuthenticated','/describe','describe','get','/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x43e163,_0x3b6efe){var _0x158410=function(_0x178a74){while(--_0x178a74){_0x43e163['push'](_0x43e163['shift']());}};_0x158410(++_0x3b6efe);}(_0x2f4d,0x77));var _0xd2f4=function(_0x132e83,_0x258555){_0x132e83=_0x132e83-0x0;var _0x2ddf9b=_0x2f4d[_0x132e83];return _0x2ddf9b;};'use strict';var multer=require(_0xd2f4('0x0'));var util=require(_0xd2f4('0x1'));var path=require('path');var timeout=require(_0xd2f4('0x2'));var express=require(_0xd2f4('0x3'));var router=express['Router']();var auth=require(_0xd2f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd2f4('0x5'));var controller=require(_0xd2f4('0x6'));router['get']('/',auth[_0xd2f4('0x7')](),controller['index']);router['get'](_0xd2f4('0x8'),auth[_0xd2f4('0x7')](),controller[_0xd2f4('0x9')]);router[_0xd2f4('0xa')](_0xd2f4('0xb'),auth[_0xd2f4('0x7')](),controller[_0xd2f4('0xc')]);router[_0xd2f4('0xd')]('/',auth[_0xd2f4('0x7')](),controller[_0xd2f4('0xe')]);router['put'](_0xd2f4('0xb'),auth[_0xd2f4('0x7')](),controller['update']);router[_0xd2f4('0xf')](_0xd2f4('0xb'),auth[_0xd2f4('0x7')](),controller[_0xd2f4('0x10')]);module[_0xd2f4('0x11')]=router; \ No newline at end of file +var _0x15ce=['update','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','put'];(function(_0x2b5057,_0x59b4a0){var _0x52d823=function(_0x48b9e6){while(--_0x48b9e6){_0x2b5057['push'](_0x2b5057['shift']());}};_0x52d823(++_0x59b4a0);}(_0x15ce,0x69));var _0xe15c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x15ce[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xe15c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe15c('0x1'));var router=express[_0xe15c('0x2')]();var auth=require(_0xe15c('0x3'));var interaction=require(_0xe15c('0x4'));var config=require('../../config/environment');var controller=require(_0xe15c('0x5'));router['get']('/',auth[_0xe15c('0x6')](),controller[_0xe15c('0x7')]);router[_0xe15c('0x8')](_0xe15c('0x9'),auth[_0xe15c('0x6')](),controller[_0xe15c('0xa')]);router[_0xe15c('0x8')](_0xe15c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe15c('0xc')]('/',auth[_0xe15c('0x6')](),controller['create']);router[_0xe15c('0xd')]('/:id',auth[_0xe15c('0x6')](),controller[_0xe15c('0xe')]);router[_0xe15c('0xf')](_0xe15c('0xb'),auth[_0xe15c('0x6')](),controller[_0xe15c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index e1a6c1a..8078a8f 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 _0x8ef6=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0x8ef6,0xf2));var _0x68ef=function(_0x38fb87,_0x2724a2){_0x38fb87=_0x38fb87-0x0;var _0x5216df=_0x8ef6[_0x38fb87];return _0x5216df;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'type':{'type':Sequelize[_0x68ef('0x2')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize[_0x68ef('0x2')]},'queue':{'type':Sequelize[_0x68ef('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x68ef('0x2')]},'agentcalledAt':{'type':Sequelize[_0x68ef('0x3')]},'agentconnectAt':{'type':Sequelize[_0x68ef('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x68ef('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x68ef('0x4')]},'agentcomplete':{'type':Sequelize[_0x68ef('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x68ef('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x68ef('0x4')]},'agentacw':{'type':Sequelize[_0x68ef('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x68ef('0x4')]},'reason':{'type':Sequelize[_0x68ef('0x2')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x4')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x68ef('0x2')]},'priority':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize[_0x68ef('0x2')]},'destchannelstate':{'type':Sequelize[_0x68ef('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x68ef('0x2')]},'transfer':{'type':Sequelize[_0x68ef('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x68ef('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x68ef('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5d17=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5d17,0x114));var _0x75d1=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x5d17[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x75d1('0x2')]},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'queue':{'type':Sequelize[_0x75d1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x75d1('0x2')]},'agentcalledAt':{'type':Sequelize[_0x75d1('0x3')]},'agentconnectAt':{'type':Sequelize[_0x75d1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x75d1('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x75d1('0x3')]},'holdtime':{'type':Sequelize[_0x75d1('0x4')]},'agentcomplete':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x75d1('0x4')]},'agentacw':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x75d1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x75d1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x75d1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x75d1('0x2')]},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'exten':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize[_0x75d1('0x2')]},'destchannel':{'type':Sequelize[_0x75d1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x75d1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x75d1('0x2')]},'destcalleridname':{'type':Sequelize[_0x75d1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x75d1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x75d1('0x2')]},'destexten':{'type':Sequelize[_0x75d1('0x2')]},'destpriority':{'type':Sequelize[_0x75d1('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x75d1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x75d1('0x2')]},'transfer':{'type':Sequelize[_0x75d1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x75d1('0x2')],'comment':_0x75d1('0x6')},'transferexten':{'type':Sequelize[_0x75d1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x75d1('0x2')]},'agententerreason':{'type':Sequelize[_0x75d1('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 557de6c..6f732df 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 _0x9fbc=['then','destroy','stack','name','index','VoiceAgentReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','count','includeAll','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','reject','save','update'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9fbc,0xfd));var _0xc9fb=function(_0x145880,_0x1365aa){_0x145880=_0x145880-0x0;var _0xd2f1c2=_0x9fbc[_0x145880];return _0xd2f1c2;};'use strict';var pdf=require(_0xc9fb('0x0'));var emlformat=require(_0xc9fb('0x1'));var rimraf=require(_0xc9fb('0x2'));var zipdir=require(_0xc9fb('0x3'));var jsonpatch=require(_0xc9fb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc9fb('0x5'));var Mustache=require(_0xc9fb('0x6'));var util=require('util');var path=require(_0xc9fb('0x7'));var sox=require(_0xc9fb('0x8'));var csv=require(_0xc9fb('0x9'));var ejs=require(_0xc9fb('0xa'));var fs=require('fs');var _=require(_0xc9fb('0xb'));var squel=require(_0xc9fb('0xc'));var crypto=require(_0xc9fb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc9fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc9fb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc9fb('0x10'));var qs=require(_0xc9fb('0x11'));var hardwareService=require(_0xc9fb('0x12'));var logger=require(_0xc9fb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc9fb('0x14'));var db=require(_0xc9fb('0x15'))['db'];function respondWithStatusCode(_0x3a08e1,_0x2d7f4c){_0x2d7f4c=_0x2d7f4c||0xcc;return function(_0x1a1f25){if(_0x1a1f25){return _0x3a08e1['sendStatus'](_0x2d7f4c);}return _0x3a08e1[_0xc9fb('0x16')](_0x2d7f4c)[_0xc9fb('0x17')]();};}function respondWithResult(_0x33a666,_0x1c6a15){_0x1c6a15=_0x1c6a15||0xc8;return function(_0x5d7660){if(_0x5d7660){return _0x33a666[_0xc9fb('0x16')](_0x1c6a15)[_0xc9fb('0x18')](_0x5d7660);}};}function respondWithFilteredResult(_0x5a6d1b,_0x1c2a3d){return function(_0x56e4fb){if(_0x56e4fb){var _0x33cc3c=_0x56e4fb['count'],_0x59e76e=_0x1c2a3d[_0xc9fb('0x19')],_0x2ef4e4=_0x1c2a3d[_0xc9fb('0x19')]+_0x1c2a3d['limit'],_0x4bfee9;if(_0x2ef4e4>=_0x33cc3c){_0x2ef4e4=_0x33cc3c;_0x4bfee9=0xc8;}else{_0x4bfee9=0xce;}_0x5a6d1b[_0xc9fb('0x16')](_0x4bfee9);return _0x5a6d1b[_0xc9fb('0x1a')](_0xc9fb('0x1b'),_0x59e76e+'-'+_0x2ef4e4+'/'+_0x33cc3c)[_0xc9fb('0x18')](_0x56e4fb);}return null;};}function patchUpdates(_0x55c43c){return function(_0x39b015){try{jsonpatch['apply'](_0x39b015,_0x55c43c,!![]);}catch(_0x1fa674){return BPromise[_0xc9fb('0x1c')](_0x1fa674);}return _0x39b015[_0xc9fb('0x1d')]();};}function saveUpdates(_0x31a58f,_0x1e52ee){return function(_0xe008e3){if(_0xe008e3){return _0xe008e3[_0xc9fb('0x1e')](_0x31a58f)[_0xc9fb('0x1f')](function(_0x13acbd){return _0x13acbd;});}return null;};}function removeEntity(_0x497487,_0x26eb7e){return function(_0x2555ca){if(_0x2555ca){return _0x2555ca[_0xc9fb('0x20')]()['then'](function(){_0x497487[_0xc9fb('0x16')](0xcc)[_0xc9fb('0x17')]();});}};}function handleEntityNotFound(_0xf65c79,_0x290358){return function(_0x25de72){if(!_0x25de72){_0xf65c79['sendStatus'](0x194);}return _0x25de72;};}function handleError(_0x1a281e,_0x12feea){_0x12feea=_0x12feea||0x1f4;return function(_0x5ccb46){logger['error'](_0x5ccb46[_0xc9fb('0x21')]);if(_0x5ccb46[_0xc9fb('0x22')]){delete _0x5ccb46[_0xc9fb('0x22')];}_0x1a281e[_0xc9fb('0x16')](_0x12feea)['send'](_0x5ccb46);};}exports[_0xc9fb('0x23')]=function(_0x4883d0,_0x176339){var _0x166659={},_0x368d40={},_0x3364cd={'count':0x0,'rows':[]};var _0x515dfa=db[_0xc9fb('0x24')][_0xc9fb('0x25')];_0x368d40['model']=_[_0xc9fb('0x26')](_0x515dfa);_0x368d40[_0xc9fb('0x27')]=_[_0xc9fb('0x26')](_0x4883d0[_0xc9fb('0x27')]);_0x368d40[_0xc9fb('0x28')]=_[_0xc9fb('0x29')](_0x368d40[_0xc9fb('0x2a')],_0x368d40[_0xc9fb('0x27')]);_0x166659[_0xc9fb('0x2b')]=_['intersection'](_0x368d40['model'],qs['fields'](_0x4883d0[_0xc9fb('0x27')][_0xc9fb('0x2c')]));_0x166659[_0xc9fb('0x2b')]=_0x166659[_0xc9fb('0x2b')][_0xc9fb('0x2d')]?_0x166659[_0xc9fb('0x2b')]:_0x368d40[_0xc9fb('0x2a')];if(!_0x4883d0[_0xc9fb('0x27')][_0xc9fb('0x2e')]('nolimit')){_0x166659[_0xc9fb('0x2f')]=qs[_0xc9fb('0x2f')](_0x4883d0[_0xc9fb('0x27')][_0xc9fb('0x2f')]);_0x166659['offset']=qs[_0xc9fb('0x19')](_0x4883d0[_0xc9fb('0x27')][_0xc9fb('0x19')]);}_0x166659[_0xc9fb('0x30')]=qs[_0xc9fb('0x31')](_0x4883d0[_0xc9fb('0x27')][_0xc9fb('0x31')]);_0x166659['where']=qs[_0xc9fb('0x28')](_[_0xc9fb('0x32')](_0x4883d0[_0xc9fb('0x27')],_0x368d40[_0xc9fb('0x28')]));if(_0x4883d0['query'][_0xc9fb('0x33')]){_0x166659[_0xc9fb('0x34')]=_[_0xc9fb('0x35')](_0x166659[_0xc9fb('0x34')],{'$or':_[_0xc9fb('0x36')](_0x515dfa,function(_0x4cd0e3){if(_0x4cd0e3[_0xc9fb('0x37')][_0xc9fb('0x38')]!==_0xc9fb('0x39')){var _0x3eddd0={};_0x3eddd0[_0x4cd0e3[_0xc9fb('0x3a')]]={'$like':'%'+_0x4883d0[_0xc9fb('0x27')]['filter']+'%'};return _0x3eddd0;}})});}_0x166659=_[_0xc9fb('0x35')]({},_0x166659,_0x4883d0[_0xc9fb('0x3b')]);var _0x3b57ab={'where':_0x166659['where']};return db[_0xc9fb('0x24')][_0xc9fb('0x3c')](_0x3b57ab)[_0xc9fb('0x1f')](function(_0x15dca0){_0x3364cd['count']=_0x15dca0;if(_0x4883d0[_0xc9fb('0x27')][_0xc9fb('0x3d')]){_0x166659['include']=[{'all':!![]}];}return db[_0xc9fb('0x24')][_0xc9fb('0x3e')](_0x166659);})[_0xc9fb('0x1f')](function(_0x55dd03){_0x3364cd[_0xc9fb('0x3f')]=_0x55dd03;return _0x3364cd;})[_0xc9fb('0x1f')](respondWithFilteredResult(_0x176339,_0x166659))[_0xc9fb('0x40')](handleError(_0x176339,null));};exports[_0xc9fb('0x41')]=function(_0x56f1e3,_0x430581){var _0x38ffe5={'raw':![],'where':{'id':_0x56f1e3[_0xc9fb('0x42')]['id']}},_0x12453d={};_0x12453d[_0xc9fb('0x2a')]=_[_0xc9fb('0x26')](db[_0xc9fb('0x24')][_0xc9fb('0x25')]);_0x12453d[_0xc9fb('0x27')]=_[_0xc9fb('0x26')](_0x56f1e3[_0xc9fb('0x27')]);_0x12453d[_0xc9fb('0x28')]=_[_0xc9fb('0x29')](_0x12453d[_0xc9fb('0x2a')],_0x12453d[_0xc9fb('0x27')]);_0x38ffe5[_0xc9fb('0x2b')]=_[_0xc9fb('0x29')](_0x12453d[_0xc9fb('0x2a')],qs[_0xc9fb('0x2c')](_0x56f1e3[_0xc9fb('0x27')][_0xc9fb('0x2c')]));_0x38ffe5[_0xc9fb('0x2b')]=_0x38ffe5['attributes'][_0xc9fb('0x2d')]?_0x38ffe5[_0xc9fb('0x2b')]:_0x12453d[_0xc9fb('0x2a')];if(_0x56f1e3[_0xc9fb('0x27')][_0xc9fb('0x3d')]){_0x38ffe5['include']=[{'all':!![]}];}_0x38ffe5=_[_0xc9fb('0x35')]({},_0x38ffe5,_0x56f1e3[_0xc9fb('0x3b')]);return db[_0xc9fb('0x24')][_0xc9fb('0x43')](_0x38ffe5)[_0xc9fb('0x1f')](handleEntityNotFound(_0x430581,null))[_0xc9fb('0x1f')](respondWithResult(_0x430581,null))[_0xc9fb('0x40')](handleError(_0x430581,null));};exports[_0xc9fb('0x44')]=function(_0x5640c0,_0x272aa0){return db[_0xc9fb('0x24')][_0xc9fb('0x44')](_0x5640c0[_0xc9fb('0x45')],{})[_0xc9fb('0x1f')](respondWithResult(_0x272aa0,0xc9))[_0xc9fb('0x40')](handleError(_0x272aa0,null));};exports[_0xc9fb('0x1e')]=function(_0x54d2c5,_0x6e3c40){if(_0x54d2c5[_0xc9fb('0x45')]['id']){delete _0x54d2c5['body']['id'];}return db[_0xc9fb('0x24')]['find']({'where':{'id':_0x54d2c5[_0xc9fb('0x42')]['id']}})[_0xc9fb('0x1f')](handleEntityNotFound(_0x6e3c40,null))['then'](saveUpdates(_0x54d2c5[_0xc9fb('0x45')],null))['then'](respondWithResult(_0x6e3c40,null))[_0xc9fb('0x40')](handleError(_0x6e3c40,null));};exports['destroy']=function(_0x439e96,_0x2fa821){return db['VoiceAgentReport'][_0xc9fb('0x43')]({'where':{'id':_0x439e96[_0xc9fb('0x42')]['id']}})[_0xc9fb('0x1f')](handleEntityNotFound(_0x2fa821,null))[_0xc9fb('0x1f')](removeEntity(_0x2fa821,null))[_0xc9fb('0x40')](handleError(_0x2fa821,null));};exports[_0xc9fb('0x46')]=function(_0x355cf1,_0x4c8d90){return db[_0xc9fb('0x24')]['describe']()[_0xc9fb('0x1f')](respondWithResult(_0x4c8d90,null))[_0xc9fb('0x40')](handleError(_0x4c8d90,null));}; \ No newline at end of file +var _0x6e8f=['fast-json-patch','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','reject','save','then','destroy','error','stack','name','send','VoiceAgentReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x33ac75,_0x4953e3){var _0x34d5f2=function(_0x4c2b4a){while(--_0x4c2b4a){_0x33ac75['push'](_0x33ac75['shift']());}};_0x34d5f2(++_0x4953e3);}(_0x6e8f,0x118));var _0xf6e8=function(_0x3186e9,_0x3f9d10){_0x3186e9=_0x3186e9-0x0;var _0x1ec686=_0x6e8f[_0x3186e9];return _0x1ec686;};'use strict';var pdf=require(_0xf6e8('0x0'));var emlformat=require(_0xf6e8('0x1'));var rimraf=require(_0xf6e8('0x2'));var zipdir=require(_0xf6e8('0x3'));var jsonpatch=require(_0xf6e8('0x4'));var rp=require('request-promise');var moment=require(_0xf6e8('0x5'));var BPromise=require(_0xf6e8('0x6'));var Mustache=require('mustache');var util=require(_0xf6e8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf6e8('0x8'));var ejs=require(_0xf6e8('0x9'));var fs=require('fs');var _=require(_0xf6e8('0xa'));var squel=require(_0xf6e8('0xb'));var crypto=require(_0xf6e8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6e8('0x8'));var querystring=require(_0xf6e8('0xd'));var Papa=require(_0xf6e8('0xe'));var Redis=require(_0xf6e8('0xf'));var authService=require(_0xf6e8('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xf6e8('0x11'));var logger=require(_0xf6e8('0x12'))(_0xf6e8('0x13'));var utils=require(_0xf6e8('0x14'));var config=require(_0xf6e8('0x15'));var db=require(_0xf6e8('0x16'))['db'];function respondWithStatusCode(_0x383dee,_0x564352){_0x564352=_0x564352||0xcc;return function(_0x43c748){if(_0x43c748){return _0x383dee[_0xf6e8('0x17')](_0x564352);}return _0x383dee[_0xf6e8('0x18')](_0x564352)[_0xf6e8('0x19')]();};}function respondWithResult(_0x2e7574,_0x5514b6){_0x5514b6=_0x5514b6||0xc8;return function(_0x4e6b49){if(_0x4e6b49){return _0x2e7574[_0xf6e8('0x18')](_0x5514b6)[_0xf6e8('0x1a')](_0x4e6b49);}};}function respondWithFilteredResult(_0x3e46a4,_0x5db3a0){return function(_0x9c9d30){if(_0x9c9d30){var _0x421bb2=_0x9c9d30['count'],_0x87569c=_0x5db3a0[_0xf6e8('0x1b')],_0xfa6fed=_0x5db3a0[_0xf6e8('0x1b')]+_0x5db3a0['limit'],_0xf87163;if(_0xfa6fed>=_0x421bb2){_0xfa6fed=_0x421bb2;_0xf87163=0xc8;}else{_0xf87163=0xce;}_0x3e46a4[_0xf6e8('0x18')](_0xf87163);return _0x3e46a4['set'](_0xf6e8('0x1c'),_0x87569c+'-'+_0xfa6fed+'/'+_0x421bb2)[_0xf6e8('0x1a')](_0x9c9d30);}return null;};}function patchUpdates(_0x49a49d){return function(_0x459d85){try{jsonpatch['apply'](_0x459d85,_0x49a49d,!![]);}catch(_0x43580c){return BPromise[_0xf6e8('0x1d')](_0x43580c);}return _0x459d85[_0xf6e8('0x1e')]();};}function saveUpdates(_0x12563d,_0x1c3deb){return function(_0x4380ec){if(_0x4380ec){return _0x4380ec['update'](_0x12563d)[_0xf6e8('0x1f')](function(_0x4f37d1){return _0x4f37d1;});}return null;};}function removeEntity(_0x243b08,_0x47605c){return function(_0x29902c){if(_0x29902c){return _0x29902c[_0xf6e8('0x20')]()[_0xf6e8('0x1f')](function(){_0x243b08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3d5b0,_0x264f17){return function(_0xb6f038){if(!_0xb6f038){_0xd3d5b0[_0xf6e8('0x17')](0x194);}return _0xb6f038;};}function handleError(_0x21aed4,_0xbc6aa5){_0xbc6aa5=_0xbc6aa5||0x1f4;return function(_0x3a3732){logger[_0xf6e8('0x21')](_0x3a3732[_0xf6e8('0x22')]);if(_0x3a3732[_0xf6e8('0x23')]){delete _0x3a3732[_0xf6e8('0x23')];}_0x21aed4[_0xf6e8('0x18')](_0xbc6aa5)[_0xf6e8('0x24')](_0x3a3732);};}exports['index']=function(_0x140614,_0x281959){var _0x3f4ee7={},_0x1dae41={},_0x178002={'count':0x0,'rows':[]};var _0x56ee9a=db[_0xf6e8('0x25')][_0xf6e8('0x26')];_0x1dae41[_0xf6e8('0x27')]=_['keys'](_0x56ee9a);_0x1dae41[_0xf6e8('0x28')]=_[_0xf6e8('0x29')](_0x140614['query']);_0x1dae41[_0xf6e8('0x2a')]=_[_0xf6e8('0x2b')](_0x1dae41[_0xf6e8('0x27')],_0x1dae41[_0xf6e8('0x28')]);_0x3f4ee7[_0xf6e8('0x2c')]=_[_0xf6e8('0x2b')](_0x1dae41['model'],qs[_0xf6e8('0x2d')](_0x140614[_0xf6e8('0x28')][_0xf6e8('0x2d')]));_0x3f4ee7[_0xf6e8('0x2c')]=_0x3f4ee7[_0xf6e8('0x2c')][_0xf6e8('0x2e')]?_0x3f4ee7[_0xf6e8('0x2c')]:_0x1dae41[_0xf6e8('0x27')];if(!_0x140614['query'][_0xf6e8('0x2f')](_0xf6e8('0x30'))){_0x3f4ee7[_0xf6e8('0x31')]=qs[_0xf6e8('0x31')](_0x140614[_0xf6e8('0x28')]['limit']);_0x3f4ee7[_0xf6e8('0x1b')]=qs[_0xf6e8('0x1b')](_0x140614[_0xf6e8('0x28')][_0xf6e8('0x1b')]);}_0x3f4ee7['order']=qs[_0xf6e8('0x32')](_0x140614['query'][_0xf6e8('0x32')]);_0x3f4ee7[_0xf6e8('0x33')]=qs[_0xf6e8('0x2a')](_['pick'](_0x140614[_0xf6e8('0x28')],_0x1dae41[_0xf6e8('0x2a')]));if(_0x140614['query'][_0xf6e8('0x34')]){_0x3f4ee7['where']=_[_0xf6e8('0x35')](_0x3f4ee7[_0xf6e8('0x33')],{'$or':_['map'](_0x56ee9a,function(_0x12b51a){if(_0x12b51a[_0xf6e8('0x36')][_0xf6e8('0x37')]!==_0xf6e8('0x38')){var _0x48a50d={};_0x48a50d[_0x12b51a[_0xf6e8('0x39')]]={'$like':'%'+_0x140614['query'][_0xf6e8('0x34')]+'%'};return _0x48a50d;}})});}_0x3f4ee7=_['merge']({},_0x3f4ee7,_0x140614[_0xf6e8('0x3a')]);var _0x1b73f9={'where':_0x3f4ee7['where']};return db[_0xf6e8('0x25')][_0xf6e8('0x3b')](_0x1b73f9)[_0xf6e8('0x1f')](function(_0x4510e9){_0x178002[_0xf6e8('0x3b')]=_0x4510e9;if(_0x140614[_0xf6e8('0x28')][_0xf6e8('0x3c')]){_0x3f4ee7[_0xf6e8('0x3d')]=[{'all':!![]}];}return db[_0xf6e8('0x25')][_0xf6e8('0x3e')](_0x3f4ee7);})[_0xf6e8('0x1f')](function(_0x5a057c){_0x178002[_0xf6e8('0x3f')]=_0x5a057c;return _0x178002;})[_0xf6e8('0x1f')](respondWithFilteredResult(_0x281959,_0x3f4ee7))['catch'](handleError(_0x281959,null));};exports[_0xf6e8('0x40')]=function(_0x421bef,_0x30d75a){var _0x11ee51={'raw':![],'where':{'id':_0x421bef[_0xf6e8('0x41')]['id']}},_0xa3cfbc={};_0xa3cfbc[_0xf6e8('0x27')]=_[_0xf6e8('0x29')](db[_0xf6e8('0x25')][_0xf6e8('0x26')]);_0xa3cfbc['query']=_['keys'](_0x421bef[_0xf6e8('0x28')]);_0xa3cfbc[_0xf6e8('0x2a')]=_[_0xf6e8('0x2b')](_0xa3cfbc[_0xf6e8('0x27')],_0xa3cfbc[_0xf6e8('0x28')]);_0x11ee51[_0xf6e8('0x2c')]=_['intersection'](_0xa3cfbc[_0xf6e8('0x27')],qs['fields'](_0x421bef['query'][_0xf6e8('0x2d')]));_0x11ee51[_0xf6e8('0x2c')]=_0x11ee51[_0xf6e8('0x2c')][_0xf6e8('0x2e')]?_0x11ee51[_0xf6e8('0x2c')]:_0xa3cfbc[_0xf6e8('0x27')];if(_0x421bef[_0xf6e8('0x28')][_0xf6e8('0x3c')]){_0x11ee51[_0xf6e8('0x3d')]=[{'all':!![]}];}_0x11ee51=_[_0xf6e8('0x35')]({},_0x11ee51,_0x421bef[_0xf6e8('0x3a')]);return db[_0xf6e8('0x25')][_0xf6e8('0x42')](_0x11ee51)[_0xf6e8('0x1f')](handleEntityNotFound(_0x30d75a,null))[_0xf6e8('0x1f')](respondWithResult(_0x30d75a,null))[_0xf6e8('0x43')](handleError(_0x30d75a,null));};exports[_0xf6e8('0x44')]=function(_0x50d817,_0x4cc641){return db[_0xf6e8('0x25')][_0xf6e8('0x44')](_0x50d817[_0xf6e8('0x45')],{})[_0xf6e8('0x1f')](respondWithResult(_0x4cc641,0xc9))[_0xf6e8('0x43')](handleError(_0x4cc641,null));};exports[_0xf6e8('0x46')]=function(_0x40fca2,_0x500c15){if(_0x40fca2[_0xf6e8('0x45')]['id']){delete _0x40fca2['body']['id'];}return db['VoiceAgentReport'][_0xf6e8('0x42')]({'where':{'id':_0x40fca2[_0xf6e8('0x41')]['id']}})[_0xf6e8('0x1f')](handleEntityNotFound(_0x500c15,null))['then'](saveUpdates(_0x40fca2[_0xf6e8('0x45')],null))[_0xf6e8('0x1f')](respondWithResult(_0x500c15,null))[_0xf6e8('0x43')](handleError(_0x500c15,null));};exports[_0xf6e8('0x20')]=function(_0x61f3e3,_0x232cf7){return db[_0xf6e8('0x25')][_0xf6e8('0x42')]({'where':{'id':_0x61f3e3[_0xf6e8('0x41')]['id']}})[_0xf6e8('0x1f')](handleEntityNotFound(_0x232cf7,null))[_0xf6e8('0x1f')](removeEntity(_0x232cf7,null))['catch'](handleError(_0x232cf7,null));};exports['describe']=function(_0x31fa90,_0x51c683){return db[_0xf6e8('0x25')]['describe']()[_0xf6e8('0x1f')](respondWithResult(_0x51c683,null))[_0xf6e8('0x43')](handleError(_0x51c683,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 164b330..3248038 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 _0x2937=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','VoiceAgentReport','report_agent','uniqueid'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x2937,0xb4));var _0x7293=function(_0x2c3c95,_0x55ef0e){_0x2c3c95=_0x2c3c95-0x0;var _0x4be9f4=_0x2937[_0x2c3c95];return _0x4be9f4;};'use strict';var _=require(_0x7293('0x0'));var util=require('util');var logger=require(_0x7293('0x1'))(_0x7293('0x2'));var moment=require(_0x7293('0x3'));var BPromise=require(_0x7293('0x4'));var rp=require(_0x7293('0x5'));var fs=require('fs');var path=require(_0x7293('0x6'));var rimraf=require('rimraf');var config=require(_0x7293('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0x7293('0x8')]=function(_0x3ae37b,_0x3f21db){return _0x3ae37b['define'](_0x7293('0x9'),attributes,{'tableName':_0x7293('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7293('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c72=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x43b26d,_0x2731f9){var _0x57881d=function(_0x93be97){while(--_0x93be97){_0x43b26d['push'](_0x43b26d['shift']());}};_0x57881d(++_0x2731f9);}(_0x5c72,0x18f));var _0x25c7=function(_0x57b909,_0x3587ad){_0x57b909=_0x57b909-0x0;var _0xb4405=_0x5c72[_0x57b909];return _0xb4405;};'use strict';var _=require(_0x25c7('0x0'));var util=require(_0x25c7('0x1'));var logger=require(_0x25c7('0x2'))(_0x25c7('0x3'));var moment=require('moment');var BPromise=require(_0x25c7('0x4'));var rp=require(_0x25c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25c7('0x6'));var config=require(_0x25c7('0x7'));var attributes=require(_0x25c7('0x8'));module[_0x25c7('0x9')]=function(_0x57015b,_0x74b71e){return _0x57015b[_0x25c7('0xa')](_0x25c7('0xb'),attributes,{'tableName':_0x25c7('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x25c7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 996a393..1232532 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 _0x2964=['create','body','options','raw','CreateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','message','error','result','catch'];(function(_0x55657d,_0x46e278){var _0x4a8f69=function(_0x375222){while(--_0x375222){_0x55657d['push'](_0x55657d['shift']());}};_0x4a8f69(++_0x46e278);}(_0x2964,0x9b));var _0x4296=function(_0x169268,_0x15fc54){_0x169268=_0x169268-0x0;var _0x478da2=_0x2964[_0x169268];return _0x478da2;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var moment=require(_0x4296('0x2'));var BPromise=require(_0x4296('0x3'));var rs=require(_0x4296('0x4'));var fs=require('fs');var Redis=require(_0x4296('0x5'));var db=require(_0x4296('0x6'))['db'];var utils=require(_0x4296('0x7'));var logger=require(_0x4296('0x8'))(_0x4296('0x9'));var config=require(_0x4296('0xa'));var jayson=require(_0x4296('0xb'));var client=jayson[_0x4296('0xc')][_0x4296('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x58d9a4,_0x15678,_0x27c74d){return new BPromise(function(_0xad7e59,_0x50e9a9){return client[_0x4296('0xe')](_0x58d9a4,_0x27c74d)[_0x4296('0xf')](function(_0x324ee3){logger[_0x4296('0x10')](_0x4296('0x11'),_0x15678,'request\x20sent');logger[_0x4296('0x12')](_0x4296('0x13'),_0x15678,_0x4296('0x14'),JSON['stringify'](_0x324ee3));if(_0x324ee3['error']){if(_0x324ee3['error']['code']===0x1f4){logger['error'](_0x4296('0x11'),_0x15678,_0x324ee3['error'][_0x4296('0x15')]);return _0x50e9a9(_0x324ee3[_0x4296('0x16')][_0x4296('0x15')]);}logger[_0x4296('0x16')]('VoiceAgentReport,\x20%s,\x20%s',_0x15678,_0x324ee3['error']['message']);return _0xad7e59(_0x324ee3['error'][_0x4296('0x15')]);}else{logger[_0x4296('0x10')](_0x4296('0x11'),_0x15678,'request\x20sent');_0xad7e59(_0x324ee3[_0x4296('0x17')]['message']);}})[_0x4296('0x18')](function(_0x14db92){logger[_0x4296('0x16')](_0x4296('0x11'),_0x15678,_0x14db92);_0x50e9a9(_0x14db92);});});}exports['CreateVoiceAgentReport']=function(_0x4a239d){var _0x2d1f16=this;return new Promise(function(_0x5b738b,_0x228831){return db['VoiceAgentReport'][_0x4296('0x19')](_0x4a239d[_0x4296('0x1a')],{'raw':_0x4a239d['options']?_0x4a239d[_0x4296('0x1b')][_0x4296('0x1c')]===undefined?!![]:![]:!![]})[_0x4296('0xf')](function(_0x360269){logger[_0x4296('0x10')](_0x4296('0x1d'),_0x4a239d);logger[_0x4296('0x12')](_0x4296('0x1d'),_0x4a239d,JSON['stringify'](_0x360269));_0x5b738b(_0x360269);})[_0x4296('0x18')](function(_0x2b95ad){logger['error'](_0x4296('0x1d'),_0x2b95ad['message'],_0x4a239d);_0x228831(_0x2d1f16[_0x4296('0x16')](0x1f4,_0x2b95ad['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x929d55){var _0x44c252=this;return new Promise(function(_0x263085,_0x452aeb){return db[_0x4296('0x1e')][_0x4296('0x1f')](_0x929d55[_0x4296('0x1a')],{'raw':_0x929d55[_0x4296('0x1b')]?_0x929d55[_0x4296('0x1b')][_0x4296('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x929d55['options']?_0x929d55[_0x4296('0x1b')][_0x4296('0x20')]||null:null,'attributes':_0x929d55[_0x4296('0x1b')]?_0x929d55[_0x4296('0x1b')][_0x4296('0x21')]||null:null,'limit':_0x929d55[_0x4296('0x1b')]?_0x929d55['options'][_0x4296('0x22')]||null:null})['then'](function(_0x324705){logger[_0x4296('0x10')](_0x4296('0x23'),_0x929d55);logger[_0x4296('0x12')](_0x4296('0x23'),_0x929d55,JSON['stringify'](_0x324705));_0x263085(_0x324705);})[_0x4296('0x18')](function(_0x4f42f5){logger[_0x4296('0x16')]('UpdateVoiceAgentReport',_0x4f42f5['message'],_0x929d55);_0x452aeb(_0x44c252['error'](0x1f4,_0x4f42f5[_0x4296('0x15')]));});});}; \ No newline at end of file +var _0x46e7=['../../config/environment','client','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','VoiceAgentReport','create','options','then','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x5db8b0,_0x524939){var _0x198782=function(_0x101b94){while(--_0x101b94){_0x5db8b0['push'](_0x5db8b0['shift']());}};_0x198782(++_0x524939);}(_0x46e7,0xbf));var _0x746e=function(_0x3a0fa7,_0x5ad20f){_0x3a0fa7=_0x3a0fa7-0x0;var _0x40dcbc=_0x46e7[_0x3a0fa7];return _0x40dcbc;};'use strict';var _=require(_0x746e('0x0'));var util=require(_0x746e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x746e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x746e('0x3'))['db'];var utils=require(_0x746e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x746e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x746e('0x6')][_0x746e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8a3a77,_0x5bd7b4,_0x1d0de3){return new BPromise(function(_0x565411,_0x4e9590){return client['request'](_0x8a3a77,_0x1d0de3)['then'](function(_0x495e27){logger[_0x746e('0x8')](_0x746e('0x9'),_0x5bd7b4,_0x746e('0xa'));logger[_0x746e('0xb')](_0x746e('0xc'),_0x5bd7b4,_0x746e('0xa'),JSON['stringify'](_0x495e27));if(_0x495e27['error']){if(_0x495e27[_0x746e('0xd')]['code']===0x1f4){logger[_0x746e('0xd')](_0x746e('0x9'),_0x5bd7b4,_0x495e27[_0x746e('0xd')]['message']);return _0x4e9590(_0x495e27[_0x746e('0xd')][_0x746e('0xe')]);}logger[_0x746e('0xd')](_0x746e('0x9'),_0x5bd7b4,_0x495e27[_0x746e('0xd')][_0x746e('0xe')]);return _0x565411(_0x495e27[_0x746e('0xd')][_0x746e('0xe')]);}else{logger[_0x746e('0x8')](_0x746e('0x9'),_0x5bd7b4,_0x746e('0xa'));_0x565411(_0x495e27[_0x746e('0xf')][_0x746e('0xe')]);}})['catch'](function(_0x30c6f2){logger[_0x746e('0xd')](_0x746e('0x9'),_0x5bd7b4,_0x30c6f2);_0x4e9590(_0x30c6f2);});});}exports['CreateVoiceAgentReport']=function(_0x16f5ba){var _0x137e42=this;return new Promise(function(_0x3c1c76,_0x54d495){return db[_0x746e('0x10')][_0x746e('0x11')](_0x16f5ba['body'],{'raw':_0x16f5ba[_0x746e('0x12')]?_0x16f5ba['options']['raw']===undefined?!![]:![]:!![]})[_0x746e('0x13')](function(_0x257e19){logger['info'](_0x746e('0x14'),_0x16f5ba);logger[_0x746e('0xb')](_0x746e('0x14'),_0x16f5ba,JSON['stringify'](_0x257e19));_0x3c1c76(_0x257e19);})[_0x746e('0x15')](function(_0x5c7ce6){logger[_0x746e('0xd')]('CreateVoiceAgentReport',_0x5c7ce6[_0x746e('0xe')],_0x16f5ba);_0x54d495(_0x137e42[_0x746e('0xd')](0x1f4,_0x5c7ce6['message']));});});};exports[_0x746e('0x16')]=function(_0x1e59be){var _0x17d1b0=this;return new Promise(function(_0x51ca13,_0x4359cd){return db[_0x746e('0x10')][_0x746e('0x17')](_0x1e59be[_0x746e('0x18')],{'raw':_0x1e59be[_0x746e('0x12')]?_0x1e59be[_0x746e('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e59be[_0x746e('0x12')]?_0x1e59be[_0x746e('0x12')][_0x746e('0x19')]||null:null,'attributes':_0x1e59be[_0x746e('0x12')]?_0x1e59be[_0x746e('0x12')][_0x746e('0x1a')]||null:null,'limit':_0x1e59be['options']?_0x1e59be[_0x746e('0x12')][_0x746e('0x1b')]||null:null})['then'](function(_0x51887b){logger[_0x746e('0x8')](_0x746e('0x16'),_0x1e59be);logger[_0x746e('0xb')](_0x746e('0x16'),_0x1e59be,JSON['stringify'](_0x51887b));_0x51ca13(_0x51887b);})[_0x746e('0x15')](function(_0x273d55){logger['error'](_0x746e('0x16'),_0x273d55[_0x746e('0xe')],_0x1e59be);_0x4359cd(_0x17d1b0[_0x746e('0xd')](0x1f4,_0x273d55[_0x746e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 122e814..958b153 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 _0x881d=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','connect-timeout'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x881d,0x9f));var _0xd881=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x881d[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd881('0x0'));var express=require('express');var router=express[_0xd881('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xd881('0x2'));var config=require(_0xd881('0x3'));var controller=require('./voiceCallReport.controller');router[_0xd881('0x4')]('/',auth[_0xd881('0x5')](),controller[_0xd881('0x6')]);router[_0xd881('0x4')](_0xd881('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xd881('0x4')](_0xd881('0x8'),auth['isAuthenticated'](),controller[_0xd881('0x9')]);router[_0xd881('0xa')]('/',auth['isAuthenticated'](),controller[_0xd881('0xb')]);router[_0xd881('0xc')]('/:id',auth[_0xd881('0x5')](),controller['update']);router[_0xd881('0xd')](_0xd881('0x8'),auth[_0xd881('0x5')](),controller[_0xd881('0xe')]);module[_0xd881('0xf')]=router; \ No newline at end of file +var _0xe98e=['../../config/environment','./voiceCallReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe98e,0x9c));var _0xee98=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe98e[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xee98('0x0'));var util=require(_0xee98('0x1'));var path=require('path');var timeout=require(_0xee98('0x2'));var express=require('express');var router=express[_0xee98('0x3')]();var auth=require(_0xee98('0x4'));var interaction=require(_0xee98('0x5'));var config=require(_0xee98('0x6'));var controller=require(_0xee98('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xee98('0x8')]);router[_0xee98('0x9')](_0xee98('0xa'),auth['isAuthenticated'](),controller[_0xee98('0xb')]);router[_0xee98('0x9')](_0xee98('0xc'),auth[_0xee98('0xd')](),controller[_0xee98('0xe')]);router[_0xee98('0xf')]('/',auth[_0xee98('0xd')](),controller['create']);router['put'](_0xee98('0xc'),auth['isAuthenticated'](),controller[_0xee98('0x10')]);router[_0xee98('0x11')]('/:id',auth[_0xee98('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6afdf1a..cde5f77 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(_0x24723c,_0x3b5cc0){var _0x46e3a7=function(_0xa5c9bb){while(--_0xa5c9bb){_0x24723c['push'](_0x24723c['shift']());}};_0x46e3a7(++_0x3b5cc0);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 1de0aa7..c27eaea 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 _0xe155=['../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','VoiceCallReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL','field','filter','options','includeAll','include','fullname','User','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x3944cc,_0x145416){var _0x321e7c=function(_0x555533){while(--_0x555533){_0x3944cc['push'](_0x3944cc['shift']());}};_0x321e7c(++_0x145416);}(_0xe155,0x1c9));var _0x5e15=function(_0x155c5c,_0x4af08c){_0x155c5c=_0x155c5c-0x0;var _0x10f6cd=_0xe155[_0x155c5c];return _0x10f6cd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5e15('0x0'));var zipdir=require(_0x5e15('0x1'));var jsonpatch=require(_0x5e15('0x2'));var rp=require('request-promise');var moment=require(_0x5e15('0x3'));var BPromise=require(_0x5e15('0x4'));var Mustache=require(_0x5e15('0x5'));var util=require(_0x5e15('0x6'));var path=require('path');var sox=require(_0x5e15('0x7'));var csv=require(_0x5e15('0x8'));var ejs=require(_0x5e15('0x9'));var fs=require('fs');var _=require(_0x5e15('0xa'));var squel=require(_0x5e15('0xb'));var crypto=require(_0x5e15('0xc'));var jsforce=require(_0x5e15('0xd'));var deskjs=require(_0x5e15('0xe'));var toCsv=require(_0x5e15('0x8'));var querystring=require(_0x5e15('0xf'));var Papa=require(_0x5e15('0x10'));var Redis=require(_0x5e15('0x11'));var authService=require(_0x5e15('0x12'));var qs=require(_0x5e15('0x13'));var hardwareService=require(_0x5e15('0x14'));var logger=require(_0x5e15('0x15'))(_0x5e15('0x16'));var utils=require(_0x5e15('0x17'));var config=require('../../config/environment');var db=require(_0x5e15('0x18'))['db'];function respondWithStatusCode(_0x59d620,_0x16557f){_0x16557f=_0x16557f||0xcc;return function(_0x2b8104){if(_0x2b8104){return _0x59d620[_0x5e15('0x19')](_0x16557f);}return _0x59d620[_0x5e15('0x1a')](_0x16557f)[_0x5e15('0x1b')]();};}function respondWithResult(_0x11960b,_0x17c0d8){_0x17c0d8=_0x17c0d8||0xc8;return function(_0x720e73){if(_0x720e73){return _0x11960b['status'](_0x17c0d8)['json'](_0x720e73);}};}function respondWithFilteredResult(_0x206876,_0x29d344){return function(_0xaebb0a){if(_0xaebb0a){var _0x4ce842=_0xaebb0a[_0x5e15('0x1c')],_0x5ebb39=_0x29d344[_0x5e15('0x1d')],_0x303d8e=_0x29d344[_0x5e15('0x1d')]+_0x29d344[_0x5e15('0x1e')],_0x57db;if(_0x303d8e>=_0x4ce842){_0x303d8e=_0x4ce842;_0x57db=0xc8;}else{_0x57db=0xce;}_0x206876[_0x5e15('0x1a')](_0x57db);return _0x206876[_0x5e15('0x1f')](_0x5e15('0x20'),_0x5ebb39+'-'+_0x303d8e+'/'+_0x4ce842)[_0x5e15('0x21')](_0xaebb0a);}return null;};}function patchUpdates(_0x464f91){return function(_0x43b3e6){try{jsonpatch[_0x5e15('0x22')](_0x43b3e6,_0x464f91,!![]);}catch(_0x2d44cd){return BPromise[_0x5e15('0x23')](_0x2d44cd);}return _0x43b3e6['save']();};}function saveUpdates(_0xdc3e50,_0x31a8d1){return function(_0x5082f5){if(_0x5082f5){return _0x5082f5[_0x5e15('0x24')](_0xdc3e50)[_0x5e15('0x25')](function(_0x3a6df7){return _0x3a6df7;});}return null;};}function removeEntity(_0x302a36,_0x3b53c9){return function(_0x52584c){if(_0x52584c){return _0x52584c[_0x5e15('0x26')]()[_0x5e15('0x25')](function(){_0x302a36[_0x5e15('0x1a')](0xcc)[_0x5e15('0x1b')]();});}};}function handleEntityNotFound(_0x1237f9,_0x5cc3f2){return function(_0x4b8160){if(!_0x4b8160){_0x1237f9['sendStatus'](0x194);}return _0x4b8160;};}function handleError(_0x1827dd,_0x77e3b3){_0x77e3b3=_0x77e3b3||0x1f4;return function(_0x422ef6){logger[_0x5e15('0x27')](_0x422ef6[_0x5e15('0x28')]);if(_0x422ef6['name']){delete _0x422ef6[_0x5e15('0x29')];}_0x1827dd['status'](_0x77e3b3)[_0x5e15('0x2a')](_0x422ef6);};}exports[_0x5e15('0x2b')]=function(_0x4176bf,_0x580bf3){var _0x2c2d54={},_0x5c0ab4={},_0x5931fa={'count':0x0,'rows':[]};var _0x44c7aa=db[_0x5e15('0x2c')][_0x5e15('0x2d')];_0x5c0ab4[_0x5e15('0x2e')]=_[_0x5e15('0x2f')](_0x44c7aa);_0x5c0ab4[_0x5e15('0x30')]=_[_0x5e15('0x2f')](_0x4176bf[_0x5e15('0x30')]);_0x5c0ab4[_0x5e15('0x31')]=_[_0x5e15('0x32')](_0x5c0ab4['model'],_0x5c0ab4[_0x5e15('0x30')]);_0x2c2d54[_0x5e15('0x33')]=_[_0x5e15('0x32')](_0x5c0ab4[_0x5e15('0x2e')],qs[_0x5e15('0x34')](_0x4176bf[_0x5e15('0x30')][_0x5e15('0x34')]));_0x2c2d54['attributes']=_0x2c2d54[_0x5e15('0x33')][_0x5e15('0x35')]?_0x2c2d54[_0x5e15('0x33')]:_0x5c0ab4[_0x5e15('0x2e')];if(!_0x4176bf[_0x5e15('0x30')]['hasOwnProperty'](_0x5e15('0x36'))){_0x2c2d54[_0x5e15('0x1e')]=qs[_0x5e15('0x1e')](_0x4176bf[_0x5e15('0x30')][_0x5e15('0x1e')]);_0x2c2d54[_0x5e15('0x1d')]=qs[_0x5e15('0x1d')](_0x4176bf[_0x5e15('0x30')]['offset']);}_0x2c2d54[_0x5e15('0x37')]=qs[_0x5e15('0x38')](_0x4176bf[_0x5e15('0x30')][_0x5e15('0x38')]);_0x2c2d54[_0x5e15('0x39')]=qs[_0x5e15('0x31')](_[_0x5e15('0x3a')](_0x4176bf[_0x5e15('0x30')],_0x5c0ab4[_0x5e15('0x31')]));if(_0x4176bf['query']['filter']){_0x2c2d54[_0x5e15('0x39')]=_[_0x5e15('0x3b')](_0x2c2d54[_0x5e15('0x39')],{'$or':_[_0x5e15('0x3c')](_0x44c7aa,function(_0x3c31aa){if(_0x3c31aa['type']['key']!==_0x5e15('0x3d')){var _0x44d7f2={};_0x44d7f2[_0x3c31aa[_0x5e15('0x3e')]]={'$like':'%'+_0x4176bf[_0x5e15('0x30')][_0x5e15('0x3f')]+'%'};return _0x44d7f2;}})});}_0x2c2d54=_[_0x5e15('0x3b')]({},_0x2c2d54,_0x4176bf[_0x5e15('0x40')]);var _0x575805={'where':_0x2c2d54['where']};return db[_0x5e15('0x2c')][_0x5e15('0x1c')](_0x575805)[_0x5e15('0x25')](function(_0x363901){_0x5931fa[_0x5e15('0x1c')]=_0x363901;if(_0x4176bf[_0x5e15('0x30')][_0x5e15('0x41')]){_0x2c2d54[_0x5e15('0x42')]=[{'attributes':['id','name',_0x5e15('0x43'),'alias'],'model':db[_0x5e15('0x44')],'as':_0x5e15('0x44')}];}return db[_0x5e15('0x2c')][_0x5e15('0x45')](_0x2c2d54);})[_0x5e15('0x25')](function(_0x3e4234){_0x5931fa[_0x5e15('0x46')]=_0x3e4234;return _0x5931fa;})[_0x5e15('0x25')](respondWithFilteredResult(_0x580bf3,_0x2c2d54))[_0x5e15('0x47')](handleError(_0x580bf3,null));};exports[_0x5e15('0x48')]=function(_0x1a0e37,_0x398d10){var _0x376560={'raw':!![],'where':{'id':_0x1a0e37[_0x5e15('0x49')]['id']}},_0x54e740={};_0x54e740[_0x5e15('0x2e')]=_[_0x5e15('0x2f')](db[_0x5e15('0x2c')][_0x5e15('0x2d')]);_0x54e740[_0x5e15('0x30')]=_['keys'](_0x1a0e37[_0x5e15('0x30')]);_0x54e740[_0x5e15('0x31')]=_['intersection'](_0x54e740[_0x5e15('0x2e')],_0x54e740['query']);_0x376560[_0x5e15('0x33')]=_[_0x5e15('0x32')](_0x54e740[_0x5e15('0x2e')],qs['fields'](_0x1a0e37[_0x5e15('0x30')][_0x5e15('0x34')]));_0x376560[_0x5e15('0x33')]=_0x376560['attributes'][_0x5e15('0x35')]?_0x376560[_0x5e15('0x33')]:_0x54e740[_0x5e15('0x2e')];if(_0x1a0e37[_0x5e15('0x30')][_0x5e15('0x41')]){_0x376560[_0x5e15('0x42')]=[{'all':!![]}];}_0x376560=_[_0x5e15('0x3b')]({},_0x376560,_0x1a0e37[_0x5e15('0x40')]);return db[_0x5e15('0x2c')][_0x5e15('0x4a')](_0x376560)[_0x5e15('0x25')](handleEntityNotFound(_0x398d10,null))[_0x5e15('0x25')](respondWithResult(_0x398d10,null))[_0x5e15('0x47')](handleError(_0x398d10,null));};exports[_0x5e15('0x4b')]=function(_0x20b69e,_0x208a38){return db[_0x5e15('0x2c')][_0x5e15('0x4b')](_0x20b69e[_0x5e15('0x4c')],{})[_0x5e15('0x25')](respondWithResult(_0x208a38,0xc9))[_0x5e15('0x47')](handleError(_0x208a38,null));};exports[_0x5e15('0x26')]=function(_0xbecbbc,_0x4d5dce){return db[_0x5e15('0x2c')]['find']({'where':{'id':_0xbecbbc[_0x5e15('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d5dce,null))[_0x5e15('0x25')](removeEntity(_0x4d5dce,null))[_0x5e15('0x47')](handleError(_0x4d5dce,null));};exports[_0x5e15('0x4d')]=function(_0x14f644,_0x5b5c60){return db[_0x5e15('0x2c')][_0x5e15('0x4d')]()[_0x5e15('0x25')](respondWithResult(_0x5b5c60,null))[_0x5e15('0x47')](handleError(_0x5b5c60,null));};exports[_0x5e15('0x24')]=function(_0x41bf2b,_0x14411a){if(_0x41bf2b[_0x5e15('0x4c')][_0x5e15('0x4e')]){delete _0x41bf2b[_0x5e15('0x4c')][_0x5e15('0x4e')];}return db[_0x5e15('0x2c')]['find']({'where':{'uniqueid':_0x41bf2b[_0x5e15('0x49')]['id'],'UserId':{'$or':[null,_0x41bf2b[_0x5e15('0x4f')]['id']]}}})['then'](handleEntityNotFound(_0x14411a,null))['then'](saveUpdates(_0x41bf2b[_0x5e15('0x4c')],null))['then'](respondWithResult(_0x14411a,null))['catch'](handleError(_0x14411a,null));}; \ No newline at end of file +var _0x652b=['create','body','describe','update','uniqueid','user','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','save','then','destroy','end','error','stack','name','send','index','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','map','type','key','VIRTUAL','field','filter','merge','options','VoiceCallReport','include','fullname','alias','findAll','rows','show','params','find','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x652b,0x9c));var _0xb652=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x652b[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb652('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb652('0x1'));var moment=require(_0xb652('0x2'));var BPromise=require(_0xb652('0x3'));var Mustache=require(_0xb652('0x4'));var util=require(_0xb652('0x5'));var path=require(_0xb652('0x6'));var sox=require(_0xb652('0x7'));var csv=require(_0xb652('0x8'));var ejs=require(_0xb652('0x9'));var fs=require('fs');var _=require(_0xb652('0xa'));var squel=require(_0xb652('0xb'));var crypto=require(_0xb652('0xc'));var jsforce=require(_0xb652('0xd'));var deskjs=require(_0xb652('0xe'));var toCsv=require(_0xb652('0x8'));var querystring=require(_0xb652('0xf'));var Papa=require(_0xb652('0x10'));var Redis=require(_0xb652('0x11'));var authService=require(_0xb652('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb652('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb652('0x14'));var db=require(_0xb652('0x15'))['db'];function respondWithStatusCode(_0x248a1b,_0xd40fee){_0xd40fee=_0xd40fee||0xcc;return function(_0x57fa5b){if(_0x57fa5b){return _0x248a1b[_0xb652('0x16')](_0xd40fee);}return _0x248a1b[_0xb652('0x17')](_0xd40fee)['end']();};}function respondWithResult(_0x31a2e4,_0x31c1ad){_0x31c1ad=_0x31c1ad||0xc8;return function(_0x33f35e){if(_0x33f35e){return _0x31a2e4[_0xb652('0x17')](_0x31c1ad)['json'](_0x33f35e);}};}function respondWithFilteredResult(_0x4c71d9,_0x40ad8f){return function(_0x525fd2){if(_0x525fd2){var _0x596513=_0x525fd2[_0xb652('0x18')],_0x9a2daf=_0x40ad8f[_0xb652('0x19')],_0x38155b=_0x40ad8f[_0xb652('0x19')]+_0x40ad8f[_0xb652('0x1a')],_0x50bb7e;if(_0x38155b>=_0x596513){_0x38155b=_0x596513;_0x50bb7e=0xc8;}else{_0x50bb7e=0xce;}_0x4c71d9[_0xb652('0x17')](_0x50bb7e);return _0x4c71d9[_0xb652('0x1b')]('Content-Range',_0x9a2daf+'-'+_0x38155b+'/'+_0x596513)[_0xb652('0x1c')](_0x525fd2);}return null;};}function patchUpdates(_0x1814c3){return function(_0x27edcc){try{jsonpatch['apply'](_0x27edcc,_0x1814c3,!![]);}catch(_0x36bfe8){return BPromise['reject'](_0x36bfe8);}return _0x27edcc[_0xb652('0x1d')]();};}function saveUpdates(_0x20824e,_0xf1b73d){return function(_0x1cc8c5){if(_0x1cc8c5){return _0x1cc8c5['update'](_0x20824e)[_0xb652('0x1e')](function(_0x320017){return _0x320017;});}return null;};}function removeEntity(_0x25b68e,_0x88b6e){return function(_0x9622a2){if(_0x9622a2){return _0x9622a2[_0xb652('0x1f')]()['then'](function(){_0x25b68e['status'](0xcc)[_0xb652('0x20')]();});}};}function handleEntityNotFound(_0x4cd853,_0x5f276c){return function(_0x4c192d){if(!_0x4c192d){_0x4cd853[_0xb652('0x16')](0x194);}return _0x4c192d;};}function handleError(_0x44f7ac,_0x451ffe){_0x451ffe=_0x451ffe||0x1f4;return function(_0x190246){logger[_0xb652('0x21')](_0x190246[_0xb652('0x22')]);if(_0x190246[_0xb652('0x23')]){delete _0x190246[_0xb652('0x23')];}_0x44f7ac[_0xb652('0x17')](_0x451ffe)[_0xb652('0x24')](_0x190246);};}exports[_0xb652('0x25')]=function(_0x4014a0,_0xb7ec44){var _0x5ac57f={},_0x42eba2={},_0x4a1dfb={'count':0x0,'rows':[]};var _0xf894cb=db['VoiceCallReport'][_0xb652('0x26')];_0x42eba2[_0xb652('0x27')]=_['keys'](_0xf894cb);_0x42eba2['query']=_[_0xb652('0x28')](_0x4014a0[_0xb652('0x29')]);_0x42eba2[_0xb652('0x2a')]=_['intersection'](_0x42eba2[_0xb652('0x27')],_0x42eba2[_0xb652('0x29')]);_0x5ac57f[_0xb652('0x2b')]=_[_0xb652('0x2c')](_0x42eba2[_0xb652('0x27')],qs['fields'](_0x4014a0[_0xb652('0x29')][_0xb652('0x2d')]));_0x5ac57f[_0xb652('0x2b')]=_0x5ac57f[_0xb652('0x2b')][_0xb652('0x2e')]?_0x5ac57f['attributes']:_0x42eba2[_0xb652('0x27')];if(!_0x4014a0[_0xb652('0x29')]['hasOwnProperty'](_0xb652('0x2f'))){_0x5ac57f[_0xb652('0x1a')]=qs[_0xb652('0x1a')](_0x4014a0[_0xb652('0x29')]['limit']);_0x5ac57f[_0xb652('0x19')]=qs[_0xb652('0x19')](_0x4014a0[_0xb652('0x29')][_0xb652('0x19')]);}_0x5ac57f['order']=qs[_0xb652('0x30')](_0x4014a0['query'][_0xb652('0x30')]);_0x5ac57f[_0xb652('0x31')]=qs[_0xb652('0x2a')](_[_0xb652('0x32')](_0x4014a0[_0xb652('0x29')],_0x42eba2[_0xb652('0x2a')]));if(_0x4014a0[_0xb652('0x29')]['filter']){_0x5ac57f[_0xb652('0x31')]=_['merge'](_0x5ac57f[_0xb652('0x31')],{'$or':_[_0xb652('0x33')](_0xf894cb,function(_0x488b4e){if(_0x488b4e[_0xb652('0x34')][_0xb652('0x35')]!==_0xb652('0x36')){var _0x2fca2c={};_0x2fca2c[_0x488b4e[_0xb652('0x37')]]={'$like':'%'+_0x4014a0[_0xb652('0x29')][_0xb652('0x38')]+'%'};return _0x2fca2c;}})});}_0x5ac57f=_[_0xb652('0x39')]({},_0x5ac57f,_0x4014a0[_0xb652('0x3a')]);var _0x1c82e9={'where':_0x5ac57f['where']};return db[_0xb652('0x3b')][_0xb652('0x18')](_0x1c82e9)[_0xb652('0x1e')](function(_0x21f97a){_0x4a1dfb[_0xb652('0x18')]=_0x21f97a;if(_0x4014a0[_0xb652('0x29')]['includeAll']){_0x5ac57f[_0xb652('0x3c')]=[{'attributes':['id',_0xb652('0x23'),_0xb652('0x3d'),_0xb652('0x3e')],'model':db['User'],'as':'User'}];}return db[_0xb652('0x3b')][_0xb652('0x3f')](_0x5ac57f);})[_0xb652('0x1e')](function(_0x596514){_0x4a1dfb[_0xb652('0x40')]=_0x596514;return _0x4a1dfb;})[_0xb652('0x1e')](respondWithFilteredResult(_0xb7ec44,_0x5ac57f))['catch'](handleError(_0xb7ec44,null));};exports[_0xb652('0x41')]=function(_0x1ea370,_0x218577){var _0x5be500={'raw':!![],'where':{'id':_0x1ea370[_0xb652('0x42')]['id']}},_0x26c6b4={};_0x26c6b4['model']=_[_0xb652('0x28')](db[_0xb652('0x3b')][_0xb652('0x26')]);_0x26c6b4[_0xb652('0x29')]=_[_0xb652('0x28')](_0x1ea370['query']);_0x26c6b4['filters']=_[_0xb652('0x2c')](_0x26c6b4[_0xb652('0x27')],_0x26c6b4[_0xb652('0x29')]);_0x5be500['attributes']=_[_0xb652('0x2c')](_0x26c6b4[_0xb652('0x27')],qs[_0xb652('0x2d')](_0x1ea370[_0xb652('0x29')][_0xb652('0x2d')]));_0x5be500[_0xb652('0x2b')]=_0x5be500[_0xb652('0x2b')][_0xb652('0x2e')]?_0x5be500['attributes']:_0x26c6b4[_0xb652('0x27')];if(_0x1ea370[_0xb652('0x29')]['includeAll']){_0x5be500[_0xb652('0x3c')]=[{'all':!![]}];}_0x5be500=_[_0xb652('0x39')]({},_0x5be500,_0x1ea370[_0xb652('0x3a')]);return db[_0xb652('0x3b')][_0xb652('0x43')](_0x5be500)[_0xb652('0x1e')](handleEntityNotFound(_0x218577,null))['then'](respondWithResult(_0x218577,null))[_0xb652('0x44')](handleError(_0x218577,null));};exports[_0xb652('0x45')]=function(_0x9d14cc,_0x1e9a08){return db[_0xb652('0x3b')][_0xb652('0x45')](_0x9d14cc[_0xb652('0x46')],{})[_0xb652('0x1e')](respondWithResult(_0x1e9a08,0xc9))['catch'](handleError(_0x1e9a08,null));};exports['destroy']=function(_0x4ef25a,_0xf77d3e){return db[_0xb652('0x3b')][_0xb652('0x43')]({'where':{'id':_0x4ef25a[_0xb652('0x42')]['id']}})[_0xb652('0x1e')](handleEntityNotFound(_0xf77d3e,null))['then'](removeEntity(_0xf77d3e,null))[_0xb652('0x44')](handleError(_0xf77d3e,null));};exports[_0xb652('0x47')]=function(_0x11a8a2,_0x3382c0){return db[_0xb652('0x3b')][_0xb652('0x47')]()[_0xb652('0x1e')](respondWithResult(_0x3382c0,null))[_0xb652('0x44')](handleError(_0x3382c0,null));};exports[_0xb652('0x48')]=function(_0x25050d,_0x3e3190){if(_0x25050d[_0xb652('0x46')]['uniqueid']){delete _0x25050d[_0xb652('0x46')][_0xb652('0x49')];}return db[_0xb652('0x3b')][_0xb652('0x43')]({'where':{'uniqueid':_0x25050d['params']['id'],'UserId':{'$or':[null,_0x25050d[_0xb652('0x4a')]['id']]}}})['then'](handleEntityNotFound(_0x3e3190,null))[_0xb652('0x1e')](saveUpdates(_0x25050d[_0xb652('0x46')],null))[_0xb652('0x1e')](respondWithResult(_0x3e3190,null))[_0xb652('0x44')](handleError(_0x3e3190,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 144db15..9c764f3 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 _0xc454=['rimraf','../../config/environment','./voiceCallReport.attributes','define','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc454,0x14b));var _0x4c45=function(_0xfd234f,_0x5592b2){_0xfd234f=_0xfd234f-0x0;var _0x16bc59=_0xc454[_0xfd234f];return _0x16bc59;};'use strict';var _=require('lodash');var util=require(_0x4c45('0x0'));var logger=require(_0x4c45('0x1'))(_0x4c45('0x2'));var moment=require(_0x4c45('0x3'));var BPromise=require(_0x4c45('0x4'));var rp=require(_0x4c45('0x5'));var fs=require('fs');var path=require(_0x4c45('0x6'));var rimraf=require(_0x4c45('0x7'));var config=require(_0x4c45('0x8'));var attributes=require(_0x4c45('0x9'));module['exports']=function(_0x13a019,_0x1fe1fc){return _0x13a019[_0x4c45('0xa')]('VoiceCallReport',attributes,{'tableName':_0x4c45('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4c45('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e47=['api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','util'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x2e47,0x15a));var _0x72e4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2e47[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x72e4('0x0'));var util=require(_0x72e4('0x1'));var logger=require('../../config/logger')(_0x72e4('0x2'));var moment=require(_0x72e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x72e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72e4('0x5'));var config=require(_0x72e4('0x6'));var attributes=require(_0x72e4('0x7'));module[_0x72e4('0x8')]=function(_0x133407,_0x1c1472){return _0x133407[_0x72e4('0x9')]('VoiceCallReport',attributes,{'tableName':_0x72e4('0xa'),'paranoid':![],'indexes':[{'fields':[_0x72e4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c4bae4b..041e376 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 _0x63ff=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','moment'];(function(_0x529059,_0x294a33){var _0x156bc2=function(_0x9bc770){while(--_0x9bc770){_0x529059['push'](_0x529059['shift']());}};_0x156bc2(++_0x294a33);}(_0x63ff,0x195));var _0xf63f=function(_0xc92087,_0x5dc511){_0xc92087=_0xc92087-0x0;var _0x431aba=_0x63ff[_0xc92087];return _0x431aba;};'use strict';var _=require(_0xf63f('0x0'));var util=require('util');var moment=require(_0xf63f('0x1'));var BPromise=require(_0xf63f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf63f('0x3'));var db=require(_0xf63f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf63f('0x5'))(_0xf63f('0x6'));var config=require(_0xf63f('0x7'));var jayson=require(_0xf63f('0x8'));var client=jayson[_0xf63f('0x9')][_0xf63f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44b492,_0x5df292,_0x12d51a){return new BPromise(function(_0x439563,_0x52a76e){return client[_0xf63f('0xb')](_0x44b492,_0x12d51a)[_0xf63f('0xc')](function(_0x404677){logger[_0xf63f('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x5df292,_0xf63f('0xe'));logger[_0xf63f('0xf')](_0xf63f('0x10'),_0x5df292,_0xf63f('0xe'),JSON[_0xf63f('0x11')](_0x404677));if(_0x404677[_0xf63f('0x12')]){if(_0x404677[_0xf63f('0x12')][_0xf63f('0x13')]===0x1f4){logger[_0xf63f('0x12')](_0xf63f('0x14'),_0x5df292,_0x404677[_0xf63f('0x12')][_0xf63f('0x15')]);return _0x52a76e(_0x404677[_0xf63f('0x12')][_0xf63f('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5df292,_0x404677[_0xf63f('0x12')][_0xf63f('0x15')]);return _0x439563(_0x404677[_0xf63f('0x12')][_0xf63f('0x15')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5df292,_0xf63f('0xe'));_0x439563(_0x404677[_0xf63f('0x16')][_0xf63f('0x15')]);}})[_0xf63f('0x17')](function(_0x3bd3c7){logger[_0xf63f('0x12')](_0xf63f('0x14'),_0x5df292,_0x3bd3c7);_0x52a76e(_0x3bd3c7);});});}exports[_0xf63f('0x18')]=function(_0x1f313e){var _0x20dbd7=this;return new Promise(function(_0x4448c3,_0x2b937e){return db[_0xf63f('0x19')][_0xf63f('0x1a')]({'raw':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e[_0xf63f('0x1b')][_0xf63f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e['options'][_0xf63f('0x1d')]||null:null,'attributes':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e[_0xf63f('0x1b')][_0xf63f('0x1e')]||null:null,'limit':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e[_0xf63f('0x1b')][_0xf63f('0x1f')]||null:null,'include':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e[_0xf63f('0x1b')][_0xf63f('0x20')]?_['map'](_0x1f313e[_0xf63f('0x1b')]['include'],function(_0xfe19ea){return{'model':db[_0xfe19ea[_0xf63f('0x21')]],'as':_0xfe19ea['as'],'attributes':_0xfe19ea[_0xf63f('0x1e')],'include':_0xfe19ea[_0xf63f('0x20')]?_[_0xf63f('0x22')](_0xfe19ea[_0xf63f('0x20')],function(_0x3c4041){return{'model':db[_0x3c4041[_0xf63f('0x21')]],'as':_0x3c4041['as'],'attributes':_0x3c4041[_0xf63f('0x1e')],'include':_0x3c4041[_0xf63f('0x20')]?_['map'](_0x3c4041[_0xf63f('0x20')],function(_0x148823){return{'model':db[_0x148823[_0xf63f('0x21')]],'as':_0x148823['as'],'attributes':_0x148823[_0xf63f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf63f('0xc')](function(_0x165b36){logger['info'](_0xf63f('0x18'),_0x1f313e);logger['debug'](_0xf63f('0x18'),_0x1f313e,JSON[_0xf63f('0x11')](_0x165b36));_0x4448c3(_0x165b36);})[_0xf63f('0x17')](function(_0x28d5e4){logger[_0xf63f('0x12')](_0xf63f('0x18'),_0x28d5e4[_0xf63f('0x15')],_0x1f313e);_0x2b937e(_0x20dbd7[_0xf63f('0x12')](0x1f4,_0x28d5e4[_0xf63f('0x15')]));});});};exports[_0xf63f('0x23')]=function(_0x14bbd9){var _0x124d9b=this;return new Promise(function(_0x20e0c4,_0x4e57b0){return db[_0xf63f('0x19')]['create'](_0x14bbd9['body'],{'raw':_0x14bbd9[_0xf63f('0x1b')]?_0x14bbd9[_0xf63f('0x1b')][_0xf63f('0x1c')]===undefined?!![]:![]:!![]})[_0xf63f('0xc')](function(_0x2ee054){logger[_0xf63f('0xd')](_0xf63f('0x23'),_0x14bbd9);logger[_0xf63f('0xf')](_0xf63f('0x23'),_0x14bbd9,JSON[_0xf63f('0x11')](_0x2ee054));_0x20e0c4(_0x2ee054);})[_0xf63f('0x17')](function(_0x437b5b){logger[_0xf63f('0x12')](_0xf63f('0x23'),_0x437b5b[_0xf63f('0x15')],_0x14bbd9);_0x4e57b0(_0x124d9b[_0xf63f('0x12')](0x1f4,_0x437b5b[_0xf63f('0x15')]));});});};exports[_0xf63f('0x24')]=function(_0x3df3d8){var _0x1a1445=this;return new Promise(function(_0x2fcb00,_0x2db503){return db[_0xf63f('0x19')]['update'](_0x3df3d8['body'],{'raw':_0x3df3d8[_0xf63f('0x1b')]?_0x3df3d8[_0xf63f('0x1b')][_0xf63f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3df3d8['options']?_0x3df3d8[_0xf63f('0x1b')][_0xf63f('0x1d')]||null:null,'attributes':_0x3df3d8[_0xf63f('0x1b')]?_0x3df3d8[_0xf63f('0x1b')][_0xf63f('0x1e')]||null:null,'limit':_0x3df3d8['options']?_0x3df3d8[_0xf63f('0x1b')][_0xf63f('0x1f')]||null:null})[_0xf63f('0xc')](function(_0x569156){logger[_0xf63f('0xd')](_0xf63f('0x24'),_0x3df3d8);logger[_0xf63f('0xf')](_0xf63f('0x24'),_0x3df3d8,JSON[_0xf63f('0x11')](_0x569156));_0x2fcb00(_0x569156);})[_0xf63f('0x17')](function(_0x43b6d7){logger[_0xf63f('0x12')](_0xf63f('0x24'),_0x43b6d7[_0xf63f('0x15')],_0x3df3d8);_0x2db503(_0x1a1445['error'](0x1f4,_0x43b6d7[_0xf63f('0x15')]));});});}; \ No newline at end of file +var _0x64f5=['VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','include','map','model','attributes','info','VoiceCallReport','create','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','util','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then'];(function(_0x49f5e8,_0x2ee007){var _0x4fa732=function(_0x3117fe){while(--_0x3117fe){_0x49f5e8['push'](_0x49f5e8['shift']());}};_0x4fa732(++_0x2ee007);}(_0x64f5,0x13a));var _0x564f=function(_0xfc8e94,_0x2f92de){_0xfc8e94=_0xfc8e94-0x0;var _0x130e33=_0x64f5[_0xfc8e94];return _0x130e33;};'use strict';var _=require(_0x564f('0x0'));var util=require(_0x564f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x564f('0x2'));var fs=require('fs');var Redis=require(_0x564f('0x3'));var db=require(_0x564f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x564f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x564f('0x6')][_0x564f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39b14a,_0x32e09b,_0x4d8463){return new BPromise(function(_0x38cff9,_0x1d5b56){return client[_0x564f('0x8')](_0x39b14a,_0x4d8463)[_0x564f('0x9')](function(_0x4c6cf1){logger['info'](_0x564f('0xa'),_0x32e09b,'request\x20sent');logger[_0x564f('0xb')](_0x564f('0xc'),_0x32e09b,_0x564f('0xd'),JSON[_0x564f('0xe')](_0x4c6cf1));if(_0x4c6cf1['error']){if(_0x4c6cf1[_0x564f('0xf')][_0x564f('0x10')]===0x1f4){logger['error'](_0x564f('0xa'),_0x32e09b,_0x4c6cf1[_0x564f('0xf')][_0x564f('0x11')]);return _0x1d5b56(_0x4c6cf1['error'][_0x564f('0x11')]);}logger[_0x564f('0xf')](_0x564f('0xa'),_0x32e09b,_0x4c6cf1['error']['message']);return _0x38cff9(_0x4c6cf1['error'][_0x564f('0x11')]);}else{logger['info'](_0x564f('0xa'),_0x32e09b,_0x564f('0xd'));_0x38cff9(_0x4c6cf1[_0x564f('0x12')][_0x564f('0x11')]);}})[_0x564f('0x13')](function(_0xc2a109){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x32e09b,_0xc2a109);_0x1d5b56(_0xc2a109);});});}exports[_0x564f('0x14')]=function(_0x6eac79){var _0x446e5d=this;return new Promise(function(_0x4a2e64,_0x1e6b04){return db['VoiceCallReport'][_0x564f('0x15')]({'raw':_0x6eac79[_0x564f('0x16')]?_0x6eac79[_0x564f('0x16')][_0x564f('0x17')]===undefined?!![]:![]:!![],'where':_0x6eac79[_0x564f('0x16')]?_0x6eac79[_0x564f('0x16')][_0x564f('0x18')]||null:null,'attributes':_0x6eac79['options']?_0x6eac79[_0x564f('0x16')]['attributes']||null:null,'limit':_0x6eac79[_0x564f('0x16')]?_0x6eac79[_0x564f('0x16')]['limit']||null:null,'include':_0x6eac79[_0x564f('0x16')]?_0x6eac79[_0x564f('0x16')][_0x564f('0x19')]?_[_0x564f('0x1a')](_0x6eac79[_0x564f('0x16')]['include'],function(_0x2bbda6){return{'model':db[_0x2bbda6[_0x564f('0x1b')]],'as':_0x2bbda6['as'],'attributes':_0x2bbda6[_0x564f('0x1c')],'include':_0x2bbda6[_0x564f('0x19')]?_[_0x564f('0x1a')](_0x2bbda6[_0x564f('0x19')],function(_0x5ea273){return{'model':db[_0x5ea273[_0x564f('0x1b')]],'as':_0x5ea273['as'],'attributes':_0x5ea273[_0x564f('0x1c')],'include':_0x5ea273[_0x564f('0x19')]?_[_0x564f('0x1a')](_0x5ea273['include'],function(_0x534ee6){return{'model':db[_0x534ee6['model']],'as':_0x534ee6['as'],'attributes':_0x534ee6[_0x564f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x564f('0x9')](function(_0xbe8152){logger[_0x564f('0x1d')](_0x564f('0x14'),_0x6eac79);logger[_0x564f('0xb')](_0x564f('0x14'),_0x6eac79,JSON['stringify'](_0xbe8152));_0x4a2e64(_0xbe8152);})['catch'](function(_0x5a4692){logger[_0x564f('0xf')](_0x564f('0x14'),_0x5a4692[_0x564f('0x11')],_0x6eac79);_0x1e6b04(_0x446e5d[_0x564f('0xf')](0x1f4,_0x5a4692[_0x564f('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x25d3c7){var _0x54b59e=this;return new Promise(function(_0x399781,_0x57bab7){return db[_0x564f('0x1e')][_0x564f('0x1f')](_0x25d3c7[_0x564f('0x20')],{'raw':_0x25d3c7['options']?_0x25d3c7[_0x564f('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x564f('0x9')](function(_0x33a4ad){logger[_0x564f('0x1d')](_0x564f('0x21'),_0x25d3c7);logger[_0x564f('0xb')]('CreateVoiceCallReport',_0x25d3c7,JSON['stringify'](_0x33a4ad));_0x399781(_0x33a4ad);})[_0x564f('0x13')](function(_0x56ecc4){logger[_0x564f('0xf')](_0x564f('0x21'),_0x56ecc4[_0x564f('0x11')],_0x25d3c7);_0x57bab7(_0x54b59e[_0x564f('0xf')](0x1f4,_0x56ecc4[_0x564f('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x46933a){var _0x38ab1f=this;return new Promise(function(_0x556a75,_0xff6507){return db[_0x564f('0x1e')][_0x564f('0x22')](_0x46933a[_0x564f('0x20')],{'raw':_0x46933a[_0x564f('0x16')]?_0x46933a[_0x564f('0x16')][_0x564f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46933a['options']?_0x46933a['options'][_0x564f('0x18')]||null:null,'attributes':_0x46933a['options']?_0x46933a[_0x564f('0x16')][_0x564f('0x1c')]||null:null,'limit':_0x46933a['options']?_0x46933a[_0x564f('0x16')]['limit']||null:null})[_0x564f('0x9')](function(_0x2c39bd){logger[_0x564f('0x1d')](_0x564f('0x23'),_0x46933a);logger[_0x564f('0xb')](_0x564f('0x23'),_0x46933a,JSON[_0x564f('0xe')](_0x2c39bd));_0x556a75(_0x2c39bd);})['catch'](function(_0x3dbde3){logger['error']('UpdateVoiceCallReport',_0x3dbde3[_0x564f('0x11')],_0x46933a);_0xff6507(_0x38ab1f[_0x564f('0xf')](0x1f4,_0x3dbde3[_0x564f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5884480..ae1fe34 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 _0x5946=['isAuthenticated','index','post','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0xc5463e,_0x54f914){var _0x1c45f7=function(_0x265a5f){while(--_0x265a5f){_0xc5463e['push'](_0xc5463e['shift']());}};_0x1c45f7(++_0x54f914);}(_0x5946,0x8f));var _0x6594=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x5946[_0x65c903];return _0x23e1d7;};'use strict';var multer=require('multer');var util=require(_0x6594('0x0'));var path=require('path');var timeout=require(_0x6594('0x1'));var express=require(_0x6594('0x2'));var router=express[_0x6594('0x3')]();var auth=require(_0x6594('0x4'));var interaction=require(_0x6594('0x5'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x6594('0x6')]('/',auth[_0x6594('0x7')](),controller[_0x6594('0x8')]);router[_0x6594('0x6')]('/:id',auth[_0x6594('0x7')](),controller['show']);router[_0x6594('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6594('0xa')](_0x6594('0xb'),auth[_0x6594('0x7')](),controller[_0x6594('0xc')]);router['delete'](_0x6594('0xb'),auth[_0x6594('0x7')](),controller[_0x6594('0xd')]);module[_0x6594('0xe')]=router; \ No newline at end of file +var _0x4d61=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put'];(function(_0x2cba85,_0x24b99a){var _0x2343aa=function(_0x120fe6){while(--_0x120fe6){_0x2cba85['push'](_0x2cba85['shift']());}};_0x2343aa(++_0x24b99a);}(_0x4d61,0x147));var _0x14d6=function(_0x5380c5,_0x5bc69f){_0x5380c5=_0x5380c5-0x0;var _0x32c4a6=_0x4d61[_0x5380c5];return _0x32c4a6;};'use strict';var multer=require(_0x14d6('0x0'));var util=require(_0x14d6('0x1'));var path=require(_0x14d6('0x2'));var timeout=require(_0x14d6('0x3'));var express=require(_0x14d6('0x4'));var router=express[_0x14d6('0x5')]();var auth=require(_0x14d6('0x6'));var interaction=require(_0x14d6('0x7'));var config=require(_0x14d6('0x8'));var controller=require('./voiceChanSpy.controller');router[_0x14d6('0x9')]('/',auth[_0x14d6('0xa')](),controller[_0x14d6('0xb')]);router[_0x14d6('0x9')](_0x14d6('0xc'),auth[_0x14d6('0xa')](),controller[_0x14d6('0xd')]);router['post']('/',auth[_0x14d6('0xa')](),controller['create']);router[_0x14d6('0xe')]('/:id',auth[_0x14d6('0xa')](),controller[_0x14d6('0xf')]);router['delete'](_0x14d6('0xc'),auth[_0x14d6('0xa')](),controller[_0x14d6('0x10')]);module[_0x14d6('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 8ddf4c8..f028a44 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 _0x5cef=['setDataValue','options','join','getDataValue','split','BOOLEAN','exports','STRING','name'];(function(_0x46f4af,_0x52d56a){var _0x3643e9=function(_0x5ad306){while(--_0x5ad306){_0x46f4af['push'](_0x46f4af['shift']());}};_0x3643e9(++_0x52d56a);}(_0x5cef,0x102));var _0xf5ce=function(_0x263a30,_0x3ce000){_0x263a30=_0x263a30-0x0;var _0x33258e=_0x5cef[_0x263a30];return _0x33258e;};'use strict';var Sequelize=require('sequelize');module[_0xf5ce('0x0')]={'name':{'type':Sequelize[_0xf5ce('0x1')]},'prefix':{'type':Sequelize[_0xf5ce('0x1')],'unique':_0xf5ce('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5c6348){this[_0xf5ce('0x3')](_0xf5ce('0x4'),_0x5c6348?_0x5c6348[_0xf5ce('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xf5ce('0x6')](_0xf5ce('0x4'))[_0xf5ce('0x7')](''):[];}},'auth':{'type':Sequelize[_0xf5ce('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xf5ce('0x1')]},'record':{'type':Sequelize[_0xf5ce('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf5ce('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7997=['BOOLEAN','exports','STRING','name','options','getDataValue'];(function(_0x5bc154,_0x1cf742){var _0x657476=function(_0x82b3f0){while(--_0x82b3f0){_0x5bc154['push'](_0x5bc154['shift']());}};_0x657476(++_0x1cf742);}(_0x7997,0x1f3));var _0x7799=function(_0x13bd5d,_0x1db5d9){_0x13bd5d=_0x13bd5d-0x0;var _0x174194=_0x7997[_0x13bd5d];return _0x174194;};'use strict';var Sequelize=require('sequelize');module[_0x7799('0x0')]={'name':{'type':Sequelize[_0x7799('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x7799('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x7799('0x1')],'set':function(_0x357933){this['setDataValue'](_0x7799('0x3'),_0x357933?_0x357933['join'](''):[]);},'get':function(){return this[_0x7799('0x4')]('options')?this[_0x7799('0x4')](_0x7799('0x3'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x7799('0x1')]},'record':{'type':Sequelize[_0x7799('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7799('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8a4c4a2..8909bae 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 _0xe9fb=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','VoiceChanSpy','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','get','UserProfileResource','error','name','send','rawAttributes','model','keys','query','filters','intersection'];(function(_0x1f886c,_0x303195){var _0x49e8a1=function(_0x28f654){while(--_0x28f654){_0x1f886c['push'](_0x1f886c['shift']());}};_0x49e8a1(++_0x303195);}(_0xe9fb,0x168));var _0xbe9f=function(_0x1a21a7,_0x57e51f){_0x1a21a7=_0x1a21a7-0x0;var _0x1d7555=_0xe9fb[_0x1a21a7];return _0x1d7555;};'use strict';var pdf=require(_0xbe9f('0x0'));var emlformat=require(_0xbe9f('0x1'));var rimraf=require(_0xbe9f('0x2'));var zipdir=require(_0xbe9f('0x3'));var jsonpatch=require(_0xbe9f('0x4'));var rp=require(_0xbe9f('0x5'));var moment=require(_0xbe9f('0x6'));var BPromise=require(_0xbe9f('0x7'));var Mustache=require(_0xbe9f('0x8'));var util=require(_0xbe9f('0x9'));var path=require(_0xbe9f('0xa'));var sox=require(_0xbe9f('0xb'));var csv=require('to-csv');var ejs=require(_0xbe9f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbe9f('0xd'));var jsforce=require(_0xbe9f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe9f('0xf'));var Papa=require(_0xbe9f('0x10'));var Redis=require(_0xbe9f('0x11'));var authService=require(_0xbe9f('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xbe9f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbe9f('0x14'));var config=require('../../config/environment');var db=require(_0xbe9f('0x15'))['db'];function respondWithStatusCode(_0x3b3ba5,_0x29452b){_0x29452b=_0x29452b||0xcc;return function(_0x303bb2){if(_0x303bb2){return _0x3b3ba5[_0xbe9f('0x16')](_0x29452b);}return _0x3b3ba5[_0xbe9f('0x17')](_0x29452b)[_0xbe9f('0x18')]();};}function respondWithResult(_0x3cac95,_0x3f6e5e){_0x3f6e5e=_0x3f6e5e||0xc8;return function(_0x2065e0){if(_0x2065e0){return _0x3cac95[_0xbe9f('0x17')](_0x3f6e5e)[_0xbe9f('0x19')](_0x2065e0);}};}function respondWithFilteredResult(_0x18e0d7,_0x1ff966){return function(_0x378620){if(_0x378620){var _0x339317=_0x378620['count'],_0x4573a7=_0x1ff966[_0xbe9f('0x1a')],_0x4c9730=_0x1ff966[_0xbe9f('0x1a')]+_0x1ff966[_0xbe9f('0x1b')],_0x290b12;if(_0x4c9730>=_0x339317){_0x4c9730=_0x339317;_0x290b12=0xc8;}else{_0x290b12=0xce;}_0x18e0d7['status'](_0x290b12);return _0x18e0d7[_0xbe9f('0x1c')](_0xbe9f('0x1d'),_0x4573a7+'-'+_0x4c9730+'/'+_0x339317)[_0xbe9f('0x19')](_0x378620);}return null;};}function patchUpdates(_0x1dbcea){return function(_0x55b392){try{jsonpatch['apply'](_0x55b392,_0x1dbcea,!![]);}catch(_0x393192){return BPromise[_0xbe9f('0x1e')](_0x393192);}return _0x55b392[_0xbe9f('0x1f')]();};}function saveUpdates(_0x31df3f,_0x5594e7){return function(_0x294b80){if(_0x294b80){return _0x294b80[_0xbe9f('0x20')](_0x31df3f)[_0xbe9f('0x21')](function(_0x4de1b0){return _0x4de1b0;});}return null;};}function removeEntity(_0x512b87,_0x26b1b5){return function(_0x4d1c39){if(_0x4d1c39){return _0x4d1c39['destroy']()[_0xbe9f('0x21')](function(){var _0x5338df=_0x4d1c39[_0xbe9f('0x22')]({'plain':!![]});var _0xc4895e='ChanSpies';return db[_0xbe9f('0x23')]['destroy']({'where':{'type':_0xc4895e,'resourceId':_0x5338df['id']}})[_0xbe9f('0x21')](function(){return _0x4d1c39;});})[_0xbe9f('0x21')](function(){_0x512b87['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x548039,_0x51c8f0){return function(_0x4c9c38){if(!_0x4c9c38){_0x548039[_0xbe9f('0x16')](0x194);}return _0x4c9c38;};}function handleError(_0x9d3a94,_0x72fa85){_0x72fa85=_0x72fa85||0x1f4;return function(_0x3175dd){logger[_0xbe9f('0x24')](_0x3175dd['stack']);if(_0x3175dd[_0xbe9f('0x25')]){delete _0x3175dd[_0xbe9f('0x25')];}_0x9d3a94[_0xbe9f('0x17')](_0x72fa85)[_0xbe9f('0x26')](_0x3175dd);};}exports['index']=function(_0x5e0703,_0x19deed){var _0x1e4273={},_0x5b4608={},_0x59bc0b={'count':0x0,'rows':[]};var _0x4e961d=db['VoiceChanSpy'][_0xbe9f('0x27')];_0x5b4608[_0xbe9f('0x28')]=_[_0xbe9f('0x29')](_0x4e961d);_0x5b4608[_0xbe9f('0x2a')]=_['keys'](_0x5e0703[_0xbe9f('0x2a')]);_0x5b4608[_0xbe9f('0x2b')]=_[_0xbe9f('0x2c')](_0x5b4608['model'],_0x5b4608['query']);_0x1e4273['attributes']=_['intersection'](_0x5b4608['model'],qs[_0xbe9f('0x2d')](_0x5e0703[_0xbe9f('0x2a')][_0xbe9f('0x2d')]));_0x1e4273[_0xbe9f('0x2e')]=_0x1e4273[_0xbe9f('0x2e')][_0xbe9f('0x2f')]?_0x1e4273[_0xbe9f('0x2e')]:_0x5b4608[_0xbe9f('0x28')];if(!_0x5e0703['query'][_0xbe9f('0x30')](_0xbe9f('0x31'))){_0x1e4273[_0xbe9f('0x1b')]=qs['limit'](_0x5e0703[_0xbe9f('0x2a')][_0xbe9f('0x1b')]);_0x1e4273[_0xbe9f('0x1a')]=qs[_0xbe9f('0x1a')](_0x5e0703[_0xbe9f('0x2a')]['offset']);}_0x1e4273[_0xbe9f('0x32')]=qs[_0xbe9f('0x33')](_0x5e0703[_0xbe9f('0x2a')]['sort']);_0x1e4273[_0xbe9f('0x34')]=qs[_0xbe9f('0x2b')](_['pick'](_0x5e0703[_0xbe9f('0x2a')],_0x5b4608['filters']));if(_0x5e0703['query'][_0xbe9f('0x35')]){_0x1e4273[_0xbe9f('0x34')]=_[_0xbe9f('0x36')](_0x1e4273['where'],{'$or':_[_0xbe9f('0x37')](_0x4e961d,function(_0x12e846){if(_0x12e846[_0xbe9f('0x38')][_0xbe9f('0x39')]!==_0xbe9f('0x3a')){var _0x285c45={};_0x285c45[_0x12e846[_0xbe9f('0x3b')]]={'$like':'%'+_0x5e0703['query'][_0xbe9f('0x35')]+'%'};return _0x285c45;}})});}_0x1e4273=_[_0xbe9f('0x36')]({},_0x1e4273,_0x5e0703[_0xbe9f('0x3c')]);var _0x5ade12={'where':_0x1e4273[_0xbe9f('0x34')]};return db['VoiceChanSpy'][_0xbe9f('0x3d')](_0x5ade12)['then'](function(_0x5c70be){_0x59bc0b[_0xbe9f('0x3d')]=_0x5c70be;if(_0x5e0703[_0xbe9f('0x2a')][_0xbe9f('0x3e')]){_0x1e4273[_0xbe9f('0x3f')]=[{'all':!![]}];}return db[_0xbe9f('0x40')]['findAll'](_0x1e4273);})[_0xbe9f('0x21')](function(_0x1320e4){_0x59bc0b[_0xbe9f('0x41')]=_0x1320e4;return _0x59bc0b;})[_0xbe9f('0x21')](respondWithFilteredResult(_0x19deed,_0x1e4273))['catch'](handleError(_0x19deed,null));};exports[_0xbe9f('0x42')]=function(_0x2d6eef,_0x4eb5cd){var _0x538908={'raw':![],'where':{'id':_0x2d6eef[_0xbe9f('0x43')]['id']}},_0x49ec50={};_0x49ec50['model']=_[_0xbe9f('0x29')](db[_0xbe9f('0x40')][_0xbe9f('0x27')]);_0x49ec50['query']=_[_0xbe9f('0x29')](_0x2d6eef['query']);_0x49ec50['filters']=_[_0xbe9f('0x2c')](_0x49ec50['model'],_0x49ec50[_0xbe9f('0x2a')]);_0x538908[_0xbe9f('0x2e')]=_[_0xbe9f('0x2c')](_0x49ec50[_0xbe9f('0x28')],qs[_0xbe9f('0x2d')](_0x2d6eef[_0xbe9f('0x2a')]['fields']));_0x538908[_0xbe9f('0x2e')]=_0x538908['attributes'][_0xbe9f('0x2f')]?_0x538908[_0xbe9f('0x2e')]:_0x49ec50[_0xbe9f('0x28')];if(_0x2d6eef['query'][_0xbe9f('0x3e')]){_0x538908['include']=[{'all':!![]}];}_0x538908=_[_0xbe9f('0x36')]({},_0x538908,_0x2d6eef[_0xbe9f('0x3c')]);return db[_0xbe9f('0x40')][_0xbe9f('0x44')](_0x538908)[_0xbe9f('0x21')](handleEntityNotFound(_0x4eb5cd,null))[_0xbe9f('0x21')](respondWithResult(_0x4eb5cd,null))[_0xbe9f('0x45')](handleError(_0x4eb5cd,null));};exports['create']=function(_0x495079,_0x326f13){return db[_0xbe9f('0x40')][_0xbe9f('0x46')](_0x495079[_0xbe9f('0x47')],{})[_0xbe9f('0x21')](function(_0x4ed05b){var _0x5792d4=_0x495079['user'][_0xbe9f('0x22')]({'plain':!![]});if(!_0x5792d4)throw new Error(_0xbe9f('0x48'));if(_0x5792d4[_0xbe9f('0x49')]===_0xbe9f('0x4a')){var _0x3338f6=_0x4ed05b[_0xbe9f('0x22')]({'plain':!![]});var _0x4d7e97=_0xbe9f('0x4b');return db[_0xbe9f('0x4c')][_0xbe9f('0x44')]({'where':{'name':_0x4d7e97,'userProfileId':_0x5792d4[_0xbe9f('0x4d')]},'raw':!![]})['then'](function(_0x55e261){if(_0x55e261&&_0x55e261[_0xbe9f('0x4e')]===0x0){return db[_0xbe9f('0x23')][_0xbe9f('0x46')]({'name':_0x3338f6[_0xbe9f('0x25')],'resourceId':_0x3338f6['id'],'type':_0x55e261[_0xbe9f('0x25')],'sectionId':_0x55e261['id']},{})['then'](function(){return _0x4ed05b;});}else{return _0x4ed05b;}})[_0xbe9f('0x45')](function(_0x4c4029){logger[_0xbe9f('0x24')](_0xbe9f('0x4f'),_0x4c4029);throw _0x4c4029;});}return _0x4ed05b;})['then'](respondWithResult(_0x326f13,0xc9))[_0xbe9f('0x45')](handleError(_0x326f13,null));};exports['update']=function(_0xc25a46,_0x45551f){if(_0xc25a46['body']['id']){delete _0xc25a46[_0xbe9f('0x47')]['id'];}return db[_0xbe9f('0x40')][_0xbe9f('0x44')]({'where':{'id':_0xc25a46[_0xbe9f('0x43')]['id']}})[_0xbe9f('0x21')](handleEntityNotFound(_0x45551f,null))[_0xbe9f('0x21')](saveUpdates(_0xc25a46['body'],null))[_0xbe9f('0x21')](respondWithResult(_0x45551f,null))['catch'](handleError(_0x45551f,null));};exports[_0xbe9f('0x50')]=function(_0x466b9e,_0x500fa7){return db[_0xbe9f('0x40')][_0xbe9f('0x44')]({'where':{'id':_0x466b9e['params']['id']}})[_0xbe9f('0x21')](handleEntityNotFound(_0x500fa7,null))['then'](removeEntity(_0x500fa7,null))['catch'](handleError(_0x500fa7,null));}; \ No newline at end of file +var _0x57c5=['../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','ChanSpies','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','map','type','key','field','merge','options','include','findAll','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57c5,0x120));var _0x557c=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x57c5[_0x3511d3];return _0x5d6321;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x557c('0x0'));var zipdir=require(_0x557c('0x1'));var jsonpatch=require(_0x557c('0x2'));var rp=require(_0x557c('0x3'));var moment=require(_0x557c('0x4'));var BPromise=require(_0x557c('0x5'));var Mustache=require(_0x557c('0x6'));var util=require(_0x557c('0x7'));var path=require(_0x557c('0x8'));var sox=require(_0x557c('0x9'));var csv=require('to-csv');var ejs=require(_0x557c('0xa'));var fs=require('fs');var _=require(_0x557c('0xb'));var squel=require(_0x557c('0xc'));var crypto=require(_0x557c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x557c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x557c('0xf'));var Papa=require(_0x557c('0x10'));var Redis=require(_0x557c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x557c('0x12'));var logger=require('../../config/logger')(_0x557c('0x13'));var utils=require(_0x557c('0x14'));var config=require(_0x557c('0x15'));var db=require(_0x557c('0x16'))['db'];function respondWithStatusCode(_0x1e5936,_0x5542bd){_0x5542bd=_0x5542bd||0xcc;return function(_0x2a7725){if(_0x2a7725){return _0x1e5936['sendStatus'](_0x5542bd);}return _0x1e5936[_0x557c('0x17')](_0x5542bd)[_0x557c('0x18')]();};}function respondWithResult(_0x201c32,_0x148e0c){_0x148e0c=_0x148e0c||0xc8;return function(_0x41fcb7){if(_0x41fcb7){return _0x201c32[_0x557c('0x17')](_0x148e0c)[_0x557c('0x19')](_0x41fcb7);}};}function respondWithFilteredResult(_0x4e1de5,_0x5cbae7){return function(_0x53b2fe){if(_0x53b2fe){var _0x5b77a8=_0x53b2fe[_0x557c('0x1a')],_0x30d42e=_0x5cbae7['offset'],_0x86655f=_0x5cbae7[_0x557c('0x1b')]+_0x5cbae7[_0x557c('0x1c')],_0x39bc0f;if(_0x86655f>=_0x5b77a8){_0x86655f=_0x5b77a8;_0x39bc0f=0xc8;}else{_0x39bc0f=0xce;}_0x4e1de5[_0x557c('0x17')](_0x39bc0f);return _0x4e1de5[_0x557c('0x1d')](_0x557c('0x1e'),_0x30d42e+'-'+_0x86655f+'/'+_0x5b77a8)['json'](_0x53b2fe);}return null;};}function patchUpdates(_0x1b5c2d){return function(_0x1b58bf){try{jsonpatch[_0x557c('0x1f')](_0x1b58bf,_0x1b5c2d,!![]);}catch(_0x4eeb96){return BPromise[_0x557c('0x20')](_0x4eeb96);}return _0x1b58bf[_0x557c('0x21')]();};}function saveUpdates(_0x155f57,_0x5e4691){return function(_0x365c72){if(_0x365c72){return _0x365c72['update'](_0x155f57)['then'](function(_0x30433b){return _0x30433b;});}return null;};}function removeEntity(_0x49a603,_0x31b803){return function(_0x352a33){if(_0x352a33){return _0x352a33[_0x557c('0x22')]()[_0x557c('0x23')](function(){var _0x5437ed=_0x352a33[_0x557c('0x24')]({'plain':!![]});var _0x2c70dc=_0x557c('0x25');return db[_0x557c('0x26')][_0x557c('0x22')]({'where':{'type':_0x2c70dc,'resourceId':_0x5437ed['id']}})['then'](function(){return _0x352a33;});})[_0x557c('0x23')](function(){_0x49a603[_0x557c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0849,_0xc45c8f){return function(_0x3025a0){if(!_0x3025a0){_0x4f0849[_0x557c('0x27')](0x194);}return _0x3025a0;};}function handleError(_0x5755bf,_0x77cee4){_0x77cee4=_0x77cee4||0x1f4;return function(_0x2575a1){logger[_0x557c('0x28')](_0x2575a1[_0x557c('0x29')]);if(_0x2575a1[_0x557c('0x2a')]){delete _0x2575a1[_0x557c('0x2a')];}_0x5755bf[_0x557c('0x17')](_0x77cee4)[_0x557c('0x2b')](_0x2575a1);};}exports[_0x557c('0x2c')]=function(_0x562f63,_0x559d56){var _0x354e44={},_0x44989b={},_0x45fd37={'count':0x0,'rows':[]};var _0x28f752=db[_0x557c('0x2d')][_0x557c('0x2e')];_0x44989b[_0x557c('0x2f')]=_[_0x557c('0x30')](_0x28f752);_0x44989b[_0x557c('0x31')]=_[_0x557c('0x30')](_0x562f63[_0x557c('0x31')]);_0x44989b[_0x557c('0x32')]=_[_0x557c('0x33')](_0x44989b['model'],_0x44989b[_0x557c('0x31')]);_0x354e44['attributes']=_[_0x557c('0x33')](_0x44989b[_0x557c('0x2f')],qs[_0x557c('0x34')](_0x562f63[_0x557c('0x31')][_0x557c('0x34')]));_0x354e44['attributes']=_0x354e44[_0x557c('0x35')][_0x557c('0x36')]?_0x354e44[_0x557c('0x35')]:_0x44989b[_0x557c('0x2f')];if(!_0x562f63[_0x557c('0x31')]['hasOwnProperty'](_0x557c('0x37'))){_0x354e44[_0x557c('0x1c')]=qs['limit'](_0x562f63['query'][_0x557c('0x1c')]);_0x354e44[_0x557c('0x1b')]=qs[_0x557c('0x1b')](_0x562f63[_0x557c('0x31')][_0x557c('0x1b')]);}_0x354e44['order']=qs[_0x557c('0x38')](_0x562f63[_0x557c('0x31')][_0x557c('0x38')]);_0x354e44[_0x557c('0x39')]=qs[_0x557c('0x32')](_['pick'](_0x562f63[_0x557c('0x31')],_0x44989b['filters']));if(_0x562f63[_0x557c('0x31')][_0x557c('0x3a')]){_0x354e44[_0x557c('0x39')]=_['merge'](_0x354e44['where'],{'$or':_[_0x557c('0x3b')](_0x28f752,function(_0x4afccc){if(_0x4afccc[_0x557c('0x3c')][_0x557c('0x3d')]!=='VIRTUAL'){var _0x2cb9ce={};_0x2cb9ce[_0x4afccc[_0x557c('0x3e')]]={'$like':'%'+_0x562f63[_0x557c('0x31')]['filter']+'%'};return _0x2cb9ce;}})});}_0x354e44=_[_0x557c('0x3f')]({},_0x354e44,_0x562f63[_0x557c('0x40')]);var _0x3b775e={'where':_0x354e44['where']};return db[_0x557c('0x2d')][_0x557c('0x1a')](_0x3b775e)[_0x557c('0x23')](function(_0x3117aa){_0x45fd37[_0x557c('0x1a')]=_0x3117aa;if(_0x562f63[_0x557c('0x31')]['includeAll']){_0x354e44[_0x557c('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x557c('0x42')](_0x354e44);})['then'](function(_0x49b3b0){_0x45fd37[_0x557c('0x43')]=_0x49b3b0;return _0x45fd37;})[_0x557c('0x23')](respondWithFilteredResult(_0x559d56,_0x354e44))['catch'](handleError(_0x559d56,null));};exports['show']=function(_0x1f288f,_0x25c5b4){var _0x4bfab4={'raw':![],'where':{'id':_0x1f288f[_0x557c('0x44')]['id']}},_0x5a15ce={};_0x5a15ce[_0x557c('0x2f')]=_[_0x557c('0x30')](db['VoiceChanSpy'][_0x557c('0x2e')]);_0x5a15ce[_0x557c('0x31')]=_[_0x557c('0x30')](_0x1f288f[_0x557c('0x31')]);_0x5a15ce[_0x557c('0x32')]=_[_0x557c('0x33')](_0x5a15ce[_0x557c('0x2f')],_0x5a15ce['query']);_0x4bfab4[_0x557c('0x35')]=_[_0x557c('0x33')](_0x5a15ce[_0x557c('0x2f')],qs[_0x557c('0x34')](_0x1f288f['query'][_0x557c('0x34')]));_0x4bfab4[_0x557c('0x35')]=_0x4bfab4[_0x557c('0x35')][_0x557c('0x36')]?_0x4bfab4[_0x557c('0x35')]:_0x5a15ce[_0x557c('0x2f')];if(_0x1f288f[_0x557c('0x31')]['includeAll']){_0x4bfab4[_0x557c('0x41')]=[{'all':!![]}];}_0x4bfab4=_[_0x557c('0x3f')]({},_0x4bfab4,_0x1f288f[_0x557c('0x40')]);return db[_0x557c('0x2d')][_0x557c('0x45')](_0x4bfab4)[_0x557c('0x23')](handleEntityNotFound(_0x25c5b4,null))['then'](respondWithResult(_0x25c5b4,null))[_0x557c('0x46')](handleError(_0x25c5b4,null));};exports[_0x557c('0x47')]=function(_0x5fef41,_0xc2df47){return db[_0x557c('0x2d')]['create'](_0x5fef41[_0x557c('0x48')],{})[_0x557c('0x23')](function(_0x28a799){var _0x1c982a=_0x5fef41[_0x557c('0x49')][_0x557c('0x24')]({'plain':!![]});if(!_0x1c982a)throw new Error(_0x557c('0x4a'));if(_0x1c982a[_0x557c('0x4b')]===_0x557c('0x49')){var _0x423fc6=_0x28a799[_0x557c('0x24')]({'plain':!![]});var _0x20176d=_0x557c('0x25');return db['UserProfileSection'][_0x557c('0x45')]({'where':{'name':_0x20176d,'userProfileId':_0x1c982a['userProfileId']},'raw':!![]})[_0x557c('0x23')](function(_0x145c4a){if(_0x145c4a&&_0x145c4a[_0x557c('0x4c')]===0x0){return db[_0x557c('0x26')][_0x557c('0x47')]({'name':_0x423fc6['name'],'resourceId':_0x423fc6['id'],'type':_0x145c4a[_0x557c('0x2a')],'sectionId':_0x145c4a['id']},{})['then'](function(){return _0x28a799;});}else{return _0x28a799;}})['catch'](function(_0x5818fb){logger[_0x557c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5818fb);throw _0x5818fb;});}return _0x28a799;})[_0x557c('0x23')](respondWithResult(_0xc2df47,0xc9))[_0x557c('0x46')](handleError(_0xc2df47,null));};exports['update']=function(_0x3a55c4,_0x38dfd3){if(_0x3a55c4[_0x557c('0x48')]['id']){delete _0x3a55c4[_0x557c('0x48')]['id'];}return db[_0x557c('0x2d')][_0x557c('0x45')]({'where':{'id':_0x3a55c4[_0x557c('0x44')]['id']}})[_0x557c('0x23')](handleEntityNotFound(_0x38dfd3,null))['then'](saveUpdates(_0x3a55c4[_0x557c('0x48')],null))[_0x557c('0x23')](respondWithResult(_0x38dfd3,null))['catch'](handleError(_0x38dfd3,null));};exports[_0x557c('0x22')]=function(_0x10fda4,_0x35702f){return db[_0x557c('0x2d')][_0x557c('0x45')]({'where':{'id':_0x10fda4[_0x557c('0x44')]['id']}})[_0x557c('0x23')](handleEntityNotFound(_0x35702f,null))[_0x557c('0x23')](removeEntity(_0x35702f,null))['catch'](handleError(_0x35702f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 427ecdf..1eb598f 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 _0xb7a0=['CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','models','VoiceChanSpy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','context','format','prefix','system','push','merge','Set'];(function(_0x6e222c,_0x4ea6a4){var _0x484826=function(_0x547613){while(--_0x547613){_0x6e222c['push'](_0x6e222c['shift']());}};_0x484826(++_0x4ea6a4);}(_0xb7a0,0xb4));var _0x0b7a=function(_0xeea09d,_0xd19fa2){_0xeea09d=_0xeea09d-0x0;var _0x321980=_0xb7a0[_0xeea09d];return _0x321980;};'use strict';var _=require(_0x0b7a('0x0'));var util=require(_0x0b7a('0x1'));var BPromise=require(_0x0b7a('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x731ff1,_0x33324c,_0x1a9263){var _0x2173a3=0x1;var _0x1c8ed0=[];var _0x199964={'context':_0x33324c[_0x0b7a('0x3')]||'from-sip','exten':util[_0x0b7a('0x4')]('%s%s',_0x731ff1[_0x0b7a('0x5')],_0x1a9263),'type':_0x0b7a('0x6'),'isApp':![],'ChanSpyId':_0x731ff1['id'],'UserId':_0x33324c['id']};_0x1c8ed0[_0x0b7a('0x7')](_[_0x0b7a('0x8')]({'app':_0x0b7a('0x9'),'appdata':util['format'](_0x0b7a('0xa'),_0x0b7a('0xb')),'priority':_0x2173a3++},_0x199964));if(_0x731ff1[_0x0b7a('0xc')]){_0x1c8ed0[_0x0b7a('0x7')](_[_0x0b7a('0x8')]({'app':_0x0b7a('0xd'),'appdata':util[_0x0b7a('0x4')](_0x0b7a('0xe'),_0x731ff1[_0x0b7a('0xf')]),'priority':_0x2173a3++},_0x199964));}if(_0x731ff1[_0x0b7a('0x10')]){_0x1c8ed0['push'](_['merge']({'app':_0x0b7a('0x11'),'appdata':_0x731ff1[_0x0b7a('0x12')],'priority':_0x2173a3++},_0x199964));}_0x1c8ed0['push'](_[_0x0b7a('0x8')]({'app':_0x0b7a('0x13'),'appdata':util[_0x0b7a('0x4')](_0x0b7a('0x14'),_0x33324c[_0x0b7a('0x15')],_0x731ff1[_0x0b7a('0x16')]?_0x731ff1[_0x0b7a('0x16')][_0x0b7a('0x17')](''):''),'priority':_0x2173a3++},_0x199964));if(_0x731ff1[_0x0b7a('0xc')]){_0x1c8ed0['push'](_[_0x0b7a('0x8')]({'app':_0x0b7a('0x18'),'priority':_0x2173a3++},_0x199964));}return _0x1c8ed0;};var getChanSpyApplications=function(_0x432aed,_0x3558a1){var _0x33c03c=[];for(var _0x35be15=0x0,_0x463ebb=0x1;_0x35be15<_0x3558a1[_0x0b7a('0x19')];_0x35be15++,_0x463ebb=0x1){_0x33c03c=_0x33c03c[_0x0b7a('0x1a')](getUserApplications(_0x432aed,_0x3558a1[_0x35be15],_0x3558a1[_0x35be15][_0x0b7a('0x1b')]));if(_0x3558a1[_0x35be15][_0x0b7a('0x1b')]!=_0x3558a1[_0x35be15][_0x0b7a('0x15')]){_0x33c03c=_0x33c03c[_0x0b7a('0x1a')](getUserApplications(_0x432aed,_0x3558a1[_0x35be15],_0x3558a1[_0x35be15][_0x0b7a('0x15')]));}}return _0x33c03c;};var getChanSpyPromise=function(_0x572b48,_0x1739f1){return new BPromise(function(_0x27feda,_0x20c611){return _0x572b48['User'][_0x0b7a('0x1c')]({'attributes':['id',_0x0b7a('0x15'),'internal'],'where':{'role':_0x0b7a('0x1d'),'chanspy':!![]},'raw':!![]})[_0x0b7a('0x1e')](function(_0x2bce58){if(_0x2bce58){return _0x27feda(getChanSpyApplications(_0x1739f1,_0x2bce58));}return _0x27feda([]);})[_0x0b7a('0x1f')](function(_0x3e873f){_0x20c611(_0x3e873f);});});};module[_0x0b7a('0x20')]=function(_0x52bcd3,_0x50d570){var _0x510f6d=_0x52bcd3[_0x0b7a('0x21')];return _0x52bcd3['define'](_0x0b7a('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x46b973,_0x5592ef,_0x21cf0b){return getChanSpyPromise(_0x510f6d,_0x46b973)[_0x0b7a('0x1e')](function(_0x1c3b26){if(_0x1c3b26&&_0x1c3b26[_0x0b7a('0x19')]){return _0x510f6d[_0x0b7a('0x23')]['bulkCreate'](_0x1c3b26);}})[_0x0b7a('0x1e')](function(){_0x21cf0b();})[_0x0b7a('0x1f')](function(_0x4d38ac){_0x21cf0b(_0x4d38ac);});},'afterUpdate':function(_0x1790ef,_0x6cc9ee,_0x1f29d9){return _0x510f6d[_0x0b7a('0x23')][_0x0b7a('0x24')]({'where':{'ChanSpyId':_0x1790ef['id']}})[_0x0b7a('0x1e')](function(){return getChanSpyPromise(_0x510f6d,_0x1790ef);})[_0x0b7a('0x1e')](function(_0x4bb0c9){if(_0x4bb0c9&&_0x4bb0c9[_0x0b7a('0x19')]){return _0x510f6d[_0x0b7a('0x23')][_0x0b7a('0x25')](_0x4bb0c9);}})[_0x0b7a('0x1e')](function(){_0x1f29d9();})[_0x0b7a('0x1f')](function(_0x559f45){_0x1f29d9(_0x559f45);});},'afterDestroy':function(_0xc3371b,_0x544617,_0x1a57a6){return _0x510f6d[_0x0b7a('0x23')][_0x0b7a('0x24')]({'where':{'ChanSpyId':_0xc3371b['id']}})[_0x0b7a('0x1e')](function(){_0x1a57a6();})[_0x0b7a('0x1f')](function(_0x577c4c){_0x1a57a6(_0x577c4c);});}}});}; \ No newline at end of file +var _0x6944=['destroy','VoiceExtension','lodash','bluebird','context','from-sip','format','system','push','merge','Set','chanspy','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','password','name','options','join','record','length','internal','concat','User','findAll','then','models','define','VoiceChanSpy','voice_chanspy','bulkCreate'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x6944,0x1d0));var _0x4694=function(_0x268f69,_0x1144fd){_0x268f69=_0x268f69-0x0;var _0x4aaf0e=_0x6944[_0x268f69];return _0x4aaf0e;};'use strict';var _=require(_0x4694('0x0'));var util=require('util');var BPromise=require(_0x4694('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x48328d,_0x54626f,_0x126e88){var _0x2fd4a1=0x1;var _0x1dc39a=[];var _0x540a10={'context':_0x54626f[_0x4694('0x2')]||_0x4694('0x3'),'exten':util[_0x4694('0x4')]('%s%s',_0x48328d['prefix'],_0x126e88),'type':_0x4694('0x5'),'isApp':![],'ChanSpyId':_0x48328d['id'],'UserId':_0x54626f['id']};_0x1dc39a[_0x4694('0x6')](_[_0x4694('0x7')]({'app':_0x4694('0x8'),'appdata':util[_0x4694('0x4')]('CDR(type)=%s',_0x4694('0x9')),'priority':_0x2fd4a1++},_0x540a10));if(_0x48328d['record']){_0x1dc39a['push'](_[_0x4694('0x7')]({'app':_0x4694('0xa'),'appdata':util[_0x4694('0x4')](_0x4694('0xb'),_0x48328d[_0x4694('0xc')]),'priority':_0x2fd4a1++},_0x540a10));}if(_0x48328d[_0x4694('0xd')]){_0x1dc39a[_0x4694('0x6')](_[_0x4694('0x7')]({'app':_0x4694('0xe'),'appdata':_0x48328d[_0x4694('0xf')],'priority':_0x2fd4a1++},_0x540a10));}_0x1dc39a[_0x4694('0x6')](_['merge']({'app':'ChanSpy','appdata':util[_0x4694('0x4')]('SIP/%s,%s',_0x54626f[_0x4694('0x10')],_0x48328d[_0x4694('0x11')]?_0x48328d[_0x4694('0x11')][_0x4694('0x12')](''):''),'priority':_0x2fd4a1++},_0x540a10));if(_0x48328d[_0x4694('0x13')]){_0x1dc39a['push'](_[_0x4694('0x7')]({'app':'StopMixMonitor','priority':_0x2fd4a1++},_0x540a10));}return _0x1dc39a;};var getChanSpyApplications=function(_0x271e95,_0x33f1c6){var _0x4f2378=[];for(var _0x2936a4=0x0,_0x281678=0x1;_0x2936a4<_0x33f1c6[_0x4694('0x14')];_0x2936a4++,_0x281678=0x1){_0x4f2378=_0x4f2378['concat'](getUserApplications(_0x271e95,_0x33f1c6[_0x2936a4],_0x33f1c6[_0x2936a4][_0x4694('0x15')]));if(_0x33f1c6[_0x2936a4][_0x4694('0x15')]!=_0x33f1c6[_0x2936a4][_0x4694('0x10')]){_0x4f2378=_0x4f2378[_0x4694('0x16')](getUserApplications(_0x271e95,_0x33f1c6[_0x2936a4],_0x33f1c6[_0x2936a4][_0x4694('0x10')]));}}return _0x4f2378;};var getChanSpyPromise=function(_0x519870,_0x4d960f){return new BPromise(function(_0x338369,_0x468c3f){return _0x519870[_0x4694('0x17')][_0x4694('0x18')]({'attributes':['id',_0x4694('0x10'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x4694('0x19')](function(_0x2421c2){if(_0x2421c2){return _0x338369(getChanSpyApplications(_0x4d960f,_0x2421c2));}return _0x338369([]);})['catch'](function(_0x2e4714){_0x468c3f(_0x2e4714);});});};module['exports']=function(_0x858297,_0x388d6d){var _0x19465e=_0x858297[_0x4694('0x1a')];return _0x858297[_0x4694('0x1b')](_0x4694('0x1c'),attributes,{'tableName':_0x4694('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a1458,_0x2de2b3,_0x5010bb){return getChanSpyPromise(_0x19465e,_0x4a1458)[_0x4694('0x19')](function(_0x4cc317){if(_0x4cc317&&_0x4cc317['length']){return _0x19465e['VoiceExtension'][_0x4694('0x1e')](_0x4cc317);}})[_0x4694('0x19')](function(){_0x5010bb();})['catch'](function(_0x5c838b){_0x5010bb(_0x5c838b);});},'afterUpdate':function(_0x48b2e9,_0x3ecb5f,_0x57f448){return _0x19465e['VoiceExtension'][_0x4694('0x1f')]({'where':{'ChanSpyId':_0x48b2e9['id']}})[_0x4694('0x19')](function(){return getChanSpyPromise(_0x19465e,_0x48b2e9);})['then'](function(_0x7211c1){if(_0x7211c1&&_0x7211c1[_0x4694('0x14')]){return _0x19465e[_0x4694('0x20')][_0x4694('0x1e')](_0x7211c1);}})[_0x4694('0x19')](function(){_0x57f448();})['catch'](function(_0x495960){_0x57f448(_0x495960);});},'afterDestroy':function(_0x1c7eaf,_0x5e0656,_0x3965e6){return _0x19465e['VoiceExtension'][_0x4694('0x1f')]({'where':{'ChanSpyId':_0x1c7eaf['id']}})[_0x4694('0x19')](function(){_0x3965e6();})['catch'](function(_0x45d47a){_0x3965e6(_0x45d47a);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e9677db..bf58535 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 _0x0e1c=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0e1c,0x1b3));var _0xc0e1=function(_0x3bc8b5,_0x1e3ed3){_0x3bc8b5=_0x3bc8b5-0x0;var _0x5211af=_0x0e1c[_0x3bc8b5];return _0x5211af;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0e1('0x0'));var BPromise=require(_0xc0e1('0x1'));var rs=require(_0xc0e1('0x2'));var fs=require('fs');var Redis=require(_0xc0e1('0x3'));var db=require(_0xc0e1('0x4'))['db'];var utils=require(_0xc0e1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc0e1('0x6'));var jayson=require(_0xc0e1('0x7'));var client=jayson[_0xc0e1('0x8')][_0xc0e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x79f8f2,_0x6733ec,_0x36747d){return new BPromise(function(_0x3e165b,_0x302971){return client[_0xc0e1('0xa')](_0x79f8f2,_0x36747d)[_0xc0e1('0xb')](function(_0x35b16b){logger[_0xc0e1('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x6733ec,_0xc0e1('0xd'));logger[_0xc0e1('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x6733ec,_0xc0e1('0xd'),JSON[_0xc0e1('0xf')](_0x35b16b));if(_0x35b16b[_0xc0e1('0x10')]){if(_0x35b16b[_0xc0e1('0x10')][_0xc0e1('0x11')]===0x1f4){logger[_0xc0e1('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x6733ec,_0x35b16b[_0xc0e1('0x10')][_0xc0e1('0x12')]);return _0x302971(_0x35b16b[_0xc0e1('0x10')][_0xc0e1('0x12')]);}logger[_0xc0e1('0x10')](_0xc0e1('0x13'),_0x6733ec,_0x35b16b[_0xc0e1('0x10')][_0xc0e1('0x12')]);return _0x3e165b(_0x35b16b[_0xc0e1('0x10')][_0xc0e1('0x12')]);}else{logger[_0xc0e1('0xc')](_0xc0e1('0x13'),_0x6733ec,_0xc0e1('0xd'));_0x3e165b(_0x35b16b[_0xc0e1('0x14')]['message']);}})[_0xc0e1('0x15')](function(_0x5ea1a0){logger[_0xc0e1('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x6733ec,_0x5ea1a0);_0x302971(_0x5ea1a0);});});} \ No newline at end of file +var _0x68f1=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x26a561,_0x478cc3){var _0x2cfb51=function(_0x3c8647){while(--_0x3c8647){_0x26a561['push'](_0x26a561['shift']());}};_0x2cfb51(++_0x478cc3);}(_0x68f1,0x155));var _0x168f=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x68f1[_0xa4b8e1];return _0x507e42;};'use strict';var _=require(_0x168f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x168f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x168f('0x2'))(_0x168f('0x3'));var config=require(_0x168f('0x4'));var jayson=require(_0x168f('0x5'));var client=jayson['client'][_0x168f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2cf7a2,_0x43dcd9,_0x40bb08){return new BPromise(function(_0x402a65,_0x682d5f){return client[_0x168f('0x7')](_0x2cf7a2,_0x40bb08)[_0x168f('0x8')](function(_0x138cc0){logger[_0x168f('0x9')](_0x168f('0xa'),_0x43dcd9,'request\x20sent');logger[_0x168f('0xb')](_0x168f('0xc'),_0x43dcd9,_0x168f('0xd'),JSON[_0x168f('0xe')](_0x138cc0));if(_0x138cc0[_0x168f('0xf')]){if(_0x138cc0[_0x168f('0xf')]['code']===0x1f4){logger[_0x168f('0xf')](_0x168f('0xa'),_0x43dcd9,_0x138cc0['error'][_0x168f('0x10')]);return _0x682d5f(_0x138cc0['error'][_0x168f('0x10')]);}logger[_0x168f('0xf')](_0x168f('0xa'),_0x43dcd9,_0x138cc0[_0x168f('0xf')][_0x168f('0x10')]);return _0x402a65(_0x138cc0[_0x168f('0xf')]['message']);}else{logger[_0x168f('0x9')]('VoiceChanSpy,\x20%s,\x20%s',_0x43dcd9,_0x168f('0xd'));_0x402a65(_0x138cc0[_0x168f('0x11')][_0x168f('0x10')]);}})['catch'](function(_0xf592bd){logger[_0x168f('0xf')](_0x168f('0xa'),_0x43dcd9,_0xf592bd);_0x682d5f(_0xf592bd);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2988afa..3c58be6 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 _0xe394=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x435d6e,_0x3edf13){var _0x35e0ea=function(_0x579da1){while(--_0x579da1){_0x435d6e['push'](_0x435d6e['shift']());}};_0x35e0ea(++_0x3edf13);}(_0xe394,0x1ca));var _0x4e39=function(_0x1f77af,_0x5b5029){_0x1f77af=_0x1f77af-0x0;var _0x4298a7=_0xe394[_0x1f77af];return _0x4298a7;};'use strict';var multer=require(_0x4e39('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e39('0x1'));var router=express[_0x4e39('0x2')]();var auth=require(_0x4e39('0x3'));var interaction=require(_0x4e39('0x4'));var config=require('../../config/environment');var controller=require(_0x4e39('0x5'));router[_0x4e39('0x6')]('/',auth[_0x4e39('0x7')](),controller['index']);router['get'](_0x4e39('0x8'),auth[_0x4e39('0x7')](),controller[_0x4e39('0x9')]);router[_0x4e39('0xa')]('/',auth[_0x4e39('0x7')](),controller[_0x4e39('0xb')]);router[_0x4e39('0xc')](_0x4e39('0x8'),auth['isAuthenticated'](),controller[_0x4e39('0xd')]);router[_0x4e39('0xe')](_0x4e39('0x8'),auth[_0x4e39('0x7')](),controller[_0x4e39('0xf')]);module[_0x4e39('0x10')]=router; \ No newline at end of file +var _0x3736=['post','create','put','/:id','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0x31b224,_0x4e7564){var _0x55062b=function(_0x83457a){while(--_0x83457a){_0x31b224['push'](_0x31b224['shift']());}};_0x55062b(++_0x4e7564);}(_0x3736,0x1d3));var _0x6373=function(_0x20b092,_0x2370a3){_0x20b092=_0x20b092-0x0;var _0x597066=_0x3736[_0x20b092];return _0x597066;};'use strict';var multer=require(_0x6373('0x0'));var util=require('util');var path=require(_0x6373('0x1'));var timeout=require('connect-timeout');var express=require(_0x6373('0x2'));var router=express['Router']();var auth=require(_0x6373('0x3'));var interaction=require(_0x6373('0x4'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x6373('0x5')]('/',auth[_0x6373('0x6')](),controller[_0x6373('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6373('0x8')]);router[_0x6373('0x9')]('/',auth[_0x6373('0x6')](),controller[_0x6373('0xa')]);router[_0x6373('0xb')](_0x6373('0xc'),auth[_0x6373('0x6')](),controller[_0x6373('0xd')]);router[_0x6373('0xe')]('/:id',auth[_0x6373('0x6')](),controller[_0x6373('0xf')]);module[_0x6373('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ed239c3..a322fa1 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(_0xc983d0,_0x1b3127){var _0x13c6e5=function(_0x49dcca){while(--_0x49dcca){_0xc983d0['push'](_0xc983d0['shift']());}};_0x13c6e5(++_0x1b3127);}(_0x34e8,0x12c));var _0x834e=function(_0x5d95b1,_0x37b771){_0x5d95b1=_0x5d95b1-0x0;var _0x35f1d9=_0x34e8[_0x5d95b1];return _0x35f1d9;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0xadf368,_0x5a5863){var _0x41a61e=function(_0x53c5be){while(--_0x53c5be){_0xadf368['push'](_0xadf368['shift']());}};_0x41a61e(++_0x5a5863);}(_0x3e74,0x175));var _0x43e7=function(_0x46a209,_0x475af4){_0x46a209=_0x46a209-0x0;var _0xd1e0ef=_0x3e74[_0x46a209];return _0xd1e0ef;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index a582617..bb3c24a 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 _0xe381=['query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','merge','field','filter','options','count','includeAll','include','rows','show','params','find','create','body','findAll','readFileSync','join','server/files/templates/context.ejs','utf8','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','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','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','sendStatus','name','send','index','VoiceContext','rawAttributes','keys'];(function(_0x5c662c,_0x3249a8){var _0x1d8f3c=function(_0x25f2d0){while(--_0x25f2d0){_0x5c662c['push'](_0x5c662c['shift']());}};_0x1d8f3c(++_0x3249a8);}(_0xe381,0xf1));var _0x1e38=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xe381[_0x4792c8];return _0x35edb1;};'use strict';var pdf=require(_0x1e38('0x0'));var emlformat=require(_0x1e38('0x1'));var rimraf=require(_0x1e38('0x2'));var zipdir=require(_0x1e38('0x3'));var jsonpatch=require(_0x1e38('0x4'));var rp=require(_0x1e38('0x5'));var moment=require(_0x1e38('0x6'));var BPromise=require(_0x1e38('0x7'));var Mustache=require(_0x1e38('0x8'));var util=require('util');var path=require(_0x1e38('0x9'));var sox=require(_0x1e38('0xa'));var csv=require('to-csv');var ejs=require(_0x1e38('0xb'));var fs=require('fs');var _=require(_0x1e38('0xc'));var squel=require(_0x1e38('0xd'));var crypto=require(_0x1e38('0xe'));var jsforce=require(_0x1e38('0xf'));var deskjs=require(_0x1e38('0x10'));var toCsv=require(_0x1e38('0x11'));var querystring=require('querystring');var Papa=require(_0x1e38('0x12'));var Redis=require(_0x1e38('0x13'));var authService=require(_0x1e38('0x14'));var qs=require(_0x1e38('0x15'));var hardwareService=require(_0x1e38('0x16'));var logger=require('../../config/logger')(_0x1e38('0x17'));var utils=require(_0x1e38('0x18'));var config=require(_0x1e38('0x19'));var db=require(_0x1e38('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3c3115,_0x180fff,_0x504b8a){if(_0x504b8a){var _0x18daf3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18daf3[_0x1e38('0x1b')](_0x180fff)){return _0x3c3115;}else{throw new db[(_0x1e38('0x1c'))][(_0x1e38('0x1d'))](_0x1e38('0x1e'));}}else{return _0x3c3115;}}function respondWithRpcPromise(_0x470673,_0x348bd5,_0x270845,_0x167b12){return new BPromise(function(_0x3ab046,_0x59958c){var _0x37f98d=_0x167b12||client;return _0x37f98d['request'](_0x470673,_0x270845)[_0x1e38('0x1f')](function(_0x5cf84d){logger[_0x1e38('0x20')](_0x1e38('0x21'),_0x348bd5,_0x1e38('0x22'));logger[_0x1e38('0x23')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x348bd5,_0x1e38('0x22'),JSON['stringify'](_0x5cf84d));if(_0x5cf84d[_0x1e38('0x24')]){if(_0x5cf84d[_0x1e38('0x24')]['code']===0x1f4){logger[_0x1e38('0x24')](_0x1e38('0x21'),_0x348bd5,_0x5cf84d[_0x1e38('0x24')]['message']);return _0x59958c(_0x5cf84d['error'][_0x1e38('0x25')]);}logger[_0x1e38('0x24')](_0x1e38('0x21'),_0x348bd5,_0x5cf84d[_0x1e38('0x24')][_0x1e38('0x25')]);return _0x3ab046(_0x5cf84d['error']['message']);}else{logger[_0x1e38('0x20')](_0x1e38('0x21'),_0x348bd5,'request\x20sent');_0x3ab046(_0x5cf84d['result'][_0x1e38('0x25')]);}})[_0x1e38('0x26')](function(_0x21495e){logger[_0x1e38('0x24')]('VoiceContext,\x20%s,\x20%s',_0x348bd5,_0x21495e);_0x59958c(_0x21495e);});});}function respondWithStatusCode(_0x17083a,_0x44086b){_0x44086b=_0x44086b||0xcc;return function(_0x3bfffe){if(_0x3bfffe){return _0x17083a['sendStatus'](_0x44086b);}return _0x17083a[_0x1e38('0x27')](_0x44086b)[_0x1e38('0x28')]();};}function respondWithResult(_0x3ff5f1,_0x4f34a0){_0x4f34a0=_0x4f34a0||0xc8;return function(_0x3b0db1){if(_0x3b0db1){return _0x3ff5f1[_0x1e38('0x27')](_0x4f34a0)[_0x1e38('0x29')](_0x3b0db1);}};}function respondWithFilteredResult(_0x4ae725,_0x3871d0){return function(_0x4ef5c2){if(_0x4ef5c2){var _0x2dcc3c=_0x4ef5c2['count'],_0x71a284=_0x3871d0[_0x1e38('0x2a')],_0x2b4a3a=_0x3871d0[_0x1e38('0x2a')]+_0x3871d0[_0x1e38('0x2b')],_0x35e3cb;if(_0x2b4a3a>=_0x2dcc3c){_0x2b4a3a=_0x2dcc3c;_0x35e3cb=0xc8;}else{_0x35e3cb=0xce;}_0x4ae725[_0x1e38('0x27')](_0x35e3cb);return _0x4ae725[_0x1e38('0x2c')](_0x1e38('0x2d'),_0x71a284+'-'+_0x2b4a3a+'/'+_0x2dcc3c)[_0x1e38('0x29')](_0x4ef5c2);}return null;};}function patchUpdates(_0x130f9a){return function(_0x135da1){try{jsonpatch[_0x1e38('0x2e')](_0x135da1,_0x130f9a,!![]);}catch(_0x45d612){return BPromise[_0x1e38('0x2f')](_0x45d612);}return _0x135da1[_0x1e38('0x30')]();};}function saveUpdates(_0x194292,_0x4e415d){return function(_0x421eac){if(_0x421eac){return _0x421eac[_0x1e38('0x31')](_0x194292)[_0x1e38('0x1f')](function(_0x2fc3c0){return _0x2fc3c0;});}return null;};}function removeEntity(_0x47174a,_0x1a989b){return function(_0x48f858){if(_0x48f858){return _0x48f858[_0x1e38('0x32')]()['then'](function(){var _0x502f36=_0x48f858[_0x1e38('0x33')]({'plain':!![]});var _0xa5f6d8='Contexts';return db['UserProfileResource']['destroy']({'where':{'type':_0xa5f6d8,'resourceId':_0x502f36['id']}})[_0x1e38('0x1f')](function(){return _0x48f858;});})[_0x1e38('0x1f')](function(){_0x47174a[_0x1e38('0x27')](0xcc)[_0x1e38('0x28')]();});}};}function handleEntityNotFound(_0x16ba84,_0xb3685e){return function(_0x356457){if(!_0x356457){_0x16ba84[_0x1e38('0x34')](0x194);}return _0x356457;};}function handleError(_0xd9e0c7,_0x3e82fa){_0x3e82fa=_0x3e82fa||0x1f4;return function(_0x30304d){logger[_0x1e38('0x24')](_0x30304d['stack']);if(_0x30304d[_0x1e38('0x35')]){delete _0x30304d[_0x1e38('0x35')];}_0xd9e0c7[_0x1e38('0x27')](_0x3e82fa)[_0x1e38('0x36')](_0x30304d);};}exports[_0x1e38('0x37')]=function(_0x2e2115,_0x2f821c){var _0x35ea31={},_0x3e78c2={},_0x203b37={'count':0x0,'rows':[]};var _0x46f1a7=db[_0x1e38('0x38')][_0x1e38('0x39')];_0x3e78c2['model']=_[_0x1e38('0x3a')](_0x46f1a7);_0x3e78c2[_0x1e38('0x3b')]=_['keys'](_0x2e2115[_0x1e38('0x3b')]);_0x3e78c2[_0x1e38('0x3c')]=_[_0x1e38('0x3d')](_0x3e78c2['model'],_0x3e78c2['query']);_0x35ea31[_0x1e38('0x3e')]=_[_0x1e38('0x3d')](_0x3e78c2['model'],qs[_0x1e38('0x3f')](_0x2e2115[_0x1e38('0x3b')][_0x1e38('0x3f')]));_0x35ea31[_0x1e38('0x3e')]=_0x35ea31[_0x1e38('0x3e')][_0x1e38('0x40')]?_0x35ea31['attributes']:_0x3e78c2[_0x1e38('0x41')];if(!_0x2e2115['query'][_0x1e38('0x42')](_0x1e38('0x43'))){_0x35ea31[_0x1e38('0x2b')]=qs[_0x1e38('0x2b')](_0x2e2115[_0x1e38('0x3b')][_0x1e38('0x2b')]);_0x35ea31[_0x1e38('0x2a')]=qs[_0x1e38('0x2a')](_0x2e2115[_0x1e38('0x3b')][_0x1e38('0x2a')]);}_0x35ea31['order']=qs[_0x1e38('0x44')](_0x2e2115[_0x1e38('0x3b')][_0x1e38('0x44')]);_0x35ea31[_0x1e38('0x45')]=qs['filters'](_[_0x1e38('0x46')](_0x2e2115[_0x1e38('0x3b')],_0x3e78c2[_0x1e38('0x3c')]));if(_0x2e2115['query']['filter']){_0x35ea31[_0x1e38('0x45')]=_[_0x1e38('0x47')](_0x35ea31[_0x1e38('0x45')],{'$or':_['map'](_0x46f1a7,function(_0x3fcefa){if(_0x3fcefa['type']['key']!=='VIRTUAL'){var _0x2d1498={};_0x2d1498[_0x3fcefa[_0x1e38('0x48')]]={'$like':'%'+_0x2e2115[_0x1e38('0x3b')][_0x1e38('0x49')]+'%'};return _0x2d1498;}})});}_0x35ea31=_['merge']({},_0x35ea31,_0x2e2115[_0x1e38('0x4a')]);var _0x3bdbf1={'where':_0x35ea31[_0x1e38('0x45')]};return db['VoiceContext'][_0x1e38('0x4b')](_0x3bdbf1)[_0x1e38('0x1f')](function(_0x868544){_0x203b37[_0x1e38('0x4b')]=_0x868544;if(_0x2e2115['query'][_0x1e38('0x4c')]){_0x35ea31[_0x1e38('0x4d')]=[{'all':!![]}];}return db[_0x1e38('0x38')]['findAll'](_0x35ea31);})['then'](function(_0x355e9f){_0x203b37[_0x1e38('0x4e')]=_0x355e9f;return _0x203b37;})['then'](respondWithFilteredResult(_0x2f821c,_0x35ea31))[_0x1e38('0x26')](handleError(_0x2f821c,null));};exports[_0x1e38('0x4f')]=function(_0x172353,_0xaa994e){var _0x5a4c87={'raw':![],'where':{'id':_0x172353[_0x1e38('0x50')]['id']}},_0x10a894={};_0x10a894['model']=_[_0x1e38('0x3a')](db[_0x1e38('0x38')][_0x1e38('0x39')]);_0x10a894[_0x1e38('0x3b')]=_[_0x1e38('0x3a')](_0x172353[_0x1e38('0x3b')]);_0x10a894[_0x1e38('0x3c')]=_[_0x1e38('0x3d')](_0x10a894[_0x1e38('0x41')],_0x10a894[_0x1e38('0x3b')]);_0x5a4c87['attributes']=_[_0x1e38('0x3d')](_0x10a894[_0x1e38('0x41')],qs['fields'](_0x172353['query'][_0x1e38('0x3f')]));_0x5a4c87[_0x1e38('0x3e')]=_0x5a4c87[_0x1e38('0x3e')]['length']?_0x5a4c87['attributes']:_0x10a894[_0x1e38('0x41')];if(_0x172353[_0x1e38('0x3b')][_0x1e38('0x4c')]){_0x5a4c87[_0x1e38('0x4d')]=[{'all':!![]}];}_0x5a4c87=_[_0x1e38('0x47')]({},_0x5a4c87,_0x172353[_0x1e38('0x4a')]);return db[_0x1e38('0x38')][_0x1e38('0x51')](_0x5a4c87)[_0x1e38('0x1f')](handleEntityNotFound(_0xaa994e,null))[_0x1e38('0x1f')](respondWithResult(_0xaa994e,null))[_0x1e38('0x26')](handleError(_0xaa994e,null));};exports[_0x1e38('0x52')]=function(_0x3c2fca,_0xc68636,_0x5e2606){var _0x18a225;return db[_0x1e38('0x38')][_0x1e38('0x52')](_0x3c2fca[_0x1e38('0x53')],{'raw':!![]})[_0x1e38('0x1f')](function(_0x5ac26e){_0x18a225=_0x5ac26e;return db[_0x1e38('0x38')][_0x1e38('0x54')]({'raw':!![]});})[_0x1e38('0x1f')](function(_0x1f5b07){var _0x3ae317=fs[_0x1e38('0x55')](path[_0x1e38('0x56')](config['root'],_0x1e38('0x57')),_0x1e38('0x58'));var _0x103d8d=ejs['render'](_0x3ae317,{'contexts':_0x1f5b07||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x103d8d);})[_0x1e38('0x1f')](function(){return respondWithRpcPromise(_0x1e38('0x59'),_0x1e38('0x52'),{'module':_0x1e38('0x5a')});})[_0x1e38('0x1f')](function(){var _0xb55d93=_0x3c2fca[_0x1e38('0x5b')]['get']({'plain':!![]});if(!_0xb55d93)throw new Error(_0x1e38('0x5c'));if(_0xb55d93[_0x1e38('0x5d')]===_0x1e38('0x5b')){var _0x3765be=_0x18a225[_0x1e38('0x33')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Contexts','userProfileId':_0xb55d93[_0x1e38('0x5e')]},'raw':!![]})['then'](function(_0x4e33a7){if(_0x4e33a7&&_0x4e33a7['autoAssociation']===0x0){return db[_0x1e38('0x5f')][_0x1e38('0x52')]({'name':_0x3765be[_0x1e38('0x35')],'resourceId':_0x3765be['id'],'type':_0x4e33a7[_0x1e38('0x35')],'sectionId':_0x4e33a7['id']},{})['then'](function(){return _0x18a225;});}else{return _0x18a225;}})[_0x1e38('0x26')](function(_0xf8f9a1){logger[_0x1e38('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf8f9a1);throw _0xf8f9a1;});}return _0x18a225;})[_0x1e38('0x1f')](respondWithResult(_0xc68636,0xc9))[_0x1e38('0x26')](handleError(_0xc68636,null));};exports[_0x1e38('0x31')]=function(_0x192a2c,_0x3545d9,_0x2b2588){var _0x1435b9;return db[_0x1e38('0x38')]['find']({'where':{'id':_0x192a2c['params']['id']}})[_0x1e38('0x1f')](handleEntityNotFound(_0x3545d9,null))[_0x1e38('0x1f')](saveUpdates(_0x192a2c['body'],null))['then'](function(_0x519252){if(_0x519252){_0x1435b9=_0x519252;return db[_0x1e38('0x38')][_0x1e38('0x54')]({'raw':!![]});}})['then'](function(_0x5e982c){var _0x4c0780=fs[_0x1e38('0x55')](path[_0x1e38('0x56')](config[_0x1e38('0x60')],'server/files/templates/context.ejs'),_0x1e38('0x58'));var _0x18dda2=ejs[_0x1e38('0x61')](_0x4c0780,{'contexts':_0x5e982c||[]});fs[_0x1e38('0x62')](_0x1e38('0x63'),_0x18dda2);})['then'](function(){return respondWithRpcPromise('Reload',_0x1e38('0x31'),{'module':_0x1e38('0x5a')});})[_0x1e38('0x1f')](function(){return _0x1435b9;})[_0x1e38('0x1f')](respondWithResult(_0x3545d9,null))[_0x1e38('0x26')](handleError(_0x3545d9,null));};exports['destroy']=function(_0x2235fb,_0x5817bf,_0x1416db){var _0x194630;return db[_0x1e38('0x38')][_0x1e38('0x51')]({'where':{'id':_0x2235fb[_0x1e38('0x50')]['id']}})['then'](handleEntityNotFound(_0x5817bf,null))[_0x1e38('0x1f')](removeEntity(_0x5817bf,null))[_0x1e38('0x1f')](function(){return db[_0x1e38('0x38')][_0x1e38('0x54')]({'raw':!![]});})['then'](function(_0x4589db){var _0x224621=fs[_0x1e38('0x55')](path[_0x1e38('0x56')](config[_0x1e38('0x60')],_0x1e38('0x57')),_0x1e38('0x58'));var _0x3c3cf5=ejs[_0x1e38('0x61')](_0x224621,{'contexts':_0x4589db});fs['writeFileSync'](_0x1e38('0x63'),_0x3c3cf5);return respondWithRpcPromise(_0x1e38('0x59'),_0x1e38('0x32'),{'module':_0x1e38('0x5a')});})[_0x1e38('0x26')](handleError(_0x5817bf,null));}; \ No newline at end of file +var _0x9b8a=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','readFileSync','join','Reload','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','save','destroy','get','UserProfileResource','stack','name','rawAttributes','model','keys','query','intersection','attributes','fields','length','nolimit','order','where','filters','filter','merge','map','VIRTUAL','VoiceContext','include','findAll','rows','show','params','options','find','create','body','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','Contexts','userProfileId'];(function(_0x1c9b46,_0x458d2e){var _0x41bae2=function(_0x383d8b){while(--_0x383d8b){_0x1c9b46['push'](_0x1c9b46['shift']());}};_0x41bae2(++_0x458d2e);}(_0x9b8a,0x1d6));var _0xa9b8=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0x9b8a[_0x22bee0];return _0x2d295b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa9b8('0x0'));var rimraf=require(_0xa9b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9b8('0x2'));var rp=require(_0xa9b8('0x3'));var moment=require(_0xa9b8('0x4'));var BPromise=require(_0xa9b8('0x5'));var Mustache=require(_0xa9b8('0x6'));var util=require(_0xa9b8('0x7'));var path=require(_0xa9b8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9b8('0x9'));var fs=require('fs');var _=require(_0xa9b8('0xa'));var squel=require(_0xa9b8('0xb'));var crypto=require(_0xa9b8('0xc'));var jsforce=require(_0xa9b8('0xd'));var deskjs=require(_0xa9b8('0xe'));var toCsv=require(_0xa9b8('0xf'));var querystring=require('querystring');var Papa=require(_0xa9b8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xa9b8('0x11'));var logger=require('../../config/logger')(_0xa9b8('0x12'));var utils=require(_0xa9b8('0x13'));var config=require(_0xa9b8('0x14'));var db=require(_0xa9b8('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa9b8('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3170ca,_0x4dc6df,_0x20fc2c){if(_0x20fc2c){var _0xaa0bdc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xaa0bdc['test'](_0x4dc6df)){return _0x3170ca;}else{throw new db['Sequelize'][(_0xa9b8('0x17'))](_0xa9b8('0x18'));}}else{return _0x3170ca;}}function respondWithRpcPromise(_0x16a418,_0x2a8042,_0x50de73,_0x4a9a2d){return new BPromise(function(_0x633dc1,_0x2de416){var _0x52ba53=_0x4a9a2d||client;return _0x52ba53[_0xa9b8('0x19')](_0x16a418,_0x50de73)[_0xa9b8('0x1a')](function(_0x232a8c){logger[_0xa9b8('0x1b')](_0xa9b8('0x1c'),_0x2a8042,_0xa9b8('0x1d'));logger[_0xa9b8('0x1e')](_0xa9b8('0x1f'),_0x2a8042,'request\x20sent',JSON['stringify'](_0x232a8c));if(_0x232a8c[_0xa9b8('0x20')]){if(_0x232a8c[_0xa9b8('0x20')][_0xa9b8('0x21')]===0x1f4){logger[_0xa9b8('0x20')](_0xa9b8('0x1c'),_0x2a8042,_0x232a8c['error'][_0xa9b8('0x22')]);return _0x2de416(_0x232a8c[_0xa9b8('0x20')][_0xa9b8('0x22')]);}logger['error'](_0xa9b8('0x1c'),_0x2a8042,_0x232a8c['error'][_0xa9b8('0x22')]);return _0x633dc1(_0x232a8c[_0xa9b8('0x20')][_0xa9b8('0x22')]);}else{logger[_0xa9b8('0x1b')](_0xa9b8('0x1c'),_0x2a8042,_0xa9b8('0x1d'));_0x633dc1(_0x232a8c[_0xa9b8('0x23')][_0xa9b8('0x22')]);}})[_0xa9b8('0x24')](function(_0x1ce93b){logger[_0xa9b8('0x20')](_0xa9b8('0x1c'),_0x2a8042,_0x1ce93b);_0x2de416(_0x1ce93b);});});}function respondWithStatusCode(_0x28efbe,_0x5cb9d1){_0x5cb9d1=_0x5cb9d1||0xcc;return function(_0x58e394){if(_0x58e394){return _0x28efbe[_0xa9b8('0x25')](_0x5cb9d1);}return _0x28efbe[_0xa9b8('0x26')](_0x5cb9d1)['end']();};}function respondWithResult(_0x39a459,_0x43b0fd){_0x43b0fd=_0x43b0fd||0xc8;return function(_0x1c79ce){if(_0x1c79ce){return _0x39a459[_0xa9b8('0x26')](_0x43b0fd)[_0xa9b8('0x27')](_0x1c79ce);}};}function respondWithFilteredResult(_0x3b0ac1,_0x15b29b){return function(_0x501fc9){if(_0x501fc9){var _0x3b4a88=_0x501fc9[_0xa9b8('0x28')],_0x4de06b=_0x15b29b[_0xa9b8('0x29')],_0xe282ba=_0x15b29b[_0xa9b8('0x29')]+_0x15b29b[_0xa9b8('0x2a')],_0x57e597;if(_0xe282ba>=_0x3b4a88){_0xe282ba=_0x3b4a88;_0x57e597=0xc8;}else{_0x57e597=0xce;}_0x3b0ac1[_0xa9b8('0x26')](_0x57e597);return _0x3b0ac1[_0xa9b8('0x2b')]('Content-Range',_0x4de06b+'-'+_0xe282ba+'/'+_0x3b4a88)['json'](_0x501fc9);}return null;};}function patchUpdates(_0x2f5380){return function(_0x1b33da){try{jsonpatch[_0xa9b8('0x2c')](_0x1b33da,_0x2f5380,!![]);}catch(_0x5abd07){return BPromise['reject'](_0x5abd07);}return _0x1b33da[_0xa9b8('0x2d')]();};}function saveUpdates(_0x52c131,_0x5b3e4d){return function(_0x330b40){if(_0x330b40){return _0x330b40['update'](_0x52c131)['then'](function(_0x10a48f){return _0x10a48f;});}return null;};}function removeEntity(_0x2b16f1,_0x4e349a){return function(_0x315ffb){if(_0x315ffb){return _0x315ffb[_0xa9b8('0x2e')]()[_0xa9b8('0x1a')](function(){var _0x1e10a6=_0x315ffb[_0xa9b8('0x2f')]({'plain':!![]});var _0x3fb380='Contexts';return db[_0xa9b8('0x30')][_0xa9b8('0x2e')]({'where':{'type':_0x3fb380,'resourceId':_0x1e10a6['id']}})['then'](function(){return _0x315ffb;});})[_0xa9b8('0x1a')](function(){_0x2b16f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d6bc8,_0x2e027d){return function(_0x1fe7e6){if(!_0x1fe7e6){_0x3d6bc8[_0xa9b8('0x25')](0x194);}return _0x1fe7e6;};}function handleError(_0x110948,_0x257dde){_0x257dde=_0x257dde||0x1f4;return function(_0x5d6001){logger[_0xa9b8('0x20')](_0x5d6001[_0xa9b8('0x31')]);if(_0x5d6001[_0xa9b8('0x32')]){delete _0x5d6001[_0xa9b8('0x32')];}_0x110948[_0xa9b8('0x26')](_0x257dde)['send'](_0x5d6001);};}exports['index']=function(_0x479b6b,_0x28d3ee){var _0x35afc8={},_0x1b2475={},_0x37a322={'count':0x0,'rows':[]};var _0x448c33=db['VoiceContext'][_0xa9b8('0x33')];_0x1b2475[_0xa9b8('0x34')]=_[_0xa9b8('0x35')](_0x448c33);_0x1b2475[_0xa9b8('0x36')]=_[_0xa9b8('0x35')](_0x479b6b[_0xa9b8('0x36')]);_0x1b2475['filters']=_[_0xa9b8('0x37')](_0x1b2475[_0xa9b8('0x34')],_0x1b2475['query']);_0x35afc8[_0xa9b8('0x38')]=_[_0xa9b8('0x37')](_0x1b2475[_0xa9b8('0x34')],qs['fields'](_0x479b6b[_0xa9b8('0x36')][_0xa9b8('0x39')]));_0x35afc8[_0xa9b8('0x38')]=_0x35afc8[_0xa9b8('0x38')][_0xa9b8('0x3a')]?_0x35afc8[_0xa9b8('0x38')]:_0x1b2475[_0xa9b8('0x34')];if(!_0x479b6b[_0xa9b8('0x36')]['hasOwnProperty'](_0xa9b8('0x3b'))){_0x35afc8['limit']=qs[_0xa9b8('0x2a')](_0x479b6b[_0xa9b8('0x36')]['limit']);_0x35afc8[_0xa9b8('0x29')]=qs['offset'](_0x479b6b[_0xa9b8('0x36')][_0xa9b8('0x29')]);}_0x35afc8[_0xa9b8('0x3c')]=qs['sort'](_0x479b6b[_0xa9b8('0x36')]['sort']);_0x35afc8[_0xa9b8('0x3d')]=qs[_0xa9b8('0x3e')](_['pick'](_0x479b6b[_0xa9b8('0x36')],_0x1b2475[_0xa9b8('0x3e')]));if(_0x479b6b['query'][_0xa9b8('0x3f')]){_0x35afc8['where']=_[_0xa9b8('0x40')](_0x35afc8['where'],{'$or':_[_0xa9b8('0x41')](_0x448c33,function(_0x5882a6){if(_0x5882a6['type']['key']!==_0xa9b8('0x42')){var _0x36245a={};_0x36245a[_0x5882a6['field']]={'$like':'%'+_0x479b6b[_0xa9b8('0x36')][_0xa9b8('0x3f')]+'%'};return _0x36245a;}})});}_0x35afc8=_[_0xa9b8('0x40')]({},_0x35afc8,_0x479b6b['options']);var _0x19c5a5={'where':_0x35afc8[_0xa9b8('0x3d')]};return db[_0xa9b8('0x43')][_0xa9b8('0x28')](_0x19c5a5)['then'](function(_0x42b90e){_0x37a322[_0xa9b8('0x28')]=_0x42b90e;if(_0x479b6b[_0xa9b8('0x36')]['includeAll']){_0x35afc8[_0xa9b8('0x44')]=[{'all':!![]}];}return db['VoiceContext'][_0xa9b8('0x45')](_0x35afc8);})[_0xa9b8('0x1a')](function(_0x43b478){_0x37a322[_0xa9b8('0x46')]=_0x43b478;return _0x37a322;})[_0xa9b8('0x1a')](respondWithFilteredResult(_0x28d3ee,_0x35afc8))[_0xa9b8('0x24')](handleError(_0x28d3ee,null));};exports[_0xa9b8('0x47')]=function(_0x335d0d,_0x163654){var _0x272c7a={'raw':![],'where':{'id':_0x335d0d[_0xa9b8('0x48')]['id']}},_0x2140fe={};_0x2140fe[_0xa9b8('0x34')]=_[_0xa9b8('0x35')](db[_0xa9b8('0x43')][_0xa9b8('0x33')]);_0x2140fe[_0xa9b8('0x36')]=_[_0xa9b8('0x35')](_0x335d0d[_0xa9b8('0x36')]);_0x2140fe[_0xa9b8('0x3e')]=_[_0xa9b8('0x37')](_0x2140fe[_0xa9b8('0x34')],_0x2140fe[_0xa9b8('0x36')]);_0x272c7a[_0xa9b8('0x38')]=_[_0xa9b8('0x37')](_0x2140fe['model'],qs[_0xa9b8('0x39')](_0x335d0d[_0xa9b8('0x36')][_0xa9b8('0x39')]));_0x272c7a[_0xa9b8('0x38')]=_0x272c7a[_0xa9b8('0x38')][_0xa9b8('0x3a')]?_0x272c7a[_0xa9b8('0x38')]:_0x2140fe[_0xa9b8('0x34')];if(_0x335d0d[_0xa9b8('0x36')]['includeAll']){_0x272c7a[_0xa9b8('0x44')]=[{'all':!![]}];}_0x272c7a=_[_0xa9b8('0x40')]({},_0x272c7a,_0x335d0d[_0xa9b8('0x49')]);return db[_0xa9b8('0x43')][_0xa9b8('0x4a')](_0x272c7a)['then'](handleEntityNotFound(_0x163654,null))[_0xa9b8('0x1a')](respondWithResult(_0x163654,null))['catch'](handleError(_0x163654,null));};exports[_0xa9b8('0x4b')]=function(_0x4963da,_0x42a060,_0xd03d7f){var _0x5aeaba;return db['VoiceContext'][_0xa9b8('0x4b')](_0x4963da[_0xa9b8('0x4c')],{'raw':!![]})[_0xa9b8('0x1a')](function(_0x5a22e3){_0x5aeaba=_0x5a22e3;return db[_0xa9b8('0x43')][_0xa9b8('0x45')]({'raw':!![]});})[_0xa9b8('0x1a')](function(_0x2b2758){var _0x2a946d=fs['readFileSync'](path['join'](config[_0xa9b8('0x4d')],_0xa9b8('0x4e')),_0xa9b8('0x4f'));var _0x4a18d4=ejs[_0xa9b8('0x50')](_0x2a946d,{'contexts':_0x2b2758||[]});fs[_0xa9b8('0x51')](_0xa9b8('0x52'),_0x4a18d4);})[_0xa9b8('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':_0xa9b8('0x53')});})[_0xa9b8('0x1a')](function(){var _0x2b260a=_0x4963da[_0xa9b8('0x54')]['get']({'plain':!![]});if(!_0x2b260a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b260a[_0xa9b8('0x55')]===_0xa9b8('0x54')){var _0x3eebe9=_0x5aeaba['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xa9b8('0x56'),'userProfileId':_0x2b260a[_0xa9b8('0x57')]},'raw':!![]})[_0xa9b8('0x1a')](function(_0xffe378){if(_0xffe378&&_0xffe378['autoAssociation']===0x0){return db['UserProfileResource'][_0xa9b8('0x4b')]({'name':_0x3eebe9[_0xa9b8('0x32')],'resourceId':_0x3eebe9['id'],'type':_0xffe378['name'],'sectionId':_0xffe378['id']},{})[_0xa9b8('0x1a')](function(){return _0x5aeaba;});}else{return _0x5aeaba;}})[_0xa9b8('0x24')](function(_0x3af46d){logger[_0xa9b8('0x20')](_0xa9b8('0x58'),_0x3af46d);throw _0x3af46d;});}return _0x5aeaba;})[_0xa9b8('0x1a')](respondWithResult(_0x42a060,0xc9))[_0xa9b8('0x24')](handleError(_0x42a060,null));};exports[_0xa9b8('0x59')]=function(_0x43750f,_0x413457,_0x542eac){var _0x1b67c2;return db[_0xa9b8('0x43')][_0xa9b8('0x4a')]({'where':{'id':_0x43750f[_0xa9b8('0x48')]['id']}})[_0xa9b8('0x1a')](handleEntityNotFound(_0x413457,null))['then'](saveUpdates(_0x43750f[_0xa9b8('0x4c')],null))[_0xa9b8('0x1a')](function(_0x50dbb3){if(_0x50dbb3){_0x1b67c2=_0x50dbb3;return db[_0xa9b8('0x43')][_0xa9b8('0x45')]({'raw':!![]});}})[_0xa9b8('0x1a')](function(_0x3456ea){var _0x564e2f=fs[_0xa9b8('0x5a')](path[_0xa9b8('0x5b')](config[_0xa9b8('0x4d')],_0xa9b8('0x4e')),_0xa9b8('0x4f'));var _0x36116f=ejs[_0xa9b8('0x50')](_0x564e2f,{'contexts':_0x3456ea||[]});fs[_0xa9b8('0x51')](_0xa9b8('0x52'),_0x36116f);})[_0xa9b8('0x1a')](function(){return respondWithRpcPromise(_0xa9b8('0x5c'),'update',{'module':_0xa9b8('0x53')});})[_0xa9b8('0x1a')](function(){return _0x1b67c2;})[_0xa9b8('0x1a')](respondWithResult(_0x413457,null))['catch'](handleError(_0x413457,null));};exports[_0xa9b8('0x2e')]=function(_0x52314d,_0x3cc4c9,_0x4383b9){var _0x218dd0;return db[_0xa9b8('0x43')][_0xa9b8('0x4a')]({'where':{'id':_0x52314d[_0xa9b8('0x48')]['id']}})[_0xa9b8('0x1a')](handleEntityNotFound(_0x3cc4c9,null))['then'](removeEntity(_0x3cc4c9,null))[_0xa9b8('0x1a')](function(){return db[_0xa9b8('0x43')][_0xa9b8('0x45')]({'raw':!![]});})[_0xa9b8('0x1a')](function(_0x193873){var _0x9597a7=fs['readFileSync'](path[_0xa9b8('0x5b')](config[_0xa9b8('0x4d')],_0xa9b8('0x4e')),'utf8');var _0x407f50=ejs[_0xa9b8('0x50')](_0x9597a7,{'contexts':_0x193873});fs['writeFileSync'](_0xa9b8('0x52'),_0x407f50);return respondWithRpcPromise(_0xa9b8('0x5c'),_0xa9b8('0x2e'),{'module':_0xa9b8('0x53')});})['catch'](handleError(_0x3cc4c9,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 16fc395..9e26250 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 _0x967c=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceContext','voice_contexts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x967c,0xd8));var _0xc967=function(_0x7d957a,_0x57652b){_0x7d957a=_0x7d957a-0x0;var _0x3423f=_0x967c[_0x7d957a];return _0x3423f;};'use strict';var _=require(_0xc967('0x0'));var util=require('util');var logger=require(_0xc967('0x1'))(_0xc967('0x2'));var moment=require(_0xc967('0x3'));var BPromise=require(_0xc967('0x4'));var rp=require(_0xc967('0x5'));var fs=require('fs');var path=require(_0xc967('0x6'));var rimraf=require('rimraf');var config=require(_0xc967('0x7'));var attributes=require('./voiceContext.attributes');module[_0xc967('0x8')]=function(_0x167ef1,_0x17ebe0){return _0x167ef1[_0xc967('0x9')](_0xc967('0xa'),attributes,{'tableName':_0xc967('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdf4=['exports','define','voice_contexts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x3893da,_0x22bffb){var _0x1c3533=function(_0x1a882c){while(--_0x1a882c){_0x3893da['push'](_0x3893da['shift']());}};_0x1c3533(++_0x22bffb);}(_0xfdf4,0x1c6));var _0x4fdf=function(_0x9a9370,_0x25cd69){_0x9a9370=_0x9a9370-0x0;var _0x1418af=_0xfdf4[_0x9a9370];return _0x1418af;};'use strict';var _=require(_0x4fdf('0x0'));var util=require('util');var logger=require(_0x4fdf('0x1'))('api');var moment=require(_0x4fdf('0x2'));var BPromise=require(_0x4fdf('0x3'));var rp=require(_0x4fdf('0x4'));var fs=require('fs');var path=require(_0x4fdf('0x5'));var rimraf=require(_0x4fdf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4fdf('0x7'));module[_0x4fdf('0x8')]=function(_0x11fe62,_0x2299e8){return _0x11fe62[_0x4fdf('0x9')]('VoiceContext',attributes,{'tableName':_0x4fdf('0xa'),'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 308da98..10f6a58 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 _0xdcbc=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xdcbc,0x80));var _0xcdcb=function(_0x5e03c1,_0x1d4336){_0x5e03c1=_0x5e03c1-0x0;var _0x13d8d8=_0xdcbc[_0x5e03c1];return _0x13d8d8;};'use strict';var _=require(_0xcdcb('0x0'));var util=require(_0xcdcb('0x1'));var moment=require(_0xcdcb('0x2'));var BPromise=require(_0xcdcb('0x3'));var rs=require(_0xcdcb('0x4'));var fs=require('fs');var Redis=require(_0xcdcb('0x5'));var db=require(_0xcdcb('0x6'))['db'];var utils=require(_0xcdcb('0x7'));var logger=require(_0xcdcb('0x8'))(_0xcdcb('0x9'));var config=require(_0xcdcb('0xa'));var jayson=require(_0xcdcb('0xb'));var client=jayson[_0xcdcb('0xc')][_0xcdcb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38de32,_0x33a6dc,_0x1e97a3){return new BPromise(function(_0x566592,_0x27d608){return client[_0xcdcb('0xe')](_0x38de32,_0x1e97a3)['then'](function(_0x2dc70a){logger[_0xcdcb('0xf')](_0xcdcb('0x10'),_0x33a6dc,_0xcdcb('0x11'));logger[_0xcdcb('0x12')](_0xcdcb('0x13'),_0x33a6dc,_0xcdcb('0x11'),JSON['stringify'](_0x2dc70a));if(_0x2dc70a['error']){if(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x15')]===0x1f4){logger[_0xcdcb('0x14')](_0xcdcb('0x10'),_0x33a6dc,_0x2dc70a['error'][_0xcdcb('0x16')]);return _0x27d608(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);}logger[_0xcdcb('0x14')](_0xcdcb('0x10'),_0x33a6dc,_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);return _0x566592(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x33a6dc,_0xcdcb('0x11'));_0x566592(_0x2dc70a[_0xcdcb('0x17')][_0xcdcb('0x16')]);}})[_0xcdcb('0x18')](function(_0x59e554){logger[_0xcdcb('0x14')]('VoiceContext,\x20%s,\x20%s',_0x33a6dc,_0x59e554);_0x27d608(_0x59e554);});});} \ No newline at end of file +var _0xebff=['../../config/environment','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2e3d0d,_0x4e3849){var _0x4f9601=function(_0x1428cb){while(--_0x1428cb){_0x2e3d0d['push'](_0x2e3d0d['shift']());}};_0x4f9601(++_0x4e3849);}(_0xebff,0xf8));var _0xfebf=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xebff[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xfebf('0x0'));var util=require('util');var moment=require(_0xfebf('0x1'));var BPromise=require('bluebird');var rs=require(_0xfebf('0x2'));var fs=require('fs');var Redis=require(_0xfebf('0x3'));var db=require(_0xfebf('0x4'))['db'];var utils=require(_0xfebf('0x5'));var logger=require('../../config/logger')(_0xfebf('0x6'));var config=require(_0xfebf('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x256c16,_0x4b8456,_0xf4de6e){return new BPromise(function(_0x86e9c,_0x5da9e1){return client['request'](_0x256c16,_0xf4de6e)['then'](function(_0x2d9a6c){logger[_0xfebf('0x8')](_0xfebf('0x9'),_0x4b8456,_0xfebf('0xa'));logger[_0xfebf('0xb')](_0xfebf('0xc'),_0x4b8456,_0xfebf('0xa'),JSON['stringify'](_0x2d9a6c));if(_0x2d9a6c[_0xfebf('0xd')]){if(_0x2d9a6c[_0xfebf('0xd')][_0xfebf('0xe')]===0x1f4){logger[_0xfebf('0xd')](_0xfebf('0x9'),_0x4b8456,_0x2d9a6c['error'][_0xfebf('0xf')]);return _0x5da9e1(_0x2d9a6c['error']['message']);}logger[_0xfebf('0xd')](_0xfebf('0x9'),_0x4b8456,_0x2d9a6c[_0xfebf('0xd')]['message']);return _0x86e9c(_0x2d9a6c[_0xfebf('0xd')][_0xfebf('0xf')]);}else{logger[_0xfebf('0x8')]('VoiceContext,\x20%s,\x20%s',_0x4b8456,_0xfebf('0xa'));_0x86e9c(_0x2d9a6c[_0xfebf('0x10')][_0xfebf('0xf')]);}})['catch'](function(_0x3d47fc){logger[_0xfebf('0xd')]('VoiceContext,\x20%s,\x20%s',_0x4b8456,_0x3d47fc);_0x5da9e1(_0x3d47fc);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3c29069..82dff86 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 _0x3312=['Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x44deeb,_0x48c940){var _0x4c5d2e=function(_0x3f1504){while(--_0x3f1504){_0x44deeb['push'](_0x44deeb['shift']());}};_0x4c5d2e(++_0x48c940);}(_0x3312,0x172));var _0x2331=function(_0x177ce2,_0x4d10d9){_0x177ce2=_0x177ce2-0x0;var _0x4a4a0a=_0x3312[_0x177ce2];return _0x4a4a0a;};'use strict';var multer=require(_0x2331('0x0'));var util=require(_0x2331('0x1'));var path=require(_0x2331('0x2'));var timeout=require('connect-timeout');var express=require(_0x2331('0x3'));var router=express[_0x2331('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2331('0x5'));var config=require(_0x2331('0x6'));var controller=require(_0x2331('0x7'));router[_0x2331('0x8')]('/',auth['isAuthenticated'](),controller[_0x2331('0x9')]);router['get'](_0x2331('0xa'),auth[_0x2331('0xb')](),controller[_0x2331('0xc')]);router[_0x2331('0x8')](_0x2331('0xd'),auth['isAuthenticated'](),controller[_0x2331('0xe')]);router[_0x2331('0xf')]('/',auth[_0x2331('0xb')](),controller[_0x2331('0x10')]);router[_0x2331('0x11')](_0x2331('0xd'),auth[_0x2331('0xb')](),controller[_0x2331('0x12')]);router[_0x2331('0x13')](_0x2331('0xd'),auth['isAuthenticated'](),controller[_0x2331('0x14')]);module[_0x2331('0x15')]=router; \ No newline at end of file +var _0x14ef=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0x14ef,0x1a7));var _0xf14e=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0x14ef[_0x57b432];return _0x2edf2a;};'use strict';var multer=require(_0xf14e('0x0'));var util=require(_0xf14e('0x1'));var path=require(_0xf14e('0x2'));var timeout=require(_0xf14e('0x3'));var express=require(_0xf14e('0x4'));var router=express[_0xf14e('0x5')]();var auth=require(_0xf14e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf14e('0x7'));var controller=require('./voiceDialReport.controller');router[_0xf14e('0x8')]('/',auth[_0xf14e('0x9')](),controller['index']);router['get'](_0xf14e('0xa'),auth[_0xf14e('0x9')](),controller[_0xf14e('0xb')]);router[_0xf14e('0x8')](_0xf14e('0xc'),auth[_0xf14e('0x9')](),controller[_0xf14e('0xd')]);router[_0xf14e('0xe')]('/',auth[_0xf14e('0x9')](),controller[_0xf14e('0xf')]);router[_0xf14e('0x10')](_0xf14e('0xc'),auth[_0xf14e('0x9')](),controller[_0xf14e('0x11')]);router[_0xf14e('0x12')]('/:id',auth[_0xf14e('0x9')](),controller[_0xf14e('0x13')]);module[_0xf14e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0813f52..dddd605 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 _0xa5cb=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa5cb,0x1a6));var _0xba5c=function(_0x4af42c,_0x2bf2c3){_0x4af42c=_0x4af42c-0x0;var _0x6e098a=_0xa5cb[_0x4af42c];return _0x6e098a;};'use strict';var Sequelize=require(_0xba5c('0x0'));module[_0xba5c('0x1')]={'privilege':{'type':Sequelize[_0xba5c('0x2')]},'channel':{'type':Sequelize[_0xba5c('0x2')]},'channelstate':{'type':Sequelize[_0xba5c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xba5c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xba5c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xba5c('0x2')]},'connectedlinename':{'type':Sequelize[_0xba5c('0x2')]},'language':{'type':Sequelize[_0xba5c('0x2')]},'accountcode':{'type':Sequelize[_0xba5c('0x2')]},'context':{'type':Sequelize[_0xba5c('0x2')]},'exten':{'type':Sequelize[_0xba5c('0x2')]},'priority':{'type':Sequelize[_0xba5c('0x3')]},'uniqueid':{'type':Sequelize[_0xba5c('0x2')]},'linkedid':{'type':Sequelize[_0xba5c('0x2')]},'destchannel':{'type':Sequelize[_0xba5c('0x2')]},'destchannelstate':{'type':Sequelize[_0xba5c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xba5c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xba5c('0x2')]},'destcalleridname':{'type':Sequelize[_0xba5c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xba5c('0x2')]},'destlanguage':{'type':Sequelize[_0xba5c('0x2')]},'destaccountcode':{'type':Sequelize[_0xba5c('0x2')]},'destcontext':{'type':Sequelize[_0xba5c('0x2')]},'destexten':{'type':Sequelize[_0xba5c('0x2')]},'destpriority':{'type':Sequelize[_0xba5c('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xba5c('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xba5c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xba5c('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xba5c('0x2')],'comment':_0xba5c('0x5')},'routeId':{'type':Sequelize[_0xba5c('0x3')]},'duration':{'type':Sequelize[_0xba5c('0x3')]},'holdtime':{'type':Sequelize[_0xba5c('0x3')]},'billableseconds':{'type':Sequelize[_0xba5c('0x3')]}}; \ No newline at end of file +var _0x249c=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x992c6b,_0x1b9eef){var _0x2a6590=function(_0x566ae1){while(--_0x566ae1){_0x992c6b['push'](_0x992c6b['shift']());}};_0x2a6590(++_0x1b9eef);}(_0x249c,0x149));var _0xc249=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x249c[_0x1deb72];return _0x18bbdf;};'use strict';var Sequelize=require(_0xc249('0x0'));module[_0xc249('0x1')]={'privilege':{'type':Sequelize[_0xc249('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc249('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc249('0x2')]},'calleridname':{'type':Sequelize[_0xc249('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc249('0x2')]},'connectedlinename':{'type':Sequelize[_0xc249('0x2')]},'language':{'type':Sequelize[_0xc249('0x2')]},'accountcode':{'type':Sequelize[_0xc249('0x2')]},'context':{'type':Sequelize[_0xc249('0x2')]},'exten':{'type':Sequelize[_0xc249('0x2')]},'priority':{'type':Sequelize[_0xc249('0x3')]},'uniqueid':{'type':Sequelize[_0xc249('0x2')]},'linkedid':{'type':Sequelize[_0xc249('0x2')]},'destchannel':{'type':Sequelize[_0xc249('0x2')]},'destchannelstate':{'type':Sequelize[_0xc249('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc249('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc249('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xc249('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc249('0x2')]},'destlanguage':{'type':Sequelize[_0xc249('0x2')]},'destaccountcode':{'type':Sequelize[_0xc249('0x2')]},'destcontext':{'type':Sequelize[_0xc249('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc249('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xc249('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc249('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xc249('0x2')],'comment':_0xc249('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xc249('0x3')]},'holdtime':{'type':Sequelize[_0xc249('0x3')]},'billableseconds':{'type':Sequelize[_0xc249('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a403650..212d611 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 _0xba73=['html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','status','count','offset','set','Content-Range','json','reject','update','then','destroy','end','sendStatus','name','send','index','VoiceDialReport','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xba73,0x1dc));var _0x3ba7=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xba73[_0x346737];return _0x1ade2e;};'use strict';var pdf=require(_0x3ba7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ba7('0x1'));var zipdir=require(_0x3ba7('0x2'));var jsonpatch=require(_0x3ba7('0x3'));var rp=require('request-promise');var moment=require(_0x3ba7('0x4'));var BPromise=require(_0x3ba7('0x5'));var Mustache=require(_0x3ba7('0x6'));var util=require('util');var path=require(_0x3ba7('0x7'));var sox=require('sox');var csv=require(_0x3ba7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3ba7('0x9'));var squel=require(_0x3ba7('0xa'));var crypto=require(_0x3ba7('0xb'));var jsforce=require(_0x3ba7('0xc'));var deskjs=require(_0x3ba7('0xd'));var toCsv=require(_0x3ba7('0x8'));var querystring=require(_0x3ba7('0xe'));var Papa=require(_0x3ba7('0xf'));var Redis=require('ioredis');var authService=require(_0x3ba7('0x10'));var qs=require(_0x3ba7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ba7('0x12'));var utils=require('../../config/utils');var config=require(_0x3ba7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25ccff,_0x4ce443){_0x4ce443=_0x4ce443||0xcc;return function(_0x1d34c9){if(_0x1d34c9){return _0x25ccff['sendStatus'](_0x4ce443);}return _0x25ccff[_0x3ba7('0x14')](_0x4ce443)['end']();};}function respondWithResult(_0x5f12d3,_0x18bdff){_0x18bdff=_0x18bdff||0xc8;return function(_0x5c4d4d){if(_0x5c4d4d){return _0x5f12d3[_0x3ba7('0x14')](_0x18bdff)['json'](_0x5c4d4d);}};}function respondWithFilteredResult(_0x32a8f4,_0x4b5611){return function(_0x2a56a2){if(_0x2a56a2){var _0x3ea384=_0x2a56a2[_0x3ba7('0x15')],_0xebedca=_0x4b5611['offset'],_0x1ce93e=_0x4b5611[_0x3ba7('0x16')]+_0x4b5611['limit'],_0x57d2d1;if(_0x1ce93e>=_0x3ea384){_0x1ce93e=_0x3ea384;_0x57d2d1=0xc8;}else{_0x57d2d1=0xce;}_0x32a8f4['status'](_0x57d2d1);return _0x32a8f4[_0x3ba7('0x17')](_0x3ba7('0x18'),_0xebedca+'-'+_0x1ce93e+'/'+_0x3ea384)[_0x3ba7('0x19')](_0x2a56a2);}return null;};}function patchUpdates(_0x2885eb){return function(_0x457e6b){try{jsonpatch['apply'](_0x457e6b,_0x2885eb,!![]);}catch(_0x364fef){return BPromise[_0x3ba7('0x1a')](_0x364fef);}return _0x457e6b['save']();};}function saveUpdates(_0x5268ba,_0x2d0719){return function(_0xd3f957){if(_0xd3f957){return _0xd3f957[_0x3ba7('0x1b')](_0x5268ba)[_0x3ba7('0x1c')](function(_0x4b0485){return _0x4b0485;});}return null;};}function removeEntity(_0xc7746c,_0x25eee3){return function(_0x5c6081){if(_0x5c6081){return _0x5c6081[_0x3ba7('0x1d')]()['then'](function(){_0xc7746c['status'](0xcc)[_0x3ba7('0x1e')]();});}};}function handleEntityNotFound(_0x5276f4,_0x9880ed){return function(_0x280b3c){if(!_0x280b3c){_0x5276f4[_0x3ba7('0x1f')](0x194);}return _0x280b3c;};}function handleError(_0x12423a,_0x151fd0){_0x151fd0=_0x151fd0||0x1f4;return function(_0x54c852){logger['error'](_0x54c852['stack']);if(_0x54c852[_0x3ba7('0x20')]){delete _0x54c852[_0x3ba7('0x20')];}_0x12423a[_0x3ba7('0x14')](_0x151fd0)[_0x3ba7('0x21')](_0x54c852);};}exports[_0x3ba7('0x22')]=function(_0x48e394,_0x5153c4){var _0x275481={},_0x50a8cf={},_0x2069da={'count':0x0,'rows':[]};var _0x4add82=db[_0x3ba7('0x23')][_0x3ba7('0x24')];_0x50a8cf[_0x3ba7('0x25')]=_['keys'](_0x4add82);_0x50a8cf[_0x3ba7('0x26')]=_[_0x3ba7('0x27')](_0x48e394['query']);_0x50a8cf[_0x3ba7('0x28')]=_[_0x3ba7('0x29')](_0x50a8cf[_0x3ba7('0x25')],_0x50a8cf['query']);_0x275481['attributes']=_[_0x3ba7('0x29')](_0x50a8cf[_0x3ba7('0x25')],qs[_0x3ba7('0x2a')](_0x48e394[_0x3ba7('0x26')]['fields']));_0x275481[_0x3ba7('0x2b')]=_0x275481['attributes'][_0x3ba7('0x2c')]?_0x275481[_0x3ba7('0x2b')]:_0x50a8cf[_0x3ba7('0x25')];if(!_0x48e394[_0x3ba7('0x26')][_0x3ba7('0x2d')]('nolimit')){_0x275481[_0x3ba7('0x2e')]=qs[_0x3ba7('0x2e')](_0x48e394[_0x3ba7('0x26')][_0x3ba7('0x2e')]);_0x275481[_0x3ba7('0x16')]=qs[_0x3ba7('0x16')](_0x48e394[_0x3ba7('0x26')][_0x3ba7('0x16')]);}_0x275481[_0x3ba7('0x2f')]=qs[_0x3ba7('0x30')](_0x48e394['query']['sort']);_0x275481[_0x3ba7('0x31')]=qs[_0x3ba7('0x28')](_['pick'](_0x48e394[_0x3ba7('0x26')],_0x50a8cf[_0x3ba7('0x28')]));if(_0x48e394['query']['filter']){_0x275481['where']=_[_0x3ba7('0x32')](_0x275481[_0x3ba7('0x31')],{'$or':_[_0x3ba7('0x33')](_0x4add82,function(_0x3ca2b5){if(_0x3ca2b5[_0x3ba7('0x34')][_0x3ba7('0x35')]!==_0x3ba7('0x36')){var _0x1bb53e={};_0x1bb53e[_0x3ca2b5[_0x3ba7('0x37')]]={'$like':'%'+_0x48e394['query']['filter']+'%'};return _0x1bb53e;}})});}_0x275481=_[_0x3ba7('0x32')]({},_0x275481,_0x48e394[_0x3ba7('0x38')]);var _0x5d6020={'where':_0x275481[_0x3ba7('0x31')]};return db[_0x3ba7('0x23')][_0x3ba7('0x15')](_0x5d6020)[_0x3ba7('0x1c')](function(_0x5dfd0c){_0x2069da['count']=_0x5dfd0c;if(_0x48e394[_0x3ba7('0x26')][_0x3ba7('0x39')]){_0x275481['include']=[{'all':!![]}];}return db[_0x3ba7('0x23')][_0x3ba7('0x3a')](_0x275481);})[_0x3ba7('0x1c')](function(_0xc06d70){_0x2069da[_0x3ba7('0x3b')]=_0xc06d70;return _0x2069da;})['then'](respondWithFilteredResult(_0x5153c4,_0x275481))[_0x3ba7('0x3c')](handleError(_0x5153c4,null));};exports[_0x3ba7('0x3d')]=function(_0x34cf2d,_0x33ae73){var _0x243e2d={'raw':!![],'where':{'id':_0x34cf2d[_0x3ba7('0x3e')]['id']}},_0x10d5da={};_0x10d5da[_0x3ba7('0x25')]=_[_0x3ba7('0x27')](db[_0x3ba7('0x23')]['rawAttributes']);_0x10d5da['query']=_[_0x3ba7('0x27')](_0x34cf2d[_0x3ba7('0x26')]);_0x10d5da['filters']=_[_0x3ba7('0x29')](_0x10d5da[_0x3ba7('0x25')],_0x10d5da[_0x3ba7('0x26')]);_0x243e2d['attributes']=_[_0x3ba7('0x29')](_0x10d5da[_0x3ba7('0x25')],qs['fields'](_0x34cf2d['query'][_0x3ba7('0x2a')]));_0x243e2d[_0x3ba7('0x2b')]=_0x243e2d['attributes']['length']?_0x243e2d['attributes']:_0x10d5da[_0x3ba7('0x25')];if(_0x34cf2d[_0x3ba7('0x26')][_0x3ba7('0x39')]){_0x243e2d[_0x3ba7('0x3f')]=[{'all':!![]}];}_0x243e2d=_[_0x3ba7('0x32')]({},_0x243e2d,_0x34cf2d[_0x3ba7('0x38')]);return db[_0x3ba7('0x23')][_0x3ba7('0x40')](_0x243e2d)[_0x3ba7('0x1c')](handleEntityNotFound(_0x33ae73,null))[_0x3ba7('0x1c')](respondWithResult(_0x33ae73,null))['catch'](handleError(_0x33ae73,null));};exports[_0x3ba7('0x41')]=function(_0x295aab,_0x12a620){return db[_0x3ba7('0x23')][_0x3ba7('0x41')](_0x295aab[_0x3ba7('0x42')],{})[_0x3ba7('0x1c')](respondWithResult(_0x12a620,0xc9))[_0x3ba7('0x3c')](handleError(_0x12a620,null));};exports[_0x3ba7('0x1b')]=function(_0x146fe8,_0x374c2f){if(_0x146fe8['body']['id']){delete _0x146fe8[_0x3ba7('0x42')]['id'];}return db[_0x3ba7('0x23')][_0x3ba7('0x40')]({'where':{'id':_0x146fe8['params']['id']}})[_0x3ba7('0x1c')](handleEntityNotFound(_0x374c2f,null))[_0x3ba7('0x1c')](saveUpdates(_0x146fe8[_0x3ba7('0x42')],null))[_0x3ba7('0x1c')](respondWithResult(_0x374c2f,null))[_0x3ba7('0x3c')](handleError(_0x374c2f,null));};exports[_0x3ba7('0x1d')]=function(_0x29b873,_0x48cb93){return db[_0x3ba7('0x23')][_0x3ba7('0x40')]({'where':{'id':_0x29b873['params']['id']}})[_0x3ba7('0x1c')](handleEntityNotFound(_0x48cb93,null))[_0x3ba7('0x1c')](removeEntity(_0x48cb93,null))[_0x3ba7('0x3c')](handleError(_0x48cb93,null));};exports[_0x3ba7('0x43')]=function(_0x101598,_0x775f45){return db[_0x3ba7('0x23')][_0x3ba7('0x43')]()['then'](respondWithResult(_0x775f45,null))[_0x3ba7('0x3c')](handleError(_0x775f45,null));}; \ No newline at end of file +var _0x6a02=['destroy','error','stack','name','index','VoiceDialReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','includeAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','lodash','squel','jsforce','desk.js','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','limit','Content-Range','apply','reject','save','update','then'];(function(_0x190956,_0x2313fe){var _0x1a583b=function(_0x3c43de){while(--_0x3c43de){_0x190956['push'](_0x190956['shift']());}};_0x1a583b(++_0x2313fe);}(_0x6a02,0x6e));var _0x26a0=function(_0x194982,_0x5d50c3){_0x194982=_0x194982-0x0;var _0x4a6d26=_0x6a02[_0x194982];return _0x4a6d26;};'use strict';var pdf=require(_0x26a0('0x0'));var emlformat=require(_0x26a0('0x1'));var rimraf=require(_0x26a0('0x2'));var zipdir=require(_0x26a0('0x3'));var jsonpatch=require(_0x26a0('0x4'));var rp=require(_0x26a0('0x5'));var moment=require(_0x26a0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x26a0('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x26a0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x26a0('0x9'));var squel=require(_0x26a0('0xa'));var crypto=require('crypto');var jsforce=require(_0x26a0('0xb'));var deskjs=require(_0x26a0('0xc'));var toCsv=require(_0x26a0('0x8'));var querystring=require(_0x26a0('0xd'));var Papa=require('papaparse');var Redis=require(_0x26a0('0xe'));var authService=require(_0x26a0('0xf'));var qs=require(_0x26a0('0x10'));var hardwareService=require(_0x26a0('0x11'));var logger=require(_0x26a0('0x12'))(_0x26a0('0x13'));var utils=require(_0x26a0('0x14'));var config=require(_0x26a0('0x15'));var db=require(_0x26a0('0x16'))['db'];function respondWithStatusCode(_0x2846e6,_0x48f6dd){_0x48f6dd=_0x48f6dd||0xcc;return function(_0x3bca4c){if(_0x3bca4c){return _0x2846e6[_0x26a0('0x17')](_0x48f6dd);}return _0x2846e6[_0x26a0('0x18')](_0x48f6dd)[_0x26a0('0x19')]();};}function respondWithResult(_0x476d95,_0x3fd926){_0x3fd926=_0x3fd926||0xc8;return function(_0x497658){if(_0x497658){return _0x476d95['status'](_0x3fd926)[_0x26a0('0x1a')](_0x497658);}};}function respondWithFilteredResult(_0x51cff5,_0x5b7654){return function(_0x2e670c){if(_0x2e670c){var _0x4325c0=_0x2e670c[_0x26a0('0x1b')],_0x2dce56=_0x5b7654[_0x26a0('0x1c')],_0x2bb777=_0x5b7654[_0x26a0('0x1c')]+_0x5b7654[_0x26a0('0x1d')],_0x24b1f2;if(_0x2bb777>=_0x4325c0){_0x2bb777=_0x4325c0;_0x24b1f2=0xc8;}else{_0x24b1f2=0xce;}_0x51cff5[_0x26a0('0x18')](_0x24b1f2);return _0x51cff5['set'](_0x26a0('0x1e'),_0x2dce56+'-'+_0x2bb777+'/'+_0x4325c0)[_0x26a0('0x1a')](_0x2e670c);}return null;};}function patchUpdates(_0x3a6a9b){return function(_0x4b54e2){try{jsonpatch[_0x26a0('0x1f')](_0x4b54e2,_0x3a6a9b,!![]);}catch(_0x29f8be){return BPromise[_0x26a0('0x20')](_0x29f8be);}return _0x4b54e2[_0x26a0('0x21')]();};}function saveUpdates(_0x23a38f,_0x5e1169){return function(_0x18dfae){if(_0x18dfae){return _0x18dfae[_0x26a0('0x22')](_0x23a38f)[_0x26a0('0x23')](function(_0x777315){return _0x777315;});}return null;};}function removeEntity(_0xf9039e,_0x4a65f4){return function(_0x578880){if(_0x578880){return _0x578880[_0x26a0('0x24')]()['then'](function(){_0xf9039e[_0x26a0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a06b1,_0x38cffd){return function(_0x526d71){if(!_0x526d71){_0x4a06b1[_0x26a0('0x17')](0x194);}return _0x526d71;};}function handleError(_0x5bab43,_0x2a99fe){_0x2a99fe=_0x2a99fe||0x1f4;return function(_0x11c120){logger[_0x26a0('0x25')](_0x11c120[_0x26a0('0x26')]);if(_0x11c120[_0x26a0('0x27')]){delete _0x11c120[_0x26a0('0x27')];}_0x5bab43['status'](_0x2a99fe)['send'](_0x11c120);};}exports[_0x26a0('0x28')]=function(_0x59d467,_0x28a992){var _0x5c195d={},_0xc095a1={},_0x45bcc2={'count':0x0,'rows':[]};var _0x560aba=db[_0x26a0('0x29')][_0x26a0('0x2a')];_0xc095a1[_0x26a0('0x2b')]=_[_0x26a0('0x2c')](_0x560aba);_0xc095a1[_0x26a0('0x2d')]=_[_0x26a0('0x2c')](_0x59d467[_0x26a0('0x2d')]);_0xc095a1[_0x26a0('0x2e')]=_['intersection'](_0xc095a1[_0x26a0('0x2b')],_0xc095a1[_0x26a0('0x2d')]);_0x5c195d[_0x26a0('0x2f')]=_[_0x26a0('0x30')](_0xc095a1[_0x26a0('0x2b')],qs['fields'](_0x59d467['query'][_0x26a0('0x31')]));_0x5c195d['attributes']=_0x5c195d['attributes'][_0x26a0('0x32')]?_0x5c195d[_0x26a0('0x2f')]:_0xc095a1[_0x26a0('0x2b')];if(!_0x59d467[_0x26a0('0x2d')][_0x26a0('0x33')](_0x26a0('0x34'))){_0x5c195d[_0x26a0('0x1d')]=qs['limit'](_0x59d467['query'][_0x26a0('0x1d')]);_0x5c195d[_0x26a0('0x1c')]=qs[_0x26a0('0x1c')](_0x59d467[_0x26a0('0x2d')][_0x26a0('0x1c')]);}_0x5c195d['order']=qs[_0x26a0('0x35')](_0x59d467[_0x26a0('0x2d')][_0x26a0('0x35')]);_0x5c195d['where']=qs[_0x26a0('0x2e')](_[_0x26a0('0x36')](_0x59d467['query'],_0xc095a1[_0x26a0('0x2e')]));if(_0x59d467[_0x26a0('0x2d')][_0x26a0('0x37')]){_0x5c195d[_0x26a0('0x38')]=_[_0x26a0('0x39')](_0x5c195d[_0x26a0('0x38')],{'$or':_[_0x26a0('0x3a')](_0x560aba,function(_0x10da4e){if(_0x10da4e[_0x26a0('0x3b')][_0x26a0('0x3c')]!==_0x26a0('0x3d')){var _0x19fd44={};_0x19fd44[_0x10da4e[_0x26a0('0x3e')]]={'$like':'%'+_0x59d467[_0x26a0('0x2d')]['filter']+'%'};return _0x19fd44;}})});}_0x5c195d=_[_0x26a0('0x39')]({},_0x5c195d,_0x59d467[_0x26a0('0x3f')]);var _0xc7951={'where':_0x5c195d[_0x26a0('0x38')]};return db[_0x26a0('0x29')][_0x26a0('0x1b')](_0xc7951)[_0x26a0('0x23')](function(_0x57687e){_0x45bcc2[_0x26a0('0x1b')]=_0x57687e;if(_0x59d467[_0x26a0('0x2d')][_0x26a0('0x40')]){_0x5c195d['include']=[{'all':!![]}];}return db[_0x26a0('0x29')]['findAll'](_0x5c195d);})[_0x26a0('0x23')](function(_0x281069){_0x45bcc2[_0x26a0('0x41')]=_0x281069;return _0x45bcc2;})[_0x26a0('0x23')](respondWithFilteredResult(_0x28a992,_0x5c195d))[_0x26a0('0x42')](handleError(_0x28a992,null));};exports[_0x26a0('0x43')]=function(_0x719c96,_0x5d01d5){var _0x428795={'raw':!![],'where':{'id':_0x719c96[_0x26a0('0x44')]['id']}},_0x1395c7={};_0x1395c7['model']=_[_0x26a0('0x2c')](db[_0x26a0('0x29')][_0x26a0('0x2a')]);_0x1395c7[_0x26a0('0x2d')]=_[_0x26a0('0x2c')](_0x719c96[_0x26a0('0x2d')]);_0x1395c7[_0x26a0('0x2e')]=_[_0x26a0('0x30')](_0x1395c7[_0x26a0('0x2b')],_0x1395c7[_0x26a0('0x2d')]);_0x428795['attributes']=_['intersection'](_0x1395c7[_0x26a0('0x2b')],qs[_0x26a0('0x31')](_0x719c96[_0x26a0('0x2d')]['fields']));_0x428795[_0x26a0('0x2f')]=_0x428795[_0x26a0('0x2f')][_0x26a0('0x32')]?_0x428795[_0x26a0('0x2f')]:_0x1395c7[_0x26a0('0x2b')];if(_0x719c96[_0x26a0('0x2d')][_0x26a0('0x40')]){_0x428795['include']=[{'all':!![]}];}_0x428795=_[_0x26a0('0x39')]({},_0x428795,_0x719c96['options']);return db['VoiceDialReport'][_0x26a0('0x45')](_0x428795)[_0x26a0('0x23')](handleEntityNotFound(_0x5d01d5,null))['then'](respondWithResult(_0x5d01d5,null))[_0x26a0('0x42')](handleError(_0x5d01d5,null));};exports[_0x26a0('0x46')]=function(_0x100472,_0x566cd8){return db[_0x26a0('0x29')][_0x26a0('0x46')](_0x100472['body'],{})[_0x26a0('0x23')](respondWithResult(_0x566cd8,0xc9))[_0x26a0('0x42')](handleError(_0x566cd8,null));};exports[_0x26a0('0x22')]=function(_0x50b6c4,_0x151630){if(_0x50b6c4[_0x26a0('0x47')]['id']){delete _0x50b6c4['body']['id'];}return db[_0x26a0('0x29')]['find']({'where':{'id':_0x50b6c4['params']['id']}})['then'](handleEntityNotFound(_0x151630,null))[_0x26a0('0x23')](saveUpdates(_0x50b6c4[_0x26a0('0x47')],null))[_0x26a0('0x23')](respondWithResult(_0x151630,null))['catch'](handleError(_0x151630,null));};exports[_0x26a0('0x24')]=function(_0x112f60,_0x1b8a69){return db[_0x26a0('0x29')][_0x26a0('0x45')]({'where':{'id':_0x112f60[_0x26a0('0x44')]['id']}})[_0x26a0('0x23')](handleEntityNotFound(_0x1b8a69,null))['then'](removeEntity(_0x1b8a69,null))[_0x26a0('0x42')](handleError(_0x1b8a69,null));};exports[_0x26a0('0x48')]=function(_0x154312,_0x480d65){return db['VoiceDialReport'][_0x26a0('0x48')]()[_0x26a0('0x23')](respondWithResult(_0x480d65,null))[_0x26a0('0x42')](handleError(_0x480d65,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 830ffc5..ab608d5 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 _0x5e9f=['api','bluebird','request-promise','rimraf','../../config/environment','define','VoiceDialReport','lodash','util'];(function(_0x49fcb4,_0x2f278d){var _0x44c3e4=function(_0x4c7071){while(--_0x4c7071){_0x49fcb4['push'](_0x49fcb4['shift']());}};_0x44c3e4(++_0x2f278d);}(_0x5e9f,0x73));var _0xf5e9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5e9f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf5e9('0x0'));var util=require(_0xf5e9('0x1'));var logger=require('../../config/logger')(_0xf5e9('0x2'));var moment=require('moment');var BPromise=require(_0xf5e9('0x3'));var rp=require(_0xf5e9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5e9('0x5'));var config=require(_0xf5e9('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x59fb8d,_0x1489e1){return _0x59fb8d[_0xf5e9('0x7')](_0xf5e9('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xec69=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','moment'];(function(_0x5a88a4,_0x2c4d57){var _0x34b68a=function(_0x17af78){while(--_0x17af78){_0x5a88a4['push'](_0x5a88a4['shift']());}};_0x34b68a(++_0x2c4d57);}(_0xec69,0x15c));var _0x9ec6=function(_0x12ec65,_0x5bd7c9){_0x12ec65=_0x12ec65-0x0;var _0x28502f=_0xec69[_0x12ec65];return _0x28502f;};'use strict';var _=require(_0x9ec6('0x0'));var util=require('util');var logger=require(_0x9ec6('0x1'))('api');var moment=require(_0x9ec6('0x2'));var BPromise=require(_0x9ec6('0x3'));var rp=require(_0x9ec6('0x4'));var fs=require('fs');var path=require(_0x9ec6('0x5'));var rimraf=require(_0x9ec6('0x6'));var config=require(_0x9ec6('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x9ec6('0x8')]=function(_0x580602,_0x16951a){return _0x580602[_0x9ec6('0x9')](_0x9ec6('0xa'),attributes,{'tableName':_0x9ec6('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9ec6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6060596..9ff4f2c 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 _0x2029=['VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport'];(function(_0x12d50a,_0x365fd6){var _0x45d046=function(_0x2797d0){while(--_0x2797d0){_0x12d50a['push'](_0x12d50a['shift']());}};_0x45d046(++_0x365fd6);}(_0x2029,0x171));var _0x9202=function(_0x575348,_0x242a18){_0x575348=_0x575348-0x0;var _0x581edb=_0x2029[_0x575348];return _0x581edb;};'use strict';var _=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var moment=require('moment');var BPromise=require(_0x9202('0x2'));var rs=require(_0x9202('0x3'));var fs=require('fs');var Redis=require(_0x9202('0x4'));var db=require(_0x9202('0x5'))['db'];var utils=require(_0x9202('0x6'));var logger=require(_0x9202('0x7'))(_0x9202('0x8'));var config=require(_0x9202('0x9'));var jayson=require(_0x9202('0xa'));var client=jayson[_0x9202('0xb')][_0x9202('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c4f7a,_0x539d6f,_0x5527d0){return new BPromise(function(_0x4003ae,_0x5eba55){return client[_0x9202('0xd')](_0x2c4f7a,_0x5527d0)[_0x9202('0xe')](function(_0x583e06){logger[_0x9202('0xf')](_0x9202('0x10'),_0x539d6f,_0x9202('0x11'));logger[_0x9202('0x12')](_0x9202('0x13'),_0x539d6f,_0x9202('0x11'),JSON[_0x9202('0x14')](_0x583e06));if(_0x583e06[_0x9202('0x15')]){if(_0x583e06[_0x9202('0x15')][_0x9202('0x16')]===0x1f4){logger[_0x9202('0x15')](_0x9202('0x10'),_0x539d6f,_0x583e06[_0x9202('0x15')][_0x9202('0x17')]);return _0x5eba55(_0x583e06[_0x9202('0x15')][_0x9202('0x17')]);}logger[_0x9202('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x539d6f,_0x583e06[_0x9202('0x15')][_0x9202('0x17')]);return _0x4003ae(_0x583e06[_0x9202('0x15')][_0x9202('0x17')]);}else{logger[_0x9202('0xf')](_0x9202('0x10'),_0x539d6f,_0x9202('0x11'));_0x4003ae(_0x583e06[_0x9202('0x18')][_0x9202('0x17')]);}})[_0x9202('0x19')](function(_0x4bcfe4){logger[_0x9202('0x15')](_0x9202('0x10'),_0x539d6f,_0x4bcfe4);_0x5eba55(_0x4bcfe4);});});}exports[_0x9202('0x1a')]=function(_0x1222b6){var _0x332141=this;return new Promise(function(_0x1aad83,_0x36f5d3){return db[_0x9202('0x1b')][_0x9202('0x1c')](_0x1222b6['body'],{'raw':_0x1222b6['options']?_0x1222b6[_0x9202('0x1d')][_0x9202('0x1e')]===undefined?!![]:![]:!![]})[_0x9202('0xe')](function(_0x10a556){logger['info'](_0x9202('0x1a'),_0x1222b6);logger['debug'](_0x9202('0x1a'),_0x1222b6,JSON[_0x9202('0x14')](_0x10a556));_0x1aad83(_0x10a556);})['catch'](function(_0x41e19d){logger['error'](_0x9202('0x1a'),_0x41e19d[_0x9202('0x17')],_0x1222b6);_0x36f5d3(_0x332141[_0x9202('0x15')](0x1f4,_0x41e19d[_0x9202('0x17')]));});});};exports[_0x9202('0x1f')]=function(_0xf535c6){var _0x3a68f5=this;return new Promise(function(_0x47de09,_0x3dad1c){return db[_0x9202('0x1b')][_0x9202('0x20')](_0xf535c6[_0x9202('0x21')],{'raw':_0xf535c6[_0x9202('0x1d')]?_0xf535c6[_0x9202('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf535c6[_0x9202('0x1d')]?_0xf535c6[_0x9202('0x1d')][_0x9202('0x22')]||null:null,'attributes':_0xf535c6['options']?_0xf535c6['options']['attributes']||null:null,'limit':_0xf535c6[_0x9202('0x1d')]?_0xf535c6[_0x9202('0x1d')][_0x9202('0x23')]||null:null})['then'](function(_0x195589){logger['info'](_0x9202('0x1f'),_0xf535c6);logger[_0x9202('0x12')](_0x9202('0x1f'),_0xf535c6,JSON[_0x9202('0x14')](_0x195589));_0x47de09(_0x195589);})[_0x9202('0x19')](function(_0x4a65bd){logger[_0x9202('0x15')]('UpdateVoiceDialReport',_0x4a65bd[_0x9202('0x17')],_0xf535c6);_0x3dad1c(_0x3a68f5[_0x9202('0x15')](0x1f4,_0x4a65bd['message']));});});}; \ No newline at end of file +var _0xf194=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','code','error','message','result','CreateVoiceDialReport','VoiceDialReport','create','options','stringify','catch','UpdateVoiceDialReport','update','body','where','limit','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x41c696,_0x1dc908){var _0x2d57ee=function(_0x162688){while(--_0x162688){_0x41c696['push'](_0x41c696['shift']());}};_0x2d57ee(++_0x1dc908);}(_0xf194,0x91));var _0x4f19=function(_0x3b0c76,_0xc24e0e){_0x3b0c76=_0x3b0c76-0x0;var _0x24a03a=_0xf194[_0x3b0c76];return _0x24a03a;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var moment=require(_0x4f19('0x2'));var BPromise=require(_0x4f19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f19('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f19('0x5'));var config=require(_0x4f19('0x6'));var jayson=require(_0x4f19('0x7'));var client=jayson['client'][_0x4f19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45c88a,_0x514d93,_0x4b023f){return new BPromise(function(_0x265d15,_0x116780){return client[_0x4f19('0x9')](_0x45c88a,_0x4b023f)[_0x4f19('0xa')](function(_0x4aaf89){logger[_0x4f19('0xb')](_0x4f19('0xc'),_0x514d93,_0x4f19('0xd'));logger[_0x4f19('0xe')](_0x4f19('0xf'),_0x514d93,_0x4f19('0xd'),JSON['stringify'](_0x4aaf89));if(_0x4aaf89['error']){if(_0x4aaf89['error'][_0x4f19('0x10')]===0x1f4){logger[_0x4f19('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x514d93,_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);return _0x116780(_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);}logger['error'](_0x4f19('0xc'),_0x514d93,_0x4aaf89[_0x4f19('0x11')]['message']);return _0x265d15(_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);}else{logger['info'](_0x4f19('0xc'),_0x514d93,'request\x20sent');_0x265d15(_0x4aaf89[_0x4f19('0x13')][_0x4f19('0x12')]);}})['catch'](function(_0x4d8021){logger[_0x4f19('0x11')](_0x4f19('0xc'),_0x514d93,_0x4d8021);_0x116780(_0x4d8021);});});}exports[_0x4f19('0x14')]=function(_0x576eef){var _0x1d9bf3=this;return new Promise(function(_0x205fee,_0x1b4d79){return db[_0x4f19('0x15')][_0x4f19('0x16')](_0x576eef['body'],{'raw':_0x576eef[_0x4f19('0x17')]?_0x576eef[_0x4f19('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x4f19('0xa')](function(_0x14ff93){logger[_0x4f19('0xb')](_0x4f19('0x14'),_0x576eef);logger['debug'](_0x4f19('0x14'),_0x576eef,JSON[_0x4f19('0x18')](_0x14ff93));_0x205fee(_0x14ff93);})[_0x4f19('0x19')](function(_0xcbe002){logger[_0x4f19('0x11')](_0x4f19('0x14'),_0xcbe002[_0x4f19('0x12')],_0x576eef);_0x1b4d79(_0x1d9bf3[_0x4f19('0x11')](0x1f4,_0xcbe002[_0x4f19('0x12')]));});});};exports[_0x4f19('0x1a')]=function(_0x4531f4){var _0x2e2bf5=this;return new Promise(function(_0x21e0f7,_0x3457a4){return db[_0x4f19('0x15')][_0x4f19('0x1b')](_0x4531f4[_0x4f19('0x1c')],{'raw':_0x4531f4[_0x4f19('0x17')]?_0x4531f4[_0x4f19('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4531f4[_0x4f19('0x17')]?_0x4531f4['options'][_0x4f19('0x1d')]||null:null,'attributes':_0x4531f4['options']?_0x4531f4[_0x4f19('0x17')]['attributes']||null:null,'limit':_0x4531f4[_0x4f19('0x17')]?_0x4531f4[_0x4f19('0x17')][_0x4f19('0x1e')]||null:null})['then'](function(_0x444858){logger[_0x4f19('0xb')](_0x4f19('0x1a'),_0x4531f4);logger[_0x4f19('0xe')](_0x4f19('0x1a'),_0x4531f4,JSON['stringify'](_0x444858));_0x21e0f7(_0x444858);})[_0x4f19('0x19')](function(_0xa6789b){logger['error'](_0x4f19('0x1a'),_0xa6789b[_0x4f19('0x12')],_0x4531f4);_0x3457a4(_0x2e2bf5[_0x4f19('0x11')](0x1f4,_0xa6789b[_0x4f19('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 9851e98..4d01872 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 _0x841a=['./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3b41ac,_0x45282f){var _0x2c3d2e=function(_0x25fb7c){while(--_0x25fb7c){_0x3b41ac['push'](_0x3b41ac['shift']());}};_0x2c3d2e(++_0x45282f);}(_0x841a,0x67));var _0xa841=function(_0x35e5c0,_0x95ef9f){_0x35e5c0=_0x35e5c0-0x0;var _0x1aeacd=_0x841a[_0x35e5c0];return _0x1aeacd;};'use strict';var multer=require(_0xa841('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa841('0x1')]();var auth=require(_0xa841('0x2'));var interaction=require(_0xa841('0x3'));var config=require(_0xa841('0x4'));var controller=require(_0xa841('0x5'));router[_0xa841('0x6')]('/',auth[_0xa841('0x7')](),controller[_0xa841('0x8')]);router['get'](_0xa841('0x9'),auth[_0xa841('0x7')](),controller[_0xa841('0xa')]);router[_0xa841('0xb')]('/',auth[_0xa841('0x7')](),controller[_0xa841('0xc')]);router[_0xa841('0xb')](_0xa841('0xd'),auth[_0xa841('0x7')](),controller[_0xa841('0xe')]);router[_0xa841('0xf')](_0xa841('0x9'),auth[_0xa841('0x7')](),controller[_0xa841('0x10')]);router['delete'](_0xa841('0x9'),auth[_0xa841('0x7')](),controller['destroy']);module[_0xa841('0x11')]=router; \ No newline at end of file +var _0xbd8e=['connect-timeout','express','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index','get','/:id','post','create','/:id/applications','update','destroy','exports','multer','path'];(function(_0x105f3d,_0xd70cbd){var _0x3d8518=function(_0x51830b){while(--_0x51830b){_0x105f3d['push'](_0x105f3d['shift']());}};_0x3d8518(++_0xd70cbd);}(_0xbd8e,0x1de));var _0xebd8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbd8e[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xebd8('0x0'));var util=require('util');var path=require(_0xebd8('0x1'));var timeout=require(_0xebd8('0x2'));var express=require(_0xebd8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xebd8('0x4'));var config=require('../../config/environment');var controller=require(_0xebd8('0x5'));router['get']('/',auth[_0xebd8('0x6')](),controller[_0xebd8('0x7')]);router[_0xebd8('0x8')](_0xebd8('0x9'),auth[_0xebd8('0x6')](),controller['show']);router[_0xebd8('0xa')]('/',auth[_0xebd8('0x6')](),controller[_0xebd8('0xb')]);router['post'](_0xebd8('0xc'),auth[_0xebd8('0x6')](),controller['addApplications']);router['put']('/:id',auth[_0xebd8('0x6')](),controller[_0xebd8('0xd')]);router['delete']('/:id',auth[_0xebd8('0x6')](),controller[_0xebd8('0xe')]);module[_0xebd8('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index b10d621..9db40e1 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(_0x1985c1,_0x5252b9){var _0x912122=function(_0x48a38a){while(--_0x48a38a){_0x1985c1['push'](_0x1985c1['shift']());}};_0x912122(++_0x5252b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x2e30c6,_0x40a809){var _0x470e59=function(_0x4faaed){while(--_0x4faaed){_0x2e30c6['push'](_0x2e30c6['shift']());}};_0x470e59(++_0x40a809);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 c206c4c..aebcaa6 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 _0x8c75=['attributes','fields','sort','where','merge','map','key','VIRTUAL','field','options','include','findAll','rows','show','keys','length','includeAll','find','catch','params','create','body','exten','concat','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','type','name','UserProfileResource','destroy','error','send','index','VoiceExtension','rawAttributes','model','query','filters','intersection'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x8c75,0x162));var _0x58c7=function(_0x104fe2,_0x3f40e1){_0x104fe2=_0x104fe2-0x0;var _0x53d5d9=_0x8c75[_0x104fe2];return _0x53d5d9;};'use strict';var pdf=require(_0x58c7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x58c7('0x1'));var zipdir=require(_0x58c7('0x2'));var jsonpatch=require(_0x58c7('0x3'));var rp=require(_0x58c7('0x4'));var moment=require(_0x58c7('0x5'));var BPromise=require(_0x58c7('0x6'));var Mustache=require(_0x58c7('0x7'));var util=require(_0x58c7('0x8'));var path=require('path');var sox=require(_0x58c7('0x9'));var csv=require(_0x58c7('0xa'));var ejs=require(_0x58c7('0xb'));var fs=require('fs');var _=require(_0x58c7('0xc'));var squel=require(_0x58c7('0xd'));var crypto=require('crypto');var jsforce=require(_0x58c7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x58c7('0xf'));var authService=require(_0x58c7('0x10'));var qs=require(_0x58c7('0x11'));var hardwareService=require(_0x58c7('0x12'));var logger=require(_0x58c7('0x13'))(_0x58c7('0x14'));var utils=require(_0x58c7('0x15'));var config=require('../../config/environment');var db=require(_0x58c7('0x16'))['db'];config[_0x58c7('0x17')]=_[_0x58c7('0x18')](config['redis'],{'host':_0x58c7('0x19'),'port':0x18eb});var socket=require(_0x58c7('0x1a'))(new Redis(config[_0x58c7('0x17')]));require(_0x58c7('0x1b'))[_0x58c7('0x1c')](socket);function respondWithStatusCode(_0x3a7f7d,_0x29fc1a){_0x29fc1a=_0x29fc1a||0xcc;return function(_0x1b78b1){if(_0x1b78b1){return _0x3a7f7d[_0x58c7('0x1d')](_0x29fc1a);}return _0x3a7f7d[_0x58c7('0x1e')](_0x29fc1a)[_0x58c7('0x1f')]();};}function respondWithResult(_0xdea341,_0x36c78f){_0x36c78f=_0x36c78f||0xc8;return function(_0x284cf0){if(_0x284cf0){return _0xdea341[_0x58c7('0x1e')](_0x36c78f)[_0x58c7('0x20')](_0x284cf0);}};}function respondWithFilteredResult(_0x45ceeb,_0x4c38e4){return function(_0x17a679){if(_0x17a679){var _0x557365=_0x17a679[_0x58c7('0x21')],_0x14772d=_0x4c38e4[_0x58c7('0x22')],_0x14fa28=_0x4c38e4[_0x58c7('0x22')]+_0x4c38e4[_0x58c7('0x23')],_0x5417f9;if(_0x14fa28>=_0x557365){_0x14fa28=_0x557365;_0x5417f9=0xc8;}else{_0x5417f9=0xce;}_0x45ceeb[_0x58c7('0x1e')](_0x5417f9);return _0x45ceeb[_0x58c7('0x24')](_0x58c7('0x25'),_0x14772d+'-'+_0x14fa28+'/'+_0x557365)['json'](_0x17a679);}return null;};}function patchUpdates(_0x33230c){return function(_0xe6aaa1){try{jsonpatch['apply'](_0xe6aaa1,_0x33230c,!![]);}catch(_0x257f33){return BPromise[_0x58c7('0x26')](_0x257f33);}return _0xe6aaa1[_0x58c7('0x27')]();};}function saveUpdates(_0x2585e1,_0x480254){return function(_0x3d5408){if(_0x3d5408){return _0x3d5408['update'](_0x2585e1)[_0x58c7('0x28')](function(_0x7d716e){return _0x7d716e;});}return null;};}function removeEntity(_0x4b8c28,_0x4508e9){return function(_0x468fa1){if(_0x468fa1){return _0x468fa1['destroy']()['then'](function(){var _0x511e60=_0x468fa1['get']({'plain':!![]});var _0x3c4750=[{'name':_0x58c7('0x29'),'value':'inbound','ignore':![]},{'name':_0x58c7('0x2a'),'value':_0x58c7('0x2b'),'ignore':![]},{'name':_0x58c7('0x2c'),'value':_0x58c7('0x2d'),'ignore':![]}];var _0x45f09a=_(_0x3c4750)[_0x58c7('0x2e')](_0x58c7('0x2f'))['map'](_0x58c7('0x30'))[_0x58c7('0x30')]();if(_['includes'](_0x45f09a,_0x511e60['type'])){return;}var _0x1b846b=_['find'](_0x3c4750,['value',_0x511e60[_0x58c7('0x31')]])[_0x58c7('0x32')];return db[_0x58c7('0x33')][_0x58c7('0x34')]({'where':{'type':_0x1b846b,'resourceId':_0x511e60['id']}})[_0x58c7('0x28')](function(){return _0x468fa1;});})[_0x58c7('0x28')](function(){_0x4b8c28['status'](0xcc)[_0x58c7('0x1f')]();});}};}function handleEntityNotFound(_0x179c35,_0x31c120){return function(_0x45fd23){if(!_0x45fd23){_0x179c35['sendStatus'](0x194);}return _0x45fd23;};}function handleError(_0x38aa06,_0x171d0e){_0x171d0e=_0x171d0e||0x1f4;return function(_0x5eb292){logger[_0x58c7('0x35')](_0x5eb292['stack']);if(_0x5eb292[_0x58c7('0x32')]){delete _0x5eb292[_0x58c7('0x32')];}_0x38aa06[_0x58c7('0x1e')](_0x171d0e)[_0x58c7('0x36')](_0x5eb292);};}exports[_0x58c7('0x37')]=function(_0x1652e8,_0x1e73fb){var _0x2f59a8={},_0x5be1e7={},_0x4361ce={'count':0x0,'rows':[]};var _0xf6ed04=db[_0x58c7('0x38')][_0x58c7('0x39')];_0x5be1e7[_0x58c7('0x3a')]=_['keys'](_0xf6ed04);_0x5be1e7['query']=_['keys'](_0x1652e8[_0x58c7('0x3b')]);_0x5be1e7[_0x58c7('0x3c')]=_[_0x58c7('0x3d')](_0x5be1e7['model'],_0x5be1e7[_0x58c7('0x3b')]);_0x2f59a8[_0x58c7('0x3e')]=_[_0x58c7('0x3d')](_0x5be1e7['model'],qs[_0x58c7('0x3f')](_0x1652e8[_0x58c7('0x3b')][_0x58c7('0x3f')]));_0x2f59a8[_0x58c7('0x3e')]=_0x2f59a8['attributes']['length']?_0x2f59a8[_0x58c7('0x3e')]:_0x5be1e7[_0x58c7('0x3a')];if(!_0x1652e8['query']['hasOwnProperty']('nolimit')){_0x2f59a8[_0x58c7('0x23')]=qs[_0x58c7('0x23')](_0x1652e8[_0x58c7('0x3b')][_0x58c7('0x23')]);_0x2f59a8[_0x58c7('0x22')]=qs[_0x58c7('0x22')](_0x1652e8['query']['offset']);}_0x2f59a8['order']=qs[_0x58c7('0x40')](_0x1652e8['query'][_0x58c7('0x40')]);_0x2f59a8['where']=qs[_0x58c7('0x3c')](_['pick'](_0x1652e8['query'],_0x5be1e7[_0x58c7('0x3c')]));if(_0x1652e8[_0x58c7('0x3b')][_0x58c7('0x2e')]){_0x2f59a8[_0x58c7('0x41')]=_[_0x58c7('0x42')](_0x2f59a8[_0x58c7('0x41')],{'$or':_[_0x58c7('0x43')](_0xf6ed04,function(_0x1af978){if(_0x1af978[_0x58c7('0x31')][_0x58c7('0x44')]!==_0x58c7('0x45')){var _0x1088c9={};_0x1088c9[_0x1af978[_0x58c7('0x46')]]={'$like':'%'+_0x1652e8[_0x58c7('0x3b')][_0x58c7('0x2e')]+'%'};return _0x1088c9;}})});}_0x2f59a8=_[_0x58c7('0x42')]({},_0x2f59a8,_0x1652e8[_0x58c7('0x47')]);var _0x55d766={'where':_0x2f59a8[_0x58c7('0x41')]};return db['VoiceExtension'][_0x58c7('0x21')](_0x55d766)[_0x58c7('0x28')](function(_0x40c533){_0x4361ce['count']=_0x40c533;if(_0x1652e8[_0x58c7('0x3b')]['includeAll']){_0x2f59a8[_0x58c7('0x48')]=[{'all':!![]}];}return db[_0x58c7('0x38')][_0x58c7('0x49')](_0x2f59a8);})[_0x58c7('0x28')](function(_0x46148f){_0x4361ce[_0x58c7('0x4a')]=_0x46148f;return _0x4361ce;})[_0x58c7('0x28')](respondWithFilteredResult(_0x1e73fb,_0x2f59a8))['catch'](handleError(_0x1e73fb,null));};exports[_0x58c7('0x4b')]=function(_0x5bedc8,_0x21c7e0){var _0x3d15b3={'raw':![],'where':{'id':_0x5bedc8['params']['id']}},_0x574554={};_0x574554[_0x58c7('0x3a')]=_['keys'](db[_0x58c7('0x38')][_0x58c7('0x39')]);_0x574554[_0x58c7('0x3b')]=_[_0x58c7('0x4c')](_0x5bedc8[_0x58c7('0x3b')]);_0x574554[_0x58c7('0x3c')]=_[_0x58c7('0x3d')](_0x574554[_0x58c7('0x3a')],_0x574554[_0x58c7('0x3b')]);_0x3d15b3[_0x58c7('0x3e')]=_[_0x58c7('0x3d')](_0x574554[_0x58c7('0x3a')],qs[_0x58c7('0x3f')](_0x5bedc8[_0x58c7('0x3b')]['fields']));_0x3d15b3[_0x58c7('0x3e')]=_0x3d15b3['attributes'][_0x58c7('0x4d')]?_0x3d15b3[_0x58c7('0x3e')]:_0x574554[_0x58c7('0x3a')];if(_0x5bedc8[_0x58c7('0x3b')][_0x58c7('0x4e')]){_0x3d15b3['include']=[{'all':!![]}];}_0x3d15b3=_[_0x58c7('0x42')]({},_0x3d15b3,_0x5bedc8[_0x58c7('0x47')]);return db[_0x58c7('0x38')][_0x58c7('0x4f')](_0x3d15b3)[_0x58c7('0x28')](handleEntityNotFound(_0x21c7e0,null))['then'](respondWithResult(_0x21c7e0,null))[_0x58c7('0x50')](handleError(_0x21c7e0,null));};exports[_0x58c7('0x34')]=function(_0x3f376b,_0x5d5cc7){return db[_0x58c7('0x38')][_0x58c7('0x4f')]({'where':{'id':_0x3f376b[_0x58c7('0x51')]['id']}})[_0x58c7('0x28')](handleEntityNotFound(_0x5d5cc7,null))['then'](removeEntity(_0x5d5cc7,null))[_0x58c7('0x50')](handleError(_0x5d5cc7,null));};exports[_0x58c7('0x52')]=function(_0x228e7f,_0x401103){if(_0x228e7f[_0x58c7('0x53')]['type']===_0x58c7('0x2b')&&!_['startsWith'](_0x228e7f[_0x58c7('0x53')][_0x58c7('0x54')],'_')){_0x228e7f['body'][_0x58c7('0x54')]='_'[_0x58c7('0x55')](_0x228e7f[_0x58c7('0x53')][_0x58c7('0x54')]);}return db[_0x58c7('0x38')][_0x58c7('0x52')](_0x228e7f[_0x58c7('0x53')],{'raw':![]})[_0x58c7('0x28')](function(_0x438ba7){var _0x124ae7=_0x228e7f[_0x58c7('0x56')][_0x58c7('0x57')]({'plain':!![]});if(!_0x124ae7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x124ae7['role']===_0x58c7('0x56')){var _0x224eff=_0x438ba7[_0x58c7('0x57')]({'plain':!![]});var _0x454a69=[{'name':_0x58c7('0x29'),'value':'inbound'},{'name':_0x58c7('0x2a'),'value':_0x58c7('0x2b')},{'name':_0x58c7('0x2c'),'value':'internal'}];var _0x390221=_[_0x58c7('0x4f')](_0x454a69,[_0x58c7('0x30'),_0x224eff[_0x58c7('0x31')]])[_0x58c7('0x32')];return db[_0x58c7('0x58')][_0x58c7('0x4f')]({'where':{'name':_0x390221,'userProfileId':_0x124ae7[_0x58c7('0x59')]},'raw':!![]})[_0x58c7('0x28')](function(_0x37f6aa){if(_0x37f6aa&&_0x37f6aa[_0x58c7('0x5a')]===0x0){return db['UserProfileResource'][_0x58c7('0x52')]({'name':_0x224eff[_0x58c7('0x32')],'resourceId':_0x224eff['id'],'type':_0x37f6aa[_0x58c7('0x32')],'sectionId':_0x37f6aa['id']},{})['then'](function(){return _0x438ba7;});}else{return _0x438ba7;}})[_0x58c7('0x50')](function(_0x80748a){logger[_0x58c7('0x35')](_0x58c7('0x5b'),_0x80748a);throw _0x80748a;});}return _0x438ba7;})[_0x58c7('0x28')](respondWithResult(_0x401103,0xc9))['catch'](handleError(_0x401103,null));};exports[_0x58c7('0x5c')]=function(_0x435b03,_0x5dc7d4){if(_0x435b03['body']['id']){delete _0x435b03[_0x58c7('0x53')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x435b03[_0x58c7('0x51')]['id']}})['then'](handleEntityNotFound(_0x5dc7d4,null))[_0x58c7('0x28')](function(_0xd6e164){if(_0xd6e164){return db['VoiceExtension'][_0x58c7('0x5c')](_[_0x58c7('0x5d')](_0x435b03[_0x58c7('0x53')],[_0x58c7('0x54'),_0x58c7('0x5e'),'description',_0x58c7('0x5f'),_0x58c7('0x60'),_0x58c7('0x61')]),{'where':{'context':_0xd6e164[_0x58c7('0x5e')],'exten':_0xd6e164[_0x58c7('0x54')]},'individualHooks':!![]})['then'](function(_0x3b440){return _0x3b440;});}return null;})[_0x58c7('0x28')](respondWithStatusCode(_0x5dc7d4,null))[_0x58c7('0x50')](handleError(_0x5dc7d4,null));};exports[_0x58c7('0x62')]=function(_0x5a94f2,_0x19453e,_0x341ae0){return db[_0x58c7('0x38')][_0x58c7('0x63')]({'where':{'id':_0x5a94f2['params']['id']}})[_0x58c7('0x28')](handleEntityNotFound(_0x19453e,null))[_0x58c7('0x28')](function(_0x2d89af){if(_0x2d89af){return db['sequelize'][_0x58c7('0x64')](function(_0x44b0a6){return db['VoiceExtension'][_0x58c7('0x34')]({'where':{'VoiceExtensionId':_0x5a94f2['params']['id']},'transaction':_0x44b0a6})['then'](function(_0x4447b7){var _0x2a2058=_[_0x58c7('0x43')](_0x5a94f2[_0x58c7('0x53')],function(_0x400360){_0x400360[_0x58c7('0x65')]=_0x5a94f2[_0x58c7('0x51')]['id'];return _0x400360;});return db[_0x58c7('0x38')]['bulkCreate'](_0x2a2058,{'transaction':_0x44b0a6});});})[_0x58c7('0x28')](function(){return db[_0x58c7('0x38')][_0x58c7('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5a94f2[_0x58c7('0x51')]['id']},'order':_0x58c7('0x67')});});}})['then'](respondWithResult(_0x19453e,null))[_0x58c7('0x50')](handleError(_0x19453e,null));}; \ No newline at end of file +var _0x6468=['update','then','destroy','OutboundRoutes','outbound','InternalRoutes','filter','value','type','find','name','end','sendStatus','error','stack','send','index','VoiceExtension','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','map','key','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','startsWith','exten','concat','user','get','InboundRoutes','inbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','count','set','Content-Range','apply','reject','save'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x6468,0xa1));var _0x8646=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x6468[_0x20c9b2];return _0x2c6030;};'use strict';var pdf=require(_0x8646('0x0'));var emlformat=require(_0x8646('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8646('0x2'));var rp=require(_0x8646('0x3'));var moment=require(_0x8646('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8646('0x5'));var sox=require(_0x8646('0x6'));var csv=require(_0x8646('0x7'));var ejs=require(_0x8646('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8646('0x9'));var crypto=require('crypto');var jsforce=require(_0x8646('0xa'));var deskjs=require(_0x8646('0xb'));var toCsv=require(_0x8646('0x7'));var querystring=require('querystring');var Papa=require(_0x8646('0xc'));var Redis=require(_0x8646('0xd'));var authService=require(_0x8646('0xe'));var qs=require(_0x8646('0xf'));var hardwareService=require(_0x8646('0x10'));var logger=require('../../config/logger')(_0x8646('0x11'));var utils=require(_0x8646('0x12'));var config=require('../../config/environment');var db=require(_0x8646('0x13'))['db'];config['redis']=_['defaults'](config[_0x8646('0x14')],{'host':_0x8646('0x15'),'port':0x18eb});var socket=require(_0x8646('0x16'))(new Redis(config['redis']));require(_0x8646('0x17'))[_0x8646('0x18')](socket);function respondWithStatusCode(_0x4565ea,_0x3c8842){_0x3c8842=_0x3c8842||0xcc;return function(_0x8a1489){if(_0x8a1489){return _0x4565ea['sendStatus'](_0x3c8842);}return _0x4565ea[_0x8646('0x19')](_0x3c8842)['end']();};}function respondWithResult(_0x36774f,_0x1fdf74){_0x1fdf74=_0x1fdf74||0xc8;return function(_0x5bf75b){if(_0x5bf75b){return _0x36774f[_0x8646('0x19')](_0x1fdf74)[_0x8646('0x1a')](_0x5bf75b);}};}function respondWithFilteredResult(_0x332fea,_0x26460e){return function(_0x553f86){if(_0x553f86){var _0x17be14=_0x553f86[_0x8646('0x1b')],_0x24a654=_0x26460e['offset'],_0x3f3f57=_0x26460e['offset']+_0x26460e['limit'],_0x19425a;if(_0x3f3f57>=_0x17be14){_0x3f3f57=_0x17be14;_0x19425a=0xc8;}else{_0x19425a=0xce;}_0x332fea[_0x8646('0x19')](_0x19425a);return _0x332fea[_0x8646('0x1c')](_0x8646('0x1d'),_0x24a654+'-'+_0x3f3f57+'/'+_0x17be14)['json'](_0x553f86);}return null;};}function patchUpdates(_0x34201e){return function(_0x2d5b04){try{jsonpatch[_0x8646('0x1e')](_0x2d5b04,_0x34201e,!![]);}catch(_0x3fc6ed){return BPromise[_0x8646('0x1f')](_0x3fc6ed);}return _0x2d5b04[_0x8646('0x20')]();};}function saveUpdates(_0x55a7dc,_0x217197){return function(_0x345dbc){if(_0x345dbc){return _0x345dbc[_0x8646('0x21')](_0x55a7dc)[_0x8646('0x22')](function(_0x183b1e){return _0x183b1e;});}return null;};}function removeEntity(_0x2e1ed3,_0x508ad4){return function(_0x4220b9){if(_0x4220b9){return _0x4220b9[_0x8646('0x23')]()[_0x8646('0x22')](function(){var _0x40c308=_0x4220b9['get']({'plain':!![]});var _0x11cebf=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x8646('0x24'),'value':_0x8646('0x25'),'ignore':![]},{'name':_0x8646('0x26'),'value':'internal','ignore':![]}];var _0x11bf31=_(_0x11cebf)[_0x8646('0x27')]('ignore')['map']('value')[_0x8646('0x28')]();if(_['includes'](_0x11bf31,_0x40c308[_0x8646('0x29')])){return;}var _0x6607ea=_[_0x8646('0x2a')](_0x11cebf,[_0x8646('0x28'),_0x40c308['type']])[_0x8646('0x2b')];return db['UserProfileResource'][_0x8646('0x23')]({'where':{'type':_0x6607ea,'resourceId':_0x40c308['id']}})[_0x8646('0x22')](function(){return _0x4220b9;});})[_0x8646('0x22')](function(){_0x2e1ed3[_0x8646('0x19')](0xcc)[_0x8646('0x2c')]();});}};}function handleEntityNotFound(_0x13a293,_0x2468fb){return function(_0x2070f2){if(!_0x2070f2){_0x13a293[_0x8646('0x2d')](0x194);}return _0x2070f2;};}function handleError(_0x54f074,_0x505886){_0x505886=_0x505886||0x1f4;return function(_0x1b242e){logger[_0x8646('0x2e')](_0x1b242e[_0x8646('0x2f')]);if(_0x1b242e['name']){delete _0x1b242e['name'];}_0x54f074['status'](_0x505886)[_0x8646('0x30')](_0x1b242e);};}exports[_0x8646('0x31')]=function(_0x3464e4,_0x675f69){var _0x9e64ec={},_0x7d11a3={},_0x170aa0={'count':0x0,'rows':[]};var _0x1c19b7=db[_0x8646('0x32')][_0x8646('0x33')];_0x7d11a3[_0x8646('0x34')]=_[_0x8646('0x35')](_0x1c19b7);_0x7d11a3[_0x8646('0x36')]=_[_0x8646('0x35')](_0x3464e4[_0x8646('0x36')]);_0x7d11a3[_0x8646('0x37')]=_[_0x8646('0x38')](_0x7d11a3[_0x8646('0x34')],_0x7d11a3['query']);_0x9e64ec[_0x8646('0x39')]=_[_0x8646('0x38')](_0x7d11a3[_0x8646('0x34')],qs[_0x8646('0x3a')](_0x3464e4[_0x8646('0x36')]['fields']));_0x9e64ec[_0x8646('0x39')]=_0x9e64ec[_0x8646('0x39')][_0x8646('0x3b')]?_0x9e64ec[_0x8646('0x39')]:_0x7d11a3[_0x8646('0x34')];if(!_0x3464e4[_0x8646('0x36')][_0x8646('0x3c')](_0x8646('0x3d'))){_0x9e64ec[_0x8646('0x3e')]=qs[_0x8646('0x3e')](_0x3464e4[_0x8646('0x36')]['limit']);_0x9e64ec['offset']=qs['offset'](_0x3464e4[_0x8646('0x36')][_0x8646('0x3f')]);}_0x9e64ec['order']=qs['sort'](_0x3464e4[_0x8646('0x36')][_0x8646('0x40')]);_0x9e64ec[_0x8646('0x41')]=qs[_0x8646('0x37')](_[_0x8646('0x42')](_0x3464e4[_0x8646('0x36')],_0x7d11a3[_0x8646('0x37')]));if(_0x3464e4[_0x8646('0x36')][_0x8646('0x27')]){_0x9e64ec[_0x8646('0x41')]=_[_0x8646('0x43')](_0x9e64ec['where'],{'$or':_[_0x8646('0x44')](_0x1c19b7,function(_0x55abd6){if(_0x55abd6[_0x8646('0x29')][_0x8646('0x45')]!==_0x8646('0x46')){var _0x419ebe={};_0x419ebe[_0x55abd6['field']]={'$like':'%'+_0x3464e4[_0x8646('0x36')][_0x8646('0x27')]+'%'};return _0x419ebe;}})});}_0x9e64ec=_[_0x8646('0x43')]({},_0x9e64ec,_0x3464e4['options']);var _0x5a0dc3={'where':_0x9e64ec[_0x8646('0x41')]};return db[_0x8646('0x32')][_0x8646('0x1b')](_0x5a0dc3)[_0x8646('0x22')](function(_0x35f3d3){_0x170aa0[_0x8646('0x1b')]=_0x35f3d3;if(_0x3464e4[_0x8646('0x36')][_0x8646('0x47')]){_0x9e64ec[_0x8646('0x48')]=[{'all':!![]}];}return db['VoiceExtension'][_0x8646('0x49')](_0x9e64ec);})[_0x8646('0x22')](function(_0xac95a5){_0x170aa0['rows']=_0xac95a5;return _0x170aa0;})['then'](respondWithFilteredResult(_0x675f69,_0x9e64ec))[_0x8646('0x4a')](handleError(_0x675f69,null));};exports[_0x8646('0x4b')]=function(_0x2e5bbb,_0x38c28e){var _0x3d7cb7={'raw':![],'where':{'id':_0x2e5bbb[_0x8646('0x4c')]['id']}},_0x46c313={};_0x46c313['model']=_[_0x8646('0x35')](db[_0x8646('0x32')][_0x8646('0x33')]);_0x46c313['query']=_['keys'](_0x2e5bbb['query']);_0x46c313[_0x8646('0x37')]=_[_0x8646('0x38')](_0x46c313[_0x8646('0x34')],_0x46c313[_0x8646('0x36')]);_0x3d7cb7[_0x8646('0x39')]=_[_0x8646('0x38')](_0x46c313[_0x8646('0x34')],qs[_0x8646('0x3a')](_0x2e5bbb[_0x8646('0x36')][_0x8646('0x3a')]));_0x3d7cb7['attributes']=_0x3d7cb7[_0x8646('0x39')][_0x8646('0x3b')]?_0x3d7cb7[_0x8646('0x39')]:_0x46c313[_0x8646('0x34')];if(_0x2e5bbb['query'][_0x8646('0x47')]){_0x3d7cb7[_0x8646('0x48')]=[{'all':!![]}];}_0x3d7cb7=_[_0x8646('0x43')]({},_0x3d7cb7,_0x2e5bbb[_0x8646('0x4d')]);return db[_0x8646('0x32')][_0x8646('0x2a')](_0x3d7cb7)[_0x8646('0x22')](handleEntityNotFound(_0x38c28e,null))['then'](respondWithResult(_0x38c28e,null))[_0x8646('0x4a')](handleError(_0x38c28e,null));};exports[_0x8646('0x23')]=function(_0x1f9029,_0x362b24){return db[_0x8646('0x32')][_0x8646('0x2a')]({'where':{'id':_0x1f9029[_0x8646('0x4c')]['id']}})['then'](handleEntityNotFound(_0x362b24,null))[_0x8646('0x22')](removeEntity(_0x362b24,null))[_0x8646('0x4a')](handleError(_0x362b24,null));};exports[_0x8646('0x4e')]=function(_0x472e7a,_0x2884c6){if(_0x472e7a[_0x8646('0x4f')]['type']==='outbound'&&!_[_0x8646('0x50')](_0x472e7a[_0x8646('0x4f')][_0x8646('0x51')],'_')){_0x472e7a[_0x8646('0x4f')]['exten']='_'[_0x8646('0x52')](_0x472e7a[_0x8646('0x4f')]['exten']);}return db['VoiceExtension'][_0x8646('0x4e')](_0x472e7a['body'],{'raw':![]})['then'](function(_0x1e5844){var _0x4ce15e=_0x472e7a[_0x8646('0x53')][_0x8646('0x54')]({'plain':!![]});if(!_0x4ce15e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ce15e['role']===_0x8646('0x53')){var _0x4afab8=_0x1e5844[_0x8646('0x54')]({'plain':!![]});var _0x21a8ac=[{'name':_0x8646('0x55'),'value':_0x8646('0x56')},{'name':_0x8646('0x24'),'value':'outbound'},{'name':_0x8646('0x26'),'value':'internal'}];var _0xf66f5b=_[_0x8646('0x2a')](_0x21a8ac,[_0x8646('0x28'),_0x4afab8['type']])[_0x8646('0x2b')];return db[_0x8646('0x57')][_0x8646('0x2a')]({'where':{'name':_0xf66f5b,'userProfileId':_0x4ce15e['userProfileId']},'raw':!![]})['then'](function(_0x392d65){if(_0x392d65&&_0x392d65['autoAssociation']===0x0){return db['UserProfileResource'][_0x8646('0x4e')]({'name':_0x4afab8[_0x8646('0x2b')],'resourceId':_0x4afab8['id'],'type':_0x392d65[_0x8646('0x2b')],'sectionId':_0x392d65['id']},{})['then'](function(){return _0x1e5844;});}else{return _0x1e5844;}})[_0x8646('0x4a')](function(_0x4fd747){logger[_0x8646('0x2e')](_0x8646('0x58'),_0x4fd747);throw _0x4fd747;});}return _0x1e5844;})[_0x8646('0x22')](respondWithResult(_0x2884c6,0xc9))[_0x8646('0x4a')](handleError(_0x2884c6,null));};exports[_0x8646('0x21')]=function(_0x18de18,_0x1e293c){if(_0x18de18[_0x8646('0x4f')]['id']){delete _0x18de18[_0x8646('0x4f')]['id'];}return db[_0x8646('0x32')][_0x8646('0x2a')]({'where':{'id':_0x18de18['params']['id']}})['then'](handleEntityNotFound(_0x1e293c,null))[_0x8646('0x22')](function(_0x576ae1){if(_0x576ae1){return db['VoiceExtension'][_0x8646('0x21')](_[_0x8646('0x42')](_0x18de18[_0x8646('0x4f')],['exten',_0x8646('0x59'),'description',_0x8646('0x5a'),_0x8646('0x5b'),_0x8646('0x5c')]),{'where':{'context':_0x576ae1[_0x8646('0x59')],'exten':_0x576ae1[_0x8646('0x51')]},'individualHooks':!![]})[_0x8646('0x22')](function(_0x10b0ef){return _0x10b0ef;});}return null;})[_0x8646('0x22')](respondWithStatusCode(_0x1e293c,null))['catch'](handleError(_0x1e293c,null));};exports['addApplications']=function(_0x4369f3,_0xb7feba,_0x14f670){return db['VoiceExtension']['findOne']({'where':{'id':_0x4369f3['params']['id']}})[_0x8646('0x22')](handleEntityNotFound(_0xb7feba,null))[_0x8646('0x22')](function(_0x5a492a){if(_0x5a492a){return db['sequelize'][_0x8646('0x5d')](function(_0x11b352){return db[_0x8646('0x32')]['destroy']({'where':{'VoiceExtensionId':_0x4369f3[_0x8646('0x4c')]['id']},'transaction':_0x11b352})['then'](function(_0x31e440){var _0x486c05=_[_0x8646('0x44')](_0x4369f3[_0x8646('0x4f')],function(_0x5deaad){_0x5deaad['VoiceExtensionId']=_0x4369f3[_0x8646('0x4c')]['id'];return _0x5deaad;});return db[_0x8646('0x32')][_0x8646('0x5e')](_0x486c05,{'transaction':_0x11b352});});})[_0x8646('0x22')](function(){return db[_0x8646('0x32')][_0x8646('0x5f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4369f3[_0x8646('0x4c')]['id']},'order':_0x8646('0x60')});});}})['then'](respondWithResult(_0xb7feba,null))['catch'](handleError(_0xb7feba,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 1927c44..37b7e51 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 _0x1552=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','VoiceExtension'];(function(_0x9cb6d8,_0x4bff88){var _0x467d58=function(_0x1c21e5){while(--_0x1c21e5){_0x9cb6d8['push'](_0x9cb6d8['shift']());}};_0x467d58(++_0x4bff88);}(_0x1552,0x1e4));var _0x2155=function(_0x3a7e42,_0x58e47d){_0x3a7e42=_0x3a7e42-0x0;var _0x7122b7=_0x1552[_0x3a7e42];return _0x7122b7;};'use strict';var EventEmitter=require(_0x2155('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x2155('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2155('0x2')](0x0);var events={'afterCreate':_0x2155('0x3'),'afterUpdate':_0x2155('0x4'),'afterDestroy':_0x2155('0x5')};function emitEvent(_0x20135c){return function(_0xc5fc19,_0x53dc84,_0x77ce21){VoiceExtensionEvents[_0x2155('0x6')](_0x20135c+':'+_0xc5fc19['id'],_0xc5fc19);VoiceExtensionEvents[_0x2155('0x6')](_0x20135c,_0xc5fc19);_0x77ce21(null);};}for(var e in events){if(events[_0x2155('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x2155('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x2ba7=['emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2ba7,0xe9));var _0x72ba=function(_0x275b07,_0x150799){_0x275b07=_0x275b07-0x0;var _0x2700ea=_0x2ba7[_0x275b07];return _0x2700ea;};'use strict';var EventEmitter=require(_0x72ba('0x0'));var VoiceExtension=require(_0x72ba('0x1'))['db'][_0x72ba('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x72ba('0x3')](0x0);var events={'afterCreate':_0x72ba('0x4'),'afterUpdate':_0x72ba('0x5'),'afterDestroy':_0x72ba('0x6')};function emitEvent(_0x160afc){return function(_0x205f12,_0x4f9375,_0x9ad7c7){VoiceExtensionEvents[_0x72ba('0x7')](_0x160afc+':'+_0x205f12['id'],_0x205f12);VoiceExtensionEvents[_0x72ba('0x7')](_0x160afc,_0x205f12);_0x9ad7c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x72ba('0x8')](e,emitEvent(event));}}module[_0x72ba('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 87fe3e6..b27bace 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 _0xc7e5=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','voice_extensions','lodash'];(function(_0x192f9f,_0x3052e7){var _0x1465a7=function(_0x34001e){while(--_0x34001e){_0x192f9f['push'](_0x192f9f['shift']());}};_0x1465a7(++_0x3052e7);}(_0xc7e5,0x1af));var _0x5c7e=function(_0x7fab3,_0x1ec6a1){_0x7fab3=_0x7fab3-0x0;var _0x25acc7=_0xc7e5[_0x7fab3];return _0x25acc7;};'use strict';var _=require(_0x5c7e('0x0'));var util=require(_0x5c7e('0x1'));var logger=require(_0x5c7e('0x2'))(_0x5c7e('0x3'));var moment=require('moment');var BPromise=require(_0x5c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c7e('0x5'));var rimraf=require(_0x5c7e('0x6'));var config=require(_0x5c7e('0x7'));var attributes=require(_0x5c7e('0x8'));module[_0x5c7e('0x9')]=function(_0x441baa,_0x5cdb65){return _0x441baa[_0x5c7e('0xa')]('VoiceExtension',attributes,{'tableName':_0x5c7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0c1=['path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0xc0c1,0x16f));var _0x1c0c=function(_0x4e63c8,_0x5544db){_0x4e63c8=_0x4e63c8-0x0;var _0x5bd106=_0xc0c1[_0x4e63c8];return _0x5bd106;};'use strict';var _=require(_0x1c0c('0x0'));var util=require(_0x1c0c('0x1'));var logger=require(_0x1c0c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c0c('0x3'));var rp=require(_0x1c0c('0x4'));var fs=require('fs');var path=require(_0x1c0c('0x5'));var rimraf=require(_0x1c0c('0x6'));var config=require(_0x1c0c('0x7'));var attributes=require(_0x1c0c('0x8'));module[_0x1c0c('0x9')]=function(_0x27192a,_0x3212bf){return _0x27192a[_0x1c0c('0xa')](_0x1c0c('0xb'),attributes,{'tableName':'voice_extensions','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 3d8982b..a2f5328 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 _0x861b=['result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x18470a,_0x5de236){var _0x38dee2=function(_0x498e80){while(--_0x498e80){_0x18470a['push'](_0x18470a['shift']());}};_0x38dee2(++_0x5de236);}(_0x861b,0x1ad));var _0xb861=function(_0x54ef43,_0x308497){_0x54ef43=_0x54ef43-0x0;var _0x4e3816=_0x861b[_0x54ef43];return _0x4e3816;};'use strict';var _=require(_0xb861('0x0'));var util=require(_0xb861('0x1'));var moment=require(_0xb861('0x2'));var BPromise=require(_0xb861('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb861('0x4'));var db=require(_0xb861('0x5'))['db'];var utils=require(_0xb861('0x6'));var logger=require('../../config/logger')(_0xb861('0x7'));var config=require(_0xb861('0x8'));var jayson=require(_0xb861('0x9'));var client=jayson[_0xb861('0xa')]['http']({'port':0x232a});config[_0xb861('0xb')]=_[_0xb861('0xc')](config[_0xb861('0xb')],{'host':_0xb861('0xd'),'port':0x18eb});var socket=require(_0xb861('0xe'))(new Redis(config[_0xb861('0xb')]));require(_0xb861('0xf'))['register'](socket);function respondWithRpcPromise(_0x136420,_0xc29eae,_0x8227ab){return new BPromise(function(_0x3a4e5e,_0x202e47){return client[_0xb861('0x10')](_0x136420,_0x8227ab)[_0xb861('0x11')](function(_0x3898bd){logger['info'](_0xb861('0x12'),_0xc29eae,_0xb861('0x13'));logger[_0xb861('0x14')](_0xb861('0x15'),_0xc29eae,'request\x20sent',JSON[_0xb861('0x16')](_0x3898bd));if(_0x3898bd[_0xb861('0x17')]){if(_0x3898bd[_0xb861('0x17')][_0xb861('0x18')]===0x1f4){logger[_0xb861('0x17')]('VoiceExtension,\x20%s,\x20%s',_0xc29eae,_0x3898bd[_0xb861('0x17')][_0xb861('0x19')]);return _0x202e47(_0x3898bd[_0xb861('0x17')]['message']);}logger[_0xb861('0x17')]('VoiceExtension,\x20%s,\x20%s',_0xc29eae,_0x3898bd[_0xb861('0x17')][_0xb861('0x19')]);return _0x3a4e5e(_0x3898bd[_0xb861('0x17')][_0xb861('0x19')]);}else{logger[_0xb861('0x1a')](_0xb861('0x12'),_0xc29eae,_0xb861('0x13'));_0x3a4e5e(_0x3898bd[_0xb861('0x1b')][_0xb861('0x19')]);}})[_0xb861('0x1c')](function(_0x19d5b5){logger[_0xb861('0x17')]('VoiceExtension,\x20%s,\x20%s',_0xc29eae,_0x19d5b5);_0x202e47(_0x19d5b5);});});}exports[_0xb861('0x1d')]=function(_0x1c956f){var _0x541d6a=this;return new Promise(function(_0x27785c,_0x577439){return db[_0xb861('0x1e')]['findAll']({'raw':_0x1c956f[_0xb861('0x1f')]?_0x1c956f[_0xb861('0x1f')][_0xb861('0x20')]===undefined?!![]:![]:!![],'where':_0x1c956f[_0xb861('0x1f')]?_0x1c956f[_0xb861('0x1f')][_0xb861('0x21')]||null:null,'attributes':_0x1c956f['options']?_0x1c956f[_0xb861('0x1f')]['attributes']||null:null,'limit':_0x1c956f['options']?_0x1c956f[_0xb861('0x1f')]['limit']||null:null,'include':_0x1c956f[_0xb861('0x1f')]?_0x1c956f[_0xb861('0x1f')][_0xb861('0x22')]?_[_0xb861('0x23')](_0x1c956f[_0xb861('0x1f')]['include'],function(_0x583aa6){return{'model':db[_0x583aa6[_0xb861('0x24')]],'as':_0x583aa6['as'],'attributes':_0x583aa6['attributes'],'include':_0x583aa6['include']?_[_0xb861('0x23')](_0x583aa6[_0xb861('0x22')],function(_0x3d39ea){return{'model':db[_0x3d39ea[_0xb861('0x24')]],'as':_0x3d39ea['as'],'attributes':_0x3d39ea[_0xb861('0x25')],'include':_0x3d39ea[_0xb861('0x22')]?_[_0xb861('0x23')](_0x3d39ea[_0xb861('0x22')],function(_0x37d861){return{'model':db[_0x37d861[_0xb861('0x24')]],'as':_0x37d861['as'],'attributes':_0x37d861[_0xb861('0x25')]};}):[]};}):[]};}):[]:[]})[_0xb861('0x11')](function(_0x249e08){logger['info'](_0xb861('0x1d'),_0x1c956f);logger[_0xb861('0x14')](_0xb861('0x1d'),_0x1c956f,JSON[_0xb861('0x16')](_0x249e08));_0x27785c(_0x249e08);})[_0xb861('0x1c')](function(_0x190331){logger[_0xb861('0x17')](_0xb861('0x1d'),_0x190331[_0xb861('0x19')],_0x1c956f);_0x577439(_0x541d6a['error'](0x1f4,_0x190331['message']));});});}; \ No newline at end of file +var _0x522a=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','attributes','limit','include','map','model','debug','stringify','lodash'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x522a,0x155));var _0xa522=function(_0x430936,_0x2a6e66){_0x430936=_0x430936-0x0;var _0x470994=_0x522a[_0x430936];return _0x470994;};'use strict';var _=require(_0xa522('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa522('0x1'));var fs=require('fs');var Redis=require(_0xa522('0x2'));var db=require(_0xa522('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa522('0x4'))(_0xa522('0x5'));var config=require(_0xa522('0x6'));var jayson=require(_0xa522('0x7'));var client=jayson[_0xa522('0x8')][_0xa522('0x9')]({'port':0x232a});config['redis']=_[_0xa522('0xa')](config[_0xa522('0xb')],{'host':_0xa522('0xc'),'port':0x18eb});var socket=require(_0xa522('0xd'))(new Redis(config[_0xa522('0xb')]));require(_0xa522('0xe'))[_0xa522('0xf')](socket);function respondWithRpcPromise(_0x1130b3,_0x6c369e,_0x45360b){return new BPromise(function(_0x70c7cc,_0x3de998){return client[_0xa522('0x10')](_0x1130b3,_0x45360b)[_0xa522('0x11')](function(_0x3fae3f){logger[_0xa522('0x12')](_0xa522('0x13'),_0x6c369e,_0xa522('0x14'));logger['debug'](_0xa522('0x15'),_0x6c369e,_0xa522('0x14'),JSON['stringify'](_0x3fae3f));if(_0x3fae3f[_0xa522('0x16')]){if(_0x3fae3f[_0xa522('0x16')][_0xa522('0x17')]===0x1f4){logger[_0xa522('0x16')](_0xa522('0x13'),_0x6c369e,_0x3fae3f[_0xa522('0x16')]['message']);return _0x3de998(_0x3fae3f[_0xa522('0x16')]['message']);}logger[_0xa522('0x16')](_0xa522('0x13'),_0x6c369e,_0x3fae3f[_0xa522('0x16')][_0xa522('0x18')]);return _0x70c7cc(_0x3fae3f['error'][_0xa522('0x18')]);}else{logger[_0xa522('0x12')](_0xa522('0x13'),_0x6c369e,_0xa522('0x14'));_0x70c7cc(_0x3fae3f[_0xa522('0x19')][_0xa522('0x18')]);}})[_0xa522('0x1a')](function(_0x1d3d77){logger[_0xa522('0x16')](_0xa522('0x13'),_0x6c369e,_0x1d3d77);_0x3de998(_0x1d3d77);});});}exports[_0xa522('0x1b')]=function(_0xaa0ec6){var _0xf9f0fc=this;return new Promise(function(_0x444d73,_0x13390a){return db[_0xa522('0x1c')]['findAll']({'raw':_0xaa0ec6[_0xa522('0x1d')]?_0xaa0ec6['options'][_0xa522('0x1e')]===undefined?!![]:![]:!![],'where':_0xaa0ec6['options']?_0xaa0ec6[_0xa522('0x1d')]['where']||null:null,'attributes':_0xaa0ec6[_0xa522('0x1d')]?_0xaa0ec6['options'][_0xa522('0x1f')]||null:null,'limit':_0xaa0ec6[_0xa522('0x1d')]?_0xaa0ec6[_0xa522('0x1d')][_0xa522('0x20')]||null:null,'include':_0xaa0ec6[_0xa522('0x1d')]?_0xaa0ec6[_0xa522('0x1d')][_0xa522('0x21')]?_[_0xa522('0x22')](_0xaa0ec6[_0xa522('0x1d')][_0xa522('0x21')],function(_0x5cd9e4){return{'model':db[_0x5cd9e4['model']],'as':_0x5cd9e4['as'],'attributes':_0x5cd9e4[_0xa522('0x1f')],'include':_0x5cd9e4[_0xa522('0x21')]?_[_0xa522('0x22')](_0x5cd9e4['include'],function(_0x3b59d8){return{'model':db[_0x3b59d8[_0xa522('0x23')]],'as':_0x3b59d8['as'],'attributes':_0x3b59d8[_0xa522('0x1f')],'include':_0x3b59d8[_0xa522('0x21')]?_[_0xa522('0x22')](_0x3b59d8[_0xa522('0x21')],function(_0x9cea94){return{'model':db[_0x9cea94[_0xa522('0x23')]],'as':_0x9cea94['as'],'attributes':_0x9cea94[_0xa522('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa522('0x11')](function(_0x7478f5){logger['info'](_0xa522('0x1b'),_0xaa0ec6);logger[_0xa522('0x24')](_0xa522('0x1b'),_0xaa0ec6,JSON[_0xa522('0x25')](_0x7478f5));_0x444d73(_0x7478f5);})['catch'](function(_0x51b045){logger['error'](_0xa522('0x1b'),_0x51b045[_0xa522('0x18')],_0xaa0ec6);_0x13390a(_0xf9f0fc[_0xa522('0x16')](0x1f4,_0x51b045[_0xa522('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1acda4a..fd12340 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 _0x5d16=['length','./voiceExtension.events','save','remove','update','removeListener'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5d16,0xa3));var _0x65d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d16[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceExtensionEvents=require(_0x65d1('0x0'));var events=[_0x65d1('0x1'),_0x65d1('0x2'),_0x65d1('0x3')];function createListener(_0x574ee9,_0x21883b){return function(_0x4db420){_0x21883b['emit'](_0x574ee9,_0x4db420);};}function removeListener(_0x551138,_0x51c581){return function(){VoiceExtensionEvents[_0x65d1('0x4')](_0x551138,_0x51c581);};}exports['register']=function(_0x414d4c){for(var _0x18cdc2=0x0,_0x4b9607=events[_0x65d1('0x5')];_0x18cdc2<_0x4b9607;_0x18cdc2++){var _0x4a8a44=events[_0x18cdc2];var _0x31005f=createListener('voiceExtension:'+_0x4a8a44,_0x414d4c);VoiceExtensionEvents['on'](_0x4a8a44,_0x31005f);}}; \ No newline at end of file +var _0xc405=['save','register','length','./voiceExtension.events'];(function(_0x1ecfa1,_0x361295){var _0x994c55=function(_0x3acd3f){while(--_0x3acd3f){_0x1ecfa1['push'](_0x1ecfa1['shift']());}};_0x994c55(++_0x361295);}(_0xc405,0x8b));var _0x5c40=function(_0x246cbe,_0x19305c){_0x246cbe=_0x246cbe-0x0;var _0x855b0=_0xc405[_0x246cbe];return _0x855b0;};'use strict';var VoiceExtensionEvents=require(_0x5c40('0x0'));var events=[_0x5c40('0x1'),'remove','update'];function createListener(_0x284e37,_0x31a9be){return function(_0x506f74){_0x31a9be['emit'](_0x284e37,_0x506f74);};}function removeListener(_0x2f480d,_0x4a07a4){return function(){VoiceExtensionEvents['removeListener'](_0x2f480d,_0x4a07a4);};}exports[_0x5c40('0x2')]=function(_0x361600){for(var _0x557901=0x0,_0x3386d2=events[_0x5c40('0x3')];_0x557901<_0x3386d2;_0x557901++){var _0x558b4e=events[_0x557901];var _0x306bb9=createListener('voiceExtension:'+_0x558b4e,_0x361600);VoiceExtensionEvents['on'](_0x558b4e,_0x306bb9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5283e5c..8ed7fe8 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 _0x97cb=['/:id','show','/:id/messages','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index'];(function(_0xa6b085,_0x7728a0){var _0x1a1e4c=function(_0x2680e7){while(--_0x2680e7){_0xa6b085['push'](_0xa6b085['shift']());}};_0x1a1e4c(++_0x7728a0);}(_0x97cb,0x125));var _0xb97c=function(_0x48ee2c,_0x2d9b6d){_0x48ee2c=_0x48ee2c-0x0;var _0x2272bf=_0x97cb[_0x48ee2c];return _0x2272bf;};'use strict';var multer=require(_0xb97c('0x0'));var util=require(_0xb97c('0x1'));var path=require(_0xb97c('0x2'));var timeout=require(_0xb97c('0x3'));var express=require('express');var router=express[_0xb97c('0x4')]();var auth=require(_0xb97c('0x5'));var interaction=require(_0xb97c('0x6'));var config=require('../../config/environment');var controller=require(_0xb97c('0x7'));router[_0xb97c('0x8')]('/',auth[_0xb97c('0x9')](),controller[_0xb97c('0xa')]);router[_0xb97c('0x8')](_0xb97c('0xb'),auth[_0xb97c('0x9')](),controller[_0xb97c('0xc')]);router[_0xb97c('0x8')](_0xb97c('0xd'),auth[_0xb97c('0x9')](),controller['getMessages']);router[_0xb97c('0xe')]('/',auth[_0xb97c('0x9')](),controller['create']);router[_0xb97c('0xf')](_0xb97c('0xb'),auth[_0xb97c('0x9')](),controller[_0xb97c('0x10')]);router[_0xb97c('0x11')](_0xb97c('0xb'),auth[_0xb97c('0x9')](),controller['destroy']);module[_0xb97c('0x12')]=router; \ No newline at end of file +var _0x555e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','show','getMessages','post','create','put','update','delete','exports','multer','util','path'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x555e,0xba));var _0xe555=function(_0xb8298b,_0x411bdc){_0xb8298b=_0xb8298b-0x0;var _0x2077ab=_0x555e[_0xb8298b];return _0x2077ab;};'use strict';var multer=require(_0xe555('0x0'));var util=require(_0xe555('0x1'));var path=require(_0xe555('0x2'));var timeout=require(_0xe555('0x3'));var express=require(_0xe555('0x4'));var router=express[_0xe555('0x5')]();var auth=require(_0xe555('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe555('0x7'));var controller=require(_0xe555('0x8'));router[_0xe555('0x9')]('/',auth['isAuthenticated'](),controller[_0xe555('0xa')]);router['get'](_0xe555('0xb'),auth[_0xe555('0xc')](),controller[_0xe555('0xd')]);router[_0xe555('0x9')]('/:id/messages',auth[_0xe555('0xc')](),controller[_0xe555('0xe')]);router[_0xe555('0xf')]('/',auth[_0xe555('0xc')](),controller[_0xe555('0x10')]);router[_0xe555('0x11')](_0xe555('0xb'),auth[_0xe555('0xc')](),controller[_0xe555('0x12')]);router[_0xe555('0x13')](_0xe555('0xb'),auth[_0xe555('0xc')](),controller['destroy']);module[_0xe555('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 8cb4689..6f4fa28 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 _0x9354=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x9354,0x96));var _0x4935=function(_0x474035,_0x41e639){_0x474035=_0x474035-0x0;var _0x1b58e0=_0x9354[_0x474035];return _0x1b58e0;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'customer_id':{'type':Sequelize[_0x4935('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x4935('0x2'),'unique':_0x4935('0x3')},'mailbox':{'type':Sequelize[_0x4935('0x1')],'defaultValue':'','allowNull':![],'unique':_0x4935('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x4935('0x1')]},'email':{'type':Sequelize[_0x4935('0x1')],'validate':{'isEmail':!![]},'set':function(_0x127226){this[_0x4935('0x4')](_0x4935('0x5'),typeof _0x127226===_0x4935('0x6')&&_0x127226[_0x4935('0x7')]()?_0x127226[_0x4935('0x7')]():null);}},'pager':{'type':Sequelize[_0x4935('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x4935('0x8')},'attach':{'type':Sequelize['ENUM'](_0x4935('0x9'),'no'),'defaultValue':_0x4935('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4935('0xa')](_0x4935('0x9'),'no'),'defaultValue':_0x4935('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4935('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x4935('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4935('0xa')](_0x4935('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4935('0xa')](_0x4935('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4935('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4935('0xa')](_0x4935('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4935('0xa')](_0x4935('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4935('0xa')](_0x4935('0x9'),'no'),'defaultValue':_0x4935('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4935('0xa')](_0x4935('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4935('0xa')](_0x4935('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x4935('0x9'),'no'),'defaultValue':_0x4935('0x9'),'allowNull':![]},'stamp':{'type':_0x4935('0xc')},'emailsubject':{'type':Sequelize[_0x4935('0x1')]},'emailbody':{'type':Sequelize[_0x4935('0x1')]},'maxsecs':{'type':Sequelize[_0x4935('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4935('0xe')],'get':function(){return this[_0x4935('0xf')]('fullname')+_0x4935('0x10')+this[_0x4935('0xf')](_0x4935('0x11'));}}}; \ No newline at end of file +var _0xda3f=['fullname','\x20-\x20','exports','STRING','setDataValue','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x370b9d,_0x328107){var _0xe420a9=function(_0xe86f2a){while(--_0xe86f2a){_0x370b9d['push'](_0x370b9d['shift']());}};_0xe420a9(++_0x328107);}(_0xda3f,0xec));var _0xfda3=function(_0x4d0748,_0x5d7876){_0x4d0748=_0x4d0748-0x0;var _0x4fbf74=_0xda3f[_0x4d0748];return _0x4fbf74;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'customer_id':{'type':Sequelize[_0xfda3('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfda3('0x1')]},'fullname':{'type':Sequelize[_0xfda3('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x42bd74){this[_0xfda3('0x2')]('email',typeof _0x42bd74==='string'&&_0x42bd74[_0xfda3('0x3')]()?_0x42bd74[_0xfda3('0x3')]():null);}},'pager':{'type':Sequelize[_0xfda3('0x1')]},'tz':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':_0xfda3('0x4')},'attach':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfda3('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfda3('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'stamp':{'type':_0xfda3('0x8')},'emailsubject':{'type':Sequelize[_0xfda3('0x1')]},'emailbody':{'type':Sequelize[_0xfda3('0x1')]},'maxsecs':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfda3('0xa')](_0xfda3('0xb'))+_0xfda3('0xc')+this[_0xfda3('0xa')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0c2b036..a03e80d 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 _0xa9e0=['send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','key','VIRTUAL','field','options','includeAll','include','VoiceMail','rows','catch','show','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','getMessages','hasOwnProperty','pick','map','mailbox','VoiceMailMessage','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','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name'];(function(_0x4c8f17,_0xf7db09){var _0x40d9ce=function(_0x215a35){while(--_0x215a35){_0x4c8f17['push'](_0x4c8f17['shift']());}};_0x40d9ce(++_0xf7db09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){var _0x432e56=_0x5a09ef[_0x0a9e('0x20')]({'plain':!![]});var _0x30bae6='Voicemails';return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'type':_0x30bae6,'resourceId':_0x432e56['id']}})[_0x0a9e('0x1f')](function(){return _0x5a09ef;});})[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x13')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x23')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x24')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x25')](_0x33161b);};}exports[_0x0a9e('0x26')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=db['VoiceMail'][_0x0a9e('0x27')];_0x1538a4[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](_0x14de77);_0x1538a4[_0x0a9e('0x2a')]=_['keys'](_0x25fba9[_0x0a9e('0x2a')]);_0x1538a4[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],_0x1538a4[_0x0a9e('0x2a')]);_0x140511[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],qs[_0x0a9e('0x2e')](_0x25fba9['query'][_0x0a9e('0x2e')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x140511[_0x0a9e('0x2d')]:_0x1538a4[_0x0a9e('0x28')];if(!_0x25fba9[_0x0a9e('0x2a')]['hasOwnProperty'](_0x0a9e('0x30'))){_0x140511[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x19')]);_0x140511[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x25fba9[_0x0a9e('0x2a')]['offset']);}_0x140511[_0x0a9e('0x31')]=qs['sort'](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x140511[_0x0a9e('0x33')]=qs[_0x0a9e('0x2b')](_['pick'](_0x25fba9[_0x0a9e('0x2a')],_0x1538a4[_0x0a9e('0x2b')]));if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]){_0x140511['where']=_['merge'](_0x140511[_0x0a9e('0x33')],{'$or':_['map'](_0x14de77,function(_0x24936a){if(_0x24936a[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4f41ae={};_0x4f41ae[_0x24936a[_0x0a9e('0x38')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]+'%'};return _0x4f41ae;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x39')]);var _0x1a180b={'where':_0x140511[_0x0a9e('0x33')]};return db['VoiceMail']['count'](_0x1a180b)[_0x0a9e('0x1f')](function(_0x40d766){_0x11c3b6['count']=_0x40d766;if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x140511[_0x0a9e('0x3b')]=[{'all':!![]}];}return db[_0x0a9e('0x3c')]['findAll'](_0x140511);})['then'](function(_0x15e37d){_0x11c3b6[_0x0a9e('0x3d')]=_0x15e37d;return _0x11c3b6;})['then'](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x3e')](handleError(_0x14433c,null));};exports[_0x0a9e('0x3f')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x40')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](db[_0x0a9e('0x3c')][_0x0a9e('0x27')]);_0x2cfea9[_0x0a9e('0x2a')]=_[_0x0a9e('0x29')](_0x1459bb[_0x0a9e('0x2a')]);_0x2cfea9[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x2cfea9[_0x0a9e('0x28')],_0x2cfea9[_0x0a9e('0x2a')]);_0x316c8f[_0x0a9e('0x2d')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x2e')](_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x316c8f[_0x0a9e('0x2d')]=_0x316c8f[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x316c8f[_0x0a9e('0x2d')]:_0x2cfea9[_0x0a9e('0x28')];if(_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x316c8f[_0x0a9e('0x3b')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x41')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x316c8f)[_0x0a9e('0x1f')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x1f')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x3e')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x43')]=function(_0x21eb86,_0x44dd99){return db['VoiceMail'][_0x0a9e('0x43')](_0x21eb86['body'],{})[_0x0a9e('0x1f')](function(_0x476688){var _0x8d6dd1=_0x21eb86['user'][_0x0a9e('0x20')]({'plain':!![]});if(!_0x8d6dd1)throw new Error(_0x0a9e('0x44'));if(_0x8d6dd1[_0x0a9e('0x45')]===_0x0a9e('0x46')){var _0x45c845=_0x476688[_0x0a9e('0x20')]({'plain':!![]});var _0x45bf7f='Voicemails';return db[_0x0a9e('0x47')][_0x0a9e('0x42')]({'where':{'name':_0x45bf7f,'userProfileId':_0x8d6dd1[_0x0a9e('0x48')]},'raw':!![]})[_0x0a9e('0x1f')](function(_0x409789){if(_0x409789&&_0x409789[_0x0a9e('0x49')]===0x0){return db[_0x0a9e('0x21')][_0x0a9e('0x43')]({'name':_0x45c845[_0x0a9e('0x24')],'resourceId':_0x45c845['id'],'type':_0x409789['name'],'sectionId':_0x409789['id']},{})[_0x0a9e('0x1f')](function(){return _0x476688;});}else{return _0x476688;}})[_0x0a9e('0x3e')](function(_0x4f7240){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7240);throw _0x4f7240;});}return _0x476688;})[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x3e')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x11545a,_0x61bb17){if(_0x11545a[_0x0a9e('0x4b')]['id']){delete _0x11545a[_0x0a9e('0x4b')]['id'];}return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x11545a['params']['id']}})['then'](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x1f')](saveUpdates(_0x11545a[_0x0a9e('0x4b')],null))[_0x0a9e('0x1f')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};exports[_0x0a9e('0x22')]=function(_0x161aa7,_0x53d113){return db['VoiceMail'][_0x0a9e('0x42')]({'where':{'id':_0x161aa7['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x53d113,null))['then'](removeEntity(_0x53d113,null))[_0x0a9e('0x3e')](handleError(_0x53d113,null));};exports[_0x0a9e('0x4c')]=function(_0x439340,_0x53613a,_0x2f82da){return db[_0x0a9e('0x3c')]['findOne']({'where':{'id':_0x439340['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x53613a,null))[_0x0a9e('0x1f')](function(_0x49c095){var _0x145931;var _0x5ce9ac={},_0x211ef9={};_0x211ef9['model']=_[_0x0a9e('0x29')](db['VoiceMailMessage']['rawAttributes']);_0x211ef9['query']=_[_0x0a9e('0x29')](_0x439340['query']);_0x211ef9[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x211ef9[_0x0a9e('0x28')],_0x211ef9[_0x0a9e('0x2a')]);_0x5ce9ac[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x211ef9[_0x0a9e('0x28')],qs[_0x0a9e('0x2e')](_0x439340['query'][_0x0a9e('0x2e')]));_0x5ce9ac[_0x0a9e('0x2d')]=_0x5ce9ac[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x5ce9ac[_0x0a9e('0x2d')]:_0x211ef9[_0x0a9e('0x28')];if(!_0x439340['query'][_0x0a9e('0x4d')](_0x0a9e('0x30'))){_0x5ce9ac['limit']=qs[_0x0a9e('0x19')](_0x439340['query'][_0x0a9e('0x19')]);_0x5ce9ac['offset']=qs['offset'](_0x439340['query'][_0x0a9e('0x18')]);}_0x5ce9ac['order']=qs[_0x0a9e('0x32')](_0x439340[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x5ce9ac[_0x0a9e('0x33')]=qs[_0x0a9e('0x2b')](_[_0x0a9e('0x4e')](_0x439340['query'],_0x211ef9[_0x0a9e('0x2b')]));if(_0x439340['query'][_0x0a9e('0x34')]){_0x5ce9ac[_0x0a9e('0x33')]=_[_0x0a9e('0x41')](_0x5ce9ac['where'],{'$or':_[_0x0a9e('0x4f')](_0x5ce9ac[_0x0a9e('0x2d')],function(_0x119677){var _0x32e134={};_0x32e134[_0x119677]={'$like':'%'+_0x439340['query'][_0x0a9e('0x34')]+'%'};return _0x32e134;})});}_0x5ce9ac[_0x0a9e('0x33')]=_['merge'](_0x5ce9ac[_0x0a9e('0x33')],{'mailboxuser':_0x49c095[_0x0a9e('0x50')]});_0x5ce9ac=_[_0x0a9e('0x41')]({},_0x5ce9ac,_0x439340[_0x0a9e('0x39')]);return db[_0x0a9e('0x51')]['findAndCountAll'](_0x5ce9ac)[_0x0a9e('0x1f')](respondWithFilteredResult(_0x53613a,_0x5ce9ac));})[_0x0a9e('0x3e')](handleError(_0x53613a,null));}; \ No newline at end of file +var _0xa9e0=['send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','key','VIRTUAL','field','options','includeAll','include','VoiceMail','rows','catch','show','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','getMessages','hasOwnProperty','pick','map','mailbox','VoiceMailMessage','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','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name'];(function(_0x44616a,_0x2d6a8c){var _0x57fd42=function(_0x5933b4){while(--_0x5933b4){_0x44616a['push'](_0x44616a['shift']());}};_0x57fd42(++_0x2d6a8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){var _0x432e56=_0x5a09ef[_0x0a9e('0x20')]({'plain':!![]});var _0x30bae6='Voicemails';return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'type':_0x30bae6,'resourceId':_0x432e56['id']}})[_0x0a9e('0x1f')](function(){return _0x5a09ef;});})[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x13')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x23')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x24')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x25')](_0x33161b);};}exports[_0x0a9e('0x26')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=db['VoiceMail'][_0x0a9e('0x27')];_0x1538a4[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](_0x14de77);_0x1538a4[_0x0a9e('0x2a')]=_['keys'](_0x25fba9[_0x0a9e('0x2a')]);_0x1538a4[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],_0x1538a4[_0x0a9e('0x2a')]);_0x140511[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],qs[_0x0a9e('0x2e')](_0x25fba9['query'][_0x0a9e('0x2e')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x140511[_0x0a9e('0x2d')]:_0x1538a4[_0x0a9e('0x28')];if(!_0x25fba9[_0x0a9e('0x2a')]['hasOwnProperty'](_0x0a9e('0x30'))){_0x140511[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x19')]);_0x140511[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x25fba9[_0x0a9e('0x2a')]['offset']);}_0x140511[_0x0a9e('0x31')]=qs['sort'](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x140511[_0x0a9e('0x33')]=qs[_0x0a9e('0x2b')](_['pick'](_0x25fba9[_0x0a9e('0x2a')],_0x1538a4[_0x0a9e('0x2b')]));if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]){_0x140511['where']=_['merge'](_0x140511[_0x0a9e('0x33')],{'$or':_['map'](_0x14de77,function(_0x24936a){if(_0x24936a[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4f41ae={};_0x4f41ae[_0x24936a[_0x0a9e('0x38')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]+'%'};return _0x4f41ae;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x39')]);var _0x1a180b={'where':_0x140511[_0x0a9e('0x33')]};return db['VoiceMail']['count'](_0x1a180b)[_0x0a9e('0x1f')](function(_0x40d766){_0x11c3b6['count']=_0x40d766;if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x140511[_0x0a9e('0x3b')]=[{'all':!![]}];}return db[_0x0a9e('0x3c')]['findAll'](_0x140511);})['then'](function(_0x15e37d){_0x11c3b6[_0x0a9e('0x3d')]=_0x15e37d;return _0x11c3b6;})['then'](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x3e')](handleError(_0x14433c,null));};exports[_0x0a9e('0x3f')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x40')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](db[_0x0a9e('0x3c')][_0x0a9e('0x27')]);_0x2cfea9[_0x0a9e('0x2a')]=_[_0x0a9e('0x29')](_0x1459bb[_0x0a9e('0x2a')]);_0x2cfea9[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x2cfea9[_0x0a9e('0x28')],_0x2cfea9[_0x0a9e('0x2a')]);_0x316c8f[_0x0a9e('0x2d')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x2e')](_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x316c8f[_0x0a9e('0x2d')]=_0x316c8f[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x316c8f[_0x0a9e('0x2d')]:_0x2cfea9[_0x0a9e('0x28')];if(_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x316c8f[_0x0a9e('0x3b')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x41')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x316c8f)[_0x0a9e('0x1f')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x1f')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x3e')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x43')]=function(_0x21eb86,_0x44dd99){return db['VoiceMail'][_0x0a9e('0x43')](_0x21eb86['body'],{})[_0x0a9e('0x1f')](function(_0x476688){var _0x8d6dd1=_0x21eb86['user'][_0x0a9e('0x20')]({'plain':!![]});if(!_0x8d6dd1)throw new Error(_0x0a9e('0x44'));if(_0x8d6dd1[_0x0a9e('0x45')]===_0x0a9e('0x46')){var _0x45c845=_0x476688[_0x0a9e('0x20')]({'plain':!![]});var _0x45bf7f='Voicemails';return db[_0x0a9e('0x47')][_0x0a9e('0x42')]({'where':{'name':_0x45bf7f,'userProfileId':_0x8d6dd1[_0x0a9e('0x48')]},'raw':!![]})[_0x0a9e('0x1f')](function(_0x409789){if(_0x409789&&_0x409789[_0x0a9e('0x49')]===0x0){return db[_0x0a9e('0x21')][_0x0a9e('0x43')]({'name':_0x45c845[_0x0a9e('0x24')],'resourceId':_0x45c845['id'],'type':_0x409789['name'],'sectionId':_0x409789['id']},{})[_0x0a9e('0x1f')](function(){return _0x476688;});}else{return _0x476688;}})[_0x0a9e('0x3e')](function(_0x4f7240){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7240);throw _0x4f7240;});}return _0x476688;})[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x3e')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x11545a,_0x61bb17){if(_0x11545a[_0x0a9e('0x4b')]['id']){delete _0x11545a[_0x0a9e('0x4b')]['id'];}return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x11545a['params']['id']}})['then'](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x1f')](saveUpdates(_0x11545a[_0x0a9e('0x4b')],null))[_0x0a9e('0x1f')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};exports[_0x0a9e('0x22')]=function(_0x161aa7,_0x53d113){return db['VoiceMail'][_0x0a9e('0x42')]({'where':{'id':_0x161aa7['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x53d113,null))['then'](removeEntity(_0x53d113,null))[_0x0a9e('0x3e')](handleError(_0x53d113,null));};exports[_0x0a9e('0x4c')]=function(_0x439340,_0x53613a,_0x2f82da){return db[_0x0a9e('0x3c')]['findOne']({'where':{'id':_0x439340['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x53613a,null))[_0x0a9e('0x1f')](function(_0x49c095){var _0x145931;var _0x5ce9ac={},_0x211ef9={};_0x211ef9['model']=_[_0x0a9e('0x29')](db['VoiceMailMessage']['rawAttributes']);_0x211ef9['query']=_[_0x0a9e('0x29')](_0x439340['query']);_0x211ef9[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x211ef9[_0x0a9e('0x28')],_0x211ef9[_0x0a9e('0x2a')]);_0x5ce9ac[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x211ef9[_0x0a9e('0x28')],qs[_0x0a9e('0x2e')](_0x439340['query'][_0x0a9e('0x2e')]));_0x5ce9ac[_0x0a9e('0x2d')]=_0x5ce9ac[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x5ce9ac[_0x0a9e('0x2d')]:_0x211ef9[_0x0a9e('0x28')];if(!_0x439340['query'][_0x0a9e('0x4d')](_0x0a9e('0x30'))){_0x5ce9ac['limit']=qs[_0x0a9e('0x19')](_0x439340['query'][_0x0a9e('0x19')]);_0x5ce9ac['offset']=qs['offset'](_0x439340['query'][_0x0a9e('0x18')]);}_0x5ce9ac['order']=qs[_0x0a9e('0x32')](_0x439340[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x5ce9ac[_0x0a9e('0x33')]=qs[_0x0a9e('0x2b')](_[_0x0a9e('0x4e')](_0x439340['query'],_0x211ef9[_0x0a9e('0x2b')]));if(_0x439340['query'][_0x0a9e('0x34')]){_0x5ce9ac[_0x0a9e('0x33')]=_[_0x0a9e('0x41')](_0x5ce9ac['where'],{'$or':_[_0x0a9e('0x4f')](_0x5ce9ac[_0x0a9e('0x2d')],function(_0x119677){var _0x32e134={};_0x32e134[_0x119677]={'$like':'%'+_0x439340['query'][_0x0a9e('0x34')]+'%'};return _0x32e134;})});}_0x5ce9ac[_0x0a9e('0x33')]=_['merge'](_0x5ce9ac[_0x0a9e('0x33')],{'mailboxuser':_0x49c095[_0x0a9e('0x50')]});_0x5ce9ac=_[_0x0a9e('0x41')]({},_0x5ce9ac,_0x439340[_0x0a9e('0x39')]);return db[_0x0a9e('0x51')]['findAndCountAll'](_0x5ce9ac)[_0x0a9e('0x1f')](respondWithFilteredResult(_0x53613a,_0x5ce9ac));})[_0x0a9e('0x3e')](handleError(_0x53613a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 292c688..2eb18e3 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 _0xe1d1=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x2baf40,_0x5ebef2){var _0x2bb2cb=function(_0x1a3fc1){while(--_0x1a3fc1){_0x2baf40['push'](_0x2baf40['shift']());}};_0x2bb2cb(++_0x5ebef2);}(_0xe1d1,0x131));var _0x1e1d=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xe1d1[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0x1e1d('0x0'));var util=require(_0x1e1d('0x1'));var logger=require('../../config/logger')(_0x1e1d('0x2'));var moment=require(_0x1e1d('0x3'));var BPromise=require(_0x1e1d('0x4'));var rp=require(_0x1e1d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e1d('0x6'));var config=require(_0x1e1d('0x7'));var attributes=require(_0x1e1d('0x8'));module[_0x1e1d('0x9')]=function(_0x2ad942,_0x3c504c){return _0x2ad942['define'](_0x1e1d('0xa'),attributes,{'tableName':_0x1e1d('0xb'),'paranoid':![],'indexes':[{'name':_0x1e1d('0xc'),'fields':[_0x1e1d('0xd'),_0x1e1d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3278=['../../config/environment','./voiceMail.attributes','mailbox_context','mailbox','../../config/logger','api','bluebird','path'];(function(_0x1547be,_0x554031){var _0x3ad13b=function(_0x4dd747){while(--_0x4dd747){_0x1547be['push'](_0x1547be['shift']());}};_0x3ad13b(++_0x554031);}(_0x3278,0x11c));var _0x8327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3278[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8327('0x0'))(_0x8327('0x1'));var moment=require('moment');var BPromise=require(_0x8327('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8327('0x3'));var rimraf=require('rimraf');var config=require(_0x8327('0x4'));var attributes=require(_0x8327('0x5'));module['exports']=function(_0x378c14,_0x471056){return _0x378c14['define']('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x8327('0x6'),'fields':[_0x8327('0x7'),'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 c55748e..6d654a5 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 _0x19b3=['http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2cd1be,_0x2848b2){var _0x6912bf=function(_0x2cc43e){while(--_0x2cc43e){_0x2cd1be['push'](_0x2cd1be['shift']());}};_0x6912bf(++_0x2848b2);}(_0x19b3,0x7f));var _0x319b=function(_0x3168e1,_0xa046e0){_0x3168e1=_0x3168e1-0x0;var _0x13ad69=_0x19b3[_0x3168e1];return _0x13ad69;};'use strict';var _=require('lodash');var util=require(_0x319b('0x0'));var moment=require(_0x319b('0x1'));var BPromise=require(_0x319b('0x2'));var rs=require(_0x319b('0x3'));var fs=require('fs');var Redis=require(_0x319b('0x4'));var db=require(_0x319b('0x5'))['db'];var utils=require(_0x319b('0x6'));var logger=require(_0x319b('0x7'))(_0x319b('0x8'));var config=require('../../config/environment');var jayson=require(_0x319b('0x9'));var client=jayson[_0x319b('0xa')][_0x319b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cc166,_0x535c98,_0x5bb44c){return new BPromise(function(_0xa1f717,_0x2ab4f0){return client[_0x319b('0xc')](_0x3cc166,_0x5bb44c)[_0x319b('0xd')](function(_0x1dc6fc){logger[_0x319b('0xe')](_0x319b('0xf'),_0x535c98,_0x319b('0x10'));logger[_0x319b('0x11')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x535c98,_0x319b('0x10'),JSON['stringify'](_0x1dc6fc));if(_0x1dc6fc[_0x319b('0x12')]){if(_0x1dc6fc[_0x319b('0x12')][_0x319b('0x13')]===0x1f4){logger[_0x319b('0x12')](_0x319b('0xf'),_0x535c98,_0x1dc6fc[_0x319b('0x12')]['message']);return _0x2ab4f0(_0x1dc6fc[_0x319b('0x12')][_0x319b('0x14')]);}logger[_0x319b('0x12')](_0x319b('0xf'),_0x535c98,_0x1dc6fc[_0x319b('0x12')]['message']);return _0xa1f717(_0x1dc6fc[_0x319b('0x12')][_0x319b('0x14')]);}else{logger[_0x319b('0xe')]('VoiceMail,\x20%s,\x20%s',_0x535c98,_0x319b('0x10'));_0xa1f717(_0x1dc6fc[_0x319b('0x15')][_0x319b('0x14')]);}})[_0x319b('0x16')](function(_0x7e4fd4){logger[_0x319b('0x12')](_0x319b('0xf'),_0x535c98,_0x7e4fd4);_0x2ab4f0(_0x7e4fd4);});});} \ No newline at end of file +var _0x781a=['stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x19ee3a,_0x1c597f){var _0x3d7d89=function(_0x59d619){while(--_0x59d619){_0x19ee3a['push'](_0x19ee3a['shift']());}};_0x3d7d89(++_0x1c597f);}(_0x781a,0x17f));var _0xa781=function(_0x23d195,_0x438bdb){_0x23d195=_0x23d195-0x0;var _0x2de896=_0x781a[_0x23d195];return _0x2de896;};'use strict';var _=require(_0xa781('0x0'));var util=require(_0xa781('0x1'));var moment=require(_0xa781('0x2'));var BPromise=require(_0xa781('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa781('0x4'))['db'];var utils=require(_0xa781('0x5'));var logger=require(_0xa781('0x6'))('rpc');var config=require(_0xa781('0x7'));var jayson=require(_0xa781('0x8'));var client=jayson[_0xa781('0x9')][_0xa781('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x249af8,_0x5383bd,_0x1f1f53){return new BPromise(function(_0x286116,_0x450a7b){return client['request'](_0x249af8,_0x1f1f53)[_0xa781('0xb')](function(_0x86a706){logger[_0xa781('0xc')](_0xa781('0xd'),_0x5383bd,_0xa781('0xe'));logger['debug'](_0xa781('0xf'),_0x5383bd,_0xa781('0xe'),JSON[_0xa781('0x10')](_0x86a706));if(_0x86a706['error']){if(_0x86a706[_0xa781('0x11')]['code']===0x1f4){logger[_0xa781('0x11')]('VoiceMail,\x20%s,\x20%s',_0x5383bd,_0x86a706['error'][_0xa781('0x12')]);return _0x450a7b(_0x86a706[_0xa781('0x11')]['message']);}logger['error'](_0xa781('0xd'),_0x5383bd,_0x86a706['error'][_0xa781('0x12')]);return _0x286116(_0x86a706[_0xa781('0x11')][_0xa781('0x12')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x5383bd,_0xa781('0xe'));_0x286116(_0x86a706[_0xa781('0x13')][_0xa781('0x12')]);}})[_0xa781('0x14')](function(_0x5aa43){logger['error'](_0xa781('0xd'),_0x5383bd,_0x5aa43);_0x450a7b(_0x5aa43);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 76a9e7e..0a24d81 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 _0x3f8a=['download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0xcfef9b,_0x4ba6ed){var _0x2e5019=function(_0x590c42){while(--_0x590c42){_0xcfef9b['push'](_0xcfef9b['shift']());}};_0x2e5019(++_0x4ba6ed);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x376c87,_0x259f10){_0x376c87=_0x376c87-0x0;var _0x265832=_0x3f8a[_0x376c87];return _0x265832;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0x9')](_0xa3f8('0xe'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')]('/',auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['update']);router[_0xa3f8('0x13')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x14')]);module[_0xa3f8('0x15')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x5fc3[_0x5e9876];return _0x576c48;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0x8')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth[_0x35fc('0x9')](),controller['create']);router[_0x35fc('0xf')](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 6749cad..0b6c0c5 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 _0xc5c2=['long','exports','getDataValue','STRING'];(function(_0x2c69be,_0x35481e){var _0x360f6c=function(_0x470f1b){while(--_0x470f1b){_0x2c69be['push'](_0x2c69be['shift']());}};_0x360f6c(++_0x35481e);}(_0xc5c2,0x8d));var _0x2c5c=function(_0x3ed107,_0x2ebe46){_0x3ed107=_0x3ed107-0x0;var _0x587927=_0xc5c2[_0x3ed107];return _0x587927;};'use strict';var Sequelize=require('sequelize');module[_0x2c5c('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x24e118){return this[_0x2c5c('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x2c5c('0x2')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x2c5c('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0x2c5c('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x2c5c('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x2c5c('0x2')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x2c5c('0x3')),'defaultValue':null},'flag':{'type':Sequelize[_0x2c5c('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x1764=['STRING','BLOB','TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER'];(function(_0xeb711f,_0x48d75b){var _0x562268=function(_0x81a81){while(--_0x81a81){_0xeb711f['push'](_0xeb711f['shift']());}};_0x562268(++_0x48d75b);}(_0x1764,0x8f));var _0x4176=function(_0x561016,_0x43b2df){_0x561016=_0x561016-0x0;var _0x360f8b=_0x1764[_0x561016];return _0x360f8b;};'use strict';var Sequelize=require(_0x4176('0x0'));module[_0x4176('0x1')]={'name':{'type':Sequelize[_0x4176('0x2')],'get':function(_0x7222da){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x4176('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4176('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x4176('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x4176('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4176('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4176('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x4176('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x4176('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4176('0x4')],'defaultValue':''},'stamp':{'type':_0x4176('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f6cf25d..d184a6b 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 _0xa9e0=['../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','send','index','VoiceMailMessage','rawAttributes','model','differenceBy','keys','name','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','type','merge','options','findAll','rows','catch','params','includeAll','include','find','create','body','update','destroy','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','msg_id','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'];(function(_0x55a532,_0x2bade2){var _0x21cd7d=function(_0x1f413f){while(--_0x1f413f){_0x55a532['push'](_0x55a532['shift']());}};_0x21cd7d(++_0x2bade2);}(_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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={},_0x479bc4={},_0x45a1e7={'count':0x0,'rows':[]};var _0x5bfb33=db[_0x0a9e('0x24')][_0x0a9e('0x25')];_0x479bc4[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_[_0x0a9e('0x28')](_0x5bfb33),[_0x0a9e('0x29')]);_0x479bc4[_0x0a9e('0x2a')]=_[_0x0a9e('0x28')](_0x33161b['query']);_0x479bc4[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x479bc4[_0x0a9e('0x26')],_0x479bc4[_0x0a9e('0x2a')]);_0x384319['attributes']=_[_0x0a9e('0x2c')](_0x479bc4[_0x0a9e('0x26')],qs[_0x0a9e('0x2d')](_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x2d')]));_0x384319[_0x0a9e('0x2e')]=_0x384319[_0x0a9e('0x2e')][_0x0a9e('0x2f')]?_0x384319[_0x0a9e('0x2e')]:_0x479bc4['model'];if(!_0x33161b[_0x0a9e('0x2a')]['hasOwnProperty'](_0x0a9e('0x30'))){_0x384319[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x19')]);_0x384319['offset']=qs[_0x0a9e('0x18')](_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x18')]);}_0x384319[_0x0a9e('0x31')]=qs[_0x0a9e('0x32')](_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x384319[_0x0a9e('0x33')]=qs['filters'](_[_0x0a9e('0x34')](_0x33161b['query'],_0x479bc4[_0x0a9e('0x2b')]));if(_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x35')]){_0x384319[_0x0a9e('0x33')]=_['merge'](_0x384319[_0x0a9e('0x33')],{'$or':_[_0x0a9e('0x36')](_0x5bfb33,function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0x37')]['key']!=='VIRTUAL'){var _0x1e8694={};_0x1e8694[_0x1fa90d['field']]={'$like':'%'+_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x35')]+'%'};return _0x1e8694;}})});}_0x384319=_[_0x0a9e('0x38')]({},_0x384319,_0x33161b[_0x0a9e('0x39')]);var _0x4f41ae={'where':_0x384319[_0x0a9e('0x33')]};return db[_0x0a9e('0x24')][_0x0a9e('0x17')](_0x4f41ae)['then'](function(_0x1dbf74){_0x45a1e7[_0x0a9e('0x17')]=_0x1dbf74;if(_0x33161b[_0x0a9e('0x2a')]['includeAll']){_0x384319['include']=[{'all':!![]}];}return db[_0x0a9e('0x24')][_0x0a9e('0x3a')](_0x384319);})['then'](function(_0x2b814e){_0x45a1e7[_0x0a9e('0x3b')]=_0x2b814e;return _0x45a1e7;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x526cf3,_0x384319))[_0x0a9e('0x3c')](handleError(_0x526cf3,null));};exports['show']=function(_0x5a594b,_0x15e37d){var _0x45b3d0={'raw':!![],'where':{'id':_0x5a594b[_0x0a9e('0x3d')]['id']}},_0x53f3ee={};_0x53f3ee[_0x0a9e('0x26')]=_[_0x0a9e('0x28')](db['VoiceMailMessage'][_0x0a9e('0x25')]);_0x53f3ee[_0x0a9e('0x2a')]=_[_0x0a9e('0x28')](_0x5a594b[_0x0a9e('0x2a')]);_0x53f3ee[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x53f3ee[_0x0a9e('0x26')],_0x53f3ee[_0x0a9e('0x2a')]);_0x45b3d0[_0x0a9e('0x2e')]=_[_0x0a9e('0x2c')](_0x53f3ee[_0x0a9e('0x26')],qs[_0x0a9e('0x2d')](_0x5a594b[_0x0a9e('0x2a')][_0x0a9e('0x2d')]));_0x45b3d0[_0x0a9e('0x2e')]=_0x45b3d0['attributes']['length']?_0x45b3d0[_0x0a9e('0x2e')]:_0x53f3ee[_0x0a9e('0x26')];if(_0x5a594b[_0x0a9e('0x2a')][_0x0a9e('0x3e')]){_0x45b3d0[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45b3d0=_[_0x0a9e('0x38')]({},_0x45b3d0,_0x5a594b[_0x0a9e('0x39')]);return db[_0x0a9e('0x24')][_0x0a9e('0x40')](_0x45b3d0)[_0x0a9e('0x1f')](handleEntityNotFound(_0x15e37d,null))[_0x0a9e('0x1f')](respondWithResult(_0x15e37d,null))[_0x0a9e('0x3c')](handleError(_0x15e37d,null));};exports['create']=function(_0x117c99,_0x138b8b){return db[_0x0a9e('0x24')][_0x0a9e('0x41')](_0x117c99[_0x0a9e('0x42')],{})[_0x0a9e('0x1f')](respondWithResult(_0x138b8b,0xc9))[_0x0a9e('0x3c')](handleError(_0x138b8b,null));};exports[_0x0a9e('0x43')]=function(_0x59afe8,_0x2e9d90){if(_0x59afe8['body']['id']){delete _0x59afe8[_0x0a9e('0x42')]['id'];}return db[_0x0a9e('0x24')][_0x0a9e('0x40')]({'where':{'id':_0x59afe8['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x2e9d90,null))[_0x0a9e('0x1f')](saveUpdates(_0x59afe8[_0x0a9e('0x42')],null))[_0x0a9e('0x1f')](respondWithResult(_0x2e9d90,null))[_0x0a9e('0x3c')](handleError(_0x2e9d90,null));};exports[_0x0a9e('0x44')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x24')][_0x0a9e('0x40')]({'where':{'id':_0x45bf7f[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x1f')](removeEntity(_0x5bbcde,null))[_0x0a9e('0x3c')](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x45')]=function(_0x19383e,_0x34febd,_0x58a5c2){return db[_0x0a9e('0x24')][_0x0a9e('0x40')]({'where':{'id':_0x19383e['params']['id']},'attributes':['id','recording','msg_id']})[_0x0a9e('0x1f')](handleEntityNotFound(_0x34febd,null))[_0x0a9e('0x1f')](function(_0x37edaa){if(_0x37edaa){if(!_0x37edaa[_0x0a9e('0x46')]){throw new db[(_0x0a9e('0x47'))][(_0x0a9e('0x48'))](_0x0a9e('0x49'));}var _0x375c18={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x37edaa['msg_id']){_0x375c18[_0x0a9e('0x4a')]=_0x0a9e('0x4b')+_0x37edaa[_0x0a9e('0x4c')]+'.wav\x22';}_0x34febd[_0x0a9e('0x1a')](_0x375c18);return _0x34febd[_0x0a9e('0x22')](new Buffer(_0x37edaa['recording']));}})['catch'](handleError(_0x34febd,null));}; \ No newline at end of file +var _0xa9e0=['../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','send','index','VoiceMailMessage','rawAttributes','model','differenceBy','keys','name','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','type','merge','options','findAll','rows','catch','params','includeAll','include','find','create','body','update','destroy','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','msg_id','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'];(function(_0x4e3468,_0x2cf67e){var _0x4a711a=function(_0x5ba7a2){while(--_0x5ba7a2){_0x4e3468['push'](_0x4e3468['shift']());}};_0x4a711a(++_0x2cf67e);}(_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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={},_0x479bc4={},_0x45a1e7={'count':0x0,'rows':[]};var _0x5bfb33=db[_0x0a9e('0x24')][_0x0a9e('0x25')];_0x479bc4[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_[_0x0a9e('0x28')](_0x5bfb33),[_0x0a9e('0x29')]);_0x479bc4[_0x0a9e('0x2a')]=_[_0x0a9e('0x28')](_0x33161b['query']);_0x479bc4[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x479bc4[_0x0a9e('0x26')],_0x479bc4[_0x0a9e('0x2a')]);_0x384319['attributes']=_[_0x0a9e('0x2c')](_0x479bc4[_0x0a9e('0x26')],qs[_0x0a9e('0x2d')](_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x2d')]));_0x384319[_0x0a9e('0x2e')]=_0x384319[_0x0a9e('0x2e')][_0x0a9e('0x2f')]?_0x384319[_0x0a9e('0x2e')]:_0x479bc4['model'];if(!_0x33161b[_0x0a9e('0x2a')]['hasOwnProperty'](_0x0a9e('0x30'))){_0x384319[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x19')]);_0x384319['offset']=qs[_0x0a9e('0x18')](_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x18')]);}_0x384319[_0x0a9e('0x31')]=qs[_0x0a9e('0x32')](_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x384319[_0x0a9e('0x33')]=qs['filters'](_[_0x0a9e('0x34')](_0x33161b['query'],_0x479bc4[_0x0a9e('0x2b')]));if(_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x35')]){_0x384319[_0x0a9e('0x33')]=_['merge'](_0x384319[_0x0a9e('0x33')],{'$or':_[_0x0a9e('0x36')](_0x5bfb33,function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0x37')]['key']!=='VIRTUAL'){var _0x1e8694={};_0x1e8694[_0x1fa90d['field']]={'$like':'%'+_0x33161b[_0x0a9e('0x2a')][_0x0a9e('0x35')]+'%'};return _0x1e8694;}})});}_0x384319=_[_0x0a9e('0x38')]({},_0x384319,_0x33161b[_0x0a9e('0x39')]);var _0x4f41ae={'where':_0x384319[_0x0a9e('0x33')]};return db[_0x0a9e('0x24')][_0x0a9e('0x17')](_0x4f41ae)['then'](function(_0x1dbf74){_0x45a1e7[_0x0a9e('0x17')]=_0x1dbf74;if(_0x33161b[_0x0a9e('0x2a')]['includeAll']){_0x384319['include']=[{'all':!![]}];}return db[_0x0a9e('0x24')][_0x0a9e('0x3a')](_0x384319);})['then'](function(_0x2b814e){_0x45a1e7[_0x0a9e('0x3b')]=_0x2b814e;return _0x45a1e7;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x526cf3,_0x384319))[_0x0a9e('0x3c')](handleError(_0x526cf3,null));};exports['show']=function(_0x5a594b,_0x15e37d){var _0x45b3d0={'raw':!![],'where':{'id':_0x5a594b[_0x0a9e('0x3d')]['id']}},_0x53f3ee={};_0x53f3ee[_0x0a9e('0x26')]=_[_0x0a9e('0x28')](db['VoiceMailMessage'][_0x0a9e('0x25')]);_0x53f3ee[_0x0a9e('0x2a')]=_[_0x0a9e('0x28')](_0x5a594b[_0x0a9e('0x2a')]);_0x53f3ee[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x53f3ee[_0x0a9e('0x26')],_0x53f3ee[_0x0a9e('0x2a')]);_0x45b3d0[_0x0a9e('0x2e')]=_[_0x0a9e('0x2c')](_0x53f3ee[_0x0a9e('0x26')],qs[_0x0a9e('0x2d')](_0x5a594b[_0x0a9e('0x2a')][_0x0a9e('0x2d')]));_0x45b3d0[_0x0a9e('0x2e')]=_0x45b3d0['attributes']['length']?_0x45b3d0[_0x0a9e('0x2e')]:_0x53f3ee[_0x0a9e('0x26')];if(_0x5a594b[_0x0a9e('0x2a')][_0x0a9e('0x3e')]){_0x45b3d0[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45b3d0=_[_0x0a9e('0x38')]({},_0x45b3d0,_0x5a594b[_0x0a9e('0x39')]);return db[_0x0a9e('0x24')][_0x0a9e('0x40')](_0x45b3d0)[_0x0a9e('0x1f')](handleEntityNotFound(_0x15e37d,null))[_0x0a9e('0x1f')](respondWithResult(_0x15e37d,null))[_0x0a9e('0x3c')](handleError(_0x15e37d,null));};exports['create']=function(_0x117c99,_0x138b8b){return db[_0x0a9e('0x24')][_0x0a9e('0x41')](_0x117c99[_0x0a9e('0x42')],{})[_0x0a9e('0x1f')](respondWithResult(_0x138b8b,0xc9))[_0x0a9e('0x3c')](handleError(_0x138b8b,null));};exports[_0x0a9e('0x43')]=function(_0x59afe8,_0x2e9d90){if(_0x59afe8['body']['id']){delete _0x59afe8[_0x0a9e('0x42')]['id'];}return db[_0x0a9e('0x24')][_0x0a9e('0x40')]({'where':{'id':_0x59afe8['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x2e9d90,null))[_0x0a9e('0x1f')](saveUpdates(_0x59afe8[_0x0a9e('0x42')],null))[_0x0a9e('0x1f')](respondWithResult(_0x2e9d90,null))[_0x0a9e('0x3c')](handleError(_0x2e9d90,null));};exports[_0x0a9e('0x44')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x24')][_0x0a9e('0x40')]({'where':{'id':_0x45bf7f[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x1f')](removeEntity(_0x5bbcde,null))[_0x0a9e('0x3c')](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x45')]=function(_0x19383e,_0x34febd,_0x58a5c2){return db[_0x0a9e('0x24')][_0x0a9e('0x40')]({'where':{'id':_0x19383e['params']['id']},'attributes':['id','recording','msg_id']})[_0x0a9e('0x1f')](handleEntityNotFound(_0x34febd,null))[_0x0a9e('0x1f')](function(_0x37edaa){if(_0x37edaa){if(!_0x37edaa[_0x0a9e('0x46')]){throw new db[(_0x0a9e('0x47'))][(_0x0a9e('0x48'))](_0x0a9e('0x49'));}var _0x375c18={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x37edaa['msg_id']){_0x375c18[_0x0a9e('0x4a')]=_0x0a9e('0x4b')+_0x37edaa[_0x0a9e('0x4c')]+'.wav\x22';}_0x34febd[_0x0a9e('0x1a')](_0x375c18);return _0x34febd[_0x0a9e('0x22')](new Buffer(_0x37edaa['recording']));}})['catch'](handleError(_0x34febd,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 26e2aae..2ca9245 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 _0x6512=['exports','define','voice_voicemail_messages','dir','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x49cf11,_0x5c5933){var _0x168419=function(_0x44f038){while(--_0x44f038){_0x49cf11['push'](_0x49cf11['shift']());}};_0x168419(++_0x5c5933);}(_0x6512,0xa9));var _0x2651=function(_0x2e5472,_0x17b12a){_0x2e5472=_0x2e5472-0x0;var _0x219f4e=_0x6512[_0x2e5472];return _0x219f4e;};'use strict';var _=require('lodash');var util=require(_0x2651('0x0'));var logger=require(_0x2651('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2651('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2651('0x3'));var rimraf=require(_0x2651('0x4'));var config=require(_0x2651('0x5'));var attributes=require(_0x2651('0x6'));module[_0x2651('0x7')]=function(_0x1ba4f3,_0x2235b0){return _0x1ba4f3[_0x2651('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x2651('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x2651('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7e09=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a8950,_0x14be1a){var _0xe93ac8=function(_0x114b92){while(--_0x114b92){_0x5a8950['push'](_0x5a8950['shift']());}};_0xe93ac8(++_0x14be1a);}(_0x7e09,0xd6));var _0x97e0=function(_0x303131,_0x35a7da){_0x303131=_0x303131-0x0;var _0x52a74b=_0x7e09[_0x303131];return _0x52a74b;};'use strict';var _=require(_0x97e0('0x0'));var util=require(_0x97e0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x97e0('0x2'));var rp=require(_0x97e0('0x3'));var fs=require('fs');var path=require(_0x97e0('0x4'));var rimraf=require(_0x97e0('0x5'));var config=require(_0x97e0('0x6'));var attributes=require(_0x97e0('0x7'));module[_0x97e0('0x8')]=function(_0x160d4a,_0x38aac1){return _0x160d4a[_0x97e0('0x9')](_0x97e0('0xa'),attributes,{'tableName':_0x97e0('0xb'),'paranoid':![],'indexes':[{'name':_0x97e0('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 21f493a..c663f7d 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 _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1a832a,_0x4a52a4){var _0x3e1192=function(_0x3347e3){while(--_0x3347e3){_0x1a832a['push'](_0x1a832a['shift']());}};_0x3e1192(++_0x4a52a4);}(_0x57ca,0x108));var _0xa57c=function(_0x475bd9,_0x50c546){_0x475bd9=_0x475bd9-0x0;var _0x577088=_0x57ca[_0x475bd9];return _0x577088;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5dad9f,_0x104465){var _0x569079=function(_0x49ea56){while(--_0x49ea56){_0x5dad9f['push'](_0x5dad9f['shift']());}};_0x569079(++_0x104465);}(_0x57ca,0x108));var _0xa57c=function(_0x1b7ae8,_0x805c5e){_0x1b7ae8=_0x1b7ae8-0x0;var _0x2f5fa6=_0x57ca[_0x1b7ae8];return _0x2f5fa6;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 345a740..15c1fe7 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 _0x96cf=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','destroy','/:id/sounds/:id2','exports','multer','util','connect-timeout','express','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x96cf,0x1de));var _0xf96c=function(_0x1c6b71,_0x2fda35){_0x1c6b71=_0x1c6b71-0x0;var _0x42ff59=_0x96cf[_0x1c6b71];return _0x42ff59;};'use strict';var multer=require(_0xf96c('0x0'));var util=require(_0xf96c('0x1'));var path=require('path');var timeout=require(_0xf96c('0x2'));var express=require(_0xf96c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf96c('0x4'));var config=require(_0xf96c('0x5'));var controller=require(_0xf96c('0x6'));router[_0xf96c('0x7')]('/',auth[_0xf96c('0x8')](),controller[_0xf96c('0x9')]);router[_0xf96c('0x7')](_0xf96c('0xa'),auth[_0xf96c('0x8')](),controller[_0xf96c('0xb')]);router[_0xf96c('0x7')](_0xf96c('0xc'),auth[_0xf96c('0x8')](),controller[_0xf96c('0xd')]);router[_0xf96c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf96c('0xc'),auth[_0xf96c('0x8')](),controller[_0xf96c('0xf')]);router[_0xf96c('0x10')](_0xf96c('0xa'),auth[_0xf96c('0x8')](),controller[_0xf96c('0x11')]);router['delete'](_0xf96c('0xa'),auth[_0xf96c('0x8')](),controller[_0xf96c('0x12')]);router['delete'](_0xf96c('0x13'),auth[_0xf96c('0x8')](),controller['removeSound']);module[_0xf96c('0x14')]=router; \ No newline at end of file +var _0x4370=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id/sounds','getSounds','post','create','addSound','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound'];(function(_0x406762,_0x290b1b){var _0x1188b0=function(_0x3f9086){while(--_0x3f9086){_0x406762['push'](_0x406762['shift']());}};_0x1188b0(++_0x290b1b);}(_0x4370,0xa9));var _0x0437=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x4370[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x0437('0x0'));var util=require(_0x0437('0x1'));var path=require(_0x0437('0x2'));var timeout=require(_0x0437('0x3'));var express=require(_0x0437('0x4'));var router=express[_0x0437('0x5')]();var auth=require(_0x0437('0x6'));var interaction=require(_0x0437('0x7'));var config=require('../../config/environment');var controller=require(_0x0437('0x8'));router['get']('/',auth[_0x0437('0x9')](),controller[_0x0437('0xa')]);router[_0x0437('0xb')]('/:id',auth[_0x0437('0x9')](),controller['show']);router[_0x0437('0xb')](_0x0437('0xc'),auth['isAuthenticated'](),controller[_0x0437('0xd')]);router[_0x0437('0xe')]('/',auth[_0x0437('0x9')](),controller[_0x0437('0xf')]);router['post']('/:id/sounds',auth[_0x0437('0x9')](),controller[_0x0437('0x10')]);router['put'](_0x0437('0x11'),auth[_0x0437('0x9')](),controller[_0x0437('0x12')]);router[_0x0437('0x13')](_0x0437('0x11'),auth['isAuthenticated'](),controller[_0x0437('0x14')]);router[_0x0437('0x13')](_0x0437('0x15'),auth[_0x0437('0x9')](),controller[_0x0437('0x16')]);module[_0x0437('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5ac20d0..325a2aa 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 _0x57c2=['files','mp3nb','quietmp3','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM'];(function(_0x4b0f76,_0x2b804e){var _0x939ed5=function(_0x226622){while(--_0x226622){_0x4b0f76['push'](_0x4b0f76['shift']());}};_0x939ed5(++_0x2b804e);}(_0x57c2,0x113));var _0x257c=function(_0x2a6b76,_0x25add0){_0x2a6b76=_0x2a6b76-0x0;var _0x566825=_0x57c2[_0x2a6b76];return _0x566825;};'use strict';var Sequelize=require(_0x257c('0x0'));module['exports']={'name':{'type':Sequelize[_0x257c('0x1')],'allowNull':![],'unique':_0x257c('0x2')},'mode':{'type':Sequelize[_0x257c('0x3')]('custom',_0x257c('0x4'),_0x257c('0x5'),'quietmp3nb',_0x257c('0x6'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x257c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x257c('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x257c('0x1')],'allowNull':!![]},'stamp':{'type':_0x257c('0x7')},'defaultEntry':{'type':Sequelize[_0x257c('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ef3=['STRING','name','mp3nb','quietmp3nb','quietmp3','mp3','files','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0xb0227f,_0x4d3a0d){var _0x5ec8cd=function(_0x37edfa){while(--_0x37edfa){_0xb0227f['push'](_0xb0227f['shift']());}};_0x5ec8cd(++_0x4d3a0d);}(_0x7ef3,0x106));var _0x37ef=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x7ef3[_0x4063a4];return _0x17908d;};'use strict';var Sequelize=require(_0x37ef('0x0'));module[_0x37ef('0x1')]={'name':{'type':Sequelize[_0x37ef('0x2')],'allowNull':![],'unique':_0x37ef('0x3')},'mode':{'type':Sequelize['ENUM']('custom','files',_0x37ef('0x4'),_0x37ef('0x5'),_0x37ef('0x6'),_0x37ef('0x7')),'allowNull':!![],'defaultValue':_0x37ef('0x8')},'directory':{'type':Sequelize[_0x37ef('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x37ef('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x37ef('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x37ef('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x37ef('0x2')],'allowNull':!![]},'stamp':{'type':_0x37ef('0x9')},'defaultEntry':{'type':Sequelize[_0x37ef('0xa')],'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 73e09e4..7ecdb46 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 _0xaab7=['ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','VoiceMusicOnHold','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','sequelize','mode','files','join','create','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','root','server/files/sounds/converted','%s.%s','basename','save_name','extname','server/files/moh','format','symlinkSync','ValidationError','removeSound','id2','message','getSounds','pick','length','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv'];(function(_0x49dce4,_0x36ed76){var _0x4362e1=function(_0x43ac9f){while(--_0x43ac9f){_0x49dce4['push'](_0x49dce4['shift']());}};_0x4362e1(++_0x36ed76);}(_0xaab7,0x66));var _0x7aab=function(_0x2ebfa6,_0x259a37){_0x2ebfa6=_0x2ebfa6-0x0;var _0x4ae818=_0xaab7[_0x2ebfa6];return _0x4ae818;};'use strict';var pdf=require(_0x7aab('0x0'));var emlformat=require(_0x7aab('0x1'));var rimraf=require(_0x7aab('0x2'));var zipdir=require(_0x7aab('0x3'));var jsonpatch=require(_0x7aab('0x4'));var rp=require(_0x7aab('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7aab('0x6'));var util=require(_0x7aab('0x7'));var path=require(_0x7aab('0x8'));var sox=require(_0x7aab('0x9'));var csv=require(_0x7aab('0xa'));var ejs=require(_0x7aab('0xb'));var fs=require('fs');var _=require(_0x7aab('0xc'));var squel=require(_0x7aab('0xd'));var crypto=require(_0x7aab('0xe'));var jsforce=require(_0x7aab('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7aab('0x10'));var Redis=require(_0x7aab('0x11'));var authService=require(_0x7aab('0x12'));var qs=require(_0x7aab('0x13'));var hardwareService=require(_0x7aab('0x14'));var logger=require('../../config/logger')(_0x7aab('0x15'));var utils=require('../../config/utils');var config=require(_0x7aab('0x16'));var db=require(_0x7aab('0x17'))['db'];function respondWithStatusCode(_0x2f542e,_0x29edfc){_0x29edfc=_0x29edfc||0xcc;return function(_0x37ca07){if(_0x37ca07){return _0x2f542e['sendStatus'](_0x29edfc);}return _0x2f542e['status'](_0x29edfc)['end']();};}function respondWithResult(_0x1b21f0,_0x1fda47){_0x1fda47=_0x1fda47||0xc8;return function(_0x54f75d){if(_0x54f75d){return _0x1b21f0[_0x7aab('0x18')](_0x1fda47)[_0x7aab('0x19')](_0x54f75d);}};}function respondWithFilteredResult(_0x10b3f5,_0x4a257e){return function(_0x16099f){if(_0x16099f){var _0x87fba0=_0x16099f[_0x7aab('0x1a')],_0xcdd192=_0x4a257e['offset'],_0x18ed0f=_0x4a257e[_0x7aab('0x1b')]+_0x4a257e[_0x7aab('0x1c')],_0x2e3a4d;if(_0x18ed0f>=_0x87fba0){_0x18ed0f=_0x87fba0;_0x2e3a4d=0xc8;}else{_0x2e3a4d=0xce;}_0x10b3f5['status'](_0x2e3a4d);return _0x10b3f5['set'](_0x7aab('0x1d'),_0xcdd192+'-'+_0x18ed0f+'/'+_0x87fba0)[_0x7aab('0x19')](_0x16099f);}return null;};}function patchUpdates(_0x5e9717){return function(_0x1b5f58){try{jsonpatch['apply'](_0x1b5f58,_0x5e9717,!![]);}catch(_0x11f37b){return BPromise[_0x7aab('0x1e')](_0x11f37b);}return _0x1b5f58[_0x7aab('0x1f')]();};}function saveUpdates(_0x434a32,_0x1c3aa6){return function(_0x1df8ad){if(_0x1df8ad){return _0x1df8ad[_0x7aab('0x20')](_0x434a32)['then'](function(_0x4812c9){return _0x4812c9;});}return null;};}function removeEntity(_0x410085,_0xebbcde){return function(_0xa91183){if(_0xa91183){return _0xa91183[_0x7aab('0x21')]()[_0x7aab('0x22')](function(){var _0x5e0bff=_0xa91183['get']({'plain':!![]});var _0x2b2d3b=_0x7aab('0x23');return db[_0x7aab('0x24')][_0x7aab('0x21')]({'where':{'type':_0x2b2d3b,'resourceId':_0x5e0bff['id']}})[_0x7aab('0x22')](function(){return _0xa91183;});})[_0x7aab('0x22')](function(){_0x410085[_0x7aab('0x18')](0xcc)[_0x7aab('0x25')]();});}};}function handleEntityNotFound(_0x3a131c,_0x461395){return function(_0x22d356){if(!_0x22d356){_0x3a131c['sendStatus'](0x194);}return _0x22d356;};}function handleError(_0x31bb34,_0x83ee90){_0x83ee90=_0x83ee90||0x1f4;return function(_0x579488){logger[_0x7aab('0x26')](_0x579488[_0x7aab('0x27')]);if(_0x579488[_0x7aab('0x28')]){delete _0x579488['name'];}_0x31bb34[_0x7aab('0x18')](_0x83ee90)[_0x7aab('0x29')](_0x579488);};}exports[_0x7aab('0x2a')]=function(_0x48bfbd,_0x50d3a0){var _0x4a3d53={},_0x5c51ed={},_0x504fa5={'count':0x0,'rows':[]};var _0x1866e4=db[_0x7aab('0x2b')]['rawAttributes'];_0x5c51ed['model']=_[_0x7aab('0x2c')](_0x1866e4);_0x5c51ed[_0x7aab('0x2d')]=_[_0x7aab('0x2c')](_0x48bfbd[_0x7aab('0x2d')]);_0x5c51ed[_0x7aab('0x2e')]=_['intersection'](_0x5c51ed[_0x7aab('0x2f')],_0x5c51ed[_0x7aab('0x2d')]);_0x4a3d53['attributes']=_[_0x7aab('0x30')](_0x5c51ed[_0x7aab('0x2f')],qs['fields'](_0x48bfbd[_0x7aab('0x2d')][_0x7aab('0x31')]));_0x4a3d53[_0x7aab('0x32')]=_0x4a3d53[_0x7aab('0x32')]['length']?_0x4a3d53[_0x7aab('0x32')]:_0x5c51ed[_0x7aab('0x2f')];if(!_0x48bfbd[_0x7aab('0x2d')][_0x7aab('0x33')](_0x7aab('0x34'))){_0x4a3d53['limit']=qs[_0x7aab('0x1c')](_0x48bfbd[_0x7aab('0x2d')][_0x7aab('0x1c')]);_0x4a3d53['offset']=qs[_0x7aab('0x1b')](_0x48bfbd['query'][_0x7aab('0x1b')]);}_0x4a3d53[_0x7aab('0x35')]=qs[_0x7aab('0x36')](_0x48bfbd[_0x7aab('0x2d')]['sort']);_0x4a3d53[_0x7aab('0x37')]=qs[_0x7aab('0x2e')](_['pick'](_0x48bfbd[_0x7aab('0x2d')],_0x5c51ed[_0x7aab('0x2e')]));if(_0x48bfbd[_0x7aab('0x2d')][_0x7aab('0x38')]){_0x4a3d53[_0x7aab('0x37')]=_[_0x7aab('0x39')](_0x4a3d53[_0x7aab('0x37')],{'$or':_[_0x7aab('0x3a')](_0x1866e4,function(_0x32622a){if(_0x32622a[_0x7aab('0x3b')][_0x7aab('0x3c')]!==_0x7aab('0x3d')){var _0x1af78d={};_0x1af78d[_0x32622a[_0x7aab('0x3e')]]={'$like':'%'+_0x48bfbd[_0x7aab('0x2d')][_0x7aab('0x38')]+'%'};return _0x1af78d;}})});}_0x4a3d53=_[_0x7aab('0x39')]({},_0x4a3d53,_0x48bfbd[_0x7aab('0x3f')]);var _0x1463ca={'where':_0x4a3d53[_0x7aab('0x37')]};return db[_0x7aab('0x2b')][_0x7aab('0x1a')](_0x1463ca)[_0x7aab('0x22')](function(_0x4078e1){_0x504fa5[_0x7aab('0x1a')]=_0x4078e1;if(_0x48bfbd['query'][_0x7aab('0x40')]){_0x4a3d53[_0x7aab('0x41')]=[{'all':!![]}];}return db[_0x7aab('0x2b')][_0x7aab('0x42')](_0x4a3d53);})['then'](function(_0x223430){_0x504fa5[_0x7aab('0x43')]=_0x223430;return _0x504fa5;})[_0x7aab('0x22')](respondWithFilteredResult(_0x50d3a0,_0x4a3d53))[_0x7aab('0x44')](handleError(_0x50d3a0,null));};exports[_0x7aab('0x45')]=function(_0x215e19,_0x5d0268){var _0x4da5ec={'raw':![],'where':{'id':_0x215e19[_0x7aab('0x46')]['id']}},_0x44fdd0={};_0x44fdd0[_0x7aab('0x2f')]=_[_0x7aab('0x2c')](db[_0x7aab('0x2b')][_0x7aab('0x47')]);_0x44fdd0[_0x7aab('0x2d')]=_[_0x7aab('0x2c')](_0x215e19[_0x7aab('0x2d')]);_0x44fdd0[_0x7aab('0x2e')]=_['intersection'](_0x44fdd0[_0x7aab('0x2f')],_0x44fdd0[_0x7aab('0x2d')]);_0x4da5ec[_0x7aab('0x32')]=_['intersection'](_0x44fdd0[_0x7aab('0x2f')],qs[_0x7aab('0x31')](_0x215e19[_0x7aab('0x2d')][_0x7aab('0x31')]));_0x4da5ec['attributes']=_0x4da5ec['attributes']['length']?_0x4da5ec[_0x7aab('0x32')]:_0x44fdd0[_0x7aab('0x2f')];if(_0x215e19[_0x7aab('0x2d')][_0x7aab('0x40')]){_0x4da5ec[_0x7aab('0x41')]=[{'all':!![]}];}_0x4da5ec=_[_0x7aab('0x39')]({},_0x4da5ec,_0x215e19['options']);return db[_0x7aab('0x2b')][_0x7aab('0x48')](_0x4da5ec)[_0x7aab('0x22')](handleEntityNotFound(_0x5d0268,null))[_0x7aab('0x22')](respondWithResult(_0x5d0268,null))[_0x7aab('0x44')](handleError(_0x5d0268,null));};exports[_0x7aab('0x20')]=function(_0x2e5758,_0x3f2bfd){if(_0x2e5758[_0x7aab('0x49')]['id']){delete _0x2e5758[_0x7aab('0x49')]['id'];}return db[_0x7aab('0x2b')]['find']({'where':{'id':_0x2e5758[_0x7aab('0x46')]['id']}})[_0x7aab('0x22')](handleEntityNotFound(_0x3f2bfd,null))[_0x7aab('0x22')](saveUpdates(_0x2e5758[_0x7aab('0x49')],null))[_0x7aab('0x22')](respondWithResult(_0x3f2bfd,null))['catch'](handleError(_0x3f2bfd,null));};exports['create']=function(_0x5df0ae,_0x4a2c05,_0x309b0e){return db[_0x7aab('0x4a')]['transaction'](function(_0xdc2224){if(_0x5df0ae[_0x7aab('0x49')][_0x7aab('0x4b')]===_0x7aab('0x4c')){_0x5df0ae[_0x7aab('0x49')]['directory']=path[_0x7aab('0x4d')](config['root'],'server/files/moh',_0x5df0ae['body'][_0x7aab('0x28')]);}return db['VoiceMusicOnHold'][_0x7aab('0x4e')](_0x5df0ae[_0x7aab('0x49')],{'transaction':_0xdc2224})[_0x7aab('0x22')](function(_0x24a6c3){if(_0x5df0ae[_0x7aab('0x49')][_0x7aab('0x4b')]===_0x7aab('0x4c')){fs[_0x7aab('0x4f')](_0x24a6c3[_0x7aab('0x50')],parseInt(_0x7aab('0x51'),0x8));}var _0x1963c7=_0x5df0ae[_0x7aab('0x52')][_0x7aab('0x53')]({'plain':!![]});if(!_0x1963c7)throw new Error(_0x7aab('0x54'));if(_0x1963c7[_0x7aab('0x55')]===_0x7aab('0x52')){var _0x222b08=_0x24a6c3[_0x7aab('0x53')]({'plain':!![]});return db[_0x7aab('0x56')][_0x7aab('0x48')]({'where':{'name':_0x7aab('0x23'),'userProfileId':_0x1963c7[_0x7aab('0x57')]},'raw':!![]})[_0x7aab('0x22')](function(_0x4aefa9){if(_0x4aefa9&&_0x4aefa9['autoAssociation']===0x0){return db[_0x7aab('0x24')][_0x7aab('0x4e')]({'name':_0x222b08[_0x7aab('0x28')],'resourceId':_0x222b08['id'],'type':_0x4aefa9[_0x7aab('0x28')],'sectionId':_0x4aefa9['id']},{})[_0x7aab('0x22')](function(){return _0x24a6c3;});}else{return _0x24a6c3;}})[_0x7aab('0x44')](function(_0x218da5){logger[_0x7aab('0x26')](_0x7aab('0x58'),_0x218da5);});}return _0x24a6c3;});})[_0x7aab('0x22')](respondWithResult(_0x4a2c05,0xc9))[_0x7aab('0x44')](handleError(_0x4a2c05,null));};exports[_0x7aab('0x21')]=function(_0x4bbc94,_0x325157,_0x9bc791){var _0xe9b916;return db[_0x7aab('0x2b')][_0x7aab('0x48')]({'where':{'id':_0x4bbc94[_0x7aab('0x46')]['id']}})[_0x7aab('0x22')](function(_0x993eb7){if(_0x993eb7){return db['sequelize'][_0x7aab('0x59')](function(_0x190aaf){return _0x993eb7[_0x7aab('0x21')]({'transaction':_0x190aaf,'raw':!![]})[_0x7aab('0x22')](function(_0xf85e88){if(_0xf85e88[_0x7aab('0x50')]){fs[_0x7aab('0x5a')](_0xf85e88[_0x7aab('0x50')])['forEach'](function(_0x4b369a){fs['unlinkSync'](path[_0x7aab('0x4d')](_0xf85e88['directory'],_0x4b369a));});fs['rmdirSync'](_0xf85e88['directory']);}return _0xf85e88;});})[_0x7aab('0x44')](function(_0x9257c6){throw new db[(_0x7aab('0x5b'))]['ValidationError'](_0x9257c6['message']);});}})[_0x7aab('0x22')](handleEntityNotFound(_0x325157,null))['then'](removeEntity(_0x325157,null))['catch'](handleError(_0x325157,null));};exports[_0x7aab('0x5c')]=function(_0x5d7876,_0x5650ef,_0x4d93f4){return db[_0x7aab('0x4a')]['transaction'](function(_0x275e82){var _0xe5d413;return db[_0x7aab('0x2b')][_0x7aab('0x48')]({'where':{'id':_0x5d7876[_0x7aab('0x46')]['id']}})[_0x7aab('0x22')](function(_0x16f9e7){if(_0x16f9e7){_0xe5d413=_0x16f9e7;return _0x16f9e7[_0x7aab('0x5c')](_0x5d7876[_0x7aab('0x49')]['id'],{'transaction':_0x275e82});}})[_0x7aab('0x22')](function(_0x538c3f){if(_0x538c3f){return db[_0x7aab('0x5d')][_0x7aab('0x5e')]({'where':{'id':_0x5d7876[_0x7aab('0x49')]['id']},'attributes':['id',_0x7aab('0x28'),'save_name',_0x7aab('0x5f'),_0x7aab('0x60')],'raw':!![]});}})[_0x7aab('0x22')](function(_0x4b911d){if(_0x4b911d){var _0x5960ed=path[_0x7aab('0x4d')](config[_0x7aab('0x61')],_0x7aab('0x62'),util['format'](_0x7aab('0x63'),path[_0x7aab('0x64')](_0x4b911d[_0x7aab('0x65')],path[_0x7aab('0x66')](_0x4b911d[_0x7aab('0x65')])),_0x4b911d[_0x7aab('0x5f')]));var _0x23749b=path[_0x7aab('0x4d')](config['root'],_0x7aab('0x67'),_0xe5d413[_0x7aab('0x28')],util[_0x7aab('0x68')](_0x7aab('0x63'),_0x4b911d[_0x7aab('0x28')],_0x4b911d[_0x7aab('0x5f')]));fs[_0x7aab('0x69')](_0x5960ed,_0x23749b);return _0x4b911d;}})[_0x7aab('0x44')](function(_0x578e9a){throw new db[(_0x7aab('0x5b'))][(_0x7aab('0x6a'))](_0x578e9a['message']);});})[_0x7aab('0x22')](handleEntityNotFound(_0x5650ef,null))[_0x7aab('0x22')](respondWithResult(_0x5650ef,0xc9))[_0x7aab('0x44')](handleError(_0x5650ef,null));};exports[_0x7aab('0x6b')]=function(_0x51917b,_0x43ce35,_0x250841){return db['sequelize'][_0x7aab('0x59')](function(_0x4289d3){var _0x13c515;return db[_0x7aab('0x2b')][_0x7aab('0x5e')]({'where':{'id':_0x51917b[_0x7aab('0x46')]['id']}})[_0x7aab('0x22')](handleEntityNotFound(_0x43ce35,null))[_0x7aab('0x22')](function(_0x221f84){if(_0x221f84){_0x13c515=_0x221f84;return _0x221f84[_0x7aab('0x6b')](_0x51917b[_0x7aab('0x46')][_0x7aab('0x6c')]);}})[_0x7aab('0x22')](function(_0x94abfe){if(_0x94abfe){return db[_0x7aab('0x5d')][_0x7aab('0x5e')]({'where':{'id':_0x51917b[_0x7aab('0x46')][_0x7aab('0x6c')]},'attributes':['id',_0x7aab('0x28'),'save_name',_0x7aab('0x5f'),_0x7aab('0x60')],'raw':!![]});}})[_0x7aab('0x22')](function(_0x27fd9d){if(_0x27fd9d){fs['unlinkSync'](path[_0x7aab('0x4d')](_0x13c515[_0x7aab('0x50')],util[_0x7aab('0x68')](_0x7aab('0x63'),_0x27fd9d[_0x7aab('0x28')],_0x27fd9d[_0x7aab('0x5f')])));return _0x27fd9d;}})['catch'](function(_0x457237){throw new db[(_0x7aab('0x5b'))][(_0x7aab('0x6a'))](_0x457237[_0x7aab('0x6d')]);});})[_0x7aab('0x22')](handleEntityNotFound(_0x43ce35,null))[_0x7aab('0x22')](respondWithStatusCode(_0x43ce35,0xcc))['catch'](handleError(_0x43ce35,null));};exports[_0x7aab('0x6e')]=function(_0x41fc5a,_0x25cd2e,_0x3bec11){var _0x18cf96={};var _0x31d2e2={};var _0x1e43c6;var _0x66574f;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x41fc5a[_0x7aab('0x46')]['id']}})[_0x7aab('0x22')](handleEntityNotFound(_0x25cd2e,null))[_0x7aab('0x22')](function(_0x1a48f6){if(_0x1a48f6){_0x1e43c6=_0x1a48f6;_0x31d2e2[_0x7aab('0x2f')]=_[_0x7aab('0x2c')](db[_0x7aab('0x5d')][_0x7aab('0x47')]);_0x31d2e2[_0x7aab('0x2d')]=_['keys'](_0x41fc5a[_0x7aab('0x2d')]);_0x31d2e2['filters']=_[_0x7aab('0x30')](_0x31d2e2[_0x7aab('0x2f')],_0x31d2e2[_0x7aab('0x2d')]);_0x18cf96[_0x7aab('0x32')]=_[_0x7aab('0x30')](_0x31d2e2[_0x7aab('0x2f')],qs[_0x7aab('0x31')](_0x41fc5a[_0x7aab('0x2d')][_0x7aab('0x31')]));_0x18cf96['attributes']=_0x18cf96['attributes']['length']?_0x18cf96[_0x7aab('0x32')]:_0x31d2e2['model'];_0x18cf96[_0x7aab('0x35')]=qs[_0x7aab('0x36')](_0x41fc5a['query'][_0x7aab('0x36')]);_0x18cf96[_0x7aab('0x37')]=qs[_0x7aab('0x2e')](_[_0x7aab('0x6f')](_0x41fc5a[_0x7aab('0x2d')],_0x31d2e2[_0x7aab('0x2e')]));if(_0x41fc5a[_0x7aab('0x2d')][_0x7aab('0x38')]){_0x18cf96[_0x7aab('0x37')]=_[_0x7aab('0x39')](_0x18cf96[_0x7aab('0x37')],{'$or':_[_0x7aab('0x3a')](_0x18cf96['attributes'],function(_0x5b0fac){var _0x5baa42={};_0x5baa42[_0x5b0fac]={'$like':'%'+_0x41fc5a['query'][_0x7aab('0x38')]+'%'};return _0x5baa42;})});}_0x18cf96=_['merge']({},_0x18cf96,_0x41fc5a['options']);return _0x1e43c6[_0x7aab('0x6e')](_0x18cf96);}})[_0x7aab('0x22')](function(_0x7754e2){if(_0x7754e2){_0x66574f=_0x7754e2[_0x7aab('0x70')];if(!_0x41fc5a['query'][_0x7aab('0x33')](_0x7aab('0x34'))){_0x18cf96[_0x7aab('0x1c')]=qs[_0x7aab('0x1c')](_0x41fc5a[_0x7aab('0x2d')][_0x7aab('0x1c')]);_0x18cf96[_0x7aab('0x1b')]=qs[_0x7aab('0x1b')](_0x41fc5a[_0x7aab('0x2d')][_0x7aab('0x1b')]);}return _0x1e43c6[_0x7aab('0x6e')](_0x18cf96);}})['then'](function(_0x1d36bc){if(_0x1d36bc){return _0x1d36bc?{'count':_0x66574f,'rows':_0x1d36bc}:null;}})[_0x7aab('0x22')](respondWithResult(_0x25cd2e,null))[_0x7aab('0x44')](handleError(_0x25cd2e,null));}; \ No newline at end of file +var _0x564d=['then','destroy','get','UserProfileResource','error','name','index','VoiceMusicOnHold','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','key','VIRTUAL','field','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','body','params','create','transaction','mode','files','root','server/files/moh','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','ValidationError','addSound','sequelize','Sound','findOne','converted_format','createdAt','join','format','%s.%s','basename','save_name','symlinkSync','Sequelize','message','removeSound','id2','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update'];(function(_0x4c073d,_0x4d6f87){var _0x1ec041=function(_0x2004f6){while(--_0x2004f6){_0x4c073d['push'](_0x4c073d['shift']());}};_0x1ec041(++_0x4d6f87);}(_0x564d,0x184));var _0xd564=function(_0x4f7e5b,_0x452c65){_0x4f7e5b=_0x4f7e5b-0x0;var _0x13ea34=_0x564d[_0x4f7e5b];return _0x13ea34;};'use strict';var pdf=require(_0xd564('0x0'));var emlformat=require(_0xd564('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd564('0x2'));var jsonpatch=require(_0xd564('0x3'));var rp=require(_0xd564('0x4'));var moment=require(_0xd564('0x5'));var BPromise=require(_0xd564('0x6'));var Mustache=require(_0xd564('0x7'));var util=require(_0xd564('0x8'));var path=require(_0xd564('0x9'));var sox=require('sox');var csv=require(_0xd564('0xa'));var ejs=require(_0xd564('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd564('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd564('0xd'));var toCsv=require(_0xd564('0xa'));var querystring=require('querystring');var Papa=require(_0xd564('0xe'));var Redis=require(_0xd564('0xf'));var authService=require(_0xd564('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xd564('0x11'));var logger=require(_0xd564('0x12'))(_0xd564('0x13'));var utils=require(_0xd564('0x14'));var config=require('../../config/environment');var db=require(_0xd564('0x15'))['db'];function respondWithStatusCode(_0x5195ee,_0x24da99){_0x24da99=_0x24da99||0xcc;return function(_0x5c3690){if(_0x5c3690){return _0x5195ee[_0xd564('0x16')](_0x24da99);}return _0x5195ee[_0xd564('0x17')](_0x24da99)[_0xd564('0x18')]();};}function respondWithResult(_0x509495,_0x3d8ebd){_0x3d8ebd=_0x3d8ebd||0xc8;return function(_0x333101){if(_0x333101){return _0x509495['status'](_0x3d8ebd)[_0xd564('0x19')](_0x333101);}};}function respondWithFilteredResult(_0x42d96a,_0x207adb){return function(_0x36f5e1){if(_0x36f5e1){var _0x3d9242=_0x36f5e1[_0xd564('0x1a')],_0x3c56d4=_0x207adb[_0xd564('0x1b')],_0x1aef94=_0x207adb[_0xd564('0x1b')]+_0x207adb[_0xd564('0x1c')],_0x21b07c;if(_0x1aef94>=_0x3d9242){_0x1aef94=_0x3d9242;_0x21b07c=0xc8;}else{_0x21b07c=0xce;}_0x42d96a[_0xd564('0x17')](_0x21b07c);return _0x42d96a['set']('Content-Range',_0x3c56d4+'-'+_0x1aef94+'/'+_0x3d9242)[_0xd564('0x19')](_0x36f5e1);}return null;};}function patchUpdates(_0x5034f2){return function(_0x141492){try{jsonpatch[_0xd564('0x1d')](_0x141492,_0x5034f2,!![]);}catch(_0x192b09){return BPromise[_0xd564('0x1e')](_0x192b09);}return _0x141492['save']();};}function saveUpdates(_0x2575b8,_0x522b01){return function(_0x324cdc){if(_0x324cdc){return _0x324cdc[_0xd564('0x1f')](_0x2575b8)[_0xd564('0x20')](function(_0x27fce1){return _0x27fce1;});}return null;};}function removeEntity(_0x5d151e,_0x5b999b){return function(_0x1b5a9d){if(_0x1b5a9d){return _0x1b5a9d[_0xd564('0x21')]()['then'](function(){var _0x2219fd=_0x1b5a9d[_0xd564('0x22')]({'plain':!![]});var _0x5d2f5b='MusicOnHolds';return db[_0xd564('0x23')][_0xd564('0x21')]({'where':{'type':_0x5d2f5b,'resourceId':_0x2219fd['id']}})[_0xd564('0x20')](function(){return _0x1b5a9d;});})[_0xd564('0x20')](function(){_0x5d151e[_0xd564('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38782b,_0x8d21af){return function(_0x54d8cd){if(!_0x54d8cd){_0x38782b['sendStatus'](0x194);}return _0x54d8cd;};}function handleError(_0x24b9b0,_0x1461c8){_0x1461c8=_0x1461c8||0x1f4;return function(_0x54c3ea){logger[_0xd564('0x24')](_0x54c3ea['stack']);if(_0x54c3ea[_0xd564('0x25')]){delete _0x54c3ea['name'];}_0x24b9b0[_0xd564('0x17')](_0x1461c8)['send'](_0x54c3ea);};}exports[_0xd564('0x26')]=function(_0x1aa4e0,_0x20ba36){var _0x3e8c38={},_0x256f5f={},_0x1d4b2c={'count':0x0,'rows':[]};var _0x14a530=db[_0xd564('0x27')][_0xd564('0x28')];_0x256f5f[_0xd564('0x29')]=_[_0xd564('0x2a')](_0x14a530);_0x256f5f[_0xd564('0x2b')]=_[_0xd564('0x2a')](_0x1aa4e0[_0xd564('0x2b')]);_0x256f5f['filters']=_[_0xd564('0x2c')](_0x256f5f[_0xd564('0x29')],_0x256f5f[_0xd564('0x2b')]);_0x3e8c38['attributes']=_[_0xd564('0x2c')](_0x256f5f[_0xd564('0x29')],qs[_0xd564('0x2d')](_0x1aa4e0[_0xd564('0x2b')]['fields']));_0x3e8c38[_0xd564('0x2e')]=_0x3e8c38[_0xd564('0x2e')][_0xd564('0x2f')]?_0x3e8c38[_0xd564('0x2e')]:_0x256f5f[_0xd564('0x29')];if(!_0x1aa4e0[_0xd564('0x2b')][_0xd564('0x30')](_0xd564('0x31'))){_0x3e8c38[_0xd564('0x1c')]=qs[_0xd564('0x1c')](_0x1aa4e0[_0xd564('0x2b')]['limit']);_0x3e8c38['offset']=qs['offset'](_0x1aa4e0[_0xd564('0x2b')]['offset']);}_0x3e8c38[_0xd564('0x32')]=qs[_0xd564('0x33')](_0x1aa4e0[_0xd564('0x2b')]['sort']);_0x3e8c38[_0xd564('0x34')]=qs[_0xd564('0x35')](_[_0xd564('0x36')](_0x1aa4e0[_0xd564('0x2b')],_0x256f5f[_0xd564('0x35')]));if(_0x1aa4e0[_0xd564('0x2b')]['filter']){_0x3e8c38[_0xd564('0x34')]=_['merge'](_0x3e8c38[_0xd564('0x34')],{'$or':_[_0xd564('0x37')](_0x14a530,function(_0x2da16c){if(_0x2da16c['type'][_0xd564('0x38')]!==_0xd564('0x39')){var _0x3757aa={};_0x3757aa[_0x2da16c[_0xd564('0x3a')]]={'$like':'%'+_0x1aa4e0[_0xd564('0x2b')][_0xd564('0x3b')]+'%'};return _0x3757aa;}})});}_0x3e8c38=_[_0xd564('0x3c')]({},_0x3e8c38,_0x1aa4e0[_0xd564('0x3d')]);var _0x2703a8={'where':_0x3e8c38[_0xd564('0x34')]};return db[_0xd564('0x27')][_0xd564('0x1a')](_0x2703a8)[_0xd564('0x20')](function(_0x532356){_0x1d4b2c[_0xd564('0x1a')]=_0x532356;if(_0x1aa4e0[_0xd564('0x2b')][_0xd564('0x3e')]){_0x3e8c38[_0xd564('0x3f')]=[{'all':!![]}];}return db[_0xd564('0x27')][_0xd564('0x40')](_0x3e8c38);})['then'](function(_0x215eaa){_0x1d4b2c[_0xd564('0x41')]=_0x215eaa;return _0x1d4b2c;})[_0xd564('0x20')](respondWithFilteredResult(_0x20ba36,_0x3e8c38))[_0xd564('0x42')](handleError(_0x20ba36,null));};exports[_0xd564('0x43')]=function(_0x520fa2,_0x2cbb34){var _0x1df888={'raw':![],'where':{'id':_0x520fa2['params']['id']}},_0x421d8a={};_0x421d8a[_0xd564('0x29')]=_[_0xd564('0x2a')](db[_0xd564('0x27')]['rawAttributes']);_0x421d8a[_0xd564('0x2b')]=_[_0xd564('0x2a')](_0x520fa2[_0xd564('0x2b')]);_0x421d8a[_0xd564('0x35')]=_[_0xd564('0x2c')](_0x421d8a['model'],_0x421d8a[_0xd564('0x2b')]);_0x1df888[_0xd564('0x2e')]=_[_0xd564('0x2c')](_0x421d8a[_0xd564('0x29')],qs[_0xd564('0x2d')](_0x520fa2['query'][_0xd564('0x2d')]));_0x1df888[_0xd564('0x2e')]=_0x1df888[_0xd564('0x2e')][_0xd564('0x2f')]?_0x1df888[_0xd564('0x2e')]:_0x421d8a[_0xd564('0x29')];if(_0x520fa2[_0xd564('0x2b')][_0xd564('0x3e')]){_0x1df888[_0xd564('0x3f')]=[{'all':!![]}];}_0x1df888=_['merge']({},_0x1df888,_0x520fa2[_0xd564('0x3d')]);return db[_0xd564('0x27')][_0xd564('0x44')](_0x1df888)[_0xd564('0x20')](handleEntityNotFound(_0x2cbb34,null))[_0xd564('0x20')](respondWithResult(_0x2cbb34,null))['catch'](handleError(_0x2cbb34,null));};exports['update']=function(_0x3fb3cb,_0x4355e7){if(_0x3fb3cb[_0xd564('0x45')]['id']){delete _0x3fb3cb[_0xd564('0x45')]['id'];}return db[_0xd564('0x27')]['find']({'where':{'id':_0x3fb3cb[_0xd564('0x46')]['id']}})['then'](handleEntityNotFound(_0x4355e7,null))[_0xd564('0x20')](saveUpdates(_0x3fb3cb[_0xd564('0x45')],null))[_0xd564('0x20')](respondWithResult(_0x4355e7,null))['catch'](handleError(_0x4355e7,null));};exports[_0xd564('0x47')]=function(_0x4e1248,_0x4ca6c2,_0x9139f1){return db['sequelize'][_0xd564('0x48')](function(_0x495f6d){if(_0x4e1248[_0xd564('0x45')][_0xd564('0x49')]===_0xd564('0x4a')){_0x4e1248[_0xd564('0x45')]['directory']=path['join'](config[_0xd564('0x4b')],_0xd564('0x4c'),_0x4e1248[_0xd564('0x45')]['name']);}return db[_0xd564('0x27')][_0xd564('0x47')](_0x4e1248['body'],{'transaction':_0x495f6d})['then'](function(_0x22e961){if(_0x4e1248[_0xd564('0x45')][_0xd564('0x49')]===_0xd564('0x4a')){fs['mkdirSync'](_0x22e961[_0xd564('0x4d')],parseInt(_0xd564('0x4e'),0x8));}var _0x2af36d=_0x4e1248['user'][_0xd564('0x22')]({'plain':!![]});if(!_0x2af36d)throw new Error(_0xd564('0x4f'));if(_0x2af36d[_0xd564('0x50')]==='user'){var _0x15c215=_0x22e961[_0xd564('0x22')]({'plain':!![]});return db[_0xd564('0x51')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x2af36d[_0xd564('0x52')]},'raw':!![]})['then'](function(_0x3ea1bc){if(_0x3ea1bc&&_0x3ea1bc[_0xd564('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x15c215['name'],'resourceId':_0x15c215['id'],'type':_0x3ea1bc[_0xd564('0x25')],'sectionId':_0x3ea1bc['id']},{})[_0xd564('0x20')](function(){return _0x22e961;});}else{return _0x22e961;}})['catch'](function(_0x126109){logger[_0xd564('0x24')](_0xd564('0x54'),_0x126109);});}return _0x22e961;});})['then'](respondWithResult(_0x4ca6c2,0xc9))[_0xd564('0x42')](handleError(_0x4ca6c2,null));};exports['destroy']=function(_0x4c7bc1,_0x319df2,_0x3a8a67){var _0x49cce9;return db[_0xd564('0x27')][_0xd564('0x44')]({'where':{'id':_0x4c7bc1[_0xd564('0x46')]['id']}})['then'](function(_0x2c2703){if(_0x2c2703){return db['sequelize']['transaction'](function(_0x57c3f7){return _0x2c2703[_0xd564('0x21')]({'transaction':_0x57c3f7,'raw':!![]})[_0xd564('0x20')](function(_0x58116a){if(_0x58116a[_0xd564('0x4d')]){fs[_0xd564('0x55')](_0x58116a[_0xd564('0x4d')])['forEach'](function(_0x495556){fs['unlinkSync'](path['join'](_0x58116a['directory'],_0x495556));});fs[_0xd564('0x56')](_0x58116a[_0xd564('0x4d')]);}return _0x58116a;});})[_0xd564('0x42')](function(_0x2a3dd4){throw new db['Sequelize'][(_0xd564('0x57'))](_0x2a3dd4['message']);});}})[_0xd564('0x20')](handleEntityNotFound(_0x319df2,null))[_0xd564('0x20')](removeEntity(_0x319df2,null))['catch'](handleError(_0x319df2,null));};exports[_0xd564('0x58')]=function(_0xf8145c,_0xc3d50,_0x6d936b){return db[_0xd564('0x59')][_0xd564('0x48')](function(_0x294617){var _0x27bf85;return db['VoiceMusicOnHold'][_0xd564('0x44')]({'where':{'id':_0xf8145c[_0xd564('0x46')]['id']}})[_0xd564('0x20')](function(_0x45ca28){if(_0x45ca28){_0x27bf85=_0x45ca28;return _0x45ca28[_0xd564('0x58')](_0xf8145c[_0xd564('0x45')]['id'],{'transaction':_0x294617});}})['then'](function(_0x5ce366){if(_0x5ce366){return db[_0xd564('0x5a')][_0xd564('0x5b')]({'where':{'id':_0xf8145c[_0xd564('0x45')]['id']},'attributes':['id',_0xd564('0x25'),'save_name',_0xd564('0x5c'),_0xd564('0x5d')],'raw':!![]});}})[_0xd564('0x20')](function(_0x574292){if(_0x574292){var _0x5baed7=path[_0xd564('0x5e')](config['root'],'server/files/sounds/converted',util[_0xd564('0x5f')](_0xd564('0x60'),path[_0xd564('0x61')](_0x574292[_0xd564('0x62')],path['extname'](_0x574292[_0xd564('0x62')])),_0x574292[_0xd564('0x5c')]));var _0x20bee2=path[_0xd564('0x5e')](config[_0xd564('0x4b')],'server/files/moh',_0x27bf85[_0xd564('0x25')],util[_0xd564('0x5f')](_0xd564('0x60'),_0x574292[_0xd564('0x25')],_0x574292['converted_format']));fs[_0xd564('0x63')](_0x5baed7,_0x20bee2);return _0x574292;}})[_0xd564('0x42')](function(_0x2b6c63){throw new db[(_0xd564('0x64'))][(_0xd564('0x57'))](_0x2b6c63[_0xd564('0x65')]);});})[_0xd564('0x20')](handleEntityNotFound(_0xc3d50,null))[_0xd564('0x20')](respondWithResult(_0xc3d50,0xc9))[_0xd564('0x42')](handleError(_0xc3d50,null));};exports[_0xd564('0x66')]=function(_0xedc80a,_0x3e968a,_0x36aabc){return db[_0xd564('0x59')][_0xd564('0x48')](function(_0x279d9f){var _0x286582;return db['VoiceMusicOnHold'][_0xd564('0x5b')]({'where':{'id':_0xedc80a[_0xd564('0x46')]['id']}})[_0xd564('0x20')](handleEntityNotFound(_0x3e968a,null))[_0xd564('0x20')](function(_0x3ef81d){if(_0x3ef81d){_0x286582=_0x3ef81d;return _0x3ef81d[_0xd564('0x66')](_0xedc80a['params'][_0xd564('0x67')]);}})[_0xd564('0x20')](function(_0x965355){if(_0x965355){return db[_0xd564('0x5a')][_0xd564('0x5b')]({'where':{'id':_0xedc80a[_0xd564('0x46')][_0xd564('0x67')]},'attributes':['id',_0xd564('0x25'),'save_name',_0xd564('0x5c'),'createdAt'],'raw':!![]});}})[_0xd564('0x20')](function(_0x41e6ac){if(_0x41e6ac){fs[_0xd564('0x68')](path[_0xd564('0x5e')](_0x286582[_0xd564('0x4d')],util[_0xd564('0x5f')](_0xd564('0x60'),_0x41e6ac[_0xd564('0x25')],_0x41e6ac['converted_format'])));return _0x41e6ac;}})[_0xd564('0x42')](function(_0x4a3c5a){throw new db[(_0xd564('0x64'))][(_0xd564('0x57'))](_0x4a3c5a[_0xd564('0x65')]);});})[_0xd564('0x20')](handleEntityNotFound(_0x3e968a,null))['then'](respondWithStatusCode(_0x3e968a,0xcc))[_0xd564('0x42')](handleError(_0x3e968a,null));};exports['getSounds']=function(_0x227718,_0x3929d5,_0x1442bf){var _0x5a0bcb={};var _0x553ca6={};var _0x26fd4e;var _0x15e481;return db['VoiceMusicOnHold'][_0xd564('0x5b')]({'where':{'id':_0x227718['params']['id']}})[_0xd564('0x20')](handleEntityNotFound(_0x3929d5,null))[_0xd564('0x20')](function(_0x5f1612){if(_0x5f1612){_0x26fd4e=_0x5f1612;_0x553ca6[_0xd564('0x29')]=_[_0xd564('0x2a')](db[_0xd564('0x5a')]['rawAttributes']);_0x553ca6['query']=_[_0xd564('0x2a')](_0x227718[_0xd564('0x2b')]);_0x553ca6['filters']=_[_0xd564('0x2c')](_0x553ca6['model'],_0x553ca6[_0xd564('0x2b')]);_0x5a0bcb['attributes']=_[_0xd564('0x2c')](_0x553ca6[_0xd564('0x29')],qs[_0xd564('0x2d')](_0x227718['query'][_0xd564('0x2d')]));_0x5a0bcb[_0xd564('0x2e')]=_0x5a0bcb['attributes'][_0xd564('0x2f')]?_0x5a0bcb[_0xd564('0x2e')]:_0x553ca6[_0xd564('0x29')];_0x5a0bcb[_0xd564('0x32')]=qs['sort'](_0x227718[_0xd564('0x2b')][_0xd564('0x33')]);_0x5a0bcb[_0xd564('0x34')]=qs[_0xd564('0x35')](_[_0xd564('0x36')](_0x227718['query'],_0x553ca6['filters']));if(_0x227718[_0xd564('0x2b')][_0xd564('0x3b')]){_0x5a0bcb[_0xd564('0x34')]=_[_0xd564('0x3c')](_0x5a0bcb[_0xd564('0x34')],{'$or':_[_0xd564('0x37')](_0x5a0bcb[_0xd564('0x2e')],function(_0x10ed7a){var _0x33167c={};_0x33167c[_0x10ed7a]={'$like':'%'+_0x227718[_0xd564('0x2b')][_0xd564('0x3b')]+'%'};return _0x33167c;})});}_0x5a0bcb=_[_0xd564('0x3c')]({},_0x5a0bcb,_0x227718[_0xd564('0x3d')]);return _0x26fd4e['getSounds'](_0x5a0bcb);}})[_0xd564('0x20')](function(_0x253761){if(_0x253761){_0x15e481=_0x253761[_0xd564('0x2f')];if(!_0x227718['query'][_0xd564('0x30')]('nolimit')){_0x5a0bcb[_0xd564('0x1c')]=qs[_0xd564('0x1c')](_0x227718[_0xd564('0x2b')][_0xd564('0x1c')]);_0x5a0bcb[_0xd564('0x1b')]=qs[_0xd564('0x1b')](_0x227718[_0xd564('0x2b')][_0xd564('0x1b')]);}return _0x26fd4e['getSounds'](_0x5a0bcb);}})['then'](function(_0x3f3694){if(_0x3f3694){return _0x3f3694?{'count':_0x15e481,'rows':_0x3f3694}:null;}})[_0xd564('0x20')](respondWithResult(_0x3929d5,null))[_0xd564('0x42')](handleError(_0x3929d5,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index a3072e5..e4c4da1 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 _0x0c6b=['api','moment','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x18d686,_0x3559c7){var _0x44e32d=function(_0x53f761){while(--_0x53f761){_0x18d686['push'](_0x18d686['shift']());}};_0x44e32d(++_0x3559c7);}(_0x0c6b,0xad));var _0xb0c6=function(_0x16c0c5,_0x16d7b8){_0x16c0c5=_0x16c0c5-0x0;var _0x50f91d=_0x0c6b[_0x16c0c5];return _0x50f91d;};'use strict';var _=require(_0xb0c6('0x0'));var util=require(_0xb0c6('0x1'));var logger=require(_0xb0c6('0x2'))(_0xb0c6('0x3'));var moment=require(_0xb0c6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0c6('0x5'));var attributes=require(_0xb0c6('0x6'));module[_0xb0c6('0x7')]=function(_0x28da65,_0x557f23){return _0x28da65[_0xb0c6('0x8')](_0xb0c6('0x9'),attributes,{'tableName':_0xb0c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7707=['request-promise','path','rimraf','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7707,0x7c));var _0x7770=function(_0x165203,_0xbde165){_0x165203=_0x165203-0x0;var _0x391d6d=_0x7707[_0x165203];return _0x391d6d;};'use strict';var _=require(_0x7770('0x0'));var util=require(_0x7770('0x1'));var logger=require(_0x7770('0x2'))(_0x7770('0x3'));var moment=require(_0x7770('0x4'));var BPromise=require(_0x7770('0x5'));var rp=require(_0x7770('0x6'));var fs=require('fs');var path=require(_0x7770('0x7'));var rimraf=require(_0x7770('0x8'));var config=require(_0x7770('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x27fff6,_0x531a38){return _0x27fff6[_0x7770('0xa')](_0x7770('0xb'),attributes,{'tableName':_0x7770('0xc'),'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 2441de6..dfc0329 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 _0x720a=['client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x720a,0x10a));var _0xa720=function(_0x49f544,_0x43f5c6){_0x49f544=_0x49f544-0x0;var _0x88e3e2=_0x720a[_0x49f544];return _0x88e3e2;};'use strict';var _=require(_0xa720('0x0'));var util=require(_0xa720('0x1'));var moment=require(_0xa720('0x2'));var BPromise=require('bluebird');var rs=require(_0xa720('0x3'));var fs=require('fs');var Redis=require(_0xa720('0x4'));var db=require(_0xa720('0x5'))['db'];var utils=require(_0xa720('0x6'));var logger=require('../../config/logger')(_0xa720('0x7'));var config=require(_0xa720('0x8'));var jayson=require(_0xa720('0x9'));var client=jayson[_0xa720('0xa')][_0xa720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13af3b,_0x2d29f5,_0x5b3d98){return new BPromise(function(_0x140849,_0x3ed6bc){return client[_0xa720('0xc')](_0x13af3b,_0x5b3d98)[_0xa720('0xd')](function(_0x33682f){logger[_0xa720('0xe')](_0xa720('0xf'),_0x2d29f5,_0xa720('0x10'));logger['debug'](_0xa720('0x11'),_0x2d29f5,'request\x20sent',JSON[_0xa720('0x12')](_0x33682f));if(_0x33682f['error']){if(_0x33682f['error']['code']===0x1f4){logger[_0xa720('0x13')](_0xa720('0xf'),_0x2d29f5,_0x33682f['error'][_0xa720('0x14')]);return _0x3ed6bc(_0x33682f[_0xa720('0x13')][_0xa720('0x14')]);}logger[_0xa720('0x13')](_0xa720('0xf'),_0x2d29f5,_0x33682f['error'][_0xa720('0x14')]);return _0x140849(_0x33682f['error'][_0xa720('0x14')]);}else{logger['info'](_0xa720('0xf'),_0x2d29f5,_0xa720('0x10'));_0x140849(_0x33682f[_0xa720('0x15')]['message']);}})[_0xa720('0x16')](function(_0x266934){logger[_0xa720('0x13')](_0xa720('0xf'),_0x2d29f5,_0x266934);_0x3ed6bc(_0x266934);});});} \ No newline at end of file +var _0xce3d=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x56b407,_0xe5a347){var _0x559afa=function(_0x4dbc9e){while(--_0x4dbc9e){_0x56b407['push'](_0x56b407['shift']());}};_0x559afa(++_0xe5a347);}(_0xce3d,0x1bc));var _0xdce3=function(_0x2e24d0,_0x34db1d){_0x2e24d0=_0x2e24d0-0x0;var _0x5aec4a=_0xce3d[_0x2e24d0];return _0x5aec4a;};'use strict';var _=require(_0xdce3('0x0'));var util=require(_0xdce3('0x1'));var moment=require(_0xdce3('0x2'));var BPromise=require(_0xdce3('0x3'));var rs=require(_0xdce3('0x4'));var fs=require('fs');var Redis=require(_0xdce3('0x5'));var db=require(_0xdce3('0x6'))['db'];var utils=require(_0xdce3('0x7'));var logger=require(_0xdce3('0x8'))(_0xdce3('0x9'));var config=require(_0xdce3('0xa'));var jayson=require(_0xdce3('0xb'));var client=jayson[_0xdce3('0xc')][_0xdce3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x501a21,_0x5f20b5,_0x480f2d){return new BPromise(function(_0x3ab678,_0x77a0c1){return client[_0xdce3('0xe')](_0x501a21,_0x480f2d)[_0xdce3('0xf')](function(_0x2d1d12){logger['info'](_0xdce3('0x10'),_0x5f20b5,_0xdce3('0x11'));logger['debug'](_0xdce3('0x12'),_0x5f20b5,'request\x20sent',JSON[_0xdce3('0x13')](_0x2d1d12));if(_0x2d1d12[_0xdce3('0x14')]){if(_0x2d1d12['error'][_0xdce3('0x15')]===0x1f4){logger[_0xdce3('0x14')](_0xdce3('0x10'),_0x5f20b5,_0x2d1d12[_0xdce3('0x14')][_0xdce3('0x16')]);return _0x77a0c1(_0x2d1d12['error'][_0xdce3('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5f20b5,_0x2d1d12[_0xdce3('0x14')][_0xdce3('0x16')]);return _0x3ab678(_0x2d1d12[_0xdce3('0x14')]['message']);}else{logger[_0xdce3('0x17')](_0xdce3('0x10'),_0x5f20b5,_0xdce3('0x11'));_0x3ab678(_0x2d1d12[_0xdce3('0x18')][_0xdce3('0x16')]);}})[_0xdce3('0x19')](function(_0x2c68a7){logger['error'](_0xdce3('0x10'),_0x5f20b5,_0x2c68a7);_0x77a0c1(_0x2c68a7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e52840a..03eab04 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 _0x93d5=['addAgents','put','update','delete','destroy','removeAgents','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','show','/:id/users','getAgents','post','create'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0x93d5,0x74));var _0x593d=function(_0x3f431d,_0x1535ab){_0x3f431d=_0x3f431d-0x0;var _0x3366b7=_0x93d5[_0x3f431d];return _0x3366b7;};'use strict';var multer=require(_0x593d('0x0'));var util=require(_0x593d('0x1'));var path=require(_0x593d('0x2'));var timeout=require('connect-timeout');var express=require(_0x593d('0x3'));var router=express['Router']();var auth=require(_0x593d('0x4'));var interaction=require(_0x593d('0x5'));var config=require(_0x593d('0x6'));var controller=require(_0x593d('0x7'));router[_0x593d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x593d('0x8')]('/describe',auth[_0x593d('0x9')](),controller[_0x593d('0xa')]);router[_0x593d('0x8')]('/:id',auth[_0x593d('0x9')](),controller[_0x593d('0xb')]);router[_0x593d('0x8')](_0x593d('0xc'),auth['isAuthenticated'](),controller[_0x593d('0xd')]);router[_0x593d('0xe')]('/',auth[_0x593d('0x9')](),controller[_0x593d('0xf')]);router['post'](_0x593d('0xc'),auth[_0x593d('0x9')](),controller[_0x593d('0x10')]);router[_0x593d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x593d('0x12')]);router[_0x593d('0x13')]('/:id',auth[_0x593d('0x9')](),controller[_0x593d('0x14')]);router['delete'](_0x593d('0xc'),auth[_0x593d('0x9')](),controller[_0x593d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x80f6=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents'];(function(_0x4ef7bc,_0x1e8207){var _0x30a74f=function(_0x5c728e){while(--_0x5c728e){_0x4ef7bc['push'](_0x4ef7bc['shift']());}};_0x30a74f(++_0x1e8207);}(_0x80f6,0xd0));var _0x680f=function(_0x987abd,_0xf4f513){_0x987abd=_0x987abd-0x0;var _0x12f86b=_0x80f6[_0x987abd];return _0x12f86b;};'use strict';var multer=require(_0x680f('0x0'));var util=require('util');var path=require(_0x680f('0x1'));var timeout=require(_0x680f('0x2'));var express=require(_0x680f('0x3'));var router=express['Router']();var auth=require(_0x680f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x680f('0x5'));var controller=require(_0x680f('0x6'));router[_0x680f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x680f('0x7')](_0x680f('0x8'),auth[_0x680f('0x9')](),controller[_0x680f('0xa')]);router['get'](_0x680f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x680f('0x7')]('/:id/users',auth[_0x680f('0x9')](),controller[_0x680f('0xc')]);router[_0x680f('0xd')]('/',auth[_0x680f('0x9')](),controller[_0x680f('0xe')]);router[_0x680f('0xd')](_0x680f('0xf'),auth[_0x680f('0x9')](),controller[_0x680f('0x10')]);router[_0x680f('0x11')](_0x680f('0xb'),auth[_0x680f('0x9')](),controller[_0x680f('0x12')]);router[_0x680f('0x13')](_0x680f('0xb'),auth[_0x680f('0x9')](),controller[_0x680f('0x14')]);router[_0x680f('0x13')](_0x680f('0xf'),auth[_0x680f('0x9')](),controller[_0x680f('0x15')]);module[_0x680f('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f4b174a..674c19e 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 _0x852a=['INTEGER','exports','STRING','name','system-','getDataValue'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0x852a,0x1d5));var _0xa852=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x852a[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module[_0xa852('0x0')]={'name':{'type':Sequelize[_0xa852('0x1')],'allowNull':![],'unique':_0xa852('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2b595e){return _0xa852('0x3')+this[_0xa852('0x4')](_0xa852('0x2'))+'-';}},'description':{'type':Sequelize[_0xa852('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xa852('0x5')]}}; \ No newline at end of file +var _0x04d6=['getDataValue','name','INTEGER','sequelize','STRING','VIRTUAL','system-'];(function(_0x589964,_0x510d29){var _0x44fe2f=function(_0x3f75d9){while(--_0x3f75d9){_0x589964['push'](_0x589964['shift']());}};_0x44fe2f(++_0x510d29);}(_0x04d6,0x137));var _0x604d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x04d6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x604d('0x0'));module['exports']={'name':{'type':Sequelize[_0x604d('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x604d('0x2')],'get':function(_0x5a55fc){return _0x604d('0x3')+this[_0x604d('0x4')](_0x604d('0x5'))+'-';}},'description':{'type':Sequelize[_0x604d('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x604d('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 3032bcf..be3bfe0 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 _0xd14c=['html-pdf','eml-format','rimraf','zip-dir','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','limit','set','Content-Range','apply','reject','update','destroy','then','get','VoicePrefixes','error','name','send','index','VoicePrefix','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','map','key','VIRTUAL','field','filter','merge','includeAll','rows','catch','show','include','find','describe','create','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','type','system','description','priority','prefix','Voice\x20Prefix','VoicePrefixId','push','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','charAt','body','sequelize','transaction','addAgents','params','ids','omit','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','options'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xd14c,0xf4));var _0xcd14=function(_0x5c5ee7,_0x5c9df9){_0x5c5ee7=_0x5c5ee7-0x0;var _0x72c692=_0xd14c[_0x5c5ee7];return _0x72c692;};'use strict';var pdf=require(_0xcd14('0x0'));var emlformat=require(_0xcd14('0x1'));var rimraf=require(_0xcd14('0x2'));var zipdir=require(_0xcd14('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcd14('0x4'));var util=require(_0xcd14('0x5'));var path=require(_0xcd14('0x6'));var sox=require(_0xcd14('0x7'));var csv=require('to-csv');var ejs=require(_0xcd14('0x8'));var fs=require('fs');var _=require(_0xcd14('0x9'));var squel=require(_0xcd14('0xa'));var crypto=require(_0xcd14('0xb'));var jsforce=require(_0xcd14('0xc'));var deskjs=require(_0xcd14('0xd'));var toCsv=require(_0xcd14('0xe'));var querystring=require(_0xcd14('0xf'));var Papa=require(_0xcd14('0x10'));var Redis=require(_0xcd14('0x11'));var authService=require(_0xcd14('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xcd14('0x13'));var logger=require(_0xcd14('0x14'))(_0xcd14('0x15'));var utils=require(_0xcd14('0x16'));var config=require(_0xcd14('0x17'));var db=require(_0xcd14('0x18'))['db'];config[_0xcd14('0x19')]=_['defaults'](config[_0xcd14('0x19')],{'host':_0xcd14('0x1a'),'port':0x18eb});var socket=require(_0xcd14('0x1b'))(new Redis(config[_0xcd14('0x19')]));require(_0xcd14('0x1c'))[_0xcd14('0x1d')](socket);function respondWithStatusCode(_0x54d1d4,_0x343aa1){_0x343aa1=_0x343aa1||0xcc;return function(_0x29384e){if(_0x29384e){return _0x54d1d4[_0xcd14('0x1e')](_0x343aa1);}return _0x54d1d4[_0xcd14('0x1f')](_0x343aa1)[_0xcd14('0x20')]();};}function respondWithResult(_0x292ad9,_0x1a499b){_0x1a499b=_0x1a499b||0xc8;return function(_0x4b15dd){if(_0x4b15dd){return _0x292ad9[_0xcd14('0x1f')](_0x1a499b)[_0xcd14('0x21')](_0x4b15dd);}};}function respondWithFilteredResult(_0x538e57,_0x29b8b3){return function(_0x2df758){if(_0x2df758){var _0x2e2ca7=_0x2df758[_0xcd14('0x22')],_0x3b96a3=_0x29b8b3['offset'],_0x3a2ce3=_0x29b8b3[_0xcd14('0x23')]+_0x29b8b3[_0xcd14('0x24')],_0x4ea3ed;if(_0x3a2ce3>=_0x2e2ca7){_0x3a2ce3=_0x2e2ca7;_0x4ea3ed=0xc8;}else{_0x4ea3ed=0xce;}_0x538e57['status'](_0x4ea3ed);return _0x538e57[_0xcd14('0x25')](_0xcd14('0x26'),_0x3b96a3+'-'+_0x3a2ce3+'/'+_0x2e2ca7)[_0xcd14('0x21')](_0x2df758);}return null;};}function patchUpdates(_0x17260e){return function(_0x550bb5){try{jsonpatch[_0xcd14('0x27')](_0x550bb5,_0x17260e,!![]);}catch(_0x2a4326){return BPromise[_0xcd14('0x28')](_0x2a4326);}return _0x550bb5['save']();};}function saveUpdates(_0x4aaa3b,_0x2dd725){return function(_0x406afc){if(_0x406afc){return _0x406afc[_0xcd14('0x29')](_0x4aaa3b)['then'](function(_0xd026aa){return _0xd026aa;});}return null;};}function removeEntity(_0x3f38c8,_0x3e0856){return function(_0x1c15c5){if(_0x1c15c5){return _0x1c15c5[_0xcd14('0x2a')]()[_0xcd14('0x2b')](function(){var _0x31d56b=_0x1c15c5[_0xcd14('0x2c')]({'plain':!![]});var _0x39fa6f=_0xcd14('0x2d');return db['UserProfileResource'][_0xcd14('0x2a')]({'where':{'type':_0x39fa6f,'resourceId':_0x31d56b['id']}})[_0xcd14('0x2b')](function(){return _0x1c15c5;});})[_0xcd14('0x2b')](function(){_0x3f38c8['status'](0xcc)[_0xcd14('0x20')]();});}};}function handleEntityNotFound(_0x395fbd,_0x5bcd62){return function(_0x2eda05){if(!_0x2eda05){_0x395fbd[_0xcd14('0x1e')](0x194);}return _0x2eda05;};}function handleError(_0x6f5f90,_0x107c4e){_0x107c4e=_0x107c4e||0x1f4;return function(_0x14d133){logger[_0xcd14('0x2e')](_0x14d133['stack']);if(_0x14d133[_0xcd14('0x2f')]){delete _0x14d133['name'];}_0x6f5f90[_0xcd14('0x1f')](_0x107c4e)[_0xcd14('0x30')](_0x14d133);};}exports[_0xcd14('0x31')]=function(_0x30356a,_0x53a577){var _0x494e2e={},_0x2682ec={},_0x2b8970={'count':0x0,'rows':[]};var _0x57f316=db[_0xcd14('0x32')][_0xcd14('0x33')];_0x2682ec['model']=_[_0xcd14('0x34')](_0x57f316);_0x2682ec[_0xcd14('0x35')]=_[_0xcd14('0x34')](_0x30356a['query']);_0x2682ec[_0xcd14('0x36')]=_[_0xcd14('0x37')](_0x2682ec[_0xcd14('0x38')],_0x2682ec[_0xcd14('0x35')]);_0x494e2e[_0xcd14('0x39')]=_['intersection'](_0x2682ec[_0xcd14('0x38')],qs[_0xcd14('0x3a')](_0x30356a[_0xcd14('0x35')][_0xcd14('0x3a')]));_0x494e2e['attributes']=_0x494e2e[_0xcd14('0x39')][_0xcd14('0x3b')]?_0x494e2e[_0xcd14('0x39')]:_0x2682ec[_0xcd14('0x38')];if(!_0x30356a['query'][_0xcd14('0x3c')]('nolimit')){_0x494e2e[_0xcd14('0x24')]=qs[_0xcd14('0x24')](_0x30356a[_0xcd14('0x35')][_0xcd14('0x24')]);_0x494e2e['offset']=qs[_0xcd14('0x23')](_0x30356a[_0xcd14('0x35')]['offset']);}_0x494e2e[_0xcd14('0x3d')]=qs[_0xcd14('0x3e')](_0x30356a[_0xcd14('0x35')][_0xcd14('0x3e')]);_0x494e2e['where']=qs[_0xcd14('0x36')](_[_0xcd14('0x3f')](_0x30356a[_0xcd14('0x35')],_0x2682ec['filters']));if(_0x30356a[_0xcd14('0x35')]['filter']){_0x494e2e[_0xcd14('0x40')]=_['merge'](_0x494e2e['where'],{'$or':_[_0xcd14('0x41')](_0x57f316,function(_0x12be9c){if(_0x12be9c['type'][_0xcd14('0x42')]!==_0xcd14('0x43')){var _0xbaf3fe={};_0xbaf3fe[_0x12be9c[_0xcd14('0x44')]]={'$like':'%'+_0x30356a[_0xcd14('0x35')][_0xcd14('0x45')]+'%'};return _0xbaf3fe;}})});}_0x494e2e=_[_0xcd14('0x46')]({},_0x494e2e,_0x30356a['options']);var _0x321cac={'where':_0x494e2e['where']};return db[_0xcd14('0x32')][_0xcd14('0x22')](_0x321cac)['then'](function(_0x14f5e8){_0x2b8970['count']=_0x14f5e8;if(_0x30356a[_0xcd14('0x35')][_0xcd14('0x47')]){_0x494e2e['include']=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x494e2e);})[_0xcd14('0x2b')](function(_0x360ef2){_0x2b8970[_0xcd14('0x48')]=_0x360ef2;return _0x2b8970;})[_0xcd14('0x2b')](respondWithFilteredResult(_0x53a577,_0x494e2e))[_0xcd14('0x49')](handleError(_0x53a577,null));};exports[_0xcd14('0x4a')]=function(_0x3579f8,_0x52c144){var _0x19cb91={'raw':![],'where':{'id':_0x3579f8['params']['id']}},_0x12fc58={};_0x12fc58[_0xcd14('0x38')]=_[_0xcd14('0x34')](db[_0xcd14('0x32')][_0xcd14('0x33')]);_0x12fc58[_0xcd14('0x35')]=_[_0xcd14('0x34')](_0x3579f8[_0xcd14('0x35')]);_0x12fc58[_0xcd14('0x36')]=_[_0xcd14('0x37')](_0x12fc58[_0xcd14('0x38')],_0x12fc58[_0xcd14('0x35')]);_0x19cb91[_0xcd14('0x39')]=_[_0xcd14('0x37')](_0x12fc58['model'],qs[_0xcd14('0x3a')](_0x3579f8[_0xcd14('0x35')][_0xcd14('0x3a')]));_0x19cb91[_0xcd14('0x39')]=_0x19cb91[_0xcd14('0x39')][_0xcd14('0x3b')]?_0x19cb91[_0xcd14('0x39')]:_0x12fc58['model'];if(_0x3579f8[_0xcd14('0x35')][_0xcd14('0x47')]){_0x19cb91[_0xcd14('0x4b')]=[{'all':!![]}];}_0x19cb91=_['merge']({},_0x19cb91,_0x3579f8['options']);return db['VoicePrefix'][_0xcd14('0x4c')](_0x19cb91)['then'](handleEntityNotFound(_0x52c144,null))[_0xcd14('0x2b')](respondWithResult(_0x52c144,null))[_0xcd14('0x49')](handleError(_0x52c144,null));};exports[_0xcd14('0x2a')]=function(_0x14ab18,_0x44edad){return db[_0xcd14('0x32')][_0xcd14('0x4c')]({'where':{'id':_0x14ab18['params']['id']}})[_0xcd14('0x2b')](handleEntityNotFound(_0x44edad,null))['then'](removeEntity(_0x44edad,null))[_0xcd14('0x49')](handleError(_0x44edad,null));};exports[_0xcd14('0x4d')]=function(_0xa4f706,_0x2741a0){return db['VoicePrefix'][_0xcd14('0x4d')]()[_0xcd14('0x2b')](respondWithResult(_0x2741a0,null))['catch'](handleError(_0x2741a0,null));};exports[_0xcd14('0x4e')]=function(_0x12cf06,_0x965e52){var _0x25f632;return db['sequelize']['transaction'](function(_0x2c59c7){return db[_0xcd14('0x32')][_0xcd14('0x4e')](_0x12cf06['body'],{'transaction':_0x2c59c7})[_0xcd14('0x2b')](function(_0x2983aa){_0x25f632=_0x2983aa[_0xcd14('0x2c')]({'plain':!![]});return db[_0xcd14('0x4f')]['find']({'where':{'id':_0x25f632[_0xcd14('0x50')]},'raw':!![]})[_0xcd14('0x2b')](function(_0x51f4f9){return createVoicePrefixExtensions(_0x25f632,_0x51f4f9,_0x2c59c7);});});})[_0xcd14('0x2b')](function(){var _0x146b98=_0x12cf06[_0xcd14('0x51')][_0xcd14('0x2c')]({'plain':!![]});if(!_0x146b98)throw new Error(_0xcd14('0x52'));if(_0x146b98[_0xcd14('0x53')]==='user'){var _0x226807=_0x25f632;return db[_0xcd14('0x54')][_0xcd14('0x4c')]({'where':{'name':_0xcd14('0x2d'),'userProfileId':_0x146b98[_0xcd14('0x55')]},'raw':!![]})['then'](function(_0x4a6743){if(_0x4a6743&&_0x4a6743['autoAssociation']===0x0){return db[_0xcd14('0x56')][_0xcd14('0x4e')]({'name':_0x226807[_0xcd14('0x2f')],'resourceId':_0x226807['id'],'type':_0x4a6743[_0xcd14('0x2f')],'sectionId':_0x4a6743['id']},{})[_0xcd14('0x2b')](function(){return _0x25f632;});}else{return _0x25f632;}})[_0xcd14('0x49')](function(_0x5a253c){logger[_0xcd14('0x2e')](_0xcd14('0x57'),_0x5a253c);throw _0x5a253c;});}return _0x25f632;})['then'](respondWithResult(_0x965e52,null))[_0xcd14('0x49')](handleError(_0x965e52,null));};function Extension(_0x586a1a,_0x31e9af,_0x2e46d7,_0x446ecc){this[_0xcd14('0x58')]=_0xcd14('0x59');this[_0xcd14('0x5a')]=_0x586a1a;this[_0xcd14('0x5b')]=_0x2e46d7;this[_0xcd14('0x5c')]=_0xcd14('0x5d');this[_0xcd14('0x5e')]='Voice\x20Prefix\x20Extension';this[_0xcd14('0x5f')]=_0x31e9af;this['appdata']=_0x446ecc;}function createVoicePrefixExtensions(_0x28bd97,_0x326dcc,_0x2ce0c9){return new BPromise(function(_0xd74bee,_0x3f7afd){var _0x1fcf7d=new Extension(formatPrefixName(_0x28bd97[_0xcd14('0x60')]),0x1,'NoOp',_0xcd14('0x61'));_0x1fcf7d[_0xcd14('0x62')]=_0x28bd97['id'];return db[_0xcd14('0x4f')]['create'](_0x1fcf7d,{'transaction':_0x2ce0c9})[_0xcd14('0x2b')](function(_0x5d36d1){var _0x456c3e=_0x5d36d1[_0xcd14('0x2c')]({'plain':!![]});var _0xe608ec=_[_0xcd14('0x41')](addVoicePrefixExtensions(_0x28bd97,_0x326dcc),function(_0x37678a){_0x37678a['VoiceExtensionId']=_0x456c3e['id'];_0x37678a['VoicePrefixId']=_0x28bd97['id'];return _0x37678a;});return db['VoiceExtension']['bulkCreate'](_0xe608ec,{'transaction':_0x2ce0c9})[_0xcd14('0x2b')](function(_0x5db075){if(!_0x5db075){return _0x3f7afd('Extensions\x20creation\x20failed');}else{return _0xd74bee(_0x5db075);}})['catch'](function(_0x5ebf26){return _0x3f7afd(_0x5ebf26);});});;});};function addVoicePrefixExtensions(_0x40afee,_0x4ea796){var _0x3e661c=[];var _0x3c1c9b=formatPrefixName(_0x40afee[_0xcd14('0x60')]);_0x3e661c[_0xcd14('0x63')](new Extension(_0x3c1c9b,0x2,'Set',_0xcd14('0x64')+_0x40afee[_0xcd14('0x2f')]));if(_0x40afee[_0xcd14('0x65')]){_0x3e661c[_0xcd14('0x63')](new Extension(_0x3c1c9b,0x3,'Set',_0xcd14('0x66')+_0x40afee[_0xcd14('0x65')]));}else{_0x3e661c[_0xcd14('0x63')](new Extension(_0x3c1c9b,0x3,_0xcd14('0x67'),_0xcd14('0x68')));}_0x3e661c[_0xcd14('0x63')](new Extension(_0x3c1c9b,0x4,_0xcd14('0x69'),_0x4ea796['context']+','+'${EXTEN:'+(0x8+_0x40afee['name'][_0xcd14('0x3b')])+'}'+','+0x1));return _0x3e661c;}function formatPrefixName(_0x2e9dd3){var _0x69095a='_';for(var _0xfdbe64=0x0;_0xfdbe64<_0x2e9dd3[_0xcd14('0x3b')];_0xfdbe64++){if(_0x2e9dd3['charAt'](_0xfdbe64)=='-'){_0x69095a+=_0x2e9dd3[_0xcd14('0x6a')](_0xfdbe64);}else{_0x69095a+='['+_0x2e9dd3[_0xcd14('0x6a')](_0xfdbe64)+']';}}_0x69095a+='.';return _0x69095a;}exports[_0xcd14('0x29')]=function(_0x30c879,_0x1f438d,_0x394c7b){var _0x47c101=_0x30c879[_0xcd14('0x6b')];_0x47c101[_0xcd14('0x60')]='system-'+_0x47c101[_0xcd14('0x2f')]+'-';return db[_0xcd14('0x6c')][_0xcd14('0x6d')](function(_0x300ec9){return db[_0xcd14('0x32')]['update'](_0x47c101,{'where':{'id':_0x47c101['id']},'transaction':_0x300ec9})[_0xcd14('0x2b')](function(){return db['VoiceExtension'][_0xcd14('0x2a')]({'where':{'VoicePrefixId':_0x47c101['id']},'transaction':_0x300ec9})[_0xcd14('0x2b')](function(){return db[_0xcd14('0x4f')][_0xcd14('0x4c')]({'where':{'id':_0x47c101[_0xcd14('0x50')]},'raw':!![]})[_0xcd14('0x2b')](function(_0x45ef14){return createVoicePrefixExtensions(_0x47c101,_0x45ef14,_0x300ec9);});});});})['then'](function(){return db[_0xcd14('0x32')]['findById'](_0x47c101['id']);})[_0xcd14('0x2b')](respondWithResult(_0x1f438d,null))[_0xcd14('0x49')](handleError(_0x1f438d,null));};exports[_0xcd14('0x6e')]=function(_0x534e7c,_0x567d98,_0x13ddbc){return db[_0xcd14('0x32')]['find']({'where':{'id':_0x534e7c[_0xcd14('0x6f')]['id']}})[_0xcd14('0x2b')](handleEntityNotFound(_0x567d98,null))['then'](function(_0x25a77){if(_0x25a77){return _0x25a77[_0xcd14('0x6e')](_0x534e7c[_0xcd14('0x6b')][_0xcd14('0x70')],_[_0xcd14('0x71')](_0x534e7c[_0xcd14('0x6b')],[_0xcd14('0x70'),'id'])||{})['spread'](function(_0x5080bb){for(var _0x4e0d50=0x0;_0x4e0d50<_0x534e7c[_0xcd14('0x6b')][_0xcd14('0x70')][_0xcd14('0x3b')];_0x4e0d50+=0x1){socket[_0xcd14('0x72')](_0xcd14('0x73'),{'UserId':_0x534e7c['body'][_0xcd14('0x70')][_0x4e0d50],'VoicePrefixId':_0x534e7c['params']['id']});}return _0x5080bb;});}})[_0xcd14('0x2b')](respondWithResult(_0x567d98,null))[_0xcd14('0x49')](handleError(_0x567d98,null));};exports['removeAgents']=function(_0x178dae,_0x47e229,_0x20722d){return db['VoicePrefix'][_0xcd14('0x4c')]({'where':{'id':_0x178dae[_0xcd14('0x6f')]['id']}})[_0xcd14('0x2b')](handleEntityNotFound(_0x47e229,null))[_0xcd14('0x2b')](function(_0x954dc){if(_0x954dc){return _0x954dc['removeAgents'](_0x178dae[_0xcd14('0x35')]['ids'])[_0xcd14('0x2b')](function(){if(_[_0xcd14('0x74')](_0x178dae['query'][_0xcd14('0x70')])){for(var _0x3c9dff=0x0;_0x3c9dff<_0x178dae['query'][_0xcd14('0x70')][_0xcd14('0x3b')];_0x3c9dff+=0x1){socket[_0xcd14('0x72')](_0xcd14('0x75'),{'UserId':Number(_0x178dae[_0xcd14('0x35')][_0xcd14('0x70')][_0x3c9dff]),'VoicePrefixId':Number(_0x178dae[_0xcd14('0x6f')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x178dae['query']['ids']),'VoicePrefixId':Number(_0x178dae[_0xcd14('0x6f')]['id'])});}});}})[_0xcd14('0x2b')](respondWithStatusCode(_0x47e229,null))[_0xcd14('0x49')](handleError(_0x47e229,null));};exports[_0xcd14('0x76')]=function(_0x5b7e49,_0x4ef852,_0x3d1f0a){var _0x21df13={};var _0x6ef38f={};var _0x5b7512;var _0x269595;return db[_0xcd14('0x32')][_0xcd14('0x77')]({'where':{'id':_0x5b7e49[_0xcd14('0x6f')]['id']}})['then'](handleEntityNotFound(_0x4ef852,null))[_0xcd14('0x2b')](function(_0x5e180d){if(_0x5e180d){_0x5b7512=_0x5e180d;_0x6ef38f['model']=_['keys'](db[_0xcd14('0x78')][_0xcd14('0x33')]);_0x6ef38f[_0xcd14('0x35')]=_['keys'](_0x5b7e49[_0xcd14('0x35')]);_0x6ef38f[_0xcd14('0x36')]=_[_0xcd14('0x37')](_0x6ef38f[_0xcd14('0x38')],_0x6ef38f[_0xcd14('0x35')]);_0x21df13['attributes']=_[_0xcd14('0x37')](_0x6ef38f['model'],qs[_0xcd14('0x3a')](_0x5b7e49[_0xcd14('0x35')]['fields']));_0x21df13[_0xcd14('0x39')]=_0x21df13[_0xcd14('0x39')][_0xcd14('0x3b')]?_0x21df13[_0xcd14('0x39')]:_0x6ef38f[_0xcd14('0x38')];_0x21df13['order']=qs[_0xcd14('0x3e')](_0x5b7e49['query'][_0xcd14('0x3e')]);_0x21df13[_0xcd14('0x40')]=qs[_0xcd14('0x36')](_['pick'](_0x5b7e49['query'],_0x6ef38f['filters']));if(_0x5b7e49[_0xcd14('0x35')][_0xcd14('0x45')]){_0x21df13['where']=_[_0xcd14('0x46')](_0x21df13[_0xcd14('0x40')],{'$or':_[_0xcd14('0x41')](_0x21df13[_0xcd14('0x39')],function(_0x4fff44){var _0x381cca={};_0x381cca[_0x4fff44]={'$like':'%'+_0x5b7e49[_0xcd14('0x35')][_0xcd14('0x45')]+'%'};return _0x381cca;})});}_0x21df13=_[_0xcd14('0x46')]({},_0x21df13,_0x5b7e49[_0xcd14('0x79')]);return _0x5b7512['getAgents'](_0x21df13);}})[_0xcd14('0x2b')](function(_0x49697f){if(_0x49697f){_0x269595=_0x49697f['length'];if(!_0x5b7e49['query'][_0xcd14('0x3c')]('nolimit')){_0x21df13['limit']=qs[_0xcd14('0x24')](_0x5b7e49[_0xcd14('0x35')][_0xcd14('0x24')]);_0x21df13[_0xcd14('0x23')]=qs['offset'](_0x5b7e49[_0xcd14('0x35')]['offset']);}return _0x5b7512[_0xcd14('0x76')](_0x21df13);}})[_0xcd14('0x2b')](function(_0x498985){if(_0x498985){return _0x498985?{'count':_0x269595,'rows':_0x498985}:null;}})[_0xcd14('0x2b')](respondWithResult(_0x4ef852,null))[_0xcd14('0x49')](handleError(_0x4ef852,null));}; \ No newline at end of file +var _0x5516=['VoicePrefix','rawAttributes','model','keys','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','then','includeAll','rows','params','filters','intersection','include','find','catch','describe','sequelize','transaction','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','length','update','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','limit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index'];(function(_0x255444,_0x214810){var _0x326ffd=function(_0x20f360){while(--_0x20f360){_0x255444['push'](_0x255444['shift']());}};_0x326ffd(++_0x214810);}(_0x5516,0xd2));var _0x6551=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x5516[_0x3ec122];return _0x4ecf41;};'use strict';var pdf=require(_0x6551('0x0'));var emlformat=require(_0x6551('0x1'));var rimraf=require(_0x6551('0x2'));var zipdir=require(_0x6551('0x3'));var jsonpatch=require(_0x6551('0x4'));var rp=require('request-promise');var moment=require(_0x6551('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6551('0x6'));var util=require(_0x6551('0x7'));var path=require(_0x6551('0x8'));var sox=require(_0x6551('0x9'));var csv=require(_0x6551('0xa'));var ejs=require(_0x6551('0xb'));var fs=require('fs');var _=require(_0x6551('0xc'));var squel=require(_0x6551('0xd'));var crypto=require(_0x6551('0xe'));var jsforce=require(_0x6551('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6551('0xa'));var querystring=require(_0x6551('0x10'));var Papa=require('papaparse');var Redis=require(_0x6551('0x11'));var authService=require(_0x6551('0x12'));var qs=require(_0x6551('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6551('0x14'));var config=require(_0x6551('0x15'));var db=require(_0x6551('0x16'))['db'];config[_0x6551('0x17')]=_[_0x6551('0x18')](config[_0x6551('0x17')],{'host':_0x6551('0x19'),'port':0x18eb});var socket=require(_0x6551('0x1a'))(new Redis(config[_0x6551('0x17')]));require('./voicePrefix.socket')[_0x6551('0x1b')](socket);function respondWithStatusCode(_0x2ea297,_0x1b4736){_0x1b4736=_0x1b4736||0xcc;return function(_0x578ab6){if(_0x578ab6){return _0x2ea297[_0x6551('0x1c')](_0x1b4736);}return _0x2ea297[_0x6551('0x1d')](_0x1b4736)[_0x6551('0x1e')]();};}function respondWithResult(_0x59b80d,_0x928ab1){_0x928ab1=_0x928ab1||0xc8;return function(_0x1d2ef3){if(_0x1d2ef3){return _0x59b80d['status'](_0x928ab1)[_0x6551('0x1f')](_0x1d2ef3);}};}function respondWithFilteredResult(_0x32ba38,_0x3d07eb){return function(_0xb61198){if(_0xb61198){var _0x1d5418=_0xb61198[_0x6551('0x20')],_0x203ae9=_0x3d07eb[_0x6551('0x21')],_0x1bac94=_0x3d07eb[_0x6551('0x21')]+_0x3d07eb['limit'],_0x7247fe;if(_0x1bac94>=_0x1d5418){_0x1bac94=_0x1d5418;_0x7247fe=0xc8;}else{_0x7247fe=0xce;}_0x32ba38[_0x6551('0x1d')](_0x7247fe);return _0x32ba38[_0x6551('0x22')](_0x6551('0x23'),_0x203ae9+'-'+_0x1bac94+'/'+_0x1d5418)[_0x6551('0x1f')](_0xb61198);}return null;};}function patchUpdates(_0x34bb32){return function(_0x2c6ba0){try{jsonpatch[_0x6551('0x24')](_0x2c6ba0,_0x34bb32,!![]);}catch(_0x3a28f4){return BPromise[_0x6551('0x25')](_0x3a28f4);}return _0x2c6ba0[_0x6551('0x26')]();};}function saveUpdates(_0x51f4e3,_0x10872d){return function(_0x3e5060){if(_0x3e5060){return _0x3e5060['update'](_0x51f4e3)['then'](function(_0x34661b){return _0x34661b;});}return null;};}function removeEntity(_0x526735,_0x499161){return function(_0x4cff98){if(_0x4cff98){return _0x4cff98[_0x6551('0x27')]()['then'](function(){var _0x7000d2=_0x4cff98[_0x6551('0x28')]({'plain':!![]});var _0x2d7124='VoicePrefixes';return db[_0x6551('0x29')][_0x6551('0x27')]({'where':{'type':_0x2d7124,'resourceId':_0x7000d2['id']}})['then'](function(){return _0x4cff98;});})['then'](function(){_0x526735[_0x6551('0x1d')](0xcc)[_0x6551('0x1e')]();});}};}function handleEntityNotFound(_0x5bd763,_0x481af4){return function(_0x5c3c2c){if(!_0x5c3c2c){_0x5bd763['sendStatus'](0x194);}return _0x5c3c2c;};}function handleError(_0x29555c,_0x3e51a2){_0x3e51a2=_0x3e51a2||0x1f4;return function(_0x289059){logger['error'](_0x289059[_0x6551('0x2a')]);if(_0x289059[_0x6551('0x2b')]){delete _0x289059[_0x6551('0x2b')];}_0x29555c['status'](_0x3e51a2)[_0x6551('0x2c')](_0x289059);};}exports[_0x6551('0x2d')]=function(_0x5c1f1b,_0x343000){var _0x23fa57={},_0x3444f1={},_0x3139eb={'count':0x0,'rows':[]};var _0x42baaf=db[_0x6551('0x2e')][_0x6551('0x2f')];_0x3444f1[_0x6551('0x30')]=_[_0x6551('0x31')](_0x42baaf);_0x3444f1[_0x6551('0x32')]=_['keys'](_0x5c1f1b['query']);_0x3444f1['filters']=_['intersection'](_0x3444f1[_0x6551('0x30')],_0x3444f1['query']);_0x23fa57['attributes']=_['intersection'](_0x3444f1[_0x6551('0x30')],qs[_0x6551('0x33')](_0x5c1f1b[_0x6551('0x32')][_0x6551('0x33')]));_0x23fa57['attributes']=_0x23fa57[_0x6551('0x34')]['length']?_0x23fa57[_0x6551('0x34')]:_0x3444f1[_0x6551('0x30')];if(!_0x5c1f1b[_0x6551('0x32')][_0x6551('0x35')](_0x6551('0x36'))){_0x23fa57['limit']=qs['limit'](_0x5c1f1b['query']['limit']);_0x23fa57[_0x6551('0x21')]=qs[_0x6551('0x21')](_0x5c1f1b[_0x6551('0x32')][_0x6551('0x21')]);}_0x23fa57[_0x6551('0x37')]=qs[_0x6551('0x38')](_0x5c1f1b[_0x6551('0x32')][_0x6551('0x38')]);_0x23fa57[_0x6551('0x39')]=qs['filters'](_[_0x6551('0x3a')](_0x5c1f1b[_0x6551('0x32')],_0x3444f1['filters']));if(_0x5c1f1b[_0x6551('0x32')][_0x6551('0x3b')]){_0x23fa57[_0x6551('0x39')]=_[_0x6551('0x3c')](_0x23fa57[_0x6551('0x39')],{'$or':_[_0x6551('0x3d')](_0x42baaf,function(_0x30eddc){if(_0x30eddc[_0x6551('0x3e')]['key']!==_0x6551('0x3f')){var _0x48f38c={};_0x48f38c[_0x30eddc[_0x6551('0x40')]]={'$like':'%'+_0x5c1f1b[_0x6551('0x32')]['filter']+'%'};return _0x48f38c;}})});}_0x23fa57=_[_0x6551('0x3c')]({},_0x23fa57,_0x5c1f1b[_0x6551('0x41')]);var _0x3a477={'where':_0x23fa57[_0x6551('0x39')]};return db[_0x6551('0x2e')]['count'](_0x3a477)[_0x6551('0x42')](function(_0x17d734){_0x3139eb[_0x6551('0x20')]=_0x17d734;if(_0x5c1f1b[_0x6551('0x32')][_0x6551('0x43')]){_0x23fa57['include']=[{'all':!![]}];}return db[_0x6551('0x2e')]['findAll'](_0x23fa57);})[_0x6551('0x42')](function(_0x4ef35c){_0x3139eb[_0x6551('0x44')]=_0x4ef35c;return _0x3139eb;})[_0x6551('0x42')](respondWithFilteredResult(_0x343000,_0x23fa57))['catch'](handleError(_0x343000,null));};exports['show']=function(_0x5de4ff,_0x2eb1df){var _0x1e2976={'raw':![],'where':{'id':_0x5de4ff[_0x6551('0x45')]['id']}},_0x1ee459={};_0x1ee459[_0x6551('0x30')]=_[_0x6551('0x31')](db['VoicePrefix']['rawAttributes']);_0x1ee459[_0x6551('0x32')]=_[_0x6551('0x31')](_0x5de4ff[_0x6551('0x32')]);_0x1ee459[_0x6551('0x46')]=_[_0x6551('0x47')](_0x1ee459[_0x6551('0x30')],_0x1ee459[_0x6551('0x32')]);_0x1e2976[_0x6551('0x34')]=_['intersection'](_0x1ee459[_0x6551('0x30')],qs['fields'](_0x5de4ff['query'][_0x6551('0x33')]));_0x1e2976[_0x6551('0x34')]=_0x1e2976[_0x6551('0x34')]['length']?_0x1e2976[_0x6551('0x34')]:_0x1ee459[_0x6551('0x30')];if(_0x5de4ff[_0x6551('0x32')][_0x6551('0x43')]){_0x1e2976[_0x6551('0x48')]=[{'all':!![]}];}_0x1e2976=_[_0x6551('0x3c')]({},_0x1e2976,_0x5de4ff[_0x6551('0x41')]);return db[_0x6551('0x2e')][_0x6551('0x49')](_0x1e2976)[_0x6551('0x42')](handleEntityNotFound(_0x2eb1df,null))[_0x6551('0x42')](respondWithResult(_0x2eb1df,null))[_0x6551('0x4a')](handleError(_0x2eb1df,null));};exports['destroy']=function(_0x2a8279,_0x4d27b5){return db[_0x6551('0x2e')][_0x6551('0x49')]({'where':{'id':_0x2a8279[_0x6551('0x45')]['id']}})[_0x6551('0x42')](handleEntityNotFound(_0x4d27b5,null))[_0x6551('0x42')](removeEntity(_0x4d27b5,null))['catch'](handleError(_0x4d27b5,null));};exports[_0x6551('0x4b')]=function(_0xc6f7d,_0x1639cd){return db[_0x6551('0x2e')]['describe']()['then'](respondWithResult(_0x1639cd,null))['catch'](handleError(_0x1639cd,null));};exports['create']=function(_0x2f572f,_0x3b8068){var _0x54e690;return db[_0x6551('0x4c')][_0x6551('0x4d')](function(_0x3afc7e){return db['VoicePrefix'][_0x6551('0x4e')](_0x2f572f[_0x6551('0x4f')],{'transaction':_0x3afc7e})['then'](function(_0x333978){_0x54e690=_0x333978[_0x6551('0x28')]({'plain':!![]});return db[_0x6551('0x50')]['find']({'where':{'id':_0x54e690['VoiceExtensionId']},'raw':!![]})[_0x6551('0x42')](function(_0x45429b){return createVoicePrefixExtensions(_0x54e690,_0x45429b,_0x3afc7e);});});})['then'](function(){var _0x1d8abb=_0x2f572f[_0x6551('0x51')]['get']({'plain':!![]});if(!_0x1d8abb)throw new Error(_0x6551('0x52'));if(_0x1d8abb[_0x6551('0x53')]==='user'){var _0xc705c2=_0x54e690;return db[_0x6551('0x54')][_0x6551('0x49')]({'where':{'name':_0x6551('0x55'),'userProfileId':_0x1d8abb[_0x6551('0x56')]},'raw':!![]})[_0x6551('0x42')](function(_0x2fd706){if(_0x2fd706&&_0x2fd706[_0x6551('0x57')]===0x0){return db[_0x6551('0x29')][_0x6551('0x4e')]({'name':_0xc705c2['name'],'resourceId':_0xc705c2['id'],'type':_0x2fd706[_0x6551('0x2b')],'sectionId':_0x2fd706['id']},{})[_0x6551('0x42')](function(){return _0x54e690;});}else{return _0x54e690;}})['catch'](function(_0x505ee3){logger[_0x6551('0x58')](_0x6551('0x59'),_0x505ee3);throw _0x505ee3;});}return _0x54e690;})[_0x6551('0x42')](respondWithResult(_0x3b8068,null))[_0x6551('0x4a')](handleError(_0x3b8068,null));};function Extension(_0x5e0247,_0x48672a,_0xb652d,_0xbfc12f){this['context']=_0x6551('0x5a');this['exten']=_0x5e0247;this[_0x6551('0x5b')]=_0xb652d;this[_0x6551('0x3e')]='system';this[_0x6551('0x5c')]=_0x6551('0x5d');this[_0x6551('0x5e')]=_0x48672a;this[_0x6551('0x5f')]=_0xbfc12f;}function createVoicePrefixExtensions(_0x17a166,_0x16bcd1,_0x21be85){return new BPromise(function(_0x5d3bb6,_0x4b99d2){var _0x1d5669=new Extension(formatPrefixName(_0x17a166[_0x6551('0x60')]),0x1,_0x6551('0x61'),_0x6551('0x62'));_0x1d5669[_0x6551('0x63')]=_0x17a166['id'];return db['VoiceExtension'][_0x6551('0x4e')](_0x1d5669,{'transaction':_0x21be85})[_0x6551('0x42')](function(_0x164a04){var _0xbfbcde=_0x164a04[_0x6551('0x28')]({'plain':!![]});var _0x4ec2f6=_[_0x6551('0x3d')](addVoicePrefixExtensions(_0x17a166,_0x16bcd1),function(_0x23933f){_0x23933f[_0x6551('0x64')]=_0xbfbcde['id'];_0x23933f['VoicePrefixId']=_0x17a166['id'];return _0x23933f;});return db[_0x6551('0x50')][_0x6551('0x65')](_0x4ec2f6,{'transaction':_0x21be85})[_0x6551('0x42')](function(_0x4d4e02){if(!_0x4d4e02){return _0x4b99d2(_0x6551('0x66'));}else{return _0x5d3bb6(_0x4d4e02);}})['catch'](function(_0x13bffc){return _0x4b99d2(_0x13bffc);});});;});};function addVoicePrefixExtensions(_0x57d7d4,_0xeabc57){var _0xb4d5af=[];var _0x426da0=formatPrefixName(_0x57d7d4[_0x6551('0x60')]);_0xb4d5af['push'](new Extension(_0x426da0,0x2,'Set',_0x6551('0x67')+_0x57d7d4[_0x6551('0x2b')]));if(_0x57d7d4[_0x6551('0x68')]){_0xb4d5af[_0x6551('0x69')](new Extension(_0x426da0,0x3,_0x6551('0x6a'),_0x6551('0x6b')+_0x57d7d4['callerIdAll']));}else{_0xb4d5af[_0x6551('0x69')](new Extension(_0x426da0,0x3,'NoOp',_0x6551('0x6c')));}_0xb4d5af[_0x6551('0x69')](new Extension(_0x426da0,0x4,_0x6551('0x6d'),_0xeabc57[_0x6551('0x6e')]+','+'${EXTEN:'+(0x8+_0x57d7d4['name'][_0x6551('0x6f')])+'}'+','+0x1));return _0xb4d5af;}function formatPrefixName(_0xf7b474){var _0x14b78b='_';for(var _0x34c7a9=0x0;_0x34c7a9<_0xf7b474[_0x6551('0x6f')];_0x34c7a9++){if(_0xf7b474['charAt'](_0x34c7a9)=='-'){_0x14b78b+=_0xf7b474['charAt'](_0x34c7a9);}else{_0x14b78b+='['+_0xf7b474['charAt'](_0x34c7a9)+']';}}_0x14b78b+='.';return _0x14b78b;}exports[_0x6551('0x70')]=function(_0x3b50c1,_0x28f7e5,_0x165e9c){var _0x6662e1=_0x3b50c1[_0x6551('0x4f')];_0x6662e1[_0x6551('0x60')]=_0x6551('0x71')+_0x6662e1[_0x6551('0x2b')]+'-';return db[_0x6551('0x4c')]['transaction'](function(_0x3de95a){return db[_0x6551('0x2e')][_0x6551('0x70')](_0x6662e1,{'where':{'id':_0x6662e1['id']},'transaction':_0x3de95a})[_0x6551('0x42')](function(){return db[_0x6551('0x50')][_0x6551('0x27')]({'where':{'VoicePrefixId':_0x6662e1['id']},'transaction':_0x3de95a})[_0x6551('0x42')](function(){return db[_0x6551('0x50')][_0x6551('0x49')]({'where':{'id':_0x6662e1[_0x6551('0x64')]},'raw':!![]})[_0x6551('0x42')](function(_0x459665){return createVoicePrefixExtensions(_0x6662e1,_0x459665,_0x3de95a);});});});})[_0x6551('0x42')](function(){return db[_0x6551('0x2e')][_0x6551('0x72')](_0x6662e1['id']);})[_0x6551('0x42')](respondWithResult(_0x28f7e5,null))[_0x6551('0x4a')](handleError(_0x28f7e5,null));};exports[_0x6551('0x73')]=function(_0x781bfe,_0x1bdd31,_0xd3ffb8){return db[_0x6551('0x2e')][_0x6551('0x49')]({'where':{'id':_0x781bfe[_0x6551('0x45')]['id']}})[_0x6551('0x42')](handleEntityNotFound(_0x1bdd31,null))[_0x6551('0x42')](function(_0x202f2c){if(_0x202f2c){return _0x202f2c['addAgents'](_0x781bfe['body'][_0x6551('0x74')],_[_0x6551('0x75')](_0x781bfe['body'],[_0x6551('0x74'),'id'])||{})[_0x6551('0x76')](function(_0x5a503f){for(var _0x377528=0x0;_0x377528<_0x781bfe['body'][_0x6551('0x74')]['length'];_0x377528+=0x1){socket[_0x6551('0x77')](_0x6551('0x78'),{'UserId':_0x781bfe[_0x6551('0x4f')]['ids'][_0x377528],'VoicePrefixId':_0x781bfe[_0x6551('0x45')]['id']});}return _0x5a503f;});}})['then'](respondWithResult(_0x1bdd31,null))[_0x6551('0x4a')](handleError(_0x1bdd31,null));};exports[_0x6551('0x79')]=function(_0x3a3497,_0x19f242,_0x1b10ee){return db[_0x6551('0x2e')][_0x6551('0x49')]({'where':{'id':_0x3a3497[_0x6551('0x45')]['id']}})[_0x6551('0x42')](handleEntityNotFound(_0x19f242,null))[_0x6551('0x42')](function(_0x42eaaa){if(_0x42eaaa){return _0x42eaaa['removeAgents'](_0x3a3497[_0x6551('0x32')]['ids'])[_0x6551('0x42')](function(){if(_[_0x6551('0x7a')](_0x3a3497[_0x6551('0x32')][_0x6551('0x74')])){for(var _0x17215c=0x0;_0x17215c<_0x3a3497[_0x6551('0x32')][_0x6551('0x74')][_0x6551('0x6f')];_0x17215c+=0x1){socket['emit'](_0x6551('0x7b'),{'UserId':Number(_0x3a3497[_0x6551('0x32')][_0x6551('0x74')][_0x17215c]),'VoicePrefixId':Number(_0x3a3497[_0x6551('0x45')]['id'])});}}else{socket[_0x6551('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x3a3497['query'][_0x6551('0x74')]),'VoicePrefixId':Number(_0x3a3497['params']['id'])});}});}})['then'](respondWithStatusCode(_0x19f242,null))[_0x6551('0x4a')](handleError(_0x19f242,null));};exports['getAgents']=function(_0x44311e,_0x15f153,_0x27edc8){var _0xc53cf4={};var _0x3a48b1={};var _0x3800dc;var _0x14c2d8;return db['VoicePrefix'][_0x6551('0x7c')]({'where':{'id':_0x44311e[_0x6551('0x45')]['id']}})[_0x6551('0x42')](handleEntityNotFound(_0x15f153,null))['then'](function(_0x2b3f4f){if(_0x2b3f4f){_0x3800dc=_0x2b3f4f;_0x3a48b1[_0x6551('0x30')]=_[_0x6551('0x31')](db[_0x6551('0x7d')][_0x6551('0x2f')]);_0x3a48b1[_0x6551('0x32')]=_[_0x6551('0x31')](_0x44311e[_0x6551('0x32')]);_0x3a48b1[_0x6551('0x46')]=_['intersection'](_0x3a48b1[_0x6551('0x30')],_0x3a48b1[_0x6551('0x32')]);_0xc53cf4['attributes']=_[_0x6551('0x47')](_0x3a48b1[_0x6551('0x30')],qs[_0x6551('0x33')](_0x44311e['query']['fields']));_0xc53cf4[_0x6551('0x34')]=_0xc53cf4[_0x6551('0x34')]['length']?_0xc53cf4['attributes']:_0x3a48b1[_0x6551('0x30')];_0xc53cf4[_0x6551('0x37')]=qs[_0x6551('0x38')](_0x44311e[_0x6551('0x32')]['sort']);_0xc53cf4[_0x6551('0x39')]=qs[_0x6551('0x46')](_[_0x6551('0x3a')](_0x44311e['query'],_0x3a48b1[_0x6551('0x46')]));if(_0x44311e[_0x6551('0x32')][_0x6551('0x3b')]){_0xc53cf4[_0x6551('0x39')]=_[_0x6551('0x3c')](_0xc53cf4[_0x6551('0x39')],{'$or':_[_0x6551('0x3d')](_0xc53cf4[_0x6551('0x34')],function(_0x3a688f){var _0x4214a0={};_0x4214a0[_0x3a688f]={'$like':'%'+_0x44311e[_0x6551('0x32')][_0x6551('0x3b')]+'%'};return _0x4214a0;})});}_0xc53cf4=_[_0x6551('0x3c')]({},_0xc53cf4,_0x44311e[_0x6551('0x41')]);return _0x3800dc[_0x6551('0x7e')](_0xc53cf4);}})[_0x6551('0x42')](function(_0x413f63){if(_0x413f63){_0x14c2d8=_0x413f63[_0x6551('0x6f')];if(!_0x44311e[_0x6551('0x32')][_0x6551('0x35')](_0x6551('0x36'))){_0xc53cf4[_0x6551('0x7f')]=qs['limit'](_0x44311e[_0x6551('0x32')][_0x6551('0x7f')]);_0xc53cf4[_0x6551('0x21')]=qs['offset'](_0x44311e[_0x6551('0x32')]['offset']);}return _0x3800dc[_0x6551('0x7e')](_0xc53cf4);}})[_0x6551('0x42')](function(_0x934f66){if(_0x934f66){return _0x934f66?{'count':_0x14c2d8,'rows':_0x934f66}:null;}})[_0x6551('0x42')](respondWithResult(_0x15f153,null))[_0x6551('0x4a')](handleError(_0x15f153,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 8e6cf02..71c3c66 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x56e60b,_0x3c1bdc){var _0x305ce1=function(_0x98659c){while(--_0x98659c){_0x56e60b['push'](_0x56e60b['shift']());}};_0x305ce1(++_0x3c1bdc);}(_0x70e0,0x17b));var _0x070e=function(_0x393ffb,_0x4be9ed){_0x393ffb=_0x393ffb-0x0;var _0x4c3465=_0x70e0[_0x393ffb];return _0x4c3465;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x34e8,0x12c));var _0x834e=function(_0x97e239,_0x48526b){_0x97e239=_0x97e239-0x0;var _0x541483=_0x34e8[_0x97e239];return _0x541483;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 391f1e0..e5c0305 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 _0xafeb=['../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','api','path','rimraf'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xafeb,0xff));var _0xbafe=function(_0x4ce721,_0x187b7c){_0x4ce721=_0x4ce721-0x0;var _0x523b2d=_0xafeb[_0x4ce721];return _0x523b2d;};'use strict';var _=require(_0xbafe('0x0'));var util=require(_0xbafe('0x1'));var logger=require('../../config/logger')(_0xbafe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbafe('0x3'));var rimraf=require(_0xbafe('0x4'));var config=require(_0xbafe('0x5'));var attributes=require(_0xbafe('0x6'));module['exports']=function(_0x438977,_0x28e452){return _0x438977[_0xbafe('0x7')](_0xbafe('0x8'),attributes,{'tableName':_0xbafe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe85c=['path','rimraf','../../config/environment','exports','define','voice_prefixes','lodash','util','api','bluebird'];(function(_0x50a104,_0x3b0422){var _0x31cfe8=function(_0x3ca4ff){while(--_0x3ca4ff){_0x50a104['push'](_0x50a104['shift']());}};_0x31cfe8(++_0x3b0422);}(_0xe85c,0x182));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce85('0x0'));var util=require(_0xce85('0x1'));var logger=require('../../config/logger')(_0xce85('0x2'));var moment=require('moment');var BPromise=require(_0xce85('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce85('0x4'));var rimraf=require(_0xce85('0x5'));var config=require(_0xce85('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xce85('0x7')]=function(_0x2965e7,_0x581c4a){return _0x2965e7[_0xce85('0x8')]('VoicePrefix',attributes,{'tableName':_0xce85('0x9'),'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 8518e41..e7d1561 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 _0xa723=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0xa723,0x185));var _0x3a72=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xa723[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require('lodash');var util=require(_0x3a72('0x0'));var moment=require(_0x3a72('0x1'));var BPromise=require(_0x3a72('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a72('0x3'));var db=require(_0x3a72('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a72('0x5'))(_0x3a72('0x6'));var config=require('../../config/environment');var jayson=require(_0x3a72('0x7'));var client=jayson[_0x3a72('0x8')][_0x3a72('0x9')]({'port':0x232a});config[_0x3a72('0xa')]=_[_0x3a72('0xb')](config[_0x3a72('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a72('0xc'))(new Redis(config[_0x3a72('0xa')]));require('./voicePrefix.socket')[_0x3a72('0xd')](socket);function respondWithRpcPromise(_0x1b658e,_0x2115e0,_0x5bdd86){return new BPromise(function(_0x896ad7,_0x1fd775){return client[_0x3a72('0xe')](_0x1b658e,_0x5bdd86)[_0x3a72('0xf')](function(_0x1557a1){logger[_0x3a72('0x10')](_0x3a72('0x11'),_0x2115e0,_0x3a72('0x12'));logger[_0x3a72('0x13')](_0x3a72('0x14'),_0x2115e0,_0x3a72('0x12'),JSON[_0x3a72('0x15')](_0x1557a1));if(_0x1557a1[_0x3a72('0x16')]){if(_0x1557a1[_0x3a72('0x16')][_0x3a72('0x17')]===0x1f4){logger[_0x3a72('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2115e0,_0x1557a1[_0x3a72('0x16')][_0x3a72('0x18')]);return _0x1fd775(_0x1557a1[_0x3a72('0x16')]['message']);}logger[_0x3a72('0x16')](_0x3a72('0x11'),_0x2115e0,_0x1557a1[_0x3a72('0x16')][_0x3a72('0x18')]);return _0x896ad7(_0x1557a1[_0x3a72('0x16')][_0x3a72('0x18')]);}else{logger[_0x3a72('0x10')](_0x3a72('0x11'),_0x2115e0,'request\x20sent');_0x896ad7(_0x1557a1[_0x3a72('0x19')]['message']);}})[_0x3a72('0x1a')](function(_0x534791){logger['error'](_0x3a72('0x11'),_0x2115e0,_0x534791);_0x1fd775(_0x534791);});});} \ No newline at end of file +var _0xacd6=['debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xacd6,0xef));var _0x6acd=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0xacd6[_0x49beea];return _0x27693a;};'use strict';var _=require(_0x6acd('0x0'));var util=require(_0x6acd('0x1'));var moment=require(_0x6acd('0x2'));var BPromise=require(_0x6acd('0x3'));var rs=require(_0x6acd('0x4'));var fs=require('fs');var Redis=require(_0x6acd('0x5'));var db=require(_0x6acd('0x6'))['db'];var utils=require(_0x6acd('0x7'));var logger=require(_0x6acd('0x8'))(_0x6acd('0x9'));var config=require(_0x6acd('0xa'));var jayson=require(_0x6acd('0xb'));var client=jayson['client'][_0x6acd('0xc')]({'port':0x232a});config[_0x6acd('0xd')]=_[_0x6acd('0xe')](config[_0x6acd('0xd')],{'host':_0x6acd('0xf'),'port':0x18eb});var socket=require(_0x6acd('0x10'))(new Redis(config[_0x6acd('0xd')]));require(_0x6acd('0x11'))['register'](socket);function respondWithRpcPromise(_0x35c08d,_0x20deb7,_0x211c33){return new BPromise(function(_0x3d827b,_0x1352cb){return client[_0x6acd('0x12')](_0x35c08d,_0x211c33)[_0x6acd('0x13')](function(_0x5670cc){logger['info'](_0x6acd('0x14'),_0x20deb7,_0x6acd('0x15'));logger[_0x6acd('0x16')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x20deb7,_0x6acd('0x15'),JSON[_0x6acd('0x17')](_0x5670cc));if(_0x5670cc[_0x6acd('0x18')]){if(_0x5670cc[_0x6acd('0x18')][_0x6acd('0x19')]===0x1f4){logger[_0x6acd('0x18')](_0x6acd('0x14'),_0x20deb7,_0x5670cc[_0x6acd('0x18')]['message']);return _0x1352cb(_0x5670cc[_0x6acd('0x18')][_0x6acd('0x1a')]);}logger[_0x6acd('0x18')](_0x6acd('0x14'),_0x20deb7,_0x5670cc[_0x6acd('0x18')]['message']);return _0x3d827b(_0x5670cc['error'][_0x6acd('0x1a')]);}else{logger[_0x6acd('0x1b')]('VoicePrefix,\x20%s,\x20%s',_0x20deb7,_0x6acd('0x15'));_0x3d827b(_0x5670cc['result'][_0x6acd('0x1a')]);}})[_0x6acd('0x1c')](function(_0x21192e){logger[_0x6acd('0x18')](_0x6acd('0x14'),_0x20deb7,_0x21192e);_0x1352cb(_0x21192e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4d0a9f3..79a3c0a 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 _0xa2db=['save','update','removeListener','length','./voicePrefix.events'];(function(_0x4f680c,_0x292aba){var _0x5326b2=function(_0xaccea0){while(--_0xaccea0){_0x4f680c['push'](_0x4f680c['shift']());}};_0x5326b2(++_0x292aba);}(_0xa2db,0x68));var _0xba2d=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0xa2db[_0x4e170e];return _0x338291;};'use strict';var VoicePrefixEvents=require(_0xba2d('0x0'));var events=[_0xba2d('0x1'),'remove',_0xba2d('0x2')];function createListener(_0x3558e6,_0x11d9a0){return function(_0x39670e){_0x11d9a0['emit'](_0x3558e6,_0x39670e);};}function removeListener(_0x1876e3,_0x443689){return function(){VoicePrefixEvents[_0xba2d('0x3')](_0x1876e3,_0x443689);};}exports['register']=function(_0x54a644){for(var _0x4726e1=0x0,_0x1e980d=events[_0xba2d('0x4')];_0x4726e1<_0x1e980d;_0x4726e1++){var _0x5ba730=events[_0x4726e1];var _0xb2c257=createListener('voicePrefix:'+_0x5ba730,_0x54a644);VoicePrefixEvents['on'](_0x5ba730,_0xb2c257);}}; \ No newline at end of file +var _0x7cfd=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0xacbd6,_0x13ad2c){var _0x23e7fb=function(_0x2147ec){while(--_0x2147ec){_0xacbd6['push'](_0xacbd6['shift']());}};_0x23e7fb(++_0x13ad2c);}(_0x7cfd,0x1a0));var _0xd7cf=function(_0x3624fc,_0x3250fe){_0x3624fc=_0x3624fc-0x0;var _0x51b4e0=_0x7cfd[_0x3624fc];return _0x51b4e0;};'use strict';var VoicePrefixEvents=require(_0xd7cf('0x0'));var events=[_0xd7cf('0x1'),_0xd7cf('0x2'),_0xd7cf('0x3')];function createListener(_0x51cfb6,_0x24f7c3){return function(_0x33c687){_0x24f7c3[_0xd7cf('0x4')](_0x51cfb6,_0x33c687);};}function removeListener(_0x275e1b,_0x35e7e6){return function(){VoicePrefixEvents[_0xd7cf('0x5')](_0x275e1b,_0x35e7e6);};}exports[_0xd7cf('0x6')]=function(_0x368dc5){for(var _0x39a614=0x0,_0x417948=events[_0xd7cf('0x7')];_0x39a614<_0x417948;_0x39a614++){var _0xd5a769=events[_0x39a614];var _0x489fad=createListener('voicePrefix:'+_0xd5a769,_0x368dc5);VoicePrefixEvents['on'](_0xd5a769,_0x489fad);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index db07d68..86fdb35 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 _0x7ce5=['../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','show','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addTeams','/:id/users','addAgents','addBlackLists','put','delete','/:id','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4a6fac,_0x398714){var _0x109bfa=function(_0x38cabd){while(--_0x38cabd){_0x4a6fac['push'](_0x4a6fac['shift']());}};_0x109bfa(++_0x398714);}(_0x7ce5,0x13b));var _0x57ce=function(_0x214b27,_0x1ccfc0){_0x214b27=_0x214b27-0x0;var _0x474de9=_0x7ce5[_0x214b27];return _0x474de9;};'use strict';var multer=require(_0x57ce('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x57ce('0x1'));var express=require(_0x57ce('0x2'));var router=express[_0x57ce('0x3')]();var auth=require(_0x57ce('0x4'));var interaction=require(_0x57ce('0x5'));var config=require(_0x57ce('0x6'));var controller=require(_0x57ce('0x7'));router[_0x57ce('0x8')]('/',auth[_0x57ce('0x9')](),controller[_0x57ce('0xa')]);router[_0x57ce('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x57ce('0xb')]);router[_0x57ce('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x57ce('0xc')]);router[_0x57ce('0x8')](_0x57ce('0xd'),auth[_0x57ce('0x9')](),controller['getHopperHistories']);router[_0x57ce('0x8')](_0x57ce('0xe'),auth[_0x57ce('0x9')](),controller[_0x57ce('0xf')]);router['get'](_0x57ce('0x10'),auth[_0x57ce('0x9')](),controller[_0x57ce('0x11')]);router[_0x57ce('0x8')](_0x57ce('0x12'),auth[_0x57ce('0x9')](),controller['getTeams']);router[_0x57ce('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x57ce('0x13')]);router[_0x57ce('0x8')](_0x57ce('0x14'),auth[_0x57ce('0x9')](),controller['getMembers']);router[_0x57ce('0x8')](_0x57ce('0x15'),auth['isAuthenticated'](),controller[_0x57ce('0x16')]);router[_0x57ce('0x8')](_0x57ce('0x17'),auth[_0x57ce('0x9')](),controller['getBlackLists']);router[_0x57ce('0x18')]('/',auth[_0x57ce('0x9')](),controller[_0x57ce('0x19')]);router[_0x57ce('0x18')](_0x57ce('0x1a'),auth[_0x57ce('0x9')](),controller['clone']);router[_0x57ce('0x18')](_0x57ce('0x12'),auth[_0x57ce('0x9')](),controller[_0x57ce('0x1b')]);router[_0x57ce('0x18')](_0x57ce('0x1c'),auth['isAuthenticated'](),controller[_0x57ce('0x1d')]);router['post'](_0x57ce('0x15'),auth[_0x57ce('0x9')](),controller['addLists']);router[_0x57ce('0x18')](_0x57ce('0x17'),auth[_0x57ce('0x9')](),controller[_0x57ce('0x1e')]);router[_0x57ce('0x1f')]('/:id',auth[_0x57ce('0x9')](),controller['update']);router[_0x57ce('0x20')](_0x57ce('0x21'),auth[_0x57ce('0x9')](),controller[_0x57ce('0x22')]);router[_0x57ce('0x20')](_0x57ce('0x12'),auth[_0x57ce('0x9')](),controller[_0x57ce('0x23')]);router[_0x57ce('0x20')](_0x57ce('0x1c'),auth['isAuthenticated'](),controller[_0x57ce('0x24')]);router[_0x57ce('0x20')](_0x57ce('0x15'),auth[_0x57ce('0x9')](),controller[_0x57ce('0x25')]);router['delete']('/:id/blacklists',auth[_0x57ce('0x9')](),controller[_0x57ce('0x26')]);module[_0x57ce('0x27')]=router; \ No newline at end of file +var _0xe6c0=['/:id/members','getMembers','/:id/blacklists','getBlackLists','post','create','clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6c0,0x1c1));var _0x0e6c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xe6c0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0e6c('0x0'));var util=require(_0x0e6c('0x1'));var path=require('path');var timeout=require(_0x0e6c('0x2'));var express=require(_0x0e6c('0x3'));var router=express['Router']();var auth=require(_0x0e6c('0x4'));var interaction=require(_0x0e6c('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0x0e6c('0x6')]('/',auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x8')]);router['get'](_0x0e6c('0x9'),auth[_0x0e6c('0x7')](),controller['show']);router[_0x0e6c('0x6')](_0x0e6c('0xa'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0xb')]);router['get'](_0x0e6c('0xc'),auth[_0x0e6c('0x7')](),controller['getHopperHistories']);router[_0x0e6c('0x6')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x0e6c('0xd')]);router[_0x0e6c('0x6')](_0x0e6c('0xe'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0xf')]);router[_0x0e6c('0x6')](_0x0e6c('0x10'),auth[_0x0e6c('0x7')](),controller['getTeams']);router[_0x0e6c('0x6')](_0x0e6c('0x11'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x12')]);router[_0x0e6c('0x6')](_0x0e6c('0x13'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x14')]);router['get']('/:id/lists',auth[_0x0e6c('0x7')](),controller['getLists']);router[_0x0e6c('0x6')](_0x0e6c('0x15'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x16')]);router[_0x0e6c('0x17')]('/',auth['isAuthenticated'](),controller[_0x0e6c('0x18')]);router[_0x0e6c('0x17')]('/:id/clone',auth['isAuthenticated'](),controller[_0x0e6c('0x19')]);router[_0x0e6c('0x17')](_0x0e6c('0x10'),auth['isAuthenticated'](),controller[_0x0e6c('0x1a')]);router[_0x0e6c('0x17')](_0x0e6c('0x11'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x1b')]);router[_0x0e6c('0x17')](_0x0e6c('0x1c'),auth['isAuthenticated'](),controller[_0x0e6c('0x1d')]);router[_0x0e6c('0x17')](_0x0e6c('0x15'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x1e')]);router[_0x0e6c('0x1f')](_0x0e6c('0x9'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x20')]);router[_0x0e6c('0x21')]('/:id',auth[_0x0e6c('0x7')](),controller['destroy']);router[_0x0e6c('0x21')](_0x0e6c('0x10'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x22')]);router['delete']('/:id/users',auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x23')]);router['delete'](_0x0e6c('0x1c'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x24')]);router[_0x0e6c('0x21')](_0x0e6c('0x15'),auth[_0x0e6c('0x7')](),controller[_0x0e6c('0x25')]);module[_0x0e6c('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 87bb754..ae2b068 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 _0x0038=['always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','outbound','inbound','STRING','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','dialMethod','booked','roundrobin','progressive','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*'];(function(_0x189af7,_0x42e7ed){var _0x483af6=function(_0xf20bed){while(--_0xf20bed){_0x189af7['push'](_0x189af7['shift']());}};_0x483af6(++_0x42e7ed);}(_0x0038,0x12e));var _0x8003=function(_0x5cb029,_0x38443b){_0x5cb029=_0x5cb029-0x0;var _0x373052=_0x0038[_0x5cb029];return _0x373052;};'use strict';var Sequelize=require(_0x8003('0x0'));module[_0x8003('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8003('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8003('0x3')]('inbound',_0x8003('0x4')),'allowNull':![],'defaultValue':_0x8003('0x5')},'musiconhold':{'type':Sequelize[_0x8003('0x6')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x8003('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8003('0x3')]('rr',_0x8003('0x7'),_0x8003('0x8'),_0x8003('0x9'),'random',_0x8003('0xa'),_0x8003('0xb'),_0x8003('0xc'),_0x8003('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x2622e7){this[_0x8003('0xe')](_0x8003('0xf'),_0x2622e7?_0x2622e7:'rrmemory');},'get':function(){var _0x437217=this['getDataValue'](_0x8003('0x10'));var _0x1b791e=this[_0x8003('0x11')](_0x8003('0x12'));var _0x19d684=this['getDataValue'](_0x8003('0xf'));if(_0x437217===_0x8003('0x5')){return _0x19d684;}if(_0x1b791e===_0x8003('0x13')&&_0x19d684==='rrmemory'||_0x1b791e===_0x8003('0x13')&&_0x19d684===_0x8003('0x14')){return _0x19d684;}if(_0x1b791e===_0x8003('0x15')||_0x1b791e==='predictive'||_0x1b791e==='power'){return _0x19d684;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8003('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8003('0x6')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8003('0x3')](_0x8003('0x17'),'no'),'defaultValue':_0x8003('0x17')},'autopause':{'type':Sequelize[_0x8003('0x3')](_0x8003('0x17'),'no',_0x8003('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8003('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x8003('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8003('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8003('0x3')](_0x8003('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x8003('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x8003('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8003('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x8003('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8003('0x3')](_0x8003('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x8003('0x3')](_0x8003('0x17'),'no',_0x8003('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8003('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x8003('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x8003('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8003('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8003('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8003('0x6')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8003('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8003('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8003('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8003('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8003('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8003('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8003('0x6')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x8003('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x8003('0x6')]},'queue_less_than':{'type':Sequelize[_0x8003('0x6')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2dc118){this['setDataValue']('periodic_announce',_0x2dc118?_0x2dc118[_0x8003('0x1a')](','):[]);},'get':function(){return this[_0x8003('0x11')](_0x8003('0x1b'))?this[_0x8003('0x11')]('periodic_announce')[_0x8003('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x8003('0x6')],'defaultValue':'yes','set':function(_0x1c4337){this[_0x8003('0xe')](_0x8003('0x1d'),_0x1c4337?_0x1c4337[_0x8003('0x1a')](','):[]);},'get':function(){return this[_0x8003('0x11')]('joinempty')?this[_0x8003('0x11')](_0x8003('0x1d'))[_0x8003('0x1c')](','):[];}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x2402e2){this['setDataValue']('leavewhenempty',_0x2402e2?_0x2402e2[_0x8003('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0x8003('0x1e'))?this[_0x8003('0x11')](_0x8003('0x1e'))[_0x8003('0x1c')](','):[];}},'reportholdtime':{'type':Sequelize['ENUM'](_0x8003('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8003('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8003('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8003('0x6')]},'description':{'type':Sequelize[_0x8003('0x6')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4a7d38){this[_0x8003('0xe')]('acw',_0x4a7d38);if(_0x4a7d38){if(this[_0x8003('0x11')](_0x8003('0x1f'))<0x2){this[_0x8003('0xe')](_0x8003('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8003('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8003('0x20')],'defaultValue':0x0,'comment':_0x8003('0x21')},'dialMethod':{'type':Sequelize['ENUM']('preview','progressive','power','predictive',_0x8003('0x13')),'defaultValue':'progressive','comment':_0x8003('0x22')},'dialLimitChannel':{'type':Sequelize[_0x8003('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8003('0x23')},'dialLimitQueue':{'type':Sequelize[_0x8003('0x16')](0x4)[_0x8003('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8003('0x25')},'dialPowerLevel':{'type':Sequelize[_0x8003('0x26')](0x2)[_0x8003('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8003('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x8003('0x3')]('agentBusyFactor','dropRate'),'defaultValue':_0x8003('0x28'),'comment':_0x8003('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8003('0x26')](0x2)[_0x8003('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8003('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x8003('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x8003('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x8003('0x16')](0x3)[_0x8003('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8003('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x8003('0x6')],'defaultValue':_0x8003('0x2c'),'comment':_0x8003('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x8003('0x16')](0x3)[_0x8003('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8003('0x2e')},'dialQueueProject':{'type':Sequelize[_0x8003('0x6')],'comment':_0x8003('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8003('0x16')](0x3)[_0x8003('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8003('0x16')](0x5)[_0x8003('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8003('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8003('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8003('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8003('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8003('0x16')](0x3)[_0x8003('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8003('0x16')](0x5)[_0x8003('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8003('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8003('0x16')](0x3)[_0x8003('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8003('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8003('0x6')],'defaultValue':_0x8003('0x34')},'dialPrefix':{'type':Sequelize[_0x8003('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8003('0x3')](_0x8003('0x35'),_0x8003('0x36'),_0x8003('0x37')),'defaultValue':_0x8003('0x35')},'dialAMDActive':{'type':Sequelize[_0x8003('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8003('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8003('0x38')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x8003('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8003('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8003('0x16')](0x9)[_0x8003('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8003('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8003('0x16')](0x9)[_0x8003('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8003('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x8003('0x16')](0x9)[_0x8003('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8003('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8003('0x16')](0x9)[_0x8003('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8003('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8003('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8003('0x16')](0x5)[_0x8003('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8003('0x16')](0x9)[_0x8003('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x8003('0x16')](0x5)[_0x8003('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8003('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0x8003('0x20')],'defaultValue':0x0,'comment':_0x8003('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x8003('0x40'),_0x8003('0x41')),'defaultValue':_0x8003('0x40')},'dialQueueProject2':{'type':Sequelize[_0x8003('0x6')],'comment':_0x8003('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8003('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8003('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8003('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8003('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8003('0x16')],'allowNull':!![],'comment':_0x8003('0x43')},'mandatoryDisposition':{'type':Sequelize[_0x8003('0x20')],'defaultValue':![],'comment':_0x8003('0x44'),'set':function(_0x3453e0){if(!_0x3453e0)this[_0x8003('0xe')](_0x8003('0x45'),null);this[_0x8003('0xe')](_0x8003('0x46'),_0x3453e0);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8003('0x16')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8003('0x16')](0x3)[_0x8003('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x9f9c=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','type','getDataValue','dialMethod','strategy','roundrobin','progressive','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','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\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x9f9c,0x1d6));var _0xc9f9=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9f9c[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xc9f9('0x0'));module[_0xc9f9('0x1')]={'name':{'type':Sequelize[_0xc9f9('0x2')],'allowNull':![],'unique':_0xc9f9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc9f9('0x4')](_0xc9f9('0x5'),'outbound'),'allowNull':![],'defaultValue':_0xc9f9('0x5')},'musiconhold':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':_0xc9f9('0x6')},'announce':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0xc9f9('0x7'),_0xc9f9('0x8'),'random',_0xc9f9('0x9'),_0xc9f9('0xa'),_0xc9f9('0xb'),_0xc9f9('0xc')),'allowNull':![],'defaultValue':_0xc9f9('0xd'),'set':function(_0x7438b1){this[_0xc9f9('0xe')]('strategy',_0x7438b1?_0x7438b1:_0xc9f9('0x9'));},'get':function(){var _0x36cd1f=this['getDataValue'](_0xc9f9('0xf'));var _0x2f9a5d=this[_0xc9f9('0x10')](_0xc9f9('0x11'));var _0x5d22b2=this['getDataValue'](_0xc9f9('0x12'));if(_0x36cd1f===_0xc9f9('0x5')){return _0x5d22b2;}if(_0x2f9a5d==='booked'&&_0x5d22b2==='rrmemory'||_0x2f9a5d==='booked'&&_0x5d22b2===_0xc9f9('0x13')){return _0x5d22b2;}if(_0x2f9a5d===_0xc9f9('0x14')||_0x2f9a5d===_0xc9f9('0x15')||_0x2f9a5d===_0xc9f9('0x16')){return _0x5d22b2;}return null;}},'servicelevel':{'type':Sequelize[_0xc9f9('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc9f9('0x17')](0xb)},'timeout':{'type':Sequelize[_0xc9f9('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc9f9('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc9f9('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc9f9('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc9f9('0x4')](_0xc9f9('0x18'),'no'),'defaultValue':_0xc9f9('0x18')},'autopause':{'type':Sequelize[_0xc9f9('0x4')]('yes','no',_0xc9f9('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xc9f9('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc9f9('0x4')](_0xc9f9('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc9f9('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xc9f9('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc9f9('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc9f9('0x4')](_0xc9f9('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc9f9('0x4')](_0xc9f9('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc9f9('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc9f9('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc9f9('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc9f9('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xc9f9('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xc9f9('0x18'),'no'),'defaultValue':_0xc9f9('0x18')},'announce_holdtime':{'type':Sequelize[_0xc9f9('0x4')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc9f9('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xc9f9('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc9f9('0x2')]},'queue_youarenext':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc9f9('0x2')]},'queue_quantity1':{'type':Sequelize[_0xc9f9('0x2')]},'queue_quantity2':{'type':Sequelize[_0xc9f9('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xc9f9('0x2')]},'queue_less_than':{'type':Sequelize[_0xc9f9('0x2')]},'periodic_announce':{'type':Sequelize[_0xc9f9('0x1a')],'set':function(_0x24e5b4){this['setDataValue'](_0xc9f9('0x1b'),_0x24e5b4?_0x24e5b4[_0xc9f9('0x1c')](','):[]);},'get':function(){return this[_0xc9f9('0x10')](_0xc9f9('0x1b'))?this[_0xc9f9('0x10')](_0xc9f9('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':'yes','set':function(_0x56e625){this[_0xc9f9('0xe')](_0xc9f9('0x1d'),_0x56e625?_0x56e625['join'](','):[]);},'get':function(){return this[_0xc9f9('0x10')](_0xc9f9('0x1d'))?this[_0xc9f9('0x10')](_0xc9f9('0x1d'))[_0xc9f9('0x1e')](','):[];}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1b1f11){this[_0xc9f9('0xe')]('leavewhenempty',_0x1b1f11?_0x1b1f11[_0xc9f9('0x1c')](','):[]);},'get':function(){return this[_0xc9f9('0x10')](_0xc9f9('0x1f'))?this['getDataValue']('leavewhenempty')['split'](','):[];}},'reportholdtime':{'type':Sequelize[_0xc9f9('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc9f9('0x4')](_0xc9f9('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc9f9('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc9f9('0x4')](_0xc9f9('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc9f9('0x2')]},'acw':{'type':Sequelize[_0xc9f9('0x20')],'defaultValue':0x0,'set':function(_0x529689){this[_0xc9f9('0xe')](_0xc9f9('0x21'),_0x529689);if(_0x529689){if(this[_0xc9f9('0x10')]('wrapuptime')<0x2){this[_0xc9f9('0xe')](_0xc9f9('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xc9f9('0x4')]('preview',_0xc9f9('0x14'),_0xc9f9('0x16'),_0xc9f9('0x15'),'booked'),'defaultValue':_0xc9f9('0x14'),'comment':_0xc9f9('0x23')},'dialLimitChannel':{'type':Sequelize[_0xc9f9('0x17')](0x4)[_0xc9f9('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc9f9('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xc9f9('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc9f9('0x26')},'dialPowerLevel':{'type':Sequelize[_0xc9f9('0x27')](0x2)[_0xc9f9('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc9f9('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xc9f9('0x29'),_0xc9f9('0x2a')),'defaultValue':_0xc9f9('0x2a'),'comment':_0xc9f9('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xc9f9('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc9f9('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xc9f9('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc9f9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc9f9('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc9f9('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9f9('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':_0xc9f9('0x2e'),'comment':_0xc9f9('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xc9f9('0x17')](0x3)[_0xc9f9('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9f9('0x30')},'dialQueueProject':{'type':Sequelize[_0xc9f9('0x2')],'comment':_0xc9f9('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc9f9('0x17')](0x3)[_0xc9f9('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9f9('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc9f9('0x17')](0x5)[_0xc9f9('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9f9('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xc9f9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9f9('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc9f9('0x17')](0x5)[_0xc9f9('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc9f9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc9f9('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc9f9('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9f9('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc9f9('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc9f9('0x37')},'dialTimezone':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc9f9('0x2')],'defaultValue':_0xc9f9('0x38')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc9f9('0x4')]('always','never',_0xc9f9('0x39')),'defaultValue':_0xc9f9('0x3a')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc9f9('0x17')](0x9)[_0xc9f9('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc9f9('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0xc9f9('0x17')](0x9)[_0xc9f9('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc9f9('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc9f9('0x17')](0x9)[_0xc9f9('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc9f9('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc9f9('0x17')](0x9)[_0xc9f9('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc9f9('0x17')](0x9)[_0xc9f9('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc9f9('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc9f9('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc9f9('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc9f9('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc9f9('0x17')](0x5)[_0xc9f9('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc9f9('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc9f9('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc9f9('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xc9f9('0x17')](0x5)[_0xc9f9('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc9f9('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xc9f9('0x20')],'defaultValue':0x0,'comment':_0xc9f9('0x43')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0xc9f9('0x44')},'dialQueueProject2':{'type':Sequelize[_0xc9f9('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc9f9('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc9f9('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc9f9('0x17')](0x3)[_0xc9f9('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc9f9('0x45')},'dialCutDigit':{'type':Sequelize[_0xc9f9('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc9f9('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc9f9('0x17')],'allowNull':!![],'comment':_0xc9f9('0x47')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc9f9('0x48'),'set':function(_0x4d1db1){if(!_0x4d1db1)this[_0xc9f9('0xe')](_0xc9f9('0x49'),null);this[_0xc9f9('0xe')](_0xc9f9('0x4a'),_0x4d1db1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc9f9('0x17')](0x3)[_0xc9f9('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc9f9('0x17')](0x3)[_0xc9f9('0x24')],'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 bb103d7..b3e1090 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 _0x362a=['insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','fromQuery','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','index','VoiceQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','merge','options','includeAll','include','findAll','rows','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','role','inbound','userProfileId','autoAssociation','CmHopper','pick','CmHopperHistory','VoiceQueueId','findOne','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','format','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','union','transaction','isEmpty','removeAgents','addAgents','spread','SIP/%s','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType'];(function(_0x290844,_0x366077){var _0x546847=function(_0x4ea65e){while(--_0x4ea65e){_0x290844['push'](_0x290844['shift']());}};_0x546847(++_0x366077);}(_0x362a,0xc8));var _0xa362=function(_0x5ee3e1,_0x3bcd2e){_0x5ee3e1=_0x5ee3e1-0x0;var _0x2bfc83=_0x362a[_0x5ee3e1];return _0x2bfc83;};'use strict';var pdf=require(_0xa362('0x0'));var emlformat=require(_0xa362('0x1'));var rimraf=require(_0xa362('0x2'));var zipdir=require(_0xa362('0x3'));var jsonpatch=require(_0xa362('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa362('0x5'));var util=require(_0xa362('0x6'));var path=require(_0xa362('0x7'));var sox=require(_0xa362('0x8'));var csv=require(_0xa362('0x9'));var ejs=require(_0xa362('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa362('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa362('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa362('0xd'));var Papa=require(_0xa362('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa362('0xf'));var hardwareService=require(_0xa362('0x10'));var logger=require('../../config/logger')(_0xa362('0x11'));var utils=require(_0xa362('0x12'));var config=require(_0xa362('0x13'));var db=require(_0xa362('0x14'))['db'];config[_0xa362('0x15')]=_[_0xa362('0x16')](config[_0xa362('0x15')],{'host':_0xa362('0x17'),'port':0x18eb});var socket=require(_0xa362('0x18'))(new Redis(config[_0xa362('0x15')]));require(_0xa362('0x19'))[_0xa362('0x1a')](socket);function respondWithStatusCode(_0x514e54,_0x28dccb){_0x28dccb=_0x28dccb||0xcc;return function(_0x3ef320){if(_0x3ef320){return _0x514e54[_0xa362('0x1b')](_0x28dccb);}return _0x514e54[_0xa362('0x1c')](_0x28dccb)[_0xa362('0x1d')]();};}function respondWithResult(_0x4cd5d,_0xdcf81c){_0xdcf81c=_0xdcf81c||0xc8;return function(_0x3a1325){if(_0x3a1325){return _0x4cd5d['status'](_0xdcf81c)['json'](_0x3a1325);}};}function respondWithFilteredResult(_0x135b28,_0xeea2db){return function(_0x559152){if(_0x559152){var _0x3c9741=_0x559152[_0xa362('0x1e')],_0x45f118=_0xeea2db[_0xa362('0x1f')],_0x265fdc=_0xeea2db[_0xa362('0x1f')]+_0xeea2db[_0xa362('0x20')],_0x260855;if(_0x265fdc>=_0x3c9741){_0x265fdc=_0x3c9741;_0x260855=0xc8;}else{_0x260855=0xce;}_0x135b28['status'](_0x260855);return _0x135b28[_0xa362('0x21')](_0xa362('0x22'),_0x45f118+'-'+_0x265fdc+'/'+_0x3c9741)[_0xa362('0x23')](_0x559152);}return null;};}function patchUpdates(_0x45087d){return function(_0x3d402d){try{jsonpatch[_0xa362('0x24')](_0x3d402d,_0x45087d,!![]);}catch(_0x1cb041){return BPromise[_0xa362('0x25')](_0x1cb041);}return _0x3d402d[_0xa362('0x26')]();};}function saveUpdates(_0x5c0e48,_0x50388e){return function(_0x2353fc){if(_0x2353fc){return _0x2353fc[_0xa362('0x27')](_0x5c0e48)[_0xa362('0x28')](function(_0x102a66){return _0x102a66;});}return null;};}function removeEntity(_0x14d8f3,_0x531ae6){return function(_0xb98b58){if(_0xb98b58){return _0xb98b58[_0xa362('0x29')]()[_0xa362('0x28')](function(){var _0x2bdaa4=_0xb98b58[_0xa362('0x2a')]({'plain':!![]});var _0x260771=[{'name':_0xa362('0x2b'),'value':'inbound','ignore':![]},{'name':_0xa362('0x2c'),'value':_0xa362('0x2d'),'ignore':![]}];var _0x115a90=_(_0x260771)[_0xa362('0x2e')](_0xa362('0x2f'))[_0xa362('0x30')](_0xa362('0x31'))[_0xa362('0x31')]();if(_[_0xa362('0x32')](_0x115a90,_0x2bdaa4[_0xa362('0x33')])){return;}var _0x1f122c=_[_0xa362('0x34')](_0x260771,[_0xa362('0x31'),_0x2bdaa4[_0xa362('0x33')]])['name'];return db[_0xa362('0x35')][_0xa362('0x29')]({'where':{'type':_0x1f122c,'resourceId':_0x2bdaa4['id']}})[_0xa362('0x28')](function(){return _0xb98b58;});})[_0xa362('0x28')](function(){_0x14d8f3['status'](0xcc)[_0xa362('0x1d')]();});}};}function handleEntityNotFound(_0xc0cabf,_0x3b41d6){return function(_0x5e7008){if(!_0x5e7008){_0xc0cabf['sendStatus'](0x194);}return _0x5e7008;};}function handleError(_0x1f8525,_0x484b6e){_0x484b6e=_0x484b6e||0x1f4;return function(_0x3f6e81){logger[_0xa362('0x36')](_0x3f6e81[_0xa362('0x37')]);if(_0x3f6e81[_0xa362('0x38')]){delete _0x3f6e81[_0xa362('0x38')];}_0x1f8525['status'](_0x484b6e)['send'](_0x3f6e81);};}exports[_0xa362('0x39')]=function(_0x12f253,_0x2d1732){var _0xef8a6d={},_0x352f65={},_0x292baf={'count':0x0,'rows':[]};var _0x2da7b6=db[_0xa362('0x3a')][_0xa362('0x3b')];_0x352f65[_0xa362('0x3c')]=_['keys'](_0x2da7b6);_0x352f65[_0xa362('0x3d')]=_[_0xa362('0x3e')](_0x12f253[_0xa362('0x3d')]);_0x352f65[_0xa362('0x3f')]=_[_0xa362('0x40')](_0x352f65[_0xa362('0x3c')],_0x352f65['query']);_0xef8a6d[_0xa362('0x41')]=_[_0xa362('0x40')](_0x352f65[_0xa362('0x3c')],qs[_0xa362('0x42')](_0x12f253[_0xa362('0x3d')][_0xa362('0x42')]));_0xef8a6d[_0xa362('0x41')]=_0xef8a6d[_0xa362('0x41')][_0xa362('0x43')]?_0xef8a6d[_0xa362('0x41')]:_0x352f65[_0xa362('0x3c')];if(!_0x12f253[_0xa362('0x3d')][_0xa362('0x44')](_0xa362('0x45'))){_0xef8a6d['limit']=qs[_0xa362('0x20')](_0x12f253[_0xa362('0x3d')][_0xa362('0x20')]);_0xef8a6d['offset']=qs[_0xa362('0x1f')](_0x12f253[_0xa362('0x3d')][_0xa362('0x1f')]);}_0xef8a6d[_0xa362('0x46')]=qs[_0xa362('0x47')](_0x12f253['query'][_0xa362('0x47')]);_0xef8a6d[_0xa362('0x48')]=qs[_0xa362('0x3f')](_['pick'](_0x12f253[_0xa362('0x3d')],_0x352f65[_0xa362('0x3f')]));if(_0x12f253[_0xa362('0x3d')][_0xa362('0x2e')]){_0xef8a6d[_0xa362('0x48')]=_['merge'](_0xef8a6d['where'],{'$or':_[_0xa362('0x30')](_0x2da7b6,function(_0x20ad15){if(_0x20ad15[_0xa362('0x33')]['key']!=='VIRTUAL'){var _0x1afdeb={};_0x1afdeb[_0x20ad15[_0xa362('0x49')]]={'$like':'%'+_0x12f253['query'][_0xa362('0x2e')]+'%'};return _0x1afdeb;}})});}_0xef8a6d=_[_0xa362('0x4a')]({},_0xef8a6d,_0x12f253[_0xa362('0x4b')]);var _0x36adc1={'where':_0xef8a6d['where']};return db['VoiceQueue'][_0xa362('0x1e')](_0x36adc1)['then'](function(_0x38815d){_0x292baf[_0xa362('0x1e')]=_0x38815d;if(_0x12f253[_0xa362('0x3d')][_0xa362('0x4c')]){_0xef8a6d[_0xa362('0x4d')]=[{'all':!![]}];}return db[_0xa362('0x3a')][_0xa362('0x4e')](_0xef8a6d);})[_0xa362('0x28')](function(_0x17b367){_0x292baf[_0xa362('0x4f')]=_0x17b367;return _0x292baf;})[_0xa362('0x28')](respondWithFilteredResult(_0x2d1732,_0xef8a6d))['catch'](handleError(_0x2d1732,null));};exports[_0xa362('0x50')]=function(_0x2a0da4,_0x8887f0){var _0x8d71da={'raw':![],'where':{'id':_0x2a0da4[_0xa362('0x51')]['id']}},_0x26f1d3={};_0x26f1d3[_0xa362('0x3c')]=_[_0xa362('0x3e')](db['VoiceQueue'][_0xa362('0x3b')]);_0x26f1d3[_0xa362('0x3d')]=_['keys'](_0x2a0da4['query']);_0x26f1d3[_0xa362('0x3f')]=_['intersection'](_0x26f1d3[_0xa362('0x3c')],_0x26f1d3[_0xa362('0x3d')]);_0x8d71da[_0xa362('0x41')]=_['intersection'](_0x26f1d3[_0xa362('0x3c')],qs[_0xa362('0x42')](_0x2a0da4[_0xa362('0x3d')]['fields']));_0x8d71da[_0xa362('0x41')]=_0x8d71da[_0xa362('0x41')][_0xa362('0x43')]?_0x8d71da[_0xa362('0x41')]:_0x26f1d3[_0xa362('0x3c')];if(_0x2a0da4['query'][_0xa362('0x4c')]){_0x8d71da[_0xa362('0x4d')]=[{'all':!![]}];}_0x8d71da=_['merge']({},_0x8d71da,_0x2a0da4[_0xa362('0x4b')]);return db[_0xa362('0x3a')][_0xa362('0x34')](_0x8d71da)[_0xa362('0x28')](handleEntityNotFound(_0x8887f0,null))['then'](respondWithResult(_0x8887f0,null))[_0xa362('0x52')](handleError(_0x8887f0,null));};exports[_0xa362('0x53')]=function(_0x48ebd3,_0xdd8262){return db[_0xa362('0x3a')]['create'](_0x48ebd3['body'],{})[_0xa362('0x28')](function(_0xf84555){var _0x509b8a=_0x48ebd3[_0xa362('0x54')][_0xa362('0x2a')]({'plain':!![]});if(!_0x509b8a)throw new Error(_0xa362('0x55'));if(_0x509b8a['role']===_0xa362('0x54')){var _0x13d3b8=_0xf84555[_0xa362('0x2a')]({'plain':!![]});var _0x4340d2=[{'name':_0xa362('0x2b'),'value':'inbound'},{'name':_0xa362('0x2c'),'value':_0xa362('0x2d')}];var _0x20608e=_[_0xa362('0x34')](_0x4340d2,[_0xa362('0x31'),_0x13d3b8[_0xa362('0x33')]])[_0xa362('0x38')];return db[_0xa362('0x56')]['find']({'where':{'name':_0x20608e,'userProfileId':_0x509b8a['userProfileId']},'raw':!![]})[_0xa362('0x28')](function(_0x45b410){if(_0x45b410&&_0x45b410['autoAssociation']===0x0){return db['UserProfileResource'][_0xa362('0x53')]({'name':_0x13d3b8[_0xa362('0x38')],'resourceId':_0x13d3b8['id'],'type':_0x45b410['name'],'sectionId':_0x45b410['id']},{})['then'](function(){return _0xf84555;});}else{return _0xf84555;}})['catch'](function(_0x4f4fa5){logger[_0xa362('0x36')](_0xa362('0x57'),_0x4f4fa5);throw _0x4f4fa5;});}return _0xf84555;})[_0xa362('0x28')](respondWithResult(_0xdd8262,0xc9))[_0xa362('0x52')](handleError(_0xdd8262,null));};exports[_0xa362('0x58')]=function(_0x23f25c,_0x114129){var _0x3427a4={'raw':![],'where':{'id':_0x23f25c['params']['id']}},_0x5411c7={};_0x5411c7[_0xa362('0x3c')]=_[_0xa362('0x3e')](db['VoiceQueue'][_0xa362('0x3b')]);_0x3427a4[_0xa362('0x41')]=_[_0xa362('0x40')](_0x5411c7[_0xa362('0x3c')],qs['fields'](_0x23f25c[_0xa362('0x3d')][_0xa362('0x42')]));_0x3427a4[_0xa362('0x41')]=_0x3427a4[_0xa362('0x41')][_0xa362('0x43')]?_0x3427a4[_0xa362('0x41')]:_0x5411c7['model'];if(_0x23f25c[_0xa362('0x3d')][_0xa362('0x4c')]){_0x3427a4[_0xa362('0x4d')]=[{'all':!![]}];}_0x3427a4=_[_0xa362('0x4a')]({},_0x3427a4,_0x23f25c[_0xa362('0x4b')]);return db[_0xa362('0x3a')][_0xa362('0x34')](_0x3427a4)[_0xa362('0x28')](handleEntityNotFound(_0x114129,null))[_0xa362('0x28')](function(_0xb47256){if(_0xb47256){var _0x573754=_0xb47256[_0xa362('0x2a')]({'plain':!![]});_0x573754=qs[_0xa362('0x59')](_0x573754,['id',_0xa362('0x5a'),'updatedAt']);_0x23f25c[_0xa362('0x5b')]=_[_0xa362('0x59')](_0x23f25c[_0xa362('0x5b')],['id',_0xa362('0x5a'),_0xa362('0x5c')]);return db[_0xa362('0x3a')][_0xa362('0x53')](_[_0xa362('0x4a')](_0x573754,_0x23f25c[_0xa362('0x5b')]),{'include':_0x23f25c[_0xa362('0x3d')][_0xa362('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x20eb7a){var _0x4ba8df=_0x23f25c[_0xa362('0x54')][_0xa362('0x2a')]({'plain':!![]});if(!_0x4ba8df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ba8df[_0xa362('0x5d')]===_0xa362('0x54')){var _0x1b87e2=_0x20eb7a[_0xa362('0x2a')]({'plain':!![]});var _0x3b0246=[{'name':_0xa362('0x2b'),'value':_0xa362('0x5e')},{'name':_0xa362('0x2c'),'value':_0xa362('0x2d')}];var _0x713afa=_['find'](_0x3b0246,['value',_0x1b87e2['type']])[_0xa362('0x38')];return db[_0xa362('0x56')][_0xa362('0x34')]({'where':{'name':_0x713afa,'userProfileId':_0x4ba8df[_0xa362('0x5f')]},'raw':!![]})[_0xa362('0x28')](function(_0x3a57a3){if(_0x3a57a3&&_0x3a57a3[_0xa362('0x60')]===0x0){return db[_0xa362('0x35')][_0xa362('0x53')]({'name':_0x1b87e2['name'],'resourceId':_0x1b87e2['id'],'type':_0x3a57a3[_0xa362('0x38')],'sectionId':_0x3a57a3['id']},{})['then'](function(){return _0x20eb7a;});}else{return _0x20eb7a;}})['catch'](function(_0x21e507){logger[_0xa362('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21e507);throw _0x21e507;});}return _0x20eb7a;});}})[_0xa362('0x28')](respondWithResult(_0x114129,0xc9))[_0xa362('0x52')](handleError(_0x114129,null));};exports['update']=function(_0x5a8a0b,_0x3bb719){if(_0x5a8a0b[_0xa362('0x5b')]['id']){delete _0x5a8a0b['body']['id'];}return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x5a8a0b['params']['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x3bb719,null))[_0xa362('0x28')](saveUpdates(_0x5a8a0b[_0xa362('0x5b')],null))[_0xa362('0x28')](respondWithResult(_0x3bb719,null))[_0xa362('0x52')](handleError(_0x3bb719,null));};exports[_0xa362('0x29')]=function(_0x56eab5,_0x2568d7){return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x56eab5[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x2568d7,null))[_0xa362('0x28')](removeEntity(_0x2568d7,null))['catch'](handleError(_0x2568d7,null));};exports['getHoppers']=function(_0x20e3d3,_0x16f772,_0xe92599){var _0x250998={'raw':![],'where':{}};var _0x63d306={};var _0x140540={'count':0x0,'rows':[]};return db[_0xa362('0x3a')]['findOne']({'where':{'id':_0x20e3d3[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x16f772,null))[_0xa362('0x28')](function(_0x25a28a){if(_0x25a28a){_0x63d306[_0xa362('0x3c')]=_[_0xa362('0x3e')](db[_0xa362('0x61')][_0xa362('0x3b')]);_0x63d306[_0xa362('0x3d')]=_[_0xa362('0x3e')](_0x20e3d3['query']);_0x63d306['filters']=_['intersection'](_0x63d306[_0xa362('0x3c')],_0x63d306[_0xa362('0x3d')]);_0x250998[_0xa362('0x41')]=_[_0xa362('0x40')](_0x63d306['model'],qs[_0xa362('0x42')](_0x20e3d3[_0xa362('0x3d')]['fields']));_0x250998[_0xa362('0x41')]=_0x250998[_0xa362('0x41')][_0xa362('0x43')]?_0x250998[_0xa362('0x41')]:_0x63d306[_0xa362('0x3c')];if(!_0x20e3d3['query']['hasOwnProperty'](_0xa362('0x45'))){_0x250998[_0xa362('0x20')]=qs[_0xa362('0x20')](_0x20e3d3[_0xa362('0x3d')][_0xa362('0x20')]);_0x250998[_0xa362('0x1f')]=qs[_0xa362('0x1f')](_0x20e3d3['query'][_0xa362('0x1f')]);}_0x250998[_0xa362('0x46')]=qs[_0xa362('0x47')](_0x20e3d3[_0xa362('0x3d')][_0xa362('0x47')]);_0x250998[_0xa362('0x48')]=qs['filters'](_[_0xa362('0x62')](_0x20e3d3['query'],_0x63d306[_0xa362('0x3f')]));_0x250998['where']['VoiceQueueId']=_0x25a28a['id'];if(_0x20e3d3[_0xa362('0x3d')][_0xa362('0x2e')]){_0x250998['where']=_[_0xa362('0x4a')](_0x250998[_0xa362('0x48')],{'$or':_[_0xa362('0x30')](_0x250998[_0xa362('0x41')],function(_0x2fba16){var _0x10ec71={};_0x10ec71[_0x2fba16]={'$like':'%'+_0x20e3d3[_0xa362('0x3d')][_0xa362('0x2e')]+'%'};return _0x10ec71;})});}_0x250998=_[_0xa362('0x4a')]({},_0x250998,_0x20e3d3[_0xa362('0x4b')]);return db['CmHopper'][_0xa362('0x1e')]({'where':_0x250998[_0xa362('0x48')]})['then'](function(_0x2d9bef){_0x140540[_0xa362('0x1e')]=_0x2d9bef;if(_0x20e3d3['query'][_0xa362('0x4c')]){_0x250998[_0xa362('0x4d')]=[{'all':!![]}];}return db[_0xa362('0x61')][_0xa362('0x4e')](_0x250998);})[_0xa362('0x28')](function(_0x3d9841){_0x140540[_0xa362('0x4f')]=_0x3d9841;return _0x140540;});}})[_0xa362('0x28')](respondWithFilteredResult(_0x16f772,_0x250998))[_0xa362('0x52')](handleError(_0x16f772,null));};exports['getHopperHistories']=function(_0x338239,_0xb8dcf9,_0xac7c0d){var _0x5dd8d5={'raw':!![],'where':{}};var _0x49eb3e={};var _0xb81c22={'count':0x0,'rows':[]};return db[_0xa362('0x3a')]['findOne']({'where':{'id':_0x338239['params']['id']}})[_0xa362('0x28')](handleEntityNotFound(_0xb8dcf9,null))['then'](function(_0xdd2d0c){if(_0xdd2d0c){_0x49eb3e[_0xa362('0x3c')]=_[_0xa362('0x3e')](db[_0xa362('0x63')]['rawAttributes']);_0x49eb3e['query']=_[_0xa362('0x3e')](_0x338239[_0xa362('0x3d')]);_0x49eb3e['filters']=_['intersection'](_0x49eb3e[_0xa362('0x3c')],_0x49eb3e[_0xa362('0x3d')]);_0x5dd8d5[_0xa362('0x41')]=_[_0xa362('0x40')](_0x49eb3e[_0xa362('0x3c')],qs[_0xa362('0x42')](_0x338239[_0xa362('0x3d')][_0xa362('0x42')]));_0x5dd8d5['attributes']=_0x5dd8d5[_0xa362('0x41')]['length']?_0x5dd8d5['attributes']:_0x49eb3e[_0xa362('0x3c')];if(!_0x338239[_0xa362('0x3d')][_0xa362('0x44')](_0xa362('0x45'))){_0x5dd8d5['limit']=qs['limit'](_0x338239[_0xa362('0x3d')][_0xa362('0x20')]);_0x5dd8d5[_0xa362('0x1f')]=qs[_0xa362('0x1f')](_0x338239[_0xa362('0x3d')][_0xa362('0x1f')]);}_0x5dd8d5['order']=qs['sort'](_0x338239[_0xa362('0x3d')]['sort']);_0x5dd8d5[_0xa362('0x48')]=qs[_0xa362('0x3f')](_[_0xa362('0x62')](_0x338239[_0xa362('0x3d')],_0x49eb3e[_0xa362('0x3f')]));_0x5dd8d5[_0xa362('0x48')][_0xa362('0x64')]=_0xdd2d0c['id'];if(_0x338239[_0xa362('0x3d')][_0xa362('0x2e')]){_0x5dd8d5[_0xa362('0x48')]=_[_0xa362('0x4a')](_0x5dd8d5[_0xa362('0x48')],{'$or':_[_0xa362('0x30')](_0x5dd8d5[_0xa362('0x41')],function(_0x5e9ac9){var _0x330e10={};_0x330e10[_0x5e9ac9]={'$like':'%'+_0x338239['query'][_0xa362('0x2e')]+'%'};return _0x330e10;})});}_0x5dd8d5=_[_0xa362('0x4a')]({},_0x5dd8d5,_0x338239['options']);return db[_0xa362('0x63')][_0xa362('0x1e')]({'where':_0x5dd8d5[_0xa362('0x48')]})['then'](function(_0x3bd977){_0xb81c22[_0xa362('0x1e')]=_0x3bd977;if(_0x338239[_0xa362('0x3d')]['includeAll']){_0x5dd8d5[_0xa362('0x4d')]=[{'all':!![]}];}return db[_0xa362('0x63')][_0xa362('0x4e')](_0x5dd8d5);})[_0xa362('0x28')](function(_0x27ea7e){_0xb81c22['rows']=_0x27ea7e;return _0xb81c22;});}})[_0xa362('0x28')](respondWithFilteredResult(_0xb8dcf9,_0x5dd8d5))['catch'](handleError(_0xb8dcf9,null));};exports['getHopperFinals']=function(_0x48f34d,_0x41efa5,_0xcf9515){var _0x5813be={'raw':!![],'where':{}};var _0x47f7a5={};var _0x251560={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa362('0x65')]({'where':{'id':_0x48f34d[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x41efa5,null))[_0xa362('0x28')](function(_0x513922){if(_0x513922){_0x47f7a5[_0xa362('0x3c')]=_[_0xa362('0x3e')](db['CmHopperFinal'][_0xa362('0x3b')]);_0x47f7a5[_0xa362('0x3d')]=_[_0xa362('0x3e')](_0x48f34d['query']);_0x47f7a5[_0xa362('0x3f')]=_['intersection'](_0x47f7a5[_0xa362('0x3c')],_0x47f7a5[_0xa362('0x3d')]);_0x5813be[_0xa362('0x41')]=_[_0xa362('0x40')](_0x47f7a5[_0xa362('0x3c')],qs[_0xa362('0x42')](_0x48f34d[_0xa362('0x3d')][_0xa362('0x42')]));_0x5813be['attributes']=_0x5813be[_0xa362('0x41')]['length']?_0x5813be['attributes']:_0x47f7a5[_0xa362('0x3c')];if(!_0x48f34d[_0xa362('0x3d')][_0xa362('0x44')]('nolimit')){_0x5813be[_0xa362('0x20')]=qs[_0xa362('0x20')](_0x48f34d['query'][_0xa362('0x20')]);_0x5813be[_0xa362('0x1f')]=qs[_0xa362('0x1f')](_0x48f34d[_0xa362('0x3d')][_0xa362('0x1f')]);}_0x5813be[_0xa362('0x46')]=qs[_0xa362('0x47')](_0x48f34d[_0xa362('0x3d')]['sort']);_0x5813be[_0xa362('0x48')]=qs[_0xa362('0x3f')](_[_0xa362('0x62')](_0x48f34d['query'],_0x47f7a5['filters']));_0x5813be['where'][_0xa362('0x64')]=_0x513922['id'];if(_0x48f34d[_0xa362('0x3d')][_0xa362('0x2e')]){_0x5813be[_0xa362('0x48')]=_[_0xa362('0x4a')](_0x5813be[_0xa362('0x48')],{'$or':_[_0xa362('0x30')](_0x5813be[_0xa362('0x41')],function(_0x38ca94){var _0x2999d0={};_0x2999d0[_0x38ca94]={'$like':'%'+_0x48f34d[_0xa362('0x3d')][_0xa362('0x2e')]+'%'};return _0x2999d0;})});}_0x5813be=_[_0xa362('0x4a')]({},_0x5813be,_0x48f34d[_0xa362('0x4b')]);return db[_0xa362('0x66')][_0xa362('0x1e')]({'where':_0x5813be['where']})[_0xa362('0x28')](function(_0x5a602b){_0x251560['count']=_0x5a602b;if(_0x48f34d[_0xa362('0x3d')][_0xa362('0x4c')]){_0x5813be[_0xa362('0x4d')]=[{'all':!![]}];}return db[_0xa362('0x66')][_0xa362('0x4e')](_0x5813be);})[_0xa362('0x28')](function(_0x3f4c52){_0x251560[_0xa362('0x4f')]=_0x3f4c52;return _0x251560;});}})['then'](respondWithFilteredResult(_0x41efa5,_0x5813be))[_0xa362('0x52')](handleError(_0x41efa5,null));};exports['getHopperBlacks']=function(_0x1e2507,_0x2f40b8,_0xb861b1){var _0x3d1c71={'raw':!![],'where':{}};var _0x3a7e76={};var _0x3901df={'count':0x0,'rows':[]};return db[_0xa362('0x3a')][_0xa362('0x65')]({'where':{'id':_0x1e2507[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x2f40b8,null))[_0xa362('0x28')](function(_0x543bb8){if(_0x543bb8){_0x3a7e76[_0xa362('0x3c')]=_[_0xa362('0x3e')](db['CmHopperBlack'][_0xa362('0x3b')]);_0x3a7e76[_0xa362('0x3d')]=_[_0xa362('0x3e')](_0x1e2507['query']);_0x3a7e76['filters']=_[_0xa362('0x40')](_0x3a7e76[_0xa362('0x3c')],_0x3a7e76[_0xa362('0x3d')]);_0x3d1c71[_0xa362('0x41')]=_['intersection'](_0x3a7e76[_0xa362('0x3c')],qs[_0xa362('0x42')](_0x1e2507[_0xa362('0x3d')][_0xa362('0x42')]));_0x3d1c71[_0xa362('0x41')]=_0x3d1c71[_0xa362('0x41')]['length']?_0x3d1c71[_0xa362('0x41')]:_0x3a7e76[_0xa362('0x3c')];if(!_0x1e2507[_0xa362('0x3d')][_0xa362('0x44')](_0xa362('0x45'))){_0x3d1c71[_0xa362('0x20')]=qs[_0xa362('0x20')](_0x1e2507[_0xa362('0x3d')]['limit']);_0x3d1c71[_0xa362('0x1f')]=qs[_0xa362('0x1f')](_0x1e2507[_0xa362('0x3d')][_0xa362('0x1f')]);}_0x3d1c71['order']=qs[_0xa362('0x47')](_0x1e2507['query'][_0xa362('0x47')]);_0x3d1c71[_0xa362('0x48')]=qs[_0xa362('0x3f')](_['pick'](_0x1e2507[_0xa362('0x3d')],_0x3a7e76[_0xa362('0x3f')]));_0x3d1c71[_0xa362('0x48')][_0xa362('0x64')]=_0x543bb8['id'];if(_0x1e2507[_0xa362('0x3d')]['filter']){_0x3d1c71['where']=_[_0xa362('0x4a')](_0x3d1c71[_0xa362('0x48')],{'$or':_[_0xa362('0x30')](_0x3d1c71['attributes'],function(_0x526281){var _0x518a39={};_0x518a39[_0x526281]={'$like':'%'+_0x1e2507[_0xa362('0x3d')][_0xa362('0x2e')]+'%'};return _0x518a39;})});}_0x3d1c71=_[_0xa362('0x4a')]({},_0x3d1c71,_0x1e2507[_0xa362('0x4b')]);return db[_0xa362('0x67')]['count']({'where':_0x3d1c71[_0xa362('0x48')]})[_0xa362('0x28')](function(_0x31c0b3){_0x3901df[_0xa362('0x1e')]=_0x31c0b3;if(_0x1e2507[_0xa362('0x3d')][_0xa362('0x4c')]){_0x3d1c71[_0xa362('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa362('0x4e')](_0x3d1c71);})[_0xa362('0x28')](function(_0x4dec68){_0x3901df['rows']=_0x4dec68;return _0x3901df;});}})[_0xa362('0x28')](respondWithFilteredResult(_0x2f40b8,_0x3d1c71))[_0xa362('0x52')](handleError(_0x2f40b8,null));};exports['getTeams']=function(_0x518093,_0x168d7d,_0x2545e0){var _0x3bff97={};var _0x253fb4={};var _0x983c7;var _0x3c8905;return db['VoiceQueue'][_0xa362('0x65')]({'where':{'id':_0x518093['params']['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x168d7d,null))[_0xa362('0x28')](function(_0x23c2a3){if(_0x23c2a3){_0x983c7=_0x23c2a3;_0x253fb4[_0xa362('0x3c')]=_[_0xa362('0x3e')](db['Team'][_0xa362('0x3b')]);_0x253fb4[_0xa362('0x3d')]=_['keys'](_0x518093[_0xa362('0x3d')]);_0x253fb4[_0xa362('0x3f')]=_[_0xa362('0x40')](_0x253fb4[_0xa362('0x3c')],_0x253fb4['query']);_0x3bff97[_0xa362('0x41')]=_['intersection'](_0x253fb4[_0xa362('0x3c')],qs[_0xa362('0x42')](_0x518093[_0xa362('0x3d')][_0xa362('0x42')]));_0x3bff97[_0xa362('0x41')]=_0x3bff97[_0xa362('0x41')][_0xa362('0x43')]?_0x3bff97[_0xa362('0x41')]:_0x253fb4['model'];_0x3bff97[_0xa362('0x46')]=qs[_0xa362('0x47')](_0x518093[_0xa362('0x3d')]['sort']);_0x3bff97[_0xa362('0x48')]=qs[_0xa362('0x3f')](_[_0xa362('0x62')](_0x518093['query'],_0x253fb4[_0xa362('0x3f')]));if(_0x518093[_0xa362('0x3d')][_0xa362('0x2e')]){_0x3bff97[_0xa362('0x48')]=_[_0xa362('0x4a')](_0x3bff97[_0xa362('0x48')],{'$or':_[_0xa362('0x30')](_0x3bff97[_0xa362('0x41')],function(_0x59b96b){var _0x6ab625={};_0x6ab625[_0x59b96b]={'$like':'%'+_0x518093[_0xa362('0x3d')][_0xa362('0x2e')]+'%'};return _0x6ab625;})});}_0x3bff97=_[_0xa362('0x4a')]({},_0x3bff97,_0x518093[_0xa362('0x4b')]);return _0x983c7[_0xa362('0x68')](_0x3bff97);}})[_0xa362('0x28')](function(_0x53d2b2){if(_0x53d2b2){_0x3c8905=_0x53d2b2['length'];if(!_0x518093['query'][_0xa362('0x44')](_0xa362('0x45'))){_0x3bff97[_0xa362('0x20')]=qs['limit'](_0x518093[_0xa362('0x3d')][_0xa362('0x20')]);_0x3bff97[_0xa362('0x1f')]=qs[_0xa362('0x1f')](_0x518093[_0xa362('0x3d')][_0xa362('0x1f')]);}return _0x983c7[_0xa362('0x68')](_0x3bff97);}})['then'](function(_0x5541ef){if(_0x5541ef){return _0x5541ef?{'count':_0x3c8905,'rows':_0x5541ef}:null;}})[_0xa362('0x28')](respondWithResult(_0x168d7d,null))[_0xa362('0x52')](handleError(_0x168d7d,null));};exports[_0xa362('0x69')]=function(_0x386508,_0x1aa469,_0xadaa35){var _0x45baab=_0x386508[_0xa362('0x5b')][_0xa362('0x6a')];var _0x2f6a5c=_[_0xa362('0x30')](_0x45baab,'id');return db[_0xa362('0x6b')][_0xa362('0x4e')]({'where':{'id':_0x2f6a5c},'attributes':['id'],'include':[{'model':db[_0xa362('0x6c')],'as':_0xa362('0x6d'),'attributes':['id','name',_0xa362('0x6e'),_0xa362('0x6f'),'interface'],'raw':!![]}]})[_0xa362('0x28')](function(_0x1f97fd){if(_0x1f97fd){var _0x130fdd=_[_0xa362('0x70')](_0x1f97fd,function(_0x3db5ec){var _0x15313f=_0x3db5ec['get']({'plain':!![]});_0x15313f['Agents'][_0xa362('0x71')](function(_0x2bc6a2){_0x2bc6a2[_0xa362('0x72')]=_[_0xa362('0x34')](_0x45baab,{'id':_0x15313f['id']})[_0xa362('0x72')];});return _0x15313f[_0xa362('0x6d')];});return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x386508[_0xa362('0x51')]['id']}})[_0xa362('0x28')](function(_0x18853a){return db[_0xa362('0x73')]['transaction'](function(_0x53fc15){return _0x18853a[_0xa362('0x69')](_0x2f6a5c,{'transaction':_0x53fc15})[_0xa362('0x28')](function(){return BPromise[_0xa362('0x74')](_0x130fdd,function(_0x492b75){return db[_0xa362('0x75')][_0xa362('0x76')]({'where':{'UserId':_0x492b75['id'],'VoiceQueueId':_0x386508[_0xa362('0x51')]['id']},'defaults':{'penalty':_0x492b75[_0xa362('0x72')]},'transaction':_0x53fc15});});})[_0xa362('0x28')](function(){return BPromise[_0xa362('0x74')](_['filter'](_0x130fdd,{'online':!![]}),function(_0x256d00){return db[_0xa362('0x77')][_0xa362('0x78')]({'membername':_0x256d00[_0xa362('0x38')],'UserId':_0x256d00['id'],'queue_name':_0x18853a[_0xa362('0x38')],'VoiceQueueId':_0x18853a['id'],'interface':_[_0xa362('0x79')](_0x256d00[_0xa362('0x7a')])?util[_0xa362('0x7b')]('SIP/%s',_0x256d00[_0xa362('0x38')]):_0x256d00[_0xa362('0x7a')],'paused':_0x256d00[_0xa362('0x6f')]||![],'penalty':_0x256d00[_0xa362('0x72')]},{'transaction':_0x53fc15});});})[_0xa362('0x28')](function(){_0x130fdd[_0xa362('0x71')](function(_0x2cff96){socket[_0xa362('0x7c')](_0xa362('0x7d'),{'UserId':_0x2cff96['id'],'VoiceQueueId':_0x18853a['id']});});});});});}})['then'](respondWithStatusCode(_0x1aa469,null))[_0xa362('0x52')](handleError(_0x1aa469,null));};exports[_0xa362('0x7e')]=function(_0x6557f9,_0xc298b,_0x53e7c4){return db['Team'][_0xa362('0x4e')]({'where':{'id':_0x6557f9['query'][_0xa362('0x7f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa362('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xa362('0x28')](handleEntityNotFound(_0xc298b,null))[_0xa362('0x28')](function(_0x50c3b2){var _0x39d72b=_[_0xa362('0x30')](_0x50c3b2,'id');var _0x21659c=[];var _0x9b08aa=[];var _0x279f7b=squel[_0xa362('0x80')]();_0x279f7b[_0xa362('0x49')](_0xa362('0x81'))['from'](_0xa362('0x82'),'tq')['join'](_0xa362('0x83'),'ut',_0xa362('0x84'))[_0xa362('0x48')](_0xa362('0x85'),_0x6557f9[_0xa362('0x51')]['id']);for(var _0x53de09=0x0;_0x53de09<_0x50c3b2[_0xa362('0x43')];_0x53de09+=0x1){let _0x1fdd8c=_0x50c3b2[_0x53de09];for(var _0x1c677a=0x0;_0x1c677a<_0x1fdd8c[_0xa362('0x6d')][_0xa362('0x43')];_0x1c677a+=0x1){let _0x4dd58d=_0x1fdd8c[_0xa362('0x6d')][_0x1c677a];var _0x57b984=_0x279f7b[_0xa362('0x58')]();_0x57b984[_0xa362('0x48')](_0xa362('0x86'),_0x4dd58d['id']);_0x9b08aa[_0xa362('0x87')](db[_0xa362('0x73')][_0xa362('0x3d')](_0x57b984[_0xa362('0x88')](),{'type':db[_0xa362('0x73')][_0xa362('0x89')]['SELECT']})[_0xa362('0x28')](function(_0x18306a){if(_0x18306a[_0xa362('0x43')]===0x1){return _0x4dd58d['id'];}else{var _0x10f298=_['every'](_[_0xa362('0x30')](_0x18306a,_0xa362('0x8a')),function(_0x4d2133){return _[_0xa362('0x32')](_0x39d72b,_0x4d2133);});if(_0x10f298){return _0x4dd58d['id'];}}}));}}return BPromise[_0xa362('0x8b')](_0x9b08aa)['then'](function(_0x244082){_0x21659c=_(_0x21659c)[_0xa362('0x8c')](_0x244082)['compact']()[_0xa362('0x31')]();return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x6557f9[_0xa362('0x51')]['id']}})['then'](function(_0x4501c8){return db[_0xa362('0x73')][_0xa362('0x8d')](function(_0x500fda){return _0x4501c8['removeTeams'](_0x6557f9[_0xa362('0x3d')][_0xa362('0x7f')],{'transaction':_0x500fda})[_0xa362('0x28')](function(){if(!_[_0xa362('0x8e')](_0x21659c)){return _0x4501c8[_0xa362('0x8f')](_0x21659c,{'transaction':_0x500fda})[_0xa362('0x28')](function(){return db[_0xa362('0x77')][_0xa362('0x29')]({'where':{'VoiceQueueId':_0x6557f9[_0xa362('0x51')]['id'],'UserId':_0x21659c},'transaction':_0x500fda});});}})[_0xa362('0x28')](function(){_0x21659c[_0xa362('0x71')](function(_0x3125df){socket[_0xa362('0x7c')]('userVoiceQueue:remove',{'UserId':_0x3125df,'VoiceQueueId':_0x4501c8['id']});});});});});});})[_0xa362('0x28')](respondWithStatusCode(_0xc298b,null))[_0xa362('0x52')](handleError(_0xc298b,null));};exports[_0xa362('0x90')]=function(_0x24d2ce,_0x26ca8d,_0x2f9c08){var _0x4e15e1,_0x50a0cb;return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x24d2ce[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x26ca8d,null))[_0xa362('0x28')](function(_0x42c0c5){if(_0x42c0c5){_0x50a0cb=_0x42c0c5;return _0x42c0c5[_0xa362('0x90')](_0x24d2ce[_0xa362('0x5b')]['ids'],_[_0xa362('0x59')](_0x24d2ce['body'],[_0xa362('0x7f'),'id'])||{})[_0xa362('0x91')](function(_0x32d76b){for(var _0x3f651c=0x0;_0x3f651c<_0x24d2ce[_0xa362('0x5b')][_0xa362('0x7f')][_0xa362('0x43')];_0x3f651c+=0x1){socket['emit'](_0xa362('0x7d'),{'UserId':_0x24d2ce[_0xa362('0x5b')][_0xa362('0x7f')][_0x3f651c],'VoiceQueueId':_0x24d2ce['params']['id']});}return _0x32d76b;});}})[_0xa362('0x28')](function(_0x4f3e92){_0x4e15e1=_0x4f3e92||[];if(_0x50a0cb){return db[_0xa362('0x6c')][_0xa362('0x4e')]({'where':{'id':_0x24d2ce[_0xa362('0x5b')][_0xa362('0x7f')]},'attributes':['id',_0xa362('0x38'),_0xa362('0x6e'),_0xa362('0x6f'),_0xa362('0x7a')],'raw':!![]});}})[_0xa362('0x28')](function(_0x337bc1){if(!_[_0xa362('0x8e')](_0x337bc1)){var _0x405be6=[];for(var _0x109865=0x0;_0x109865<_0x337bc1[_0xa362('0x43')];_0x109865++){if(_0x337bc1[_0x109865][_0xa362('0x6e')]){_0x405be6[_0xa362('0x87')](db['UserVoiceQueueRt'][_0xa362('0x78')]({'membername':_0x337bc1[_0x109865][_0xa362('0x38')],'UserId':_0x337bc1[_0x109865]['id'],'queue_name':_0x50a0cb[_0xa362('0x38')],'VoiceQueueId':_0x50a0cb['id'],'interface':_['isNil'](_0x337bc1[_0x109865][_0xa362('0x7a')])?util[_0xa362('0x7b')](_0xa362('0x92'),_0x337bc1[_0x109865]['name']):_0x337bc1[_0x109865][_0xa362('0x7a')],'paused':_0x337bc1[_0x109865][_0xa362('0x6f')]||![],'penalty':_0x24d2ce[_0xa362('0x5b')][_0xa362('0x72')]||0x0}));}}return BPromise[_0xa362('0x8b')](_0x405be6);}})[_0xa362('0x28')](function(){return _0x4e15e1;})[_0xa362('0x28')](respondWithResult(_0x26ca8d,null))[_0xa362('0x52')](handleError(_0x26ca8d,null));};exports[_0xa362('0x8f')]=function(_0x2d259c,_0x5d2a00,_0x7811c6){return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x2d259c[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x5d2a00,null))[_0xa362('0x28')](function(_0x4e6e25){if(_0x4e6e25){return _0x4e6e25[_0xa362('0x8f')](_0x2d259c[_0xa362('0x3d')][_0xa362('0x7f')])[_0xa362('0x28')](function(){if(_['isArray'](_0x2d259c[_0xa362('0x3d')][_0xa362('0x7f')])){for(var _0x314803=0x0;_0x314803<_0x2d259c[_0xa362('0x3d')][_0xa362('0x7f')][_0xa362('0x43')];_0x314803+=0x1){socket[_0xa362('0x7c')](_0xa362('0x93'),{'UserId':Number(_0x2d259c[_0xa362('0x3d')][_0xa362('0x7f')][_0x314803]),'VoiceQueueId':Number(_0x2d259c[_0xa362('0x51')]['id'])});}}else{socket[_0xa362('0x7c')](_0xa362('0x93'),{'UserId':Number(_0x2d259c[_0xa362('0x3d')][_0xa362('0x7f')]),'VoiceQueueId':Number(_0x2d259c[_0xa362('0x51')]['id'])});}});}})[_0xa362('0x28')](function(_0x1bf824){return db['UserVoiceQueueRt'][_0xa362('0x29')]({'where':{'VoiceQueueId':_0x2d259c['params']['id'],'UserId':_0x2d259c[_0xa362('0x3d')][_0xa362('0x7f')]}})['then'](function(){return _0x1bf824;});})[_0xa362('0x28')](respondWithStatusCode(_0x5d2a00,null))[_0xa362('0x52')](handleError(_0x5d2a00,null));};exports[_0xa362('0x94')]=function(_0x2ffc95,_0x408338,_0x2a3519){var _0x3e8d9f={};var _0x460252={};var _0xde4cf7;var _0xedd7ec;return db[_0xa362('0x3a')][_0xa362('0x65')]({'where':{'id':_0x2ffc95[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x408338,null))['then'](function(_0x1ce912){if(_0x1ce912){_0xde4cf7=_0x1ce912;_0x460252['model']=_[_0xa362('0x3e')](db['User'][_0xa362('0x3b')]);_0x460252['query']=_[_0xa362('0x3e')](_0x2ffc95[_0xa362('0x3d')]);_0x460252[_0xa362('0x3f')]=_[_0xa362('0x40')](_0x460252[_0xa362('0x3c')],_0x460252[_0xa362('0x3d')]);_0x3e8d9f[_0xa362('0x41')]=_['intersection'](_0x460252[_0xa362('0x3c')],qs[_0xa362('0x42')](_0x2ffc95['query']['fields']));_0x3e8d9f[_0xa362('0x41')]=_0x3e8d9f[_0xa362('0x41')][_0xa362('0x43')]?_0x3e8d9f['attributes']:_0x460252[_0xa362('0x3c')];_0x3e8d9f[_0xa362('0x46')]=qs['sort'](_0x2ffc95[_0xa362('0x3d')][_0xa362('0x47')]);_0x3e8d9f[_0xa362('0x48')]=qs[_0xa362('0x3f')](_[_0xa362('0x62')](_0x2ffc95[_0xa362('0x3d')],_0x460252[_0xa362('0x3f')]));if(_0x2ffc95[_0xa362('0x3d')][_0xa362('0x2e')]){_0x3e8d9f[_0xa362('0x48')]=_['merge'](_0x3e8d9f[_0xa362('0x48')],{'$or':_[_0xa362('0x30')](_0x3e8d9f[_0xa362('0x41')],function(_0x2ab566){var _0x22e07f={};_0x22e07f[_0x2ab566]={'$like':'%'+_0x2ffc95[_0xa362('0x3d')][_0xa362('0x2e')]+'%'};return _0x22e07f;})});}_0x3e8d9f=_[_0xa362('0x4a')]({},_0x3e8d9f,_0x2ffc95[_0xa362('0x4b')]);return _0xde4cf7[_0xa362('0x94')](_0x3e8d9f);}})['then'](function(_0x3893b5){if(_0x3893b5){_0xedd7ec=_0x3893b5[_0xa362('0x43')];if(!_0x2ffc95[_0xa362('0x3d')][_0xa362('0x44')](_0xa362('0x45'))){_0x3e8d9f[_0xa362('0x20')]=qs[_0xa362('0x20')](_0x2ffc95[_0xa362('0x3d')][_0xa362('0x20')]);_0x3e8d9f['offset']=qs['offset'](_0x2ffc95[_0xa362('0x3d')][_0xa362('0x1f')]);}return _0xde4cf7[_0xa362('0x94')](_0x3e8d9f);}})[_0xa362('0x28')](function(_0x185d12){if(_0x185d12){return _0x185d12?{'count':_0xedd7ec,'rows':_0x185d12}:null;}})[_0xa362('0x28')](respondWithResult(_0x408338,null))[_0xa362('0x52')](handleError(_0x408338,null));};exports[_0xa362('0x95')]=function(_0xd44d6,_0x24adeb,_0x3e6a84){var _0x321b46={};var _0x36f6da={};var _0x1a3e24;var _0x4e05cb;return db[_0xa362('0x3a')]['findOne']({'where':{'id':_0xd44d6[_0xa362('0x51')]['id']}})['then'](handleEntityNotFound(_0x24adeb,null))[_0xa362('0x28')](function(_0x259d63){if(_0x259d63){_0x1a3e24=_0x259d63;_0x36f6da[_0xa362('0x3c')]=_['keys'](db[_0xa362('0x77')]['rawAttributes']);_0x36f6da[_0xa362('0x3d')]=_[_0xa362('0x3e')](_0xd44d6['query']);_0x36f6da[_0xa362('0x3f')]=_['intersection'](_0x36f6da['model'],_0x36f6da[_0xa362('0x3d')]);_0x321b46['attributes']=_[_0xa362('0x40')](_0x36f6da['model'],qs[_0xa362('0x42')](_0xd44d6[_0xa362('0x3d')][_0xa362('0x42')]));_0x321b46['attributes']=_0x321b46[_0xa362('0x41')][_0xa362('0x43')]?_0x321b46[_0xa362('0x41')]:_0x36f6da[_0xa362('0x3c')];_0x321b46['order']=qs[_0xa362('0x47')](_0xd44d6[_0xa362('0x3d')]['sort']);_0x321b46[_0xa362('0x48')]=qs[_0xa362('0x3f')](_['pick'](_0xd44d6[_0xa362('0x3d')],_0x36f6da['filters']));if(_0xd44d6[_0xa362('0x3d')]['filter']){_0x321b46[_0xa362('0x48')]=_[_0xa362('0x4a')](_0x321b46['where'],{'$or':_['map'](_0x321b46[_0xa362('0x41')],function(_0x5f5cf0){var _0x404100={};_0x404100[_0x5f5cf0]={'$like':'%'+_0xd44d6[_0xa362('0x3d')][_0xa362('0x2e')]+'%'};return _0x404100;})});}_0x321b46=_[_0xa362('0x4a')]({},_0x321b46,_0xd44d6['options']);return _0x1a3e24[_0xa362('0x95')](_0x321b46);}})[_0xa362('0x28')](function(_0x5dcc3b){if(_0x5dcc3b){_0x4e05cb=_0x5dcc3b[_0xa362('0x43')];if(!_0xd44d6[_0xa362('0x3d')]['hasOwnProperty'](_0xa362('0x45'))){_0x321b46['limit']=qs[_0xa362('0x20')](_0xd44d6[_0xa362('0x3d')][_0xa362('0x20')]);_0x321b46[_0xa362('0x1f')]=qs[_0xa362('0x1f')](_0xd44d6['query']['offset']);}return _0x1a3e24[_0xa362('0x95')](_0x321b46);}})['then'](function(_0x5f00e0){return _0x5f00e0?{'count':_0x4e05cb,'rows':_0x5f00e0}:null;})[_0xa362('0x28')](respondWithResult(_0x24adeb,null))[_0xa362('0x52')](handleError(_0x24adeb,null));};exports[_0xa362('0x96')]=function(_0x260299,_0x3cc879,_0x471f48){var _0x5de462={};var _0x5345a2={};var _0xf9936c;var _0x1bc73b;return db[_0xa362('0x3a')][_0xa362('0x65')]({'where':{'id':_0x260299[_0xa362('0x51')]['id']}})['then'](handleEntityNotFound(_0x3cc879,null))[_0xa362('0x28')](function(_0x5da0b0){if(_0x5da0b0){_0xf9936c=_0x5da0b0;_0x5345a2[_0xa362('0x3c')]=_['keys'](db[_0xa362('0x97')][_0xa362('0x3b')]);_0x5345a2['query']=_[_0xa362('0x3e')](_0x260299['query']);_0x5345a2[_0xa362('0x3f')]=_[_0xa362('0x40')](_0x5345a2[_0xa362('0x3c')],_0x5345a2[_0xa362('0x3d')]);_0x5de462[_0xa362('0x41')]=_[_0xa362('0x40')](_0x5345a2[_0xa362('0x3c')],qs[_0xa362('0x42')](_0x260299[_0xa362('0x3d')][_0xa362('0x42')]));_0x5de462[_0xa362('0x41')]=_0x5de462[_0xa362('0x41')]['length']?_0x5de462[_0xa362('0x41')]:_0x5345a2[_0xa362('0x3c')];_0x5de462['order']=qs['sort'](_0x260299[_0xa362('0x3d')]['sort']);_0x5de462[_0xa362('0x48')]=qs[_0xa362('0x3f')](_[_0xa362('0x62')](_0x260299[_0xa362('0x3d')],_0x5345a2[_0xa362('0x3f')]));if(_0x260299[_0xa362('0x3d')]['filter']){_0x5de462[_0xa362('0x48')]=_[_0xa362('0x4a')](_0x5de462[_0xa362('0x48')],{'$or':_[_0xa362('0x30')](_0x5de462[_0xa362('0x41')],function(_0x1efd7f){var _0x2434d9={};_0x2434d9[_0x1efd7f]={'$like':'%'+_0x260299[_0xa362('0x3d')]['filter']+'%'};return _0x2434d9;})});}_0x5de462=_[_0xa362('0x4a')]({},_0x5de462,_0x260299['options']);return _0xf9936c[_0xa362('0x96')](_0x5de462);}})[_0xa362('0x28')](function(_0x444409){if(_0x444409){_0x1bc73b=_0x444409[_0xa362('0x43')];if(!_0x260299[_0xa362('0x3d')][_0xa362('0x44')](_0xa362('0x45'))){_0x5de462[_0xa362('0x20')]=qs['limit'](_0x260299[_0xa362('0x3d')]['limit']);_0x5de462[_0xa362('0x1f')]=qs[_0xa362('0x1f')](_0x260299[_0xa362('0x3d')]['offset']);}return _0xf9936c[_0xa362('0x96')](_0x5de462);}})[_0xa362('0x28')](function(_0x2e7619){if(_0x2e7619){return _0x2e7619?{'count':_0x1bc73b,'rows':_0x2e7619}:null;}})['then'](respondWithResult(_0x3cc879,null))[_0xa362('0x52')](handleError(_0x3cc879,null));};exports[_0xa362('0x98')]=function(_0x133e46,_0x18c1ec,_0x22c5b1){var _0x3077cf,_0x5bdc99;return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x133e46[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x18c1ec,null))[_0xa362('0x28')](function(_0x2dbaf3){if(_0x2dbaf3){_0x5bdc99=_0x2dbaf3;return _0x2dbaf3[_0xa362('0x98')](_0x133e46[_0xa362('0x5b')][_0xa362('0x7f')],_['omit'](_0x133e46[_0xa362('0x5b')],[_0xa362('0x7f'),'id'])||{});}return null;})[_0xa362('0x91')](function(_0x5731a5){var _0x2f7e58;_0x3077cf=_0x5731a5||[];var _0x3efbd4=[];if(_0x5731a5){for(var _0x2c749c=0x0;_0x2c749c<_0x5731a5[_0xa362('0x43')];_0x2c749c+=0x1){var _0x2f16d5=_0x5731a5[_0x2c749c]['get']({'plain':!![]});_0x5bdc99[_0xa362('0x99')]=_0x133e46[_0xa362('0x5b')]['dialCheckDuplicateType']?_0x133e46['body'][_0xa362('0x99')]:_0x5bdc99[_0xa362('0x99')];switch(_0x5bdc99[_0xa362('0x99')]){case'always':_0x2f7e58=squel[_0xa362('0x9a')]()[_0xa362('0x9b')](_0xa362('0x9c'))['fromQuery']([_0xa362('0x9d'),_0xa362('0x9e'),_0xa362('0x9f'),_0xa362('0xa0'),_0xa362('0x64'),_0xa362('0x5a'),_0xa362('0x5c')],squel['select']()[_0xa362('0x49')](_0xa362('0x9d'),_0xa362('0x9d'))[_0xa362('0x49')](_0xa362('0xa1'),_0xa362('0x9e'))['field']('id','ContactId')['field'](_0x2f16d5[_0xa362('0xa2')][_0xa362('0x88')](),'ListId')[_0xa362('0x49')](_0x133e46['params']['id'][_0xa362('0x88')](),_0xa362('0x64'))['field'](_0xa362('0xa1'),_0xa362('0x5a'))[_0xa362('0x49')](_0xa362('0xa1'),_0xa362('0x5c'))['from'](_0xa362('0xa3'))['where'](_0xa362('0xa4'))[_0xa362('0x48')]('ListId\x20=\x20?',_0x2f16d5[_0xa362('0xa2')][_0xa362('0x88')]())[_0xa362('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0xa362('0x48')](_0xa362('0xa5'),squel['select']()[_0xa362('0x49')]('COALESCE(calleridnum,\x27\x27)')[_0xa362('0xa6')]('cm_hopper_final')[_0xa362('0x48')](_0xa362('0x85'),_0x133e46[_0xa362('0x51')]['id'][_0xa362('0x88')]()))['where'](_0xa362('0xa5'),squel[_0xa362('0x80')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0xa362('0x9c'))[_0xa362('0x48')](_0xa362('0x85'),_0x133e46[_0xa362('0x51')]['id'][_0xa362('0x88')]())))[_0xa362('0x88')]();break;case _0xa362('0xa7'):_0x2f7e58=squel[_0xa362('0x9a')]()[_0xa362('0x9b')](_0xa362('0x9c'))['fromQuery']([_0xa362('0x9d'),'scheduledAt','ContactId','ListId','VoiceQueueId','createdAt',_0xa362('0x5c')],squel[_0xa362('0x80')]()['field'](_0xa362('0x9d'),_0xa362('0x9d'))['field'](_0xa362('0xa1'),_0xa362('0x9e'))[_0xa362('0x49')]('id','ContactId')['field'](_0x2f16d5['CmListId'][_0xa362('0x88')](),_0xa362('0xa0'))[_0xa362('0x49')](_0x133e46[_0xa362('0x51')]['id']['toString'](),_0xa362('0x64'))[_0xa362('0x49')](_0xa362('0xa1'),_0xa362('0x5a'))[_0xa362('0x49')](_0xa362('0xa1'),_0xa362('0x5c'))[_0xa362('0xa6')]('cm_contacts')[_0xa362('0x48')](_0xa362('0xa4'))['where']('ListId\x20=\x20?',_0x2f16d5[_0xa362('0xa2')][_0xa362('0x88')]())[_0xa362('0x48')](_0xa362('0xa8'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa362('0x49')](_0xa362('0xa9'))[_0xa362('0xa6')]('cm_hopper')[_0xa362('0x48')](_0xa362('0x85'),_0x133e46[_0xa362('0x51')]['id'][_0xa362('0x88')]())))[_0xa362('0x88')]();break;default:_0x2f7e58=squel[_0xa362('0x9a')]()[_0xa362('0x9b')](_0xa362('0x9c'))[_0xa362('0xaa')]([_0xa362('0x9d'),_0xa362('0x9e'),_0xa362('0x9f'),'ListId',_0xa362('0x64'),_0xa362('0x5a'),'updatedAt'],squel[_0xa362('0x80')]()[_0xa362('0x49')](_0xa362('0x9d'),'phone')['field'](_0xa362('0xa1'),_0xa362('0x9e'))[_0xa362('0x49')]('id','ContactId')['field'](_0x2f16d5['CmListId']['toString'](),'ListId')[_0xa362('0x49')](_0x133e46[_0xa362('0x51')]['id'][_0xa362('0x88')](),_0xa362('0x64'))['field']('NOW()','createdAt')[_0xa362('0x49')](_0xa362('0xa1'),'updatedAt')[_0xa362('0xa6')](_0xa362('0xa3'))[_0xa362('0x48')](_0xa362('0xa4'))['where'](_0xa362('0xab'),_0x2f16d5[_0xa362('0xa2')][_0xa362('0x88')]())[_0xa362('0x48')](_0xa362('0xa8')))[_0xa362('0x88')]();}_0x3efbd4['push'](db[_0xa362('0x73')][_0xa362('0x3d')](_0x2f7e58));}return BPromise['all'](_0x3efbd4);}})[_0xa362('0x28')](function(){return _0x3077cf;})[_0xa362('0x28')](respondWithResult(_0x18c1ec,null))[_0xa362('0x52')](handleError(_0x18c1ec,null));};exports[_0xa362('0xac')]=function(_0x1d7a18,_0x2756e3,_0x171115){return db[_0xa362('0x3a')]['find']({'where':{'id':_0x1d7a18[_0xa362('0x51')]['id']}})['then'](handleEntityNotFound(_0x2756e3,null))['then'](function(_0x5a5e99){if(_0x5a5e99){return _0x5a5e99[_0xa362('0xac')](_0x1d7a18[_0xa362('0x3d')]['ids']);}})[_0xa362('0x28')](function(_0x23df23){if(_0x23df23){return db[_0xa362('0x61')]['destroy']({'where':{'ListId':_0x1d7a18[_0xa362('0x3d')][_0xa362('0x7f')],'VoiceQueueId':_0x1d7a18['params']['id']}})[_0xa362('0x28')](function(){return _0x23df23;});}})[_0xa362('0x28')](respondWithStatusCode(_0x2756e3,null))['catch'](handleError(_0x2756e3,null));};exports['getBlackLists']=function(_0x148e14,_0x287fa5,_0x23262c){var _0x4edc42={};var _0x37b012={};var _0x33d4c6;var _0x47133d;return db[_0xa362('0x3a')][_0xa362('0x65')]({'where':{'id':_0x148e14[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x287fa5,null))[_0xa362('0x28')](function(_0x1c3c86){if(_0x1c3c86){_0x33d4c6=_0x1c3c86;_0x37b012[_0xa362('0x3c')]=_[_0xa362('0x3e')](db[_0xa362('0x97')][_0xa362('0x3b')]);_0x37b012[_0xa362('0x3d')]=_['keys'](_0x148e14[_0xa362('0x3d')]);_0x37b012[_0xa362('0x3f')]=_['intersection'](_0x37b012[_0xa362('0x3c')],_0x37b012[_0xa362('0x3d')]);_0x4edc42[_0xa362('0x41')]=_[_0xa362('0x40')](_0x37b012['model'],qs[_0xa362('0x42')](_0x148e14[_0xa362('0x3d')]['fields']));_0x4edc42[_0xa362('0x41')]=_0x4edc42['attributes'][_0xa362('0x43')]?_0x4edc42['attributes']:_0x37b012[_0xa362('0x3c')];_0x4edc42[_0xa362('0x46')]=qs[_0xa362('0x47')](_0x148e14[_0xa362('0x3d')][_0xa362('0x47')]);_0x4edc42[_0xa362('0x48')]=qs['filters'](_[_0xa362('0x62')](_0x148e14[_0xa362('0x3d')],_0x37b012[_0xa362('0x3f')]));if(_0x148e14[_0xa362('0x3d')][_0xa362('0x2e')]){_0x4edc42[_0xa362('0x48')]=_[_0xa362('0x4a')](_0x4edc42[_0xa362('0x48')],{'$or':_[_0xa362('0x30')](_0x4edc42['attributes'],function(_0x2f8991){var _0x4b439c={};_0x4b439c[_0x2f8991]={'$like':'%'+_0x148e14[_0xa362('0x3d')][_0xa362('0x2e')]+'%'};return _0x4b439c;})});}_0x4edc42=_['merge']({},_0x4edc42,_0x148e14[_0xa362('0x4b')]);return _0x33d4c6[_0xa362('0xad')](_0x4edc42);}})['then'](function(_0x5aec07){if(_0x5aec07){_0x47133d=_0x5aec07[_0xa362('0x43')];if(!_0x148e14[_0xa362('0x3d')][_0xa362('0x44')](_0xa362('0x45'))){_0x4edc42['limit']=qs[_0xa362('0x20')](_0x148e14[_0xa362('0x3d')][_0xa362('0x20')]);_0x4edc42[_0xa362('0x1f')]=qs[_0xa362('0x1f')](_0x148e14[_0xa362('0x3d')][_0xa362('0x1f')]);}return _0x33d4c6[_0xa362('0xad')](_0x4edc42);}})[_0xa362('0x28')](function(_0xf66e1b){if(_0xf66e1b){return _0xf66e1b?{'count':_0x47133d,'rows':_0xf66e1b}:null;}})['then'](respondWithResult(_0x287fa5,null))[_0xa362('0x52')](handleError(_0x287fa5,null));};exports[_0xa362('0xae')]=function(_0x27641d,_0x182f58,_0x18cacd){var _0x5a3c1b,_0x4b372a;return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x27641d[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x182f58,null))[_0xa362('0x28')](function(_0x35934b){if(_0x35934b){_0x4b372a=_0x35934b;return _0x35934b[_0xa362('0xae')](_0x27641d[_0xa362('0x5b')][_0xa362('0x7f')],_['omit'](_0x27641d[_0xa362('0x5b')],[_0xa362('0x7f'),'id'])||{});}return null;})[_0xa362('0x91')](function(_0x4e1b84){var _0x443e12;_0x5a3c1b=_0x4e1b84||[];var _0x10ce00=[];if(_0x4e1b84){for(var _0x82c2e8=0x0;_0x82c2e8<_0x4e1b84[_0xa362('0x43')];_0x82c2e8+=0x1){var _0x317a13=_0x4e1b84[_0x82c2e8][_0xa362('0x2a')]({'plain':!![]});_0x443e12=squel['insert']()[_0xa362('0x9b')](_0xa362('0xaf'))[_0xa362('0xaa')]([_0xa362('0x9d'),_0xa362('0x9f'),_0xa362('0xa0'),_0xa362('0x64'),_0xa362('0x5a'),_0xa362('0x5c')],squel['select']()[_0xa362('0x49')](_0xa362('0x9d'),'phone')[_0xa362('0x49')]('id',_0xa362('0x9f'))['field'](_0x317a13[_0xa362('0xa2')]['toString'](),'ListId')['field'](_0x27641d['params']['id'][_0xa362('0x88')](),_0xa362('0x64'))['field'](_0xa362('0xa1'),_0xa362('0x5a'))[_0xa362('0x49')](_0xa362('0xa1'),_0xa362('0x5c'))[_0xa362('0xa6')](_0xa362('0xa3'))[_0xa362('0x48')](_0xa362('0xa4'))['where'](_0xa362('0xab'),_0x317a13['CmListId'][_0xa362('0x88')]())[_0xa362('0x48')](_0xa362('0xa8')))[_0xa362('0x88')]();_0x10ce00[_0xa362('0x87')](db[_0xa362('0x73')][_0xa362('0x3d')](_0x443e12));}return BPromise[_0xa362('0x8b')](_0x10ce00);}})['then'](function(){return _0x5a3c1b;})[_0xa362('0x28')](respondWithResult(_0x182f58,null))[_0xa362('0x52')](handleError(_0x182f58,null));};exports['removeBlackLists']=function(_0x41e21f,_0x5eece0,_0x311f3d){return db[_0xa362('0x3a')][_0xa362('0x34')]({'where':{'id':_0x41e21f[_0xa362('0x51')]['id']}})[_0xa362('0x28')](handleEntityNotFound(_0x5eece0,null))['then'](function(_0x379676){if(_0x379676){return _0x379676[_0xa362('0xb0')](_0x41e21f[_0xa362('0x3d')][_0xa362('0x7f')]);}})[_0xa362('0x28')](function(_0x29941c){if(_0x29941c){return db[_0xa362('0x67')]['destroy']({'where':{'ListId':_0x41e21f[_0xa362('0x3d')][_0xa362('0x7f')],'VoiceQueueId':_0x41e21f[_0xa362('0x51')]['id']}})[_0xa362('0x28')](function(){return _0x29941c;});}})[_0xa362('0x28')](respondWithStatusCode(_0x5eece0,null))[_0xa362('0x52')](handleError(_0x5eece0,null));}; \ No newline at end of file +var _0x3695=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','outbound','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','inbound','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','removeTeams','User','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','addAgents','emit','userVoiceQueue:save','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','NOW()','CmListId','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)','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','filter','ignore','map','value','type','find','UserProfileResource','stack','name','index','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','key','VIRTUAL','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','options'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3695,0x1d2));var _0x5369=function(_0x2f22ee,_0x3a9cd4){_0x2f22ee=_0x2f22ee-0x0;var _0xe86ac6=_0x3695[_0x2f22ee];return _0xe86ac6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5369('0x0'));var rimraf=require(_0x5369('0x1'));var zipdir=require(_0x5369('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5369('0x3'));var moment=require(_0x5369('0x4'));var BPromise=require(_0x5369('0x5'));var Mustache=require(_0x5369('0x6'));var util=require(_0x5369('0x7'));var path=require(_0x5369('0x8'));var sox=require(_0x5369('0x9'));var csv=require(_0x5369('0xa'));var ejs=require(_0x5369('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5369('0xc'));var crypto=require(_0x5369('0xd'));var jsforce=require(_0x5369('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5369('0xa'));var querystring=require(_0x5369('0xf'));var Papa=require(_0x5369('0x10'));var Redis=require(_0x5369('0x11'));var authService=require(_0x5369('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x5369('0x13'));var logger=require(_0x5369('0x14'))(_0x5369('0x15'));var utils=require('../../config/utils');var config=require(_0x5369('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5369('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5369('0x18'))(new Redis(config[_0x5369('0x19')]));require(_0x5369('0x1a'))[_0x5369('0x1b')](socket);function respondWithStatusCode(_0x553c66,_0x5e5920){_0x5e5920=_0x5e5920||0xcc;return function(_0x48f72a){if(_0x48f72a){return _0x553c66[_0x5369('0x1c')](_0x5e5920);}return _0x553c66[_0x5369('0x1d')](_0x5e5920)[_0x5369('0x1e')]();};}function respondWithResult(_0xa32e2b,_0xc2225){_0xc2225=_0xc2225||0xc8;return function(_0x3e0976){if(_0x3e0976){return _0xa32e2b[_0x5369('0x1d')](_0xc2225)[_0x5369('0x1f')](_0x3e0976);}};}function respondWithFilteredResult(_0x4994b0,_0x13a0c3){return function(_0x16a38f){if(_0x16a38f){var _0x2198ed=_0x16a38f[_0x5369('0x20')],_0x3996bf=_0x13a0c3[_0x5369('0x21')],_0xbf6663=_0x13a0c3['offset']+_0x13a0c3[_0x5369('0x22')],_0x15feb4;if(_0xbf6663>=_0x2198ed){_0xbf6663=_0x2198ed;_0x15feb4=0xc8;}else{_0x15feb4=0xce;}_0x4994b0[_0x5369('0x1d')](_0x15feb4);return _0x4994b0[_0x5369('0x23')](_0x5369('0x24'),_0x3996bf+'-'+_0xbf6663+'/'+_0x2198ed)[_0x5369('0x1f')](_0x16a38f);}return null;};}function patchUpdates(_0x2d1171){return function(_0x3a7f5a){try{jsonpatch[_0x5369('0x25')](_0x3a7f5a,_0x2d1171,!![]);}catch(_0x5d7aa7){return BPromise[_0x5369('0x26')](_0x5d7aa7);}return _0x3a7f5a[_0x5369('0x27')]();};}function saveUpdates(_0x2c6590,_0xf26873){return function(_0x48030b){if(_0x48030b){return _0x48030b[_0x5369('0x28')](_0x2c6590)[_0x5369('0x29')](function(_0x5b4614){return _0x5b4614;});}return null;};}function removeEntity(_0x3274d4,_0xf9d89f){return function(_0x326249){if(_0x326249){return _0x326249[_0x5369('0x2a')]()['then'](function(){var _0x44d24f=_0x326249[_0x5369('0x2b')]({'plain':!![]});var _0xa00b99=[{'name':_0x5369('0x2c'),'value':'inbound','ignore':![]},{'name':_0x5369('0x2d'),'value':'outbound','ignore':![]}];var _0x2833fb=_(_0xa00b99)[_0x5369('0x2e')](_0x5369('0x2f'))[_0x5369('0x30')]('value')[_0x5369('0x31')]();if(_['includes'](_0x2833fb,_0x44d24f[_0x5369('0x32')])){return;}var _0x4d2872=_[_0x5369('0x33')](_0xa00b99,[_0x5369('0x31'),_0x44d24f[_0x5369('0x32')]])['name'];return db[_0x5369('0x34')][_0x5369('0x2a')]({'where':{'type':_0x4d2872,'resourceId':_0x44d24f['id']}})[_0x5369('0x29')](function(){return _0x326249;});})[_0x5369('0x29')](function(){_0x3274d4['status'](0xcc)[_0x5369('0x1e')]();});}};}function handleEntityNotFound(_0x1b0873,_0x22dbeb){return function(_0x26ef0e){if(!_0x26ef0e){_0x1b0873[_0x5369('0x1c')](0x194);}return _0x26ef0e;};}function handleError(_0xeacc04,_0xd0f20){_0xd0f20=_0xd0f20||0x1f4;return function(_0x538287){logger['error'](_0x538287[_0x5369('0x35')]);if(_0x538287[_0x5369('0x36')]){delete _0x538287[_0x5369('0x36')];}_0xeacc04[_0x5369('0x1d')](_0xd0f20)['send'](_0x538287);};}exports[_0x5369('0x37')]=function(_0x5849b8,_0x55395e){var _0x526b4d={},_0x1ceb21={},_0xf211f={'count':0x0,'rows':[]};var _0x36d18a=db['VoiceQueue'][_0x5369('0x38')];_0x1ceb21[_0x5369('0x39')]=_['keys'](_0x36d18a);_0x1ceb21['query']=_[_0x5369('0x3a')](_0x5849b8[_0x5369('0x3b')]);_0x1ceb21['filters']=_[_0x5369('0x3c')](_0x1ceb21[_0x5369('0x39')],_0x1ceb21[_0x5369('0x3b')]);_0x526b4d[_0x5369('0x3d')]=_['intersection'](_0x1ceb21[_0x5369('0x39')],qs[_0x5369('0x3e')](_0x5849b8[_0x5369('0x3b')][_0x5369('0x3e')]));_0x526b4d[_0x5369('0x3d')]=_0x526b4d[_0x5369('0x3d')][_0x5369('0x3f')]?_0x526b4d[_0x5369('0x3d')]:_0x1ceb21['model'];if(!_0x5849b8[_0x5369('0x3b')][_0x5369('0x40')](_0x5369('0x41'))){_0x526b4d[_0x5369('0x22')]=qs['limit'](_0x5849b8[_0x5369('0x3b')][_0x5369('0x22')]);_0x526b4d[_0x5369('0x21')]=qs[_0x5369('0x21')](_0x5849b8[_0x5369('0x3b')][_0x5369('0x21')]);}_0x526b4d[_0x5369('0x42')]=qs[_0x5369('0x43')](_0x5849b8[_0x5369('0x3b')][_0x5369('0x43')]);_0x526b4d[_0x5369('0x44')]=qs[_0x5369('0x45')](_[_0x5369('0x46')](_0x5849b8[_0x5369('0x3b')],_0x1ceb21[_0x5369('0x45')]));if(_0x5849b8['query']['filter']){_0x526b4d[_0x5369('0x44')]=_[_0x5369('0x47')](_0x526b4d['where'],{'$or':_[_0x5369('0x30')](_0x36d18a,function(_0x5e0ddc){if(_0x5e0ddc['type'][_0x5369('0x48')]!==_0x5369('0x49')){var _0x28b26f={};_0x28b26f[_0x5e0ddc['field']]={'$like':'%'+_0x5849b8[_0x5369('0x3b')][_0x5369('0x2e')]+'%'};return _0x28b26f;}})});}_0x526b4d=_[_0x5369('0x47')]({},_0x526b4d,_0x5849b8['options']);var _0x32cbda={'where':_0x526b4d[_0x5369('0x44')]};return db[_0x5369('0x4a')]['count'](_0x32cbda)[_0x5369('0x29')](function(_0x4e4e16){_0xf211f[_0x5369('0x20')]=_0x4e4e16;if(_0x5849b8[_0x5369('0x3b')][_0x5369('0x4b')]){_0x526b4d[_0x5369('0x4c')]=[{'all':!![]}];}return db[_0x5369('0x4a')][_0x5369('0x4d')](_0x526b4d);})[_0x5369('0x29')](function(_0x2ab42b){_0xf211f[_0x5369('0x4e')]=_0x2ab42b;return _0xf211f;})[_0x5369('0x29')](respondWithFilteredResult(_0x55395e,_0x526b4d))[_0x5369('0x4f')](handleError(_0x55395e,null));};exports[_0x5369('0x50')]=function(_0x32e28b,_0x56a8cd){var _0x561c66={'raw':![],'where':{'id':_0x32e28b[_0x5369('0x51')]['id']}},_0x25f5ed={};_0x25f5ed[_0x5369('0x39')]=_[_0x5369('0x3a')](db[_0x5369('0x4a')][_0x5369('0x38')]);_0x25f5ed['query']=_[_0x5369('0x3a')](_0x32e28b[_0x5369('0x3b')]);_0x25f5ed['filters']=_[_0x5369('0x3c')](_0x25f5ed[_0x5369('0x39')],_0x25f5ed[_0x5369('0x3b')]);_0x561c66[_0x5369('0x3d')]=_['intersection'](_0x25f5ed[_0x5369('0x39')],qs[_0x5369('0x3e')](_0x32e28b[_0x5369('0x3b')][_0x5369('0x3e')]));_0x561c66[_0x5369('0x3d')]=_0x561c66[_0x5369('0x3d')][_0x5369('0x3f')]?_0x561c66[_0x5369('0x3d')]:_0x25f5ed['model'];if(_0x32e28b[_0x5369('0x3b')]['includeAll']){_0x561c66[_0x5369('0x4c')]=[{'all':!![]}];}_0x561c66=_[_0x5369('0x47')]({},_0x561c66,_0x32e28b[_0x5369('0x52')]);return db[_0x5369('0x4a')][_0x5369('0x33')](_0x561c66)[_0x5369('0x29')](handleEntityNotFound(_0x56a8cd,null))['then'](respondWithResult(_0x56a8cd,null))[_0x5369('0x4f')](handleError(_0x56a8cd,null));};exports[_0x5369('0x53')]=function(_0x4f673c,_0x4368d2){return db[_0x5369('0x4a')][_0x5369('0x53')](_0x4f673c[_0x5369('0x54')],{})[_0x5369('0x29')](function(_0x452a87){var _0x1188e8=_0x4f673c['user'][_0x5369('0x2b')]({'plain':!![]});if(!_0x1188e8)throw new Error(_0x5369('0x55'));if(_0x1188e8[_0x5369('0x56')]===_0x5369('0x57')){var _0x4e276d=_0x452a87['get']({'plain':!![]});var _0x86f06a=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0x5369('0x58')}];var _0x5abff8=_[_0x5369('0x33')](_0x86f06a,['value',_0x4e276d[_0x5369('0x32')]])[_0x5369('0x36')];return db[_0x5369('0x59')][_0x5369('0x33')]({'where':{'name':_0x5abff8,'userProfileId':_0x1188e8[_0x5369('0x5a')]},'raw':!![]})[_0x5369('0x29')](function(_0x5b151b){if(_0x5b151b&&_0x5b151b[_0x5369('0x5b')]===0x0){return db[_0x5369('0x34')]['create']({'name':_0x4e276d[_0x5369('0x36')],'resourceId':_0x4e276d['id'],'type':_0x5b151b[_0x5369('0x36')],'sectionId':_0x5b151b['id']},{})[_0x5369('0x29')](function(){return _0x452a87;});}else{return _0x452a87;}})['catch'](function(_0x2c8724){logger[_0x5369('0x5c')](_0x5369('0x5d'),_0x2c8724);throw _0x2c8724;});}return _0x452a87;})[_0x5369('0x29')](respondWithResult(_0x4368d2,0xc9))[_0x5369('0x4f')](handleError(_0x4368d2,null));};exports[_0x5369('0x5e')]=function(_0x4604df,_0x5e47d7){var _0x4c4d7d={'raw':![],'where':{'id':_0x4604df[_0x5369('0x51')]['id']}},_0x5230d7={};_0x5230d7[_0x5369('0x39')]=_['keys'](db[_0x5369('0x4a')][_0x5369('0x38')]);_0x4c4d7d[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x5230d7[_0x5369('0x39')],qs[_0x5369('0x3e')](_0x4604df[_0x5369('0x3b')][_0x5369('0x3e')]));_0x4c4d7d[_0x5369('0x3d')]=_0x4c4d7d['attributes']['length']?_0x4c4d7d[_0x5369('0x3d')]:_0x5230d7['model'];if(_0x4604df[_0x5369('0x3b')][_0x5369('0x4b')]){_0x4c4d7d[_0x5369('0x4c')]=[{'all':!![]}];}_0x4c4d7d=_[_0x5369('0x47')]({},_0x4c4d7d,_0x4604df[_0x5369('0x52')]);return db['VoiceQueue'][_0x5369('0x33')](_0x4c4d7d)['then'](handleEntityNotFound(_0x5e47d7,null))[_0x5369('0x29')](function(_0x1db8d7){if(_0x1db8d7){var _0xbe1aee=_0x1db8d7[_0x5369('0x2b')]({'plain':!![]});_0xbe1aee=qs[_0x5369('0x5f')](_0xbe1aee,['id',_0x5369('0x60'),_0x5369('0x61')]);_0x4604df[_0x5369('0x54')]=_['omit'](_0x4604df[_0x5369('0x54')],['id','createdAt',_0x5369('0x61')]);return db[_0x5369('0x4a')][_0x5369('0x53')](_['merge'](_0xbe1aee,_0x4604df['body']),{'include':_0x4604df['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x144a1c){var _0x50644b=_0x4604df[_0x5369('0x57')][_0x5369('0x2b')]({'plain':!![]});if(!_0x50644b)throw new Error(_0x5369('0x55'));if(_0x50644b[_0x5369('0x56')]===_0x5369('0x57')){var _0xb52045=_0x144a1c[_0x5369('0x2b')]({'plain':!![]});var _0x2ae430=[{'name':_0x5369('0x2c'),'value':_0x5369('0x62')},{'name':'QueueCampaigns','value':_0x5369('0x58')}];var _0x41f23e=_['find'](_0x2ae430,['value',_0xb52045['type']])[_0x5369('0x36')];return db[_0x5369('0x59')]['find']({'where':{'name':_0x41f23e,'userProfileId':_0x50644b[_0x5369('0x5a')]},'raw':!![]})[_0x5369('0x29')](function(_0x59a270){if(_0x59a270&&_0x59a270['autoAssociation']===0x0){return db[_0x5369('0x34')]['create']({'name':_0xb52045[_0x5369('0x36')],'resourceId':_0xb52045['id'],'type':_0x59a270[_0x5369('0x36')],'sectionId':_0x59a270['id']},{})[_0x5369('0x29')](function(){return _0x144a1c;});}else{return _0x144a1c;}})[_0x5369('0x4f')](function(_0x2380ae){logger[_0x5369('0x5c')](_0x5369('0x5d'),_0x2380ae);throw _0x2380ae;});}return _0x144a1c;});}})[_0x5369('0x29')](respondWithResult(_0x5e47d7,0xc9))[_0x5369('0x4f')](handleError(_0x5e47d7,null));};exports['update']=function(_0x365ea3,_0x1a0ec4){if(_0x365ea3[_0x5369('0x54')]['id']){delete _0x365ea3[_0x5369('0x54')]['id'];}return db[_0x5369('0x4a')]['find']({'where':{'id':_0x365ea3['params']['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x1a0ec4,null))['then'](saveUpdates(_0x365ea3[_0x5369('0x54')],null))[_0x5369('0x29')](respondWithResult(_0x1a0ec4,null))[_0x5369('0x4f')](handleError(_0x1a0ec4,null));};exports[_0x5369('0x2a')]=function(_0x5b7a6b,_0x1e0223){return db[_0x5369('0x4a')]['find']({'where':{'id':_0x5b7a6b[_0x5369('0x51')]['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x1e0223,null))[_0x5369('0x29')](removeEntity(_0x1e0223,null))[_0x5369('0x4f')](handleError(_0x1e0223,null));};exports[_0x5369('0x63')]=function(_0x1d9373,_0x5d3450,_0xa5211c){var _0x2aa635={'raw':![],'where':{}};var _0x2d8bb9={};var _0xa70d9a={'count':0x0,'rows':[]};return db[_0x5369('0x4a')][_0x5369('0x64')]({'where':{'id':_0x1d9373['params']['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x5d3450,null))[_0x5369('0x29')](function(_0x22051b){if(_0x22051b){_0x2d8bb9[_0x5369('0x39')]=_[_0x5369('0x3a')](db['CmHopper']['rawAttributes']);_0x2d8bb9['query']=_[_0x5369('0x3a')](_0x1d9373[_0x5369('0x3b')]);_0x2d8bb9[_0x5369('0x45')]=_[_0x5369('0x3c')](_0x2d8bb9[_0x5369('0x39')],_0x2d8bb9[_0x5369('0x3b')]);_0x2aa635[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x2d8bb9[_0x5369('0x39')],qs[_0x5369('0x3e')](_0x1d9373[_0x5369('0x3b')][_0x5369('0x3e')]));_0x2aa635[_0x5369('0x3d')]=_0x2aa635[_0x5369('0x3d')][_0x5369('0x3f')]?_0x2aa635[_0x5369('0x3d')]:_0x2d8bb9['model'];if(!_0x1d9373[_0x5369('0x3b')][_0x5369('0x40')](_0x5369('0x41'))){_0x2aa635[_0x5369('0x22')]=qs[_0x5369('0x22')](_0x1d9373[_0x5369('0x3b')][_0x5369('0x22')]);_0x2aa635[_0x5369('0x21')]=qs['offset'](_0x1d9373['query'][_0x5369('0x21')]);}_0x2aa635[_0x5369('0x42')]=qs[_0x5369('0x43')](_0x1d9373[_0x5369('0x3b')]['sort']);_0x2aa635[_0x5369('0x44')]=qs[_0x5369('0x45')](_[_0x5369('0x46')](_0x1d9373[_0x5369('0x3b')],_0x2d8bb9[_0x5369('0x45')]));_0x2aa635[_0x5369('0x44')][_0x5369('0x65')]=_0x22051b['id'];if(_0x1d9373[_0x5369('0x3b')][_0x5369('0x2e')]){_0x2aa635[_0x5369('0x44')]=_[_0x5369('0x47')](_0x2aa635[_0x5369('0x44')],{'$or':_[_0x5369('0x30')](_0x2aa635[_0x5369('0x3d')],function(_0x62479c){var _0x4d9588={};_0x4d9588[_0x62479c]={'$like':'%'+_0x1d9373[_0x5369('0x3b')]['filter']+'%'};return _0x4d9588;})});}_0x2aa635=_[_0x5369('0x47')]({},_0x2aa635,_0x1d9373[_0x5369('0x52')]);return db['CmHopper']['count']({'where':_0x2aa635[_0x5369('0x44')]})[_0x5369('0x29')](function(_0x3f94d1){_0xa70d9a[_0x5369('0x20')]=_0x3f94d1;if(_0x1d9373[_0x5369('0x3b')][_0x5369('0x4b')]){_0x2aa635[_0x5369('0x4c')]=[{'all':!![]}];}return db[_0x5369('0x66')][_0x5369('0x4d')](_0x2aa635);})['then'](function(_0x31059b){_0xa70d9a[_0x5369('0x4e')]=_0x31059b;return _0xa70d9a;});}})[_0x5369('0x29')](respondWithFilteredResult(_0x5d3450,_0x2aa635))[_0x5369('0x4f')](handleError(_0x5d3450,null));};exports[_0x5369('0x67')]=function(_0xad2419,_0x2d2a99,_0x81c12){var _0x456229={'raw':!![],'where':{}};var _0x36a09a={};var _0x1120ab={'count':0x0,'rows':[]};return db[_0x5369('0x4a')][_0x5369('0x64')]({'where':{'id':_0xad2419[_0x5369('0x51')]['id']}})['then'](handleEntityNotFound(_0x2d2a99,null))[_0x5369('0x29')](function(_0x58e9ca){if(_0x58e9ca){_0x36a09a[_0x5369('0x39')]=_[_0x5369('0x3a')](db[_0x5369('0x68')][_0x5369('0x38')]);_0x36a09a[_0x5369('0x3b')]=_['keys'](_0xad2419['query']);_0x36a09a[_0x5369('0x45')]=_[_0x5369('0x3c')](_0x36a09a[_0x5369('0x39')],_0x36a09a[_0x5369('0x3b')]);_0x456229[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x36a09a[_0x5369('0x39')],qs['fields'](_0xad2419['query']['fields']));_0x456229['attributes']=_0x456229[_0x5369('0x3d')][_0x5369('0x3f')]?_0x456229['attributes']:_0x36a09a[_0x5369('0x39')];if(!_0xad2419[_0x5369('0x3b')][_0x5369('0x40')](_0x5369('0x41'))){_0x456229[_0x5369('0x22')]=qs[_0x5369('0x22')](_0xad2419[_0x5369('0x3b')][_0x5369('0x22')]);_0x456229[_0x5369('0x21')]=qs['offset'](_0xad2419[_0x5369('0x3b')][_0x5369('0x21')]);}_0x456229[_0x5369('0x42')]=qs[_0x5369('0x43')](_0xad2419[_0x5369('0x3b')][_0x5369('0x43')]);_0x456229[_0x5369('0x44')]=qs[_0x5369('0x45')](_['pick'](_0xad2419['query'],_0x36a09a[_0x5369('0x45')]));_0x456229['where'][_0x5369('0x65')]=_0x58e9ca['id'];if(_0xad2419[_0x5369('0x3b')][_0x5369('0x2e')]){_0x456229[_0x5369('0x44')]=_[_0x5369('0x47')](_0x456229['where'],{'$or':_[_0x5369('0x30')](_0x456229[_0x5369('0x3d')],function(_0x2f6414){var _0x47128e={};_0x47128e[_0x2f6414]={'$like':'%'+_0xad2419[_0x5369('0x3b')]['filter']+'%'};return _0x47128e;})});}_0x456229=_[_0x5369('0x47')]({},_0x456229,_0xad2419[_0x5369('0x52')]);return db[_0x5369('0x68')][_0x5369('0x20')]({'where':_0x456229[_0x5369('0x44')]})[_0x5369('0x29')](function(_0x579d17){_0x1120ab['count']=_0x579d17;if(_0xad2419[_0x5369('0x3b')]['includeAll']){_0x456229[_0x5369('0x4c')]=[{'all':!![]}];}return db[_0x5369('0x68')][_0x5369('0x4d')](_0x456229);})[_0x5369('0x29')](function(_0x521c54){_0x1120ab[_0x5369('0x4e')]=_0x521c54;return _0x1120ab;});}})[_0x5369('0x29')](respondWithFilteredResult(_0x2d2a99,_0x456229))[_0x5369('0x4f')](handleError(_0x2d2a99,null));};exports['getHopperFinals']=function(_0x223b9d,_0x4ff76a,_0x52fd36){var _0x33fb56={'raw':!![],'where':{}};var _0x5160d6={};var _0x5deeb0={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x223b9d[_0x5369('0x51')]['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x4ff76a,null))[_0x5369('0x29')](function(_0x4214e5){if(_0x4214e5){_0x5160d6[_0x5369('0x39')]=_['keys'](db['CmHopperFinal'][_0x5369('0x38')]);_0x5160d6[_0x5369('0x3b')]=_['keys'](_0x223b9d[_0x5369('0x3b')]);_0x5160d6[_0x5369('0x45')]=_['intersection'](_0x5160d6[_0x5369('0x39')],_0x5160d6['query']);_0x33fb56[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x5160d6['model'],qs[_0x5369('0x3e')](_0x223b9d[_0x5369('0x3b')][_0x5369('0x3e')]));_0x33fb56[_0x5369('0x3d')]=_0x33fb56[_0x5369('0x3d')]['length']?_0x33fb56[_0x5369('0x3d')]:_0x5160d6[_0x5369('0x39')];if(!_0x223b9d[_0x5369('0x3b')][_0x5369('0x40')](_0x5369('0x41'))){_0x33fb56[_0x5369('0x22')]=qs['limit'](_0x223b9d['query']['limit']);_0x33fb56[_0x5369('0x21')]=qs[_0x5369('0x21')](_0x223b9d[_0x5369('0x3b')][_0x5369('0x21')]);}_0x33fb56[_0x5369('0x42')]=qs[_0x5369('0x43')](_0x223b9d[_0x5369('0x3b')]['sort']);_0x33fb56[_0x5369('0x44')]=qs['filters'](_[_0x5369('0x46')](_0x223b9d[_0x5369('0x3b')],_0x5160d6['filters']));_0x33fb56[_0x5369('0x44')]['VoiceQueueId']=_0x4214e5['id'];if(_0x223b9d[_0x5369('0x3b')][_0x5369('0x2e')]){_0x33fb56[_0x5369('0x44')]=_[_0x5369('0x47')](_0x33fb56[_0x5369('0x44')],{'$or':_[_0x5369('0x30')](_0x33fb56[_0x5369('0x3d')],function(_0x2d334e){var _0x12e2cf={};_0x12e2cf[_0x2d334e]={'$like':'%'+_0x223b9d[_0x5369('0x3b')][_0x5369('0x2e')]+'%'};return _0x12e2cf;})});}_0x33fb56=_[_0x5369('0x47')]({},_0x33fb56,_0x223b9d['options']);return db[_0x5369('0x69')]['count']({'where':_0x33fb56[_0x5369('0x44')]})[_0x5369('0x29')](function(_0x34560c){_0x5deeb0[_0x5369('0x20')]=_0x34560c;if(_0x223b9d[_0x5369('0x3b')][_0x5369('0x4b')]){_0x33fb56['include']=[{'all':!![]}];}return db[_0x5369('0x69')][_0x5369('0x4d')](_0x33fb56);})[_0x5369('0x29')](function(_0x2e3968){_0x5deeb0[_0x5369('0x4e')]=_0x2e3968;return _0x5deeb0;});}})['then'](respondWithFilteredResult(_0x4ff76a,_0x33fb56))[_0x5369('0x4f')](handleError(_0x4ff76a,null));};exports[_0x5369('0x6a')]=function(_0x295808,_0x1d31f9,_0x5f4f58){var _0x5a1ab5={'raw':!![],'where':{}};var _0x329a92={};var _0x4b9b48={'count':0x0,'rows':[]};return db[_0x5369('0x4a')][_0x5369('0x64')]({'where':{'id':_0x295808['params']['id']}})['then'](handleEntityNotFound(_0x1d31f9,null))[_0x5369('0x29')](function(_0x31510d){if(_0x31510d){_0x329a92[_0x5369('0x39')]=_[_0x5369('0x3a')](db['CmHopperBlack'][_0x5369('0x38')]);_0x329a92[_0x5369('0x3b')]=_[_0x5369('0x3a')](_0x295808[_0x5369('0x3b')]);_0x329a92[_0x5369('0x45')]=_[_0x5369('0x3c')](_0x329a92[_0x5369('0x39')],_0x329a92[_0x5369('0x3b')]);_0x5a1ab5[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x329a92[_0x5369('0x39')],qs['fields'](_0x295808[_0x5369('0x3b')][_0x5369('0x3e')]));_0x5a1ab5[_0x5369('0x3d')]=_0x5a1ab5[_0x5369('0x3d')]['length']?_0x5a1ab5['attributes']:_0x329a92['model'];if(!_0x295808[_0x5369('0x3b')][_0x5369('0x40')](_0x5369('0x41'))){_0x5a1ab5[_0x5369('0x22')]=qs[_0x5369('0x22')](_0x295808[_0x5369('0x3b')]['limit']);_0x5a1ab5[_0x5369('0x21')]=qs[_0x5369('0x21')](_0x295808[_0x5369('0x3b')][_0x5369('0x21')]);}_0x5a1ab5['order']=qs[_0x5369('0x43')](_0x295808[_0x5369('0x3b')][_0x5369('0x43')]);_0x5a1ab5['where']=qs[_0x5369('0x45')](_['pick'](_0x295808['query'],_0x329a92[_0x5369('0x45')]));_0x5a1ab5[_0x5369('0x44')]['VoiceQueueId']=_0x31510d['id'];if(_0x295808[_0x5369('0x3b')]['filter']){_0x5a1ab5[_0x5369('0x44')]=_[_0x5369('0x47')](_0x5a1ab5[_0x5369('0x44')],{'$or':_[_0x5369('0x30')](_0x5a1ab5[_0x5369('0x3d')],function(_0x4e1a23){var _0x156539={};_0x156539[_0x4e1a23]={'$like':'%'+_0x295808[_0x5369('0x3b')][_0x5369('0x2e')]+'%'};return _0x156539;})});}_0x5a1ab5=_[_0x5369('0x47')]({},_0x5a1ab5,_0x295808[_0x5369('0x52')]);return db[_0x5369('0x6b')][_0x5369('0x20')]({'where':_0x5a1ab5[_0x5369('0x44')]})['then'](function(_0x5a127b){_0x4b9b48[_0x5369('0x20')]=_0x5a127b;if(_0x295808[_0x5369('0x3b')]['includeAll']){_0x5a1ab5[_0x5369('0x4c')]=[{'all':!![]}];}return db[_0x5369('0x6b')][_0x5369('0x4d')](_0x5a1ab5);})[_0x5369('0x29')](function(_0x1759b8){_0x4b9b48['rows']=_0x1759b8;return _0x4b9b48;});}})[_0x5369('0x29')](respondWithFilteredResult(_0x1d31f9,_0x5a1ab5))['catch'](handleError(_0x1d31f9,null));};exports[_0x5369('0x6c')]=function(_0x10f0de,_0x13db00,_0x44fe33){var _0x344974={};var _0x4754ff={};var _0x248f14;var _0x3e1c07;return db['VoiceQueue']['findOne']({'where':{'id':_0x10f0de[_0x5369('0x51')]['id']}})['then'](handleEntityNotFound(_0x13db00,null))[_0x5369('0x29')](function(_0x2763bb){if(_0x2763bb){_0x248f14=_0x2763bb;_0x4754ff[_0x5369('0x39')]=_['keys'](db[_0x5369('0x6d')][_0x5369('0x38')]);_0x4754ff[_0x5369('0x3b')]=_[_0x5369('0x3a')](_0x10f0de[_0x5369('0x3b')]);_0x4754ff[_0x5369('0x45')]=_[_0x5369('0x3c')](_0x4754ff[_0x5369('0x39')],_0x4754ff[_0x5369('0x3b')]);_0x344974[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x4754ff[_0x5369('0x39')],qs[_0x5369('0x3e')](_0x10f0de[_0x5369('0x3b')][_0x5369('0x3e')]));_0x344974['attributes']=_0x344974[_0x5369('0x3d')][_0x5369('0x3f')]?_0x344974[_0x5369('0x3d')]:_0x4754ff[_0x5369('0x39')];_0x344974[_0x5369('0x42')]=qs[_0x5369('0x43')](_0x10f0de[_0x5369('0x3b')]['sort']);_0x344974[_0x5369('0x44')]=qs[_0x5369('0x45')](_[_0x5369('0x46')](_0x10f0de[_0x5369('0x3b')],_0x4754ff[_0x5369('0x45')]));if(_0x10f0de['query'][_0x5369('0x2e')]){_0x344974['where']=_[_0x5369('0x47')](_0x344974['where'],{'$or':_[_0x5369('0x30')](_0x344974['attributes'],function(_0x3de485){var _0x5bba59={};_0x5bba59[_0x3de485]={'$like':'%'+_0x10f0de[_0x5369('0x3b')][_0x5369('0x2e')]+'%'};return _0x5bba59;})});}_0x344974=_[_0x5369('0x47')]({},_0x344974,_0x10f0de[_0x5369('0x52')]);return _0x248f14[_0x5369('0x6c')](_0x344974);}})['then'](function(_0x1f5658){if(_0x1f5658){_0x3e1c07=_0x1f5658[_0x5369('0x3f')];if(!_0x10f0de['query']['hasOwnProperty'](_0x5369('0x41'))){_0x344974['limit']=qs[_0x5369('0x22')](_0x10f0de[_0x5369('0x3b')][_0x5369('0x22')]);_0x344974[_0x5369('0x21')]=qs[_0x5369('0x21')](_0x10f0de[_0x5369('0x3b')]['offset']);}return _0x248f14[_0x5369('0x6c')](_0x344974);}})[_0x5369('0x29')](function(_0x300b05){if(_0x300b05){return _0x300b05?{'count':_0x3e1c07,'rows':_0x300b05}:null;}})['then'](respondWithResult(_0x13db00,null))[_0x5369('0x4f')](handleError(_0x13db00,null));};exports['addTeams']=function(_0x3b7b75,_0x54624e,_0x1e427d){var _0x232b43=_0x3b7b75[_0x5369('0x54')]['teams'];var _0x1ae24f=_[_0x5369('0x30')](_0x232b43,'id');return db[_0x5369('0x6d')][_0x5369('0x4d')]({'where':{'id':_0x1ae24f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5369('0x36'),_0x5369('0x6e'),_0x5369('0x6f'),_0x5369('0x70')],'raw':!![]}]})['then'](function(_0xc995cf){if(_0xc995cf){var _0x3e7570=_[_0x5369('0x71')](_0xc995cf,function(_0x2a82cd){var _0x1ccef7=_0x2a82cd[_0x5369('0x2b')]({'plain':!![]});_0x1ccef7[_0x5369('0x72')][_0x5369('0x73')](function(_0x3132f4){_0x3132f4[_0x5369('0x74')]=_[_0x5369('0x33')](_0x232b43,{'id':_0x1ccef7['id']})['penalty'];});return _0x1ccef7[_0x5369('0x72')];});return db[_0x5369('0x4a')]['find']({'where':{'id':_0x3b7b75[_0x5369('0x51')]['id']}})[_0x5369('0x29')](function(_0x3c6e64){return db[_0x5369('0x75')][_0x5369('0x76')](function(_0x193403){return _0x3c6e64['addTeams'](_0x1ae24f,{'transaction':_0x193403})[_0x5369('0x29')](function(){return BPromise[_0x5369('0x77')](_0x3e7570,function(_0x229a20){return db[_0x5369('0x78')]['findOrCreate']({'where':{'UserId':_0x229a20['id'],'VoiceQueueId':_0x3b7b75[_0x5369('0x51')]['id']},'defaults':{'penalty':_0x229a20[_0x5369('0x74')]},'transaction':_0x193403});});})['then'](function(){return BPromise['each'](_['filter'](_0x3e7570,{'online':!![]}),function(_0x218670){return db[_0x5369('0x79')][_0x5369('0x7a')]({'membername':_0x218670[_0x5369('0x36')],'UserId':_0x218670['id'],'queue_name':_0x3c6e64['name'],'VoiceQueueId':_0x3c6e64['id'],'interface':_[_0x5369('0x7b')](_0x218670['interface'])?util[_0x5369('0x7c')](_0x5369('0x7d'),_0x218670[_0x5369('0x36')]):_0x218670[_0x5369('0x70')],'paused':_0x218670[_0x5369('0x6f')]||![],'penalty':_0x218670[_0x5369('0x74')]},{'transaction':_0x193403});});})[_0x5369('0x29')](function(){_0x3e7570[_0x5369('0x73')](function(_0x2d4fb8){socket['emit']('userVoiceQueue:save',{'UserId':_0x2d4fb8['id'],'VoiceQueueId':_0x3c6e64['id']});});});});});}})[_0x5369('0x29')](respondWithStatusCode(_0x54624e,null))[_0x5369('0x4f')](handleError(_0x54624e,null));};exports[_0x5369('0x7e')]=function(_0x5c0181,_0x81ce4c,_0xa25e31){return db['Team'][_0x5369('0x4d')]({'where':{'id':_0x5c0181[_0x5369('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5369('0x7f')],'as':_0x5369('0x72'),'attributes':['id'],'raw':!![]}]})[_0x5369('0x29')](handleEntityNotFound(_0x81ce4c,null))[_0x5369('0x29')](function(_0x5e0dc4){var _0x4e781a=_[_0x5369('0x30')](_0x5e0dc4,'id');var _0xd56cb=[];var _0x798a85=[];var _0x13dbd6=squel['select']();_0x13dbd6['field'](_0x5369('0x80'))[_0x5369('0x81')]('team_has_voice_queues','tq')[_0x5369('0x82')]('user_has_teams','ut',_0x5369('0x83'))[_0x5369('0x44')](_0x5369('0x84'),_0x5c0181[_0x5369('0x51')]['id']);for(var _0x2a35a9=0x0;_0x2a35a9<_0x5e0dc4[_0x5369('0x3f')];_0x2a35a9+=0x1){let _0x6decdf=_0x5e0dc4[_0x2a35a9];for(var _0x5275ea=0x0;_0x5275ea<_0x6decdf['Agents'][_0x5369('0x3f')];_0x5275ea+=0x1){let _0x1bfe79=_0x6decdf[_0x5369('0x72')][_0x5275ea];var _0x46003f=_0x13dbd6[_0x5369('0x5e')]();_0x46003f[_0x5369('0x44')](_0x5369('0x85'),_0x1bfe79['id']);_0x798a85[_0x5369('0x86')](db[_0x5369('0x75')]['query'](_0x46003f[_0x5369('0x87')](),{'type':db[_0x5369('0x75')][_0x5369('0x88')][_0x5369('0x89')]})[_0x5369('0x29')](function(_0xf6f844){if(_0xf6f844[_0x5369('0x3f')]===0x1){return _0x1bfe79['id'];}else{var _0x5c6aa4=_[_0x5369('0x8a')](_[_0x5369('0x30')](_0xf6f844,_0x5369('0x8b')),function(_0x3b7e8e){return _[_0x5369('0x8c')](_0x4e781a,_0x3b7e8e);});if(_0x5c6aa4){return _0x1bfe79['id'];}}}));}}return BPromise[_0x5369('0x8d')](_0x798a85)[_0x5369('0x29')](function(_0x32a37f){_0xd56cb=_(_0xd56cb)[_0x5369('0x8e')](_0x32a37f)[_0x5369('0x8f')]()[_0x5369('0x31')]();return db[_0x5369('0x4a')][_0x5369('0x33')]({'where':{'id':_0x5c0181[_0x5369('0x51')]['id']}})[_0x5369('0x29')](function(_0x78b76){return db[_0x5369('0x75')]['transaction'](function(_0x250957){return _0x78b76[_0x5369('0x7e')](_0x5c0181[_0x5369('0x3b')][_0x5369('0x90')],{'transaction':_0x250957})['then'](function(){if(!_[_0x5369('0x91')](_0xd56cb)){return _0x78b76[_0x5369('0x92')](_0xd56cb,{'transaction':_0x250957})[_0x5369('0x29')](function(){return db[_0x5369('0x79')][_0x5369('0x2a')]({'where':{'VoiceQueueId':_0x5c0181[_0x5369('0x51')]['id'],'UserId':_0xd56cb},'transaction':_0x250957});});}})[_0x5369('0x29')](function(){_0xd56cb[_0x5369('0x73')](function(_0x3696e5){socket['emit']('userVoiceQueue:remove',{'UserId':_0x3696e5,'VoiceQueueId':_0x78b76['id']});});});});});});})[_0x5369('0x29')](respondWithStatusCode(_0x81ce4c,null))[_0x5369('0x4f')](handleError(_0x81ce4c,null));};exports[_0x5369('0x93')]=function(_0x43b114,_0x4b8746,_0x571882){var _0x44f3d0,_0x5c2d50;return db[_0x5369('0x4a')]['find']({'where':{'id':_0x43b114['params']['id']}})['then'](handleEntityNotFound(_0x4b8746,null))[_0x5369('0x29')](function(_0x566fe4){if(_0x566fe4){_0x5c2d50=_0x566fe4;return _0x566fe4[_0x5369('0x93')](_0x43b114[_0x5369('0x54')][_0x5369('0x90')],_['omit'](_0x43b114[_0x5369('0x54')],['ids','id'])||{})['spread'](function(_0x413b23){for(var _0x546202=0x0;_0x546202<_0x43b114[_0x5369('0x54')][_0x5369('0x90')]['length'];_0x546202+=0x1){socket[_0x5369('0x94')](_0x5369('0x95'),{'UserId':_0x43b114[_0x5369('0x54')][_0x5369('0x90')][_0x546202],'VoiceQueueId':_0x43b114['params']['id']});}return _0x413b23;});}})['then'](function(_0x4a473d){_0x44f3d0=_0x4a473d||[];if(_0x5c2d50){return db[_0x5369('0x7f')][_0x5369('0x4d')]({'where':{'id':_0x43b114[_0x5369('0x54')][_0x5369('0x90')]},'attributes':['id',_0x5369('0x36'),_0x5369('0x6e'),_0x5369('0x6f'),_0x5369('0x70')],'raw':!![]});}})[_0x5369('0x29')](function(_0x1b8cf6){if(!_['isEmpty'](_0x1b8cf6)){var _0x3e4ac7=[];for(var _0x15760c=0x0;_0x15760c<_0x1b8cf6[_0x5369('0x3f')];_0x15760c++){if(_0x1b8cf6[_0x15760c]['online']){_0x3e4ac7[_0x5369('0x86')](db[_0x5369('0x79')][_0x5369('0x7a')]({'membername':_0x1b8cf6[_0x15760c][_0x5369('0x36')],'UserId':_0x1b8cf6[_0x15760c]['id'],'queue_name':_0x5c2d50[_0x5369('0x36')],'VoiceQueueId':_0x5c2d50['id'],'interface':_[_0x5369('0x7b')](_0x1b8cf6[_0x15760c]['interface'])?util[_0x5369('0x7c')](_0x5369('0x7d'),_0x1b8cf6[_0x15760c][_0x5369('0x36')]):_0x1b8cf6[_0x15760c][_0x5369('0x70')],'paused':_0x1b8cf6[_0x15760c][_0x5369('0x6f')]||![],'penalty':_0x43b114[_0x5369('0x54')][_0x5369('0x74')]||0x0}));}}return BPromise[_0x5369('0x8d')](_0x3e4ac7);}})['then'](function(){return _0x44f3d0;})[_0x5369('0x29')](respondWithResult(_0x4b8746,null))['catch'](handleError(_0x4b8746,null));};exports[_0x5369('0x92')]=function(_0xa39216,_0x504513,_0xbe5c8c){return db[_0x5369('0x4a')][_0x5369('0x33')]({'where':{'id':_0xa39216['params']['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x504513,null))[_0x5369('0x29')](function(_0x152571){if(_0x152571){return _0x152571['removeAgents'](_0xa39216[_0x5369('0x3b')][_0x5369('0x90')])[_0x5369('0x29')](function(){if(_[_0x5369('0x96')](_0xa39216[_0x5369('0x3b')][_0x5369('0x90')])){for(var _0x29b258=0x0;_0x29b258<_0xa39216[_0x5369('0x3b')][_0x5369('0x90')][_0x5369('0x3f')];_0x29b258+=0x1){socket[_0x5369('0x94')](_0x5369('0x97'),{'UserId':Number(_0xa39216[_0x5369('0x3b')][_0x5369('0x90')][_0x29b258]),'VoiceQueueId':Number(_0xa39216[_0x5369('0x51')]['id'])});}}else{socket[_0x5369('0x94')](_0x5369('0x97'),{'UserId':Number(_0xa39216['query']['ids']),'VoiceQueueId':Number(_0xa39216[_0x5369('0x51')]['id'])});}});}})[_0x5369('0x29')](function(_0x8bf7cd){return db[_0x5369('0x79')][_0x5369('0x2a')]({'where':{'VoiceQueueId':_0xa39216[_0x5369('0x51')]['id'],'UserId':_0xa39216[_0x5369('0x3b')][_0x5369('0x90')]}})[_0x5369('0x29')](function(){return _0x8bf7cd;});})['then'](respondWithStatusCode(_0x504513,null))[_0x5369('0x4f')](handleError(_0x504513,null));};exports[_0x5369('0x98')]=function(_0x52f1ac,_0x531f7b,_0x117bad){var _0xab2d14={};var _0x43d431={};var _0x365db0;var _0x558aed;return db[_0x5369('0x4a')]['findOne']({'where':{'id':_0x52f1ac[_0x5369('0x51')]['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x531f7b,null))[_0x5369('0x29')](function(_0x171c7f){if(_0x171c7f){_0x365db0=_0x171c7f;_0x43d431[_0x5369('0x39')]=_[_0x5369('0x3a')](db[_0x5369('0x7f')]['rawAttributes']);_0x43d431['query']=_['keys'](_0x52f1ac[_0x5369('0x3b')]);_0x43d431[_0x5369('0x45')]=_[_0x5369('0x3c')](_0x43d431['model'],_0x43d431[_0x5369('0x3b')]);_0xab2d14[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x43d431['model'],qs['fields'](_0x52f1ac[_0x5369('0x3b')][_0x5369('0x3e')]));_0xab2d14[_0x5369('0x3d')]=_0xab2d14['attributes'][_0x5369('0x3f')]?_0xab2d14[_0x5369('0x3d')]:_0x43d431['model'];_0xab2d14[_0x5369('0x42')]=qs['sort'](_0x52f1ac['query'][_0x5369('0x43')]);_0xab2d14['where']=qs[_0x5369('0x45')](_[_0x5369('0x46')](_0x52f1ac[_0x5369('0x3b')],_0x43d431[_0x5369('0x45')]));if(_0x52f1ac[_0x5369('0x3b')]['filter']){_0xab2d14[_0x5369('0x44')]=_[_0x5369('0x47')](_0xab2d14[_0x5369('0x44')],{'$or':_[_0x5369('0x30')](_0xab2d14[_0x5369('0x3d')],function(_0x2de5fe){var _0x48a784={};_0x48a784[_0x2de5fe]={'$like':'%'+_0x52f1ac[_0x5369('0x3b')][_0x5369('0x2e')]+'%'};return _0x48a784;})});}_0xab2d14=_[_0x5369('0x47')]({},_0xab2d14,_0x52f1ac[_0x5369('0x52')]);return _0x365db0[_0x5369('0x98')](_0xab2d14);}})[_0x5369('0x29')](function(_0x23845a){if(_0x23845a){_0x558aed=_0x23845a[_0x5369('0x3f')];if(!_0x52f1ac[_0x5369('0x3b')][_0x5369('0x40')](_0x5369('0x41'))){_0xab2d14['limit']=qs['limit'](_0x52f1ac['query'][_0x5369('0x22')]);_0xab2d14[_0x5369('0x21')]=qs['offset'](_0x52f1ac['query'][_0x5369('0x21')]);}return _0x365db0['getAgents'](_0xab2d14);}})[_0x5369('0x29')](function(_0x49ab51){if(_0x49ab51){return _0x49ab51?{'count':_0x558aed,'rows':_0x49ab51}:null;}})[_0x5369('0x29')](respondWithResult(_0x531f7b,null))['catch'](handleError(_0x531f7b,null));};exports[_0x5369('0x99')]=function(_0x1eefbd,_0x3b0633,_0x44b55b){var _0x8364f9={};var _0x5e9f5b={};var _0x5e5091;var _0x38540a;return db['VoiceQueue'][_0x5369('0x64')]({'where':{'id':_0x1eefbd['params']['id']}})['then'](handleEntityNotFound(_0x3b0633,null))[_0x5369('0x29')](function(_0x24d11a){if(_0x24d11a){_0x5e5091=_0x24d11a;_0x5e9f5b[_0x5369('0x39')]=_['keys'](db['UserVoiceQueueRt'][_0x5369('0x38')]);_0x5e9f5b[_0x5369('0x3b')]=_[_0x5369('0x3a')](_0x1eefbd[_0x5369('0x3b')]);_0x5e9f5b[_0x5369('0x45')]=_[_0x5369('0x3c')](_0x5e9f5b[_0x5369('0x39')],_0x5e9f5b[_0x5369('0x3b')]);_0x8364f9[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x5e9f5b[_0x5369('0x39')],qs[_0x5369('0x3e')](_0x1eefbd[_0x5369('0x3b')][_0x5369('0x3e')]));_0x8364f9[_0x5369('0x3d')]=_0x8364f9[_0x5369('0x3d')][_0x5369('0x3f')]?_0x8364f9[_0x5369('0x3d')]:_0x5e9f5b[_0x5369('0x39')];_0x8364f9[_0x5369('0x42')]=qs[_0x5369('0x43')](_0x1eefbd[_0x5369('0x3b')][_0x5369('0x43')]);_0x8364f9['where']=qs[_0x5369('0x45')](_[_0x5369('0x46')](_0x1eefbd[_0x5369('0x3b')],_0x5e9f5b[_0x5369('0x45')]));if(_0x1eefbd[_0x5369('0x3b')][_0x5369('0x2e')]){_0x8364f9['where']=_[_0x5369('0x47')](_0x8364f9[_0x5369('0x44')],{'$or':_[_0x5369('0x30')](_0x8364f9[_0x5369('0x3d')],function(_0x17bb51){var _0x1669f7={};_0x1669f7[_0x17bb51]={'$like':'%'+_0x1eefbd['query'][_0x5369('0x2e')]+'%'};return _0x1669f7;})});}_0x8364f9=_[_0x5369('0x47')]({},_0x8364f9,_0x1eefbd[_0x5369('0x52')]);return _0x5e5091[_0x5369('0x99')](_0x8364f9);}})[_0x5369('0x29')](function(_0x51c002){if(_0x51c002){_0x38540a=_0x51c002[_0x5369('0x3f')];if(!_0x1eefbd[_0x5369('0x3b')][_0x5369('0x40')]('nolimit')){_0x8364f9[_0x5369('0x22')]=qs[_0x5369('0x22')](_0x1eefbd[_0x5369('0x3b')]['limit']);_0x8364f9[_0x5369('0x21')]=qs[_0x5369('0x21')](_0x1eefbd[_0x5369('0x3b')][_0x5369('0x21')]);}return _0x5e5091[_0x5369('0x99')](_0x8364f9);}})[_0x5369('0x29')](function(_0x3c5759){return _0x3c5759?{'count':_0x38540a,'rows':_0x3c5759}:null;})['then'](respondWithResult(_0x3b0633,null))[_0x5369('0x4f')](handleError(_0x3b0633,null));};exports[_0x5369('0x9a')]=function(_0x8bf422,_0x32e4ee,_0x53cfbe){var _0x245819={};var _0x20b51b={};var _0x4893ef;var _0x43d15f;return db[_0x5369('0x4a')]['findOne']({'where':{'id':_0x8bf422[_0x5369('0x51')]['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x32e4ee,null))['then'](function(_0x163844){if(_0x163844){_0x4893ef=_0x163844;_0x20b51b[_0x5369('0x39')]=_['keys'](db['CmList']['rawAttributes']);_0x20b51b[_0x5369('0x3b')]=_['keys'](_0x8bf422[_0x5369('0x3b')]);_0x20b51b['filters']=_[_0x5369('0x3c')](_0x20b51b['model'],_0x20b51b['query']);_0x245819['attributes']=_[_0x5369('0x3c')](_0x20b51b['model'],qs[_0x5369('0x3e')](_0x8bf422[_0x5369('0x3b')][_0x5369('0x3e')]));_0x245819[_0x5369('0x3d')]=_0x245819[_0x5369('0x3d')][_0x5369('0x3f')]?_0x245819[_0x5369('0x3d')]:_0x20b51b[_0x5369('0x39')];_0x245819[_0x5369('0x42')]=qs[_0x5369('0x43')](_0x8bf422[_0x5369('0x3b')][_0x5369('0x43')]);_0x245819[_0x5369('0x44')]=qs[_0x5369('0x45')](_[_0x5369('0x46')](_0x8bf422[_0x5369('0x3b')],_0x20b51b['filters']));if(_0x8bf422[_0x5369('0x3b')][_0x5369('0x2e')]){_0x245819['where']=_[_0x5369('0x47')](_0x245819[_0x5369('0x44')],{'$or':_[_0x5369('0x30')](_0x245819[_0x5369('0x3d')],function(_0x1d5e3f){var _0x58d871={};_0x58d871[_0x1d5e3f]={'$like':'%'+_0x8bf422[_0x5369('0x3b')][_0x5369('0x2e')]+'%'};return _0x58d871;})});}_0x245819=_[_0x5369('0x47')]({},_0x245819,_0x8bf422['options']);return _0x4893ef[_0x5369('0x9a')](_0x245819);}})[_0x5369('0x29')](function(_0x31a43b){if(_0x31a43b){_0x43d15f=_0x31a43b[_0x5369('0x3f')];if(!_0x8bf422[_0x5369('0x3b')]['hasOwnProperty'](_0x5369('0x41'))){_0x245819['limit']=qs[_0x5369('0x22')](_0x8bf422[_0x5369('0x3b')]['limit']);_0x245819['offset']=qs['offset'](_0x8bf422[_0x5369('0x3b')][_0x5369('0x21')]);}return _0x4893ef[_0x5369('0x9a')](_0x245819);}})[_0x5369('0x29')](function(_0x4f229f){if(_0x4f229f){return _0x4f229f?{'count':_0x43d15f,'rows':_0x4f229f}:null;}})[_0x5369('0x29')](respondWithResult(_0x32e4ee,null))[_0x5369('0x4f')](handleError(_0x32e4ee,null));};exports['addLists']=function(_0x2d5159,_0x36a250,_0x506c6d){var _0x81ce1b,_0x41fa69;return db['VoiceQueue']['find']({'where':{'id':_0x2d5159[_0x5369('0x51')]['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x36a250,null))[_0x5369('0x29')](function(_0xa73be6){if(_0xa73be6){_0x41fa69=_0xa73be6;return _0xa73be6[_0x5369('0x9b')](_0x2d5159[_0x5369('0x54')][_0x5369('0x90')],_[_0x5369('0x5f')](_0x2d5159['body'],[_0x5369('0x90'),'id'])||{});}return null;})[_0x5369('0x9c')](function(_0x301ff1){var _0x282e4e;_0x81ce1b=_0x301ff1||[];var _0x320de6=[];if(_0x301ff1){for(var _0x340667=0x0;_0x340667<_0x301ff1[_0x5369('0x3f')];_0x340667+=0x1){var _0x3a8a74=_0x301ff1[_0x340667][_0x5369('0x2b')]({'plain':!![]});_0x41fa69['dialCheckDuplicateType']=_0x2d5159[_0x5369('0x54')][_0x5369('0x9d')]?_0x2d5159[_0x5369('0x54')][_0x5369('0x9d')]:_0x41fa69['dialCheckDuplicateType'];switch(_0x41fa69[_0x5369('0x9d')]){case'always':_0x282e4e=squel[_0x5369('0x9e')]()[_0x5369('0x9f')](_0x5369('0xa0'))[_0x5369('0xa1')](['phone',_0x5369('0xa2'),_0x5369('0xa3'),_0x5369('0xa4'),_0x5369('0x65'),_0x5369('0x60'),_0x5369('0x61')],squel[_0x5369('0xa5')]()['field']('phone',_0x5369('0xa6'))[_0x5369('0xa7')](_0x5369('0xa8'),_0x5369('0xa2'))[_0x5369('0xa7')]('id',_0x5369('0xa3'))[_0x5369('0xa7')](_0x3a8a74[_0x5369('0xa9')][_0x5369('0x87')](),_0x5369('0xa4'))[_0x5369('0xa7')](_0x2d5159[_0x5369('0x51')]['id']['toString'](),_0x5369('0x65'))[_0x5369('0xa7')](_0x5369('0xa8'),_0x5369('0x60'))[_0x5369('0xa7')]('NOW()','updatedAt')[_0x5369('0x81')](_0x5369('0xaa'))['where'](_0x5369('0xab'))[_0x5369('0x44')](_0x5369('0xac'),_0x3a8a74[_0x5369('0xa9')][_0x5369('0x87')]())[_0x5369('0x44')](_0x5369('0xad'))['where'](_0x5369('0xae'),squel[_0x5369('0xa5')]()['field'](_0x5369('0xaf'))[_0x5369('0x81')](_0x5369('0xb0'))[_0x5369('0x44')](_0x5369('0x84'),_0x2d5159['params']['id'][_0x5369('0x87')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5369('0xa7')](_0x5369('0xb1'))[_0x5369('0x81')](_0x5369('0xa0'))['where'](_0x5369('0x84'),_0x2d5159['params']['id']['toString']())))[_0x5369('0x87')]();break;case'onlyIfOpen':_0x282e4e=squel['insert']()['into'](_0x5369('0xa0'))[_0x5369('0xa1')]([_0x5369('0xa6'),'scheduledAt',_0x5369('0xa3'),_0x5369('0xa4'),'VoiceQueueId',_0x5369('0x60'),_0x5369('0x61')],squel['select']()[_0x5369('0xa7')](_0x5369('0xa6'),_0x5369('0xa6'))['field'](_0x5369('0xa8'),_0x5369('0xa2'))[_0x5369('0xa7')]('id',_0x5369('0xa3'))[_0x5369('0xa7')](_0x3a8a74[_0x5369('0xa9')]['toString'](),_0x5369('0xa4'))[_0x5369('0xa7')](_0x2d5159[_0x5369('0x51')]['id'][_0x5369('0x87')](),_0x5369('0x65'))[_0x5369('0xa7')](_0x5369('0xa8'),_0x5369('0x60'))['field'](_0x5369('0xa8'),_0x5369('0x61'))[_0x5369('0x81')](_0x5369('0xaa'))['where'](_0x5369('0xab'))['where'](_0x5369('0xac'),_0x3a8a74[_0x5369('0xa9')][_0x5369('0x87')]())[_0x5369('0x44')](_0x5369('0xad'))[_0x5369('0x44')](_0x5369('0xae'),squel[_0x5369('0xa5')]()['field'](_0x5369('0xb1'))['from'](_0x5369('0xa0'))[_0x5369('0x44')]('VoiceQueueId\x20=\x20?',_0x2d5159[_0x5369('0x51')]['id']['toString']())))[_0x5369('0x87')]();break;default:_0x282e4e=squel['insert']()[_0x5369('0x9f')](_0x5369('0xa0'))['fromQuery'](['phone',_0x5369('0xa2'),_0x5369('0xa3'),'ListId',_0x5369('0x65'),_0x5369('0x60'),_0x5369('0x61')],squel['select']()[_0x5369('0xa7')](_0x5369('0xa6'),'phone')['field'](_0x5369('0xa8'),'scheduledAt')[_0x5369('0xa7')]('id','ContactId')[_0x5369('0xa7')](_0x3a8a74[_0x5369('0xa9')]['toString'](),'ListId')['field'](_0x2d5159['params']['id'][_0x5369('0x87')](),'VoiceQueueId')['field']('NOW()',_0x5369('0x60'))[_0x5369('0xa7')](_0x5369('0xa8'),_0x5369('0x61'))[_0x5369('0x81')](_0x5369('0xaa'))['where']('deletedAt\x20IS\x20NULL')[_0x5369('0x44')](_0x5369('0xac'),_0x3a8a74[_0x5369('0xa9')]['toString']())[_0x5369('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x320de6[_0x5369('0x86')](db[_0x5369('0x75')][_0x5369('0x3b')](_0x282e4e));}return BPromise[_0x5369('0x8d')](_0x320de6);}})[_0x5369('0x29')](function(){return _0x81ce1b;})[_0x5369('0x29')](respondWithResult(_0x36a250,null))[_0x5369('0x4f')](handleError(_0x36a250,null));};exports['removeLists']=function(_0xd16afc,_0x2340c5,_0x16168f){return db[_0x5369('0x4a')][_0x5369('0x33')]({'where':{'id':_0xd16afc[_0x5369('0x51')]['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x2340c5,null))[_0x5369('0x29')](function(_0x8f2f6d){if(_0x8f2f6d){return _0x8f2f6d['removeLists'](_0xd16afc[_0x5369('0x3b')][_0x5369('0x90')]);}})['then'](function(_0x11e596){if(_0x11e596){return db[_0x5369('0x66')][_0x5369('0x2a')]({'where':{'ListId':_0xd16afc[_0x5369('0x3b')][_0x5369('0x90')],'VoiceQueueId':_0xd16afc[_0x5369('0x51')]['id']}})[_0x5369('0x29')](function(){return _0x11e596;});}})[_0x5369('0x29')](respondWithStatusCode(_0x2340c5,null))[_0x5369('0x4f')](handleError(_0x2340c5,null));};exports['getBlackLists']=function(_0x302904,_0x543b0a,_0x50f054){var _0x53262d={};var _0x436da8={};var _0x1dcc21;var _0x4463aa;return db[_0x5369('0x4a')][_0x5369('0x64')]({'where':{'id':_0x302904[_0x5369('0x51')]['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x543b0a,null))[_0x5369('0x29')](function(_0xc5d390){if(_0xc5d390){_0x1dcc21=_0xc5d390;_0x436da8[_0x5369('0x39')]=_[_0x5369('0x3a')](db[_0x5369('0xb2')][_0x5369('0x38')]);_0x436da8[_0x5369('0x3b')]=_[_0x5369('0x3a')](_0x302904['query']);_0x436da8[_0x5369('0x45')]=_[_0x5369('0x3c')](_0x436da8['model'],_0x436da8[_0x5369('0x3b')]);_0x53262d[_0x5369('0x3d')]=_[_0x5369('0x3c')](_0x436da8[_0x5369('0x39')],qs[_0x5369('0x3e')](_0x302904['query'][_0x5369('0x3e')]));_0x53262d[_0x5369('0x3d')]=_0x53262d[_0x5369('0x3d')]['length']?_0x53262d[_0x5369('0x3d')]:_0x436da8[_0x5369('0x39')];_0x53262d[_0x5369('0x42')]=qs[_0x5369('0x43')](_0x302904[_0x5369('0x3b')][_0x5369('0x43')]);_0x53262d[_0x5369('0x44')]=qs[_0x5369('0x45')](_['pick'](_0x302904[_0x5369('0x3b')],_0x436da8[_0x5369('0x45')]));if(_0x302904['query'][_0x5369('0x2e')]){_0x53262d[_0x5369('0x44')]=_[_0x5369('0x47')](_0x53262d[_0x5369('0x44')],{'$or':_['map'](_0x53262d[_0x5369('0x3d')],function(_0x5bde23){var _0x24abd2={};_0x24abd2[_0x5bde23]={'$like':'%'+_0x302904[_0x5369('0x3b')]['filter']+'%'};return _0x24abd2;})});}_0x53262d=_[_0x5369('0x47')]({},_0x53262d,_0x302904[_0x5369('0x52')]);return _0x1dcc21['getBlackLists'](_0x53262d);}})[_0x5369('0x29')](function(_0x15715c){if(_0x15715c){_0x4463aa=_0x15715c['length'];if(!_0x302904[_0x5369('0x3b')]['hasOwnProperty'](_0x5369('0x41'))){_0x53262d[_0x5369('0x22')]=qs['limit'](_0x302904[_0x5369('0x3b')][_0x5369('0x22')]);_0x53262d[_0x5369('0x21')]=qs[_0x5369('0x21')](_0x302904[_0x5369('0x3b')][_0x5369('0x21')]);}return _0x1dcc21[_0x5369('0xb3')](_0x53262d);}})['then'](function(_0x4ddeb5){if(_0x4ddeb5){return _0x4ddeb5?{'count':_0x4463aa,'rows':_0x4ddeb5}:null;}})['then'](respondWithResult(_0x543b0a,null))[_0x5369('0x4f')](handleError(_0x543b0a,null));};exports['addBlackLists']=function(_0xb4854b,_0x5c7239,_0x4152d5){var _0x1b4548,_0x31c5ec;return db['VoiceQueue']['find']({'where':{'id':_0xb4854b['params']['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x5c7239,null))[_0x5369('0x29')](function(_0x2cf41b){if(_0x2cf41b){_0x31c5ec=_0x2cf41b;return _0x2cf41b[_0x5369('0xb4')](_0xb4854b[_0x5369('0x54')][_0x5369('0x90')],_[_0x5369('0x5f')](_0xb4854b[_0x5369('0x54')],[_0x5369('0x90'),'id'])||{});}return null;})[_0x5369('0x9c')](function(_0x5b6162){var _0xda7981;_0x1b4548=_0x5b6162||[];var _0x3d9081=[];if(_0x5b6162){for(var _0x31ef65=0x0;_0x31ef65<_0x5b6162[_0x5369('0x3f')];_0x31ef65+=0x1){var _0x1f4daa=_0x5b6162[_0x31ef65]['get']({'plain':!![]});_0xda7981=squel['insert']()['into'](_0x5369('0xb5'))[_0x5369('0xa1')](['phone',_0x5369('0xa3'),_0x5369('0xa4'),_0x5369('0x65'),_0x5369('0x60'),_0x5369('0x61')],squel[_0x5369('0xa5')]()[_0x5369('0xa7')](_0x5369('0xa6'),_0x5369('0xa6'))[_0x5369('0xa7')]('id',_0x5369('0xa3'))['field'](_0x1f4daa['CmListId'][_0x5369('0x87')](),'ListId')[_0x5369('0xa7')](_0xb4854b[_0x5369('0x51')]['id'][_0x5369('0x87')](),_0x5369('0x65'))[_0x5369('0xa7')](_0x5369('0xa8'),_0x5369('0x60'))[_0x5369('0xa7')]('NOW()',_0x5369('0x61'))['from'](_0x5369('0xaa'))[_0x5369('0x44')](_0x5369('0xab'))[_0x5369('0x44')](_0x5369('0xac'),_0x1f4daa[_0x5369('0xa9')][_0x5369('0x87')]())['where'](_0x5369('0xad')))[_0x5369('0x87')]();_0x3d9081['push'](db['sequelize']['query'](_0xda7981));}return BPromise[_0x5369('0x8d')](_0x3d9081);}})['then'](function(){return _0x1b4548;})[_0x5369('0x29')](respondWithResult(_0x5c7239,null))[_0x5369('0x4f')](handleError(_0x5c7239,null));};exports['removeBlackLists']=function(_0x2e561c,_0x10b8c0,_0x28e6fb){return db[_0x5369('0x4a')][_0x5369('0x33')]({'where':{'id':_0x2e561c['params']['id']}})[_0x5369('0x29')](handleEntityNotFound(_0x10b8c0,null))['then'](function(_0x4d6e71){if(_0x4d6e71){return _0x4d6e71[_0x5369('0xb6')](_0x2e561c['query']['ids']);}})[_0x5369('0x29')](function(_0x2e4627){if(_0x2e4627){return db['CmHopperBlack'][_0x5369('0x2a')]({'where':{'ListId':_0x2e561c[_0x5369('0x3b')][_0x5369('0x90')],'VoiceQueueId':_0x2e561c['params']['id']}})[_0x5369('0x29')](function(){return _0x2e4627;});}})[_0x5369('0x29')](respondWithStatusCode(_0x10b8c0,null))[_0x5369('0x4f')](handleError(_0x10b8c0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 90d7209..20b4bd2 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 _0x899c=['hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x1f7bda,_0x3f1d6c){var _0x5752e1=function(_0x249318){while(--_0x249318){_0x1f7bda['push'](_0x1f7bda['shift']());}};_0x5752e1(++_0x3f1d6c);}(_0x899c,0x174));var _0xc899=function(_0x43bed9,_0x26adca){_0x43bed9=_0x43bed9-0x0;var _0x27b03d=_0x899c[_0x43bed9];return _0x27b03d;};'use strict';var EventEmitter=require(_0xc899('0x0'));var VoiceQueue=require(_0xc899('0x1'))['db'][_0xc899('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc899('0x3')](0x0);var events={'afterCreate':_0xc899('0x4'),'afterUpdate':_0xc899('0x5'),'afterDestroy':_0xc899('0x6')};function emitEvent(_0x5d6739){return function(_0xd810b6,_0x5bb875,_0x1157e8){VoiceQueueEvents[_0xc899('0x7')](_0x5d6739+':'+_0xd810b6['id'],_0xd810b6);VoiceQueueEvents[_0xc899('0x7')](_0x5d6739,_0xd810b6);_0x1157e8(null);};}for(var e in events){if(events[_0xc899('0x8')](e)){var event=events[e];VoiceQueue[_0xc899('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xdf94=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','save'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0xdf94,0x83));var _0x4df9=function(_0x2018c0,_0x5a91f0){_0x2018c0=_0x2018c0-0x0;var _0x2e0ddd=_0xdf94[_0x2018c0];return _0x2e0ddd;};'use strict';var EventEmitter=require(_0x4df9('0x0'));var VoiceQueue=require(_0x4df9('0x1'))['db'][_0x4df9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4df9('0x3'),'afterUpdate':_0x4df9('0x4'),'afterDestroy':_0x4df9('0x5')};function emitEvent(_0x5af0ad){return function(_0x18fea4,_0x525434,_0x9a4da2){VoiceQueueEvents[_0x4df9('0x6')](_0x5af0ad+':'+_0x18fea4['id'],_0x18fea4);VoiceQueueEvents[_0x4df9('0x6')](_0x5af0ad,_0x18fea4);_0x9a4da2(null);};}for(var e in events){if(events[_0x4df9('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x4df9('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 32d7aa7..7a23ef6 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 _0xd493=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','VoiceQueue','lodash'];(function(_0x541acc,_0x2cd754){var _0xe03f6c=function(_0x528343){while(--_0x528343){_0x541acc['push'](_0x541acc['shift']());}};_0xe03f6c(++_0x2cd754);}(_0xd493,0x1ad));var _0x3d49=function(_0x274cfb,_0xc79238){_0x274cfb=_0x274cfb-0x0;var _0x7e2c9d=_0xd493[_0x274cfb];return _0x7e2c9d;};'use strict';var _=require(_0x3d49('0x0'));var util=require(_0x3d49('0x1'));var logger=require(_0x3d49('0x2'))('api');var moment=require(_0x3d49('0x3'));var BPromise=require('bluebird');var rp=require(_0x3d49('0x4'));var fs=require('fs');var path=require(_0x3d49('0x5'));var rimraf=require(_0x3d49('0x6'));var config=require(_0x3d49('0x7'));var attributes=require('./voiceQueue.attributes');module[_0x3d49('0x8')]=function(_0x4cd606,_0x5ae5a4){return _0x4cd606['define'](_0x3d49('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59fe=['define','VoiceQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x178442,_0x300791){var _0x3f870a=function(_0x43cbe8){while(--_0x43cbe8){_0x178442['push'](_0x178442['shift']());}};_0x3f870a(++_0x300791);}(_0x59fe,0x154));var _0xe59f=function(_0x26a781,_0x730726){_0x26a781=_0x26a781-0x0;var _0xd9e5b3=_0x59fe[_0x26a781];return _0xd9e5b3;};'use strict';var _=require(_0xe59f('0x0'));var util=require('util');var logger=require(_0xe59f('0x1'))(_0xe59f('0x2'));var moment=require(_0xe59f('0x3'));var BPromise=require(_0xe59f('0x4'));var rp=require(_0xe59f('0x5'));var fs=require('fs');var path=require(_0xe59f('0x6'));var rimraf=require(_0xe59f('0x7'));var config=require(_0xe59f('0x8'));var attributes=require(_0xe59f('0x9'));module[_0xe59f('0xa')]=function(_0xfa59c,_0x1ccd6f){return _0xfa59c[_0xe59f('0xb')](_0xe59f('0xc'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0917a96..2297502 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 _0xa2a0=['VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','options','raw','where','attributes','limit','map','include','model','catch','ShowVoiceQueue','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info'];(function(_0x2319d6,_0x9bd027){var _0x4bb229=function(_0x505241){while(--_0x505241){_0x2319d6['push'](_0x2319d6['shift']());}};_0x4bb229(++_0x9bd027);}(_0xa2a0,0xc7));var _0x0a2a=function(_0x4ddb13,_0x4131eb){_0x4ddb13=_0x4ddb13-0x0;var _0x41ec67=_0xa2a0[_0x4ddb13];return _0x41ec67;};'use strict';var _=require(_0x0a2a('0x0'));var util=require('util');var moment=require(_0x0a2a('0x1'));var BPromise=require(_0x0a2a('0x2'));var rs=require(_0x0a2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a2a('0x4'))['db'];var utils=require(_0x0a2a('0x5'));var logger=require('../../config/logger')(_0x0a2a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a2a('0x7')][_0x0a2a('0x8')]({'port':0x232a});config[_0x0a2a('0x9')]=_[_0x0a2a('0xa')](config[_0x0a2a('0x9')],{'host':_0x0a2a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a2a('0xc'))[_0x0a2a('0xd')](socket);function respondWithRpcPromise(_0x3c9010,_0x13ee95,_0x3e76f4){return new BPromise(function(_0xf4ab3,_0x16e536){return client[_0x0a2a('0xe')](_0x3c9010,_0x3e76f4)[_0x0a2a('0xf')](function(_0x485828){logger[_0x0a2a('0x10')](_0x0a2a('0x11'),_0x13ee95,_0x0a2a('0x12'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x13ee95,'request\x20sent',JSON[_0x0a2a('0x13')](_0x485828));if(_0x485828[_0x0a2a('0x14')]){if(_0x485828['error'][_0x0a2a('0x15')]===0x1f4){logger[_0x0a2a('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x13ee95,_0x485828[_0x0a2a('0x14')][_0x0a2a('0x16')]);return _0x16e536(_0x485828[_0x0a2a('0x14')]['message']);}logger[_0x0a2a('0x14')](_0x0a2a('0x11'),_0x13ee95,_0x485828[_0x0a2a('0x14')][_0x0a2a('0x16')]);return _0xf4ab3(_0x485828[_0x0a2a('0x14')][_0x0a2a('0x16')]);}else{logger['info'](_0x0a2a('0x11'),_0x13ee95,_0x0a2a('0x12'));_0xf4ab3(_0x485828[_0x0a2a('0x17')][_0x0a2a('0x16')]);}})['catch'](function(_0xa8c63a){logger[_0x0a2a('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x13ee95,_0xa8c63a);_0x16e536(_0xa8c63a);});});}exports[_0x0a2a('0x18')]=function(_0x4d54fe){var _0x50f8a3=this;return new Promise(function(_0x40ab77,_0x41d2f3){return db['VoiceQueue']['findAll']({'raw':_0x4d54fe[_0x0a2a('0x19')]?_0x4d54fe[_0x0a2a('0x19')][_0x0a2a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d54fe[_0x0a2a('0x19')]?_0x4d54fe[_0x0a2a('0x19')][_0x0a2a('0x1b')]||null:null,'attributes':_0x4d54fe[_0x0a2a('0x19')]?_0x4d54fe[_0x0a2a('0x19')][_0x0a2a('0x1c')]||null:null,'limit':_0x4d54fe[_0x0a2a('0x19')]?_0x4d54fe[_0x0a2a('0x19')][_0x0a2a('0x1d')]||null:null,'include':_0x4d54fe['options']?_0x4d54fe[_0x0a2a('0x19')]['include']?_[_0x0a2a('0x1e')](_0x4d54fe[_0x0a2a('0x19')][_0x0a2a('0x1f')],function(_0x871bef){return{'model':db[_0x871bef['model']],'as':_0x871bef['as'],'attributes':_0x871bef[_0x0a2a('0x1c')],'include':_0x871bef['include']?_[_0x0a2a('0x1e')](_0x871bef[_0x0a2a('0x1f')],function(_0x1873bb){return{'model':db[_0x1873bb['model']],'as':_0x1873bb['as'],'attributes':_0x1873bb[_0x0a2a('0x1c')],'include':_0x1873bb['include']?_[_0x0a2a('0x1e')](_0x1873bb[_0x0a2a('0x1f')],function(_0x1b67df){return{'model':db[_0x1b67df[_0x0a2a('0x20')]],'as':_0x1b67df['as'],'attributes':_0x1b67df[_0x0a2a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0a2a('0xf')](function(_0x1a1367){logger[_0x0a2a('0x10')](_0x0a2a('0x18'),_0x4d54fe);logger['debug']('GetVoiceQueue',_0x4d54fe,JSON[_0x0a2a('0x13')](_0x1a1367));_0x40ab77(_0x1a1367);})[_0x0a2a('0x21')](function(_0x1df7be){logger['error']('GetVoiceQueue',_0x1df7be[_0x0a2a('0x16')],_0x4d54fe);_0x41d2f3(_0x50f8a3[_0x0a2a('0x14')](0x1f4,_0x1df7be['message']));});});};exports[_0x0a2a('0x22')]=function(_0x222890){var _0x57f24d=this;return new Promise(function(_0x4af3f6,_0x2e1121){return db['VoiceQueue']['find']({'raw':_0x222890[_0x0a2a('0x19')]?_0x222890[_0x0a2a('0x19')][_0x0a2a('0x1a')]===undefined?!![]:![]:!![],'where':_0x222890[_0x0a2a('0x19')]?_0x222890[_0x0a2a('0x19')]['where']||null:null,'attributes':_0x222890[_0x0a2a('0x19')]?_0x222890[_0x0a2a('0x19')][_0x0a2a('0x1c')]||null:null,'include':_0x222890[_0x0a2a('0x19')]?_0x222890[_0x0a2a('0x19')][_0x0a2a('0x1f')]?_[_0x0a2a('0x1e')](_0x222890[_0x0a2a('0x19')][_0x0a2a('0x1f')],function(_0x1192f6){return{'model':db[_0x1192f6[_0x0a2a('0x20')]],'as':_0x1192f6['as'],'attributes':_0x1192f6[_0x0a2a('0x1c')],'include':_0x1192f6[_0x0a2a('0x1f')]?_[_0x0a2a('0x1e')](_0x1192f6['include'],function(_0x56b5d5){return{'model':db[_0x56b5d5['model']],'as':_0x56b5d5['as'],'attributes':_0x56b5d5[_0x0a2a('0x1c')],'include':_0x56b5d5[_0x0a2a('0x1f')]?_[_0x0a2a('0x1e')](_0x56b5d5[_0x0a2a('0x1f')],function(_0x249877){return{'model':db[_0x249877[_0x0a2a('0x20')]],'as':_0x249877['as'],'attributes':_0x249877['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a2a('0xf')](function(_0x45994f){logger[_0x0a2a('0x10')](_0x0a2a('0x22'),_0x222890);logger[_0x0a2a('0x23')](_0x0a2a('0x22'),_0x222890,JSON['stringify'](_0x45994f));_0x4af3f6(_0x45994f);})[_0x0a2a('0x21')](function(_0x3838f5){logger[_0x0a2a('0x14')](_0x0a2a('0x22'),_0x3838f5['message'],_0x222890);_0x2e1121(_0x57f24d[_0x0a2a('0x14')](0x1f4,_0x3838f5['message']));});});}; \ No newline at end of file +var _0x2b49=['socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','include','map','attributes','model','debug','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost'];(function(_0xa7fe3f,_0x4d5b4c){var _0x213637=function(_0x3c7134){while(--_0x3c7134){_0xa7fe3f['push'](_0xa7fe3f['shift']());}};_0x213637(++_0x4d5b4c);}(_0x2b49,0x95));var _0x92b4=function(_0x2771e9,_0x18848a){_0x2771e9=_0x2771e9-0x0;var _0x5e6b06=_0x2b49[_0x2771e9];return _0x5e6b06;};'use strict';var _=require(_0x92b4('0x0'));var util=require(_0x92b4('0x1'));var moment=require(_0x92b4('0x2'));var BPromise=require(_0x92b4('0x3'));var rs=require(_0x92b4('0x4'));var fs=require('fs');var Redis=require(_0x92b4('0x5'));var db=require(_0x92b4('0x6'))['db'];var utils=require(_0x92b4('0x7'));var logger=require(_0x92b4('0x8'))(_0x92b4('0x9'));var config=require('../../config/environment');var jayson=require(_0x92b4('0xa'));var client=jayson[_0x92b4('0xb')][_0x92b4('0xc')]({'port':0x232a});config[_0x92b4('0xd')]=_['defaults'](config['redis'],{'host':_0x92b4('0xe'),'port':0x18eb});var socket=require(_0x92b4('0xf'))(new Redis(config[_0x92b4('0xd')]));require(_0x92b4('0x10'))[_0x92b4('0x11')](socket);function respondWithRpcPromise(_0x5c94e2,_0x403b5c,_0x276422){return new BPromise(function(_0x1b99e7,_0x35d17e){return client[_0x92b4('0x12')](_0x5c94e2,_0x276422)[_0x92b4('0x13')](function(_0x12a0f7){logger[_0x92b4('0x14')](_0x92b4('0x15'),_0x403b5c,_0x92b4('0x16'));logger['debug'](_0x92b4('0x17'),_0x403b5c,_0x92b4('0x16'),JSON[_0x92b4('0x18')](_0x12a0f7));if(_0x12a0f7['error']){if(_0x12a0f7[_0x92b4('0x19')]['code']===0x1f4){logger[_0x92b4('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x403b5c,_0x12a0f7[_0x92b4('0x19')][_0x92b4('0x1a')]);return _0x35d17e(_0x12a0f7['error'][_0x92b4('0x1a')]);}logger[_0x92b4('0x19')](_0x92b4('0x15'),_0x403b5c,_0x12a0f7[_0x92b4('0x19')][_0x92b4('0x1a')]);return _0x1b99e7(_0x12a0f7[_0x92b4('0x19')]['message']);}else{logger['info'](_0x92b4('0x15'),_0x403b5c,_0x92b4('0x16'));_0x1b99e7(_0x12a0f7[_0x92b4('0x1b')][_0x92b4('0x1a')]);}})[_0x92b4('0x1c')](function(_0x3bf90c){logger[_0x92b4('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x403b5c,_0x3bf90c);_0x35d17e(_0x3bf90c);});});}exports[_0x92b4('0x1d')]=function(_0x30db75){var _0x7a40a1=this;return new Promise(function(_0x35d530,_0x33aaa7){return db[_0x92b4('0x1e')]['findAll']({'raw':_0x30db75[_0x92b4('0x1f')]?_0x30db75[_0x92b4('0x1f')][_0x92b4('0x20')]===undefined?!![]:![]:!![],'where':_0x30db75['options']?_0x30db75[_0x92b4('0x1f')][_0x92b4('0x21')]||null:null,'attributes':_0x30db75[_0x92b4('0x1f')]?_0x30db75[_0x92b4('0x1f')]['attributes']||null:null,'limit':_0x30db75[_0x92b4('0x1f')]?_0x30db75[_0x92b4('0x1f')]['limit']||null:null,'include':_0x30db75['options']?_0x30db75[_0x92b4('0x1f')][_0x92b4('0x22')]?_[_0x92b4('0x23')](_0x30db75[_0x92b4('0x1f')]['include'],function(_0x356114){return{'model':db[_0x356114['model']],'as':_0x356114['as'],'attributes':_0x356114[_0x92b4('0x24')],'include':_0x356114[_0x92b4('0x22')]?_['map'](_0x356114[_0x92b4('0x22')],function(_0x122b6a){return{'model':db[_0x122b6a[_0x92b4('0x25')]],'as':_0x122b6a['as'],'attributes':_0x122b6a[_0x92b4('0x24')],'include':_0x122b6a[_0x92b4('0x22')]?_[_0x92b4('0x23')](_0x122b6a['include'],function(_0x4d4da4){return{'model':db[_0x4d4da4['model']],'as':_0x4d4da4['as'],'attributes':_0x4d4da4[_0x92b4('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57978c){logger[_0x92b4('0x14')](_0x92b4('0x1d'),_0x30db75);logger[_0x92b4('0x26')]('GetVoiceQueue',_0x30db75,JSON[_0x92b4('0x18')](_0x57978c));_0x35d530(_0x57978c);})[_0x92b4('0x1c')](function(_0x3b2662){logger[_0x92b4('0x19')]('GetVoiceQueue',_0x3b2662[_0x92b4('0x1a')],_0x30db75);_0x33aaa7(_0x7a40a1[_0x92b4('0x19')](0x1f4,_0x3b2662[_0x92b4('0x1a')]));});});};exports[_0x92b4('0x27')]=function(_0xab516c){var _0x72ffe5=this;return new Promise(function(_0x52efa6,_0x41959e){return db[_0x92b4('0x1e')][_0x92b4('0x28')]({'raw':_0xab516c[_0x92b4('0x1f')]?_0xab516c['options'][_0x92b4('0x20')]===undefined?!![]:![]:!![],'where':_0xab516c[_0x92b4('0x1f')]?_0xab516c[_0x92b4('0x1f')][_0x92b4('0x21')]||null:null,'attributes':_0xab516c[_0x92b4('0x1f')]?_0xab516c['options']['attributes']||null:null,'include':_0xab516c[_0x92b4('0x1f')]?_0xab516c['options'][_0x92b4('0x22')]?_[_0x92b4('0x23')](_0xab516c['options']['include'],function(_0x5a45f7){return{'model':db[_0x5a45f7[_0x92b4('0x25')]],'as':_0x5a45f7['as'],'attributes':_0x5a45f7[_0x92b4('0x24')],'include':_0x5a45f7[_0x92b4('0x22')]?_[_0x92b4('0x23')](_0x5a45f7[_0x92b4('0x22')],function(_0x4ba040){return{'model':db[_0x4ba040[_0x92b4('0x25')]],'as':_0x4ba040['as'],'attributes':_0x4ba040[_0x92b4('0x24')],'include':_0x4ba040[_0x92b4('0x22')]?_[_0x92b4('0x23')](_0x4ba040[_0x92b4('0x22')],function(_0x2d70f4){return{'model':db[_0x2d70f4[_0x92b4('0x25')]],'as':_0x2d70f4['as'],'attributes':_0x2d70f4['attributes']};}):[]};}):[]};}):[]:[]})[_0x92b4('0x13')](function(_0x18ea24){logger[_0x92b4('0x14')]('ShowVoiceQueue',_0xab516c);logger[_0x92b4('0x26')](_0x92b4('0x27'),_0xab516c,JSON['stringify'](_0x18ea24));_0x52efa6(_0x18ea24);})[_0x92b4('0x1c')](function(_0x5d85fb){logger[_0x92b4('0x19')](_0x92b4('0x27'),_0x5d85fb[_0x92b4('0x1a')],_0xab516c);_0x41959e(_0x72ffe5[_0x92b4('0x19')](0x1f4,_0x5d85fb[_0x92b4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7100906..2da32cf 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 _0xceee=['emit','removeListener','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x46e30b,_0x4146b0){var _0x12d6ac=function(_0x3a9c26){while(--_0x3a9c26){_0x46e30b['push'](_0x46e30b['shift']());}};_0x12d6ac(++_0x4146b0);}(_0xceee,0xff));var _0xecee=function(_0x121f24,_0x2c49b4){_0x121f24=_0x121f24-0x0;var _0x2ed4bf=_0xceee[_0x121f24];return _0x2ed4bf;};'use strict';var VoiceQueueEvents=require(_0xecee('0x0'));var events=[_0xecee('0x1'),_0xecee('0x2'),_0xecee('0x3')];function createListener(_0x4bff1a,_0x423235){return function(_0x2b580a){_0x423235[_0xecee('0x4')](_0x4bff1a,_0x2b580a);};}function removeListener(_0x3f4b6e,_0x305d2b){return function(){VoiceQueueEvents[_0xecee('0x5')](_0x3f4b6e,_0x305d2b);};}exports['register']=function(_0x2d93df){for(var _0x1951c6=0x0,_0x1135ce=events['length'];_0x1951c6<_0x1135ce;_0x1951c6++){var _0x477ca3=events[_0x1951c6];var _0x2bf1fb=createListener(_0xecee('0x6')+_0x477ca3,_0x2d93df);VoiceQueueEvents['on'](_0x477ca3,_0x2bf1fb);}}; \ No newline at end of file +var _0xaebe=['emit','removeListener','register','./voiceQueue.events','save','remove'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xaebe,0xed));var _0xeaeb=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xaebe[_0x3c8e9a];return _0x2d4c57;};'use strict';var VoiceQueueEvents=require(_0xeaeb('0x0'));var events=[_0xeaeb('0x1'),_0xeaeb('0x2'),'update'];function createListener(_0x5df6de,_0x27ddc8){return function(_0xd4fde){_0x27ddc8[_0xeaeb('0x3')](_0x5df6de,_0xd4fde);};}function removeListener(_0x32642a,_0x4e6464){return function(){VoiceQueueEvents[_0xeaeb('0x4')](_0x32642a,_0x4e6464);};}exports[_0xeaeb('0x5')]=function(_0x2d542c){for(var _0x1a1a6c=0x0,_0x21fd10=events['length'];_0x1a1a6c<_0x21fd10;_0x1a1a6c++){var _0x2fb29c=events[_0x1a1a6c];var _0x4a479c=createListener('voiceQueue:'+_0x2fb29c,_0x2d542c);VoiceQueueEvents['on'](_0x2fb29c,_0x4a479c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index a6f71ce..c2afbbd 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 _0x77d4=['/describe','getVoiceQueuesReport','/:id','show','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x77d4,0x108));var _0x477d=function(_0x250333,_0x25fe43){_0x250333=_0x250333-0x0;var _0x486c36=_0x77d4[_0x250333];return _0x486c36;};'use strict';var multer=require('multer');var util=require(_0x477d('0x0'));var path=require('path');var timeout=require(_0x477d('0x1'));var express=require('express');var router=express[_0x477d('0x2')]();var auth=require(_0x477d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x477d('0x4'));router[_0x477d('0x5')]('/',auth[_0x477d('0x6')](),controller[_0x477d('0x7')]);router[_0x477d('0x5')](_0x477d('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x477d('0x5')]('/index',auth['isAuthenticated'](),controller[_0x477d('0x9')]);router[_0x477d('0x5')](_0x477d('0xa'),auth[_0x477d('0x6')](),controller[_0x477d('0xb')]);router['post']('/',auth[_0x477d('0x6')](),controller['create']);router[_0x477d('0xc')](_0x477d('0xa'),auth['isAuthenticated'](),controller[_0x477d('0xd')]);router[_0x477d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x477d('0xf')]);module[_0x477d('0x10')]=router; \ No newline at end of file +var _0x5d17=['/describe','describe','/index','/:id','post','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d17,0x114));var _0x75d1=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x5d17[_0x3932eb];return _0x5316e5;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0x7')](_0x75d1('0xb'),auth[_0x75d1('0x8')](),controller['getVoiceQueuesReport']);router['get'](_0x75d1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0xd')]('/',auth[_0x75d1('0x8')](),controller['create']);router[_0x75d1('0xe')](_0x75d1('0xc'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')](_0x75d1('0xc'),auth['isAuthenticated'](),controller[_0x75d1('0x11')]);module[_0x75d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 81078e6..9008b61 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 _0x9de0=['holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x9de0,0x148));var _0x09de=function(_0x1d2a07,_0x2b4f41){_0x1d2a07=_0x1d2a07-0x0;var _0xfcb5be=_0x9de0[_0x1d2a07];return _0xfcb5be;};'use strict';var Sequelize=require(_0x09de('0x0'));var moment=require(_0x09de('0x1'));module['exports']={'type':{'type':Sequelize[_0x09de('0x2')]},'uniqueid':{'type':Sequelize[_0x09de('0x2')]},'calleridnum':{'type':Sequelize[_0x09de('0x2')]},'calleridname':{'type':Sequelize[_0x09de('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x09de('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x09de('0x3')],'set':function(_0x10f68f){var _0x4894f3=moment(_0x10f68f);var _0xd6834e=moment(this['getDataValue'](_0x09de('0x4')))['format'](_0x09de('0x5'));var _0x24b5d7=_0x4894f3[_0x09de('0x6')](_0xd6834e,'seconds');this[_0x09de('0x7')]('queuecallerleaveAt',_0x10f68f);this[_0x09de('0x7')](_0x09de('0x8'),_0x24b5d7||null);}},'position':{'type':Sequelize[_0x09de('0x9')]},'count':{'type':Sequelize[_0x09de('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x09de('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x09de('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x09de('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x09de('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x09de('0x2')]},'connectedlinenum':{'type':Sequelize[_0x09de('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x09de('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x09de('0x9')]},'mohtime':{'type':Sequelize[_0x09de('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x09de('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x09de('0x2')],'comment':_0x09de('0xb')},'transferexten':{'type':Sequelize[_0x09de('0x2')]},'transferuniqueid':{'type':Sequelize[_0x09de('0x2')]},'disposition':{'type':Sequelize[_0x09de('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7473=['moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x7473,0xdd));var _0x3747=function(_0x2d125f,_0x36050f){_0x2d125f=_0x2d125f-0x0;var _0x5e2691=_0x7473[_0x2d125f];return _0x5e2691;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3747('0x0'));module['exports']={'type':{'type':Sequelize[_0x3747('0x1')]},'uniqueid':{'type':Sequelize[_0x3747('0x1')]},'calleridnum':{'type':Sequelize[_0x3747('0x1')]},'calleridname':{'type':Sequelize[_0x3747('0x1')]},'queue':{'type':Sequelize[_0x3747('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x3747('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3747('0x2')],'set':function(_0x2be6d4){var _0x1df441=moment(_0x2be6d4);var _0x493a67=moment(this[_0x3747('0x3')](_0x3747('0x4')))[_0x3747('0x5')](_0x3747('0x6'));var _0xbf21a8=_0x1df441[_0x3747('0x7')](_0x493a67,_0x3747('0x8'));this[_0x3747('0x9')]('queuecallerleaveAt',_0x2be6d4);this[_0x3747('0x9')]('holdtime',_0xbf21a8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x3747('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3747('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3747('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3747('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x3747('0x1')],'comment':_0x3747('0xb')},'originalposition':{'type':Sequelize[_0x3747('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3747('0x1')]},'connectedlinename':{'type':Sequelize[_0x3747('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3747('0x1')]},'exten':{'type':Sequelize[_0x3747('0x1')]},'priority':{'type':Sequelize[_0x3747('0x1')]},'holdtime':{'type':Sequelize[_0x3747('0xc')]},'mohtime':{'type':Sequelize[_0x3747('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3747('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3747('0x1')]},'transfer':{'type':Sequelize[_0x3747('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x3747('0x1')]},'disposition':{'type':Sequelize[_0x3747('0x1')]},'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 8ff3492..10a90ab 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 _0x4e5d=['nolimit','limit','order','sort','pick','filter','merge','type','VIRTUAL','field','where','count','include','findAll','rows','params','rawAttributes','length','options','find','catch','create','body','update','describe','getVoiceQueuesReport','map','includeAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','offset','Content-Range','apply','reject','save','destroy','then','stack','name','send','VoiceQueueReport','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4e5d,0xb0));var _0xd4e5=function(_0x540511,_0x201e3b){_0x540511=_0x540511-0x0;var _0x5c1ac6=_0x4e5d[_0x540511];return _0x5c1ac6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd4e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd4e5('0x1'));var jsonpatch=require(_0xd4e5('0x2'));var rp=require(_0xd4e5('0x3'));var moment=require(_0xd4e5('0x4'));var BPromise=require(_0xd4e5('0x5'));var Mustache=require(_0xd4e5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd4e5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd4e5('0x8'));var squel=require(_0xd4e5('0x9'));var crypto=require('crypto');var jsforce=require(_0xd4e5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd4e5('0x7'));var querystring=require('querystring');var Papa=require(_0xd4e5('0xb'));var Redis=require(_0xd4e5('0xc'));var authService=require(_0xd4e5('0xd'));var qs=require(_0xd4e5('0xe'));var hardwareService=require(_0xd4e5('0xf'));var logger=require(_0xd4e5('0x10'))(_0xd4e5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd4e5('0x12'))['db'];config[_0xd4e5('0x13')]=_[_0xd4e5('0x14')](config[_0xd4e5('0x13')],{'host':_0xd4e5('0x15'),'port':0x18eb});var socket=require(_0xd4e5('0x16'))(new Redis(config[_0xd4e5('0x13')]));require(_0xd4e5('0x17'))[_0xd4e5('0x18')](socket);function respondWithStatusCode(_0x353a7f,_0x340952){_0x340952=_0x340952||0xcc;return function(_0x4fd5b1){if(_0x4fd5b1){return _0x353a7f[_0xd4e5('0x19')](_0x340952);}return _0x353a7f['status'](_0x340952)['end']();};}function respondWithResult(_0x201781,_0x4d707f){_0x4d707f=_0x4d707f||0xc8;return function(_0x2a508d){if(_0x2a508d){return _0x201781[_0xd4e5('0x1a')](_0x4d707f)['json'](_0x2a508d);}};}function respondWithFilteredResult(_0x1633e,_0x5f0107){return function(_0x49caee){if(_0x49caee){var _0x3200b6=_0x49caee['count'],_0x1e056e=_0x5f0107[_0xd4e5('0x1b')],_0x13caa7=_0x5f0107[_0xd4e5('0x1b')]+_0x5f0107['limit'],_0x526bb8;if(_0x13caa7>=_0x3200b6){_0x13caa7=_0x3200b6;_0x526bb8=0xc8;}else{_0x526bb8=0xce;}_0x1633e['status'](_0x526bb8);return _0x1633e['set'](_0xd4e5('0x1c'),_0x1e056e+'-'+_0x13caa7+'/'+_0x3200b6)['json'](_0x49caee);}return null;};}function patchUpdates(_0x140c35){return function(_0xf78444){try{jsonpatch[_0xd4e5('0x1d')](_0xf78444,_0x140c35,!![]);}catch(_0x470a29){return BPromise[_0xd4e5('0x1e')](_0x470a29);}return _0xf78444[_0xd4e5('0x1f')]();};}function saveUpdates(_0x720ada,_0x412f95){return function(_0x4778e4){if(_0x4778e4){return _0x4778e4['update'](_0x720ada)['then'](function(_0x5809fc){return _0x5809fc;});}return null;};}function removeEntity(_0x54f16f,_0x374eb5){return function(_0x4d6dd2){if(_0x4d6dd2){return _0x4d6dd2[_0xd4e5('0x20')]()[_0xd4e5('0x21')](function(){_0x54f16f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8a38,_0x56db8a){return function(_0x58a7f7){if(!_0x58a7f7){_0x1d8a38['sendStatus'](0x194);}return _0x58a7f7;};}function handleError(_0x3580ae,_0x28aec7){_0x28aec7=_0x28aec7||0x1f4;return function(_0x3229f6){logger['error'](_0x3229f6[_0xd4e5('0x22')]);if(_0x3229f6[_0xd4e5('0x23')]){delete _0x3229f6[_0xd4e5('0x23')];}_0x3580ae[_0xd4e5('0x1a')](_0x28aec7)[_0xd4e5('0x24')](_0x3229f6);};}exports['index']=function(_0x46809b,_0x2825af){var _0x6677e5={},_0x26d9c0={},_0x513771={'count':0x0,'rows':[]};var _0x2ccbec=db[_0xd4e5('0x25')]['rawAttributes'];_0x26d9c0[_0xd4e5('0x26')]=_[_0xd4e5('0x27')](_0x2ccbec);_0x26d9c0[_0xd4e5('0x28')]=_[_0xd4e5('0x27')](_0x46809b[_0xd4e5('0x28')]);_0x26d9c0[_0xd4e5('0x29')]=_['intersection'](_0x26d9c0[_0xd4e5('0x26')],_0x26d9c0[_0xd4e5('0x28')]);_0x6677e5[_0xd4e5('0x2a')]=_[_0xd4e5('0x2b')](_0x26d9c0[_0xd4e5('0x26')],qs[_0xd4e5('0x2c')](_0x46809b[_0xd4e5('0x28')]['fields']));_0x6677e5[_0xd4e5('0x2a')]=_0x6677e5[_0xd4e5('0x2a')]['length']?_0x6677e5['attributes']:_0x26d9c0[_0xd4e5('0x26')];if(!_0x46809b[_0xd4e5('0x28')][_0xd4e5('0x2d')](_0xd4e5('0x2e'))){_0x6677e5[_0xd4e5('0x2f')]=qs[_0xd4e5('0x2f')](_0x46809b['query']['limit']);_0x6677e5[_0xd4e5('0x1b')]=qs[_0xd4e5('0x1b')](_0x46809b[_0xd4e5('0x28')]['offset']);}_0x6677e5[_0xd4e5('0x30')]=qs[_0xd4e5('0x31')](_0x46809b[_0xd4e5('0x28')][_0xd4e5('0x31')]);_0x6677e5['where']=qs[_0xd4e5('0x29')](_[_0xd4e5('0x32')](_0x46809b['query'],_0x26d9c0[_0xd4e5('0x29')]));if(_0x46809b[_0xd4e5('0x28')][_0xd4e5('0x33')]){_0x6677e5['where']=_[_0xd4e5('0x34')](_0x6677e5['where'],{'$or':_['map'](_0x2ccbec,function(_0xa3bc21){if(_0xa3bc21[_0xd4e5('0x35')]['key']!==_0xd4e5('0x36')){var _0x36e571={};_0x36e571[_0xa3bc21[_0xd4e5('0x37')]]={'$like':'%'+_0x46809b[_0xd4e5('0x28')][_0xd4e5('0x33')]+'%'};return _0x36e571;}})});}_0x6677e5=_[_0xd4e5('0x34')]({},_0x6677e5,_0x46809b['options']);var _0x21da45={'where':_0x6677e5[_0xd4e5('0x38')]};return db[_0xd4e5('0x25')][_0xd4e5('0x39')](_0x21da45)['then'](function(_0x365d88){_0x513771[_0xd4e5('0x39')]=_0x365d88;if(_0x46809b[_0xd4e5('0x28')]['includeAll']){_0x6677e5[_0xd4e5('0x3a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xd4e5('0x3b')](_0x6677e5);})[_0xd4e5('0x21')](function(_0x204d8e){_0x513771[_0xd4e5('0x3c')]=_0x204d8e;return _0x513771;})['then'](respondWithFilteredResult(_0x2825af,_0x6677e5))['catch'](handleError(_0x2825af,null));};exports['show']=function(_0x4a6749,_0x4343f4){var _0x401445={'raw':![],'where':{'id':_0x4a6749[_0xd4e5('0x3d')]['id']}},_0x173dd2={};_0x173dd2['model']=_[_0xd4e5('0x27')](db[_0xd4e5('0x25')][_0xd4e5('0x3e')]);_0x173dd2[_0xd4e5('0x28')]=_['keys'](_0x4a6749[_0xd4e5('0x28')]);_0x173dd2[_0xd4e5('0x29')]=_[_0xd4e5('0x2b')](_0x173dd2[_0xd4e5('0x26')],_0x173dd2[_0xd4e5('0x28')]);_0x401445[_0xd4e5('0x2a')]=_[_0xd4e5('0x2b')](_0x173dd2[_0xd4e5('0x26')],qs[_0xd4e5('0x2c')](_0x4a6749[_0xd4e5('0x28')][_0xd4e5('0x2c')]));_0x401445['attributes']=_0x401445[_0xd4e5('0x2a')][_0xd4e5('0x3f')]?_0x401445[_0xd4e5('0x2a')]:_0x173dd2[_0xd4e5('0x26')];if(_0x4a6749[_0xd4e5('0x28')]['includeAll']){_0x401445['include']=[{'all':!![]}];}_0x401445=_['merge']({},_0x401445,_0x4a6749[_0xd4e5('0x40')]);return db[_0xd4e5('0x25')][_0xd4e5('0x41')](_0x401445)['then'](handleEntityNotFound(_0x4343f4,null))[_0xd4e5('0x21')](respondWithResult(_0x4343f4,null))[_0xd4e5('0x42')](handleError(_0x4343f4,null));};exports[_0xd4e5('0x43')]=function(_0x241cf9,_0x5ce258){return db[_0xd4e5('0x25')][_0xd4e5('0x43')](_0x241cf9[_0xd4e5('0x44')],{})[_0xd4e5('0x21')](respondWithResult(_0x5ce258,0xc9))[_0xd4e5('0x42')](handleError(_0x5ce258,null));};exports[_0xd4e5('0x45')]=function(_0x584e34,_0x421dce){if(_0x584e34[_0xd4e5('0x44')]['id']){delete _0x584e34[_0xd4e5('0x44')]['id'];}return db[_0xd4e5('0x25')]['find']({'where':{'id':_0x584e34['params']['id']}})[_0xd4e5('0x21')](handleEntityNotFound(_0x421dce,null))['then'](saveUpdates(_0x584e34[_0xd4e5('0x44')],null))['then'](respondWithResult(_0x421dce,null))[_0xd4e5('0x42')](handleError(_0x421dce,null));};exports['destroy']=function(_0x38a45a,_0x53a65a){return db['VoiceQueueReport'][_0xd4e5('0x41')]({'where':{'id':_0x38a45a[_0xd4e5('0x3d')]['id']}})[_0xd4e5('0x21')](handleEntityNotFound(_0x53a65a,null))['then'](removeEntity(_0x53a65a,null))[_0xd4e5('0x42')](handleError(_0x53a65a,null));};exports[_0xd4e5('0x46')]=function(_0x2c0bce,_0xdb34f4){return db[_0xd4e5('0x25')][_0xd4e5('0x46')]()[_0xd4e5('0x21')](respondWithResult(_0xdb34f4,null))['catch'](handleError(_0xdb34f4,null));};exports[_0xd4e5('0x47')]=function(_0x4c72fd,_0x2c9f14){var _0x13ef95={},_0x5cc3bb={},_0x43e982={'count':0x0,'rows':[]};_0x5cc3bb[_0xd4e5('0x26')]=_[_0xd4e5('0x27')](db['VoiceQueueReport'][_0xd4e5('0x3e')]);_0x5cc3bb['query']=_['keys'](_0x4c72fd[_0xd4e5('0x28')]);_0x5cc3bb[_0xd4e5('0x29')]=_[_0xd4e5('0x2b')](_0x5cc3bb[_0xd4e5('0x26')],_0x5cc3bb[_0xd4e5('0x28')]);_0x13ef95[_0xd4e5('0x2a')]=_[_0xd4e5('0x2b')](_0x5cc3bb[_0xd4e5('0x26')],qs[_0xd4e5('0x2c')](_0x4c72fd[_0xd4e5('0x28')]['fields']));_0x13ef95[_0xd4e5('0x2a')]=_0x13ef95[_0xd4e5('0x2a')]['length']?_0x13ef95[_0xd4e5('0x2a')]:_0x5cc3bb[_0xd4e5('0x26')];if(!_0x4c72fd[_0xd4e5('0x28')][_0xd4e5('0x2d')](_0xd4e5('0x2e'))){_0x13ef95[_0xd4e5('0x2f')]=qs[_0xd4e5('0x2f')](_0x4c72fd[_0xd4e5('0x28')][_0xd4e5('0x2f')]);_0x13ef95[_0xd4e5('0x1b')]=qs['offset'](_0x4c72fd[_0xd4e5('0x28')][_0xd4e5('0x1b')]);}_0x13ef95[_0xd4e5('0x30')]=qs[_0xd4e5('0x31')](_0x4c72fd[_0xd4e5('0x28')]['sort']);_0x13ef95[_0xd4e5('0x38')]=qs[_0xd4e5('0x29')](_['pick'](_0x4c72fd[_0xd4e5('0x28')],_0x5cc3bb['filters']));if(_0x4c72fd['query'][_0xd4e5('0x33')]){_0x13ef95[_0xd4e5('0x38')]=_[_0xd4e5('0x34')](_0x13ef95['where'],{'$or':_[_0xd4e5('0x48')](_0x13ef95[_0xd4e5('0x2a')],function(_0x5729d6){var _0x1e1189={};_0x1e1189[_0x5729d6]={'$like':'%'+_0x4c72fd[_0xd4e5('0x28')][_0xd4e5('0x33')]+'%'};return _0x1e1189;})});}_0x13ef95=_[_0xd4e5('0x34')]({},_0x13ef95,_0x4c72fd[_0xd4e5('0x40')]);var _0x422c18={'where':_0x13ef95[_0xd4e5('0x38')]};return db[_0xd4e5('0x25')][_0xd4e5('0x39')](_0x422c18)[_0xd4e5('0x21')](function(_0x1007a2){_0x43e982[_0xd4e5('0x39')]=_0x1007a2;if(_0x4c72fd[_0xd4e5('0x28')][_0xd4e5('0x49')]){_0x13ef95[_0xd4e5('0x3a')]=[{'all':!![]}];}return db[_0xd4e5('0x25')][_0xd4e5('0x3b')](_0x13ef95);})['then'](function(_0x3800e5){_0x43e982[_0xd4e5('0x3c')]=_0x3800e5;return _0x43e982;})[_0xd4e5('0x21')](respondWithFilteredResult(_0x2c9f14,_0x13ef95,_0xd4e5('0x47')))[_0xd4e5('0x42')](handleError(_0x2c9f14,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x21d1=['papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','Content-Range','apply','reject','save','update','then','error','stack','name','index','VoiceQueueReport','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','filter','where','merge','map','type','VIRTUAL','field','options','count','includeAll','include','rows','catch','show','params','find','create','body','describe','getVoiceQueuesReport','order','pick','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x21d1,0x184));var _0x121d=function(_0x5cbee2,_0x5bbd89){_0x5cbee2=_0x5cbee2-0x0;var _0x223d5b=_0x21d1[_0x5cbee2];return _0x223d5b;};'use strict';var pdf=require(_0x121d('0x0'));var emlformat=require(_0x121d('0x1'));var rimraf=require(_0x121d('0x2'));var zipdir=require(_0x121d('0x3'));var jsonpatch=require(_0x121d('0x4'));var rp=require(_0x121d('0x5'));var moment=require('moment');var BPromise=require(_0x121d('0x6'));var Mustache=require(_0x121d('0x7'));var util=require(_0x121d('0x8'));var path=require('path');var sox=require(_0x121d('0x9'));var csv=require('to-csv');var ejs=require(_0x121d('0xa'));var fs=require('fs');var _=require(_0x121d('0xb'));var squel=require(_0x121d('0xc'));var crypto=require('crypto');var jsforce=require(_0x121d('0xd'));var deskjs=require(_0x121d('0xe'));var toCsv=require(_0x121d('0xf'));var querystring=require(_0x121d('0x10'));var Papa=require(_0x121d('0x11'));var Redis=require(_0x121d('0x12'));var authService=require(_0x121d('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x121d('0x14'))('api');var utils=require(_0x121d('0x15'));var config=require('../../config/environment');var db=require(_0x121d('0x16'))['db'];config[_0x121d('0x17')]=_[_0x121d('0x18')](config['redis'],{'host':_0x121d('0x19'),'port':0x18eb});var socket=require(_0x121d('0x1a'))(new Redis(config[_0x121d('0x17')]));require(_0x121d('0x1b'))[_0x121d('0x1c')](socket);function respondWithStatusCode(_0x3cfb85,_0x4a45d2){_0x4a45d2=_0x4a45d2||0xcc;return function(_0x54cf0a){if(_0x54cf0a){return _0x3cfb85[_0x121d('0x1d')](_0x4a45d2);}return _0x3cfb85['status'](_0x4a45d2)[_0x121d('0x1e')]();};}function respondWithResult(_0x301706,_0x21558f){_0x21558f=_0x21558f||0xc8;return function(_0x563d4c){if(_0x563d4c){return _0x301706[_0x121d('0x1f')](_0x21558f)[_0x121d('0x20')](_0x563d4c);}};}function respondWithFilteredResult(_0x1fbafe,_0x308835){return function(_0x51ee50){if(_0x51ee50){var _0x4d96fb=_0x51ee50['count'],_0x3cf5af=_0x308835[_0x121d('0x21')],_0x5f1312=_0x308835[_0x121d('0x21')]+_0x308835['limit'],_0x3bacb5;if(_0x5f1312>=_0x4d96fb){_0x5f1312=_0x4d96fb;_0x3bacb5=0xc8;}else{_0x3bacb5=0xce;}_0x1fbafe[_0x121d('0x1f')](_0x3bacb5);return _0x1fbafe['set'](_0x121d('0x22'),_0x3cf5af+'-'+_0x5f1312+'/'+_0x4d96fb)[_0x121d('0x20')](_0x51ee50);}return null;};}function patchUpdates(_0x3cc06d){return function(_0x433643){try{jsonpatch[_0x121d('0x23')](_0x433643,_0x3cc06d,!![]);}catch(_0x14a3b6){return BPromise[_0x121d('0x24')](_0x14a3b6);}return _0x433643[_0x121d('0x25')]();};}function saveUpdates(_0x36eb92,_0x497ab5){return function(_0x23d48){if(_0x23d48){return _0x23d48[_0x121d('0x26')](_0x36eb92)['then'](function(_0x34ee72){return _0x34ee72;});}return null;};}function removeEntity(_0x41ed3b,_0x3f3735){return function(_0x571098){if(_0x571098){return _0x571098['destroy']()[_0x121d('0x27')](function(){_0x41ed3b[_0x121d('0x1f')](0xcc)[_0x121d('0x1e')]();});}};}function handleEntityNotFound(_0xe8b290,_0x42cd3d){return function(_0x3e32cd){if(!_0x3e32cd){_0xe8b290[_0x121d('0x1d')](0x194);}return _0x3e32cd;};}function handleError(_0x1f0c59,_0x297038){_0x297038=_0x297038||0x1f4;return function(_0x2eea72){logger[_0x121d('0x28')](_0x2eea72[_0x121d('0x29')]);if(_0x2eea72[_0x121d('0x2a')]){delete _0x2eea72[_0x121d('0x2a')];}_0x1f0c59[_0x121d('0x1f')](_0x297038)['send'](_0x2eea72);};}exports[_0x121d('0x2b')]=function(_0x92eb73,_0x1a275a){var _0x300113={},_0x51d859={},_0x161a5d={'count':0x0,'rows':[]};var _0x54f233=db[_0x121d('0x2c')][_0x121d('0x2d')];_0x51d859[_0x121d('0x2e')]=_[_0x121d('0x2f')](_0x54f233);_0x51d859[_0x121d('0x30')]=_[_0x121d('0x2f')](_0x92eb73[_0x121d('0x30')]);_0x51d859['filters']=_[_0x121d('0x31')](_0x51d859[_0x121d('0x2e')],_0x51d859[_0x121d('0x30')]);_0x300113[_0x121d('0x32')]=_[_0x121d('0x31')](_0x51d859[_0x121d('0x2e')],qs[_0x121d('0x33')](_0x92eb73['query'][_0x121d('0x33')]));_0x300113[_0x121d('0x32')]=_0x300113[_0x121d('0x32')][_0x121d('0x34')]?_0x300113[_0x121d('0x32')]:_0x51d859[_0x121d('0x2e')];if(!_0x92eb73[_0x121d('0x30')][_0x121d('0x35')](_0x121d('0x36'))){_0x300113[_0x121d('0x37')]=qs[_0x121d('0x37')](_0x92eb73['query'][_0x121d('0x37')]);_0x300113[_0x121d('0x21')]=qs['offset'](_0x92eb73[_0x121d('0x30')][_0x121d('0x21')]);}_0x300113['order']=qs['sort'](_0x92eb73['query'][_0x121d('0x38')]);_0x300113['where']=qs[_0x121d('0x39')](_['pick'](_0x92eb73[_0x121d('0x30')],_0x51d859['filters']));if(_0x92eb73[_0x121d('0x30')][_0x121d('0x3a')]){_0x300113[_0x121d('0x3b')]=_[_0x121d('0x3c')](_0x300113[_0x121d('0x3b')],{'$or':_[_0x121d('0x3d')](_0x54f233,function(_0x34a533){if(_0x34a533[_0x121d('0x3e')]['key']!==_0x121d('0x3f')){var _0x78a632={};_0x78a632[_0x34a533[_0x121d('0x40')]]={'$like':'%'+_0x92eb73[_0x121d('0x30')]['filter']+'%'};return _0x78a632;}})});}_0x300113=_[_0x121d('0x3c')]({},_0x300113,_0x92eb73[_0x121d('0x41')]);var _0x28d559={'where':_0x300113[_0x121d('0x3b')]};return db['VoiceQueueReport'][_0x121d('0x42')](_0x28d559)[_0x121d('0x27')](function(_0x669523){_0x161a5d[_0x121d('0x42')]=_0x669523;if(_0x92eb73[_0x121d('0x30')][_0x121d('0x43')]){_0x300113[_0x121d('0x44')]=[{'all':!![]}];}return db[_0x121d('0x2c')]['findAll'](_0x300113);})[_0x121d('0x27')](function(_0x1b48d7){_0x161a5d[_0x121d('0x45')]=_0x1b48d7;return _0x161a5d;})['then'](respondWithFilteredResult(_0x1a275a,_0x300113))[_0x121d('0x46')](handleError(_0x1a275a,null));};exports[_0x121d('0x47')]=function(_0x23eb43,_0x3f7095){var _0x7a606e={'raw':![],'where':{'id':_0x23eb43[_0x121d('0x48')]['id']}},_0x375d6c={};_0x375d6c[_0x121d('0x2e')]=_['keys'](db[_0x121d('0x2c')]['rawAttributes']);_0x375d6c['query']=_[_0x121d('0x2f')](_0x23eb43['query']);_0x375d6c[_0x121d('0x39')]=_['intersection'](_0x375d6c[_0x121d('0x2e')],_0x375d6c[_0x121d('0x30')]);_0x7a606e[_0x121d('0x32')]=_[_0x121d('0x31')](_0x375d6c[_0x121d('0x2e')],qs[_0x121d('0x33')](_0x23eb43[_0x121d('0x30')][_0x121d('0x33')]));_0x7a606e[_0x121d('0x32')]=_0x7a606e[_0x121d('0x32')][_0x121d('0x34')]?_0x7a606e[_0x121d('0x32')]:_0x375d6c['model'];if(_0x23eb43[_0x121d('0x30')][_0x121d('0x43')]){_0x7a606e[_0x121d('0x44')]=[{'all':!![]}];}_0x7a606e=_[_0x121d('0x3c')]({},_0x7a606e,_0x23eb43[_0x121d('0x41')]);return db[_0x121d('0x2c')][_0x121d('0x49')](_0x7a606e)[_0x121d('0x27')](handleEntityNotFound(_0x3f7095,null))[_0x121d('0x27')](respondWithResult(_0x3f7095,null))[_0x121d('0x46')](handleError(_0x3f7095,null));};exports[_0x121d('0x4a')]=function(_0x4867f6,_0x3ceb89){return db[_0x121d('0x2c')][_0x121d('0x4a')](_0x4867f6['body'],{})[_0x121d('0x27')](respondWithResult(_0x3ceb89,0xc9))[_0x121d('0x46')](handleError(_0x3ceb89,null));};exports['update']=function(_0x2271d0,_0x2d697a){if(_0x2271d0[_0x121d('0x4b')]['id']){delete _0x2271d0[_0x121d('0x4b')]['id'];}return db[_0x121d('0x2c')][_0x121d('0x49')]({'where':{'id':_0x2271d0[_0x121d('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d697a,null))['then'](saveUpdates(_0x2271d0[_0x121d('0x4b')],null))[_0x121d('0x27')](respondWithResult(_0x2d697a,null))[_0x121d('0x46')](handleError(_0x2d697a,null));};exports['destroy']=function(_0x2c7ee5,_0x302f52){return db['VoiceQueueReport']['find']({'where':{'id':_0x2c7ee5['params']['id']}})[_0x121d('0x27')](handleEntityNotFound(_0x302f52,null))['then'](removeEntity(_0x302f52,null))['catch'](handleError(_0x302f52,null));};exports[_0x121d('0x4c')]=function(_0x35d6fa,_0xb8eeba){return db[_0x121d('0x2c')][_0x121d('0x4c')]()[_0x121d('0x27')](respondWithResult(_0xb8eeba,null))[_0x121d('0x46')](handleError(_0xb8eeba,null));};exports[_0x121d('0x4d')]=function(_0x3f3d89,_0x5ccf0c){var _0x5c8b6c={},_0x4ace50={},_0x427bdf={'count':0x0,'rows':[]};_0x4ace50['model']=_[_0x121d('0x2f')](db['VoiceQueueReport'][_0x121d('0x2d')]);_0x4ace50[_0x121d('0x30')]=_[_0x121d('0x2f')](_0x3f3d89[_0x121d('0x30')]);_0x4ace50[_0x121d('0x39')]=_['intersection'](_0x4ace50['model'],_0x4ace50[_0x121d('0x30')]);_0x5c8b6c['attributes']=_[_0x121d('0x31')](_0x4ace50[_0x121d('0x2e')],qs[_0x121d('0x33')](_0x3f3d89['query'][_0x121d('0x33')]));_0x5c8b6c[_0x121d('0x32')]=_0x5c8b6c[_0x121d('0x32')]['length']?_0x5c8b6c['attributes']:_0x4ace50[_0x121d('0x2e')];if(!_0x3f3d89['query']['hasOwnProperty']('nolimit')){_0x5c8b6c[_0x121d('0x37')]=qs[_0x121d('0x37')](_0x3f3d89[_0x121d('0x30')]['limit']);_0x5c8b6c['offset']=qs[_0x121d('0x21')](_0x3f3d89[_0x121d('0x30')]['offset']);}_0x5c8b6c[_0x121d('0x4e')]=qs[_0x121d('0x38')](_0x3f3d89[_0x121d('0x30')][_0x121d('0x38')]);_0x5c8b6c[_0x121d('0x3b')]=qs['filters'](_[_0x121d('0x4f')](_0x3f3d89[_0x121d('0x30')],_0x4ace50[_0x121d('0x39')]));if(_0x3f3d89[_0x121d('0x30')][_0x121d('0x3a')]){_0x5c8b6c[_0x121d('0x3b')]=_[_0x121d('0x3c')](_0x5c8b6c[_0x121d('0x3b')],{'$or':_['map'](_0x5c8b6c[_0x121d('0x32')],function(_0x14f4c1){var _0x88149c={};_0x88149c[_0x14f4c1]={'$like':'%'+_0x3f3d89[_0x121d('0x30')][_0x121d('0x3a')]+'%'};return _0x88149c;})});}_0x5c8b6c=_['merge']({},_0x5c8b6c,_0x3f3d89[_0x121d('0x41')]);var _0x2177b1={'where':_0x5c8b6c[_0x121d('0x3b')]};return db['VoiceQueueReport']['count'](_0x2177b1)[_0x121d('0x27')](function(_0x15a384){_0x427bdf[_0x121d('0x42')]=_0x15a384;if(_0x3f3d89[_0x121d('0x30')][_0x121d('0x43')]){_0x5c8b6c[_0x121d('0x44')]=[{'all':!![]}];}return db[_0x121d('0x2c')][_0x121d('0x50')](_0x5c8b6c);})[_0x121d('0x27')](function(_0xbc6cab){_0x427bdf[_0x121d('0x45')]=_0xbc6cab;return _0x427bdf;})[_0x121d('0x27')](respondWithFilteredResult(_0x5ccf0c,_0x5c8b6c,_0x121d('0x4d')))[_0x121d('0x46')](handleError(_0x5ccf0c,null,_0x121d('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 7d1a4a3..79e75da 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 _0xf660=['hasOwnProperty','../../mysqldb','setMaxListeners','save'];(function(_0x54a086,_0xce72c1){var _0xa8bc20=function(_0x2bf926){while(--_0x2bf926){_0x54a086['push'](_0x54a086['shift']());}};_0xa8bc20(++_0xce72c1);}(_0xf660,0x195));var _0x0f66=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xf660[_0x45313f];return _0x402910;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0f66('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0f66('0x1')](0x0);var events={'afterCreate':_0x0f66('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ee2f9){return function(_0x1cf80b,_0x25fa1e,_0x3b1599){VoiceQueueReportEvents['emit'](_0x3ee2f9+':'+_0x1cf80b['id'],_0x1cf80b);VoiceQueueReportEvents['emit'](_0x3ee2f9,_0x1cf80b);_0x3b1599(null);};}for(var e in events){if(events[_0x0f66('0x3')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x7487=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x5f55e1,_0x613ff3){var _0x573241=function(_0x227e03){while(--_0x227e03){_0x5f55e1['push'](_0x5f55e1['shift']());}};_0x573241(++_0x613ff3);}(_0x7487,0x140));var _0x7748=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x7487[_0x9d639c];return _0x1671de;};'use strict';var EventEmitter=require(_0x7748('0x0'));var VoiceQueueReport=require(_0x7748('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7748('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7748('0x3'),'afterDestroy':_0x7748('0x4')};function emitEvent(_0x11d992){return function(_0x20514e,_0x274756,_0x2c8853){VoiceQueueReportEvents[_0x7748('0x5')](_0x11d992+':'+_0x20514e['id'],_0x20514e);VoiceQueueReportEvents[_0x7748('0x5')](_0x11d992,_0x20514e);_0x2c8853(null);};}for(var e in events){if(events[_0x7748('0x6')](e)){var event=events[e];VoiceQueueReport[_0x7748('0x7')](e,emitEvent(event));}}module[_0x7748('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 b63015f..e9bf182 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 _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x159c2f,_0xd39d20){var _0x591f68=function(_0x161ba6){while(--_0x161ba6){_0x159c2f['push'](_0x159c2f['shift']());}};_0x591f68(++_0xd39d20);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e8571,_0xc46307){_0x5e8571=_0x5e8571-0x0;var _0x5e2293=_0x5f2f[_0x5e8571];return _0x5e2293;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0xdb28,0x106));var _0x8db2=function(_0x782812,_0x394f44){_0x782812=_0x782812-0x0;var _0x3e5b13=_0xdb28[_0x782812];return _0x3e5b13;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8db2('0xc')]},{'fields':[_0x8db2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index e08db76..8bde751 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 _0xfe3f=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','code','VoiceQueueReport,\x20%s,\x20%s','error','message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug'];(function(_0x4cfa2e,_0x5752b5){var _0x279b50=function(_0x3f817b){while(--_0x3f817b){_0x4cfa2e['push'](_0x4cfa2e['shift']());}};_0x279b50(++_0x5752b5);}(_0xfe3f,0x1c5));var _0xffe3=function(_0x3abc68,_0xd9d1fd){_0x3abc68=_0x3abc68-0x0;var _0x3966d6=_0xfe3f[_0x3abc68];return _0x3966d6;};'use strict';var _=require('lodash');var util=require(_0xffe3('0x0'));var moment=require(_0xffe3('0x1'));var BPromise=require(_0xffe3('0x2'));var rs=require(_0xffe3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffe3('0x4'))['db'];var utils=require(_0xffe3('0x5'));var logger=require(_0xffe3('0x6'))(_0xffe3('0x7'));var config=require(_0xffe3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xffe3('0x9')][_0xffe3('0xa')]({'port':0x232a});config[_0xffe3('0xb')]=_['defaults'](config[_0xffe3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xffe3('0xc'))(new Redis(config[_0xffe3('0xb')]));require(_0xffe3('0xd'))[_0xffe3('0xe')](socket);function respondWithRpcPromise(_0x479007,_0x18ee34,_0x258fd8){return new BPromise(function(_0x422169,_0xc58cd9){return client[_0xffe3('0xf')](_0x479007,_0x258fd8)[_0xffe3('0x10')](function(_0x561f42){logger[_0xffe3('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x18ee34,_0xffe3('0x12'));logger[_0xffe3('0x13')](_0xffe3('0x14'),_0x18ee34,_0xffe3('0x12'),JSON['stringify'](_0x561f42));if(_0x561f42['error']){if(_0x561f42['error'][_0xffe3('0x15')]===0x1f4){logger['error'](_0xffe3('0x16'),_0x18ee34,_0x561f42[_0xffe3('0x17')][_0xffe3('0x18')]);return _0xc58cd9(_0x561f42[_0xffe3('0x17')][_0xffe3('0x18')]);}logger[_0xffe3('0x17')](_0xffe3('0x16'),_0x18ee34,_0x561f42[_0xffe3('0x17')][_0xffe3('0x18')]);return _0x422169(_0x561f42['error'][_0xffe3('0x18')]);}else{logger[_0xffe3('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x18ee34,_0xffe3('0x12'));_0x422169(_0x561f42['result'][_0xffe3('0x18')]);}})[_0xffe3('0x19')](function(_0x19d7e2){logger['error'](_0xffe3('0x16'),_0x18ee34,_0x19d7e2);_0xc58cd9(_0x19d7e2);});});}exports['GetVoiceQueueReport']=function(_0x58d40a){var _0x4d6abc=this;return new Promise(function(_0x391bdb,_0x3c0d82){return db[_0xffe3('0x1a')][_0xffe3('0x1b')]({'raw':_0x58d40a[_0xffe3('0x1c')]?_0x58d40a['options'][_0xffe3('0x1d')]===undefined?!![]:![]:!![],'where':_0x58d40a[_0xffe3('0x1c')]?_0x58d40a[_0xffe3('0x1c')][_0xffe3('0x1e')]||null:null,'attributes':_0x58d40a[_0xffe3('0x1c')]?_0x58d40a[_0xffe3('0x1c')][_0xffe3('0x1f')]||null:null,'limit':_0x58d40a[_0xffe3('0x1c')]?_0x58d40a['options'][_0xffe3('0x20')]||null:null,'include':_0x58d40a[_0xffe3('0x1c')]?_0x58d40a[_0xffe3('0x1c')][_0xffe3('0x21')]?_[_0xffe3('0x22')](_0x58d40a['options']['include'],function(_0x496f50){return{'model':db[_0x496f50[_0xffe3('0x23')]],'as':_0x496f50['as'],'attributes':_0x496f50[_0xffe3('0x1f')],'include':_0x496f50['include']?_[_0xffe3('0x22')](_0x496f50['include'],function(_0xe0623f){return{'model':db[_0xe0623f[_0xffe3('0x23')]],'as':_0xe0623f['as'],'attributes':_0xe0623f[_0xffe3('0x1f')],'include':_0xe0623f[_0xffe3('0x21')]?_[_0xffe3('0x22')](_0xe0623f[_0xffe3('0x21')],function(_0xe9e0e5){return{'model':db[_0xe9e0e5[_0xffe3('0x23')]],'as':_0xe9e0e5['as'],'attributes':_0xe9e0e5[_0xffe3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xffe3('0x10')](function(_0x3d51ff){logger[_0xffe3('0x11')](_0xffe3('0x24'),_0x58d40a);logger[_0xffe3('0x13')](_0xffe3('0x24'),_0x58d40a,JSON[_0xffe3('0x25')](_0x3d51ff));_0x391bdb(_0x3d51ff);})['catch'](function(_0x33bfa2){logger[_0xffe3('0x17')](_0xffe3('0x24'),_0x33bfa2['message'],_0x58d40a);_0x3c0d82(_0x4d6abc[_0xffe3('0x17')](0x1f4,_0x33bfa2['message']));});});};exports[_0xffe3('0x26')]=function(_0x27d77e){var _0x3e35a9=this;return new Promise(function(_0x4a4ace,_0x307291){return db[_0xffe3('0x1a')][_0xffe3('0x27')](_0x27d77e[_0xffe3('0x28')],{'raw':_0x27d77e['options']?_0x27d77e[_0xffe3('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x455b81){logger[_0xffe3('0x11')]('CreateVoiceQueueReport',_0x27d77e);logger['debug'](_0xffe3('0x26'),_0x27d77e,JSON[_0xffe3('0x25')](_0x455b81));_0x4a4ace(_0x455b81);})[_0xffe3('0x19')](function(_0x37224c){logger['error'](_0xffe3('0x26'),_0x37224c[_0xffe3('0x18')],_0x27d77e);_0x307291(_0x3e35a9[_0xffe3('0x17')](0x1f4,_0x37224c['message']));});});};exports[_0xffe3('0x29')]=function(_0x20e510){var _0xdd4d9a=this;return new Promise(function(_0x37904c,_0x502705){return db['VoiceQueueReport'][_0xffe3('0x2a')](_0x20e510[_0xffe3('0x28')],{'raw':_0x20e510[_0xffe3('0x1c')]?_0x20e510['options'][_0xffe3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20e510['options']?_0x20e510[_0xffe3('0x1c')][_0xffe3('0x1e')]||null:null,'attributes':_0x20e510['options']?_0x20e510[_0xffe3('0x1c')][_0xffe3('0x1f')]||null:null,'limit':_0x20e510[_0xffe3('0x1c')]?_0x20e510['options'][_0xffe3('0x20')]||null:null})[_0xffe3('0x10')](function(_0x52f6d7){logger[_0xffe3('0x11')]('UpdateVoiceQueueReport',_0x20e510);logger[_0xffe3('0x13')](_0xffe3('0x29'),_0x20e510,JSON['stringify'](_0x52f6d7));_0x37904c(_0x52f6d7);})['catch'](function(_0x2e5d56){logger[_0xffe3('0x17')](_0xffe3('0x29'),_0x2e5d56[_0xffe3('0x18')],_0x20e510);_0x502705(_0xdd4d9a[_0xffe3('0x17')](0x1f4,_0x2e5d56[_0xffe3('0x18')]));});});}; \ No newline at end of file +var _0x97c8=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','catch','CreateVoiceQueueReport','create','body','debug','update','UpdateVoiceQueueReport','util'];(function(_0x6da160,_0x51ebe5){var _0x31f2c7=function(_0x4a4cdc){while(--_0x4a4cdc){_0x6da160['push'](_0x6da160['shift']());}};_0x31f2c7(++_0x51ebe5);}(_0x97c8,0x1ad));var _0x897c=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x97c8[_0x391c55];return _0xa434e0;};'use strict';var _=require('lodash');var util=require(_0x897c('0x0'));var moment=require(_0x897c('0x1'));var BPromise=require('bluebird');var rs=require(_0x897c('0x2'));var fs=require('fs');var Redis=require(_0x897c('0x3'));var db=require(_0x897c('0x4'))['db'];var utils=require(_0x897c('0x5'));var logger=require(_0x897c('0x6'))(_0x897c('0x7'));var config=require(_0x897c('0x8'));var jayson=require(_0x897c('0x9'));var client=jayson[_0x897c('0xa')]['http']({'port':0x232a});config[_0x897c('0xb')]=_[_0x897c('0xc')](config[_0x897c('0xb')],{'host':_0x897c('0xd'),'port':0x18eb});var socket=require(_0x897c('0xe'))(new Redis(config[_0x897c('0xb')]));require('./voiceQueueReport.socket')[_0x897c('0xf')](socket);function respondWithRpcPromise(_0x45421c,_0x36f6a6,_0x458642){return new BPromise(function(_0x35d8cb,_0x1972f3){return client['request'](_0x45421c,_0x458642)[_0x897c('0x10')](function(_0x10a780){logger[_0x897c('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x36f6a6,_0x897c('0x12'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x36f6a6,_0x897c('0x12'),JSON[_0x897c('0x13')](_0x10a780));if(_0x10a780['error']){if(_0x10a780[_0x897c('0x14')][_0x897c('0x15')]===0x1f4){logger[_0x897c('0x14')](_0x897c('0x16'),_0x36f6a6,_0x10a780[_0x897c('0x14')][_0x897c('0x17')]);return _0x1972f3(_0x10a780[_0x897c('0x14')][_0x897c('0x17')]);}logger['error'](_0x897c('0x16'),_0x36f6a6,_0x10a780[_0x897c('0x14')][_0x897c('0x17')]);return _0x35d8cb(_0x10a780[_0x897c('0x14')][_0x897c('0x17')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x36f6a6,_0x897c('0x12'));_0x35d8cb(_0x10a780[_0x897c('0x18')][_0x897c('0x17')]);}})['catch'](function(_0x4f8f12){logger['error'](_0x897c('0x16'),_0x36f6a6,_0x4f8f12);_0x1972f3(_0x4f8f12);});});}exports[_0x897c('0x19')]=function(_0x5308f0){var _0x10bf3b=this;return new Promise(function(_0x32e876,_0x818298){return db[_0x897c('0x1a')][_0x897c('0x1b')]({'raw':_0x5308f0[_0x897c('0x1c')]?_0x5308f0['options'][_0x897c('0x1d')]===undefined?!![]:![]:!![],'where':_0x5308f0[_0x897c('0x1c')]?_0x5308f0['options'][_0x897c('0x1e')]||null:null,'attributes':_0x5308f0[_0x897c('0x1c')]?_0x5308f0[_0x897c('0x1c')][_0x897c('0x1f')]||null:null,'limit':_0x5308f0[_0x897c('0x1c')]?_0x5308f0['options'][_0x897c('0x20')]||null:null,'include':_0x5308f0[_0x897c('0x1c')]?_0x5308f0[_0x897c('0x1c')]['include']?_['map'](_0x5308f0[_0x897c('0x1c')][_0x897c('0x21')],function(_0x120f51){return{'model':db[_0x120f51[_0x897c('0x22')]],'as':_0x120f51['as'],'attributes':_0x120f51[_0x897c('0x1f')],'include':_0x120f51[_0x897c('0x21')]?_['map'](_0x120f51['include'],function(_0x3d61e7){return{'model':db[_0x3d61e7[_0x897c('0x22')]],'as':_0x3d61e7['as'],'attributes':_0x3d61e7[_0x897c('0x1f')],'include':_0x3d61e7[_0x897c('0x21')]?_[_0x897c('0x23')](_0x3d61e7['include'],function(_0x3b992f){return{'model':db[_0x3b992f[_0x897c('0x22')]],'as':_0x3b992f['as'],'attributes':_0x3b992f[_0x897c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x897c('0x10')](function(_0x12ad1b){logger['info'](_0x897c('0x19'),_0x5308f0);logger['debug'](_0x897c('0x19'),_0x5308f0,JSON[_0x897c('0x13')](_0x12ad1b));_0x32e876(_0x12ad1b);})[_0x897c('0x24')](function(_0x3ecb77){logger['error'](_0x897c('0x19'),_0x3ecb77[_0x897c('0x17')],_0x5308f0);_0x818298(_0x10bf3b[_0x897c('0x14')](0x1f4,_0x3ecb77[_0x897c('0x17')]));});});};exports[_0x897c('0x25')]=function(_0x27b779){var _0xf5f33e=this;return new Promise(function(_0x1c32ef,_0x1932e2){return db[_0x897c('0x1a')][_0x897c('0x26')](_0x27b779[_0x897c('0x27')],{'raw':_0x27b779[_0x897c('0x1c')]?_0x27b779[_0x897c('0x1c')][_0x897c('0x1d')]===undefined?!![]:![]:!![]})[_0x897c('0x10')](function(_0x34d8b4){logger[_0x897c('0x11')](_0x897c('0x25'),_0x27b779);logger[_0x897c('0x28')]('CreateVoiceQueueReport',_0x27b779,JSON['stringify'](_0x34d8b4));_0x1c32ef(_0x34d8b4);})['catch'](function(_0x30129e){logger['error'](_0x897c('0x25'),_0x30129e[_0x897c('0x17')],_0x27b779);_0x1932e2(_0xf5f33e[_0x897c('0x14')](0x1f4,_0x30129e[_0x897c('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x399fa3){var _0x47cdb2=this;return new Promise(function(_0x5582c6,_0x4d8abb){return db[_0x897c('0x1a')][_0x897c('0x29')](_0x399fa3[_0x897c('0x27')],{'raw':_0x399fa3[_0x897c('0x1c')]?_0x399fa3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399fa3[_0x897c('0x1c')]?_0x399fa3[_0x897c('0x1c')]['where']||null:null,'attributes':_0x399fa3[_0x897c('0x1c')]?_0x399fa3[_0x897c('0x1c')][_0x897c('0x1f')]||null:null,'limit':_0x399fa3[_0x897c('0x1c')]?_0x399fa3[_0x897c('0x1c')][_0x897c('0x20')]||null:null})['then'](function(_0x2b1a4d){logger[_0x897c('0x11')](_0x897c('0x2a'),_0x399fa3);logger[_0x897c('0x28')]('UpdateVoiceQueueReport',_0x399fa3,JSON[_0x897c('0x13')](_0x2b1a4d));_0x5582c6(_0x2b1a4d);})[_0x897c('0x24')](function(_0x2c4077){logger[_0x897c('0x14')]('UpdateVoiceQueueReport',_0x2c4077[_0x897c('0x17')],_0x399fa3);_0x4d8abb(_0x47cdb2[_0x897c('0x14')](0x1f4,_0x2c4077[_0x897c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index eece4d1..bccf59f 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 _0xb273=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','register','length'];(function(_0x4d5cc8,_0x3221a8){var _0x15a728=function(_0x4e7537){while(--_0x4e7537){_0x4d5cc8['push'](_0x4d5cc8['shift']());}};_0x15a728(++_0x3221a8);}(_0xb273,0xd9));var _0x3b27=function(_0x1a379d,_0x1ff7ec){_0x1a379d=_0x1a379d-0x0;var _0x222700=_0xb273[_0x1a379d];return _0x222700;};'use strict';var VoiceQueueReportEvents=require(_0x3b27('0x0'));var events=[_0x3b27('0x1'),_0x3b27('0x2'),_0x3b27('0x3')];function createListener(_0x1dd852,_0x43b3fb){return function(_0xc3f49e){_0x43b3fb[_0x3b27('0x4')](_0x1dd852,_0xc3f49e);};}function removeListener(_0x321638,_0x4fdbcc){return function(){VoiceQueueReportEvents['removeListener'](_0x321638,_0x4fdbcc);};}exports[_0x3b27('0x5')]=function(_0x17ef18){for(var _0x4bf6ad=0x0,_0x4591ca=events[_0x3b27('0x6')];_0x4bf6ad<_0x4591ca;_0x4bf6ad++){var _0x546d51=events[_0x4bf6ad];var _0x2da050=createListener(_0x3b27('0x7')+_0x546d51,_0x17ef18);VoiceQueueReportEvents['on'](_0x546d51,_0x2da050);}}; \ No newline at end of file +var _0x56b8=['length','update','removeListener','register'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0x56b8,0x13d));var _0x856b=function(_0x51b363,_0x8c66d1){_0x51b363=_0x51b363-0x0;var _0x45c962=_0x56b8[_0x51b363];return _0x45c962;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save','remove',_0x856b('0x0')];function createListener(_0x7fc590,_0x51478d){return function(_0x49e742){_0x51478d['emit'](_0x7fc590,_0x49e742);};}function removeListener(_0x574ad8,_0x4537d5){return function(){VoiceQueueReportEvents[_0x856b('0x1')](_0x574ad8,_0x4537d5);};}exports[_0x856b('0x2')]=function(_0x31ea02){for(var _0x123663=0x0,_0x587419=events[_0x856b('0x3')];_0x123663<_0x587419;_0x123663++){var _0x5dd5f0=events[_0x123663];var _0x12f1e2=createListener('voiceQueueReport:'+_0x5dd5f0,_0x31ea02);VoiceQueueReportEvents['on'](_0x5dd5f0,_0x12f1e2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3bd34c2..eae0022 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 _0x44b6=['get','show','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index'];(function(_0x4e5d34,_0x5607fa){var _0x4411fa=function(_0x2da63e){while(--_0x2da63e){_0x4e5d34['push'](_0x4e5d34['shift']());}};_0x4411fa(++_0x5607fa);}(_0x44b6,0x14c));var _0x644b=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x44b6[_0x59616b];return _0x5c4523;};'use strict';var multer=require(_0x644b('0x0'));var util=require('util');var path=require(_0x644b('0x1'));var timeout=require(_0x644b('0x2'));var express=require(_0x644b('0x3'));var router=express[_0x644b('0x4')]();var auth=require(_0x644b('0x5'));var interaction=require(_0x644b('0x6'));var config=require('../../config/environment');var controller=require(_0x644b('0x7'));router['get']('/',auth[_0x644b('0x8')](),controller[_0x644b('0x9')]);router[_0x644b('0xa')]('/:id',auth[_0x644b('0x8')](),controller[_0x644b('0xb')]);router[_0x644b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x644b('0xd')](_0x644b('0xe'),auth[_0x644b('0x8')](),controller['update']);router[_0x644b('0xf')](_0x644b('0xe'),auth['isAuthenticated'](),controller[_0x644b('0x10')]);module[_0x644b('0x11')]=router; \ No newline at end of file +var _0x7a94=['update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post'];(function(_0x4801a0,_0x252c24){var _0x338e26=function(_0x1599c2){while(--_0x1599c2){_0x4801a0['push'](_0x4801a0['shift']());}};_0x338e26(++_0x252c24);}(_0x7a94,0x1c5));var _0x47a9=function(_0x1c8085,_0x1d5d5b){_0x1c8085=_0x1c8085-0x0;var _0x5ab7b4=_0x7a94[_0x1c8085];return _0x5ab7b4;};'use strict';var multer=require('multer');var util=require(_0x47a9('0x0'));var path=require(_0x47a9('0x1'));var timeout=require(_0x47a9('0x2'));var express=require(_0x47a9('0x3'));var router=express[_0x47a9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a9('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x47a9('0x6')]('/',auth['isAuthenticated'](),controller[_0x47a9('0x7')]);router[_0x47a9('0x6')](_0x47a9('0x8'),auth[_0x47a9('0x9')](),controller[_0x47a9('0xa')]);router[_0x47a9('0xb')]('/',auth[_0x47a9('0x9')](),controller['create']);router['put'](_0x47a9('0x8'),auth['isAuthenticated'](),controller[_0x47a9('0xc')]);router['delete'](_0x47a9('0x8'),auth['isAuthenticated'](),controller[_0x47a9('0xd')]);module[_0x47a9('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 264e5b2..6002c84 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 _0x7574=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x131eb1,_0x55b270){var _0x3a3b7a=function(_0xab2165){while(--_0xab2165){_0x131eb1['push'](_0x131eb1['shift']());}};_0x3a3b7a(++_0x55b270);}(_0x7574,0x15d));var _0x4757=function(_0x504975,_0xd78a9c){_0x504975=_0x504975-0x0;var _0x18a9ac=_0x7574[_0x504975];return _0x18a9ac;};'use strict';var Sequelize=require(_0x4757('0x0'));var moment=require(_0x4757('0x1'));module[_0x4757('0x2')]={'time':{'type':Sequelize[_0x4757('0x3')]},'callid':{'type':Sequelize[_0x4757('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4757('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4757('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4757('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4757('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4757('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4757('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4757('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4757('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x4757('0x5'))}}; \ No newline at end of file +var _0x4d84=['DATE','sequelize','exports','STRING'];(function(_0x544bab,_0x4f2a9b){var _0xd03644=function(_0x5c67cd){while(--_0x5c67cd){_0x544bab['push'](_0x544bab['shift']());}};_0xd03644(++_0x4f2a9b);}(_0x4d84,0x1c5));var _0x44d8=function(_0x4de1b5,_0x2a7626){_0x4de1b5=_0x4de1b5-0x0;var _0xed55cf=_0x4d84[_0x4de1b5];return _0xed55cf;};'use strict';var Sequelize=require(_0x44d8('0x0'));var moment=require('moment');module[_0x44d8('0x1')]={'time':{'type':Sequelize[_0x44d8('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x44d8('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x44d8('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x44d8('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x44d8('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x44d8('0x3')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4c1dad4..2c66433 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 _0x09a8=['send','index','rawAttributes','model','keys','query','filters','attributes','intersection','fields','nolimit','limit','order','where','filter','merge','map','key','VIRTUAL','field','options','VoiceQueuesLog','includeAll','findAll','rows','catch','show','include','find','create','body','update','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','then','error','stack','name'];(function(_0x1daf0a,_0x462b84){var _0x2a1c06=function(_0x1a6ac4){while(--_0x1a6ac4){_0x1daf0a['push'](_0x1daf0a['shift']());}};_0x2a1c06(++_0x462b84);}(_0x09a8,0x13d));var _0x809a=function(_0x43a7fb,_0x50a958){_0x43a7fb=_0x43a7fb-0x0;var _0x11e3d0=_0x09a8[_0x43a7fb];return _0x11e3d0;};'use strict';var pdf=require(_0x809a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x809a('0x1'));var zipdir=require(_0x809a('0x2'));var jsonpatch=require(_0x809a('0x3'));var rp=require(_0x809a('0x4'));var moment=require(_0x809a('0x5'));var BPromise=require(_0x809a('0x6'));var Mustache=require(_0x809a('0x7'));var util=require('util');var path=require(_0x809a('0x8'));var sox=require('sox');var csv=require(_0x809a('0x9'));var ejs=require(_0x809a('0xa'));var fs=require('fs');var _=require(_0x809a('0xb'));var squel=require(_0x809a('0xc'));var crypto=require(_0x809a('0xd'));var jsforce=require(_0x809a('0xe'));var deskjs=require(_0x809a('0xf'));var toCsv=require(_0x809a('0x9'));var querystring=require('querystring');var Papa=require(_0x809a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x809a('0x11'));var hardwareService=require(_0x809a('0x12'));var logger=require(_0x809a('0x13'))(_0x809a('0x14'));var utils=require(_0x809a('0x15'));var config=require(_0x809a('0x16'));var db=require(_0x809a('0x17'))['db'];function respondWithStatusCode(_0x5dfe33,_0x3fc336){_0x3fc336=_0x3fc336||0xcc;return function(_0x1b52a9){if(_0x1b52a9){return _0x5dfe33[_0x809a('0x18')](_0x3fc336);}return _0x5dfe33['status'](_0x3fc336)[_0x809a('0x19')]();};}function respondWithResult(_0x216577,_0x56a714){_0x56a714=_0x56a714||0xc8;return function(_0x472075){if(_0x472075){return _0x216577[_0x809a('0x1a')](_0x56a714)[_0x809a('0x1b')](_0x472075);}};}function respondWithFilteredResult(_0x293a4a,_0x49daa1){return function(_0x111f0b){if(_0x111f0b){var _0x5a563a=_0x111f0b[_0x809a('0x1c')],_0x60fcf=_0x49daa1[_0x809a('0x1d')],_0x21574e=_0x49daa1['offset']+_0x49daa1['limit'],_0x369532;if(_0x21574e>=_0x5a563a){_0x21574e=_0x5a563a;_0x369532=0xc8;}else{_0x369532=0xce;}_0x293a4a[_0x809a('0x1a')](_0x369532);return _0x293a4a[_0x809a('0x1e')](_0x809a('0x1f'),_0x60fcf+'-'+_0x21574e+'/'+_0x5a563a)['json'](_0x111f0b);}return null;};}function patchUpdates(_0x21c1ce){return function(_0x20d6e9){try{jsonpatch[_0x809a('0x20')](_0x20d6e9,_0x21c1ce,!![]);}catch(_0x2e6252){return BPromise[_0x809a('0x21')](_0x2e6252);}return _0x20d6e9['save']();};}function saveUpdates(_0x5d6598,_0x2008e8){return function(_0x4a3451){if(_0x4a3451){return _0x4a3451['update'](_0x5d6598)[_0x809a('0x22')](function(_0x5374dd){return _0x5374dd;});}return null;};}function removeEntity(_0x5e0e9a,_0x492641){return function(_0x435cc4){if(_0x435cc4){return _0x435cc4['destroy']()[_0x809a('0x22')](function(){_0x5e0e9a['status'](0xcc)[_0x809a('0x19')]();});}};}function handleEntityNotFound(_0x23a544,_0x342da1){return function(_0x4c91c9){if(!_0x4c91c9){_0x23a544['sendStatus'](0x194);}return _0x4c91c9;};}function handleError(_0x5af4a2,_0x214f5a){_0x214f5a=_0x214f5a||0x1f4;return function(_0x1c88bd){logger[_0x809a('0x23')](_0x1c88bd[_0x809a('0x24')]);if(_0x1c88bd[_0x809a('0x25')]){delete _0x1c88bd[_0x809a('0x25')];}_0x5af4a2[_0x809a('0x1a')](_0x214f5a)[_0x809a('0x26')](_0x1c88bd);};}exports[_0x809a('0x27')]=function(_0x37e32d,_0x5eceb6){var _0x12ce42={},_0x5db4fb={},_0x323905={'count':0x0,'rows':[]};var _0x5a82b0=db['VoiceQueuesLog'][_0x809a('0x28')];_0x5db4fb[_0x809a('0x29')]=_[_0x809a('0x2a')](_0x5a82b0);_0x5db4fb[_0x809a('0x2b')]=_[_0x809a('0x2a')](_0x37e32d[_0x809a('0x2b')]);_0x5db4fb[_0x809a('0x2c')]=_['intersection'](_0x5db4fb[_0x809a('0x29')],_0x5db4fb[_0x809a('0x2b')]);_0x12ce42[_0x809a('0x2d')]=_[_0x809a('0x2e')](_0x5db4fb[_0x809a('0x29')],qs[_0x809a('0x2f')](_0x37e32d[_0x809a('0x2b')][_0x809a('0x2f')]));_0x12ce42[_0x809a('0x2d')]=_0x12ce42[_0x809a('0x2d')]['length']?_0x12ce42[_0x809a('0x2d')]:_0x5db4fb[_0x809a('0x29')];if(!_0x37e32d['query']['hasOwnProperty'](_0x809a('0x30'))){_0x12ce42['limit']=qs[_0x809a('0x31')](_0x37e32d['query'][_0x809a('0x31')]);_0x12ce42[_0x809a('0x1d')]=qs[_0x809a('0x1d')](_0x37e32d[_0x809a('0x2b')]['offset']);}_0x12ce42[_0x809a('0x32')]=qs['sort'](_0x37e32d[_0x809a('0x2b')]['sort']);_0x12ce42[_0x809a('0x33')]=qs['filters'](_['pick'](_0x37e32d[_0x809a('0x2b')],_0x5db4fb[_0x809a('0x2c')]));if(_0x37e32d[_0x809a('0x2b')][_0x809a('0x34')]){_0x12ce42['where']=_[_0x809a('0x35')](_0x12ce42[_0x809a('0x33')],{'$or':_[_0x809a('0x36')](_0x5a82b0,function(_0x2c5271){if(_0x2c5271['type'][_0x809a('0x37')]!==_0x809a('0x38')){var _0x966778={};_0x966778[_0x2c5271[_0x809a('0x39')]]={'$like':'%'+_0x37e32d['query'][_0x809a('0x34')]+'%'};return _0x966778;}})});}_0x12ce42=_[_0x809a('0x35')]({},_0x12ce42,_0x37e32d[_0x809a('0x3a')]);var _0x57e36c={'where':_0x12ce42[_0x809a('0x33')]};return db[_0x809a('0x3b')]['count'](_0x57e36c)[_0x809a('0x22')](function(_0x3a046f){_0x323905[_0x809a('0x1c')]=_0x3a046f;if(_0x37e32d[_0x809a('0x2b')][_0x809a('0x3c')]){_0x12ce42['include']=[{'all':!![]}];}return db[_0x809a('0x3b')][_0x809a('0x3d')](_0x12ce42);})[_0x809a('0x22')](function(_0x37f7fa){_0x323905[_0x809a('0x3e')]=_0x37f7fa;return _0x323905;})[_0x809a('0x22')](respondWithFilteredResult(_0x5eceb6,_0x12ce42))[_0x809a('0x3f')](handleError(_0x5eceb6,null));};exports[_0x809a('0x40')]=function(_0x20494e,_0x8027e3){var _0x22d90e={'raw':!![],'where':{'id':_0x20494e['params']['id']}},_0x1b9c77={};_0x1b9c77['model']=_['keys'](db[_0x809a('0x3b')][_0x809a('0x28')]);_0x1b9c77[_0x809a('0x2b')]=_[_0x809a('0x2a')](_0x20494e[_0x809a('0x2b')]);_0x1b9c77[_0x809a('0x2c')]=_['intersection'](_0x1b9c77[_0x809a('0x29')],_0x1b9c77['query']);_0x22d90e['attributes']=_[_0x809a('0x2e')](_0x1b9c77[_0x809a('0x29')],qs[_0x809a('0x2f')](_0x20494e[_0x809a('0x2b')][_0x809a('0x2f')]));_0x22d90e['attributes']=_0x22d90e[_0x809a('0x2d')]['length']?_0x22d90e[_0x809a('0x2d')]:_0x1b9c77[_0x809a('0x29')];if(_0x20494e[_0x809a('0x2b')][_0x809a('0x3c')]){_0x22d90e[_0x809a('0x41')]=[{'all':!![]}];}_0x22d90e=_[_0x809a('0x35')]({},_0x22d90e,_0x20494e['options']);return db[_0x809a('0x3b')][_0x809a('0x42')](_0x22d90e)[_0x809a('0x22')](handleEntityNotFound(_0x8027e3,null))['then'](respondWithResult(_0x8027e3,null))[_0x809a('0x3f')](handleError(_0x8027e3,null));};exports['create']=function(_0x364a00,_0x53b64e){return db[_0x809a('0x3b')][_0x809a('0x43')](_0x364a00[_0x809a('0x44')],{})['then'](respondWithResult(_0x53b64e,0xc9))['catch'](handleError(_0x53b64e,null));};exports[_0x809a('0x45')]=function(_0x43bf02,_0x19bff1){if(_0x43bf02[_0x809a('0x44')]['id']){delete _0x43bf02[_0x809a('0x44')]['id'];}return db[_0x809a('0x3b')][_0x809a('0x42')]({'where':{'id':_0x43bf02[_0x809a('0x46')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x19bff1,null))[_0x809a('0x22')](saveUpdates(_0x43bf02[_0x809a('0x44')],null))[_0x809a('0x22')](respondWithResult(_0x19bff1,null))[_0x809a('0x3f')](handleError(_0x19bff1,null));};exports['destroy']=function(_0x205179,_0x902679){return db[_0x809a('0x3b')][_0x809a('0x42')]({'where':{'id':_0x205179[_0x809a('0x46')]['id']}})['then'](handleEntityNotFound(_0x902679,null))[_0x809a('0x22')](removeEntity(_0x902679,null))[_0x809a('0x3f')](handleError(_0x902679,null));}; \ No newline at end of file +var _0xd6fd=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','limit','set','Content-Range','save','update','then','status','error','name','send','index','VoiceQueuesLog','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','show','params','catch','create','body','destroy','find','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service'];(function(_0x1dedd1,_0x5b184c){var _0x47fb8e=function(_0x5be148){while(--_0x5be148){_0x1dedd1['push'](_0x1dedd1['shift']());}};_0x47fb8e(++_0x5b184c);}(_0xd6fd,0x7d));var _0xdd6f=function(_0x208c26,_0xd03b50){_0x208c26=_0x208c26-0x0;var _0x160b08=_0xd6fd[_0x208c26];return _0x160b08;};'use strict';var pdf=require(_0xdd6f('0x0'));var emlformat=require(_0xdd6f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdd6f('0x2'));var moment=require(_0xdd6f('0x3'));var BPromise=require(_0xdd6f('0x4'));var Mustache=require(_0xdd6f('0x5'));var util=require(_0xdd6f('0x6'));var path=require(_0xdd6f('0x7'));var sox=require(_0xdd6f('0x8'));var csv=require(_0xdd6f('0x9'));var ejs=require(_0xdd6f('0xa'));var fs=require('fs');var _=require(_0xdd6f('0xb'));var squel=require(_0xdd6f('0xc'));var crypto=require(_0xdd6f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd6f('0x9'));var querystring=require('querystring');var Papa=require(_0xdd6f('0xe'));var Redis=require(_0xdd6f('0xf'));var authService=require(_0xdd6f('0x10'));var qs=require(_0xdd6f('0x11'));var hardwareService=require(_0xdd6f('0x12'));var logger=require(_0xdd6f('0x13'))(_0xdd6f('0x14'));var utils=require(_0xdd6f('0x15'));var config=require(_0xdd6f('0x16'));var db=require(_0xdd6f('0x17'))['db'];function respondWithStatusCode(_0x322efe,_0x596d90){_0x596d90=_0x596d90||0xcc;return function(_0x562dad){if(_0x562dad){return _0x322efe['sendStatus'](_0x596d90);}return _0x322efe['status'](_0x596d90)[_0xdd6f('0x18')]();};}function respondWithResult(_0x74729a,_0x577016){_0x577016=_0x577016||0xc8;return function(_0x52a671){if(_0x52a671){return _0x74729a['status'](_0x577016)[_0xdd6f('0x19')](_0x52a671);}};}function respondWithFilteredResult(_0x2bfd22,_0x9c141e){return function(_0xd63d26){if(_0xd63d26){var _0x8419d8=_0xd63d26[_0xdd6f('0x1a')],_0x584502=_0x9c141e['offset'],_0x31c760=_0x9c141e['offset']+_0x9c141e[_0xdd6f('0x1b')],_0x427fb6;if(_0x31c760>=_0x8419d8){_0x31c760=_0x8419d8;_0x427fb6=0xc8;}else{_0x427fb6=0xce;}_0x2bfd22['status'](_0x427fb6);return _0x2bfd22[_0xdd6f('0x1c')](_0xdd6f('0x1d'),_0x584502+'-'+_0x31c760+'/'+_0x8419d8)[_0xdd6f('0x19')](_0xd63d26);}return null;};}function patchUpdates(_0x9e87f2){return function(_0x3697be){try{jsonpatch['apply'](_0x3697be,_0x9e87f2,!![]);}catch(_0x54db63){return BPromise['reject'](_0x54db63);}return _0x3697be[_0xdd6f('0x1e')]();};}function saveUpdates(_0x211dd3,_0x4d69f0){return function(_0x49bcb9){if(_0x49bcb9){return _0x49bcb9[_0xdd6f('0x1f')](_0x211dd3)['then'](function(_0x214589){return _0x214589;});}return null;};}function removeEntity(_0x515016,_0x4fb3e8){return function(_0x288f00){if(_0x288f00){return _0x288f00['destroy']()[_0xdd6f('0x20')](function(){_0x515016[_0xdd6f('0x21')](0xcc)[_0xdd6f('0x18')]();});}};}function handleEntityNotFound(_0x573246,_0x3f03f9){return function(_0xdd399e){if(!_0xdd399e){_0x573246['sendStatus'](0x194);}return _0xdd399e;};}function handleError(_0x3de039,_0x9a1021){_0x9a1021=_0x9a1021||0x1f4;return function(_0x5b419d){logger[_0xdd6f('0x22')](_0x5b419d['stack']);if(_0x5b419d[_0xdd6f('0x23')]){delete _0x5b419d[_0xdd6f('0x23')];}_0x3de039[_0xdd6f('0x21')](_0x9a1021)[_0xdd6f('0x24')](_0x5b419d);};}exports[_0xdd6f('0x25')]=function(_0x59f6e8,_0x39a7b1){var _0x53d432={},_0x2a601d={},_0x59c825={'count':0x0,'rows':[]};var _0x59e863=db[_0xdd6f('0x26')][_0xdd6f('0x27')];_0x2a601d[_0xdd6f('0x28')]=_[_0xdd6f('0x29')](_0x59e863);_0x2a601d[_0xdd6f('0x2a')]=_['keys'](_0x59f6e8['query']);_0x2a601d[_0xdd6f('0x2b')]=_[_0xdd6f('0x2c')](_0x2a601d[_0xdd6f('0x28')],_0x2a601d[_0xdd6f('0x2a')]);_0x53d432[_0xdd6f('0x2d')]=_[_0xdd6f('0x2c')](_0x2a601d[_0xdd6f('0x28')],qs['fields'](_0x59f6e8['query'][_0xdd6f('0x2e')]));_0x53d432[_0xdd6f('0x2d')]=_0x53d432[_0xdd6f('0x2d')][_0xdd6f('0x2f')]?_0x53d432[_0xdd6f('0x2d')]:_0x2a601d[_0xdd6f('0x28')];if(!_0x59f6e8['query']['hasOwnProperty'](_0xdd6f('0x30'))){_0x53d432[_0xdd6f('0x1b')]=qs[_0xdd6f('0x1b')](_0x59f6e8[_0xdd6f('0x2a')]['limit']);_0x53d432[_0xdd6f('0x31')]=qs[_0xdd6f('0x31')](_0x59f6e8['query']['offset']);}_0x53d432[_0xdd6f('0x32')]=qs['sort'](_0x59f6e8[_0xdd6f('0x2a')][_0xdd6f('0x33')]);_0x53d432[_0xdd6f('0x34')]=qs[_0xdd6f('0x2b')](_[_0xdd6f('0x35')](_0x59f6e8[_0xdd6f('0x2a')],_0x2a601d[_0xdd6f('0x2b')]));if(_0x59f6e8[_0xdd6f('0x2a')]['filter']){_0x53d432[_0xdd6f('0x34')]=_[_0xdd6f('0x36')](_0x53d432[_0xdd6f('0x34')],{'$or':_[_0xdd6f('0x37')](_0x59e863,function(_0x54afbd){if(_0x54afbd[_0xdd6f('0x38')][_0xdd6f('0x39')]!==_0xdd6f('0x3a')){var _0xbe9ae4={};_0xbe9ae4[_0x54afbd[_0xdd6f('0x3b')]]={'$like':'%'+_0x59f6e8['query'][_0xdd6f('0x3c')]+'%'};return _0xbe9ae4;}})});}_0x53d432=_[_0xdd6f('0x36')]({},_0x53d432,_0x59f6e8[_0xdd6f('0x3d')]);var _0x5a2c02={'where':_0x53d432[_0xdd6f('0x34')]};return db[_0xdd6f('0x26')][_0xdd6f('0x1a')](_0x5a2c02)[_0xdd6f('0x20')](function(_0x1178fb){_0x59c825[_0xdd6f('0x1a')]=_0x1178fb;if(_0x59f6e8['query'][_0xdd6f('0x3e')]){_0x53d432[_0xdd6f('0x3f')]=[{'all':!![]}];}return db[_0xdd6f('0x26')]['findAll'](_0x53d432);})[_0xdd6f('0x20')](function(_0x83a6fc){_0x59c825['rows']=_0x83a6fc;return _0x59c825;})['then'](respondWithFilteredResult(_0x39a7b1,_0x53d432))['catch'](handleError(_0x39a7b1,null));};exports[_0xdd6f('0x40')]=function(_0x370e6d,_0x52934e){var _0x5a2207={'raw':!![],'where':{'id':_0x370e6d[_0xdd6f('0x41')]['id']}},_0x28290a={};_0x28290a[_0xdd6f('0x28')]=_['keys'](db[_0xdd6f('0x26')][_0xdd6f('0x27')]);_0x28290a['query']=_[_0xdd6f('0x29')](_0x370e6d['query']);_0x28290a[_0xdd6f('0x2b')]=_[_0xdd6f('0x2c')](_0x28290a[_0xdd6f('0x28')],_0x28290a[_0xdd6f('0x2a')]);_0x5a2207[_0xdd6f('0x2d')]=_[_0xdd6f('0x2c')](_0x28290a[_0xdd6f('0x28')],qs[_0xdd6f('0x2e')](_0x370e6d['query'][_0xdd6f('0x2e')]));_0x5a2207[_0xdd6f('0x2d')]=_0x5a2207['attributes'][_0xdd6f('0x2f')]?_0x5a2207['attributes']:_0x28290a[_0xdd6f('0x28')];if(_0x370e6d[_0xdd6f('0x2a')][_0xdd6f('0x3e')]){_0x5a2207['include']=[{'all':!![]}];}_0x5a2207=_[_0xdd6f('0x36')]({},_0x5a2207,_0x370e6d[_0xdd6f('0x3d')]);return db[_0xdd6f('0x26')]['find'](_0x5a2207)[_0xdd6f('0x20')](handleEntityNotFound(_0x52934e,null))[_0xdd6f('0x20')](respondWithResult(_0x52934e,null))[_0xdd6f('0x42')](handleError(_0x52934e,null));};exports['create']=function(_0x1e1bb5,_0x31d47a){return db[_0xdd6f('0x26')][_0xdd6f('0x43')](_0x1e1bb5['body'],{})['then'](respondWithResult(_0x31d47a,0xc9))[_0xdd6f('0x42')](handleError(_0x31d47a,null));};exports[_0xdd6f('0x1f')]=function(_0x365868,_0x13f3da){if(_0x365868[_0xdd6f('0x44')]['id']){delete _0x365868[_0xdd6f('0x44')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x365868['params']['id']}})['then'](handleEntityNotFound(_0x13f3da,null))[_0xdd6f('0x20')](saveUpdates(_0x365868['body'],null))[_0xdd6f('0x20')](respondWithResult(_0x13f3da,null))[_0xdd6f('0x42')](handleError(_0x13f3da,null));};exports[_0xdd6f('0x45')]=function(_0x61de3b,_0x4c23a3){return db[_0xdd6f('0x26')][_0xdd6f('0x46')]({'where':{'id':_0x61de3b[_0xdd6f('0x41')]['id']}})[_0xdd6f('0x20')](handleEntityNotFound(_0x4c23a3,null))['then'](removeEntity(_0x4c23a3,null))[_0xdd6f('0x42')](handleError(_0x4c23a3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c59d5a3..b106a7b 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 _0xb392=['VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','api','moment','bluebird','request-promise','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x3596a9,_0x2d26a0){var _0x3b0d1e=function(_0x245098){while(--_0x245098){_0x3596a9['push'](_0x3596a9['shift']());}};_0x3b0d1e(++_0x2d26a0);}(_0xb392,0xc7));var _0x2b39=function(_0x51dae4,_0xa7f367){_0x51dae4=_0x51dae4-0x0;var _0x27d0b0=_0xb392[_0x51dae4];return _0x27d0b0;};'use strict';var _=require(_0x2b39('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2b39('0x1'));var moment=require(_0x2b39('0x2'));var BPromise=require(_0x2b39('0x3'));var rp=require(_0x2b39('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b39('0x5'));var attributes=require(_0x2b39('0x6'));module[_0x2b39('0x7')]=function(_0x202a31,_0x4bb8f9){return _0x202a31[_0x2b39('0x8')](_0x2b39('0x9'),attributes,{'tableName':_0x2b39('0xa'),'paranoid':![],'indexes':[{'name':_0x2b39('0xb'),'fields':[_0x2b39('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xa9b2=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','voice_queues_log','event_dtm','event','dtm'];(function(_0x549c39,_0x1f88de){var _0xb88b84=function(_0x1dee91){while(--_0x1dee91){_0x549c39['push'](_0x549c39['shift']());}};_0xb88b84(++_0x1f88de);}(_0xa9b2,0xc3));var _0x2a9b=function(_0x2dee81,_0x58c3df){_0x2dee81=_0x2dee81-0x0;var _0xa3a214=_0xa9b2[_0x2dee81];return _0xa3a214;};'use strict';var _=require('lodash');var util=require(_0x2a9b('0x0'));var logger=require(_0x2a9b('0x1'))(_0x2a9b('0x2'));var moment=require(_0x2a9b('0x3'));var BPromise=require(_0x2a9b('0x4'));var rp=require(_0x2a9b('0x5'));var fs=require('fs');var path=require(_0x2a9b('0x6'));var rimraf=require(_0x2a9b('0x7'));var config=require(_0x2a9b('0x8'));var attributes=require(_0x2a9b('0x9'));module[_0x2a9b('0xa')]=function(_0x4d55d9,_0x2f45cf){return _0x4d55d9['define']('VoiceQueuesLog',attributes,{'tableName':_0x2a9b('0xb'),'paranoid':![],'indexes':[{'name':_0x2a9b('0xc'),'fields':[_0x2a9b('0xd'),_0x2a9b('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f7a3f3a..6cfc110 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 _0xc900=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc900,0xb3));var _0x0c90=function(_0x52966e,_0x409155){_0x52966e=_0x52966e-0x0;var _0x47587e=_0xc900[_0x52966e];return _0x47587e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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')]('VoiceQueuesLog,\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/voiceRecording/index.js b/server/api/voiceRecording/index.js index d515706..74f237e 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 _0x9c88=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','describe','show','get','/:id/download','download','/:id','delete','exports','connect-timeout'];(function(_0x57deb6,_0x478ded){var _0x32b7f7=function(_0x33b996){while(--_0x33b996){_0x57deb6['push'](_0x57deb6['shift']());}};_0x32b7f7(++_0x478ded);}(_0x9c88,0x8f));var _0x89c8=function(_0x56a347,_0x54d322){_0x56a347=_0x56a347-0x0;var _0x2745f7=_0x9c88[_0x56a347];return _0x2745f7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x89c8('0x0'));var express=require(_0x89c8('0x1'));var router=express['Router']();var auth=require(_0x89c8('0x2'));var interaction=require(_0x89c8('0x3'));var config=require(_0x89c8('0x4'));var controller=require(_0x89c8('0x5'));router['get']('/',auth[_0x89c8('0x6')](),controller[_0x89c8('0x7')]);router['get']('/describe',auth[_0x89c8('0x6')](),controller[_0x89c8('0x8')]);router['get']('/:id',auth[_0x89c8('0x6')](),controller[_0x89c8('0x9')]);router[_0x89c8('0xa')](_0x89c8('0xb'),auth[_0x89c8('0x6')](),controller[_0x89c8('0xc')]);router[_0x89c8('0xa')]('/:id/downloads',controller['downloads']);router['post']('/',auth[_0x89c8('0x6')](),controller['create']);router['put'](_0x89c8('0xd'),auth[_0x89c8('0x6')](),controller['update']);router[_0x89c8('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x89c8('0xf')]=router; \ No newline at end of file +var _0xe956=['../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','download','/:id/downloads','downloads','post','delete','exports','util','path','Router'];(function(_0x4f8f52,_0x139a03){var _0x16c1d4=function(_0x333a1a){while(--_0x333a1a){_0x4f8f52['push'](_0x4f8f52['shift']());}};_0x16c1d4(++_0x139a03);}(_0xe956,0x9f));var _0x6e95=function(_0x3dcfeb,_0x152f15){_0x3dcfeb=_0x3dcfeb-0x0;var _0x52fd91=_0xe956[_0x3dcfeb];return _0x52fd91;};'use strict';var multer=require('multer');var util=require(_0x6e95('0x0'));var path=require(_0x6e95('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6e95('0x2')]();var auth=require(_0x6e95('0x3'));var interaction=require(_0x6e95('0x4'));var config=require('../../config/environment');var controller=require(_0x6e95('0x5'));router[_0x6e95('0x6')]('/',auth[_0x6e95('0x7')](),controller[_0x6e95('0x8')]);router['get'](_0x6e95('0x9'),auth['isAuthenticated'](),controller[_0x6e95('0xa')]);router[_0x6e95('0x6')](_0x6e95('0xb'),auth[_0x6e95('0x7')](),controller['show']);router[_0x6e95('0x6')]('/:id/download',auth[_0x6e95('0x7')](),controller[_0x6e95('0xc')]);router[_0x6e95('0x6')](_0x6e95('0xd'),controller[_0x6e95('0xe')]);router[_0x6e95('0xf')]('/',auth[_0x6e95('0x7')](),controller['create']);router['put']('/:id',auth[_0x6e95('0x7')](),controller['update']);router[_0x6e95('0x10')](_0x6e95('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e95('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1a9a919..4fdb564 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 _0x77a4=['getDataValue','value','extname','STRING','setDataValue','membername','split','INTEGER','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','exports','VIRTUAL'];(function(_0x2668be,_0x4da205){var _0x5817ea=function(_0x419d22){while(--_0x419d22){_0x2668be['push'](_0x2668be['shift']());}};_0x5817ea(++_0x4da205);}(_0x77a4,0x7a));var _0x477a=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x77a4[_0x3e21f4];return _0x40fc49;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x477a('0x0'));var path=require(_0x477a('0x1'));module[_0x477a('0x2')]={'format':{'type':Sequelize[_0x477a('0x3')],'get':function(){return this[_0x477a('0x4')](_0x477a('0x5'))?path[_0x477a('0x6')](this['getDataValue'](_0x477a('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x477a('0x7')],'set':function(_0x35ef27){if(_0x35ef27){this[_0x477a('0x8')]('channel',_0x35ef27);this['setDataValue'](_0x477a('0x9'),_0x35ef27[_0x477a('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x477a('0x7')]},'calleridnum':{'type':Sequelize[_0x477a('0x7')]},'calleridname':{'type':Sequelize[_0x477a('0x7')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x477a('0x7')]},'context':{'type':Sequelize[_0x477a('0x7')]},'exten':{'type':Sequelize[_0x477a('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x477a('0x7')]},'rating':{'type':Sequelize[_0x477a('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x477a('0x7')]},'createdAt':{'type':Sequelize[_0x477a('0xc')],'get':function(){return moment(this[_0x477a('0x4')](_0x477a('0xd')))[_0x477a('0xe')](_0x477a('0xf'))[_0x477a('0x10')]();}},'updatedAt':{'type':Sequelize[_0x477a('0xc')],'get':function(){return moment(this[_0x477a('0x4')](_0x477a('0x11')))[_0x477a('0xe')](_0x477a('0xf'))[_0x477a('0x10')]();}}}; \ No newline at end of file +var _0x2823=['sequelize','path','exports','getDataValue','value','extname','STRING','setDataValue','channel','split','INTEGER','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x23d075,_0x341f61){var _0x205e13=function(_0x2246b5){while(--_0x2246b5){_0x23d075['push'](_0x23d075['shift']());}};_0x205e13(++_0x341f61);}(_0x2823,0x78));var _0x3282=function(_0x11e155,_0x5188ed){_0x11e155=_0x11e155-0x0;var _0x922939=_0x2823[_0x11e155];return _0x922939;};'use strict';var Sequelize=require(_0x3282('0x0'));var moment=require('moment');var path=require(_0x3282('0x1'));module[_0x3282('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3282('0x3')](_0x3282('0x4'))?path[_0x3282('0x5')](this[_0x3282('0x3')](_0x3282('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x3282('0x6')]},'channel':{'type':Sequelize[_0x3282('0x6')],'set':function(_0x41715e){if(_0x41715e){this[_0x3282('0x7')](_0x3282('0x8'),_0x41715e);this[_0x3282('0x7')]('membername',_0x41715e[_0x3282('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3282('0x6')]},'connectedlinenum':{'type':Sequelize[_0x3282('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3282('0x6')]},'context':{'type':Sequelize[_0x3282('0x6')]},'exten':{'type':Sequelize[_0x3282('0x6')]},'value':{'type':Sequelize[_0x3282('0x6')]},'type':{'type':Sequelize[_0x3282('0x6')]},'rating':{'type':Sequelize[_0x3282('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x3282('0x6')]},'userDisposition':{'type':Sequelize[_0x3282('0x6')]},'createdAt':{'type':Sequelize[_0x3282('0xb')],'get':function(){return moment(this[_0x3282('0x3')]('createdAt'))[_0x3282('0xc')](_0x3282('0xd'))[_0x3282('0xe')]();}},'updatedAt':{'type':Sequelize[_0x3282('0xb')],'get':function(){return moment(this[_0x3282('0x3')]('updatedAt'))[_0x3282('0xc')](_0x3282('0xd'))[_0x3282('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index e877dea..16f0095 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 _0xf146=['key','VIRTUAL','field','merge','options','includeAll','include','findAll','params','find','create','body','catch','update','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','$and','push','decryptFile','existsSync','Sequelize','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','VoiceRecording','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','type'];(function(_0x542a5d,_0x27e6c8){var _0x251378=function(_0x295247){while(--_0x295247){_0x542a5d['push'](_0x542a5d['shift']());}};_0x251378(++_0x27e6c8);}(_0xf146,0x88));var _0x6f14=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xf146[_0x1fc1f9];return _0x4987ca;};'use strict';var pdf=require(_0x6f14('0x0'));var emlformat=require(_0x6f14('0x1'));var rimraf=require(_0x6f14('0x2'));var zipdir=require(_0x6f14('0x3'));var jsonpatch=require(_0x6f14('0x4'));var rp=require('request-promise');var moment=require(_0x6f14('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6f14('0x6'));var util=require(_0x6f14('0x7'));var path=require(_0x6f14('0x8'));var sox=require(_0x6f14('0x9'));var csv=require(_0x6f14('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f14('0xb'));var squel=require(_0x6f14('0xc'));var crypto=require('crypto');var jsforce=require(_0x6f14('0xd'));var deskjs=require(_0x6f14('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f14('0xf'));var Papa=require(_0x6f14('0x10'));var Redis=require(_0x6f14('0x11'));var authService=require(_0x6f14('0x12'));var qs=require(_0x6f14('0x13'));var hardwareService=require(_0x6f14('0x14'));var logger=require('../../config/logger')(_0x6f14('0x15'));var utils=require('../../config/utils');var config=require(_0x6f14('0x16'));var db=require(_0x6f14('0x17'))['db'];function respondWithStatusCode(_0x2a61b6,_0x2c6119){_0x2c6119=_0x2c6119||0xcc;return function(_0x2f4fbd){if(_0x2f4fbd){return _0x2a61b6['sendStatus'](_0x2c6119);}return _0x2a61b6['status'](_0x2c6119)[_0x6f14('0x18')]();};}function respondWithResult(_0x45139b,_0x55236f){_0x55236f=_0x55236f||0xc8;return function(_0x31d865){if(_0x31d865){return _0x45139b[_0x6f14('0x19')](_0x55236f)[_0x6f14('0x1a')](_0x31d865);}};}function respondWithFilteredResult(_0x1860ab,_0x47934c){return function(_0x227c85){if(_0x227c85){var _0x5c16bb=_0x227c85[_0x6f14('0x1b')],_0x2eb5bd=_0x47934c[_0x6f14('0x1c')],_0x4164e9=_0x47934c[_0x6f14('0x1c')]+_0x47934c['limit'],_0x59824c;if(_0x4164e9>=_0x5c16bb){_0x4164e9=_0x5c16bb;_0x59824c=0xc8;}else{_0x59824c=0xce;}_0x1860ab[_0x6f14('0x19')](_0x59824c);return _0x1860ab[_0x6f14('0x1d')](_0x6f14('0x1e'),_0x2eb5bd+'-'+_0x4164e9+'/'+_0x5c16bb)[_0x6f14('0x1a')](_0x227c85);}return null;};}function patchUpdates(_0x4a9a01){return function(_0x362535){try{jsonpatch[_0x6f14('0x1f')](_0x362535,_0x4a9a01,!![]);}catch(_0x20aca7){return BPromise[_0x6f14('0x20')](_0x20aca7);}return _0x362535['save']();};}function saveUpdates(_0x323e24,_0x3807c3){return function(_0xdd18eb){if(_0xdd18eb){return _0xdd18eb['update'](_0x323e24)[_0x6f14('0x21')](function(_0x5f15bb){return _0x5f15bb;});}return null;};}function removeEntity(_0x1cc3db,_0x47e1af){return function(_0xb4bc9e){if(_0xb4bc9e){return _0xb4bc9e[_0x6f14('0x22')]()[_0x6f14('0x21')](function(){_0x1cc3db[_0x6f14('0x19')](0xcc)[_0x6f14('0x18')]();});}};}function handleEntityNotFound(_0x42181c,_0x4177b2){return function(_0x46e720){if(!_0x46e720){_0x42181c[_0x6f14('0x23')](0x194);}return _0x46e720;};}function handleError(_0x2218c9,_0x400687){_0x400687=_0x400687||0x1f4;return function(_0x1c660a){logger[_0x6f14('0x24')](_0x1c660a[_0x6f14('0x25')]);if(_0x1c660a[_0x6f14('0x26')]){delete _0x1c660a[_0x6f14('0x26')];}_0x2218c9[_0x6f14('0x19')](_0x400687)[_0x6f14('0x27')](_0x1c660a);};}exports[_0x6f14('0x28')]=function(_0x2906f1,_0x38dc0f){var _0x3827de={},_0x4e7e8a={},_0x175696={'count':0x0,'rows':[]};var _0x43177c=db[_0x6f14('0x29')]['rawAttributes'];_0x4e7e8a[_0x6f14('0x2a')]=_[_0x6f14('0x2b')](_['keys'](_0x43177c),['format']);_0x4e7e8a[_0x6f14('0x2c')]=_[_0x6f14('0x2d')](_0x2906f1['query']);_0x4e7e8a[_0x6f14('0x2e')]=_[_0x6f14('0x2f')](_0x4e7e8a[_0x6f14('0x2a')],_0x4e7e8a['query']);_0x3827de['attributes']=_[_0x6f14('0x2f')](_0x4e7e8a[_0x6f14('0x2a')],qs[_0x6f14('0x30')](_0x2906f1[_0x6f14('0x2c')]['fields']));_0x3827de[_0x6f14('0x31')]=_0x3827de[_0x6f14('0x31')][_0x6f14('0x32')]?_0x3827de['attributes']:_0x4e7e8a['model'];if(!_0x2906f1[_0x6f14('0x2c')][_0x6f14('0x33')](_0x6f14('0x34'))){_0x3827de[_0x6f14('0x35')]=qs['limit'](_0x2906f1[_0x6f14('0x2c')][_0x6f14('0x35')]);_0x3827de[_0x6f14('0x1c')]=qs[_0x6f14('0x1c')](_0x2906f1['query'][_0x6f14('0x1c')]);}_0x3827de[_0x6f14('0x36')]=qs[_0x6f14('0x37')](_0x2906f1['query'][_0x6f14('0x37')]);_0x3827de[_0x6f14('0x38')]=qs['filters'](_['pick'](_0x2906f1[_0x6f14('0x2c')],_0x4e7e8a['filters']));if(_0x2906f1[_0x6f14('0x2c')][_0x6f14('0x39')]){_0x3827de['where']=_['merge'](_0x3827de[_0x6f14('0x38')],{'$or':_[_0x6f14('0x3a')](_0x43177c,function(_0x46e67e){if(_0x46e67e[_0x6f14('0x3b')][_0x6f14('0x3c')]!==_0x6f14('0x3d')){var _0x4e12d3={};_0x4e12d3[_0x46e67e[_0x6f14('0x3e')]]={'$like':'%'+_0x2906f1[_0x6f14('0x2c')][_0x6f14('0x39')]+'%'};return _0x4e12d3;}})});}_0x3827de=_[_0x6f14('0x3f')]({},_0x3827de,_0x2906f1[_0x6f14('0x40')]);var _0x23dd2e={'where':_0x3827de[_0x6f14('0x38')]};return db[_0x6f14('0x29')][_0x6f14('0x1b')](_0x23dd2e)[_0x6f14('0x21')](function(_0x36070a){_0x175696[_0x6f14('0x1b')]=_0x36070a;if(_0x2906f1[_0x6f14('0x2c')][_0x6f14('0x41')]){_0x3827de[_0x6f14('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x6f14('0x43')](_0x3827de);})[_0x6f14('0x21')](function(_0x323d33){_0x175696['rows']=_0x323d33;return _0x175696;})[_0x6f14('0x21')](respondWithFilteredResult(_0x38dc0f,_0x3827de))['catch'](handleError(_0x38dc0f,null));};exports['show']=function(_0x10cc9c,_0x2f4ccf){var _0x357adf={'raw':![],'where':{'id':_0x10cc9c[_0x6f14('0x44')]['id']}},_0xe6277b={};_0xe6277b[_0x6f14('0x2a')]=_[_0x6f14('0x2d')](db[_0x6f14('0x29')]['rawAttributes']);_0xe6277b[_0x6f14('0x2c')]=_[_0x6f14('0x2d')](_0x10cc9c[_0x6f14('0x2c')]);_0xe6277b['filters']=_['intersection'](_0xe6277b[_0x6f14('0x2a')],_0xe6277b[_0x6f14('0x2c')]);_0x357adf[_0x6f14('0x31')]=_[_0x6f14('0x2f')](_0xe6277b[_0x6f14('0x2a')],qs[_0x6f14('0x30')](_0x10cc9c['query'][_0x6f14('0x30')]));_0x357adf[_0x6f14('0x31')]=_0x357adf[_0x6f14('0x31')][_0x6f14('0x32')]?_0x357adf['attributes']:_0xe6277b[_0x6f14('0x2a')];if(_0x10cc9c['query']['includeAll']){_0x357adf[_0x6f14('0x42')]=[{'all':!![]}];}_0x357adf=_[_0x6f14('0x3f')]({},_0x357adf,_0x10cc9c[_0x6f14('0x40')]);return db[_0x6f14('0x29')][_0x6f14('0x45')](_0x357adf)[_0x6f14('0x21')](handleEntityNotFound(_0x2f4ccf,null))[_0x6f14('0x21')](respondWithResult(_0x2f4ccf,null))['catch'](handleError(_0x2f4ccf,null));};exports[_0x6f14('0x46')]=function(_0x36cec1,_0x203725){return db[_0x6f14('0x29')][_0x6f14('0x46')](_0x36cec1[_0x6f14('0x47')],{})['then'](respondWithResult(_0x203725,0xc9))[_0x6f14('0x48')](handleError(_0x203725,null));};exports[_0x6f14('0x49')]=function(_0x48401a,_0x27c47c){if(_0x48401a[_0x6f14('0x47')]['id']){delete _0x48401a[_0x6f14('0x47')]['id'];}return db[_0x6f14('0x29')]['find']({'where':{'id':_0x48401a['params']['id']}})[_0x6f14('0x21')](handleEntityNotFound(_0x27c47c,null))[_0x6f14('0x21')](saveUpdates(_0x48401a['body'],null))[_0x6f14('0x21')](respondWithResult(_0x27c47c,null))[_0x6f14('0x48')](handleError(_0x27c47c,null));};exports[_0x6f14('0x22')]=function(_0x4e7023,_0x338923){return db['VoiceRecording']['find']({'where':{'id':_0x4e7023[_0x6f14('0x44')]['id']}})[_0x6f14('0x21')](handleEntityNotFound(_0x338923,null))['then'](removeEntity(_0x338923,null))[_0x6f14('0x48')](handleError(_0x338923,null));};exports['describe']=function(_0x3bfa7e,_0x4c49a8){return db[_0x6f14('0x29')][_0x6f14('0x4a')]()[_0x6f14('0x21')](respondWithResult(_0x4c49a8,null))[_0x6f14('0x48')](handleError(_0x4c49a8,null));};exports[_0x6f14('0x4b')]=function(_0x575a1c,_0x220dcb,_0x4f3ce7){var _0x58e355=require(_0x6f14('0x4c'));var _0x3f7825=![];var _0x560ee7={};if(_0x575a1c['query'][_0x6f14('0x3b')]&&_0x575a1c['query'][_0x6f14('0x3b')]===_0x6f14('0x4d')){_0x560ee7[_0x6f14('0x4d')]=_0x575a1c[_0x6f14('0x44')]['id'];}else{_0x560ee7['id']=_0x575a1c[_0x6f14('0x44')]['id'];}return db[_0x6f14('0x29')]['find']({'where':_0x560ee7,'attributes':['id',_0x6f14('0x4e')],'raw':!![]})[_0x6f14('0x21')](handleEntityNotFound(_0x220dcb,null))[_0x6f14('0x21')](function(_0x38e48a){if(_0x38e48a){var _0x33021f=_0x38e48a['value'];var _0x32db73=util[_0x6f14('0x4f')](_0x6f14('0x50'),_0x33021f);if(fs['existsSync'](_0x32db73)){_0x3f7825=!![];return _0x58e355['decryptFile'](_0x32db73,_0x33021f,config[_0x6f14('0x51')][_0x6f14('0x52')])[_0x6f14('0x21')](function(){return _0x38e48a;});}return _0x38e48a;}})[_0x6f14('0x21')](function(_0x44196e){if(_0x44196e){var _0x464a56=_0x44196e[_0x6f14('0x4e')];if(!fs['existsSync'](_0x464a56)){throw new db['Sequelize'][(_0x6f14('0x53'))](_0x6f14('0x54'));}if(_0x44196e[_0x6f14('0x55')]){return _0x220dcb[_0x6f14('0x4b')](_0x464a56,_0x44196e[_0x6f14('0x55')]+path[_0x6f14('0x56')](_0x464a56),function(){if(_0x3f7825){fs[_0x6f14('0x57')](_0x464a56);}});}else{return _0x220dcb['download'](_0x464a56,function(_0x47d7e0){if(_0x3f7825){fs['unlink'](_0x464a56);}});}}})[_0x6f14('0x48')](function(_0x31dfe1){if(_0x31dfe1[_0x6f14('0x58')]===_0x6f14('0x54')){_0x220dcb[_0x6f14('0x19')](0x194)[_0x6f14('0x27')](_0x6f14('0x59'));}else{return handleError(_0x220dcb,null);}});};exports['downloads']=function(_0x2ccdbc,_0x340de4,_0x44b99c){var _0x25b166=require(_0x6f14('0x4c'));var _0x48dae2=![];var _0x6af156={'$and':[db['sequelize'][_0x6f14('0x38')](db[_0x6f14('0x5a')]['fn'](_0x6f14('0x5b'),db[_0x6f14('0x5a')][_0x6f14('0x5c')](_0x6f14('0x4d'))),_0x2ccdbc[_0x6f14('0x2c')]['token'])]};if(_0x2ccdbc[_0x6f14('0x2c')][_0x6f14('0x3b')]&&_0x2ccdbc[_0x6f14('0x2c')][_0x6f14('0x3b')]===_0x6f14('0x4d')){_0x6af156[_0x6f14('0x5d')][_0x6f14('0x5e')]({'uniqueid':_0x2ccdbc[_0x6f14('0x44')]['id']});}else{_0x6af156['$and'][_0x6f14('0x5e')]({'id':_0x2ccdbc[_0x6f14('0x44')]['id']});}return db['VoiceRecording'][_0x6f14('0x45')]({'where':_0x6af156,'attributes':['id',_0x6f14('0x4e')],'raw':!![]})[_0x6f14('0x21')](handleEntityNotFound(_0x340de4,null))[_0x6f14('0x21')](function(_0x717763){if(_0x717763){var _0x585a5f=util[_0x6f14('0x4f')](_0x6f14('0x50'),_0x717763['value']);if(fs['existsSync'](_0x585a5f)){_0x48dae2=!![];return _0x25b166[_0x6f14('0x5f')](_0x585a5f,_0x717763['value'],config['secrets'][_0x6f14('0x52')])[_0x6f14('0x21')](function(){return _0x717763;});}return _0x717763;}})[_0x6f14('0x21')](function(_0x3cb15a){if(_0x3cb15a){if(!fs[_0x6f14('0x60')](_0x3cb15a[_0x6f14('0x4e')])){throw new db[(_0x6f14('0x61'))]['ValidationError'](_0x6f14('0x54'));}if(_0x3cb15a[_0x6f14('0x55')]){return _0x340de4[_0x6f14('0x4b')](_0x3cb15a[_0x6f14('0x4e')],_0x3cb15a['filename']+path[_0x6f14('0x56')](_0x3cb15a[_0x6f14('0x4e')]),function(){if(_0x48dae2){fs[_0x6f14('0x57')](_0x3cb15a[_0x6f14('0x4e')]);}});}else{return _0x340de4[_0x6f14('0x4b')](_0x3cb15a['value'],function(_0x53f257){if(_0x48dae2){fs[_0x6f14('0x57')](_0x3cb15a[_0x6f14('0x4e')]);}});}}})[_0x6f14('0x48')](handleError(_0x340de4,null));}; \ No newline at end of file +var _0x35c0=['path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','end','error','name','send','VoiceRecording','rawAttributes','model','differenceBy','keys','query','filters','attributes','intersection','fields','order','sort','pick','where','map','key','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','type','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','download','Not\x20found','sequelize','MD5','col','uniqueid','token','$and','push','ValidationError','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35c0,0x166));var _0x035c=function(_0x22ea59,_0x387ed1){_0x22ea59=_0x22ea59-0x0;var _0x444611=_0x35c0[_0x22ea59];return _0x444611;};'use strict';var pdf=require(_0x035c('0x0'));var emlformat=require(_0x035c('0x1'));var rimraf=require(_0x035c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x035c('0x3'));var rp=require(_0x035c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x035c('0x5'));var path=require(_0x035c('0x6'));var sox=require(_0x035c('0x7'));var csv=require(_0x035c('0x8'));var ejs=require(_0x035c('0x9'));var fs=require('fs');var _=require(_0x035c('0xa'));var squel=require(_0x035c('0xb'));var crypto=require(_0x035c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x035c('0xd'));var Papa=require(_0x035c('0xe'));var Redis=require(_0x035c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x035c('0x10'));var hardwareService=require(_0x035c('0x11'));var logger=require(_0x035c('0x12'))(_0x035c('0x13'));var utils=require('../../config/utils');var config=require(_0x035c('0x14'));var db=require(_0x035c('0x15'))['db'];function respondWithStatusCode(_0x105c80,_0x594553){_0x594553=_0x594553||0xcc;return function(_0xd69236){if(_0xd69236){return _0x105c80[_0x035c('0x16')](_0x594553);}return _0x105c80[_0x035c('0x17')](_0x594553)['end']();};}function respondWithResult(_0x30b782,_0x3b4f7c){_0x3b4f7c=_0x3b4f7c||0xc8;return function(_0xa1ee7f){if(_0xa1ee7f){return _0x30b782[_0x035c('0x17')](_0x3b4f7c)[_0x035c('0x18')](_0xa1ee7f);}};}function respondWithFilteredResult(_0x118b02,_0x513b72){return function(_0x3a8625){if(_0x3a8625){var _0x5d78b9=_0x3a8625[_0x035c('0x19')],_0x2f6b34=_0x513b72[_0x035c('0x1a')],_0x989855=_0x513b72[_0x035c('0x1a')]+_0x513b72[_0x035c('0x1b')],_0x36b429;if(_0x989855>=_0x5d78b9){_0x989855=_0x5d78b9;_0x36b429=0xc8;}else{_0x36b429=0xce;}_0x118b02[_0x035c('0x17')](_0x36b429);return _0x118b02[_0x035c('0x1c')](_0x035c('0x1d'),_0x2f6b34+'-'+_0x989855+'/'+_0x5d78b9)[_0x035c('0x18')](_0x3a8625);}return null;};}function patchUpdates(_0x50cc4f){return function(_0xdcae4c){try{jsonpatch['apply'](_0xdcae4c,_0x50cc4f,!![]);}catch(_0x5cb18c){return BPromise[_0x035c('0x1e')](_0x5cb18c);}return _0xdcae4c['save']();};}function saveUpdates(_0x4b3aec,_0x4f3cf9){return function(_0x49dc5d){if(_0x49dc5d){return _0x49dc5d[_0x035c('0x1f')](_0x4b3aec)[_0x035c('0x20')](function(_0x57564e){return _0x57564e;});}return null;};}function removeEntity(_0x13ca7c,_0xa3b25f){return function(_0x2c2858){if(_0x2c2858){return _0x2c2858['destroy']()[_0x035c('0x20')](function(){_0x13ca7c[_0x035c('0x17')](0xcc)[_0x035c('0x21')]();});}};}function handleEntityNotFound(_0x1f148d,_0x598f39){return function(_0x367373){if(!_0x367373){_0x1f148d[_0x035c('0x16')](0x194);}return _0x367373;};}function handleError(_0x43a50c,_0x5f0220){_0x5f0220=_0x5f0220||0x1f4;return function(_0x13dcea){logger[_0x035c('0x22')](_0x13dcea['stack']);if(_0x13dcea[_0x035c('0x23')]){delete _0x13dcea[_0x035c('0x23')];}_0x43a50c[_0x035c('0x17')](_0x5f0220)[_0x035c('0x24')](_0x13dcea);};}exports['index']=function(_0xbd652c,_0x7a60af){var _0xbe22ab={},_0x35e7d5={},_0x481ce3={'count':0x0,'rows':[]};var _0x52f8c6=db[_0x035c('0x25')][_0x035c('0x26')];_0x35e7d5[_0x035c('0x27')]=_[_0x035c('0x28')](_[_0x035c('0x29')](_0x52f8c6),['format']);_0x35e7d5[_0x035c('0x2a')]=_['keys'](_0xbd652c[_0x035c('0x2a')]);_0x35e7d5[_0x035c('0x2b')]=_['intersection'](_0x35e7d5[_0x035c('0x27')],_0x35e7d5[_0x035c('0x2a')]);_0xbe22ab[_0x035c('0x2c')]=_[_0x035c('0x2d')](_0x35e7d5['model'],qs[_0x035c('0x2e')](_0xbd652c['query']['fields']));_0xbe22ab[_0x035c('0x2c')]=_0xbe22ab['attributes']['length']?_0xbe22ab[_0x035c('0x2c')]:_0x35e7d5['model'];if(!_0xbd652c[_0x035c('0x2a')]['hasOwnProperty']('nolimit')){_0xbe22ab[_0x035c('0x1b')]=qs[_0x035c('0x1b')](_0xbd652c[_0x035c('0x2a')][_0x035c('0x1b')]);_0xbe22ab[_0x035c('0x1a')]=qs[_0x035c('0x1a')](_0xbd652c['query']['offset']);}_0xbe22ab[_0x035c('0x2f')]=qs[_0x035c('0x30')](_0xbd652c[_0x035c('0x2a')]['sort']);_0xbe22ab['where']=qs[_0x035c('0x2b')](_[_0x035c('0x31')](_0xbd652c['query'],_0x35e7d5['filters']));if(_0xbd652c[_0x035c('0x2a')]['filter']){_0xbe22ab[_0x035c('0x32')]=_['merge'](_0xbe22ab[_0x035c('0x32')],{'$or':_[_0x035c('0x33')](_0x52f8c6,function(_0x174b4c){if(_0x174b4c['type'][_0x035c('0x34')]!==_0x035c('0x35')){var _0x193d14={};_0x193d14[_0x174b4c['field']]={'$like':'%'+_0xbd652c[_0x035c('0x2a')]['filter']+'%'};return _0x193d14;}})});}_0xbe22ab=_[_0x035c('0x36')]({},_0xbe22ab,_0xbd652c[_0x035c('0x37')]);var _0xb3a01f={'where':_0xbe22ab['where']};return db[_0x035c('0x25')]['count'](_0xb3a01f)[_0x035c('0x20')](function(_0x1c4813){_0x481ce3[_0x035c('0x19')]=_0x1c4813;if(_0xbd652c['query'][_0x035c('0x38')]){_0xbe22ab[_0x035c('0x39')]=[{'all':!![]}];}return db['VoiceRecording'][_0x035c('0x3a')](_0xbe22ab);})[_0x035c('0x20')](function(_0x5d86fa){_0x481ce3[_0x035c('0x3b')]=_0x5d86fa;return _0x481ce3;})['then'](respondWithFilteredResult(_0x7a60af,_0xbe22ab))[_0x035c('0x3c')](handleError(_0x7a60af,null));};exports[_0x035c('0x3d')]=function(_0x4d0233,_0x5aa026){var _0x37ac55={'raw':![],'where':{'id':_0x4d0233[_0x035c('0x3e')]['id']}},_0x2da3de={};_0x2da3de[_0x035c('0x27')]=_[_0x035c('0x29')](db[_0x035c('0x25')][_0x035c('0x26')]);_0x2da3de['query']=_[_0x035c('0x29')](_0x4d0233[_0x035c('0x2a')]);_0x2da3de[_0x035c('0x2b')]=_[_0x035c('0x2d')](_0x2da3de[_0x035c('0x27')],_0x2da3de[_0x035c('0x2a')]);_0x37ac55['attributes']=_[_0x035c('0x2d')](_0x2da3de[_0x035c('0x27')],qs[_0x035c('0x2e')](_0x4d0233[_0x035c('0x2a')][_0x035c('0x2e')]));_0x37ac55[_0x035c('0x2c')]=_0x37ac55['attributes'][_0x035c('0x3f')]?_0x37ac55[_0x035c('0x2c')]:_0x2da3de['model'];if(_0x4d0233[_0x035c('0x2a')][_0x035c('0x38')]){_0x37ac55[_0x035c('0x39')]=[{'all':!![]}];}_0x37ac55=_[_0x035c('0x36')]({},_0x37ac55,_0x4d0233['options']);return db[_0x035c('0x25')][_0x035c('0x40')](_0x37ac55)['then'](handleEntityNotFound(_0x5aa026,null))[_0x035c('0x20')](respondWithResult(_0x5aa026,null))[_0x035c('0x3c')](handleError(_0x5aa026,null));};exports[_0x035c('0x41')]=function(_0x48b6ba,_0x4ff3b8){return db['VoiceRecording']['create'](_0x48b6ba['body'],{})[_0x035c('0x20')](respondWithResult(_0x4ff3b8,0xc9))[_0x035c('0x3c')](handleError(_0x4ff3b8,null));};exports[_0x035c('0x1f')]=function(_0x55024b,_0x19ee42){if(_0x55024b[_0x035c('0x42')]['id']){delete _0x55024b[_0x035c('0x42')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x55024b['params']['id']}})[_0x035c('0x20')](handleEntityNotFound(_0x19ee42,null))[_0x035c('0x20')](saveUpdates(_0x55024b[_0x035c('0x42')],null))[_0x035c('0x20')](respondWithResult(_0x19ee42,null))['catch'](handleError(_0x19ee42,null));};exports[_0x035c('0x43')]=function(_0x1b089e,_0x551827){return db[_0x035c('0x25')]['find']({'where':{'id':_0x1b089e[_0x035c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x551827,null))[_0x035c('0x20')](removeEntity(_0x551827,null))[_0x035c('0x3c')](handleError(_0x551827,null));};exports[_0x035c('0x44')]=function(_0x3d74ab,_0x59abe5){return db[_0x035c('0x25')]['describe']()['then'](respondWithResult(_0x59abe5,null))[_0x035c('0x3c')](handleError(_0x59abe5,null));};exports['download']=function(_0x5406cf,_0x482988,_0x47020e){var _0x590906=require('../../components/encryptor');var _0xb5a887=![];var _0x52830e={};if(_0x5406cf[_0x035c('0x2a')][_0x035c('0x45')]&&_0x5406cf[_0x035c('0x2a')]['type']==='uniqueid'){_0x52830e['uniqueid']=_0x5406cf[_0x035c('0x3e')]['id'];}else{_0x52830e['id']=_0x5406cf[_0x035c('0x3e')]['id'];}return db[_0x035c('0x25')][_0x035c('0x40')]({'where':_0x52830e,'attributes':['id','value'],'raw':!![]})[_0x035c('0x20')](handleEntityNotFound(_0x482988,null))[_0x035c('0x20')](function(_0x97796e){if(_0x97796e){var _0x53de46=_0x97796e[_0x035c('0x46')];var _0x4911c4=util[_0x035c('0x47')](_0x035c('0x48'),_0x53de46);if(fs[_0x035c('0x49')](_0x4911c4)){_0xb5a887=!![];return _0x590906[_0x035c('0x4a')](_0x4911c4,_0x53de46,config[_0x035c('0x4b')][_0x035c('0x4c')])[_0x035c('0x20')](function(){return _0x97796e;});}return _0x97796e;}})['then'](function(_0x1aaa71){if(_0x1aaa71){var _0x407af9=_0x1aaa71[_0x035c('0x46')];if(!fs[_0x035c('0x49')](_0x407af9)){throw new db['Sequelize']['ValidationError'](_0x035c('0x4d'));}if(_0x1aaa71[_0x035c('0x4e')]){return _0x482988['download'](_0x407af9,_0x1aaa71[_0x035c('0x4e')]+path[_0x035c('0x4f')](_0x407af9),function(){if(_0xb5a887){fs[_0x035c('0x50')](_0x407af9);}});}else{return _0x482988[_0x035c('0x51')](_0x407af9,function(_0x39cc63){if(_0xb5a887){fs[_0x035c('0x50')](_0x407af9);}});}}})['catch'](function(_0x1677c1){if(_0x1677c1['message']==='VoiceRecording\x20not\x20found'){_0x482988[_0x035c('0x17')](0x194)[_0x035c('0x24')](_0x035c('0x52'));}else{return handleError(_0x482988,null);}});};exports['downloads']=function(_0x385741,_0x2bb114,_0x4da215){var _0x42bc75=require('../../components/encryptor');var _0x22c69a=![];var _0x3db762={'$and':[db[_0x035c('0x53')][_0x035c('0x32')](db[_0x035c('0x53')]['fn'](_0x035c('0x54'),db[_0x035c('0x53')][_0x035c('0x55')](_0x035c('0x56'))),_0x385741[_0x035c('0x2a')][_0x035c('0x57')])]};if(_0x385741[_0x035c('0x2a')]['type']&&_0x385741[_0x035c('0x2a')][_0x035c('0x45')]===_0x035c('0x56')){_0x3db762[_0x035c('0x58')][_0x035c('0x59')]({'uniqueid':_0x385741[_0x035c('0x3e')]['id']});}else{_0x3db762[_0x035c('0x58')][_0x035c('0x59')]({'id':_0x385741[_0x035c('0x3e')]['id']});}return db[_0x035c('0x25')][_0x035c('0x40')]({'where':_0x3db762,'attributes':['id',_0x035c('0x46')],'raw':!![]})[_0x035c('0x20')](handleEntityNotFound(_0x2bb114,null))[_0x035c('0x20')](function(_0x2b7e0b){if(_0x2b7e0b){var _0x53b6ff=util[_0x035c('0x47')](_0x035c('0x48'),_0x2b7e0b[_0x035c('0x46')]);if(fs[_0x035c('0x49')](_0x53b6ff)){_0x22c69a=!![];return _0x42bc75['decryptFile'](_0x53b6ff,_0x2b7e0b[_0x035c('0x46')],config[_0x035c('0x4b')][_0x035c('0x4c')])[_0x035c('0x20')](function(){return _0x2b7e0b;});}return _0x2b7e0b;}})[_0x035c('0x20')](function(_0x4db91e){if(_0x4db91e){if(!fs[_0x035c('0x49')](_0x4db91e[_0x035c('0x46')])){throw new db['Sequelize'][(_0x035c('0x5a'))](_0x035c('0x4d'));}if(_0x4db91e['filename']){return _0x2bb114[_0x035c('0x51')](_0x4db91e[_0x035c('0x46')],_0x4db91e[_0x035c('0x4e')]+path['extname'](_0x4db91e['value']),function(){if(_0x22c69a){fs[_0x035c('0x50')](_0x4db91e[_0x035c('0x46')]);}});}else{return _0x2bb114[_0x035c('0x51')](_0x4db91e['value'],function(_0x472fa0){if(_0x22c69a){fs['unlink'](_0x4db91e['value']);}});}}})['catch'](handleError(_0x2bb114,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 69dd33d..0fecedc 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 _0x1895=['define','VoiceRecording','voice_recordings','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x1895,0x183));var _0x5189=function(_0x1db1f8,_0x551853){_0x1db1f8=_0x1db1f8-0x0;var _0xaba515=_0x1895[_0x1db1f8];return _0xaba515;};'use strict';var _=require('lodash');var util=require(_0x5189('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5189('0x1'));var BPromise=require(_0x5189('0x2'));var rp=require(_0x5189('0x3'));var fs=require('fs');var path=require(_0x5189('0x4'));var rimraf=require(_0x5189('0x5'));var config=require(_0x5189('0x6'));var attributes=require(_0x5189('0x7'));module[_0x5189('0x8')]=function(_0x52add4,_0x3ff15e){return _0x52add4[_0x5189('0x9')](_0x5189('0xa'),attributes,{'tableName':_0x5189('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8af1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid'];(function(_0x5ce514,_0x4b185c){var _0x791a92=function(_0x222d33){while(--_0x222d33){_0x5ce514['push'](_0x5ce514['shift']());}};_0x791a92(++_0x4b185c);}(_0x8af1,0x1c0));var _0x18af=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x8af1[_0x42c118];return _0x112ebd;};'use strict';var _=require(_0x18af('0x0'));var util=require(_0x18af('0x1'));var logger=require(_0x18af('0x2'))(_0x18af('0x3'));var moment=require(_0x18af('0x4'));var BPromise=require(_0x18af('0x5'));var rp=require(_0x18af('0x6'));var fs=require('fs');var path=require(_0x18af('0x7'));var rimraf=require(_0x18af('0x8'));var config=require('../../config/environment');var attributes=require(_0x18af('0x9'));module[_0x18af('0xa')]=function(_0x290c4a,_0x590175){return _0x290c4a[_0x18af('0xb')](_0x18af('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x18af('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 12a4e5f..e96b5dd 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(_0x4d967a,_0xc56013){var _0x362726=function(_0x39c753){while(--_0x39c753){_0x4d967a['push'](_0x4d967a['shift']());}};_0x362726(++_0xc56013);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x2ef251,_0x3687e5){var _0x5c931b=function(_0x3e1e36){while(--_0x3e1e36){_0x2ef251['push'](_0x2ef251['shift']());}};_0x5c931b(++_0x3687e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 a1c3d03..ed0a28a 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 _0x8958=['isAuthenticated','show','create','put','update','delete','destroy','util','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','/:id'];(function(_0x3d3310,_0x47241d){var _0x49fda5=function(_0x57257b){while(--_0x57257b){_0x3d3310['push'](_0x3d3310['shift']());}};_0x49fda5(++_0x47241d);}(_0x8958,0x93));var _0x8895=function(_0x3b6761,_0x2623b4){_0x3b6761=_0x3b6761-0x0;var _0x2c6e13=_0x8958[_0x3b6761];return _0x2c6e13;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8895('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x8895('0x2'));var controller=require(_0x8895('0x3'));router[_0x8895('0x4')]('/',auth['isAuthenticated'](),controller[_0x8895('0x5')]);router[_0x8895('0x4')](_0x8895('0x6'),auth[_0x8895('0x7')](),controller[_0x8895('0x8')]);router['post']('/',auth[_0x8895('0x7')](),controller[_0x8895('0x9')]);router[_0x8895('0xa')](_0x8895('0x6'),auth[_0x8895('0x7')](),controller[_0x8895('0xb')]);router[_0x8895('0xc')](_0x8895('0x6'),auth[_0x8895('0x7')](),controller[_0x8895('0xd')]);module['exports']=router; \ No newline at end of file +var _0x5d58=['../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','Router'];(function(_0x2f68bf,_0x1c93d7){var _0x2e0535=function(_0x533047){while(--_0x533047){_0x2f68bf['push'](_0x2f68bf['shift']());}};_0x2e0535(++_0x1c93d7);}(_0x5d58,0x187));var _0x85d5=function(_0x1bd16e,_0x3404d6){_0x1bd16e=_0x1bd16e-0x0;var _0x1edf5f=_0x5d58[_0x1bd16e];return _0x1edf5f;};'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[_0x85d5('0x0')]();var auth=require(_0x85d5('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x85d5('0x2'));var controller=require(_0x85d5('0x3'));router['get']('/',auth[_0x85d5('0x4')](),controller[_0x85d5('0x5')]);router[_0x85d5('0x6')](_0x85d5('0x7'),auth['isAuthenticated'](),controller[_0x85d5('0x8')]);router[_0x85d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x85d5('0xa')]);router['put'](_0x85d5('0x7'),auth[_0x85d5('0x4')](),controller[_0x85d5('0xb')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x85d5('0xc')]);module[_0x85d5('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 71824e7..fbdc1bc 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 _0xdba7=['moment','ENUM','blind','STRING','sequelize'];(function(_0x36207e,_0xc12f1b){var _0x447b61=function(_0x397659){while(--_0x397659){_0x36207e['push'](_0x36207e['shift']());}};_0x447b61(++_0xc12f1b);}(_0xdba7,0x1c1));var _0x7dba=function(_0x85358,_0x5e8dab){_0x85358=_0x85358-0x0;var _0x5d03d=_0xdba7[_0x85358];return _0x5d03d;};'use strict';var Sequelize=require(_0x7dba('0x0'));var moment=require(_0x7dba('0x1'));module['exports']={'type':{'type':Sequelize[_0x7dba('0x2')](_0x7dba('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x7dba('0x4')]},'transferercalleridname':{'type':Sequelize[_0x7dba('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7dba('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x7dba('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x7dba('0x4')]},'transferercontext':{'type':Sequelize[_0x7dba('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x7dba('0x4')]},'transfereechannel':{'type':Sequelize[_0x7dba('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x7dba('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7dba('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7dba('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7dba('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x7dba('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7dba('0x4')]}}; \ No newline at end of file +var _0x0df1=['exports','blind','STRING','Yes','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0df1,0xf9));var _0x10df=function(_0x5e9201,_0x5ece30){_0x5e9201=_0x5e9201-0x0;var _0x1d351f=_0x0df1[_0x5e9201];return _0x1d351f;};'use strict';var Sequelize=require(_0x10df('0x0'));var moment=require('moment');module[_0x10df('0x1')]={'type':{'type':Sequelize['ENUM'](_0x10df('0x2'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x10df('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x10df('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x10df('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x10df('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x10df('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x10df('0x3')]},'transfereechannel':{'type':Sequelize[_0x10df('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x10df('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x10df('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x10df('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x10df('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x10df('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x10df('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0x10df('0x4'),'No')},'context':{'type':Sequelize[_0x10df('0x3')]},'extension':{'type':Sequelize[_0x10df('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c780303..dd8a2ea 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 _0x6d00=['VoiceTransferReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index'];(function(_0x31cb77,_0x348021){var _0x710374=function(_0x5e92f6){while(--_0x5e92f6){_0x31cb77['push'](_0x31cb77['shift']());}};_0x710374(++_0x348021);}(_0x6d00,0x1cc));var _0x06d0=function(_0x27f023,_0x4abe11){_0x27f023=_0x27f023-0x0;var _0x38e6fd=_0x6d00[_0x27f023];return _0x38e6fd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x06d0('0x0'));var rimraf=require(_0x06d0('0x1'));var zipdir=require(_0x06d0('0x2'));var jsonpatch=require(_0x06d0('0x3'));var rp=require('request-promise');var moment=require(_0x06d0('0x4'));var BPromise=require(_0x06d0('0x5'));var Mustache=require(_0x06d0('0x6'));var util=require(_0x06d0('0x7'));var path=require('path');var sox=require(_0x06d0('0x8'));var csv=require(_0x06d0('0x9'));var ejs=require(_0x06d0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x06d0('0xb'));var crypto=require(_0x06d0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x06d0('0x9'));var querystring=require(_0x06d0('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x06d0('0xe'));var logger=require(_0x06d0('0xf'))(_0x06d0('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x06d0('0x11'))['db'];function respondWithStatusCode(_0x1d51f5,_0x193ad4){_0x193ad4=_0x193ad4||0xcc;return function(_0x362ca5){if(_0x362ca5){return _0x1d51f5[_0x06d0('0x12')](_0x193ad4);}return _0x1d51f5[_0x06d0('0x13')](_0x193ad4)['end']();};}function respondWithResult(_0x386813,_0x5cbd3a){_0x5cbd3a=_0x5cbd3a||0xc8;return function(_0x2f0541){if(_0x2f0541){return _0x386813[_0x06d0('0x13')](_0x5cbd3a)[_0x06d0('0x14')](_0x2f0541);}};}function respondWithFilteredResult(_0x21cac4,_0x44afee){return function(_0x6d7949){if(_0x6d7949){var _0x1a7e57=_0x6d7949['count'],_0x43904b=_0x44afee[_0x06d0('0x15')],_0x4db420=_0x44afee[_0x06d0('0x15')]+_0x44afee[_0x06d0('0x16')],_0x5a8464;if(_0x4db420>=_0x1a7e57){_0x4db420=_0x1a7e57;_0x5a8464=0xc8;}else{_0x5a8464=0xce;}_0x21cac4[_0x06d0('0x13')](_0x5a8464);return _0x21cac4[_0x06d0('0x17')](_0x06d0('0x18'),_0x43904b+'-'+_0x4db420+'/'+_0x1a7e57)['json'](_0x6d7949);}return null;};}function patchUpdates(_0x465743){return function(_0x23f3b7){try{jsonpatch[_0x06d0('0x19')](_0x23f3b7,_0x465743,!![]);}catch(_0x59636d){return BPromise[_0x06d0('0x1a')](_0x59636d);}return _0x23f3b7[_0x06d0('0x1b')]();};}function saveUpdates(_0x37cfb4,_0x3770ab){return function(_0x243853){if(_0x243853){return _0x243853[_0x06d0('0x1c')](_0x37cfb4)['then'](function(_0x4dea71){return _0x4dea71;});}return null;};}function removeEntity(_0x144d2a,_0x11dc6d){return function(_0x29c038){if(_0x29c038){return _0x29c038[_0x06d0('0x1d')]()[_0x06d0('0x1e')](function(){_0x144d2a['status'](0xcc)[_0x06d0('0x1f')]();});}};}function handleEntityNotFound(_0x27cb09,_0x3c24f6){return function(_0x7da64f){if(!_0x7da64f){_0x27cb09[_0x06d0('0x12')](0x194);}return _0x7da64f;};}function handleError(_0x17325b,_0x23414b){_0x23414b=_0x23414b||0x1f4;return function(_0x2fcbfe){logger[_0x06d0('0x20')](_0x2fcbfe[_0x06d0('0x21')]);if(_0x2fcbfe[_0x06d0('0x22')]){delete _0x2fcbfe[_0x06d0('0x22')];}_0x17325b[_0x06d0('0x13')](_0x23414b)[_0x06d0('0x23')](_0x2fcbfe);};}exports[_0x06d0('0x24')]=function(_0xe16b36,_0x160fba){var _0x16a517={},_0x592bea={},_0x5ec771={'count':0x0,'rows':[]};var _0x48140d=db[_0x06d0('0x25')][_0x06d0('0x26')];_0x592bea[_0x06d0('0x27')]=_[_0x06d0('0x28')](_0x48140d);_0x592bea[_0x06d0('0x29')]=_['keys'](_0xe16b36['query']);_0x592bea[_0x06d0('0x2a')]=_['intersection'](_0x592bea[_0x06d0('0x27')],_0x592bea[_0x06d0('0x29')]);_0x16a517[_0x06d0('0x2b')]=_[_0x06d0('0x2c')](_0x592bea[_0x06d0('0x27')],qs[_0x06d0('0x2d')](_0xe16b36[_0x06d0('0x29')][_0x06d0('0x2d')]));_0x16a517[_0x06d0('0x2b')]=_0x16a517[_0x06d0('0x2b')]['length']?_0x16a517['attributes']:_0x592bea[_0x06d0('0x27')];if(!_0xe16b36[_0x06d0('0x29')][_0x06d0('0x2e')]('nolimit')){_0x16a517['limit']=qs['limit'](_0xe16b36[_0x06d0('0x29')]['limit']);_0x16a517['offset']=qs['offset'](_0xe16b36[_0x06d0('0x29')][_0x06d0('0x15')]);}_0x16a517[_0x06d0('0x2f')]=qs[_0x06d0('0x30')](_0xe16b36[_0x06d0('0x29')][_0x06d0('0x30')]);_0x16a517[_0x06d0('0x31')]=qs[_0x06d0('0x2a')](_[_0x06d0('0x32')](_0xe16b36[_0x06d0('0x29')],_0x592bea[_0x06d0('0x2a')]));if(_0xe16b36[_0x06d0('0x29')][_0x06d0('0x33')]){_0x16a517['where']=_[_0x06d0('0x34')](_0x16a517['where'],{'$or':_[_0x06d0('0x35')](_0x48140d,function(_0x447404){if(_0x447404[_0x06d0('0x36')][_0x06d0('0x37')]!==_0x06d0('0x38')){var _0x139671={};_0x139671[_0x447404[_0x06d0('0x39')]]={'$like':'%'+_0xe16b36[_0x06d0('0x29')]['filter']+'%'};return _0x139671;}})});}_0x16a517=_['merge']({},_0x16a517,_0xe16b36[_0x06d0('0x3a')]);var _0x3e48a7={'where':_0x16a517[_0x06d0('0x31')]};return db[_0x06d0('0x25')]['count'](_0x3e48a7)[_0x06d0('0x1e')](function(_0x1ae284){_0x5ec771[_0x06d0('0x3b')]=_0x1ae284;if(_0xe16b36[_0x06d0('0x29')][_0x06d0('0x3c')]){_0x16a517[_0x06d0('0x3d')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x06d0('0x3e')](_0x16a517);})['then'](function(_0x3d88c2){_0x5ec771[_0x06d0('0x3f')]=_0x3d88c2;return _0x5ec771;})[_0x06d0('0x1e')](respondWithFilteredResult(_0x160fba,_0x16a517))[_0x06d0('0x40')](handleError(_0x160fba,null));};exports[_0x06d0('0x41')]=function(_0x4d437c,_0x52566f){var _0x2ce39d={'raw':!![],'where':{'id':_0x4d437c[_0x06d0('0x42')]['id']}},_0x21d5eb={};_0x21d5eb['model']=_[_0x06d0('0x28')](db[_0x06d0('0x25')]['rawAttributes']);_0x21d5eb[_0x06d0('0x29')]=_[_0x06d0('0x28')](_0x4d437c[_0x06d0('0x29')]);_0x21d5eb[_0x06d0('0x2a')]=_['intersection'](_0x21d5eb[_0x06d0('0x27')],_0x21d5eb['query']);_0x2ce39d[_0x06d0('0x2b')]=_['intersection'](_0x21d5eb[_0x06d0('0x27')],qs[_0x06d0('0x2d')](_0x4d437c['query']['fields']));_0x2ce39d[_0x06d0('0x2b')]=_0x2ce39d[_0x06d0('0x2b')][_0x06d0('0x43')]?_0x2ce39d[_0x06d0('0x2b')]:_0x21d5eb[_0x06d0('0x27')];if(_0x4d437c['query'][_0x06d0('0x3c')]){_0x2ce39d[_0x06d0('0x3d')]=[{'all':!![]}];}_0x2ce39d=_[_0x06d0('0x34')]({},_0x2ce39d,_0x4d437c['options']);return db['VoiceTransferReport']['find'](_0x2ce39d)[_0x06d0('0x1e')](handleEntityNotFound(_0x52566f,null))[_0x06d0('0x1e')](respondWithResult(_0x52566f,null))[_0x06d0('0x40')](handleError(_0x52566f,null));};exports[_0x06d0('0x44')]=function(_0xce60b0,_0x416b5d){return db[_0x06d0('0x25')][_0x06d0('0x44')](_0xce60b0[_0x06d0('0x45')],{})[_0x06d0('0x1e')](respondWithResult(_0x416b5d,0xc9))['catch'](handleError(_0x416b5d,null));};exports['update']=function(_0x2a92da,_0x429dcf){if(_0x2a92da[_0x06d0('0x45')]['id']){delete _0x2a92da['body']['id'];}return db[_0x06d0('0x25')]['find']({'where':{'id':_0x2a92da[_0x06d0('0x42')]['id']}})[_0x06d0('0x1e')](handleEntityNotFound(_0x429dcf,null))[_0x06d0('0x1e')](saveUpdates(_0x2a92da[_0x06d0('0x45')],null))[_0x06d0('0x1e')](respondWithResult(_0x429dcf,null))['catch'](handleError(_0x429dcf,null));};exports['destroy']=function(_0xce5efb,_0x4ce9e8){return db['VoiceTransferReport'][_0x06d0('0x46')]({'where':{'id':_0xce5efb[_0x06d0('0x42')]['id']}})[_0x06d0('0x1e')](handleEntityNotFound(_0x4ce9e8,null))[_0x06d0('0x1e')](removeEntity(_0x4ce9e8,null))[_0x06d0('0x40')](handleError(_0x4ce9e8,null));}; \ No newline at end of file +var _0x5cd9=['keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','VoiceTransferReport','length','include','find','create','body','update','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','name','send','index','rawAttributes','model'];(function(_0xbe31d1,_0x126345){var _0x7bd03=function(_0xbcacac){while(--_0xbcacac){_0xbe31d1['push'](_0xbe31d1['shift']());}};_0x7bd03(++_0x126345);}(_0x5cd9,0x17a));var _0x95cd=function(_0x3115ae,_0x2d3e7f){_0x3115ae=_0x3115ae-0x0;var _0x20634d=_0x5cd9[_0x3115ae];return _0x20634d;};'use strict';var pdf=require(_0x95cd('0x0'));var emlformat=require(_0x95cd('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x95cd('0x2'));var rp=require(_0x95cd('0x3'));var moment=require(_0x95cd('0x4'));var BPromise=require(_0x95cd('0x5'));var Mustache=require(_0x95cd('0x6'));var util=require(_0x95cd('0x7'));var path=require(_0x95cd('0x8'));var sox=require(_0x95cd('0x9'));var csv=require('to-csv');var ejs=require(_0x95cd('0xa'));var fs=require('fs');var _=require(_0x95cd('0xb'));var squel=require(_0x95cd('0xc'));var crypto=require(_0x95cd('0xd'));var jsforce=require(_0x95cd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x95cd('0xf'));var querystring=require(_0x95cd('0x10'));var Papa=require(_0x95cd('0x11'));var Redis=require(_0x95cd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x95cd('0x13'));var hardwareService=require(_0x95cd('0x14'));var logger=require('../../config/logger')(_0x95cd('0x15'));var utils=require(_0x95cd('0x16'));var config=require(_0x95cd('0x17'));var db=require(_0x95cd('0x18'))['db'];function respondWithStatusCode(_0x1ef37d,_0x57fceb){_0x57fceb=_0x57fceb||0xcc;return function(_0x5de86d){if(_0x5de86d){return _0x1ef37d['sendStatus'](_0x57fceb);}return _0x1ef37d[_0x95cd('0x19')](_0x57fceb)[_0x95cd('0x1a')]();};}function respondWithResult(_0x142396,_0x29214d){_0x29214d=_0x29214d||0xc8;return function(_0xefdaf8){if(_0xefdaf8){return _0x142396[_0x95cd('0x19')](_0x29214d)['json'](_0xefdaf8);}};}function respondWithFilteredResult(_0x5ef621,_0x5050d5){return function(_0x60a460){if(_0x60a460){var _0x20ad7a=_0x60a460['count'],_0x367861=_0x5050d5[_0x95cd('0x1b')],_0x38ac0e=_0x5050d5[_0x95cd('0x1b')]+_0x5050d5['limit'],_0xb84c4f;if(_0x38ac0e>=_0x20ad7a){_0x38ac0e=_0x20ad7a;_0xb84c4f=0xc8;}else{_0xb84c4f=0xce;}_0x5ef621[_0x95cd('0x19')](_0xb84c4f);return _0x5ef621[_0x95cd('0x1c')](_0x95cd('0x1d'),_0x367861+'-'+_0x38ac0e+'/'+_0x20ad7a)[_0x95cd('0x1e')](_0x60a460);}return null;};}function patchUpdates(_0x4556f8){return function(_0x1e3502){try{jsonpatch[_0x95cd('0x1f')](_0x1e3502,_0x4556f8,!![]);}catch(_0x5abc6e){return BPromise[_0x95cd('0x20')](_0x5abc6e);}return _0x1e3502[_0x95cd('0x21')]();};}function saveUpdates(_0x56539f,_0x3dfbc4){return function(_0x527df2){if(_0x527df2){return _0x527df2['update'](_0x56539f)[_0x95cd('0x22')](function(_0x5aeb10){return _0x5aeb10;});}return null;};}function removeEntity(_0x4fa8b4,_0xe499f8){return function(_0x4c347b){if(_0x4c347b){return _0x4c347b[_0x95cd('0x23')]()[_0x95cd('0x22')](function(){_0x4fa8b4[_0x95cd('0x19')](0xcc)[_0x95cd('0x1a')]();});}};}function handleEntityNotFound(_0x32fddb,_0x4b4a79){return function(_0x307d68){if(!_0x307d68){_0x32fddb[_0x95cd('0x24')](0x194);}return _0x307d68;};}function handleError(_0x16bd62,_0x430bfb){_0x430bfb=_0x430bfb||0x1f4;return function(_0x526831){logger['error'](_0x526831['stack']);if(_0x526831['name']){delete _0x526831[_0x95cd('0x25')];}_0x16bd62[_0x95cd('0x19')](_0x430bfb)[_0x95cd('0x26')](_0x526831);};}exports[_0x95cd('0x27')]=function(_0x108c66,_0x14559d){var _0x44166e={},_0x102a03={},_0x37fd7b={'count':0x0,'rows':[]};var _0xd996af=db['VoiceTransferReport'][_0x95cd('0x28')];_0x102a03[_0x95cd('0x29')]=_[_0x95cd('0x2a')](_0xd996af);_0x102a03['query']=_[_0x95cd('0x2a')](_0x108c66[_0x95cd('0x2b')]);_0x102a03[_0x95cd('0x2c')]=_['intersection'](_0x102a03[_0x95cd('0x29')],_0x102a03[_0x95cd('0x2b')]);_0x44166e['attributes']=_[_0x95cd('0x2d')](_0x102a03[_0x95cd('0x29')],qs[_0x95cd('0x2e')](_0x108c66[_0x95cd('0x2b')][_0x95cd('0x2e')]));_0x44166e[_0x95cd('0x2f')]=_0x44166e[_0x95cd('0x2f')]['length']?_0x44166e[_0x95cd('0x2f')]:_0x102a03[_0x95cd('0x29')];if(!_0x108c66[_0x95cd('0x2b')][_0x95cd('0x30')](_0x95cd('0x31'))){_0x44166e['limit']=qs[_0x95cd('0x32')](_0x108c66[_0x95cd('0x2b')]['limit']);_0x44166e[_0x95cd('0x1b')]=qs[_0x95cd('0x1b')](_0x108c66[_0x95cd('0x2b')][_0x95cd('0x1b')]);}_0x44166e[_0x95cd('0x33')]=qs['sort'](_0x108c66[_0x95cd('0x2b')]['sort']);_0x44166e[_0x95cd('0x34')]=qs[_0x95cd('0x2c')](_['pick'](_0x108c66[_0x95cd('0x2b')],_0x102a03['filters']));if(_0x108c66['query'][_0x95cd('0x35')]){_0x44166e[_0x95cd('0x34')]=_[_0x95cd('0x36')](_0x44166e[_0x95cd('0x34')],{'$or':_['map'](_0xd996af,function(_0x5a28b4){if(_0x5a28b4['type']['key']!==_0x95cd('0x37')){var _0x52d128={};_0x52d128[_0x5a28b4['field']]={'$like':'%'+_0x108c66[_0x95cd('0x2b')]['filter']+'%'};return _0x52d128;}})});}_0x44166e=_[_0x95cd('0x36')]({},_0x44166e,_0x108c66[_0x95cd('0x38')]);var _0x5729b6={'where':_0x44166e[_0x95cd('0x34')]};return db['VoiceTransferReport'][_0x95cd('0x39')](_0x5729b6)[_0x95cd('0x22')](function(_0x4bc382){_0x37fd7b['count']=_0x4bc382;if(_0x108c66[_0x95cd('0x2b')][_0x95cd('0x3a')]){_0x44166e['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x95cd('0x3b')](_0x44166e);})['then'](function(_0x2cb575){_0x37fd7b[_0x95cd('0x3c')]=_0x2cb575;return _0x37fd7b;})[_0x95cd('0x22')](respondWithFilteredResult(_0x14559d,_0x44166e))[_0x95cd('0x3d')](handleError(_0x14559d,null));};exports['show']=function(_0x54a4d5,_0x508d77){var _0x3c1880={'raw':!![],'where':{'id':_0x54a4d5[_0x95cd('0x3e')]['id']}},_0x219d87={};_0x219d87[_0x95cd('0x29')]=_[_0x95cd('0x2a')](db[_0x95cd('0x3f')][_0x95cd('0x28')]);_0x219d87[_0x95cd('0x2b')]=_[_0x95cd('0x2a')](_0x54a4d5[_0x95cd('0x2b')]);_0x219d87[_0x95cd('0x2c')]=_['intersection'](_0x219d87['model'],_0x219d87[_0x95cd('0x2b')]);_0x3c1880['attributes']=_[_0x95cd('0x2d')](_0x219d87[_0x95cd('0x29')],qs[_0x95cd('0x2e')](_0x54a4d5['query'][_0x95cd('0x2e')]));_0x3c1880['attributes']=_0x3c1880[_0x95cd('0x2f')][_0x95cd('0x40')]?_0x3c1880[_0x95cd('0x2f')]:_0x219d87['model'];if(_0x54a4d5[_0x95cd('0x2b')][_0x95cd('0x3a')]){_0x3c1880[_0x95cd('0x41')]=[{'all':!![]}];}_0x3c1880=_[_0x95cd('0x36')]({},_0x3c1880,_0x54a4d5[_0x95cd('0x38')]);return db[_0x95cd('0x3f')][_0x95cd('0x42')](_0x3c1880)[_0x95cd('0x22')](handleEntityNotFound(_0x508d77,null))['then'](respondWithResult(_0x508d77,null))['catch'](handleError(_0x508d77,null));};exports[_0x95cd('0x43')]=function(_0x468131,_0x3ee92e){return db[_0x95cd('0x3f')]['create'](_0x468131[_0x95cd('0x44')],{})[_0x95cd('0x22')](respondWithResult(_0x3ee92e,0xc9))[_0x95cd('0x3d')](handleError(_0x3ee92e,null));};exports[_0x95cd('0x45')]=function(_0x5cc450,_0x4d9448){if(_0x5cc450[_0x95cd('0x44')]['id']){delete _0x5cc450['body']['id'];}return db[_0x95cd('0x3f')]['find']({'where':{'id':_0x5cc450['params']['id']}})[_0x95cd('0x22')](handleEntityNotFound(_0x4d9448,null))[_0x95cd('0x22')](saveUpdates(_0x5cc450[_0x95cd('0x44')],null))['then'](respondWithResult(_0x4d9448,null))[_0x95cd('0x3d')](handleError(_0x4d9448,null));};exports[_0x95cd('0x23')]=function(_0x2154ef,_0xd30328){return db[_0x95cd('0x3f')][_0x95cd('0x42')]({'where':{'id':_0x2154ef[_0x95cd('0x3e')]['id']}})[_0x95cd('0x22')](handleEntityNotFound(_0xd30328,null))[_0x95cd('0x22')](removeEntity(_0xd30328,null))[_0x95cd('0x3d')](handleError(_0xd30328,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9681e60..9ca590e 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 _0x51ab=['define','VoiceTransferReport','report_call_transfer','../../config/logger','bluebird','request-promise','./voiceTransferReport.attributes','exports'];(function(_0x6e4fea,_0x1248c4){var _0x51e71d=function(_0x1cf7d8){while(--_0x1cf7d8){_0x6e4fea['push'](_0x6e4fea['shift']());}};_0x51e71d(++_0x1248c4);}(_0x51ab,0x103));var _0xb51a=function(_0x76d825,_0x2a6af3){_0x76d825=_0x76d825-0x0;var _0x20361d=_0x51ab[_0x76d825];return _0x20361d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb51a('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb51a('0x1'));var rp=require(_0xb51a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb51a('0x3'));module[_0xb51a('0x4')]=function(_0x5400f0,_0x394d92){return _0x5400f0[_0xb51a('0x5')](_0xb51a('0x6'),attributes,{'tableName':_0xb51a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c8d=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','../../config/logger','moment','bluebird'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x0c8d,0x194));var _0xd0c8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0c8d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd0c8('0x0'));var util=require('util');var logger=require(_0xd0c8('0x1'))('api');var moment=require(_0xd0c8('0x2'));var BPromise=require(_0xd0c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd0c8('0x4'));module[_0xd0c8('0x5')]=function(_0xd685d7,_0x3ce2e1){return _0xd685d7[_0xd0c8('0x6')](_0xd0c8('0x7'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 701c44a..ad548df 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 _0x4a94=['raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options'];(function(_0x2242a1,_0x38f44d){var _0x2c298b=function(_0x4f4246){while(--_0x4f4246){_0x2242a1['push'](_0x2242a1['shift']());}};_0x2c298b(++_0x38f44d);}(_0x4a94,0x146));var _0x44a9=function(_0x5be801,_0x45cae9){_0x5be801=_0x5be801-0x0;var _0x3d3760=_0x4a94[_0x5be801];return _0x3d3760;};'use strict';var _=require(_0x44a9('0x0'));var util=require('util');var moment=require(_0x44a9('0x1'));var BPromise=require(_0x44a9('0x2'));var rs=require(_0x44a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44a9('0x4'))['db'];var utils=require(_0x44a9('0x5'));var logger=require(_0x44a9('0x6'))(_0x44a9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x44a9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b4da4,_0x36335e,_0x21cf05){return new BPromise(function(_0x11d890,_0x5d32fe){return client['request'](_0x1b4da4,_0x21cf05)[_0x44a9('0x9')](function(_0x2a1db3){logger[_0x44a9('0xa')](_0x44a9('0xb'),_0x36335e,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x36335e,_0x44a9('0xc'),JSON[_0x44a9('0xd')](_0x2a1db3));if(_0x2a1db3[_0x44a9('0xe')]){if(_0x2a1db3[_0x44a9('0xe')][_0x44a9('0xf')]===0x1f4){logger[_0x44a9('0xe')](_0x44a9('0xb'),_0x36335e,_0x2a1db3[_0x44a9('0xe')][_0x44a9('0x10')]);return _0x5d32fe(_0x2a1db3[_0x44a9('0xe')][_0x44a9('0x10')]);}logger['error'](_0x44a9('0xb'),_0x36335e,_0x2a1db3[_0x44a9('0xe')][_0x44a9('0x10')]);return _0x11d890(_0x2a1db3[_0x44a9('0xe')][_0x44a9('0x10')]);}else{logger[_0x44a9('0xa')](_0x44a9('0xb'),_0x36335e,_0x44a9('0xc'));_0x11d890(_0x2a1db3[_0x44a9('0x11')]['message']);}})[_0x44a9('0x12')](function(_0x1b105a){logger[_0x44a9('0xe')](_0x44a9('0xb'),_0x36335e,_0x1b105a);_0x5d32fe(_0x1b105a);});});}exports[_0x44a9('0x13')]=function(_0x5adc24){var _0x3c97a6=this;return new Promise(function(_0x343a91,_0x1778df){return db[_0x44a9('0x14')][_0x44a9('0x15')](_0x5adc24[_0x44a9('0x16')],{'raw':_0x5adc24[_0x44a9('0x17')]?_0x5adc24[_0x44a9('0x17')][_0x44a9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x461917){logger[_0x44a9('0xa')]('CreateVoiceTransferReport',_0x5adc24);logger['debug'](_0x44a9('0x13'),_0x5adc24,JSON[_0x44a9('0xd')](_0x461917));_0x343a91(_0x461917);})[_0x44a9('0x12')](function(_0x587870){logger[_0x44a9('0xe')](_0x44a9('0x13'),_0x587870['message'],_0x5adc24);_0x1778df(_0x3c97a6['error'](0x1f4,_0x587870[_0x44a9('0x10')]));});});}; \ No newline at end of file +var _0xdff1=['options','raw','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceTransferReport','VoiceTransferReport','create','body'];(function(_0x3d79f2,_0x5ac997){var _0x12d938=function(_0x1e774e){while(--_0x1e774e){_0x3d79f2['push'](_0x3d79f2['shift']());}};_0x12d938(++_0x5ac997);}(_0xdff1,0xd3));var _0x1dff=function(_0x91bac5,_0x194711){_0x91bac5=_0x91bac5-0x0;var _0x1bd75c=_0xdff1[_0x91bac5];return _0x1bd75c;};'use strict';var _=require('lodash');var util=require(_0x1dff('0x0'));var moment=require('moment');var BPromise=require(_0x1dff('0x1'));var rs=require(_0x1dff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dff('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dff('0x4'))('rpc');var config=require(_0x1dff('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1dff('0x6')][_0x1dff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f60ed,_0x36c08f,_0xfb1f0f){return new BPromise(function(_0x2ccb21,_0xce4eca){return client[_0x1dff('0x8')](_0x3f60ed,_0xfb1f0f)[_0x1dff('0x9')](function(_0x52c0fd){logger[_0x1dff('0xa')](_0x1dff('0xb'),_0x36c08f,_0x1dff('0xc'));logger[_0x1dff('0xd')](_0x1dff('0xe'),_0x36c08f,_0x1dff('0xc'),JSON[_0x1dff('0xf')](_0x52c0fd));if(_0x52c0fd[_0x1dff('0x10')]){if(_0x52c0fd[_0x1dff('0x10')][_0x1dff('0x11')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x36c08f,_0x52c0fd[_0x1dff('0x10')]['message']);return _0xce4eca(_0x52c0fd['error'][_0x1dff('0x12')]);}logger[_0x1dff('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x36c08f,_0x52c0fd[_0x1dff('0x10')][_0x1dff('0x12')]);return _0x2ccb21(_0x52c0fd[_0x1dff('0x10')][_0x1dff('0x12')]);}else{logger[_0x1dff('0xa')](_0x1dff('0xb'),_0x36c08f,_0x1dff('0xc'));_0x2ccb21(_0x52c0fd['result'][_0x1dff('0x12')]);}})['catch'](function(_0x57d97c){logger[_0x1dff('0x10')](_0x1dff('0xb'),_0x36c08f,_0x57d97c);_0xce4eca(_0x57d97c);});});}exports[_0x1dff('0x13')]=function(_0x586741){var _0x5f5855=this;return new Promise(function(_0x4c83dc,_0x336e38){return db[_0x1dff('0x14')][_0x1dff('0x15')](_0x586741[_0x1dff('0x16')],{'raw':_0x586741[_0x1dff('0x17')]?_0x586741[_0x1dff('0x17')][_0x1dff('0x18')]===undefined?!![]:![]:!![]})[_0x1dff('0x9')](function(_0x4cb20b){logger[_0x1dff('0xa')](_0x1dff('0x13'),_0x586741);logger[_0x1dff('0xd')](_0x1dff('0x13'),_0x586741,JSON[_0x1dff('0xf')](_0x4cb20b));_0x4c83dc(_0x4cb20b);})[_0x1dff('0x19')](function(_0x5a01e3){logger[_0x1dff('0x10')]('CreateVoiceTransferReport',_0x5a01e3[_0x1dff('0x12')],_0x586741);_0x336e38(_0x5f5855[_0x1dff('0x10')](0x1f4,_0x5a01e3[_0x1dff('0x12')]));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index 27388d6..a5a0bf2 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x866a=['join','Offline\x20apps:','status','None','./config/seedDB','default','./config/license','catch','error','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','listen','info','start','then','Online\x20apps:','map','filter','online','name'];(function(_0x54abbd,_0x34edb4){var _0x2eac08=function(_0xbca3c4){while(--_0xbca3c4){_0x54abbd['push'](_0x54abbd['shift']());}};_0x2eac08(++_0x34edb4);}(_0x866a,0x154));var _0xa866=function(_0x45ad09,_0x521ab1){_0x45ad09=_0x45ad09-0x0;var _0x2084fd=_0x866a[_0x45ad09];return _0x2084fd;};'use strict';var _=require('lodash');var mysqldb=require(_0xa866('0x0'));var rpc=require(_0xa866('0x1'));var config=require(_0xa866('0x2'));var logger=require(_0xa866('0x3'))(_0xa866('0x4'));var pm2=require(_0xa866('0x5'));var pm2Config=require(_0xa866('0x6'));var schedule=require(_0xa866('0x7'));var chat=require(_0xa866('0x8'));function main(){return mysqldb['db'][_0xa866('0x9')][_0xa866('0xa')]()['then'](function(){return rpc[_0xa866('0xb')]();})['then'](function(_0xa907ec){logger[_0xa866('0xc')](_0xa907ec);return chat[_0xa866('0xd')]();})[_0xa866('0xe')](function(){return schedule[_0xa866('0xd')]();})[_0xa866('0xe')](function(_0x310c67){logger['info'](_0x310c67);return pm2['start'](pm2Config);})[_0xa866('0xe')](function(_0x2291e4){logger[_0xa866('0xc')](_0xa866('0xf'),_[_0xa866('0x10')](_[_0xa866('0x11')](_0x2291e4,{'status':_0xa866('0x12')}),_0xa866('0x13'))[_0xa866('0x14')]());logger['info'](_0xa866('0x15'),_[_0xa866('0x10')](_[_0xa866('0x11')](_0x2291e4,function(_0x4d07bc){return _0x4d07bc[_0xa866('0x16')]!=='online';}),'name')[_0xa866('0x14')]()||_0xa866('0x17'));config['seedDB']&&require(_0xa866('0x18'))[_0xa866('0x19')]();require(_0xa866('0x1a'))[_0xa866('0x19')]();})[_0xa866('0x1b')](function(_0x10237d){logger[_0xa866('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x10237d);process[_0xa866('0x1d')](0x1);});}main(); \ No newline at end of file +var _0x615a=['name','join','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','info','start','map','filter','online'];(function(_0x1a89c7,_0x1b00bf){var _0x358cd7=function(_0x539c52){while(--_0x539c52){_0x1a89c7['push'](_0x1a89c7['shift']());}};_0x358cd7(++_0x1b00bf);}(_0x615a,0x1b1));var _0xa615=function(_0x2d6141,_0x189922){_0x2d6141=_0x2d6141-0x0;var _0xbc02da=_0x615a[_0x2d6141];return _0xbc02da;};'use strict';var _=require('lodash');var mysqldb=require(_0xa615('0x0'));var rpc=require(_0xa615('0x1'));var config=require(_0xa615('0x2'));var logger=require(_0xa615('0x3'))(_0xa615('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0xa615('0x5'));var schedule=require(_0xa615('0x6'));var chat=require(_0xa615('0x7'));function main(){return mysqldb['db'][_0xa615('0x8')][_0xa615('0x9')]()[_0xa615('0xa')](function(){return rpc[_0xa615('0xb')]();})['then'](function(_0x41514a){logger[_0xa615('0xc')](_0x41514a);return chat[_0xa615('0xd')]();})[_0xa615('0xa')](function(){return schedule['start']();})[_0xa615('0xa')](function(_0x592bf8){logger[_0xa615('0xc')](_0x592bf8);return pm2['start'](pm2Config);})['then'](function(_0xf03f3c){logger[_0xa615('0xc')]('Online\x20apps:',_[_0xa615('0xe')](_[_0xa615('0xf')](_0xf03f3c,{'status':_0xa615('0x10')}),_0xa615('0x11'))[_0xa615('0x12')]());logger[_0xa615('0xc')]('Offline\x20apps:',_[_0xa615('0xe')](_[_0xa615('0xf')](_0xf03f3c,function(_0xf5f91){return _0xf5f91['status']!==_0xa615('0x10');}),_0xa615('0x11'))[_0xa615('0x12')]()||'None');config[_0xa615('0x13')]&&require(_0xa615('0x14'))[_0xa615('0x15')]();require('./config/license')[_0xa615('0x15')]();})[_0xa615('0x16')](function(_0x52151b){logger[_0xa615('0x17')](_0xa615('0x18'),_0x52151b);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1ea8279..5af5a72 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 _0x6596=['getLicense','update','isMiddleware','signToken','setTokenCookie','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','sign','secrets','promisify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','params','closed','then','status','unmanaged','json','disposition','Unmanaged.','Forbidden.','catch','startsWith','headers','authorization','Basic','User','find','authenticate','pass','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','nonce','User\x20object\x20not\x20found.','../../config/license/util'];(function(_0x2b400c,_0x3eb1b0){var _0x3ec13b=function(_0x2df17c){while(--_0x2df17c){_0x2b400c['push'](_0x2b400c['shift']());}};_0x3ec13b(++_0x3eb1b0);}(_0x6596,0x1d3));var _0x6659=function(_0x41bae7,_0x25959b){_0x41bae7=_0x41bae7-0x0;var _0x5b4210=_0x6596[_0x41bae7];return _0x5b4210;};'use strict';var db=require(_0x6659('0x0'))['db'];var config=require(_0x6659('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require(_0x6659('0x2'));var jwt=require(_0x6659('0x3'));var expressJwt=require(_0x6659('0x4'));var compose=require(_0x6659('0x5'));var basicAuth=require(_0x6659('0x6'));var crypto=require(_0x6659('0x7'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config['secrets'][_0x6659('0x8')]});var userAttributes=['id',_0x6659('0x9'),_0x6659('0xa'),_0x6659('0xb'),_0x6659('0xc'),'email','userpic',_0x6659('0xd'),_0x6659('0xe'),_0x6659('0xf'),_0x6659('0x10'),_0x6659('0x11'),_0x6659('0x12'),'smsPause',_0x6659('0x13'),'pauseType','showWebBar',_0x6659('0x14'),'lastPauseAt',_0x6659('0x15'),_0x6659('0x16'),_0x6659('0x17'),_0x6659('0x18'),'phoneBarAutoAnswer',_0x6659('0x19'),_0x6659('0x1a'),'phoneBarEnableDtmfTone',_0x6659('0x1b'),_0x6659('0x1c'),_0x6659('0x1d'),_0x6659('0x1e'),_0x6659('0x1f'),_0x6659('0x20'),'interface',_0x6659('0x21')];exports[_0x6659('0x22')]=function(){return this[_0x6659('0x23')](!![])[_0x6659('0x24')](function(_0x324fbc,_0x75836a,_0x50bb0b){if(_0x324fbc['user']){_0x50bb0b();}else{return db[_0x6659('0x25')]['findOne']({'where':{'id':_0x324fbc[_0x6659('0x26')]['id']},'attributes':['id',_0x6659('0x27'),'disposition'],'raw':!![]})[_0x6659('0x28')](function(_0x5253e5){if(_0x5253e5&&_0x5253e5[_0x6659('0x27')]){return _0x75836a[_0x6659('0x29')](_0x5253e5['disposition']===_0x6659('0x2a')?0x195:0x193)[_0x6659('0x2b')]({'message':_0x5253e5[_0x6659('0x2c')]===_0x6659('0x2a')?_0x6659('0x2d'):_0x6659('0x2e')});}else{_0x50bb0b();}})[_0x6659('0x2f')](function(_0x524562){_0x50bb0b(_0x524562);});}});};exports[_0x6659('0x23')]=function isAuthenticated(_0x3506fd){return compose()[_0x6659('0x24')](function(_0x3c0fe6,_0x4d079c,_0x4ce553){if(_0x3c0fe6['headers']['authorization']){if(_[_0x6659('0x30')](_0x3c0fe6[_0x6659('0x31')][_0x6659('0x32')],_0x6659('0x33'))){var _0x45effc=basicAuth(_0x3c0fe6);db[_0x6659('0x34')][_0x6659('0x35')]({'where':{'name':_0x45effc[_0x6659('0xb')]}})[_0x6659('0x28')](function(_0x5f48d6){if(!_0x5f48d6||!_0x5f48d6[_0x6659('0x36')](_0x45effc[_0x6659('0x37')])){return _0x4d079c[_0x6659('0x29')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x3c0fe6[_0x6659('0x38')]={'id':_0x5f48d6['id']};_0x4ce553();})[_0x6659('0x2f')](function(_0x5bee7f){_0x4ce553(_0x5bee7f);});}else if(_[_0x6659('0x30')](_0x3c0fe6[_0x6659('0x31')][_0x6659('0x32')],_0x6659('0x39'))){validateJwt(_0x3c0fe6,_0x4d079c,_0x4ce553);}else{if(_0x3506fd){_0x4ce553();}else{return _0x4d079c[_0x6659('0x29')](0x193)['json']({'message':_0x6659('0x3a')});}}}else if(_0x3c0fe6[_0x6659('0x3b')][_0x6659('0x3c')]){var _0x3bb3c7={'audience':hardwareConf[_0x6659('0x3d')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x3c0fe6[_0x6659('0x3b')][_0x6659('0x3c')],_0x3bb3c7)[_0x6659('0x28')](function(_0x59c43){return db[_0x6659('0x34')][_0x6659('0x35')]({'where':{'id':_0x59c43[_0x6659('0x3e')]}})['then'](function(_0x17e9bf){if(!_0x17e9bf||!_[_0x6659('0x3f')](_0x17e9bf['apiKeyNonce'],_0x59c43[_0x6659('0x40')])){return _0x4d079c['status'](0x193)[_0x6659('0x2b')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x3c0fe6[_0x6659('0x38')]={'id':_0x17e9bf['id']};_0x4ce553();});})[_0x6659('0x2f')](function(_0x512b89){_0x4ce553(_0x512b89);});}else if(_0x3506fd){_0x4ce553();}else{return _0x4d079c['status'](0x193)[_0x6659('0x2b')]({'message':'Unknown\x20authorization\x20format'});}})[_0x6659('0x24')](function(_0x5173c9,_0x3f818f,_0x49e692){if(_0x5173c9[_0x6659('0x38')]){db[_0x6659('0x34')]['find']({'where':{'id':_0x5173c9[_0x6659('0x38')]['id']},'attributes':userAttributes})[_0x6659('0x28')](function(_0x2c209c){if(!_0x2c209c){return _0x3f818f[_0x6659('0x29')](0x194)[_0x6659('0x2b')]({'message':'User\x20not\x20found.'});}_0x5173c9[_0x6659('0x38')]=_0x2c209c;_0x49e692();})['catch'](function(_0x55baf4){_0x49e692(_0x55baf4);});}else if(_0x3506fd){_0x49e692();}else{return _0x3f818f[_0x6659('0x29')](0x194)[_0x6659('0x2b')]({'message':_0x6659('0x41')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x6659('0x24')](function(_0x487416,_0x4e601b,_0x19bde3){return require(_0x6659('0x42'))[_0x6659('0x43')]()[_0x6659('0x28')](function(_0x46b472){if(_0x46b472[_0x6659('0x44')]){_0x19bde3();}else{return _0x4e601b[_0x6659('0x29')](0x193)['json']({'message':'Forbidden'});}})[_0x6659('0x2f')](function(_0x1fde99){_0x19bde3(_0x1fde99);});});};exports[_0x6659('0x45')]=function(_0x532e2c,_0x1dd5ba,_0x3e4a93){_0x532e2c['isMiddleware']=!![];return _0x3e4a93();};exports[_0x6659('0x46')]=function signToken(_0xa3311c){return signJwt(_0xa3311c);};exports[_0x6659('0x47')]=function(_0x2924f4,_0x12b174){if(!_0x2924f4['user']){return _0x12b174['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x280c9f={'payload':{'id':_0x2924f4['user']['id'],'role':_0x2924f4['user'][_0x6659('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x280c9f)[_0x6659('0x28')](function(_0x595fef){_0x12b174[_0x6659('0x48')](_0x6659('0x49'),_0x595fef);_0x12b174['redirect'](_0x6659('0x4a'));})[_0x6659('0x2f')](function(_0x1d39b6){return _0x12b174[_0x6659('0x29')](0x1f4)['send'](_0x1d39b6);});};exports[_0x6659('0x4b')]=function(_0x582f2a){if(_[_0x6659('0x4c')](_0x582f2a[_0x6659('0x4d')])||_[_0x6659('0x4c')](_0x582f2a[_0x6659('0x4e')])){return null;}else{return createJwt(_0x582f2a);}};exports[_0x6659('0x4f')]=function(_0x3e4918){_0x3e4918['apiKeyNonce']=generateNonce();_0x3e4918['apiKeyIat']=generateIssuedAt();return createJwt(_0x3e4918);};exports[_0x6659('0x50')]=function(_0x3cd482,_0x29e107){var _0x288ab3=_0x3cd482[_0x6659('0x3b')][_0x6659('0x3c')];if(_0x288ab3){var _0x380a09={'nonce':_0x29e107[_0x6659('0x4d')],'iat':_0x29e107[_0x6659('0x4e')],'audience':hardwareConf[_0x6659('0x3d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x288ab3,_0x380a09)[_0x6659('0x28')](function(){return generateApiKey(_0x29e107);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x104d61){var _0x395187=BPromise['promisify'](jwt[_0x6659('0x51')],{'context':jwt});var _0x1debc1=_0x104d61['secret']||config[_0x6659('0x52')][_0x6659('0x8')];return new BPromise(function(_0x6e0e41,_0x304733){_0x395187(_0x104d61['payload'],_0x1debc1,_0x104d61['options'])[_0x6659('0x28')](function(_0x268e06){_0x6e0e41(_0x268e06);})[_0x6659('0x2f')](function(_0x29f7f1){_0x304733(_0x29f7f1);});});}function verifyJwt(_0x442355,_0x3afc78,_0x5dccdd){var _0x2e1844=BPromise[_0x6659('0x53')](jwt['verify'],{'context':jwt});var _0x3a8927=_0x5dccdd||config[_0x6659('0x52')]['session'];return new BPromise(function(_0x463d5b,_0x3e5596){_0x2e1844(_0x442355,_0x3a8927,_0x3afc78)[_0x6659('0x28')](function(_0x342b3d){_0x463d5b(_0x342b3d);})[_0x6659('0x2f')](function(_0x1bdf74){_0x3e5596(_0x1bdf74);});});}function generateNonce(){return crypto[_0x6659('0x54')](0x10)[_0x6659('0x55')](_0x6659('0x56'));}function generateIssuedAt(){return Math[_0x6659('0x57')](Date[_0x6659('0x58')]()/0x3e8)[_0x6659('0x55')]();}function createJwt(_0x50a581){var _0x4c338b={'payload':{'iat':_0x50a581[_0x6659('0x4e')],'nonce':_0x50a581[_0x6659('0x4d')]},'options':{'algorithm':'HS512','subject':_0x50a581['id'][_0x6659('0x55')](),'issuer':hardwareConf[_0x6659('0x3d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x4c338b)[_0x6659('0x28')](function(_0x1bce80){return{'iat':_0x50a581[_0x6659('0x4e')],'nonce':_0x50a581['apiKeyNonce'],'token':_0x1bce80};});} \ No newline at end of file +var _0x1224=['showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','authorization','startsWith','Basic','then','authenticate','pass','Wrong\x20credentials.','catch','headers','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','User','find','apiKeyNonce','nonce','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','secret','secrets','options','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType'];(function(_0x2e19ef,_0xbd9773){var _0x423b94=function(_0x5ec6a9){while(--_0x5ec6a9){_0x2e19ef['push'](_0x2e19ef['shift']());}};_0x423b94(++_0xbd9773);}(_0x1224,0x10d));var _0x4122=function(_0x5634d2,_0x40ec38){_0x5634d2=_0x5634d2-0x0;var _0x4150b5=_0x1224[_0x5634d2];return _0x4150b5;};'use strict';var db=require(_0x4122('0x0'))['db'];var config=require(_0x4122('0x1'));var hardwareConf=require(_0x4122('0x2'));var _=require(_0x4122('0x3'));var jwt=require(_0x4122('0x4'));var expressJwt=require(_0x4122('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x4122('0x6'));var crypto=require(_0x4122('0x7'));var BPromise=require(_0x4122('0x8'));var validateJwt=expressJwt({'secret':config['secrets'][_0x4122('0x9')]});var userAttributes=['id',_0x4122('0xa'),_0x4122('0xb'),_0x4122('0xc'),_0x4122('0xd'),_0x4122('0xe'),_0x4122('0xf'),_0x4122('0x10'),_0x4122('0x11'),_0x4122('0x12'),_0x4122('0x13'),_0x4122('0x14'),_0x4122('0x15'),_0x4122('0x16'),_0x4122('0x17'),_0x4122('0x18'),_0x4122('0x19'),_0x4122('0x1a'),_0x4122('0x1b'),_0x4122('0x1c'),_0x4122('0x1d'),_0x4122('0x1e'),_0x4122('0x1f'),_0x4122('0x20'),_0x4122('0x21'),_0x4122('0x22'),_0x4122('0x23'),_0x4122('0x24'),_0x4122('0x25'),_0x4122('0x26'),_0x4122('0x27'),'phoneBarRemoteControlPort',_0x4122('0x28'),_0x4122('0x29'),_0x4122('0x2a')];exports[_0x4122('0x2b')]=function(){return this['isAuthenticated'](!![])[_0x4122('0x2c')](function(_0x19684e,_0x507b70,_0xda6466){if(_0x19684e[_0x4122('0x2d')]){_0xda6466();}else{return db[_0x4122('0x2e')][_0x4122('0x2f')]({'where':{'id':_0x19684e[_0x4122('0x30')]['id']},'attributes':['id',_0x4122('0x31'),_0x4122('0x32')],'raw':!![]})['then'](function(_0x482116){if(_0x482116&&_0x482116['closed']){return _0x507b70[_0x4122('0x33')](_0x482116[_0x4122('0x32')]===_0x4122('0x34')?0x195:0x193)[_0x4122('0x35')]({'message':_0x482116[_0x4122('0x32')]===_0x4122('0x34')?_0x4122('0x36'):_0x4122('0x37')});}else{_0xda6466();}})['catch'](function(_0x315ef6){_0xda6466(_0x315ef6);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4f949a){return compose()['use'](function(_0x36d8d9,_0x13a08c,_0x317418){if(_0x36d8d9['headers'][_0x4122('0x38')]){if(_[_0x4122('0x39')](_0x36d8d9['headers']['authorization'],_0x4122('0x3a'))){var _0x5ba3c1=basicAuth(_0x36d8d9);db['User']['find']({'where':{'name':_0x5ba3c1[_0x4122('0xc')]}})[_0x4122('0x3b')](function(_0xbb76e1){if(!_0xbb76e1||!_0xbb76e1[_0x4122('0x3c')](_0x5ba3c1[_0x4122('0x3d')])){return _0x13a08c[_0x4122('0x33')](0x191)[_0x4122('0x35')]({'message':_0x4122('0x3e')});}_0x36d8d9[_0x4122('0x2d')]={'id':_0xbb76e1['id']};_0x317418();})[_0x4122('0x3f')](function(_0x28c89f){_0x317418(_0x28c89f);});}else if(_[_0x4122('0x39')](_0x36d8d9[_0x4122('0x40')]['authorization'],_0x4122('0x41'))){validateJwt(_0x36d8d9,_0x13a08c,_0x317418);}else{if(_0x4f949a){_0x317418();}else{return _0x13a08c[_0x4122('0x33')](0x193)[_0x4122('0x35')]({'message':_0x4122('0x42')});}}}else if(_0x36d8d9['query'][_0x4122('0x43')]){var _0x47e8bc={'audience':hardwareConf[_0x4122('0x44')](),'issuer':hardwareConf[_0x4122('0x44')]()};verifyJwt(_0x36d8d9[_0x4122('0x45')][_0x4122('0x43')],_0x47e8bc)[_0x4122('0x3b')](function(_0x308cda){return db[_0x4122('0x46')][_0x4122('0x47')]({'where':{'id':_0x308cda['sub']}})[_0x4122('0x3b')](function(_0x11c2a2){if(!_0x11c2a2||!_['isEqual'](_0x11c2a2[_0x4122('0x48')],_0x308cda[_0x4122('0x49')])){return _0x13a08c[_0x4122('0x33')](0x193)[_0x4122('0x35')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x36d8d9[_0x4122('0x2d')]={'id':_0x11c2a2['id']};_0x317418();});})[_0x4122('0x3f')](function(_0x57416e){_0x317418(_0x57416e);});}else if(_0x4f949a){_0x317418();}else{return _0x13a08c['status'](0x193)[_0x4122('0x35')]({'message':'Unknown\x20authorization\x20format'});}})[_0x4122('0x2c')](function(_0x1081e3,_0x5c7e42,_0x45a51a){if(_0x1081e3[_0x4122('0x2d')]){db[_0x4122('0x46')]['find']({'where':{'id':_0x1081e3[_0x4122('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0x4063cb){if(!_0x4063cb){return _0x5c7e42[_0x4122('0x33')](0x194)[_0x4122('0x35')]({'message':'User\x20not\x20found.'});}_0x1081e3[_0x4122('0x2d')]=_0x4063cb;_0x45a51a();})['catch'](function(_0x2da1bd){_0x45a51a(_0x2da1bd);});}else if(_0x4f949a){_0x45a51a();}else{return _0x5c7e42[_0x4122('0x33')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x4122('0x2c')](function(_0x50261c,_0x477e51,_0x789bcf){return require(_0x4122('0x4a'))[_0x4122('0x4b')]()[_0x4122('0x3b')](function(_0x517a59){if(_0x517a59['update']){_0x789bcf();}else{return _0x477e51[_0x4122('0x33')](0x193)['json']({'message':_0x4122('0x4c')});}})['catch'](function(_0x1e5ce4){_0x789bcf(_0x1e5ce4);});});};exports[_0x4122('0x4d')]=function(_0x4fbcd5,_0x1b33e6,_0x2b7d56){_0x4fbcd5[_0x4122('0x4d')]=!![];return _0x2b7d56();};exports[_0x4122('0x4e')]=function signToken(_0x6ce0aa){return signJwt(_0x6ce0aa);};exports[_0x4122('0x4f')]=function(_0x5b8fe2,_0x3944c1){if(!_0x5b8fe2['user']){return _0x3944c1[_0x4122('0x33')](0x194)['json']({'message':_0x4122('0x50')});}var _0x36ac7f={'payload':{'id':_0x5b8fe2[_0x4122('0x2d')]['id'],'role':_0x5b8fe2[_0x4122('0x2d')][_0x4122('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x36ac7f)['then'](function(_0x3f5716){_0x3944c1[_0x4122('0x51')]('motion.token',_0x3f5716);_0x3944c1['redirect']('/dashboards/general');})[_0x4122('0x3f')](function(_0x1d7442){return _0x3944c1[_0x4122('0x33')](0x1f4)[_0x4122('0x52')](_0x1d7442);});};exports[_0x4122('0x53')]=function(_0x1183f5){if(_[_0x4122('0x54')](_0x1183f5[_0x4122('0x48')])||_[_0x4122('0x54')](_0x1183f5['apiKeyIat'])){return null;}else{return createJwt(_0x1183f5);}};exports[_0x4122('0x55')]=function(_0x4c6578){_0x4c6578['apiKeyNonce']=generateNonce();_0x4c6578[_0x4122('0x56')]=generateIssuedAt();return createJwt(_0x4c6578);};exports[_0x4122('0x57')]=function(_0x87305d,_0x5ed2c7){var _0x46dadf=_0x87305d[_0x4122('0x45')]['apikey'];if(_0x46dadf){var _0x2285b6={'nonce':_0x5ed2c7[_0x4122('0x48')],'iat':_0x5ed2c7[_0x4122('0x56')],'audience':hardwareConf[_0x4122('0x44')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x46dadf,_0x2285b6)[_0x4122('0x3b')](function(){return generateApiKey(_0x5ed2c7);});}else{throw{'message':_0x4122('0x58')};}};function signJwt(_0xc45587){var _0x2f45d7=BPromise[_0x4122('0x59')](jwt['sign'],{'context':jwt});var _0x531117=_0xc45587[_0x4122('0x5a')]||config[_0x4122('0x5b')][_0x4122('0x9')];return new BPromise(function(_0x13cc1d,_0x144d4c){_0x2f45d7(_0xc45587['payload'],_0x531117,_0xc45587[_0x4122('0x5c')])[_0x4122('0x3b')](function(_0x163db4){_0x13cc1d(_0x163db4);})['catch'](function(_0x8755af){_0x144d4c(_0x8755af);});});}function verifyJwt(_0x53f7d9,_0x39515c,_0x163224){var _0x337788=BPromise[_0x4122('0x59')](jwt['verify'],{'context':jwt});var _0x48740d=_0x163224||config[_0x4122('0x5b')][_0x4122('0x9')];return new BPromise(function(_0x2ad013,_0x181640){_0x337788(_0x53f7d9,_0x48740d,_0x39515c)['then'](function(_0x2b03b4){_0x2ad013(_0x2b03b4);})['catch'](function(_0x376782){_0x181640(_0x376782);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x4122('0x5d')](_0x4122('0x5e'));}function generateIssuedAt(){return Math[_0x4122('0x5f')](Date[_0x4122('0x60')]()/0x3e8)[_0x4122('0x5d')]();}function createJwt(_0xecfafd){var _0x4fb7ac={'payload':{'iat':_0xecfafd[_0x4122('0x56')],'nonce':_0xecfafd['apiKeyNonce']},'options':{'algorithm':_0x4122('0x61'),'subject':_0xecfafd['id'][_0x4122('0x5d')](),'issuer':hardwareConf[_0x4122('0x44')](),'audience':hardwareConf[_0x4122('0x44')]()}};return signJwt(_0x4fb7ac)[_0x4122('0x3b')](function(_0x5dd938){return{'iat':_0xecfafd[_0x4122('0x56')],'nonce':_0xecfafd[_0x4122('0x48')],'token':_0x5dd938};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5a071ad..f1d4a42 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 _0xbaf0=['data','update','binary','write','end','decryptFile','createDecipher','final','close','unlink','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x0baf('0x0'));var defaultOptions={'algorithm':_0x0baf('0x1')};function combineOptions(_0x1e212d){var _0x263f79={};for(var _0x1688bc in defaultOptions){if(defaultOptions[_0x0baf('0x2')](_0x1688bc)){_0x263f79[_0x1688bc]=defaultOptions[_0x1688bc];}}if(_0x1e212d){for(var _0x5a3e42 in _0x1e212d){if(_0x1e212d[_0x0baf('0x2')](_0x5a3e42)){_0x263f79[_0x5a3e42]=_0x1e212d[_0x5a3e42];}}}return _0x263f79;}exports[_0x0baf('0x3')]=function(_0x2d3fa5,_0x39b8f3,_0xe4c3c4,_0x335e24){return new BPromise(function(_0x1a10b1,_0x2dcaac){_0x335e24=combineOptions(_0x335e24);var _0x1d0a0d=new Buffer(_0xe4c3c4);var _0x5f5030=fs[_0x0baf('0x4')](_0x2d3fa5);var _0x5f20aa=fs[_0x0baf('0x5')](_0x39b8f3);var _0x2c7442=crypto[_0x0baf('0x6')](_0x335e24[_0x0baf('0x7')],_0x1d0a0d);_0x5f5030['on'](_0x0baf('0x8'),function(_0xf4c8ac){var _0x41cead=new Buffer(_0x2c7442[_0x0baf('0x9')](_0xf4c8ac),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x41cead);});_0x5f5030['on'](_0x0baf('0xc'),function(){try{var _0x51d93c=new Buffer(_0x2c7442['final'](_0x0baf('0xa')),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x51d93c);_0x5f20aa[_0x0baf('0xc')]();_0x5f20aa['on']('close',function(){return _0x1a10b1(_0x39b8f3);});}catch(_0x2ab33e){fs['unlink'](_0x39b8f3);return _0x2dcaac(_0x2ab33e);}});});};exports[_0x0baf('0xd')]=function(_0x1f50c3,_0x7fbf67,_0x2bc381,_0xb8339e){return new BPromise(function(_0x469599,_0x4f80a8){_0xb8339e=combineOptions(_0xb8339e);var _0x4cd79d=new Buffer(_0x2bc381);var _0x2312c7=fs[_0x0baf('0x4')](_0x1f50c3);var _0x283408=fs[_0x0baf('0x5')](_0x7fbf67);var _0x2cf7da=crypto[_0x0baf('0xe')](_0xb8339e['algorithm'],_0x4cd79d);_0x2312c7['on'](_0x0baf('0x8'),function(_0xfbecec){var _0x1ef0e5=new Buffer(_0x2cf7da[_0x0baf('0x9')](_0xfbecec),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x1ef0e5);});_0x2312c7['on']('end',function(){try{var _0x5cff5d=new Buffer(_0x2cf7da[_0x0baf('0xf')](_0x0baf('0xa')),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x5cff5d);_0x283408[_0x0baf('0xc')]();_0x283408['on'](_0x0baf('0x10'),function(){return _0x469599(_0x7fbf67);});}catch(_0x210cd8){fs[_0x0baf('0x11')](_0x7fbf67);return _0x4f80a8(_0x210cd8);}});});}; \ No newline at end of file +var _0xbaf0=['data','update','binary','write','end','decryptFile','createDecipher','final','close','unlink','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x0baf('0x0'));var defaultOptions={'algorithm':_0x0baf('0x1')};function combineOptions(_0x1e212d){var _0x263f79={};for(var _0x1688bc in defaultOptions){if(defaultOptions[_0x0baf('0x2')](_0x1688bc)){_0x263f79[_0x1688bc]=defaultOptions[_0x1688bc];}}if(_0x1e212d){for(var _0x5a3e42 in _0x1e212d){if(_0x1e212d[_0x0baf('0x2')](_0x5a3e42)){_0x263f79[_0x5a3e42]=_0x1e212d[_0x5a3e42];}}}return _0x263f79;}exports[_0x0baf('0x3')]=function(_0x2d3fa5,_0x39b8f3,_0xe4c3c4,_0x335e24){return new BPromise(function(_0x1a10b1,_0x2dcaac){_0x335e24=combineOptions(_0x335e24);var _0x1d0a0d=new Buffer(_0xe4c3c4);var _0x5f5030=fs[_0x0baf('0x4')](_0x2d3fa5);var _0x5f20aa=fs[_0x0baf('0x5')](_0x39b8f3);var _0x2c7442=crypto[_0x0baf('0x6')](_0x335e24[_0x0baf('0x7')],_0x1d0a0d);_0x5f5030['on'](_0x0baf('0x8'),function(_0xf4c8ac){var _0x41cead=new Buffer(_0x2c7442[_0x0baf('0x9')](_0xf4c8ac),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x41cead);});_0x5f5030['on'](_0x0baf('0xc'),function(){try{var _0x51d93c=new Buffer(_0x2c7442['final'](_0x0baf('0xa')),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x51d93c);_0x5f20aa[_0x0baf('0xc')]();_0x5f20aa['on']('close',function(){return _0x1a10b1(_0x39b8f3);});}catch(_0x2ab33e){fs['unlink'](_0x39b8f3);return _0x2dcaac(_0x2ab33e);}});});};exports[_0x0baf('0xd')]=function(_0x1f50c3,_0x7fbf67,_0x2bc381,_0xb8339e){return new BPromise(function(_0x469599,_0x4f80a8){_0xb8339e=combineOptions(_0xb8339e);var _0x4cd79d=new Buffer(_0x2bc381);var _0x2312c7=fs[_0x0baf('0x4')](_0x1f50c3);var _0x283408=fs[_0x0baf('0x5')](_0x7fbf67);var _0x2cf7da=crypto[_0x0baf('0xe')](_0xb8339e['algorithm'],_0x4cd79d);_0x2312c7['on'](_0x0baf('0x8'),function(_0xfbecec){var _0x1ef0e5=new Buffer(_0x2cf7da[_0x0baf('0x9')](_0xfbecec),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x1ef0e5);});_0x2312c7['on']('end',function(){try{var _0x5cff5d=new Buffer(_0x2cf7da[_0x0baf('0xf')](_0x0baf('0xa')),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x5cff5d);_0x283408[_0x0baf('0xc')]();_0x283408['on'](_0x0baf('0x10'),function(){return _0x469599(_0x7fbf67);});}catch(_0x210cd8){fs[_0x0baf('0x11')](_0x7fbf67);return _0x4f80a8(_0x210cd8);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 196a60b..425b3f6 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 _0xbec5=['%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','join','mkdirSync','each','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push'];(function(_0x4a155f,_0xb73f2){var _0x518b24=function(_0x1e5578){while(--_0x1e5578){_0x4a155f['push'](_0x4a155f['shift']());}};_0x518b24(++_0xb73f2);}(_0xbec5,0xe5));var _0x5bec=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xbec5[_0x336264];return _0x53cf91;};'use strict';var util=require(_0x5bec('0x0'));var path=require(_0x5bec('0x1'));var _=require('lodash');var csv=require(_0x5bec('0x2'));var fs=require('fs');var BPromise=require(_0x5bec('0x3'));var zipdir=require(_0x5bec('0x4'));var rimraf=require(_0x5bec('0x5'));var db=require(_0x5bec('0x6'))['db'];var dbH=require('../../mysqldb')[_0x5bec('0x7')];var logger=require(_0x5bec('0x8'))(_0x5bec('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5bec('0xa')][0x3];var PATH=process[_0x5bec('0xa')][0x4];function analyticExtractedReport(_0x38456e,_0x406e65){var _0x43d96e={'status':_0x38456e};var _0x302aae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x406e65){_0x43d96e[_0x5bec('0xb')]=_0x406e65;}return db[_0x5bec('0xc')]['update'](_0x43d96e,_0x302aae);}function main(){var _0x41a827=0x1388;var _0x5c2d67;logger[_0x5bec('0xd')](util[_0x5bec('0xe')](_0x5bec('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x5bec('0x10')][_0x5bec('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5bec('0x12'),'splitSizeCsv']})[_0x5bec('0x13')](function(_0x1c888f){if(_0x1c888f){_0x5c2d67=_0x1c888f;_0x41a827=_0x5c2d67['splitSizeCsv']||0x1388;}})[_0x5bec('0x13')](function(){return dbH[_0x5bec('0x14')][_0x5bec('0x15')](util[_0x5bec('0xe')](_0x5bec('0x16'),QUERY),{'type':dbH[_0x5bec('0x14')][_0x5bec('0x17')][_0x5bec('0x18')]});})[_0x5bec('0x13')](function(_0x3ebc41){if(!_0x3ebc41[0x0][_0x5bec('0x19')]){return analyticExtractedReport(_0x5bec('0x1a'));}var _0x11fb8e=[];var _0x506639=0x0;var _0x4ab821=!![];if(_0x3ebc41&&_0x3ebc41[_0x5bec('0x1b')]){var _0x773740=_0x3ebc41[0x0][_0x5bec('0x19')]%(_0x506639+_0x41a827);if(_0x5c2d67[_0x5bec('0x12')]){for(;_0x4ab821;_0x506639+=_0x41a827,_0x773740=_0x3ebc41[0x0]['num']%(_0x506639+_0x41a827)){if(_0x773740==0x0||_0x773740==_0x3ebc41[0x0]['num']){_0x4ab821=![];}_0x11fb8e[_0x5bec('0x1c')](dbH[_0x5bec('0x14')]['query'](util[_0x5bec('0xe')](_0x5bec('0x1d'),QUERY,_0x41a827,_0x506639),{'type':dbH[_0x5bec('0x14')][_0x5bec('0x17')]['SELECT']}));}}else{_0x11fb8e[_0x5bec('0x1c')](dbH['sequelize'][_0x5bec('0x15')](QUERY,{'type':dbH[_0x5bec('0x14')][_0x5bec('0x17')][_0x5bec('0x18')]}));}}var _0xfed23=path['dirname'](PATH);var _0x232584=path['basename'](PATH,_0x5bec('0x1e'));var _0x3ddb88=_0x5c2d67['split']&&_0x11fb8e[_0x5bec('0x1b')]>0x1;var _0xbef70b=[];if(!fs['existsSync'](path[_0x5bec('0x1f')](_0xfed23,_0x232584))&&_0x3ddb88){fs[_0x5bec('0x20')](path[_0x5bec('0x1f')](_0xfed23,_0x232584));}return BPromise[_0x5bec('0x21')](_0x11fb8e,function(_0x226d55){_0xbef70b[_0x5bec('0x1c')](_0x226d55);})[_0x5bec('0x13')](function(){for(var _0x4de66a=0x0;_0x4de66a<_0xbef70b['length'];_0x4de66a+=0x1){var _0x5e44b3;var _0x2961bd=_0xbef70b[_0x4de66a];if(_0x3ddb88){_0x5e44b3=path[_0x5bec('0x1f')](_0xfed23,_0x232584,util[_0x5bec('0xe')]('%s%d.%s',_0x232584,_0x4de66a,_0x5bec('0x22')));}else{_0x5e44b3=path[_0x5bec('0x1f')](_0xfed23,util['format'](_0x5bec('0x23'),_0x232584,_0x5bec('0x22')));}fs['writeFileSync'](_0x5e44b3,csv(_0x2961bd));}})['then'](function(){if(_0x3ddb88){zipdir(path[_0x5bec('0x1f')](_0xfed23,_0x232584),{'saveTo':path[_0x5bec('0x1f')](_0xfed23,util[_0x5bec('0xe')](_0x5bec('0x23'),_0x232584,_0x5bec('0x24')))},function(_0x3f224c,_0x5d6621){});rimraf(path[_0x5bec('0x1f')](_0xfed23,_0x232584),function(){});}})['then'](function(){logger[_0x5bec('0xd')](util[_0x5bec('0xe')](_0x5bec('0x25'),EXTRACTED_REPORT_ID,_0x5bec('0x26')));return analyticExtractedReport('Completed',_0x3ddb88?util[_0x5bec('0xe')](_0x5bec('0x23'),_0x232584,_0x3ddb88?_0x5bec('0x24'):'csv'):null);});})[_0x5bec('0x27')](function(_0x4cfb89){logger[_0x5bec('0xd')](util[_0x5bec('0xe')](_0x5bec('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0x5bec('0x29')](_0x4cfb89,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x5bec('0x2a'));});}main(); \ No newline at end of file +var _0x668b=['SELECT','num','Empty','push','dirname','.csv','existsSync','join','mkdirSync','each','csv','writeFileSync','%s.%s','zip','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x1fed59,_0x67354c){var _0x856e90=function(_0x324d35){while(--_0x324d35){_0x1fed59['push'](_0x1fed59['shift']());}};_0x856e90(++_0x67354c);}(_0x668b,0x140));var _0xb668=function(_0x26bbd1,_0xb274f3){_0x26bbd1=_0x26bbd1-0x0;var _0x26b1eb=_0x668b[_0x26bbd1];return _0x26b1eb;};'use strict';var util=require(_0xb668('0x0'));var path=require(_0xb668('0x1'));var _=require('lodash');var csv=require(_0xb668('0x2'));var fs=require('fs');var BPromise=require(_0xb668('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xb668('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb668('0x5'))[_0xb668('0x6')];var logger=require(_0xb668('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xb668('0x8')][0x2]);var QUERY=process[_0xb668('0x8')][0x3];var PATH=process[_0xb668('0x8')][0x4];function analyticExtractedReport(_0x2778e9,_0x20b749){var _0x3f01bc={'status':_0x2778e9};var _0x517fc5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20b749){_0x3f01bc[_0xb668('0x9')]=_0x20b749;}return db[_0xb668('0xa')][_0xb668('0xb')](_0x3f01bc,_0x517fc5);}function main(){var _0x16d50d=0x1388;var _0x39b79c;logger[_0xb668('0xc')](util[_0xb668('0xd')](_0xb668('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xb668('0xf')][_0xb668('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb668('0x11'),_0xb668('0x12')]})[_0xb668('0x13')](function(_0x167057){if(_0x167057){_0x39b79c=_0x167057;_0x16d50d=_0x39b79c[_0xb668('0x12')]||0x1388;}})[_0xb668('0x13')](function(){return dbH[_0xb668('0x14')][_0xb668('0x15')](util[_0xb668('0xd')](_0xb668('0x16'),QUERY),{'type':dbH[_0xb668('0x14')][_0xb668('0x17')][_0xb668('0x18')]});})[_0xb668('0x13')](function(_0x1ca6e7){if(!_0x1ca6e7[0x0][_0xb668('0x19')]){return analyticExtractedReport(_0xb668('0x1a'));}var _0x4a755b=[];var _0xd3e39f=0x0;var _0x27bbfa=!![];if(_0x1ca6e7&&_0x1ca6e7['length']){var _0x13ee71=_0x1ca6e7[0x0]['num']%(_0xd3e39f+_0x16d50d);if(_0x39b79c[_0xb668('0x11')]){for(;_0x27bbfa;_0xd3e39f+=_0x16d50d,_0x13ee71=_0x1ca6e7[0x0][_0xb668('0x19')]%(_0xd3e39f+_0x16d50d)){if(_0x13ee71==0x0||_0x13ee71==_0x1ca6e7[0x0]['num']){_0x27bbfa=![];}_0x4a755b[_0xb668('0x1b')](dbH[_0xb668('0x14')]['query'](util[_0xb668('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x16d50d,_0xd3e39f),{'type':dbH[_0xb668('0x14')][_0xb668('0x17')][_0xb668('0x18')]}));}}else{_0x4a755b[_0xb668('0x1b')](dbH['sequelize'][_0xb668('0x15')](QUERY,{'type':dbH[_0xb668('0x14')][_0xb668('0x17')]['SELECT']}));}}var _0x5a2f74=path[_0xb668('0x1c')](PATH);var _0x1e5620=path['basename'](PATH,_0xb668('0x1d'));var _0x4bf863=_0x39b79c[_0xb668('0x11')]&&_0x4a755b['length']>0x1;var _0x3f4745=[];if(!fs[_0xb668('0x1e')](path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620))&&_0x4bf863){fs[_0xb668('0x20')](path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620));}return BPromise[_0xb668('0x21')](_0x4a755b,function(_0x4d4bf8){_0x3f4745[_0xb668('0x1b')](_0x4d4bf8);})[_0xb668('0x13')](function(){for(var _0x2ab8c2=0x0;_0x2ab8c2<_0x3f4745['length'];_0x2ab8c2+=0x1){var _0x5e0cee;var _0xe62fce=_0x3f4745[_0x2ab8c2];if(_0x4bf863){_0x5e0cee=path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620,util[_0xb668('0xd')]('%s%d.%s',_0x1e5620,_0x2ab8c2,_0xb668('0x22')));}else{_0x5e0cee=path[_0xb668('0x1f')](_0x5a2f74,util[_0xb668('0xd')]('%s.%s',_0x1e5620,'csv'));}fs[_0xb668('0x23')](_0x5e0cee,csv(_0xe62fce));}})[_0xb668('0x13')](function(){if(_0x4bf863){zipdir(path['join'](_0x5a2f74,_0x1e5620),{'saveTo':path[_0xb668('0x1f')](_0x5a2f74,util[_0xb668('0xd')](_0xb668('0x24'),_0x1e5620,_0xb668('0x25')))},function(_0x256a8,_0x5f36b5){});rimraf(path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620),function(){});}})[_0xb668('0x13')](function(){logger['info'](util[_0xb668('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb668('0x26')));return analyticExtractedReport(_0xb668('0x27'),_0x4bf863?util[_0xb668('0xd')](_0xb668('0x24'),_0x1e5620,_0x4bf863?_0xb668('0x25'):_0xb668('0x22')):null);});})[_0xb668('0x28')](function(_0x3d4bd8){logger[_0xb668('0xc')](util['format'](_0xb668('0x29'),EXTRACTED_REPORT_ID,_0xb668('0x26')),util[_0xb668('0x2a')](_0x3d4bd8,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d538d2e..8a94f68 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(_0x5d915d,_0x1d6be4){var _0x362569=function(_0x38d737){while(--_0x38d737){_0x5d915d['push'](_0x5d915d['shift']());}};_0x362569(++_0x1d6be4);}(_0xb10b,0x12a));var _0xbb10=function(_0x172e0a,_0x15d22a){_0x172e0a=_0x172e0a-0x0;var _0x4baf16=_0xb10b[_0x172e0a];return _0x4baf16;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x348b69,_0x414253){var _0x590237=function(_0x678057){while(--_0x678057){_0x348b69['push'](_0x348b69['shift']());}};_0x590237(++_0x414253);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b43d6be..601c430 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 _0x2c64=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','join','xlsx','binary','%s.%s','Completed'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x2c64,0x1bb));var _0x42c6=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x2c64[_0x43a37c];return _0x5d1d40;};'use strict';var util=require(_0x42c6('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x42c6('0x1'));var BPromise=require(_0x42c6('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x42c6('0x3'));var db=require(_0x42c6('0x4'))['db'];var dbH=require(_0x42c6('0x4'))[_0x42c6('0x5')];var logger=require(_0x42c6('0x6'))(_0x42c6('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x42c6('0x8')][0x2]);var QUERY=process[_0x42c6('0x8')][0x3];var PATH=process[_0x42c6('0x8')][0x4];function analyticExtractedReport(_0x476917,_0x1c77bd){var _0x2e8276={'status':_0x476917};var _0x2e5030={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c77bd){_0x2e8276['savename']=_0x1c77bd;}return db[_0x42c6('0x9')]['update'](_0x2e8276,_0x2e5030);}function main(){var _0x588ad1=0x1388;var _0x437115;logger[_0x42c6('0xa')](util[_0x42c6('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x42c6('0xc')));return db[_0x42c6('0xd')][_0x42c6('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x42c6('0xf'),_0x42c6('0x10')]})[_0x42c6('0x11')](function(_0x1a4c74){if(_0x1a4c74){_0x437115=_0x1a4c74;_0x588ad1=_0x437115[_0x42c6('0x10')]||0x1388;}})[_0x42c6('0x11')](function(){return dbH[_0x42c6('0x12')][_0x42c6('0x13')](util[_0x42c6('0xb')](_0x42c6('0x14'),QUERY),{'type':dbH[_0x42c6('0x12')][_0x42c6('0x15')][_0x42c6('0x16')]});})[_0x42c6('0x11')](function(_0x1d458e){if(!_0x1d458e[0x0][_0x42c6('0x17')]){return analyticExtractedReport(_0x42c6('0x18'));}var _0x5bf801=[];var _0x38a46b=0x0;var _0xba2051=!![];if(_0x437115['split']){if(_0x1d458e&&_0x1d458e[_0x42c6('0x19')]){var _0x1f63d1=_0x1d458e[0x0][_0x42c6('0x17')]%(_0x38a46b+_0x588ad1);for(;_0xba2051;_0x38a46b+=_0x588ad1,_0x1f63d1=_0x1d458e[0x0][_0x42c6('0x17')]%(_0x38a46b+_0x588ad1)){if(_0x1f63d1==0x0||_0x1f63d1==_0x1d458e[0x0]['num']){_0xba2051=![];}_0x5bf801['push'](dbH[_0x42c6('0x12')][_0x42c6('0x13')](util[_0x42c6('0xb')](_0x42c6('0x1a'),QUERY,_0x588ad1,_0x38a46b),{'type':dbH[_0x42c6('0x12')]['QueryTypes'][_0x42c6('0x16')]}));}}}else{_0x5bf801[_0x42c6('0x1b')](dbH[_0x42c6('0x12')][_0x42c6('0x13')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x42c6('0x16')]}));}var _0x131a5f=path[_0x42c6('0x1c')](PATH);var _0x3bae07=path[_0x42c6('0x1d')](PATH,_0x42c6('0x1e'));var _0xc224b0=_0x437115[_0x42c6('0xf')]&&_0x5bf801[_0x42c6('0x19')]>0x1;var _0x93f01d=[];if(!fs[_0x42c6('0x1f')](path[_0x42c6('0x20')](_0x131a5f,_0x3bae07))&&_0xc224b0){fs['mkdirSync'](path[_0x42c6('0x20')](_0x131a5f,_0x3bae07));}return BPromise['each'](_0x5bf801,function(_0x370260){_0x93f01d[_0x42c6('0x1b')](_0x370260);})[_0x42c6('0x11')](function(){for(var _0x30bbf3=0x0;_0x30bbf3<_0x93f01d[_0x42c6('0x19')];_0x30bbf3+=0x1){var _0x3f7bf2;var _0x2110f0=_0x93f01d[_0x30bbf3];if(_0xc224b0){_0x3f7bf2=path['join'](_0x131a5f,_0x3bae07,util[_0x42c6('0xb')]('%s%d.%s',_0x3bae07,_0x30bbf3,_0x42c6('0x21')));}else{_0x3f7bf2=path[_0x42c6('0x20')](_0x131a5f,util[_0x42c6('0xb')]('%s.%s',_0x3bae07,_0x42c6('0x21')));}fs['writeFileSync'](_0x3f7bf2,json2xls(_0x2110f0),_0x42c6('0x22'));}})[_0x42c6('0x11')](function(){if(_0xc224b0){zipdir(path[_0x42c6('0x20')](_0x131a5f,_0x3bae07),{'saveTo':path[_0x42c6('0x20')](_0x131a5f,util[_0x42c6('0xb')](_0x42c6('0x23'),_0x3bae07,'zip'))},function(_0x4bb8b6,_0x2cc246){});rimraf(path[_0x42c6('0x20')](_0x131a5f,_0x3bae07),function(){});}})[_0x42c6('0x11')](function(){logger[_0x42c6('0xa')](util[_0x42c6('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x42c6('0xc')));return analyticExtractedReport(_0x42c6('0x24'),_0xc224b0?util[_0x42c6('0xb')](_0x42c6('0x23'),_0x3bae07,_0xc224b0?'zip':_0x42c6('0x21')):null);});})['catch'](function(_0x1831b6){logger[_0x42c6('0xa')](util[_0x42c6('0xb')](_0x42c6('0x25'),EXTRACTED_REPORT_ID,_0x42c6('0xc')),util[_0x42c6('0x26')](_0x1831b6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x42c6('0x27'));});}main(); \ No newline at end of file +var _0xb0d9=['join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','json2xls','bluebird','zip-dir','../../mysqldb','argv','AnalyticExtractedReport','update','info','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','QueryTypes','SELECT','num','Empty','length','push','basename','existsSync'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb0d9,0x87));var _0x9b0d=function(_0x73b5c7,_0x261835){_0x73b5c7=_0x73b5c7-0x0;var _0x1570f1=_0xb0d9[_0x73b5c7];return _0x1570f1;};'use strict';var util=require(_0x9b0d('0x0'));var path=require(_0x9b0d('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var zipdir=require(_0x9b0d('0x4'));var rimraf=require('rimraf');var db=require(_0x9b0d('0x5'))['db'];var dbH=require(_0x9b0d('0x5'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9b0d('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9b0d('0x6')][0x4];function analyticExtractedReport(_0xadcf0b,_0x19be51){var _0x3fa766={'status':_0xadcf0b};var _0x202f62={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x19be51){_0x3fa766['savename']=_0x19be51;}return db[_0x9b0d('0x7')][_0x9b0d('0x8')](_0x3fa766,_0x202f62);}function main(){var _0x1cb6bf=0x1388;var _0x54cc80;logger[_0x9b0d('0x9')](util[_0x9b0d('0xa')](_0x9b0d('0xb'),EXTRACTED_REPORT_ID,_0x9b0d('0xc')));return db[_0x9b0d('0xd')][_0x9b0d('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9b0d('0xf'),_0x9b0d('0x10')]})[_0x9b0d('0x11')](function(_0xf250c7){if(_0xf250c7){_0x54cc80=_0xf250c7;_0x1cb6bf=_0x54cc80[_0x9b0d('0x10')]||0x1388;}})[_0x9b0d('0x11')](function(){return dbH[_0x9b0d('0x12')][_0x9b0d('0x13')](util[_0x9b0d('0xa')](_0x9b0d('0x14'),QUERY),{'type':dbH[_0x9b0d('0x12')][_0x9b0d('0x15')][_0x9b0d('0x16')]});})[_0x9b0d('0x11')](function(_0x5a706a){if(!_0x5a706a[0x0][_0x9b0d('0x17')]){return analyticExtractedReport(_0x9b0d('0x18'));}var _0x5c43e8=[];var _0x41c4aa=0x0;var _0x3c537c=!![];if(_0x54cc80['split']){if(_0x5a706a&&_0x5a706a[_0x9b0d('0x19')]){var _0x3a3cd9=_0x5a706a[0x0][_0x9b0d('0x17')]%(_0x41c4aa+_0x1cb6bf);for(;_0x3c537c;_0x41c4aa+=_0x1cb6bf,_0x3a3cd9=_0x5a706a[0x0][_0x9b0d('0x17')]%(_0x41c4aa+_0x1cb6bf)){if(_0x3a3cd9==0x0||_0x3a3cd9==_0x5a706a[0x0][_0x9b0d('0x17')]){_0x3c537c=![];}_0x5c43e8[_0x9b0d('0x1a')](dbH['sequelize']['query'](util[_0x9b0d('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1cb6bf,_0x41c4aa),{'type':dbH[_0x9b0d('0x12')][_0x9b0d('0x15')][_0x9b0d('0x16')]}));}}}else{_0x5c43e8[_0x9b0d('0x1a')](dbH[_0x9b0d('0x12')]['query'](QUERY,{'type':dbH[_0x9b0d('0x12')][_0x9b0d('0x15')][_0x9b0d('0x16')]}));}var _0x47c1ee=path['dirname'](PATH);var _0x2ce9ff=path[_0x9b0d('0x1b')](PATH,'.xlsx');var _0x5f33dc=_0x54cc80['split']&&_0x5c43e8[_0x9b0d('0x19')]>0x1;var _0x46d770=[];if(!fs[_0x9b0d('0x1c')](path[_0x9b0d('0x1d')](_0x47c1ee,_0x2ce9ff))&&_0x5f33dc){fs[_0x9b0d('0x1e')](path[_0x9b0d('0x1d')](_0x47c1ee,_0x2ce9ff));}return BPromise[_0x9b0d('0x1f')](_0x5c43e8,function(_0x169679){_0x46d770[_0x9b0d('0x1a')](_0x169679);})[_0x9b0d('0x11')](function(){for(var _0xbb5b35=0x0;_0xbb5b35<_0x46d770[_0x9b0d('0x19')];_0xbb5b35+=0x1){var _0x69c6e3;var _0x112027=_0x46d770[_0xbb5b35];if(_0x5f33dc){_0x69c6e3=path[_0x9b0d('0x1d')](_0x47c1ee,_0x2ce9ff,util[_0x9b0d('0xa')](_0x9b0d('0x20'),_0x2ce9ff,_0xbb5b35,_0x9b0d('0x21')));}else{_0x69c6e3=path[_0x9b0d('0x1d')](_0x47c1ee,util[_0x9b0d('0xa')]('%s.%s',_0x2ce9ff,_0x9b0d('0x21')));}fs[_0x9b0d('0x22')](_0x69c6e3,json2xls(_0x112027),_0x9b0d('0x23'));}})[_0x9b0d('0x11')](function(){if(_0x5f33dc){zipdir(path['join'](_0x47c1ee,_0x2ce9ff),{'saveTo':path['join'](_0x47c1ee,util['format'](_0x9b0d('0x24'),_0x2ce9ff,_0x9b0d('0x25')))},function(_0x47aaab,_0x2b6b50){});rimraf(path[_0x9b0d('0x1d')](_0x47c1ee,_0x2ce9ff),function(){});}})[_0x9b0d('0x11')](function(){logger[_0x9b0d('0x9')](util[_0x9b0d('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9b0d('0xc')));return analyticExtractedReport(_0x9b0d('0x26'),_0x5f33dc?util[_0x9b0d('0xa')](_0x9b0d('0x24'),_0x2ce9ff,_0x5f33dc?_0x9b0d('0x25'):'xlsx'):null);});})['catch'](function(_0x18630a){logger[_0x9b0d('0x9')](util['format'](_0x9b0d('0x27'),EXTRACTED_REPORT_ID,_0x9b0d('0xc')),util['inspect'](_0x18630a,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x9b0d('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index eb21a06..36461fc 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 _0xaecf=['queue','playback','hasOwnProperty','priority','extension','extensions','push','type','Set','format','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','intervals','models','VoiceExtension','then','uniq','exten','filter'];(function(_0x5453e2,_0x576b5d){var _0x52c357=function(_0x48072b){while(--_0x48072b){_0x5453e2['push'](_0x5453e2['shift']());}};_0x52c357(++_0x576b5d);}(_0xaecf,0x149));var _0xfaec=function(_0x564939,_0x3cc0f2){_0x564939=_0x564939-0x0;var _0x21a3c8=_0xaecf[_0x564939];return _0x21a3c8;};'use strict';var _=require(_0xfaec('0x0'));var util=require(_0xfaec('0x1'));function rewrite(_0x1adf70,_0x508ddf){var _0x25cf61=this;return _0x1adf70['models'][_0xfaec('0x2')][_0xfaec('0x3')]({'raw':!![]})['then'](function(_0x494a31){_0x25cf61[_0xfaec('0x4')]=_0x494a31;return _0x1adf70[_0xfaec('0x5')][_0xfaec('0x6')][_0xfaec('0x3')]({'where':{'IntervalId':_0x508ddf['IntervalId']},'raw':!![]});})[_0xfaec('0x7')](function(_0x51da3b){return _0x1adf70[_0xfaec('0x5')]['VoiceExtension'][_0xfaec('0x3')]({'where':{'exten':{'$in':_[_0xfaec('0x8')](_['map'](_0x51da3b,_0xfaec('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xfaec('0x7')](function(_0x2adbd1){var _0x239ffd=_[_0xfaec('0xa')](_0x2adbd1,{'priority':'1'});var _0x5cf850=_['filter'](_0x2adbd1,{'isApp':0x1});var _0x19cd73=_['groupBy'](_0x5cf850,_0xfaec('0x9'));var _0x26eac5=[_0xfaec('0xb'),_0xfaec('0xc')];var _0x2cc6ee=[];var _0x30e710=[];for(var _0x414a9 in _0x19cd73){if(_0x19cd73[_0xfaec('0xd')](_0x414a9)){_0x25cf61[_0xfaec('0xe')]=0x2;_0x25cf61['extensions']=[];_0x25cf61[_0xfaec('0xf')]=_['find'](_0x239ffd,{'exten':_0x19cd73[_0x414a9][0x0]['exten']});_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':_0xfaec('0x13'),'appdata':util[_0xfaec('0x14')]('CDR(type)=%s',_0x19cd73[_0x414a9][0x0]['type']),'context':_0x19cd73[_0x414a9][0x0][_0xfaec('0x15')],'exten':_0x19cd73[_0x414a9][0x0][_0xfaec('0x9')],'priority':_0x25cf61[_0xfaec('0xe')]++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});if(_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')]===_0xfaec('0x17')){if(_0x25cf61[_0xfaec('0xf')]){_0x25cf61['extensions'][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':_0xfaec('0x13'),'appdata':_0xfaec('0x18')+(_0x25cf61[_0xfaec('0xf')][_0xfaec('0x19')]?_0xfaec('0x1a')+_0x25cf61[_0xfaec('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0x19cd73[_0x414a9][0x0][_0xfaec('0x15')],'exten':_0x19cd73[_0x414a9][0x0]['exten'],'priority':_0x25cf61[_0xfaec('0xe')]++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0]['VoiceExtensionId']});}_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':_0xfaec('0x13'),'appdata':_0xfaec('0x1b')+_0x19cd73[_0x414a9][0x0]['VoiceExtensionId'],'context':_0x19cd73[_0x414a9][0x0]['context'],'exten':_0x19cd73[_0x414a9][0x0][_0xfaec('0x9')],'priority':_0x25cf61[_0xfaec('0xe')]++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});var _0x4a1754=_0x25cf61[_0xfaec('0xe')]++;_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':_0xfaec('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4a1754+0x2)+'):Goto('+(_0x4a1754+0x1)+')','context':_0x19cd73[_0x414a9][0x0]['context'],'exten':_0x19cd73[_0x414a9][0x0][_0xfaec('0x9')],'priority':_0x4a1754,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});if(_0x25cf61[_0xfaec('0xf')]){_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':_0xfaec('0x13'),'appdata':_0x25cf61[_0xfaec('0xf')][_0xfaec('0x19')]?_0xfaec('0x1d')+_0x25cf61['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x19cd73[_0x414a9][0x0]['context'],'exten':_0x19cd73[_0x414a9][0x0]['exten'],'priority':_0x25cf61[_0xfaec('0xe')]++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0]['VoiceExtensionId']});}_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':'Set','appdata':_0xfaec('0x1e')+_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')],'context':_0x19cd73[_0x414a9][0x0][_0xfaec('0x15')],'exten':_0x19cd73[_0x414a9][0x0]['exten'],'priority':_0x25cf61['priority']++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});if(_0x25cf61[_0xfaec('0xf')]&&_0x25cf61[_0xfaec('0xf')]['hasOwnProperty'](_0xfaec('0x1f'))&&_0x25cf61[_0xfaec('0xf')][_0xfaec('0x1f')]!==_0xfaec('0x20')){_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':_0xfaec('0x13'),'appdata':_0xfaec('0x21'),'context':_0x19cd73[_0x414a9][0x0][_0xfaec('0x15')],'exten':_0x19cd73[_0x414a9][0x0][_0xfaec('0x9')],'priority':_0x25cf61[_0xfaec('0xe')]++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});_0x25cf61['extensions'][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':'Set','appdata':_0xfaec('0x22')+_0x25cf61[_0xfaec('0xf')][_0xfaec('0x1f')]||_0xfaec('0x23'),'context':_0x19cd73[_0x414a9][0x0][_0xfaec('0x15')],'exten':_0x19cd73[_0x414a9][0x0][_0xfaec('0x9')],'priority':_0x25cf61[_0xfaec('0xe')]++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});}}_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':_0xfaec('0x13'),'appdata':_0xfaec('0x24'),'context':_0x19cd73[_0x414a9][0x0][_0xfaec('0x15')],'exten':_0x19cd73[_0x414a9][0x0]['exten'],'priority':_0x25cf61[_0xfaec('0xe')]++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0]['VoiceExtensionId']});_0x25cf61['extensions'][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':_0xfaec('0x13'),'appdata':_0xfaec('0x25'),'context':_0x19cd73[_0x414a9][0x0]['context'],'exten':_0x19cd73[_0x414a9][0x0][_0xfaec('0x9')],'priority':_0x25cf61[_0xfaec('0xe')]++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0]['VoiceExtensionId']});_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0]['type'],'app':_0xfaec('0x13'),'appdata':_0xfaec('0x26'),'context':_0x19cd73[_0x414a9][0x0][_0xfaec('0x15')],'exten':_0x19cd73[_0x414a9][0x0][_0xfaec('0x9')],'priority':_0x25cf61['priority']++,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});for(var _0x47ceb3=0x0,_0x5bb369=0x0;_0x47ceb3<_0x19cd73[_0x414a9][_0xfaec('0x27')];_0x47ceb3+=0x1,_0x5bb369=0x0){var _0x46bf6c=_0x19cd73[_0x414a9][_0x47ceb3];if(_0x46bf6c[_0xfaec('0x12')]){_0x46bf6c[_0xfaec('0x12')]=_0x46bf6c[_0xfaec('0x12')][_0xfaec('0x28')]();}var _0x55747a=[];var _0x222e7b=[];delete _0x46bf6c['id'];delete _0x46bf6c[_0xfaec('0x29')];delete _0x46bf6c[_0xfaec('0x2a')];var _0x29e2f8=_0x46bf6c[_0xfaec('0x2b')]!==_0xfaec('0x2c')?[_0x46bf6c[_0xfaec('0x2b')]]:_0x46bf6c['IntervalId']?_[_0xfaec('0x2d')](_[_0xfaec('0xa')](_0x25cf61[_0xfaec('0x4')],{'IntervalId':_0x46bf6c[_0xfaec('0x2e')]}),'interval'):[];if(_0x46bf6c[_0xfaec('0xd')](_0xfaec('0x2f'))){if(_0x46bf6c['tag']&&_0x46bf6c['tag']!=='--'){_0x55747a[_0xfaec('0x11')]({'type':_0x46bf6c[_0xfaec('0x12')],'app':_0xfaec('0x13'),'appdata':_0xfaec('0x30')+_0x46bf6c[_0xfaec('0x2f')],'context':_0x46bf6c[_0xfaec('0x15')],'exten':_0x46bf6c['exten'],'priority':_0x29e2f8['length']+_0x25cf61['priority']+_0x5bb369++,'VoiceExtensionId':_0x46bf6c[_0xfaec('0x16')]});}}if(_0x46bf6c['type']===_0xfaec('0x17')&&_0x46bf6c[_0xfaec('0xd')]('callerID')){if(_0x46bf6c[_0xfaec('0x31')]){_0x55747a[_0xfaec('0x11')]({'type':_0x46bf6c[_0xfaec('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x46bf6c[_0xfaec('0x31')]+')','context':_0x46bf6c[_0xfaec('0x15')],'exten':_0x46bf6c[_0xfaec('0x9')],'priority':_0x29e2f8['length']+_0x25cf61['priority']+_0x5bb369++,'VoiceExtensionId':_0x46bf6c[_0xfaec('0x16')]});}else{_0x55747a['push']({'type':_0x46bf6c[_0xfaec('0x12')],'app':_0xfaec('0x1c'),'appdata':_0xfaec('0x32'),'context':_0x46bf6c[_0xfaec('0x15')],'exten':_0x46bf6c['exten'],'priority':_0x29e2f8[_0xfaec('0x27')]+_0x25cf61[_0xfaec('0xe')]+_0x5bb369++,'VoiceExtensionId':_0x46bf6c['VoiceExtensionId']});}}if(_0x46bf6c[_0xfaec('0xd')](_0xfaec('0x33'))){if(_0x26eac5[_0xfaec('0x34')](_0x46bf6c[_0xfaec('0x35')]['toLowerCase']())>=0x0&&_0x46bf6c[_0xfaec('0x36')]!=='custom'){if(_0x46bf6c['answer']){_0x55747a[_0xfaec('0x11')]({'type':_0x46bf6c[_0xfaec('0x12')],'app':_0xfaec('0x1c'),'appdata':_0xfaec('0x37'),'context':_0x46bf6c[_0xfaec('0x15')],'exten':_0x46bf6c[_0xfaec('0x9')],'priority':_0x29e2f8['length']+_0x25cf61[_0xfaec('0xe')]+_0x5bb369++,'VoiceExtensionId':_0x46bf6c[_0xfaec('0x16')]});_0x55747a[_0xfaec('0x11')]({'type':_0x46bf6c[_0xfaec('0x12')],'app':'Set','appdata':_0xfaec('0x38'),'context':_0x46bf6c[_0xfaec('0x15')],'exten':_0x46bf6c[_0xfaec('0x9')],'priority':_0x29e2f8['length']+_0x25cf61[_0xfaec('0xe')]+_0x5bb369++,'VoiceExtensionId':_0x46bf6c['VoiceExtensionId']});}else{_0x55747a['push']({'type':_0x46bf6c[_0xfaec('0x12')],'app':_0xfaec('0x1c'),'appdata':_0xfaec('0x39'),'context':_0x46bf6c[_0xfaec('0x15')],'exten':_0x46bf6c[_0xfaec('0x9')],'priority':_0x29e2f8[_0xfaec('0x27')]+_0x25cf61['priority']+_0x5bb369++,'VoiceExtensionId':_0x46bf6c[_0xfaec('0x16')]});_0x55747a[_0xfaec('0x11')]({'type':_0x46bf6c[_0xfaec('0x12')],'app':'Set','appdata':_0xfaec('0x3a'),'context':_0x46bf6c[_0xfaec('0x15')],'exten':_0x46bf6c[_0xfaec('0x9')],'priority':_0x29e2f8['length']+_0x25cf61['priority']+_0x5bb369++,'VoiceExtensionId':_0x46bf6c[_0xfaec('0x16')]});}}}for(var _0x3864de=0x0;_0x3864de<_0x29e2f8[_0xfaec('0x27')];_0x3864de+=0x1){var _0x3933c3=_0x25cf61['priority']+_0x29e2f8['length'];var _0x4fac6a=_0x3864de===_0x29e2f8[_0xfaec('0x27')]-0x1?_0x25cf61['priority']+_0x55747a[_0xfaec('0x27')]+_0x222e7b[_0xfaec('0x27')]+0x2:_0x25cf61['priority']+_0x3864de+0x1;_0x55747a['splice'](_0x3864de,0x0,{'type':_0x46bf6c[_0xfaec('0x12')],'app':_0xfaec('0x3b'),'appdata':_0x29e2f8[_0x3864de]+'?'+_0x46bf6c[_0xfaec('0x15')]+_0xfaec('0x3c')+_0x3933c3+':'+_0x46bf6c['context']+',${EXTEN},'+_0x4fac6a,'exten':_0x46bf6c[_0xfaec('0x9')],'context':_0x46bf6c[_0xfaec('0x15')],'priority':_0x25cf61[_0xfaec('0xe')]+_0x3864de,'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});}_0x46bf6c['priority']=_0x55747a['length']?_[_0xfaec('0x3d')](_0x55747a)[_0xfaec('0xe')]+0x1:_0x25cf61['priority'];_0x25cf61['priority']=(_0x222e7b['length']?_[_0xfaec('0x3d')](_0x222e7b)[_0xfaec('0xe')]:_0x46bf6c[_0xfaec('0xe')])+0x1;_0x25cf61[_0xfaec('0x10')]=_['concat'](_0x25cf61['extensions'],_0x55747a,[_0x46bf6c],_0x222e7b);}_0x25cf61[_0xfaec('0x10')][_0xfaec('0x11')]({'type':_0x19cd73[_0x414a9][0x0][_0xfaec('0x12')],'app':'Hangup','exten':_0x19cd73[_0x414a9][0x0][_0xfaec('0x9')],'context':_0x19cd73[_0x414a9][0x0][_0xfaec('0x15')],'priority':_0x25cf61[_0xfaec('0xe')],'VoiceExtensionId':_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]});_0x2cc6ee['push'](_0x19cd73[_0x414a9][0x0][_0xfaec('0x16')]);_0x30e710=_[_0xfaec('0x3e')](_0x30e710,_0x25cf61[_0xfaec('0x10')]);}}return _0x1adf70['transaction'](function(_0x36a0f5){return _0x1adf70['models'][_0xfaec('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x2cc6ee}},'transaction':_0x36a0f5})[_0xfaec('0x7')](function(_0x59dcd5){return _0x1adf70[_0xfaec('0x5')]['VoiceExtension'][_0xfaec('0x3f')](_[_0xfaec('0x40')](_0x30e710,_0xfaec('0xe')),{'transaction':_0x36a0f5});});});})[_0xfaec('0x41')](function(_0xbe822){console[_0xfaec('0x42')](_0xbe822);});}exports[_0xfaec('0x43')]=rewrite; \ No newline at end of file +var _0xad8a=['updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','outbound','Set','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','VoiceExtensionId','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt'];(function(_0x7dc1dc,_0x35d1bc){var _0x3786f3=function(_0x314fca){while(--_0x314fca){_0x7dc1dc['push'](_0x7dc1dc['shift']());}};_0x3786f3(++_0x35d1bc);}(_0xad8a,0xb0));var _0xaad8=function(_0x2cf4f9,_0x4910a8){_0x2cf4f9=_0x2cf4f9-0x0;var _0x338f0e=_0xad8a[_0x2cf4f9];return _0x338f0e;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));function rewrite(_0x6efdc8,_0xa8be63){var _0x158aa2=this;return _0x6efdc8['models'][_0xaad8('0x2')][_0xaad8('0x3')]({'raw':!![]})[_0xaad8('0x4')](function(_0x58f2c5){_0x158aa2[_0xaad8('0x5')]=_0x58f2c5;return _0x6efdc8[_0xaad8('0x6')][_0xaad8('0x7')][_0xaad8('0x3')]({'where':{'IntervalId':_0xa8be63[_0xaad8('0x8')]},'raw':!![]});})[_0xaad8('0x4')](function(_0x28f3a1){return _0x6efdc8[_0xaad8('0x6')][_0xaad8('0x7')][_0xaad8('0x3')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x28f3a1,_0xaad8('0x9')))}},'order':[{'raw':_0xaad8('0xa')}],'raw':!![]});})[_0xaad8('0x4')](function(_0x4784a9){var _0x3fed5c=_[_0xaad8('0xb')](_0x4784a9,{'priority':'1'});var _0x1a9da9=_[_0xaad8('0xb')](_0x4784a9,{'isApp':0x1});var _0x1e0b82=_['groupBy'](_0x1a9da9,_0xaad8('0x9'));var _0x2a13fb=[_0xaad8('0xc'),_0xaad8('0xd')];var _0x3f24ab=[];var _0x13b799=[];for(var _0x321c22 in _0x1e0b82){if(_0x1e0b82[_0xaad8('0xe')](_0x321c22)){_0x158aa2[_0xaad8('0xf')]=0x2;_0x158aa2[_0xaad8('0x10')]=[];_0x158aa2[_0xaad8('0x11')]=_[_0xaad8('0x12')](_0x3fed5c,{'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')]});_0x158aa2['extensions'][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':'Set','appdata':util[_0xaad8('0x15')](_0xaad8('0x16'),_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')]),'context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2[_0xaad8('0xf')]++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0]['VoiceExtensionId']});if(_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')]===_0xaad8('0x18')){if(_0x158aa2['extension']){_0x158aa2[_0xaad8('0x10')]['push']({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':_0xaad8('0x19'),'appdata':_0xaad8('0x1a')+(_0x158aa2[_0xaad8('0x11')]['cutdigits']?_0xaad8('0x1b')+_0x158aa2[_0xaad8('0x11')]['cutdigits']+'}':_0xaad8('0x1c')),'context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2['priority']++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0]['VoiceExtensionId']});}_0x158aa2[_0xaad8('0x10')][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':_0xaad8('0x19'),'appdata':_0xaad8('0x1d')+_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')],'context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2[_0xaad8('0xf')]++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')]});var _0x1bbac4=_0x158aa2[_0xaad8('0xf')]++;_0x158aa2[_0xaad8('0x10')][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':'ExecIf','appdata':_0xaad8('0x1f')+(_0x1bbac4+0x2)+_0xaad8('0x20')+(_0x1bbac4+0x1)+')','context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'exten':_0x1e0b82[_0x321c22][0x0]['exten'],'priority':_0x1bbac4,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')]});if(_0x158aa2[_0xaad8('0x11')]){_0x158aa2[_0xaad8('0x10')][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':'Set','appdata':_0x158aa2[_0xaad8('0x11')][_0xaad8('0x21')]?_0xaad8('0x22')+_0x158aa2[_0xaad8('0x11')][_0xaad8('0x21')]+'}':'CDR(prefix)=noprefix','context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2[_0xaad8('0xf')]++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')]});}_0x158aa2['extensions'][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':_0xaad8('0x19'),'appdata':_0xaad8('0x23')+_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')],'context':_0x1e0b82[_0x321c22][0x0]['context'],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2[_0xaad8('0xf')]++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0]['VoiceExtensionId']});if(_0x158aa2['extension']&&_0x158aa2[_0xaad8('0x11')][_0xaad8('0xe')](_0xaad8('0x24'))&&_0x158aa2[_0xaad8('0x11')]['recordingFormat']!==_0xaad8('0x25')){_0x158aa2[_0xaad8('0x10')]['push']({'type':_0x1e0b82[_0x321c22][0x0]['type'],'app':_0xaad8('0x19'),'appdata':_0xaad8('0x26'),'context':_0x1e0b82[_0x321c22][0x0]['context'],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2['priority']++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0]['VoiceExtensionId']});_0x158aa2[_0xaad8('0x10')][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0]['type'],'app':_0xaad8('0x19'),'appdata':_0xaad8('0x27')+_0x158aa2[_0xaad8('0x11')][_0xaad8('0x24')]||'wav','context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2[_0xaad8('0xf')]++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')]});}}_0x158aa2[_0xaad8('0x10')][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0]['type'],'app':_0xaad8('0x19'),'appdata':_0xaad8('0x28'),'context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'exten':_0x1e0b82[_0x321c22][0x0]['exten'],'priority':_0x158aa2[_0xaad8('0xf')]++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')]});_0x158aa2[_0xaad8('0x10')][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':_0xaad8('0x19'),'appdata':_0xaad8('0x29'),'context':_0x1e0b82[_0x321c22][0x0]['context'],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2[_0xaad8('0xf')]++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')]});_0x158aa2[_0xaad8('0x10')][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':'Set','appdata':_0xaad8('0x2a'),'context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'priority':_0x158aa2[_0xaad8('0xf')]++,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0]['VoiceExtensionId']});for(var _0x543761=0x0,_0x5b1bad=0x0;_0x543761<_0x1e0b82[_0x321c22][_0xaad8('0x2b')];_0x543761+=0x1,_0x5b1bad=0x0){var _0x228631=_0x1e0b82[_0x321c22][_0x543761];if(_0x228631[_0xaad8('0x14')]){_0x228631['type']=_0x228631[_0xaad8('0x14')][_0xaad8('0x2c')]();}var _0x4af930=[];var _0x34cbae=[];delete _0x228631['id'];delete _0x228631[_0xaad8('0x2d')];delete _0x228631[_0xaad8('0x2e')];var _0x292d4e=_0x228631[_0xaad8('0x2f')]!==_0xaad8('0x30')?[_0x228631[_0xaad8('0x2f')]]:_0x228631[_0xaad8('0x8')]?_[_0xaad8('0x31')](_[_0xaad8('0xb')](_0x158aa2[_0xaad8('0x5')],{'IntervalId':_0x228631[_0xaad8('0x8')]}),'interval'):[];if(_0x228631['hasOwnProperty']('tag')){if(_0x228631[_0xaad8('0x32')]&&_0x228631['tag']!=='--'){_0x4af930[_0xaad8('0x13')]({'type':_0x228631['type'],'app':'Set','appdata':_0xaad8('0x33')+_0x228631['tag'],'context':_0x228631[_0xaad8('0x17')],'exten':_0x228631[_0xaad8('0x9')],'priority':_0x292d4e[_0xaad8('0x2b')]+_0x158aa2[_0xaad8('0xf')]+_0x5b1bad++,'VoiceExtensionId':_0x228631[_0xaad8('0x1e')]});}}if(_0x228631[_0xaad8('0x14')]===_0xaad8('0x18')&&_0x228631[_0xaad8('0xe')](_0xaad8('0x34'))){if(_0x228631[_0xaad8('0x34')]){_0x4af930[_0xaad8('0x13')]({'type':_0x228631[_0xaad8('0x14')],'app':_0xaad8('0x35'),'appdata':_0xaad8('0x36')+_0x228631[_0xaad8('0x34')]+')','context':_0x228631['context'],'exten':_0x228631['exten'],'priority':_0x292d4e[_0xaad8('0x2b')]+_0x158aa2[_0xaad8('0xf')]+_0x5b1bad++,'VoiceExtensionId':_0x228631[_0xaad8('0x1e')]});}else{_0x4af930['push']({'type':_0x228631['type'],'app':_0xaad8('0x35'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x228631[_0xaad8('0x17')],'exten':_0x228631[_0xaad8('0x9')],'priority':_0x292d4e[_0xaad8('0x2b')]+_0x158aa2[_0xaad8('0xf')]+_0x5b1bad++,'VoiceExtensionId':_0x228631[_0xaad8('0x1e')]});}}if(_0x228631[_0xaad8('0xe')](_0xaad8('0x37'))){if(_0x2a13fb[_0xaad8('0x38')](_0x228631[_0xaad8('0x39')]['toLowerCase']())>=0x0&&_0x228631[_0xaad8('0x3a')]!==_0xaad8('0x3b')){if(_0x228631['answer']){_0x4af930[_0xaad8('0x13')]({'type':_0x228631['type'],'app':_0xaad8('0x35'),'appdata':_0xaad8('0x3c'),'context':_0x228631[_0xaad8('0x17')],'exten':_0x228631[_0xaad8('0x9')],'priority':_0x292d4e[_0xaad8('0x2b')]+_0x158aa2[_0xaad8('0xf')]+_0x5b1bad++,'VoiceExtensionId':_0x228631[_0xaad8('0x1e')]});_0x4af930[_0xaad8('0x13')]({'type':_0x228631[_0xaad8('0x14')],'app':'Set','appdata':_0xaad8('0x3d'),'context':_0x228631[_0xaad8('0x17')],'exten':_0x228631[_0xaad8('0x9')],'priority':_0x292d4e[_0xaad8('0x2b')]+_0x158aa2[_0xaad8('0xf')]+_0x5b1bad++,'VoiceExtensionId':_0x228631[_0xaad8('0x1e')]});}else{_0x4af930['push']({'type':_0x228631[_0xaad8('0x14')],'app':_0xaad8('0x35'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x228631['context'],'exten':_0x228631[_0xaad8('0x9')],'priority':_0x292d4e[_0xaad8('0x2b')]+_0x158aa2[_0xaad8('0xf')]+_0x5b1bad++,'VoiceExtensionId':_0x228631[_0xaad8('0x1e')]});_0x4af930[_0xaad8('0x13')]({'type':_0x228631[_0xaad8('0x14')],'app':'Set','appdata':_0xaad8('0x3e'),'context':_0x228631[_0xaad8('0x17')],'exten':_0x228631[_0xaad8('0x9')],'priority':_0x292d4e[_0xaad8('0x2b')]+_0x158aa2[_0xaad8('0xf')]+_0x5b1bad++,'VoiceExtensionId':_0x228631['VoiceExtensionId']});}}}for(var _0x5ddb77=0x0;_0x5ddb77<_0x292d4e[_0xaad8('0x2b')];_0x5ddb77+=0x1){var _0x474a81=_0x158aa2[_0xaad8('0xf')]+_0x292d4e['length'];var _0x390120=_0x5ddb77===_0x292d4e[_0xaad8('0x2b')]-0x1?_0x158aa2[_0xaad8('0xf')]+_0x4af930['length']+_0x34cbae[_0xaad8('0x2b')]+0x2:_0x158aa2['priority']+_0x5ddb77+0x1;_0x4af930[_0xaad8('0x3f')](_0x5ddb77,0x0,{'type':_0x228631[_0xaad8('0x14')],'app':_0xaad8('0x40'),'appdata':_0x292d4e[_0x5ddb77]+'?'+_0x228631[_0xaad8('0x17')]+',${EXTEN},'+_0x474a81+':'+_0x228631[_0xaad8('0x17')]+_0xaad8('0x41')+_0x390120,'exten':_0x228631['exten'],'context':_0x228631['context'],'priority':_0x158aa2[_0xaad8('0xf')]+_0x5ddb77,'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0]['VoiceExtensionId']});}_0x228631[_0xaad8('0xf')]=_0x4af930[_0xaad8('0x2b')]?_[_0xaad8('0x42')](_0x4af930)[_0xaad8('0xf')]+0x1:_0x158aa2[_0xaad8('0xf')];_0x158aa2[_0xaad8('0xf')]=(_0x34cbae[_0xaad8('0x2b')]?_[_0xaad8('0x42')](_0x34cbae)[_0xaad8('0xf')]:_0x228631['priority'])+0x1;_0x158aa2[_0xaad8('0x10')]=_[_0xaad8('0x43')](_0x158aa2[_0xaad8('0x10')],_0x4af930,[_0x228631],_0x34cbae);}_0x158aa2[_0xaad8('0x10')][_0xaad8('0x13')]({'type':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x14')],'app':'Hangup','exten':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x9')],'context':_0x1e0b82[_0x321c22][0x0][_0xaad8('0x17')],'priority':_0x158aa2[_0xaad8('0xf')],'VoiceExtensionId':_0x1e0b82[_0x321c22][0x0]['VoiceExtensionId']});_0x3f24ab['push'](_0x1e0b82[_0x321c22][0x0][_0xaad8('0x1e')]);_0x13b799=_[_0xaad8('0x43')](_0x13b799,_0x158aa2[_0xaad8('0x10')]);}}return _0x6efdc8[_0xaad8('0x44')](function(_0x5a30d4){return _0x6efdc8[_0xaad8('0x6')][_0xaad8('0x7')][_0xaad8('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x3f24ab}},'transaction':_0x5a30d4})[_0xaad8('0x4')](function(_0x97e954){return _0x6efdc8['models']['VoiceExtension'][_0xaad8('0x46')](_[_0xaad8('0x47')](_0x13b799,_0xaad8('0xf')),{'transaction':_0x5a30d4});});});})[_0xaad8('0x48')](function(_0x3b6f67){console[_0xaad8('0x49')](_0x3b6f67);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1339725..7b52282 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 _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){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'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}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(_0xcae443,_0x19df0e){var _0x4cd5f0=function(_0x46641a){while(--_0x46641a){_0xcae443['push'](_0xcae443['shift']());}};_0x4cd5f0(++_0x19df0e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xcb91[_0x378b4];return _0x11d07b;};'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 61065d9..8631f5c 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 _0x5eb6=['updatedAt','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','createdAt','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','ListId','id\x20IN\x20?','MIN(id)','min_id','group','info','message','code','push','catch','main','start','binding','socket_timestamp','root','header','writeFileSync','parse','createReadStream','data','length','errors','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','rows','Abort\x20parser','abort','SystemError','error','step','duplicates','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','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','finish','affectedRows','emit','contact:import:','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId'];(function(_0x3484c3,_0x31718b){var _0x7d46dc=function(_0x475443){while(--_0x475443){_0x3484c3['push'](_0x3484c3['shift']());}};_0x7d46dc(++_0x31718b);}(_0x5eb6,0x15e));var _0x65eb=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5eb6[_0x4e676e];return _0x336a3c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x65eb('0x0'));var Papa=require('papaparse');var util=require(_0x65eb('0x1'));var BPromise=require(_0x65eb('0x2'));var moment=require(_0x65eb('0x3'));var squel=require(_0x65eb('0x4'));var Redis=require(_0x65eb('0x5'));var db=require(_0x65eb('0x6'))['db'];var config=require(_0x65eb('0x7'));var logger=require(_0x65eb('0x8'))(_0x65eb('0x9'));config[_0x65eb('0xa')]=_['defaults'](config[_0x65eb('0xa')],{'host':_0x65eb('0xb'),'port':0x18eb});var socket=require(_0x65eb('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x65eb('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x36945c){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))*$/[_0x65eb('0xe')](_0x36945c);}function selectNotIn(_0x5d9b6f,_0x4666bf,_0x3a6417,_0x3d6e1b,_0x122de0){return squel[_0x65eb('0xf')]()[_0x65eb('0x10')](_0x65eb('0x11'))[_0x65eb('0x12')](_0x3d6e1b)['join'](_0x4666bf,null,_0x4666bf+_0x65eb('0x13')+_0x3d6e1b+'.'+_0x3a6417)[_0x65eb('0x14')](_0x3d6e1b+'.'+_0x3a6417+_0x65eb('0x15')+_0x5d9b6f+'.'+_0x3a6417)[_0x65eb('0x14')](_0x4666bf+_0x65eb('0x16')+_0x122de0[_0x65eb('0x17')]()+')');}function insertCmHopper(_0x130c24,_0x25daa5,_0x3f3052,_0x360847,_0x3ba896){var _0x1116d4=[_0x65eb('0x18'),_0x65eb('0x19'),_0x65eb('0x1a'),'cm_contacts.ListId',_0x25daa5+'.'+_0x360847,_0x65eb('0x1b'),_0x65eb('0x1c'),_0x65eb('0x1d'),_0x65eb('0x1e'),'\x22'+_0x3ba896+'\x22'];return squel[_0x65eb('0x1f')]()[_0x65eb('0x20')](_0x65eb('0x21'))[_0x65eb('0x22')](['phone',_0x65eb('0x23'),_0x65eb('0x24'),'ListId',_0x360847,'createdAt',_0x65eb('0x25'),'priority',_0x65eb('0x26'),'recallme'],squel[_0x65eb('0xf')]()[_0x65eb('0x27')](_0x1116d4)[_0x65eb('0x12')](_0x25daa5)[_0x65eb('0x17')](_0x65eb('0x28'),null,_0x65eb('0x29')+_0x25daa5+_0x65eb('0x2a'))['join'](_0x3f3052,null,_0x3f3052+'.id\x20=\x20'+_0x25daa5+'.'+_0x360847)['where'](_0x25daa5+_0x65eb('0x2b'),_0x130c24)[_0x65eb('0x14')](_0x65eb('0x2c'),NOW)[_0x65eb('0x14')](_0x65eb('0x2d'),selectNotIn(_0x25daa5,_0x3f3052,_0x360847,_0x65eb('0x21'),[_0x65eb('0x2e'),_0x65eb('0x2f')]))[_0x65eb('0x14')](_0x65eb('0x2d'),selectNotIn(_0x25daa5,_0x3f3052,_0x360847,_0x65eb('0x21'),[_0x65eb('0x2e')])))[_0x65eb('0x30')]();}function insertCmHopperBlack(_0x1d9d5e,_0x18fbbc,_0x47c9a1,_0x13e869){var _0x495a97=[_0x65eb('0x18'),'cm_contacts.id',_0x65eb('0x31'),_0x18fbbc+'.'+_0x13e869,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x65eb('0x1f')]()[_0x65eb('0x20')]('cm_hopper_black')[_0x65eb('0x22')]([_0x65eb('0x11'),_0x65eb('0x24'),'ListId',_0x13e869,_0x65eb('0x32'),'updatedAt'],squel[_0x65eb('0xf')]()['fields'](_0x495a97)[_0x65eb('0x12')](_0x18fbbc)[_0x65eb('0x17')](_0x65eb('0x28'),null,_0x65eb('0x29')+_0x18fbbc+_0x65eb('0x2a'))['join'](_0x47c9a1,null,_0x47c9a1+_0x65eb('0x13')+_0x18fbbc+'.'+_0x13e869)[_0x65eb('0x14')](_0x18fbbc+_0x65eb('0x2b'),_0x1d9d5e)['where'](_0x65eb('0x2c'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x65eb('0xf')]()[_0x65eb('0x10')](_0x65eb('0x11'))['from'](_0x65eb('0x33'))['where'](_0x65eb('0x34'),_0x1d9d5e)['where'](_0x13e869+_0x65eb('0x35'),_0x18fbbc+'.'+_0x13e869)))[_0x65eb('0x30')]();}function insertCmContact(_0x2ebcb2,_0x86e83b,_0x8a7cd1,_0x5733d4){var _0x5d6090=_[_0x65eb('0x36')](_[_0x65eb('0x37')](_0x5733d4),[_0x65eb('0x38'),'CompanyId','createdAt',_0x65eb('0x25')]);return squel[_0x65eb('0x1f')]()[_0x65eb('0x20')]('cm_contacts')[_0x65eb('0x22')](_0x5d6090,squel[_0x65eb('0xf')]()[_0x65eb('0x27')](_0x5d6090)[_0x65eb('0x12')](_0x86e83b)[_0x65eb('0x14')]('('+_0x8a7cd1[_0x65eb('0x17')](',')+')\x20NOT\x20IN\x20?',squel[_0x65eb('0xf')]()[_0x65eb('0x27')](_0x8a7cd1)['from']('cm_contacts')[_0x65eb('0x14')](_0x65eb('0x34'),_0x2ebcb2))[_0x65eb('0x14')](_0x65eb('0x39'),squel[_0x65eb('0xf')]()['field'](_0x65eb('0x3a'),_0x65eb('0x3b'))['from'](_0x86e83b)[_0x65eb('0x3c')](_0x8a7cd1['join'](','))))[_0x65eb('0x30')]();}function handleStop(){logger[_0x65eb('0x3d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4782ad){logger['error'](_0x4782ad[_0x65eb('0x3e')]);process['exit'](0x1);}function handleError(_0x530d44,_0x578797){stats['errors']['push']({'name':_0x578797[_0x65eb('0x3f')],'message':_0x578797[_0x65eb('0x3e')],'row':_0x530d44});}function handleQuery(_0x205c4a){logger[_0x65eb('0x3d')](_0x205c4a);return db['sequelize']['query'](_0x205c4a)['spread'](function(_0x4cedb6){results[_0x65eb('0x40')](_0x4cedb6);})[_0x65eb('0x41')](function(_0x3fefb0){logger['error'](_0x3fefb0[_0x65eb('0x3e')]);});}function main(_0x149258,_0x40fc5b,_0x241fd4,_0x3b9d13){logger[_0x65eb('0x3d')](_0x65eb('0x42'),_0x149258,JSON['stringify'](_0x40fc5b));process['send'](_0x65eb('0x43'));var _0xfbcabc=_0x40fc5b[_0x65eb('0x44')];var _0x3cec57=_0x40fc5b[_0x65eb('0x45')];var _0x283424=path['join'](config[_0x65eb('0x46')],'server/files/tmp',_0x3cec57+'.csv');var _0x20aeb3=_[_0x65eb('0x37')](_0xfbcabc)[_0x65eb('0x17')]();logger['info'](_0x65eb('0x47'),_0x20aeb3);fs[_0x65eb('0x48')](_0x283424,_0x20aeb3+'\x0a');Papa[_0x65eb('0x49')](fs[_0x65eb('0x4a')](_0x149258),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e9404,_0x3a093f){try{for(var _0x1823ad=0x0,_0x19d7a1=[];_0x1823ad<_0x3e9404[_0x65eb('0x4b')][_0x65eb('0x4c')];_0x1823ad++){stats['rows']+=0x1;if(_0x3e9404['errors'][_0x1823ad]){handleError(_0x3e9404[_0x65eb('0x4b')][_0x1823ad],_0x3e9404[_0x65eb('0x4d')][_0x1823ad]);}else{var _0x2c9bb3=[];for(var _0x248f5c in _0xfbcabc){if(_0xfbcabc['hasOwnProperty'](_0x248f5c)){if(_0x3e9404[_0x65eb('0x4b')][_0x1823ad][_0xfbcabc[_0x248f5c]]){var _0x1f0e25=_[_0x65eb('0x4e')](_0x3e9404[_0x65eb('0x4b')][_0x1823ad][_0xfbcabc[_0x248f5c]]['replace'](/"/g,'\x27'));switch(_0x248f5c){case _0x65eb('0x23'):var _0x4b126b=moment(_0x1f0e25,_0x65eb('0x4f'),!![]);if(_0x4b126b[_0x65eb('0x50')]()){_0x19d7a1[_0x65eb('0x40')]('\x22'+_0x1f0e25+'\x22');}else{_0x2c9bb3[_0x65eb('0x40')](_0x65eb('0x51'));}break;case _0x65eb('0x52'):var _0x1e29e3=parseInt(_0x1f0e25);_0x1f0e25=_[_0x65eb('0x53')](_0x1e29e3)||_0x1e29e3<0x0||_0x1e29e3>0x4?_0x3b9d13?0x3:0x2:_0x1e29e3;_0x19d7a1[_0x65eb('0x40')]('\x22'+_0x1f0e25+'\x22');break;case _0x65eb('0x26'):var _0x1bf757=parseInt(_0x1f0e25);if(_['isNumber'](_0x1bf757)&&_['includes'](_0x241fd4,_0x1bf757)){_0x19d7a1[_0x65eb('0x40')]('\x22'+_0x1bf757+'\x22');}else{_0x2c9bb3['push'](_0x65eb('0x54'));}break;case'email':if(isEmail(_0x1f0e25)){_0x19d7a1[_0x65eb('0x40')]('\x22'+_0x1f0e25+'\x22');}else{_0x2c9bb3[_0x65eb('0x40')](_0x65eb('0x55'));}break;case _0x65eb('0x56'):var _0x2c796b=moment(_0x1f0e25,_0x65eb('0x57'),!![]);if(_0x2c796b[_0x65eb('0x50')]()){_0x19d7a1[_0x65eb('0x40')]('\x22'+_0x1f0e25+'\x22');}else{_0x2c9bb3[_0x65eb('0x40')](_0x65eb('0x58'));}break;default:_0x19d7a1[_0x65eb('0x40')]('\x22'+_0x1f0e25+'\x22');}}else{switch(_0x248f5c){case'firstName':case'phone':_0x2c9bb3[_0x65eb('0x40')](_0x248f5c+_0x65eb('0x59'));break;default:_0x19d7a1['push']('\x22\x22');}}}}if(_0x2c9bb3[_0x65eb('0x4c')]){handleError(_0x3e9404[_0x65eb('0x4b')][_0x1823ad],{'code':_0x65eb('0x5a'),'message':_0x2c9bb3[_0x65eb('0x17')]()});}else{fs[_0x65eb('0x5b')](_0x283424,_0x19d7a1[_0x65eb('0x17')]()+'\x0a');}_0x19d7a1=[];}if(!(stats[_0x65eb('0x5c')]%0xc8)){socket['emit']('contact:import:'+_0x3cec57,stats);stats[_0x65eb('0x4d')]=[];}}if(stopped){logger['info'](_0x65eb('0x5d'));_0x3a093f[_0x65eb('0x5e')]();}}catch(_0x1695e5){handleError(_0x3e9404['data'][_0x1823ad],{'code':_0x65eb('0x5f'),'message':_0x1695e5['message']});logger[_0x65eb('0x60')](_0x65eb('0x61'),_0x1695e5[_0x65eb('0x3e')]);}},'complete':function(){try{var _0x195177=[];var _0x8e5786='cm_contacts';if(_0x40fc5b[_0x65eb('0x62')]&&_0x40fc5b['duplicates'][_0x65eb('0x4c')]){_0x8e5786='cm_contacts_'+_0x3cec57;_0x195177[_0x65eb('0x40')]('CREATE\x20TABLE\x20'+_0x8e5786+'\x20LIKE\x20cm_contacts;');}var _0x14ddda=util[_0x65eb('0xd')](_0x65eb('0x63'),_0x283424,_0x8e5786,_0x20aeb3,_0x40fc5b[_0x65eb('0x38')],_0x40fc5b[_0x65eb('0x64')]||null,NOW,NOW);if(_[_0x65eb('0x65')](_0xfbcabc['scheduledat'])){_0x14ddda+=',\x20scheduledAt\x20=\x20NOW()';}_0x195177[_0x65eb('0x40')](_0x14ddda);if(_0x40fc5b['duplicates']&&_0x40fc5b['duplicates']['length']){_0x195177[_0x65eb('0x40')](insertCmContact(_0x40fc5b[_0x65eb('0x38')],_0x8e5786,_0x40fc5b[_0x65eb('0x62')],_0xfbcabc));_0x195177['push'](_0x65eb('0x66')+_0x8e5786+';');}_0x195177[_0x65eb('0x40')](insertCmHopper(_0x40fc5b[_0x65eb('0x38')],_0x65eb('0x67'),_0x65eb('0x68'),_0x65eb('0x69'),_0x3b9d13));_0x195177[_0x65eb('0x40')](insertCmHopperBlack(_0x40fc5b[_0x65eb('0x38')],_0x65eb('0x6a'),'voice_queues',_0x65eb('0x69')));_0x195177[_0x65eb('0x40')](insertCmHopper(_0x40fc5b[_0x65eb('0x38')],_0x65eb('0x6b'),_0x65eb('0x6c'),_0x65eb('0x6d'),_0x3b9d13));_0x195177[_0x65eb('0x40')](insertCmHopperBlack(_0x40fc5b['ListId'],'campaigns_has_cm_blacklists','campaigns',_0x65eb('0x6d')));BPromise['each'](_0x195177,handleQuery)['then'](function(_0x2bba0a){stats[_0x65eb('0x6e')]=!![];stats[_0x65eb('0x6f')]=_0x40fc5b[_0x65eb('0x62')]&&_0x40fc5b['duplicates'][_0x65eb('0x4c')]?results[0x2][_0x65eb('0x6f')]:results[0x0][_0x65eb('0x6f')];socket[_0x65eb('0x70')](_0x65eb('0x71')+_0x3cec57,stats);fs[_0x65eb('0x72')](_0x149258);fs[_0x65eb('0x72')](_0x283424);process[_0x65eb('0x73')](0x0);})[_0x65eb('0x41')](function(_0x1372ca){logger[_0x65eb('0x60')](_0x1372ca[_0x65eb('0x3e')]);process[_0x65eb('0x73')](0x1);});}catch(_0x5dfe65){logger[_0x65eb('0x60')]('complete',_0x5dfe65[_0x65eb('0x3e')]);process['exit'](0x1);}},'error':function(_0x4c1271,_0x1568ec,_0x314d91,_0x1847dc){throw new Error(_0x1847dc);}});}function validate(){if(process[_0x65eb('0x74')]&&process[_0x65eb('0x74')]['length']<0x4){throw new Error(_0x65eb('0x75'));}var _0x15eca6=path[_0x65eb('0x17')](config['root'],_0x65eb('0x76'),process[_0x65eb('0x74')][0x2]);if(!fs['existsSync'](_0x15eca6)){throw new Error(_0x65eb('0x77'));}var _0x6d04f3={};try{_0x6d04f3=JSON[_0x65eb('0x49')](process[_0x65eb('0x74')][0x3]);if(!_0x6d04f3[_0x65eb('0x44')]){throw new Error(_0x65eb('0x78'));}if(!_0x6d04f3[_0x65eb('0x44')][_0x65eb('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x6d04f3[_0x65eb('0x44')][_0x65eb('0x79')]){throw new Error(_0x65eb('0x7a'));}var _0x37d1b2=0x0;if(_0x6d04f3[_0x65eb('0x44')][_0x65eb('0x26')]){_0x37d1b2=0x1;}if(!_0x6d04f3['ListId']){throw new Error(_0x65eb('0x7b'));}}catch(_0x340353){throw new Error(_0x65eb('0x7c'));}var _0x117bcf=[];try{_0x117bcf=_[_0x65eb('0x7d')](JSON[_0x65eb('0x49')](process['argv'][0x4]),'id');}catch(_0x189c75){logger[_0x65eb('0x3d')](_0x65eb('0x7e'));}main(_0x15eca6,_0x6d04f3,_0x117bcf,_0x37d1b2);}validate();process['on'](_0x65eb('0x7f'),handleStop);process['on'](_0x65eb('0x80'),handleUncaughtException); \ No newline at end of file +var _0xc46d=['emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','util','bluebird','moment','ioredis','../../../config/environment','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','into','updatedAt','fields','.CmListId','.id\x20=\x20','field','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','cm_contacts',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','errors','push','info','spread','catch','error','send','start','binding','root','.csv','header','writeFileSync','parse','data','length','rows','hasOwnProperty','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow'];(function(_0x5eb4ae,_0x24d9f0){var _0x563160=function(_0x38282c){while(--_0x38282c){_0x5eb4ae['push'](_0x5eb4ae['shift']());}};_0x563160(++_0x24d9f0);}(_0xc46d,0x118));var _0xdc46=function(_0x1cef29,_0x1b1357){_0x1cef29=_0x1cef29-0x0;var _0x5c8d26=_0xc46d[_0x1cef29];return _0x5c8d26;};'use strict';var fs=require('fs');var path=require(_0xdc46('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xdc46('0x1'));var BPromise=require(_0xdc46('0x2'));var moment=require(_0xdc46('0x3'));var squel=require('squel');var Redis=require(_0xdc46('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xdc46('0x5'));var logger=require('../../../config/logger')('import');config[_0xdc46('0x6')]=_[_0xdc46('0x7')](config['redis'],{'host':_0xdc46('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc46('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xdc46('0x9')](_0xdc46('0xa'));function isEmail(_0x51378e){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))*$/[_0xdc46('0xb')](_0x51378e);}function selectNotIn(_0x1b4f33,_0x4f9f89,_0x355284,_0x15c98b,_0x463690){return squel[_0xdc46('0xc')]()['field'](_0xdc46('0xd'))[_0xdc46('0xe')](_0x15c98b)[_0xdc46('0xf')](_0x4f9f89,null,_0x4f9f89+'.id\x20=\x20'+_0x15c98b+'.'+_0x355284)[_0xdc46('0x10')](_0x15c98b+'.'+_0x355284+_0xdc46('0x11')+_0x1b4f33+'.'+_0x355284)['where'](_0x4f9f89+_0xdc46('0x12')+_0x463690[_0xdc46('0xf')]()+')');}function insertCmHopper(_0x1a1b3e,_0x4fc806,_0xde43fe,_0xecec4a,_0x122ae6){var _0x417dc7=[_0xdc46('0x13'),_0xdc46('0x14'),_0xdc46('0x15'),_0xdc46('0x16'),_0x4fc806+'.'+_0xecec4a,_0xdc46('0x17'),'cm_contacts.updatedAt',_0xdc46('0x18'),_0xdc46('0x19'),'\x22'+_0x122ae6+'\x22'];return squel['insert']()['into'](_0xdc46('0x1a'))[_0xdc46('0x1b')]([_0xdc46('0xd'),_0xdc46('0x1c'),_0xdc46('0x1d'),_0xdc46('0x1e'),_0xecec4a,_0xdc46('0x1f'),'updatedAt',_0xdc46('0x20'),_0xdc46('0x21'),_0xdc46('0x22')],squel['select']()['fields'](_0x417dc7)['from'](_0x4fc806)[_0xdc46('0xf')]('cm_contacts',null,_0xdc46('0x23')+_0x4fc806+'.CmListId')[_0xdc46('0xf')](_0xde43fe,null,_0xde43fe+'.id\x20=\x20'+_0x4fc806+'.'+_0xecec4a)[_0xdc46('0x10')](_0x4fc806+_0xdc46('0x24'),_0x1a1b3e)[_0xdc46('0x10')](_0xdc46('0x25'),NOW)[_0xdc46('0x10')](_0xdc46('0x26'),selectNotIn(_0x4fc806,_0xde43fe,_0xecec4a,_0xdc46('0x1a'),[_0xdc46('0x27'),_0xdc46('0x28')]))[_0xdc46('0x10')](_0xdc46('0x26'),selectNotIn(_0x4fc806,_0xde43fe,_0xecec4a,'cm_hopper',[_0xdc46('0x27')])))[_0xdc46('0x29')]();}function insertCmHopperBlack(_0x3877e9,_0xc03d30,_0x45f0c8,_0xf3c367){var _0x361269=[_0xdc46('0x13'),_0xdc46('0x15'),_0xdc46('0x16'),_0xc03d30+'.'+_0xf3c367,_0xdc46('0x17'),'cm_contacts.updatedAt'];return squel[_0xdc46('0x2a')]()[_0xdc46('0x2b')]('cm_hopper_black')[_0xdc46('0x1b')]([_0xdc46('0xd'),_0xdc46('0x1d'),'ListId',_0xf3c367,_0xdc46('0x1f'),_0xdc46('0x2c')],squel[_0xdc46('0xc')]()[_0xdc46('0x2d')](_0x361269)[_0xdc46('0xe')](_0xc03d30)[_0xdc46('0xf')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xc03d30+_0xdc46('0x2e'))[_0xdc46('0xf')](_0x45f0c8,null,_0x45f0c8+_0xdc46('0x2f')+_0xc03d30+'.'+_0xf3c367)[_0xdc46('0x10')](_0xc03d30+_0xdc46('0x24'),_0x3877e9)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdc46('0x10')](_0xdc46('0x26'),squel[_0xdc46('0xc')]()[_0xdc46('0x30')](_0xdc46('0xd'))[_0xdc46('0xe')](_0xdc46('0x31'))[_0xdc46('0x10')](_0xdc46('0x32'),_0x3877e9)['where'](_0xf3c367+_0xdc46('0x33'),_0xc03d30+'.'+_0xf3c367)))['toString']();}function insertCmContact(_0x1e51a5,_0x5db043,_0x3e0e5c,_0x4a36b8){var _0x4bbd87=_['concat'](_[_0xdc46('0x34')](_0x4a36b8),['ListId',_0xdc46('0x35'),'createdAt','updatedAt']);return squel['insert']()[_0xdc46('0x2b')](_0xdc46('0x36'))[_0xdc46('0x1b')](_0x4bbd87,squel[_0xdc46('0xc')]()[_0xdc46('0x2d')](_0x4bbd87)[_0xdc46('0xe')](_0x5db043)[_0xdc46('0x10')]('('+_0x3e0e5c['join'](',')+_0xdc46('0x37'),squel[_0xdc46('0xc')]()[_0xdc46('0x2d')](_0x3e0e5c)[_0xdc46('0xe')](_0xdc46('0x36'))[_0xdc46('0x10')]('ListId\x20=\x20?',_0x1e51a5))[_0xdc46('0x10')](_0xdc46('0x38'),squel[_0xdc46('0xc')]()[_0xdc46('0x30')](_0xdc46('0x39'),_0xdc46('0x3a'))['from'](_0x5db043)[_0xdc46('0x3b')](_0x3e0e5c[_0xdc46('0xf')](','))))[_0xdc46('0x29')]();}function handleStop(){logger['info'](_0xdc46('0x3c'));stopped=!![];}function handleUncaughtException(_0x771d15){logger['error'](_0x771d15[_0xdc46('0x3d')]);process['exit'](0x1);}function handleError(_0x437dbf,_0x2da2fd){stats[_0xdc46('0x3e')][_0xdc46('0x3f')]({'name':_0x2da2fd['code'],'message':_0x2da2fd['message'],'row':_0x437dbf});}function handleQuery(_0x5db248){logger[_0xdc46('0x40')](_0x5db248);return db['sequelize']['query'](_0x5db248)[_0xdc46('0x41')](function(_0x220781){results['push'](_0x220781);})[_0xdc46('0x42')](function(_0xe7c9bf){logger[_0xdc46('0x43')](_0xe7c9bf[_0xdc46('0x3d')]);});}function main(_0x3c43a8,_0x24e94f,_0x380316,_0x2b7619){logger[_0xdc46('0x40')]('main',_0x3c43a8,JSON['stringify'](_0x24e94f));process[_0xdc46('0x44')](_0xdc46('0x45'));var _0x2c0b50=_0x24e94f[_0xdc46('0x46')];var _0x286b06=_0x24e94f['socket_timestamp'];var _0x6efd44=path['join'](config[_0xdc46('0x47')],'server/files/tmp',_0x286b06+_0xdc46('0x48'));var _0x53aabe=_[_0xdc46('0x34')](_0x2c0b50)[_0xdc46('0xf')]();logger[_0xdc46('0x40')](_0xdc46('0x49'),_0x53aabe);fs[_0xdc46('0x4a')](_0x6efd44,_0x53aabe+'\x0a');Papa[_0xdc46('0x4b')](fs['createReadStream'](_0x3c43a8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x134fe5,_0x3b3842){try{for(var _0x3d2399=0x0,_0x5d2182=[];_0x3d2399<_0x134fe5[_0xdc46('0x4c')][_0xdc46('0x4d')];_0x3d2399++){stats[_0xdc46('0x4e')]+=0x1;if(_0x134fe5[_0xdc46('0x3e')][_0x3d2399]){handleError(_0x134fe5[_0xdc46('0x4c')][_0x3d2399],_0x134fe5[_0xdc46('0x3e')][_0x3d2399]);}else{var _0x4a3a89=[];for(var _0x15abf7 in _0x2c0b50){if(_0x2c0b50[_0xdc46('0x4f')](_0x15abf7)){if(_0x134fe5[_0xdc46('0x4c')][_0x3d2399][_0x2c0b50[_0x15abf7]]){var _0xebc605=_['trim'](_0x134fe5[_0xdc46('0x4c')][_0x3d2399][_0x2c0b50[_0x15abf7]]['replace'](/"/g,'\x27'));switch(_0x15abf7){case _0xdc46('0x1c'):var _0x427582=moment(_0xebc605,_0xdc46('0xa'),!![]);if(_0x427582[_0xdc46('0x50')]()){_0x5d2182[_0xdc46('0x3f')]('\x22'+_0xebc605+'\x22');}else{_0x4a3a89[_0xdc46('0x3f')](_0xdc46('0x51'));}break;case _0xdc46('0x20'):var _0x3ef1ad=parseInt(_0xebc605);_0xebc605=_[_0xdc46('0x52')](_0x3ef1ad)||_0x3ef1ad<0x0||_0x3ef1ad>0x4?_0x2b7619?0x3:0x2:_0x3ef1ad;_0x5d2182[_0xdc46('0x3f')]('\x22'+_0xebc605+'\x22');break;case'UserId':var _0xb0fd1b=parseInt(_0xebc605);if(_['isNumber'](_0xb0fd1b)&&_[_0xdc46('0x53')](_0x380316,_0xb0fd1b)){_0x5d2182['push']('\x22'+_0xb0fd1b+'\x22');}else{_0x4a3a89['push'](_0xdc46('0x54'));}break;case _0xdc46('0x55'):if(isEmail(_0xebc605)){_0x5d2182[_0xdc46('0x3f')]('\x22'+_0xebc605+'\x22');}else{_0x4a3a89['push'](_0xdc46('0x56'));}break;case'dateOfBirth':var _0xe561bb=moment(_0xebc605,_0xdc46('0x57'),!![]);if(_0xe561bb[_0xdc46('0x50')]()){_0x5d2182[_0xdc46('0x3f')]('\x22'+_0xebc605+'\x22');}else{_0x4a3a89['push'](_0xdc46('0x58'));}break;default:_0x5d2182[_0xdc46('0x3f')]('\x22'+_0xebc605+'\x22');}}else{switch(_0x15abf7){case _0xdc46('0x59'):case'phone':_0x4a3a89[_0xdc46('0x3f')](_0x15abf7+_0xdc46('0x5a'));break;default:_0x5d2182[_0xdc46('0x3f')]('\x22\x22');}}}}if(_0x4a3a89[_0xdc46('0x4d')]){handleError(_0x134fe5[_0xdc46('0x4c')][_0x3d2399],{'code':_0xdc46('0x5b'),'message':_0x4a3a89[_0xdc46('0xf')]()});}else{fs['appendFileSync'](_0x6efd44,_0x5d2182[_0xdc46('0xf')]()+'\x0a');}_0x5d2182=[];}if(!(stats[_0xdc46('0x4e')]%0xc8)){socket[_0xdc46('0x5c')](_0xdc46('0x5d')+_0x286b06,stats);stats[_0xdc46('0x3e')]=[];}}if(stopped){logger[_0xdc46('0x40')](_0xdc46('0x5e'));_0x3b3842[_0xdc46('0x5f')]();}}catch(_0x5f463b){handleError(_0x134fe5[_0xdc46('0x4c')][_0x3d2399],{'code':_0xdc46('0x60'),'message':_0x5f463b[_0xdc46('0x3d')]});logger[_0xdc46('0x43')](_0xdc46('0x61'),_0x5f463b[_0xdc46('0x3d')]);}},'complete':function(){try{var _0x44495d=[];var _0x263abf='cm_contacts';if(_0x24e94f[_0xdc46('0x62')]&&_0x24e94f[_0xdc46('0x62')]['length']){_0x263abf=_0xdc46('0x63')+_0x286b06;_0x44495d[_0xdc46('0x3f')](_0xdc46('0x64')+_0x263abf+'\x20LIKE\x20cm_contacts;');}var _0x2e130e=util[_0xdc46('0x9')]('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',_0x6efd44,_0x263abf,_0x53aabe,_0x24e94f['ListId'],_0x24e94f[_0xdc46('0x35')]||null,NOW,NOW);if(_['isNil'](_0x2c0b50[_0xdc46('0x1c')])){_0x2e130e+=_0xdc46('0x65');}_0x44495d[_0xdc46('0x3f')](_0x2e130e);if(_0x24e94f[_0xdc46('0x62')]&&_0x24e94f['duplicates'][_0xdc46('0x4d')]){_0x44495d['push'](insertCmContact(_0x24e94f[_0xdc46('0x1e')],_0x263abf,_0x24e94f[_0xdc46('0x62')],_0x2c0b50));_0x44495d[_0xdc46('0x3f')]('DROP\x20TABLE\x20'+_0x263abf+';');}_0x44495d[_0xdc46('0x3f')](insertCmHopper(_0x24e94f[_0xdc46('0x1e')],_0xdc46('0x66'),_0xdc46('0x67'),'VoiceQueueId',_0x2b7619));_0x44495d['push'](insertCmHopperBlack(_0x24e94f['ListId'],_0xdc46('0x68'),_0xdc46('0x67'),'VoiceQueueId'));_0x44495d[_0xdc46('0x3f')](insertCmHopper(_0x24e94f['ListId'],_0xdc46('0x69'),_0xdc46('0x6a'),_0xdc46('0x6b'),_0x2b7619));_0x44495d[_0xdc46('0x3f')](insertCmHopperBlack(_0x24e94f[_0xdc46('0x1e')],_0xdc46('0x6c'),'campaigns','CampaignId'));BPromise['each'](_0x44495d,handleQuery)[_0xdc46('0x6d')](function(_0x5d1206){stats[_0xdc46('0x6e')]=!![];stats[_0xdc46('0x6f')]=_0x24e94f['duplicates']&&_0x24e94f[_0xdc46('0x62')][_0xdc46('0x4d')]?results[0x2][_0xdc46('0x6f')]:results[0x0][_0xdc46('0x6f')];socket[_0xdc46('0x5c')](_0xdc46('0x5d')+_0x286b06,stats);fs[_0xdc46('0x70')](_0x3c43a8);fs[_0xdc46('0x70')](_0x6efd44);process['exit'](0x0);})['catch'](function(_0x5e1201){logger['error'](_0x5e1201['message']);process[_0xdc46('0x71')](0x1);});}catch(_0x7cb86d){logger[_0xdc46('0x43')]('complete',_0x7cb86d[_0xdc46('0x3d')]);process[_0xdc46('0x71')](0x1);}},'error':function(_0x5b2fae,_0x12d603,_0x2268c3,_0xe36990){throw new Error(_0xe36990);}});}function validate(){if(process['argv']&&process[_0xdc46('0x72')][_0xdc46('0x4d')]<0x4){throw new Error(_0xdc46('0x73'));}var _0x3b306e=path[_0xdc46('0xf')](config[_0xdc46('0x47')],_0xdc46('0x74'),process[_0xdc46('0x72')][0x2]);if(!fs[_0xdc46('0x75')](_0x3b306e)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x163730={};try{_0x163730=JSON[_0xdc46('0x4b')](process['argv'][0x3]);if(!_0x163730['binding']){throw new Error(_0xdc46('0x76'));}if(!_0x163730['binding'][_0xdc46('0xd')]){throw new Error(_0xdc46('0x77'));}if(!_0x163730[_0xdc46('0x46')][_0xdc46('0x59')]){throw new Error('firstName\x20is\x20mandatory');}var _0xe0820d=0x0;if(_0x163730[_0xdc46('0x46')][_0xdc46('0x21')]){_0xe0820d=0x1;}if(!_0x163730[_0xdc46('0x1e')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x571b3d){throw new Error(_0xdc46('0x78'));}var _0x4e9c59=[];try{_0x4e9c59=_[_0xdc46('0x79')](JSON['parse'](process[_0xdc46('0x72')][0x4]),'id');}catch(_0x2e5cad){logger[_0xdc46('0x40')](_0xdc46('0x7a'));}main(_0x3b306e,_0x163730,_0x4e9c59,_0xe0820d);}validate();process['on'](_0xdc46('0x7b'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 11582d6..acb311a 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c00=['***\x20Time\x20Info\x20***','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','Date','Agent\x20Name','Agent\x20Number'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4cce3e,_0x4a1349){_0x4cce3e=_0x4cce3e-0x0;var _0x391e08=_0x9c00[_0x4cce3e];return _0x391e08;};'use strict';exports[_0x09c0('0x0')]=function(_0x170d8b,_0x4dff21){var _0x5e32e7=[{'type':_0x09c0('0x1'),'content':_0x09c0('0x2'),'variableName':null}];switch(_0x170d8b['toLowerCase']()){case _0x09c0('0x3'):switch(_0x4dff21[_0x09c0('0x4')]()){case _0x09c0('0x5'):_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x7'),'content':'','variableName':'queue'});_0x5e32e7['push']({'type':_0x09c0('0x7'),'content':'','variableName':_0x09c0('0x8')});break;case _0x09c0('0x9'):_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x1'),'content':'Outbound\x20Call','variableName':null});_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x7'),'content':'','variableName':_0x09c0('0xa')});break;}}return _0x5e32e7;};exports[_0x09c0('0xb')]=function(_0x27a33c,_0x1e16f4){var _0x1fec4f=[];switch(_0x27a33c[_0x09c0('0x4')]()){case _0x09c0('0x3'):switch(_0x1e16f4[_0x09c0('0x4')]()){case _0x09c0('0x5'):_0x1fec4f=[{'type':_0x09c0('0x1'),'content':_0x09c0('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0xe'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x8')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0xf'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x10')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x11'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x12')},{'type':_0x09c0('0xd'),'content':'','key':'Queue','keyType':'variable','variableName':'queue'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x13'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x14')},{'type':'keyValue','content':'','key':_0x09c0('0x15'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x09c0('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x16'),'keyType':_0x09c0('0x7'),'variableName':'destcalleridname'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x17'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0xa')},{'type':_0x09c0('0x1'),'content':_0x09c0('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x19')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1a'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1b'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x1c')},{'type':'keyValue','content':'','key':_0x09c0('0x1d'),'keyType':_0x09c0('0x7'),'variableName':'holdtime'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1e'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x1f')}];break;case _0x09c0('0x9'):_0x1fec4f=[{'type':_0x09c0('0x1'),'content':_0x09c0('0xc'),'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x20'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0xa')},{'type':'keyValue','content':'','key':_0x09c0('0x21'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x09c0('0xd'),'content':'','key':'UniqueId','keyType':_0x09c0('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x15'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x22')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x23'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0x09c0('0xd'),'content':'','key':'Complete\x20Time','keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x24')},{'type':_0x09c0('0xd'),'content':'','key':'Duration','keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x25')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x26'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x27')}];break;}}return _0x1fec4f;}; \ No newline at end of file +var _0xdd4f=['holdtime','Talk\x20Time','outbound','Called\x20Number','membername','UniqueId','starttime','Answer\x20Time','endtime','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','variable','queue','push','calleridnum','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt'];(function(_0x1c9fc4,_0x1654cb){var _0x5b9763=function(_0x48e36d){while(--_0x48e36d){_0x1c9fc4['push'](_0x1c9fc4['shift']());}};_0x5b9763(++_0x1654cb);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2b1b84,_0xa861da){_0x2b1b84=_0x2b1b84-0x0;var _0x536419=_0xdd4f[_0x2b1b84];return _0x536419;};'use strict';exports[_0xfdd4('0x0')]=function(_0x51d240,_0x5656ab){var _0x55d8f9=[{'type':_0xfdd4('0x1'),'content':_0xfdd4('0x2'),'variableName':null}];switch(_0x51d240['toLowerCase']()){case _0xfdd4('0x3'):switch(_0x5656ab[_0xfdd4('0x4')]()){case _0xfdd4('0x5'):_0x55d8f9['push']({'type':_0xfdd4('0x6'),'content':'','variableName':_0xfdd4('0x7')});_0x55d8f9[_0xfdd4('0x8')]({'type':_0xfdd4('0x6'),'content':'','variableName':_0xfdd4('0x9')});break;case'outbound':_0x55d8f9[_0xfdd4('0x8')]({'type':'string','content':_0xfdd4('0xa'),'variableName':null});_0x55d8f9[_0xfdd4('0x8')]({'type':_0xfdd4('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x55d8f9;};exports[_0xfdd4('0xb')]=function(_0x4b4f1d,_0x27a9f3){var _0x3ce77a=[];switch(_0x4b4f1d[_0xfdd4('0x4')]()){case _0xfdd4('0x3'):switch(_0x27a9f3[_0xfdd4('0x4')]()){case _0xfdd4('0x5'):_0x3ce77a=[{'type':_0xfdd4('0x1'),'content':_0xfdd4('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0xe'),'keyType':_0xfdd4('0x6'),'variableName':'calleridnum'},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0xf'),'keyType':_0xfdd4('0x6'),'variableName':'calleridname'},{'type':_0xfdd4('0xd'),'content':'','key':'Call\x20To','keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x10')},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x11'),'keyType':_0xfdd4('0x6'),'variableName':'queue'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x12')},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x13'),'keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x14')},{'type':_0xfdd4('0x1'),'content':_0xfdd4('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xfdd4('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x16')},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x17'),'keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x18')},{'type':_0xfdd4('0x1'),'content':_0xfdd4('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xfdd4('0x1a'),'keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x14')},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x1b'),'keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x1c')},{'type':_0xfdd4('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x1d')},{'type':_0xfdd4('0xd'),'content':'','key':'Hold\x20Time','keyType':_0xfdd4('0x6'),'variableName':_0xfdd4('0x1e')},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x1f'),'keyType':_0xfdd4('0x6'),'variableName':'talktime'}];break;case _0xfdd4('0x20'):_0x3ce77a=[{'type':_0xfdd4('0x1'),'content':_0xfdd4('0xc'),'variableName':null},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x21'),'keyType':_0xfdd4('0x6'),'keyContent':'','variableName':_0xfdd4('0x18')},{'type':_0xfdd4('0xd'),'content':'','key':'Member\x20Name','keyType':_0xfdd4('0x6'),'keyContent':'','variableName':_0xfdd4('0x22')},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x23'),'keyType':_0xfdd4('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x13'),'keyType':_0xfdd4('0x6'),'keyContent':'','variableName':_0xfdd4('0x24')},{'type':_0xfdd4('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xfdd4('0xd'),'content':'','key':_0xfdd4('0x25'),'keyType':_0xfdd4('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0xfdd4('0xd'),'content':'','key':'Complete\x20Time','keyType':_0xfdd4('0x6'),'keyContent':'','variableName':_0xfdd4('0x26')},{'type':'keyValue','content':'','key':'Duration','keyType':_0xfdd4('0x6'),'keyContent':'','variableName':_0xfdd4('0x27')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0xfdd4('0x6'),'keyContent':'','variableName':_0xfdd4('0x28')}];break;}}return _0x3ce77a;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index eeacd88..0b495c2 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 _0xd6dc=['mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','error','user','query','clone','body','omit','html','phone','mobile','../../mysqldb','../../config/logger'];(function(_0x3958fe,_0x3c6605){var _0x1f27d6=function(_0x2bfb4a){while(--_0x2bfb4a){_0x3958fe['push'](_0x3958fe['shift']());}};_0x1f27d6(++_0x3c6605);}(_0xd6dc,0x178));var _0xcd6d=function(_0x499d27,_0x4b601d){_0x499d27=_0x499d27-0x0;var _0xc88f16=_0xd6dc[_0x499d27];return _0xc88f16;};'use strict';var _=require('lodash');var db=require(_0xcd6d('0x0'))['db'];var loggers={'openchannel':require(_0xcd6d('0x1'))('openchannel-interactions'),'mail':require(_0xcd6d('0x1'))(_0xcd6d('0x2')),'fax':require('../../config/logger')(_0xcd6d('0x3')),'sms':require(_0xcd6d('0x1'))(_0xcd6d('0x4')),'chat':require(_0xcd6d('0x1'))(_0xcd6d('0x5'))};function getInteractionId(_0x5ce925,_0x3ea64f,_0x37e185){if(_0x5ce925&&_0x5ce925[_[_0xcd6d('0x6')](_0x37e185)+_0xcd6d('0x7')]){return _0x5ce925[_['upperFirst'](_0x37e185)+_0xcd6d('0x7')];}else if(_0x5ce925&&_0x5ce925['id']){return _0x5ce925['id'];}else if(_0x3ea64f&&_0x3ea64f['id']){return _0x3ea64f['id'];}else{return'unknown';}}function log(_0x413fec,_0x5d6d66,_0x2b762c,_0x41dfe0,_0x3f5b01,_0x2f0fb0){loggers[_0x3f5b01[_0xcd6d('0x8')]()][_0x413fec](_0xcd6d('0x9'),_0x2f0fb0[_0xcd6d('0xa')](),_0x5d6d66?_0x5d6d66['id']:null,_0x5d6d66?_0x5d6d66[_0xcd6d('0xb')]:null,_0x5d6d66?_0x5d6d66[_0xcd6d('0xc')]:null,getInteractionId(_0x2b762c,_0x41dfe0,_0x3f5b01),_0x2b762c?JSON[_0xcd6d('0xd')](_0x2b762c):_0xcd6d('0xe'));}function updateUser(_0x2e8c37,_0x317c9d,_0x1b4a17,_0x40d1cf,_0x573fe7){db[_['upperFirst'](_0x40d1cf)+_0xcd6d('0xf')][_0xcd6d('0x10')]({'where':{'id':getInteractionId(_0x317c9d,_0x1b4a17,_0x40d1cf)}})[_0xcd6d('0x11')](function(_0x457482){if(_0x457482){return _0x457482['update']({'UserId':_0x2e8c37?_0x2e8c37['id']:null});}})[_0xcd6d('0x11')](function(_0x560fc8){if(_0x560fc8){log('info',_0x2e8c37,_0x317c9d,_0x1b4a17,_0x40d1cf,_0x573fe7);}})['catch'](function(){log(_0xcd6d('0x12'),_0x2e8c37,_0x317c9d,_0x1b4a17,_0x40d1cf,_0x573fe7);});}exports['tracked']=function(_0x11fab9,_0x2e5699){return function(_0x105f2a,_0x3dd81b,_0x40235a){var _0x4c4fb6=_0x105f2a[_0xcd6d('0x13')];var _0x1bcec6={};var _0x3390bc=_0x105f2a[_0xcd6d('0x14')];if(_0x1bcec6){_0x1bcec6=_[_0xcd6d('0x15')](_0x105f2a[_0xcd6d('0x16')]);_0x1bcec6=_[_0xcd6d('0x17')](_0x1bcec6,[_0xcd6d('0x16'),_0xcd6d('0x18'),_0xcd6d('0x19'),'fax',_0xcd6d('0x1a')]);}updateUser(_0x4c4fb6,_0x1bcec6,_0x3390bc,_0x11fab9,_0x2e5699);_0x40235a(null);};}; \ No newline at end of file +var _0x5175=['fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','omit','html','phone'];(function(_0x37269c,_0x40fae8){var _0x19869b=function(_0xb4bc6f){while(--_0xb4bc6f){_0x37269c['push'](_0x37269c['shift']());}};_0x19869b(++_0x40fae8);}(_0x5175,0x17b));var _0x5517=function(_0x553e1f,_0x52741){_0x553e1f=_0x553e1f-0x0;var _0x45728a=_0x5175[_0x553e1f];return _0x45728a;};'use strict';var _=require(_0x5517('0x0'));var db=require(_0x5517('0x1'))['db'];var loggers={'openchannel':require(_0x5517('0x2'))(_0x5517('0x3')),'mail':require(_0x5517('0x2'))(_0x5517('0x4')),'fax':require(_0x5517('0x2'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x5517('0x2'))('chat-interactions')};function getInteractionId(_0x569aff,_0x5ec895,_0x492bfb){if(_0x569aff&&_0x569aff[_[_0x5517('0x5')](_0x492bfb)+_0x5517('0x6')]){return _0x569aff[_[_0x5517('0x5')](_0x492bfb)+_0x5517('0x6')];}else if(_0x569aff&&_0x569aff['id']){return _0x569aff['id'];}else if(_0x5ec895&&_0x5ec895['id']){return _0x5ec895['id'];}else{return _0x5517('0x7');}}function log(_0x418b97,_0x22b32c,_0x398989,_0x40a8e6,_0x3814ad,_0x246529){loggers[_0x3814ad[_0x5517('0x8')]()][_0x418b97]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x246529[_0x5517('0x9')](),_0x22b32c?_0x22b32c['id']:null,_0x22b32c?_0x22b32c[_0x5517('0xa')]:null,_0x22b32c?_0x22b32c['role']:null,getInteractionId(_0x398989,_0x40a8e6,_0x3814ad),_0x398989?JSON['stringify'](_0x398989):_0x5517('0xb'));}function updateUser(_0x59b51f,_0x330f08,_0x54c634,_0x47813e,_0x24a81b){db[_[_0x5517('0x5')](_0x47813e)+_0x5517('0xc')][_0x5517('0xd')]({'where':{'id':getInteractionId(_0x330f08,_0x54c634,_0x47813e)}})[_0x5517('0xe')](function(_0x5b1278){if(_0x5b1278){return _0x5b1278[_0x5517('0xf')]({'UserId':_0x59b51f?_0x59b51f['id']:null});}})[_0x5517('0xe')](function(_0x2f9a35){if(_0x2f9a35){log(_0x5517('0x10'),_0x59b51f,_0x330f08,_0x54c634,_0x47813e,_0x24a81b);}})[_0x5517('0x11')](function(){log(_0x5517('0x12'),_0x59b51f,_0x330f08,_0x54c634,_0x47813e,_0x24a81b);});}exports[_0x5517('0x13')]=function(_0x302cbb,_0x3e5f1a){return function(_0xf025a1,_0x5e45f6,_0x294493){var _0x12248e=_0xf025a1[_0x5517('0x14')];var _0x16eb4e={};var _0x533bb3=_0xf025a1[_0x5517('0x15')];if(_0x16eb4e){_0x16eb4e=_[_0x5517('0x16')](_0xf025a1[_0x5517('0x17')]);_0x16eb4e=_[_0x5517('0x18')](_0x16eb4e,['body',_0x5517('0x19'),_0x5517('0x1a'),_0x5517('0x1b'),_0x5517('0x1c')]);}updateUser(_0x12248e,_0x16eb4e,_0x533bb3,_0x302cbb,_0x3e5f1a);_0x294493(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c56140e..a5fdaee 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 _0x8e28=['License','findOne','then','count','status','format','catch','users','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','utf8','parse','hasOwnProperty','use'];(function(_0x22e513,_0x1160ce){var _0x585e20=function(_0x185159){while(--_0x185159){_0x22e513['push'](_0x22e513['shift']());}};_0x585e20(++_0x1160ce);}(_0x8e28,0x1ab));var _0x88e2=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8e28[_0x2c7618];return _0x5ce3f0;};'use strict';var crypto=require(_0x88e2('0x0'));var util=require(_0x88e2('0x1'));var compose=require(_0x88e2('0x2'));var db=require(_0x88e2('0x3'))['db'];var config=require(_0x88e2('0x4'));function getValueFromLicense(_0x2c4573,_0xe7f7d4){if(_0x2c4573&&_0xe7f7d4){if(_0xe7f7d4[_0x88e2('0x5')]&&_0xe7f7d4[_0x88e2('0x6')]){var _0x18cb9f=_0xe7f7d4['data1'];var _0x4b4446=_0xe7f7d4[_0x88e2('0x6')];var _0x1a09af=_0x18cb9f[_0x88e2('0x7')]('-')[0x4];var _0x263af8=_0x18cb9f[_0x88e2('0x7')]('-')[0x0];var _0x44f798=crypto[_0x88e2('0x8')]('aes-256-ctr',util['format'](_0x88e2('0x9'),_0x1a09af,_0x18cb9f,_0x263af8));var _0x1f0ddc=_0x44f798[_0x88e2('0xa')](_0x4b4446,'base64',_0x88e2('0xb'));_0x1f0ddc+=_0x44f798['final']('utf8');var _0x5e148c=JSON[_0x88e2('0xc')](_0x1f0ddc);return _0x5e148c[_0x88e2('0xd')](_0x2c4573)?_0x5e148c[_0x2c4573]:null;}}return null;}function isLimit(_0x4df76a,_0x1b3e60,_0x2fbad4,_0x300ff8){var _0x51b62c=_0x1b3e60;return compose()[_0x88e2('0xe')](function(_0x5b2ab2,_0x44507a,_0x4b3b75){return db[_0x88e2('0xf')][_0x88e2('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x88e2('0x11')](function(_0x25f2f8){var _0x124080=getValueFromLicense(_0x4df76a,_0x25f2f8);return _0x124080?_0x124080:_0x51b62c;})[_0x88e2('0x11')](function(_0x24ec99){_0x51b62c=_0x24ec99;return _0x2fbad4[_0x88e2('0x12')](_0x300ff8);})[_0x88e2('0x11')](function(_0x48bdc1){if(_0x48bdc1>=_0x51b62c){return _0x44507a[_0x88e2('0x13')](0x193)['json']({'message':util[_0x88e2('0x14')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x4df76a)});}_0x4b3b75();})[_0x88e2('0x15')](function(_0x36891d){_0x4b3b75(_0x36891d);});});}function isUserLimit(){return isLimit(_0x88e2('0x16'),0x1,db[_0x88e2('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x88e2('0x18')}]}});}exports[_0x88e2('0x19')]=isUserLimit; \ No newline at end of file +var _0x1f79=['util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','isUserLimit'];(function(_0x4695ed,_0xa9541d){var _0x1ce2a4=function(_0xd3cdc5){while(--_0xd3cdc5){_0x4695ed['push'](_0x4695ed['shift']());}};_0x1ce2a4(++_0xa9541d);}(_0x1f79,0x1e6));var _0x91f7=function(_0x4afa07,_0x13fb8a){_0x4afa07=_0x4afa07-0x0;var _0x26b3dd=_0x1f79[_0x4afa07];return _0x26b3dd;};'use strict';var crypto=require('crypto');var util=require(_0x91f7('0x0'));var compose=require(_0x91f7('0x1'));var db=require(_0x91f7('0x2'))['db'];var config=require(_0x91f7('0x3'));function getValueFromLicense(_0x6eb799,_0x213596){if(_0x6eb799&&_0x213596){if(_0x213596[_0x91f7('0x4')]&&_0x213596[_0x91f7('0x5')]){var _0x9c86d3=_0x213596['data1'];var _0x350241=_0x213596[_0x91f7('0x5')];var _0x189445=_0x9c86d3[_0x91f7('0x6')]('-')[0x4];var _0x3f1251=_0x9c86d3[_0x91f7('0x6')]('-')[0x0];var _0x5a5e5d=crypto[_0x91f7('0x7')](_0x91f7('0x8'),util[_0x91f7('0x9')](_0x91f7('0xa'),_0x189445,_0x9c86d3,_0x3f1251));var _0x422057=_0x5a5e5d[_0x91f7('0xb')](_0x350241,_0x91f7('0xc'),_0x91f7('0xd'));_0x422057+=_0x5a5e5d['final'](_0x91f7('0xd'));var _0x16e955=JSON[_0x91f7('0xe')](_0x422057);return _0x16e955[_0x91f7('0xf')](_0x6eb799)?_0x16e955[_0x6eb799]:null;}}return null;}function isLimit(_0x426484,_0x3526a0,_0x5c7ca4,_0x1180fa){var _0x8eee35=_0x3526a0;return compose()['use'](function(_0x23d51e,_0x329b67,_0x435559){return db[_0x91f7('0x10')][_0x91f7('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x91f7('0x12')](function(_0x230bf4){var _0x290b61=getValueFromLicense(_0x426484,_0x230bf4);return _0x290b61?_0x290b61:_0x8eee35;})[_0x91f7('0x12')](function(_0x20e32c){_0x8eee35=_0x20e32c;return _0x5c7ca4[_0x91f7('0x13')](_0x1180fa);})['then'](function(_0xc1d0c5){if(_0xc1d0c5>=_0x8eee35){return _0x329b67[_0x91f7('0x14')](0x193)[_0x91f7('0x15')]({'message':util[_0x91f7('0x9')](_0x91f7('0x16'),_0x426484)});}_0x435559();})[_0x91f7('0x17')](function(_0x430ac9){_0x435559(_0x430ac9);});});}function isUserLimit(){return isLimit(_0x91f7('0x18'),0x1,db['User'],{'where':{'$or':[{'role':_0x91f7('0x19')},{'role':'user'}]}});}exports[_0x91f7('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index de75ecd..6edff3a 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 _0x6644=['cast','omit','length','isObject','hasOwnProperty','isNumeric','match','^[0-9]*$','lodash','moment','sequelize','fields','split','isEmpty','forOwn','isArray','parse','limit','offset','sort','map','indexOf','priority','col','unsigned','DESC'];(function(_0x19c878,_0x1e26aa){var _0x3d2af6=function(_0x2fbe40){while(--_0x2fbe40){_0x19c878['push'](_0x19c878['shift']());}};_0x3d2af6(++_0x1e26aa);}(_0x6644,0x1c2));var _0x4664=function(_0x469ff2,_0x2aa58c){_0x469ff2=_0x469ff2-0x0;var _0x33e5e2=_0x6644[_0x469ff2];return _0x33e5e2;};'use strict';var _=require(_0x4664('0x0'));var moment=require(_0x4664('0x1'));var sequelize=require(_0x4664('0x2'));var LIMIT_VALUE=0xfa;exports[_0x4664('0x3')]=function(_0x2c27f3){var _0x60e820=null;if(_0x2c27f3){_0x60e820=_0x2c27f3[_0x4664('0x4')](',');}return _0x60e820;};exports['filters']=function(_0x5c7c5f){var _0x27aa46={};if(!_[_0x4664('0x5')](_0x5c7c5f)){_0x27aa46={};_[_0x4664('0x6')](_0x5c7c5f,function(_0x3e05c2,_0x173e09){try{_0x27aa46[_0x173e09]=_[_0x4664('0x7')](_0x3e05c2)?_0x3e05c2:JSON[_0x4664('0x8')](_0x3e05c2);}catch(_0x5e46f6){_0x27aa46[_0x173e09]=_0x3e05c2[_0x4664('0x4')](',');}});}return _0x27aa46;};exports[_0x4664('0x9')]=function(_0x233c70){_0x233c70=parseInt(_0x233c70,0xa);if(!_0x233c70||_0x233c70<0x0){_0x233c70=LIMIT_VALUE;}return _0x233c70;};exports[_0x4664('0xa')]=function(_0x728850){_0x728850=parseInt(_0x728850,0xa);if(!_0x728850||_0x728850<0x0){_0x728850=0x0;}return _0x728850;};exports[_0x4664('0xb')]=function(_0x1a599b){var _0x465c92,_0x14b342=null;if(_0x1a599b){_0x465c92=_0x1a599b['split'](',');_0x14b342=_[_0x4664('0xc')](_0x465c92,function(_0x5f3d76){if(_0x5f3d76[_0x4664('0xd')]('-')===0x0){return[_0x5f3d76===_0x4664('0xe')?sequelize['cast'](sequelize[_0x4664('0xf')]('priority'),_0x4664('0x10')):_0x5f3d76['substr'](0x1),_0x4664('0x11')];}else{return[_0x5f3d76==='priority'?sequelize[_0x4664('0x12')](sequelize['col'](_0x4664('0xe')),_0x4664('0x10')):_0x5f3d76,'ASC'];}});}return _0x14b342;};exports[_0x4664('0x13')]=function(_0x11047d,_0xfa26f2){if(_['isEmpty'](_0x11047d)){return _0x11047d;}if(_['isArray'](_0x11047d)){for(var _0x44cf0a=0x0;_0x44cf0a<_0x11047d[_0x4664('0x14')];_0x44cf0a+=0x1){_0x11047d[_0x44cf0a]=this['omit'](_0x11047d[_0x44cf0a],_0xfa26f2);}return _0x11047d;}if(!_[_0x4664('0x15')](_0x11047d)){return _0x11047d;}if(_['isString'](_0xfa26f2)){_0xfa26f2=[_0xfa26f2];}if(!_[_0x4664('0x7')](_0xfa26f2)){return _0x11047d;}for(var _0xa0a86e=0x0;_0xa0a86e<_0xfa26f2[_0x4664('0x14')];_0xa0a86e+=0x1){_['unset'](_0x11047d,_0xfa26f2[_0xa0a86e]);}for(var _0x135b14 in _0x11047d){if(_0x11047d[_0x4664('0x16')](_0x135b14)){_0x11047d[_0x135b14]=this[_0x4664('0x13')](_0x11047d[_0x135b14],_0xfa26f2);}}return _0x11047d;};exports[_0x4664('0x17')]=function(_0x356ab7){return _0x356ab7[_0x4664('0x18')](RegExp(_0x4664('0x19')))?!![]:![];};exports['isEmail']=function(_0x2d0dd9){return _0x2d0dd9['match'](/^\S+@\S+$/)?!![]:![];}; \ No newline at end of file +var _0xc35c=['cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','unset','hasOwnProperty','^[0-9]*$','isEmail','match','lodash','moment','sequelize','split','filters','isEmpty','forOwn','isArray','parse','limit','indexOf','priority'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc35c,0x12c));var _0xcc35=function(_0xe8a7ac,_0x45d545){_0xe8a7ac=_0xe8a7ac-0x0;var _0x46294e=_0xc35c[_0xe8a7ac];return _0x46294e;};'use strict';var _=require(_0xcc35('0x0'));var moment=require(_0xcc35('0x1'));var sequelize=require(_0xcc35('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x2d0f92){var _0x5d4a7e=null;if(_0x2d0f92){_0x5d4a7e=_0x2d0f92[_0xcc35('0x3')](',');}return _0x5d4a7e;};exports[_0xcc35('0x4')]=function(_0x214882){var _0x23df18={};if(!_[_0xcc35('0x5')](_0x214882)){_0x23df18={};_[_0xcc35('0x6')](_0x214882,function(_0x4affe8,_0x2325c5){try{_0x23df18[_0x2325c5]=_[_0xcc35('0x7')](_0x4affe8)?_0x4affe8:JSON[_0xcc35('0x8')](_0x4affe8);}catch(_0x22c246){_0x23df18[_0x2325c5]=_0x4affe8[_0xcc35('0x3')](',');}});}return _0x23df18;};exports[_0xcc35('0x9')]=function(_0x305438){_0x305438=parseInt(_0x305438,0xa);if(!_0x305438||_0x305438<0x0){_0x305438=LIMIT_VALUE;}return _0x305438;};exports['offset']=function(_0x16bdd6){_0x16bdd6=parseInt(_0x16bdd6,0xa);if(!_0x16bdd6||_0x16bdd6<0x0){_0x16bdd6=0x0;}return _0x16bdd6;};exports['sort']=function(_0x144913){var _0x2c595e,_0x4501e0=null;if(_0x144913){_0x2c595e=_0x144913['split'](',');_0x4501e0=_['map'](_0x2c595e,function(_0x144a53){if(_0x144a53[_0xcc35('0xa')]('-')===0x0){return[_0x144a53===_0xcc35('0xb')?sequelize[_0xcc35('0xc')](sequelize[_0xcc35('0xd')](_0xcc35('0xb')),_0xcc35('0xe')):_0x144a53[_0xcc35('0xf')](0x1),_0xcc35('0x10')];}else{return[_0x144a53==='priority'?sequelize['cast'](sequelize['col'](_0xcc35('0xb')),_0xcc35('0xe')):_0x144a53,_0xcc35('0x11')];}});}return _0x4501e0;};exports[_0xcc35('0x12')]=function(_0x55be28,_0x51950e){if(_[_0xcc35('0x5')](_0x55be28)){return _0x55be28;}if(_[_0xcc35('0x7')](_0x55be28)){for(var _0x3011b3=0x0;_0x3011b3<_0x55be28[_0xcc35('0x13')];_0x3011b3+=0x1){_0x55be28[_0x3011b3]=this[_0xcc35('0x12')](_0x55be28[_0x3011b3],_0x51950e);}return _0x55be28;}if(!_[_0xcc35('0x14')](_0x55be28)){return _0x55be28;}if(_['isString'](_0x51950e)){_0x51950e=[_0x51950e];}if(!_[_0xcc35('0x7')](_0x51950e)){return _0x55be28;}for(var _0x11d554=0x0;_0x11d554<_0x51950e[_0xcc35('0x13')];_0x11d554+=0x1){_[_0xcc35('0x15')](_0x55be28,_0x51950e[_0x11d554]);}for(var _0x105df8 in _0x55be28){if(_0x55be28[_0xcc35('0x16')](_0x105df8)){_0x55be28[_0x105df8]=this[_0xcc35('0x12')](_0x55be28[_0x105df8],_0x51950e);}}return _0x55be28;};exports['isNumeric']=function(_0x5b9acd){return _0x5b9acd['match'](RegExp(_0xcc35('0x17')))?!![]:![];};exports[_0xcc35('0x18')]=function(_0x229cb0){return _0x229cb0[_0xcc35('0x19')](/^\S+@\S+$/)?!![]:![];}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 501eeab..ac5d562 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9214=['set','join','client','toISOString','use','views','/server/views','html','ejs','renderFile','urlencoded','50mb','json','express','serve-favicon','body-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','get','env','production','appPath','root','public','test'];(function(_0x33a21a,_0x22d1a8){var _0x4c628e=function(_0x59edab){while(--_0x59edab){_0x33a21a['push'](_0x33a21a['shift']());}};_0x4c628e(++_0x22d1a8);}(_0x9214,0x11b));var _0x4921=function(_0x24a60f,_0x5ec8de){_0x24a60f=_0x24a60f-0x0;var _0x2ca7ea=_0x9214[_0x24a60f];return _0x2ca7ea;};'use strict';var express=require(_0x4921('0x0'));var favicon=require(_0x4921('0x1'));var bodyParser=require(_0x4921('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x4921('0x3'));var path=require(_0x4921('0x4'));var passport=require(_0x4921('0x5'));var cors=require(_0x4921('0x6'));var moment=require(_0x4921('0x7'));var config=require(_0x4921('0x8'));var db=require(_0x4921('0x9'))['db'];exports['default']=function(_0x3cc574){var _0x469c55=_0x3cc574[_0x4921('0xa')](_0x4921('0xb'));if(_0x469c55===_0x4921('0xc')){_0x3cc574['set'](_0x4921('0xd'),path['join'](config[_0x4921('0xe')],_0x4921('0xf')));}if(_0x469c55==='development'||_0x469c55===_0x4921('0x10')){_0x3cc574[_0x4921('0x11')](_0x4921('0xd'),path[_0x4921('0x12')](config['root'],_0x4921('0x13')));_0x3cc574['use'](errorHandler());}_0x3cc574[_0x4921('0x11')]('json\x20replacer',function(_0x9f53e5,_0x22bfc3){if(this[_0x9f53e5]instanceof Date){_0x22bfc3=this[_0x9f53e5][_0x4921('0x14')]()['split']('.')[0x0]+'Z';}return _0x22bfc3;});_0x3cc574[_0x4921('0x15')](express['static'](_0x3cc574[_0x4921('0xa')](_0x4921('0xd'))));_0x3cc574['set'](_0x4921('0x16'),config['root']+_0x4921('0x17'));_0x3cc574['engine'](_0x4921('0x18'),require(_0x4921('0x19'))[_0x4921('0x1a')]);_0x3cc574[_0x4921('0x11')]('view\x20engine','html');_0x3cc574[_0x4921('0x15')](bodyParser[_0x4921('0x1b')]({'limit':_0x4921('0x1c'),'extended':!![]}));_0x3cc574[_0x4921('0x15')](bodyParser[_0x4921('0x1d')]({'limit':_0x4921('0x1c')}));_0x3cc574[_0x4921('0x15')](cors());_0x3cc574[_0x4921('0x15')](methodOverride());_0x3cc574['use'](cookieParser());_0x3cc574[_0x4921('0x15')](passport['initialize']());}; \ No newline at end of file +var _0xe0b7=['renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','body-parser','method-override','cookie-parser','path','passport','cors','moment','./environment','default','get','env','join','root','development','test','client','use','set','json\x20replacer','toISOString','split','static','appPath','views','/server/views','engine','html','ejs'];(function(_0x3007b9,_0x42e81a){var _0x4cc890=function(_0x522d91){while(--_0x522d91){_0x3007b9['push'](_0x3007b9['shift']());}};_0x4cc890(++_0x42e81a);}(_0xe0b7,0x11e));var _0x7e0b=function(_0xaa0fef,_0x5b4ab1){_0xaa0fef=_0xaa0fef-0x0;var _0x8ad00e=_0xe0b7[_0xaa0fef];return _0x8ad00e;};'use strict';var express=require(_0x7e0b('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x7e0b('0x1'));var methodOverride=require(_0x7e0b('0x2'));var cookieParser=require(_0x7e0b('0x3'));var errorHandler=require('errorhandler');var path=require(_0x7e0b('0x4'));var passport=require(_0x7e0b('0x5'));var cors=require(_0x7e0b('0x6'));var moment=require(_0x7e0b('0x7'));var config=require(_0x7e0b('0x8'));var db=require('../mysqldb')['db'];exports[_0x7e0b('0x9')]=function(_0x2a29ab){var _0x467233=_0x2a29ab[_0x7e0b('0xa')](_0x7e0b('0xb'));if(_0x467233==='production'){_0x2a29ab['set']('appPath',path[_0x7e0b('0xc')](config[_0x7e0b('0xd')],'public'));}if(_0x467233===_0x7e0b('0xe')||_0x467233===_0x7e0b('0xf')){_0x2a29ab['set']('appPath',path[_0x7e0b('0xc')](config[_0x7e0b('0xd')],_0x7e0b('0x10')));_0x2a29ab[_0x7e0b('0x11')](errorHandler());}_0x2a29ab[_0x7e0b('0x12')](_0x7e0b('0x13'),function(_0x571e84,_0x13cc96){if(this[_0x571e84]instanceof Date){_0x13cc96=this[_0x571e84][_0x7e0b('0x14')]()[_0x7e0b('0x15')]('.')[0x0]+'Z';}return _0x13cc96;});_0x2a29ab[_0x7e0b('0x11')](express[_0x7e0b('0x16')](_0x2a29ab[_0x7e0b('0xa')](_0x7e0b('0x17'))));_0x2a29ab[_0x7e0b('0x12')](_0x7e0b('0x18'),config[_0x7e0b('0xd')]+_0x7e0b('0x19'));_0x2a29ab[_0x7e0b('0x1a')](_0x7e0b('0x1b'),require(_0x7e0b('0x1c'))[_0x7e0b('0x1d')]);_0x2a29ab['set'](_0x7e0b('0x1e'),_0x7e0b('0x1b'));_0x2a29ab[_0x7e0b('0x11')](bodyParser[_0x7e0b('0x1f')]({'limit':_0x7e0b('0x20'),'extended':!![]}));_0x2a29ab[_0x7e0b('0x11')](bodyParser[_0x7e0b('0x21')]({'limit':_0x7e0b('0x20')}));_0x2a29ab[_0x7e0b('0x11')](cors());_0x2a29ab[_0x7e0b('0x11')](methodOverride());_0x2a29ab[_0x7e0b('0x11')](cookieParser());_0x2a29ab['use'](passport[_0x7e0b('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9ec377c..6e1db2f 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 _0x8c32=['map','model','join','createHash','update','hex','platform','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','md5','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','head','address','getFirstInterface'];(function(_0x290181,_0x46db3e){var _0x2dc9dc=function(_0x1f08d6){while(--_0x1f08d6){_0x290181['push'](_0x290181['shift']());}};_0x2dc9dc(++_0x46db3e);}(_0x8c32,0x130));var _0x28c3=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8c32[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x28c3('0x0'));var os=require('os');var crypto=require(_0x28c3('0x1'));var machine=require(_0x28c3('0x2'));var exec=require(_0x28c3('0x3'))[_0x28c3('0x4')];function getInterfaces(){var _0xc522d5=[];var _0x36d4ad=os[_0x28c3('0x5')]();var _0x2f94e0=_[_0x28c3('0x6')](_[_0x28c3('0x7')](_0x36d4ad));for(var _0x1c6a52=0x0;_0x1c6a52<_0x2f94e0['length'];_0x1c6a52++){var _0x2861c9=_0x36d4ad[_0x2f94e0[_0x1c6a52]][_0x28c3('0x8')](function(_0x2ce6c1){return _0x2ce6c1[_0x28c3('0x9')]===_0x28c3('0xa')&&_0x2ce6c1[_0x28c3('0xb')]===![];});_0xc522d5=_0xc522d5['concat'](_0x2861c9);}return _0xc522d5;}function getFirstInterface(){var _0x1f8595=_[_0x28c3('0xc')](getInterfaces());return{'macAddress':_0x1f8595&&_0x1f8595['mac']?_0x1f8595['mac']:'00:00:00:00:00:00','ipAddress':_0x1f8595&&_0x1f8595[_0x28c3('0xd')]?_0x1f8595[_0x28c3('0xd')]:'127.0.0.1'};}exports[_0x28c3('0xe')]=getFirstInterface;function getCPUhash(){var _0x15c306=_[_0x28c3('0x6')](os['cpus']()[_0x28c3('0xf')](function(_0x145986){return _0x145986[_0x28c3('0x10')];}))[_0x28c3('0x11')](':');return crypto[_0x28c3('0x12')]('md5')[_0x28c3('0x13')](_0x15c306)['digest'](_0x28c3('0x14'));}exports['getUuid']=function(){switch(os[_0x28c3('0x15')]()){case'win32':return exec(_0x28c3('0x16'),{'encoding':_0x28c3('0x17')})['replace']('\x0d\x0a','');default:var _0x194c6e=getFirstInterface();var _0x5d3664=getCPUhash();var _0x59f619=_0x5d3664+'|'+os['hostname']()+'|'+_0x194c6e[_0x28c3('0x18')]+'|'+_0x194c6e[_0x28c3('0x19')];var _0x44e3e2=crypto['createHash'](_0x28c3('0x1a'))[_0x28c3('0x13')](_0x59f619)[_0x28c3('0x1b')](_0x28c3('0x14'));return _0x44e3e2[_0x28c3('0x1c')](0x0,0x8)+'-'+_0x44e3e2[_0x28c3('0x1c')](0x8,0xc)+'-'+_0x44e3e2[_0x28c3('0x1c')](0xc,0x10)+'-'+_0x44e3e2[_0x28c3('0x1c')](0x10,0x14)+'-'+_0x44e3e2[_0x28c3('0x1c')](0x14);}}; \ No newline at end of file +var _0xb4c7=['mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x14c4f8,_0x4894ad){_0x14c4f8=_0x14c4f8-0x0;var _0xf0a5fb=_0xb4c7[_0x14c4f8];return _0xf0a5fb;};'use strict';var _=require(_0x7b4c('0x0'));var os=require('os');var crypto=require(_0x7b4c('0x1'));var machine=require(_0x7b4c('0x2'));var exec=require(_0x7b4c('0x3'))[_0x7b4c('0x4')];function getInterfaces(){var _0x4bef48=[];var _0x387199=os[_0x7b4c('0x5')]();var _0x3ebc75=_[_0x7b4c('0x6')](_[_0x7b4c('0x7')](_0x387199));for(var _0x5adec9=0x0;_0x5adec9<_0x3ebc75[_0x7b4c('0x8')];_0x5adec9++){var _0x10e197=_0x387199[_0x3ebc75[_0x5adec9]][_0x7b4c('0x9')](function(_0x4bf85d){return _0x4bf85d[_0x7b4c('0xa')]===_0x7b4c('0xb')&&_0x4bf85d['internal']===![];});_0x4bef48=_0x4bef48[_0x7b4c('0xc')](_0x10e197);}return _0x4bef48;}function getFirstInterface(){var _0x179b2d=_[_0x7b4c('0xd')](getInterfaces());return{'macAddress':_0x179b2d&&_0x179b2d[_0x7b4c('0xe')]?_0x179b2d[_0x7b4c('0xe')]:_0x7b4c('0xf'),'ipAddress':_0x179b2d&&_0x179b2d[_0x7b4c('0x10')]?_0x179b2d[_0x7b4c('0x10')]:_0x7b4c('0x11')};}exports[_0x7b4c('0x12')]=getFirstInterface;function getCPUhash(){var _0x5d5bc3=_['orderBy'](os[_0x7b4c('0x13')]()[_0x7b4c('0x14')](function(_0x38656b){return _0x38656b[_0x7b4c('0x15')];}))[_0x7b4c('0x16')](':');return crypto[_0x7b4c('0x17')](_0x7b4c('0x18'))[_0x7b4c('0x19')](_0x5d5bc3)[_0x7b4c('0x1a')](_0x7b4c('0x1b'));}exports['getUuid']=function(){switch(os[_0x7b4c('0x1c')]()){case _0x7b4c('0x1d'):return exec(_0x7b4c('0x1e'),{'encoding':_0x7b4c('0x1f')})[_0x7b4c('0x20')]('\x0d\x0a','');default:var _0x2471b3=getFirstInterface();var _0x1642e1=getCPUhash();var _0x22c409=_0x1642e1+'|'+os['hostname']()+'|'+_0x2471b3[_0x7b4c('0x21')]+'|'+_0x2471b3[_0x7b4c('0x22')];var _0x15a5a9=crypto[_0x7b4c('0x17')]('md5')[_0x7b4c('0x19')](_0x22c409)[_0x7b4c('0x1a')](_0x7b4c('0x1b'));return _0x15a5a9[_0x7b4c('0x23')](0x0,0x8)+'-'+_0x15a5a9[_0x7b4c('0x23')](0x8,0xc)+'-'+_0x15a5a9[_0x7b4c('0x23')](0xc,0x10)+'-'+_0x15a5a9[_0x7b4c('0x23')](0x10,0x14)+'-'+_0x15a5a9[_0x7b4c('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 5a2f5e7..ad04c50 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 _0xd4a2=['%s/api/servers/%s/check?version=%s&oldtoken=%s','createCipher','aes-256-ctr','secrets','session','base64','createDecipher','utf8','final','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','|reason|','|uuid|','|machineUuid|','|name|','|email|','email','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','then','active','info','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','catch','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','request-promise','pkginfo','../../mysqldb','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd4a2,0x173));var _0x2d4a=function(_0x4c04f6,_0x453ce0){_0x4c04f6=_0x4c04f6-0x0;var _0x3d9de9=_0xd4a2[_0x4c04f6];return _0x3d9de9;};'use strict';var util=require(_0x2d4a('0x0'));var crypto=require('crypto');var moment=require('moment');var rp=require(_0x2d4a('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x2d4a('0x2'))(module,'version');var db=require(_0x2d4a('0x3'))['db'];var config=require('../environment');var hardware=require(_0x2d4a('0x4'));var logger=require(_0x2d4a('0x5'))(_0x2d4a('0x6'));var jira=require(_0x2d4a('0x7'));var HOST=_0x2d4a('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x57058f){return new BPromise(function(_0x45fefb,_0x41b161){var _0x1f237e=util[_0x2d4a('0x9')](_0x2d4a('0xa'),HOST,_0x57058f,module[_0x2d4a('0xb')][_0x2d4a('0xc')]);if(oldToken){_0x1f237e=util[_0x2d4a('0x9')](_0x2d4a('0xd'),HOST,_0x57058f,module[_0x2d4a('0xb')][_0x2d4a('0xc')],oldToken);}var _0xce6af6={'uri':_0x1f237e,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xce6af6)['then'](function(_0x4002de){_0x45fefb(_0x4002de);})['catch'](function(_0xfd67d4){_0x41b161(_0xfd67d4);});});}function encryptDate(_0x42cb63){var _0x45b9fb=crypto[_0x2d4a('0xe')](_0x2d4a('0xf'),config[_0x2d4a('0x10')][_0x2d4a('0x11')]);var _0x2c4569=_0x45b9fb['update'](_0x42cb63,'utf8',_0x2d4a('0x12'));_0x2c4569+=_0x45b9fb['final'](_0x2d4a('0x12'));return _0x2c4569;}function decryptDate(_0x175bda){var _0x11896d=crypto[_0x2d4a('0x13')]('aes-256-ctr',config[_0x2d4a('0x10')]['session']);var _0x2838fa=_0x11896d['update'](_0x175bda,_0x2d4a('0x12'),_0x2d4a('0x14'));_0x2838fa+=_0x11896d[_0x2d4a('0x15')](_0x2d4a('0x14'));return _0x2838fa;}function sendJiraAlert(_0x498956,_0x4fd169,_0x5ac74b){var _0x12afd7=_0x2d4a('0x16');return db[_0x2d4a('0x17')][_0x2d4a('0x18')]({'where':{'role':_0x2d4a('0x19')},'attributes':[_0x2d4a('0x1a'),'email'],'raw':!![]})['then'](function(_0x3eabe5){ADMIN=_0x3eabe5;_0x12afd7+=_0x2d4a('0x1b')+_0x5ac74b+'|\x0a';_0x12afd7+=_0x2d4a('0x1c')+_0x498956+'|\x0a';_0x12afd7+=_0x2d4a('0x1d')+_0x4fd169+'|\x0a';_0x12afd7+=_0x2d4a('0x1e')+ADMIN[_0x2d4a('0x1a')]+'|\x0a';_0x12afd7+=_0x2d4a('0x1f')+ADMIN[_0x2d4a('0x20')]+'|\x0a';return _0x12afd7;})['then'](function(_0x26e7b8){var _0x3240a2=hardware[_0x2d4a('0x21')]()[_0x2d4a('0x22')];return jira[_0x2d4a('0x23')]({'key':_0x2d4a('0x24'),'summary':_0x2d4a('0x25'),'description':_0x26e7b8,'issuetype':_0x2d4a('0x26'),'oldToken':_0x498956,'newToken':_0x4fd169,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x3240a2});});}function manageLicense(_0x5cc7d8,_0x2bb9f0){var _0x5029f3=_0x2bb9f0[_0x2d4a('0x27')]({'plain':!![]});httpRequest(_0x5cc7d8)[_0x2d4a('0x28')](function(_0x3d5558){if(oldToken){oldToken=undefined;}if(_0x3d5558[_0x2d4a('0x29')]){if(!_0x5029f3[_0x2d4a('0x6')]&&_0x5029f3[_0x2d4a('0x6')]!=_0x3d5558[_0x2d4a('0x6')]||_0x5029f3[_0x2d4a('0x6')]&&_0x5029f3['data2']){logger[_0x2d4a('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5029f3[_0x2d4a('0x6')]&&!_0x5029f3[_0x2d4a('0x2b')]&&_0x5029f3[_0x2d4a('0x6')]!=_0x3d5558[_0x2d4a('0x6')]){logger[_0x2d4a('0x2a')](_0x2d4a('0x2c'));}if(_0x5029f3[_0x2d4a('0x6')]&&!_0x5029f3[_0x2d4a('0x2b')]&&_0x5029f3['license']==_0x3d5558[_0x2d4a('0x6')]){return _0x2bb9f0;}return _0x2bb9f0[_0x2d4a('0x2d')]({'data1':_0x5cc7d8,'data2':null,'license':_0x3d5558[_0x2d4a('0x6')]});}else{if(_0x3d5558[_0x2d4a('0x6')]||_0x5029f3[_0x2d4a('0x6')]){if(!_0x5029f3['data2']){if(_0x5029f3[_0x2d4a('0x2e')]==_0x5cc7d8){GRAY_PERIOD_REASON=_0x2d4a('0x2f');logger[_0x2d4a('0x2a')](_0x2d4a('0x30'));}else{GRAY_PERIOD_REASON=_0x2d4a('0x31');oldToken=_0x5029f3['data1'];logger[_0x2d4a('0x2a')](_0x2d4a('0x32'),_0x5029f3[_0x2d4a('0x2e')],_0x5cc7d8);}sendJiraAlert(_0x5029f3[_0x2d4a('0x2e')],_0x3d5558[_0x2d4a('0x33')],GRAY_PERIOD_REASON);logger[_0x2d4a('0x2a')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x2d4a('0x34')](),moment()[_0x2d4a('0x9')](_0x2d4a('0x35')));return _0x2bb9f0[_0x2d4a('0x2d')]({'data2':encryptDate(moment()[_0x2d4a('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x2d4a('0x36')](decryptDate(_0x5029f3[_0x2d4a('0x2b')]),'days')>DAYS){logger[_0x2d4a('0x2a')](_0x2d4a('0x37'),moment()[_0x2d4a('0x9')](_0x2d4a('0x35')));return _0x2bb9f0[_0x2d4a('0x2d')]({'data1':_0x5cc7d8,'data2':null,'license':null});}}}else{if(_0x5029f3[_0x2d4a('0x2e')]!=_0x5cc7d8){logger['info'](_0x2d4a('0x32'),_0x5029f3[_0x2d4a('0x2e')],_0x5cc7d8);return _0x2bb9f0[_0x2d4a('0x2d')]({'data1':_0x5cc7d8,'data2':null,'license':null});}}}return _0x2bb9f0;})[_0x2d4a('0x28')](function(_0x103558){_0x2bb9f0=_0x103558;})[_0x2d4a('0x38')](function(_0x5b49f9){logger['error'](_0x5b49f9[_0x2d4a('0x39')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x2d4a('0x3a')](),_0x2bb9f0);},TIME);});}function defaultLicense(){var _0x309e33=hardware['getUuid']();if(_0x309e33){return db[_0x2d4a('0x3b')][_0x2d4a('0x3c')]({'where':{'id':0x1},'defaults':{'data1':_0x309e33}})[_0x2d4a('0x3d')](function(_0x1035b9,_0x67bce3){logger[_0x2d4a('0x2a')](_0x2d4a('0x3e'),_0x309e33);manageLicense(_0x309e33,_0x1035b9);})[_0x2d4a('0x38')](function(_0x334841){logger[_0x2d4a('0x3f')](_0x334841[_0x2d4a('0x39')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x7da6=['base64','createDecipher','aes-256-ctr','||FIELD||VALUE||\x0a','User','admin','then','|reason|','|uuid|','|email|','email','getFirstInterface','openIssue','MOTLICENSE','Alert','fullname','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','uuid','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','%s/api/servers/%s/check?version=%s','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','createCipher','secrets','session','update','utf8','final'];(function(_0x570d49,_0xb5ad29){var _0x4de528=function(_0x16e8d1){while(--_0x16e8d1){_0x570d49['push'](_0x570d49['shift']());}};_0x4de528(++_0xb5ad29);}(_0x7da6,0x124));var _0x67da=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0x7da6[_0x2e7f96];return _0x315277;};'use strict';var util=require('util');var crypto=require('crypto');var moment=require(_0x67da('0x0'));var rp=require(_0x67da('0x1'));var BPromise=require(_0x67da('0x2'));var pkginfo=require(_0x67da('0x3'))(module,'version');var db=require(_0x67da('0x4'))['db'];var config=require(_0x67da('0x5'));var hardware=require(_0x67da('0x6'));var logger=require(_0x67da('0x7'))(_0x67da('0x8'));var jira=require(_0x67da('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xb7f52){return new BPromise(function(_0x49025f,_0x4cfe49){var _0x3d971d=util['format'](_0x67da('0xa'),HOST,_0xb7f52,module['exports'][_0x67da('0xb')]);if(oldToken){_0x3d971d=util[_0x67da('0xc')](_0x67da('0xd'),HOST,_0xb7f52,module[_0x67da('0xe')][_0x67da('0xb')],oldToken);}var _0x26198c={'uri':_0x3d971d,'method':_0x67da('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x26198c)['then'](function(_0x5bfa4f){_0x49025f(_0x5bfa4f);})[_0x67da('0x10')](function(_0x329a9c){_0x4cfe49(_0x329a9c);});});}function encryptDate(_0x3e2305){var _0x2450aa=crypto[_0x67da('0x11')]('aes-256-ctr',config[_0x67da('0x12')][_0x67da('0x13')]);var _0x3929fb=_0x2450aa[_0x67da('0x14')](_0x3e2305,_0x67da('0x15'),'base64');_0x3929fb+=_0x2450aa[_0x67da('0x16')](_0x67da('0x17'));return _0x3929fb;}function decryptDate(_0x5e0802){var _0x11e151=crypto[_0x67da('0x18')](_0x67da('0x19'),config[_0x67da('0x12')][_0x67da('0x13')]);var _0xb3a67=_0x11e151[_0x67da('0x14')](_0x5e0802,_0x67da('0x17'),'utf8');_0xb3a67+=_0x11e151[_0x67da('0x16')]('utf8');return _0xb3a67;}function sendJiraAlert(_0x31454f,_0x5765d5,_0x263517){var _0xa53a90=_0x67da('0x1a');return db[_0x67da('0x1b')]['findOne']({'where':{'role':_0x67da('0x1c')},'attributes':['fullname','email'],'raw':!![]})[_0x67da('0x1d')](function(_0x31c6c5){ADMIN=_0x31c6c5;_0xa53a90+=_0x67da('0x1e')+_0x263517+'|\x0a';_0xa53a90+=_0x67da('0x1f')+_0x31454f+'|\x0a';_0xa53a90+='|machineUuid|'+_0x5765d5+'|\x0a';_0xa53a90+='|name|'+ADMIN['fullname']+'|\x0a';_0xa53a90+=_0x67da('0x20')+ADMIN[_0x67da('0x21')]+'|\x0a';return _0xa53a90;})[_0x67da('0x1d')](function(_0xd32481){var _0x2460c3=hardware[_0x67da('0x22')]()['ipAddress'];return jira[_0x67da('0x23')]({'key':_0x67da('0x24'),'summary':'Motion\x20License\x20Alert','description':_0xd32481,'issuetype':_0x67da('0x25'),'oldToken':_0x31454f,'newToken':_0x5765d5,'email':ADMIN['email'],'name':ADMIN[_0x67da('0x26')],'reason':GRAY_PERIOD_REASON,'ip':_0x2460c3});});}function manageLicense(_0x15207c,_0x29a0ce){var _0x17e76f=_0x29a0ce[_0x67da('0x27')]({'plain':!![]});httpRequest(_0x15207c)[_0x67da('0x1d')](function(_0x4c4bfe){if(oldToken){oldToken=undefined;}if(_0x4c4bfe[_0x67da('0x28')]){if(!_0x17e76f[_0x67da('0x8')]&&_0x17e76f['license']!=_0x4c4bfe['license']||_0x17e76f[_0x67da('0x8')]&&_0x17e76f[_0x67da('0x29')]){logger[_0x67da('0x2a')](_0x67da('0x2b'));}if(_0x17e76f['license']&&!_0x17e76f[_0x67da('0x29')]&&_0x17e76f[_0x67da('0x8')]!=_0x4c4bfe[_0x67da('0x8')]){logger[_0x67da('0x2a')](_0x67da('0x2c'));}if(_0x17e76f[_0x67da('0x8')]&&!_0x17e76f[_0x67da('0x29')]&&_0x17e76f[_0x67da('0x8')]==_0x4c4bfe[_0x67da('0x8')]){return _0x29a0ce;}return _0x29a0ce[_0x67da('0x14')]({'data1':_0x15207c,'data2':null,'license':_0x4c4bfe[_0x67da('0x8')]});}else{if(_0x4c4bfe[_0x67da('0x8')]||_0x17e76f[_0x67da('0x8')]){if(!_0x17e76f[_0x67da('0x29')]){if(_0x17e76f['data1']==_0x15207c){GRAY_PERIOD_REASON=_0x67da('0x2d');logger[_0x67da('0x2a')](_0x67da('0x2e'));}else{GRAY_PERIOD_REASON=_0x67da('0x2f');oldToken=_0x17e76f[_0x67da('0x30')];logger[_0x67da('0x2a')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x17e76f[_0x67da('0x30')],_0x15207c);}sendJiraAlert(_0x17e76f[_0x67da('0x30')],_0x4c4bfe[_0x67da('0x31')],GRAY_PERIOD_REASON);logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x67da('0x32')));return _0x29a0ce['update']({'data2':encryptDate(moment()[_0x67da('0xc')](_0x67da('0x32')))});}else{if(moment()[_0x67da('0x33')](decryptDate(_0x17e76f[_0x67da('0x29')]),_0x67da('0x34'))>DAYS){logger[_0x67da('0x2a')](_0x67da('0x35'),moment()[_0x67da('0xc')](_0x67da('0x32')));return _0x29a0ce[_0x67da('0x14')]({'data1':_0x15207c,'data2':null,'license':null});}}}else{if(_0x17e76f[_0x67da('0x30')]!=_0x15207c){logger[_0x67da('0x2a')](_0x67da('0x36'),_0x17e76f[_0x67da('0x30')],_0x15207c);return _0x29a0ce[_0x67da('0x14')]({'data1':_0x15207c,'data2':null,'license':null});}}}return _0x29a0ce;})[_0x67da('0x1d')](function(_0x2ee9fe){_0x29a0ce=_0x2ee9fe;})[_0x67da('0x10')](function(_0x380bc1){logger[_0x67da('0x37')](_0x380bc1[_0x67da('0x38')]);})[_0x67da('0x39')](function(){setTimeout(function(){manageLicense(hardware[_0x67da('0x3a')](),_0x29a0ce);},TIME);});}function defaultLicense(){var _0x2985f6=hardware[_0x67da('0x3a')]();if(_0x2985f6){return db[_0x67da('0x3b')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2985f6}})[_0x67da('0x3c')](function(_0x273173,_0x5e6bdc){logger[_0x67da('0x2a')](_0x67da('0x3d'),_0x2985f6);manageLicense(_0x2985f6,_0x273173);})['catch'](function(_0x4dcc69){logger['error'](_0x4dcc69[_0x67da('0x38')]);});}}exports[_0x67da('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index cf91a40..b4e6116 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 _0xd9ee=['demo','uuid','machineUuid','getUuid','secrets','session','base64','gray','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','Demo\x20license','data1','getLicense','License','find','defaults','then','checkLicense','util','lodash','moment','./hardware','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse'];(function(_0x950c4a,_0xc961f3){var _0x8e37ac=function(_0x1ff892){while(--_0x1ff892){_0x950c4a['push'](_0x950c4a['shift']());}};_0x8e37ac(++_0xc961f3);}(_0xd9ee,0x108));var _0xed9e=function(_0x374220,_0x31e4b4){_0x374220=_0x374220-0x0;var _0x3d9ec6=_0xd9ee[_0x374220];return _0x3d9ec6;};'use strict';var crypto=require('crypto');var util=require(_0xed9e('0x0'));var _=require(_0xed9e('0x1'));var moment=require(_0xed9e('0x2'));var hardware=require(_0xed9e('0x3'));var config=require('../environment');var db=require('../../mysqldb')['db'];function checkLicense(_0x5d5a24,_0x5b444a){if(_0x5d5a24){try{var _0x2d2289=_0x5b444a||_0x5d5a24['license'];if(_[_0xed9e('0x4')](_0x2d2289)){throw new Error(_0xed9e('0x5'));}var _0x392372=_0x5d5a24['data1'];var _0x3f143a=_0x5d5a24[_0xed9e('0x6')];var _0xa1c09c=_0x392372[_0xed9e('0x7')]('-')[0x4];var _0x20ebd4=_0x392372['split']('-')[0x0];var _0x24d2ea=crypto[_0xed9e('0x8')](_0xed9e('0x9'),util[_0xed9e('0xa')](_0xed9e('0xb'),_0xa1c09c,_0x392372,_0x20ebd4));var _0x58daf9=_0x24d2ea[_0xed9e('0xc')](_0x2d2289,'base64',_0xed9e('0xd'));_0x58daf9+=_0x24d2ea[_0xed9e('0xe')](_0xed9e('0xd'));var _0x3ee854=JSON[_0xed9e('0xf')](_0x58daf9);_0x3ee854[_0xed9e('0x10')]=![];_0x3ee854[_0xed9e('0x11')]=_0x392372;_0x3ee854[_0xed9e('0x12')]=hardware[_0xed9e('0x13')]();if(_0x3f143a){var _0x24b634=crypto[_0xed9e('0x8')](_0xed9e('0x9'),config[_0xed9e('0x14')][_0xed9e('0x15')]);var _0x1513d0=_0x24b634[_0xed9e('0xc')](_0x3f143a,_0xed9e('0x16'),_0xed9e('0xd'));_0x1513d0+=_0x24b634[_0xed9e('0xe')](_0xed9e('0xd'));_0x3ee854[_0xed9e('0x17')]=_0x1513d0;_0x3ee854[_0xed9e('0x18')]=moment(_0x1513d0)[_0xed9e('0x19')](0x7,_0xed9e('0x1a'))[_0xed9e('0xa')]();_0x3ee854[_0xed9e('0x1b')]=_0x3ee854[_0xed9e('0x11')]!=_0x3ee854[_0xed9e('0x12')]?_0xed9e('0x1c'):_0xed9e('0x1d');}return _0x3ee854;}catch(_0x14faef){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xed9e('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xed9e('0x1f'),'uuid':_0x5d5a24['data1'],'machineUuid':hardware['getUuid'](),'message':_0x14faef['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xed9e('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xed9e('0x20'),'uuid':_0x5d5a24[_0xed9e('0x21')],'machineUuid':hardware[_0xed9e('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0xed9e('0x22')]=function(_0x4a9d5c){return db[_0xed9e('0x23')][_0xed9e('0x24')](_[_0xed9e('0x25')](_0x4a9d5c,{'raw':!![],'where':{'id':0x1}}))[_0xed9e('0x26')](function(_0x2621ae){return checkLicense(_0x2621ae,null);});};exports[_0xed9e('0x27')]=checkLicense; \ No newline at end of file +var _0xb35f=['base64','utf8','final','parse','demo','uuid','machineUuid','secrets','gray','add','days','format','grayReason','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','message','Demo\x20license','getLicense','find','defaults','then','checkLicense','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','%s:%s:%s','update'];(function(_0x28c165,_0x2f5ef4){var _0x174ddf=function(_0x5a0a49){while(--_0x5a0a49){_0x28c165['push'](_0x28c165['shift']());}};_0x174ddf(++_0x2f5ef4);}(_0xb35f,0x1db));var _0xfb35=function(_0x35a752,_0x4cc5cc){_0x35a752=_0x35a752-0x0;var _0x90dd99=_0xb35f[_0x35a752];return _0x90dd99;};'use strict';var crypto=require(_0xfb35('0x0'));var util=require(_0xfb35('0x1'));var _=require(_0xfb35('0x2'));var moment=require(_0xfb35('0x3'));var hardware=require(_0xfb35('0x4'));var config=require(_0xfb35('0x5'));var db=require(_0xfb35('0x6'))['db'];function checkLicense(_0x208ec5,_0x2e8c51){if(_0x208ec5){try{var _0x5b243d=_0x2e8c51||_0x208ec5[_0xfb35('0x7')];if(_[_0xfb35('0x8')](_0x5b243d)){throw new Error(_0xfb35('0x9'));}var _0x50af63=_0x208ec5[_0xfb35('0xa')];var _0x4890f5=_0x208ec5[_0xfb35('0xb')];var _0x3b950d=_0x50af63[_0xfb35('0xc')]('-')[0x4];var _0x346464=_0x50af63[_0xfb35('0xc')]('-')[0x0];var _0x2e5fb9=crypto[_0xfb35('0xd')](_0xfb35('0xe'),util['format'](_0xfb35('0xf'),_0x3b950d,_0x50af63,_0x346464));var _0x1e60c0=_0x2e5fb9[_0xfb35('0x10')](_0x5b243d,_0xfb35('0x11'),_0xfb35('0x12'));_0x1e60c0+=_0x2e5fb9[_0xfb35('0x13')](_0xfb35('0x12'));var _0x392b84=JSON[_0xfb35('0x14')](_0x1e60c0);_0x392b84[_0xfb35('0x15')]=![];_0x392b84[_0xfb35('0x16')]=_0x50af63;_0x392b84[_0xfb35('0x17')]=hardware['getUuid']();if(_0x4890f5){var _0x327c57=crypto[_0xfb35('0xd')](_0xfb35('0xe'),config[_0xfb35('0x18')]['session']);var _0x21c0d9=_0x327c57['update'](_0x4890f5,_0xfb35('0x11'),_0xfb35('0x12'));_0x21c0d9+=_0x327c57[_0xfb35('0x13')](_0xfb35('0x12'));_0x392b84[_0xfb35('0x19')]=_0x21c0d9;_0x392b84['deadline']=moment(_0x21c0d9)[_0xfb35('0x1a')](0x7,_0xfb35('0x1b'))[_0xfb35('0x1c')]();_0x392b84[_0xfb35('0x1d')]=_0x392b84[_0xfb35('0x16')]!=_0x392b84[_0xfb35('0x17')]?'changed':_0xfb35('0x1e');}return _0x392b84;}catch(_0x18a7a3){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfb35('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xfb35('0x20'),'uuid':_0x208ec5[_0xfb35('0xa')],'machineUuid':hardware[_0xfb35('0x21')](),'message':_0x18a7a3[_0xfb35('0x22')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xfb35('0x23'),'uuid':_0x208ec5[_0xfb35('0xa')],'machineUuid':hardware[_0xfb35('0x21')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0xfb35('0x24')]=function(_0x367a69){return db['License'][_0xfb35('0x25')](_[_0xfb35('0x26')](_0x367a69,{'raw':!![],'where':{'id':0x1}}))[_0xfb35('0x27')](function(_0x354430){return checkLicense(_0x354430,null);});};exports[_0xfb35('0x28')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index e6059de..da5a420 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 _0x0f46=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x4975f4,_0x371f7f){var _0x719c02=function(_0x55cdc7){while(--_0x55cdc7){_0x4975f4['push'](_0x4975f4['shift']());}};_0x719c02(++_0x371f7f);}(_0x0f46,0x1a1));var _0x60f4=function(_0x3d86d1,_0xd1c64c){_0x3d86d1=_0x3d86d1-0x0;var _0x4fb978=_0x0f46[_0x3d86d1];return _0x4fb978;};'use strict';module[_0x60f4('0x0')]={'DOMAIN':_0x60f4('0x1'),'SESSION_SECRET':_0x60f4('0x2'),'GOOGLE_ID':_0x60f4('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xc4e1=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x5bd60b,_0x13465a){var _0x2dcff0=function(_0x31079c){while(--_0x31079c){_0x5bd60b['push'](_0x5bd60b['shift']());}};_0x2dcff0(++_0x13465a);}(_0xc4e1,0x172));var _0x1c4e=function(_0x32c0c5,_0x1120b2){_0x32c0c5=_0x32c0c5-0x0;var _0x2cc278=_0xc4e1[_0x32c0c5];return _0x2cc278;};'use strict';module[_0x1c4e('0x0')]={'DOMAIN':_0x1c4e('0x1'),'SESSION_SECRET':_0x1c4e('0x2'),'GOOGLE_ID':_0x1c4e('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ffd8e4b..0f50aa5 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb447=['util','INFO','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','%s-%s','error','File','info','transports','Console','env','debugLevel','moment'];(function(_0x5db059,_0x4358b7){var _0x2136f3=function(_0x4926a8){while(--_0x4926a8){_0x5db059['push'](_0x5db059['shift']());}};_0x2136f3(++_0x4358b7);}(_0xb447,0x149));var _0x7b44=function(_0x370a34,_0x22dfc5){_0x370a34=_0x370a34-0x0;var _0xc8dc30=_0xb447[_0x370a34];return _0xc8dc30;};'use strict';var moment=require(_0x7b44('0x0'));var winston=require('winston');var util=require(_0x7b44('0x1'));var path=require('path');var debugLevel=_0x7b44('0x2');function filename(_0x3de989,_0x2d67dd){return path['join'](_0x7b44('0x3'),_0x7b44('0x4'),_0x7b44('0x5'),util[_0x7b44('0x6')](_0x7b44('0x7'),_0x3de989,_0x2d67dd));}function formatter(_0x4e4608,_0x5d5b76){return util[_0x7b44('0x6')](_0x7b44('0x8'),moment()[_0x7b44('0x6')](_0x7b44('0x9')),_0x5d5b76[_0x7b44('0xa')][_0x7b44('0xb')](),_0x4e4608,_0x5d5b76[_0x7b44('0xc')]);}module[_0x7b44('0xd')]=function(_0x249cc3){return new winston['Logger']({'transports':[new winston['transports']['File']({'name':util[_0x7b44('0x6')](_0x7b44('0xe'),_0x249cc3,_0x7b44('0xf')),'filename':filename(_0x249cc3,_0x7b44('0xf')),'level':_0x7b44('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x140cc7){return formatter(_0x249cc3,_0x140cc7);}}),new winston['transports'][(_0x7b44('0x10'))]({'name':util[_0x7b44('0x6')](_0x7b44('0xe'),_0x249cc3,'info'),'filename':filename(_0x249cc3,_0x7b44('0x11')),'level':_0x7b44('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x23eca3){return formatter(_0x249cc3,_0x23eca3);}}),new winston[(_0x7b44('0x12'))][(_0x7b44('0x13'))]({'level':process[_0x7b44('0x14')][_0x7b44('0x15')]||debugLevel,'json':![],'formatter':function(_0x4bf163){return formatter(_0x249cc3,_0x4bf163);}})]});}; \ No newline at end of file +var _0x423a=['YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','%s-%s','error','transports','File','info','env','debugLevel','moment','winston','path','INFO','join','/var','log','xcally','format'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x423a,0x1db));var _0xa423=function(_0x384f59,_0x5e1dcc){_0x384f59=_0x384f59-0x0;var _0x564a85=_0x423a[_0x384f59];return _0x564a85;};'use strict';var moment=require(_0xa423('0x0'));var winston=require(_0xa423('0x1'));var util=require('util');var path=require(_0xa423('0x2'));var debugLevel=_0xa423('0x3');function filename(_0x5b8c39,_0x324dc1){return path[_0xa423('0x4')](_0xa423('0x5'),_0xa423('0x6'),_0xa423('0x7'),util[_0xa423('0x8')]('%s-%s.log',_0x5b8c39,_0x324dc1));}function formatter(_0x5a0b5b,_0x410a98){return util[_0xa423('0x8')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xa423('0x8')](_0xa423('0x9')),_0x410a98[_0xa423('0xa')][_0xa423('0xb')](),_0x5a0b5b,_0x410a98[_0xa423('0xc')]);}module[_0xa423('0xd')]=function(_0x1dd272){return new winston[(_0xa423('0xe'))]({'transports':[new winston['transports']['File']({'name':util[_0xa423('0x8')](_0xa423('0xf'),_0x1dd272,_0xa423('0x10')),'filename':filename(_0x1dd272,_0xa423('0x10')),'level':_0xa423('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5098b5){return formatter(_0x1dd272,_0x5098b5);}}),new winston[(_0xa423('0x11'))][(_0xa423('0x12'))]({'name':util[_0xa423('0x8')](_0xa423('0xf'),_0x1dd272,'info'),'filename':filename(_0x1dd272,'info'),'level':_0xa423('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x403b83){return formatter(_0x1dd272,_0x403b83);}}),new winston['transports']['Console']({'level':process[_0xa423('0x14')][_0xa423('0x15')]||debugLevel,'json':![],'formatter':function(_0x239e0b){return formatter(_0x1dd272,_0x239e0b);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d115e22..fee3d8b 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 _0xe41f=['email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','agi','../../services/agi/index.js'];(function(_0x225fb4,_0x2a94cb){var _0x402023=function(_0x2960f3){while(--_0x2960f3){_0x225fb4['push'](_0x225fb4['shift']());}};_0x402023(++_0x2a94cb);}(_0xe41f,0x13e));var _0xfe41=function(_0x320b23,_0x5da626){_0x320b23=_0x320b23-0x0;var _0x22fa8f=_0xe41f[_0x320b23];return _0x22fa8f;};'use strict';var path=require(_0xfe41('0x0'));var os=require('os');var config={'apps':[{'name':_0xfe41('0x1'),'script':path[_0xfe41('0x2')](__dirname,_0xfe41('0x3'))},{'name':'ami','script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0xfe41('0x4'),'script':path[_0xfe41('0x2')](__dirname,_0xfe41('0x5'))},{'name':_0xfe41('0x6'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0xfe41('0x7'),'script':path['join'](__dirname,_0xfe41('0x8'))},{'name':_0xfe41('0x9'),'script':path[_0xfe41('0x2')](__dirname,_0xfe41('0xa'))}]};module[_0xfe41('0xb')]=config; \ No newline at end of file +var _0x4d04=['exports','express','join','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x16b065,_0x516936){var _0x9cfcbe=function(_0x2ce836){while(--_0x2ce836){_0x16b065['push'](_0x16b065['shift']());}};_0x9cfcbe(++_0x516936);}(_0x4d04,0xf3));var _0x44d0=function(_0x25540e,_0x54da6e){_0x25540e=_0x25540e-0x0;var _0x4fd671=_0x4d04[_0x25540e];return _0x4fd671;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x44d0('0x0'),'script':path[_0x44d0('0x1')](__dirname,_0x44d0('0x2'))},{'name':'ami','script':path[_0x44d0('0x1')](__dirname,_0x44d0('0x3'))},{'name':'agi','script':path[_0x44d0('0x1')](__dirname,_0x44d0('0x4'))},{'name':_0x44d0('0x5'),'script':path[_0x44d0('0x1')](__dirname,_0x44d0('0x6'))},{'name':_0x44d0('0x7'),'script':path[_0x44d0('0x1')](__dirname,_0x44d0('0x8'))},{'name':_0x44d0('0x9'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0x44d0('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b58ebdb..bbf88b3 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 _0x2cd0=['stop','restart','list','describe','dump','saved','pm2','bluebird','connected','start','then','disconnect'];(function(_0x5c35a1,_0x42f364){var _0x1b0f22=function(_0x35ae1b){while(--_0x35ae1b){_0x5c35a1['push'](_0x5c35a1['shift']());}};_0x1b0f22(++_0x42f364);}(_0x2cd0,0x8a));var _0x02cd=function(_0x31688a,_0x588c7d){_0x31688a=_0x31688a-0x0;var _0xc7b088=_0x2cd0[_0x31688a];return _0xc7b088;};'use strict';var pm2=require(_0x02cd('0x0'));var BPromise=require(_0x02cd('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5184c5,_0x22baca){return pm2['connect'](function(_0x55565b){if(_0x55565b){return _0x22baca(_0x55565b);}return _0x5184c5(_0x02cd('0x2'));});});};exports[_0x02cd('0x3')]=function(_0x3fba37){return connect()[_0x02cd('0x4')](function(){return new BPromise(function(_0x1519b1,_0x35144b){return pm2[_0x02cd('0x3')](_0x3fba37,function(_0x178a25,_0x78732d){if(_0x178a25){return _0x35144b(_0x178a25);}pm2[_0x02cd('0x5')]();return _0x1519b1(_0x78732d);});});});};exports['stop']=function(_0x291977){return connect()[_0x02cd('0x4')](function(){return new BPromise(function(_0x365566,_0x95f051){return pm2[_0x02cd('0x6')](_0x291977,function(_0xd0cc56,_0x18dfe0){if(_0xd0cc56){return _0x95f051(_0xd0cc56);}pm2[_0x02cd('0x5')]();return _0x365566(_0x18dfe0);});});});};exports[_0x02cd('0x7')]=function(_0x806274){return connect()['then'](function(){return new BPromise(function(_0x59f017,_0x395bb0){return pm2[_0x02cd('0x7')](_0x806274,function(_0x568fa8,_0x53159e){if(_0x568fa8){return _0x395bb0(_0x568fa8);}pm2[_0x02cd('0x5')]();return _0x59f017(_0x53159e);});});});};exports['list']=function(){return connect()[_0x02cd('0x4')](function(){return new BPromise(function(_0x18b817,_0xd89165){return pm2[_0x02cd('0x8')](function(_0x22d6b2,_0x3b7a7d){if(_0x22d6b2){return _0xd89165(_0x22d6b2);}pm2['disconnect']();return _0x18b817(_0x3b7a7d);});});});};exports['describe']=function(_0x2c2269){return connect()[_0x02cd('0x4')](function(){return new BPromise(function(_0x1adf4c,_0x37fbf2){return pm2[_0x02cd('0x9')](_0x2c2269,function(_0x4dfbdf,_0x94301f){if(_0x4dfbdf){return _0x37fbf2(_0x4dfbdf);}pm2['disconnect']();return _0x1adf4c(_0x94301f);});});});};exports['delete']=function(_0x40d319){return connect()[_0x02cd('0x4')](function(){return new BPromise(function(_0x1a2ec1,_0x1077d5){return pm2['delete'](_0x40d319,function(_0x341ace,_0x5301a8){if(_0x341ace){return _0x1077d5(_0x341ace);}pm2[_0x02cd('0x5')]();return _0x1a2ec1(_0x5301a8);});});});};exports[_0x02cd('0xa')]=function(){return connect()[_0x02cd('0x4')](function(){return new BPromise(function(_0x20b7ea,_0x3edee6){return pm2[_0x02cd('0xa')](function(_0x664d32){if(_0x664d32){return _0x3edee6(_0x664d32);}return _0x20b7ea(_0x02cd('0xb'));});});});}; \ No newline at end of file +var _0xb5ec=['connect','connected','start','disconnect','stop','then','restart','list','describe','delete','dump','pm2','bluebird','./config'];(function(_0x4c2712,_0x4de6e9){var _0x596c97=function(_0x17626c){while(--_0x17626c){_0x4c2712['push'](_0x4c2712['shift']());}};_0x596c97(++_0x4de6e9);}(_0xb5ec,0x97));var _0xcb5e=function(_0x95658b,_0x286b2d){_0x95658b=_0x95658b-0x0;var _0x16489d=_0xb5ec[_0x95658b];return _0x16489d;};'use strict';var pm2=require(_0xcb5e('0x0'));var BPromise=require(_0xcb5e('0x1'));var config=require(_0xcb5e('0x2'));function connect(){return new BPromise(function(_0x29a9ca,_0x4830bc){return pm2[_0xcb5e('0x3')](function(_0x41a291){if(_0x41a291){return _0x4830bc(_0x41a291);}return _0x29a9ca(_0xcb5e('0x4'));});});};exports['start']=function(_0x421351){return connect()['then'](function(){return new BPromise(function(_0x165efc,_0xfbd838){return pm2[_0xcb5e('0x5')](_0x421351,function(_0x20e2a2,_0x1c449c){if(_0x20e2a2){return _0xfbd838(_0x20e2a2);}pm2[_0xcb5e('0x6')]();return _0x165efc(_0x1c449c);});});});};exports[_0xcb5e('0x7')]=function(_0x3150be){return connect()[_0xcb5e('0x8')](function(){return new BPromise(function(_0xdd5d94,_0x5d9e02){return pm2[_0xcb5e('0x7')](_0x3150be,function(_0x51dca4,_0x2b1461){if(_0x51dca4){return _0x5d9e02(_0x51dca4);}pm2[_0xcb5e('0x6')]();return _0xdd5d94(_0x2b1461);});});});};exports[_0xcb5e('0x9')]=function(_0x218371){return connect()[_0xcb5e('0x8')](function(){return new BPromise(function(_0x9f6d75,_0x5d5138){return pm2[_0xcb5e('0x9')](_0x218371,function(_0x5bb9cf,_0x3ce932){if(_0x5bb9cf){return _0x5d5138(_0x5bb9cf);}pm2[_0xcb5e('0x6')]();return _0x9f6d75(_0x3ce932);});});});};exports[_0xcb5e('0xa')]=function(){return connect()[_0xcb5e('0x8')](function(){return new BPromise(function(_0x59b488,_0x1674aa){return pm2[_0xcb5e('0xa')](function(_0x522b1b,_0x598a2b){if(_0x522b1b){return _0x1674aa(_0x522b1b);}pm2[_0xcb5e('0x6')]();return _0x59b488(_0x598a2b);});});});};exports[_0xcb5e('0xb')]=function(_0x18002f){return connect()[_0xcb5e('0x8')](function(){return new BPromise(function(_0xf8d2d9,_0x4277b2){return pm2[_0xcb5e('0xb')](_0x18002f,function(_0xc9c745,_0x2e7ba9){if(_0xc9c745){return _0x4277b2(_0xc9c745);}pm2[_0xcb5e('0x6')]();return _0xf8d2d9(_0x2e7ba9);});});});};exports['delete']=function(_0x3251fe){return connect()['then'](function(){return new BPromise(function(_0x57a540,_0x22ed81){return pm2[_0xcb5e('0xc')](_0x3251fe,function(_0x5edd80,_0x21f615){if(_0x5edd80){return _0x22ed81(_0x5edd80);}pm2[_0xcb5e('0x6')]();return _0x57a540(_0x21f615);});});});};exports[_0xcb5e('0xd')]=function(){return connect()[_0xcb5e('0x8')](function(){return new BPromise(function(_0x200749,_0x18adb2){return pm2[_0xcb5e('0xd')](function(_0x28d988){if(_0x28d988){return _0x18adb2(_0x28d988);}return _0x200749('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8a6b441..942cd23 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 _0x3db6=['moment','ioredis','../../mysqldb','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','ChatInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','error','start','lodash'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3db6,0x1a8));var _0x63db=function(_0x3afaa7,_0x2d08cd){_0x3afaa7=_0x3afaa7-0x0;var _0x370162=_0x3db6[_0x3afaa7];return _0x370162;};'use strict';var _=require(_0x63db('0x0'));var moment=require(_0x63db('0x1'));var Redis=require(_0x63db('0x2'));var db=require(_0x63db('0x3'))['db'];var config=require('../../config/environment');config[_0x63db('0x4')]=_[_0x63db('0x5')](config[_0x63db('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x63db('0x6'))(new Redis(config[_0x63db('0x4')]));function closeInteractions(){var _0x5b803a=0x0;var _0x30420e=[];return db[_0x63db('0x7')][_0x63db('0x8')]({'raw':!![],'attributes':['id',_0x63db('0x9')],'where':{'id':0x1}})[_0x63db('0xa')](function(_0x45c71e){_0x5b803a=_0x45c71e[_0x63db('0x9')];if(_0x5b803a){return db['ChatInteraction'][_0x63db('0xb')]({'raw':!![],'attributes':['id',_0x63db('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x63db('0xd')](_0x45c71e['chatTimeout'],_0x63db('0xe'))}}});}else{return[];}})['then'](function(_0x5905ed){_0x30420e=_0x5905ed;if(_0x5b803a){return db[_0x63db('0xf')][_0x63db('0x10')]({'closeReason':'system','disposition':_0x63db('0x11'),'closed':!![],'closedAt':moment()[_0x63db('0x12')](_0x63db('0x13'))},{'where':{'id':_['map'](_0x30420e||[],'id')}});}})[_0x63db('0xa')](function(_0x3c192d){for(var _0x391fae=0x0;_0x391fae<_0x30420e[_0x63db('0x14')];_0x391fae++){io[_0x63db('0x15')](_0x63db('0x16'),{'id':_0x30420e[_0x391fae]['id'],'closed':!![]});}})['catch'](function(_0x5b2af0){console[_0x63db('0x17')](_0x5b2af0);});}exports[_0x63db('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6dda=['defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','subtract','minutes','update','format','YYYY-MM-DD\x20HH:mm:ss','map','then','length','emit','chatInteraction:update','catch','error','start','moment','ioredis','../../mysqldb','../../config/environment','redis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6dda,0x1e9));var _0xa6dd=function(_0x53ccf7,_0x2cfbd9){_0x53ccf7=_0x53ccf7-0x0;var _0x426f16=_0x6dda[_0x53ccf7];return _0x426f16;};'use strict';var _=require('lodash');var moment=require(_0xa6dd('0x0'));var Redis=require(_0xa6dd('0x1'));var db=require(_0xa6dd('0x2'))['db'];var config=require(_0xa6dd('0x3'));config[_0xa6dd('0x4')]=_[_0xa6dd('0x5')](config[_0xa6dd('0x4')],{'host':_0xa6dd('0x6'),'port':0x18eb});var io=require(_0xa6dd('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x26f898=0x0;var _0x16011a=[];return db[_0xa6dd('0x8')][_0xa6dd('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x200ced){_0x26f898=_0x200ced[_0xa6dd('0xa')];if(_0x26f898){return db[_0xa6dd('0xb')][_0xa6dd('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xa6dd('0xd')](_0x200ced[_0xa6dd('0xa')],_0xa6dd('0xe'))}}});}else{return[];}})['then'](function(_0x17dfde){_0x16011a=_0x17dfde;if(_0x26f898){return db[_0xa6dd('0xb')][_0xa6dd('0xf')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xa6dd('0x10')](_0xa6dd('0x11'))},{'where':{'id':_[_0xa6dd('0x12')](_0x16011a||[],'id')}});}})[_0xa6dd('0x13')](function(_0x20d168){for(var _0x648a42=0x0;_0x648a42<_0x16011a[_0xa6dd('0x14')];_0x648a42++){io[_0xa6dd('0x15')](_0xa6dd('0x16'),{'id':_0x16011a[_0x648a42]['id'],'closed':!![]});}})[_0xa6dd('0x17')](function(_0xee1c7e){console[_0xa6dd('0x18')](_0xee1c7e);});}exports[_0xa6dd('0x19')]=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 22c8279..2718ed9 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 _0x96f7=['update','update\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','../logger','schedule','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','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','status','text','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','email\x20sent','error\x20mail','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','Schedule','findAll','MailServerOut','keys','jobs','map','toString','intersection','difference','length','exists','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','start','stop','stop\x20cron'];(function(_0x30dc67,_0x59d11a){var _0x3df117=function(_0x459548){while(--_0x459548){_0x30dc67['push'](_0x30dc67['shift']());}};_0x3df117(++_0x59d11a);}(_0x96f7,0xf6));var _0x796f=function(_0x354e7a,_0x4e4dc0){_0x354e7a=_0x354e7a-0x0;var _0x17b550=_0x96f7[_0x354e7a];return _0x17b550;};'use strict';var fs=require('fs');var util=require(_0x796f('0x0'));var path=require(_0x796f('0x1'));var _=require('lodash');var moment=require(_0x796f('0x2'));var CronJobManager=require(_0x796f('0x3'));var jayson=require(_0x796f('0x4'));var BPromise=require('bluebird');var logger=require(_0x796f('0x5'))(_0x796f('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x337a21,_0x171455){return function(){logger[_0x796f('0x7')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x337a21[_0x796f('0x8')]);var _0x27e978=!![];var _0x49cb3b={'tls':{'rejectUnauthorized':![]}};if(_0x337a21[_0x796f('0x9')][_0x796f('0xa')][_0x796f('0xb')]){_0x49cb3b[_0x796f('0xb')]=_0x337a21[_0x796f('0x9')][_0x796f('0xa')]['service'];}else{_0x49cb3b[_0x796f('0xc')]=_0x337a21[_0x796f('0x9')][_0x796f('0xa')][_0x796f('0xc')];_0x49cb3b[_0x796f('0xd')]=_0x337a21['MailAccount'][_0x796f('0xa')][_0x796f('0xd')];_0x49cb3b['secure']=_0x337a21['MailAccount'][_0x796f('0xa')][_0x796f('0xe')];}if(_0x337a21[_0x796f('0x9')][_0x796f('0xa')][_0x796f('0xf')]){_0x49cb3b[_0x796f('0x10')]={'user':_0x337a21[_0x796f('0x9')][_0x796f('0xa')][_0x796f('0x11')],'pass':_0x337a21[_0x796f('0x9')][_0x796f('0xa')][_0x796f('0x12')]};}var _0x51710f={'account':_0x49cb3b,'message':{'from':util[_0x796f('0x13')](_0x796f('0x14'),_0x337a21['MailAccount'][_0x796f('0x15')],_0x337a21[_0x796f('0x9')][_0x796f('0x8')]||_0x337a21[_0x796f('0x9')][_0x796f('0xa')][_0x796f('0x11')]),'to':_0x337a21[_0x796f('0x8')],'cc':_0x337a21['cc'],'bcc':_0x337a21['bcc'],'subject':util[_0x796f('0x13')](_0x796f('0x16'),_0x171455[_0x796f('0x15')],_0x337a21['subtractNumber'],_0x337a21[_0x796f('0x17')])}};var _0x4b81fa=path[_0x796f('0x18')](__dirname,_0x796f('0x19'));var _0xd0cb71=_0x171455[_0x796f('0x1a')];var _0x5d8963=util[_0x796f('0x13')](_0x796f('0x1b'),path['basename'](_0x171455[_0x796f('0x1a')],path[_0x796f('0x1c')](_0x171455[_0x796f('0x1a')])),_0x796f('0x1d'));var _0x140a07=path['join'](_0x4b81fa,_0xd0cb71);var _0x5c8423=path['join'](_0x4b81fa,_0x5d8963);if(fs['existsSync'](_0x140a07)){_0x171455['status']=_0x796f('0x1e');_0x51710f[_0x796f('0x1f')][_0x796f('0x20')]=[{'filename':_0xd0cb71,'path':_0x140a07}];_0x51710f['message']['text']=util[_0x796f('0x13')](_0x796f('0x21'),JSON[_0x796f('0x22')](_0x171455,null,0x2));}else if(fs['existsSync'](_0x5c8423)){_0x171455[_0x796f('0x23')]='Sent';_0x51710f['message'][_0x796f('0x20')]=[{'filename':_0x5d8963,'path':_0x5c8423}];}else{_0x51710f['message'][_0x796f('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x337a21['sendIfEmpty']){_0x27e978=![];logger[_0x796f('0x7')](_0x796f('0x25'));}}if(_0x27e978){return client['request'](_0x796f('0x26'),_0x51710f)[_0x796f('0x27')](function(_0x4cc285){if(_0x4cc285[_0x796f('0x28')]){return logger['error']('error\x20mail',JSON['stringify'](_0x4cc285));}return logger[_0x796f('0x7')](_0x796f('0x29'));})['catch'](function(_0x280586){return logger[_0x796f('0x28')](_0x796f('0x2a'),JSON['stringify'](_0x280586));});}};}function handleError(){return function(_0xecf544){return logger[_0x796f('0x28')](JSON[_0x796f('0x22')](_0xecf544));};}function handleResult(_0x418b9a){return function(_0x5da063){logger[_0x796f('0x7')](_0x796f('0x2b'),JSON[_0x796f('0x22')](_0x5da063));if(_0x418b9a['MailAccount']&&_0x418b9a[_0x796f('0x9')]['Smtp']&&!_['isNil'](_0x418b9a[_0x796f('0x8')])){setTimeout(handleSendEmail(_0x418b9a,_0x5da063),0x3c*0x3e8);}};}function handleJob(_0x301bd6){return function(){try{if(_[_0x796f('0x2c')](_0x301bd6[_0x796f('0x2d')])){return logger[_0x796f('0x7')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x796f('0x2c')](_0x301bd6[_0x796f('0x17')])){return logger[_0x796f('0x7')](_0x796f('0x2e'));}var _0x4bb05b={'startDate':moment()[_0x796f('0x2f')](_0x301bd6[_0x796f('0x2d')],_0x301bd6['subtractUnit'])['format'](_0x796f('0x30')),'endDate':moment()[_0x796f('0x13')](_0x796f('0x30')),'type':_0x796f('0x31'),'output':_0x301bd6['output'],'name':_0x301bd6[_0x796f('0x15')]};if(!_['isNil'](_0x301bd6[_0x796f('0x32')])){logger[_0x796f('0x7')](_0x796f('0x33'),_0x301bd6['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x301bd6[_0x796f('0x32')]},_0x4bb05b)[_0x796f('0x27')](handleResult(_0x301bd6))['catch'](handleError());}if(!_[_0x796f('0x2c')](_0x301bd6[_0x796f('0x34')])){logger[_0x796f('0x7')]('exec\x20custom\x20report\x20id:%s',_0x301bd6[_0x796f('0x34')]);return analyticCustomReportController[_0x796f('0x35')]({'id':_0x301bd6[_0x796f('0x34')]},_0x4bb05b)[_0x796f('0x27')](handleResult(_0x301bd6))['catch'](handleError());}}catch(_0x41687b){logger[_0x796f('0x28')](JSON[_0x796f('0x22')](_0x41687b));}return logger[_0x796f('0x7')]('no\x20report\x20id');};}function getJobs(_0x5e3654){var _0x4cd81a={};if(_0x5e3654){_0x4cd81a['id']=_0x5e3654;}return db[_0x796f('0x36')][_0x796f('0x37')]({'where':_0x4cd81a,'include':[{'model':db['MailAccount'],'attributes':['id',_0x796f('0x15'),_0x796f('0x8')],'include':[{'model':db[_0x796f('0x38')],'as':'Smtp'}]}]})[_0x796f('0x27')](function(_0x3a9c54){var _0x302088=_[_0x796f('0x39')](manager[_0x796f('0x3a')]);var _0x4730c3=_[_0x796f('0x3b')](_0x3a9c54,function(_0x232496){return _0x232496['id'][_0x796f('0x3c')]();});var _0x5af1b7=_['keyBy'](_0x3a9c54,function(_0x396690){return _0x396690['id'][_0x796f('0x3c')]();});var _0x3d01cc=_0x5e3654?_0x4730c3:_['difference'](_0x4730c3,_0x302088);var _0x411473=_[_0x796f('0x3d')](_0x4730c3,_0x302088);var _0x33432d=_[_0x796f('0x3e')](_0x302088,_0x4730c3);var _0x5440c0;var _0x1a7896;for(_0x5440c0=0x0;_0x5440c0<_0x33432d[_0x796f('0x3f')]&&!_0x5e3654;_0x5440c0+=0x1){_0x1a7896=_0x33432d[_0x5440c0][_0x796f('0x3c')]();if(manager[_0x796f('0x40')](_0x1a7896)){manager['stop'](_0x1a7896);manager[_0x796f('0x41')](_0x1a7896);logger[_0x796f('0x7')](_0x796f('0x42'),_0x1a7896);}}logger['info']('toRun',JSON['stringify'](_0x3d01cc));for(_0x5440c0=0x0;_0x5440c0<_0x3d01cc[_0x796f('0x3f')];_0x5440c0+=0x1){_0x1a7896=_0x3d01cc[_0x5440c0]['toString']();logger[_0x796f('0x7')](_0x796f('0x43'),_0x1a7896);if(_0x5e3654){logger['info'](_0x796f('0x44'),_0x5e3654);logger[_0x796f('0x7')](JSON['stringify'](_0x5af1b7[_0x1a7896]));BPromise[_0x796f('0x45')]()[_0x796f('0x27')](handleJob(_0x5af1b7[_0x1a7896]));logger['info'](_0x796f('0x46'),_0x5af1b7[_0x1a7896][_0x796f('0x15')],_0x5af1b7[_0x1a7896][_0x796f('0x47')]);}else if(_0x5af1b7[_0x1a7896][_0x796f('0x47')]&&_0x5af1b7[_0x1a7896][_0x796f('0x48')]&&moment()['isBetween'](_0x5af1b7[_0x1a7896][_0x796f('0x49')],_0x5af1b7[_0x1a7896][_0x796f('0x4a')])){manager['add'](_0x1a7896,_0x5af1b7[_0x1a7896][_0x796f('0x47')],handleJob(_0x5af1b7[_0x1a7896]));manager[_0x796f('0x4b')](_0x1a7896);logger[_0x796f('0x7')]('add\x20cron',_0x5af1b7[_0x1a7896][_0x796f('0x15')],_0x5af1b7[_0x1a7896][_0x796f('0x47')]);}else if(manager['exists'](_0x1a7896)){manager[_0x796f('0x4c')](_0x1a7896);manager['deleteJob'](_0x1a7896);logger[_0x796f('0x7')](_0x796f('0x4d'),_0x5af1b7[_0x1a7896][_0x796f('0x15')],_0x5af1b7[_0x1a7896][_0x796f('0x47')]);}}for(_0x5440c0=0x0,_0x1a7896;_0x5440c0<_0x411473[_0x796f('0x3f')]&&!_0x5e3654;_0x5440c0+=0x1){_0x1a7896=_0x411473[_0x5440c0][_0x796f('0x3c')]();if(manager[_0x796f('0x40')](_0x1a7896)){if(_0x5af1b7[_0x1a7896][_0x796f('0x47')]&&_0x5af1b7[_0x1a7896]['active']&&moment()['isBetween'](_0x5af1b7[_0x1a7896][_0x796f('0x49')],_0x5af1b7[_0x1a7896][_0x796f('0x4a')])){manager[_0x796f('0x4e')](_0x1a7896,_0x5af1b7[_0x1a7896][_0x796f('0x47')],handleJob(_0x5af1b7[_0x1a7896]));logger[_0x796f('0x7')](_0x796f('0x4f'),_0x5af1b7[_0x1a7896][_0x796f('0x15')],_0x5af1b7[_0x1a7896][_0x796f('0x47')]);}else{manager['stop'](_0x1a7896);manager['deleteJob'](_0x1a7896);logger['info']('stop\x20cron',_0x5af1b7[_0x1a7896]['name'],_0x5af1b7[_0x1a7896][_0x796f('0x47')]);}}}})['catch'](function(_0x1ae6eb){logger[_0x796f('0x28')](JSON[_0x796f('0x22')](_0x1ae6eb));});}exports[_0x796f('0x50')]=function(_0x2317d2){return getJobs(_0x2317d2);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf6a8=['secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','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','status','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error\x20mail','stringify','catch','error','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','Schedule','findAll','keys','jobs','map','toString','difference','exists','stop','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','active','isBetween','startAt','endAt','add','cron','add\x20cron','deleteJob','stop\x20cron','update','update\x20cron','util','path','lodash','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','service','Smtp','host','port'];(function(_0x1c53e1,_0x2f11a8){var _0x1f5b1f=function(_0x37bc47){while(--_0x37bc47){_0x1c53e1['push'](_0x1c53e1['shift']());}};_0x1f5b1f(++_0x2f11a8);}(_0xf6a8,0x1af));var _0x8f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a8[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require(_0x8f6a('0x0'));var path=require(_0x8f6a('0x1'));var _=require(_0x8f6a('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x8f6a('0x3'));var BPromise=require('bluebird');var logger=require(_0x8f6a('0x4'))('schedule');var db=require(_0x8f6a('0x5'))['db'];var analyticCustomReportController=require(_0x8f6a('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x8f6a('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x458169,_0x598491){return function(){logger['info'](_0x8f6a('0x8'),_0x458169['email']);var _0x5b1963=!![];var _0x174d68={'tls':{'rejectUnauthorized':![]}};if(_0x458169[_0x8f6a('0x9')]['Smtp'][_0x8f6a('0xa')]){_0x174d68[_0x8f6a('0xa')]=_0x458169[_0x8f6a('0x9')][_0x8f6a('0xb')]['service'];}else{_0x174d68[_0x8f6a('0xc')]=_0x458169[_0x8f6a('0x9')][_0x8f6a('0xb')][_0x8f6a('0xc')];_0x174d68[_0x8f6a('0xd')]=_0x458169['MailAccount'][_0x8f6a('0xb')][_0x8f6a('0xd')];_0x174d68[_0x8f6a('0xe')]=_0x458169['MailAccount'][_0x8f6a('0xb')][_0x8f6a('0xe')];}if(_0x458169[_0x8f6a('0x9')][_0x8f6a('0xb')][_0x8f6a('0xf')]){_0x174d68['auth']={'user':_0x458169[_0x8f6a('0x9')][_0x8f6a('0xb')][_0x8f6a('0x10')],'pass':_0x458169[_0x8f6a('0x9')]['Smtp'][_0x8f6a('0x11')]};}var _0x1aa032={'account':_0x174d68,'message':{'from':util[_0x8f6a('0x12')](_0x8f6a('0x13'),_0x458169[_0x8f6a('0x9')][_0x8f6a('0x14')],_0x458169['MailAccount'][_0x8f6a('0x15')]||_0x458169[_0x8f6a('0x9')][_0x8f6a('0xb')][_0x8f6a('0x10')]),'to':_0x458169[_0x8f6a('0x15')],'cc':_0x458169['cc'],'bcc':_0x458169[_0x8f6a('0x16')],'subject':util[_0x8f6a('0x12')]('Report\x20%s\x20last\x20%s\x20%s',_0x598491[_0x8f6a('0x14')],_0x458169[_0x8f6a('0x17')],_0x458169[_0x8f6a('0x18')])}};var _0x5c69ae=path[_0x8f6a('0x19')](__dirname,_0x8f6a('0x1a'));var _0x4b451d=_0x598491[_0x8f6a('0x1b')];var _0x4b98ed=util[_0x8f6a('0x12')](_0x8f6a('0x1c'),path[_0x8f6a('0x1d')](_0x598491['savename'],path[_0x8f6a('0x1e')](_0x598491[_0x8f6a('0x1b')])),_0x8f6a('0x1f'));var _0x4d146b=path['join'](_0x5c69ae,_0x4b451d);var _0x3bf6fa=path[_0x8f6a('0x19')](_0x5c69ae,_0x4b98ed);if(fs[_0x8f6a('0x20')](_0x4d146b)){_0x598491['status']=_0x8f6a('0x21');_0x1aa032[_0x8f6a('0x22')][_0x8f6a('0x23')]=[{'filename':_0x4b451d,'path':_0x4d146b}];_0x1aa032[_0x8f6a('0x22')]['text']=util[_0x8f6a('0x12')](_0x8f6a('0x24'),JSON['stringify'](_0x598491,null,0x2));}else if(fs[_0x8f6a('0x20')](_0x3bf6fa)){_0x598491[_0x8f6a('0x25')]=_0x8f6a('0x21');_0x1aa032[_0x8f6a('0x22')][_0x8f6a('0x23')]=[{'filename':_0x4b98ed,'path':_0x3bf6fa}];}else{_0x1aa032[_0x8f6a('0x22')][_0x8f6a('0x26')]=_0x8f6a('0x27');if(!_0x458169[_0x8f6a('0x28')]){_0x5b1963=![];logger[_0x8f6a('0x29')](_0x8f6a('0x2a'));}}if(_0x5b1963){return client[_0x8f6a('0x2b')](_0x8f6a('0x2c'),_0x1aa032)[_0x8f6a('0x2d')](function(_0x39d14b){if(_0x39d14b['error']){return logger['error'](_0x8f6a('0x2e'),JSON[_0x8f6a('0x2f')](_0x39d14b));}return logger['info']('email\x20sent');})[_0x8f6a('0x30')](function(_0x583ab8){return logger[_0x8f6a('0x31')](_0x8f6a('0x2e'),JSON[_0x8f6a('0x2f')](_0x583ab8));});}};}function handleError(){return function(_0x370ca2){return logger['error'](JSON['stringify'](_0x370ca2));};}function handleResult(_0x5a35b4){return function(_0x330515){logger['info']('data',JSON[_0x8f6a('0x2f')](_0x330515));if(_0x5a35b4[_0x8f6a('0x9')]&&_0x5a35b4[_0x8f6a('0x9')]['Smtp']&&!_[_0x8f6a('0x32')](_0x5a35b4[_0x8f6a('0x15')])){setTimeout(handleSendEmail(_0x5a35b4,_0x330515),0x3c*0x3e8);}};}function handleJob(_0x1c076b){return function(){try{if(_[_0x8f6a('0x32')](_0x1c076b['subtractNumber'])){return logger[_0x8f6a('0x29')](_0x8f6a('0x33'));}if(_['isNil'](_0x1c076b[_0x8f6a('0x18')])){return logger[_0x8f6a('0x29')](_0x8f6a('0x34'));}var _0x433ca0={'startDate':moment()[_0x8f6a('0x35')](_0x1c076b[_0x8f6a('0x17')],_0x1c076b[_0x8f6a('0x18')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x8f6a('0x12')](_0x8f6a('0x36')),'type':_0x8f6a('0x37'),'output':_0x1c076b[_0x8f6a('0x38')],'name':_0x1c076b[_0x8f6a('0x14')]};if(!_['isNil'](_0x1c076b[_0x8f6a('0x39')])){logger[_0x8f6a('0x29')](_0x8f6a('0x3a'),_0x1c076b[_0x8f6a('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x1c076b[_0x8f6a('0x39')]},_0x433ca0)[_0x8f6a('0x2d')](handleResult(_0x1c076b))['catch'](handleError());}if(!_[_0x8f6a('0x32')](_0x1c076b[_0x8f6a('0x3b')])){logger['info'](_0x8f6a('0x3c'),_0x1c076b[_0x8f6a('0x3b')]);return analyticCustomReportController[_0x8f6a('0x3d')]({'id':_0x1c076b[_0x8f6a('0x3b')]},_0x433ca0)['then'](handleResult(_0x1c076b))['catch'](handleError());}}catch(_0x297ea8){logger['error'](JSON[_0x8f6a('0x2f')](_0x297ea8));}return logger[_0x8f6a('0x29')]('no\x20report\x20id');};}function getJobs(_0x51dcc4){var _0xf8ecec={};if(_0x51dcc4){_0xf8ecec['id']=_0x51dcc4;}return db[_0x8f6a('0x3e')][_0x8f6a('0x3f')]({'where':_0xf8ecec,'include':[{'model':db['MailAccount'],'attributes':['id',_0x8f6a('0x14'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x8f6a('0xb')}]}]})[_0x8f6a('0x2d')](function(_0x175a57){var _0x434b88=_[_0x8f6a('0x40')](manager[_0x8f6a('0x41')]);var _0x25e9b3=_[_0x8f6a('0x42')](_0x175a57,function(_0x46396e){return _0x46396e['id']['toString']();});var _0x1230b1=_['keyBy'](_0x175a57,function(_0x598c69){return _0x598c69['id'][_0x8f6a('0x43')]();});var _0x54aaec=_0x51dcc4?_0x25e9b3:_[_0x8f6a('0x44')](_0x25e9b3,_0x434b88);var _0x209e5e=_['intersection'](_0x25e9b3,_0x434b88);var _0x925912=_[_0x8f6a('0x44')](_0x434b88,_0x25e9b3);var _0x52c800;var _0x29c3f0;for(_0x52c800=0x0;_0x52c800<_0x925912['length']&&!_0x51dcc4;_0x52c800+=0x1){_0x29c3f0=_0x925912[_0x52c800][_0x8f6a('0x43')]();if(manager[_0x8f6a('0x45')](_0x29c3f0)){manager[_0x8f6a('0x46')](_0x29c3f0);manager['deleteJob'](_0x29c3f0);logger['info'](_0x8f6a('0x47'),_0x29c3f0);}}logger[_0x8f6a('0x29')](_0x8f6a('0x48'),JSON[_0x8f6a('0x2f')](_0x54aaec));for(_0x52c800=0x0;_0x52c800<_0x54aaec[_0x8f6a('0x49')];_0x52c800+=0x1){_0x29c3f0=_0x54aaec[_0x52c800]['toString']();logger[_0x8f6a('0x29')](_0x8f6a('0x4a'),_0x29c3f0);if(_0x51dcc4){logger['info'](_0x8f6a('0x4b'),_0x51dcc4);logger[_0x8f6a('0x29')](JSON[_0x8f6a('0x2f')](_0x1230b1[_0x29c3f0]));BPromise[_0x8f6a('0x4c')]()[_0x8f6a('0x2d')](handleJob(_0x1230b1[_0x29c3f0]));logger[_0x8f6a('0x29')](_0x8f6a('0x4d'),_0x1230b1[_0x29c3f0]['name'],_0x1230b1[_0x29c3f0]['cron']);}else if(_0x1230b1[_0x29c3f0]['cron']&&_0x1230b1[_0x29c3f0][_0x8f6a('0x4e')]&&moment()[_0x8f6a('0x4f')](_0x1230b1[_0x29c3f0][_0x8f6a('0x50')],_0x1230b1[_0x29c3f0][_0x8f6a('0x51')])){manager[_0x8f6a('0x52')](_0x29c3f0,_0x1230b1[_0x29c3f0][_0x8f6a('0x53')],handleJob(_0x1230b1[_0x29c3f0]));manager['start'](_0x29c3f0);logger['info'](_0x8f6a('0x54'),_0x1230b1[_0x29c3f0][_0x8f6a('0x14')],_0x1230b1[_0x29c3f0][_0x8f6a('0x53')]);}else if(manager['exists'](_0x29c3f0)){manager[_0x8f6a('0x46')](_0x29c3f0);manager[_0x8f6a('0x55')](_0x29c3f0);logger[_0x8f6a('0x29')](_0x8f6a('0x56'),_0x1230b1[_0x29c3f0][_0x8f6a('0x14')],_0x1230b1[_0x29c3f0][_0x8f6a('0x53')]);}}for(_0x52c800=0x0,_0x29c3f0;_0x52c800<_0x209e5e[_0x8f6a('0x49')]&&!_0x51dcc4;_0x52c800+=0x1){_0x29c3f0=_0x209e5e[_0x52c800]['toString']();if(manager[_0x8f6a('0x45')](_0x29c3f0)){if(_0x1230b1[_0x29c3f0][_0x8f6a('0x53')]&&_0x1230b1[_0x29c3f0]['active']&&moment()[_0x8f6a('0x4f')](_0x1230b1[_0x29c3f0]['startAt'],_0x1230b1[_0x29c3f0]['endAt'])){manager[_0x8f6a('0x57')](_0x29c3f0,_0x1230b1[_0x29c3f0][_0x8f6a('0x53')],handleJob(_0x1230b1[_0x29c3f0]));logger[_0x8f6a('0x29')](_0x8f6a('0x58'),_0x1230b1[_0x29c3f0][_0x8f6a('0x14')],_0x1230b1[_0x29c3f0][_0x8f6a('0x53')]);}else{manager[_0x8f6a('0x46')](_0x29c3f0);manager[_0x8f6a('0x55')](_0x29c3f0);logger[_0x8f6a('0x29')](_0x8f6a('0x56'),_0x1230b1[_0x29c3f0][_0x8f6a('0x14')],_0x1230b1[_0x29c3f0][_0x8f6a('0x53')]);}}}})[_0x8f6a('0x30')](function(_0x34d113){logger['error'](JSON[_0x8f6a('0x2f')](_0x34d113));});}exports['run']=function(_0x2c0fcf){return getJobs(_0x2c0fcf);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 093fb54..74c1cde 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8937=['destroy','hopper1','contacts2','hopper2','util','push','Innocenzo','innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','then','log','finished\x20populating','CmHopper'];(function(_0xf77eac,_0x56e821){var _0x892437=function(_0x174615){while(--_0x174615){_0xf77eac['push'](_0xf77eac['shift']());}};_0x892437(++_0x56e821);}(_0x8937,0x104));var _0x7893=function(_0x38d64c,_0x42d957){_0x38d64c=_0x38d64c-0x0;var _0x25dda6=_0x8937[_0x38d64c];return _0x25dda6;};'use strict';var util=require(_0x7893('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7893('0x1')]({'id':i,'firstName':_0x7893('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7893('0x3')+i+_0x7893('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7893('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x7893('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7893('0x5')](),'updatedAt':Date[_0x7893('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7893('0x1')]({'id':i,'firstName':_0x7893('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7893('0x3')+i+_0x7893('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7893('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x7893('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7893('0x5')](),'updatedAt':Date[_0x7893('0x5')]()});}db['CmContact']['destroy']({'where':{}})['then'](function(){return db[_0x7893('0x6')][_0x7893('0x7')](contacts);})[_0x7893('0x8')](function(){console[_0x7893('0x9')](_0x7893('0xa'),'contacts1');return db[_0x7893('0xb')][_0x7893('0xc')]({'where':{}});})['then'](function(){return db[_0x7893('0xb')][_0x7893('0x7')](hopper);})[_0x7893('0x8')](function(){console[_0x7893('0x9')](_0x7893('0xa'),_0x7893('0xd'));return db[_0x7893('0x6')][_0x7893('0x7')](contacts2);})[_0x7893('0x8')](function(){console['log'](_0x7893('0xa'),_0x7893('0xe'));return db['CmHopper'][_0x7893('0x7')](hopper2);})['then'](function(){console[_0x7893('0x9')](_0x7893('0xa'),_0x7893('0xf'));})['catch'](function(_0x2ec8f3){console['log'](_0x2ec8f3);}); \ No newline at end of file +var _0xfe98=['Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','push','innocenzo.biondo','@xcally.com','now'];(function(_0x1b87a5,_0x5875ef){var _0x212666=function(_0x49f640){while(--_0x49f640){_0x1b87a5['push'](_0x1b87a5['shift']());}};_0x212666(++_0x5875ef);}(_0xfe98,0x1f2));var _0x8fe9=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0xfe98[_0x54a9e3];return _0x247cce;};'use strict';var util=require(_0x8fe9('0x0'));var db=require(_0x8fe9('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8fe9('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x8fe9('0x3')+i+_0x8fe9('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8fe9('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x8fe9('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8fe9('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x8fe9('0x6')+i,'phone':0xf879fb460+i,'email':_0x8fe9('0x3')+i+_0x8fe9('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x8fe9('0x7')][_0x8fe9('0x8')]({'where':{}})[_0x8fe9('0x9')](function(){return db[_0x8fe9('0x7')][_0x8fe9('0xa')](contacts);})[_0x8fe9('0x9')](function(){console[_0x8fe9('0xb')](_0x8fe9('0xc'),_0x8fe9('0xd'));return db[_0x8fe9('0xe')][_0x8fe9('0x8')]({'where':{}});})[_0x8fe9('0x9')](function(){return db[_0x8fe9('0xe')][_0x8fe9('0xa')](hopper);})[_0x8fe9('0x9')](function(){console[_0x8fe9('0xb')]('finished\x20populating',_0x8fe9('0xf'));return db['CmContact']['bulkCreate'](contacts2);})[_0x8fe9('0x9')](function(){console[_0x8fe9('0xb')]('finished\x20populating',_0x8fe9('0x10'));return db['CmHopper'][_0x8fe9('0xa')](hopper2);})[_0x8fe9('0x9')](function(){console[_0x8fe9('0xb')](_0x8fe9('0xc'),_0x8fe9('0x11'));})['catch'](function(_0xca68c9){console[_0x8fe9('0xb')](_0xca68c9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 750b593..267d4bb 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8a=['add\x20user','catch','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log'];(function(_0x52278a,_0x207ce5){var _0x4e86b8=function(_0x25fc88){while(--_0x25fc88){_0x52278a['push'](_0x52278a['shift']());}};_0x4e86b8(++_0x207ce5);}(_0x8b8a,0x9a));var _0xa8b8=function(_0x74eb91,_0x333651){_0x74eb91=_0x74eb91-0x0;var _0x3011aa=_0x8b8a[_0x74eb91];return _0x3011aa;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa8b8('0x0')]({'name':util[_0xa8b8('0x1')](_0xa8b8('0x2'),'agent',i),'fullname':util[_0xa8b8('0x1')](_0xa8b8('0x2'),_0xa8b8('0x3'),i),'email':util['format']('%s%s@xcally.com',_0xa8b8('0x3'),i),'role':_0xa8b8('0x3'),'password':_0xa8b8('0x4'),'internal':0xfa0+i,'type':_0xa8b8('0x5'),'transport':[_0xa8b8('0x6'),'ws',_0xa8b8('0x7')],'disallow':[_0xa8b8('0x8')],'allow':[_0xa8b8('0x9')],'defaultuser':util['format'](_0xa8b8('0x2'),'agent',i),'encryption':_0xa8b8('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0xa8b8('0xa'),'dtlsenable':_0xa8b8('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xa8b8('0xb'),'dtlssetup':_0xa8b8('0xc'),'callerid':util['format'](_0xa8b8('0xd'),util[_0xa8b8('0x1')](_0xa8b8('0x2'),_0xa8b8('0x3'),i),0xfa0+i)});}db[_0xa8b8('0xe')]['bulkCreate'](users)[_0xa8b8('0xf')](function(){console[_0xa8b8('0x10')](_0xa8b8('0x11'));})[_0xa8b8('0x12')](function(_0x49d426){console['log'](_0x49d426);}); \ No newline at end of file +var _0x80f8=['friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x80f8,0x14f));var _0x880f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x80f8[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x880f('0x0'));var db=require(_0x880f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x880f('0x2')]({'name':util[_0x880f('0x3')](_0x880f('0x4'),_0x880f('0x5'),i),'fullname':util[_0x880f('0x3')](_0x880f('0x4'),_0x880f('0x5'),i),'email':util[_0x880f('0x3')](_0x880f('0x6'),_0x880f('0x5'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x880f('0x7'),'transport':['udp','ws',_0x880f('0x8')],'disallow':[_0x880f('0x9')],'allow':[_0x880f('0xa')],'defaultuser':util['format'](_0x880f('0x4'),_0x880f('0x5'),i),'encryption':_0x880f('0xb'),'avpf':'yes','force_avp':'yes','icesupport':_0x880f('0xb'),'dtlsenable':_0x880f('0xb'),'dtlsverify':'no','dtlscertfile':_0x880f('0xc'),'dtlsprivatekey':_0x880f('0xd'),'dtlssetup':'actpass','callerid':util[_0x880f('0x3')]('\x22%s\x22\x20<%s>',util['format'](_0x880f('0x4'),'agent',i),0xfa0+i)});}db[_0x880f('0xe')][_0x880f('0xf')](users)[_0x880f('0x10')](function(){console['log']('add\x20user');})['catch'](function(_0x4779de){console[_0x880f('0x11')](_0x4779de);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 6bd28b3..e11de13 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6deb=['User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','%s:queue:%s','format','user:%s','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','user','SmsQueue','Telephones','Trunks','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','all','length','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','user_has_chat_interactions:remove','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','log','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','bluebird','name','Agents'];(function(_0x4962e6,_0x220196){var _0x5f2a08=function(_0x2fb22c){while(--_0x2fb22c){_0x4962e6['push'](_0x4962e6['shift']());}};_0x5f2a08(++_0x220196);}(_0x6deb,0x1c3));var _0xb6de=function(_0x3f8435,_0x40c97a){_0x3f8435=_0x3f8435-0x0;var _0x2117d6=_0x6deb[_0x3f8435];return _0x2117d6;};'use strict';var _=require(_0xb6de('0x0'));var util=require('util');var BPromise=require(_0xb6de('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xb6de('0x2')],'include':[{'as':_0xb6de('0x3'),'model':db[_0xb6de('0x4')],'attributes':['id','name',_0xb6de('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb6de('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xb6de('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0xb6de('0x2')],'where':{'role':_0xb6de('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb6de('0x2'),_0xb6de('0x7')],'where':{'type':_0xb6de('0x8')}};function getAssociatedResources(_0x421e92,_0x203a68,_0xf31c59){return db[_0xb6de('0x9')][_0xb6de('0xa')]({'where':{'name':_0x421e92,'userProfileId':_0x203a68},'raw':!![]})[_0xb6de('0xb')](function(_0x42c6fb){if(_0x42c6fb){if(_0x42c6fb[_0xb6de('0xc')]){switch(_0x421e92){case _0xb6de('0xd'):case _0xb6de('0xe'):case _0xb6de('0xf'):case _0xb6de('0x10'):case _0xb6de('0x11'):case _0xb6de('0x12'):return db[_0xf31c59]['findAll'](queryQueues);case'Telephones':return db[_0xf31c59][_0xb6de('0x13')](queryTelephones);case'Trunks':return db[_0xf31c59][_0xb6de('0x13')](queryTrunks);case _0xb6de('0x14'):return db[_0xf31c59]['findAll'](queryCampaigns);}}else{return db[_0xb6de('0x15')]['findAll']({'attributes':[_0xb6de('0x16')],'where':{'sectionId':_0x42c6fb['id']},'raw':!![]})[_0xb6de('0xb')](function(_0xd4c25){if(_0xd4c25){var _0x5f762a={'where':{'id':_['map'](_0xd4c25,_0xb6de('0x16'))},'raw':!![]};switch(_0xf31c59){case'User':_0x5f762a[_0xb6de('0x17')][_0xb6de('0x5')]=_0xb6de('0x18');break;case _0xb6de('0x19'):_0x5f762a[_0xb6de('0x17')][_0xb6de('0x7')]='ivr';break;}return db[_0xf31c59]['findAll'](_0x5f762a);}else{return[];}});}}else{return[];}})['then'](function(_0x464462){return _0x464462;});}function joinOrLeaveQueues(_0xf40ee1,_0x3b3297,_0xee3f96,_0x4c2db1){_0xf40ee1[_0x3b3297](util['format'](_0xb6de('0x1a'),_0xee3f96,_0x4c2db1[_0xb6de('0x2')]));if(_0x4c2db1[_0xb6de('0x3')]){for(var _0x4868a9=0x0;_0x4868a9<_0x4c2db1['Agents']['length'];_0x4868a9+=0x1){_0xf40ee1[_0x3b3297](util[_0xb6de('0x1b')](_0xb6de('0x1c'),_0x4c2db1[_0xb6de('0x3')][_0x4868a9][_0xb6de('0x2')]));}}}function joinOrLeave(_0x11c6e2,_0x116bd5,_0x1d7f4a){var _0x352764;if(_0x11c6e2['handshake'][_0xb6de('0x1d')]['id']){db[_0xb6de('0x4')][_0xb6de('0x1e')]({'attributes':['id',_0xb6de('0x2'),_0xb6de('0x5'),_0xb6de('0x1f')],'where':{'id':_0x11c6e2['handshake'][_0xb6de('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xb6de('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xb6de('0x21')],'as':_0xb6de('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xb6de('0x23')],'as':_0xb6de('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xb6de('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xb6de('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})[_0xb6de('0xb')](function(_0x22bd66){if(_0x22bd66){_0x352764=_0x22bd66;_0x11c6e2[_0x116bd5](util[_0xb6de('0x1b')]('user:%s',_0x22bd66[_0xb6de('0x2')]));var _0x26ca25=[];switch(_0x22bd66[_0xb6de('0x5')]){case'admin':_0x11c6e2[_0x116bd5]('voice:inbound');_0x11c6e2[_0x116bd5](_0xb6de('0x27'));if(queryQueues[_0xb6de('0x28')](_0xb6de('0x29'))){delete queryQueues[_0xb6de('0x29')];}_0x26ca25[_0xb6de('0x2a')](db[_0xb6de('0x2b')][_0xb6de('0x13')](queryQueues));_0x26ca25[_0xb6de('0x2a')](db['ChatQueue'][_0xb6de('0x13')](queryQueues));_0x26ca25[_0xb6de('0x2a')](db[_0xb6de('0x2c')][_0xb6de('0x13')](queryQueues));_0x26ca25[_0xb6de('0x2a')](db['SmsQueue'][_0xb6de('0x13')](queryQueues));_0x26ca25['push'](db[_0xb6de('0x2d')][_0xb6de('0x13')](queryQueues));_0x26ca25['push'](db[_0xb6de('0x2e')][_0xb6de('0x13')](queryQueues));_0x26ca25['push'](db[_0xb6de('0x4')]['findAll'](queryTelephones));_0x26ca25[_0xb6de('0x2a')](db[_0xb6de('0x2f')][_0xb6de('0x13')](queryTrunks));_0x26ca25[_0xb6de('0x2a')](db[_0xb6de('0x19')][_0xb6de('0x13')](queryCampaigns));_0x26ca25[_0xb6de('0x2a')](db[_0xb6de('0x4')][_0xb6de('0x13')](queryAgents));break;case _0xb6de('0x30'):_0x11c6e2[_0x116bd5]('voice:inbound');_0x11c6e2[_0x116bd5](_0xb6de('0x27'));_0x26ca25['push'](getAssociatedResources(_0xb6de('0xd'),_0x22bd66[_0xb6de('0x1f')],_0xb6de('0x2b')));_0x26ca25[_0xb6de('0x2a')](getAssociatedResources(_0xb6de('0xe'),_0x22bd66['userProfileId'],'ChatQueue'));_0x26ca25['push'](getAssociatedResources(_0xb6de('0xf'),_0x22bd66['userProfileId'],'FaxQueue'));_0x26ca25[_0xb6de('0x2a')](getAssociatedResources(_0xb6de('0x10'),_0x22bd66[_0xb6de('0x1f')],_0xb6de('0x31')));_0x26ca25[_0xb6de('0x2a')](getAssociatedResources('MailQueues',_0x22bd66[_0xb6de('0x1f')],_0xb6de('0x2d')));_0x26ca25[_0xb6de('0x2a')](getAssociatedResources(_0xb6de('0x12'),_0x22bd66[_0xb6de('0x1f')],_0xb6de('0x2e')));_0x26ca25['push'](getAssociatedResources(_0xb6de('0x32'),_0x22bd66[_0xb6de('0x1f')],'User'));_0x26ca25[_0xb6de('0x2a')](getAssociatedResources(_0xb6de('0x33'),_0x22bd66[_0xb6de('0x1f')],'Trunk'));_0x26ca25[_0xb6de('0x2a')](getAssociatedResources('IvrCampaigns',_0x22bd66[_0xb6de('0x1f')],'Campaign'));_0x26ca25['push'](db[_0xb6de('0x4')]['findAll'](queryAgents));break;case _0xb6de('0x6'):_0x11c6e2[_0x116bd5](_0xb6de('0x34'));_0x11c6e2[_0x116bd5](_0xb6de('0x27'));_0x26ca25[_0xb6de('0x2a')](_0x22bd66[_0xb6de('0x35')]({'attributes':['id','name']}));_0x26ca25[_0xb6de('0x2a')](_0x22bd66[_0xb6de('0x36')]({'attributes':['id',_0xb6de('0x2')]}));_0x26ca25[_0xb6de('0x2a')](_0x22bd66[_0xb6de('0x37')]({'attributes':['id',_0xb6de('0x2')]}));_0x26ca25[_0xb6de('0x2a')](_0x22bd66[_0xb6de('0x38')]({'attributes':['id','name']}));_0x26ca25[_0xb6de('0x2a')](_0x22bd66[_0xb6de('0x39')]({'attributes':['id',_0xb6de('0x2')]}));_0x26ca25['push'](_0x22bd66['getOpenchannelQueues']({'attributes':['id',_0xb6de('0x2')]}));break;}return BPromise[_0xb6de('0x3a')](_0x26ca25);}})['then'](function(_0x4059e4){if(_0x4059e4&&_0x4059e4[_0xb6de('0x3b')]){for(var _0x1582d0=0x0;_0x1582d0<_0x4059e4[_0xb6de('0x3b')];_0x1582d0+=0x1){for(var _0x66bf2d=0x0;_0x66bf2d<_0x4059e4[_0x1582d0]['length'];_0x66bf2d+=0x1){switch(_0x1582d0){case 0x0:joinOrLeaveQueues(_0x11c6e2,_0x116bd5,_0xb6de('0x3c'),_0x4059e4[_0x1582d0][_0x66bf2d]);break;case 0x1:joinOrLeaveQueues(_0x11c6e2,_0x116bd5,_0xb6de('0x3d'),_0x4059e4[_0x1582d0][_0x66bf2d]);break;case 0x2:joinOrLeaveQueues(_0x11c6e2,_0x116bd5,_0xb6de('0x3e'),_0x4059e4[_0x1582d0][_0x66bf2d]);break;case 0x3:joinOrLeaveQueues(_0x11c6e2,_0x116bd5,_0xb6de('0x3f'),_0x4059e4[_0x1582d0][_0x66bf2d]);break;case 0x4:joinOrLeaveQueues(_0x11c6e2,_0x116bd5,_0xb6de('0x40'),_0x4059e4[_0x1582d0][_0x66bf2d]);break;case 0x5:joinOrLeaveQueues(_0x11c6e2,_0x116bd5,_0xb6de('0x41'),_0x4059e4[_0x1582d0][_0x66bf2d]);break;case 0x6:_0x11c6e2[_0x116bd5](util[_0xb6de('0x1b')](_0xb6de('0x42'),_0x4059e4[_0x1582d0][_0x66bf2d][_0xb6de('0x2')]));break;case 0x7:_0x11c6e2[_0x116bd5](util['format'](_0xb6de('0x43'),_0x4059e4[_0x1582d0][_0x66bf2d][_0xb6de('0x2')]));break;case 0x8:_0x11c6e2[_0x116bd5](util['format'](_0xb6de('0x44'),_0x4059e4[_0x1582d0][_0x66bf2d]['type'],_0x4059e4[_0x1582d0][_0x66bf2d][_0xb6de('0x2')]));break;case 0x9:_0x11c6e2[_0x116bd5](util[_0xb6de('0x1b')]('user:%s',_0x4059e4[_0x1582d0][_0x66bf2d]['name']));break;}}}}})[_0xb6de('0xb')](function(){if(_0x116bd5===_0xb6de('0x45')){var _0x4d6a0c=_[_0xb6de('0x46')](_0x352764[_0xb6de('0x20')],'id');return _0x352764['removeChatInteractions'](_0x4d6a0c)['then'](function(){for(var _0x21d67b=0x0;_0x21d67b<_0x4d6a0c['length'];_0x21d67b+=0x1){_0x1d7f4a['emit'](_0xb6de('0x47'),{'ChatInteractionId':Number(_0x4d6a0c[_0x21d67b]),'UserId':Number(_0x352764['id'])});}});}})[_0xb6de('0xb')](function(){if(_0x116bd5===_0xb6de('0x45')){var _0x216f10=_[_0xb6de('0x46')](_0x352764[_0xb6de('0x22')],'id');return _0x352764['removeMailInteractions'](_0x216f10)[_0xb6de('0xb')](function(){for(var _0x4ef716=0x0;_0x4ef716<_0x216f10[_0xb6de('0x3b')];_0x4ef716+=0x1){_0x1d7f4a[_0xb6de('0x48')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x216f10[_0x4ef716]),'UserId':Number(_0x352764['id'])});}});}})[_0xb6de('0xb')](function(){if(_0x116bd5==='leave'){var _0xf62a7f=_[_0xb6de('0x46')](_0x352764[_0xb6de('0x24')],'id');return _0x352764[_0xb6de('0x49')](_0xf62a7f)[_0xb6de('0xb')](function(){for(var _0x2a1408=0x0;_0x2a1408<_0xf62a7f['length'];_0x2a1408+=0x1){_0x1d7f4a['emit'](_0xb6de('0x4a'),{'FaxInteractionId':Number(_0xf62a7f[_0x2a1408]),'UserId':Number(_0x352764['id'])});}});}})[_0xb6de('0xb')](function(){if(_0x116bd5===_0xb6de('0x45')){var _0x5c46f1=_[_0xb6de('0x46')](_0x352764['SmsInteractions'],'id');return _0x352764[_0xb6de('0x4b')](_0x5c46f1)[_0xb6de('0xb')](function(){for(var _0x30170f=0x0;_0x30170f<_0x5c46f1[_0xb6de('0x3b')];_0x30170f+=0x1){_0x1d7f4a[_0xb6de('0x48')](_0xb6de('0x4c'),{'SmsInteractionId':Number(_0x5c46f1[_0x30170f]),'UserId':Number(_0x352764['id'])});}});}})[_0xb6de('0xb')](function(){if(_0x116bd5===_0xb6de('0x45')){var _0x3952ea=_['map'](_0x352764['OpenchannelInteractions'],'id');return _0x352764[_0xb6de('0x4d')](_0x3952ea)[_0xb6de('0xb')](function(){for(var _0x2a8d50=0x0;_0x2a8d50<_0x3952ea[_0xb6de('0x3b')];_0x2a8d50+=0x1){_0x1d7f4a[_0xb6de('0x48')](_0xb6de('0x4e'),{'OpenchannelInteractionId':Number(_0x3952ea[_0x2a8d50]),'UserId':Number(_0x352764['id'])});}});}})['catch'](function(_0x608b81){_0x11c6e2[_0xb6de('0x4f')](_0x608b81);});}}function onDisconnect(_0x9375f0,_0x2ed4d3){joinOrLeave(_0x9375f0,_0xb6de('0x45'),_0x2ed4d3);}function onConnect(_0x4c58d7){joinOrLeave(_0x4c58d7,'join');}exports[_0xb6de('0x50')]=function(_0x5aa577){_0x5aa577['on'](_0xb6de('0x51'),function(_0x2e4ff3){_0x2e4ff3[_0xb6de('0x52')](0x0);_0x2e4ff3[_0xb6de('0x53')]=_0x2e4ff3[_0xb6de('0x54')][_0xb6de('0x51')][_0xb6de('0x55')]+':'+_0x2e4ff3['request'][_0xb6de('0x51')][_0xb6de('0x56')];_0x2e4ff3['connectedAt']=new Date();_0x2e4ff3[_0xb6de('0x4f')]=function(_0x333dd9){console[_0xb6de('0x4f')](_0xb6de('0x57')+_0x2e4ff3[_0xb6de('0x58')]['name']+'['+_0x2e4ff3[_0xb6de('0x53')]+']',_0x333dd9);};_0x2e4ff3['on'](_0xb6de('0x59'),function(){onDisconnect(_0x2e4ff3,_0x5aa577);_0x2e4ff3[_0xb6de('0x4f')](_0xb6de('0x5a'));});onConnect(_0x2e4ff3);_0x2e4ff3['log']('CONNECTED');});}; \ No newline at end of file +var _0x3c80=['emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','log','SocketIO\x20','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','ChatQueues','MailQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:outbound','VoiceQueues','VoiceQueue','FaxQueues','SmsQueues','OpenchannelQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions'];(function(_0x4419e8,_0x36f7ed){var _0x45e87b=function(_0x3c2bce){while(--_0x3c2bce){_0x4419e8['push'](_0x4419e8['shift']());}};_0x45e87b(++_0x36f7ed);}(_0x3c80,0x130));var _0x03c8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3c80[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x03c8('0x0'));var util=require('util');var BPromise=require(_0x03c8('0x1'));var db=require(_0x03c8('0x2'))['db'];var config=require(_0x03c8('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x03c8('0x4'),'model':db[_0x03c8('0x5')],'attributes':['id',_0x03c8('0x6'),_0x03c8('0x7')],'raw':!![],'where':{'role':_0x03c8('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x03c8('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x03c8('0x6')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x03c8('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x03c8('0x6'),_0x03c8('0xa')],'where':{'type':_0x03c8('0xb')}};function getAssociatedResources(_0x498348,_0x5c257f,_0x14d336){return db[_0x03c8('0xc')]['findOne']({'where':{'name':_0x498348,'userProfileId':_0x5c257f},'raw':!![]})[_0x03c8('0xd')](function(_0x3d0c5b){if(_0x3d0c5b){if(_0x3d0c5b[_0x03c8('0xe')]){switch(_0x498348){case'VoiceQueues':case _0x03c8('0xf'):case'FaxQueues':case'SmsQueues':case _0x03c8('0x10'):case'OpenchannelQueues':return db[_0x14d336][_0x03c8('0x11')](queryQueues);case _0x03c8('0x12'):return db[_0x14d336][_0x03c8('0x11')](queryTelephones);case _0x03c8('0x13'):return db[_0x14d336][_0x03c8('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x14d336]['findAll'](queryCampaigns);}}else{return db[_0x03c8('0x14')][_0x03c8('0x11')]({'attributes':[_0x03c8('0x15')],'where':{'sectionId':_0x3d0c5b['id']},'raw':!![]})['then'](function(_0x265c7c){if(_0x265c7c){var _0x4fc3f3={'where':{'id':_[_0x03c8('0x16')](_0x265c7c,_0x03c8('0x15'))},'raw':!![]};switch(_0x14d336){case _0x03c8('0x5'):_0x4fc3f3[_0x03c8('0x17')][_0x03c8('0x7')]='telephone';break;case _0x03c8('0x18'):_0x4fc3f3[_0x03c8('0x17')]['type']=_0x03c8('0xb');break;}return db[_0x14d336][_0x03c8('0x11')](_0x4fc3f3);}else{return[];}});}}else{return[];}})[_0x03c8('0xd')](function(_0x4498aa){return _0x4498aa;});}function joinOrLeaveQueues(_0x12f21d,_0x34e853,_0x49f4d9,_0x5e684e){_0x12f21d[_0x34e853](util['format'](_0x03c8('0x19'),_0x49f4d9,_0x5e684e['name']));if(_0x5e684e[_0x03c8('0x4')]){for(var _0x2a34f8=0x0;_0x2a34f8<_0x5e684e[_0x03c8('0x4')][_0x03c8('0x1a')];_0x2a34f8+=0x1){_0x12f21d[_0x34e853](util[_0x03c8('0x1b')](_0x03c8('0x1c'),_0x5e684e[_0x03c8('0x4')][_0x2a34f8][_0x03c8('0x6')]));}}}function joinOrLeave(_0x5dabcb,_0x357bb4,_0x27459a){var _0x4122b7;if(_0x5dabcb[_0x03c8('0x1d')][_0x03c8('0x1e')]['id']){db['User'][_0x03c8('0x1f')]({'attributes':['id',_0x03c8('0x6'),'role',_0x03c8('0x20')],'where':{'id':_0x5dabcb[_0x03c8('0x1d')][_0x03c8('0x1e')]['id']},'include':[{'model':db[_0x03c8('0x21')],'as':_0x03c8('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x03c8('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x03c8('0x24')],'as':_0x03c8('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x03c8('0x26')],'as':_0x03c8('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x03c8('0x28')],'as':_0x03c8('0x29'),'attributes':['id'],'raw':!![]}]})[_0x03c8('0xd')](function(_0x237618){if(_0x237618){_0x4122b7=_0x237618;_0x5dabcb[_0x357bb4](util[_0x03c8('0x1b')]('user:%s',_0x237618[_0x03c8('0x6')]));var _0x26c0e0=[];switch(_0x237618['role']){case _0x03c8('0x2a'):_0x5dabcb[_0x357bb4](_0x03c8('0x2b'));_0x5dabcb[_0x357bb4]('voice:outbound');if(queryQueues[_0x03c8('0x2c')]('include')){delete queryQueues[_0x03c8('0x2d')];}_0x26c0e0[_0x03c8('0x2e')](db['VoiceQueue'][_0x03c8('0x11')](queryQueues));_0x26c0e0[_0x03c8('0x2e')](db[_0x03c8('0x2f')]['findAll'](queryQueues));_0x26c0e0[_0x03c8('0x2e')](db['FaxQueue'][_0x03c8('0x11')](queryQueues));_0x26c0e0[_0x03c8('0x2e')](db[_0x03c8('0x30')][_0x03c8('0x11')](queryQueues));_0x26c0e0[_0x03c8('0x2e')](db[_0x03c8('0x31')][_0x03c8('0x11')](queryQueues));_0x26c0e0[_0x03c8('0x2e')](db[_0x03c8('0x32')]['findAll'](queryQueues));_0x26c0e0[_0x03c8('0x2e')](db[_0x03c8('0x5')]['findAll'](queryTelephones));_0x26c0e0[_0x03c8('0x2e')](db[_0x03c8('0x33')][_0x03c8('0x11')](queryTrunks));_0x26c0e0[_0x03c8('0x2e')](db[_0x03c8('0x18')]['findAll'](queryCampaigns));_0x26c0e0['push'](db[_0x03c8('0x5')][_0x03c8('0x11')](queryAgents));break;case _0x03c8('0x34'):_0x5dabcb[_0x357bb4](_0x03c8('0x2b'));_0x5dabcb[_0x357bb4](_0x03c8('0x35'));_0x26c0e0['push'](getAssociatedResources(_0x03c8('0x36'),_0x237618[_0x03c8('0x20')],_0x03c8('0x37')));_0x26c0e0['push'](getAssociatedResources(_0x03c8('0xf'),_0x237618[_0x03c8('0x20')],'ChatQueue'));_0x26c0e0[_0x03c8('0x2e')](getAssociatedResources(_0x03c8('0x38'),_0x237618[_0x03c8('0x20')],'FaxQueue'));_0x26c0e0[_0x03c8('0x2e')](getAssociatedResources(_0x03c8('0x39'),_0x237618[_0x03c8('0x20')],_0x03c8('0x30')));_0x26c0e0[_0x03c8('0x2e')](getAssociatedResources(_0x03c8('0x10'),_0x237618[_0x03c8('0x20')],'MailQueue'));_0x26c0e0[_0x03c8('0x2e')](getAssociatedResources(_0x03c8('0x3a'),_0x237618[_0x03c8('0x20')],_0x03c8('0x32')));_0x26c0e0[_0x03c8('0x2e')](getAssociatedResources('Telephones',_0x237618[_0x03c8('0x20')],'User'));_0x26c0e0['push'](getAssociatedResources(_0x03c8('0x13'),_0x237618[_0x03c8('0x20')],'Trunk'));_0x26c0e0[_0x03c8('0x2e')](getAssociatedResources('IvrCampaigns',_0x237618[_0x03c8('0x20')],_0x03c8('0x18')));_0x26c0e0[_0x03c8('0x2e')](db[_0x03c8('0x5')][_0x03c8('0x11')](queryAgents));break;case _0x03c8('0x8'):_0x5dabcb[_0x357bb4](_0x03c8('0x2b'));_0x5dabcb[_0x357bb4](_0x03c8('0x35'));_0x26c0e0[_0x03c8('0x2e')](_0x237618['getVoiceQueues']({'attributes':['id','name']}));_0x26c0e0[_0x03c8('0x2e')](_0x237618[_0x03c8('0x3b')]({'attributes':['id','name']}));_0x26c0e0[_0x03c8('0x2e')](_0x237618[_0x03c8('0x3c')]({'attributes':['id',_0x03c8('0x6')]}));_0x26c0e0[_0x03c8('0x2e')](_0x237618['getSmsQueues']({'attributes':['id',_0x03c8('0x6')]}));_0x26c0e0['push'](_0x237618[_0x03c8('0x3d')]({'attributes':['id',_0x03c8('0x6')]}));_0x26c0e0[_0x03c8('0x2e')](_0x237618[_0x03c8('0x3e')]({'attributes':['id',_0x03c8('0x6')]}));break;}return BPromise['all'](_0x26c0e0);}})[_0x03c8('0xd')](function(_0x351de9){if(_0x351de9&&_0x351de9[_0x03c8('0x1a')]){for(var _0x3266c9=0x0;_0x3266c9<_0x351de9['length'];_0x3266c9+=0x1){for(var _0x583e8e=0x0;_0x583e8e<_0x351de9[_0x3266c9][_0x03c8('0x1a')];_0x583e8e+=0x1){switch(_0x3266c9){case 0x0:joinOrLeaveQueues(_0x5dabcb,_0x357bb4,_0x03c8('0x3f'),_0x351de9[_0x3266c9][_0x583e8e]);break;case 0x1:joinOrLeaveQueues(_0x5dabcb,_0x357bb4,_0x03c8('0x40'),_0x351de9[_0x3266c9][_0x583e8e]);break;case 0x2:joinOrLeaveQueues(_0x5dabcb,_0x357bb4,_0x03c8('0x41'),_0x351de9[_0x3266c9][_0x583e8e]);break;case 0x3:joinOrLeaveQueues(_0x5dabcb,_0x357bb4,_0x03c8('0x42'),_0x351de9[_0x3266c9][_0x583e8e]);break;case 0x4:joinOrLeaveQueues(_0x5dabcb,_0x357bb4,_0x03c8('0x43'),_0x351de9[_0x3266c9][_0x583e8e]);break;case 0x5:joinOrLeaveQueues(_0x5dabcb,_0x357bb4,_0x03c8('0x44'),_0x351de9[_0x3266c9][_0x583e8e]);break;case 0x6:_0x5dabcb[_0x357bb4](util['format'](_0x03c8('0x45'),_0x351de9[_0x3266c9][_0x583e8e]['name']));break;case 0x7:_0x5dabcb[_0x357bb4](util['format'](_0x03c8('0x46'),_0x351de9[_0x3266c9][_0x583e8e][_0x03c8('0x6')]));break;case 0x8:_0x5dabcb[_0x357bb4](util[_0x03c8('0x1b')](_0x03c8('0x47'),_0x351de9[_0x3266c9][_0x583e8e][_0x03c8('0xa')],_0x351de9[_0x3266c9][_0x583e8e][_0x03c8('0x6')]));break;case 0x9:_0x5dabcb[_0x357bb4](util[_0x03c8('0x1b')](_0x03c8('0x1c'),_0x351de9[_0x3266c9][_0x583e8e][_0x03c8('0x6')]));break;}}}}})[_0x03c8('0xd')](function(){if(_0x357bb4===_0x03c8('0x48')){var _0x56ffd1=_[_0x03c8('0x16')](_0x4122b7['ChatInteractions'],'id');return _0x4122b7[_0x03c8('0x49')](_0x56ffd1)[_0x03c8('0xd')](function(){for(var _0x4c00c9=0x0;_0x4c00c9<_0x56ffd1[_0x03c8('0x1a')];_0x4c00c9+=0x1){_0x27459a['emit'](_0x03c8('0x4a'),{'ChatInteractionId':Number(_0x56ffd1[_0x4c00c9]),'UserId':Number(_0x4122b7['id'])});}});}})['then'](function(){if(_0x357bb4===_0x03c8('0x48')){var _0x79963d=_[_0x03c8('0x16')](_0x4122b7[_0x03c8('0x23')],'id');return _0x4122b7[_0x03c8('0x4b')](_0x79963d)[_0x03c8('0xd')](function(){for(var _0x2178ad=0x0;_0x2178ad<_0x79963d[_0x03c8('0x1a')];_0x2178ad+=0x1){_0x27459a[_0x03c8('0x4c')](_0x03c8('0x4d'),{'MailInteractionId':Number(_0x79963d[_0x2178ad]),'UserId':Number(_0x4122b7['id'])});}});}})[_0x03c8('0xd')](function(){if(_0x357bb4===_0x03c8('0x48')){var _0x292caa=_[_0x03c8('0x16')](_0x4122b7[_0x03c8('0x25')],'id');return _0x4122b7['removeFaxInteractions'](_0x292caa)[_0x03c8('0xd')](function(){for(var _0x180725=0x0;_0x180725<_0x292caa[_0x03c8('0x1a')];_0x180725+=0x1){_0x27459a[_0x03c8('0x4c')](_0x03c8('0x4e'),{'FaxInteractionId':Number(_0x292caa[_0x180725]),'UserId':Number(_0x4122b7['id'])});}});}})['then'](function(){if(_0x357bb4===_0x03c8('0x48')){var _0x269701=_[_0x03c8('0x16')](_0x4122b7[_0x03c8('0x27')],'id');return _0x4122b7[_0x03c8('0x4f')](_0x269701)[_0x03c8('0xd')](function(){for(var _0x59db6d=0x0;_0x59db6d<_0x269701['length'];_0x59db6d+=0x1){_0x27459a['emit'](_0x03c8('0x50'),{'SmsInteractionId':Number(_0x269701[_0x59db6d]),'UserId':Number(_0x4122b7['id'])});}});}})[_0x03c8('0xd')](function(){if(_0x357bb4===_0x03c8('0x48')){var _0x8f4daa=_[_0x03c8('0x16')](_0x4122b7[_0x03c8('0x29')],'id');return _0x4122b7[_0x03c8('0x51')](_0x8f4daa)[_0x03c8('0xd')](function(){for(var _0xf119d4=0x0;_0xf119d4<_0x8f4daa[_0x03c8('0x1a')];_0xf119d4+=0x1){_0x27459a[_0x03c8('0x4c')](_0x03c8('0x52'),{'OpenchannelInteractionId':Number(_0x8f4daa[_0xf119d4]),'UserId':Number(_0x4122b7['id'])});}});}})['catch'](function(_0x53b57b){_0x5dabcb['log'](_0x53b57b);});}}function onDisconnect(_0x190fba,_0x1b7299){joinOrLeave(_0x190fba,_0x03c8('0x48'),_0x1b7299);}function onConnect(_0x333f12){joinOrLeave(_0x333f12,_0x03c8('0x53'));}exports[_0x03c8('0x54')]=function(_0x200665){_0x200665['on']('connection',function(_0x12db7c){_0x12db7c[_0x03c8('0x55')](0x0);_0x12db7c[_0x03c8('0x56')]=_0x12db7c[_0x03c8('0x57')][_0x03c8('0x58')][_0x03c8('0x59')]+':'+_0x12db7c[_0x03c8('0x57')][_0x03c8('0x58')][_0x03c8('0x5a')];_0x12db7c['connectedAt']=new Date();_0x12db7c['log']=function(_0x361d28){console[_0x03c8('0x5b')](_0x03c8('0x5c')+_0x12db7c['nsp'][_0x03c8('0x6')]+'['+_0x12db7c[_0x03c8('0x56')]+']',_0x361d28);};_0x12db7c['on'](_0x03c8('0x5d'),function(){onDisconnect(_0x12db7c,_0x200665);_0x12db7c[_0x03c8('0x5b')](_0x03c8('0x5e'));});onConnect(_0x12db7c);_0x12db7c[_0x03c8('0x5b')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 22310ac..be5472c 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 _0xbb24=['Sms','SmsMessage','newmessage','Fax','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','error','Trigger,\x20%s','catch','get','channel','event','direction','UserId','User','name','format','SIP/%s','incomingmessage','outgoingmessage','opened','closed','find','interface','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','SmsInteraction'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0xbb24,0xc3));var _0x4bb2=function(_0xa5bc0,_0x95212d){_0xa5bc0=_0xa5bc0-0x0;var _0x496e7b=_0xbb24[_0xa5bc0];return _0x496e7b;};'use strict';var util=require(_0x4bb2('0x0'));var db=require(_0x4bb2('0x1'))['db'];var jayson=require(_0x4bb2('0x2'));var logger=require('../logger')(_0x4bb2('0x3'));var client=jayson[_0x4bb2('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x4bb2('0x5'),'model':_0x4bb2('0x6'),'event':_0x4bb2('0x7'),'condition':_0x4bb2('0x8'),'callback':afterCreate},{'channel':_0x4bb2('0x5'),'model':_0x4bb2('0x6'),'event':_0x4bb2('0x9'),'condition':_0x4bb2('0xa'),'callback':afterUpdate},{'channel':_0x4bb2('0x5'),'model':_0x4bb2('0xb'),'event':_0x4bb2('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':_0x4bb2('0xc'),'event':_0x4bb2('0x7'),'condition':_0x4bb2('0x8'),'callback':afterCreate},{'channel':_0x4bb2('0xd'),'model':_0x4bb2('0xc'),'event':_0x4bb2('0x9'),'condition':_0x4bb2('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0x4bb2('0xe'),'event':_0x4bb2('0x7'),'condition':_0x4bb2('0xf'),'callback':afterCreateMessage},{'channel':_0x4bb2('0x10'),'model':'FaxInteraction','event':'afterCreate','condition':_0x4bb2('0x8'),'callback':afterCreate},{'channel':_0x4bb2('0x10'),'model':'FaxInteraction','event':_0x4bb2('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4bb2('0x10'),'model':'FaxMessage','event':'afterCreate','condition':_0x4bb2('0xf'),'callback':afterCreateMessage},{'channel':_0x4bb2('0x11'),'model':_0x4bb2('0x12'),'event':_0x4bb2('0x7'),'condition':_0x4bb2('0x8'),'callback':afterCreate},{'channel':_0x4bb2('0x11'),'model':_0x4bb2('0x12'),'event':_0x4bb2('0x9'),'condition':_0x4bb2('0xa'),'callback':afterUpdate},{'channel':'Mail','model':_0x4bb2('0x13'),'event':_0x4bb2('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x4bb2('0x14'),'event':_0x4bb2('0x7'),'condition':_0x4bb2('0x8'),'callback':afterCreate},{'channel':_0x4bb2('0x15'),'model':_0x4bb2('0x14'),'event':'afterUpdate','condition':_0x4bb2('0xa'),'callback':afterUpdate},{'channel':_0x4bb2('0x15'),'model':_0x4bb2('0x16'),'event':_0x4bb2('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x30b74b){return client[_0x4bb2('0x17')](_0x4bb2('0x18'),_0x30b74b)[_0x4bb2('0x19')](function(_0x1c440f){logger[_0x4bb2('0x1a')]('Trigger,\x20%s',_0x4bb2('0x18'),_0x1c440f);if(_0x1c440f[_0x4bb2('0x1b')]){if(_0x1c440f[_0x4bb2('0x1b')]['code']===0x1f4){logger[_0x4bb2('0x1b')](_0x4bb2('0x1c'),_0x4bb2('0x18'),_0x1c440f['error']);}}})[_0x4bb2('0x1d')](function(_0x1150ec){logger[_0x4bb2('0x1b')](_0x4bb2('0x1c'),_0x4bb2('0x18'),_0x1150ec);});}function afterCreateMessage(_0x3d5e5a,_0x2ff447){return function(_0x34112c,_0x262aba){_0x34112c=_0x34112c[_0x4bb2('0x1e')]({'plain':!![]});_0x34112c[_0x4bb2('0x1f')]=_0x3d5e5a;_0x34112c[_0x4bb2('0x20')]=_0x34112c[_0x4bb2('0x21')];if(_0x34112c[_0x4bb2('0x22')]){return db[_0x4bb2('0x23')]['find']({'where':{'id':_0x34112c[_0x4bb2('0x22')]},'attributes':['id',_0x4bb2('0x24')],'raw':!![]})[_0x4bb2('0x19')](function(_0x13ced0){_0x34112c['interface']=util[_0x4bb2('0x25')](_0x4bb2('0x26'),_0x13ced0[_0x4bb2('0x24')]);_0x34112c[_0x4bb2('0x1f')]=_0x3d5e5a;return request({'event':_0x4bb2('0x27'),'message':_0x34112c});})[_0x4bb2('0x1d')](function(_0x560219){console[_0x4bb2('0x1b')](_0x560219);});}else{return request({'event':_0x4bb2('0x28'),'message':_0x34112c});}};}function afterCreate(_0x13f441,_0x438f8d){return function(_0x1dcfa2,_0x377d2c){_0x1dcfa2=_0x1dcfa2[_0x4bb2('0x1e')]({'plain':!![]});_0x1dcfa2[_0x4bb2('0x1f')]=_0x13f441;_0x1dcfa2[_0x4bb2('0x20')]=_0x4bb2('0x29');return request({'event':_0x438f8d,'message':_0x1dcfa2});};}function afterUpdate(_0x43e0ab,_0x5b041f){return function(_0x599353,_0x2d0432){if(_0x599353['changed'](_0x4bb2('0x2a'))&&_0x599353['closed']){_0x599353=_0x599353[_0x4bb2('0x1e')]({'plain':!![]});_0x599353[_0x4bb2('0x1f')]=_0x43e0ab;_0x599353[_0x4bb2('0x20')]=_0x4bb2('0x2a');if(_0x599353[_0x4bb2('0x22')]){return db[_0x4bb2('0x23')][_0x4bb2('0x2b')]({'where':{'id':_0x599353[_0x4bb2('0x22')]},'attributes':['id',_0x4bb2('0x24')],'raw':!![]})[_0x4bb2('0x19')](function(_0x16fa1d){_0x599353[_0x4bb2('0x2c')]=util['format']('SIP/%s',_0x16fa1d[_0x4bb2('0x24')]);return request({'event':_0x5b041f,'message':_0x599353});})[_0x4bb2('0x1d')](function(_0x23c9ed){console[_0x4bb2('0x1b')](_0x23c9ed);});}else{return request({'event':_0x5b041f,'message':_0x599353});}}};}exports[_0x4bb2('0x2d')]=function(){for(var _0x473563=0x0;_0x473563=_0x4429ab[_0x9c27('0x12')]){throw Error(_0x9c27('0x13'));}_0x58919e(_0x35b69d);})[_0x9c27('0x14')](function(_0x28571f){_0x43590a(_0x28571f);});});}; \ No newline at end of file +var _0xdf0f=['getChannels','isValidChannel','toLowerCase','includes','blockedAt','getLicense','agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel'];(function(_0x35a462,_0x1b69af){var _0x4322b0=function(_0x42290d){while(--_0x42290d){_0x35a462['push'](_0x35a462['shift']());}};_0x4322b0(++_0x1b69af);}(_0xdf0f,0x1af));var _0xfdf0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdf0f[_0x432682];return _0x463d05;};'use strict';var _=require(_0xfdf0('0x0'));var BPromise=require('bluebird');var db=require(_0xfdf0('0x1'))['db'];var util=require(_0xfdf0('0x2'));var channels=[_0xfdf0('0x3'),_0xfdf0('0x4'),_0xfdf0('0x5'),_0xfdf0('0x6'),_0xfdf0('0x7'),_0xfdf0('0x8')];exports[_0xfdf0('0x9')]=function(){return channels;};exports[_0xfdf0('0xa')]=function(_0x372da2){_0x372da2=_0x372da2[_0xfdf0('0xb')]();return _[_0xfdf0('0xc')](channels,_0x372da2);};exports['clearBlockUser']=function(_0x4af522,_0x168f67,_0x35ef4d,_0x10e427){var _0x22c8dc={'loginAttempts':_0x168f67,'blocked':_0x35ef4d};if(!_['isUndefined'](_0x10e427)){_0x22c8dc[_0xfdf0('0xd')]=_0x10e427;}return _0x4af522['updateAttributes'](_0x22c8dc);};exports[_0xfdf0('0xe')]=function(_0x4d8356){return new BPromise(function(_0x544ec1,_0x2106a2){var _0x2fed3e=0x0;if(_0x4d8356['role']!==_0xfdf0('0xf')){_0x544ec1(_0x4d8356);}db[_0xfdf0('0x10')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4d8356['id']}}})[_0xfdf0('0x11')](function(_0x5879e4){_0x2fed3e=_0x5879e4;return util[_0xfdf0('0xe')]();})[_0xfdf0('0x11')](function(_0x282583){if(_0x282583&&_0x282583[_0xfdf0('0x12')]&&_0x2fed3e>=_0x282583[_0xfdf0('0x12')]){throw Error(_0xfdf0('0x13'));}_0x544ec1(_0x4d8356);})['catch'](function(_0x47e2c9){_0x2106a2(_0x47e2c9);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 19f3be1..871fc4d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bcc=['exports','404','status','render','send'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x8bcc,0xd2));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xc8bc('0x0')][0x194]=function pageNotFound(_0x12e611,_0xcb6a5e){var _0x14e3bb=_0xc8bc('0x1');var _0x222b77=0x194;var _0x433c0d={'status':_0x222b77};_0xcb6a5e[_0xc8bc('0x2')](_0x433c0d['status']);_0xcb6a5e[_0xc8bc('0x3')](_0x14e3bb,{},function(_0x4438e9,_0x46424b){if(_0x4438e9){return _0xcb6a5e[_0xc8bc('0x2')](_0x433c0d[_0xc8bc('0x2')])['json'](_0x433c0d);}_0xcb6a5e[_0xc8bc('0x4')](_0x46424b);});}; \ No newline at end of file +var _0x1b31=['404','status','exports'];(function(_0x24a342,_0x51c765){var _0x3c5b0c=function(_0xf1fe19){while(--_0xf1fe19){_0x24a342['push'](_0x24a342['shift']());}};_0x3c5b0c(++_0x51c765);}(_0x1b31,0x1d9));var _0x11b3=function(_0x916fe0,_0x2f0e58){_0x916fe0=_0x916fe0-0x0;var _0x18e8db=_0x1b31[_0x916fe0];return _0x18e8db;};'use strict';module[_0x11b3('0x0')][0x194]=function pageNotFound(_0x1efbf9,_0x422831){var _0x2058c4=_0x11b3('0x1');var _0x446e0b=0x194;var _0x24d106={'status':_0x446e0b};_0x422831[_0x11b3('0x2')](_0x24d106[_0x11b3('0x2')]);_0x422831['render'](_0x2058c4,{},function(_0x3b312b,_0x414d3f){if(_0x3b312b){return _0x422831[_0x11b3('0x2')](_0x24d106[_0x11b3('0x2')])['json'](_0x24d106);}_0x422831['send'](_0x414d3f);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6d817c7..1bed1e9 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5593=['ToMailQueueId','ToMailAccountId','FromChatWebsiteId','FromAccount','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAgent','ToFaxQueueId','ToFaxAccountId','ToAccount','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CmCustomField','Contacts','HopperHistory','voice_queues_has_cm_lists','UserProfileSection','Resources','sectionId','exports','path','sequelize','jstz','defaultsDeep','motion2','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','hasOne','cascade','Recordings','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','MailInteractions','userProfileId','belongsToMany','Groups','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','UserVoiceQueue','MailQueue','UserChatQueue','FaxQueues','SmsQueues','UserOpenchannelQueue','ChatWebsites','user_has_chat_websites','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','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','belongsTo','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','VoiceCallReport','QueueCalls','AgentReports','uniqueid','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Messages','MailApplication','List','TemplateId','team_has_mail_queues','Account','Contact','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','restrict','MailQueueReport','ListId','Dashboard','FaxAccountId','Interactions','FaxApplication','Exntensions','TagId','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','chat_group_has_users','Website','CompanyId','JscriptySessions','SmsInteractions','Company','cm_contact_has_tags','Campaign','CampaignId','Automation','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','MailApplications','ChatApplications','SmsApplications','Schedule','DefaultReportId','Mohs','Trigger','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','CustomReportId','Fields','MetricId','AccountId','SubjectId','Descriptions','Subject','Description','DescriptionId','Field','Variable','VariableId','Configurations','FieldId','Subjects','DeskAccount','int_desk_configuration_has_tags','ZohoAccount','ZohoField','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','int_vtiger_configuration_has_tags','FromId','ToId','SessionId','JscriptyAnswerReport','SmsQueueReport','ProjectId','JscriptyProject','MailQueues','ChatQueues','team_has_sms_queues','HopperBlacks','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromUserId','ToUserId'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x5593,0x1e8));var _0x3559=function(_0x56968c,_0x1e4877){_0x56968c=_0x56968c-0x0;var _0x3e3524=_0x5593[_0x56968c];return _0x3e3524;};'use strict';var path=require(_0x3559('0x0'));var config=require('../config/environment');var Sequelize=require(_0x3559('0x1'));var _=require('lodash');var jstz=require(_0x3559('0x2'));var timezone=jstz['determine']();config[_0x3559('0x1')]=_[_0x3559('0x3')](config[_0x3559('0x1')],{'database':_0x3559('0x4'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x3559('0x5'),'port':0xcea,'dialect':_0x3559('0x6'),'dialectOptions':{'charset':_0x3559('0x7')},'logging':![],'timezone':timezone[_0x3559('0x8')](),'define':{'charset':_0x3559('0x9'),'collate':_0x3559('0xa')}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0x3559('0xb')],{'database':_0x3559('0x4'),'username':_0x3559('0xc'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3559('0x6'),'dialectOptions':{'charset':_0x3559('0x7')},'logging':![],'timezone':timezone[_0x3559('0x8')](),'define':{'charset':_0x3559('0x9'),'collate':_0x3559('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x3559('0xd')],config[_0x3559('0x1')]['username'],config['sequelize'][_0x3559('0xe')],config[_0x3559('0x1')][_0x3559('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x3559('0xd')],config[_0x3559('0xb')][_0x3559('0x10')],config[_0x3559('0xb')][_0x3559('0xe')],config[_0x3559('0xb')][_0x3559('0xf')])};db[_0x3559('0x11')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x13'));db[_0x3559('0x14')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x15'));db[_0x3559('0x16')]=db[_0x3559('0x1')]['import'](_0x3559('0x17'));db[_0x3559('0x18')]=db[_0x3559('0x1')]['import']('../api/voiceExtension/voiceExtension.model');db[_0x3559('0x19')]=db['sequelize']['import'](_0x3559('0x1a'));db[_0x3559('0x1b')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x1c'));db[_0x3559('0x1d')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x1e'));db[_0x3559('0x1f')]=db['sequelize']['import'](_0x3559('0x20'));db[_0x3559('0x21')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/voiceMail/voiceMail.model');db[_0x3559('0x22')]=db['sequelize'][_0x3559('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x3559('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x3559('0x23')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x24'));db[_0x3559('0x25')]=db[_0x3559('0x1')]['import'](_0x3559('0x26'));db[_0x3559('0x27')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x28'));db[_0x3559('0x29')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/memberReport/memberReport.model');db[_0x3559('0x2a')]=db[_0x3559('0x1')]['import']('../api/trunk/trunk.model');db[_0x3559('0x2b')]=db[_0x3559('0x1')]['import'](_0x3559('0x2c'));db[_0x3559('0x2d')]=db[_0x3559('0x1')]['import'](_0x3559('0x2e'));db['UserVoiceQueue']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x2f'));db[_0x3559('0x30')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x31'));db[_0x3559('0x32')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x33'));db[_0x3559('0x34')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x35'));db['UserOpenchannelQueue']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x36'));db[_0x3559('0x37')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x38'));db[_0x3559('0x39')]=db['sequelize'][_0x3559('0x12')]('../api/mailServerOut/mailServerOut.model');db[_0x3559('0x3a')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x3b'));db['MailQueue']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x3c'));db[_0x3559('0x3d')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3559('0x3e')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x3f'));db[_0x3559('0x40')]=db['sequelize']['import'](_0x3559('0x41'));db['MailApplication']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x42'));db['MailQueueReport']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x43'));db['Dashboard']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x44'));db[_0x3559('0x45')]=db['sequelize']['import'](_0x3559('0x46'));db[_0x3559('0x47')]=db['sequelize']['import']('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/faxApplication/faxApplication.model');db[_0x3559('0x48')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0x3559('0x49')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x4a'));db[_0x3559('0x4b')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x4c'));db[_0x3559('0x4d')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x4e'));db['SmsAccount']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x4f'));db['SmsApplication']=db['sequelize'][_0x3559('0x12')](_0x3559('0x50'));db[_0x3559('0x51')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x52'));db[_0x3559('0x53')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x54'));db[_0x3559('0x55')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/smsQueue/smsQueue.model');db[_0x3559('0x56')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x57'));db['OpenchannelApplication']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x3559('0x12')](_0x3559('0x58'));db[_0x3559('0x59')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x5a'));db[_0x3559('0x5b')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x5c'));db[_0x3559('0x5d')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x5e'));db[_0x3559('0x5f')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x60'));db[_0x3559('0x61')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x62'));db[_0x3559('0x63')]=db[_0x3559('0x1')]['import'](_0x3559('0x64'));db[_0x3559('0x65')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x66'));db[_0x3559('0x67')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x68'));db[_0x3559('0x69')]=db[_0x3559('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x3559('0x6a')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/chatGroup/chatGroup.model');db[_0x3559('0x6b')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x6c'));db[_0x3559('0x6d')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x6e'));db[_0x3559('0x6f')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x70'));db['CmHopper']=db[_0x3559('0x1')]['import'](_0x3559('0x71'));db[_0x3559('0x72')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x73'));db[_0x3559('0x74')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x75'));db[_0x3559('0x76')]=db[_0x3559('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x3559('0x77')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x78'));db['CmCustomField']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x79'));db[_0x3559('0x7a')]=db[_0x3559('0x1')]['import'](_0x3559('0x7b'));db['Automation']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/automation/automation.model');db[_0x3559('0x7c')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x7d'));db[_0x3559('0x7e')]=db[_0x3559('0x1')]['import'](_0x3559('0x7f'));db[_0x3559('0x80')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x81'));db['Interval']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x82'));db[_0x3559('0x83')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x84'));db[_0x3559('0x85')]=db[_0x3559('0x1')]['import'](_0x3559('0x86'));db[_0x3559('0x87')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x88'));db['Schedule']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/schedule/schedule.model');db[_0x3559('0x89')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x8a'));db[_0x3559('0x8b')]=db['sequelize']['import'](_0x3559('0x8c'));db[_0x3559('0x8d')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x8e'));db['Trigger']=db[_0x3559('0x1')]['import'](_0x3559('0x8f'));db['Variable']=db[_0x3559('0x1')]['import']('../api/variable/variable.model');db[_0x3559('0x90')]=db['sequelize'][_0x3559('0x12')](_0x3559('0x91'));db[_0x3559('0x92')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x93'));db[_0x3559('0x94')]=db[_0x3559('0x1')]['import'](_0x3559('0x95'));db[_0x3559('0x96')]=db[_0x3559('0x1')]['import'](_0x3559('0x97'));db[_0x3559('0x98')]=db[_0x3559('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x3559('0x99')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x9a'));db[_0x3559('0x9b')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0x9c'));db[_0x3559('0x9d')]=db['sequelize'][_0x3559('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x3559('0x9e')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x3559('0x9f')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xa0'));db[_0x3559('0xa1')]=db['sequelize']['import'](_0x3559('0xa2'));db[_0x3559('0xa3')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x3559('0xa4')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xa5'));db[_0x3559('0xa6')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xa7'));db['DeskAccount']=db[_0x3559('0x1')]['import'](_0x3559('0xa8'));db[_0x3559('0xa9')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xaa'));db[_0x3559('0xab')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xac'));db['ZohoAccount']=db[_0x3559('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0x3559('0xad')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xae'));db['ZohoField']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x3559('0xaf')]=db[_0x3559('0x1')]['import'](_0x3559('0xb0'));db['ZendeskField']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0x3559('0xb1')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xb2'));db[_0x3559('0xb3')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xb4'));db[_0x3559('0xb5')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xb6'));db[_0x3559('0xb7')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xb8'));db[_0x3559('0xb9')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xba'));db[_0x3559('0xbb')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xbc'));db[_0x3559('0xbd')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x3559('0xbe')]=db['sequelize'][_0x3559('0x12')](_0x3559('0xbf'));db[_0x3559('0xc0')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xc1'));db[_0x3559('0xc2')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xc3'));db[_0x3559('0xc4')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xc5'));db[_0x3559('0xc6')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xc7'));db['Integration']=db[_0x3559('0x1')]['import']('../api/integration/integration.model');db['Network']=db[_0x3559('0x1')]['import'](_0x3559('0xc8'));db[_0x3559('0xc9')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xca'));db[_0x3559('0xcb')]=db['sequelize'][_0x3559('0x12')](_0x3559('0xcc'));db['JscriptyAnswerReport']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x3559('0xcd')]=db['sequelize']['import'](_0x3559('0xce'));db[_0x3559('0xcf')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xd0'));db['SmsQueueReport']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xd1'));db[_0x3559('0xd2')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xd3'));db[_0x3559('0xd4')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0x3559('0x1')]['import'](_0x3559('0xd5'));db['Setting']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/setting/setting.model');db[_0x3559('0xd6')]=db['sequelize'][_0x3559('0x12')](_0x3559('0xd7'));db[_0x3559('0xd8')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/squareProject/squareProject.model');db[_0x3559('0xd9')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xda'));db[_0x3559('0xdb')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xdc'));db[_0x3559('0xdd')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/team/team.model');db[_0x3559('0xde')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xdf'));db['Campaign']=db['sequelize']['import'](_0x3559('0xe0'));db[_0x3559('0xe1')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xe2'));db[_0x3559('0xe3')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xe4'));db[_0x3559('0xe5')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xe6'));db['MailTransferReport']=db[_0x3559('0x1')][_0x3559('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x3559('0xe7')]=db[_0x3559('0x1')]['import'](_0x3559('0xe8'));db[_0x3559('0xe9')]=db['sequelize'][_0x3559('0x12')](_0x3559('0xea'));db[_0x3559('0xeb')]=db['sequelize'][_0x3559('0x12')](_0x3559('0xec'));db['SmsTransferReport']=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xed'));db[_0x3559('0xee')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xef'));db[_0x3559('0xf0')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x3559('0xf1')]=db[_0x3559('0x1')][_0x3559('0x12')](_0x3559('0xf2'));db['UserProfileSection']=db['sequelize']['import']('../api/userProfileSection/userProfileSection.model');db[_0x3559('0xf3')]=db[_0x3559('0x1')][_0x3559('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x3559('0x11')][_0x3559('0xf4')](db[_0x3559('0x21')],{'as':_0x3559('0x21'),'onDelete':_0x3559('0xf5'),'foreignKey':'UserId'});db[_0x3559('0x11')]['hasMany'](db[_0x3559('0x1d')],{'as':_0x3559('0xf6'),'foreignKey':_0x3559('0xf7')});db[_0x3559('0x11')][_0x3559('0xf8')](db[_0x3559('0x2d')],{'as':_0x3559('0xf9'),'foreignKey':_0x3559('0xf7')});db['User']['hasMany'](db[_0x3559('0x18')],{'as':_0x3559('0xfa'),'onDelete':_0x3559('0xf5'),'hooks':!![]});db[_0x3559('0x11')][_0x3559('0xf8')](db[_0x3559('0x74')],{'as':_0x3559('0xfb'),'foreignKey':_0x3559('0xf7')});db['User'][_0x3559('0xf8')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x3559('0xf7')});db[_0x3559('0x11')][_0x3559('0xf8')](db[_0x3559('0x77')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db['User'][_0x3559('0xf8')](db[_0x3559('0xfc')],{'as':_0x3559('0xfd'),'foreignKey':'UserId'});db['User'][_0x3559('0xf8')](db['ChatInteraction'],{'as':_0x3559('0xfe'),'foreignKey':_0x3559('0xf7')});db[_0x3559('0x11')]['hasMany'](db[_0x3559('0x51')],{'as':'SmsInteractions','foreignKey':_0x3559('0xf7')});db[_0x3559('0x11')][_0x3559('0xf8')](db[_0x3559('0x48')],{'as':'FaxInteractions','foreignKey':_0x3559('0xf7')});db['User'][_0x3559('0xf8')](db[_0x3559('0x3e')],{'as':_0x3559('0xff'),'foreignKey':_0x3559('0xf7')});db[_0x3559('0x11')]['belongsTo'](db[_0x3559('0xf1')],{'as':_0x3559('0xf1'),'foreignKey':_0x3559('0x100')});db['User'][_0x3559('0x101')](db[_0x3559('0x6a')],{'as':_0x3559('0x102'),'through':'chat_group_has_users'});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0x6f')],{'as':'Contacts','through':_0x3559('0x103')});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0xee')],{'as':'Lists','through':_0x3559('0x104')});db['User'][_0x3559('0x101')](db[_0x3559('0xdd')],{'through':_0x3559('0x105')});db['User'][_0x3559('0x101')](db[_0x3559('0x3e')],{'as':_0x3559('0xff'),'through':'user_has_mail_interactions'});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0x63')],{'as':'ChatInteractions','through':_0x3559('0x106')});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0x48')],{'as':_0x3559('0x107'),'through':_0x3559('0x108')});db[_0x3559('0x11')][_0x3559('0x101')](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0xfc')],{'as':_0x3559('0xfd'),'through':_0x3559('0x109')});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0x1b')],{'as':_0x3559('0x10a'),'through':_0x3559('0x10b'),'required':![]});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0x10c')],{'as':'MailQueues','through':_0x3559('0x30'),'required':![]});db[_0x3559('0x11')][_0x3559('0x101')](db['ChatQueue'],{'as':'ChatQueues','through':_0x3559('0x10d'),'required':![],'hooks':!![]});db[_0x3559('0x11')]['belongsToMany'](db[_0x3559('0x4b')],{'as':_0x3559('0x10e'),'through':_0x3559('0x32'),'required':![]});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0x55')],{'as':_0x3559('0x10f'),'through':_0x3559('0x34'),'required':![]});db['User']['belongsToMany'](db[_0x3559('0x5b')],{'as':'OpenchannelQueues','through':_0x3559('0x110'),'required':![]});db[_0x3559('0x11')]['belongsToMany'](db[_0x3559('0xee')],{'through':_0x3559('0x104')});db[_0x3559('0x11')]['belongsToMany'](db[_0x3559('0xf0')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0x5d')],{'as':_0x3559('0x111'),'through':_0x3559('0x112')});db[_0x3559('0x11')][_0x3559('0x101')](db['FaxAccount'],{'as':_0x3559('0x113'),'through':_0x3559('0x114')});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0x3a')],{'as':_0x3559('0x115'),'through':_0x3559('0x116')});db[_0x3559('0x11')]['belongsToMany'](db[_0x3559('0x56')],{'as':'OpenchannelAccounts','through':_0x3559('0x117')});db['User'][_0x3559('0x101')](db[_0x3559('0x118')],{'as':_0x3559('0x119'),'through':_0x3559('0x11a')});db[_0x3559('0x11')][_0x3559('0x101')](db[_0x3559('0xd8')],{'as':'SquareProjects','through':_0x3559('0x11b')});db[_0x3559('0x14')][_0x3559('0xf8')](db['VoiceExtension'],{'as':_0x3559('0x11c'),'onDelete':_0x3559('0xf5'),'foreignKey':'ChanSpyId'});db[_0x3559('0x16')][_0x3559('0xf8')](db[_0x3559('0x18')],{'onDelete':_0x3559('0xf5')});db['VoiceExtension'][_0x3559('0xf8')](db[_0x3559('0x18')],{'as':_0x3559('0x11d'),'onDelete':_0x3559('0xf5')});db[_0x3559('0x19')][_0x3559('0x101')](db[_0x3559('0x89')],{'as':_0x3559('0x11e'),'through':_0x3559('0x11f')});db[_0x3559('0x1b')][_0x3559('0xf8')](db[_0x3559('0x2d')],{'as':_0x3559('0x120'),'foreignKey':_0x3559('0x121')});db[_0x3559('0x1b')][_0x3559('0xf8')](db[_0x3559('0x122')],{'as':_0x3559('0x123'),'foreignKey':_0x3559('0x121')});db[_0x3559('0x1b')][_0x3559('0xf8')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x3559('0x76')],{'as':_0x3559('0x124'),'foreignKey':_0x3559('0x121')});db[_0x3559('0x1b')][_0x3559('0xf8')](db[_0x3559('0x77')],{'as':_0x3559('0x77'),'foreignKey':_0x3559('0x121')});db[_0x3559('0x1b')][_0x3559('0xf8')](db[_0x3559('0x72')],{'as':'HopperBlacks','foreignKey':_0x3559('0x121')});db['VoiceQueue'][_0x3559('0xf8')](db[_0x3559('0xcf')],{'as':'JscriptySessions','foreignKey':_0x3559('0x121')});db['VoiceQueue'][_0x3559('0x125')](db['Trunk'],{'as':_0x3559('0x2a'),'foreignKey':'TrunkId'});db[_0x3559('0x1b')][_0x3559('0x125')](db[_0x3559('0x2a')],{'as':_0x3559('0x126'),'foreignKey':_0x3559('0x127')});db[_0x3559('0x1b')][_0x3559('0x125')](db[_0x3559('0x128')],{'as':_0x3559('0x128'),'foreignKey':_0x3559('0x129')});db[_0x3559('0x1b')]['belongsTo'](db['Pause'],{'as':_0x3559('0x12a'),'foreignKey':_0x3559('0x12b')});db[_0x3559('0x1b')][_0x3559('0x101')](db[_0x3559('0xee')],{'as':_0x3559('0x12c'),'through':'voice_queues_has_cm_lists'});db[_0x3559('0x1b')]['belongsToMany'](db[_0x3559('0x11')],{'as':_0x3559('0x12d'),'through':_0x3559('0x10b')});db[_0x3559('0x1b')]['belongsToMany'](db['Team'],{'as':_0x3559('0x12e'),'through':_0x3559('0x12f')});db[_0x3559('0x1b')][_0x3559('0x101')](db[_0x3559('0xee')],{'as':_0x3559('0x130'),'through':_0x3559('0x131')});db[_0x3559('0x1d')][_0x3559('0x125')](db[_0x3559('0x11')],{'as':'User','foreignKey':'UserId'});db[_0x3559('0x1f')]['belongsTo'](db['User'],{'as':'User','foreignKey':'UserId'});db['VoiceMail'][_0x3559('0xf8')](db[_0x3559('0x22')],{'as':'Messages','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x132'),'sourceKey':_0x3559('0x133')});db['VoiceMailMessage']['belongsTo'](db[_0x3559('0x21')],{'foreignKey':_0x3559('0x132'),'targetKey':_0x3559('0x133')});db[_0x3559('0x134')]['hasMany'](db[_0x3559('0x27')],{'as':_0x3559('0x135'),'foreignKey':'uniqueid','constraints':![]});db[_0x3559('0x134')][_0x3559('0xf8')](db[_0x3559('0x25')],{'as':_0x3559('0x136'),'foreignKey':_0x3559('0x137'),'constraints':![]});db[_0x3559('0x134')][_0x3559('0x125')](db[_0x3559('0x11')],{'as':_0x3559('0x11'),'foreignKey':'UserId'});db[_0x3559('0x134')][_0x3559('0x125')](db[_0x3559('0x6f')],{'as':'Contact','foreignKey':_0x3559('0x138')});db[_0x3559('0x37')][_0x3559('0x125')](db[_0x3559('0x3a')],{'as':_0x3559('0x3a'),'foreignKey':_0x3559('0x139')});db['MailServerOut']['belongsTo'](db[_0x3559('0x3a')],{'as':_0x3559('0x3a'),'foreignKey':_0x3559('0x139')});db[_0x3559('0x3a')]['hasOne'](db['MailServerIn'],{'as':_0x3559('0x13a'),'onDelete':_0x3559('0xf5')});db['MailAccount'][_0x3559('0xf4')](db[_0x3559('0x39')],{'as':_0x3559('0x13b'),'onDelete':_0x3559('0xf5')});db['MailAccount'][_0x3559('0xf8')](db[_0x3559('0x7e')],{'as':_0x3559('0x13c'),'foreignKey':_0x3559('0x139')});db['MailAccount'][_0x3559('0xf8')](db[_0x3559('0x7c')],{'as':_0x3559('0x13d'),'foreignKey':_0x3559('0x139')});db[_0x3559('0x3a')][_0x3559('0xf8')](db[_0x3559('0x40')],{'as':_0x3559('0x13e'),'foreignKey':_0x3559('0x139')});db[_0x3559('0x3a')]['hasMany'](db[_0x3559('0x3e')],{'as':'Interactions'});db[_0x3559('0x3a')][_0x3559('0xf8')](db[_0x3559('0x13f')],{'as':_0x3559('0x11d')});db[_0x3559('0x3a')][_0x3559('0x125')](db[_0x3559('0xee')],{'as':_0x3559('0x140'),'foreignKey':'ListId'});db['MailAccount'][_0x3559('0x125')](db['Template'],{'as':_0x3559('0x8d'),'foreignKey':_0x3559('0x141')});db[_0x3559('0x3a')][_0x3559('0x125')](db[_0x3559('0x83')],{'as':_0x3559('0x12a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3559('0x3a')]['belongsToMany'](db[_0x3559('0x11')],{'as':'Agents','through':_0x3559('0x116')});db['MailQueue'][_0x3559('0x101')](db['User'],{'as':_0x3559('0x12d'),'through':_0x3559('0x30')});db[_0x3559('0x10c')]['belongsToMany'](db[_0x3559('0xdd')],{'through':_0x3559('0x142'),'as':_0x3559('0x12e')});db[_0x3559('0x3e')][_0x3559('0xf8')](db['MailMessage'],{'as':_0x3559('0x13e'),'onDelete':_0x3559('0xf5'),'foreignKey':'MailInteractionId'});db[_0x3559('0x3e')][_0x3559('0x125')](db[_0x3559('0x3a')],{'as':_0x3559('0x143'),'foreignKey':'MailAccountId'});db[_0x3559('0x3e')][_0x3559('0x125')](db[_0x3559('0x6f')],{'as':_0x3559('0x144'),'foreignKey':_0x3559('0x138')});db[_0x3559('0x3e')][_0x3559('0x125')](db[_0x3559('0x11')],{'as':'Owner','foreignKey':_0x3559('0xf7')});db[_0x3559('0x3e')][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':_0x3559('0x145'),'as':_0x3559('0x146')});db['MailInteraction'][_0x3559('0x101')](db['Tag'],{'through':_0x3559('0x145'),'as':_0x3559('0x147')});db[_0x3559('0x3e')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x148'),'through':_0x3559('0x149'),'foreignKey':_0x3559('0x14a')});db[_0x3559('0x40')][_0x3559('0xf8')](db[_0x3559('0xe3')],{'as':_0x3559('0x14b'),'onDelete':'cascade'});db[_0x3559('0x40')][_0x3559('0x125')](db[_0x3559('0x11')],{'as':_0x3559('0x11')});db[_0x3559('0x40')]['belongsTo'](db['CmContact'],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x144')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':_0x3559('0x14c'),'foreignKey':'MailInteractionId'});db[_0x3559('0x40')][_0x3559('0x125')](db['MailAccount'],{'as':_0x3559('0x143'),'foreignKey':_0x3559('0x139')});db['MailApplication']['belongsTo'](db['User'],{'onDelete':_0x3559('0x14d')});db[_0x3559('0x13f')][_0x3559('0x125')](db['MailQueue'],{'onDelete':_0x3559('0x14d')});db['MailApplication'][_0x3559('0x125')](db[_0x3559('0x3a')],{'onDelete':'restrict'});db[_0x3559('0x13f')][_0x3559('0x125')](db[_0x3559('0x128')],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x129')});db[_0x3559('0x13f')][_0x3559('0x125')](db['Tag'],{'onDelete':_0x3559('0x14d'),'foreignKey':'TagId'});db[_0x3559('0x14e')][_0x3559('0x125')](db[_0x3559('0x3a')],{});db['MailQueueReport'][_0x3559('0x125')](db['CmList'],{'as':_0x3559('0x140'),'foreignKey':_0x3559('0x14f')});db[_0x3559('0x14e')][_0x3559('0x125')](db[_0x3559('0x6f')],{'as':_0x3559('0x144'),'foreignKey':'ContactId'});db[_0x3559('0x14e')]['belongsTo'](db[_0x3559('0x3e')],{});db[_0x3559('0x14e')][_0x3559('0x125')](db[_0x3559('0x40')],{});db['MailQueueReport'][_0x3559('0x125')](db[_0x3559('0x11')],{});db[_0x3559('0x14e')][_0x3559('0x125')](db['MailQueue'],{});db[_0x3559('0x150')][_0x3559('0xf8')](db[_0x3559('0x45')],{'as':'Items','onDelete':_0x3559('0xf5')});db[_0x3559('0x47')][_0x3559('0xf8')](db[_0x3559('0x7e')],{'as':_0x3559('0x13c'),'foreignKey':_0x3559('0x151')});db[_0x3559('0x47')][_0x3559('0xf8')](db['CannedAnswer'],{'as':_0x3559('0x13d'),'foreignKey':_0x3559('0x151')});db[_0x3559('0x47')][_0x3559('0xf8')](db[_0x3559('0x48')],{'as':_0x3559('0x152')});db[_0x3559('0x47')][_0x3559('0xf8')](db[_0x3559('0x153')],{'as':_0x3559('0x11d')});db['FaxAccount'][_0x3559('0xf8')](db['VoiceExtension'],{'as':_0x3559('0x154'),'onDelete':_0x3559('0xf5')});db[_0x3559('0x47')][_0x3559('0xf8')](db['FaxMessage'],{'as':_0x3559('0x13e')});db['FaxAccount']['belongsTo'](db['Trunk'],{'as':'Trunk'});db['FaxAccount']['belongsTo'](db[_0x3559('0xee')],{'as':_0x3559('0x140'),'foreignKey':_0x3559('0x14f')});db[_0x3559('0x47')][_0x3559('0x125')](db[_0x3559('0x83')],{'as':_0x3559('0x12a'),'foreignKey':_0x3559('0x12b')});db['FaxAccount']['belongsToMany'](db[_0x3559('0x11')],{'as':_0x3559('0x12d'),'through':_0x3559('0x114')});db[_0x3559('0x153')][_0x3559('0x125')](db[_0x3559('0x11')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0x3559('0x4b')],{'onDelete':'restrict'});db[_0x3559('0x153')][_0x3559('0x125')](db['FaxAccount'],{'onDelete':_0x3559('0x14d')});db[_0x3559('0x153')][_0x3559('0x125')](db['Tag'],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x155')});db['FaxInteraction'][_0x3559('0xf8')](db[_0x3559('0x49')],{'as':'Messages','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x156')});db[_0x3559('0x48')][_0x3559('0x125')](db[_0x3559('0x47')],{'as':_0x3559('0x143'),'foreignKey':'FaxAccountId'});db[_0x3559('0x48')]['belongsTo'](db[_0x3559('0x6f')],{'as':'Contact','foreignKey':_0x3559('0x138')});db[_0x3559('0x48')][_0x3559('0x125')](db[_0x3559('0x11')],{'as':_0x3559('0x157'),'foreignKey':_0x3559('0xf7')});db['FaxInteraction']['belongsToMany'](db[_0x3559('0x8b')],{'through':'fax_interaction_has_tags','as':_0x3559('0x146')});db[_0x3559('0x48')][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':_0x3559('0x158'),'as':_0x3559('0x147')});db['FaxInteraction'][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x148'),'through':_0x3559('0x108'),'foreignKey':_0x3559('0x156')});db[_0x3559('0x49')][_0x3559('0x125')](db['User'],{'onDelete':'cascade','as':'User'});db[_0x3559('0x49')]['belongsTo'](db['FaxInteraction'],{'as':_0x3559('0x14c'),'foreignKey':_0x3559('0x156')});db[_0x3559('0x49')][_0x3559('0x125')](db[_0x3559('0x6f')],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x144')});db[_0x3559('0x49')][_0x3559('0x125')](db['Attachment'],{'as':_0x3559('0xe3'),'foreignKey':_0x3559('0x159')});db[_0x3559('0x49')][_0x3559('0x125')](db[_0x3559('0x47')],{'as':_0x3559('0x143'),'foreignKey':_0x3559('0x151')});db[_0x3559('0x4b')][_0x3559('0x101')](db['User'],{'as':_0x3559('0x12d'),'through':_0x3559('0x32')});db[_0x3559('0x4b')][_0x3559('0x101')](db[_0x3559('0xdd')],{'through':_0x3559('0x15a'),'as':_0x3559('0x12e')});db[_0x3559('0x4d')][_0x3559('0x125')](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db[_0x3559('0xee')],{'as':_0x3559('0x140'),'foreignKey':_0x3559('0x14f')});db['FaxQueueReport'][_0x3559('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x3559('0x138')});db[_0x3559('0x4d')][_0x3559('0x125')](db[_0x3559('0x48')],{});db[_0x3559('0x4d')][_0x3559('0x125')](db['FaxMessage'],{});db['FaxQueueReport']['belongsTo'](db[_0x3559('0x11')],{});db[_0x3559('0x4d')][_0x3559('0x125')](db['FaxQueue'],{});db['SmsAccount'][_0x3559('0xf8')](db[_0x3559('0x7e')],{'as':_0x3559('0x13c'),'foreignKey':_0x3559('0x15b')});db[_0x3559('0x118')][_0x3559('0xf8')](db['CannedAnswer'],{'as':_0x3559('0x13d'),'foreignKey':_0x3559('0x15b')});db[_0x3559('0x118')][_0x3559('0xf8')](db[_0x3559('0x53')],{'as':_0x3559('0x13e'),'foreignKey':'SmsAccountId'});db[_0x3559('0x118')][_0x3559('0xf8')](db[_0x3559('0x51')],{'as':_0x3559('0x152')});db[_0x3559('0x118')]['hasMany'](db[_0x3559('0x15c')],{'as':'Applications'});db[_0x3559('0x118')][_0x3559('0x125')](db[_0x3559('0xee')],{'as':'List','foreignKey':_0x3559('0x14f')});db[_0x3559('0x118')][_0x3559('0x125')](db[_0x3559('0x83')],{'as':_0x3559('0x12a'),'foreignKey':_0x3559('0x12b')});db[_0x3559('0x118')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x3559('0x11a')});db[_0x3559('0x15c')][_0x3559('0x125')](db[_0x3559('0x11')],{'onDelete':_0x3559('0x14d')});db['SmsApplication']['belongsTo'](db[_0x3559('0x55')],{'onDelete':_0x3559('0x14d')});db[_0x3559('0x15c')][_0x3559('0x125')](db['SmsAccount'],{'onDelete':_0x3559('0x14d')});db['SmsApplication']['belongsTo'](db[_0x3559('0x128')],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x129')});db[_0x3559('0x15c')][_0x3559('0x125')](db['Tag'],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x155')});db[_0x3559('0x51')][_0x3559('0xf8')](db[_0x3559('0x53')],{'as':_0x3559('0x13e'),'onDelete':'cascade','foreignKey':_0x3559('0x15d')});db[_0x3559('0x51')][_0x3559('0x125')](db[_0x3559('0x118')],{'as':_0x3559('0x143'),'foreignKey':'SmsAccountId'});db[_0x3559('0x51')][_0x3559('0x125')](db[_0x3559('0x6f')],{'as':'Contact','foreignKey':_0x3559('0x138')});db[_0x3559('0x51')][_0x3559('0x125')](db['User'],{'as':_0x3559('0x157'),'foreignKey':'UserId'});db[_0x3559('0x51')][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':_0x3559('0x15e'),'as':'Tags'});db[_0x3559('0x51')][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':_0x3559('0x15e'),'as':_0x3559('0x147')});db[_0x3559('0x51')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x148'),'through':'user_has_sms_interactions','foreignKey':_0x3559('0x15d')});db[_0x3559('0x53')][_0x3559('0x125')](db[_0x3559('0x11')],{'as':_0x3559('0x11')});db[_0x3559('0x53')][_0x3559('0x125')](db[_0x3559('0x6f')],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x144')});db[_0x3559('0x53')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x14c'),'foreignKey':_0x3559('0x15d')});db[_0x3559('0x53')]['belongsTo'](db[_0x3559('0x118')],{'as':_0x3559('0x143'),'foreignKey':'SmsAccountId'});db[_0x3559('0x55')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':'Agents','through':_0x3559('0x34'),'foreignKey':_0x3559('0x15f')});db[_0x3559('0x55')]['belongsToMany'](db[_0x3559('0xdd')],{'through':'team_has_sms_queues','as':_0x3559('0x12e')});db[_0x3559('0x56')][_0x3559('0xf8')](db[_0x3559('0x7e')],{'as':_0x3559('0x13c'),'foreignKey':_0x3559('0x160')});db[_0x3559('0x56')][_0x3559('0xf8')](db[_0x3559('0x7c')],{'as':_0x3559('0x13d'),'foreignKey':'OpenchannelAccountId'});db[_0x3559('0x56')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x3559('0x152'),'foreignKey':'OpenchannelAccountId'});db[_0x3559('0x56')][_0x3559('0xf8')](db[_0x3559('0x59')],{'as':_0x3559('0x13e'),'foreignKey':'OpenchannelAccountId'});db[_0x3559('0x56')]['hasMany'](db[_0x3559('0x161')],{'as':_0x3559('0x11d'),'foreignKey':_0x3559('0x160')});db[_0x3559('0x56')][_0x3559('0x125')](db[_0x3559('0xee')],{'as':_0x3559('0x140'),'foreignKey':_0x3559('0x14f')});db['OpenchannelAccount'][_0x3559('0x125')](db[_0x3559('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x3559('0x12b')});db[_0x3559('0x56')]['belongsToMany'](db[_0x3559('0x11')],{'as':_0x3559('0x12d'),'through':_0x3559('0x117')});db['OpenchannelApplication'][_0x3559('0x125')](db[_0x3559('0x11')],{'onDelete':_0x3559('0x14d')});db[_0x3559('0x161')]['belongsTo'](db[_0x3559('0x5b')],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x162')});db[_0x3559('0x161')][_0x3559('0x125')](db[_0x3559('0x56')],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x160')});db[_0x3559('0x161')][_0x3559('0x125')](db['Interval'],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x129')});db['OpenchannelApplication'][_0x3559('0x125')](db[_0x3559('0x8b')],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x155')});db[_0x3559('0xfc')][_0x3559('0xf8')](db[_0x3559('0x59')],{'as':'Messages','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x163')});db[_0x3559('0xfc')][_0x3559('0x125')](db[_0x3559('0x56')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x3559('0xfc')][_0x3559('0x125')](db[_0x3559('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x3559('0xfc')]['belongsTo'](db['User'],{'as':_0x3559('0x157'),'foreignKey':'UserId'});db[_0x3559('0xfc')][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':'openchannel_interaction_has_tags','as':_0x3559('0x146')});db[_0x3559('0xfc')]['belongsToMany'](db[_0x3559('0x8b')],{'through':_0x3559('0x164'),'as':'ThroughTags'});db[_0x3559('0xfc')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x148'),'through':_0x3559('0x109'),'foreignKey':_0x3559('0x163')});db[_0x3559('0x59')][_0x3559('0x125')](db['User'],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x11')});db[_0x3559('0x59')][_0x3559('0x125')](db[_0x3559('0x6f')],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x144')});db[_0x3559('0x59')]['belongsTo'](db[_0x3559('0xfc')],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x14c'),'foreignKey':'OpenchannelInteractionId'});db[_0x3559('0x59')][_0x3559('0x125')](db['Attachment'],{'as':_0x3559('0xe3'),'foreignKey':_0x3559('0x159')});db[_0x3559('0x59')][_0x3559('0x125')](db[_0x3559('0x56')],{'as':'Account','foreignKey':_0x3559('0x160')});db[_0x3559('0x5b')]['belongsToMany'](db['User'],{'as':_0x3559('0x12d'),'through':_0x3559('0x110'),'foreignKey':_0x3559('0x162')});db[_0x3559('0x5b')][_0x3559('0x101')](db['Team'],{'through':_0x3559('0x165'),'as':_0x3559('0x12e')});db['ChatWebsite'][_0x3559('0xf8')](db[_0x3559('0x7e')],{'as':_0x3559('0x13c'),'foreignKey':_0x3559('0x166')});db[_0x3559('0x5d')][_0x3559('0xf8')](db[_0x3559('0x7c')],{'as':_0x3559('0x13d'),'foreignKey':_0x3559('0x166')});db[_0x3559('0x5d')][_0x3559('0xf8')](db[_0x3559('0x6b')],{'as':_0x3559('0x167')});db[_0x3559('0x5d')][_0x3559('0xf8')](db[_0x3559('0x63')],{'as':_0x3559('0x152')});db[_0x3559('0x5d')][_0x3559('0xf8')](db[_0x3559('0x61')],{'as':_0x3559('0x11d')});db[_0x3559('0x5d')][_0x3559('0xf8')](db['ChatMessage'],{'as':_0x3559('0x13e')});db['ChatWebsite'][_0x3559('0x125')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['ChatWebsite']['belongsTo'](db[_0x3559('0x128')],{'as':_0x3559('0x128'),'foreignKey':_0x3559('0x129')});db[_0x3559('0x5d')][_0x3559('0x125')](db[_0x3559('0x83')],{'as':_0x3559('0x12a'),'foreignKey':_0x3559('0x12b')});db[_0x3559('0x5d')]['belongsToMany'](db[_0x3559('0x11')],{'as':_0x3559('0x12d'),'through':_0x3559('0x112')});db[_0x3559('0x5f')][_0x3559('0x125')](db[_0x3559('0x56')],{});db[_0x3559('0x5f')][_0x3559('0x125')](db[_0x3559('0xee')],{'as':_0x3559('0x140'),'foreignKey':_0x3559('0x14f')});db['OpenchannelQueueReport'][_0x3559('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x3559('0x138')});db[_0x3559('0x5f')][_0x3559('0x125')](db[_0x3559('0xfc')],{});db[_0x3559('0x5f')][_0x3559('0x125')](db[_0x3559('0x59')],{});db[_0x3559('0x5f')][_0x3559('0x125')](db['User'],{});db[_0x3559('0x5f')][_0x3559('0x125')](db[_0x3559('0x5b')],{});db[_0x3559('0x61')]['belongsTo'](db[_0x3559('0x11')],{'as':_0x3559('0x168'),'foreignKey':_0x3559('0xf7'),'onDelete':_0x3559('0x14d')});db[_0x3559('0x61')][_0x3559('0x125')](db[_0x3559('0x69')],{'as':_0x3559('0x169'),'foreignKey':_0x3559('0x16a'),'onDelete':'restrict'});db[_0x3559('0x61')][_0x3559('0x125')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x3559('0x166'),'onDelete':_0x3559('0x14d')});db[_0x3559('0x61')]['belongsTo'](db[_0x3559('0x8b')],{'onDelete':_0x3559('0x14d'),'foreignKey':_0x3559('0x155')});db[_0x3559('0x63')][_0x3559('0xf8')](db['ChatMessage'],{'as':'Messages','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x16b')});db[_0x3559('0x63')][_0x3559('0x125')](db['ChatWebsite'],{'as':_0x3559('0x143'),'foreignKey':_0x3559('0x166')});db[_0x3559('0x63')][_0x3559('0x125')](db['CmContact'],{'as':_0x3559('0x144'),'foreignKey':_0x3559('0x138')});db[_0x3559('0x63')][_0x3559('0x125')](db[_0x3559('0x11')],{'as':_0x3559('0x157'),'foreignKey':_0x3559('0xf7')});db['ChatInteraction'][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':'chat_interaction_has_tags','as':_0x3559('0x146')});db[_0x3559('0x63')][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':_0x3559('0x16c'),'as':_0x3559('0x147')});db[_0x3559('0x63')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x148'),'through':_0x3559('0x106'),'foreignKey':_0x3559('0x16b')});db[_0x3559('0x65')][_0x3559('0x125')](db[_0x3559('0x11')],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x11')});db[_0x3559('0x65')][_0x3559('0x125')](db[_0x3559('0x6f')],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x144'),'foreignKey':'ContactId'});db['ChatMessage'][_0x3559('0x125')](db['ChatInteraction'],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x14c'),'foreignKey':_0x3559('0x16b')});db[_0x3559('0x65')][_0x3559('0x125')](db['Attachment'],{'as':'Attachment','foreignKey':_0x3559('0x159')});db[_0x3559('0x65')][_0x3559('0x125')](db[_0x3559('0x5d')],{'as':_0x3559('0x143'),'foreignKey':'ChatWebsiteId'});db[_0x3559('0x67')]['belongsTo'](db[_0x3559('0x6f')],{'onDelete':_0x3559('0xf5'),'as':_0x3559('0x144'),'foreignKey':_0x3559('0x138')});db[_0x3559('0x67')]['belongsTo'](db[_0x3559('0x5d')],{'as':'Account','foreignKey':_0x3559('0x166')});db[_0x3559('0x69')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x12d'),'through':'UserChatQueue','hooks':!![]});db[_0x3559('0x69')]['belongsToMany'](db['Team'],{'through':_0x3559('0x16d'),'as':_0x3559('0x12e')});db[_0x3559('0x6a')][_0x3559('0xf8')](db[_0x3559('0xcb')],{'as':_0x3559('0x13e'),'foreignKey':'ChatGroupId','onDelete':_0x3559('0xf5')});db[_0x3559('0x6a')]['belongsToMany'](db[_0x3559('0x11')],{'as':'Members','through':_0x3559('0x16e')});db[_0x3559('0x6b')][_0x3559('0x125')](db[_0x3559('0x5d')],{'as':_0x3559('0x16f'),'foreignKey':_0x3559('0x166')});db[_0x3559('0x6d')][_0x3559('0xf8')](db[_0x3559('0x6f')],{'as':'Contacts','foreignKey':_0x3559('0x170')});db[_0x3559('0x6f')][_0x3559('0xf8')](db[_0x3559('0x122')],{'as':_0x3559('0x123'),'foreignKey':_0x3559('0x138')});db[_0x3559('0x6f')][_0x3559('0xf8')](db[_0x3559('0x74')],{'as':'HopperFinals','foreignKey':_0x3559('0x138')});db[_0x3559('0x6f')][_0x3559('0xf8')](db['CmHopperHistory'],{'as':_0x3559('0x124'),'foreignKey':_0x3559('0x138')});db[_0x3559('0x6f')][_0x3559('0xf8')](db['ReportAgentPreview'],{'as':_0x3559('0x77'),'foreignKey':_0x3559('0x138')});db['CmContact']['hasMany'](db[_0x3559('0xcf')],{'as':_0x3559('0x171'),'foreignKey':'ContactId'});db['CmContact'][_0x3559('0xf8')](db['OpenchannelInteraction'],{'as':_0x3559('0xfd'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x3559('0xf8')](db[_0x3559('0x63')],{'as':_0x3559('0xfe'),'foreignKey':_0x3559('0x138'),'onDelete':_0x3559('0x14d')});db[_0x3559('0x6f')]['hasMany'](db[_0x3559('0x51')],{'as':_0x3559('0x172'),'foreignKey':_0x3559('0x138'),'onDelete':_0x3559('0x14d')});db[_0x3559('0x6f')][_0x3559('0xf8')](db[_0x3559('0x48')],{'as':'FaxInteractions','foreignKey':_0x3559('0x138'),'onDelete':_0x3559('0x14d')});db[_0x3559('0x6f')][_0x3559('0xf8')](db[_0x3559('0x3e')],{'as':'MailInteractions','foreignKey':_0x3559('0x138'),'onDelete':_0x3559('0x14d')});db[_0x3559('0x6f')][_0x3559('0x125')](db[_0x3559('0x6d')],{'as':_0x3559('0x173'),'foreignKey':_0x3559('0x170')});db[_0x3559('0x6f')][_0x3559('0x125')](db[_0x3559('0xee')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x3559('0x6f')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x148'),'through':_0x3559('0x103')});db[_0x3559('0x6f')][_0x3559('0x101')](db[_0x3559('0x8b')],{'as':_0x3559('0x146'),'through':_0x3559('0x174')});db[_0x3559('0x6f')]['belongsToMany'](db[_0x3559('0x8b')],{'through':_0x3559('0x174'),'as':_0x3559('0x147')});db[_0x3559('0x122')][_0x3559('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x3559('0x138'),'onDelete':'cascade'});db[_0x3559('0x122')][_0x3559('0x125')](db[_0x3559('0xee')],{'as':_0x3559('0x140'),'foreignKey':_0x3559('0x14f'),'onDelete':'cascade'});db[_0x3559('0x122')][_0x3559('0x125')](db[_0x3559('0x11')],{'as':_0x3559('0x168'),'foreignKey':_0x3559('0xf7')});db['CmHopper'][_0x3559('0x125')](db[_0x3559('0x1b')],{'as':_0x3559('0x169'),'foreignKey':_0x3559('0x121'),'onDelete':_0x3559('0xf5')});db[_0x3559('0x122')][_0x3559('0x125')](db[_0x3559('0x175')],{'as':_0x3559('0x175'),'foreignKey':_0x3559('0x176'),'onDelete':'cascade'});db['CmHopper'][_0x3559('0x125')](db[_0x3559('0x11')],{'as':_0x3559('0x157'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x3559('0x125')](db[_0x3559('0x6f')],{'as':_0x3559('0x144'),'foreignKey':'ContactId','onDelete':_0x3559('0xf5')});db[_0x3559('0x72')][_0x3559('0x125')](db[_0x3559('0xee')],{'as':_0x3559('0x140'),'foreignKey':_0x3559('0x14f'),'onDelete':'cascade'});db['CmHopperBlack'][_0x3559('0x125')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x3559('0x121'),'onDelete':_0x3559('0xf5')});db[_0x3559('0x72')]['belongsTo'](db[_0x3559('0x175')],{'as':_0x3559('0x175'),'foreignKey':_0x3559('0x176'),'onDelete':_0x3559('0xf5')});db[_0x3559('0x177')][_0x3559('0xf8')](db[_0x3559('0x80')],{'as':{'plural':_0x3559('0x178'),'singular':'OneAll'},'foreignKey':_0x3559('0x179'),'onDelete':_0x3559('0xf5'),'hooks':!![]});db['Automation'][_0x3559('0xf8')](db['Condition'],{'as':{'plural':_0x3559('0x17a'),'singular':_0x3559('0x17b')},'foreignKey':_0x3559('0x17c'),'onDelete':_0x3559('0xf5'),'hooks':!![]});db[_0x3559('0x177')][_0x3559('0xf8')](db[_0x3559('0x7a')],{'as':_0x3559('0x17d'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x3559('0x128')][_0x3559('0xf8')](db[_0x3559('0x128')],{'as':_0x3559('0x17e'),'foreignKey':_0x3559('0x129'),'onDelete':_0x3559('0xf5'),'hooks':!![],'required':![]});db[_0x3559('0x128')][_0x3559('0xf8')](db['VoiceExtension'],{'as':_0x3559('0xfa'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x3559('0x128')]['hasMany'](db[_0x3559('0x13f')],{'as':_0x3559('0x17f'),'foreignKey':_0x3559('0x129')});db['Interval'][_0x3559('0xf8')](db[_0x3559('0x61')],{'as':_0x3559('0x180'),'foreignKey':_0x3559('0x129')});db[_0x3559('0x128')][_0x3559('0xf8')](db[_0x3559('0x153')],{'as':'FaxApplications','foreignKey':_0x3559('0x129')});db['Interval'][_0x3559('0xf8')](db[_0x3559('0x15c')],{'as':_0x3559('0x181'),'foreignKey':_0x3559('0x129')});db[_0x3559('0x182')][_0x3559('0x125')](db['MailAccount'],{});db[_0x3559('0x182')][_0x3559('0x125')](db[_0x3559('0x96')],{'foreignKey':_0x3559('0x183')});db[_0x3559('0x182')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db['Sound'][_0x3559('0x101')](db[_0x3559('0x19')],{'as':_0x3559('0x184'),'through':_0x3559('0x11f'),'onDelete':_0x3559('0x14d')});db[_0x3559('0x8b')][_0x3559('0x101')](db['CmContact'],{'through':_0x3559('0x174')});db[_0x3559('0x8b')][_0x3559('0x101')](db['ChatInteraction'],{'through':_0x3559('0x16c')});db['Tag'][_0x3559('0x101')](db[_0x3559('0x3e')],{'through':_0x3559('0x145')});db[_0x3559('0x8b')][_0x3559('0x101')](db[_0x3559('0x51')],{'through':_0x3559('0x15e')});db[_0x3559('0x8b')]['belongsToMany'](db['FaxInteraction'],{'through':_0x3559('0x158')});db['Tag'][_0x3559('0x101')](db[_0x3559('0xfc')],{'through':_0x3559('0x164')});db[_0x3559('0x185')][_0x3559('0xf8')](db[_0x3559('0x80')],{'as':{'plural':_0x3559('0x186'),'singular':_0x3559('0x187')},'foreignKey':'TriggerAllId','onDelete':_0x3559('0xf5'),'hooks':!![]});db[_0x3559('0x185')][_0x3559('0xf8')](db['Condition'],{'as':{'plural':_0x3559('0x188'),'singular':_0x3559('0x189')},'foreignKey':_0x3559('0x18a'),'onDelete':_0x3559('0xf5'),'hooks':!![]});db[_0x3559('0x185')][_0x3559('0xf8')](db[_0x3559('0x7a')],{'as':_0x3559('0x17d'),'foreignKey':_0x3559('0x18b'),'onDelete':_0x3559('0xf5'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x3559('0x9b')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x3559('0x18c'),'hooks':!![]});db[_0x3559('0x96')][_0x3559('0xf8')](db[_0x3559('0x9b')],{'as':_0x3559('0x18d'),'onDelete':'cascade','foreignKey':_0x3559('0x183')});db[_0x3559('0x99')][_0x3559('0xf8')](db['AnalyticFieldReport'],{'as':_0x3559('0x18d'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x3559('0x9b')]['belongsTo'](db[_0x3559('0x99')],{'foreignKey':_0x3559('0x18e')});db['SalesforceAccount'][_0x3559('0xf8')](db[_0x3559('0x9f')],{'as':'Configurations','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x18f')});db[_0x3559('0x9f')]['hasMany'](db[_0x3559('0xa1')],{'as':'Subjects','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x190')});db[_0x3559('0x9f')][_0x3559('0xf8')](db[_0x3559('0xa1')],{'as':_0x3559('0x191'),'onDelete':_0x3559('0xf5'),'foreignKey':'DescriptionId'});db[_0x3559('0x9f')][_0x3559('0xf8')](db[_0x3559('0xa1')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x3559('0x9f')][_0x3559('0x125')](db[_0x3559('0x9e')],{'as':_0x3559('0x143'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db[_0x3559('0xa1')],{'as':_0x3559('0x192'),'foreignKey':_0x3559('0x190')});db[_0x3559('0xa1')][_0x3559('0xf8')](db['SalesforceField'],{'as':_0x3559('0x193'),'foreignKey':_0x3559('0x194')});db[_0x3559('0xa1')][_0x3559('0xf8')](db['SalesforceField'],{'as':_0x3559('0x195'),'foreignKey':'FieldId'});db['SalesforceField'][_0x3559('0x125')](db[_0x3559('0x196')],{'as':_0x3559('0x196'),'foreignKey':_0x3559('0x197')});db['SugarcrmAccount']['hasMany'](db[_0x3559('0xa4')],{'as':_0x3559('0x198'),'onDelete':'cascade','foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x3559('0xf8')](db[_0x3559('0xa6')],{'as':'Subjects','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x190')});db['SugarcrmConfiguration']['hasMany'](db[_0x3559('0xa6')],{'as':_0x3559('0x191'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x194')});db[_0x3559('0xa4')][_0x3559('0xf8')](db[_0x3559('0xa6')],{'as':_0x3559('0x18d'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x199')});db['SugarcrmConfiguration'][_0x3559('0x125')](db['SugarcrmAccount'],{'as':_0x3559('0x143'),'foreignKey':_0x3559('0x18f')});db[_0x3559('0xa6')][_0x3559('0xf8')](db[_0x3559('0xa6')],{'as':_0x3559('0x192'),'foreignKey':_0x3559('0x190')});db['SugarcrmField']['hasMany'](db[_0x3559('0xa6')],{'as':_0x3559('0x193'),'foreignKey':'DescriptionId'});db[_0x3559('0xa6')][_0x3559('0xf8')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x3559('0x199')});db['SugarcrmField'][_0x3559('0x125')](db[_0x3559('0x196')],{'as':_0x3559('0x196'),'foreignKey':'VariableId'});db['DeskAccount'][_0x3559('0xf8')](db[_0x3559('0xa9')],{'as':_0x3559('0x198'),'onDelete':_0x3559('0xf5'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x3559('0xf8')](db[_0x3559('0xab')],{'as':_0x3559('0x19a'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x190')});db[_0x3559('0xa9')]['hasMany'](db[_0x3559('0xab')],{'as':_0x3559('0x191'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x194')});db[_0x3559('0xa9')][_0x3559('0xf8')](db['DeskField'],{'as':'Fields','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x199')});db[_0x3559('0xa9')][_0x3559('0x125')](db[_0x3559('0x19b')],{'as':_0x3559('0x143'),'foreignKey':_0x3559('0x18f')});db[_0x3559('0xa9')]['belongsToMany'](db['Tag'],{'through':_0x3559('0x19c')});db[_0x3559('0xab')][_0x3559('0xf8')](db['DeskField'],{'as':_0x3559('0x192'),'foreignKey':_0x3559('0x190')});db[_0x3559('0xab')]['hasMany'](db[_0x3559('0xab')],{'as':_0x3559('0x193'),'foreignKey':_0x3559('0x194')});db[_0x3559('0xab')][_0x3559('0xf8')](db['DeskField'],{'as':_0x3559('0x195'),'foreignKey':'FieldId'});db[_0x3559('0xab')]['belongsTo'](db[_0x3559('0x196')],{'as':_0x3559('0x196'),'foreignKey':_0x3559('0x197')});db[_0x3559('0x19d')][_0x3559('0xf8')](db[_0x3559('0xad')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x3559('0x18f')});db[_0x3559('0xad')][_0x3559('0xf8')](db[_0x3559('0x19e')],{'as':_0x3559('0x19a'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x190')});db[_0x3559('0xad')][_0x3559('0xf8')](db[_0x3559('0x19e')],{'as':_0x3559('0x191'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x194')});db[_0x3559('0xad')][_0x3559('0xf8')](db[_0x3559('0x19e')],{'as':_0x3559('0x18d'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x199')});db[_0x3559('0xad')][_0x3559('0x125')](db[_0x3559('0x19d')],{'as':_0x3559('0x143'),'foreignKey':_0x3559('0x18f')});db['ZohoField'][_0x3559('0xf8')](db[_0x3559('0x19e')],{'as':_0x3559('0x192'),'foreignKey':_0x3559('0x190')});db[_0x3559('0x19e')][_0x3559('0xf8')](db['ZohoField'],{'as':_0x3559('0x193'),'foreignKey':_0x3559('0x194')});db[_0x3559('0x19e')]['hasMany'](db[_0x3559('0x19e')],{'as':'Field','foreignKey':_0x3559('0x199')});db[_0x3559('0x19e')][_0x3559('0x125')](db[_0x3559('0x196')],{'as':'Variable','foreignKey':_0x3559('0x197')});db[_0x3559('0x19f')][_0x3559('0xf8')](db['ZendeskConfiguration'],{'as':_0x3559('0x198'),'onDelete':'cascade','foreignKey':_0x3559('0x18f')});db[_0x3559('0xaf')][_0x3559('0xf8')](db[_0x3559('0x1a0')],{'as':_0x3559('0x19a'),'foreignKey':_0x3559('0x190')});db[_0x3559('0xaf')][_0x3559('0xf8')](db[_0x3559('0x1a0')],{'as':'Descriptions','foreignKey':_0x3559('0x194')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x3559('0x18d'),'foreignKey':_0x3559('0x199')});db[_0x3559('0xaf')][_0x3559('0x125')](db[_0x3559('0x19f')],{'as':_0x3559('0x143'),'foreignKey':'AccountId'});db[_0x3559('0xaf')][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':_0x3559('0x1a1')});db[_0x3559('0x1a0')][_0x3559('0xf8')](db[_0x3559('0x1a0')],{'as':_0x3559('0x192'),'foreignKey':_0x3559('0x190')});db[_0x3559('0x1a0')]['hasMany'](db[_0x3559('0x1a0')],{'as':'Description','foreignKey':_0x3559('0x194')});db[_0x3559('0x1a0')]['hasMany'](db[_0x3559('0x1a0')],{'as':_0x3559('0x195'),'foreignKey':_0x3559('0x199')});db[_0x3559('0x1a0')][_0x3559('0x125')](db[_0x3559('0x196')],{'as':_0x3559('0x196'),'foreignKey':_0x3559('0x197')});db[_0x3559('0xb1')][_0x3559('0xf8')](db[_0x3559('0xb3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x3559('0x18f')});db[_0x3559('0xb3')][_0x3559('0xf8')](db[_0x3559('0xb5')],{'as':_0x3559('0x19a'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x190')});db['FreshdeskConfiguration'][_0x3559('0xf8')](db[_0x3559('0xb5')],{'as':_0x3559('0x191'),'onDelete':'cascade','foreignKey':_0x3559('0x194')});db[_0x3559('0xb3')]['hasMany'](db[_0x3559('0xb5')],{'as':_0x3559('0x18d'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x199')});db[_0x3559('0xb3')]['belongsTo'](db[_0x3559('0xb1')],{'as':_0x3559('0x143'),'foreignKey':'AccountId'});db[_0x3559('0xb3')][_0x3559('0x101')](db[_0x3559('0x8b')],{'through':_0x3559('0x1a2')});db[_0x3559('0xb5')][_0x3559('0xf8')](db[_0x3559('0xb5')],{'as':'Subject','foreignKey':_0x3559('0x190')});db[_0x3559('0xb5')][_0x3559('0xf8')](db[_0x3559('0xb5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3559('0xb5')][_0x3559('0xf8')](db[_0x3559('0xb5')],{'as':_0x3559('0x195'),'foreignKey':'FieldId'});db[_0x3559('0xb5')][_0x3559('0x125')](db[_0x3559('0x196')],{'as':_0x3559('0x196'),'foreignKey':_0x3559('0x197')});db[_0x3559('0xb7')][_0x3559('0xf8')](db[_0x3559('0xb9')],{'as':_0x3559('0x198'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x18f')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':'Subjects','foreignKey':_0x3559('0x190')});db[_0x3559('0xb9')][_0x3559('0xf8')](db['VtigerField'],{'as':_0x3559('0x191'),'foreignKey':_0x3559('0x194')});db['VtigerConfiguration'][_0x3559('0xf8')](db[_0x3559('0xbb')],{'as':_0x3559('0x18d'),'foreignKey':_0x3559('0x199')});db[_0x3559('0xb9')][_0x3559('0x125')](db[_0x3559('0xb7')],{'as':'Account','foreignKey':'AccountId'});db['VtigerConfiguration']['belongsToMany'](db[_0x3559('0x8b')],{'through':_0x3559('0x1a3')});db[_0x3559('0xbb')][_0x3559('0xf8')](db[_0x3559('0xbb')],{'as':'Subject','foreignKey':_0x3559('0x190')});db[_0x3559('0xbb')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':_0x3559('0x194')});db[_0x3559('0xbb')]['hasMany'](db[_0x3559('0xbb')],{'as':_0x3559('0x195'),'foreignKey':_0x3559('0x199')});db[_0x3559('0xbb')][_0x3559('0x125')](db['Variable'],{'as':'Variable','foreignKey':_0x3559('0x197')});db[_0x3559('0xbd')][_0x3559('0xf8')](db[_0x3559('0xbe')],{'as':'Configurations','onDelete':_0x3559('0xf5'),'foreignKey':'AccountId'});db[_0x3559('0xbe')][_0x3559('0xf8')](db[_0x3559('0xc0')],{'as':_0x3559('0x19a'),'foreignKey':_0x3559('0x190')});db[_0x3559('0xbe')]['hasMany'](db[_0x3559('0xc0')],{'as':_0x3559('0x191'),'foreignKey':'DescriptionId'});db[_0x3559('0xbe')][_0x3559('0xf8')](db['ServicenowField'],{'as':'Fields','foreignKey':_0x3559('0x199')});db[_0x3559('0xbe')][_0x3559('0x125')](db['ServicenowAccount'],{'as':_0x3559('0x143'),'foreignKey':_0x3559('0x18f')});db[_0x3559('0xc0')][_0x3559('0xf8')](db[_0x3559('0xc0')],{'as':_0x3559('0x192'),'foreignKey':_0x3559('0x190')});db['ServicenowField'][_0x3559('0xf8')](db['ServicenowField'],{'as':'Description','foreignKey':_0x3559('0x194')});db[_0x3559('0xc0')]['hasMany'](db[_0x3559('0xc0')],{'as':'Field','foreignKey':_0x3559('0x199')});db[_0x3559('0xc0')][_0x3559('0x125')](db['Variable'],{'as':'Variable','foreignKey':_0x3559('0x197')});db[_0x3559('0xc2')][_0x3559('0xf8')](db['Dynamics365Configuration'],{'as':_0x3559('0x198'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x18f')});db[_0x3559('0xc4')]['hasMany'](db[_0x3559('0xc6')],{'as':_0x3559('0x19a'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x190')});db[_0x3559('0xc4')][_0x3559('0xf8')](db[_0x3559('0xc6')],{'as':'Descriptions','onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x194')});db[_0x3559('0xc4')][_0x3559('0xf8')](db['Dynamics365Field'],{'as':_0x3559('0x18d'),'onDelete':_0x3559('0xf5'),'foreignKey':'FieldId'});db[_0x3559('0xc4')][_0x3559('0x125')](db['Dynamics365Account'],{'as':_0x3559('0x143'),'foreignKey':'AccountId'});db[_0x3559('0xc6')][_0x3559('0xf8')](db['Dynamics365Field'],{'as':_0x3559('0x192'),'foreignKey':'SubjectId'});db[_0x3559('0xc6')][_0x3559('0xf8')](db[_0x3559('0xc6')],{'as':_0x3559('0x193'),'foreignKey':_0x3559('0x194')});db['Dynamics365Field'][_0x3559('0xf8')](db[_0x3559('0xc6')],{'as':_0x3559('0x195'),'foreignKey':_0x3559('0x199')});db['Dynamics365Field'][_0x3559('0x125')](db[_0x3559('0x196')],{'as':'Variable','foreignKey':_0x3559('0x197')});db['ChatQueueReport'][_0x3559('0x125')](db[_0x3559('0x5d')],{});db['ChatQueueReport'][_0x3559('0x125')](db['CmList'],{'as':_0x3559('0x140'),'foreignKey':_0x3559('0x14f')});db[_0x3559('0xc9')]['belongsTo'](db[_0x3559('0x6f')],{'as':'Contact','foreignKey':_0x3559('0x138')});db[_0x3559('0xc9')]['belongsTo'](db[_0x3559('0x63')],{});db['ChatQueueReport'][_0x3559('0x125')](db[_0x3559('0x65')],{});db[_0x3559('0xc9')][_0x3559('0x125')](db['User'],{});db[_0x3559('0xc9')]['belongsTo'](db[_0x3559('0x69')],{});db['ChatInternalMessage'][_0x3559('0x125')](db[_0x3559('0x11')],{'onDelete':'cascade','foreignKey':_0x3559('0x1a4')});db[_0x3559('0xcb')][_0x3559('0x125')](db[_0x3559('0x11')],{'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x1a5')});db[_0x3559('0xcf')][_0x3559('0xf8')](db[_0x3559('0xcd')],{'foreignKey':_0x3559('0x1a6'),'onDelete':_0x3559('0xf5')});db[_0x3559('0xcf')][_0x3559('0xf8')](db[_0x3559('0x1a7')],{'foreignKey':_0x3559('0x1a6'),'onDelete':_0x3559('0xf5')});db['SmsQueueReport']['belongsTo'](db[_0x3559('0x118')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x3559('0x14f')});db[_0x3559('0x1a8')][_0x3559('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x3559('0x138')});db['SmsQueueReport'][_0x3559('0x125')](db[_0x3559('0x51')],{});db[_0x3559('0x1a8')][_0x3559('0x125')](db[_0x3559('0x53')],{});db[_0x3559('0x1a8')][_0x3559('0x125')](db[_0x3559('0x11')],{});db[_0x3559('0x1a8')][_0x3559('0x125')](db[_0x3559('0x55')],{});db['JscriptyProject'][_0x3559('0xf8')](db['JscriptySessionReport'],{'foreignKey':_0x3559('0x1a9')});db[_0x3559('0x1aa')][_0x3559('0xf8')](db[_0x3559('0xcd')],{'foreignKey':_0x3559('0x1a9')});db[_0x3559('0x1aa')][_0x3559('0xf8')](db[_0x3559('0x1a7')],{'foreignKey':_0x3559('0x1a9')});db[_0x3559('0xd8')]['belongsToMany'](db[_0x3559('0x11')],{'as':_0x3559('0x148'),'through':'user_has_square_projects'});db[_0x3559('0xdd')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':'Agents','through':_0x3559('0x105')});db[_0x3559('0xdd')][_0x3559('0x101')](db[_0x3559('0x1b')],{'through':'team_has_voice_queues','as':'VoiceQueues'});db['Team'][_0x3559('0x101')](db['MailQueue'],{'through':_0x3559('0x142'),'as':_0x3559('0x1ab')});db[_0x3559('0xdd')][_0x3559('0x101')](db['ChatQueue'],{'through':_0x3559('0x16d'),'as':_0x3559('0x1ac')});db[_0x3559('0xdd')]['belongsToMany'](db[_0x3559('0x4b')],{'through':_0x3559('0x15a'),'as':'FaxQueues'});db[_0x3559('0xdd')][_0x3559('0x101')](db[_0x3559('0x55')],{'through':_0x3559('0x1ad'),'as':_0x3559('0x10f')});db['Team'][_0x3559('0x101')](db[_0x3559('0x5b')],{'through':_0x3559('0x165'),'as':'OpenchannelQueues'});db['Campaign'][_0x3559('0xf8')](db[_0x3559('0x122')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x3559('0x175')][_0x3559('0xf8')](db[_0x3559('0x74')],{'as':_0x3559('0xfb'),'foreignKey':_0x3559('0x176')});db[_0x3559('0x175')][_0x3559('0xf8')](db[_0x3559('0x76')],{'as':_0x3559('0x124'),'foreignKey':'CampaignId'});db['Campaign'][_0x3559('0xf8')](db[_0x3559('0x72')],{'as':_0x3559('0x1ae'),'foreignKey':_0x3559('0x176')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x3559('0x2a'),'foreignKey':_0x3559('0x1af')});db[_0x3559('0x175')]['belongsTo'](db['Trunk'],{'as':_0x3559('0x126'),'foreignKey':_0x3559('0x127')});db[_0x3559('0x175')][_0x3559('0x125')](db['Interval'],{'as':_0x3559('0x128'),'foreignKey':_0x3559('0x129')});db['Campaign'][_0x3559('0x125')](db['SquareProject'],{'as':_0x3559('0xd8'),'foreignKey':_0x3559('0x1b0')});db['Campaign'][_0x3559('0x101')](db[_0x3559('0xee')],{'as':_0x3559('0x12c'),'through':_0x3559('0x1b1')});db[_0x3559('0x175')][_0x3559('0x101')](db['CmList'],{'as':'BlackLists','through':_0x3559('0x1b2')});db[_0x3559('0x1b3')][_0x3559('0x125')](db['MailMessage'],{});db[_0x3559('0x1b3')][_0x3559('0x125')](db[_0x3559('0x3e')],{});db['MailTransferReport'][_0x3559('0x125')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x3559('0x1b3')]['belongsTo'](db[_0x3559('0x11')],{'foreignKey':_0x3559('0x1b4'),'as':'FromAgent'});db['MailTransferReport'][_0x3559('0x125')](db['User'],{'foreignKey':_0x3559('0x1b5'),'as':'ToAgent'});db[_0x3559('0x1b3')][_0x3559('0x125')](db['MailQueue'],{'foreignKey':_0x3559('0x1b6'),'as':'ToQueue'});db[_0x3559('0x1b3')][_0x3559('0x125')](db[_0x3559('0x3a')],{'foreignKey':_0x3559('0x1b7'),'as':'ToAccount'});db[_0x3559('0xe7')][_0x3559('0x125')](db[_0x3559('0x65')],{});db['ChatTransferReport'][_0x3559('0x125')](db[_0x3559('0x63')],{});db[_0x3559('0xe7')][_0x3559('0x125')](db[_0x3559('0x5d')],{'foreignKey':_0x3559('0x1b8'),'as':_0x3559('0x1b9')});db[_0x3559('0xe7')][_0x3559('0x125')](db[_0x3559('0x11')],{'foreignKey':_0x3559('0x1b4'),'as':_0x3559('0x1ba')});db[_0x3559('0xe7')][_0x3559('0x125')](db[_0x3559('0x11')],{'foreignKey':_0x3559('0x1b5'),'as':'ToAgent'});db[_0x3559('0xe7')][_0x3559('0x125')](db[_0x3559('0x69')],{'foreignKey':_0x3559('0x1bb'),'as':_0x3559('0x1bc')});db[_0x3559('0xe7')][_0x3559('0x125')](db[_0x3559('0x5d')],{'foreignKey':_0x3559('0x1bd'),'as':'ToAccount'});db['FaxTransferReport']['belongsTo'](db[_0x3559('0x49')],{});db[_0x3559('0xe9')][_0x3559('0x125')](db[_0x3559('0x48')],{});db['FaxTransferReport'][_0x3559('0x125')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db['FaxTransferReport'][_0x3559('0x125')](db[_0x3559('0x11')],{'foreignKey':_0x3559('0x1b4'),'as':_0x3559('0x1ba')});db[_0x3559('0xe9')][_0x3559('0x125')](db[_0x3559('0x11')],{'foreignKey':_0x3559('0x1b5'),'as':_0x3559('0x1be')});db['FaxTransferReport'][_0x3559('0x125')](db[_0x3559('0x4b')],{'foreignKey':_0x3559('0x1bf'),'as':'ToQueue'});db[_0x3559('0xe9')]['belongsTo'](db[_0x3559('0x47')],{'foreignKey':_0x3559('0x1c0'),'as':_0x3559('0x1c1')});db[_0x3559('0xeb')][_0x3559('0x125')](db[_0x3559('0x59')],{});db[_0x3559('0xeb')][_0x3559('0x125')](db[_0x3559('0xfc')],{});db[_0x3559('0xeb')][_0x3559('0x125')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x3559('0x1b9')});db[_0x3559('0xeb')][_0x3559('0x125')](db[_0x3559('0x11')],{'foreignKey':_0x3559('0x1b4'),'as':_0x3559('0x1ba')});db[_0x3559('0xeb')][_0x3559('0x125')](db[_0x3559('0x11')],{'foreignKey':_0x3559('0x1b5'),'as':_0x3559('0x1be')});db[_0x3559('0xeb')]['belongsTo'](db[_0x3559('0x5b')],{'foreignKey':_0x3559('0x1c2'),'as':_0x3559('0x1bc')});db[_0x3559('0xeb')][_0x3559('0x125')](db['OpenchannelAccount'],{'foreignKey':_0x3559('0x1c3'),'as':_0x3559('0x1c1')});db['SmsTransferReport']['belongsTo'](db[_0x3559('0x53')],{});db[_0x3559('0x1c4')]['belongsTo'](db[_0x3559('0x51')],{});db[_0x3559('0x1c4')][_0x3559('0x125')](db[_0x3559('0x118')],{'foreignKey':_0x3559('0x1c5'),'as':'FromAccount'});db[_0x3559('0x1c4')][_0x3559('0x125')](db[_0x3559('0x11')],{'foreignKey':_0x3559('0x1b4'),'as':'FromAgent'});db[_0x3559('0x1c4')]['belongsTo'](db['User'],{'foreignKey':_0x3559('0x1b5'),'as':'ToAgent'});db[_0x3559('0x1c4')][_0x3559('0x125')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x3559('0x1bc')});db[_0x3559('0x1c4')][_0x3559('0x125')](db[_0x3559('0x118')],{'foreignKey':_0x3559('0x1c6'),'as':_0x3559('0x1c1')});db['CmList']['hasMany'](db[_0x3559('0x7e')],{'as':_0x3559('0x13c'),'foreignKey':_0x3559('0x14f')});db[_0x3559('0xee')]['hasMany'](db[_0x3559('0x1c7')],{'as':'CustomFields','foreignKey':'ListId'});db[_0x3559('0xee')]['hasMany'](db['CmContact'],{'as':_0x3559('0x1c8'),'onDelete':_0x3559('0xf5'),'foreignKey':_0x3559('0x14f')});db[_0x3559('0xee')]['hasMany'](db['CmHopperFinal'],{'as':_0x3559('0xfb'),'foreignKey':_0x3559('0x14f')});db[_0x3559('0xee')][_0x3559('0xf8')](db[_0x3559('0x76')],{'as':_0x3559('0x1c9'),'foreignKey':_0x3559('0x14f')});db['CmList'][_0x3559('0xf8')](db['ReportAgentPreview'],{'as':_0x3559('0x77'),'foreignKey':_0x3559('0x14f')});db[_0x3559('0xee')][_0x3559('0x101')](db[_0x3559('0x1b')],{'as':'Queues','through':_0x3559('0x1ca')});db[_0x3559('0xee')][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x12d'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x3559('0xf8')](db[_0x3559('0x18')],{'as':'Extensions','onDelete':_0x3559('0x14d')});db['VoicePrefix'][_0x3559('0x101')](db[_0x3559('0x11')],{'as':_0x3559('0x12d'),'through':'user_has_voice_prefixes'});db[_0x3559('0xf1')]['hasMany'](db[_0x3559('0x11')],{'as':'Users','foreignKey':_0x3559('0x100')});db['UserProfile'][_0x3559('0xf8')](db[_0x3559('0x1cb')],{'as':'UserProfileSections','foreignKey':_0x3559('0x100'),'onDelete':_0x3559('0xf5')});db[_0x3559('0x1cb')][_0x3559('0xf8')](db[_0x3559('0xf3')],{'as':_0x3559('0x1cc'),'foreignKey':_0x3559('0x1cd'),'onDelete':'cascade'});module[_0x3559('0x1ce')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xe401=['UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','VoicePrefixes','ChatWebsite','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','CmHopperBlack','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccount','MailAccountId','Smtp','Dispositions','Answers','Interactions','MailApplication','ListId','TemplateId','Pause','MailQueue','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','restrict','TagId','Items','Disposition','FaxAccountId','Exntensions','Owner','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','List','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','ChatApplication','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','Website','CompanyId','CmHopper','Hoppers','JscriptySessions','FaxInteractions','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','Trigger','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','AnalyticFieldReport','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','SalesforceField','Descriptions','DescriptionId','FieldId','AccountId','SubjectId','Description','Field','VariableId','SugarcrmConfiguration','Subjects','Subject','DeskAccount','ZendeskConfiguration','int_vtiger_configuration_has_tags','ServicenowAccount','FromId','SessionId','JscriptyAnswerReport','ProjectId','JscriptyQuestionReport','user_has_teams','team_has_chat_queues','team_has_sms_queues','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsAccountId','CustomFields','user_has_voice_prefixes','UserProfileSections','Resources','exports','path','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','database','username','password','options','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model'];(function(_0x4bfaa7,_0x1033b0){var _0x282f8f=function(_0x4cf762){while(--_0x4cf762){_0x4bfaa7['push'](_0x4bfaa7['shift']());}};_0x282f8f(++_0x1033b0);}(_0xe401,0x199));var _0x1e40=function(_0x3ddb12,_0xa844ba){_0x3ddb12=_0x3ddb12-0x0;var _0x7feada=_0xe401[_0x3ddb12];return _0x7feada;};'use strict';var path=require(_0x1e40('0x0'));var config=require('../config/environment');var Sequelize=require(_0x1e40('0x1'));var _=require(_0x1e40('0x2'));var jstz=require(_0x1e40('0x3'));var timezone=jstz[_0x1e40('0x4')]();config[_0x1e40('0x1')]=_[_0x1e40('0x5')](config[_0x1e40('0x1')],{'database':_0x1e40('0x6'),'username':_0x1e40('0x7'),'password':_0x1e40('0x8'),'options':{'host':_0x1e40('0x9'),'port':0xcea,'dialect':_0x1e40('0xa'),'dialectOptions':{'charset':_0x1e40('0xb')},'logging':![],'timezone':timezone[_0x1e40('0xc')](),'define':{'charset':_0x1e40('0xd'),'collate':_0x1e40('0xe')}}});config['sequelizeHistory']=_[_0x1e40('0x5')](config['sequelizeHistory'],{'database':_0x1e40('0x6'),'username':_0x1e40('0x7'),'password':_0x1e40('0x8'),'options':{'host':_0x1e40('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x1e40('0xd'),'collate':_0x1e40('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1e40('0x1')][_0x1e40('0xf')],config[_0x1e40('0x1')][_0x1e40('0x10')],config[_0x1e40('0x1')][_0x1e40('0x11')],config['sequelize'][_0x1e40('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1e40('0x13')][_0x1e40('0xf')],config['sequelizeHistory'][_0x1e40('0x10')],config[_0x1e40('0x13')]['password'],config[_0x1e40('0x13')][_0x1e40('0x12')])};db[_0x1e40('0x14')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x16'));db[_0x1e40('0x17')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x18'));db['VoiceContext']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x19'));db[_0x1e40('0x1a')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x1b'));db[_0x1e40('0x1c')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x1d'));db[_0x1e40('0x1e')]=db['sequelize']['import'](_0x1e40('0x1f'));db[_0x1e40('0x20')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x21'));db[_0x1e40('0x22')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x23'));db[_0x1e40('0x24')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x25'));db['VoiceMailMessage']=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x26'));db[_0x1e40('0x27')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x28'));db['VoiceDialReport']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x29'));db[_0x1e40('0x2a')]=db['sequelize']['import'](_0x1e40('0x2b'));db[_0x1e40('0x2c')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x2d'));db[_0x1e40('0x2e')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/memberReport/memberReport.model');db[_0x1e40('0x2f')]=db['sequelize']['import'](_0x1e40('0x30'));db[_0x1e40('0x31')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x32'));db[_0x1e40('0x33')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x34'));db[_0x1e40('0x35')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x36'));db[_0x1e40('0x37')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x38'));db[_0x1e40('0x39')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x3a'));db[_0x1e40('0x3b')]=db[_0x1e40('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x1e40('0x3c')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x3d'));db[_0x1e40('0x3e')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x3f'));db[_0x1e40('0x40')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x41'));db[_0x1e40('0x42')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x43'));db['MailAccount']=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x44'));db['MailQueue']=db[_0x1e40('0x1')]['import'](_0x1e40('0x45'));db[_0x1e40('0x46')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x1e40('0x47')]=db[_0x1e40('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x1e40('0x48')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x49'));db['MailApplication']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x4a'));db[_0x1e40('0x4b')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x4c'));db[_0x1e40('0x4d')]=db['sequelize'][_0x1e40('0x15')]('../api/dashboard/dashboard.model');db[_0x1e40('0x4e')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x4f'));db[_0x1e40('0x50')]=db[_0x1e40('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0x1e40('0x51')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x52'));db[_0x1e40('0x53')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x54'));db[_0x1e40('0x55')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x56'));db[_0x1e40('0x57')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x58'));db[_0x1e40('0x59')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x5a'));db[_0x1e40('0x5b')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x5c'));db[_0x1e40('0x5d')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x5e'));db[_0x1e40('0x5f')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x60'));db['SmsMessage']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x61'));db[_0x1e40('0x62')]=db['sequelize']['import'](_0x1e40('0x63'));db[_0x1e40('0x64')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x65'));db[_0x1e40('0x66')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x67'));db[_0x1e40('0x68')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x69'));db[_0x1e40('0x6a')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x6b'));db[_0x1e40('0x6c')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x6d'));db['ChatWebsite']=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x6e'));db[_0x1e40('0x6f')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x70'));db['ChatApplication']=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/chatApplication/chatApplication.model');db[_0x1e40('0x71')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/chatInteraction/chatInteraction.model');db[_0x1e40('0x72')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x73'));db['ChatOfflineMessage']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x74'));db['ChatQueue']=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x75'));db[_0x1e40('0x76')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x77'));db[_0x1e40('0x78')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x1e40('0x79')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x7a'));db[_0x1e40('0x7b')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x7c'));db['CmHopper']=db[_0x1e40('0x1')]['import'](_0x1e40('0x7d'));db['CmHopperBlack']=db['sequelize']['import'](_0x1e40('0x7e'));db[_0x1e40('0x7f')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x1e40('0x80')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x81'));db[_0x1e40('0x82')]=db['sequelize'][_0x1e40('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x1e40('0x83')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0x1e40('0x84')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x85'));db[_0x1e40('0x86')]=db['sequelize']['import']('../api/automation/automation.model');db[_0x1e40('0x87')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x88'));db['Disposition']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x89'));db[_0x1e40('0x8a')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x8b'));db['Interval']=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x8c'));db['Pause']=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/pause/pause.model');db[_0x1e40('0x8d')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x8e'));db[_0x1e40('0x8f')]=db[_0x1e40('0x1')]['import'](_0x1e40('0x90'));db[_0x1e40('0x91')]=db['sequelize'][_0x1e40('0x15')]('../api/schedule/schedule.model');db[_0x1e40('0x92')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x93'));db[_0x1e40('0x94')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0x95'));db[_0x1e40('0x96')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/template/template.model');db['Trigger']=db[_0x1e40('0x1')]['import'](_0x1e40('0x97'));db[_0x1e40('0x98')]=db[_0x1e40('0x1')]['import']('../api/variable/variable.model');db[_0x1e40('0x99')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x9a'));db[_0x1e40('0x9b')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x9c'));db[_0x1e40('0x9d')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x9e'));db[_0x1e40('0x9f')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xa0'));db[_0x1e40('0xa1')]=db['sequelize']['import'](_0x1e40('0xa2'));db[_0x1e40('0xa3')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0xa4'));db['AnalyticFieldReport']=db['sequelize']['import'](_0x1e40('0xa5'));db[_0x1e40('0xa6')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0xa7'));db['SalesforceAccount']=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x1e40('0x1')]['import'](_0x1e40('0xa8'));db['SalesforceField']=db['sequelize'][_0x1e40('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0x1e40('0xa9')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xaa'));db['SugarcrmConfiguration']=db['sequelize'][_0x1e40('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x1e40('0xab')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xac'));db['DeskAccount']=db[_0x1e40('0x1')]['import'](_0x1e40('0xad'));db[_0x1e40('0xae')]=db['sequelize'][_0x1e40('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x1e40('0xaf')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/intDeskField/intDeskField.model');db[_0x1e40('0xb0')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xb1'));db[_0x1e40('0xb2')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x1e40('0xb3')]=db[_0x1e40('0x1')]['import'](_0x1e40('0xb4'));db[_0x1e40('0xb5')]=db[_0x1e40('0x1')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x1e40('0x1')]['import'](_0x1e40('0xb6'));db[_0x1e40('0xb7')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db[_0x1e40('0xb8')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xb9'));db[_0x1e40('0xba')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xbb'));db[_0x1e40('0xbc')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xbd'));db[_0x1e40('0xbe')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0xbf'));db[_0x1e40('0xc0')]=db[_0x1e40('0x1')]['import'](_0x1e40('0xc1'));db[_0x1e40('0xc2')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xc3'));db['ServicenowAccount']=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x1e40('0xc4')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xc5'));db[_0x1e40('0xc6')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0x1e40('0xc7')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x1e40('0xc8')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xc9'));db[_0x1e40('0xca')]=db['sequelize'][_0x1e40('0x15')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x1e40('0x99')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0x9a'));db['Network']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xcb'));db[_0x1e40('0xcc')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xcd'));db['ChatInternalMessage']=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xce'));db['JscriptyQuestionReport']=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x1e40('0xcf')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xd0'));db[_0x1e40('0xd1')]=db['sequelize']['import'](_0x1e40('0xd2'));db[_0x1e40('0xd3')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xd4'));db['SquareDetailsReport']=db[_0x1e40('0x1')]['import'](_0x1e40('0xd5'));db[_0x1e40('0xd6')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xd7'));db['Setting']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xd8'));db[_0x1e40('0xd9')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xda'));db['SquareProject']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xdb'));db[_0x1e40('0xdc')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xdd'));db[_0x1e40('0xde')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xdf'));db[_0x1e40('0xe0')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xe1'));db[_0x1e40('0xe2')]=db[_0x1e40('0x1')]['import'](_0x1e40('0xe3'));db[_0x1e40('0xe4')]=db['sequelize']['import'](_0x1e40('0xe5'));db[_0x1e40('0xe6')]=db[_0x1e40('0x1')]['import'](_0x1e40('0xe7'));db[_0x1e40('0xe8')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xe9'));db['Plugin']=db['sequelize'][_0x1e40('0x15')]('../api/plugin/plugin.model');db[_0x1e40('0xea')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xeb'));db['ChatTransferReport']=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xec'));db[_0x1e40('0xed')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xee'));db[_0x1e40('0xef')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xf0'));db[_0x1e40('0xf1')]=db[_0x1e40('0x1')][_0x1e40('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0x1e40('0xf2')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0xf3'));db[_0x1e40('0xf4')]=db['sequelize'][_0x1e40('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0x1e40('0xf5')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xf6'));db[_0x1e40('0xf7')]=db[_0x1e40('0x1')][_0x1e40('0x15')](_0x1e40('0xf8'));db[_0x1e40('0xf9')]=db['sequelize'][_0x1e40('0x15')](_0x1e40('0xfa'));db['User'][_0x1e40('0xfb')](db['VoiceMail'],{'as':_0x1e40('0x24'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x14')][_0x1e40('0xfe')](db[_0x1e40('0x20')],{'as':_0x1e40('0xff'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x14')]['hasMany'](db[_0x1e40('0x33')],{'as':_0x1e40('0x100'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x14')][_0x1e40('0xfe')](db[_0x1e40('0x1a')],{'as':_0x1e40('0x101'),'onDelete':_0x1e40('0xfc'),'hooks':!![]});db['User']['hasMany'](db[_0x1e40('0x7f')],{'as':_0x1e40('0x102'),'foreignKey':_0x1e40('0xfd')});db['User']['hasMany'](db['CmHopperHistory'],{'as':_0x1e40('0x103'),'foreignKey':'UserId'});db[_0x1e40('0x14')][_0x1e40('0xfe')](db[_0x1e40('0x82')],{'as':_0x1e40('0x82'),'foreignKey':'UserId'});db['User'][_0x1e40('0xfe')](db[_0x1e40('0x68')],{'as':_0x1e40('0x104'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x14')][_0x1e40('0xfe')](db[_0x1e40('0x71')],{'as':_0x1e40('0x105'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x14')]['hasMany'](db[_0x1e40('0x5f')],{'as':_0x1e40('0x106'),'foreignKey':'UserId'});db[_0x1e40('0x14')][_0x1e40('0xfe')](db[_0x1e40('0x53')],{'as':'FaxInteractions','foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x14')][_0x1e40('0xfe')](db[_0x1e40('0x47')],{'as':'MailInteractions','foreignKey':'UserId'});db['User'][_0x1e40('0x107')](db[_0x1e40('0xf5')],{'as':'UserProfile','foreignKey':_0x1e40('0x108')});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x76')],{'as':_0x1e40('0x10a'),'through':_0x1e40('0x10b')});db['User'][_0x1e40('0x109')](db[_0x1e40('0x7b')],{'as':_0x1e40('0x10c'),'through':_0x1e40('0x10d')});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0xf2')],{'as':_0x1e40('0x10e'),'through':_0x1e40('0x10f')});db[_0x1e40('0x14')]['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x47')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x71')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x1e40('0x14')][_0x1e40('0x109')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x1e40('0x110')});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x5f')],{'as':_0x1e40('0x106'),'through':_0x1e40('0x111')});db[_0x1e40('0x14')][_0x1e40('0x109')](db['OpenchannelInteraction'],{'as':_0x1e40('0x104'),'through':_0x1e40('0x112')});db[_0x1e40('0x14')][_0x1e40('0x109')](db['VoiceQueue'],{'as':_0x1e40('0x113'),'through':'UserVoiceQueue','required':![]});db['User']['belongsToMany'](db['MailQueue'],{'as':_0x1e40('0x114'),'through':'UserMailQueue','required':![]});db[_0x1e40('0x14')]['belongsToMany'](db[_0x1e40('0x115')],{'as':_0x1e40('0x116'),'through':_0x1e40('0x37'),'required':![],'hooks':!![]});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x57')],{'as':_0x1e40('0x117'),'through':_0x1e40('0x3b'),'required':![]});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x62')],{'as':_0x1e40('0x118'),'through':_0x1e40('0x3c'),'required':![]});db[_0x1e40('0x14')][_0x1e40('0x109')](db['OpenchannelQueue'],{'as':_0x1e40('0x119'),'through':_0x1e40('0x3e'),'required':![]});db[_0x1e40('0x14')]['belongsToMany'](db[_0x1e40('0xf2')],{'through':_0x1e40('0x10f')});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0xf4')],{'as':_0x1e40('0x11a'),'through':'user_has_voice_prefixes','required':![]});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x11b')],{'as':_0x1e40('0x11c'),'through':'user_has_chat_websites'});db[_0x1e40('0x14')][_0x1e40('0x109')](db['FaxAccount'],{'as':_0x1e40('0x11d'),'through':_0x1e40('0x11e')});db[_0x1e40('0x14')][_0x1e40('0x109')](db['MailAccount'],{'as':_0x1e40('0x11f'),'through':_0x1e40('0x120')});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x64')],{'as':_0x1e40('0x121'),'through':_0x1e40('0x122')});db[_0x1e40('0x14')][_0x1e40('0x109')](db['SmsAccount'],{'as':_0x1e40('0x123'),'through':_0x1e40('0x124')});db[_0x1e40('0x14')][_0x1e40('0x109')](db[_0x1e40('0x125')],{'as':_0x1e40('0x126'),'through':_0x1e40('0x127')});db['VoiceChanSpy']['hasMany'](db[_0x1e40('0x1a')],{'as':_0x1e40('0x128'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x129')});db[_0x1e40('0x12a')][_0x1e40('0xfe')](db[_0x1e40('0x1a')],{'onDelete':_0x1e40('0xfc')});db[_0x1e40('0x1a')][_0x1e40('0xfe')](db['VoiceExtension'],{'as':_0x1e40('0x12b'),'onDelete':_0x1e40('0xfc')});db[_0x1e40('0x1c')][_0x1e40('0x109')](db[_0x1e40('0x92')],{'as':_0x1e40('0x12c'),'through':_0x1e40('0x12d')});db[_0x1e40('0x1e')][_0x1e40('0xfe')](db[_0x1e40('0x33')],{'as':_0x1e40('0x12e'),'foreignKey':_0x1e40('0x12f')});db[_0x1e40('0x1e')][_0x1e40('0xfe')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x1e40('0x12f')});db['VoiceQueue'][_0x1e40('0xfe')](db[_0x1e40('0x7f')],{'as':_0x1e40('0x102'),'foreignKey':'VoiceQueueId'});db[_0x1e40('0x1e')]['hasMany'](db[_0x1e40('0x80')],{'as':_0x1e40('0x130'),'foreignKey':_0x1e40('0x12f')});db['VoiceQueue'][_0x1e40('0xfe')](db[_0x1e40('0x82')],{'as':_0x1e40('0x82'),'foreignKey':_0x1e40('0x12f')});db['VoiceQueue'][_0x1e40('0xfe')](db[_0x1e40('0x131')],{'as':_0x1e40('0x132'),'foreignKey':'VoiceQueueId'});db[_0x1e40('0x1e')][_0x1e40('0xfe')](db[_0x1e40('0xcf')],{'as':'JscriptySessions','foreignKey':_0x1e40('0x12f')});db['VoiceQueue'][_0x1e40('0x107')](db[_0x1e40('0x2f')],{'as':'Trunk','foreignKey':_0x1e40('0x133')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0x1e40('0x134'),'foreignKey':_0x1e40('0x135')});db['VoiceQueue'][_0x1e40('0x107')](db['Interval'],{'as':_0x1e40('0x136'),'foreignKey':_0x1e40('0x137')});db[_0x1e40('0x1e')][_0x1e40('0x107')](db['Pause'],{'as':_0x1e40('0x138'),'foreignKey':_0x1e40('0x139')});db[_0x1e40('0x1e')][_0x1e40('0x109')](db['CmList'],{'as':_0x1e40('0x10e'),'through':_0x1e40('0x13a')});db['VoiceQueue']['belongsToMany'](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':'UserVoiceQueue'});db[_0x1e40('0x1e')][_0x1e40('0x109')](db[_0x1e40('0xe0')],{'as':_0x1e40('0x13c'),'through':_0x1e40('0x13d')});db[_0x1e40('0x1e')]['belongsToMany'](db[_0x1e40('0xf2')],{'as':_0x1e40('0x13e'),'through':_0x1e40('0x13f')});db[_0x1e40('0x20')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'as':_0x1e40('0x14'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x22')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'as':_0x1e40('0x14'),'foreignKey':_0x1e40('0xfd')});db['VoiceMail'][_0x1e40('0xfe')](db[_0x1e40('0x140')],{'as':_0x1e40('0x141'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x142'),'sourceKey':_0x1e40('0x143')});db[_0x1e40('0x140')][_0x1e40('0x107')](db[_0x1e40('0x24')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0x1e40('0x27')]['hasMany'](db[_0x1e40('0x2c')],{'as':_0x1e40('0x144'),'foreignKey':_0x1e40('0x145'),'constraints':![]});db['VoiceCallReport'][_0x1e40('0xfe')](db[_0x1e40('0x2a')],{'as':'AgentReports','foreignKey':_0x1e40('0x145'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db['User'],{'as':_0x1e40('0x14'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x27')]['belongsTo'](db['CmContact'],{'as':_0x1e40('0x146'),'foreignKey':_0x1e40('0x147')});db[_0x1e40('0x40')]['belongsTo'](db[_0x1e40('0x148')],{'as':_0x1e40('0x148'),'foreignKey':_0x1e40('0x149')});db['MailServerOut']['belongsTo'](db[_0x1e40('0x148')],{'as':'MailAccount','foreignKey':_0x1e40('0x149')});db[_0x1e40('0x148')][_0x1e40('0xfb')](db[_0x1e40('0x40')],{'as':'Imap','onDelete':_0x1e40('0xfc')});db[_0x1e40('0x148')][_0x1e40('0xfb')](db[_0x1e40('0x42')],{'as':_0x1e40('0x14a'),'onDelete':_0x1e40('0xfc')});db[_0x1e40('0x148')][_0x1e40('0xfe')](db['Disposition'],{'as':_0x1e40('0x14b'),'foreignKey':'MailAccountId'});db[_0x1e40('0x148')][_0x1e40('0xfe')](db[_0x1e40('0x87')],{'as':_0x1e40('0x14c'),'foreignKey':_0x1e40('0x149')});db[_0x1e40('0x148')][_0x1e40('0xfe')](db[_0x1e40('0x48')],{'as':'Messages','foreignKey':_0x1e40('0x149')});db['MailAccount'][_0x1e40('0xfe')](db[_0x1e40('0x47')],{'as':_0x1e40('0x14d')});db['MailAccount']['hasMany'](db[_0x1e40('0x14e')],{'as':_0x1e40('0x12b')});db[_0x1e40('0x148')][_0x1e40('0x107')](db['CmList'],{'as':'List','foreignKey':_0x1e40('0x14f')});db['MailAccount'][_0x1e40('0x107')](db[_0x1e40('0x96')],{'as':_0x1e40('0x96'),'foreignKey':_0x1e40('0x150')});db[_0x1e40('0x148')][_0x1e40('0x107')](db[_0x1e40('0x151')],{'as':_0x1e40('0x138'),'foreignKey':_0x1e40('0x139')});db[_0x1e40('0x148')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':_0x1e40('0x120')});db[_0x1e40('0x152')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':'UserMailQueue'});db[_0x1e40('0x152')][_0x1e40('0x109')](db[_0x1e40('0xe0')],{'through':_0x1e40('0x153'),'as':_0x1e40('0x13c')});db[_0x1e40('0x47')]['hasMany'](db[_0x1e40('0x48')],{'as':_0x1e40('0x141'),'onDelete':'cascade','foreignKey':_0x1e40('0x154')});db[_0x1e40('0x47')][_0x1e40('0x107')](db[_0x1e40('0x148')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x149')});db['MailInteraction']['belongsTo'](db[_0x1e40('0x7b')],{'as':_0x1e40('0x146'),'foreignKey':_0x1e40('0x147')});db['MailInteraction'][_0x1e40('0x107')](db[_0x1e40('0x14')],{'as':'Owner','foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x47')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':_0x1e40('0x156'),'as':_0x1e40('0x157')});db[_0x1e40('0x47')][_0x1e40('0x109')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x1e40('0x158')});db['MailInteraction'][_0x1e40('0x109')](db['User'],{'as':_0x1e40('0x159'),'through':_0x1e40('0x15a'),'foreignKey':_0x1e40('0x154')});db[_0x1e40('0x48')]['hasMany'](db[_0x1e40('0xe8')],{'as':_0x1e40('0x15b'),'onDelete':_0x1e40('0xfc')});db[_0x1e40('0x48')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'as':_0x1e40('0x14')});db[_0x1e40('0x48')][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'onDelete':'cascade','as':'Contact'});db['MailMessage'][_0x1e40('0x107')](db[_0x1e40('0x47')],{'as':_0x1e40('0x15c'),'foreignKey':_0x1e40('0x154')});db[_0x1e40('0x48')][_0x1e40('0x107')](db[_0x1e40('0x148')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x149')});db[_0x1e40('0x14e')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'onDelete':'restrict'});db[_0x1e40('0x14e')][_0x1e40('0x107')](db[_0x1e40('0x152')],{'onDelete':_0x1e40('0x15d')});db[_0x1e40('0x14e')][_0x1e40('0x107')](db[_0x1e40('0x148')],{'onDelete':_0x1e40('0x15d')});db['MailApplication'][_0x1e40('0x107')](db[_0x1e40('0x136')],{'onDelete':_0x1e40('0x15d'),'foreignKey':'IntervalId'});db[_0x1e40('0x14e')][_0x1e40('0x107')](db[_0x1e40('0x94')],{'onDelete':_0x1e40('0x15d'),'foreignKey':_0x1e40('0x15e')});db[_0x1e40('0x4b')][_0x1e40('0x107')](db[_0x1e40('0x148')],{});db[_0x1e40('0x4b')][_0x1e40('0x107')](db[_0x1e40('0xf2')],{'as':'List','foreignKey':_0x1e40('0x14f')});db['MailQueueReport'][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x1e40('0x4b')][_0x1e40('0x107')](db[_0x1e40('0x47')],{});db[_0x1e40('0x4b')][_0x1e40('0x107')](db['MailMessage'],{});db[_0x1e40('0x4b')]['belongsTo'](db[_0x1e40('0x14')],{});db[_0x1e40('0x4b')][_0x1e40('0x107')](db[_0x1e40('0x152')],{});db[_0x1e40('0x4d')]['hasMany'](db[_0x1e40('0x4e')],{'as':_0x1e40('0x15f'),'onDelete':'cascade'});db['FaxAccount'][_0x1e40('0xfe')](db[_0x1e40('0x160')],{'as':_0x1e40('0x14b'),'foreignKey':_0x1e40('0x161')});db[_0x1e40('0x50')]['hasMany'](db[_0x1e40('0x87')],{'as':_0x1e40('0x14c'),'foreignKey':_0x1e40('0x161')});db[_0x1e40('0x50')][_0x1e40('0xfe')](db[_0x1e40('0x53')],{'as':_0x1e40('0x14d')});db[_0x1e40('0x50')][_0x1e40('0xfe')](db[_0x1e40('0x51')],{'as':_0x1e40('0x12b')});db[_0x1e40('0x50')][_0x1e40('0xfe')](db['VoiceExtension'],{'as':_0x1e40('0x162'),'onDelete':_0x1e40('0xfc')});db[_0x1e40('0x50')]['hasMany'](db[_0x1e40('0x55')],{'as':_0x1e40('0x141')});db[_0x1e40('0x50')][_0x1e40('0x107')](db[_0x1e40('0x2f')],{'as':_0x1e40('0x2f')});db['FaxAccount']['belongsTo'](db[_0x1e40('0xf2')],{'as':'List','foreignKey':_0x1e40('0x14f')});db[_0x1e40('0x50')][_0x1e40('0x107')](db[_0x1e40('0x151')],{'as':_0x1e40('0x138'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x1e40('0x109')](db['User'],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x1e40('0x51')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'onDelete':'restrict'});db[_0x1e40('0x51')]['belongsTo'](db[_0x1e40('0x57')],{'onDelete':_0x1e40('0x15d')});db[_0x1e40('0x51')][_0x1e40('0x107')](db['FaxAccount'],{'onDelete':'restrict'});db['FaxApplication'][_0x1e40('0x107')](db['Tag'],{'onDelete':_0x1e40('0x15d'),'foreignKey':_0x1e40('0x15e')});db[_0x1e40('0x53')][_0x1e40('0xfe')](db['FaxMessage'],{'as':_0x1e40('0x141'),'onDelete':_0x1e40('0xfc'),'foreignKey':'FaxInteractionId'});db[_0x1e40('0x53')][_0x1e40('0x107')](db[_0x1e40('0x50')],{'as':_0x1e40('0x155'),'foreignKey':'FaxAccountId'});db[_0x1e40('0x53')]['belongsTo'](db[_0x1e40('0x7b')],{'as':'Contact','foreignKey':_0x1e40('0x147')});db[_0x1e40('0x53')][_0x1e40('0x107')](db['User'],{'as':_0x1e40('0x163'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x53')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':_0x1e40('0x164'),'as':_0x1e40('0x157')});db[_0x1e40('0x53')][_0x1e40('0x109')](db['Tag'],{'through':_0x1e40('0x164'),'as':_0x1e40('0x158')});db[_0x1e40('0x53')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x159'),'through':_0x1e40('0x110'),'foreignKey':_0x1e40('0x165')});db[_0x1e40('0x55')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'onDelete':_0x1e40('0xfc'),'as':'User'});db['FaxMessage'][_0x1e40('0x107')](db[_0x1e40('0x53')],{'as':_0x1e40('0x15c'),'foreignKey':_0x1e40('0x165')});db['FaxMessage'][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'onDelete':_0x1e40('0xfc'),'as':_0x1e40('0x146')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':_0x1e40('0xe8'),'foreignKey':_0x1e40('0x166')});db[_0x1e40('0x55')][_0x1e40('0x107')](db[_0x1e40('0x50')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x161')});db[_0x1e40('0x57')][_0x1e40('0x109')](db['User'],{'as':_0x1e40('0x13b'),'through':'UserFaxQueue'});db[_0x1e40('0x57')][_0x1e40('0x109')](db['Team'],{'through':_0x1e40('0x167'),'as':_0x1e40('0x13c')});db['FaxQueueReport'][_0x1e40('0x107')](db[_0x1e40('0x50')],{});db[_0x1e40('0x59')][_0x1e40('0x107')](db['CmList'],{'as':_0x1e40('0x168'),'foreignKey':_0x1e40('0x14f')});db['FaxQueueReport'][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'as':'Contact','foreignKey':_0x1e40('0x147')});db[_0x1e40('0x59')][_0x1e40('0x107')](db[_0x1e40('0x53')],{});db['FaxQueueReport'][_0x1e40('0x107')](db[_0x1e40('0x55')],{});db[_0x1e40('0x59')][_0x1e40('0x107')](db[_0x1e40('0x14')],{});db[_0x1e40('0x59')]['belongsTo'](db[_0x1e40('0x57')],{});db[_0x1e40('0x5b')][_0x1e40('0xfe')](db[_0x1e40('0x160')],{'as':_0x1e40('0x14b'),'foreignKey':_0x1e40('0x169')});db['SmsAccount'][_0x1e40('0xfe')](db[_0x1e40('0x87')],{'as':_0x1e40('0x14c'),'foreignKey':_0x1e40('0x169')});db['SmsAccount'][_0x1e40('0xfe')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x1e40('0x169')});db[_0x1e40('0x5b')][_0x1e40('0xfe')](db[_0x1e40('0x5f')],{'as':'Interactions'});db[_0x1e40('0x5b')]['hasMany'](db[_0x1e40('0x5d')],{'as':'Applications'});db['SmsAccount']['belongsTo'](db[_0x1e40('0xf2')],{'as':_0x1e40('0x168'),'foreignKey':'ListId'});db[_0x1e40('0x5b')]['belongsTo'](db[_0x1e40('0x151')],{'as':'mandatoryDispositionPause','foreignKey':_0x1e40('0x139')});db[_0x1e40('0x5b')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':'user_has_sms_accounts'});db[_0x1e40('0x5d')]['belongsTo'](db[_0x1e40('0x14')],{'onDelete':'restrict'});db[_0x1e40('0x5d')][_0x1e40('0x107')](db[_0x1e40('0x62')],{'onDelete':_0x1e40('0x15d')});db[_0x1e40('0x5d')][_0x1e40('0x107')](db[_0x1e40('0x5b')],{'onDelete':_0x1e40('0x15d')});db[_0x1e40('0x5d')][_0x1e40('0x107')](db[_0x1e40('0x136')],{'onDelete':_0x1e40('0x15d'),'foreignKey':_0x1e40('0x137')});db[_0x1e40('0x5d')][_0x1e40('0x107')](db['Tag'],{'onDelete':_0x1e40('0x15d'),'foreignKey':_0x1e40('0x15e')});db[_0x1e40('0x5f')][_0x1e40('0xfe')](db[_0x1e40('0x16a')],{'as':_0x1e40('0x141'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x16b')});db['SmsInteraction']['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0x1e40('0x169')});db['SmsInteraction'][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x1e40('0x5f')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'as':'Owner','foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x5f')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':_0x1e40('0x16c'),'as':'Tags'});db['SmsInteraction'][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':_0x1e40('0x16c'),'as':_0x1e40('0x158')});db[_0x1e40('0x5f')]['belongsToMany'](db[_0x1e40('0x14')],{'as':'Users','through':_0x1e40('0x111'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x1e40('0x107')](db[_0x1e40('0x14')],{'as':_0x1e40('0x14')});db['SmsMessage'][_0x1e40('0x107')](db['CmContact'],{'onDelete':_0x1e40('0xfc'),'as':_0x1e40('0x146')});db[_0x1e40('0x16a')][_0x1e40('0x107')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x1e40('0x15c'),'foreignKey':_0x1e40('0x16b')});db[_0x1e40('0x16a')][_0x1e40('0x107')](db[_0x1e40('0x5b')],{'as':'Account','foreignKey':_0x1e40('0x169')});db['SmsQueue'][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':_0x1e40('0x3c'),'foreignKey':_0x1e40('0x16d')});db[_0x1e40('0x62')][_0x1e40('0x109')](db[_0x1e40('0xe0')],{'through':'team_has_sms_queues','as':'Teams'});db[_0x1e40('0x64')][_0x1e40('0xfe')](db[_0x1e40('0x160')],{'as':_0x1e40('0x14b'),'foreignKey':_0x1e40('0x16e')});db[_0x1e40('0x64')][_0x1e40('0xfe')](db[_0x1e40('0x87')],{'as':_0x1e40('0x14c'),'foreignKey':_0x1e40('0x16e')});db[_0x1e40('0x64')]['hasMany'](db[_0x1e40('0x68')],{'as':'Interactions','foreignKey':_0x1e40('0x16e')});db[_0x1e40('0x64')][_0x1e40('0xfe')](db[_0x1e40('0x6a')],{'as':_0x1e40('0x141'),'foreignKey':_0x1e40('0x16e')});db['OpenchannelAccount'][_0x1e40('0xfe')](db['OpenchannelApplication'],{'as':_0x1e40('0x12b'),'foreignKey':_0x1e40('0x16e')});db[_0x1e40('0x64')][_0x1e40('0x107')](db['CmList'],{'as':'List','foreignKey':_0x1e40('0x14f')});db[_0x1e40('0x64')][_0x1e40('0x107')](db[_0x1e40('0x151')],{'as':_0x1e40('0x138'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1e40('0x64')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':_0x1e40('0x122')});db[_0x1e40('0x66')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'onDelete':_0x1e40('0x15d')});db[_0x1e40('0x66')][_0x1e40('0x107')](db[_0x1e40('0x6c')],{'onDelete':_0x1e40('0x15d'),'foreignKey':'OpenchannelQueueId'});db[_0x1e40('0x66')][_0x1e40('0x107')](db[_0x1e40('0x64')],{'onDelete':'restrict','foreignKey':_0x1e40('0x16e')});db[_0x1e40('0x66')][_0x1e40('0x107')](db['Interval'],{'onDelete':_0x1e40('0x15d'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x1e40('0x107')](db[_0x1e40('0x94')],{'onDelete':_0x1e40('0x15d'),'foreignKey':_0x1e40('0x15e')});db[_0x1e40('0x68')]['hasMany'](db[_0x1e40('0x6a')],{'as':'Messages','onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x16f')});db[_0x1e40('0x68')]['belongsTo'](db[_0x1e40('0x64')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x16e')});db[_0x1e40('0x68')][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'as':'Contact','foreignKey':_0x1e40('0x147')});db[_0x1e40('0x68')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'as':_0x1e40('0x163'),'foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x68')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0x1e40('0x68')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':_0x1e40('0x170'),'as':_0x1e40('0x158')});db[_0x1e40('0x68')]['belongsToMany'](db[_0x1e40('0x14')],{'as':_0x1e40('0x159'),'through':_0x1e40('0x112'),'foreignKey':'OpenchannelInteractionId'});db[_0x1e40('0x6a')][_0x1e40('0x107')](db['User'],{'onDelete':'cascade','as':'User'});db[_0x1e40('0x6a')][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'onDelete':_0x1e40('0xfc'),'as':_0x1e40('0x146')});db[_0x1e40('0x6a')]['belongsTo'](db[_0x1e40('0x68')],{'onDelete':_0x1e40('0xfc'),'as':_0x1e40('0x15c'),'foreignKey':'OpenchannelInteractionId'});db[_0x1e40('0x6a')][_0x1e40('0x107')](db['Attachment'],{'as':_0x1e40('0xe8'),'foreignKey':_0x1e40('0x166')});db[_0x1e40('0x6a')][_0x1e40('0x107')](db[_0x1e40('0x64')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x16e')});db[_0x1e40('0x6c')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':_0x1e40('0x3e'),'foreignKey':_0x1e40('0x171')});db[_0x1e40('0x6c')][_0x1e40('0x109')](db[_0x1e40('0xe0')],{'through':_0x1e40('0x172'),'as':_0x1e40('0x13c')});db[_0x1e40('0x11b')][_0x1e40('0xfe')](db[_0x1e40('0x160')],{'as':'Dispositions','foreignKey':_0x1e40('0x173')});db['ChatWebsite'][_0x1e40('0xfe')](db[_0x1e40('0x87')],{'as':'Answers','foreignKey':_0x1e40('0x173')});db['ChatWebsite'][_0x1e40('0xfe')](db[_0x1e40('0x78')],{'as':_0x1e40('0x174')});db[_0x1e40('0x11b')][_0x1e40('0xfe')](db['ChatInteraction'],{'as':'Interactions'});db[_0x1e40('0x11b')][_0x1e40('0xfe')](db['ChatApplication'],{'as':_0x1e40('0x12b')});db[_0x1e40('0x11b')][_0x1e40('0xfe')](db[_0x1e40('0x72')],{'as':_0x1e40('0x141')});db[_0x1e40('0x11b')][_0x1e40('0x107')](db[_0x1e40('0xf2')],{'as':_0x1e40('0x168'),'foreignKey':_0x1e40('0x14f')});db[_0x1e40('0x11b')][_0x1e40('0x107')](db['Interval'],{'as':'Interval','foreignKey':_0x1e40('0x137')});db['ChatWebsite'][_0x1e40('0x107')](db[_0x1e40('0x151')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x1e40('0x13b'),'through':_0x1e40('0x175')});db[_0x1e40('0x6f')][_0x1e40('0x107')](db[_0x1e40('0x64')],{});db['OpenchannelQueueReport'][_0x1e40('0x107')](db[_0x1e40('0xf2')],{'as':_0x1e40('0x168'),'foreignKey':_0x1e40('0x14f')});db[_0x1e40('0x6f')]['belongsTo'](db[_0x1e40('0x7b')],{'as':'Contact','foreignKey':_0x1e40('0x147')});db[_0x1e40('0x6f')][_0x1e40('0x107')](db[_0x1e40('0x68')],{});db[_0x1e40('0x6f')][_0x1e40('0x107')](db[_0x1e40('0x6a')],{});db['OpenchannelQueueReport'][_0x1e40('0x107')](db[_0x1e40('0x14')],{});db[_0x1e40('0x6f')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x1e40('0x176')][_0x1e40('0x107')](db['User'],{'as':_0x1e40('0x177'),'foreignKey':'UserId','onDelete':_0x1e40('0x15d')});db[_0x1e40('0x176')][_0x1e40('0x107')](db[_0x1e40('0x115')],{'as':_0x1e40('0x178'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x1e40('0x176')][_0x1e40('0x107')](db[_0x1e40('0x11b')],{'as':'Website','foreignKey':_0x1e40('0x173'),'onDelete':_0x1e40('0x15d')});db[_0x1e40('0x176')][_0x1e40('0x107')](db['Tag'],{'onDelete':_0x1e40('0x15d'),'foreignKey':'TagId'});db[_0x1e40('0x71')][_0x1e40('0xfe')](db[_0x1e40('0x72')],{'as':_0x1e40('0x141'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x179')});db[_0x1e40('0x71')][_0x1e40('0x107')](db[_0x1e40('0x11b')],{'as':_0x1e40('0x155'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'as':_0x1e40('0x146'),'foreignKey':_0x1e40('0x147')});db['ChatInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x1e40('0xfd')});db[_0x1e40('0x71')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':_0x1e40('0x17a'),'as':_0x1e40('0x157')});db[_0x1e40('0x71')][_0x1e40('0x109')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x1e40('0x158')});db['ChatInteraction'][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x159'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x1e40('0x107')](db[_0x1e40('0x14')],{'onDelete':_0x1e40('0xfc'),'as':_0x1e40('0x14')});db[_0x1e40('0x72')]['belongsTo'](db[_0x1e40('0x7b')],{'onDelete':_0x1e40('0xfc'),'as':_0x1e40('0x146'),'foreignKey':'ContactId'});db[_0x1e40('0x72')][_0x1e40('0x107')](db[_0x1e40('0x71')],{'onDelete':_0x1e40('0xfc'),'as':_0x1e40('0x15c'),'foreignKey':'ChatInteractionId'});db[_0x1e40('0x72')][_0x1e40('0x107')](db[_0x1e40('0xe8')],{'as':'Attachment','foreignKey':_0x1e40('0x166')});db[_0x1e40('0x72')][_0x1e40('0x107')](db['ChatWebsite'],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x173')});db['ChatOfflineMessage'][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'onDelete':_0x1e40('0xfc'),'as':_0x1e40('0x146'),'foreignKey':_0x1e40('0x147')});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x173')});db[_0x1e40('0x115')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':_0x1e40('0x37'),'hooks':!![]});db[_0x1e40('0x115')][_0x1e40('0x109')](db[_0x1e40('0xe0')],{'through':'team_has_chat_queues','as':_0x1e40('0x13c')});db[_0x1e40('0x76')]['hasMany'](db['ChatInternalMessage'],{'as':_0x1e40('0x141'),'foreignKey':'ChatGroupId','onDelete':_0x1e40('0xfc')});db[_0x1e40('0x76')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x12e'),'through':_0x1e40('0x10b')});db[_0x1e40('0x78')][_0x1e40('0x107')](db[_0x1e40('0x11b')],{'as':_0x1e40('0x17b'),'foreignKey':_0x1e40('0x173')});db['CmCompany'][_0x1e40('0xfe')](db[_0x1e40('0x7b')],{'as':_0x1e40('0x10c'),'foreignKey':_0x1e40('0x17c')});db[_0x1e40('0x7b')][_0x1e40('0xfe')](db[_0x1e40('0x17d')],{'as':_0x1e40('0x17e'),'foreignKey':_0x1e40('0x147')});db[_0x1e40('0x7b')][_0x1e40('0xfe')](db['CmHopperFinal'],{'as':_0x1e40('0x102'),'foreignKey':_0x1e40('0x147')});db['CmContact']['hasMany'](db[_0x1e40('0x80')],{'as':_0x1e40('0x130'),'foreignKey':_0x1e40('0x147')});db[_0x1e40('0x7b')][_0x1e40('0xfe')](db[_0x1e40('0x82')],{'as':_0x1e40('0x82'),'foreignKey':_0x1e40('0x147')});db[_0x1e40('0x7b')][_0x1e40('0xfe')](db['JscriptySessionReport'],{'as':_0x1e40('0x17f'),'foreignKey':_0x1e40('0x147')});db[_0x1e40('0x7b')][_0x1e40('0xfe')](db[_0x1e40('0x68')],{'as':_0x1e40('0x104'),'foreignKey':_0x1e40('0x147'),'onDelete':_0x1e40('0x15d')});db[_0x1e40('0x7b')][_0x1e40('0xfe')](db[_0x1e40('0x71')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x1e40('0x7b')]['hasMany'](db[_0x1e40('0x5f')],{'as':'SmsInteractions','foreignKey':_0x1e40('0x147'),'onDelete':_0x1e40('0x15d')});db['CmContact'][_0x1e40('0xfe')](db[_0x1e40('0x53')],{'as':_0x1e40('0x180'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact']['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x1e40('0x15d')});db[_0x1e40('0x7b')][_0x1e40('0x107')](db['CmCompany'],{'as':_0x1e40('0x181'),'foreignKey':_0x1e40('0x17c')});db[_0x1e40('0x7b')][_0x1e40('0x107')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x1e40('0xfc')});db[_0x1e40('0x7b')]['belongsToMany'](db[_0x1e40('0x14')],{'as':_0x1e40('0x159'),'through':_0x1e40('0x10d')});db[_0x1e40('0x7b')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'as':_0x1e40('0x157'),'through':_0x1e40('0x182')});db[_0x1e40('0x7b')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':_0x1e40('0x182'),'as':_0x1e40('0x158')});db[_0x1e40('0x17d')][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'as':_0x1e40('0x146'),'foreignKey':_0x1e40('0x147'),'onDelete':_0x1e40('0xfc')});db['CmHopper']['belongsTo'](db[_0x1e40('0xf2')],{'as':_0x1e40('0x168'),'foreignKey':_0x1e40('0x14f'),'onDelete':_0x1e40('0xfc')});db['CmHopper'][_0x1e40('0x107')](db['User'],{'as':'Agent','foreignKey':_0x1e40('0xfd')});db['CmHopper']['belongsTo'](db[_0x1e40('0x1e')],{'as':'Queue','foreignKey':_0x1e40('0x12f'),'onDelete':'cascade'});db[_0x1e40('0x17d')][_0x1e40('0x107')](db[_0x1e40('0xe4')],{'as':'Campaign','foreignKey':_0x1e40('0x183'),'onDelete':'cascade'});db[_0x1e40('0x17d')]['belongsTo'](db[_0x1e40('0x14')],{'as':_0x1e40('0x163'),'foreignKey':_0x1e40('0x184')});db['CmHopperBlack']['belongsTo'](db[_0x1e40('0x7b')],{'as':'Contact','foreignKey':_0x1e40('0x147'),'onDelete':_0x1e40('0xfc')});db[_0x1e40('0x131')][_0x1e40('0x107')](db[_0x1e40('0xf2')],{'as':_0x1e40('0x168'),'foreignKey':_0x1e40('0x14f'),'onDelete':'cascade'});db[_0x1e40('0x131')][_0x1e40('0x107')](db[_0x1e40('0x1e')],{'as':_0x1e40('0x178'),'foreignKey':'VoiceQueueId','onDelete':_0x1e40('0xfc')});db[_0x1e40('0x131')][_0x1e40('0x107')](db[_0x1e40('0xe4')],{'as':_0x1e40('0xe4'),'foreignKey':_0x1e40('0x183'),'onDelete':_0x1e40('0xfc')});db[_0x1e40('0x86')][_0x1e40('0xfe')](db[_0x1e40('0x8a')],{'as':{'plural':_0x1e40('0x185'),'singular':_0x1e40('0x186')},'foreignKey':_0x1e40('0x187'),'onDelete':_0x1e40('0xfc'),'hooks':!![]});db[_0x1e40('0x86')]['hasMany'](db[_0x1e40('0x8a')],{'as':{'plural':_0x1e40('0x188'),'singular':_0x1e40('0x189')},'foreignKey':_0x1e40('0x18a'),'onDelete':_0x1e40('0xfc'),'hooks':!![]});db[_0x1e40('0x86')][_0x1e40('0xfe')](db[_0x1e40('0x84')],{'as':_0x1e40('0x18b'),'foreignKey':_0x1e40('0x18c'),'onDelete':_0x1e40('0xfc'),'hooks':!![]});db[_0x1e40('0x136')][_0x1e40('0xfe')](db['Interval'],{'as':_0x1e40('0x18d'),'foreignKey':_0x1e40('0x137'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x1e40('0x136')][_0x1e40('0xfe')](db[_0x1e40('0x1a')],{'as':_0x1e40('0x101'),'foreignKey':'IntervalId','onDelete':_0x1e40('0x15d')});db['Interval'][_0x1e40('0xfe')](db[_0x1e40('0x14e')],{'as':_0x1e40('0x18e'),'foreignKey':'IntervalId'});db['Interval'][_0x1e40('0xfe')](db[_0x1e40('0x176')],{'as':_0x1e40('0x18f'),'foreignKey':_0x1e40('0x137')});db[_0x1e40('0x136')][_0x1e40('0xfe')](db['FaxApplication'],{'as':_0x1e40('0x190'),'foreignKey':'IntervalId'});db[_0x1e40('0x136')]['hasMany'](db[_0x1e40('0x5d')],{'as':'SmsApplications','foreignKey':_0x1e40('0x137')});db[_0x1e40('0x91')]['belongsTo'](db['MailAccount'],{});db[_0x1e40('0x91')][_0x1e40('0x107')](db[_0x1e40('0x9f')],{'foreignKey':_0x1e40('0x191')});db['Schedule'][_0x1e40('0x107')](db['AnalyticCustomReport'],{'foreignKey':_0x1e40('0x192')});db[_0x1e40('0x92')][_0x1e40('0x109')](db[_0x1e40('0x1c')],{'as':_0x1e40('0x193'),'through':_0x1e40('0x12d'),'onDelete':_0x1e40('0x15d')});db['Tag']['belongsToMany'](db['CmContact'],{'through':_0x1e40('0x182')});db['Tag'][_0x1e40('0x109')](db[_0x1e40('0x71')],{'through':_0x1e40('0x17a')});db[_0x1e40('0x94')][_0x1e40('0x109')](db[_0x1e40('0x47')],{'through':'mail_interaction_has_tags'});db[_0x1e40('0x94')][_0x1e40('0x109')](db[_0x1e40('0x5f')],{'through':'sms_interaction_has_tags'});db[_0x1e40('0x94')][_0x1e40('0x109')](db[_0x1e40('0x53')],{'through':_0x1e40('0x164')});db['Tag'][_0x1e40('0x109')](db['OpenchannelInteraction'],{'through':_0x1e40('0x170')});db[_0x1e40('0x194')]['hasMany'](db['Condition'],{'as':{'plural':_0x1e40('0x195'),'singular':_0x1e40('0x196')},'foreignKey':_0x1e40('0x197'),'onDelete':'cascade','hooks':!![]});db[_0x1e40('0x194')]['hasMany'](db['Condition'],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x1e40('0x198'),'onDelete':'cascade','hooks':!![]});db[_0x1e40('0x194')][_0x1e40('0xfe')](db['Action'],{'as':_0x1e40('0x18b'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x1e40('0x9d')][_0x1e40('0xfe')](db[_0x1e40('0x199')],{'as':_0x1e40('0x19a'),'onDelete':'cascade','foreignKey':_0x1e40('0x192'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db['AnalyticFieldReport'],{'as':_0x1e40('0x19a'),'onDelete':'cascade','foreignKey':_0x1e40('0x191')});db[_0x1e40('0xa3')][_0x1e40('0xfe')](db[_0x1e40('0x199')],{'as':_0x1e40('0x19a'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x19b')});db[_0x1e40('0x199')][_0x1e40('0x107')](db['AnalyticMetric'],{'foreignKey':_0x1e40('0x19b')});db[_0x1e40('0x19c')][_0x1e40('0xfe')](db[_0x1e40('0x19d')],{'as':_0x1e40('0x19e'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1e40('0x19d')]['hasMany'](db[_0x1e40('0x19f')],{'as':'Subjects','onDelete':_0x1e40('0xfc'),'foreignKey':'SubjectId'});db[_0x1e40('0x19d')][_0x1e40('0xfe')](db[_0x1e40('0x19f')],{'as':_0x1e40('0x1a0'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0x19d')][_0x1e40('0xfe')](db[_0x1e40('0x19f')],{'as':_0x1e40('0x19a'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0x19d')][_0x1e40('0x107')](db[_0x1e40('0x19c')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0x19f')][_0x1e40('0xfe')](db[_0x1e40('0x19f')],{'as':'Subject','foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0x19f')][_0x1e40('0xfe')](db[_0x1e40('0x19f')],{'as':_0x1e40('0x1a5'),'foreignKey':_0x1e40('0x1a1')});db['SalesforceField'][_0x1e40('0xfe')](db[_0x1e40('0x19f')],{'as':_0x1e40('0x1a6'),'foreignKey':_0x1e40('0x1a2')});db['SalesforceField'][_0x1e40('0x107')](db[_0x1e40('0x98')],{'as':_0x1e40('0x98'),'foreignKey':_0x1e40('0x1a7')});db['SugarcrmAccount'][_0x1e40('0xfe')](db[_0x1e40('0x1a8')],{'as':_0x1e40('0x19e'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0x1a8')]['hasMany'](db[_0x1e40('0xab')],{'as':_0x1e40('0x1a9'),'onDelete':_0x1e40('0xfc'),'foreignKey':'SubjectId'});db[_0x1e40('0x1a8')][_0x1e40('0xfe')](db['SugarcrmField'],{'as':_0x1e40('0x1a0'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0x1a8')][_0x1e40('0xfe')](db[_0x1e40('0xab')],{'as':_0x1e40('0x19a'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0x1a8')][_0x1e40('0x107')](db[_0x1e40('0xa9')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0xab')]['hasMany'](db[_0x1e40('0xab')],{'as':_0x1e40('0x1aa'),'foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0xab')]['hasMany'](db[_0x1e40('0xab')],{'as':_0x1e40('0x1a5'),'foreignKey':_0x1e40('0x1a1')});db['SugarcrmField'][_0x1e40('0xfe')](db[_0x1e40('0xab')],{'as':_0x1e40('0x1a6'),'foreignKey':_0x1e40('0x1a2')});db['SugarcrmField'][_0x1e40('0x107')](db[_0x1e40('0x98')],{'as':_0x1e40('0x98'),'foreignKey':_0x1e40('0x1a7')});db[_0x1e40('0x1ab')][_0x1e40('0xfe')](db[_0x1e40('0xae')],{'as':_0x1e40('0x19e'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0x1e40('0xfe')](db[_0x1e40('0xaf')],{'as':'Subjects','onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0xae')]['hasMany'](db[_0x1e40('0xaf')],{'as':'Descriptions','onDelete':_0x1e40('0xfc'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x1e40('0xfe')](db[_0x1e40('0xaf')],{'as':_0x1e40('0x19a'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xae')][_0x1e40('0x107')](db[_0x1e40('0x1ab')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0xae')]['belongsToMany'](db[_0x1e40('0x94')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x1e40('0xfe')](db[_0x1e40('0xaf')],{'as':'Subject','foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0xaf')][_0x1e40('0xfe')](db[_0x1e40('0xaf')],{'as':'Description','foreignKey':_0x1e40('0x1a1')});db['DeskField'][_0x1e40('0xfe')](db[_0x1e40('0xaf')],{'as':'Field','foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xaf')][_0x1e40('0x107')](db['Variable'],{'as':_0x1e40('0x98'),'foreignKey':_0x1e40('0x1a7')});db[_0x1e40('0xb0')]['hasMany'](db[_0x1e40('0xb2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1e40('0x1a3')});db['ZohoConfiguration'][_0x1e40('0xfe')](db[_0x1e40('0xb3')],{'as':'Subjects','onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0xb2')][_0x1e40('0xfe')](db['ZohoField'],{'as':_0x1e40('0x1a0'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a1')});db['ZohoConfiguration'][_0x1e40('0xfe')](db['ZohoField'],{'as':'Fields','onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xb2')][_0x1e40('0x107')](db[_0x1e40('0xb0')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0xb3')]['hasMany'](db['ZohoField'],{'as':_0x1e40('0x1aa'),'foreignKey':'SubjectId'});db['ZohoField'][_0x1e40('0xfe')](db['ZohoField'],{'as':_0x1e40('0x1a5'),'foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0xb3')][_0x1e40('0xfe')](db['ZohoField'],{'as':_0x1e40('0x1a6'),'foreignKey':'FieldId'});db[_0x1e40('0xb3')][_0x1e40('0x107')](db[_0x1e40('0x98')],{'as':_0x1e40('0x98'),'foreignKey':_0x1e40('0x1a7')});db[_0x1e40('0xb5')][_0x1e40('0xfe')](db[_0x1e40('0x1ac')],{'as':_0x1e40('0x19e'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0x1ac')][_0x1e40('0xfe')](db[_0x1e40('0xb7')],{'as':'Subjects','foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x1e40('0xfe')](db[_0x1e40('0xb7')],{'as':_0x1e40('0x1a0'),'foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0x1ac')][_0x1e40('0xfe')](db[_0x1e40('0xb7')],{'as':_0x1e40('0x19a'),'foreignKey':_0x1e40('0x1a2')});db['ZendeskConfiguration'][_0x1e40('0x107')](db[_0x1e40('0xb5')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x1a3')});db['ZendeskConfiguration'][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':'int_zendesk_configuration_has_tags'});db[_0x1e40('0xb7')][_0x1e40('0xfe')](db[_0x1e40('0xb7')],{'as':_0x1e40('0x1aa'),'foreignKey':'SubjectId'});db[_0x1e40('0xb7')][_0x1e40('0xfe')](db[_0x1e40('0xb7')],{'as':_0x1e40('0x1a5'),'foreignKey':_0x1e40('0x1a1')});db['ZendeskField']['hasMany'](db[_0x1e40('0xb7')],{'as':_0x1e40('0x1a6'),'foreignKey':_0x1e40('0x1a2')});db['ZendeskField'][_0x1e40('0x107')](db[_0x1e40('0x98')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1e40('0xb8')][_0x1e40('0xfe')](db[_0x1e40('0xba')],{'as':_0x1e40('0x19e'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a3')});db['FreshdeskConfiguration'][_0x1e40('0xfe')](db[_0x1e40('0xbc')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0xba')]['hasMany'](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x1e40('0xfc'),'foreignKey':'DescriptionId'});db[_0x1e40('0xba')][_0x1e40('0xfe')](db[_0x1e40('0xbc')],{'as':_0x1e40('0x19a'),'onDelete':'cascade','foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xba')][_0x1e40('0x107')](db[_0x1e40('0xb8')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x1a3')});db['FreshdeskConfiguration'][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x1e40('0xfe')](db[_0x1e40('0xbc')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x1e40('0xbc')][_0x1e40('0xfe')](db[_0x1e40('0xbc')],{'as':'Description','foreignKey':_0x1e40('0x1a1')});db['FreshdeskField'][_0x1e40('0xfe')](db[_0x1e40('0xbc')],{'as':_0x1e40('0x1a6'),'foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xbc')][_0x1e40('0x107')](db['Variable'],{'as':_0x1e40('0x98'),'foreignKey':'VariableId'});db[_0x1e40('0xbe')][_0x1e40('0xfe')](db[_0x1e40('0xc0')],{'as':_0x1e40('0x19e'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0xc0')][_0x1e40('0xfe')](db[_0x1e40('0xc2')],{'as':_0x1e40('0x1a9'),'foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0xc0')][_0x1e40('0xfe')](db['VtigerField'],{'as':_0x1e40('0x1a0'),'foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0xc0')][_0x1e40('0xfe')](db['VtigerField'],{'as':_0x1e40('0x19a'),'foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xc0')][_0x1e40('0x107')](db[_0x1e40('0xbe')],{'as':_0x1e40('0x155'),'foreignKey':'AccountId'});db[_0x1e40('0xc0')][_0x1e40('0x109')](db[_0x1e40('0x94')],{'through':_0x1e40('0x1ad')});db[_0x1e40('0xc2')][_0x1e40('0xfe')](db[_0x1e40('0xc2')],{'as':_0x1e40('0x1aa'),'foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0xc2')]['hasMany'](db[_0x1e40('0xc2')],{'as':_0x1e40('0x1a5'),'foreignKey':_0x1e40('0x1a1')});db['VtigerField'][_0x1e40('0xfe')](db[_0x1e40('0xc2')],{'as':_0x1e40('0x1a6'),'foreignKey':_0x1e40('0x1a2')});db['VtigerField'][_0x1e40('0x107')](db[_0x1e40('0x98')],{'as':_0x1e40('0x98'),'foreignKey':_0x1e40('0x1a7')});db['ServicenowAccount'][_0x1e40('0xfe')](db[_0x1e40('0xc4')],{'as':_0x1e40('0x19e'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a3')});db['ServicenowConfiguration'][_0x1e40('0xfe')](db[_0x1e40('0xc6')],{'as':_0x1e40('0x1a9'),'foreignKey':'SubjectId'});db[_0x1e40('0xc4')][_0x1e40('0xfe')](db[_0x1e40('0xc6')],{'as':_0x1e40('0x1a0'),'foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0xc4')][_0x1e40('0xfe')](db[_0x1e40('0xc6')],{'as':_0x1e40('0x19a'),'foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xc4')]['belongsTo'](db[_0x1e40('0x1ae')],{'as':'Account','foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0xc6')]['hasMany'](db[_0x1e40('0xc6')],{'as':_0x1e40('0x1aa'),'foreignKey':_0x1e40('0x1a4')});db[_0x1e40('0xc6')][_0x1e40('0xfe')](db[_0x1e40('0xc6')],{'as':'Description','foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0xc6')][_0x1e40('0xfe')](db[_0x1e40('0xc6')],{'as':'Field','foreignKey':_0x1e40('0x1a2')});db['ServicenowField']['belongsTo'](db[_0x1e40('0x98')],{'as':_0x1e40('0x98'),'foreignKey':_0x1e40('0x1a7')});db['Dynamics365Account'][_0x1e40('0xfe')](db[_0x1e40('0xc8')],{'as':_0x1e40('0x19e'),'onDelete':'cascade','foreignKey':_0x1e40('0x1a3')});db[_0x1e40('0xc8')][_0x1e40('0xfe')](db[_0x1e40('0xca')],{'as':_0x1e40('0x1a9'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a4')});db['Dynamics365Configuration'][_0x1e40('0xfe')](db[_0x1e40('0xca')],{'as':_0x1e40('0x1a0'),'onDelete':'cascade','foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0xc8')][_0x1e40('0xfe')](db['Dynamics365Field'],{'as':_0x1e40('0x19a'),'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xc8')][_0x1e40('0x107')](db[_0x1e40('0xc7')],{'as':_0x1e40('0x155'),'foreignKey':_0x1e40('0x1a3')});db['Dynamics365Field'][_0x1e40('0xfe')](db['Dynamics365Field'],{'as':_0x1e40('0x1aa'),'foreignKey':'SubjectId'});db[_0x1e40('0xca')][_0x1e40('0xfe')](db[_0x1e40('0xca')],{'as':_0x1e40('0x1a5'),'foreignKey':_0x1e40('0x1a1')});db[_0x1e40('0xca')]['hasMany'](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x1e40('0x1a2')});db[_0x1e40('0xca')][_0x1e40('0x107')](db[_0x1e40('0x98')],{'as':_0x1e40('0x98'),'foreignKey':'VariableId'});db[_0x1e40('0xcc')][_0x1e40('0x107')](db[_0x1e40('0x11b')],{});db[_0x1e40('0xcc')][_0x1e40('0x107')](db[_0x1e40('0xf2')],{'as':_0x1e40('0x168'),'foreignKey':_0x1e40('0x14f')});db[_0x1e40('0xcc')][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'as':_0x1e40('0x146'),'foreignKey':_0x1e40('0x147')});db[_0x1e40('0xcc')][_0x1e40('0x107')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x1e40('0x107')](db[_0x1e40('0x72')],{});db['ChatQueueReport']['belongsTo'](db['User'],{});db['ChatQueueReport'][_0x1e40('0x107')](db[_0x1e40('0x115')],{});db['ChatInternalMessage'][_0x1e40('0x107')](db[_0x1e40('0x14')],{'onDelete':_0x1e40('0xfc'),'foreignKey':_0x1e40('0x1af')});db['ChatInternalMessage']['belongsTo'](db[_0x1e40('0x14')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x1e40('0xcf')][_0x1e40('0xfe')](db['JscriptyQuestionReport'],{'foreignKey':_0x1e40('0x1b0'),'onDelete':_0x1e40('0xfc')});db[_0x1e40('0xcf')][_0x1e40('0xfe')](db[_0x1e40('0x1b1')],{'foreignKey':_0x1e40('0x1b0'),'onDelete':_0x1e40('0xfc')});db[_0x1e40('0xd1')][_0x1e40('0x107')](db[_0x1e40('0x5b')],{});db['SmsQueueReport']['belongsTo'](db[_0x1e40('0xf2')],{'as':'List','foreignKey':_0x1e40('0x14f')});db[_0x1e40('0xd1')][_0x1e40('0x107')](db[_0x1e40('0x7b')],{'as':'Contact','foreignKey':_0x1e40('0x147')});db[_0x1e40('0xd1')][_0x1e40('0x107')](db[_0x1e40('0x5f')],{});db[_0x1e40('0xd1')][_0x1e40('0x107')](db[_0x1e40('0x16a')],{});db[_0x1e40('0xd1')]['belongsTo'](db[_0x1e40('0x14')],{});db[_0x1e40('0xd1')][_0x1e40('0x107')](db[_0x1e40('0x62')],{});db['JscriptyProject'][_0x1e40('0xfe')](db['JscriptySessionReport'],{'foreignKey':_0x1e40('0x1b2')});db['JscriptyProject']['hasMany'](db[_0x1e40('0x1b3')],{'foreignKey':_0x1e40('0x1b2')});db[_0x1e40('0xd6')][_0x1e40('0xfe')](db[_0x1e40('0x1b1')],{'foreignKey':_0x1e40('0x1b2')});db[_0x1e40('0x125')][_0x1e40('0x109')](db[_0x1e40('0x14')],{'as':_0x1e40('0x159'),'through':'user_has_square_projects'});db[_0x1e40('0xe0')][_0x1e40('0x109')](db['User'],{'as':_0x1e40('0x13b'),'through':_0x1e40('0x1b4')});db[_0x1e40('0xe0')][_0x1e40('0x109')](db[_0x1e40('0x1e')],{'through':_0x1e40('0x13d'),'as':_0x1e40('0x113')});db[_0x1e40('0xe0')][_0x1e40('0x109')](db[_0x1e40('0x152')],{'through':_0x1e40('0x153'),'as':_0x1e40('0x114')});db['Team']['belongsToMany'](db[_0x1e40('0x115')],{'through':_0x1e40('0x1b5'),'as':_0x1e40('0x116')});db['Team']['belongsToMany'](db[_0x1e40('0x57')],{'through':_0x1e40('0x167'),'as':'FaxQueues'});db[_0x1e40('0xe0')][_0x1e40('0x109')](db[_0x1e40('0x62')],{'through':_0x1e40('0x1b6'),'as':_0x1e40('0x118')});db['Team'][_0x1e40('0x109')](db[_0x1e40('0x6c')],{'through':_0x1e40('0x172'),'as':_0x1e40('0x119')});db[_0x1e40('0xe4')][_0x1e40('0xfe')](db[_0x1e40('0x17d')],{'as':_0x1e40('0x17e'),'foreignKey':_0x1e40('0x183')});db[_0x1e40('0xe4')][_0x1e40('0xfe')](db[_0x1e40('0x7f')],{'as':'HopperFinals','foreignKey':_0x1e40('0x183')});db[_0x1e40('0xe4')][_0x1e40('0xfe')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x1e40('0xe4')][_0x1e40('0xfe')](db[_0x1e40('0x131')],{'as':_0x1e40('0x132'),'foreignKey':_0x1e40('0x183')});db[_0x1e40('0xe4')][_0x1e40('0x107')](db[_0x1e40('0x2f')],{'as':_0x1e40('0x2f'),'foreignKey':'TrunkId'});db['Campaign'][_0x1e40('0x107')](db[_0x1e40('0x2f')],{'as':_0x1e40('0x134'),'foreignKey':_0x1e40('0x135')});db[_0x1e40('0xe4')][_0x1e40('0x107')](db['Interval'],{'as':_0x1e40('0x136'),'foreignKey':_0x1e40('0x137')});db['Campaign'][_0x1e40('0x107')](db[_0x1e40('0x125')],{'as':_0x1e40('0x125'),'foreignKey':'SquareProjectId'});db['Campaign']['belongsToMany'](db[_0x1e40('0xf2')],{'as':_0x1e40('0x10e'),'through':_0x1e40('0x1b7')});db[_0x1e40('0xe4')][_0x1e40('0x109')](db[_0x1e40('0xf2')],{'as':_0x1e40('0x13e'),'through':_0x1e40('0x1b8')});db['MailTransferReport'][_0x1e40('0x107')](db[_0x1e40('0x48')],{});db[_0x1e40('0xea')][_0x1e40('0x107')](db[_0x1e40('0x47')],{});db[_0x1e40('0xea')][_0x1e40('0x107')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x1e40('0x1b9')});db[_0x1e40('0xea')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'foreignKey':_0x1e40('0x1ba'),'as':_0x1e40('0x1bb')});db['MailTransferReport'][_0x1e40('0x107')](db[_0x1e40('0x14')],{'foreignKey':_0x1e40('0x1bc'),'as':_0x1e40('0x1bd')});db['MailTransferReport'][_0x1e40('0x107')](db['MailQueue'],{'foreignKey':_0x1e40('0x1be'),'as':_0x1e40('0x1bf')});db['MailTransferReport'][_0x1e40('0x107')](db[_0x1e40('0x148')],{'foreignKey':_0x1e40('0x1c0'),'as':_0x1e40('0x1c1')});db[_0x1e40('0x1c2')]['belongsTo'](db[_0x1e40('0x72')],{});db['ChatTransferReport'][_0x1e40('0x107')](db['ChatInteraction'],{});db[_0x1e40('0x1c2')][_0x1e40('0x107')](db[_0x1e40('0x11b')],{'foreignKey':_0x1e40('0x1c3'),'as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db[_0x1e40('0x14')],{'foreignKey':_0x1e40('0x1ba'),'as':'FromAgent'});db[_0x1e40('0x1c2')]['belongsTo'](db['User'],{'foreignKey':_0x1e40('0x1bc'),'as':_0x1e40('0x1bd')});db[_0x1e40('0x1c2')][_0x1e40('0x107')](db[_0x1e40('0x115')],{'foreignKey':_0x1e40('0x1c4'),'as':'ToQueue'});db[_0x1e40('0x1c2')][_0x1e40('0x107')](db[_0x1e40('0x11b')],{'foreignKey':_0x1e40('0x1c5'),'as':'ToAccount'});db[_0x1e40('0xed')][_0x1e40('0x107')](db[_0x1e40('0x55')],{});db[_0x1e40('0xed')][_0x1e40('0x107')](db[_0x1e40('0x53')],{});db[_0x1e40('0xed')][_0x1e40('0x107')](db['FaxAccount'],{'foreignKey':_0x1e40('0x1c6'),'as':_0x1e40('0x1b9')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x1e40('0x1ba'),'as':_0x1e40('0x1bb')});db[_0x1e40('0xed')]['belongsTo'](db[_0x1e40('0x14')],{'foreignKey':_0x1e40('0x1bc'),'as':_0x1e40('0x1bd')});db[_0x1e40('0xed')][_0x1e40('0x107')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x1e40('0x1bf')});db[_0x1e40('0xed')][_0x1e40('0x107')](db[_0x1e40('0x50')],{'foreignKey':_0x1e40('0x1c7'),'as':_0x1e40('0x1c1')});db[_0x1e40('0xef')][_0x1e40('0x107')](db['OpenchannelMessage'],{});db[_0x1e40('0xef')][_0x1e40('0x107')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x1e40('0x107')](db[_0x1e40('0x64')],{'foreignKey':'FromOpenchannelAccountId','as':_0x1e40('0x1b9')});db['OpenchannelTransferReport'][_0x1e40('0x107')](db['User'],{'foreignKey':_0x1e40('0x1ba'),'as':'FromAgent'});db[_0x1e40('0xef')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'foreignKey':_0x1e40('0x1bc'),'as':_0x1e40('0x1bd')});db[_0x1e40('0xef')][_0x1e40('0x107')](db[_0x1e40('0x6c')],{'foreignKey':_0x1e40('0x1c8'),'as':_0x1e40('0x1bf')});db[_0x1e40('0xef')][_0x1e40('0x107')](db[_0x1e40('0x64')],{'foreignKey':_0x1e40('0x1c9'),'as':_0x1e40('0x1c1')});db[_0x1e40('0xf1')][_0x1e40('0x107')](db['SmsMessage'],{});db['SmsTransferReport']['belongsTo'](db[_0x1e40('0x5f')],{});db[_0x1e40('0xf1')][_0x1e40('0x107')](db[_0x1e40('0x5b')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0x1e40('0xf1')][_0x1e40('0x107')](db[_0x1e40('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x1e40('0xf1')][_0x1e40('0x107')](db['User'],{'foreignKey':_0x1e40('0x1bc'),'as':_0x1e40('0x1bd')});db[_0x1e40('0xf1')][_0x1e40('0x107')](db[_0x1e40('0x62')],{'foreignKey':'ToSmsQueueId','as':_0x1e40('0x1bf')});db[_0x1e40('0xf1')][_0x1e40('0x107')](db[_0x1e40('0x5b')],{'foreignKey':_0x1e40('0x1ca'),'as':_0x1e40('0x1c1')});db[_0x1e40('0xf2')][_0x1e40('0xfe')](db[_0x1e40('0x160')],{'as':'Dispositions','foreignKey':_0x1e40('0x14f')});db[_0x1e40('0xf2')][_0x1e40('0xfe')](db['CmCustomField'],{'as':_0x1e40('0x1cb'),'foreignKey':_0x1e40('0x14f')});db[_0x1e40('0xf2')][_0x1e40('0xfe')](db['CmContact'],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x1e40('0x14f')});db[_0x1e40('0xf2')]['hasMany'](db[_0x1e40('0x7f')],{'as':_0x1e40('0x102'),'foreignKey':_0x1e40('0x14f')});db[_0x1e40('0xf2')]['hasMany'](db[_0x1e40('0x80')],{'as':'HopperHistory','foreignKey':_0x1e40('0x14f')});db[_0x1e40('0xf2')][_0x1e40('0xfe')](db[_0x1e40('0x82')],{'as':'ReportAgentPreview','foreignKey':_0x1e40('0x14f')});db[_0x1e40('0xf2')][_0x1e40('0x109')](db[_0x1e40('0x1e')],{'as':'Queues','through':_0x1e40('0x13a')});db['CmList']['belongsToMany'](db[_0x1e40('0x14')],{'as':_0x1e40('0x13b'),'through':_0x1e40('0x10f')});db['VoicePrefix'][_0x1e40('0xfe')](db[_0x1e40('0x1a')],{'as':_0x1e40('0x101'),'onDelete':_0x1e40('0x15d')});db[_0x1e40('0xf4')][_0x1e40('0x109')](db['User'],{'as':'Agents','through':_0x1e40('0x1cc')});db['UserProfile'][_0x1e40('0xfe')](db[_0x1e40('0x14')],{'as':_0x1e40('0x159'),'foreignKey':_0x1e40('0x108')});db[_0x1e40('0xf5')][_0x1e40('0xfe')](db[_0x1e40('0xf7')],{'as':_0x1e40('0x1cd'),'foreignKey':_0x1e40('0x108'),'onDelete':_0x1e40('0xfc')});db['UserProfileSection'][_0x1e40('0xfe')](db[_0x1e40('0xf9')],{'as':_0x1e40('0x1ce'),'foreignKey':'sectionId','onDelete':'cascade'});module[_0x1e40('0x1cf')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 7bf1fd3..d37ae74 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cb4=['/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/apidoc','static','/www','join','root','/demo','/snippet','1.0.15','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','/index.html','path','express','express-winston','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','user','role','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','name','other','agent_name','test','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x5cb4,0x19a));var _0x45cb=function(_0x34a9fe,_0x5cf50b){_0x34a9fe=_0x34a9fe-0x0;var _0x443985=_0x5cb4[_0x34a9fe];return _0x443985;};'use strict';var path=require(_0x45cb('0x0'));var express=require(_0x45cb('0x1'));var ewinston=require(_0x45cb('0x2'));var util=require('util');var errors=require(_0x45cb('0x3'));var config=require(_0x45cb('0x4'));var logger=require(_0x45cb('0x5'))(_0x45cb('0x6'));var authLogger=require('./config/logger')(_0x45cb('0x7'));exports[_0x45cb('0x8')]=function(_0x440fa9){_0x440fa9[_0x45cb('0x9')](ewinston[_0x45cb('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4ab7ce,_0x527efd){return util[_0x45cb('0xb')](_0x45cb('0xc'),_0x4ab7ce['method'],_0x4ab7ce['headers'][_0x45cb('0xd')]?_0x4ab7ce[_0x45cb('0xe')][_0x45cb('0xd')]:_0x4ab7ce['connection'][_0x45cb('0xf')]||_0x4ab7ce['ip'],_0x4ab7ce[_0x45cb('0x10')],_0x527efd[_0x45cb('0x11')],_0x527efd[_0x45cb('0x12')],_0x4ab7ce[_0x45cb('0x13')]?_0x4ab7ce['user']['id']:null,_0x4ab7ce[_0x45cb('0x13')]?_0x4ab7ce['user']['name']:null,_0x4ab7ce[_0x45cb('0x13')]?_0x4ab7ce[_0x45cb('0x13')][_0x45cb('0x14')]:null);}}));_0x440fa9[_0x45cb('0x9')](ewinston[_0x45cb('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x287aa0,_0x341e05){var _0x492819='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x287aa0[_0x45cb('0x15')]&&_0x287aa0[_0x45cb('0x15')][_0x45cb('0x16')]&&_0x287aa0[_0x45cb('0x15')][_0x45cb('0x17')]){_0x492819=_0x45cb('0x18');}return util['format'](_0x492819,_0x287aa0['method'],_0x287aa0[_0x45cb('0xe')][_0x45cb('0xd')]?_0x287aa0[_0x45cb('0xe')]['x-forwarded-for']:_0x287aa0[_0x45cb('0x19')][_0x45cb('0xf')]||_0x287aa0['ip'],_0x287aa0[_0x45cb('0x10')],_0x341e05[_0x45cb('0x11')],_0x341e05[_0x45cb('0x12')],_0x287aa0[_0x45cb('0x13')]?_0x287aa0[_0x45cb('0x13')]['id']:null,_0x287aa0[_0x45cb('0x13')]?_0x287aa0[_0x45cb('0x13')][_0x45cb('0x1a')]:null,_0x287aa0[_0x45cb('0x13')]?_0x287aa0[_0x45cb('0x13')][_0x45cb('0x14')]:null,_0x287aa0['body']&&_0x287aa0['body'][_0x45cb('0x16')]?_0x287aa0[_0x45cb('0x15')]['device']:_0x45cb('0x1b'),_0x287aa0[_0x45cb('0x15')]&&_0x287aa0[_0x45cb('0x15')][_0x45cb('0x17')]?_0x287aa0[_0x45cb('0x15')]['agent_id']:'',_0x287aa0['body']&&_0x287aa0[_0x45cb('0x15')][_0x45cb('0x1c')]?_0x287aa0[_0x45cb('0x15')][_0x45cb('0x1c')]:'');},'ignoreRoute':function(_0x44078f){var _0x4d8ee4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4d8ee4[_0x45cb('0x1d')](_0x44078f['url']);}}));_0x440fa9[_0x45cb('0x9')]('/api/users',require('./api/user'));_0x440fa9[_0x45cb('0x9')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x440fa9[_0x45cb('0x9')]('/api/voice/contexts',require(_0x45cb('0x1e')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x1f'),require(_0x45cb('0x20')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x21'),require(_0x45cb('0x22')));_0x440fa9['use'](_0x45cb('0x23'),require(_0x45cb('0x24')));_0x440fa9[_0x45cb('0x9')]('/api/voice/recordings',require(_0x45cb('0x25')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x26'),require(_0x45cb('0x27')));_0x440fa9[_0x45cb('0x9')]('/api/voice/mails',require(_0x45cb('0x28')));_0x440fa9[_0x45cb('0x9')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x440fa9[_0x45cb('0x9')]('/api/voice/calls/reports',require(_0x45cb('0x29')));_0x440fa9['use'](_0x45cb('0x2a'),require(_0x45cb('0x2b')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x2c'),require(_0x45cb('0x2d')));_0x440fa9[_0x45cb('0x9')]('/api/voice/queues/reports',require(_0x45cb('0x2e')));_0x440fa9['use']('/api/members/reports',require(_0x45cb('0x2f')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x30'),require(_0x45cb('0x31')));_0x440fa9['use'](_0x45cb('0x32'),require(_0x45cb('0x33')));_0x440fa9['use'](_0x45cb('0x34'),require('./api/mailServerOut'));_0x440fa9['use']('/api/mail/accounts',require(_0x45cb('0x35')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x36'),require(_0x45cb('0x37')));_0x440fa9['use'](_0x45cb('0x38'),require(_0x45cb('0x39')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x3a'),require(_0x45cb('0x3b')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x3c'),require(_0x45cb('0x3d')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x3e'),require(_0x45cb('0x3f')));_0x440fa9['use'](_0x45cb('0x40'),require('./api/mailQueueReport'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x41'),require(_0x45cb('0x42')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x43'),require('./api/dashboardItem'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x44'),require(_0x45cb('0x45')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x46'),require('./api/faxApplication'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x47'),require(_0x45cb('0x48')));_0x440fa9[_0x45cb('0x9')]('/api/fax/messages',require(_0x45cb('0x49')));_0x440fa9['use'](_0x45cb('0x4a'),require(_0x45cb('0x4b')));_0x440fa9['use']('/api/fax/reports/queue',require(_0x45cb('0x4c')));_0x440fa9['use'](_0x45cb('0x4d'),require(_0x45cb('0x4e')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x4f'),require(_0x45cb('0x50')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x51'),require(_0x45cb('0x52')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x53'),require(_0x45cb('0x54')));_0x440fa9[_0x45cb('0x9')]('/api/sms/queues',require('./api/smsQueue'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x55'),require('./api/openchannelAccount'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x56'),require('./api/openchannelApplication'));_0x440fa9[_0x45cb('0x9')]('/api/openchannel/interactions',require(_0x45cb('0x57')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x58'),require(_0x45cb('0x59')));_0x440fa9['use'](_0x45cb('0x5a'),require(_0x45cb('0x5b')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x5c'),require(_0x45cb('0x5d')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x5e'),require(_0x45cb('0x5f')));_0x440fa9['use'](_0x45cb('0x60'),require(_0x45cb('0x61')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x62'),require(_0x45cb('0x63')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x64'),require(_0x45cb('0x65')));_0x440fa9['use'](_0x45cb('0x66'),require(_0x45cb('0x67')));_0x440fa9['use'](_0x45cb('0x68'),require(_0x45cb('0x69')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x6a'),require('./api/chatGroup'));_0x440fa9[_0x45cb('0x9')]('/api/chat/proactive_actions',require(_0x45cb('0x6b')));_0x440fa9['use'](_0x45cb('0x6c'),require(_0x45cb('0x6d')));_0x440fa9['use'](_0x45cb('0x6e'),require(_0x45cb('0x6f')));_0x440fa9[_0x45cb('0x9')]('/api/cm/hopper',require(_0x45cb('0x70')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x71'),require('./api/cmHopperBlack'));_0x440fa9[_0x45cb('0x9')]('/api/cm/hopper_final',require(_0x45cb('0x72')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x73'),require(_0x45cb('0x74')));_0x440fa9[_0x45cb('0x9')]('/api/cm/custom_fields',require(_0x45cb('0x75')));_0x440fa9[_0x45cb('0x9')]('/api/actions',require(_0x45cb('0x76')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x77'),require('./api/automation'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x78'),require(_0x45cb('0x79')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x7a'),require(_0x45cb('0x7b')));_0x440fa9[_0x45cb('0x9')]('/api/conditions',require(_0x45cb('0x7c')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x7d'),require(_0x45cb('0x7e')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x7f'),require(_0x45cb('0x80')));_0x440fa9['use'](_0x45cb('0x81'),require(_0x45cb('0x82')));_0x440fa9['use'](_0x45cb('0x83'),require(_0x45cb('0x84')));_0x440fa9['use'](_0x45cb('0x85'),require(_0x45cb('0x86')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x87'),require(_0x45cb('0x88')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x89'),require(_0x45cb('0x8a')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x8b'),require(_0x45cb('0x8c')));_0x440fa9[_0x45cb('0x9')]('/api/triggers',require(_0x45cb('0x8d')));_0x440fa9[_0x45cb('0x9')]('/api/variables',require(_0x45cb('0x8e')));_0x440fa9['use'](_0x45cb('0x8f'),require(_0x45cb('0x90')));_0x440fa9[_0x45cb('0x9')]('/api/integrations/reports',require('./api/integrationReport'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x91'),require(_0x45cb('0x92')));_0x440fa9[_0x45cb('0x9')]('/api/analytics/default_reports',require(_0x45cb('0x93')));_0x440fa9[_0x45cb('0x9')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x94'),require('./api/analyticMetric'));_0x440fa9[_0x45cb('0x9')]('/api/analytics/field_reports',require(_0x45cb('0x95')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x96'),require('./api/analyticTreeReport'));_0x440fa9[_0x45cb('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x97'),require(_0x45cb('0x98')));_0x440fa9[_0x45cb('0x9')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x99'),require('./api/intSugarcrmAccount'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x9a'),require(_0x45cb('0x9b')));_0x440fa9[_0x45cb('0x9')]('/api/integrations/sugarcrm/fields',require(_0x45cb('0x9c')));_0x440fa9[_0x45cb('0x9')]('/api/integrations/desk/accounts',require(_0x45cb('0x9d')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0x9e'),require(_0x45cb('0x9f')));_0x440fa9['use'](_0x45cb('0xa0'),require('./api/intDeskField'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xa1'),require(_0x45cb('0xa2')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xa3'),require(_0x45cb('0xa4')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xa5'),require(_0x45cb('0xa6')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xa7'),require(_0x45cb('0xa8')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xa9'),require(_0x45cb('0xaa')));_0x440fa9[_0x45cb('0x9')]('/api/integrations/zendesk/fields',require(_0x45cb('0xab')));_0x440fa9['use'](_0x45cb('0xac'),require(_0x45cb('0xad')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xae'),require('./api/intFreshdeskConfiguration'));_0x440fa9['use'](_0x45cb('0xaf'),require('./api/intFreshdeskField'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xb0'),require(_0x45cb('0xb1')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xb2'),require(_0x45cb('0xb3')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xb4'),require(_0x45cb('0xb5')));_0x440fa9[_0x45cb('0x9')]('/api/integrations/servicenow/accounts',require(_0x45cb('0xb6')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xb7'),require(_0x45cb('0xb8')));_0x440fa9['use']('/api/integrations/servicenow/fields',require(_0x45cb('0xb9')));_0x440fa9[_0x45cb('0x9')]('/api/integrations/dynamics365/accounts',require(_0x45cb('0xba')));_0x440fa9[_0x45cb('0x9')]('/api/integrations/dynamics365/configurations',require(_0x45cb('0xbb')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xbc'),require(_0x45cb('0xbd')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xbe'),require(_0x45cb('0xbf')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xc0'),require(_0x45cb('0xc1')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xc2'),require('./api/chatInternalMessage'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xc3'),require(_0x45cb('0xc4')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xc5'),require(_0x45cb('0xc6')));_0x440fa9['use'](_0x45cb('0xc7'),require(_0x45cb('0xc8')));_0x440fa9[_0x45cb('0x9')]('/api/sms/reports/queue',require(_0x45cb('0xc9')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xca'),require(_0x45cb('0xcb')));_0x440fa9[_0x45cb('0x9')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xcc'),require(_0x45cb('0xcd')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xce'),require(_0x45cb('0xcf')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xd0'),require(_0x45cb('0xd1')));_0x440fa9[_0x45cb('0x9')]('/api/square/projects',require(_0x45cb('0xd2')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xd3'),require('./api/squareRecording'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xd4'),require(_0x45cb('0xd5')));_0x440fa9['use'](_0x45cb('0xd6'),require('./api/team'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xd7'),require('./api/license'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xd8'),require(_0x45cb('0xd9')));_0x440fa9['use'](_0x45cb('0xda'),require(_0x45cb('0xdb')));_0x440fa9['use'](_0x45cb('0xdc'),require('./api/attachment'));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xdd'),require(_0x45cb('0xde')));_0x440fa9['use'](_0x45cb('0xdf'),require(_0x45cb('0xe0')));_0x440fa9['use']('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x440fa9[_0x45cb('0x9')]('/api/fax/reports/transfer',require(_0x45cb('0xe1')));_0x440fa9[_0x45cb('0x9')]('/api/openchannel/reports/transfer',require(_0x45cb('0xe2')));_0x440fa9[_0x45cb('0x9')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x440fa9['use'](_0x45cb('0xe3'),require(_0x45cb('0xe4')));_0x440fa9['use'](_0x45cb('0xe5'),require(_0x45cb('0xe6')));_0x440fa9[_0x45cb('0x9')]('/api/userProfiles',require(_0x45cb('0xe7')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xe8'),require(_0x45cb('0xe9')));_0x440fa9[_0x45cb('0x9')]('/api/userProfile/resources',require(_0x45cb('0xea')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xeb'),require(_0x45cb('0xec')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xed'),require(_0x45cb('0xee')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xef'),require(_0x45cb('0xf0')));_0x440fa9['use']('/api/rpc',require(_0x45cb('0xf1')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xf2'),require(_0x45cb('0xf3')));_0x440fa9[_0x45cb('0x9')]('/api/system',require(_0x45cb('0xf4')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xf5'),require(_0x45cb('0xf6')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xf7'),express[_0x45cb('0xf8')](path['join'](config['root'],'/apidoc')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xf9'),express[_0x45cb('0xf8')](path[_0x45cb('0xfa')](config[_0x45cb('0xfb')],_0x45cb('0xf9'))));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xfc'),express[_0x45cb('0xf8')](path['join'](config[_0x45cb('0xfb')],'/demo')));_0x440fa9[_0x45cb('0x9')](_0x45cb('0xfd'),express[_0x45cb('0xf8')](path[_0x45cb('0xfa')](config[_0x45cb('0xfb')],'snippet',_0x45cb('0xfe'))));_0x440fa9[_0x45cb('0x9')]('/plugins',express[_0x45cb('0xf8')](path[_0x45cb('0xfa')](config[_0x45cb('0xfb')],'/server/files/plugins')));_0x440fa9[_0x45cb('0xff')](_0x45cb('0x100'))[_0x45cb('0x101')](errors[0x194]);_0x440fa9[_0x45cb('0xff')]('/*')[_0x45cb('0x101')](function(_0x336082,_0x57cf33){_0x57cf33[_0x45cb('0x102')](path['resolve'](_0x440fa9[_0x45cb('0x101')]('appPath')+_0x45cb('0x103')));});}; \ No newline at end of file +var _0xd1bf=['/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./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/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfileSection','/api/userProfile/resources','./api/authLocal','/api/auth/google','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/apidoc','join','root','/www','/demo','static','snippet','1.0.15','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','path','express','util','./config/environment','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','role','other','agent_name','test','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport'];(function(_0x2c9fd2,_0x5ce225){var _0x3a252f=function(_0x178c38){while(--_0x178c38){_0x2c9fd2['push'](_0x2c9fd2['shift']());}};_0x3a252f(++_0x5ce225);}(_0xd1bf,0x1e1));var _0xfd1b=function(_0xcf3e7e,_0x255a38){_0xcf3e7e=_0xcf3e7e-0x0;var _0x325286=_0xd1bf[_0xcf3e7e];return _0x325286;};'use strict';var path=require(_0xfd1b('0x0'));var express=require(_0xfd1b('0x1'));var ewinston=require('express-winston');var util=require(_0xfd1b('0x2'));var errors=require('./errors');var config=require(_0xfd1b('0x3'));var logger=require(_0xfd1b('0x4'))(_0xfd1b('0x5'));var authLogger=require(_0xfd1b('0x4'))(_0xfd1b('0x6'));exports[_0xfd1b('0x7')]=function(_0x8a2502){_0x8a2502[_0xfd1b('0x8')](ewinston[_0xfd1b('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4eeb30,_0xbf053){return util[_0xfd1b('0xa')](_0xfd1b('0xb'),_0x4eeb30[_0xfd1b('0xc')],_0x4eeb30[_0xfd1b('0xd')][_0xfd1b('0xe')]?_0x4eeb30[_0xfd1b('0xd')][_0xfd1b('0xe')]:_0x4eeb30[_0xfd1b('0xf')]['remoteAddress']||_0x4eeb30['ip'],_0x4eeb30[_0xfd1b('0x10')],_0xbf053[_0xfd1b('0x11')],_0xbf053[_0xfd1b('0x12')],_0x4eeb30['user']?_0x4eeb30[_0xfd1b('0x13')]['id']:null,_0x4eeb30[_0xfd1b('0x13')]?_0x4eeb30['user'][_0xfd1b('0x14')]:null,_0x4eeb30[_0xfd1b('0x13')]?_0x4eeb30[_0xfd1b('0x13')]['role']:null);}}));_0x8a2502[_0xfd1b('0x8')](ewinston[_0xfd1b('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3b1058,_0x27e847){var _0x3d3b7c=_0xfd1b('0x15');if(_0x3b1058[_0xfd1b('0x16')]&&_0x3b1058[_0xfd1b('0x16')][_0xfd1b('0x17')]&&_0x3b1058['body'][_0xfd1b('0x18')]){_0x3d3b7c=_0xfd1b('0x19');}return util[_0xfd1b('0xa')](_0x3d3b7c,_0x3b1058[_0xfd1b('0xc')],_0x3b1058[_0xfd1b('0xd')]['x-forwarded-for']?_0x3b1058[_0xfd1b('0xd')][_0xfd1b('0xe')]:_0x3b1058[_0xfd1b('0xf')][_0xfd1b('0x1a')]||_0x3b1058['ip'],_0x3b1058['url'],_0x27e847[_0xfd1b('0x11')],_0x27e847[_0xfd1b('0x12')],_0x3b1058[_0xfd1b('0x13')]?_0x3b1058['user']['id']:null,_0x3b1058[_0xfd1b('0x13')]?_0x3b1058['user'][_0xfd1b('0x14')]:null,_0x3b1058[_0xfd1b('0x13')]?_0x3b1058[_0xfd1b('0x13')][_0xfd1b('0x1b')]:null,_0x3b1058[_0xfd1b('0x16')]&&_0x3b1058[_0xfd1b('0x16')]['device']?_0x3b1058[_0xfd1b('0x16')][_0xfd1b('0x17')]:_0xfd1b('0x1c'),_0x3b1058['body']&&_0x3b1058[_0xfd1b('0x16')][_0xfd1b('0x18')]?_0x3b1058['body'][_0xfd1b('0x18')]:'',_0x3b1058['body']&&_0x3b1058[_0xfd1b('0x16')]['agent_name']?_0x3b1058[_0xfd1b('0x16')][_0xfd1b('0x1d')]:'');},'ignoreRoute':function(_0x1b44a5){var _0x297c98=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x297c98[_0xfd1b('0x1e')](_0x1b44a5[_0xfd1b('0x10')]);}}));_0x8a2502[_0xfd1b('0x8')]('/api/users',require('./api/user'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x1f'),require(_0xfd1b('0x20')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x21'),require(_0xfd1b('0x22')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x23'),require(_0xfd1b('0x24')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x25'),require(_0xfd1b('0x26')));_0x8a2502['use'](_0xfd1b('0x27'),require(_0xfd1b('0x28')));_0x8a2502[_0xfd1b('0x8')]('/api/voice/recordings',require(_0xfd1b('0x29')));_0x8a2502['use'](_0xfd1b('0x2a'),require(_0xfd1b('0x2b')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x2c'),require(_0xfd1b('0x2d')));_0x8a2502[_0xfd1b('0x8')]('/api/voice/mails/messages',require(_0xfd1b('0x2e')));_0x8a2502['use'](_0xfd1b('0x2f'),require(_0xfd1b('0x30')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x31'),require(_0xfd1b('0x32')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x33'),require(_0xfd1b('0x34')));_0x8a2502['use'](_0xfd1b('0x35'),require('./api/voiceQueueReport'));_0x8a2502[_0xfd1b('0x8')]('/api/members/reports',require(_0xfd1b('0x36')));_0x8a2502['use'](_0xfd1b('0x37'),require(_0xfd1b('0x38')));_0x8a2502[_0xfd1b('0x8')]('/api/voice/transfers/reports',require(_0xfd1b('0x39')));_0x8a2502[_0xfd1b('0x8')]('/api/mail/out_servers',require(_0xfd1b('0x3a')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x3b'),require(_0xfd1b('0x3c')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x3d'),require(_0xfd1b('0x3e')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x3f'),require('./api/mailSubstatus'));_0x8a2502['use'](_0xfd1b('0x40'),require(_0xfd1b('0x41')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x42'),require(_0xfd1b('0x43')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x44'),require('./api/mailApplication'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x45'),require(_0xfd1b('0x46')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x47'),require(_0xfd1b('0x48')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x49'),require(_0xfd1b('0x4a')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x4b'),require(_0xfd1b('0x4c')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x4d'),require(_0xfd1b('0x4e')));_0x8a2502['use'](_0xfd1b('0x4f'),require(_0xfd1b('0x50')));_0x8a2502['use'](_0xfd1b('0x51'),require(_0xfd1b('0x52')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x53'),require(_0xfd1b('0x54')));_0x8a2502[_0xfd1b('0x8')]('/api/fax/reports/queue',require(_0xfd1b('0x55')));_0x8a2502[_0xfd1b('0x8')]('/api/sms/accounts',require(_0xfd1b('0x56')));_0x8a2502['use'](_0xfd1b('0x57'),require(_0xfd1b('0x58')));_0x8a2502[_0xfd1b('0x8')]('/api/sms/interactions',require(_0xfd1b('0x59')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x5a'),require('./api/smsMessage'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x5b'),require('./api/smsQueue'));_0x8a2502[_0xfd1b('0x8')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x5c'),require(_0xfd1b('0x5d')));_0x8a2502[_0xfd1b('0x8')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x8a2502[_0xfd1b('0x8')]('/api/openchannel/messages',require(_0xfd1b('0x5e')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x5f'),require(_0xfd1b('0x60')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x61'),require(_0xfd1b('0x62')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x63'),require(_0xfd1b('0x64')));_0x8a2502['use'](_0xfd1b('0x65'),require(_0xfd1b('0x66')));_0x8a2502['use'](_0xfd1b('0x67'),require(_0xfd1b('0x68')));_0x8a2502['use'](_0xfd1b('0x69'),require(_0xfd1b('0x6a')));_0x8a2502['use']('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x6b'),require(_0xfd1b('0x6c')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x6d'),require(_0xfd1b('0x6e')));_0x8a2502['use'](_0xfd1b('0x6f'),require(_0xfd1b('0x70')));_0x8a2502['use'](_0xfd1b('0x71'),require(_0xfd1b('0x72')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x73'),require(_0xfd1b('0x74')));_0x8a2502['use'](_0xfd1b('0x75'),require(_0xfd1b('0x76')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x77'),require('./api/cmHopperBlack'));_0x8a2502[_0xfd1b('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x8a2502['use'](_0xfd1b('0x78'),require('./api/cmHopperHistory'));_0x8a2502['use'](_0xfd1b('0x79'),require(_0xfd1b('0x7a')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x7b'),require(_0xfd1b('0x7c')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x7d'),require(_0xfd1b('0x7e')));_0x8a2502['use'](_0xfd1b('0x7f'),require(_0xfd1b('0x80')));_0x8a2502[_0xfd1b('0x8')]('/api/dispositions',require('./api/disposition'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x81'),require(_0xfd1b('0x82')));_0x8a2502['use'](_0xfd1b('0x83'),require(_0xfd1b('0x84')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x85'),require('./api/pause'));_0x8a2502['use'](_0xfd1b('0x86'),require('./api/cdr'));_0x8a2502[_0xfd1b('0x8')]('/api/voiceQueuesLog',require(_0xfd1b('0x87')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x88'),require(_0xfd1b('0x89')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x8a'),require(_0xfd1b('0x8b')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x8c'),require(_0xfd1b('0x8d')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x8e'),require(_0xfd1b('0x8f')));_0x8a2502[_0xfd1b('0x8')]('/api/triggers',require(_0xfd1b('0x90')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x91'),require(_0xfd1b('0x92')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x93'),require('./api/integration'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x94'),require(_0xfd1b('0x95')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x96'),require(_0xfd1b('0x97')));_0x8a2502[_0xfd1b('0x8')]('/api/analytics/default_reports',require(_0xfd1b('0x98')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x99'),require('./api/analyticExtractedReport'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x9a'),require(_0xfd1b('0x9b')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x9c'),require(_0xfd1b('0x9d')));_0x8a2502['use']('/api/analytics/tree_reports',require(_0xfd1b('0x9e')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x9f'),require(_0xfd1b('0xa0')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xa1'),require(_0xfd1b('0xa2')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xa3'),require(_0xfd1b('0xa4')));_0x8a2502['use']('/api/integrations/sugarcrm/accounts',require(_0xfd1b('0xa5')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xa6'),require('./api/intSugarcrmConfiguration'));_0x8a2502[_0xfd1b('0x8')]('/api/integrations/sugarcrm/fields',require(_0xfd1b('0xa7')));_0x8a2502['use'](_0xfd1b('0xa8'),require(_0xfd1b('0xa9')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xaa'),require(_0xfd1b('0xab')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xac'),require('./api/intDeskField'));_0x8a2502['use']('/api/integrations/zoho/accounts',require(_0xfd1b('0xad')));_0x8a2502['use']('/api/integrations/zoho/configurations',require(_0xfd1b('0xae')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xaf'),require(_0xfd1b('0xb0')));_0x8a2502['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x8a2502[_0xfd1b('0x8')]('/api/integrations/zendesk/configurations',require(_0xfd1b('0xb1')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xb2'),require(_0xfd1b('0xb3')));_0x8a2502[_0xfd1b('0x8')]('/api/integrations/freshdesk/accounts',require(_0xfd1b('0xb4')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xb5'),require('./api/intFreshdeskConfiguration'));_0x8a2502[_0xfd1b('0x8')]('/api/integrations/freshdesk/fields',require(_0xfd1b('0xb6')));_0x8a2502['use'](_0xfd1b('0xb7'),require(_0xfd1b('0xb8')));_0x8a2502['use']('/api/integrations/vtiger/configurations',require(_0xfd1b('0xb9')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xba'),require(_0xfd1b('0xbb')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xbc'),require('./api/intServicenowAccount'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xbd'),require(_0xfd1b('0xbe')));_0x8a2502[_0xfd1b('0x8')]('/api/integrations/servicenow/fields',require(_0xfd1b('0xbf')));_0x8a2502['use'](_0xfd1b('0xc0'),require(_0xfd1b('0xc1')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xc2'),require(_0xfd1b('0xc3')));_0x8a2502['use'](_0xfd1b('0xc4'),require('./api/intDynamics365Field'));_0x8a2502['use'](_0xfd1b('0xc5'),require(_0xfd1b('0xc6')));_0x8a2502['use'](_0xfd1b('0xc7'),require(_0xfd1b('0xc8')));_0x8a2502['use']('/api/chat/internal/messages',require(_0xfd1b('0xc9')));_0x8a2502[_0xfd1b('0x8')]('/api/jscripty/answers/reports',require(_0xfd1b('0xca')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xcb'),require('./api/jscriptyQuestionReport'));_0x8a2502[_0xfd1b('0x8')]('/api/jscripty/sessions/reports',require(_0xfd1b('0xcc')));_0x8a2502['use'](_0xfd1b('0xcd'),require(_0xfd1b('0xce')));_0x8a2502[_0xfd1b('0x8')]('/api/square/reports',require('./api/squareReport'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xcf'),require(_0xfd1b('0xd0')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xd1'),require(_0xfd1b('0xd2')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xd3'),require(_0xfd1b('0xd4')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xd5'),require('./api/squareOdbc'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xd6'),require(_0xfd1b('0xd7')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xd8'),require(_0xfd1b('0xd9')));_0x8a2502['use'](_0xfd1b('0xda'),require(_0xfd1b('0xdb')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xdc'),require(_0xfd1b('0xdd')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xde'),require('./api/license'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xdf'),require(_0xfd1b('0xe0')));_0x8a2502['use']('/api/migrations',require(_0xfd1b('0xe1')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xe2'),require(_0xfd1b('0xe3')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xe4'),require(_0xfd1b('0xe5')));_0x8a2502['use'](_0xfd1b('0xe6'),require(_0xfd1b('0xe7')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xe8'),require(_0xfd1b('0xe9')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xea'),require('./api/faxTransferReport'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xeb'),require(_0xfd1b('0xec')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xed'),require(_0xfd1b('0xee')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xef'),require(_0xfd1b('0xf0')));_0x8a2502['use']('/api/voice/prefixes',require(_0xfd1b('0xf1')));_0x8a2502[_0xfd1b('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x8a2502[_0xfd1b('0x8')]('/api/userProfile/sections',require(_0xfd1b('0xf2')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xf3'),require('./api/userProfileResource'));_0x8a2502[_0xfd1b('0x8')]('/api/auth/local',require(_0xfd1b('0xf4')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xf5'),require('./api/authGoogle'));_0x8a2502[_0xfd1b('0x8')]('/api/jira',require(_0xfd1b('0xf6')));_0x8a2502[_0xfd1b('0x8')]('/api/rpc',require(_0xfd1b('0xf7')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xf8'),require(_0xfd1b('0xf9')));_0x8a2502['use'](_0xfd1b('0xfa'),require(_0xfd1b('0xfb')));_0x8a2502['use'](_0xfd1b('0xfc'),require('./api/pm2'));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0xfd'),express['static'](path[_0xfd1b('0xfe')](config[_0xfd1b('0xff')],'/apidoc')));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x100'),express['static'](path[_0xfd1b('0xfe')](config['root'],_0xfd1b('0x100'))));_0x8a2502['use'](_0xfd1b('0x101'),express[_0xfd1b('0x102')](path['join'](config[_0xfd1b('0xff')],_0xfd1b('0x101'))));_0x8a2502[_0xfd1b('0x8')]('/snippet',express[_0xfd1b('0x102')](path[_0xfd1b('0xfe')](config[_0xfd1b('0xff')],_0xfd1b('0x103'),_0xfd1b('0x104'))));_0x8a2502[_0xfd1b('0x8')](_0xfd1b('0x105'),express[_0xfd1b('0x102')](path['join'](config[_0xfd1b('0xff')],_0xfd1b('0x106'))));_0x8a2502[_0xfd1b('0x107')](_0xfd1b('0x108'))[_0xfd1b('0x109')](errors[0x194]);_0x8a2502[_0xfd1b('0x107')]('/*')[_0xfd1b('0x109')](function(_0x570ded,_0x525951){_0x525951['sendFile'](path[_0xfd1b('0x10a')](_0x8a2502[_0xfd1b('0x109')]('appPath')+_0xfd1b('0x10b')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c3a6c4f..444c0ef 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69b8=['../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.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/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc'];(function(_0x1bb2ca,_0x3867c5){var _0x5888a7=function(_0x3d0011){while(--_0x3d0011){_0x1bb2ca['push'](_0x1bb2ca['shift']());}};_0x5888a7(++_0x3867c5);}(_0x69b8,0x87));var _0x869b=function(_0x246236,_0x4ea6f1){_0x246236=_0x246236-0x0;var _0x3ad622=_0x69b8[_0x246236];return _0x3ad622;};'use strict';var jayson=require(_0x869b('0x0'));var BPromise=require('bluebird');var _=require(_0x869b('0x1'));var config=require(_0x869b('0x2'));exports[_0x869b('0x3')]=function(){return new BPromise(function(_0x396596,_0x19e572){var _0x1e58d8={};_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x5')));_0x1e58d8=_['merge'](_0x1e58d8,require(_0x869b('0x6')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x7')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x8')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x9')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0xa')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0xb')));_0x1e58d8=_['merge'](_0x1e58d8,require('../api/memberReport/memberReport.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0xc')));_0x1e58d8=_['merge'](_0x1e58d8,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1e58d8=_['merge'](_0x1e58d8,require(_0x869b('0xd')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0xe')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/mailAccount/mailAccount.rpc'));_0x1e58d8=_['merge'](_0x1e58d8,require(_0x869b('0xf')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x10')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x11')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x12')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x13')));_0x1e58d8=_['merge'](_0x1e58d8,require('../api/faxAccount/faxAccount.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x14')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x15')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/faxMessage/faxMessage.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x16')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x17')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x18')));_0x1e58d8=_['merge'](_0x1e58d8,require('../api/smsInteraction/smsInteraction.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/smsMessage/smsMessage.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x19')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x1a')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x1b')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x1c')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x1d')));_0x1e58d8=_['merge'](_0x1e58d8,require('../api/chatMessage/chatMessage.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x1e')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x1f')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x20')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x21')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x22')));_0x1e58d8=_['merge'](_0x1e58d8,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x23')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/interval/interval.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/pause/pause.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x24')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x25')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x26')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/variable/variable.rpc'));_0x1e58d8=_['merge'](_0x1e58d8,require(_0x869b('0x27')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x28')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x29')));_0x1e58d8=_['merge'](_0x1e58d8,require(_0x869b('0x2a')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x2b')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x2c')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x2d')));_0x1e58d8=_['merge'](_0x1e58d8,require(_0x869b('0x2e')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x2f')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x30')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x31')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x32')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/squareOdbc/squareOdbc.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x33')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x34')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x35')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require('../api/campaign/campaign.rpc'));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x36')));_0x1e58d8=_[_0x869b('0x4')](_0x1e58d8,require(_0x869b('0x37')));var _0x3f24d0=jayson['server'](_0x1e58d8)['http']();var _0x8d0ad7=config[_0x869b('0x38')][_0x869b('0x39')]||config[_0x869b('0x39')]+0x1;var _0x4e788b=config[_0x869b('0x38')]['ip']||'localhost';_0x3f24d0['on'](_0x869b('0x3a'),function(_0x1dedb6){return _0x19e572(_0x1dedb6);});_0x3f24d0[_0x869b('0x3')](_0x8d0ad7,_0x4e788b,function(){console[_0x869b('0x3b')](_0x869b('0x3c'),_0x4e788b,_0x8d0ad7);require(_0x869b('0x3d'))[_0x869b('0x3e')]();return _0x396596('RPC\x20listening\x20on\x20'+_0x4e788b+':'+_0x8d0ad7);});});}; \ No newline at end of file +var _0x2728=['../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.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','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0x5bf630,_0x550219){var _0x5421c6=function(_0x2faa95){while(--_0x2faa95){_0x5bf630['push'](_0x5bf630['shift']());}};_0x5421c6(++_0x550219);}(_0x2728,0x128));var _0x8272=function(_0x49e096,_0x5ee8f2){_0x49e096=_0x49e096-0x0;var _0x16dcdd=_0x2728[_0x49e096];return _0x16dcdd;};'use strict';var jayson=require(_0x8272('0x0'));var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x8272('0x1'));exports[_0x8272('0x2')]=function(){return new BPromise(function(_0x230079,_0x3ac88b){var _0x17d584={};_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x4')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x5')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x6')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/voiceRecording/voiceRecording.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x7')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x8')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x9')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0xa')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/memberReport/memberReport.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0xb')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0xc')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0xd')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0xe')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0xf')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x10')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x11')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x12')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x13')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x14')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x15')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x16')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x17')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/faxMessage/faxMessage.rpc'));_0x17d584=_['merge'](_0x17d584,require('../api/faxQueue/faxQueue.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x17d584=_['merge'](_0x17d584,require('../api/smsAccount/smsAccount.rpc'));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x18')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x19')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x1a')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x1b')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x1c')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x1d')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x1e')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x1f')));_0x17d584=_['merge'](_0x17d584,require('../api/chatMessage/chatMessage.rpc'));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x20')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x21')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x22')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x23')));_0x17d584=_['merge'](_0x17d584,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x24')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x25')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x26')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x27')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/template/template.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/trigger/trigger.rpc'));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x28')));_0x17d584=_['merge'](_0x17d584,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x29')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x2a')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x2b')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x2c')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x2d')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x2e')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x2f')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x30')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x31')));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x32')));_0x17d584=_[_0x8272('0x3')](_0x17d584,require('../api/squareRecording/squareRecording.rpc'));_0x17d584=_[_0x8272('0x3')](_0x17d584,require(_0x8272('0x33')));_0x17d584=_['merge'](_0x17d584,require('../api/campaign/campaign.rpc'));_0x17d584=_['merge'](_0x17d584,require(_0x8272('0x34')));_0x17d584=_['merge'](_0x17d584,require('../api/plugin/plugin.rpc'));var _0x4f8ec5=jayson[_0x8272('0x35')](_0x17d584)[_0x8272('0x36')]();var _0x3853b7=config[_0x8272('0x37')][_0x8272('0x38')]||config['port']+0x1;var _0x48e054=config[_0x8272('0x37')]['ip']||_0x8272('0x39');_0x4f8ec5['on'](_0x8272('0x3a'),function(_0x3aef4b){return _0x3ac88b(_0x3aef4b);});_0x4f8ec5[_0x8272('0x2')](_0x3853b7,_0x48e054,function(){console[_0x8272('0x3b')](_0x8272('0x3c'),_0x48e054,_0x3853b7);require(_0x8272('0x3d'))[_0x8272('0x3e')]();return _0x230079(_0x8272('0x3f')+_0x48e054+':'+_0x3853b7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 9a862f6..7c920b8 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 _0x7e50=['EventEmitter','./reply','./error','utf8','setTimeout','setEncoding','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','WAIT','label','exports','lodash','events'];(function(_0x10fabb,_0xca68ec){var _0x4ecf53=function(_0x382ba3){while(--_0x382ba3){_0x10fabb['push'](_0x10fabb['shift']());}};_0x4ecf53(++_0xca68ec);}(_0x7e50,0x1ef));var _0x07e5=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x7e50[_0x57a50d];return _0x1b25b3;};'use strict';var util=require('util');var _=require(_0x07e5('0x0'));var EventEmitter=require(_0x07e5('0x1'))[_0x07e5('0x2')];var AGIReply=require(_0x07e5('0x3'));var AGIError=require(_0x07e5('0x4'));function AGIChannel(_0x37ae21){var _0xc9c47f=this,_0x39f467=new AGIReply(),_0x25139f=![],_0x366925={};EventEmitter['call'](_0xc9c47f);_0x37ae21['setEncoding'](_0x07e5('0x5'));_0x37ae21[_0x07e5('0x6')](0x8*0x3c*0x3c*0x3e8);_0x39f467[_0x07e5('0x7')](_0x07e5('0x5'));_0x39f467['on']('headers',function(_0x1c6187){for(var _0x447f84 in _0x1c6187){_0xc9c47f[_0x447f84]=_0x1c6187[_0x447f84];}_0xc9c47f[_0x07e5('0x8')](_0x07e5('0x9'));});_0x39f467['on'](_0x07e5('0xa'),function(_0x553290){if(_0x553290[_0x07e5('0xb')]()==_0x07e5('0xc')){_0xc9c47f['emit'](_0x07e5('0xc'));return;}if(_0x553290[_0x07e5('0xd')](0x0,0xb)=='520-Invalid'){_0x25139f=!![];}if(_0x25139f){_0x366925['rx']+=_0x553290+'\x0a';if(_0x553290[_0x07e5('0xe')](_0x07e5('0xf'))!=-0x1){_0x25139f=![];}}else{_0x366925['rx']=_0x553290;}if(_0x25139f){return;}if(typeof _0x366925['cb']==_0x07e5('0x10')){var _0x17e645=_0x366925['rx'][_0x07e5('0xd')](0x0,0x3),_0x2a91fd=null,_0x56e815=null;_0x17e645=parseInt(_0x17e645);if(isNaN(_0x17e645)){_0x366925['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x17e645!=0xc8){_0x366925['cb'](null,{'code':_0x17e645,'result':-0x1,'extra':'KO'});return;}_0x2a91fd=_0x366925['rx'][_0x07e5('0xd')](0x4)[_0x07e5('0x11')](_0x07e5('0x12'),'');if(_0x2a91fd[_0x07e5('0x13')]('\x20')!=-0x1){_0x2a91fd=_0x2a91fd['substr'](0x0,_0x2a91fd[_0x07e5('0x13')]('\x20'));}if(_[_0x07e5('0x14')](_0x2a91fd,'-1')){_0x2a91fd=parseInt(_0x2a91fd);}_0x56e815=_0x366925['rx'][_0x07e5('0x15')]('\x20');if(_0x56e815['length']==0x3){_0x56e815=_0x56e815[0x2][_0x07e5('0xd')](0x1,_0x56e815[0x2][_0x07e5('0x16')]-0x1);}else if(_0x56e815[_0x07e5('0x16')]>0x3){var _0xe0ee59=/\((.+)\)/;var _0x3795b3=_0x366925['rx'][_0x07e5('0x17')](_0xe0ee59);if(_0x3795b3){_0x56e815=_0x3795b3[0x1];}else{_0x56e815=null;}}else{_0x56e815=null;}_0x366925['cb'](null,{'code':_0x17e645,'result':_0x2a91fd,'extra':_0x56e815});}});_0x37ae21['on'](_0x07e5('0x18'),function(_0x2523b2){_0xc9c47f['emit']('error',new AGIError(_0x07e5('0x19'),_0x2523b2[_0x07e5('0x1a')]));});_0x37ae21['on']('close',function(){_0xc9c47f[_0x07e5('0x8')](_0x07e5('0x1b'),new AGIError(_0x07e5('0x1c')));});_0x37ae21['on'](_0x07e5('0x1d'),function(){_0xc9c47f['emit'](_0x07e5('0x1d'),new AGIError(_0x07e5('0x1e')));_0x37ae21[_0x07e5('0x1f')]();});_0x37ae21[_0x07e5('0x20')](_0x39f467);this[_0x07e5('0x21')]=function(_0x482796,_0x48ffa0){var _0x482796=_0x482796||'',_0x48ffa0=typeof _0x48ffa0==_0x07e5('0x10')?_0x48ffa0:new Function();_0x366925={'tx':_0x482796,'rx':'','cb':_0x48ffa0};_0x37ae21['write'](_0x482796+'\x0a');},this[_0x07e5('0x1b')]=function(){_0x37ae21['destroy']();};}util[_0x07e5('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x07e5('0x23')][_0x07e5('0x24')]=function(_0x4ad429){return this[_0x07e5('0x21')]['sync'](this,_0x4ad429);};AGIChannel[_0x07e5('0x23')][_0x07e5('0x25')]=function(){return this['sendRequest'](_0x07e5('0x26'));};AGIChannel[_0x07e5('0x23')][_0x07e5('0x27')]=function(_0x55f305,_0xe96f31,_0x406d30){_0x55f305=_0x55f305===undefined?_0x07e5('0x28'):_0x55f305;_0xe96f31=_0xe96f31===undefined?'5':_0xe96f31;_0x406d30=_0x406d30===undefined?'1':_0x406d30;return this['sendRequest'](util[_0x07e5('0x29')](_0x07e5('0x2a'),_0x55f305,_0xe96f31*0x3e8,_0x406d30));};AGIChannel[_0x07e5('0x23')][_0x07e5('0x2b')]=function(_0x4636c6){_0x4636c6=_0x4636c6||'NO\x20MESSAGE';return this[_0x07e5('0x24')](util[_0x07e5('0x29')](_0x07e5('0x2c'),_0x4636c6));};AGIChannel[_0x07e5('0x23')]['exec']=function(_0x5208f9,_0x3035cf){if(_[_0x07e5('0x2d')](_0x3035cf)){return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x5208f9,_0x3035cf['join'](',')));}return this[_0x07e5('0x24')](util['format'](_0x07e5('0x2e'),_0x5208f9,_0x3035cf));};AGIChannel[_0x07e5('0x23')]['setContext']=function(_0xbaac70){return this[_0x07e5('0x24')](util[_0x07e5('0x29')](_0x07e5('0x2f'),_0xbaac70));};AGIChannel[_0x07e5('0x23')][_0x07e5('0x30')]=function(_0x3e41d9){return this[_0x07e5('0x24')](util[_0x07e5('0x29')]('SET\x20EXTENSION\x20%s',_0x3e41d9));};AGIChannel['prototype'][_0x07e5('0x31')]=function(_0x1a882d){return this[_0x07e5('0x24')](util[_0x07e5('0x29')]('SET\x20PRIORITY\x20%s',_0x1a882d));};AGIChannel['prototype'][_0x07e5('0xc')]=function(){return this['sendRequest'](_0x07e5('0x32'));};AGIChannel[_0x07e5('0x23')]['setVariable']=function(_0x201db6,_0x1f4ff3){return this[_0x07e5('0x24')](util['format'](_0x07e5('0x33'),_0x201db6,_0x1f4ff3?_0x1f4ff3[_0x07e5('0x34')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x07e5('0x35')]=function(_0x5cb9cd,_0x1800c5){return this['sendRequest'](util[_0x07e5('0x29')]('SAY\x20NUMBER\x20%s\x20%s',_0x5cb9cd,_0x1800c5));};AGIChannel[_0x07e5('0x23')]['sayDigits']=function(_0xbe9071,_0x15fcbb){return this[_0x07e5('0x24')](util['format'](_0x07e5('0x36'),_0xbe9071,_0x15fcbb));};AGIChannel['prototype']['sayPhonetic']=function(_0xff176,_0x2c8a2d){return this['sendRequest'](util['format'](_0x07e5('0x37'),_0xff176,_0x2c8a2d));};AGIChannel[_0x07e5('0x23')]['continueAt']=function(_0x4276f4,_0x2d64ad,_0x454ccc){_0x2d64ad=_0x2d64ad||this[_0x07e5('0x38')];_0x454ccc=_0x454ccc||0x1;this[_0x07e5('0x39')](_0x4276f4);this[_0x07e5('0x30')](_0x2d64ad);this[_0x07e5('0x31')](_0x454ccc);return this[_0x07e5('0x2b')](util['format'](_0x07e5('0x3a'),_0x4276f4,_0x2d64ad,_0x454ccc));};AGIChannel['prototype'][_0x07e5('0x3b')]=function(_0x4c297b){return this[_0x07e5('0x24')](util['format'](_0x07e5('0x3c'),_0x4c297b));};AGIChannel[_0x07e5('0x23')][_0x07e5('0x3d')]=function(_0x41918b,_0x22fc82,_0x142f2c,_0x2e8ad6,_0x424da6,_0x17a27c){_0x22fc82=_0x22fc82||'wav';_0x142f2c=_0x142f2c||'';_0x2e8ad6=_0x2e8ad6===undefined?-0x1:_0x2e8ad6==='-1'?-0x1:_0x2e8ad6*0x3e8;_0x424da6=_0x424da6===undefined?'':'s='+_0x424da6;_0x17a27c=_0x17a27c?_0x07e5('0x3e'):'';return this[_0x07e5('0x24')](util[_0x07e5('0x29')](_0x07e5('0x3f'),_0x41918b,_0x22fc82,_0x142f2c,_0x2e8ad6,_0x17a27c,_0x424da6));};AGIChannel[_0x07e5('0x23')]['streamFile']=function(_0x58dfe2,_0x24ccdb){_0x24ccdb=_0x24ccdb||'';return this[_0x07e5('0x24')](util[_0x07e5('0x29')](_0x07e5('0x40'),_0x58dfe2,_0x24ccdb));};AGIChannel[_0x07e5('0x23')][_0x07e5('0x41')]=function(_0x33e646){return this[_0x07e5('0x42')](_0x07e5('0x43'),_0x33e646);};AGIChannel[_0x07e5('0x23')]['wait']=function(_0x19a46b){return this[_0x07e5('0x42')](_0x07e5('0x44'),_0x19a46b);};AGIChannel[_0x07e5('0x23')][_0x07e5('0x18')]=function(_0x4767c6,_0x4d1e31){this[_0x07e5('0x2b')](util[_0x07e5('0x29')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4767c6['id'],_0x4767c6[_0x07e5('0x45')],_0x4d1e31));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x07e5('0x46')]=AGIChannel; \ No newline at end of file +var _0xbc89=['GET\x20VARIABLE\x20\x22%s\x22','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','util','events','EventEmitter','./reply','call','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','prototype','sendRequest','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable'];(function(_0xfb3ab,_0x5b9df3){var _0x51a4a0=function(_0x59c5c2){while(--_0x59c5c2){_0xfb3ab['push'](_0xfb3ab['shift']());}};_0x51a4a0(++_0x5b9df3);}(_0xbc89,0x179));var _0x9bc8=function(_0x505df9,_0x14138e){_0x505df9=_0x505df9-0x0;var _0x1cc025=_0xbc89[_0x505df9];return _0x1cc025;};'use strict';var util=require(_0x9bc8('0x0'));var _=require('lodash');var EventEmitter=require(_0x9bc8('0x1'))[_0x9bc8('0x2')];var AGIReply=require(_0x9bc8('0x3'));var AGIError=require('./error');function AGIChannel(_0x2feea6){var _0x4f6bbf=this,_0xd9c39e=new AGIReply(),_0x34724d=![],_0x1c4e97={};EventEmitter[_0x9bc8('0x4')](_0x4f6bbf);_0x2feea6[_0x9bc8('0x5')](_0x9bc8('0x6'));_0x2feea6['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0xd9c39e['setEncoding']('utf8');_0xd9c39e['on'](_0x9bc8('0x7'),function(_0x48f7a9){for(var _0x187c5b in _0x48f7a9){_0x4f6bbf[_0x187c5b]=_0x48f7a9[_0x187c5b];}_0x4f6bbf[_0x9bc8('0x8')](_0x9bc8('0x9'));});_0xd9c39e['on'](_0x9bc8('0xa'),function(_0x24dd01){if(_0x24dd01[_0x9bc8('0xb')]()=='hangup'){_0x4f6bbf[_0x9bc8('0x8')](_0x9bc8('0xc'));return;}if(_0x24dd01[_0x9bc8('0xd')](0x0,0xb)==_0x9bc8('0xe')){_0x34724d=!![];}if(_0x34724d){_0x1c4e97['rx']+=_0x24dd01+'\x0a';if(_0x24dd01[_0x9bc8('0xf')](_0x9bc8('0x10'))!=-0x1){_0x34724d=![];}}else{_0x1c4e97['rx']=_0x24dd01;}if(_0x34724d){return;}if(typeof _0x1c4e97['cb']==_0x9bc8('0x11')){var _0xa74e7d=_0x1c4e97['rx'][_0x9bc8('0xd')](0x0,0x3),_0x44f7e7=null,_0x113820=null;_0xa74e7d=parseInt(_0xa74e7d);if(isNaN(_0xa74e7d)){_0x1c4e97['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9bc8('0x12')});return;}if(_0xa74e7d!=0xc8){_0x1c4e97['cb'](null,{'code':_0xa74e7d,'result':-0x1,'extra':'KO'});return;}_0x44f7e7=_0x1c4e97['rx']['substring'](0x4)['replace']('result=','');if(_0x44f7e7[_0x9bc8('0x13')]('\x20')!=-0x1){_0x44f7e7=_0x44f7e7[_0x9bc8('0x14')](0x0,_0x44f7e7['indexOf']('\x20'));}if(_[_0x9bc8('0x15')](_0x44f7e7,'-1')){_0x44f7e7=parseInt(_0x44f7e7);}_0x113820=_0x1c4e97['rx'][_0x9bc8('0x16')]('\x20');if(_0x113820[_0x9bc8('0x17')]==0x3){_0x113820=_0x113820[0x2]['substring'](0x1,_0x113820[0x2][_0x9bc8('0x17')]-0x1);}else if(_0x113820[_0x9bc8('0x17')]>0x3){var _0x4b3128=/\((.+)\)/;var _0x36f6a6=_0x1c4e97['rx'][_0x9bc8('0x18')](_0x4b3128);if(_0x36f6a6){_0x113820=_0x36f6a6[0x1];}else{_0x113820=null;}}else{_0x113820=null;}_0x1c4e97['cb'](null,{'code':_0xa74e7d,'result':_0x44f7e7,'extra':_0x113820});}});_0x2feea6['on'](_0x9bc8('0x19'),function(_0x524785){_0x4f6bbf[_0x9bc8('0x8')](_0x9bc8('0x19'),new AGIError(_0x9bc8('0x1a'),_0x524785[_0x9bc8('0x1b')]));});_0x2feea6['on'](_0x9bc8('0x1c'),function(){_0x4f6bbf[_0x9bc8('0x8')](_0x9bc8('0x1c'),new AGIError(_0x9bc8('0x1d')));});_0x2feea6['on'](_0x9bc8('0x1e'),function(){_0x4f6bbf[_0x9bc8('0x8')](_0x9bc8('0x1e'),new AGIError(_0x9bc8('0x1f')));_0x2feea6['destroy']();});_0x2feea6[_0x9bc8('0x20')](_0xd9c39e);this[_0x9bc8('0x21')]=function(_0x18663b,_0x461e4c){var _0x18663b=_0x18663b||'',_0x461e4c=typeof _0x461e4c==_0x9bc8('0x11')?_0x461e4c:new Function();_0x1c4e97={'tx':_0x18663b,'rx':'','cb':_0x461e4c};_0x2feea6['write'](_0x18663b+'\x0a');},this[_0x9bc8('0x1c')]=function(){_0x2feea6['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x23')]=function(_0x131c44){return this[_0x9bc8('0x21')]['sync'](this,_0x131c44);};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x24')]=function(){return this[_0x9bc8('0x23')](_0x9bc8('0x25'));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x26')]=function(_0x7fbe9b,_0x3d7b56,_0x5c966b){_0x7fbe9b=_0x7fbe9b===undefined?_0x9bc8('0x27'):_0x7fbe9b;_0x3d7b56=_0x3d7b56===undefined?'5':_0x3d7b56;_0x5c966b=_0x5c966b===undefined?'1':_0x5c966b;return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')](_0x9bc8('0x29'),_0x7fbe9b,_0x3d7b56*0x3e8,_0x5c966b));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x2a')]=function(_0x3fcc1b){_0x3fcc1b=_0x3fcc1b||_0x9bc8('0x2b');return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')]('VERBOSE\x20\x22%s\x22',_0x3fcc1b));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x2c')]=function(_0x4e56d3,_0x4fc620){if(_[_0x9bc8('0x2d')](_0x4fc620)){return this['sendRequest'](util[_0x9bc8('0x28')](_0x9bc8('0x2e'),_0x4e56d3,_0x4fc620[_0x9bc8('0x2f')](',')));}return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')](_0x9bc8('0x2e'),_0x4e56d3,_0x4fc620));};AGIChannel['prototype']['setContext']=function(_0x4537f1){return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')](_0x9bc8('0x30'),_0x4537f1));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x31')]=function(_0x5ca88b){return this['sendRequest'](util['format'](_0x9bc8('0x32'),_0x5ca88b));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x33')]=function(_0x3fb634){return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')](_0x9bc8('0x34'),_0x3fb634));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0xc')]=function(){return this['sendRequest'](_0x9bc8('0x35'));};AGIChannel[_0x9bc8('0x22')]['setVariable']=function(_0xaebf19,_0x368797){return this[_0x9bc8('0x23')](util['format'](_0x9bc8('0x36'),_0xaebf19,_0x368797?_0x368797[_0x9bc8('0x37')]()[_0x9bc8('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x39')]=function(_0xf7277,_0x3bb333){return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')](_0x9bc8('0x3a'),_0xf7277,_0x3bb333));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x3b')]=function(_0x17df7a,_0xd0b945){return this['sendRequest'](util[_0x9bc8('0x28')](_0x9bc8('0x3c'),_0x17df7a,_0xd0b945));};AGIChannel['prototype'][_0x9bc8('0x3d')]=function(_0x4071d9,_0x4489ff){return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')](_0x9bc8('0x3e'),_0x4071d9,_0x4489ff));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x3f')]=function(_0x45455e,_0x2a1b2b,_0x3db051){_0x2a1b2b=_0x2a1b2b||this['extension'];_0x3db051=_0x3db051||0x1;this[_0x9bc8('0x40')](_0x45455e);this[_0x9bc8('0x31')](_0x2a1b2b);this[_0x9bc8('0x33')](_0x3db051);return this[_0x9bc8('0x2a')](util[_0x9bc8('0x28')](_0x9bc8('0x41'),_0x45455e,_0x2a1b2b,_0x3db051));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x42')]=function(_0x3db68e){return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')](_0x9bc8('0x43'),_0x3db68e));};AGIChannel[_0x9bc8('0x22')]['recordFile']=function(_0x12c7b5,_0x3f6a9e,_0x2431f7,_0x115f2b,_0x1e74ef,_0x22795d){_0x3f6a9e=_0x3f6a9e||'wav';_0x2431f7=_0x2431f7||'';_0x115f2b=_0x115f2b===undefined?-0x1:_0x115f2b==='-1'?-0x1:_0x115f2b*0x3e8;_0x1e74ef=_0x1e74ef===undefined?'':'s='+_0x1e74ef;_0x22795d=_0x22795d?_0x9bc8('0x44'):'';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',_0x12c7b5,_0x3f6a9e,_0x2431f7,_0x115f2b,_0x22795d,_0x1e74ef));};AGIChannel[_0x9bc8('0x22')]['streamFile']=function(_0x3ff38c,_0x9c2fb0){_0x9c2fb0=_0x9c2fb0||'';return this[_0x9bc8('0x23')](util[_0x9bc8('0x28')](_0x9bc8('0x45'),_0x3ff38c,_0x9c2fb0));};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x46')]=function(_0x558000){return this[_0x9bc8('0x2c')](_0x9bc8('0x47'),_0x558000);};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x48')]=function(_0x3d7263){return this[_0x9bc8('0x2c')](_0x9bc8('0x49'),_0x3d7263);};AGIChannel[_0x9bc8('0x22')][_0x9bc8('0x19')]=function(_0x51da06,_0x35d041){this[_0x9bc8('0x2a')](util[_0x9bc8('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x51da06['id'],_0x51da06['label'],_0x35d041));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9034f87..c97a50e 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 _0x6c96=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x6c96,0x1c1));var _0x66c9=function(_0x598bb0,_0x136414){_0x598bb0=_0x598bb0-0x0;var _0x4dd0fd=_0x6c96[_0x598bb0];return _0x4dd0fd;};'use strict';var util=require(_0x66c9('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x66c9('0x1'),'E_AGI_SERVER_ERROR':_0x66c9('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x66c9('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x66c9('0x4'),'E_AGI_SOCKET_ERROR':_0x66c9('0x5'),'E_AGI_SOCKET_CLOSE':_0x66c9('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x66c9('0x7'),'E_AGI_COMMAND_EMPTY':_0x66c9('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x66c9('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x1c8b59){var _0x1c8b59=_0x1c8b59||null,_0xb03819=_0xb03819||[],_0x4d7692=0x1,_0x55b488='';if(!error[_0x1c8b59]){_0x1c8b59=_0x66c9('0xa');}_0xb03819[_0x66c9('0xb')](error[_0x1c8b59]);while(arguments[_0x4d7692]){_0xb03819[_0x66c9('0xb')](arguments[_0x4d7692]);_0x4d7692++;}_0x55b488=util[_0x66c9('0xc')]['apply'](util,_0xb03819);this['message']=_0x55b488;this['name']=_0x1c8b59;}module['exports']=AGIError; \ No newline at end of file +var _0x3a12=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util','Undefined\x20error.'];(function(_0x1373fa,_0x3e0911){var _0x490a1f=function(_0x355c71){while(--_0x355c71){_0x1373fa['push'](_0x1373fa['shift']());}};_0x490a1f(++_0x3e0911);}(_0x3a12,0x1ce));var _0x23a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a12[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x23a1('0x0'));var error={'E_AGI_UNDEFINED':_0x23a1('0x1'),'E_AGI_ARGUMENT_PORT':_0x23a1('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x23a1('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x23a1('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x23a1('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x23a1('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x23a1('0x7'),'E_AGI_COMMAND_EMPTY':_0x23a1('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x23a1('0x9')};function AGIError(_0x3f41d6){var _0x3f41d6=_0x3f41d6||null,_0x34bfeb=_0x34bfeb||[],_0x13a11f=0x1,_0x148956='';if(!error[_0x3f41d6]){_0x3f41d6=_0x23a1('0xa');}_0x34bfeb[_0x23a1('0xb')](error[_0x3f41d6]);while(arguments[_0x13a11f]){_0x34bfeb[_0x23a1('0xb')](arguments[_0x13a11f]);_0x13a11f++;}_0x148956=util[_0x23a1('0xc')][_0x23a1('0xd')](util,_0x34bfeb);this[_0x23a1('0xe')]=_0x148956;this[_0x23a1('0xf')]=_0x3f41d6;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index d9a5a5c..3364875 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 _0xac4a=['getsecretdigits','numberOfEdges','prototype','addVertex','vertices','push','relations','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','edges','length','no\x20edge/s\x20available','split','agicommand','vswitch','target','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits'];(function(_0xb3825b,_0x4c4f92){var _0x283120=function(_0x3735c7){while(--_0x3735c7){_0xb3825b['push'](_0xb3825b['shift']());}};_0x283120(++_0x4c4f92);}(_0xac4a,0x13f));var _0xaac4=function(_0xf24c89,_0x409d2c){_0xf24c89=_0xf24c89-0x0;var _0x4c1290=_0xac4a[_0xf24c89];return _0x4c1290;};'use strict';var _=require(_0xaac4('0x0'));var logger=require(_0xaac4('0x1'))(_0xaac4('0x2'));var verticesWithRetry=[_0xaac4('0x3'),_0xaac4('0x4'),_0xaac4('0x5')];var Graph=function(){this['vertices']={};this['edges']={};this[_0xaac4('0x6')]=0x0;};Graph[_0xaac4('0x7')][_0xaac4('0x8')]=function(_0x58ae95){this[_0xaac4('0x9')][_0x58ae95['id']]=_0x58ae95;this['edges'][_0x58ae95['id']]=[];};Graph[_0xaac4('0x7')]['addEdge']=function(_0x1e4283,_0x27354c,_0x567295){this['edges'][_0x1e4283][_0xaac4('0xa')]({'target':_0x27354c,'condition':_0x567295});this['numberOfEdges']+=0x1;};Graph[_0xaac4('0x7')]['size']=function(){return _['size'](this[_0xaac4('0x9')]);};Graph[_0xaac4('0x7')][_0xaac4('0xb')]=function(){return this[_0xaac4('0x6')];};Graph[_0xaac4('0x7')]['getVertex']=function(_0x508e14){return this[_0xaac4('0x9')][_0x508e14];};Graph[_0xaac4('0x7')][_0xaac4('0xc')]=function(_0x5a4801,_0x6a808d){if(!this[_0xaac4('0x9')][_0x5a4801]){return logger['info'](_0xaac4('0xd'));}var _0x2b20d0=_0x6a808d(this[_0xaac4('0x9')][_0x5a4801]);if(!_0x2b20d0){return logger[_0xaac4('0xe')](_0xaac4('0xf'));}if(this[_0xaac4('0x10')][_0x5a4801][_0xaac4('0x11')]===0x0){return logger[_0xaac4('0xe')](_0xaac4('0x12'));}for(var _0xb8466e=0x0,_0x35bc32=[],_0x1766c2=![];_0xb8466e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','toJson','root','agicommand','maxRetry','retry','addVertex','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','then','createSquareReport','catch','agi_','inspect','debug','variables','stringify','close','timeout','hangup','sync','production','start','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./vertices'];(function(_0x2681a3,_0x1a7f8b){var _0x5c7210=function(_0x2a28f4){while(--_0x2a28f4){_0x2681a3['push'](_0x2681a3['shift']());}};_0x5c7210(++_0x1a7f8b);}(_0xbd50,0x196));var _0x0bd5=function(_0x4f36d9,_0x35e95d){_0x4f36d9=_0x4f36d9-0x0;var _0x17bb63=_0xbd50[_0x4f36d9];return _0x17bb63;};'use strict';var parser=require(_0x0bd5('0x0'));var _=require(_0x0bd5('0x1'));var syncho=require(_0x0bd5('0x2'));var util=require('util');var moment=require(_0x0bd5('0x3'));var config=require(_0x0bd5('0x4'));var logger=require(_0x0bd5('0x5'))(_0x0bd5('0x6'));var utilLicense=require(_0x0bd5('0x7'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x0bd5('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0bd5('0x6')]=_[_0x0bd5('0x9')](config[_0x0bd5('0x6')],{'ip':_0x0bd5('0xa'),'port':0x11dd});function connectionHandler(_0x5ebe64){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5ebe64);agiHandler(_0x5ebe64);}catch(_0x1a5cb9){logger[_0x0bd5('0xb')](_0x1a5cb9[_0x0bd5('0xc')]);}});});}function listeningHandler(){console['log'](_0x0bd5('0xd'),config[_0x0bd5('0x6')]['port']);logger[_0x0bd5('0xe')](util[_0x0bd5('0xf')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x0bd5('0x6')]['ip'],config[_0x0bd5('0x6')][_0x0bd5('0x10')]));}function errorHandler(_0x5f49ee){if(_0x5f49ee&&_0x5f49ee[_0x0bd5('0x11')]&&_0x5f49ee[_0x0bd5('0x12')]){logger[_0x0bd5('0xb')](util[_0x0bd5('0xf')](_0x0bd5('0x13'),_0x5f49ee[_0x0bd5('0x11')],_0x5f49ee[_0x0bd5('0x12')]));}else{logger[_0x0bd5('0xb')](util['format'](_0x0bd5('0x14'),_0x5f49ee[_0x0bd5('0xc')]));}}function closeHandler(){logger['info'](util[_0x0bd5('0xf')](_0x0bd5('0x15'),this[_0x0bd5('0x16')],this[_0x0bd5('0x17')],this['callerid'],this[_0x0bd5('0x18')],this[_0x0bd5('0x19')]));try{createSquareReport(this);}catch(_0xa890be){logger[_0x0bd5('0xb')](_0xa890be[_0x0bd5('0xc')]);}}function timeoutHandler(){logger[_0x0bd5('0xe')](util[_0x0bd5('0xf')](_0x0bd5('0x1a'),this[_0x0bd5('0x16')],this[_0x0bd5('0x17')],this[_0x0bd5('0x1b')],this[_0x0bd5('0x18')],this[_0x0bd5('0x19')]));}function hangupHandler(){logger[_0x0bd5('0xe')](util['format']('[HANGUP]\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[_0x0bd5('0x18')],this[_0x0bd5('0x19')]));this[_0x0bd5('0x1c')]=!![];}function getRoot(_0x4a6910){return parser[_0x0bd5('0x1d')](_0x4a6910,{'object':!![]})['mxGraphModel'][_0x0bd5('0x1e')];}function addVertex(_0x3b235b,_0x38c21d,_0x5a8139){_0x38c21d[_0x0bd5('0x1f')]=_0x5a8139;if(_0x38c21d['hasOwnProperty']('retry')){_0x38c21d[_0x0bd5('0x20')]=parseInt(_0x38c21d[_0x0bd5('0x21')],0xa);}_0x3b235b[_0x0bd5('0x22')](_['omit'](_0x38c21d,_0x0bd5('0x23')));}function initGraph(_0x5eab3e,_0x456e87){var _0x3ffb08=new Graph();for(var _0x18cec3 in _0x5eab3e){if(_0x5eab3e[_0x0bd5('0x24')](_0x18cec3)){if(_[_0x0bd5('0x25')](_0x5eab3e[_0x18cec3])){for(var _0x2023d5=0x0;_0x2023d5<_0x5eab3e[_0x18cec3][_0x0bd5('0x26')];_0x2023d5+=0x1){addVertex(_0x3ffb08,_0x5eab3e[_0x18cec3][_0x2023d5],_0x18cec3);}}else{addVertex(_0x3ffb08,_0x5eab3e[_0x18cec3],_0x18cec3);}}}for(var _0x2f01ff=0x0;_0x2f01ff<_0x456e87[_0x0bd5('0x26')];_0x2f01ff+=0x1){if(_0x456e87[_0x2f01ff][_0x0bd5('0x27')]&&_0x456e87[_0x2f01ff][_0x0bd5('0x28')]){_0x3ffb08[_0x0bd5('0x29')](_0x456e87[_0x2f01ff][_0x0bd5('0x27')],_0x456e87[_0x2f01ff][_0x0bd5('0x28')],_0x456e87[_0x2f01ff]['value']);}}return _0x3ffb08;}function getSquareProject(_0x461ae3,_0x19eb75){rpc['getSquareProject'](_0x461ae3)[_0x0bd5('0x2a')](function(_0x8eccc9){_0x19eb75(null,_0x8eccc9);})['catch'](function(_0x11f482){_0x19eb75(null,_0x11f482);});}function createSquareReport(_0x1b7cf4,_0x28ab82){rpc[_0x0bd5('0x2b')](_0x1b7cf4)['then'](function(_0x440e69){if(_0x28ab82){_0x28ab82(null,_0x440e69);}})[_0x0bd5('0x2c')](function(_0x622d46){if(_0x28ab82){_0x28ab82(null,_0x622d46);}});}function setChannelVariables(_0x24ef4a){for(var _0xecf11f in _0x24ef4a){if(_0x24ef4a[_0x0bd5('0x24')](_0xecf11f)){if(_0xecf11f['indexOf'](_0x0bd5('0x2d'))===0x0){_0x24ef4a[_0xecf11f['substring'](0x4)]=_0x24ef4a[_0xecf11f];delete _0x24ef4a[_0xecf11f];}}}}function getLogFromObject(_0x398362){return util[_0x0bd5('0x2e')](_0x398362,{'showHidden':![],'depth':null});}function agiHandler(_0x444ddb){var _0x132e02,_0x37e14b,_0x1c7010,_0x15e380,_0x24f7d5;logger[_0x0bd5('0x2f')](_0x0bd5('0x30'),JSON[_0x0bd5('0x31')](_0x444ddb,null,0x2));logger[_0x0bd5('0xe')](util[_0x0bd5('0xf')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x444ddb[_0x0bd5('0x16')],_0x444ddb[_0x0bd5('0x17')],_0x444ddb['callerid'],_0x444ddb['dnid'],_0x444ddb[_0x0bd5('0x19')]));_0x444ddb['on'](_0x0bd5('0xb'),errorHandler);_0x444ddb['on'](_0x0bd5('0x32'),closeHandler);_0x444ddb['on'](_0x0bd5('0x33'),timeoutHandler);_0x444ddb[_0x0bd5('0x1c')]=![];_0x444ddb['on'](_0x0bd5('0x34'),hangupHandler);var _0x22c10c=getSquareProject[_0x0bd5('0x35')](null,_0x444ddb[_0x0bd5('0x16')]);if(_0x22c10c){if(_0x22c10c[_0x0bd5('0x36')]){_0x132e02=getRoot(_0x22c10c[_0x0bd5('0x36')]);if(_0x132e02&&_0x132e02[_0x0bd5('0x37')]){logger[_0x0bd5('0x2f')]('root',JSON[_0x0bd5('0x31')](_0x132e02,null,0x2));_0x444ddb['joinAt']=moment()[_0x0bd5('0xf')](_0x0bd5('0x38'));_0x37e14b=initGraph(_[_0x0bd5('0x39')](_0x132e02,_0x0bd5('0x23')),_0x132e02[_0x0bd5('0x23')]);_0x1c7010=new Vertices(_0x444ddb,rpc,mailRpc);logger[_0x0bd5('0xe')](util['format'](_0x0bd5('0x3a'),_0x444ddb[_0x0bd5('0x16')],_0x444ddb[_0x0bd5('0x17')],_0x444ddb[_0x0bd5('0x1b')],_0x444ddb[_0x0bd5('0x18')],_0x444ddb[_0x0bd5('0x19')]));_0x37e14b[_0x0bd5('0x3b')](_0x132e02[_0x0bd5('0x37')]['id'],function(_0x1c2ef8){try{_0x1c2ef8=_0x1c7010['clear'](_0x1c2ef8);logger[_0x0bd5('0x2f')]('vertex',JSON[_0x0bd5('0x31')](_0x1c2ef8,null,0x2));if(_0x1c2ef8[_0x0bd5('0x1f')]==='gotoc'){logger[_0x0bd5('0xe')](_0x0bd5('0x3c'));_0x444ddb[_0x0bd5('0x3d')]=_0x1c2ef8[_0x0bd5('0x3d')]||_0x444ddb[_0x0bd5('0x3d')];_0x444ddb[_0x0bd5('0x3e')]=_0x1c2ef8[_0x0bd5('0x3e')];_0x444ddb['priority']=_0x1c2ef8['priority']?_0x1c2ef8[_0x0bd5('0x3f')]-0x1:0x1;return null;}else if(_0x1c2ef8&&_0x1c7010[_0x1c2ef8['agicommand']]){_0x24f7d5=_0x1c7010[_0x1c2ef8['agicommand']](_0x1c2ef8);logger[_0x0bd5('0xe')](_0x0bd5('0x40'),JSON['stringify'](_0x24f7d5,null,0x2));if(_0x24f7d5&&_0x24f7d5['code']===AGI_CODE_SUCCESS&&_0x24f7d5['result']!==AGI_RESULT_ERROR&&!_0x444ddb[_0x0bd5('0x1c')]){logger['debug']('response',getLogFromObject(_0x24f7d5));return _[_0x0bd5('0x41')](_0x24f7d5[_0x0bd5('0x42')])?null:_0x24f7d5['result']['toString']();}else{logger[_0x0bd5('0xb')](_0x0bd5('0x40'),getLogFromObject(_0x24f7d5));return null;}}else{logger[_0x0bd5('0xb')](_0x0bd5('0x43'));return null;}}catch(_0x56a702){logger[_0x0bd5('0xb')](_0x56a702[_0x0bd5('0xc')]);return null;}});if(_0x132e02[_0x0bd5('0x44')]){logger[_0x0bd5('0xe')](util[_0x0bd5('0xf')](_0x0bd5('0x45'),_0x444ddb['arg_1'],_0x444ddb[_0x0bd5('0x17')],_0x444ddb[_0x0bd5('0x1b')],_0x444ddb[_0x0bd5('0x18')],_0x444ddb['uniqueid']));_0x37e14b[_0x0bd5('0x3b')](_0x132e02[_0x0bd5('0x44')]['id'],function(_0x2c0d17){try{_0x2c0d17=_0x1c7010['clear'](_0x2c0d17);logger[_0x0bd5('0x2f')](_0x0bd5('0x46'),JSON[_0x0bd5('0x31')](_0x2c0d17,null,0x2));if(_0x2c0d17&&_0x1c7010[_0x2c0d17[_0x0bd5('0x1f')]]){_0x24f7d5=_0x1c7010[_0x2c0d17[_0x0bd5('0x1f')]](_0x2c0d17);if(_0x24f7d5){logger['debug'](_0x0bd5('0x40'),getLogFromObject(_0x24f7d5));return _[_0x0bd5('0x41')](_0x24f7d5['result'])?null:_0x24f7d5[_0x0bd5('0x42')][_0x0bd5('0x47')]();}else{logger[_0x0bd5('0xb')](_0x0bd5('0x40'),getLogFromObject(_0x24f7d5));return null;}}else{logger[_0x0bd5('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x109793){logger[_0x0bd5('0xb')](_0x109793['stack']);return null;}});}logger[_0x0bd5('0xe')](util['format'](_0x0bd5('0x48'),_0x444ddb[_0x0bd5('0x16')],_0x444ddb[_0x0bd5('0x17')],_0x444ddb[_0x0bd5('0x1b')],_0x444ddb['dnid'],_0x444ddb[_0x0bd5('0x19')]));logger['info'](util['format'](_0x0bd5('0x49'),_0x444ddb[_0x0bd5('0x3d')],_0x444ddb[_0x0bd5('0x3e')],parseInt(_0x444ddb['priority'],0xa)+0x1));_0x444ddb[_0x0bd5('0x4a')](_0x444ddb['context'],_0x444ddb[_0x0bd5('0x3e')],parseInt(_0x444ddb[_0x0bd5('0x3f')],0xa)+0x1);_0x444ddb[_0x0bd5('0x32')]();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x444ddb[_0x0bd5('0x16')]));_0x444ddb[_0x0bd5('0x4a')](_0x444ddb[_0x0bd5('0x3d')],_0x444ddb['extension'],parseInt(_0x444ddb[_0x0bd5('0x3f')],0xa)+0x1);_0x444ddb[_0x0bd5('0x32')]();}}else{logger['error'](util[_0x0bd5('0xf')]('Project\x20%s\x20not\x20found',_0x444ddb['arg_1']));_0x444ddb[_0x0bd5('0x4a')](_0x444ddb[_0x0bd5('0x3d')],_0x444ddb[_0x0bd5('0x3e')],parseInt(_0x444ddb[_0x0bd5('0x3f')],0xa)+0x1);_0x444ddb['close']();}}function main(){var _0x3a92e8;return utilLicense[_0x0bd5('0x4b')]()[_0x0bd5('0x2a')](function(_0x5cf2f2){if(_0x5cf2f2){if(_0x5cf2f2[_0x0bd5('0x4c')]){if(_0x5cf2f2[_0x0bd5('0x4d')]&&_0x5cf2f2[_0x0bd5('0x4d')]>0x0){logger['info'](util['format'](_0x0bd5('0x4e'),_0x5cf2f2['callysquare']));_0x3a92e8=_0x5cf2f2[_0x0bd5('0x4d')];}else{logger[_0x0bd5('0xe')](_0x0bd5('0x4f'));}}else{logger['info'](_0x0bd5('0x50'));_0x3a92e8=-0x1;}}})[_0x0bd5('0x2c')](function(_0x3eaea6){logger[_0x0bd5('0xb')]('[LICENSE]',_0x3eaea6[_0x0bd5('0xc')]);})[_0x0bd5('0x44')](function(){var _0x5d02cb=require(_0x0bd5('0x51'))(config[_0x0bd5('0x6')]['port'],config[_0x0bd5('0x6')]['ip'],_0x3a92e8);_0x5d02cb['on']('error',errorHandler);_0x5d02cb['on'](_0x0bd5('0x52'),listeningHandler);_0x5d02cb['on']('connection',connectionHandler);_0x5d02cb['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x6aa7=['priority','response','code','result','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','xml2json','syncho','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./vertices','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','arg_1','callerid','uniqueid','stack','calleridname','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','target','source','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','production','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','start','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension'];(function(_0x24afa8,_0x3c1832){var _0x506362=function(_0x3f93a4){while(--_0x3f93a4){_0x24afa8['push'](_0x24afa8['shift']());}};_0x506362(++_0x3c1832);}(_0x6aa7,0x178));var _0x76aa=function(_0x183e84,_0x436af3){_0x183e84=_0x183e84-0x0;var _0xd45bd5=_0x6aa7[_0x183e84];return _0xd45bd5;};'use strict';var parser=require(_0x76aa('0x0'));var _=require('lodash');var syncho=require(_0x76aa('0x1'));var util=require(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var config=require(_0x76aa('0x4'));var logger=require('../../config/logger')(_0x76aa('0x5'));var utilLicense=require(_0x76aa('0x6'));var rpc=require(_0x76aa('0x7'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x76aa('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x76aa('0x9')](config[_0x76aa('0x5')],{'ip':_0x76aa('0xa'),'port':0x11dd});function connectionHandler(_0x56d6bc){process[_0x76aa('0xb')](function(){syncho(function(){try{setChannelVariables(_0x56d6bc);agiHandler(_0x56d6bc);}catch(_0x266bd5){logger[_0x76aa('0xc')](_0x266bd5['stack']);}});});}function listeningHandler(){console[_0x76aa('0xd')](_0x76aa('0xe'),config[_0x76aa('0x5')][_0x76aa('0xf')]);logger[_0x76aa('0x10')](util[_0x76aa('0x11')](_0x76aa('0x12'),config[_0x76aa('0x5')]['ip'],config[_0x76aa('0x5')][_0x76aa('0xf')]));}function errorHandler(_0x5e5f47){if(_0x5e5f47&&_0x5e5f47[_0x76aa('0x13')]&&_0x5e5f47['message']){logger[_0x76aa('0xc')](util[_0x76aa('0x11')](_0x76aa('0x14'),_0x5e5f47[_0x76aa('0x13')],_0x5e5f47[_0x76aa('0x15')]));}else{logger['error'](util['format'](_0x76aa('0x16'),_0x5e5f47['stack']));}}function closeHandler(){logger[_0x76aa('0x10')](util[_0x76aa('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x76aa('0x17')],this['calleridname'],this[_0x76aa('0x18')],this['dnid'],this[_0x76aa('0x19')]));try{createSquareReport(this);}catch(_0x413cf6){logger[_0x76aa('0xc')](_0x413cf6[_0x76aa('0x1a')]);}}function timeoutHandler(){logger[_0x76aa('0x10')](util[_0x76aa('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x76aa('0x1b')],this[_0x76aa('0x18')],this[_0x76aa('0x1c')],this[_0x76aa('0x19')]));}function hangupHandler(){logger[_0x76aa('0x10')](util[_0x76aa('0x11')](_0x76aa('0x1d'),this[_0x76aa('0x17')],this[_0x76aa('0x1b')],this['callerid'],this[_0x76aa('0x1c')],this[_0x76aa('0x19')]));this[_0x76aa('0x1e')]=!![];}function getRoot(_0x5b3f55){return parser[_0x76aa('0x1f')](_0x5b3f55,{'object':!![]})[_0x76aa('0x20')][_0x76aa('0x21')];}function addVertex(_0x2bd2c6,_0x29c50c,_0xc1044c){_0x29c50c[_0x76aa('0x22')]=_0xc1044c;if(_0x29c50c[_0x76aa('0x23')](_0x76aa('0x24'))){_0x29c50c[_0x76aa('0x25')]=parseInt(_0x29c50c[_0x76aa('0x24')],0xa);}_0x2bd2c6[_0x76aa('0x26')](_[_0x76aa('0x27')](_0x29c50c,'mxCell'));}function initGraph(_0xb5e8a9,_0x1d6d15){var _0x25c614=new Graph();for(var _0x2e7ab4 in _0xb5e8a9){if(_0xb5e8a9[_0x76aa('0x23')](_0x2e7ab4)){if(_[_0x76aa('0x28')](_0xb5e8a9[_0x2e7ab4])){for(var _0x25a803=0x0;_0x25a803<_0xb5e8a9[_0x2e7ab4][_0x76aa('0x29')];_0x25a803+=0x1){addVertex(_0x25c614,_0xb5e8a9[_0x2e7ab4][_0x25a803],_0x2e7ab4);}}else{addVertex(_0x25c614,_0xb5e8a9[_0x2e7ab4],_0x2e7ab4);}}}for(var _0xd12a99=0x0;_0xd12a99<_0x1d6d15[_0x76aa('0x29')];_0xd12a99+=0x1){if(_0x1d6d15[_0xd12a99]['source']&&_0x1d6d15[_0xd12a99][_0x76aa('0x2a')]){_0x25c614['addEdge'](_0x1d6d15[_0xd12a99][_0x76aa('0x2b')],_0x1d6d15[_0xd12a99][_0x76aa('0x2a')],_0x1d6d15[_0xd12a99][_0x76aa('0x2c')]);}}return _0x25c614;}function getSquareProject(_0x1e90b9,_0x1eecd9){rpc[_0x76aa('0x2d')](_0x1e90b9)[_0x76aa('0x2e')](function(_0x3827ec){_0x1eecd9(null,_0x3827ec);})[_0x76aa('0x2f')](function(_0x3ea05a){_0x1eecd9(null,_0x3ea05a);});}function createSquareReport(_0x5edcd8,_0x430ad6){rpc[_0x76aa('0x30')](_0x5edcd8)[_0x76aa('0x2e')](function(_0x928ccf){if(_0x430ad6){_0x430ad6(null,_0x928ccf);}})[_0x76aa('0x2f')](function(_0x38ecd1){if(_0x430ad6){_0x430ad6(null,_0x38ecd1);}});}function setChannelVariables(_0x35a705){for(var _0x4eb57a in _0x35a705){if(_0x35a705[_0x76aa('0x23')](_0x4eb57a)){if(_0x4eb57a[_0x76aa('0x31')]('agi_')===0x0){_0x35a705[_0x4eb57a[_0x76aa('0x32')](0x4)]=_0x35a705[_0x4eb57a];delete _0x35a705[_0x4eb57a];}}}}function getLogFromObject(_0x58d860){return util[_0x76aa('0x33')](_0x58d860,{'showHidden':![],'depth':null});}function agiHandler(_0x4c90b6){var _0x8479a3,_0x5653e0,_0x58f135,_0x1aa182,_0x282c56;logger[_0x76aa('0x34')](_0x76aa('0x35'),JSON['stringify'](_0x4c90b6,null,0x2));logger['info'](util[_0x76aa('0x11')](_0x76aa('0x36'),_0x4c90b6[_0x76aa('0x17')],_0x4c90b6[_0x76aa('0x1b')],_0x4c90b6[_0x76aa('0x18')],_0x4c90b6['dnid'],_0x4c90b6[_0x76aa('0x19')]));_0x4c90b6['on']('error',errorHandler);_0x4c90b6['on']('close',closeHandler);_0x4c90b6['on'](_0x76aa('0x37'),timeoutHandler);_0x4c90b6[_0x76aa('0x1e')]=![];_0x4c90b6['on'](_0x76aa('0x38'),hangupHandler);var _0x127bc4=getSquareProject['sync'](null,_0x4c90b6[_0x76aa('0x17')]);if(_0x127bc4){if(_0x127bc4[_0x76aa('0x39')]){_0x8479a3=getRoot(_0x127bc4[_0x76aa('0x39')]);if(_0x8479a3&&_0x8479a3['start']){logger[_0x76aa('0x34')](_0x76aa('0x21'),JSON[_0x76aa('0x3a')](_0x8479a3,null,0x2));_0x4c90b6[_0x76aa('0x3b')]=moment()[_0x76aa('0x11')](_0x76aa('0x3c'));_0x5653e0=initGraph(_[_0x76aa('0x27')](_0x8479a3,_0x76aa('0x3d')),_0x8479a3[_0x76aa('0x3d')]);_0x58f135=new Vertices(_0x4c90b6,rpc,mailRpc);logger['info'](util[_0x76aa('0x11')](_0x76aa('0x3e'),_0x4c90b6[_0x76aa('0x17')],_0x4c90b6[_0x76aa('0x1b')],_0x4c90b6[_0x76aa('0x18')],_0x4c90b6[_0x76aa('0x1c')],_0x4c90b6['uniqueid']));_0x5653e0['traverseBFS'](_0x8479a3[_0x76aa('0x3f')]['id'],function(_0x262906){try{_0x262906=_0x58f135[_0x76aa('0x40')](_0x262906);logger[_0x76aa('0x34')]('vertex',JSON[_0x76aa('0x3a')](_0x262906,null,0x2));if(_0x262906[_0x76aa('0x22')]===_0x76aa('0x41')){logger[_0x76aa('0x10')](_0x76aa('0x42'));_0x4c90b6['context']=_0x262906[_0x76aa('0x43')]||_0x4c90b6['context'];_0x4c90b6[_0x76aa('0x44')]=_0x262906['extension'];_0x4c90b6['priority']=_0x262906['priority']?_0x262906[_0x76aa('0x45')]-0x1:0x1;return null;}else if(_0x262906&&_0x58f135[_0x262906['agicommand']]){_0x282c56=_0x58f135[_0x262906['agicommand']](_0x262906);logger['info'](_0x76aa('0x46'),JSON[_0x76aa('0x3a')](_0x282c56,null,0x2));if(_0x282c56&&_0x282c56[_0x76aa('0x47')]===AGI_CODE_SUCCESS&&_0x282c56[_0x76aa('0x48')]!==AGI_RESULT_ERROR&&!_0x4c90b6[_0x76aa('0x1e')]){logger['debug'](_0x76aa('0x46'),getLogFromObject(_0x282c56));return _[_0x76aa('0x49')](_0x282c56[_0x76aa('0x48')])?null:_0x282c56[_0x76aa('0x48')][_0x76aa('0x4a')]();}else{logger['error'](_0x76aa('0x46'),getLogFromObject(_0x282c56));return null;}}else{logger[_0x76aa('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x2d3441){logger['error'](_0x2d3441[_0x76aa('0x1a')]);return null;}});if(_0x8479a3[_0x76aa('0x4b')]){logger[_0x76aa('0x10')](util[_0x76aa('0x11')](_0x76aa('0x4c'),_0x4c90b6[_0x76aa('0x17')],_0x4c90b6[_0x76aa('0x1b')],_0x4c90b6[_0x76aa('0x18')],_0x4c90b6[_0x76aa('0x1c')],_0x4c90b6[_0x76aa('0x19')]));_0x5653e0['traverseBFS'](_0x8479a3[_0x76aa('0x4b')]['id'],function(_0x4b8f12){try{_0x4b8f12=_0x58f135[_0x76aa('0x40')](_0x4b8f12);logger[_0x76aa('0x34')](_0x76aa('0x4d'),JSON[_0x76aa('0x3a')](_0x4b8f12,null,0x2));if(_0x4b8f12&&_0x58f135[_0x4b8f12['agicommand']]){_0x282c56=_0x58f135[_0x4b8f12['agicommand']](_0x4b8f12);if(_0x282c56){logger[_0x76aa('0x34')]('response',getLogFromObject(_0x282c56));return _[_0x76aa('0x49')](_0x282c56[_0x76aa('0x48')])?null:_0x282c56[_0x76aa('0x48')][_0x76aa('0x4a')]();}else{logger[_0x76aa('0xc')](_0x76aa('0x46'),getLogFromObject(_0x282c56));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x2fcf8f){logger[_0x76aa('0xc')](_0x2fcf8f[_0x76aa('0x1a')]);return null;}});}logger[_0x76aa('0x10')](util[_0x76aa('0x11')](_0x76aa('0x4e'),_0x4c90b6['arg_1'],_0x4c90b6[_0x76aa('0x1b')],_0x4c90b6[_0x76aa('0x18')],_0x4c90b6[_0x76aa('0x1c')],_0x4c90b6['uniqueid']));logger[_0x76aa('0x10')](util['format'](_0x76aa('0x4f'),_0x4c90b6['context'],_0x4c90b6[_0x76aa('0x44')],parseInt(_0x4c90b6[_0x76aa('0x45')],0xa)+0x1));_0x4c90b6[_0x76aa('0x50')](_0x4c90b6[_0x76aa('0x43')],_0x4c90b6[_0x76aa('0x44')],parseInt(_0x4c90b6[_0x76aa('0x45')],0xa)+0x1);_0x4c90b6[_0x76aa('0x51')]();}}else{logger['error'](util[_0x76aa('0x11')]('Project\x20%s\x20not\x20published',_0x4c90b6[_0x76aa('0x17')]));_0x4c90b6[_0x76aa('0x50')](_0x4c90b6[_0x76aa('0x43')],_0x4c90b6[_0x76aa('0x44')],parseInt(_0x4c90b6[_0x76aa('0x45')],0xa)+0x1);_0x4c90b6[_0x76aa('0x51')]();}}else{logger[_0x76aa('0xc')](util['format'](_0x76aa('0x52'),_0x4c90b6[_0x76aa('0x17')]));_0x4c90b6[_0x76aa('0x50')](_0x4c90b6[_0x76aa('0x43')],_0x4c90b6['extension'],parseInt(_0x4c90b6[_0x76aa('0x45')],0xa)+0x1);_0x4c90b6[_0x76aa('0x51')]();}}function main(){var _0x8dc601;return utilLicense[_0x76aa('0x53')]()[_0x76aa('0x2e')](function(_0xf7732){if(_0xf7732){if(_0xf7732['voice']){if(_0xf7732[_0x76aa('0x54')]&&_0xf7732[_0x76aa('0x54')]>0x0){logger[_0x76aa('0x10')](util[_0x76aa('0x11')](_0x76aa('0x55'),_0xf7732[_0x76aa('0x54')]));_0x8dc601=_0xf7732[_0x76aa('0x54')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x76aa('0x10')](_0x76aa('0x56'));_0x8dc601=-0x1;}}})['catch'](function(_0x3d7802){logger[_0x76aa('0xc')]('[LICENSE]',_0x3d7802[_0x76aa('0x1a')]);})[_0x76aa('0x4b')](function(){var _0x1928c2=require(_0x76aa('0x57'))(config[_0x76aa('0x5')][_0x76aa('0xf')],config[_0x76aa('0x5')]['ip'],_0x8dc601);_0x1928c2['on'](_0x76aa('0xc'),errorHandler);_0x1928c2['on'](_0x76aa('0x58'),listeningHandler);_0x1928c2['on']('connection',connectionHandler);_0x1928c2['on'](_0x76aa('0x51'),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 df4c223..9ce59a5 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x23d930,_0x93b264){var _0x1bcba2=function(_0x5013ac){while(--_0x5013ac){_0x23d930['push'](_0x23d930['shift']());}};_0x1bcba2(++_0x93b264);}(_0x34e8,0x12c));var _0x834e=function(_0x27ef4c,_0x403ea9){_0x27ef4c=_0x27ef4c-0x0;var _0x5903c1=_0x34e8[_0x27ef4c];return _0x5903c1;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x3ed0f0,_0xe0b369){var _0x5cacf7=function(_0x46f52a){while(--_0x46f52a){_0x3ed0f0['push'](_0x3ed0f0['shift']());}};_0x5cacf7(++_0xe0b369);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 9c7daac..a0c82cc 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x3ee9b2,_0xa090bb){var _0x51ac3e=function(_0x8ba28d){while(--_0x8ba28d){_0x3ee9b2['push'](_0x3ee9b2['shift']());}};_0x51ac3e(++_0xa090bb);}(_0xb10b,0x12a));var _0xbb10=function(_0x31cdff,_0x545438){_0x31cdff=_0x31cdff-0x0;var _0x14091f=_0xb10b[_0x31cdff];return _0x14091f;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0xb10b,0x12a));var _0xbb10=function(_0xc85513,_0x49e852){_0xc85513=_0xc85513-0x0;var _0x3e70be=_0xb10b[_0xc85513];return _0x3e70be;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 38ac4e2..33d8bd2 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 _0x3014=['getSquareProjectById','ShowSquareProject','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','dsn','getUserById','ShowUser','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','agentLogin','agentPause','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','util','jayson/promise','request','then','error','message','result','getSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','email'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3014,0x1d7));var _0x4301=function(_0x293a2a,_0x587b9e){_0x293a2a=_0x293a2a-0x0;var _0x453a76=_0x3014[_0x293a2a];return _0x453a76;};'use strict';var BPromise=require(_0x4301('0x0'));var moment=require(_0x4301('0x1'));var _=require('lodash');var util=require(_0x4301('0x2'));var jayson=require(_0x4301('0x3'));var client=jayson['client']['http']({'port':0x2329});function request(_0x40c7b5,_0x30c6f9){return new BPromise(function(_0xa74423,_0xbe6c71){return client[_0x4301('0x4')](_0x40c7b5,_0x30c6f9)[_0x4301('0x5')](function(_0x42ac4b){if(_0x42ac4b[_0x4301('0x6')]){return _0xbe6c71(_0x42ac4b[_0x4301('0x6')][_0x4301('0x7')]);}else{return _0xa74423(_0x42ac4b[_0x4301('0x8')]);}})['catch'](function(_0x489c97){return _0xbe6c71(_0x489c97);});});}exports[_0x4301('0x9')]=function(_0x2d6581){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2d6581},'attributes':[_0x4301('0xa')]}});};exports[_0x4301('0xb')]=function(_0x2c9224){return request(_0x4301('0xc'),{'options':{'raw':![],'where':{'id':_0x2c9224},'include':[{'model':'MailServerOut','as':_0x4301('0xd')}],'attributes':['id','name',_0x4301('0xe')]}});};exports[_0x4301('0xf')]=function(_0x10b1c3){return request(_0x4301('0x10'),{'options':{'where':{'id':_0x10b1c3},'attributes':[_0x4301('0x11')]}});};exports[_0x4301('0x12')]=function(_0x2c1af4){return request(_0x4301('0x13'),{'options':{'where':{'id':_0x2c1af4},'attributes':[_0x4301('0x11')]}});};exports[_0x4301('0x14')]=function(_0x3f2d5d){return request(_0x4301('0x15'),{'options':{'where':{'id':_0x3f2d5d},'attributes':[_0x4301('0x11')]}});};exports['getSquareOdbcById']=function(_0x5ee1fb){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5ee1fb},'attributes':[_0x4301('0x16')]}});};exports[_0x4301('0x17')]=function(_0x213c91){return request(_0x4301('0x18'),{'options':{'where':{'id':_0x213c91},'attributes':['name']}});};exports['getTrunkById']=function(_0x2d3281){return request(_0x4301('0x19'),{'options':{'where':{'id':_0x2d3281},'attributes':[_0x4301('0x11')]}});};exports['getSoundById']=function(_0xa1cbea){return request(_0x4301('0x1a'),{'options':{'where':{'id':_0xa1cbea},'attributes':[_0x4301('0x1b')]}});};exports[_0x4301('0x1c')]=function(_0x86d885){return request(_0x4301('0x1d'),{'options':{'raw':![],'where':{'id':_0x86d885},'include':[{'model':'Interval','as':_0x4301('0x1e')}]}});};exports[_0x4301('0x1f')]=function(_0x1e7601){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1e7601},'attributes':['id',_0x4301('0x11')]}});};exports['createSmsMessage']=function(_0x31e9d9){return request(_0x4301('0x20'),{'body':_0x31e9d9});};exports[_0x4301('0x21')]=function(_0x1b3ebf){return request('CreateSquareDetailsReport',{'body':_0x1b3ebf});};exports[_0x4301('0x22')]=function(_0x139a64){return request('CreateSquareReport',{'body':_[_0x4301('0x23')](_0x139a64,{'project_name':_0x139a64['arg_1'],'prev_project_name':_0x139a64[_0x4301('0x24')]||'','is_subproject':_0x139a64[_0x4301('0x24')]?!![]:![],'leaveAt':moment()[_0x4301('0x25')](_0x4301('0x26'))})});};exports[_0x4301('0x27')]=function(_0x11fe82){return request(_0x4301('0x28'),{'body':_0x11fe82});};exports[_0x4301('0x29')]=function(_0x2049d4){return request(_0x4301('0x2a'),{'body':_0x2049d4});};exports[_0x4301('0x2b')]=function(_0x4a60d7){return request(_0x4301('0x2c'),{'options':{'raw':![],'where':{'phone':_0x4a60d7[_0x4301('0x2d')],'ListId':_0x4a60d7[_0x4301('0x2e')]}}})[_0x4301('0x5')](function(_0x50d75d){if(_0x50d75d){return _0x50d75d;}return request(_0x4301('0x2f'),{'body':_0x4a60d7});});};exports[_0x4301('0x30')]=function(_0x28f36a){return request('ShowPause',{'options':{'where':{'id':_0x28f36a},'attributes':[_0x4301('0x11')]}});};exports[_0x4301('0x31')]=function(_0x4cbb69,_0x30b6a9){return request('LoginUser',{'body':{'interface':_0x30b6a9},'options':{'where':_0x4cbb69}});};exports[_0x4301('0x32')]=function(_0x2fc27b,_0x2854fb,_0xebb79b){return request('PauseUser',{'body':{'type':_0x2854fb,'uniqueid':_0xebb79b},'options':{'where':_0x2fc27b}});};exports[_0x4301('0x33')]=function(_0x4ee156){return request(_0x4301('0x34'),{'body':{},'options':{'where':_0x4ee156}});};exports['agentLogout']=function(_0x59960a){return request(_0x4301('0x35'),{'body':{},'options':{'where':_0x59960a}});}; \ No newline at end of file +var _0xbd37=['getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client','http','request','error','message','result','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','ShowTrunk','getSoundById','ShowSound','save_name'];(function(_0x25e754,_0x200eba){var _0x1d991e=function(_0x1601ba){while(--_0x1601ba){_0x25e754['push'](_0x25e754['shift']());}};_0x1d991e(++_0x200eba);}(_0xbd37,0x13a));var _0x7bd3=function(_0x13f0a2,_0x1b3623){_0x13f0a2=_0x13f0a2-0x0;var _0x4cd0b4=_0xbd37[_0x13f0a2];return _0x4cd0b4;};'use strict';var BPromise=require('bluebird');var moment=require(_0x7bd3('0x0'));var _=require(_0x7bd3('0x1'));var util=require(_0x7bd3('0x2'));var jayson=require(_0x7bd3('0x3'));var client=jayson[_0x7bd3('0x4')][_0x7bd3('0x5')]({'port':0x2329});function request(_0x3b0aee,_0x52f67f){return new BPromise(function(_0x2e843c,_0x492437){return client[_0x7bd3('0x6')](_0x3b0aee,_0x52f67f)['then'](function(_0xa8ee64){if(_0xa8ee64[_0x7bd3('0x7')]){return _0x492437(_0xa8ee64['error'][_0x7bd3('0x8')]);}else{return _0x2e843c(_0xa8ee64[_0x7bd3('0x9')]);}})['catch'](function(_0x571cfe){return _0x492437(_0x571cfe);});});}exports[_0x7bd3('0xa')]=function(_0x30b11){return request(_0x7bd3('0xb'),{'options':{'raw':![],'where':{'name':_0x30b11},'attributes':[_0x7bd3('0xc')]}});};exports['getMailAccountById']=function(_0x1cbfcb){return request(_0x7bd3('0xd'),{'options':{'raw':![],'where':{'id':_0x1cbfcb},'include':[{'model':_0x7bd3('0xe'),'as':'Smtp'}],'attributes':['id',_0x7bd3('0xf'),_0x7bd3('0x10')]}});};exports[_0x7bd3('0x11')]=function(_0x28d7cb){return request(_0x7bd3('0xb'),{'options':{'where':{'id':_0x28d7cb},'attributes':[_0x7bd3('0xf')]}});};exports[_0x7bd3('0x12')]=function(_0x1be179){return request(_0x7bd3('0x13'),{'options':{'where':{'id':_0x1be179},'attributes':[_0x7bd3('0xf')]}});};exports[_0x7bd3('0x14')]=function(_0x304e2a){return request('ShowVariable',{'options':{'where':{'id':_0x304e2a},'attributes':['name']}});};exports[_0x7bd3('0x15')]=function(_0x337eb5){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x337eb5},'attributes':[_0x7bd3('0x16')]}});};exports[_0x7bd3('0x17')]=function(_0x3b8424){return request('ShowUser',{'options':{'where':{'id':_0x3b8424},'attributes':[_0x7bd3('0xf')]}});};exports['getTrunkById']=function(_0x1e1bf3){return request(_0x7bd3('0x18'),{'options':{'where':{'id':_0x1e1bf3},'attributes':['name']}});};exports[_0x7bd3('0x19')]=function(_0xe2ad52){return request(_0x7bd3('0x1a'),{'options':{'where':{'id':_0xe2ad52},'attributes':[_0x7bd3('0x1b')]}});};exports[_0x7bd3('0x1c')]=function(_0x8a2e7c){return request(_0x7bd3('0x1d'),{'options':{'raw':![],'where':{'id':_0x8a2e7c},'include':[{'model':_0x7bd3('0x1e'),'as':_0x7bd3('0x1f')}]}});};exports[_0x7bd3('0x20')]=function(_0x1090e1){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1090e1},'attributes':['id',_0x7bd3('0xf')]}});};exports['createSmsMessage']=function(_0x3c0a94){return request(_0x7bd3('0x21'),{'body':_0x3c0a94});};exports['createSquareDetailsReport']=function(_0x188aa5){return request(_0x7bd3('0x22'),{'body':_0x188aa5});};exports[_0x7bd3('0x23')]=function(_0x6be266){return request(_0x7bd3('0x24'),{'body':_[_0x7bd3('0x25')](_0x6be266,{'project_name':_0x6be266[_0x7bd3('0x26')],'prev_project_name':_0x6be266[_0x7bd3('0x27')]||'','is_subproject':_0x6be266[_0x7bd3('0x27')]?!![]:![],'leaveAt':moment()[_0x7bd3('0x28')](_0x7bd3('0x29'))})});};exports[_0x7bd3('0x2a')]=function(_0x35bc71){return request(_0x7bd3('0x2b'),{'body':_0x35bc71});};exports['createSquareMessage']=function(_0x33b6f5){return request(_0x7bd3('0x2c'),{'body':_0x33b6f5});};exports[_0x7bd3('0x2d')]=function(_0x25eddf){return request(_0x7bd3('0x2e'),{'options':{'raw':![],'where':{'phone':_0x25eddf['phone'],'ListId':_0x25eddf[_0x7bd3('0x2f')]}}})['then'](function(_0x1c06ac){if(_0x1c06ac){return _0x1c06ac;}return request(_0x7bd3('0x30'),{'body':_0x25eddf});});};exports[_0x7bd3('0x31')]=function(_0x59a014){return request(_0x7bd3('0x32'),{'options':{'where':{'id':_0x59a014},'attributes':[_0x7bd3('0xf')]}});};exports[_0x7bd3('0x33')]=function(_0x38ca7d,_0x395364){return request('LoginUser',{'body':{'interface':_0x395364},'options':{'where':_0x38ca7d}});};exports[_0x7bd3('0x34')]=function(_0x4a248f,_0x59f847,_0x30cea6){return request(_0x7bd3('0x35'),{'body':{'type':_0x59f847,'uniqueid':_0x30cea6},'options':{'where':_0x4a248f}});};exports['agentUnpause']=function(_0x3df607){return request(_0x7bd3('0x36'),{'body':{},'options':{'where':_0x3df607}});};exports[_0x7bd3('0x37')]=function(_0x5235f7){return request(_0x7bd3('0x38'),{'body':{},'options':{'where':_0x5235f7}});}; \ 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 f2cad3a..a2775f1 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 _0x9a19=['./polly','./lex','exports'];(function(_0x341c54,_0x4819d8){var _0x1271cc=function(_0xc3d12d){while(--_0xc3d12d){_0x341c54['push'](_0x341c54['shift']());}};_0x1271cc(++_0x4819d8);}(_0x9a19,0x114));var _0x99a1=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x9a19[_0x1928c9];return _0x51b5fb;};var polly=require(_0x99a1('0x0'));var lex=require(_0x99a1('0x1'));module[_0x99a1('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf72b=['exports','./polly'];(function(_0x5766ff,_0x1e4b43){var _0x1540ed=function(_0x5a478c){while(--_0x5a478c){_0x5766ff['push'](_0x5766ff['shift']());}};_0x1540ed(++_0x1e4b43);}(_0xf72b,0x1d9));var _0xbf72=function(_0x2a5d06,_0x9af7f8){_0x2a5d06=_0x2a5d06-0x0;var _0x2a6772=_0xf72b[_0x2a5d06];return _0x2a6772;};var polly=require(_0xbf72('0x0'));var lex=require('./lex');module[_0xbf72('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index bcc1b7d..972f7a7 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 _0xa4fb=['./lib/api','exports'];(function(_0x4cb97d,_0x459af4){var _0x1f0100=function(_0x5aef39){while(--_0x5aef39){_0x4cb97d['push'](_0x4cb97d['shift']());}};_0x1f0100(++_0x459af4);}(_0xa4fb,0x150));var _0xba4f=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0xa4fb[_0x5c2a2b];return _0x19921f;};'use strict';var lex=require(_0xba4f('0x0'));module[_0xba4f('0x1')]=function(_0x45a5dc,_0x473226,_0x569bf7,_0x5d2269,_0x4131a6,_0x196e5b){return lex(_0x45a5dc,_0x473226,_0x569bf7,_0x5d2269,_0x4131a6,_0x196e5b);}; \ No newline at end of file +var _0x4d9e=['./lib/api'];(function(_0x42fdc5,_0x4f1881){var _0x3fea4a=function(_0x57b876){while(--_0x57b876){_0x42fdc5['push'](_0x42fdc5['shift']());}};_0x3fea4a(++_0x4f1881);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x3036c9,_0xefe8a7){_0x3036c9=_0x3036c9-0x0;var _0x58121f=_0x4d9e[_0x3036c9];return _0x58121f;};'use strict';var lex=require(_0xe4d9('0x0'));module['exports']=function(_0x4da72e,_0x46e8c2,_0x574c1d,_0x36adac,_0x4d7687,_0x2c6990){return lex(_0x4da72e,_0x46e8c2,_0x574c1d,_0x36adac,_0x4d7687,_0x2c6990);}; \ 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 d72ff9f..f5b291c 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 _0xab02=['slots','hasOwnProperty','slot_','exports','LexRuntime','bluebird','postText'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xab02,0x140));var _0x2ab0=function(_0xcb0df1,_0x509943){_0xcb0df1=_0xcb0df1-0x0;var _0x250f6f=_0xab02[_0xcb0df1];return _0x250f6f;};'use strict';var BPromise=require(_0x2ab0('0x0'));var AWS=require('aws-sdk');function lexResult(_0x3b8552,_0x7dc940){return new BPromise(function(_0x40a5d3,_0x37ee3d){_0x3b8552[_0x2ab0('0x1')](_0x7dc940,function(_0xfc1df1,_0x1c15d0){if(_0xfc1df1){_0x37ee3d(_0xfc1df1);}if(_0x1c15d0[_0x2ab0('0x2')]){for(const _0x315651 in _0x1c15d0[_0x2ab0('0x2')]){if(_0x1c15d0[_0x2ab0('0x2')][_0x2ab0('0x3')](_0x315651)){var _0x2ae779=_0x1c15d0[_0x2ab0('0x2')][_0x315651];_0x1c15d0[_0x2ab0('0x4')+_0x315651]=_0x2ae779;}}}_0x40a5d3(_0x1c15d0);});});}module[_0x2ab0('0x5')]=function(_0x38546e,_0x297eb9,_0x37753e,_0x1344e5,_0x403faa,_0x486792){var _0x4eb37b=new AWS[(_0x2ab0('0x6'))]({'accessKeyId':_0x297eb9,'secretAccessKey':_0x37753e,'region':_0x1344e5});var _0xa11422={'botAlias':'$LATEST','botName':_0x486792,'inputText':_0x403faa,'userId':_0x38546e};return lexResult(_0x4eb37b,_0xa11422);}; \ No newline at end of file +var _0xe1c9=['$LATEST','aws-sdk','postText','slots','slot_','exports'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0xe1c9,0x19f));var _0x9e1c=function(_0x2cc0b3,_0x120bf1){_0x2cc0b3=_0x2cc0b3-0x0;var _0x1667ef=_0xe1c9[_0x2cc0b3];return _0x1667ef;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x9e1c('0x0'));function lexResult(_0x544b7b,_0x58b220){return new BPromise(function(_0x5e46c2,_0x5b3978){_0x544b7b[_0x9e1c('0x1')](_0x58b220,function(_0x2b810c,_0x41979f){if(_0x2b810c){_0x5b3978(_0x2b810c);}if(_0x41979f[_0x9e1c('0x2')]){for(const _0x41231e in _0x41979f[_0x9e1c('0x2')]){if(_0x41979f['slots']['hasOwnProperty'](_0x41231e)){var _0x2de34b=_0x41979f[_0x9e1c('0x2')][_0x41231e];_0x41979f[_0x9e1c('0x3')+_0x41231e]=_0x2de34b;}}}_0x5e46c2(_0x41979f);});});}module[_0x9e1c('0x4')]=function(_0xd58a84,_0x19cc97,_0x226b48,_0x29f6f0,_0x722ef8,_0x5c6e58){var _0x5d4d30=new AWS['LexRuntime']({'accessKeyId':_0x19cc97,'secretAccessKey':_0x226b48,'region':_0x29f6f0});var _0x4f923d={'botAlias':_0x9e1c('0x5'),'botName':_0x5c6e58,'inputText':_0x722ef8,'userId':_0xd58a84};return lexResult(_0x5d4d30,_0x4f923d);}; \ 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 91f2064..5824cb0 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 _0xaa73=['./lib/api','exports'];(function(_0x4291a6,_0x253fe9){var _0x45e983=function(_0x377ff3){while(--_0x377ff3){_0x4291a6['push'](_0x4291a6['shift']());}};_0x45e983(++_0x253fe9);}(_0xaa73,0xda));var _0x3aa7=function(_0x10158d,_0x5893cf){_0x10158d=_0x10158d-0x0;var _0x4eba09=_0xaa73[_0x10158d];return _0x4eba09;};'use strict';var polly=require(_0x3aa7('0x0'));module[_0x3aa7('0x1')]=function(_0x3c41a0,_0x3e39b0,_0x289843,_0x13f063,_0x1986fe,_0x3156cf,_0xa682de){return polly(_0x3c41a0,_0x3e39b0,_0x289843,_0x13f063,_0x1986fe,_0x3156cf,_0xa682de);}; \ No newline at end of file +var _0x4671=['./lib/api','exports'];(function(_0x505abb,_0x2170c6){var _0x3d7804=function(_0x20e639){while(--_0x20e639){_0x505abb['push'](_0x505abb['shift']());}};_0x3d7804(++_0x2170c6);}(_0x4671,0x1c8));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};'use strict';var polly=require(_0x1467('0x0'));module[_0x1467('0x1')]=function(_0xaa458c,_0x43547a,_0x31aa01,_0x99e644,_0xf6729e,_0xda6a08,_0x297174){return polly(_0xaa458c,_0x43547a,_0x31aa01,_0x99e644,_0xf6729e,_0xda6a08,_0x297174);}; \ 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 3dd08b2..50b4080 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 _0xb341=['aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring'];(function(_0x4d98c9,_0x54f529){var _0x572034=function(_0x4eae01){while(--_0x4eae01){_0x4d98c9['push'](_0x4d98c9['shift']());}};_0x572034(++_0x54f529);}(_0xb341,0x19f));var _0x1b34=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb341[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var path=require(_0x1b34('0x0'));var BPromise=require(_0x1b34('0x1'));var rs=require(_0x1b34('0x2'));var AWS=require(_0x1b34('0x3'));function pollyResult(_0x2aa9f3,_0x34155c,_0xb91abc){return new BPromise(function(_0x3e97e9,_0x4a8738){_0x2aa9f3[_0x1b34('0x4')](_0x34155c,function(_0x494e2d,_0x37e4e3){if(_0x494e2d){_0x4a8738(_0x494e2d);}else if(_0x37e4e3){if(_0x37e4e3[_0x1b34('0x5')]instanceof Buffer){fs['writeFile'](_0xb91abc,_0x37e4e3[_0x1b34('0x5')],function(_0x5b066c){if(_0x5b066c){_0x4a8738(_0x5b066c);}else{_0x3e97e9();}});}else{_0x4a8738(new Error(_0x1b34('0x6')));}}else{_0x4a8738(new Error(_0x1b34('0x7')));}});});}module[_0x1b34('0x8')]=function(_0x2a425a,_0x335174,_0x5a673d,_0x1a52fd,_0x92529f,_0x53f6c2,_0x3884b){var _0x5cbd2c=new AWS['Polly']({'accessKeyId':_0x2a425a,'secretAccessKey':_0x335174,'region':_0x5a673d});var _0x2e53b1={'Text':_0x92529f,'TextType':_0x53f6c2||_0x1b34('0x9'),'OutputFormat':_0x1b34('0xa'),'VoiceId':_0x1a52fd};return pollyResult(_0x5cbd2c,_0x2e53b1,_0x3884b);}; \ No newline at end of file +var _0x517b=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x517b,0x130));var _0xb517=function(_0x13a0e7,_0x5d04a1){_0x13a0e7=_0x13a0e7-0x0;var _0x700167=_0x517b[_0x13a0e7];return _0x700167;};'use strict';var fs=require('fs');var path=require(_0xb517('0x0'));var BPromise=require(_0xb517('0x1'));var rs=require('randomstring');var AWS=require(_0xb517('0x2'));function pollyResult(_0x33d47d,_0x2e2ded,_0xf96f30){return new BPromise(function(_0x55afda,_0xcd2e6){_0x33d47d[_0xb517('0x3')](_0x2e2ded,function(_0x4402b7,_0x2bf416){if(_0x4402b7){_0xcd2e6(_0x4402b7);}else if(_0x2bf416){if(_0x2bf416[_0xb517('0x4')]instanceof Buffer){fs[_0xb517('0x5')](_0xf96f30,_0x2bf416[_0xb517('0x4')],function(_0x21d463){if(_0x21d463){_0xcd2e6(_0x21d463);}else{_0x55afda();}});}else{_0xcd2e6(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xcd2e6(new Error(_0xb517('0x6')));}});});}module[_0xb517('0x7')]=function(_0x3f07c4,_0x11e9c2,_0x12e253,_0x1245af,_0x1119ff,_0x5b0e5b,_0x410d73){var _0x2e5fd5=new AWS[(_0xb517('0x8'))]({'accessKeyId':_0x3f07c4,'secretAccessKey':_0x11e9c2,'region':_0x12e253});var _0x571b10={'Text':_0x1119ff,'TextType':_0x5b0e5b||'text','OutputFormat':_0xb517('0x9'),'VoiceId':_0x1245af};return pollyResult(_0x2e5fd5,_0x571b10,_0x410d73);}; \ 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 45c658a..a79b91d 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 _0x730d=['./lib/api'];(function(_0x40bc1f,_0x26b8a1){var _0x193002=function(_0x3051ce){while(--_0x3051ce){_0x40bc1f['push'](_0x40bc1f['shift']());}};_0x193002(++_0x26b8a1);}(_0x730d,0x1cc));var _0xd730=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x730d[_0x1e7b16];return _0x37fadc;};'use strict';var asr=require(_0xd730('0x0'));module['exports']=function(_0x40ed5f,_0x499ee6,_0x20e325,_0x5c9dea){return asr(_0x40ed5f,_0x499ee6,_0x20e325);}; \ No newline at end of file +var _0x15ac=['./lib/api'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x15ac,0x14c));var _0xc15a=function(_0x52f4c7,_0x30801e){_0x52f4c7=_0x52f4c7-0x0;var _0x5dc69f=_0x15ac[_0x52f4c7];return _0x5dc69f;};'use strict';var asr=require(_0xc15a('0x0'));module['exports']=function(_0x383b8d,_0x4c7bc5,_0x5d966e,_0x2103ff){return asr(_0x383b8d,_0x4c7bc5,_0x5d966e);}; \ 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 39df8d9..64ce044 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 _0x1130=['8000','url','https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x2cfe6f,_0x4477f1){var _0x1d11ec=function(_0x1db839){while(--_0x1db839){_0x2cfe6f['push'](_0x2cfe6f['shift']());}};_0x1d11ec(++_0x4477f1);}(_0x1130,0x85));var _0x0113=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1130[_0x2dafbe];return _0x58a45a;};'use strict';var url=require(_0x0113('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x0113('0x1');module['exports']=function(_0xa502bd,_0x29300a,_0x2a6731){return new BPromise(function(_0x5e12cf,_0x4e0f37){var _0x2ebec5;if(typeof _0xa502bd!=='string'||_0xa502bd[_0x0113('0x2')]===0x0){return _0x4e0f37(_0x0113('0x3'));}if(typeof _0x29300a!=='string'||_0x29300a[_0x0113('0x2')]===0x0){return _0x4e0f37(_0x0113('0x4'));}if(typeof _0x2a6731!=='undefined'&&(typeof _0x2a6731!=='string'||_0x2a6731['length']===0x0)){return _0x4e0f37('lang\x20should\x20be\x20a\x20string');}try{_0x2ebec5=fs[_0x0113('0x5')](_0xa502bd)['toString'](_0x0113('0x6'));}catch(_0x2ed7fa){return _0x4e0f37(_0x2ed7fa);}return _0x5e12cf({'method':_0x0113('0x7'),'uri':host+_0x0113('0x8')+_0x29300a,'body':{'config':{'encoding':_0x0113('0x9'),'sampleRateHertz':_0x0113('0xa'),'languageCode':_0x2a6731},'audio':{'content':_0x2ebec5}},'json':!![]});});}; \ No newline at end of file +var _0x906f=['readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length'];(function(_0x318de8,_0x1a8055){var _0x4a5bfa=function(_0x3e5515){while(--_0x3e5515){_0x318de8['push'](_0x318de8['shift']());}};_0x4a5bfa(++_0x1a8055);}(_0x906f,0x1e2));var _0xf906=function(_0x14a3d7,_0x12fb98){_0x14a3d7=_0x14a3d7-0x0;var _0x357ea3=_0x906f[_0x14a3d7];return _0x357ea3;};'use strict';var url=require(_0xf906('0x0'));var BPromise=require(_0xf906('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf906('0x2')]=function(_0x5223bd,_0x4345f5,_0x320e79){return new BPromise(function(_0x5840ed,_0x50e75b){var _0x162ccb;if(typeof _0x5223bd!==_0xf906('0x3')||_0x5223bd['length']===0x0){return _0x50e75b(_0xf906('0x4'));}if(typeof _0x4345f5!==_0xf906('0x3')||_0x4345f5['length']===0x0){return _0x50e75b(_0xf906('0x5'));}if(typeof _0x320e79!==_0xf906('0x6')&&(typeof _0x320e79!==_0xf906('0x3')||_0x320e79[_0xf906('0x7')]===0x0)){return _0x50e75b('lang\x20should\x20be\x20a\x20string');}try{_0x162ccb=fs[_0xf906('0x8')](_0x5223bd)['toString'](_0xf906('0x9'));}catch(_0x251c48){return _0x50e75b(_0x251c48);}return _0x5840ed({'method':_0xf906('0xa'),'uri':host+_0xf906('0xb')+_0x4345f5,'body':{'config':{'encoding':_0xf906('0xc'),'sampleRateHertz':_0xf906('0xd'),'languageCode':_0x320e79},'audio':{'content':_0x162ccb}},'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 48e09cb..4a7ff09 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 _0x7269=['./asr','exports'];(function(_0x59e150,_0x160e37){var _0xbb94e1=function(_0x23c193){while(--_0x23c193){_0x59e150['push'](_0x59e150['shift']());}};_0xbb94e1(++_0x160e37);}(_0x7269,0x76));var _0x9726=function(_0x3b99f1,_0x36fddf){_0x3b99f1=_0x3b99f1-0x0;var _0x28a87a=_0x7269[_0x3b99f1];return _0x28a87a;};var asr=require(_0x9726('0x0'));module[_0x9726('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa051=['exports','./asr'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xa051,0x189));var _0x1a05=function(_0x2fb37b,_0x5c1a95){_0x2fb37b=_0x2fb37b-0x0;var _0x4d5040=_0xa051[_0x2fb37b];return _0x4d5040;};var asr=require(_0x1a05('0x0'));module[_0x1a05('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 1ee2d61..c5d1d46 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 _0xc788=['awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','path','http','url','parse','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','./google','./aws','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','get','error','request\x20to\x20','statusCode','statusMessage','finish','finish\x20download\x20file','download\x20error','pipe','end','WHAT_EVER','\x20failed,\x20status\x20code\x20=\x20','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','writeFileSync','base64','then','unlink','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','tmp','generate','.mp3','from','writeFile','777','googleCloudTTS\x20path','googleTTS','info','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','stringify','source','result','action','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence'];(function(_0x5735fc,_0x113502){var _0xf4b84=function(_0x2cc901){while(--_0x2cc901){_0x5735fc['push'](_0x5735fc['shift']());}};_0xf4b84(++_0x113502);}(_0xc788,0x82));var _0x8c78=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0xc788[_0x631a3c];return _0x2bdfa3;};'use strict';var fs=require('fs');var path=require(_0x8c78('0x0'));var http=require(_0x8c78('0x1'));var https=require('https');var urlParse=require(_0x8c78('0x2'))[_0x8c78('0x3')];var BPromise=require('bluebird');var rs=require(_0x8c78('0x4'));var sox=require(_0x8c78('0x5'));var rp=require(_0x8c78('0x6'));var util=require(_0x8c78('0x7'));var querystring=require(_0x8c78('0x8'));var tts=require(_0x8c78('0x9'));var apiai=require(_0x8c78('0xa'));var md5=require('md5');var google=require(_0x8c78('0xb'));var aws=require(_0x8c78('0xc'));var tilde=require('./tilde');var sestek=require(_0x8c78('0xd'));var logger=require(_0x8c78('0xe'))('agi');var ISPEECH_API=_0x8c78('0xf');function downloadFile(_0x521f4a,_0x48af94){return new BPromise(function(_0x11aa8e,_0x442cdc){var _0x2d7994=urlParse(_0x521f4a);var _0x4061f2=_0x2d7994[_0x8c78('0x10')]===_0x8c78('0x11')?https:http;var _0x48f55e={'host':_0x2d7994[_0x8c78('0x12')],'path':_0x2d7994['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4061f2[_0x8c78('0x13')](_0x48f55e,function(_0xb34a81){if(_0xb34a81['statusCode']!==0xc8){logger[_0x8c78('0x14')](_0x8c78('0x15')+_0x521f4a+'\x20failed,\x20status\x20code\x20=\x20'+_0xb34a81[_0x8c78('0x16')]+'\x20('+_0xb34a81['statusMessage']+')');_0x442cdc(new Error(_0x8c78('0x15')+_0x521f4a+'\x20failed,\x20status\x20code\x20=\x20'+_0xb34a81[_0x8c78('0x16')]+'\x20('+_0xb34a81[_0x8c78('0x17')]+')'));return;}var _0x54370c=fs['createWriteStream'](_0x48af94);_0x54370c['on'](_0x8c78('0x18'),function(){logger['info'](_0x8c78('0x19'));_0x54370c['close'](_0x11aa8e);});_0x54370c['on'](_0x8c78('0x14'),function(_0x47ab01){fs['unlink'](_0x48af94);logger[_0x8c78('0x14')](_0x8c78('0x1a'),_0x47ab01);_0x442cdc(_0x47ab01);});_0xb34a81[_0x8c78('0x1b')](_0x54370c);})['on'](_0x8c78('0x14'),function(_0x375bea){logger[_0x8c78('0x14')](_0x375bea);_0x442cdc(_0x375bea);})[_0x8c78('0x1c')]();});}function uploadFile(_0x575b42){return new BPromise(function(_0x1b8448,_0x807275){var _0xd85e8d=urlParse(_0x575b42);var _0x565cd2=_0xd85e8d[_0x8c78('0x10')]===_0x8c78('0x11')?https:http;var _0x7c184c={'host':_0xd85e8d[_0x8c78('0x12')],'path':_0xd85e8d[_0x8c78('0x0')],'headers':{'user-agent':_0x8c78('0x1d')}};_0x565cd2[_0x8c78('0x13')](_0x7c184c,function(_0xb02058){if(_0xb02058[_0x8c78('0x16')]!==0xc8){_0x807275(new Error(_0x8c78('0x15')+_0x575b42+_0x8c78('0x1e')+_0xb02058[_0x8c78('0x16')]+'\x20('+_0xb02058['statusMessage']+')'));return;}var _0x5363cd='';_0xb02058['on']('data',function(_0x439d55){_0x5363cd+=_0x439d55;});_0xb02058['on'](_0x8c78('0x1c'),function(){_0x1b8448(_0x5363cd);});})['on']('error',function(_0x4d4196){_0x807275(_0x4d4196);})[_0x8c78('0x1c')]();});}function convertFile(_0x2cbdfe,_0x1b2ec3){return new BPromise(function(_0x282bcf,_0x14c2d0){var _0x2cffb5=sox[_0x8c78('0x1f')](_0x2cbdfe,_0x1b2ec3,{'sampleRate':0x1f40,'format':_0x8c78('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2cffb5['on'](_0x8c78('0x14'),function(_0x3e2d44){logger[_0x8c78('0x14')](_0x8c78('0x21'),_0x3e2d44);_0x14c2d0(_0x3e2d44);});_0x2cffb5['on']('end',function(){logger['info'](_0x8c78('0x22'));_0x282bcf();});_0x2cffb5[_0x8c78('0x23')]();});}function base64Decode(_0x2282e4,_0x3a8384){var _0x264b82=path[_0x8c78('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x8c78('0x25'));fs[_0x8c78('0x26')](_0x264b82,_0x2282e4,_0x8c78('0x27'));return convertFile(_0x264b82,_0x3a8384)[_0x8c78('0x28')](function(){try{fs[_0x8c78('0x29')](_0x264b82);fs[_0x8c78('0x2a')](_0x3a8384,'777');}catch(_0x18609f){logger['error'](_0x18609f);}return _0x3a8384[_0x8c78('0x2b')]('.')[0x0];});}function base64Encode(_0x5fa360){var _0x17d318=fs[_0x8c78('0x2c')](_0x5fa360);return new Buffer(_0x17d318)[_0x8c78('0x2d')](_0x8c78('0x27'));}exports[_0x8c78('0x2e')]=function(_0xc1731,_0x5ad1d1,_0x3078a9,_0x491e4b,_0xdcff99,_0x581b3d){var _0x1924b0,_0x2449c9;var _0x14012c=_0x8c78('0x2f');var _0x1f2b0d=_0x8c78('0x30')+_0xc1731;var _0x336373={};if(_0x5ad1d1===_0x8c78('0x31')){_0x336373[_0x8c78('0x32')]={'ssml':_0x3078a9};}else{_0x336373[_0x8c78('0x32')]={'text':_0x3078a9};};_0x336373[_0x8c78('0x33')]={'languageCode':_0x491e4b,'ssmlGender':_0xdcff99};_0x336373[_0x8c78('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0xd49755={'url':_0x14012c+_0x8c78('0x35')+_0x1f2b0d,'method':'POST','json':!![],'body':_0x336373};return rp(_0xd49755)[_0x8c78('0x28')](function(_0x37302d){return new BPromise(function(_0xdf6b45,_0x437f59){_0x1924b0=path[_0x8c78('0x24')](__dirname,_0x8c78('0x36'),rs[_0x8c78('0x37')](0x4)+_0x8c78('0x38'));var _0x40c9d9=Buffer[_0x8c78('0x39')](_0x37302d['audioContent'],_0x8c78('0x27'));return fs[_0x8c78('0x3a')](_0x1924b0,_0x40c9d9,function(_0x5dfb99){_0x437f59(_0x5dfb99);},function(_0x4855cc){fs[_0x8c78('0x2a')](_0x1924b0,'777');_0xdf6b45(_0x4855cc);});});})['then'](function(_0x1f03d3){_0x2449c9=path[_0x8c78('0x24')](__dirname,_0x8c78('0x36'),rs[_0x8c78('0x37')](0x4)+'.wav');return convertFile(_0x1924b0,_0x2449c9);})[_0x8c78('0x28')](function(){try{fs[_0x8c78('0x29')](_0x1924b0);fs[_0x8c78('0x2a')](_0x2449c9,_0x8c78('0x3b'));}catch(_0x260c1a){logger[_0x8c78('0x14')](_0x260c1a);}logger['info'](_0x8c78('0x3c'),_0x2449c9[_0x8c78('0x2b')]('.')[0x0]);return _0x2449c9[_0x8c78('0x2b')]('.')[0x0];});};exports[_0x8c78('0x3d')]=function(_0x54ca9f,_0x51bb1d){var _0x56df38,_0x238127;return tts(_0x54ca9f,_0x51bb1d||'en',0x1)['then'](function(_0x37c01d){logger[_0x8c78('0x3e')](_0x37c01d);_0x56df38=path[_0x8c78('0x24')](__dirname,_0x8c78('0x36'),rs['generate'](0x4)+'.mp3');return downloadFile(_0x37c01d,_0x56df38);})['then'](function(){_0x238127=path['resolve'](__dirname,_0x8c78('0x36'),rs[_0x8c78('0x37')](0x4)+_0x8c78('0x25'));return convertFile(_0x56df38,_0x238127);})[_0x8c78('0x28')](function(){try{fs[_0x8c78('0x29')](_0x56df38);fs[_0x8c78('0x2a')](_0x238127,_0x8c78('0x3b'));}catch(_0xd55719){logger[_0x8c78('0x14')](_0xd55719);}logger['info'](_0x8c78('0x3f'),_0x238127['split']('.')[0x0]);return _0x238127[_0x8c78('0x2b')]('.')[0x0];});};exports[_0x8c78('0x40')]=function(_0x131549,_0x338d05,_0x11cec1){return google[_0x8c78('0x41')](_0x131549,_0x338d05,_0x11cec1)[_0x8c78('0x28')](function(_0x731343){logger[_0x8c78('0x3e')](_0x731343[_0x8c78('0x42')]);return rp(_0x731343);})[_0x8c78('0x28')](function(_0x27224f){var _0x1b496f='';var _0x58e0ff=0x0;try{fs[_0x8c78('0x29')](_0x131549);}catch(_0x4c631a){logger[_0x8c78('0x14')](_0x4c631a);}if(_0x27224f&&_0x27224f[_0x8c78('0x43')]){_0x1b496f=_0x27224f[_0x8c78('0x43')][_0x8c78('0x44')](function(_0x9e3033){return _0x9e3033&&_0x9e3033[_0x8c78('0x45')][0x0]&&_0x9e3033[_0x8c78('0x45')][0x0][_0x8c78('0x46')]?_0x9e3033[_0x8c78('0x45')][0x0][_0x8c78('0x46')]:'';})[_0x8c78('0x47')]('\x0a');_0x58e0ff=_0x27224f[_0x8c78('0x43')][_0x8c78('0x44')](function(_0x413741){return _0x413741&&_0x413741['alternatives'][0x0]&&_0x413741[_0x8c78('0x45')][0x0][_0x8c78('0x48')]?_0x413741['alternatives'][0x0][_0x8c78('0x48')]:0x0;})[_0x8c78('0x47')]('\x0a');}logger[_0x8c78('0x3e')](_0x8c78('0x49'),_0x1b496f);logger['info'](_0x8c78('0x4a'),_0x58e0ff);return{'transcript':_0x1b496f,'confidence':_0x58e0ff};})['catch'](function(_0x468972){logger['error'](_0x8c78('0x4b'),_0x468972['statusCode'],_0x468972[_0x8c78('0x4c')],_0x468972[_0x8c78('0x4d')]);});};exports['googleDialogflow']=function(_0x4cd689,_0x5596dd,_0x239417,_0x24004e){var _0x2d57e0=apiai(_0x5596dd,{'language':_0x24004e||'en'});return _0x2d57e0[_0x8c78('0x4e')](_0x239417,{'sessionId':md5(_0x4cd689)})[_0x8c78('0x28')](function(_0x384acd){logger[_0x8c78('0x3e')](JSON[_0x8c78('0x4f')](_0x384acd));return{'source':_0x384acd['result'][_0x8c78('0x50')],'resolvedQuery':_0x384acd['result']['resolvedQuery'],'action':_0x384acd[_0x8c78('0x51')][_0x8c78('0x52')],'actionIncomplete':_0x384acd[_0x8c78('0x51')]['actionIncomplete'],'speech':_0x384acd[_0x8c78('0x51')][_0x8c78('0x53')][_0x8c78('0x54')],'score':_0x384acd['result'][_0x8c78('0x55')],'statusCode':_0x384acd[_0x8c78('0x56')][_0x8c78('0x57')],'endConversation':_0x384acd[_0x8c78('0x51')][_0x8c78('0x58')][_0x8c78('0x59')]||![],'isFallbackIntent':_0x384acd[_0x8c78('0x51')][_0x8c78('0x58')][_0x8c78('0x5a')]};});};exports[_0x8c78('0x5b')]=function(_0x43fc85,_0x23641e,_0x36e6b0,_0x25ff39){return tilde[_0x8c78('0x41')](_0x43fc85,_0x23641e,_0x36e6b0,_0x25ff39)[_0x8c78('0x28')](function(_0x33d849){try{fs[_0x8c78('0x29')](_0x43fc85);}catch(_0x48d224){logger[_0x8c78('0x14')](_0x48d224);}logger['info'](_0x8c78('0x5c'),_0x33d849[_0x8c78('0x46')]);logger['info'](_0x8c78('0x5d'),_0x33d849[_0x8c78('0x48')]);return _0x33d849;});};exports[_0x8c78('0x5e')]=function(_0x2542e2,_0x70303c,_0x8beb74,_0x2d168a,_0x12edf1,_0x1a8708){var _0x158abf=path[_0x8c78('0x24')](__dirname,_0x8c78('0x36'),rs['generate'](0x4)+'.mp3');var _0x16f40f;return aws[_0x8c78('0x5f')](_0x2542e2,_0x70303c,_0x8beb74,_0x2d168a,_0x12edf1,_0x1a8708,_0x158abf)[_0x8c78('0x28')](function(){_0x16f40f=path[_0x8c78('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x8c78('0x25'));return convertFile(_0x158abf,_0x16f40f);})['then'](function(){try{fs[_0x8c78('0x29')](_0x158abf);fs[_0x8c78('0x2a')](_0x16f40f,_0x8c78('0x3b'));}catch(_0x1a97f0){logger[_0x8c78('0x14')](_0x1a97f0);}return _0x16f40f[_0x8c78('0x2b')]('.')[0x0];});};exports[_0x8c78('0x60')]=function(_0x638d48,_0x3890fd,_0xcc2966,_0x1d62d2,_0x2f8a35,_0x2367b5){return aws[_0x8c78('0x61')](_0x638d48,_0x3890fd,_0xcc2966,_0x1d62d2,_0x2f8a35,_0x2367b5)[_0x8c78('0x28')](function(_0x47fe9c){logger[_0x8c78('0x3e')](JSON[_0x8c78('0x4f')](_0x47fe9c));return _0x47fe9c;});};exports[_0x8c78('0x62')]=function(_0x584073,_0x1b464e,_0x2d04b6,_0x535d3e){var _0x5dd285=util[_0x8c78('0x63')](_0x8c78('0x64'),ISPEECH_API,_0x584073,encodeURIComponent(_0x1b464e),_0x2d04b6,_0x535d3e);var _0x2aa2a5=path[_0x8c78('0x24')](__dirname,_0x8c78('0x36'),rs[_0x8c78('0x37')](0x4)+'.mp3');var _0x412d43;return downloadFile(_0x5dd285,_0x2aa2a5)[_0x8c78('0x28')](function(){_0x412d43=path[_0x8c78('0x24')](__dirname,_0x8c78('0x36'),rs[_0x8c78('0x37')](0x4)+_0x8c78('0x25'));return convertFile(_0x2aa2a5,_0x412d43);})['then'](function(){try{fs[_0x8c78('0x29')](_0x2aa2a5);fs['chmodSync'](_0x412d43,_0x8c78('0x3b'));}catch(_0x56f30b){logger[_0x8c78('0x14')](_0x56f30b);}return _0x412d43[_0x8c78('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x10a8ac,_0x53c7e1,_0x48e630,_0x15c66e){var _0x1d13d8=util[_0x8c78('0x63')](_0x8c78('0x65'),ISPEECH_API,_0x53c7e1,_0x48e630,base64Encode(_0x10a8ac),_0x15c66e?util[_0x8c78('0x63')](_0x8c78('0x66'),encodeURIComponent(_0x15c66e)):_0x8c78('0x67'));return uploadFile(_0x1d13d8)['then'](function(_0x3537b7){return querystring[_0x8c78('0x3')](_0x3537b7);});};exports['sestekNDA']=function(_0x103cf9,_0x4311af){return sestek[_0x8c78('0x68')](_0x103cf9,_0x4311af)[_0x8c78('0x28')](function(_0xcc41ad){logger[_0x8c78('0x3e')](JSON[_0x8c78('0x4f')](_0xcc41ad));var _0x514708={'speech':_0xcc41ad[_0x8c78('0x69')],'action':_0xcc41ad[_0x8c78('0x6a')]?_0xcc41ad[_0x8c78('0x6a')][_0x8c78('0x6b')]:undefined,'actiondata':_0xcc41ad[_0x8c78('0x6a')]?_0xcc41ad['channelData'][_0x8c78('0x6c')]:undefined};if(_0xcc41ad['channelData']&&_0xcc41ad[_0x8c78('0x6a')]['AudioFromTts']){return base64Decode(_0xcc41ad[_0x8c78('0x6a')][_0x8c78('0x6d')][_0x8c78('0x6e')],path[_0x8c78('0x24')](__dirname,_0x8c78('0x36'),rs[_0x8c78('0x37')](0x4)+'.wav'))[_0x8c78('0x28')](function(_0x1088a3){_0x514708[_0x8c78('0x6f')]=_0x1088a3;return _0x514708;});}return _0x514708;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xab71=['chmodSync','777','split','googleCloudTTS','?key=','ssml','input','MP3','POST','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','stringify','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','AudioFromTts','audiofile','dirName','path','https','url','parse','bluebird','randomstring','sox','request-promise','util','querystring','google-tts-api','md5','./aws','./tilde','./sestek','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then'];(function(_0x4aebe7,_0xf4ed63){var _0x1182c4=function(_0x30958c){while(--_0x30958c){_0x4aebe7['push'](_0x4aebe7['shift']());}};_0x1182c4(++_0xf4ed63);}(_0xab71,0x17d));var _0x1ab7=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0xab71[_0x23ca4d];return _0x435432;};'use strict';var fs=require('fs');var path=require(_0x1ab7('0x0'));var http=require('http');var https=require(_0x1ab7('0x1'));var urlParse=require(_0x1ab7('0x2'))[_0x1ab7('0x3')];var BPromise=require(_0x1ab7('0x4'));var rs=require(_0x1ab7('0x5'));var sox=require(_0x1ab7('0x6'));var rp=require(_0x1ab7('0x7'));var util=require(_0x1ab7('0x8'));var querystring=require(_0x1ab7('0x9'));var tts=require(_0x1ab7('0xa'));var apiai=require('apiai-promise');var md5=require(_0x1ab7('0xb'));var google=require('./google');var aws=require(_0x1ab7('0xc'));var tilde=require(_0x1ab7('0xd'));var sestek=require(_0x1ab7('0xe'));var logger=require(_0x1ab7('0xf'))(_0x1ab7('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x35e4d9,_0x30e470){return new BPromise(function(_0xb20a6a,_0x5712b5){var _0x1b57a3=urlParse(_0x35e4d9);var _0x84048b=_0x1b57a3[_0x1ab7('0x11')]===_0x1ab7('0x12')?https:http;var _0x4d0f1b={'host':_0x1b57a3[_0x1ab7('0x13')],'path':_0x1b57a3['path'],'headers':{'user-agent':_0x1ab7('0x14')}};_0x84048b[_0x1ab7('0x15')](_0x4d0f1b,function(_0x49f0f2){if(_0x49f0f2[_0x1ab7('0x16')]!==0xc8){logger[_0x1ab7('0x17')](_0x1ab7('0x18')+_0x35e4d9+_0x1ab7('0x19')+_0x49f0f2[_0x1ab7('0x16')]+'\x20('+_0x49f0f2[_0x1ab7('0x1a')]+')');_0x5712b5(new Error(_0x1ab7('0x18')+_0x35e4d9+'\x20failed,\x20status\x20code\x20=\x20'+_0x49f0f2['statusCode']+'\x20('+_0x49f0f2[_0x1ab7('0x1a')]+')'));return;}var _0x218a4f=fs[_0x1ab7('0x1b')](_0x30e470);_0x218a4f['on'](_0x1ab7('0x1c'),function(){logger[_0x1ab7('0x1d')](_0x1ab7('0x1e'));_0x218a4f[_0x1ab7('0x1f')](_0xb20a6a);});_0x218a4f['on']('error',function(_0x427304){fs[_0x1ab7('0x20')](_0x30e470);logger[_0x1ab7('0x17')](_0x1ab7('0x21'),_0x427304);_0x5712b5(_0x427304);});_0x49f0f2[_0x1ab7('0x22')](_0x218a4f);})['on']('error',function(_0x5d7e34){logger[_0x1ab7('0x17')](_0x5d7e34);_0x5712b5(_0x5d7e34);})[_0x1ab7('0x23')]();});}function uploadFile(_0x4d0040){return new BPromise(function(_0x5a9f8f,_0x15c973){var _0xa3e881=urlParse(_0x4d0040);var _0x381c5a=_0xa3e881[_0x1ab7('0x11')]===_0x1ab7('0x12')?https:http;var _0x4e947b={'host':_0xa3e881[_0x1ab7('0x13')],'path':_0xa3e881[_0x1ab7('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x381c5a[_0x1ab7('0x15')](_0x4e947b,function(_0x49f618){if(_0x49f618['statusCode']!==0xc8){_0x15c973(new Error(_0x1ab7('0x18')+_0x4d0040+_0x1ab7('0x19')+_0x49f618[_0x1ab7('0x16')]+'\x20('+_0x49f618['statusMessage']+')'));return;}var _0x523505='';_0x49f618['on'](_0x1ab7('0x24'),function(_0x3458c7){_0x523505+=_0x3458c7;});_0x49f618['on'](_0x1ab7('0x23'),function(){_0x5a9f8f(_0x523505);});})['on'](_0x1ab7('0x17'),function(_0x1c4bc5){_0x15c973(_0x1c4bc5);})['end']();});}function convertFile(_0x11afd8,_0x80003c){return new BPromise(function(_0x4e6126,_0x2b7528){var _0x1ff7a3=sox[_0x1ab7('0x25')](_0x11afd8,_0x80003c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ff7a3['on'](_0x1ab7('0x17'),function(_0xc6ee8c){logger[_0x1ab7('0x17')](_0x1ab7('0x26'),_0xc6ee8c);_0x2b7528(_0xc6ee8c);});_0x1ff7a3['on'](_0x1ab7('0x23'),function(){logger[_0x1ab7('0x1d')]('finish\x20to\x20convert');_0x4e6126();});_0x1ff7a3[_0x1ab7('0x27')]();});}function base64Decode(_0x289298,_0x45cc0c){var _0x31e088=path[_0x1ab7('0x28')](__dirname,_0x1ab7('0x29'),rs[_0x1ab7('0x2a')](0x4)+_0x1ab7('0x2b'));fs[_0x1ab7('0x2c')](_0x31e088,_0x289298,_0x1ab7('0x2d'));return convertFile(_0x31e088,_0x45cc0c)[_0x1ab7('0x2e')](function(){try{fs[_0x1ab7('0x20')](_0x31e088);fs[_0x1ab7('0x2f')](_0x45cc0c,_0x1ab7('0x30'));}catch(_0x3c738f){logger[_0x1ab7('0x17')](_0x3c738f);}return _0x45cc0c[_0x1ab7('0x31')]('.')[0x0];});}function base64Encode(_0x16cfbc){var _0x141c57=fs['readFileSync'](_0x16cfbc);return new Buffer(_0x141c57)['toString'](_0x1ab7('0x2d'));}exports[_0x1ab7('0x32')]=function(_0x109978,_0x5d8dc0,_0x2fc761,_0x53ac30,_0x7c265c,_0x7ad447){var _0x2fd551,_0x3def32;var _0x16ade5='https://texttospeech.googleapis.com/v1/';var _0x51b7ed=_0x1ab7('0x33')+_0x109978;var _0x21c01f={};if(_0x5d8dc0===_0x1ab7('0x34')){_0x21c01f[_0x1ab7('0x35')]={'ssml':_0x2fc761};}else{_0x21c01f[_0x1ab7('0x35')]={'text':_0x2fc761};};_0x21c01f['voice']={'languageCode':_0x53ac30,'ssmlGender':_0x7c265c};_0x21c01f['audioConfig']={'audioEncoding':_0x1ab7('0x36'),'sampleRateHertz':0x1f40};var _0x343efc={'url':_0x16ade5+'text:synthesize'+_0x51b7ed,'method':_0x1ab7('0x37'),'json':!![],'body':_0x21c01f};return rp(_0x343efc)[_0x1ab7('0x2e')](function(_0xc6b00){return new BPromise(function(_0x4d177e,_0x395e5b){_0x2fd551=path[_0x1ab7('0x28')](__dirname,_0x1ab7('0x29'),rs[_0x1ab7('0x2a')](0x4)+_0x1ab7('0x38'));var _0x3ef6ae=Buffer[_0x1ab7('0x39')](_0xc6b00[_0x1ab7('0x3a')],_0x1ab7('0x2d'));return fs['writeFile'](_0x2fd551,_0x3ef6ae,function(_0x355d5f){_0x395e5b(_0x355d5f);},function(_0xdcae4){fs[_0x1ab7('0x2f')](_0x2fd551,'777');_0x4d177e(_0xdcae4);});});})[_0x1ab7('0x2e')](function(_0x3818db){_0x3def32=path[_0x1ab7('0x28')](__dirname,_0x1ab7('0x29'),rs['generate'](0x4)+_0x1ab7('0x2b'));return convertFile(_0x2fd551,_0x3def32);})['then'](function(){try{fs[_0x1ab7('0x20')](_0x2fd551);fs['chmodSync'](_0x3def32,'777');}catch(_0x54abfb){logger[_0x1ab7('0x17')](_0x54abfb);}logger[_0x1ab7('0x1d')](_0x1ab7('0x3b'),_0x3def32[_0x1ab7('0x31')]('.')[0x0]);return _0x3def32[_0x1ab7('0x31')]('.')[0x0];});};exports[_0x1ab7('0x3c')]=function(_0x298723,_0x2daf8f){var _0x6fcf99,_0x4a82fe;return tts(_0x298723,_0x2daf8f||'en',0x1)[_0x1ab7('0x2e')](function(_0x34f53e){logger[_0x1ab7('0x1d')](_0x34f53e);_0x6fcf99=path[_0x1ab7('0x28')](__dirname,_0x1ab7('0x29'),rs[_0x1ab7('0x2a')](0x4)+'.mp3');return downloadFile(_0x34f53e,_0x6fcf99);})[_0x1ab7('0x2e')](function(){_0x4a82fe=path[_0x1ab7('0x28')](__dirname,_0x1ab7('0x29'),rs[_0x1ab7('0x2a')](0x4)+_0x1ab7('0x2b'));return convertFile(_0x6fcf99,_0x4a82fe);})[_0x1ab7('0x2e')](function(){try{fs[_0x1ab7('0x20')](_0x6fcf99);fs[_0x1ab7('0x2f')](_0x4a82fe,_0x1ab7('0x30'));}catch(_0x2dfab9){logger[_0x1ab7('0x17')](_0x2dfab9);}logger[_0x1ab7('0x1d')]('goggleTTS\x20path',_0x4a82fe[_0x1ab7('0x31')]('.')[0x0]);return _0x4a82fe[_0x1ab7('0x31')]('.')[0x0];});};exports[_0x1ab7('0x3d')]=function(_0x3fe9b0,_0x5bb903,_0x5ce372){return google[_0x1ab7('0x3e')](_0x3fe9b0,_0x5bb903,_0x5ce372)[_0x1ab7('0x2e')](function(_0x5d0ddb){logger[_0x1ab7('0x1d')](_0x5d0ddb[_0x1ab7('0x3f')]);return rp(_0x5d0ddb);})[_0x1ab7('0x2e')](function(_0x191b22){var _0x45c288='';var _0x5325ca=0x0;try{fs[_0x1ab7('0x20')](_0x3fe9b0);}catch(_0x2325ff){logger[_0x1ab7('0x17')](_0x2325ff);}if(_0x191b22&&_0x191b22[_0x1ab7('0x40')]){_0x45c288=_0x191b22[_0x1ab7('0x40')][_0x1ab7('0x41')](function(_0xad67d7){return _0xad67d7&&_0xad67d7[_0x1ab7('0x42')][0x0]&&_0xad67d7[_0x1ab7('0x42')][0x0][_0x1ab7('0x43')]?_0xad67d7[_0x1ab7('0x42')][0x0][_0x1ab7('0x43')]:'';})[_0x1ab7('0x44')]('\x0a');_0x5325ca=_0x191b22['results'][_0x1ab7('0x41')](function(_0x44fa85){return _0x44fa85&&_0x44fa85[_0x1ab7('0x42')][0x0]&&_0x44fa85['alternatives'][0x0][_0x1ab7('0x45')]?_0x44fa85[_0x1ab7('0x42')][0x0]['confidence']:0x0;})[_0x1ab7('0x44')]('\x0a');}logger[_0x1ab7('0x1d')](_0x1ab7('0x46'),_0x45c288);logger[_0x1ab7('0x1d')](_0x1ab7('0x47'),_0x5325ca);return{'transcript':_0x45c288,'confidence':_0x5325ca};})['catch'](function(_0x598fee){logger[_0x1ab7('0x17')](_0x1ab7('0x48'),_0x598fee[_0x1ab7('0x16')],_0x598fee[_0x1ab7('0x49')],_0x598fee[_0x1ab7('0x4a')]);});};exports['googleDialogflow']=function(_0x51bf68,_0x4c0d42,_0x43ae0e,_0x428f92){var _0x5b999b=apiai(_0x4c0d42,{'language':_0x428f92||'en'});return _0x5b999b[_0x1ab7('0x4b')](_0x43ae0e,{'sessionId':md5(_0x51bf68)})[_0x1ab7('0x2e')](function(_0xd5b361){logger[_0x1ab7('0x1d')](JSON['stringify'](_0xd5b361));return{'source':_0xd5b361[_0x1ab7('0x4c')]['source'],'resolvedQuery':_0xd5b361['result'][_0x1ab7('0x4d')],'action':_0xd5b361[_0x1ab7('0x4c')][_0x1ab7('0x4e')],'actionIncomplete':_0xd5b361['result'][_0x1ab7('0x4f')],'speech':_0xd5b361['result'][_0x1ab7('0x50')][_0x1ab7('0x51')],'score':_0xd5b361[_0x1ab7('0x4c')][_0x1ab7('0x52')],'statusCode':_0xd5b361[_0x1ab7('0x53')][_0x1ab7('0x54')],'endConversation':_0xd5b361[_0x1ab7('0x4c')][_0x1ab7('0x55')][_0x1ab7('0x56')]||![],'isFallbackIntent':_0xd5b361[_0x1ab7('0x4c')][_0x1ab7('0x55')][_0x1ab7('0x57')]};});};exports['tildeASR']=function(_0xeb6f0e,_0x59f51e,_0x580e4e,_0x2ff7a8){return tilde['asr'](_0xeb6f0e,_0x59f51e,_0x580e4e,_0x2ff7a8)['then'](function(_0x9888cd){try{fs[_0x1ab7('0x20')](_0xeb6f0e);}catch(_0x1cc369){logger[_0x1ab7('0x17')](_0x1cc369);}logger[_0x1ab7('0x1d')](_0x1ab7('0x58'),_0x9888cd[_0x1ab7('0x43')]);logger[_0x1ab7('0x1d')]('Tilde\x20ASR\x20confidence',_0x9888cd[_0x1ab7('0x45')]);return _0x9888cd;});};exports[_0x1ab7('0x59')]=function(_0x3641a7,_0x23b26c,_0x313874,_0x39e204,_0x2ed239,_0x40a73c){var _0x3b20aa=path['resolve'](__dirname,'tmp',rs[_0x1ab7('0x2a')](0x4)+'.mp3');var _0x1c167a;return aws[_0x1ab7('0x5a')](_0x3641a7,_0x23b26c,_0x313874,_0x39e204,_0x2ed239,_0x40a73c,_0x3b20aa)[_0x1ab7('0x2e')](function(){_0x1c167a=path['resolve'](__dirname,_0x1ab7('0x29'),rs[_0x1ab7('0x2a')](0x4)+'.wav');return convertFile(_0x3b20aa,_0x1c167a);})['then'](function(){try{fs[_0x1ab7('0x20')](_0x3b20aa);fs[_0x1ab7('0x2f')](_0x1c167a,_0x1ab7('0x30'));}catch(_0xef8a10){logger['error'](_0xef8a10);}return _0x1c167a[_0x1ab7('0x31')]('.')[0x0];});};exports[_0x1ab7('0x5b')]=function(_0x2b67d5,_0x22dc31,_0x5f3d03,_0x27701a,_0x506901,_0x5cc98d){return aws['lex'](_0x2b67d5,_0x22dc31,_0x5f3d03,_0x27701a,_0x506901,_0x5cc98d)['then'](function(_0x22c3e9){logger[_0x1ab7('0x1d')](JSON[_0x1ab7('0x5c')](_0x22c3e9));return _0x22c3e9;});};exports[_0x1ab7('0x5d')]=function(_0x1e1267,_0x20ff68,_0x83f3e6,_0x4d6a67){var _0x2d7609=util[_0x1ab7('0x5e')](_0x1ab7('0x5f'),ISPEECH_API,_0x1e1267,encodeURIComponent(_0x20ff68),_0x83f3e6,_0x4d6a67);var _0x390feb=path[_0x1ab7('0x28')](__dirname,_0x1ab7('0x29'),rs[_0x1ab7('0x2a')](0x4)+_0x1ab7('0x38'));var _0x4a95f1;return downloadFile(_0x2d7609,_0x390feb)['then'](function(){_0x4a95f1=path[_0x1ab7('0x28')](__dirname,_0x1ab7('0x29'),rs[_0x1ab7('0x2a')](0x4)+'.wav');return convertFile(_0x390feb,_0x4a95f1);})[_0x1ab7('0x2e')](function(){try{fs['unlink'](_0x390feb);fs[_0x1ab7('0x2f')](_0x4a95f1,_0x1ab7('0x30'));}catch(_0x4b8533){logger[_0x1ab7('0x17')](_0x4b8533);}return _0x4a95f1[_0x1ab7('0x31')]('.')[0x0];});};exports[_0x1ab7('0x60')]=function(_0x36cbfe,_0x2e4974,_0x910ac6,_0x180db3){var _0x43abc2=util[_0x1ab7('0x5e')](_0x1ab7('0x61'),ISPEECH_API,_0x2e4974,_0x910ac6,base64Encode(_0x36cbfe),_0x180db3?util[_0x1ab7('0x5e')](_0x1ab7('0x62'),encodeURIComponent(_0x180db3)):_0x1ab7('0x63'));return uploadFile(_0x43abc2)['then'](function(_0x368a48){return querystring[_0x1ab7('0x3')](_0x368a48);});};exports[_0x1ab7('0x64')]=function(_0x12eb23,_0x12456f){return sestek[_0x1ab7('0x65')](_0x12eb23,_0x12456f)[_0x1ab7('0x2e')](function(_0x117446){logger[_0x1ab7('0x1d')](JSON[_0x1ab7('0x5c')](_0x117446));var _0x245eb8={'speech':_0x117446[_0x1ab7('0x66')],'action':_0x117446[_0x1ab7('0x67')]?_0x117446[_0x1ab7('0x67')]['CustomAction']:undefined,'actiondata':_0x117446[_0x1ab7('0x67')]?_0x117446[_0x1ab7('0x67')]['CustomActionData']:undefined};if(_0x117446[_0x1ab7('0x67')]&&_0x117446[_0x1ab7('0x67')][_0x1ab7('0x68')]){return base64Decode(_0x117446['channelData'][_0x1ab7('0x68')]['Data'],path[_0x1ab7('0x28')](__dirname,_0x1ab7('0x29'),rs[_0x1ab7('0x2a')](0x4)+_0x1ab7('0x2b')))[_0x1ab7('0x2e')](function(_0x264b95){_0x245eb8[_0x1ab7('0x69')]=_0x264b95;return _0x245eb8;});}return _0x245eb8;});};exports[_0x1ab7('0x6a')]=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 d940e75..b00b03d 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 _0x7853=['exports','./nda'];(function(_0x4ade33,_0x103537){var _0x162cc1=function(_0x1c52ab){while(--_0x1c52ab){_0x4ade33['push'](_0x4ade33['shift']());}};_0x162cc1(++_0x103537);}(_0x7853,0xe7));var _0x3785=function(_0x1237a9,_0x153831){_0x1237a9=_0x1237a9-0x0;var _0x580bb6=_0x7853[_0x1237a9];return _0x580bb6;};var nda=require(_0x3785('0x0'));module[_0x3785('0x1')]={'nda':nda}; \ No newline at end of file +var _0xfd94=['./nda'];(function(_0x368cfb,_0x571855){var _0x27e714=function(_0x142d64){while(--_0x142d64){_0x368cfb['push'](_0x368cfb['shift']());}};_0x27e714(++_0x571855);}(_0xfd94,0x69));var _0x4fd9=function(_0xcd45b6,_0x54d0f9){_0xcd45b6=_0xcd45b6-0x0;var _0x31aee6=_0xfd94[_0xcd45b6];return _0x31aee6;};var nda=require(_0x4fd9('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index a00892e..b514103 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 _0x7912=['CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','POST','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x155ba4,_0x26f1f0){var _0xe750d0=function(_0x14a56b){while(--_0x14a56b){_0x155ba4['push'](_0x155ba4['shift']());}};_0xe750d0(++_0x26f1f0);}(_0x7912,0xdf));var _0x2791=function(_0x3cf080,_0x5e475f){_0x3cf080=_0x3cf080-0x0;var _0x1fac5f=_0x7912[_0x3cf080];return _0x1fac5f;};'use strict';var rp=require(_0x2791('0x0'));var url=require(_0x2791('0x1'));var logger=require(_0x2791('0x2'))('agi');module['exports']=function(_0x111e9b,_0x117682){var _0x5612ed={'method':_0x2791('0x3'),'uri':url['resolve'](_0x117682[_0x2791('0x4')],_0x2791('0x5')),'form':{'grant_type':_0x2791('0x6'),'username':_0x117682[_0x2791('0x7')],'password':_0x117682[_0x2791('0x6')]},'json':!![]};return rp(_0x5612ed)[_0x2791('0x8')](function(_0x30830d){var _0x4d5263={'method':_0x2791('0x3'),'uri':url['resolve'](_0x117682[_0x2791('0x9')],_0x2791('0xa')),'body':{'type':_0x117682['ndaactivity_type']||_0x2791('0xb'),'channelId':'Nda','conversation':{'id':_0x111e9b[_0x2791('0xc')]},'from':{'id':_0x111e9b[_0x2791('0xd')],'name':_0x111e9b[_0x2791('0xe')]},'recipient':{'id':_0x111e9b['dnid'],'name':_0x111e9b[_0x2791('0xf')]},'text':_0x117682[_0x2791('0x10')],'channelData':{}},'headers':{'Authorization':_0x2791('0x11')+_0x30830d[_0x2791('0x12')]},'json':!![]};if(_0x117682[_0x2791('0x13')]){_0x4d5263[_0x2791('0x14')][_0x2791('0x15')][_0x2791('0x16')]=_0x117682['project'];}if(_0x117682[_0x2791('0x17')]=='1'){_0x4d5263['body'][_0x2791('0x15')][_0x2791('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x117682['custom_action']){_0x4d5263['body'][_0x2791('0x15')][_0x2791('0x19')]=_0x117682[_0x2791('0x1a')];if(_0x117682[_0x2791('0x1b')]){_0x4d5263['body'][_0x2791('0x15')][_0x2791('0x1c')]=_0x117682[_0x2791('0x1b')];}}logger[_0x2791('0x1d')](JSON[_0x2791('0x1e')](_0x4d5263));return rp(_0x4d5263);});}; \ No newline at end of file +var _0xb44e=['extension','Bearer\x20','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','dnid'];(function(_0xef4fc0,_0x33cc41){var _0x57dade=function(_0xe75b3e){while(--_0xe75b3e){_0xef4fc0['push'](_0xef4fc0['shift']());}};_0x57dade(++_0x33cc41);}(_0xb44e,0x85));var _0xeb44=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0xb44e[_0x1a72b8];return _0x39f72d;};'use strict';var rp=require(_0xeb44('0x0'));var url=require(_0xeb44('0x1'));var logger=require(_0xeb44('0x2'))('agi');module['exports']=function(_0x1e8aa5,_0x105033){var _0x161927={'method':'POST','uri':url[_0xeb44('0x3')](_0x105033[_0xeb44('0x4')],_0xeb44('0x5')),'form':{'grant_type':_0xeb44('0x6'),'username':_0x105033[_0xeb44('0x7')],'password':_0x105033[_0xeb44('0x6')]},'json':!![]};return rp(_0x161927)[_0xeb44('0x8')](function(_0x196220){var _0x3f4568={'method':_0xeb44('0x9'),'uri':url['resolve'](_0x105033[_0xeb44('0xa')],_0xeb44('0xb')),'body':{'type':_0x105033[_0xeb44('0xc')]||_0xeb44('0xd'),'channelId':_0xeb44('0xe'),'conversation':{'id':_0x1e8aa5[_0xeb44('0xf')]},'from':{'id':_0x1e8aa5['callerid'],'name':_0x1e8aa5['calleridname']},'recipient':{'id':_0x1e8aa5[_0xeb44('0x10')],'name':_0x1e8aa5[_0xeb44('0x11')]},'text':_0x105033['text'],'channelData':{}},'headers':{'Authorization':_0xeb44('0x12')+_0x196220['access_token']},'json':!![]};if(_0x105033['project']){_0x3f4568[_0xeb44('0x13')]['channelData'][_0xeb44('0x14')]=_0x105033['project'];}if(_0x105033[_0xeb44('0x15')]=='1'){_0x3f4568['body'][_0xeb44('0x16')][_0xeb44('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xeb44('0x18')};}if(_0x105033['custom_action']){_0x3f4568[_0xeb44('0x13')][_0xeb44('0x16')][_0xeb44('0x19')]=_0x105033[_0xeb44('0x1a')];if(_0x105033[_0xeb44('0x1b')]){_0x3f4568[_0xeb44('0x13')][_0xeb44('0x16')][_0xeb44('0x1c')]=_0x105033[_0xeb44('0x1b')];}}logger['info'](JSON[_0xeb44('0x1d')](_0x3f4568));return rp(_0x3f4568);});}; \ 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 fbea787..8011f2f 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 _0x9f1a=['./lib/api'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x9f1a,0x15c));var _0xa9f1=function(_0xbb5f57,_0x1aa034){_0xbb5f57=_0xbb5f57-0x0;var _0x30c74a=_0x9f1a[_0xbb5f57];return _0x30c74a;};'use strict';var asr=require(_0xa9f1('0x0'));module['exports']=function(_0xc21e25,_0x2c32d2,_0x178666,_0x1d4cf0){return asr(_0xc21e25,_0x2c32d2,_0x178666,_0x1d4cf0);}; \ No newline at end of file +var _0x2c84=['exports'];(function(_0xdc3ad9,_0x2e1613){var _0x3be308=function(_0x370529){while(--_0x370529){_0xdc3ad9['push'](_0xdc3ad9['shift']());}};_0x3be308(++_0x2e1613);}(_0x2c84,0xb6));var _0x42c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2c84[_0x1facfa];return _0x9ec701;};'use strict';var asr=require('./lib/api');module[_0x42c8('0x0')]=function(_0x38f62e,_0x5f2dda,_0x58c172,_0x2a89ed){return asr(_0x38f62e,_0x5f2dda,_0x58c172,_0x2a89ed);}; \ 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 b05d50d..76980af 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 _0xdb6b=['open','message','bluebird','lodash','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','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.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x1bc39f,_0x1a307c){var _0x587271=function(_0x307ced){while(--_0x307ced){_0x1bc39f['push'](_0x1bc39f['shift']());}};_0x587271(++_0x1a307c);}(_0xdb6b,0x80));var _0xbdb6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb6b[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xbdb6('0x0'));var _=require(_0xbdb6('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xbdb6('0x2'));var logger=require('../../../../../../config/logger')(_0xbdb6('0x3'));module[_0xbdb6('0x4')]=function(_0x17888a,_0x160d52,_0x44b888,_0x928441){return new BPromise(function(_0x30b5cb,_0x838e7c){logger[_0xbdb6('0x5')](_0xbdb6('0x6'),_0x928441||_0xbdb6('0x7'));var _0x572c94=new WebSocket(_0x928441||_0xbdb6('0x7'),{'perMessageDeflate':![]});var _0x46ca26='';var _0x204925='0';var _0x2f2575='1';var _0x10dd18='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x479504(_0x176576){var _0x18c9fb=crypto[_0xbdb6('0x8')](_0xbdb6('0x9'));_0x18c9fb[_0xbdb6('0xa')](_0x176576);return _0x18c9fb[_0xbdb6('0xb')](_0xbdb6('0xc'));}function _0x13e428(){try{logger[_0xbdb6('0x5')](_0xbdb6('0xd'));var _0x37c9e7=moment()[_0xbdb6('0xe')]();var _0x3a66e9=_0x479504(_0x37c9e7+_0x160d52+_0x44b888);_0x572c94[_0xbdb6('0xf')](JSON[_0xbdb6('0x10')]({'appID':_0x160d52,'timestamp':_0x37c9e7,'appKey':_0x3a66e9}));var _0x39b383=fs[_0xbdb6('0x11')](_0x17888a);_0x39b383['on'](_0xbdb6('0x12'),function(_0x40f8f0){_0x572c94[_0xbdb6('0xf')](_0x40f8f0);});_0x39b383['on'](_0xbdb6('0x13'),function(){_0x572c94[_0xbdb6('0xf')](_0xbdb6('0x14'));});}catch(_0x34ea67){logger[_0xbdb6('0x15')](_0xbdb6('0x16'),JSON[_0xbdb6('0x10')](_0x34ea67));_0x572c94[_0xbdb6('0x17')]();}}function _0x3bfae6(_0x3e671b){try{if(_0x3e671b){var _0x522d34=JSON['parse'](_0x3e671b);switch(_0x522d34['status']){case 0x0:if(_0x522d34[_0xbdb6('0x18')]){if(_0x522d34[_0xbdb6('0x18')][_0xbdb6('0x19')]){logger['info'](_0xbdb6('0x1a'),JSON[_0xbdb6('0x10')](_0x522d34[_0xbdb6('0x18')]['hypotheses']));_0x46ca26=_0x522d34[_0xbdb6('0x18')][_0xbdb6('0x1b')][0x0][_0xbdb6('0x1c')];_0x204925=_0x522d34[_0xbdb6('0x18')][_0xbdb6('0x1b')][0x0][_0xbdb6('0x1d')];_0x2f2575='0';_0x10dd18=_0xbdb6('0x1e');_0x572c94[_0xbdb6('0x17')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2f2575='1';_0x10dd18=_0xbdb6('0x1f');break;case 0x2:logger[_0xbdb6('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2f2575='2';_0x10dd18=_0xbdb6('0x20');break;case 0x9:logger['info'](_0xbdb6('0x21'));_0x2f2575='9';_0x10dd18=_0xbdb6('0x21');break;case 0xa:logger[_0xbdb6('0x5')](_0xbdb6('0x22'));_0x2f2575='10';_0x10dd18='Authentication\x20failed.';break;case 0xb:logger[_0xbdb6('0x5')](_0xbdb6('0x23'));_0x2f2575='11';_0x10dd18=_0xbdb6('0x23');}}}catch(_0x531045){logger[_0xbdb6('0x15')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xbdb6('0x10')](_0x531045));_0x572c94[_0xbdb6('0x17')]();}}function _0x33ef07(){logger['info'](_0xbdb6('0x24'));_0x30b5cb({'transcript':_0x46ca26,'confidence':_0x204925,'status':_0x2f2575,'status_message':_0x10dd18});}function _0x3b7b64(_0x48ae43){logger[_0xbdb6('0x15')](_0xbdb6('0x25'));if(!_[_0xbdb6('0x26')](_0x48ae43)){logger['error'](_[_0xbdb6('0x27')](_0x48ae43)?JSON[_0xbdb6('0x10')](_0x48ae43):_0x48ae43);}}_0x572c94['on'](_0xbdb6('0x28'),_0x13e428);_0x572c94['on'](_0xbdb6('0x29'),_0x3bfae6);_0x572c94['on'](_0xbdb6('0x13'),_0x33ef07);_0x572c94['on'](_0xbdb6('0x15'),_0x3b7b64);});}; \ No newline at end of file +var _0x4d53=['Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS'];(function(_0x3aba98,_0x192ed7){var _0x4ea900=function(_0xae40a1){while(--_0xae40a1){_0x3aba98['push'](_0x3aba98['shift']());}};_0x4ea900(++_0x192ed7);}(_0x4d53,0x115));var _0x34d5=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x4d53[_0x1e7b16];return _0x37fadc;};'use strict';var BPromise=require('bluebird');var _=require(_0x34d5('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x34d5('0x1'));var crypto=require(_0x34d5('0x2'));var logger=require(_0x34d5('0x3'))(_0x34d5('0x4'));module['exports']=function(_0x432d6f,_0x4fb8f7,_0x8eda5a,_0x1ba05e){return new BPromise(function(_0x126271,_0x3464ab){logger[_0x34d5('0x5')](_0x34d5('0x6'),_0x1ba05e||_0x34d5('0x7'));var _0x24df5c=new WebSocket(_0x1ba05e||_0x34d5('0x7'),{'perMessageDeflate':![]});var _0x56c782='';var _0x59b6af='0';var _0x40511b='1';var _0x19912a=_0x34d5('0x8');function _0x162cad(_0x440f4b){var _0x19078a=crypto[_0x34d5('0x9')]('sha1');_0x19078a[_0x34d5('0xa')](_0x440f4b);return _0x19078a[_0x34d5('0xb')]('hex');}function _0x2fd01d(){try{logger[_0x34d5('0x5')](_0x34d5('0xc'));var _0x15cbe9=moment()[_0x34d5('0xd')]();var _0x232ad8=_0x162cad(_0x15cbe9+_0x4fb8f7+_0x8eda5a);_0x24df5c[_0x34d5('0xe')](JSON[_0x34d5('0xf')]({'appID':_0x4fb8f7,'timestamp':_0x15cbe9,'appKey':_0x232ad8}));var _0x40c999=fs[_0x34d5('0x10')](_0x432d6f);_0x40c999['on']('data',function(_0x2a933a){_0x24df5c[_0x34d5('0xe')](_0x2a933a);});_0x40c999['on'](_0x34d5('0x11'),function(){_0x24df5c[_0x34d5('0xe')](_0x34d5('0x12'));});}catch(_0x36a27f){logger['error'](_0x34d5('0x13'),JSON['stringify'](_0x36a27f));_0x24df5c[_0x34d5('0x14')]();}}function _0x65744f(_0x72ed12){try{if(_0x72ed12){var _0x5d6f8c=JSON[_0x34d5('0x15')](_0x72ed12);switch(_0x5d6f8c[_0x34d5('0x16')]){case 0x0:if(_0x5d6f8c[_0x34d5('0x17')]){if(_0x5d6f8c['result']['final']){logger[_0x34d5('0x5')](_0x34d5('0x18'),JSON[_0x34d5('0xf')](_0x5d6f8c['result']['hypotheses']));_0x56c782=_0x5d6f8c['result']['hypotheses'][0x0][_0x34d5('0x19')];_0x59b6af=_0x5d6f8c[_0x34d5('0x17')]['hypotheses'][0x0][_0x34d5('0x1a')];_0x40511b='0';_0x19912a='Success.';_0x24df5c[_0x34d5('0x14')]();}}break;case 0x1:logger[_0x34d5('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x40511b='1';_0x19912a=_0x34d5('0x8');break;case 0x2:logger['info'](_0x34d5('0x1b'));_0x40511b='2';_0x19912a=_0x34d5('0x1b');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x40511b='9';_0x19912a=_0x34d5('0x1c');break;case 0xa:logger[_0x34d5('0x5')]('Authentication\x20failed.');_0x40511b='10';_0x19912a='Authentication\x20failed.';break;case 0xb:logger[_0x34d5('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x40511b='11';_0x19912a='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x3d2e4e){logger['error'](_0x34d5('0x1d'),JSON[_0x34d5('0xf')](_0x3d2e4e));_0x24df5c['terminate']();}}function _0x53bc1e(){logger['info'](_0x34d5('0x1e'));_0x126271({'transcript':_0x56c782,'confidence':_0x59b6af,'status':_0x40511b,'status_message':_0x19912a});}function _0x23889f(_0x85ada6){logger[_0x34d5('0x1f')](_0x34d5('0x20'));if(!_[_0x34d5('0x21')](_0x85ada6)){logger[_0x34d5('0x1f')](_[_0x34d5('0x22')](_0x85ada6)?JSON[_0x34d5('0xf')](_0x85ada6):_0x85ada6);}}_0x24df5c['on'](_0x34d5('0x23'),_0x2fd01d);_0x24df5c['on'](_0x34d5('0x24'),_0x65744f);_0x24df5c['on'](_0x34d5('0x11'),_0x53bc1e);_0x24df5c['on'](_0x34d5('0x1f'),_0x23889f);});}; \ 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 f78be3a..4c348ad 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 _0x24ba=['./asr'];(function(_0x3f134d,_0xa14a9){var _0x10733b=function(_0x27434e){while(--_0x27434e){_0x3f134d['push'](_0x3f134d['shift']());}};_0x10733b(++_0xa14a9);}(_0x24ba,0xa1));var _0xa24b=function(_0x5a47ac,_0x128140){_0x5a47ac=_0x5a47ac-0x0;var _0x99111f=_0x24ba[_0x5a47ac];return _0x99111f;};var asr=require(_0xa24b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xa82a=['exports','./asr'];(function(_0x46f267,_0x4ccb5d){var _0x58e5ca=function(_0x3c9c0a){while(--_0x3c9c0a){_0x46f267['push'](_0x46f267['shift']());}};_0x58e5ca(++_0x4ccb5d);}(_0xa82a,0xeb));var _0xaa82=function(_0x524ced,_0x4acc7a){_0x524ced=_0x524ced-0x0;var _0xd6b8c2=_0xa82a[_0x524ced];return _0xd6b8c2;};var asr=require(_0xaa82('0x0'));module[_0xaa82('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8e9009f..53539a6 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 _0xf00e=['./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','error','E_AGI_SERVER_MAXCONNECTION','destroy','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','events','EventEmitter','./error'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xf00e,0x12f));var _0xef00=function(_0x1fdd33,_0x580a84){_0x1fdd33=_0x1fdd33-0x0;var _0x30c0d8=_0xf00e[_0x1fdd33];return _0x30c0d8;};'use strict';var util=require(_0xef00('0x0'));var net=require(_0xef00('0x1'));var EventEmitter=require(_0xef00('0x2'))[_0xef00('0x3')];var AGIError=require(_0xef00('0x4'));var AGIChannel=require(_0xef00('0x5'));var AGIServer=function(_0x1861da,_0x7c47c7,_0x21260a){var _0x4261ea=this,_0x1861da=_0x1861da||0x11dd,_0x7c47c7=_0x7c47c7||_0xef00('0x6'),_0x397c39=null,_0x3e91d1=0x0;EventEmitter[_0xef00('0x7')](_0x4261ea);function _0x2245a3(){if(!_0x1861da){_0x4261ea[_0xef00('0x8')]('error',new AGIError(_0xef00('0x9')));return![];}_0x397c39=net['createServer']();_0x397c39['listen'](_0x1861da,_0x7c47c7);_0x397c39['on'](_0xef00('0xa'),function(){_0x4261ea['emit']('listening');});_0x397c39['on'](_0xef00('0xb'),function(_0x506a38){_0x397c39[_0xef00('0xc')](function(_0x3a7b21,_0x5dba5b){if(_0x3a7b21){_0x4261ea['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x3a7b21));}else if(_0x21260a&&_0x21260a<0x0){_0x4261ea[_0xef00('0x8')]('error',new AGIError(_0xef00('0xd')));_0x506a38['destroy']();}else if(_0x21260a&&_0x21260a>0x0&&_0x21260a<_0x5dba5b){_0x3e91d1+=0x1;_0x4261ea[_0xef00('0x8')](_0xef00('0xe'),new AGIError(_0xef00('0xf'),_0x3e91d1));_0x506a38[_0xef00('0x10')]();}else{var _0x216963=new AGIChannel(_0x506a38);_0x216963['on']('ready',function(){_0x4261ea[_0xef00('0x8')](_0xef00('0xb'),_0x216963);});}});});_0x397c39['on']('error',function(_0x21257e){_0x4261ea[_0xef00('0x8')](_0xef00('0xe'),new AGIError(_0xef00('0x11'),_0x21257e['code']));});_0x397c39['on'](_0xef00('0x12'),function(){_0x4261ea[_0xef00('0x8')]('close',new AGIError(_0xef00('0x13')));});}process[_0xef00('0x14')](function(){_0x2245a3();});};util[_0xef00('0x15')](AGIServer,EventEmitter);module['exports']=function(_0x5d66dd,_0x59fbdf,_0x1b059c){return new AGIServer(_0x5d66dd,_0x59fbdf,_0x1b059c);}; \ No newline at end of file +var _0xb43b=['./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','close','E_AGI_SERVER_CLOSE','inherits','util','net','EventEmitter'];(function(_0x1ac4a2,_0x56c635){var _0x138e73=function(_0x5cfaa5){while(--_0x5cfaa5){_0x1ac4a2['push'](_0x1ac4a2['shift']());}};_0x138e73(++_0x56c635);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1f2858,_0xf3b313){_0x1f2858=_0x1f2858-0x0;var _0x4419f3=_0xb43b[_0x1f2858];return _0x4419f3;};'use strict';var util=require(_0xbb43('0x0'));var net=require(_0xbb43('0x1'));var EventEmitter=require('events')[_0xbb43('0x2')];var AGIError=require(_0xbb43('0x3'));var AGIChannel=require(_0xbb43('0x4'));var AGIServer=function(_0x4cf605,_0x131e9e,_0x41aff6){var _0x351254=this,_0x4cf605=_0x4cf605||0x11dd,_0x131e9e=_0x131e9e||'127.0.0.1',_0x491fb9=null,_0x378df5=0x0;EventEmitter[_0xbb43('0x5')](_0x351254);function _0x1ccd49(){if(!_0x4cf605){_0x351254[_0xbb43('0x6')](_0xbb43('0x7'),new AGIError(_0xbb43('0x8')));return![];}_0x491fb9=net['createServer']();_0x491fb9[_0xbb43('0x9')](_0x4cf605,_0x131e9e);_0x491fb9['on'](_0xbb43('0xa'),function(){_0x351254['emit'](_0xbb43('0xa'));});_0x491fb9['on'](_0xbb43('0xb'),function(_0xd37cdf){_0x491fb9[_0xbb43('0xc')](function(_0xfac791,_0x2bef86){if(_0xfac791){_0x351254['emit'](_0xbb43('0x7'),new AGIError(_0xbb43('0xd'),_0xfac791));}else if(_0x41aff6&&_0x41aff6<0x0){_0x351254['emit']('error',new AGIError(_0xbb43('0xe')));_0xd37cdf['destroy']();}else if(_0x41aff6&&_0x41aff6>0x0&&_0x41aff6<_0x2bef86){_0x378df5+=0x1;_0x351254['emit'](_0xbb43('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x378df5));_0xd37cdf[_0xbb43('0xf')]();}else{var _0x43021d=new AGIChannel(_0xd37cdf);_0x43021d['on']('ready',function(){_0x351254['emit']('connection',_0x43021d);});}});});_0x491fb9['on'](_0xbb43('0x7'),function(_0x2abce0){_0x351254['emit']('error',new AGIError(_0xbb43('0xd'),_0x2abce0['code']));});_0x491fb9['on']('close',function(){_0x351254[_0xbb43('0x6')](_0xbb43('0x10'),new AGIError(_0xbb43('0x11')));});}process['nextTick'](function(){_0x1ccd49();});};util[_0xbb43('0x12')](AGIServer,EventEmitter);module['exports']=function(_0x3bb57d,_0x8e6429,_0x4dfc54){return new AGIServer(_0x3bb57d,_0x8e6429,_0x4dfc54);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index efedc89..8b93282 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 _0x9bde=['dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','audiofile','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','bot','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','operation','math\x20%s','isArray','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','maxRetry','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','sayphonetic','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','shellCommand','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','prototype','getVariable','rpc','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','%s.%s','split','length','replaceAll','getAndSetVariable','result','extra','setVariable','isConfigured','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','delay','add','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set'];(function(_0x142588,_0x7431e6){var _0x22ef2d=function(_0x1361ea){while(--_0x1361ea){_0x142588['push'](_0x142588['shift']());}};_0x22ef2d(++_0x7431e6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3ca147,_0x5c1daa){_0x3ca147=_0x3ca147-0x0;var _0x8c18c7=_0x9bde[_0x3ca147];return _0x8c18c7;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xe9bd('0x0'));var _=require('lodash');var sh=require(_0xe9bd('0x1'));var odbc=require('odbc')();var rs=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var rp=require(_0xe9bd('0x5'));var logger=require(_0xe9bd('0x6'))(_0xe9bd('0x7'));var config=require(_0xe9bd('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xe9bd('0x9');var recursiveMapAttributes=[_0xe9bd('0xa'),_0xe9bd('0xb')];var verticesWithRetry=[_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe')];var AGIVertices=function(_0x29bc2b,_0xbefddb,_0x439abc){this[_0xe9bd('0xf')]=_0x29bc2b;this['rpc']=_0xbefddb;this['mailRpc']=_0x439abc;};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x11')]=function(_0x2601ac,_0x581ab9){this[_0xe9bd('0x12')][_0xe9bd('0x13')](_0x2601ac)[_0xe9bd('0x14')](function(_0x141587){_0x581ab9(null,_0x141587?_0x141587['name']:![]);})[_0xe9bd('0x15')](function(_0x4ac319){_0x581ab9(_0x4ac319);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x16')]=function(_0x3435b4,_0x51109f){this['rpc'][_0xe9bd('0x17')](_0x3435b4)[_0xe9bd('0x14')](function(_0x3a9e5f){_0x51109f(null,_0x3a9e5f?_0x3a9e5f[_0xe9bd('0x18')]:![]);})[_0xe9bd('0x15')](function(_0x389e7b){_0x51109f(_0x389e7b);});};AGIVertices[_0xe9bd('0x10')]['getSquareProject']=function(_0x1d11a0,_0x464a1b){this[_0xe9bd('0x12')]['getSquareProjectById'](_0x1d11a0)[_0xe9bd('0x14')](function(_0x3bae08){_0x464a1b(null,_0x3bae08?_0x3bae08[_0xe9bd('0x18')]:![]);})[_0xe9bd('0x15')](function(_0x5cf674){_0x464a1b(_0x5cf674);});};AGIVertices[_0xe9bd('0x10')]['getSquareOdbc']=function(_0xc6b661,_0x55b869){this[_0xe9bd('0x12')][_0xe9bd('0x19')](_0xc6b661)[_0xe9bd('0x14')](function(_0x3dda13){_0x55b869(null,_0x3dda13?_0x3dda13[_0xe9bd('0x1a')]:![]);})[_0xe9bd('0x15')](function(_0x6593ce){_0x55b869(_0x6593ce);});};AGIVertices['prototype'][_0xe9bd('0x1b')]=function(_0x28cd17,_0x4ecaf5){this[_0xe9bd('0x12')]['getUserById'](_0x28cd17)[_0xe9bd('0x14')](function(_0x1b9cc9){_0x4ecaf5(null,_0x1b9cc9?_0x1b9cc9[_0xe9bd('0x18')]:![]);})[_0xe9bd('0x15')](function(_0x5bc4bf){_0x4ecaf5(_0x5bc4bf);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x1c')]=function(_0x2c9a57,_0x39b206){this[_0xe9bd('0x12')][_0xe9bd('0x1d')](_0x2c9a57)[_0xe9bd('0x14')](function(_0x43ea90){_0x39b206(null,_0x43ea90?_0x43ea90[_0xe9bd('0x18')]:![]);})['catch'](function(_0x3c211a){_0x39b206(_0x3c211a);});};AGIVertices[_0xe9bd('0x10')]['getSound']=function(_0x3b13b7,_0xc25248){var _0x119672=this;this[_0xe9bd('0x12')][_0xe9bd('0x1e')](_0x3b13b7)[_0xe9bd('0x14')](function(_0x519f48){_0xc25248(null,_0x519f48?_0x119672['getSoundPath'](_0x519f48[_0xe9bd('0x1f')]):![]);})['catch'](function(_0xa45eb0){_0xc25248(_0xa45eb0);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x20')]=function(_0x36aa80,_0x4057df){this['rpc']['getMailAccountById'](_0x36aa80)[_0xe9bd('0x14')](function(_0x3b6682){_0x4057df(null,_0x3b6682?_0x3b6682:![]);})[_0xe9bd('0x15')](function(_0x3081f3){_0x4057df(_0x3081f3);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x21')]=function(_0x3c31ee,_0x66213a,_0x45703e){this['mailRpc'][_0xe9bd('0x21')](_0x3c31ee,_0x66213a)[_0xe9bd('0x14')](function(){_0x45703e(null);})[_0xe9bd('0x15')](function(_0x5117bc){_0x45703e(_0x5117bc);});};AGIVertices['prototype'][_0xe9bd('0x22')]=function(_0x2e9593,_0x601649){this[_0xe9bd('0x12')][_0xe9bd('0x23')](_0x2e9593)[_0xe9bd('0x14')](function(_0x1e50ac){if(_0x1e50ac){if(_0x1e50ac[_0xe9bd('0x24')]){_0x601649(null,[_0x1e50ac[_0xe9bd('0x25')]]);}else{_0x601649(null,_[_0xe9bd('0x26')](_0x1e50ac[_0xe9bd('0x27')],_0xe9bd('0x25')));}}else{_0x601649(null,![]);}})[_0xe9bd('0x15')](function(_0x199477){_0x601649(_0x199477);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x28')]=function(_0x264ba0){return util[_0xe9bd('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x264ba0);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x2a')]=function(_0x56b4a5,_0x404a7d,_0x264c87){odbc['open'](_0x56b4a5,function(_0x4b1da0){if(_0x4b1da0){logger[_0xe9bd('0x2b')](_0xe9bd('0x2c'),_0x4b1da0);_0x264c87(_0x4b1da0);}else{logger['info'](_0xe9bd('0x2d'));odbc[_0xe9bd('0x2e')](_0x404a7d,function(_0x14927c,_0x5b894a){if(_0x14927c){logger[_0xe9bd('0x2f')]('Error\x20executing\x20query\x20%s',_0x404a7d);_0x264c87(_0x14927c);}else{logger[_0xe9bd('0x2f')](_0xe9bd('0x30'),_0x404a7d);odbc[_0xe9bd('0x31')](function(_0x1366f2){if(_0x1366f2){logger['error'](_0xe9bd('0x32'),_0x1366f2);}_0x264c87(null,_0x5b894a);});}});}});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x33')]=function(_0x3f1212,_0x253359){this[_0xe9bd('0x12')][_0xe9bd('0x34')](_0x3f1212)[_0xe9bd('0x14')](function(_0x2b5a71){_0x253359(null,_0x2b5a71?_0x2b5a71:![]);})[_0xe9bd('0x15')](function(_0x4e8565){_0x253359(_0x4e8565);});};AGIVertices['prototype'][_0xe9bd('0x35')]=function(_0x499e13,_0x4608a0){this[_0xe9bd('0x12')][_0xe9bd('0x35')](_0x499e13)['then'](function(_0x1ba613){_0x4608a0(null,_0x1ba613);})[_0xe9bd('0x15')](function(_0x1a2d94){_0x4608a0(_0x1a2d94);});};AGIVertices['prototype'][_0xe9bd('0x36')]=function(_0x3a5703,_0x2b3cd7,_0x388132){this[_0xe9bd('0x12')][_0xe9bd('0x36')]({'uniqueid':this[_0xe9bd('0xf')][_0xe9bd('0x37')],'node':_0x3a5703[_0xe9bd('0x38')],'application':_0x3a5703[_0xe9bd('0x39')],'data':_0x2b3cd7||null,'project_name':this[_0xe9bd('0xf')][_0xe9bd('0x3a')],'callerid':this[_0xe9bd('0xf')][_0xe9bd('0x3b')]})[_0xe9bd('0x14')](function(_0x5b70d3){if(_0x388132){_0x388132(null,_0x5b70d3);}})['catch'](function(_0x283e67){if(_0x388132){_0x388132(_0x283e67);}});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x3c')]=function(_0x58828b,_0x594e80,_0x43cf7d,_0x3f6f22){this[_0xe9bd('0x12')][_0xe9bd('0x3c')]({'uniqueid':this[_0xe9bd('0xf')][_0xe9bd('0x37')],'callerid':this[_0xe9bd('0xf')]['callerid'],'calleridname':this[_0xe9bd('0xf')]['calleridname'],'context':this[_0xe9bd('0xf')][_0xe9bd('0x3d')],'extension':this[_0xe9bd('0xf')][_0xe9bd('0x3e')],'priority':this[_0xe9bd('0xf')]['priority'],'accountcode':this[_0xe9bd('0xf')][_0xe9bd('0x3f')],'dnid':this[_0xe9bd('0xf')]['dnid'],'projectName':this[_0xe9bd('0xf')][_0xe9bd('0x3a')],'saveName':_0x594e80,'filename':_0x58828b[_0xe9bd('0x40')]||_0x594e80,'savePath':_0x43cf7d})['then'](function(_0x28d2ea){_0x3f6f22(null,_0x28d2ea);})[_0xe9bd('0x15')](function(_0x2e634d){_0x3f6f22(_0x2e634d);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x41')]=function(_0x579d26,_0x3f4833,_0x4b8ff9){this[_0xe9bd('0x12')][_0xe9bd('0x41')]({'uniqueid':this[_0xe9bd('0xf')][_0xe9bd('0x37')],'body':_0x579d26,'direction':_0x3f4833})[_0xe9bd('0x14')](function(_0x4944e3){if(_0x4b8ff9){_0x4b8ff9(null,_0x4944e3);}})[_0xe9bd('0x15')](function(_0x485e95){if(_0x4b8ff9){_0x4b8ff9(_0x485e95);}});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x42')]=function(_0x5e08ae,_0x59d5cb){this[_0xe9bd('0x12')]['createCmContact']({'firstName':_[_0xe9bd('0x43')](_0x5e08ae['name'])||_[_0xe9bd('0x44')](_0x5e08ae[_0xe9bd('0x18')])?'callback_'+Math[_0xe9bd('0x45')]():_0x5e08ae['name'],'lastName':_[_0xe9bd('0x43')](_0x5e08ae[_0xe9bd('0x46')])||_[_0xe9bd('0x44')](_0x5e08ae['lastName'])?null:_0x5e08ae[_0xe9bd('0x46')],'phone':_0x5e08ae[_0xe9bd('0x47')],'ListId':_0x5e08ae[_0xe9bd('0x48')],'scheduledAt':_0x5e08ae[_0xe9bd('0x49')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xe9bd('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x5e08ae[_0xe9bd('0x49')][_0xe9bd('0x4b')](),'priority':_0x5e08ae[_0xe9bd('0x4c')]})[_0xe9bd('0x14')](function(_0x159f68){_0x59d5cb(null,_0x159f68);})[_0xe9bd('0x15')](function(_0x373057){_0x59d5cb(_0x373057);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x4d')]=function(_0x3be526,_0x1fd5bf){this[_0xe9bd('0x12')]['getPauseById'](_0x3be526)['then'](function(_0x566dd8){_0x1fd5bf(null,_0x566dd8?_0x566dd8[_0xe9bd('0x18')]:![]);})['catch'](function(_0x2c4ca7){_0x1fd5bf(_0x2c4ca7);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x4e')]=function(_0x6232e5,_0x1c9328,_0xaf6ffd){var _0x3bb2ba={'role':_0xe9bd('0x4f')};_0x3bb2ba[_0x6232e5]=this[_0xe9bd('0xf')]['callerid'];this[_0xe9bd('0x12')][_0xe9bd('0x4e')](_0x3bb2ba,_0x1c9328,this[_0xe9bd('0xf')][_0xe9bd('0x37')])['then'](function(_0x1c8765){_0xaf6ffd(null,_[_0xe9bd('0x44')](_0x1c8765)?![]:!![]);})[_0xe9bd('0x15')](function(_0x4e05f0){logger[_0xe9bd('0x2b')](_0x4e05f0);_0xaf6ffd(null,![]);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x50')]=function(_0xfe82f7,_0x4ee26a){var _0x4b3447={'role':_0xe9bd('0x4f')};_0x4b3447[_0xfe82f7]=this[_0xe9bd('0xf')][_0xe9bd('0x3b')];this[_0xe9bd('0x12')]['agentUnpause'](_0x4b3447)['then'](function(_0x305efa){_0x4ee26a(null,_[_0xe9bd('0x44')](_0x305efa)?![]:!![]);})[_0xe9bd('0x15')](function(_0x3ba881){logger[_0xe9bd('0x2b')](_0x3ba881);_0x4ee26a(null,![]);});};AGIVertices[_0xe9bd('0x10')]['agentLogout']=function(_0x179c8d,_0x5681ab){var _0x27e07c={'role':_0xe9bd('0x4f')};_0x27e07c[_0x179c8d]=this[_0xe9bd('0xf')][_0xe9bd('0x3b')];this['rpc'][_0xe9bd('0x51')](_0x27e07c)[_0xe9bd('0x14')](function(_0x3b0190){_0x5681ab(null,_['isNil'](_0x3b0190)?![]:!![]);})[_0xe9bd('0x15')](function(_0x1a9d0c){logger[_0xe9bd('0x2b')](_0x1a9d0c);_0x5681ab(null,![]);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x52')]=function(_0x16b66c,_0x3a626d){var _0x336222={'role':_0xe9bd('0x4f')};_0x336222[_0x16b66c]=this[_0xe9bd('0xf')][_0xe9bd('0x3b')];var _0x37d07a=_0x16b66c!='internal'?util[_0xe9bd('0x29')](_0xe9bd('0x53'),'LOCAL',this[_0xe9bd('0xf')][_0xe9bd('0x3b')]):undefined;this['rpc']['agentLogin'](_0x336222,_0x37d07a)[_0xe9bd('0x14')](function(_0x4190f0){_0x3a626d(null,_['isNil'](_0x4190f0)?![]:!![]);})['catch'](function(_0x4a6422){logger[_0xe9bd('0x2b')](_0x4a6422);_0x3a626d(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x4b5bfb,_0x4bcf2b){sh[_0xe9bd('0x54')](_[_0xe9bd('0x55')](_0x4b5bfb),function(_0x2ed5f2,_0x4947b0){var _0x3d4dd1=_0x4947b0[_0xe9bd('0x56')](/(\r\n|\n|\r)/gm,'');_0x4bcf2b(null,_0x3d4dd1);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x57')]=function(_0x5dc598,_0x2656e9){scripts[_0xe9bd('0x57')](_0x5dc598[_0xe9bd('0x58')],_0x5dc598['google_cloud_tts_text_type']||'text',_0x5dc598[_0xe9bd('0x59')],_0x5dc598[_0xe9bd('0x5a')]||_0xe9bd('0x5b'),_0x5dc598[_0xe9bd('0x5c')]||_0xe9bd('0x5d'),_0x5dc598[_0xe9bd('0x5e')]||_0xe9bd('0x5f'))[_0xe9bd('0x14')](function(_0x578e85){_0x2656e9(null,_0x578e85);})[_0xe9bd('0x15')](function(_0x35e0ca){_0x2656e9(_0x35e0ca);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x60')]=function(_0x2364fc,_0x5d7257){scripts[_0xe9bd('0x60')](_0x2364fc['text'],_0x2364fc['google_tts_language']||'en',0x1)[_0xe9bd('0x14')](function(_0x4496e3){_0x5d7257(null,_0x4496e3);})['catch'](function(_0x1a6bf9){_0x5d7257(_0x1a6bf9);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x61')]=function(_0x292faf,_0x582cf3){var _0x3c1ab9={'uri':_0x292faf[_0xe9bd('0x62')],'method':_0x292faf['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x292faf[_0xe9bd('0x63')])===_0xe9bd('0x64')&&parseInt(_0x292faf[_0xe9bd('0x63')])>=0x1?parseInt(_0x292faf[_0xe9bd('0x63')])*0x3e8:0x5*0x3e8};if(_[_0xe9bd('0x65')]([_0xe9bd('0x66'),_0xe9bd('0x67')],_0x3c1ab9['method'][_0xe9bd('0x68')]())){try{_0x3c1ab9[_0xe9bd('0x69')]=_0x292faf[_0xe9bd('0xb')]?JSON[_0xe9bd('0x6a')](_0x292faf[_0xe9bd('0xb')]):{};}catch(_0x8f51aa){logger[_0xe9bd('0x2b')](_0xe9bd('0x6b'),_0x8f51aa);}}try{_0x3c1ab9[_0xe9bd('0x6c')]=_0x292faf['rawHeaders']?JSON[_0xe9bd('0x6a')](_0x292faf[_0xe9bd('0xa')]):{};}catch(_0x256890){logger[_0xe9bd('0x2b')](_0xe9bd('0x6d'),_0x256890);}if(_0x292faf[_0xe9bd('0x6e')]){try{var _0x1bad42=require(_0x292faf['computedVariables'])[_0xe9bd('0x6f')](this,_0x3c1ab9);_0x3c1ab9[_0xe9bd('0x70')]=Mustache['render'](_0x292faf[_0xe9bd('0x62')],_0x1bad42,{},['$$','$$']);if(_0x3c1ab9[_0xe9bd('0x6c')]){_0x3c1ab9[_0xe9bd('0x6c')]=JSON[_0xe9bd('0x6a')](Mustache[_0xe9bd('0x71')](JSON[_0xe9bd('0x72')](_0x3c1ab9[_0xe9bd('0x6c')]),_0x1bad42,{},['$$','$$']));}if(_0x3c1ab9['body']){_0x3c1ab9['body']=JSON[_0xe9bd('0x6a')](Mustache[_0xe9bd('0x71')](JSON[_0xe9bd('0x72')](_0x3c1ab9[_0xe9bd('0x69')]),_0x1bad42,{},['$$','$$']));}}catch(_0x449175){logger[_0xe9bd('0x2b')](_0xe9bd('0x73'),_0x449175);}}rp(_0x3c1ab9)['then'](function(_0x35390a){var _0x44f47e={'statusCode':_0x35390a[_0xe9bd('0x74')]||0xc8,'statusMessage':_0x35390a[_0xe9bd('0x75')]||'OK','headers':_0x35390a[_0xe9bd('0x6c')]||{},'body':_0x35390a[_0xe9bd('0x69')]||{}};_0x582cf3(null,_0x44f47e);})[_0xe9bd('0x15')](function(_0x4bbeef){var _0x55aacf={'statusCode':_0x4bbeef['statusCode']||0x1f4,'statusMessage':_0x4bbeef[_0xe9bd('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4bbeef['options']['headers']||{},'body':_0x4bbeef[_0xe9bd('0x77')][_0xe9bd('0x69')]||{}};_0x582cf3(null,_0x55aacf);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x78')]=function(_0xd8a604,_0x3bc2f2){scripts[_0xe9bd('0x78')](this[_0xe9bd('0xf')][_0xe9bd('0x37')],_0xd8a604['key'],_0xd8a604[_0xe9bd('0x59')],_0xd8a604['dialogflow_language']||'en')[_0xe9bd('0x14')](function(_0x433a98){_0x3bc2f2(null,_0x433a98);})[_0xe9bd('0x15')](function(_0x6fff03){_0x3bc2f2(_0x6fff03);});};AGIVertices[_0xe9bd('0x10')]['sestekNDA']=function(_0x5b14e5,_0x56d4eb){scripts[_0xe9bd('0x79')](this[_0xe9bd('0xf')],_0x5b14e5)['then'](function(_0x3c7875){_0x56d4eb(null,_0x3c7875);})[_0xe9bd('0x15')](function(_0x2bf2f0){_0x56d4eb(_0x2bf2f0);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x7a')]=function(_0x58c1e5,_0x821505){scripts[_0xe9bd('0x7a')](_0x58c1e5[_0xe9bd('0x7b')],_0x58c1e5[_0xe9bd('0x59')],_0x58c1e5[_0xe9bd('0x7c')]||_0xe9bd('0x5b'),_0x58c1e5[_0xe9bd('0x7d')])[_0xe9bd('0x14')](function(_0x45991e){_0x821505(null,_0x45991e);})[_0xe9bd('0x15')](function(_0x5f24c8){_0x821505(_0x5f24c8);});};AGIVertices['prototype']['ispeechASR']=function(_0x5b5c35,_0x4039c7,_0x2c7ecc){scripts[_0xe9bd('0x7e')](_0x4039c7,_0x5b5c35['key'],_0x5b5c35[_0xe9bd('0x7f')]||_0xe9bd('0x5b'),this['isConfigured'](_0x5b5c35['model'])?_0x5b5c35[_0xe9bd('0x80')]:undefined)[_0xe9bd('0x14')](function(_0x2a4937){_0x2c7ecc(null,_0x2a4937);})[_0xe9bd('0x15')](function(_0x23a145){_0x2c7ecc(_0x23a145);});};AGIVertices['prototype']['awsPolly']=function(_0x499771,_0x223f56){scripts[_0xe9bd('0x81')](_0x499771[_0xe9bd('0x82')],_0x499771[_0xe9bd('0x83')],_0x499771[_0xe9bd('0x84')],_0x499771[_0xe9bd('0x85')]||_0xe9bd('0x86'),_0x499771[_0xe9bd('0x59')],_0x499771[_0xe9bd('0x87')]||_0xe9bd('0x59'))['then'](function(_0xb1203d){_0x223f56(null,_0xb1203d);})['catch'](function(_0x116815){_0x223f56(_0x116815);});};AGIVertices['prototype']['awsLex']=function(_0x423e15,_0x4a6253){scripts[_0xe9bd('0x88')](this['channel'][_0xe9bd('0x37')],_0x423e15[_0xe9bd('0x82')],_0x423e15[_0xe9bd('0x83')],_0x423e15[_0xe9bd('0x89')],_0x423e15[_0xe9bd('0x59')],_0x423e15[_0xe9bd('0x8a')])['then'](function(_0x3b97a0){_0x4a6253(null,_0x3b97a0);})[_0xe9bd('0x15')](function(_0x4ee8a3){_0x4a6253(_0x4ee8a3);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x8b')]=function(_0x141fe2,_0x59897b,_0x342f9e){scripts[_0xe9bd('0x8b')](_0x59897b,_0x141fe2[_0xe9bd('0x7b')],_0x141fe2[_0xe9bd('0x8c')]||_0xe9bd('0x5b'))['then'](function(_0x45021c){_0x342f9e(null,_0x45021c);})[_0xe9bd('0x15')](function(_0x591c5f){_0x342f9e(_0x591c5f);});};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x8d')]=function(_0x396679,_0x4d9717,_0x50243f){scripts[_0xe9bd('0x8d')](_0x4d9717,_0x396679[_0xe9bd('0x8e')],_0x396679[_0xe9bd('0x8f')],_0x396679[_0xe9bd('0x70')])[_0xe9bd('0x14')](function(_0xb6582b){_0x50243f(null,_0xb6582b);})[_0xe9bd('0x15')](function(_0x56bdcd){_0x50243f(_0x56bdcd);});};AGIVertices[_0xe9bd('0x10')]['clear']=function(_0x33dcf6){var _0x3a2d9f=_[_0xe9bd('0x65')](verticesWithRetry,_0x33dcf6['agicommand'])?_0x33dcf6:_[_0xe9bd('0x90')](_0x33dcf6);for(var _0x4ae8d1 in _0x3a2d9f){if(_0x3a2d9f[_0xe9bd('0x91')](_0x4ae8d1)){if(_0x3a2d9f[_0x4ae8d1]&&_[_0xe9bd('0x92')](_0x3a2d9f[_0x4ae8d1])){if(_[_0xe9bd('0x65')](recursiveMapAttributes,_0x4ae8d1)){_0x3a2d9f[_0x4ae8d1]=this[_0xe9bd('0x93')](_0x3a2d9f[_0x4ae8d1]);}else{_0x3a2d9f[_0x4ae8d1]=this[_0xe9bd('0x94')](_0x3a2d9f[_0x4ae8d1]);}}}}return _0x3a2d9f;};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x95')]=function(_0x2abd8f){for(var _0x14db25 in _0x2abd8f){if(_0x2abd8f[_0xe9bd('0x91')](_0x14db25)){if(_[_0xe9bd('0x96')](_0x2abd8f[_0x14db25])){return this['recursiveNodeIndex'](_0x2abd8f[_0x14db25]);}_0x2abd8f[_0x14db25]=this[_0xe9bd('0x94')](_0x2abd8f[_0x14db25]);}}};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x97')]=function(_0x5dad5e,_0x97e5b1){for(var _0x16bcce in _0x5dad5e){if(_0x5dad5e['hasOwnProperty'](_0x16bcce)){if(_['isPlainObject'](_0x5dad5e[_0x16bcce])){if(!_['isEmpty'](_0x5dad5e[_0x16bcce])){this['saveRestApiResult'](_0x5dad5e[_0x16bcce],util[_0xe9bd('0x29')](_0xe9bd('0x98'),_0x97e5b1,_0x16bcce));}}else{if(_0x5dad5e[_0x16bcce]){this[_0xe9bd('0xf')]['setVariable'](util[_0xe9bd('0x29')](_0xe9bd('0x98'),_0x97e5b1,_0x16bcce),_0x5dad5e[_0x16bcce]);}}}}};AGIVertices['prototype'][_0xe9bd('0x93')]=function(_0x35894c){try{var _0x3fed2e=JSON[_0xe9bd('0x6a')](_0x35894c);this[_0xe9bd('0x95')](_0x3fed2e);return JSON['stringify'](_0x3fed2e);}catch(_0x1fcc3a){return this[_0xe9bd('0x94')](_0x35894c);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x54ffbd){var _0x4fbbd6=_0x54ffbd[_0xe9bd('0x99')]('{');for(var _0x26b67a=0x1;_0x26b67a<_0x4fbbd6[_0xe9bd('0x9a')];_0x26b67a+=0x1){var _0xae352d=_0x4fbbd6[_0x26b67a]['split']('}');if(_0xae352d['length']>0x1){_0x54ffbd=_0x54ffbd[_0xe9bd('0x9b')]('{'+_0xae352d[0x0]+'}',this[_0xe9bd('0xf')][_0xe9bd('0x11')](_0xae352d[0x0])['extra']||_0xae352d[0x0]);}}if(_0x4fbbd6[_0xe9bd('0x9a')]===0x1){return _0x54ffbd[_0xe9bd('0x4b')]();}return this['replaceAllVariables'](_0x54ffbd);};AGIVertices['prototype'][_0xe9bd('0x9c')]=function(_0x90b3d7,_0x346da7){var _0x3453c3=this[_0xe9bd('0xf')][_0xe9bd('0x11')](_0x90b3d7);if(_0x3453c3[_0xe9bd('0x9d')]===-0x1){return _0x3453c3;}logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x346da7,_0x3453c3[_0xe9bd('0x9e')]));return this[_0xe9bd('0xf')][_0xe9bd('0x9f')](_0x346da7,_0x3453c3[_0xe9bd('0x9e')]);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xa0')]=function(_0x55f0d3){return _0x55f0d3&&_0x55f0d3!=='0'&&_0x55f0d3!=='-1'&&_0x55f0d3!=='';};AGIVertices[_0xe9bd('0x10')]['maxRetry']=function(_0x13e932){this['createSquareDetailsReport'][_0xe9bd('0x6f')](this,_0x13e932,'-');_0x13e932[_0xe9bd('0xa1')]=_0x13e932['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x7')]=function(_0x54a6c6){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0xa2'),_0x54a6c6[_0xe9bd('0x38')]));return this['channel'][_0xe9bd('0x7')]([_0x54a6c6[_0xe9bd('0xa3')],_0x54a6c6['args']]);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xa4')]=function(_0x2d5601){logger['info'](util[_0xe9bd('0x29')](_0xe9bd('0xa5'),_0x2d5601[_0xe9bd('0x38')]));if(this[_0xe9bd('0xa0')](_0x2d5601[_0xe9bd('0x63')])){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2d5601[_0xe9bd('0x63')]));var _0x2e1c0f=this[_0xe9bd('0xf')]['wait'](_0x2d5601[_0xe9bd('0x63')]);if(_0x2e1c0f['result']===-0x1){return _0x2e1c0f;}}return this['channel']['answer']();};AGIVertices[_0xe9bd('0x10')]['callback']=function(_0x516080){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x516080[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x516080['list_id'])){return this['channel'][_0xe9bd('0x2b')](_0x516080,'no\x20list\x20selected');}_0x516080['scheduledAt']=moment();if(this[_0xe9bd('0xa0')](_0x516080[_0xe9bd('0xa6')])){_0x516080[_0xe9bd('0x49')]=moment()[_0xe9bd('0xa7')](_0x516080[_0xe9bd('0xa6')],_0xe9bd('0xa8'));}if(!this[_0xe9bd('0xa0')](_0x516080['callback_priority'])){_0x516080[_0xe9bd('0x4c')]=0x2;}this['createCmContact']['sync'](this,_0x516080);return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xaa'),_0x516080[_0xe9bd('0x47')],_0x516080['list_id'],_0x516080[_0xe9bd('0x49')]));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xab')]=function(_0x2a4f8a){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2a4f8a[_0xe9bd('0x38')]));var _0x265dba=this[_0xe9bd('0xf')][_0xe9bd('0x54')](_0x2a4f8a[_0xe9bd('0xac')],_0x2a4f8a[_0xe9bd('0x77')]);if(_0x265dba['result']===-0x1){return _0x265dba;}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0xad'),_0x2a4f8a[_0xe9bd('0xac')],_0x2a4f8a[_0xe9bd('0x77')]));};AGIVertices[_0xe9bd('0x10')]['lumenvoxtts']=function(_0x13b95b){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0xae'),_0x13b95b[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x13b95b[_0xe9bd('0x59')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('no\x20text\x20configured');}var _0x2fa992='\x22'+_0x13b95b[_0xe9bd('0x59')]+'\x22';if(this[_0xe9bd('0xa0')](_0x13b95b[_0xe9bd('0x77')])){_0x2fa992+=','+_0x13b95b[_0xe9bd('0x77')];}var _0x1bda30=this[_0xe9bd('0xf')]['exec'](_0xe9bd('0xaf'),_0x2fa992);if(_0x1bda30['result']===-0x1){return _0x1bda30;}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xb0'),_0x2fa992));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xb1')]=function(_0x5bf65b){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0xb2'),_0x5bf65b['label']));if(!this[_0xe9bd('0xa0')](_0x5bf65b[_0xe9bd('0x59')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xb3'));}var _0x7d2411='\x22'+_0x5bf65b[_0xe9bd('0x59')]+'\x22';if(this[_0xe9bd('0xa0')](_0x5bf65b[_0xe9bd('0x77')])){_0x7d2411+=','+_0x5bf65b[_0xe9bd('0x77')];}var _0x5c0b2d=this[_0xe9bd('0xf')][_0xe9bd('0x54')](_0xe9bd('0xaf'),_0x7d2411);if(_0x5c0b2d['result']===-0x1){return _0x5c0b2d;}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x7d2411));};AGIVertices['prototype'][_0xe9bd('0xb4')]=function(_0x183071){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0xb5'),_0x183071[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x183071['grammar'])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('no\x20grammar\x20configured');}var _0x767a44=_0x183071[_0xe9bd('0xb6')];if(this[_0xe9bd('0xa0')](_0x183071[_0xe9bd('0x77')])){_0x767a44+=','+_0x183071[_0xe9bd('0x77')];}var _0x142907=this[_0xe9bd('0xf')][_0xe9bd('0x54')](_0xe9bd('0xb7'),_0x767a44);if(_0x142907[_0xe9bd('0x9d')]===-0x1){return _0x142907;}var _0x38ce72=this[_0xe9bd('0x9c')](_0xe9bd('0xb8'),_0xe9bd('0xb9'));if(_0x38ce72[_0xe9bd('0x9d')]===-0x1){return _0x38ce72;}var _0x58f68a=this[_0xe9bd('0x9c')](_0xe9bd('0xba'),_0xe9bd('0xbb'));if(_0x58f68a[_0xe9bd('0x9d')]===-0x1){return _0x58f68a;}var _0x217eff=this['getAndSetVariable'](_0xe9bd('0xbc'),_0xe9bd('0xbd'));if(_0x217eff[_0xe9bd('0x9d')]===-0x1){return _0x217eff;}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xbe'),_0x767a44));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xbf')]=function(_0xab57a8){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0xc0'),_0xab57a8['label']));if(!this[_0xe9bd('0xa0')](_0xab57a8[_0xe9bd('0xb6')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xc1'));}var _0x3541d0=_0xab57a8[_0xe9bd('0xb6')];if(this[_0xe9bd('0xa0')](_0xab57a8[_0xe9bd('0x77')])){_0x3541d0+=','+_0xab57a8[_0xe9bd('0x77')];}var _0xad2195=this[_0xe9bd('0xf')]['exec'](_0xe9bd('0xb7'),_0x3541d0);if(_0xad2195[_0xe9bd('0x9d')]===-0x1){return _0xad2195;}var _0x62dd82=this[_0xe9bd('0x9c')](_0xe9bd('0xb8'),'SESTEK_ASR_CONFIDENCE');if(_0x62dd82[_0xe9bd('0x9d')]===-0x1){return _0x62dd82;}var _0x43579b=this[_0xe9bd('0x9c')]('RECOG_INPUT()',_0xe9bd('0xc2'));if(_0x43579b[_0xe9bd('0x9d')]===-0x1){return _0x43579b;}var _0x496640=this['getAndSetVariable']('RECOG_INSTANCE()',_0xe9bd('0xc3'));if(_0x496640[_0xe9bd('0x9d')]===-0x1){return _0x496640;}return this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xbe'),_0x3541d0));};AGIVertices['prototype'][_0xe9bd('0xc4')]=function(_0x3445f6){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3445f6[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x3445f6['odbc_id'])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x3445f6,_0xe9bd('0xc5'));}var _0x33d5cb=this['getSquareOdbc']['sync'](this,_0x3445f6['odbc_id']);if(!_0x33d5cb){return this[_0xe9bd('0xf')]['error'](_0x3445f6,_0xe9bd('0xc6'));}if(!this[_0xe9bd('0xa0')](_0x3445f6[_0xe9bd('0x2e')])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x3445f6,_0xe9bd('0xc7'));}var _0x53b73c=_0x3445f6[_0xe9bd('0x2e')][_0xe9bd('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xc8'),_0x53b73c));var _0x25def7=this['getQueryOdbc'][_0xe9bd('0x6f')](this,_0x33d5cb,_0x53b73c);this[_0xe9bd('0x36')][_0xe9bd('0x6f')](this,_0x3445f6,_0x53b73c);if(!this[_0xe9bd('0xa0')](_0x3445f6['variable_id'])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xc9'));}var _0x152070=this[_0xe9bd('0x11')][_0xe9bd('0x6f')](this,_0x3445f6[_0xe9bd('0xca')]);if(!_0x152070){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x3445f6,_0xe9bd('0xcb'));}var _0x3cfa05=this;_0x25def7[_0xe9bd('0xcc')](function(_0x11a03d,_0x4eeb96){Object[_0xe9bd('0xcd')](_0x11a03d)[_0xe9bd('0xcc')](function(_0x571328){_0x3cfa05[_0xe9bd('0xf')][_0xe9bd('0x9f')](util[_0xe9bd('0x29')]('%s[%s][%s]',_0x152070,_0x4eeb96,_0x571328),_0x11a03d[_0x571328]);});});this[_0xe9bd('0xf')][_0xe9bd('0x9f')](util[_0xe9bd('0x29')](_0xe9bd('0xce'),_0x152070),_0x25def7['length']);return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xcf'),_0x152070));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xd0')]=function(_0x58f73d){logger[_0xe9bd('0xd1')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x58f73d[_0xe9bd('0x38')]));if(!this['isConfigured'](_0x58f73d[_0xe9bd('0xd2')])){return this['channel'][_0xe9bd('0x2b')](_0x58f73d,_0xe9bd('0xd3'));}var _0x5e60b0=this[_0xe9bd('0x1b')][_0xe9bd('0x6f')](this,_0x58f73d[_0xe9bd('0xd2')]);if(!_0x5e60b0){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x58f73d,_0xe9bd('0xd4'));}var _0x1d94e1=this['channel'][_0xe9bd('0x54')](_0xe9bd('0xd5'),[util[_0xe9bd('0x29')](_0xe9bd('0xd6'),_0x5e60b0),_0x58f73d[_0xe9bd('0x63')],_0x58f73d[_0xe9bd('0xd7')],_0x58f73d['url']]);if(_0x1d94e1[_0xe9bd('0x9d')]===-0x1){return _0x1d94e1;}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xd8'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x470071){logger['info'](util[_0xe9bd('0x29')](_0xe9bd('0xd9'),_0x470071['label']));if(!this[_0xe9bd('0xa0')](_0x470071[_0xe9bd('0x7b')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xda'));}if(!this[_0xe9bd('0xa0')](_0x470071[_0xe9bd('0x59')])){return this['channel']['noop'](_0xe9bd('0xb3'));}this['channel']['bot']=!![];this[_0xe9bd('0x36')](_0x470071);this[_0xe9bd('0x41')](_0x470071[_0xe9bd('0x59')],'in');this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xdb'),_0x470071[_0xe9bd('0x59')]));var _0xe55ad1=this[_0xe9bd('0x78')][_0xe9bd('0x6f')](this,_0x470071);if(_0xe55ad1){for(var _0x5b44bf in _0xe55ad1){if(_0xe55ad1[_0xe9bd('0x91')](_0x5b44bf)){this['channel'][_0xe9bd('0x9f')](util[_0xe9bd('0x29')](_0xe9bd('0xdc'),_0x5b44bf[_0xe9bd('0x68')]()),_0xe55ad1[_0x5b44bf]);}}this['createSquareMessage'](_0xe55ad1[_0xe9bd('0xdd')],_0xe9bd('0xde'));return this[_0xe9bd('0xf')]['noop'](util['format'](_0xe9bd('0xdf'),_0xe55ad1[_0xe9bd('0xdd')]));}return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x470071,_0xe9bd('0xe0'));};AGIVertices[_0xe9bd('0x10')]['sesteknda']=function(_0x2daedf){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0xe1'),_0x2daedf['label']));if(!this[_0xe9bd('0xa0')](_0x2daedf[_0xe9bd('0xe2')])){return this[_0xe9bd('0xf')]['noop'](_0xe9bd('0xe3'));}if(!this[_0xe9bd('0xa0')](_0x2daedf[_0xe9bd('0xe4')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xe5'));}if(!this[_0xe9bd('0xa0')](_0x2daedf['password'])){return this['channel'][_0xe9bd('0xa9')](_0xe9bd('0xe6'));}if(!this[_0xe9bd('0xa0')](_0x2daedf['ndassistant_url'])){return this['channel'][_0xe9bd('0xa9')](_0xe9bd('0xb3'));}this[_0xe9bd('0xf')]['bot']=!![];this[_0xe9bd('0x36')](_0x2daedf);this['createSquareMessage'](_0x2daedf[_0xe9bd('0x59')],'in');this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xe7'),_0x2daedf[_0xe9bd('0x59')]));var _0x103791=this[_0xe9bd('0x79')][_0xe9bd('0x6f')](this,_0x2daedf);if(_0x103791){for(var _0x53a060 in _0x103791){if(_0x103791['hasOwnProperty'](_0x53a060)){this[_0xe9bd('0xf')][_0xe9bd('0x9f')](util[_0xe9bd('0x29')](_0xe9bd('0xe8'),_0x53a060[_0xe9bd('0x68')]()),_0x103791[_0x53a060]);}}this[_0xe9bd('0x41')](_0x103791[_0xe9bd('0xdd')],_0xe9bd('0xde'));if(_0x103791['audiofile']){this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0xe9'),_0x103791['audiofile']));var _0x3b32f7=this[_0xe9bd('0xf')][_0xe9bd('0xea')](_0x103791['audiofile']);try{fs[_0xe9bd('0xeb')](_0x103791[_0xe9bd('0xec')]+'.wav');}catch(_0x10d9ed){logger[_0xe9bd('0x2b')](_0x10d9ed);}return _0x3b32f7;}else{return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')]('SestekNDA\x20Result\x20%s',_0x103791[_0xe9bd('0xdd')]));}}return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x2daedf,_0xe9bd('0xed'));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xee')]=function(_0x551853){logger[_0xe9bd('0x2f')](util['format'](_0xe9bd('0xef'),_0x551853['label']));return this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('end');};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xf0')]=function(_0x5a8d1a){logger[_0xe9bd('0x2f')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x5a8d1a['label']));var _0x3a625d='';if(_0x5a8d1a[_0xe9bd('0xf1')]){if(!this['isConfigured'](_0x5a8d1a['trunk_id'])){return this[_0xe9bd('0xf')]['error'](_0x5a8d1a,_0xe9bd('0xf2'));}else{var _0x447743=parseInt(_0x5a8d1a['trunk_id'],0xa);if(isNaN(_0x447743)){_0x3a625d=_0x5a8d1a[_0xe9bd('0xf1')];}else{_0x3a625d=this[_0xe9bd('0x1c')][_0xe9bd('0x6f')](this,_0x5a8d1a[_0xe9bd('0xf1')]);if(!_0x3a625d){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x5a8d1a,_0xe9bd('0xf3'));}}}}else if(_0x5a8d1a[_0xe9bd('0xf4')]){_0x3a625d=_0x5a8d1a[_0xe9bd('0xf4')];}else{return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x5a8d1a,_0xe9bd('0xf2'));}var _0x430df1=this['channel'][_0xe9bd('0x54')](_0xe9bd('0xd5'),[util[_0xe9bd('0x29')](_0xe9bd('0xf5'),_0x3a625d,_0x5a8d1a[_0xe9bd('0x47')]),_0x5a8d1a['timeout'],_0x5a8d1a[_0xe9bd('0xd7')],_0x5a8d1a[_0xe9bd('0x62')]]);if(_0x430df1[_0xe9bd('0x9d')]===-0x1){return _0x430df1;}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xd8'),'DIAL'));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xf6')]=function(_0x49e80a){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0xf7'),_0x49e80a[_0xe9bd('0x38')]));return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xf6'));};AGIVertices[_0xe9bd('0x10')]['getdigits']=function(_0x3e445d){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3e445d[_0xe9bd('0x38')]));if(_0x3e445d[_0xe9bd('0xa1')]===0x0){return this['maxRetry'](_0x3e445d);}_0x3e445d['retry']-=0x1;if(!this[_0xe9bd('0xa0')](_0x3e445d['file_id'])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x3e445d,_0xe9bd('0xf8'));}var _0x4feba7=this[_0xe9bd('0xf9')][_0xe9bd('0x6f')](this,_0x3e445d[_0xe9bd('0xfa')]);if(!_0x4feba7){return this[_0xe9bd('0xf')]['error'](_0x3e445d,_0xe9bd('0xfb'));}if(!this[_0xe9bd('0xa0')](_0x3e445d[_0xe9bd('0xca')])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0xe9bd('0xc9'));}var _0x4d2675=this[_0xe9bd('0xf')][_0xe9bd('0xfc')](_0x4feba7,_0x3e445d[_0xe9bd('0xfd')],_0x3e445d[_0xe9bd('0xfe')]);var _0x458fe0=_0x4d2675[_0xe9bd('0x9d')]?_0x4d2675[_0xe9bd('0x9d')][_0xe9bd('0x4b')]():'';logger['info']('test',JSON[_0xe9bd('0x72')](_0x4d2675));if(_0x4d2675[_0xe9bd('0x9d')]===-0x1){this[_0xe9bd('0x36')][_0xe9bd('0x6f')](this,_0x3e445d,_0x458fe0);return _0x4d2675;}else if(_0x4d2675[_0xe9bd('0x9e')]===_0xe9bd('0x63')){_0x4d2675[_0xe9bd('0x9d')]=_0x458fe0[_0xe9bd('0x9a')]>=parseInt(_0x3e445d[_0xe9bd('0xff')])?'x':'i';}else{_0x4d2675[_0xe9bd('0x9d')]=_0x458fe0['length']>=parseInt(_0x3e445d[_0xe9bd('0xff')])&&_0x458fe0[_0xe9bd('0x9a')]<=parseInt(_0x3e445d[_0xe9bd('0xfe')])?'x':'i';}var _0xd98d29=this[_0xe9bd('0x11')][_0xe9bd('0x6f')](this,_0x3e445d[_0xe9bd('0xca')]);if(!_0xd98d29){return this['channel'][_0xe9bd('0x2b')](_0x3e445d,_0xe9bd('0xcb'));}this[_0xe9bd('0xf')][_0xe9bd('0x9f')](_0xd98d29,_0x458fe0);if(this[_0xe9bd('0xa0')](_0x3e445d['hiddendigitsnum'])){var _0x3be5d4=parseInt(_0x3e445d[_0xe9bd('0x100')],0xa);var _0x3fd3fb=rs[_0xe9bd('0x101')]({'charset':'*','length':_0x3be5d4});var _0x333e0e=_0x458fe0['length'];if(_0x333e0e>0x0){if(_0x333e0e>_0x3be5d4){this[_0xe9bd('0x36')]['sync'](this,_0x3e445d,_0x3e445d[_0xe9bd('0x102')]===_0xe9bd('0x103')?_0x3fd3fb+_0x458fe0[_0xe9bd('0x104')](_0x3be5d4):_0x458fe0['substr'](0x0,_0x333e0e-_0x3be5d4)+_0x3fd3fb);}else{this['createSquareDetailsReport'][_0xe9bd('0x6f')](this,_0x3e445d,rs[_0xe9bd('0x101')]({'charset':'*','length':_0x333e0e}));}}else{this[_0xe9bd('0x36')]['sync'](this,_0x3e445d,'');}}else{this[_0xe9bd('0x36')][_0xe9bd('0x6f')](this,_0x3e445d,_0x458fe0);}return _0x4d2675;};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xe')]=function(_0x2e3595){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x105'),_0x2e3595[_0xe9bd('0x38')]));return this[_0xe9bd('0xd')](_0x2e3595);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x106')]=function(_0x3b5bca){logger[_0xe9bd('0x2f')](util['format'](_0xe9bd('0x107'),_0x3b5bca[_0xe9bd('0x38')]));this['createSquareDetailsReport'][_0xe9bd('0x6f')](this,_0x3b5bca,_0x3b5bca[_0xe9bd('0x108')]);return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0x109'),_0x3b5bca[_0xe9bd('0x108')]));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x10a')]=function(_0x52d59e){logger['info'](util[_0xe9bd('0x29')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x52d59e[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x52d59e[_0xe9bd('0x82')])||!this[_0xe9bd('0xa0')](_0x52d59e[_0xe9bd('0x83')])){return this['channel'][_0xe9bd('0xa9')](_0xe9bd('0x10b'));}if(!this[_0xe9bd('0xa0')](_0x52d59e[_0xe9bd('0x59')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xb3'));}this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x10c'),_0x52d59e[_0xe9bd('0x59')]));var _0x1b346d=this['awsPolly'][_0xe9bd('0x6f')](this,_0x52d59e);if(_0x1b346d){this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x10d'),_0x1b346d));var _0x3e06f7=this[_0xe9bd('0xf')][_0xe9bd('0xea')](_0x1b346d);try{fs[_0xe9bd('0xeb')](_0x1b346d+_0xe9bd('0x10e'));}catch(_0x1871eb){logger[_0xe9bd('0x2b')](_0x1871eb);}return _0x3e06f7;}return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x52d59e,_0xe9bd('0x10f'));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x110')]=function(_0x249e3a){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x249e3a[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x249e3a[_0xe9bd('0x82')])||!this[_0xe9bd('0xa0')](_0x249e3a['aws_secret_access_key'])){return this[_0xe9bd('0xf')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x249e3a['aws_bot_name'])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x111'));}if(!this['isConfigured'](_0x249e3a[_0xe9bd('0x59')])){return this['channel'][_0xe9bd('0xa9')](_0xe9bd('0xb3'));}this['channel'][_0xe9bd('0x112')]=!![];this['createSquareDetailsReport'](_0x249e3a);this['createSquareMessage'](_0x249e3a[_0xe9bd('0x59')],'in');this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0x113'),_0x249e3a['text']));var _0x7bf3ff=this['awsLex'][_0xe9bd('0x6f')](this,_0x249e3a);if(_0x7bf3ff){for(var _0x1c4e38 in _0x7bf3ff){if(_0x7bf3ff[_0xe9bd('0x91')](_0x1c4e38)&&_['isString'](_0x7bf3ff[_0x1c4e38])){this[_0xe9bd('0xf')]['setVariable'](util[_0xe9bd('0x29')](_0xe9bd('0x114'),_0x1c4e38[_0xe9bd('0x68')]()),_0x7bf3ff[_0x1c4e38]);}}if(_[_0xe9bd('0x44')](_0x7bf3ff[_0xe9bd('0x76')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x115'));}else{this[_0xe9bd('0x41')](_0x7bf3ff[_0xe9bd('0x76')],_0xe9bd('0xde'));return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x116'),_0x7bf3ff[_0xe9bd('0x76')]));}}return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x249e3a,_0xe9bd('0x117'));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x118')]=function(_0x53eb33){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x53eb33[_0xe9bd('0x38')],_0x53eb33[_0xe9bd('0x63')]));if(!this[_0xe9bd('0xa0')](_0x53eb33[_0xe9bd('0x7b')])){return this[_0xe9bd('0xf')]['noop'](_0xe9bd('0xda'));}var _0x2d7c18=_0xe9bd('0x119');var _0x27c2aa=util[_0xe9bd('0x29')](_0xe9bd('0x11a'),FILES_PATH,rs[_0xe9bd('0x101')](0x4));var _0xe8f186=util[_0xe9bd('0x29')](_0xe9bd('0x98'),_0x27c2aa,_0x2d7c18);var _0x5564d7=!![];if(_0x53eb33[_0xe9bd('0x11b')]===_0xe9bd('0x11c')){_0x5564d7=![];}var _0x3b0650=this[_0xe9bd('0xf')][_0xe9bd('0x11d')](_0x27c2aa,_0x2d7c18,_0x53eb33[_0xe9bd('0x11e')],_0x53eb33[_0xe9bd('0x63')],undefined,_0x5564d7);if(_0x3b0650[_0xe9bd('0x9d')]!==-0x1){this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x11f'),_0xe8f186));var _0x10ea33=this['googleASR'][_0xe9bd('0x6f')](this,_0x53eb33,_0xe8f186);if(_0x10ea33){for(var _0x3682d1 in _0x10ea33){if(_0x10ea33[_0xe9bd('0x91')](_0x3682d1)){this[_0xe9bd('0xf')][_0xe9bd('0x9f')](util[_0xe9bd('0x29')](_0xe9bd('0x120'),_0x3682d1[_0xe9bd('0x68')]()),_0x10ea33[_0x3682d1]);}}return this['channel'][_0xe9bd('0xa9')](util['format']('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x10ea33)));}}return _0x3b0650;};AGIVertices[_0xe9bd('0x10')]['tildeasr']=function(_0x28b74b){logger['info'](util['format'](_0xe9bd('0x121'),_0x28b74b['label']));if(!this[_0xe9bd('0xa0')](_0x28b74b[_0xe9bd('0x8e')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x122'));}if(!this[_0xe9bd('0xa0')](_0x28b74b['appsecret'])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x123'));}var _0x51e0b5=_0xe9bd('0x119');var _0x3c0224=util['format'](_0xe9bd('0x11a'),FILES_PATH,rs[_0xe9bd('0x101')](0x4));var _0x44af86=util[_0xe9bd('0x29')](_0xe9bd('0x98'),_0x3c0224,_0x51e0b5);var _0x53a617=!![];if(_0x28b74b['beep']===_0xe9bd('0x11c')){_0x53a617=![];}var _0x5d2b09=this['channel']['recordFile'](_0x3c0224,_0x51e0b5,_0x28b74b[_0xe9bd('0x11e')],_0x28b74b[_0xe9bd('0x63')],undefined,_0x53a617);if(_0x5d2b09[_0xe9bd('0x9d')]!==-0x1){this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x124'),_0x44af86));var _0x49077e=this[_0xe9bd('0x8d')][_0xe9bd('0x6f')](this,_0x28b74b,_0x44af86);if(_0x49077e){for(var _0x95d14e in _0x49077e){if(_0x49077e['hasOwnProperty'](_0x95d14e)){this[_0xe9bd('0xf')][_0xe9bd('0x9f')](util[_0xe9bd('0x29')]('TILDE_ASR_%s',_0x95d14e[_0xe9bd('0x68')]()),_0x49077e[_0x95d14e]);}}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0x125'),JSON[_0xe9bd('0x72')](_0x49077e)));}}return _0x5d2b09;};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x126')]=function(_0x550ac8){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x127'),_0x550ac8[_0xe9bd('0x38')]));return this['channel'][_0xe9bd('0x128')](_0x550ac8[_0xe9bd('0x3d')],_0x550ac8[_0xe9bd('0x3e')],_0x550ac8[_0xe9bd('0x129')]);};AGIVertices[_0xe9bd('0x10')]['gotoif']=function(_0x1377ec){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x12a'),_0x1377ec['label']));if(!this[_0xe9bd('0xa0')](_0x1377ec[_0xe9bd('0x12b')])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x1377ec,'no\x20condition\x20configured');}try{var _0x3d7f65=eval(_0x1377ec[_0xe9bd('0x12b')])?_0xe9bd('0x12c'):_0xe9bd('0x12d');this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x12e'),_0x1377ec[_0xe9bd('0x12b')],_0x3d7f65));return{'code':0xc8,'result':_0x3d7f65};}catch(_0x18aee1){return{'code':0xc8,'result':_0xe9bd('0x12d')};}};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x12f')]=function(_0x568937){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x130'),_0x568937[_0xe9bd('0x38')]));if(!this['isConfigured'](_0x568937[_0xe9bd('0x131')])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x568937,_0xe9bd('0x132'));}var _0x5ad4a6=this['getIntervals'][_0xe9bd('0x6f')](this,_0x568937['interval_id']);if(!_0x5ad4a6){return this['channel'][_0xe9bd('0x2b')](_0x568937,'no\x20intervals\x20found');}for(var _0x122413=0x0;_0x122413<_0x5ad4a6[_0xe9bd('0x9a')];_0x122413+=0x1){var _0x3e7830=this[_0xe9bd('0xf')][_0xe9bd('0x11')](util[_0xe9bd('0x29')](_0xe9bd('0x133'),_0x5ad4a6[_0x122413]));if(_0x3e7830[_0xe9bd('0x9d')]===-0x1){return _0x3e7830;}logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x134'),_0x5ad4a6[_0x122413],_0x3e7830[_0xe9bd('0x9e')]));if(_0x3e7830[_0xe9bd('0x9e')]===_0xe9bd('0x12c')){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('IFTIME\x20%s\x20%s',_0x5ad4a6[_0x122413],_0xe9bd('0x12c')));this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x134'),_0x5ad4a6[_0x122413],'true'));return{'code':0xc8,'result':_0xe9bd('0x12c')};}else{logger['info'](util['format'](_0xe9bd('0x134'),_0x5ad4a6[_0x122413],_0xe9bd('0x12d')));this['channel']['noop'](util['format'](_0xe9bd('0x134'),_0x5ad4a6[_0x122413],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xe9bd('0x10')]['hangup']=function(_0x3f709e){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x135'),_0x3f709e['label']));return this[_0xe9bd('0xf')][_0xe9bd('0x136')]();};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x137')]=function(_0x13ea8a){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x13ea8a['label']));if(!this['isConfigured'](_0x13ea8a['key'])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xda'));}var _0x223d9b=_0xe9bd('0x119');var _0x446fe7=util[_0xe9bd('0x29')](_0xe9bd('0x11a'),FILES_PATH,rs['generate'](0x4));var _0x99245c=util[_0xe9bd('0x29')](_0xe9bd('0x98'),_0x446fe7,_0x223d9b);var _0x34c059=!![];if(_0x13ea8a[_0xe9bd('0x11b')]===_0xe9bd('0x11c')){_0x34c059=![];}var _0x510de3=this[_0xe9bd('0xf')][_0xe9bd('0x11d')](_0x446fe7,_0x223d9b,_0x13ea8a[_0xe9bd('0x11e')],_0x13ea8a[_0xe9bd('0x63')],undefined,_0x34c059);if(_0x510de3['result']!==-0x1){this['channel']['noop'](util[_0xe9bd('0x29')]('ispeech\x20%s\x20file\x20created',_0x99245c));var _0x47254a=this[_0xe9bd('0x7e')][_0xe9bd('0x6f')](this,_0x13ea8a,_0x99245c);if(_0x47254a){for(var _0xb30c8f in _0x47254a){if(_0x47254a[_0xe9bd('0x91')](_0xb30c8f)){this[_0xe9bd('0xf')][_0xe9bd('0x9f')](util[_0xe9bd('0x29')]('ISPEECH_ASR_%s',_0xb30c8f[_0xe9bd('0x68')]()),_0x47254a[_0xb30c8f]);}}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x138'),JSON[_0xe9bd('0x72')](_0x47254a)));}}return _0x510de3;};AGIVertices[_0xe9bd('0x10')]['ispeechtts']=function(_0x9766f2){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x139'),_0x9766f2[_0xe9bd('0x38')]));if(!this['isConfigured'](_0x9766f2[_0xe9bd('0x7b')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x9766f2[_0xe9bd('0x59')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xb3'));}this[_0xe9bd('0xf')]['noop'](util[_0xe9bd('0x29')](_0xe9bd('0x13a'),_0x9766f2[_0xe9bd('0x59')]));var _0x293858=this[_0xe9bd('0x7a')][_0xe9bd('0x6f')](this,_0x9766f2);if(_0x293858){this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')]('ispeech\x20%s\x20file\x20created',_0x293858));var _0x3ebd5d=this[_0xe9bd('0xf')]['streamFile'](_0x293858,_0x9766f2[_0xe9bd('0x11e')]);try{fs[_0xe9bd('0xeb')](_0x293858+_0xe9bd('0x10e'));}catch(_0x148989){logger['error'](_0x148989);}return _0x3ebd5d;}return this[_0xe9bd('0xf')]['error'](_0x9766f2,_0xe9bd('0x13b'));};AGIVertices[_0xe9bd('0x10')]['login']=function(_0x143c72){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x143c72[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x143c72[_0xe9bd('0x13c')])){return this[_0xe9bd('0xf')]['error'](_0x143c72,_0xe9bd('0x13d'));}logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x13e'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x143c72[_0xe9bd('0x13c')]));var _0xe84682=this['agentLogin'][_0xe9bd('0x6f')](this,_0x143c72[_0xe9bd('0x13c')]);if(_0xe84682){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x143c72[_0xe9bd('0x13c')]));this[_0xe9bd('0xf')]['noop'](util[_0xe9bd('0x29')](_0xe9bd('0x13f'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x143c72[_0xe9bd('0x13c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x140'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x143c72[_0xe9bd('0x13c')]));this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x140'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x143c72['findBy']));return{'code':0xc8,'result':_0xe9bd('0x141')};}};AGIVertices['prototype'][_0xe9bd('0x142')]=function(_0x4ee2b7){logger['info'](util['format'](_0xe9bd('0x143'),_0x4ee2b7[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x4ee2b7[_0xe9bd('0x13c')])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x4ee2b7,_0xe9bd('0x13d'));}logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x13e'),this['channel'][_0xe9bd('0x3b')],_0x4ee2b7[_0xe9bd('0x13c')]));var _0x48af31=this[_0xe9bd('0x51')]['sync'](this,_0x4ee2b7['findBy']);if(_0x48af31){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x13f'),this['channel']['callerid'],_0x4ee2b7[_0xe9bd('0x13c')]));this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0x13f'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x4ee2b7['findBy']));return{'code':0xc8,'result':_0xe9bd('0x144')};}else{logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x140'),this['channel'][_0xe9bd('0x3b')],_0x4ee2b7[_0xe9bd('0x13c')]));this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0x140'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x4ee2b7['findBy']));return{'code':0xc8,'result':_0xe9bd('0x141')};}};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x145')]=function(_0x47c137){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x47c137[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x47c137[_0xe9bd('0x146')])){return this[_0xe9bd('0xf')]['error'](_0x47c137,'no\x20operation\x20configured');}this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0x147'),_0x47c137['operation']));var _0x4b0a01=eval(_0x47c137['operation']);if(!this['isConfigured'](_0x47c137[_0xe9bd('0xca')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0xc9'));}var _0x253be2=this[_0xe9bd('0x11')]['sync'](this,_0x47c137['variable_id']);if(!_0x253be2){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x47c137,_0xe9bd('0xcb'));}if(_[_0xe9bd('0x148')](_0x4b0a01)){var _0x517e1d=this;_0x4b0a01['forEach'](function(_0x5a8333,_0x3c091e){_0x517e1d['channel'][_0xe9bd('0x9f')](util[_0xe9bd('0x29')]('%s[%s]',_0x253be2,_0x3c091e),_0x5a8333);});return this['channel'][_0xe9bd('0xa9')](util['format'](_0xe9bd('0x149'),_0x253be2));}else{return this[_0xe9bd('0xf')][_0xe9bd('0x9f')](_0x253be2,_0x4b0a01);}};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0xc')]=function(_0x5482ad){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x14a'),_0x5482ad[_0xe9bd('0x38')]));if(_0x5482ad[_0xe9bd('0xa1')]===0x0){return this[_0xe9bd('0x14b')](_0x5482ad);}_0x5482ad['retry']-=0x1;if(!this[_0xe9bd('0xa0')](_0x5482ad['file_id'])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x5482ad,_0xe9bd('0xf8'));}var _0x2b5eaa=this['getSound'][_0xe9bd('0x6f')](this,_0x5482ad[_0xe9bd('0xfa')]);if(!_0x2b5eaa){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x5482ad,'no\x20file\x20audio\x20found');}var _0xf9e1e2=this[_0xe9bd('0xf')][_0xe9bd('0xfc')](_0x2b5eaa,_0x5482ad['response'],_0x5482ad[_0xe9bd('0x14c')]);var _0x2ce47d=_0xf9e1e2[_0xe9bd('0x9d')];if(_0xf9e1e2['result']===-0x1){this[_0xe9bd('0x36')][_0xe9bd('0x6f')](this,_0x5482ad,'-1');return _0xf9e1e2;}else if(_0xf9e1e2[_0xe9bd('0x9e')]===_0xe9bd('0x63')){_0xf9e1e2[_0xe9bd('0x9d')]=_0xf9e1e2[_0xe9bd('0x9d')][_0xe9bd('0x9a')]>0x0?_0xf9e1e2['result']:'t';}else if(_['isEmpty'](_0xf9e1e2[_0xe9bd('0x9d')])){_0xf9e1e2[_0xe9bd('0x9d')]='#';_0x2ce47d='#';}if(!this[_0xe9bd('0xa0')](_0x5482ad['variable_id'])){this['channel'][_0xe9bd('0xa9')](_0xe9bd('0xc9'));}else{var _0x2e3586=this['getVariable'][_0xe9bd('0x6f')](this,_0x5482ad[_0xe9bd('0xca')]);if(!_0x2e3586){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x5482ad,_0xe9bd('0xcb'));}this[_0xe9bd('0xf')][_0xe9bd('0x9f')](_0x2e3586,_0x2ce47d);}this[_0xe9bd('0x36')][_0xe9bd('0x6f')](this,_0x5482ad,_0x2ce47d);return _0xf9e1e2;};AGIVertices['prototype']['noop']=function(_0x22dd87){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x14d'),_0x22dd87['label']));return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0x22dd87[_0xe9bd('0x14e')]||_0x22dd87[_0xe9bd('0x38')]);};AGIVertices[_0xe9bd('0x10')]['pause']=function(_0x39e628){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x14f'),_0x39e628['label']));if(!this['isConfigured'](_0x39e628[_0xe9bd('0x13c')])){return this['channel'][_0xe9bd('0x2b')](_0x39e628,_0xe9bd('0x13d'));}logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x13e'),this['channel']['callerid'],_0x39e628[_0xe9bd('0x13c')]));var _0x5690ee=this[_0xe9bd('0x4d')][_0xe9bd('0x6f')](this,_0x39e628['pause_id']);var _0x5c26b7=this[_0xe9bd('0x4e')][_0xe9bd('0x6f')](this,_0x39e628[_0xe9bd('0x13c')],_0x5690ee);if(_0x5c26b7){logger[_0xe9bd('0x2f')](util['format'](_0xe9bd('0x13f'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x39e628[_0xe9bd('0x13c')]));this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe9bd('0xf')]['callerid'],_0x39e628[_0xe9bd('0x13c')]));return{'code':0xc8,'result':_0xe9bd('0x144')};}else{logger['info'](util[_0xe9bd('0x29')](_0xe9bd('0x140'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x39e628[_0xe9bd('0x13c')]));this[_0xe9bd('0xf')]['noop'](util[_0xe9bd('0x29')](_0xe9bd('0x13f'),this['channel']['callerid'],_0x39e628[_0xe9bd('0x13c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x150')]=function(_0x43d731){logger[_0xe9bd('0x2f')](util['format'](_0xe9bd('0x151'),_0x43d731[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x43d731[_0xe9bd('0xfa')])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x43d731,_0xe9bd('0xf8'));}var _0xc877fd=this[_0xe9bd('0xf9')][_0xe9bd('0x6f')](this,_0x43d731[_0xe9bd('0xfa')]);if(!_0xc877fd){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x43d731,_0xe9bd('0xfb'));}var _0x57e43c=this[_0xe9bd('0xf')][_0xe9bd('0x54')](_0xe9bd('0x152'),[_0xc877fd,_0x43d731[_0xe9bd('0xd7')]]);if(_0x57e43c[_0xe9bd('0x9d')]===-0x1){return _0x57e43c;}return this[_0xe9bd('0xf')]['noop'](util[_0xe9bd('0x29')](_0xe9bd('0xad'),'PLAYBACK',_0xc877fd));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x153')]=function(_0x3cd856){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x154'),_0x3cd856[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x3cd856[_0xe9bd('0x155')])){return this[_0xe9bd('0xf')]['error'](_0x3cd856,_0xe9bd('0x156'));}var _0x912dfa='';var _0x1b633b=parseInt(_0x3cd856[_0xe9bd('0x155')],0xa);if(isNaN(_0x1b633b)){_0x912dfa=_0x3cd856[_0xe9bd('0x155')];}else{_0x912dfa=this[_0xe9bd('0x16')]['sync'](this,_0x3cd856[_0xe9bd('0x155')]);if(!_0x912dfa){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x3cd856,_0xe9bd('0x157'));}}var _0x42d9cb='';if(this[_0xe9bd('0xa0')](_0x3cd856['file_id'])){var _0x1b9aa3=this[_0xe9bd('0xf9')][_0xe9bd('0x6f')](this,_0x3cd856[_0xe9bd('0xfa')]);if(_0x1b9aa3){_0x42d9cb=_0x1b9aa3;}}this[_0xe9bd('0x36')][_0xe9bd('0x6f')](this,_0x3cd856,_0x912dfa);if(_0x3cd856[_0xe9bd('0xd7')]['indexOf']('x')<0x0){_0x3cd856[_0xe9bd('0xd7')]+='x';}if(_0x3cd856[_0xe9bd('0xd7')]['indexOf']('X')<0x0){_0x3cd856[_0xe9bd('0xd7')]+='X';}this[_0xe9bd('0xf')][_0xe9bd('0x9f')](_0xe9bd('0x158'),_0x912dfa?_0x912dfa[_0xe9bd('0x159')]():'');var _0xe27daf=this[_0xe9bd('0xf')][_0xe9bd('0x54')](_0xe9bd('0x15a'),[_0x912dfa,_0x3cd856['opts'],_0x3cd856['url'],_0x42d9cb,_0x3cd856['timeout'],_0x3cd856[_0xe9bd('0x7')],_0x3cd856[_0xe9bd('0x15b')],_0x3cd856[_0xe9bd('0x15c')],'',_0x3cd856['position']]);if(_0xe27daf[_0xe9bd('0x9d')]===-0x1){return _0xe27daf;}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')]('Executed\x20command\x20%s\x20%s',_0xe9bd('0x15a'),_0x912dfa));};AGIVertices[_0xe9bd('0x10')]['record']=function(_0x13bb4f){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x13bb4f[_0xe9bd('0x38')]));var _0x7adf3a=_0x13bb4f[_0xe9bd('0x15d')]||'wav';var _0x4ca812=util[_0xe9bd('0x29')](_0xe9bd('0x15e'),this['channel'][_0xe9bd('0x37')],rs[_0xe9bd('0x101')](0x5));var _0x3b7324=util[_0xe9bd('0x29')](_0xe9bd('0x15f'),FILES_PATH,_0x4ca812,_0x7adf3a);var _0x126e2e=util[_0xe9bd('0x29')](_0xe9bd('0x11a'),FILES_PATH,_0x4ca812);this[_0xe9bd('0x3c')][_0xe9bd('0x6f')](this,_0x13bb4f,_0x4ca812,_0x3b7324);this[_0xe9bd('0xf')][_0xe9bd('0x9f')](_0xe9bd('0x160'),_0x4ca812);logger['info'](_0xe9bd('0x161'),_0x126e2e,_0x7adf3a,_0x13bb4f[_0xe9bd('0x162')],_0x13bb4f[_0xe9bd('0x63')]);return this[_0xe9bd('0xf')]['recordFile'](_0x126e2e,_0x7adf3a,_0x13bb4f[_0xe9bd('0x162')],_0x13bb4f['timeout'],undefined,!![]);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x163')]=function(_0x258d43){logger['info'](util[_0xe9bd('0x29')](_0xe9bd('0x164'),_0x258d43['label']));if(!this['isConfigured'](_0x258d43[_0xe9bd('0x62')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x165'));}var _0x3a5061=this[_0xe9bd('0x61')]['sync'](this,_0x258d43);logger[_0xe9bd('0x2f')](util['format'](_0xe9bd('0x166'),util['inspect'](_0x3a5061,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x258d43[_0xe9bd('0xca')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x25cf50=this[_0xe9bd('0x11')][_0xe9bd('0x6f')](this,_0x258d43[_0xe9bd('0xca')]);if(!_0x25cf50){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x258d43,_0xe9bd('0xcb'));}this[_0xe9bd('0xf')][_0xe9bd('0x9f')](util[_0xe9bd('0x29')](_0xe9bd('0x167'),_0x25cf50),_0x3a5061[_0xe9bd('0x74')]?_0x3a5061[_0xe9bd('0x74')]:_0xe9bd('0x168'));this['channel']['setVariable'](util[_0xe9bd('0x29')]('%s_STATUS_MESSAGE',_0x25cf50),_0x3a5061['statusMessage']?_0x3a5061[_0xe9bd('0x75')]:'OK');if(_0x3a5061[_0xe9bd('0x69')]){try{this[_0xe9bd('0x97')](_0x3a5061[_0xe9bd('0x69')],_0x25cf50);}catch(_0x40b617){logger[_0xe9bd('0x2b')](util[_0xe9bd('0x29')](_0xe9bd('0x169'),_0x25cf50));}}return this[_0xe9bd('0xf')]['noop'](util['format']('variable\x20%s\x20set',_0x25cf50));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x16a')]=function(_0x4637c3){logger['info'](util[_0xe9bd('0x29')](_0xe9bd('0x16b'),_0x4637c3['label']));return this[_0xe9bd('0xf')][_0xe9bd('0x16c')](_0x4637c3['digits']['replace'](/\s+/g,''),_0x4637c3[_0xe9bd('0x162')]);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x16d')]=function(_0x4e7305){logger['info'](util[_0xe9bd('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4e7305['label']));return this[_0xe9bd('0xf')][_0xe9bd('0x16e')](_0x4e7305[_0xe9bd('0x64')][_0xe9bd('0x56')](/\s+/g,''),_0x4e7305[_0xe9bd('0x162')]);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x16f')]=function(_0x47e667){logger['info'](util[_0xe9bd('0x29')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x47e667['label']));return this['channel'][_0xe9bd('0x170')](_0x47e667[_0xe9bd('0x59')],_0x47e667[_0xe9bd('0x162')]);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x171')]=function(_0x48db15){logger[_0xe9bd('0x2f')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x48db15[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x48db15[_0xe9bd('0x172')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x173'));}var _0x430aaf=this[_0xe9bd('0x20')][_0xe9bd('0x6f')](this,_0x48db15[_0xe9bd('0x172')]);if(!_0x430aaf||!_0x430aaf[_0xe9bd('0x174')]){return this['channel'][_0xe9bd('0x2b')](_0x48db15,'no\x20mail\x20account\x20found');}var _0x569660={'from':util[_0xe9bd('0x29')](_0xe9bd('0x175'),_0x430aaf[_0xe9bd('0x18')],_0x430aaf[_0xe9bd('0x176')]||_0x430aaf[_0xe9bd('0x174')][_0xe9bd('0x177')]),'to':_0x48db15['to']||'','cc':_0x48db15['cc']||'','bcc':_0x48db15[_0xe9bd('0x178')]||'','subject':_0x48db15[_0xe9bd('0x179')],'html':_0x48db15['text'],'text':_0x48db15[_0xe9bd('0x59')]};var _0x3c38b5={'tls':{'rejectUnauthorized':![]}};if(_0x430aaf[_0xe9bd('0x174')][_0xe9bd('0x17a')]){_0x3c38b5[_0xe9bd('0x17a')]=_0x430aaf[_0xe9bd('0x174')]['service'];}else{_0x3c38b5[_0xe9bd('0x17b')]=_0x430aaf[_0xe9bd('0x174')]['host'];_0x3c38b5[_0xe9bd('0x17c')]=_0x430aaf[_0xe9bd('0x174')]['port'];_0x3c38b5[_0xe9bd('0x17d')]=_0x430aaf['Smtp']['secure'];}if(_0x430aaf[_0xe9bd('0x174')][_0xe9bd('0x17e')]){_0x3c38b5[_0xe9bd('0x17f')]={'user':_0x430aaf[_0xe9bd('0x174')][_0xe9bd('0x177')],'pass':_0x430aaf[_0xe9bd('0x174')]['pass']};}if(this['isConfigured'](_0x48db15[_0xe9bd('0x180')])){}logger[_0xe9bd('0xd1')](_0xe9bd('0x181'),JSON[_0xe9bd('0x72')](_0x569660));this[_0xe9bd('0x36')][_0xe9bd('0x6f')](this,_0x48db15,_0x48db15['account_id']);this['channel']['noop'](util[_0xe9bd('0x29')](_0xe9bd('0x182'),_0x430aaf[_0xe9bd('0x18')]));this[_0xe9bd('0x21')][_0xe9bd('0x6f')](this,_0x3c38b5,_0x569660);return this['channel'][_0xe9bd('0xa9')](_0xe9bd('0x183'));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x184')]=function(_0x42c0d5){logger['info'](util[_0xe9bd('0x29')](_0xe9bd('0x185'),_0x42c0d5[_0xe9bd('0x38')]));return this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x186')]=function(_0x1000d1){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x187'),_0x1000d1[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x1000d1[_0xe9bd('0x188')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('no\x20sms\x20account\x20configured');}var _0x5504f5=this[_0xe9bd('0x33')]['sync'](this,_0x1000d1[_0xe9bd('0x188')]);if(!_0x5504f5){return this[_0xe9bd('0xf')]['error'](_0x1000d1,_0xe9bd('0x189'));}var _0x19cf5a={'body':_0x1000d1[_0xe9bd('0x18a')],'phone':_0x1000d1['to']||'','SmsAccountId':_0x5504f5['id']};logger['debug']('sendSMS\x20message',JSON[_0xe9bd('0x72')](_0x19cf5a));this[_0xe9bd('0x36')]['sync'](this,_0x1000d1,_0x1000d1[_0xe9bd('0x188')]);this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x18b'),_0x5504f5[_0xe9bd('0x18')]));this[_0xe9bd('0x35')][_0xe9bd('0x6f')](this,_0x19cf5a);return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x18c'));};AGIVertices['prototype'][_0xe9bd('0x18d')]=function(_0x312523){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x18e'),_0x312523[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x312523[_0xe9bd('0xca')])){return this[_0xe9bd('0xf')]['error'](_0x312523,'no\x20variable\x20selected');}var _0x447903=this[_0xe9bd('0x11')]['sync'](this,_0x312523['variable_id']);if(!_0x447903){return this['channel'][_0xe9bd('0x2b')](_0x312523,_0xe9bd('0xcb'));}return this[_0xe9bd('0xf')][_0xe9bd('0x9f')](_0x447903,_0x312523[_0xe9bd('0x18f')]);};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x190')]=function(_0x27dc44){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x191'),_0x27dc44[_0xe9bd('0x38')]));this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x192'));if(_0x27dc44['answer']==='yes'){this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('Answer');return this[_0xe9bd('0xf')][_0xe9bd('0xa4')]();}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](_0xe9bd('0x193'));};AGIVertices['prototype'][_0xe9bd('0x194')]=function(_0x5d4e3d){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x195'),_0x5d4e3d[_0xe9bd('0x38')]));if(!this['isConfigured'](_0x5d4e3d[_0xe9bd('0x196')])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x5d4e3d,_0xe9bd('0x197'));}var _0x5b7666=this[_0xe9bd('0x198')]['sync'](this,_0x5d4e3d[_0xe9bd('0x196')]);if(!this[_0xe9bd('0xa0')](_0x5b7666)){return this['channel']['error'](_0x5d4e3d,util[_0xe9bd('0x29')](_0xe9bd('0x199'),_0x5d4e3d[_0xe9bd('0x196')]));}if(_0x5b7666===this[_0xe9bd('0xf')][_0xe9bd('0x3a')]){return this[_0xe9bd('0xf')]['error'](_0x5d4e3d,_0xe9bd('0x19a'));}this['createSquareDetailsReport'][_0xe9bd('0x6f')](this,_0x5d4e3d,_0x5b7666);var _0xa9de92=this[_0xe9bd('0xf')][_0xe9bd('0x54')](_0xe9bd('0x19b'),util[_0xe9bd('0x29')](_0xe9bd('0x19c'),config[_0xe9bd('0x7')][_0xe9bd('0x17b')]||_0xe9bd('0x19d'),_0x5b7666,this['channel']['arg_1']));if(_0xa9de92[_0xe9bd('0x9d')]===-0x1){return _0xa9de92;}return this['channel']['noop'](util[_0xe9bd('0x29')](_0xe9bd('0xad'),'AGI',_0x5b7666));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x19e')]=function(_0x1b8df2){logger['info'](util[_0xe9bd('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1b8df2[_0xe9bd('0x38')]));var _0x4bf6f8=this[_0xe9bd('0x19f')][_0xe9bd('0x6f')](this,_0x1b8df2['command']);this[_0xe9bd('0x36')][_0xe9bd('0x6f')](this,_0x1b8df2,_0x1b8df2['command']);if(this['isConfigured'](_0x1b8df2['variable_id'])){var _0x347d01=this['getVariable'][_0xe9bd('0x6f')](this,_0x1b8df2[_0xe9bd('0xca')]);if(_0x347d01){this[_0xe9bd('0xf')]['setVariable'](_0x347d01,_0x4bf6f8);return this[_0xe9bd('0xf')]['noop'](util[_0xe9bd('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x1b8df2[_0xe9bd('0xa3')],_0x347d01));}}return this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x1b8df2['command']));};AGIVertices[_0xe9bd('0x10')]['google_cloud_tts']=function(_0xf82d5f){logger[_0xe9bd('0x2f')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xf82d5f[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0xf82d5f[_0xe9bd('0x58')])){return this[_0xe9bd('0xf')][_0xe9bd('0xa9')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0xf82d5f[_0xe9bd('0x59')])){return this[_0xe9bd('0xf')]['noop'](_0xe9bd('0xb3'));}this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x1a0'),_0xf82d5f[_0xe9bd('0x59')]));var _0x27ed51=this[_0xe9bd('0x57')][_0xe9bd('0x6f')](this,_0xf82d5f);if(_0x27ed51){this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x1a1'),_0x27ed51));var _0x3657f3=this[_0xe9bd('0xf')][_0xe9bd('0xea')](_0x27ed51);try{fs[_0xe9bd('0xeb')](_0x27ed51+'.wav');}catch(_0x502a91){logger['error'](_0x502a91);}return _0x3657f3;}return this['channel'][_0xe9bd('0x2b')](_0xf82d5f,_0xe9bd('0x1a2'));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x1a3')]=function(_0x3bd62c){logger['info'](util[_0xe9bd('0x29')](_0xe9bd('0x1a4'),_0x3bd62c['label']));if(!this[_0xe9bd('0xa0')](_0x3bd62c['text'])){return this['channel'][_0xe9bd('0xa9')](_0xe9bd('0xb3'));}this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x1a5'),_0x3bd62c['text']));var _0x2980b6=this[_0xe9bd('0x60')][_0xe9bd('0x6f')](this,_0x3bd62c);if(_0x2980b6){this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x1a6'),_0x2980b6));var _0x392c36=this[_0xe9bd('0xf')][_0xe9bd('0xea')](_0x2980b6);try{fs['unlink'](_0x2980b6+_0xe9bd('0x10e'));}catch(_0x2d453b){logger[_0xe9bd('0x2b')](_0x2d453b);}return _0x392c36;}return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x3bd62c,_0xe9bd('0x1a7'));};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x1a8')]=function(_0x405b45){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x1a9'),_0x405b45['label']));if(!this[_0xe9bd('0xa0')](_0x405b45['findBy'])){return this['channel'][_0xe9bd('0x2b')](_0x405b45,_0xe9bd('0x13d'));}logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x13e'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x405b45[_0xe9bd('0x13c')]));var _0x5710b5=this[_0xe9bd('0x50')]['sync'](this,_0x405b45[_0xe9bd('0x13c')]);if(_0x5710b5){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x13f'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x405b45[_0xe9bd('0x13c')]));this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0x13f'),this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x405b45[_0xe9bd('0x13c')]));return{'code':0xc8,'result':_0xe9bd('0x144')};}else{logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe9bd('0xf')][_0xe9bd('0x3b')],_0x405b45[_0xe9bd('0x13c')]));this[_0xe9bd('0xf')][_0xe9bd('0xa9')](util['format'](_0xe9bd('0x140'),this[_0xe9bd('0xf')]['callerid'],_0x405b45[_0xe9bd('0x13c')]));return{'code':0xc8,'result':_0xe9bd('0x141')};}};AGIVertices[_0xe9bd('0x10')][_0xe9bd('0x1aa')]=function(_0x981d02){logger[_0xe9bd('0x2f')](util[_0xe9bd('0x29')](_0xe9bd('0x1ab'),_0x981d02[_0xe9bd('0x38')]));var _0xa800ed=this[_0xe9bd('0xf')][_0xe9bd('0x54')](_0xe9bd('0x1ac'),[_0x981d02['mailbox'],_0x981d02[_0xe9bd('0x77')]]);if(_0xa800ed[_0xe9bd('0x9d')]===-0x1){return _0xa800ed;}return this['channel'][_0xe9bd('0xa9')](util[_0xe9bd('0x29')](_0xe9bd('0xad'),'VOICEMAIL',_0x981d02[_0xe9bd('0x1ad')]));};AGIVertices['prototype'][_0xe9bd('0x1ae')]=function(_0x1e869c){logger['info'](util[_0xe9bd('0x29')](_0xe9bd('0x1af'),_0x1e869c[_0xe9bd('0x38')]));if(!this[_0xe9bd('0xa0')](_0x1e869c[_0xe9bd('0xca')])){return this[_0xe9bd('0xf')][_0xe9bd('0x2b')](_0x1e869c,'no\x20variable\x20selected');}var _0x2cacd4=this['getVariable'][_0xe9bd('0x6f')](this,_0x1e869c[_0xe9bd('0xca')]);if(!_0x2cacd4){return this['channel']['error'](_0x1e869c,_0xe9bd('0xcb'));}var _0x38abb0=this['channel'][_0xe9bd('0x11')](_0x2cacd4);return{'code':0xc8,'result':_0x38abb0['extra']?_0x38abb0[_0xe9bd('0x9e')]:'-'};};String[_0xe9bd('0x10')][_0xe9bd('0x9b')]=function(_0x23ed69,_0x564c4e){return this['split'](_0x23ed69)[_0xe9bd('0x1b0')](_0x564c4e);};module['exports']=AGIVertices; \ No newline at end of file +var _0xd8b0=['aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','intKey','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','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','isArray','forEach','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','toLowerCase','macro','gosub','QUEUE','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\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','exports','path','util','randomstring','moment','mustache','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','callerid','uniqueid','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','scheduledAt','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','list_id','no\x20list\x20selected','delay','callback_priority','noop','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','sesteknda','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getSound','no\x20file\x20audio\x20found','getData','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block'];(function(_0x21319c,_0x56f666){var _0x1705cd=function(_0x353045){while(--_0x353045){_0x21319c['push'](_0x21319c['shift']());}};_0x1705cd(++_0x56f666);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var rp=require(_0x0d8b('0x5'));var logger=require(_0x0d8b('0x6'))('agi');var config=require('../../config/environment');var scripts=require(_0x0d8b('0x7'));var FILES_PATH=_0x0d8b('0x8');var recursiveMapAttributes=[_0x0d8b('0x9'),'rawBody'];var verticesWithRetry=[_0x0d8b('0xa'),_0x0d8b('0xb'),'getsecretdigits'];var AGIVertices=function(_0x129310,_0x348e65,_0x3b027f){this[_0x0d8b('0xc')]=_0x129310;this[_0x0d8b('0xd')]=_0x348e65;this[_0x0d8b('0xe')]=_0x3b027f;};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x10')]=function(_0x48fa16,_0x3c4bfa){this['rpc'][_0x0d8b('0x11')](_0x48fa16)[_0x0d8b('0x12')](function(_0x340cc4){_0x3c4bfa(null,_0x340cc4?_0x340cc4[_0x0d8b('0x13')]:![]);})[_0x0d8b('0x14')](function(_0x32bb1a){_0x3c4bfa(_0x32bb1a);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x15')]=function(_0x1d4bbc,_0x2ce75e){this[_0x0d8b('0xd')][_0x0d8b('0x16')](_0x1d4bbc)[_0x0d8b('0x12')](function(_0x2d4e1c){_0x2ce75e(null,_0x2d4e1c?_0x2d4e1c['name']:![]);})[_0x0d8b('0x14')](function(_0xa86349){_0x2ce75e(_0xa86349);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x17')]=function(_0x2cb03c,_0x5cd485){this[_0x0d8b('0xd')][_0x0d8b('0x18')](_0x2cb03c)[_0x0d8b('0x12')](function(_0x5fecbd){_0x5cd485(null,_0x5fecbd?_0x5fecbd[_0x0d8b('0x13')]:![]);})[_0x0d8b('0x14')](function(_0x264b39){_0x5cd485(_0x264b39);});};AGIVertices[_0x0d8b('0xf')]['getSquareOdbc']=function(_0x27512e,_0x23d58f){this[_0x0d8b('0xd')][_0x0d8b('0x19')](_0x27512e)[_0x0d8b('0x12')](function(_0x5b709c){_0x23d58f(null,_0x5b709c?_0x5b709c[_0x0d8b('0x1a')]:![]);})[_0x0d8b('0x14')](function(_0x50ec1e){_0x23d58f(_0x50ec1e);});};AGIVertices['prototype'][_0x0d8b('0x1b')]=function(_0x54a9a7,_0x56c729){this['rpc'][_0x0d8b('0x1c')](_0x54a9a7)[_0x0d8b('0x12')](function(_0x214778){_0x56c729(null,_0x214778?_0x214778[_0x0d8b('0x13')]:![]);})[_0x0d8b('0x14')](function(_0x2c64e2){_0x56c729(_0x2c64e2);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x1d')]=function(_0x27b695,_0x5e5bc3){this[_0x0d8b('0xd')][_0x0d8b('0x1e')](_0x27b695)['then'](function(_0xe1ef20){_0x5e5bc3(null,_0xe1ef20?_0xe1ef20['name']:![]);})[_0x0d8b('0x14')](function(_0x234bdd){_0x5e5bc3(_0x234bdd);});};AGIVertices[_0x0d8b('0xf')]['getSound']=function(_0x59a905,_0x28f639){var _0x3ef745=this;this['rpc'][_0x0d8b('0x1f')](_0x59a905)['then'](function(_0x1b2b59){_0x28f639(null,_0x1b2b59?_0x3ef745['getSoundPath'](_0x1b2b59[_0x0d8b('0x20')]):![]);})['catch'](function(_0x2ab00d){_0x28f639(_0x2ab00d);});};AGIVertices['prototype'][_0x0d8b('0x21')]=function(_0x544735,_0x3c8887){this[_0x0d8b('0xd')][_0x0d8b('0x22')](_0x544735)['then'](function(_0x4c80a2){_0x3c8887(null,_0x4c80a2?_0x4c80a2:![]);})['catch'](function(_0x4e8992){_0x3c8887(_0x4e8992);});};AGIVertices['prototype'][_0x0d8b('0x23')]=function(_0x54f6f3,_0x5d05fc,_0x36017a){this[_0x0d8b('0xe')][_0x0d8b('0x23')](_0x54f6f3,_0x5d05fc)[_0x0d8b('0x12')](function(){_0x36017a(null);})[_0x0d8b('0x14')](function(_0xeaa769){_0x36017a(_0xeaa769);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x24')]=function(_0x553e03,_0x37ca42){this[_0x0d8b('0xd')]['getIntervalById'](_0x553e03)[_0x0d8b('0x12')](function(_0x23f7f6){if(_0x23f7f6){if(_0x23f7f6[_0x0d8b('0x25')]){_0x37ca42(null,[_0x23f7f6['interval']]);}else{_0x37ca42(null,_[_0x0d8b('0x26')](_0x23f7f6[_0x0d8b('0x27')],_0x0d8b('0x28')));}}else{_0x37ca42(null,![]);}})[_0x0d8b('0x14')](function(_0x933e01){_0x37ca42(_0x933e01);});};AGIVertices['prototype'][_0x0d8b('0x29')]=function(_0x1649fc){return util['format'](_0x0d8b('0x2a'),FILES_PATH,_0x1649fc);};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x2b')]=function(_0x974b9b,_0x373544,_0x519088){odbc['open'](_0x974b9b,function(_0x41b4f9){if(_0x41b4f9){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x41b4f9);_0x519088(_0x41b4f9);}else{logger[_0x0d8b('0x2c')](_0x0d8b('0x2d'));odbc[_0x0d8b('0x2e')](_0x373544,function(_0x1388b1,_0xc1ac4a){if(_0x1388b1){logger[_0x0d8b('0x2c')]('Error\x20executing\x20query\x20%s',_0x373544);_0x519088(_0x1388b1);}else{logger[_0x0d8b('0x2c')](_0x0d8b('0x2f'),_0x373544);odbc[_0x0d8b('0x30')](function(_0xe8fad){if(_0xe8fad){logger[_0x0d8b('0x31')](_0x0d8b('0x32'),_0xe8fad);}_0x519088(null,_0xc1ac4a);});}});}});};AGIVertices[_0x0d8b('0xf')]['getSmsAccount']=function(_0x1d06b6,_0x34acb5){this[_0x0d8b('0xd')][_0x0d8b('0x33')](_0x1d06b6)['then'](function(_0xe0bf42){_0x34acb5(null,_0xe0bf42?_0xe0bf42:![]);})['catch'](function(_0x37b26c){_0x34acb5(_0x37b26c);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x34')]=function(_0x26ac10,_0x35fa7e){this[_0x0d8b('0xd')][_0x0d8b('0x34')](_0x26ac10)[_0x0d8b('0x12')](function(_0x89ab0d){_0x35fa7e(null,_0x89ab0d);})[_0x0d8b('0x14')](function(_0x482069){_0x35fa7e(_0x482069);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x4d0811,_0x524d79,_0x1a46f6){this[_0x0d8b('0xd')][_0x0d8b('0x35')]({'uniqueid':this['channel']['uniqueid'],'node':_0x4d0811[_0x0d8b('0x36')],'application':_0x4d0811[_0x0d8b('0x37')],'data':_0x524d79||null,'project_name':this[_0x0d8b('0xc')]['arg_1'],'callerid':this[_0x0d8b('0xc')][_0x0d8b('0x38')]})['then'](function(_0x4d7bb0){if(_0x1a46f6){_0x1a46f6(null,_0x4d7bb0);}})[_0x0d8b('0x14')](function(_0x495870){if(_0x1a46f6){_0x1a46f6(_0x495870);}});};AGIVertices[_0x0d8b('0xf')]['createSquareRecording']=function(_0x53f643,_0x30ccee,_0x194f17,_0x5a75c7){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x0d8b('0x39')],'callerid':this[_0x0d8b('0xc')][_0x0d8b('0x38')],'calleridname':this['channel'][_0x0d8b('0x3a')],'context':this[_0x0d8b('0xc')][_0x0d8b('0x3b')],'extension':this[_0x0d8b('0xc')][_0x0d8b('0x3c')],'priority':this[_0x0d8b('0xc')][_0x0d8b('0x3d')],'accountcode':this[_0x0d8b('0xc')][_0x0d8b('0x3e')],'dnid':this[_0x0d8b('0xc')][_0x0d8b('0x3f')],'projectName':this[_0x0d8b('0xc')][_0x0d8b('0x40')],'saveName':_0x30ccee,'filename':_0x53f643[_0x0d8b('0x41')]||_0x30ccee,'savePath':_0x194f17})[_0x0d8b('0x12')](function(_0xdfcf32){_0x5a75c7(null,_0xdfcf32);})[_0x0d8b('0x14')](function(_0x1e162c){_0x5a75c7(_0x1e162c);});};AGIVertices[_0x0d8b('0xf')]['createSquareMessage']=function(_0x371fa0,_0x4d8850,_0x5d29ab){this[_0x0d8b('0xd')][_0x0d8b('0x42')]({'uniqueid':this[_0x0d8b('0xc')][_0x0d8b('0x39')],'body':_0x371fa0,'direction':_0x4d8850})['then'](function(_0x131579){if(_0x5d29ab){_0x5d29ab(null,_0x131579);}})[_0x0d8b('0x14')](function(_0x386074){if(_0x5d29ab){_0x5d29ab(_0x386074);}});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x43')]=function(_0x4cd85a,_0x5c0824){this['rpc']['createCmContact']({'firstName':_[_0x0d8b('0x44')](_0x4cd85a[_0x0d8b('0x13')])||_['isNil'](_0x4cd85a['name'])?_0x0d8b('0x45')+Math[_0x0d8b('0x46')]():_0x4cd85a['name'],'lastName':_['isEmpty'](_0x4cd85a[_0x0d8b('0x47')])||_[_0x0d8b('0x48')](_0x4cd85a[_0x0d8b('0x47')])?null:_0x4cd85a[_0x0d8b('0x47')],'phone':_0x4cd85a[_0x0d8b('0x49')],'ListId':_0x4cd85a['list_id'],'scheduledAt':_0x4cd85a[_0x0d8b('0x4a')],'callbackUniqueid':this[_0x0d8b('0xc')]['uniqueid'],'tags':'callback','description':_0x0d8b('0x4b')+_0x4cd85a[_0x0d8b('0x4a')]['toString'](),'priority':_0x4cd85a['callback_priority']})[_0x0d8b('0x12')](function(_0x2f2462){_0x5c0824(null,_0x2f2462);})[_0x0d8b('0x14')](function(_0xb58818){_0x5c0824(_0xb58818);});};AGIVertices['prototype'][_0x0d8b('0x4c')]=function(_0x598e03,_0x5c271c){this[_0x0d8b('0xd')][_0x0d8b('0x4d')](_0x598e03)['then'](function(_0x4a8f33){_0x5c271c(null,_0x4a8f33?_0x4a8f33[_0x0d8b('0x13')]:![]);})[_0x0d8b('0x14')](function(_0xccc2a9){_0x5c271c(_0xccc2a9);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x4e')]=function(_0xb66e76,_0x3978e5,_0x3bead7){var _0x5418d8={'role':_0x0d8b('0x4f')};_0x5418d8[_0xb66e76]=this[_0x0d8b('0xc')][_0x0d8b('0x38')];this[_0x0d8b('0xd')][_0x0d8b('0x4e')](_0x5418d8,_0x3978e5,this[_0x0d8b('0xc')][_0x0d8b('0x39')])[_0x0d8b('0x12')](function(_0x375684){_0x3bead7(null,_['isNil'](_0x375684)?![]:!![]);})[_0x0d8b('0x14')](function(_0x451940){logger[_0x0d8b('0x31')](_0x451940);_0x3bead7(null,![]);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x50')]=function(_0x577951,_0x1e1dce){var _0x2d6284={'role':_0x0d8b('0x4f')};_0x2d6284[_0x577951]=this[_0x0d8b('0xc')][_0x0d8b('0x38')];this['rpc']['agentUnpause'](_0x2d6284)[_0x0d8b('0x12')](function(_0x291b83){_0x1e1dce(null,_[_0x0d8b('0x48')](_0x291b83)?![]:!![]);})[_0x0d8b('0x14')](function(_0x5a70bd){logger[_0x0d8b('0x31')](_0x5a70bd);_0x1e1dce(null,![]);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x51')]=function(_0x5952dd,_0x2f19f4){var _0x532a85={'role':_0x0d8b('0x4f')};_0x532a85[_0x5952dd]=this[_0x0d8b('0xc')][_0x0d8b('0x38')];this[_0x0d8b('0xd')][_0x0d8b('0x51')](_0x532a85)[_0x0d8b('0x12')](function(_0x5b5fdb){_0x2f19f4(null,_[_0x0d8b('0x48')](_0x5b5fdb)?![]:!![]);})['catch'](function(_0x71e8d8){logger[_0x0d8b('0x31')](_0x71e8d8);_0x2f19f4(null,![]);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x52')]=function(_0x48025e,_0x19e097){var _0x34d01f={'role':_0x0d8b('0x4f')};_0x34d01f[_0x48025e]=this[_0x0d8b('0xc')][_0x0d8b('0x38')];var _0x273aef=_0x48025e!=_0x0d8b('0x53')?util[_0x0d8b('0x54')](_0x0d8b('0x55'),_0x0d8b('0x56'),this['channel']['callerid']):undefined;this[_0x0d8b('0xd')][_0x0d8b('0x52')](_0x34d01f,_0x273aef)['then'](function(_0xb1aa96){_0x19e097(null,_['isNil'](_0xb1aa96)?![]:!![]);})['catch'](function(_0x22ee20){logger[_0x0d8b('0x31')](_0x22ee20);_0x19e097(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x1900e3,_0x1c007b){sh[_0x0d8b('0x57')](_[_0x0d8b('0x58')](_0x1900e3),function(_0x2ab72b,_0x156859){var _0x40d265=_0x156859['replace'](/(\r\n|\n|\r)/gm,'');_0x1c007b(null,_0x40d265);});};AGIVertices[_0x0d8b('0xf')]['googleCloudTTS']=function(_0x1a203e,_0x2c6242){scripts[_0x0d8b('0x59')](_0x1a203e[_0x0d8b('0x5a')],_0x1a203e['google_cloud_tts_text_type']||_0x0d8b('0x5b'),_0x1a203e['text'],_0x1a203e[_0x0d8b('0x5c')]||_0x0d8b('0x5d'),_0x1a203e[_0x0d8b('0x5e')]||_0x0d8b('0x5f'),_0x1a203e[_0x0d8b('0x60')]||_0x0d8b('0x61'))[_0x0d8b('0x12')](function(_0x91aa89){_0x2c6242(null,_0x91aa89);})[_0x0d8b('0x14')](function(_0x44aa74){_0x2c6242(_0x44aa74);});};AGIVertices['prototype'][_0x0d8b('0x62')]=function(_0x54c28b,_0x3e4121){scripts[_0x0d8b('0x62')](_0x54c28b['text'],_0x54c28b[_0x0d8b('0x63')]||'en',0x1)['then'](function(_0x10c318){_0x3e4121(null,_0x10c318);})[_0x0d8b('0x14')](function(_0x24f75){_0x3e4121(_0x24f75);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x64')]=function(_0x299f98,_0x3a073b){var _0x3029d9={'uri':_0x299f98['url'],'method':_0x299f98[_0x0d8b('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x299f98[_0x0d8b('0x66')])==='number'&&parseInt(_0x299f98[_0x0d8b('0x66')])>=0x1?parseInt(_0x299f98[_0x0d8b('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x0d8b('0x67')]([_0x0d8b('0x68'),_0x0d8b('0x69')],_0x3029d9[_0x0d8b('0x65')][_0x0d8b('0x6a')]())){try{_0x3029d9[_0x0d8b('0x6b')]=_0x299f98[_0x0d8b('0x6c')]?JSON[_0x0d8b('0x6d')](_0x299f98[_0x0d8b('0x6c')]):{};}catch(_0x16df83){logger['error'](_0x0d8b('0x6e'),_0x16df83);}}try{_0x3029d9[_0x0d8b('0x6f')]=_0x299f98[_0x0d8b('0x9')]?JSON['parse'](_0x299f98['rawHeaders']):{};}catch(_0xebca83){logger[_0x0d8b('0x31')](_0x0d8b('0x70'),_0xebca83);}if(_0x299f98['computedVariables']){try{var _0x5bd5c8=require(_0x299f98[_0x0d8b('0x71')])[_0x0d8b('0x72')](this,_0x3029d9);_0x3029d9[_0x0d8b('0x73')]=Mustache[_0x0d8b('0x74')](_0x299f98[_0x0d8b('0x75')],_0x5bd5c8,{},['$$','$$']);if(_0x3029d9[_0x0d8b('0x6f')]){_0x3029d9[_0x0d8b('0x6f')]=JSON[_0x0d8b('0x6d')](Mustache[_0x0d8b('0x74')](JSON[_0x0d8b('0x76')](_0x3029d9[_0x0d8b('0x6f')]),_0x5bd5c8,{},['$$','$$']));}if(_0x3029d9[_0x0d8b('0x6b')]){_0x3029d9[_0x0d8b('0x6b')]=JSON['parse'](Mustache[_0x0d8b('0x74')](JSON[_0x0d8b('0x76')](_0x3029d9['body']),_0x5bd5c8,{},['$$','$$']));}}catch(_0x51c41b){logger[_0x0d8b('0x31')](_0x0d8b('0x77'),_0x51c41b);}}rp(_0x3029d9)[_0x0d8b('0x12')](function(_0x14b1b8){var _0x23e2e0={'statusCode':_0x14b1b8[_0x0d8b('0x78')]||0xc8,'statusMessage':_0x14b1b8['statusMessage']||'OK','headers':_0x14b1b8['headers']||{},'body':_0x14b1b8['body']||{}};_0x3a073b(null,_0x23e2e0);})[_0x0d8b('0x14')](function(_0xce759e){var _0x466442={'statusCode':_0xce759e[_0x0d8b('0x78')]||0x1f4,'statusMessage':_0xce759e[_0x0d8b('0x79')]||_0x0d8b('0x7a'),'headers':_0xce759e['options'][_0x0d8b('0x6f')]||{},'body':_0xce759e[_0x0d8b('0x7b')]['body']||{}};_0x3a073b(null,_0x466442);});};AGIVertices[_0x0d8b('0xf')]['googleDialogflow']=function(_0x10ce36,_0x2db959){scripts[_0x0d8b('0x7c')](this[_0x0d8b('0xc')][_0x0d8b('0x39')],_0x10ce36[_0x0d8b('0x7d')],_0x10ce36[_0x0d8b('0x5b')],_0x10ce36[_0x0d8b('0x7e')]||'en')[_0x0d8b('0x12')](function(_0x20b36c){_0x2db959(null,_0x20b36c);})[_0x0d8b('0x14')](function(_0x1dcdf2){_0x2db959(_0x1dcdf2);});};AGIVertices['prototype']['sestekNDA']=function(_0x41baa2,_0x33f4cb){scripts[_0x0d8b('0x7f')](this[_0x0d8b('0xc')],_0x41baa2)[_0x0d8b('0x12')](function(_0x3c659e){_0x33f4cb(null,_0x3c659e);})[_0x0d8b('0x14')](function(_0x54674f){_0x33f4cb(_0x54674f);});};AGIVertices[_0x0d8b('0xf')]['ispeechTTS']=function(_0x161855,_0x55e8be){scripts['ispeechTTS'](_0x161855[_0x0d8b('0x7d')],_0x161855[_0x0d8b('0x5b')],_0x161855[_0x0d8b('0x80')]||_0x0d8b('0x5d'),_0x161855[_0x0d8b('0x81')])[_0x0d8b('0x12')](function(_0x3c7b9b){_0x55e8be(null,_0x3c7b9b);})[_0x0d8b('0x14')](function(_0x35267a){_0x55e8be(_0x35267a);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x82')]=function(_0x180539,_0x5e0f7e,_0x13ddfa){scripts[_0x0d8b('0x82')](_0x5e0f7e,_0x180539[_0x0d8b('0x7d')],_0x180539['ispeech_asr_language']||'en-US',this[_0x0d8b('0x83')](_0x180539[_0x0d8b('0x84')])?_0x180539[_0x0d8b('0x84')]:undefined)[_0x0d8b('0x12')](function(_0xae81df){_0x13ddfa(null,_0xae81df);})[_0x0d8b('0x14')](function(_0x5648eb){_0x13ddfa(_0x5648eb);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x85')]=function(_0x1c5e90,_0x365f75){scripts[_0x0d8b('0x85')](_0x1c5e90['aws_access_key_id'],_0x1c5e90['aws_secret_access_key'],_0x1c5e90[_0x0d8b('0x86')],_0x1c5e90[_0x0d8b('0x87')]||_0x0d8b('0x88'),_0x1c5e90['text'],_0x1c5e90[_0x0d8b('0x89')]||_0x0d8b('0x5b'))[_0x0d8b('0x12')](function(_0x586fc2){_0x365f75(null,_0x586fc2);})[_0x0d8b('0x14')](function(_0x3bc6d5){_0x365f75(_0x3bc6d5);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x8a')]=function(_0x6340d8,_0x150e9f){scripts[_0x0d8b('0x8a')](this[_0x0d8b('0xc')][_0x0d8b('0x39')],_0x6340d8['aws_access_key_id'],_0x6340d8[_0x0d8b('0x8b')],_0x6340d8[_0x0d8b('0x8c')],_0x6340d8[_0x0d8b('0x5b')],_0x6340d8[_0x0d8b('0x8d')])[_0x0d8b('0x12')](function(_0x12fa0a){_0x150e9f(null,_0x12fa0a);})[_0x0d8b('0x14')](function(_0x673201){_0x150e9f(_0x673201);});};AGIVertices[_0x0d8b('0xf')]['googleASR']=function(_0x4a6847,_0xeaf489,_0x3c6ae1){scripts[_0x0d8b('0x8e')](_0xeaf489,_0x4a6847[_0x0d8b('0x7d')],_0x4a6847['google_asr_language']||_0x0d8b('0x5d'))[_0x0d8b('0x12')](function(_0x4e7c89){_0x3c6ae1(null,_0x4e7c89);})[_0x0d8b('0x14')](function(_0x4e1b5b){_0x3c6ae1(_0x4e1b5b);});};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x8f')]=function(_0x33965a,_0x40c8c3,_0x36a82f){scripts[_0x0d8b('0x8f')](_0x40c8c3,_0x33965a[_0x0d8b('0x90')],_0x33965a[_0x0d8b('0x91')],_0x33965a['uri'])[_0x0d8b('0x12')](function(_0x5cc226){_0x36a82f(null,_0x5cc226);})['catch'](function(_0x35bd36){_0x36a82f(_0x35bd36);});};AGIVertices['prototype'][_0x0d8b('0x92')]=function(_0x1d53a3){var _0x4b1038=_[_0x0d8b('0x67')](verticesWithRetry,_0x1d53a3['agicommand'])?_0x1d53a3:_['clone'](_0x1d53a3);for(var _0x456642 in _0x4b1038){if(_0x4b1038[_0x0d8b('0x93')](_0x456642)){if(_0x4b1038[_0x456642]&&_[_0x0d8b('0x94')](_0x4b1038[_0x456642])){if(_[_0x0d8b('0x67')](recursiveMapAttributes,_0x456642)){_0x4b1038[_0x456642]=this[_0x0d8b('0x95')](_0x4b1038[_0x456642]);}else{_0x4b1038[_0x456642]=this['replaceAllVariables'](_0x4b1038[_0x456642]);}}}}return _0x4b1038;};AGIVertices['prototype'][_0x0d8b('0x96')]=function(_0x2e446a){for(var _0x411c15 in _0x2e446a){if(_0x2e446a[_0x0d8b('0x93')](_0x411c15)){if(_[_0x0d8b('0x97')](_0x2e446a[_0x411c15])){return this[_0x0d8b('0x96')](_0x2e446a[_0x411c15]);}_0x2e446a[_0x411c15]=this[_0x0d8b('0x98')](_0x2e446a[_0x411c15]);}}};AGIVertices[_0x0d8b('0xf')]['saveRestApiResult']=function(_0x5ab046,_0x3582d3){for(var _0x2640a6 in _0x5ab046){if(_0x5ab046['hasOwnProperty'](_0x2640a6)){if(_['isPlainObject'](_0x5ab046[_0x2640a6])){if(!_['isEmpty'](_0x5ab046[_0x2640a6])){this[_0x0d8b('0x99')](_0x5ab046[_0x2640a6],util[_0x0d8b('0x54')](_0x0d8b('0x9a'),_0x3582d3,_0x2640a6));}}else{if(_0x5ab046[_0x2640a6]){this['channel'][_0x0d8b('0x9b')](util[_0x0d8b('0x54')](_0x0d8b('0x9a'),_0x3582d3,_0x2640a6),_0x5ab046[_0x2640a6]);}}}}};AGIVertices['prototype'][_0x0d8b('0x95')]=function(_0x5385b5){try{var _0xa0cd19=JSON['parse'](_0x5385b5);this[_0x0d8b('0x96')](_0xa0cd19);return JSON[_0x0d8b('0x76')](_0xa0cd19);}catch(_0x43be3c){return this[_0x0d8b('0x98')](_0x5385b5);}};AGIVertices[_0x0d8b('0xf')]['replaceAllVariables']=function(_0x46f0dd){var _0x5b903a=_0x46f0dd[_0x0d8b('0x9c')]('{');for(var _0x4bd01c=0x1;_0x4bd01c<_0x5b903a[_0x0d8b('0x9d')];_0x4bd01c+=0x1){var _0x5f43d2=_0x5b903a[_0x4bd01c]['split']('}');if(_0x5f43d2[_0x0d8b('0x9d')]>0x1){_0x46f0dd=_0x46f0dd[_0x0d8b('0x9e')]('{'+_0x5f43d2[0x0]+'}',this['channel'][_0x0d8b('0x10')](_0x5f43d2[0x0])[_0x0d8b('0x9f')]||_0x5f43d2[0x0]);}}if(_0x5b903a[_0x0d8b('0x9d')]===0x1){return _0x46f0dd['toString']();}return this['replaceAllVariables'](_0x46f0dd);};AGIVertices['prototype'][_0x0d8b('0xa0')]=function(_0x410b2e,_0x313c47){var _0x442fee=this[_0x0d8b('0xc')][_0x0d8b('0x10')](_0x410b2e);if(_0x442fee[_0x0d8b('0xa1')]===-0x1){return _0x442fee;}logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0xa2'),_0x313c47,_0x442fee['extra']));return this[_0x0d8b('0xc')][_0x0d8b('0x9b')](_0x313c47,_0x442fee[_0x0d8b('0x9f')]);};AGIVertices['prototype'][_0x0d8b('0x83')]=function(_0x1da3d1){return _0x1da3d1&&_0x1da3d1!=='0'&&_0x1da3d1!=='-1'&&_0x1da3d1!=='';};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xa3')]=function(_0x299d0b){this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x299d0b,'-');_0x299d0b[_0x0d8b('0xa4')]=_0x299d0b[_0x0d8b('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xa5')]=function(_0x27968d){logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0xa6'),_0x27968d[_0x0d8b('0x36')]));return this[_0x0d8b('0xc')]['agi']([_0x27968d['command'],_0x27968d[_0x0d8b('0xa7')]]);};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xa8')]=function(_0x59698d){logger['info'](util['format'](_0x0d8b('0xa9'),_0x59698d['label']));if(this[_0x0d8b('0x83')](_0x59698d[_0x0d8b('0x66')])){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0xaa'),_0x59698d[_0x0d8b('0x66')]));var _0x104546=this[_0x0d8b('0xc')]['wait'](_0x59698d[_0x0d8b('0x66')]);if(_0x104546[_0x0d8b('0xa1')]===-0x1){return _0x104546;}}return this[_0x0d8b('0xc')][_0x0d8b('0xa8')]();};AGIVertices['prototype'][_0x0d8b('0xab')]=function(_0x62fedf){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x62fedf[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x62fedf[_0x0d8b('0xac')])){return this[_0x0d8b('0xc')]['error'](_0x62fedf,_0x0d8b('0xad'));}_0x62fedf['scheduledAt']=moment();if(this[_0x0d8b('0x83')](_0x62fedf['delay'])){_0x62fedf[_0x0d8b('0x4a')]=moment()['add'](_0x62fedf[_0x0d8b('0xae')],'minutes');}if(!this[_0x0d8b('0x83')](_0x62fedf['callback_priority'])){_0x62fedf[_0x0d8b('0xaf')]=0x2;}this['createCmContact'][_0x0d8b('0x72')](this,_0x62fedf);return this['channel'][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x62fedf['phone'],_0x62fedf['list_id'],_0x62fedf[_0x0d8b('0x4a')]));};AGIVertices['prototype'][_0x0d8b('0xb1')]=function(_0x485211){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0xb2'),_0x485211[_0x0d8b('0x36')]));var _0x451c73=this[_0x0d8b('0xc')]['exec'](_0x485211['application'],_0x485211[_0x0d8b('0x7b')]);if(_0x451c73['result']===-0x1){return _0x451c73;}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('Executed\x20command\x20%s\x20%s',_0x485211[_0x0d8b('0xb3')],_0x485211['options']));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xb4')]=function(_0xbc9b61){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0xb5'),_0xbc9b61[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0xbc9b61['text'])){return this[_0x0d8b('0xc')]['noop'](_0x0d8b('0xb6'));}var _0x28868a='\x22'+_0xbc9b61[_0x0d8b('0x5b')]+'\x22';if(this[_0x0d8b('0x83')](_0xbc9b61[_0x0d8b('0x7b')])){_0x28868a+=','+_0xbc9b61[_0x0d8b('0x7b')];}var _0x278b23=this[_0x0d8b('0xc')][_0x0d8b('0x57')](_0x0d8b('0xb7'),_0x28868a);if(_0x278b23[_0x0d8b('0xa1')]===-0x1){return _0x278b23;}return this[_0x0d8b('0xc')]['noop'](util[_0x0d8b('0x54')](_0x0d8b('0xb8'),_0x28868a));};AGIVertices['prototype'][_0x0d8b('0xb9')]=function(_0x592b9d){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0xba'),_0x592b9d['label']));if(!this['isConfigured'](_0x592b9d[_0x0d8b('0x5b')])){return this[_0x0d8b('0xc')]['noop']('no\x20text\x20configured');}var _0x5a7cdb='\x22'+_0x592b9d['text']+'\x22';if(this[_0x0d8b('0x83')](_0x592b9d[_0x0d8b('0x7b')])){_0x5a7cdb+=','+_0x592b9d[_0x0d8b('0x7b')];}var _0x29e8e6=this[_0x0d8b('0xc')][_0x0d8b('0x57')](_0x0d8b('0xb7'),_0x5a7cdb);if(_0x29e8e6[_0x0d8b('0xa1')]===-0x1){return _0x29e8e6;}return this['channel'][_0x0d8b('0xb0')](util['format'](_0x0d8b('0xb8'),_0x5a7cdb));};AGIVertices['prototype'][_0x0d8b('0xbb')]=function(_0x37e06f){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0xbc'),_0x37e06f[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x37e06f[_0x0d8b('0xbd')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xbe'));}var _0x36527c=_0x37e06f[_0x0d8b('0xbd')];if(this['isConfigured'](_0x37e06f[_0x0d8b('0x7b')])){_0x36527c+=','+_0x37e06f['options'];}var _0x4111e6=this[_0x0d8b('0xc')]['exec'](_0x0d8b('0xbf'),_0x36527c);if(_0x4111e6['result']===-0x1){return _0x4111e6;}var _0x21c950=this['getAndSetVariable'](_0x0d8b('0xc0'),_0x0d8b('0xc1'));if(_0x21c950[_0x0d8b('0xa1')]===-0x1){return _0x21c950;}var _0x3e7cc7=this[_0x0d8b('0xa0')](_0x0d8b('0xc2'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3e7cc7[_0x0d8b('0xa1')]===-0x1){return _0x3e7cc7;}var _0x4ec554=this[_0x0d8b('0xa0')](_0x0d8b('0xc3'),_0x0d8b('0xc4'));if(_0x4ec554[_0x0d8b('0xa1')]===-0x1){return _0x4ec554;}return this[_0x0d8b('0xc')]['noop'](util[_0x0d8b('0x54')](_0x0d8b('0xc5'),_0x36527c));};AGIVertices['prototype'][_0x0d8b('0xc6')]=function(_0x2edc22){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2edc22[_0x0d8b('0x36')]));if(!this['isConfigured'](_0x2edc22[_0x0d8b('0xbd')])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0xbe'));}var _0x5eed31=_0x2edc22[_0x0d8b('0xbd')];if(this[_0x0d8b('0x83')](_0x2edc22[_0x0d8b('0x7b')])){_0x5eed31+=','+_0x2edc22[_0x0d8b('0x7b')];}var _0x4ce0c9=this[_0x0d8b('0xc')]['exec'](_0x0d8b('0xbf'),_0x5eed31);if(_0x4ce0c9[_0x0d8b('0xa1')]===-0x1){return _0x4ce0c9;}var _0x55ecef=this[_0x0d8b('0xa0')](_0x0d8b('0xc0'),_0x0d8b('0xc7'));if(_0x55ecef[_0x0d8b('0xa1')]===-0x1){return _0x55ecef;}var _0x391e28=this[_0x0d8b('0xa0')](_0x0d8b('0xc2'),_0x0d8b('0xc8'));if(_0x391e28['result']===-0x1){return _0x391e28;}var _0x10a0a7=this['getAndSetVariable'](_0x0d8b('0xc3'),_0x0d8b('0xc9'));if(_0x10a0a7[_0x0d8b('0xa1')]===-0x1){return _0x10a0a7;}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0xc5'),_0x5eed31));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xca')]=function(_0x53bfe5){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x53bfe5[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x53bfe5['odbc_id'])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x53bfe5,_0x0d8b('0xcb'));}var _0xa8ab56=this[_0x0d8b('0xcc')][_0x0d8b('0x72')](this,_0x53bfe5[_0x0d8b('0xcd')]);if(!_0xa8ab56){return this[_0x0d8b('0xc')]['error'](_0x53bfe5,_0x0d8b('0xce'));}if(!this[_0x0d8b('0x83')](_0x53bfe5[_0x0d8b('0x2e')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x53bfe5,_0x0d8b('0xcf'));}var _0x32bff5=_0x53bfe5[_0x0d8b('0x2e')][_0x0d8b('0xd0')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format']('query:\x20%s',_0x32bff5));var _0x4f2e24=this['getQueryOdbc']['sync'](this,_0xa8ab56,_0x32bff5);this['createSquareDetailsReport'][_0x0d8b('0x72')](this,_0x53bfe5,_0x32bff5);if(!this['isConfigured'](_0x53bfe5[_0x0d8b('0xd1')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xd2'));}var _0x389aba=this[_0x0d8b('0x10')][_0x0d8b('0x72')](this,_0x53bfe5[_0x0d8b('0xd1')]);if(!_0x389aba){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x53bfe5,_0x0d8b('0xd3'));}var _0x38a2c4=this;_0x4f2e24['forEach'](function(_0xef49f4,_0x4dd8db){Object[_0x0d8b('0xd4')](_0xef49f4)['forEach'](function(_0x105cfe){_0x38a2c4[_0x0d8b('0xc')][_0x0d8b('0x9b')](util[_0x0d8b('0x54')](_0x0d8b('0xd5'),_0x389aba,_0x4dd8db,_0x105cfe),_0xef49f4[_0x105cfe]);});});this['channel'][_0x0d8b('0x9b')](util[_0x0d8b('0x54')]('%s_ROWS_COUNT',_0x389aba),_0x4f2e24[_0x0d8b('0x9d')]);return this['channel']['noop'](util[_0x0d8b('0x54')](_0x0d8b('0xd6'),_0x389aba));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xd7')]=function(_0x166f56){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x166f56[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x166f56[_0x0d8b('0xd8')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x166f56,_0x0d8b('0xd9'));}var _0x4c4cf2=this[_0x0d8b('0x1b')][_0x0d8b('0x72')](this,_0x166f56['sip_id']);if(!_0x4c4cf2){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x166f56,_0x0d8b('0xda'));}var _0xfe53a=this[_0x0d8b('0xc')]['exec']('DIAL',[util[_0x0d8b('0x54')](_0x0d8b('0xdb'),_0x4c4cf2),_0x166f56['timeout'],_0x166f56[_0x0d8b('0xdc')],_0x166f56[_0x0d8b('0x75')]]);if(_0xfe53a[_0x0d8b('0xa1')]===-0x1){return _0xfe53a;}return this['channel']['noop'](util[_0x0d8b('0x54')](_0x0d8b('0xdd'),'DIAL'));};AGIVertices['prototype'][_0x0d8b('0xde')]=function(_0x5a5d93){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0xdf'),_0x5a5d93[_0x0d8b('0x36')]));if(!this['isConfigured'](_0x5a5d93[_0x0d8b('0x7d')])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0xe0'));}if(!this[_0x0d8b('0x83')](_0x5a5d93[_0x0d8b('0x5b')])){return this[_0x0d8b('0xc')]['noop'](_0x0d8b('0xb6'));}this[_0x0d8b('0xc')][_0x0d8b('0xe1')]=!![];this['createSquareDetailsReport'](_0x5a5d93);this[_0x0d8b('0x42')](_0x5a5d93['text'],'in');this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format']('Trying\x20Dialogflow:\x20%s',_0x5a5d93['text']));var _0x24705e=this[_0x0d8b('0x7c')]['sync'](this,_0x5a5d93);if(_0x24705e){for(var _0x25acb5 in _0x24705e){if(_0x24705e['hasOwnProperty'](_0x25acb5)){this[_0x0d8b('0xc')][_0x0d8b('0x9b')](util[_0x0d8b('0x54')](_0x0d8b('0xe2'),_0x25acb5[_0x0d8b('0x6a')]()),_0x24705e[_0x25acb5]);}}this[_0x0d8b('0x42')](_0x24705e[_0x0d8b('0xe3')],_0x0d8b('0xe4'));return this['channel'][_0x0d8b('0xb0')](util['format']('Dialogflow\x20Result\x20%s',_0x24705e[_0x0d8b('0xe3')]));}return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x5a5d93,_0x0d8b('0xe5'));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xe6')]=function(_0x2098ed){logger['info'](util[_0x0d8b('0x54')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x2098ed['label']));if(!this[_0x0d8b('0x83')](_0x2098ed['ndauth_url'])){return this[_0x0d8b('0xc')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x0d8b('0x83')](_0x2098ed[_0x0d8b('0xe7')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xe8'));}if(!this[_0x0d8b('0x83')](_0x2098ed['password'])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0xe9'));}if(!this[_0x0d8b('0x83')](_0x2098ed[_0x0d8b('0xea')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xb6'));}this[_0x0d8b('0xc')][_0x0d8b('0xe1')]=!![];this[_0x0d8b('0x35')](_0x2098ed);this[_0x0d8b('0x42')](_0x2098ed[_0x0d8b('0x5b')],'in');this[_0x0d8b('0xc')]['noop'](util['format']('Trying\x20SestekNDA:\x20%s',_0x2098ed[_0x0d8b('0x5b')]));var _0x331d3f=this[_0x0d8b('0x7f')][_0x0d8b('0x72')](this,_0x2098ed);if(_0x331d3f){for(var _0xdf9aeb in _0x331d3f){if(_0x331d3f[_0x0d8b('0x93')](_0xdf9aeb)){this[_0x0d8b('0xc')][_0x0d8b('0x9b')](util[_0x0d8b('0x54')](_0x0d8b('0xeb'),_0xdf9aeb[_0x0d8b('0x6a')]()),_0x331d3f[_0xdf9aeb]);}}this[_0x0d8b('0x42')](_0x331d3f[_0x0d8b('0xe3')],_0x0d8b('0xe4'));if(_0x331d3f[_0x0d8b('0xec')]){this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x331d3f[_0x0d8b('0xec')]));var _0x4d41ea=this['channel']['streamFile'](_0x331d3f[_0x0d8b('0xec')]);try{fs[_0x0d8b('0xed')](_0x331d3f[_0x0d8b('0xec')]+_0x0d8b('0xee'));}catch(_0x31b4dc){logger['error'](_0x31b4dc);}return _0x4d41ea;}else{return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0xef'),_0x331d3f['speech']));}}return this['channel'][_0x0d8b('0x31')](_0x2098ed,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xf0')]=function(_0x4035cb){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0xf1'),_0x4035cb['label']));return this[_0x0d8b('0xc')]['noop'](_0x0d8b('0xf0'));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xf2')]=function(_0x855139){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x855139['label']));var _0x24d9d4='';if(_0x855139[_0x0d8b('0xf3')]){if(!this[_0x0d8b('0x83')](_0x855139[_0x0d8b('0xf3')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x855139,'no\x20trunk\x20selected');}else{var _0x495456=parseInt(_0x855139['trunk_id'],0xa);if(isNaN(_0x495456)){_0x24d9d4=_0x855139['trunk_id'];}else{_0x24d9d4=this[_0x0d8b('0x1d')][_0x0d8b('0x72')](this,_0x855139['trunk_id']);if(!_0x24d9d4){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x855139,_0x0d8b('0xf4'));}}}}else if(_0x855139[_0x0d8b('0xf5')]){_0x24d9d4=_0x855139[_0x0d8b('0xf5')];}else{return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x855139,'no\x20trunk\x20selected');}var _0x269724=this[_0x0d8b('0xc')][_0x0d8b('0x57')]('DIAL',[util[_0x0d8b('0x54')](_0x0d8b('0xf6'),_0x24d9d4,_0x855139[_0x0d8b('0x49')]),_0x855139[_0x0d8b('0x66')],_0x855139[_0x0d8b('0xdc')],_0x855139[_0x0d8b('0x75')]]);if(_0x269724[_0x0d8b('0xa1')]===-0x1){return _0x269724;}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0xf7')]=function(_0x1ddfb4){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0xf8'),_0x1ddfb4[_0x0d8b('0x36')]));return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xf7'));};AGIVertices['prototype']['getdigits']=function(_0x177758){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0xf9'),_0x177758['label']));if(_0x177758['retry']===0x0){return this[_0x0d8b('0xa3')](_0x177758);}_0x177758[_0x0d8b('0xa4')]-=0x1;if(!this[_0x0d8b('0x83')](_0x177758[_0x0d8b('0xfa')])){return this[_0x0d8b('0xc')]['error'](_0x177758,'no\x20file\x20audio\x20selected');}var _0x9e6f33=this[_0x0d8b('0xfb')][_0x0d8b('0x72')](this,_0x177758[_0x0d8b('0xfa')]);if(!_0x9e6f33){return this['channel'][_0x0d8b('0x31')](_0x177758,_0x0d8b('0xfc'));}if(!this[_0x0d8b('0x83')](_0x177758[_0x0d8b('0xd1')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3ac851=this[_0x0d8b('0xc')][_0x0d8b('0xfd')](_0x9e6f33,_0x177758['response'],_0x177758[_0x0d8b('0xfe')]);var _0xd37e13=_0x3ac851['result']?_0x3ac851['result'][_0x0d8b('0xff')]():'';logger[_0x0d8b('0x2c')](_0x0d8b('0x100'),JSON[_0x0d8b('0x76')](_0x3ac851));if(_0x3ac851[_0x0d8b('0xa1')]===-0x1){this['createSquareDetailsReport'][_0x0d8b('0x72')](this,_0x177758,_0xd37e13);return _0x3ac851;}else if(_0x3ac851[_0x0d8b('0x9f')]==='timeout'){_0x3ac851[_0x0d8b('0xa1')]=_0xd37e13[_0x0d8b('0x9d')]>=parseInt(_0x177758[_0x0d8b('0x101')])?'x':'i';}else{_0x3ac851[_0x0d8b('0xa1')]=_0xd37e13[_0x0d8b('0x9d')]>=parseInt(_0x177758['mindigit'])&&_0xd37e13['length']<=parseInt(_0x177758['maxdigit'])?'x':'i';}var _0x106aad=this['getVariable'][_0x0d8b('0x72')](this,_0x177758[_0x0d8b('0xd1')]);if(!_0x106aad){return this['channel'][_0x0d8b('0x31')](_0x177758,_0x0d8b('0xd3'));}this[_0x0d8b('0xc')]['setVariable'](_0x106aad,_0xd37e13);if(this['isConfigured'](_0x177758[_0x0d8b('0x102')])){var _0x4f6eb3=parseInt(_0x177758['hiddendigitsnum'],0xa);var _0x3dc01c=rs[_0x0d8b('0x103')]({'charset':'*','length':_0x4f6eb3});var _0x3158ab=_0xd37e13[_0x0d8b('0x9d')];if(_0x3158ab>0x0){if(_0x3158ab>_0x4f6eb3){this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x177758,_0x177758[_0x0d8b('0x104')]==='first'?_0x3dc01c+_0xd37e13[_0x0d8b('0x105')](_0x4f6eb3):_0xd37e13['substr'](0x0,_0x3158ab-_0x4f6eb3)+_0x3dc01c);}else{this[_0x0d8b('0x35')]['sync'](this,_0x177758,rs[_0x0d8b('0x103')]({'charset':'*','length':_0x3158ab}));}}else{this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x177758,'');}}else{this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x177758,_0xd37e13);}return _0x3ac851;};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x106')]=function(_0x58a292){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x107'),_0x58a292[_0x0d8b('0x36')]));return this[_0x0d8b('0xb')](_0x58a292);};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x108')]=function(_0x2a823a){logger['info'](util['format'](_0x0d8b('0x109'),_0x2a823a[_0x0d8b('0x36')]));this[_0x0d8b('0x35')]['sync'](this,_0x2a823a,_0x2a823a['goalname']);return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x10a'),_0x2a823a['goalname']));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x10b')]=function(_0xae8f7e){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x10c'),_0xae8f7e[_0x0d8b('0x36')]));if(!this['isConfigured'](_0xae8f7e[_0x0d8b('0x10d')])||!this[_0x0d8b('0x83')](_0xae8f7e[_0x0d8b('0x8b')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x10e'));}if(!this['isConfigured'](_0xae8f7e[_0x0d8b('0x5b')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')]('no\x20text\x20configured');}this[_0x0d8b('0xc')]['noop'](util[_0x0d8b('0x54')](_0x0d8b('0x10f'),_0xae8f7e[_0x0d8b('0x5b')]));var _0x3e6da8=this[_0x0d8b('0x85')]['sync'](this,_0xae8f7e);if(_0x3e6da8){this[_0x0d8b('0xc')]['noop'](util[_0x0d8b('0x54')]('aws\x20Polly\x20%s\x20file\x20created',_0x3e6da8));var _0x5c0e7d=this[_0x0d8b('0xc')][_0x0d8b('0x110')](_0x3e6da8);try{fs[_0x0d8b('0xed')](_0x3e6da8+'.wav');}catch(_0x191efc){logger[_0x0d8b('0x31')](_0x191efc);}return _0x5c0e7d;}return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0xae8f7e,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x0d8b('0x111')]=function(_0x581358){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x112'),_0x581358[_0x0d8b('0x36')]));if(!this['isConfigured'](_0x581358[_0x0d8b('0x10d')])||!this[_0x0d8b('0x83')](_0x581358['aws_secret_access_key'])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0x10e'));}if(!this['isConfigured'](_0x581358[_0x0d8b('0x8d')])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0x113'));}if(!this['isConfigured'](_0x581358[_0x0d8b('0x5b')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xb6'));}this[_0x0d8b('0xc')][_0x0d8b('0xe1')]=!![];this[_0x0d8b('0x35')](_0x581358);this[_0x0d8b('0x42')](_0x581358[_0x0d8b('0x5b')],'in');this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x114'),_0x581358[_0x0d8b('0x5b')]));var _0x51720f=this[_0x0d8b('0x8a')][_0x0d8b('0x72')](this,_0x581358);if(_0x51720f){for(var _0x1c42f1 in _0x51720f){if(_0x51720f[_0x0d8b('0x93')](_0x1c42f1)&&_[_0x0d8b('0x94')](_0x51720f[_0x1c42f1])){this['channel']['setVariable'](util['format'](_0x0d8b('0x115'),_0x1c42f1['toUpperCase']()),_0x51720f[_0x1c42f1]);}}if(_['isNil'](_0x51720f['message'])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0x116'));}else{this['createSquareMessage'](_0x51720f[_0x0d8b('0x79')],_0x0d8b('0xe4'));return this['channel'][_0x0d8b('0xb0')](util['format'](_0x0d8b('0x117'),_0x51720f[_0x0d8b('0x79')]));}}return this[_0x0d8b('0xc')]['error'](_0x581358,_0x0d8b('0x118'));};AGIVertices[_0x0d8b('0xf')]['googleasr']=function(_0x497ed7){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x497ed7[_0x0d8b('0x36')],_0x497ed7[_0x0d8b('0x66')]));if(!this[_0x0d8b('0x83')](_0x497ed7['key'])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xe0'));}var _0x5081d1=_0x0d8b('0x119');var _0xd50f7e=util[_0x0d8b('0x54')](_0x0d8b('0x11a'),FILES_PATH,rs['generate'](0x4));var _0x8462ee=util['format']('%s.%s',_0xd50f7e,_0x5081d1);var _0x3f5145=!![];if(_0x497ed7[_0x0d8b('0x11b')]===_0x0d8b('0x11c')){_0x3f5145=![];}var _0x596ea9=this[_0x0d8b('0xc')][_0x0d8b('0x11d')](_0xd50f7e,_0x5081d1,_0x497ed7['intKey'],_0x497ed7[_0x0d8b('0x66')],undefined,_0x3f5145);if(_0x596ea9['result']!==-0x1){this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format'](_0x0d8b('0x11e'),_0x8462ee));var _0x3a1b9c=this[_0x0d8b('0x8e')][_0x0d8b('0x72')](this,_0x497ed7,_0x8462ee);if(_0x3a1b9c){for(var _0x3a52ce in _0x3a1b9c){if(_0x3a1b9c['hasOwnProperty'](_0x3a52ce)){this['channel']['setVariable'](util[_0x0d8b('0x54')](_0x0d8b('0x11f'),_0x3a52ce[_0x0d8b('0x6a')]()),_0x3a1b9c[_0x3a52ce]);}}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x120'),JSON[_0x0d8b('0x76')](_0x3a1b9c)));}}return _0x596ea9;};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x121')]=function(_0x12733c){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x122'),_0x12733c['label']));if(!this[_0x0d8b('0x83')](_0x12733c[_0x0d8b('0x90')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x123'));}if(!this[_0x0d8b('0x83')](_0x12733c['appsecret'])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')]('no\x20appsecret\x20configured');}var _0x234ab3=_0x0d8b('0x119');var _0x7c8294=util[_0x0d8b('0x54')](_0x0d8b('0x11a'),FILES_PATH,rs[_0x0d8b('0x103')](0x4));var _0x11eb1f=util[_0x0d8b('0x54')]('%s.%s',_0x7c8294,_0x234ab3);var _0xce94b4=!![];if(_0x12733c[_0x0d8b('0x11b')]===_0x0d8b('0x11c')){_0xce94b4=![];}var _0x1309fa=this[_0x0d8b('0xc')]['recordFile'](_0x7c8294,_0x234ab3,_0x12733c['intKey'],_0x12733c[_0x0d8b('0x66')],undefined,_0xce94b4);if(_0x1309fa[_0x0d8b('0xa1')]!==-0x1){this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('tilde\x20%s\x20file\x20created',_0x11eb1f));var _0x3ad012=this[_0x0d8b('0x8f')]['sync'](this,_0x12733c,_0x11eb1f);if(_0x3ad012){for(var _0x462f3 in _0x3ad012){if(_0x3ad012['hasOwnProperty'](_0x462f3)){this[_0x0d8b('0xc')]['setVariable'](util[_0x0d8b('0x54')]('TILDE_ASR_%s',_0x462f3['toUpperCase']()),_0x3ad012[_0x462f3]);}}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x3ad012)));}}return _0x1309fa;};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x124')]=function(_0x33c6ff){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x125'),_0x33c6ff['label']));return this[_0x0d8b('0xc')]['continueAt'](_0x33c6ff[_0x0d8b('0x3b')],_0x33c6ff['extension'],_0x33c6ff[_0x0d8b('0x3d')]);};AGIVertices['prototype'][_0x0d8b('0x126')]=function(_0x47fa7){logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x127'),_0x47fa7[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x47fa7[_0x0d8b('0x128')])){return this[_0x0d8b('0xc')]['error'](_0x47fa7,'no\x20condition\x20configured');}try{var _0x2a40ef=eval(_0x47fa7[_0x0d8b('0x128')])?_0x0d8b('0x129'):_0x0d8b('0x12a');this['channel']['noop'](util[_0x0d8b('0x54')](_0x0d8b('0x12b'),_0x47fa7['condition'],_0x2a40ef));return{'code':0xc8,'result':_0x2a40ef};}catch(_0x31c11e){return{'code':0xc8,'result':_0x0d8b('0x12a')};}};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x12c')]=function(_0x41a871){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x12d'),_0x41a871[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x41a871[_0x0d8b('0x12e')])){return this['channel'][_0x0d8b('0x31')](_0x41a871,'no\x20interval\x20configured');}var _0x424546=this['getIntervals'][_0x0d8b('0x72')](this,_0x41a871[_0x0d8b('0x12e')]);if(!_0x424546){return this['channel'][_0x0d8b('0x31')](_0x41a871,_0x0d8b('0x12f'));}for(var _0x550ff5=0x0;_0x550ff5<_0x424546[_0x0d8b('0x9d')];_0x550ff5+=0x1){var _0x4d94b0=this[_0x0d8b('0xc')][_0x0d8b('0x10')](util[_0x0d8b('0x54')]('IFTIME(%s?true:false)',_0x424546[_0x550ff5]));if(_0x4d94b0[_0x0d8b('0xa1')]===-0x1){return _0x4d94b0;}logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x130'),_0x424546[_0x550ff5],_0x4d94b0[_0x0d8b('0x9f')]));if(_0x4d94b0[_0x0d8b('0x9f')]===_0x0d8b('0x129')){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('IFTIME\x20%s\x20%s',_0x424546[_0x550ff5],_0x0d8b('0x129')));this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format'](_0x0d8b('0x130'),_0x424546[_0x550ff5],_0x0d8b('0x129')));return{'code':0xc8,'result':'true'};}else{logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x130'),_0x424546[_0x550ff5],_0x0d8b('0x12a')));this[_0x0d8b('0xc')]['noop'](util[_0x0d8b('0x54')](_0x0d8b('0x130'),_0x424546[_0x550ff5],'false'));}}return{'code':0xc8,'result':_0x0d8b('0x12a')};};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x131')]=function(_0x4131f6){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x132'),_0x4131f6['label']));return this[_0x0d8b('0xc')]['hangup']();};AGIVertices['prototype'][_0x0d8b('0x133')]=function(_0x5595a3){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x5595a3[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x5595a3[_0x0d8b('0x7d')])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0xe0'));}var _0x4fd6bd=_0x0d8b('0x119');var _0x5865d5=util[_0x0d8b('0x54')](_0x0d8b('0x11a'),FILES_PATH,rs[_0x0d8b('0x103')](0x4));var _0x3209ae=util['format'](_0x0d8b('0x9a'),_0x5865d5,_0x4fd6bd);var _0x446403=!![];if(_0x5595a3[_0x0d8b('0x11b')]==='NOBEEP'){_0x446403=![];}var _0x520bcb=this[_0x0d8b('0xc')][_0x0d8b('0x11d')](_0x5865d5,_0x4fd6bd,_0x5595a3[_0x0d8b('0x134')],_0x5595a3['timeout'],undefined,_0x446403);if(_0x520bcb[_0x0d8b('0xa1')]!==-0x1){this['channel']['noop'](util[_0x0d8b('0x54')](_0x0d8b('0x135'),_0x3209ae));var _0x2c036f=this[_0x0d8b('0x82')][_0x0d8b('0x72')](this,_0x5595a3,_0x3209ae);if(_0x2c036f){for(var _0x4eaa8f in _0x2c036f){if(_0x2c036f['hasOwnProperty'](_0x4eaa8f)){this[_0x0d8b('0xc')][_0x0d8b('0x9b')](util[_0x0d8b('0x54')]('ISPEECH_ASR_%s',_0x4eaa8f[_0x0d8b('0x6a')]()),_0x2c036f[_0x4eaa8f]);}}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x136'),JSON['stringify'](_0x2c036f)));}}return _0x520bcb;};AGIVertices[_0x0d8b('0xf')]['ispeechtts']=function(_0x383c62){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x137'),_0x383c62[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x383c62[_0x0d8b('0x7d')])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0xe0'));}if(!this[_0x0d8b('0x83')](_0x383c62[_0x0d8b('0x5b')])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0xb6'));}this['channel'][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x138'),_0x383c62[_0x0d8b('0x5b')]));var _0x727868=this['ispeechTTS'][_0x0d8b('0x72')](this,_0x383c62);if(_0x727868){this['channel']['noop'](util[_0x0d8b('0x54')](_0x0d8b('0x135'),_0x727868));var _0xd8d8ae=this[_0x0d8b('0xc')][_0x0d8b('0x110')](_0x727868,_0x383c62[_0x0d8b('0x134')]);try{fs[_0x0d8b('0xed')](_0x727868+_0x0d8b('0xee'));}catch(_0x4887dd){logger[_0x0d8b('0x31')](_0x4887dd);}return _0xd8d8ae;}return this[_0x0d8b('0xc')]['error'](_0x383c62,_0x0d8b('0x139'));};AGIVertices['prototype'][_0x0d8b('0x13a')]=function(_0x54411a){logger['info'](util['format'](_0x0d8b('0x13b'),_0x54411a[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x54411a['findBy'])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x54411a,_0x0d8b('0x13c'));}logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x54411a[_0x0d8b('0x13d')]));var _0x39c27b=this[_0x0d8b('0x52')][_0x0d8b('0x72')](this,_0x54411a[_0x0d8b('0x13d')]);if(_0x39c27b){logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x13e'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x54411a['findBy']));this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x13e'),this[_0x0d8b('0xc')]['callerid'],_0x54411a[_0x0d8b('0x13d')]));return{'code':0xc8,'result':_0x0d8b('0x13f')};}else{logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x140'),this['channel'][_0x0d8b('0x38')],_0x54411a[_0x0d8b('0x13d')]));this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0d8b('0xc')]['callerid'],_0x54411a[_0x0d8b('0x13d')]));return{'code':0xc8,'result':_0x0d8b('0x141')};}};AGIVertices[_0x0d8b('0xf')]['logout']=function(_0x31bf52){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x142'),_0x31bf52[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x31bf52[_0x0d8b('0x13d')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x31bf52,_0x0d8b('0x13c'));}logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x143'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x31bf52[_0x0d8b('0x13d')]));var _0x43193a=this[_0x0d8b('0x51')][_0x0d8b('0x72')](this,_0x31bf52[_0x0d8b('0x13d')]);if(_0x43193a){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x31bf52[_0x0d8b('0x13d')]));this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x31bf52[_0x0d8b('0x13d')]));return{'code':0xc8,'result':_0x0d8b('0x13f')};}else{logger['info'](util[_0x0d8b('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x31bf52[_0x0d8b('0x13d')]));this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x140'),this[_0x0d8b('0xc')]['callerid'],_0x31bf52[_0x0d8b('0x13d')]));return{'code':0xc8,'result':_0x0d8b('0x141')};}};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x144')]=function(_0x3aab9b){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x145'),_0x3aab9b[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x3aab9b['operation'])){return this['channel'][_0x0d8b('0x31')](_0x3aab9b,'no\x20operation\x20configured');}this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('math\x20%s',_0x3aab9b[_0x0d8b('0x146')]));var _0x2b6ad3=eval(_0x3aab9b[_0x0d8b('0x146')]);if(!this[_0x0d8b('0x83')](_0x3aab9b[_0x0d8b('0xd1')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4c26a4=this[_0x0d8b('0x10')][_0x0d8b('0x72')](this,_0x3aab9b['variable_id']);if(!_0x4c26a4){return this[_0x0d8b('0xc')]['error'](_0x3aab9b,'no\x20variable\x20found');}if(_[_0x0d8b('0x147')](_0x2b6ad3)){var _0x5f57cb=this;_0x2b6ad3[_0x0d8b('0x148')](function(_0x12af1e,_0x254227){_0x5f57cb[_0x0d8b('0xc')][_0x0d8b('0x9b')](util[_0x0d8b('0x54')](_0x0d8b('0x149'),_0x4c26a4,_0x254227),_0x12af1e);});return this['channel'][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x14a'),_0x4c26a4));}else{return this[_0x0d8b('0xc')][_0x0d8b('0x9b')](_0x4c26a4,_0x2b6ad3);}};AGIVertices['prototype'][_0x0d8b('0xa')]=function(_0x1759a6){logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x14b'),_0x1759a6[_0x0d8b('0x36')]));if(_0x1759a6[_0x0d8b('0xa4')]===0x0){return this['maxRetry'](_0x1759a6);}_0x1759a6[_0x0d8b('0xa4')]-=0x1;if(!this[_0x0d8b('0x83')](_0x1759a6['file_id'])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x1759a6,_0x0d8b('0x14c'));}var _0x2a922b=this[_0x0d8b('0xfb')][_0x0d8b('0x72')](this,_0x1759a6['file_id']);if(!_0x2a922b){return this['channel'][_0x0d8b('0x31')](_0x1759a6,_0x0d8b('0xfc'));}var _0x5dfacc=this[_0x0d8b('0xc')]['getData'](_0x2a922b,_0x1759a6[_0x0d8b('0x14d')],_0x1759a6[_0x0d8b('0x14e')]);var _0x2f2390=_0x5dfacc[_0x0d8b('0xa1')];if(_0x5dfacc[_0x0d8b('0xa1')]===-0x1){this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x1759a6,'-1');return _0x5dfacc;}else if(_0x5dfacc[_0x0d8b('0x9f')]===_0x0d8b('0x66')){_0x5dfacc['result']=_0x5dfacc[_0x0d8b('0xa1')][_0x0d8b('0x9d')]>0x0?_0x5dfacc['result']:'t';}else if(_['isEmpty'](_0x5dfacc[_0x0d8b('0xa1')])){_0x5dfacc['result']='#';_0x2f2390='#';}if(!this[_0x0d8b('0x83')](_0x1759a6[_0x0d8b('0xd1')])){this[_0x0d8b('0xc')]['noop'](_0x0d8b('0xd2'));}else{var _0x23d83c=this[_0x0d8b('0x10')][_0x0d8b('0x72')](this,_0x1759a6[_0x0d8b('0xd1')]);if(!_0x23d83c){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x1759a6,'no\x20variable\x20found');}this[_0x0d8b('0xc')]['setVariable'](_0x23d83c,_0x2f2390);}this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x1759a6,_0x2f2390);return _0x5dfacc;};AGIVertices['prototype'][_0x0d8b('0xb0')]=function(_0x5b0258){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x14f'),_0x5b0258[_0x0d8b('0x36')]));return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x5b0258[_0x0d8b('0x150')]||_0x5b0258[_0x0d8b('0x36')]);};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x151')]=function(_0x4d4ecd){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x152'),_0x4d4ecd['label']));if(!this[_0x0d8b('0x83')](_0x4d4ecd[_0x0d8b('0x13d')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x4d4ecd,'no\x20find\x20by\x20configured');}logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x143'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x4d4ecd[_0x0d8b('0x13d')]));var _0x22d143=this[_0x0d8b('0x4c')]['sync'](this,_0x4d4ecd[_0x0d8b('0x153')]);var _0x4bafa1=this[_0x0d8b('0x4e')]['sync'](this,_0x4d4ecd[_0x0d8b('0x13d')],_0x22d143);if(_0x4bafa1){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x13e'),this[_0x0d8b('0xc')]['callerid'],_0x4d4ecd[_0x0d8b('0x13d')]));this['channel'][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x13e'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x4d4ecd['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x140'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x4d4ecd['findBy']));this[_0x0d8b('0xc')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x4d4ecd['findBy']));return{'code':0xc8,'result':_0x0d8b('0x141')};}};AGIVertices['prototype']['playback']=function(_0x4b002e){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x154'),_0x4b002e[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x4b002e[_0x0d8b('0xfa')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x4b002e,_0x0d8b('0x14c'));}var _0x1dd4e1=this[_0x0d8b('0xfb')]['sync'](this,_0x4b002e[_0x0d8b('0xfa')]);if(!_0x1dd4e1){return this[_0x0d8b('0xc')]['error'](_0x4b002e,_0x0d8b('0xfc'));}var _0x5f58e0=this[_0x0d8b('0xc')][_0x0d8b('0x57')](_0x0d8b('0x155'),[_0x1dd4e1,_0x4b002e[_0x0d8b('0xdc')]]);if(_0x5f58e0[_0x0d8b('0xa1')]===-0x1){return _0x5f58e0;}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format'](_0x0d8b('0x156'),_0x0d8b('0x155'),_0x1dd4e1));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x157')]=function(_0x2d6f7d){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x158'),_0x2d6f7d[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x2d6f7d[_0x0d8b('0x159')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x2d6f7d,'no\x20queue\x20selected');}var _0x582a09='';var _0x2259a6=parseInt(_0x2d6f7d['queue_id'],0xa);if(isNaN(_0x2259a6)){_0x582a09=_0x2d6f7d[_0x0d8b('0x159')];}else{_0x582a09=this[_0x0d8b('0x15')][_0x0d8b('0x72')](this,_0x2d6f7d[_0x0d8b('0x159')]);if(!_0x582a09){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x2d6f7d,_0x0d8b('0x15a'));}}var _0x3de7b8='';if(this['isConfigured'](_0x2d6f7d[_0x0d8b('0xfa')])){var _0x315949=this[_0x0d8b('0xfb')][_0x0d8b('0x72')](this,_0x2d6f7d[_0x0d8b('0xfa')]);if(_0x315949){_0x3de7b8=_0x315949;}}this[_0x0d8b('0x35')]['sync'](this,_0x2d6f7d,_0x582a09);if(_0x2d6f7d[_0x0d8b('0xdc')]['indexOf']('x')<0x0){_0x2d6f7d[_0x0d8b('0xdc')]+='x';}if(_0x2d6f7d['opts'][_0x0d8b('0x15b')]('X')<0x0){_0x2d6f7d[_0x0d8b('0xdc')]+='X';}this[_0x0d8b('0xc')]['setVariable']('XMCS-QUEUE',_0x582a09?_0x582a09[_0x0d8b('0x15c')]():'');var _0x202643=this[_0x0d8b('0xc')][_0x0d8b('0x57')]('QUEUE',[_0x582a09,_0x2d6f7d[_0x0d8b('0xdc')],_0x2d6f7d[_0x0d8b('0x75')],_0x3de7b8,_0x2d6f7d[_0x0d8b('0x66')],_0x2d6f7d['agi'],_0x2d6f7d[_0x0d8b('0x15d')],_0x2d6f7d[_0x0d8b('0x15e')],'',_0x2d6f7d['position']]);if(_0x202643[_0x0d8b('0xa1')]===-0x1){return _0x202643;}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x156'),_0x0d8b('0x15f'),_0x582a09));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x160')]=function(_0x213f42){logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x161'),_0x213f42[_0x0d8b('0x36')]));var _0x4b7843=_0x213f42[_0x0d8b('0x162')]||_0x0d8b('0x119');var _0x180500=util[_0x0d8b('0x54')](_0x0d8b('0x163'),this[_0x0d8b('0xc')]['uniqueid'],rs['generate'](0x5));var _0x1f993c=util[_0x0d8b('0x54')]('%s/recordings/%s.%s',FILES_PATH,_0x180500,_0x4b7843);var _0x3cf675=util[_0x0d8b('0x54')](_0x0d8b('0x11a'),FILES_PATH,_0x180500);this['createSquareRecording']['sync'](this,_0x213f42,_0x180500,_0x1f993c);this[_0x0d8b('0xc')][_0x0d8b('0x9b')](_0x0d8b('0x164'),_0x180500);logger[_0x0d8b('0x2c')](_0x0d8b('0x165'),_0x3cf675,_0x4b7843,_0x213f42[_0x0d8b('0x166')],_0x213f42['timeout']);return this[_0x0d8b('0xc')][_0x0d8b('0x11d')](_0x3cf675,_0x4b7843,_0x213f42[_0x0d8b('0x166')],_0x213f42[_0x0d8b('0x66')],undefined,!![]);};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x167')]=function(_0x13edd3){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x168'),_0x13edd3[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x13edd3['url'])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x169'));}var _0x49fcac=this[_0x0d8b('0x64')][_0x0d8b('0x72')](this,_0x13edd3);logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x16a'),util['inspect'](_0x49fcac,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x13edd3[_0x0d8b('0xd1')])){return this[_0x0d8b('0xc')]['noop'](_0x0d8b('0x16b'));}var _0x2aeed7=this[_0x0d8b('0x10')]['sync'](this,_0x13edd3[_0x0d8b('0xd1')]);if(!_0x2aeed7){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x13edd3,_0x0d8b('0xd3'));}this[_0x0d8b('0xc')][_0x0d8b('0x9b')](util['format'](_0x0d8b('0x16c'),_0x2aeed7),_0x49fcac[_0x0d8b('0x78')]?_0x49fcac['statusCode']:'200');this['channel'][_0x0d8b('0x9b')](util[_0x0d8b('0x54')](_0x0d8b('0x16d'),_0x2aeed7),_0x49fcac[_0x0d8b('0x16e')]?_0x49fcac[_0x0d8b('0x16e')]:'OK');if(_0x49fcac[_0x0d8b('0x6b')]){try{this[_0x0d8b('0x99')](_0x49fcac[_0x0d8b('0x6b')],_0x2aeed7);}catch(_0x4cc8ec){logger[_0x0d8b('0x31')](util['format'](_0x0d8b('0x16f'),_0x2aeed7));}}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format'](_0x0d8b('0xd6'),_0x2aeed7));};AGIVertices['prototype'][_0x0d8b('0x170')]=function(_0x46ba78){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x171'),_0x46ba78[_0x0d8b('0x36')]));return this['channel'][_0x0d8b('0x172')](_0x46ba78[_0x0d8b('0x173')]['replace'](/\s+/g,''),_0x46ba78[_0x0d8b('0x166')]);};AGIVertices['prototype'][_0x0d8b('0x174')]=function(_0x4ead95){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x175'),_0x4ead95[_0x0d8b('0x36')]));return this[_0x0d8b('0xc')]['sayNumber'](_0x4ead95[_0x0d8b('0x176')][_0x0d8b('0xd0')](/\s+/g,''),_0x4ead95['escape_digits']);};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x177')]=function(_0x2874f6){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x178'),_0x2874f6[_0x0d8b('0x36')]));return this[_0x0d8b('0xc')][_0x0d8b('0x179')](_0x2874f6[_0x0d8b('0x5b')],_0x2874f6['escape_digits']);};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x17a')]=function(_0x717f31){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x717f31[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x717f31[_0x0d8b('0x17b')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x17c'));}var _0x101635=this[_0x0d8b('0x21')][_0x0d8b('0x72')](this,_0x717f31[_0x0d8b('0x17b')]);if(!_0x101635||!_0x101635[_0x0d8b('0x17d')]){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x717f31,'no\x20mail\x20account\x20found');}var _0x52402c={'from':util[_0x0d8b('0x54')](_0x0d8b('0x17e'),_0x101635[_0x0d8b('0x13')],_0x101635['email']||_0x101635[_0x0d8b('0x17d')]['user']),'to':_0x717f31['to']||'','cc':_0x717f31['cc']||'','bcc':_0x717f31[_0x0d8b('0x17f')]||'','subject':_0x717f31[_0x0d8b('0x180')],'html':_0x717f31['text'],'text':_0x717f31[_0x0d8b('0x5b')]};var _0x4f1bfc={'tls':{'rejectUnauthorized':![]}};if(_0x101635[_0x0d8b('0x17d')][_0x0d8b('0x181')]){_0x4f1bfc[_0x0d8b('0x181')]=_0x101635['Smtp']['service'];}else{_0x4f1bfc['host']=_0x101635[_0x0d8b('0x17d')][_0x0d8b('0x182')];_0x4f1bfc['port']=_0x101635[_0x0d8b('0x17d')][_0x0d8b('0x183')];_0x4f1bfc['secure']=_0x101635[_0x0d8b('0x17d')][_0x0d8b('0x184')];}if(_0x101635[_0x0d8b('0x17d')][_0x0d8b('0x185')]){_0x4f1bfc[_0x0d8b('0x186')]={'user':_0x101635[_0x0d8b('0x17d')][_0x0d8b('0x187')],'pass':_0x101635[_0x0d8b('0x17d')][_0x0d8b('0x188')]};}if(this['isConfigured'](_0x717f31[_0x0d8b('0x189')])){}logger[_0x0d8b('0x18a')]('sendMail\x20message',JSON[_0x0d8b('0x76')](_0x52402c));this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x717f31,_0x717f31[_0x0d8b('0x17b')]);this['channel'][_0x0d8b('0xb0')](util['format'](_0x0d8b('0x18b'),_0x101635['name']));this[_0x0d8b('0x23')]['sync'](this,_0x4f1bfc,_0x52402c);return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x18c'));};AGIVertices['prototype'][_0x0d8b('0x18d')]=function(_0x20a278){logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x18e'),_0x20a278['label']));return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x18f'));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x190')]=function(_0x2be9db){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x191'),_0x2be9db[_0x0d8b('0x36')]));if(!this['isConfigured'](_0x2be9db[_0x0d8b('0x192')])){return this[_0x0d8b('0xc')]['noop'](_0x0d8b('0x193'));}var _0x3ee15c=this[_0x0d8b('0x194')][_0x0d8b('0x72')](this,_0x2be9db['sms_account_id']);if(!_0x3ee15c){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x2be9db,_0x0d8b('0x195'));}var _0xb80b30={'body':_0x2be9db[_0x0d8b('0x196')],'phone':_0x2be9db['to']||'','SmsAccountId':_0x3ee15c['id']};logger[_0x0d8b('0x18a')](_0x0d8b('0x197'),JSON['stringify'](_0xb80b30));this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x2be9db,_0x2be9db[_0x0d8b('0x192')]);this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format'](_0x0d8b('0x198'),_0x3ee15c[_0x0d8b('0x13')]));this[_0x0d8b('0x34')][_0x0d8b('0x72')](this,_0xb80b30);return this['channel'][_0x0d8b('0xb0')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x199')]=function(_0x255ff1){logger['info'](util[_0x0d8b('0x54')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x255ff1[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x255ff1[_0x0d8b('0xd1')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x255ff1,_0x0d8b('0x19a'));}var _0x11f372=this[_0x0d8b('0x10')][_0x0d8b('0x72')](this,_0x255ff1['variable_id']);if(!_0x11f372){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x255ff1,_0x0d8b('0xd3'));}return this[_0x0d8b('0xc')][_0x0d8b('0x9b')](_0x11f372,_0x255ff1['variable_value']);};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x19b')]=function(_0x18236c){logger['info'](util[_0x0d8b('0x54')]('Enter\x20in\x20START\x20(%s)\x20block',_0x18236c[_0x0d8b('0x36')]));this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x19c'));if(_0x18236c[_0x0d8b('0xa8')]==='yes'){this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x19d'));return this[_0x0d8b('0xc')][_0x0d8b('0xa8')]();}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0x19e'));};AGIVertices[_0x0d8b('0xf')][_0x0d8b('0x19f')]=function(_0x588aa8){logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x1a0'),_0x588aa8['label']));if(!this[_0x0d8b('0x83')](_0x588aa8[_0x0d8b('0x1a1')])){return this[_0x0d8b('0xc')]['error'](_0x588aa8,_0x0d8b('0x1a2'));}var _0x129bc6=this['getSquareProject']['sync'](this,_0x588aa8['project_id']);if(!this[_0x0d8b('0x83')](_0x129bc6)){return this['channel']['error'](_0x588aa8,util[_0x0d8b('0x54')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x588aa8[_0x0d8b('0x1a1')]));}if(_0x129bc6===this[_0x0d8b('0xc')][_0x0d8b('0x40')]){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x588aa8,_0x0d8b('0x1a3'));}this[_0x0d8b('0x35')][_0x0d8b('0x72')](this,_0x588aa8,_0x129bc6);var _0x489440=this[_0x0d8b('0xc')][_0x0d8b('0x57')](_0x0d8b('0x1a4'),util['format'](_0x0d8b('0x1a5'),config['agi'][_0x0d8b('0x182')]||_0x0d8b('0x1a6'),_0x129bc6,this[_0x0d8b('0xc')][_0x0d8b('0x40')]));if(_0x489440[_0x0d8b('0xa1')]===-0x1){return _0x489440;}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x156'),_0x0d8b('0x1a4'),_0x129bc6));};AGIVertices['prototype']['system']=function(_0x15ce1c){logger['info'](util[_0x0d8b('0x54')](_0x0d8b('0x1a7'),_0x15ce1c['label']));var _0x451bbf=this['shellCommand'][_0x0d8b('0x72')](this,_0x15ce1c[_0x0d8b('0x1a8')]);this['createSquareDetailsReport']['sync'](this,_0x15ce1c,_0x15ce1c[_0x0d8b('0x1a8')]);if(this[_0x0d8b('0x83')](_0x15ce1c[_0x0d8b('0xd1')])){var _0x2e1ee3=this[_0x0d8b('0x10')][_0x0d8b('0x72')](this,_0x15ce1c[_0x0d8b('0xd1')]);if(_0x2e1ee3){this[_0x0d8b('0xc')]['setVariable'](_0x2e1ee3,_0x451bbf);return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x1a9'),_0x15ce1c[_0x0d8b('0x1a8')],_0x2e1ee3));}}return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x15ce1c[_0x0d8b('0x1a8')]));};AGIVertices['prototype'][_0x0d8b('0x1aa')]=function(_0x4eb8d4){logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x1ab'),_0x4eb8d4[_0x0d8b('0x36')]));if(!this[_0x0d8b('0x83')](_0x4eb8d4['apiKey'])){return this['channel'][_0x0d8b('0xb0')](_0x0d8b('0x1ac'));}if(!this['isConfigured'](_0x4eb8d4[_0x0d8b('0x5b')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xb6'));}this['channel'][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x1ad'),_0x4eb8d4[_0x0d8b('0x5b')]));var _0x3a8f92=this['googleCloudTTS'][_0x0d8b('0x72')](this,_0x4eb8d4);if(_0x3a8f92){this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x1ae'),_0x3a8f92));var _0xaadc09=this[_0x0d8b('0xc')]['streamFile'](_0x3a8f92);try{fs['unlink'](_0x3a8f92+'.wav');}catch(_0x34f9ce){logger[_0x0d8b('0x31')](_0x34f9ce);}return _0xaadc09;}return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x4eb8d4,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0d8b('0xf')]['tts']=function(_0x16c74c){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x1af'),_0x16c74c[_0x0d8b('0x36')]));if(!this['isConfigured'](_0x16c74c[_0x0d8b('0x5b')])){return this[_0x0d8b('0xc')][_0x0d8b('0xb0')](_0x0d8b('0xb6'));}this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x1b0'),_0x16c74c['text']));var _0x14aa6a=this[_0x0d8b('0x62')]['sync'](this,_0x16c74c);if(_0x14aa6a){this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')](_0x0d8b('0x1b1'),_0x14aa6a));var _0x1c4e28=this[_0x0d8b('0xc')][_0x0d8b('0x110')](_0x14aa6a);try{fs['unlink'](_0x14aa6a+_0x0d8b('0xee'));}catch(_0x4fd5b9){logger[_0x0d8b('0x31')](_0x4fd5b9);}return _0x1c4e28;}return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x16c74c,_0x0d8b('0x1b2'));};AGIVertices['prototype']['unpause']=function(_0x33f77f){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x1b3'),_0x33f77f[_0x0d8b('0x36')]));if(!this['isConfigured'](_0x33f77f[_0x0d8b('0x13d')])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x33f77f,_0x0d8b('0x13c'));}logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x143'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x33f77f[_0x0d8b('0x13d')]));var _0x382a79=this[_0x0d8b('0x50')][_0x0d8b('0x72')](this,_0x33f77f[_0x0d8b('0x13d')]);if(_0x382a79){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x13e'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x33f77f[_0x0d8b('0x13d')]));this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util['format'](_0x0d8b('0x13e'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x33f77f[_0x0d8b('0x13d')]));return{'code':0xc8,'result':_0x0d8b('0x13f')};}else{logger[_0x0d8b('0x2c')](util['format'](_0x0d8b('0x140'),this[_0x0d8b('0xc')][_0x0d8b('0x38')],_0x33f77f[_0x0d8b('0x13d')]));this[_0x0d8b('0xc')][_0x0d8b('0xb0')](util[_0x0d8b('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x0d8b('0x38')],_0x33f77f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x0d8b('0x1b4')]=function(_0x1edf77){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')](_0x0d8b('0x1b5'),_0x1edf77['label']));var _0x18a450=this[_0x0d8b('0xc')][_0x0d8b('0x57')](_0x0d8b('0x1b6'),[_0x1edf77['mailbox'],_0x1edf77['options']]);if(_0x18a450['result']===-0x1){return _0x18a450;}return this['channel']['noop'](util['format'](_0x0d8b('0x156'),'VOICEMAIL',_0x1edf77[_0x0d8b('0x1b7')]));};AGIVertices['prototype']['vswitch']=function(_0x3c5405){logger[_0x0d8b('0x2c')](util[_0x0d8b('0x54')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3c5405['label']));if(!this[_0x0d8b('0x83')](_0x3c5405['variable_id'])){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x3c5405,'no\x20variable\x20selected');}var _0x4abc93=this['getVariable'][_0x0d8b('0x72')](this,_0x3c5405[_0x0d8b('0xd1')]);if(!_0x4abc93){return this[_0x0d8b('0xc')][_0x0d8b('0x31')](_0x3c5405,'no\x20variable\x20found');}var _0x6978e9=this[_0x0d8b('0xc')][_0x0d8b('0x10')](_0x4abc93);return{'code':0xc8,'result':_0x6978e9['extra']?_0x6978e9[_0x0d8b('0x9f')]:'-'};};String[_0x0d8b('0xf')][_0x0d8b('0x9e')]=function(_0xfc4a85,_0x4c1bb7){return this[_0x0d8b('0x9c')](_0xfc4a85)[_0x0d8b('0x1b8')](_0x4c1bb7);};module[_0x0d8b('0x1b9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ede3a5b..91d996e 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 _0x7da7=['[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','prototype','channels','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid'];(function(_0x2084dc,_0x154144){var _0x87e0e5=function(_0x3b68b6){while(--_0x3b68b6){_0x2084dc['push'](_0x2084dc['shift']());}};_0x87e0e5(++_0x154144);}(_0x7da7,0x10d));var _0x77da=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x7da7[_0x1abb09];return _0xea1c07;};'use strict';var util=require(_0x77da('0x0'));var _=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x77da('0x3'));var RpcUser=require(_0x77da('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3a9fa6){this[_0x77da('0x5')]=_0x3a9fa6['voiceQueues'];this[_0x77da('0x6')]=_0x3a9fa6[_0x77da('0x6')];this['timers']=_0x3a9fa6[_0x77da('0x7')];this['channels']={};ami['on'](_0x77da('0x8'),this[_0x77da('0x9')][_0x77da('0xa')](this));ami['on'](_0x77da('0xb'),this[_0x77da('0xc')]['bind'](this));ami['on'](_0x77da('0xd'),this[_0x77da('0xe')][_0x77da('0xa')](this));ami['on']('agentringnoanswer',this[_0x77da('0xf')][_0x77da('0xa')](this));ami['on'](_0x77da('0x10'),this[_0x77da('0x11')]['bind'](this));ami['on'](_0x77da('0x12'),this[_0x77da('0x13')][_0x77da('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x77da('0xa')](this));}function getDiff(_0x4263d9){var _0x589aa1=moment()[_0x77da('0x14')](0x0);var _0x369df0=moment(_0x4263d9)[_0x77da('0x14')](0x0);return _0x589aa1[_0x77da('0x15')](_0x369df0,'seconds');}Acw[_0x77da('0x16')]['startAcw']=function(_0x29cd7b){try{var _0x366443=this;var _0x1b0e17=this[_0x77da('0x17')][_0x29cd7b]['interface'];var _0x5c07da=this['channels'][_0x29cd7b]['queue'];var _0x103e46=this[_0x77da('0x5')][_0x5c07da];var _0x289887=![];var _0x335dcb=_0x77da('0x18');if(_0x103e46[_0x77da('0x19')]){if(_0x103e46[_0x77da('0x1a')][_0x77da('0x1b')]){_0x289887=!![];_0x335dcb=_0x103e46['mandatoryDispositionPause']['name'];}}ami[_0x77da('0x1c')]({'action':_0x77da('0x1d'),'interface':_0x1b0e17,'paused':!![],'reason':_0x335dcb})['then'](function(_0x45a122){if(_0x366443[_0x77da('0x6')][_0x1b0e17]){return RpcUser[_0x77da('0x1e')](_0x366443['agents'][_0x1b0e17]['id'])['then'](function(_0x3e6cfe){if(_0x3e6cfe&&!_0x3e6cfe['voicePause']){logger[_0x77da('0x1f')](_0x77da('0x20'),_0x29cd7b,_0x1b0e17,_0x5c07da);var _0xc52f0e=_0x366443[_0x77da('0x17')][_0x29cd7b][_0x77da('0x21')]&&_0x366443[_0x77da('0x17')][_0x29cd7b][_0x77da('0x22')]?_0x366443['channels'][_0x29cd7b]['destlinkedid']:_0x29cd7b;return RpcUser[_0x77da('0x23')](_0x366443[_0x77da('0x6')][_0x1b0e17],_0x335dcb,_0xc52f0e)[_0x77da('0x24')](function(_0xbd06b7){if(!_0x289887){_0x366443['timers'][_0x1b0e17]={};logger[_0x77da('0x1f')](_0x77da('0x25'),_0x29cd7b,_0x366443[_0x77da('0x5')][_0x5c07da][_0x77da('0x26')],_0x1b0e17,_0x5c07da);_0x366443[_0x77da('0x7')][_0x1b0e17]['timer']=setTimeout(_0x366443[_0x77da('0x27')][_0x77da('0xa')](_0x366443,_0x1b0e17),_0x366443[_0x77da('0x5')][_0x5c07da][_0x77da('0x26')]*0x3e8);_0x366443['timers'][_0x1b0e17]['lastPauseAt']=moment()['format'](_0x77da('0x28'));_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x29')]=_0x29cd7b;_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2a')]=_0x5c07da;_0x366443['timers'][_0x1b0e17][_0x77da('0x2b')]=function(){var _0x26f5a0=getDiff(_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2c')]);clearTimeout(_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2d')]);_0x366443['timers'][_0x1b0e17][_0x77da('0x2d')]=![];RpcVoiceAgentReport[_0x77da('0x2e')]({'acwtime':_0x26f5a0},_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x29')],_0x1b0e17)[_0x77da('0x24')](function(_0x12ea16){logger[_0x77da('0x1f')](_0x77da('0x2f'),_0x29cd7b,_0x26f5a0,_0x12ea16);})['catch'](function(_0x5e8d1e){logger[_0x77da('0x30')](_0x77da('0x31'),_0x29cd7b,_0x5e8d1e);});delete _0x366443['timers'][_0x1b0e17];};}});}else{logger[_0x77da('0x1f')](_0x77da('0x32'),_0x29cd7b,_0x1b0e17,_0x5c07da);}});}})[_0x77da('0x33')](function(_0x10540a){logger[_0x77da('0x30')](_0x77da('0x25'),_0x29cd7b,_0x366443[_0x77da('0x5')][_0x5c07da]['acwTimeout'],_0x1b0e17,_0x5c07da);})[_0x77da('0x34')](function(){delete _0x366443['channels'][_0x29cd7b];});}catch(_0x54b7f2){logger['error'](_0x77da('0x35'),_0x54b7f2['message']);}};Acw[_0x77da('0x16')][_0x77da('0x27')]=function(_0xce9df2){try{var _0x3cc78b=this;if(_0x3cc78b[_0x77da('0x7')][_0xce9df2]){_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x2d')]=![];var _0x501306=_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x29')];var _0x1ca53a=_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x2a')];var _0x188284=_0x3cc78b['voiceQueues'][_0x1ca53a][_0x77da('0x26')];logger[_0x77da('0x1f')](_0x77da('0x36'),_0xce9df2);RpcUser['saveUnpause'](this[_0x77da('0x6')][_0xce9df2]);RpcVoiceAgentReport['update']({'acwtime':_0x188284,'agentacw':!![]},_0x501306,_0xce9df2)['then'](function(_0x599e21){logger['info'](_0x77da('0x2f'),_0x501306,_0x188284,_0x599e21);})[_0x77da('0x33')](function(_0xebdea1){logger['error'](_0x77da('0x31'),_0x501306,_0xebdea1);});}else{logger['error'](_0x77da('0x37'),_0xce9df2);if(_0x3cc78b['timers']){logger[_0x77da('0x1f')](_0x77da('0x38'),JSON[_0x77da('0x39')](_0x3cc78b[_0x77da('0x7')]));}}}catch(_0x240bee){logger['error'](_0x77da('0x3a'),_0x240bee[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')][_0x77da('0x9')]=function(_0x32a9c4){try{if(this[_0x77da('0x5')][_0x32a9c4['queue']]&&(this[_0x77da('0x5')][_0x32a9c4[_0x77da('0x2a')]][_0x77da('0x3')]||this[_0x77da('0x5')][_0x32a9c4[_0x77da('0x2a')]][_0x77da('0x19')])){if(this['agents'][_0x32a9c4[_0x77da('0x3c')]]){this['channels'][_0x32a9c4[_0x77da('0x29')]]={'queue':_0x32a9c4[_0x77da('0x2a')],'interface':_0x32a9c4[_0x77da('0x3c')],'destlinkedid':_0x32a9c4['destlinkedid']};}}}catch(_0x1c83c2){logger[_0x77da('0x30')](_0x77da('0x3d'),_0x1c83c2[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')][_0x77da('0x3e')]=function(_0x203caa){try{if(this[_0x77da('0x5')][_0x203caa[_0x77da('0x2a')]]&&(this['voiceQueues'][_0x203caa[_0x77da('0x2a')]][_0x77da('0x3')]||this[_0x77da('0x5')][_0x203caa[_0x77da('0x2a')]][_0x77da('0x19')])){if(this[_0x77da('0x6')][_0x203caa['interface']]){this['channels'][_0x203caa[_0x77da('0x29')]]={'queue':_0x203caa[_0x77da('0x2a')],'interface':_0x203caa[_0x77da('0x3c')]};}}}catch(_0x326054){logger[_0x77da('0x30')](_0x77da('0x3f'),_0x326054['message']);}};Acw[_0x77da('0x16')][_0x77da('0xc')]=function(_0x332f80){try{if(this[_0x77da('0x17')][_0x332f80['uniqueid']]&&_[_0x77da('0x40')](this['channels'][_0x332f80['uniqueid']][_0x77da('0x21')])){logger[_0x77da('0x1f')](_0x77da('0x41'),_0x332f80[_0x77da('0x29')]);this['startAcw'](_0x332f80[_0x77da('0x29')]);}else if(this[_0x77da('0x17')][_0x332f80['linkedid']]&&_[_0x77da('0x40')](this[_0x77da('0x17')][_0x332f80['linkedid']][_0x77da('0x21')])){logger[_0x77da('0x1f')](_0x77da('0x42'),_0x332f80[_0x77da('0x43')]);this[_0x77da('0x44')](_0x332f80[_0x77da('0x43')]);}}catch(_0x2b96c1){logger[_0x77da('0x30')](_0x77da('0x45'),_0x2b96c1[_0x77da('0x3b')]);}};Acw['prototype'][_0x77da('0xe')]=function(_0x513017){try{if(this[_0x77da('0x17')][_0x513017[_0x77da('0x29')]]&&this[_0x77da('0x17')][_0x513017[_0x77da('0x29')]][_0x77da('0x21')]){logger[_0x77da('0x1f')](_0x77da('0x46'),_0x513017['uniqueid']);this[_0x77da('0x44')](_0x513017[_0x77da('0x29')]);}else if(this[_0x77da('0x17')][_0x513017[_0x77da('0x43')]]&&this['channels'][_0x513017[_0x77da('0x43')]][_0x77da('0x21')]){logger[_0x77da('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x513017['linkedid']);this[_0x77da('0x44')](_0x513017[_0x77da('0x43')]);}}catch(_0x42ea9e){logger[_0x77da('0x30')](_0x77da('0x47'),_0x42ea9e['message']);}};Acw['prototype'][_0x77da('0x11')]=function(_0x36f161){try{if(!_['isNil'](this[_0x77da('0x17')][_0x36f161[_0x77da('0x48')]])){this[_0x77da('0x44')](_0x36f161['transfereeuniqueid']);if(this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]]){this['channels'][_0x36f161[_0x77da('0x49')]][_0x77da('0x21')]=!![];this[_0x77da('0x17')][_0x36f161[_0x77da('0x4a')]]=this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]];delete this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]];}}else if(!_[_0x77da('0x4b')](this['channels'][_0x36f161[_0x77da('0x4a')]])){this[_0x77da('0x44')](_0x36f161[_0x77da('0x4a')]);if(this[_0x77da('0x17')][_0x36f161[_0x77da('0x4c')]]){this[_0x77da('0x17')][_0x36f161['origtransfereruniqueid']][_0x77da('0x21')]=!![];this[_0x77da('0x17')][_0x36f161[_0x77da('0x48')]]=this['channels'][_0x36f161[_0x77da('0x4c')]];delete this[_0x77da('0x17')][_0x36f161[_0x77da('0x4c')]];}}}catch(_0x8592c7){logger[_0x77da('0x30')](_0x77da('0x4d'),_0x8592c7[_0x77da('0x3b')]);}};Acw['prototype'][_0x77da('0x13')]=function(_0x52c8f0){try{if(this[_0x77da('0x17')][_0x52c8f0[_0x77da('0x4e')]]){logger[_0x77da('0x1f')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x77da('0x39')](_0x52c8f0[_0x77da('0x4e')]));this[_0x77da('0x44')](_0x52c8f0[_0x77da('0x4e')]);}else if(this['channels'][_0x52c8f0['transfererlinkedid']]){logger['info'](_0x77da('0x4f'),JSON[_0x77da('0x39')](_0x52c8f0[_0x77da('0x50')]));this[_0x77da('0x44')](_0x52c8f0[_0x77da('0x50')]);}}catch(_0x454f35){logger[_0x77da('0x30')](_0x77da('0x51'),_0x454f35[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')]['syncAgentRingNoAnswer']=function(_0x3028ca){try{if(this[_0x77da('0x5')][_0x3028ca['queue']]&&this['voiceQueues'][_0x3028ca[_0x77da('0x2a')]]['autopause']===_0x77da('0x52')){if(this[_0x77da('0x6')][_0x3028ca[_0x77da('0x3c')]]){logger['info'](_0x77da('0x53'),_0x3028ca[_0x77da('0x29')],_0x3028ca[_0x77da('0x3c')],_0x3028ca[_0x77da('0x2a')]);return RpcUser[_0x77da('0x23')](this['agents'][_0x3028ca[_0x77da('0x3c')]],_0x77da('0x54'),_0x3028ca['uniqueid']);}}}catch(_0x3fdde1){logger[_0x77da('0x30')](_0x77da('0x55'),_0x3fdde1[_0x77da('0x3b')]);}};module[_0x77da('0x56')]=Acw; \ No newline at end of file +var _0xd6d6=['origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','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][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','stopAcw','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x404e63,_0x432de5){var _0x35c5d7=function(_0x9d6278){while(--_0x9d6278){_0x404e63['push'](_0x404e63['shift']());}};_0x35c5d7(++_0x432de5);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2f5e15,_0x35ac92){_0x2f5e15=_0x2f5e15-0x0;var _0x4efb92=_0xd6d6[_0x2f5e15];return _0x4efb92;};'use strict';var util=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var ami=require(_0x6d6d('0x3'));var logger=require('../../../config/logger')(_0x6d6d('0x4'));var RpcUser=require(_0x6d6d('0x5'));var RpcVoiceAgentReport=require(_0x6d6d('0x6'));function Acw(_0x2a838a){this[_0x6d6d('0x7')]=_0x2a838a[_0x6d6d('0x7')];this[_0x6d6d('0x8')]=_0x2a838a['agents'];this[_0x6d6d('0x9')]=_0x2a838a[_0x6d6d('0x9')];this[_0x6d6d('0xa')]={};ami['on'](_0x6d6d('0xb'),this[_0x6d6d('0xc')][_0x6d6d('0xd')](this));ami['on'](_0x6d6d('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0x6d6d('0xf'),this[_0x6d6d('0x10')][_0x6d6d('0xd')](this));ami['on'](_0x6d6d('0x11'),this[_0x6d6d('0x12')]['bind'](this));ami['on'](_0x6d6d('0x13'),this[_0x6d6d('0x14')]['bind'](this));ami['on']('blindtransfer',this[_0x6d6d('0x15')][_0x6d6d('0xd')](this));ami['on'](_0x6d6d('0x16'),this[_0x6d6d('0x17')][_0x6d6d('0xd')](this));}function getDiff(_0x41fbdf){var _0x19cf50=moment()[_0x6d6d('0x18')](0x0);var _0x5f4154=moment(_0x41fbdf)[_0x6d6d('0x18')](0x0);return _0x19cf50[_0x6d6d('0x19')](_0x5f4154,_0x6d6d('0x1a'));}Acw[_0x6d6d('0x1b')][_0x6d6d('0x1c')]=function(_0x5d80c0){try{var _0x2e6fdb=this;var _0x587338=this[_0x6d6d('0xa')][_0x5d80c0][_0x6d6d('0x1d')];var _0x1cc02b=this['channels'][_0x5d80c0]['queue'];var _0x9e1e18=this[_0x6d6d('0x7')][_0x1cc02b];var _0x2b59d4=![];var _0x2c5314='ACW';if(_0x9e1e18['mandatoryDisposition']){if(_0x9e1e18[_0x6d6d('0x1e')]['name']){_0x2b59d4=!![];_0x2c5314=_0x9e1e18[_0x6d6d('0x1e')][_0x6d6d('0x1f')];}}ami[_0x6d6d('0x20')]({'action':_0x6d6d('0x21'),'interface':_0x587338,'paused':!![],'reason':_0x2c5314})[_0x6d6d('0x22')](function(_0x3242d8){if(_0x2e6fdb[_0x6d6d('0x8')][_0x587338]){return RpcUser[_0x6d6d('0x23')](_0x2e6fdb[_0x6d6d('0x8')][_0x587338]['id'])[_0x6d6d('0x22')](function(_0x24b10d){if(_0x24b10d&&!_0x24b10d[_0x6d6d('0x24')]){logger[_0x6d6d('0x25')](_0x6d6d('0x26'),_0x5d80c0,_0x587338,_0x1cc02b);var _0x1f7f88=_0x2e6fdb[_0x6d6d('0xa')][_0x5d80c0][_0x6d6d('0x27')]&&_0x2e6fdb['channels'][_0x5d80c0][_0x6d6d('0x28')]?_0x2e6fdb[_0x6d6d('0xa')][_0x5d80c0][_0x6d6d('0x28')]:_0x5d80c0;return RpcUser[_0x6d6d('0x29')](_0x2e6fdb[_0x6d6d('0x8')][_0x587338],_0x2c5314,_0x1f7f88)[_0x6d6d('0x22')](function(_0x554f8e){if(!_0x2b59d4){_0x2e6fdb[_0x6d6d('0x9')][_0x587338]={};logger[_0x6d6d('0x25')](_0x6d6d('0x2a'),_0x5d80c0,_0x2e6fdb[_0x6d6d('0x7')][_0x1cc02b][_0x6d6d('0x2b')],_0x587338,_0x1cc02b);_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x2c')]=setTimeout(_0x2e6fdb['stopAcw'][_0x6d6d('0xd')](_0x2e6fdb,_0x587338),_0x2e6fdb[_0x6d6d('0x7')][_0x1cc02b]['acwTimeout']*0x3e8);_0x2e6fdb['timers'][_0x587338][_0x6d6d('0x2d')]=moment()[_0x6d6d('0x2e')](_0x6d6d('0x2f'));_0x2e6fdb['timers'][_0x587338][_0x6d6d('0x30')]=_0x5d80c0;_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x31')]=_0x1cc02b;_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x32')]=function(){var _0x428c17=getDiff(_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x2d')]);clearTimeout(_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x2c')]);_0x2e6fdb['timers'][_0x587338][_0x6d6d('0x2c')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x428c17},_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x30')],_0x587338)[_0x6d6d('0x22')](function(_0x2814ed){logger['info'](_0x6d6d('0x33'),_0x5d80c0,_0x428c17,_0x2814ed);})['catch'](function(_0x3cc702){logger[_0x6d6d('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x5d80c0,_0x3cc702);});delete _0x2e6fdb[_0x6d6d('0x9')][_0x587338];};}});}else{logger[_0x6d6d('0x25')](_0x6d6d('0x35'),_0x5d80c0,_0x587338,_0x1cc02b);}});}})[_0x6d6d('0x36')](function(_0x34c390){logger[_0x6d6d('0x34')](_0x6d6d('0x2a'),_0x5d80c0,_0x2e6fdb[_0x6d6d('0x7')][_0x1cc02b][_0x6d6d('0x2b')],_0x587338,_0x1cc02b);})[_0x6d6d('0x37')](function(){delete _0x2e6fdb[_0x6d6d('0xa')][_0x5d80c0];});}catch(_0x3693da){logger[_0x6d6d('0x34')](_0x6d6d('0x38'),_0x3693da['message']);}};Acw[_0x6d6d('0x1b')][_0x6d6d('0x39')]=function(_0x3e2415){try{var _0x5e4f38=this;if(_0x5e4f38['timers'][_0x3e2415]){_0x5e4f38['timers'][_0x3e2415][_0x6d6d('0x2c')]=![];var _0x26b2de=_0x5e4f38[_0x6d6d('0x9')][_0x3e2415]['uniqueid'];var _0x2a3f67=_0x5e4f38[_0x6d6d('0x9')][_0x3e2415][_0x6d6d('0x31')];var _0x125d79=_0x5e4f38['voiceQueues'][_0x2a3f67]['acwTimeout'];logger['info'](_0x6d6d('0x3a'),_0x3e2415);RpcUser[_0x6d6d('0x3b')](this[_0x6d6d('0x8')][_0x3e2415]);RpcVoiceAgentReport[_0x6d6d('0x3c')]({'acwtime':_0x125d79,'agentacw':!![]},_0x26b2de,_0x3e2415)['then'](function(_0x253416){logger[_0x6d6d('0x25')](_0x6d6d('0x33'),_0x26b2de,_0x125d79,_0x253416);})[_0x6d6d('0x36')](function(_0x3d632c){logger[_0x6d6d('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x26b2de,_0x3d632c);});}else{logger[_0x6d6d('0x34')](_0x6d6d('0x3d'),_0x3e2415);if(_0x5e4f38[_0x6d6d('0x9')]){logger[_0x6d6d('0x25')](_0x6d6d('0x3e'),JSON[_0x6d6d('0x3f')](_0x5e4f38[_0x6d6d('0x9')]));}}}catch(_0x54bf87){logger[_0x6d6d('0x34')](_0x6d6d('0x40'),_0x54bf87[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')][_0x6d6d('0xc')]=function(_0x5d9268){try{if(this[_0x6d6d('0x7')][_0x5d9268[_0x6d6d('0x31')]]&&(this['voiceQueues'][_0x5d9268[_0x6d6d('0x31')]]['acw']||this[_0x6d6d('0x7')][_0x5d9268[_0x6d6d('0x31')]]['mandatoryDisposition'])){if(this[_0x6d6d('0x8')][_0x5d9268[_0x6d6d('0x1d')]]){this[_0x6d6d('0xa')][_0x5d9268[_0x6d6d('0x30')]]={'queue':_0x5d9268[_0x6d6d('0x31')],'interface':_0x5d9268['interface'],'destlinkedid':_0x5d9268['destlinkedid']};}}}catch(_0x981dd7){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x981dd7[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')][_0x6d6d('0x17')]=function(_0x49aa5d){try{if(this[_0x6d6d('0x7')][_0x49aa5d['queue']]&&(this[_0x6d6d('0x7')][_0x49aa5d[_0x6d6d('0x31')]][_0x6d6d('0x4')]||this[_0x6d6d('0x7')][_0x49aa5d[_0x6d6d('0x31')]][_0x6d6d('0x42')])){if(this[_0x6d6d('0x8')][_0x49aa5d['interface']]){this[_0x6d6d('0xa')][_0x49aa5d[_0x6d6d('0x30')]]={'queue':_0x49aa5d[_0x6d6d('0x31')],'interface':_0x49aa5d[_0x6d6d('0x1d')]};}}}catch(_0x320390){logger[_0x6d6d('0x34')](_0x6d6d('0x43'),_0x320390[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')]['syncHangupRequest']=function(_0x4d78bb){try{if(this[_0x6d6d('0xa')][_0x4d78bb[_0x6d6d('0x30')]]&&_[_0x6d6d('0x44')](this[_0x6d6d('0xa')][_0x4d78bb[_0x6d6d('0x30')]]['attended'])){logger[_0x6d6d('0x25')](_0x6d6d('0x45'),_0x4d78bb[_0x6d6d('0x30')]);this[_0x6d6d('0x1c')](_0x4d78bb[_0x6d6d('0x30')]);}else if(this[_0x6d6d('0xa')][_0x4d78bb[_0x6d6d('0x46')]]&&_[_0x6d6d('0x44')](this[_0x6d6d('0xa')][_0x4d78bb[_0x6d6d('0x46')]][_0x6d6d('0x27')])){logger[_0x6d6d('0x25')]('[%s][HANGUP:LINKEDID]',_0x4d78bb[_0x6d6d('0x46')]);this[_0x6d6d('0x1c')](_0x4d78bb[_0x6d6d('0x46')]);}}catch(_0x972221){logger[_0x6d6d('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x972221[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')][_0x6d6d('0x10')]=function(_0x4e4c3e){try{if(this['channels'][_0x4e4c3e[_0x6d6d('0x30')]]&&this['channels'][_0x4e4c3e[_0x6d6d('0x30')]][_0x6d6d('0x27')]){logger[_0x6d6d('0x25')](_0x6d6d('0x47'),_0x4e4c3e[_0x6d6d('0x30')]);this[_0x6d6d('0x1c')](_0x4e4c3e[_0x6d6d('0x30')]);}else if(this[_0x6d6d('0xa')][_0x4e4c3e[_0x6d6d('0x46')]]&&this[_0x6d6d('0xa')][_0x4e4c3e['linkedid']][_0x6d6d('0x27')]){logger[_0x6d6d('0x25')](_0x6d6d('0x48'),_0x4e4c3e[_0x6d6d('0x46')]);this[_0x6d6d('0x1c')](_0x4e4c3e[_0x6d6d('0x46')]);}}catch(_0x243be3){logger['error']('[ACW][syncHangup]\x20%s',_0x243be3[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')]['syncAttendedTransfer']=function(_0x3e98a0){try{if(!_[_0x6d6d('0x49')](this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4a')]])){this[_0x6d6d('0x1c')](_0x3e98a0[_0x6d6d('0x4a')]);if(this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4b')]]){this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4b')]][_0x6d6d('0x27')]=!![];this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4c')]]=this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4b')]];delete this['channels'][_0x3e98a0[_0x6d6d('0x4b')]];}}else if(!_[_0x6d6d('0x49')](this['channels'][_0x3e98a0[_0x6d6d('0x4c')]])){this[_0x6d6d('0x1c')](_0x3e98a0[_0x6d6d('0x4c')]);if(this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4d')]]){this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4d')]][_0x6d6d('0x27')]=!![];this[_0x6d6d('0xa')][_0x3e98a0['transfereeuniqueid']]=this['channels'][_0x3e98a0[_0x6d6d('0x4d')]];delete this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4d')]];}}}catch(_0x5de33f){logger['error'](_0x6d6d('0x4e'),_0x5de33f['message']);}};Acw[_0x6d6d('0x1b')]['syncBlindTransfer']=function(_0x395fa9){try{if(this[_0x6d6d('0xa')][_0x395fa9[_0x6d6d('0x4f')]]){logger[_0x6d6d('0x25')](_0x6d6d('0x50'),JSON[_0x6d6d('0x3f')](_0x395fa9['transfereruniqueid']));this[_0x6d6d('0x1c')](_0x395fa9['transfereruniqueid']);}else if(this[_0x6d6d('0xa')][_0x395fa9['transfererlinkedid']]){logger[_0x6d6d('0x25')](_0x6d6d('0x51'),JSON[_0x6d6d('0x3f')](_0x395fa9[_0x6d6d('0x52')]));this[_0x6d6d('0x1c')](_0x395fa9[_0x6d6d('0x52')]);}}catch(_0x23d950){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x23d950[_0x6d6d('0x41')]);}};Acw['prototype'][_0x6d6d('0x12')]=function(_0x53b77a){try{if(this[_0x6d6d('0x7')][_0x53b77a[_0x6d6d('0x31')]]&&this[_0x6d6d('0x7')][_0x53b77a[_0x6d6d('0x31')]][_0x6d6d('0x53')]===_0x6d6d('0x54')){if(this['agents'][_0x53b77a[_0x6d6d('0x1d')]]){logger[_0x6d6d('0x25')](_0x6d6d('0x55'),_0x53b77a[_0x6d6d('0x30')],_0x53b77a[_0x6d6d('0x1d')],_0x53b77a[_0x6d6d('0x31')]);return RpcUser[_0x6d6d('0x29')](this['agents'][_0x53b77a[_0x6d6d('0x1d')]],_0x6d6d('0x56'),_0x53b77a[_0x6d6d('0x30')]);}}}catch(_0x3bf8a7){logger[_0x6d6d('0x34')](_0x6d6d('0x57'),_0x3bf8a7[_0x6d6d('0x41')]);}};module[_0x6d6d('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5371c0e..332268a 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 _0x84d5=['actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','queuesummary','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','log','close','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','port','asterisk','username','password','keepConnected','Action','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0xf20c5d,_0x3a0130){var _0x28a0fe=function(_0x27b8d5){while(--_0x27b8d5){_0xf20c5d['push'](_0xf20c5d['shift']());}};_0x28a0fe(++_0x3a0130);}(_0x84d5,0x127));var _0x584d=function(_0x2f470d,_0x3f8461){_0x2f470d=_0x2f470d-0x0;var _0x4200d1=_0x84d5[_0x2f470d];return _0x4200d1;};'use strict';var Manager=require(_0x584d('0x0'));var BPromise=require(_0x584d('0x1'));var moment=require(_0x584d('0x2'));var util=require('util');var _=require(_0x584d('0x3'));var logger=require(_0x584d('0x4'))(_0x584d('0x5'));var config=require(_0x584d('0x6'));var ami=new Manager(config['asterisk'][_0x584d('0x7')],config['asterisk']['ip'],config[_0x584d('0x8')][_0x584d('0x9')],config[_0x584d('0x8')][_0x584d('0xa')],!![]);ami[_0x584d('0xb')]();ami[_0x584d('0xc')]=BPromise['promisify'](ami[_0x584d('0xd')]);function error(_0x4941cc){logger['error'](util[_0x584d('0xe')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x584d('0x8')]['username'],config[_0x584d('0x8')]['ip'],config[_0x584d('0x8')]['port'],util['inspect'](_0x4941cc,![],null)));}function close(){logger[_0x584d('0xf')](util['format'](_0x584d('0x10'),config[_0x584d('0x8')]['username'],config[_0x584d('0x8')]['ip'],config[_0x584d('0x8')]['port']));}ami[_0x584d('0x11')]=function(){return function(){return ami[_0x584d('0xc')]({'action':_0x584d('0x12')});};};ami[_0x584d('0x13')]=function(){return function(){return ami[_0x584d('0xc')]({'action':_0x584d('0x14')});};};ami[_0x584d('0x15')]=function(){return function(){return ami[_0x584d('0xc')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x584d('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x584d('0xc')]({'action':_0x584d('0x17')});};};function connect(_0x3a7342){logger['info'](util['format'](_0x584d('0x18'),config[_0x584d('0x8')][_0x584d('0x9')],config[_0x584d('0x8')]['ip'],config[_0x584d('0x8')]['port']));ami['once'](_0x584d('0xf'),error);ami[_0x584d('0x19')]('close',close);}ami['on'](_0x584d('0x1a'),connect);ami['on']('shutdown',function(_0x31e435){logger[_0x584d('0x1b')](util['format'](_0x584d('0x1c'),config[_0x584d('0x8')][_0x584d('0x9')],config[_0x584d('0x8')]['ip'],config['asterisk'][_0x584d('0x7')],util[_0x584d('0x1d')](_0x31e435,![],null)));});ami['on'](_0x584d('0x1e'),function(_0x46719c){logger[_0x584d('0x1b')](util[_0x584d('0xe')](_0x584d('0x1f'),config['asterisk'][_0x584d('0x9')],config[_0x584d('0x8')]['ip'],config[_0x584d('0x8')][_0x584d('0x7')]));return BPromise[_0x584d('0x20')]()['then'](ami['actionSipShowRegistry']())[_0x584d('0x21')](ami['actionDeviceStateList']())['then'](ami[_0x584d('0x15')]())['then'](ami['actionQueueSummary']())[_0x584d('0x21')](ami[_0x584d('0x22')]())[_0x584d('0x23')](function(_0x716402){console[_0x584d('0x24')](_0x716402);});});ami[_0x584d('0x19')](_0x584d('0xf'),error);ami[_0x584d('0x19')](_0x584d('0x25'),close);module[_0x584d('0x26')]=ami; \ No newline at end of file +var _0x14d6=['actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','catch','log','close','exports','bluebird','moment','util','lodash','../../config/logger','../../config/environment','asterisk','port','username','password','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionQueueSummary'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x14d6,0x19a));var _0x614d=function(_0x27f4bd,_0x2f2681){_0x27f4bd=_0x27f4bd-0x0;var _0x69f4b5=_0x14d6[_0x27f4bd];return _0x69f4b5;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x614d('0x0'));var moment=require(_0x614d('0x1'));var util=require(_0x614d('0x2'));var _=require(_0x614d('0x3'));var logger=require(_0x614d('0x4'))('ami');var config=require(_0x614d('0x5'));var ami=new Manager(config[_0x614d('0x6')][_0x614d('0x7')],config[_0x614d('0x6')]['ip'],config['asterisk'][_0x614d('0x8')],config[_0x614d('0x6')][_0x614d('0x9')],!![]);ami['keepConnected']();ami[_0x614d('0xa')]=BPromise[_0x614d('0xb')](ami[_0x614d('0xc')]);function error(_0x47cde0){logger['error'](util[_0x614d('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x614d('0x6')][_0x614d('0x8')],config[_0x614d('0x6')]['ip'],config[_0x614d('0x6')][_0x614d('0x7')],util['inspect'](_0x47cde0,![],null)));}function close(){logger[_0x614d('0xe')](util[_0x614d('0xd')](_0x614d('0xf'),config['asterisk']['username'],config[_0x614d('0x6')]['ip'],config[_0x614d('0x6')][_0x614d('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x614d('0xa')]({'action':_0x614d('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x614d('0xa')]({'action':_0x614d('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x614d('0x12')]=function(){return function(){return ami[_0x614d('0xa')]({'action':'queuesummary'});};};ami[_0x614d('0x13')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x3866c7){logger[_0x614d('0x14')](util[_0x614d('0xd')](_0x614d('0x15'),config['asterisk'][_0x614d('0x8')],config[_0x614d('0x6')]['ip'],config['asterisk'][_0x614d('0x7')]));ami[_0x614d('0x16')](_0x614d('0xe'),error);ami[_0x614d('0x16')]('close',close);}ami['on'](_0x614d('0x17'),connect);ami['on']('shutdown',function(_0x4d2b88){logger[_0x614d('0x14')](util[_0x614d('0xd')](_0x614d('0x18'),config[_0x614d('0x6')][_0x614d('0x8')],config[_0x614d('0x6')]['ip'],config[_0x614d('0x6')][_0x614d('0x7')],util['inspect'](_0x4d2b88,![],null)));});ami['on'](_0x614d('0x19'),function(_0x5252f1){logger[_0x614d('0x14')](util['format'](_0x614d('0x1a'),config[_0x614d('0x6')][_0x614d('0x8')],config[_0x614d('0x6')]['ip'],config[_0x614d('0x6')]['port']));return BPromise['resolve']()[_0x614d('0x1b')](ami['actionSipShowRegistry']())[_0x614d('0x1b')](ami[_0x614d('0x1c')]())[_0x614d('0x1b')](ami['actionSipPeerStatus']())[_0x614d('0x1b')](ami[_0x614d('0x12')]())[_0x614d('0x1b')](ami[_0x614d('0x13')]())[_0x614d('0x1d')](function(_0x6bea7c){console[_0x614d('0x1e')](_0x6bea7c);});});ami['once'](_0x614d('0xe'),error);ami[_0x614d('0x16')](_0x614d('0x1f'),close);module[_0x614d('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 1bf7183..a133c6b 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 _0x60d9=['message','catch','exports','jayson/promise','bluebird','../../config/logger','ami','client','http','request','debug','memberReport','error','rpc'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x60d9,0xb9));var _0x960d=function(_0x41617e,_0x17da0f){_0x41617e=_0x41617e-0x0;var _0x11c7f3=_0x60d9[_0x41617e];return _0x11c7f3;};'use strict';var jayson=require(_0x960d('0x0'));var BPromise=require(_0x960d('0x1'));var logger=require(_0x960d('0x2'))(_0x960d('0x3'));var client=jayson[_0x960d('0x4')][_0x960d('0x5')]({'port':0x2329});client['Request']=function(_0x7ae0d8,_0x3c129e){return new BPromise(function(_0x177594,_0x274374){return client[_0x960d('0x6')](_0x7ae0d8,_0x3c129e)['then'](function(_0x2a4143){logger[_0x960d('0x7')]('rpc',_0x960d('0x8'),_0x7ae0d8,_0x3c129e,_0x2a4143);if(_0x2a4143[_0x960d('0x9')]){logger[_0x960d('0x9')](_0x960d('0xa'),_0x960d('0x8'),_0x7ae0d8,_0x2a4143['error'][_0x960d('0xb')],_0x3c129e);return _0x274374(_0x2a4143[_0x960d('0x9')][_0x960d('0xb')]);}else{return _0x177594(_0x2a4143['result']);}})[_0x960d('0xc')](function(_0x2155e4){logger['error'](_0x960d('0xa'),_0x960d('0x8'),_0x7ae0d8,_0x2155e4,_0x3c129e);return _0x274374(_0x2155e4);});});};module[_0x960d('0xd')]=client; \ No newline at end of file +var _0x9710=['request','then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','ami','client','http'];(function(_0x57fa79,_0x48b6a4){var _0x2f3ef8=function(_0x40ef0c){while(--_0x40ef0c){_0x57fa79['push'](_0x57fa79['shift']());}};_0x2f3ef8(++_0x48b6a4);}(_0x9710,0x6b));var _0x0971=function(_0x20dddd,_0x41242b){_0x20dddd=_0x20dddd-0x0;var _0x4c759=_0x9710[_0x20dddd];return _0x4c759;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x0971('0x0'));var logger=require(_0x0971('0x1'))(_0x0971('0x2'));var client=jayson[_0x0971('0x3')][_0x0971('0x4')]({'port':0x2329});client['Request']=function(_0x1ebbe9,_0x586c6d){return new BPromise(function(_0xf5507c,_0x4bf2a6){return client[_0x0971('0x5')](_0x1ebbe9,_0x586c6d)[_0x0971('0x6')](function(_0x3f773f){logger['debug'](_0x0971('0x7'),_0x0971('0x8'),_0x1ebbe9,_0x586c6d,_0x3f773f);if(_0x3f773f[_0x0971('0x9')]){logger['error'](_0x0971('0x7'),_0x0971('0x8'),_0x1ebbe9,_0x3f773f['error'][_0x0971('0xa')],_0x586c6d);return _0x4bf2a6(_0x3f773f[_0x0971('0x9')]['message']);}else{return _0xf5507c(_0x3f773f[_0x0971('0xb')]);}})[_0x0971('0xc')](function(_0x1a35cb){logger[_0x0971('0x9')](_0x0971('0x7'),_0x0971('0x8'),_0x1ebbe9,_0x1a35cb,_0x586c6d);return _0x4bf2a6(_0x1a35cb);});});};module[_0x0971('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 e601f2f..cf37003 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 _0xc827=['exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue'];(function(_0x232098,_0x24fc4d){var _0x53513c=function(_0x560c5a){while(--_0x560c5a){_0x232098['push'](_0x232098['shift']());}};_0x53513c(++_0x24fc4d);}(_0xc827,0x149));var _0x7c82=function(_0x4fcee8,_0x5e8711){_0x4fcee8=_0x4fcee8-0x0;var _0x417e62=_0xc827[_0x4fcee8];return _0x417e62;};'use strict';var util=require(_0x7c82('0x0'));var _=require('lodash');var moment=require(_0x7c82('0x1'));function checkNameSurname(_0x569e29,_0xdea1f0,_0x4fbd59){var _0x3dbdf4='';if(!_[_0x7c82('0x2')](_0xdea1f0)&&_0x7c82('0x3')===typeof _0xdea1f0){_0x3dbdf4+=_0xdea1f0;}if(!_[_0x7c82('0x2')](_0x4fbd59)&&_0x7c82('0x3')===typeof _0x4fbd59){_0x3dbdf4+='\x20'+_0x4fbd59;}if(_0x3dbdf4!==''){return _0x3dbdf4;}return _0x569e29;}function Action(_0x41e4bb,_0xe22c3a,_0xa344dc){this[_0x7c82('0x4')]=_0x41e4bb;this[_0x7c82('0x5')]=_0xa344dc||undefined;this[_0x7c82('0x6')]=checkNameSurname(_0xe22c3a[_0x7c82('0x7')][_0x7c82('0x8')],_0xe22c3a[_0x7c82('0x7')][_0x7c82('0x9')],_0xe22c3a[_0x7c82('0x7')][_0x7c82('0xa')]);this[_0x7c82('0xb')]=_0xe22c3a['Contact'][_0x7c82('0x8')];this[_0x7c82('0xc')]=_0x41e4bb['name'];this[_0x7c82('0xd')]=_0xe22c3a[_0x7c82('0xd')]||![];this[_0x7c82('0xe')]=_0x41e4bb['type'];this[_0x7c82('0xf')]=_0x41e4bb[_0x7c82('0xf')]||0x3;this[_0x7c82('0x10')]=_0xe22c3a[_0x7c82('0x10')];this[_0x7c82('0x11')]=_0xe22c3a[_0x7c82('0x11')];this[_0x7c82('0x12')]=_0xe22c3a[_0x7c82('0x12')];this[_0x7c82('0x13')]=_0xe22c3a[_0x7c82('0x13')];this[_0x7c82('0x14')]=_0xe22c3a[_0x7c82('0x14')];this[_0x7c82('0x15')]=_0xe22c3a[_0x7c82('0x15')];this['UserId']=_0xe22c3a['UserId'];this['VoiceQueueId']=_0xe22c3a[_0x7c82('0x16')];this[_0x7c82('0x17')]=_0xe22c3a[_0x7c82('0x17')];this[_0x7c82('0x18')]=_0xe22c3a['id'];this[_0x7c82('0x19')]=_0xe22c3a['Contact'][_0x7c82('0x9')]||'';this[_0x7c82('0x1a')]=moment()['format'](_0x7c82('0x1b'));this[_0x7c82('0x1c')]=_0xe22c3a['callback'];this['callbackuniqueid']=_0xe22c3a[_0x7c82('0x1d')];this[_0x7c82('0x1e')]=_0xe22c3a[_0x7c82('0x1e')];this[_0x7c82('0x1f')]=_0xe22c3a[_0x7c82('0x1f')];this['originatecalleridnum']='';this[_0x7c82('0x20')]='';}Action[_0x7c82('0x21')][_0x7c82('0x22')]=function(){return util[_0x7c82('0x23')](_0x7c82('0x24'),this[_0x7c82('0x6')],this['voiceQueue'][_0x7c82('0x25')]>0x0?this[_0x7c82('0xb')][_0x7c82('0x26')](this[_0x7c82('0x4')][_0x7c82('0x25')]):this[_0x7c82('0xb')]);};Action['prototype'][_0x7c82('0x27')]=function(){return this[_0x7c82('0xc')];};module[_0x7c82('0x28')]=Action; \ No newline at end of file +var _0x102b=['format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','queue','exports','lodash','isNil','string','voiceQueue','uniqueid','name','phone','Contact','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','firstName','starttime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x102b,0x1be));var _0xb102=function(_0x3017f9,_0x244f0b){_0x3017f9=_0x3017f9-0x0;var _0x41d972=_0x102b[_0x3017f9];return _0x41d972;};'use strict';var util=require('util');var _=require(_0xb102('0x0'));var moment=require('moment');function checkNameSurname(_0x3c503a,_0x3e1311,_0x42172c){var _0x1be904='';if(!_[_0xb102('0x1')](_0x3e1311)&&_0xb102('0x2')===typeof _0x3e1311){_0x1be904+=_0x3e1311;}if(!_[_0xb102('0x1')](_0x42172c)&&_0xb102('0x2')===typeof _0x42172c){_0x1be904+='\x20'+_0x42172c;}if(_0x1be904!==''){return _0x1be904;}return _0x3c503a;}function Action(_0x489c73,_0x3325b7,_0x370baa){this[_0xb102('0x3')]=_0x489c73;this[_0xb102('0x4')]=_0x370baa||undefined;this[_0xb102('0x5')]=checkNameSurname(_0x3325b7['Contact'][_0xb102('0x6')],_0x3325b7['Contact']['firstName'],_0x3325b7[_0xb102('0x7')]['lastName']);this['number']=_0x3325b7[_0xb102('0x7')][_0xb102('0x6')];this['queue']=_0x489c73[_0xb102('0x5')];this[_0xb102('0x8')]=_0x3325b7[_0xb102('0x8')]||![];this[_0xb102('0x9')]=_0x489c73[_0xb102('0x9')];this[_0xb102('0xa')]=_0x489c73[_0xb102('0xa')]||0x3;this['scheduledat']=_0x3325b7[_0xb102('0xb')];this['countbusyretry']=_0x3325b7[_0xb102('0xc')];this[_0xb102('0xd')]=_0x3325b7['countcongestionretry'];this[_0xb102('0xe')]=_0x3325b7[_0xb102('0xe')];this['ContactId']=_0x3325b7[_0xb102('0xf')];this[_0xb102('0x10')]=_0x3325b7[_0xb102('0x10')];this['UserId']=_0x3325b7['UserId'];this['VoiceQueueId']=_0x3325b7[_0xb102('0x11')];this[_0xb102('0x12')]=_0x3325b7[_0xb102('0x12')];this[_0xb102('0x13')]=_0x3325b7['id'];this['ContactFirstName']=_0x3325b7['Contact'][_0xb102('0x14')]||'';this[_0xb102('0x15')]=moment()[_0xb102('0x16')](_0xb102('0x17'));this['callback']=_0x3325b7['callback'];this[_0xb102('0x18')]=_0x3325b7[_0xb102('0x18')];this[_0xb102('0x19')]=_0x3325b7[_0xb102('0x19')];this['recallme']=_0x3325b7[_0xb102('0x1a')];this[_0xb102('0x1b')]='';this[_0xb102('0x1c')]='';}Action[_0xb102('0x1d')]['getCaller']=function(){return util['format'](_0xb102('0x1e'),this[_0xb102('0x5')],this['voiceQueue'][_0xb102('0x1f')]>0x0?this['number'][_0xb102('0x20')](this[_0xb102('0x3')][_0xb102('0x1f')]):this[_0xb102('0x21')]);};Action['prototype']['getQueue']=function(){return this[_0xb102('0x22')];};module[_0xb102('0x23')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 707579c..d25d8d9 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 _0x55ac=['originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0x54516f,_0x334f78){var _0x39734e=function(_0x156eb6){while(--_0x156eb6){_0x54516f['push'](_0x54516f['shift']());}};_0x39734e(++_0x334f78);}(_0x55ac,0xaa));var _0xc55a=function(_0x26fd61,_0x37511d){_0x26fd61=_0x26fd61-0x0;var _0x4b293c=_0x55ac[_0x26fd61];return _0x4b293c;};'use strict';var util=require(_0xc55a('0x0'));var _=require(_0xc55a('0x1'));var moment=require(_0xc55a('0x2'));function getSeconds(_0x252e4e,_0x20166b){var _0xa1e55f=moment(_0x252e4e)[_0xc55a('0x3')](0x0);var _0x2cac04=moment(_0x20166b)[_0xc55a('0x3')](0x0);return _0xa1e55f['diff'](_0x2cac04,_0xc55a('0x4'));}function AgentComplete(_0x1a95bf,_0x5ab8e4){this[_0xc55a('0x5')]=0x4;this[_0xc55a('0x6')]=_0xc55a('0x7');this[_0xc55a('0x8')]=_0x1a95bf[_0xc55a('0x8')];this['type']=_0x1a95bf[_0xc55a('0x9')];this[_0xc55a('0xa')]=_0x1a95bf[_0xc55a('0x9')]===_0xc55a('0xb')?_0xc55a('0xc'):_0x1a95bf[_0xc55a('0x9')];this[_0xc55a('0xd')]=_0x1a95bf['countbusyretry'];this[_0xc55a('0xe')]=_0x1a95bf['countcongestionretry'];this[_0xc55a('0xf')]=_0x1a95bf['countnoanswerretry'];this['countglobal']=_0x1a95bf[_0xc55a('0xd')]+_0x1a95bf[_0xc55a('0xe')]+_0x1a95bf['countnoanswerretry'];this['uniqueid']=_0x5ab8e4[_0xc55a('0x10')];this[_0xc55a('0x11')]=_0x1a95bf[_0xc55a('0x12')];this[_0xc55a('0x13')]=_0x1a95bf['number'];this[_0xc55a('0x14')]=_0x1a95bf['starttime'];this[_0xc55a('0x15')]=_0x1a95bf[_0xc55a('0x15')];this['answertime']=_0x1a95bf[_0xc55a('0x16')];this['endtime']=moment()[_0xc55a('0x17')](_0xc55a('0x18'));this[_0xc55a('0x19')]=getSeconds(_0x1a95bf[_0xc55a('0x15')],_0x1a95bf['starttime']);this[_0xc55a('0x1a')]=getSeconds(_0x1a95bf[_0xc55a('0x16')],_0x1a95bf['responsetime']);this[_0xc55a('0x1b')]=getSeconds(this[_0xc55a('0x1c')],_0x1a95bf['answertime']);this[_0xc55a('0xc')]=_0x5ab8e4[_0xc55a('0xc')];this[_0xc55a('0x1d')]=_0x5ab8e4[_0xc55a('0x1d')];this[_0xc55a('0x1e')]=_0x5ab8e4[_0xc55a('0x1e')];this[_0xc55a('0x1f')]=_0x1a95bf[_0xc55a('0x1f')];this[_0xc55a('0x20')]=_0x1a95bf[_0xc55a('0x20')];this[_0xc55a('0x21')]=_0x1a95bf[_0xc55a('0x21')];this[_0xc55a('0x22')]=_0x1a95bf['recallme'];this[_0xc55a('0x23')]=_0x1a95bf[_0xc55a('0x23')];this[_0xc55a('0x24')]=_0x1a95bf[_0xc55a('0x24')];this[_0xc55a('0x25')]=_0x1a95bf[_0xc55a('0x25')];this[_0xc55a('0x26')]=_0x1a95bf['VoiceQueueId'];this['CampaignId']=_0x1a95bf['CampaignId'];this['originatecalleridnum']=_0x1a95bf[_0xc55a('0x27')]||'';this[_0xc55a('0x28')]=_0x1a95bf[_0xc55a('0x28')]||'';}module[_0xc55a('0x29')]=AgentComplete; \ No newline at end of file +var _0x2b66=['Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','number','starttime','answertime','endtime','format','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','statedesc'];(function(_0x1a058f,_0x3cf215){var _0x17cad5=function(_0x445134){while(--_0x445134){_0x1a058f['push'](_0x1a058f['shift']());}};_0x17cad5(++_0x3cf215);}(_0x2b66,0xbd));var _0x62b6=function(_0x2786bb,_0x7b1ae8){_0x2786bb=_0x2786bb-0x0;var _0x3a3910=_0x2b66[_0x2786bb];return _0x3a3910;};'use strict';var util=require(_0x62b6('0x0'));var _=require('lodash');var moment=require(_0x62b6('0x1'));function getSeconds(_0x2aba77,_0x533d3b){var _0x356b9e=moment(_0x2aba77)[_0x62b6('0x2')](0x0);var _0x1d0aa3=moment(_0x533d3b)['milliseconds'](0x0);return _0x356b9e[_0x62b6('0x3')](_0x1d0aa3,_0x62b6('0x4'));}function AgentComplete(_0x8ea842,_0x4177ed){this['state']=0x4;this[_0x62b6('0x5')]=_0x62b6('0x6');this[_0x62b6('0x7')]=_0x8ea842[_0x62b6('0x7')];this['type']=_0x8ea842[_0x62b6('0x8')];this[_0x62b6('0x9')]=_0x8ea842[_0x62b6('0x8')]===_0x62b6('0xa')?_0x62b6('0xb'):_0x8ea842['type'];this[_0x62b6('0xc')]=_0x8ea842['countbusyretry'];this[_0x62b6('0xd')]=_0x8ea842[_0x62b6('0xd')];this[_0x62b6('0xe')]=_0x8ea842[_0x62b6('0xe')];this[_0x62b6('0xf')]=_0x8ea842[_0x62b6('0xc')]+_0x8ea842[_0x62b6('0xd')]+_0x8ea842[_0x62b6('0xe')];this['uniqueid']=_0x4177ed[_0x62b6('0x10')];this[_0x62b6('0x11')]=_0x8ea842[_0x62b6('0x12')];this['calleridnum']=_0x8ea842[_0x62b6('0x13')];this[_0x62b6('0x14')]=_0x8ea842[_0x62b6('0x14')];this['responsetime']=_0x8ea842['responsetime'];this[_0x62b6('0x15')]=_0x8ea842[_0x62b6('0x15')];this[_0x62b6('0x16')]=moment()[_0x62b6('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x8ea842[_0x62b6('0x18')],_0x8ea842[_0x62b6('0x14')]);this[_0x62b6('0x19')]=getSeconds(_0x8ea842['answertime'],_0x8ea842['responsetime']);this[_0x62b6('0x1a')]=getSeconds(this[_0x62b6('0x16')],_0x8ea842[_0x62b6('0x15')]);this[_0x62b6('0xb')]=_0x4177ed[_0x62b6('0xb')];this[_0x62b6('0x1b')]=_0x4177ed[_0x62b6('0x1b')];this[_0x62b6('0x1c')]=_0x4177ed['reason'];this[_0x62b6('0x1d')]=_0x8ea842[_0x62b6('0x1d')];this[_0x62b6('0x1e')]=_0x8ea842[_0x62b6('0x1e')];this[_0x62b6('0x1f')]=_0x8ea842['callbackat'];this[_0x62b6('0x20')]=_0x8ea842['recallme'];this[_0x62b6('0x21')]=_0x8ea842[_0x62b6('0x21')];this[_0x62b6('0x22')]=_0x8ea842[_0x62b6('0x22')];this['UserId']=_0x8ea842['UserId'];this['VoiceQueueId']=_0x8ea842['VoiceQueueId'];this['CampaignId']=_0x8ea842[_0x62b6('0x23')];this[_0x62b6('0x24')]=_0x8ea842[_0x62b6('0x24')]||'';this[_0x62b6('0x25')]=_0x8ea842[_0x62b6('0x25')]||'';}module[_0x62b6('0x26')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 55aa5ba..adee499 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 _0x8921=['scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid'];(function(_0xf9b26,_0x580c21){var _0x36e5ce=function(_0xc8cdfb){while(--_0xc8cdfb){_0xf9b26['push'](_0xf9b26['shift']());}};_0x36e5ce(++_0x580c21);}(_0x8921,0x9a));var _0x1892=function(_0x216718,_0x1686c9){_0x216718=_0x216718-0x0;var _0x41d63c=_0x8921[_0x216718];return _0x41d63c;};'use strict';var util=require(_0x1892('0x0'));var _=require('lodash');var moment=require(_0x1892('0x1'));function getSeconds(_0x37e629,_0x1e3c14){var _0x2a40a6=moment(_0x37e629)[_0x1892('0x2')](0x0);var _0x110b75=moment(_0x1e3c14)[_0x1892('0x2')](0x0);return _0x2a40a6[_0x1892('0x3')](_0x110b75,_0x1892('0x4'));}function Final(_0x1ec03f){this[_0x1892('0x5')]=_0x1ec03f[_0x1892('0x5')];this['scheduledat']=_0x1ec03f[_0x1892('0x6')];this[_0x1892('0x7')]=_0x1ec03f[_0x1892('0x7')];this[_0x1892('0x8')]=_0x1ec03f[_0x1892('0x7')]===_0x1892('0x9')?'queue':_0x1ec03f[_0x1892('0x7')];this[_0x1892('0xa')]=_0x1ec03f[_0x1892('0xa')];this[_0x1892('0xb')]=_0x1ec03f[_0x1892('0xb')];this[_0x1892('0xc')]=_0x1ec03f[_0x1892('0xc')];this[_0x1892('0xd')]=_0x1ec03f[_0x1892('0xa')]+_0x1ec03f[_0x1892('0xb')]+_0x1ec03f[_0x1892('0xc')];this['queue']=_0x1ec03f[_0x1892('0xe')];this[_0x1892('0xf')]=_0x1ec03f[_0x1892('0xf')];this['calleridnum']=_0x1ec03f[_0x1892('0x10')];this[_0x1892('0x11')]=_0x1ec03f[_0x1892('0x11')];this[_0x1892('0x12')]=_0x1ec03f['responsetime'];this['endtime']=_0x1ec03f[_0x1892('0x12')];this['ringtime']=_0x1ec03f[_0x1892('0x13')]||0x0;this['holdtime']=_0x1ec03f[_0x1892('0x14')]||0x0;this[_0x1892('0x15')]=_0x1ec03f[_0x1892('0x15')]||0x0;this[_0x1892('0x16')]=_0x1ec03f[_0x1892('0x16')];this['callbackuniqueid']=_0x1ec03f['callbackuniqueid'];this[_0x1892('0x17')]=_0x1ec03f['callbackat'];this[_0x1892('0x18')]=_0x1ec03f['recallme'];this[_0x1892('0x19')]=_0x1ec03f[_0x1892('0x19')];this['ListId']=_0x1ec03f[_0x1892('0x1a')];this[_0x1892('0x1b')]=_0x1ec03f[_0x1892('0x1b')];this[_0x1892('0x1c')]=_0x1ec03f['VoiceQueueId'];this['CampaignId']=_0x1ec03f['CampaignId'];this[_0x1892('0x1d')]=_0x1ec03f[_0x1892('0x1d')]||'';this['originatecalleridname']=_0x1ec03f[_0x1892('0x1e')]||'';}module[_0x1892('0x1f')]=Final; \ No newline at end of file +var _0x0a6b=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x72579c,_0x48768b){var _0x5e5b03=function(_0x10609e){while(--_0x10609e){_0x72579c['push'](_0x72579c['shift']());}};_0x5e5b03(++_0x48768b);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1b8d1c,_0x395b3b){_0x1b8d1c=_0x1b8d1c-0x0;var _0x159a0b=_0x0a6b[_0x1b8d1c];return _0x159a0b;};'use strict';var util=require(_0xb0a6('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x50b658,_0x16a15d){var _0x50d3d5=moment(_0x50b658)[_0xb0a6('0x1')](0x0);var _0x13dc41=moment(_0x16a15d)[_0xb0a6('0x1')](0x0);return _0x50d3d5['diff'](_0x13dc41,_0xb0a6('0x2'));}function Final(_0x4cc3ae){this[_0xb0a6('0x3')]=_0x4cc3ae[_0xb0a6('0x3')];this['scheduledat']=_0x4cc3ae[_0xb0a6('0x4')];this[_0xb0a6('0x5')]=_0x4cc3ae[_0xb0a6('0x5')];this['campaigntype']=_0x4cc3ae['type']==='outbound'?_0xb0a6('0x6'):_0x4cc3ae[_0xb0a6('0x5')];this[_0xb0a6('0x7')]=_0x4cc3ae[_0xb0a6('0x7')];this['countcongestionretry']=_0x4cc3ae[_0xb0a6('0x8')];this[_0xb0a6('0x9')]=_0x4cc3ae['countnoanswerretry'];this[_0xb0a6('0xa')]=_0x4cc3ae[_0xb0a6('0x7')]+_0x4cc3ae[_0xb0a6('0x8')]+_0x4cc3ae[_0xb0a6('0x9')];this[_0xb0a6('0x6')]=_0x4cc3ae[_0xb0a6('0x6')];this[_0xb0a6('0xb')]=_0x4cc3ae[_0xb0a6('0xb')];this[_0xb0a6('0xc')]=_0x4cc3ae[_0xb0a6('0xc')];this['starttime']=_0x4cc3ae[_0xb0a6('0xd')];this['responsetime']=_0x4cc3ae[_0xb0a6('0xe')];this['endtime']=_0x4cc3ae[_0xb0a6('0xe')];this['ringtime']=_0x4cc3ae[_0xb0a6('0xf')]||0x0;this[_0xb0a6('0x10')]=_0x4cc3ae[_0xb0a6('0x10')]||0x0;this['talktime']=_0x4cc3ae['talktime']||0x0;this[_0xb0a6('0x11')]=_0x4cc3ae[_0xb0a6('0x11')];this[_0xb0a6('0x12')]=_0x4cc3ae[_0xb0a6('0x12')];this[_0xb0a6('0x13')]=_0x4cc3ae[_0xb0a6('0x13')];this['recallme']=_0x4cc3ae[_0xb0a6('0x14')];this[_0xb0a6('0x15')]=_0x4cc3ae[_0xb0a6('0x15')];this[_0xb0a6('0x16')]=_0x4cc3ae[_0xb0a6('0x16')];this[_0xb0a6('0x17')]=_0x4cc3ae['UserId'];this[_0xb0a6('0x18')]=_0x4cc3ae[_0xb0a6('0x18')];this[_0xb0a6('0x19')]=_0x4cc3ae[_0xb0a6('0x19')];this[_0xb0a6('0x1a')]=_0x4cc3ae[_0xb0a6('0x1a')]||'';this[_0xb0a6('0x1b')]=_0x4cc3ae[_0xb0a6('0x1b')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index dd22721..5c44b60 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 _0xa9e0=['countglobal','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry'];(function(_0x1e2447,_0x5fea89){var _0x306f03=function(_0x11ac2c){while(--_0x11ac2c){_0x1e2447['push'](_0x1e2447['shift']());}};_0x306f03(++_0x5fea89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function getSeconds(_0x5dd881,_0x550fbc){var _0x18d5c9=moment(_0x5dd881)['milliseconds'](0x0);var _0x333808=moment(_0x550fbc)[_0x0a9e('0x3')](0x0);return _0x18d5c9[_0x0a9e('0x4')](_0x333808,_0x0a9e('0x5'));}function Hangup(_0x981158,_0x57b080){this[_0x0a9e('0x6')]=0x4;this[_0x0a9e('0x7')]=_0x0a9e('0x8');this['scheduledat']=_0x981158['scheduledat'];this[_0x0a9e('0x9')]=_0x981158['type'];this['campaigntype']=_0x981158[_0x0a9e('0x9')]===_0x0a9e('0xa')?_0x0a9e('0xb'):_0x981158[_0x0a9e('0x9')];this[_0x0a9e('0xc')]=_0x981158[_0x0a9e('0xc')];this['countcongestionretry']=_0x981158['countcongestionretry'];this['countnoanswerretry']=_0x981158['countnoanswerretry'];this[_0x0a9e('0xd')]=_0x981158[_0x0a9e('0xc')]+_0x981158[_0x0a9e('0xe')]+_0x981158[_0x0a9e('0xf')];this[_0x0a9e('0x10')]=_0x57b080[_0x0a9e('0x10')];this['calleridname']=_0x981158[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x981158[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x981158[_0x0a9e('0x14')];this[_0x0a9e('0x15')]=_0x981158['responsetime'];this[_0x0a9e('0x16')]=moment()['format'](_0x0a9e('0x17'));this['ringtime']=getSeconds(_0x981158[_0x0a9e('0x15')],_0x981158[_0x0a9e('0x14')]);this['holdtime']=0x0;this[_0x0a9e('0x18')]=getSeconds(this['endtime'],_0x981158[_0x0a9e('0x15')]);this[_0x0a9e('0xb')]=_0x981158[_0x0a9e('0xb')];this[_0x0a9e('0x19')]=_0x0a9e('0x1a');this[_0x0a9e('0x1b')]=_0x57b080[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x981158[_0x0a9e('0x1d')];this[_0x0a9e('0x1e')]=_0x981158[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x981158['callbackat'];this[_0x0a9e('0x20')]=_0x981158[_0x0a9e('0x20')];this['ContactId']=_0x981158[_0x0a9e('0x21')];this['ListId']=_0x981158['ListId'];this[_0x0a9e('0x22')]=_0x981158[_0x0a9e('0x22')];this[_0x0a9e('0x23')]=_0x981158[_0x0a9e('0x23')];this['CampaignId']=_0x981158[_0x0a9e('0x24')];}module[_0x0a9e('0x25')]=Hangup; \ No newline at end of file +var _0x9957=['state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds'];(function(_0x3471cc,_0x31ca36){var _0x3201cf=function(_0x1e6f43){while(--_0x1e6f43){_0x3471cc['push'](_0x3471cc['shift']());}};_0x3201cf(++_0x31ca36);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));function getSeconds(_0x10a05d,_0x5b96eb){var _0x86c128=moment(_0x10a05d)[_0x7995('0x3')](0x0);var _0x1902b4=moment(_0x5b96eb)[_0x7995('0x3')](0x0);return _0x86c128['diff'](_0x1902b4,_0x7995('0x4'));}function Hangup(_0x1a36d8,_0x137b6b){this[_0x7995('0x5')]=0x4;this[_0x7995('0x6')]=_0x7995('0x7');this['scheduledat']=_0x1a36d8[_0x7995('0x8')];this[_0x7995('0x9')]=_0x1a36d8['type'];this[_0x7995('0xa')]=_0x1a36d8[_0x7995('0x9')]===_0x7995('0xb')?_0x7995('0xc'):_0x1a36d8[_0x7995('0x9')];this[_0x7995('0xd')]=_0x1a36d8[_0x7995('0xd')];this['countcongestionretry']=_0x1a36d8[_0x7995('0xe')];this[_0x7995('0xf')]=_0x1a36d8['countnoanswerretry'];this[_0x7995('0x10')]=_0x1a36d8[_0x7995('0xd')]+_0x1a36d8[_0x7995('0xe')]+_0x1a36d8[_0x7995('0xf')];this[_0x7995('0x11')]=_0x137b6b[_0x7995('0x11')];this[_0x7995('0x12')]=_0x1a36d8['name'];this['calleridnum']=_0x1a36d8[_0x7995('0x13')];this[_0x7995('0x14')]=_0x1a36d8[_0x7995('0x14')];this[_0x7995('0x15')]=_0x1a36d8[_0x7995('0x15')];this[_0x7995('0x16')]=moment()[_0x7995('0x17')](_0x7995('0x18'));this['ringtime']=getSeconds(_0x1a36d8[_0x7995('0x15')],_0x1a36d8['starttime']);this[_0x7995('0x19')]=0x0;this[_0x7995('0x1a')]=getSeconds(this[_0x7995('0x16')],_0x1a36d8[_0x7995('0x15')]);this[_0x7995('0xc')]=_0x1a36d8[_0x7995('0xc')];this['membername']='IVR';this[_0x7995('0x1b')]=_0x137b6b['cause-txt'];this['callback']=_0x1a36d8[_0x7995('0x1c')];this[_0x7995('0x1d')]=_0x1a36d8['callbackuniqueid'];this[_0x7995('0x1e')]=_0x1a36d8['callbackat'];this['recallme']=_0x1a36d8[_0x7995('0x1f')];this[_0x7995('0x20')]=_0x1a36d8[_0x7995('0x20')];this[_0x7995('0x21')]=_0x1a36d8[_0x7995('0x21')];this[_0x7995('0x22')]=_0x1a36d8['UserId'];this[_0x7995('0x23')]=_0x1a36d8[_0x7995('0x23')];this[_0x7995('0x24')]=_0x1a36d8[_0x7995('0x24')];}module[_0x7995('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 463fb22..2e2a882 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 _0xc053=['util','lodash','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','queue','calleridname','calleridnum','number','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports'];(function(_0x4556a5,_0x3fecd2){var _0x36d8d3=function(_0x62a561){while(--_0x62a561){_0x4556a5['push'](_0x4556a5['shift']());}};_0x36d8d3(++_0x3fecd2);}(_0xc053,0xd9));var _0x3c05=function(_0x4c9a56,_0x1f060a){_0x4c9a56=_0x4c9a56-0x0;var _0xfef63f=_0xc053[_0x4c9a56];return _0xfef63f;};'use strict';var util=require(_0x3c05('0x0'));var _=require(_0x3c05('0x1'));var moment=require(_0x3c05('0x2'));function getSeconds(_0x12512c,_0x497475){var _0x1131fc=moment(_0x12512c)['milliseconds'](0x0);var _0x2348c9=moment(_0x497475)['milliseconds'](0x0);return _0x1131fc[_0x3c05('0x3')](_0x2348c9,_0x3c05('0x4'));}function History(_0xce57c0){this[_0x3c05('0x5')]=_0xce57c0['uniqueid'];this[_0x3c05('0x6')]=_0xce57c0[_0x3c05('0x6')]||undefined;this[_0x3c05('0x7')]=_0xce57c0[_0x3c05('0x7')];this[_0x3c05('0x8')]=_0xce57c0[_0x3c05('0x7')]===_0x3c05('0x9')?'queue':_0xce57c0[_0x3c05('0x7')];this[_0x3c05('0xa')]=_0xce57c0['countbusyretry'];this['countcongestionretry']=_0xce57c0[_0x3c05('0xb')];this[_0x3c05('0xc')]=_0xce57c0['countnoanswerretry'];this['countglobal']=_0xce57c0[_0x3c05('0xa')]+_0xce57c0['countcongestionretry']+_0xce57c0[_0x3c05('0xc')];this[_0x3c05('0xd')]=_0xce57c0['queue'];this[_0x3c05('0xe')]=_0xce57c0['name'];this[_0x3c05('0xf')]=_0xce57c0[_0x3c05('0x10')];this[_0x3c05('0x11')]=_0xce57c0[_0x3c05('0x11')];this['responsetime']=_0xce57c0[_0x3c05('0x12')];this['endtime']=_0xce57c0[_0x3c05('0x12')];this[_0x3c05('0x13')]=getSeconds(_0xce57c0[_0x3c05('0x12')],_0xce57c0[_0x3c05('0x11')]);this['holdtime']=0x0;this[_0x3c05('0x14')]=0x0;this['callback']=_0xce57c0[_0x3c05('0x15')];this[_0x3c05('0x16')]=_0xce57c0[_0x3c05('0x16')];this[_0x3c05('0x17')]=_0xce57c0[_0x3c05('0x17')];this['recallme']=_0xce57c0['recallme'];this[_0x3c05('0x18')]=_0xce57c0[_0x3c05('0x18')];this[_0x3c05('0x19')]=_0xce57c0[_0x3c05('0x19')];this[_0x3c05('0x1a')]=_0xce57c0['UserId'];this[_0x3c05('0x1b')]=_0xce57c0[_0x3c05('0x1b')];this[_0x3c05('0x1c')]=_0xce57c0[_0x3c05('0x1c')];this['originatecalleridnum']=_0xce57c0['originatecalleridnum']||'';this['originatecalleridname']=_0xce57c0[_0x3c05('0x1d')]||'';}module[_0x3c05('0x1e')]=History; \ No newline at end of file +var _0x0e33=['originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x6b7519,_0x58034b){var _0x49ec80=function(_0x37185c){while(--_0x37185c){_0x6b7519['push'](_0x6b7519['shift']());}};_0x49ec80(++_0x58034b);}(_0x0e33,0xce));var _0x30e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e33[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x30e3('0x0'));var moment=require(_0x30e3('0x1'));function getSeconds(_0x3b5ae3,_0x2818bd){var _0x32a1ee=moment(_0x3b5ae3)[_0x30e3('0x2')](0x0);var _0x140a9f=moment(_0x2818bd)[_0x30e3('0x2')](0x0);return _0x32a1ee['diff'](_0x140a9f,_0x30e3('0x3'));}function History(_0x307409){this[_0x30e3('0x4')]=_0x307409[_0x30e3('0x4')];this[_0x30e3('0x5')]=_0x307409[_0x30e3('0x5')]||undefined;this[_0x30e3('0x6')]=_0x307409['type'];this[_0x30e3('0x7')]=_0x307409['type']===_0x30e3('0x8')?_0x30e3('0x9'):_0x307409['type'];this[_0x30e3('0xa')]=_0x307409[_0x30e3('0xa')];this[_0x30e3('0xb')]=_0x307409['countcongestionretry'];this[_0x30e3('0xc')]=_0x307409[_0x30e3('0xc')];this['countglobal']=_0x307409['countbusyretry']+_0x307409['countcongestionretry']+_0x307409[_0x30e3('0xc')];this[_0x30e3('0x9')]=_0x307409['queue'];this[_0x30e3('0xd')]=_0x307409[_0x30e3('0xe')];this[_0x30e3('0xf')]=_0x307409[_0x30e3('0x10')];this[_0x30e3('0x11')]=_0x307409[_0x30e3('0x11')];this[_0x30e3('0x12')]=_0x307409[_0x30e3('0x12')];this['endtime']=_0x307409[_0x30e3('0x12')];this[_0x30e3('0x13')]=getSeconds(_0x307409['responsetime'],_0x307409[_0x30e3('0x11')]);this[_0x30e3('0x14')]=0x0;this[_0x30e3('0x15')]=0x0;this[_0x30e3('0x16')]=_0x307409['callback'];this['callbackuniqueid']=_0x307409[_0x30e3('0x17')];this['callbackat']=_0x307409[_0x30e3('0x18')];this[_0x30e3('0x19')]=_0x307409[_0x30e3('0x19')];this['ContactId']=_0x307409[_0x30e3('0x1a')];this[_0x30e3('0x1b')]=_0x307409['ListId'];this[_0x30e3('0x1c')]=_0x307409['UserId'];this[_0x30e3('0x1d')]=_0x307409['VoiceQueueId'];this[_0x30e3('0x1e')]=_0x307409[_0x30e3('0x1e')];this[_0x30e3('0x1f')]=_0x307409[_0x30e3('0x1f')]||'';this['originatecalleridname']=_0x307409[_0x30e3('0x20')]||'';}module[_0x30e3('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 6daa29c..ea21a7f 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 _0x88c5=['actionid','stateinterface','locked','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','ListId','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','phone','Contact','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','substring','xcally-motion-dialer','from-sip','[originateError]:\x20%s','OriginateError','starttime','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','countnoanswerretry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','countbusyretry','dialBusyRetryFrequency','minutes','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','dialGlobalMaxRetry','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\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','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Ts\x20=\x20','[abandonmentRate]','p\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','md5','ioredis','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','name','message','NOT_ACTIVE','Interval','\x20INTERVAL_IS_NULL','Intervals','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','pTalking','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','prototype','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','enqueue','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','value','HANGUP','uniqueId','HangupInAMD','membername','[syncHangupInAMD][createHistory]','Machine','AMD','amd','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[syncMachineIvr]','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','syncAgentComplete','reason','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','dropreason','TIMEOUT','agiafterat','dialQueueProject2','Abandoned','CALLEREXIT','actions'];(function(_0x3a107b,_0x5b8c0d){var _0x10cca3=function(_0x18088d){while(--_0x18088d){_0x3a107b['push'](_0x3a107b['shift']());}};_0x10cca3(++_0x5b8c0d);}(_0x88c5,0xe2));var _0x588c=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x88c5[_0x13ff53];return _0x290228;};'use strict';var util=require(_0x588c('0x0'));var _=require('lodash');var BPromise=require(_0x588c('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x588c('0x2'));var Redis=require(_0x588c('0x3'));var config=require('../../../config/environment/');var logger=require(_0x588c('0x4'))('dialer');var loggerBooked=require(_0x588c('0x4'))(_0x588c('0x5'));var loggerPredictive=require(_0x588c('0x4'))(_0x588c('0x6'));var loggerPredictiveCalls=require(_0x588c('0x4'))(_0x588c('0x7'));var loggerSyncQueueSummary=require(_0x588c('0x4'))(_0x588c('0x8'));var ami=require(_0x588c('0x9'));config[_0x588c('0xa')]=_[_0x588c('0xb')](config[_0x588c('0xa')],{'host':_0x588c('0xc'),'port':0x18eb});var io=require(_0x588c('0xd'))(new Redis(config[_0x588c('0xa')]));var cmHopper=require(_0x588c('0xe'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x588c('0xf'));var cmHopperBlack=require(_0x588c('0x10'));var voiceQueueRt=require(_0x588c('0x11'));var Action=require(_0x588c('0x12'));var History=require('./history');var Final=require(_0x588c('0x13'));var AgentComplete=require(_0x588c('0x14'));var QueueCallerAbandon=require(_0x588c('0x15'));var Hangup=require(_0x588c('0x16'));var ipAgi=process['env'][_0x588c('0x17')]||'127.0.0.1';var strategy={'rrmemory':_0x588c('0x18'),'roundrobin':_0x588c('0x19')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x1b4522){this['tail']=this[_0x588c('0x1a')]?this[_0x588c('0x1a')][_0x588c('0x1b')](_0x1b4522):_0x1b4522();};function Dialer(_0x1b028c,_0x943ed7){this[_0x588c('0x1c')]=new Sequence();this[_0x588c('0x1d')]=_0x943ed7;this['voiceQueues']=_0x1b028c[_0x588c('0x1e')];this[_0x588c('0x1f')]=_0x1b028c[_0x588c('0x1f')];this['agents']=_0x1b028c[_0x588c('0x20')];this[_0x588c('0x21')]=_0x1b028c[_0x588c('0x21')];this[_0x588c('0x22')]=config[_0x588c('0x22')]||0x2;this[_0x588c('0x23')]={};this['actions']={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0x588c('0x24')]={};this[_0x588c('0x25')]={};this[_0x588c('0x26')]={};this[_0x588c('0x27')]={};this[_0x588c('0x28')]={};ami['on'](_0x588c('0x29'),this[_0x588c('0x2a')][_0x588c('0x2b')](this));ami['on']('queuecallerabandon',this[_0x588c('0x2c')][_0x588c('0x2b')](this));ami['on'](_0x588c('0x2d'),this[_0x588c('0x2e')]['bind'](this));ami['on'](_0x588c('0x2f'),this['syncAgentComplete'][_0x588c('0x2b')](this));ami['on']('custom:queuesummary',this[_0x588c('0x8')]['bind'](this));ami['on'](_0x588c('0x30'),this[_0x588c('0x31')][_0x588c('0x2b')](this));ami['on'](_0x588c('0x32'),this[_0x588c('0x33')][_0x588c('0x2b')](this));ami['on'](_0x588c('0x34'),this[_0x588c('0x35')][_0x588c('0x2b')](this));ami['on'](_0x588c('0x36'),this[_0x588c('0x37')][_0x588c('0x2b')](this));ami['on'](_0x588c('0x38'),this[_0x588c('0x39')][_0x588c('0x2b')](this));this[_0x588c('0x3a')]();this[_0x588c('0x3b')]();}function isNotNull(_0x4a714b){return _0x4a714b!==null&&!_[_0x588c('0x3c')](_0x4a714b);}function checkIsLoggedIn(_0x4d4676,_0x1162fb){return function(){if(_0x1162fb<=0x0){_0x4d4676['message']='AGENTS_NOT_LOGGED';throw _0x4d4676[_0x588c('0x3d')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3a7408){return _0x3a7408;}function checkIsActive(_0x2ad86c,_0x59dedc){return function(){if(!isActive(_0x59dedc)){_0x2ad86c[_0x588c('0x3e')]=_0x588c('0x3f');throw _0x2ad86c[_0x588c('0x3d')]+'\x20NOT\x20Active';}};}function checkInterval(_0x293337){return function(){if(!isNotNull(_0x293337[_0x588c('0x40')])){_0x293337[_0x588c('0x3e')]='INTERVAL_IS_NULL';throw _0x293337[_0x588c('0x3d')]+_0x588c('0x41');}if(!isNotNull(_0x293337[_0x588c('0x40')][_0x588c('0x42')])){_0x293337[_0x588c('0x3e')]='INTERVAL_IS_NULL';throw _0x293337[_0x588c('0x3d')]+_0x588c('0x41');}if(!isNotNull(_[_0x588c('0x43')](_0x293337[_0x588c('0x40')][_0x588c('0x42')]))){_0x293337['message']=_0x588c('0x44');throw _0x293337['name']+_0x588c('0x41');}};}function msgResponse(_0x205864,_0x1cedac,_0x5557b7){return{'action':_0x205864,'response':_0x1cedac,'message':_0x5557b7,'stack':_0x5557b7};}function myreject(_0x5d8b26){return function(_0x719ee0){return _0x5d8b26(msgResponse(_0x588c('0x45'),_0x588c('0x46'),JSON[_0x588c('0x47')](_0x719ee0)));};}function getSeconds(_0x325735,_0x28c220){var _0x5b6e1b=moment(_0x325735)['milliseconds'](0x0);var _0x5e3407=moment(_0x28c220)[_0x588c('0x48')](0x0);return _0x5b6e1b[_0x588c('0x49')](_0x5e3407,_0x588c('0x4a'));}function emit(_0xc82d45,_0x4a8022,_0x127164){io['to'](_0xc82d45)[_0x588c('0x4b')](_0x4a8022,_0x127164);}function emitVoiceQueueSummary(_0x5562fd){if(_0x5562fd[_0x588c('0x4c')]===_0x588c('0x4d')){var _0x3d6f93={'id':_0x5562fd['id'],'name':_0x5562fd[_0x588c('0x3d')],'strategy':_0x5562fd[_0x588c('0x4e')],'answered':_0x5562fd[_0x588c('0x4f')],'available':_0x5562fd[_0x588c('0x50')],'loggedIn':_0x5562fd['loggedIn'],'pTalking':_0x5562fd[_0x588c('0x51')],'sumBillable':_0x5562fd['sumBillable'],'sumDuration':_0x5562fd[_0x588c('0x52')],'sumHoldTime':_0x5562fd['sumHoldTime']||0x0,'talking':_0x5562fd[_0x588c('0x53')],'total':_0x5562fd[_0x588c('0x54')],'type':_0x5562fd[_0x588c('0x4c')],'unmanaged':_0x5562fd[_0x588c('0x55')],'abandoned':_0x5562fd[_0x588c('0x56')],'waiting':_0x5562fd[_0x588c('0x57')],'loggedInDb':_0x5562fd[_0x588c('0x58')],'dialActive':_0x5562fd[_0x588c('0x59')],'dialMethod':_0x5562fd[_0x588c('0x5a')],'dialOriginateCallerIdName':_0x5562fd[_0x588c('0x5b')],'dialOriginateCallerIdNumber':_0x5562fd[_0x588c('0x5c')],'dialOriginateTimeout':_0x5562fd[_0x588c('0x5d')],'dialPrefix':_0x5562fd[_0x588c('0x5e')],'outboundAnswerAgiCallsDay':_0x5562fd[_0x588c('0x5f')],'outboundAnswerCallsDay':_0x5562fd[_0x588c('0x60')],'outboundBlacklistCallsDay':_0x5562fd[_0x588c('0x61')],'outboundBusyCallsDay':_0x5562fd[_0x588c('0x62')],'outboundCongestionCallsDay':_0x5562fd[_0x588c('0x63')],'outboundDropCallsDayACS':_0x5562fd[_0x588c('0x64')],'outboundDropCallsDayCallersExit':_0x5562fd[_0x588c('0x65')],'outboundDropCallsDayTimeout':_0x5562fd[_0x588c('0x66')],'outboundNoAnswerCallsDay':_0x5562fd['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5562fd[_0x588c('0x67')],'outboundOriginateFailureCallsDay':_0x5562fd[_0x588c('0x68')],'outboundReCallsDay':_0x5562fd[_0x588c('0x69')],'outboundRejectCallsDay':_0x5562fd[_0x588c('0x6a')],'outboundUnknownCallsDay':_0x5562fd['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x5562fd[_0x588c('0x6b')],'predictiveIntervalAvgHoldtime':_0x5562fd['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5562fd['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5562fd[_0x588c('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x5562fd[_0x588c('0x6d')],'predictiveIntervalErlangCalls':_0x5562fd[_0x588c('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x5562fd[_0x588c('0x6f')],'predictiveIntervalHitRate':_0x5562fd[_0x588c('0x70')],'predictiveIntervalMultiplicativeFactor':_0x5562fd[_0x588c('0x71')],'predictiveIntervalPauses':_0x5562fd['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5562fd[_0x588c('0x72')],'predictiveIntervalTotalCalls':_0x5562fd[_0x588c('0x73')],'message':_0x5562fd['message'],'originated':_0x5562fd['originated'],'erlangCalls':_0x5562fd[_0x588c('0x74')],'erlangCallToSecond':_0x5562fd[_0x588c('0x75')],'erlangAbandonmentRate':_0x5562fd['erlangAbandonmentRate'],'erlangBusyFactor':_0x5562fd[_0x588c('0x76')],'startPredictive':_0x5562fd[_0x588c('0x24')],'startProgressive':_0x5562fd[_0x588c('0x25')]};if(_0x5562fd['Trunk']){_0x3d6f93[_0x588c('0x77')]={'id':_0x5562fd[_0x588c('0x77')]['id'],'name':_0x5562fd[_0x588c('0x77')][_0x588c('0x3d')],'active':_0x5562fd[_0x588c('0x77')][_0x588c('0x78')],'callerid':_0x5562fd['Trunk'][_0x588c('0x79')]};}if(_0x5562fd['Interval']){_0x3d6f93['Interval']={'id':_0x5562fd[_0x588c('0x40')]['id'],'name':_0x5562fd[_0x588c('0x40')]['name']};}var _0xe62762=md5(JSON[_0x588c('0x47')](_0x3d6f93));if(_0x5562fd[_0x588c('0x2')]!==_0xe62762){_0x5562fd[_0x588c('0x2')]=_0xe62762;emit(util[_0x588c('0x7a')](_0x588c('0x7b'),_0x3d6f93['name']),_0x588c('0x7c'),_0x3d6f93);}}}function emitCampaignSummary(_0x2641ab){if(_0x2641ab[_0x588c('0x4c')]===_0x588c('0x7d')){emit(util[_0x588c('0x7a')](_0x588c('0x7e'),_0x2641ab[_0x588c('0x3d')]),_0x588c('0x7f'),_0x2641ab);}}function checkGetDataPredictive(_0x35da6c){if(isNotNull(_0x35da6c)){if(!_[_0x588c('0x43')](_0x35da6c)){loggerPredictive['info'](_0x588c('0x80'));loggerPredictive[_0x588c('0x81')](_0x588c('0x82'),_0x35da6c[_0x588c('0x73')]);loggerPredictive[_0x588c('0x81')](_0x588c('0x83'),_0x35da6c['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x588c('0x84'),_0x35da6c[_0x588c('0x6d')]);loggerPredictive[_0x588c('0x81')](_0x588c('0x85'),_0x35da6c[_0x588c('0x6c')]);loggerPredictive[_0x588c('0x81')](_0x588c('0x86'),_0x35da6c['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x588c('0x81')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35da6c[_0x588c('0x87')]);loggerPredictive[_0x588c('0x81')](_0x588c('0x88'));if(_0x35da6c[_0x588c('0x73')]>0x0){if(!_[_0x588c('0x3c')](_0x35da6c[_0x588c('0x87')])&&_0x35da6c[_0x588c('0x87')]>0x0){return!![];}else{loggerPredictive['info'](_0x588c('0x89'));}if(!_[_0x588c('0x3c')](_0x35da6c[_0x588c('0x8a')])&&_0x35da6c[_0x588c('0x8a')]>0x0){return!![];}else{loggerPredictive[_0x588c('0x81')](_0x588c('0x8b'));}}else{loggerPredictive[_0x588c('0x81')](_0x588c('0x8c'));}}else{loggerPredictive[_0x588c('0x81')](_0x588c('0x8d'));}}else{loggerPredictive[_0x588c('0x81')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5ae190){return function(_0x24f441){loggerPredictive[_0x588c('0x81')](_0x588c('0x8e'));loggerPredictive[_0x588c('0x81')](_0x588c('0x8f'),_0x24f441[_0x588c('0x74')]);loggerPredictive[_0x588c('0x81')](_0x588c('0x90'),_0x24f441['erlangCallToSecond']);loggerPredictive['info'](_0x588c('0x91'),_0x24f441[_0x588c('0x92')]);loggerPredictive[_0x588c('0x81')](_0x588c('0x93'),_0x24f441[_0x588c('0x76')]);loggerPredictive[_0x588c('0x81')](_0x588c('0x91'),_0x24f441[_0x588c('0x92')]);loggerPredictive[_0x588c('0x81')](_0x588c('0x88'));_[_0x588c('0x94')](_0x5ae190,_0x24f441);};}function getDiff(_0x5673e6){var _0x32eba6=moment()[_0x588c('0x48')](0x0);var _0x5884e5=moment(_0x5673e6)[_0x588c('0x48')](0x0);return _0x32eba6[_0x588c('0x49')](_0x5884e5,'seconds');}function ifInterval(_0x1fb415,_0x4f9950){if(_[_0x588c('0x3c')](_0x4f9950)){return![];}if(getDiff(_0x4f9950)<_0x1fb415*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x21833e){if(isNotNull(_0x21833e)){if(!_[_0x588c('0x3c')](_0x21833e[_0x588c('0x25')])){_0x21833e[_0x588c('0x25')]=undefined;loggerPredictive['info'](_0x21833e[_0x588c('0x3d')],_0x588c('0x95'));}if(!_[_0x588c('0x3c')](_0x21833e['startPredictive'])){_0x21833e[_0x588c('0x24')]=undefined;loggerPredictive[_0x588c('0x81')](_0x21833e['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x588c('0x3c')](_0x21833e[_0x588c('0x96')])){clearInterval(_0x21833e[_0x588c('0x96')]);_0x21833e['handlePredictive']=undefined;loggerPredictive[_0x588c('0x81')](_0x21833e['name'],_0x588c('0x97'));}}}function erlangb(_0xbc3056,_0x5b7c86){if(_0x5b7c86===0x0){return 0x0;}var _0x6920c2=0x1;for(var _0x122ffd=0x1;_0x122ffd<=_0x5b7c86;_0x122ffd+=0x1){_0x6920c2=0x1+_0x6920c2*_0x122ffd/_0xbc3056;}return 0x1/_0x6920c2;}function isVoiceQueueOutbound(_0x4344bb){return _0x4344bb==='outbound';}function isNotPreview(_0x3c90fa){return _0x3c90fa!==_0x588c('0x1d');}function isCampaignIvr(_0x3a942f){return _0x3a942f===_0x588c('0x7d');}function getCallerId(_0x2895ac,_0x36b012,_0x52b4b0){if(!_['isUndefined'](_0x52b4b0)&&_0x588c('0x98')===typeof _0x52b4b0&&!_['isEmpty'](_0x52b4b0)){if(!_[_0x588c('0x3c')](_0x36b012)&&_0x588c('0x98')===typeof _0x36b012&&!_['isEmpty'](_0x36b012)){return util[_0x588c('0x7a')](_0x588c('0x99'),_0x36b012,_0x52b4b0);}return util[_0x588c('0x7a')](_0x588c('0x99'),_0x52b4b0,_0x52b4b0);}if(!_[_0x588c('0x3c')](_0x2895ac)&&_0x588c('0x98')===typeof _0x2895ac&&!_[_0x588c('0x43')](_0x2895ac)){return _0x2895ac;}return _0x588c('0x9a');}function loggerCatchQueueSummary(_0x19215d,_0x29db32){return function(_0x3bf55b){freeVariablesPredictive(_0x29db32);emitVoiceQueueSummary(_0x29db32);emitCampaignSummary(_0x29db32);loggerSyncQueueSummary[_0x588c('0x9b')](_0x19215d,util[_0x588c('0x9c')](_0x3bf55b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2c8ada,_0x3c3c42){return function(_0x324dd3){loggerPredictive[_0x588c('0x9b')](_0x3c3c42[_0x588c('0x3d')],_0x2c8ada);loggerPredictive[_0x588c('0x9b')](_0x324dd3[_0x588c('0x9d')]);freeVariablesPredictive(_0x3c3c42);};}function loggerCatch(_0x519eff){return function(_0x5afe64){logger['error'](_0x519eff,util[_0x588c('0x9c')](_0x5afe64,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x14cc77){return _0x14cc77&&!_[_0x588c('0x3c')](_0x14cc77)&&_0x14cc77[_0x588c('0x9e')]>0x0;}function decremetOriginate(_0x299767){if(!_['isUndefined'](_0x299767)&&_0x299767!==null){if(_0x299767['hasOwnProperty'](_0x588c('0x9f'))){if(_0x299767[_0x588c('0x9f')]>0x0){_0x299767[_0x588c('0x9f')]-=0x1;}else{logger[_0x588c('0x9b')](_0x588c('0xa0'));}}}else{logger[_0x588c('0x9b')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x531d2c,_0x328600,_0x56b530){if(_0x328600>_0x56b530){for(var _0x2fa330=0x0;_0x2fa330<_0x328600-_0x56b530;_0x2fa330+=0x1){decremetOriginate(_0x531d2c);}}}function loggerGetContactDialer(_0x440788,_0x69674d,_0x2ba117){return function(_0x417e90){checkContactLowerLimitOriginate(_0x69674d,_0x2ba117,0x0);logger[_0x588c('0x9b')](_0x440788,util['inspect'](_0x417e90,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x34d561){return function(_0xb2fb4f){if(isNotNull(_0xb2fb4f)&&isNotNull(_0xb2fb4f[0x0])){if(_0xb2fb4f[0x0][_0x588c('0xa1')]>0x0){_0x34d561['message']='RESCHEDULED_CONTACTS';logger['info'](_0x588c('0xa2')+_0x34d561[_0x588c('0x3d')],_0xb2fb4f[0x0][_0x588c('0xa1')],_0x588c('0xa3'));}else{_0x34d561['message']=_0x588c('0xa4');logger[_0x588c('0x81')](_0x588c('0xa5')+_0x34d561['name']);}}};}function notSendMessagesQueue(_0x459c83){if(_0x459c83[_0x588c('0xa6')]){freeVariablesPredictive(_0x459c83);if(_0x459c83[_0x588c('0x9f')]===0x0&&_0x459c83[_0x588c('0x53')]===0x0&&_0x459c83[_0x588c('0x57')]===0x0&&(_0x459c83[_0x588c('0x51')]||0x0)===0x0){_0x459c83[_0x588c('0xa6')]=![];_0x459c83['available']=0x0;_0x459c83[_0x588c('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x588c('0x9b')](_0x588c('0xa7'),_0x459c83[_0x588c('0x3d')],_0x588c('0xa8'));}else{_0x459c83[_0x588c('0x3e')]=_0x588c('0xa9');loggerSyncQueueSummary[_0x588c('0x9b')](_0x588c('0xa7'),_0x459c83[_0x588c('0x3d')],'is\x20disactive');}emitVoiceQueueSummary(_0x459c83);}}function notSendMessagesCampaign(_0x43f43f){if(_0x43f43f[_0x588c('0xa6')]){if(_0x43f43f[_0x588c('0x9f')]===0x0){_0x43f43f[_0x588c('0xa6')]=![];_0x43f43f['message']=_0x588c('0x3f');loggerSyncQueueSummary[_0x588c('0x9b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x43f43f[_0x588c('0x3d')],_0x588c('0xa8'));}else{_0x43f43f[_0x588c('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x588c('0xaa'),_0x43f43f['name'],'is\x20disactive');}emitCampaignSummary(_0x43f43f);}}function createObjHistory(_0x372497,_0x242777,_0x47b3ff,_0x3c4924,_0x5e2458){_0x372497[_0x588c('0x3e')]=_0x47b3ff;var _0x577361=new Action(_0x372497,_0x242777);var _0x10482b=new History(_0x577361);_0x10482b[_0x588c('0xab')]=_0x3c4924;_0x10482b[_0x588c('0xac')]=_0x5e2458;_0x10482b[_0x588c('0xad')]=_0x577361['starttime'];return _0x10482b;}Dialer[_0x588c('0xae')][_0x588c('0x3b')]=function(){var _0x27d8e2=this;setInterval(function(){_0x27d8e2[_0x588c('0xaf')](_0x27d8e2['uniqueId'],_0x588c('0xb0'));_0x27d8e2[_0x588c('0xaf')](_0x27d8e2['actions'],_0x588c('0xb1'));},0x32c8);};Dialer['prototype'][_0x588c('0xaf')]=function(_0x2a89f1,_0x2f2157){var _0x3223c5=this;for(var _0x2132ff in _0x2a89f1){if(_0x2a89f1[_0x588c('0xb2')](_0x2132ff)){this[_0x588c('0x1c')][_0x588c('0xb3')](function(){if(!_['isNil'](_0x2a89f1[_0x2132ff])){return ami[_0x588c('0xb4')]({'action':_0x588c('0xb5'),'channel':_0x2a89f1[_0x2132ff][_0x588c('0xb6')]})[_0x588c('0xb7')](function(_0x546fd0){if(_0x546fd0[_0x588c('0x3e')]===_0x588c('0xb8')){setTimeout(function(){if(_0x2a89f1[_0x2132ff]&&_0x2a89f1[_0x2132ff][_0x588c('0x4c')]!==_0x588c('0x7d')){_0x3223c5[_0x588c('0xb9')](_0x3223c5[_0x588c('0x1e')][_0x2a89f1[_0x2132ff]['queue']]);logger[_0x588c('0x9b')]('[Dialer][checkChannel]',_0x2f2157,_0x2132ff,_0x2a89f1[_0x2132ff]['queue']);delete _0x2a89f1[_0x2132ff];}if(_0x2a89f1[_0x2132ff]&&_0x2a89f1[_0x2132ff][_0x588c('0x4c')]===_0x588c('0x7d')){_0x3223c5[_0x588c('0xb9')](_0x3223c5[_0x588c('0x1f')][_0x2a89f1[_0x2132ff][_0x588c('0xba')]]);logger[_0x588c('0x9b')]('[Dialer][checkChannel][ivr]',_0x2f2157,_0x2132ff,_0x2a89f1[_0x2132ff][_0x588c('0xba')]);delete _0x2a89f1[_0x2132ff];}},0x2328);}});}});}}};Dialer[_0x588c('0xae')][_0x588c('0xbb')]=function(_0x1f6e49){return BPromise[_0x588c('0xbc')]()[_0x588c('0xbd')](cmHopper['countReScheduled'](_0x1f6e49))['catch'](loggerCatch(_0x588c('0xbe')));};Dialer['prototype'][_0x588c('0xbf')]=function(_0x26e959){return BPromise[_0x588c('0xbc')]()[_0x588c('0xbd')](cmHopperBlack[_0x588c('0xbf')](_0x26e959))[_0x588c('0xb7')](loggerCatch(_0x588c('0xc0')));};Dialer[_0x588c('0xae')][_0x588c('0xc1')]=function(_0x2e3c57){return BPromise[_0x588c('0xbc')]()[_0x588c('0xbd')](cmHopperBlack['checkIsBlackListIvr'](_0x2e3c57))['catch'](loggerCatch(_0x588c('0xc2')));};Dialer['prototype'][_0x588c('0xc3')]=function(_0x5e58ad){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x5e58ad))[_0x588c('0xb7')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x588c('0xae')][_0x588c('0xc4')]=function(_0x46a3ba){return BPromise[_0x588c('0xbc')]()[_0x588c('0xbd')](cmHopper['rescheduleContact'](_0x46a3ba))[_0x588c('0xb7')](loggerCatch(_0x588c('0xc5')));};Dialer['prototype'][_0x588c('0xc6')]=function(_0x449d84,_0x274432,_0x14735d,_0x310165){return BPromise[_0x588c('0xbc')]()[_0x588c('0xbd')](cmHopper[_0x588c('0xc6')](_0x449d84,_0x274432,_0x14735d,_0x310165))[_0x588c('0xb7')](loggerCatch(_0x588c('0xc7')));};Dialer['prototype'][_0x588c('0xc8')]=function(_0x4967d3,_0x113beb,_0x47298c){return BPromise['resolve']()[_0x588c('0xbd')](cmHopper[_0x588c('0xc8')](_0x4967d3,_0x113beb,_0x47298c))[_0x588c('0xb7')](loggerCatch(_0x588c('0xc7')));};Dialer[_0x588c('0xae')][_0x588c('0xc9')]=function(_0x2436bc){return BPromise[_0x588c('0xbc')]()[_0x588c('0xbd')](voiceQueueRt[_0x588c('0xc9')](_0x2436bc))[_0x588c('0xb7')](loggerCatch(_0x588c('0xca')));};Dialer[_0x588c('0xae')][_0x588c('0xcb')]=function(_0x466d54){return BPromise[_0x588c('0xbc')]()[_0x588c('0xbd')](cmHopper[_0x588c('0xcb')](_0x466d54))[_0x588c('0xb7')](loggerCatch(_0x588c('0xcc')));};Dialer[_0x588c('0xae')][_0x588c('0xcd')]=function(_0x40b789){return BPromise['resolve']()[_0x588c('0xbd')](cmHopperHistory[_0x588c('0xcd')](_0x40b789))[_0x588c('0xb7')](loggerCatch('[createHistory]\x20'));};Dialer[_0x588c('0xae')][_0x588c('0xb9')]=function(_0x21635e){if(!_[_0x588c('0x3c')](_0x21635e)&&_0x21635e!==null){if(_0x21635e[_0x588c('0xb2')](_0x588c('0x9f'))){if(_0x21635e[_0x588c('0x9f')]>0x0){_0x21635e[_0x588c('0x9f')]-=0x1;}else{logger['error'](_0x588c('0xce'));}}}else{logger[_0x588c('0x9b')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0x588c('0xcf')]=function(_0x3e5a96,_0x2980ab){var _0x40522d=this;return function(_0x3e5d8c){_0x40522d[_0x588c('0xb9')](_0x2980ab);logger[_0x588c('0x9b')](_0x3e5a96,util[_0x588c('0x9c')](_0x3e5d8c,{'showHidden':![],'depth':null}));};};Dialer[_0x588c('0xae')][_0x588c('0xd0')]=function(_0xe789b1,_0x4140f4,_0x6fd563){var _0x44d13b={'state':0x19,'statedesc':_0x588c('0xd1')};this[_0x588c('0xb9')](_0x4140f4);this[_0x588c('0xd2')](_[_0x588c('0x94')](_0x44d13b,_[_0x588c('0xd3')](_0x6fd563,[_0x588c('0xd4'),'ListId',_0x588c('0xd5'),_0x588c('0xd6'),_0x588c('0xd7')])),_0x588c('0xd8'),_0x588c('0xd9'));logger[_0x588c('0x9b')](_0xe789b1);};Dialer[_0x588c('0xae')][_0x588c('0xda')]=function(_0x1c9e08){return _0x1c9e08===_0x588c('0xdb');};Dialer[_0x588c('0xae')]['isTrunkReachable']=function(_0x2a3cfd){return!_['isUndefined'](_0x2a3cfd)&&_0x2a3cfd&&!_[_0x588c('0x3c')](_0x2a3cfd[_0x588c('0x3d')])&&!_[_0x588c('0x3c')](_0x2a3cfd[_0x588c('0x78')])&&_0x2a3cfd['active']&&(this[_0x588c('0x21')][util[_0x588c('0x7a')](_0x588c('0xdc'),_0x2a3cfd[_0x588c('0x3d')])][_0x588c('0xb5')]===_0x588c('0xdd')||this['trunks'][util[_0x588c('0x7a')]('SIP/%s',_0x2a3cfd[_0x588c('0x3d')])][_0x588c('0xb5')]===_0x588c('0xde'));};Dialer[_0x588c('0xae')][_0x588c('0xd2')]=function(_0x2c62d9,_0xd1728f,_0x2181ea){this['createHistory'](_0x2c62d9)[_0x588c('0xb7')](loggerCatch(_0xd1728f));this[_0x588c('0xcb')](_0x2c62d9)[_0x588c('0xb7')](loggerCatch(_0x2181ea));};Dialer[_0x588c('0xae')][_0x588c('0x35')]=function(_0x51b646){var _0x399a06=this['uniqueId'][_0x51b646[_0x588c('0xdf')]];var _0x1e56d9;if(!_[_0x588c('0xe0')](_0x51b646)&&!_[_0x588c('0xe0')](_0x51b646[_0x588c('0xe1')])&&!_[_0x588c('0xe0')](_0x51b646[_0x588c('0xe1')][_0x588c('0xe2')])&&_0x51b646[_0x588c('0xe3')]==='xcally-motion-dialer'&&_0x399a06){if(_0x399a06[_0x588c('0x4c')]!==_0x588c('0x7d')&&this[_0x588c('0x1e')][_0x399a06[_0x588c('0xba')]][_0x588c('0xe4')]&&_0x51b646[_0x588c('0xe5')]===_0x588c('0xe6')){delete this[_0x588c('0xe7')][_0x51b646[_0x588c('0xdf')]];this[_0x588c('0xb9')](this[_0x588c('0x1e')][_0x399a06[_0x588c('0xba')]]);this['voiceQueues'][_0x399a06[_0x588c('0xba')]][_0x588c('0x60')]+=0x1;this['voiceQueues'][_0x399a06[_0x588c('0xba')]][_0x588c('0x5f')]+=0x1;_0x1e56d9=new Hangup(_0x399a06,_0x51b646);_0x1e56d9[_0x588c('0xab')]=0x12;_0x1e56d9[_0x588c('0xac')]=_0x588c('0xe8');_0x1e56d9[_0x588c('0xe9')]='AMD';this[_0x588c('0xd2')](_0x1e56d9,_0x588c('0xea'),'[syncHangupInAMD]');}if(_0x399a06[_0x588c('0x4c')]!==_0x588c('0x7d')&&this[_0x588c('0x1e')][_0x399a06[_0x588c('0xba')]][_0x588c('0xe4')]&&_0x51b646[_0x588c('0xe5')]==='MACHINE'){delete this['uniqueId'][_0x51b646['uniqueid']];this[_0x588c('0xb9')](this[_0x588c('0x1e')][_0x399a06[_0x588c('0xba')]]);this[_0x588c('0x1e')][_0x399a06[_0x588c('0xba')]][_0x588c('0x60')]+=0x1;this[_0x588c('0x1e')][_0x399a06[_0x588c('0xba')]][_0x588c('0x5f')]+=0x1;_0x1e56d9=new Hangup(_0x399a06,_0x51b646);_0x1e56d9[_0x588c('0xab')]=0x13;_0x1e56d9[_0x588c('0xac')]=_0x588c('0xeb');_0x1e56d9[_0x588c('0xe9')]=_0x588c('0xec');_0x1e56d9[_0x588c('0xed')]=!![];this['saveInDb'](_0x1e56d9,'[syncMachine][createHistory]',_0x588c('0xee'));}if(_0x399a06[_0x588c('0x4c')]==='ivr'&&this[_0x588c('0x1f')][_0x399a06[_0x588c('0xba')]]['dialAMDActive']&&_0x51b646[_0x588c('0xe5')]===_0x588c('0xe6')){delete this[_0x588c('0xe7')][_0x51b646[_0x588c('0xdf')]];this[_0x588c('0xb9')](this[_0x588c('0x1f')][_0x399a06['queue']]);_0x1e56d9=new Hangup(_0x399a06,_0x51b646);_0x1e56d9[_0x588c('0xab')]=0x12;_0x1e56d9[_0x588c('0xac')]='HangupInAMD';_0x1e56d9[_0x588c('0xe9')]=_0x588c('0xec');this[_0x588c('0xd2')](_0x1e56d9,_0x588c('0xef'),_0x588c('0xf0'));}if(_0x399a06[_0x588c('0x4c')]===_0x588c('0x7d')&&this['campaigns'][_0x399a06['queue']][_0x588c('0xe4')]&&_0x51b646[_0x588c('0xe5')]===_0x588c('0xf1')){delete this['uniqueId'][_0x51b646[_0x588c('0xdf')]];this['updateOriginated'](this['campaigns'][_0x399a06[_0x588c('0xba')]]);_0x1e56d9=new Hangup(_0x399a06,_0x51b646);_0x1e56d9[_0x588c('0xab')]=0x13;_0x1e56d9['statedesc']=_0x588c('0xeb');_0x1e56d9[_0x588c('0xe9')]='AMD';_0x1e56d9[_0x588c('0xed')]=!![];this[_0x588c('0xd2')](_0x1e56d9,'[syncMachineIvr][createHistory]',_0x588c('0xf2'));}}};Dialer[_0x588c('0xae')][_0x588c('0x31')]=function(_0x962ce7){var _0x327b73=this[_0x588c('0xe7')][_0x962ce7[_0x588c('0xdf')]];var _0x323c9e=this;var _0x550a4f;if(_0x327b73&&_0x327b73[_0x588c('0x4c')]===_0x588c('0x7d')){delete this[_0x588c('0xe7')][_0x962ce7[_0x588c('0xdf')]];this['updateOriginated'](this[_0x588c('0x1f')][_0x327b73[_0x588c('0xba')]]);this[_0x588c('0x1f')][_0x327b73[_0x588c('0xba')]]['ivrAnswerCallsDay']+=0x1;_0x550a4f=new Hangup(_0x327b73,_0x962ce7);this[_0x588c('0xcd')](_0x550a4f)[_0x588c('0xb7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x588c('0xcb')](_0x550a4f)[_0x588c('0xb7')](loggerCatch(_0x588c('0xf3')));}if(_0x327b73&&_0x327b73[_0x588c('0x4c')]!==_0x588c('0x7d')&&isNotNull(this['voiceQueues'][_0x327b73[_0x588c('0xba')]][_0x588c('0xf4')])){delete this['uniqueId'][_0x962ce7[_0x588c('0xdf')]];this[_0x588c('0xb9')](this['voiceQueues'][_0x327b73[_0x588c('0xba')]]);this['voiceQueues'][_0x327b73[_0x588c('0xba')]][_0x588c('0x60')]+=0x1;this[_0x588c('0x1e')][_0x327b73['queue']][_0x588c('0x5f')]+=0x1;_0x550a4f=new Hangup(_0x327b73,_0x962ce7);_0x550a4f[_0x588c('0xab')]=0x10;_0x550a4f[_0x588c('0xac')]='AnswerAGI';_0x550a4f['membername']=_0x588c('0xf5');this[_0x588c('0xcd')](_0x550a4f)[_0x588c('0xb7')](loggerCatch(_0x588c('0xf6')));this[_0x588c('0xcb')](_0x550a4f)[_0x588c('0xb7')](loggerCatch(_0x588c('0xf3')));}if(_0x327b73&&_0x327b73[_0x588c('0x4c')]!=='ivr'&&!isNotNull(this[_0x588c('0x1e')][_0x327b73[_0x588c('0xba')]][_0x588c('0xf4')])){delete this[_0x588c('0xe7')][_0x962ce7['uniqueid']];this['updateOriginated'](this[_0x588c('0x1e')][_0x327b73[_0x588c('0xba')]]);this[_0x588c('0x1e')][_0x327b73[_0x588c('0xba')]][_0x588c('0xf7')]+=0x1;_0x550a4f=new Hangup(_0x327b73,_0x962ce7);_0x550a4f[_0x588c('0xab')]=0xc;_0x550a4f[_0x588c('0xac')]=_0x962ce7['cause-txt'];_0x550a4f[_0x588c('0xe9')]='Unknow';this[_0x588c('0xcd')](_0x550a4f)['catch'](loggerCatch(_0x588c('0xf6')));this[_0x588c('0xcb')](_0x550a4f)[_0x588c('0xb7')](loggerCatch(_0x588c('0xf3')));}};Dialer['prototype'][_0x588c('0xf8')]=function(_0x25e40b){var _0x227efb=this[_0x588c('0xe7')][_0x25e40b[_0x588c('0xdf')]];var _0xd9674f=this;if(this['voiceQueues'][_0x25e40b['queue']]){if(_0x227efb&&_0x227efb[_0x588c('0x4c')]!==_0x588c('0x7d')){delete this[_0x588c('0xe7')][_0x25e40b[_0x588c('0xdf')]];this[_0x588c('0x1e')][_0x25e40b[_0x588c('0xba')]][_0x588c('0x60')]+=0x1;var _0x24383e=new AgentComplete(_0x227efb,_0x25e40b);if(_0x25e40b[_0x588c('0xf9')]==='agent'){_0x24383e['agiafterat']=this['voiceQueues'][_0x25e40b['queue']]['dialQueueProject2']&&this[_0x588c('0x1e')][_0x25e40b[_0x588c('0xba')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x588c('0xfa')):undefined;}this[_0x588c('0xcd')](_0x24383e)[_0x588c('0xb7')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x24383e)['catch'](loggerCatch(_0x588c('0xfb')));}}};Dialer[_0x588c('0xae')][_0x588c('0x2a')]=function(_0x5909a2){if(this['voiceQueues'][_0x5909a2[_0x588c('0xba')]]){if(this[_0x588c('0xe7')][_0x5909a2[_0x588c('0xdf')]]&&this[_0x588c('0xe7')][_0x5909a2[_0x588c('0xdf')]][_0x588c('0x4c')]!==_0x588c('0x7d')){this[_0x588c('0xb9')](this[_0x588c('0x1e')][_0x5909a2[_0x588c('0xba')]]);this[_0x588c('0xe7')][_0x5909a2['uniqueid']][_0x588c('0xfc')]=moment()[_0x588c('0x7a')](_0x588c('0xfa'));}}};Dialer[_0x588c('0xae')][_0x588c('0xfd')]=function(_0x4c646e){this[_0x588c('0xcd')](_0x4c646e)[_0x588c('0xb7')](loggerCatch(_0x588c('0xfe')));this[_0x588c('0xcb')](_0x4c646e)[_0x588c('0xb7')](loggerCatch(_0x588c('0xff')));};Dialer[_0x588c('0xae')][_0x588c('0x2c')]=function(_0x426f64){var _0x559acb=this[_0x588c('0xe7')][_0x426f64[_0x588c('0xdf')]];var _0x30c608=this;if(this[_0x588c('0x1e')][_0x426f64['queue']]){if(_0x559acb&&_0x559acb[_0x588c('0x4c')]!==_0x588c('0x7d')){delete this[_0x588c('0xe7')][_0x426f64[_0x588c('0xdf')]];this['updateOriginated'](this[_0x588c('0x1e')][_0x426f64[_0x588c('0xba')]]);_0x559acb[_0x588c('0x100')]=moment()[_0x588c('0x7a')](_0x588c('0xfa'));var _0x5b7f4d=new QueueCallerAbandon(_0x559acb,_0x426f64);if(getSeconds(_0x559acb[_0x588c('0x100')],_0x559acb['responsetime'])>=_0x559acb[_0x588c('0x101')]){this['voiceQueues'][_0x426f64[_0x588c('0xba')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x588c('0x1e')][_0x426f64['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x426f64[_0x588c('0xba')]][_0x588c('0x6f')]+=0x1;_0x5b7f4d[_0x588c('0xab')]=0xa;_0x5b7f4d['statedesc']='Drop';_0x5b7f4d[_0x588c('0x102')]=_0x588c('0x103');_0x5b7f4d[_0x588c('0x104')]=this[_0x588c('0x1e')][_0x426f64[_0x588c('0xba')]][_0x588c('0x105')]?moment()[_0x588c('0x7a')](_0x588c('0xfa')):undefined;this[_0x588c('0xfd')](_0x5b7f4d);}else{this[_0x588c('0x1e')][_0x426f64[_0x588c('0xba')]][_0x588c('0x6c')]+=0x1;this[_0x588c('0x1e')][_0x426f64[_0x588c('0xba')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5b7f4d[_0x588c('0xab')]=0xb;_0x5b7f4d[_0x588c('0xac')]=_0x588c('0x106');_0x5b7f4d[_0x588c('0x102')]=_0x588c('0x107');this[_0x588c('0xfd')](_0x5b7f4d);}}}};Dialer[_0x588c('0xae')]['syncNewExten']=function(_0x2d0677){if(this[_0x588c('0x108')][_0x2d0677[_0x588c('0xdf')]]){this['actions'][_0x2d0677[_0x588c('0xdf')]][_0x588c('0xb6')]=_0x2d0677[_0x588c('0xb6')];}if(this[_0x588c('0xe7')][_0x2d0677['uniqueid']]){this[_0x588c('0xe7')][_0x2d0677[_0x588c('0xdf')]][_0x588c('0xb6')]=_0x2d0677[_0x588c('0xb6')];}};Dialer[_0x588c('0xae')]['syncQueueMember']=function(_0x2592a1){if(strategy[this['voiceQueues'][this[_0x588c('0x108')][_0x2592a1[_0x588c('0x109')]][_0x588c('0xba')]][_0x588c('0x4e')]]==='roundrobin'){if(this['actions'][_0x2592a1[_0x588c('0x109')]]&&_[_0x588c('0xe0')](this['actions'][_0x2592a1[_0x588c('0x109')]]['locked'])&&_0x2592a1[_0x588c('0xb5')]==='1'&&_0x2592a1['paused']==='0'){if(this[_0x588c('0x20')][_0x2592a1[_0x588c('0x10a')]]){if(!this[_0x588c('0x20')][_0x2592a1[_0x588c('0x10a')]]['locked']){this['agents'][_0x2592a1[_0x588c('0x10a')]][_0x588c('0x10b')]=!![];this[_0x588c('0x108')][_0x2592a1['actionid']]['locked']=!![];this['actions'][_0x2592a1[_0x588c('0x109')]][_0x588c('0x10a')]=_0x2592a1[_0x588c('0x10a')];}}}}else if((strategy[this[_0x588c('0x1e')][this[_0x588c('0x108')][_0x2592a1[_0x588c('0x109')]]['queue']]['strategy']]||_0x588c('0x18'))===_0x588c('0x18')){if(this[_0x588c('0x108')][_0x2592a1[_0x588c('0x109')]]){if(this[_0x588c('0x20')][_0x2592a1[_0x588c('0x10a')]]){this[_0x588c('0x108')][_0x2592a1[_0x588c('0x109')]]['stateinterface']=_0x2592a1['stateinterface'];if(_[_0x588c('0xe0')](this[_0x588c('0x27')][this[_0x588c('0x108')][_0x2592a1[_0x588c('0x109')]][_0x588c('0xba')]])){this['queueBooked'][this[_0x588c('0x108')][_0x2592a1[_0x588c('0x109')]][_0x588c('0xba')]]=[];}this[_0x588c('0x27')][this[_0x588c('0x108')][_0x2592a1[_0x588c('0x109')]]['queue']][_0x588c('0x10c')](_['merge'](_[_0x588c('0xd3')](this[_0x588c('0x108')][_0x2592a1[_0x588c('0x109')]],[_0x588c('0x10d'),_0x588c('0x10a')]),{'status':_0x2592a1[_0x588c('0xb5')],'paused':_0x2592a1[_0x588c('0x10e')]}));}}}};function unlockQueueStatus(_0x472f4a,_0x1bbd1a){setTimeout(function(){if(_[_0x588c('0x3c')](_0x472f4a[_0x588c('0x10f')])){loggerBooked[_0x588c('0x9b')](_0x588c('0x110'),_0x1bbd1a);}_0x472f4a[_0x588c('0x10f')]=!![];loggerBooked[_0x588c('0x81')](_0x588c('0x111'),_0x1bbd1a,JSON['stringify'](_[_0x588c('0xd3')](_0x472f4a,['name',_0x588c('0x10f')])));},0x1f3);}Dialer[_0x588c('0xae')][_0x588c('0x39')]=function(_0x9709d0){var _0x123ad6=this;var _0x54c0a6=_0x123ad6[_0x588c('0x1e')][_0x123ad6[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]];if(strategy[this[_0x588c('0x1e')][this['actions'][_0x9709d0[_0x588c('0x109')]]['queue']][_0x588c('0x4e')]]===_0x588c('0x19')){if(this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]]&&this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0x10a')]){this[_0x588c('0x1d')]['run'](this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0x10d')],this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0x10a')])[_0x588c('0xb7')](function(_0x43ab64){logger[_0x588c('0x9b')](_0x588c('0x112'),util[_0x588c('0x9c')](_0x43ab64,{'showHidden':![],'depth':null}));})[_0x588c('0x1b')](function(){_0x123ad6['updateOriginated'](_0x123ad6['voiceQueues'][_0x123ad6[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]]);_0x123ad6[_0x588c('0x20')][_0x123ad6[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]]['stateinterface']][_0x588c('0x10b')]=![];delete _0x123ad6['actions'][_0x9709d0[_0x588c('0x109')]];unlockQueueStatus(_0x54c0a6);});}else{this[_0x588c('0xb9')](this['voiceQueues'][this['actions'][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xd4')],'ListId':this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]]['ListId'],'VoiceQueueId':this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xd6')]||undefined,'CampaignId':this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]]['CampaignId']||undefined})[_0x588c('0xb7')](loggerCatch(_0x588c('0x113')));delete this['actions'][_0x9709d0[_0x588c('0x109')]];unlockQueueStatus(_0x54c0a6);}}else if((strategy[this[_0x588c('0x1e')][this['actions'][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]]['strategy']]||_0x588c('0x18'))===_0x588c('0x18')){var _0x292740;if(this['actions'][_0x9709d0[_0x588c('0x109')]]&&!_[_0x588c('0x43')](this[_0x588c('0x27')][this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]])){if(this[_0x588c('0x28')][_0x123ad6[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]]){this[_0x588c('0x28')][_0x123ad6[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]]=this[_0x588c('0x28')][this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]]?this[_0x588c('0x28')][this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]]['queue']]:this[_0x588c('0x27')][this[_0x588c('0x108')][_0x9709d0['actionid']][_0x588c('0xba')]]?this[_0x588c('0x27')][this['actions'][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]][_0x588c('0x114')]||0x0:0x0;}this[_0x588c('0x27')][this[_0x588c('0x108')][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]][_0x588c('0x114')]=this[_0x588c('0x28')][this['actions'][_0x9709d0[_0x588c('0x109')]][_0x588c('0xba')]];for(var _0x554622=0x0;_0x554622=0x0?!![]:![];})[_0x588c('0xb7')](myreject(_0x3b939a)));}}else{_0x424305['push'](ami[_0x588c('0xb4')]({'action':_0x588c('0x12c'),'command':util[_0x588c('0x7a')](_0x588c('0x12d'),_0x51a0ad,!_[_0x588c('0x3c')](config[_0x588c('0x12a')][_0xb9e8d3])?_0xb9e8d3:'')})['then'](function(_0x4217f9){return _0x4217f9['content'][_0x588c('0x130')](_0x588c('0x131'))>=0x0?!![]:![];})[_0x588c('0xb7')](myreject(_0x3b939a)));}BPromise[_0x588c('0x132')](_0x424305)[_0x588c('0xbd')](function(_0xf76ede){var _0x5f4267=_[_0x588c('0x133')](_0xf76ede);if(_0x5f4267){return _0x2b3662(_0x5f4267);}else{_0x10ba76['message']=_0x4a2bd3?_0x588c('0x134'):_0x588c('0x135');return _0x3b939a(msgResponse('[ifTime][promiseAll]',_0x588c('0x128'),_0x588c('0x136')+_0x4a2bd3+'\x20'+_0x49f4ff+_0x588c('0x137')+util[_0x588c('0x9c')](_0x51a0ad,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xb9e8d3));}})[_0x588c('0xb7')](function(_0x163fcf){return _0x3b939a(msgResponse(_0x588c('0x124'),_0x588c('0x128'),JSON[_0x588c('0x47')](_0x163fcf)));});});};Dialer[_0x588c('0xae')][_0x588c('0x138')]=function(_0xecb6a0){var _0x317e03=this;return function(){switch(_0xecb6a0[_0x588c('0x5a')]){case _0x588c('0x139'):freeVariablesPredictive(_0xecb6a0);_0x317e03[_0x588c('0x13a')](_0xecb6a0,0x1);break;case _0x588c('0x13b'):freeVariablesPredictive(_0xecb6a0);_0x317e03[_0x588c('0x13a')](_0xecb6a0,_0xecb6a0['dialPowerLevel']);break;case _0x588c('0x6'):_0x317e03['predictive'](_0xecb6a0);break;case _0x588c('0x5'):freeVariablesPredictive(_0xecb6a0);_0x317e03[_0x588c('0x13a')](_0xecb6a0,0x1);break;default:freeVariablesPredictive(_0xecb6a0);logger['error']('Queue',_0xecb6a0['name'],_0x588c('0x13c'));}};};Dialer[_0x588c('0xae')][_0x588c('0x13d')]=function(_0x72d267){var _0x113bfd=this;return function(){_0x113bfd[_0x588c('0x13e')](_0x72d267);};};Dialer[_0x588c('0xae')][_0x588c('0x8')]=function(_0x4e123c){var _0x4d869e=this;if(isNotPreview(_0x4e123c[_0x588c('0x5a')])){if(isVoiceQueueOutbound(_0x4e123c[_0x588c('0x4c')])&&isActive(_0x4e123c['dialActive'])){_0x4e123c[_0x588c('0xa6')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x4e123c,_0x4e123c[_0x588c('0x13f')]))[_0x588c('0xbd')](checkIsActive(_0x4e123c,_0x4e123c[_0x588c('0x59')]))[_0x588c('0xbd')](checkInterval(_0x4e123c))['then'](_0x4d869e[_0x588c('0x11f')](_0x4e123c))[_0x588c('0xbd')](_0x4d869e[_0x588c('0x140')](_0x4e123c[_0x588c('0x141')],_0x4e123c[_0x588c('0x142')],_0x4e123c[_0x588c('0x3d')],_0x4e123c))[_0x588c('0xbd')](_0x4d869e[_0x588c('0x125')](_0x4e123c[_0x588c('0x40')],_0x4e123c[_0x588c('0x142')],_0x4e123c[_0x588c('0x3d')],_0x4e123c))[_0x588c('0xbd')](_0x4d869e['checkDialMethod'](_0x4e123c))['catch'](loggerCatchQueueSummary(_0x588c('0x143'),_0x4e123c));}else{notSendMessagesQueue(_0x4e123c);}}else{freeVariablesPredictive(_0x4e123c);}};Dialer[_0x588c('0xae')][_0x588c('0x144')]=function(){var _0x25a74d=this;var _0x175a17;for(var _0x53f0bc in this['campaigns']){if(this['campaigns'][_0x588c('0xb2')](_0x53f0bc)){_0x175a17=this[_0x588c('0x1f')][_0x53f0bc];if(isCampaignIvr(_0x175a17[_0x588c('0x4c')])&&isActive(_0x175a17[_0x588c('0x78')])){_0x175a17[_0x588c('0xa6')]=!![];BPromise['resolve']()[_0x588c('0xbd')](checkIsActive(_0x175a17,_0x175a17[_0x588c('0x78')]))[_0x588c('0xbd')](checkInterval(_0x175a17))[_0x588c('0xbd')](_0x25a74d[_0x588c('0x11f')](_0x175a17))['then'](_0x25a74d['checkIfTime'](_0x175a17[_0x588c('0x141')],_0x175a17[_0x588c('0x142')],_0x175a17[_0x588c('0x3d')],_0x175a17))[_0x588c('0xbd')](_0x25a74d[_0x588c('0x125')](_0x175a17[_0x588c('0x40')],_0x175a17[_0x588c('0x142')],_0x175a17[_0x588c('0x3d')],_0x175a17))[_0x588c('0xbd')](_0x25a74d['launchHandleIvr'](_0x175a17))[_0x588c('0xb7')](loggerCatchQueueSummary(_0x588c('0x145'),_0x175a17));}else{notSendMessagesCampaign(_0x175a17);}}}};function getCallerIdRandom(_0x5c132d,_0x3346e2){var _0x4d468b,_0x289a2c,_0x31ac6d;if(_0x3346e2<=0x0){_0x3346e2=0x1;}_0x4d468b=new RegExp(_0x588c('0x146')+_0x3346e2+'}$');_0x289a2c=Math[_0x588c('0x147')](0xa,_0x3346e2-0x1);_0x31ac6d=Math[_0x588c('0x147')](0xa,_0x3346e2)-0x1;return util[_0x588c('0x7a')]('%s',_[_0x588c('0x148')](_0x5c132d,_0x4d468b,_[_0x588c('0x149')](_0x289a2c,_0x31ac6d)));}function extractCalleridName(_0xff0bbb){var _0x93f678=_0xff0bbb['match'](/"(.*?)"/);return _0x93f678?_0x93f678[0x1]:_0xff0bbb;}function extractCalleridNumber(_0x143175){var _0x542fae=_0x143175[_0x588c('0x14a')](/<(.*?)>/);return _0x542fae?_0x542fae[0x1]:_0x143175;}Dialer[_0x588c('0xae')][_0x588c('0x14b')]=function(_0x340a30,_0x55b393){var _0x209e93=this;var _0x5ad694=uuid['v4']();this[_0x588c('0x108')][_0x5ad694]=new Action(_0x340a30,_0x55b393,_0x5ad694);return new BPromise(function(_0x1c281f,_0x5a61f7){if(_[_0x588c('0x3c')](_0x340a30)&&_0x588c('0x14c')!==typeof _0x340a30){return _0x5a61f7(msgResponse('originate',_0x588c('0x128'),'voiceQueue\x20is\x20undefine'));}if(_[_0x588c('0x3c')](_0x55b393['Contact'][_0x588c('0x14d')])||_0x55b393[_0x588c('0x14e')]['phone']===null){return _0x5a61f7(msgResponse(_0x588c('0x14f'),'Failure',_0x588c('0x150')));}var _0x34b075={'XMD-CALLERID':_0x209e93[_0x588c('0x108')][_0x5ad694][_0x588c('0x151')](),'XMD-AGI':_0x340a30[_0x588c('0xf4')]?util['format'](_0x588c('0x152'),ipAgi,_0x340a30[_0x588c('0xf4')]):'NONE','XMD-AGIAFTER':_0x340a30[_0x588c('0x105')]?util[_0x588c('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x340a30['dialQueueProject2']):_0x588c('0x153'),'XMD-QUEUE':_0x340a30[_0x588c('0x4c')]===_0x588c('0x4d')?util[_0x588c('0x7a')](_0x588c('0x154'),_0x340a30['name'],_0x340a30[_0x588c('0x155')]||'',_0x340a30[_0x588c('0x156')]?'c':'',_0x340a30[_0x588c('0x101')]||0x3):_0x588c('0x153'),'XMD-CONTACTID':_0x55b393[_0x588c('0xd4')],'XMD-CDRTYPE':_0x588c('0x157'),'CALLERID(all)':_0x209e93['actions'][_0x5ad694]['getCaller'](),'XMD-AMD':_0x340a30['dialAMDActive']?_0x588c('0x158'):_0x588c('0x153'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x340a30['dialAMDActive']){_0x34b075[_0x588c('0x159')]=_0x340a30[_0x588c('0x15a')]||0x9c4;_0x34b075[_0x588c('0x15b')]=_0x340a30[_0x588c('0x15c')]||0x5dc;_0x34b075['XMD-AMDAFTERGREETINGSILENCE']=_0x340a30[_0x588c('0x15d')]||0x320;_0x34b075[_0x588c('0x15e')]=_0x340a30[_0x588c('0x15f')]||0x1388;_0x34b075[_0x588c('0x160')]=_0x340a30[_0x588c('0x161')]||0x64;_0x34b075[_0x588c('0x162')]=_0x340a30[_0x588c('0x163')]||0x32;_0x34b075[_0x588c('0x164')]=_0x340a30[_0x588c('0x165')]||0x3;_0x34b075['XMD-AMDSILENCETHRESHOLD']=_0x340a30['dialAMDSilenceThreshold']||0x100;_0x34b075[_0x588c('0x166')]=_0x340a30[_0x588c('0x167')]||0x1388;}if(_0x340a30[_0x588c('0x4c')]===_0x588c('0x4d')){_0x34b075['XMD-VOICEQUEUEID']=_0x55b393[_0x588c('0xd6')];}else{_0x34b075[_0x588c('0x168')]=_0x55b393[_0x588c('0xd7')];}for(var _0x3e1417 in _0x55b393[_0x588c('0x14e')]){if(_0x55b393['Contact'][_0x588c('0xb2')](_0x3e1417)){if(isNotNull(_0x55b393[_0x588c('0x14e')][_0x3e1417])&&_0x3e1417!=='id'&&_0x3e1417!==_0x588c('0x169')&&_0x3e1417!=='createdAt'&&_0x3e1417!==_0x588c('0x16a')){_0x34b075[util['format']('%s%s','XMD-',_['toUpper'](_0x3e1417))]=_0x55b393[_0x588c('0x14e')][_0x3e1417];}}}var _0x2e06bc=_0x209e93[_0x588c('0x120')](_0x340a30[_0x588c('0x77')])?getCallerId(_0x340a30[_0x588c('0x77')][_0x588c('0x79')],_0x340a30['dialOriginateCallerIdName'],_0x340a30['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x340a30['dialOriginateCallerIdNumber'],_0x340a30['dialRandomLastDigitCallerIdNumber']):_0x340a30[_0x588c('0x5c')]):getCallerId(_[_0x588c('0xe0')](_0x340a30[_0x588c('0x121')])?_0x340a30[_0x588c('0x77')][_0x588c('0x79')]:_0x340a30[_0x588c('0x121')][_0x588c('0x79')],_0x340a30[_0x588c('0x5b')],_0x340a30[_0x588c('0x16b')]>0x0?getCallerIdRandom(_0x340a30['dialOriginateCallerIdNumber'],_0x340a30['dialRandomLastDigitCallerIdNumber']):_0x340a30[_0x588c('0x5c')]);if(_0x2e06bc){_0x34b075['XMD-ORIGINATECALLERIDNAME']=_0x209e93[_0x588c('0x108')][_0x5ad694][_0x588c('0x16c')]=extractCalleridName(_0x2e06bc);_0x34b075[_0x588c('0x16d')]=_0x209e93[_0x588c('0x108')][_0x5ad694][_0x588c('0x16e')]=extractCalleridNumber(_0x2e06bc);}return ami[_0x588c('0xb4')]({'actionid':_0x5ad694,'action':'originate','channel':_0x209e93[_0x588c('0x120')](_0x340a30['Trunk'])?util['format']('SIP/%s/%s%s',_0x340a30['Trunk']['name'],isNotNull(_0x340a30[_0x588c('0x5e')])?_0x340a30[_0x588c('0x5e')][_0x588c('0x16f')]()||'':'',_0x340a30[_0x588c('0x170')]>0x0?_0x55b393['Contact'][_0x588c('0x14d')][_0x588c('0x171')](_0x340a30[_0x588c('0x170')]):_0x55b393['Contact'][_0x588c('0x14d')]):util[_0x588c('0x7a')]('SIP/%s/%s%s',_[_0x588c('0xe0')](_0x340a30[_0x588c('0x121')])?_0x340a30[_0x588c('0x77')]['name']:_0x340a30[_0x588c('0x121')][_0x588c('0x3d')],isNotNull(_0x340a30[_0x588c('0x5e')])?_0x340a30[_0x588c('0x5e')][_0x588c('0x16f')]()||'':'',_0x340a30[_0x588c('0x170')]>0x0?_0x55b393[_0x588c('0x14e')]['phone']['substring'](_0x340a30[_0x588c('0x170')]):_0x55b393[_0x588c('0x14e')]['phone']),'callerid':_0x2e06bc,'Exten':_0x588c('0x172'),'Context':_0x588c('0x173'),'Priority':'1','variable':_0x34b075,'timeout':(_0x340a30['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5ad694})[_0x588c('0xbd')](function(_0x23952e){return _0x1c281f(_0x23952e);})['catch'](function(_0x31b193){_0x340a30[_0x588c('0x68')]+=0x1;var _0x4ac697=new History(_0x209e93['actions'][_0x5ad694]);logger[_0x588c('0x9b')](util[_0x588c('0x7a')](_0x588c('0x174'),JSON['stringify'](_0x31b193)));_0x4ac697['state']=0xe;_0x4ac697[_0x588c('0xac')]=_0x588c('0x175');_0x4ac697['starttime']=moment()['format'](_0x588c('0xfa'));_0x4ac697['endtime']=_0x4ac697[_0x588c('0x176')];_0x209e93[_0x588c('0xcd')](_0x4ac697)['catch'](loggerCatch('[originate][error]'));_0x209e93[_0x588c('0xcb')](_0x4ac697)[_0x588c('0xb7')](loggerCatch(_0x588c('0x177')))['finally'](function(){delete _0x209e93['actions'][_0x5ad694];return _0x5a61f7(msgResponse(_0x588c('0x14f'),'Error','originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x588c('0x2e')]=function(_0x5d2571){var _0x5a74c5=this[_0x588c('0x108')][_0x5d2571['actionid']];var _0x2c2e6f=this;if(_0x5a74c5){delete this[_0x588c('0x108')][_0x5d2571[_0x588c('0x109')]];_0x5a74c5['responsetime']=moment()[_0x588c('0x7a')](_0x588c('0xfa'));var _0x5b1d80=_0x5a74c5['type']==='ivr'?this[_0x588c('0x1f')][_0x5a74c5['queue']]:this[_0x588c('0x1e')][_0x5a74c5[_0x588c('0x178')]()];if(!this[_0x588c('0xda')](_0x5d2571[_0x588c('0x179')])){this[_0x588c('0xb9')](_0x5b1d80);return this[_0x588c('0x17a')](_0x5a74c5,_0x5b1d80,_0x5d2571)['then'](function(_0x531c09){})['catch'](loggerCatch(_0x588c('0x17b')));}else{this[_0x588c('0xe7')][_0x5d2571[_0x588c('0xdf')]]=_0x5a74c5;}}};Dialer[_0x588c('0xae')][_0x588c('0x17c')]=function(_0x42d19f,_0x96bb0,_0x32d89a){var _0x266935=new History(_0x96bb0);if(_0x266935['countbusyretry']+_0x266935[_0x588c('0x17d')]+_0x266935['countnoanswerretry']>=_0x32d89a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x42d19f){case 0x3:if(_0x266935[_0x588c('0x17e')]>=_0x32d89a[_0x588c('0x17f')]-0x1){return!![];}else{this[_0x588c('0xc4')]({'active':![],'countnoanswerretry':_0x266935[_0x588c('0x17e')]+=0x1,'scheduledat':moment()[_0x588c('0x180')](_0x32d89a[_0x588c('0x181')],'minutes')['format'](_0x588c('0xfa')),'ContactId':_0x266935['ContactId'],'ListId':_0x266935['ListId'],'VoiceQueueId':_0x266935['VoiceQueueId']||undefined,'CampaignId':_0x266935['CampaignId']||undefined})[_0x588c('0xb7')](loggerCatch(_0x588c('0x182')));}break;case 0x5:if(_0x266935[_0x588c('0x183')]>=_0x32d89a['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x588c('0xc4')]({'active':![],'countbusyretry':_0x266935[_0x588c('0x183')]+=0x1,'scheduledat':moment()['add'](_0x32d89a[_0x588c('0x184')],_0x588c('0x185'))[_0x588c('0x7a')](_0x588c('0xfa')),'ContactId':_0x266935['ContactId'],'ListId':_0x266935[_0x588c('0x11c')],'VoiceQueueId':_0x266935[_0x588c('0xd6')]||undefined,'CampaignId':_0x266935[_0x588c('0xd7')]||undefined})[_0x588c('0xb7')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x266935[_0x588c('0x17d')]>=_0x32d89a[_0x588c('0x186')]-0x1){return!![];}else{this[_0x588c('0xc4')]({'active':![],'countcongestionretry':_0x266935[_0x588c('0x17d')]+=0x1,'scheduledat':moment()['add'](_0x32d89a[_0x588c('0x187')],_0x588c('0x185'))[_0x588c('0x7a')](_0x588c('0xfa')),'ContactId':_0x266935[_0x588c('0xd4')],'ListId':_0x266935[_0x588c('0x11c')],'VoiceQueueId':_0x266935[_0x588c('0xd6')]||undefined,'CampaignId':_0x266935['CampaignId']||undefined})[_0x588c('0xb7')](loggerCatch(_0x588c('0x188')));}break;default:return!![];}};Dialer[_0x588c('0xae')][_0x588c('0x17a')]=function(_0x4fa7bc,_0x28fa56,_0x298699){var _0x1695af=this;var _0x1a1f79=new History(_0x4fa7bc);return new BPromise(function(_0x597905,_0x11812b){if(_['isUndefined'](_0x28fa56)&&_0x588c('0x14c')!==typeof _0x28fa56){return _0x11812b(msgResponse('[callProgressDetecting]',_0x588c('0x128'),_0x588c('0x189')));}if(_['isUndefined'](_0x298699)&&_0x588c('0x14c')!==typeof _0x298699){return _0x11812b(msgResponse(_0x588c('0x18a'),_0x588c('0x128'),_0x588c('0x18b')));}switch(_0x298699[_0x588c('0xf9')]){case'0':_0x28fa56[_0x588c('0x67')]+=0x1;_0x1a1f79[_0x588c('0xab')]=0x0;_0x1a1f79[_0x588c('0xac')]=_0x588c('0x18c');_0x1695af[_0x588c('0xcd')](_0x1a1f79)['catch'](loggerCatch(_0x588c('0x18d')));if(_0x1695af[_0x588c('0x17c')](0x0,_0x4fa7bc,_0x28fa56)){if(_0x1a1f79['countbusyretry']+_0x1a1f79[_0x588c('0x17d')]+_0x1a1f79[_0x588c('0x17e')]>=_0x28fa56[_0x588c('0x18e')]){_0x1695af[_0x588c('0x18f')](_0x1a1f79,_0x597905,_0x11812b,_0x588c('0x190'));}else{_0x1695af[_0x588c('0x191')](_0x1a1f79,_0x597905,_0x11812b,_0x588c('0x190'));}}break;case'3':_0x28fa56['outboundNoAnswerCallsDay']+=0x1;_0x1a1f79[_0x588c('0xab')]=0x3;_0x1a1f79[_0x588c('0xac')]=_0x588c('0x192');_0x1a1f79[_0x588c('0x17e')]+=0x1;_0x1a1f79[_0x588c('0x193')]+=0x1;_0x1695af[_0x588c('0xcd')](_0x1a1f79)[_0x588c('0xb7')](loggerCatch(_0x588c('0x194')));if(_0x1695af[_0x588c('0x17c')](0x3,_0x4fa7bc,_0x28fa56)){if(_0x1a1f79[_0x588c('0x17e')]>=_0x28fa56[_0x588c('0x17f')]){_0x1695af['createStateFinal'](_0x1a1f79,_0x597905,_0x11812b,_0x588c('0x195'));}else{_0x1695af['stateGlobal'](_0x1a1f79,_0x597905,_0x11812b,_0x588c('0x195'));}}break;case'5':_0x28fa56['outboundBusyCallsDay']+=0x1;_0x1a1f79['state']=0x5;_0x1a1f79[_0x588c('0xac')]=_0x588c('0x196');_0x1a1f79['countbusyretry']+=0x1;_0x1a1f79[_0x588c('0x193')]+=0x1;_0x1695af[_0x588c('0xcd')](_0x1a1f79)[_0x588c('0xb7')](loggerCatch(_0x588c('0x197')));if(_0x1695af[_0x588c('0x17c')](0x5,_0x4fa7bc,_0x28fa56)){if(_0x1a1f79[_0x588c('0x183')]>=_0x28fa56[_0x588c('0x198')]){_0x1695af[_0x588c('0x191')](_0x1a1f79,_0x597905,_0x11812b,'reason\x205\x20busy');}else{_0x1695af[_0x588c('0x18f')](_0x1a1f79,_0x597905,_0x11812b,'reason\x205\x20busy');}}break;case'8':_0x28fa56['outboundCongestionCallsDay']+=0x1;_0x1a1f79[_0x588c('0xab')]=0x8;_0x1a1f79[_0x588c('0xac')]='Congestion';_0x1a1f79['countcongestionretry']+=0x1;_0x1a1f79[_0x588c('0x193')]+=0x1;_0x1695af[_0x588c('0xcd')](_0x1a1f79)[_0x588c('0xb7')](loggerCatch(_0x588c('0x199')));if(_0x1695af[_0x588c('0x17c')](0x8,_0x4fa7bc,_0x28fa56)){if(_0x1a1f79[_0x588c('0x17d')]>=_0x28fa56['dialCongestionMaxRetry']){_0x1695af['createStateFinal'](_0x1a1f79,_0x597905,_0x11812b,'reason\x208\x20congestion');}else{_0x1695af['stateGlobal'](_0x1a1f79,_0x597905,_0x11812b,_0x588c('0x19a'));}}break;default:_0x28fa56[_0x588c('0xf7')]+=0x1;_0x1a1f79[_0x588c('0xab')]=0xc;_0x1a1f79[_0x588c('0xac')]=_0x298699[_0x588c('0xf9')];_0x1695af['createHistory'](_0x1a1f79)[_0x588c('0xb7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1695af[_0x588c('0x17c')](_0x298699['reason'],_0x4fa7bc,_0x28fa56)){if(_0x1a1f79['countbusyretry']+_0x1a1f79[_0x588c('0x17d')]+_0x1a1f79['countnoanswerretry']>=_0x28fa56[_0x588c('0x18e')]){_0x1695af[_0x588c('0x18f')](_0x1a1f79,_0x597905,_0x11812b,_0x298699[_0x588c('0xf9')]);}else{_0x1695af['createStateFinal'](_0x1a1f79,_0x597905,_0x11812b,_0x298699[_0x588c('0xf9')]);}}}});};Dialer[_0x588c('0xae')][_0x588c('0x18f')]=function(_0x4e88f6,_0x4ad4cb,_0x16c2fa,_0x4c88f4){var _0x214ae0=new Final(_0x4e88f6);_0x214ae0[_0x588c('0xab')]=0xf;_0x214ae0[_0x588c('0xac')]=_0x588c('0x19b');this[_0x588c('0x191')](_0x214ae0,_0x4ad4cb,_0x16c2fa,_0x4c88f4);};Dialer[_0x588c('0xae')][_0x588c('0x191')]=function(_0x15ab0d,_0x199f63,_0x550d76,_0x3b44ad){this['moveContactManagedDialer'](_0x15ab0d)[_0x588c('0xbd')](function(_0x287fe5){return _0x199f63(msgResponse('[callProgressDetecting]',_0x588c('0xdb'),_0x3b44ad));})[_0x588c('0xb7')](function(_0xaf0f35){return _0x550d76(msgResponse(_0x588c('0x19c'),_0x588c('0x128'),'contact\x20not\x20moved'));});};Dialer[_0x588c('0xae')]['predictive']=function(_0x360285){var _0x52e17a=this;var _0x2c96b5=_0x360285[_0x588c('0x19d')]/0x64;var _0x52d5aa=_0x360285[_0x588c('0x66')]/(_0x360285[_0x588c('0x66')]+_0x360285[_0x588c('0x60')]);var _0x32b7e7=Math[_0x588c('0x19e')](_0x360285[_0x588c('0x72')]*(_0x360285['predictiveIntervalMaxThreshold']/0x64));var _0x243a06=Math[_0x588c('0x19e')](_0x360285[_0x588c('0x72')]*(_0x360285['predictiveIntervalMinThreshold']/0x64));var _0x55b306=_0x360285[_0x588c('0x50')]+_0x360285['talking'];var _0x122c64=Math[_0x588c('0x19f')](_0x360285[_0x588c('0x74')]*_0x360285[_0x588c('0x92')]*_0x360285[_0x588c('0x70')]*_0x360285['predictiveIntervalMultiplicativeFactor']);if(_[_0x588c('0x3c')](_0x360285[_0x588c('0x25')])){if(!_['isUndefined'](_0x360285[_0x588c('0x24')])){_0x360285[_0x588c('0x24')]=undefined;loggerPredictive[_0x588c('0x9b')](_0x588c('0x1a0'),_0x588c('0x1a1'));}if(!_[_0x588c('0x3c')](_0x360285[_0x588c('0x96')])){loggerPredictive[_0x588c('0x9b')](_0x588c('0x1a0'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x360285[_0x588c('0x96')]);_0x360285['handlePredictive']=undefined;}_0x360285[_0x588c('0x25')]=moment()['format'](_0x588c('0xfa'));loggerPredictive['info'](_0x360285[_0x588c('0x3d')],_0x588c('0x1a2'),_0x360285[_0x588c('0x25')]);this['handlePower'](_0x360285,0x1);}else if(ifInterval(_0x360285[_0x588c('0x1a3')],_0x360285[_0x588c('0x25')])){this[_0x588c('0x13a')](_0x360285,0x1);loggerPredictiveCalls[_0x588c('0x81')](_0x588c('0x1a4'),_0x360285[_0x588c('0x25')],_0x360285[_0x588c('0x3d')]);_0x360285[_0x588c('0x74')]=0x0;_0x360285[_0x588c('0x6f')]=0x0;}else if(_0x2c96b5<_0x52d5aa&&_0x360285['dialPredictiveOptimization']===_0x588c('0x1a5')){freeVariablesPredictive(_0x360285);loggerPredictive['info'](_0x588c('0x1a6'),_0x588c('0x1a7'),_0x52d5aa,_0x588c('0x25'),_0x360285[_0x588c('0x3d')]);}else if(_0x122c64<_0x360285['predictiveIntervalErlangCallsDroppedCalls']&&_0x360285[_0x588c('0x1a8')]==='dropRate'){freeVariablesPredictive(_0x360285);loggerPredictive[_0x588c('0x81')](_0x588c('0x1a9'),_0x588c('0x1aa'),_0x122c64,_0x588c('0x1ab'),_0x360285[_0x588c('0x6f')],_0x588c('0x25'),_0x360285['name']);}else if(!ifInterval(_0x360285[_0x588c('0x1a3')],_0x360285[_0x588c('0x25')])&&_[_0x588c('0x3c')](_0x360285[_0x588c('0x24')])&&!_[_0x588c('0x3c')](_0x360285[_0x588c('0x25')])){_0x360285[_0x588c('0x24')]=moment()[_0x588c('0x7a')](_0x588c('0xfa'));loggerPredictive[_0x588c('0x81')](_0x360285[_0x588c('0x3d')],_0x588c('0x1ac'),_0x360285['startPredictive']);this[_0x588c('0xc3')](_0x360285['dialPredictiveInterval'])[_0x588c('0xbd')](this[_0x588c('0x1ad')](_0x360285))['then'](mergeDataErlangB(_0x360285))[_0x588c('0xbd')](this['startMethodPredictive'](_0x360285))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x360285));}else if(!ifInterval(_0x360285[_0x588c('0x1a3')],_0x360285[_0x588c('0x24')])){_0x360285[_0x588c('0x6f')]=0x0;_0x360285[_0x588c('0x24')]=moment()[_0x588c('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x588c('0x81')](_0x360285[_0x588c('0x3d')],'recalculate\x20predictive\x20at',_0x360285[_0x588c('0x24')]);clearInterval(_0x360285[_0x588c('0x96')]);_0x360285[_0x588c('0x96')]=undefined;this[_0x588c('0xc3')](_0x360285[_0x588c('0x1a3')])[_0x588c('0xbd')](this[_0x588c('0x1ad')](_0x360285))[_0x588c('0xbd')](mergeDataErlangB(_0x360285))[_0x588c('0xbd')](this[_0x588c('0x1ae')](_0x360285))['catch'](loggerCatchPredictive(_0x588c('0x1af'),_0x360285));}else if(_0x360285[_0x588c('0x72')]&&_0x55b306<_0x360285[_0x588c('0x72')]-_0x243a06){freeVariablesPredictive(_0x360285);loggerPredictive[_0x588c('0x81')](_0x360285[_0x588c('0x3d')],_0x588c('0x1b0'),_0x55b306,_0x588c('0x1b1'),_0x360285[_0x588c('0x72')],'-',_0x243a06,'=',_0x360285[_0x588c('0x72')]-_0x243a06,')');}else if(_0x360285[_0x588c('0x72')]&&_0x55b306>_0x360285[_0x588c('0x72')]+_0x32b7e7){freeVariablesPredictive(_0x360285);loggerPredictive[_0x588c('0x81')](_0x360285[_0x588c('0x3d')],_0x588c('0x1b0'),_0x55b306,_0x588c('0x1b2'),_0x360285[_0x588c('0x72')],'+',_0x32b7e7,'=',_0x360285['predictiveIntervalAvailable']+_0x32b7e7,')');}};Dialer[_0x588c('0xae')][_0x588c('0x1ad')]=function(_0x197b6c){var _0x5d47ef=this;return function(_0x80a8e3){return new BPromise(function(_0x4558f2,_0x16400f){_[_0x588c('0x94')](_0x197b6c,_0x80a8e3[0x0]);if(checkGetDataPredictive(_0x80a8e3[0x0])){var _0x3a4f7a=_0x197b6c[_0x588c('0x72')]=_0x197b6c[_0x588c('0x53')]+_0x197b6c['available'];var _0x1a8520=_0x197b6c['dialPredictiveInterval']*0x3c;var _0x3c52ca=_0x80a8e3[0x0]['predictiveIntervalAvgTalktime']+_0x80a8e3[0x0][_0x588c('0x8a')];var _0x1f11c3=(_0x80a8e3[0x0][_0x588c('0x6b')]+_0x80a8e3[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x80a8e3[0x0][_0x588c('0x6c')])/_0x80a8e3[0x0][_0x588c('0x73')];_0x197b6c[_0x588c('0x70')]=_0x1f11c3>0x0?_0x1f11c3:0x1;switch(_0x197b6c['dialPredictiveOptimization']){case'dropRate':var _0x477986=_0x197b6c[_0x588c('0x19d')]/0x64;return _0x5d47ef[_0x588c('0x1b3')](_0x3a4f7a,_0x1a8520,_0x3c52ca,_0x1f11c3,_0x477986)[_0x588c('0xbd')](function(_0x2b7e84){return _0x4558f2(_0x2b7e84);});case _0x588c('0x1b4'):var _0x4de9e9=_0x197b6c[_0x588c('0x19d')]/0x64;return _0x5d47ef[_0x588c('0x1b5')](_0x3a4f7a,_0x1a8520,_0x3c52ca,_0x1f11c3,_0x4de9e9)[_0x588c('0xbd')](function(_0x4e7754){return _0x4558f2(_0x4e7754);});default:return _0x16400f(msgResponse(_0x588c('0x1b6'),'Failure','Unknown\x20Predictive'));}}else{return _0x16400f(msgResponse(_0x588c('0x1b6'),_0x588c('0x128'),_0x588c('0x1b7')));}});};};Dialer['prototype'][_0x588c('0x1b8')]=function(_0x292a41){var _0x1f59c7=this;return function(_0x564089){return new BPromise(function(_0x1370f2,_0x38a978){_[_0x588c('0x94')](_0x292a41,_0x564089[0x0]);if(checkGetDataPredictive(_0x564089[0x0])){loggerPredictive[_0x588c('0x81')](JSON['stringify'](_0x564089[0x0]));if(_0x292a41[_0x588c('0x1a8')]===_0x588c('0x1a5')){return _0x1f59c7[_0x588c('0xc9')](_0x292a41['id'])['then'](function(_0x7cdac0){var _0x2db424=_0x292a41[_0x588c('0x13f')]-_0x7cdac0[0x0][_0x588c('0x1b9')];var _0x4803aa=_0x292a41['dialPredictiveInterval']*0x3c;var _0x5ba751=_0x564089[0x0][_0x588c('0x87')]+_0x564089[0x0]['predictiveIntervalAvgHoldtime'];var _0xdb3792=(_0x564089[0x0][_0x588c('0x6b')]+_0x564089[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x564089[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x564089[0x0][_0x588c('0x73')];var _0x3a95db=_0x292a41['dialPredictiveOptimizationPercentage']/0x64;_0x292a41['predictiveIntervalPauses']=_0x7cdac0[0x0]['outboundQueuePauses']||0x0;_0x292a41[_0x588c('0x70')]=_0xdb3792>0x0?_0xdb3792:0x1;return _0x1f59c7[_0x588c('0x1b3')](_0x2db424,_0x4803aa,_0x5ba751,_0xdb3792,_0x3a95db);})['then'](function(_0x5286cc){return _0x1370f2(_0x5286cc);})[_0x588c('0xb7')](function(_0x4c6246){return _0x38a978(msgResponse(_0x588c('0x1ba'),_0x588c('0x128'),JSON[_0x588c('0x47')](_0x4c6246)));});}if(_0x292a41[_0x588c('0x1a8')]==='agentBusyFactor'){return _0x1f59c7['getVoiceQueueRtPauses'](_0x292a41['id'])['then'](function(_0x538d27){var _0x953ac4=_0x292a41[_0x588c('0x13f')]-_0x538d27[0x0][_0x588c('0x1b9')];var _0x27bca5=_0x292a41[_0x588c('0x1a3')]*0x3c;var _0x5df148=_0x564089[0x0][_0x588c('0x87')]+_0x564089[0x0]['predictiveIntervalAvgHoldtime'];var _0x4c605a=(_0x564089[0x0][_0x588c('0x6b')]+_0x564089[0x0][_0x588c('0x6d')]+_0x564089[0x0][_0x588c('0x6c')])/_0x564089[0x0][_0x588c('0x73')];var _0x5c8e77=_0x292a41['dialPredictiveOptimizationPercentage']/0x64;_0x292a41['predictiveIntervalPauses']=_0x538d27[0x0][_0x588c('0x1b9')]||0x0;_0x292a41[_0x588c('0x70')]=_0x4c605a>0x0?_0x4c605a:0x1;return _0x1f59c7[_0x588c('0x1b5')](_0x953ac4,_0x27bca5,_0x5df148,_0x4c605a,_0x5c8e77);})[_0x588c('0xbd')](function(_0x176445){return _0x1370f2(_0x176445);})[_0x588c('0xb7')](function(_0x37f386){return _0x38a978(msgResponse(_0x588c('0x1ba'),_0x588c('0x128'),JSON[_0x588c('0x47')](_0x37f386)));});}}else{return _0x38a978(msgResponse(_0x588c('0x1b6'),'Failure',_0x588c('0x1b7')));}});};};Dialer[_0x588c('0xae')][_0x588c('0x1ae')]=function(_0x4535ac){var _0x2e5c39=this;return function(){var _0x2dc3d1=0x0;var _0x3dbaa6=Math['floor'](_0x4535ac[_0x588c('0x75')]*0x3e8);if(_0x3dbaa6>0x0){_0x3dbaa6=_0x3dbaa6<0x64?0x64:_0x3dbaa6;loggerPredictive[_0x588c('0x81')](_0x4535ac[_0x588c('0x3d')],_0x588c('0x1bb'),_0x3dbaa6,_0x588c('0x48'));_0x4535ac[_0x588c('0x96')]=setInterval(function(){_0x2e5c39[_0x588c('0x96')](_0x4535ac);loggerPredictiveCalls[_0x588c('0x81')](_0x588c('0x1bc'),_0x2dc3d1+=0x1);},_0x3dbaa6);}else{loggerPredictive[_0x588c('0x81')](_0x4535ac[_0x588c('0x3d')],_0x588c('0x1bd'));}};};Dialer[_0x588c('0xae')][_0x588c('0x1be')]=function(_0x43a098,_0x33b92a){var _0x4e5ddf=this;return function(_0x940a0e){if(_[_0x588c('0x43')](_0x940a0e)){if(_[_0x588c('0xe0')](_0x33b92a[_0x588c('0xd5')])||!_0x33b92a[_0x588c('0x1bf')]){if(_0x43a098[_0x588c('0x5a')]==='booked'){_0x43a098[_0x588c('0x10f')]=_[_0x588c('0x3c')](_0x43a098[_0x588c('0x10f')])?!![]:_0x43a098[_0x588c('0x10f')];var _0x2c9ecd=uuid['v4']();_0x4e5ddf['actions'][_0x2c9ecd]=new Action(_0x43a098,_0x33b92a,_0x2c9ecd);loggerBooked[_0x588c('0x81')](_0x588c('0x1c0'),_0x2c9ecd,'queueStatusComplete:\x20',JSON['stringify'](_0x43a098[_0x588c('0x10f')]),'Queue:\x20',_0x43a098[_0x588c('0x3d')]);if(_0x43a098[_0x588c('0x10f')]){_0x43a098['queueStatusComplete']=![];_0x4e5ddf['queueBooked'][_0x4e5ddf['actions'][_0x2c9ecd]['queue']]=[];ami['Action']({'actionid':_0x2c9ecd,'action':_0x588c('0x1c1'),'queue':_0x43a098['name']})[_0x588c('0xb7')](function(_0x8050af){_0x4e5ddf[_0x588c('0xb9')](_0x43a098);_0x4e5ddf[_0x588c('0xc4')]({'active':![],'ContactId':_0x4e5ddf['actions'][_0x2c9ecd][_0x588c('0xd4')],'ListId':_0x4e5ddf[_0x588c('0x108')][_0x2c9ecd][_0x588c('0x11c')],'VoiceQueueId':_0x4e5ddf['actions'][_0x2c9ecd][_0x588c('0xd6')]||undefined,'CampaignId':_0x4e5ddf[_0x588c('0x108')][_0x2c9ecd][_0x588c('0xd7')]||undefined})['catch'](loggerCatch(_0x588c('0x1c2')));delete _0x4e5ddf['actions'][_0x2c9ecd];});}else{loggerBooked[_0x588c('0x81')](_0x588c('0x1c3'),JSON[_0x588c('0x47')](_0x43a098[_0x588c('0x10f')]),_0x588c('0x1c4'),_0x43a098[_0x588c('0x3d')]);_0x4e5ddf[_0x588c('0xb9')](_0x43a098);_0x4e5ddf[_0x588c('0xc4')]({'active':![],'ContactId':_0x4e5ddf[_0x588c('0x108')][_0x2c9ecd]['ContactId'],'ListId':_0x4e5ddf[_0x588c('0x108')][_0x2c9ecd][_0x588c('0x11c')],'VoiceQueueId':_0x4e5ddf[_0x588c('0x108')][_0x2c9ecd][_0x588c('0xd6')]||undefined,'CampaignId':_0x4e5ddf[_0x588c('0x108')][_0x2c9ecd][_0x588c('0xd7')]||undefined})[_0x588c('0xb7')](loggerCatch(_0x588c('0x1c2')));delete _0x4e5ddf['actions'][_0x2c9ecd];}}else{return _0x4e5ddf['actionOriginate'](_0x43a098,_0x33b92a);}}else{if(getDiff(_0x33b92a['scheduledat'])<_0x43a098['dialRecallMeTimeout']*0x3c){_0x4e5ddf[_0x588c('0x1d')][_0x588c('0x119')](_0x33b92a['id'])[_0x588c('0x1b')](function(){_0x4e5ddf[_0x588c('0xb9')](_0x43a098);});}else{_0x43a098['outboundReCallsDay']+=0x1;_0x4e5ddf['updateOriginated'](_0x43a098);if(_0x43a098[_0x588c('0x1c5')]){_0x4e5ddf['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x33b92a[_0x588c('0xd4')],'ListId':_0x33b92a[_0x588c('0x11c')],'VoiceQueueId':_0x33b92a[_0x588c('0xd6')]||undefined,'CampaignId':_0x33b92a[_0x588c('0xd7')]||undefined})[_0x588c('0xb7')](loggerCatch(_0x588c('0x1c6')));_0x4e5ddf[_0x588c('0xcd')](createObjHistory(_0x43a098,_0x33b92a,_0x588c('0x1c7'),0x17,_0x588c('0x1c8')))[_0x588c('0xb7')](loggerCatch(_0x588c('0x1c9')));}else{_0x4e5ddf[_0x588c('0xd2')](createObjHistory(_0x43a098,_0x33b92a,_0x588c('0x1ca'),0x16,'RecallFailedTimeout'),_0x588c('0x1cb'),_0x588c('0x1cc'));}}}}else{_0x43a098['outboundBlacklistCallsDay']+=0x1;_0x4e5ddf['saveInDb'](createObjHistory(_0x43a098,_0x33b92a,_0x588c('0x1cd'),0xd,'Blacklist'),_0x588c('0x1ce'),'[Originate][MoveBlacklist]');throw _0x588c('0x1cf');}};};Dialer[_0x588c('0xae')][_0x588c('0x13e')]=function(_0x156ed6){var _0x4c7e2b=this;var _0x417201=[];var _0x2b3c2a=_0x156ed6[_0x588c('0x1d0')]-_0x156ed6[_0x588c('0x9f')]-_0x156ed6[_0x588c('0x1d1')];emitCampaignSummary(_0x156ed6);if(_0x2b3c2a>0x0){if(_0x2b3c2a>this[_0x588c('0x22')]){_0x2b3c2a=this[_0x588c('0x22')];}_0x156ed6[_0x588c('0x1d1')]+=_0x2b3c2a;this[_0x588c('0xc8')](_0x156ed6['id'],_0x2b3c2a,_0x156ed6['dialOrderByScheduledAt'])[_0x588c('0xbd')](function(_0x480f25){_0x156ed6[_0x588c('0x1d1')]-=_0x2b3c2a;_0x156ed6['temp']=_0x156ed6['temp']>0x0?_0x156ed6['temp']:0x0;if(!checkContactEmpty(_0x480f25)){_0x156ed6[_0x588c('0x3e')]=_0x588c('0xa4');logger[_0x588c('0x81')]('[getContactCampaign2][Empty]'+_0x156ed6[_0x588c('0x3d')]);}else{_0x156ed6[_0x588c('0x9f')]+=_0x480f25[_0x588c('0x9e')];_0x156ed6[_0x588c('0x3e')]=_0x588c('0x1d2');for(var _0x55b76c=0x0;_0x55b76c<_0x480f25[_0x588c('0x9e')];_0x55b76c+=0x1){_0x156ed6[_0x588c('0x1d3')]+=0x1;if(_[_0x588c('0xe0')](_0x480f25[_0x55b76c])||_[_0x588c('0xe0')](_0x480f25[_0x55b76c][_0x588c('0x14e')])||_[_0x588c('0xe0')](_0x480f25[_0x55b76c][_0x588c('0x14e')][_0x588c('0x14d')])){_0x4c7e2b['emptyContact'](_0x588c('0x1d4'),_0x156ed6,_0x480f25[_0x55b76c]);}else{_0x4c7e2b[_0x588c('0xc1')](_[_0x588c('0xd3')](_0x480f25[_0x55b76c],[_0x588c('0xd7'),_0x588c('0x1d5')]))[_0x588c('0xbd')](_0x4c7e2b['checkContactBlack'](_0x156ed6,_0x480f25[_0x55b76c]))['catch'](_0x4c7e2b[_0x588c('0xcf')](_0x588c('0x1d6'),_0x156ed6));}}}})[_0x588c('0xb7')](loggerGetContactDialer(_0x588c('0x1d7'),_0x156ed6,_0x2b3c2a));}};Dialer[_0x588c('0xae')][_0x588c('0x13a')]=function(_0x5cbc98,_0x552536){var _0x1f18ca=this;var _0x40639c=[];var _0x2ae769=_0x552536>=0x1?_0x552536:0x1;var _0xf16f7c=[];if(_0x5cbc98[_0x588c('0x5a')]===_0x588c('0x5')){_0x2ae769=0x1;}var _0x5d32f8=Math[_0x588c('0x19f')](_0x5cbc98[_0x588c('0x50')]*_0x2ae769)-_0x5cbc98['originated']-_0x5cbc98[_0x588c('0x1d1')];emitVoiceQueueSummary(_0x5cbc98);if(_0x5cbc98[_0x588c('0x1d8')]>0x0){var _0x2f3058=_0x5cbc98[_0x588c('0x1d8')]-_0x5cbc98[_0x588c('0x9f')]-_0x5cbc98['talking']-_0x5cbc98[_0x588c('0x1d1')]-_0x5cbc98['pTalking'];if(_0x5d32f8>_0x2f3058){_0x5d32f8=_0x2f3058;}}if(_0x5d32f8>0x0){if(_0x5cbc98['dialMethod']==='booked'){_0x5d32f8=0x1;}if(_0x5d32f8>this[_0x588c('0x22')]){_0x5d32f8=this[_0x588c('0x22')];}_0x5cbc98[_0x588c('0x1d1')]+=_0x5d32f8;for(var _0x1d208c in this[_0x588c('0x20')]){if(this[_0x588c('0x20')][_0x588c('0xb2')](_0x1d208c)){if(this[_0x588c('0x20')][_0x1d208c][_0x588c('0xab')]===_0x588c('0x1d9')&&this[_0x588c('0x20')][_0x1d208c][_0x588c('0xb5')]===_0x588c('0xdd')){_0x40639c[_0x588c('0x10c')](this['agents'][_0x1d208c]['id']);}}}this[_0x588c('0xc6')](_0x5cbc98['id'],_0x40639c,_0x5d32f8,_0x5cbc98[_0x588c('0x1da')])[_0x588c('0xbd')](function(_0x425d24){_0x5cbc98[_0x588c('0x1d1')]-=_0x5d32f8;_0x5cbc98[_0x588c('0x1d1')]=_0x5cbc98[_0x588c('0x1d1')]>0x0?_0x5cbc98[_0x588c('0x1d1')]:0x0;if(!checkContactEmpty(_0x425d24)){_0x1f18ca[_0x588c('0xbb')](_0x5cbc98)['then'](sendMessageReschedule(_0x5cbc98))[_0x588c('0xb7')](loggerCatch('[countReScheduled]\x20'));}else{_0x5cbc98['originated']+=_0x425d24[_0x588c('0x9e')];_0x5cbc98[_0x588c('0x3e')]=_0x5cbc98[_0x588c('0x5a')]===_0x588c('0x5')?_0x588c('0x158'):_0x588c('0x1d2');for(var _0x370515=0x0;_0x370515<_0x425d24['length'];_0x370515+=0x1){if(_[_0x588c('0xe0')](_0x425d24[_0x370515])||_[_0x588c('0xe0')](_0x425d24[_0x370515][_0x588c('0x14e')])||_[_0x588c('0xe0')](_0x425d24[_0x370515]['Contact'][_0x588c('0x14d')])){_0x1f18ca[_0x588c('0xd0')](_0x588c('0x1d4'),_0x5cbc98,_0x425d24[_0x370515]);}else{_0x1f18ca[_0x588c('0xbf')](_[_0x588c('0xd3')](_0x425d24[_0x370515],[_0x588c('0xd6'),_0x588c('0x1d5')]))[_0x588c('0xbd')](_0x1f18ca['checkContactBlack'](_0x5cbc98,_0x425d24[_0x370515]))['catch'](_0x1f18ca[_0x588c('0xcf')](_0x588c('0x1d4'),_0x5cbc98));}}}})[_0x588c('0xb7')](loggerGetContactDialer(_0x588c('0x1db'),_0x5cbc98,_0x5d32f8));}};Dialer[_0x588c('0xae')]['handlePredictive']=function(_0x34e716){var _0x595333=this;if(_0x34e716[_0x588c('0x1d8')]>0x0){var _0x37e504=_0x34e716[_0x588c('0x1d8')]-_0x34e716[_0x588c('0x9f')]-_0x34e716[_0x588c('0x53')];if(_0x37e504>0x0){this[_0x588c('0x1dc')](_0x34e716);}else{loggerPredictiveCalls[_0x588c('0x81')](_0x588c('0x1dd'));}}else{this[_0x588c('0x1dc')](_0x34e716);}};Dialer[_0x588c('0xae')][_0x588c('0x1dc')]=function(_0x2b9ed2){var _0x5a0d4e=this;var _0x3119cb=[];_0x2b9ed2[_0x588c('0x9f')]+=0x1;for(var _0x4cd876 in this[_0x588c('0x20')]){if(this['agents'][_0x588c('0xb2')](_0x4cd876)){if(this[_0x588c('0x20')][_0x4cd876][_0x588c('0xab')]===_0x588c('0x1d9')&&this[_0x588c('0x20')][_0x4cd876][_0x588c('0xb5')]==='reachable'){_0x3119cb[_0x588c('0x10c')](this[_0x588c('0x20')][_0x4cd876]['id']);}}}this[_0x588c('0xc6')](_0x2b9ed2['id'],_0x3119cb,0x1,_0x2b9ed2[_0x588c('0x1da')])[_0x588c('0xbd')](function(_0x2a6b3d){if(!checkContactEmpty(_0x2a6b3d)){checkContactLowerLimitOriginate(_0x2b9ed2,0x1,0x0);_0x5a0d4e['countReScheduled'](_0x2b9ed2)['then'](sendMessageReschedule(_0x2b9ed2))[_0x588c('0xb7')](loggerCatch(_0x588c('0xbe')));}else{_0x2b9ed2[_0x588c('0x3e')]='RUNNING';if(_[_0x588c('0xe0')](_0x2a6b3d[0x0])||_[_0x588c('0xe0')](_0x2a6b3d[0x0][_0x588c('0x14e')])||_[_0x588c('0xe0')](_0x2a6b3d[0x0][_0x588c('0x14e')][_0x588c('0x14d')])){_0x5a0d4e['emptyContact'](_0x588c('0x1d4'),_0x2b9ed2,_0x2a6b3d[0x0]);}else{_0x5a0d4e[_0x588c('0xbf')](_[_0x588c('0xd3')](_0x2a6b3d[0x0],['VoiceQueueId',_0x588c('0x1d5')]))[_0x588c('0xbd')](_0x5a0d4e[_0x588c('0x1be')](_0x2b9ed2,_0x2a6b3d[0x0]))[_0x588c('0xb7')](_0x5a0d4e[_0x588c('0xcf')](_0x588c('0x1de'),_0x2b9ed2));}}})['catch'](loggerGetContactDialer(_0x588c('0x1df'),_0x2b9ed2,0x1));emitVoiceQueueSummary(_0x2b9ed2);};Dialer[_0x588c('0xae')]['abandonmentRate']=function(_0x4c7540,_0x216e30,_0x20f2c0,_0x305ddd,_0x2e36d9,_0x1b3e49){loggerPredictive[_0x588c('0x81')](_0x588c('0x1e0'));loggerPredictive['info'](_0x588c('0x1e1'),_0x4c7540);loggerPredictive[_0x588c('0x81')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x216e30);loggerPredictive[_0x588c('0x81')](_0x588c('0x1e2'),_0x20f2c0);loggerPredictive[_0x588c('0x81')]('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',_0x305ddd);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e36d9);loggerPredictive[_0x588c('0x81')](_0x588c('0x88'));return new BPromise(function(_0x28e843,_0x2489f8){if(_0x4c7540<=0x0||isNaN(_0x4c7540)){return _0x2489f8(msgResponse('[abandonmentRate]',_0x588c('0x46'),'m\x20=\x20'+_0x4c7540));}if(_0x20f2c0<=0x0||isNaN(_0x20f2c0)){return _0x2489f8(msgResponse('[abandonmentRate]',_0x588c('0x46'),_0x588c('0x1e3')+_0x20f2c0));}if(_0x305ddd<=0x0||isNaN(_0x305ddd)){return _0x2489f8(msgResponse(_0x588c('0x1e4'),_0x588c('0x46'),_0x588c('0x1e5')+_0x305ddd));}if(_0x216e30<=0x0||isNaN(_0x216e30)){return _0x2489f8(msgResponse(_0x588c('0x1e4'),_0x588c('0x46'),'interval\x20=\x20'+_0x216e30));}if(_0x2e36d9<=0x0||isNaN(_0x2e36d9)){return _0x2489f8(msgResponse(_0x588c('0x1e4'),_0x588c('0x46'),'Amax\x20=\x20'+_0x2e36d9));}_0x1b3e49=_0x1b3e49||0x0;var _0x3842a0=0x1/_0x20f2c0;var _0x21fc3d=0x0;var _0x1d760f=0x0;var _0x2ff437=0x0;var _0xb117c6=0x0;for(var _0x2962fc=0x0;_0x2ff437<_0x2e36d9;_0x2962fc+=0x1){_0x1d760f=_0x2962fc/_0x216e30;_0x21fc3d=(_0x305ddd*_0x1d760f+_0x1b3e49)/_0x3842a0;_0x2ff437=erlangb(_0x21fc3d,_0x4c7540);_0xb117c6=_0x21fc3d/_0x4c7540*(0x1-erlangb(_0x21fc3d,_0x4c7540));}return _0x28e843({'erlangCalls':_0x2962fc,'erlangCallToSecond':_0x216e30/_0x2962fc,'erlangAbandonmentRate':_0x2ff437,'erlangBusyFactor':_0xb117c6});});};Dialer[_0x588c('0xae')][_0x588c('0x1b5')]=function(_0x588ce2,_0x2654ba,_0xdc8eaa,_0x162347,_0xb4e664,_0x35fbef){loggerPredictive[_0x588c('0x81')](_0x588c('0x1e6'));loggerPredictive[_0x588c('0x81')](_0x588c('0x1e1'),_0x588ce2);loggerPredictive[_0x588c('0x81')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2654ba);loggerPredictive[_0x588c('0x81')]('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',_0xdc8eaa);loggerPredictive[_0x588c('0x81')]('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',_0x162347);loggerPredictive['info'](_0x588c('0x1e7'),_0xb4e664);loggerPredictive[_0x588c('0x81')](_0x588c('0x88'));return new BPromise(function(_0x103399,_0x879e56){if(_0x588ce2<=0x0||isNaN(_0x588ce2)){return _0x879e56(msgResponse(_0x588c('0x1e8'),'Error','m\x20=\x20'+_0x588ce2));}if(_0xdc8eaa<=0x0||isNaN(_0xdc8eaa)){return _0x879e56(msgResponse(_0x588c('0x1e8'),_0x588c('0x46'),'Ts\x20=\x20'+_0xdc8eaa));}if(_0x162347<=0x0||isNaN(_0x162347)){return _0x879e56(msgResponse(_0x588c('0x1e8'),_0x588c('0x46'),_0x588c('0x1e5')+_0x162347));}if(_0x2654ba<=0x0||isNaN(_0x2654ba)){return _0x879e56(msgResponse(_0x588c('0x1e8'),_0x588c('0x46'),'interval\x20=\x20'+_0x2654ba));}if(_0xb4e664<=0x0||isNaN(_0xb4e664)){return _0x879e56(msgResponse(_0x588c('0x1e8'),_0x588c('0x46'),_0x588c('0x1e9')+_0xb4e664));}_0x35fbef=_0x35fbef||0x0;var _0x5ab78e=0x1/_0xdc8eaa;var _0x366acb=0x0;var _0x33d4c7=0x0;var _0x28a542=0x0;var _0x501116=0x0;for(var _0x48e6e9=0x0;_0x501116<_0xb4e664;_0x48e6e9+=0x1){_0x33d4c7=_0x48e6e9/_0x2654ba;_0x366acb=(_0x162347*_0x33d4c7+_0x35fbef)/_0x5ab78e;_0x28a542=erlangb(_0x366acb,_0x588ce2);_0x501116=_0x366acb/_0x588ce2*(0x1-erlangb(_0x366acb,_0x588ce2));}return _0x103399({'erlangCalls':_0x48e6e9,'erlangCallToSecond':_0x2654ba/_0x48e6e9,'erlangAbandonmentRate':_0x28a542,'erlangBusyFactor':_0x501116});});};module[_0x588c('0x1ea')]=Dialer; \ No newline at end of file +var _0xd9cb=['xcally-motion-dialer','dialAMDActive','outboundAnswerCallsDay','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','AMD','amd','[syncMachine][createHistory]','[syncMachine]','HANGUP','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','channel','actionid','roundrobin','locked','paused','agents','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','true','content','all','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','checkDialMethod','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','outbound','dialQueueOptions','getCaller','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countnoanswerretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','minutes','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','countcongestionretry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','reachable','tryOriginatePredictive','RUNNING','[getContactDialerPredictive]','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----','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','[busyFactor]','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','strategy','available','loggedIn','pTalking','sumHoldTime','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','active','SIP/%s','unmonitored','saveInDb','uniqueid','isNil','variable','amdstatus','exten'];(function(_0x279657,_0x34d0fe){var _0x3e8895=function(_0x43960a){while(--_0x43960a){_0x279657['push'](_0x279657['shift']());}};_0x3e8895(++_0x34d0fe);}(_0xd9cb,0x106));var _0xbd9c=function(_0xf71b61,_0x218f11){_0xf71b61=_0xf71b61-0x0;var _0x1b9b5d=_0xd9cb[_0xf71b61];return _0x1b9b5d;};'use strict';var util=require(_0xbd9c('0x0'));var _=require(_0xbd9c('0x1'));var BPromise=require(_0xbd9c('0x2'));var uuid=require(_0xbd9c('0x3'));var moment=require(_0xbd9c('0x4'));var rr=require('rr');var md5=require(_0xbd9c('0x5'));var Redis=require(_0xbd9c('0x6'));var config=require(_0xbd9c('0x7'));var logger=require(_0xbd9c('0x8'))(_0xbd9c('0x9'));var loggerBooked=require(_0xbd9c('0x8'))(_0xbd9c('0xa'));var loggerPredictive=require('../../../config/logger')(_0xbd9c('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0xbd9c('0xc'));var ami=require(_0xbd9c('0xd'));config[_0xbd9c('0xe')]=_[_0xbd9c('0xf')](config[_0xbd9c('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd9c('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xbd9c('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xbd9c('0x11'));var Action=require(_0xbd9c('0x12'));var History=require(_0xbd9c('0x13'));var Final=require('./final');var AgentComplete=require(_0xbd9c('0x14'));var QueueCallerAbandon=require(_0xbd9c('0x15'));var Hangup=require(_0xbd9c('0x16'));var ipAgi=process[_0xbd9c('0x17')]['XCALLY_IP_AGI']||_0xbd9c('0x18');var strategy={'rrmemory':_0xbd9c('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0xbd9c('0x1a')]=function(_0x397554){this['tail']=this[_0xbd9c('0x1b')]?this[_0xbd9c('0x1b')][_0xbd9c('0x1c')](_0x397554):_0x397554();};function Dialer(_0x4e7fb7,_0x332acf){this[_0xbd9c('0x1d')]=new Sequence();this[_0xbd9c('0x1e')]=_0x332acf;this[_0xbd9c('0x1f')]=_0x4e7fb7[_0xbd9c('0x1f')];this[_0xbd9c('0x20')]=_0x4e7fb7[_0xbd9c('0x20')];this['agents']=_0x4e7fb7['agents'];this[_0xbd9c('0x21')]=_0x4e7fb7[_0xbd9c('0x21')];this[_0xbd9c('0x22')]=config[_0xbd9c('0x22')]||0x2;this[_0xbd9c('0x23')]={};this[_0xbd9c('0x24')]={};this['contactsId']={};this[_0xbd9c('0x25')]={};this[_0xbd9c('0x26')]={};this[_0xbd9c('0x27')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xbd9c('0x28')]={};this[_0xbd9c('0x29')]={};ami['on'](_0xbd9c('0x2a'),this['syncAgentConnect'][_0xbd9c('0x2b')](this));ami['on'](_0xbd9c('0x2c'),this[_0xbd9c('0x2d')]['bind'](this));ami['on'](_0xbd9c('0x2e'),this['syncOriginateResponse'][_0xbd9c('0x2b')](this));ami['on']('agentcomplete',this[_0xbd9c('0x2f')]['bind'](this));ami['on'](_0xbd9c('0x30'),this[_0xbd9c('0xc')][_0xbd9c('0x2b')](this));ami['on'](_0xbd9c('0x31'),this[_0xbd9c('0x32')][_0xbd9c('0x2b')](this));ami['on'](_0xbd9c('0x33'),this[_0xbd9c('0x34')][_0xbd9c('0x2b')](this));ami['on']('varset',this[_0xbd9c('0x35')][_0xbd9c('0x2b')](this));ami['on'](_0xbd9c('0x36'),this[_0xbd9c('0x37')]['bind'](this));ami['on'](_0xbd9c('0x38'),this[_0xbd9c('0x39')][_0xbd9c('0x2b')](this));this[_0xbd9c('0x3a')]();this['loopClearZombieChannels']();}function isNotNull(_0x3ae76d){return _0x3ae76d!==null&&!_['isUndefined'](_0x3ae76d);}function checkIsLoggedIn(_0x513509,_0x368dd2){return function(){if(_0x368dd2<=0x0){_0x513509[_0xbd9c('0x3b')]=_0xbd9c('0x3c');throw _0x513509[_0xbd9c('0x3d')]+_0xbd9c('0x3e');}};}function isActive(_0x4c01bb){return _0x4c01bb;}function checkIsActive(_0x5789cf,_0x2e3315){return function(){if(!isActive(_0x2e3315)){_0x5789cf['message']=_0xbd9c('0x3f');throw _0x5789cf['name']+_0xbd9c('0x40');}};}function checkInterval(_0x1c6c4e){return function(){if(!isNotNull(_0x1c6c4e[_0xbd9c('0x41')])){_0x1c6c4e[_0xbd9c('0x3b')]='INTERVAL_IS_NULL';throw _0x1c6c4e['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1c6c4e[_0xbd9c('0x41')][_0xbd9c('0x42')])){_0x1c6c4e[_0xbd9c('0x3b')]=_0xbd9c('0x43');throw _0x1c6c4e[_0xbd9c('0x3d')]+_0xbd9c('0x44');}if(!isNotNull(_[_0xbd9c('0x45')](_0x1c6c4e[_0xbd9c('0x41')][_0xbd9c('0x42')]))){_0x1c6c4e[_0xbd9c('0x3b')]=_0xbd9c('0x43');throw _0x1c6c4e[_0xbd9c('0x3d')]+_0xbd9c('0x44');}};}function msgResponse(_0xef2947,_0x57c75b,_0x219b20){return{'action':_0xef2947,'response':_0x57c75b,'message':_0x219b20,'stack':_0x219b20};}function myreject(_0x45317d){return function(_0x9ed6c8){return _0x45317d(msgResponse(_0xbd9c('0x46'),_0xbd9c('0x47'),JSON[_0xbd9c('0x48')](_0x9ed6c8)));};}function getSeconds(_0x1561d2,_0x4b9b41){var _0x51f6af=moment(_0x1561d2)[_0xbd9c('0x49')](0x0);var _0x365d38=moment(_0x4b9b41)[_0xbd9c('0x49')](0x0);return _0x51f6af['diff'](_0x365d38,_0xbd9c('0x4a'));}function emit(_0x1295ca,_0x244903,_0x4dade6){io['to'](_0x1295ca)[_0xbd9c('0x4b')](_0x244903,_0x4dade6);}function emitVoiceQueueSummary(_0x2ccf1f){if(_0x2ccf1f['type']==='outbound'){var _0x1f1996={'id':_0x2ccf1f['id'],'name':_0x2ccf1f[_0xbd9c('0x3d')],'strategy':_0x2ccf1f[_0xbd9c('0x4c')],'answered':_0x2ccf1f['answered'],'available':_0x2ccf1f[_0xbd9c('0x4d')],'loggedIn':_0x2ccf1f[_0xbd9c('0x4e')],'pTalking':_0x2ccf1f[_0xbd9c('0x4f')],'sumBillable':_0x2ccf1f['sumBillable'],'sumDuration':_0x2ccf1f['sumDuration'],'sumHoldTime':_0x2ccf1f[_0xbd9c('0x50')]||0x0,'talking':_0x2ccf1f['talking'],'total':_0x2ccf1f[_0xbd9c('0x51')],'type':_0x2ccf1f[_0xbd9c('0x52')],'unmanaged':_0x2ccf1f[_0xbd9c('0x53')],'abandoned':_0x2ccf1f['abandoned'],'waiting':_0x2ccf1f[_0xbd9c('0x54')],'loggedInDb':_0x2ccf1f[_0xbd9c('0x55')],'dialActive':_0x2ccf1f[_0xbd9c('0x56')],'dialMethod':_0x2ccf1f[_0xbd9c('0x57')],'dialOriginateCallerIdName':_0x2ccf1f[_0xbd9c('0x58')],'dialOriginateCallerIdNumber':_0x2ccf1f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x2ccf1f[_0xbd9c('0x59')],'dialPrefix':_0x2ccf1f[_0xbd9c('0x5a')],'outboundAnswerAgiCallsDay':_0x2ccf1f[_0xbd9c('0x5b')],'outboundAnswerCallsDay':_0x2ccf1f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2ccf1f[_0xbd9c('0x5c')],'outboundBusyCallsDay':_0x2ccf1f[_0xbd9c('0x5d')],'outboundCongestionCallsDay':_0x2ccf1f[_0xbd9c('0x5e')],'outboundDropCallsDayACS':_0x2ccf1f[_0xbd9c('0x5f')],'outboundDropCallsDayCallersExit':_0x2ccf1f[_0xbd9c('0x60')],'outboundDropCallsDayTimeout':_0x2ccf1f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2ccf1f[_0xbd9c('0x61')],'outboundNoSuchCallsDay':_0x2ccf1f[_0xbd9c('0x62')],'outboundOriginateFailureCallsDay':_0x2ccf1f[_0xbd9c('0x63')],'outboundReCallsDay':_0x2ccf1f[_0xbd9c('0x64')],'outboundRejectCallsDay':_0x2ccf1f['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2ccf1f[_0xbd9c('0x65')],'predictiveIntervalAnsweredCalls':_0x2ccf1f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2ccf1f['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2ccf1f[_0xbd9c('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x2ccf1f[_0xbd9c('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x2ccf1f[_0xbd9c('0x68')],'predictiveIntervalErlangCalls':_0x2ccf1f[_0xbd9c('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x2ccf1f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2ccf1f[_0xbd9c('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x2ccf1f[_0xbd9c('0x6b')],'predictiveIntervalPauses':_0x2ccf1f[_0xbd9c('0x6c')],'predictiveIntervalAvailable':_0x2ccf1f['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2ccf1f[_0xbd9c('0x6d')],'message':_0x2ccf1f[_0xbd9c('0x3b')],'originated':_0x2ccf1f[_0xbd9c('0x6e')],'erlangCalls':_0x2ccf1f['erlangCalls'],'erlangCallToSecond':_0x2ccf1f[_0xbd9c('0x6f')],'erlangAbandonmentRate':_0x2ccf1f[_0xbd9c('0x70')],'erlangBusyFactor':_0x2ccf1f[_0xbd9c('0x71')],'startPredictive':_0x2ccf1f['startPredictive'],'startProgressive':_0x2ccf1f[_0xbd9c('0x72')]};if(_0x2ccf1f[_0xbd9c('0x73')]){_0x1f1996['Trunk']={'id':_0x2ccf1f[_0xbd9c('0x73')]['id'],'name':_0x2ccf1f[_0xbd9c('0x73')][_0xbd9c('0x3d')],'active':_0x2ccf1f[_0xbd9c('0x73')]['active'],'callerid':_0x2ccf1f[_0xbd9c('0x73')][_0xbd9c('0x74')]};}if(_0x2ccf1f[_0xbd9c('0x41')]){_0x1f1996[_0xbd9c('0x41')]={'id':_0x2ccf1f[_0xbd9c('0x41')]['id'],'name':_0x2ccf1f[_0xbd9c('0x41')]['name']};}var _0x37352f=md5(JSON['stringify'](_0x1f1996));if(_0x2ccf1f[_0xbd9c('0x5')]!==_0x37352f){_0x2ccf1f[_0xbd9c('0x5')]=_0x37352f;emit(util[_0xbd9c('0x75')]('voice:queue:%s',_0x1f1996[_0xbd9c('0x3d')]),_0xbd9c('0x76'),_0x1f1996);}}}function emitCampaignSummary(_0x245d97){if(_0x245d97['type']===_0xbd9c('0x77')){emit(util[_0xbd9c('0x75')](_0xbd9c('0x78'),_0x245d97[_0xbd9c('0x3d')]),_0xbd9c('0x79'),_0x245d97);}}function checkGetDataPredictive(_0x30f100){if(isNotNull(_0x30f100)){if(!_['isEmpty'](_0x30f100)){loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x7b'));loggerPredictive['info'](_0xbd9c('0x7c'),_0x30f100[_0xbd9c('0x6d')]);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x7d'),_0x30f100[_0xbd9c('0x7e')]);loggerPredictive['info'](_0xbd9c('0x7f'),_0x30f100[_0xbd9c('0x68')]);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x80'),_0x30f100[_0xbd9c('0x67')]);loggerPredictive['info'](_0xbd9c('0x81'),_0x30f100[_0xbd9c('0x82')]);loggerPredictive['info'](_0xbd9c('0x83'),_0x30f100[_0xbd9c('0x66')]);loggerPredictive['info'](_0xbd9c('0x84'));if(_0x30f100[_0xbd9c('0x6d')]>0x0){if(!_[_0xbd9c('0x85')](_0x30f100[_0xbd9c('0x66')])&&_0x30f100['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x86'));}if(!_[_0xbd9c('0x85')](_0x30f100['predictiveIntervalAvgHoldtime'])&&_0x30f100[_0xbd9c('0x82')]>0x0){return!![];}else{loggerPredictive['info'](_0xbd9c('0x87'));}}else{loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x88'));}}else{loggerPredictive[_0xbd9c('0x7a')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x89'));}return![];}function mergeDataErlangB(_0x359055){return function(_0x4ab53a){loggerPredictive['info'](_0xbd9c('0x8a'));loggerPredictive[_0xbd9c('0x7a')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ab53a[_0xbd9c('0x8b')]);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x8c'),_0x4ab53a[_0xbd9c('0x6f')]);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x8d'),_0x4ab53a[_0xbd9c('0x70')]);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x8e'),_0x4ab53a[_0xbd9c('0x71')]);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x8d'),_0x4ab53a['erlangAbandonmentRate']);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x84'));_['merge'](_0x359055,_0x4ab53a);};}function getDiff(_0x1f4599){var _0x2ab486=moment()[_0xbd9c('0x49')](0x0);var _0x31922e=moment(_0x1f4599)[_0xbd9c('0x49')](0x0);return _0x2ab486[_0xbd9c('0x8f')](_0x31922e,_0xbd9c('0x4a'));}function ifInterval(_0x131916,_0xfe456f){if(_[_0xbd9c('0x85')](_0xfe456f)){return![];}if(getDiff(_0xfe456f)<_0x131916*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x5928a5){if(isNotNull(_0x5928a5)){if(!_[_0xbd9c('0x85')](_0x5928a5[_0xbd9c('0x72')])){_0x5928a5['startProgressive']=undefined;loggerPredictive[_0xbd9c('0x7a')](_0x5928a5[_0xbd9c('0x3d')],_0xbd9c('0x90'));}if(!_[_0xbd9c('0x85')](_0x5928a5[_0xbd9c('0x27')])){_0x5928a5[_0xbd9c('0x27')]=undefined;loggerPredictive[_0xbd9c('0x7a')](_0x5928a5[_0xbd9c('0x3d')],_0xbd9c('0x91'));}if(!_['isUndefined'](_0x5928a5['handlePredictive'])){clearInterval(_0x5928a5[_0xbd9c('0x92')]);_0x5928a5['handlePredictive']=undefined;loggerPredictive[_0xbd9c('0x7a')](_0x5928a5[_0xbd9c('0x3d')],_0xbd9c('0x93'));}}}function erlangb(_0x2d16e2,_0x196f5e){if(_0x196f5e===0x0){return 0x0;}var _0x22fecc=0x1;for(var _0x45f70b=0x1;_0x45f70b<=_0x196f5e;_0x45f70b+=0x1){_0x22fecc=0x1+_0x22fecc*_0x45f70b/_0x2d16e2;}return 0x1/_0x22fecc;}function isVoiceQueueOutbound(_0x2b1b9c){return _0x2b1b9c==='outbound';}function isNotPreview(_0x595d6c){return _0x595d6c!=='preview';}function isCampaignIvr(_0x242a65){return _0x242a65===_0xbd9c('0x77');}function getCallerId(_0x40e657,_0x3c985f,_0x4b1f9d){if(!_['isUndefined'](_0x4b1f9d)&&_0xbd9c('0x94')===typeof _0x4b1f9d&&!_[_0xbd9c('0x45')](_0x4b1f9d)){if(!_[_0xbd9c('0x85')](_0x3c985f)&&_0xbd9c('0x94')===typeof _0x3c985f&&!_['isEmpty'](_0x3c985f)){return util[_0xbd9c('0x75')](_0xbd9c('0x95'),_0x3c985f,_0x4b1f9d);}return util[_0xbd9c('0x75')](_0xbd9c('0x95'),_0x4b1f9d,_0x4b1f9d);}if(!_[_0xbd9c('0x85')](_0x40e657)&&_0xbd9c('0x94')===typeof _0x40e657&&!_[_0xbd9c('0x45')](_0x40e657)){return _0x40e657;}return _0xbd9c('0x96');}function loggerCatchQueueSummary(_0x3bf7d7,_0x2b6406){return function(_0x5cfd4e){freeVariablesPredictive(_0x2b6406);emitVoiceQueueSummary(_0x2b6406);emitCampaignSummary(_0x2b6406);loggerSyncQueueSummary[_0xbd9c('0x97')](_0x3bf7d7,util[_0xbd9c('0x98')](_0x5cfd4e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1e1370,_0x27fa47){return function(_0x10a9a4){loggerPredictive[_0xbd9c('0x97')](_0x27fa47[_0xbd9c('0x3d')],_0x1e1370);loggerPredictive[_0xbd9c('0x97')](_0x10a9a4[_0xbd9c('0x99')]);freeVariablesPredictive(_0x27fa47);};}function loggerCatch(_0x4ba541){return function(_0x3eb31f){logger['error'](_0x4ba541,util[_0xbd9c('0x98')](_0x3eb31f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x385771){return _0x385771&&!_[_0xbd9c('0x85')](_0x385771)&&_0x385771[_0xbd9c('0x9a')]>0x0;}function decremetOriginate(_0x26abf8){if(!_[_0xbd9c('0x85')](_0x26abf8)&&_0x26abf8!==null){if(_0x26abf8[_0xbd9c('0x9b')](_0xbd9c('0x6e'))){if(_0x26abf8[_0xbd9c('0x6e')]>0x0){_0x26abf8['originated']-=0x1;}else{logger[_0xbd9c('0x97')](_0xbd9c('0x9c'));}}}else{logger[_0xbd9c('0x97')](_0xbd9c('0x9d'));}}function checkContactLowerLimitOriginate(_0x1794b0,_0x5a7538,_0x5e560c){if(_0x5a7538>_0x5e560c){for(var _0x1b729a=0x0;_0x1b729a<_0x5a7538-_0x5e560c;_0x1b729a+=0x1){decremetOriginate(_0x1794b0);}}}function loggerGetContactDialer(_0x2693bc,_0x4260b7,_0x4ee816){return function(_0x23441a){checkContactLowerLimitOriginate(_0x4260b7,_0x4ee816,0x0);logger[_0xbd9c('0x97')](_0x2693bc,util[_0xbd9c('0x98')](_0x23441a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5cf692){return function(_0x4f45e1){if(isNotNull(_0x4f45e1)&&isNotNull(_0x4f45e1[0x0])){if(_0x4f45e1[0x0][_0xbd9c('0x9e')]>0x0){_0x5cf692['message']=_0xbd9c('0x9f');logger['info'](_0xbd9c('0xa0')+_0x5cf692[_0xbd9c('0x3d')],_0x4f45e1[0x0][_0xbd9c('0x9e')],_0xbd9c('0xa1'));}else{_0x5cf692[_0xbd9c('0x3b')]=_0xbd9c('0xa2');logger['info'](_0xbd9c('0xa3')+_0x5cf692[_0xbd9c('0x3d')]);}}};}function notSendMessagesQueue(_0x4a8380){if(_0x4a8380[_0xbd9c('0xa4')]){freeVariablesPredictive(_0x4a8380);if(_0x4a8380[_0xbd9c('0x6e')]===0x0&&_0x4a8380[_0xbd9c('0xa5')]===0x0&&_0x4a8380[_0xbd9c('0x54')]===0x0&&(_0x4a8380[_0xbd9c('0x4f')]||0x0)===0x0){_0x4a8380['sendMessageOneNotActive']=![];_0x4a8380['available']=0x0;_0x4a8380['message']=_0xbd9c('0x3f');loggerSyncQueueSummary[_0xbd9c('0x97')](_0xbd9c('0xa6'),_0x4a8380[_0xbd9c('0x3d')],_0xbd9c('0xa7'));}else{_0x4a8380['message']=_0xbd9c('0xa8');loggerSyncQueueSummary[_0xbd9c('0x97')](_0xbd9c('0xa6'),_0x4a8380[_0xbd9c('0x3d')],'is\x20disactive');}emitVoiceQueueSummary(_0x4a8380);}}function notSendMessagesCampaign(_0x42721b){if(_0x42721b[_0xbd9c('0xa4')]){if(_0x42721b[_0xbd9c('0x6e')]===0x0){_0x42721b['sendMessageOneNotActive']=![];_0x42721b[_0xbd9c('0x3b')]=_0xbd9c('0x3f');loggerSyncQueueSummary[_0xbd9c('0x97')](_0xbd9c('0xa9'),_0x42721b['name'],'is\x20not\x20active');}else{_0x42721b['message']=_0xbd9c('0xa8');loggerSyncQueueSummary[_0xbd9c('0x97')](_0xbd9c('0xa9'),_0x42721b[_0xbd9c('0x3d')],_0xbd9c('0xaa'));}emitCampaignSummary(_0x42721b);}}function createObjHistory(_0x95b134,_0xbc250e,_0x4e6206,_0x2f1f6a,_0x31c091){_0x95b134['message']=_0x4e6206;var _0x124c46=new Action(_0x95b134,_0xbc250e);var _0x313369=new History(_0x124c46);_0x313369[_0xbd9c('0xab')]=_0x2f1f6a;_0x313369[_0xbd9c('0xac')]=_0x31c091;_0x313369[_0xbd9c('0xad')]=_0x124c46[_0xbd9c('0xae')];return _0x313369;}Dialer[_0xbd9c('0xaf')][_0xbd9c('0xb0')]=function(){var _0x222612=this;setInterval(function(){_0x222612[_0xbd9c('0xb1')](_0x222612['uniqueId'],_0xbd9c('0xb2'));_0x222612[_0xbd9c('0xb1')](_0x222612[_0xbd9c('0x24')],'[actions]');},0x32c8);};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xb1')]=function(_0x3b44fb,_0x418997){var _0xdfd476=this;for(var _0x1aee0b in _0x3b44fb){if(_0x3b44fb['hasOwnProperty'](_0x1aee0b)){this[_0xbd9c('0x1d')][_0xbd9c('0x1a')](function(){if(!_['isNil'](_0x3b44fb[_0x1aee0b])){return ami[_0xbd9c('0xb3')]({'action':_0xbd9c('0xb4'),'channel':_0x3b44fb[_0x1aee0b]['channel']})[_0xbd9c('0xb5')](function(_0x1bbfc1){if(_0x1bbfc1[_0xbd9c('0x3b')]===_0xbd9c('0xb6')){setTimeout(function(){if(_0x3b44fb[_0x1aee0b]&&_0x3b44fb[_0x1aee0b]['type']!==_0xbd9c('0x77')){_0xdfd476[_0xbd9c('0xb7')](_0xdfd476['voiceQueues'][_0x3b44fb[_0x1aee0b][_0xbd9c('0xb8')]]);logger[_0xbd9c('0x97')](_0xbd9c('0xb9'),_0x418997,_0x1aee0b,_0x3b44fb[_0x1aee0b][_0xbd9c('0xb8')]);delete _0x3b44fb[_0x1aee0b];}if(_0x3b44fb[_0x1aee0b]&&_0x3b44fb[_0x1aee0b][_0xbd9c('0x52')]===_0xbd9c('0x77')){_0xdfd476[_0xbd9c('0xb7')](_0xdfd476[_0xbd9c('0x20')][_0x3b44fb[_0x1aee0b][_0xbd9c('0xb8')]]);logger['error'](_0xbd9c('0xba'),_0x418997,_0x1aee0b,_0x3b44fb[_0x1aee0b][_0xbd9c('0xb8')]);delete _0x3b44fb[_0x1aee0b];}},0x2328);}});}});}}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xbb')]=function(_0x5e12cf){return BPromise[_0xbd9c('0xbc')]()['then'](cmHopper[_0xbd9c('0xbb')](_0x5e12cf))[_0xbd9c('0xb5')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0xbd9c('0xbd')]=function(_0x67f1ec){return BPromise[_0xbd9c('0xbc')]()[_0xbd9c('0xbe')](cmHopperBlack[_0xbd9c('0xbd')](_0x67f1ec))['catch'](loggerCatch(_0xbd9c('0xbf')));};Dialer[_0xbd9c('0xaf')]['checkIsBlackListIvr']=function(_0x475cb2){return BPromise[_0xbd9c('0xbc')]()[_0xbd9c('0xbe')](cmHopperBlack[_0xbd9c('0xc0')](_0x475cb2))[_0xbd9c('0xb5')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0xbd9c('0xc1')]=function(_0x28936f){return BPromise[_0xbd9c('0xbc')]()[_0xbd9c('0xbe')](cmHopperHistory[_0xbd9c('0xc2')](_0x28936f))[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0xc3')));};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xc4')]=function(_0x128604){return BPromise['resolve']()[_0xbd9c('0xbe')](cmHopper[_0xbd9c('0xc4')](_0x128604))['catch'](loggerCatch(_0xbd9c('0xc5')));};Dialer[_0xbd9c('0xaf')]['getContactDialer']=function(_0x362942,_0x5901d0,_0x47919b,_0x4612b6){return BPromise[_0xbd9c('0xbc')]()['then'](cmHopper[_0xbd9c('0xc6')](_0x362942,_0x5901d0,_0x47919b,_0x4612b6))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xbd9c('0xaf')]['getContactDialerIvr']=function(_0x4988de,_0x261d5c,_0x7140a0){return BPromise[_0xbd9c('0xbc')]()[_0xbd9c('0xbe')](cmHopper[_0xbd9c('0xc7')](_0x4988de,_0x261d5c,_0x7140a0))[_0xbd9c('0xb5')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xc8')]=function(_0x5634ef){return BPromise[_0xbd9c('0xbc')]()[_0xbd9c('0xbe')](voiceQueueRt[_0xbd9c('0xc8')](_0x5634ef))[_0xbd9c('0xb5')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xc9')]=function(_0x4cf453){return BPromise[_0xbd9c('0xbc')]()[_0xbd9c('0xbe')](cmHopper[_0xbd9c('0xc9')](_0x4cf453))['catch'](loggerCatch(_0xbd9c('0xca')));};Dialer['prototype']['createHistory']=function(_0x2fbbcd){return BPromise['resolve']()[_0xbd9c('0xbe')](cmHopperHistory[_0xbd9c('0xcb')](_0x2fbbcd))[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0xcc')));};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xb7')]=function(_0x4d806a){if(!_['isUndefined'](_0x4d806a)&&_0x4d806a!==null){if(_0x4d806a['hasOwnProperty'](_0xbd9c('0x6e'))){if(_0x4d806a[_0xbd9c('0x6e')]>0x0){_0x4d806a[_0xbd9c('0x6e')]-=0x1;}else{logger[_0xbd9c('0x97')](_0xbd9c('0xcd'));}}}else{logger[_0xbd9c('0x97')](_0xbd9c('0xce'));}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xcf')]=function(_0x121172,_0x51be63){var _0x71ccda=this;return function(_0x26f1fa){_0x71ccda[_0xbd9c('0xb7')](_0x51be63);logger[_0xbd9c('0x97')](_0x121172,util[_0xbd9c('0x98')](_0x26f1fa,{'showHidden':![],'depth':null}));};};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xd0')]=function(_0x4211d3,_0x5780b6,_0x48000d){var _0x18a52d={'state':0x19,'statedesc':_0xbd9c('0xd1')};this[_0xbd9c('0xb7')](_0x5780b6);this['saveInDb'](_[_0xbd9c('0xd2')](_0x18a52d,_[_0xbd9c('0xd3')](_0x48000d,[_0xbd9c('0xd4'),_0xbd9c('0xd5'),_0xbd9c('0xd6'),_0xbd9c('0xd7'),_0xbd9c('0xd8')])),_0xbd9c('0xd9'),_0xbd9c('0xda'));logger[_0xbd9c('0x97')](_0x4211d3);};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xdb')]=function(_0x2087fa){return _0x2087fa===_0xbd9c('0xdc');};Dialer[_0xbd9c('0xaf')]['isTrunkReachable']=function(_0x53548d){return!_[_0xbd9c('0x85')](_0x53548d)&&_0x53548d&&!_[_0xbd9c('0x85')](_0x53548d[_0xbd9c('0x3d')])&&!_['isUndefined'](_0x53548d['active'])&&_0x53548d[_0xbd9c('0xdd')]&&(this['trunks'][util[_0xbd9c('0x75')](_0xbd9c('0xde'),_0x53548d[_0xbd9c('0x3d')])][_0xbd9c('0xb4')]==='reachable'||this[_0xbd9c('0x21')][util['format']('SIP/%s',_0x53548d['name'])][_0xbd9c('0xb4')]===_0xbd9c('0xdf'));};Dialer['prototype'][_0xbd9c('0xe0')]=function(_0x5a407b,_0x3ee4c4,_0x47516b){this[_0xbd9c('0xcb')](_0x5a407b)[_0xbd9c('0xb5')](loggerCatch(_0x3ee4c4));this[_0xbd9c('0xc9')](_0x5a407b)[_0xbd9c('0xb5')](loggerCatch(_0x47516b));};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x35')]=function(_0x14a014){var _0x3e0e6b=this[_0xbd9c('0x25')][_0x14a014[_0xbd9c('0xe1')]];var _0x4a612f;if(!_[_0xbd9c('0xe2')](_0x14a014)&&!_[_0xbd9c('0xe2')](_0x14a014[_0xbd9c('0xe3')])&&!_[_0xbd9c('0xe2')](_0x14a014[_0xbd9c('0xe3')][_0xbd9c('0xe4')])&&_0x14a014[_0xbd9c('0xe5')]===_0xbd9c('0xe6')&&_0x3e0e6b){if(_0x3e0e6b[_0xbd9c('0x52')]!==_0xbd9c('0x77')&&this[_0xbd9c('0x1f')][_0x3e0e6b[_0xbd9c('0xb8')]][_0xbd9c('0xe7')]&&_0x14a014['value']==='HANGUP'){delete this[_0xbd9c('0x25')][_0x14a014[_0xbd9c('0xe1')]];this['updateOriginated'](this[_0xbd9c('0x1f')][_0x3e0e6b['queue']]);this['voiceQueues'][_0x3e0e6b[_0xbd9c('0xb8')]][_0xbd9c('0xe8')]+=0x1;this[_0xbd9c('0x1f')][_0x3e0e6b['queue']][_0xbd9c('0x5b')]+=0x1;_0x4a612f=new Hangup(_0x3e0e6b,_0x14a014);_0x4a612f[_0xbd9c('0xab')]=0x12;_0x4a612f['statedesc']=_0xbd9c('0xe9');_0x4a612f[_0xbd9c('0xea')]='AMD';this['saveInDb'](_0x4a612f,_0xbd9c('0xeb'),_0xbd9c('0xec'));}if(_0x3e0e6b[_0xbd9c('0x52')]!==_0xbd9c('0x77')&&this[_0xbd9c('0x1f')][_0x3e0e6b['queue']][_0xbd9c('0xe7')]&&_0x14a014[_0xbd9c('0xed')]===_0xbd9c('0xee')){delete this[_0xbd9c('0x25')][_0x14a014[_0xbd9c('0xe1')]];this[_0xbd9c('0xb7')](this[_0xbd9c('0x1f')][_0x3e0e6b[_0xbd9c('0xb8')]]);this[_0xbd9c('0x1f')][_0x3e0e6b['queue']][_0xbd9c('0xe8')]+=0x1;this[_0xbd9c('0x1f')][_0x3e0e6b[_0xbd9c('0xb8')]][_0xbd9c('0x5b')]+=0x1;_0x4a612f=new Hangup(_0x3e0e6b,_0x14a014);_0x4a612f['state']=0x13;_0x4a612f[_0xbd9c('0xac')]=_0xbd9c('0xef');_0x4a612f[_0xbd9c('0xea')]=_0xbd9c('0xf0');_0x4a612f[_0xbd9c('0xf1')]=!![];this['saveInDb'](_0x4a612f,_0xbd9c('0xf2'),_0xbd9c('0xf3'));}if(_0x3e0e6b[_0xbd9c('0x52')]===_0xbd9c('0x77')&&this[_0xbd9c('0x20')][_0x3e0e6b[_0xbd9c('0xb8')]][_0xbd9c('0xe7')]&&_0x14a014[_0xbd9c('0xed')]===_0xbd9c('0xf4')){delete this[_0xbd9c('0x25')][_0x14a014[_0xbd9c('0xe1')]];this[_0xbd9c('0xb7')](this[_0xbd9c('0x20')][_0x3e0e6b[_0xbd9c('0xb8')]]);_0x4a612f=new Hangup(_0x3e0e6b,_0x14a014);_0x4a612f['state']=0x12;_0x4a612f[_0xbd9c('0xac')]='HangupInAMD';_0x4a612f[_0xbd9c('0xea')]=_0xbd9c('0xf0');this['saveInDb'](_0x4a612f,'[syncHangupInAMDIvr][createHistory]',_0xbd9c('0xf5'));}if(_0x3e0e6b[_0xbd9c('0x52')]===_0xbd9c('0x77')&&this[_0xbd9c('0x20')][_0x3e0e6b[_0xbd9c('0xb8')]][_0xbd9c('0xe7')]&&_0x14a014[_0xbd9c('0xed')]==='MACHINE'){delete this['uniqueId'][_0x14a014['uniqueid']];this['updateOriginated'](this['campaigns'][_0x3e0e6b[_0xbd9c('0xb8')]]);_0x4a612f=new Hangup(_0x3e0e6b,_0x14a014);_0x4a612f['state']=0x13;_0x4a612f[_0xbd9c('0xac')]=_0xbd9c('0xef');_0x4a612f['membername']=_0xbd9c('0xf0');_0x4a612f[_0xbd9c('0xf1')]=!![];this[_0xbd9c('0xe0')](_0x4a612f,_0xbd9c('0xf6'),'[syncMachineIvr]');}}};Dialer[_0xbd9c('0xaf')]['syncHangup']=function(_0x5aa238){var _0x484cc1=this[_0xbd9c('0x25')][_0x5aa238[_0xbd9c('0xe1')]];var _0x47e046=this;var _0x1cf083;if(_0x484cc1&&_0x484cc1['type']===_0xbd9c('0x77')){delete this[_0xbd9c('0x25')][_0x5aa238[_0xbd9c('0xe1')]];this[_0xbd9c('0xb7')](this[_0xbd9c('0x20')][_0x484cc1[_0xbd9c('0xb8')]]);this[_0xbd9c('0x20')][_0x484cc1[_0xbd9c('0xb8')]]['ivrAnswerCallsDay']+=0x1;_0x1cf083=new Hangup(_0x484cc1,_0x5aa238);this[_0xbd9c('0xcb')](_0x1cf083)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0xf7')));this['moveContactManagedDialer'](_0x1cf083)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0xf8')));}if(_0x484cc1&&_0x484cc1[_0xbd9c('0x52')]!==_0xbd9c('0x77')&&isNotNull(this['voiceQueues'][_0x484cc1[_0xbd9c('0xb8')]][_0xbd9c('0xf9')])){delete this['uniqueId'][_0x5aa238[_0xbd9c('0xe1')]];this[_0xbd9c('0xb7')](this[_0xbd9c('0x1f')][_0x484cc1[_0xbd9c('0xb8')]]);this[_0xbd9c('0x1f')][_0x484cc1[_0xbd9c('0xb8')]][_0xbd9c('0xe8')]+=0x1;this['voiceQueues'][_0x484cc1[_0xbd9c('0xb8')]][_0xbd9c('0x5b')]+=0x1;_0x1cf083=new Hangup(_0x484cc1,_0x5aa238);_0x1cf083[_0xbd9c('0xab')]=0x10;_0x1cf083[_0xbd9c('0xac')]='AnswerAGI';_0x1cf083[_0xbd9c('0xea')]='AGI';this[_0xbd9c('0xcb')](_0x1cf083)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0xf7')));this[_0xbd9c('0xc9')](_0x1cf083)['catch'](loggerCatch(_0xbd9c('0xf8')));}if(_0x484cc1&&_0x484cc1['type']!==_0xbd9c('0x77')&&!isNotNull(this[_0xbd9c('0x1f')][_0x484cc1['queue']][_0xbd9c('0xf9')])){delete this[_0xbd9c('0x25')][_0x5aa238[_0xbd9c('0xe1')]];this[_0xbd9c('0xb7')](this['voiceQueues'][_0x484cc1['queue']]);this['voiceQueues'][_0x484cc1[_0xbd9c('0xb8')]][_0xbd9c('0x65')]+=0x1;_0x1cf083=new Hangup(_0x484cc1,_0x5aa238);_0x1cf083['state']=0xc;_0x1cf083[_0xbd9c('0xac')]=_0x5aa238[_0xbd9c('0xfa')];_0x1cf083['membername']=_0xbd9c('0xfb');this[_0xbd9c('0xcb')](_0x1cf083)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x1cf083)[_0xbd9c('0xb5')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x2f')]=function(_0x44e602){var _0x4f4d8d=this[_0xbd9c('0x25')][_0x44e602[_0xbd9c('0xe1')]];var _0x2c7cd5=this;if(this[_0xbd9c('0x1f')][_0x44e602[_0xbd9c('0xb8')]]){if(_0x4f4d8d&&_0x4f4d8d[_0xbd9c('0x52')]!==_0xbd9c('0x77')){delete this['uniqueId'][_0x44e602[_0xbd9c('0xe1')]];this[_0xbd9c('0x1f')][_0x44e602['queue']][_0xbd9c('0xe8')]+=0x1;var _0x3855e3=new AgentComplete(_0x4f4d8d,_0x44e602);if(_0x44e602[_0xbd9c('0xfc')]==='agent'){_0x3855e3[_0xbd9c('0xfd')]=this['voiceQueues'][_0x44e602['queue']][_0xbd9c('0xfe')]&&this[_0xbd9c('0x1f')][_0x44e602[_0xbd9c('0xb8')]][_0xbd9c('0xff')]?moment()[_0xbd9c('0x75')](_0xbd9c('0x100')):undefined;}this[_0xbd9c('0xcb')](_0x3855e3)[_0xbd9c('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xbd9c('0xc9')](_0x3855e3)['catch'](loggerCatch(_0xbd9c('0x101')));}}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x102')]=function(_0x542303){if(this[_0xbd9c('0x1f')][_0x542303[_0xbd9c('0xb8')]]){if(this[_0xbd9c('0x25')][_0x542303[_0xbd9c('0xe1')]]&&this[_0xbd9c('0x25')][_0x542303[_0xbd9c('0xe1')]][_0xbd9c('0x52')]!==_0xbd9c('0x77')){this[_0xbd9c('0xb7')](this[_0xbd9c('0x1f')][_0x542303[_0xbd9c('0xb8')]]);this['uniqueId'][_0x542303[_0xbd9c('0xe1')]][_0xbd9c('0x103')]=moment()[_0xbd9c('0x75')](_0xbd9c('0x100'));}}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x104')]=function(_0x14ce84){this[_0xbd9c('0xcb')](_0x14ce84)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x105')));this[_0xbd9c('0xc9')](_0x14ce84)['catch'](loggerCatch(_0xbd9c('0x106')));};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x2d')]=function(_0x553861){var _0xd3b55=this[_0xbd9c('0x25')][_0x553861[_0xbd9c('0xe1')]];var _0x5001f3=this;if(this[_0xbd9c('0x1f')][_0x553861['queue']]){if(_0xd3b55&&_0xd3b55[_0xbd9c('0x52')]!==_0xbd9c('0x77')){delete this['uniqueId'][_0x553861[_0xbd9c('0xe1')]];this[_0xbd9c('0xb7')](this[_0xbd9c('0x1f')][_0x553861['queue']]);_0xd3b55[_0xbd9c('0x107')]=moment()[_0xbd9c('0x75')]('YYYY-MM-DD\x20HH:mm:ss');var _0x57208a=new QueueCallerAbandon(_0xd3b55,_0x553861);if(getSeconds(_0xd3b55[_0xbd9c('0x107')],_0xd3b55['responsetime'])>=_0xd3b55[_0xbd9c('0x108')]){this[_0xbd9c('0x1f')][_0x553861[_0xbd9c('0xb8')]][_0xbd9c('0x68')]+=0x1;this[_0xbd9c('0x1f')][_0x553861['queue']][_0xbd9c('0x109')]+=0x1;this[_0xbd9c('0x1f')][_0x553861[_0xbd9c('0xb8')]][_0xbd9c('0x10a')]+=0x1;_0x57208a[_0xbd9c('0xab')]=0xa;_0x57208a[_0xbd9c('0xac')]=_0xbd9c('0x10b');_0x57208a[_0xbd9c('0x10c')]='TIMEOUT';_0x57208a[_0xbd9c('0xfd')]=this[_0xbd9c('0x1f')][_0x553861[_0xbd9c('0xb8')]][_0xbd9c('0xfe')]?moment()[_0xbd9c('0x75')](_0xbd9c('0x100')):undefined;this[_0xbd9c('0x104')](_0x57208a);}else{this[_0xbd9c('0x1f')][_0x553861[_0xbd9c('0xb8')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xbd9c('0x1f')][_0x553861['queue']][_0xbd9c('0x60')]+=0x1;_0x57208a['state']=0xb;_0x57208a[_0xbd9c('0xac')]='Abandoned';_0x57208a[_0xbd9c('0x10c')]='CALLEREXIT';this['queueCallerAbandonCreateState'](_0x57208a);}}}};Dialer[_0xbd9c('0xaf')]['syncNewExten']=function(_0x382a2c){if(this[_0xbd9c('0x24')][_0x382a2c[_0xbd9c('0xe1')]]){this['actions'][_0x382a2c[_0xbd9c('0xe1')]][_0xbd9c('0x10d')]=_0x382a2c[_0xbd9c('0x10d')];}if(this[_0xbd9c('0x25')][_0x382a2c[_0xbd9c('0xe1')]]){this[_0xbd9c('0x25')][_0x382a2c[_0xbd9c('0xe1')]][_0xbd9c('0x10d')]=_0x382a2c[_0xbd9c('0x10d')];}};Dialer['prototype']['syncQueueMember']=function(_0x1f54c1){if(strategy[this['voiceQueues'][this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]]['strategy']]===_0xbd9c('0x10f')){if(this[_0xbd9c('0x24')][_0x1f54c1['actionid']]&&_[_0xbd9c('0xe2')](this['actions'][_0x1f54c1[_0xbd9c('0x10e')]][_0xbd9c('0x110')])&&_0x1f54c1[_0xbd9c('0xb4')]==='1'&&_0x1f54c1[_0xbd9c('0x111')]==='0'){if(this[_0xbd9c('0x112')][_0x1f54c1[_0xbd9c('0x113')]]){if(!this[_0xbd9c('0x112')][_0x1f54c1[_0xbd9c('0x113')]]['locked']){this['agents'][_0x1f54c1[_0xbd9c('0x113')]]['locked']=!![];this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]][_0xbd9c('0x110')]=!![];this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]]['stateinterface']=_0x1f54c1['stateinterface'];}}}}else if((strategy[this[_0xbd9c('0x1f')][this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]][_0xbd9c('0x4c')]]||_0xbd9c('0x19'))===_0xbd9c('0x19')){if(this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]]){if(this[_0xbd9c('0x112')][_0x1f54c1[_0xbd9c('0x113')]]){this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]][_0xbd9c('0x113')]=_0x1f54c1[_0xbd9c('0x113')];if(_['isNil'](this[_0xbd9c('0x28')][this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]]['queue']])){this[_0xbd9c('0x28')][this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]]=[];}this[_0xbd9c('0x28')][this[_0xbd9c('0x24')][_0x1f54c1[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]][_0xbd9c('0x114')](_[_0xbd9c('0xd2')](_[_0xbd9c('0xd3')](this[_0xbd9c('0x24')][_0x1f54c1['actionid']],[_0xbd9c('0x115'),_0xbd9c('0x113')]),{'status':_0x1f54c1[_0xbd9c('0xb4')],'paused':_0x1f54c1[_0xbd9c('0x111')]}));}}}};function unlockQueueStatus(_0x5ed2d3,_0x330d64){setTimeout(function(){if(_[_0xbd9c('0x85')](_0x5ed2d3[_0xbd9c('0x116')])){loggerBooked[_0xbd9c('0x97')](_0xbd9c('0x117'),_0x330d64);}_0x5ed2d3[_0xbd9c('0x116')]=!![];loggerBooked[_0xbd9c('0x7a')](_0xbd9c('0x118'),_0x330d64,JSON['stringify'](_[_0xbd9c('0xd3')](_0x5ed2d3,[_0xbd9c('0x3d'),_0xbd9c('0x116')])));},0x1f3);}Dialer['prototype'][_0xbd9c('0x39')]=function(_0x45b05b){var _0x46c4a5=this;var _0x22b532=_0x46c4a5[_0xbd9c('0x1f')][_0x46c4a5[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]];if(strategy[this['voiceQueues'][this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]]['strategy']]===_0xbd9c('0x10f')){if(this['actions'][_0x45b05b[_0xbd9c('0x10e')]]&&this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0x113')]){this[_0xbd9c('0x1e')]['run'](this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0x115')],this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0x113')])['catch'](function(_0x7a24ef){logger[_0xbd9c('0x97')](_0xbd9c('0x119'),util[_0xbd9c('0x98')](_0x7a24ef,{'showHidden':![],'depth':null}));})[_0xbd9c('0x1c')](function(){_0x46c4a5[_0xbd9c('0xb7')](_0x46c4a5[_0xbd9c('0x1f')][_0x46c4a5[_0xbd9c('0x24')][_0x45b05b['actionid']]['queue']]);_0x46c4a5['agents'][_0x46c4a5[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0x113')]][_0xbd9c('0x110')]=![];delete _0x46c4a5['actions'][_0x45b05b[_0xbd9c('0x10e')]];unlockQueueStatus(_0x22b532);});}else{this[_0xbd9c('0xb7')](this[_0xbd9c('0x1f')][this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xd4')],'ListId':this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xd5')],'VoiceQueueId':this['actions'][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xd7')]||undefined,'CampaignId':this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xd8')]||undefined})[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x11a')));delete this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]];unlockQueueStatus(_0x22b532);}}else if((strategy[this[_0xbd9c('0x1f')][this[_0xbd9c('0x24')][_0x45b05b['actionid']][_0xbd9c('0xb8')]][_0xbd9c('0x4c')]]||_0xbd9c('0x19'))===_0xbd9c('0x19')){var _0x21f7d6;if(this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]]&&!_[_0xbd9c('0x45')](this['queueBooked'][this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]])){if(this[_0xbd9c('0x29')][_0x46c4a5[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]]['queue']]){this[_0xbd9c('0x29')][_0x46c4a5[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]]=this[_0xbd9c('0x29')][this['actions'][_0x45b05b[_0xbd9c('0x10e')]]['queue']]?this[_0xbd9c('0x29')][this['actions'][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]]:this[_0xbd9c('0x28')][this['actions'][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]]?this[_0xbd9c('0x28')][this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]][_0xbd9c('0xb8')]][_0xbd9c('0x11b')]||0x0:0x0;}this['queueBooked'][this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]]['queue']][_0xbd9c('0x11b')]=this[_0xbd9c('0x29')][this[_0xbd9c('0x24')][_0x45b05b[_0xbd9c('0x10e')]]['queue']];for(var _0x2c4d7c=0x0;_0x2c4d7c=0x0?!![]:![];})[_0xbd9c('0xb5')](myreject(_0x55eaa1)));}}else{_0x343462['push'](ami[_0xbd9c('0xb3')]({'action':_0xbd9c('0x12f'),'command':util[_0xbd9c('0x75')](_0xbd9c('0x130'),_0x1f59a3,!_['isUndefined'](config['timezones'][_0xd4409])?_0xd4409:'')})['then'](function(_0xb3915a){return _0xb3915a[_0xbd9c('0x134')][_0xbd9c('0x132')]('true')>=0x0?!![]:![];})[_0xbd9c('0xb5')](myreject(_0x55eaa1)));}BPromise[_0xbd9c('0x135')](_0x343462)[_0xbd9c('0xbe')](function(_0x3642b5){var _0x10feb5=_['some'](_0x3642b5);if(_0x10feb5){return _0x288cd4(_0x10feb5);}else{_0x5c9638['message']=_0x420c8b?_0xbd9c('0x136'):'INTERVAL_IS_OVERTIME';return _0x55eaa1(msgResponse('[ifTime][promiseAll]',_0xbd9c('0x12c'),_0xbd9c('0x137')+_0x420c8b+'\x20'+_0xeaed2c+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x1f59a3,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xd4409));}})[_0xbd9c('0xb5')](function(_0x8cb805){return _0x55eaa1(msgResponse(_0xbd9c('0x126'),_0xbd9c('0x12c'),JSON[_0xbd9c('0x48')](_0x8cb805)));});});};Dialer['prototype'][_0xbd9c('0x138')]=function(_0x44626d){var _0x202680=this;return function(){switch(_0x44626d[_0xbd9c('0x57')]){case'progressive':freeVariablesPredictive(_0x44626d);_0x202680[_0xbd9c('0x139')](_0x44626d,0x1);break;case'power':freeVariablesPredictive(_0x44626d);_0x202680[_0xbd9c('0x139')](_0x44626d,_0x44626d[_0xbd9c('0x13a')]);break;case _0xbd9c('0xb'):_0x202680[_0xbd9c('0xb')](_0x44626d);break;case _0xbd9c('0xa'):freeVariablesPredictive(_0x44626d);_0x202680[_0xbd9c('0x139')](_0x44626d,0x1);break;default:freeVariablesPredictive(_0x44626d);logger[_0xbd9c('0x97')](_0xbd9c('0x13b'),_0x44626d[_0xbd9c('0x3d')],_0xbd9c('0x13c'));}};};Dialer['prototype'][_0xbd9c('0x13d')]=function(_0x41a656){var _0xa826f5=this;return function(){_0xa826f5['handleIvr'](_0x41a656);};};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xc')]=function(_0x43a1b8){var _0x25f2e7=this;if(isNotPreview(_0x43a1b8[_0xbd9c('0x57')])){if(isVoiceQueueOutbound(_0x43a1b8['type'])&&isActive(_0x43a1b8[_0xbd9c('0x56')])){_0x43a1b8[_0xbd9c('0xa4')]=!![];BPromise[_0xbd9c('0xbc')]()[_0xbd9c('0xbe')](checkIsLoggedIn(_0x43a1b8,_0x43a1b8[_0xbd9c('0x4e')]))['then'](checkIsActive(_0x43a1b8,_0x43a1b8['dialActive']))[_0xbd9c('0xbe')](checkInterval(_0x43a1b8))[_0xbd9c('0xbe')](_0x25f2e7[_0xbd9c('0x13e')](_0x43a1b8))['then'](_0x25f2e7[_0xbd9c('0x125')](_0x43a1b8[_0xbd9c('0x13f')],_0x43a1b8[_0xbd9c('0x140')],_0x43a1b8['name'],_0x43a1b8))[_0xbd9c('0xbe')](_0x25f2e7[_0xbd9c('0x127')](_0x43a1b8[_0xbd9c('0x41')],_0x43a1b8['dialTimezone'],_0x43a1b8[_0xbd9c('0x3d')],_0x43a1b8))['then'](_0x25f2e7[_0xbd9c('0x138')](_0x43a1b8))[_0xbd9c('0xb5')](loggerCatchQueueSummary(_0xbd9c('0x141'),_0x43a1b8));}else{notSendMessagesQueue(_0x43a1b8);}}else{freeVariablesPredictive(_0x43a1b8);}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x142')]=function(){var _0x4ddf62=this;var _0xea035a;for(var _0x5e8230 in this['campaigns']){if(this['campaigns']['hasOwnProperty'](_0x5e8230)){_0xea035a=this['campaigns'][_0x5e8230];if(isCampaignIvr(_0xea035a[_0xbd9c('0x52')])&&isActive(_0xea035a[_0xbd9c('0xdd')])){_0xea035a[_0xbd9c('0xa4')]=!![];BPromise[_0xbd9c('0xbc')]()['then'](checkIsActive(_0xea035a,_0xea035a['active']))['then'](checkInterval(_0xea035a))[_0xbd9c('0xbe')](_0x4ddf62[_0xbd9c('0x13e')](_0xea035a))['then'](_0x4ddf62[_0xbd9c('0x125')](_0xea035a[_0xbd9c('0x13f')],_0xea035a[_0xbd9c('0x140')],_0xea035a[_0xbd9c('0x3d')],_0xea035a))[_0xbd9c('0xbe')](_0x4ddf62[_0xbd9c('0x127')](_0xea035a['Interval'],_0xea035a[_0xbd9c('0x140')],_0xea035a[_0xbd9c('0x3d')],_0xea035a))['then'](_0x4ddf62[_0xbd9c('0x13d')](_0xea035a))[_0xbd9c('0xb5')](loggerCatchQueueSummary(_0xbd9c('0x143'),_0xea035a));}else{notSendMessagesCampaign(_0xea035a);}}}};function getCallerIdRandom(_0x3fac8e,_0xfe08bd){var _0x1dd7a6,_0x406271,_0x1b9e53;if(_0xfe08bd<=0x0){_0xfe08bd=0x1;}_0x1dd7a6=new RegExp(_0xbd9c('0x144')+_0xfe08bd+'}$');_0x406271=Math[_0xbd9c('0x145')](0xa,_0xfe08bd-0x1);_0x1b9e53=Math['pow'](0xa,_0xfe08bd)-0x1;return util['format']('%s',_[_0xbd9c('0x146')](_0x3fac8e,_0x1dd7a6,_['random'](_0x406271,_0x1b9e53)));}function extractCalleridName(_0x1be56d){var _0x55f0e7=_0x1be56d[_0xbd9c('0x147')](/"(.*?)"/);return _0x55f0e7?_0x55f0e7[0x1]:_0x1be56d;}function extractCalleridNumber(_0x1734a5){var _0x430de8=_0x1734a5[_0xbd9c('0x147')](/<(.*?)>/);return _0x430de8?_0x430de8[0x1]:_0x1734a5;}Dialer[_0xbd9c('0xaf')][_0xbd9c('0x148')]=function(_0x5b297f,_0x2be024){var _0x255ae4=this;var _0xbfb2ca=uuid['v4']();this['actions'][_0xbfb2ca]=new Action(_0x5b297f,_0x2be024,_0xbfb2ca);return new BPromise(function(_0x36d2ec,_0x2182be){if(_['isUndefined'](_0x5b297f)&&_0xbd9c('0x149')!==typeof _0x5b297f){return _0x2182be(msgResponse(_0xbd9c('0x14a'),'Failure',_0xbd9c('0x14b')));}if(_['isUndefined'](_0x2be024[_0xbd9c('0x14c')][_0xbd9c('0x14d')])||_0x2be024[_0xbd9c('0x14c')][_0xbd9c('0x14d')]===null){return _0x2182be(msgResponse(_0xbd9c('0x14a'),'Failure',_0xbd9c('0x14e')));}var _0x5469f0={'XMD-CALLERID':_0x255ae4[_0xbd9c('0x24')][_0xbfb2ca]['getCaller'](),'XMD-AGI':_0x5b297f[_0xbd9c('0xf9')]?util['format'](_0xbd9c('0x14f'),ipAgi,_0x5b297f[_0xbd9c('0xf9')]):_0xbd9c('0x150'),'XMD-AGIAFTER':_0x5b297f[_0xbd9c('0xfe')]?util[_0xbd9c('0x75')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5b297f[_0xbd9c('0xfe')]):'NONE','XMD-QUEUE':_0x5b297f['type']===_0xbd9c('0x151')?util[_0xbd9c('0x75')]('\x22%s,%s%s,,,%s\x22',_0x5b297f[_0xbd9c('0x3d')],_0x5b297f[_0xbd9c('0x152')]||'',_0x5b297f[_0xbd9c('0xff')]?'c':'',_0x5b297f['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x2be024[_0xbd9c('0xd4')],'XMD-CDRTYPE':_0xbd9c('0x9'),'CALLERID(all)':_0x255ae4[_0xbd9c('0x24')][_0xbfb2ca][_0xbd9c('0x153')](),'XMD-AMD':_0x5b297f[_0xbd9c('0xe7')]?_0xbd9c('0x154'):_0xbd9c('0x150'),'XMD-DESTINATION':_0xbd9c('0xe6')};if(_0x5b297f[_0xbd9c('0xe7')]){_0x5469f0['XMD-AMDINITIALSILENCE']=_0x5b297f[_0xbd9c('0x155')]||0x9c4;_0x5469f0[_0xbd9c('0x156')]=_0x5b297f['dialAMDGreeting']||0x5dc;_0x5469f0['XMD-AMDAFTERGREETINGSILENCE']=_0x5b297f[_0xbd9c('0x157')]||0x320;_0x5469f0['XMD-AMDTOTALANALYSISTIME']=_0x5b297f[_0xbd9c('0x158')]||0x1388;_0x5469f0[_0xbd9c('0x159')]=_0x5b297f[_0xbd9c('0x15a')]||0x64;_0x5469f0[_0xbd9c('0x15b')]=_0x5b297f[_0xbd9c('0x15c')]||0x32;_0x5469f0[_0xbd9c('0x15d')]=_0x5b297f['dialAMDMaximumNumberOfWords']||0x3;_0x5469f0[_0xbd9c('0x15e')]=_0x5b297f[_0xbd9c('0x15f')]||0x100;_0x5469f0[_0xbd9c('0x160')]=_0x5b297f[_0xbd9c('0x161')]||0x1388;}if(_0x5b297f['type']===_0xbd9c('0x151')){_0x5469f0[_0xbd9c('0x162')]=_0x2be024[_0xbd9c('0xd7')];}else{_0x5469f0[_0xbd9c('0x163')]=_0x2be024['CampaignId'];}for(var _0x49d39f in _0x2be024[_0xbd9c('0x14c')]){if(_0x2be024[_0xbd9c('0x14c')][_0xbd9c('0x9b')](_0x49d39f)){if(isNotNull(_0x2be024[_0xbd9c('0x14c')][_0x49d39f])&&_0x49d39f!=='id'&&_0x49d39f!==_0xbd9c('0x164')&&_0x49d39f!==_0xbd9c('0x165')&&_0x49d39f!=='updatedAt'){_0x5469f0[util[_0xbd9c('0x75')](_0xbd9c('0x166'),_0xbd9c('0x167'),_['toUpper'](_0x49d39f))]=_0x2be024[_0xbd9c('0x14c')][_0x49d39f];}}}var _0x540828=_0x255ae4[_0xbd9c('0x122')](_0x5b297f[_0xbd9c('0x73')])?getCallerId(_0x5b297f[_0xbd9c('0x73')][_0xbd9c('0x74')],_0x5b297f[_0xbd9c('0x58')],_0x5b297f['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5b297f['dialOriginateCallerIdNumber'],_0x5b297f['dialRandomLastDigitCallerIdNumber']):_0x5b297f[_0xbd9c('0x168')]):getCallerId(_[_0xbd9c('0xe2')](_0x5b297f[_0xbd9c('0x123')])?_0x5b297f[_0xbd9c('0x73')][_0xbd9c('0x74')]:_0x5b297f['TrunkBackup']['callerid'],_0x5b297f[_0xbd9c('0x58')],_0x5b297f[_0xbd9c('0x169')]>0x0?getCallerIdRandom(_0x5b297f[_0xbd9c('0x168')],_0x5b297f['dialRandomLastDigitCallerIdNumber']):_0x5b297f[_0xbd9c('0x168')]);if(_0x540828){_0x5469f0[_0xbd9c('0x16a')]=_0x255ae4[_0xbd9c('0x24')][_0xbfb2ca][_0xbd9c('0x16b')]=extractCalleridName(_0x540828);_0x5469f0[_0xbd9c('0x16c')]=_0x255ae4[_0xbd9c('0x24')][_0xbfb2ca][_0xbd9c('0x16d')]=extractCalleridNumber(_0x540828);}return ami['Action']({'actionid':_0xbfb2ca,'action':_0xbd9c('0x14a'),'channel':_0x255ae4[_0xbd9c('0x122')](_0x5b297f['Trunk'])?util['format'](_0xbd9c('0x16e'),_0x5b297f[_0xbd9c('0x73')][_0xbd9c('0x3d')],isNotNull(_0x5b297f[_0xbd9c('0x5a')])?_0x5b297f['dialPrefix']['trim']()||'':'',_0x5b297f[_0xbd9c('0x16f')]>0x0?_0x2be024['Contact'][_0xbd9c('0x14d')]['substring'](_0x5b297f[_0xbd9c('0x16f')]):_0x2be024[_0xbd9c('0x14c')][_0xbd9c('0x14d')]):util[_0xbd9c('0x75')](_0xbd9c('0x16e'),_[_0xbd9c('0xe2')](_0x5b297f[_0xbd9c('0x123')])?_0x5b297f[_0xbd9c('0x73')][_0xbd9c('0x3d')]:_0x5b297f['TrunkBackup'][_0xbd9c('0x3d')],isNotNull(_0x5b297f[_0xbd9c('0x5a')])?_0x5b297f[_0xbd9c('0x5a')][_0xbd9c('0x170')]()||'':'',_0x5b297f['dialCutDigit']>0x0?_0x2be024[_0xbd9c('0x14c')][_0xbd9c('0x14d')]['substring'](_0x5b297f[_0xbd9c('0x16f')]):_0x2be024['Contact'][_0xbd9c('0x14d')]),'callerid':_0x540828,'Exten':_0xbd9c('0xe6'),'Context':_0xbd9c('0x171'),'Priority':'1','variable':_0x5469f0,'timeout':(_0x5b297f[_0xbd9c('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0xbfb2ca})[_0xbd9c('0xbe')](function(_0x1a1fe2){return _0x36d2ec(_0x1a1fe2);})[_0xbd9c('0xb5')](function(_0x2a06ee){_0x5b297f[_0xbd9c('0x63')]+=0x1;var _0xe2aef5=new History(_0x255ae4[_0xbd9c('0x24')][_0xbfb2ca]);logger['error'](util[_0xbd9c('0x75')]('[originateError]:\x20%s',JSON['stringify'](_0x2a06ee)));_0xe2aef5[_0xbd9c('0xab')]=0xe;_0xe2aef5[_0xbd9c('0xac')]=_0xbd9c('0x172');_0xe2aef5[_0xbd9c('0xae')]=moment()[_0xbd9c('0x75')](_0xbd9c('0x100'));_0xe2aef5[_0xbd9c('0xad')]=_0xe2aef5[_0xbd9c('0xae')];_0x255ae4[_0xbd9c('0xcb')](_0xe2aef5)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x173')));_0x255ae4[_0xbd9c('0xc9')](_0xe2aef5)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x173')))[_0xbd9c('0x1c')](function(){delete _0x255ae4[_0xbd9c('0x24')][_0xbfb2ca];return _0x2182be(msgResponse(_0xbd9c('0x14a'),_0xbd9c('0x47'),_0xbd9c('0x174')));});});});};Dialer['prototype'][_0xbd9c('0x175')]=function(_0x2c33a5){var _0x145783=this[_0xbd9c('0x24')][_0x2c33a5[_0xbd9c('0x10e')]];var _0x580870=this;if(_0x145783){delete this['actions'][_0x2c33a5['actionid']];_0x145783['responsetime']=moment()['format'](_0xbd9c('0x100'));var _0x4ffec6=_0x145783[_0xbd9c('0x52')]==='ivr'?this[_0xbd9c('0x20')][_0x145783[_0xbd9c('0xb8')]]:this['voiceQueues'][_0x145783[_0xbd9c('0x176')]()];if(!this[_0xbd9c('0xdb')](_0x2c33a5['response'])){this[_0xbd9c('0xb7')](_0x4ffec6);return this['callProgressDetecting'](_0x145783,_0x4ffec6,_0x2c33a5)['then'](function(_0x1ec0fa){})[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x177')));}else{this[_0xbd9c('0x25')][_0x2c33a5[_0xbd9c('0xe1')]]=_0x145783;}}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x178')]=function(_0x50c34f,_0x5d511a,_0x3733e8){var _0x4e9dc1=new History(_0x5d511a);if(_0x4e9dc1[_0xbd9c('0x179')]+_0x4e9dc1['countcongestionretry']+_0x4e9dc1[_0xbd9c('0x17a')]>=_0x3733e8[_0xbd9c('0x17b')]-0x1){return!![];}switch(_0x50c34f){case 0x3:if(_0x4e9dc1[_0xbd9c('0x17a')]>=_0x3733e8[_0xbd9c('0x17c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4e9dc1['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xbd9c('0x17d')](_0x3733e8[_0xbd9c('0x17e')],_0xbd9c('0x17f'))[_0xbd9c('0x75')](_0xbd9c('0x100')),'ContactId':_0x4e9dc1[_0xbd9c('0xd4')],'ListId':_0x4e9dc1['ListId'],'VoiceQueueId':_0x4e9dc1[_0xbd9c('0xd7')]||undefined,'CampaignId':_0x4e9dc1[_0xbd9c('0xd8')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x4e9dc1['countbusyretry']>=_0x3733e8['dialBusyMaxRetry']-0x1){return!![];}else{this[_0xbd9c('0xc4')]({'active':![],'countbusyretry':_0x4e9dc1[_0xbd9c('0x179')]+=0x1,'scheduledat':moment()[_0xbd9c('0x17d')](_0x3733e8[_0xbd9c('0x180')],_0xbd9c('0x17f'))[_0xbd9c('0x75')](_0xbd9c('0x100')),'ContactId':_0x4e9dc1[_0xbd9c('0xd4')],'ListId':_0x4e9dc1[_0xbd9c('0xd5')],'VoiceQueueId':_0x4e9dc1[_0xbd9c('0xd7')]||undefined,'CampaignId':_0x4e9dc1['CampaignId']||undefined})['catch'](loggerCatch(_0xbd9c('0x181')));}break;case 0x8:if(_0x4e9dc1[_0xbd9c('0x182')]>=_0x3733e8['dialCongestionMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x4e9dc1['countcongestionretry']+=0x1,'scheduledat':moment()[_0xbd9c('0x17d')](_0x3733e8[_0xbd9c('0x183')],_0xbd9c('0x17f'))[_0xbd9c('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e9dc1[_0xbd9c('0xd4')],'ListId':_0x4e9dc1[_0xbd9c('0xd5')],'VoiceQueueId':_0x4e9dc1['VoiceQueueId']||undefined,'CampaignId':_0x4e9dc1['CampaignId']||undefined})['catch'](loggerCatch(_0xbd9c('0x184')));}break;default:return!![];}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x185')]=function(_0x5084c2,_0x40045a,_0x44dee2){var _0x36a62c=this;var _0x9bd4db=new History(_0x5084c2);return new BPromise(function(_0x57a2a6,_0xc76360){if(_['isUndefined'](_0x40045a)&&_0xbd9c('0x149')!==typeof _0x40045a){return _0xc76360(msgResponse(_0xbd9c('0x186'),_0xbd9c('0x12c'),'entity\x20is\x20undefine'));}if(_[_0xbd9c('0x85')](_0x44dee2)&&_0xbd9c('0x149')!==typeof _0x44dee2){return _0xc76360(msgResponse(_0xbd9c('0x186'),_0xbd9c('0x12c'),_0xbd9c('0x187')));}switch(_0x44dee2[_0xbd9c('0xfc')]){case'0':_0x40045a[_0xbd9c('0x62')]+=0x1;_0x9bd4db[_0xbd9c('0xab')]=0x0;_0x9bd4db[_0xbd9c('0xac')]='NoSuchNumber';_0x36a62c[_0xbd9c('0xcb')](_0x9bd4db)[_0xbd9c('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x36a62c['checkRetriveMax'](0x0,_0x5084c2,_0x40045a)){if(_0x9bd4db[_0xbd9c('0x179')]+_0x9bd4db[_0xbd9c('0x182')]+_0x9bd4db[_0xbd9c('0x17a')]>=_0x40045a[_0xbd9c('0x17b')]){_0x36a62c[_0xbd9c('0x188')](_0x9bd4db,_0x57a2a6,_0xc76360,_0xbd9c('0x189'));}else{_0x36a62c[_0xbd9c('0x18a')](_0x9bd4db,_0x57a2a6,_0xc76360,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x40045a[_0xbd9c('0x61')]+=0x1;_0x9bd4db[_0xbd9c('0xab')]=0x3;_0x9bd4db[_0xbd9c('0xac')]=_0xbd9c('0x18b');_0x9bd4db[_0xbd9c('0x17a')]+=0x1;_0x9bd4db[_0xbd9c('0x18c')]+=0x1;_0x36a62c[_0xbd9c('0xcb')](_0x9bd4db)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x18d')));if(_0x36a62c[_0xbd9c('0x178')](0x3,_0x5084c2,_0x40045a)){if(_0x9bd4db[_0xbd9c('0x17a')]>=_0x40045a[_0xbd9c('0x17c')]){_0x36a62c[_0xbd9c('0x18a')](_0x9bd4db,_0x57a2a6,_0xc76360,_0xbd9c('0x18e'));}else{_0x36a62c['stateGlobal'](_0x9bd4db,_0x57a2a6,_0xc76360,_0xbd9c('0x18e'));}}break;case'5':_0x40045a['outboundBusyCallsDay']+=0x1;_0x9bd4db[_0xbd9c('0xab')]=0x5;_0x9bd4db[_0xbd9c('0xac')]=_0xbd9c('0x18f');_0x9bd4db[_0xbd9c('0x179')]+=0x1;_0x9bd4db['countglobal']+=0x1;_0x36a62c['createHistory'](_0x9bd4db)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x190')));if(_0x36a62c[_0xbd9c('0x178')](0x5,_0x5084c2,_0x40045a)){if(_0x9bd4db[_0xbd9c('0x179')]>=_0x40045a[_0xbd9c('0x191')]){_0x36a62c[_0xbd9c('0x18a')](_0x9bd4db,_0x57a2a6,_0xc76360,_0xbd9c('0x192'));}else{_0x36a62c['stateGlobal'](_0x9bd4db,_0x57a2a6,_0xc76360,_0xbd9c('0x192'));}}break;case'8':_0x40045a[_0xbd9c('0x5e')]+=0x1;_0x9bd4db[_0xbd9c('0xab')]=0x8;_0x9bd4db['statedesc']=_0xbd9c('0x193');_0x9bd4db[_0xbd9c('0x182')]+=0x1;_0x9bd4db[_0xbd9c('0x18c')]+=0x1;_0x36a62c[_0xbd9c('0xcb')](_0x9bd4db)[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x194')));if(_0x36a62c[_0xbd9c('0x178')](0x8,_0x5084c2,_0x40045a)){if(_0x9bd4db['countcongestionretry']>=_0x40045a[_0xbd9c('0x195')]){_0x36a62c[_0xbd9c('0x18a')](_0x9bd4db,_0x57a2a6,_0xc76360,_0xbd9c('0x196'));}else{_0x36a62c['stateGlobal'](_0x9bd4db,_0x57a2a6,_0xc76360,_0xbd9c('0x196'));}}break;default:_0x40045a[_0xbd9c('0x65')]+=0x1;_0x9bd4db['state']=0xc;_0x9bd4db[_0xbd9c('0xac')]=_0x44dee2[_0xbd9c('0xfc')];_0x36a62c[_0xbd9c('0xcb')](_0x9bd4db)['catch'](loggerCatch(_0xbd9c('0x197')));if(_0x36a62c[_0xbd9c('0x178')](_0x44dee2[_0xbd9c('0xfc')],_0x5084c2,_0x40045a)){if(_0x9bd4db[_0xbd9c('0x179')]+_0x9bd4db[_0xbd9c('0x182')]+_0x9bd4db[_0xbd9c('0x17a')]>=_0x40045a[_0xbd9c('0x17b')]){_0x36a62c[_0xbd9c('0x188')](_0x9bd4db,_0x57a2a6,_0xc76360,_0x44dee2[_0xbd9c('0xfc')]);}else{_0x36a62c[_0xbd9c('0x18a')](_0x9bd4db,_0x57a2a6,_0xc76360,_0x44dee2['reason']);}}}});};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x188')]=function(_0x356337,_0x2ca3cb,_0x44c965,_0x2e89f2){var _0x1dbac0=new Final(_0x356337);_0x1dbac0[_0xbd9c('0xab')]=0xf;_0x1dbac0[_0xbd9c('0xac')]=_0xbd9c('0x198');this['createStateFinal'](_0x1dbac0,_0x2ca3cb,_0x44c965,_0x2e89f2);};Dialer['prototype']['createStateFinal']=function(_0xc3d4b4,_0x28335a,_0x2e4ff2,_0x1adf17){this[_0xbd9c('0xc9')](_0xc3d4b4)[_0xbd9c('0xbe')](function(_0x1cb500){return _0x28335a(msgResponse(_0xbd9c('0x186'),_0xbd9c('0xdc'),_0x1adf17));})['catch'](function(_0x246851){return _0x2e4ff2(msgResponse('[moveContactManagedDialer][0]',_0xbd9c('0x12c'),_0xbd9c('0x199')));});};Dialer[_0xbd9c('0xaf')][_0xbd9c('0xb')]=function(_0x111e86){var _0x17913d=this;var _0x196b8a=_0x111e86[_0xbd9c('0x19a')]/0x64;var _0x49c9bc=_0x111e86[_0xbd9c('0x109')]/(_0x111e86[_0xbd9c('0x109')]+_0x111e86[_0xbd9c('0xe8')]);var _0x153f52=Math[_0xbd9c('0x19b')](_0x111e86['predictiveIntervalAvailable']*(_0x111e86[_0xbd9c('0x19c')]/0x64));var _0x4656b0=Math[_0xbd9c('0x19b')](_0x111e86[_0xbd9c('0x19d')]*(_0x111e86[_0xbd9c('0x19e')]/0x64));var _0x6ba7ef=_0x111e86[_0xbd9c('0x4d')]+_0x111e86[_0xbd9c('0xa5')];var _0x5d32d4=Math[_0xbd9c('0x19f')](_0x111e86[_0xbd9c('0x8b')]*_0x111e86['erlangAbandonmentRate']*_0x111e86[_0xbd9c('0x6a')]*_0x111e86[_0xbd9c('0x6b')]);if(_[_0xbd9c('0x85')](_0x111e86['startProgressive'])){if(!_[_0xbd9c('0x85')](_0x111e86[_0xbd9c('0x27')])){_0x111e86[_0xbd9c('0x27')]=undefined;loggerPredictive[_0xbd9c('0x97')]('[startMethodPredictive][StartProgressive]',_0xbd9c('0x1a0'));}if(!_[_0xbd9c('0x85')](_0x111e86[_0xbd9c('0x92')])){loggerPredictive[_0xbd9c('0x97')](_0xbd9c('0x1a1'),_0xbd9c('0x1a2'));clearInterval(_0x111e86[_0xbd9c('0x92')]);_0x111e86[_0xbd9c('0x92')]=undefined;}_0x111e86[_0xbd9c('0x72')]=moment()[_0xbd9c('0x75')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x111e86['name'],_0xbd9c('0x1a3'),_0x111e86[_0xbd9c('0x72')]);this[_0xbd9c('0x139')](_0x111e86,0x1);}else if(ifInterval(_0x111e86[_0xbd9c('0x1a4')],_0x111e86['startProgressive'])){this[_0xbd9c('0x139')](_0x111e86,0x1);loggerPredictiveCalls[_0xbd9c('0x7a')](_0xbd9c('0x1a5'),_0x111e86['startProgressive'],_0x111e86[_0xbd9c('0x3d')]);_0x111e86[_0xbd9c('0x8b')]=0x0;_0x111e86['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x196b8a<_0x49c9bc&&_0x111e86[_0xbd9c('0x1a6')]===_0xbd9c('0x1a7')){freeVariablesPredictive(_0x111e86);loggerPredictive['info'](_0xbd9c('0x1a8'),_0xbd9c('0x1a9'),_0x49c9bc,_0xbd9c('0x72'),_0x111e86[_0xbd9c('0x3d')]);}else if(_0x5d32d4<_0x111e86['predictiveIntervalErlangCallsDroppedCalls']&&_0x111e86['dialPredictiveOptimization']===_0xbd9c('0x1a7')){freeVariablesPredictive(_0x111e86);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x1aa'),_0xbd9c('0x1ab'),_0x5d32d4,'Drop\x20in\x20this\x20interval',_0x111e86['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x111e86['name']);}else if(!ifInterval(_0x111e86['dialPredictiveInterval'],_0x111e86[_0xbd9c('0x72')])&&_[_0xbd9c('0x85')](_0x111e86[_0xbd9c('0x27')])&&!_[_0xbd9c('0x85')](_0x111e86[_0xbd9c('0x72')])){_0x111e86['startPredictive']=moment()['format'](_0xbd9c('0x100'));loggerPredictive[_0xbd9c('0x7a')](_0x111e86[_0xbd9c('0x3d')],_0xbd9c('0x1ac'),_0x111e86[_0xbd9c('0x27')]);this[_0xbd9c('0xc1')](_0x111e86['dialPredictiveInterval'])[_0xbd9c('0xbe')](this['getDataPredictive'](_0x111e86))[_0xbd9c('0xbe')](mergeDataErlangB(_0x111e86))[_0xbd9c('0xbe')](this['startMethodPredictive'](_0x111e86))[_0xbd9c('0xb5')](loggerCatchPredictive(_0xbd9c('0x1ad'),_0x111e86));}else if(!ifInterval(_0x111e86['dialPredictiveInterval'],_0x111e86['startPredictive'])){_0x111e86[_0xbd9c('0x10a')]=0x0;_0x111e86[_0xbd9c('0x27')]=moment()['format'](_0xbd9c('0x100'));loggerPredictive[_0xbd9c('0x7a')](_0x111e86[_0xbd9c('0x3d')],_0xbd9c('0x1ae'),_0x111e86[_0xbd9c('0x27')]);clearInterval(_0x111e86[_0xbd9c('0x92')]);_0x111e86[_0xbd9c('0x92')]=undefined;this[_0xbd9c('0xc1')](_0x111e86[_0xbd9c('0x1a4')])['then'](this[_0xbd9c('0x1af')](_0x111e86))[_0xbd9c('0xbe')](mergeDataErlangB(_0x111e86))[_0xbd9c('0xbe')](this[_0xbd9c('0x1b0')](_0x111e86))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x111e86));}else if(_0x111e86[_0xbd9c('0x19d')]&&_0x6ba7ef<_0x111e86[_0xbd9c('0x19d')]-_0x4656b0){freeVariablesPredictive(_0x111e86);loggerPredictive[_0xbd9c('0x7a')](_0x111e86[_0xbd9c('0x3d')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x6ba7ef,_0xbd9c('0x1b1'),_0x111e86[_0xbd9c('0x19d')],'-',_0x4656b0,'=',_0x111e86[_0xbd9c('0x19d')]-_0x4656b0,')');}else if(_0x111e86[_0xbd9c('0x19d')]&&_0x6ba7ef>_0x111e86[_0xbd9c('0x19d')]+_0x153f52){freeVariablesPredictive(_0x111e86);loggerPredictive[_0xbd9c('0x7a')](_0x111e86[_0xbd9c('0x3d')],_0xbd9c('0x1b2'),_0x6ba7ef,_0xbd9c('0x1b3'),_0x111e86[_0xbd9c('0x19d')],'+',_0x153f52,'=',_0x111e86[_0xbd9c('0x19d')]+_0x153f52,')');}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x1af')]=function(_0x5f5b63){var _0x2be51b=this;return function(_0x1a4419){return new BPromise(function(_0x50085b,_0x2511a5){_[_0xbd9c('0xd2')](_0x5f5b63,_0x1a4419[0x0]);if(checkGetDataPredictive(_0x1a4419[0x0])){var _0x2b7cc4=_0x5f5b63[_0xbd9c('0x19d')]=_0x5f5b63[_0xbd9c('0xa5')]+_0x5f5b63[_0xbd9c('0x4d')];var _0x3abfbc=_0x5f5b63['dialPredictiveInterval']*0x3c;var _0x573153=_0x1a4419[0x0]['predictiveIntervalAvgTalktime']+_0x1a4419[0x0][_0xbd9c('0x82')];var _0x586523=(_0x1a4419[0x0][_0xbd9c('0x7e')]+_0x1a4419[0x0][_0xbd9c('0x68')]+_0x1a4419[0x0][_0xbd9c('0x67')])/_0x1a4419[0x0][_0xbd9c('0x6d')];_0x5f5b63[_0xbd9c('0x6a')]=_0x586523>0x0?_0x586523:0x1;switch(_0x5f5b63['dialPredictiveOptimization']){case _0xbd9c('0x1a7'):var _0x3ba2cd=_0x5f5b63[_0xbd9c('0x19a')]/0x64;return _0x2be51b[_0xbd9c('0x1b4')](_0x2b7cc4,_0x3abfbc,_0x573153,_0x586523,_0x3ba2cd)[_0xbd9c('0xbe')](function(_0x41ffa5){return _0x50085b(_0x41ffa5);});case _0xbd9c('0x1b5'):var _0x1a4906=_0x5f5b63[_0xbd9c('0x19a')]/0x64;return _0x2be51b[_0xbd9c('0x1b6')](_0x2b7cc4,_0x3abfbc,_0x573153,_0x586523,_0x1a4906)['then'](function(_0x5ca7df){return _0x50085b(_0x5ca7df);});default:return _0x2511a5(msgResponse(_0xbd9c('0x1b7'),_0xbd9c('0x12c'),_0xbd9c('0x1b8')));}}else{return _0x2511a5(msgResponse(_0xbd9c('0x1b7'),'Failure',_0xbd9c('0x1b9')));}});};};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x1ba')]=function(_0x256f7a){var _0x366f2c=this;return function(_0x3b3477){return new BPromise(function(_0xd1ee2c,_0x362ee1){_[_0xbd9c('0xd2')](_0x256f7a,_0x3b3477[0x0]);if(checkGetDataPredictive(_0x3b3477[0x0])){loggerPredictive[_0xbd9c('0x7a')](JSON[_0xbd9c('0x48')](_0x3b3477[0x0]));if(_0x256f7a['dialPredictiveOptimization']===_0xbd9c('0x1a7')){return _0x366f2c[_0xbd9c('0xc8')](_0x256f7a['id'])[_0xbd9c('0xbe')](function(_0x1593b2){var _0x3bd10a=_0x256f7a['loggedIn']-_0x1593b2[0x0][_0xbd9c('0x1bb')];var _0x31ee66=_0x256f7a['dialPredictiveInterval']*0x3c;var _0xee21da=_0x3b3477[0x0][_0xbd9c('0x66')]+_0x3b3477[0x0]['predictiveIntervalAvgHoldtime'];var _0x111525=(_0x3b3477[0x0][_0xbd9c('0x7e')]+_0x3b3477[0x0][_0xbd9c('0x68')]+_0x3b3477[0x0][_0xbd9c('0x67')])/_0x3b3477[0x0][_0xbd9c('0x6d')];var _0x41723b=_0x256f7a[_0xbd9c('0x19a')]/0x64;_0x256f7a[_0xbd9c('0x6c')]=_0x1593b2[0x0][_0xbd9c('0x1bb')]||0x0;_0x256f7a['predictiveIntervalHitRate']=_0x111525>0x0?_0x111525:0x1;return _0x366f2c[_0xbd9c('0x1b4')](_0x3bd10a,_0x31ee66,_0xee21da,_0x111525,_0x41723b);})[_0xbd9c('0xbe')](function(_0x30f65f){return _0xd1ee2c(_0x30f65f);})[_0xbd9c('0xb5')](function(_0x393a94){return _0x362ee1(msgResponse(_0xbd9c('0x1bc'),_0xbd9c('0x12c'),JSON[_0xbd9c('0x48')](_0x393a94)));});}if(_0x256f7a[_0xbd9c('0x1a6')]==='agentBusyFactor'){return _0x366f2c[_0xbd9c('0xc8')](_0x256f7a['id'])['then'](function(_0x4684b8){var _0x53fe74=_0x256f7a[_0xbd9c('0x4e')]-_0x4684b8[0x0][_0xbd9c('0x1bb')];var _0x4ca091=_0x256f7a[_0xbd9c('0x1a4')]*0x3c;var _0x3b9da9=_0x3b3477[0x0][_0xbd9c('0x66')]+_0x3b3477[0x0][_0xbd9c('0x82')];var _0x11cc67=(_0x3b3477[0x0]['predictiveIntervalAnsweredCalls']+_0x3b3477[0x0][_0xbd9c('0x68')]+_0x3b3477[0x0][_0xbd9c('0x67')])/_0x3b3477[0x0][_0xbd9c('0x6d')];var _0x1f424b=_0x256f7a[_0xbd9c('0x19a')]/0x64;_0x256f7a[_0xbd9c('0x6c')]=_0x4684b8[0x0]['outboundQueuePauses']||0x0;_0x256f7a[_0xbd9c('0x6a')]=_0x11cc67>0x0?_0x11cc67:0x1;return _0x366f2c[_0xbd9c('0x1b6')](_0x53fe74,_0x4ca091,_0x3b9da9,_0x11cc67,_0x1f424b);})['then'](function(_0x1a657c){return _0xd1ee2c(_0x1a657c);})['catch'](function(_0x271d85){return _0x362ee1(msgResponse(_0xbd9c('0x1bc'),_0xbd9c('0x12c'),JSON['stringify'](_0x271d85)));});}}else{return _0x362ee1(msgResponse(_0xbd9c('0x1b7'),_0xbd9c('0x12c'),'check\x20failure'));}});};};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x1b0')]=function(_0x3e5cc1){var _0x30a7d1=this;return function(){var _0xd52c2a=0x0;var _0x5da801=Math[_0xbd9c('0x19f')](_0x3e5cc1[_0xbd9c('0x6f')]*0x3e8);if(_0x5da801>0x0){_0x5da801=_0x5da801<0x64?0x64:_0x5da801;loggerPredictive['info'](_0x3e5cc1[_0xbd9c('0x3d')],_0xbd9c('0x1bd'),_0x5da801,'milliseconds');_0x3e5cc1['handlePredictive']=setInterval(function(){_0x30a7d1[_0xbd9c('0x92')](_0x3e5cc1);loggerPredictiveCalls[_0xbd9c('0x7a')]('[handlePredictive]',_0xd52c2a+=0x1);},_0x5da801);}else{loggerPredictive['info'](_0x3e5cc1[_0xbd9c('0x3d')],_0xbd9c('0x1be'));}};};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x1bf')]=function(_0x380e5c,_0x5c9cd9){var _0x224be1=this;return function(_0xec8c86){if(_[_0xbd9c('0x45')](_0xec8c86)){if(_[_0xbd9c('0xe2')](_0x5c9cd9[_0xbd9c('0xd6')])||!_0x5c9cd9['recallme']){if(_0x380e5c[_0xbd9c('0x57')]==='booked'){_0x380e5c[_0xbd9c('0x116')]=_[_0xbd9c('0x85')](_0x380e5c['queueStatusComplete'])?!![]:_0x380e5c[_0xbd9c('0x116')];var _0x48da7b=uuid['v4']();_0x224be1[_0xbd9c('0x24')][_0x48da7b]=new Action(_0x380e5c,_0x5c9cd9,_0x48da7b);loggerBooked['info'](_0xbd9c('0x1c0'),_0x48da7b,_0xbd9c('0x1c1'),JSON[_0xbd9c('0x48')](_0x380e5c['queueStatusComplete']),_0xbd9c('0x1c2'),_0x380e5c[_0xbd9c('0x3d')]);if(_0x380e5c[_0xbd9c('0x116')]){_0x380e5c[_0xbd9c('0x116')]=![];_0x224be1['queueBooked'][_0x224be1['actions'][_0x48da7b][_0xbd9c('0xb8')]]=[];ami[_0xbd9c('0xb3')]({'actionid':_0x48da7b,'action':_0xbd9c('0x1c3'),'queue':_0x380e5c[_0xbd9c('0x3d')]})[_0xbd9c('0xb5')](function(_0x145477){_0x224be1[_0xbd9c('0xb7')](_0x380e5c);_0x224be1[_0xbd9c('0xc4')]({'active':![],'ContactId':_0x224be1['actions'][_0x48da7b][_0xbd9c('0xd4')],'ListId':_0x224be1['actions'][_0x48da7b][_0xbd9c('0xd5')],'VoiceQueueId':_0x224be1[_0xbd9c('0x24')][_0x48da7b]['VoiceQueueId']||undefined,'CampaignId':_0x224be1[_0xbd9c('0x24')][_0x48da7b][_0xbd9c('0xd8')]||undefined})[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x1c4')));delete _0x224be1[_0xbd9c('0x24')][_0x48da7b];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xbd9c('0x48')](_0x380e5c[_0xbd9c('0x116')]),_0xbd9c('0x1c2'),_0x380e5c[_0xbd9c('0x3d')]);_0x224be1[_0xbd9c('0xb7')](_0x380e5c);_0x224be1['rescheduleContact']({'active':![],'ContactId':_0x224be1[_0xbd9c('0x24')][_0x48da7b][_0xbd9c('0xd4')],'ListId':_0x224be1[_0xbd9c('0x24')][_0x48da7b][_0xbd9c('0xd5')],'VoiceQueueId':_0x224be1[_0xbd9c('0x24')][_0x48da7b][_0xbd9c('0xd7')]||undefined,'CampaignId':_0x224be1[_0xbd9c('0x24')][_0x48da7b][_0xbd9c('0xd8')]||undefined})[_0xbd9c('0xb5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x224be1[_0xbd9c('0x24')][_0x48da7b];}}else{return _0x224be1['actionOriginate'](_0x380e5c,_0x5c9cd9);}}else{if(getDiff(_0x5c9cd9[_0xbd9c('0x1c5')])<_0x380e5c[_0xbd9c('0x1c6')]*0x3c){_0x224be1[_0xbd9c('0x1e')][_0xbd9c('0x120')](_0x5c9cd9['id'])['finally'](function(){_0x224be1[_0xbd9c('0xb7')](_0x380e5c);});}else{_0x380e5c[_0xbd9c('0x64')]+=0x1;_0x224be1[_0xbd9c('0xb7')](_0x380e5c);if(_0x380e5c['dialRecallInQueue']){_0x224be1['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c9cd9[_0xbd9c('0xd4')],'ListId':_0x5c9cd9[_0xbd9c('0xd5')],'VoiceQueueId':_0x5c9cd9[_0xbd9c('0xd7')]||undefined,'CampaignId':_0x5c9cd9[_0xbd9c('0xd8')]||undefined})[_0xbd9c('0xb5')](loggerCatch(_0xbd9c('0x1c7')));_0x224be1['createHistory'](createObjHistory(_0x380e5c,_0x5c9cd9,'RECALLINQUEUE',0x17,_0xbd9c('0x1c8')))['catch'](loggerCatch(_0xbd9c('0x1c9')));}else{_0x224be1[_0xbd9c('0xe0')](createObjHistory(_0x380e5c,_0x5c9cd9,'RECALLFAILEDTIMEOUT',0x16,_0xbd9c('0x1ca')),_0xbd9c('0x1cb'),_0xbd9c('0x1cc'));}}}}else{_0x380e5c[_0xbd9c('0x5c')]+=0x1;_0x224be1[_0xbd9c('0xe0')](createObjHistory(_0x380e5c,_0x5c9cd9,'BLACKLIST',0xd,_0xbd9c('0x1cd')),_0xbd9c('0x1ce'),'[Originate][MoveBlacklist]');throw _0xbd9c('0x1cf');}};};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x1d0')]=function(_0x5495a9){var _0x263605=this;var _0x32e65a=[];var _0x459ca0=_0x5495a9[_0xbd9c('0x1d1')]-_0x5495a9[_0xbd9c('0x6e')]-_0x5495a9['temp'];emitCampaignSummary(_0x5495a9);if(_0x459ca0>0x0){if(_0x459ca0>this['maxNumberOriginate']){_0x459ca0=this['maxNumberOriginate'];}_0x5495a9[_0xbd9c('0x1d2')]+=_0x459ca0;this[_0xbd9c('0xc7')](_0x5495a9['id'],_0x459ca0,_0x5495a9[_0xbd9c('0x1d3')])[_0xbd9c('0xbe')](function(_0x28c9c1){_0x5495a9[_0xbd9c('0x1d2')]-=_0x459ca0;_0x5495a9[_0xbd9c('0x1d2')]=_0x5495a9['temp']>0x0?_0x5495a9[_0xbd9c('0x1d2')]:0x0;if(!checkContactEmpty(_0x28c9c1)){_0x5495a9[_0xbd9c('0x3b')]=_0xbd9c('0xa2');logger['info'](_0xbd9c('0x1d4')+_0x5495a9['name']);}else{_0x5495a9['originated']+=_0x28c9c1[_0xbd9c('0x9a')];_0x5495a9['message']='RUNNING';for(var _0xc51bbd=0x0;_0xc51bbd<_0x28c9c1[_0xbd9c('0x9a')];_0xc51bbd+=0x1){_0x5495a9[_0xbd9c('0x1d5')]+=0x1;if(_[_0xbd9c('0xe2')](_0x28c9c1[_0xc51bbd])||_['isNil'](_0x28c9c1[_0xc51bbd]['Contact'])||_[_0xbd9c('0xe2')](_0x28c9c1[_0xc51bbd][_0xbd9c('0x14c')][_0xbd9c('0x14d')])){_0x263605[_0xbd9c('0xd0')](_0xbd9c('0x1d6'),_0x5495a9,_0x28c9c1[_0xc51bbd]);}else{_0x263605[_0xbd9c('0xc0')](_['pick'](_0x28c9c1[_0xc51bbd],[_0xbd9c('0xd8'),_0xbd9c('0x1d7')]))['then'](_0x263605['checkContactBlack'](_0x5495a9,_0x28c9c1[_0xc51bbd]))['catch'](_0x263605[_0xbd9c('0xcf')](_0xbd9c('0x1d8'),_0x5495a9));}}}})[_0xbd9c('0xb5')](loggerGetContactDialer('[getContactCampaign2]',_0x5495a9,_0x459ca0));}};Dialer['prototype'][_0xbd9c('0x139')]=function(_0x4c9643,_0x4e32c1){var _0x2049fb=this;var _0x535e0b=[];var _0x3bc67b=_0x4e32c1>=0x1?_0x4e32c1:0x1;var _0x2651fa=[];if(_0x4c9643[_0xbd9c('0x57')]==='booked'){_0x3bc67b=0x1;}var _0x515f5e=Math[_0xbd9c('0x19f')](_0x4c9643[_0xbd9c('0x4d')]*_0x3bc67b)-_0x4c9643[_0xbd9c('0x6e')]-_0x4c9643['temp'];emitVoiceQueueSummary(_0x4c9643);if(_0x4c9643[_0xbd9c('0x1d9')]>0x0){var _0x4b7e20=_0x4c9643[_0xbd9c('0x1d9')]-_0x4c9643[_0xbd9c('0x6e')]-_0x4c9643[_0xbd9c('0xa5')]-_0x4c9643[_0xbd9c('0x1d2')]-_0x4c9643[_0xbd9c('0x4f')];if(_0x515f5e>_0x4b7e20){_0x515f5e=_0x4b7e20;}}if(_0x515f5e>0x0){if(_0x4c9643[_0xbd9c('0x57')]===_0xbd9c('0xa')){_0x515f5e=0x1;}if(_0x515f5e>this['maxNumberOriginate']){_0x515f5e=this[_0xbd9c('0x22')];}_0x4c9643[_0xbd9c('0x1d2')]+=_0x515f5e;for(var _0x145fe3 in this['agents']){if(this[_0xbd9c('0x112')][_0xbd9c('0x9b')](_0x145fe3)){if(this[_0xbd9c('0x112')][_0x145fe3][_0xbd9c('0xab')]===_0xbd9c('0x1da')&&this[_0xbd9c('0x112')][_0x145fe3]['status']===_0xbd9c('0x1db')){_0x535e0b[_0xbd9c('0x114')](this[_0xbd9c('0x112')][_0x145fe3]['id']);}}}this[_0xbd9c('0xc6')](_0x4c9643['id'],_0x535e0b,_0x515f5e,_0x4c9643[_0xbd9c('0x1d3')])['then'](function(_0x239600){_0x4c9643[_0xbd9c('0x1d2')]-=_0x515f5e;_0x4c9643['temp']=_0x4c9643[_0xbd9c('0x1d2')]>0x0?_0x4c9643[_0xbd9c('0x1d2')]:0x0;if(!checkContactEmpty(_0x239600)){_0x2049fb[_0xbd9c('0xbb')](_0x4c9643)['then'](sendMessageReschedule(_0x4c9643))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x4c9643['originated']+=_0x239600[_0xbd9c('0x9a')];_0x4c9643[_0xbd9c('0x3b')]=_0x4c9643[_0xbd9c('0x57')]===_0xbd9c('0xa')?_0xbd9c('0x154'):'RUNNING';for(var _0x219d8c=0x0;_0x219d8c<_0x239600['length'];_0x219d8c+=0x1){if(_[_0xbd9c('0xe2')](_0x239600[_0x219d8c])||_[_0xbd9c('0xe2')](_0x239600[_0x219d8c]['Contact'])||_[_0xbd9c('0xe2')](_0x239600[_0x219d8c]['Contact'][_0xbd9c('0x14d')])){_0x2049fb[_0xbd9c('0xd0')](_0xbd9c('0x1d6'),_0x4c9643,_0x239600[_0x219d8c]);}else{_0x2049fb[_0xbd9c('0xbd')](_[_0xbd9c('0xd3')](_0x239600[_0x219d8c],['VoiceQueueId','Contact.phone']))[_0xbd9c('0xbe')](_0x2049fb[_0xbd9c('0x1bf')](_0x4c9643,_0x239600[_0x219d8c]))[_0xbd9c('0xb5')](_0x2049fb[_0xbd9c('0xcf')](_0xbd9c('0x1d6'),_0x4c9643));}}}})[_0xbd9c('0xb5')](loggerGetContactDialer('[getContactDialer2]',_0x4c9643,_0x515f5e));}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x92')]=function(_0x47f159){var _0x5af066=this;if(_0x47f159['dialLimitQueue']>0x0){var _0x2489e6=_0x47f159['dialLimitQueue']-_0x47f159['originated']-_0x47f159['talking'];if(_0x2489e6>0x0){this[_0xbd9c('0x1dc')](_0x47f159);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x47f159);}};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x1dc')]=function(_0x36833){var _0x802af8=this;var _0x2e8a6e=[];_0x36833[_0xbd9c('0x6e')]+=0x1;for(var _0x31c2d9 in this[_0xbd9c('0x112')]){if(this[_0xbd9c('0x112')]['hasOwnProperty'](_0x31c2d9)){if(this[_0xbd9c('0x112')][_0x31c2d9]['state']===_0xbd9c('0x1da')&&this[_0xbd9c('0x112')][_0x31c2d9]['status']===_0xbd9c('0x1db')){_0x2e8a6e[_0xbd9c('0x114')](this[_0xbd9c('0x112')][_0x31c2d9]['id']);}}}this[_0xbd9c('0xc6')](_0x36833['id'],_0x2e8a6e,0x1,_0x36833['dialOrderByScheduledAt'])['then'](function(_0x122e9d){if(!checkContactEmpty(_0x122e9d)){checkContactLowerLimitOriginate(_0x36833,0x1,0x0);_0x802af8[_0xbd9c('0xbb')](_0x36833)[_0xbd9c('0xbe')](sendMessageReschedule(_0x36833))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x36833[_0xbd9c('0x3b')]=_0xbd9c('0x1dd');if(_[_0xbd9c('0xe2')](_0x122e9d[0x0])||_['isNil'](_0x122e9d[0x0][_0xbd9c('0x14c')])||_['isNil'](_0x122e9d[0x0]['Contact'][_0xbd9c('0x14d')])){_0x802af8[_0xbd9c('0xd0')](_0xbd9c('0x1d6'),_0x36833,_0x122e9d[0x0]);}else{_0x802af8[_0xbd9c('0xbd')](_[_0xbd9c('0xd3')](_0x122e9d[0x0],[_0xbd9c('0xd7'),_0xbd9c('0x1d7')]))[_0xbd9c('0xbe')](_0x802af8[_0xbd9c('0x1bf')](_0x36833,_0x122e9d[0x0]))[_0xbd9c('0xb5')](_0x802af8[_0xbd9c('0xcf')]('[actionOriginatePredictive]\x20',_0x36833));}}})[_0xbd9c('0xb5')](loggerGetContactDialer(_0xbd9c('0x1de'),_0x36833,0x1));emitVoiceQueueSummary(_0x36833);};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x1b4')]=function(_0x1350fa,_0x240c28,_0x5c89d5,_0x150e92,_0x4edea0,_0x4262b8){loggerPredictive[_0xbd9c('0x7a')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xbd9c('0x7a')]('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',_0x1350fa);loggerPredictive[_0xbd9c('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x240c28);loggerPredictive['info'](_0xbd9c('0x1df'),_0x5c89d5);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x1e0'),_0x150e92);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x1e1'),_0x4edea0);loggerPredictive[_0xbd9c('0x7a')]('---------------------------');return new BPromise(function(_0xf5dc2b,_0x2e977d){if(_0x1350fa<=0x0||isNaN(_0x1350fa)){return _0x2e977d(msgResponse(_0xbd9c('0x1e2'),'Error',_0xbd9c('0x1e3')+_0x1350fa));}if(_0x5c89d5<=0x0||isNaN(_0x5c89d5)){return _0x2e977d(msgResponse(_0xbd9c('0x1e2'),_0xbd9c('0x47'),_0xbd9c('0x1e4')+_0x5c89d5));}if(_0x150e92<=0x0||isNaN(_0x150e92)){return _0x2e977d(msgResponse(_0xbd9c('0x1e2'),_0xbd9c('0x47'),_0xbd9c('0x1e5')+_0x150e92));}if(_0x240c28<=0x0||isNaN(_0x240c28)){return _0x2e977d(msgResponse(_0xbd9c('0x1e2'),'Error',_0xbd9c('0x1e6')+_0x240c28));}if(_0x4edea0<=0x0||isNaN(_0x4edea0)){return _0x2e977d(msgResponse(_0xbd9c('0x1e2'),_0xbd9c('0x47'),_0xbd9c('0x1e7')+_0x4edea0));}_0x4262b8=_0x4262b8||0x0;var _0x290bc5=0x1/_0x5c89d5;var _0x511750=0x0;var _0x438355=0x0;var _0x49feca=0x0;var _0xc5032b=0x0;for(var _0x588b33=0x0;_0x49feca<_0x4edea0;_0x588b33+=0x1){_0x438355=_0x588b33/_0x240c28;_0x511750=(_0x150e92*_0x438355+_0x4262b8)/_0x290bc5;_0x49feca=erlangb(_0x511750,_0x1350fa);_0xc5032b=_0x511750/_0x1350fa*(0x1-erlangb(_0x511750,_0x1350fa));}return _0xf5dc2b({'erlangCalls':_0x588b33,'erlangCallToSecond':_0x240c28/_0x588b33,'erlangAbandonmentRate':_0x49feca,'erlangBusyFactor':_0xc5032b});});};Dialer[_0xbd9c('0xaf')][_0xbd9c('0x1b6')]=function(_0x45140f,_0x53fed3,_0x39f8f7,_0x13f6b2,_0x23d8c6,_0x7319d3){loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x1e8'));loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x1e9'),_0x45140f);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x1ea'),_0x53fed3);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x1df'),_0x39f8f7);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x1e0'),_0x13f6b2);loggerPredictive[_0xbd9c('0x7a')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23d8c6);loggerPredictive[_0xbd9c('0x7a')](_0xbd9c('0x84'));return new BPromise(function(_0x46d76f,_0x256248){if(_0x45140f<=0x0||isNaN(_0x45140f)){return _0x256248(msgResponse(_0xbd9c('0x1eb'),_0xbd9c('0x47'),'m\x20=\x20'+_0x45140f));}if(_0x39f8f7<=0x0||isNaN(_0x39f8f7)){return _0x256248(msgResponse('[busyFactor]',_0xbd9c('0x47'),_0xbd9c('0x1e4')+_0x39f8f7));}if(_0x13f6b2<=0x0||isNaN(_0x13f6b2)){return _0x256248(msgResponse(_0xbd9c('0x1eb'),_0xbd9c('0x47'),_0xbd9c('0x1e5')+_0x13f6b2));}if(_0x53fed3<=0x0||isNaN(_0x53fed3)){return _0x256248(msgResponse(_0xbd9c('0x1eb'),'Error','interval\x20=\x20'+_0x53fed3));}if(_0x23d8c6<=0x0||isNaN(_0x23d8c6)){return _0x256248(msgResponse(_0xbd9c('0x1eb'),_0xbd9c('0x47'),'Umin\x20=\x20'+_0x23d8c6));}_0x7319d3=_0x7319d3||0x0;var _0x5ee324=0x1/_0x39f8f7;var _0x326a4c=0x0;var _0x284987=0x0;var _0x40898a=0x0;var _0x4abd3c=0x0;for(var _0x3dcf5c=0x0;_0x4abd3c<_0x23d8c6;_0x3dcf5c+=0x1){_0x284987=_0x3dcf5c/_0x53fed3;_0x326a4c=(_0x13f6b2*_0x284987+_0x7319d3)/_0x5ee324;_0x40898a=erlangb(_0x326a4c,_0x45140f);_0x4abd3c=_0x326a4c/_0x45140f*(0x1-erlangb(_0x326a4c,_0x45140f));}return _0x46d76f({'erlangCalls':_0x3dcf5c,'erlangCallToSecond':_0x53fed3/_0x3dcf5c,'erlangAbandonmentRate':_0x40898a,'erlangBusyFactor':_0x4abd3c});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 06cea32..64eba96 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 _0x4a0c=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','scheduledat','type','outbound','queue'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4a0c,0x145));var _0xc4a0=function(_0x100999,_0x27139b){_0x100999=_0x100999-0x0;var _0x3b60b4=_0x4a0c[_0x100999];return _0x3b60b4;};'use strict';var util=require('util');var _=require(_0xc4a0('0x0'));var moment=require('moment');function getSeconds(_0x254959,_0x3cf9a6){var _0x48ae5c=moment(_0x254959)[_0xc4a0('0x1')](0x0);var _0x17ebe7=moment(_0x3cf9a6)['milliseconds'](0x0);return _0x48ae5c[_0xc4a0('0x2')](_0x17ebe7,_0xc4a0('0x3'));}function QueueCallerAbandon(_0x3e018e,_0x20b8a0){this[_0xc4a0('0x4')]=_0x3e018e[_0xc4a0('0x4')];this[_0xc4a0('0x5')]=_0x3e018e['type'];this['campaigntype']=_0x3e018e['type']===_0xc4a0('0x6')?_0xc4a0('0x7'):_0x3e018e[_0xc4a0('0x5')];this['countbusyretry']=_0x3e018e[_0xc4a0('0x8')];this['countcongestionretry']=_0x3e018e[_0xc4a0('0x9')];this[_0xc4a0('0xa')]=_0x3e018e[_0xc4a0('0xa')];this[_0xc4a0('0xb')]=_0x3e018e[_0xc4a0('0x8')]+_0x3e018e['countcongestionretry']+_0x3e018e[_0xc4a0('0xa')];this[_0xc4a0('0xc')]=_0x20b8a0[_0xc4a0('0xc')];this[_0xc4a0('0xd')]=_0x3e018e[_0xc4a0('0xe')];this[_0xc4a0('0xf')]=_0x3e018e[_0xc4a0('0x10')];this['starttime']=_0x3e018e[_0xc4a0('0x11')];this['responsetime']=_0x3e018e[_0xc4a0('0x12')];this[_0xc4a0('0x13')]=_0x3e018e[_0xc4a0('0x13')];this[_0xc4a0('0x14')]=this[_0xc4a0('0x13')];this[_0xc4a0('0x15')]=getSeconds(_0x3e018e[_0xc4a0('0x12')],_0x3e018e[_0xc4a0('0x11')]);this['holdtime']=getSeconds(this[_0xc4a0('0x13')],_0x3e018e['responsetime']);this['talktime']=0x0;this[_0xc4a0('0x7')]=_0x20b8a0[_0xc4a0('0x7')];this[_0xc4a0('0x16')]=_0x20b8a0[_0xc4a0('0x17')];this[_0xc4a0('0x18')]=_0x20b8a0[_0xc4a0('0x18')];this['callback']=_0x3e018e[_0xc4a0('0x19')];this[_0xc4a0('0x1a')]=_0x3e018e[_0xc4a0('0x1a')];this['callbackat']=_0x3e018e[_0xc4a0('0x1b')];this[_0xc4a0('0x1c')]=_0x3e018e[_0xc4a0('0x1c')];this[_0xc4a0('0x1d')]=_0x3e018e[_0xc4a0('0x1d')];this[_0xc4a0('0x1e')]=_0x3e018e[_0xc4a0('0x1e')];this[_0xc4a0('0x1f')]=_0x3e018e[_0xc4a0('0x1f')];this[_0xc4a0('0x20')]=_0x3e018e[_0xc4a0('0x20')];this['CampaignId']=_0x3e018e[_0xc4a0('0x21')];this[_0xc4a0('0x22')]=_0x3e018e['originatecalleridnum']||'';this[_0xc4a0('0x23')]=_0x3e018e['originatecalleridname']||'';}module[_0xc4a0('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0x1b31=['endtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','exports','lodash','moment','milliseconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime'];(function(_0x22b362,_0x38eea1){var _0x38d609=function(_0x754ce){while(--_0x754ce){_0x22b362['push'](_0x22b362['shift']());}};_0x38d609(++_0x38eea1);}(_0x1b31,0xd5));var _0x11b3=function(_0x59998c,_0x1a3b87){_0x59998c=_0x59998c-0x0;var _0x52741e=_0x1b31[_0x59998c];return _0x52741e;};'use strict';var util=require('util');var _=require(_0x11b3('0x0'));var moment=require(_0x11b3('0x1'));function getSeconds(_0x1d96a8,_0x4e34d6){var _0x18c740=moment(_0x1d96a8)[_0x11b3('0x2')](0x0);var _0x37ae58=moment(_0x4e34d6)[_0x11b3('0x2')](0x0);return _0x18c740['diff'](_0x37ae58,'seconds');}function QueueCallerAbandon(_0x5e7a5f,_0x3acd26){this[_0x11b3('0x3')]=_0x5e7a5f['scheduledat'];this[_0x11b3('0x4')]=_0x5e7a5f[_0x11b3('0x4')];this['campaigntype']=_0x5e7a5f[_0x11b3('0x4')]===_0x11b3('0x5')?_0x11b3('0x6'):_0x5e7a5f[_0x11b3('0x4')];this[_0x11b3('0x7')]=_0x5e7a5f[_0x11b3('0x7')];this[_0x11b3('0x8')]=_0x5e7a5f[_0x11b3('0x8')];this[_0x11b3('0x9')]=_0x5e7a5f[_0x11b3('0x9')];this[_0x11b3('0xa')]=_0x5e7a5f[_0x11b3('0x7')]+_0x5e7a5f[_0x11b3('0x8')]+_0x5e7a5f[_0x11b3('0x9')];this[_0x11b3('0xb')]=_0x3acd26[_0x11b3('0xb')];this[_0x11b3('0xc')]=_0x5e7a5f[_0x11b3('0xd')];this[_0x11b3('0xe')]=_0x5e7a5f['number'];this[_0x11b3('0xf')]=_0x5e7a5f['starttime'];this[_0x11b3('0x10')]=_0x5e7a5f[_0x11b3('0x10')];this[_0x11b3('0x11')]=_0x5e7a5f['droptime'];this[_0x11b3('0x12')]=this[_0x11b3('0x11')];this['ringtime']=getSeconds(_0x5e7a5f['responsetime'],_0x5e7a5f['starttime']);this[_0x11b3('0x13')]=getSeconds(this[_0x11b3('0x11')],_0x5e7a5f[_0x11b3('0x10')]);this[_0x11b3('0x14')]=0x0;this[_0x11b3('0x6')]=_0x3acd26['queue'];this[_0x11b3('0x15')]=_0x3acd26['connectedlinename'];this[_0x11b3('0x16')]=_0x3acd26[_0x11b3('0x16')];this['callback']=_0x5e7a5f[_0x11b3('0x17')];this[_0x11b3('0x18')]=_0x5e7a5f['callbackuniqueid'];this['callbackat']=_0x5e7a5f[_0x11b3('0x19')];this[_0x11b3('0x1a')]=_0x5e7a5f[_0x11b3('0x1a')];this[_0x11b3('0x1b')]=_0x5e7a5f[_0x11b3('0x1b')];this['ListId']=_0x5e7a5f[_0x11b3('0x1c')];this[_0x11b3('0x1d')]=_0x5e7a5f['UserId'];this['VoiceQueueId']=_0x5e7a5f[_0x11b3('0x1e')];this['CampaignId']=_0x5e7a5f['CampaignId'];this['originatecalleridnum']=_0x5e7a5f['originatecalleridnum']||'';this[_0x11b3('0x1f')]=_0x5e7a5f[_0x11b3('0x1f')]||'';}module[_0x11b3('0x20')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5f61d8a..967acb7 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 _0xf627=['moment','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','localstationid','headerinfo','path','AttachmentId','util'];(function(_0x4d0329,_0x442873){var _0x22a0b8=function(_0x504502){while(--_0x504502){_0x4d0329['push'](_0x4d0329['shift']());}};_0x22a0b8(++_0x442873);}(_0xf627,0x12a));var _0x7f62=function(_0xc6647a,_0x412531){_0xc6647a=_0xc6647a-0x0;var _0x358bfb=_0xf627[_0xc6647a];return _0x358bfb;};'use strict';var util=require(_0x7f62('0x0'));var _=require('lodash');var moment=require(_0x7f62('0x1'));function Action(_0x167602,_0x110781,_0x5d8a6e){this[_0x7f62('0x2')]=_0x167602||undefined;this[_0x7f62('0x3')]=util[_0x7f62('0x4')](_0x7f62('0x5'),_0x110781[_0x7f62('0x6')],_0x110781[_0x7f62('0x7')][_0x7f62('0x8')],_0x5d8a6e['fax']);this[_0x7f62('0x9')]=_0x110781[_0x7f62('0x9')];this[_0x7f62('0xa')]=_0x110781[_0x7f62('0xa')];this[_0x7f62('0xb')]=_0x5d8a6e['path'];this[_0x7f62('0xc')]=_0x5d8a6e[_0x7f62('0xc')];}module['exports']=Action; \ No newline at end of file +var _0xbd90=['channel','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports','lodash','moment','uniqueid'];(function(_0x2212cb,_0x1fa9d1){var _0x4e694c=function(_0x51eab9){while(--_0x51eab9){_0x2212cb['push'](_0x2212cb['shift']());}};_0x4e694c(++_0x1fa9d1);}(_0xbd90,0x14d));var _0x0bd9=function(_0x1e4b88,_0x374bd0){_0x1e4b88=_0x1e4b88-0x0;var _0x34bab6=_0xbd90[_0x1e4b88];return _0x34bab6;};'use strict';var util=require('util');var _=require(_0x0bd9('0x0'));var moment=require(_0x0bd9('0x1'));function Action(_0x184144,_0x5abc80,_0x2f1568){this[_0x0bd9('0x2')]=_0x184144||undefined;this[_0x0bd9('0x3')]=util['format'](_0x0bd9('0x4'),_0x5abc80[_0x0bd9('0x5')],_0x5abc80[_0x0bd9('0x6')][_0x0bd9('0x7')],_0x2f1568[_0x0bd9('0x8')]);this[_0x0bd9('0x9')]=_0x5abc80['localstationid'];this[_0x0bd9('0xa')]=_0x5abc80[_0x0bd9('0xa')];this[_0x0bd9('0xb')]=_0x2f1568[_0x0bd9('0xb')];this['AttachmentId']=_0x2f1568[_0x0bd9('0xc')];}module[_0x0bd9('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index dbdaa1c..ba0b563 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 _0x57df=['faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','isTrunkReachable','isNil','active','reachable','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','stringify','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncHangup','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','variable','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','then','notify','.pdf','catch','error','\x20notify\x20','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20'];(function(_0x5b2096,_0x213141){var _0x198357=function(_0x5afe77){while(--_0x5afe77){_0x5b2096['push'](_0x5b2096['shift']());}};_0x198357(++_0x213141);}(_0x57df,0x1dd));var _0xf57d=function(_0x1c8e0b,_0x1a84b7){_0x1c8e0b=_0x1c8e0b-0x0;var _0x148893=_0x57df[_0x1c8e0b];return _0x148893;};'use strict';var util=require(_0xf57d('0x0'));var _=require(_0xf57d('0x1'));var BPromise=require(_0xf57d('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xf57d('0x3'));var tiff2pdf=require(_0xf57d('0x4'));var gs=require('./util/gs');var logger=require(_0xf57d('0x5'))(_0xf57d('0x6'));var ami=require(_0xf57d('0x7'));var rpcDb=require(_0xf57d('0x8'));var Channel=require('./channel');var ut=require('./util/util');var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xf57d('0x9'));var faxMessage=require(_0xf57d('0xa'));function Fax(_0x29002f){this['channels']={};this[_0xf57d('0xb')]=_0x29002f[_0xf57d('0xb')];this[_0xf57d('0xc')]=_0x29002f[_0xf57d('0xc')];this[_0xf57d('0xd')]={};ami['on'](_0xf57d('0xe'),this['syncNewchannel'][_0xf57d('0xf')](this));ami['on'](_0xf57d('0x10'),this[_0xf57d('0x11')][_0xf57d('0xf')](this));ami['on'](_0xf57d('0x12'),this[_0xf57d('0x13')][_0xf57d('0xf')](this));ami['on'](_0xf57d('0x14'),this['syncNewExten'][_0xf57d('0xf')](this));ami['on'](_0xf57d('0x15'),this[_0xf57d('0x16')]['bind'](this));ami['on'](_0xf57d('0x17'),this['syncReceiveFax'][_0xf57d('0xf')](this));ami['on']('hangup',this[_0xf57d('0x18')][_0xf57d('0xf')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));}Fax[_0xf57d('0x19')][_0xf57d('0x1a')]=function(_0x53ad5f){if(_0x53ad5f[_0xf57d('0x1b')]===_0xf57d('0x1c')){for(var _0x5b82e4 in this[_0xf57d('0xb')]){if(this[_0xf57d('0xb')][_0xf57d('0x1d')](_0x5b82e4)){if(_0x53ad5f['exten']===this[_0xf57d('0xb')][_0x5b82e4][_0xf57d('0x1e')]){this['channels'][_0x53ad5f[_0xf57d('0x1f')]]={};this[_0xf57d('0x20')][_0x53ad5f[_0xf57d('0x1f')]][_0xf57d('0x21')]=_0x53ad5f[_0xf57d('0x21')];this[_0xf57d('0x20')][_0x53ad5f[_0xf57d('0x1f')]]['id']=this['faxAccounts'][_0x5b82e4]['id'];this['channels'][_0x53ad5f[_0xf57d('0x1f')]][_0xf57d('0x22')]=this[_0xf57d('0xb')][_0x5b82e4][_0xf57d('0x22')];logger[_0xf57d('0x23')](_0x53ad5f['uniqueid'],_0xf57d('0x24'));}}}}if(this['actions'][_0x53ad5f[_0xf57d('0x1f')]]){this[_0xf57d('0x20')][_0x53ad5f[_0xf57d('0x1f')]]={};this['channels'][_0x53ad5f[_0xf57d('0x1f')]][_0xf57d('0x21')]=_0x53ad5f['channel'];logger[_0xf57d('0x23')](_0x53ad5f[_0xf57d('0x1f')],_0xf57d('0x24'));}};Fax[_0xf57d('0x19')][_0xf57d('0x11')]=function(_0x2cbde0){if(this[_0xf57d('0x20')][_0x2cbde0[_0xf57d('0x1f')]]){for(var _0x4d331d in _0x2cbde0['variable']){if(_0x2cbde0[_0xf57d('0x25')][_0xf57d('0x1d')](_0x4d331d)){this[_0xf57d('0x20')][_0x2cbde0[_0xf57d('0x1f')]][_0x4d331d]=_0x2cbde0['value'];}}}};Fax[_0xf57d('0x19')][_0xf57d('0x13')]=function(_0x35bcd6){if(this[_0xf57d('0x20')][_0x35bcd6[_0xf57d('0x1f')]]){this[_0xf57d('0x20')][_0x35bcd6['uniqueid']]['channelstate']=_0x35bcd6['channelstate'];this[_0xf57d('0x20')][_0x35bcd6[_0xf57d('0x1f')]][_0xf57d('0x26')]=_0x35bcd6[_0xf57d('0x26')];}};Fax[_0xf57d('0x19')][_0xf57d('0x27')]=function(_0xa39afb){if(this[_0xf57d('0x20')][_0xa39afb['uniqueid']]){for(var _0x4ab19e in _0xa39afb[_0xf57d('0x25')]){if(_0xa39afb['variable'][_0xf57d('0x1d')](_0x4ab19e)){this[_0xf57d('0x20')][_0xa39afb[_0xf57d('0x1f')]][_0x4ab19e]=_0xa39afb['value'];}}}};Fax[_0xf57d('0x19')][_0xf57d('0x16')]=function(_0x50fae5){if(this[_0xf57d('0x20')][_0x50fae5[_0xf57d('0x1f')]]){this[_0xf57d('0x20')][_0x50fae5['uniqueid']][_0xf57d('0x28')]=_0x50fae5[_0xf57d('0x28')];this['channels'][_0x50fae5[_0xf57d('0x1f')]]['status']=_0x50fae5[_0xf57d('0x29')];this[_0xf57d('0x20')][_0x50fae5['uniqueid']][_0xf57d('0x1e')]=_0x50fae5['localstationid'];this['channels'][_0x50fae5['uniqueid']][_0xf57d('0x2a')]=_0x50fae5['filename'];logger[_0xf57d('0x23')](_0x50fae5['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0xf57d('0x19')]['syncReceiveFax']=function(_0x262c80){var _0x40b5f5=this;if(this['channels'][_0x262c80[_0xf57d('0x1f')]]){var _0x46c8e4=this[_0xf57d('0x20')][_0x262c80['uniqueid']]['id'];this[_0xf57d('0x20')][_0x262c80['uniqueid']][_0xf57d('0x2b')]=_0x262c80[_0xf57d('0x2b')];this[_0xf57d('0x20')][_0x262c80['uniqueid']][_0xf57d('0x2c')]=_0x262c80['pagestransferred'];this[_0xf57d('0x20')][_0x262c80[_0xf57d('0x1f')]][_0xf57d('0x1e')]=_0x262c80[_0xf57d('0x1e')];this[_0xf57d('0x20')][_0x262c80[_0xf57d('0x1f')]][_0xf57d('0x2d')]=_0x262c80[_0xf57d('0x2d')];this['channels'][_0x262c80['uniqueid']]['transferrate']=_0x262c80['transferrate'];this[_0xf57d('0x20')][_0x262c80['uniqueid']][_0xf57d('0x2a')]=_0x262c80[_0xf57d('0x2a')];this[_0xf57d('0x20')][_0x262c80[_0xf57d('0x1f')]][_0xf57d('0x2e')]=_0x262c80[_0xf57d('0x2e')];if(this[_0xf57d('0x20')][_0x262c80[_0xf57d('0x1f')]][_0xf57d('0x2c')]>0x0){tiff2pdf(_0x262c80[_0xf57d('0x2a')],_0xf57d('0x2f'),function(_0x4dd6c1){logger[_0xf57d('0x23')](_0x262c80[_0xf57d('0x1f')],_0xf57d('0x30'),_0x4dd6c1[_0xf57d('0x31')]);attachment[_0xf57d('0x32')]({'name':path[_0xf57d('0x33')](_0x262c80['filename'])[_0xf57d('0x22')],'basename':path[_0xf57d('0x33')](_0x262c80[_0xf57d('0x2a')])[_0xf57d('0x22')]+'.pdf','type':'application/pdf'})[_0xf57d('0x34')](function(_0x1198fd){faxAccount[_0xf57d('0x35')](_0x46c8e4,{'from':_0x262c80[_0xf57d('0x2e')],'mapKey':_0xf57d('0x6'),'body':path['parse'](_0x262c80[_0xf57d('0x2a')])['name']+_0xf57d('0x36'),'AttachmentId':_0x1198fd['id']})[_0xf57d('0x37')](function(_0x9b15aa){logger[_0xf57d('0x38')](_0x262c80['uniqueid'],_0xf57d('0x39'),JSON['stringify'](_0x9b15aa));});})['catch'](function(_0x3cf97c){logger[_0xf57d('0x38')](_0x262c80[_0xf57d('0x1f')],'\x20receiveFax\x20',JSON['stringify'](_0x3cf97c));});});}logger[_0xf57d('0x23')](_0x262c80['uniqueid'],_0xf57d('0x3a'));}};Fax[_0xf57d('0x19')]['syncOriginateResponse']=function(_0x5d996c){if(this[_0xf57d('0xd')][_0x5d996c['uniqueid']]){_[_0xf57d('0x3b')](this[_0xf57d('0x20')][_0x5d996c[_0xf57d('0x1f')]],_['pick'](_0x5d996c,[_0xf57d('0x3c'),_0xf57d('0x3d')]));}};function updateStatus(_0x3b87c8){if(_0x3b87c8[_0xf57d('0x3e')]){faxMessage[_0xf57d('0x3f')](_0x3b87c8[_0xf57d('0x3e')],{'failMessage':_0xf57d('0x40')})['then'](function(_0xb328e0){ut[_0xf57d('0x41')](_0xf57d('0x42'),_0xb328e0);})[_0xf57d('0x37')](function(_0x44021f){ut[_0xf57d('0x41')](_0xf57d('0x43'),_0x44021f);});}else{ut[_0xf57d('0x41')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xf57d('0x19')][_0xf57d('0x44')]=function(_0x292099,_0x43bebd,_0x13745b){var _0x2d7fbb=this;var _0x2da880={};if(_0x43bebd){_0x2da880={'read':_0x43bebd};}else{_0x2da880={'failMessage':_0x13745b};}if(this[_0xf57d('0xd')][_0x292099]['AttachmentId']){faxMessage[_0xf57d('0x3f')](this[_0xf57d('0xd')][_0x292099]['AttachmentId'],_0x2da880)[_0xf57d('0x34')](function(_0x43d7c9){ut[_0xf57d('0x41')](_0xf57d('0x45'),_0x43d7c9);})[_0xf57d('0x37')](function(_0x25e25f){ut[_0xf57d('0x41')](_0xf57d('0x46'),_0x25e25f);})[_0xf57d('0x47')](function(){delete _0x2d7fbb[_0xf57d('0x20')][_0x292099];delete _0x2d7fbb[_0xf57d('0xd')][_0x292099];});}else{ut[_0xf57d('0x41')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x292099];delete this['actions'][_0x292099];}};Fax[_0xf57d('0x19')][_0xf57d('0x18')]=function(_0x56d4d3){var _0x5d55d8=this;if(this['channels'][_0x56d4d3[_0xf57d('0x1f')]]){if(this[_0xf57d('0xd')][_0x56d4d3['uniqueid']]){this['channels'][_0x56d4d3[_0xf57d('0x1f')]]['id']=this[_0xf57d('0xd')][_0x56d4d3[_0xf57d('0x1f')]]['id'];this[_0xf57d('0x20')][_0x56d4d3['uniqueid']][_0xf57d('0x22')]=this[_0xf57d('0xd')][_0x56d4d3[_0xf57d('0x1f')]][_0xf57d('0x22')];}logger[_0xf57d('0x23')](_0x56d4d3[_0xf57d('0x1f')],this[_0xf57d('0xd')][_0x56d4d3[_0xf57d('0x1f')]]?'\x20hangup\x20sendFile\x20':_0xf57d('0x48'),JSON['stringify'](this[_0xf57d('0x20')][_0x56d4d3[_0xf57d('0x1f')]]));if(this[_0xf57d('0xd')][_0x56d4d3[_0xf57d('0x1f')]]){if(this[_0xf57d('0x20')][_0x56d4d3[_0xf57d('0x1f')]]['faxpages']>0x0&&this['channels'][_0x56d4d3[_0xf57d('0x1f')]][_0xf57d('0x15')]==='SUCCESS'){this[_0xf57d('0x44')](_0x56d4d3[_0xf57d('0x1f')],!![]);}else{this['updateStatus'](_0x56d4d3['uniqueid'],![],this[_0xf57d('0x20')][_0x56d4d3[_0xf57d('0x1f')]][_0xf57d('0x49')]?_0xf57d('0x4a')+this['channels'][_0x56d4d3[_0xf57d('0x1f')]]['faxstatusstring']:_0xf57d('0x4b'));}}}};Fax['prototype'][_0xf57d('0x4c')]=function(_0x1307d1){var _0x2fbd04=this;return new BPromise(function(_0xc361d0,_0x21219a){_0x2fbd04[_0xf57d('0x4d')](_0x1307d1,_0x2fbd04[_0xf57d('0xb')][_0x1307d1[_0xf57d('0x4e')]])[_0xf57d('0x34')](function(_0x3d3b98){ut['logger'](_0xf57d('0x4f'),_0x3d3b98);_0xc361d0(ut[_0xf57d('0x31')]('Fax\x20received'));})[_0xf57d('0x37')](function(_0x18be71){ut[_0xf57d('0x41')](_0xf57d('0x50'),_0x18be71);updateStatus(_0x1307d1);_0x21219a(ut['message'](_0xf57d('0x51')));});});};Fax[_0xf57d('0x19')][_0xf57d('0x52')]=function(_0x2031f3){var _0x41504b=this;return new BPromise(function(_0x469c5a,_0x43dea9){var _0xb3ad4=_0x41504b[_0xf57d('0x53')](_0x41504b[_0xf57d('0xb')][_0x2031f3[_0xf57d('0x4e')]][_0xf57d('0x54')],_0x2031f3);if(_0xb3ad4['isValid']){_0x469c5a(ut['message'](_0xf57d('0x55')));}else{_0x43dea9(ut[_0xf57d('0x31')](_0xb3ad4['message']));}});};function originate(_0x110331,_0x26c619,_0x3e1ebf){return new BPromise(function(_0x15eff2,_0x1e73db){if(_0x3e1ebf){var _0x27ca40=util[_0xf57d('0x56')](_0xf57d('0x57'),path[_0xf57d('0x33')](_0x110331[_0xf57d('0x3')])['name'],_0x110331[_0xf57d('0x3')]);gs[_0xf57d('0x58')](_0x27ca40)[_0xf57d('0x34')](function(){_0x110331[_0xf57d('0x3')]=util[_0xf57d('0x56')](_0xf57d('0x59'),path[_0xf57d('0x33')](_0x110331['path'])[_0xf57d('0x5a')],path['parse'](_0x110331[_0xf57d('0x3')])[_0xf57d('0x22')]);_0x26c619[_0xf57d('0x5b')]=_0x110331['path'];ut['logger'](_0xf57d('0x5c'),'');ami[_0xf57d('0x5d')](ut['variablesAction'](_0x110331,_0x26c619))['then'](function(_0x407187){_0x15eff2(_0x407187);})['catch'](function(_0x150f3b){_0x1e73db(_0x150f3b);});})[_0xf57d('0x37')](function(_0x99f6c7){_0x1e73db(_0x99f6c7);});}else{ami[_0xf57d('0x5d')](ut['variablesAction'](_0x110331,_0x26c619))[_0xf57d('0x34')](function(_0x3620cb){_0x15eff2(_0x3620cb);})[_0xf57d('0x37')](function(_0x2defa2){_0x1e73db(_0x2defa2);});}});}Fax[_0xf57d('0x19')]['execOriginate']=function(_0x539aeb,_0x109715){var _0x13dae4=this;return new BPromise(function(_0xe2e2e5,_0x4df130){var _0x320142=uuid['v4']();var _0xb292bc=ut[_0xf57d('0x5e')](_0x539aeb,_0x109715);_0x13dae4[_0xf57d('0xd')][_0x320142]=new Action(_0x320142,_0x109715,_0x539aeb);var _0x6fcb6f=_0x13dae4[_0xf57d('0xd')][_0x320142];if(path[_0xf57d('0x33')](_0x539aeb['path'])['ext']===_0xf57d('0x36')){originate(_0x6fcb6f,_0xb292bc,!![])['then'](function(_0x24c1df){_0xe2e2e5(_0x24c1df);})[_0xf57d('0x37')](function(_0x34dd1c){_0x4df130(_0x34dd1c);});}else{originate(_0x6fcb6f,_0xb292bc,![])['then'](function(_0x23f96a){_0xe2e2e5(_0x23f96a);})[_0xf57d('0x37')](function(_0x2fb9f8){_0x4df130(_0x2fb9f8);});}});};Fax[_0xf57d('0x19')][_0xf57d('0x5f')]=function(_0x352807){return!_[_0xf57d('0x60')](_0x352807)&&!_[_0xf57d('0x60')](_0x352807['name'])&&!_[_0xf57d('0x60')](_0x352807[_0xf57d('0x61')])&&_0x352807[_0xf57d('0x61')]&&!_[_0xf57d('0x60')](this['trunks'][util['format']('SIP/%s',_0x352807[_0xf57d('0x22')])])&&!_[_0xf57d('0x60')](this[_0xf57d('0xc')][util[_0xf57d('0x56')]('SIP/%s',_0x352807[_0xf57d('0x22')])][_0xf57d('0x29')])&&(this[_0xf57d('0xc')][util[_0xf57d('0x56')]('SIP/%s',_0x352807[_0xf57d('0x22')])][_0xf57d('0x29')]===_0xf57d('0x62')||this[_0xf57d('0xc')][util[_0xf57d('0x56')](_0xf57d('0x63'),_0x352807[_0xf57d('0x22')])][_0xf57d('0x29')]===_0xf57d('0x64'));};Fax[_0xf57d('0x19')][_0xf57d('0x53')]=function(_0xee7d8e,_0x442c3b){if(!this[_0xf57d('0x5f')](_0xee7d8e)){ut['logger'](_0xf57d('0x65'),_[_0xf57d('0x60')](_0xee7d8e)?'':_0xee7d8e[_0xf57d('0x22')]+_0xf57d('0x66'));return{'isValid':![],'message':_0xf57d('0x67')};}if(_[_0xf57d('0x60')](_0x442c3b[_0xf57d('0x6')])){ut[_0xf57d('0x41')](_0xf57d('0x68'),JSON[_0xf57d('0x69')](_0x442c3b));return{'isValid':![],'message':_0xf57d('0x6a')};}if(_[_0xf57d('0x60')](_0x442c3b[_0xf57d('0x3')])){ut['logger'](_0xf57d('0x6b'),JSON[_0xf57d('0x69')](_0x442c3b));return{'isValid':![],'message':_0xf57d('0x6c')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xf57d('0x6d')]=Fax; \ No newline at end of file +var _0x6ca6=['execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','path','tiff2pdf','fax','../ami','./rpcDb','./util/util','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncFaxStatus','receivefax','hangup','syncHangup','syncOriginateResponse','prototype','context','hasOwnProperty','exten','channels','uniqueid','channel','name','info','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','SENDING\x20FAILED'];(function(_0x3f9b33,_0x4c370b){var _0x48cd73=function(_0x52b986){while(--_0x52b986){_0x3f9b33['push'](_0x3f9b33['shift']());}};_0x48cd73(++_0x4c370b);}(_0x6ca6,0x100));var _0x66ca=function(_0xb9f259,_0x164141){_0xb9f259=_0xb9f259-0x0;var _0x277335=_0x6ca6[_0xb9f259];return _0x277335;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x66ca('0x0'));var uuid=require(_0x66ca('0x1'));var moment=require('moment');var path=require(_0x66ca('0x2'));var tiff2pdf=require(_0x66ca('0x3'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x66ca('0x4'));var ami=require(_0x66ca('0x5'));var rpcDb=require(_0x66ca('0x6'));var Channel=require('./channel');var ut=require(_0x66ca('0x7'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x66ca('0x8'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x3d3023){this['channels']={};this['faxAccounts']=_0x3d3023[_0x66ca('0x9')];this[_0x66ca('0xa')]=_0x3d3023[_0x66ca('0xa')];this[_0x66ca('0xb')]={};ami['on'](_0x66ca('0xc'),this[_0x66ca('0xd')][_0x66ca('0xe')](this));ami['on']('varset',this[_0x66ca('0xf')]['bind'](this));ami['on'](_0x66ca('0x10'),this[_0x66ca('0x11')][_0x66ca('0xe')](this));ami['on'](_0x66ca('0x12'),this['syncNewExten']['bind'](this));ami['on']('faxstatus',this[_0x66ca('0x13')][_0x66ca('0xe')](this));ami['on'](_0x66ca('0x14'),this['syncReceiveFax'][_0x66ca('0xe')](this));ami['on'](_0x66ca('0x15'),this[_0x66ca('0x16')]['bind'](this));ami['on']('originateresponse',this[_0x66ca('0x17')][_0x66ca('0xe')](this));}Fax[_0x66ca('0x18')][_0x66ca('0xd')]=function(_0x37ff82){if(_0x37ff82[_0x66ca('0x19')]==='from-voip-provider'){for(var _0x4f02ba in this[_0x66ca('0x9')]){if(this[_0x66ca('0x9')][_0x66ca('0x1a')](_0x4f02ba)){if(_0x37ff82[_0x66ca('0x1b')]===this['faxAccounts'][_0x4f02ba]['localstationid']){this[_0x66ca('0x1c')][_0x37ff82[_0x66ca('0x1d')]]={};this[_0x66ca('0x1c')][_0x37ff82[_0x66ca('0x1d')]][_0x66ca('0x1e')]=_0x37ff82[_0x66ca('0x1e')];this[_0x66ca('0x1c')][_0x37ff82[_0x66ca('0x1d')]]['id']=this['faxAccounts'][_0x4f02ba]['id'];this[_0x66ca('0x1c')][_0x37ff82[_0x66ca('0x1d')]][_0x66ca('0x1f')]=this['faxAccounts'][_0x4f02ba][_0x66ca('0x1f')];logger[_0x66ca('0x20')](_0x37ff82['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x66ca('0xb')][_0x37ff82['uniqueid']]){this[_0x66ca('0x1c')][_0x37ff82['uniqueid']]={};this[_0x66ca('0x1c')][_0x37ff82[_0x66ca('0x1d')]]['channel']=_0x37ff82[_0x66ca('0x1e')];logger[_0x66ca('0x20')](_0x37ff82[_0x66ca('0x1d')],'\x20syncNewchannel\x20');}};Fax[_0x66ca('0x18')][_0x66ca('0xf')]=function(_0x257e75){if(this[_0x66ca('0x1c')][_0x257e75[_0x66ca('0x1d')]]){for(var _0x42887c in _0x257e75['variable']){if(_0x257e75[_0x66ca('0x21')][_0x66ca('0x1a')](_0x42887c)){this['channels'][_0x257e75[_0x66ca('0x1d')]][_0x42887c]=_0x257e75[_0x66ca('0x22')];}}}};Fax[_0x66ca('0x18')][_0x66ca('0x11')]=function(_0x21963b){if(this[_0x66ca('0x1c')][_0x21963b['uniqueid']]){this[_0x66ca('0x1c')][_0x21963b[_0x66ca('0x1d')]][_0x66ca('0x23')]=_0x21963b[_0x66ca('0x23')];this[_0x66ca('0x1c')][_0x21963b[_0x66ca('0x1d')]]['channelstatedesc']=_0x21963b[_0x66ca('0x24')];}};Fax[_0x66ca('0x18')][_0x66ca('0x25')]=function(_0x5d29a9){if(this[_0x66ca('0x1c')][_0x5d29a9['uniqueid']]){for(var _0x20cbc2 in _0x5d29a9[_0x66ca('0x21')]){if(_0x5d29a9[_0x66ca('0x21')][_0x66ca('0x1a')](_0x20cbc2)){this[_0x66ca('0x1c')][_0x5d29a9['uniqueid']][_0x20cbc2]=_0x5d29a9[_0x66ca('0x22')];}}}};Fax[_0x66ca('0x18')]['syncFaxStatus']=function(_0x594fee){if(this[_0x66ca('0x1c')][_0x594fee[_0x66ca('0x1d')]]){this['channels'][_0x594fee[_0x66ca('0x1d')]][_0x66ca('0x26')]=_0x594fee[_0x66ca('0x26')];this['channels'][_0x594fee[_0x66ca('0x1d')]][_0x66ca('0x27')]=_0x594fee[_0x66ca('0x27')];this['channels'][_0x594fee['uniqueid']][_0x66ca('0x28')]=_0x594fee['localstationid'];this[_0x66ca('0x1c')][_0x594fee[_0x66ca('0x1d')]]['filename']=_0x594fee['filename'];logger[_0x66ca('0x20')](_0x594fee[_0x66ca('0x1d')],_0x66ca('0x29'));}};Fax[_0x66ca('0x18')][_0x66ca('0x2a')]=function(_0x3783f9){var _0x1fa6a8=this;if(this[_0x66ca('0x1c')][_0x3783f9[_0x66ca('0x1d')]]){var _0x469acb=this['channels'][_0x3783f9['uniqueid']]['id'];this['channels'][_0x3783f9[_0x66ca('0x1d')]][_0x66ca('0x2b')]=_0x3783f9[_0x66ca('0x2b')];this['channels'][_0x3783f9['uniqueid']][_0x66ca('0x2c')]=_0x3783f9[_0x66ca('0x2c')];this['channels'][_0x3783f9[_0x66ca('0x1d')]][_0x66ca('0x28')]=_0x3783f9[_0x66ca('0x28')];this[_0x66ca('0x1c')][_0x3783f9[_0x66ca('0x1d')]]['resolution']=_0x3783f9[_0x66ca('0x2d')];this[_0x66ca('0x1c')][_0x3783f9[_0x66ca('0x1d')]][_0x66ca('0x2e')]=_0x3783f9[_0x66ca('0x2e')];this['channels'][_0x3783f9[_0x66ca('0x1d')]]['filename']=_0x3783f9[_0x66ca('0x2f')];this[_0x66ca('0x1c')][_0x3783f9[_0x66ca('0x1d')]][_0x66ca('0x30')]=_0x3783f9['calleridnum'];if(this[_0x66ca('0x1c')][_0x3783f9['uniqueid']][_0x66ca('0x2c')]>0x0){tiff2pdf(_0x3783f9['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x32f8fd){logger[_0x66ca('0x20')](_0x3783f9['uniqueid'],_0x66ca('0x31'),_0x32f8fd[_0x66ca('0x32')]);attachment[_0x66ca('0x33')]({'name':path['parse'](_0x3783f9['filename'])[_0x66ca('0x1f')],'basename':path[_0x66ca('0x34')](_0x3783f9['filename'])[_0x66ca('0x1f')]+'.pdf','type':_0x66ca('0x35')})[_0x66ca('0x36')](function(_0x390127){faxAccount[_0x66ca('0x37')](_0x469acb,{'from':_0x3783f9[_0x66ca('0x30')],'mapKey':_0x66ca('0x4'),'body':path[_0x66ca('0x34')](_0x3783f9[_0x66ca('0x2f')])[_0x66ca('0x1f')]+_0x66ca('0x38'),'AttachmentId':_0x390127['id']})[_0x66ca('0x39')](function(_0x312740){logger[_0x66ca('0x3a')](_0x3783f9['uniqueid'],_0x66ca('0x3b'),JSON[_0x66ca('0x3c')](_0x312740));});})['catch'](function(_0x34082b){logger[_0x66ca('0x3a')](_0x3783f9[_0x66ca('0x1d')],_0x66ca('0x3d'),JSON['stringify'](_0x34082b));});});}logger[_0x66ca('0x20')](_0x3783f9['uniqueid'],_0x66ca('0x3d'));}};Fax['prototype']['syncOriginateResponse']=function(_0x3a87ea){if(this[_0x66ca('0xb')][_0x3a87ea[_0x66ca('0x1d')]]){_[_0x66ca('0x3e')](this[_0x66ca('0x1c')][_0x3a87ea[_0x66ca('0x1d')]],_[_0x66ca('0x3f')](_0x3a87ea,[_0x66ca('0x40'),_0x66ca('0x41')]));}};function updateStatus(_0x16eea1){if(_0x16eea1['AttachmentId']){faxMessage[_0x66ca('0x42')](_0x16eea1[_0x66ca('0x43')],{'failMessage':_0x66ca('0x44')})[_0x66ca('0x36')](function(_0x426be2){ut[_0x66ca('0x45')](_0x66ca('0x46'),_0x426be2);})[_0x66ca('0x39')](function(_0x2302a7){ut[_0x66ca('0x45')](_0x66ca('0x47'),_0x2302a7);});}else{ut['logger'](_0x66ca('0x48'));}}Fax['prototype'][_0x66ca('0x49')]=function(_0x20a5b2,_0x23a846,_0x212342){var _0x3447e3=this;var _0x10872e={};if(_0x23a846){_0x10872e={'read':_0x23a846};}else{_0x10872e={'failMessage':_0x212342};}if(this[_0x66ca('0xb')][_0x20a5b2][_0x66ca('0x43')]){faxMessage[_0x66ca('0x42')](this[_0x66ca('0xb')][_0x20a5b2][_0x66ca('0x43')],_0x10872e)[_0x66ca('0x36')](function(_0x243c8a){ut[_0x66ca('0x45')](_0x66ca('0x4a'),_0x243c8a);})[_0x66ca('0x39')](function(_0x55d6ff){ut['logger'](_0x66ca('0x4b'),_0x55d6ff);})['finally'](function(){delete _0x3447e3[_0x66ca('0x1c')][_0x20a5b2];delete _0x3447e3['actions'][_0x20a5b2];});}else{ut['logger'](_0x66ca('0x4c'));delete this[_0x66ca('0x1c')][_0x20a5b2];delete this[_0x66ca('0xb')][_0x20a5b2];}};Fax['prototype'][_0x66ca('0x16')]=function(_0xfaafe3){var _0x59ba31=this;if(this[_0x66ca('0x1c')][_0xfaafe3[_0x66ca('0x1d')]]){if(this[_0x66ca('0xb')][_0xfaafe3[_0x66ca('0x1d')]]){this['channels'][_0xfaafe3['uniqueid']]['id']=this[_0x66ca('0xb')][_0xfaafe3[_0x66ca('0x1d')]]['id'];this['channels'][_0xfaafe3['uniqueid']][_0x66ca('0x1f')]=this[_0x66ca('0xb')][_0xfaafe3['uniqueid']]['name'];}logger['info'](_0xfaafe3[_0x66ca('0x1d')],this[_0x66ca('0xb')][_0xfaafe3['uniqueid']]?_0x66ca('0x4d'):_0x66ca('0x4e'),JSON['stringify'](this[_0x66ca('0x1c')][_0xfaafe3[_0x66ca('0x1d')]]));if(this[_0x66ca('0xb')][_0xfaafe3[_0x66ca('0x1d')]]){if(this[_0x66ca('0x1c')][_0xfaafe3[_0x66ca('0x1d')]][_0x66ca('0x4f')]>0x0&&this[_0x66ca('0x1c')][_0xfaafe3[_0x66ca('0x1d')]][_0x66ca('0x50')]==='SUCCESS'){this[_0x66ca('0x49')](_0xfaafe3[_0x66ca('0x1d')],!![]);}else{this[_0x66ca('0x49')](_0xfaafe3[_0x66ca('0x1d')],![],this[_0x66ca('0x1c')][_0xfaafe3['uniqueid']][_0x66ca('0x51')]?'SENDING\x20FAILED:\x20'+this[_0x66ca('0x1c')][_0xfaafe3[_0x66ca('0x1d')]][_0x66ca('0x51')]:_0x66ca('0x52'));}}}};Fax['prototype']['send']=function(_0x412fc5){var _0x469531=this;return new BPromise(function(_0x52c603,_0x542da9){_0x469531[_0x66ca('0x53')](_0x412fc5,_0x469531[_0x66ca('0x9')][_0x412fc5[_0x66ca('0x54')]])[_0x66ca('0x36')](function(_0x5becc5){ut[_0x66ca('0x45')](_0x66ca('0x55'),_0x5becc5);_0x52c603(ut[_0x66ca('0x32')](_0x66ca('0x56')));})[_0x66ca('0x39')](function(_0x5adf07){ut['logger'](_0x66ca('0x57'),_0x5adf07);updateStatus(_0x412fc5);_0x542da9(ut[_0x66ca('0x32')]('Fax\x20failed'));});});};Fax[_0x66ca('0x18')][_0x66ca('0x58')]=function(_0x33544e){var _0x43fe79=this;return new BPromise(function(_0x3d92b2,_0xb0c86c){var _0x23dd2a=_0x43fe79[_0x66ca('0x59')](_0x43fe79[_0x66ca('0x9')][_0x33544e[_0x66ca('0x54')]][_0x66ca('0x5a')],_0x33544e);if(_0x23dd2a[_0x66ca('0x5b')]){_0x3d92b2(ut['message'](_0x66ca('0x5c')));}else{_0xb0c86c(ut[_0x66ca('0x32')](_0x23dd2a[_0x66ca('0x32')]));}});};function originate(_0x4c23a4,_0x2f5faf,_0x281487){return new BPromise(function(_0x3415ae,_0x2531e5){if(_0x281487){var _0x31a0c5=util['format'](_0x66ca('0x5d'),path[_0x66ca('0x34')](_0x4c23a4[_0x66ca('0x2')])[_0x66ca('0x1f')],_0x4c23a4['path']);gs[_0x66ca('0x5e')](_0x31a0c5)['then'](function(){_0x4c23a4[_0x66ca('0x2')]=util[_0x66ca('0x5f')](_0x66ca('0x60'),path[_0x66ca('0x34')](_0x4c23a4[_0x66ca('0x2')])[_0x66ca('0x61')],path[_0x66ca('0x34')](_0x4c23a4[_0x66ca('0x2')])[_0x66ca('0x1f')]);_0x2f5faf[_0x66ca('0x62')]=_0x4c23a4[_0x66ca('0x2')];ut[_0x66ca('0x45')]('Convert\x20pdf\x20to\x20tif','');ami[_0x66ca('0x63')](ut[_0x66ca('0x64')](_0x4c23a4,_0x2f5faf))['then'](function(_0x136a94){_0x3415ae(_0x136a94);})[_0x66ca('0x39')](function(_0x543cc8){_0x2531e5(_0x543cc8);});})[_0x66ca('0x39')](function(_0x58c64e){_0x2531e5(_0x58c64e);});}else{ami[_0x66ca('0x63')](ut[_0x66ca('0x64')](_0x4c23a4,_0x2f5faf))['then'](function(_0x85963a){_0x3415ae(_0x85963a);})[_0x66ca('0x39')](function(_0x71cab9){_0x2531e5(_0x71cab9);});}});}Fax['prototype'][_0x66ca('0x53')]=function(_0x251767,_0x1888e4){var _0x361ec2=this;return new BPromise(function(_0x4bd351,_0x3f6120){var _0x3ba096=uuid['v4']();var _0x39445a=ut['addVariables'](_0x251767,_0x1888e4);_0x361ec2['actions'][_0x3ba096]=new Action(_0x3ba096,_0x1888e4,_0x251767);var _0x16de95=_0x361ec2[_0x66ca('0xb')][_0x3ba096];if(path['parse'](_0x251767[_0x66ca('0x2')])['ext']===_0x66ca('0x38')){originate(_0x16de95,_0x39445a,!![])[_0x66ca('0x36')](function(_0x2abb23){_0x4bd351(_0x2abb23);})['catch'](function(_0x3db91a){_0x3f6120(_0x3db91a);});}else{originate(_0x16de95,_0x39445a,![])[_0x66ca('0x36')](function(_0x57a85d){_0x4bd351(_0x57a85d);})[_0x66ca('0x39')](function(_0x403579){_0x3f6120(_0x403579);});}});};Fax[_0x66ca('0x18')]['isTrunkReachable']=function(_0x277e1f){return!_['isNil'](_0x277e1f)&&!_[_0x66ca('0x65')](_0x277e1f[_0x66ca('0x1f')])&&!_[_0x66ca('0x65')](_0x277e1f[_0x66ca('0x66')])&&_0x277e1f[_0x66ca('0x66')]&&!_['isNil'](this['trunks'][util[_0x66ca('0x5f')](_0x66ca('0x67'),_0x277e1f[_0x66ca('0x1f')])])&&!_[_0x66ca('0x65')](this['trunks'][util[_0x66ca('0x5f')]('SIP/%s',_0x277e1f[_0x66ca('0x1f')])][_0x66ca('0x27')])&&(this[_0x66ca('0xa')][util[_0x66ca('0x5f')](_0x66ca('0x67'),_0x277e1f[_0x66ca('0x1f')])][_0x66ca('0x27')]===_0x66ca('0x68')||this[_0x66ca('0xa')][util[_0x66ca('0x5f')](_0x66ca('0x67'),_0x277e1f[_0x66ca('0x1f')])][_0x66ca('0x27')]==='unmonitored');};Fax[_0x66ca('0x18')]['checkTrunk']=function(_0xacd185,_0x3a641f){if(!this[_0x66ca('0x69')](_0xacd185)){ut['logger'](_0x66ca('0x6a'),_[_0x66ca('0x65')](_0xacd185)?'':_0xacd185[_0x66ca('0x1f')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x66ca('0x65')](_0x3a641f[_0x66ca('0x4')])){ut[_0x66ca('0x45')](_0x66ca('0x6b'),JSON[_0x66ca('0x3c')](_0x3a641f));return{'isValid':![],'message':_0x66ca('0x6c')};}if(_[_0x66ca('0x65')](_0x3a641f['path'])){ut[_0x66ca('0x45')](_0x66ca('0x6d'),JSON['stringify'](_0x3a641f));return{'isValid':![],'message':_0x66ca('0x6e')};}return{'isValid':!![],'message':_0x66ca('0x6f')};};module[_0x66ca('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 64b4849..1ea2a8e 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 _0xfd07=['lodash','inspect','resolve','then','notify','util','bluebird','../../../config/logger','preview'];(function(_0x20606c,_0x3db4b0){var _0x949af=function(_0x5995bc){while(--_0x5995bc){_0x20606c['push'](_0x20606c['shift']());}};_0x949af(++_0x3db4b0);}(_0xfd07,0x113));var _0x7fd0=function(_0x14f132,_0x4cf31e){_0x14f132=_0x14f132-0x0;var _0x24bf39=_0xfd07[_0x14f132];return _0x24bf39;};'use strict';var util=require(_0x7fd0('0x0'));var BPromise=require(_0x7fd0('0x1'));var logger=require(_0x7fd0('0x2'))(_0x7fd0('0x3'));var _=require(_0x7fd0('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x24f30b){return function(_0x1f8e00){logger['error'](_0x24f30b,util[_0x7fd0('0x5')](_0x1f8e00,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3ea406,_0x253ecf){return BPromise[_0x7fd0('0x6')]()[_0x7fd0('0x7')](faxAccount[_0x7fd0('0x8')](_0x3ea406,_0x253ecf))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xa001=['error','inspect','then','notify','catch','[Notify]\x20','util','preview','lodash','../rpc/faxAccount'];(function(_0x4f9939,_0x56fa3b){var _0x5e8326=function(_0x46752d){while(--_0x46752d){_0x4f9939['push'](_0x4f9939['shift']());}};_0x5e8326(++_0x56fa3b);}(_0xa001,0x18c));var _0x1a00=function(_0x40650a,_0x3f3622){_0x40650a=_0x40650a-0x0;var _0x34f48f=_0xa001[_0x40650a];return _0x34f48f;};'use strict';var util=require(_0x1a00('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x1a00('0x1'));var _=require(_0x1a00('0x2'));var faxAccount=require(_0x1a00('0x3'));function loggerCatch(_0x4b9280){return function(_0x58ff8d){logger[_0x1a00('0x4')](_0x4b9280,util[_0x1a00('0x5')](_0x58ff8d,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0xffd59e,_0x5a1781){return BPromise['resolve']()[_0x1a00('0x6')](faxAccount[_0x1a00('0x7')](_0xffd59e,_0x5a1781))[_0x1a00('0x8')](loggerCatch(_0x1a00('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index ae759e2..a460d76 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 _0xaaf5=['util','../../../../config/logger','fax','bluebird','info','Exec\x20gs'];(function(_0x57b2db,_0x413803){var _0x288f48=function(_0x5dedc3){while(--_0x5dedc3){_0x57b2db['push'](_0x57b2db['shift']());}};_0x288f48(++_0x413803);}(_0xaaf5,0x7e));var _0x5aaf=function(_0x31152f,_0x145537){_0x31152f=_0x31152f-0x0;var _0x10dd3b=_0xaaf5[_0x31152f];return _0x10dd3b;};'use strict';var util=require(_0x5aaf('0x0'));var logger=require(_0x5aaf('0x1'))(_0x5aaf('0x2'));var BPromise=require(_0x5aaf('0x3'));var exec=require('child_process')['exec'];exports['execute']=function(_0x4ed3a4){return new BPromise(function(_0x20a9f6,_0x342908){exec(_0x4ed3a4,function(_0x253f52,_0x4b4758,_0x5b1f81){logger[_0x5aaf('0x4')](_0x5aaf('0x5'),_0x4b4758);if(_0x253f52){logger[_0x5aaf('0x4')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x253f52,{'showHidden':![],'depth':null}),_0x4b4758,_0x5b1f81);_0x342908(_0x253f52);}_0x20a9f6(_0x4b4758);});});}; \ No newline at end of file +var _0xfdaa=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x23e346,_0x2ffc96){var _0x58fd5a=function(_0x47052e){while(--_0x47052e){_0x23e346['push'](_0x23e346['shift']());}};_0x58fd5a(++_0x2ffc96);}(_0xfdaa,0x161));var _0xafda=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xfdaa[_0x44f974];return _0x805dbd;};'use strict';var util=require(_0xafda('0x0'));var logger=require(_0xafda('0x1'))(_0xafda('0x2'));var BPromise=require(_0xafda('0x3'));var exec=require(_0xafda('0x4'))[_0xafda('0x5')];exports[_0xafda('0x6')]=function(_0x1057ed){return new BPromise(function(_0x4443c0,_0x460f2c){exec(_0x1057ed,function(_0x123cc3,_0x5c4e99,_0x3f2f38){logger[_0xafda('0x7')](_0xafda('0x8'),_0x5c4e99);if(_0x123cc3){logger['info'](_0xafda('0x8'),_0xafda('0x9'),util[_0xafda('0xa')](_0x123cc3,{'showHidden':![],'depth':null}),_0x5c4e99,_0x3f2f38);_0x460f2c(_0x123cc3);}_0x4443c0(_0x5c4e99);});});}; \ 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 b816dc0..833e38f 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 _0x0fd9=['info','inspect','addVariables','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','format','headerinfo','lodash','moment','../../../../config/logger','fax','logger'];(function(_0x22fe5c,_0x28645c){var _0x17a217=function(_0x1306f0){while(--_0x1306f0){_0x22fe5c['push'](_0x22fe5c['shift']());}};_0x17a217(++_0x28645c);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0x0fd9[_0x1fd9e7];return _0x1781f2;};'use strict';var util=require('util');var _=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var logger=require(_0x90fd('0x2'))(_0x90fd('0x3'));exports['message']=function(_0x4acbd9){return{'message':_0x4acbd9};};exports[_0x90fd('0x4')]=function(_0x2a5f76,_0xb7cf6){logger[_0x90fd('0x5')](_0x2a5f76,util[_0x90fd('0x6')](_0xb7cf6,{'showHidden':![],'depth':null}));};exports[_0x90fd('0x7')]=function(_0x5e2107,_0x4ff2d4){var _0x128c17={'XMF-ECM':_0x4ff2d4['ecm'],'XMF-HEADERINFO':_0x4ff2d4['headerinfo'],'XMF-MINRATE':_0x4ff2d4[_0x90fd('0x8')],'XMF-MAXRATE':_0x4ff2d4[_0x90fd('0x9')],'XMF-MODEM':util['format'](_0x90fd('0xa'),_0x4ff2d4[_0x90fd('0xb')]),'XMF-GATEWAY':_0x4ff2d4[_0x90fd('0xc')],'XMF-FAXDETECT':_0x4ff2d4[_0x90fd('0xd')],'XMF-T38TIMEOUT':_0x4ff2d4[_0x90fd('0xe')],'XMF-LOCALSTATIONID':_0x4ff2d4[_0x90fd('0xf')],'XMF-PATH':_0x5e2107[_0x90fd('0x10')]};return _0x128c17;};exports[_0x90fd('0x11')]=function(_0x3c541e,_0x48943e){return{'actionid':_0x3c541e[_0x90fd('0x12')],'action':_0x90fd('0x13'),'channel':_0x3c541e['channel'],'Exten':_0x90fd('0x14'),'Context':_0x90fd('0x15'),'Priority':'1','callerid':util[_0x90fd('0x16')]('\x22%s\x22\x20<%s>',_0x3c541e[_0x90fd('0x17')]?_0x3c541e['headerinfo']:'',_0x3c541e[_0x90fd('0xf')]),'variable':_0x48943e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3c541e[_0x90fd('0x12')]};}; \ No newline at end of file +var _0xe706=['\x22%s\x22\x20<%s>','util','lodash','moment','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x43a636,_0x502e32){var _0x39b8b1=function(_0x240d24){while(--_0x240d24){_0x43a636['push'](_0x43a636['shift']());}};_0x39b8b1(++_0x502e32);}(_0xe706,0xa3));var _0x6e70=function(_0x2128d3,_0x420dfa){_0x2128d3=_0x2128d3-0x0;var _0x49fa00=_0xe706[_0x2128d3];return _0x49fa00;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var logger=require('../../../../config/logger')(_0x6e70('0x3'));exports[_0x6e70('0x4')]=function(_0x2ca810){return{'message':_0x2ca810};};exports[_0x6e70('0x5')]=function(_0x142c27,_0x2164a4){logger[_0x6e70('0x6')](_0x142c27,util[_0x6e70('0x7')](_0x2164a4,{'showHidden':![],'depth':null}));};exports[_0x6e70('0x8')]=function(_0x4381d1,_0x36357b){var _0x293ce7={'XMF-ECM':_0x36357b[_0x6e70('0x9')],'XMF-HEADERINFO':_0x36357b[_0x6e70('0xa')],'XMF-MINRATE':_0x36357b[_0x6e70('0xb')],'XMF-MAXRATE':_0x36357b[_0x6e70('0xc')],'XMF-MODEM':util[_0x6e70('0xd')](_0x6e70('0xe'),_0x36357b[_0x6e70('0xf')]),'XMF-GATEWAY':_0x36357b[_0x6e70('0x10')],'XMF-FAXDETECT':_0x36357b[_0x6e70('0x11')],'XMF-T38TIMEOUT':_0x36357b[_0x6e70('0x12')],'XMF-LOCALSTATIONID':_0x36357b[_0x6e70('0x13')],'XMF-PATH':_0x4381d1[_0x6e70('0x14')]};return _0x293ce7;};exports['variablesAction']=function(_0x47f6b2,_0x3594c1){return{'actionid':_0x47f6b2[_0x6e70('0x15')],'action':_0x6e70('0x16'),'channel':_0x47f6b2[_0x6e70('0x17')],'Exten':_0x6e70('0x18'),'Context':_0x6e70('0x19'),'Priority':'1','callerid':util[_0x6e70('0xd')](_0x6e70('0x1a'),_0x47f6b2['headerinfo']?_0x47f6b2['headerinfo']:'',_0x47f6b2['localstationid']),'variable':_0x3594c1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x47f6b2[_0x6e70('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ac255f3..ea6b4f4 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 _0x9101=['initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','getAgents','then','initAgents','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x9101,0x91));var _0x1910=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x9101[_0x5c2e3e];return _0x53f64a;};'use strict';var BPromise=require(_0x1910('0x0'));var util=require(_0x1910('0x1'));var moment=require('moment');var server=require(_0x1910('0x2'));var Realtime=require(_0x1910('0x3'));var Report=require(_0x1910('0x4'));var Acw=require(_0x1910('0x5'));var Trigger=require(_0x1910('0x6'));var Dialer=require(_0x1910('0x7'));var Preview=require(_0x1910('0x8'));var Fax=require(_0x1910('0x9'));var user=require(_0x1910('0xa'));var voiceQueue=require(_0x1910('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x1910('0xc'));var trunk=require(_0x1910('0xd'));var trigger=require(_0x1910('0xe'));var template=require(_0x1910('0xf'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x1910('0x10'));var voiceExtension=require(_0x1910('0x11'));var faxAccount=require(_0x1910('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x1910('0x13'));var sugarcrm=require(_0x1910('0x14'));var freshdesk=require(_0x1910('0x15'));var desk=require(_0x1910('0x16'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x1910('0x17'));var servicenow=require(_0x1910('0x18'));var dynamics365=require(_0x1910('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1910('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1910('0x1a')](_0x1910('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0x1910('0x1c')]())[_0x1910('0x1d')](realtime[_0x1910('0x1e')]())[_0x1910('0x1d')](user['getTelephones']())['then'](realtime['initTelephones']())[_0x1910('0x1d')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x1910('0x1d')](voiceQueue['getVoiceQueues']())[_0x1910('0x1d')](realtime[_0x1910('0x1f')]())['then'](trigger[_0x1910('0x20')]())['then'](realtime[_0x1910('0x21')]())[_0x1910('0x1d')](template['getTemplates']())['then'](realtime[_0x1910('0x22')]())[_0x1910('0x1d')](zendesk[_0x1910('0x23')]())[_0x1910('0x1d')](realtime[_0x1910('0x24')]())[_0x1910('0x1d')](salesforce['getSalesforceAccounts']())[_0x1910('0x1d')](realtime[_0x1910('0x25')]())[_0x1910('0x1d')](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())[_0x1910('0x1d')](freshdesk[_0x1910('0x26')]())['then'](realtime['initFreshdeskAccounts']())[_0x1910('0x1d')](desk[_0x1910('0x27')]())[_0x1910('0x1d')](realtime[_0x1910('0x28')]())['then'](zoho[_0x1910('0x29')]())['then'](realtime['initZohoAccounts']())['then'](vtiger[_0x1910('0x2a')]())[_0x1910('0x1d')](realtime[_0x1910('0x2b')]())[_0x1910('0x1d')](servicenow['getServicenowAccounts']())[_0x1910('0x1d')](realtime[_0x1910('0x2c')]())['then'](dynamics365[_0x1910('0x2d')]())[_0x1910('0x1d')](realtime[_0x1910('0x2e')]())[_0x1910('0x1d')](campaign[_0x1910('0x2f')]())['then'](realtime[_0x1910('0x30')]())[_0x1910('0x1d')](voiceExtension[_0x1910('0x31')]())[_0x1910('0x1d')](realtime[_0x1910('0x32')]())[_0x1910('0x1d')](faxAccount[_0x1910('0x33')]())[_0x1910('0x1d')](realtime[_0x1910('0x34')]())[_0x1910('0x1d')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x1910('0x1d')](voiceQueueReport[_0x1910('0x35')]())[_0x1910('0x1d')](realtime[_0x1910('0x36')]())['then'](cmHopperHistory[_0x1910('0x37')]())[_0x1910('0x1d')](realtime[_0x1910('0x38')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x1910('0x1d')](realtime[_0x1910('0x39')]())[_0x1910('0x1d')](voiceCallReport[_0x1910('0x3a')]())[_0x1910('0x1d')](realtime[_0x1910('0x3b')]())[_0x1910('0x1d')](function(_0x236590){})[_0x1910('0x3c')](function(_0x3c389c){console[_0x1910('0x3d')](_0x3c389c);});}function main(){return server['listen'](realtime,preview,fax)[_0x1910('0x1d')](function(_0x3693cf){return initRealtime();})[_0x1910('0x1d')](function(){return initParams();})['then'](function(){report[_0x1910('0x3e')]();setInterval(initRealtime,0x1388);})[_0x1910('0x3c')](function(_0xee4cfc){console[_0x1910('0x3d')](_0xee4cfc);});}main(); \ No newline at end of file +var _0xf5e6=['./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./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/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','log','util','moment','./server','./report'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xf5e6,0x100));var _0x6f5e=function(_0x4dcd4f,_0x652024){_0x4dcd4f=_0x4dcd4f-0x0;var _0x184487=_0xf5e6[_0x4dcd4f];return _0x184487;};'use strict';var BPromise=require('bluebird');var util=require(_0x6f5e('0x0'));var moment=require(_0x6f5e('0x1'));var server=require(_0x6f5e('0x2'));var Realtime=require('./realtime');var Report=require(_0x6f5e('0x3'));var Acw=require(_0x6f5e('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x6f5e('0x5'));var Preview=require(_0x6f5e('0x6'));var Fax=require(_0x6f5e('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x6f5e('0x8'));var voiceQueueReport=require(_0x6f5e('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x6f5e('0xa'));var template=require('./rpc/template');var cmHopperHistory=require(_0x6f5e('0xb'));var campaign=require(_0x6f5e('0xc'));var voiceExtension=require(_0x6f5e('0xd'));var faxAccount=require(_0x6f5e('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6f5e('0xf'));var freshdesk=require(_0x6f5e('0x10'));var desk=require(_0x6f5e('0x11'));var zoho=require(_0x6f5e('0x12'));var vtiger=require(_0x6f5e('0x13'));var servicenow=require(_0x6f5e('0x14'));var dynamics365=require(_0x6f5e('0x15'));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()[_0x6f5e('0x16')](_0x6f5e('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6f5e('0x16')](_0x6f5e('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6f5e('0x18')]()[_0x6f5e('0x19')](user[_0x6f5e('0x1a')]())[_0x6f5e('0x19')](realtime['initAgents']())[_0x6f5e('0x19')](user[_0x6f5e('0x1b')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x1c')]())[_0x6f5e('0x19')](trunk[_0x6f5e('0x1d')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x1e')]())[_0x6f5e('0x19')](voiceQueue['getVoiceQueues']())[_0x6f5e('0x19')](realtime[_0x6f5e('0x1f')]())['then'](trigger[_0x6f5e('0x20')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x21')]())['then'](template[_0x6f5e('0x22')]())[_0x6f5e('0x19')](realtime['initTemplates']())['then'](zendesk[_0x6f5e('0x23')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x24')]())[_0x6f5e('0x19')](salesforce[_0x6f5e('0x25')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x26')]())[_0x6f5e('0x19')](sugarcrm[_0x6f5e('0x27')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x28')]())[_0x6f5e('0x19')](freshdesk[_0x6f5e('0x29')]())[_0x6f5e('0x19')](realtime['initFreshdeskAccounts']())[_0x6f5e('0x19')](desk[_0x6f5e('0x2a')]())['then'](realtime[_0x6f5e('0x2b')]())[_0x6f5e('0x19')](zoho[_0x6f5e('0x2c')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x2d')]())['then'](vtiger[_0x6f5e('0x2e')]())[_0x6f5e('0x19')](realtime['initVtigerAccounts']())['then'](servicenow['getServicenowAccounts']())['then'](realtime[_0x6f5e('0x2f')]())[_0x6f5e('0x19')](dynamics365[_0x6f5e('0x30')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x31')]())[_0x6f5e('0x19')](campaign[_0x6f5e('0x32')]())['then'](realtime[_0x6f5e('0x33')]())[_0x6f5e('0x19')](voiceExtension['getVoiceExtensions']())[_0x6f5e('0x19')](realtime[_0x6f5e('0x34')]())['then'](faxAccount[_0x6f5e('0x35')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x36')]())[_0x6f5e('0x19')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x6f5e('0x37')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x38')]())[_0x6f5e('0x19')](cmHopperHistory[_0x6f5e('0x39')]())[_0x6f5e('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x6f5e('0x19')](cmHopperHistory[_0x6f5e('0x3a')]())[_0x6f5e('0x19')](realtime[_0x6f5e('0x3b')]())['then'](voiceCallReport[_0x6f5e('0x3c')]())['then'](realtime[_0x6f5e('0x3d')]())[_0x6f5e('0x19')](function(_0x2a3fb9){})[_0x6f5e('0x3e')](function(_0x394afe){console['log'](_0x394afe);});}function main(){return server[_0x6f5e('0x3f')](realtime,preview,fax)[_0x6f5e('0x19')](function(_0x563908){return initRealtime();})[_0x6f5e('0x19')](function(){return initParams();})[_0x6f5e('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6f5e('0x3e')](function(_0x385aec){console[_0x6f5e('0x40')](_0x385aec);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 809a74c..9df5c30 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 _0x5072=['emit','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','fullname','state','unknown','stateTime','status','phone','mobile','online','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','idle','inuse','talking','statePause','toNumber','format','accountcode','address','voiceStatusQueue','interface'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5072,0x96));var _0x2507=function(_0x14bc91,_0x43cf69){_0x14bc91=_0x14bc91-0x0;var _0x11d715=_0x5072[_0x14bc91];return _0x11d715;};'use strict';var _=require(_0x2507('0x0'));var util=require(_0x2507('0x1'));var moment=require(_0x2507('0x2'));var md5=require(_0x2507('0x3'));var Redis=require(_0x2507('0x4'));var config=require(_0x2507('0x5'));config[_0x2507('0x6')]=_[_0x2507('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2507('0x8'))(new Redis(config['redis']));function Agent(_0x17cc25){this['id']=_0x17cc25['id']||0x0;this[_0x2507('0x9')]=_0x17cc25[_0x2507('0x9')]||'';this[_0x2507('0xa')]=_0x17cc25['email']||'';this['accountcode']=_0x17cc25['accountcode']||'';this[_0x2507('0xb')]=_0x17cc25[_0x2507('0xb')]||'';this[_0x2507('0xc')]=_0x2507('0xd');this[_0x2507('0xe')]=0x0;this[_0x2507('0xf')]=_0x2507('0xd');this['address']='';this[_0x2507('0x10')]='';this[_0x2507('0x11')]='';this['interface']='';this[_0x2507('0x12')]=_0x17cc25[_0x2507('0x12')]||![];this[_0x2507('0x13')]=_0x2507('0xd');this[_0x2507('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x2507('0x15')]=![];this[_0x2507('0x16')]=![];this[_0x2507('0x3')]='';}Agent[_0x2507('0x17')][_0x2507('0x18')]=function(_0x42f476){var _0x320e7c;if(_0x42f476&&_0x42f476[_0x2507('0xc')]){_0x320e7c=_0x42f476[_0x2507('0xc')]['toLowerCase']();switch(_0x320e7c){case'not_inuse':_0x320e7c=_0x2507('0x19');break;case _0x2507('0x1a'):_0x320e7c=_0x2507('0x1b');break;}}if(_0x320e7c&&this[_0x2507('0x13')]!==_0x320e7c||_0x42f476[_0x2507('0x1c')]){this[_0x2507('0x14')]=_[_0x2507('0x1d')](moment()[_0x2507('0x1e')]('x'));}if(_0x320e7c){this[_0x2507('0x13')]=_0x320e7c;}var _0x20eef7={'id':this['id'],'name':this[_0x2507('0x9')],'email':this[_0x2507('0xa')],'accountcode':this[_0x2507('0x1f')],'fullname':this['fullname'],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x2507('0x20')],'online':this[_0x2507('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x2507('0x14')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x2507('0x21')],'interface':this[_0x2507('0x22')],'onhold':this[_0x2507('0x15')]};var _0x2cef54=md5(JSON['stringify'](_0x20eef7));if(this[_0x2507('0x3')]!==_0x2cef54){this[_0x2507('0x3')]=_0x2cef54;io['to'](util[_0x2507('0x1e')]('user:%s',_0x20eef7['name']))[_0x2507('0x23')]('user:save',_0x20eef7);}};module[_0x2507('0x24')]=Agent; \ No newline at end of file +var _0xb156=['state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','stringify','user:%s','emit','lodash','ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb156,0x1a7));var _0x6b15=function(_0x30f63d,_0xf0902b){_0x30f63d=_0x30f63d-0x0;var _0x4f59f4=_0xb156[_0x30f63d];return _0x4f59f4;};'use strict';var _=require(_0x6b15('0x0'));var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require(_0x6b15('0x1'));var config=require('../../../config/environment');config[_0x6b15('0x2')]=_['defaults'](config[_0x6b15('0x2')],{'host':_0x6b15('0x3'),'port':0x18eb});var io=require(_0x6b15('0x4'))(new Redis(config[_0x6b15('0x2')]));function Agent(_0x4c8457){this['id']=_0x4c8457['id']||0x0;this[_0x6b15('0x5')]=_0x4c8457[_0x6b15('0x5')]||'';this['email']=_0x4c8457[_0x6b15('0x6')]||'';this['accountcode']=_0x4c8457[_0x6b15('0x7')]||'';this[_0x6b15('0x8')]=_0x4c8457[_0x6b15('0x8')]||'';this[_0x6b15('0x9')]=_0x6b15('0xa');this[_0x6b15('0xb')]=0x0;this[_0x6b15('0xc')]=_0x6b15('0xa');this[_0x6b15('0xd')]='';this[_0x6b15('0xe')]='';this[_0x6b15('0xf')]='';this[_0x6b15('0x10')]='';this[_0x6b15('0x11')]=_0x4c8457['online']||![];this[_0x6b15('0x12')]='unknown';this[_0x6b15('0x13')]=0x0;this[_0x6b15('0x14')]='';this[_0x6b15('0x15')]='';this[_0x6b15('0x16')]=![];this['local']=![];this[_0x6b15('0x17')]='';}Agent[_0x6b15('0x18')][_0x6b15('0x19')]=function(_0x3fd863){var _0x3bb635;if(_0x3fd863&&_0x3fd863[_0x6b15('0x9')]){_0x3bb635=_0x3fd863[_0x6b15('0x9')][_0x6b15('0x1a')]();switch(_0x3bb635){case _0x6b15('0x1b'):_0x3bb635=_0x6b15('0x1c');break;case _0x6b15('0x1d'):_0x3bb635='talking';break;}}if(_0x3bb635&&this[_0x6b15('0x12')]!==_0x3bb635||_0x3fd863[_0x6b15('0x1e')]){this[_0x6b15('0x13')]=_[_0x6b15('0x1f')](moment()[_0x6b15('0x20')]('x'));}if(_0x3bb635){this[_0x6b15('0x12')]=_0x3bb635;}var _0x352b10={'id':this['id'],'name':this[_0x6b15('0x5')],'email':this[_0x6b15('0x6')],'accountcode':this[_0x6b15('0x7')],'fullname':this[_0x6b15('0x8')],'state':this[_0x6b15('0x9')],'stateTime':this[_0x6b15('0xb')],'status':this[_0x6b15('0xc')],'address':this[_0x6b15('0xd')],'online':this['online'],'voiceStatus':this[_0x6b15('0x12')],'voiceStatusTime':this[_0x6b15('0x13')],'voiceStatusCallerIdNumber':this[_0x6b15('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x6b15('0x10')],'onhold':this[_0x6b15('0x16')]};var _0x239728=md5(JSON[_0x6b15('0x21')](_0x352b10));if(this[_0x6b15('0x17')]!==_0x239728){this[_0x6b15('0x17')]=_0x239728;io['to'](util[_0x6b15('0x20')](_0x6b15('0x22'),_0x352b10[_0x6b15('0x5')]))[_0x6b15('0x23')]('user:save',_0x352b10);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 06c3492..0642925 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 _0x757a=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0x757a,0xde));var _0xa757=function(_0xc6539c,_0x515894){_0xc6539c=_0xc6539c-0x0;var _0x367ffe=_0x757a[_0xc6539c];return _0x367ffe;};'use strict';function Campaign(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['type']=_0x1acf7d['type']||'campaign';this[_0xa757('0x1')]=0x0;this[_0xa757('0x2')]=0x0;this[_0xa757('0x3')]=0x0;this[_0xa757('0x4')]=0x0;this[_0xa757('0x5')]='';this[_0xa757('0x6')]=!![];this['active']=_0x1acf7d[_0xa757('0x7')];this[_0xa757('0x8')]=_0x1acf7d['limitCalls'];this[_0xa757('0x9')]=_0x1acf7d[_0xa757('0x9')]||null;this[_0xa757('0xa')]=_0x1acf7d[_0xa757('0xa')]?_0x1acf7d[_0xa757('0xa')]:null;this['dialOriginateCallerIdName']=_0x1acf7d[_0xa757('0xb')];this[_0xa757('0xc')]=_0x1acf7d[_0xa757('0xc')];this[_0xa757('0xd')]=_0x1acf7d[_0xa757('0xd')]||0x1e;this[_0xa757('0xe')]=_0x1acf7d[_0xa757('0xe')];this['dialCongestionRetryFrequency']=_0x1acf7d['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x1acf7d['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x1acf7d[_0xa757('0xf')];this['dialNoAnswerMaxRetry']=_0x1acf7d['dialNoAnswerMaxRetry'];this[_0xa757('0x10')]=_0x1acf7d['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x1acf7d[_0xa757('0x11')];this[_0xa757('0x12')]=_0x1acf7d[_0xa757('0x12')]||_0xa757('0x13');this[_0xa757('0x14')]=_0x1acf7d[_0xa757('0x14')]||undefined;this[_0xa757('0x15')]=_0x1acf7d[_0xa757('0x15')]||undefined;this[_0xa757('0x16')]=_0x1acf7d[_0xa757('0x16')]||undefined;this['TrunkBackup']=_0x1acf7d[_0xa757('0x17')]?_0x1acf7d[_0xa757('0x17')]:undefined;this[_0xa757('0x18')]=_0x1acf7d['Trunk']?_0x1acf7d['Trunk']:undefined;this[_0xa757('0x19')]=_0x1acf7d[_0xa757('0x19')]?_0x1acf7d[_0xa757('0x19')]:undefined;this[_0xa757('0x1a')]=_0x1acf7d[_0xa757('0x1a')]?_0x1acf7d[_0xa757('0x1a')]:undefined;this['dialQueueProject']=_0x1acf7d[_0xa757('0x1a')]?_0x1acf7d['SquareProject'][_0xa757('0x0')]:undefined;this[_0xa757('0x1b')]=_0x1acf7d[_0xa757('0x1b')]||![];this[_0xa757('0x1c')]=_0x1acf7d['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1acf7d[_0xa757('0x1d')];this[_0xa757('0x1e')]=_0x1acf7d[_0xa757('0x1e')];this[_0xa757('0x1f')]=_0x1acf7d[_0xa757('0x1f')];this[_0xa757('0x20')]=_0x1acf7d[_0xa757('0x20')];this[_0xa757('0x21')]=_0x1acf7d[_0xa757('0x21')];this['dialAMDMaximumNumberOfWords']=_0x1acf7d[_0xa757('0x22')];this['dialAMDSilenceThreshold']=_0x1acf7d[_0xa757('0x23')];this['dialAMDMaximumWordLength']=_0x1acf7d[_0xa757('0x24')];}module[_0xa757('0x25')]=Campaign; \ No newline at end of file +var _0xbaf0=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x4d6efb,_0x30d83c){var _0x35d839=function(_0x5ade95){while(--_0x5ade95){_0x4d6efb['push'](_0x4d6efb['shift']());}};_0x35d839(++_0x30d83c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';function Campaign(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=0x0;this['temp']=0x0;this[_0x0baf('0x4')]=0x0;this[_0x0baf('0x5')]=0x0;this[_0x0baf('0x6')]='';this[_0x0baf('0x7')]=!![];this[_0x0baf('0x8')]=_0x61caa9[_0x0baf('0x8')];this[_0x0baf('0x9')]=_0x61caa9[_0x0baf('0x9')];this[_0x0baf('0xa')]=_0x61caa9['dialTimezone']||null;this[_0x0baf('0xb')]=_0x61caa9['dialGlobalInterval']?_0x61caa9[_0x0baf('0xb')]:null;this[_0x0baf('0xc')]=_0x61caa9[_0x0baf('0xc')];this[_0x0baf('0xd')]=_0x61caa9[_0x0baf('0xd')];this[_0x0baf('0xe')]=_0x61caa9[_0x0baf('0xe')]||0x1e;this[_0x0baf('0xf')]=_0x61caa9[_0x0baf('0xf')];this[_0x0baf('0x10')]=_0x61caa9[_0x0baf('0x10')];this['dialBusyMaxRetry']=_0x61caa9['dialBusyMaxRetry'];this[_0x0baf('0x11')]=_0x61caa9[_0x0baf('0x11')];this[_0x0baf('0x12')]=_0x61caa9[_0x0baf('0x12')];this['dialNoAnswerRetryFrequency']=_0x61caa9[_0x0baf('0x13')];this['dialGlobalMaxRetry']=_0x61caa9[_0x0baf('0x14')];this[_0x0baf('0x15')]=_0x61caa9[_0x0baf('0x15')]||_0x0baf('0x16');this[_0x0baf('0x17')]=_0x61caa9[_0x0baf('0x17')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x61caa9['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0baf('0x18')]=_0x61caa9[_0x0baf('0x18')]||undefined;this[_0x0baf('0x19')]=_0x61caa9[_0x0baf('0x19')]?_0x61caa9[_0x0baf('0x19')]:undefined;this[_0x0baf('0x1a')]=_0x61caa9['Trunk']?_0x61caa9[_0x0baf('0x1a')]:undefined;this[_0x0baf('0x1b')]=_0x61caa9[_0x0baf('0x1b')]?_0x61caa9[_0x0baf('0x1b')]:undefined;this[_0x0baf('0x1c')]=_0x61caa9[_0x0baf('0x1c')]?_0x61caa9['SquareProject']:undefined;this['dialQueueProject']=_0x61caa9[_0x0baf('0x1c')]?_0x61caa9[_0x0baf('0x1c')][_0x0baf('0x0')]:undefined;this[_0x0baf('0x1d')]=_0x61caa9[_0x0baf('0x1d')]||![];this[_0x0baf('0x1e')]=_0x61caa9[_0x0baf('0x1e')];this[_0x0baf('0x1f')]=_0x61caa9[_0x0baf('0x1f')];this[_0x0baf('0x20')]=_0x61caa9['dialAMDAfterGreetingSilence'];this[_0x0baf('0x21')]=_0x61caa9['dialAMDTotalAnalysisTime'];this[_0x0baf('0x22')]=_0x61caa9['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x61caa9[_0x0baf('0x23')];this['dialAMDMaximumNumberOfWords']=_0x61caa9['dialAMDMaximumNumberOfWords'];this[_0x0baf('0x24')]=_0x61caa9[_0x0baf('0x24')];this[_0x0baf('0x25')]=_0x61caa9[_0x0baf('0x25')];}module[_0x0baf('0x26')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 934192c..d283453 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 _0x5ec3=['tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5ec3,0xf2));var _0x35ec=function(_0x5ea301,_0x5f1ad6){_0x5ea301=_0x5ea301-0x0;var _0x19f09d=_0x5ec3[_0x5ea301];return _0x19f09d;};'use strict';function Channel(){this[_0x35ec('0x0')]=null;this['channel']='';this[_0x35ec('0x1')]='';this[_0x35ec('0x2')]=0x0;this['calleridname']='';this[_0x35ec('0x3')]=undefined;this[_0x35ec('0x4')]=undefined;this['accountcode']=0x0;this[_0x35ec('0x5')]='';this[_0x35ec('0x6')]=0x0;this[_0x35ec('0x7')]=0x0;this[_0x35ec('0x8')]=0x0;this[_0x35ec('0x9')]=![];this[_0x35ec('0xa')]=null;this[_0x35ec('0xb')]=null;this[_0x35ec('0xc')]=![];this[_0x35ec('0xd')]=![];this['lastapplication']='';this[_0x35ec('0xe')]='';this[_0x35ec('0xf')]=0x0;this[_0x35ec('0x10')]=0x0;this[_0x35ec('0x11')]=0x0;this['type']=null;this[_0x35ec('0x12')]=null;this[_0x35ec('0x13')]=null;this['monitor']=![];this[_0x35ec('0x14')]=null;this[_0x35ec('0x15')]=null;this[_0x35ec('0x16')]=[];this[_0x35ec('0x17')]=undefined;this[_0x35ec('0x18')]=undefined;this['mohtime']=0x0;}module[_0x35ec('0x19')]=Channel; \ No newline at end of file +var _0x707b=['transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridname','accountcode','context','uniqueid','linkedid','exten','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','monitor','queue','monitors','transfercalleridnum'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0x707b,0xdf));var _0xb707=function(_0x992fd0,_0x53feeb){_0x992fd0=_0x992fd0-0x0;var _0x5a4785=_0x707b[_0x992fd0];return _0x5a4785;};'use strict';function Channel(){this[_0xb707('0x0')]=null;this[_0xb707('0x1')]='';this[_0xb707('0x2')]='';this['calleridnum']=0x0;this[_0xb707('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xb707('0x4')]=0x0;this[_0xb707('0x5')]='';this[_0xb707('0x6')]=0x0;this[_0xb707('0x7')]=0x0;this[_0xb707('0x8')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0xb707('0x9')]=![];this[_0xb707('0xa')]=![];this[_0xb707('0xb')]='';this[_0xb707('0xc')]='';this['duration']=0x0;this[_0xb707('0xd')]=0x0;this[_0xb707('0xe')]=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0xb707('0xf')]=![];this['monitorFilename']=null;this[_0xb707('0x10')]=null;this[_0xb707('0x11')]=[];this[_0xb707('0x12')]=undefined;this[_0xb707('0x13')]=undefined;this[_0xb707('0x14')]=0x0;}module[_0xb707('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 432f921..34523a4 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 _0x6dac=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x3346f0,_0x48b0fc){var _0x47c04d=function(_0x5b9abc){while(--_0x5b9abc){_0x3346f0['push'](_0x3346f0['shift']());}};_0x47c04d(++_0x48b0fc);}(_0x6dac,0x16e));var _0xc6da=function(_0x374041,_0x30468f){_0x374041=_0x374041-0x0;var _0x119c5b=_0x6dac[_0x374041];return _0x119c5b;};'use strict';function DeskAccount(_0x2b8222){this['id']=_0x2b8222['id']||0x0;this[_0xc6da('0x0')]=_0x2b8222[_0xc6da('0x0')]||'';this[_0xc6da('0x1')]=_0x2b8222[_0xc6da('0x1')]||'';this[_0xc6da('0x2')]=_0x2b8222[_0xc6da('0x2')]||'';this[_0xc6da('0x3')]=_0x2b8222[_0xc6da('0x3')]||'';this[_0xc6da('0x4')]=_0x2b8222[_0xc6da('0x4')]||'';this[_0xc6da('0x5')]=_0x2b8222[_0xc6da('0x5')]||'';this['consumerSecret']=_0x2b8222[_0xc6da('0x6')]||'';this[_0xc6da('0x7')]=_0x2b8222[_0xc6da('0x7')]||'';this[_0xc6da('0x8')]=_0x2b8222[_0xc6da('0x8')]||'';this[_0xc6da('0x9')]=_0x2b8222[_0xc6da('0x9')]||'';this[_0xc6da('0xa')]=_0x2b8222[_0xc6da('0xa')]||'';this['Configurations']=_0x2b8222[_0xc6da('0xb')]||{};}module[_0xc6da('0xc')]=DeskAccount; \ No newline at end of file +var _0x14f5=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x4c1f09,_0x480653){var _0x19b13a=function(_0x567bf6){while(--_0x567bf6){_0x4c1f09['push'](_0x4c1f09['shift']());}};_0x19b13a(++_0x480653);}(_0x14f5,0xae));var _0x514f=function(_0x3ea5ca,_0x5ae94e){_0x3ea5ca=_0x3ea5ca-0x0;var _0x29f55e=_0x14f5[_0x3ea5ca];return _0x29f55e;};'use strict';function DeskAccount(_0x356f2f){this['id']=_0x356f2f['id']||0x0;this[_0x514f('0x0')]=_0x356f2f['name']||'';this[_0x514f('0x1')]=_0x356f2f[_0x514f('0x1')]||'';this[_0x514f('0x2')]=_0x356f2f['remoteUri']||'';this[_0x514f('0x3')]=_0x356f2f[_0x514f('0x3')]||'';this['password']=_0x356f2f[_0x514f('0x4')]||'';this[_0x514f('0x5')]=_0x356f2f[_0x514f('0x5')]||'';this[_0x514f('0x6')]=_0x356f2f[_0x514f('0x6')]||'';this[_0x514f('0x7')]=_0x356f2f[_0x514f('0x7')]||'';this['tokenSecret']=_0x356f2f[_0x514f('0x8')]||'';this['type']=_0x356f2f[_0x514f('0x9')]||'';this[_0x514f('0xa')]=_0x356f2f[_0x514f('0xa')]||'';this[_0x514f('0xb')]=_0x356f2f[_0x514f('0xb')]||{};}module[_0x514f('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 2b24d6b..3b7c661 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 _0xae1d=['serverUrl','Configurations','exports','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x275d42,_0x2fa726){var _0x1382ca=function(_0x1468b2){while(--_0x1468b2){_0x275d42['push'](_0x275d42['shift']());}};_0x1382ca(++_0x2fa726);}(_0xae1d,0xb3));var _0xdae1=function(_0x4250b4,_0x3fd543){_0x4250b4=_0x4250b4-0x0;var _0x8a4807=_0xae1d[_0x4250b4];return _0x8a4807;};'use strict';function Dynamics365Account(_0x2e7b22){this['id']=_0x2e7b22['id']||0x0;this['name']=_0x2e7b22['name']||'';this['username']=_0x2e7b22['username']||'';this[_0xdae1('0x0')]=_0x2e7b22[_0xdae1('0x0')]||'';this[_0xdae1('0x1')]=_0x2e7b22[_0xdae1('0x1')]||'';this[_0xdae1('0x2')]=_0x2e7b22[_0xdae1('0x2')]||'';this[_0xdae1('0x3')]=_0x2e7b22[_0xdae1('0x3')]||'';this[_0xdae1('0x4')]=_0x2e7b22[_0xdae1('0x4')]||{};this[_0xdae1('0x5')]=_0x2e7b22[_0xdae1('0x5')]||'';this['Configurations']=_0x2e7b22[_0xdae1('0x6')]||{};}module[_0xdae1('0x7')]=Dynamics365Account; \ No newline at end of file +var _0xd62a=['clientId','clientSecret','serverUrl','Configurations','name','username','password','remoteUri','tenantId'];(function(_0x127b52,_0x5ef4e4){var _0x49025b=function(_0x5e6d30){while(--_0x5e6d30){_0x127b52['push'](_0x127b52['shift']());}};_0x49025b(++_0x5ef4e4);}(_0xd62a,0x187));var _0xad62=function(_0x400070,_0x202875){_0x400070=_0x400070-0x0;var _0x3187b6=_0xd62a[_0x400070];return _0x3187b6;};'use strict';function Dynamics365Account(_0x56931d){this['id']=_0x56931d['id']||0x0;this[_0xad62('0x0')]=_0x56931d[_0xad62('0x0')]||'';this[_0xad62('0x1')]=_0x56931d[_0xad62('0x1')]||'';this[_0xad62('0x2')]=_0x56931d[_0xad62('0x2')]||'';this[_0xad62('0x3')]=_0x56931d[_0xad62('0x3')]||'';this[_0xad62('0x4')]=_0x56931d[_0xad62('0x4')]||'';this[_0xad62('0x5')]=_0x56931d['clientId']||'';this[_0xad62('0x6')]=_0x56931d[_0xad62('0x6')]||{};this['serverUrl']=_0x56931d[_0xad62('0x7')]||'';this[_0xad62('0x8')]=_0x56931d['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 1295e50..6af2e7c 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 _0x2791=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2791,0x100));var _0x1279=function(_0x40834d,_0x1ca59c){_0x40834d=_0x40834d-0x0;var _0x42e84c=_0x2791[_0x40834d];return _0x42e84c;};'use strict';function FaxAccount(_0xb5ddb4){this['id']=_0xb5ddb4['id']||0x0;this[_0x1279('0x0')]=_0xb5ddb4[_0x1279('0x0')]||'';this[_0x1279('0x1')]=_0xb5ddb4['description'];this[_0x1279('0x2')]=_0xb5ddb4[_0x1279('0x2')];this[_0x1279('0x3')]=_0xb5ddb4[_0x1279('0x3')];this[_0x1279('0x4')]=_0xb5ddb4[_0x1279('0x4')];this[_0x1279('0x5')]=_0xb5ddb4['minrate']||0x960;this['maxrate']=_0xb5ddb4[_0x1279('0x6')]||0x3840;this[_0x1279('0x7')]=_0xb5ddb4[_0x1279('0x7')]||_0x1279('0x8');this[_0x1279('0x9')]=_0xb5ddb4[_0x1279('0x9')]||'no';this[_0x1279('0xa')]=_0xb5ddb4[_0x1279('0xa')]||'no';this[_0x1279('0xb')]=_0xb5ddb4[_0x1279('0xb')]||0x1388;this[_0x1279('0xc')]=_0xb5ddb4[_0x1279('0xc')]||_0x1279('0xd');this['Trunk']=_0xb5ddb4[_0x1279('0xe')]?_0xb5ddb4[_0x1279('0xe')]:undefined;this[_0x1279('0xf')]=_0xb5ddb4[_0x1279('0xf')];this[_0x1279('0x10')]=_0xb5ddb4[_0x1279('0x10')];}module[_0x1279('0x11')]=FaxAccount; \ No newline at end of file +var _0x8bdf=['key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x4a55e0,_0x109357){var _0x45de2d=function(_0x4e02a3){while(--_0x4e02a3){_0x4a55e0['push'](_0x4a55e0['shift']());}};_0x45de2d(++_0x109357);}(_0x8bdf,0xfe));var _0xf8bd=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8bdf[_0x126558];return _0x1f6d14;};'use strict';function FaxAccount(_0x4656c2){this['id']=_0x4656c2['id']||0x0;this['name']=_0x4656c2[_0xf8bd('0x0')]||'';this['description']=_0x4656c2[_0xf8bd('0x1')];this['ecm']=_0x4656c2[_0xf8bd('0x2')];this[_0xf8bd('0x3')]=_0x4656c2['headerinfo'];this[_0xf8bd('0x4')]=_0x4656c2['localstationid'];this[_0xf8bd('0x5')]=_0x4656c2[_0xf8bd('0x5')]||0x960;this[_0xf8bd('0x6')]=_0x4656c2[_0xf8bd('0x6')]||0x3840;this['modem']=_0x4656c2[_0xf8bd('0x7')]||_0xf8bd('0x8');this['gateway']=_0x4656c2[_0xf8bd('0x9')]||'no';this['faxdetect']=_0x4656c2[_0xf8bd('0xa')]||'no';this['t38timeout']=_0x4656c2[_0xf8bd('0xb')]||0x1388;this[_0xf8bd('0xc')]=_0x4656c2[_0xf8bd('0xc')]||_0xf8bd('0xd');this[_0xf8bd('0xe')]=_0x4656c2[_0xf8bd('0xe')]?_0x4656c2[_0xf8bd('0xe')]:undefined;this[_0xf8bd('0xf')]=_0x4656c2[_0xf8bd('0xf')];this[_0xf8bd('0x10')]=_0x4656c2['key'];}module[_0xf8bd('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d21a840..fc605e6 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 _0x5d7f=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x44ba24,_0x1afac7){var _0x373f97=function(_0x183f1a){while(--_0x183f1a){_0x44ba24['push'](_0x44ba24['shift']());}};_0x373f97(++_0x1afac7);}(_0x5d7f,0x105));var _0xf5d7=function(_0x293aad,_0x496e55){_0x293aad=_0x293aad-0x0;var _0x36a498=_0x5d7f[_0x293aad];return _0x36a498;};'use strict';function FreshdeskAccount(_0x38a50f){this['id']=_0x38a50f['id']||0x0;this[_0xf5d7('0x0')]=_0x38a50f[_0xf5d7('0x0')]||'';this[_0xf5d7('0x1')]=_0x38a50f['username']||'';this[_0xf5d7('0x2')]=_0x38a50f[_0xf5d7('0x3')]||'';this[_0xf5d7('0x4')]=_0x38a50f['remoteUri']||'';this[_0xf5d7('0x5')]=_0x38a50f[_0xf5d7('0x5')]||'';this[_0xf5d7('0x6')]=_0x38a50f['Configurations']||{};}module[_0xf5d7('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x71f0=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5e0761,_0x5a8d69){var _0x956f81=function(_0x21aeb7){while(--_0x21aeb7){_0x5e0761['push'](_0x5e0761['shift']());}};_0x956f81(++_0x5a8d69);}(_0x71f0,0x1c7));var _0x071f=function(_0x205b46,_0x3ca65b){_0x205b46=_0x205b46-0x0;var _0x2b6ae8=_0x71f0[_0x205b46];return _0x2b6ae8;};'use strict';function FreshdeskAccount(_0x7e0b3d){this['id']=_0x7e0b3d['id']||0x0;this[_0x071f('0x0')]=_0x7e0b3d[_0x071f('0x0')]||'';this[_0x071f('0x1')]=_0x7e0b3d[_0x071f('0x1')]||'';this['apiKey']=_0x7e0b3d['token']||'';this['remoteUri']=_0x7e0b3d[_0x071f('0x2')]||'';this['serverUrl']=_0x7e0b3d[_0x071f('0x3')]||'';this[_0x071f('0x4')]=_0x7e0b3d['Configurations']||{};}module[_0x071f('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a8d9988..b8e2d4e 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 _0x02f7=['queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','assigned','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue'];(function(_0x48aeb0,_0x1163c4){var _0x291776=function(_0x2d83e7){while(--_0x2d83e7){_0x48aeb0['push'](_0x48aeb0['shift']());}};_0x291776(++_0x1163c4);}(_0x02f7,0x1f3));var _0x702f=function(_0x40433a,_0x2c9bd9){_0x40433a=_0x40433a-0x0;var _0x41d7f4=_0x02f7[_0x40433a];return _0x41d7f4;};'use strict';function QueueReport(){this[_0x702f('0x0')]=_0x702f('0x1');this['uniqueid']='';this[_0x702f('0x2')]='';this[_0x702f('0x3')]='';this[_0x702f('0x4')]='';this[_0x702f('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x702f('0x6')]=0x1;this[_0x702f('0x7')]=![];this[_0x702f('0x8')]=null;this[_0x702f('0x9')]=![];this[_0x702f('0xa')]=null;this['queuecallerexit']=![];this[_0x702f('0xb')]=null;this[_0x702f('0xc')]=0x1;this[_0x702f('0xd')]='';this[_0x702f('0xe')]='';this[_0x702f('0xf')]='';this[_0x702f('0x10')]='';this[_0x702f('0x11')]='';this[_0x702f('0x12')]='';this['priority']='';this[_0x702f('0x13')]=0x0;this[_0x702f('0x14')]=![];this['lastAssignedTo']='';this[_0x702f('0x15')]=0x0;this[_0x702f('0x16')]={};}module[_0x702f('0x17')]=QueueReport; \ No newline at end of file +var _0x2d28=['count','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten','priority','holdtime','assigned','variables','type','inbound','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x2616bc,_0x41c5e3){var _0x58e842=function(_0x2ac3b3){while(--_0x2ac3b3){_0x2616bc['push'](_0x2616bc['shift']());}};_0x58e842(++_0x41c5e3);}(_0x2d28,0x1be));var _0x82d2=function(_0xbf1875,_0x34b144){_0xbf1875=_0xbf1875-0x0;var _0x2e598b=_0x2d28[_0xbf1875];return _0x2e598b;};'use strict';function QueueReport(){this[_0x82d2('0x0')]=_0x82d2('0x1');this['uniqueid']='';this['calleridnum']='';this['calleridname']='';this['queue']='';this[_0x82d2('0x2')]=null;this[_0x82d2('0x3')]=null;this['position']=0x1;this[_0x82d2('0x4')]=0x1;this[_0x82d2('0x5')]=![];this['queuecallerabandonAt']=null;this[_0x82d2('0x6')]=![];this['queuecallercompleteAt']=null;this[_0x82d2('0x7')]=![];this[_0x82d2('0x8')]=null;this[_0x82d2('0x9')]=0x1;this[_0x82d2('0xa')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x82d2('0xb')]='';this[_0x82d2('0xc')]='';this[_0x82d2('0xd')]='';this[_0x82d2('0xe')]='';this[_0x82d2('0xf')]=0x0;this[_0x82d2('0x10')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0x82d2('0x11')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f82fc0d..29f9c39 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 _0x9390=['type','serverUrl','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x19159d,_0x3d05c8){var _0x35884a=function(_0xe419f8){while(--_0xe419f8){_0x19159d['push'](_0x19159d['shift']());}};_0x35884a(++_0x3d05c8);}(_0x9390,0x119));var _0x0939=function(_0x333628,_0x5efa68){_0x333628=_0x333628-0x0;var _0x2fa29b=_0x9390[_0x333628];return _0x2fa29b;};'use strict';function SalesforceAccount(_0x2b8820){this['id']=_0x2b8820['id']||0x0;this[_0x0939('0x0')]=_0x2b8820['name']||'';this[_0x0939('0x1')]=_0x2b8820[_0x0939('0x1')]||'';this[_0x0939('0x2')]=_0x2b8820['remoteUri']||'';this[_0x0939('0x3')]=_0x2b8820[_0x0939('0x3')]||'';this[_0x0939('0x4')]=_0x2b8820[_0x0939('0x4')]||'';this[_0x0939('0x5')]=_0x2b8820['clientSecret']||'';this[_0x0939('0x6')]=_0x2b8820['securityToken']||'';this[_0x0939('0x7')]=_0x2b8820[_0x0939('0x7')]||'integrationTab';this[_0x0939('0x8')]=_0x2b8820[_0x0939('0x8')]||'';this['Configurations']=_0x2b8820['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x3864=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x384041,_0x442be1){var _0x328886=function(_0x38598e){while(--_0x38598e){_0x384041['push'](_0x384041['shift']());}};_0x328886(++_0x442be1);}(_0x3864,0x128));var _0x4386=function(_0x923d0e,_0x5d12ca){_0x923d0e=_0x923d0e-0x0;var _0x769ecd=_0x3864[_0x923d0e];return _0x769ecd;};'use strict';function SalesforceAccount(_0x33dda9){this['id']=_0x33dda9['id']||0x0;this[_0x4386('0x0')]=_0x33dda9[_0x4386('0x0')]||'';this[_0x4386('0x1')]=_0x33dda9[_0x4386('0x1')]||'';this[_0x4386('0x2')]=_0x33dda9[_0x4386('0x2')]||'';this[_0x4386('0x3')]=_0x33dda9[_0x4386('0x3')]||'';this[_0x4386('0x4')]=_0x33dda9[_0x4386('0x4')]||'';this[_0x4386('0x5')]=_0x33dda9[_0x4386('0x5')]||'';this[_0x4386('0x6')]=_0x33dda9[_0x4386('0x6')]||'';this[_0x4386('0x7')]=_0x33dda9[_0x4386('0x7')]||_0x4386('0x8');this[_0x4386('0x9')]=_0x33dda9[_0x4386('0x9')]||'';this[_0x4386('0xa')]=_0x33dda9['Configurations']||{};}module[_0x4386('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 4ecdd4d..b6ebd23 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 _0x2d50=['username','password','serverUrl','Configurations','name'];(function(_0x3e8816,_0x255798){var _0x508d1d=function(_0x49bcba){while(--_0x49bcba){_0x3e8816['push'](_0x3e8816['shift']());}};_0x508d1d(++_0x255798);}(_0x2d50,0xea));var _0x02d5=function(_0x352846,_0x4a4bcb){_0x352846=_0x352846-0x0;var _0x864c9a=_0x2d50[_0x352846];return _0x864c9a;};'use strict';function ServicenowAccount(_0x5794b4){this['id']=_0x5794b4['id']||0x0;this[_0x02d5('0x0')]=_0x5794b4[_0x02d5('0x0')]||'';this[_0x02d5('0x1')]=_0x5794b4['username']||'';this[_0x02d5('0x2')]=_0x5794b4['password']||'';this['remoteUri']=_0x5794b4['remoteUri']||'';this[_0x02d5('0x3')]=_0x5794b4[_0x02d5('0x3')]||'';this['Configurations']=_0x5794b4[_0x02d5('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x8505=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x1bad8a,_0x4a160f){var _0xfa3b6b=function(_0x1abb3a){while(--_0x1abb3a){_0x1bad8a['push'](_0x1bad8a['shift']());}};_0xfa3b6b(++_0x4a160f);}(_0x8505,0xf9));var _0x5850=function(_0x2ce468,_0x1a89e5){_0x2ce468=_0x2ce468-0x0;var _0x43141a=_0x8505[_0x2ce468];return _0x43141a;};'use strict';function ServicenowAccount(_0x3fd115){this['id']=_0x3fd115['id']||0x0;this['name']=_0x3fd115[_0x5850('0x0')]||'';this[_0x5850('0x1')]=_0x3fd115[_0x5850('0x1')]||'';this[_0x5850('0x2')]=_0x3fd115['password']||'';this[_0x5850('0x3')]=_0x3fd115[_0x5850('0x3')]||'';this['serverUrl']=_0x3fd115[_0x5850('0x4')]||'';this[_0x5850('0x5')]=_0x3fd115[_0x5850('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index b0b46d4..25ef8db 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 _0x6c34=['Configurations','username','password','remoteUri','serverUrl'];(function(_0x14d4c3,_0x57581d){var _0x981d1e=function(_0x3c35e3){while(--_0x3c35e3){_0x14d4c3['push'](_0x14d4c3['shift']());}};_0x981d1e(++_0x57581d);}(_0x6c34,0x1eb));var _0x46c3=function(_0x270fae,_0x1cd880){_0x270fae=_0x270fae-0x0;var _0x4070a9=_0x6c34[_0x270fae];return _0x4070a9;};'use strict';function SugarcrmAccount(_0x22dd7d){this['id']=_0x22dd7d['id']||0x0;this['name']=_0x22dd7d['name']||'';this[_0x46c3('0x0')]=_0x22dd7d[_0x46c3('0x0')]||'';this[_0x46c3('0x1')]=_0x22dd7d[_0x46c3('0x1')]||'';this[_0x46c3('0x2')]=_0x22dd7d[_0x46c3('0x2')]||'';this[_0x46c3('0x3')]=_0x22dd7d[_0x46c3('0x3')]||'';this[_0x46c3('0x4')]=_0x22dd7d[_0x46c3('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x7a05=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0xa940b2,_0x461a65){var _0x109e97=function(_0x51f6e6){while(--_0x51f6e6){_0xa940b2['push'](_0xa940b2['shift']());}};_0x109e97(++_0x461a65);}(_0x7a05,0x168));var _0x57a0=function(_0x55fc1b,_0x16d022){_0x55fc1b=_0x55fc1b-0x0;var _0x26257d=_0x7a05[_0x55fc1b];return _0x26257d;};'use strict';function SugarcrmAccount(_0x25026f){this['id']=_0x25026f['id']||0x0;this[_0x57a0('0x0')]=_0x25026f[_0x57a0('0x0')]||'';this[_0x57a0('0x1')]=_0x25026f[_0x57a0('0x1')]||'';this[_0x57a0('0x2')]=_0x25026f[_0x57a0('0x2')]||'';this[_0x57a0('0x3')]=_0x25026f['remoteUri']||'';this[_0x57a0('0x4')]=_0x25026f['serverUrl']||'';this[_0x57a0('0x5')]=_0x25026f['Configurations']||{};}module[_0x57a0('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 1d9e7ff..8e941aa 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 _0x4e72=['address','exports','name','accountcode','stateTime','status','unknown'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4e72,0xaa));var _0x24e7=function(_0x5d5668,_0xbfaf7c){_0x5d5668=_0x5d5668-0x0;var _0x40a6a3=_0x4e72[_0x5d5668];return _0x40a6a3;};'use strict';function Telephone(_0x45ad0c){this['id']=_0x45ad0c['id']||0x0;this[_0x24e7('0x0')]=_0x45ad0c[_0x24e7('0x0')]||'';this['accountcode']=_0x45ad0c[_0x24e7('0x1')]||'';this['state']='unknown';this[_0x24e7('0x2')]=0x0;this[_0x24e7('0x3')]=_0x24e7('0x4');this[_0x24e7('0x5')]='';}module[_0x24e7('0x6')]=Telephone; \ No newline at end of file +var _0x6739=['address','name','accountcode','state','unknown','stateTime','status'];(function(_0x3534c5,_0x23f4e9){var _0x5352c5=function(_0x184c82){while(--_0x184c82){_0x3534c5['push'](_0x3534c5['shift']());}};_0x5352c5(++_0x23f4e9);}(_0x6739,0x127));var _0x9673=function(_0x43642d,_0x152cd1){_0x43642d=_0x43642d-0x0;var _0x2319a8=_0x6739[_0x43642d];return _0x2319a8;};'use strict';function Telephone(_0x3797de){this['id']=_0x3797de['id']||0x0;this[_0x9673('0x0')]=_0x3797de[_0x9673('0x0')]||'';this[_0x9673('0x1')]=_0x3797de[_0x9673('0x1')]||'';this[_0x9673('0x2')]=_0x9673('0x3');this[_0x9673('0x4')]=0x0;this[_0x9673('0x5')]=_0x9673('0x3');this[_0x9673('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index e1d5569..15b4fd9 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 _0x220b=['exports','name','html'];(function(_0x4f83c5,_0x5077b6){var _0x10ab3e=function(_0x2115eb){while(--_0x2115eb){_0x4f83c5['push'](_0x4f83c5['shift']());}};_0x10ab3e(++_0x5077b6);}(_0x220b,0x1b7));var _0xb220=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x220b[_0x1dd532];return _0x3732aa;};'use strict';function template(_0x1c1a8c){this['id']=_0x1c1a8c['id']||0x0;this[_0xb220('0x0')]=_0x1c1a8c[_0xb220('0x0')]||'';this[_0xb220('0x1')]=_0x1c1a8c[_0xb220('0x1')]||'';}module[_0xb220('0x2')]=template; \ No newline at end of file +var _0x015d=['name','exports'];(function(_0x32087d,_0x30c7aa){var _0x46eb69=function(_0x2fecc0){while(--_0x2fecc0){_0x32087d['push'](_0x32087d['shift']());}};_0x46eb69(++_0x30c7aa);}(_0x015d,0xd2));var _0xd015=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x015d[_0x3f55de];return _0x2698de;};'use strict';function template(_0x2d6964){this['id']=_0x2d6964['id']||0x0;this[_0xd015('0x0')]=_0x2d6964['name']||'';this['html']=_0x2d6964['html']||'';}module[_0xd015('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 38a32be..d32524d 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 _0xa41a=['AnyConditions','Actions','name','channel','voice','status','AllConditions'];(function(_0x14c625,_0x3f5972){var _0x1886aa=function(_0x3d589f){while(--_0x3d589f){_0x14c625['push'](_0x14c625['shift']());}};_0x1886aa(++_0x3f5972);}(_0xa41a,0x6b));var _0xaa41=function(_0xb3088e,_0x3c128f){_0xb3088e=_0xb3088e-0x0;var _0x54adc8=_0xa41a[_0xb3088e];return _0x54adc8;};'use strict';function Trigger(_0x33e667){this['id']=_0x33e667['id']||0x0;this[_0xaa41('0x0')]=_0x33e667['name']||'';this[_0xaa41('0x1')]=_0x33e667[_0xaa41('0x1')]||_0xaa41('0x2');this[_0xaa41('0x3')]=_0x33e667[_0xaa41('0x3')]||![];this[_0xaa41('0x4')]=_0x33e667[_0xaa41('0x4')]||[];this[_0xaa41('0x5')]=_0x33e667['AnyConditions']||[];this[_0xaa41('0x6')]=_0x33e667[_0xaa41('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0xec403e,_0x5a9fd5){var _0x838658=function(_0x1df3d5){while(--_0x1df3d5){_0xec403e['push'](_0xec403e['shift']());}};_0x838658(++_0x5a9fd5);}(_0xedd9,0xfc));var _0x9edd=function(_0x341eaf,_0x41d94a){_0x341eaf=_0x341eaf-0x0;var _0x489e8a=_0xedd9[_0x341eaf];return _0x489e8a;};'use strict';function Trigger(_0x265eb8){this['id']=_0x265eb8['id']||0x0;this[_0x9edd('0x0')]=_0x265eb8[_0x9edd('0x0')]||'';this[_0x9edd('0x1')]=_0x265eb8[_0x9edd('0x1')]||_0x9edd('0x2');this[_0x9edd('0x3')]=_0x265eb8[_0x9edd('0x3')]||![];this[_0x9edd('0x4')]=_0x265eb8['AllConditions']||[];this[_0x9edd('0x5')]=_0x265eb8[_0x9edd('0x5')]||[];this[_0x9edd('0x6')]=_0x265eb8[_0x9edd('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 934f021..e095ca0 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 _0xde56=['registry','indexOf','split','host','port','domain','stateRegistry','registrationtime','address','active','name','state','unknown','stateTime','status'];(function(_0x352168,_0xc37f48){var _0x3e9333=function(_0xd4446a){while(--_0xd4446a){_0x352168['push'](_0x352168['shift']());}};_0x3e9333(++_0xc37f48);}(_0xde56,0x144));var _0x6de5=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0xde56[_0x3457b4];return _0xaa8fa9;};'use strict';function Trunk(_0x292395){this['id']=_0x292395['id']||0x0;this['active']=_0x292395[_0x6de5('0x0')]||![];this[_0x6de5('0x1')]=_0x292395[_0x6de5('0x1')]||'';this[_0x6de5('0x2')]=_0x6de5('0x3');this[_0x6de5('0x4')]=0x0;this[_0x6de5('0x5')]=_0x6de5('0x3');this[_0x6de5('0x6')]=_0x292395[_0x6de5('0x6')]&&_0x292395['registry'][_0x6de5('0x7')](':')?_0x292395[_0x6de5('0x6')][_0x6de5('0x8')](':')[0x0]:'';this[_0x6de5('0x9')]='';this[_0x6de5('0xa')]='';this[_0x6de5('0xb')]='';this['domainport']='';this['refresh']='';this[_0x6de5('0xc')]=_0x6de5('0x3');this[_0x6de5('0xd')]='';this[_0x6de5('0xe')]='';}module['exports']=Trunk; \ No newline at end of file +var _0xd289=['name','state','unknown','registry','split','port','domain','domainport','refresh','stateRegistry','address','exports','active'];(function(_0x58914e,_0xfb9203){var _0x160449=function(_0x4f1d19){while(--_0x4f1d19){_0x58914e['push'](_0x58914e['shift']());}};_0x160449(++_0xfb9203);}(_0xd289,0xf6));var _0x9d28=function(_0x49c1f2,_0x468abb){_0x49c1f2=_0x49c1f2-0x0;var _0x2058c9=_0xd289[_0x49c1f2];return _0x2058c9;};'use strict';function Trunk(_0x260e8f){this['id']=_0x260e8f['id']||0x0;this[_0x9d28('0x0')]=_0x260e8f['active']||![];this[_0x9d28('0x1')]=_0x260e8f[_0x9d28('0x1')]||'';this[_0x9d28('0x2')]=_0x9d28('0x3');this['stateTime']=0x0;this['status']='unknown';this[_0x9d28('0x4')]=_0x260e8f[_0x9d28('0x4')]&&_0x260e8f['registry']['indexOf'](':')?_0x260e8f[_0x9d28('0x4')][_0x9d28('0x5')](':')[0x0]:'';this['host']='';this[_0x9d28('0x6')]='';this[_0x9d28('0x7')]='';this[_0x9d28('0x8')]='';this[_0x9d28('0x9')]='';this[_0x9d28('0xa')]=_0x9d28('0x3');this['registrationtime']='';this[_0x9d28('0xb')]='';}module[_0x9d28('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 bb1b98c..a5db0aa 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 _0x8ce7=['mandatoryDisposition','exports','recordingFormat','none'];(function(_0x1d453f,_0x5793a9){var _0x50996a=function(_0x59bdf3){while(--_0x59bdf3){_0x1d453f['push'](_0x1d453f['shift']());}};_0x50996a(++_0x5793a9);}(_0x8ce7,0x1c2));var _0x78ce=function(_0x30ec0a,_0x390560){_0x30ec0a=_0x30ec0a-0x0;var _0x1c5562=_0x8ce7[_0x30ec0a];return _0x1c5562;};'use strict';function voiceExtension(_0x12aac5){this['id']=_0x12aac5['id']||0x0;this['exten']=_0x12aac5['exten']||'';this[_0x78ce('0x0')]=_0x12aac5[_0x78ce('0x0')]||_0x78ce('0x1');this['mandatoryDisposition']=_0x12aac5[_0x78ce('0x2')]||![];}module[_0x78ce('0x3')]=voiceExtension; \ No newline at end of file +var _0xf264=['mandatoryDisposition','recordingFormat','none'];(function(_0x138ea2,_0x1d8283){var _0xf184ef=function(_0x43536b){while(--_0x43536b){_0x138ea2['push'](_0x138ea2['shift']());}};_0xf184ef(++_0x1d8283);}(_0xf264,0x76));var _0x4f26=function(_0x2d3187,_0x7ce442){_0x2d3187=_0x2d3187-0x0;var _0x4e575b=_0xf264[_0x2d3187];return _0x4e575b;};'use strict';function voiceExtension(_0x159889){this['id']=_0x159889['id']||0x0;this['exten']=_0x159889['exten']||'';this[_0x4f26('0x0')]=_0x159889[_0x4f26('0x0')]||_0x4f26('0x1');this[_0x4f26('0x2')]=_0x159889[_0x4f26('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 95bb481..93577a7 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 _0xea52=['outboundDropCallsDayACS','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','type','talking','total','sumDuration','sumBillable','unmanaged','loggedIn','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout'];(function(_0xbc3241,_0xabde3b){var _0x12bf73=function(_0x3fc3ea){while(--_0x3fc3ea){_0xbc3241['push'](_0xbc3241['shift']());}};_0x12bf73(++_0xabde3b);}(_0xea52,0x7d));var _0x2ea5=function(_0x1df4a9,_0x52a221){_0x1df4a9=_0x1df4a9-0x0;var _0x77192d=_0xea52[_0x1df4a9];return _0x77192d;};'use strict';var statusDesc=['unknown',_0x2ea5('0x0'),_0x2ea5('0x1'),_0x2ea5('0x2'),_0x2ea5('0x3'),_0x2ea5('0x4'),_0x2ea5('0x5'),_0x2ea5('0x6'),_0x2ea5('0x7')];var monitorFormat={'wav':_0x2ea5('0x8'),'wav49':_0x2ea5('0x9'),'gsm':_0x2ea5('0xa')};var strategy={'rrmemory':_0x2ea5('0xb'),'roundrobin':'roundrobin'};function VoiceQueue(_0x5aa7a5){this['id']=_0x5aa7a5['id']||0x0;this[_0x2ea5('0xc')]=_0x5aa7a5['name']||'';this[_0x2ea5('0xd')]=_0x5aa7a5['monitor_format']||'';this[_0x2ea5('0xe')]=_0x5aa7a5[_0x2ea5('0xe')]||'inbound';this['waiting']=0x0;this[_0x2ea5('0xf')]=0x0;this[_0x2ea5('0x10')]=0x0;this['answered']=0x0;this[_0x2ea5('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x2ea5('0x12')]=0x0;this[_0x2ea5('0x13')]=0x0;this['abandoned']=0x0;this[_0x2ea5('0x14')]=0x0;this['available']=0x0;this[_0x2ea5('0x15')]=_0x5aa7a5[_0x2ea5('0x15')]||![];this[_0x2ea5('0x16')]=_0x5aa7a5[_0x2ea5('0x16')]||0xa;this[_0x2ea5('0x17')]=_0x5aa7a5[_0x2ea5('0x17')]||'no';this['sendMessageOneNotActive']=!![];this[_0x2ea5('0x18')]='';this[_0x2ea5('0x19')]=0x0;this[_0x2ea5('0x1a')]=0x0;this['dialTimezone']=_0x5aa7a5[_0x2ea5('0x1b')]||null;this[_0x2ea5('0x1c')]=_0x5aa7a5[_0x2ea5('0x1c')]?_0x5aa7a5[_0x2ea5('0x1c')]:null;this[_0x2ea5('0x1d')]=_0x5aa7a5[_0x2ea5('0x1d')];this[_0x2ea5('0x1e')]=_0x5aa7a5[_0x2ea5('0x1e')]||_0x2ea5('0x1f');this[_0x2ea5('0x20')]=_0x5aa7a5['dialLimitChannel']||0x0;this[_0x2ea5('0x21')]=_0x5aa7a5[_0x2ea5('0x21')]||0x0;this[_0x2ea5('0x22')]=_0x5aa7a5[_0x2ea5('0x22')]||0x1;this[_0x2ea5('0x23')]=_0x5aa7a5[_0x2ea5('0x23')]||_0x2ea5('0x24');this[_0x2ea5('0x25')]=_0x5aa7a5[_0x2ea5('0x25')]||0.03;this[_0x2ea5('0x26')]=_0x5aa7a5['dialPredictiveInterval']||0x258;this[_0x2ea5('0x27')]=_0x5aa7a5[_0x2ea5('0x27')]||_0x2ea5('0x28');this['dialOriginateCallerIdNumber']=_0x5aa7a5['dialOriginateCallerIdNumber']||_0x2ea5('0x28');this['dialOriginateTimeout']=_0x5aa7a5['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x5aa7a5[_0x2ea5('0x29')]||_0x2ea5('0x2a');this[_0x2ea5('0x2b')]=_0x5aa7a5['dialQueueTimeout']||0x3;this[_0x2ea5('0x2c')]=_0x5aa7a5[_0x2ea5('0x2c')]||undefined;this[_0x2ea5('0x2d')]=_0x5aa7a5[_0x2ea5('0x2d')]||0x3;this[_0x2ea5('0x2e')]=_0x5aa7a5[_0x2ea5('0x2e')]||0x96;this[_0x2ea5('0x2f')]=_0x5aa7a5[_0x2ea5('0x2f')]||0x3;this[_0x2ea5('0x30')]=_0x5aa7a5['dialBusyRetryFrequency']||0x96;this[_0x2ea5('0x31')]=_0x5aa7a5['dialNoAnswerMaxRetry']||0x3;this[_0x2ea5('0x32')]=_0x5aa7a5[_0x2ea5('0x32')]||0x96;this['dialGlobalMaxRetry']=_0x5aa7a5[_0x2ea5('0x33')]||0x4;this[_0x2ea5('0x34')]=_0x5aa7a5[_0x2ea5('0x34')]?_0x5aa7a5[_0x2ea5('0x34')]:undefined;this[_0x2ea5('0x35')]=_0x5aa7a5[_0x2ea5('0x35')]?_0x5aa7a5[_0x2ea5('0x35')]:undefined;this['dialPrefix']=_0x5aa7a5[_0x2ea5('0x36')]||undefined;this[_0x2ea5('0x37')]=_0x5aa7a5['Interval']?_0x5aa7a5[_0x2ea5('0x37')]:undefined;this['dialOrderByScheduledAt']=_0x5aa7a5[_0x2ea5('0x38')]||_0x2ea5('0x39');this[_0x2ea5('0x3a')]=_0x5aa7a5[_0x2ea5('0x3a')]||undefined;this['dialCutDigit']=_0x5aa7a5['dialCutDigit']||undefined;this[_0x2ea5('0x3b')]=strategy[_0x5aa7a5['strategy']]||_0x2ea5('0xb');this[_0x2ea5('0x3c')]=!![];this[_0x2ea5('0x3d')]=_0x5aa7a5['dialAMDActive']||![];this[_0x2ea5('0x3e')]=_0x5aa7a5[_0x2ea5('0x3e')];this[_0x2ea5('0x3f')]=_0x5aa7a5[_0x2ea5('0x3f')];this[_0x2ea5('0x40')]=_0x5aa7a5['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5aa7a5[_0x2ea5('0x41')];this[_0x2ea5('0x42')]=_0x5aa7a5[_0x2ea5('0x42')];this['dialAMDBetweenWordsSilence']=_0x5aa7a5['dialAMDBetweenWordsSilence'];this[_0x2ea5('0x43')]=_0x5aa7a5[_0x2ea5('0x43')];this[_0x2ea5('0x44')]=_0x5aa7a5['dialAMDSilenceThreshold'];this[_0x2ea5('0x45')]=_0x5aa7a5[_0x2ea5('0x45')];this[_0x2ea5('0x46')]=0x0;this[_0x2ea5('0x47')]=0x0;this[_0x2ea5('0x48')]=_0x5aa7a5[_0x2ea5('0x48')];this[_0x2ea5('0x49')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x2ea5('0x4a')]=0x0;this[_0x2ea5('0x4b')]=0x0;this[_0x2ea5('0x4c')]=0x0;this[_0x2ea5('0x4d')]=0x0;this[_0x2ea5('0x4e')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2ea5('0x4f')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x2ea5('0x50')]=0x0;this[_0x2ea5('0x51')]=0x0;this['outboundReCallsDay']=0x0;this['startProgressive']=undefined;this[_0x2ea5('0x52')]=undefined;this['handlePredictive']=undefined;this[_0x2ea5('0x53')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x2ea5('0x54')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x2ea5('0x55')]=0x0;this[_0x2ea5('0x56')]=0x0;this[_0x2ea5('0x57')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x2ea5('0x58')]=_0x5aa7a5[_0x2ea5('0x59')]||0x14;this[_0x2ea5('0x5a')]=_0x5aa7a5['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x2ea5('0x5b')]=0x1;this[_0x2ea5('0x5c')]=0x0;this[_0x2ea5('0x5d')]=0x0;this[_0x2ea5('0x5e')]=0x0;this['erlangBusyFactor']=0x0;this[_0x2ea5('0x5f')]=_0x5aa7a5[_0x2ea5('0x5f')]||0x1e;this['dialRecallInQueue']=_0x5aa7a5[_0x2ea5('0x60')]||![];this[_0x2ea5('0x61')]=_0x5aa7a5[_0x2ea5('0x61')]||undefined;this[_0x2ea5('0x62')]=_0x5aa7a5[_0x2ea5('0x62')]||![];this[_0x2ea5('0x63')]=_0x5aa7a5[_0x2ea5('0x63')]||![];this['monitor_format']=monitorFormat[_0x5aa7a5[_0x2ea5('0xd')]]?monitorFormat[_0x5aa7a5['monitor_format']]:undefined;this[_0x2ea5('0x64')]=_0x5aa7a5[_0x2ea5('0x64')]||![];this['mandatoryDispositionPause']=_0x5aa7a5['mandatoryDispositionPause']?_0x5aa7a5[_0x2ea5('0x65')]:undefined;}module[_0x2ea5('0x66')]=VoiceQueue; \ No newline at end of file +var _0x8fb3=['dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8fb3,0x1a5));var _0x38fb=function(_0xa96854,_0x5b3af6){_0xa96854=_0xa96854-0x0;var _0x5bb4b2=_0x8fb3[_0xa96854];return _0x5bb4b2;};'use strict';var statusDesc=['unknown',_0x38fb('0x0'),_0x38fb('0x1'),_0x38fb('0x2'),_0x38fb('0x3'),_0x38fb('0x4'),_0x38fb('0x5'),_0x38fb('0x6'),_0x38fb('0x7')];var monitorFormat={'wav':_0x38fb('0x8'),'wav49':_0x38fb('0x9'),'gsm':_0x38fb('0xa')};var strategy={'rrmemory':_0x38fb('0xb'),'roundrobin':_0x38fb('0xc')};function VoiceQueue(_0x12b3f9){this['id']=_0x12b3f9['id']||0x0;this[_0x38fb('0xd')]=_0x12b3f9['name']||'';this[_0x38fb('0xe')]=_0x12b3f9['monitor_format']||'';this[_0x38fb('0xf')]=_0x12b3f9[_0x38fb('0xf')]||'inbound';this[_0x38fb('0x10')]=0x0;this[_0x38fb('0x11')]=0x0;this['total']=0x0;this[_0x38fb('0x12')]=0x0;this[_0x38fb('0x13')]=0x0;this[_0x38fb('0x14')]=0x0;this[_0x38fb('0x15')]=0x0;this[_0x38fb('0x16')]=0x0;this[_0x38fb('0x17')]=0x0;this[_0x38fb('0x18')]=0x0;this[_0x38fb('0x19')]=0x0;this['acw']=_0x12b3f9[_0x38fb('0x1a')]||![];this['acwTimeout']=_0x12b3f9[_0x38fb('0x1b')]||0xa;this[_0x38fb('0x1c')]=_0x12b3f9[_0x38fb('0x1c')]||'no';this[_0x38fb('0x1d')]=!![];this[_0x38fb('0x1e')]='';this[_0x38fb('0x1f')]=0x0;this['temp']=0x0;this[_0x38fb('0x20')]=_0x12b3f9[_0x38fb('0x20')]||null;this[_0x38fb('0x21')]=_0x12b3f9[_0x38fb('0x21')]?_0x12b3f9[_0x38fb('0x21')]:null;this['dialActive']=_0x12b3f9[_0x38fb('0x22')];this[_0x38fb('0x23')]=_0x12b3f9['dialMethod']||_0x38fb('0x24');this[_0x38fb('0x25')]=_0x12b3f9[_0x38fb('0x25')]||0x0;this['dialLimitQueue']=_0x12b3f9['dialLimitQueue']||0x0;this[_0x38fb('0x26')]=_0x12b3f9[_0x38fb('0x26')]||0x1;this[_0x38fb('0x27')]=_0x12b3f9[_0x38fb('0x27')]||_0x38fb('0x28');this[_0x38fb('0x29')]=_0x12b3f9[_0x38fb('0x29')]||0.03;this[_0x38fb('0x2a')]=_0x12b3f9[_0x38fb('0x2a')]||0x258;this[_0x38fb('0x2b')]=_0x12b3f9[_0x38fb('0x2b')]||_0x38fb('0x2c');this[_0x38fb('0x2d')]=_0x12b3f9[_0x38fb('0x2d')]||'anonymous';this[_0x38fb('0x2e')]=_0x12b3f9['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x12b3f9[_0x38fb('0x2f')]||'tTxX';this['dialQueueTimeout']=_0x12b3f9[_0x38fb('0x30')]||0x3;this[_0x38fb('0x31')]=_0x12b3f9[_0x38fb('0x31')]||undefined;this['dialCongestionMaxRetry']=_0x12b3f9[_0x38fb('0x32')]||0x3;this[_0x38fb('0x33')]=_0x12b3f9[_0x38fb('0x33')]||0x96;this['dialBusyMaxRetry']=_0x12b3f9['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x12b3f9[_0x38fb('0x34')]||0x96;this['dialNoAnswerMaxRetry']=_0x12b3f9[_0x38fb('0x35')]||0x3;this[_0x38fb('0x36')]=_0x12b3f9[_0x38fb('0x36')]||0x96;this[_0x38fb('0x37')]=_0x12b3f9[_0x38fb('0x37')]||0x4;this[_0x38fb('0x38')]=_0x12b3f9[_0x38fb('0x38')]?_0x12b3f9['Trunk']:undefined;this[_0x38fb('0x39')]=_0x12b3f9[_0x38fb('0x39')]?_0x12b3f9[_0x38fb('0x39')]:undefined;this['dialPrefix']=_0x12b3f9[_0x38fb('0x3a')]||undefined;this[_0x38fb('0x3b')]=_0x12b3f9[_0x38fb('0x3b')]?_0x12b3f9[_0x38fb('0x3b')]:undefined;this[_0x38fb('0x3c')]=_0x12b3f9[_0x38fb('0x3c')]||_0x38fb('0x3d');this['dialRandomLastDigitCallerIdNumber']=_0x12b3f9['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x38fb('0x3e')]=_0x12b3f9[_0x38fb('0x3e')]||undefined;this[_0x38fb('0x3f')]=strategy[_0x12b3f9[_0x38fb('0x3f')]]||_0x38fb('0xb');this[_0x38fb('0x40')]=!![];this[_0x38fb('0x41')]=_0x12b3f9[_0x38fb('0x41')]||![];this[_0x38fb('0x42')]=_0x12b3f9[_0x38fb('0x42')];this[_0x38fb('0x43')]=_0x12b3f9[_0x38fb('0x43')];this[_0x38fb('0x44')]=_0x12b3f9['dialAMDAfterGreetingSilence'];this[_0x38fb('0x45')]=_0x12b3f9[_0x38fb('0x45')];this[_0x38fb('0x46')]=_0x12b3f9[_0x38fb('0x46')];this[_0x38fb('0x47')]=_0x12b3f9[_0x38fb('0x47')];this[_0x38fb('0x48')]=_0x12b3f9['dialAMDMaximumNumberOfWords'];this[_0x38fb('0x49')]=_0x12b3f9['dialAMDSilenceThreshold'];this[_0x38fb('0x4a')]=_0x12b3f9[_0x38fb('0x4a')];this[_0x38fb('0x4b')]=0x0;this[_0x38fb('0x4c')]=0x0;this['timeout']=_0x12b3f9[_0x38fb('0x4d')];this[_0x38fb('0x4e')]=0x0;this[_0x38fb('0x4f')]=0x0;this[_0x38fb('0x50')]=0x0;this[_0x38fb('0x51')]=0x0;this[_0x38fb('0x52')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x38fb('0x53')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x38fb('0x54')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x38fb('0x55')]=0x0;this['outboundReCallsDay']=0x0;this[_0x38fb('0x56')]=undefined;this[_0x38fb('0x57')]=undefined;this[_0x38fb('0x58')]=undefined;this[_0x38fb('0x59')]=1.05;this[_0x38fb('0x5a')]=0x0;this[_0x38fb('0x5b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x38fb('0x5c')]=0x0;this[_0x38fb('0x5d')]=0x0;this[_0x38fb('0x5e')]=0x0;this[_0x38fb('0x5f')]=0x0;this[_0x38fb('0x60')]=0x0;this[_0x38fb('0x61')]=_0x12b3f9[_0x38fb('0x62')]||0x14;this[_0x38fb('0x63')]=_0x12b3f9['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x38fb('0x64')]=0x0;this[_0x38fb('0x65')]=0x0;this[_0x38fb('0x66')]=0x1;this[_0x38fb('0x67')]=0x0;this[_0x38fb('0x68')]=0x0;this[_0x38fb('0x69')]=0x0;this[_0x38fb('0x6a')]=0x0;this[_0x38fb('0x6b')]=_0x12b3f9[_0x38fb('0x6b')]||0x1e;this[_0x38fb('0x6c')]=_0x12b3f9[_0x38fb('0x6c')]||![];this[_0x38fb('0x6d')]=_0x12b3f9['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x12b3f9['dialAgiAfterHangupClient']||![];this[_0x38fb('0x6e')]=_0x12b3f9[_0x38fb('0x6e')]||![];this[_0x38fb('0xe')]=monitorFormat[_0x12b3f9[_0x38fb('0xe')]]?monitorFormat[_0x12b3f9[_0x38fb('0xe')]]:undefined;this[_0x38fb('0x6f')]=_0x12b3f9['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x12b3f9[_0x38fb('0x70')]?_0x12b3f9[_0x38fb('0x70')]:undefined;}module[_0x38fb('0x71')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index fbf23c4..15a519a 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 _0x687b=['accessKey','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x147669,_0x13534b){var _0x28a77f=function(_0xbd043d){while(--_0xbd043d){_0x147669['push'](_0x147669['shift']());}};_0x28a77f(++_0x13534b);}(_0x687b,0x197));var _0xb687=function(_0x5da048,_0xca5c85){_0x5da048=_0x5da048-0x0;var _0x13dfc5=_0x687b[_0x5da048];return _0x13dfc5;};'use strict';function VtigerAccount(_0x53ae4c){this['id']=_0x53ae4c['id']||0x0;this['name']=_0x53ae4c['name']||'';this[_0xb687('0x0')]=_0x53ae4c[_0xb687('0x0')]||'';this[_0xb687('0x1')]=_0x53ae4c[_0xb687('0x1')]||'';this[_0xb687('0x2')]=_0x53ae4c[_0xb687('0x2')]||'';this[_0xb687('0x3')]=_0x53ae4c['serverUrl']||'';this[_0xb687('0x4')]=_0x53ae4c[_0xb687('0x4')]||{};}module[_0xb687('0x5')]=VtigerAccount; \ No newline at end of file +var _0x25f2=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25f2,0xb2));var _0x225f=function(_0x525708,_0x4dc932){_0x525708=_0x525708-0x0;var _0xcbe77=_0x25f2[_0x525708];return _0xcbe77;};'use strict';function VtigerAccount(_0x480582){this['id']=_0x480582['id']||0x0;this[_0x225f('0x0')]=_0x480582[_0x225f('0x0')]||'';this[_0x225f('0x1')]=_0x480582[_0x225f('0x1')]||'';this[_0x225f('0x2')]=_0x480582['accessKey']||'';this[_0x225f('0x3')]=_0x480582['remoteUri']||'';this[_0x225f('0x4')]=_0x480582[_0x225f('0x4')]||'';this[_0x225f('0x5')]=_0x480582[_0x225f('0x5')]||{};}module[_0x225f('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 5fc779a..cd65c7d 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 _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x5c4585,_0x3d0eab){var _0x21dede=function(_0x5c3d6a){while(--_0x5c3d6a){_0x5c4585['push'](_0x5c4585['shift']());}};_0x21dede(++_0x3d0eab);}(_0x0b0e,0x187));var _0xe0b0=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0x0b0e[_0x562ec5];return _0x279c8c;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x3e53bd,_0x8d2aa4){_0x3e53bd=_0x3e53bd-0x0;var _0x55eed6=_0x7a54[_0x3e53bd];return _0x55eed6;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 3e813dd..3a9291d 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 _0xf4f4=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x564764,_0x56f342){var _0x1ed62d=function(_0x16cca5){while(--_0x16cca5){_0x564764['push'](_0x564764['shift']());}};_0x1ed62d(++_0x56f342);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x53f1ee,_0x29cff6){_0x53f1ee=_0x53f1ee-0x0;var _0x3638da=_0xf4f4[_0x53f1ee];return _0x3638da;};'use strict';function ZohoAccount(_0x12f610){this['id']=_0x12f610['id']||0x0;this[_0x4f4f('0x0')]=_0x12f610['name']||'';this[_0x4f4f('0x1')]=_0x12f610[_0x4f4f('0x1')]||'';this[_0x4f4f('0x2')]=_0x12f610[_0x4f4f('0x2')]||'';this[_0x4f4f('0x3')]=_0x12f610['zone']||'';this[_0x4f4f('0x4')]=_0x12f610['clientId']||'';this[_0x4f4f('0x5')]=_0x12f610[_0x4f4f('0x5')]||'';this[_0x4f4f('0x6')]=_0x12f610[_0x4f4f('0x6')]||'';this[_0x4f4f('0x7')]=_0x12f610[_0x4f4f('0x7')]||'';this[_0x4f4f('0x8')]=_0x12f610[_0x4f4f('0x8')]||'';this['Configurations']=_0x12f610[_0x4f4f('0x9')]||{};}module[_0x4f4f('0xa')]=ZohoAccount; \ No newline at end of file +var _0x7382=['refreshToken','Configurations','exports','name','zone','clientId','clientSecret','serverUrl','code'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7382,0x111));var _0x2738=function(_0x5b3fad,_0x31d7cd){_0x5b3fad=_0x5b3fad-0x0;var _0x4ac1fe=_0x7382[_0x5b3fad];return _0x4ac1fe;};'use strict';function ZohoAccount(_0xa7d3b1){this['id']=_0xa7d3b1['id']||0x0;this[_0x2738('0x0')]=_0xa7d3b1['name']||'';this['description']=_0xa7d3b1['description']||'';this['host']=_0xa7d3b1['host']||'';this[_0x2738('0x1')]=_0xa7d3b1[_0x2738('0x1')]||'';this[_0x2738('0x2')]=_0xa7d3b1[_0x2738('0x2')]||'';this[_0x2738('0x3')]=_0xa7d3b1['clientSecret']||'';this[_0x2738('0x4')]=_0xa7d3b1[_0x2738('0x4')]||'';this[_0x2738('0x5')]=_0xa7d3b1['code']||'';this[_0x2738('0x6')]=_0xa7d3b1[_0x2738('0x6')]||'';this[_0x2738('0x7')]=_0xa7d3b1['Configurations']||{};}module[_0x2738('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index dfdfc88..7ac5ba6 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 _0xb9b7=['countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','string','isNil','uniqueid','queue','name','type','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','phone','Contact','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xb9b7,0x80));var _0x7b9b=function(_0x5ba952,_0x3d39c3){_0x5ba952=_0x5ba952-0x0;var _0x472cca=_0xb9b7[_0x5ba952];return _0x472cca;};'use strict';var util=require(_0x7b9b('0x0'));var _=require('lodash');var moment=require(_0x7b9b('0x1'));function checkNameSurname(_0x19ffdf,_0xd09ea1,_0x15f718){var _0x5e11d6='';if(!_['isNil'](_0xd09ea1)&&_0x7b9b('0x2')===typeof _0xd09ea1){_0x5e11d6+=_0xd09ea1;}if(!_[_0x7b9b('0x3')](_0x15f718)&&'string'===typeof _0x15f718){_0x5e11d6+='\x20'+_0x15f718;}if(_0x5e11d6!==''){return _0x5e11d6;}return _0x19ffdf;}function Action(_0x6c81bd,_0x11688a,_0x1e4203,_0x394882,_0x10332d){this[_0x7b9b('0x4')]=_0x1e4203||undefined;this['idContact']=_0x6c81bd['id'];this[_0x7b9b('0x5')]=_0x11688a[_0x7b9b('0x6')];this[_0x7b9b('0x7')]=_0x11688a['type'];this['campaigntype']=_0x7b9b('0x5');this[_0x7b9b('0x8')]=![];this['membername']=_['isNil'](_0x6c81bd[_0x7b9b('0x9')])?undefined:_0x6c81bd['Agent'][_0x7b9b('0x6')];this[_0x7b9b('0xa')]=this[_0x7b9b('0xb')]?util[_0x7b9b('0xc')](_0x7b9b('0xd'),this[_0x7b9b('0xb')]):_0x394882||undefined;this[_0x7b9b('0xe')]=checkNameSurname(_0x6c81bd['Contact'][_0x7b9b('0xf')],_0x6c81bd[_0x7b9b('0x10')][_0x7b9b('0x11')],_0x6c81bd[_0x7b9b('0x10')]['lastName']);this[_0x7b9b('0x12')]=_0x6c81bd[_0x7b9b('0x12')]||![];this[_0x7b9b('0x13')]=_0x6c81bd['Contact'][_0x7b9b('0xf')];this['scheduledat']=_0x6c81bd[_0x7b9b('0x14')];this[_0x7b9b('0x15')]=_0x6c81bd[_0x7b9b('0x15')]||0x0;this[_0x7b9b('0x16')]=_0x6c81bd[_0x7b9b('0x16')]||0x0;this[_0x7b9b('0x17')]=_0x6c81bd[_0x7b9b('0x17')]||0x0;this[_0x7b9b('0x18')]=(_0x6c81bd[_0x7b9b('0x15')]||0x0)+(_0x6c81bd[_0x7b9b('0x16')]||0x0)+(_0x6c81bd[_0x7b9b('0x17')]||0x0);this[_0x7b9b('0x19')]=_0x6c81bd['callback'];this[_0x7b9b('0x1a')]=_0x6c81bd[_0x7b9b('0x1a')];this[_0x7b9b('0x1b')]=_0x6c81bd[_0x7b9b('0x1b')];this['recallme']=_0x6c81bd[_0x7b9b('0x1c')];this['ContactId']=_0x6c81bd[_0x7b9b('0x1d')];this[_0x7b9b('0x1e')]=_0x6c81bd[_0x7b9b('0x1e')];this['UserId']=_['isNil'](_0x6c81bd[_0x7b9b('0x9')])?_0x6c81bd['UserId']:_0x6c81bd[_0x7b9b('0x9')]['id'];this[_0x7b9b('0x1f')]=_0x6c81bd[_0x7b9b('0x1f')];this[_0x7b9b('0x20')]='';this[_0x7b9b('0x21')]='';}Action['prototype'][_0x7b9b('0x22')]=function(){return util[_0x7b9b('0xc')](_0x7b9b('0x23'),this[_0x7b9b('0xe')],this[_0x7b9b('0x24')]);};module[_0x7b9b('0x25')]=Action; \ No newline at end of file +var _0x4fd6=['uniqueid','idContact','queue','name','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','prototype','getCaller','number','exports','util','lodash','moment','isNil','string'];(function(_0x1d8a3e,_0x4193cc){var _0x193334=function(_0x312a19){while(--_0x312a19){_0x1d8a3e['push'](_0x1d8a3e['shift']());}};_0x193334(++_0x4193cc);}(_0x4fd6,0x163));var _0x64fd=function(_0x289842,_0x2d9db4){_0x289842=_0x289842-0x0;var _0x16155a=_0x4fd6[_0x289842];return _0x16155a;};'use strict';var util=require(_0x64fd('0x0'));var _=require(_0x64fd('0x1'));var moment=require(_0x64fd('0x2'));function checkNameSurname(_0x3cd20e,_0x2a2a28,_0x2e657e){var _0x2022d6='';if(!_['isNil'](_0x2a2a28)&&'string'===typeof _0x2a2a28){_0x2022d6+=_0x2a2a28;}if(!_[_0x64fd('0x3')](_0x2e657e)&&_0x64fd('0x4')===typeof _0x2e657e){_0x2022d6+='\x20'+_0x2e657e;}if(_0x2022d6!==''){return _0x2022d6;}return _0x3cd20e;}function Action(_0x1d59ed,_0x8e5ade,_0x10c53a,_0x18e278,_0x302b19){this[_0x64fd('0x5')]=_0x10c53a||undefined;this[_0x64fd('0x6')]=_0x1d59ed['id'];this[_0x64fd('0x7')]=_0x8e5ade[_0x64fd('0x8')];this['type']=_0x8e5ade['type'];this[_0x64fd('0x9')]=_0x64fd('0x7');this[_0x64fd('0xa')]=![];this[_0x64fd('0xb')]=_[_0x64fd('0x3')](_0x1d59ed[_0x64fd('0xc')])?undefined:_0x1d59ed[_0x64fd('0xc')][_0x64fd('0x8')];this['channelAgent']=this[_0x64fd('0xb')]?util[_0x64fd('0xd')](_0x64fd('0xe'),this[_0x64fd('0xb')]):_0x18e278||undefined;this[_0x64fd('0xf')]=checkNameSurname(_0x1d59ed[_0x64fd('0x10')]['phone'],_0x1d59ed[_0x64fd('0x10')]['firstName'],_0x1d59ed['Contact'][_0x64fd('0x11')]);this['active']=_0x1d59ed[_0x64fd('0x12')]||![];this[_0x64fd('0x13')]=_0x1d59ed[_0x64fd('0x10')][_0x64fd('0x14')];this[_0x64fd('0x15')]=_0x1d59ed['scheduledat'];this[_0x64fd('0x16')]=_0x1d59ed[_0x64fd('0x16')]||0x0;this['countcongestionretry']=_0x1d59ed['countcongestionretry']||0x0;this[_0x64fd('0x17')]=_0x1d59ed[_0x64fd('0x17')]||0x0;this[_0x64fd('0x18')]=(_0x1d59ed['countbusyretry']||0x0)+(_0x1d59ed['countcongestionretry']||0x0)+(_0x1d59ed['countnoanswerretry']||0x0);this[_0x64fd('0x19')]=_0x1d59ed[_0x64fd('0x19')];this[_0x64fd('0x1a')]=_0x1d59ed['callbackuniqueid'];this[_0x64fd('0x1b')]=_0x1d59ed[_0x64fd('0x1b')];this[_0x64fd('0x1c')]=_0x1d59ed[_0x64fd('0x1c')];this['ContactId']=_0x1d59ed['ContactId'];this[_0x64fd('0x1d')]=_0x1d59ed[_0x64fd('0x1d')];this[_0x64fd('0x1e')]=_[_0x64fd('0x3')](_0x1d59ed[_0x64fd('0xc')])?_0x1d59ed['UserId']:_0x1d59ed['Agent']['id'];this['VoiceQueueId']=_0x1d59ed[_0x64fd('0x1f')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x64fd('0x20')][_0x64fd('0x21')]=function(){return util[_0x64fd('0xd')]('\x22%s\x22\x20<%s>',this[_0x64fd('0xf')],this[_0x64fd('0x22')]);};module[_0x64fd('0x23')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f127b30..d12fdca 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 _0x5b3d=['dialRecallMeTimeout','logger2','[RecallMe]','catch','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','unlockAgent','activeContact','countnoanswerretry','NoAnswer','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','outboundRejectCallsDay','AgentReject','[syncHangupRequest][logAgentReject]','disableContact','dialAnswer','[default]','loggerError','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','status','SIP/%s','reachable','execRun','unlock','unlockContact','recallme','isValid','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','Agent','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','name','active','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','IS_DISACTIVED','prototype','syncCampaigns','hasOwnProperty','booked','outbound','clearZombieChannels','type','setMessage','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','pick','UserId','VoiceQueueId','ListId','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][Preview]','recallMe','getContactRecallMe','then','length','getDiff','scheduledat'];(function(_0x37b370,_0x2b35c2){var _0x22e791=function(_0x11bf5e){while(--_0x11bf5e){_0x37b370['push'](_0x37b370['shift']());}};_0x22e791(++_0x2b35c2);}(_0x5b3d,0xb5));var _0xd5b3=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0x5b3d[_0x25a136];return _0x5b7159;};'use strict';var util=require(_0xd5b3('0x0'));var _=require(_0xd5b3('0x1'));var BPromise=require(_0xd5b3('0x2'));var uuid=require(_0xd5b3('0x3'));var moment=require(_0xd5b3('0x4'));var md5=require('md5');var Redis=require(_0xd5b3('0x5'));var config=require(_0xd5b3('0x6'));var logger=require(_0xd5b3('0x7'))(_0xd5b3('0x8'));var loggerAction=require(_0xd5b3('0x7'))(_0xd5b3('0x9'));var ami=require(_0xd5b3('0xa'));var rpcDb=require(_0xd5b3('0xb'));var Action=require(_0xd5b3('0xc'));var ut=require(_0xd5b3('0xd'));config[_0xd5b3('0xe')]=_['defaults'](config[_0xd5b3('0xe')],{'host':_0xd5b3('0xf'),'port':0x18eb});var io=require(_0xd5b3('0x10'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xd5b3('0x11')]=function(_0x3a0234){this[_0xd5b3('0x12')]=this['tail']?this['tail'][_0xd5b3('0x13')](_0x3a0234):_0x3a0234();};function Preview(_0x23f0d7){this[_0xd5b3('0x14')]=new Sequence();this[_0xd5b3('0x15')]=_0x23f0d7[_0xd5b3('0x16')];this[_0xd5b3('0x17')]=_0x23f0d7[_0xd5b3('0x17')];this[_0xd5b3('0x18')]={};this[_0xd5b3('0x19')]=_0x23f0d7[_0xd5b3('0x19')];this[_0xd5b3('0x1a')]=0x0;ami['on']('originateresponse',this[_0xd5b3('0x1b')][_0xd5b3('0x1c')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xd5b3('0x1d'),this['syncHangupRequest'][_0xd5b3('0x1c')](this));ami['on'](_0xd5b3('0x1e'),this[_0xd5b3('0x1f')][_0xd5b3('0x1c')](this));ami['on'](_0xd5b3('0x20'),this[_0xd5b3('0x21')]['bind'](this));ami['on'](_0xd5b3('0x22'),this[_0xd5b3('0x23')]['bind'](this));ami['on'](_0xd5b3('0x24'),this[_0xd5b3('0x25')][_0xd5b3('0x1c')](this));ami['on']('blindtransfer',this[_0xd5b3('0x26')][_0xd5b3('0x1c')](this));this[_0xd5b3('0x27')](this[_0xd5b3('0x15')]);}function emit(_0x205796,_0x4d69b8,_0x5a4920){io['to'](_0x205796)[_0xd5b3('0x28')](_0x4d69b8,_0x5a4920);}function emitCampaignPreview(_0x2ff4ac){if(_0x2ff4ac['type']==='outbound'){var _0x3d54d8={'id':_0x2ff4ac['id'],'name':_0x2ff4ac['name'],'strategy':_0x2ff4ac[_0xd5b3('0x29')],'answered':_0x2ff4ac[_0xd5b3('0x2a')],'available':_0x2ff4ac['available'],'loggedIn':_0x2ff4ac[_0xd5b3('0x2b')],'pTalking':_0x2ff4ac[_0xd5b3('0x2c')],'sumBillable':_0x2ff4ac[_0xd5b3('0x2d')],'sumDuration':_0x2ff4ac[_0xd5b3('0x2e')],'sumHoldTime':_0x2ff4ac[_0xd5b3('0x2f')]||0x0,'talking':_0x2ff4ac[_0xd5b3('0x30')],'total':_0x2ff4ac['total'],'type':_0x2ff4ac['type'],'unmanaged':_0x2ff4ac[_0xd5b3('0x31')],'abandoned':_0x2ff4ac[_0xd5b3('0x32')],'waiting':_0x2ff4ac['waiting'],'loggedInDb':_0x2ff4ac['loggedInDb'],'dialActive':_0x2ff4ac[_0xd5b3('0x33')],'dialMethod':_0x2ff4ac[_0xd5b3('0x34')],'dialOriginateCallerIdName':_0x2ff4ac[_0xd5b3('0x35')],'dialOriginateCallerIdNumber':_0x2ff4ac[_0xd5b3('0x36')],'dialOriginateTimeout':_0x2ff4ac[_0xd5b3('0x37')],'dialPrefix':_0x2ff4ac['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2ff4ac['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2ff4ac[_0xd5b3('0x38')],'outboundBlacklistCallsDay':_0x2ff4ac[_0xd5b3('0x39')],'outboundBusyCallsDay':_0x2ff4ac[_0xd5b3('0x3a')],'outboundCongestionCallsDay':_0x2ff4ac[_0xd5b3('0x3b')],'outboundDropCallsDayACS':_0x2ff4ac[_0xd5b3('0x3c')],'outboundDropCallsDayCallersExit':_0x2ff4ac[_0xd5b3('0x3d')],'outboundDropCallsDayTimeout':_0x2ff4ac[_0xd5b3('0x3e')],'outboundNoAnswerCallsDay':_0x2ff4ac[_0xd5b3('0x3f')],'outboundNoSuchCallsDay':_0x2ff4ac['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2ff4ac[_0xd5b3('0x40')],'outboundReCallsDay':_0x2ff4ac[_0xd5b3('0x41')],'outboundRejectCallsDay':_0x2ff4ac['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2ff4ac[_0xd5b3('0x42')],'predictiveIntervalAnsweredCalls':_0x2ff4ac[_0xd5b3('0x43')],'predictiveIntervalAvgHoldtime':_0x2ff4ac['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2ff4ac[_0xd5b3('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x2ff4ac[_0xd5b3('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x2ff4ac[_0xd5b3('0x46')],'predictiveIntervalErlangCalls':_0x2ff4ac[_0xd5b3('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x2ff4ac[_0xd5b3('0x48')],'predictiveIntervalHitRate':_0x2ff4ac['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2ff4ac[_0xd5b3('0x49')],'predictiveIntervalPauses':_0x2ff4ac[_0xd5b3('0x4a')],'predictiveIntervalAvailable':_0x2ff4ac[_0xd5b3('0x4b')],'predictiveIntervalTotalCalls':_0x2ff4ac['predictiveIntervalTotalCalls'],'message':_0x2ff4ac['message'],'originated':_0x2ff4ac[_0xd5b3('0x4c')],'erlangCalls':_0x2ff4ac['erlangCalls'],'erlangCallToSecond':_0x2ff4ac['erlangCallToSecond'],'erlangAbandonmentRate':_0x2ff4ac[_0xd5b3('0x4d')],'erlangBusyFactor':_0x2ff4ac[_0xd5b3('0x4e')],'startPredictive':_0x2ff4ac[_0xd5b3('0x4f')],'startProgressive':_0x2ff4ac['startProgressive']};if(_0x2ff4ac['Trunk']){_0x3d54d8[_0xd5b3('0x50')]={'id':_0x2ff4ac[_0xd5b3('0x50')]['id'],'name':_0x2ff4ac[_0xd5b3('0x50')][_0xd5b3('0x51')],'active':_0x2ff4ac[_0xd5b3('0x50')][_0xd5b3('0x52')],'callerid':_0x2ff4ac[_0xd5b3('0x50')]['callerid']};}if(_0x2ff4ac['Interval']){_0x3d54d8[_0xd5b3('0x53')]={'id':_0x2ff4ac[_0xd5b3('0x53')]['id'],'name':_0x2ff4ac[_0xd5b3('0x53')][_0xd5b3('0x51')]};}var _0x343da2=md5(JSON[_0xd5b3('0x54')](_0x3d54d8));if(_0x2ff4ac[_0xd5b3('0x55')]!==_0x343da2){_0x2ff4ac[_0xd5b3('0x55')]=_0x343da2;emit(util[_0xd5b3('0x56')](_0xd5b3('0x57'),_0x3d54d8[_0xd5b3('0x51')]),_0xd5b3('0x58'),_0x3d54d8);}}}function emitVoiceQueueChannelRemove(_0x40579f){emit(util[_0xd5b3('0x56')]('voice:queue:%s',_0x40579f[_0xd5b3('0x51')]),_0xd5b3('0x59'),_0x40579f);}function notSendMessagesQueue(_0x1a27f7){if(_0x1a27f7[_0xd5b3('0x5a')]){if(_0x1a27f7[_0xd5b3('0x4c')]===0x0&&_0x1a27f7[_0xd5b3('0x2c')]===0x0){_0x1a27f7[_0xd5b3('0x5a')]=![];_0x1a27f7['available']=0x0;_0x1a27f7['paused']=0x0;_0x1a27f7['message']=_0xd5b3('0x5b');ut[_0xd5b3('0x5c')](_0xd5b3('0x5d'),_0x1a27f7[_0xd5b3('0x51')]+'\x20is\x20not\x20active');}else{_0x1a27f7[_0xd5b3('0x5e')]=_0xd5b3('0x5f');ut[_0xd5b3('0x5c')](_0xd5b3('0x5d'),_0x1a27f7[_0xd5b3('0x51')]+'\x20is\x20disactive');}emitCampaignPreview(_0x1a27f7);}}Preview['prototype'][_0xd5b3('0x27')]=function(){var _0x28255e=this;setInterval(function(){_0x28255e['syncCampaigns']();},0x7cf);};Preview[_0xd5b3('0x60')][_0xd5b3('0x61')]=function(){var _0x45c0f6=this[_0xd5b3('0x15')];this[_0xd5b3('0x1a')]+=0x1;for(var _0x314b2b in _0x45c0f6){if(_0x45c0f6[_0xd5b3('0x62')](_0x314b2b)&&(_0x45c0f6[_0x314b2b][_0xd5b3('0x34')]===_0xd5b3('0x8')||_0x45c0f6[_0x314b2b]['dialMethod']===_0xd5b3('0x63'))&&_0x45c0f6[_0x314b2b]['type']===_0xd5b3('0x64')){if(this[_0xd5b3('0x1a')]>0x7){this[_0xd5b3('0x1a')]=0x0;this[_0xd5b3('0x65')]();}}if(_0x45c0f6['hasOwnProperty'](_0x314b2b)&&_0x45c0f6[_0x314b2b][_0xd5b3('0x34')]===_0xd5b3('0x8')&&_0x45c0f6[_0x314b2b][_0xd5b3('0x66')]===_0xd5b3('0x64')){if(_0x45c0f6[_0x314b2b][_0xd5b3('0x33')]){this[_0xd5b3('0x67')](_0x45c0f6[_0x314b2b]);this['recallMe'](_0x45c0f6[_0x314b2b]);}else{notSendMessagesQueue(_0x45c0f6[_0x314b2b]);}}}};Preview['prototype'][_0xd5b3('0x68')]=function(_0x561286){var _0x13f861=this;this[_0xd5b3('0x14')]['enqueue'](function(){if(!_[_0xd5b3('0x69')](_0x13f861[_0xd5b3('0x18')][_0x561286])){loggerAction[_0xd5b3('0x6a')](_0xd5b3('0x6b'),_0x561286,_0xd5b3('0x6c'),_0x13f861[_0xd5b3('0x18')][_0x561286][_0xd5b3('0x6d')],'originated:\x20',JSON['stringify'](_0x13f861['campaignsPreview'][_0x13f861['actions'][_0x561286]['queue']]['originated']),_0xd5b3('0x6e'),JSON[_0xd5b3('0x54')](_0x13f861['campaignsPreview'][_0x13f861['actions'][_0x561286][_0xd5b3('0x6d')]][_0xd5b3('0x2c')]),JSON[_0xd5b3('0x54')](_0x13f861[_0xd5b3('0x18')][_0x561286]['dialAnswer']),JSON['stringify'](_[_0xd5b3('0x6f')](_0x13f861[_0xd5b3('0x18')][_0x561286],['contactId',_0xd5b3('0x70'),_0xd5b3('0x71'),_0xd5b3('0x72')])));return ami['Action']({'action':'status','channel':_0x13f861[_0xd5b3('0x18')][_0x561286][_0xd5b3('0x73')]})['catch'](function(_0x27b312){if(_0x27b312[_0xd5b3('0x5e')]===_0xd5b3('0x74')){setTimeout(function(){if(_0x13f861[_0xd5b3('0x18')][_0x561286]){ut[_0xd5b3('0x75')](_0x13f861[_0xd5b3('0x15')][_0x13f861[_0xd5b3('0x18')][_0x561286][_0xd5b3('0x6d')]],_0xd5b3('0x76'));if(_0x13f861[_0xd5b3('0x18')][_0x561286]['dialAnswer']===!![]){ut[_0xd5b3('0x77')](_0x13f861[_0xd5b3('0x15')][_0x13f861[_0xd5b3('0x18')][_0x561286][_0xd5b3('0x6d')]],_0xd5b3('0x76'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x561286,_0x13f861[_0xd5b3('0x18')][_0x561286][_0xd5b3('0x6d')]);}ut['loggerError'](_0xd5b3('0x78')+_0x561286,_0x13f861['actions'][_0x561286][_0xd5b3('0x6d')]);delete _0x13f861[_0xd5b3('0x18')][_0x561286];}},0x2328);}});}});};Preview[_0xd5b3('0x60')][_0xd5b3('0x65')]=function(){var _0x15dcde=this;loggerAction[_0xd5b3('0x6a')]('[action]',_['size'](this[_0xd5b3('0x18')]));for(var _0x447cda in this[_0xd5b3('0x18')]){if(_0x15dcde['actions'][_0xd5b3('0x62')](_0x447cda)){_0x15dcde[_0xd5b3('0x68')](_0x447cda);}}};Preview[_0xd5b3('0x60')][_0xd5b3('0x79')]=function(_0x5257ee){var _0x17047d=this;rpcDb[_0xd5b3('0x7a')](_0x5257ee['id'],ut['agentReadyId'](this['agents']))[_0xd5b3('0x7b')](function(_0x3b3abb){if(!_[_0xd5b3('0x69')](_0x3b3abb)){for(var _0x54fa55=0x0;_0x54fa55<_0x3b3abb[_0xd5b3('0x7c')];_0x54fa55+=0x1){if(ut[_0xd5b3('0x7d')](_0x3b3abb[_0x54fa55][_0xd5b3('0x7e')])<_0x5257ee[_0xd5b3('0x7f')]*0x3c){_0x17047d['run'](_0x3b3abb[_0x54fa55]['id'])['then'](ut[_0xd5b3('0x80')](_0xd5b3('0x81')))[_0xd5b3('0x82')](ut[_0xd5b3('0x80')](_0xd5b3('0x81')));}else{var _0x22994b=new Action(_0x3b3abb[_0x54fa55],_0x5257ee);_0x22994b[_0xd5b3('0x83')]=moment()[_0xd5b3('0x56')](_0xd5b3('0x84'));_0x5257ee[_0xd5b3('0x41')]+=0x1;ut[_0xd5b3('0x85')](_0x22994b,0x17,'RecallInQueue');if(_0x5257ee[_0xd5b3('0x86')]){rpcDb[_0xd5b3('0x87')](ut[_0xd5b3('0x88')](_0x3b3abb[_0x54fa55]));rpcDb[_0xd5b3('0x89')](_0x22994b,_0xd5b3('0x8a'));}else{ut[_0xd5b3('0x85')](_0x22994b,0x16,_0xd5b3('0x8b'));rpcDb[_0xd5b3('0x89')](_0x22994b,'[HistoryRecallClose]');rpcDb[_0xd5b3('0x8c')](_0x22994b,_0xd5b3('0x8d'));}}}}})['catch'](ut[_0xd5b3('0x80')](_0xd5b3('0x8e')));};Preview[_0xd5b3('0x60')][_0xd5b3('0x67')]=function(_0x45c253){_0x45c253[_0xd5b3('0x5a')]=!![];if(ut[_0xd5b3('0x8f')](_0x45c253[_0xd5b3('0x2b')])){_0x45c253[_0xd5b3('0x5e')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xd5b3('0x90')](_0x45c253[_0xd5b3('0x33')])){_0x45c253[_0xd5b3('0x5e')]='NOT_ACTIVE';}else if(!this[_0xd5b3('0x91')](_0x45c253[_0xd5b3('0x50')])){if(!this[_0xd5b3('0x91')](_0x45c253['TrunkBackup'])){_0x45c253[_0xd5b3('0x5e')]=_0xd5b3('0x92');}else{_0x45c253[_0xd5b3('0x5e')]='ACTIVE';}}else{_0x45c253['message']='ACTIVE';}emitCampaignPreview(_0x45c253);};Preview[_0xd5b3('0x60')]['callProgressDetectingCustomer']=function(_0x4a0363,_0x4ab7d7,_0x17001a){var _0xeba5ce=this;var _0x4299c9=this[_0xd5b3('0x18')][_0x4ab7d7];var _0x43b0bd=this[_0xd5b3('0x15')][_0x4299c9[_0xd5b3('0x6d')]];var _0x80fd82;if(_0x43b0bd){switch(_0x17001a){case'1':_0x43b0bd['outboundNoSuchCallsDay']+=0x1;_0x4299c9[_0xd5b3('0x93')]=ut[_0xd5b3('0x94')](_0x4299c9);ut['logCustomer'](_0x4299c9,0x0,_0xd5b3('0x95'));rpcDb[_0xd5b3('0x89')](_0x4299c9,_0xd5b3('0x96'));if(ut[_0xd5b3('0x94')](_0x4299c9)>=_0x43b0bd['dialGlobalMaxRetry']){_0x80fd82=ut[_0xd5b3('0x97')](_0x4299c9,0xf,_0xd5b3('0x98'));rpcDb[_0xd5b3('0x8c')](_0x80fd82,_0xd5b3('0x99'));}else{rpcDb[_0xd5b3('0x8c')](_0x4299c9,'[callProgressDetectingCustomer][logNoSuchGlobal]');}delete this[_0xd5b3('0x18')][_0x4a0363[_0xd5b3('0x9a')]];break;case _0xd5b3('0x9b'):var _0xa3983=moment()['format'](_0xd5b3('0x84'));_0x4299c9[_0xd5b3('0x9c')]=_0xa3983;_0x4299c9['answertime']=_0xa3983;_0x4299c9['dialAnswer']=!![];_0x43b0bd[_0xd5b3('0x2c')]+=0x1;logger['info'](_0xd5b3('0x9d'),_0x4299c9[_0xd5b3('0x9e')],_0xd5b3('0x9f'),_0x43b0bd[_0xd5b3('0x51')],_0xd5b3('0x6e'),_0x43b0bd['pTalking']);ami['emit']('custom:agentconnect',ut[_0xd5b3('0xa0')](_0x4299c9,_0xd5b3('0xa1')));if(_0x43b0bd['acw']){ami[_0xd5b3('0x28')](_0xd5b3('0xa2'),ut[_0xd5b3('0xa3')](_0x4299c9));}break;case'16':ami[_0xd5b3('0x28')](_0xd5b3('0xa4'),ut[_0xd5b3('0xa0')](_0x4299c9,_0xd5b3('0xa5')));emitVoiceQueueChannelRemove(ut[_0xd5b3('0xa0')](_0x4299c9,_0xd5b3('0xa5')));_0x43b0bd[_0xd5b3('0x38')]+=0x1;_0x43b0bd[_0xd5b3('0xa6')]+=0x1;_0x43b0bd[_0xd5b3('0x2a')]+=0x1;ut[_0xd5b3('0x77')](_0x43b0bd,_0xd5b3('0xa7'));_0x4299c9[_0xd5b3('0x93')]=ut[_0xd5b3('0x94')](_0x4299c9);ut[_0xd5b3('0x85')](_0x4299c9,0x4,'Answer');rpcDb[_0xd5b3('0x89')](_0x4299c9,_0xd5b3('0xa8'));rpcDb['createCustomerFinal'](_0x4299c9,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xd5b3('0xa9')](_0x4299c9);_0x43b0bd['sumDuration']+=_0x4299c9['talktime'];_0x43b0bd[_0xd5b3('0x2d')]+=_0x4299c9[_0xd5b3('0xaa')];logger[_0xd5b3('0x6a')]('[syncHangup][talking][decrement]',_0x4299c9[_0xd5b3('0x9e')],_0xd5b3('0x9f'),_0x43b0bd[_0xd5b3('0x51')],'pTalking:\x20',_0x43b0bd[_0xd5b3('0x2c')]);delete this[_0xd5b3('0x18')][_0x4a0363[_0xd5b3('0x9a')]];break;case _0xd5b3('0xab'):_0x43b0bd[_0xd5b3('0x3a')]+=0x1;_0x4299c9[_0xd5b3('0xac')]+=0x1;_0x4299c9[_0xd5b3('0x93')]=ut['totalGlobal'](_0x4299c9);ut['logCustomer'](_0x4299c9,0x5,_0xd5b3('0xad'));rpcDb[_0xd5b3('0x89')](_0x4299c9,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xd5b3('0x94')](_0x4299c9)>=_0x43b0bd['dialGlobalMaxRetry']){_0x80fd82=ut[_0xd5b3('0x97')](_0x4299c9,0xf,_0xd5b3('0x98'));rpcDb[_0xd5b3('0x8c')](_0x80fd82,_0xd5b3('0xae'));}else{if(_0x4299c9['countbusyretry']>=_0x43b0bd[_0xd5b3('0xaf')]){rpcDb['createCustomerFinal'](_0x4299c9,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd5b3('0xb0')](ut['scheduledAt'](_0x4299c9,_0xd5b3('0xac'),_0x43b0bd['dialBusyRetryFrequency']),_0x4299c9[_0xd5b3('0xb1')],_0x4299c9[_0xd5b3('0xb2')]);}}break;case'NOANSWER':_0x43b0bd[_0xd5b3('0x3f')]+=0x1;_0x4299c9[_0xd5b3('0xb3')]+=0x1;_0x4299c9[_0xd5b3('0x93')]=ut[_0xd5b3('0x94')](_0x4299c9);ut[_0xd5b3('0x85')](_0x4299c9,0x3,_0xd5b3('0xb4'));rpcDb[_0xd5b3('0x89')](_0x4299c9,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xd5b3('0x94')](_0x4299c9)>=_0x43b0bd[_0xd5b3('0xb5')]){_0x80fd82=ut[_0xd5b3('0x97')](_0x4299c9,0xf,_0xd5b3('0x98'));rpcDb['createCustomerFinal'](_0x80fd82,_0xd5b3('0xb6'));}else{if(_0x4299c9['countnoanswerretry']>=_0x43b0bd[_0xd5b3('0xb7')]){rpcDb[_0xd5b3('0x8c')](_0x4299c9,_0xd5b3('0xb8'));}else{rpcDb['rescheduleContact'](ut[_0xd5b3('0xb9')](_0x4299c9,_0xd5b3('0xb3'),_0x43b0bd[_0xd5b3('0xba')]),_0x4299c9['unlockAgent'],_0x4299c9[_0xd5b3('0xb2')]);}}break;case'CONGESTION':_0x43b0bd[_0xd5b3('0x3b')]+=0x1;_0x4299c9[_0xd5b3('0xbb')]+=0x1;_0x4299c9[_0xd5b3('0x93')]=ut[_0xd5b3('0x94')](_0x4299c9);ut['logCustomer'](_0x4299c9,0x8,'Congestion');rpcDb[_0xd5b3('0x89')](_0x4299c9,_0xd5b3('0xbc'));if(ut['totalGlobal'](_0x4299c9)>=_0x43b0bd[_0xd5b3('0xb5')]){_0x80fd82=ut[_0xd5b3('0x97')](_0x4299c9,0xf,_0xd5b3('0x98'));rpcDb[_0xd5b3('0x8c')](_0x80fd82,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4299c9[_0xd5b3('0xbb')]>=_0x43b0bd[_0xd5b3('0xbd')]){rpcDb[_0xd5b3('0x8c')](_0x4299c9,_0xd5b3('0xbc'));}else{rpcDb[_0xd5b3('0xb0')](ut[_0xd5b3('0xb9')](_0x4299c9,_0xd5b3('0xbb'),_0x43b0bd[_0xd5b3('0xbe')]),_0x4299c9[_0xd5b3('0xb1')],_0x4299c9[_0xd5b3('0xb2')]);}}break;case _0xd5b3('0xbf'):_0x43b0bd[_0xd5b3('0xc0')]+=0x1;_0x4299c9[_0xd5b3('0x93')]=ut[_0xd5b3('0x94')](_0x4299c9);ut[_0xd5b3('0x85')](_0x4299c9,0x14,_0xd5b3('0xc1'));rpcDb[_0xd5b3('0x89')](_0x4299c9,_0xd5b3('0xc2'));if(_0x4299c9[_0xd5b3('0xb1')]){rpcDb['unlockContact'](_0x4299c9['idContact']);}if(_0x4299c9[_0xd5b3('0xb2')]){rpcDb[_0xd5b3('0xc3')](_0x4299c9['idContact']);}break;default:if(_0x4299c9[_0xd5b3('0xc4')]){ut[_0xd5b3('0x77')](_0x43b0bd,_0xd5b3('0xc5'));ut[_0xd5b3('0xc6')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x43b0bd['name'],_0x4a0363);}_0x43b0bd['outboundUnknownCallsDay']+=0x1;_0x4299c9['countglobal']=ut['totalGlobal'](_0x4299c9);ut['logCustomer'](_0x4299c9,0xc,_0x4a0363['cause-txt']||_0x4a0363[_0xd5b3('0xc7')]);rpcDb[_0xd5b3('0x89')](_0x4299c9,_0xd5b3('0xc8'));if(ut[_0xd5b3('0x94')](_0x4299c9)>=_0x43b0bd[_0xd5b3('0xb5')]){_0x80fd82=ut[_0xd5b3('0x97')](_0x4299c9,0xf,_0xd5b3('0x98'));rpcDb[_0xd5b3('0x8c')](_0x80fd82,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x4299c9,_0xd5b3('0xc9'));}delete this[_0xd5b3('0x18')][_0x4a0363[_0xd5b3('0x9a')]];}if(!(_0x4299c9['dialAnswer']&&_0x17001a==='16')){ut['updateOriginated'](_0x43b0bd,'[callProgressDetectingCustomer]');logger[_0xd5b3('0x6a')](_0xd5b3('0xca'),_0x4299c9['uniqueid'],_0xd5b3('0x9f'),_0x43b0bd[_0xd5b3('0x51')],_0xd5b3('0xcb'),_0x43b0bd[_0xd5b3('0x4c')]);}if(_0x17001a!==_0xd5b3('0x9b')){delete this[_0xd5b3('0x18')][_0x4a0363[_0xd5b3('0x9a')]];delete this[_0xd5b3('0x18')][_0x4a0363[_0xd5b3('0xcc')]];}}};Preview[_0xd5b3('0x60')][_0xd5b3('0xcd')]=function(_0x25f3a2,_0x5f4fd7,_0x30e3a6){if(_[_0xd5b3('0xce')](_0x5f4fd7)&&_0xd5b3('0xcf')!==typeof _0x5f4fd7){return;}if(_[_0xd5b3('0xce')](_0x30e3a6)&&_0xd5b3('0xcf')!==typeof _0x30e3a6){return;}switch(_0x30e3a6[_0xd5b3('0xd0')]){case'0':ut[_0xd5b3('0xd1')](_0x25f3a2,0x0,_0xd5b3('0x95'));rpcDb[_0xd5b3('0xd2')](_0x25f3a2,_0xd5b3('0xd3'));break;case'3':ut[_0xd5b3('0xd1')](_0x25f3a2,0x3,_0xd5b3('0xb4'));rpcDb[_0xd5b3('0xd2')](_0x25f3a2,_0xd5b3('0xd4'));break;case'5':ut[_0xd5b3('0xd1')](_0x25f3a2,0x5,_0xd5b3('0xad'));rpcDb[_0xd5b3('0xd2')](_0x25f3a2,_0xd5b3('0xd5'));break;case'8':ut['logAgent'](_0x25f3a2,0x8,_0xd5b3('0xd6'));rpcDb[_0xd5b3('0xd2')](_0x25f3a2,_0xd5b3('0xd7'));break;case'22':ut['logAgent'](_0x25f3a2,0x16,_0xd5b3('0xd8'));rpcDb['createAgentHistory'](_0x25f3a2,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xd5b3('0xd1')](_0x25f3a2,0xc,_0x30e3a6[_0xd5b3('0xd0')]);rpcDb['createAgentHistory'](_0x25f3a2,_0xd5b3('0xd7'));}ut['updateOriginated'](_0x5f4fd7,_0xd5b3('0xd9'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x25f3a2[_0xd5b3('0x9e')],'\x20Queue',_0x5f4fd7['name'],_0xd5b3('0xcb'),_0x5f4fd7[_0xd5b3('0x4c')]);delete this[_0xd5b3('0x18')][_0x25f3a2[_0xd5b3('0x9e')]];};Preview['prototype'][_0xd5b3('0xda')]=function(_0x2aa09a,_0x4fab66,_0x1d7678,_0x513059,_0x5d4906){var _0x1ecd43=this;return new BPromise(function(_0x2c8817,_0x408fd6){if(_[_0xd5b3('0x69')](_0x4fab66)||_[_0xd5b3('0x69')](_0x4fab66[_0xd5b3('0xdb')])||_[_0xd5b3('0x69')](_0x4fab66[_0xd5b3('0xdb')][_0xd5b3('0xdc')])||_[_0xd5b3('0x69')](_0x4fab66[_0xd5b3('0x71')])){_0x408fd6(ut[_0xd5b3('0x5e')](_0xd5b3('0xdd'),_0x513059,_0x5d4906));return;}var _0x5b9b75=uuid['v4']();var _0x98e42c=_0x1ecd43[_0xd5b3('0x15')][_0x4fab66[_0xd5b3('0x6c')]['name']];var _0x198eb1=_0x1d7678?_0x1ecd43[_0xd5b3('0x19')][_0x1d7678]['id']:undefined;_0x1ecd43[_0xd5b3('0x18')][_0x5b9b75]=new Action(_0x4fab66,_0x98e42c,_0x5b9b75,_0x1d7678,_0x198eb1);var _0x548cc9=_0x1ecd43[_0xd5b3('0x18')][_0x5b9b75];_0x548cc9[_0xd5b3('0xb1')]=_0x513059;_0x548cc9[_0xd5b3('0xb2')]=_0x5d4906;_0x548cc9[_0xd5b3('0xde')]=_0x1d7678;if(_[_0xd5b3('0xdf')](_0x2aa09a)){_0x1ecd43[_0xd5b3('0xe0')](_0x548cc9,_0x98e42c,_0x4fab66,_0x1d7678)[_0xd5b3('0x7b')](function(_0xe5a928){logger[_0xd5b3('0x6a')](_0xd5b3('0xe1'),'Queue:\x20'+_0x548cc9[_0xd5b3('0x6d')]+_0xd5b3('0xe2')+_0x548cc9[_0xd5b3('0xe3')],JSON['stringify'](_0xe5a928));ami[_0xd5b3('0x28')](_0xd5b3('0xe4'),ut['buildObj'](_0x548cc9,_0xd5b3('0xe5')));_0x2c8817(ut[_0xd5b3('0x5e')](_0xd5b3('0xe6')));})[_0xd5b3('0x82')](function(_0x4e68ac){ut[_0xd5b3('0x5c')]('[Preview][execCall][failure]',_0x4e68ac);_0x408fd6(ut[_0xd5b3('0x5e')]('Call\x20failed',_0x513059,_0x5d4906));});}else{_0x98e42c[_0xd5b3('0x39')]+=0x1;ut[_0xd5b3('0xe7')](_0x548cc9);rpcDb[_0xd5b3('0xe8')](_0x548cc9,_0xd5b3('0xe9'));delete _0x1ecd43[_0xd5b3('0x18')][_0x5b9b75];_0x408fd6(ut['message'](_0xd5b3('0xea'),_0x513059,_0x5d4906));}});};Preview[_0xd5b3('0x60')][_0xd5b3('0x91')]=function(_0x5a3d60){return!_[_0xd5b3('0x69')](_0x5a3d60)&&!_[_0xd5b3('0x69')](_0x5a3d60[_0xd5b3('0x51')])&&!_[_0xd5b3('0x69')](_0x5a3d60['active'])&&_0x5a3d60[_0xd5b3('0x52')]&&!_['isNil'](this['trunks'][util[_0xd5b3('0x56')]('SIP/%s',_0x5a3d60[_0xd5b3('0x51')])])&&!_[_0xd5b3('0x69')](this[_0xd5b3('0x17')][util[_0xd5b3('0x56')]('SIP/%s',_0x5a3d60['name'])][_0xd5b3('0xeb')])&&(this[_0xd5b3('0x17')][util[_0xd5b3('0x56')](_0xd5b3('0xec'),_0x5a3d60[_0xd5b3('0x51')])][_0xd5b3('0xeb')]===_0xd5b3('0xed')||this['trunks'][util[_0xd5b3('0x56')]('SIP/%s',_0x5a3d60[_0xd5b3('0x51')])][_0xd5b3('0xeb')]==='unmonitored');};Preview[_0xd5b3('0x60')]['run']=function(_0x400fb9,_0x374b32){var _0x14f3a5=this;return new BPromise(function(_0x1b3640,_0x240f47){_0x14f3a5[_0xd5b3('0xee')](_0x400fb9,_0x374b32)['then'](function(_0x42896e){_0x1b3640(_[_0xd5b3('0x6f')](_0x42896e,[_0xd5b3('0x5e')]));})[_0xd5b3('0x82')](function(_0x1d6824){if(_0x1d6824[_0xd5b3('0xef')]){rpcDb[_0xd5b3('0xf0')](_0x400fb9);}if(_0x1d6824[_0xd5b3('0x52')]){rpcDb['disableContact'](_0x400fb9);}_0x240f47(_['pick'](_0x1d6824,['message']));});});};Preview[_0xd5b3('0x60')][_0xd5b3('0xee')]=function(_0x16036a,_0x25b63b){var _0x467673=this;return new BPromise(function(_0x2f3f93,_0x3975f0){var _0x583ee4,_0x35c9ca;rpcDb['getContactPreview'](_0x16036a)[_0xd5b3('0x7b')](function(_0x347dd1){if(!_[_0xd5b3('0x69')](_0x347dd1[0x0])){_0x35c9ca=_0x347dd1[0x0][_0xd5b3('0xf1')]?![]:!![];_0x583ee4=_0x347dd1[0x0][_0xd5b3('0xf1')]?!![]:![];_0x583ee4=_0x25b63b?!![]:_0x583ee4;}var _0xde05d8=_0x467673['validateContact'](_0x347dd1);if(_0xde05d8[_0xd5b3('0xf2')]){rpcDb['checkIsBlackList'](_[_0xd5b3('0x6f')](_0x347dd1[0x0],['VoiceQueueId','Contact.phone']))[_0xd5b3('0x7b')](function(_0x25e944){_0x467673[_0xd5b3('0xda')](_0x25e944,_0x347dd1[0x0],_0x25b63b,_0x35c9ca,_0x583ee4)[_0xd5b3('0x7b')](function(_0x26ee81){_0x2f3f93(_0x26ee81);})[_0xd5b3('0x82')](function(_0x14e842){_0x3975f0(_0x14e842);});})[_0xd5b3('0x82')](function(_0x5ceaf1){ut[_0xd5b3('0x5c')](_0xd5b3('0xf3'),_0x5ceaf1);_0x3975f0(ut[_0xd5b3('0x5e')]('Call\x20unsuccessful',_0x35c9ca,_0x583ee4));});}else{_0x3975f0(ut[_0xd5b3('0x5e')](_0xde05d8[_0xd5b3('0x5e')],_0x35c9ca,_0x583ee4));}})['catch'](function(_0x13b927){ut['logger'](_0xd5b3('0xf4'),_0x13b927);_0x3975f0(ut['message'](_0xd5b3('0xf5'),![],!![]));});});};Preview[_0xd5b3('0x60')]['validateContact']=function(_0x4361b3){if(_['isNil'](_0x4361b3)||_['isEmpty'](_0x4361b3)||!_[_0xd5b3('0x69')](_0x4361b3[0x0][_0xd5b3('0xf6')])&&_[_0xd5b3('0x69')](_0x4361b3[0x0][_0xd5b3('0xf6')][_0xd5b3('0x51')])){ut[_0xd5b3('0x5c')]('[Preview][validateContact][Empty\x20Contact]',_0x4361b3);return{'isValid':![],'message':_0xd5b3('0xf7')};}var _0x58c1c3=this[_0xd5b3('0x15')][_0x4361b3[0x0][_0xd5b3('0x6c')][_0xd5b3('0x51')]];_0x58c1c3['message']=_0xd5b3('0xf8');if(_[_0xd5b3('0x69')](_0x58c1c3)){ut[_0xd5b3('0x5c')](_0xd5b3('0xf9'),_0x58c1c3);return{'isValid':![],'message':_0xd5b3('0xfa')};}if(!this['isTrunkReachable'](_0x58c1c3['Trunk'])){ut[_0xd5b3('0x5c')](_0xd5b3('0xfb'),_0xd5b3('0xfc')+_0x58c1c3[_0xd5b3('0x51')]+_0xd5b3('0xfd'));if(!this[_0xd5b3('0x91')](_0x58c1c3[_0xd5b3('0xfe')])){ut[_0xd5b3('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x58c1c3[_0xd5b3('0x51')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xd5b3('0xff')};}}if(!ut['isActive'](_0x58c1c3[_0xd5b3('0x33')])){ut['logger'](_0xd5b3('0x100'),_0x58c1c3[_0xd5b3('0x51')]+_0xd5b3('0x101'));return{'isValid':![],'message':_0xd5b3('0xfc')+_0x58c1c3['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0xd5b3('0xe0')]=function(_0x121fbf,_0x45a715,_0x37e72f,_0xae6f23){var _0x269d61=this;return new BPromise(function(_0x44ab61,_0x22871a){var _0x2e3d4b=_0x121fbf[_0xd5b3('0x9e')];var _0x3cc216=_0x269d61[_0xd5b3('0x91')](_0x45a715[_0xd5b3('0x50')])?util[_0xd5b3('0x56')](_0xd5b3('0x102'),_0x45a715[_0xd5b3('0x50')][_0xd5b3('0x51')],_[_0xd5b3('0x69')](_0x45a715['dialPrefix'])?'':_0x45a715[_0xd5b3('0x103')][_0xd5b3('0x104')]()||'',_0x45a715[_0xd5b3('0x105')]>0x0?_0x37e72f[_0xd5b3('0xdb')][_0xd5b3('0xdc')][_0xd5b3('0x106')](_0x45a715['dialCutDigit']):_0x37e72f[_0xd5b3('0xdb')]['phone']):util[_0xd5b3('0x56')](_0xd5b3('0x102'),_[_0xd5b3('0x69')](_0x45a715[_0xd5b3('0xfe')])?_0x45a715[_0xd5b3('0x50')]['name']:_0x45a715[_0xd5b3('0xfe')][_0xd5b3('0x51')],_[_0xd5b3('0x69')](_0x45a715[_0xd5b3('0x103')])?'':_0x45a715[_0xd5b3('0x103')][_0xd5b3('0x104')]()||'',_0x45a715[_0xd5b3('0x105')]>0x0?_0x37e72f['Contact'][_0xd5b3('0xdc')][_0xd5b3('0x106')](_0x45a715[_0xd5b3('0x105')]):_0x37e72f[_0xd5b3('0xdb')]['phone']);var _0x19ee55=_0x269d61[_0xd5b3('0x91')](_0x45a715['Trunk'])?ut[_0xd5b3('0x107')](_0x45a715['Trunk'][_0xd5b3('0x108')],_0x45a715['dialOriginateCallerIdName'],_0x45a715['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xd5b3('0x109')](_0x45a715['dialOriginateCallerIdNumber'],_0x45a715[_0xd5b3('0x10a')]):_0x45a715['dialOriginateCallerIdNumber']):ut[_0xd5b3('0x107')](_['isNil'](_0x45a715[_0xd5b3('0xfe')])?_0x45a715[_0xd5b3('0x50')]['callerid']:_0x45a715['TrunkBackup'][_0xd5b3('0x108')],_0x45a715[_0xd5b3('0x35')],_0x45a715[_0xd5b3('0x10a')]>0x0?ut[_0xd5b3('0x109')](_0x45a715['dialOriginateCallerIdNumber'],_0x45a715[_0xd5b3('0x10a')]):_0x45a715[_0xd5b3('0x36')]);if(_0x19ee55){_0x121fbf[_0xd5b3('0x10b')]=ut[_0xd5b3('0x10c')](_0x19ee55);_0x121fbf[_0xd5b3('0x10d')]=ut[_0xd5b3('0x10e')](_0x19ee55);}var _0x316cd6=ut[_0xd5b3('0x10f')](_0x45a715,_0x37e72f,_0x3cc216,_0x19ee55,_0x2e3d4b,_0x121fbf);_[_0xd5b3('0x110')](_0x121fbf,ut['toLowerVariables'](_0x316cd6));_0x121fbf[_0xd5b3('0x83')]=moment()[_0xd5b3('0x56')](_0xd5b3('0x84'));ami[_0xd5b3('0x111')](ut['variablesAction'](_0x121fbf,_0x45a715,_0x316cd6,_0x121fbf[_0xd5b3('0xb2')],_0xae6f23))['then'](function(_0x29c25d){_0x45a715['originated']+=0x1;logger[_0xd5b3('0x6a')](_0xd5b3('0x112'),_0x2e3d4b,_0xd5b3('0x9f'),_0x45a715[_0xd5b3('0x51')],'originated:\x20',_0x45a715['originated']);_0x44ab61(_0x29c25d);})[_0xd5b3('0x82')](function(_0x499d33){ut['logAgent'](_0x121fbf,0xe,_0xd5b3('0x113'));rpcDb['createAgentHistory'](_0x121fbf,_0xd5b3('0x114'));_0x22871a(_0x499d33);});});};Preview[_0xd5b3('0x60')][_0xd5b3('0x21')]=function(_0x5cf3c2){if(this[_0xd5b3('0x18')][_0x5cf3c2['linkedid']]){this[_0xd5b3('0x18')][_0x5cf3c2[_0xd5b3('0x9a')]][_0xd5b3('0x73')]=_0x5cf3c2[_0xd5b3('0x73')];}};Preview['prototype'][_0xd5b3('0x1b')]=function(_0x5b9426){var _0x55e25f=this;var _0x257b83=this[_0xd5b3('0x18')][_0x5b9426[_0xd5b3('0x115')]];if(_0x257b83){if(_0x257b83[_0xd5b3('0xde')]&&this['agents'][_0x257b83['lookAgent']]){ut[_0xd5b3('0x116')](_0x257b83,this[_0xd5b3('0x19')][_0x257b83[_0xd5b3('0xde')]][_0xd5b3('0x51')],this['agents'][_0x257b83[_0xd5b3('0xde')]]['id']);}var _0x15ddd4=_[_0xd5b3('0x117')](_0x257b83);_0x15ddd4['responsetime']=moment()[_0xd5b3('0x56')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1b258c=_0x55e25f[_0xd5b3('0x15')][_0x257b83[_0xd5b3('0x6d')]];if(ut['isFailure'](_0x5b9426[_0xd5b3('0x118')])){if(_0x257b83[_0xd5b3('0xb1')]){rpcDb[_0xd5b3('0xf0')](_0x257b83[_0xd5b3('0xe3')]);}if(_0x257b83[_0xd5b3('0xb2')]){rpcDb[_0xd5b3('0xc3')](_0x257b83[_0xd5b3('0xe3')]);}ami[_0xd5b3('0x28')](_0xd5b3('0x119'),ut[_0xd5b3('0xa0')](_0x257b83,_0xd5b3('0x11a')));this[_0xd5b3('0xcd')](_0x15ddd4,_0x1b258c,_0x5b9426);}else{_0x257b83[_0xd5b3('0x83')]=moment()[_0xd5b3('0x56')](_0xd5b3('0x84'));ut['logAgent'](_0x15ddd4,0x4,_0xd5b3('0x11b'));rpcDb[_0xd5b3('0xd2')](_0x15ddd4,_0xd5b3('0x11c'));}}};Preview['prototype'][_0xd5b3('0x11d')]=function(_0x5be9f1){var _0x21eb64=this;var _0x5c0f4f=this[_0xd5b3('0x18')][_0x5be9f1[_0xd5b3('0x9a')]];var _0x412f0a;if(_0x5c0f4f){_0x412f0a=this[_0xd5b3('0x15')][_0x5c0f4f[_0xd5b3('0x6d')]];logger['info'](_0xd5b3('0x11e'),_0x5be9f1[_0xd5b3('0x9a')],_0xd5b3('0x9f'),_0x412f0a[_0xd5b3('0x51')],_0xd5b3('0x6e'),_0x412f0a['pTalking']);}if(this[_0xd5b3('0x18')][_0x5be9f1['linkedid']]&&_0x5be9f1[_0xd5b3('0x9a')]!==_0x5be9f1['uniqueid']){if(_0x5be9f1[_0xd5b3('0x11f')]==='16'&&this[_0xd5b3('0x18')][_0x5be9f1[_0xd5b3('0x9a')]][_0xd5b3('0xc4')]){this[_0xd5b3('0x120')](_0x5be9f1,_0x5be9f1[_0xd5b3('0x9a')],_0x5be9f1[_0xd5b3('0x11f')]);}else if(this['actions'][_0x5be9f1[_0xd5b3('0x9a')]][_0xd5b3('0xc4')]){logger[_0xd5b3('0x6a')](_0xd5b3('0x121'),_0x5be9f1[_0xd5b3('0x9a')],_0x5be9f1['cause'],_0xd5b3('0x9f'),_0x412f0a['name'],_0xd5b3('0x6e'),_0x412f0a[_0xd5b3('0x2c')]);this['callProgressDetectingCustomer'](_0x5be9f1,_0x5be9f1[_0xd5b3('0x9a')],_0x5be9f1[_0xd5b3('0x11f')]);}}else if(_0x5c0f4f&&_[_0xd5b3('0x69')](_0x5c0f4f[_0xd5b3('0x122')])&&_0x412f0a[_0xd5b3('0x123')]&&_0x5be9f1[_0xd5b3('0x9a')]===_0x5be9f1['uniqueid']&&_[_0xd5b3('0x69')](_0x5be9f1['reason'])&&_0x5be9f1[_0xd5b3('0x11f')]==='16'&&_0x5be9f1[_0xd5b3('0x124')]==='6'&&_[_0xd5b3('0xce')](_0x5c0f4f[_0xd5b3('0x125')])){if(_0x5c0f4f['unlockAgent']){rpcDb[_0xd5b3('0xf0')](_0x5c0f4f[_0xd5b3('0xe3')]);}if(_0x5c0f4f['activeContact']){rpcDb[_0xd5b3('0xc3')](_0x5c0f4f[_0xd5b3('0xe3')]);}_0x5be9f1['reason']='22';this[_0xd5b3('0xcd')](_0x5c0f4f,_0x412f0a,_0x5be9f1);}else if(_0x5c0f4f&&_0x5c0f4f[_0xd5b3('0x125')]){if(_0x5be9f1[_0xd5b3('0x11f')]==='16'&&this['actions'][_0x5be9f1[_0xd5b3('0x9a')]][_0xd5b3('0xc4')]){logger['info'](_0xd5b3('0x126'),_0x5be9f1[_0xd5b3('0x9a')],_0x5be9f1[_0xd5b3('0x11f')],_0xd5b3('0x9f'),_0x412f0a['name'],'pTalking:\x20',_0x412f0a[_0xd5b3('0x2c')]);this['callProgressDetectingCustomer'](_0x5be9f1,_0x5be9f1['linkedid'],_0x5be9f1['cause']);}else if(this[_0xd5b3('0x18')][_0x5be9f1[_0xd5b3('0x9a')]][_0xd5b3('0xc4')]){logger[_0xd5b3('0x6a')]('[syncHangup][talking][cause]',_0x5be9f1[_0xd5b3('0x9a')],_0x5be9f1[_0xd5b3('0x11f')],_0xd5b3('0x9f'),_0x412f0a[_0xd5b3('0x51')],_0xd5b3('0x6e'),_0x412f0a[_0xd5b3('0x2c')]);this[_0xd5b3('0x120')](_0x5be9f1,_0x5be9f1['linkedid'],_0x5be9f1[_0xd5b3('0x11f')]);}}};Preview['prototype'][_0xd5b3('0x1f')]=function(_0x4dced0){if(this['actions'][_0x4dced0[_0xd5b3('0xcc')]]&&_0x4dced0['destlinkedid']!==_0x4dced0[_0xd5b3('0x127')]){this[_0xd5b3('0x120')](_0x4dced0,_0x4dced0[_0xd5b3('0xcc')],_0x4dced0[_0xd5b3('0xc7')]);}};Preview[_0xd5b3('0x60')]['syncHangupRequest']=function(_0x187d96){if(this[_0xd5b3('0x18')][_0x187d96[_0xd5b3('0x9a')]]&&_0x187d96['linkedid']!==_0x187d96['uniqueid']&&!this[_0xd5b3('0x18')][_0x187d96[_0xd5b3('0x9a')]][_0xd5b3('0xc4')]){if(_0x187d96[_0xd5b3('0x11f')]==='1'){this['callProgressDetectingCustomer'](_0x187d96,_0x187d96[_0xd5b3('0x9a')],_0x187d96['cause']);}}};Preview['prototype'][_0xd5b3('0x128')]=function(_0x57a568,_0x1ac58c,_0x426ea9){if(this[_0xd5b3('0x18')][_0x57a568]){if(_['isNil'](this[_0xd5b3('0x18')][_0x57a568]['variables'])){this[_0xd5b3('0x18')][_0x57a568][_0xd5b3('0x129')]={};}this[_0xd5b3('0x18')][_0x57a568]['variables'][_0x1ac58c]=_0x426ea9;}};Preview['prototype'][_0xd5b3('0x23')]=function(_0x3edf93){try{if(!_['isNil'](_0x3edf93)){if(ut[_0xd5b3('0x12a')](_[_0xd5b3('0x12b')](_0x3edf93[_0xd5b3('0x12c')])[0x0])){this[_0xd5b3('0x128')](_0x3edf93['uniqueid'],_[_0xd5b3('0x12b')](_0x3edf93[_0xd5b3('0x12c')])[0x0],_0x3edf93[_0xd5b3('0x12d')]);}}}catch(_0x382742){logger[_0xd5b3('0x12e')](_0xd5b3('0x12f'),util[_0xd5b3('0x130')](_0x382742,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xd5b3('0x25')]=function(_0x4b7894){if(_0x4b7894){if(this[_0xd5b3('0x18')][_0x4b7894['transfertargetlinkedid']]){this[_0xd5b3('0x18')][_0x4b7894[_0xd5b3('0x131')]][_0xd5b3('0x125')]=!![];}}};Preview[_0xd5b3('0x60')][_0xd5b3('0x26')]=function(_0x36494f){if(_0x36494f){if(this[_0xd5b3('0x18')][_0x36494f[_0xd5b3('0x132')]]){this[_0xd5b3('0x18')][_0x36494f[_0xd5b3('0x132')]][_0xd5b3('0x125')]=!![];}}};module[_0xd5b3('0x133')]=Preview; \ No newline at end of file +var _0xe307=['dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','\x20Queue','ANSWER','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','unmonitored','execRun','unlock','disableContact','getContactPreview','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','starttime','variablesAction','[originated][increment]','OriginateError','channel','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','channelstate','transfer','[syncHangup][talking][cause]','destlinkedid','destuniqueid','variables','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','outbound','name','strategy','answered','available','pTalking','sumBillable','sumDuration','talking','total','type','unmanaged','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','voice:queue:%s','sendMessageOneNotActive','paused','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','dialActive','setMessage','recallMe','clearZombieChannel','isNil','info','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','message','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','run','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','catch','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','Busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','unlockAgent','activeContact','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','rescheduleContact','idContact','[default]','cause-txt'];(function(_0x40cadd,_0x3849d6){var _0x9a53a2=function(_0x1f98fe){while(--_0x1f98fe){_0x40cadd['push'](_0x40cadd['shift']());}};_0x9a53a2(++_0x3849d6);}(_0xe307,0x64));var _0x7e30=function(_0x4dbb98,_0x2b0c4a){_0x4dbb98=_0x4dbb98-0x0;var _0x14b698=_0xe307[_0x4dbb98];return _0x14b698;};'use strict';var util=require(_0x7e30('0x0'));var _=require('lodash');var BPromise=require(_0x7e30('0x1'));var uuid=require(_0x7e30('0x2'));var moment=require(_0x7e30('0x3'));var md5=require(_0x7e30('0x4'));var Redis=require(_0x7e30('0x5'));var config=require(_0x7e30('0x6'));var logger=require(_0x7e30('0x7'))(_0x7e30('0x8'));var loggerAction=require(_0x7e30('0x7'))(_0x7e30('0x9'));var ami=require(_0x7e30('0xa'));var rpcDb=require('./rpcDb');var Action=require(_0x7e30('0xb'));var ut=require(_0x7e30('0xc'));config['redis']=_['defaults'](config[_0x7e30('0xd')],{'host':_0x7e30('0xe'),'port':0x18eb});var io=require(_0x7e30('0xf'))(new Redis(config[_0x7e30('0xd')]));var Sequence=function(){};Sequence[_0x7e30('0x10')][_0x7e30('0x11')]=function(_0x342c46){this[_0x7e30('0x12')]=this[_0x7e30('0x12')]?this[_0x7e30('0x12')][_0x7e30('0x13')](_0x342c46):_0x342c46();};function Preview(_0x456431){this[_0x7e30('0x14')]=new Sequence();this['campaignsPreview']=_0x456431[_0x7e30('0x15')];this[_0x7e30('0x16')]=_0x456431[_0x7e30('0x16')];this[_0x7e30('0x17')]={};this[_0x7e30('0x18')]=_0x456431[_0x7e30('0x18')];this[_0x7e30('0x19')]=0x0;ami['on'](_0x7e30('0x1a'),this[_0x7e30('0x1b')][_0x7e30('0x1c')](this));ami['on'](_0x7e30('0x1d'),this[_0x7e30('0x1e')][_0x7e30('0x1c')](this));ami['on'](_0x7e30('0x1f'),this[_0x7e30('0x20')]['bind'](this));ami['on'](_0x7e30('0x21'),this[_0x7e30('0x22')][_0x7e30('0x1c')](this));ami['on'](_0x7e30('0x23'),this[_0x7e30('0x24')][_0x7e30('0x1c')](this));ami['on'](_0x7e30('0x25'),this[_0x7e30('0x26')]['bind'](this));ami['on'](_0x7e30('0x27'),this[_0x7e30('0x28')][_0x7e30('0x1c')](this));ami['on']('blindtransfer',this[_0x7e30('0x29')][_0x7e30('0x1c')](this));this[_0x7e30('0x2a')](this[_0x7e30('0x2b')]);}function emit(_0x45a578,_0x1d2dce,_0x30c929){io['to'](_0x45a578)[_0x7e30('0x2c')](_0x1d2dce,_0x30c929);}function emitCampaignPreview(_0x20df44){if(_0x20df44['type']===_0x7e30('0x2d')){var _0x153a66={'id':_0x20df44['id'],'name':_0x20df44[_0x7e30('0x2e')],'strategy':_0x20df44[_0x7e30('0x2f')],'answered':_0x20df44[_0x7e30('0x30')],'available':_0x20df44[_0x7e30('0x31')],'loggedIn':_0x20df44['loggedIn'],'pTalking':_0x20df44[_0x7e30('0x32')],'sumBillable':_0x20df44[_0x7e30('0x33')],'sumDuration':_0x20df44[_0x7e30('0x34')],'sumHoldTime':_0x20df44['sumHoldTime']||0x0,'talking':_0x20df44[_0x7e30('0x35')],'total':_0x20df44[_0x7e30('0x36')],'type':_0x20df44[_0x7e30('0x37')],'unmanaged':_0x20df44[_0x7e30('0x38')],'abandoned':_0x20df44['abandoned'],'waiting':_0x20df44[_0x7e30('0x39')],'loggedInDb':_0x20df44['loggedInDb'],'dialActive':_0x20df44['dialActive'],'dialMethod':_0x20df44[_0x7e30('0x3a')],'dialOriginateCallerIdName':_0x20df44[_0x7e30('0x3b')],'dialOriginateCallerIdNumber':_0x20df44[_0x7e30('0x3c')],'dialOriginateTimeout':_0x20df44[_0x7e30('0x3d')],'dialPrefix':_0x20df44[_0x7e30('0x3e')],'outboundAnswerAgiCallsDay':_0x20df44[_0x7e30('0x3f')],'outboundAnswerCallsDay':_0x20df44[_0x7e30('0x40')],'outboundBlacklistCallsDay':_0x20df44[_0x7e30('0x41')],'outboundBusyCallsDay':_0x20df44[_0x7e30('0x42')],'outboundCongestionCallsDay':_0x20df44[_0x7e30('0x43')],'outboundDropCallsDayACS':_0x20df44[_0x7e30('0x44')],'outboundDropCallsDayCallersExit':_0x20df44['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x20df44['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x20df44[_0x7e30('0x45')],'outboundNoSuchCallsDay':_0x20df44[_0x7e30('0x46')],'outboundOriginateFailureCallsDay':_0x20df44[_0x7e30('0x47')],'outboundReCallsDay':_0x20df44[_0x7e30('0x48')],'outboundRejectCallsDay':_0x20df44[_0x7e30('0x49')],'outboundUnknownCallsDay':_0x20df44[_0x7e30('0x4a')],'predictiveIntervalAnsweredCalls':_0x20df44['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x20df44[_0x7e30('0x4b')],'predictiveIntervalAvgTalktime':_0x20df44[_0x7e30('0x4c')],'predictiveIntervalDroppedCallsCallersExit':_0x20df44['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x20df44[_0x7e30('0x4d')],'predictiveIntervalErlangCalls':_0x20df44[_0x7e30('0x4e')],'predictiveIntervalErlangCallsDroppedCalls':_0x20df44[_0x7e30('0x4f')],'predictiveIntervalHitRate':_0x20df44[_0x7e30('0x50')],'predictiveIntervalMultiplicativeFactor':_0x20df44[_0x7e30('0x51')],'predictiveIntervalPauses':_0x20df44[_0x7e30('0x52')],'predictiveIntervalAvailable':_0x20df44[_0x7e30('0x53')],'predictiveIntervalTotalCalls':_0x20df44['predictiveIntervalTotalCalls'],'message':_0x20df44['message'],'originated':_0x20df44[_0x7e30('0x54')],'erlangCalls':_0x20df44['erlangCalls'],'erlangCallToSecond':_0x20df44[_0x7e30('0x55')],'erlangAbandonmentRate':_0x20df44['erlangAbandonmentRate'],'erlangBusyFactor':_0x20df44[_0x7e30('0x56')],'startPredictive':_0x20df44[_0x7e30('0x57')],'startProgressive':_0x20df44[_0x7e30('0x58')]};if(_0x20df44[_0x7e30('0x59')]){_0x153a66[_0x7e30('0x59')]={'id':_0x20df44[_0x7e30('0x59')]['id'],'name':_0x20df44[_0x7e30('0x59')][_0x7e30('0x2e')],'active':_0x20df44['Trunk'][_0x7e30('0x5a')],'callerid':_0x20df44['Trunk'][_0x7e30('0x5b')]};}if(_0x20df44[_0x7e30('0x5c')]){_0x153a66[_0x7e30('0x5c')]={'id':_0x20df44[_0x7e30('0x5c')]['id'],'name':_0x20df44[_0x7e30('0x5c')][_0x7e30('0x2e')]};}var _0x50c661=md5(JSON[_0x7e30('0x5d')](_0x153a66));if(_0x20df44['md5']!==_0x50c661){_0x20df44[_0x7e30('0x4')]=_0x50c661;emit(util[_0x7e30('0x5e')]('voice:queue:%s',_0x153a66[_0x7e30('0x2e')]),_0x7e30('0x5f'),_0x153a66);}}}function emitVoiceQueueChannelRemove(_0x316c5a){emit(util[_0x7e30('0x5e')](_0x7e30('0x60'),_0x316c5a['name']),'voice_queue_channel:remove',_0x316c5a);}function notSendMessagesQueue(_0x3b3dc3){if(_0x3b3dc3['sendMessageOneNotActive']){if(_0x3b3dc3[_0x7e30('0x54')]===0x0&&_0x3b3dc3[_0x7e30('0x32')]===0x0){_0x3b3dc3[_0x7e30('0x61')]=![];_0x3b3dc3[_0x7e30('0x31')]=0x0;_0x3b3dc3[_0x7e30('0x62')]=0x0;_0x3b3dc3['message']='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3b3dc3[_0x7e30('0x2e')]+_0x7e30('0x63'));}else{_0x3b3dc3['message']=_0x7e30('0x64');ut[_0x7e30('0x65')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3b3dc3[_0x7e30('0x2e')]+_0x7e30('0x66'));}emitCampaignPreview(_0x3b3dc3);}}Preview[_0x7e30('0x10')][_0x7e30('0x2a')]=function(){var _0xec31ba=this;setInterval(function(){_0xec31ba[_0x7e30('0x67')]();},0x7cf);};Preview[_0x7e30('0x10')]['syncCampaigns']=function(){var _0x374966=this[_0x7e30('0x2b')];this[_0x7e30('0x19')]+=0x1;for(var _0x52f363 in _0x374966){if(_0x374966[_0x7e30('0x68')](_0x52f363)&&(_0x374966[_0x52f363][_0x7e30('0x3a')]==='preview'||_0x374966[_0x52f363]['dialMethod']===_0x7e30('0x69'))&&_0x374966[_0x52f363][_0x7e30('0x37')]===_0x7e30('0x2d')){if(this[_0x7e30('0x19')]>0x7){this[_0x7e30('0x19')]=0x0;this['clearZombieChannels']();}}if(_0x374966['hasOwnProperty'](_0x52f363)&&_0x374966[_0x52f363][_0x7e30('0x3a')]==='preview'&&_0x374966[_0x52f363][_0x7e30('0x37')]==='outbound'){if(_0x374966[_0x52f363][_0x7e30('0x6a')]){this[_0x7e30('0x6b')](_0x374966[_0x52f363]);this[_0x7e30('0x6c')](_0x374966[_0x52f363]);}else{notSendMessagesQueue(_0x374966[_0x52f363]);}}}};Preview[_0x7e30('0x10')][_0x7e30('0x6d')]=function(_0x25a7a7){var _0x18ebc5=this;this[_0x7e30('0x14')][_0x7e30('0x11')](function(){if(!_[_0x7e30('0x6e')](_0x18ebc5['actions'][_0x25a7a7])){loggerAction[_0x7e30('0x6f')]('[clearZombieChannels][talking]',_0x25a7a7,_0x7e30('0x70'),_0x18ebc5[_0x7e30('0x17')][_0x25a7a7]['queue'],_0x7e30('0x71'),JSON[_0x7e30('0x5d')](_0x18ebc5[_0x7e30('0x2b')][_0x18ebc5[_0x7e30('0x17')][_0x25a7a7][_0x7e30('0x72')]][_0x7e30('0x54')]),_0x7e30('0x73'),JSON[_0x7e30('0x5d')](_0x18ebc5['campaignsPreview'][_0x18ebc5[_0x7e30('0x17')][_0x25a7a7][_0x7e30('0x72')]][_0x7e30('0x32')]),JSON[_0x7e30('0x5d')](_0x18ebc5[_0x7e30('0x17')][_0x25a7a7][_0x7e30('0x74')]),JSON['stringify'](_[_0x7e30('0x75')](_0x18ebc5[_0x7e30('0x17')][_0x25a7a7],[_0x7e30('0x76'),_0x7e30('0x77'),_0x7e30('0x78'),_0x7e30('0x79')])));return ami[_0x7e30('0x7a')]({'action':_0x7e30('0x7b'),'channel':_0x18ebc5[_0x7e30('0x17')][_0x25a7a7]['channel']})['catch'](function(_0x2c7d9d){if(_0x2c7d9d[_0x7e30('0x7c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x18ebc5['actions'][_0x25a7a7]){ut['updateOriginated'](_0x18ebc5[_0x7e30('0x2b')][_0x18ebc5['actions'][_0x25a7a7][_0x7e30('0x72')]],_0x7e30('0x7d'));if(_0x18ebc5[_0x7e30('0x17')][_0x25a7a7][_0x7e30('0x74')]===!![]){ut[_0x7e30('0x7e')](_0x18ebc5[_0x7e30('0x2b')][_0x18ebc5[_0x7e30('0x17')][_0x25a7a7][_0x7e30('0x72')]],_0x7e30('0x7d'));ut['loggerError'](_0x7e30('0x7f')+_0x25a7a7,_0x18ebc5['actions'][_0x25a7a7][_0x7e30('0x72')]);}ut[_0x7e30('0x80')](_0x7e30('0x81')+_0x25a7a7,_0x18ebc5['actions'][_0x25a7a7][_0x7e30('0x72')]);delete _0x18ebc5[_0x7e30('0x17')][_0x25a7a7];}},0x2328);}});}});};Preview[_0x7e30('0x10')][_0x7e30('0x82')]=function(){var _0x476b21=this;loggerAction[_0x7e30('0x6f')](_0x7e30('0x83'),_[_0x7e30('0x84')](this[_0x7e30('0x17')]));for(var _0x2eb00 in this['actions']){if(_0x476b21['actions'][_0x7e30('0x68')](_0x2eb00)){_0x476b21[_0x7e30('0x6d')](_0x2eb00);}}};Preview[_0x7e30('0x10')][_0x7e30('0x6c')]=function(_0x44ccf8){var _0x587ef3=this;rpcDb[_0x7e30('0x85')](_0x44ccf8['id'],ut[_0x7e30('0x86')](this['agents']))[_0x7e30('0x87')](function(_0x1d9e26){if(!_[_0x7e30('0x6e')](_0x1d9e26)){for(var _0x2fe8ea=0x0;_0x2fe8ea<_0x1d9e26['length'];_0x2fe8ea+=0x1){if(ut[_0x7e30('0x88')](_0x1d9e26[_0x2fe8ea][_0x7e30('0x89')])<_0x44ccf8[_0x7e30('0x8a')]*0x3c){_0x587ef3[_0x7e30('0x8b')](_0x1d9e26[_0x2fe8ea]['id'])['then'](ut[_0x7e30('0x8c')](_0x7e30('0x8d')))['catch'](ut[_0x7e30('0x8c')](_0x7e30('0x8d')));}else{var _0x22b9fa=new Action(_0x1d9e26[_0x2fe8ea],_0x44ccf8);_0x22b9fa['starttime']=moment()['format'](_0x7e30('0x8e'));_0x44ccf8['outboundReCallsDay']+=0x1;ut[_0x7e30('0x8f')](_0x22b9fa,0x17,_0x7e30('0x90'));if(_0x44ccf8['dialRecallInQueue']){rpcDb[_0x7e30('0x91')](ut[_0x7e30('0x92')](_0x1d9e26[_0x2fe8ea]));rpcDb['createCustomerHistory'](_0x22b9fa,_0x7e30('0x93'));}else{ut[_0x7e30('0x8f')](_0x22b9fa,0x16,'RecallFailedTimeout');rpcDb[_0x7e30('0x94')](_0x22b9fa,'[HistoryRecallClose]');rpcDb[_0x7e30('0x95')](_0x22b9fa,_0x7e30('0x96'));}}}}})[_0x7e30('0x97')](ut['logger2'](_0x7e30('0x98')));};Preview[_0x7e30('0x10')][_0x7e30('0x6b')]=function(_0x27d829){_0x27d829[_0x7e30('0x61')]=!![];if(ut[_0x7e30('0x99')](_0x27d829[_0x7e30('0x9a')])){_0x27d829[_0x7e30('0x7c')]=_0x7e30('0x9b');}else if(!ut[_0x7e30('0x9c')](_0x27d829['dialActive'])){_0x27d829['message']=_0x7e30('0x9d');}else if(!this[_0x7e30('0x9e')](_0x27d829[_0x7e30('0x59')])){if(!this['isTrunkReachable'](_0x27d829[_0x7e30('0x9f')])){_0x27d829[_0x7e30('0x7c')]='TRUNK_IS_NOT_REACHABLE';}else{_0x27d829[_0x7e30('0x7c')]=_0x7e30('0xa0');}}else{_0x27d829[_0x7e30('0x7c')]=_0x7e30('0xa0');}emitCampaignPreview(_0x27d829);};Preview['prototype'][_0x7e30('0xa1')]=function(_0x52e398,_0x49b490,_0x481f96){var _0x4cdf35=this;var _0x16542b=this[_0x7e30('0x17')][_0x49b490];var _0xb0840c=this[_0x7e30('0x2b')][_0x16542b[_0x7e30('0x72')]];var _0x439044;if(_0xb0840c){switch(_0x481f96){case'1':_0xb0840c[_0x7e30('0x46')]+=0x1;_0x16542b[_0x7e30('0xa2')]=ut[_0x7e30('0xa3')](_0x16542b);ut[_0x7e30('0x8f')](_0x16542b,0x0,_0x7e30('0xa4'));rpcDb[_0x7e30('0x94')](_0x16542b,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x16542b)>=_0xb0840c[_0x7e30('0xa5')]){_0x439044=ut[_0x7e30('0xa6')](_0x16542b,0xf,_0x7e30('0xa7'));rpcDb[_0x7e30('0x95')](_0x439044,_0x7e30('0xa8'));}else{rpcDb[_0x7e30('0x95')](_0x16542b,_0x7e30('0xa8'));}delete this[_0x7e30('0x17')][_0x52e398[_0x7e30('0xa9')]];break;case'ANSWER':var _0x31653b=moment()[_0x7e30('0x5e')](_0x7e30('0x8e'));_0x16542b[_0x7e30('0xaa')]=_0x31653b;_0x16542b[_0x7e30('0xab')]=_0x31653b;_0x16542b[_0x7e30('0x74')]=!![];_0xb0840c[_0x7e30('0x32')]+=0x1;logger[_0x7e30('0x6f')](_0x7e30('0xac'),_0x16542b[_0x7e30('0xad')],'\x20Queue',_0xb0840c[_0x7e30('0x2e')],_0x7e30('0x73'),_0xb0840c['pTalking']);ami['emit'](_0x7e30('0xae'),ut[_0x7e30('0xaf')](_0x16542b,_0x7e30('0xb0')));if(_0xb0840c[_0x7e30('0xb1')]){ami['emit'](_0x7e30('0xb2'),ut['buildAcw'](_0x16542b));}break;case'16':ami['emit'](_0x7e30('0xb3'),ut[_0x7e30('0xaf')](_0x16542b,'complete'));emitVoiceQueueChannelRemove(ut['buildObj'](_0x16542b,_0x7e30('0xb4')));_0xb0840c['outboundAnswerCallsDay']+=0x1;_0xb0840c['total']+=0x1;_0xb0840c[_0x7e30('0x30')]+=0x1;ut[_0x7e30('0x7e')](_0xb0840c,_0x7e30('0xb5'));_0x16542b['countglobal']=ut[_0x7e30('0xa3')](_0x16542b);ut[_0x7e30('0x8f')](_0x16542b,0x4,_0x7e30('0xb6'));rpcDb['createCustomerHistory'](_0x16542b,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x7e30('0x95')](_0x16542b,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x7e30('0xb7')](_0x16542b);_0xb0840c[_0x7e30('0x34')]+=_0x16542b[_0x7e30('0xb8')];_0xb0840c[_0x7e30('0x33')]+=_0x16542b[_0x7e30('0xb8')];logger[_0x7e30('0x6f')](_0x7e30('0xb9'),_0x16542b[_0x7e30('0xad')],'\x20Queue',_0xb0840c[_0x7e30('0x2e')],_0x7e30('0x73'),_0xb0840c[_0x7e30('0x32')]);delete this['actions'][_0x52e398[_0x7e30('0xa9')]];break;case _0x7e30('0xba'):_0xb0840c[_0x7e30('0x42')]+=0x1;_0x16542b['countbusyretry']+=0x1;_0x16542b[_0x7e30('0xa2')]=ut['totalGlobal'](_0x16542b);ut[_0x7e30('0x8f')](_0x16542b,0x5,_0x7e30('0xbb'));rpcDb[_0x7e30('0x94')](_0x16542b,_0x7e30('0xbc'));if(ut[_0x7e30('0xa3')](_0x16542b)>=_0xb0840c[_0x7e30('0xa5')]){_0x439044=ut[_0x7e30('0xa6')](_0x16542b,0xf,_0x7e30('0xa7'));rpcDb[_0x7e30('0x95')](_0x439044,_0x7e30('0xbd'));}else{if(_0x16542b[_0x7e30('0xbe')]>=_0xb0840c[_0x7e30('0xbf')]){rpcDb[_0x7e30('0x95')](_0x16542b,_0x7e30('0xbc'));}else{rpcDb['rescheduleContact'](ut[_0x7e30('0xc0')](_0x16542b,'countbusyretry',_0xb0840c[_0x7e30('0xc1')]),_0x16542b[_0x7e30('0xc2')],_0x16542b[_0x7e30('0xc3')]);}}break;case'NOANSWER':_0xb0840c[_0x7e30('0x45')]+=0x1;_0x16542b['countnoanswerretry']+=0x1;_0x16542b[_0x7e30('0xa2')]=ut[_0x7e30('0xa3')](_0x16542b);ut['logCustomer'](_0x16542b,0x3,_0x7e30('0xc4'));rpcDb[_0x7e30('0x94')](_0x16542b,_0x7e30('0xc5'));if(ut[_0x7e30('0xa3')](_0x16542b)>=_0xb0840c[_0x7e30('0xa5')]){_0x439044=ut[_0x7e30('0xa6')](_0x16542b,0xf,'Global');rpcDb['createCustomerFinal'](_0x439044,_0x7e30('0xc6'));}else{if(_0x16542b[_0x7e30('0xc7')]>=_0xb0840c[_0x7e30('0xc8')]){rpcDb['createCustomerFinal'](_0x16542b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x7e30('0xc0')](_0x16542b,_0x7e30('0xc7'),_0xb0840c['dialNoAnswerRetryFrequency']),_0x16542b[_0x7e30('0xc2')],_0x16542b[_0x7e30('0xc3')]);}}break;case _0x7e30('0xc9'):_0xb0840c[_0x7e30('0x43')]+=0x1;_0x16542b[_0x7e30('0xca')]+=0x1;_0x16542b[_0x7e30('0xa2')]=ut[_0x7e30('0xa3')](_0x16542b);ut[_0x7e30('0x8f')](_0x16542b,0x8,_0x7e30('0xcb'));rpcDb[_0x7e30('0x94')](_0x16542b,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x7e30('0xa3')](_0x16542b)>=_0xb0840c[_0x7e30('0xa5')]){_0x439044=ut[_0x7e30('0xa6')](_0x16542b,0xf,_0x7e30('0xa7'));rpcDb['createCustomerFinal'](_0x439044,_0x7e30('0xcc'));}else{if(_0x16542b['countcongestionretry']>=_0xb0840c[_0x7e30('0xcd')]){rpcDb[_0x7e30('0x95')](_0x16542b,_0x7e30('0xce'));}else{rpcDb[_0x7e30('0xcf')](ut[_0x7e30('0xc0')](_0x16542b,_0x7e30('0xca'),_0xb0840c[_0x7e30('0xc1')]),_0x16542b[_0x7e30('0xc2')],_0x16542b[_0x7e30('0xc3')]);}}break;case'CANCEL':_0xb0840c[_0x7e30('0x49')]+=0x1;_0x16542b[_0x7e30('0xa2')]=ut[_0x7e30('0xa3')](_0x16542b);ut[_0x7e30('0x8f')](_0x16542b,0x14,'AgentReject');rpcDb[_0x7e30('0x94')](_0x16542b,'[syncHangupRequest][logAgentReject]');if(_0x16542b[_0x7e30('0xc2')]){rpcDb['unlockContact'](_0x16542b[_0x7e30('0xd0')]);}if(_0x16542b[_0x7e30('0xc3')]){rpcDb['disableContact'](_0x16542b['idContact']);}break;default:if(_0x16542b['dialAnswer']){ut[_0x7e30('0x7e')](_0xb0840c,_0x7e30('0xd1'));ut[_0x7e30('0x80')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0xb0840c['name'],_0x52e398);}_0xb0840c['outboundUnknownCallsDay']+=0x1;_0x16542b['countglobal']=ut[_0x7e30('0xa3')](_0x16542b);ut[_0x7e30('0x8f')](_0x16542b,0xc,_0x52e398[_0x7e30('0xd2')]||_0x52e398[_0x7e30('0xd3')]);rpcDb['createCustomerHistory'](_0x16542b,_0x7e30('0xd4'));if(ut[_0x7e30('0xa3')](_0x16542b)>=_0xb0840c[_0x7e30('0xa5')]){_0x439044=ut[_0x7e30('0xa6')](_0x16542b,0xf,'Global');rpcDb[_0x7e30('0x95')](_0x439044,_0x7e30('0xd5'));}else{rpcDb[_0x7e30('0x95')](_0x16542b,_0x7e30('0xd5'));}delete this[_0x7e30('0x17')][_0x52e398[_0x7e30('0xa9')]];}if(!(_0x16542b['dialAnswer']&&_0x481f96==='16')){ut['updateOriginated'](_0xb0840c,_0x7e30('0xd6'));logger[_0x7e30('0x6f')]('[originated][decrement][callProgressDetectingCustomer]',_0x16542b[_0x7e30('0xad')],_0x7e30('0xd7'),_0xb0840c[_0x7e30('0x2e')],'originated:\x20',_0xb0840c[_0x7e30('0x54')]);}if(_0x481f96!==_0x7e30('0xd8')){delete this[_0x7e30('0x17')][_0x52e398[_0x7e30('0xa9')]];delete this['actions'][_0x52e398['destlinkedid']];}}};Preview[_0x7e30('0x10')]['callProgressDetectingAgent']=function(_0x20a771,_0x96baca,_0x400f18){if(_[_0x7e30('0xd9')](_0x96baca)&&'object'!==typeof _0x96baca){return;}if(_['isUndefined'](_0x400f18)&&_0x7e30('0xda')!==typeof _0x400f18){return;}switch(_0x400f18[_0x7e30('0xdb')]){case'0':ut[_0x7e30('0xdc')](_0x20a771,0x0,_0x7e30('0xa4'));rpcDb[_0x7e30('0xdd')](_0x20a771,_0x7e30('0xde'));break;case'3':ut[_0x7e30('0xdc')](_0x20a771,0x3,_0x7e30('0xc4'));rpcDb['createAgentHistory'](_0x20a771,_0x7e30('0xdf'));break;case'5':ut['logAgent'](_0x20a771,0x5,'Busy');rpcDb[_0x7e30('0xdd')](_0x20a771,_0x7e30('0xe0'));break;case'8':ut[_0x7e30('0xdc')](_0x20a771,0x8,_0x7e30('0xcb'));rpcDb[_0x7e30('0xdd')](_0x20a771,_0x7e30('0xe1'));break;case'22':ut['logAgent'](_0x20a771,0x16,_0x7e30('0xe2'));rpcDb[_0x7e30('0xdd')](_0x20a771,_0x7e30('0xe3'));break;default:ut[_0x7e30('0xdc')](_0x20a771,0xc,_0x400f18[_0x7e30('0xdb')]);rpcDb[_0x7e30('0xdd')](_0x20a771,_0x7e30('0xe1'));}ut[_0x7e30('0xe4')](_0x96baca,_0x7e30('0xe5'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x20a771[_0x7e30('0xad')],_0x7e30('0xd7'),_0x96baca[_0x7e30('0x2e')],_0x7e30('0x71'),_0x96baca[_0x7e30('0x54')]);delete this[_0x7e30('0x17')][_0x20a771[_0x7e30('0xad')]];};Preview[_0x7e30('0x10')][_0x7e30('0xe6')]=function(_0x55cd85,_0x34351e,_0x1ed447,_0xdcc72f,_0x27642c){var _0x4258d6=this;return new BPromise(function(_0x41091e,_0x2fdb12){if(_[_0x7e30('0x6e')](_0x34351e)||_[_0x7e30('0x6e')](_0x34351e[_0x7e30('0xe7')])||_[_0x7e30('0x6e')](_0x34351e['Contact'][_0x7e30('0xe8')])||_[_0x7e30('0x6e')](_0x34351e[_0x7e30('0x78')])){_0x2fdb12(ut[_0x7e30('0x7c')](_0x7e30('0xe9'),_0xdcc72f,_0x27642c));return;}var _0x834432=uuid['v4']();var _0x1d80c5=_0x4258d6[_0x7e30('0x2b')][_0x34351e[_0x7e30('0x70')][_0x7e30('0x2e')]];var _0x46284f=_0x1ed447?_0x4258d6[_0x7e30('0x18')][_0x1ed447]['id']:undefined;_0x4258d6['actions'][_0x834432]=new Action(_0x34351e,_0x1d80c5,_0x834432,_0x1ed447,_0x46284f);var _0x103808=_0x4258d6[_0x7e30('0x17')][_0x834432];_0x103808['unlockAgent']=_0xdcc72f;_0x103808[_0x7e30('0xc3')]=_0x27642c;_0x103808[_0x7e30('0xea')]=_0x1ed447;if(_[_0x7e30('0xeb')](_0x55cd85)){_0x4258d6[_0x7e30('0xec')](_0x103808,_0x1d80c5,_0x34351e,_0x1ed447)[_0x7e30('0x87')](function(_0x45768b){logger[_0x7e30('0x6f')](_0x7e30('0xed'),_0x7e30('0xee')+_0x103808[_0x7e30('0x72')]+_0x7e30('0xef')+_0x103808[_0x7e30('0xd0')],JSON[_0x7e30('0x5d')](_0x45768b));ami['emit'](_0x7e30('0xf0'),ut[_0x7e30('0xaf')](_0x103808,_0x7e30('0xf1')));_0x41091e(ut[_0x7e30('0x7c')](_0x7e30('0xf2')));})[_0x7e30('0x97')](function(_0x5019e4){ut[_0x7e30('0x65')](_0x7e30('0xf3'),_0x5019e4);_0x2fdb12(ut[_0x7e30('0x7c')](_0x7e30('0xf4'),_0xdcc72f,_0x27642c));});}else{_0x1d80c5[_0x7e30('0x41')]+=0x1;ut[_0x7e30('0xf5')](_0x103808);rpcDb[_0x7e30('0xf6')](_0x103808,_0x7e30('0xf7'));delete _0x4258d6[_0x7e30('0x17')][_0x834432];_0x2fdb12(ut[_0x7e30('0x7c')]('Contact\x20in\x20black\x20List',_0xdcc72f,_0x27642c));}});};Preview[_0x7e30('0x10')][_0x7e30('0x9e')]=function(_0x449eb8){return!_[_0x7e30('0x6e')](_0x449eb8)&&!_['isNil'](_0x449eb8[_0x7e30('0x2e')])&&!_[_0x7e30('0x6e')](_0x449eb8['active'])&&_0x449eb8[_0x7e30('0x5a')]&&!_[_0x7e30('0x6e')](this[_0x7e30('0x16')][util[_0x7e30('0x5e')](_0x7e30('0xf8'),_0x449eb8[_0x7e30('0x2e')])])&&!_[_0x7e30('0x6e')](this['trunks'][util[_0x7e30('0x5e')]('SIP/%s',_0x449eb8[_0x7e30('0x2e')])][_0x7e30('0x7b')])&&(this[_0x7e30('0x16')][util[_0x7e30('0x5e')](_0x7e30('0xf8'),_0x449eb8[_0x7e30('0x2e')])][_0x7e30('0x7b')]==='reachable'||this[_0x7e30('0x16')][util[_0x7e30('0x5e')](_0x7e30('0xf8'),_0x449eb8[_0x7e30('0x2e')])]['status']===_0x7e30('0xf9'));};Preview[_0x7e30('0x10')][_0x7e30('0x8b')]=function(_0x4400fa,_0x299b35){var _0x21b1c8=this;return new BPromise(function(_0x12394f,_0x31d849){_0x21b1c8[_0x7e30('0xfa')](_0x4400fa,_0x299b35)['then'](function(_0x376b0b){_0x12394f(_[_0x7e30('0x75')](_0x376b0b,[_0x7e30('0x7c')]));})[_0x7e30('0x97')](function(_0x2ce704){if(_0x2ce704[_0x7e30('0xfb')]){rpcDb['unlockContact'](_0x4400fa);}if(_0x2ce704[_0x7e30('0x5a')]){rpcDb[_0x7e30('0xfc')](_0x4400fa);}_0x31d849(_[_0x7e30('0x75')](_0x2ce704,['message']));});});};Preview['prototype']['execRun']=function(_0x5e98b1,_0x450735){var _0x10d9b7=this;return new BPromise(function(_0x7c9bc4,_0x39c987){var _0x5394e9,_0x40b016;rpcDb[_0x7e30('0xfd')](_0x5e98b1)['then'](function(_0x53dc74){if(!_[_0x7e30('0x6e')](_0x53dc74[0x0])){_0x40b016=_0x53dc74[0x0]['recallme']?![]:!![];_0x5394e9=_0x53dc74[0x0]['recallme']?!![]:![];_0x5394e9=_0x450735?!![]:_0x5394e9;}var _0x3bc86c=_0x10d9b7[_0x7e30('0xfe')](_0x53dc74);if(_0x3bc86c['isValid']){rpcDb[_0x7e30('0xff')](_[_0x7e30('0x75')](_0x53dc74[0x0],[_0x7e30('0x78'),_0x7e30('0x100')]))['then'](function(_0x3f88ca){_0x10d9b7[_0x7e30('0xe6')](_0x3f88ca,_0x53dc74[0x0],_0x450735,_0x40b016,_0x5394e9)[_0x7e30('0x87')](function(_0x945393){_0x7c9bc4(_0x945393);})[_0x7e30('0x97')](function(_0xcd7934){_0x39c987(_0xcd7934);});})[_0x7e30('0x97')](function(_0x3de44d){ut[_0x7e30('0x65')](_0x7e30('0x101'),_0x3de44d);_0x39c987(ut['message'](_0x7e30('0x102'),_0x40b016,_0x5394e9));});}else{_0x39c987(ut[_0x7e30('0x7c')](_0x3bc86c['message'],_0x40b016,_0x5394e9));}})[_0x7e30('0x97')](function(_0x3f2999){ut[_0x7e30('0x65')]('[Preview][getContactPreview]',_0x3f2999);_0x39c987(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0x7e30('0x10')][_0x7e30('0xfe')]=function(_0x1be85f){if(_[_0x7e30('0x6e')](_0x1be85f)||_[_0x7e30('0xeb')](_0x1be85f)||!_[_0x7e30('0x6e')](_0x1be85f[0x0][_0x7e30('0x103')])&&_[_0x7e30('0x6e')](_0x1be85f[0x0][_0x7e30('0x103')][_0x7e30('0x2e')])){ut[_0x7e30('0x65')](_0x7e30('0x104'),_0x1be85f);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1ec3c2=this[_0x7e30('0x2b')][_0x1be85f[0x0][_0x7e30('0x70')][_0x7e30('0x2e')]];_0x1ec3c2[_0x7e30('0x7c')]=_0x7e30('0xa0');if(_[_0x7e30('0x6e')](_0x1ec3c2)){ut[_0x7e30('0x65')]('[Preview][validateContact][Empty\x20Campaign]',_0x1ec3c2);return{'isValid':![],'message':_0x7e30('0x105')};}if(!this['isTrunkReachable'](_0x1ec3c2['Trunk'])){ut[_0x7e30('0x65')](_0x7e30('0x106'),_0x7e30('0x107')+_0x1ec3c2['name']+_0x7e30('0x108'));if(!this[_0x7e30('0x9e')](_0x1ec3c2['TrunkBackup'])){ut[_0x7e30('0x65')](_0x7e30('0x106'),_0x1ec3c2[_0x7e30('0x2e')]+_0x7e30('0x109'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x7e30('0x9c')](_0x1ec3c2['dialActive'])){ut[_0x7e30('0x65')]('[Preview][validateContact][Campaign\x20Active]',_0x1ec3c2[_0x7e30('0x2e')]+_0x7e30('0x10a'));return{'isValid':![],'message':_0x7e30('0x107')+_0x1ec3c2['name']+_0x7e30('0x10a')};}return{'isValid':!![],'message':_0x7e30('0x10b')};};Preview[_0x7e30('0x10')]['execCall']=function(_0x455266,_0x298839,_0x97bc12,_0x29eea5){var _0xf390d4=this;return new BPromise(function(_0x5af579,_0x5a2f65){var _0x260230=_0x455266['uniqueid'];var _0x5786fe=_0xf390d4[_0x7e30('0x9e')](_0x298839[_0x7e30('0x59')])?util[_0x7e30('0x5e')](_0x7e30('0x10c'),_0x298839['Trunk'][_0x7e30('0x2e')],_['isNil'](_0x298839['dialPrefix'])?'':_0x298839[_0x7e30('0x3e')][_0x7e30('0x10d')]()||'',_0x298839[_0x7e30('0x10e')]>0x0?_0x97bc12[_0x7e30('0xe7')][_0x7e30('0xe8')][_0x7e30('0x10f')](_0x298839[_0x7e30('0x10e')]):_0x97bc12['Contact'][_0x7e30('0xe8')]):util[_0x7e30('0x5e')]('SIP/%s/%s%s',_[_0x7e30('0x6e')](_0x298839[_0x7e30('0x9f')])?_0x298839[_0x7e30('0x59')][_0x7e30('0x2e')]:_0x298839[_0x7e30('0x9f')][_0x7e30('0x2e')],_[_0x7e30('0x6e')](_0x298839['dialPrefix'])?'':_0x298839[_0x7e30('0x3e')][_0x7e30('0x10d')]()||'',_0x298839[_0x7e30('0x10e')]>0x0?_0x97bc12[_0x7e30('0xe7')][_0x7e30('0xe8')][_0x7e30('0x10f')](_0x298839[_0x7e30('0x10e')]):_0x97bc12[_0x7e30('0xe7')][_0x7e30('0xe8')]);var _0x2088b0=_0xf390d4[_0x7e30('0x9e')](_0x298839[_0x7e30('0x59')])?ut[_0x7e30('0x110')](_0x298839[_0x7e30('0x59')][_0x7e30('0x5b')],_0x298839[_0x7e30('0x3b')],_0x298839[_0x7e30('0x111')]>0x0?ut[_0x7e30('0x112')](_0x298839[_0x7e30('0x3c')],_0x298839[_0x7e30('0x111')]):_0x298839[_0x7e30('0x3c')]):ut[_0x7e30('0x110')](_[_0x7e30('0x6e')](_0x298839[_0x7e30('0x9f')])?_0x298839[_0x7e30('0x59')][_0x7e30('0x5b')]:_0x298839[_0x7e30('0x9f')][_0x7e30('0x5b')],_0x298839[_0x7e30('0x3b')],_0x298839[_0x7e30('0x111')]>0x0?ut[_0x7e30('0x112')](_0x298839[_0x7e30('0x3c')],_0x298839['dialRandomLastDigitCallerIdNumber']):_0x298839[_0x7e30('0x3c')]);if(_0x2088b0){_0x455266['originatecalleridname']=ut[_0x7e30('0x113')](_0x2088b0);_0x455266[_0x7e30('0x114')]=ut['extractCalleridNumber'](_0x2088b0);}var _0x1b51bc=ut[_0x7e30('0x115')](_0x298839,_0x97bc12,_0x5786fe,_0x2088b0,_0x260230,_0x455266);_[_0x7e30('0x116')](_0x455266,ut[_0x7e30('0x117')](_0x1b51bc));_0x455266[_0x7e30('0x118')]=moment()[_0x7e30('0x5e')](_0x7e30('0x8e'));ami[_0x7e30('0x7a')](ut[_0x7e30('0x119')](_0x455266,_0x298839,_0x1b51bc,_0x455266[_0x7e30('0xc3')],_0x29eea5))[_0x7e30('0x87')](function(_0x2d9b66){_0x298839[_0x7e30('0x54')]+=0x1;logger['info'](_0x7e30('0x11a'),_0x260230,'\x20Queue',_0x298839['name'],_0x7e30('0x71'),_0x298839[_0x7e30('0x54')]);_0x5af579(_0x2d9b66);})[_0x7e30('0x97')](function(_0x3cf46e){ut[_0x7e30('0xdc')](_0x455266,0xe,_0x7e30('0x11b'));rpcDb[_0x7e30('0xdd')](_0x455266,'[originateFailure][logOriginateFailure]');_0x5a2f65(_0x3cf46e);});});};Preview[_0x7e30('0x10')]['syncNewExten']=function(_0x9a240b){if(this[_0x7e30('0x17')][_0x9a240b[_0x7e30('0xa9')]]){this[_0x7e30('0x17')][_0x9a240b[_0x7e30('0xa9')]]['channel']=_0x9a240b[_0x7e30('0x11c')];}};Preview[_0x7e30('0x10')][_0x7e30('0x1b')]=function(_0xf31557){var _0x5f50f4=this;var _0x5c5f78=this[_0x7e30('0x17')][_0xf31557[_0x7e30('0x11d')]];if(_0x5c5f78){if(_0x5c5f78['lookAgent']&&this['agents'][_0x5c5f78[_0x7e30('0xea')]]){ut[_0x7e30('0x11e')](_0x5c5f78,this['agents'][_0x5c5f78[_0x7e30('0xea')]]['name'],this[_0x7e30('0x18')][_0x5c5f78[_0x7e30('0xea')]]['id']);}var _0x5ae941=_[_0x7e30('0x11f')](_0x5c5f78);_0x5ae941[_0x7e30('0xaa')]=moment()[_0x7e30('0x5e')](_0x7e30('0x8e'));var _0x1eb271=_0x5f50f4['campaignsPreview'][_0x5c5f78[_0x7e30('0x72')]];if(ut[_0x7e30('0x120')](_0xf31557[_0x7e30('0x121')])){if(_0x5c5f78[_0x7e30('0xc2')]){rpcDb[_0x7e30('0x122')](_0x5c5f78[_0x7e30('0xd0')]);}if(_0x5c5f78[_0x7e30('0xc3')]){rpcDb[_0x7e30('0xfc')](_0x5c5f78[_0x7e30('0xd0')]);}ami['emit'](_0x7e30('0x123'),ut[_0x7e30('0xaf')](_0x5c5f78,_0x7e30('0x124')));this[_0x7e30('0x125')](_0x5ae941,_0x1eb271,_0xf31557);}else{_0x5c5f78[_0x7e30('0x118')]=moment()['format'](_0x7e30('0x8e'));ut[_0x7e30('0xdc')](_0x5ae941,0x4,'Answer');rpcDb[_0x7e30('0xdd')](_0x5ae941,_0x7e30('0x126'));}}};Preview[_0x7e30('0x10')][_0x7e30('0x1e')]=function(_0x451846){var _0x204e0d=this;var _0x2ef4a2=this[_0x7e30('0x17')][_0x451846[_0x7e30('0xa9')]];var _0x2a16ca;if(_0x2ef4a2){_0x2a16ca=this[_0x7e30('0x2b')][_0x2ef4a2[_0x7e30('0x72')]];logger['info'](_0x7e30('0x127'),_0x451846[_0x7e30('0xa9')],'\x20Queue',_0x2a16ca[_0x7e30('0x2e')],'pTalking:\x20',_0x2a16ca[_0x7e30('0x32')]);}if(this[_0x7e30('0x17')][_0x451846[_0x7e30('0xa9')]]&&_0x451846[_0x7e30('0xa9')]!==_0x451846['uniqueid']){if(_0x451846['cause']==='16'&&this[_0x7e30('0x17')][_0x451846[_0x7e30('0xa9')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x451846,_0x451846['linkedid'],_0x451846[_0x7e30('0x128')]);}else if(this[_0x7e30('0x17')][_0x451846[_0x7e30('0xa9')]]['dialAnswer']){logger[_0x7e30('0x6f')]('[syncHangup][talking][cause]',_0x451846[_0x7e30('0xa9')],_0x451846[_0x7e30('0x128')],_0x7e30('0xd7'),_0x2a16ca['name'],_0x7e30('0x73'),_0x2a16ca[_0x7e30('0x32')]);this[_0x7e30('0xa1')](_0x451846,_0x451846[_0x7e30('0xa9')],_0x451846[_0x7e30('0x128')]);}}else if(_0x2ef4a2&&_[_0x7e30('0x6e')](_0x2ef4a2[_0x7e30('0x129')])&&_0x2a16ca['dialQueueProject']&&_0x451846[_0x7e30('0xa9')]===_0x451846[_0x7e30('0xad')]&&_[_0x7e30('0x6e')](_0x451846[_0x7e30('0xdb')])&&_0x451846[_0x7e30('0x128')]==='16'&&_0x451846[_0x7e30('0x12a')]==='6'&&_[_0x7e30('0xd9')](_0x2ef4a2['transfer'])){if(_0x2ef4a2['unlockAgent']){rpcDb[_0x7e30('0x122')](_0x2ef4a2[_0x7e30('0xd0')]);}if(_0x2ef4a2['activeContact']){rpcDb['disableContact'](_0x2ef4a2[_0x7e30('0xd0')]);}_0x451846[_0x7e30('0xdb')]='22';this['callProgressDetectingAgent'](_0x2ef4a2,_0x2a16ca,_0x451846);}else if(_0x2ef4a2&&_0x2ef4a2[_0x7e30('0x12b')]){if(_0x451846[_0x7e30('0x128')]==='16'&&this['actions'][_0x451846[_0x7e30('0xa9')]][_0x7e30('0x74')]){logger[_0x7e30('0x6f')]('[syncHangup][talking][transfer]',_0x451846['linkedid'],_0x451846['cause'],'\x20Queue',_0x2a16ca[_0x7e30('0x2e')],'pTalking:\x20',_0x2a16ca[_0x7e30('0x32')]);this['callProgressDetectingCustomer'](_0x451846,_0x451846['linkedid'],_0x451846[_0x7e30('0x128')]);}else if(this[_0x7e30('0x17')][_0x451846[_0x7e30('0xa9')]][_0x7e30('0x74')]){logger['info'](_0x7e30('0x12c'),_0x451846[_0x7e30('0xa9')],_0x451846[_0x7e30('0x128')],_0x7e30('0xd7'),_0x2a16ca[_0x7e30('0x2e')],_0x7e30('0x73'),_0x2a16ca[_0x7e30('0x32')]);this[_0x7e30('0xa1')](_0x451846,_0x451846['linkedid'],_0x451846['cause']);}}};Preview[_0x7e30('0x10')]['syncDialEnd']=function(_0x1f3bff){if(this[_0x7e30('0x17')][_0x1f3bff[_0x7e30('0x12d')]]&&_0x1f3bff['destlinkedid']!==_0x1f3bff[_0x7e30('0x12e')]){this['callProgressDetectingCustomer'](_0x1f3bff,_0x1f3bff[_0x7e30('0x12d')],_0x1f3bff[_0x7e30('0xd3')]);}};Preview['prototype'][_0x7e30('0x20')]=function(_0x4ae0fc){if(this[_0x7e30('0x17')][_0x4ae0fc['linkedid']]&&_0x4ae0fc['linkedid']!==_0x4ae0fc[_0x7e30('0xad')]&&!this[_0x7e30('0x17')][_0x4ae0fc[_0x7e30('0xa9')]][_0x7e30('0x74')]){if(_0x4ae0fc['cause']==='1'){this['callProgressDetectingCustomer'](_0x4ae0fc,_0x4ae0fc[_0x7e30('0xa9')],_0x4ae0fc[_0x7e30('0x128')]);}}};Preview[_0x7e30('0x10')]['addVariable']=function(_0x29c61a,_0x2fde25,_0x55ec93){if(this[_0x7e30('0x17')][_0x29c61a]){if(_[_0x7e30('0x6e')](this['actions'][_0x29c61a]['variables'])){this[_0x7e30('0x17')][_0x29c61a]['variables']={};}this[_0x7e30('0x17')][_0x29c61a][_0x7e30('0x12f')][_0x2fde25]=_0x55ec93;}};Preview[_0x7e30('0x10')]['syncVarSet']=function(_0xbca5f2){try{if(!_['isNil'](_0xbca5f2)){if(ut['filterKey'](_[_0x7e30('0x130')](_0xbca5f2[_0x7e30('0x131')])[0x0])){this['addVariable'](_0xbca5f2[_0x7e30('0xad')],_[_0x7e30('0x130')](_0xbca5f2['variable'])[0x0],_0xbca5f2['value']);}}}catch(_0x1c7905){logger['error'](_0x7e30('0x132'),util[_0x7e30('0x133')](_0x1c7905,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x21d8fe){if(_0x21d8fe){if(this[_0x7e30('0x17')][_0x21d8fe[_0x7e30('0x134')]]){this[_0x7e30('0x17')][_0x21d8fe['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x7e30('0x10')][_0x7e30('0x29')]=function(_0x1c75e5){if(_0x1c75e5){if(this[_0x7e30('0x17')][_0x1c75e5[_0x7e30('0x135')]]){this[_0x7e30('0x17')][_0x1c75e5['transfererlinkedid']]['transfer']=!![];}}};module[_0x7e30('0x136')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 16c624c..f7541f8 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 _0x98a8=['[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','then','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x22125c,_0x1e4732){var _0x2c8a58=function(_0x5075cb){while(--_0x5075cb){_0x22125c['push'](_0x22125c['shift']());}};_0x2c8a58(++_0x1e4732);}(_0x98a8,0x12c));var _0x898a=function(_0x5dd879,_0x3cf7bb){_0x5dd879=_0x5dd879-0x0;var _0x2124d2=_0x98a8[_0x5dd879];return _0x2124d2;};'use strict';var util=require(_0x898a('0x0'));var BPromise=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var _=require(_0x898a('0x4'));var cmHopper=require(_0x898a('0x5'));var cmHopperFinal=require(_0x898a('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x898a('0x7'));var voiceQueueRt=require(_0x898a('0x8'));var agentReportPreview=require(_0x898a('0x9'));var voiceQueueReport=require(_0x898a('0xa'));function loggerCatch(_0x3e7ddd){return function(_0x5d7e59){logger[_0x898a('0xb')](_0x3e7ddd,util['inspect'](_0x5d7e59,{'showHidden':![],'depth':null}));};}function create(_0xfa8c50){return BPromise['resolve']()[_0x898a('0xc')](cmHopperHistory[_0x898a('0xd')](_0xfa8c50))[_0x898a('0xe')](loggerCatch(_0x898a('0xf')));}function createAgent(_0x3150df){return BPromise[_0x898a('0x10')]()[_0x898a('0xc')](agentReportPreview[_0x898a('0xd')](_0x3150df))[_0x898a('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3e1867){return BPromise['resolve']()[_0x898a('0xc')](cmHopper['moveContactManagedDialer'](_0x3e1867,!![]))[_0x898a('0xe')](loggerCatch(_0x898a('0x11')));}exports[_0x898a('0x12')]=function(_0x5f5e06){return BPromise['resolve']()['then'](cmHopperBlack[_0x898a('0x12')](_0x5f5e06))[_0x898a('0xe')](loggerCatch(_0x898a('0x13')));};exports[_0x898a('0x14')]=function(_0x1873e9){return BPromise[_0x898a('0x10')]()['then'](cmHopper[_0x898a('0x14')](_0x1873e9))['catch'](loggerCatch(_0x898a('0x15')));};exports['createHistory']=function(_0x303321,_0x4fb05b){create(_0x303321)[_0x898a('0xe')](loggerCatch(_0x4fb05b));moveContact(_0x303321)['catch'](loggerCatch(_0x4fb05b));};exports[_0x898a('0x16')]=function(_0x3197f7,_0x28cc63){createAgent(_0x3197f7)['catch'](loggerCatch(_0x28cc63));};exports[_0x898a('0x17')]=function(_0x5960e0,_0x54c8f3){create(_0x5960e0)[_0x898a('0xe')](loggerCatch(_0x54c8f3));};exports[_0x898a('0x18')]=function(_0x58c3ab,_0x4d374b){moveContact(_0x58c3ab)[_0x898a('0xe')](loggerCatch(_0x4d374b));};exports[_0x898a('0x19')]=function(_0x38a8f0,_0x2917ff,_0x2da52d){if(_0x2917ff){_0x38a8f0[_0x898a('0x1a')]=null;}if(_0x2da52d){_0x38a8f0[_0x898a('0x1b')]=![];}return BPromise['resolve']()[_0x898a('0xc')](cmHopper[_0x898a('0x19')](_0x38a8f0))[_0x898a('0xe')](loggerCatch(_0x898a('0x1c')));};exports[_0x898a('0x1d')]=function(_0x310bfa){return BPromise['resolve']()[_0x898a('0xc')](cmHopper[_0x898a('0x1d')](_0x310bfa))[_0x898a('0xe')](loggerCatch(_0x898a('0x1e')));};exports[_0x898a('0x1f')]=function(_0x1426e3){return BPromise['resolve']()[_0x898a('0xc')](cmHopper['unlockContact']({'UserId':null},_0x1426e3,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x898a('0x20')]=function(_0x1f4d86){return BPromise[_0x898a('0x10')]()[_0x898a('0xc')](cmHopper[_0x898a('0x1f')]({'active':![]},_0x1f4d86,0x1))[_0x898a('0xe')](loggerCatch(_0x898a('0x21')));};exports[_0x898a('0x22')]=function(_0xd31922){var _0x58149d={};_0x58149d['type']=_0xd31922['type'];_0x58149d[_0x898a('0x23')]=_0xd31922[_0x898a('0x23')];_0x58149d[_0x898a('0x24')]=_0xd31922[_0x898a('0x24')];_0x58149d[_0x898a('0x25')]=_0xd31922[_0x898a('0x25')];_0x58149d[_0x898a('0x26')]=_0xd31922[_0x898a('0x26')];_0x58149d[_0x898a('0x27')]=_0xd31922[_0x898a('0x28')];_0x58149d[_0x898a('0x29')]=_0xd31922[_0x898a('0x28')];_0x58149d['queuecallercomplete']=0x1;_0x58149d[_0x898a('0x2a')]=_0xd31922[_0x898a('0x2b')];_0x58149d[_0x898a('0x2c')]=_0xd31922[_0x898a('0x2d')];_0x58149d[_0x898a('0x2e')]='from-sip';_0x58149d['exten']=_0x898a('0x2f');_0x58149d[_0x898a('0x30')]=0x0;_0x58149d[_0x898a('0x31')]=0x1;_0x58149d['lastAssignedTo']=_0xd31922[_0x898a('0x2d')];_0x58149d[_0x898a('0x32')]=_0x898a('0x33');return BPromise[_0x898a('0x10')]()[_0x898a('0xc')](voiceQueueReport[_0x898a('0x34')](_0x58149d))[_0x898a('0xe')](loggerCatch(_0x898a('0x35')));};exports['getContactRecallMe']=function(_0x33a191,_0x5baf5b){return BPromise['resolve']()[_0x898a('0xc')](cmHopper['getContactRecallMe'](_0x33a191,_0x5baf5b))[_0x898a('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x898a('0x36')]=function(_0x4f202c){return BPromise[_0x898a('0x10')]()[_0x898a('0xc')](cmHopper[_0x898a('0x19')](_0x4f202c,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xdc97=['util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0xdfb3c3,_0x59788d){var _0x4f9a74=function(_0x2f1544){while(--_0x2f1544){_0xdfb3c3['push'](_0xdfb3c3['shift']());}};_0x4f9a74(++_0x59788d);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2a66e3,_0x22c112){_0x2a66e3=_0x2a66e3-0x0;var _0x42e2c8=_0xdc97[_0x2a66e3];return _0x42e2c8;};'use strict';var util=require(_0x7dc9('0x0'));var BPromise=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('preview');var _=require(_0x7dc9('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7dc9('0x4'));var cmHopperHistory=require(_0x7dc9('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7dc9('0x6'));var agentReportPreview=require(_0x7dc9('0x7'));var voiceQueueReport=require(_0x7dc9('0x8'));function loggerCatch(_0x3ba3ca){return function(_0x589f02){logger[_0x7dc9('0x9')](_0x3ba3ca,util['inspect'](_0x589f02,{'showHidden':![],'depth':null}));};}function create(_0x4b3229){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopperHistory[_0x7dc9('0xc')](_0x4b3229))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0xe')));}function createAgent(_0x5ca05b){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](agentReportPreview[_0x7dc9('0xc')](_0x5ca05b))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0xe')));}function moveContact(_0x3c2af5){return BPromise[_0x7dc9('0xa')]()['then'](cmHopper['moveContactManagedDialer'](_0x3c2af5,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x7dc9('0xf')]=function(_0x14e5db){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopperBlack[_0x7dc9('0xf')](_0x14e5db))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x10')));};exports[_0x7dc9('0x11')]=function(_0x11af93){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x11')](_0x11af93))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x12')));};exports[_0x7dc9('0xc')]=function(_0xbe0437,_0x45698c){create(_0xbe0437)[_0x7dc9('0xd')](loggerCatch(_0x45698c));moveContact(_0xbe0437)[_0x7dc9('0xd')](loggerCatch(_0x45698c));};exports['createAgentHistory']=function(_0x22577e,_0x4afb47){createAgent(_0x22577e)[_0x7dc9('0xd')](loggerCatch(_0x4afb47));};exports[_0x7dc9('0x13')]=function(_0x5d61d7,_0x41f66e){create(_0x5d61d7)[_0x7dc9('0xd')](loggerCatch(_0x41f66e));};exports[_0x7dc9('0x14')]=function(_0x4b2703,_0x43ec33){moveContact(_0x4b2703)[_0x7dc9('0xd')](loggerCatch(_0x43ec33));};exports[_0x7dc9('0x15')]=function(_0x2895f5,_0x155cc4,_0x2b38d6){if(_0x155cc4){_0x2895f5['UserId']=null;}if(_0x2b38d6){_0x2895f5['active']=![];}return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['rescheduleContact'](_0x2895f5))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x16')));};exports['countReScheduled']=function(_0xffc080){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['countReScheduled'](_0xffc080))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x17')));};exports[_0x7dc9('0x18')]=function(_0x55a482){return BPromise['resolve']()['then'](cmHopper[_0x7dc9('0x18')]({'UserId':null},_0x55a482,0x1))[_0x7dc9('0xd')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x47771b){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x18')]({'active':![]},_0x47771b,0x1))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x19')));};exports[_0x7dc9('0x1a')]=function(_0x450124){var _0x236d42={};_0x236d42[_0x7dc9('0x1b')]=_0x450124[_0x7dc9('0x1b')];_0x236d42[_0x7dc9('0x1c')]=_0x450124[_0x7dc9('0x1c')];_0x236d42[_0x7dc9('0x1d')]=_0x450124['calleridnum'];_0x236d42['calleridname']=_0x450124['calleridname'];_0x236d42['queue']=_0x450124['queue'];_0x236d42['queuecallerjoinAt']=_0x450124['answertime'];_0x236d42['queuecallerleaveAt']=_0x450124[_0x7dc9('0x1e')];_0x236d42[_0x7dc9('0x1f')]=0x1;_0x236d42[_0x7dc9('0x20')]=_0x450124[_0x7dc9('0x21')];_0x236d42[_0x7dc9('0x22')]=_0x450124[_0x7dc9('0x23')];_0x236d42['context']='from-sip';_0x236d42['exten']=_0x7dc9('0x24');_0x236d42['holdtime']=0x0;_0x236d42[_0x7dc9('0x25')]=0x1;_0x236d42[_0x7dc9('0x26')]=_0x450124[_0x7dc9('0x23')];_0x236d42[_0x7dc9('0x27')]=_0x7dc9('0x28');return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](voiceQueueReport[_0x7dc9('0x29')](_0x236d42))['catch'](loggerCatch(_0x7dc9('0x2a')));};exports['getContactRecallMe']=function(_0x421e1a,_0x16431a){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['getContactRecallMe'](_0x421e1a,_0x16431a))[_0x7dc9('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7dc9('0x2b')]=function(_0x4f47af){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x15')](_0x4f47af,!![],!![]))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x2c')));}; \ 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 0071e5c..81cb2e2 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 _0xdb26=['queue','interface','buildAcw','status','reachable','push','getDiff','milliseconds','createBody','CampaignId','type','campaigntype','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','ringtime','responsetime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','RECALL','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countnoanswerretry','cloneAction','Global','active','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0xdb26,0xb7));var _0x6db2=function(_0x210f72,_0x47c505){_0x210f72=_0x210f72-0x0;var _0x222218=_0xdb26[_0x210f72];return _0x222218;};'use strict';var util=require(_0x6db2('0x0'));var _=require('lodash');var moment=require(_0x6db2('0x1'));var logger=require(_0x6db2('0x2'))(_0x6db2('0x3'));var ipAgi=process[_0x6db2('0x4')][_0x6db2('0x5')]||_0x6db2('0x6');function getSeconds(_0x41d1c5,_0x240f42){var _0x148db9=moment(_0x41d1c5)['milliseconds'](0x0);var _0x57fcee=moment(_0x240f42)['milliseconds'](0x0);return _0x148db9[_0x6db2('0x7')](_0x57fcee,_0x6db2('0x8'));}exports[_0x6db2('0x9')]=function(_0x9ebfcf){return function(_0x9490d5){logger[_0x6db2('0xa')](_0x9ebfcf,util[_0x6db2('0xb')](_0x9490d5,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1b4713,_0x13ff27){logger[_0x6db2('0xc')](_0x1b4713,util[_0x6db2('0xb')](_0x13ff27,{'showHidden':![],'depth':null}));};exports[_0x6db2('0xd')]=function(_0x456907,_0x2c5ab1){logger[_0x6db2('0xa')](_0x456907,util[_0x6db2('0xb')](_0x2c5ab1,{'showHidden':![],'depth':null}));};exports[_0x6db2('0xe')]=function(_0x34feef){return function(_0x5926d6){logger[_0x6db2('0xc')](_0x34feef,util[_0x6db2('0xb')](_0x5926d6,{'showHidden':![],'depth':null}));};};exports[_0x6db2('0xf')]=function(_0x6a4574,_0x198f8,_0x365f06){return{'message':_0x6a4574,'unlock':_0x198f8,'active':_0x365f06};};exports[_0x6db2('0x10')]=function(_0x51e178,_0x255c78,_0x3a91aa){if(!_[_0x6db2('0x11')](_0x3a91aa)&&_0x6db2('0x12')===typeof _0x3a91aa&&!_['isEmpty'](_0x3a91aa)){if(!_[_0x6db2('0x11')](_0x255c78)&&'string'===typeof _0x255c78&&!_['isEmpty'](_0x255c78)){return util[_0x6db2('0x13')](_0x6db2('0x14'),_0x255c78,_0x3a91aa);}return util['format'](_0x6db2('0x14'),_0x3a91aa,_0x3a91aa);}if(!_['isUndefined'](_0x51e178)&&_0x6db2('0x12')===typeof _0x51e178&&!_[_0x6db2('0x15')](_0x51e178)){return _0x51e178;}return _0x6db2('0x16');};exports['isActive']=function(_0x402c62){if(_[_0x6db2('0x17')](_0x402c62)){return![];}return _0x402c62;};exports[_0x6db2('0x18')]=function(_0x2865c8,_0x3d6f8d,_0x2a5677,_0x339854,_0x47d827,_0x4cad41){var _0x383d2a={'XMD-QUEUE':_0x3d6f8d['Queue']?_0x3d6f8d[_0x6db2('0x19')][_0x6db2('0x1a')]:'','XMD-CALLERID':_0x339854,'XMD-CALLERID-PREVIEW':_0x4cad41?util['format'](_0x6db2('0x14'),_0x4cad41[_0x6db2('0x1b')],_0x4cad41['calleridnum']):_0x339854,'XMD-DIALID':_0x47d827,'XMD-CONTACTID':_0x3d6f8d[_0x6db2('0x1c')],'XMD-CDRTYPE':_0x6db2('0x1d'),'CALLERID(all)':_0x339854,'XMD-VOICEQUEUEID':_0x3d6f8d[_0x6db2('0x1e')],'XMD-DIALCHANNEL':_0x2a5677,'XMD-DIALTIMEOUT':_0x2865c8[_0x6db2('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x6db2('0x20'),_0x2865c8['dialQueueProject2']?'g':'',_[_0x6db2('0x15')](_0x2865c8[_0x6db2('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2865c8[_0x6db2('0x22')]||'','XMD-AGI':_0x2865c8[_0x6db2('0x23')]?util[_0x6db2('0x13')](_0x6db2('0x24'),ipAgi,_0x2865c8[_0x6db2('0x23')]):_0x6db2('0x25'),'XMD-AGIAFTER':_0x2865c8[_0x6db2('0x26')]?util[_0x6db2('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2865c8[_0x6db2('0x26')]):_0x6db2('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x4cad41?_0x4cad41[_0x6db2('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x4cad41?_0x4cad41['originatecalleridname']:'','XMD-DESTINATION':_0x6db2('0x28')};if(!_[_0x6db2('0x15')](_0x2865c8['monitor_format'])){_0x383d2a[util['format']('%s',_0x6db2('0x29'))]=_0x2865c8[_0x6db2('0x21')];_0x383d2a[util[_0x6db2('0x13')]('%s',_0x6db2('0x2a'))]=_0x47d827;}if(_0x3d6f8d&&_0x3d6f8d[_0x6db2('0x2b')]){for(var _0x51520c in _0x3d6f8d[_0x6db2('0x2b')]){if(_0x3d6f8d['Contact'][_0x6db2('0x2c')](_0x51520c)){if(!_['isNil'](_0x3d6f8d[_0x6db2('0x2b')][_0x51520c])&&_0x51520c!=='id'&&_0x51520c!==_0x6db2('0x2d')&&_0x51520c!==_0x6db2('0x2e')&&_0x51520c!==_0x6db2('0x2f')){_0x383d2a[util[_0x6db2('0x13')](_0x6db2('0x30'),'XMD-',_[_0x6db2('0x31')](_0x51520c))]=_0x3d6f8d[_0x6db2('0x2b')][_0x51520c];}}}}return _0x383d2a;};exports[_0x6db2('0x32')]=function(_0x1e596f){var _0x2f44f1={};for(var _0x3f65cc in _0x1e596f){if(_0x1e596f['hasOwnProperty'](_0x3f65cc)){_0x2f44f1[util[_0x6db2('0x13')]('%s',_['toLower'](_0x3f65cc))]=_0x1e596f[_0x3f65cc];}}return{'variables':_0x2f44f1};};exports[_0x6db2('0x33')]=function(_0x595164,_0x5eab78){if(!_[_0x6db2('0x17')](_0x595164)){if(_0x595164[_0x6db2('0x2c')](_0x6db2('0x34'))){if(_0x595164['originated']>0x0){_0x595164[_0x6db2('0x34')]-=0x1;}else{logger[_0x6db2('0xa')](_0x6db2('0x35'),_0x5eab78);}}}else{logger[_0x6db2('0xa')](_0x6db2('0x36'),_0x5eab78);}};exports[_0x6db2('0x37')]=function(_0x18f7b3){var _0x24aadc=moment()['format'](_0x6db2('0x38'));_0x18f7b3[_0x6db2('0x39')]=0xd;_0x18f7b3[_0x6db2('0x3a')]=_0x6db2('0x3b');_0x18f7b3[_0x6db2('0x3c')]=_0x24aadc;_0x18f7b3['responsetime']=_0x24aadc;_0x18f7b3[_0x6db2('0x3d')]=_0x24aadc;};exports[_0x6db2('0x3e')]=function(_0x216e1b,_0x32d9d6,_0x2241b0){var _0x3a9566=moment()['format'](_0x6db2('0x38'));_0x216e1b[_0x6db2('0x39')]=_0x32d9d6;_0x216e1b[_0x6db2('0x3a')]=_0x2241b0;_0x216e1b['responsetime']=_0x3a9566;_0x216e1b[_0x6db2('0x3f')]=getSeconds(_0x216e1b[_0x6db2('0x40')],_0x216e1b[_0x6db2('0x3c')]);};exports[_0x6db2('0x41')]=function(_0x1fd67f,_0x496eed,_0xeaa40f){_0x1fd67f[_0x6db2('0x42')]=_0x496eed;_0x1fd67f[_0x6db2('0x43')]=_0xeaa40f;};exports[_0x6db2('0x44')]=function(_0x4b9d83,_0x2a1c1c,_0x2cc788){var _0x170a7d=moment()[_0x6db2('0x13')](_0x6db2('0x38'));_0x4b9d83['state']=_0x2a1c1c;_0x4b9d83['statedesc']=_0x2cc788;_0x4b9d83[_0x6db2('0x40')]=_0x4b9d83[_0x6db2('0x40')]?_0x4b9d83['responsetime']:_0x170a7d;_0x4b9d83[_0x6db2('0x3d')]=_0x4b9d83[_0x6db2('0x3d')]?_0x4b9d83[_0x6db2('0x3d')]:_0x170a7d;_0x4b9d83[_0x6db2('0x3f')]=getSeconds(_0x4b9d83[_0x6db2('0x40')]||0x0,_0x4b9d83[_0x6db2('0x3c')]||0x0);_0x4b9d83[_0x6db2('0x45')]=_0x4b9d83[_0x6db2('0x46')]?getSeconds(_0x4b9d83['endtime'],_0x4b9d83[_0x6db2('0x46')]):0x0;};exports['isFailure']=function(_0x3ba073){return _0x3ba073===_0x6db2('0x47');};exports['variablesAction']=function(_0x29ffb3,_0x16c712,_0x26c34b,_0x26aec4,_0xc14b1c){var _0xe9a049=_0x26aec4?_0x6db2('0x48'):_0x29ffb3['calleridname'];_0xe9a049=_0xc14b1c?'BOOKED':_0xe9a049;return{'actionid':_0x29ffb3[_0x6db2('0x49')],'action':_0x6db2('0x4a'),'channel':_0x29ffb3[_0x6db2('0x4b')],'callerid':util[_0x6db2('0x13')]('\x22%s\x22\x20<%s>',_0xe9a049,_0x29ffb3[_0x6db2('0x4c')]),'Exten':_0x6db2('0x28'),'Context':_0x6db2('0x4d'),'Priority':'1','variable':_0x26c34b,'timeout':(_0x16c712[_0x6db2('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x29ffb3['uniqueid']};};exports[_0x6db2('0x4f')]=function(_0x4be644){return _0x4be644['countbusyretry']+_0x4be644['countcongestionretry']+_0x4be644[_0x6db2('0x50')];};exports[_0x6db2('0x51')]=function(_0x123a1d){var _0x3f0016=_['clone'](_0x123a1d);_0x3f0016[_0x6db2('0x39')]=0xf;_0x3f0016[_0x6db2('0x3a')]=_0x6db2('0x52');return _0x3f0016;};exports['scheduledAt']=function(_0x2753cb,_0x31a1dc,_0x153d5c){var _0x37b390={};_0x37b390[_0x31a1dc]=_0x2753cb[_0x31a1dc];_0x37b390[_0x6db2('0x53')]=![];_0x37b390[_0x6db2('0x54')]=moment()['add'](_0x153d5c,'minutes')['format'](_0x6db2('0x38'));_0x37b390[_0x6db2('0x1c')]=_0x2753cb[_0x6db2('0x1c')];_0x37b390[_0x6db2('0x55')]=_0x2753cb['ListId'];_0x37b390['VoiceQueueId']=_0x2753cb[_0x6db2('0x1e')]||undefined;return _0x37b390;};exports[_0x6db2('0x56')]=function(_0xe1c120,_0x122d3f){if(!_[_0x6db2('0x17')](_0xe1c120)){if(_0xe1c120['pTalking']>0x0){_0xe1c120[_0x6db2('0x57')]-=0x1;}else{logger['error'](_0x122d3f,_0x6db2('0x58'));}}else{logger['error'](_0x122d3f,_0x6db2('0x59'));}};exports[_0x6db2('0x5a')]=function(_0x381709){if(_0x381709<=0x0){return!![];}return![];};exports[_0x6db2('0x5b')]=function(_0x73fb9e,_0x35cfa1){_0x73fb9e[_0x6db2('0x5c')]=_0x35cfa1;_0x73fb9e[_0x6db2('0x1a')]=_0x73fb9e[_0x6db2('0x5d')];_0x73fb9e[_0x6db2('0x5e')]=_0x73fb9e[_0x6db2('0x4b')];return _0x73fb9e;};exports[_0x6db2('0x5f')]=function(_0x174140){var _0x5b4a86={};_0x5b4a86[_0x6db2('0x5d')]=_0x174140[_0x6db2('0x5d')];_0x5b4a86[_0x6db2('0x5e')]=_0x174140[_0x6db2('0x4b')];_0x5b4a86['uniqueid']=_0x174140[_0x6db2('0x49')];return _0x5b4a86;};exports['agentReadyId']=function(_0xe82d14){var _0xcf749e=[];for(var _0x4657ad in _0xe82d14){if(_0xe82d14[_0x6db2('0x2c')](_0x4657ad)){if(!_['isNil'](_0xe82d14[_0x4657ad])&&_0xe82d14[_0x4657ad][_0x6db2('0x39')]==='not_inuse'&&_0xe82d14[_0x4657ad][_0x6db2('0x60')]===_0x6db2('0x61')){_0xcf749e[_0x6db2('0x62')](_0xe82d14[_0x4657ad]['id']);}}}return _0xcf749e;};exports[_0x6db2('0x63')]=function(_0xd580de){var _0x1bc82f=moment()[_0x6db2('0x64')](0x0);var _0x166a56=moment(_0xd580de)[_0x6db2('0x64')](0x0);return _0x1bc82f[_0x6db2('0x7')](_0x166a56,_0x6db2('0x8'));};exports[_0x6db2('0x65')]=function(_0x24fa9a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x24fa9a['ContactId'],'ListId':_0x24fa9a[_0x6db2('0x55')],'VoiceQueueId':_0x24fa9a[_0x6db2('0x1e')]||undefined,'CampaignId':_0x24fa9a[_0x6db2('0x66')]||undefined};};exports['filterKey']=function(_0x48bf24){if(_0x48bf24==='uniqueid'||_0x48bf24==='idContact'||_0x48bf24===_0x6db2('0x5d')||_0x48bf24===_0x6db2('0x67')||_0x48bf24===_0x6db2('0x68')||_0x48bf24==='dialAnswer'||_0x48bf24===_0x6db2('0x42')||_0x48bf24===_0x6db2('0x4b')||_0x48bf24===_0x6db2('0x1b')||_0x48bf24===_0x6db2('0x53')||_0x48bf24===_0x6db2('0x4c')||_0x48bf24==='scheduledat'||_0x48bf24===_0x6db2('0x69')||_0x48bf24==='countcongestionretry'||_0x48bf24==='countnoanswerretry'||_0x48bf24===_0x6db2('0x6a')||_0x48bf24===_0x6db2('0x6b')||_0x48bf24===_0x6db2('0x6c')||_0x48bf24===_0x6db2('0x6d')||_0x48bf24===_0x6db2('0x6e')||_0x48bf24===_0x6db2('0x1c')||_0x48bf24===_0x6db2('0x55')||_0x48bf24===_0x6db2('0x43')||_0x48bf24===_0x6db2('0x1e')||_0x48bf24===_0x6db2('0x6f')||_0x48bf24===_0x6db2('0x70')||_0x48bf24===_0x6db2('0x71')||_0x48bf24===_0x6db2('0x72')||_0x48bf24==='xmd-listid'||_0x48bf24===_0x6db2('0x73')||_0x48bf24===_0x6db2('0x74')||_0x48bf24==='xmd-dialoptions'||_0x48bf24==='xmd-dialid'||_0x48bf24===_0x6db2('0x75')||_0x48bf24===_0x6db2('0x76')||_0x48bf24===_0x6db2('0x77')||_0x48bf24===_0x6db2('0x78')||_0x48bf24===_0x6db2('0x79')||_0x48bf24===_0x6db2('0x7a')||_0x48bf24===_0x6db2('0x7b')||_0x48bf24===_0x6db2('0x7c')||_0x48bf24===_0x6db2('0x7d')||_0x48bf24===_0x6db2('0x7e')||_0x48bf24==='rtpaudioqosloss'||_0x48bf24===_0x6db2('0x7f')||_0x48bf24==='rtpaudioqosrtt'||_0x48bf24===_0x6db2('0x80')||_0x48bf24===_0x6db2('0x7b')||_0x48bf24==='rtpaudioqosbridged'||_0x48bf24==='rtpaudioqosjitter'||_0x48bf24===_0x6db2('0x7e')||_0x48bf24===_0x6db2('0x81')||_0x48bf24==='rtpaudioqoslossbridged'||_0x48bf24===_0x6db2('0x82')||_0x48bf24===_0x6db2('0x80')||_0x48bf24==='bridgepeer'||_0x48bf24===_0x6db2('0x83')||_0x48bf24==='state'||_0x48bf24===_0x6db2('0x3a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x206f68,_0x216625){var _0x4e59cf,_0x4ef9a7,_0x3deb49;if(_0x216625<=0x0){_0x216625=0x1;}_0x4e59cf=new RegExp(_0x6db2('0x84')+_0x216625+'}$');_0x4ef9a7=Math[_0x6db2('0x85')](0xa,_0x216625-0x1);_0x3deb49=Math[_0x6db2('0x85')](0xa,_0x216625)-0x1;return util[_0x6db2('0x13')]('%s',_[_0x6db2('0x86')](_0x206f68,_0x4e59cf,_[_0x6db2('0x87')](_0x4ef9a7,_0x3deb49)));};exports['extractCalleridName']=function(_0x2279ef){var _0x3bdb54=_0x2279ef[_0x6db2('0x88')](/"(.*?)"/);return _0x3bdb54?_0x3bdb54[0x1]:_0x2279ef;};exports[_0x6db2('0x89')]=function(_0x1f4d00){var _0x3a8bd3=_0x1f4d00[_0x6db2('0x88')](/<(.*?)>/);return _0x3a8bd3?_0x3a8bd3[0x1]:_0x1f4d00;}; \ No newline at end of file +var _0x949d=['membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','cloneAction','Global','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','buildAcw','agentReadyId','not_inuse','status','reachable','getDiff','seconds','CampaignId','idContact','type','scheduledat','countnoanswerretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosrtt','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','inspect','logger','info','error','message','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','Contact','updatedAt','XMD-','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','ringtime','logLookAgent'];(function(_0x59026b,_0x12ace5){var _0x2c6152=function(_0x193dc2){while(--_0x193dc2){_0x59026b['push'](_0x59026b['shift']());}};_0x2c6152(++_0x12ace5);}(_0x949d,0x162));var _0xd949=function(_0x177d9d,_0x49f2e0){_0x177d9d=_0x177d9d-0x0;var _0x5858f5=_0x949d[_0x177d9d];return _0x5858f5;};'use strict';var util=require(_0xd949('0x0'));var _=require(_0xd949('0x1'));var moment=require(_0xd949('0x2'));var logger=require(_0xd949('0x3'))('preview');var ipAgi=process['env'][_0xd949('0x4')]||_0xd949('0x5');function getSeconds(_0x596628,_0x2768a3){var _0x312499=moment(_0x596628)['milliseconds'](0x0);var _0x3d2be5=moment(_0x2768a3)[_0xd949('0x6')](0x0);return _0x312499[_0xd949('0x7')](_0x3d2be5,'seconds');}exports[_0xd949('0x8')]=function(_0x158cc2){return function(_0x49b70a){logger['error'](_0x158cc2,util[_0xd949('0x9')](_0x49b70a,{'showHidden':![],'depth':null}));};};exports[_0xd949('0xa')]=function(_0x37123a,_0x24eff8){logger[_0xd949('0xb')](_0x37123a,util['inspect'](_0x24eff8,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xd4d875,_0x2fb71f){logger[_0xd949('0xc')](_0xd4d875,util[_0xd949('0x9')](_0x2fb71f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x1975d4){return function(_0x4e9244){logger[_0xd949('0xb')](_0x1975d4,util[_0xd949('0x9')](_0x4e9244,{'showHidden':![],'depth':null}));};};exports[_0xd949('0xd')]=function(_0x2edba2,_0x204615,_0x2a7fe8){return{'message':_0x2edba2,'unlock':_0x204615,'active':_0x2a7fe8};};exports['getCallerId']=function(_0x319286,_0x2efe05,_0x3fc0bb){if(!_[_0xd949('0xe')](_0x3fc0bb)&&'string'===typeof _0x3fc0bb&&!_[_0xd949('0xf')](_0x3fc0bb)){if(!_[_0xd949('0xe')](_0x2efe05)&&_0xd949('0x10')===typeof _0x2efe05&&!_[_0xd949('0xf')](_0x2efe05)){return util[_0xd949('0x11')](_0xd949('0x12'),_0x2efe05,_0x3fc0bb);}return util[_0xd949('0x11')]('\x22%s\x22\x20<%s>',_0x3fc0bb,_0x3fc0bb);}if(!_[_0xd949('0xe')](_0x319286)&&_0xd949('0x10')===typeof _0x319286&&!_['isEmpty'](_0x319286)){return _0x319286;}return _0xd949('0x13');};exports[_0xd949('0x14')]=function(_0x129521){if(_[_0xd949('0x15')](_0x129521)){return![];}return _0x129521;};exports[_0xd949('0x16')]=function(_0x495cbf,_0x25f52f,_0x99a9f2,_0x56d8f2,_0x582d8e,_0x6c4e63){var _0xb06b83={'XMD-QUEUE':_0x25f52f[_0xd949('0x17')]?_0x25f52f[_0xd949('0x17')]['name']:'','XMD-CALLERID':_0x56d8f2,'XMD-CALLERID-PREVIEW':_0x6c4e63?util['format'](_0xd949('0x12'),_0x6c4e63[_0xd949('0x18')],_0x6c4e63[_0xd949('0x19')]):_0x56d8f2,'XMD-DIALID':_0x582d8e,'XMD-CONTACTID':_0x25f52f[_0xd949('0x1a')],'XMD-CDRTYPE':_0xd949('0x1b'),'CALLERID(all)':_0x56d8f2,'XMD-VOICEQUEUEID':_0x25f52f[_0xd949('0x1c')],'XMD-DIALCHANNEL':_0x99a9f2,'XMD-DIALTIMEOUT':_0x495cbf[_0xd949('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xd949('0x1e'),_0x495cbf[_0xd949('0x1f')]?'g':'',_[_0xd949('0xf')](_0x495cbf[_0xd949('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x495cbf[_0xd949('0x21')]||'','XMD-AGI':_0x495cbf[_0xd949('0x22')]?util[_0xd949('0x11')](_0xd949('0x23'),ipAgi,_0x495cbf[_0xd949('0x22')]):'NONE','XMD-AGIAFTER':_0x495cbf['dialQueueProject2']?util[_0xd949('0x11')](_0xd949('0x23'),ipAgi,_0x495cbf['dialQueueProject2']):_0xd949('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x6c4e63?_0x6c4e63[_0xd949('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x6c4e63?_0x6c4e63['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xd949('0xf')](_0x495cbf[_0xd949('0x20')])){_0xb06b83[util[_0xd949('0x11')]('%s',_0xd949('0x26'))]=_0x495cbf['monitor_format'];_0xb06b83[util[_0xd949('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x582d8e;}if(_0x25f52f&&_0x25f52f[_0xd949('0x27')]){for(var _0x4df87c in _0x25f52f['Contact']){if(_0x25f52f[_0xd949('0x27')]['hasOwnProperty'](_0x4df87c)){if(!_[_0xd949('0x15')](_0x25f52f[_0xd949('0x27')][_0x4df87c])&&_0x4df87c!=='id'&&_0x4df87c!=='tags'&&_0x4df87c!=='createdAt'&&_0x4df87c!==_0xd949('0x28')){_0xb06b83[util[_0xd949('0x11')]('%s%s',_0xd949('0x29'),_['toUpper'](_0x4df87c))]=_0x25f52f[_0xd949('0x27')][_0x4df87c];}}}}return _0xb06b83;};exports[_0xd949('0x2a')]=function(_0x564e1c){var _0x576678={};for(var _0x5b69c2 in _0x564e1c){if(_0x564e1c[_0xd949('0x2b')](_0x5b69c2)){_0x576678[util[_0xd949('0x11')]('%s',_[_0xd949('0x2c')](_0x5b69c2))]=_0x564e1c[_0x5b69c2];}}return{'variables':_0x576678};};exports[_0xd949('0x2d')]=function(_0x3bccee,_0x814ed2){if(!_[_0xd949('0x15')](_0x3bccee)){if(_0x3bccee[_0xd949('0x2b')](_0xd949('0x2e'))){if(_0x3bccee[_0xd949('0x2e')]>0x0){_0x3bccee[_0xd949('0x2e')]-=0x1;}else{logger[_0xd949('0xc')](_0xd949('0x2f'),_0x814ed2);}}}else{logger['error'](_0xd949('0x30'),_0x814ed2);}};exports[_0xd949('0x31')]=function(_0x3e49c5){var _0x365f7c=moment()[_0xd949('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e49c5['state']=0xd;_0x3e49c5[_0xd949('0x32')]=_0xd949('0x33');_0x3e49c5[_0xd949('0x34')]=_0x365f7c;_0x3e49c5[_0xd949('0x35')]=_0x365f7c;_0x3e49c5[_0xd949('0x36')]=_0x365f7c;};exports[_0xd949('0x37')]=function(_0x54c357,_0x49f68c,_0x2279e7){var _0x4cd509=moment()[_0xd949('0x11')](_0xd949('0x38'));_0x54c357[_0xd949('0x39')]=_0x49f68c;_0x54c357[_0xd949('0x32')]=_0x2279e7;_0x54c357[_0xd949('0x35')]=_0x4cd509;_0x54c357[_0xd949('0x3a')]=getSeconds(_0x54c357[_0xd949('0x35')],_0x54c357[_0xd949('0x34')]);};exports[_0xd949('0x3b')]=function(_0x3ccf50,_0x3c5810,_0x3b0e3f){_0x3ccf50[_0xd949('0x3c')]=_0x3c5810;_0x3ccf50[_0xd949('0x3d')]=_0x3b0e3f;};exports[_0xd949('0x3e')]=function(_0x6efcaa,_0x1b2380,_0xdcd1bc){var _0x6c0cb6=moment()[_0xd949('0x11')](_0xd949('0x38'));_0x6efcaa['state']=_0x1b2380;_0x6efcaa[_0xd949('0x32')]=_0xdcd1bc;_0x6efcaa[_0xd949('0x35')]=_0x6efcaa[_0xd949('0x35')]?_0x6efcaa[_0xd949('0x35')]:_0x6c0cb6;_0x6efcaa['endtime']=_0x6efcaa[_0xd949('0x36')]?_0x6efcaa['endtime']:_0x6c0cb6;_0x6efcaa[_0xd949('0x3a')]=getSeconds(_0x6efcaa['responsetime']||0x0,_0x6efcaa[_0xd949('0x34')]||0x0);_0x6efcaa[_0xd949('0x3f')]=_0x6efcaa[_0xd949('0x40')]?getSeconds(_0x6efcaa[_0xd949('0x36')],_0x6efcaa[_0xd949('0x40')]):0x0;};exports[_0xd949('0x41')]=function(_0x144363){return _0x144363===_0xd949('0x42');};exports['variablesAction']=function(_0x21356c,_0x2cc368,_0x45c59a,_0x57423b,_0x5bb46b){var _0x4e4898=_0x57423b?_0xd949('0x43'):_0x21356c[_0xd949('0x18')];_0x4e4898=_0x5bb46b?_0xd949('0x44'):_0x4e4898;return{'actionid':_0x21356c[_0xd949('0x45')],'action':_0xd949('0x46'),'channel':_0x21356c[_0xd949('0x47')],'callerid':util[_0xd949('0x11')](_0xd949('0x12'),_0x4e4898,_0x21356c[_0xd949('0x19')]),'Exten':_0xd949('0x48'),'Context':_0xd949('0x49'),'Priority':'1','variable':_0x45c59a,'timeout':(_0x2cc368[_0xd949('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x21356c[_0xd949('0x45')]};};exports[_0xd949('0x4b')]=function(_0x466d1d){return _0x466d1d[_0xd949('0x4c')]+_0x466d1d[_0xd949('0x4d')]+_0x466d1d['countnoanswerretry'];};exports[_0xd949('0x4e')]=function(_0x59d3a5){var _0x20cde5=_['clone'](_0x59d3a5);_0x20cde5[_0xd949('0x39')]=0xf;_0x20cde5['statedesc']=_0xd949('0x4f');return _0x20cde5;};exports['scheduledAt']=function(_0x26d1e4,_0x834b75,_0x1001db){var _0x320541={};_0x320541[_0x834b75]=_0x26d1e4[_0x834b75];_0x320541[_0xd949('0x50')]=![];_0x320541['scheduledat']=moment()[_0xd949('0x51')](_0x1001db,_0xd949('0x52'))[_0xd949('0x11')](_0xd949('0x38'));_0x320541[_0xd949('0x1a')]=_0x26d1e4[_0xd949('0x1a')];_0x320541[_0xd949('0x53')]=_0x26d1e4[_0xd949('0x53')];_0x320541['VoiceQueueId']=_0x26d1e4[_0xd949('0x1c')]||undefined;return _0x320541;};exports[_0xd949('0x54')]=function(_0x424ab6,_0x55db8c){if(!_['isNil'](_0x424ab6)){if(_0x424ab6[_0xd949('0x55')]>0x0){_0x424ab6['pTalking']-=0x1;}else{logger[_0xd949('0xc')](_0x55db8c,_0xd949('0x56'));}}else{logger['error'](_0x55db8c,_0xd949('0x57'));}};exports[_0xd949('0x58')]=function(_0x5d2169){if(_0x5d2169<=0x0){return!![];}return![];};exports[_0xd949('0x59')]=function(_0x1b577a,_0x278d3d){_0x1b577a[_0xd949('0x5a')]=_0x278d3d;_0x1b577a[_0xd949('0x5b')]=_0x1b577a[_0xd949('0x5c')];_0x1b577a[_0xd949('0x5d')]=_0x1b577a[_0xd949('0x47')];return _0x1b577a;};exports[_0xd949('0x5e')]=function(_0x957225){var _0x1fe428={};_0x1fe428[_0xd949('0x5c')]=_0x957225[_0xd949('0x5c')];_0x1fe428[_0xd949('0x5d')]=_0x957225[_0xd949('0x47')];_0x1fe428['uniqueid']=_0x957225['uniqueid'];return _0x1fe428;};exports[_0xd949('0x5f')]=function(_0x1cb331){var _0x352d2d=[];for(var _0x2084cb in _0x1cb331){if(_0x1cb331[_0xd949('0x2b')](_0x2084cb)){if(!_[_0xd949('0x15')](_0x1cb331[_0x2084cb])&&_0x1cb331[_0x2084cb][_0xd949('0x39')]===_0xd949('0x60')&&_0x1cb331[_0x2084cb][_0xd949('0x61')]===_0xd949('0x62')){_0x352d2d['push'](_0x1cb331[_0x2084cb]['id']);}}}return _0x352d2d;};exports[_0xd949('0x63')]=function(_0xc91e86){var _0x9d2f98=moment()['milliseconds'](0x0);var _0x60e3a2=moment(_0xc91e86)[_0xd949('0x6')](0x0);return _0x9d2f98[_0xd949('0x7')](_0x60e3a2,_0xd949('0x64'));};exports['createBody']=function(_0x43d500){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x43d500[_0xd949('0x1a')],'ListId':_0x43d500[_0xd949('0x53')],'VoiceQueueId':_0x43d500[_0xd949('0x1c')]||undefined,'CampaignId':_0x43d500[_0xd949('0x65')]||undefined};};exports['filterKey']=function(_0x492caf){if(_0x492caf===_0xd949('0x45')||_0x492caf===_0xd949('0x66')||_0x492caf===_0xd949('0x5c')||_0x492caf===_0xd949('0x67')||_0x492caf==='campaigntype'||_0x492caf==='dialAnswer'||_0x492caf===_0xd949('0x3c')||_0x492caf===_0xd949('0x47')||_0x492caf===_0xd949('0x18')||_0x492caf===_0xd949('0x50')||_0x492caf===_0xd949('0x19')||_0x492caf===_0xd949('0x68')||_0x492caf===_0xd949('0x4c')||_0x492caf===_0xd949('0x4d')||_0x492caf===_0xd949('0x69')||_0x492caf===_0xd949('0x6a')||_0x492caf===_0xd949('0x6b')||_0x492caf===_0xd949('0x6c')||_0x492caf==='callbackat'||_0x492caf===_0xd949('0x6d')||_0x492caf===_0xd949('0x1a')||_0x492caf==='ListId'||_0x492caf===_0xd949('0x3d')||_0x492caf===_0xd949('0x1c')||_0x492caf===_0xd949('0x6e')||_0x492caf==='xmd-voicequeueid'||_0x492caf===_0xd949('0x6f')||_0x492caf===_0xd949('0x70')||_0x492caf===_0xd949('0x71')||_0x492caf===_0xd949('0x72')||_0x492caf===_0xd949('0x73')||_0x492caf===_0xd949('0x74')||_0x492caf===_0xd949('0x75')||_0x492caf===_0xd949('0x76')||_0x492caf===_0xd949('0x77')||_0x492caf===_0xd949('0x78')||_0x492caf==='xmd-callerid'||_0x492caf===_0xd949('0x79')||_0x492caf===_0xd949('0x7a')||_0x492caf==='rtpaudioqos'||_0x492caf===_0xd949('0x7b')||_0x492caf===_0xd949('0x7c')||_0x492caf===_0xd949('0x7d')||_0x492caf===_0xd949('0x7e')||_0x492caf===_0xd949('0x7f')||_0x492caf==='rtpaudioqosrtt'||_0x492caf===_0xd949('0x80')||_0x492caf===_0xd949('0x81')||_0x492caf===_0xd949('0x7b')||_0x492caf===_0xd949('0x7c')||_0x492caf===_0xd949('0x7d')||_0x492caf==='rtpaudioqosloss'||_0x492caf===_0xd949('0x7f')||_0x492caf===_0xd949('0x82')||_0x492caf===_0xd949('0x80')||_0x492caf==='bridgepeer'||_0x492caf==='bridgepvtcallid'||_0x492caf===_0xd949('0x39')||_0x492caf===_0xd949('0x32')){return![];}return!![];};exports[_0xd949('0x83')]=function(_0x39df82,_0xf7c69){var _0x3379d0,_0x458517,_0x2a36dd;if(_0xf7c69<=0x0){_0xf7c69=0x1;}_0x3379d0=new RegExp(_0xd949('0x84')+_0xf7c69+'}$');_0x458517=Math[_0xd949('0x85')](0xa,_0xf7c69-0x1);_0x2a36dd=Math[_0xd949('0x85')](0xa,_0xf7c69)-0x1;return util['format']('%s',_[_0xd949('0x86')](_0x39df82,_0x3379d0,_['random'](_0x458517,_0x2a36dd)));};exports[_0xd949('0x87')]=function(_0x1c71ed){var _0x4fdd94=_0x1c71ed[_0xd949('0x88')](/"(.*?)"/);return _0x4fdd94?_0x4fdd94[0x1]:_0x1c71ed;};exports[_0xd949('0x89')]=function(_0x188823){var _0x43cd33=_0x188823[_0xd949('0x88')](/<(.*?)>/);return _0x43cd33?_0x43cd33[0x1]:_0x188823;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 515e169..4633409 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x261c34,_0x56cfb0){var _0x2e7b6f=function(_0x5504ac){while(--_0x5504ac){_0x261c34['push'](_0x261c34['shift']());}};_0x2e7b6f(++_0x56cfb0);}(_0xb10b,0x12a));var _0xbb10=function(_0x489fe3,_0x5ebb81){_0x489fe3=_0x489fe3-0x0;var _0x592190=_0xb10b[_0x489fe3];return _0x592190;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x5b35f8,_0x11bfe5){var _0x287afe=function(_0x5306db){while(--_0x5306db){_0x5b35f8['push'](_0x5b35f8['shift']());}};_0x287afe(++_0x11bfe5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x448774,_0x45ddc7){_0x448774=_0x448774-0x0;var _0x46b2f6=_0x5f2f[_0x448774];return _0x46b2f6;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 00fe011..534c048 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 _0x051e=['initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','initVoiceExtensions','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','timers','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','agents','length','isNil','isUndefined','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts'];(function(_0x47de0c,_0x374e00){var _0x235153=function(_0x452750){while(--_0x452750){_0x47de0c['push'](_0x47de0c['shift']());}};_0x235153(++_0x374e00);}(_0x051e,0x1ab));var _0xe051=function(_0x3811e3,_0x5f011c){_0x3811e3=_0x3811e3-0x0;var _0x40d6b8=_0x051e[_0x3811e3];return _0x40d6b8;};'use strict';var BPromise=require(_0xe051('0x0'));var util=require('util');var _=require(_0xe051('0x1'));var moment=require(_0xe051('0x2'));var Agent=require(_0xe051('0x3'));var Telephone=require(_0xe051('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xe051('0x5'));var Trigger=require(_0xe051('0x6'));var Template=require(_0xe051('0x7'));var Campaign=require(_0xe051('0x8'));var VoiceExtension=require(_0xe051('0x9'));var ZendeskAccount=require(_0xe051('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe051('0xb'));var ServicenowAccount=require(_0xe051('0xc'));var Dynamics365Account=require('../model/dynamics365Account');var FaxAccount=require(_0xe051('0xd'));var Realtime=function(){this['agents']={};this[_0xe051('0xe')]={};this['trunks']={};this[_0xe051('0xf')]={};this[_0xe051('0x10')]={};this['campaigns']={};this[_0xe051('0x11')]={};this[_0xe051('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe051('0x13')]={};this[_0xe051('0x14')]={};this[_0xe051('0x15')]={};this['outboundChannels']={};this[_0xe051('0x16')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0xe051('0x17')]={};this[_0xe051('0x18')]={};this[_0xe051('0x19')]={};this[_0xe051('0x1a')]={};this[_0xe051('0x1b')]={};this[_0xe051('0x1c')]={};this[_0xe051('0x1d')]={};};function freeIsNotKey(_0x445c27,_0xea8bdb,_0x5381d2){var _0x4421b5=_['mapKeys'](_0x445c27,function(_0x51ec25,_0x32e69e){return _0x51ec25[_0x5381d2];});for(var _0x3601bb in _0xea8bdb){if(_0xea8bdb['hasOwnProperty'](_0x3601bb)){if(!_0x4421b5[_0x3601bb]){delete _0xea8bdb[_0x3601bb];}}}}function freeIsNotKeySip(_0x3d20fe,_0x3c748d){var _0x4ad64a=_[_0xe051('0x1e')](_0x3d20fe,function(_0x4af972,_0x5837d1){return util[_0xe051('0x1f')](_0xe051('0x20'),_0x4af972[_0xe051('0x21')]);});for(var _0x5a8d7a in _0x3c748d){if(_0x3c748d[_0xe051('0x22')](_0x5a8d7a)){if(!_0x4ad64a[_0x5a8d7a]){delete _0x3c748d[_0x5a8d7a];}}}}function freeIsNotKeyAgent(_0x5e5d48,_0x17a51d){var _0x59cec3=_[_0xe051('0x1e')](_0x5e5d48,function(_0x30a458,_0x233ac4){var _0x2779e2=_['isNil'](_0x30a458[_0xe051('0x23')])?util[_0xe051('0x1f')]('SIP/%s',_0x30a458[_0xe051('0x21')]):_0x30a458[_0xe051('0x23')];return _0x2779e2;});for(var _0x8875e4 in _0x17a51d){if(_0x17a51d[_0xe051('0x22')](_0x8875e4)){if(!_0x59cec3[_0x8875e4]){delete _0x17a51d[_0x8875e4];}}}}function clearVoiceCallReports(_0x10530a){_0x10530a[_0xe051('0x24')]=0x0;_0x10530a[_0xe051('0x25')]=0x0;_0x10530a['sumHoldTime']=0x0;_0x10530a[_0xe051('0x26')]=0x0;_0x10530a[_0xe051('0x27')]=0x0;}function clearCampaigns(_0x4f0920){if(!_[_0xe051('0x28')](_0x4f0920)){for(var _0x36a020 in _0x4f0920){if(_0x4f0920[_0xe051('0x22')](_0x36a020)){_0x4f0920[_0x36a020]['ivrTotalCallsDays']=0x0;_0x4f0920[_0x36a020][_0xe051('0x29')]=0x0;}}}}function clearVoiceQueues(_0x1ec119){if(!_[_0xe051('0x28')](_0x1ec119)){for(var _0x5d9ad5 in _0x1ec119){if(_0x1ec119['hasOwnProperty'](_0x5d9ad5)){_0x1ec119[_0x5d9ad5][_0xe051('0x24')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x25')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x2a')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x2b')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x2c')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x26')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x27')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x2d')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x2e')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x2f')]=0x0;_0x1ec119[_0x5d9ad5]['outboundCongestionCallsDay']=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x30')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x31')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x32')]=0x0;_0x1ec119[_0x5d9ad5]['outboundDropCallsDayCallersExit']=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x33')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x34')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x35')]=0x0;_0x1ec119[_0x5d9ad5]['outboundReCallsDay']=0x0;_0x1ec119[_0x5d9ad5]['outboundAnswerAgiCallsDay']=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x36')]=0x0;_0x1ec119[_0x5d9ad5][_0xe051('0x37')]=!![];}}}}Realtime['prototype'][_0xe051('0x38')]=function(_0x57f93b,_0x2b41cb){for(var _0x4d274e in _0x2b41cb){if(_0x57f93b[_0xe051('0x22')](_0x4d274e)){_0x57f93b[_0x4d274e]=_0x2b41cb[_0x4d274e];}}};Realtime[_0xe051('0x39')][_0xe051('0x3a')]=function(){var _0x521bee=this;return function(_0x3ef8c5){if(_0x3ef8c5){freeIsNotKeyAgent(_0x3ef8c5,_0x521bee[_0xe051('0x3b')]);for(var _0xb14f17=0x0,_0x36ce42={},_0x178efb={};_0xb14f17<_0x3ef8c5[_0xe051('0x3c')];_0xb14f17+=0x1){_0x36ce42=_0x3ef8c5[_0xb14f17];var _0x56c845=_[_0xe051('0x3d')](_0x36ce42[_0xe051('0x23')])?util['format']('SIP/%s',_0x36ce42[_0xe051('0x21')]):_0x36ce42[_0xe051('0x23')];if(_[_0xe051('0x3e')](_0x521bee[_0xe051('0x3b')][_0x56c845])){_0x521bee[_0xe051('0x3b')][_0x56c845]=new Agent(_0x36ce42);}else{_0x521bee[_0xe051('0x38')](_0x521bee[_0xe051('0x3b')][_0x56c845],_0x36ce42);}}}return _0x521bee[_0xe051('0x3b')];};};Realtime[_0xe051('0x39')]['initTelephones']=function(){var _0x5c697e=this;return function(_0x3ff46f){if(_0x3ff46f){freeIsNotKeySip(_0x3ff46f,_0x5c697e['telephones']);for(var _0x4a050f=0x0,_0x4c68db={},_0x365e48={};_0x4a050f<_0x3ff46f[_0xe051('0x3c')];_0x4a050f+=0x1){_0x4c68db=_0x3ff46f[_0x4a050f];if(_[_0xe051('0x3e')](_0x5c697e[_0xe051('0xe')][util[_0xe051('0x1f')]('SIP/%s',_0x4c68db['name'])])){_0x5c697e[_0xe051('0xe')][util[_0xe051('0x1f')](_0xe051('0x20'),_0x4c68db[_0xe051('0x21')])]=new Telephone(_0x4c68db);}else{_0x5c697e[_0xe051('0x38')](_0x5c697e[_0xe051('0xe')][util[_0xe051('0x1f')](_0xe051('0x20'),_0x4c68db[_0xe051('0x21')])],_0x4c68db);}}}return _0x5c697e[_0xe051('0xe')];};};Realtime[_0xe051('0x39')][_0xe051('0x3f')]=function(){var _0x256e42=this;return function(_0x72e53d){if(_0x72e53d){freeIsNotKeySip(_0x72e53d,_0x256e42[_0xe051('0x40')]);for(var _0x34cd45=0x0,_0x70016c={},_0x343788={};_0x34cd45<_0x72e53d['length'];_0x34cd45+=0x1){_0x70016c=_0x72e53d[_0x34cd45];if(_[_0xe051('0x3e')](_0x256e42['trunks'][util[_0xe051('0x1f')](_0xe051('0x20'),_0x70016c[_0xe051('0x21')])])){_0x256e42['trunks'][util[_0xe051('0x1f')]('SIP/%s',_0x70016c['name'])]=new Trunk(_0x70016c);}else{_0x256e42[_0xe051('0x38')](_0x256e42[_0xe051('0x40')][util[_0xe051('0x1f')](_0xe051('0x20'),_0x70016c['name'])],_0x70016c);}}}return _0x256e42[_0xe051('0x40')];};};Realtime[_0xe051('0x39')][_0xe051('0x41')]=function(){var _0x5ed24b=this;return function(_0x1d7d55){if(_0x1d7d55){freeIsNotKey(_0x1d7d55,_0x5ed24b[_0xe051('0xf')],_0xe051('0x21'));for(var _0x21b7f2=0x0,_0x4619dc={},_0x1d3cec={};_0x21b7f2<_0x1d7d55[_0xe051('0x3c')];_0x21b7f2+=0x1){_0x4619dc=_0x1d7d55[_0x21b7f2];if(_[_0xe051('0x3e')](_0x5ed24b[_0xe051('0xf')][_0x4619dc[_0xe051('0x21')]])){_0x5ed24b[_0xe051('0xf')][_0x4619dc[_0xe051('0x21')]]=new VoiceQueue(_0x4619dc);}else{_0x5ed24b[_0xe051('0x38')](_0x5ed24b['voiceQueues'][_0x4619dc[_0xe051('0x21')]],_0x4619dc);}}}return _0x5ed24b[_0xe051('0xf')];};};Realtime[_0xe051('0x39')][_0xe051('0x42')]=function(){var _0x1cb6d6=this;return function(_0x16edce){if(_0x16edce){freeIsNotKey(_0x16edce,_0x1cb6d6[_0xe051('0x10')],'id');for(var _0x3b44ef=0x0,_0x3c4d0f={},_0x22e799={};_0x3b44ef<_0x16edce[_0xe051('0x3c')];_0x3b44ef+=0x1){_0x3c4d0f=_0x16edce[_0x3b44ef];if(_[_0xe051('0x3e')](_0x1cb6d6[_0xe051('0x10')][_0x3c4d0f['id']])){_0x1cb6d6[_0xe051('0x10')][_0x3c4d0f['id']]=new Trigger(_0x3c4d0f);}else{_0x1cb6d6[_0xe051('0x38')](_0x1cb6d6[_0xe051('0x10')][_0x3c4d0f['id']],_0x3c4d0f);}}}return _0x1cb6d6[_0xe051('0x10')];};};Realtime[_0xe051('0x39')][_0xe051('0x43')]=function(){var _0x47c747=this;return function(_0x2cb6e4){if(_0x2cb6e4){freeIsNotKey(_0x2cb6e4,_0x47c747['templates'],'id');for(var _0x470cb0=0x0,_0x15c7dd={},_0x2d0817={};_0x470cb0<_0x2cb6e4[_0xe051('0x3c')];_0x470cb0+=0x1){_0x15c7dd=_0x2cb6e4[_0x470cb0];if(_[_0xe051('0x3e')](_0x47c747[_0xe051('0x11')][_0x15c7dd['id']])){_0x47c747[_0xe051('0x11')][_0x15c7dd['id']]=new Template(_0x15c7dd);}else{_0x47c747[_0xe051('0x38')](_0x47c747[_0xe051('0x11')][_0x15c7dd['id']],_0x15c7dd);}}}return _0x47c747[_0xe051('0x11')];};};Realtime[_0xe051('0x39')][_0xe051('0x44')]=function(){var _0x42cc1e=this;return function(_0x498a1b){if(_0x498a1b){freeIsNotKey(_0x498a1b,_0x42cc1e[_0xe051('0x45')],'id');for(var _0x51c75b=0x0,_0x140956={},_0x5b11b9={};_0x51c75b<_0x498a1b[_0xe051('0x3c')];_0x51c75b+=0x1){_0x140956=_0x498a1b[_0x51c75b];if(_[_0xe051('0x3e')](_0x42cc1e['zendeskAccounts'][_0x140956['id']])){_0x42cc1e[_0xe051('0x45')][_0x140956['id']]=new ZendeskAccount(_0x140956);}else{_0x42cc1e[_0xe051('0x38')](_0x42cc1e['zendeskAccounts'][_0x140956['id']],_0x140956);}}}return _0x42cc1e[_0xe051('0x45')];};};Realtime[_0xe051('0x39')]['initSalesforceAccounts']=function(){var _0x355896=this;return function(_0x339fb1){if(_0x339fb1){freeIsNotKey(_0x339fb1,_0x355896[_0xe051('0x46')],'id');for(var _0x2bf062=0x0,_0xe4d81e={},_0x4a87b0={};_0x2bf062<_0x339fb1[_0xe051('0x3c')];_0x2bf062+=0x1){_0xe4d81e=_0x339fb1[_0x2bf062];if(_[_0xe051('0x3e')](_0x355896[_0xe051('0x46')][_0xe4d81e['id']])){_0x355896[_0xe051('0x46')][_0xe4d81e['id']]=new SalesforceAccount(_0xe4d81e);}else{_0x355896[_0xe051('0x38')](_0x355896[_0xe051('0x46')][_0xe4d81e['id']],_0xe4d81e);}}}return _0x355896[_0xe051('0x46')];};};Realtime[_0xe051('0x39')][_0xe051('0x47')]=function(){var _0x277b78=this;return function(_0x122858){if(_0x122858){freeIsNotKey(_0x122858,_0x277b78[_0xe051('0x17')],'id');for(var _0xcf0a34=0x0,_0x355ead={},_0x20e007={};_0xcf0a34<_0x122858[_0xe051('0x3c')];_0xcf0a34+=0x1){_0x355ead=_0x122858[_0xcf0a34];if(_[_0xe051('0x3e')](_0x277b78[_0xe051('0x17')][_0x355ead['id']])){_0x277b78[_0xe051('0x17')][_0x355ead['id']]=new FreshdeskAccount(_0x355ead);}else{_0x277b78['mergeFromDatabase'](_0x277b78[_0xe051('0x17')][_0x355ead['id']],_0x355ead);}}}return _0x277b78[_0xe051('0x17')];};};Realtime['prototype'][_0xe051('0x48')]=function(){var _0x4412a2=this;return function(_0x118daf){if(_0x118daf){freeIsNotKey(_0x118daf,_0x4412a2[_0xe051('0x18')],'id');for(var _0x230dd3=0x0,_0x3fc1dd={},_0x1e6a89={};_0x230dd3<_0x118daf[_0xe051('0x3c')];_0x230dd3+=0x1){_0x3fc1dd=_0x118daf[_0x230dd3];if(_[_0xe051('0x3e')](_0x4412a2[_0xe051('0x18')][_0x3fc1dd['id']])){_0x4412a2[_0xe051('0x18')][_0x3fc1dd['id']]=new ZohoAccount(_0x3fc1dd);}else{_0x4412a2[_0xe051('0x38')](_0x4412a2[_0xe051('0x18')][_0x3fc1dd['id']],_0x3fc1dd);}}}return _0x4412a2[_0xe051('0x18')];};};Realtime[_0xe051('0x39')][_0xe051('0x49')]=function(){var _0x54b5a9=this;return function(_0x38ae4a){if(_0x38ae4a){freeIsNotKey(_0x38ae4a,_0x54b5a9[_0xe051('0x19')],'id');for(var _0x22cd31=0x0,_0x2f4d82={},_0x1b8035={};_0x22cd31<_0x38ae4a[_0xe051('0x3c')];_0x22cd31+=0x1){_0x2f4d82=_0x38ae4a[_0x22cd31];if(_[_0xe051('0x3e')](_0x54b5a9[_0xe051('0x19')][_0x2f4d82['id']])){_0x54b5a9[_0xe051('0x19')][_0x2f4d82['id']]=new DeskAccount(_0x2f4d82);}else{_0x54b5a9[_0xe051('0x38')](_0x54b5a9[_0xe051('0x19')][_0x2f4d82['id']],_0x2f4d82);}}}return _0x54b5a9[_0xe051('0x19')];};};Realtime[_0xe051('0x39')][_0xe051('0x4a')]=function(){var _0x4bde1d=this;return function(_0x190bd5){if(_0x190bd5){freeIsNotKey(_0x190bd5,_0x4bde1d[_0xe051('0x4b')],'id');for(var _0x3ba1e7=0x0,_0x4f045c={},_0x1f58f8={};_0x3ba1e7<_0x190bd5[_0xe051('0x3c')];_0x3ba1e7+=0x1){_0x4f045c=_0x190bd5[_0x3ba1e7];if(_[_0xe051('0x3e')](_0x4bde1d[_0xe051('0x4b')][_0x4f045c['id']])){_0x4bde1d[_0xe051('0x4b')][_0x4f045c['id']]=new SugarcrmAccount(_0x4f045c);}else{_0x4bde1d[_0xe051('0x38')](_0x4bde1d[_0xe051('0x4b')][_0x4f045c['id']],_0x4f045c);}}}return _0x4bde1d[_0xe051('0x4b')];};};Realtime[_0xe051('0x39')][_0xe051('0x4c')]=function(){var _0x3d3823=this;return function(_0x1174fe){if(_0x1174fe){freeIsNotKey(_0x1174fe,_0x3d3823[_0xe051('0x1a')],'id');for(var _0x4738ca=0x0,_0x445384={},_0x291ba6={};_0x4738ca<_0x1174fe[_0xe051('0x3c')];_0x4738ca+=0x1){_0x445384=_0x1174fe[_0x4738ca];if(_['isUndefined'](_0x3d3823[_0xe051('0x1a')][_0x445384['id']])){_0x3d3823[_0xe051('0x1a')][_0x445384['id']]=new VtigerAccount(_0x445384);}else{_0x3d3823[_0xe051('0x38')](_0x3d3823['vtigerAccounts'][_0x445384['id']],_0x445384);}}}return _0x3d3823[_0xe051('0x1a')];};};Realtime[_0xe051('0x39')]['initServicenowAccounts']=function(){var _0x39665a=this;return function(_0x5bfa38){if(_0x5bfa38){freeIsNotKey(_0x5bfa38,_0x39665a[_0xe051('0x1b')],'id');for(var _0x2f976c=0x0,_0x216a9e={},_0xf8796={};_0x2f976c<_0x5bfa38[_0xe051('0x3c')];_0x2f976c+=0x1){_0x216a9e=_0x5bfa38[_0x2f976c];if(_['isUndefined'](_0x39665a[_0xe051('0x1b')][_0x216a9e['id']])){_0x39665a[_0xe051('0x1b')][_0x216a9e['id']]=new ServicenowAccount(_0x216a9e);}else{_0x39665a['mergeFromDatabase'](_0x39665a[_0xe051('0x1b')][_0x216a9e['id']],_0x216a9e);}}}return _0x39665a[_0xe051('0x1b')];};};Realtime[_0xe051('0x39')][_0xe051('0x4d')]=function(){var _0x413d3b=this;return function(_0x439465){if(_0x439465){freeIsNotKey(_0x439465,_0x413d3b['dynamics365Accounts'],'id');for(var _0x21c167=0x0,_0x832a04={},_0xa766b5={};_0x21c167<_0x439465[_0xe051('0x3c')];_0x21c167+=0x1){_0x832a04=_0x439465[_0x21c167];if(_[_0xe051('0x3e')](_0x413d3b['dynamics365Accounts'][_0x832a04['id']])){_0x413d3b['dynamics365Accounts'][_0x832a04['id']]=new Dynamics365Account(_0x832a04);}else{_0x413d3b[_0xe051('0x38')](_0x413d3b[_0xe051('0x1c')][_0x832a04['id']],_0x832a04);}}}return _0x413d3b[_0xe051('0x1c')];};};Realtime[_0xe051('0x39')][_0xe051('0x4e')]=function(){var _0x2d7dbb=this;return function(_0x3a2709){for(var _0x29784f=0x0;_0x29784f<_0x3a2709[_0xe051('0x3c')];_0x29784f+=0x1){_[_0xe051('0x4f')](_0x2d7dbb[_0xe051('0xf')][_0x3a2709[_0x29784f][_0xe051('0x21')]],_0x3a2709[_0x29784f]);}return _0x2d7dbb['voiceQueues'];};};Realtime['prototype'][_0xe051('0x50')]=function(){var _0x49dbb0=this;return function(_0x5423d7){clearVoiceQueues(_0x49dbb0[_0xe051('0xf')]);if(_0x5423d7){_0x5423d7=_[_0xe051('0x51')](_0x5423d7,_0xe051('0x52'));for(var _0x29208c in _0x5423d7){if(_0x5423d7['hasOwnProperty'](_0x29208c)){var _0x4e7be9={};for(var _0x362f78=0x0;_0x362f78<_0x5423d7[_0x29208c][_0xe051('0x3c')];_0x362f78+=0x1){var _0x1fb3ca=_0x5423d7[_0x29208c][_0x362f78][_0xe051('0x53')];if(_0x49dbb0['voiceQueues'][_0x1fb3ca]){if(_0x5423d7[_0x29208c][_0x362f78][_0xe051('0x54')]){_0x49dbb0['voiceQueues'][_0x1fb3ca]['unmanaged']+=0x1;}if(_0x5423d7[_0x29208c][_0x362f78]['queuecallerabandon']){_0x49dbb0[_0xe051('0xf')][_0x1fb3ca]['abandoned']+=0x1;}_0x49dbb0[_0xe051('0xf')][_0x1fb3ca][_0xe051('0x2c')]+=moment(_0x5423d7[_0x29208c][_0x362f78]['queuecallerleaveAt'])[_0xe051('0x55')](moment(_0x5423d7[_0x29208c][_0x362f78]['queuecallerjoinAt']),'seconds')||0x0;if(_0x362f78===_0x5423d7[_0x29208c]['length']-0x1){_0x49dbb0[_0xe051('0xf')][_0x1fb3ca][_0xe051('0x26')]+=moment(_0x5423d7[_0x29208c][_0x362f78][_0xe051('0x56')]||_0x5423d7[_0x29208c][_0x362f78][_0xe051('0x57')]||_0x5423d7[_0x29208c][_0x362f78][_0xe051('0x58')])[_0xe051('0x55')](moment(_0x5423d7[_0x29208c][_0x362f78]['queuecallerjoinAt']),_0xe051('0x59'))||0x0;_0x49dbb0[_0xe051('0xf')][_0x1fb3ca][_0xe051('0x24')]+=0x1;if(_0x5423d7[_0x29208c][_0x362f78]['queuecallercomplete']){_0x49dbb0['voiceQueues'][_0x1fb3ca][_0xe051('0x25')]+=0x1;_0x49dbb0[_0xe051('0xf')][_0x1fb3ca][_0xe051('0x27')]+=moment(_0x5423d7[_0x29208c][_0x362f78][_0xe051('0x56')])[_0xe051('0x55')](moment(_0x5423d7[_0x29208c][_0x362f78][_0xe051('0x5a')]),'seconds')||0x0;}}else{_0x49dbb0[_0xe051('0xf')][_0x1fb3ca]['sumDuration']+=_0x49dbb0[_0xe051('0xf')][_0x1fb3ca][_0xe051('0x2c')]||0x0;}}}}}}return _0x49dbb0[_0xe051('0xf')];};};Realtime[_0xe051('0x39')][_0xe051('0x5b')]=function(){var _0xde2115=this;return function(_0x30e1ca){clearVoiceCallReports(_0xde2115[_0xe051('0x12')]);if(_0x30e1ca){for(var _0x31770a=0x0;_0x31770a<_0x30e1ca[_0xe051('0x3c')];_0x31770a+=0x1){_0xde2115[_0xe051('0x12')][_0xe051('0x24')]+=0x1;_0xde2115[_0xe051('0x12')][_0xe051('0x26')]+=_0x30e1ca[_0x31770a][_0xe051('0x5c')];if(_0x30e1ca[_0x31770a][_0xe051('0x5d')]===_0xe051('0x5e')){_0xde2115['outbound'][_0xe051('0x25')]+=0x1;_0xde2115[_0xe051('0x12')][_0xe051('0x2c')]+=_0x30e1ca[_0x31770a]['duration']-_0x30e1ca[_0x31770a][_0xe051('0x5f')]||0x0;_0xde2115[_0xe051('0x12')][_0xe051('0x27')]+=_0x30e1ca[_0x31770a][_0xe051('0x5f')];}}}return _0xde2115['outbound'];};};Realtime[_0xe051('0x39')]['initCampaigns']=function(){var _0x557365=this;return function(_0x2bb2a3){if(_0x2bb2a3){freeIsNotKey(_0x2bb2a3,_0x557365['campaigns'],_0xe051('0x21'));for(var _0x11358f=0x0,_0x48c46d={};_0x11358f<_0x2bb2a3['length'];_0x11358f+=0x1){_0x48c46d=_0x2bb2a3[_0x11358f];if(_[_0xe051('0x3e')](_0x557365[_0xe051('0x60')][_0x48c46d[_0xe051('0x21')]])){_0x557365['campaigns'][_0x48c46d['name']]=new Campaign(_0x48c46d);}else{_0x557365[_0xe051('0x38')](_0x557365[_0xe051('0x60')][_0x48c46d['name']],_0x48c46d);}}}return _0x557365[_0xe051('0x60')];};};Realtime[_0xe051('0x39')][_0xe051('0x61')]=function(){var _0x1b3c31=this;return function(_0x54a109){if(_0x54a109){freeIsNotKey(_0x54a109,_0x1b3c31['voiceExtensions'],'id');for(var _0x2517c3=0x0,_0x19e38d={};_0x2517c3<_0x54a109[_0xe051('0x3c')];_0x2517c3+=0x1){_0x19e38d=_0x54a109[_0x2517c3];if(_[_0xe051('0x3e')](_0x1b3c31[_0xe051('0x13')][_0x19e38d['id']])){_0x1b3c31[_0xe051('0x13')][_0x19e38d['id']]=new VoiceExtension(_0x19e38d);}else{_0x1b3c31['mergeFromDatabase'](_0x1b3c31[_0xe051('0x13')][_0x19e38d['id']],_0x19e38d);}}}return _0x1b3c31['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x2da871=this;return function(_0x3c91c6){clearCampaigns(_0x2da871[_0xe051('0x60')]);for(var _0x518de9=0x0;_0x518de9<_0x3c91c6[_0xe051('0x3c')];_0x518de9+=0x1){_[_0xe051('0x4f')](_0x2da871[_0xe051('0x60')][_0x3c91c6[_0x518de9][_0xe051('0x21')]],_0x3c91c6[_0x518de9]);}return _0x2da871['campaigns'];};};Realtime[_0xe051('0x39')][_0xe051('0x62')]=function(){var _0x785ced=this;return function(_0x45e99f){if(_0x45e99f){freeIsNotKey(_0x45e99f,_0x785ced[_0xe051('0x1d')],'id');for(var _0x3a5bc5=0x0,_0x4f13d6={},_0x41b17d={};_0x3a5bc5<_0x45e99f[_0xe051('0x3c')];_0x3a5bc5+=0x1){_0x4f13d6=_0x45e99f[_0x3a5bc5];if(_[_0xe051('0x3e')](_0x785ced[_0xe051('0x1d')][_0x4f13d6['id']])){_0x785ced[_0xe051('0x1d')][_0x4f13d6['id']]=new FaxAccount(_0x4f13d6);}else{_0x785ced[_0xe051('0x38')](_0x785ced[_0xe051('0x1d')][_0x4f13d6['id']],_0x4f13d6);}}}return _0x785ced[_0xe051('0x1d')];};};module[_0xe051('0x63')]=Realtime; \ No newline at end of file +var _0x2dc4=['billableseconds','initCampaigns','campaigns','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','mapKeys','format','name','hasOwnProperty','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','sumBillable','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','length','initTelephones','isUndefined','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','deskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','disposition','ANSWERED','outbound','duration'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x2dc4,0x1b7));var _0x42dc=function(_0x2b7eb4,_0x1a6b4d){_0x2b7eb4=_0x2b7eb4-0x0;var _0x39ddf6=_0x2dc4[_0x2b7eb4];return _0x39ddf6;};'use strict';var BPromise=require(_0x42dc('0x0'));var util=require(_0x42dc('0x1'));var _=require(_0x42dc('0x2'));var moment=require(_0x42dc('0x3'));var Agent=require('../model/agent');var Telephone=require(_0x42dc('0x4'));var Trunk=require(_0x42dc('0x5'));var VoiceQueue=require(_0x42dc('0x6'));var Trigger=require(_0x42dc('0x7'));var Template=require(_0x42dc('0x8'));var Campaign=require(_0x42dc('0x9'));var VoiceExtension=require(_0x42dc('0xa'));var ZendeskAccount=require(_0x42dc('0xb'));var SalesforceAccount=require(_0x42dc('0xc'));var FreshdeskAccount=require(_0x42dc('0xd'));var SugarcrmAccount=require(_0x42dc('0xe'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x42dc('0xf'));var VtigerAccount=require(_0x42dc('0x10'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x42dc('0x11'));var FaxAccount=require(_0x42dc('0x12'));var Realtime=function(){this[_0x42dc('0x13')]={};this[_0x42dc('0x14')]={};this[_0x42dc('0x15')]={};this[_0x42dc('0x16')]={};this[_0x42dc('0x17')]={};this['campaigns']={};this[_0x42dc('0x18')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x42dc('0x19')]={};this[_0x42dc('0x1a')]={};this[_0x42dc('0x1b')]={};this[_0x42dc('0x1c')]={};this[_0x42dc('0x1d')]={};this[_0x42dc('0x1e')]={};this[_0x42dc('0x1f')]={};this[_0x42dc('0x20')]={};this['freshdeskAccounts']={};this[_0x42dc('0x21')]={};this['deskAccounts']={};this[_0x42dc('0x22')]={};this[_0x42dc('0x23')]={};this['dynamics365Accounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x1195e8,_0x28f393,_0x473eef){var _0x4af3ea=_[_0x42dc('0x24')](_0x1195e8,function(_0x6e3c8e,_0x5720f9){return _0x6e3c8e[_0x473eef];});for(var _0x26df5c in _0x28f393){if(_0x28f393['hasOwnProperty'](_0x26df5c)){if(!_0x4af3ea[_0x26df5c]){delete _0x28f393[_0x26df5c];}}}}function freeIsNotKeySip(_0x42930e,_0x1a7bd2){var _0x1424f7=_[_0x42dc('0x24')](_0x42930e,function(_0x2a31cb,_0x596c70){return util[_0x42dc('0x25')]('SIP/%s',_0x2a31cb[_0x42dc('0x26')]);});for(var _0x16f800 in _0x1a7bd2){if(_0x1a7bd2[_0x42dc('0x27')](_0x16f800)){if(!_0x1424f7[_0x16f800]){delete _0x1a7bd2[_0x16f800];}}}}function freeIsNotKeyAgent(_0x32f88d,_0x43e648){var _0x24e7e3=_['mapKeys'](_0x32f88d,function(_0x27a199,_0x37222d){var _0x149d19=_[_0x42dc('0x28')](_0x27a199[_0x42dc('0x29')])?util[_0x42dc('0x25')](_0x42dc('0x2a'),_0x27a199[_0x42dc('0x26')]):_0x27a199[_0x42dc('0x29')];return _0x149d19;});for(var _0x1bc5d0 in _0x43e648){if(_0x43e648['hasOwnProperty'](_0x1bc5d0)){if(!_0x24e7e3[_0x1bc5d0]){delete _0x43e648[_0x1bc5d0];}}}}function clearVoiceCallReports(_0x10ddeb){_0x10ddeb[_0x42dc('0x2b')]=0x0;_0x10ddeb[_0x42dc('0x2c')]=0x0;_0x10ddeb[_0x42dc('0x2d')]=0x0;_0x10ddeb[_0x42dc('0x2e')]=0x0;_0x10ddeb['sumBillable']=0x0;}function clearCampaigns(_0x2b4280){if(!_['isEmpty'](_0x2b4280)){for(var _0x1c58d7 in _0x2b4280){if(_0x2b4280[_0x42dc('0x27')](_0x1c58d7)){_0x2b4280[_0x1c58d7][_0x42dc('0x2f')]=0x0;_0x2b4280[_0x1c58d7][_0x42dc('0x30')]=0x0;}}}}function clearVoiceQueues(_0x22e1c7){if(!_[_0x42dc('0x31')](_0x22e1c7)){for(var _0xdbb45 in _0x22e1c7){if(_0x22e1c7['hasOwnProperty'](_0xdbb45)){_0x22e1c7[_0xdbb45][_0x42dc('0x2b')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x2c')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x32')]=0x0;_0x22e1c7[_0xdbb45]['abandoned']=0x0;_0x22e1c7[_0xdbb45]['sumHoldTime']=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x2e')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x33')]=0x0;_0x22e1c7[_0xdbb45]['outboundAnswerAgiCallsDay']=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x34')]=0x0;_0x22e1c7[_0xdbb45]['outboundBusyCallsDay']=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x35')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x36')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x37')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x38')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x39')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x3a')]=0x0;_0x22e1c7[_0xdbb45]['outboundOriginateFailureCallsDay']=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x3b')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x3c')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x3d')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x3e')]=0x0;_0x22e1c7[_0xdbb45][_0x42dc('0x3f')]=!![];}}}}Realtime['prototype'][_0x42dc('0x40')]=function(_0x584af9,_0x4e2d50){for(var _0x4fd24c in _0x4e2d50){if(_0x584af9['hasOwnProperty'](_0x4fd24c)){_0x584af9[_0x4fd24c]=_0x4e2d50[_0x4fd24c];}}};Realtime[_0x42dc('0x41')]['initAgents']=function(){var _0x17be9c=this;return function(_0x3001b6){if(_0x3001b6){freeIsNotKeyAgent(_0x3001b6,_0x17be9c[_0x42dc('0x13')]);for(var _0x1c5e10=0x0,_0x81c197={},_0x462e18={};_0x1c5e10<_0x3001b6[_0x42dc('0x42')];_0x1c5e10+=0x1){_0x81c197=_0x3001b6[_0x1c5e10];var _0x554e35=_[_0x42dc('0x28')](_0x81c197[_0x42dc('0x29')])?util['format'](_0x42dc('0x2a'),_0x81c197['name']):_0x81c197[_0x42dc('0x29')];if(_['isUndefined'](_0x17be9c[_0x42dc('0x13')][_0x554e35])){_0x17be9c[_0x42dc('0x13')][_0x554e35]=new Agent(_0x81c197);}else{_0x17be9c[_0x42dc('0x40')](_0x17be9c[_0x42dc('0x13')][_0x554e35],_0x81c197);}}}return _0x17be9c[_0x42dc('0x13')];};};Realtime['prototype'][_0x42dc('0x43')]=function(){var _0x5a7860=this;return function(_0x38eb97){if(_0x38eb97){freeIsNotKeySip(_0x38eb97,_0x5a7860[_0x42dc('0x14')]);for(var _0x1e3212=0x0,_0x17c29e={},_0x298ee3={};_0x1e3212<_0x38eb97[_0x42dc('0x42')];_0x1e3212+=0x1){_0x17c29e=_0x38eb97[_0x1e3212];if(_[_0x42dc('0x44')](_0x5a7860[_0x42dc('0x14')][util[_0x42dc('0x25')](_0x42dc('0x2a'),_0x17c29e['name'])])){_0x5a7860[_0x42dc('0x14')][util[_0x42dc('0x25')]('SIP/%s',_0x17c29e[_0x42dc('0x26')])]=new Telephone(_0x17c29e);}else{_0x5a7860[_0x42dc('0x40')](_0x5a7860['telephones'][util[_0x42dc('0x25')](_0x42dc('0x2a'),_0x17c29e['name'])],_0x17c29e);}}}return _0x5a7860[_0x42dc('0x14')];};};Realtime[_0x42dc('0x41')]['initTrunks']=function(){var _0x4720fa=this;return function(_0x4208e4){if(_0x4208e4){freeIsNotKeySip(_0x4208e4,_0x4720fa['trunks']);for(var _0x3f35e9=0x0,_0x1c112c={},_0x3d7f32={};_0x3f35e9<_0x4208e4['length'];_0x3f35e9+=0x1){_0x1c112c=_0x4208e4[_0x3f35e9];if(_[_0x42dc('0x44')](_0x4720fa[_0x42dc('0x15')][util[_0x42dc('0x25')](_0x42dc('0x2a'),_0x1c112c[_0x42dc('0x26')])])){_0x4720fa['trunks'][util[_0x42dc('0x25')](_0x42dc('0x2a'),_0x1c112c[_0x42dc('0x26')])]=new Trunk(_0x1c112c);}else{_0x4720fa[_0x42dc('0x40')](_0x4720fa[_0x42dc('0x15')][util[_0x42dc('0x25')](_0x42dc('0x2a'),_0x1c112c[_0x42dc('0x26')])],_0x1c112c);}}}return _0x4720fa[_0x42dc('0x15')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x45')]=function(){var _0x376bdd=this;return function(_0x1ec197){if(_0x1ec197){freeIsNotKey(_0x1ec197,_0x376bdd[_0x42dc('0x16')],_0x42dc('0x26'));for(var _0x37daa2=0x0,_0x30a60e={},_0x4509fe={};_0x37daa2<_0x1ec197[_0x42dc('0x42')];_0x37daa2+=0x1){_0x30a60e=_0x1ec197[_0x37daa2];if(_[_0x42dc('0x44')](_0x376bdd[_0x42dc('0x16')][_0x30a60e['name']])){_0x376bdd['voiceQueues'][_0x30a60e['name']]=new VoiceQueue(_0x30a60e);}else{_0x376bdd[_0x42dc('0x40')](_0x376bdd[_0x42dc('0x16')][_0x30a60e['name']],_0x30a60e);}}}return _0x376bdd[_0x42dc('0x16')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x46')]=function(){var _0x4f0cca=this;return function(_0x411faf){if(_0x411faf){freeIsNotKey(_0x411faf,_0x4f0cca['triggers'],'id');for(var _0x3b1848=0x0,_0x3c640a={},_0x27d3e2={};_0x3b1848<_0x411faf[_0x42dc('0x42')];_0x3b1848+=0x1){_0x3c640a=_0x411faf[_0x3b1848];if(_[_0x42dc('0x44')](_0x4f0cca[_0x42dc('0x17')][_0x3c640a['id']])){_0x4f0cca[_0x42dc('0x17')][_0x3c640a['id']]=new Trigger(_0x3c640a);}else{_0x4f0cca[_0x42dc('0x40')](_0x4f0cca['triggers'][_0x3c640a['id']],_0x3c640a);}}}return _0x4f0cca[_0x42dc('0x17')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x47')]=function(){var _0xaa2039=this;return function(_0x4221b7){if(_0x4221b7){freeIsNotKey(_0x4221b7,_0xaa2039[_0x42dc('0x18')],'id');for(var _0x37af75=0x0,_0x59890f={},_0xc42c83={};_0x37af75<_0x4221b7[_0x42dc('0x42')];_0x37af75+=0x1){_0x59890f=_0x4221b7[_0x37af75];if(_[_0x42dc('0x44')](_0xaa2039[_0x42dc('0x18')][_0x59890f['id']])){_0xaa2039[_0x42dc('0x18')][_0x59890f['id']]=new Template(_0x59890f);}else{_0xaa2039['mergeFromDatabase'](_0xaa2039['templates'][_0x59890f['id']],_0x59890f);}}}return _0xaa2039['templates'];};};Realtime[_0x42dc('0x41')]['initZendeskAccounts']=function(){var _0x4d194c=this;return function(_0x27f5c4){if(_0x27f5c4){freeIsNotKey(_0x27f5c4,_0x4d194c[_0x42dc('0x1e')],'id');for(var _0x36ae07=0x0,_0x37b2f3={},_0x2fde38={};_0x36ae07<_0x27f5c4['length'];_0x36ae07+=0x1){_0x37b2f3=_0x27f5c4[_0x36ae07];if(_[_0x42dc('0x44')](_0x4d194c[_0x42dc('0x1e')][_0x37b2f3['id']])){_0x4d194c[_0x42dc('0x1e')][_0x37b2f3['id']]=new ZendeskAccount(_0x37b2f3);}else{_0x4d194c['mergeFromDatabase'](_0x4d194c[_0x42dc('0x1e')][_0x37b2f3['id']],_0x37b2f3);}}}return _0x4d194c[_0x42dc('0x1e')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x48')]=function(){var _0x251646=this;return function(_0x1f4dce){if(_0x1f4dce){freeIsNotKey(_0x1f4dce,_0x251646[_0x42dc('0x1f')],'id');for(var _0x8410a8=0x0,_0x6c622d={},_0x4affa3={};_0x8410a8<_0x1f4dce[_0x42dc('0x42')];_0x8410a8+=0x1){_0x6c622d=_0x1f4dce[_0x8410a8];if(_[_0x42dc('0x44')](_0x251646[_0x42dc('0x1f')][_0x6c622d['id']])){_0x251646[_0x42dc('0x1f')][_0x6c622d['id']]=new SalesforceAccount(_0x6c622d);}else{_0x251646['mergeFromDatabase'](_0x251646[_0x42dc('0x1f')][_0x6c622d['id']],_0x6c622d);}}}return _0x251646[_0x42dc('0x1f')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x49')]=function(){var _0x43ba41=this;return function(_0x372bdf){if(_0x372bdf){freeIsNotKey(_0x372bdf,_0x43ba41['freshdeskAccounts'],'id');for(var _0x326813=0x0,_0x1f675d={},_0x254675={};_0x326813<_0x372bdf[_0x42dc('0x42')];_0x326813+=0x1){_0x1f675d=_0x372bdf[_0x326813];if(_[_0x42dc('0x44')](_0x43ba41[_0x42dc('0x4a')][_0x1f675d['id']])){_0x43ba41['freshdeskAccounts'][_0x1f675d['id']]=new FreshdeskAccount(_0x1f675d);}else{_0x43ba41[_0x42dc('0x40')](_0x43ba41[_0x42dc('0x4a')][_0x1f675d['id']],_0x1f675d);}}}return _0x43ba41[_0x42dc('0x4a')];};};Realtime['prototype'][_0x42dc('0x4b')]=function(){var _0x3f31d4=this;return function(_0x48a944){if(_0x48a944){freeIsNotKey(_0x48a944,_0x3f31d4[_0x42dc('0x21')],'id');for(var _0x423092=0x0,_0x430c29={},_0x3eac57={};_0x423092<_0x48a944['length'];_0x423092+=0x1){_0x430c29=_0x48a944[_0x423092];if(_[_0x42dc('0x44')](_0x3f31d4[_0x42dc('0x21')][_0x430c29['id']])){_0x3f31d4['zohoAccounts'][_0x430c29['id']]=new ZohoAccount(_0x430c29);}else{_0x3f31d4[_0x42dc('0x40')](_0x3f31d4[_0x42dc('0x21')][_0x430c29['id']],_0x430c29);}}}return _0x3f31d4[_0x42dc('0x21')];};};Realtime[_0x42dc('0x41')]['initDeskAccounts']=function(){var _0x2f6e8c=this;return function(_0x531d86){if(_0x531d86){freeIsNotKey(_0x531d86,_0x2f6e8c[_0x42dc('0x4c')],'id');for(var _0x31df12=0x0,_0x439908={},_0x6aa69c={};_0x31df12<_0x531d86['length'];_0x31df12+=0x1){_0x439908=_0x531d86[_0x31df12];if(_[_0x42dc('0x44')](_0x2f6e8c[_0x42dc('0x4c')][_0x439908['id']])){_0x2f6e8c[_0x42dc('0x4c')][_0x439908['id']]=new DeskAccount(_0x439908);}else{_0x2f6e8c['mergeFromDatabase'](_0x2f6e8c[_0x42dc('0x4c')][_0x439908['id']],_0x439908);}}}return _0x2f6e8c[_0x42dc('0x4c')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x4d')]=function(){var _0x184dad=this;return function(_0x19f90f){if(_0x19f90f){freeIsNotKey(_0x19f90f,_0x184dad['sugarcrmAccounts'],'id');for(var _0x315c09=0x0,_0x345a8b={},_0x346a1a={};_0x315c09<_0x19f90f[_0x42dc('0x42')];_0x315c09+=0x1){_0x345a8b=_0x19f90f[_0x315c09];if(_[_0x42dc('0x44')](_0x184dad[_0x42dc('0x20')][_0x345a8b['id']])){_0x184dad[_0x42dc('0x20')][_0x345a8b['id']]=new SugarcrmAccount(_0x345a8b);}else{_0x184dad['mergeFromDatabase'](_0x184dad[_0x42dc('0x20')][_0x345a8b['id']],_0x345a8b);}}}return _0x184dad[_0x42dc('0x20')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x312815=this;return function(_0x1766d2){if(_0x1766d2){freeIsNotKey(_0x1766d2,_0x312815[_0x42dc('0x22')],'id');for(var _0x3e5eaa=0x0,_0x17b992={},_0x2564c3={};_0x3e5eaa<_0x1766d2[_0x42dc('0x42')];_0x3e5eaa+=0x1){_0x17b992=_0x1766d2[_0x3e5eaa];if(_[_0x42dc('0x44')](_0x312815[_0x42dc('0x22')][_0x17b992['id']])){_0x312815[_0x42dc('0x22')][_0x17b992['id']]=new VtigerAccount(_0x17b992);}else{_0x312815['mergeFromDatabase'](_0x312815[_0x42dc('0x22')][_0x17b992['id']],_0x17b992);}}}return _0x312815[_0x42dc('0x22')];};};Realtime['prototype'][_0x42dc('0x4e')]=function(){var _0x58ed29=this;return function(_0x565917){if(_0x565917){freeIsNotKey(_0x565917,_0x58ed29[_0x42dc('0x23')],'id');for(var _0x465c95=0x0,_0x3b136d={},_0x548b08={};_0x465c95<_0x565917[_0x42dc('0x42')];_0x465c95+=0x1){_0x3b136d=_0x565917[_0x465c95];if(_[_0x42dc('0x44')](_0x58ed29[_0x42dc('0x23')][_0x3b136d['id']])){_0x58ed29[_0x42dc('0x23')][_0x3b136d['id']]=new ServicenowAccount(_0x3b136d);}else{_0x58ed29[_0x42dc('0x40')](_0x58ed29[_0x42dc('0x23')][_0x3b136d['id']],_0x3b136d);}}}return _0x58ed29[_0x42dc('0x23')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x4f')]=function(){var _0x10b97e=this;return function(_0x389454){if(_0x389454){freeIsNotKey(_0x389454,_0x10b97e[_0x42dc('0x50')],'id');for(var _0xdfb14a=0x0,_0x354eb5={},_0x3c85f0={};_0xdfb14a<_0x389454[_0x42dc('0x42')];_0xdfb14a+=0x1){_0x354eb5=_0x389454[_0xdfb14a];if(_[_0x42dc('0x44')](_0x10b97e['dynamics365Accounts'][_0x354eb5['id']])){_0x10b97e[_0x42dc('0x50')][_0x354eb5['id']]=new Dynamics365Account(_0x354eb5);}else{_0x10b97e[_0x42dc('0x40')](_0x10b97e[_0x42dc('0x50')][_0x354eb5['id']],_0x354eb5);}}}return _0x10b97e['dynamics365Accounts'];};};Realtime[_0x42dc('0x41')]['initVoiceQueueHopperHistory']=function(){var _0x4945f8=this;return function(_0x5184a9){for(var _0xc04bd8=0x0;_0xc04bd8<_0x5184a9[_0x42dc('0x42')];_0xc04bd8+=0x1){_[_0x42dc('0x51')](_0x4945f8['voiceQueues'][_0x5184a9[_0xc04bd8][_0x42dc('0x26')]],_0x5184a9[_0xc04bd8]);}return _0x4945f8['voiceQueues'];};};Realtime[_0x42dc('0x41')][_0x42dc('0x52')]=function(){var _0x4c1fe9=this;return function(_0xfd60bc){clearVoiceQueues(_0x4c1fe9[_0x42dc('0x16')]);if(_0xfd60bc){_0xfd60bc=_[_0x42dc('0x53')](_0xfd60bc,_0x42dc('0x54'));for(var _0x59b912 in _0xfd60bc){if(_0xfd60bc[_0x42dc('0x27')](_0x59b912)){var _0x43ee99={};for(var _0x2210ab=0x0;_0x2210ab<_0xfd60bc[_0x59b912][_0x42dc('0x42')];_0x2210ab+=0x1){var _0x3b4b7b=_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x55')];if(_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b]){if(_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x56')]){_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b][_0x42dc('0x32')]+=0x1;}if(_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x57')]){_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b][_0x42dc('0x58')]+=0x1;}_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b][_0x42dc('0x2d')]+=moment(_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x59')])[_0x42dc('0x5a')](moment(_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x5b')]),_0x42dc('0x5c'))||0x0;if(_0x2210ab===_0xfd60bc[_0x59b912][_0x42dc('0x42')]-0x1){_0x4c1fe9['voiceQueues'][_0x3b4b7b]['sumDuration']+=moment(_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x5d')]||_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x5e')]||_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x5f')])[_0x42dc('0x5a')](moment(_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x5b')]),'seconds')||0x0;_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b][_0x42dc('0x2b')]+=0x1;if(_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x60')]){_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b]['answered']+=0x1;_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b][_0x42dc('0x33')]+=moment(_0xfd60bc[_0x59b912][_0x2210ab]['queuecallercompleteAt'])[_0x42dc('0x5a')](moment(_0xfd60bc[_0x59b912][_0x2210ab][_0x42dc('0x59')]),'seconds')||0x0;}}else{_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b][_0x42dc('0x2e')]+=_0x4c1fe9[_0x42dc('0x16')][_0x3b4b7b][_0x42dc('0x2d')]||0x0;}}}}}}return _0x4c1fe9[_0x42dc('0x16')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x40b4d9=this;return function(_0x35aed4){clearVoiceCallReports(_0x40b4d9['outbound']);if(_0x35aed4){for(var _0x5e1d6e=0x0;_0x5e1d6e<_0x35aed4[_0x42dc('0x42')];_0x5e1d6e+=0x1){_0x40b4d9['outbound'][_0x42dc('0x2b')]+=0x1;_0x40b4d9['outbound'][_0x42dc('0x2e')]+=_0x35aed4[_0x5e1d6e]['duration'];if(_0x35aed4[_0x5e1d6e][_0x42dc('0x61')]===_0x42dc('0x62')){_0x40b4d9[_0x42dc('0x63')]['answered']+=0x1;_0x40b4d9['outbound']['sumHoldTime']+=_0x35aed4[_0x5e1d6e][_0x42dc('0x64')]-_0x35aed4[_0x5e1d6e][_0x42dc('0x65')]||0x0;_0x40b4d9['outbound']['sumBillable']+=_0x35aed4[_0x5e1d6e][_0x42dc('0x65')];}}}return _0x40b4d9[_0x42dc('0x63')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x66')]=function(){var _0x3749c2=this;return function(_0x19e0ea){if(_0x19e0ea){freeIsNotKey(_0x19e0ea,_0x3749c2[_0x42dc('0x67')],_0x42dc('0x26'));for(var _0x211bc8=0x0,_0x52d039={};_0x211bc8<_0x19e0ea[_0x42dc('0x42')];_0x211bc8+=0x1){_0x52d039=_0x19e0ea[_0x211bc8];if(_[_0x42dc('0x44')](_0x3749c2[_0x42dc('0x67')][_0x52d039[_0x42dc('0x26')]])){_0x3749c2[_0x42dc('0x67')][_0x52d039[_0x42dc('0x26')]]=new Campaign(_0x52d039);}else{_0x3749c2['mergeFromDatabase'](_0x3749c2[_0x42dc('0x67')][_0x52d039[_0x42dc('0x26')]],_0x52d039);}}}return _0x3749c2[_0x42dc('0x67')];};};Realtime[_0x42dc('0x41')]['initVoiceExtensions']=function(){var _0xb19f4a=this;return function(_0x41d046){if(_0x41d046){freeIsNotKey(_0x41d046,_0xb19f4a['voiceExtensions'],'id');for(var _0x769e68=0x0,_0x1670ff={};_0x769e68<_0x41d046['length'];_0x769e68+=0x1){_0x1670ff=_0x41d046[_0x769e68];if(_['isUndefined'](_0xb19f4a['voiceExtensions'][_0x1670ff['id']])){_0xb19f4a[_0x42dc('0x19')][_0x1670ff['id']]=new VoiceExtension(_0x1670ff);}else{_0xb19f4a['mergeFromDatabase'](_0xb19f4a[_0x42dc('0x19')][_0x1670ff['id']],_0x1670ff);}}}return _0xb19f4a['voiceExtensions'];};};Realtime[_0x42dc('0x41')][_0x42dc('0x68')]=function(){var _0x425a0d=this;return function(_0x907d1){clearCampaigns(_0x425a0d[_0x42dc('0x67')]);for(var _0x17ebc5=0x0;_0x17ebc5<_0x907d1['length'];_0x17ebc5+=0x1){_[_0x42dc('0x51')](_0x425a0d[_0x42dc('0x67')][_0x907d1[_0x17ebc5][_0x42dc('0x26')]],_0x907d1[_0x17ebc5]);}return _0x425a0d[_0x42dc('0x67')];};};Realtime[_0x42dc('0x41')][_0x42dc('0x69')]=function(){var _0x4df005=this;return function(_0x9413c6){if(_0x9413c6){freeIsNotKey(_0x9413c6,_0x4df005['faxAccounts'],'id');for(var _0x230f48=0x0,_0x41630f={},_0x346b79={};_0x230f48<_0x9413c6[_0x42dc('0x42')];_0x230f48+=0x1){_0x41630f=_0x9413c6[_0x230f48];if(_[_0x42dc('0x44')](_0x4df005[_0x42dc('0x6a')][_0x41630f['id']])){_0x4df005[_0x42dc('0x6a')][_0x41630f['id']]=new FaxAccount(_0x41630f);}else{_0x4df005[_0x42dc('0x40')](_0x4df005[_0x42dc('0x6a')][_0x41630f['id']],_0x41630f);}}}return _0x4df005[_0x42dc('0x6a')];};};module[_0x42dc('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 35926fd..1968e56 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 _0x212c=['prototype','sync','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','SIP/%s','voiceQueueReport','length','accountcode','lastAssignedTo','interface','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','originatecalleridnum','disposition','connectedlinenum','\x22%s\x22\x20<%s>','monitor','monitorFilename','monitors','filename','createdAt','calleridname','connectedlinename','exten','xcally-motion-dialer','isArray','startsWith','indexOf','substring','lastIndexOf','membername','blindTransfer','exports','lodash','moment','util','../../../config/logger','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x212c,0xe6));var _0xc212=function(_0x15a829,_0x1a524b){_0x15a829=_0x15a829-0x0;var _0x10b241=_0x212c[_0x15a829];return _0x10b241;};'use strict';var BPromise=require('bluebird');var _=require(_0xc212('0x0'));var moment=require(_0xc212('0x1'));var util=require(_0xc212('0x2'));var config=require('../../../config/environment');var logger=require(_0xc212('0x3'))('ami');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xc212('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc212('0x5'));var RpcMemberReport=require(_0xc212('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xc212('0x7'));var RpcVoiceTransferReport=require(_0xc212('0x8'));var VoiceQueueReport=require(_0xc212('0x9'));var VoiceCallReport=require(_0xc212('0xa'));var VoiceAgentReport=require(_0xc212('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xc212('0xc'));function Report(_0x4f5e9a){this[_0xc212('0xd')]=_0x4f5e9a;this['agents']=_0x4f5e9a[_0xc212('0xe')];this['telephones']=_0x4f5e9a[_0xc212('0xf')];}Report[_0xc212('0x10')][_0xc212('0x11')]=function(_0x4e0b88){var _0x91a11a=new VoiceQueueReport(this[_0xc212('0xd')]);var _0x4f6ebf=new VoiceAgentReport(this['realtime']);var _0x1fbd3a=new VoiceDialReport(this[_0xc212('0xd')]);var _0x5ded85=new VoiceCallReport(this[_0xc212('0xd')]);var _0x5afe22=new UserReport(this[_0xc212('0xd')]);if(config['xdr']&&config['xdr']['disabled']){ami['on'](_0xc212('0x12'),this['voiceQueueReport']['bind'](this));ami['on'](_0xc212('0x13'),this[_0xc212('0x14')][_0xc212('0x15')](this));ami['on'](_0xc212('0x16'),this[_0xc212('0x17')][_0xc212('0x15')](this));ami['on'](_0xc212('0x18'),this[_0xc212('0x19')][_0xc212('0x15')](this));ami['on'](_0xc212('0x1a'),this['blindTransfer'][_0xc212('0x15')](this));ami['on'](_0xc212('0x1b'),this[_0xc212('0x1c')][_0xc212('0x15')](this));}};Report[_0xc212('0x10')][_0xc212('0x1d')]=function(_0x4c3b7b){var _0x1e117a=undefined;_0x1e117a=_[_0xc212('0x1e')](this['agents'],function(_0x3fce4e){return _0x3fce4e['accountcode']==_0x4c3b7b||_0x3fce4e[_0xc212('0x1f')]==_0x4c3b7b;});if(_[_0xc212('0x20')](_0x1e117a)){var _0x54d76f=_['find'](this[_0xc212('0xf')],function(_0x244c7d){return _0x244c7d['accountcode']==_0x4c3b7b||_0x244c7d[_0xc212('0x1f')]==_0x4c3b7b;});if(_0x54d76f){_0x1e117a=_[_0xc212('0x1e')](this[_0xc212('0xe')],function(_0x270a79){return _0x270a79['interface']==util['format'](_0xc212('0x21'),_0x54d76f[_0xc212('0x1f')]);});}}return _0x1e117a;};Report[_0xc212('0x10')][_0xc212('0x22')]=function(_0x15d924){for(var _0x9729cc=0x0;_0x9729cc<_0x15d924[_0xc212('0x23')];_0x9729cc+=0x1){var _0x572c4e=this[_0xc212('0x1d')](_0x15d924[_0x9729cc]['connectedlinenum']);if(_0x572c4e){_0x15d924[_0x9729cc][_0xc212('0x24')]=_0x572c4e['accountcode'];_0x15d924[_0x9729cc]['assigned']=!![];_0x15d924[_0x9729cc][_0xc212('0x25')]=_0x572c4e['name'];_0x15d924[_0x9729cc][_0xc212('0x26')]=_[_0xc212('0x20')](_0x572c4e['interface'])?util[_0xc212('0x27')](_0xc212('0x21'),_0x572c4e[_0xc212('0x1f')]):_0x572c4e[_0xc212('0x26')];if(_0x15d924[_0x9729cc][_0xc212('0x28')]){_0x15d924[_0x9729cc][_0xc212('0x29')]=moment()[_0xc212('0x27')](_0xc212('0x2a'));}if(_0x15d924[_0x9729cc][_0xc212('0x2b')]){_0x15d924[_0x9729cc][_0xc212('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc212('0x22')](_0x15d924[_0x9729cc]);}RpcVoiceQueueReport[_0xc212('0x2d')](_0x15d924[_0x9729cc]);}};function extractCalleridNumber(_0x236cb3){var _0x4a19d5=_0x236cb3['match'](/<(.*?)>/);return _0x4a19d5?_0x4a19d5[0x1]:_0x236cb3;}Report['prototype']['voiceCallReport']=function(_0x297958){_0x297958['destination']=_0x297958[_0xc212('0x2e')]||_0x297958['exten'];if(_0x297958[_0xc212('0x2f')]==_0xc212('0x30')){_0x297958[_0xc212('0x31')]=_0xc212('0x32');_0x297958[_0xc212('0x33')]=_0x297958[_0xc212('0x32')];if(_0x297958[_0xc212('0x34')]==_0xc212('0x35')){_0x297958[_0xc212('0x24')]='';_0x297958[_0xc212('0x2e')]=extractCalleridNumber(_0x297958[_0xc212('0x36')]);}else if(_0x297958[_0xc212('0x34')]==_0xc212('0x37')){if(_0x297958[_0xc212('0x2e')]==_0xc212('0x38')){_0x297958[_0xc212('0x2e')]=extractCalleridNumber(_0x297958[_0xc212('0x39')]);_0x297958[_0xc212('0x3a')]=_0x297958['originatecalleridnum'];_0x297958[_0xc212('0x3b')]=[_0x297958['channel'],_0x297958[_0xc212('0x3c')]=_0x297958[_0xc212('0x3b')]][0x0];_0x297958[_0xc212('0x36')]=_0x297958[_0xc212('0x39')];}else{_0x297958['destination']=_0x297958[_0xc212('0x3a')];_0x297958['calleridnum']=_0x297958[_0xc212('0x3d')];if(_0x297958[_0xc212('0x3e')]=='ANSWERED'){_0x297958[_0xc212('0x24')]=_0x297958[_0xc212('0x3f')];}else{_0x297958[_0xc212('0x24')]='';}}}}else{_0x297958[_0xc212('0x36')]=util['format'](_0xc212('0x40'),_0x297958['calleridname'],_0x297958[_0xc212('0x3a')]);}RpcVoiceCallReport[_0xc212('0x2d')](_0x297958);if(_0x297958[_0xc212('0x41')]){for(var _0x24251f=0x0;_0x24251f<_0x297958['monitors']['length'];_0x24251f+=0x1){_0x297958[_0xc212('0x42')]=_0x297958[_0xc212('0x43')][_0x24251f][_0xc212('0x44')];_0x297958[_0xc212('0x45')]=_0x297958[_0xc212('0x43')][_0x24251f][_0xc212('0x45')];if(_0x297958['exten']==_0xc212('0x38')){_0x297958[_0xc212('0x3a')]=_0x297958['connectedlinenum'];_0x297958[_0xc212('0x46')]=_0x297958[_0xc212('0x47')];_0x297958[_0xc212('0x3f')]=_0x297958[_0xc212('0x24')];_0x297958[_0xc212('0x47')]=_0x297958['membername'];_0x297958['exten']=_0x297958['originatecalleridnum'];}else if(_0x297958[_0xc212('0x48')]==_0xc212('0x49')){_0x297958[_0xc212('0x3a')]=_0x297958[_0xc212('0x2e')];_0x297958[_0xc212('0x48')]=_0x297958['originatecalleridnum'];}RpcVoiceRecording['create'](_0x297958);}}};Report[_0xc212('0x10')]['voiceAgentReport']=function(_0x2430e9){if(_[_0xc212('0x4a')](_0x2430e9)){_0x2430e9['forEach'](function(_0x5abaf3){RpcVoiceAgentReport[_0xc212('0x2d')](_0x5abaf3);});}else{RpcVoiceAgentReport[_0xc212('0x2d')](_0x2430e9);}};Report['prototype'][_0xc212('0x19')]=function(_0x209795){RpcVoiceDialReport['create'](_0x209795);var _0x2ec64f=undefined;var _0x4f2dd6=_0x209795[_0xc212('0x3c')];if(_[_0xc212('0x4b')](_0x4f2dd6,'Local')){var _0x50c186=_0x4f2dd6['substring'](_0x4f2dd6['indexOf']('/')+0x1,_0x4f2dd6[_0xc212('0x4c')]('@'));_0x2ec64f=_['find'](this[_0xc212('0xe')],function(_0x4b17e6){return _0x4b17e6['mobile']==_0x50c186||_0x4b17e6['phone']==_0x50c186||_0x4b17e6[_0xc212('0x24')]==_0x50c186;});}else{var _0x50c186=_0x4f2dd6[_0xc212('0x4d')](_0x4f2dd6[_0xc212('0x4c')]('/')+0x1,_0x4f2dd6[_0xc212('0x4e')]('-'));_0x2ec64f=this[_0xc212('0x1d')](_0x50c186);}if(_0x2ec64f){_0x209795[_0xc212('0x26')]=_['isNil'](_0x2ec64f[_0xc212('0x26')])?util[_0xc212('0x27')]('SIP/%s',_0x2ec64f[_0xc212('0x1f')]):_0x2ec64f[_0xc212('0x26')];_0x209795[_0xc212('0x4f')]=_0x2ec64f['name'];_0x209795[_0xc212('0x24')]=_0x2ec64f[_0xc212('0x24')];RpcMemberReport[_0xc212('0x19')](_0x209795);}};Report[_0xc212('0x10')]['blindTransfer']=function(_0x4ef72b){RpcVoiceTransferReport[_0xc212('0x50')](_0x4ef72b);};Report[_0xc212('0x10')][_0xc212('0x1c')]=function(_0x4ef91e){RpcVoiceTransferReport['attendedTransfer'](_0x4ef91e);};module[_0xc212('0x51')]=Report; \ No newline at end of file +var _0x979a=['blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','accountcode','name','isNil','find','interface','format','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','ANSWERED','callerid','\x22%s\x22\x20<%s>','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','sync','realtime','xdr','custom:voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport'];(function(_0x34d9a9,_0x1a7da1){var _0x31726c=function(_0x1f3fb7){while(--_0x1f3fb7){_0x34d9a9['push'](_0x34d9a9['shift']());}};_0x31726c(++_0x1a7da1);}(_0x979a,0x91));var _0xa979=function(_0x2a07c9,_0x185c10){_0x2a07c9=_0x2a07c9-0x0;var _0x4e5723=_0x979a[_0x2a07c9];return _0x4e5723;};'use strict';var BPromise=require(_0xa979('0x0'));var _=require(_0xa979('0x1'));var moment=require(_0xa979('0x2'));var util=require(_0xa979('0x3'));var config=require(_0xa979('0x4'));var logger=require(_0xa979('0x5'))(_0xa979('0x6'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xa979('0x7'));var RpcVoiceCallReport=require(_0xa979('0x8'));var RpcVoiceDialReport=require(_0xa979('0x9'));var RpcMemberReport=require(_0xa979('0xa'));var RpcVoiceQueueReport=require(_0xa979('0xb'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xa979('0xc'));var VoiceQueueReport=require(_0xa979('0xd'));var VoiceCallReport=require(_0xa979('0xe'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xa979('0xf'));function Report(_0x2f815c){this['realtime']=_0x2f815c;this[_0xa979('0x10')]=_0x2f815c[_0xa979('0x10')];this[_0xa979('0x11')]=_0x2f815c['telephones'];}Report['prototype'][_0xa979('0x12')]=function(_0x9c4725){var _0x4d0f41=new VoiceQueueReport(this[_0xa979('0x13')]);var _0x5045fd=new VoiceAgentReport(this['realtime']);var _0x11b6cb=new VoiceDialReport(this['realtime']);var _0x3204dc=new VoiceCallReport(this['realtime']);var _0x3a0ac3=new UserReport(this[_0xa979('0x13')]);if(config[_0xa979('0x14')]&&config[_0xa979('0x14')]['disabled']){ami['on'](_0xa979('0x15'),this['voiceQueueReport'][_0xa979('0x16')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0xa979('0x16')](this));ami['on'](_0xa979('0x17'),this[_0xa979('0x18')][_0xa979('0x16')](this));ami['on'](_0xa979('0x19'),this[_0xa979('0x1a')]['bind'](this));ami['on']('blindtransfer',this[_0xa979('0x1b')][_0xa979('0x16')](this));ami['on'](_0xa979('0x1c'),this[_0xa979('0x1d')][_0xa979('0x16')](this));}};Report[_0xa979('0x1e')][_0xa979('0x1f')]=function(_0x5d9b6b){var _0x371d9d=undefined;_0x371d9d=_['find'](this[_0xa979('0x10')],function(_0x550d90){return _0x550d90[_0xa979('0x20')]==_0x5d9b6b||_0x550d90[_0xa979('0x21')]==_0x5d9b6b;});if(_[_0xa979('0x22')](_0x371d9d)){var _0x227bea=_[_0xa979('0x23')](this[_0xa979('0x11')],function(_0x59a55a){return _0x59a55a[_0xa979('0x20')]==_0x5d9b6b||_0x59a55a[_0xa979('0x21')]==_0x5d9b6b;});if(_0x227bea){_0x371d9d=_['find'](this[_0xa979('0x10')],function(_0x1e5428){return _0x1e5428[_0xa979('0x24')]==util[_0xa979('0x25')]('SIP/%s',_0x227bea[_0xa979('0x21')]);});}}return _0x371d9d;};Report[_0xa979('0x1e')][_0xa979('0x26')]=function(_0x4cb585){for(var _0x209232=0x0;_0x209232<_0x4cb585[_0xa979('0x27')];_0x209232+=0x1){var _0x23b0f4=this[_0xa979('0x1f')](_0x4cb585[_0x209232][_0xa979('0x28')]);if(_0x23b0f4){_0x4cb585[_0x209232][_0xa979('0x20')]=_0x23b0f4[_0xa979('0x20')];_0x4cb585[_0x209232][_0xa979('0x29')]=!![];_0x4cb585[_0x209232][_0xa979('0x2a')]=_0x23b0f4['name'];_0x4cb585[_0x209232][_0xa979('0x24')]=_[_0xa979('0x22')](_0x23b0f4[_0xa979('0x24')])?util['format'](_0xa979('0x2b'),_0x23b0f4[_0xa979('0x21')]):_0x23b0f4['interface'];if(_0x4cb585[_0x209232]['queuecallercomplete']){_0x4cb585[_0x209232][_0xa979('0x2c')]=moment()[_0xa979('0x25')](_0xa979('0x2d'));}if(_0x4cb585[_0x209232][_0xa979('0x2e')]){_0x4cb585[_0x209232][_0xa979('0x2f')]=moment()[_0xa979('0x25')](_0xa979('0x2d'));}RpcMemberReport['voiceQueueReport'](_0x4cb585[_0x209232]);}RpcVoiceQueueReport[_0xa979('0x30')](_0x4cb585[_0x209232]);}};function extractCalleridNumber(_0x519dbc){var _0x3e2cf5=_0x519dbc[_0xa979('0x31')](/<(.*?)>/);return _0x3e2cf5?_0x3e2cf5[0x1]:_0x519dbc;}Report[_0xa979('0x1e')][_0xa979('0x32')]=function(_0x34e3d7){_0x34e3d7[_0xa979('0x33')]=_0x34e3d7[_0xa979('0x33')]||_0x34e3d7[_0xa979('0x34')];if(_0x34e3d7[_0xa979('0x35')]==_0xa979('0x36')){_0x34e3d7[_0xa979('0x37')]=_0xa979('0x38');_0x34e3d7[_0xa979('0x39')]=_0x34e3d7[_0xa979('0x38')];if(_0x34e3d7[_0xa979('0x3a')]==_0xa979('0x3b')){_0x34e3d7[_0xa979('0x20')]='';_0x34e3d7[_0xa979('0x33')]=extractCalleridNumber(_0x34e3d7['callerid']);}else if(_0x34e3d7[_0xa979('0x3a')]==_0xa979('0x3c')){if(_0x34e3d7[_0xa979('0x33')]==_0xa979('0x3d')){_0x34e3d7[_0xa979('0x33')]=extractCalleridNumber(_0x34e3d7[_0xa979('0x3e')]);_0x34e3d7['calleridnum']=_0x34e3d7[_0xa979('0x3f')];_0x34e3d7[_0xa979('0x40')]=[_0x34e3d7[_0xa979('0x41')],_0x34e3d7['channel']=_0x34e3d7[_0xa979('0x40')]][0x0];_0x34e3d7['callerid']=_0x34e3d7['calleridpreview'];}else{_0x34e3d7[_0xa979('0x33')]=_0x34e3d7[_0xa979('0x42')];_0x34e3d7[_0xa979('0x42')]=_0x34e3d7[_0xa979('0x3f')];if(_0x34e3d7['disposition']==_0xa979('0x43')){_0x34e3d7[_0xa979('0x20')]=_0x34e3d7[_0xa979('0x28')];}else{_0x34e3d7[_0xa979('0x20')]='';}}}}else{_0x34e3d7[_0xa979('0x44')]=util[_0xa979('0x25')](_0xa979('0x45'),_0x34e3d7['calleridname'],_0x34e3d7['calleridnum']);}RpcVoiceCallReport[_0xa979('0x30')](_0x34e3d7);if(_0x34e3d7[_0xa979('0x46')]){for(var _0x3c6f49=0x0;_0x3c6f49<_0x34e3d7[_0xa979('0x47')]['length'];_0x3c6f49+=0x1){_0x34e3d7[_0xa979('0x48')]=_0x34e3d7[_0xa979('0x47')][_0x3c6f49][_0xa979('0x49')];_0x34e3d7['createdAt']=_0x34e3d7['monitors'][_0x3c6f49][_0xa979('0x4a')];if(_0x34e3d7[_0xa979('0x34')]=='xcally-motion-preview'){_0x34e3d7['calleridnum']=_0x34e3d7['connectedlinenum'];_0x34e3d7['calleridname']=_0x34e3d7[_0xa979('0x4b')];_0x34e3d7['connectedlinenum']=_0x34e3d7[_0xa979('0x20')];_0x34e3d7[_0xa979('0x4b')]=_0x34e3d7[_0xa979('0x4c')];_0x34e3d7['exten']=_0x34e3d7[_0xa979('0x3f')];}else if(_0x34e3d7[_0xa979('0x34')]==_0xa979('0x4d')){_0x34e3d7[_0xa979('0x42')]=_0x34e3d7[_0xa979('0x33')];_0x34e3d7[_0xa979('0x34')]=_0x34e3d7[_0xa979('0x3f')];}RpcVoiceRecording[_0xa979('0x30')](_0x34e3d7);}}};Report['prototype'][_0xa979('0x18')]=function(_0x3cb6e8){if(_[_0xa979('0x4e')](_0x3cb6e8)){_0x3cb6e8[_0xa979('0x4f')](function(_0x4f2a01){RpcVoiceAgentReport[_0xa979('0x30')](_0x4f2a01);});}else{RpcVoiceAgentReport[_0xa979('0x30')](_0x3cb6e8);}};Report['prototype'][_0xa979('0x1a')]=function(_0x327ad6){RpcVoiceDialReport['create'](_0x327ad6);var _0x39895e=undefined;var _0x248e60=_0x327ad6[_0xa979('0x41')];if(_['startsWith'](_0x248e60,_0xa979('0x50'))){var _0x254de9=_0x248e60[_0xa979('0x51')](_0x248e60[_0xa979('0x52')]('/')+0x1,_0x248e60[_0xa979('0x52')]('@'));_0x39895e=_[_0xa979('0x23')](this[_0xa979('0x10')],function(_0x65507c){return _0x65507c[_0xa979('0x53')]==_0x254de9||_0x65507c[_0xa979('0x54')]==_0x254de9||_0x65507c['accountcode']==_0x254de9;});}else{var _0x254de9=_0x248e60['substring'](_0x248e60[_0xa979('0x52')]('/')+0x1,_0x248e60[_0xa979('0x55')]('-'));_0x39895e=this[_0xa979('0x1f')](_0x254de9);}if(_0x39895e){_0x327ad6['interface']=_[_0xa979('0x22')](_0x39895e['interface'])?util[_0xa979('0x25')](_0xa979('0x2b'),_0x39895e[_0xa979('0x21')]):_0x39895e[_0xa979('0x24')];_0x327ad6[_0xa979('0x4c')]=_0x39895e[_0xa979('0x21')];_0x327ad6[_0xa979('0x20')]=_0x39895e[_0xa979('0x20')];RpcMemberReport[_0xa979('0x1a')](_0x327ad6);}};Report[_0xa979('0x1e')][_0xa979('0x1b')]=function(_0x43b6c1){RpcVoiceTransferReport[_0xa979('0x1b')](_0x43b6c1);};Report[_0xa979('0x1e')]['attendedTransfer']=function(_0x19f504){RpcVoiceTransferReport[_0xa979('0x1d')](_0x19f504);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 8dcdef2..75f0d7c 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 _0x3d41=['ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','actionSipShowRegistry','prototype','isNotNull','isUndefined','emit','find','stateRegistry','state','merge','event','username','format','trunk:%s','name','trunk:save','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','startsWith','Local','substring','indexOf','phone','accountcode','[syncDeviceState][UserReport]','peer','status','address','[syncPeerStatus][UserReport]','exports','moment','bluebird','util'];(function(_0x543a0f,_0x149d24){var _0x115369=function(_0xa4fd41){while(--_0xa4fd41){_0x543a0f['push'](_0x543a0f['shift']());}};_0x115369(++_0x149d24);}(_0x3d41,0x7d));var _0x13d4=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x3d41[_0x5b27da];return _0x3254f4;};'use strict';var _=require('lodash');var moment=require(_0x13d4('0x0'));var BPromise=require(_0x13d4('0x1'));var util=require(_0x13d4('0x2'));var Redis=require(_0x13d4('0x3'));var config=require(_0x13d4('0x4'));var logger=require(_0x13d4('0x5'))(_0x13d4('0x6'));var ami=require(_0x13d4('0x7'));config[_0x13d4('0x8')]=_[_0x13d4('0x9')](config[_0x13d4('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x13d4('0x8')]));function UserReport(_0x2f2dd5){this[_0x13d4('0xa')]=_0x2f2dd5[_0x13d4('0xa')];this[_0x13d4('0xb')]=_0x2f2dd5['agents'];this[_0x13d4('0xc')]=_0x2f2dd5[_0x13d4('0xc')];ami['on'](_0x13d4('0xd'),this[_0x13d4('0xe')][_0x13d4('0xf')](this));ami['on'](_0x13d4('0x10'),this[_0x13d4('0xe')][_0x13d4('0xf')](this));ami['on']('devicestatechange',this[_0x13d4('0x11')][_0x13d4('0xf')](this));ami['on'](_0x13d4('0x12'),this[_0x13d4('0x13')]['bind'](this));this[_0x13d4('0x14')]();return BPromise[_0x13d4('0x15')]()[_0x13d4('0x16')](ami['actionSipShowRegistry']())[_0x13d4('0x16')](ami[_0x13d4('0x17')]())[_0x13d4('0x16')](ami[_0x13d4('0x18')]())[_0x13d4('0x19')](loggerCatch(_0x13d4('0x1a')));}function loggerCatch(_0x12476f){return function(_0x16c898){logger[_0x13d4('0x1b')](_0x12476f,util[_0x13d4('0x1c')](_0x16c898,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x13d4('0x14')]=function(){setInterval(function(){BPromise[_0x13d4('0x15')]()[_0x13d4('0x16')](ami[_0x13d4('0x1d')]())['then'](ami[_0x13d4('0x17')]())[_0x13d4('0x16')](ami[_0x13d4('0x18')]())[_0x13d4('0x19')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0x13d4('0x1e')][_0x13d4('0x1f')]=function(_0x2e3b6e){return _0x2e3b6e!==null&&!_[_0x13d4('0x20')](_0x2e3b6e);};UserReport[_0x13d4('0x1e')][_0x13d4('0x21')]=function(_0x43728b,_0x48474c,_0x5266a8){io['to'](_0x43728b)[_0x13d4('0x21')](_0x48474c,_0x5266a8);};UserReport[_0x13d4('0x1e')][_0x13d4('0xe')]=function(_0x14bf4e){try{if(this['isNotNull'](_0x14bf4e)){var _0x5b8adb=_[_0x13d4('0x22')](this['trunks'],{'registry':_0x14bf4e['username']});if(_0x5b8adb){_0x14bf4e[_0x13d4('0x23')]=_0x14bf4e[_0x13d4('0x24')];_[_0x13d4('0x25')](_0x5b8adb,_['omit'](_0x14bf4e,[_0x13d4('0x26'),'actionid',_0x13d4('0x27'),'state']));this[_0x13d4('0x21')](util[_0x13d4('0x28')](_0x13d4('0x29'),_0x5b8adb[_0x13d4('0x2a')]),_0x13d4('0x2b'),_0x5b8adb);}}}catch(_0x1d2345){logger[_0x13d4('0x1b')]('[syncRegistry][UserReport]',util[_0x13d4('0x1c')](_0x1d2345,{'showHidden':![],'depth':null}));}};UserReport[_0x13d4('0x1e')]['syncDeviceState']=function(_0x288c97){try{if(this[_0x13d4('0x1f')](_0x288c97)){if(this[_0x13d4('0xb')][_0x288c97[_0x13d4('0x2c')]]){if(!this[_0x13d4('0xb')][_0x288c97[_0x13d4('0x2c')]][_0x13d4('0x2d')]||_0x288c97[_0x13d4('0x24')][_0x13d4('0x2e')]()==_0x13d4('0x2f')){this[_0x13d4('0xb')][_0x288c97['device']][_0x13d4('0x2d')]=![];if(this[_0x13d4('0xb')][_0x288c97[_0x13d4('0x2c')]][_0x13d4('0x24')]!==_0x288c97[_0x13d4('0x24')][_0x13d4('0x2e')]()){this[_0x13d4('0xb')][_0x288c97['device']][_0x13d4('0x30')]=_[_0x13d4('0x31')](moment()['format']('x'));}this[_0x13d4('0xb')][_0x288c97[_0x13d4('0x2c')]][_0x13d4('0x24')]=_0x288c97[_0x13d4('0x24')]['toLowerCase']();this['agents'][_0x288c97[_0x13d4('0x2c')]][_0x13d4('0x32')](_0x288c97);}}else if(this[_0x13d4('0xc')][_0x288c97['device']]){if(this[_0x13d4('0xc')][_0x288c97[_0x13d4('0x2c')]][_0x13d4('0x24')]!==_0x288c97[_0x13d4('0x24')][_0x13d4('0x2e')]()){this['telephones'][_0x288c97[_0x13d4('0x2c')]]['stateTime']=_['toNumber'](moment()[_0x13d4('0x28')]('x'));}this['telephones'][_0x288c97[_0x13d4('0x2c')]][_0x13d4('0x24')]=_0x288c97['state']['toLowerCase']();this[_0x13d4('0x21')](util['format'](_0x13d4('0x33'),this[_0x13d4('0xc')][_0x288c97['device']]['name']),'telephone:save',this[_0x13d4('0xc')][_0x288c97[_0x13d4('0x2c')]]);}else if(this[_0x13d4('0xa')][_0x288c97[_0x13d4('0x2c')]]){if(this[_0x13d4('0xa')][_0x288c97['device']]['state']!==_0x288c97[_0x13d4('0x24')]['toLowerCase']()){this['trunks'][_0x288c97[_0x13d4('0x2c')]]['stateTime']=_[_0x13d4('0x31')](moment()[_0x13d4('0x28')]('x'));}this[_0x13d4('0xa')][_0x288c97['device']][_0x13d4('0x24')]=_0x288c97[_0x13d4('0x24')][_0x13d4('0x2e')]();this['emit'](util[_0x13d4('0x28')](_0x13d4('0x29'),this[_0x13d4('0xa')][_0x288c97[_0x13d4('0x2c')]][_0x13d4('0x2a')]),_0x13d4('0x2b'),this[_0x13d4('0xa')][_0x288c97[_0x13d4('0x2c')]]);}else if(_[_0x13d4('0x34')](_0x288c97[_0x13d4('0x2c')],'Queue')){}else if(_['startsWith'](_0x288c97[_0x13d4('0x2c')],_0x13d4('0x35'))){var _0x352184=_0x288c97[_0x13d4('0x2c')];var _0x1ca0d4=_0x352184[_0x13d4('0x36')](_0x352184[_0x13d4('0x37')]('/')+0x1,_0x352184[_0x13d4('0x37')]('@'));var _0x185c34=_['find'](this[_0x13d4('0xb')],function(_0x385fe4){return _0x385fe4['mobile']==_0x1ca0d4||_0x385fe4[_0x13d4('0x38')]==_0x1ca0d4||_0x385fe4[_0x13d4('0x39')]==_0x1ca0d4;});if(_0x185c34){if(_0x185c34[_0x13d4('0x24')]!==_0x288c97[_0x13d4('0x24')][_0x13d4('0x2e')]()){_0x185c34[_0x13d4('0x30')]=_[_0x13d4('0x31')](moment()[_0x13d4('0x28')]('x'));}_0x185c34[_0x13d4('0x24')]=_0x288c97[_0x13d4('0x24')][_0x13d4('0x2e')]();_0x185c34[_0x13d4('0x2d')]=!![];_0x185c34[_0x13d4('0x32')](_0x288c97);}}else{}}}catch(_0x1dcf0c){logger[_0x13d4('0x1b')](_0x13d4('0x3a'),util['inspect'](_0x1dcf0c,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x13d4('0x13')]=function(_0x5094bf){try{if(this[_0x13d4('0x1f')](_0x5094bf)&&this[_0x13d4('0x1f')](_0x5094bf[_0x13d4('0x12')])){if(this['agents'][_0x5094bf[_0x13d4('0x3b')]]){if(!this[_0x13d4('0xb')][_0x5094bf[_0x13d4('0x3b')]][_0x13d4('0x2d')]||_0x5094bf[_0x13d4('0x12')][_0x13d4('0x2e')]()=='registered'){this['agents'][_0x5094bf['peer']][_0x13d4('0x2d')]=![];this[_0x13d4('0xb')][_0x5094bf[_0x13d4('0x3b')]][_0x13d4('0x3c')]=_0x5094bf[_0x13d4('0x12')][_0x13d4('0x2e')]();this['agents'][_0x5094bf[_0x13d4('0x3b')]][_0x13d4('0x3d')]=_0x5094bf[_0x13d4('0x3d')];this['agents'][_0x5094bf[_0x13d4('0x3b')]][_0x13d4('0x32')](_0x5094bf);}}else if(this[_0x13d4('0xc')][_0x5094bf[_0x13d4('0x3b')]]){this[_0x13d4('0xc')][_0x5094bf[_0x13d4('0x3b')]][_0x13d4('0x3c')]=_0x5094bf[_0x13d4('0x12')][_0x13d4('0x2e')]();this[_0x13d4('0xc')][_0x5094bf[_0x13d4('0x3b')]]['address']=_0x5094bf[_0x13d4('0x3d')];this[_0x13d4('0x21')](util['format']('telephone:%s',this[_0x13d4('0xc')][_0x5094bf[_0x13d4('0x3b')]][_0x13d4('0x2a')]),'telephone:save',this[_0x13d4('0xc')][_0x5094bf['peer']]);}else if(this[_0x13d4('0xa')][_0x5094bf[_0x13d4('0x3b')]]){this[_0x13d4('0xa')][_0x5094bf[_0x13d4('0x3b')]][_0x13d4('0x3c')]=_0x5094bf[_0x13d4('0x12')][_0x13d4('0x2e')]();this['trunks'][_0x5094bf['peer']][_0x13d4('0x3d')]=_0x5094bf[_0x13d4('0x3d')];this[_0x13d4('0x21')](util[_0x13d4('0x28')](_0x13d4('0x29'),this[_0x13d4('0xa')][_0x5094bf[_0x13d4('0x3b')]][_0x13d4('0x2a')]),_0x13d4('0x2b'),this[_0x13d4('0xa')][_0x5094bf[_0x13d4('0x3b')]]);}else{}}}catch(_0x217d11){logger[_0x13d4('0x1b')](_0x13d4('0x3e'),util[_0x13d4('0x1c')](_0x217d11,{'showHidden':![],'depth':null}));}};module[_0x13d4('0x3f')]=UserReport; \ No newline at end of file +var _0xa70b=['[syncDeviceState][UserReport]','peerstatus','peer','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','actionSipShowRegistry','isNotNull','emit','find','username','state','merge','omit','event','actionid','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','Queue','startsWith','substring','indexOf','mobile','phone','accountcode'];(function(_0x1f880a,_0x26d233){var _0x12ae7f=function(_0x120e06){while(--_0x120e06){_0x1f880a['push'](_0x1f880a['shift']());}};_0x12ae7f(++_0x26d233);}(_0xa70b,0x1dd));var _0xba70=function(_0x2c2390,_0x37ef1c){_0x2c2390=_0x2c2390-0x0;var _0x478b7e=_0xa70b[_0x2c2390];return _0x478b7e;};'use strict';var _=require(_0xba70('0x0'));var moment=require(_0xba70('0x1'));var BPromise=require(_0xba70('0x2'));var util=require(_0xba70('0x3'));var Redis=require(_0xba70('0x4'));var config=require('../../../config/environment');var logger=require(_0xba70('0x5'))(_0xba70('0x6'));var ami=require(_0xba70('0x7'));config[_0xba70('0x8')]=_['defaults'](config[_0xba70('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xba70('0x9'))(new Redis(config[_0xba70('0x8')]));function UserReport(_0x4a8b7e){this[_0xba70('0xa')]=_0x4a8b7e[_0xba70('0xa')];this[_0xba70('0xb')]=_0x4a8b7e[_0xba70('0xb')];this[_0xba70('0xc')]=_0x4a8b7e[_0xba70('0xc')];ami['on'](_0xba70('0xd'),this[_0xba70('0xe')][_0xba70('0xf')](this));ami['on']('registry',this[_0xba70('0xe')]['bind'](this));ami['on'](_0xba70('0x10'),this[_0xba70('0x11')][_0xba70('0xf')](this));ami['on']('peerstatus',this[_0xba70('0x12')][_0xba70('0xf')](this));this[_0xba70('0x13')]();return BPromise[_0xba70('0x14')]()[_0xba70('0x15')](ami['actionSipShowRegistry']())[_0xba70('0x15')](ami['actionDeviceStateList']())[_0xba70('0x15')](ami[_0xba70('0x16')]())[_0xba70('0x17')](loggerCatch(_0xba70('0x18')));}function loggerCatch(_0x248e80){return function(_0x3171a9){logger[_0xba70('0x19')](_0x248e80,util[_0xba70('0x1a')](_0x3171a9,{'showHidden':![],'depth':null}));};}UserReport[_0xba70('0x1b')][_0xba70('0x13')]=function(){setInterval(function(){BPromise['resolve']()[_0xba70('0x15')](ami[_0xba70('0x1c')]())[_0xba70('0x15')](ami['actionDeviceStateList']())['then'](ami['actionSipPeerStatus']())[_0xba70('0x17')](loggerCatch(_0xba70('0x18')));},0x32c8);};UserReport[_0xba70('0x1b')][_0xba70('0x1d')]=function(_0x31f097){return _0x31f097!==null&&!_['isUndefined'](_0x31f097);};UserReport['prototype'][_0xba70('0x1e')]=function(_0x4cbe55,_0x2d2c61,_0x10a9b8){io['to'](_0x4cbe55)[_0xba70('0x1e')](_0x2d2c61,_0x10a9b8);};UserReport[_0xba70('0x1b')][_0xba70('0xe')]=function(_0x2b8db7){try{if(this[_0xba70('0x1d')](_0x2b8db7)){var _0x40fd2b=_[_0xba70('0x1f')](this[_0xba70('0xa')],{'registry':_0x2b8db7[_0xba70('0x20')]});if(_0x40fd2b){_0x2b8db7['stateRegistry']=_0x2b8db7[_0xba70('0x21')];_[_0xba70('0x22')](_0x40fd2b,_[_0xba70('0x23')](_0x2b8db7,[_0xba70('0x24'),_0xba70('0x25'),_0xba70('0x20'),_0xba70('0x21')]));this[_0xba70('0x1e')](util[_0xba70('0x26')](_0xba70('0x27'),_0x40fd2b[_0xba70('0x28')]),_0xba70('0x29'),_0x40fd2b);}}}catch(_0x564266){logger[_0xba70('0x19')](_0xba70('0x2a'),util['inspect'](_0x564266,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x27dedd){try{if(this[_0xba70('0x1d')](_0x27dedd)){if(this[_0xba70('0xb')][_0x27dedd[_0xba70('0x2b')]]){if(!this['agents'][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x2c')]||_0x27dedd[_0xba70('0x21')]['toLowerCase']()==_0xba70('0x2d')){this[_0xba70('0xb')][_0x27dedd[_0xba70('0x2b')]]['local']=![];if(this[_0xba70('0xb')][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x21')]!==_0x27dedd[_0xba70('0x21')][_0xba70('0x2e')]()){this[_0xba70('0xb')][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x2f')]=_[_0xba70('0x30')](moment()[_0xba70('0x26')]('x'));}this[_0xba70('0xb')][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x21')]=_0x27dedd[_0xba70('0x21')][_0xba70('0x2e')]();this[_0xba70('0xb')][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x31')](_0x27dedd);}}else if(this['telephones'][_0x27dedd['device']]){if(this[_0xba70('0xc')][_0x27dedd['device']][_0xba70('0x21')]!==_0x27dedd[_0xba70('0x21')][_0xba70('0x2e')]()){this[_0xba70('0xc')][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x2f')]=_[_0xba70('0x30')](moment()[_0xba70('0x26')]('x'));}this[_0xba70('0xc')][_0x27dedd['device']][_0xba70('0x21')]=_0x27dedd['state'][_0xba70('0x2e')]();this[_0xba70('0x1e')](util[_0xba70('0x26')](_0xba70('0x32'),this[_0xba70('0xc')][_0x27dedd['device']][_0xba70('0x28')]),_0xba70('0x33'),this[_0xba70('0xc')][_0x27dedd[_0xba70('0x2b')]]);}else if(this['trunks'][_0x27dedd[_0xba70('0x2b')]]){if(this[_0xba70('0xa')][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x21')]!==_0x27dedd['state'][_0xba70('0x2e')]()){this['trunks'][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x2f')]=_[_0xba70('0x30')](moment()[_0xba70('0x26')]('x'));}this['trunks'][_0x27dedd[_0xba70('0x2b')]]['state']=_0x27dedd['state'][_0xba70('0x2e')]();this[_0xba70('0x1e')](util[_0xba70('0x26')](_0xba70('0x27'),this[_0xba70('0xa')][_0x27dedd[_0xba70('0x2b')]][_0xba70('0x28')]),_0xba70('0x29'),this[_0xba70('0xa')][_0x27dedd['device']]);}else if(_['startsWith'](_0x27dedd['device'],_0xba70('0x34'))){}else if(_[_0xba70('0x35')](_0x27dedd[_0xba70('0x2b')],'Local')){var _0x28dfde=_0x27dedd[_0xba70('0x2b')];var _0x3e133b=_0x28dfde[_0xba70('0x36')](_0x28dfde[_0xba70('0x37')]('/')+0x1,_0x28dfde[_0xba70('0x37')]('@'));var _0x55f933=_[_0xba70('0x1f')](this[_0xba70('0xb')],function(_0x1011ef){return _0x1011ef[_0xba70('0x38')]==_0x3e133b||_0x1011ef[_0xba70('0x39')]==_0x3e133b||_0x1011ef[_0xba70('0x3a')]==_0x3e133b;});if(_0x55f933){if(_0x55f933[_0xba70('0x21')]!==_0x27dedd[_0xba70('0x21')][_0xba70('0x2e')]()){_0x55f933[_0xba70('0x2f')]=_[_0xba70('0x30')](moment()[_0xba70('0x26')]('x'));}_0x55f933['state']=_0x27dedd[_0xba70('0x21')][_0xba70('0x2e')]();_0x55f933[_0xba70('0x2c')]=!![];_0x55f933[_0xba70('0x31')](_0x27dedd);}}else{}}}catch(_0x235705){logger['error'](_0xba70('0x3b'),util[_0xba70('0x1a')](_0x235705,{'showHidden':![],'depth':null}));}};UserReport[_0xba70('0x1b')][_0xba70('0x12')]=function(_0x4896c1){try{if(this[_0xba70('0x1d')](_0x4896c1)&&this[_0xba70('0x1d')](_0x4896c1[_0xba70('0x3c')])){if(this[_0xba70('0xb')][_0x4896c1[_0xba70('0x3d')]]){if(!this[_0xba70('0xb')][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x2c')]||_0x4896c1[_0xba70('0x3c')][_0xba70('0x2e')]()==_0xba70('0x3e')){this['agents'][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x2c')]=![];this['agents'][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x3f')]=_0x4896c1[_0xba70('0x3c')][_0xba70('0x2e')]();this['agents'][_0x4896c1[_0xba70('0x3d')]]['address']=_0x4896c1['address'];this[_0xba70('0xb')][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x31')](_0x4896c1);}}else if(this[_0xba70('0xc')][_0x4896c1[_0xba70('0x3d')]]){this[_0xba70('0xc')][_0x4896c1['peer']][_0xba70('0x3f')]=_0x4896c1[_0xba70('0x3c')]['toLowerCase']();this[_0xba70('0xc')][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x40')]=_0x4896c1[_0xba70('0x40')];this[_0xba70('0x1e')](util[_0xba70('0x26')](_0xba70('0x32'),this[_0xba70('0xc')][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x28')]),_0xba70('0x33'),this[_0xba70('0xc')][_0x4896c1['peer']]);}else if(this['trunks'][_0x4896c1[_0xba70('0x3d')]]){this[_0xba70('0xa')][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x3f')]=_0x4896c1[_0xba70('0x3c')][_0xba70('0x2e')]();this['trunks'][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x40')]=_0x4896c1['address'];this[_0xba70('0x1e')](util[_0xba70('0x26')](_0xba70('0x27'),this[_0xba70('0xa')][_0x4896c1[_0xba70('0x3d')]][_0xba70('0x28')]),_0xba70('0x29'),this['trunks'][_0x4896c1[_0xba70('0x3d')]]);}else{}}}catch(_0x103477){logger[_0xba70('0x19')](_0xba70('0x41'),util[_0xba70('0x1a')](_0x103477,{'showHidden':![],'depth':null}));}};module[_0xba70('0x42')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 45e94c1..9a0cb5b 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 _0x7fa7=['[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','agentcompleteAt','complete','transfer','agent','agentacw','acwtime','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','inspect','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','values','transfereeuniqueid','origtransfereruniqueid','talktime','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','moment','util','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','type','merge','omit','event','privilege','format','user:%s','error','agentconnectAt','lastevent','connect','holdtime','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','queue','destconnectedlinenum','membername','user:agentconnect','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentringnoanswerAt','rejected','custom:agentringnoanswer'];(function(_0x44b237,_0x2079c1){var _0x30e217=function(_0x241900){while(--_0x241900){_0x44b237['push'](_0x44b237['shift']());}};_0x30e217(++_0x2079c1);}(_0x7fa7,0x1ee));var _0x77fa=function(_0x5bd7a3,_0x5899b1){_0x5bd7a3=_0x5bd7a3-0x0;var _0x29e95b=_0x7fa7[_0x5bd7a3];return _0x29e95b;};'use strict';var _=require(_0x77fa('0x0'));var moment=require(_0x77fa('0x1'));var util=require(_0x77fa('0x2'));var Redis=require('ioredis');var config=require(_0x77fa('0x3'));var logger=require('../../../config/logger')(_0x77fa('0x4'));var ami=require(_0x77fa('0x5'));config['redis']=_[_0x77fa('0x6')](config[_0x77fa('0x7')],{'host':_0x77fa('0x8'),'port':0x18eb});var io=require(_0x77fa('0x9'))(new Redis(config[_0x77fa('0x7')]));function VoiceAgentReport(_0xb9d72a){this[_0x77fa('0xa')]={};this[_0x77fa('0xb')]=_0xb9d72a[_0x77fa('0xb')];this[_0x77fa('0xc')]=_0xb9d72a[_0x77fa('0xc')];this[_0x77fa('0xd')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x77fa('0xe')](this));ami['on'](_0x77fa('0xf'),this[_0x77fa('0x10')][_0x77fa('0xe')](this));ami['on'](_0x77fa('0x11'),this[_0x77fa('0x12')][_0x77fa('0xe')](this));ami['on'](_0x77fa('0x13'),this[_0x77fa('0x14')][_0x77fa('0xe')](this));ami['on'](_0x77fa('0x15'),this[_0x77fa('0x16')][_0x77fa('0xe')](this));ami['on'](_0x77fa('0x17'),this[_0x77fa('0x18')]['bind'](this));ami['on'](_0x77fa('0x19'),this[_0x77fa('0x1a')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x77fa('0xe')](this));ami['on'](_0x77fa('0x1b'),this[_0x77fa('0x1c')][_0x77fa('0xe')](this));ami['on']('attendedtransfer',this[_0x77fa('0x1d')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));}VoiceAgentReport[_0x77fa('0x1e')][_0x77fa('0x1f')]=function(_0x1b47a6,_0x5c67e5,_0x1ff8da){io['to'](_0x1b47a6)[_0x77fa('0x1f')](_0x5c67e5,_0x1ff8da);};VoiceAgentReport[_0x77fa('0x1e')][_0x77fa('0x20')]=function(_0xaac603){return _0xaac603!==null&&!_[_0x77fa('0x21')](_0xaac603);};VoiceAgentReport['prototype'][_0x77fa('0x22')]=function(_0x4f58bd){try{if(this[_0x77fa('0x20')](_0x4f58bd)){if(_['isUndefined'](this[_0x77fa('0xa')][_0x4f58bd[_0x77fa('0x23')]])){this['channels'][_0x4f58bd[_0x77fa('0x23')]]={};}if(_[_0x77fa('0x21')](this[_0x77fa('0xa')][_0x4f58bd['uniqueid']][_0x4f58bd[_0x77fa('0x24')]])){this[_0x77fa('0xa')][_0x4f58bd[_0x77fa('0x23')]][_0x4f58bd['destuniqueid']]={'agentcalledAt':moment()['format'](_0x77fa('0x25')),'lastevent':'called','variables':this[_0x77fa('0xd')][_0x4f58bd['uniqueid']],'type':this[_0x77fa('0xb')][_0x4f58bd['queue']]?this['voiceQueues'][_0x4f58bd['queue']][_0x77fa('0x26')]||'inbound':'inbound'};}_[_0x77fa('0x27')](this[_0x77fa('0xa')][_0x4f58bd[_0x77fa('0x23')]][_0x4f58bd[_0x77fa('0x24')]],_[_0x77fa('0x28')](_0x4f58bd,[_0x77fa('0x29'),_0x77fa('0x2a')]));ami[_0x77fa('0x1f')]('custom:agentcalled',this['channels'][_0x4f58bd[_0x77fa('0x23')]][_0x4f58bd[_0x77fa('0x24')]]);this[_0x77fa('0x1f')](util[_0x77fa('0x2b')](_0x77fa('0x2c'),_0x4f58bd['membername']),'user:called',this[_0x77fa('0xa')][_0x4f58bd[_0x77fa('0x23')]][_0x4f58bd['destuniqueid']]);}}catch(_0x75f175){logger[_0x77fa('0x2d')]('[syncAgentCalled][VoiceAgentReport]',util['inspect'](_0x75f175,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x77fa('0x10')]=function(_0x2528e8){try{if(this[_0x77fa('0x20')](_0x2528e8)){if(this['channels'][_0x2528e8[_0x77fa('0x23')]]){for(var _0x1cf27b in this[_0x77fa('0xa')][_0x2528e8['uniqueid']]){if(this[_0x77fa('0xa')][_0x2528e8['uniqueid']]['hasOwnProperty'](_0x1cf27b)){if(_0x2528e8[_0x77fa('0x24')]===_0x1cf27b){this['channels'][_0x2528e8['uniqueid']][_0x1cf27b][_0x77fa('0x2e')]=moment()[_0x77fa('0x2b')](_0x77fa('0x25'));this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x2f')]=_0x77fa('0x30');this['channels'][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b]['holdtime']=_0x2528e8[_0x77fa('0x31')];this['channels'][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b]['connectedlinenum']=_0x2528e8['connectedlinenum'];this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x32')]=_0x2528e8[_0x77fa('0x32')];this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x33')]=_0x2528e8['destchannelstate'];this['channels'][_0x2528e8['uniqueid']][_0x1cf27b]['destchannelstatedesc']=_0x2528e8[_0x77fa('0x34')];_[_0x77fa('0x27')](this['agents'][_0x2528e8[_0x77fa('0x35')]],_[_0x77fa('0x36')](_0x2528e8,[_0x77fa('0x37'),_0x77fa('0x38')]));this[_0x77fa('0x1f')](util['format'](_0x77fa('0x2c'),_0x2528e8[_0x77fa('0x39')]),_0x77fa('0x3a'),this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x2528e8[_0x77fa('0x24')]]);ami[_0x77fa('0x1f')]('custom:agentconnect',this[_0x77fa('0xa')][_0x2528e8['uniqueid']][_0x1cf27b]);}else if(!this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x11')]&&!this['channels'][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x15')]){this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x11')]=!![];this[_0x77fa('0xa')][_0x2528e8['uniqueid']][_0x1cf27b]['agentringnoanswerAt']=moment()[_0x77fa('0x2b')](_0x77fa('0x25'));this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x3b')]=_0x77fa('0x3c');this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b]['lastevent']='answered_elsewhere';this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x3d')]=_0x2528e8[_0x77fa('0x24')];this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b][_0x77fa('0x3e')]=_0x2528e8[_0x77fa('0x39')];ami['emit']('custom:agentansweredelsewhere',this[_0x77fa('0xa')][_0x2528e8[_0x77fa('0x23')]][_0x1cf27b]);}}}}}}catch(_0x5f3051){logger[_0x77fa('0x2d')]('[syncAgentConnect][VoiceAgentReport]',util['inspect'](_0x5f3051,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x77fa('0x1e')][_0x77fa('0x12')]=function(_0x298eac){try{if(this[_0x77fa('0x20')](_0x298eac)){if(this[_0x77fa('0xa')][_0x298eac[_0x77fa('0x23')]]&&this['channels'][_0x298eac[_0x77fa('0x23')]][_0x298eac[_0x77fa('0x24')]]){this[_0x77fa('0xa')][_0x298eac[_0x77fa('0x23')]][_0x298eac[_0x77fa('0x24')]][_0x77fa('0x11')]=!![];this[_0x77fa('0xa')][_0x298eac['uniqueid']][_0x298eac[_0x77fa('0x24')]][_0x77fa('0x3f')]=moment()['format'](_0x77fa('0x25'));this[_0x77fa('0xa')][_0x298eac['uniqueid']][_0x298eac['destuniqueid']][_0x77fa('0x3b')]=_0x77fa('0x40');this[_0x77fa('0xa')][_0x298eac[_0x77fa('0x23')]][_0x298eac[_0x77fa('0x24')]][_0x77fa('0x2f')]='rejected';ami[_0x77fa('0x1f')](_0x77fa('0x41'),this[_0x77fa('0xa')][_0x298eac[_0x77fa('0x23')]][_0x298eac[_0x77fa('0x24')]]);}}}catch(_0xa6a8cf){logger[_0x77fa('0x2d')](_0x77fa('0x42'),util['inspect'](_0xa6a8cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x77fa('0x1e')][_0x77fa('0x14')]=function(_0x2c0d7c){try{if(this[_0x77fa('0x20')](_0x2c0d7c)){if(this[_0x77fa('0xa')][_0x2c0d7c[_0x77fa('0x23')]]){for(var _0x103361 in this[_0x77fa('0xa')][_0x2c0d7c[_0x77fa('0x23')]]){if(this[_0x77fa('0xa')][_0x2c0d7c[_0x77fa('0x23')]][_0x77fa('0x43')](_0x103361)&&!this[_0x77fa('0xa')][_0x2c0d7c[_0x77fa('0x23')]][_0x103361][_0x77fa('0x11')]&&!this[_0x77fa('0xa')][_0x2c0d7c['uniqueid']][_0x103361]['agentcomplete']){this['channels'][_0x2c0d7c['uniqueid']][_0x103361][_0x77fa('0x11')]=!![];this['channels'][_0x2c0d7c[_0x77fa('0x23')]][_0x103361][_0x77fa('0x3f')]=moment()[_0x77fa('0x2b')](_0x77fa('0x25'));this[_0x77fa('0xa')][_0x2c0d7c[_0x77fa('0x23')]][_0x103361][_0x77fa('0x3b')]='abandoned';this[_0x77fa('0xa')][_0x2c0d7c[_0x77fa('0x23')]][_0x103361]['lastevent']=_0x77fa('0x44');ami[_0x77fa('0x1f')]('custom:agentqueuecallerabandon',this[_0x77fa('0xa')][_0x2c0d7c['uniqueid']][_0x103361]);}}}}}catch(_0x5b486d){logger[_0x77fa('0x2d')]('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0x5b486d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x77fa('0x1e')][_0x77fa('0x16')]=function(_0x22bf3f){try{if(this['isNotNull'](_0x22bf3f)){if(this[_0x77fa('0xa')][_0x22bf3f['uniqueid']]){for(var _0x3cd37d in this[_0x77fa('0xa')][_0x22bf3f['uniqueid']]){if(this[_0x77fa('0xa')][_0x22bf3f['uniqueid']][_0x77fa('0x43')](_0x3cd37d)){if(this['channels'][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d][_0x77fa('0x2e')]&&!this[_0x77fa('0xa')][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d][_0x77fa('0x15')]){this[_0x77fa('0xa')][_0x22bf3f['uniqueid']][_0x3cd37d][_0x77fa('0x15')]=!![];this[_0x77fa('0xa')][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d][_0x77fa('0x45')]=moment()[_0x77fa('0x2b')](_0x77fa('0x25'));this['channels'][_0x22bf3f['uniqueid']][_0x3cd37d][_0x77fa('0x2f')]=_0x77fa('0x46');this[_0x77fa('0xa')][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d]['talktime']=_0x22bf3f['talktime'];this[_0x77fa('0xa')][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d][_0x77fa('0x3b')]=_0x22bf3f[_0x77fa('0x3b')]==_0x77fa('0x47')?_0x77fa('0x48'):_0x22bf3f[_0x77fa('0x3b')];if(this[_0x77fa('0xb')][_0x22bf3f[_0x77fa('0x37')]]&&this[_0x77fa('0xb')][_0x22bf3f['queue']]['acw']){this[_0x77fa('0xa')][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d][_0x77fa('0x49')]=!![];this[_0x77fa('0xa')][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d][_0x77fa('0x4a')]=this[_0x77fa('0xb')][_0x22bf3f['queue']]['acwTimeout'];}this[_0x77fa('0xc')][_0x22bf3f[_0x77fa('0x35')]]=_[_0x77fa('0x28')](this[_0x77fa('0xc')][_0x22bf3f[_0x77fa('0x35')]],[_0x77fa('0x37'),_0x77fa('0x38')]);this[_0x77fa('0x1f')](util[_0x77fa('0x2b')](_0x77fa('0x2c'),_0x22bf3f[_0x77fa('0x39')]),_0x77fa('0x4b'),this['channels'][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d]);ami[_0x77fa('0x1f')]('custom:agentcomplete',this['channels'][_0x22bf3f[_0x77fa('0x23')]][_0x3cd37d]);}}}}}}catch(_0x38ff9c){logger['error'](_0x77fa('0x4c'),util[_0x77fa('0x4d')](_0x38ff9c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x77fa('0x18')]=function(_0x1fc9e6){try{if(this[_0x77fa('0x20')](_0x1fc9e6)){this['addVariable'](_0x1fc9e6[_0x77fa('0x23')],_[_0x77fa('0x4e')](_0x1fc9e6[_0x77fa('0x4f')])[0x0],_0x1fc9e6[_0x77fa('0x50')]);if(this[_0x77fa('0xa')][_0x1fc9e6['uniqueid']]){for(var _0x343b55 in this[_0x77fa('0xa')][_0x1fc9e6['uniqueid']]){if(this[_0x77fa('0xa')][_0x1fc9e6['uniqueid']]['hasOwnProperty'](_0x343b55)){if(_['isUndefined'](this[_0x77fa('0xa')][_0x1fc9e6[_0x77fa('0x23')]][_0x343b55][_0x77fa('0xd')])){this[_0x77fa('0xa')][_0x1fc9e6[_0x77fa('0x23')]][_0x343b55]['variables']={};}this['channels'][_0x1fc9e6[_0x77fa('0x23')]][_0x343b55]['variables']=this['variables'][_0x1fc9e6['uniqueid']];}}}}}catch(_0x3ee96f){logger[_0x77fa('0x2d')](_0x77fa('0x51'),util[_0x77fa('0x4d')](_0x3ee96f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x77fa('0x1e')]['addVariable']=function(_0x3ab605,_0x5b4c46,_0x175b00){var _0x1d93e7=[_0x77fa('0x52'),'rtpaudioqosbridged',_0x77fa('0x53'),_0x77fa('0x54'),_0x77fa('0x55'),_0x77fa('0x56'),_0x77fa('0x57'),_0x77fa('0x58'),'sipcallid','sipuri','bridgepeer','bridgepvtcallid',_0x77fa('0x59'),_0x77fa('0x5a'),_0x77fa('0x5b'),_0x77fa('0x5c'),_0x77fa('0x39'),_0x77fa('0x5d'),_0x77fa('0x5e')];if(!_[_0x77fa('0x5f')](_0x5b4c46)&&!_['includes'](_0x1d93e7,_0x5b4c46)){if(_[_0x77fa('0x21')](this[_0x77fa('0xd')][_0x3ab605])){this['variables'][_0x3ab605]={};}this['variables'][_0x3ab605][_0x5b4c46]=_0x175b00;}};VoiceAgentReport[_0x77fa('0x1e')]['syncHangup']=function(_0x18825e){try{if(this[_0x77fa('0x20')](_0x18825e)){if(this[_0x77fa('0xa')][_0x18825e[_0x77fa('0x23')]]){for(var _0xb44edd in this['channels'][_0x18825e['uniqueid']]){if(this['channels'][_0x18825e['uniqueid']][_0x77fa('0x43')](_0xb44edd)){if(this[_0x77fa('0xa')][_0x18825e['uniqueid']][_0xb44edd][_0x77fa('0x3b')]==_0x77fa('0x47')&&this[_0x77fa('0xa')][_0x18825e[_0x77fa('0x23')]][_0xb44edd]['agentcomplete']){this[_0x77fa('0xa')][_0x18825e['uniqueid']][_0xb44edd][_0x77fa('0x45')]=moment()[_0x77fa('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami['emit']('custom:voiceAgentReport',_[_0x77fa('0x60')](this[_0x77fa('0xa')][_0x18825e['uniqueid']]));delete this[_0x77fa('0xa')][_0x18825e[_0x77fa('0x23')]];}if(this[_0x77fa('0xd')][_0x18825e[_0x77fa('0x23')]]){delete this[_0x77fa('0xd')][_0x18825e['uniqueid']];}}}catch(_0x12d411){logger['error']('[syncHangup][VoiceAgentReport]',util[_0x77fa('0x4d')](_0x12d411,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x77fa('0x1e')]['syncAttendedTransfer']=function(_0x595f2a){try{if(this['isNotNull'](_0x595f2a)){if(this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x61')]]){for(var _0x470845 in this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x61')]]){if(this['channels'][_0x595f2a['transfereeuniqueid']][_0x77fa('0x43')](_0x470845)){if(_0x595f2a[_0x77fa('0x62')]===_0x470845){var _0x307586=moment();this['channels'][_0x595f2a[_0x77fa('0x61')]][_0x470845]['agentcomplete']=!![];this[_0x77fa('0xa')][_0x595f2a['transfereeuniqueid']][_0x470845]['agentcompleteAt']=moment()[_0x77fa('0x2b')](_0x77fa('0x25'));this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x61')]][_0x470845][_0x77fa('0x3b')]=_0x77fa('0x47');this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x61')]][_0x470845][_0x77fa('0x2f')]=_0x77fa('0x46');this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x61')]][_0x470845][_0x77fa('0x63')]=_0x307586[_0x77fa('0x64')](this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x61')]][_0x470845][_0x77fa('0x2e')],_0x77fa('0x65'));}}}}if(this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x66')]]){var _0x5759b8=this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x66')]];this[_0x77fa('0xa')][_0x595f2a['secondtransfereruniqueid']]=this['channels'][_0x595f2a[_0x77fa('0x61')]];this[_0x77fa('0xa')][_0x595f2a[_0x77fa('0x61')]]=_0x5759b8;}}}catch(_0x1feaa7){logger['error'](_0x77fa('0x67'),util[_0x77fa('0x4d')](_0x1feaa7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x77fa('0x1e')][_0x77fa('0x68')]=function(_0x3724dd){try{if(this[_0x77fa('0x20')](_0x3724dd)){if(this[_0x77fa('0xa')][_0x3724dd['transfereeuniqueid']]){for(var _0x24c9db in this[_0x77fa('0xa')][_0x3724dd['transfereeuniqueid']]){if(this[_0x77fa('0xa')][_0x3724dd[_0x77fa('0x61')]][_0x77fa('0x43')](_0x24c9db)){if(_0x3724dd[_0x77fa('0x69')]===_0x24c9db){var _0x3ea786=moment();this[_0x77fa('0xa')][_0x3724dd[_0x77fa('0x61')]][_0x24c9db][_0x77fa('0x15')]=!![];this['channels'][_0x3724dd[_0x77fa('0x61')]][_0x24c9db][_0x77fa('0x45')]=_0x3ea786;this[_0x77fa('0xa')][_0x3724dd['transfereeuniqueid']][_0x24c9db][_0x77fa('0x3b')]=_0x77fa('0x47');this[_0x77fa('0xa')][_0x3724dd[_0x77fa('0x61')]][_0x24c9db][_0x77fa('0x2f')]=_0x77fa('0x46');this['channels'][_0x3724dd[_0x77fa('0x61')]][_0x24c9db][_0x77fa('0x63')]=_0x3ea786[_0x77fa('0x64')](this[_0x77fa('0xa')][_0x3724dd[_0x77fa('0x61')]][_0x24c9db][_0x77fa('0x2e')],_0x77fa('0x65'));}}}}}}catch(_0x2d278c){logger[_0x77fa('0x2d')](_0x77fa('0x6a'),util['inspect'](_0x2d278c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x77fa('0x1e')]['syncMusicOnHoldStart']=function(_0x2ec7f7){var _0x9bd9aa='';try{if(this['isNotNull'](_0x2ec7f7)){if(_0x2ec7f7[_0x77fa('0x6b')]){_0x9bd9aa=_0x2ec7f7[_0x77fa('0x6b')][_0x77fa('0x6c')](0x0,_0x2ec7f7[_0x77fa('0x6b')][_0x77fa('0x6d')]('-'));if(this['agents'][_0x9bd9aa]){this[_0x77fa('0xc')][_0x9bd9aa][_0x77fa('0x6e')]=!![];}}}}catch(_0x4c6657){logger[_0x77fa('0x2d')]('[syncMusicOnHoldStart][VoiceAgentReport]',util['inspect'](_0x4c6657,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x77fa('0x1c')]=function(_0x2c1eeb){var _0x6c81b2='';try{if(this[_0x77fa('0x20')](_0x2c1eeb)){if(_0x2c1eeb[_0x77fa('0x6b')]){_0x6c81b2=_0x2c1eeb['channel'][_0x77fa('0x6c')](0x0,_0x2c1eeb['channel'][_0x77fa('0x6d')]('-'));if(this[_0x77fa('0xc')][_0x6c81b2]){this['agents'][_0x6c81b2]['onhold']=![];}}}}catch(_0x3a73b6){logger['error'](_0x77fa('0x6f'),util['inspect'](_0x3a73b6,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x2ee2=['[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','syncAgentComplete','talktime','transfer','acw','agentacw','acwtime','acwTimeout','interface','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','value','variables','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','agentcompleteAt','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','seconds','secondtransfereruniqueid','transfereruniqueid','complete','diff','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','hangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','user:%s','membername','user:called','error','inspect','hasOwnProperty','agentconnectAt','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','lastevent','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x2ee2,0x121));var _0x22ee=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x2ee2[_0x38622b];return _0x2c1a7a;};'use strict';var _=require(_0x22ee('0x0'));var moment=require(_0x22ee('0x1'));var util=require(_0x22ee('0x2'));var Redis=require(_0x22ee('0x3'));var config=require(_0x22ee('0x4'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x22ee('0x5')]=_['defaults'](config[_0x22ee('0x5')],{'host':_0x22ee('0x6'),'port':0x18eb});var io=require(_0x22ee('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x328554){this[_0x22ee('0x8')]={};this[_0x22ee('0x9')]=_0x328554[_0x22ee('0x9')];this[_0x22ee('0xa')]=_0x328554[_0x22ee('0xa')];this['variables']={};ami['on'](_0x22ee('0xb'),this[_0x22ee('0xc')][_0x22ee('0xd')](this));ami['on'](_0x22ee('0xe'),this[_0x22ee('0xf')][_0x22ee('0xd')](this));ami['on'](_0x22ee('0x10'),this['syncAgentRingNoAnswer'][_0x22ee('0xd')](this));ami['on']('queuecallerabandon',this[_0x22ee('0x11')]['bind'](this));ami['on'](_0x22ee('0x12'),this['syncAgentComplete']['bind'](this));ami['on'](_0x22ee('0x13'),this[_0x22ee('0x14')][_0x22ee('0xd')](this));ami['on'](_0x22ee('0x15'),this['syncHangup'][_0x22ee('0xd')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x22ee('0xd')](this));ami['on'](_0x22ee('0x16'),this[_0x22ee('0x17')]['bind'](this));ami['on'](_0x22ee('0x18'),this[_0x22ee('0x19')][_0x22ee('0xd')](this));ami['on']('blindtransfer',this[_0x22ee('0x1a')][_0x22ee('0xd')](this));}VoiceAgentReport[_0x22ee('0x1b')][_0x22ee('0x1c')]=function(_0x581f65,_0x3d71a7,_0x183c56){io['to'](_0x581f65)[_0x22ee('0x1c')](_0x3d71a7,_0x183c56);};VoiceAgentReport['prototype'][_0x22ee('0x1d')]=function(_0x191aaf){return _0x191aaf!==null&&!_[_0x22ee('0x1e')](_0x191aaf);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x3a3973){try{if(this[_0x22ee('0x1d')](_0x3a3973)){if(_[_0x22ee('0x1e')](this[_0x22ee('0x8')][_0x3a3973[_0x22ee('0x1f')]])){this['channels'][_0x3a3973[_0x22ee('0x1f')]]={};}if(_[_0x22ee('0x1e')](this[_0x22ee('0x8')][_0x3a3973['uniqueid']][_0x3a3973[_0x22ee('0x20')]])){this[_0x22ee('0x8')][_0x3a3973['uniqueid']][_0x3a3973[_0x22ee('0x20')]]={'agentcalledAt':moment()[_0x22ee('0x21')](_0x22ee('0x22')),'lastevent':_0x22ee('0x23'),'variables':this['variables'][_0x3a3973[_0x22ee('0x1f')]],'type':this[_0x22ee('0x9')][_0x3a3973[_0x22ee('0x24')]]?this['voiceQueues'][_0x3a3973[_0x22ee('0x24')]][_0x22ee('0x25')]||_0x22ee('0x26'):_0x22ee('0x26')};}_[_0x22ee('0x27')](this[_0x22ee('0x8')][_0x3a3973[_0x22ee('0x1f')]][_0x3a3973[_0x22ee('0x20')]],_[_0x22ee('0x28')](_0x3a3973,['event','privilege']));ami[_0x22ee('0x1c')]('custom:agentcalled',this['channels'][_0x3a3973[_0x22ee('0x1f')]][_0x3a3973['destuniqueid']]);this['emit'](util[_0x22ee('0x21')](_0x22ee('0x29'),_0x3a3973[_0x22ee('0x2a')]),_0x22ee('0x2b'),this[_0x22ee('0x8')][_0x3a3973[_0x22ee('0x1f')]][_0x3a3973['destuniqueid']]);}}catch(_0x1899a7){logger[_0x22ee('0x2c')]('[syncAgentCalled][VoiceAgentReport]',util[_0x22ee('0x2d')](_0x1899a7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')][_0x22ee('0xf')]=function(_0x2dc942){try{if(this[_0x22ee('0x1d')](_0x2dc942)){if(this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]]){for(var _0x83db91 in this['channels'][_0x2dc942['uniqueid']]){if(this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x22ee('0x2e')](_0x83db91)){if(_0x2dc942[_0x22ee('0x20')]===_0x83db91){this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x2f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91]['lastevent']=_0x22ee('0x30');this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x31')]=_0x2dc942[_0x22ee('0x31')];this['channels'][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x32')]=_0x2dc942[_0x22ee('0x32')];this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x33')]=_0x2dc942[_0x22ee('0x33')];this['channels'][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x34')]=_0x2dc942[_0x22ee('0x34')];this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x35')]=_0x2dc942['destchannelstatedesc'];_[_0x22ee('0x27')](this[_0x22ee('0xa')][_0x2dc942['interface']],_[_0x22ee('0x36')](_0x2dc942,[_0x22ee('0x24'),_0x22ee('0x37')]));this[_0x22ee('0x1c')](util[_0x22ee('0x21')](_0x22ee('0x29'),_0x2dc942[_0x22ee('0x2a')]),_0x22ee('0x38'),this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x2dc942['destuniqueid']]);ami[_0x22ee('0x1c')](_0x22ee('0x39'),this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91]);}else if(!this['channels'][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x10')]&&!this['channels'][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x12')]){this['channels'][_0x2dc942['uniqueid']][_0x83db91][_0x22ee('0x10')]=!![];this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x3a')]=moment()[_0x22ee('0x21')](_0x22ee('0x22'));this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x3b')]=_0x22ee('0x3c');this['channels'][_0x2dc942['uniqueid']][_0x83db91][_0x22ee('0x3d')]='answered_elsewhere';this['channels'][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x3e')]=_0x2dc942[_0x22ee('0x20')];this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91][_0x22ee('0x3f')]=_0x2dc942[_0x22ee('0x2a')];ami[_0x22ee('0x1c')](_0x22ee('0x40'),this[_0x22ee('0x8')][_0x2dc942[_0x22ee('0x1f')]][_0x83db91]);}}}}}}catch(_0x196d67){logger[_0x22ee('0x2c')](_0x22ee('0x41'),util[_0x22ee('0x2d')](_0x196d67,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')][_0x22ee('0x42')]=function(_0x1bab3d){try{if(this['isNotNull'](_0x1bab3d)){if(this[_0x22ee('0x8')][_0x1bab3d['uniqueid']]&&this[_0x22ee('0x8')][_0x1bab3d[_0x22ee('0x1f')]][_0x1bab3d[_0x22ee('0x20')]]){this['channels'][_0x1bab3d[_0x22ee('0x1f')]][_0x1bab3d[_0x22ee('0x20')]][_0x22ee('0x10')]=!![];this['channels'][_0x1bab3d[_0x22ee('0x1f')]][_0x1bab3d[_0x22ee('0x20')]]['agentringnoanswerAt']=moment()[_0x22ee('0x21')](_0x22ee('0x22'));this[_0x22ee('0x8')][_0x1bab3d[_0x22ee('0x1f')]][_0x1bab3d[_0x22ee('0x20')]][_0x22ee('0x3b')]=_0x22ee('0x43');this[_0x22ee('0x8')][_0x1bab3d[_0x22ee('0x1f')]][_0x1bab3d['destuniqueid']][_0x22ee('0x3d')]=_0x22ee('0x43');ami[_0x22ee('0x1c')]('custom:agentringnoanswer',this[_0x22ee('0x8')][_0x1bab3d[_0x22ee('0x1f')]][_0x1bab3d['destuniqueid']]);}}}catch(_0x18922e){logger[_0x22ee('0x2c')](_0x22ee('0x44'),util[_0x22ee('0x2d')](_0x18922e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')]['syncQueueCallerAbandon']=function(_0x29535f){try{if(this[_0x22ee('0x1d')](_0x29535f)){if(this['channels'][_0x29535f[_0x22ee('0x1f')]]){for(var _0xf3f4d4 in this[_0x22ee('0x8')][_0x29535f[_0x22ee('0x1f')]]){if(this[_0x22ee('0x8')][_0x29535f[_0x22ee('0x1f')]][_0x22ee('0x2e')](_0xf3f4d4)&&!this[_0x22ee('0x8')][_0x29535f['uniqueid']][_0xf3f4d4][_0x22ee('0x10')]&&!this['channels'][_0x29535f[_0x22ee('0x1f')]][_0xf3f4d4][_0x22ee('0x12')]){this[_0x22ee('0x8')][_0x29535f[_0x22ee('0x1f')]][_0xf3f4d4]['agentringnoanswer']=!![];this[_0x22ee('0x8')][_0x29535f['uniqueid']][_0xf3f4d4][_0x22ee('0x3a')]=moment()[_0x22ee('0x21')](_0x22ee('0x22'));this[_0x22ee('0x8')][_0x29535f[_0x22ee('0x1f')]][_0xf3f4d4][_0x22ee('0x3b')]=_0x22ee('0x45');this[_0x22ee('0x8')][_0x29535f[_0x22ee('0x1f')]][_0xf3f4d4][_0x22ee('0x3d')]=_0x22ee('0x45');ami['emit'](_0x22ee('0x46'),this[_0x22ee('0x8')][_0x29535f[_0x22ee('0x1f')]][_0xf3f4d4]);}}}}}catch(_0x2c3935){logger['error'](_0x22ee('0x47'),util[_0x22ee('0x2d')](_0x2c3935,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')][_0x22ee('0x48')]=function(_0x449432){try{if(this[_0x22ee('0x1d')](_0x449432)){if(this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]]){for(var _0x42bd2b in this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]]){if(this[_0x22ee('0x8')][_0x449432['uniqueid']][_0x22ee('0x2e')](_0x42bd2b)){if(this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]][_0x42bd2b]['agentconnectAt']&&!this[_0x22ee('0x8')][_0x449432['uniqueid']][_0x42bd2b][_0x22ee('0x12')]){this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]][_0x42bd2b][_0x22ee('0x12')]=!![];this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]][_0x42bd2b]['agentcompleteAt']=moment()[_0x22ee('0x21')](_0x22ee('0x22'));this['channels'][_0x449432['uniqueid']][_0x42bd2b]['lastevent']='complete';this['channels'][_0x449432['uniqueid']][_0x42bd2b][_0x22ee('0x49')]=_0x449432[_0x22ee('0x49')];this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]][_0x42bd2b][_0x22ee('0x3b')]=_0x449432[_0x22ee('0x3b')]==_0x22ee('0x4a')?'agent':_0x449432[_0x22ee('0x3b')];if(this[_0x22ee('0x9')][_0x449432[_0x22ee('0x24')]]&&this[_0x22ee('0x9')][_0x449432[_0x22ee('0x24')]][_0x22ee('0x4b')]){this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]][_0x42bd2b][_0x22ee('0x4c')]=!![];this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]][_0x42bd2b][_0x22ee('0x4d')]=this[_0x22ee('0x9')][_0x449432[_0x22ee('0x24')]][_0x22ee('0x4e')];}this[_0x22ee('0xa')][_0x449432[_0x22ee('0x4f')]]=_[_0x22ee('0x28')](this[_0x22ee('0xa')][_0x449432[_0x22ee('0x4f')]],[_0x22ee('0x24'),_0x22ee('0x37')]);this['emit'](util[_0x22ee('0x21')](_0x22ee('0x29'),_0x449432[_0x22ee('0x2a')]),_0x22ee('0x50'),this[_0x22ee('0x8')][_0x449432['uniqueid']][_0x42bd2b]);ami[_0x22ee('0x1c')]('custom:agentcomplete',this[_0x22ee('0x8')][_0x449432[_0x22ee('0x1f')]][_0x42bd2b]);}}}}}}catch(_0x6d4e31){logger['error'](_0x22ee('0x51'),util[_0x22ee('0x2d')](_0x6d4e31,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')]['syncVarSet']=function(_0x322371){try{if(this[_0x22ee('0x1d')](_0x322371)){this[_0x22ee('0x52')](_0x322371[_0x22ee('0x1f')],_[_0x22ee('0x53')](_0x322371['variable'])[0x0],_0x322371[_0x22ee('0x54')]);if(this[_0x22ee('0x8')][_0x322371['uniqueid']]){for(var _0x147844 in this[_0x22ee('0x8')][_0x322371['uniqueid']]){if(this[_0x22ee('0x8')][_0x322371[_0x22ee('0x1f')]]['hasOwnProperty'](_0x147844)){if(_[_0x22ee('0x1e')](this[_0x22ee('0x8')][_0x322371[_0x22ee('0x1f')]][_0x147844]['variables'])){this[_0x22ee('0x8')][_0x322371[_0x22ee('0x1f')]][_0x147844]['variables']={};}this[_0x22ee('0x8')][_0x322371[_0x22ee('0x1f')]][_0x147844][_0x22ee('0x55')]=this[_0x22ee('0x55')][_0x322371['uniqueid']];}}}}}catch(_0x1cde5b){logger[_0x22ee('0x2c')]('[syncVarSet][VoiceAgentReport]',util['inspect'](_0x1cde5b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')][_0x22ee('0x52')]=function(_0x1969c1,_0x4f7a86,_0x8a966c){var _0x35aeda=[_0x22ee('0x56'),_0x22ee('0x57'),'rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0x22ee('0x58'),_0x22ee('0x59'),_0x22ee('0x5a'),_0x22ee('0x5b'),_0x22ee('0x5c'),'bridgepeer',_0x22ee('0x5d'),_0x22ee('0x5e'),_0x22ee('0x5f'),_0x22ee('0x60'),_0x22ee('0x61'),_0x22ee('0x2a'),_0x22ee('0x62'),_0x22ee('0x63')];if(!_['isNil'](_0x4f7a86)&&!_[_0x22ee('0x64')](_0x35aeda,_0x4f7a86)){if(_['isUndefined'](this[_0x22ee('0x55')][_0x1969c1])){this[_0x22ee('0x55')][_0x1969c1]={};}this[_0x22ee('0x55')][_0x1969c1][_0x4f7a86]=_0x8a966c;}};VoiceAgentReport[_0x22ee('0x1b')][_0x22ee('0x65')]=function(_0x345ccb){try{if(this[_0x22ee('0x1d')](_0x345ccb)){if(this[_0x22ee('0x8')][_0x345ccb['uniqueid']]){for(var _0x54c960 in this[_0x22ee('0x8')][_0x345ccb['uniqueid']]){if(this[_0x22ee('0x8')][_0x345ccb[_0x22ee('0x1f')]][_0x22ee('0x2e')](_0x54c960)){if(this[_0x22ee('0x8')][_0x345ccb[_0x22ee('0x1f')]][_0x54c960]['reason']==_0x22ee('0x4a')&&this['channels'][_0x345ccb[_0x22ee('0x1f')]][_0x54c960][_0x22ee('0x12')]){this[_0x22ee('0x8')][_0x345ccb[_0x22ee('0x1f')]][_0x54c960][_0x22ee('0x66')]=moment()[_0x22ee('0x21')](_0x22ee('0x22'));}}}ami[_0x22ee('0x1c')](_0x22ee('0x67'),_[_0x22ee('0x68')](this[_0x22ee('0x8')][_0x345ccb[_0x22ee('0x1f')]]));delete this[_0x22ee('0x8')][_0x345ccb[_0x22ee('0x1f')]];}if(this[_0x22ee('0x55')][_0x345ccb['uniqueid']]){delete this[_0x22ee('0x55')][_0x345ccb[_0x22ee('0x1f')]];}}}catch(_0x27ae9f){logger[_0x22ee('0x2c')]('[syncHangup][VoiceAgentReport]',util[_0x22ee('0x2d')](_0x27ae9f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')][_0x22ee('0x19')]=function(_0x2a21eb){try{if(this[_0x22ee('0x1d')](_0x2a21eb)){if(this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x69')]]){for(var _0x5bb558 in this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x69')]]){if(this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x69')]][_0x22ee('0x2e')](_0x5bb558)){if(_0x2a21eb[_0x22ee('0x6a')]===_0x5bb558){var _0x543e0f=moment();this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x69')]][_0x5bb558][_0x22ee('0x12')]=!![];this['channels'][_0x2a21eb[_0x22ee('0x69')]][_0x5bb558][_0x22ee('0x66')]=moment()[_0x22ee('0x21')](_0x22ee('0x22'));this['channels'][_0x2a21eb[_0x22ee('0x69')]][_0x5bb558]['reason']=_0x22ee('0x4a');this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x69')]][_0x5bb558][_0x22ee('0x3d')]='complete';this['channels'][_0x2a21eb[_0x22ee('0x69')]][_0x5bb558]['talktime']=_0x543e0f['diff'](this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x69')]][_0x5bb558][_0x22ee('0x2f')],_0x22ee('0x6b'));}}}}if(this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x6c')]]){var _0x12bcc9=this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x6c')]];this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x6c')]]=this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x69')]];this[_0x22ee('0x8')][_0x2a21eb[_0x22ee('0x69')]]=_0x12bcc9;}}}catch(_0x547ff9){logger[_0x22ee('0x2c')]('[syncAttendedTransfer][VoiceAgentReport]',util[_0x22ee('0x2d')](_0x547ff9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x22ee('0x1a')]=function(_0x48611b){try{if(this['isNotNull'](_0x48611b)){if(this[_0x22ee('0x8')][_0x48611b[_0x22ee('0x69')]]){for(var _0x26d2a6 in this[_0x22ee('0x8')][_0x48611b[_0x22ee('0x69')]]){if(this[_0x22ee('0x8')][_0x48611b[_0x22ee('0x69')]][_0x22ee('0x2e')](_0x26d2a6)){if(_0x48611b[_0x22ee('0x6d')]===_0x26d2a6){var _0x110fd4=moment();this[_0x22ee('0x8')][_0x48611b[_0x22ee('0x69')]][_0x26d2a6][_0x22ee('0x12')]=!![];this[_0x22ee('0x8')][_0x48611b['transfereeuniqueid']][_0x26d2a6][_0x22ee('0x66')]=_0x110fd4;this[_0x22ee('0x8')][_0x48611b[_0x22ee('0x69')]][_0x26d2a6][_0x22ee('0x3b')]='transfer';this[_0x22ee('0x8')][_0x48611b[_0x22ee('0x69')]][_0x26d2a6][_0x22ee('0x3d')]=_0x22ee('0x6e');this[_0x22ee('0x8')][_0x48611b[_0x22ee('0x69')]][_0x26d2a6][_0x22ee('0x49')]=_0x110fd4[_0x22ee('0x6f')](this['channels'][_0x48611b[_0x22ee('0x69')]][_0x26d2a6][_0x22ee('0x2f')],_0x22ee('0x6b'));}}}}}}catch(_0x2620ad){logger[_0x22ee('0x2c')](_0x22ee('0x70'),util[_0x22ee('0x2d')](_0x2620ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')]['syncMusicOnHoldStart']=function(_0x1c4681){var _0x26e955='';try{if(this[_0x22ee('0x1d')](_0x1c4681)){if(_0x1c4681[_0x22ee('0x71')]){_0x26e955=_0x1c4681['channel'][_0x22ee('0x72')](0x0,_0x1c4681[_0x22ee('0x71')][_0x22ee('0x73')]('-'));if(this[_0x22ee('0xa')][_0x26e955]){this[_0x22ee('0xa')][_0x26e955]['onhold']=!![];}}}}catch(_0x1e053b){logger['error'](_0x22ee('0x74'),util[_0x22ee('0x2d')](_0x1e053b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x22ee('0x1b')][_0x22ee('0x17')]=function(_0x429a37){var _0x58c350='';try{if(this[_0x22ee('0x1d')](_0x429a37)){if(_0x429a37[_0x22ee('0x71')]){_0x58c350=_0x429a37['channel'][_0x22ee('0x72')](0x0,_0x429a37['channel'][_0x22ee('0x73')]('-'));if(this[_0x22ee('0xa')][_0x58c350]){this['agents'][_0x58c350]['onhold']=![];}}}}catch(_0x1861f0){logger[_0x22ee('0x2c')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x22ee('0x2d')](_0x1861f0,{'showHidden':![],'depth':null}));}};module[_0x22ee('0x75')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 7c37687..2ef1735 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 _0xdc0d=['context','from-sip','omit','user:agentcomplete','accountcode','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','bind','newexten','syncNewExten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','prototype','isNotNull','isUndefined','uniqueid','linkedid','merge','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','pick','split','emit','user:%s','name','exten','[syncNewChannel][VoiceCallReport]','OutgoingSpoolFailed','application','toLowerCase','appdata','applicationdata','starttime','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','match','queue','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','calleridnum','connectedlinename','destinationchannel','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','monitors','push','rec','mixmonitor_filename','value','variable','xmd-phone','callerid','type','xmd-queue','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','diff'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc0d,0x1db));var _0xddc0=function(_0x5a5b30,_0x1fd17e){_0x5a5b30=_0x5a5b30-0x0;var _0x481495=_0xdc0d[_0x5a5b30];return _0x481495;};'use strict';var BPromise=require(_0xddc0('0x0'));var _=require(_0xddc0('0x1'));var moment=require('moment');var util=require(_0xddc0('0x2'));var path=require('path');var Redis=require(_0xddc0('0x3'));var config=require(_0xddc0('0x4'));var logger=require(_0xddc0('0x5'))(_0xddc0('0x6'));var ami=require(_0xddc0('0x7'));var Channel=require(_0xddc0('0x8'));var statusDesc=[_0xddc0('0x9'),_0xddc0('0xa'),_0xddc0('0xb'),'busy',_0xddc0('0xc'),_0xddc0('0xd'),_0xddc0('0xe'),_0xddc0('0xf'),_0xddc0('0x10')];var applications=[_0xddc0('0x11'),'queue',_0xddc0('0x12'),_0xddc0('0x13'),_0xddc0('0x14'),_0xddc0('0x15')];var dispositions=[_0xddc0('0x16'),_0xddc0('0x17'),_0xddc0('0x17'),_0xddc0('0x16'),'NO\x20ANSWER',_0xddc0('0x16'),_0xddc0('0x18'),'BUSY',_0xddc0('0x17'),_0xddc0('0x17'),_0xddc0('0x17')];var actions={};config[_0xddc0('0x19')]=_[_0xddc0('0x1a')](config['redis'],{'host':_0xddc0('0x1b'),'port':0x18eb});var io=require(_0xddc0('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x24aa03){this['channels']=_0x24aa03[_0xddc0('0x1d')];this[_0xddc0('0x1e')]=_0x24aa03[_0xddc0('0x1e')];ami['on']('coreshowchannel',this['syncNewExten'][_0xddc0('0x1f')](this));ami['on'](_0xddc0('0x20'),this[_0xddc0('0x21')][_0xddc0('0x1f')](this));ami['on']('newchannel',this[_0xddc0('0x22')][_0xddc0('0x1f')](this));ami['on'](_0xddc0('0x23'),this[_0xddc0('0x24')]['bind'](this));ami['on'](_0xddc0('0x25'),this[_0xddc0('0x26')][_0xddc0('0x1f')](this));ami['on']('hangup',this[_0xddc0('0x27')]['bind'](this));ami['on'](_0xddc0('0x28'),this[_0xddc0('0x29')]['bind'](this));ami['on'](_0xddc0('0x2a'),this[_0xddc0('0x2b')][_0xddc0('0x1f')](this));ami['on']('blindtransfer',this[_0xddc0('0x2c')]['bind'](this));ami['on'](_0xddc0('0x2d'),this['syncMusicOnHoldStart'][_0xddc0('0x1f')](this));ami['on']('musiconholdstop',this[_0xddc0('0x2e')][_0xddc0('0x1f')](this));return BPromise[_0xddc0('0x2f')]()['then'](ami[_0xddc0('0x30')]())[_0xddc0('0x31')](function(_0x196dd2){console['log'](_0x196dd2);});}VoiceCallReport[_0xddc0('0x32')][_0xddc0('0x33')]=function(_0x41342e){return _0x41342e!==null&&!_[_0xddc0('0x34')](_0x41342e);};VoiceCallReport[_0xddc0('0x32')]['emit']=function(_0x402386,_0x5cf438,_0x5387cc){io['to'](_0x402386)['emit'](_0x5cf438,_0x5387cc);};VoiceCallReport[_0xddc0('0x32')][_0xddc0('0x29')]=function(_0xc8fe0f){try{if(this[_0xddc0('0x33')](_0xc8fe0f)){if(_0xc8fe0f[_0xddc0('0x35')]===_0xc8fe0f[_0xddc0('0x36')]){if(!_[_0xddc0('0x34')](this[_0xddc0('0x1d')][_0xc8fe0f[_0xddc0('0x35')]])){_[_0xddc0('0x37')](this[_0xddc0('0x1d')][_0xc8fe0f[_0xddc0('0x35')]],_['pick'](_0xc8fe0f,_[_0xddc0('0x38')](this[_0xddc0('0x1d')][_0xc8fe0f[_0xddc0('0x35')]])));}}}}catch(_0x315ed1){logger[_0xddc0('0x39')](_0xddc0('0x3a'),util[_0xddc0('0x3b')](_0x315ed1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xddc0('0x32')]['syncNewChannel']=function(_0x275dca){try{if(this[_0xddc0('0x33')](_0x275dca)){if(_0x275dca[_0xddc0('0x35')]===_0x275dca[_0xddc0('0x36')]&&_0x275dca[_0xddc0('0x3c')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0xddc0('0x1d')][_0x275dca[_0xddc0('0x35')]])){this['channels'][_0x275dca[_0xddc0('0x35')]]=new Channel();this[_0xddc0('0x1d')][_0x275dca['uniqueid']]['starttime']=moment()[_0xddc0('0x3d')](_0xddc0('0x3e'));this[_0xddc0('0x1d')][_0x275dca['uniqueid']]['disposition']=dispositions[_[_0xddc0('0x3f')](_0x275dca[_0xddc0('0x40')])];_[_0xddc0('0x37')](this[_0xddc0('0x1d')][_0x275dca[_0xddc0('0x35')]],_[_0xddc0('0x41')](_0x275dca,_[_0xddc0('0x38')](this['channels'][_0x275dca[_0xddc0('0x35')]])));if(_0x275dca['context']==='from-sip'){if(this[_0xddc0('0x1e')][_0x275dca[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]]){this[_0xddc0('0x1e')][_0x275dca[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]]['destconnectedlinenum']=_0x275dca['exten'];this[_0xddc0('0x43')](util[_0xddc0('0x3d')](_0xddc0('0x44'),this['agents'][_0x275dca['channel']['split']('-')[0x0]][_0xddc0('0x45')]),'user:agentconnect',{'destaccountcode':this[_0xddc0('0x1e')][_0x275dca[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x275dca[_0xddc0('0x46')]});}}}}}}catch(_0x1b8d5b){logger[_0xddc0('0x39')](_0xddc0('0x47'),util[_0xddc0('0x3b')](_0x1b8d5b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xddc0('0x21')]=function(_0x1b9405){try{if(this[_0xddc0('0x33')](_0x1b9405)){if(_0x1b9405[_0xddc0('0x35')]===_0x1b9405['linkedid']&&_0x1b9405['exten']!='h'&&_0x1b9405[_0xddc0('0x3c')]!=_0xddc0('0x48')){_0x1b9405[_0xddc0('0x49')]=_0x1b9405[_0xddc0('0x49')][_0xddc0('0x4a')]();_0x1b9405['applicationdata']=(_0x1b9405[_0xddc0('0x4b')]||_0x1b9405[_0xddc0('0x4c')])[_0xddc0('0x4a')]();if(_[_0xddc0('0x34')](this[_0xddc0('0x1d')][_0x1b9405['uniqueid']])){this[_0xddc0('0x1d')][_0x1b9405['uniqueid']]=new Channel();this[_0xddc0('0x1d')][_0x1b9405[_0xddc0('0x35')]][_0xddc0('0x4d')]=_0x1b9405[_0xddc0('0x4e')]?moment()[_0xddc0('0x4f')](moment['duration'](_0x1b9405[_0xddc0('0x4e')])[_0xddc0('0x50')](),'seconds')[_0xddc0('0x3d')](_0xddc0('0x3e')):moment()[_0xddc0('0x3d')](_0xddc0('0x3e'));this[_0xddc0('0x1d')][_0x1b9405['uniqueid']][_0xddc0('0x51')]='NO\x20ANSWER';}_[_0xddc0('0x37')](this['channels'][_0x1b9405[_0xddc0('0x35')]],_[_0xddc0('0x41')](_0x1b9405,_[_0xddc0('0x38')](this['channels'][_0x1b9405[_0xddc0('0x35')]])));if(_[_0xddc0('0x52')](applications,_0x1b9405[_0xddc0('0x49')])){this['channels'][_0x1b9405[_0xddc0('0x35')]][_0xddc0('0x53')]=_0x1b9405[_0xddc0('0x49')];this[_0xddc0('0x1d')][_0x1b9405[_0xddc0('0x35')]][_0xddc0('0x54')]=_0x1b9405[_0xddc0('0x4c')];if(_0x1b9405[_0xddc0('0x49')]==='set'&&_[_0xddc0('0x55')](_0x1b9405[_0xddc0('0x4c')],_0xddc0('0x56'))){var _0x3fc95b=_0x1b9405[_0xddc0('0x4c')][_0xddc0('0x42')]('=');var _0x14d9f4=_0x3fc95b[0x0][_0xddc0('0x57')](/cdr\((.*)\)/);if(_0x14d9f4){this[_0xddc0('0x1d')][_0x1b9405[_0xddc0('0x35')]][_0x14d9f4[0x1]]=_0x3fc95b[0x1];}}else if(_0x1b9405[_0xddc0('0x49')]==='queue'){this[_0xddc0('0x1d')][_0x1b9405[_0xddc0('0x35')]][_0xddc0('0x58')]=_0x1b9405[_0xddc0('0x4c')]['split'](',')[0x0];}}}}}catch(_0x182506){logger[_0xddc0('0x39')](_0xddc0('0x59'),util['inspect'](_0x182506,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xddc0('0x32')][_0xddc0('0x24')]=function(_0x4e2d7e){try{if(this[_0xddc0('0x33')](_0x4e2d7e)){if(_0x4e2d7e[_0xddc0('0x35')]!==_0x4e2d7e[_0xddc0('0x36')]){if(this[_0xddc0('0x1d')][_0x4e2d7e[_0xddc0('0x36')]]){if(_0x4e2d7e[_0xddc0('0x40')]==='6'){if(!this[_0xddc0('0x1d')][_0x4e2d7e['linkedid']][_0xddc0('0x5a')]){var _0x4b7039=moment();this['channels'][_0x4e2d7e[_0xddc0('0x36')]]['answered']=!![];this[_0xddc0('0x1d')][_0x4e2d7e[_0xddc0('0x36')]][_0xddc0('0x5b')]=_0x4b7039[_0xddc0('0x3d')](_0xddc0('0x3e'));if(this[_0xddc0('0x1d')][_0x4e2d7e[_0xddc0('0x36')]][_0xddc0('0x4d')]){this[_0xddc0('0x1d')][_0x4e2d7e[_0xddc0('0x36')]][_0xddc0('0x5c')]=_0x4b7039['diff'](this[_0xddc0('0x1d')][_0x4e2d7e['linkedid']]['starttime'],_0xddc0('0x50'));}}this['channels'][_0x4e2d7e[_0xddc0('0x36')]]['linkedid']=_0x4e2d7e[_0xddc0('0x35')];if(_0x4e2d7e['calleridnum']!=='xcally-motion-preview'){this[_0xddc0('0x1d')][_0x4e2d7e[_0xddc0('0x36')]]['connectedlinenum']=_0x4e2d7e[_0xddc0('0x5d')];}this[_0xddc0('0x1d')][_0x4e2d7e[_0xddc0('0x36')]][_0xddc0('0x5e')]=_0x4e2d7e['calleridname'];this['channels'][_0x4e2d7e[_0xddc0('0x36')]][_0xddc0('0x5f')]=_0x4e2d7e[_0xddc0('0x3c')];this[_0xddc0('0x1d')][_0x4e2d7e['linkedid']]['disposition']=dispositions[_['toNumber'](_0x4e2d7e[_0xddc0('0x40')])];if(this[_0xddc0('0x1e')][_0x4e2d7e[_0xddc0('0x3c')]['split']('-')[0x0]]){this[_0xddc0('0x1d')][_0x4e2d7e[_0xddc0('0x36')]][_0xddc0('0x60')]=this[_0xddc0('0x1e')][_0x4e2d7e['channel'][_0xddc0('0x42')]('-')[0x0]]['id'];this['channels'][_0x4e2d7e[_0xddc0('0x36')]]['membername']=this[_0xddc0('0x1e')][_0x4e2d7e['channel']['split']('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x4e2d7e[_0xddc0('0x35')]]){if(_0x4e2d7e['channelstate']==='6'){if(this['agents'][_0x4e2d7e[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]]){this[_0xddc0('0x1d')][_0x4e2d7e[_0xddc0('0x35')]][_0xddc0('0x60')]=this[_0xddc0('0x1e')][_0x4e2d7e[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]]['id'];this[_0xddc0('0x1d')][_0x4e2d7e['uniqueid']]['membername']=this[_0xddc0('0x1e')][_0x4e2d7e['channel'][_0xddc0('0x42')]('-')[0x0]]['name'];}}}}}}catch(_0x5dd5e2){logger[_0xddc0('0x39')](_0xddc0('0x61'),util[_0xddc0('0x3b')](_0x5dd5e2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xddc0('0x32')][_0xddc0('0x62')]=function(_0x4ba73d,_0x475128){if(this[_0xddc0('0x1d')][_0x4ba73d]){this['channels'][_0x4ba73d][_0xddc0('0x63')]=!![];if(_[_0xddc0('0x64')](_0x475128,_0xddc0('0x65'))){_0x475128=_0x475128[_0xddc0('0x66')](_0xddc0('0x65'),'.WAV');}this['channels'][_0x4ba73d]['monitorFilename']=_0x475128;var _0x3bb268=_['find'](this[_0xddc0('0x1d')][_0x4ba73d][_0xddc0('0x67')],{'filename':_0x475128});if(_['isNil'](_0x3bb268)){this[_0xddc0('0x1d')][_0x4ba73d]['monitors'][_0xddc0('0x68')]({'filename':_0x475128,'createdAt':moment()[_0xddc0('0x3d')](_0xddc0('0x3e')),'mixmonitorid':'','status':_0xddc0('0x69')});}}};VoiceCallReport[_0xddc0('0x32')][_0xddc0('0x26')]=function(_0x196707){try{if(this[_0xddc0('0x33')](_0x196707)){if(this[_0xddc0('0x1d')][_0x196707['uniqueid']]&&_0x196707[_0xddc0('0x3c')]!=_0xddc0('0x48')){if(this['isNotNull'](_0x196707['variable'])){if(this[_0xddc0('0x33')](_0x196707['variable'][_0xddc0('0x6a')])){this[_0xddc0('0x62')](_0x196707[_0xddc0('0x35')],_0x196707[_0xddc0('0x6b')]);}else if(this[_0xddc0('0x33')](_0x196707[_0xddc0('0x6c')][_0xddc0('0x6d')])){this[_0xddc0('0x1d')][_0x196707[_0xddc0('0x35')]][_0xddc0('0x5d')]=_0x196707[_0xddc0('0x6b')];}else if(this[_0xddc0('0x33')](_0x196707[_0xddc0('0x6c')]['xmd-callerid'])){this['channels'][_0x196707[_0xddc0('0x35')]][_0xddc0('0x6e')]=_0x196707[_0xddc0('0x6b')];}else if(this['isNotNull'](_0x196707[_0xddc0('0x6c')]['xmd-cdrtype'])){this[_0xddc0('0x1d')][_0x196707['uniqueid']][_0xddc0('0x6f')]=_0x196707[_0xddc0('0x6b')];}else if(this[_0xddc0('0x33')](_0x196707[_0xddc0('0x6c')][_0xddc0('0x70')])){this[_0xddc0('0x1d')][_0x196707['uniqueid']][_0xddc0('0x58')]=_0x196707[_0xddc0('0x6b')]['split'](',')[0x0];}else if(this['isNotNull'](_0x196707[_0xddc0('0x6c')][_0xddc0('0x71')])){this[_0xddc0('0x1d')][_0x196707[_0xddc0('0x35')]]['originatecalleridnum']=_0x196707[_0xddc0('0x6b')];}else if(this[_0xddc0('0x33')](_0x196707[_0xddc0('0x6c')][_0xddc0('0x72')])){this[_0xddc0('0x1d')][_0x196707[_0xddc0('0x35')]][_0xddc0('0x73')]=_0x196707[_0xddc0('0x6b')];}else if(this[_0xddc0('0x33')](_0x196707[_0xddc0('0x6c')][_0xddc0('0x74')])){this[_0xddc0('0x1d')][_0x196707[_0xddc0('0x35')]][_0xddc0('0x75')]=_0x196707[_0xddc0('0x6b')];}else if(this[_0xddc0('0x33')](_0x196707['variable']['xmcs-queue'])){this[_0xddc0('0x1d')][_0x196707[_0xddc0('0x35')]][_0xddc0('0x58')]=_0x196707[_0xddc0('0x6b')];}else if(this['isNotNull'](_0x196707[_0xddc0('0x6c')][_0xddc0('0x76')])){this['channels'][_0x196707['uniqueid']][_0xddc0('0x77')]=_0x196707['value'];}}}else if(this['isNotNull'](_0x196707[_0xddc0('0x6c')][_0xddc0('0x6a')])){if(_0x196707['value']){var _0x4f076f=path[_0xddc0('0x78')](_0x196707[_0xddc0('0x6b')])[_0xddc0('0x45')];this['syncMixMonitorFilename'](_0x4f076f,_0x196707[_0xddc0('0x6b')]);}}else if(this[_0xddc0('0x1d')][_0x196707[_0xddc0('0x36')]]){if(this[_0xddc0('0x33')](_0x196707[_0xddc0('0x6c')])){if(this['isNotNull'](_0x196707[_0xddc0('0x6c')][_0xddc0('0x76')])){this[_0xddc0('0x1d')][_0x196707['linkedid']][_0xddc0('0x79')]=_0x196707[_0xddc0('0x6b')];}}}}}catch(_0x287e5e){logger[_0xddc0('0x39')](_0xddc0('0x7a'),util[_0xddc0('0x3b')](_0x287e5e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xddc0('0x27')]=function(_0x2f9610){try{if(this[_0xddc0('0x33')](_0x2f9610)){if(this[_0xddc0('0x1d')][_0x2f9610['uniqueid']]){var _0x20fa0d=moment();this[_0xddc0('0x1d')][_0x2f9610[_0xddc0('0x35')]][_0xddc0('0x7b')]=_0x20fa0d[_0xddc0('0x3d')](_0xddc0('0x3e'));this[_0xddc0('0x1d')][_0x2f9610['uniqueid']]['duration']=_0x20fa0d[_0xddc0('0x7c')](this[_0xddc0('0x1d')][_0x2f9610[_0xddc0('0x35')]][_0xddc0('0x4d')],_0xddc0('0x50'));if(this[_0xddc0('0x1d')][_0x2f9610['uniqueid']]['answered']){this[_0xddc0('0x1d')][_0x2f9610[_0xddc0('0x35')]]['billableseconds']=_0x20fa0d[_0xddc0('0x7c')](this['channels'][_0x2f9610[_0xddc0('0x35')]][_0xddc0('0x5b')],_0xddc0('0x50'));this[_0xddc0('0x1d')][_0x2f9610[_0xddc0('0x35')]][_0xddc0('0x5c')]=this[_0xddc0('0x1d')][_0x2f9610[_0xddc0('0x35')]]['duration']-this[_0xddc0('0x1d')][_0x2f9610['uniqueid']]['billableseconds'];}if(_0x2f9610[_0xddc0('0x7d')]===_0xddc0('0x7e')){if(this[_0xddc0('0x1e')][_0x2f9610[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]]){this[_0xddc0('0x1e')][_0x2f9610[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]]=_[_0xddc0('0x7f')](this[_0xddc0('0x1e')][_0x2f9610[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]],['destconnectedlinenum']);this[_0xddc0('0x43')](util['format']('user:%s',this[_0xddc0('0x1e')][_0x2f9610[_0xddc0('0x3c')]['split']('-')[0x0]]['name']),_0xddc0('0x80'),{'destaccountcode':this['agents'][_0x2f9610[_0xddc0('0x3c')][_0xddc0('0x42')]('-')[0x0]][_0xddc0('0x81')]});}}ami[_0xddc0('0x43')]('custom:voiceCallReport',this[_0xddc0('0x1d')][_0x2f9610[_0xddc0('0x35')]]);delete this[_0xddc0('0x1d')][_0x2f9610[_0xddc0('0x35')]];}}}catch(_0x4ee91d){logger[_0xddc0('0x39')](_0xddc0('0x82'),util[_0xddc0('0x3b')](_0x4ee91d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xddc0('0x32')][_0xddc0('0x2b')]=function(_0x4a0e3d){try{if(this[_0xddc0('0x33')](_0x4a0e3d)){if(this[_0xddc0('0x1d')][_0x4a0e3d['transfereeuniqueid']]){this[_0xddc0('0x1d')][_0x4a0e3d[_0xddc0('0x83')]][_0xddc0('0x84')]=_0x4a0e3d[_0xddc0('0x85')];this['channels'][_0x4a0e3d[_0xddc0('0x83')]][_0xddc0('0x86')]=_0x4a0e3d['transfertargetcalleridnum'];if(this['channels'][_0x4a0e3d['secondtransfereruniqueid']]){var _0x4995e1=this[_0xddc0('0x1d')][_0x4a0e3d[_0xddc0('0x87')]];this['channels'][_0x4a0e3d[_0xddc0('0x87')]]=this[_0xddc0('0x1d')][_0x4a0e3d[_0xddc0('0x83')]];this[_0xddc0('0x1d')][_0x4a0e3d[_0xddc0('0x83')]]=_0x4995e1;}}else if(this[_0xddc0('0x1d')][_0x4a0e3d['transfertargetuniqueid']]){this[_0xddc0('0x1d')][_0x4a0e3d[_0xddc0('0x88')]][_0xddc0('0x84')]=_0x4a0e3d['origtransferercalleridnum'];this['channels'][_0x4a0e3d[_0xddc0('0x88')]]['transferconnectedlinenum']=_0x4a0e3d[_0xddc0('0x89')];if(this[_0xddc0('0x1d')][_0x4a0e3d[_0xddc0('0x8a')]]){var _0x4995e1=this[_0xddc0('0x1d')][_0x4a0e3d['origtransfereruniqueid']];this['channels'][_0x4a0e3d['origtransfereruniqueid']]=this[_0xddc0('0x1d')][_0x4a0e3d[_0xddc0('0x88')]];this[_0xddc0('0x1d')][_0x4a0e3d[_0xddc0('0x88')]]=_0x4995e1;}}}}catch(_0x5ac34e){logger['error'](_0xddc0('0x8b'),util[_0xddc0('0x3b')](_0x5ac34e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xddc0('0x2c')]=function(_0x531e00){try{if(this[_0xddc0('0x33')](_0x531e00)){if(this[_0xddc0('0x1d')][_0x531e00[_0xddc0('0x83')]]){this['channels'][_0x531e00[_0xddc0('0x83')]][_0xddc0('0x84')]=_0x531e00[_0xddc0('0x8c')];this[_0xddc0('0x1d')][_0x531e00['transfereeuniqueid']][_0xddc0('0x86')]=_0x531e00['extension'];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x531e00[_0xddc0('0x83')],'context':_0x531e00[_0xddc0('0x7d')],'channel':_0x531e00[_0xddc0('0x8d')]});}}}catch(_0x3cd3a7){logger[_0xddc0('0x39')](_0xddc0('0x8e'),util[_0xddc0('0x3b')](_0x3cd3a7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xddc0('0x32')]['syncMusicOnHoldStart']=function(_0x36a8fc){try{if(this[_0xddc0('0x33')](_0x36a8fc)){if(this[_0xddc0('0x1d')][_0x36a8fc['uniqueid']]){if(!_[_0xddc0('0x8f')](this[_0xddc0('0x1d')][_0x36a8fc['uniqueid']][_0xddc0('0x5b')])){this['channels'][_0x36a8fc[_0xddc0('0x35')]][_0xddc0('0x90')]=moment()[_0xddc0('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x204666){logger[_0xddc0('0x39')](_0xddc0('0x91'),util[_0xddc0('0x3b')](_0x204666,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xddc0('0x32')]['syncMusicOnHoldStop']=function(_0x487502){try{if(this[_0xddc0('0x33')](_0x487502)){if(this[_0xddc0('0x1d')][_0x487502[_0xddc0('0x35')]]){if(!_['isNil'](this[_0xddc0('0x1d')][_0x487502[_0xddc0('0x35')]]['mohstarttime'])){this[_0xddc0('0x1d')][_0x487502[_0xddc0('0x35')]][_0xddc0('0x92')]+=moment()[_0xddc0('0x93')](0x0)[_0xddc0('0x7c')](this[_0xddc0('0x1d')][_0x487502[_0xddc0('0x35')]]['mohstarttime'],'seconds');delete this[_0xddc0('0x1d')][_0x487502[_0xddc0('0x35')]]['mohstarttime'];}}}}catch(_0x3c84d6){logger[_0xddc0('0x39')](_0xddc0('0x94'),util['inspect'](_0x3c84d6,{'showHidden':![],'depth':null}));}};module[_0xddc0('0x95')]=VoiceCallReport; \ No newline at end of file +var _0xd4d1=['lodash','moment','util','path','../../../config/environment','ami','../model/channel','not_inuse','inuse','busy','unavailable','ringinuse','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','channels','agents','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','prototype','isNotNull','emit','syncNewCallerId','uniqueid','isUndefined','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','linkedid','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','accountcode','inspect','application','toLowerCase','appdata','applicationdata','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','[syncNewExten][VoiceCallReport]','answered','diff','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','.wav49','replace','.WAV','monitorFilename','isNil','push','rec','variable','mixmonitor_filename','value','xmd-callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','sipcallid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','answertime','holdtime','context','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird'];(function(_0x553411,_0x2091f6){var _0xab0868=function(_0x53171b){while(--_0x53171b){_0x553411['push'](_0x553411['shift']());}};_0xab0868(++_0x2091f6);}(_0xd4d1,0x123));var _0x1d4d=function(_0x2d9465,_0x2416dd){_0x2d9465=_0x2d9465-0x0;var _0x36c8dd=_0xd4d1[_0x2d9465];return _0x36c8dd;};'use strict';var BPromise=require(_0x1d4d('0x0'));var _=require(_0x1d4d('0x1'));var moment=require(_0x1d4d('0x2'));var util=require(_0x1d4d('0x3'));var path=require(_0x1d4d('0x4'));var Redis=require('ioredis');var config=require(_0x1d4d('0x5'));var logger=require('../../../config/logger')(_0x1d4d('0x6'));var ami=require('../ami');var Channel=require(_0x1d4d('0x7'));var statusDesc=['unknown',_0x1d4d('0x8'),_0x1d4d('0x9'),_0x1d4d('0xa'),'invalid',_0x1d4d('0xb'),'ringing',_0x1d4d('0xc'),'onhold'];var applications=[_0x1d4d('0xd'),_0x1d4d('0xe'),_0x1d4d('0xf'),'dial',_0x1d4d('0x10'),_0x1d4d('0x11')];var dispositions=[_0x1d4d('0x12'),'FAILED',_0x1d4d('0x13'),_0x1d4d('0x12'),_0x1d4d('0x12'),_0x1d4d('0x12'),_0x1d4d('0x14'),_0x1d4d('0x15'),_0x1d4d('0x13'),_0x1d4d('0x13'),_0x1d4d('0x13')];var actions={};config[_0x1d4d('0x16')]=_['defaults'](config[_0x1d4d('0x16')],{'host':_0x1d4d('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x5d85d2){this[_0x1d4d('0x18')]=_0x5d85d2['channels'];this[_0x1d4d('0x19')]=_0x5d85d2['agents'];ami['on']('coreshowchannel',this[_0x1d4d('0x1a')][_0x1d4d('0x1b')](this));ami['on']('newexten',this[_0x1d4d('0x1a')]['bind'](this));ami['on'](_0x1d4d('0x1c'),this[_0x1d4d('0x1d')][_0x1d4d('0x1b')](this));ami['on'](_0x1d4d('0x1e'),this[_0x1d4d('0x1f')]['bind'](this));ami['on'](_0x1d4d('0x20'),this[_0x1d4d('0x21')]['bind'](this));ami['on']('hangup',this[_0x1d4d('0x22')][_0x1d4d('0x1b')](this));ami['on'](_0x1d4d('0x23'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x1d4d('0x1b')](this));ami['on'](_0x1d4d('0x24'),this[_0x1d4d('0x25')]['bind'](this));ami['on'](_0x1d4d('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x1d4d('0x27'),this[_0x1d4d('0x28')][_0x1d4d('0x1b')](this));return BPromise['resolve']()[_0x1d4d('0x29')](ami[_0x1d4d('0x2a')]())[_0x1d4d('0x2b')](function(_0x31affb){console['log'](_0x31affb);});}VoiceCallReport[_0x1d4d('0x2c')][_0x1d4d('0x2d')]=function(_0x14b4e9){return _0x14b4e9!==null&&!_['isUndefined'](_0x14b4e9);};VoiceCallReport[_0x1d4d('0x2c')]['emit']=function(_0x4f7644,_0x1a0cd3,_0x9cb611){io['to'](_0x4f7644)[_0x1d4d('0x2e')](_0x1a0cd3,_0x9cb611);};VoiceCallReport[_0x1d4d('0x2c')][_0x1d4d('0x2f')]=function(_0x575ff3){try{if(this[_0x1d4d('0x2d')](_0x575ff3)){if(_0x575ff3[_0x1d4d('0x30')]===_0x575ff3['linkedid']){if(!_[_0x1d4d('0x31')](this[_0x1d4d('0x18')][_0x575ff3['uniqueid']])){_[_0x1d4d('0x32')](this[_0x1d4d('0x18')][_0x575ff3[_0x1d4d('0x30')]],_[_0x1d4d('0x33')](_0x575ff3,_[_0x1d4d('0x34')](this[_0x1d4d('0x18')][_0x575ff3[_0x1d4d('0x30')]])));}}}}catch(_0x5c7d26){logger[_0x1d4d('0x35')](_0x1d4d('0x36'),util['inspect'](_0x5c7d26,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1d4d('0x2c')]['syncNewChannel']=function(_0x10338b){try{if(this[_0x1d4d('0x2d')](_0x10338b)){if(_0x10338b[_0x1d4d('0x30')]===_0x10338b[_0x1d4d('0x37')]&&_0x10338b[_0x1d4d('0x38')]!=_0x1d4d('0x39')){if(_[_0x1d4d('0x31')](this[_0x1d4d('0x18')][_0x10338b[_0x1d4d('0x30')]])){this['channels'][_0x10338b['uniqueid']]=new Channel();this[_0x1d4d('0x18')][_0x10338b['uniqueid']][_0x1d4d('0x3a')]=moment()[_0x1d4d('0x3b')](_0x1d4d('0x3c'));this[_0x1d4d('0x18')][_0x10338b[_0x1d4d('0x30')]][_0x1d4d('0x3d')]=dispositions[_[_0x1d4d('0x3e')](_0x10338b[_0x1d4d('0x3f')])];_[_0x1d4d('0x32')](this[_0x1d4d('0x18')][_0x10338b[_0x1d4d('0x30')]],_[_0x1d4d('0x33')](_0x10338b,_[_0x1d4d('0x34')](this['channels'][_0x10338b[_0x1d4d('0x30')]])));if(_0x10338b['context']===_0x1d4d('0x40')){if(this[_0x1d4d('0x19')][_0x10338b['channel'][_0x1d4d('0x41')]('-')[0x0]]){this['agents'][_0x10338b[_0x1d4d('0x38')][_0x1d4d('0x41')]('-')[0x0]][_0x1d4d('0x42')]=_0x10338b[_0x1d4d('0x43')];this['emit'](util[_0x1d4d('0x3b')](_0x1d4d('0x44'),this['agents'][_0x10338b[_0x1d4d('0x38')][_0x1d4d('0x41')]('-')[0x0]][_0x1d4d('0x45')]),_0x1d4d('0x46'),{'destaccountcode':this['agents'][_0x10338b[_0x1d4d('0x38')]['split']('-')[0x0]][_0x1d4d('0x47')],'destconnectedlinenum':_0x10338b[_0x1d4d('0x43')]});}}}}}}catch(_0x7b40b0){logger['error']('[syncNewChannel][VoiceCallReport]',util[_0x1d4d('0x48')](_0x7b40b0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1d4d('0x2c')]['syncNewExten']=function(_0x2eb4c0){try{if(this[_0x1d4d('0x2d')](_0x2eb4c0)){if(_0x2eb4c0[_0x1d4d('0x30')]===_0x2eb4c0[_0x1d4d('0x37')]&&_0x2eb4c0[_0x1d4d('0x43')]!='h'&&_0x2eb4c0[_0x1d4d('0x38')]!='OutgoingSpoolFailed'){_0x2eb4c0[_0x1d4d('0x49')]=_0x2eb4c0[_0x1d4d('0x49')][_0x1d4d('0x4a')]();_0x2eb4c0['applicationdata']=(_0x2eb4c0[_0x1d4d('0x4b')]||_0x2eb4c0[_0x1d4d('0x4c')])['toLowerCase']();if(_[_0x1d4d('0x31')](this[_0x1d4d('0x18')][_0x2eb4c0[_0x1d4d('0x30')]])){this[_0x1d4d('0x18')][_0x2eb4c0['uniqueid']]=new Channel();this['channels'][_0x2eb4c0['uniqueid']]['starttime']=_0x2eb4c0[_0x1d4d('0x4d')]?moment()[_0x1d4d('0x4e')](moment[_0x1d4d('0x4d')](_0x2eb4c0[_0x1d4d('0x4d')])[_0x1d4d('0x4f')](),_0x1d4d('0x4f'))[_0x1d4d('0x3b')](_0x1d4d('0x3c')):moment()['format'](_0x1d4d('0x3c'));this[_0x1d4d('0x18')][_0x2eb4c0[_0x1d4d('0x30')]][_0x1d4d('0x3d')]='NO\x20ANSWER';}_[_0x1d4d('0x32')](this[_0x1d4d('0x18')][_0x2eb4c0[_0x1d4d('0x30')]],_[_0x1d4d('0x33')](_0x2eb4c0,_[_0x1d4d('0x34')](this[_0x1d4d('0x18')][_0x2eb4c0['uniqueid']])));if(_[_0x1d4d('0x50')](applications,_0x2eb4c0[_0x1d4d('0x49')])){this[_0x1d4d('0x18')][_0x2eb4c0['uniqueid']][_0x1d4d('0x51')]=_0x2eb4c0['application'];this['channels'][_0x2eb4c0[_0x1d4d('0x30')]][_0x1d4d('0x52')]=_0x2eb4c0['applicationdata'];if(_0x2eb4c0['application']===_0x1d4d('0xd')&&_['startsWith'](_0x2eb4c0[_0x1d4d('0x4c')],_0x1d4d('0x53'))){var _0x9dd1a5=_0x2eb4c0[_0x1d4d('0x4c')]['split']('=');var _0x27b68d=_0x9dd1a5[0x0]['match'](/cdr\((.*)\)/);if(_0x27b68d){this['channels'][_0x2eb4c0['uniqueid']][_0x27b68d[0x1]]=_0x9dd1a5[0x1];}}else if(_0x2eb4c0[_0x1d4d('0x49')]===_0x1d4d('0xe')){this[_0x1d4d('0x18')][_0x2eb4c0[_0x1d4d('0x30')]][_0x1d4d('0xe')]=_0x2eb4c0[_0x1d4d('0x4c')][_0x1d4d('0x41')](',')[0x0];}}}}}catch(_0x792751){logger[_0x1d4d('0x35')](_0x1d4d('0x54'),util[_0x1d4d('0x48')](_0x792751,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1d4d('0x2c')][_0x1d4d('0x1f')]=function(_0x3b84ce){try{if(this['isNotNull'](_0x3b84ce)){if(_0x3b84ce['uniqueid']!==_0x3b84ce[_0x1d4d('0x37')]){if(this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]]){if(_0x3b84ce[_0x1d4d('0x3f')]==='6'){if(!this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]][_0x1d4d('0x55')]){var _0x522616=moment();this['channels'][_0x3b84ce[_0x1d4d('0x37')]]['answered']=!![];this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]]['answertime']=_0x522616['format'](_0x1d4d('0x3c'));if(this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]][_0x1d4d('0x3a')]){this['channels'][_0x3b84ce[_0x1d4d('0x37')]]['holdtime']=_0x522616[_0x1d4d('0x56')](this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]][_0x1d4d('0x3a')],_0x1d4d('0x4f'));}}this[_0x1d4d('0x18')][_0x3b84ce['linkedid']][_0x1d4d('0x37')]=_0x3b84ce['uniqueid'];if(_0x3b84ce['calleridnum']!==_0x1d4d('0x57')){this['channels'][_0x3b84ce[_0x1d4d('0x37')]][_0x1d4d('0x58')]=_0x3b84ce[_0x1d4d('0x59')];}this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]][_0x1d4d('0x5a')]=_0x3b84ce['calleridname'];this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]][_0x1d4d('0x5b')]=_0x3b84ce[_0x1d4d('0x38')];this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]]['disposition']=dispositions[_[_0x1d4d('0x3e')](_0x3b84ce[_0x1d4d('0x3f')])];if(this[_0x1d4d('0x19')][_0x3b84ce[_0x1d4d('0x38')][_0x1d4d('0x41')]('-')[0x0]]){this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]][_0x1d4d('0x5c')]=this['agents'][_0x3b84ce[_0x1d4d('0x38')][_0x1d4d('0x41')]('-')[0x0]]['id'];this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x37')]][_0x1d4d('0x5d')]=this[_0x1d4d('0x19')][_0x3b84ce['channel'][_0x1d4d('0x41')]('-')[0x0]][_0x1d4d('0x45')];}}}}else{if(this[_0x1d4d('0x18')][_0x3b84ce[_0x1d4d('0x30')]]){if(_0x3b84ce[_0x1d4d('0x3f')]==='6'){if(this[_0x1d4d('0x19')][_0x3b84ce['channel'][_0x1d4d('0x41')]('-')[0x0]]){this['channels'][_0x3b84ce['uniqueid']][_0x1d4d('0x5c')]=this[_0x1d4d('0x19')][_0x3b84ce['channel'][_0x1d4d('0x41')]('-')[0x0]]['id'];this['channels'][_0x3b84ce[_0x1d4d('0x30')]][_0x1d4d('0x5d')]=this[_0x1d4d('0x19')][_0x3b84ce[_0x1d4d('0x38')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x123a94){logger[_0x1d4d('0x35')](_0x1d4d('0x5e'),util[_0x1d4d('0x48')](_0x123a94,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1d4d('0x2c')][_0x1d4d('0x5f')]=function(_0x38fd9b,_0x5593b2){if(this['channels'][_0x38fd9b]){this['channels'][_0x38fd9b][_0x1d4d('0x60')]=!![];if(_['endsWith'](_0x5593b2,_0x1d4d('0x61'))){_0x5593b2=_0x5593b2[_0x1d4d('0x62')]('.wav49',_0x1d4d('0x63'));}this[_0x1d4d('0x18')][_0x38fd9b][_0x1d4d('0x64')]=_0x5593b2;var _0x1e98f3=_['find'](this['channels'][_0x38fd9b]['monitors'],{'filename':_0x5593b2});if(_[_0x1d4d('0x65')](_0x1e98f3)){this[_0x1d4d('0x18')][_0x38fd9b]['monitors'][_0x1d4d('0x66')]({'filename':_0x5593b2,'createdAt':moment()[_0x1d4d('0x3b')](_0x1d4d('0x3c')),'mixmonitorid':'','status':_0x1d4d('0x67')});}}};VoiceCallReport[_0x1d4d('0x2c')][_0x1d4d('0x21')]=function(_0xc6a7f8){try{if(this[_0x1d4d('0x2d')](_0xc6a7f8)){if(this[_0x1d4d('0x18')][_0xc6a7f8[_0x1d4d('0x30')]]&&_0xc6a7f8[_0x1d4d('0x38')]!=_0x1d4d('0x39')){if(this[_0x1d4d('0x2d')](_0xc6a7f8[_0x1d4d('0x68')])){if(this[_0x1d4d('0x2d')](_0xc6a7f8[_0x1d4d('0x68')][_0x1d4d('0x69')])){this[_0x1d4d('0x5f')](_0xc6a7f8[_0x1d4d('0x30')],_0xc6a7f8[_0x1d4d('0x6a')]);}else if(this['isNotNull'](_0xc6a7f8[_0x1d4d('0x68')]['xmd-phone'])){this[_0x1d4d('0x18')][_0xc6a7f8[_0x1d4d('0x30')]][_0x1d4d('0x59')]=_0xc6a7f8[_0x1d4d('0x6a')];}else if(this[_0x1d4d('0x2d')](_0xc6a7f8[_0x1d4d('0x68')][_0x1d4d('0x6b')])){this[_0x1d4d('0x18')][_0xc6a7f8['uniqueid']]['callerid']=_0xc6a7f8[_0x1d4d('0x6a')];}else if(this[_0x1d4d('0x2d')](_0xc6a7f8['variable'][_0x1d4d('0x6c')])){this[_0x1d4d('0x18')][_0xc6a7f8[_0x1d4d('0x30')]][_0x1d4d('0x6d')]=_0xc6a7f8[_0x1d4d('0x6a')];}else if(this['isNotNull'](_0xc6a7f8['variable'][_0x1d4d('0x6e')])){this[_0x1d4d('0x18')][_0xc6a7f8[_0x1d4d('0x30')]]['queue']=_0xc6a7f8['value'][_0x1d4d('0x41')](',')[0x0];}else if(this[_0x1d4d('0x2d')](_0xc6a7f8[_0x1d4d('0x68')][_0x1d4d('0x6f')])){this['channels'][_0xc6a7f8['uniqueid']]['originatecalleridnum']=_0xc6a7f8[_0x1d4d('0x6a')];}else if(this[_0x1d4d('0x2d')](_0xc6a7f8['variable'][_0x1d4d('0x70')])){this[_0x1d4d('0x18')][_0xc6a7f8[_0x1d4d('0x30')]][_0x1d4d('0x71')]=_0xc6a7f8[_0x1d4d('0x6a')];}else if(this[_0x1d4d('0x2d')](_0xc6a7f8['variable'][_0x1d4d('0x72')])){this[_0x1d4d('0x18')][_0xc6a7f8[_0x1d4d('0x30')]]['calleridpreview']=_0xc6a7f8[_0x1d4d('0x6a')];}else if(this['isNotNull'](_0xc6a7f8[_0x1d4d('0x68')]['xmcs-queue'])){this['channels'][_0xc6a7f8[_0x1d4d('0x30')]]['queue']=_0xc6a7f8['value'];}else if(this[_0x1d4d('0x2d')](_0xc6a7f8[_0x1d4d('0x68')][_0x1d4d('0x73')])){this[_0x1d4d('0x18')][_0xc6a7f8[_0x1d4d('0x30')]]['sipcalluniqueid']=_0xc6a7f8[_0x1d4d('0x6a')];}}}else if(this['isNotNull'](_0xc6a7f8[_0x1d4d('0x68')][_0x1d4d('0x69')])){if(_0xc6a7f8['value']){var _0x150b0b=path[_0x1d4d('0x74')](_0xc6a7f8[_0x1d4d('0x6a')])[_0x1d4d('0x45')];this['syncMixMonitorFilename'](_0x150b0b,_0xc6a7f8['value']);}}else if(this[_0x1d4d('0x18')][_0xc6a7f8['linkedid']]){if(this[_0x1d4d('0x2d')](_0xc6a7f8['variable'])){if(this[_0x1d4d('0x2d')](_0xc6a7f8[_0x1d4d('0x68')][_0x1d4d('0x73')])){this[_0x1d4d('0x18')][_0xc6a7f8[_0x1d4d('0x37')]][_0x1d4d('0x75')]=_0xc6a7f8[_0x1d4d('0x6a')];}}}}}catch(_0xf4e0fa){logger[_0x1d4d('0x35')](_0x1d4d('0x76'),util[_0x1d4d('0x48')](_0xf4e0fa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1d4d('0x2c')]['syncHangup']=function(_0x21150b){try{if(this[_0x1d4d('0x2d')](_0x21150b)){if(this[_0x1d4d('0x18')][_0x21150b[_0x1d4d('0x30')]]){var _0x508a87=moment();this[_0x1d4d('0x18')][_0x21150b[_0x1d4d('0x30')]][_0x1d4d('0x77')]=_0x508a87['format'](_0x1d4d('0x3c'));this['channels'][_0x21150b[_0x1d4d('0x30')]][_0x1d4d('0x4d')]=_0x508a87[_0x1d4d('0x56')](this[_0x1d4d('0x18')][_0x21150b[_0x1d4d('0x30')]]['starttime'],_0x1d4d('0x4f'));if(this['channels'][_0x21150b[_0x1d4d('0x30')]][_0x1d4d('0x55')]){this[_0x1d4d('0x18')][_0x21150b['uniqueid']][_0x1d4d('0x78')]=_0x508a87['diff'](this[_0x1d4d('0x18')][_0x21150b[_0x1d4d('0x30')]][_0x1d4d('0x79')],_0x1d4d('0x4f'));this[_0x1d4d('0x18')][_0x21150b[_0x1d4d('0x30')]][_0x1d4d('0x7a')]=this[_0x1d4d('0x18')][_0x21150b[_0x1d4d('0x30')]][_0x1d4d('0x4d')]-this[_0x1d4d('0x18')][_0x21150b[_0x1d4d('0x30')]][_0x1d4d('0x78')];}if(_0x21150b[_0x1d4d('0x7b')]===_0x1d4d('0x40')){if(this[_0x1d4d('0x19')][_0x21150b[_0x1d4d('0x38')][_0x1d4d('0x41')]('-')[0x0]]){this[_0x1d4d('0x19')][_0x21150b[_0x1d4d('0x38')][_0x1d4d('0x41')]('-')[0x0]]=_[_0x1d4d('0x7c')](this['agents'][_0x21150b[_0x1d4d('0x38')][_0x1d4d('0x41')]('-')[0x0]],['destconnectedlinenum']);this[_0x1d4d('0x2e')](util['format'](_0x1d4d('0x44'),this[_0x1d4d('0x19')][_0x21150b['channel'][_0x1d4d('0x41')]('-')[0x0]][_0x1d4d('0x45')]),_0x1d4d('0x7d'),{'destaccountcode':this[_0x1d4d('0x19')][_0x21150b[_0x1d4d('0x38')]['split']('-')[0x0]][_0x1d4d('0x47')]});}}ami[_0x1d4d('0x2e')](_0x1d4d('0x7e'),this[_0x1d4d('0x18')][_0x21150b['uniqueid']]);delete this[_0x1d4d('0x18')][_0x21150b[_0x1d4d('0x30')]];}}}catch(_0x1664e6){logger[_0x1d4d('0x35')](_0x1d4d('0x7f'),util[_0x1d4d('0x48')](_0x1664e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1d4d('0x2c')]['syncAttendedTransfer']=function(_0x1bf4aa){try{if(this[_0x1d4d('0x2d')](_0x1bf4aa)){if(this[_0x1d4d('0x18')][_0x1bf4aa[_0x1d4d('0x80')]]){this[_0x1d4d('0x18')][_0x1bf4aa[_0x1d4d('0x80')]][_0x1d4d('0x81')]=_0x1bf4aa[_0x1d4d('0x82')];this[_0x1d4d('0x18')][_0x1bf4aa['transfereeuniqueid']][_0x1d4d('0x83')]=_0x1bf4aa[_0x1d4d('0x84')];if(this[_0x1d4d('0x18')][_0x1bf4aa[_0x1d4d('0x85')]]){var _0x9c4d51=this[_0x1d4d('0x18')][_0x1bf4aa['secondtransfereruniqueid']];this[_0x1d4d('0x18')][_0x1bf4aa[_0x1d4d('0x85')]]=this['channels'][_0x1bf4aa[_0x1d4d('0x80')]];this['channels'][_0x1bf4aa[_0x1d4d('0x80')]]=_0x9c4d51;}}else if(this['channels'][_0x1bf4aa[_0x1d4d('0x86')]]){this[_0x1d4d('0x18')][_0x1bf4aa[_0x1d4d('0x86')]][_0x1d4d('0x81')]=_0x1bf4aa[_0x1d4d('0x82')];this[_0x1d4d('0x18')][_0x1bf4aa[_0x1d4d('0x86')]]['transferconnectedlinenum']=_0x1bf4aa[_0x1d4d('0x84')];if(this['channels'][_0x1bf4aa['origtransfereruniqueid']]){var _0x9c4d51=this[_0x1d4d('0x18')][_0x1bf4aa[_0x1d4d('0x87')]];this[_0x1d4d('0x18')][_0x1bf4aa[_0x1d4d('0x87')]]=this[_0x1d4d('0x18')][_0x1bf4aa['transfertargetuniqueid']];this[_0x1d4d('0x18')][_0x1bf4aa['transfertargetuniqueid']]=_0x9c4d51;}}}}catch(_0x1ad690){logger['error'](_0x1d4d('0x88'),util[_0x1d4d('0x48')](_0x1ad690,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1d4d('0x2c')][_0x1d4d('0x25')]=function(_0x26f6f1){try{if(this[_0x1d4d('0x2d')](_0x26f6f1)){if(this[_0x1d4d('0x18')][_0x26f6f1['transfereeuniqueid']]){this[_0x1d4d('0x18')][_0x26f6f1[_0x1d4d('0x80')]]['transfercalleridnum']=_0x26f6f1[_0x1d4d('0x89')];this['channels'][_0x26f6f1['transfereeuniqueid']]['transferconnectedlinenum']=_0x26f6f1['extension'];this[_0x1d4d('0x22')]({'event':_0x1d4d('0x8a'),'uniqueid':_0x26f6f1[_0x1d4d('0x80')],'context':_0x26f6f1['context'],'channel':_0x26f6f1[_0x1d4d('0x8b')]});}}}catch(_0x24a614){logger[_0x1d4d('0x35')](_0x1d4d('0x8c'),util[_0x1d4d('0x48')](_0x24a614,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1d4d('0x8d')]=function(_0x215ce5){try{if(this[_0x1d4d('0x2d')](_0x215ce5)){if(this[_0x1d4d('0x18')][_0x215ce5['uniqueid']]){if(!_[_0x1d4d('0x65')](this[_0x1d4d('0x18')][_0x215ce5[_0x1d4d('0x30')]][_0x1d4d('0x79')])){this[_0x1d4d('0x18')][_0x215ce5[_0x1d4d('0x30')]][_0x1d4d('0x8e')]=moment()[_0x1d4d('0x3b')](_0x1d4d('0x3c'));}}}}catch(_0x472c42){logger[_0x1d4d('0x35')](_0x1d4d('0x8f'),util[_0x1d4d('0x48')](_0x472c42,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1d4d('0x2c')]['syncMusicOnHoldStop']=function(_0x849cd8){try{if(this[_0x1d4d('0x2d')](_0x849cd8)){if(this[_0x1d4d('0x18')][_0x849cd8[_0x1d4d('0x30')]]){if(!_[_0x1d4d('0x65')](this[_0x1d4d('0x18')][_0x849cd8['uniqueid']]['mohstarttime'])){this[_0x1d4d('0x18')][_0x849cd8[_0x1d4d('0x30')]]['mohtime']+=moment()['milliseconds'](0x0)[_0x1d4d('0x56')](this[_0x1d4d('0x18')][_0x849cd8[_0x1d4d('0x30')]][_0x1d4d('0x8e')],_0x1d4d('0x4f'));delete this[_0x1d4d('0x18')][_0x849cd8[_0x1d4d('0x30')]][_0x1d4d('0x8e')];}}}}catch(_0x2db435){logger[_0x1d4d('0x35')](_0x1d4d('0x90'),util['inspect'](_0x2db435,{'showHidden':![],'depth':null}));}};module[_0x1d4d('0x91')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 53c6292..bd8ee88 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 _0x4ded=['bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','isNil','includes','endtime','starttime','lastevent','complete','total','answered','holdtime','diff','seconds','billableseconds','sumHoldTime','sumBillable','custom:voiceDialReport','custom:dialend','voice_outbound:save','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','dialbegin','syncDialEnd','bind','hangup','prototype','isNotNull','isUndefined','emit','syncDialBegin','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','inspect','dialstatus','connectedlinenum','connectedlinename','answertime','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','variable','value','outboundrouteid','variables','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4ded,0x116));var _0xd4de=function(_0x41d85e,_0x5f3c5f){_0x41d85e=_0x41d85e-0x0;var _0x57d005=_0x4ded[_0x41d85e];return _0x57d005;};'use strict';var _=require(_0xd4de('0x0'));var moment=require(_0xd4de('0x1'));var util=require(_0xd4de('0x2'));var Redis=require(_0xd4de('0x3'));var config=require(_0xd4de('0x4'));var logger=require(_0xd4de('0x5'))(_0xd4de('0x6'));var ami=require(_0xd4de('0x7'));config[_0xd4de('0x8')]=_[_0xd4de('0x9')](config[_0xd4de('0x8')],{'host':_0xd4de('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4de('0x8')]));function VoiceDialReport(_0x2433b8){this[_0xd4de('0xb')]=_0x2433b8[_0xd4de('0xc')];this[_0xd4de('0xd')]=_0x2433b8[_0xd4de('0xd')];this['variables']={};ami['on'](_0xd4de('0xe'),this['syncDialBegin']['bind'](this));ami['on']('dialend',this[_0xd4de('0xf')][_0xd4de('0x10')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xd4de('0x11'),this['syncHangup'][_0xd4de('0x10')](this));}VoiceDialReport[_0xd4de('0x12')][_0xd4de('0x13')]=function(_0x2aa09d){return _0x2aa09d!==null&&!_[_0xd4de('0x14')](_0x2aa09d);};VoiceDialReport[_0xd4de('0x12')][_0xd4de('0x15')]=function(_0x1b9039,_0x3e3735,_0x37cb9f){io['to'](_0x1b9039)[_0xd4de('0x15')](_0x3e3735,_0x37cb9f);};VoiceDialReport[_0xd4de('0x12')][_0xd4de('0x16')]=function(_0xbb4f7e){try{if(this[_0xd4de('0x13')](_0xbb4f7e)){if(this[_0xd4de('0xb')][_0xbb4f7e[_0xd4de('0x17')]]){_['merge'](this['channels'][_0xbb4f7e[_0xd4de('0x17')]],{'starttime':moment()[_0xd4de('0x18')](_0xd4de('0x19')),'lastevent':_0xd4de('0x1a'),'interface':_0xbb4f7e['channel']['substring'](0x0,_0xbb4f7e[_0xd4de('0x1b')]['lastIndexOf']('-')),'membername':_0xbb4f7e[_0xd4de('0x1b')][_0xd4de('0x1c')](_0xbb4f7e['channel'][_0xd4de('0x1d')]('/')+0x1,_0xbb4f7e['channel'][_0xd4de('0x1d')]('-'))},_[_0xd4de('0x1e')](_0xbb4f7e,[_0xd4de('0x1f'),_0xd4de('0x20')]));this['emit'](_0xd4de('0x21'),_0xd4de('0x22'),this[_0xd4de('0xb')][_0xbb4f7e[_0xd4de('0x17')]]);ami[_0xd4de('0x15')](_0xd4de('0x23'),this[_0xd4de('0xb')][_0xbb4f7e[_0xd4de('0x17')]]);}}}catch(_0x2f9de6){logger[_0xd4de('0x24')]('[syncDialBegin][VoiceDialReport]',util[_0xd4de('0x25')](_0x2f9de6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd4de('0x12')][_0xd4de('0xf')]=function(_0x22970c){try{if(this[_0xd4de('0x13')](_0x22970c)){if(this[_0xd4de('0xb')][_0x22970c[_0xd4de('0x17')]]){this[_0xd4de('0xb')][_0x22970c[_0xd4de('0x17')]][_0xd4de('0x26')]=_0x22970c[_0xd4de('0x26')];if(_0x22970c[_0xd4de('0x26')]==='ANSWER'){this[_0xd4de('0xb')][_0x22970c[_0xd4de('0x17')]]['connectedlinenum']=_0x22970c[_0xd4de('0x27')];this['channels'][_0x22970c[_0xd4de('0x17')]][_0xd4de('0x28')]=_0x22970c[_0xd4de('0x28')];this['channels'][_0x22970c[_0xd4de('0x17')]][_0xd4de('0x29')]=moment()[_0xd4de('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd4de('0xb')][_0x22970c[_0xd4de('0x17')]]['lastevent']='connect';ami['emit'](_0xd4de('0x2a'),this['channels'][_0x22970c[_0xd4de('0x17')]]);}this[_0xd4de('0x15')](_0xd4de('0x21'),_0xd4de('0x22'),this['channels'][_0x22970c[_0xd4de('0x17')]]);}}}catch(_0xcd6312){logger['error'](_0xd4de('0x2b'),util[_0xd4de('0x25')](_0xcd6312,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x16e7a9){try{if(this[_0xd4de('0x13')](_0x16e7a9)){this[_0xd4de('0x2c')](_0x16e7a9[_0xd4de('0x17')],_['keys'](_0x16e7a9[_0xd4de('0x2d')])[0x0],_0x16e7a9[_0xd4de('0x2e')]);if(this['isNotNull'](_0x16e7a9[_0xd4de('0x2d')])&&this[_0xd4de('0x13')](_0x16e7a9[_0xd4de('0x2d')][_0xd4de('0x2f')])){if(_[_0xd4de('0x14')](this[_0xd4de('0xb')][_0x16e7a9['uniqueid']])){this['channels'][_0x16e7a9[_0xd4de('0x17')]]={'routeId':_0x16e7a9[_0xd4de('0x2e')],'variables':this[_0xd4de('0x30')][_0x16e7a9['uniqueid']]};this[_0xd4de('0x15')](_0xd4de('0x21'),'voice_outbound_channel:save',this[_0xd4de('0xb')][_0x16e7a9[_0xd4de('0x17')]]);}}}}catch(_0x4626c7){logger[_0xd4de('0x24')]('[syncVarSet][VoiceDialReport]',util['inspect'](_0x4626c7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd4de('0x12')]['addVariable']=function(_0x3e5e34,_0x4de12c,_0x97c0ab){var _0xcc1d7=[_0xd4de('0x31'),_0xd4de('0x32'),'rtpaudioqosjitter',_0xd4de('0x33'),'rtpaudioqosloss',_0xd4de('0x34'),_0xd4de('0x35'),_0xd4de('0x36'),_0xd4de('0x37'),_0xd4de('0x38'),_0xd4de('0x39'),_0xd4de('0x3a'),'membercalls',_0xd4de('0x3b'),_0xd4de('0x3c'),_0xd4de('0x3d'),_0xd4de('0x3e'),_0xd4de('0x3f'),'memberrealtime'];if(!_[_0xd4de('0x40')](_0x4de12c)&&!_[_0xd4de('0x41')](_0xcc1d7,_0x4de12c)){if(_[_0xd4de('0x14')](this['variables'][_0x3e5e34])){this[_0xd4de('0x30')][_0x3e5e34]={};}this[_0xd4de('0x30')][_0x3e5e34][_0x4de12c]=_0x97c0ab;}};VoiceDialReport[_0xd4de('0x12')]['syncHangup']=function(_0x3b9026){try{if(this[_0xd4de('0x13')](_0x3b9026)){if(this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]]){this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x42')]=moment()['format'](_0xd4de('0x19'));this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]]['duration']=moment(this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x42')])['diff'](this['channels'][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x43')],'seconds');this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x44')]=_0xd4de('0x45');this['outbound'][_0xd4de('0x46')]+=0x1;if(this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x29')]){this[_0xd4de('0xd')][_0xd4de('0x47')]+=0x1;this['channels'][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x48')]=moment(this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x29')])[_0xd4de('0x49')](this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x43')],_0xd4de('0x4a'));this['channels'][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x4b')]=moment(this[_0xd4de('0xb')][_0x3b9026['uniqueid']][_0xd4de('0x42')])[_0xd4de('0x49')](this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x29')],_0xd4de('0x4a'));this[_0xd4de('0xd')][_0xd4de('0x4c')]+=this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]]['holdtime']||0x0;this[_0xd4de('0xd')][_0xd4de('0x4d')]+=this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]][_0xd4de('0x4b')];}this['outbound']['sumDuration']+=this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]]['duration'];ami['emit'](_0xd4de('0x4e'),this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]]);ami[_0xd4de('0x15')](_0xd4de('0x4f'),this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]]);this[_0xd4de('0x15')](_0xd4de('0x21'),_0xd4de('0x50'),this[_0xd4de('0xd')]);this[_0xd4de('0x15')]('voice:outbound',_0xd4de('0x51'),this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]]);delete this[_0xd4de('0xb')][_0x3b9026[_0xd4de('0x17')]];}if(this[_0xd4de('0x30')][_0x3b9026['uniqueid']]){delete this[_0xd4de('0x30')][_0x3b9026['uniqueid']];}}}catch(_0x48fe2a){logger[_0xd4de('0x24')](_0xd4de('0x52'),util[_0xd4de('0x25')](_0x48fe2a,{'showHidden':![],'depth':null}));}};module[_0xd4de('0x53')]=VoiceDialReport; \ No newline at end of file +var _0x04b8=['ami','../ami','defaults','redis','localhost','channels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','error','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','variables','endtime','duration','starttime','complete','total','answered','holdtime','answertime','diff','seconds','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','voice_outbound:save','exports','moment','ioredis','../../../config/environment'];(function(_0x56e2d0,_0x19508f){var _0x58615e=function(_0x14e0d8){while(--_0x14e0d8){_0x56e2d0['push'](_0x56e2d0['shift']());}};_0x58615e(++_0x19508f);}(_0x04b8,0x159));var _0x804b=function(_0x230bd4,_0x1256eb){_0x230bd4=_0x230bd4-0x0;var _0xab64fe=_0x04b8[_0x230bd4];return _0xab64fe;};'use strict';var _=require('lodash');var moment=require(_0x804b('0x0'));var util=require('util');var Redis=require(_0x804b('0x1'));var config=require(_0x804b('0x2'));var logger=require('../../../config/logger')(_0x804b('0x3'));var ami=require(_0x804b('0x4'));config['redis']=_[_0x804b('0x5')](config[_0x804b('0x6')],{'host':_0x804b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x804b('0x6')]));function VoiceDialReport(_0x3c5404){this[_0x804b('0x8')]=_0x3c5404['outboundChannels'];this[_0x804b('0x9')]=_0x3c5404[_0x804b('0x9')];this['variables']={};ami['on'](_0x804b('0xa'),this[_0x804b('0xb')][_0x804b('0xc')](this));ami['on'](_0x804b('0xd'),this[_0x804b('0xe')]['bind'](this));ami['on'](_0x804b('0xf'),this[_0x804b('0x10')][_0x804b('0xc')](this));ami['on'](_0x804b('0x11'),this[_0x804b('0x12')][_0x804b('0xc')](this));}VoiceDialReport['prototype'][_0x804b('0x13')]=function(_0x5303cc){return _0x5303cc!==null&&!_[_0x804b('0x14')](_0x5303cc);};VoiceDialReport[_0x804b('0x15')][_0x804b('0x16')]=function(_0x1f915d,_0x581fbf,_0x215825){io['to'](_0x1f915d)[_0x804b('0x16')](_0x581fbf,_0x215825);};VoiceDialReport[_0x804b('0x15')][_0x804b('0xb')]=function(_0x4ff1be){try{if(this[_0x804b('0x13')](_0x4ff1be)){if(this[_0x804b('0x8')][_0x4ff1be['uniqueid']]){_[_0x804b('0x17')](this['channels'][_0x4ff1be[_0x804b('0x18')]],{'starttime':moment()[_0x804b('0x19')](_0x804b('0x1a')),'lastevent':_0x804b('0x1b'),'interface':_0x4ff1be[_0x804b('0x1c')]['substring'](0x0,_0x4ff1be[_0x804b('0x1c')]['lastIndexOf']('-')),'membername':_0x4ff1be[_0x804b('0x1c')][_0x804b('0x1d')](_0x4ff1be[_0x804b('0x1c')][_0x804b('0x1e')]('/')+0x1,_0x4ff1be['channel'][_0x804b('0x1e')]('-'))},_[_0x804b('0x1f')](_0x4ff1be,[_0x804b('0x20'),_0x804b('0x21')]));this[_0x804b('0x16')](_0x804b('0x22'),_0x804b('0x23'),this[_0x804b('0x8')][_0x4ff1be[_0x804b('0x18')]]);ami[_0x804b('0x16')](_0x804b('0x24'),this['channels'][_0x4ff1be[_0x804b('0x18')]]);}}}catch(_0x5a77e0){logger['error'](_0x804b('0x25'),util[_0x804b('0x26')](_0x5a77e0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x804b('0x15')][_0x804b('0xe')]=function(_0x9080c2){try{if(this['isNotNull'](_0x9080c2)){if(this[_0x804b('0x8')][_0x9080c2[_0x804b('0x18')]]){this['channels'][_0x9080c2[_0x804b('0x18')]][_0x804b('0x27')]=_0x9080c2[_0x804b('0x27')];if(_0x9080c2[_0x804b('0x27')]===_0x804b('0x28')){this['channels'][_0x9080c2[_0x804b('0x18')]][_0x804b('0x29')]=_0x9080c2[_0x804b('0x29')];this[_0x804b('0x8')][_0x9080c2[_0x804b('0x18')]]['connectedlinename']=_0x9080c2[_0x804b('0x2a')];this[_0x804b('0x8')][_0x9080c2[_0x804b('0x18')]]['answertime']=moment()[_0x804b('0x19')](_0x804b('0x1a'));this[_0x804b('0x8')][_0x9080c2['uniqueid']][_0x804b('0x2b')]=_0x804b('0x2c');ami['emit'](_0x804b('0x2d'),this[_0x804b('0x8')][_0x9080c2[_0x804b('0x18')]]);}this[_0x804b('0x16')](_0x804b('0x22'),_0x804b('0x23'),this['channels'][_0x9080c2[_0x804b('0x18')]]);}}}catch(_0xc3e8e){logger[_0x804b('0x2e')](_0x804b('0x2f'),util[_0x804b('0x26')](_0xc3e8e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x804b('0x15')][_0x804b('0x10')]=function(_0x36d3c1){try{if(this[_0x804b('0x13')](_0x36d3c1)){this[_0x804b('0x30')](_0x36d3c1[_0x804b('0x18')],_[_0x804b('0x31')](_0x36d3c1[_0x804b('0x32')])[0x0],_0x36d3c1[_0x804b('0x33')]);if(this[_0x804b('0x13')](_0x36d3c1[_0x804b('0x32')])&&this[_0x804b('0x13')](_0x36d3c1[_0x804b('0x32')][_0x804b('0x34')])){if(_[_0x804b('0x14')](this[_0x804b('0x8')][_0x36d3c1[_0x804b('0x18')]])){this[_0x804b('0x8')][_0x36d3c1[_0x804b('0x18')]]={'routeId':_0x36d3c1[_0x804b('0x33')],'variables':this['variables'][_0x36d3c1['uniqueid']]};this['emit'](_0x804b('0x22'),_0x804b('0x23'),this[_0x804b('0x8')][_0x36d3c1['uniqueid']]);}}}}catch(_0x5918f2){logger['error'](_0x804b('0x35'),util[_0x804b('0x26')](_0x5918f2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x804b('0x15')][_0x804b('0x30')]=function(_0x23c543,_0x10b49a,_0x2618fb){var _0xc5eefa=[_0x804b('0x36'),_0x804b('0x37'),_0x804b('0x38'),_0x804b('0x39'),_0x804b('0x3a'),'rtpaudioqoslossbridged',_0x804b('0x3b'),_0x804b('0x3c'),_0x804b('0x3d'),_0x804b('0x3e'),_0x804b('0x3f'),'bridgepvtcallid','membercalls',_0x804b('0x40'),_0x804b('0x41'),_0x804b('0x42'),'membername',_0x804b('0x43'),'memberrealtime'];if(!_[_0x804b('0x44')](_0x10b49a)&&!_[_0x804b('0x45')](_0xc5eefa,_0x10b49a)){if(_[_0x804b('0x14')](this[_0x804b('0x46')][_0x23c543])){this[_0x804b('0x46')][_0x23c543]={};}this[_0x804b('0x46')][_0x23c543][_0x10b49a]=_0x2618fb;}};VoiceDialReport[_0x804b('0x15')]['syncHangup']=function(_0x17972a){try{if(this[_0x804b('0x13')](_0x17972a)){if(this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]]){this['channels'][_0x17972a[_0x804b('0x18')]][_0x804b('0x47')]=moment()[_0x804b('0x19')](_0x804b('0x1a'));this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]][_0x804b('0x48')]=moment(this[_0x804b('0x8')][_0x17972a['uniqueid']][_0x804b('0x47')])['diff'](this['channels'][_0x17972a['uniqueid']][_0x804b('0x49')],'seconds');this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]][_0x804b('0x2b')]=_0x804b('0x4a');this['outbound'][_0x804b('0x4b')]+=0x1;if(this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]]['answertime']){this[_0x804b('0x9')][_0x804b('0x4c')]+=0x1;this[_0x804b('0x8')][_0x17972a['uniqueid']][_0x804b('0x4d')]=moment(this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]][_0x804b('0x4e')])[_0x804b('0x4f')](this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]][_0x804b('0x49')],_0x804b('0x50'));this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]][_0x804b('0x51')]=moment(this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]]['endtime'])['diff'](this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]][_0x804b('0x4e')],_0x804b('0x50'));this[_0x804b('0x9')]['sumHoldTime']+=this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]][_0x804b('0x4d')]||0x0;this[_0x804b('0x9')][_0x804b('0x52')]+=this[_0x804b('0x8')][_0x17972a['uniqueid']]['billableseconds'];}this[_0x804b('0x9')][_0x804b('0x53')]+=this['channels'][_0x17972a['uniqueid']][_0x804b('0x48')];ami[_0x804b('0x16')](_0x804b('0x54'),this['channels'][_0x17972a[_0x804b('0x18')]]);ami[_0x804b('0x16')]('custom:dialend',this[_0x804b('0x8')][_0x17972a['uniqueid']]);this[_0x804b('0x16')]('voice:outbound',_0x804b('0x55'),this[_0x804b('0x9')]);this['emit'](_0x804b('0x22'),'voice_outbound_channel:remove',this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]]);delete this[_0x804b('0x8')][_0x17972a[_0x804b('0x18')]];}if(this[_0x804b('0x46')][_0x17972a[_0x804b('0x18')]]){delete this[_0x804b('0x46')][_0x17972a[_0x804b('0x18')]];}}}catch(_0x453b94){logger[_0x804b('0x2e')]('[syncHangup][VoiceDialReport]',util['inspect'](_0x453b94,{'showHidden':![],'depth':null}));}};module[_0x804b('0x56')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index b2f5e34..51aa10e 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 _0x93fa=['exports','lodash','bluebird','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','queueReports','agents','channels','voiceQueues','campaigns','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncBlindTransfer','isUndefined','isEmpty','originated','hasOwnProperty','pTalking','waiting','queueStatusComplete','unlockRR','prototype','switch','isNil','Action','status','channel','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','variables','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','emitVoiceQueueChannelRemove','inspect','emit','format','voice:queue:%s','emitVoiceQueueSummary','type','inbound','name','answered','available','loggedIn','sumBillable','sumHoldTime','abandoned','Trunk','active','callerid','Interval','stringify','voice_queue:save','loopQueueShow','clearZombieChannels','queues','catch','[queues]','loopQueueSummary','queuesummary','then','flagQueueSummary','isNotNull','queue','toNumber','loggedin','callers','talking','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','emitVoiceQueueChannelSave','[syncQueueCallerLeave][VoiceQueueReport]','queuecallerexitreason','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','toLowerCase','local/','add','FORWARDTRANSFER','transfertype','destexten','transferuniqueid','linkedid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','value','variable','CONTINUE','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','unmanaged','diff','seconds','length','sumDuration','milliseconds','total','custom:queuecallerunmanaged','lastevent','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','syncAttendedTransfer','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','transferexten','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLIND','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93fa,0x187));var _0xa93f=function(_0x238e7c,_0x46ee86){_0x238e7c=_0x238e7c-0x0;var _0x128a39=_0x93fa[_0x238e7c];return _0x128a39;};'use strict';var _=require(_0xa93f('0x0'));var moment=require('moment');var BPromise=require(_0xa93f('0x1'));var util=require(_0xa93f('0x2'));var md5=require(_0xa93f('0x3'));var Redis=require(_0xa93f('0x4'));var config=require(_0xa93f('0x5'));var logger=require(_0xa93f('0x6'))(_0xa93f('0x7'));var ami=require(_0xa93f('0x8'));var QueueReport=require(_0xa93f('0x9'));config[_0xa93f('0xa')]=_[_0xa93f('0xb')](config[_0xa93f('0xa')],{'host':_0xa93f('0xc'),'port':0x18eb});var io=require(_0xa93f('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xa93f('0xe')]=function(_0x49ff59){this[_0xa93f('0xf')]=this['tail']?this['tail'][_0xa93f('0x10')](_0x49ff59):_0x49ff59();};function VoiceQueueReport(_0x67d8d){this['sequence']=new Sequence();this[_0xa93f('0x11')]={};this[_0xa93f('0x12')]=_0x67d8d['agents'];this[_0xa93f('0x13')]=_0x67d8d['queueChannels'];this[_0xa93f('0x14')]=_0x67d8d[_0xa93f('0x14')];this['flagQueueSummary']=!![];this[_0xa93f('0x15')]=_0x67d8d[_0xa93f('0x15')];this['variables']={};ami['on']('queuesummary',this[_0xa93f('0x16')]['bind'](this));ami['on'](_0xa93f('0x17'),this[_0xa93f('0x18')][_0xa93f('0x19')](this));ami['on'](_0xa93f('0x1a'),this['syncQueueCallerJoin'][_0xa93f('0x19')](this));ami['on'](_0xa93f('0x1b'),this[_0xa93f('0x1c')]['bind'](this));ami['on'](_0xa93f('0x1d'),this[_0xa93f('0x1e')][_0xa93f('0x19')](this));ami['on']('agentcomplete',this[_0xa93f('0x1f')][_0xa93f('0x19')](this));ami['on'](_0xa93f('0x20'),this[_0xa93f('0x21')][_0xa93f('0x19')](this));ami['on'](_0xa93f('0x22'),this['syncVarSet']['bind'](this));ami['on'](_0xa93f('0x23'),this[_0xa93f('0x24')][_0xa93f('0x19')](this));ami['on'](_0xa93f('0x25'),this['syncFullyBooted'][_0xa93f('0x19')](this));ami['on'](_0xa93f('0x26'),this[_0xa93f('0x27')]['bind'](this));ami['on'](_0xa93f('0x28'),this[_0xa93f('0x29')][_0xa93f('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xa93f('0x19')](this));ami['on']('blindtransfer',this[_0xa93f('0x2a')]['bind'](this));this['loopQueueSummary']();this['loopQueueShow']();}function isNotNull(_0x3c3a59){return _0x3c3a59!==null&&!_[_0xa93f('0x2b')](_0x3c3a59);}function clearChannels(_0x4aa3c7){if(!_[_0xa93f('0x2c')](_0x4aa3c7)){for(var _0x5e4d12 in _0x4aa3c7){if(_0x4aa3c7['hasOwnProperty'](_0x5e4d12)){delete _0x4aa3c7[_0x5e4d12];}}}}function clearCampaigns(_0x25fab9){if(!_[_0xa93f('0x2c')](_0x25fab9)){for(var _0x43cf2a in _0x25fab9){if(_0x25fab9['hasOwnProperty'](_0x43cf2a)){_0x25fab9[_0x43cf2a][_0xa93f('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x567d73){if(!_[_0xa93f('0x2c')](_0x567d73)){for(var _0x53df2d in _0x567d73){if(_0x567d73[_0xa93f('0x2e')](_0x53df2d)){_0x567d73[_0x53df2d][_0xa93f('0x2d')]=0x0;_0x567d73[_0x53df2d]['talking']=0x0;_0x567d73[_0x53df2d][_0xa93f('0x2f')]=0x0;_0x567d73[_0x53df2d][_0xa93f('0x30')]=0x0;_0x567d73[_0x53df2d][_0xa93f('0x31')]=!![];}}}}function clearAgentBooked(_0x476ef7){if(!_[_0xa93f('0x2c')](_0x476ef7)){for(var _0x4a7867 in _0x476ef7){if(_0x476ef7[_0xa93f('0x2e')](_0x4a7867)){_0x476ef7[_0x4a7867][_0xa93f('0x32')]=!![];}}}}VoiceQueueReport[_0xa93f('0x33')]['clearZombieChannels']=function(){var _0x1a7d65=this;for(var _0x1f848d in this[_0xa93f('0x13')]){if(this['channels']['hasOwnProperty'](_0x1f848d)&&!this['channels'][_0x1f848d][_0xa93f('0x34')]){this['sequence'][_0xa93f('0xe')](function(){if(!_[_0xa93f('0x35')](_0x1a7d65[_0xa93f('0x13')][_0x1f848d])){return ami[_0xa93f('0x36')]({'action':_0xa93f('0x37'),'channel':_0x1a7d65[_0xa93f('0x13')][_0x1f848d][_0xa93f('0x38')]})['catch'](function(_0x4605fe){if(_0x4605fe[_0xa93f('0x39')]===_0xa93f('0x3a')){setTimeout(function(){if(_0x1a7d65['channels'][_0x1f848d]){delete _0x1a7d65[_0xa93f('0x13')][_0x1f848d];logger[_0xa93f('0x3b')](_0xa93f('0x3c'),_0x1f848d);}if(_0x1a7d65[_0xa93f('0x11')][_0x1f848d]){delete _0x1a7d65[_0xa93f('0x11')][_0x1f848d];logger[_0xa93f('0x3b')]('[voiceQueueReport][checkQueueReport]',_0x1f848d);}if(_0x1a7d65[_0xa93f('0x3d')][_0x1f848d]){delete _0x1a7d65[_0xa93f('0x3d')][_0x1f848d];logger[_0xa93f('0x3b')](_0xa93f('0x3e'),_0x1f848d);}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger['error'](_0xa93f('0x3f'));clearChannels(this['channels']);this['clearQueueReport'](this[_0xa93f('0x11')]);clearAgentBooked(this[_0xa93f('0x12')]);clearVoiceQueues(this[_0xa93f('0x14')]);clearCampaigns(this[_0xa93f('0x15')]);};VoiceQueueReport['prototype']['clearQueueReport']=function(_0xc85f15){var _0x1af068=this;if(!_[_0xa93f('0x2c')](_0xc85f15)){for(var _0x52c409 in _0xc85f15){if(_0xc85f15['hasOwnProperty'](_0x52c409)){_0x1af068[_0xa93f('0x40')](_0xc85f15[_0x52c409]);delete _0xc85f15[_0x52c409];}}}};function loggerCatch(_0x2c5162){return function(_0x1d9df6){logger[_0xa93f('0x3b')](_0x2c5162,util[_0xa93f('0x41')](_0x1d9df6,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xa93f('0x33')][_0xa93f('0x42')]=function(_0x3a77e7,_0x3dd702,_0x5f4fb5){io['to'](_0x3a77e7)[_0xa93f('0x42')](_0x3dd702,_0x5f4fb5);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x1fa938){this[_0xa93f('0x42')](util[_0xa93f('0x43')](_0xa93f('0x44'),_0x1fa938['name']),'voice_queue_channel:save',_0x1fa938);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x404f86){this[_0xa93f('0x42')](util[_0xa93f('0x43')](_0xa93f('0x44'),_0x404f86['name']),'voice_queue_channel:remove',_0x404f86);};VoiceQueueReport[_0xa93f('0x33')][_0xa93f('0x45')]=function(_0x546741){if(_0x546741[_0xa93f('0x46')]===_0xa93f('0x47')){var _0x3e0eca={'id':_0x546741['id'],'name':_0x546741[_0xa93f('0x48')],'strategy':_0x546741['strategy'],'answered':_0x546741[_0xa93f('0x49')],'available':_0x546741[_0xa93f('0x4a')],'loggedIn':_0x546741[_0xa93f('0x4b')],'pTalking':_0x546741[_0xa93f('0x2f')],'sumBillable':_0x546741[_0xa93f('0x4c')],'sumDuration':_0x546741['sumDuration'],'sumHoldTime':_0x546741[_0xa93f('0x4d')]||0x0,'talking':_0x546741['talking'],'total':_0x546741['total'],'type':_0x546741[_0xa93f('0x46')],'unmanaged':_0x546741['unmanaged'],'abandoned':_0x546741[_0xa93f('0x4e')],'waiting':_0x546741[_0xa93f('0x30')]};if(_0x546741[_0xa93f('0x4f')]){_0x3e0eca['Trunk']={'id':_0x546741[_0xa93f('0x4f')]['id'],'name':_0x546741[_0xa93f('0x4f')]['name'],'active':_0x546741[_0xa93f('0x4f')][_0xa93f('0x50')],'callerid':_0x546741['Trunk'][_0xa93f('0x51')]};}if(_0x546741[_0xa93f('0x52')]){_0x3e0eca[_0xa93f('0x52')]={'id':_0x546741[_0xa93f('0x52')]['id'],'name':_0x546741[_0xa93f('0x52')][_0xa93f('0x48')]};}var _0x2e60b8=md5(JSON[_0xa93f('0x53')](_0x3e0eca));if(_0x546741[_0xa93f('0x3')]!==_0x2e60b8){_0x546741['md5']=_0x2e60b8;this[_0xa93f('0x42')](util[_0xa93f('0x43')](_0xa93f('0x44'),_0x3e0eca['name']),_0xa93f('0x54'),_0x3e0eca);}}};VoiceQueueReport[_0xa93f('0x33')]['isNotNull']=function(_0x556eed){return _0x556eed!==null&&!_[_0xa93f('0x2b')](_0x556eed);};VoiceQueueReport[_0xa93f('0x33')][_0xa93f('0x55')]=function(){var _0x369fc5=this;setInterval(function(){_0x369fc5[_0xa93f('0x56')]();ami[_0xa93f('0x36')]({'action':_0xa93f('0x57')})[_0xa93f('0x58')](loggerCatch(_0xa93f('0x59')));},0x2710);};VoiceQueueReport['prototype'][_0xa93f('0x5a')]=function(){var _0x25fe8b=this;setInterval(function(){if(_0x25fe8b['flagQueueSummary']){return ami['Action']({'action':_0xa93f('0x5b')})[_0xa93f('0x5c')](function(_0x417cf5){_0x25fe8b[_0xa93f('0x5d')]=![];})['catch'](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0xa93f('0x33')][_0xa93f('0x16')]=function(_0x434f89){try{if(this[_0xa93f('0x5e')](_0x434f89)&&this[_0xa93f('0x5e')](_0x434f89[_0xa93f('0x5f')])){if(this[_0xa93f('0x14')][_0x434f89[_0xa93f('0x5f')]]){var _0x100aa3=_['countBy'](this[_0xa93f('0x13')],_0xa93f('0x5f'))[_0x434f89[_0xa93f('0x5f')]]||0x0;var _0x3f66f0=_0x100aa3-_0x434f89['callers'];if(this[_0xa93f('0x14')][_0x434f89['queue']][_0xa93f('0x30')]!==_[_0xa93f('0x60')](_0x434f89['callers'])||this[_0xa93f('0x14')][_0x434f89[_0xa93f('0x5f')]]['loggedIn']!==_[_0xa93f('0x60')](_0x434f89[_0xa93f('0x61')])||this[_0xa93f('0x14')][_0x434f89[_0xa93f('0x5f')]][_0xa93f('0x4a')]!==_[_0xa93f('0x60')](_0x434f89[_0xa93f('0x4a')])||this[_0xa93f('0x14')][_0x434f89[_0xa93f('0x5f')]]['talking']!==_0x3f66f0){this[_0xa93f('0x14')][_0x434f89[_0xa93f('0x5f')]][_0xa93f('0x30')]=_[_0xa93f('0x60')](_0x434f89[_0xa93f('0x62')]);this[_0xa93f('0x14')][_0x434f89['queue']]['loggedIn']=_[_0xa93f('0x60')](_0x434f89['loggedin']);this[_0xa93f('0x14')][_0x434f89[_0xa93f('0x5f')]][_0xa93f('0x4a')]=_[_0xa93f('0x60')](_0x434f89['available']);this['voiceQueues'][_0x434f89['queue']][_0xa93f('0x63')]=_0x3f66f0>0x0?_0x3f66f0:0x0;this[_0xa93f('0x14')][_0x434f89['queue']]['talking']=this[_0xa93f('0x14')][_0x434f89[_0xa93f('0x5f')]][_0xa93f('0x63')]>_[_0xa93f('0x60')](_0x434f89['loggedin'])?_[_0xa93f('0x60')](_0x434f89[_0xa93f('0x61')]):this[_0xa93f('0x14')][_0x434f89['queue']][_0xa93f('0x63')];this[_0xa93f('0x45')](this[_0xa93f('0x14')][_0x434f89[_0xa93f('0x5f')]]);}ami['emit']('custom:queuesummary',this[_0xa93f('0x14')][_0x434f89['queue']]);}}}catch(_0xcb3383){logger[_0xa93f('0x3b')](_0xa93f('0x64'),util['inspect'](_0xcb3383,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa93f('0x18')]=function(_0x586e11){this[_0xa93f('0x5d')]=!![];};VoiceQueueReport['prototype'][_0xa93f('0x65')]=function(_0x57ed0d){};VoiceQueueReport[_0xa93f('0x33')]['syncQueueCallerJoin']=function(_0x18f959){try{if(this[_0xa93f('0x5e')](_0x18f959)){if(_[_0xa93f('0x2b')](this[_0xa93f('0x11')][_0x18f959[_0xa93f('0x66')]])){this[_0xa93f('0x11')][_0x18f959['uniqueid']]=[];this[_0xa93f('0x13')][_0x18f959[_0xa93f('0x66')]]={};}var _0x1a45ca=new QueueReport();_0x1a45ca[_0xa93f('0x48')]=_0x18f959['queue'];_0x1a45ca[_0xa93f('0x46')]=this[_0xa93f('0x14')][_0x1a45ca['name']]&&this[_0xa93f('0x14')][_0x1a45ca[_0xa93f('0x48')]][_0xa93f('0x46')]?this[_0xa93f('0x14')][_0x1a45ca[_0xa93f('0x48')]][_0xa93f('0x46')]||_0xa93f('0x47'):_0xa93f('0x47');_0x1a45ca['queue']=_0x18f959[_0xa93f('0x5f')];_0x1a45ca[_0xa93f('0x67')]=moment()[_0xa93f('0x43')](_0xa93f('0x68'));_0x1a45ca[_0xa93f('0x69')]=_0x18f959['position'];_0x1a45ca[_0xa93f('0x6a')]=_0x18f959[_0xa93f('0x6a')];_[_0xa93f('0x6b')](_0x1a45ca,_['pick'](_0x18f959,_[_0xa93f('0x6c')](_0x1a45ca)));this['queueReports'][_0x18f959['uniqueid']][_0xa93f('0x6d')](_0x1a45ca);this[_0xa93f('0x13')][_0x18f959[_0xa93f('0x66')]]=_0x1a45ca;this['emitVoiceQueueChannelSave'](_0x1a45ca);}}catch(_0x3b7087){logger['error'](_0xa93f('0x6e'),util[_0xa93f('0x41')](_0x3b7087,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa93f('0x33')]['syncQueueCallerAbandon']=function(_0x5f557e){try{if(this[_0xa93f('0x5e')](_0x5f557e)){if(this[_0xa93f('0x11')][_0x5f557e[_0xa93f('0x66')]]){var _0x2ac444=_[_0xa93f('0x6f')](this[_0xa93f('0x11')][_0x5f557e['uniqueid']]);_0x2ac444[_0xa93f('0x70')]=![];_0x2ac444[_0xa93f('0x71')]=null;_0x2ac444['holdtime']=_0x5f557e[_0xa93f('0x72')];_0x2ac444[_0xa93f('0x73')]=_0x5f557e[_0xa93f('0x73')];_0x2ac444[_0xa93f('0x1b')]=!![];_0x2ac444[_0xa93f('0x74')]=moment()[_0xa93f('0x43')](_0xa93f('0x68'));_0x2ac444['queuecallerexitreason']='ABANDONED';_0x2ac444[_0xa93f('0x75')]=null;this['channels'][_0x5f557e[_0xa93f('0x66')]]=_0x2ac444;this[_0xa93f('0x40')](_0x2ac444);}}}catch(_0x2aa356){logger[_0xa93f('0x3b')](_0xa93f('0x76'),util[_0xa93f('0x41')](_0x2aa356,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa93f('0x33')][_0xa93f('0x1e')]=function(_0x4a6d19){try{if(this['isNotNull'](_0x4a6d19)){if(this['queueReports'][_0x4a6d19['uniqueid']]){var _0x4eaae6=_[_0xa93f('0x6f')](this['queueReports'][_0x4a6d19[_0xa93f('0x66')]]);_0x4eaae6[_0xa93f('0x77')]=moment()[_0xa93f('0x43')](_0xa93f('0x68'));_0x4eaae6['connectedlinenum']=_0x4a6d19[_0xa93f('0x78')];_0x4eaae6[_0xa93f('0x79')]=_0x4a6d19[_0xa93f('0x79')];this[_0xa93f('0x13')][_0x4a6d19[_0xa93f('0x66')]]=_0x4eaae6;this[_0xa93f('0x7a')](_0x4eaae6);}}}catch(_0x2db651){logger[_0xa93f('0x3b')](_0xa93f('0x7b'),util['inspect'](_0x2db651,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa93f('0x21')]=function(_0x56bc1c){try{if(this[_0xa93f('0x5e')](_0x56bc1c)){if(this['queueReports'][_0x56bc1c[_0xa93f('0x66')]]){var _0x2d7826=_[_0xa93f('0x6f')](this['queueReports'][_0x56bc1c[_0xa93f('0x66')]]);_0x2d7826['queuecallercomplete']=!![];_0x2d7826[_0xa93f('0x7c')]=_0xa93f('0x7d');}}}catch(_0x1fa073){logger[_0xa93f('0x3b')](_0xa93f('0x7e'),util['inspect'](_0x1fa073,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa93f('0x1f')]=function(_0x46ec0){try{if(this[_0xa93f('0x5e')](_0x46ec0)){if(this[_0xa93f('0x11')][_0x46ec0['uniqueid']]){var _0x45bf87=_[_0xa93f('0x6f')](this[_0xa93f('0x11')][_0x46ec0['uniqueid']]);_0x45bf87[_0xa93f('0x1b')]=![];_0x45bf87['queuecallerabandonAt']=null;_0x45bf87[_0xa93f('0x7f')]=!![];_0x45bf87[_0xa93f('0x75')]=_0x46ec0[_0xa93f('0x80')];_0x45bf87[_0xa93f('0x72')]=_0x46ec0['holdtime'];_0x45bf87['queuecallercomplete']=!![];_0x45bf87[_0xa93f('0x81')]=![];_0x45bf87[_0xa93f('0x82')]=null;if(!_0x45bf87[_0xa93f('0x83')]){if(_0x46ec0[_0xa93f('0x84')]=='transfer'){_0x45bf87[_0xa93f('0x7c')]=_0xa93f('0x85');}else{if(_['startsWith'](_0x46ec0[_0xa93f('0x38')][_0xa93f('0x86')](),_0xa93f('0x87'))){if(this[_0xa93f('0x11')][_0x46ec0['linkedid']]){var _0xd26b94=_[_0xa93f('0x6f')](this['queueReports'][_0x46ec0['linkedid']]);_0xd26b94[_0xa93f('0x70')]=![];_0xd26b94[_0xa93f('0x81')]=!![];_0xd26b94[_0xa93f('0x82')]=moment(_0x45bf87[_0xa93f('0x67')])[_0xa93f('0x88')](_0x46ec0[_0xa93f('0x72')],'seconds')[_0xa93f('0x43')](_0xa93f('0x68'));_0xd26b94[_0xa93f('0x7c')]=_0xa93f('0x89');_0xd26b94[_0xa93f('0x83')]=!![];_0xd26b94[_0xa93f('0x8a')]='FORWARD';_0xd26b94['transferexten']=_0x46ec0[_0xa93f('0x8b')];_0xd26b94[_0xa93f('0x8c')]=_0x46ec0[_0xa93f('0x66')];var _0x2e4123=this[_0xa93f('0x11')][_0x46ec0[_0xa93f('0x8d')]];this[_0xa93f('0x11')][_0x46ec0['linkedid']]=this['queueReports'][_0x46ec0[_0xa93f('0x66')]];this[_0xa93f('0x11')][_0x46ec0[_0xa93f('0x66')]]=_0x2e4123;}}else{_0x45bf87[_0xa93f('0x7c')]=_0xa93f('0x8e')+_0x46ec0['reason'][_0xa93f('0x8f')]();}}}this[_0xa93f('0x13')][_0x46ec0['uniqueid']]=_0x45bf87;this['emitVoiceQueueChannelRemove'](_0x45bf87);}}}catch(_0x355936){logger[_0xa93f('0x3b')](_0xa93f('0x90'),util[_0xa93f('0x41')](_0x355936,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa93f('0x33')][_0xa93f('0x91')]=function(_0x1669ee){try{if(this[_0xa93f('0x5e')](_0x1669ee)){this[_0xa93f('0x92')](_0x1669ee[_0xa93f('0x66')],_[_0xa93f('0x6c')](_0x1669ee['variable'])[0x0],_0x1669ee[_0xa93f('0x93')]);if(this[_0xa93f('0x11')][_0x1669ee[_0xa93f('0x66')]]){var _0x2b7be5=_[_0xa93f('0x6f')](this[_0xa93f('0x11')][_0x1669ee[_0xa93f('0x66')]]);if(_0x2b7be5){if(this[_0xa93f('0x5e')](_0x1669ee[_0xa93f('0x94')])&&this[_0xa93f('0x5e')](_0x1669ee['variable']['queuestatus'])){switch(_0x1669ee[_0xa93f('0x93')]){case _0xa93f('0x95'):_0x2b7be5[_0xa93f('0x81')]=![];_0x2b7be5['queuecallerexitAt']=null;break;default:_0x2b7be5[_0xa93f('0x81')]=!![];_0x2b7be5[_0xa93f('0x82')]=moment()[_0xa93f('0x43')](_0xa93f('0x68'));_0x2b7be5[_0xa93f('0x77')]=moment()['format'](_0xa93f('0x68'));}_0x2b7be5['queuecallerabandon']=![];_0x2b7be5[_0xa93f('0x74')]=null;_0x2b7be5['queuecallerexitreason']=_0x1669ee['value'];this['channels'][_0x1669ee['uniqueid']]=_0x2b7be5;this['emitVoiceQueueChannelRemove'](_0x2b7be5);}else if(this[_0xa93f('0x5e')](_0x1669ee[_0xa93f('0x94')])&&this['isNotNull'](_0x1669ee[_0xa93f('0x94')][_0xa93f('0x96')])){if(!_0x2b7be5[_0xa93f('0x1b')]){_0x2b7be5['queuecallerexit']=!![];_0x2b7be5[_0xa93f('0x82')]=moment()[_0xa93f('0x43')](_0xa93f('0x68'));_0x2b7be5['queuecallerexitreason']=_0xa93f('0x97');_0x2b7be5[_0xa93f('0x77')]=moment()[_0xa93f('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa93f('0x13')][_0x1669ee[_0xa93f('0x66')]]=_0x2b7be5;}}_0x2b7be5[_0xa93f('0x3d')]=this[_0xa93f('0x3d')][_0x1669ee[_0xa93f('0x66')]];}}}}catch(_0x7f612f){logger[_0xa93f('0x3b')](_0xa93f('0x98'),util[_0xa93f('0x41')](_0x7f612f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa93f('0x33')]['addVariable']=function(_0x236aba,_0x3d414f,_0x4c20b4){var _0xeee780=['rtpaudioqos','rtpaudioqosbridged',_0xa93f('0x99'),'rtpaudioqosjitterbridged',_0xa93f('0x9a'),'rtpaudioqoslossbridged',_0xa93f('0x9b'),'rtpaudioqosrttbridged','sipcallid',_0xa93f('0x9c'),'bridgepeer',_0xa93f('0x9d'),_0xa93f('0x9e'),_0xa93f('0x9f'),'memberinterface',_0xa93f('0xa0'),_0xa93f('0x80'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x3d414f)&&!_['includes'](_0xeee780,_0x3d414f)){if(_['isUndefined'](this[_0xa93f('0x3d')][_0x236aba])){this['variables'][_0x236aba]={};}this['variables'][_0x236aba][_0x3d414f]=_0x4c20b4;}};VoiceQueueReport[_0xa93f('0x33')]['syncHangup']=function(_0xf78eb1){try{if(this[_0xa93f('0x5e')](_0xf78eb1)){if(this[_0xa93f('0x11')][_0xf78eb1['uniqueid']]){for(var _0x142357=0x0,_0x5a525e={};_0x1423570x0?_0x184666:0x0;this[_0xfec2('0x10')][_0x375c04[_0xfec2('0x5e')]][_0xfec2('0x31')]=this[_0xfec2('0x10')][_0x375c04['queue']][_0xfec2('0x31')]>_['toNumber'](_0x375c04[_0xfec2('0x62')])?_[_0xfec2('0x60')](_0x375c04[_0xfec2('0x62')]):this[_0xfec2('0x10')][_0x375c04[_0xfec2('0x5e')]][_0xfec2('0x31')];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x375c04[_0xfec2('0x5e')]]);}ami[_0xfec2('0x42')](_0xfec2('0x63'),this['voiceQueues'][_0x375c04['queue']]);}}}catch(_0x351875){logger[_0xfec2('0x3b')](_0xfec2('0x64'),util[_0xfec2('0x65')](_0x351875,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfec2('0x16')]=function(_0x1f917f){this[_0xfec2('0x11')]=!![];};VoiceQueueReport['prototype'][_0xfec2('0x66')]=function(_0xac580d){};VoiceQueueReport[_0xfec2('0x8')][_0xfec2('0x18')]=function(_0xd36c54){try{if(this[_0xfec2('0x57')](_0xd36c54)){if(_[_0xfec2('0x58')](this[_0xfec2('0x67')][_0xd36c54[_0xfec2('0x68')]])){this[_0xfec2('0x67')][_0xd36c54[_0xfec2('0x68')]]=[];this[_0xfec2('0xe')][_0xd36c54['uniqueid']]={};}var _0x27a3d1=new QueueReport();_0x27a3d1['name']=_0xd36c54[_0xfec2('0x5e')];_0x27a3d1[_0xfec2('0x49')]=this['voiceQueues'][_0x27a3d1[_0xfec2('0x44')]]&&this[_0xfec2('0x10')][_0x27a3d1['name']][_0xfec2('0x49')]?this[_0xfec2('0x10')][_0x27a3d1['name']]['type']||_0xfec2('0x4a'):_0xfec2('0x4a');_0x27a3d1[_0xfec2('0x5e')]=_0xd36c54['queue'];_0x27a3d1[_0xfec2('0x69')]=moment()[_0xfec2('0x43')](_0xfec2('0x6a'));_0x27a3d1[_0xfec2('0x6b')]=_0xd36c54[_0xfec2('0x6b')];_0x27a3d1[_0xfec2('0x6c')]=_0xd36c54[_0xfec2('0x6c')];_[_0xfec2('0x6d')](_0x27a3d1,_[_0xfec2('0x6e')](_0xd36c54,_[_0xfec2('0x6f')](_0x27a3d1)));this[_0xfec2('0x67')][_0xd36c54[_0xfec2('0x68')]][_0xfec2('0x70')](_0x27a3d1);this['channels'][_0xd36c54[_0xfec2('0x68')]]=_0x27a3d1;this[_0xfec2('0x71')](_0x27a3d1);}}catch(_0x2c6b46){logger[_0xfec2('0x3b')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xfec2('0x65')](_0x2c6b46,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfec2('0x8')][_0xfec2('0x1b')]=function(_0x15afda){try{if(this[_0xfec2('0x57')](_0x15afda)){if(this[_0xfec2('0x67')][_0x15afda['uniqueid']]){var _0x5b5e5b=_[_0xfec2('0x72')](this[_0xfec2('0x67')][_0x15afda[_0xfec2('0x68')]]);_0x5b5e5b[_0xfec2('0x73')]=![];_0x5b5e5b['queuecallercompleteAt']=null;_0x5b5e5b[_0xfec2('0x74')]=_0x15afda['holdtime'];_0x5b5e5b[_0xfec2('0x75')]=_0x15afda[_0xfec2('0x75')];_0x5b5e5b['queuecallerabandon']=!![];_0x5b5e5b[_0xfec2('0x76')]=moment()[_0xfec2('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b5e5b[_0xfec2('0x77')]='ABANDONED';_0x5b5e5b[_0xfec2('0x78')]=null;this[_0xfec2('0xe')][_0x15afda[_0xfec2('0x68')]]=_0x5b5e5b;this[_0xfec2('0x41')](_0x5b5e5b);}}}catch(_0x2cb9d1){logger[_0xfec2('0x3b')](_0xfec2('0x79'),util['inspect'](_0x2cb9d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfec2('0x8')][_0xfec2('0x7a')]=function(_0x23a5ed){try{if(this[_0xfec2('0x57')](_0x23a5ed)){if(this[_0xfec2('0x67')][_0x23a5ed['uniqueid']]){var _0x58ba84=_[_0xfec2('0x72')](this['queueReports'][_0x23a5ed[_0xfec2('0x68')]]);_0x58ba84[_0xfec2('0x7b')]=moment()[_0xfec2('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x58ba84[_0xfec2('0x7c')]=_0x23a5ed[_0xfec2('0x7c')];_0x58ba84[_0xfec2('0x7d')]=_0x23a5ed[_0xfec2('0x7d')];this[_0xfec2('0xe')][_0x23a5ed[_0xfec2('0x68')]]=_0x58ba84;this[_0xfec2('0x71')](_0x58ba84);}}}catch(_0x317d8b){logger[_0xfec2('0x3b')](_0xfec2('0x7e'),util[_0xfec2('0x65')](_0x317d8b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfec2('0x8')][_0xfec2('0x1f')]=function(_0x24d4af){try{if(this['isNotNull'](_0x24d4af)){if(this[_0xfec2('0x67')][_0x24d4af[_0xfec2('0x68')]]){var _0x7d872b=_[_0xfec2('0x72')](this['queueReports'][_0x24d4af[_0xfec2('0x68')]]);_0x7d872b[_0xfec2('0x73')]=!![];_0x7d872b[_0xfec2('0x77')]='COMPLETEDBYAGENT';}}}catch(_0x1ae22b){logger[_0xfec2('0x3b')]('[syncAgentConnect][VoiceQueueReport]',util[_0xfec2('0x65')](_0x1ae22b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfec2('0x1d')]=function(_0x4ce746){try{if(this[_0xfec2('0x57')](_0x4ce746)){if(this[_0xfec2('0x67')][_0x4ce746['uniqueid']]){var _0x2ada06=_['last'](this[_0xfec2('0x67')][_0x4ce746[_0xfec2('0x68')]]);_0x2ada06['queuecallerabandon']=![];_0x2ada06[_0xfec2('0x76')]=null;_0x2ada06['assigned']=!![];_0x2ada06[_0xfec2('0x78')]=_0x4ce746[_0xfec2('0x7f')];_0x2ada06['holdtime']=_0x4ce746[_0xfec2('0x74')];_0x2ada06['queuecallercomplete']=!![];_0x2ada06['queuecallerexit']=![];_0x2ada06[_0xfec2('0x80')]=null;if(!_0x2ada06[_0xfec2('0x81')]){if(_0x4ce746[_0xfec2('0x82')]==_0xfec2('0x81')){_0x2ada06[_0xfec2('0x77')]=_0xfec2('0x83');}else{if(_[_0xfec2('0x84')](_0x4ce746[_0xfec2('0x38')][_0xfec2('0x85')](),_0xfec2('0x86'))){if(this[_0xfec2('0x67')][_0x4ce746[_0xfec2('0x87')]]){var _0x18af50=_['last'](this[_0xfec2('0x67')][_0x4ce746[_0xfec2('0x87')]]);_0x18af50[_0xfec2('0x73')]=![];_0x18af50[_0xfec2('0x88')]=!![];_0x18af50['queuecallerexitAt']=moment(_0x2ada06[_0xfec2('0x69')])['add'](_0x4ce746['holdtime'],_0xfec2('0x89'))[_0xfec2('0x43')](_0xfec2('0x6a'));_0x18af50['queuecallerexitreason']='FORWARDTRANSFER';_0x18af50['transfer']=!![];_0x18af50[_0xfec2('0x8a')]='FORWARD';_0x18af50[_0xfec2('0x8b')]=_0x4ce746[_0xfec2('0x8c')];_0x18af50[_0xfec2('0x8d')]=_0x4ce746[_0xfec2('0x68')];var _0x2651f3=this[_0xfec2('0x67')][_0x4ce746[_0xfec2('0x87')]];this[_0xfec2('0x67')][_0x4ce746[_0xfec2('0x87')]]=this['queueReports'][_0x4ce746[_0xfec2('0x68')]];this['queueReports'][_0x4ce746[_0xfec2('0x68')]]=_0x2651f3;}}else{_0x2ada06[_0xfec2('0x77')]='COMPLETEDBY'+_0x4ce746[_0xfec2('0x82')][_0xfec2('0x8e')]();}}}this[_0xfec2('0xe')][_0x4ce746['uniqueid']]=_0x2ada06;this[_0xfec2('0x41')](_0x2ada06);}}}catch(_0x17caef){logger[_0xfec2('0x3b')](_0xfec2('0x8f'),util[_0xfec2('0x65')](_0x17caef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfec2('0x8')][_0xfec2('0x21')]=function(_0x610325){try{if(this['isNotNull'](_0x610325)){this['addVariable'](_0x610325[_0xfec2('0x68')],_[_0xfec2('0x6f')](_0x610325[_0xfec2('0x90')])[0x0],_0x610325[_0xfec2('0x91')]);if(this['queueReports'][_0x610325[_0xfec2('0x68')]]){var _0x1ccfd7=_[_0xfec2('0x72')](this['queueReports'][_0x610325[_0xfec2('0x68')]]);if(_0x1ccfd7){if(this[_0xfec2('0x57')](_0x610325[_0xfec2('0x90')])&&this[_0xfec2('0x57')](_0x610325['variable'][_0xfec2('0x92')])){switch(_0x610325['value']){case _0xfec2('0x93'):_0x1ccfd7[_0xfec2('0x88')]=![];_0x1ccfd7[_0xfec2('0x80')]=null;break;default:_0x1ccfd7[_0xfec2('0x88')]=!![];_0x1ccfd7[_0xfec2('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ccfd7[_0xfec2('0x7b')]=moment()[_0xfec2('0x43')](_0xfec2('0x6a'));}_0x1ccfd7['queuecallerabandon']=![];_0x1ccfd7['queuecallerabandonAt']=null;_0x1ccfd7[_0xfec2('0x77')]=_0x610325[_0xfec2('0x91')];this[_0xfec2('0xe')][_0x610325['uniqueid']]=_0x1ccfd7;this[_0xfec2('0x41')](_0x1ccfd7);}else if(this[_0xfec2('0x57')](_0x610325['variable'])&&this['isNotNull'](_0x610325[_0xfec2('0x90')][_0xfec2('0x94')])){if(!_0x1ccfd7[_0xfec2('0x1a')]){_0x1ccfd7[_0xfec2('0x88')]=!![];_0x1ccfd7[_0xfec2('0x80')]=moment()[_0xfec2('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ccfd7[_0xfec2('0x77')]=_0xfec2('0x95');_0x1ccfd7['queuecallerleaveAt']=moment()[_0xfec2('0x43')](_0xfec2('0x6a'));this[_0xfec2('0xe')][_0x610325['uniqueid']]=_0x1ccfd7;}}_0x1ccfd7[_0xfec2('0x13')]=this[_0xfec2('0x13')][_0x610325['uniqueid']];}}}}catch(_0x46e03a){logger['error'](_0xfec2('0x96'),util[_0xfec2('0x65')](_0x46e03a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfec2('0x8')]['addVariable']=function(_0x5cc0a6,_0x41a5df,_0xd298ce){var _0x1ac9f5=[_0xfec2('0x97'),_0xfec2('0x98'),_0xfec2('0x99'),_0xfec2('0x9a'),'rtpaudioqosloss',_0xfec2('0x9b'),_0xfec2('0x9c'),_0xfec2('0x9d'),'sipcallid','sipuri','bridgepeer','bridgepvtcallid',_0xfec2('0x9e'),_0xfec2('0x9f'),_0xfec2('0xa0'),_0xfec2('0xa1'),_0xfec2('0x7f'),_0xfec2('0xa2'),_0xfec2('0xa3')];if(!_[_0xfec2('0x36')](_0x41a5df)&&!_[_0xfec2('0xa4')](_0x1ac9f5,_0x41a5df)){if(_[_0xfec2('0x58')](this[_0xfec2('0x13')][_0x5cc0a6])){this['variables'][_0x5cc0a6]={};}this[_0xfec2('0x13')][_0x5cc0a6][_0x41a5df]=_0xd298ce;}};VoiceQueueReport[_0xfec2('0x8')][_0xfec2('0x23')]=function(_0x380c4f){try{if(this[_0xfec2('0x57')](_0x380c4f)){if(this[_0xfec2('0x67')][_0x380c4f[_0xfec2('0x68')]]){for(var _0x405e94=0x0,_0x13019b={};_0x405e94=0x0?moment(_0x31334e[_0xf31b('0x1a')])[_0xf31b('0xf')](_0x31334e[_0xf31b('0x19')],'seconds'):null,'data1':_0xf31b('0x1b'),'data2':_0x31334e[_0xf31b('0x14')],'data3':_0x31334e['exten'],'data4':_0x31334e['dialstring']||null,'role':_0xf31b('0x1c'),'internal':_0x31334e[_0xf31b('0x14')]?_[_0xf31b('0x15')](_0x31334e[_0xf31b('0x14')]):undefined,'uniqueid':_0x31334e['uniqueid']},'log':_0xf31b('0x7')});}; \ No newline at end of file +var _0x195a=['util','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','inbound','exten','agent','accountcode','uniqueid','membername','starttime','endtime','outbound','dialstring','toNumber','lodash'];(function(_0x6d0606,_0x302387){var _0xec656d=function(_0x23bd56){while(--_0x23bd56){_0x6d0606['push'](_0x6d0606['shift']());}};_0xec656d(++_0x302387);}(_0x195a,0x16b));var _0xa195=function(_0x2bd517,_0x2019ac){_0x2bd517=_0x2bd517-0x0;var _0x449ab2=_0x195a[_0x2bd517];return _0x449ab2;};'use strict';var moment=require('moment');var _=require(_0xa195('0x0'));var util=require(_0xa195('0x1'));var client=require('../client');exports[_0xa195('0x2')]=function(_0x53c413){var _0x27b118=_0x53c413['queuecallercompleteAt']||_0x53c413[_0xa195('0x3')];return client[_0xa195('0x4')](_0xa195('0x5'),{'body':{'channel':_0xa195('0x6'),'membername':_0x53c413[_0xa195('0x7')],'interface':_[_0xa195('0x8')](_0x53c413[_0xa195('0x9')])?util['format'](_0xa195('0xa'),_0x53c413[_0xa195('0x7')]):_0x53c413[_0xa195('0x9')],'type':_0xa195('0xb'),'enterAt':_0x53c413['queuecallerleaveAt'],'exitAt':_0x27b118,'duration':moment(_0x27b118)[_0xa195('0xc')](_0x53c413[_0xa195('0xd')],_0xa195('0xe')),'data1':_0xa195('0xf'),'data2':_0x53c413['calleridnum'],'data3':_0x53c413[_0xa195('0x10')],'data4':null,'data5':_0x53c413['queue'],'role':_0xa195('0x11'),'internal':_0x53c413['accountcode']?_['toNumber'](_0x53c413[_0xa195('0x12')]):undefined,'uniqueid':_0x53c413[_0xa195('0x13')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0xc671d0){return client['Request'](_0xa195('0x5'),{'body':{'channel':_0xa195('0x6'),'membername':_0xc671d0[_0xa195('0x14')],'interface':_0xc671d0[_0xa195('0x9')],'type':_0xa195('0xb'),'enterAt':_0xc671d0[_0xa195('0x15')],'exitAt':_0xc671d0['endtime'],'duration':moment(_0xc671d0[_0xa195('0x16')])[_0xa195('0xc')](_0xc671d0[_0xa195('0x15')],_0xa195('0xe'))>=0x0?moment(_0xc671d0[_0xa195('0x16')])[_0xa195('0xc')](_0xc671d0[_0xa195('0x15')],_0xa195('0xe')):null,'data1':_0xa195('0x17'),'data2':_0xc671d0[_0xa195('0x12')],'data3':_0xc671d0[_0xa195('0x10')],'data4':_0xc671d0[_0xa195('0x18')]||null,'role':'agent','internal':_0xc671d0[_0xa195('0x12')]?_[_0xa195('0x19')](_0xc671d0[_0xa195('0x12')]):undefined,'uniqueid':_0xc671d0[_0xa195('0x13')]},'log':_0xa195('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d14576b..2fb7026 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 _0x4522=['Request','name','html','GetTemplate'];(function(_0x455f7a,_0x5d9498){var _0x4b7174=function(_0x47abb1){while(--_0x47abb1){_0x455f7a['push'](_0x455f7a['shift']());}};_0x4b7174(++_0x5d9498);}(_0x4522,0x1a0));var _0x2452=function(_0x2794d4,_0x338338){_0x2794d4=_0x2794d4-0x0;var _0x882807=_0x4522[_0x2794d4];return _0x882807;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x46400f){return function(_0xa5f6b7){return client[_0x2452('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x2452('0x1'),_0x2452('0x2')]},'log':_0x2452('0x3')});};}; \ No newline at end of file +var _0x049e=['name','html','../client','getTemplates','GetTemplate'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x049e,0x16a));var _0xe049=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x049e[_0x1a7550];return _0x426e22;};'use strict';var client=require(_0xe049('0x0'));exports[_0xe049('0x1')]=function(_0x5efb24){return function(_0x30ed85){return client['Request'](_0xe049('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe049('0x3'),_0xe049('0x4')]},'log':_0xe049('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 4d33e26..a8b4110 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 _0x854e=['getTriggers','Request','GetTrigger','status','operator','value','AnyConditions','field','Action','Actions','data1','data3','data4','data6','../client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x854e,0xc2));var _0xe854=function(_0x70504d,_0x34e810){_0x70504d=_0x70504d-0x0;var _0x47e29b=_0x854e[_0x70504d];return _0x47e29b;};'use strict';var client=require(_0xe854('0x0'));exports[_0xe854('0x1')]=function(_0x44fbe0){return function(_0x1447a6){return client[_0xe854('0x2')](_0xe854('0x3'),{'options':{'raw':![],'attributes':['id','name','channel',_0xe854('0x4')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field',_0xe854('0x5'),_0xe854('0x6')]},{'model':'Condition','as':_0xe854('0x7'),'attributes':['id',_0xe854('0x8'),'operator',_0xe854('0x6')]},{'model':_0xe854('0x9'),'as':_0xe854('0xa'),'attributes':['id','action',_0xe854('0xb'),'data2',_0xe854('0xc'),_0xe854('0xd'),'data5',_0xe854('0xe'),'data7']}]},'log':_0xe854('0x3')});};}; \ No newline at end of file +var _0xa993=['value','AnyConditions','operator','Action','Actions','action','data2','data3','data5','data6','../client','getTriggers','GetTrigger','name','channel','status','Condition','field'];(function(_0x5bc369,_0x33fae4){var _0x458794=function(_0x4d5884){while(--_0x4d5884){_0x5bc369['push'](_0x5bc369['shift']());}};_0x458794(++_0x33fae4);}(_0xa993,0x76));var _0x3a99=function(_0x15138b,_0x39baab){_0x15138b=_0x15138b-0x0;var _0x3248b7=_0xa993[_0x15138b];return _0x3248b7;};'use strict';var client=require(_0x3a99('0x0'));exports[_0x3a99('0x1')]=function(_0x41505c){return function(_0xd37762){return client['Request'](_0x3a99('0x2'),{'options':{'raw':![],'attributes':['id',_0x3a99('0x3'),_0x3a99('0x4'),_0x3a99('0x5')],'include':[{'model':_0x3a99('0x6'),'as':'AllConditions','attributes':['id',_0x3a99('0x7'),'operator',_0x3a99('0x8')]},{'model':_0x3a99('0x6'),'as':_0x3a99('0x9'),'attributes':['id','field',_0x3a99('0xa'),'value']},{'model':_0x3a99('0xb'),'as':_0x3a99('0xc'),'attributes':['id',_0x3a99('0xd'),'data1',_0x3a99('0xe'),_0x3a99('0xf'),'data4',_0x3a99('0x10'),_0x3a99('0x11'),'data7']}]},'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 ed1d57d..e7bf8f1 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 _0xfdeb=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x3fcdc6,_0x2e32a1){var _0x72f194=function(_0x51f140){while(--_0x51f140){_0x3fcdc6['push'](_0x3fcdc6['shift']());}};_0x72f194(++_0x2e32a1);}(_0xfdeb,0x11f));var _0xbfde=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0xfdeb[_0x1406ae];return _0x23a076;};'use strict';var client=require(_0xbfde('0x0'));exports[_0xbfde('0x1')]=function(_0x22f794){return function(_0x1266c8){return client[_0xbfde('0x2')](_0xbfde('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbfde('0x4'),_0xbfde('0x5')]},'log':_0xbfde('0x3')});};}; \ No newline at end of file +var _0xb156=['name','getTrunks','Request','GetTrunk'];(function(_0x144712,_0x13e8c3){var _0x201d67=function(_0x3b79a9){while(--_0x3b79a9){_0x144712['push'](_0x144712['shift']());}};_0x201d67(++_0x13e8c3);}(_0xb156,0x189));var _0x6b15=function(_0x18e014,_0x593ba7){_0x18e014=_0x18e014-0x0;var _0x858ce3=_0xb156[_0x18e014];return _0x858ce3;};'use strict';var client=require('../client');exports[_0x6b15('0x0')]=function(_0x3d5755){return function(_0x54b604){return client[_0x6b15('0x1')](_0x6b15('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6b15('0x3'),'registry']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2cdc663..d87d34b 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 _0x7b11=['lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','name','accountcode','internal','savePause','PauseUser','saveUnpause','UnpauseUser','online','pauseType','getAgent','../client','getAgents','Request','GetUser','agent','email','fullname','lastLoginAt'];(function(_0x117478,_0x1332cb){var _0x41d368=function(_0x415ba2){while(--_0x415ba2){_0x117478['push'](_0x117478['shift']());}};_0x41d368(++_0x1332cb);}(_0x7b11,0xc0));var _0x17b1=function(_0x1a7342,_0x5518b9){_0x1a7342=_0x1a7342-0x0;var _0x18aa6a=_0x7b11[_0x1a7342];return _0x18aa6a;};'use strict';var client=require(_0x17b1('0x0'));exports[_0x17b1('0x1')]=function(){return function(){return client[_0x17b1('0x2')](_0x17b1('0x3'),{'options':{'raw':![],'where':{'role':_0x17b1('0x4')},'attributes':['id','name',_0x17b1('0x5'),'accountcode',_0x17b1('0x6'),'online',_0x17b1('0x7'),'pauseType',_0x17b1('0x8'),_0x17b1('0x9'),_0x17b1('0xa'),_0x17b1('0xb'),_0x17b1('0xc')]},'log':_0x17b1('0x1')});};};exports[_0x17b1('0xd')]=function(){return function(){return client['Request'](_0x17b1('0x3'),{'options':{'raw':!![],'where':{'role':_0x17b1('0xe')},'attributes':['id',_0x17b1('0xf'),_0x17b1('0x10'),_0x17b1('0x11')]},'log':'getTelephones'});};};exports[_0x17b1('0x12')]=function(_0x376df2,_0x4dd338,_0x2e26d1){return client[_0x17b1('0x2')](_0x17b1('0x13'),{'body':{'type':_0x4dd338,'uniqueid':_0x2e26d1},'options':{'where':{'id':_0x376df2['id']}},'log':_0x17b1('0x12')});};exports[_0x17b1('0x14')]=function(_0x1c0aaa){return client[_0x17b1('0x2')](_0x17b1('0x15'),{'body':{},'options':{'where':{'id':_0x1c0aaa['id']}},'log':_0x17b1('0x12')});};exports['getAgent']=function(_0x6f0f5){return client[_0x17b1('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x17b1('0x4'),'id':_0x6f0f5},'attributes':['id',_0x17b1('0xf'),'email','accountcode',_0x17b1('0x6'),_0x17b1('0x16'),'lastLoginAt',_0x17b1('0x17'),_0x17b1('0x8'),'voicePause','interface']},'log':_0x17b1('0x18')});}; \ No newline at end of file +var _0x7a78=['lastLoginAt','pauseType','lastPauseAt','voicePause','phone','getTelephones','telephone','internal','savePause','PauseUser','getAgent','ShowUser','interface','getAgents','Request','GetUser','agent','name','accountcode','fullname','online'];(function(_0x5c22fc,_0x4f68e5){var _0xe8c418=function(_0x17c712){while(--_0x17c712){_0x5c22fc['push'](_0x5c22fc['shift']());}};_0xe8c418(++_0x4f68e5);}(_0x7a78,0xb5));var _0x87a7=function(_0x442423,_0x374da2){_0x442423=_0x442423-0x0;var _0x78428b=_0x7a78[_0x442423];return _0x78428b;};'use strict';var client=require('../client');exports[_0x87a7('0x0')]=function(){return function(){return client[_0x87a7('0x1')](_0x87a7('0x2'),{'options':{'raw':![],'where':{'role':_0x87a7('0x3')},'attributes':['id',_0x87a7('0x4'),'email',_0x87a7('0x5'),_0x87a7('0x6'),_0x87a7('0x7'),_0x87a7('0x8'),_0x87a7('0x9'),_0x87a7('0xa'),_0x87a7('0xb'),_0x87a7('0xc'),'mobile','interface']},'log':_0x87a7('0x0')});};};exports[_0x87a7('0xd')]=function(){return function(){return client[_0x87a7('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x87a7('0xe')},'attributes':['id',_0x87a7('0x4'),_0x87a7('0x5'),_0x87a7('0xf')]},'log':_0x87a7('0xd')});};};exports[_0x87a7('0x10')]=function(_0x37bfc2,_0x3b63ed,_0x4f5aa6){return client[_0x87a7('0x1')](_0x87a7('0x11'),{'body':{'type':_0x3b63ed,'uniqueid':_0x4f5aa6},'options':{'where':{'id':_0x37bfc2['id']}},'log':_0x87a7('0x10')});};exports['saveUnpause']=function(_0x8248a5){return client[_0x87a7('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x8248a5['id']}},'log':_0x87a7('0x10')});};exports[_0x87a7('0x12')]=function(_0x49e1ee){return client[_0x87a7('0x1')](_0x87a7('0x13'),{'options':{'raw':![],'where':{'role':_0x87a7('0x3'),'id':_0x49e1ee},'attributes':['id',_0x87a7('0x4'),'email',_0x87a7('0x5'),_0x87a7('0x6'),_0x87a7('0x7'),_0x87a7('0x8'),_0x87a7('0x9'),'lastPauseAt',_0x87a7('0xb'),_0x87a7('0x14')]},'log':_0x87a7('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 3d97055..6d51229 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 _0x98ba=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x1af899,_0xd62497){var _0x31291f=function(_0x4db0bf){while(--_0x4db0bf){_0x1af899['push'](_0x1af899['shift']());}};_0x31291f(++_0xd62497);}(_0x98ba,0x1e6));var _0xa98b=function(_0x243cc4,_0x54eb93){_0x243cc4=_0x243cc4-0x0;var _0x5b7582=_0x98ba[_0x243cc4];return _0x5b7582;};'use strict';var client=require('../client');exports['create']=function(_0x1931c3){return client[_0xa98b('0x0')](_0xa98b('0x1'),{'body':_0x1931c3,'log':_0xa98b('0x1')});};exports['update']=function(_0x12ac74,_0x1592f7,_0x1d89e9){return client['Request'](_0xa98b('0x2'),{'body':_0x12ac74,'options':{'where':{'uniqueid':_0x1592f7,'interface':_0x1d89e9}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x17ae=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client','create'];(function(_0xf9b41e,_0x32cbb0){var _0xdb1456=function(_0x1557cf){while(--_0x1557cf){_0xf9b41e['push'](_0xf9b41e['shift']());}};_0xdb1456(++_0x32cbb0);}(_0x17ae,0x9e));var _0xe17a=function(_0x2288fb,_0x4e2c1f){_0x2288fb=_0x2288fb-0x0;var _0x5325fa=_0x17ae[_0x2288fb];return _0x5325fa;};'use strict';var client=require(_0xe17a('0x0'));exports[_0xe17a('0x1')]=function(_0x420029){return client['Request'](_0xe17a('0x2'),{'body':_0x420029,'log':_0xe17a('0x2')});};exports['update']=function(_0x540617,_0x581412,_0x55c70a){return client[_0xe17a('0x3')](_0xe17a('0x4'),{'body':_0x540617,'options':{'where':{'uniqueid':_0x581412,'interface':_0x55c70a}},'log':_0xe17a('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 69edc5d..652e7a7 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 _0x09b8=['type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x46cbbe,_0x4f6929){var _0x223fbf=function(_0x30ba50){while(--_0x30ba50){_0x46cbbe['push'](_0x46cbbe['shift']());}};_0x223fbf(++_0x4f6929);}(_0x09b8,0x15d));var _0x809b=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x09b8[_0x500419];return _0x241c1a;};'use strict';var moment=require(_0x809b('0x0'));var util=require(_0x809b('0x1'));var _=require(_0x809b('0x2'));var client=require('../client');exports[_0x809b('0x3')]=function(_0x379c46){return client['Request'](_0x809b('0x4'),{'body':_[_0x809b('0x5')](_0x379c46,{'source':_0x379c46[_0x809b('0x6')],'destinationcontext':_0x379c46[_0x809b('0x7')],'callerid':_0x379c46[_0x809b('0x8')],'amaflags':_0x809b('0x9')}),'log':_0x809b('0x4')});};exports[_0x809b('0xa')]=function(){return function(){return client[_0x809b('0xb')](_0x809b('0xc'),{'options':{'where':{'type':[_0x809b('0xd')],'createdAt':{'$between':[moment()[_0x809b('0xe')](_0x809b('0xf'))[_0x809b('0x10')](_0x809b('0x11')),moment()[_0x809b('0x12')](_0x809b('0xf'))[_0x809b('0x10')](_0x809b('0x11'))]}},'attributes':[_0x809b('0x13'),_0x809b('0x14'),'duration',_0x809b('0x15')]},'log':_0x809b('0x16')});};}; \ No newline at end of file +var _0x6393=['../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','format','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash'];(function(_0x1d0764,_0x2beb7c){var _0x423f49=function(_0x5334ee){while(--_0x5334ee){_0x1d0764['push'](_0x1d0764['shift']());}};_0x423f49(++_0x2beb7c);}(_0x6393,0x138));var _0x3639=function(_0x5c1ade,_0xaa1212){_0x5c1ade=_0x5c1ade-0x0;var _0x4980b4=_0x6393[_0x5c1ade];return _0x4980b4;};'use strict';var moment=require(_0x3639('0x0'));var util=require(_0x3639('0x1'));var _=require(_0x3639('0x2'));var client=require(_0x3639('0x3'));exports['create']=function(_0x31bcfd){return client[_0x3639('0x4')](_0x3639('0x5'),{'body':_[_0x3639('0x6')](_0x31bcfd,{'source':_0x31bcfd[_0x3639('0x7')],'destinationcontext':_0x31bcfd[_0x3639('0x8')],'callerid':_0x31bcfd[_0x3639('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x3639('0x5')});};exports[_0x3639('0xa')]=function(){return function(){return client[_0x3639('0x4')](_0x3639('0xb'),{'options':{'where':{'type':[_0x3639('0xc')],'createdAt':{'$between':[moment()[_0x3639('0xd')](_0x3639('0xe'))['format'](_0x3639('0xf')),moment()['endOf'](_0x3639('0xe'))[_0x3639('0x10')](_0x3639('0xf'))]}},'attributes':[_0x3639('0x11'),_0x3639('0x12'),'duration',_0x3639('0x13')]},'log':_0x3639('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 2aa1182..247305c 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 _0x2a68=['../client','create','Request','CreateVoiceDialReport'];(function(_0x387c65,_0x2fd251){var _0x4d24b7=function(_0x58e055){while(--_0x58e055){_0x387c65['push'](_0x387c65['shift']());}};_0x4d24b7(++_0x2fd251);}(_0x2a68,0x1ec));var _0x82a6=function(_0x1f56a7,_0x10a5d5){_0x1f56a7=_0x1f56a7-0x0;var _0x31d64a=_0x2a68[_0x1f56a7];return _0x31d64a;};'use strict';var client=require(_0x82a6('0x0'));exports[_0x82a6('0x1')]=function(_0x20d181){return client[_0x82a6('0x2')](_0x82a6('0x3'),{'body':_0x20d181,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xd573=['../client','Request','CreateVoiceDialReport'];(function(_0x2d253d,_0x211470){var _0x2955ed=function(_0x395030){while(--_0x395030){_0x2d253d['push'](_0x2d253d['shift']());}};_0x2955ed(++_0x211470);}(_0xd573,0x14a));var _0x3d57=function(_0x2867d8,_0x1caea5){_0x2867d8=_0x2867d8-0x0;var _0x299643=_0xd573[_0x2867d8];return _0x299643;};'use strict';var client=require(_0x3d57('0x0'));exports['create']=function(_0x8b471f){return client[_0x3d57('0x1')](_0x3d57('0x2'),{'body':_0x8b471f,'log':_0x3d57('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b3bb14c..50e8402 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 _0x0b70=['getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x3b2526,_0x278079){var _0x5e40bf=function(_0x548616){while(--_0x548616){_0x3b2526['push'](_0x3b2526['shift']());}};_0x5e40bf(++_0x278079);}(_0x0b70,0x159));var _0x00b7=function(_0x2dafa1,_0x5ec091){_0x2dafa1=_0x2dafa1-0x0;var _0x420614=_0x0b70[_0x2dafa1];return _0x420614;};'use strict';var client=require('../client');exports[_0x00b7('0x0')]=function(){return function(){return client['Request'](_0x00b7('0x1'),{'options':{'raw':!![],'attributes':['id',_0x00b7('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x00b7('0x0')});};}; \ No newline at end of file +var _0x05b6=['recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension','exten'];(function(_0x53d003,_0x1e19b0){var _0x1fe900=function(_0x23cebb){while(--_0x23cebb){_0x53d003['push'](_0x53d003['shift']());}};_0x1fe900(++_0x1e19b0);}(_0x05b6,0x74));var _0x605b=function(_0x1046ba,_0x17699d){_0x1046ba=_0x1046ba-0x0;var _0x31ae08=_0x05b6[_0x1046ba];return _0x31ae08;};'use strict';var client=require(_0x605b('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x605b('0x1')](_0x605b('0x2'),{'options':{'raw':!![],'attributes':['id',_0x605b('0x3'),_0x605b('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x605b('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index f373527..40fffc6 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 _0x5a12=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence'];(function(_0x2af859,_0xb2d9a8){var _0x494940=function(_0x232425){while(--_0x232425){_0x2af859['push'](_0x2af859['shift']());}};_0x494940(++_0xb2d9a8);}(_0x5a12,0x11c));var _0x25a1=function(_0x277b93,_0x1da0dd){_0x277b93=_0x277b93-0x0;var _0x3f5764=_0x5a12[_0x277b93];return _0x3f5764;};'use strict';var client=require(_0x25a1('0x0'));exports[_0x25a1('0x1')]=function(){return function(){return client[_0x25a1('0x2')](_0x25a1('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x25a1('0x4'),_0x25a1('0x5'),_0x25a1('0x6'),_0x25a1('0x7'),_0x25a1('0x8'),_0x25a1('0x9'),'dialMethod',_0x25a1('0xa'),'dialLimitQueue',_0x25a1('0xb'),'dialPredictiveOptimization',_0x25a1('0xc'),'dialPredictiveInterval',_0x25a1('0xd'),_0x25a1('0xe'),'dialOriginateTimeout','dialQueueOptions','dialQueueTimeout',_0x25a1('0xf'),_0x25a1('0x10'),_0x25a1('0x11'),_0x25a1('0x12'),_0x25a1('0x13'),_0x25a1('0x14'),_0x25a1('0x15'),_0x25a1('0x16'),_0x25a1('0x17'),_0x25a1('0x18'),'dialPrefix',_0x25a1('0x19'),_0x25a1('0x1a'),'dialAMDInitialSilence','dialAMDGreeting',_0x25a1('0x1b'),'dialAMDTotalAnalysisTime',_0x25a1('0x1c'),_0x25a1('0x1d'),_0x25a1('0x1e'),_0x25a1('0x1f'),_0x25a1('0x20'),'timeout',_0x25a1('0x21'),_0x25a1('0x22'),_0x25a1('0x23'),_0x25a1('0x24'),'dialAgiAfterHangupClient',_0x25a1('0x25'),'monitor_format',_0x25a1('0x26'),_0x25a1('0x27'),'dialCutDigit',_0x25a1('0x28'),_0x25a1('0x29'),_0x25a1('0x2a')],'include':[{'model':_0x25a1('0x2b'),'as':_0x25a1('0x2b'),'attributes':['id',_0x25a1('0x2c'),'callerid',_0x25a1('0x2d')]},{'model':_0x25a1('0x2e'),'as':_0x25a1('0x2f'),'attributes':['id',_0x25a1('0x2c')]},{'model':_0x25a1('0x2b'),'as':_0x25a1('0x30'),'attributes':['id',_0x25a1('0x2c'),_0x25a1('0x31'),_0x25a1('0x2d')]},{'model':_0x25a1('0x32'),'as':_0x25a1('0x32'),'attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x25a1('0x2c'),_0x25a1('0x33')]}]}]},'log':_0x25a1('0x1')});};}; \ No newline at end of file +var _0x5346=['dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x5b3c99,_0xaad73b){var _0x5ee466=function(_0x4141ef){while(--_0x4141ef){_0x5b3c99['push'](_0x5b3c99['shift']());}};_0x5ee466(++_0xaad73b);}(_0x5346,0x157));var _0x6534=function(_0x25b378,_0x4d949f){_0x25b378=_0x25b378-0x0;var _0xc1c468=_0x5346[_0x25b378];return _0xc1c468;};'use strict';var client=require(_0x6534('0x0'));exports[_0x6534('0x1')]=function(){return function(){return client[_0x6534('0x2')](_0x6534('0x3'),{'options':{'raw':![],'attributes':['id',_0x6534('0x4'),_0x6534('0x5'),_0x6534('0x6'),_0x6534('0x7'),_0x6534('0x8'),_0x6534('0x9'),_0x6534('0xa'),_0x6534('0xb'),_0x6534('0xc'),_0x6534('0xd'),_0x6534('0xe'),_0x6534('0xf'),_0x6534('0x10'),_0x6534('0x11'),'dialOriginateCallerIdName',_0x6534('0x12'),_0x6534('0x13'),_0x6534('0x14'),_0x6534('0x15'),_0x6534('0x16'),_0x6534('0x17'),_0x6534('0x18'),_0x6534('0x19'),_0x6534('0x1a'),'dialNoAnswerMaxRetry',_0x6534('0x1b'),_0x6534('0x1c'),'dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType',_0x6534('0x1d'),_0x6534('0x1e'),'dialAMDGreeting',_0x6534('0x1f'),_0x6534('0x20'),_0x6534('0x21'),_0x6534('0x22'),_0x6534('0x23'),_0x6534('0x24'),'dialAMDMaximumWordLength',_0x6534('0x25'),_0x6534('0x26'),'dialRecallInQueue',_0x6534('0x27'),_0x6534('0x28'),_0x6534('0x29'),_0x6534('0x2a'),_0x6534('0x8'),_0x6534('0x2b'),_0x6534('0x2c'),_0x6534('0x2d'),_0x6534('0x2e'),_0x6534('0x2f'),_0x6534('0x30')],'include':[{'model':_0x6534('0x31'),'as':'Trunk','attributes':['id',_0x6534('0x4'),_0x6534('0x32'),'active']},{'model':_0x6534('0x33'),'as':_0x6534('0x34'),'attributes':['id',_0x6534('0x4')]},{'model':_0x6534('0x31'),'as':'TrunkBackup','attributes':['id',_0x6534('0x4'),'callerid','active']},{'model':_0x6534('0x35'),'as':_0x6534('0x35'),'attributes':['id',_0x6534('0x4')],'include':[{'model':_0x6534('0x35'),'as':'Intervals','attributes':['id',_0x6534('0x4'),_0x6534('0x36')]}]}]},'log':_0x6534('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 0df76a0..566bbb1 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 _0x5d4e=['day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','endOf'];(function(_0x16a1f8,_0xd57bbd){var _0x207a17=function(_0x1a8ab1){while(--_0x1a8ab1){_0x16a1f8['push'](_0x16a1f8['shift']());}};_0x207a17(++_0xd57bbd);}(_0x5d4e,0x138));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var _=require(_0xe5d4('0x0'));var client=require(_0xe5d4('0x1'));exports[_0xe5d4('0x2')]=function(_0x30de6a){return client[_0xe5d4('0x3')]('CreateVoiceQueueReport',{'body':_0x30de6a,'log':_0xe5d4('0x4')});};exports[_0xe5d4('0x5')]=function(){return function(){return client[_0xe5d4('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xe5d4('0x6')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xe5d4('0x7')](_0xe5d4('0x8'))[_0xe5d4('0x9')](_0xe5d4('0xa'))]}},'attributes':[_0xe5d4('0xb'),_0xe5d4('0xc'),_0xe5d4('0xd'),_0xe5d4('0xe'),_0xe5d4('0xf'),_0xe5d4('0x10'),_0xe5d4('0x11'),'queuecallerexitAt','queuecallerabandon',_0xe5d4('0x12')]},'log':_0xe5d4('0x13')});};}; \ No newline at end of file +var _0x576c=['moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','GetVoiceQueueReports'];(function(_0x28e471,_0x13c525){var _0x57d9ea=function(_0x6499dd){while(--_0x6499dd){_0x28e471['push'](_0x28e471['shift']());}};_0x57d9ea(++_0x13c525);}(_0x576c,0x7e));var _0xc576=function(_0x1a20ec,_0x27626c){_0x1a20ec=_0x1a20ec-0x0;var _0x3a2ec1=_0x576c[_0x1a20ec];return _0x3a2ec1;};'use strict';var moment=require(_0xc576('0x0'));var _=require(_0xc576('0x1'));var client=require(_0xc576('0x2'));exports[_0xc576('0x3')]=function(_0x12d8d4){return client[_0xc576('0x4')](_0xc576('0x5'),{'body':_0x12d8d4,'log':'CreateVoiceQueueReport'});};exports[_0xc576('0x6')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xc576('0x7'))[_0xc576('0x8')](_0xc576('0x9')),moment()[_0xc576('0xa')](_0xc576('0x7'))['format'](_0xc576('0x9'))]}},'attributes':[_0xc576('0xb'),'queue',_0xc576('0xc'),_0xc576('0xd'),_0xc576('0xe'),_0xc576('0xf'),_0xc576('0x10'),'queuecallerexitAt','queuecallerabandon','queuecallerabandonAt']},'log':_0xc576('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index f1c2935..0e3aa80 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 _0x471a=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x42d8a2,_0x5c5685){var _0x2ebd45=function(_0x5272dc){while(--_0x5272dc){_0x42d8a2['push'](_0x42d8a2['shift']());}};_0x2ebd45(++_0x5c5685);}(_0x471a,0x1af));var _0xa471=function(_0x393cbd,_0x3a037f){_0x393cbd=_0x393cbd-0x0;var _0x22fb35=_0x471a[_0x393cbd];return _0x22fb35;};'use strict';var client=require(_0xa471('0x0'));exports[_0xa471('0x1')]=function(_0x20a666){return function(){return client[_0xa471('0x2')](_0xa471('0x3'),{'options':{'where':{'VoiceQueueId':_0x20a666,'paused':!![]},'raw':!![]},'log':_0xa471('0x1')});};}; \ No newline at end of file +var _0xe7d5=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x101c6a,_0x2c2b0f){var _0x5afe8e=function(_0x163702){while(--_0x163702){_0x101c6a['push'](_0x101c6a['shift']());}};_0x5afe8e(++_0x2c2b0f);}(_0xe7d5,0x190));var _0x5e7d=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xe7d5[_0xc4001c];return _0x49f7bc;};'use strict';var client=require(_0x5e7d('0x0'));exports[_0x5e7d('0x1')]=function(_0x228018){return function(){return client['Request'](_0x5e7d('0x2'),{'options':{'where':{'VoiceQueueId':_0x228018,'paused':!![]},'raw':!![]},'log':_0x5e7d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4931c9b..c048a64 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 _0x2dce=['lodash','../client','create','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0x3cb465,_0x36d920){var _0x4e197b=function(_0x25fd7d){while(--_0x25fd7d){_0x3cb465['push'](_0x3cb465['shift']());}};_0x4e197b(++_0x36d920);}(_0x2dce,0xd2));var _0xe2dc=function(_0x2b7c8d,_0x555b55){_0x2b7c8d=_0x2b7c8d-0x0;var _0x30f8f7=_0x2dce[_0x2b7c8d];return _0x30f8f7;};'use strict';var _=require(_0xe2dc('0x0'));var client=require(_0xe2dc('0x1'));exports[_0xe2dc('0x2')]=function(_0xf2dc24){return client[_0xe2dc('0x3')](_0xe2dc('0x4'),{'body':_[_0xe2dc('0x5')](_0xf2dc24,{'value':_0xf2dc24[_0xe2dc('0x6')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x3143=['CreateVoiceRecording','lodash','../client','create','Request','merge','monitorFilename'];(function(_0x451f19,_0x5e94d6){var _0x799bd2=function(_0x37ee54){while(--_0x37ee54){_0x451f19['push'](_0x451f19['shift']());}};_0x799bd2(++_0x5e94d6);}(_0x3143,0x94));var _0x3314=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x3143[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x3314('0x0'));var client=require(_0x3314('0x1'));exports[_0x3314('0x2')]=function(_0x1c0bcb){return client[_0x3314('0x3')]('CreateVoiceRecording',{'body':_[_0x3314('0x4')](_0x1c0bcb,{'value':_0x1c0bcb[_0x3314('0x5')]}),'log':_0x3314('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 3d85956..7c7ca2f 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 _0x30ed=['secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','Request','result','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x39017c,_0x15f210){var _0x584624=function(_0x48afe4){while(--_0x48afe4){_0x39017c['push'](_0x39017c['shift']());}};_0x584624(++_0x15f210);}(_0x30ed,0x1e1));var _0xd30e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30ed[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xd30e('0x0'));exports['blindTransfer']=function(_0x370a88){return client[_0xd30e('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x370a88[_0xd30e('0x2')],'transfererchannel':_0x370a88['transfererchannel'],'transferercalleridnum':_0x370a88[_0xd30e('0x3')],'transferercalleridname':_0x370a88['transferercalleridname'],'transfererconnectedlinenum':_0x370a88[_0xd30e('0x4')],'transfererconnectedlinename':_0x370a88[_0xd30e('0x5')],'transfereraccountcode':_0x370a88[_0xd30e('0x6')],'transferercontext':_0x370a88[_0xd30e('0x7')],'transfererexten':_0x370a88[_0xd30e('0x8')],'transfererlinkedid':_0x370a88[_0xd30e('0x9')],'transfereechannel':_0x370a88[_0xd30e('0xa')],'transfereecalleridnum':_0x370a88[_0xd30e('0xb')],'transfereecalleridname':_0x370a88[_0xd30e('0xc')],'transfereeconnectedlinenum':_0x370a88[_0xd30e('0xd')],'transfereeconnectedlinename':_0x370a88['transfereeconnectedlinename'],'transfereeaccountcode':_0x370a88['transfereeaccountcode'],'transfereecontext':_0x370a88[_0xd30e('0xe')],'transfereeexten':_0x370a88[_0xd30e('0xf')],'transfereelinkedid':_0x370a88[_0xd30e('0x10')],'isexternal':_0x370a88[_0xd30e('0x11')],'context':_0x370a88[_0xd30e('0x12')],'extension':_0x370a88[_0xd30e('0x13')],'type':_0xd30e('0x14')},'log':_0xd30e('0x15')});};exports[_0xd30e('0x16')]=function(_0x53d20f){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x53d20f[_0xd30e('0x2')],'transfererchannel':_0x53d20f[_0xd30e('0x17')],'transferercalleridnum':_0x53d20f[_0xd30e('0x18')],'transferercalleridname':_0x53d20f[_0xd30e('0x19')],'transfererconnectedlinenum':_0x53d20f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x53d20f[_0xd30e('0x1a')],'transfereraccountcode':_0x53d20f['origtransfereraccountcode'],'transferercontext':_0x53d20f[_0xd30e('0x1b')],'transfererexten':_0x53d20f['secondtransfererexten'],'transfererlinkedid':_0x53d20f[_0xd30e('0x1c')],'transfereechannel':_0x53d20f[_0xd30e('0x1d')],'transfereecalleridnum':_0x53d20f[_0xd30e('0x1e')],'transfereecalleridname':_0x53d20f[_0xd30e('0x1f')],'transfereeconnectedlinenum':_0x53d20f[_0xd30e('0x20')],'transfereeconnectedlinename':_0x53d20f[_0xd30e('0x21')],'transfereeaccountcode':_0x53d20f[_0xd30e('0x22')],'transfereecontext':_0x53d20f[_0xd30e('0x23')],'transfereeexten':_0x53d20f[_0xd30e('0x24')],'transfereelinkedid':_0x53d20f[_0xd30e('0x25')],'isexternal':_0x53d20f[_0xd30e('0x11')],'context':_0x53d20f['origtransferercontext'],'extension':_0x53d20f['origtransfererexten'],'type':_0xd30e('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x77c0=['transfereeexten','transfereelinkedid','isexternal','context','extension','CreateVoiceTransferReport','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext'];(function(_0x3abcd7,_0x54e445){var _0x2e4393=function(_0x552567){while(--_0x552567){_0x3abcd7['push'](_0x3abcd7['shift']());}};_0x2e4393(++_0x54e445);}(_0x77c0,0x120));var _0x077c=function(_0x515d9e,_0x1a897d){_0x515d9e=_0x515d9e-0x0;var _0x354a87=_0x77c0[_0x515d9e];return _0x354a87;};'use strict';var client=require(_0x077c('0x0'));exports[_0x077c('0x1')]=function(_0xf5e658){return client[_0x077c('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0xf5e658[_0x077c('0x3')],'transfererchannel':_0xf5e658[_0x077c('0x4')],'transferercalleridnum':_0xf5e658[_0x077c('0x5')],'transferercalleridname':_0xf5e658[_0x077c('0x6')],'transfererconnectedlinenum':_0xf5e658[_0x077c('0x7')],'transfererconnectedlinename':_0xf5e658[_0x077c('0x8')],'transfereraccountcode':_0xf5e658[_0x077c('0x9')],'transferercontext':_0xf5e658['transferercontext'],'transfererexten':_0xf5e658[_0x077c('0xa')],'transfererlinkedid':_0xf5e658[_0x077c('0xb')],'transfereechannel':_0xf5e658['transfereechannel'],'transfereecalleridnum':_0xf5e658[_0x077c('0xc')],'transfereecalleridname':_0xf5e658['transfereecalleridname'],'transfereeconnectedlinenum':_0xf5e658['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0xf5e658[_0x077c('0xd')],'transfereeaccountcode':_0xf5e658[_0x077c('0xe')],'transfereecontext':_0xf5e658[_0x077c('0xf')],'transfereeexten':_0xf5e658[_0x077c('0x10')],'transfereelinkedid':_0xf5e658[_0x077c('0x11')],'isexternal':_0xf5e658[_0x077c('0x12')],'context':_0xf5e658[_0x077c('0x13')],'extension':_0xf5e658[_0x077c('0x14')],'type':'blind'},'log':_0x077c('0x15')});};exports[_0x077c('0x16')]=function(_0x3eefa6){return client[_0x077c('0x2')](_0x077c('0x15'),{'body':{'result':_0x3eefa6[_0x077c('0x3')],'transfererchannel':_0x3eefa6['origtransfererchannel'],'transferercalleridnum':_0x3eefa6['origtransferercalleridnum'],'transferercalleridname':_0x3eefa6[_0x077c('0x17')],'transfererconnectedlinenum':_0x3eefa6[_0x077c('0x18')],'transfererconnectedlinename':_0x3eefa6[_0x077c('0x19')],'transfereraccountcode':_0x3eefa6[_0x077c('0x1a')],'transferercontext':_0x3eefa6[_0x077c('0x1b')],'transfererexten':_0x3eefa6['secondtransfererexten'],'transfererlinkedid':_0x3eefa6[_0x077c('0x1c')],'transfereechannel':_0x3eefa6[_0x077c('0x1d')],'transfereecalleridnum':_0x3eefa6['transfertargetcalleridnum'],'transfereecalleridname':_0x3eefa6[_0x077c('0x1e')],'transfereeconnectedlinenum':_0x3eefa6[_0x077c('0x1f')],'transfereeconnectedlinename':_0x3eefa6[_0x077c('0x20')],'transfereeaccountcode':_0x3eefa6[_0x077c('0x21')],'transfereecontext':_0x3eefa6['transfertargetcontext'],'transfereeexten':_0x3eefa6['transfertargetexten'],'transfereelinkedid':_0x3eefa6[_0x077c('0x22')],'isexternal':_0x3eefa6[_0x077c('0x12')],'context':_0x3eefa6[_0x077c('0x23')],'extension':_0x3eefa6[_0x077c('0x24')],'type':_0x077c('0x25')},'log':_0x077c('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b9e5f06..302a105 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 _0x51ca=['outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','length','values','ami\x20disconnected','join','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','rec','MixMonitor\x20Success','mixmonitorid','Channel\x20doesn\x27t\x20exist','channels','resolve','StopMixMonitor','destinationchannel','status','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','outbound','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','pick','module','Reload','Action','then','message','catch','command','action','Command','voiceQueues','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','talking','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay'];(function(_0x491eb3,_0x5b2726){var _0x18a4a5=function(_0x1510f4){while(--_0x1510f4){_0x491eb3['push'](_0x491eb3['shift']());}};_0x18a4a5(++_0x5b2726);}(_0x51ca,0x163));var _0xa51c=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x51ca[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xa51c('0x0'));var util=require(_0xa51c('0x1'));var jayson=require('jayson/promise');var schema=require(_0xa51c('0x2'));var BPromise=require(_0xa51c('0x3'));var moment=require(_0xa51c('0x4'));var config=require(_0xa51c('0x5'));var properties=require('../properties');var ami=require(_0xa51c('0x6'));exports['listen']=function(_0x9e8293,_0x525eb3,_0x508187){return new BPromise(function(_0x295f46,_0x5c9b9e){var _0x5ad7fb={'QueuePause':function(_0x1c2ac5){return new Promise(function(_0x38af7e,_0x137f62){var _0x487d7c=util[_0xa51c('0x7')](_0xa51c('0x8'),_0xa51c('0x9'),_0x1c2ac5['name']);if(_0x9e8293[_0xa51c('0xa')]&&_0x9e8293[_0xa51c('0xa')][_0x487d7c]&&_0x9e8293[_0xa51c('0xa')][_0x487d7c][_0xa51c('0xb')]){_0x9e8293['timers'][_0x487d7c][_0xa51c('0xc')]();}if(_0x9e8293['agents'][_0x487d7c]){_0x9e8293[_0xa51c('0xd')][_0x487d7c][_0xa51c('0xe')]({'statePause':_0x1c2ac5[_0xa51c('0xf')]?!![]:![]});}_0x38af7e({'code':0xc8,'message':_0xa51c('0x10')});});},'Reload':function(_0x496807){var _0x9b741b=this;return new Promise(function(_0x6ca5ce,_0x382f59){if(ami[_0xa51c('0x11')]()==![]){return _0x382f59(_0x9b741b[_0xa51c('0x12')](0x1f4,[config[_0xa51c('0x13')]['ip'],config[_0xa51c('0x13')][_0xa51c('0x14')],'ami\x20disconnected']['join']('\x20')));}_0x496807=_[_0xa51c('0x15')](_0x496807,_['keys'](properties[_0xa51c('0x16')]));_0x496807['action']=_0xa51c('0x17');return ami[_0xa51c('0x18')](_0x496807)[_0xa51c('0x19')](function(_0x2c815e){_0x6ca5ce({'code':0xc8,'message':_0x2c815e[_0xa51c('0x1a')]});})[_0xa51c('0x1b')](function(_0x1ca4f4){_0x382f59(_0x9b741b['error'](0x1f5,_0x1ca4f4[_0xa51c('0x1a')]));});});},'Command':function(_0x37f6ab){var _0x3d9c14=this;return new Promise(function(_0x46216b,_0x522c78){if(ami[_0xa51c('0x11')]()==![]){return _0x522c78(_0x3d9c14['error'](0x1f4,[config[_0xa51c('0x13')]['ip'],config['asterisk'][_0xa51c('0x14')],'ami\x20disconnected']['join']('\x20')));}_0x37f6ab=_[_0xa51c('0x15')](_0x37f6ab,_0xa51c('0x1c'));_0x37f6ab[_0xa51c('0x1d')]=_0xa51c('0x1e');return ami[_0xa51c('0x18')](_0x37f6ab)[_0xa51c('0x19')](function(_0x38e80f){_0x46216b({'code':0xc8,'message':_0x38e80f['content']});})[_0xa51c('0x1b')](function(_0x4e96d3){_0x522c78(_0x3d9c14['error'](0x1f5,_0x4e96d3[_0xa51c('0x1a')]));});});},'VoiceQueues':function(_0x4a9c1f){return new Promise(function(_0xa3c0fd,_0x4f680f){var _0x453ab7=[];for(var _0x4ad236 in _0x9e8293[_0xa51c('0x1f')]){if(_0x9e8293['voiceQueues']['hasOwnProperty'](_0x4ad236)){var _0x1586ed=_0x9e8293[_0xa51c('0x1f')][_0x4ad236];var _0x36462d={'id':_0x1586ed['id'],'name':_0x1586ed['name'],'strategy':_0x1586ed[_0xa51c('0x20')],'answered':_0x1586ed[_0xa51c('0x21')],'available':_0x1586ed['available'],'loggedIn':_0x1586ed[_0xa51c('0x22')],'pTalking':_0x1586ed[_0xa51c('0x23')],'sumBillable':_0x1586ed[_0xa51c('0x24')],'sumDuration':_0x1586ed['sumDuration'],'sumHoldTime':_0x1586ed[_0xa51c('0x25')]||0x0,'talking':_0x1586ed[_0xa51c('0x26')],'total':_0x1586ed['total'],'type':_0x1586ed[_0xa51c('0x27')],'unmanaged':_0x1586ed[_0xa51c('0x28')],'abandoned':_0x1586ed[_0xa51c('0x29')],'waiting':_0x1586ed['waiting'],'loggedInDb':_0x1586ed[_0xa51c('0x2a')]};if(_0x1586ed[_0xa51c('0x27')]==='outbound'){_0x36462d[_0xa51c('0x2b')]=_0x1586ed[_0xa51c('0x2b')];_0x36462d['dialMethod']=_0x1586ed[_0xa51c('0x2c')];_0x36462d[_0xa51c('0x2d')]=_0x1586ed[_0xa51c('0x2d')];_0x36462d[_0xa51c('0x2e')]=_0x1586ed[_0xa51c('0x2e')];_0x36462d[_0xa51c('0x2f')]=_0x1586ed['dialOriginateTimeout'];_0x36462d[_0xa51c('0x30')]=_0x1586ed[_0xa51c('0x30')];_0x36462d[_0xa51c('0x31')]=_0x1586ed[_0xa51c('0x31')];_0x36462d['outboundAnswerCallsDay']=_0x1586ed['outboundAnswerCallsDay'];_0x36462d[_0xa51c('0x32')]=_0x1586ed[_0xa51c('0x32')];_0x36462d[_0xa51c('0x33')]=_0x1586ed['outboundBusyCallsDay'];_0x36462d[_0xa51c('0x34')]=_0x1586ed[_0xa51c('0x34')];_0x36462d[_0xa51c('0x35')]=_0x1586ed[_0xa51c('0x35')];_0x36462d[_0xa51c('0x36')]=_0x1586ed[_0xa51c('0x36')];_0x36462d['outboundDropCallsDayTimeout']=_0x1586ed[_0xa51c('0x37')];_0x36462d[_0xa51c('0x38')]=_0x1586ed[_0xa51c('0x38')];_0x36462d['outboundNoSuchCallsDay']=_0x1586ed[_0xa51c('0x39')];_0x36462d[_0xa51c('0x3a')]=_0x1586ed[_0xa51c('0x3a')];_0x36462d[_0xa51c('0x3b')]=_0x1586ed[_0xa51c('0x3b')];_0x36462d[_0xa51c('0x3c')]=_0x1586ed['outboundRejectCallsDay'];_0x36462d[_0xa51c('0x3d')]=_0x1586ed[_0xa51c('0x3d')];_0x36462d['predictiveIntervalAnsweredCalls']=_0x1586ed[_0xa51c('0x3e')];_0x36462d[_0xa51c('0x3f')]=_0x1586ed[_0xa51c('0x3f')];_0x36462d[_0xa51c('0x40')]=_0x1586ed[_0xa51c('0x40')];_0x36462d[_0xa51c('0x41')]=_0x1586ed[_0xa51c('0x41')];_0x36462d[_0xa51c('0x42')]=_0x1586ed[_0xa51c('0x42')];_0x36462d[_0xa51c('0x43')]=_0x1586ed[_0xa51c('0x43')];_0x36462d[_0xa51c('0x44')]=_0x1586ed['predictiveIntervalErlangCallsDroppedCalls'];_0x36462d[_0xa51c('0x45')]=_0x1586ed['predictiveIntervalHitRate'];_0x36462d['predictiveIntervalMultiplicativeFactor']=_0x1586ed['predictiveIntervalMultiplicativeFactor'];_0x36462d[_0xa51c('0x46')]=_0x1586ed[_0xa51c('0x46')];_0x36462d[_0xa51c('0x47')]=_0x1586ed[_0xa51c('0x47')];_0x36462d[_0xa51c('0x48')]=_0x1586ed[_0xa51c('0x48')];_0x36462d['message']=_0x1586ed['message'];_0x36462d[_0xa51c('0x49')]=_0x1586ed[_0xa51c('0x49')];_0x36462d['erlangCalls']=_0x1586ed['erlangCalls'];_0x36462d[_0xa51c('0x4a')]=_0x1586ed[_0xa51c('0x4a')];_0x36462d['erlangAbandonmentRate']=_0x1586ed[_0xa51c('0x4b')];_0x36462d[_0xa51c('0x4c')]=_0x1586ed[_0xa51c('0x4c')];_0x36462d[_0xa51c('0x4d')]=_0x1586ed['startPredictive'];_0x36462d[_0xa51c('0x4e')]=_0x1586ed[_0xa51c('0x4e')];}if(_0x1586ed['Trunk']){_0x36462d['Trunk']={'id':_0x1586ed[_0xa51c('0x4f')]['id'],'name':_0x1586ed[_0xa51c('0x4f')][_0xa51c('0x50')],'active':_0x1586ed[_0xa51c('0x4f')][_0xa51c('0x51')],'callerid':_0x1586ed[_0xa51c('0x4f')][_0xa51c('0x52')]};}if(_0x1586ed['Interval']){_0x36462d[_0xa51c('0x53')]={'id':_0x1586ed['Interval']['id'],'name':_0x1586ed[_0xa51c('0x53')][_0xa51c('0x50')]};}_0x453ab7['push'](_0x36462d);}}_0xa3c0fd({'count':_0x453ab7[_0xa51c('0x54')],'rows':_0x453ab7});});},'VoiceChannels':function(_0x5bba30){return new Promise(function(_0x4b22f3,_0xbd379e){var _0x612c1e=_[_0xa51c('0x55')](_0x9e8293['channels']);_0x4b22f3({'count':_0x612c1e[_0xa51c('0x54')],'rows':_0x612c1e});});},'VoiceChannelMixMonitor':function(_0x30ca4a){var _0x49e080=this;return new Promise(function(_0x2d0c46,_0x145ba8){if(ami[_0xa51c('0x11')]()==![]){return _0x145ba8(_0x49e080[_0xa51c('0x12')](0x1f4,[config[_0xa51c('0x13')]['ip'],config[_0xa51c('0x13')][_0xa51c('0x14')],_0xa51c('0x56')][_0xa51c('0x57')]('\x20')));}var _0x586951=schema(properties[_0xa51c('0x58')])['validate'](_0x30ca4a);if(_0x586951['length']>0x0){return _0x145ba8(_0x49e080[_0xa51c('0x12')](0x1f4,_[_0xa51c('0x59')](_0x586951,_0xa51c('0x1a'))[_0xa51c('0x57')](',\x20')));}var _0x4d6104=_['find'](_0x9e8293['channels'],{'uniqueid':_0x30ca4a[_0xa51c('0x5a')]});if(_0x4d6104&&_0x4d6104[_0xa51c('0x5b')]){var _0x43d63c=util[_0xa51c('0x7')](_0xa51c('0x5c'),_0x30ca4a[_0xa51c('0x5d')]||_0x30ca4a[_0xa51c('0x5a')],_0x30ca4a[_0xa51c('0x7')]||_0xa51c('0x5e'));return ami['Action']({'action':'MixMonitor','channel':_0x4d6104['channel'],'file':_0x43d63c,'options':'ai(mixmonitorid)'})['then'](function(_0x412504){var _0x40530e=_[_0xa51c('0x5f')](_0x4d6104[_0xa51c('0x60')],{'filename':_0xa51c('0x61')+_0x43d63c[_0xa51c('0x62')]()});if(_[_0xa51c('0x63')](_0x40530e)){_0x4d6104[_0xa51c('0x60')][_0xa51c('0x64')]({'filename':_0xa51c('0x61')+_0x43d63c[_0xa51c('0x62')](),'createdAt':moment()[_0xa51c('0x7')](_0xa51c('0x65')),'mixmonitorid':_0x412504['mixmonitorid'],'status':_0xa51c('0x66')});}else{_0x40530e['mixmonitorid']=_0x412504['mixmonitorid'];_0x40530e['status']=_0xa51c('0x66');}_0x2d0c46({'code':0xc8,'message':[_0x30ca4a[_0xa51c('0x5a')],_0xa51c('0x67'),_0x412504['mixmonitorid']][_0xa51c('0x57')]('\x20'),'mixmonitorid':_0x412504[_0xa51c('0x68')]});})[_0xa51c('0x1b')](function(_0x2cd1e7){_0x145ba8(_0x49e080['error'](0x1f5,[_0x30ca4a[_0xa51c('0x5a')],_0x2cd1e7[_0xa51c('0x1a')]['toLowerCase']()]['join']('\x20')));});}else{return _0x145ba8(_0x49e080[_0xa51c('0x12')](0x1f5,_0xa51c('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x1f04e2){var _0x475f9b=this;return new Promise(function(_0x540804,_0x373300){if(ami[_0xa51c('0x11')]()==![]){return _0x373300(_0x475f9b['error'](0x1f4,[config['asterisk']['ip'],config[_0xa51c('0x13')]['username'],_0xa51c('0x56')][_0xa51c('0x57')]('\x20')));}var _0x35363e=schema(properties['voicechannel'])['validate'](_0x1f04e2);if(_0x35363e['length']>0x0){return _0x373300(_0x475f9b[_0xa51c('0x12')](0x1f4,_[_0xa51c('0x59')](_0x35363e,_0xa51c('0x1a'))[_0xa51c('0x57')](',\x20')));}var _0x2d586c=_['find'](_0x9e8293[_0xa51c('0x6a')],{'uniqueid':_0x1f04e2[_0xa51c('0x5a')]});if(_0x2d586c){return BPromise[_0xa51c('0x6b')]()[_0xa51c('0x19')](function(){if(_0x2d586c[_0xa51c('0x5b')]){return ami[_0xa51c('0x18')]({'action':_0xa51c('0x6c'),'channel':_0x2d586c[_0xa51c('0x5b')],'mixmonitorid':_0x1f04e2[_0xa51c('0x68')]})[_0xa51c('0x1b')](function(_0x197162){});}})['then'](function(){if(_0x2d586c[_0xa51c('0x6d')]){return ami[_0xa51c('0x18')]({'action':_0xa51c('0x6c'),'channel':_0x2d586c['destinationchannel'],'mixmonitorid':_0x1f04e2[_0xa51c('0x68')]})[_0xa51c('0x1b')](function(_0x20da10){});}})[_0xa51c('0x19')](function(_0x55b584){var _0x441487=_['find'](_0x2d586c[_0xa51c('0x60')],{'mixmonitorid':_0x1f04e2[_0xa51c('0x68')]});if(_0x441487){_0x441487[_0xa51c('0x6e')]=_0xa51c('0x6f');}})[_0xa51c('0x19')](function(){var _0x3c535e=util[_0xa51c('0x7')](_0xa51c('0x5c'),_0x1f04e2['filename']||_0x1f04e2[_0xa51c('0x5a')],_0x1f04e2[_0xa51c('0x7')]||_0xa51c('0x5e'));var _0x10c2f1=_[_0xa51c('0x5f')](_0x2d586c[_0xa51c('0x60')],{'filename':_0xa51c('0x61')+_0x3c535e[_0xa51c('0x62')]()});if(_0x10c2f1){_0x10c2f1[_0xa51c('0x6e')]='stop';}})['then'](function(){_0x540804({'code':0xc8,'message':[_0x1f04e2['uniqueid'],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xa51c('0x1b')](function(_0x4bb285){_0x373300(_0x475f9b[_0xa51c('0x12')](0x1f5,[_0x1f04e2[_0xa51c('0x5a')],_0x4bb285['message'][_0xa51c('0x62')]()][_0xa51c('0x57')]('\x20')));});}else{return _0x373300(_0x475f9b[_0xa51c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x98811a){return new Promise(function(_0x3734c6,_0x1c653e){var _0x199979=_[_0xa51c('0x55')](_0x9e8293[_0xa51c('0x70')]);_0x3734c6({'count':_0x199979[_0xa51c('0x54')],'rows':_0x199979});});},'VoiceQueuesChannel':function(_0x15c4be){var _0x4fe04d=this;return new Promise(function(_0x77a79c,_0x1cc5df){var _0x160597=schema(properties[_0xa51c('0x71')])[_0xa51c('0x2')](_0x15c4be);if(_0x160597['length']>0x0){return _0x1cc5df(_0x4fe04d[_0xa51c('0x12')](0x1f4,_[_0xa51c('0x59')](_0x160597,_0xa51c('0x1a'))['join'](',\x20')));}var _0x15a8b4=_[_0xa51c('0x5f')](_0x9e8293[_0xa51c('0x70')],{'uniqueid':_0x15c4be['uniqueid']});if(_0x15a8b4){_0x77a79c(_0x15a8b4);}else{return _0x1cc5df(_0x4fe04d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x1870db){var _0x4ad946=this;return new Promise(function(_0x4eda65,_0x5aea7e){if(ami[_0xa51c('0x11')]()==![]){return _0x5aea7e(_0x4ad946[_0xa51c('0x12')](0x1f4,[config[_0xa51c('0x13')]['ip'],config[_0xa51c('0x13')]['username'],_0xa51c('0x56')]['join']('\x20')));}var _0x30d17d=schema(properties[_0xa51c('0x72')])[_0xa51c('0x2')](_0x1870db);if(_0x30d17d[_0xa51c('0x54')]>0x0){return _0x5aea7e(_0x4ad946[_0xa51c('0x12')](0x1f4,_[_0xa51c('0x59')](_0x30d17d,_0xa51c('0x1a'))[_0xa51c('0x57')](',\x20')));}var _0x152a34=_[_0xa51c('0x5f')](_0x9e8293['queueChannels'],{'uniqueid':_0x1870db[_0xa51c('0x5a')]});if(_0x152a34&&_0x152a34[_0xa51c('0x5b')]){return ami['Action']({'action':'Hangup','channel':_0x152a34[_0xa51c('0x5b')]})[_0xa51c('0x19')](function(_0x40eb2a){_0x4eda65({'code':0xc8,'message':[_0x1870db[_0xa51c('0x5a')],_0x40eb2a[_0xa51c('0x1a')]['toLowerCase']()][_0xa51c('0x57')]('\x20')});})['catch'](function(_0x9b95b3){_0x5aea7e(_0x4ad946['error'](0x1f5,[_0x1870db[_0xa51c('0x5a')],_0x9b95b3[_0xa51c('0x1a')]['toLowerCase']()][_0xa51c('0x57')]('\x20')));});}else{return _0x5aea7e(_0x4ad946[_0xa51c('0x12')](0x1f5,_0xa51c('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x24aad9){var _0x43de98=this;return new Promise(function(_0x412af1,_0x34ba8b){if(ami['isConnected']()==![]){return _0x34ba8b(_0x43de98[_0xa51c('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xa51c('0x13')][_0xa51c('0x14')],'ami\x20disconnected'][_0xa51c('0x57')]('\x20')));}var _0x27706d=schema(properties[_0xa51c('0x73')])[_0xa51c('0x2')](_0x24aad9);if(_0x27706d['length']>0x0){return _0x34ba8b(_0x43de98[_0xa51c('0x12')](0x1f4,_[_0xa51c('0x59')](_0x27706d,_0xa51c('0x1a'))[_0xa51c('0x57')](',\x20')));}var _0x5649a6=_[_0xa51c('0x5f')](_0x9e8293[_0xa51c('0x70')],{'uniqueid':_0x24aad9['uniqueid']});if(_0x5649a6&&_0x5649a6['channel']){return ami[_0xa51c('0x18')]({'action':_0xa51c('0x74'),'channel':_0x5649a6[_0xa51c('0x5b')],'exten':_0x24aad9[_0xa51c('0x75')],'context':_0x24aad9[_0xa51c('0x76')]||_0x5649a6['context'],'priority':0x1})[_0xa51c('0x19')](function(_0x32b4fe){_0x412af1({'code':0xc8,'message':[_0x24aad9[_0xa51c('0x5a')],_0x32b4fe[_0xa51c('0x1a')]['toLowerCase']()][_0xa51c('0x57')]('\x20')});})[_0xa51c('0x1b')](function(_0x130782){_0x34ba8b(_0x43de98['error'](0x1f5,[_0x24aad9['uniqueid'],_0x130782[_0xa51c('0x1a')][_0xa51c('0x62')]()][_0xa51c('0x57')]('\x20')));});}else{return _0x34ba8b(_0x43de98['error'](0x1f5,_0xa51c('0x69')));}});},'Agents':function(_0x302037){return new Promise(function(_0xbc639e,_0x221591){var _0xdb5b9=_[_0xa51c('0x55')](_0x9e8293['agents']);_0xbc639e({'count':_0xdb5b9[_0xa51c('0x54')],'rows':_0xdb5b9});});},'Telephones':function(_0x4d770a){return new Promise(function(_0x3d71a8,_0x5c531f){var _0x56686e=_[_0xa51c('0x55')](_0x9e8293['telephones']);_0x3d71a8({'count':_0x56686e[_0xa51c('0x54')],'rows':_0x56686e});});},'Trunks':function(_0x1f77e2){return new Promise(function(_0x243eeb,_0x4c9ed0){var _0x51992c=_[_0xa51c('0x55')](_0x9e8293[_0xa51c('0x77')]);_0x243eeb({'count':_0x51992c[_0xa51c('0x54')],'rows':_0x51992c});});},'OutboundChannels':function(_0x265679){return new Promise(function(_0x40d61c,_0x2a96e9){var _0x467658=_[_0xa51c('0x55')](_0x9e8293[_0xa51c('0x78')]);_0x40d61c({'count':_0x467658[_0xa51c('0x54')],'rows':_0x467658});});},'Outbound':function(_0x407cc2){return new Promise(function(_0x417b92,_0x210e9b){_0x417b92(_0x9e8293[_0xa51c('0x79')]);});},'Campaigns':function(_0x9b08a5){return new Promise(function(_0x15a358,_0x4b0be5){var _0x3b314a=_[_0xa51c('0x55')](_0x9e8293[_0xa51c('0x7a')]);_0x15a358({'count':_0x3b314a[_0xa51c('0x54')],'rows':_0x3b314a});});},'VoiceQueuesPreview':function(_0x8bebea){var _0x52675a=this;return new Promise(function(_0x507ac3,_0x5f5acf){_0x525eb3['run'](_0x8bebea['id'])['then'](function(_0x2f0f1a){_0x507ac3({'code':0xc8,'message':_0x2f0f1a[_0xa51c('0x1a')]});})[_0xa51c('0x1b')](function(_0x1eba2b){_0x5f5acf(_0x52675a[_0xa51c('0x12')](0x1f4,_0x1eba2b[_0xa51c('0x1a')]));});});},'EventManager':function(_0x30a6ce){var _0x47c156=this;return new Promise(function(_0x51ea1e,_0x4ef704){if(!_0x30a6ce[_0xa51c('0x7b')]){return _0x4ef704(_0x47c156[_0xa51c('0x12')](0x1f4,_0xa51c('0x7c')));}ami['emit'](_0xa51c('0x7d')+_0x30a6ce[_0xa51c('0x7b')],_0x30a6ce[_0xa51c('0x1a')]);_0x51ea1e({'code':0xc8,'message':_0x30a6ce});});},'FaxAccounts':function(_0xba01c1){return new Promise(function(_0x22503a,_0x4717f8){var _0x50bd8b=_['values'](_0x9e8293[_0xa51c('0x7e')]);_0x22503a({'count':_0x50bd8b[_0xa51c('0x54')],'rows':_0x50bd8b});});},'SendFax':function(_0x110b79){var _0x1eebb5=this;return new Promise(function(_0x24d1c2,_0x280e9b){_0x508187[_0xa51c('0x7f')](_0x110b79)[_0xa51c('0x19')](function(_0x43146e){_0x24d1c2({'code':0xc8,'message':_0x43146e['message']});})[_0xa51c('0x1b')](function(_0x4dd52a){_0x280e9b(_0x1eebb5[_0xa51c('0x12')](0x1f4,_0x4dd52a[_0xa51c('0x1a')]));});});},'CheckAfterSend':function(_0x40ca15){var _0x53c781=this;return new Promise(function(_0x4215a8,_0x5c38f2){_0x508187[_0xa51c('0x80')](_0x40ca15)[_0xa51c('0x19')](function(_0x16d88f){_0x4215a8({'code':0xc8,'message':_0x16d88f['message']});})[_0xa51c('0x1b')](function(_0x248312){_0x5c38f2(_0x53c781[_0xa51c('0x12')](0x1f4,_0x248312[_0xa51c('0x1a')]));});});}};var _0x198665=jayson[_0xa51c('0x81')](_0x5ad7fb)[_0xa51c('0x82')]();_0x198665['on']('error',function(_0x48b8a1){return _0x5c9b9e(_0x48b8a1);});_0x198665[_0xa51c('0x83')](0x232a,_0xa51c('0x84'),function(){console[_0xa51c('0x85')](_0xa51c('0x86'),0x232a);return _0x295f46(_0xa51c('0x87')+0x232a);});});}; \ No newline at end of file +var _0x5c65=['trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../ami','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','Action','message','command','Command','then','catch','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','values','voicechannel','find','channel','filename','uniqueid','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','format','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','map','channels','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','context','telephones'];(function(_0x2136b5,_0x4f49c4){var _0x1feb26=function(_0x32e3a2){while(--_0x32e3a2){_0x2136b5['push'](_0x2136b5['shift']());}};_0x1feb26(++_0x4f49c4);}(_0x5c65,0x9c));var _0x55c6=function(_0x4d3d1e,_0x3f0544){_0x4d3d1e=_0x4d3d1e-0x0;var _0x16ba5c=_0x5c65[_0x4d3d1e];return _0x16ba5c;};'use strict';var _=require(_0x55c6('0x0'));var util=require(_0x55c6('0x1'));var jayson=require(_0x55c6('0x2'));var schema=require('validate');var BPromise=require(_0x55c6('0x3'));var moment=require(_0x55c6('0x4'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x55c6('0x5'));exports['listen']=function(_0xe9ffaa,_0x47e6ba,_0x359041){return new BPromise(function(_0x37f9e6,_0x376de7){var _0x341745={'QueuePause':function(_0x44c23b){return new Promise(function(_0x2cf455,_0x305102){var _0x46c044=util['format'](_0x55c6('0x6'),'SIP',_0x44c23b[_0x55c6('0x7')]);if(_0xe9ffaa[_0x55c6('0x8')]&&_0xe9ffaa[_0x55c6('0x8')][_0x46c044]&&_0xe9ffaa[_0x55c6('0x8')][_0x46c044][_0x55c6('0x9')]){_0xe9ffaa[_0x55c6('0x8')][_0x46c044][_0x55c6('0xa')]();}if(_0xe9ffaa[_0x55c6('0xb')][_0x46c044]){_0xe9ffaa[_0x55c6('0xb')][_0x46c044][_0x55c6('0xc')]({'statePause':_0x44c23b[_0x55c6('0xd')]?!![]:![]});}_0x2cf455({'code':0xc8,'message':_0x55c6('0xe')});});},'Reload':function(_0x3ad443){var _0x1f7ab9=this;return new Promise(function(_0x1b92fe,_0x1c411c){if(ami[_0x55c6('0xf')]()==![]){return _0x1c411c(_0x1f7ab9[_0x55c6('0x10')](0x1f4,[config[_0x55c6('0x11')]['ip'],config['asterisk'][_0x55c6('0x12')],_0x55c6('0x13')][_0x55c6('0x14')]('\x20')));}_0x3ad443=_[_0x55c6('0x15')](_0x3ad443,_[_0x55c6('0x16')](properties['module']));_0x3ad443[_0x55c6('0x17')]=_0x55c6('0x18');return ami[_0x55c6('0x19')](_0x3ad443)['then'](function(_0x182d11){_0x1b92fe({'code':0xc8,'message':_0x182d11[_0x55c6('0x1a')]});})['catch'](function(_0x240c09){_0x1c411c(_0x1f7ab9['error'](0x1f5,_0x240c09[_0x55c6('0x1a')]));});});},'Command':function(_0x15bb34){var _0x58faae=this;return new Promise(function(_0x40ce27,_0x569825){if(ami[_0x55c6('0xf')]()==![]){return _0x569825(_0x58faae['error'](0x1f4,[config[_0x55c6('0x11')]['ip'],config[_0x55c6('0x11')][_0x55c6('0x12')],'ami\x20disconnected'][_0x55c6('0x14')]('\x20')));}_0x15bb34=_[_0x55c6('0x15')](_0x15bb34,_0x55c6('0x1b'));_0x15bb34[_0x55c6('0x17')]=_0x55c6('0x1c');return ami[_0x55c6('0x19')](_0x15bb34)[_0x55c6('0x1d')](function(_0x5f41d0){_0x40ce27({'code':0xc8,'message':_0x5f41d0['content']});})[_0x55c6('0x1e')](function(_0x2c5dd8){_0x569825(_0x58faae[_0x55c6('0x10')](0x1f5,_0x2c5dd8['message']));});});},'VoiceQueues':function(_0x559ba2){return new Promise(function(_0x414d9a,_0x909b76){var _0x45b703=[];for(var _0x4ed587 in _0xe9ffaa['voiceQueues']){if(_0xe9ffaa['voiceQueues']['hasOwnProperty'](_0x4ed587)){var _0x341d20=_0xe9ffaa['voiceQueues'][_0x4ed587];var _0x13acac={'id':_0x341d20['id'],'name':_0x341d20[_0x55c6('0x7')],'strategy':_0x341d20[_0x55c6('0x1f')],'answered':_0x341d20[_0x55c6('0x20')],'available':_0x341d20[_0x55c6('0x21')],'loggedIn':_0x341d20[_0x55c6('0x22')],'pTalking':_0x341d20[_0x55c6('0x23')],'sumBillable':_0x341d20['sumBillable'],'sumDuration':_0x341d20[_0x55c6('0x24')],'sumHoldTime':_0x341d20[_0x55c6('0x25')]||0x0,'talking':_0x341d20[_0x55c6('0x26')],'total':_0x341d20['total'],'type':_0x341d20[_0x55c6('0x27')],'unmanaged':_0x341d20[_0x55c6('0x28')],'abandoned':_0x341d20[_0x55c6('0x29')],'waiting':_0x341d20['waiting'],'loggedInDb':_0x341d20[_0x55c6('0x2a')]};if(_0x341d20[_0x55c6('0x27')]==='outbound'){_0x13acac[_0x55c6('0x2b')]=_0x341d20[_0x55c6('0x2b')];_0x13acac[_0x55c6('0x2c')]=_0x341d20[_0x55c6('0x2c')];_0x13acac[_0x55c6('0x2d')]=_0x341d20[_0x55c6('0x2d')];_0x13acac[_0x55c6('0x2e')]=_0x341d20[_0x55c6('0x2e')];_0x13acac[_0x55c6('0x2f')]=_0x341d20[_0x55c6('0x2f')];_0x13acac['dialPrefix']=_0x341d20[_0x55c6('0x30')];_0x13acac[_0x55c6('0x31')]=_0x341d20[_0x55c6('0x31')];_0x13acac[_0x55c6('0x32')]=_0x341d20[_0x55c6('0x32')];_0x13acac[_0x55c6('0x33')]=_0x341d20['outboundBlacklistCallsDay'];_0x13acac[_0x55c6('0x34')]=_0x341d20[_0x55c6('0x34')];_0x13acac[_0x55c6('0x35')]=_0x341d20[_0x55c6('0x35')];_0x13acac[_0x55c6('0x36')]=_0x341d20[_0x55c6('0x36')];_0x13acac[_0x55c6('0x37')]=_0x341d20[_0x55c6('0x37')];_0x13acac[_0x55c6('0x38')]=_0x341d20['outboundDropCallsDayTimeout'];_0x13acac[_0x55c6('0x39')]=_0x341d20['outboundNoAnswerCallsDay'];_0x13acac[_0x55c6('0x3a')]=_0x341d20[_0x55c6('0x3a')];_0x13acac[_0x55c6('0x3b')]=_0x341d20[_0x55c6('0x3b')];_0x13acac['outboundReCallsDay']=_0x341d20['outboundReCallsDay'];_0x13acac['outboundRejectCallsDay']=_0x341d20['outboundRejectCallsDay'];_0x13acac[_0x55c6('0x3c')]=_0x341d20[_0x55c6('0x3c')];_0x13acac[_0x55c6('0x3d')]=_0x341d20[_0x55c6('0x3d')];_0x13acac[_0x55c6('0x3e')]=_0x341d20[_0x55c6('0x3e')];_0x13acac[_0x55c6('0x3f')]=_0x341d20[_0x55c6('0x3f')];_0x13acac['predictiveIntervalDroppedCallsCallersExit']=_0x341d20[_0x55c6('0x40')];_0x13acac[_0x55c6('0x41')]=_0x341d20[_0x55c6('0x41')];_0x13acac[_0x55c6('0x42')]=_0x341d20[_0x55c6('0x42')];_0x13acac[_0x55c6('0x43')]=_0x341d20[_0x55c6('0x43')];_0x13acac[_0x55c6('0x44')]=_0x341d20[_0x55c6('0x44')];_0x13acac[_0x55c6('0x45')]=_0x341d20[_0x55c6('0x45')];_0x13acac[_0x55c6('0x46')]=_0x341d20[_0x55c6('0x46')];_0x13acac[_0x55c6('0x47')]=_0x341d20['predictiveIntervalAvailable'];_0x13acac[_0x55c6('0x48')]=_0x341d20[_0x55c6('0x48')];_0x13acac['message']=_0x341d20[_0x55c6('0x1a')];_0x13acac[_0x55c6('0x49')]=_0x341d20['originated'];_0x13acac[_0x55c6('0x4a')]=_0x341d20[_0x55c6('0x4a')];_0x13acac[_0x55c6('0x4b')]=_0x341d20[_0x55c6('0x4b')];_0x13acac[_0x55c6('0x4c')]=_0x341d20['erlangAbandonmentRate'];_0x13acac[_0x55c6('0x4d')]=_0x341d20[_0x55c6('0x4d')];_0x13acac['startPredictive']=_0x341d20[_0x55c6('0x4e')];_0x13acac['startProgressive']=_0x341d20[_0x55c6('0x4f')];}if(_0x341d20[_0x55c6('0x50')]){_0x13acac[_0x55c6('0x50')]={'id':_0x341d20[_0x55c6('0x50')]['id'],'name':_0x341d20['Trunk'][_0x55c6('0x7')],'active':_0x341d20[_0x55c6('0x50')][_0x55c6('0x51')],'callerid':_0x341d20['Trunk']['callerid']};}if(_0x341d20[_0x55c6('0x52')]){_0x13acac[_0x55c6('0x52')]={'id':_0x341d20[_0x55c6('0x52')]['id'],'name':_0x341d20[_0x55c6('0x52')][_0x55c6('0x7')]};}_0x45b703[_0x55c6('0x53')](_0x13acac);}}_0x414d9a({'count':_0x45b703[_0x55c6('0x54')],'rows':_0x45b703});});},'VoiceChannels':function(_0x3165ef){return new Promise(function(_0x43549b,_0x25ee82){var _0x1e3954=_[_0x55c6('0x55')](_0xe9ffaa['channels']);_0x43549b({'count':_0x1e3954[_0x55c6('0x54')],'rows':_0x1e3954});});},'VoiceChannelMixMonitor':function(_0x4620c9){var _0x4fe0f8=this;return new Promise(function(_0x1f0e96,_0x2d7ad4){if(ami[_0x55c6('0xf')]()==![]){return _0x2d7ad4(_0x4fe0f8['error'](0x1f4,[config[_0x55c6('0x11')]['ip'],config[_0x55c6('0x11')]['username'],'ami\x20disconnected'][_0x55c6('0x14')]('\x20')));}var _0x30ef4b=schema(properties[_0x55c6('0x56')])['validate'](_0x4620c9);if(_0x30ef4b[_0x55c6('0x54')]>0x0){return _0x2d7ad4(_0x4fe0f8['error'](0x1f4,_['map'](_0x30ef4b,_0x55c6('0x1a'))['join'](',\x20')));}var _0x2da784=_[_0x55c6('0x57')](_0xe9ffaa['channels'],{'uniqueid':_0x4620c9['uniqueid']});if(_0x2da784&&_0x2da784[_0x55c6('0x58')]){var _0x41bdd6=util['format']('%s.%s',_0x4620c9[_0x55c6('0x59')]||_0x4620c9[_0x55c6('0x5a')],_0x4620c9['format']||'wav');return ami['Action']({'action':_0x55c6('0x5b'),'channel':_0x2da784[_0x55c6('0x58')],'file':_0x41bdd6,'options':_0x55c6('0x5c')})['then'](function(_0x3ecba3){var _0x4f4aed=_[_0x55c6('0x57')](_0x2da784['monitors'],{'filename':_0x55c6('0x5d')+_0x41bdd6[_0x55c6('0x5e')]()});if(_[_0x55c6('0x5f')](_0x4f4aed)){_0x2da784[_0x55c6('0x60')][_0x55c6('0x53')]({'filename':_0x55c6('0x5d')+_0x41bdd6['toLowerCase'](),'createdAt':moment()[_0x55c6('0x61')](_0x55c6('0x62')),'mixmonitorid':_0x3ecba3[_0x55c6('0x63')],'status':_0x55c6('0x64')});}else{_0x4f4aed[_0x55c6('0x63')]=_0x3ecba3[_0x55c6('0x63')];_0x4f4aed[_0x55c6('0x65')]='rec';}_0x1f0e96({'code':0xc8,'message':[_0x4620c9[_0x55c6('0x5a')],_0x55c6('0x66'),_0x3ecba3[_0x55c6('0x63')]][_0x55c6('0x14')]('\x20'),'mixmonitorid':_0x3ecba3[_0x55c6('0x63')]});})[_0x55c6('0x1e')](function(_0x29f373){_0x2d7ad4(_0x4fe0f8[_0x55c6('0x10')](0x1f5,[_0x4620c9[_0x55c6('0x5a')],_0x29f373[_0x55c6('0x1a')][_0x55c6('0x5e')]()][_0x55c6('0x14')]('\x20')));});}else{return _0x2d7ad4(_0x4fe0f8[_0x55c6('0x10')](0x1f5,_0x55c6('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x4df62f){var _0x22402a=this;return new Promise(function(_0x2123e6,_0x1ffaf6){if(ami[_0x55c6('0xf')]()==![]){return _0x1ffaf6(_0x22402a[_0x55c6('0x10')](0x1f4,[config[_0x55c6('0x11')]['ip'],config[_0x55c6('0x11')][_0x55c6('0x12')],'ami\x20disconnected'][_0x55c6('0x14')]('\x20')));}var _0x53210a=schema(properties['voicechannel'])[_0x55c6('0x68')](_0x4df62f);if(_0x53210a[_0x55c6('0x54')]>0x0){return _0x1ffaf6(_0x22402a[_0x55c6('0x10')](0x1f4,_[_0x55c6('0x69')](_0x53210a,_0x55c6('0x1a'))['join'](',\x20')));}var _0x648642=_[_0x55c6('0x57')](_0xe9ffaa[_0x55c6('0x6a')],{'uniqueid':_0x4df62f[_0x55c6('0x5a')]});if(_0x648642){return BPromise[_0x55c6('0x6b')]()[_0x55c6('0x1d')](function(){if(_0x648642[_0x55c6('0x58')]){return ami['Action']({'action':_0x55c6('0x6c'),'channel':_0x648642[_0x55c6('0x58')],'mixmonitorid':_0x4df62f['mixmonitorid']})[_0x55c6('0x1e')](function(_0x21d981){});}})['then'](function(){if(_0x648642[_0x55c6('0x6d')]){return ami['Action']({'action':_0x55c6('0x6c'),'channel':_0x648642[_0x55c6('0x6d')],'mixmonitorid':_0x4df62f[_0x55c6('0x63')]})[_0x55c6('0x1e')](function(_0x4d1b1a){});}})['then'](function(_0x29aea2){var _0x1572e9=_[_0x55c6('0x57')](_0x648642[_0x55c6('0x60')],{'mixmonitorid':_0x4df62f['mixmonitorid']});if(_0x1572e9){_0x1572e9[_0x55c6('0x65')]=_0x55c6('0x6e');}})[_0x55c6('0x1d')](function(){var _0x4308a6=util[_0x55c6('0x61')]('%s.%s',_0x4df62f[_0x55c6('0x59')]||_0x4df62f['uniqueid'],_0x4df62f[_0x55c6('0x61')]||_0x55c6('0x6f'));var _0x538bc7=_[_0x55c6('0x57')](_0x648642[_0x55c6('0x60')],{'filename':_0x55c6('0x5d')+_0x4308a6[_0x55c6('0x5e')]()});if(_0x538bc7){_0x538bc7[_0x55c6('0x65')]=_0x55c6('0x6e');}})[_0x55c6('0x1d')](function(){_0x2123e6({'code':0xc8,'message':[_0x4df62f[_0x55c6('0x5a')],_0x55c6('0x70')][_0x55c6('0x14')]('\x20')});})[_0x55c6('0x1e')](function(_0xcb0bf2){_0x1ffaf6(_0x22402a['error'](0x1f5,[_0x4df62f[_0x55c6('0x5a')],_0xcb0bf2[_0x55c6('0x1a')][_0x55c6('0x5e')]()]['join']('\x20')));});}else{return _0x1ffaf6(_0x22402a['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x25dc8e){return new Promise(function(_0x4e4bc5,_0x568c81){var _0x3953bc=_[_0x55c6('0x55')](_0xe9ffaa[_0x55c6('0x71')]);_0x4e4bc5({'count':_0x3953bc[_0x55c6('0x54')],'rows':_0x3953bc});});},'VoiceQueuesChannel':function(_0x5c92eb){var _0x5992b2=this;return new Promise(function(_0x39f0f3,_0x38a458){var _0x1a6460=schema(properties[_0x55c6('0x72')])['validate'](_0x5c92eb);if(_0x1a6460[_0x55c6('0x54')]>0x0){return _0x38a458(_0x5992b2[_0x55c6('0x10')](0x1f4,_['map'](_0x1a6460,'message')['join'](',\x20')));}var _0x3d932c=_[_0x55c6('0x57')](_0xe9ffaa[_0x55c6('0x71')],{'uniqueid':_0x5c92eb['uniqueid']});if(_0x3d932c){_0x39f0f3(_0x3d932c);}else{return _0x38a458(_0x5992b2[_0x55c6('0x10')](0x1f5,_0x55c6('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x37f198){var _0x597a0b=this;return new Promise(function(_0x3df417,_0x148e33){if(ami[_0x55c6('0xf')]()==![]){return _0x148e33(_0x597a0b[_0x55c6('0x10')](0x1f4,[config[_0x55c6('0x11')]['ip'],config[_0x55c6('0x11')]['username'],'ami\x20disconnected'][_0x55c6('0x14')]('\x20')));}var _0x769646=schema(properties['voicequeuechannelhangup'])[_0x55c6('0x68')](_0x37f198);if(_0x769646['length']>0x0){return _0x148e33(_0x597a0b[_0x55c6('0x10')](0x1f4,_[_0x55c6('0x69')](_0x769646,_0x55c6('0x1a'))[_0x55c6('0x14')](',\x20')));}var _0x5cb33e=_[_0x55c6('0x57')](_0xe9ffaa['queueChannels'],{'uniqueid':_0x37f198[_0x55c6('0x5a')]});if(_0x5cb33e&&_0x5cb33e[_0x55c6('0x58')]){return ami[_0x55c6('0x19')]({'action':_0x55c6('0x73'),'channel':_0x5cb33e[_0x55c6('0x58')]})[_0x55c6('0x1d')](function(_0x27b9c7){_0x3df417({'code':0xc8,'message':[_0x37f198[_0x55c6('0x5a')],_0x27b9c7[_0x55c6('0x1a')][_0x55c6('0x5e')]()]['join']('\x20')});})[_0x55c6('0x1e')](function(_0x1a6ee8){_0x148e33(_0x597a0b['error'](0x1f5,[_0x37f198[_0x55c6('0x5a')],_0x1a6ee8[_0x55c6('0x1a')][_0x55c6('0x5e')]()][_0x55c6('0x14')]('\x20')));});}else{return _0x148e33(_0x597a0b[_0x55c6('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x14d673){var _0x3d4bf9=this;return new Promise(function(_0x43d8d7,_0x2e1507){if(ami['isConnected']()==![]){return _0x2e1507(_0x3d4bf9[_0x55c6('0x10')](0x1f4,[config[_0x55c6('0x11')]['ip'],config[_0x55c6('0x11')][_0x55c6('0x12')],_0x55c6('0x13')][_0x55c6('0x14')]('\x20')));}var _0x20c4ae=schema(properties[_0x55c6('0x74')])[_0x55c6('0x68')](_0x14d673);if(_0x20c4ae[_0x55c6('0x54')]>0x0){return _0x2e1507(_0x3d4bf9[_0x55c6('0x10')](0x1f4,_[_0x55c6('0x69')](_0x20c4ae,_0x55c6('0x1a'))[_0x55c6('0x14')](',\x20')));}var _0x3a2a8c=_[_0x55c6('0x57')](_0xe9ffaa[_0x55c6('0x71')],{'uniqueid':_0x14d673[_0x55c6('0x5a')]});if(_0x3a2a8c&&_0x3a2a8c[_0x55c6('0x58')]){return ami[_0x55c6('0x19')]({'action':_0x55c6('0x75'),'channel':_0x3a2a8c[_0x55c6('0x58')],'exten':_0x14d673['exten'],'context':_0x14d673[_0x55c6('0x76')]||_0x3a2a8c[_0x55c6('0x76')],'priority':0x1})[_0x55c6('0x1d')](function(_0x1e5355){_0x43d8d7({'code':0xc8,'message':[_0x14d673[_0x55c6('0x5a')],_0x1e5355[_0x55c6('0x1a')][_0x55c6('0x5e')]()]['join']('\x20')});})[_0x55c6('0x1e')](function(_0x2353c0){_0x2e1507(_0x3d4bf9['error'](0x1f5,[_0x14d673[_0x55c6('0x5a')],_0x2353c0['message'][_0x55c6('0x5e')]()][_0x55c6('0x14')]('\x20')));});}else{return _0x2e1507(_0x3d4bf9[_0x55c6('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x1e0c89){return new Promise(function(_0x14d72c,_0x317f74){var _0x25b90a=_[_0x55c6('0x55')](_0xe9ffaa[_0x55c6('0xb')]);_0x14d72c({'count':_0x25b90a['length'],'rows':_0x25b90a});});},'Telephones':function(_0x14a7d7){return new Promise(function(_0x19bde4,_0x3eb41a){var _0x547b2c=_[_0x55c6('0x55')](_0xe9ffaa[_0x55c6('0x77')]);_0x19bde4({'count':_0x547b2c[_0x55c6('0x54')],'rows':_0x547b2c});});},'Trunks':function(_0x50f378){return new Promise(function(_0x230e6b,_0x56e34f){var _0x4085d4=_[_0x55c6('0x55')](_0xe9ffaa[_0x55c6('0x78')]);_0x230e6b({'count':_0x4085d4[_0x55c6('0x54')],'rows':_0x4085d4});});},'OutboundChannels':function(_0x44e14d){return new Promise(function(_0x2a33bc,_0x456640){var _0x599e8e=_['values'](_0xe9ffaa[_0x55c6('0x79')]);_0x2a33bc({'count':_0x599e8e[_0x55c6('0x54')],'rows':_0x599e8e});});},'Outbound':function(_0x2a55e1){return new Promise(function(_0x497e45,_0x454256){_0x497e45(_0xe9ffaa[_0x55c6('0x7a')]);});},'Campaigns':function(_0x314a15){return new Promise(function(_0x288cd7,_0x4676f5){var _0x5f56d7=_[_0x55c6('0x55')](_0xe9ffaa[_0x55c6('0x7b')]);_0x288cd7({'count':_0x5f56d7[_0x55c6('0x54')],'rows':_0x5f56d7});});},'VoiceQueuesPreview':function(_0x43b313){var _0x1886a7=this;return new Promise(function(_0x799635,_0x4b0b3c){_0x47e6ba[_0x55c6('0x7c')](_0x43b313['id'])[_0x55c6('0x1d')](function(_0x46d284){_0x799635({'code':0xc8,'message':_0x46d284[_0x55c6('0x1a')]});})[_0x55c6('0x1e')](function(_0x13c63c){_0x4b0b3c(_0x1886a7[_0x55c6('0x10')](0x1f4,_0x13c63c[_0x55c6('0x1a')]));});});},'EventManager':function(_0x1d1560){var _0x1d2d43=this;return new Promise(function(_0x5a8140,_0x70cb1f){if(!_0x1d1560[_0x55c6('0x7d')]){return _0x70cb1f(_0x1d2d43[_0x55c6('0x10')](0x1f4,_0x55c6('0x7e')));}ami[_0x55c6('0x7f')](_0x55c6('0x80')+_0x1d1560[_0x55c6('0x7d')],_0x1d1560[_0x55c6('0x1a')]);_0x5a8140({'code':0xc8,'message':_0x1d1560});});},'FaxAccounts':function(_0x3bfd64){return new Promise(function(_0x51c839,_0x155d7b){var _0x2d989b=_[_0x55c6('0x55')](_0xe9ffaa[_0x55c6('0x81')]);_0x51c839({'count':_0x2d989b[_0x55c6('0x54')],'rows':_0x2d989b});});},'SendFax':function(_0x16db65){var _0x41adb5=this;return new Promise(function(_0x2b3919,_0x15a73a){_0x359041[_0x55c6('0x82')](_0x16db65)[_0x55c6('0x1d')](function(_0x3c936e){_0x2b3919({'code':0xc8,'message':_0x3c936e[_0x55c6('0x1a')]});})[_0x55c6('0x1e')](function(_0x52f18b){_0x15a73a(_0x41adb5[_0x55c6('0x10')](0x1f4,_0x52f18b['message']));});});},'CheckAfterSend':function(_0x192f81){var _0x293e92=this;return new Promise(function(_0x4e122f,_0x5bbd89){_0x359041[_0x55c6('0x83')](_0x192f81)[_0x55c6('0x1d')](function(_0x4295d1){_0x4e122f({'code':0xc8,'message':_0x4295d1[_0x55c6('0x1a')]});})[_0x55c6('0x1e')](function(_0x466aca){_0x5bbd89(_0x293e92[_0x55c6('0x10')](0x1f4,_0x466aca[_0x55c6('0x1a')]));});});}};var _0x4f1c10=jayson[_0x55c6('0x84')](_0x341745)['http']();_0x4f1c10['on']('error',function(_0x384eb8){return _0x376de7(_0x384eb8);});_0x4f1c10[_0x55c6('0x85')](0x232a,_0x55c6('0x86'),function(){console[_0x55c6('0x87')](_0x55c6('0x88'),0x232a);return _0x37f9e6(_0x55c6('0x89')+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 64dbb0f..f063569 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 _0x4e2e=['resolve','createContact','catch','Error\x20creating\x20contact','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','info','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','then','omit','xmd-contactid2','format','user:%s','name','trigger:%s','toLowerCase','merge'];(function(_0x544b97,_0x6bb32a){var _0x53d806=function(_0x3559ef){while(--_0x3559ef){_0x544b97['push'](_0x544b97['shift']());}};_0x53d806(++_0x6bb32a);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x28c23b,_0x8a12e4){_0x28c23b=_0x28c23b-0x0;var _0x1c11fa=_0x4e2e[_0x28c23b];return _0x1c11fa;};'use strict';var BPromise=require('bluebird');var util=require(_0xe4e2('0x0'));var _=require(_0xe4e2('0x1'));var Redis=require(_0xe4e2('0x2'));var config=require(_0xe4e2('0x3'));var logger=require(_0xe4e2('0x4'))(_0xe4e2('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0xe4e2('0x6')]=_[_0xe4e2('0x7')](config[_0xe4e2('0x6')],{'host':_0xe4e2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4e2('0x6')]));function emit(_0x36b1c6,_0x1c4e64,_0x125338){logger[_0xe4e2('0x9')](_0x36b1c6,_0x1c4e64,JSON[_0xe4e2('0xa')](_0x125338));io['to'](_0x36b1c6)[_0xe4e2('0xb')](_0x1c4e64,_0x125338);}exports[_0xe4e2('0xc')]=function(_0x4912da,_0xd81011,_0x14fe0d){_0x14fe0d[_0xe4e2('0xd')]=0x0;if(_0xd81011['data2']&&parseInt(_0xd81011[_0xe4e2('0xe')],0xa)){var _0x42a1f0={'ListId':parseInt(_0xd81011[_0xe4e2('0xf')],0xa),'phone':_0x14fe0d[_0xe4e2('0x10')]};if(_[_0xe4e2('0x11')](_0x14fe0d['routeId'])){_0x42a1f0[_0xe4e2('0x12')]=_0x14fe0d[_0xe4e2('0x13')]&&_0x14fe0d[_0xe4e2('0x13')]!==_0xe4e2('0x14')?_0x14fe0d['calleridname']:_0x14fe0d[_0xe4e2('0x10')]||_0x14fe0d[_0xe4e2('0x15')];}else{_0x42a1f0[_0xe4e2('0x12')]=_0x14fe0d[_0xe4e2('0x16')]&&_0x14fe0d[_0xe4e2('0x16')]!==''?_0x14fe0d['destcalleridname']:_0x14fe0d[_0xe4e2('0x17')]||_0x14fe0d[_0xe4e2('0x15')];_0x42a1f0[_0xe4e2('0x18')]=_0x14fe0d[_0xe4e2('0x16')]&&_0x14fe0d[_0xe4e2('0x16')]!==''?_0x14fe0d[_0xe4e2('0x16')]:_0x14fe0d[_0xe4e2('0x17')]||_0x14fe0d[_0xe4e2('0x15')];}BPromise['resolve']()[_0xe4e2('0x19')](cmContactRpc['showContact']({'where':_[_0xe4e2('0x1a')](_0x42a1f0,[_0xe4e2('0x12')])}))[_0xe4e2('0x19')](function(_0x452c85){if(_0x452c85){_0x14fe0d[_0xe4e2('0x1b')]=_0x452c85['id'];emit(util[_0xe4e2('0x1c')](_0xe4e2('0x1d'),_0x4912da[_0xe4e2('0x1e')]),util[_0xe4e2('0x1c')](_0xe4e2('0x1f'),_0xd81011['action'][_0xe4e2('0x20')]()),_[_0xe4e2('0x21')](_0x14fe0d,{'ListId':parseInt(_0xd81011[_0xe4e2('0xf')],0xa)}));return;}else{return BPromise[_0xe4e2('0x22')]()[_0xe4e2('0x19')](cmContactRpc[_0xe4e2('0x23')](_0x42a1f0));}})[_0xe4e2('0x19')](function(_0x51c67e){if(_0x51c67e){_0x14fe0d[_0xe4e2('0x1b')]=_0x51c67e['id'];emit(util[_0xe4e2('0x1c')](_0xe4e2('0x1d'),_0x4912da['name']),util[_0xe4e2('0x1c')](_0xe4e2('0x1f'),_0xd81011['action'][_0xe4e2('0x20')]()),_[_0xe4e2('0x21')](_0x14fe0d,{'ListId':parseInt(_0xd81011[_0xe4e2('0xf')],0xa)}));}})[_0xe4e2('0x24')](function(_0x249b7e){logger['error'](_0xe4e2('0x25'),JSON[_0xe4e2('0xa')](_0x249b7e));});}else{if(_0x4912da){emit(util[_0xe4e2('0x1c')]('user:%s',_0x4912da[_0xe4e2('0x1e')]),util[_0xe4e2('0x1c')](_0xe4e2('0x1f'),_0xd81011['action'][_0xe4e2('0x20')]()),_['merge']({'ListId':parseInt(_0xd81011[_0xe4e2('0xf')],0xa)},_0x14fe0d));}}}; \ No newline at end of file +var _0x44c2=['ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','stringify','emit','autoCreate','data2','data1','routeId','firstName','calleridname','','calleridnum','uniqueid','destcalleridname','phone','destcalleridnum','resolve','then','showContact','name','format','trigger:%s','action','toLowerCase','merge','createContact','user:%s','catch','error','Error\x20creating\x20contact','bluebird','util','lodash'];(function(_0xf7dd0f,_0x396c3b){var _0x3fc64b=function(_0x41adc1){while(--_0x41adc1){_0xf7dd0f['push'](_0xf7dd0f['shift']());}};_0x3fc64b(++_0x396c3b);}(_0x44c2,0x100));var _0x244c=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x44c2[_0x3fa296];return _0x10b19f;};'use strict';var BPromise=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var _=require(_0x244c('0x2'));var Redis=require(_0x244c('0x3'));var config=require('../../../../config/environment');var logger=require(_0x244c('0x4'))(_0x244c('0x5'));var cmContactRpc=require(_0x244c('0x6'));config[_0x244c('0x7')]=_[_0x244c('0x8')](config[_0x244c('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x244c('0x7')]));function emit(_0x4c758e,_0x18491b,_0x5b49a1){logger['info'](_0x4c758e,_0x18491b,JSON[_0x244c('0x9')](_0x5b49a1));io['to'](_0x4c758e)[_0x244c('0xa')](_0x18491b,_0x5b49a1);}exports['exec']=function(_0xf5430e,_0x5b873e,_0x519feb){_0x519feb[_0x244c('0xb')]=0x0;if(_0x5b873e['data2']&&parseInt(_0x5b873e[_0x244c('0xc')],0xa)){var _0x590b69={'ListId':parseInt(_0x5b873e[_0x244c('0xd')],0xa),'phone':_0x519feb['calleridnum']};if(_['isNil'](_0x519feb[_0x244c('0xe')])){_0x590b69[_0x244c('0xf')]=_0x519feb[_0x244c('0x10')]&&_0x519feb['calleridname']!==_0x244c('0x11')?_0x519feb[_0x244c('0x10')]:_0x519feb[_0x244c('0x12')]||_0x519feb[_0x244c('0x13')];}else{_0x590b69[_0x244c('0xf')]=_0x519feb[_0x244c('0x14')]&&_0x519feb[_0x244c('0x14')]!==''?_0x519feb[_0x244c('0x14')]:_0x519feb['destcalleridnum']||_0x519feb['uniqueid'];_0x590b69[_0x244c('0x15')]=_0x519feb[_0x244c('0x14')]&&_0x519feb[_0x244c('0x14')]!==_0x244c('0x11')?_0x519feb['destcalleridname']:_0x519feb[_0x244c('0x16')]||_0x519feb[_0x244c('0x13')];}BPromise[_0x244c('0x17')]()[_0x244c('0x18')](cmContactRpc[_0x244c('0x19')]({'where':_['omit'](_0x590b69,[_0x244c('0xf')])}))[_0x244c('0x18')](function(_0xd49d6a){if(_0xd49d6a){_0x519feb['xmd-contactid2']=_0xd49d6a['id'];emit(util['format']('user:%s',_0xf5430e[_0x244c('0x1a')]),util[_0x244c('0x1b')](_0x244c('0x1c'),_0x5b873e[_0x244c('0x1d')][_0x244c('0x1e')]()),_[_0x244c('0x1f')](_0x519feb,{'ListId':parseInt(_0x5b873e['data1'],0xa)}));return;}else{return BPromise[_0x244c('0x17')]()[_0x244c('0x18')](cmContactRpc[_0x244c('0x20')](_0x590b69));}})['then'](function(_0x375294){if(_0x375294){_0x519feb['xmd-contactid2']=_0x375294['id'];emit(util['format'](_0x244c('0x21'),_0xf5430e[_0x244c('0x1a')]),util['format'](_0x244c('0x1c'),_0x5b873e[_0x244c('0x1d')][_0x244c('0x1e')]()),_[_0x244c('0x1f')](_0x519feb,{'ListId':parseInt(_0x5b873e['data1'],0xa)}));}})[_0x244c('0x22')](function(_0x264ba2){logger[_0x244c('0x23')](_0x244c('0x24'),JSON[_0x244c('0x9')](_0x264ba2));});}else{if(_0xf5430e){emit(util['format']('user:%s',_0xf5430e[_0x244c('0x1a')]),util[_0x244c('0x1b')](_0x244c('0x1c'),_0x5b873e[_0x244c('0x1d')][_0x244c('0x1e')]()),_[_0x244c('0x1f')]({'ListId':parseInt(_0x5b873e[_0x244c('0xd')],0xa)},_0x519feb));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a384b4d..b0d616d 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 _0xaaa5=['./urlforward','./integration','./cmContact','./script','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','zohoAccounts','deskAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','stringify','prototype','clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','browser','data2','html','render','template\x20not\x20found','url','buildUri','isNil','data3','data4','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','user:%s','name','trigger:%s:%s','data1','jscripty','format','trigger:%s','exec','integration','queue','routeId','query','search','replace','AllConditions','checkConditions','channel','AnyConditions','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','util','lodash','ioredis'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xaaa5,0x147));var _0x5aaa=function(_0x111c07,_0x401cbd){_0x111c07=_0x111c07-0x0;var _0x1d0836=_0xaaa5[_0x111c07];return _0x1d0836;};'use strict';var util=require(_0x5aaa('0x0'));var _=require(_0x5aaa('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0x5aaa('0x2'));var urlforward=require(_0x5aaa('0x3'));var integration=require(_0x5aaa('0x4'));var cmContact=require(_0x5aaa('0x5'));var script=require(_0x5aaa('0x6'));var cmContactRpc=require('../rpc/cmContact');var config=require('../../../config/environment');var logger=require('../../../config/logger')('trigger');var ami=require(_0x5aaa('0x7'));config[_0x5aaa('0x8')]=_[_0x5aaa('0x9')](config[_0x5aaa('0x8')],{'host':_0x5aaa('0xa'),'port':0x18eb});var io=require(_0x5aaa('0xb'))(new Redis(config[_0x5aaa('0x8')]));var operators={'equals':function(_0x71e2b1,_0x5dab6f){return _0x71e2b1==_0x5dab6f;},'not_equals':function(_0x32f473,_0x2b0fae){return _0x32f473!=_0x2b0fae;}};var barAndWebActions=[_0x5aaa('0xc'),'url',_0x5aaa('0xd')];function Trigger(_0x358287){this[_0x5aaa('0xe')]=_0x358287[_0x5aaa('0xe')];this['agents']=_0x358287[_0x5aaa('0xf')];this[_0x5aaa('0x10')]=_0x358287[_0x5aaa('0x10')];this[_0x5aaa('0x11')]=_0x358287[_0x5aaa('0x11')];this[_0x5aaa('0x12')]=_0x358287[_0x5aaa('0x12')];this[_0x5aaa('0x13')]=_0x358287[_0x5aaa('0x13')];this[_0x5aaa('0x14')]=_0x358287['freshdeskAccounts'];this[_0x5aaa('0x15')]=_0x358287['salesforceAccounts'];this[_0x5aaa('0x16')]=_0x358287[_0x5aaa('0x16')];this['zohoAccounts']=_0x358287['zohoAccounts'];this['deskAccounts']=_0x358287['deskAccounts'];this[_0x5aaa('0x17')]=_0x358287[_0x5aaa('0x17')];this[_0x5aaa('0x18')]=_0x358287[_0x5aaa('0x18')];this[_0x5aaa('0x19')]=_0x358287['dynamics365Accounts'];this[_0x5aaa('0x1a')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x5aaa('0x15')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x5aaa('0x16')],'zoho':this[_0x5aaa('0x1b')],'desk':this[_0x5aaa('0x1c')],'vtiger':this[_0x5aaa('0x17')],'servicenow':this[_0x5aaa('0x18')],'dynamics365':this[_0x5aaa('0x19')]};ami['on']('custom:agentcalled',this[_0x5aaa('0x1d')][_0x5aaa('0x1e')](this));ami['on'](_0x5aaa('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5aaa('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5aaa('0x21'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5aaa('0x22'),this[_0x5aaa('0x1d')]['bind'](this));ami['on'](_0x5aaa('0x23'),this[_0x5aaa('0x24')][_0x5aaa('0x1e')](this));ami['on'](_0x5aaa('0x25'),this[_0x5aaa('0x24')][_0x5aaa('0x1e')](this));ami['on'](_0x5aaa('0x26'),this[_0x5aaa('0x24')]['bind'](this));ami['on'](_0x5aaa('0x27'),this[_0x5aaa('0x1d')][_0x5aaa('0x1e')](this));ami['on'](_0x5aaa('0x28'),this[_0x5aaa('0x1d')][_0x5aaa('0x1e')](this));ami['on'](_0x5aaa('0x29'),this[_0x5aaa('0x1d')][_0x5aaa('0x1e')](this));ami['on'](_0x5aaa('0x2a'),this['syncCustomEvent'][_0x5aaa('0x1e')](this));ami['on'](_0x5aaa('0x2b'),this[_0x5aaa('0x1d')][_0x5aaa('0x1e')](this));ami['on'](_0x5aaa('0x2c'),this['syncCustomEvent'][_0x5aaa('0x1e')](this));}Trigger['prototype'][_0x5aaa('0x2d')]=function(_0x4e1193,_0x1451d1,_0x4b03b6){logger[_0x5aaa('0x2e')](_0x4e1193,_0x1451d1,JSON[_0x5aaa('0x2f')](_0x4b03b6));io['to'](_0x4e1193)[_0x5aaa('0x2d')](_0x1451d1,_0x4b03b6);};Trigger[_0x5aaa('0x30')][_0x5aaa('0x1d')]=function(_0x3e6357){var _0x586921=_[_0x5aaa('0x31')](_0x3e6357);this[_0x5aaa('0x32')](_0x586921);};Trigger[_0x5aaa('0x30')][_0x5aaa('0x24')]=function(_0x17caa9){if(this[_0x5aaa('0xf')][_0x17caa9[_0x5aaa('0x33')]]){this[_0x5aaa('0x1d')](_0x17caa9);}};Trigger[_0x5aaa('0x30')]['checkTriggers']=function(_0x330d5b){var _0x451ad2;for(var _0x2dc7b1 in this[_0x5aaa('0xe')]){if(this[_0x5aaa('0xe')][_0x5aaa('0x34')](_0x2dc7b1)){if(this['triggers'][_0x2dc7b1][_0x5aaa('0x35')]){_0x451ad2=this[_0x5aaa('0x36')](this[_0x5aaa('0xe')][_0x2dc7b1],_0x330d5b);if(_0x451ad2){_[_0x5aaa('0x37')](_0x330d5b,_0x330d5b[_0x5aaa('0x38')]);for(var _0x4968f9=0x0,_0xc59207,_0x41a399,_0x91e6a;_0x4968f90x0){_0x2f36ad=_['map'](_0x43b122,_0x2d68b6);}return _0x2f36ad;}function getCustomFields(_0x316445,_0x16b33c){var _0xda10b6=[];var _0xb76ccc={'custom_fields':{}};if(_0x316445[_0xaac4('0x28')]>0x0){_[_0xaac4('0x29')](_0x316445,function(_0x5e469a){if(_0x5e469a[_0xaac4('0x2a')]==='string'&&_0x5e469a[_0xaac4('0x2b')]&&!_0x5e469a[_0xaac4('0x2c')]){_0xb76ccc[_0x5e469a[_0xaac4('0x2b')][_0xaac4('0x2d')]()]=_0x5e469a['content']['toString']();}else if(_0x5e469a['type']===_0xaac4('0x2e')&&_0x5e469a[_0xaac4('0x2f')]&&_0x5e469a[_0xaac4('0x2c')]){_0xb76ccc[_0xaac4('0x30')][_0x5e469a[_0xaac4('0x2f')]]=_0x5e469a[_0xaac4('0x31')][_0xaac4('0x20')]();}else if(_0x5e469a[_0xaac4('0x2a')]===_0xaac4('0x32')&&_0x5e469a[_0xaac4('0x33')]&&_0x5e469a[_0xaac4('0x2f')]&&_0x5e469a[_0xaac4('0x2c')]){_0x16b33c[_0x5e469a[_0xaac4('0x33')]]&&(_0xb76ccc[_0xaac4('0x30')][_0x5e469a[_0xaac4('0x2f')]]=_0x16b33c[_0x5e469a['variableName']]['toString']());}else if(_0x5e469a[_0xaac4('0x2a')]===_0xaac4('0x34')&&_0x5e469a[_0xaac4('0x35')]&&_0x5e469a['Variable'][_0xaac4('0x36')]&&_0x5e469a[_0xaac4('0x2f')]&&_0x5e469a[_0xaac4('0x2c')]){_0x16b33c[_0x5e469a[_0xaac4('0x35')][_0xaac4('0x36')][_0xaac4('0x2d')]()]&&(_0xb76ccc[_0xaac4('0x30')][_0x5e469a['idField']]=_0x16b33c[_0x5e469a[_0xaac4('0x35')][_0xaac4('0x36')][_0xaac4('0x2d')]()]['toString']());}});}if(_0xb76ccc[_0xaac4('0x37')]){_0xb76ccc['priority']=Number(_0xb76ccc['priority']);}return _0xb76ccc;}function getTicket(_0x344d05,_0x3c4ad4,_0x2da28a,_0x591924,_0x5000ed){logger[_0xaac4('0x13')](_0xaac4('0x38'));var _0x2f7300=_[_0xaac4('0x39')]({'subject':intUtil[_0xaac4('0x3a')](_0x591924[_0xaac4('0x3b')],_0x5000ed,'\x20'),'type':'phone','status':'new','labels':[_0xaac4('0x3c'),_0xaac4('0x3d'),'CTI'][_0xaac4('0x3e')](getTags(_0x591924[_0xaac4('0x3f')],_0xaac4('0x36'))),'description':intUtil['getString'](_0x591924[_0xaac4('0x40')],_0x5000ed,'\x0a'),'_links':{'assigned_user':{'href':util[_0xaac4('0xc')](_0xaac4('0x41'),_0x3c4ad4['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0xaac4('0x3a')](_0x591924[_0xaac4('0x40')],_0x5000ed,'\x0a')}},getCustomFields(_0x591924[_0xaac4('0x42')],_0x5000ed));return request({'uri':util[_0xaac4('0xc')]('%s/customers/%d/cases',_0x344d05[_0xaac4('0xe')],_0x2da28a['id']),'method':'POST','body':_0x2f7300});}exports['queue']=function(_0xaa7749,_0x31e240,_0x27df36,_0x40c007,_0x43bc12,_0xb78221){var _0x1f23cc,_0x236d8e;_0xb78221['remoteUri']=intUtil[_0xaac4('0x43')](_0xb78221[_0xaac4('0xe')]);_0xb78221[_0xaac4('0x44')]=intUtil[_0xaac4('0x43')](_0xb78221['serverUrl']);if(_0x43bc12&&_0x43bc12[_0xaac4('0x45')]){logger[_0xaac4('0x13')](_0xaac4('0x46'),'Recording\x20is\x20enabled!');_0x31e240[_0xaac4('0x47')]=util[_0xaac4('0xc')](_0xaac4('0x48'),_0xb78221[_0xaac4('0x44')],_0x31e240['uniqueid'],md5(_0x31e240[_0xaac4('0x49')]));}else{_0x31e240[_0xaac4('0x47')]='';}headers[_0xaac4('0x4a')]=getAuth(_0xb78221);return getUser(_0xb78221,_0x40c007['email'])[_0xaac4('0xf')](function(_0x2e9a33){_0x1f23cc=_0x2e9a33;logger[_0xaac4('0x13')](_0xaac4('0x4b'),_0x1f23cc['id']);return getEndUser(_0xb78221,_0x31e240[_0xaac4('0x4c')],_0x31e240[_0xaac4('0x4d')]);})[_0xaac4('0xf')](function(_0xa8d1c9){_0x236d8e=_0xa8d1c9;logger[_0xaac4('0x13')]('The\x20Enduser\x20ID\x20is:',_0x236d8e['id']);return getTicket(_0xb78221,_0x1f23cc,_0x236d8e,_0x27df36,_0x31e240);})[_0xaac4('0xf')](function(_0x1df765){if(_0x1df765){logger[_0xaac4('0x13')](_0xaac4('0x4e'));logger[_0xaac4('0x13')]('The\x20Ticket\x20ID\x20is:',_0x1df765['id']);switch(_0xb78221['type']){case _0xaac4('0x4f'):logger[_0xaac4('0x13')](_0xaac4('0x46'),_0xaac4('0x50'));emit(util['format'](_0xaac4('0x51'),_0x40c007['name']),_0xaac4('0x52'),{'recordId':_0x1df765['id']});break;case _0xaac4('0x53'):logger['info'](_0xaac4('0x46'),_0xaac4('0x54'));emit(util[_0xaac4('0xc')]('user:%s',_0x40c007['name']),_0xaac4('0x55'),{'uri':util[_0xaac4('0xc')](_0xaac4('0x56'),_0x1df765['id'])});break;default:logger[_0xaac4('0x57')](_0xaac4('0x46'),_0xaac4('0x58'));}}})['catch'](function(_0x3c11b9){console[_0xaac4('0x57')](_0x3c11b9);logger[_0xaac4('0x57')](_0xaac4('0x46'),JSON['stringify'](_0x3c11b9));});};exports[_0xaac4('0x59')]=function(_0x571418,_0x33e32f,_0x3a703c,_0x460252,_0x3922a0,_0x324305,_0x35b200){var _0x3d7720,_0x3aa764;_0x324305[_0xaac4('0xe')]=intUtil[_0xaac4('0x43')](_0x324305[_0xaac4('0xe')]);_0x324305[_0xaac4('0x44')]=intUtil[_0xaac4('0x43')](_0x324305[_0xaac4('0x44')]);if(_0x35b200&&_0x35b200['recordingFormat']&&_0x35b200[_0xaac4('0x5a')]!==_0xaac4('0x5b')){logger[_0xaac4('0x13')](_0xaac4('0x5c'),_0xaac4('0x5d'));_0x33e32f[_0xaac4('0x47')]=util[_0xaac4('0xc')](_0xaac4('0x48'),_0x324305['serverUrl'],_0x33e32f[_0xaac4('0x49')],md5(_0x33e32f['uniqueid']));}headers[_0xaac4('0x4a')]=getAuth(_0x324305);return getUser(_0x324305,_0x460252['email'])[_0xaac4('0xf')](function(_0x5d56ae){_0x3d7720=_0x5d56ae;logger['info'](_0xaac4('0x4b'),_0x3d7720['id']);return getEndUser(_0x324305,_0x33e32f[_0xaac4('0x5e')],_0x33e32f['destcalleridnum']);})[_0xaac4('0xf')](function(_0x3f66e6){_0x3aa764=_0x3f66e6;logger[_0xaac4('0x13')](_0xaac4('0x5f'),_0x3aa764['id']);return getTicket(_0x324305,_0x3d7720,_0x3aa764,_0x3a703c,_0x33e32f);})[_0xaac4('0xf')](function(_0x19d9c1){if(_0x19d9c1){logger['info'](_0xaac4('0x4e'));logger['info'](_0xaac4('0x60'),_0x19d9c1['id']);switch(_0x324305['type']){case'integrationTab':logger['info'](_0xaac4('0x46'),_0xaac4('0x50'));emit(util[_0xaac4('0xc')](_0xaac4('0x51'),_0x460252['name']),_0xaac4('0x52'),{'recordId':_0x19d9c1['id']});break;case _0xaac4('0x53'):logger[_0xaac4('0x13')]('[QUEUE]',_0xaac4('0x54'));emit(util[_0xaac4('0xc')](_0xaac4('0x51'),_0x460252[_0xaac4('0x36')]),_0xaac4('0x55'),{'uri':util[_0xaac4('0xc')](_0xaac4('0x61'),_0x324305['remoteUri'],_0x19d9c1['id'])});break;default:logger['error'](_0xaac4('0x5c'),'Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x2df044){logger['error'](_0xaac4('0x5c'),JSON['stringify'](_0x2df044));});};exports[_0xaac4('0x62')]=function(_0x3f547e,_0x4a3c03,_0x5112d3,_0x4e6de9,_0x4d0ee7,_0x3f852f){var _0x18451f,_0x1a6804;_0x3f852f[_0xaac4('0xe')]=intUtil['stripTrailingSlash'](_0x3f852f[_0xaac4('0xe')]);_0x3f852f[_0xaac4('0x44')]=intUtil[_0xaac4('0x43')](_0x3f852f[_0xaac4('0x44')]);if(_0x4d0ee7&&_0x4d0ee7[_0xaac4('0x45')]){logger[_0xaac4('0x13')](_0xaac4('0x63'),_0xaac4('0x5d'));_0x4a3c03[_0xaac4('0x47')]=util[_0xaac4('0xc')](_0xaac4('0x48'),_0x3f852f['serverUrl'],_0x4a3c03['uniqueid'],md5(_0x4a3c03[_0xaac4('0x49')]));}else{_0x4a3c03['recordingURL']='';}headers['Authorization']=getAuth(_0x3f852f);return getUser(_0x3f852f)[_0xaac4('0xf')](function(_0x5d7b7b){_0x18451f=_0x5d7b7b;logger[_0xaac4('0x13')](_0xaac4('0x4b'),_0x18451f['id']);return getEndUser(_0x3f852f,_0x4a3c03[_0xaac4('0x4c')],_0x4a3c03[_0xaac4('0x4d')]);})['then'](function(_0x1a49c5){_0x1a6804=_0x1a49c5;logger[_0xaac4('0x13')](_0xaac4('0x5f'),_0x1a6804['id']);return getTicket(_0x3f852f,_0x18451f,_0x1a6804,_0x5112d3,_0x4a3c03);})[_0xaac4('0xf')](function(_0x300b0e){if(_0x300b0e){logger[_0xaac4('0x13')]('Ticket\x20created!');logger[_0xaac4('0x13')](_0xaac4('0x60'),_0x300b0e['id']);}})['catch'](function(_0x2e3fd9){logger[_0xaac4('0x57')]('[ABANDONED]',JSON['stringify'](_0x2e3fd9));});}; \ No newline at end of file +var _0x8f4c=['POST','length','map','type','nameField','toLowerCase','content','string','idField','customField','variable','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','new','xCALLY','Motion','CTI','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','then','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','destcalleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:desk:display','%s/agent/tickets/%s','[ABANDONED]','Authorization','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','stringify','defaults','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x5cc39f,_0x228878){var _0x23ddcb=function(_0x3b852b){while(--_0x3b852b){_0x5cc39f['push'](_0x5cc39f['shift']());}};_0x23ddcb(++_0x228878);}(_0x8f4c,0x113));var _0xc8f4=function(_0x278f93,_0x5d74c6){_0x278f93=_0x278f93-0x0;var _0x47d224=_0x8f4c[_0x278f93];return _0x47d224;};'use strict';var _=require(_0xc8f4('0x0'));var rp=require(_0xc8f4('0x1'));var md5=require(_0xc8f4('0x2'));var util=require(_0xc8f4('0x3'));var Redis=require(_0xc8f4('0x4'));var intUtil=require(_0xc8f4('0x5'));var config=require('../../../../config/environment');var logger=require(_0xc8f4('0x6'))(_0xc8f4('0x7'));config[_0xc8f4('0x8')]=_['defaults'](config[_0xc8f4('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x373506,_0x48c39d,_0x3ea9a2){io['to'](_0x373506)[_0xc8f4('0x9')](_0x48c39d,_0x3ea9a2);}var headers={'Content-Type':_0xc8f4('0xa'),'Accept':_0xc8f4('0xa')};function getUser(_0x34f05f,_0x599de3){if(intUtil[_0xc8f4('0xb')](_0x599de3)===!![]){logger[_0xc8f4('0xc')](_0xc8f4('0xd'),_0x599de3);return request({'uri':util[_0xc8f4('0xe')]('%s/users',_0x34f05f[_0xc8f4('0xf')])})['then'](function(_0x430009){if(_0x430009[_0xc8f4('0x10')]){return _[_0xc8f4('0x11')](_0x430009[_0xc8f4('0x12')][_0xc8f4('0x13')],{'email':_0x599de3});}})['then'](function(_0x39a1d5){if(_0x39a1d5){logger[_0xc8f4('0xc')](_0xc8f4('0x14'));return _0x39a1d5;}else{logger[_0xc8f4('0xc')](_0xc8f4('0x15'));return request({'uri':util[_0xc8f4('0xe')]('%s/users/me',_0x34f05f[_0xc8f4('0xf')])});}});}else{logger[_0xc8f4('0xc')](_0xc8f4('0x16'));return request({'uri':util[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x34f05f['remoteUri'])});}}function request(_0xac45d5){logger['debug']('[HTTP]',JSON[_0xc8f4('0x18')](_0xac45d5));return rp(_[_0xc8f4('0x19')](_0xac45d5,{'method':_0xc8f4('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x7bb973){var _0x4763c1;if(_0x7bb973[_0xc8f4('0x1b')]===_0xc8f4('0x1c')){_0x4763c1=util[_0xc8f4('0xe')](_0xc8f4('0x1d'),_0x7bb973[_0xc8f4('0x1e')],_0x7bb973[_0xc8f4('0x1f')]);}else if(_0x7bb973[_0xc8f4('0x1b')]===_0xc8f4('0x20')){_0x4763c1=util['format'](_0xc8f4('0x21'),_0x7bb973[_0xc8f4('0x1e')],_0x7bb973[_0xc8f4('0x20')]);}return util[_0xc8f4('0xe')](_0xc8f4('0x22'),new Buffer(_0x4763c1)[_0xc8f4('0x23')](_0xc8f4('0x24')));}function getEndUser(_0x43eb57,_0x5e62aa,_0x4463aa){logger[_0xc8f4('0xc')](_0xc8f4('0x25'),_0x4463aa);return request({'uri':util[_0xc8f4('0xe')]('%s/customers/search',_0x43eb57[_0xc8f4('0xf')]),'qs':{'phone':_0x4463aa}})['then'](function(_0x3782fd){if(_0x3782fd['total_entries']){logger[_0xc8f4('0xc')](_0xc8f4('0x26'));return _0x3782fd['_embedded'][_0xc8f4('0x13')][0x0];}else{logger[_0xc8f4('0xc')](_0xc8f4('0x27'));return request({'uri':util[_0xc8f4('0xe')]('%s/customers',_0x43eb57[_0xc8f4('0xf')]),'method':_0xc8f4('0x28'),'body':{'first_name':_0x5e62aa,'title':_0x5e62aa,'phone_numbers':[{'type':'work','value':_0x4463aa}]}});}});}function getTags(_0x190f61,_0x37957c){var _0x157ad5=[];if(_0x190f61&&_0x190f61[_0xc8f4('0x29')]>0x0){_0x157ad5=_[_0xc8f4('0x2a')](_0x190f61,_0x37957c);}return _0x157ad5;}function getCustomFields(_0x385e41,_0x4a25da){var _0x45f972=[];var _0x24bb78={'custom_fields':{}};if(_0x385e41[_0xc8f4('0x29')]>0x0){_['forEach'](_0x385e41,function(_0xf4a556){if(_0xf4a556[_0xc8f4('0x2b')]==='string'&&_0xf4a556['nameField']&&!_0xf4a556['customField']){_0x24bb78[_0xf4a556[_0xc8f4('0x2c')][_0xc8f4('0x2d')]()]=_0xf4a556[_0xc8f4('0x2e')][_0xc8f4('0x23')]();}else if(_0xf4a556[_0xc8f4('0x2b')]===_0xc8f4('0x2f')&&_0xf4a556[_0xc8f4('0x30')]&&_0xf4a556[_0xc8f4('0x31')]){_0x24bb78['custom_fields'][_0xf4a556[_0xc8f4('0x30')]]=_0xf4a556[_0xc8f4('0x2e')][_0xc8f4('0x23')]();}else if(_0xf4a556['type']===_0xc8f4('0x32')&&_0xf4a556[_0xc8f4('0x33')]&&_0xf4a556['idField']&&_0xf4a556[_0xc8f4('0x31')]){_0x4a25da[_0xf4a556[_0xc8f4('0x33')]]&&(_0x24bb78[_0xc8f4('0x34')][_0xf4a556['idField']]=_0x4a25da[_0xf4a556[_0xc8f4('0x33')]][_0xc8f4('0x23')]());}else if(_0xf4a556[_0xc8f4('0x2b')]==='customVariable'&&_0xf4a556[_0xc8f4('0x35')]&&_0xf4a556[_0xc8f4('0x35')][_0xc8f4('0x36')]&&_0xf4a556[_0xc8f4('0x30')]&&_0xf4a556[_0xc8f4('0x31')]){_0x4a25da[_0xf4a556[_0xc8f4('0x35')][_0xc8f4('0x36')][_0xc8f4('0x2d')]()]&&(_0x24bb78[_0xc8f4('0x34')][_0xf4a556[_0xc8f4('0x30')]]=_0x4a25da[_0xf4a556[_0xc8f4('0x35')][_0xc8f4('0x36')][_0xc8f4('0x2d')]()][_0xc8f4('0x23')]());}});}if(_0x24bb78[_0xc8f4('0x37')]){_0x24bb78[_0xc8f4('0x37')]=Number(_0x24bb78['priority']);}return _0x24bb78;}function getTicket(_0x3a8cac,_0x5424cc,_0x7d06d3,_0x51bfe6,_0x399e64){logger[_0xc8f4('0xc')](_0xc8f4('0x38'));var _0x19db80=_[_0xc8f4('0x39')]({'subject':intUtil[_0xc8f4('0x3a')](_0x51bfe6[_0xc8f4('0x3b')],_0x399e64,'\x20'),'type':'phone','status':_0xc8f4('0x3c'),'labels':[_0xc8f4('0x3d'),_0xc8f4('0x3e'),_0xc8f4('0x3f')]['concat'](getTags(_0x51bfe6[_0xc8f4('0x40')],_0xc8f4('0x36'))),'description':intUtil[_0xc8f4('0x3a')](_0x51bfe6[_0xc8f4('0x41')],_0x399e64,'\x0a'),'_links':{'assigned_user':{'href':util[_0xc8f4('0xe')](_0xc8f4('0x42'),_0x5424cc['id']),'class':_0xc8f4('0x43')}},'message':{'direction':'in','body':intUtil[_0xc8f4('0x3a')](_0x51bfe6[_0xc8f4('0x41')],_0x399e64,'\x0a')}},getCustomFields(_0x51bfe6[_0xc8f4('0x44')],_0x399e64));return request({'uri':util[_0xc8f4('0xe')](_0xc8f4('0x45'),_0x3a8cac['remoteUri'],_0x7d06d3['id']),'method':_0xc8f4('0x28'),'body':_0x19db80});}exports[_0xc8f4('0x46')]=function(_0x405597,_0x275f4a,_0x588ff9,_0x49da16,_0x413a55,_0x453055){var _0x4992a0,_0x1c0f2e;_0x453055[_0xc8f4('0xf')]=intUtil['stripTrailingSlash'](_0x453055['remoteUri']);_0x453055[_0xc8f4('0x47')]=intUtil[_0xc8f4('0x48')](_0x453055[_0xc8f4('0x47')]);if(_0x413a55&&_0x413a55[_0xc8f4('0x49')]){logger[_0xc8f4('0xc')](_0xc8f4('0x4a'),'Recording\x20is\x20enabled!');_0x275f4a['recordingURL']=util[_0xc8f4('0xe')](_0xc8f4('0x4b'),_0x453055[_0xc8f4('0x47')],_0x275f4a['uniqueid'],md5(_0x275f4a['uniqueid']));}else{_0x275f4a['recordingURL']='';}headers['Authorization']=getAuth(_0x453055);return getUser(_0x453055,_0x49da16['email'])[_0xc8f4('0x4c')](function(_0x38fb89){_0x4992a0=_0x38fb89;logger[_0xc8f4('0xc')](_0xc8f4('0x4d'),_0x4992a0['id']);return getEndUser(_0x453055,_0x275f4a[_0xc8f4('0x4e')],_0x275f4a[_0xc8f4('0x4f')]);})['then'](function(_0xdd7c1a){_0x1c0f2e=_0xdd7c1a;logger[_0xc8f4('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1c0f2e['id']);return getTicket(_0x453055,_0x4992a0,_0x1c0f2e,_0x588ff9,_0x275f4a);})['then'](function(_0x724f47){if(_0x724f47){logger[_0xc8f4('0xc')](_0xc8f4('0x50'));logger[_0xc8f4('0xc')]('The\x20Ticket\x20ID\x20is:',_0x724f47['id']);switch(_0x453055['type']){case _0xc8f4('0x51'):logger[_0xc8f4('0xc')](_0xc8f4('0x4a'),_0xc8f4('0x52'));emit(util[_0xc8f4('0xe')](_0xc8f4('0x53'),_0x49da16['name']),'trigger:desk:display',{'recordId':_0x724f47['id']});break;case _0xc8f4('0x54'):logger[_0xc8f4('0xc')](_0xc8f4('0x4a'),_0xc8f4('0x55'));emit(util[_0xc8f4('0xe')](_0xc8f4('0x53'),_0x49da16[_0xc8f4('0x36')]),_0xc8f4('0x56'),{'uri':util[_0xc8f4('0xe')]('https://xcally.desk.com/web/agent/case/%d',_0x724f47['id'])});break;default:logger['error'](_0xc8f4('0x4a'),_0xc8f4('0x57'));}}})[_0xc8f4('0x58')](function(_0x342b26){console[_0xc8f4('0x59')](_0x342b26);logger[_0xc8f4('0x59')](_0xc8f4('0x4a'),JSON[_0xc8f4('0x18')](_0x342b26));});};exports[_0xc8f4('0x5a')]=function(_0x189fae,_0x15064a,_0x3bca90,_0xca342e,_0x4ec67d,_0x3d291b,_0x345576){var _0x28ad15,_0x1602d3;_0x3d291b['remoteUri']=intUtil[_0xc8f4('0x48')](_0x3d291b[_0xc8f4('0xf')]);_0x3d291b['serverUrl']=intUtil['stripTrailingSlash'](_0x3d291b[_0xc8f4('0x47')]);if(_0x345576&&_0x345576['recordingFormat']&&_0x345576[_0xc8f4('0x5b')]!==_0xc8f4('0x5c')){logger[_0xc8f4('0xc')](_0xc8f4('0x5d'),_0xc8f4('0x5e'));_0x15064a[_0xc8f4('0x5f')]=util[_0xc8f4('0xe')](_0xc8f4('0x4b'),_0x3d291b[_0xc8f4('0x47')],_0x15064a[_0xc8f4('0x60')],md5(_0x15064a[_0xc8f4('0x60')]));}headers['Authorization']=getAuth(_0x3d291b);return getUser(_0x3d291b,_0xca342e[_0xc8f4('0x61')])[_0xc8f4('0x4c')](function(_0x18397c){_0x28ad15=_0x18397c;logger[_0xc8f4('0xc')]('The\x20User\x20ID\x20is:',_0x28ad15['id']);return getEndUser(_0x3d291b,_0x15064a[_0xc8f4('0x62')],_0x15064a['destcalleridnum']);})['then'](function(_0x130c42){_0x1602d3=_0x130c42;logger[_0xc8f4('0xc')](_0xc8f4('0x63'),_0x1602d3['id']);return getTicket(_0x3d291b,_0x28ad15,_0x1602d3,_0x3bca90,_0x15064a);})[_0xc8f4('0x4c')](function(_0x2bfb92){if(_0x2bfb92){logger[_0xc8f4('0xc')]('Ticket\x20created!');logger['info'](_0xc8f4('0x64'),_0x2bfb92['id']);switch(_0x3d291b[_0xc8f4('0x2b')]){case _0xc8f4('0x51'):logger[_0xc8f4('0xc')](_0xc8f4('0x4a'),_0xc8f4('0x52'));emit(util[_0xc8f4('0xe')]('user:%s',_0xca342e[_0xc8f4('0x36')]),_0xc8f4('0x65'),{'recordId':_0x2bfb92['id']});break;case'newTab':logger[_0xc8f4('0xc')](_0xc8f4('0x4a'),_0xc8f4('0x55'));emit(util[_0xc8f4('0xe')](_0xc8f4('0x53'),_0xca342e[_0xc8f4('0x36')]),_0xc8f4('0x56'),{'uri':util['format'](_0xc8f4('0x66'),_0x3d291b[_0xc8f4('0xf')],_0x2bfb92['id'])});break;default:logger['error']('[OUTBOUND]',_0xc8f4('0x57'));}}})['catch'](function(_0x281b3a){logger[_0xc8f4('0x59')]('[OUTBOUND]',JSON['stringify'](_0x281b3a));});};exports['abandoned']=function(_0x490b8b,_0x4b619c,_0x4f66d1,_0x32665c,_0x51612f,_0x17e9d1){var _0x357e45,_0x16a3cc;_0x17e9d1[_0xc8f4('0xf')]=intUtil['stripTrailingSlash'](_0x17e9d1[_0xc8f4('0xf')]);_0x17e9d1[_0xc8f4('0x47')]=intUtil[_0xc8f4('0x48')](_0x17e9d1[_0xc8f4('0x47')]);if(_0x51612f&&_0x51612f['monitor_format']){logger[_0xc8f4('0xc')](_0xc8f4('0x67'),_0xc8f4('0x5e'));_0x4b619c[_0xc8f4('0x5f')]=util['format'](_0xc8f4('0x4b'),_0x17e9d1[_0xc8f4('0x47')],_0x4b619c['uniqueid'],md5(_0x4b619c[_0xc8f4('0x60')]));}else{_0x4b619c[_0xc8f4('0x5f')]='';}headers[_0xc8f4('0x68')]=getAuth(_0x17e9d1);return getUser(_0x17e9d1)[_0xc8f4('0x4c')](function(_0x3ae6e0){_0x357e45=_0x3ae6e0;logger[_0xc8f4('0xc')]('The\x20User\x20ID\x20is:',_0x357e45['id']);return getEndUser(_0x17e9d1,_0x4b619c[_0xc8f4('0x4e')],_0x4b619c[_0xc8f4('0x4f')]);})[_0xc8f4('0x4c')](function(_0x5e5117){_0x16a3cc=_0x5e5117;logger[_0xc8f4('0xc')](_0xc8f4('0x63'),_0x16a3cc['id']);return getTicket(_0x17e9d1,_0x357e45,_0x16a3cc,_0x4f66d1,_0x4b619c);})[_0xc8f4('0x4c')](function(_0x498578){if(_0x498578){logger[_0xc8f4('0xc')](_0xc8f4('0x50'));logger[_0xc8f4('0xc')](_0xc8f4('0x64'),_0x498578['id']);}})['catch'](function(_0x8c8e43){logger[_0xc8f4('0x59')]('[ABANDONED]',JSON[_0xc8f4('0x18')](_0x8c8e43));});}; \ 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 55873cc..74ff923 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 _0x2e88=['isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','POST','/systemusers(','headers','substring','lastIndexOf','contacts?$select=telephone1','telephone1','enduserId','forEach','type','nameField','idField','indexOf','content','ticketType','assign','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','callDirection','queue','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','abandoned','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','clientId','remoteUri','username','password','access_token','catch','error','toUpperCase','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length'];(function(_0x2509be,_0x5c9173){var _0x2f2f00=function(_0x12b660){while(--_0x12b660){_0x2509be['push'](_0x2509be['shift']());}};_0x2f2f00(++_0x5c9173);}(_0x2e88,0x1a6));var _0x82e8=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0x2e88[_0x334599];return _0x4cdff2;};'use strict';var _=require('lodash');var BPromise=require(_0x82e8('0x0'));var rp=require(_0x82e8('0x1'));var util=require('util');var intUtil=require(_0x82e8('0x2'));var md5=require('md5');var Redis=require(_0x82e8('0x3'));var logger=require(_0x82e8('0x4'))(_0x82e8('0x5'));var config=require('../../../../config/environment');config[_0x82e8('0x6')]=_[_0x82e8('0x7')](config['redis'],{'host':_0x82e8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x82e8('0x6')]));function getAuthToken(_0x4ee494,_0x44b1fa,_0x34636f){var _0x42b9dc={'method':'POST','uri':_0x44b1fa,'form':{'client_id':_0x4ee494[_0x82e8('0x9')],'resource':_0x4ee494[_0x82e8('0xa')],'username':_0x4ee494[_0x82e8('0xb')],'password':_0x4ee494[_0x82e8('0xc')],'grant_type':_0x82e8('0xc'),'client_secret':_0x4ee494['clientSecret']},'json':!![]};return rp(_0x42b9dc)['then'](function(_0x2ecefd){return _0x2ecefd[_0x82e8('0xd')];})[_0x82e8('0xe')](function(_0x386de1){logger[_0x82e8('0xf')]('['+[_0x34636f[_0x82e8('0x10')]()]+']\x20Wrong\x20credentials!');return _0x386de1[_0x82e8('0x11')];});}function getUser(_0x3b0ae2,_0x46ca48,_0x34b971,_0x1a4089,_0x166682,_0x3534ac){return new BPromise(function(_0x2dfe2f,_0x185ef6){return getAuthToken(_0x46ca48,_0x1a4089,_0x3534ac)[_0x82e8('0x12')](function(_0x8c3fb4){var _0xc22e78={'method':_0x82e8('0x13'),'uri':_0x166682+_0x82e8('0x14'),'headers':{'Authorization':_0x82e8('0x15')+_0x8c3fb4,'OData-Version':_0x82e8('0x16')},'json':!![]};return rp(_0xc22e78);})[_0x82e8('0x12')](function(_0x2836b7){var _0x14afdf=_0x2836b7[_0x82e8('0x17')];var _0x371288=![];var _0x369813=null;if(!_[_0x82e8('0x18')](_0x34b971)){if(intUtil[_0x82e8('0x19')](_0x34b971[_0x82e8('0x1a')])){_0x3b0ae2['userEmail']=_0x34b971['email'];for(_0x369813=0x0;_0x369813<_0x14afdf[_0x82e8('0x1b')];_0x369813++){if(_0x14afdf[_0x369813]['internalemailaddress']===_0x34b971[_0x82e8('0x1a')]&&!_0x14afdf[_0x369813][_0x82e8('0x1c')]){_0x371288=!![];logger[_0x82e8('0x1d')]('['+[_0x3534ac[_0x82e8('0x10')]()]+_0x82e8('0x1e')+_0x14afdf[_0x369813][_0x82e8('0x1f')]+'!');_0x3b0ae2[_0x82e8('0x20')]=_0x14afdf[_0x369813][_0x82e8('0x1f')];}}}}if(!_0x371288){logger['info']('['+[_0x3534ac[_0x82e8('0x10')]()]+_0x82e8('0x21'));_0x3b0ae2[_0x82e8('0x22')]=_0x46ca48[_0x82e8('0xb')];for(_0x369813=0x0;_0x369813<_0x14afdf[_0x82e8('0x1b')];_0x369813++){if(_0x14afdf[_0x369813][_0x82e8('0x23')]===_0x46ca48['username']){_0x3b0ae2[_0x82e8('0x20')]=_0x14afdf[_0x369813]['systemuserid'];}}}_0x2dfe2f(_0x3b0ae2);})[_0x82e8('0xe')](function(_0x257780){_0x185ef6(_0x257780['message']);});});}function createEndUser(_0x181f86,_0x3b3870,_0x1a9d2e,_0x19106b,_0x86f741,_0x5d05d6){return new BPromise(function(_0x50f718,_0x5ac94f){return getAuthToken(_0x3b3870,_0x1a9d2e,_0x5d05d6)['then'](function(_0x4ab149){var _0x5a7cf8=_0x5d05d6[_0x82e8('0x24')]()===_0x82e8('0x25')?_0x86f741[_0x82e8('0x26')]:_0x86f741[_0x82e8('0x27')];var _0x5310fc={'method':_0x82e8('0x28'),'uri':_0x19106b+'contacts','body':{'telephone1':_0x5a7cf8,'fullname':_0x5a7cf8,'firstname':_0x5a7cf8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x82e8('0x29')+_0x181f86[_0x82e8('0x20')]+')'},'headers':{'Authorization':_0x82e8('0x15')+_0x4ab149,'OData-Version':_0x82e8('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5310fc);})[_0x82e8('0x12')](function(_0x542477){var _0x1e03b4=_0x542477[_0x82e8('0x2a')]['odata-entityid'];var _0x5b6fa5=_0x1e03b4[_0x82e8('0x2b')](_0x1e03b4[_0x82e8('0x2c')]('(')+0x1,_0x1e03b4['lastIndexOf'](')'));_0x181f86['enduserId']=_0x5b6fa5;_0x50f718(_0x181f86);})['catch'](function(_0x443532){_0x5ac94f(_0x443532['message']);});});}function getEndUser(_0x5d92d1,_0x20a4d2,_0xac8fca,_0x302b4b,_0x1261a5,_0x5045b6){return new BPromise(function(_0x478111,_0x2ee826){return getAuthToken(_0x20a4d2,_0xac8fca,_0x5045b6)[_0x82e8('0x12')](function(_0x2dea42){var _0x2cb4d7={'method':_0x82e8('0x13'),'uri':_0x302b4b+_0x82e8('0x2d'),'headers':{'Authorization':_0x82e8('0x15')+_0x2dea42,'If-None-Match':null,'OData-Version':_0x82e8('0x16')},'json':!![]};return rp(_0x2cb4d7);})[_0x82e8('0x12')](function(_0x1236b7){var _0x1378a6=null;if(_0x1236b7){var _0x5400bd=_0x1236b7[_0x82e8('0x17')];var _0x1028f8=![];for(_0x1378a6=0x0;_0x1378a6<_0x5400bd[_0x82e8('0x1b')];_0x1378a6++){var _0x5a09c7=_0x5045b6['toLowerCase']()===_0x82e8('0x25')?_0x1261a5[_0x82e8('0x26')]:_0x1261a5[_0x82e8('0x27')];if(_0x5400bd[_0x1378a6][_0x82e8('0x2e')]===_0x5a09c7){_0x1028f8=!![];_0x5d92d1[_0x82e8('0x2f')]=_0x5400bd[_0x1378a6]['contactid'];}}if(_0x1028f8){_0x478111(_0x5d92d1);}else{return createEndUser(_0x5d92d1,_0x20a4d2,_0xac8fca,_0x302b4b,_0x1261a5,_0x5045b6)[_0x82e8('0x12')](function(_0x544287){logger[_0x82e8('0x1d')]('['+[_0x5045b6['toUpperCase']()]+']\x20Enduser\x20created!',_0x544287[_0x82e8('0x2f')]);_0x478111(_0x544287);});}}else{return createEndUser(_0x5d92d1,_0x20a4d2,_0xac8fca,_0x302b4b,_0x1261a5,_0x5045b6)['then'](function(_0x5339ae){logger['info']('['+[_0x5045b6[_0x82e8('0x10')]()]+']\x20Enduser\x20Created!',_0x5339ae[_0x82e8('0x2f')]);_0x478111(_0x5339ae);});}});});}function getCustomFields(_0x5175f2,_0x33be58,_0x218b9f){var _0x264845={};if(_0x5175f2[_0x82e8('0x1b')]>0x0){_[_0x82e8('0x30')](_0x5175f2,function(_0x430f87){if(_0x430f87[_0x82e8('0x31')]==='string'&&_0x430f87[_0x82e8('0x32')]&&!_0x430f87['customField']){var _0x1b2b5c=_0x430f87[_0x82e8('0x33')][_0x82e8('0x24')]();var _0x370fe2=_0x1b2b5c[_0x82e8('0x2b')](0x0,_0x1b2b5c[_0x82e8('0x34')]('_'));var _0x1a631e=_0x1b2b5c[_0x82e8('0x2b')](_0x1b2b5c[_0x82e8('0x34')]('_')+0x1);if(_0x370fe2===_0x218b9f){_0x264845[_0x1a631e]=_0x430f87[_0x82e8('0x35')];}}});}return _0x264845;}function getTicket(_0x34cc77,_0x4f0a1a,_0x1cb28f,_0x5eb0c4,_0x5c29de,_0x418044,_0x5957c8){return new BPromise(function(_0x23922b,_0x3b6c04){var _0x1e31e4;return getAuthToken(_0x4f0a1a,_0x1cb28f,_0x5957c8)[_0x82e8('0x12')](function(_0x41b3ad){if(_0x418044[_0x82e8('0x36')]==='incident'){_0x1e31e4={'method':_0x82e8('0x28'),'uri':_0x5eb0c4+'incidents','body':Object[_0x82e8('0x37')]({},{'title':intUtil[_0x82e8('0x38')](_0x418044[_0x82e8('0x39')],_0x5c29de,'\x20'),'description':intUtil[_0x82e8('0x38')](_0x418044[_0x82e8('0x3a')],_0x5c29de,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x34cc77[_0x82e8('0x2f')]+')','ownerid@odata.bind':'/systemusers('+_0x34cc77[_0x82e8('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x418044[_0x82e8('0x3b')],_0x5c29de,_0x418044[_0x82e8('0x36')])),'headers':{'Authorization':_0x82e8('0x15')+_0x41b3ad,'OData-Version':_0x82e8('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x418044[_0x82e8('0x36')]===_0x82e8('0x3c')){_0x1e31e4={'method':_0x82e8('0x28'),'uri':_0x5eb0c4+_0x82e8('0x3d'),'body':Object[_0x82e8('0x37')]({},{'subject':intUtil[_0x82e8('0x38')](_0x418044['Subjects'],_0x5c29de,'\x20'),'phonenumber':String(_0x5c29de[_0x82e8('0x27')]),'description':intUtil[_0x82e8('0x38')](_0x418044['Descriptions'],_0x5c29de,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x34cc77[_0x82e8('0x2f')]+')','ownerid@odata.bind':'/systemusers('+_0x34cc77[_0x82e8('0x20')]+')','directioncode':_0x34cc77[_0x82e8('0x3e')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x82e8('0x29')+_0x34cc77[_0x82e8('0x20')]+')','participationtypemask':_0x34cc77['callDirection']===_0x82e8('0x3f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x34cc77[_0x82e8('0x2f')]+')','participationtypemask':_0x34cc77['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x418044['Fields'],_0x5c29de,_0x418044[_0x82e8('0x36')])),'headers':{'Authorization':_0x82e8('0x15')+_0x41b3ad,'OData-Version':_0x82e8('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e31e4);})[_0x82e8('0x12')](function(_0x2bd8c6){var _0x5dcc91=_0x2bd8c6[_0x82e8('0x2a')][_0x82e8('0x40')];var _0x5ac58c=_0x5dcc91['substring'](_0x5dcc91[_0x82e8('0x2c')]('(')+0x1,_0x5dcc91['lastIndexOf'](')'));_0x34cc77['ticketId']=_0x5ac58c;_0x23922b(_0x34cc77);})['catch'](function(_0x4454e7){_0x3b6c04(_0x4454e7[_0x82e8('0x11')]);});});}function emit(_0x172ffe,_0x1b5596,_0x523887,_0x211095){var _0x2b1243={'uri':util[_0x82e8('0x41')](_0x82e8('0x42'),_0x172ffe,_0x523887,_0x211095)};io['to'](util['format'](_0x82e8('0x43'),_0x1b5596))[_0x82e8('0x44')]('trigger:browser:url',_0x2b1243);}exports['cs']=function(_0x5e480a,_0x142f66,_0x290a4f,_0x59ae16,_0x1ba3ad,_0x4698b1,_0x14b899,_0x33eb80){var _0x3455f3={};_0x4698b1[_0x82e8('0xa')]=intUtil['stripTrailingSlash'](_0x4698b1[_0x82e8('0xa')]);_0x4698b1[_0x82e8('0x45')]=intUtil['stripTrailingSlash'](_0x4698b1[_0x82e8('0x45')]);_0x3455f3[_0x82e8('0x3e')]=_0x33eb80===_0x82e8('0x3f')||_0x33eb80==='abandoned'?_0x82e8('0x3f'):_0x82e8('0x25');var _0x94aad2=util[_0x82e8('0x41')](_0x82e8('0x46'),_0x4698b1[_0x82e8('0xa')]);var _0x56c237=util[_0x82e8('0x41')](_0x82e8('0x47'),_0x4698b1[_0x82e8('0x48')]);var _0x4328b5=util[_0x82e8('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4698b1['serverUrl'],_0x142f66[_0x82e8('0x49')],md5(_0x142f66[_0x82e8('0x49')]));if(_0x1ba3ad&&_0x1ba3ad[_0x82e8('0x4a')]){logger['info'](_0x82e8('0x4b'),_0x82e8('0x4c'));_0x142f66[_0x82e8('0x4d')]=_0x4328b5;}else if(_0x14b899&&_0x14b899[_0x82e8('0x4e')]&&_0x14b899['recordingFormat']!==_0x82e8('0x4f')){logger[_0x82e8('0x1d')](_0x82e8('0x50'),_0x82e8('0x4c'));_0x142f66[_0x82e8('0x4d')]=_0x4328b5;}else{_0x142f66[_0x82e8('0x4d')]='';}return getUser(_0x3455f3,_0x4698b1,_0x59ae16,_0x56c237,_0x94aad2,_0x33eb80)['then'](function(_0x38ff39){logger[_0x82e8('0x1d')]('['+_0x33eb80[_0x82e8('0x10')]()+_0x82e8('0x51'),_0x38ff39['userId']);logger[_0x82e8('0x1d')]('['+_0x33eb80['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x38ff39[_0x82e8('0x22')]);return getEndUser(_0x38ff39,_0x4698b1,_0x56c237,_0x94aad2,_0x142f66,_0x33eb80);})[_0x82e8('0x12')](function(_0xf64051){logger['info']('['+_0x33eb80[_0x82e8('0x10')]()+']\x20The\x20Enduser\x20ID\x20is:',_0xf64051['enduserId']);logger['info']('['+_0x33eb80[_0x82e8('0x10')]()+_0x82e8('0x52'),_0x142f66[_0x82e8('0x27')]);return getTicket(_0xf64051,_0x4698b1,_0x56c237,_0x94aad2,_0x142f66,_0x290a4f,_0x33eb80);})[_0x82e8('0x12')](function(_0x4ce5bf){logger[_0x82e8('0x1d')](util[_0x82e8('0x41')]('['+_0x33eb80[_0x82e8('0x10')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x290a4f[_0x82e8('0x36')],_0x4ce5bf['ticketId']));logger[_0x82e8('0x1d')](util[_0x82e8('0x41')]('['+_0x33eb80['toUpperCase']()+_0x82e8('0x53'),_0x33eb80));if(_0x33eb80!==_0x82e8('0x54')){logger[_0x82e8('0x1d')]('['+_0x33eb80['toUpperCase']()+']',_0x82e8('0x55'));emit(_0x4698b1['remoteUri'],_0x59ae16[_0x82e8('0x56')],_0x290a4f['ticketType'],_0x4ce5bf[_0x82e8('0x57')]);}})['catch'](function(_0x3fad6a){logger['error']('['+_0x33eb80[_0x82e8('0x10')]()+_0x82e8('0x58'),util[_0x82e8('0x59')](_0x3fad6a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x29e6=['contactid',']\x20Enduser\x20created!','forEach','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','headers','ticketId','format','user:%s','emit','trigger:browser:url','serverUrl','abandoned','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','defaults','socket.io-emitter','redis','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','email','userEmail','length','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','message','contacts?$select=telephone1','telephone1','enduserId'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x29e6,0xed));var _0x629e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x29e6[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x629e('0x0'));var BPromise=require(_0x629e('0x1'));var rp=require(_0x629e('0x2'));var util=require(_0x629e('0x3'));var intUtil=require(_0x629e('0x4'));var md5=require('md5');var Redis=require(_0x629e('0x5'));var logger=require(_0x629e('0x6'))('dynamics365');var config=require(_0x629e('0x7'));config['redis']=_[_0x629e('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x629e('0x9'))(new Redis(config[_0x629e('0xa')]));function getAuthToken(_0x44a508,_0x589a74,_0x27cb88){var _0x415a2d={'method':_0x629e('0xb'),'uri':_0x589a74,'form':{'client_id':_0x44a508[_0x629e('0xc')],'resource':_0x44a508[_0x629e('0xd')],'username':_0x44a508[_0x629e('0xe')],'password':_0x44a508[_0x629e('0xf')],'grant_type':_0x629e('0xf'),'client_secret':_0x44a508[_0x629e('0x10')]},'json':!![]};return rp(_0x415a2d)[_0x629e('0x11')](function(_0x4941be){return _0x4941be[_0x629e('0x12')];})[_0x629e('0x13')](function(_0x433097){logger[_0x629e('0x14')]('['+[_0x27cb88[_0x629e('0x15')]()]+_0x629e('0x16'));return _0x433097['message'];});}function getUser(_0xcc5451,_0x20ad93,_0x13a0bc,_0x6d506e,_0x2276d9,_0x5f333b){return new BPromise(function(_0x1a3b70,_0x10b829){return getAuthToken(_0x20ad93,_0x6d506e,_0x5f333b)[_0x629e('0x11')](function(_0x50474c){var _0x1d53db={'method':_0x629e('0x17'),'uri':_0x2276d9+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x629e('0x18')+_0x50474c,'OData-Version':_0x629e('0x19')},'json':!![]};return rp(_0x1d53db);})[_0x629e('0x11')](function(_0x2e7d59){var _0x3eb804=_0x2e7d59[_0x629e('0x1a')];var _0x4cab79=![];var _0x31e7c0=null;if(!_[_0x629e('0x1b')](_0x13a0bc)){if(intUtil['validateEmail'](_0x13a0bc[_0x629e('0x1c')])){_0xcc5451[_0x629e('0x1d')]=_0x13a0bc[_0x629e('0x1c')];for(_0x31e7c0=0x0;_0x31e7c0<_0x3eb804[_0x629e('0x1e')];_0x31e7c0++){if(_0x3eb804[_0x31e7c0]['internalemailaddress']===_0x13a0bc[_0x629e('0x1c')]&&!_0x3eb804[_0x31e7c0]['isdisabled']){_0x4cab79=!![];logger[_0x629e('0x1f')]('['+[_0x5f333b['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x3eb804[_0x31e7c0][_0x629e('0x20')]+'!');_0xcc5451[_0x629e('0x21')]=_0x3eb804[_0x31e7c0][_0x629e('0x20')];}}}}if(!_0x4cab79){logger[_0x629e('0x1f')]('['+[_0x5f333b[_0x629e('0x15')]()]+_0x629e('0x22'));_0xcc5451[_0x629e('0x1d')]=_0x20ad93[_0x629e('0xe')];for(_0x31e7c0=0x0;_0x31e7c0<_0x3eb804[_0x629e('0x1e')];_0x31e7c0++){if(_0x3eb804[_0x31e7c0][_0x629e('0x23')]===_0x20ad93['username']){_0xcc5451[_0x629e('0x21')]=_0x3eb804[_0x31e7c0]['systemuserid'];}}}_0x1a3b70(_0xcc5451);})[_0x629e('0x13')](function(_0x238798){_0x10b829(_0x238798['message']);});});}function createEndUser(_0x1d47f5,_0x11dd30,_0xdf65dd,_0x16f3ab,_0x5b7f4d,_0x38bbf9){return new BPromise(function(_0x39918d,_0x1f8938){return getAuthToken(_0x11dd30,_0xdf65dd,_0x38bbf9)[_0x629e('0x11')](function(_0x2ac220){var _0x2b2418=_0x38bbf9[_0x629e('0x24')]()===_0x629e('0x25')?_0x5b7f4d[_0x629e('0x26')]:_0x5b7f4d[_0x629e('0x27')];var _0x3a5072={'method':_0x629e('0xb'),'uri':_0x16f3ab+'contacts','body':{'telephone1':_0x2b2418,'fullname':_0x2b2418,'firstname':_0x2b2418,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x629e('0x28')+_0x1d47f5[_0x629e('0x21')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x2ac220,'OData-Version':_0x629e('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3a5072);})['then'](function(_0x3cf912){var _0x351dbe=_0x3cf912['headers'][_0x629e('0x29')];var _0x2ff438=_0x351dbe[_0x629e('0x2a')](_0x351dbe[_0x629e('0x2b')]('(')+0x1,_0x351dbe['lastIndexOf'](')'));_0x1d47f5['enduserId']=_0x2ff438;_0x39918d(_0x1d47f5);})[_0x629e('0x13')](function(_0x201237){_0x1f8938(_0x201237[_0x629e('0x2c')]);});});}function getEndUser(_0x393ea8,_0x18fcc8,_0x42c4b1,_0x1ac319,_0x769d5,_0x24f973){return new BPromise(function(_0x2e0af8,_0x2b3820){return getAuthToken(_0x18fcc8,_0x42c4b1,_0x24f973)['then'](function(_0x325a77){var _0x16343c={'method':_0x629e('0x17'),'uri':_0x1ac319+_0x629e('0x2d'),'headers':{'Authorization':_0x629e('0x18')+_0x325a77,'If-None-Match':null,'OData-Version':_0x629e('0x19')},'json':!![]};return rp(_0x16343c);})[_0x629e('0x11')](function(_0x3b911f){var _0x92e128=null;if(_0x3b911f){var _0x59ccf6=_0x3b911f[_0x629e('0x1a')];var _0x1ffc28=![];for(_0x92e128=0x0;_0x92e128<_0x59ccf6[_0x629e('0x1e')];_0x92e128++){var _0x24595b=_0x24f973['toLowerCase']()==='outbound'?_0x769d5[_0x629e('0x26')]:_0x769d5[_0x629e('0x27')];if(_0x59ccf6[_0x92e128][_0x629e('0x2e')]===_0x24595b){_0x1ffc28=!![];_0x393ea8[_0x629e('0x2f')]=_0x59ccf6[_0x92e128][_0x629e('0x30')];}}if(_0x1ffc28){_0x2e0af8(_0x393ea8);}else{return createEndUser(_0x393ea8,_0x18fcc8,_0x42c4b1,_0x1ac319,_0x769d5,_0x24f973)['then'](function(_0x291ac9){logger[_0x629e('0x1f')]('['+[_0x24f973['toUpperCase']()]+_0x629e('0x31'),_0x291ac9[_0x629e('0x2f')]);_0x2e0af8(_0x291ac9);});}}else{return createEndUser(_0x393ea8,_0x18fcc8,_0x42c4b1,_0x1ac319,_0x769d5,_0x24f973)[_0x629e('0x11')](function(_0x528bd2){logger[_0x629e('0x1f')]('['+[_0x24f973['toUpperCase']()]+']\x20Enduser\x20Created!',_0x528bd2[_0x629e('0x2f')]);_0x2e0af8(_0x528bd2);});}});});}function getCustomFields(_0x5cfadd,_0x4459b8,_0x5a6a0f){var _0x4deb2c={};if(_0x5cfadd[_0x629e('0x1e')]>0x0){_[_0x629e('0x32')](_0x5cfadd,function(_0x19028b){if(_0x19028b['type']===_0x629e('0x33')&&_0x19028b[_0x629e('0x34')]&&!_0x19028b[_0x629e('0x35')]){var _0x5e4ac7=_0x19028b[_0x629e('0x36')][_0x629e('0x24')]();var _0x3fa9f7=_0x5e4ac7['substring'](0x0,_0x5e4ac7[_0x629e('0x37')]('_'));var _0x361e2e=_0x5e4ac7[_0x629e('0x2a')](_0x5e4ac7[_0x629e('0x37')]('_')+0x1);if(_0x3fa9f7===_0x5a6a0f){_0x4deb2c[_0x361e2e]=_0x19028b[_0x629e('0x38')];}}});}return _0x4deb2c;}function getTicket(_0x1bd204,_0x5ca37f,_0x51e384,_0x1d0cad,_0x42f613,_0x46ccde,_0xdc917c){return new BPromise(function(_0x9993fc,_0x127159){var _0x9de547;return getAuthToken(_0x5ca37f,_0x51e384,_0xdc917c)['then'](function(_0x4fb5f5){if(_0x46ccde[_0x629e('0x39')]===_0x629e('0x3a')){_0x9de547={'method':_0x629e('0xb'),'uri':_0x1d0cad+_0x629e('0x3b'),'body':Object[_0x629e('0x3c')]({},{'title':intUtil[_0x629e('0x3d')](_0x46ccde[_0x629e('0x3e')],_0x42f613,'\x20'),'description':intUtil[_0x629e('0x3d')](_0x46ccde[_0x629e('0x3f')],_0x42f613,'\x0a'),'customerid_contact@odata.bind':_0x629e('0x40')+_0x1bd204[_0x629e('0x2f')]+')','ownerid@odata.bind':_0x629e('0x28')+_0x1bd204[_0x629e('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x46ccde[_0x629e('0x41')],_0x42f613,_0x46ccde[_0x629e('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x4fb5f5,'OData-Version':_0x629e('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x46ccde[_0x629e('0x39')]==='phonecall'){_0x9de547={'method':_0x629e('0xb'),'uri':_0x1d0cad+_0x629e('0x42'),'body':Object[_0x629e('0x3c')]({},{'subject':intUtil[_0x629e('0x3d')](_0x46ccde[_0x629e('0x3e')],_0x42f613,'\x20'),'phonenumber':String(_0x42f613[_0x629e('0x27')]),'description':intUtil['getString'](_0x46ccde['Descriptions'],_0x42f613,'\x0a'),'regardingobjectid_contact@odata.bind':_0x629e('0x40')+_0x1bd204[_0x629e('0x2f')]+')','ownerid@odata.bind':_0x629e('0x28')+_0x1bd204[_0x629e('0x21')]+')','directioncode':_0x1bd204[_0x629e('0x43')]===_0x629e('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x629e('0x28')+_0x1bd204[_0x629e('0x21')]+')','participationtypemask':_0x1bd204[_0x629e('0x43')]===_0x629e('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x629e('0x40')+_0x1bd204[_0x629e('0x2f')]+')','participationtypemask':_0x1bd204[_0x629e('0x43')]===_0x629e('0x44')?0x1:0x2}]},getCustomFields(_0x46ccde[_0x629e('0x41')],_0x42f613,_0x46ccde['ticketType'])),'headers':{'Authorization':_0x629e('0x18')+_0x4fb5f5,'OData-Version':_0x629e('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x9de547);})[_0x629e('0x11')](function(_0x3261c2){var _0x132736=_0x3261c2[_0x629e('0x45')][_0x629e('0x29')];var _0x22945e=_0x132736[_0x629e('0x2a')](_0x132736[_0x629e('0x2b')]('(')+0x1,_0x132736['lastIndexOf'](')'));_0x1bd204[_0x629e('0x46')]=_0x22945e;_0x9993fc(_0x1bd204);})[_0x629e('0x13')](function(_0xb94eab){_0x127159(_0xb94eab[_0x629e('0x2c')]);});});}function emit(_0x387647,_0x31801f,_0x269ace,_0x26a026){var _0x3321ec={'uri':util[_0x629e('0x47')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x387647,_0x269ace,_0x26a026)};io['to'](util['format'](_0x629e('0x48'),_0x31801f))[_0x629e('0x49')](_0x629e('0x4a'),_0x3321ec);}exports['cs']=function(_0x2fe5b9,_0x9e68e6,_0x4dc511,_0x229088,_0x16d2ca,_0x2fbcb7,_0x57c9e2,_0x13c100){var _0x5b6e37={};_0x2fbcb7[_0x629e('0xd')]=intUtil['stripTrailingSlash'](_0x2fbcb7['remoteUri']);_0x2fbcb7['serverUrl']=intUtil['stripTrailingSlash'](_0x2fbcb7[_0x629e('0x4b')]);_0x5b6e37[_0x629e('0x43')]=_0x13c100===_0x629e('0x44')||_0x13c100===_0x629e('0x4c')?_0x629e('0x44'):_0x629e('0x25');var _0x4ebd3b=util[_0x629e('0x47')](_0x629e('0x4d'),_0x2fbcb7[_0x629e('0xd')]);var _0x1a8cce=util[_0x629e('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2fbcb7[_0x629e('0x4e')]);var _0x26de69=util[_0x629e('0x47')](_0x629e('0x4f'),_0x2fbcb7['serverUrl'],_0x9e68e6[_0x629e('0x50')],md5(_0x9e68e6['uniqueid']));if(_0x16d2ca&&_0x16d2ca['monitor_format']){logger[_0x629e('0x1f')]('[QUEUE]',_0x629e('0x51'));_0x9e68e6[_0x629e('0x52')]=_0x26de69;}else if(_0x57c9e2&&_0x57c9e2[_0x629e('0x53')]&&_0x57c9e2[_0x629e('0x53')]!==_0x629e('0x54')){logger[_0x629e('0x1f')](_0x629e('0x55'),_0x629e('0x51'));_0x9e68e6[_0x629e('0x52')]=_0x26de69;}else{_0x9e68e6[_0x629e('0x52')]='';}return getUser(_0x5b6e37,_0x2fbcb7,_0x229088,_0x1a8cce,_0x4ebd3b,_0x13c100)['then'](function(_0x533972){logger['info']('['+_0x13c100[_0x629e('0x15')]()+_0x629e('0x56'),_0x533972['userId']);logger['info']('['+_0x13c100[_0x629e('0x15')]()+_0x629e('0x57'),_0x533972[_0x629e('0x1d')]);return getEndUser(_0x533972,_0x2fbcb7,_0x1a8cce,_0x4ebd3b,_0x9e68e6,_0x13c100);})[_0x629e('0x11')](function(_0x5701e4){logger['info']('['+_0x13c100[_0x629e('0x15')]()+_0x629e('0x58'),_0x5701e4[_0x629e('0x2f')]);logger[_0x629e('0x1f')]('['+_0x13c100[_0x629e('0x15')]()+_0x629e('0x59'),_0x9e68e6[_0x629e('0x27')]);return getTicket(_0x5701e4,_0x2fbcb7,_0x1a8cce,_0x4ebd3b,_0x9e68e6,_0x4dc511,_0x13c100);})[_0x629e('0x11')](function(_0x3507ee){logger['info'](util[_0x629e('0x47')]('['+_0x13c100[_0x629e('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4dc511['ticketType'],_0x3507ee[_0x629e('0x46')]));logger[_0x629e('0x1f')](util['format']('['+_0x13c100[_0x629e('0x15')]()+_0x629e('0x5a'),_0x13c100));if(_0x13c100!==_0x629e('0x4c')){logger['info']('['+_0x13c100[_0x629e('0x15')]()+']',_0x629e('0x5b'));emit(_0x2fbcb7['remoteUri'],_0x229088[_0x629e('0x5c')],_0x4dc511[_0x629e('0x39')],_0x3507ee[_0x629e('0x46')]);}})[_0x629e('0x13')](function(_0x28eaa9){logger[_0x629e('0x14')]('['+_0x13c100[_0x629e('0x15')]()+_0x629e('0x5d'),util[_0x629e('0x5e')](_0x28eaa9,{'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 1cba9bd..3bbaa4e 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 _0x908e=['validateEmail','length','Agent\x20found!','find','contact','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','base64','debug','stringify','defaults','map','customField','nameField','toLowerCase','content','toString','type','string','idField','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','abandoned','[ABANDONED]','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','mapValues','keyBy','remoteUri','POST','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x908e,0x98));var _0xe908=function(_0x3fab58,_0x3b8fad){_0x3fab58=_0x3fab58-0x0;var _0x401852=_0x908e[_0x3fab58];return _0x401852;};'use strict';var _=require(_0xe908('0x0'));var rp=require('request-promise');var md5=require(_0xe908('0x1'));var util=require(_0xe908('0x2'));var Redis=require(_0xe908('0x3'));var intUtil=require(_0xe908('0x4'));var config=require(_0xe908('0x5'));var logger=require(_0xe908('0x6'))(_0xe908('0x7'));config[_0xe908('0x8')]=_['defaults'](config['redis'],{'host':_0xe908('0x9'),'port':0x18eb});var io=require(_0xe908('0xa'))(new Redis(config[_0xe908('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xe908('0xb')};function emit(_0x361df7,_0x36efbd,_0x34793f){io['to'](_0x361df7)[_0xe908('0xc')](_0x36efbd,_0x34793f);}function getTicket(_0x2c89b1,_0x593a84,_0x3c42fd,_0x47c2b2,_0x2bed67){logger['info'](_0xe908('0xd'));var _0x404b2f=_[_0xe908('0xe')]({'responder_id':_0x593a84['id'],'requester_id':_0x3c42fd['id'],'name':util[_0xe908('0xf')](_0xe908('0x10'),_0x2bed67[_0xe908('0x11')]),'phone':_0x2bed67[_0xe908('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe908('0x13')](_0x47c2b2[_0xe908('0x14')],_0x2bed67,'\x20'),'description':intUtil['getString'](_0x47c2b2[_0xe908('0x15')],_0x2bed67,'
'),'tags':getTags(_0x47c2b2[_0xe908('0x16')],_0xe908('0x17'))},getCustomFields(_0x47c2b2[_0xe908('0x18')],_0x2bed67));_0x404b2f['custom_fields']=_[_0xe908('0x19')](_[_0xe908('0x1a')](_0x404b2f['custom_fields'],'id'),'value');return request({'uri':util[_0xe908('0xf')]('%s/api/v2/tickets',_0x2c89b1[_0xe908('0x1b')]),'method':_0xe908('0x1c'),'body':_0x404b2f})[_0xe908('0x1d')](function(_0x5efb05){logger['info']('Ticket\x20created!');return _0x5efb05;});}function getUser(_0x5435dc,_0x5ed329){if(intUtil[_0xe908('0x1e')](_0x5ed329)){return request({'uri':util[_0xe908('0xf')]('%s/api/v2/agents',_0x5435dc[_0xe908('0x1b')]),'qs':{'email':_0x5ed329}})[_0xe908('0x1d')](function(_0x3d1b0d){if(_0x3d1b0d[_0xe908('0x1f')]){logger['info'](_0xe908('0x20'));return _[_0xe908('0x21')](_0x3d1b0d,function(_0x4ab3cd){return _0x4ab3cd[_0xe908('0x22')]['email']===_0x5ed329;});}else{logger[_0xe908('0x23')](_0xe908('0x24'));return request({'uri':util[_0xe908('0xf')]('%s/api/v2/agents/me',_0x5435dc[_0xe908('0x1b')])})[_0xe908('0x1d')](function(_0x34b285){logger['info'](_0xe908('0x25'));return _0x34b285;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x5435dc[_0xe908('0x1b')])})[_0xe908('0x1d')](function(_0x42c9bb){logger['info'](_0xe908('0x25'));return _0x42c9bb;});}}function getEndUser(_0x52f6fe,_0x2fc192,_0x12c28a){logger[_0xe908('0x23')](_0xe908('0x26'),_0x12c28a);return request({'uri':util[_0xe908('0xf')]('%s/api/v2/contacts',_0x52f6fe[_0xe908('0x1b')]),'qs':{'phone':_0x12c28a}})['then'](function(_0x184f86){if(_0x184f86[_0xe908('0x1f')]){logger[_0xe908('0x23')](_0xe908('0x27'));return _[_0xe908('0x21')](_0x184f86,{'phone':_0x12c28a});}else{logger[_0xe908('0x23')](_0xe908('0x28'));return request({'uri':util[_0xe908('0xf')](_0xe908('0x29'),_0x52f6fe[_0xe908('0x1b')]),'method':_0xe908('0x1c'),'body':{'name':_0x2fc192,'phone':_0x12c28a}})[_0xe908('0x1d')](function(_0x9a7a0e){logger[_0xe908('0x23')]('Enduser\x20created.');return _0x9a7a0e;});}});}function getAuth(_0x5156f4){return util['format'](_0xe908('0x2a'),new Buffer(_0x5156f4[_0xe908('0x2b')]+':X')['toString'](_0xe908('0x2c')));}function request(_0x465f18){logger[_0xe908('0x2d')]('[HTTP]',JSON[_0xe908('0x2e')](_0x465f18));return rp(_[_0xe908('0x2f')](_0x465f18,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5ca356,_0x11eff3){var _0xafe195=[];if(_0x5ca356&&_0x5ca356[_0xe908('0x1f')]>0x0){_0xafe195=_[_0xe908('0x30')](_0x5ca356,_0x11eff3);}return _0xafe195;}function getCustomFields(_0x1183c2,_0x4db463){var _0x4e93b1=[];var _0x5cca7e={'custom_fields':[]};if(_0x1183c2['length']>0x0){_['forEach'](_0x1183c2,function(_0x7558d0){if(_0x7558d0['type']==='string'&&_0x7558d0['nameField']&&!_0x7558d0[_0xe908('0x31')]){_0x5cca7e[_0x7558d0[_0xe908('0x32')][_0xe908('0x33')]()]=_0x7558d0[_0xe908('0x34')][_0xe908('0x35')]();}else if(_0x7558d0[_0xe908('0x36')]===_0xe908('0x37')&&_0x7558d0[_0xe908('0x38')]&&_0x7558d0['customField']){_0x5cca7e[_0xe908('0x39')][_0xe908('0x3a')]({'id':_0x7558d0[_0xe908('0x38')],'value':_0x7558d0['content'][_0xe908('0x35')]()});}else if(_0x7558d0['type']==='variable'&&_0x7558d0[_0xe908('0x3b')]&&_0x7558d0[_0xe908('0x38')]&&_0x7558d0[_0xe908('0x31')]){_0x4db463[_0x7558d0[_0xe908('0x3b')]]&&_0x5cca7e[_0xe908('0x39')][_0xe908('0x3a')]({'id':_0x7558d0[_0xe908('0x38')],'value':_0x4db463[_0x7558d0[_0xe908('0x3b')]][_0xe908('0x35')]()});}else if(_0x7558d0[_0xe908('0x36')]===_0xe908('0x3c')&&_0x7558d0[_0xe908('0x3d')]&&_0x7558d0[_0xe908('0x3d')][_0xe908('0x17')]&&_0x7558d0[_0xe908('0x38')]&&_0x7558d0[_0xe908('0x31')]){_0x4db463[_0x7558d0[_0xe908('0x3d')][_0xe908('0x17')]['toLowerCase']()]&&_0x5cca7e['custom_fields'][_0xe908('0x3a')]({'id':_0x7558d0[_0xe908('0x38')],'value':_0x4db463[_0x7558d0[_0xe908('0x3d')][_0xe908('0x17')][_0xe908('0x33')]()]['toString']()});}});}return _0x5cca7e;}exports[_0xe908('0x3e')]=function(_0x5c33c1,_0x49ad45,_0x4cd509,_0x5c8263,_0x37ed2a,_0x4c0063){var _0x236a2e,_0x53aea8;_0x4c0063[_0xe908('0x1b')]=intUtil[_0xe908('0x3f')](_0x4c0063[_0xe908('0x1b')]);_0x4c0063[_0xe908('0x40')]=intUtil[_0xe908('0x3f')](_0x4c0063[_0xe908('0x40')]);if(_0x37ed2a&&_0x37ed2a[_0xe908('0x41')]){logger[_0xe908('0x23')](_0xe908('0x42'),_0xe908('0x43'));_0x49ad45[_0xe908('0x44')]=util[_0xe908('0xf')](_0xe908('0x45'),_0x4c0063[_0xe908('0x40')],_0x49ad45['uniqueid'],md5(_0x49ad45[_0xe908('0x46')]));}else{_0x49ad45['recordingURL']='';}headers[_0xe908('0x47')]=getAuth(_0x4c0063);return getUser(_0x4c0063,_0x5c8263[_0xe908('0x48')])[_0xe908('0x1d')](function(_0x1e90dc){_0x236a2e=_0x1e90dc;logger[_0xe908('0x23')](_0xe908('0x49'),_0x236a2e['id']);return getEndUser(_0x4c0063,_0x49ad45['calleridname'],_0x49ad45['calleridnum']);})[_0xe908('0x1d')](function(_0x442b7b){_0x53aea8=_0x442b7b;logger[_0xe908('0x23')]('The\x20Enduser\x20ID\x20is:',_0x53aea8['id']);return getTicket(_0x4c0063,_0x236a2e,_0x53aea8,_0x4cd509,_0x49ad45);})[_0xe908('0x1d')](function(_0x418599){if(_0x418599&&_0x418599['id']){logger[_0xe908('0x23')](_0xe908('0x4a'));logger[_0xe908('0x23')](_0xe908('0x4b'),_0x418599['id']);logger[_0xe908('0x23')](_0xe908('0x42'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe908('0x4c'),_0x5c8263[_0xe908('0x17')]),'trigger:browser:url',{'uri':util[_0xe908('0xf')](_0xe908('0x4d'),_0x4c0063['remoteUri'],_0x418599['id'])});}})[_0xe908('0x4e')](function(_0x428f37){logger[_0xe908('0x4f')](_0xe908('0x42'),JSON[_0xe908('0x2e')](_0x428f37));});};exports[_0xe908('0x50')]=function(_0x46b269,_0xf7b032,_0x1c08ae,_0x39172d,_0x2d5c21,_0x59f46e,_0x2b28b1){var _0x4d01ac,_0x3862ce;_0x59f46e[_0xe908('0x1b')]=intUtil['stripTrailingSlash'](_0x59f46e[_0xe908('0x1b')]);_0x59f46e[_0xe908('0x40')]=intUtil[_0xe908('0x3f')](_0x59f46e[_0xe908('0x40')]);if(_0x2b28b1&&_0x2b28b1['recordingFormat']&&_0x2b28b1[_0xe908('0x51')]!==_0xe908('0x52')){logger[_0xe908('0x23')](_0xe908('0x53'),_0xe908('0x43'));_0xf7b032['recordingURL']=util[_0xe908('0xf')](_0xe908('0x45'),_0x59f46e[_0xe908('0x40')],_0xf7b032[_0xe908('0x46')],md5(_0xf7b032[_0xe908('0x46')]));}headers['Authorization']=getAuth(_0x59f46e);return getUser(_0x59f46e,_0x39172d[_0xe908('0x48')])[_0xe908('0x1d')](function(_0x5dcc61){_0x4d01ac=_0x5dcc61;logger[_0xe908('0x23')](_0xe908('0x49'),_0x4d01ac['id']);return getEndUser(_0x59f46e,_0xf7b032[_0xe908('0x54')],_0xf7b032[_0xe908('0x55')]);})[_0xe908('0x1d')](function(_0x3de1ab){_0x3862ce=_0x3de1ab;logger[_0xe908('0x23')](_0xe908('0x56'),_0x3862ce['id']);return getTicket(_0x59f46e,_0x4d01ac,_0x3862ce,_0x1c08ae,_0xf7b032);})[_0xe908('0x1d')](function(_0x2b2fba){if(_0x2b2fba&&_0x2b2fba['id']){logger[_0xe908('0x23')]('Ticket\x20created!');logger[_0xe908('0x23')]('The\x20Ticket\x20ID\x20is:',_0x2b2fba['id']);logger[_0xe908('0x23')]('[OUTBOUND]',_0xe908('0x57'));emit(util[_0xe908('0xf')](_0xe908('0x4c'),_0x39172d[_0xe908('0x17')]),_0xe908('0x58'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x59f46e[_0xe908('0x1b')],_0x2b2fba['id'])});}})[_0xe908('0x4e')](function(_0x236c8d){logger[_0xe908('0x4f')](_0xe908('0x53'),JSON[_0xe908('0x2e')](_0x236c8d));});};exports[_0xe908('0x59')]=function(_0x5195fb,_0x212390,_0x236da4,_0x4d6ffa,_0x1826dd,_0x5778c0){var _0x582778,_0x549c6f;_0x5778c0[_0xe908('0x1b')]=intUtil[_0xe908('0x3f')](_0x5778c0['remoteUri']);_0x5778c0['serverUrl']=intUtil['stripTrailingSlash'](_0x5778c0[_0xe908('0x40')]);if(_0x1826dd&&_0x1826dd[_0xe908('0x41')]){logger[_0xe908('0x23')]('[ABANDONED]',_0xe908('0x43'));_0x212390[_0xe908('0x44')]=util[_0xe908('0xf')](_0xe908('0x45'),_0x5778c0['serverUrl'],_0x212390[_0xe908('0x46')],md5(_0x212390[_0xe908('0x46')]));}else{_0x212390[_0xe908('0x44')]='';}headers[_0xe908('0x47')]=getAuth(_0x5778c0);return getUser(_0x5778c0,'')['then'](function(_0x4a223b){_0x582778=_0x4a223b;logger[_0xe908('0x23')](_0xe908('0x49'),_0x582778['id']);return getEndUser(_0x5778c0,_0x212390[_0xe908('0x11')],_0x212390['calleridnum']);})[_0xe908('0x1d')](function(_0x24788f){_0x549c6f=_0x24788f;logger[_0xe908('0x23')](_0xe908('0x56'),_0x549c6f['id']);return getTicket(_0x5778c0,_0x582778,_0x549c6f,_0x236da4,_0x212390);})['then'](function(_0x123dd4){if(_0x123dd4){logger['info'](_0xe908('0x4a'));logger[_0xe908('0x23')]('The\x20Ticket\x20ID\x20is:',_0x123dd4['id']);}})[_0xe908('0x4e')](function(_0xdead64){logger[_0xe908('0x4f')](_0xe908('0x5a'),JSON[_0xe908('0x2e')](_0xdead64));});}; \ No newline at end of file +var _0x45b9=['application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Basic\x20%s','toString','base64','debug','stringify','defaults','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','variable','variableName','push','customVariable','Variable','name','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','abandoned','[ABANDONED]','The\x20Ticket\x20ID\x20is:','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost'];(function(_0x2937ef,_0x3277ff){var _0x5c7a47=function(_0x491fd7){while(--_0x491fd7){_0x2937ef['push'](_0x2937ef['shift']());}};_0x5c7a47(++_0x3277ff);}(_0x45b9,0x1ae));var _0x945b=function(_0x3a3b2e,_0x1c153d){_0x3a3b2e=_0x3a3b2e-0x0;var _0x435765=_0x45b9[_0x3a3b2e];return _0x435765;};'use strict';var _=require(_0x945b('0x0'));var rp=require(_0x945b('0x1'));var md5=require(_0x945b('0x2'));var util=require(_0x945b('0x3'));var Redis=require('ioredis');var intUtil=require(_0x945b('0x4'));var config=require(_0x945b('0x5'));var logger=require(_0x945b('0x6'))(_0x945b('0x7'));config['redis']=_['defaults'](config[_0x945b('0x8')],{'host':_0x945b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x945b('0xa')};function emit(_0x3dad82,_0x5e4c50,_0x135924){io['to'](_0x3dad82)[_0x945b('0xb')](_0x5e4c50,_0x135924);}function getTicket(_0x444334,_0x2d2b34,_0x283a93,_0xa245e7,_0x954dab){logger['info'](_0x945b('0xc'));var _0x443190=_['merge']({'responder_id':_0x2d2b34['id'],'requester_id':_0x283a93['id'],'name':util[_0x945b('0xd')](_0x945b('0xe'),_0x954dab[_0x945b('0xf')]),'phone':_0x954dab[_0x945b('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xa245e7['Subjects'],_0x954dab,'\x20'),'description':intUtil[_0x945b('0x11')](_0xa245e7[_0x945b('0x12')],_0x954dab,_0x945b('0x13')),'tags':getTags(_0xa245e7[_0x945b('0x14')],'name')},getCustomFields(_0xa245e7[_0x945b('0x15')],_0x954dab));_0x443190[_0x945b('0x16')]=_['mapValues'](_[_0x945b('0x17')](_0x443190[_0x945b('0x16')],'id'),_0x945b('0x18'));return request({'uri':util[_0x945b('0xd')](_0x945b('0x19'),_0x444334[_0x945b('0x1a')]),'method':_0x945b('0x1b'),'body':_0x443190})['then'](function(_0x5f1093){logger[_0x945b('0x1c')](_0x945b('0x1d'));return _0x5f1093;});}function getUser(_0x284336,_0x55fdcf){if(intUtil[_0x945b('0x1e')](_0x55fdcf)){return request({'uri':util[_0x945b('0xd')](_0x945b('0x1f'),_0x284336['remoteUri']),'qs':{'email':_0x55fdcf}})['then'](function(_0x80d993){if(_0x80d993[_0x945b('0x20')]){logger['info'](_0x945b('0x21'));return _[_0x945b('0x22')](_0x80d993,function(_0x577114){return _0x577114[_0x945b('0x23')]['email']===_0x55fdcf;});}else{logger[_0x945b('0x1c')](_0x945b('0x24'));return request({'uri':util['format'](_0x945b('0x25'),_0x284336[_0x945b('0x1a')])})[_0x945b('0x26')](function(_0x3e3d26){logger[_0x945b('0x1c')](_0x945b('0x27'));return _0x3e3d26;});}});}else{logger[_0x945b('0x1c')](_0x945b('0x28'));return request({'uri':util[_0x945b('0xd')]('%s/api/v2/agents/me',_0x284336[_0x945b('0x1a')])})[_0x945b('0x26')](function(_0x14fabf){logger[_0x945b('0x1c')](_0x945b('0x27'));return _0x14fabf;});}}function getEndUser(_0x31b11d,_0x2ff2a2,_0x4276b8){logger[_0x945b('0x1c')](_0x945b('0x29'),_0x4276b8);return request({'uri':util[_0x945b('0xd')](_0x945b('0x2a'),_0x31b11d['remoteUri']),'qs':{'phone':_0x4276b8}})[_0x945b('0x26')](function(_0x55f0ec){if(_0x55f0ec[_0x945b('0x20')]){logger['info']('Enduser\x20found!');return _[_0x945b('0x22')](_0x55f0ec,{'phone':_0x4276b8});}else{logger[_0x945b('0x1c')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x31b11d['remoteUri']),'method':_0x945b('0x1b'),'body':{'name':_0x2ff2a2,'phone':_0x4276b8}})[_0x945b('0x26')](function(_0x3840cc){logger[_0x945b('0x1c')]('Enduser\x20created.');return _0x3840cc;});}});}function getAuth(_0x1e64b2){return util[_0x945b('0xd')](_0x945b('0x2b'),new Buffer(_0x1e64b2['apiKey']+':X')[_0x945b('0x2c')](_0x945b('0x2d')));}function request(_0x305169){logger[_0x945b('0x2e')]('[HTTP]',JSON[_0x945b('0x2f')](_0x305169));return rp(_[_0x945b('0x30')](_0x305169,{'method':_0x945b('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1d0c54,_0x27f868){var _0x761cd6=[];if(_0x1d0c54&&_0x1d0c54['length']>0x0){_0x761cd6=_[_0x945b('0x32')](_0x1d0c54,_0x27f868);}return _0x761cd6;}function getCustomFields(_0x35bd16,_0x55b7f3){var _0xa729e8=[];var _0xf6b6f={'custom_fields':[]};if(_0x35bd16[_0x945b('0x20')]>0x0){_[_0x945b('0x33')](_0x35bd16,function(_0x37ff41){if(_0x37ff41[_0x945b('0x34')]===_0x945b('0x35')&&_0x37ff41[_0x945b('0x36')]&&!_0x37ff41[_0x945b('0x37')]){_0xf6b6f[_0x37ff41['nameField'][_0x945b('0x38')]()]=_0x37ff41[_0x945b('0x39')][_0x945b('0x2c')]();}else if(_0x37ff41[_0x945b('0x34')]===_0x945b('0x35')&&_0x37ff41[_0x945b('0x3a')]&&_0x37ff41[_0x945b('0x37')]){_0xf6b6f[_0x945b('0x16')]['push']({'id':_0x37ff41[_0x945b('0x3a')],'value':_0x37ff41[_0x945b('0x39')]['toString']()});}else if(_0x37ff41[_0x945b('0x34')]===_0x945b('0x3b')&&_0x37ff41[_0x945b('0x3c')]&&_0x37ff41[_0x945b('0x3a')]&&_0x37ff41[_0x945b('0x37')]){_0x55b7f3[_0x37ff41[_0x945b('0x3c')]]&&_0xf6b6f[_0x945b('0x16')][_0x945b('0x3d')]({'id':_0x37ff41['idField'],'value':_0x55b7f3[_0x37ff41[_0x945b('0x3c')]][_0x945b('0x2c')]()});}else if(_0x37ff41[_0x945b('0x34')]===_0x945b('0x3e')&&_0x37ff41[_0x945b('0x3f')]&&_0x37ff41[_0x945b('0x3f')][_0x945b('0x40')]&&_0x37ff41[_0x945b('0x3a')]&&_0x37ff41[_0x945b('0x37')]){_0x55b7f3[_0x37ff41[_0x945b('0x3f')][_0x945b('0x40')][_0x945b('0x38')]()]&&_0xf6b6f[_0x945b('0x16')][_0x945b('0x3d')]({'id':_0x37ff41[_0x945b('0x3a')],'value':_0x55b7f3[_0x37ff41[_0x945b('0x3f')][_0x945b('0x40')]['toLowerCase']()][_0x945b('0x2c')]()});}});}return _0xf6b6f;}exports[_0x945b('0x41')]=function(_0x584a63,_0x3f7974,_0x50b607,_0x2a3e40,_0x1fd5c8,_0x305dfd){var _0xf93f6e,_0x42bf39;_0x305dfd[_0x945b('0x1a')]=intUtil['stripTrailingSlash'](_0x305dfd[_0x945b('0x1a')]);_0x305dfd[_0x945b('0x42')]=intUtil['stripTrailingSlash'](_0x305dfd['serverUrl']);if(_0x1fd5c8&&_0x1fd5c8['monitor_format']){logger[_0x945b('0x1c')](_0x945b('0x43'),_0x945b('0x44'));_0x3f7974['recordingURL']=util[_0x945b('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x305dfd[_0x945b('0x42')],_0x3f7974[_0x945b('0x45')],md5(_0x3f7974['uniqueid']));}else{_0x3f7974[_0x945b('0x46')]='';}headers['Authorization']=getAuth(_0x305dfd);return getUser(_0x305dfd,_0x2a3e40[_0x945b('0x47')])['then'](function(_0x567081){_0xf93f6e=_0x567081;logger['info']('The\x20User\x20ID\x20is:',_0xf93f6e['id']);return getEndUser(_0x305dfd,_0x3f7974[_0x945b('0xf')],_0x3f7974[_0x945b('0x10')]);})['then'](function(_0x48cdfb){_0x42bf39=_0x48cdfb;logger['info']('The\x20Enduser\x20ID\x20is:',_0x42bf39['id']);return getTicket(_0x305dfd,_0xf93f6e,_0x42bf39,_0x50b607,_0x3f7974);})[_0x945b('0x26')](function(_0x511d4a){if(_0x511d4a&&_0x511d4a['id']){logger[_0x945b('0x1c')](_0x945b('0x1d'));logger[_0x945b('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x511d4a['id']);logger[_0x945b('0x1c')](_0x945b('0x43'),_0x945b('0x48'));emit(util[_0x945b('0xd')](_0x945b('0x49'),_0x2a3e40[_0x945b('0x40')]),_0x945b('0x4a'),{'uri':util[_0x945b('0xd')](_0x945b('0x4b'),_0x305dfd['remoteUri'],_0x511d4a['id'])});}})[_0x945b('0x4c')](function(_0x29c052){logger[_0x945b('0x4d')](_0x945b('0x43'),JSON[_0x945b('0x2f')](_0x29c052));});};exports['outbound']=function(_0x4bf0bd,_0x500af2,_0x1ad539,_0x365493,_0x28cd19,_0x23dc5e,_0x232114){var _0x15e715,_0x54d41e;_0x23dc5e['remoteUri']=intUtil['stripTrailingSlash'](_0x23dc5e['remoteUri']);_0x23dc5e[_0x945b('0x42')]=intUtil['stripTrailingSlash'](_0x23dc5e[_0x945b('0x42')]);if(_0x232114&&_0x232114['recordingFormat']&&_0x232114[_0x945b('0x4e')]!==_0x945b('0x4f')){logger[_0x945b('0x1c')]('[OUTBOUND]',_0x945b('0x44'));_0x500af2[_0x945b('0x46')]=util[_0x945b('0xd')](_0x945b('0x50'),_0x23dc5e[_0x945b('0x42')],_0x500af2['uniqueid'],md5(_0x500af2[_0x945b('0x45')]));}headers[_0x945b('0x51')]=getAuth(_0x23dc5e);return getUser(_0x23dc5e,_0x365493[_0x945b('0x47')])['then'](function(_0x5196e8){_0x15e715=_0x5196e8;logger[_0x945b('0x1c')]('The\x20User\x20ID\x20is:',_0x15e715['id']);return getEndUser(_0x23dc5e,_0x500af2[_0x945b('0x52')],_0x500af2['destcalleridnum']);})[_0x945b('0x26')](function(_0x20caed){_0x54d41e=_0x20caed;logger['info'](_0x945b('0x53'),_0x54d41e['id']);return getTicket(_0x23dc5e,_0x15e715,_0x54d41e,_0x1ad539,_0x500af2);})[_0x945b('0x26')](function(_0x20f746){if(_0x20f746&&_0x20f746['id']){logger[_0x945b('0x1c')]('Ticket\x20created!');logger[_0x945b('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x20f746['id']);logger[_0x945b('0x1c')](_0x945b('0x54'),_0x945b('0x48'));emit(util[_0x945b('0xd')](_0x945b('0x49'),_0x365493[_0x945b('0x40')]),_0x945b('0x4a'),{'uri':util[_0x945b('0xd')](_0x945b('0x4b'),_0x23dc5e['remoteUri'],_0x20f746['id'])});}})['catch'](function(_0x3bd570){logger[_0x945b('0x4d')]('[OUTBOUND]',JSON[_0x945b('0x2f')](_0x3bd570));});};exports[_0x945b('0x55')]=function(_0x6b09fe,_0x55bb3d,_0x1e1620,_0x4caa0f,_0x4a8f21,_0x797c91){var _0x655183,_0x403d46;_0x797c91['remoteUri']=intUtil['stripTrailingSlash'](_0x797c91[_0x945b('0x1a')]);_0x797c91['serverUrl']=intUtil['stripTrailingSlash'](_0x797c91[_0x945b('0x42')]);if(_0x4a8f21&&_0x4a8f21['monitor_format']){logger['info'](_0x945b('0x56'),_0x945b('0x44'));_0x55bb3d['recordingURL']=util[_0x945b('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x797c91[_0x945b('0x42')],_0x55bb3d['uniqueid'],md5(_0x55bb3d[_0x945b('0x45')]));}else{_0x55bb3d['recordingURL']='';}headers[_0x945b('0x51')]=getAuth(_0x797c91);return getUser(_0x797c91,'')[_0x945b('0x26')](function(_0x5ceed7){_0x655183=_0x5ceed7;logger[_0x945b('0x1c')]('The\x20User\x20ID\x20is:',_0x655183['id']);return getEndUser(_0x797c91,_0x55bb3d[_0x945b('0xf')],_0x55bb3d[_0x945b('0x10')]);})['then'](function(_0x1d8fca){_0x403d46=_0x1d8fca;logger[_0x945b('0x1c')](_0x945b('0x53'),_0x403d46['id']);return getTicket(_0x797c91,_0x655183,_0x403d46,_0x1e1620,_0x55bb3d);})[_0x945b('0x26')](function(_0x2c05ad){if(_0x2c05ad){logger[_0x945b('0x1c')]('Ticket\x20created!');logger[_0x945b('0x1c')](_0x945b('0x57'),_0x2c05ad['id']);}})[_0x945b('0x4c')](function(_0x3e9e00){logger[_0x945b('0x4d')]('[ABANDONED]',JSON[_0x945b('0x2f')](_0x3e9e00));});}; \ 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 ae55b7a..6ec032d 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 _0x2596=['outbound','log','abandoned','freshdesk','zoho','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./sugarcrm','./desk','./dynamics365','zendesk','salesforce','sugarcrm','desk','vtiger','servicenow','dynamics365','exec','data1','toLowerCase','find','Configurations','queue'];(function(_0x198044,_0x3fdac4){var _0x47399b=function(_0x2a093b){while(--_0x2a093b){_0x198044['push'](_0x198044['shift']());}};_0x47399b(++_0x3fdac4);}(_0x2596,0x1cd));var _0x6259=function(_0x599daf,_0x141f1b){_0x599daf=_0x599daf-0x0;var _0x4c3521=_0x2596[_0x599daf];return _0x4c3521;};'use strict';var _=require(_0x6259('0x0'));var util=require('util');var zendesk=require(_0x6259('0x1'));var salesforce=require(_0x6259('0x2'));var sugarcrm=require(_0x6259('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x6259('0x4'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x6259('0x5'));var integrations=[_0x6259('0x6'),_0x6259('0x7'),_0x6259('0x8'),'freshdesk','zoho',_0x6259('0x9'),_0x6259('0xa'),_0x6259('0xb'),_0x6259('0xc')];exports[_0x6259('0xd')]=function(_0x39f0d8,_0x3fd027,_0x419a4a,_0x323d76,_0x2b1bcb,_0xcd70d6){if(_0x419a4a){if(_['includes'](integrations,_0x39f0d8[_0x6259('0xe')][_0x6259('0xf')]())){try{var _0x21ca49=null;var _0x4b08e1='';var _0x27f081=_0x419a4a[_0x39f0d8['data1'][_0x6259('0xf')]()];if(_0x27f081){var _0x592a66=_0x27f081[_0x39f0d8['data2']];if(_0x592a66){var _0x2154a6=_[_0x6259('0x10')](_0x592a66[_0x6259('0x11')],{'id':parseInt(_0x39f0d8['data3'],0xa)});if(_0x2154a6){if(_0x323d76){if(_0x2b1bcb&&_0x3fd027[_0x6259('0x12')]){_0x4b08e1=_0x6259('0x12');}else if(_0x3fd027['routeId']){_0x4b08e1=_0x6259('0x13');}else{console[_0x6259('0x14')]('EVENT\x20UNKNOWN',_0x3fd027);}}else{_0x4b08e1=_0x6259('0x15');}switch(_0x39f0d8[_0x6259('0xe')][_0x6259('0xf')]()){case _0x6259('0x6'):zendesk[_0x4b08e1](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6);break;case _0x6259('0x7'):salesforce[_0x4b08e1](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6);break;case _0x6259('0x8'):sugarcrm[_0x4b08e1](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6);break;case _0x6259('0x16'):freshdesk[_0x4b08e1](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6);break;case _0x6259('0x17'):zoho[_0x4b08e1](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6);break;case'desk':desk[_0x4b08e1](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6);break;case _0x6259('0xa'):vtiger[_0x4b08e1](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6);break;case _0x6259('0xb'):servicenow['cs'](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6,_0x4b08e1);break;case _0x6259('0xc'):dynamics365['cs'](_0x39f0d8,_0x3fd027,_0x2154a6,_0x323d76,_0x2b1bcb,_0x592a66,_0xcd70d6,_0x4b08e1);break;default:console[_0x6259('0x14')](_0x6259('0x18'));}}else{_0x21ca49=require('../../../../config/logger')(_0x39f0d8[_0x6259('0xe')][_0x6259('0xf')]());_0x21ca49[_0x6259('0x19')](_0x6259('0x1a'),util[_0x6259('0x1b')](_0x6259('0x1c'),_0x39f0d8[_0x6259('0xe')][_0x6259('0xf')](),_0x39f0d8['data3']));}}else{_0x21ca49=require(_0x6259('0x1d'))(_0x39f0d8[_0x6259('0xe')][_0x6259('0xf')]());_0x21ca49[_0x6259('0x19')](_0x6259('0x1a'),util['format'](_0x6259('0x1e'),_0x39f0d8[_0x6259('0xe')][_0x6259('0xf')](),_0x39f0d8[_0x6259('0x1f')]));}}else{}}catch(_0xea4ef5){console['error'](_0xea4ef5);}}}}; \ No newline at end of file +var _0x9f16=['../../../../config/logger','error','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','sugarcrm','freshdesk','desk','servicenow','exec','includes','data1','toLowerCase','data2','data3','queue','routeId','log','EVENT\x20UNKNOWN','zendesk','salesforce','dynamics365','format'];(function(_0x1654eb,_0x1a5291){var _0x26aa49=function(_0x38fc28){while(--_0x38fc28){_0x1654eb['push'](_0x1654eb['shift']());}};_0x26aa49(++_0x1a5291);}(_0x9f16,0x1b4));var _0x69f1=function(_0x20c2f4,_0x470117){_0x20c2f4=_0x20c2f4-0x0;var _0x2c4823=_0x9f16[_0x20c2f4];return _0x2c4823;};'use strict';var _=require(_0x69f1('0x0'));var util=require(_0x69f1('0x1'));var zendesk=require(_0x69f1('0x2'));var salesforce=require(_0x69f1('0x3'));var sugarcrm=require(_0x69f1('0x4'));var freshdesk=require(_0x69f1('0x5'));var zoho=require(_0x69f1('0x6'));var desk=require(_0x69f1('0x7'));var vtiger=require(_0x69f1('0x8'));var servicenow=require(_0x69f1('0x9'));var dynamics365=require(_0x69f1('0xa'));var integrations=['zendesk','salesforce',_0x69f1('0xb'),_0x69f1('0xc'),'zoho',_0x69f1('0xd'),'vtiger',_0x69f1('0xe'),'dynamics365'];exports[_0x69f1('0xf')]=function(_0x8182d1,_0x1c55c9,_0x44a3e7,_0x56f533,_0x5d9332,_0x4e15c7){if(_0x44a3e7){if(_[_0x69f1('0x10')](integrations,_0x8182d1[_0x69f1('0x11')][_0x69f1('0x12')]())){try{var _0x2ede22=null;var _0x3fbe90='';var _0x4f327f=_0x44a3e7[_0x8182d1[_0x69f1('0x11')][_0x69f1('0x12')]()];if(_0x4f327f){var _0x3b0eca=_0x4f327f[_0x8182d1[_0x69f1('0x13')]];if(_0x3b0eca){var _0x3aecb6=_['find'](_0x3b0eca['Configurations'],{'id':parseInt(_0x8182d1[_0x69f1('0x14')],0xa)});if(_0x3aecb6){if(_0x56f533){if(_0x5d9332&&_0x1c55c9[_0x69f1('0x15')]){_0x3fbe90=_0x69f1('0x15');}else if(_0x1c55c9[_0x69f1('0x16')]){_0x3fbe90='outbound';}else{console[_0x69f1('0x17')](_0x69f1('0x18'),_0x1c55c9);}}else{_0x3fbe90='abandoned';}switch(_0x8182d1[_0x69f1('0x11')][_0x69f1('0x12')]()){case _0x69f1('0x19'):zendesk[_0x3fbe90](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7);break;case _0x69f1('0x1a'):salesforce[_0x3fbe90](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7);break;case _0x69f1('0xb'):sugarcrm[_0x3fbe90](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7);break;case _0x69f1('0xc'):freshdesk[_0x3fbe90](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7);break;case'zoho':zoho[_0x3fbe90](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7);break;case'desk':desk[_0x3fbe90](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7);break;case'vtiger':vtiger[_0x3fbe90](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7);break;case _0x69f1('0xe'):servicenow['cs'](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7,_0x3fbe90);break;case _0x69f1('0x1b'):dynamics365['cs'](_0x8182d1,_0x1c55c9,_0x3aecb6,_0x56f533,_0x5d9332,_0x3b0eca,_0x4e15c7,_0x3fbe90);break;default:console['log']('unknown\x20integration');}}else{_0x2ede22=require('../../../../config/logger')(_0x8182d1[_0x69f1('0x11')][_0x69f1('0x12')]());_0x2ede22['error']('[EXEC]',util[_0x69f1('0x1c')]('%s\x20configuration\x20#%s\x20not\x20found',_0x8182d1[_0x69f1('0x11')][_0x69f1('0x12')](),_0x8182d1[_0x69f1('0x14')]));}}else{_0x2ede22=require(_0x69f1('0x1d'))(_0x8182d1[_0x69f1('0x11')]['toLowerCase']());_0x2ede22[_0x69f1('0x1e')]('[EXEC]',util[_0x69f1('0x1c')]('%s\x20account\x20#%s\x20not\x20found',_0x8182d1[_0x69f1('0x11')]['toLowerCase'](),_0x8182d1[_0x69f1('0x13')]));}}else{}}catch(_0x205810){console[_0x69f1('0x1e')](_0x205810);}}}}; \ 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 de6439c..a9cd9e1 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 _0x9734=['moment','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','validateEmail','User','find','then','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','Contact','execute','length','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','Company','No\x20Company','upperFirst','forEach','string','idField','content','toString','type','variableName','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','Recording\x20is\x20enabled!','isNil','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','request-promise'];(function(_0x233383,_0x7ec0bd){var _0x6bbae=function(_0x4c6727){while(--_0x4c6727){_0x233383['push'](_0x233383['shift']());}};_0x6bbae(++_0x7ec0bd);}(_0x9734,0x1bf));var _0x4973=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x9734[_0x383158];return _0x507985;};'use strict';var _=require('lodash');var rp=require(_0x4973('0x0'));var moment=require(_0x4973('0x1'));var BPromise=require(_0x4973('0x2'));var md5=require(_0x4973('0x3'));var jsforce=require('jsforce');var util=require(_0x4973('0x4'));var Redis=require(_0x4973('0x5'));var intUtil=require('./util');var config=require(_0x4973('0x6'));var logger=require(_0x4973('0x7'))(_0x4973('0x8'));config[_0x4973('0x9')]=_[_0x4973('0xa')](config[_0x4973('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4973('0xb'))(new Redis(config[_0x4973('0x9')]));function emit(_0x1f6ea5,_0x6a841c,_0x24b272){io['to'](_0x1f6ea5)['emit'](_0x6a841c,_0x24b272);}function getTicket(_0x5314d9,_0x3106c2,_0x120a95,_0x201b3c,_0x1ad813,_0x1ee860,_0x1f085a,_0x3d3932){var _0x2c04e4={};if(_0x201b3c[_0x4973('0xc')]===_0x4973('0xd')){_0x2c04e4=Object[_0x4973('0xe')]({},{'OwnerId':_0x3106c2['id'],'ActivityDate':moment[_0x4973('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x4973('0x10')](_0x201b3c[_0x4973('0x11')],_0x1ad813,'\x20'),'Description':intUtil[_0x4973('0x10')](_0x201b3c[_0x4973('0x12')],_0x1ad813,'\x0a')},getCustomFields(_0x1ee860,_0x1ad813));if(_0x120a95){_0x2c04e4[_0x4973('0x13')]=_0x120a95['id'];}}else if(_0x201b3c[_0x4973('0xc')]===_0x4973('0x14')){_0x2c04e4=Object[_0x4973('0xe')]({},{'OwnerId':_0x3106c2['id'],'Subject':intUtil['getString'](_0x201b3c[_0x4973('0x11')],_0x1ad813,'\x20'),'Description':intUtil[_0x4973('0x10')](_0x201b3c[_0x4973('0x12')],_0x1ad813,'\x0a')},getCustomFields(_0x1ee860,_0x1ad813));if(_0x120a95){_0x2c04e4[_0x4973('0x15')]=_0x120a95['id'];}}return _0x1f085a[_0x4973('0x16')](_0x201b3c[_0x4973('0xc')])[_0x4973('0x17')](_0x2c04e4);}function getUser(_0x10cea5,_0x91a3d2,_0x36d68d){if(!_['isNil'](_0x91a3d2)&&intUtil[_0x4973('0x18')](_0x91a3d2)){var _0x4b31c2={'Email':_0x91a3d2};var _0x60b195={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x36d68d[_0x4973('0x16')](_0x4973('0x19'))[_0x4973('0x1a')](_0x4b31c2,_0x60b195)['execute']()[_0x4973('0x1b')](function(_0x44a749){if(_0x44a749['length']){var _0x207b14=_[_0x4973('0x1a')](_0x44a749,function(_0x2d062c){return _0x2d062c[_0x4973('0x1c')]===_0x91a3d2;});if(_0x207b14){logger[_0x4973('0x1d')]('Agent\x20%s\x20found.',_0x91a3d2);return BPromise[_0x4973('0x1e')]({'id':_0x207b14['Id'],'name':_0x207b14[_0x4973('0x1f')]});}}else{logger['info'](_0x4973('0x20'),_0x91a3d2);return _0x36d68d[_0x4973('0x21')]()[_0x4973('0x1b')](function(_0x2d0b4f){return BPromise[_0x4973('0x1e')]({'id':_0x2d0b4f[_0x4973('0x22')],'name':_0x2d0b4f[_0x4973('0x23')]});});}});}else{logger[_0x4973('0x1d')](_0x4973('0x20'),_0x91a3d2);return _0x36d68d[_0x4973('0x21')]()[_0x4973('0x1b')](function(_0x1d8a1e){return BPromise[_0x4973('0x1e')]({'id':_0x1d8a1e[_0x4973('0x22')],'name':_0x1d8a1e[_0x4973('0x23')]});});}}function getEndUser(_0x1d5b34,_0x7c71fc,_0x539f65,_0x7fe15d,_0x2b2a69){var _0x381a0e={'Phone':_0x7fe15d};var _0x6643c9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4973('0x1e')]()[_0x4973('0x1b')](function(){if(_0x7c71fc[_0x4973('0xc')]===_0x4973('0xd')){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x7fe15d,_0x7c71fc['moduleSearch']);switch(_0x7c71fc[_0x4973('0x24')]){case _0x4973('0x25'):return _0x2b2a69[_0x4973('0x16')](_0x4973('0x26'))[_0x4973('0x1a')](_0x381a0e,_0x6643c9)[_0x4973('0x27')]()['then'](function(_0x5375ed){if(_0x5375ed&&_0x5375ed[_0x4973('0x28')]){return _0x5375ed;}else{return _0x2b2a69[_0x4973('0x16')](_0x4973('0x29'))['find'](_0x381a0e,_0x6643c9);}});case _0x4973('0x2a'):return _0x2b2a69[_0x4973('0x16')](_0x4973('0x26'))[_0x4973('0x1a')](_0x381a0e,_0x6643c9)[_0x4973('0x27')]();case _0x4973('0x2b'):return _0x2b2a69[_0x4973('0x16')](_0x4973('0x29'))['find'](_0x381a0e,_0x6643c9);default:return null;}}else if(_0x7c71fc['ticketType']===_0x4973('0x14')){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x7fe15d,_0x4973('0x2a'));return _0x2b2a69[_0x4973('0x16')](_0x4973('0x26'))[_0x4973('0x1a')](_0x381a0e,_0x6643c9)['execute']();}})['then'](function(_0xee2ff7){if(_0xee2ff7&&_0xee2ff7[_0x4973('0x28')]){var _0x184de4=_[_0x4973('0x1a')](_0xee2ff7,function(_0x359434){return _0x359434['Phone']===_0x7fe15d;});if(_0x184de4){return BPromise['resolve']({'id':_0x184de4['Id'],'name':_0x184de4[_0x4973('0x1f')],'phone':_0x184de4[_0x4973('0x2c')]});}}})[_0x4973('0x1b')](function(_0x3c243f){if(_0x3c243f){logger[_0x4973('0x1d')](_0x4973('0x2d'),_0x7fe15d);return BPromise[_0x4973('0x1e')](_0x3c243f);}else{logger[_0x4973('0x1d')](_0x4973('0x2e'),_0x7fe15d);var _0x2443c3={'LastName':_0x539f65!==_0x4973('0x2f')?_0x539f65:util[_0x4973('0x30')](_0x4973('0x31'),_0x7fe15d),'Phone':_0x7fe15d};if(_0x7c71fc['moduleCreate']){if(_0x7c71fc['moduleCreate']==='contact'){logger[_0x4973('0x1d')](_0x4973('0x32'),_0x7fe15d,_0x7c71fc[_0x4973('0x33')]);}else if(_0x7c71fc[_0x4973('0x33')]===_0x4973('0x2b')&&_0x7c71fc[_0x4973('0xc')]==='Task'){logger[_0x4973('0x1d')](_0x4973('0x32'),_0x7fe15d,_0x7c71fc[_0x4973('0x33')]);_0x2443c3[_0x4973('0x34')]=_0x4973('0x35');}else{return null;}}return _0x2b2a69[_0x4973('0x16')](_[_0x4973('0x36')](_0x7c71fc[_0x4973('0x33')]))[_0x4973('0x17')](_0x2443c3);}});}function getCustomFields(_0x2a615d,_0x572d04){var _0x2e4b5b={};if(_0x2a615d[_0x4973('0x28')]>0x0){_[_0x4973('0x37')](_0x2a615d,function(_0x47f7a5){if(_0x47f7a5['type']===_0x4973('0x38')&&_0x47f7a5[_0x4973('0x39')]){_0x2e4b5b[_0x47f7a5['idField']]=_0x47f7a5[_0x4973('0x3a')][_0x4973('0x3b')]();}else if(_0x47f7a5[_0x4973('0x3c')]==='variable'&&_0x47f7a5[_0x4973('0x3d')]&&_0x47f7a5[_0x4973('0x39')]){_0x572d04[_0x47f7a5['variableName']]&&(_0x2e4b5b[_0x47f7a5[_0x4973('0x39')]]=_0x572d04[_0x47f7a5[_0x4973('0x3d')]][_0x4973('0x3b')]());}else if(_0x47f7a5[_0x4973('0x3c')]==='customVariable'&&_0x47f7a5[_0x4973('0x3e')]&&_0x47f7a5['Variable'][_0x4973('0x3f')]&&_0x47f7a5['idField']){_0x572d04[_0x47f7a5[_0x4973('0x3e')][_0x4973('0x3f')][_0x4973('0x40')]()]&&(_0x2e4b5b[_0x47f7a5['idField']]=_0x572d04[_0x47f7a5[_0x4973('0x3e')][_0x4973('0x3f')][_0x4973('0x40')]()]['toString']());}});}return _0x2e4b5b;}function getConnection(_0x11ba42){var _0x13e925=_0x11ba42[_0x4973('0x41')]['concat'](_0x11ba42[_0x4973('0x42')]);var _0x26b805=new jsforce[(_0x4973('0x43'))]({'oauth2':{'loginUrl':_0x11ba42[_0x4973('0x44')]||_0x4973('0x45'),'clientId':_0x11ba42[_0x4973('0x46')],'clientSecret':_0x11ba42['clientSecret']}});return _0x26b805[_0x4973('0x47')](_0x11ba42[_0x4973('0x48')],_0x13e925)[_0x4973('0x1b')](function(){logger[_0x4973('0x1d')](_0x4973('0x49'));return _0x26b805;});}exports[_0x4973('0x4a')]=function(_0x356790,_0x2c3f4a,_0x5562cf,_0x5ea842,_0x245b01,_0x2227ed){var _0x254a84,_0x354603,_0x3d1d6c,_0x43de6e;_0x2227ed[_0x4973('0x4b')]=intUtil['stripTrailingSlash'](_0x2227ed[_0x4973('0x4b')]);_0x2227ed[_0x4973('0x44')]=intUtil[_0x4973('0x4c')](_0x2227ed[_0x4973('0x44')]);if(_0x245b01&&_0x245b01[_0x4973('0x4d')]){logger[_0x4973('0x1d')](_0x4973('0x4e'),'Recording\x20is\x20enabled!');_0x2c3f4a['recordingURL']=util[_0x4973('0x30')](_0x4973('0x4f'),_0x2227ed[_0x4973('0x4b')],_0x2c3f4a[_0x4973('0x50')],md5(_0x2c3f4a[_0x4973('0x50')]));}else{_0x2c3f4a[_0x4973('0x51')]='';}return getConnection(_0x2227ed)[_0x4973('0x1b')](function(_0x29390e){_0x43de6e=_0x29390e;return getUser(_0x2227ed,_0x5ea842['email'],_0x43de6e);})['then'](function(_0x3dd1bd){_0x254a84=_0x3dd1bd;return getEndUser(_0x2227ed,_0x5562cf,_0x2c3f4a[_0x4973('0x52')],_0x2c3f4a[_0x4973('0x53')],_0x43de6e);})[_0x4973('0x1b')](function(_0x212c19){_0x354603=_0x212c19;return getTicket(_0x2227ed,_0x254a84,_0x354603,_0x5562cf,_0x2c3f4a,_0x5562cf[_0x4973('0x54')],_0x43de6e,'queue');})['then'](function(_0x1b5688){_0x3d1d6c=_0x1b5688;logger[_0x4973('0x1d')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x3d1d6c['id']);logger[_0x4973('0x1d')](_0x4973('0x55'),_0x3d1d6c['id'],_0x5ea842[_0x4973('0x3f')],_0x2227ed[_0x4973('0x3c')]);switch(_0x2227ed[_0x4973('0x3c')]){case _0x4973('0x56'):emit(util[_0x4973('0x30')](_0x4973('0x57'),_0x5ea842[_0x4973('0x3f')]),'trigger:salesforce:display',{'recordId':_0x3d1d6c['id']});break;case _0x4973('0x58'):emit(util[_0x4973('0x30')](_0x4973('0x57'),_0x5ea842['name']),_0x4973('0x59'),{'uri':util[_0x4973('0x30')](_0x4973('0x5a'),_0x43de6e[_0x4973('0x5b')],_0x3d1d6c['id'])});break;default:logger[_0x4973('0x5c')](_0x4973('0x5d'));}})[_0x4973('0x5e')](function(_0xd192a1){logger[_0x4973('0x5c')]('[QUEUE]',JSON[_0x4973('0x5f')](_0xd192a1));});};exports[_0x4973('0x60')]=function(_0x3604e8,_0x3153a2,_0x298e68,_0x1e8d90,_0xb21f5a,_0x3c13fe,_0x4ecfa9){var _0x3ec4e1,_0x496c24,_0x12d237,_0x172603;_0x3c13fe[_0x4973('0x4b')]=intUtil['stripTrailingSlash'](_0x3c13fe[_0x4973('0x4b')]);_0x3c13fe[_0x4973('0x44')]=intUtil['stripTrailingSlash'](_0x3c13fe[_0x4973('0x44')]);if(_0x4ecfa9&&_0x4ecfa9[_0x4973('0x61')]&&_0x4ecfa9['recordingFormat']!==_0x4973('0x62')){logger[_0x4973('0x1d')](_0x4973('0x63'),'Recording\x20is\x20enabled!');_0x3153a2[_0x4973('0x51')]=util[_0x4973('0x30')](_0x4973('0x4f'),_0x3c13fe[_0x4973('0x4b')],_0x3153a2['uniqueid'],md5(_0x3153a2[_0x4973('0x50')]));}return getConnection(_0x3c13fe)['then'](function(_0x285f52){_0x172603=_0x285f52;return getUser(_0x3c13fe,_0x1e8d90[_0x4973('0x64')],_0x172603);})[_0x4973('0x1b')](function(_0x57dccf){_0x3ec4e1=_0x57dccf;return getEndUser(_0x3c13fe,_0x298e68,_0x3153a2[_0x4973('0x65')],_0x3153a2[_0x4973('0x66')],_0x172603);})[_0x4973('0x1b')](function(_0x5efed5){_0x496c24=_0x5efed5;return getTicket(_0x3c13fe,_0x3ec4e1,_0x496c24,_0x298e68,_0x3153a2,_0x298e68['Fields'],_0x172603,_0x4973('0x60'));})[_0x4973('0x1b')](function(_0x56b7fb){_0x12d237=_0x56b7fb;logger[_0x4973('0x1d')](_0x4973('0x67'),_0x12d237['id']);logger[_0x4973('0x1d')](_0x4973('0x68'),_0x12d237['id'],_0x1e8d90[_0x4973('0x3f')],_0x3c13fe[_0x4973('0x3c')]);switch(_0x3c13fe[_0x4973('0x3c')]){case _0x4973('0x56'):emit(util['format'](_0x4973('0x57'),_0x1e8d90['name']),_0x4973('0x69'),{'recordId':_0x12d237['id']});break;case'newTab':emit(util['format'](_0x4973('0x57'),_0x1e8d90[_0x4973('0x3f')]),'trigger:browser:url',{'uri':util['format'](_0x4973('0x5a'),_0x172603['instanceUrl'],_0x12d237['id'])});break;default:logger[_0x4973('0x5c')](_0x4973('0x63'),_0x4973('0x6a'));}})['catch'](function(_0x98a450){logger[_0x4973('0x5c')](_0x4973('0x63'),JSON['stringify'](_0x98a450));});};exports[_0x4973('0x6b')]=function(_0x12475a,_0x2fa661,_0x105c78,_0x148ad0,_0x3eeedc,_0x542085){var _0x946c2b,_0x3e99ff,_0x5161f9,_0x45371e;_0x542085[_0x4973('0x4b')]=intUtil[_0x4973('0x4c')](_0x542085[_0x4973('0x4b')]);_0x542085[_0x4973('0x44')]=intUtil['stripTrailingSlash'](_0x542085['remoteUri']);if(_0x3eeedc&&_0x3eeedc[_0x4973('0x4d')]){logger[_0x4973('0x1d')](_0x4973('0x6c'),_0x4973('0x6d'));_0x2fa661[_0x4973('0x51')]=util['format'](_0x4973('0x4f'),_0x542085[_0x4973('0x4b')],_0x2fa661[_0x4973('0x50')],md5(_0x2fa661[_0x4973('0x50')]));}else{_0x2fa661[_0x4973('0x51')]='';}return getConnection(_0x542085)['then'](function(_0x982598){_0x45371e=_0x982598;if(!_[_0x4973('0x6e')](_0x148ad0)){return getUser(_0x542085,_0x148ad0['name'],_0x45371e);}else{return getUser(_0x542085,null,_0x45371e);}})[_0x4973('0x1b')](function(_0x15d878){_0x946c2b=_0x15d878;return getEndUser(_0x542085,_0x105c78,_0x2fa661[_0x4973('0x52')],_0x2fa661[_0x4973('0x53')],_0x45371e);})[_0x4973('0x1b')](function(_0x9538de){_0x3e99ff=_0x9538de;return getTicket(_0x542085,_0x946c2b,_0x3e99ff,_0x105c78,_0x2fa661,_0x105c78[_0x4973('0x54')],_0x45371e);})[_0x4973('0x1b')](function(_0x1bf868){_0x5161f9=_0x1bf868;logger[_0x4973('0x1d')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0x5161f9['id']);logger[_0x4973('0x1d')](_0x4973('0x6f'),_0x542085[_0x4973('0x3c')]);})['catch'](function(_0x11f668){logger['error'](_0x4973('0x6c'),JSON[_0x4973('0x5f')](_0x11f668));});}; \ No newline at end of file +var _0xa230=['calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[ABANDONED]','recordingURL','isNil','Fields','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','moment','jsforce','./util','../../../../config/logger','salesforce','localhost','socket.io-emitter','emit','Task','assign','getString','Subjects','WhoId','Case','Descriptions','sobject','ticketType','validateEmail','find','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','execute','Lead','contact','lead','Contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email'];(function(_0x1dfd68,_0x36ad24){var _0x4c0d5b=function(_0x3ba912){while(--_0x3ba912){_0x1dfd68['push'](_0x1dfd68['shift']());}};_0x4c0d5b(++_0x36ad24);}(_0xa230,0x146));var _0x0a23=function(_0x280037,_0x3aae13){_0x280037=_0x280037-0x0;var _0x140ce2=_0xa230[_0x280037];return _0x140ce2;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x0a23('0x0'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x0a23('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a23('0x2'));var config=require('../../../../config/environment');var logger=require(_0x0a23('0x3'))(_0x0a23('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x0a23('0x5'),'port':0x18eb});var io=require(_0x0a23('0x6'))(new Redis(config['redis']));function emit(_0x35d06c,_0x2dc2c5,_0x2ae600){io['to'](_0x35d06c)[_0x0a23('0x7')](_0x2dc2c5,_0x2ae600);}function getTicket(_0x573de2,_0x1f6956,_0x7a1afd,_0x2b936f,_0x4a1f0e,_0x8d1308,_0x17baa9,_0x1ed440){var _0x895992={};if(_0x2b936f['ticketType']===_0x0a23('0x8')){_0x895992=Object[_0x0a23('0x9')]({},{'OwnerId':_0x1f6956['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x0a23('0xa')](_0x2b936f[_0x0a23('0xb')],_0x4a1f0e,'\x20'),'Description':intUtil[_0x0a23('0xa')](_0x2b936f['Descriptions'],_0x4a1f0e,'\x0a')},getCustomFields(_0x8d1308,_0x4a1f0e));if(_0x7a1afd){_0x895992[_0x0a23('0xc')]=_0x7a1afd['id'];}}else if(_0x2b936f['ticketType']===_0x0a23('0xd')){_0x895992=Object[_0x0a23('0x9')]({},{'OwnerId':_0x1f6956['id'],'Subject':intUtil[_0x0a23('0xa')](_0x2b936f[_0x0a23('0xb')],_0x4a1f0e,'\x20'),'Description':intUtil[_0x0a23('0xa')](_0x2b936f[_0x0a23('0xe')],_0x4a1f0e,'\x0a')},getCustomFields(_0x8d1308,_0x4a1f0e));if(_0x7a1afd){_0x895992['ContactId']=_0x7a1afd['id'];}}return _0x17baa9[_0x0a23('0xf')](_0x2b936f[_0x0a23('0x10')])['create'](_0x895992);}function getUser(_0x501d1e,_0x534d08,_0x19d261){if(!_['isNil'](_0x534d08)&&intUtil[_0x0a23('0x11')](_0x534d08)){var _0xa3b9c2={'Email':_0x534d08};var _0x1fca83={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x19d261[_0x0a23('0xf')]('User')[_0x0a23('0x12')](_0xa3b9c2,_0x1fca83)['execute']()[_0x0a23('0x13')](function(_0x92586c){if(_0x92586c[_0x0a23('0x14')]){var _0x223439=_['find'](_0x92586c,function(_0x2ac7c5){return _0x2ac7c5[_0x0a23('0x15')]===_0x534d08;});if(_0x223439){logger[_0x0a23('0x16')]('Agent\x20%s\x20found.',_0x534d08);return BPromise[_0x0a23('0x17')]({'id':_0x223439['Id'],'name':_0x223439[_0x0a23('0x18')]});}}else{logger['info'](_0x0a23('0x19'),_0x534d08);return _0x19d261[_0x0a23('0x1a')]()[_0x0a23('0x13')](function(_0x5c79da){return BPromise[_0x0a23('0x17')]({'id':_0x5c79da[_0x0a23('0x1b')],'name':_0x5c79da[_0x0a23('0x1c')]});});}});}else{logger[_0x0a23('0x16')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x534d08);return _0x19d261[_0x0a23('0x1a')]()[_0x0a23('0x13')](function(_0x3fde07){return BPromise[_0x0a23('0x17')]({'id':_0x3fde07[_0x0a23('0x1b')],'name':_0x3fde07[_0x0a23('0x1c')]});});}}function getEndUser(_0x5c3d6a,_0x1fa4c2,_0x46c7f1,_0x2e65ac,_0x5cd2ef){var _0x1c8634={'Phone':_0x2e65ac};var _0x31da01={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x0a23('0x13')](function(){if(_0x1fa4c2['ticketType']===_0x0a23('0x8')){logger[_0x0a23('0x16')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2e65ac,_0x1fa4c2[_0x0a23('0x1d')]);switch(_0x1fa4c2[_0x0a23('0x1d')]){case'contact_lead':return _0x5cd2ef['sobject']('Contact')['find'](_0x1c8634,_0x31da01)[_0x0a23('0x1e')]()['then'](function(_0x4d79a8){if(_0x4d79a8&&_0x4d79a8[_0x0a23('0x14')]){return _0x4d79a8;}else{return _0x5cd2ef[_0x0a23('0xf')](_0x0a23('0x1f'))['find'](_0x1c8634,_0x31da01);}});case _0x0a23('0x20'):return _0x5cd2ef[_0x0a23('0xf')]('Contact')[_0x0a23('0x12')](_0x1c8634,_0x31da01)[_0x0a23('0x1e')]();case _0x0a23('0x21'):return _0x5cd2ef[_0x0a23('0xf')]('Lead')[_0x0a23('0x12')](_0x1c8634,_0x31da01);default:return null;}}else if(_0x1fa4c2[_0x0a23('0x10')]===_0x0a23('0xd')){logger[_0x0a23('0x16')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2e65ac,_0x0a23('0x20'));return _0x5cd2ef[_0x0a23('0xf')](_0x0a23('0x22'))[_0x0a23('0x12')](_0x1c8634,_0x31da01)[_0x0a23('0x1e')]();}})[_0x0a23('0x13')](function(_0x57d34f){if(_0x57d34f&&_0x57d34f['length']){var _0x215c63=_[_0x0a23('0x12')](_0x57d34f,function(_0x531c30){return _0x531c30[_0x0a23('0x23')]===_0x2e65ac;});if(_0x215c63){return BPromise['resolve']({'id':_0x215c63['Id'],'name':_0x215c63[_0x0a23('0x18')],'phone':_0x215c63[_0x0a23('0x23')]});}}})[_0x0a23('0x13')](function(_0x4ac7dc){if(_0x4ac7dc){logger[_0x0a23('0x16')](_0x0a23('0x24'),_0x2e65ac);return BPromise['resolve'](_0x4ac7dc);}else{logger['info'](_0x0a23('0x25'),_0x2e65ac);var _0x147d4e={'LastName':_0x46c7f1!==_0x0a23('0x26')?_0x46c7f1:util[_0x0a23('0x27')](_0x0a23('0x28'),_0x2e65ac),'Phone':_0x2e65ac};if(_0x1fa4c2[_0x0a23('0x29')]){if(_0x1fa4c2[_0x0a23('0x29')]===_0x0a23('0x20')){logger[_0x0a23('0x16')](_0x0a23('0x2a'),_0x2e65ac,_0x1fa4c2[_0x0a23('0x29')]);}else if(_0x1fa4c2[_0x0a23('0x29')]===_0x0a23('0x21')&&_0x1fa4c2[_0x0a23('0x10')]===_0x0a23('0x8')){logger[_0x0a23('0x16')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2e65ac,_0x1fa4c2[_0x0a23('0x29')]);_0x147d4e[_0x0a23('0x2b')]=_0x0a23('0x2c');}else{return null;}}return _0x5cd2ef['sobject'](_[_0x0a23('0x2d')](_0x1fa4c2[_0x0a23('0x29')]))[_0x0a23('0x2e')](_0x147d4e);}});}function getCustomFields(_0x1efed6,_0x27d36f){var _0x1349e2={};if(_0x1efed6[_0x0a23('0x14')]>0x0){_['forEach'](_0x1efed6,function(_0x58d830){if(_0x58d830[_0x0a23('0x2f')]===_0x0a23('0x30')&&_0x58d830[_0x0a23('0x31')]){_0x1349e2[_0x58d830[_0x0a23('0x31')]]=_0x58d830[_0x0a23('0x32')][_0x0a23('0x33')]();}else if(_0x58d830[_0x0a23('0x2f')]==='variable'&&_0x58d830[_0x0a23('0x34')]&&_0x58d830[_0x0a23('0x31')]){_0x27d36f[_0x58d830[_0x0a23('0x34')]]&&(_0x1349e2[_0x58d830[_0x0a23('0x31')]]=_0x27d36f[_0x58d830[_0x0a23('0x34')]][_0x0a23('0x33')]());}else if(_0x58d830['type']===_0x0a23('0x35')&&_0x58d830[_0x0a23('0x36')]&&_0x58d830[_0x0a23('0x36')][_0x0a23('0x37')]&&_0x58d830[_0x0a23('0x31')]){_0x27d36f[_0x58d830['Variable'][_0x0a23('0x37')][_0x0a23('0x38')]()]&&(_0x1349e2[_0x58d830['idField']]=_0x27d36f[_0x58d830[_0x0a23('0x36')][_0x0a23('0x37')][_0x0a23('0x38')]()][_0x0a23('0x33')]());}});}return _0x1349e2;}function getConnection(_0x320f8a){var _0x51db24=_0x320f8a[_0x0a23('0x39')][_0x0a23('0x3a')](_0x320f8a['securityToken']);var _0x12d0c4=new jsforce[(_0x0a23('0x3b'))]({'oauth2':{'loginUrl':_0x320f8a[_0x0a23('0x3c')]||_0x0a23('0x3d'),'clientId':_0x320f8a['clientId'],'clientSecret':_0x320f8a[_0x0a23('0x3e')]}});return _0x12d0c4['login'](_0x320f8a[_0x0a23('0x3f')],_0x51db24)[_0x0a23('0x13')](function(){logger[_0x0a23('0x16')](_0x0a23('0x40'));return _0x12d0c4;});}exports[_0x0a23('0x41')]=function(_0x30473f,_0x14a750,_0x5b3f11,_0x2da7f8,_0x1682c4,_0x1e663c){var _0xe3ab8f,_0x1524ee,_0x13d54e,_0x28e4f3;_0x1e663c[_0x0a23('0x42')]=intUtil['stripTrailingSlash'](_0x1e663c['serverUrl']);_0x1e663c[_0x0a23('0x3c')]=intUtil[_0x0a23('0x43')](_0x1e663c[_0x0a23('0x3c')]);if(_0x1682c4&&_0x1682c4[_0x0a23('0x44')]){logger['info'](_0x0a23('0x45'),_0x0a23('0x46'));_0x14a750['recordingURL']=util['format'](_0x0a23('0x47'),_0x1e663c[_0x0a23('0x42')],_0x14a750['uniqueid'],md5(_0x14a750[_0x0a23('0x48')]));}else{_0x14a750['recordingURL']='';}return getConnection(_0x1e663c)[_0x0a23('0x13')](function(_0x564556){_0x28e4f3=_0x564556;return getUser(_0x1e663c,_0x2da7f8[_0x0a23('0x49')],_0x28e4f3);})[_0x0a23('0x13')](function(_0xa2c814){_0xe3ab8f=_0xa2c814;return getEndUser(_0x1e663c,_0x5b3f11,_0x14a750[_0x0a23('0x4a')],_0x14a750[_0x0a23('0x4b')],_0x28e4f3);})[_0x0a23('0x13')](function(_0x21fa29){_0x1524ee=_0x21fa29;return getTicket(_0x1e663c,_0xe3ab8f,_0x1524ee,_0x5b3f11,_0x14a750,_0x5b3f11['Fields'],_0x28e4f3,_0x0a23('0x41'));})[_0x0a23('0x13')](function(_0x3c1a6f){_0x13d54e=_0x3c1a6f;logger[_0x0a23('0x16')](_0x0a23('0x4c'),_0x13d54e['id']);logger[_0x0a23('0x16')](_0x0a23('0x4d'),_0x13d54e['id'],_0x2da7f8['name'],_0x1e663c['type']);switch(_0x1e663c[_0x0a23('0x2f')]){case _0x0a23('0x4e'):emit(util[_0x0a23('0x27')]('user:%s',_0x2da7f8[_0x0a23('0x37')]),_0x0a23('0x4f'),{'recordId':_0x13d54e['id']});break;case _0x0a23('0x50'):emit(util['format'](_0x0a23('0x51'),_0x2da7f8['name']),_0x0a23('0x52'),{'uri':util[_0x0a23('0x27')](_0x0a23('0x53'),_0x28e4f3[_0x0a23('0x54')],_0x13d54e['id'])});break;default:logger[_0x0a23('0x55')](_0x0a23('0x56'));}})[_0x0a23('0x57')](function(_0x5352d7){logger['error'](_0x0a23('0x45'),JSON[_0x0a23('0x58')](_0x5352d7));});};exports[_0x0a23('0x59')]=function(_0x4cfd92,_0x2f5d75,_0x3a9a51,_0x5b2fe0,_0x6eb9c6,_0x359eaf,_0x22604e){var _0x5744c2,_0x2e900d,_0x3ff432,_0x53eaca;_0x359eaf[_0x0a23('0x42')]=intUtil[_0x0a23('0x43')](_0x359eaf[_0x0a23('0x42')]);_0x359eaf[_0x0a23('0x3c')]=intUtil[_0x0a23('0x43')](_0x359eaf['remoteUri']);if(_0x22604e&&_0x22604e[_0x0a23('0x5a')]&&_0x22604e['recordingFormat']!=='none'){logger[_0x0a23('0x16')](_0x0a23('0x5b'),_0x0a23('0x46'));_0x2f5d75['recordingURL']=util[_0x0a23('0x27')](_0x0a23('0x47'),_0x359eaf[_0x0a23('0x42')],_0x2f5d75[_0x0a23('0x48')],md5(_0x2f5d75[_0x0a23('0x48')]));}return getConnection(_0x359eaf)[_0x0a23('0x13')](function(_0xb5a752){_0x53eaca=_0xb5a752;return getUser(_0x359eaf,_0x5b2fe0['email'],_0x53eaca);})[_0x0a23('0x13')](function(_0x33710b){_0x5744c2=_0x33710b;return getEndUser(_0x359eaf,_0x3a9a51,_0x2f5d75['destcalleridname'],_0x2f5d75['destcalleridnum'],_0x53eaca);})[_0x0a23('0x13')](function(_0x423252){_0x2e900d=_0x423252;return getTicket(_0x359eaf,_0x5744c2,_0x2e900d,_0x3a9a51,_0x2f5d75,_0x3a9a51['Fields'],_0x53eaca,_0x0a23('0x59'));})[_0x0a23('0x13')](function(_0x1b2f7d){_0x3ff432=_0x1b2f7d;logger[_0x0a23('0x16')](_0x0a23('0x5c'),_0x3ff432['id']);logger[_0x0a23('0x16')](_0x0a23('0x5d'),_0x3ff432['id'],_0x5b2fe0['name'],_0x359eaf['type']);switch(_0x359eaf['type']){case _0x0a23('0x4e'):emit(util[_0x0a23('0x27')]('user:%s',_0x5b2fe0[_0x0a23('0x37')]),'trigger:salesforce:display',{'recordId':_0x3ff432['id']});break;case'newTab':emit(util['format'](_0x0a23('0x51'),_0x5b2fe0['name']),_0x0a23('0x52'),{'uri':util[_0x0a23('0x27')](_0x0a23('0x53'),_0x53eaca[_0x0a23('0x54')],_0x3ff432['id'])});break;default:logger['error'](_0x0a23('0x5b'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x0a23('0x57')](function(_0x23f626){logger['error'](_0x0a23('0x5b'),JSON[_0x0a23('0x58')](_0x23f626));});};exports['abandoned']=function(_0x5becce,_0x27d8e9,_0x3368d8,_0x11e920,_0x1f0acb,_0xc58da9){var _0x34aa2e,_0x3741d6,_0x27680d,_0x12c6c9;_0xc58da9[_0x0a23('0x42')]=intUtil['stripTrailingSlash'](_0xc58da9[_0x0a23('0x42')]);_0xc58da9[_0x0a23('0x3c')]=intUtil[_0x0a23('0x43')](_0xc58da9[_0x0a23('0x3c')]);if(_0x1f0acb&&_0x1f0acb[_0x0a23('0x44')]){logger['info'](_0x0a23('0x5e'),_0x0a23('0x46'));_0x27d8e9[_0x0a23('0x5f')]=util['format'](_0x0a23('0x47'),_0xc58da9[_0x0a23('0x42')],_0x27d8e9[_0x0a23('0x48')],md5(_0x27d8e9['uniqueid']));}else{_0x27d8e9['recordingURL']='';}return getConnection(_0xc58da9)['then'](function(_0x4ffa4b){_0x12c6c9=_0x4ffa4b;if(!_[_0x0a23('0x60')](_0x11e920)){return getUser(_0xc58da9,_0x11e920[_0x0a23('0x37')],_0x12c6c9);}else{return getUser(_0xc58da9,null,_0x12c6c9);}})[_0x0a23('0x13')](function(_0x509105){_0x34aa2e=_0x509105;return getEndUser(_0xc58da9,_0x3368d8,_0x27d8e9[_0x0a23('0x4a')],_0x27d8e9['calleridnum'],_0x12c6c9);})[_0x0a23('0x13')](function(_0x1c9a9a){_0x3741d6=_0x1c9a9a;return getTicket(_0xc58da9,_0x34aa2e,_0x3741d6,_0x3368d8,_0x27d8e9,_0x3368d8[_0x0a23('0x61')],_0x12c6c9);})['then'](function(_0x49e253){_0x27680d=_0x49e253;logger[_0x0a23('0x16')](_0x0a23('0x62'),_0x27680d['id']);logger['info'](_0x0a23('0x63'),_0xc58da9['type']);})[_0x0a23('0x57')](function(_0x51cb4e){logger[_0x0a23('0x55')]('[ABANDONED]',JSON['stringify'](_0x51cb4e));});}; \ 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 0c42c4e..48752f6 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index b1ce45a..f9a6d18 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 _0x8ce3=['user_name','then','entry_list','length','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','nameField','customField','content','variable','custom_fields','customVariable','Variable','toLowerCase','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Outbound','version','abandoned','[ABANDONED]','Inbound','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','parent_id','parent_type','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200'];(function(_0x1093dc,_0xa31577){var _0x53bdb3=function(_0x3bc20a){while(--_0x3bc20a){_0x1093dc['push'](_0x1093dc['shift']());}};_0x53bdb3(++_0xa31577);}(_0x8ce3,0xc3));var _0x38ce=function(_0x5755bf,_0x5a50ba){_0x5755bf=_0x5755bf-0x0;var _0x156408=_0x8ce3[_0x5755bf];return _0x156408;};'use strict';var _=require(_0x38ce('0x0'));var rp=require(_0x38ce('0x1'));var BPromise=require('bluebird');var md5=require(_0x38ce('0x2'));var util=require(_0x38ce('0x3'));var Redis=require(_0x38ce('0x4'));var intUtil=require(_0x38ce('0x5'));var config=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));config[_0x38ce('0x9')]=_['defaults'](config[_0x38ce('0x9')],{'host':_0x38ce('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x38ce('0x9')]));var def={'method':_0x38ce('0xb'),'json':!![]};function emit(_0x3f8011,_0x482955,_0x3c66e5){io['to'](_0x3f8011)['emit'](_0x482955,_0x3c66e5);}function getTicket(_0x725d27,_0x4bd97b,_0x133bd5,_0x31c2e1,_0xa9931b,_0x2c0cab,_0x564332,_0x3603fa){logger[_0x38ce('0xc')](_0x38ce('0xd'));var _0x29bd3a=new Date();var _0xe33aec=[{'name':_0x38ce('0xe'),'value':intUtil[_0x38ce('0xf')](_0x31c2e1[_0x38ce('0x10')],_0xa9931b,'\x20')},{'name':_0x38ce('0x11'),'value':_0x4bd97b['id']},{'name':_0x38ce('0x12'),'value':_0x4bd97b['id']},{'name':_0x38ce('0x13'),'value':intUtil['getString'](_0x31c2e1['Descriptions'],_0xa9931b,'\x0a')},{'name':_0x38ce('0x14'),'value':_0x29bd3a[_0x38ce('0x15')]()[_0x38ce('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0x38ce('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x38ce('0x18'),'value':_0x133bd5['id']},{'name':_0x38ce('0x19'),'value':'Contacts'},{'name':_0x38ce('0x1a'),'value':_0x133bd5[_0x38ce('0xe')]},{'name':_0x38ce('0x1b'),'value':_0x3603fa}];if(_0x2c0cab['length']){_[_0x38ce('0x1c')](_0x2c0cab,function(_0x2efd6f){if(_0xa9931b[_0x2efd6f[_0x38ce('0x1d')]]){_0xe33aec[_0x38ce('0x1e')]({'name':_0x2efd6f[_0x38ce('0x1f')],'value':_0xa9931b[_0x2efd6f[_0x38ce('0x1d')]]});}});}return request({'form':{'method':_0x38ce('0x20'),'input_type':'JSON','response_type':_0x38ce('0x21'),'rest_data':JSON[_0x38ce('0x22')]({'session':_0x564332['id'],'module_name':_0x38ce('0x23'),'name_value_list':_0xe33aec})}});}function getAuth(_0x303391){return util[_0x38ce('0x24')](_0x38ce('0x25'),new Buffer(_0x303391[_0x38ce('0x26')]+':X')[_0x38ce('0x27')](_0x38ce('0x28')));}function getServerInfo(_0x3cf50b){return request({'form':{'method':_0x38ce('0x29'),'input_type':'JSON','response_type':_0x38ce('0x21'),'rest_data':JSON[_0x38ce('0x22')]({'session':_0x3cf50b['id']})}});}function getUser(_0xe40e9c,_0xcf5d9e,_0x4a56b0){if(!_[_0x38ce('0x2a')](_0xcf5d9e)){logger[_0x38ce('0xc')]('Getting\x20agent\x20with\x20name',_0xcf5d9e);return request({'form':{'method':_0x38ce('0x2b'),'input_type':_0x38ce('0x21'),'response_type':_0x38ce('0x21'),'rest_data':JSON['stringify']({'session':_0x4a56b0['id'],'module_name':'Employees','query':util[_0x38ce('0x24')](_0x38ce('0x2c'),_0xcf5d9e),'order_by':'','offset':'0','select_fields':['id',_0x38ce('0xe'),_0x38ce('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x38ce('0x2e')](function(_0x2a59fe){if(_0x2a59fe[_0x38ce('0x2f')][_0x38ce('0x30')]){var _0x405d7d=_[_0x38ce('0x31')](_0x2a59fe[_0x38ce('0x2f')],function(_0x381703){return _0x381703['name_value_list'][_0x38ce('0x2d')][_0x38ce('0x32')]===_0xcf5d9e;});if(_0x405d7d){logger['info'](_0x38ce('0x33'));return BPromise[_0x38ce('0x34')]({'id':_0x405d7d['name_value_list']['id'][_0x38ce('0x32')],'name':_0x405d7d[_0x38ce('0x35')]['name'][_0x38ce('0x32')]});}}logger['info'](_0x38ce('0x36'));return BPromise[_0x38ce('0x34')]({'id':_0x4a56b0[_0x38ce('0x35')][_0x38ce('0x37')][_0x38ce('0x32')],'name':_0x4a56b0[_0x38ce('0x35')][_0x38ce('0x2d')][_0x38ce('0x32')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x38ce('0x34')]({'id':_0x4a56b0[_0x38ce('0x35')][_0x38ce('0x37')][_0x38ce('0x32')],'name':_0x4a56b0[_0x38ce('0x35')]['user_name'][_0x38ce('0x32')]});}}function getEndUser(_0x12c68b,_0x37f696,_0xb19f75,_0x3a4895){logger[_0x38ce('0xc')](_0x38ce('0x38'),_0xb19f75);return request({'form':{'method':'get_entry_list','input_type':_0x38ce('0x21'),'response_type':_0x38ce('0x21'),'rest_data':JSON['stringify']({'session':_0x3a4895['id'],'module_name':_0x38ce('0x39'),'query':util[_0x38ce('0x24')](_0x38ce('0x3a'),_0xb19f75),'order_by':'','offset':'0','select_fields':['id',_0x38ce('0xe'),_0x38ce('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x38ce('0x2e')](function(_0x2f9173){if(_0x2f9173[_0x38ce('0x2f')]['length']){var _0x3d2c8c=_[_0x38ce('0x31')](_0x2f9173[_0x38ce('0x2f')],function(_0x444c1a){return _0x444c1a['name_value_list'][_0x38ce('0x3b')]['value']===_0xb19f75;});if(_0x3d2c8c){logger[_0x38ce('0xc')](_0x38ce('0x3c'));return BPromise[_0x38ce('0x34')]({'id':_0x3d2c8c[_0x38ce('0x35')]['id'][_0x38ce('0x32')],'name':_0x3d2c8c[_0x38ce('0x35')]['name'][_0x38ce('0x32')],'phone':_0x3d2c8c['name_value_list'][_0x38ce('0x3b')][_0x38ce('0x32')]});}}else{logger[_0x38ce('0xc')](_0x38ce('0x3d'));return request({'form':{'method':_0x38ce('0x20'),'input_type':_0x38ce('0x21'),'response_type':'JSON','rest_data':JSON[_0x38ce('0x22')]({'session':_0x3a4895['id'],'module_name':_0x38ce('0x39'),'name_value_list':[{'name':_0x38ce('0x3e'),'value':_0x37f696!==_0x38ce('0x3f')?_0x37f696:util[_0x38ce('0x24')](_0x38ce('0x40'),_0xb19f75)},{'name':'phone_home','value':_0xb19f75}]})}})['then'](function(_0x2412aa){logger[_0x38ce('0xc')](_0x38ce('0x41'));return BPromise[_0x38ce('0x34')]({'id':_0x2412aa['id'],'name':_0x2412aa[_0x38ce('0x2f')][_0x38ce('0x3e')][_0x38ce('0x32')],'phone':_0x2412aa['entry_list'][_0x38ce('0x3b')][_0x38ce('0x32')]});});}});}function request(_0x5a689b){logger[_0x38ce('0x42')](_0x38ce('0x43'),JSON[_0x38ce('0x22')](_0x5a689b));return rp(_['merge'](def,_0x5a689b));}function getTags(_0xaf99ce,_0xd95bc8){var _0x33f6a6=[];if(_0xaf99ce&&_0xaf99ce[_0x38ce('0x30')]>0x0){_0x33f6a6=_[_0x38ce('0x44')](_0xaf99ce,_0xd95bc8);}return _0x33f6a6;}function getCustomFields(_0x32355a,_0x5669f7){var _0x9f9ae=[];var _0x111073={'custom_fields':[]};if(_0x32355a[_0x38ce('0x30')]>0x0){_[_0x38ce('0x1c')](_0x32355a,function(_0x1e9073){if(_0x1e9073[_0x38ce('0x45')]==='string'&&_0x1e9073[_0x38ce('0x46')]&&!_0x1e9073[_0x38ce('0x47')]){_0x111073[_0x1e9073['nameField']['toLowerCase']()]=_0x1e9073['content'][_0x38ce('0x27')]();}else if(_0x1e9073[_0x38ce('0x45')]==='string'&&_0x1e9073['idField']&&_0x1e9073[_0x38ce('0x47')]){_0x111073['custom_fields'][_0x38ce('0x1e')]({'id':_0x1e9073['idField'],'value':_0x1e9073[_0x38ce('0x48')][_0x38ce('0x27')]()});}else if(_0x1e9073['type']===_0x38ce('0x49')&&_0x1e9073[_0x38ce('0x1d')]&&_0x1e9073['idField']&&_0x1e9073[_0x38ce('0x47')]){_0x5669f7[_0x1e9073[_0x38ce('0x1d')]]&&_0x111073[_0x38ce('0x4a')][_0x38ce('0x1e')]({'id':_0x1e9073[_0x38ce('0x1f')],'value':_0x5669f7[_0x1e9073[_0x38ce('0x1d')]]['toString']()});}else if(_0x1e9073[_0x38ce('0x45')]===_0x38ce('0x4b')&&_0x1e9073['Variable']&&_0x1e9073[_0x38ce('0x4c')][_0x38ce('0xe')]&&_0x1e9073[_0x38ce('0x1f')]&&_0x1e9073[_0x38ce('0x47')]){_0x5669f7[_0x1e9073[_0x38ce('0x4c')][_0x38ce('0xe')][_0x38ce('0x4d')]()]&&_0x111073['custom_fields'][_0x38ce('0x1e')]({'id':_0x1e9073[_0x38ce('0x1f')],'value':_0x5669f7[_0x1e9073[_0x38ce('0x4c')][_0x38ce('0xe')][_0x38ce('0x4d')]()][_0x38ce('0x27')]()});}});}return _0x111073;}function getConnection(_0x5f145d){return request({'method':'POST','form':{'method':_0x38ce('0x4e'),'input_type':_0x38ce('0x21'),'response_type':_0x38ce('0x21'),'rest_data':JSON[_0x38ce('0x22')]({'user_auth':{'user_name':_0x5f145d[_0x38ce('0x4f')],'password':_0x5f145d[_0x38ce('0x50')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x38ce('0x2e')](function(_0x480c26){var _0x5a2348=_0x480c26;if(_0x5a2348['id']){def[_0x38ce('0x51')]=_0x5a2348['id'];return BPromise[_0x38ce('0x34')](_0x5a2348);}else{throw new Error(util[_0x38ce('0x24')](_0x38ce('0x52'),_0x5f145d['id']));}});}function setRelationship(_0xd031c0,_0x56b466,_0x6cd0d7,_0x36a513){return request({'form':{'method':_0x38ce('0x53'),'input_type':_0x38ce('0x21'),'response_type':_0x38ce('0x21'),'rest_data':JSON[_0x38ce('0x22')]({'session':_0xd031c0['id'],'module_name':_0x38ce('0x23'),'module_id':_0x6cd0d7['id'],'link_field_name':_0x36a513,'related_ids':[_0x56b466['id']]})}});}exports[_0x38ce('0x54')]=function(_0xdc8304,_0x38eb66,_0x2db125,_0x56d63e,_0x5d1df1,_0x40564c){var _0x2ff4b4,_0x131b5a,_0xf6ea82,_0x52e352;_0x40564c[_0x38ce('0x55')]=intUtil[_0x38ce('0x56')](_0x40564c[_0x38ce('0x55')]);_0x40564c[_0x38ce('0x57')]=intUtil[_0x38ce('0x56')](_0x40564c[_0x38ce('0x57')]);def[_0x38ce('0x58')]=util['format'](_0x38ce('0x59'),_0x40564c[_0x38ce('0x55')]);if(_0x5d1df1&&_0x5d1df1['monitor_format']){logger['info'](_0x38ce('0x5a'),_0x38ce('0x5b'));_0x38eb66[_0x38ce('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x40564c[_0x38ce('0x57')],_0x38eb66['uniqueid'],md5(_0x38eb66[_0x38ce('0x5d')]));}else{_0x38eb66[_0x38ce('0x5c')]='';}return getConnection(_0x40564c)[_0x38ce('0x2e')](function(_0x2b3982){_0x52e352=_0x2b3982;return getUser(_0x40564c,_0x56d63e['name'],_0x52e352);})[_0x38ce('0x2e')](function(_0x7e6edc){_0x2ff4b4=_0x7e6edc;logger[_0x38ce('0xc')]('The\x20User\x20ID\x20is:',_0x2ff4b4['id']);return getEndUser(_0x40564c,_0x38eb66[_0x38ce('0x5e')],_0x38eb66[_0x38ce('0x5f')],_0x52e352);})[_0x38ce('0x2e')](function(_0x55ccd9){_0x131b5a=_0x55ccd9;logger[_0x38ce('0xc')]('The\x20Enduser\x20ID\x20is:',_0x131b5a['id']);return getTicket(_0x40564c,_0x2ff4b4,_0x131b5a,_0x2db125,_0x38eb66,_0x2db125[_0x38ce('0x60')],_0x52e352,'Inbound');})[_0x38ce('0x2e')](function(_0x167ec1){_0xf6ea82=_0x167ec1;logger[_0x38ce('0xc')](_0x38ce('0x61'));logger['info'](_0x38ce('0x62'),_0xf6ea82['id']);return setRelationship(_0x52e352,_0x2ff4b4,_0xf6ea82,_0x38ce('0x63'));})[_0x38ce('0x2e')](function(){return setRelationship(_0x52e352,_0x131b5a,_0xf6ea82,_0x38ce('0x64'));})[_0x38ce('0x2e')](function(){return getServerInfo(_0x52e352);})[_0x38ce('0x2e')](function(_0x5b8fb5){var _0x3ffc0a=parseInt(_0x5b8fb5['version'][_0x38ce('0x65')](0x0));var _0xac088c=util[_0x38ce('0x24')](_0x38ce('0x66'),_0x40564c[_0x38ce('0x55')],_0xf6ea82['id']);if(_0x3ffc0a>0x6){_0xac088c=util[_0x38ce('0x24')](_0x38ce('0x67'),_0x40564c[_0x38ce('0x55')],_0xf6ea82['id']);}logger['info'](_0x38ce('0x5a'),_0x38ce('0x68'));emit(util[_0x38ce('0x24')](_0x38ce('0x69'),_0x56d63e[_0x38ce('0xe')]),_0x38ce('0x6a'),{'uri':_0xac088c});})[_0x38ce('0x6b')](function(_0x2049c1){logger[_0x38ce('0x6c')](_0x38ce('0x5a'),JSON[_0x38ce('0x22')](_0x2049c1));});};exports[_0x38ce('0x6d')]=function(_0xa54a6d,_0x1ce54d,_0x3a68e9,_0xc5e2c6,_0x184c88,_0x1ef218,_0x2db3c5){var _0x2d79c2,_0x537c6f,_0x277a39,_0x3e9a49;_0x1ef218[_0x38ce('0x55')]=intUtil['stripTrailingSlash'](_0x1ef218['remoteUri']);_0x1ef218[_0x38ce('0x57')]=intUtil[_0x38ce('0x56')](_0x1ef218['serverUrl']);def[_0x38ce('0x58')]=util[_0x38ce('0x24')]('%s/service/v4_1/rest.php',_0x1ef218['remoteUri']);if(_0x2db3c5&&_0x2db3c5[_0x38ce('0x6e')]&&_0x2db3c5[_0x38ce('0x6e')]!=='none'){logger[_0x38ce('0xc')](_0x38ce('0x6f'),_0x38ce('0x5b'));_0x1ce54d[_0x38ce('0x5c')]=util[_0x38ce('0x24')](_0x38ce('0x70'),_0x1ef218[_0x38ce('0x57')],_0x1ce54d[_0x38ce('0x5d')],md5(_0x1ce54d['uniqueid']));}return getConnection(_0x1ef218)[_0x38ce('0x2e')](function(_0x2567cf){_0x3e9a49=_0x2567cf;return getUser(_0x1ef218,_0xc5e2c6[_0x38ce('0xe')],_0x3e9a49);})[_0x38ce('0x2e')](function(_0x1ad928){_0x2d79c2=_0x1ad928;logger[_0x38ce('0xc')](_0x38ce('0x71'),_0x2d79c2['id']);return getEndUser(_0x1ef218,_0x1ce54d['destcalleridname'],_0x1ce54d['destcalleridnum'],_0x3e9a49);})['then'](function(_0xeb038d){_0x537c6f=_0xeb038d;logger[_0x38ce('0xc')](_0x38ce('0x72'),_0x537c6f['id']);return getTicket(_0x1ef218,_0x2d79c2,_0x537c6f,_0x3a68e9,_0x1ce54d,_0x3a68e9[_0x38ce('0x60')],_0x3e9a49,_0x38ce('0x73'));})[_0x38ce('0x2e')](function(_0x41bcdf){_0x277a39=_0x41bcdf;logger['info'](_0x38ce('0x61'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x277a39['id']);return setRelationship(_0x3e9a49,_0x2d79c2,_0x277a39,'users');})[_0x38ce('0x2e')](function(){return setRelationship(_0x3e9a49,_0x537c6f,_0x277a39,_0x38ce('0x64'));})[_0x38ce('0x2e')](function(){return getServerInfo(_0x3e9a49);})['then'](function(_0xcb7953){var _0x444c8b=parseInt(_0xcb7953[_0x38ce('0x74')][_0x38ce('0x65')](0x0));var _0x32a8e3=util['format'](_0x38ce('0x66'),_0x1ef218['remoteUri'],_0x277a39['id']);if(_0x444c8b>0x6){_0x32a8e3=util[_0x38ce('0x24')](_0x38ce('0x67'),_0x1ef218['remoteUri'],_0x277a39['id']);}logger[_0x38ce('0xc')](_0x38ce('0x6f'),_0x38ce('0x68'));emit(util[_0x38ce('0x24')]('user:%s',_0xc5e2c6['name']),'trigger:browser:url',{'uri':_0x32a8e3});})['catch'](function(_0x4961b8){logger['error'](_0x38ce('0x6f'),JSON[_0x38ce('0x22')](_0x4961b8));});};exports[_0x38ce('0x75')]=function(_0x3e493b,_0x524a4b,_0x5be2e5,_0x42fc72,_0x49584f,_0x2b34b2){var _0x2ead23,_0x3f34f2,_0xe2569e,_0x169fff;_0x2b34b2[_0x38ce('0x55')]=intUtil[_0x38ce('0x56')](_0x2b34b2[_0x38ce('0x55')]);_0x2b34b2[_0x38ce('0x57')]=intUtil['stripTrailingSlash'](_0x2b34b2[_0x38ce('0x57')]);def[_0x38ce('0x58')]=util[_0x38ce('0x24')]('%s/service/v4_1/rest.php',_0x2b34b2['remoteUri']);if(_0x49584f&&_0x49584f['monitor_format']){logger[_0x38ce('0xc')](_0x38ce('0x76'),_0x38ce('0x5b'));_0x524a4b[_0x38ce('0x5c')]=util[_0x38ce('0x24')](_0x38ce('0x70'),_0x2b34b2[_0x38ce('0x57')],_0x524a4b[_0x38ce('0x5d')],md5(_0x524a4b[_0x38ce('0x5d')]));}else{_0x524a4b[_0x38ce('0x5c')]='';}return getConnection(_0x2b34b2)[_0x38ce('0x2e')](function(_0x443dc2){_0x169fff=_0x443dc2;if(!_[_0x38ce('0x2a')](_0x42fc72)){return getUser(_0x2b34b2,_0x42fc72[_0x38ce('0xe')],_0x169fff);}else{return getUser(_0x2b34b2,null,_0x169fff);}})[_0x38ce('0x2e')](function(_0x372672){_0x2ead23=_0x372672;logger[_0x38ce('0xc')](_0x38ce('0x71'),_0x2ead23['id']);return getEndUser(_0x2b34b2,_0x524a4b[_0x38ce('0x5e')],_0x524a4b[_0x38ce('0x5f')],_0x169fff);})['then'](function(_0x160f75){_0x3f34f2=_0x160f75;logger[_0x38ce('0xc')](_0x38ce('0x72'),_0x3f34f2['id']);return getTicket(_0x2b34b2,_0x2ead23,_0x3f34f2,_0x5be2e5,_0x524a4b,_0x5be2e5['Fields'],_0x169fff,_0x38ce('0x77'));})[_0x38ce('0x2e')](function(_0x4343fd){_0xe2569e=_0x4343fd;logger[_0x38ce('0xc')]('Ticket\x20created!');logger[_0x38ce('0xc')](_0x38ce('0x62'),_0xe2569e['id']);return setRelationship(_0x169fff,_0x2ead23,_0xe2569e,_0x38ce('0x63'));})[_0x38ce('0x2e')](function(){return setRelationship(_0x169fff,_0x3f34f2,_0xe2569e,'contacts');})[_0x38ce('0x2e')](function(){return getServerInfo(_0x169fff);})[_0x38ce('0x6b')](function(_0x2952f6){logger[_0x38ce('0x6c')](_0x38ce('0x76'),JSON[_0x38ce('0x22')](_0x2952f6));});}; \ No newline at end of file +var _0x8e3b=['request-promise','md5','util','sugarcrm','defaults','redis','localhost','POST','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','parent_name','length','forEach','variableName','idField','JSON','format','Basic\x20%s','apiKey','base64','get_server_info','stringify','isNil','Employees','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Contacts','first_name','Caller\x20-\x20%s','[HTTP]','merge','map','nameField','customField','toLowerCase','content','string','push','toString','type','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','queue','remoteUri','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','stripTrailingSlash','recordingFormat','destcalleridnum','Outbound','error','[ABANDONED]','calleridname','lodash'];(function(_0x3363de,_0x4bcc0f){var _0x119cc8=function(_0x127feb){while(--_0x127feb){_0x3363de['push'](_0x3363de['shift']());}};_0x119cc8(++_0x4bcc0f);}(_0x8e3b,0xd3));var _0xb8e3=function(_0x5300b6,_0x4a5846){_0x5300b6=_0x5300b6-0x0;var _0x58980e=_0x8e3b[_0x5300b6];return _0x58980e;};'use strict';var _=require(_0xb8e3('0x0'));var rp=require(_0xb8e3('0x1'));var BPromise=require('bluebird');var md5=require(_0xb8e3('0x2'));var util=require(_0xb8e3('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xb8e3('0x4'));config['redis']=_[_0xb8e3('0x5')](config[_0xb8e3('0x6')],{'host':_0xb8e3('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb8e3('0x6')]));var def={'method':_0xb8e3('0x8'),'json':!![]};function emit(_0x302a9d,_0x11f981,_0x3cd96d){io['to'](_0x302a9d)['emit'](_0x11f981,_0x3cd96d);}function getTicket(_0x364afe,_0x43be56,_0x31a453,_0x27bfc2,_0x1d1c1d,_0x49a0b6,_0x2ecc56,_0xc150cf){logger[_0xb8e3('0x9')]('Creating\x20new\x20ticket...');var _0x4af20d=new Date();var _0xdfc10f=[{'name':_0xb8e3('0xa'),'value':intUtil[_0xb8e3('0xb')](_0x27bfc2[_0xb8e3('0xc')],_0x1d1c1d,'\x20')},{'name':_0xb8e3('0xd'),'value':_0x43be56['id']},{'name':_0xb8e3('0xe'),'value':_0x43be56['id']},{'name':_0xb8e3('0xf'),'value':intUtil[_0xb8e3('0xb')](_0x27bfc2[_0xb8e3('0x10')],_0x1d1c1d,'\x0a')},{'name':_0xb8e3('0x11'),'value':_0x4af20d[_0xb8e3('0x12')]()[_0xb8e3('0x13')](0x0,0x13)[_0xb8e3('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x31a453['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xb8e3('0x15'),'value':_0x31a453[_0xb8e3('0xa')]},{'name':'direction','value':_0xc150cf}];if(_0x49a0b6[_0xb8e3('0x16')]){_[_0xb8e3('0x17')](_0x49a0b6,function(_0x5d0cf3){if(_0x1d1c1d[_0x5d0cf3[_0xb8e3('0x18')]]){_0xdfc10f['push']({'name':_0x5d0cf3[_0xb8e3('0x19')],'value':_0x1d1c1d[_0x5d0cf3[_0xb8e3('0x18')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xb8e3('0x1a'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2ecc56['id'],'module_name':'Calls','name_value_list':_0xdfc10f})}});}function getAuth(_0x20c614){return util[_0xb8e3('0x1b')](_0xb8e3('0x1c'),new Buffer(_0x20c614[_0xb8e3('0x1d')]+':X')['toString'](_0xb8e3('0x1e')));}function getServerInfo(_0xfbef8){return request({'form':{'method':_0xb8e3('0x1f'),'input_type':_0xb8e3('0x1a'),'response_type':'JSON','rest_data':JSON[_0xb8e3('0x20')]({'session':_0xfbef8['id']})}});}function getUser(_0x2a4b38,_0x41c545,_0x187f13){if(!_[_0xb8e3('0x21')](_0x41c545)){logger[_0xb8e3('0x9')]('Getting\x20agent\x20with\x20name',_0x41c545);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x187f13['id'],'module_name':_0xb8e3('0x22'),'query':util[_0xb8e3('0x1b')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x41c545),'order_by':'','offset':'0','select_fields':['id','name',_0xb8e3('0x23')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb8e3('0x24')](function(_0x3d52d8){if(_0x3d52d8[_0xb8e3('0x25')][_0xb8e3('0x16')]){var _0x332357=_[_0xb8e3('0x26')](_0x3d52d8[_0xb8e3('0x25')],function(_0x3a4bc2){return _0x3a4bc2[_0xb8e3('0x27')][_0xb8e3('0x23')][_0xb8e3('0x28')]===_0x41c545;});if(_0x332357){logger[_0xb8e3('0x9')](_0xb8e3('0x29'));return BPromise[_0xb8e3('0x2a')]({'id':_0x332357[_0xb8e3('0x27')]['id'][_0xb8e3('0x28')],'name':_0x332357['name_value_list'][_0xb8e3('0xa')][_0xb8e3('0x28')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb8e3('0x2a')]({'id':_0x187f13[_0xb8e3('0x27')][_0xb8e3('0x2b')][_0xb8e3('0x28')],'name':_0x187f13[_0xb8e3('0x27')][_0xb8e3('0x23')][_0xb8e3('0x28')]});});}else{logger[_0xb8e3('0x9')](_0xb8e3('0x2c'));return BPromise['resolve']({'id':_0x187f13[_0xb8e3('0x27')]['user_id'][_0xb8e3('0x28')],'name':_0x187f13['name_value_list'][_0xb8e3('0x23')]['value']});}}function getEndUser(_0x3954cc,_0x2803a3,_0x1fb117,_0x4656c9){logger[_0xb8e3('0x9')]('Searching\x20enduser\x20with\x20phone',_0x1fb117);return request({'form':{'method':_0xb8e3('0x2d'),'input_type':_0xb8e3('0x1a'),'response_type':_0xb8e3('0x1a'),'rest_data':JSON['stringify']({'session':_0x4656c9['id'],'module_name':'Contacts','query':util['format'](_0xb8e3('0x2e'),_0x1fb117),'order_by':'','offset':'0','select_fields':['id',_0xb8e3('0xa'),_0xb8e3('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb8e3('0x24')](function(_0x44f0ea){if(_0x44f0ea['entry_list'][_0xb8e3('0x16')]){var _0x56d6d1=_['find'](_0x44f0ea['entry_list'],function(_0x2e6ee6){return _0x2e6ee6[_0xb8e3('0x27')][_0xb8e3('0x2f')]['value']===_0x1fb117;});if(_0x56d6d1){logger['info'](_0xb8e3('0x30'));return BPromise[_0xb8e3('0x2a')]({'id':_0x56d6d1[_0xb8e3('0x27')]['id'][_0xb8e3('0x28')],'name':_0x56d6d1[_0xb8e3('0x27')][_0xb8e3('0xa')][_0xb8e3('0x28')],'phone':_0x56d6d1[_0xb8e3('0x27')][_0xb8e3('0x2f')][_0xb8e3('0x28')]});}}else{logger[_0xb8e3('0x9')](_0xb8e3('0x31'));return request({'form':{'method':_0xb8e3('0x32'),'input_type':_0xb8e3('0x1a'),'response_type':_0xb8e3('0x1a'),'rest_data':JSON[_0xb8e3('0x20')]({'session':_0x4656c9['id'],'module_name':_0xb8e3('0x33'),'name_value_list':[{'name':_0xb8e3('0x34'),'value':_0x2803a3!==''?_0x2803a3:util[_0xb8e3('0x1b')](_0xb8e3('0x35'),_0x1fb117)},{'name':_0xb8e3('0x2f'),'value':_0x1fb117}]})}})[_0xb8e3('0x24')](function(_0x725a8e){logger[_0xb8e3('0x9')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x725a8e['id'],'name':_0x725a8e[_0xb8e3('0x25')][_0xb8e3('0x34')][_0xb8e3('0x28')],'phone':_0x725a8e[_0xb8e3('0x25')][_0xb8e3('0x2f')][_0xb8e3('0x28')]});});}});}function request(_0x1082a2){logger['debug'](_0xb8e3('0x36'),JSON['stringify'](_0x1082a2));return rp(_[_0xb8e3('0x37')](def,_0x1082a2));}function getTags(_0xa3c833,_0x37423d){var _0x332b11=[];if(_0xa3c833&&_0xa3c833[_0xb8e3('0x16')]>0x0){_0x332b11=_[_0xb8e3('0x38')](_0xa3c833,_0x37423d);}return _0x332b11;}function getCustomFields(_0x1d7efd,_0x4b7bfd){var _0x14b560=[];var _0x43bf9c={'custom_fields':[]};if(_0x1d7efd[_0xb8e3('0x16')]>0x0){_[_0xb8e3('0x17')](_0x1d7efd,function(_0x26812c){if(_0x26812c['type']==='string'&&_0x26812c[_0xb8e3('0x39')]&&!_0x26812c[_0xb8e3('0x3a')]){_0x43bf9c[_0x26812c[_0xb8e3('0x39')][_0xb8e3('0x3b')]()]=_0x26812c[_0xb8e3('0x3c')]['toString']();}else if(_0x26812c['type']===_0xb8e3('0x3d')&&_0x26812c[_0xb8e3('0x19')]&&_0x26812c[_0xb8e3('0x3a')]){_0x43bf9c['custom_fields'][_0xb8e3('0x3e')]({'id':_0x26812c[_0xb8e3('0x19')],'value':_0x26812c[_0xb8e3('0x3c')][_0xb8e3('0x3f')]()});}else if(_0x26812c[_0xb8e3('0x40')]==='variable'&&_0x26812c[_0xb8e3('0x18')]&&_0x26812c[_0xb8e3('0x19')]&&_0x26812c['customField']){_0x4b7bfd[_0x26812c[_0xb8e3('0x18')]]&&_0x43bf9c[_0xb8e3('0x41')][_0xb8e3('0x3e')]({'id':_0x26812c[_0xb8e3('0x19')],'value':_0x4b7bfd[_0x26812c[_0xb8e3('0x18')]]['toString']()});}else if(_0x26812c[_0xb8e3('0x40')]===_0xb8e3('0x42')&&_0x26812c[_0xb8e3('0x43')]&&_0x26812c[_0xb8e3('0x43')][_0xb8e3('0xa')]&&_0x26812c[_0xb8e3('0x19')]&&_0x26812c[_0xb8e3('0x3a')]){_0x4b7bfd[_0x26812c[_0xb8e3('0x43')]['name']['toLowerCase']()]&&_0x43bf9c['custom_fields'][_0xb8e3('0x3e')]({'id':_0x26812c['idField'],'value':_0x4b7bfd[_0x26812c[_0xb8e3('0x43')]['name'][_0xb8e3('0x3b')]()][_0xb8e3('0x3f')]()});}});}return _0x43bf9c;}function getConnection(_0x5871ee){return request({'method':_0xb8e3('0x8'),'form':{'method':_0xb8e3('0x44'),'input_type':_0xb8e3('0x1a'),'response_type':_0xb8e3('0x1a'),'rest_data':JSON[_0xb8e3('0x20')]({'user_auth':{'user_name':_0x5871ee[_0xb8e3('0x45')],'password':_0x5871ee[_0xb8e3('0x46')],'encryption':_0xb8e3('0x47')},'application':_0xb8e3('0x48')})}})[_0xb8e3('0x24')](function(_0x4a7a3c){var _0x5b3e84=_0x4a7a3c;if(_0x5b3e84['id']){def['sessionID']=_0x5b3e84['id'];return BPromise[_0xb8e3('0x2a')](_0x5b3e84);}else{throw new Error(util[_0xb8e3('0x1b')]('Account\x20%d\x20is\x20not\x20valid',_0x5871ee['id']));}});}function setRelationship(_0x53fbc9,_0x76140f,_0x522f65,_0x14a150){return request({'form':{'method':'set_relationship','input_type':_0xb8e3('0x1a'),'response_type':'JSON','rest_data':JSON[_0xb8e3('0x20')]({'session':_0x53fbc9['id'],'module_name':'Calls','module_id':_0x522f65['id'],'link_field_name':_0x14a150,'related_ids':[_0x76140f['id']]})}});}exports[_0xb8e3('0x49')]=function(_0x5b85fd,_0x35c6d5,_0x126e7c,_0x599b49,_0x41d2e2,_0x135e09){var _0x13d15b,_0xe46c8a,_0x5c8d7b,_0x18c366;_0x135e09[_0xb8e3('0x4a')]=intUtil['stripTrailingSlash'](_0x135e09[_0xb8e3('0x4a')]);_0x135e09['serverUrl']=intUtil['stripTrailingSlash'](_0x135e09['serverUrl']);def[_0xb8e3('0x4b')]=util['format'](_0xb8e3('0x4c'),_0x135e09[_0xb8e3('0x4a')]);if(_0x41d2e2&&_0x41d2e2[_0xb8e3('0x4d')]){logger[_0xb8e3('0x9')](_0xb8e3('0x4e'),_0xb8e3('0x4f'));_0x35c6d5[_0xb8e3('0x50')]=util[_0xb8e3('0x1b')](_0xb8e3('0x51'),_0x135e09[_0xb8e3('0x52')],_0x35c6d5[_0xb8e3('0x53')],md5(_0x35c6d5[_0xb8e3('0x53')]));}else{_0x35c6d5[_0xb8e3('0x50')]='';}return getConnection(_0x135e09)[_0xb8e3('0x24')](function(_0x5e70f5){_0x18c366=_0x5e70f5;return getUser(_0x135e09,_0x599b49[_0xb8e3('0xa')],_0x18c366);})[_0xb8e3('0x24')](function(_0x217dce){_0x13d15b=_0x217dce;logger['info'](_0xb8e3('0x54'),_0x13d15b['id']);return getEndUser(_0x135e09,_0x35c6d5['calleridname'],_0x35c6d5[_0xb8e3('0x55')],_0x18c366);})[_0xb8e3('0x24')](function(_0x342cab){_0xe46c8a=_0x342cab;logger['info'](_0xb8e3('0x56'),_0xe46c8a['id']);return getTicket(_0x135e09,_0x13d15b,_0xe46c8a,_0x126e7c,_0x35c6d5,_0x126e7c[_0xb8e3('0x57')],_0x18c366,'Inbound');})['then'](function(_0x2cc38a){_0x5c8d7b=_0x2cc38a;logger[_0xb8e3('0x9')](_0xb8e3('0x58'));logger[_0xb8e3('0x9')](_0xb8e3('0x59'),_0x5c8d7b['id']);return setRelationship(_0x18c366,_0x13d15b,_0x5c8d7b,_0xb8e3('0x5a'));})[_0xb8e3('0x24')](function(){return setRelationship(_0x18c366,_0xe46c8a,_0x5c8d7b,_0xb8e3('0x5b'));})[_0xb8e3('0x24')](function(){return getServerInfo(_0x18c366);})['then'](function(_0xc1b0ed){var _0x57ea37=parseInt(_0xc1b0ed['version']['charAt'](0x0));var _0xede297=util[_0xb8e3('0x1b')](_0xb8e3('0x5c'),_0x135e09['remoteUri'],_0x5c8d7b['id']);if(_0x57ea37>0x6){_0xede297=util[_0xb8e3('0x1b')](_0xb8e3('0x5d'),_0x135e09['remoteUri'],_0x5c8d7b['id']);}logger[_0xb8e3('0x9')](_0xb8e3('0x4e'),_0xb8e3('0x5e'));emit(util[_0xb8e3('0x1b')](_0xb8e3('0x5f'),_0x599b49[_0xb8e3('0xa')]),_0xb8e3('0x60'),{'uri':_0xede297});})[_0xb8e3('0x61')](function(_0x5e5763){logger['error'](_0xb8e3('0x4e'),JSON[_0xb8e3('0x20')](_0x5e5763));});};exports[_0xb8e3('0x62')]=function(_0x4c84e7,_0xd3f01e,_0x3a6e39,_0xf95b72,_0x1844b5,_0x389fb4,_0x2781e4){var _0x4e11e5,_0x2a0d00,_0x23001d,_0x574e6c;_0x389fb4[_0xb8e3('0x4a')]=intUtil[_0xb8e3('0x63')](_0x389fb4[_0xb8e3('0x4a')]);_0x389fb4[_0xb8e3('0x52')]=intUtil['stripTrailingSlash'](_0x389fb4[_0xb8e3('0x52')]);def[_0xb8e3('0x4b')]=util[_0xb8e3('0x1b')](_0xb8e3('0x4c'),_0x389fb4[_0xb8e3('0x4a')]);if(_0x2781e4&&_0x2781e4[_0xb8e3('0x64')]&&_0x2781e4[_0xb8e3('0x64')]!=='none'){logger[_0xb8e3('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xd3f01e[_0xb8e3('0x50')]=util[_0xb8e3('0x1b')](_0xb8e3('0x51'),_0x389fb4['serverUrl'],_0xd3f01e[_0xb8e3('0x53')],md5(_0xd3f01e['uniqueid']));}return getConnection(_0x389fb4)[_0xb8e3('0x24')](function(_0x333b7e){_0x574e6c=_0x333b7e;return getUser(_0x389fb4,_0xf95b72[_0xb8e3('0xa')],_0x574e6c);})[_0xb8e3('0x24')](function(_0x46bfc9){_0x4e11e5=_0x46bfc9;logger[_0xb8e3('0x9')](_0xb8e3('0x54'),_0x4e11e5['id']);return getEndUser(_0x389fb4,_0xd3f01e['destcalleridname'],_0xd3f01e[_0xb8e3('0x65')],_0x574e6c);})[_0xb8e3('0x24')](function(_0x5b9654){_0x2a0d00=_0x5b9654;logger['info'](_0xb8e3('0x56'),_0x2a0d00['id']);return getTicket(_0x389fb4,_0x4e11e5,_0x2a0d00,_0x3a6e39,_0xd3f01e,_0x3a6e39[_0xb8e3('0x57')],_0x574e6c,_0xb8e3('0x66'));})[_0xb8e3('0x24')](function(_0x24333b){_0x23001d=_0x24333b;logger['info']('Ticket\x20created!');logger[_0xb8e3('0x9')]('The\x20Ticket\x20ID\x20is:',_0x23001d['id']);return setRelationship(_0x574e6c,_0x4e11e5,_0x23001d,_0xb8e3('0x5a'));})['then'](function(){return setRelationship(_0x574e6c,_0x2a0d00,_0x23001d,_0xb8e3('0x5b'));})['then'](function(){return getServerInfo(_0x574e6c);})[_0xb8e3('0x24')](function(_0x3d218c){var _0x17c405=parseInt(_0x3d218c['version']['charAt'](0x0));var _0x7d64a2=util[_0xb8e3('0x1b')](_0xb8e3('0x5c'),_0x389fb4['remoteUri'],_0x23001d['id']);if(_0x17c405>0x6){_0x7d64a2=util[_0xb8e3('0x1b')](_0xb8e3('0x5d'),_0x389fb4[_0xb8e3('0x4a')],_0x23001d['id']);}logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xb8e3('0x5f'),_0xf95b72[_0xb8e3('0xa')]),_0xb8e3('0x60'),{'uri':_0x7d64a2});})[_0xb8e3('0x61')](function(_0x40ec4){logger[_0xb8e3('0x67')]('[OUTBOUND]',JSON['stringify'](_0x40ec4));});};exports['abandoned']=function(_0x8c9f69,_0x3161fd,_0xcdc70f,_0x2a93f7,_0x96de40,_0x5765c2){var _0x6a1294,_0x2abd6c,_0x274c6e,_0x26e018;_0x5765c2[_0xb8e3('0x4a')]=intUtil[_0xb8e3('0x63')](_0x5765c2['remoteUri']);_0x5765c2[_0xb8e3('0x52')]=intUtil['stripTrailingSlash'](_0x5765c2[_0xb8e3('0x52')]);def[_0xb8e3('0x4b')]=util[_0xb8e3('0x1b')](_0xb8e3('0x4c'),_0x5765c2[_0xb8e3('0x4a')]);if(_0x96de40&&_0x96de40['monitor_format']){logger[_0xb8e3('0x9')](_0xb8e3('0x68'),_0xb8e3('0x4f'));_0x3161fd[_0xb8e3('0x50')]=util[_0xb8e3('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5765c2[_0xb8e3('0x52')],_0x3161fd[_0xb8e3('0x53')],md5(_0x3161fd[_0xb8e3('0x53')]));}else{_0x3161fd[_0xb8e3('0x50')]='';}return getConnection(_0x5765c2)[_0xb8e3('0x24')](function(_0x4e7de8){_0x26e018=_0x4e7de8;if(!_[_0xb8e3('0x21')](_0x2a93f7)){return getUser(_0x5765c2,_0x2a93f7[_0xb8e3('0xa')],_0x26e018);}else{return getUser(_0x5765c2,null,_0x26e018);}})[_0xb8e3('0x24')](function(_0x269283){_0x6a1294=_0x269283;logger['info']('The\x20User\x20ID\x20is:',_0x6a1294['id']);return getEndUser(_0x5765c2,_0x3161fd[_0xb8e3('0x69')],_0x3161fd['calleridnum'],_0x26e018);})[_0xb8e3('0x24')](function(_0x5eb46c){_0x2abd6c=_0x5eb46c;logger[_0xb8e3('0x9')](_0xb8e3('0x56'),_0x2abd6c['id']);return getTicket(_0x5765c2,_0x6a1294,_0x2abd6c,_0xcdc70f,_0x3161fd,_0xcdc70f[_0xb8e3('0x57')],_0x26e018,'Inbound');})['then'](function(_0x55fd8d){_0x274c6e=_0x55fd8d;logger[_0xb8e3('0x9')](_0xb8e3('0x58'));logger['info'](_0xb8e3('0x59'),_0x274c6e['id']);return setRelationship(_0x26e018,_0x6a1294,_0x274c6e,_0xb8e3('0x5a'));})['then'](function(){return setRelationship(_0x26e018,_0x2abd6c,_0x274c6e,_0xb8e3('0x5b'));})['then'](function(){return getServerInfo(_0x26e018);})[_0xb8e3('0x61')](function(_0x1bd8a0){logger['error'](_0xb8e3('0x68'),JSON[_0xb8e3('0x20')](_0x1bd8a0));});}; \ 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 ff6374e..e854bf7 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 _0xc6b9=['keyValue','string','key','%s:\x20%s','keyType','format','customVariable','join','slice','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','type','content','variable','variableName','push','toString','Variable','name','toLowerCase'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0xc6b9,0xd5));var _0x9c6b=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xc6b9[_0xf2628e];return _0x13863a;};'use strict';var _=require(_0x9c6b('0x0'));var util=require('util');exports[_0x9c6b('0x1')]=function(_0xf17beb,_0x5c8433,_0x141c80){var _0xfb92a7=[];if(_0xf17beb[_0x9c6b('0x2')]>0x0){var _0xfd4800=_['sortBy'](_0xf17beb,['id']);for(var _0x428d78=0x0;_0x428d78<_0xfd4800[_0x9c6b('0x2')];_0x428d78++){var _0x2f314f=_0xfd4800[_0x428d78];if(_0x2f314f[_0x9c6b('0x3')]==='string'){_0xfb92a7['push'](_0x2f314f[_0x9c6b('0x4')]);}else if(_0x2f314f[_0x9c6b('0x3')]===_0x9c6b('0x5')&&_0x2f314f[_0x9c6b('0x6')]){_0x5c8433[_0x2f314f[_0x9c6b('0x6')]]&&_0xfb92a7[_0x9c6b('0x7')](_0x5c8433[_0x2f314f[_0x9c6b('0x6')]][_0x9c6b('0x8')]());}else if(_0x2f314f[_0x9c6b('0x3')]==='customVariable'&&_0x2f314f[_0x9c6b('0x9')]&&_0x2f314f[_0x9c6b('0x9')][_0x9c6b('0xa')]){_0x5c8433[_0x2f314f[_0x9c6b('0x9')][_0x9c6b('0xa')][_0x9c6b('0xb')]()]&&_0xfb92a7['push'](_0x5c8433[_0x2f314f[_0x9c6b('0x9')][_0x9c6b('0xa')][_0x9c6b('0xb')]()][_0x9c6b('0x8')]());}else if(_0x2f314f['type']===_0x9c6b('0xc')){if(_0x2f314f['keyType']===_0x9c6b('0xd')&&_0x2f314f[_0x9c6b('0xe')]){_0xfb92a7[_0x9c6b('0x7')](util['format'](_0x9c6b('0xf'),_0x2f314f[_0x9c6b('0xe')],_0x2f314f['keyContent']));}else if(_0x2f314f[_0x9c6b('0x10')]===_0x9c6b('0x5')&&_0x2f314f['variableName']&&_0x2f314f[_0x9c6b('0xe')]){_0x5c8433[_0x2f314f[_0x9c6b('0x6')]]&&_0xfb92a7[_0x9c6b('0x7')](util[_0x9c6b('0x11')](_0x9c6b('0xf'),_0x2f314f['key'],_0x5c8433[_0x2f314f[_0x9c6b('0x6')]]));}else if(_0x2f314f[_0x9c6b('0x10')]===_0x9c6b('0x12')&&_0x2f314f[_0x9c6b('0x9')]&&_0x2f314f[_0x9c6b('0x9')][_0x9c6b('0xa')]&&_0x2f314f[_0x9c6b('0xe')]){_0x5c8433[_0x2f314f[_0x9c6b('0x9')][_0x9c6b('0xa')][_0x9c6b('0xb')]()]&&_0xfb92a7[_0x9c6b('0x7')](util[_0x9c6b('0x11')]('%s:\x20%s',_0x2f314f[_0x9c6b('0xe')],_0x5c8433[_0x2f314f[_0x9c6b('0x9')][_0x9c6b('0xa')][_0x9c6b('0xb')]()]));}}}}return _0xfb92a7[_0x9c6b('0x13')](_0x141c80);};exports['stripTrailingSlash']=function(_0x5cd45e){var _0x3961b3=_0x5cd45e[_0x9c6b('0x14')](-0x1);if(_0x3961b3==='/'){_0x5cd45e=_0x5cd45e['substring'](0x0,_0x5cd45e[_0x9c6b('0x15')](_0x3961b3));}return _0x5cd45e;};exports[_0x9c6b('0x16')]=function(_0x4e171a){if(!_[_0x9c6b('0x17')](_0x4e171a)&&_0x4e171a!==''){var _0x3cb69d=/^(([^<>()\[\]\\.,;:\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 _0x3cb69d[_0x9c6b('0x18')](String(_0x4e171a)[_0x9c6b('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x8e44=['toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','format','customVariable','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','sortBy','length','type','string','push','variable','variableName','toString','Variable','name'];(function(_0x46c865,_0x154b2f){var _0x200973=function(_0x6c1275){while(--_0x6c1275){_0x46c865['push'](_0x46c865['shift']());}};_0x200973(++_0x154b2f);}(_0x8e44,0x1a4));var _0x48e4=function(_0x2be3a1,_0x56e62f){_0x2be3a1=_0x2be3a1-0x0;var _0x1c2260=_0x8e44[_0x2be3a1];return _0x1c2260;};'use strict';var _=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));exports['getString']=function(_0x4caae7,_0x38fa8a,_0x56936f){var _0x246470=[];if(_0x4caae7['length']>0x0){var _0xe5bb9c=_[_0x48e4('0x2')](_0x4caae7,['id']);for(var _0x339cce=0x0;_0x339cce<_0xe5bb9c[_0x48e4('0x3')];_0x339cce++){var _0x1d7da7=_0xe5bb9c[_0x339cce];if(_0x1d7da7[_0x48e4('0x4')]===_0x48e4('0x5')){_0x246470[_0x48e4('0x6')](_0x1d7da7['content']);}else if(_0x1d7da7[_0x48e4('0x4')]===_0x48e4('0x7')&&_0x1d7da7['variableName']){_0x38fa8a[_0x1d7da7[_0x48e4('0x8')]]&&_0x246470[_0x48e4('0x6')](_0x38fa8a[_0x1d7da7['variableName']][_0x48e4('0x9')]());}else if(_0x1d7da7[_0x48e4('0x4')]==='customVariable'&&_0x1d7da7[_0x48e4('0xa')]&&_0x1d7da7[_0x48e4('0xa')][_0x48e4('0xb')]){_0x38fa8a[_0x1d7da7['Variable']['name'][_0x48e4('0xc')]()]&&_0x246470[_0x48e4('0x6')](_0x38fa8a[_0x1d7da7['Variable'][_0x48e4('0xb')][_0x48e4('0xc')]()][_0x48e4('0x9')]());}else if(_0x1d7da7['type']===_0x48e4('0xd')){if(_0x1d7da7[_0x48e4('0xe')]==='string'&&_0x1d7da7[_0x48e4('0xf')]){_0x246470[_0x48e4('0x6')](util['format'](_0x48e4('0x10'),_0x1d7da7[_0x48e4('0xf')],_0x1d7da7[_0x48e4('0x11')]));}else if(_0x1d7da7[_0x48e4('0xe')]===_0x48e4('0x7')&&_0x1d7da7[_0x48e4('0x8')]&&_0x1d7da7['key']){_0x38fa8a[_0x1d7da7['variableName']]&&_0x246470[_0x48e4('0x6')](util[_0x48e4('0x12')]('%s:\x20%s',_0x1d7da7[_0x48e4('0xf')],_0x38fa8a[_0x1d7da7['variableName']]));}else if(_0x1d7da7[_0x48e4('0xe')]===_0x48e4('0x13')&&_0x1d7da7['Variable']&&_0x1d7da7[_0x48e4('0xa')][_0x48e4('0xb')]&&_0x1d7da7[_0x48e4('0xf')]){_0x38fa8a[_0x1d7da7[_0x48e4('0xa')][_0x48e4('0xb')][_0x48e4('0xc')]()]&&_0x246470[_0x48e4('0x6')](util[_0x48e4('0x12')]('%s:\x20%s',_0x1d7da7[_0x48e4('0xf')],_0x38fa8a[_0x1d7da7[_0x48e4('0xa')][_0x48e4('0xb')][_0x48e4('0xc')]()]));}}}}return _0x246470[_0x48e4('0x14')](_0x56936f);};exports[_0x48e4('0x15')]=function(_0x4ce40a){var _0x1c59ee=_0x4ce40a[_0x48e4('0x16')](-0x1);if(_0x1c59ee==='/'){_0x4ce40a=_0x4ce40a[_0x48e4('0x17')](0x0,_0x4ce40a['lastIndexOf'](_0x1c59ee));}return _0x4ce40a;};exports[_0x48e4('0x18')]=function(_0x3b8f90){if(!_[_0x48e4('0x19')](_0x3b8f90)&&_0x3b8f90!==''){var _0x2225f9=/^(([^<>()\[\]\\.,;:\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 _0x2225f9[_0x48e4('0x1a')](String(_0x3b8f90)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index b93611e..e336aec 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 _0x34e8=['user:%s','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','monitor_format','[ABANDONED]','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','emit','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','info','Creating\x20new\x20ticket...','merge','Open','getString','Descriptions','%s/webservice.php','remoteUri','username','sessionName','stringify','then','resolve','result','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','format','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','getUser','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','phone','accessKey','success','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','Recording\x20is\x20enabled!','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x34e8,0x12c));var _0x834e=function(_0xba5114,_0x29f657){_0xba5114=_0xba5114-0x0;var _0x40e406=_0x34e8[_0xba5114];return _0x40e406;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_0x1e41fe[_0x834e('0xf')]===_0x834e('0x10')&&_0x1e41fe[_0x834e('0x11')]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x1e41fe[_0x834e('0x12')][_0x834e('0x13')]();}else if(_0x1e41fe['type']===_0x834e('0x14')&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe['idField']&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x363786[_0x1e41fe[_0x834e('0x15')]][_0x834e('0x13')]();}else if(_0x1e41fe['type']===_0x834e('0x16')&&_0x1e41fe[_0x834e('0x17')]&&_0x1e41fe['Variable'][_0x834e('0x18')]&&_0x1e41fe['idField']&&_0x363786[_0x1e41fe[_0x834e('0x17')][_0x834e('0x18')]['toLowerCase']()]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x363786[_0x1e41fe[_0x834e('0x17')][_0x834e('0x18')]['toLowerCase']()][_0x834e('0x13')]();}});}return _0x1af45a;}function createTicket(_0x211e9a,_0x34e41a,_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x113ff4=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x34e41a['id'],'ticketpriorities':'Normal','ticketstatus':_0x834e('0x1c'),'ticket_title':intUtil[_0x834e('0x1d')](_0x237947['Subjects'],_0x254677,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x237947[_0x834e('0x1e')],_0x254677,'\x0a'),'contact_id':_0xb993a1['id']},getCustomFields(_0x1dd214,_0x254677));var _0x8d406e={'method':'POST','uri':util['format'](_0x834e('0x1f'),_0x211e9a[_0x834e('0x20')]),'form':{'operation':'create','username':_0x211e9a[_0x834e('0x21')],'sessionName':_0x595515[_0x834e('0x22')],'elementType':'HelpDesk','element':JSON[_0x834e('0x23')](_0x113ff4)},'json':!![]};return request(_0x8d406e)[_0x834e('0x24')](function(_0x338636){if(_0x338636['success']){return BPromise[_0x834e('0x25')]({'id':_0x338636[_0x834e('0x26')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x23')](_0x338636['error'])));}})[_0x834e('0x27')](function(_0x3f1b0b){var _0x3db026=_0x3f1b0b[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'createTicket',_0x3db026,JSON['stringify'](_0x3f1b0b));});}function getUser(_0x4dc64a,_0x58c1d7,_0x2c7a8d){if(intUtil[_0x834e('0x2b')](_0x58c1d7)){logger[_0x834e('0x19')]('Getting\x20agent\x20with\x20email',_0x58c1d7);return request({'method':_0x834e('0x2c'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x4dc64a[_0x834e('0x20')]),'qs':{'operation':_0x834e('0x2e'),'username':_0x4dc64a[_0x834e('0x21')],'sessionName':_0x2c7a8d[_0x834e('0x22')],'query':util[_0x834e('0x2d')](_0x834e('0x2f'),_0x58c1d7)},'json':!![]})['then'](function(_0xef9ec2){if(_0xef9ec2['success']&&_0xef9ec2[_0x834e('0x26')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x30'));return BPromise[_0x834e('0x25')]({'id':_0xef9ec2[_0x834e('0x26')][0x0]['id'],'email':_0xef9ec2[_0x834e('0x26')][0x0][_0x834e('0x31')],'name':_0xef9ec2[_0x834e('0x26')][0x0][_0x834e('0x32')]+'\x20'+_0xef9ec2['result'][_0x834e('0x33')]});}else{logger[_0x834e('0x19')](_0x834e('0x34'));return BPromise[_0x834e('0x25')]({'id':_0x2c7a8d['userId'],'email':_0x4dc64a[_0x834e('0x21')],'name':_0x834e('0x35')});}})['catch'](function(_0x496533){var _0x59385a=_0x496533[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),_0x834e('0x36'),_0x59385a,JSON[_0x834e('0x23')](_0x496533));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x25')]({'id':_0x2c7a8d['userId'],'email':_0x4dc64a[_0x834e('0x21')],'name':_0x834e('0x35')})['catch'](function(_0x18ac3b){var _0x2f56c7=_0x18ac3b['statusCode']||0x1f4;logger['error'](_0x834e('0x2a'),_0x834e('0x36'),_0x2f56c7,JSON[_0x834e('0x23')](_0x18ac3b));});}}function getEndUser(_0x130c23,_0x3c49bd,_0x4ca43c,_0x1c5ed6){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x4ca43c);return request({'method':_0x834e('0x2c'),'uri':util['format'](_0x834e('0x1f'),_0x130c23[_0x834e('0x20')]),'qs':{'operation':_0x834e('0x2e'),'username':_0x130c23[_0x834e('0x21')],'sessionName':_0x1c5ed6[_0x834e('0x22')],'query':util['format'](_0x834e('0x37'),_0x4ca43c,_0x4ca43c,_0x4ca43c,_0x4ca43c,_0x4ca43c)},'json':!![]})[_0x834e('0x24')](function(_0x38f266){if(_0x38f266['success']&&_0x38f266[_0x834e('0x26')][_0x834e('0xd')]){logger['info'](_0x834e('0x38'));return BPromise['resolve']({'id':_0x38f266[_0x834e('0x26')][0x0]['id'],'name':_0x38f266[_0x834e('0x26')][0x0]['firstname']+'\x20'+_0x38f266['result'][0x0][_0x834e('0x39')],'phone':_0x4ca43c});}else{logger[_0x834e('0x19')](_0x834e('0x3a'));return request({'method':_0x834e('0x3b'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x130c23[_0x834e('0x20')]),'form':{'operation':'create','sessionName':_0x1c5ed6[_0x834e('0x22')],'elementType':'Contacts','element':JSON[_0x834e('0x23')]({'lastname':_0x3c49bd,'phone':_0x4ca43c,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1df5b0){logger['info'](_0x834e('0x3c'));return BPromise[_0x834e('0x25')]({'id':_0x1df5b0['result']['id'],'name':_0x1df5b0[_0x834e('0x26')][_0x834e('0x39')],'phone':_0x1df5b0[_0x834e('0x26')][_0x834e('0x3d')]});})[_0x834e('0x27')](function(_0x1a7149){var _0xfa28da=_0x1a7149[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'getEndUser',_0xfa28da,JSON[_0x834e('0x23')](_0x1a7149));});}});}function getConnection(_0x6fff27){var _0x47a8a9=_0x6fff27[_0x834e('0x21')];var _0x42fd90=_0x6fff27[_0x834e('0x3e')];return request({'method':_0x834e('0x2c'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x6fff27['remoteUri']),'qs':{'operation':'getchallenge','username':_0x47a8a9},'json':!![]})[_0x834e('0x24')](function(_0x1a5444){if(_0x1a5444[_0x834e('0x3f')]){return request({'method':_0x834e('0x3b'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x6fff27[_0x834e('0x20')]),'form':{'operation':_0x834e('0x40'),'username':_0x47a8a9,'accessKey':md5(_0x1a5444[_0x834e('0x26')][_0x834e('0x41')]+_0x42fd90)},'json':!![]});}})[_0x834e('0x24')](function(_0x385435){if(_0x385435[_0x834e('0x3f')]){return BPromise[_0x834e('0x25')](_0x385435[_0x834e('0x26')]);}else{throw new Error(util[_0x834e('0x2d')](_0x834e('0x42'),_0x6fff27['id']));}})[_0x834e('0x27')](function(_0x420841){var _0x1adf86=_0x420841['statusCode']||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'getConnection',_0x1adf86,JSON[_0x834e('0x23')](_0x420841));});}function request(_0x3b0988){logger['info'](_0x834e('0x43'),JSON[_0x834e('0x23')](_0x3b0988));return rp(_0x3b0988);}exports[_0x834e('0x44')]=function(_0x35636e,_0x4288e4,_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe){var _0x8bc6c6,_0x3e0550,_0x363675,_0x86ad2b;_0x1ad7fe[_0x834e('0x20')]=intUtil[_0x834e('0x45')](_0x1ad7fe[_0x834e('0x20')]);if(_0x4a8b32&&_0x4a8b32['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x46'));_0x4288e4['recordingURL']=util[_0x834e('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ad7fe['serverUrl'],_0x4288e4[_0x834e('0x47')],md5(_0x4288e4[_0x834e('0x47')]));}else{_0x4288e4['recordingURL']='';}return getConnection(_0x1ad7fe)['then'](function(_0x2c8155){_0x86ad2b=_0x2c8155;return getUser(_0x1ad7fe,_0x4549ba[_0x834e('0x48')],_0x86ad2b);})[_0x834e('0x24')](function(_0x387365){_0x8bc6c6=_0x387365;logger[_0x834e('0x19')](_0x834e('0x49'),_0x8bc6c6['id']);return getEndUser(_0x1ad7fe,_0x4288e4[_0x834e('0x4a')],_0x4288e4[_0x834e('0x4b')],_0x86ad2b);})['then'](function(_0x142334){_0x3e0550=_0x142334;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x3e0550['id']);return createTicket(_0x1ad7fe,_0x8bc6c6,_0x3e0550,_0xb77aab,_0x4288e4,_0xb77aab[_0x834e('0x4c')],_0x86ad2b);})['then'](function(_0x3e58ef){_0x363675=_0x3e58ef;logger[_0x834e('0x19')]('Ticket\x20created!');logger[_0x834e('0x19')](_0x834e('0x4d'),_0x363675['id']);var _0x2de29a=util[_0x834e('0x2d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1ad7fe[_0x834e('0x20')],_[_0x834e('0x4e')](_0x363675['id'],'x')[0x1]);logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4f'));emit(util[_0x834e('0x2d')](_0x834e('0x50'),_0x4549ba[_0x834e('0x18')]),_0x834e('0x51'),{'uri':_0x2de29a});})[_0x834e('0x27')](function(_0x3a1426){logger[_0x834e('0x29')](_0x834e('0x52'),JSON[_0x834e('0x23')](_0x3a1426));});};exports[_0x834e('0x53')]=function(_0x1dfa95,_0x1b7045,_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83){var _0x193a15,_0x3e3467,_0xed4081,_0x2cb233;_0x297cce['remoteUri']=intUtil[_0x834e('0x45')](_0x297cce[_0x834e('0x20')]);_0x297cce[_0x834e('0x54')]=intUtil[_0x834e('0x45')](_0x297cce['serverUrl']);if(_0x14ed83&&_0x14ed83[_0x834e('0x55')]&&_0x14ed83['recordingFormat']!=='none'){logger[_0x834e('0x19')](_0x834e('0x56'),_0x834e('0x46'));_0x1b7045[_0x834e('0x57')]=util[_0x834e('0x2d')](_0x834e('0x58'),_0x297cce[_0x834e('0x54')],_0x1b7045[_0x834e('0x47')],md5(_0x1b7045['uniqueid']));}return getConnection(_0x297cce)[_0x834e('0x24')](function(_0x5a99e6){_0x2cb233=_0x5a99e6;return getUser(_0x297cce,_0x460a7a[_0x834e('0x48')],_0x2cb233);})[_0x834e('0x24')](function(_0x514fe5){_0x193a15=_0x514fe5;logger['info'](_0x834e('0x49'),_0x193a15['id']);return getEndUser(_0x297cce,_0x1b7045[_0x834e('0x59')],_0x1b7045[_0x834e('0x5a')],_0x2cb233);})[_0x834e('0x24')](function(_0x2c41bd){_0x3e3467=_0x2c41bd;logger['info'](_0x834e('0x5b'),_0x3e3467['id']);return createTicket(_0x297cce,_0x193a15,_0x3e3467,_0x1659c8,_0x1b7045,_0x1659c8[_0x834e('0x4c')],_0x2cb233);})[_0x834e('0x24')](function(_0x228a60){_0xed4081=_0x228a60;logger[_0x834e('0x19')](_0x834e('0x5c'));logger[_0x834e('0x19')](_0x834e('0x4d'),_0xed4081['id']);var _0x376f72=util[_0x834e('0x2d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x297cce[_0x834e('0x20')],_[_0x834e('0x4e')](_0xed4081['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x834e('0x2d')]('user:%s',_0x460a7a['name']),'trigger:browser:url',{'uri':_0x376f72});})[_0x834e('0x27')](function(_0x332d8f){logger['error'](_0x834e('0x56'),JSON[_0x834e('0x23')](_0x332d8f));});};exports['abandoned']=function(_0x353246,_0x18ccb2,_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3){var _0x8bc7d9,_0x44c909,_0x1d8e7,_0x493239;_0x2a42a3[_0x834e('0x20')]=intUtil['stripTrailingSlash'](_0x2a42a3[_0x834e('0x20')]);_0x2a42a3[_0x834e('0x54')]=intUtil[_0x834e('0x45')](_0x2a42a3['serverUrl']);if(_0x346be5&&_0x346be5[_0x834e('0x5d')]){logger[_0x834e('0x19')]('[ABANDONED]',_0x834e('0x46'));_0x18ccb2[_0x834e('0x57')]=util[_0x834e('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a42a3[_0x834e('0x54')],_0x18ccb2[_0x834e('0x47')],md5(_0x18ccb2[_0x834e('0x47')]));}else{_0x18ccb2[_0x834e('0x57')]='';}return getConnection(_0x2a42a3)[_0x834e('0x24')](function(_0x29bfd7){_0x493239=_0x29bfd7;return getUser(_0x2a42a3,'',_0x493239);})[_0x834e('0x24')](function(_0x23b5d9){_0x8bc7d9=_0x23b5d9;logger[_0x834e('0x19')](_0x834e('0x49'),_0x8bc7d9['id']);return getEndUser(_0x2a42a3,_0x18ccb2['calleridname'],_0x18ccb2['calleridnum'],_0x493239);})['then'](function(_0x36ede9){_0x44c909=_0x36ede9;logger[_0x834e('0x19')](_0x834e('0x5b'),_0x44c909['id']);return createTicket(_0x2a42a3,_0x8bc7d9,_0x44c909,_0x4b88e7,_0x18ccb2,_0x4b88e7[_0x834e('0x4c')],_0x493239);})[_0x834e('0x24')](function(_0x5758fb){_0x1d8e7=_0x5758fb;logger['info'](_0x834e('0x5c'));logger[_0x834e('0x19')](_0x834e('0x4d'),_0x1d8e7['id']);})[_0x834e('0x27')](function(_0x40a705){logger['error'](_0x834e('0x5e'),JSON[_0x834e('0x23')](_0x40a705));});}; \ No newline at end of file +var _0x3e74=['Normal','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','username','stringify','then','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','Agent\x20found!','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin','getUser','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','create','Enduser\x20created.','lastname','phone','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','[OUTBOUND]','user:%s','abandoned','[ABANDONED]','lodash','bluebird','md5','util','../../../../config/environment','vTiger','redis','defaults','localhost','emit','forEach','string','idField','content','type','variable','variableName','toString','Variable','name','info','Creating\x20new\x20ticket...','merge'];(function(_0x214682,_0x484b91){var _0x1f5a1b=function(_0x4318f2){while(--_0x4318f2){_0x214682['push'](_0x214682['shift']());}};_0x1f5a1b(++_0x484b91);}(_0x3e74,0x175));var _0x43e7=function(_0x249d29,_0xe3520){_0x249d29=_0x249d29-0x0;var _0x3f059e=_0x3e74[_0x249d29];return _0x3f059e;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var BPromise=require(_0x43e7('0x1'));var md5=require(_0x43e7('0x2'));var util=require(_0x43e7('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x43e7('0x4'));var logger=require('../../../../config/logger')(_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')]));function emit(_0x3491d6,_0x2ede2d,_0x8528fc){io['to'](_0x3491d6)[_0x43e7('0x9')](_0x2ede2d,_0x8528fc);}function getCustomFields(_0x516b4d,_0x212c6c){var _0x554d44={};if(_0x516b4d['length']>0x0){_[_0x43e7('0xa')](_0x516b4d,function(_0x4139c9){if(_0x4139c9['type']===_0x43e7('0xb')&&_0x4139c9['idField']){_0x554d44[_0x4139c9[_0x43e7('0xc')]]=_0x4139c9[_0x43e7('0xd')]['toString']();}else if(_0x4139c9[_0x43e7('0xe')]===_0x43e7('0xf')&&_0x4139c9[_0x43e7('0x10')]&&_0x4139c9[_0x43e7('0xc')]&&_0x212c6c[_0x4139c9['variableName']]){_0x554d44[_0x4139c9['idField']]=_0x212c6c[_0x4139c9[_0x43e7('0x10')]][_0x43e7('0x11')]();}else if(_0x4139c9[_0x43e7('0xe')]==='customVariable'&&_0x4139c9['Variable']&&_0x4139c9[_0x43e7('0x12')][_0x43e7('0x13')]&&_0x4139c9[_0x43e7('0xc')]&&_0x212c6c[_0x4139c9[_0x43e7('0x12')]['name']['toLowerCase']()]){_0x554d44[_0x4139c9[_0x43e7('0xc')]]=_0x212c6c[_0x4139c9[_0x43e7('0x12')][_0x43e7('0x13')]['toLowerCase']()]['toString']();}});}return _0x554d44;}function createTicket(_0x446986,_0x1ca758,_0x9037d3,_0x140657,_0x3776f5,_0x1f24fb,_0x619236){logger[_0x43e7('0x14')](_0x43e7('0x15'));var _0xab63cf=_[_0x43e7('0x16')]({'parent_id':'','assigned_user_id':_0x1ca758['id'],'ticketpriorities':_0x43e7('0x17'),'ticketstatus':'Open','ticket_title':intUtil[_0x43e7('0x18')](_0x140657[_0x43e7('0x19')],_0x3776f5,'\x20'),'description':intUtil['getString'](_0x140657[_0x43e7('0x1a')],_0x3776f5,'\x0a'),'contact_id':_0x9037d3['id']},getCustomFields(_0x1f24fb,_0x3776f5));var _0x3e281e={'method':_0x43e7('0x1b'),'uri':util[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986[_0x43e7('0x1e')]),'form':{'operation':'create','username':_0x446986[_0x43e7('0x1f')],'sessionName':_0x619236['sessionName'],'elementType':'HelpDesk','element':JSON[_0x43e7('0x20')](_0xab63cf)},'json':!![]};return request(_0x3e281e)[_0x43e7('0x21')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x22')]){return BPromise['resolve']({'id':_0x4b2b9f[_0x43e7('0x23')]['id']});}else{throw new Error(util['format'](_0x43e7('0x24'),JSON[_0x43e7('0x20')](_0x4b2b9f[_0x43e7('0x25')])));}})[_0x43e7('0x26')](function(_0x51f4d7){var _0x52b7b3=_0x51f4d7[_0x43e7('0x27')]||0x1f4;logger['error'](_0x43e7('0x28'),_0x43e7('0x29'),_0x52b7b3,JSON[_0x43e7('0x20')](_0x51f4d7));});}function getUser(_0xb1fc63,_0x5087d7,_0x33a1a5){if(intUtil[_0x43e7('0x2a')](_0x5087d7)){logger[_0x43e7('0x14')](_0x43e7('0x2b'),_0x5087d7);return request({'method':_0x43e7('0x2c'),'uri':util[_0x43e7('0x1c')](_0x43e7('0x1d'),_0xb1fc63[_0x43e7('0x1e')]),'qs':{'operation':_0x43e7('0x2d'),'username':_0xb1fc63[_0x43e7('0x1f')],'sessionName':_0x33a1a5[_0x43e7('0x2e')],'query':util[_0x43e7('0x1c')](_0x43e7('0x2f'),_0x5087d7)},'json':!![]})[_0x43e7('0x21')](function(_0x4bdb17){if(_0x4bdb17[_0x43e7('0x22')]&&_0x4bdb17[_0x43e7('0x23')][_0x43e7('0x30')]){logger[_0x43e7('0x14')](_0x43e7('0x31'));return BPromise['resolve']({'id':_0x4bdb17[_0x43e7('0x23')][0x0]['id'],'email':_0x4bdb17[_0x43e7('0x23')][0x0][_0x43e7('0x32')],'name':_0x4bdb17[_0x43e7('0x23')][0x0]['first_name']+'\x20'+_0x4bdb17['result']['last_name']});}else{logger[_0x43e7('0x14')](_0x43e7('0x33'));return BPromise[_0x43e7('0x34')]({'id':_0x33a1a5[_0x43e7('0x35')],'email':_0xb1fc63[_0x43e7('0x1f')],'name':_0x43e7('0x36')});}})['catch'](function(_0x47baee){var _0x4ac23d=_0x47baee['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x4ac23d,JSON[_0x43e7('0x20')](_0x47baee));});}else{logger['info'](_0x43e7('0x33'));return BPromise[_0x43e7('0x34')]({'id':_0x33a1a5[_0x43e7('0x35')],'email':_0xb1fc63[_0x43e7('0x1f')],'name':_0x43e7('0x36')})[_0x43e7('0x26')](function(_0x101d45){var _0x4f1a5f=_0x101d45['statusCode']||0x1f4;logger['error'](_0x43e7('0x28'),_0x43e7('0x37'),_0x4f1a5f,JSON[_0x43e7('0x20')](_0x101d45));});}}function getEndUser(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589){logger[_0x43e7('0x14')]('Searching\x20end\x20user\x20with\x20phone',_0x1ed538);return request({'method':_0x43e7('0x2c'),'uri':util[_0x43e7('0x1c')]('%s/webservice.php',_0x16cdba[_0x43e7('0x1e')]),'qs':{'operation':'query','username':_0x16cdba[_0x43e7('0x1f')],'sessionName':_0x1d4589[_0x43e7('0x2e')],'query':util[_0x43e7('0x1c')](_0x43e7('0x38'),_0x1ed538,_0x1ed538,_0x1ed538,_0x1ed538,_0x1ed538)},'json':!![]})[_0x43e7('0x21')](function(_0x234d8f){if(_0x234d8f['success']&&_0x234d8f['result'][_0x43e7('0x30')]){logger[_0x43e7('0x14')](_0x43e7('0x39'));return BPromise[_0x43e7('0x34')]({'id':_0x234d8f[_0x43e7('0x23')][0x0]['id'],'name':_0x234d8f['result'][0x0][_0x43e7('0x3a')]+'\x20'+_0x234d8f[_0x43e7('0x23')][0x0]['lastname'],'phone':_0x1ed538});}else{logger[_0x43e7('0x14')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x43e7('0x1b'),'uri':util['format'](_0x43e7('0x1d'),_0x16cdba[_0x43e7('0x1e')]),'form':{'operation':_0x43e7('0x3b'),'sessionName':_0x1d4589[_0x43e7('0x2e')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x1b1440,'phone':_0x1ed538,'assigned_user_id':'\x20'})},'json':!![]})[_0x43e7('0x21')](function(_0x40c509){logger[_0x43e7('0x14')](_0x43e7('0x3c'));return BPromise['resolve']({'id':_0x40c509['result']['id'],'name':_0x40c509['result'][_0x43e7('0x3d')],'phone':_0x40c509['result'][_0x43e7('0x3e')]});})['catch'](function(_0x5b28db){var _0x46b2e6=_0x5b28db['statusCode']||0x1f4;logger[_0x43e7('0x25')](_0x43e7('0x28'),_0x43e7('0x3f'),_0x46b2e6,JSON[_0x43e7('0x20')](_0x5b28db));});}});}function getConnection(_0x4fc5e8){var _0x91f1e4=_0x4fc5e8[_0x43e7('0x1f')];var _0x23a611=_0x4fc5e8[_0x43e7('0x40')];return request({'method':_0x43e7('0x2c'),'uri':util[_0x43e7('0x1c')]('%s/webservice.php',_0x4fc5e8['remoteUri']),'qs':{'operation':_0x43e7('0x41'),'username':_0x91f1e4},'json':!![]})[_0x43e7('0x21')](function(_0x212841){if(_0x212841['success']){return request({'method':'POST','uri':util['format'](_0x43e7('0x1d'),_0x4fc5e8[_0x43e7('0x1e')]),'form':{'operation':'login','username':_0x91f1e4,'accessKey':md5(_0x212841[_0x43e7('0x23')][_0x43e7('0x42')]+_0x23a611)},'json':!![]});}})[_0x43e7('0x21')](function(_0x560329){if(_0x560329['success']){return BPromise['resolve'](_0x560329['result']);}else{throw new Error(util[_0x43e7('0x1c')](_0x43e7('0x43'),_0x4fc5e8['id']));}})['catch'](function(_0x23e7cb){var _0x82d32f=_0x23e7cb[_0x43e7('0x27')]||0x1f4;logger[_0x43e7('0x25')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x43e7('0x44'),_0x82d32f,JSON['stringify'](_0x23e7cb));});}function request(_0x4bebd4){logger[_0x43e7('0x14')](_0x43e7('0x45'),JSON[_0x43e7('0x20')](_0x4bebd4));return rp(_0x4bebd4);}exports[_0x43e7('0x46')]=function(_0x13503c,_0x2351cf,_0x1cd87c,_0x256ddd,_0x473fca,_0x2b5515){var _0x58dfd0,_0x119d34,_0x46c910,_0x499c03;_0x2b5515[_0x43e7('0x1e')]=intUtil['stripTrailingSlash'](_0x2b5515[_0x43e7('0x1e')]);if(_0x473fca&&_0x473fca[_0x43e7('0x47')]){logger[_0x43e7('0x14')](_0x43e7('0x48'),_0x43e7('0x49'));_0x2351cf['recordingURL']=util['format'](_0x43e7('0x4a'),_0x2b5515[_0x43e7('0x4b')],_0x2351cf[_0x43e7('0x4c')],md5(_0x2351cf[_0x43e7('0x4c')]));}else{_0x2351cf[_0x43e7('0x4d')]='';}return getConnection(_0x2b5515)[_0x43e7('0x21')](function(_0xa47464){_0x499c03=_0xa47464;return getUser(_0x2b5515,_0x256ddd[_0x43e7('0x4e')],_0x499c03);})[_0x43e7('0x21')](function(_0x24e758){_0x58dfd0=_0x24e758;logger[_0x43e7('0x14')]('The\x20User\x20ID\x20is:',_0x58dfd0['id']);return getEndUser(_0x2b5515,_0x2351cf[_0x43e7('0x4f')],_0x2351cf[_0x43e7('0x50')],_0x499c03);})['then'](function(_0x4314d8){_0x119d34=_0x4314d8;logger[_0x43e7('0x14')](_0x43e7('0x51'),_0x119d34['id']);return createTicket(_0x2b5515,_0x58dfd0,_0x119d34,_0x1cd87c,_0x2351cf,_0x1cd87c['Fields'],_0x499c03);})['then'](function(_0x459c13){_0x46c910=_0x459c13;logger[_0x43e7('0x14')]('Ticket\x20created!');logger[_0x43e7('0x14')]('The\x20Ticket\x20ID\x20is:',_0x46c910['id']);var _0x49a6ce=util[_0x43e7('0x1c')](_0x43e7('0x52'),_0x2b5515[_0x43e7('0x1e')],_[_0x43e7('0x53')](_0x46c910['id'],'x')[0x1]);logger[_0x43e7('0x14')]('[QUEUE]',_0x43e7('0x54'));emit(util[_0x43e7('0x1c')]('user:%s',_0x256ddd[_0x43e7('0x13')]),_0x43e7('0x55'),{'uri':_0x49a6ce});})[_0x43e7('0x26')](function(_0x5bb536){logger['error']('[QUEUE]',JSON[_0x43e7('0x20')](_0x5bb536));});};exports[_0x43e7('0x56')]=function(_0x323cf7,_0x3a6404,_0x52ea9c,_0x5a50fc,_0x1b27da,_0x8b50bb,_0x140438){var _0x5dd349,_0x5ea0db,_0x4438c0,_0x1a7cb5;_0x8b50bb[_0x43e7('0x1e')]=intUtil[_0x43e7('0x57')](_0x8b50bb[_0x43e7('0x1e')]);_0x8b50bb[_0x43e7('0x4b')]=intUtil[_0x43e7('0x57')](_0x8b50bb[_0x43e7('0x4b')]);if(_0x140438&&_0x140438[_0x43e7('0x58')]&&_0x140438[_0x43e7('0x58')]!==_0x43e7('0x59')){logger['info']('[OUTBOUND]',_0x43e7('0x49'));_0x3a6404['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8b50bb[_0x43e7('0x4b')],_0x3a6404[_0x43e7('0x4c')],md5(_0x3a6404['uniqueid']));}return getConnection(_0x8b50bb)[_0x43e7('0x21')](function(_0x135791){_0x1a7cb5=_0x135791;return getUser(_0x8b50bb,_0x5a50fc[_0x43e7('0x4e')],_0x1a7cb5);})['then'](function(_0x2b7406){_0x5dd349=_0x2b7406;logger[_0x43e7('0x14')](_0x43e7('0x5a'),_0x5dd349['id']);return getEndUser(_0x8b50bb,_0x3a6404[_0x43e7('0x5b')],_0x3a6404[_0x43e7('0x5c')],_0x1a7cb5);})[_0x43e7('0x21')](function(_0x1e02fa){_0x5ea0db=_0x1e02fa;logger['info'](_0x43e7('0x51'),_0x5ea0db['id']);return createTicket(_0x8b50bb,_0x5dd349,_0x5ea0db,_0x52ea9c,_0x3a6404,_0x52ea9c[_0x43e7('0x5d')],_0x1a7cb5);})[_0x43e7('0x21')](function(_0x549f4e){_0x4438c0=_0x549f4e;logger['info'](_0x43e7('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4438c0['id']);var _0x1b793d=util[_0x43e7('0x1c')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x8b50bb[_0x43e7('0x1e')],_[_0x43e7('0x53')](_0x4438c0['id'],'x')[0x1]);logger[_0x43e7('0x14')](_0x43e7('0x5f'),_0x43e7('0x54'));emit(util[_0x43e7('0x1c')](_0x43e7('0x60'),_0x5a50fc['name']),_0x43e7('0x55'),{'uri':_0x1b793d});})[_0x43e7('0x26')](function(_0x4e5956){logger[_0x43e7('0x25')]('[OUTBOUND]',JSON[_0x43e7('0x20')](_0x4e5956));});};exports[_0x43e7('0x61')]=function(_0x37301b,_0x1ca24b,_0x506361,_0x2d25b5,_0x2646c2,_0xf929a5){var _0x556001,_0x17889c,_0x38fa5b,_0x219dc6;_0xf929a5[_0x43e7('0x1e')]=intUtil[_0x43e7('0x57')](_0xf929a5['remoteUri']);_0xf929a5[_0x43e7('0x4b')]=intUtil[_0x43e7('0x57')](_0xf929a5[_0x43e7('0x4b')]);if(_0x2646c2&&_0x2646c2[_0x43e7('0x47')]){logger[_0x43e7('0x14')](_0x43e7('0x62'),_0x43e7('0x49'));_0x1ca24b['recordingURL']=util['format'](_0x43e7('0x4a'),_0xf929a5['serverUrl'],_0x1ca24b['uniqueid'],md5(_0x1ca24b['uniqueid']));}else{_0x1ca24b[_0x43e7('0x4d')]='';}return getConnection(_0xf929a5)[_0x43e7('0x21')](function(_0x230fda){_0x219dc6=_0x230fda;return getUser(_0xf929a5,'',_0x219dc6);})[_0x43e7('0x21')](function(_0x18713b){_0x556001=_0x18713b;logger[_0x43e7('0x14')]('The\x20User\x20ID\x20is:',_0x556001['id']);return getEndUser(_0xf929a5,_0x1ca24b[_0x43e7('0x4f')],_0x1ca24b[_0x43e7('0x50')],_0x219dc6);})[_0x43e7('0x21')](function(_0x5b4c76){_0x17889c=_0x5b4c76;logger[_0x43e7('0x14')](_0x43e7('0x51'),_0x17889c['id']);return createTicket(_0xf929a5,_0x556001,_0x17889c,_0x506361,_0x1ca24b,_0x506361[_0x43e7('0x5d')],_0x219dc6);})[_0x43e7('0x21')](function(_0x1afea6){_0x38fa5b=_0x1afea6;logger[_0x43e7('0x14')](_0x43e7('0x5e'));logger[_0x43e7('0x14')]('The\x20Ticket\x20ID\x20is:',_0x38fa5b['id']);})['catch'](function(_0x55990c){logger[_0x43e7('0x25')](_0x43e7('0x62'),JSON['stringify'](_0x55990c));});}; \ 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 308814f..7139078 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 _0xb90d=['end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','password','token','%s/token:%s','Basic\x20%s','base64','[HTTP]','stringify','GET','forEach','nameField','customField','toLowerCase','content','type','idField','toString','variable','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','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...','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','newTab','user:%s','catch','abandoned','[ABANDONED]','Recording\x20is\x20enabled!','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','remoteUri','POST','merge','Tags','name','getString','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xb90d,0x17a));var _0xdb90=function(_0x3330b8,_0x19b32a){_0x3330b8=_0x3330b8-0x0;var _0x191799=_0xb90d[_0x3330b8];return _0x191799;};'use strict';var _=require('lodash');var rp=require(_0xdb90('0x0'));var md5=require(_0xdb90('0x1'));var util=require(_0xdb90('0x2'));var Redis=require(_0xdb90('0x3'));var intUtil=require(_0xdb90('0x4'));var config=require(_0xdb90('0x5'));var logger=require('../../../../config/logger')(_0xdb90('0x6'));config[_0xdb90('0x7')]=_[_0xdb90('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdb90('0x9'))(new Redis(config[_0xdb90('0x7')]));function emit(_0x6d8ec5,_0xbb1e2,_0x57862b){io['to'](_0x6d8ec5)[_0xdb90('0xa')](_0xbb1e2,_0x57862b);}var headers={'Content-Type':_0xdb90('0xb'),'Accept':_0xdb90('0xb')};function getTicket(_0x54e3e6,_0x4779a9,_0x40312b,_0x39479d,_0x3ec812){logger[_0xdb90('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util['format']('%s/tickets.json',_0x54e3e6[_0xdb90('0xd')]),'method':_0xdb90('0xe'),'body':{'ticket':_[_0xdb90('0xf')]({'requester_id':_0x40312b['id'],'submitter_id':_0x4779a9?_0x4779a9['id']:undefined,'assignee_id':_0x4779a9?_0x4779a9['id']:undefined,'tags':getTags(_0x39479d[_0xdb90('0x10')],_0xdb90('0x11')),'subject':intUtil[_0xdb90('0x12')](_0x39479d['Subjects'],_0x3ec812,'\x20'),'description':intUtil['getString'](_0x39479d['Descriptions'],_0x3ec812,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x39479d['Descriptions'],_0x3ec812,'\x0a')}},getCustomFields(_0x39479d['Fields'],_0x3ec812))}})[_0xdb90('0x13')](function(_0x118101){logger['info'](_0xdb90('0x14'));return _0x118101[_0xdb90('0x15')];});}function getUser(_0x4db002,_0x4a3298){if(intUtil[_0xdb90('0x16')](_0x4a3298)){logger[_0xdb90('0xc')](_0xdb90('0x17'),_0x4a3298);return request({'uri':util['format'](_0xdb90('0x18'),_0x4db002[_0xdb90('0xd')]),'qs':{'query':util[_0xdb90('0x19')](_0xdb90('0x1a'),_0x4a3298)}})[_0xdb90('0x13')](function(_0x2b7583){if(_0x2b7583[_0xdb90('0x1b')]){logger[_0xdb90('0xc')](_0xdb90('0x1c'));return _[_0xdb90('0x1d')](_0x2b7583['results'],{'email':_0x4a3298,'role':'agent'});}else{logger[_0xdb90('0xc')](_0xdb90('0x1e'));return request({'uri':util[_0xdb90('0x19')](_0xdb90('0x1f'),_0x4db002[_0xdb90('0xd')])})['then'](function(_0x31f9df){logger[_0xdb90('0xc')]('Admin\x20account\x20selected.');return _0x31f9df[_0xdb90('0x20')];});}});}else{logger['info'](_0xdb90('0x1e'));return request({'uri':util[_0xdb90('0x19')](_0xdb90('0x1f'),_0x4db002[_0xdb90('0xd')])})[_0xdb90('0x13')](function(_0x67f251){logger[_0xdb90('0xc')](_0xdb90('0x21'));return _0x67f251[_0xdb90('0x20')];});}}function getEndUser(_0x1fed39,_0x64268c,_0x5d3b63){logger[_0xdb90('0xc')](_0xdb90('0x22'),_0x5d3b63);return request({'uri':util[_0xdb90('0x19')]('%s/search.json',_0x1fed39['remoteUri']),'qs':{'query':util[_0xdb90('0x19')](_0xdb90('0x23'),_0x5d3b63)}})[_0xdb90('0x13')](function(_0x18e806){var _0x19fd32;if(_0x18e806[_0xdb90('0x24')][_0xdb90('0x25')]){_0x18e806[_0xdb90('0x24')]=_['filter'](_0x18e806[_0xdb90('0x24')],{'suspended':![],'role':_0xdb90('0x26')});if(_0x18e806[_0xdb90('0x24')][_0xdb90('0x25')]){_0x19fd32=_[_0xdb90('0x27')](_0x18e806[_0xdb90('0x24')]);}}if(_0x19fd32){logger[_0xdb90('0xc')](_0xdb90('0x28'));return _0x19fd32;}else{logger[_0xdb90('0xc')](_0xdb90('0x29'));return request({'uri':util[_0xdb90('0x19')](_0xdb90('0x2a'),_0x1fed39[_0xdb90('0xd')]),'method':_0xdb90('0xe'),'body':{'user':{'role':'end-user','name':util[_0xdb90('0x19')](_0xdb90('0x2b'),_0x64268c||_0x5d3b63),'phone':_0x5d3b63}}})[_0xdb90('0x13')](function(_0x204d61){logger[_0xdb90('0xc')](_0xdb90('0x2c'));return _0x204d61[_0xdb90('0x20')];});}});}function getAuth(_0x3cdd77){var _0x35a406;if(_0x3cdd77[_0xdb90('0x2d')]==='password'){_0x35a406=util[_0xdb90('0x19')](_0xdb90('0x2e'),_0x3cdd77['username'],_0x3cdd77[_0xdb90('0x2f')]);}else if(_0x3cdd77[_0xdb90('0x2d')]===_0xdb90('0x30')){_0x35a406=util[_0xdb90('0x19')](_0xdb90('0x31'),_0x3cdd77['username'],_0x3cdd77[_0xdb90('0x30')]);}return util[_0xdb90('0x19')](_0xdb90('0x32'),new Buffer(_0x35a406)['toString'](_0xdb90('0x33')));}function request(_0x3b7ae7){logger['debug'](_0xdb90('0x34'),JSON[_0xdb90('0x35')](_0x3b7ae7));return rp(_[_0xdb90('0x8')](_0x3b7ae7,{'method':_0xdb90('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x5bcc58,_0x1c495c){var _0xefa785=[];if(_0x5bcc58&&_0x5bcc58['length']>0x0){_0xefa785=_['map'](_0x5bcc58,_0x1c495c);}return _0xefa785;}function getCustomFields(_0x3e57ae,_0x195b26){var _0x6418f3=[];var _0x2ad3d2={'custom_fields':[]};if(_0x3e57ae['length']>0x0){_[_0xdb90('0x37')](_0x3e57ae,function(_0x5c2ee8){if(_0x5c2ee8['type']==='string'&&_0x5c2ee8[_0xdb90('0x38')]&&!_0x5c2ee8[_0xdb90('0x39')]){_0x2ad3d2[_0x5c2ee8[_0xdb90('0x38')][_0xdb90('0x3a')]()]=_0x5c2ee8[_0xdb90('0x3b')]['toString']();}else if(_0x5c2ee8[_0xdb90('0x3c')]==='string'&&_0x5c2ee8[_0xdb90('0x3d')]&&_0x5c2ee8[_0xdb90('0x39')]){_0x2ad3d2['custom_fields']['push']({'id':_0x5c2ee8[_0xdb90('0x3d')],'value':_0x5c2ee8['content'][_0xdb90('0x3e')]()});}else if(_0x5c2ee8[_0xdb90('0x3c')]===_0xdb90('0x3f')&&_0x5c2ee8['variableName']&&_0x5c2ee8[_0xdb90('0x3d')]&&_0x5c2ee8[_0xdb90('0x39')]){_0x195b26[_0x5c2ee8['variableName']]&&_0x2ad3d2[_0xdb90('0x40')][_0xdb90('0x41')]({'id':_0x5c2ee8[_0xdb90('0x3d')],'value':_0x195b26[_0x5c2ee8[_0xdb90('0x42')]][_0xdb90('0x3e')]()});}else if(_0x5c2ee8[_0xdb90('0x3c')]===_0xdb90('0x43')&&_0x5c2ee8[_0xdb90('0x44')]&&_0x5c2ee8['Variable'][_0xdb90('0x11')]&&_0x5c2ee8['idField']&&_0x5c2ee8['customField']){_0x195b26[_0x5c2ee8['Variable'][_0xdb90('0x11')]['toLowerCase']()]&&_0x2ad3d2['custom_fields'][_0xdb90('0x41')]({'id':_0x5c2ee8[_0xdb90('0x3d')],'value':_0x195b26[_0x5c2ee8[_0xdb90('0x44')][_0xdb90('0x11')]['toLowerCase']()][_0xdb90('0x3e')]()});}});}return _0x2ad3d2;}exports[_0xdb90('0x45')]=function(_0x7e6398,_0x147be8,_0x234b2d,_0x33c043,_0x45ef0d,_0x1bb950){var _0x2e64a2,_0x408b37;_0x1bb950[_0xdb90('0xd')]=intUtil[_0xdb90('0x46')](_0x1bb950[_0xdb90('0xd')]);_0x1bb950['serverUrl']=intUtil['stripTrailingSlash'](_0x1bb950['serverUrl']);if(_0x45ef0d&&_0x45ef0d['monitor_format']){logger[_0xdb90('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x147be8['recordingURL']=util[_0xdb90('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1bb950[_0xdb90('0x47')],_0x147be8[_0xdb90('0x48')],md5(_0x147be8[_0xdb90('0x48')]));}else{_0x147be8[_0xdb90('0x49')]='';}headers[_0xdb90('0x4a')]=getAuth(_0x1bb950);return getUser(_0x1bb950,_0x33c043[_0xdb90('0x4b')])[_0xdb90('0x13')](function(_0x4616f3){_0x2e64a2=_0x4616f3;logger['info'](_0xdb90('0x4c'),_0x2e64a2['id']);return getEndUser(_0x1bb950,_0x147be8[_0xdb90('0x4d')],_0x147be8['calleridnum']);})['then'](function(_0x133d8b){_0x408b37=_0x133d8b;logger[_0xdb90('0xc')](_0xdb90('0x4e'),_0x408b37['id']);return getTicket(_0x1bb950,_0x2e64a2,_0x408b37,_0x234b2d,_0x147be8);})['then'](function(_0x3ebe50){if(_0x3ebe50){logger[_0xdb90('0xc')](_0xdb90('0x4f'),_0x3ebe50['id']);switch(_0x1bb950[_0xdb90('0x3c')]){case _0xdb90('0x50'):logger[_0xdb90('0xc')](_0xdb90('0x51'),_0xdb90('0x52'));return request({'uri':util[_0xdb90('0x19')](_0xdb90('0x53'),_0x1bb950[_0xdb90('0xd')],_0x2e64a2['id'],_0x3ebe50['id']),'method':_0xdb90('0xe')});case'newTab':logger['info']('[QUEUE]',_0xdb90('0x54'));emit(util[_0xdb90('0x19')]('user:%s',_0x33c043['name']),_0xdb90('0x55'),{'uri':util[_0xdb90('0x19')](_0xdb90('0x56'),_0x1bb950[_0xdb90('0xd')],_0x3ebe50['id'])});break;default:logger['error'](_0xdb90('0x51'),_0xdb90('0x57'));}}})['catch'](function(_0x5e7dd1){logger[_0xdb90('0x58')](_0xdb90('0x59'),util[_0xdb90('0x5a')](_0x5e7dd1,{'showHidden':!![],'depth':null}));});};exports[_0xdb90('0x5b')]=function(_0x28ca72,_0x2ee43d,_0x510edd,_0x48f819,_0x2ef614,_0x2f51d4,_0x4b0806){var _0x2c9d89,_0x21bbdf;_0x2f51d4[_0xdb90('0xd')]=intUtil[_0xdb90('0x46')](_0x2f51d4['remoteUri']);_0x2f51d4[_0xdb90('0x47')]=intUtil['stripTrailingSlash'](_0x2f51d4[_0xdb90('0x47')]);if(_0x4b0806&&_0x4b0806[_0xdb90('0x5c')]&&_0x4b0806[_0xdb90('0x5c')]!==_0xdb90('0x5d')){logger[_0xdb90('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2ee43d[_0xdb90('0x49')]=util[_0xdb90('0x19')](_0xdb90('0x5e'),_0x2f51d4[_0xdb90('0x47')],_0x2ee43d['uniqueid'],md5(_0x2ee43d[_0xdb90('0x48')]));}headers[_0xdb90('0x4a')]=getAuth(_0x2f51d4);return getUser(_0x2f51d4,_0x48f819[_0xdb90('0x4b')])[_0xdb90('0x13')](function(_0x5dc06b){_0x2c9d89=_0x5dc06b;logger[_0xdb90('0xc')]('The\x20User\x20ID\x20is:',_0x2c9d89['id']);return getEndUser(_0x2f51d4,_0x2ee43d[_0xdb90('0x5f')],_0x2ee43d[_0xdb90('0x60')]);})[_0xdb90('0x13')](function(_0x38702d){_0x21bbdf=_0x38702d;logger[_0xdb90('0xc')](_0xdb90('0x4e'),_0x21bbdf['id']);return getTicket(_0x2f51d4,_0x2c9d89,_0x21bbdf,_0x510edd,_0x2ee43d);})[_0xdb90('0x13')](function(_0x5c3a2c){if(_0x5c3a2c){logger[_0xdb90('0xc')](_0xdb90('0x4f'),_0x5c3a2c['id']);switch(_0x2f51d4[_0xdb90('0x3c')]){case _0xdb90('0x50'):logger[_0xdb90('0xc')](_0xdb90('0x61'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xdb90('0x19')](_0xdb90('0x53'),_0x2f51d4['remoteUri'],_0x2c9d89['id'],_0x5c3a2c['id']),'method':_0xdb90('0xe')});case _0xdb90('0x62'):logger[_0xdb90('0xc')](_0xdb90('0x61'),_0xdb90('0x54'));emit(util['format'](_0xdb90('0x63'),_0x48f819['name']),_0xdb90('0x55'),{'uri':util[_0xdb90('0x19')](_0xdb90('0x56'),_0x2f51d4[_0xdb90('0xd')],_0x5c3a2c['id'])});break;default:logger[_0xdb90('0x58')](_0xdb90('0x61'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xdb90('0x64')](function(_0x2c9107){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xdb90('0x5a')](_0x2c9107,{'showHidden':!![],'depth':null}));});};exports[_0xdb90('0x65')]=function(_0x44ab28,_0x747c19,_0x4941f9,_0x3d29e3,_0x33c887,_0x5c2449){var _0x3caf84,_0x12f97f;_0x5c2449[_0xdb90('0xd')]=intUtil[_0xdb90('0x46')](_0x5c2449[_0xdb90('0xd')]);_0x5c2449['serverUrl']=intUtil[_0xdb90('0x46')](_0x5c2449[_0xdb90('0x47')]);if(_0x33c887&&_0x33c887['monitor_format']){logger[_0xdb90('0xc')](_0xdb90('0x66'),_0xdb90('0x67'));_0x747c19['recordingURL']=util[_0xdb90('0x19')](_0xdb90('0x5e'),_0x5c2449[_0xdb90('0x47')],_0x747c19[_0xdb90('0x48')],md5(_0x747c19['uniqueid']));}else{_0x747c19[_0xdb90('0x49')]='';}headers[_0xdb90('0x4a')]=getAuth(_0x5c2449);return getUser(_0x5c2449)['then'](function(_0x4c3bac){_0x3caf84=_0x4c3bac;logger[_0xdb90('0xc')](_0xdb90('0x4c'),_0x3caf84['id']);return getEndUser(_0x5c2449,_0x747c19['calleridname'],_0x747c19['calleridnum']);})[_0xdb90('0x13')](function(_0x164c4c){_0x12f97f=_0x164c4c;logger[_0xdb90('0xc')](_0xdb90('0x4e'),_0x12f97f['id']);return getTicket(_0x5c2449,_0x3caf84,_0x12f97f,_0x4941f9,_0x747c19);})[_0xdb90('0x13')](function(_0x379094){if(_0x379094){logger[_0xdb90('0xc')]('The\x20Ticket\x20ID\x20is:',_0x379094['id']);}})[_0xdb90('0x64')](function(_0x4755b9){logger['error']('[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration',util[_0xdb90('0x5a')](_0x4755b9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb201=['outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','monitor_format','calleridname','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','application/json','info','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','user','authType','username','password','token','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','string','nameField','customField','toLowerCase','content','custom_fields','push','idField','type','variable','variableName','Variable','name','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0xb201,0x1b1));var _0x1b20=function(_0x5d9aed,_0x4b3e01){_0x5d9aed=_0x5d9aed-0x0;var _0x3bb1ce=_0xb201[_0x5d9aed];return _0x3bb1ce;};'use strict';var _=require(_0x1b20('0x0'));var rp=require('request-promise');var md5=require(_0x1b20('0x1'));var util=require(_0x1b20('0x2'));var Redis=require(_0x1b20('0x3'));var intUtil=require(_0x1b20('0x4'));var config=require(_0x1b20('0x5'));var logger=require(_0x1b20('0x6'))('zendesk');config[_0x1b20('0x7')]=_[_0x1b20('0x8')](config[_0x1b20('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1b20('0x9'))(new Redis(config['redis']));function emit(_0x34304b,_0x2a184f,_0x3cc600){io['to'](_0x34304b)[_0x1b20('0xa')](_0x2a184f,_0x3cc600);}var headers={'Content-Type':'application/json','Accept':_0x1b20('0xb')};function getTicket(_0x1f5ae4,_0x3d837e,_0x490a84,_0xc7a0fc,_0x5d4a56){logger[_0x1b20('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x1b20('0xd'),_0x1f5ae4[_0x1b20('0xe')]),'method':_0x1b20('0xf'),'body':{'ticket':_[_0x1b20('0x10')]({'requester_id':_0x490a84['id'],'submitter_id':_0x3d837e?_0x3d837e['id']:undefined,'assignee_id':_0x3d837e?_0x3d837e['id']:undefined,'tags':getTags(_0xc7a0fc[_0x1b20('0x11')],'name'),'subject':intUtil[_0x1b20('0x12')](_0xc7a0fc[_0x1b20('0x13')],_0x5d4a56,'\x20'),'description':intUtil[_0x1b20('0x12')](_0xc7a0fc[_0x1b20('0x14')],_0x5d4a56,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1b20('0x12')](_0xc7a0fc['Descriptions'],_0x5d4a56,'\x0a')}},getCustomFields(_0xc7a0fc[_0x1b20('0x15')],_0x5d4a56))}})[_0x1b20('0x16')](function(_0x341a93){logger['info'](_0x1b20('0x17'));return _0x341a93['ticket'];});}function getUser(_0x348f79,_0x1a256a){if(intUtil['validateEmail'](_0x1a256a)){logger[_0x1b20('0xc')](_0x1b20('0x18'),_0x1a256a);return request({'uri':util[_0x1b20('0x19')](_0x1b20('0x1a'),_0x348f79[_0x1b20('0xe')]),'qs':{'query':util[_0x1b20('0x19')](_0x1b20('0x1b'),_0x1a256a)}})[_0x1b20('0x16')](function(_0x30a310){if(_0x30a310[_0x1b20('0x1c')]){logger[_0x1b20('0xc')](_0x1b20('0x1d'));return _[_0x1b20('0x1e')](_0x30a310[_0x1b20('0x1f')],{'email':_0x1a256a,'role':_0x1b20('0x20')});}else{logger['info'](_0x1b20('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x348f79['remoteUri'])})[_0x1b20('0x16')](function(_0x4d5bb9){logger['info'](_0x1b20('0x22'));return _0x4d5bb9['user'];});}});}else{logger[_0x1b20('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1b20('0x19')](_0x1b20('0x23'),_0x348f79[_0x1b20('0xe')])})[_0x1b20('0x16')](function(_0x298cad){logger[_0x1b20('0xc')]('Admin\x20account\x20selected.');return _0x298cad['user'];});}}function getEndUser(_0x23da7b,_0x468bc4,_0x9c8359){logger[_0x1b20('0xc')](_0x1b20('0x24'),_0x9c8359);return request({'uri':util[_0x1b20('0x19')](_0x1b20('0x1a'),_0x23da7b[_0x1b20('0xe')]),'qs':{'query':util[_0x1b20('0x19')](_0x1b20('0x25'),_0x9c8359)}})['then'](function(_0x56a27e){var _0x556a9d;if(_0x56a27e['results']['length']){_0x56a27e['results']=_[_0x1b20('0x26')](_0x56a27e[_0x1b20('0x1f')],{'suspended':![],'role':_0x1b20('0x27')});if(_0x56a27e[_0x1b20('0x1f')][_0x1b20('0x28')]){_0x556a9d=_[_0x1b20('0x29')](_0x56a27e[_0x1b20('0x1f')]);}}if(_0x556a9d){logger['info']('Enduser\x20found!');return _0x556a9d;}else{logger[_0x1b20('0xc')](_0x1b20('0x2a'));return request({'uri':util[_0x1b20('0x19')](_0x1b20('0x2b'),_0x23da7b[_0x1b20('0xe')]),'method':_0x1b20('0xf'),'body':{'user':{'role':'end-user','name':util['format'](_0x1b20('0x2c'),_0x468bc4||_0x9c8359),'phone':_0x9c8359}}})[_0x1b20('0x16')](function(_0x39f388){logger[_0x1b20('0xc')]('Enduser\x20created.');return _0x39f388[_0x1b20('0x2d')];});}});}function getAuth(_0x1a6447){var _0x29f8a3;if(_0x1a6447[_0x1b20('0x2e')]==='password'){_0x29f8a3=util[_0x1b20('0x19')]('%s:%s',_0x1a6447[_0x1b20('0x2f')],_0x1a6447[_0x1b20('0x30')]);}else if(_0x1a6447[_0x1b20('0x2e')]===_0x1b20('0x31')){_0x29f8a3=util[_0x1b20('0x19')]('%s/token:%s',_0x1a6447[_0x1b20('0x2f')],_0x1a6447[_0x1b20('0x31')]);}return util[_0x1b20('0x19')](_0x1b20('0x32'),new Buffer(_0x29f8a3)[_0x1b20('0x33')](_0x1b20('0x34')));}function request(_0x290f73){logger[_0x1b20('0x35')](_0x1b20('0x36'),JSON['stringify'](_0x290f73));return rp(_[_0x1b20('0x8')](_0x290f73,{'method':_0x1b20('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1c066b,_0x56a7cb){var _0x26f7c9=[];if(_0x1c066b&&_0x1c066b[_0x1b20('0x28')]>0x0){_0x26f7c9=_[_0x1b20('0x38')](_0x1c066b,_0x56a7cb);}return _0x26f7c9;}function getCustomFields(_0x59957a,_0x4a77aa){var _0x2ae893=[];var _0x51c4de={'custom_fields':[]};if(_0x59957a['length']>0x0){_[_0x1b20('0x39')](_0x59957a,function(_0x1aff62){if(_0x1aff62['type']===_0x1b20('0x3a')&&_0x1aff62[_0x1b20('0x3b')]&&!_0x1aff62[_0x1b20('0x3c')]){_0x51c4de[_0x1aff62[_0x1b20('0x3b')][_0x1b20('0x3d')]()]=_0x1aff62[_0x1b20('0x3e')][_0x1b20('0x33')]();}else if(_0x1aff62['type']===_0x1b20('0x3a')&&_0x1aff62['idField']&&_0x1aff62[_0x1b20('0x3c')]){_0x51c4de[_0x1b20('0x3f')][_0x1b20('0x40')]({'id':_0x1aff62[_0x1b20('0x41')],'value':_0x1aff62['content']['toString']()});}else if(_0x1aff62[_0x1b20('0x42')]===_0x1b20('0x43')&&_0x1aff62[_0x1b20('0x44')]&&_0x1aff62['idField']&&_0x1aff62[_0x1b20('0x3c')]){_0x4a77aa[_0x1aff62[_0x1b20('0x44')]]&&_0x51c4de['custom_fields']['push']({'id':_0x1aff62[_0x1b20('0x41')],'value':_0x4a77aa[_0x1aff62[_0x1b20('0x44')]][_0x1b20('0x33')]()});}else if(_0x1aff62[_0x1b20('0x42')]==='customVariable'&&_0x1aff62[_0x1b20('0x45')]&&_0x1aff62[_0x1b20('0x45')]['name']&&_0x1aff62[_0x1b20('0x41')]&&_0x1aff62[_0x1b20('0x3c')]){_0x4a77aa[_0x1aff62[_0x1b20('0x45')][_0x1b20('0x46')][_0x1b20('0x3d')]()]&&_0x51c4de[_0x1b20('0x3f')]['push']({'id':_0x1aff62[_0x1b20('0x41')],'value':_0x4a77aa[_0x1aff62[_0x1b20('0x45')][_0x1b20('0x46')][_0x1b20('0x3d')]()]['toString']()});}});}return _0x51c4de;}exports[_0x1b20('0x47')]=function(_0x183f65,_0x39243a,_0x3524b3,_0x279737,_0x2b8b1f,_0x12dc41){var _0x39e45e,_0x14429c;_0x12dc41[_0x1b20('0xe')]=intUtil['stripTrailingSlash'](_0x12dc41[_0x1b20('0xe')]);_0x12dc41['serverUrl']=intUtil['stripTrailingSlash'](_0x12dc41[_0x1b20('0x48')]);if(_0x2b8b1f&&_0x2b8b1f['monitor_format']){logger['info'](_0x1b20('0x49'),_0x1b20('0x4a'));_0x39243a[_0x1b20('0x4b')]=util['format'](_0x1b20('0x4c'),_0x12dc41[_0x1b20('0x48')],_0x39243a[_0x1b20('0x4d')],md5(_0x39243a[_0x1b20('0x4d')]));}else{_0x39243a[_0x1b20('0x4b')]='';}headers[_0x1b20('0x4e')]=getAuth(_0x12dc41);return getUser(_0x12dc41,_0x279737[_0x1b20('0x4f')])['then'](function(_0x163e14){_0x39e45e=_0x163e14;logger[_0x1b20('0xc')](_0x1b20('0x50'),_0x39e45e['id']);return getEndUser(_0x12dc41,_0x39243a['calleridname'],_0x39243a[_0x1b20('0x51')]);})['then'](function(_0x379cc8){_0x14429c=_0x379cc8;logger[_0x1b20('0xc')](_0x1b20('0x52'),_0x14429c['id']);return getTicket(_0x12dc41,_0x39e45e,_0x14429c,_0x3524b3,_0x39243a);})['then'](function(_0x9dd4f7){if(_0x9dd4f7){logger[_0x1b20('0xc')](_0x1b20('0x53'),_0x9dd4f7['id']);switch(_0x12dc41['type']){case _0x1b20('0x54'):logger[_0x1b20('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x1b20('0x55'),_0x12dc41[_0x1b20('0xe')],_0x39e45e['id'],_0x9dd4f7['id']),'method':'POST'});case _0x1b20('0x56'):logger['info'](_0x1b20('0x49'),_0x1b20('0x57'));emit(util[_0x1b20('0x19')]('user:%s',_0x279737[_0x1b20('0x46')]),'trigger:browser:url',{'uri':util[_0x1b20('0x19')](_0x1b20('0x58'),_0x12dc41[_0x1b20('0xe')],_0x9dd4f7['id'])});break;default:logger[_0x1b20('0x59')](_0x1b20('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x2fc5ae){logger[_0x1b20('0x59')](_0x1b20('0x5a'),util[_0x1b20('0x5b')](_0x2fc5ae,{'showHidden':!![],'depth':null}));});};exports[_0x1b20('0x5c')]=function(_0x57422c,_0x398add,_0x545c98,_0x4eba6a,_0x3111f2,_0x455ce1,_0x557a69){var _0x439d6e,_0x7497f7;_0x455ce1[_0x1b20('0xe')]=intUtil[_0x1b20('0x5d')](_0x455ce1[_0x1b20('0xe')]);_0x455ce1[_0x1b20('0x48')]=intUtil[_0x1b20('0x5d')](_0x455ce1[_0x1b20('0x48')]);if(_0x557a69&&_0x557a69['recordingFormat']&&_0x557a69[_0x1b20('0x5e')]!==_0x1b20('0x5f')){logger[_0x1b20('0xc')](_0x1b20('0x60'),_0x1b20('0x4a'));_0x398add['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x455ce1[_0x1b20('0x48')],_0x398add[_0x1b20('0x4d')],md5(_0x398add['uniqueid']));}headers['Authorization']=getAuth(_0x455ce1);return getUser(_0x455ce1,_0x4eba6a[_0x1b20('0x4f')])[_0x1b20('0x16')](function(_0x5e01a1){_0x439d6e=_0x5e01a1;logger[_0x1b20('0xc')](_0x1b20('0x50'),_0x439d6e['id']);return getEndUser(_0x455ce1,_0x398add[_0x1b20('0x61')],_0x398add[_0x1b20('0x62')]);})[_0x1b20('0x16')](function(_0x3af1c0){_0x7497f7=_0x3af1c0;logger[_0x1b20('0xc')](_0x1b20('0x52'),_0x7497f7['id']);return getTicket(_0x455ce1,_0x439d6e,_0x7497f7,_0x545c98,_0x398add);})[_0x1b20('0x16')](function(_0x35933f){if(_0x35933f){logger[_0x1b20('0xc')]('The\x20Ticket\x20ID\x20is:',_0x35933f['id']);switch(_0x455ce1[_0x1b20('0x42')]){case _0x1b20('0x54'):logger[_0x1b20('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1b20('0x19')](_0x1b20('0x55'),_0x455ce1[_0x1b20('0xe')],_0x439d6e['id'],_0x35933f['id']),'method':'POST'});case _0x1b20('0x56'):logger[_0x1b20('0xc')](_0x1b20('0x60'),_0x1b20('0x57'));emit(util[_0x1b20('0x19')]('user:%s',_0x4eba6a[_0x1b20('0x46')]),'trigger:browser:url',{'uri':util['format'](_0x1b20('0x58'),_0x455ce1[_0x1b20('0xe')],_0x35933f['id'])});break;default:logger[_0x1b20('0x59')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x1b20('0x63')](function(_0x295a2b){logger[_0x1b20('0x59')](_0x1b20('0x64'),util['inspect'](_0x295a2b,{'showHidden':!![],'depth':null}));});};exports[_0x1b20('0x65')]=function(_0x4ca7c0,_0x48d03d,_0x1d8534,_0xe04a46,_0x57e042,_0x12072c){var _0x2a980b,_0x55ae6;_0x12072c['remoteUri']=intUtil[_0x1b20('0x5d')](_0x12072c[_0x1b20('0xe')]);_0x12072c['serverUrl']=intUtil[_0x1b20('0x5d')](_0x12072c[_0x1b20('0x48')]);if(_0x57e042&&_0x57e042[_0x1b20('0x66')]){logger[_0x1b20('0xc')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x48d03d[_0x1b20('0x4b')]=util[_0x1b20('0x19')](_0x1b20('0x4c'),_0x12072c['serverUrl'],_0x48d03d[_0x1b20('0x4d')],md5(_0x48d03d[_0x1b20('0x4d')]));}else{_0x48d03d['recordingURL']='';}headers[_0x1b20('0x4e')]=getAuth(_0x12072c);return getUser(_0x12072c)[_0x1b20('0x16')](function(_0xdf564e){_0x2a980b=_0xdf564e;logger[_0x1b20('0xc')](_0x1b20('0x50'),_0x2a980b['id']);return getEndUser(_0x12072c,_0x48d03d[_0x1b20('0x67')],_0x48d03d[_0x1b20('0x51')]);})[_0x1b20('0x16')](function(_0xdcc117){_0x55ae6=_0xdcc117;logger[_0x1b20('0xc')](_0x1b20('0x52'),_0x55ae6['id']);return getTicket(_0x12072c,_0x2a980b,_0x55ae6,_0x1d8534,_0x48d03d);})['then'](function(_0x88722f){if(_0x88722f){logger[_0x1b20('0xc')](_0x1b20('0x53'),_0x88722f['id']);}})[_0x1b20('0x63')](function(_0x46d993){logger[_0x1b20('0x59')](_0x1b20('0x68'),util[_0x1b20('0x5b')](_0x46d993,{'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 cfb2b14..0220e34 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 _0x5c96=['calleridname','The\x20Enduser\x20ID\x20is:','[ABANDONED]','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','debug','[HTTP]','stringify','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','info','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','Search\x20end\x20user','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','data','enduserType','End\x20user\x20found\x20(Contact)','/crm/v2/Leads/search?criteria=((Phone:equals:','End\x20user\x20found\x20(Lead)','moduleCreate','role','first_name','last_name','SUCCESS','details','Error\x20on\x20Lead\x20retrieve:\x20','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','connect','Call_Result','rejected','abandoned','Abandoned','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','log','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','com','destcalleridname','destcalleridnum','Outbound','user:%s','/crm/EntityInfo.do?module=Calls&id='];(function(_0x4e30be,_0x40445e){var _0x4d1d27=function(_0x532fea){while(--_0x532fea){_0x4e30be['push'](_0x4e30be['shift']());}};_0x4d1d27(++_0x40445e);}(_0x5c96,0x133));var _0x65c9=function(_0xcaea77,_0x168f3b){_0xcaea77=_0xcaea77-0x0;var _0x49db6c=_0x5c96[_0xcaea77];return _0x49db6c;};'use strict';var _=require(_0x65c9('0x0'));var rp=require(_0x65c9('0x1'));var md5=require(_0x65c9('0x2'));var util=require(_0x65c9('0x3'));var intUtil=require('./util');var moment=require(_0x65c9('0x4'));var Redis=require(_0x65c9('0x5'));var config=require(_0x65c9('0x6'));var logger=require(_0x65c9('0x7'))(_0x65c9('0x8'));config[_0x65c9('0x9')]=_[_0x65c9('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x1a9b93,_0x10a355,_0x1c679d){io['to'](_0x1a9b93)['emit'](_0x10a355,_0x1c679d);}function request(_0x2bd3b3){logger[_0x65c9('0xb')](_0x65c9('0xc'),JSON[_0x65c9('0xd')](_0x2bd3b3));return rp(_0x2bd3b3);}function getCustomFields(_0x4106e9,_0x34b7c6){var _0x292827={};if(_0x4106e9['length']>0x0){_['forEach'](_0x4106e9,function(_0x5a29dd){if(_0x5a29dd[_0x65c9('0xe')]===_0x65c9('0xf')&&_0x5a29dd[_0x65c9('0x10')]){_0x292827[_0x5a29dd[_0x65c9('0x10')]]=_0x5a29dd[_0x65c9('0x11')]['toString']();}else if(_0x5a29dd[_0x65c9('0xe')]===_0x65c9('0x12')&&_0x5a29dd[_0x65c9('0x13')]&&_0x5a29dd[_0x65c9('0x10')]&&_0x34b7c6[_0x5a29dd['variableName']]){_0x292827[_0x5a29dd[_0x65c9('0x10')]]=_0x34b7c6[_0x5a29dd[_0x65c9('0x13')]][_0x65c9('0x14')]();}else if(_0x5a29dd[_0x65c9('0xe')]===_0x65c9('0x15')&&_0x5a29dd[_0x65c9('0x16')]&&_0x5a29dd[_0x65c9('0x16')][_0x65c9('0x17')]&&_0x5a29dd[_0x65c9('0x10')]&&_0x34b7c6[_0x5a29dd[_0x65c9('0x16')][_0x65c9('0x17')][_0x65c9('0x18')]()]){_0x292827[_0x5a29dd['idField']]=_0x34b7c6[_0x5a29dd['Variable'][_0x65c9('0x17')][_0x65c9('0x18')]()][_0x65c9('0x14')]();}});}return _0x292827;}function getName(_0x1caf2a){if(_0x1caf2a[_0x65c9('0x19')]('\x20')>0x0){var _0x285850=_0x1caf2a[_0x65c9('0x1a')](/ (.+)/);if(_0x285850[0x1]){return _0x285850;}}return[_0x1caf2a,_0x1caf2a];}var accountsTokens={};function getAccessToken(_0x483c1d){return new Promise(function(_0x42f7f2,_0x4fccab){if(!_['isNil'](accountsTokens[_0x483c1d['id']])&&!_['isNil'](accountsTokens[_0x483c1d['id']]['access_token'])){if(moment()[_0x65c9('0x1b')](accountsTokens[_0x483c1d['id']][_0x65c9('0x1c')])){_0x42f7f2(accountsTokens[_0x483c1d['id']][_0x65c9('0x1d')]);}}var _0x20258f;switch(_0x483c1d[_0x65c9('0x1e')]){case'US':_0x20258f=_0x65c9('0x1f');break;case'AU':_0x20258f=_0x65c9('0x20');break;case'EU':_0x20258f=_0x65c9('0x21');break;case'IN':_0x20258f=_0x65c9('0x22');break;case'CN':_0x20258f=_0x65c9('0x23');break;default:_0x20258f=_0x65c9('0x21');break;}var _0x5c9593={'method':_0x65c9('0x24'),'uri':_0x20258f+_0x65c9('0x25'),'qs':{'refresh_token':_0x483c1d[_0x65c9('0x26')],'client_id':_0x483c1d[_0x65c9('0x27')],'client_secret':_0x483c1d[_0x65c9('0x28')],'grant_type':_0x65c9('0x29')},'json':!![]};return rp(_0x5c9593)[_0x65c9('0x2a')](function(_0x4c6469){accountsTokens[_0x483c1d['id']]={'access_token':_0x4c6469[_0x65c9('0x1d')],'expires_in':moment()[_0x65c9('0x2b')](_0x4c6469['expires_in'],_0x65c9('0x2c'))};_0x42f7f2(_0x4c6469[_0x65c9('0x1d')]);})['catch'](function(_0x1db634){logger[_0x65c9('0x2d')]('Failing\x20creating\x20the\x20access_token',_0x1db634['stack']);_0x4fccab(_0x1db634);});});}function getUser(_0x1b2d58,_0x5612e9,_0x436c32,_0x50fb61){logger[_0x65c9('0x2e')]('Search\x20user');return request({'method':_0x65c9('0x2f'),'uri':util[_0x65c9('0x30')](_0x65c9('0x31'),_0x5612e9),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x65c9('0x32')+_0x1b2d58},'json':!![]})[_0x65c9('0x2a')](function(_0x499fa6){if(_0x499fa6[_0x65c9('0x33')]){var _0x5e61ca=-0x1;if(_[_0x65c9('0x34')](_0x499fa6[_0x65c9('0x33')])){if(!_[_0x65c9('0x35')](_0x50fb61)){_0x5e61ca=_[_0x65c9('0x36')](_0x499fa6['users'],function(_0x1dcd81){return _0x1dcd81[_0x65c9('0x37')]===_0x50fb61;});}if(_0x5e61ca>=0x0){logger[_0x65c9('0x2e')]('Agent\x20found!');}else{logger[_0x65c9('0x2e')](_0x65c9('0x38'));_0x5e61ca=_['findIndex'](_0x499fa6[_0x65c9('0x33')],function(_0x4b2afb){return _0x4b2afb[_0x65c9('0x39')][_0x65c9('0x17')]===_0x65c9('0x3a');});}return _0x499fa6[_0x65c9('0x33')][_0x5e61ca];}else{if(_0x499fa6['user'][_0x65c9('0x39')][_0x65c9('0x17')]==='Administrator'){logger[_0x65c9('0x2e')](_0x65c9('0x38'));user=_0x499fa6[_0x65c9('0x3b')];return user;}else{logger[_0x65c9('0x2d')](_0x65c9('0x3c'),JSON[_0x65c9('0xd')](_0x499fa6));throw new Error(_0x65c9('0x3d')+JSON[_0x65c9('0xd')](_0x499fa6));}}}else{logger[_0x65c9('0x2d')](_0x65c9('0x3c'),JSON[_0x65c9('0xd')](_0x499fa6));throw new Error(_0x65c9('0x3d')+JSON[_0x65c9('0xd')](_0x499fa6));}})[_0x65c9('0x3e')](function(_0x2f04f1){console[_0x65c9('0x2d')](_0x2f04f1);});}function getEndUser(_0x5d41b9,_0x102cfb,_0x4a752e,_0x1cc3bb,_0x2990fa,_0x52885f,_0x4a8803){logger[_0x65c9('0x2e')](_0x65c9('0x3f'));return request({'method':_0x65c9('0x2f'),'uri':_0x65c9('0x40')+_0x102cfb+_0x65c9('0x41')+_0x2990fa+'))','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5d41b9},'json':!![]})[_0x65c9('0x2a')](function(_0x56f553){if(_0x56f553){var _0x4d1692=_0x56f553[_0x65c9('0x42')][0x0];_0x4d1692[_0x65c9('0x43')]='Contacts';logger['info'](_0x65c9('0x44'));return _0x4d1692;}else{return request({'method':'GET','uri':_0x65c9('0x40')+_0x102cfb+_0x65c9('0x45')+_0x2990fa+'))','headers':{'Authorization':_0x65c9('0x32')+_0x5d41b9},'json':!![]})[_0x65c9('0x2a')](function(_0x3fe16b){if(_0x3fe16b){var _0x170ba9=_0x3fe16b[_0x65c9('0x42')][0x0];_0x170ba9[_0x65c9('0x43')]='Leads';logger[_0x65c9('0x2e')](_0x65c9('0x46'));return _0x170ba9;}else{logger[_0x65c9('0x2e')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x1cc3bb=getName(_0x1cc3bb);return request({'method':'POST','uri':_0x65c9('0x40')+_0x102cfb+'/crm/v2/'+_0x4a8803[_0x65c9('0x47')],'body':{'data':[{'Last_Name':_0x1cc3bb[0x1],'First_Name':_0x1cc3bb[0x0],'Phone':_0x2990fa,'Owner':{'name':!_[_0x65c9('0x35')](_0x52885f[_0x65c9('0x48')]['name'])?_0x52885f[_0x65c9('0x48')][_0x65c9('0x17')]:!_[_0x65c9('0x35')](_0x52885f['first_name'])?_0x52885f[_0x65c9('0x49')]+'\x20'+_0x52885f[_0x65c9('0x4a')]:_0x52885f[_0x65c9('0x4a')],'id':_0x52885f['id']}}]},'headers':{'Authorization':_0x65c9('0x32')+_0x5d41b9},'json':!![]})[_0x65c9('0x2a')](function(_0x4dda39){if(_0x4dda39&&_0x4dda39[_0x65c9('0x42')][0x0]['code']===_0x65c9('0x4b')){var _0x498351=_0x4dda39[_0x65c9('0x42')][0x0][_0x65c9('0x4c')];_0x498351['enduserType']=_0x4a8803[_0x65c9('0x47')];return _0x498351;}logger[_0x65c9('0x2d')](_0x65c9('0x3c'),JSON[_0x65c9('0xd')](_0x4dda39));throw new Error(_0x65c9('0x4d')+JSON[_0x65c9('0xd')](_0x4dda39));});}});}});}function getCall(_0x5b783e,_0x24860c,_0x2effbb,_0x29d169,_0x2a47d9,_0x445d84,_0x5b58c2,_0x49f522){logger[_0x65c9('0x2e')](_0x65c9('0x4e'));var _0x28b4d1={};_0x28b4d1[_0x65c9('0x4f')]={'name':!_['isNil'](_0x29d169[_0x65c9('0x48')][_0x65c9('0x17')])&&!_[_0x65c9('0x35')](_0x29d169[_0x65c9('0x39')][_0x65c9('0x17')])&&_0x29d169[_0x65c9('0x39')][_0x65c9('0x17')]===_0x65c9('0x50')?_0x29d169['role'][_0x65c9('0x17')]:!_[_0x65c9('0x35')](_0x29d169[_0x65c9('0x49')])?_0x29d169[_0x65c9('0x49')]+'\x20'+_0x29d169[_0x65c9('0x4a')]:_0x29d169[_0x65c9('0x4a')],'id':_0x29d169['id']};_0x28b4d1[_0x65c9('0x51')]=intUtil[_0x65c9('0x52')](_0x445d84['Subjects'],_0x5b58c2,'\x20');_0x28b4d1[_0x65c9('0x53')]=intUtil[_0x65c9('0x52')](_0x445d84[_0x65c9('0x54')],_0x5b58c2,'\x0a');if(_0x2a47d9['enduserType']==='Contacts'){_0x28b4d1[_0x65c9('0x55')]={'name':!_[_0x65c9('0x35')](_0x2a47d9[_0x65c9('0x56')])?_0x2a47d9[_0x65c9('0x56')]:!_['isNil'](_0x2a47d9['First_Name'])?_0x2a47d9[_0x65c9('0x57')]+'\x20'+_0x2a47d9[_0x65c9('0x58')]:_0x2a47d9[_0x65c9('0x58')],'id':_0x2a47d9['id']};}if(_0x2a47d9[_0x65c9('0x43')]===_0x65c9('0x59')){_0x28b4d1[_0x65c9('0x5a')]={'name':!_[_0x65c9('0x35')](_0x2a47d9[_0x65c9('0x56')])?_0x2a47d9[_0x65c9('0x56')]:!_[_0x65c9('0x35')](_0x2a47d9[_0x65c9('0x57')])?_0x2a47d9[_0x65c9('0x57')]+'\x20'+_0x2a47d9['Last_Name']:_0x2a47d9[_0x65c9('0x58')],'id':_0x2a47d9['id']};_0x28b4d1[_0x65c9('0x5b')]=_0x2a47d9['enduserType'];}if(_0x5b58c2['talktime']){_0x28b4d1[_0x65c9('0x5c')]=moment[_0x65c9('0x5d')](parseInt(_0x5b58c2[_0x65c9('0x5e')])*0x3e8)['format'](_0x65c9('0x5f'));}else if(_0x5b58c2[_0x65c9('0x60')]&&_0x5b58c2[_0x65c9('0x61')]){_0x28b4d1['Call_Duration']=moment[_0x65c9('0x5d')](moment(_0x5b58c2[_0x65c9('0x61')],'YYYY-MM-DDTHH:mm:ss')[_0x65c9('0x62')](moment(_0x5b58c2[_0x65c9('0x63')],_0x65c9('0x64'))))[_0x65c9('0x30')](_0x65c9('0x5f'));}switch(_0x5b58c2[_0x65c9('0x65')]){case _0x65c9('0x66'):_0x28b4d1['Call_Result']=_0x65c9('0x67');break;case _0x65c9('0x68'):case _0x65c9('0x69'):_0x28b4d1[_0x65c9('0x6a')]='Answered';break;case _0x65c9('0x6b'):_0x28b4d1['Call_Result']='Rejected';break;case _0x65c9('0x6c'):_0x28b4d1[_0x65c9('0x6a')]=_0x65c9('0x6d');break;default:}_0x28b4d1[_0x65c9('0x6e')]=(_0x49f522===_0x65c9('0x6f')?moment(_0x5b58c2[_0x65c9('0x63')])['format'](_0x65c9('0x64')):moment(_0x5b58c2[_0x65c9('0x70')])['format'](_0x65c9('0x64')))||moment()[_0x65c9('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x28b4d1[_0x65c9('0x71')]=_0x49f522||_0x65c9('0x72');_0x28b4d1=_[_0x65c9('0x73')](_0x28b4d1,getCustomFields(_0x445d84[_0x65c9('0x74')],_0x5b58c2));return request({'method':'POST','uri':_0x65c9('0x40')+_0x24860c+_0x65c9('0x75'),'headers':{'Authorization':_0x65c9('0x32')+_0x5b783e},'body':{'data':[_0x28b4d1]},'json':!![]})['then'](function(_0x4b5f11){if(_0x4b5f11&&_0x4b5f11[_0x65c9('0x42')][0x0][_0x65c9('0x76')]===_0x65c9('0x4b')){logger[_0x65c9('0x2e')](_0x65c9('0x77'));return{'id':_0x4b5f11[_0x65c9('0x42')][0x0][_0x65c9('0x4c')]['id']};}})['catch'](function(_0x5e06ff){logger[_0x65c9('0x2e')](_0x65c9('0x78'),_0x5e06ff['stack']);console[_0x65c9('0x79')](_0x65c9('0x78'),_0x5e06ff);});}exports[_0x65c9('0x7a')]=function(_0x5db8f0,_0x24e283,_0x391370,_0x40c589,_0xa4af80,_0x1e4da3){var _0x2bc3bd,_0x4696af,_0x2df050;_0x1e4da3[_0x65c9('0x7b')]=intUtil['stripTrailingSlash'](_0x1e4da3['host']);_0x1e4da3[_0x65c9('0x7c')]=intUtil['stripTrailingSlash'](_0x1e4da3['serverUrl']);if(_0xa4af80&&_0xa4af80[_0x65c9('0x7d')]){logger[_0x65c9('0x2e')](_0x65c9('0x7e'),_0x65c9('0x7f'));_0x24e283[_0x65c9('0x80')]=_0x1e4da3[_0x65c9('0x7c')]+_0x65c9('0x81')+_0x24e283[_0x65c9('0x82')]+_0x65c9('0x83')+md5(_0x24e283[_0x65c9('0x82')]);}else{_0x24e283[_0x65c9('0x80')]='';}var _0x58c915=_0x1e4da3[_0x65c9('0x7b')]===_0x65c9('0x84')?'eu':'com';return getAccessToken(_0x1e4da3)[_0x65c9('0x2a')](function(_0x2086d0){_0x2df050=_0x2086d0;return getUser(_0x2df050,_0x58c915,_0x1e4da3,_0x40c589[_0x65c9('0x37')]);})[_0x65c9('0x2a')](function(_0x15440f){_0x2bc3bd=_0x15440f;logger[_0x65c9('0x2e')](_0x65c9('0x85'),_0x2bc3bd['id']);return getEndUser(_0x2df050,_0x58c915,_0x1e4da3,_0x24e283['calleridname'],_0x24e283[_0x65c9('0x86')],_0x2bc3bd,_0x391370);})[_0x65c9('0x2a')](function(_0x245c1c){_0x4696af=_0x245c1c;logger[_0x65c9('0x2e')]('The\x20Enduser\x20ID\x20is:',_0x4696af['id']);return getCall(_0x2df050,_0x58c915,_0x1e4da3,_0x2bc3bd,_0x4696af,_0x391370,_0x24e283,_0x65c9('0x72'));})[_0x65c9('0x2a')](function(_0x4a21fb){if(_0x4a21fb){logger[_0x65c9('0x2e')](_0x65c9('0x87'),_0x4a21fb['id']);logger['info'](_0x65c9('0x7e'),_0x65c9('0x88'));emit(util[_0x65c9('0x30')]('user:%s',_0x40c589['name']),_0x65c9('0x89'),{'uri':_0x65c9('0x8a')+_0x1e4da3[_0x65c9('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4a21fb['id']});}})[_0x65c9('0x3e')](function(_0x82f4e8){logger[_0x65c9('0x2d')](_0x65c9('0x7e'),JSON[_0x65c9('0xd')](_0x82f4e8));});};exports[_0x65c9('0x6f')]=function(_0xea0d11,_0x489724,_0x2d96b5,_0x52b50d,_0xb43947,_0x541ac4,_0x27864e){var _0x2bb161,_0x151c5b,_0x1226f2;_0x541ac4[_0x65c9('0x7b')]=intUtil['stripTrailingSlash'](_0x541ac4[_0x65c9('0x7b')]);_0x541ac4[_0x65c9('0x7c')]=intUtil[_0x65c9('0x8b')](_0x541ac4[_0x65c9('0x7c')]);if(_0x27864e&&_0x27864e[_0x65c9('0x8c')]&&_0x27864e[_0x65c9('0x8c')]!==_0x65c9('0x8d')){logger[_0x65c9('0x2e')](_0x65c9('0x8e'),_0x65c9('0x7f'));_0x489724[_0x65c9('0x80')]=_0x541ac4[_0x65c9('0x7c')]+'/api/voice/recordings/'+_0x489724['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x489724[_0x65c9('0x82')]);}var _0x4ce63a=_0x541ac4[_0x65c9('0x7b')]===_0x65c9('0x84')?'eu':_0x65c9('0x8f');return getAccessToken(_0x541ac4)[_0x65c9('0x2a')](function(_0x28ba01){_0x1226f2=_0x28ba01;return getUser(_0x1226f2,_0x4ce63a,_0x541ac4,_0x52b50d[_0x65c9('0x37')]);})['then'](function(_0x28fa68){_0x2bb161=_0x28fa68;logger['info'](_0x65c9('0x85'),_0x2bb161['id']);return getEndUser(_0x1226f2,_0x4ce63a,_0x541ac4,_0x489724[_0x65c9('0x90')],_0x489724[_0x65c9('0x91')],_0x2bb161,_0x2d96b5);})[_0x65c9('0x2a')](function(_0x538446){_0x151c5b=_0x538446;logger[_0x65c9('0x2e')]('The\x20Enduser\x20ID\x20is:',_0x151c5b['id']);return getCall(_0x1226f2,_0x4ce63a,_0x541ac4,_0x2bb161,_0x151c5b,_0x2d96b5,_0x489724,_0x65c9('0x92'));})[_0x65c9('0x2a')](function(_0x24a09b){if(_0x24a09b){logger['info'](_0x65c9('0x87'),_0x24a09b['id']);logger['info']('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x65c9('0x30')](_0x65c9('0x93'),_0x52b50d['name']),_0x65c9('0x89'),{'uri':'https://crm.'+_0x541ac4[_0x65c9('0x7b')]+_0x65c9('0x94')+_0x24a09b['id']});}})[_0x65c9('0x3e')](function(_0x381ce3){logger[_0x65c9('0x2d')]('[OUTBOUND]',JSON[_0x65c9('0xd')](_0x381ce3));});};exports[_0x65c9('0x6c')]=function(_0x439b55,_0x389989,_0x3fda13,_0x1097b2,_0x3e24f0,_0x199fdb){var _0x56b01d,_0x54c957,_0x48bfcd;_0x199fdb[_0x65c9('0x7b')]=intUtil[_0x65c9('0x8b')](_0x199fdb[_0x65c9('0x7b')]);_0x199fdb[_0x65c9('0x7c')]=intUtil[_0x65c9('0x8b')](_0x199fdb[_0x65c9('0x7c')]);if(_0x3e24f0&&_0x3e24f0[_0x65c9('0x7d')]){logger['info']('[ABANDONED]',_0x65c9('0x7f'));_0x389989[_0x65c9('0x80')]=_0x199fdb[_0x65c9('0x7c')]+'/api/voice/recordings/'+_0x389989[_0x65c9('0x82')]+_0x65c9('0x83')+md5(_0x389989['uniqueid']);}else{_0x389989[_0x65c9('0x80')]='';}var _0x49f2ce=_0x199fdb[_0x65c9('0x7b')]===_0x65c9('0x84')?'eu':_0x65c9('0x8f');return getAccessToken(_0x199fdb)[_0x65c9('0x2a')](function(_0x52ff56){_0x48bfcd=_0x52ff56;return getUser(_0x48bfcd,_0x49f2ce,_0x199fdb);})[_0x65c9('0x2a')](function(_0x2ea706){_0x56b01d=_0x2ea706;logger[_0x65c9('0x2e')]('The\x20User\x20ID\x20is:',_0x56b01d['id']);return getEndUser(_0x48bfcd,_0x49f2ce,_0x199fdb,_0x389989[_0x65c9('0x95')],_0x389989[_0x65c9('0x86')],_0x56b01d,_0x3fda13);})[_0x65c9('0x2a')](function(_0x3d63e6){_0x54c957=_0x3d63e6;logger[_0x65c9('0x2e')](_0x65c9('0x96'),_0x54c957['id']);return getCall(_0x48bfcd,_0x49f2ce,_0x199fdb,_0x56b01d,_0x54c957,_0x3fda13,_0x389989,_0x65c9('0x72'));})[_0x65c9('0x2a')](function(_0x490132){if(_0x490132){logger[_0x65c9('0x2e')](_0x65c9('0x87'),_0x490132['id']);}})[_0x65c9('0x3e')](function(_0x1bf116){logger[_0x65c9('0x2d')](_0x65c9('0x97'),JSON[_0x65c9('0xd')](_0x1bf116));});}; \ No newline at end of file +var _0x5eed=['variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','info','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','data','Contacts','End\x20user\x20found\x20(Contact)','enduserType','Leads','End\x20user\x20found\x20(Lead)','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','/crm/v2/','moduleCreate','role','first_name','last_name','code','details','Error\x20on\x20Lead\x20retrieve:\x20','Owner','Subject','Subjects','Description','getString','Descriptions','Full_Name','First_Name','What_Id','Last_Name','$se_module','talktime','Call_Duration','mm:ss','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','rejected','abandoned','Abandoned','Call_Start_Time','Call_Type','merge','Fields','SUCCESS','err','log','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','/api/voice/recordings/','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','email','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','Outbound','The\x20User\x20ID\x20is:','calleridnum','[ABANDONED]','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','[HTTP]','stringify','length','forEach','string','idField','content','toString','type','variable'];(function(_0x18b298,_0x1d6938){var _0x16015c=function(_0x7b291e){while(--_0x7b291e){_0x18b298['push'](_0x18b298['shift']());}};_0x16015c(++_0x1d6938);}(_0x5eed,0x10a));var _0xd5ee=function(_0xa4a34a,_0x39ef23){_0xa4a34a=_0xa4a34a-0x0;var _0x3fa9e0=_0x5eed[_0xa4a34a];return _0x3fa9e0;};'use strict';var _=require(_0xd5ee('0x0'));var rp=require(_0xd5ee('0x1'));var md5=require(_0xd5ee('0x2'));var util=require(_0xd5ee('0x3'));var intUtil=require(_0xd5ee('0x4'));var moment=require(_0xd5ee('0x5'));var Redis=require(_0xd5ee('0x6'));var config=require(_0xd5ee('0x7'));var logger=require(_0xd5ee('0x8'))(_0xd5ee('0x9'));config['redis']=_[_0xd5ee('0xa')](config[_0xd5ee('0xb')],{'host':_0xd5ee('0xc'),'port':0x18eb});var io=require(_0xd5ee('0xd'))(new Redis(config[_0xd5ee('0xb')]));function emit(_0x181790,_0x162bb5,_0x217e70){io['to'](_0x181790)['emit'](_0x162bb5,_0x217e70);}function request(_0x545c1e){logger['debug'](_0xd5ee('0xe'),JSON[_0xd5ee('0xf')](_0x545c1e));return rp(_0x545c1e);}function getCustomFields(_0x1e92df,_0x21b7af){var _0x472827={};if(_0x1e92df[_0xd5ee('0x10')]>0x0){_[_0xd5ee('0x11')](_0x1e92df,function(_0x245456){if(_0x245456['type']===_0xd5ee('0x12')&&_0x245456[_0xd5ee('0x13')]){_0x472827[_0x245456['idField']]=_0x245456[_0xd5ee('0x14')][_0xd5ee('0x15')]();}else if(_0x245456[_0xd5ee('0x16')]===_0xd5ee('0x17')&&_0x245456[_0xd5ee('0x18')]&&_0x245456['idField']&&_0x21b7af[_0x245456['variableName']]){_0x472827[_0x245456['idField']]=_0x21b7af[_0x245456[_0xd5ee('0x18')]][_0xd5ee('0x15')]();}else if(_0x245456['type']==='customVariable'&&_0x245456[_0xd5ee('0x19')]&&_0x245456[_0xd5ee('0x19')]['name']&&_0x245456[_0xd5ee('0x13')]&&_0x21b7af[_0x245456[_0xd5ee('0x19')][_0xd5ee('0x1a')][_0xd5ee('0x1b')]()]){_0x472827[_0x245456[_0xd5ee('0x13')]]=_0x21b7af[_0x245456[_0xd5ee('0x19')][_0xd5ee('0x1a')][_0xd5ee('0x1b')]()][_0xd5ee('0x15')]();}});}return _0x472827;}function getName(_0x343e0a){if(_0x343e0a['indexOf']('\x20')>0x0){var _0x2e0c27=_0x343e0a[_0xd5ee('0x1c')](/ (.+)/);if(_0x2e0c27[0x1]){return _0x2e0c27;}}return[_0x343e0a,_0x343e0a];}var accountsTokens={};function getAccessToken(_0x218bad){return new Promise(function(_0x120224,_0x3f7c29){if(!_['isNil'](accountsTokens[_0x218bad['id']])&&!_[_0xd5ee('0x1d')](accountsTokens[_0x218bad['id']][_0xd5ee('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x218bad['id']][_0xd5ee('0x1f')])){_0x120224(accountsTokens[_0x218bad['id']][_0xd5ee('0x1e')]);}}var _0x37d7e6;switch(_0x218bad[_0xd5ee('0x20')]){case'US':_0x37d7e6=_0xd5ee('0x21');break;case'AU':_0x37d7e6=_0xd5ee('0x22');break;case'EU':_0x37d7e6=_0xd5ee('0x23');break;case'IN':_0x37d7e6=_0xd5ee('0x24');break;case'CN':_0x37d7e6=_0xd5ee('0x25');break;default:_0x37d7e6=_0xd5ee('0x23');break;}var _0x608bbc={'method':'POST','uri':_0x37d7e6+_0xd5ee('0x26'),'qs':{'refresh_token':_0x218bad['refreshToken'],'client_id':_0x218bad[_0xd5ee('0x27')],'client_secret':_0x218bad[_0xd5ee('0x28')],'grant_type':_0xd5ee('0x29')},'json':!![]};return rp(_0x608bbc)[_0xd5ee('0x2a')](function(_0x459a47){accountsTokens[_0x218bad['id']]={'access_token':_0x459a47[_0xd5ee('0x1e')],'expires_in':moment()[_0xd5ee('0x2b')](_0x459a47[_0xd5ee('0x1f')],_0xd5ee('0x2c'))};_0x120224(_0x459a47['access_token']);})[_0xd5ee('0x2d')](function(_0x586d7d){logger[_0xd5ee('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x586d7d[_0xd5ee('0x2f')]);_0x3f7c29(_0x586d7d);});});}function getUser(_0x315b55,_0x2e4a2b,_0x4ca688,_0x1b8d7e){logger['info'](_0xd5ee('0x30'));return request({'method':_0xd5ee('0x31'),'uri':util[_0xd5ee('0x32')](_0xd5ee('0x33'),_0x2e4a2b),'qs':{'type':_0xd5ee('0x34')},'headers':{'Authorization':_0xd5ee('0x35')+_0x315b55},'json':!![]})[_0xd5ee('0x2a')](function(_0x4ae18b){if(_0x4ae18b[_0xd5ee('0x36')]){var _0x1238bf=-0x1;if(_['isArrayLikeObject'](_0x4ae18b[_0xd5ee('0x36')])){if(!_[_0xd5ee('0x1d')](_0x1b8d7e)){_0x1238bf=_['findIndex'](_0x4ae18b[_0xd5ee('0x36')],function(_0x43d337){return _0x43d337['email']===_0x1b8d7e;});}if(_0x1238bf>=0x0){logger['info'](_0xd5ee('0x37'));}else{logger['info'](_0xd5ee('0x38'));_0x1238bf=_['findIndex'](_0x4ae18b[_0xd5ee('0x36')],function(_0x4e1780){return _0x4e1780[_0xd5ee('0x39')]['name']===_0xd5ee('0x3a');});}return _0x4ae18b[_0xd5ee('0x36')][_0x1238bf];}else{if(_0x4ae18b[_0xd5ee('0x3b')][_0xd5ee('0x39')][_0xd5ee('0x1a')]===_0xd5ee('0x3a')){logger['info'](_0xd5ee('0x38'));user=_0x4ae18b[_0xd5ee('0x3b')];return user;}else{logger[_0xd5ee('0x2e')](_0xd5ee('0x3c'),JSON[_0xd5ee('0xf')](_0x4ae18b));throw new Error(_0xd5ee('0x3d')+JSON[_0xd5ee('0xf')](_0x4ae18b));}}}else{logger[_0xd5ee('0x2e')](_0xd5ee('0x3c'),JSON['stringify'](_0x4ae18b));throw new Error(_0xd5ee('0x3d')+JSON['stringify'](_0x4ae18b));}})[_0xd5ee('0x2d')](function(_0x2980e6){console[_0xd5ee('0x2e')](_0x2980e6);});}function getEndUser(_0x400301,_0x593278,_0xd4be67,_0x500051,_0x426305,_0x156563,_0x2e0a23){logger[_0xd5ee('0x3e')]('Search\x20end\x20user');return request({'method':_0xd5ee('0x31'),'uri':_0xd5ee('0x3f')+_0x593278+_0xd5ee('0x40')+_0x426305+'))','headers':{'Authorization':_0xd5ee('0x35')+_0x400301},'json':!![]})[_0xd5ee('0x2a')](function(_0x169ec9){if(_0x169ec9){var _0x2617c6=_0x169ec9[_0xd5ee('0x41')][0x0];_0x2617c6['enduserType']=_0xd5ee('0x42');logger['info'](_0xd5ee('0x43'));return _0x2617c6;}else{return request({'method':_0xd5ee('0x31'),'uri':_0xd5ee('0x3f')+_0x593278+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x426305+'))','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x400301},'json':!![]})[_0xd5ee('0x2a')](function(_0x23ace8){if(_0x23ace8){var _0x4ae065=_0x23ace8['data'][0x0];_0x4ae065[_0xd5ee('0x44')]=_0xd5ee('0x45');logger[_0xd5ee('0x3e')](_0xd5ee('0x46'));return _0x4ae065;}else{logger['info'](_0xd5ee('0x47'));_0x500051=getName(_0x500051);return request({'method':'POST','uri':_0xd5ee('0x3f')+_0x593278+_0xd5ee('0x48')+_0x2e0a23[_0xd5ee('0x49')],'body':{'data':[{'Last_Name':_0x500051[0x1],'First_Name':_0x500051[0x0],'Phone':_0x426305,'Owner':{'name':!_[_0xd5ee('0x1d')](_0x156563[_0xd5ee('0x4a')][_0xd5ee('0x1a')])?_0x156563[_0xd5ee('0x4a')]['name']:!_['isNil'](_0x156563[_0xd5ee('0x4b')])?_0x156563[_0xd5ee('0x4b')]+'\x20'+_0x156563[_0xd5ee('0x4c')]:_0x156563['last_name'],'id':_0x156563['id']}}]},'headers':{'Authorization':_0xd5ee('0x35')+_0x400301},'json':!![]})['then'](function(_0x4b44e4){if(_0x4b44e4&&_0x4b44e4['data'][0x0][_0xd5ee('0x4d')]==='SUCCESS'){var _0x195324=_0x4b44e4['data'][0x0][_0xd5ee('0x4e')];_0x195324[_0xd5ee('0x44')]=_0x2e0a23['moduleCreate'];return _0x195324;}logger[_0xd5ee('0x2e')](_0xd5ee('0x3c'),JSON['stringify'](_0x4b44e4));throw new Error(_0xd5ee('0x4f')+JSON['stringify'](_0x4b44e4));});}});}});}function getCall(_0xa63272,_0x32576c,_0x522171,_0x234363,_0x13bbde,_0xf7d339,_0x4d0403,_0x51f245){logger['info']('Creating\x20new\x20call...');var _0x4bd8ee={};_0x4bd8ee[_0xd5ee('0x50')]={'name':!_[_0xd5ee('0x1d')](_0x234363[_0xd5ee('0x4a')][_0xd5ee('0x1a')])&&!_[_0xd5ee('0x1d')](_0x234363[_0xd5ee('0x39')][_0xd5ee('0x1a')])&&_0x234363[_0xd5ee('0x39')][_0xd5ee('0x1a')]==='administrator'?_0x234363[_0xd5ee('0x4a')][_0xd5ee('0x1a')]:!_[_0xd5ee('0x1d')](_0x234363['first_name'])?_0x234363[_0xd5ee('0x4b')]+'\x20'+_0x234363[_0xd5ee('0x4c')]:_0x234363[_0xd5ee('0x4c')],'id':_0x234363['id']};_0x4bd8ee[_0xd5ee('0x51')]=intUtil['getString'](_0xf7d339[_0xd5ee('0x52')],_0x4d0403,'\x20');_0x4bd8ee[_0xd5ee('0x53')]=intUtil[_0xd5ee('0x54')](_0xf7d339[_0xd5ee('0x55')],_0x4d0403,'\x0a');if(_0x13bbde[_0xd5ee('0x44')]===_0xd5ee('0x42')){_0x4bd8ee['Who_Id']={'name':!_['isNil'](_0x13bbde[_0xd5ee('0x56')])?_0x13bbde[_0xd5ee('0x56')]:!_[_0xd5ee('0x1d')](_0x13bbde[_0xd5ee('0x57')])?_0x13bbde[_0xd5ee('0x57')]+'\x20'+_0x13bbde['Last_Name']:_0x13bbde['Last_Name'],'id':_0x13bbde['id']};}if(_0x13bbde[_0xd5ee('0x44')]==='Leads'){_0x4bd8ee[_0xd5ee('0x58')]={'name':!_[_0xd5ee('0x1d')](_0x13bbde[_0xd5ee('0x56')])?_0x13bbde[_0xd5ee('0x56')]:!_['isNil'](_0x13bbde['First_Name'])?_0x13bbde[_0xd5ee('0x57')]+'\x20'+_0x13bbde[_0xd5ee('0x59')]:_0x13bbde[_0xd5ee('0x59')],'id':_0x13bbde['id']};_0x4bd8ee[_0xd5ee('0x5a')]=_0x13bbde[_0xd5ee('0x44')];}if(_0x4d0403[_0xd5ee('0x5b')]){_0x4bd8ee[_0xd5ee('0x5c')]=moment['utc'](parseInt(_0x4d0403[_0xd5ee('0x5b')])*0x3e8)['format'](_0xd5ee('0x5d'));}else if(_0x4d0403['answertime']&&_0x4d0403['endtime']){_0x4bd8ee[_0xd5ee('0x5c')]=moment[_0xd5ee('0x5e')](moment(_0x4d0403[_0xd5ee('0x5f')],_0xd5ee('0x60'))[_0xd5ee('0x61')](moment(_0x4d0403[_0xd5ee('0x62')],_0xd5ee('0x60'))))[_0xd5ee('0x32')](_0xd5ee('0x5d'));}switch(_0x4d0403[_0xd5ee('0x63')]){case _0xd5ee('0x64'):_0x4bd8ee[_0xd5ee('0x65')]='Called';break;case _0xd5ee('0x66'):case _0xd5ee('0x67'):_0x4bd8ee[_0xd5ee('0x65')]='Answered';break;case _0xd5ee('0x68'):_0x4bd8ee[_0xd5ee('0x65')]='Rejected';break;case _0xd5ee('0x69'):_0x4bd8ee['Call_Result']=_0xd5ee('0x6a');break;default:}_0x4bd8ee[_0xd5ee('0x6b')]=(_0x51f245==='outbound'?moment(_0x4d0403[_0xd5ee('0x62')])[_0xd5ee('0x32')](_0xd5ee('0x60')):moment(_0x4d0403['agentcalledAt'])[_0xd5ee('0x32')](_0xd5ee('0x60')))||moment()[_0xd5ee('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x4bd8ee[_0xd5ee('0x6c')]=_0x51f245||'Inbound';_0x4bd8ee=_[_0xd5ee('0x6d')](_0x4bd8ee,getCustomFields(_0xf7d339[_0xd5ee('0x6e')],_0x4d0403));return request({'method':'POST','uri':_0xd5ee('0x3f')+_0x32576c+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xa63272},'body':{'data':[_0x4bd8ee]},'json':!![]})[_0xd5ee('0x2a')](function(_0x47a777){if(_0x47a777&&_0x47a777[_0xd5ee('0x41')][0x0]['code']===_0xd5ee('0x6f')){logger[_0xd5ee('0x3e')]('Call\x20created!');return{'id':_0x47a777[_0xd5ee('0x41')][0x0][_0xd5ee('0x4e')]['id']};}})[_0xd5ee('0x2d')](function(_0x28733d){logger[_0xd5ee('0x3e')](_0xd5ee('0x70'),_0x28733d[_0xd5ee('0x2f')]);console[_0xd5ee('0x71')]('err',_0x28733d);});}exports[_0xd5ee('0x72')]=function(_0x353d01,_0x4d25e5,_0x4154c6,_0x435430,_0x459ec1,_0x212327){var _0x43f7c6,_0x4ec764,_0x5333c8;_0x212327[_0xd5ee('0x73')]=intUtil['stripTrailingSlash'](_0x212327['host']);_0x212327[_0xd5ee('0x74')]=intUtil[_0xd5ee('0x75')](_0x212327[_0xd5ee('0x74')]);if(_0x459ec1&&_0x459ec1[_0xd5ee('0x76')]){logger[_0xd5ee('0x3e')](_0xd5ee('0x77'),'Recording\x20is\x20enabled!');_0x4d25e5['recordingURL']=_0x212327[_0xd5ee('0x74')]+_0xd5ee('0x78')+_0x4d25e5['uniqueid']+_0xd5ee('0x79')+md5(_0x4d25e5['uniqueid']);}else{_0x4d25e5[_0xd5ee('0x7a')]='';}var _0x5bbc78=_0x212327[_0xd5ee('0x73')]===_0xd5ee('0x7b')?'eu':_0xd5ee('0x7c');return getAccessToken(_0x212327)['then'](function(_0x4f59e9){_0x5333c8=_0x4f59e9;return getUser(_0x5333c8,_0x5bbc78,_0x212327,_0x435430[_0xd5ee('0x7d')]);})[_0xd5ee('0x2a')](function(_0xbcd378){_0x43f7c6=_0xbcd378;logger[_0xd5ee('0x3e')]('The\x20User\x20ID\x20is:',_0x43f7c6['id']);return getEndUser(_0x5333c8,_0x5bbc78,_0x212327,_0x4d25e5[_0xd5ee('0x7e')],_0x4d25e5['calleridnum'],_0x43f7c6,_0x4154c6);})[_0xd5ee('0x2a')](function(_0x369bfb){_0x4ec764=_0x369bfb;logger[_0xd5ee('0x3e')](_0xd5ee('0x7f'),_0x4ec764['id']);return getCall(_0x5333c8,_0x5bbc78,_0x212327,_0x43f7c6,_0x4ec764,_0x4154c6,_0x4d25e5,_0xd5ee('0x80'));})['then'](function(_0x171b2c){if(_0x171b2c){logger[_0xd5ee('0x3e')](_0xd5ee('0x81'),_0x171b2c['id']);logger[_0xd5ee('0x3e')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd5ee('0x82'),_0x435430['name']),'trigger:browser:url',{'uri':_0xd5ee('0x83')+_0x212327[_0xd5ee('0x73')]+_0xd5ee('0x84')+_0x171b2c['id']});}})['catch'](function(_0x128546){logger[_0xd5ee('0x2e')](_0xd5ee('0x77'),JSON['stringify'](_0x128546));});};exports[_0xd5ee('0x85')]=function(_0x3d8c0f,_0x220ea4,_0x571572,_0x572ac5,_0x467974,_0x2e150a,_0x3c2c93){var _0x5edecc,_0x190377,_0x5e303a;_0x2e150a[_0xd5ee('0x73')]=intUtil[_0xd5ee('0x75')](_0x2e150a[_0xd5ee('0x73')]);_0x2e150a[_0xd5ee('0x74')]=intUtil[_0xd5ee('0x75')](_0x2e150a[_0xd5ee('0x74')]);if(_0x3c2c93&&_0x3c2c93[_0xd5ee('0x86')]&&_0x3c2c93[_0xd5ee('0x86')]!==_0xd5ee('0x87')){logger['info'](_0xd5ee('0x88'),_0xd5ee('0x89'));_0x220ea4['recordingURL']=_0x2e150a['serverUrl']+_0xd5ee('0x78')+_0x220ea4[_0xd5ee('0x8a')]+_0xd5ee('0x79')+md5(_0x220ea4[_0xd5ee('0x8a')]);}var _0x470f1b=_0x2e150a[_0xd5ee('0x73')]==='zoho.eu'?'eu':_0xd5ee('0x7c');return getAccessToken(_0x2e150a)[_0xd5ee('0x2a')](function(_0x4928e6){_0x5e303a=_0x4928e6;return getUser(_0x5e303a,_0x470f1b,_0x2e150a,_0x572ac5[_0xd5ee('0x7d')]);})[_0xd5ee('0x2a')](function(_0xfbf744){_0x5edecc=_0xfbf744;logger[_0xd5ee('0x3e')]('The\x20User\x20ID\x20is:',_0x5edecc['id']);return getEndUser(_0x5e303a,_0x470f1b,_0x2e150a,_0x220ea4[_0xd5ee('0x8b')],_0x220ea4[_0xd5ee('0x8c')],_0x5edecc,_0x571572);})[_0xd5ee('0x2a')](function(_0x49405f){_0x190377=_0x49405f;logger[_0xd5ee('0x3e')](_0xd5ee('0x7f'),_0x190377['id']);return getCall(_0x5e303a,_0x470f1b,_0x2e150a,_0x5edecc,_0x190377,_0x571572,_0x220ea4,_0xd5ee('0x8d'));})[_0xd5ee('0x2a')](function(_0x594376){if(_0x594376){logger[_0xd5ee('0x3e')]('The\x20Call\x20ID\x20is:',_0x594376['id']);logger[_0xd5ee('0x3e')](_0xd5ee('0x88'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd5ee('0x82'),_0x572ac5[_0xd5ee('0x1a')]),'trigger:browser:url',{'uri':_0xd5ee('0x83')+_0x2e150a['host']+_0xd5ee('0x84')+_0x594376['id']});}})[_0xd5ee('0x2d')](function(_0xc1c484){logger[_0xd5ee('0x2e')](_0xd5ee('0x88'),JSON[_0xd5ee('0xf')](_0xc1c484));});};exports[_0xd5ee('0x69')]=function(_0x5ad20f,_0x27a470,_0xaabe85,_0x2817c6,_0x1e94d8,_0x20d52d){var _0x46ba21,_0x74d81c,_0x5d387e;_0x20d52d[_0xd5ee('0x73')]=intUtil['stripTrailingSlash'](_0x20d52d[_0xd5ee('0x73')]);_0x20d52d[_0xd5ee('0x74')]=intUtil[_0xd5ee('0x75')](_0x20d52d[_0xd5ee('0x74')]);if(_0x1e94d8&&_0x1e94d8[_0xd5ee('0x76')]){logger[_0xd5ee('0x3e')]('[ABANDONED]',_0xd5ee('0x89'));_0x27a470[_0xd5ee('0x7a')]=_0x20d52d[_0xd5ee('0x74')]+'/api/voice/recordings/'+_0x27a470['uniqueid']+_0xd5ee('0x79')+md5(_0x27a470['uniqueid']);}else{_0x27a470['recordingURL']='';}var _0xc4a9d8=_0x20d52d[_0xd5ee('0x73')]===_0xd5ee('0x7b')?'eu':'com';return getAccessToken(_0x20d52d)['then'](function(_0x364437){_0x5d387e=_0x364437;return getUser(_0x5d387e,_0xc4a9d8,_0x20d52d);})['then'](function(_0x1816a7){_0x46ba21=_0x1816a7;logger[_0xd5ee('0x3e')](_0xd5ee('0x8e'),_0x46ba21['id']);return getEndUser(_0x5d387e,_0xc4a9d8,_0x20d52d,_0x27a470[_0xd5ee('0x7e')],_0x27a470[_0xd5ee('0x8f')],_0x46ba21,_0xaabe85);})[_0xd5ee('0x2a')](function(_0x1951b7){_0x74d81c=_0x1951b7;logger[_0xd5ee('0x3e')]('The\x20Enduser\x20ID\x20is:',_0x74d81c['id']);return getCall(_0x5d387e,_0xc4a9d8,_0x20d52d,_0x46ba21,_0x74d81c,_0xaabe85,_0x27a470,_0xd5ee('0x80'));})['then'](function(_0x2b6a87){if(_0x2b6a87){logger[_0xd5ee('0x3e')](_0xd5ee('0x81'),_0x2b6a87['id']);}})[_0xd5ee('0x2d')](function(_0x4471e8){logger[_0xd5ee('0x2e')](_0xd5ee('0x90'),JSON[_0xd5ee('0xf')](_0x4471e8));});}; \ 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 b39b0f8..0abcf5c 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(_0x58adb5,_0x58df75){var _0xf12ccd=function(_0x3e6a32){while(--_0x3e6a32){_0x58adb5['push'](_0x58adb5['shift']());}};_0xf12ccd(++_0x58df75);}(_0x7a54,0x106));var _0x47a5=function(_0x2e71b7,_0x279c21){_0x2e71b7=_0x2e71b7-0x0;var _0x6a55f3=_0x7a54[_0x2e71b7];return _0x6a55f3;};'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(_0x553295,_0x11345b){var _0x153cbb=function(_0x1b8011){while(--_0x1b8011){_0x553295['push'](_0x553295['shift']());}};_0x153cbb(++_0x11345b);}(_0x7a54,0x106));var _0x47a5=function(_0x91ee3f,_0x56fc34){_0x91ee3f=_0x91ee3f-0x0;var _0x348e35=_0x7a54[_0x91ee3f];return _0x348e35;};'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 b58d52f..af23578 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0xaea385,_0x131de1){var _0x14e31b=function(_0x50ac68){while(--_0x50ac68){_0xaea385['push'](_0xaea385['shift']());}};_0x14e31b(++_0x131de1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b2957,_0x5bf59c){_0x5b2957=_0x5b2957-0x0;var _0x48f76f=_0x5f2f[_0x5b2957];return _0x48f76f;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x947023,_0x42cb83){var _0x5ef2d1=function(_0x331cb3){while(--_0x331cb3){_0x947023['push'](_0x947023['shift']());}};_0x5ef2d1(++_0x42cb83);}(_0xb10b,0x12a));var _0xbb10=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0xb10b[_0x2aa48b];return _0x48caf8;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 66b9213..671acd6 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 _0x624c=['message','catch','bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error'];(function(_0x147327,_0x271105){var _0x533aee=function(_0x427450){while(--_0x427450){_0x147327['push'](_0x147327['shift']());}};_0x533aee(++_0x271105);}(_0x624c,0x1ee));var _0xc624=function(_0xd25da3,_0x2a7b4f){_0xd25da3=_0xd25da3-0x0;var _0x531cab=_0x624c[_0xd25da3];return _0x531cab;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc624('0x0'));var logger=require(_0xc624('0x1'))(_0xc624('0x2'));var client=jayson[_0xc624('0x3')][_0xc624('0x4')]({'port':0x2329});client['Request']=function(_0x406db7,_0x483c73){return new BPromise(function(_0x1e6dbe,_0x5f0cc1){return client[_0xc624('0x5')](_0x406db7,_0x483c73)[_0xc624('0x6')](function(_0x39759e){logger[_0xc624('0x7')](_0xc624('0x8'),_0xc624('0x2'),_0x406db7,_0x483c73,_0x39759e);if(_0x39759e[_0xc624('0x9')]){logger['error'](_0xc624('0x8'),_0xc624('0x2'),_0x406db7,_0x39759e[_0xc624('0x9')]['message'],_0x483c73);return _0x5f0cc1(_0x39759e[_0xc624('0x9')][_0xc624('0xa')]);}else{return _0x1e6dbe(_0x39759e['result']);}})[_0xc624('0xb')](function(_0x24cb84){logger[_0xc624('0x9')](_0xc624('0x8'),_0xc624('0x2'),_0x406db7,_0x24cb84,_0x483c73);return _0x5f0cc1(_0x24cb84);});});};module['exports']=client; \ No newline at end of file +var _0x851c=['routing','client','http','Request','request','then','debug','error','message','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x5b495b,_0x2ad13e){var _0x1796ec=function(_0x4a4cb8){while(--_0x4a4cb8){_0x5b495b['push'](_0x5b495b['shift']());}};_0x1796ec(++_0x2ad13e);}(_0x851c,0x19d));var _0xc851=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x851c[_0x397e5f];return _0x5302b8;};'use strict';var jayson=require(_0xc851('0x0'));var BPromise=require(_0xc851('0x1'));var logger=require(_0xc851('0x2'))(_0xc851('0x3'));var client=jayson[_0xc851('0x4')][_0xc851('0x5')]({'port':0x2329});client[_0xc851('0x6')]=function(_0x4ad892,_0x2fddd4){return new BPromise(function(_0x84f5ad,_0x52374b){return client[_0xc851('0x7')](_0x4ad892,_0x2fddd4)[_0xc851('0x8')](function(_0x535cf1){logger[_0xc851('0x9')]('rpc','routing',_0x4ad892,_0x2fddd4,_0x535cf1);if(_0x535cf1[_0xc851('0xa')]){logger['error']('rpc',_0xc851('0x3'),_0x4ad892,_0x535cf1[_0xc851('0xa')][_0xc851('0xb')],_0x2fddd4);return _0x52374b(_0x535cf1[_0xc851('0xa')][_0xc851('0xb')]);}else{return _0x84f5ad(_0x535cf1[_0xc851('0xc')]);}})[_0xc851('0xd')](function(_0x69ce5a){logger['error'](_0xc851('0xe'),_0xc851('0x3'),_0x4ad892,_0x69ce5a,_0x2fddd4);return _0x52374b(_0x69ce5a);});});};module[_0xc851('0xf')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index c71fcc2..e19d8dd 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 _0x7f05=['mailAccounts','findOne','loginMailFrequency','catch','bluebird','./server','./realtime','./rpc/mailAccount','resolve','then','initMailAccounts','refresh'];(function(_0x4edcc0,_0x454306){var _0x493289=function(_0x27c33d){while(--_0x27c33d){_0x4edcc0['push'](_0x4edcc0['shift']());}};_0x493289(++_0x454306);}(_0x7f05,0xdc));var _0x57f0=function(_0x1af6eb,_0x5f3f64){_0x1af6eb=_0x1af6eb-0x0;var _0xc0472e=_0x7f05[_0x1af6eb];return _0xc0472e;};'use strict';var BPromise=require(_0x57f0('0x0'));var server=require(_0x57f0('0x1'));var Realtime=require(_0x57f0('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x57f0('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x57f0('0x4')]()[_0x57f0('0x5')](mailAccount['getMailAccounts']())[_0x57f0('0x5')](realtime[_0x57f0('0x6')]())['then'](function(){email[_0x57f0('0x7')](realtime[_0x57f0('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x57f0('0x5')](function(_0x574a16){return initRealtime();})[_0x57f0('0x5')](function(_0x55d417){return db['Setting'][_0x57f0('0x9')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0x57f0('0x5')](function(_0x30ff14){return setInterval(initRealtime,_0x30ff14[_0x57f0('0xa')]*0x3e8);})[_0x57f0('0xb')](function(_0x5a715b){console['log'](_0x5a715b);});}main(); \ No newline at end of file +var _0xc4f5=['../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','loginMailFrequency','catch','log','./server','./realtime','./lib/email'];(function(_0x490741,_0x145ff4){var _0xc1fe7d=function(_0x255237){while(--_0x255237){_0x490741['push'](_0x490741['shift']());}};_0xc1fe7d(++_0x145ff4);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x79ef34,_0x42d1a1){_0x79ef34=_0x79ef34-0x0;var _0x43d708=_0xc4f5[_0x79ef34];return _0x43d708;};'use strict';var BPromise=require('bluebird');var server=require(_0x5c4f('0x0'));var Realtime=require(_0x5c4f('0x1'));var EmailChannel=require(_0x5c4f('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5c4f('0x3'))['db'];function initRealtime(){return BPromise[_0x5c4f('0x4')]()[_0x5c4f('0x5')](mailAccount[_0x5c4f('0x6')]())[_0x5c4f('0x5')](realtime['initMailAccounts']())[_0x5c4f('0x5')](function(){email[_0x5c4f('0x7')](realtime[_0x5c4f('0x8')]);return realtime;});}function main(){return server[_0x5c4f('0x9')](realtime,email)[_0x5c4f('0x5')](function(_0x48f095){return initRealtime();})[_0x5c4f('0x5')](function(_0x4a7bd4){return db[_0x5c4f('0xa')]['findOne']({'attributes':['id',_0x5c4f('0xb')],'raw':!![]});})[_0x5c4f('0x5')](function(_0x19623c){return setInterval(initRealtime,_0x19623c[_0x5c4f('0xb')]*0x3e8);})[_0x5c4f('0xc')](function(_0x2a9bf9){console[_0x5c4f('0xd')](_0x2a9bf9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index cf6b9da..597be9e 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 _0xcd85=['messages','firstName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','imapAccounts','smtp','emit','mailAccounts','name','active','Imap','status','total','stringify','mailAccount:update','prototype','hasOwnProperty','email','box','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','isNil','disabled','handleImapBox','connected','messageStatus'];(function(_0x34d7cc,_0x2b7d14){var _0x24f692=function(_0x2d3300){while(--_0x2d3300){_0x34d7cc['push'](_0x34d7cc['shift']());}};_0x24f692(++_0x2b7d14);}(_0xcd85,0xac));var _0x5cd8=function(_0x29a707,_0x342505){_0x29a707=_0x29a707-0x0;var _0x229e83=_0xcd85[_0x29a707];return _0x229e83;};'use strict';var _=require(_0x5cd8('0x0'));var moment=require(_0x5cd8('0x1'));var BPromise=require(_0x5cd8('0x2'));var md5=require(_0x5cd8('0x3'));var Redis=require(_0x5cd8('0x4'));var config=require('../../../config/environment');var logger=require(_0x5cd8('0x5'))('email');config[_0x5cd8('0x6')]=_[_0x5cd8('0x7')](config[_0x5cd8('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5cd8('0x8'))(new Redis(config[_0x5cd8('0x6')]));var EmailImap=require(_0x5cd8('0x9'));var EmailSmtp=require(_0x5cd8('0xa'));var mailAccount=require(_0x5cd8('0xb'));var md5Accounts={};function EmailChannel(_0x253545){logger[_0x5cd8('0xc')](_0x5cd8('0xd'));this['mailAccounts']=_0x253545['mailAccounts'];this[_0x5cd8('0xe')]={};this[_0x5cd8('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0x5cd8('0x10')]=function(_0x3e24c8){var _0x427db5=this[_0x5cd8('0x11')][_0x3e24c8];var _0x39d082={'id':_0x427db5['id'],'name':_0x427db5[_0x5cd8('0x12')],'key':_0x427db5['key'],'active':_0x427db5[_0x5cd8('0x13')],'Imap':{'status':_0x427db5[_0x5cd8('0x14')][_0x5cd8('0x15')],'messageStatus':_0x427db5['Imap']['messageStatus'],'total':_0x427db5['Imap'][_0x5cd8('0x16')]}};if(_['isNil'](md5Accounts[_0x3e24c8])){md5Accounts[_0x3e24c8]={};}var _0x2d48ab=md5(JSON[_0x5cd8('0x17')](_0x39d082));if(md5Accounts[_0x3e24c8]['md5']!==_0x2d48ab){md5Accounts[_0x3e24c8][_0x5cd8('0x3')]=_0x2d48ab;io[_0x5cd8('0x10')](_0x5cd8('0x18'),_0x39d082);}};EmailChannel[_0x5cd8('0x19')]['refresh']=function(_0x4f7f66){for(var _0x42141a in _0x4f7f66){if(_0x4f7f66[_0x5cd8('0x1a')](_0x42141a)){if(_0x4f7f66[_0x42141a]['Imap']&&_0x4f7f66[_0x42141a][_0x5cd8('0x13')]){var _0xd7ef99=_0x4f7f66[_0x42141a]['Imap'];if(!this[_0x5cd8('0xe')]['hasOwnProperty'](_0xd7ef99['id'])){this[_0x5cd8('0xe')][_0xd7ef99['id']]=new EmailImap(_0xd7ef99,_0x4f7f66[_0x42141a][_0x5cd8('0x1b')]);this['imapAccounts'][_0xd7ef99['id']]['on'](_0x5cd8('0x1c'),this['handleImapBox']['bind'](this,_0x42141a));this[_0x5cd8('0xe')][_0xd7ef99['id']]['on'](_0x5cd8('0x1b'),this[_0x5cd8('0x1d')][_0x5cd8('0x1e')](this,_0x42141a));this[_0x5cd8('0xe')][_0xd7ef99['id']]['on'](_0x5cd8('0x1f'),this[_0x5cd8('0x20')][_0x5cd8('0x1e')](this,_0x42141a));this[_0x5cd8('0xe')][_0xd7ef99['id']]['on'](_0x5cd8('0x21'),this[_0x5cd8('0x22')]['bind'](this,_0x42141a));}}else{if(_[_0x5cd8('0x23')](this['mailAccounts'][_0x42141a]['Imap'])){this[_0x5cd8('0x11')][_0x42141a][_0x5cd8('0x14')]={};}this[_0x5cd8('0x11')][_0x42141a][_0x5cd8('0x14')][_0x5cd8('0x15')]=_0x5cd8('0x24');this[_0x5cd8('0x11')][_0x42141a][_0x5cd8('0x14')]['messageStatus']='';this['emit'](_0x42141a);}}}};EmailChannel['prototype'][_0x5cd8('0x25')]=function(_0x2e191a,_0x15dcea){if(this['mailAccounts'][_0x2e191a]){this[_0x5cd8('0x11')][_0x2e191a][_0x5cd8('0x14')][_0x5cd8('0x15')]=_0x5cd8('0x26');this[_0x5cd8('0x11')][_0x2e191a][_0x5cd8('0x14')][_0x5cd8('0x27')]=_0x15dcea[_0x5cd8('0x12')];if(_0x15dcea[_0x5cd8('0x28')]){this[_0x5cd8('0x11')][_0x2e191a][_0x5cd8('0x14')][_0x5cd8('0x16')]=_0x15dcea[_0x5cd8('0x28')][_0x5cd8('0x16')];}return this[_0x5cd8('0x10')](_0x2e191a);}};EmailChannel[_0x5cd8('0x19')][_0x5cd8('0x1d')]=function(_0x1b832a,_0x34ee72){logger[_0x5cd8('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x34ee72[_0x5cd8('0x29')],_0x34ee72['lastName'],_0x34ee72[_0x5cd8('0x2a')],_0x1b832a);if(this[_0x5cd8('0x11')][_0x1b832a]){return mailAccount[_0x5cd8('0x2b')](_0x1b832a,_0x34ee72)[_0x5cd8('0x2c')](function(_0x354f3a){if(_0x354f3a){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x5cd8('0x2d')](function(_0x33a394){logger[_0x5cd8('0x21')](_0x5cd8('0x2e'),JSON['stringify'](_0x33a394));});}};EmailChannel['prototype'][_0x5cd8('0x20')]=function(_0x26f943){if(this[_0x5cd8('0x11')][_0x26f943]&&this[_0x5cd8('0x11')][_0x26f943][_0x5cd8('0x14')]){if(this[_0x5cd8('0xe')][this[_0x5cd8('0x11')][_0x26f943][_0x5cd8('0x14')]['id']]){delete this[_0x5cd8('0xe')][this[_0x5cd8('0x11')][_0x26f943][_0x5cd8('0x14')]['id']];}this[_0x5cd8('0x11')][_0x26f943][_0x5cd8('0x14')][_0x5cd8('0x2f')]=moment();this[_0x5cd8('0x10')](_0x26f943);}};EmailChannel[_0x5cd8('0x19')][_0x5cd8('0x22')]=function(_0x259d87,_0x4b23a1){if(this[_0x5cd8('0x11')][_0x259d87]){this[_0x5cd8('0x11')][_0x259d87][_0x5cd8('0x14')][_0x5cd8('0x15')]=_0x5cd8('0x21');this[_0x5cd8('0x11')][_0x259d87][_0x5cd8('0x14')][_0x5cd8('0x27')]=_0x4b23a1;return this['emit'](_0x259d87);}};EmailChannel[_0x5cd8('0x19')][_0x5cd8('0x30')]=function(_0x304429,_0xa4a2f1){return this['smtp'][_0x5cd8('0x31')](_0x304429,_0xa4a2f1);};EmailChannel[_0x5cd8('0x19')]['verifySmtp']=function(_0x24c42c){var _0x330446=this;if(this[_0x5cd8('0x11')][_0x24c42c['id']]){if(_[_0x5cd8('0x23')](this[_0x5cd8('0x11')][_0x24c42c['id']][_0x5cd8('0x32')])){this[_0x5cd8('0x11')][_0x24c42c['id']][_0x5cd8('0x32')]={};}this[_0x5cd8('0x11')][_0x24c42c['id']][_0x5cd8('0x32')][_0x5cd8('0x2f')]=moment();return new BPromise(function(_0x14f7dc,_0xfd2cf8){return _0x330446['smtp']['verify'](_0x24c42c)[_0x5cd8('0x2c')](function(_0x3c19c6){_0x330446[_0x5cd8('0x11')][_0x24c42c['id']][_0x5cd8('0x32')]['status']='verified';_0x330446['mailAccounts'][_0x24c42c['id']][_0x5cd8('0x32')]['messageStatus']='';_0x330446[_0x5cd8('0x10')](_0x24c42c['id']);_0x14f7dc(_0x3c19c6);})[_0x5cd8('0x2d')](function(_0x22eaeb){_0x330446[_0x5cd8('0x11')][_0x24c42c['id']]['Smtp']['status']=_0x5cd8('0x21');_0x330446[_0x5cd8('0x11')][_0x24c42c['id']]['Smtp'][_0x5cd8('0x27')]=_0x22eaeb;_0x330446[_0x5cd8('0x10')](_0x24c42c['id']);_0xfd2cf8(_0x22eaeb);});});}return this[_0x5cd8('0xf')][_0x5cd8('0x33')](_0x24c42c);};module[_0x5cd8('0x34')]=EmailChannel; \ No newline at end of file +var _0x445f=['send','verifySmtp','Smtp','verify','then','verified','catch','exports','lodash','moment','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','total','isNil','stringify','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','messages','firstName','lastName','from','notify','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x445f,0x1a0));var _0xf445=function(_0x1f6380,_0x88469e){_0x1f6380=_0x1f6380-0x0;var _0x47cf0e=_0x445f[_0x1f6380];return _0x47cf0e;};'use strict';var _=require(_0xf445('0x0'));var moment=require(_0xf445('0x1'));var BPromise=require('bluebird');var md5=require(_0xf445('0x2'));var Redis=require(_0xf445('0x3'));var config=require('../../../config/environment');var logger=require(_0xf445('0x4'))(_0xf445('0x5'));config[_0xf445('0x6')]=_[_0xf445('0x7')](config[_0xf445('0x6')],{'host':_0xf445('0x8'),'port':0x18eb});var io=require(_0xf445('0x9'))(new Redis(config[_0xf445('0x6')]));var EmailImap=require(_0xf445('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x14fc5e){logger[_0xf445('0xb')]('start\x20email\x20channel');this[_0xf445('0xc')]=_0x14fc5e[_0xf445('0xc')];this[_0xf445('0xd')]={};this[_0xf445('0xe')]=new EmailSmtp();}EmailChannel[_0xf445('0xf')][_0xf445('0x10')]=function(_0x3b2089){var _0x3075bd=this[_0xf445('0xc')][_0x3b2089];var _0x739f9={'id':_0x3075bd['id'],'name':_0x3075bd[_0xf445('0x11')],'key':_0x3075bd[_0xf445('0x12')],'active':_0x3075bd['active'],'Imap':{'status':_0x3075bd[_0xf445('0x13')][_0xf445('0x14')],'messageStatus':_0x3075bd[_0xf445('0x13')][_0xf445('0x15')],'total':_0x3075bd[_0xf445('0x13')][_0xf445('0x16')]}};if(_[_0xf445('0x17')](md5Accounts[_0x3b2089])){md5Accounts[_0x3b2089]={};}var _0x1f3776=md5(JSON[_0xf445('0x18')](_0x739f9));if(md5Accounts[_0x3b2089][_0xf445('0x2')]!==_0x1f3776){md5Accounts[_0x3b2089]['md5']=_0x1f3776;io[_0xf445('0x10')]('mailAccount:update',_0x739f9);}};EmailChannel[_0xf445('0xf')]['refresh']=function(_0x2b450a){for(var _0x2fc46f in _0x2b450a){if(_0x2b450a[_0xf445('0x19')](_0x2fc46f)){if(_0x2b450a[_0x2fc46f][_0xf445('0x13')]&&_0x2b450a[_0x2fc46f][_0xf445('0x1a')]){var _0x34dc61=_0x2b450a[_0x2fc46f][_0xf445('0x13')];if(!this[_0xf445('0xd')][_0xf445('0x19')](_0x34dc61['id'])){this[_0xf445('0xd')][_0x34dc61['id']]=new EmailImap(_0x34dc61,_0x2b450a[_0x2fc46f][_0xf445('0x5')]);this['imapAccounts'][_0x34dc61['id']]['on'](_0xf445('0x1b'),this[_0xf445('0x1c')][_0xf445('0x1d')](this,_0x2fc46f));this['imapAccounts'][_0x34dc61['id']]['on'](_0xf445('0x5'),this[_0xf445('0x1e')][_0xf445('0x1d')](this,_0x2fc46f));this[_0xf445('0xd')][_0x34dc61['id']]['on'](_0xf445('0x1f'),this[_0xf445('0x20')][_0xf445('0x1d')](this,_0x2fc46f));this[_0xf445('0xd')][_0x34dc61['id']]['on'](_0xf445('0x21'),this[_0xf445('0x22')]['bind'](this,_0x2fc46f));}}else{if(_['isNil'](this[_0xf445('0xc')][_0x2fc46f][_0xf445('0x13')])){this[_0xf445('0xc')][_0x2fc46f][_0xf445('0x13')]={};}this[_0xf445('0xc')][_0x2fc46f][_0xf445('0x13')]['status']='disabled';this['mailAccounts'][_0x2fc46f][_0xf445('0x13')][_0xf445('0x15')]='';this[_0xf445('0x10')](_0x2fc46f);}}}};EmailChannel[_0xf445('0xf')][_0xf445('0x1c')]=function(_0x1c4102,_0x234a14){if(this[_0xf445('0xc')][_0x1c4102]){this[_0xf445('0xc')][_0x1c4102]['Imap'][_0xf445('0x14')]='connected';this[_0xf445('0xc')][_0x1c4102]['Imap']['messageStatus']=_0x234a14['name'];if(_0x234a14[_0xf445('0x23')]){this[_0xf445('0xc')][_0x1c4102][_0xf445('0x13')]['total']=_0x234a14[_0xf445('0x23')][_0xf445('0x16')];}return this['emit'](_0x1c4102);}};EmailChannel[_0xf445('0xf')][_0xf445('0x1e')]=function(_0x32b3e7,_0x2dce35){logger[_0xf445('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x2dce35[_0xf445('0x24')],_0x2dce35[_0xf445('0x25')],_0x2dce35[_0xf445('0x26')],_0x32b3e7);if(this['mailAccounts'][_0x32b3e7]){return mailAccount[_0xf445('0x27')](_0x32b3e7,_0x2dce35)['then'](function(_0x8049af){if(_0x8049af){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x218117){logger[_0xf445('0x21')](_0xf445('0x28'),JSON[_0xf445('0x18')](_0x218117));});}};EmailChannel[_0xf445('0xf')]['handleImapEnd']=function(_0x9fb5b8){if(this[_0xf445('0xc')][_0x9fb5b8]&&this[_0xf445('0xc')][_0x9fb5b8][_0xf445('0x13')]){if(this['imapAccounts'][this[_0xf445('0xc')][_0x9fb5b8][_0xf445('0x13')]['id']]){delete this['imapAccounts'][this[_0xf445('0xc')][_0x9fb5b8][_0xf445('0x13')]['id']];}this[_0xf445('0xc')][_0x9fb5b8][_0xf445('0x13')][_0xf445('0x29')]=moment();this[_0xf445('0x10')](_0x9fb5b8);}};EmailChannel['prototype'][_0xf445('0x22')]=function(_0x2b0c9b,_0x249825){if(this[_0xf445('0xc')][_0x2b0c9b]){this[_0xf445('0xc')][_0x2b0c9b][_0xf445('0x13')][_0xf445('0x14')]=_0xf445('0x21');this['mailAccounts'][_0x2b0c9b][_0xf445('0x13')][_0xf445('0x15')]=_0x249825;return this[_0xf445('0x10')](_0x2b0c9b);}};EmailChannel[_0xf445('0xf')][_0xf445('0x2a')]=function(_0x54729b,_0x53d91b){return this[_0xf445('0xe')][_0xf445('0x2b')](_0x54729b,_0x53d91b);};EmailChannel[_0xf445('0xf')][_0xf445('0x2c')]=function(_0x348ffc){var _0x9efb64=this;if(this[_0xf445('0xc')][_0x348ffc['id']]){if(_[_0xf445('0x17')](this[_0xf445('0xc')][_0x348ffc['id']][_0xf445('0x2d')])){this[_0xf445('0xc')][_0x348ffc['id']][_0xf445('0x2d')]={};}this['mailAccounts'][_0x348ffc['id']]['Smtp'][_0xf445('0x29')]=moment();return new BPromise(function(_0x55c317,_0x4130dd){return _0x9efb64['smtp'][_0xf445('0x2e')](_0x348ffc)[_0xf445('0x2f')](function(_0x32a291){_0x9efb64[_0xf445('0xc')][_0x348ffc['id']][_0xf445('0x2d')][_0xf445('0x14')]=_0xf445('0x30');_0x9efb64[_0xf445('0xc')][_0x348ffc['id']][_0xf445('0x2d')][_0xf445('0x15')]='';_0x9efb64[_0xf445('0x10')](_0x348ffc['id']);_0x55c317(_0x32a291);})[_0xf445('0x31')](function(_0x1de5e4){_0x9efb64[_0xf445('0xc')][_0x348ffc['id']][_0xf445('0x2d')][_0xf445('0x14')]=_0xf445('0x21');_0x9efb64[_0xf445('0xc')][_0x348ffc['id']][_0xf445('0x2d')]['messageStatus']=_0x1de5e4;_0x9efb64[_0xf445('0x10')](_0x348ffc['id']);_0x4130dd(_0x1de5e4);});});}return this[_0xf445('0xe')]['verify'](_0x348ffc);};module[_0xf445('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b8aa8c6..8fb2caf 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 _0x9ca4=['getAccount','imap','once','ready','handleReady','end','handleEnd','bind','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','autotls','password','getHost','email','openBox','mailbox','handleOpenBox','box','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','path','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','INBOX','account'];(function(_0x2ddd21,_0x3dd1e7){var _0x132af3=function(_0x4a9b20){while(--_0x4a9b20){_0x2ddd21['push'](_0x2ddd21['shift']());}};_0x132af3(++_0x3dd1e7);}(_0x9ca4,0xb2));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x49ca('0x0'));var util=require('util');var Imap=require('imap');var _=require('lodash');var rs=require(_0x49ca('0x1'));var simpleParser=require(_0x49ca('0x2'))[_0x49ca('0x3')];var Iconv=require(_0x49ca('0x4'))[_0x49ca('0x5')];var EventEmitter=require(_0x49ca('0x6'))['EventEmitter'];var utils=require(_0x49ca('0x7'));var logger=require(_0x49ca('0x8'))('email');function EmailImap(_0x4a48aa,_0x5359c4){this['mailbox']=_0x49ca('0x9');this[_0x49ca('0xa')]=this[_0x49ca('0xb')](_0x4a48aa,_0x5359c4);this[_0x49ca('0xc')]=new Imap(this[_0x49ca('0xa')]);this[_0x49ca('0xc')][_0x49ca('0xd')](_0x49ca('0xe'),this[_0x49ca('0xf')]['bind'](this));this[_0x49ca('0xc')]['once'](_0x49ca('0x10'),this[_0x49ca('0x11')][_0x49ca('0x12')](this));this[_0x49ca('0xc')]['on']('error',this[_0x49ca('0x13')][_0x49ca('0x12')](this));this[_0x49ca('0xc')][_0x49ca('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x49ca('0x15')]['getAccount']=function(_0xdc86fd,_0x40bdc8){var _0x1ab26f={'connTimeout':_0xdc86fd[_0x49ca('0x16')]?_0xdc86fd['connTimeout']*0x3e8:0x2710,'authTimeout':_0xdc86fd[_0x49ca('0x17')]?_0xdc86fd[_0x49ca('0x17')]*0x3e8:0x1388};if(_[_0x49ca('0x18')](_0xdc86fd[_0x49ca('0x19')])){if(_0xdc86fd[_0x49ca('0x1a')]){_0x1ab26f[_0x49ca('0x1b')]=_0xdc86fd['user'];_0x1ab26f['password']=_0xdc86fd['password'];}_0x1ab26f[_0x49ca('0x1c')]=_0xdc86fd[_0x49ca('0x1c')];_0x1ab26f[_0x49ca('0x1d')]=_0xdc86fd[_0x49ca('0x1d')]||0x3e1;if(_0xdc86fd[_0x49ca('0x1e')]){_0x1ab26f['tls']=!![];}else{_0x1ab26f[_0x49ca('0x1e')]=![];_0x1ab26f[_0x49ca('0x1f')]='required';}}else{_0x1ab26f[_0x49ca('0x1b')]=_0xdc86fd[_0x49ca('0x1b')];_0x1ab26f['password']=_0xdc86fd[_0x49ca('0x20')];_0x1ab26f['host']=utils[_0x49ca('0x21')](_0xdc86fd[_0x49ca('0x19')]);_0x1ab26f['port']=0x3e1;_0x1ab26f['tls']=!![];}_0x1ab26f[_0x49ca('0x22')]=_0x40bdc8||_0xdc86fd['user']||'anonymous@xcally.com';return _0x1ab26f;};EmailImap[_0x49ca('0x15')]['handleReady']=function(){this[_0x49ca('0xc')][_0x49ca('0x23')](this[_0x49ca('0x24')],![],this[_0x49ca('0x25')][_0x49ca('0x12')](this));};EmailImap[_0x49ca('0x15')][_0x49ca('0x25')]=function(_0x222e9f,_0x1cc2da){if(_0x222e9f){this['handleError'](_0x222e9f,!![]);}else{this['emit'](_0x49ca('0x26'),_0x1cc2da);this['readUnseen']();}};EmailImap['prototype'][_0x49ca('0x27')]=function(_0x709371){if(_0x709371){this[_0x49ca('0x13')](_0x709371,!![]);}else{this[_0x49ca('0xc')][_0x49ca('0x10')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x49ca('0xc')][_0x49ca('0x28')]([_0x49ca('0x29')],this[_0x49ca('0x2a')][_0x49ca('0x12')](this));};EmailImap[_0x49ca('0x15')]['handleReadUnseen']=function(_0x4527a5,_0x5a0b9d){if(_0x4527a5){this['handleError'](_0x4527a5,!![]);}else{if(_0x5a0b9d[_0x49ca('0x2b')]){try{var _0x379e32=this[_0x49ca('0xc')]['fetch'](_0x5a0b9d,{'bodies':'','markSeen':!![]});_0x379e32['on'](_0x49ca('0x2c'),this[_0x49ca('0x2d')]['bind'](this));_0x379e32[_0x49ca('0xd')](_0x49ca('0x2e'),this[_0x49ca('0x2f')][_0x49ca('0x12')](this));_0x379e32['once']('end',this[_0x49ca('0x30')]['bind'](this));}catch(_0x54dcee){logger['error'](_0x54dcee);}}else{this[_0x49ca('0xc')][_0x49ca('0x31')](!![],this[_0x49ca('0x27')][_0x49ca('0x12')](this));}}};EmailImap['prototype'][_0x49ca('0x2d')]=function(_0x21e9a8,_0x1540a3){_0x21e9a8['on'](_0x49ca('0x32'),this['handleMessageBody'][_0x49ca('0x12')](this));_0x21e9a8['once'](_0x49ca('0x33'),this[_0x49ca('0x34')][_0x49ca('0x12')](this));_0x21e9a8[_0x49ca('0xd')](_0x49ca('0x10'),this[_0x49ca('0x35')][_0x49ca('0x12')](this));};EmailImap[_0x49ca('0x15')][_0x49ca('0x36')]=function(_0xe97a79,_0x4045e1){simpleParser(_0xe97a79,{'Iconv':Iconv},this[_0x49ca('0x37')][_0x49ca('0x12')](this));};EmailImap[_0x49ca('0x15')]['handleMessageAttributes']=function(_0x2ad411){};EmailImap['prototype'][_0x49ca('0x35')]=function(){};EmailImap[_0x49ca('0x15')][_0x49ca('0x37')]=function(_0x14f69f,_0x29ecce){if(_0x14f69f){logger['error'](_0x14f69f);}else{var _0x43c067=this;utils[_0x49ca('0x38')](this[_0x49ca('0xa')],_0x29ecce,function(_0xd85c90){_0x43c067[_0x49ca('0x39')](_0x49ca('0x22'),_0xd85c90);});}};EmailImap[_0x49ca('0x15')][_0x49ca('0x30')]=function(){this[_0x49ca('0xc')]['closeBox'](!![],this[_0x49ca('0x27')][_0x49ca('0x12')](this));};EmailImap[_0x49ca('0x15')][_0x49ca('0x2f')]=function(_0x5060bd){this[_0x49ca('0x13')](_0x5060bd);this[_0x49ca('0xc')][_0x49ca('0x31')](!![],this[_0x49ca('0x27')][_0x49ca('0x12')](this));};EmailImap[_0x49ca('0x15')][_0x49ca('0x11')]=function(){this['emit']('end');};EmailImap['prototype'][_0x49ca('0x13')]=function(_0x3ef27a,_0x7f1532){logger[_0x49ca('0x2e')](_0x49ca('0x13'),this['account'][_0x49ca('0x22')],JSON[_0x49ca('0x3a')](_0x3ef27a));var _0x566967='';if(_0x3ef27a){if(_0x3ef27a[_0x49ca('0x3b')]){_0x566967=_0x3ef27a[_0x49ca('0x3b')];}else{for(var _0x10ec72 in _0x3ef27a){if(_0x3ef27a[_0x49ca('0x3c')](_0x10ec72)){_0x566967+=_[_0x49ca('0x3d')](_0x10ec72)+':\x20'+_0x3ef27a[_0x10ec72]+'\x0a';}}}}if(_0x7f1532){this['imap'][_0x49ca('0x10')]();}else{this['emit'](_0x49ca('0x2e'),_0x566967);this[_0x49ca('0x39')](_0x49ca('0x10'));}};module[_0x49ca('0x3e')]=EmailImap; \ No newline at end of file +var _0xa0af=['handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','lodash','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','error','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','closeBox','end','handleMessageEnd'];(function(_0x15c83c,_0x5a13fc){var _0x8f86c1=function(_0x1ba3f1){while(--_0x1ba3f1){_0x15c83c['push'](_0x15c83c['shift']());}};_0x8f86c1(++_0x5a13fc);}(_0xa0af,0x86));var _0xfa0a=function(_0x19560b,_0x5caefd){_0x19560b=_0x19560b-0x0;var _0x36c77e=_0xa0af[_0x19560b];return _0x36c77e;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xfa0a('0x0'));var Imap=require(_0xfa0a('0x1'));var _=require(_0xfa0a('0x2'));var rs=require('randomstring');var simpleParser=require(_0xfa0a('0x3'))[_0xfa0a('0x4')];var Iconv=require('iconv')[_0xfa0a('0x5')];var EventEmitter=require(_0xfa0a('0x6'))[_0xfa0a('0x7')];var utils=require(_0xfa0a('0x8'));var logger=require(_0xfa0a('0x9'))(_0xfa0a('0xa'));function EmailImap(_0x585e7a,_0x382c84){this[_0xfa0a('0xb')]='INBOX';this[_0xfa0a('0xc')]=this[_0xfa0a('0xd')](_0x585e7a,_0x382c84);this[_0xfa0a('0x1')]=new Imap(this['account']);this[_0xfa0a('0x1')][_0xfa0a('0xe')](_0xfa0a('0xf'),this[_0xfa0a('0x10')][_0xfa0a('0x11')](this));this['imap']['once']('end',this[_0xfa0a('0x12')]['bind'](this));this[_0xfa0a('0x1')]['on'](_0xfa0a('0x13'),this['handleError'][_0xfa0a('0x11')](this));this[_0xfa0a('0x1')]['connect']();}util[_0xfa0a('0x14')](EmailImap,EventEmitter);EmailImap[_0xfa0a('0x15')]['getAccount']=function(_0x1b3f40,_0x19c5df){var _0x55364d={'connTimeout':_0x1b3f40[_0xfa0a('0x16')]?_0x1b3f40[_0xfa0a('0x16')]*0x3e8:0x2710,'authTimeout':_0x1b3f40[_0xfa0a('0x17')]?_0x1b3f40[_0xfa0a('0x17')]*0x3e8:0x1388};if(_[_0xfa0a('0x18')](_0x1b3f40[_0xfa0a('0x19')])){if(_0x1b3f40[_0xfa0a('0x1a')]){_0x55364d[_0xfa0a('0x1b')]=_0x1b3f40[_0xfa0a('0x1b')];_0x55364d['password']=_0x1b3f40[_0xfa0a('0x1c')];}_0x55364d[_0xfa0a('0x1d')]=_0x1b3f40[_0xfa0a('0x1d')];_0x55364d[_0xfa0a('0x1e')]=_0x1b3f40['port']||0x3e1;if(_0x1b3f40['tls']){_0x55364d[_0xfa0a('0x1f')]=!![];}else{_0x55364d[_0xfa0a('0x1f')]=![];_0x55364d[_0xfa0a('0x20')]=_0xfa0a('0x21');}}else{_0x55364d['user']=_0x1b3f40[_0xfa0a('0x1b')];_0x55364d['password']=_0x1b3f40[_0xfa0a('0x1c')];_0x55364d[_0xfa0a('0x1d')]=utils[_0xfa0a('0x22')](_0x1b3f40['service']);_0x55364d['port']=0x3e1;_0x55364d[_0xfa0a('0x1f')]=!![];}_0x55364d[_0xfa0a('0xa')]=_0x19c5df||_0x1b3f40[_0xfa0a('0x1b')]||_0xfa0a('0x23');return _0x55364d;};EmailImap[_0xfa0a('0x15')][_0xfa0a('0x10')]=function(){this['imap'][_0xfa0a('0x24')](this['mailbox'],![],this[_0xfa0a('0x25')][_0xfa0a('0x11')](this));};EmailImap[_0xfa0a('0x15')]['handleOpenBox']=function(_0x2cf42a,_0x40b163){if(_0x2cf42a){this[_0xfa0a('0x26')](_0x2cf42a,!![]);}else{this[_0xfa0a('0x27')](_0xfa0a('0x28'),_0x40b163);this[_0xfa0a('0x29')]();}};EmailImap[_0xfa0a('0x15')][_0xfa0a('0x2a')]=function(_0x5c67a9){if(_0x5c67a9){this[_0xfa0a('0x26')](_0x5c67a9,!![]);}else{this['imap']['end']();}};EmailImap[_0xfa0a('0x15')]['readUnseen']=function(){this[_0xfa0a('0x1')][_0xfa0a('0x2b')](['UNSEEN'],this[_0xfa0a('0x2c')][_0xfa0a('0x11')](this));};EmailImap[_0xfa0a('0x15')]['handleReadUnseen']=function(_0x1611c9,_0x48ac9e){if(_0x1611c9){this[_0xfa0a('0x26')](_0x1611c9,!![]);}else{if(_0x48ac9e[_0xfa0a('0x2d')]){try{var _0xebfd2f=this[_0xfa0a('0x1')][_0xfa0a('0x2e')](_0x48ac9e,{'bodies':'','markSeen':!![]});_0xebfd2f['on']('message',this[_0xfa0a('0x2f')][_0xfa0a('0x11')](this));_0xebfd2f[_0xfa0a('0xe')](_0xfa0a('0x13'),this['handleFetchError'][_0xfa0a('0x11')](this));_0xebfd2f[_0xfa0a('0xe')]('end',this[_0xfa0a('0x30')]['bind'](this));}catch(_0x23d19b){logger[_0xfa0a('0x13')](_0x23d19b);}}else{this['imap'][_0xfa0a('0x31')](!![],this[_0xfa0a('0x2a')][_0xfa0a('0x11')](this));}}};EmailImap[_0xfa0a('0x15')][_0xfa0a('0x2f')]=function(_0x68d143,_0x4e5bd7){_0x68d143['on']('body',this['handleMessageBody'][_0xfa0a('0x11')](this));_0x68d143['once']('attributes',this['handleMessageAttributes'][_0xfa0a('0x11')](this));_0x68d143['once'](_0xfa0a('0x32'),this[_0xfa0a('0x33')][_0xfa0a('0x11')](this));};EmailImap['prototype'][_0xfa0a('0x34')]=function(_0x12aef0,_0x327085){simpleParser(_0x12aef0,{'Iconv':Iconv},this['handleSimpleParser'][_0xfa0a('0x11')](this));};EmailImap[_0xfa0a('0x15')][_0xfa0a('0x35')]=function(_0x401b42){};EmailImap[_0xfa0a('0x15')][_0xfa0a('0x33')]=function(){};EmailImap[_0xfa0a('0x15')][_0xfa0a('0x36')]=function(_0x248603,_0xb5debf){if(_0x248603){logger[_0xfa0a('0x13')](_0x248603);}else{var _0x3dd841=this;utils[_0xfa0a('0x37')](this[_0xfa0a('0xc')],_0xb5debf,function(_0x50cd29){_0x3dd841[_0xfa0a('0x27')]('email',_0x50cd29);});}};EmailImap['prototype'][_0xfa0a('0x30')]=function(){this[_0xfa0a('0x1')][_0xfa0a('0x31')](!![],this[_0xfa0a('0x2a')]['bind'](this));};EmailImap['prototype'][_0xfa0a('0x38')]=function(_0x5d032a){this[_0xfa0a('0x26')](_0x5d032a);this[_0xfa0a('0x1')][_0xfa0a('0x31')](!![],this[_0xfa0a('0x2a')][_0xfa0a('0x11')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0xfa0a('0x27')](_0xfa0a('0x32'));};EmailImap[_0xfa0a('0x15')]['handleError']=function(_0x2ee5b5,_0x3f073e){logger[_0xfa0a('0x13')]('handleError',this['account'][_0xfa0a('0xa')],JSON[_0xfa0a('0x39')](_0x2ee5b5));var _0x436c4b='';if(_0x2ee5b5){if(_0x2ee5b5['textCode']){_0x436c4b=_0x2ee5b5[_0xfa0a('0x3a')];}else{for(var _0x2dce27 in _0x2ee5b5){if(_0x2ee5b5[_0xfa0a('0x3b')](_0x2dce27)){_0x436c4b+=_[_0xfa0a('0x3c')](_0x2dce27)+':\x20'+_0x2ee5b5[_0x2dce27]+'\x0a';}}}}if(_0x3f073e){this['imap'][_0xfa0a('0x32')]();}else{this[_0xfa0a('0x27')](_0xfa0a('0x13'),_0x436c4b);this[_0xfa0a('0x27')](_0xfa0a('0x32'));}};module[_0xfa0a('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 26d2836..ce0928b 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 _0x1e42=['toString','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','sendMail'];(function(_0x47debc,_0x3dffad){var _0x2cff3d=function(_0x1196a8){while(--_0x1196a8){_0x47debc['push'](_0x47debc['shift']());}};_0x2cff3d(++_0x3dffad);}(_0x1e42,0x194));var _0x21e4=function(_0x568460,_0x444908){_0x568460=_0x568460-0x0;var _0x361cd9=_0x1e42[_0x568460];return _0x361cd9;};'use strict';var nodemailer=require(_0x21e4('0x0'));var BPromise=require(_0x21e4('0x1'));var inlineBase64=require(_0x21e4('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x21e4('0x3')]=function(_0x236dab,_0x5cdc2e){return new BPromise(function(_0x1606f3,_0x4817b3){var _0x4c6636=nodemailer[_0x21e4('0x4')](_0x236dab);_0x4c6636['use']('compile',inlineBase64());_0x4c6636[_0x21e4('0x5')](_0x5cdc2e,function(_0x1ff959,_0x1f3956){if(_0x1ff959){_0x4817b3(_0x1ff959[_0x21e4('0x6')]());}else{_0x1606f3(_0x1f3956);}});});};EmailSmtp['prototype'][_0x21e4('0x7')]=function(_0x8b798f){return new BPromise(function(_0x568130,_0x4ce4c7){var _0x5488c2=nodemailer[_0x21e4('0x4')](_0x8b798f);_0x5488c2[_0x21e4('0x7')](function(_0x27feb2,_0x16550d){if(_0x27feb2){_0x4ce4c7(_0x27feb2['toString']());}else{if(_0x16550d){_0x568130(_0x16550d);}else{_0x4ce4c7(_0x21e4('0x8'));}}});});};module[_0x21e4('0x9')]=EmailSmtp; \ No newline at end of file +var _0x8174=['compile','sendMail','toString','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8174,0xe0));var _0x4817=function(_0x10df87,_0x4e3dcb){_0x10df87=_0x10df87-0x0;var _0x22923d=_0x8174[_0x10df87];return _0x22923d;};'use strict';var nodemailer=require(_0x4817('0x0'));var BPromise=require(_0x4817('0x1'));var inlineBase64=require(_0x4817('0x2'));function EmailSmtp(){}EmailSmtp[_0x4817('0x3')][_0x4817('0x4')]=function(_0x13ef70,_0x507c60){return new BPromise(function(_0x52c22d,_0x59cfb3){var _0x334949=nodemailer[_0x4817('0x5')](_0x13ef70);_0x334949[_0x4817('0x6')](_0x4817('0x7'),inlineBase64());_0x334949[_0x4817('0x8')](_0x507c60,function(_0x1d5340,_0x5be11f){if(_0x1d5340){_0x59cfb3(_0x1d5340[_0x4817('0x9')]());}else{_0x52c22d(_0x5be11f);}});});};EmailSmtp['prototype']['verify']=function(_0x45e7f4){return new BPromise(function(_0x191727,_0x25dedd){var _0x5554d6=nodemailer[_0x4817('0x5')](_0x45e7f4);_0x5554d6['verify'](function(_0x9bb1a0,_0x2f3b13){if(_0x9bb1a0){_0x25dedd(_0x9bb1a0[_0x4817('0x9')]());}else{if(_0x2f3b13){_0x191727(_0x2f3b13);}else{_0x25dedd('Not\x20verifired');}}});});};module[_0x4817('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9c569fa..a9f9c08 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 _0x6b38=['randomstring','path','util','node-tnef','../../../config/logger','email','value','address','anonymous','generate','@xcally.com','split','length','slice','join','name','Anonymous','head','pop','isEmpty','html','test','body','textAsHtml','replace','message','originTo','includes','originCc','bcc','attachments','attach','type','filename','attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','push','contentType','parser','from','subject','messageId','inReplyTo','date','format','filter','application/ms-tnef','info','parseBuffer','first','content','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash'];(function(_0x292dcd,_0x531091){var _0x54b110=function(_0x1b8e2c){while(--_0x1b8e2c){_0x292dcd['push'](_0x292dcd['shift']());}};_0x54b110(++_0x531091);}(_0x6b38,0x197));var _0x86b3=function(_0x4f545a,_0x35742b){_0x4f545a=_0x4f545a-0x0;var _0x4a227f=_0x6b38[_0x4f545a];return _0x4a227f;};'use strict';var _=require(_0x86b3('0x0'));var moment=require('moment');var random=require(_0x86b3('0x1'));var fs=require('fs');var path=require(_0x86b3('0x2'));var util=require(_0x86b3('0x3'));var tnef=require(_0x86b3('0x4'));var logger=require(_0x86b3('0x5'))(_0x86b3('0x6'));var config=require('../../../config/environment');function getAddress(_0x41558a){var _0x342d8f=_['head'](_0x41558a[_0x86b3('0x7')]);return _0x342d8f&&_0x342d8f['address']?_0x342d8f[_0x86b3('0x8')]:_0x86b3('0x9')+random[_0x86b3('0xa')](0x6)+_0x86b3('0xb');}function getFirstName(_0x5ae31d){var _0x2acb16=_['head'](_0x5ae31d['value']);if(_0x2acb16&&_0x2acb16['name']){var _0x2b37d9=_0x2acb16['name'][_0x86b3('0xc')](/\s+/);return _0x2b37d9[_0x86b3('0xd')]?_0x2b37d9[_0x86b3('0xe')](0x0,-0x1)[_0x86b3('0xf')]('\x20'):_0x2acb16[_0x86b3('0x10')];}return _0x86b3('0x11');}function getLastName(_0x1291a6){var _0x5d8cd3=_[_0x86b3('0x12')](_0x1291a6[_0x86b3('0x7')]);if(_0x5d8cd3&&_0x5d8cd3[_0x86b3('0x10')]){var _0x23b666=_0x5d8cd3[_0x86b3('0x10')][_0x86b3('0xc')](/\s+/);return _0x23b666[_0x86b3('0xd')]>0x1?_0x23b666[_0x86b3('0x13')]():'';}return'';}function getMails(_0x3d7ee8,_0x125cb4){var _0x2ee669='';for(var _0x304e1f=0x0;_0x304e1f<_0x125cb4[_0x86b3('0x7')][_0x86b3('0xd')];_0x304e1f+=0x1){if(_0x125cb4[_0x86b3('0x7')][_0x304e1f][_0x86b3('0x8')]!==_0x3d7ee8){if(!_[_0x86b3('0x14')](_0x2ee669)){_0x2ee669+=',';}_0x2ee669+=_0x125cb4[_0x86b3('0x7')][_0x304e1f][_0x86b3('0x10')]||_0x125cb4['value'][_0x304e1f][_0x86b3('0x8')]||'';_0x2ee669+='\x20<';_0x2ee669+=_0x125cb4['value'][_0x304e1f]['address']?_0x125cb4[_0x86b3('0x7')][_0x304e1f][_0x86b3('0x8')]:_0x86b3('0x9')+random[_0x86b3('0xa')](0x6)+_0x86b3('0xb');_0x2ee669+='>';}}return _0x2ee669;}function parseEmail(_0x4a24ea,_0x3c874b,_0x43e795){if(_0x3c874b[_0x86b3('0x15')]){var _0x338527=/)<[^<]*)*<\/script>/gi;while(_0x338527[_0x86b3('0x16')](_0x3c874b[_0x86b3('0x15')])){_0x3c874b['html']=_0x3c874b[_0x86b3('0x15')]['replace'](_0x338527,'');}_0x43e795[_0x86b3('0x17')]=_0x3c874b[_0x86b3('0x15')];}else{_0x43e795[_0x86b3('0x17')]=_0x3c874b[_0x86b3('0x18')];}if(_0x43e795[_0x86b3('0x17')]){_0x43e795[_0x86b3('0x17')]=_0x43e795[_0x86b3('0x17')][_0x86b3('0x19')](/Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','value','name','split','length','join','Anonymous','pop','@xcally.com','html','test','replace','body','message','originTo','isEmpty','originCc','includes','bcc','attachments','attach','type','attachment-','server/files/attachments/','content','push','contentType','parser','from','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef'];(function(_0x927391,_0x357652){var _0x56586a=function(_0x595049){while(--_0x595049){_0x927391['push'](_0x927391['shift']());}};_0x56586a(++_0x357652);}(_0xfc68,0xc9));var _0x8fc6=function(_0x54efa8,_0x3bedbe){_0x54efa8=_0x54efa8-0x0;var _0x5eafc1=_0xfc68[_0x54efa8];return _0x5eafc1;};'use strict';var _=require(_0x8fc6('0x0'));var moment=require(_0x8fc6('0x1'));var random=require(_0x8fc6('0x2'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x8fc6('0x3'));var logger=require(_0x8fc6('0x4'))(_0x8fc6('0x5'));var config=require(_0x8fc6('0x6'));function getAddress(_0x175d44){var _0x30bfcf=_[_0x8fc6('0x7')](_0x175d44['value']);return _0x30bfcf&&_0x30bfcf[_0x8fc6('0x8')]?_0x30bfcf['address']:_0x8fc6('0x9')+random[_0x8fc6('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x596149){var _0xe435fc=_['head'](_0x596149[_0x8fc6('0xb')]);if(_0xe435fc&&_0xe435fc[_0x8fc6('0xc')]){var _0x46ac24=_0xe435fc['name'][_0x8fc6('0xd')](/\s+/);return _0x46ac24[_0x8fc6('0xe')]?_0x46ac24['slice'](0x0,-0x1)[_0x8fc6('0xf')]('\x20'):_0xe435fc['name'];}return _0x8fc6('0x10');}function getLastName(_0x10ce11){var _0x23fd54=_['head'](_0x10ce11[_0x8fc6('0xb')]);if(_0x23fd54&&_0x23fd54['name']){var _0x2ed5e7=_0x23fd54[_0x8fc6('0xc')]['split'](/\s+/);return _0x2ed5e7[_0x8fc6('0xe')]>0x1?_0x2ed5e7[_0x8fc6('0x11')]():'';}return'';}function getMails(_0x38ee04,_0x1ec7ae){var _0xc4062b='';for(var _0x43ac94=0x0;_0x43ac94<_0x1ec7ae['value'][_0x8fc6('0xe')];_0x43ac94+=0x1){if(_0x1ec7ae[_0x8fc6('0xb')][_0x43ac94][_0x8fc6('0x8')]!==_0x38ee04){if(!_['isEmpty'](_0xc4062b)){_0xc4062b+=',';}_0xc4062b+=_0x1ec7ae[_0x8fc6('0xb')][_0x43ac94][_0x8fc6('0xc')]||_0x1ec7ae[_0x8fc6('0xb')][_0x43ac94]['address']||'';_0xc4062b+='\x20<';_0xc4062b+=_0x1ec7ae[_0x8fc6('0xb')][_0x43ac94]['address']?_0x1ec7ae[_0x8fc6('0xb')][_0x43ac94][_0x8fc6('0x8')]:_0x8fc6('0x9')+random['generate'](0x6)+_0x8fc6('0x12');_0xc4062b+='>';}}return _0xc4062b;}function parseEmail(_0x3a82cc,_0x1d32fd,_0x3f4845){if(_0x1d32fd[_0x8fc6('0x13')]){var _0x1503e8=/)<[^<]*)*<\/script>/gi;while(_0x1503e8[_0x8fc6('0x14')](_0x1d32fd[_0x8fc6('0x13')])){_0x1d32fd[_0x8fc6('0x13')]=_0x1d32fd['html'][_0x8fc6('0x15')](_0x1503e8,'');}_0x3f4845['body']=_0x1d32fd['html'];}else{_0x3f4845[_0x8fc6('0x16')]=_0x1d32fd['textAsHtml'];}if(_0x3f4845[_0x8fc6('0x16')]){_0x3f4845[_0x8fc6('0x16')]=_0x3f4845[_0x8fc6('0x16')][_0x8fc6('0x15')](/0x0){if(this[_0x41a823+_0x42e5('0x25')]>0x0&&this[_0x41a823+_0x42e5('0x24')]>=this[_0x41a823+_0x42e5('0x25')]){return _0x42e5('0x26');}else{return _0x42e5('0x27');}}else{return'idle';}};Agent['prototype'][_0x42e5('0x22')]=function(){var _0x52d319=[_0x42e5('0x28'),_0x42e5('0x29'),_0x42e5('0x2a'),_0x42e5('0x2b'),_0x42e5('0x2c')];for(var _0x5d6b24=0x0;_0x5d6b24<_0x52d319[_0x42e5('0x2d')];_0x5d6b24+=0x1){var _0xf29221=this[_0x42e5('0x2e')](_0x52d319[_0x5d6b24]);if(this[_0x52d319[_0x5d6b24]+_0x42e5('0x2f')]!==_0xf29221){this[_0x52d319[_0x5d6b24]+_0x42e5('0x30')]=_['toNumber'](moment()['format']('x'));}this[_0x52d319[_0x5d6b24]+_0x42e5('0x2f')]=_0xf29221;}var _0x534a26={'id':this['id'],'name':this['name'],'online':this[_0x42e5('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x42e5('0xa')],'mailPause':this[_0x42e5('0xb')],'smsPause':this[_0x42e5('0xd')],'faxPause':this[_0x42e5('0xc')],'openchannelPause':this[_0x42e5('0xe')],'chatStatus':this[_0x42e5('0x31')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x42e5('0x11')],'chatCurrentCapacity':this[_0x42e5('0x12')],'mailStatus':this[_0x42e5('0x13')],'mailStatusTime':this[_0x42e5('0x14')],'mailCapacity':this[_0x42e5('0x15')],'mailCurrentCapacity':this[_0x42e5('0x16')],'faxStatus':this[_0x42e5('0x17')],'faxStatusTime':this[_0x42e5('0x32')],'faxCapacity':this[_0x42e5('0x18')],'faxCurrentCapacity':this[_0x42e5('0x19')],'smsStatus':this[_0x42e5('0x1a')],'smsStatusTime':this[_0x42e5('0x1b')],'smsCapacity':this[_0x42e5('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'openchannelStatus':this[_0x42e5('0x1e')],'openchannelStatusTime':this[_0x42e5('0x1f')],'openchannelCapacity':this[_0x42e5('0x20')],'openchannelCurrentCapacity':this[_0x42e5('0x33')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x21d933=md5(JSON['stringify'](_0x534a26));if(this[_0x42e5('0x34')]!==_0x21d933){this['md5']=_0x21d933;io[_0x42e5('0x35')](_0x42e5('0x36'),_0x534a26);}};module[_0x42e5('0x37')]=Agent; \ No newline at end of file +var _0xd2ea=['ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','updateRealtime','mail','chat','openchannel','fax','sms','length','getChannelStatus','Status','StatusTime','toNumber','format','mailStatus','mailCurrentCapacity','faxStatus','stringify','emit','user:save','lodash','moment','md5'];(function(_0x1d5452,_0x25e20e){var _0x35240a=function(_0x4b21df){while(--_0x4b21df){_0x1d5452['push'](_0x1d5452['shift']());}};_0x35240a(++_0x25e20e);}(_0xd2ea,0x15f));var _0xad2e=function(_0x4b8591,_0x1f1e23){_0x4b8591=_0x4b8591-0x0;var _0x427f0f=_0xd2ea[_0x4b8591];return _0x427f0f;};'use strict';var _=require(_0xad2e('0x0'));var moment=require(_0xad2e('0x1'));var md5=require(_0xad2e('0x2'));var Redis=require(_0xad2e('0x3'));var config=require(_0xad2e('0x4'));config['redis']=_[_0xad2e('0x5')](config[_0xad2e('0x6')],{'host':_0xad2e('0x7'),'port':0x18eb});var io=require(_0xad2e('0x8'))(new Redis(config[_0xad2e('0x6')]));function Agent(_0x2fd28e){this['id']=_0x2fd28e['id']||0x0;this[_0xad2e('0x9')]=_0x2fd28e['name']||'';this[_0xad2e('0xa')]=_0x2fd28e[_0xad2e('0xa')]||!![];this[_0xad2e('0xb')]=_0x2fd28e['voicePause']||![];this[_0xad2e('0xc')]=_0x2fd28e[_0xad2e('0xc')]||![];this['mailPause']=_0x2fd28e[_0xad2e('0xd')]||![];this['faxPause']=_0x2fd28e[_0xad2e('0xe')]||![];this[_0xad2e('0xf')]=_0x2fd28e[_0xad2e('0xf')]||![];this[_0xad2e('0x10')]=_0x2fd28e['openchannelPause']||![];this[_0xad2e('0x11')]='unknown';this[_0xad2e('0x12')]=0x0;this[_0xad2e('0x13')]=_0x2fd28e[_0xad2e('0x13')]||0x0;this[_0xad2e('0x14')]=0x0;this['mailStatus']=_0xad2e('0x15');this['mailStatusTime']=0x0;this[_0xad2e('0x16')]=_0x2fd28e['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0xad2e('0x17')]=0x0;this[_0xad2e('0x18')]=_0x2fd28e[_0xad2e('0x18')]||0x0;this[_0xad2e('0x19')]=0x0;this[_0xad2e('0x1a')]=_0xad2e('0x15');this[_0xad2e('0x1b')]=0x0;this[_0xad2e('0x1c')]=_0x2fd28e[_0xad2e('0x1c')]||0x0;this[_0xad2e('0x1d')]=0x0;this[_0xad2e('0x1e')]=_0xad2e('0x15');this[_0xad2e('0x1f')]=0x0;this[_0xad2e('0x20')]=_0x2fd28e[_0xad2e('0x20')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xad2e('0x21')]=![];this[_0xad2e('0x22')]=undefined;this['md5']='';this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x18c38d){if(this[_0x18c38d+_0xad2e('0x23')]>0x0){if(this[_0x18c38d+_0xad2e('0x24')]>0x0&&this[_0x18c38d+_0xad2e('0x23')]>=this[_0x18c38d+_0xad2e('0x24')]){return _0xad2e('0x25');}else{return _0xad2e('0x26');}}else{return _0xad2e('0x27');}};Agent[_0xad2e('0x28')][_0xad2e('0x29')]=function(){var _0x40e1e4=[_0xad2e('0x2a'),_0xad2e('0x2b'),_0xad2e('0x2c'),_0xad2e('0x2d'),_0xad2e('0x2e')];for(var _0x59630b=0x0;_0x59630b<_0x40e1e4[_0xad2e('0x2f')];_0x59630b+=0x1){var _0x2e8887=this[_0xad2e('0x30')](_0x40e1e4[_0x59630b]);if(this[_0x40e1e4[_0x59630b]+_0xad2e('0x31')]!==_0x2e8887){this[_0x40e1e4[_0x59630b]+_0xad2e('0x32')]=_[_0xad2e('0x33')](moment()[_0xad2e('0x34')]('x'));}this[_0x40e1e4[_0x59630b]+_0xad2e('0x31')]=_0x2e8887;}var _0xfd90a4={'id':this['id'],'name':this['name'],'online':this[_0xad2e('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0xad2e('0xc')],'mailPause':this[_0xad2e('0xd')],'smsPause':this[_0xad2e('0xf')],'faxPause':this[_0xad2e('0xe')],'openchannelPause':this[_0xad2e('0x10')],'chatStatus':this[_0xad2e('0x11')],'chatStatusTime':this[_0xad2e('0x12')],'chatCapacity':this[_0xad2e('0x13')],'chatCurrentCapacity':this[_0xad2e('0x14')],'mailStatus':this[_0xad2e('0x35')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xad2e('0x16')],'mailCurrentCapacity':this[_0xad2e('0x36')],'faxStatus':this[_0xad2e('0x37')],'faxStatusTime':this[_0xad2e('0x17')],'faxCapacity':this[_0xad2e('0x18')],'faxCurrentCapacity':this[_0xad2e('0x19')],'smsStatus':this[_0xad2e('0x1a')],'smsStatusTime':this[_0xad2e('0x1b')],'smsCapacity':this[_0xad2e('0x1c')],'smsCurrentCapacity':this[_0xad2e('0x1d')],'openchannelStatus':this[_0xad2e('0x1e')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xad2e('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xad2e('0x21')],'busyQueue':this[_0xad2e('0x22')]};var _0x5ac436=md5(JSON[_0xad2e('0x38')](_0xfd90a4));if(this[_0xad2e('0x2')]!==_0x5ac436){this['md5']=_0x5ac436;io[_0xad2e('0x39')](_0xad2e('0x3a'),_0xfd90a4);}};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 48c6caa..b584bc3 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 _0x8c84=['format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify'];(function(_0x4ad802,_0x18cf24){var _0xec37a5=function(_0x3cc08e){while(--_0x3cc08e){_0x4ad802['push'](_0x4ad802['shift']());}};_0xec37a5(++_0x18cf24);}(_0x8c84,0x85));var _0x48c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8c84[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x48c8('0x0'));var md5=require(_0x48c8('0x1'));var util=require(_0x48c8('0x2'));var Redis=require(_0x48c8('0x3'));var config=require(_0x48c8('0x4'));config[_0x48c8('0x5')]=_[_0x48c8('0x6')](config[_0x48c8('0x5')],{'host':_0x48c8('0x7'),'port':0x18eb});var io=require(_0x48c8('0x8'))(new Redis(config[_0x48c8('0x5')]));function ChatQueue(_0x15ddd1){this['id']=_0x15ddd1['id']||0x0;this[_0x48c8('0x9')]=_0x15ddd1[_0x48c8('0x9')]||'';this[_0x48c8('0xa')]=_0x15ddd1[_0x48c8('0xa')]||0xa;this[_0x48c8('0xb')]=_0x15ddd1[_0x48c8('0xb')]||_0x48c8('0xc');this[_0x48c8('0xd')]=_0x15ddd1[_0x48c8('0xd')];this[_0x48c8('0xe')]={};this[_0x48c8('0xf')]=0x0;this[_0x48c8('0x1')]='';this[_0x48c8('0x10')]();this[_0x48c8('0x11')]();}ChatQueue['prototype'][_0x48c8('0x10')]=function(){var _0x1b2cfe=this[_0x48c8('0xe')][_0x48c8('0x12')];this[_0x48c8('0xe')]=_[_0x48c8('0x13')](this[_0x48c8('0xd')],'id');this[_0x48c8('0xe')][_0x48c8('0x12')]=_0x1b2cfe;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x48c8('0x14')]=0x0;this[_0x48c8('0x15')]=0x0;for(var _0x931a58=0x0;_0x931a58=0x0?this[_0x48c8('0x19')]:0x0;var _0x34cc0c={'id':this['id'],'available':this[_0x48c8('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x48c8('0x9')],'paused':this[_0x48c8('0x15')],'waiting':this['waiting']};var _0x4dfe5e=md5(JSON[_0x48c8('0x1a')](_0x34cc0c));if(this[_0x48c8('0x1')]!==_0x4dfe5e){this[_0x48c8('0x1')]=_0x4dfe5e;io['to'](util[_0x48c8('0x1b')](_0x48c8('0x1c'),_0x34cc0c['name']))[_0x48c8('0x1d')](_0x48c8('0x1e'),_0x34cc0c);}};module[_0x48c8('0x1f')]=ChatQueue; \ No newline at end of file +var _0x95b3=['loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x95b3,0x106));var _0x395b=function(_0x6c445,_0x39b937){_0x6c445=_0x6c445-0x0;var _0x89e9cc=_0x95b3[_0x6c445];return _0x89e9cc;};'use strict';var _=require(_0x395b('0x0'));var md5=require(_0x395b('0x1'));var util=require(_0x395b('0x2'));var Redis=require(_0x395b('0x3'));var config=require(_0x395b('0x4'));config['redis']=_['defaults'](config[_0x395b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x395b('0x6'))(new Redis(config['redis']));function ChatQueue(_0x36d0a4){this['id']=_0x36d0a4['id']||0x0;this[_0x395b('0x7')]=_0x36d0a4['name']||'';this['timeout']=_0x36d0a4[_0x395b('0x8')]||0xa;this[_0x395b('0x9')]=_0x36d0a4[_0x395b('0x9')]||_0x395b('0xa');this['Agents']=_0x36d0a4[_0x395b('0xb')];this[_0x395b('0xc')]={};this[_0x395b('0xd')]=0x0;this[_0x395b('0x1')]='';this[_0x395b('0xe')]();this['updateRealtime']();}ChatQueue[_0x395b('0xf')][_0x395b('0xe')]=function(){var _0x494a78=this[_0x395b('0xc')][_0x395b('0x10')];this[_0x395b('0xc')]=_[_0x395b('0x11')](this[_0x395b('0xb')],'id');this[_0x395b('0xc')][_0x395b('0x10')]=_0x494a78;};ChatQueue[_0x395b('0xf')]['updateRealtime']=function(){this[_0x395b('0x12')]=0x0;this[_0x395b('0x13')]=0x0;for(var _0x5ae38d=0x0;_0x5ae38d=0x0?this[_0x395b('0x17')]:0x0;var _0x1c6d8d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x395b('0x12')],'name':this[_0x395b('0x7')],'paused':this[_0x395b('0x13')],'waiting':this['waiting']};var _0x291fa0=md5(JSON[_0x395b('0x18')](_0x1c6d8d));if(this[_0x395b('0x1')]!==_0x291fa0){this['md5']=_0x291fa0;io['to'](util[_0x395b('0x19')](_0x395b('0x1a'),_0x1c6d8d[_0x395b('0x7')]))[_0x395b('0x1b')]('chat_queue:save',_0x1c6d8d);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e1955e9..93722ef 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(_0x1a47d6,_0x2b79ca){var _0x12740d=function(_0xbc7316){while(--_0xbc7316){_0x1a47d6['push'](_0x1a47d6['shift']());}};_0x12740d(++_0x2b79ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x412a87,_0x38a214){var _0x71c766=function(_0x5cb4c9){while(--_0x5cb4c9){_0x412a87['push'](_0x412a87['shift']());}};_0x71c766(++_0x38a214);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 9e0eb0e..7763bd6 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 _0x3330=['Intervals','name'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x3330,0x1c3));var _0x0333=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3330[_0x6c993a];return _0x27f547;};'use strict';function Interval(_0x137980){this['id']=_0x137980['id']||0x0;this[_0x0333('0x0')]=_0x137980[_0x0333('0x0')]||'';this['Intervals']=_0x137980[_0x0333('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xf4b0=['Intervals','exports','name'];(function(_0x4b0d24,_0x258109){var _0x51d235=function(_0x2cc105){while(--_0x2cc105){_0x4b0d24['push'](_0x4b0d24['shift']());}};_0x51d235(++_0x258109);}(_0xf4b0,0x194));var _0x0f4b=function(_0x30467b,_0x2e4a2f){_0x30467b=_0x30467b-0x0;var _0x57f4df=_0xf4b0[_0x30467b];return _0x57f4df;};'use strict';function Interval(_0x271061){this['id']=_0x271061['id']||0x0;this[_0x0f4b('0x0')]=_0x271061[_0x0f4b('0x0')]||'';this[_0x0f4b('0x1')]=_0x271061[_0x0f4b('0x1')]||{};}module[_0x0f4b('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 0b3e3c8..2415085 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 _0x5790=['available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRouting','prototype','_rr','mapAgentsId','map','updateRealtime','loggedIn','paused','length','online','mailPause'];(function(_0x886d08,_0x2b985d){var _0x163828=function(_0x1ad2f5){while(--_0x1ad2f5){_0x886d08['push'](_0x886d08['shift']());}};_0x163828(++_0x2b985d);}(_0x5790,0xa1));var _0x0579=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5790[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x0579('0x0'));var md5=require('md5');var util=require(_0x0579('0x1'));var Redis=require(_0x0579('0x2'));var config=require(_0x0579('0x3'));config[_0x0579('0x4')]=_[_0x0579('0x5')](config[_0x0579('0x4')],{'host':_0x0579('0x6'),'port':0x18eb});var io=require(_0x0579('0x7'))(new Redis(config[_0x0579('0x4')]));function MailQueue(_0xd320a8){this['id']=_0xd320a8['id']||0x0;this[_0x0579('0x8')]=_0xd320a8[_0x0579('0x8')]||'';this[_0x0579('0x9')]=_0xd320a8[_0x0579('0x9')]||0xa;this[_0x0579('0xa')]=_0xd320a8[_0x0579('0xa')]||_0x0579('0xb');this[_0x0579('0xc')]=_0xd320a8[_0x0579('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x0579('0xd')]='';this[_0x0579('0xe')]();this['updateRealtime']();}MailQueue[_0x0579('0xf')][_0x0579('0xe')]=function(){var _0x5efe9c=this['mapAgentsId'][_0x0579('0x10')];this[_0x0579('0x11')]=_[_0x0579('0x12')](this[_0x0579('0xc')],'id');this[_0x0579('0x11')][_0x0579('0x10')]=_0x5efe9c;};MailQueue['prototype'][_0x0579('0x13')]=function(){this[_0x0579('0x14')]=0x0;this[_0x0579('0x15')]=0x0;for(var _0x20fccb=0x0;_0x20fccb=0x0?this[_0x0579('0x19')]:0x0;var _0x27e70f={'id':this['id'],'available':this[_0x0579('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x0579('0x15')],'waiting':this['waiting']};var _0x12bb3e=md5(JSON[_0x0579('0x1a')](_0x27e70f));if(this[_0x0579('0xd')]!==_0x12bb3e){this[_0x0579('0xd')]=_0x12bb3e;io['to'](util[_0x0579('0x1b')](_0x0579('0x1c'),_0x27e70f[_0x0579('0x8')]))['emit'](_0x0579('0x1d'),_0x27e70f);}};module[_0x0579('0x1e')]=MailQueue; \ No newline at end of file +var _0xe51f=['updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','mailPause','available','format','emit','mail_queue:save','lodash','md5','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x5af724,_0x924901){var _0x19d08d=function(_0x557263){while(--_0x557263){_0x5af724['push'](_0x5af724['shift']());}};_0x19d08d(++_0x924901);}(_0xe51f,0xaa));var _0xfe51=function(_0x49a179,_0x50cb00){_0x49a179=_0x49a179-0x0;var _0x404636=_0xe51f[_0x49a179];return _0x404636;};'use strict';var _=require(_0xfe51('0x0'));var md5=require(_0xfe51('0x1'));var util=require('util');var Redis=require(_0xfe51('0x2'));var config=require('../../../config/environment');config[_0xfe51('0x3')]=_['defaults'](config[_0xfe51('0x3')],{'host':_0xfe51('0x4'),'port':0x18eb});var io=require(_0xfe51('0x5'))(new Redis(config[_0xfe51('0x3')]));function MailQueue(_0x1d6889){this['id']=_0x1d6889['id']||0x0;this[_0xfe51('0x6')]=_0x1d6889[_0xfe51('0x6')]||'';this[_0xfe51('0x7')]=_0x1d6889[_0xfe51('0x7')]||0xa;this[_0xfe51('0x8')]=_0x1d6889[_0xfe51('0x8')]||'beepall';this[_0xfe51('0x9')]=_0x1d6889['Agents'];this[_0xfe51('0xa')]={};this[_0xfe51('0xb')]=0x0;this[_0xfe51('0x1')]='';this[_0xfe51('0xc')]();this[_0xfe51('0xd')]();}MailQueue[_0xfe51('0xe')]['updateRouting']=function(){var _0x1c4024=this[_0xfe51('0xa')][_0xfe51('0xf')];this[_0xfe51('0xa')]=_[_0xfe51('0x10')](this[_0xfe51('0x9')],'id');this[_0xfe51('0xa')][_0xfe51('0xf')]=_0x1c4024;};MailQueue['prototype'][_0xfe51('0xd')]=function(){this['loggedIn']=0x0;this[_0xfe51('0x11')]=0x0;for(var _0x260253=0x0;_0x260253=0x0?this[_0xfe51('0x16')]:0x0;var _0x1f89b9={'id':this['id'],'available':this[_0xfe51('0x16')],'loggedIn':this[_0xfe51('0x14')],'name':this['name'],'paused':this[_0xfe51('0x11')],'waiting':this[_0xfe51('0xb')]};var _0x3d44d5=md5(JSON['stringify'](_0x1f89b9));if(this[_0xfe51('0x1')]!==_0x3d44d5){this['md5']=_0x3d44d5;io['to'](util[_0xfe51('0x17')]('mail:queue:%s',_0x1f89b9[_0xfe51('0x6')]))[_0xfe51('0x18')](_0xfe51('0x19'),_0x1f89b9);}};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 0f554e5..2ef5ec2 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 _0x1d0a=['util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','prototype','paused','online','loggedIn','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x1d0a,0xfa));var _0xa1d0=function(_0x403833,_0x2b4869){_0x403833=_0x403833-0x0;var _0x1e659a=_0x1d0a[_0x403833];return _0x1e659a;};'use strict';var _=require(_0xa1d0('0x0'));var md5=require(_0xa1d0('0x1'));var util=require(_0xa1d0('0x2'));var Redis=require('ioredis');var config=require(_0xa1d0('0x3'));config[_0xa1d0('0x4')]=_[_0xa1d0('0x5')](config['redis'],{'host':_0xa1d0('0x6'),'port':0x18eb});var io=require(_0xa1d0('0x7'))(new Redis(config[_0xa1d0('0x4')]));function OpenchannelQueue(_0xb63a5a){this['id']=_0xb63a5a['id']||0x0;this['name']=_0xb63a5a[_0xa1d0('0x8')]||'';this['timeout']=_0xb63a5a[_0xa1d0('0x9')]||0xa;this[_0xa1d0('0xa')]=_0xb63a5a[_0xa1d0('0xa')]||'beepall';this['Agents']=_0xb63a5a[_0xa1d0('0xb')];this[_0xa1d0('0xc')]={};this[_0xa1d0('0xd')]=0x0;this[_0xa1d0('0x1')]='';this['updateRouting']();this[_0xa1d0('0xe')]();}OpenchannelQueue['prototype'][_0xa1d0('0xf')]=function(){var _0x112f2e=this[_0xa1d0('0xc')][_0xa1d0('0x10')];this[_0xa1d0('0xc')]=_[_0xa1d0('0x11')](this[_0xa1d0('0xb')],'id');this[_0xa1d0('0xc')][_0xa1d0('0x10')]=_0x112f2e;};OpenchannelQueue[_0xa1d0('0x12')][_0xa1d0('0xe')]=function(){this['loggedIn']=0x0;this[_0xa1d0('0x13')]=0x0;for(var _0x395845=0x0;_0x395845=0x0?this[_0xa1d0('0x16')]:0x0;var _0x23f5da={'id':this['id'],'available':this[_0xa1d0('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xa1d0('0x8')],'paused':this[_0xa1d0('0x13')],'waiting':this[_0xa1d0('0xd')]};var _0x4de0e2=md5(JSON[_0xa1d0('0x17')](_0x23f5da));if(this[_0xa1d0('0x1')]!==_0x4de0e2){this[_0xa1d0('0x1')]=_0x4de0e2;io['to'](util['format'](_0xa1d0('0x18'),_0x23f5da[_0xa1d0('0x8')]))[_0xa1d0('0x19')](_0xa1d0('0x1a'),_0x23f5da);}};module[_0xa1d0('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0xe80c=['openchannel_queue:save','exports','md5','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','length','paused','available','stringify','format','emit'];(function(_0xd3fb91,_0xfc54c0){var _0x33438c=function(_0x924998){while(--_0x924998){_0xd3fb91['push'](_0xd3fb91['shift']());}};_0x33438c(++_0xfc54c0);}(_0xe80c,0x66));var _0xce80=function(_0x1bc8c6,_0x2bd9ed){_0x1bc8c6=_0x1bc8c6-0x0;var _0x6816ec=_0xe80c[_0x1bc8c6];return _0x6816ec;};'use strict';var _=require('lodash');var md5=require(_0xce80('0x0'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xce80('0x1')](config[_0xce80('0x2')],{'host':_0xce80('0x3'),'port':0x18eb});var io=require(_0xce80('0x4'))(new Redis(config['redis']));function OpenchannelQueue(_0x3729af){this['id']=_0x3729af['id']||0x0;this[_0xce80('0x5')]=_0x3729af[_0xce80('0x5')]||'';this[_0xce80('0x6')]=_0x3729af[_0xce80('0x6')]||0xa;this[_0xce80('0x7')]=_0x3729af[_0xce80('0x7')]||_0xce80('0x8');this[_0xce80('0x9')]=_0x3729af[_0xce80('0x9')];this['mapAgentsId']={};this[_0xce80('0xa')]=0x0;this[_0xce80('0x0')]='';this[_0xce80('0xb')]();this[_0xce80('0xc')]();}OpenchannelQueue[_0xce80('0xd')][_0xce80('0xb')]=function(){var _0xa7dba9=this[_0xce80('0xe')][_0xce80('0xf')];this['mapAgentsId']=_['map'](this[_0xce80('0x9')],'id');this[_0xce80('0xe')][_0xce80('0xf')]=_0xa7dba9;};OpenchannelQueue['prototype']['updateRealtime']=function(){this[_0xce80('0x10')]=0x0;this['paused']=0x0;for(var _0x460b66=0x0;_0x460b66=0x0?this[_0xce80('0x13')]:0x0;var _0x3f0bff={'id':this['id'],'available':this[_0xce80('0x13')],'loggedIn':this['loggedIn'],'name':this[_0xce80('0x5')],'paused':this[_0xce80('0x12')],'waiting':this[_0xce80('0xa')]};var _0x2786df=md5(JSON[_0xce80('0x14')](_0x3f0bff));if(this[_0xce80('0x0')]!==_0x2786df){this[_0xce80('0x0')]=_0x2786df;io['to'](util[_0xce80('0x15')]('openchannel:queue:%s',_0x3f0bff['name']))[_0xce80('0x16')](_0xce80('0x17'),_0x3f0bff);}};module[_0xce80('0x18')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 88c0512..526ea80 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(_0x1f47b2,_0x5c8614){var _0x365831=function(_0x5578fb){while(--_0x5578fb){_0x1f47b2['push'](_0x1f47b2['shift']());}};_0x365831(++_0x5c8614);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d160,_0xa4838e){_0x5d160=_0x5d160-0x0;var _0x1d180d=_0xb10b[_0x5d160];return _0x1d180d;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 42620b9..3d019be 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 _0x09e7=['../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','length','isUndefined','agents','mergeFromDatabase','updateRouting','updateRealtime','initSmsQueues','initFaxQueues','exports','bluebird','util','lodash','moment','../model/agent'];(function(_0x1d5e54,_0x5115e6){var _0x420d64=function(_0x14c1dc){while(--_0x14c1dc){_0x1d5e54['push'](_0x1d5e54['shift']());}};_0x420d64(++_0x5115e6);}(_0x09e7,0x19f));var _0x709e=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0x09e7[_0x50cd41];return _0x399475;};'use strict';var BPromise=require(_0x709e('0x0'));var util=require(_0x709e('0x1'));var _=require(_0x709e('0x2'));var moment=require(_0x709e('0x3'));var Agent=require(_0x709e('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x709e('0x5'));var SmsQueue=require(_0x709e('0x6'));var MailQueue=require(_0x709e('0x7'));var FaxQueue=require(_0x709e('0x8'));var Realtime=function(){this['agents']={};this[_0x709e('0x9')]={};this[_0x709e('0xa')]={};this[_0x709e('0xb')]={};this[_0x709e('0xc')]={};this[_0x709e('0xd')]={};this[_0x709e('0xe')]={};this[_0x709e('0xf')]={};this[_0x709e('0x10')]={};this[_0x709e('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0x4e2e42,_0x5af3ec,_0x4d8c50){var _0xb0715f=_[_0x709e('0x12')](_0x4e2e42,function(_0x5abb5b,_0x1a156c){return _0x5abb5b[_0x4d8c50];});for(var _0x41b59f in _0x5af3ec){if(_0x5af3ec[_0x709e('0x13')](_0x41b59f)){if(!_0xb0715f[_0x41b59f]){delete _0x5af3ec[_0x41b59f];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0xdb4589,_0x5e9f6d){for(var _0xb3c4e4 in _0x5e9f6d){if(_0xdb4589['hasOwnProperty'](_0xb3c4e4)){_0xdb4589[_0xb3c4e4]=_0x5e9f6d[_0xb3c4e4];}}};Realtime[_0x709e('0x14')]['initAgents']=function(){var _0x23501e=this;return function(_0xdf0758){if(_0xdf0758){freeIsNotKey(_0xdf0758,_0x23501e['agents'],'id');for(var _0x3c1a1c=0x0,_0x3a4b6e={},_0x1a66e1={};_0x3c1a1c<_0xdf0758[_0x709e('0x15')];_0x3c1a1c+=0x1){_0x3a4b6e=_0xdf0758[_0x3c1a1c];if(_[_0x709e('0x16')](_0x23501e[_0x709e('0x17')][_0x3a4b6e['id']])){_0x23501e[_0x709e('0x17')][_0x3a4b6e['id']]=new Agent(_0x3a4b6e);}else{_0x23501e[_0x709e('0x18')](_0x23501e['agents'][_0x3a4b6e['id']],_0x3a4b6e);}}}return _0x23501e[_0x709e('0x17')];};};Realtime[_0x709e('0x14')]['initIntervals']=function(){var _0x397cd8=this;return function(_0x421de9){if(_0x421de9){freeIsNotKey(_0x421de9,_0x397cd8['intervals'],'id');for(var _0x274795=0x0,_0x5daea0={},_0xd758af={};_0x274795<_0x421de9[_0x709e('0x15')];_0x274795+=0x1){_0x5daea0=_0x421de9[_0x274795];if(_['isUndefined'](_0x397cd8['intervals'][_0x5daea0['id']])){_0x397cd8[_0x709e('0x9')][_0x5daea0['id']]=new Interval(_0x5daea0);}else{_0x397cd8[_0x709e('0x18')](_0x397cd8[_0x709e('0x9')][_0x5daea0['id']],_0x5daea0);}}}return _0x397cd8[_0x709e('0x9')];};};Realtime[_0x709e('0x14')]['initOpenchannelQueues']=function(){var _0x5c2048=this;return function(_0x26e890){if(_0x26e890){freeIsNotKey(_0x26e890,_0x5c2048[_0x709e('0xa')],'id');for(var _0x1eec85=0x0,_0x3e4bc8={},_0x5f1b15={};_0x1eec85<_0x26e890[_0x709e('0x15')];_0x1eec85+=0x1){_0x3e4bc8=_0x26e890[_0x1eec85];if(_[_0x709e('0x16')](_0x5c2048[_0x709e('0xa')][_0x3e4bc8['id']])){_0x5c2048['openchannelQueues'][_0x3e4bc8['id']]=new OpenchannelQueue(_0x3e4bc8);}else{_0x5c2048[_0x709e('0x18')](_0x5c2048[_0x709e('0xa')][_0x3e4bc8['id']],_0x3e4bc8);}_0x5c2048[_0x709e('0xa')][_0x3e4bc8['id']][_0x709e('0x19')]();_0x5c2048[_0x709e('0xa')][_0x3e4bc8['id']][_0x709e('0x1a')]();}}return _0x5c2048[_0x709e('0xa')];};};Realtime[_0x709e('0x14')]['initChatQueues']=function(){var _0x2cebc2=this;return function(_0x1b1fad){if(_0x1b1fad){freeIsNotKey(_0x1b1fad,_0x2cebc2[_0x709e('0xb')],'id');for(var _0x1b9e95=0x0,_0x272b81={},_0x440215={};_0x1b9e95<_0x1b1fad[_0x709e('0x15')];_0x1b9e95+=0x1){_0x272b81=_0x1b1fad[_0x1b9e95];if(_['isUndefined'](_0x2cebc2['chatQueues'][_0x272b81['id']])){_0x2cebc2[_0x709e('0xb')][_0x272b81['id']]=new ChatQueue(_0x272b81);}else{_0x2cebc2[_0x709e('0x18')](_0x2cebc2[_0x709e('0xb')][_0x272b81['id']],_0x272b81);}_0x2cebc2[_0x709e('0xb')][_0x272b81['id']][_0x709e('0x19')]();_0x2cebc2['chatQueues'][_0x272b81['id']][_0x709e('0x1a')]();}}return _0x2cebc2[_0x709e('0xb')];};};Realtime[_0x709e('0x14')][_0x709e('0x1b')]=function(){var _0x3606da=this;return function(_0x21fb61){if(_0x21fb61){freeIsNotKey(_0x21fb61,_0x3606da[_0x709e('0xc')],'id');for(var _0x3e42ce=0x0,_0x156e41={},_0x20f001={};_0x3e42ce<_0x21fb61['length'];_0x3e42ce+=0x1){_0x156e41=_0x21fb61[_0x3e42ce];if(_['isUndefined'](_0x3606da[_0x709e('0xc')][_0x156e41['id']])){_0x3606da[_0x709e('0xc')][_0x156e41['id']]=new SmsQueue(_0x156e41);}else{_0x3606da[_0x709e('0x18')](_0x3606da['smsQueues'][_0x156e41['id']],_0x156e41);}_0x3606da[_0x709e('0xc')][_0x156e41['id']][_0x709e('0x19')]();_0x3606da['smsQueues'][_0x156e41['id']][_0x709e('0x1a')]();}}return _0x3606da[_0x709e('0xc')];};};Realtime[_0x709e('0x14')]['initMailQueues']=function(){var _0x158b8a=this;return function(_0x1b35ee){if(_0x1b35ee){freeIsNotKey(_0x1b35ee,_0x158b8a[_0x709e('0xd')],'id');for(var _0x40ddd3=0x0,_0x4141f6={},_0x49382a={};_0x40ddd3<_0x1b35ee[_0x709e('0x15')];_0x40ddd3+=0x1){_0x4141f6=_0x1b35ee[_0x40ddd3];if(_[_0x709e('0x16')](_0x158b8a['mailQueues'][_0x4141f6['id']])){_0x158b8a[_0x709e('0xd')][_0x4141f6['id']]=new MailQueue(_0x4141f6);}else{_0x158b8a[_0x709e('0x18')](_0x158b8a[_0x709e('0xd')][_0x4141f6['id']],_0x4141f6);}_0x158b8a[_0x709e('0xd')][_0x4141f6['id']][_0x709e('0x19')]();_0x158b8a[_0x709e('0xd')][_0x4141f6['id']][_0x709e('0x1a')]();}}return _0x158b8a[_0x709e('0xd')];};};Realtime[_0x709e('0x14')][_0x709e('0x1c')]=function(){var _0x55a824=this;return function(_0x27570f){if(_0x27570f){freeIsNotKey(_0x27570f,_0x55a824[_0x709e('0xe')],'id');for(var _0x5a9358=0x0,_0x3afc62={},_0x1119d2={};_0x5a9358<_0x27570f[_0x709e('0x15')];_0x5a9358+=0x1){_0x3afc62=_0x27570f[_0x5a9358];if(_[_0x709e('0x16')](_0x55a824[_0x709e('0xe')][_0x3afc62['id']])){_0x55a824['faxQueues'][_0x3afc62['id']]=new FaxQueue(_0x3afc62);}else{_0x55a824[_0x709e('0x18')](_0x55a824[_0x709e('0xe')][_0x3afc62['id']],_0x3afc62);}_0x55a824['faxQueues'][_0x3afc62['id']]['updateRouting']();_0x55a824[_0x709e('0xe')][_0x3afc62['id']][_0x709e('0x1a')]();}}return _0x55a824['faxQueues'];};};module[_0x709e('0x1d')]=Realtime; \ No newline at end of file +var _0xf05e=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initAgents','length','isUndefined','initOpenchannelQueues','updateRouting','initSmsQueues','updateRealtime','initMailQueues','mailQueues','initFaxQueues','exports','bluebird','lodash','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues'];(function(_0x51e375,_0x256dc3){var _0x4d37bf=function(_0x1d984f){while(--_0x1d984f){_0x51e375['push'](_0x51e375['shift']());}};_0x4d37bf(++_0x256dc3);}(_0xf05e,0x17f));var _0xef05=function(_0x2f6e2a,_0x559421){_0x2f6e2a=_0x2f6e2a-0x0;var _0x3afca1=_0xf05e[_0x2f6e2a];return _0x3afca1;};'use strict';var BPromise=require(_0xef05('0x0'));var util=require('util');var _=require(_0xef05('0x1'));var moment=require('moment');var Agent=require(_0xef05('0x2'));var Interval=require(_0xef05('0x3'));var OpenchannelQueue=require(_0xef05('0x4'));var ChatQueue=require(_0xef05('0x5'));var SmsQueue=require(_0xef05('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xef05('0x7'));var Realtime=function(){this[_0xef05('0x8')]={};this[_0xef05('0x9')]={};this[_0xef05('0xa')]={};this[_0xef05('0xb')]={};this[_0xef05('0xc')]={};this['mailQueues']={};this[_0xef05('0xd')]={};this['chatQueuesWaitingInteractions']={};this[_0xef05('0xe')]={};this[_0xef05('0xf')]={};this[_0xef05('0x10')]={};this[_0xef05('0x11')]={};};function freeIsNotKey(_0x106114,_0x393d70,_0xeece54){var _0xd88ecf=_[_0xef05('0x12')](_0x106114,function(_0x3b6370,_0x39cb6f){return _0x3b6370[_0xeece54];});for(var _0x12217d in _0x393d70){if(_0x393d70[_0xef05('0x13')](_0x12217d)){if(!_0xd88ecf[_0x12217d]){delete _0x393d70[_0x12217d];}}}}Realtime['prototype'][_0xef05('0x14')]=function(_0x3ce09c,_0x43146c){for(var _0x5083d6 in _0x43146c){if(_0x3ce09c[_0xef05('0x13')](_0x5083d6)){_0x3ce09c[_0x5083d6]=_0x43146c[_0x5083d6];}}};Realtime[_0xef05('0x15')][_0xef05('0x16')]=function(){var _0x348739=this;return function(_0x256317){if(_0x256317){freeIsNotKey(_0x256317,_0x348739[_0xef05('0x8')],'id');for(var _0x1d745e=0x0,_0x1fc151={},_0x2583c4={};_0x1d745e<_0x256317[_0xef05('0x17')];_0x1d745e+=0x1){_0x1fc151=_0x256317[_0x1d745e];if(_[_0xef05('0x18')](_0x348739[_0xef05('0x8')][_0x1fc151['id']])){_0x348739[_0xef05('0x8')][_0x1fc151['id']]=new Agent(_0x1fc151);}else{_0x348739[_0xef05('0x14')](_0x348739[_0xef05('0x8')][_0x1fc151['id']],_0x1fc151);}}}return _0x348739[_0xef05('0x8')];};};Realtime['prototype']['initIntervals']=function(){var _0x524050=this;return function(_0xc45be4){if(_0xc45be4){freeIsNotKey(_0xc45be4,_0x524050[_0xef05('0x9')],'id');for(var _0x437226=0x0,_0x27cca7={},_0x2eccb9={};_0x437226<_0xc45be4[_0xef05('0x17')];_0x437226+=0x1){_0x27cca7=_0xc45be4[_0x437226];if(_[_0xef05('0x18')](_0x524050[_0xef05('0x9')][_0x27cca7['id']])){_0x524050['intervals'][_0x27cca7['id']]=new Interval(_0x27cca7);}else{_0x524050[_0xef05('0x14')](_0x524050[_0xef05('0x9')][_0x27cca7['id']],_0x27cca7);}}}return _0x524050['intervals'];};};Realtime[_0xef05('0x15')][_0xef05('0x19')]=function(){var _0xf0031c=this;return function(_0x42a3b3){if(_0x42a3b3){freeIsNotKey(_0x42a3b3,_0xf0031c['openchannelQueues'],'id');for(var _0x27f24f=0x0,_0x131afb={},_0x3baf5a={};_0x27f24f<_0x42a3b3[_0xef05('0x17')];_0x27f24f+=0x1){_0x131afb=_0x42a3b3[_0x27f24f];if(_[_0xef05('0x18')](_0xf0031c['openchannelQueues'][_0x131afb['id']])){_0xf0031c[_0xef05('0xa')][_0x131afb['id']]=new OpenchannelQueue(_0x131afb);}else{_0xf0031c[_0xef05('0x14')](_0xf0031c[_0xef05('0xa')][_0x131afb['id']],_0x131afb);}_0xf0031c[_0xef05('0xa')][_0x131afb['id']][_0xef05('0x1a')]();_0xf0031c[_0xef05('0xa')][_0x131afb['id']]['updateRealtime']();}}return _0xf0031c[_0xef05('0xa')];};};Realtime[_0xef05('0x15')]['initChatQueues']=function(){var _0x573626=this;return function(_0x467ad9){if(_0x467ad9){freeIsNotKey(_0x467ad9,_0x573626[_0xef05('0xb')],'id');for(var _0x28a8b9=0x0,_0x55a950={},_0x554713={};_0x28a8b9<_0x467ad9[_0xef05('0x17')];_0x28a8b9+=0x1){_0x55a950=_0x467ad9[_0x28a8b9];if(_[_0xef05('0x18')](_0x573626[_0xef05('0xb')][_0x55a950['id']])){_0x573626[_0xef05('0xb')][_0x55a950['id']]=new ChatQueue(_0x55a950);}else{_0x573626[_0xef05('0x14')](_0x573626[_0xef05('0xb')][_0x55a950['id']],_0x55a950);}_0x573626['chatQueues'][_0x55a950['id']]['updateRouting']();_0x573626[_0xef05('0xb')][_0x55a950['id']]['updateRealtime']();}}return _0x573626[_0xef05('0xb')];};};Realtime[_0xef05('0x15')][_0xef05('0x1b')]=function(){var _0x245251=this;return function(_0x152007){if(_0x152007){freeIsNotKey(_0x152007,_0x245251[_0xef05('0xc')],'id');for(var _0x44a4af=0x0,_0x294851={},_0xd2944b={};_0x44a4af<_0x152007[_0xef05('0x17')];_0x44a4af+=0x1){_0x294851=_0x152007[_0x44a4af];if(_[_0xef05('0x18')](_0x245251[_0xef05('0xc')][_0x294851['id']])){_0x245251[_0xef05('0xc')][_0x294851['id']]=new SmsQueue(_0x294851);}else{_0x245251[_0xef05('0x14')](_0x245251[_0xef05('0xc')][_0x294851['id']],_0x294851);}_0x245251[_0xef05('0xc')][_0x294851['id']][_0xef05('0x1a')]();_0x245251[_0xef05('0xc')][_0x294851['id']][_0xef05('0x1c')]();}}return _0x245251[_0xef05('0xc')];};};Realtime[_0xef05('0x15')][_0xef05('0x1d')]=function(){var _0x72775=this;return function(_0x1d3667){if(_0x1d3667){freeIsNotKey(_0x1d3667,_0x72775[_0xef05('0x1e')],'id');for(var _0x5672b5=0x0,_0x274691={},_0x5e789c={};_0x5672b5<_0x1d3667['length'];_0x5672b5+=0x1){_0x274691=_0x1d3667[_0x5672b5];if(_[_0xef05('0x18')](_0x72775[_0xef05('0x1e')][_0x274691['id']])){_0x72775[_0xef05('0x1e')][_0x274691['id']]=new MailQueue(_0x274691);}else{_0x72775[_0xef05('0x14')](_0x72775['mailQueues'][_0x274691['id']],_0x274691);}_0x72775[_0xef05('0x1e')][_0x274691['id']][_0xef05('0x1a')]();_0x72775[_0xef05('0x1e')][_0x274691['id']]['updateRealtime']();}}return _0x72775['mailQueues'];};};Realtime['prototype'][_0xef05('0x1f')]=function(){var _0x1ec8b9=this;return function(_0x59f29e){if(_0x59f29e){freeIsNotKey(_0x59f29e,_0x1ec8b9[_0xef05('0xd')],'id');for(var _0x4705da=0x0,_0x579f4d={},_0x5c040b={};_0x4705da<_0x59f29e['length'];_0x4705da+=0x1){_0x579f4d=_0x59f29e[_0x4705da];if(_['isUndefined'](_0x1ec8b9[_0xef05('0xd')][_0x579f4d['id']])){_0x1ec8b9[_0xef05('0xd')][_0x579f4d['id']]=new FaxQueue(_0x579f4d);}else{_0x1ec8b9[_0xef05('0x14')](_0x1ec8b9['faxQueues'][_0x579f4d['id']],_0x579f4d);}_0x1ec8b9[_0xef05('0xd')][_0x579f4d['id']]['updateRouting']();_0x1ec8b9['faxQueues'][_0x579f4d['id']]['updateRealtime']();}}return _0x1ec8b9[_0xef05('0xd')];};};module[_0xef05('0x20')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 09921c7..6ff6869 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 _0xb759=['AddTagsToChatInteraction','../client','Request','updateChatInteraction','addTags'];(function(_0x2bf5d5,_0x366ece){var _0x505ee3=function(_0x5b1192){while(--_0x5b1192){_0x2bf5d5['push'](_0x2bf5d5['shift']());}};_0x505ee3(++_0x366ece);}(_0xb759,0x1d2));var _0x9b75=function(_0x41cdde,_0x4bd78c){_0x41cdde=_0x41cdde-0x0;var _0x2dec1e=_0xb759[_0x41cdde];return _0x2dec1e;};'use strict';var client=require(_0x9b75('0x0'));exports['update']=function(_0x5a95ee,_0x5c9794){return client[_0x9b75('0x1')]('UpdateChatInteraction',{'body':_0x5c9794,'options':{'where':{'id':_0x5a95ee}},'log':_0x9b75('0x2')});};exports[_0x9b75('0x3')]=function(_0x2c6809,_0x492832){return client[_0x9b75('0x1')](_0x9b75('0x4'),{'body':_0x492832,'options':{'where':{'id':_0x2c6809}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1d07=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x321e9d,_0x3fe94f){var _0xeafde7=function(_0x1c98b0){while(--_0x1c98b0){_0x321e9d['push'](_0x321e9d['shift']());}};_0xeafde7(++_0x3fe94f);}(_0x1d07,0x84));var _0x71d0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1d07[_0x19950b];return _0x3c6b41;};'use strict';var client=require('../client');exports[_0x71d0('0x0')]=function(_0x3c0473,_0x1765f1){return client[_0x71d0('0x1')](_0x71d0('0x2'),{'body':_0x1765f1,'options':{'where':{'id':_0x3c0473}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x4bf52a,_0xda4b6d){return client['Request'](_0x71d0('0x3'),{'body':_0xda4b6d,'options':{'where':{'id':_0x4bf52a}},'log':_0x71d0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3733b29..a471d25 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 _0xd2a8=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xd2a8,0x90));var _0x8d2a=function(_0x214c35,_0x387a79){_0x214c35=_0x214c35-0x0;var _0x16cf53=_0xd2a8[_0x214c35];return _0x16cf53;};'use strict';var client=require(_0x8d2a('0x0'));exports[_0x8d2a('0x1')]=function(_0x2d5d00){return client[_0x8d2a('0x2')](_0x8d2a('0x3'),{'body':_0x2d5d00,'log':_0x8d2a('0x4')});}; \ No newline at end of file +var _0xc986=['Request','createChatMessage','../client'];(function(_0x34e94c,_0x3dfe9f){var _0x55172e=function(_0x9376a9){while(--_0x9376a9){_0x34e94c['push'](_0x34e94c['shift']());}};_0x55172e(++_0x3dfe9f);}(_0xc986,0xce));var _0x6c98=function(_0x5099e4,_0xc868d3){_0x5099e4=_0x5099e4-0x0;var _0x46299c=_0xc986[_0x5099e4];return _0x46299c;};'use strict';var client=require(_0x6c98('0x0'));exports['create']=function(_0x2b7d8a){return client[_0x6c98('0x1')]('CreateChatMessage',{'body':_0x2b7d8a,'log':_0x6c98('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 5ea886b..23ee60c 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 _0x3e95=['GetChatQueue','name','strategy','Agents','chatPause','../client','getChatQueues'];(function(_0x89271b,_0x401132){var _0x5a19f5=function(_0x159eff){while(--_0x159eff){_0x89271b['push'](_0x89271b['shift']());}};_0x5a19f5(++_0x401132);}(_0x3e95,0x140));var _0x53e9=function(_0x57c924,_0x5d004f){_0x57c924=_0x57c924-0x0;var _0x40bbf4=_0x3e95[_0x57c924];return _0x40bbf4;};'use strict';var client=require(_0x53e9('0x0'));exports[_0x53e9('0x1')]=function(){return function(){return client['Request'](_0x53e9('0x2'),{'options':{'raw':![],'attributes':['id',_0x53e9('0x3'),'timeout',_0x53e9('0x4')],'include':[{'model':'User','as':_0x53e9('0x5'),'attributes':['id',_0x53e9('0x3'),'online',_0x53e9('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x98fa=['User','Agents','online','chatPause','../client','getChatQueues','GetChatQueue','name','timeout','strategy'];(function(_0xea0a17,_0x5ce91f){var _0x3500d1=function(_0x4fa7d5){while(--_0x4fa7d5){_0xea0a17['push'](_0xea0a17['shift']());}};_0x3500d1(++_0x5ce91f);}(_0x98fa,0x90));var _0xa98f=function(_0x318da6,_0x4b031d){_0x318da6=_0x318da6-0x0;var _0x31193c=_0x98fa[_0x318da6];return _0x31193c;};'use strict';var client=require(_0xa98f('0x0'));exports[_0xa98f('0x1')]=function(){return function(){return client['Request'](_0xa98f('0x2'),{'options':{'raw':![],'attributes':['id',_0xa98f('0x3'),_0xa98f('0x4'),_0xa98f('0x5')],'include':[{'model':_0xa98f('0x6'),'as':_0xa98f('0x7'),'attributes':['id',_0xa98f('0x3'),_0xa98f('0x8'),_0xa98f('0x9')]}]},'log':_0xa98f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c5e3d43..5910ece 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 _0x2121=['UpdateChatQueueReport','../client','create','CreateChatQueueReport','update'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x2121,0x1b4));var _0x1212=function(_0x3cdb2f,_0x180d7f){_0x3cdb2f=_0x3cdb2f-0x0;var _0x5139ce=_0x2121[_0x3cdb2f];return _0x5139ce;};'use strict';var client=require(_0x1212('0x0'));exports[_0x1212('0x1')]=function(_0x55810d){return client['Request'](_0x1212('0x2'),{'body':_0x55810d,'log':_0x1212('0x2')});};exports[_0x1212('0x3')]=function(_0x2447e3,_0x44337c){return client['Request'](_0x1212('0x4'),{'body':_0x44337c,'options':{'where':{'uniqueid':_0x2447e3},'order':[['id','DESC']],'limit':0x1},'log':_0x1212('0x4')});}; \ No newline at end of file +var _0x3098=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x4fcba1,_0x54128e){var _0x1f685e=function(_0x4c4441){while(--_0x4c4441){_0x4fcba1['push'](_0x4fcba1['shift']());}};_0x1f685e(++_0x54128e);}(_0x3098,0x86));var _0x8309=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x3098[_0x1d7037];return _0x4d6568;};'use strict';var client=require(_0x8309('0x0'));exports[_0x8309('0x1')]=function(_0x1cb9fb){return client[_0x8309('0x2')]('CreateChatQueueReport',{'body':_0x1cb9fb,'log':_0x8309('0x3')});};exports[_0x8309('0x4')]=function(_0x9aa807,_0x2e58f5){return client[_0x8309('0x2')](_0x8309('0x5'),{'body':_0x2e58f5,'options':{'where':{'uniqueid':_0x9aa807},'order':[['id',_0x8309('0x6')]],'limit':0x1},'log':_0x8309('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2492d68..6bf3d30 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 _0x8d6a=['addTagsToFaxInteraction','update','UpdateFaxInteraction','updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x8d6a,0x1ac));var _0xa8d6=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x8d6a[_0x13ea00];return _0x1f7347;};'use strict';var client=require('../client');exports[_0xa8d6('0x0')]=function(_0x300b95,_0x75234b){return client['Request'](_0xa8d6('0x1'),{'body':_0x75234b,'options':{'where':{'id':_0x300b95}},'log':_0xa8d6('0x2')});};exports[_0xa8d6('0x3')]=function(_0x5cdad3,_0xb1eb8a){return client[_0xa8d6('0x4')](_0xa8d6('0x5'),{'body':_0xb1eb8a,'options':{'where':{'id':_0x5cdad3}},'log':_0xa8d6('0x6')});}; \ No newline at end of file +var _0x4ca9=['updateFaxInteraction','AddTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction'];(function(_0xe2de08,_0x540381){var _0x10c9c3=function(_0x52ea87){while(--_0x52ea87){_0xe2de08['push'](_0xe2de08['shift']());}};_0x10c9c3(++_0x540381);}(_0x4ca9,0x128));var _0x94ca=function(_0x4b1596,_0x298661){_0x4b1596=_0x4b1596-0x0;var _0xfee8fc=_0x4ca9[_0x4b1596];return _0xfee8fc;};'use strict';var client=require(_0x94ca('0x0'));exports[_0x94ca('0x1')]=function(_0x491b3e,_0x51ae63){return client[_0x94ca('0x2')](_0x94ca('0x3'),{'body':_0x51ae63,'options':{'where':{'id':_0x491b3e}},'log':_0x94ca('0x4')});};exports['addTags']=function(_0x400184,_0x299034){return client['Request'](_0x94ca('0x5'),{'body':_0x299034,'options':{'where':{'id':_0x400184}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 8e829d3..2467d66 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 _0x74ad=['createFaxMessage','create','Request'];(function(_0x2840c9,_0xd6f959){var _0x88f2c4=function(_0x140cc5){while(--_0x140cc5){_0x2840c9['push'](_0x2840c9['shift']());}};_0x88f2c4(++_0xd6f959);}(_0x74ad,0xeb));var _0xd74a=function(_0x303310,_0x3d6211){_0x303310=_0x303310-0x0;var _0x1e4370=_0x74ad[_0x303310];return _0x1e4370;};'use strict';var client=require('../client');exports[_0xd74a('0x0')]=function(_0x487a8d){return client[_0xd74a('0x1')]('CreateFaxMessage',{'body':_0x487a8d,'log':_0xd74a('0x2')});}; \ No newline at end of file +var _0x4dd2=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x4dd2,0x180));var _0x24dd=function(_0x12a06b,_0x417b51){_0x12a06b=_0x12a06b-0x0;var _0x5d0bb8=_0x4dd2[_0x12a06b];return _0x5d0bb8;};'use strict';var client=require(_0x24dd('0x0'));exports[_0x24dd('0x1')]=function(_0xc408c6){return client[_0x24dd('0x2')](_0x24dd('0x3'),{'body':_0xc408c6,'log':_0x24dd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4a7acb9..592c6d4 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 _0x6057=['Agents','name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','strategy','User'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6057,0x1e4));var _0x7605=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x6057[_0x3305de];return _0x3b5a84;};'use strict';var client=require(_0x7605('0x0'));exports[_0x7605('0x1')]=function(){return function(){return client[_0x7605('0x2')](_0x7605('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x7605('0x4')],'include':[{'model':_0x7605('0x5'),'as':_0x7605('0x6'),'attributes':['id',_0x7605('0x7'),_0x7605('0x8'),_0x7605('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x1589=['getFaxQueues','Request','name','timeout','strategy','User','Agents','../client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1589,0x187));var _0x9158=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x1589[_0x507ac5];return _0x12c1bc;};'use strict';var client=require(_0x9158('0x0'));exports[_0x9158('0x1')]=function(){return function(){return client[_0x9158('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x9158('0x3'),_0x9158('0x4'),_0x9158('0x5')],'include':[{'model':_0x9158('0x6'),'as':_0x9158('0x7'),'attributes':['id',_0x9158('0x3'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index c630ea3..77f62fc 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 _0xb8d9=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb8d9,0x175));var _0x9b8d=function(_0x4acb24,_0x26ab60){_0x4acb24=_0x4acb24-0x0;var _0x181b0b=_0xb8d9[_0x4acb24];return _0x181b0b;};'use strict';var client=require(_0x9b8d('0x0'));exports[_0x9b8d('0x1')]=function(_0x391d10){return client[_0x9b8d('0x2')](_0x9b8d('0x3'),{'body':_0x391d10,'log':_0x9b8d('0x3')});};exports[_0x9b8d('0x4')]=function(_0x1fdf9a,_0x3eb139){return client[_0x9b8d('0x2')](_0x9b8d('0x5'),{'body':_0x3eb139,'options':{'where':{'uniqueid':_0x1fdf9a},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xcfa1=['../client','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x301fcd,_0x9dc7b2){var _0x82817b=function(_0x86f726){while(--_0x86f726){_0x301fcd['push'](_0x301fcd['shift']());}};_0x82817b(++_0x9dc7b2);}(_0xcfa1,0xc8));var _0x1cfa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfa1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1cfa('0x0'));exports['create']=function(_0x3f6965){return client[_0x1cfa('0x1')](_0x1cfa('0x2'),{'body':_0x3f6965,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x3fbbc2,_0x1640d5){return client[_0x1cfa('0x1')](_0x1cfa('0x3'),{'body':_0x1640d5,'options':{'where':{'uniqueid':_0x3fbbc2},'order':[['id',_0x1cfa('0x4')]],'limit':0x1},'log':_0x1cfa('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 81645d7..99df63a 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 _0xcf66=['getIntervals','Request','name','Interval','interval','../client'];(function(_0x4461e1,_0x58bb1e){var _0x33fa76=function(_0x4687a6){while(--_0x4687a6){_0x4461e1['push'](_0x4461e1['shift']());}};_0x33fa76(++_0x58bb1e);}(_0xcf66,0x71));var _0x6cf6=function(_0x17f0fc,_0x676423){_0x17f0fc=_0x17f0fc-0x0;var _0x32ea4a=_0xcf66[_0x17f0fc];return _0x32ea4a;};'use strict';var client=require(_0x6cf6('0x0'));exports[_0x6cf6('0x1')]=function(){return function(){return client[_0x6cf6('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6cf6('0x3')],'include':[{'model':_0x6cf6('0x4'),'as':'Intervals','attributes':['id','name',_0x6cf6('0x5')]}]},'log':_0x6cf6('0x1')});};}; \ No newline at end of file +var _0xe511=['interval','../client','getIntervals','GetInterval','Interval','Intervals'];(function(_0x4a8f8d,_0x58bfe9){var _0x39e20d=function(_0x1f8a89){while(--_0x1f8a89){_0x4a8f8d['push'](_0x4a8f8d['shift']());}};_0x39e20d(++_0x58bfe9);}(_0xe511,0x16f));var _0x1e51=function(_0x29fefa,_0x3c9ba0){_0x29fefa=_0x29fefa-0x0;var _0x530b05=_0xe511[_0x29fefa];return _0x530b05;};'use strict';var client=require(_0x1e51('0x0'));exports[_0x1e51('0x1')]=function(){return function(){return client['Request'](_0x1e51('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1e51('0x3'),'as':_0x1e51('0x4'),'attributes':['id','name',_0x1e51('0x5')]}]},'log':_0x1e51('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 11b89bc..6799668 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 _0xe654=['../client','updateMailInteraction','Request','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xe654,0x73));var _0x4e65=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe654[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x4e65('0x0'));exports['update']=function(_0x3af3fe,_0x39ce74){return client['Request']('UpdateMailInteraction',{'body':_0x39ce74,'options':{'where':{'id':_0x3af3fe}},'log':_0x4e65('0x1')});};exports['addTags']=function(_0x194f47,_0x16f453){return client[_0x4e65('0x2')](_0x4e65('0x3'),{'body':_0x16f453,'options':{'where':{'id':_0x194f47}},'log':_0x4e65('0x4')});}; \ No newline at end of file +var _0xe811=['UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update','Request'];(function(_0xd20e4d,_0x49a347){var _0x11586d=function(_0x531667){while(--_0x531667){_0xd20e4d['push'](_0xd20e4d['shift']());}};_0x11586d(++_0x49a347);}(_0xe811,0x7b));var _0x1e81=function(_0x1eb999,_0x2446c4){_0x1eb999=_0x1eb999-0x0;var _0x2fca48=_0xe811[_0x1eb999];return _0x2fca48;};'use strict';var client=require(_0x1e81('0x0'));exports[_0x1e81('0x1')]=function(_0x27f2ab,_0x1996e0){return client[_0x1e81('0x2')](_0x1e81('0x3'),{'body':_0x1996e0,'options':{'where':{'id':_0x27f2ab}},'log':_0x1e81('0x4')});};exports[_0x1e81('0x5')]=function(_0x39563b,_0x4c388d){return client[_0x1e81('0x2')]('AddTagsToMailInteraction',{'body':_0x4c388d,'options':{'where':{'id':_0x39563b}},'log':_0x1e81('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 501a511..db6b022 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 _0xc0be=['create','Request','CreateMailMessage'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xc0be,0x1d4));var _0xec0b=function(_0x149c7b,_0x1bf275){_0x149c7b=_0x149c7b-0x0;var _0xfe447e=_0xc0be[_0x149c7b];return _0xfe447e;};'use strict';var client=require('../client');exports[_0xec0b('0x0')]=function(_0x51ea5e){return client[_0xec0b('0x1')](_0xec0b('0x2'),{'body':_0x51ea5e,'log':'createMailMessage'});}; \ No newline at end of file +var _0x3fc4=['CreateMailMessage','create','Request'];(function(_0xe786d5,_0x2eaf8c){var _0xfdb2c0=function(_0x21ec89){while(--_0x21ec89){_0xe786d5['push'](_0xe786d5['shift']());}};_0xfdb2c0(++_0x2eaf8c);}(_0x3fc4,0xf4));var _0x43fc=function(_0x39502d,_0x3029af){_0x39502d=_0x39502d-0x0;var _0x6f267e=_0x3fc4[_0x39502d];return _0x6f267e;};'use strict';var client=require('../client');exports[_0x43fc('0x0')]=function(_0x46fb0e){return client[_0x43fc('0x1')](_0x43fc('0x2'),{'body':_0x46fb0e,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a3a8c29..837479d 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 _0xc7d4=['User','Agents','online','../client','getMailQueues','Request','name','timeout','strategy'];(function(_0x413d8d,_0x3c98a1){var _0x2030c0=function(_0x556028){while(--_0x556028){_0x413d8d['push'](_0x413d8d['shift']());}};_0x2030c0(++_0x3c98a1);}(_0xc7d4,0x111));var _0x4c7d=function(_0x4cd4ea,_0x4807b3){_0x4cd4ea=_0x4cd4ea-0x0;var _0x1fa23b=_0xc7d4[_0x4cd4ea];return _0x1fa23b;};'use strict';var client=require(_0x4c7d('0x0'));exports[_0x4c7d('0x1')]=function(){return function(){return client[_0x4c7d('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x4c7d('0x3'),_0x4c7d('0x4'),_0x4c7d('0x5')],'include':[{'model':_0x4c7d('0x6'),'as':_0x4c7d('0x7'),'attributes':['id',_0x4c7d('0x3'),_0x4c7d('0x8'),'mailPause']}]},'log':_0x4c7d('0x1')});};}; \ No newline at end of file +var _0x2e4e=['../client','Request','GetMailQueue','User','Agents','name','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e4e,0x69));var _0xe2e4=function(_0x30da8d,_0x27b510){_0x30da8d=_0x30da8d-0x0;var _0x5abf10=_0x2e4e[_0x30da8d];return _0x5abf10;};'use strict';var client=require(_0xe2e4('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xe2e4('0x1')](_0xe2e4('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xe2e4('0x3'),'as':_0xe2e4('0x4'),'attributes':['id',_0xe2e4('0x5'),_0xe2e4('0x6'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 31909fc..71db40b 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 _0x58c5=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x58c5,0x155));var _0x558c=function(_0x5546de,_0x47c039){_0x5546de=_0x5546de-0x0;var _0x10fdde=_0x58c5[_0x5546de];return _0x10fdde;};'use strict';var client=require(_0x558c('0x0'));exports[_0x558c('0x1')]=function(_0x177594){return client[_0x558c('0x2')](_0x558c('0x3'),{'body':_0x177594,'log':'CreateMailQueueReport'});};exports[_0x558c('0x4')]=function(_0x53c3b2,_0x2f3cc8){return client[_0x558c('0x2')](_0x558c('0x5'),{'body':_0x2f3cc8,'options':{'where':{'uniqueid':_0x53c3b2},'order':[['id',_0x558c('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xae70=['create','Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client'];(function(_0x4fce8f,_0x43bcf9){var _0x52f0ae=function(_0x247ca2){while(--_0x247ca2){_0x4fce8f['push'](_0x4fce8f['shift']());}};_0x52f0ae(++_0x43bcf9);}(_0xae70,0x172));var _0x0ae7=function(_0x5838ec,_0x173553){_0x5838ec=_0x5838ec-0x0;var _0x178dbb=_0xae70[_0x5838ec];return _0x178dbb;};'use strict';var client=require(_0x0ae7('0x0'));exports[_0x0ae7('0x1')]=function(_0x14ec2f){return client[_0x0ae7('0x2')](_0x0ae7('0x3'),{'body':_0x14ec2f,'log':_0x0ae7('0x3')});};exports[_0x0ae7('0x4')]=function(_0x3a3384,_0x21317a){return client[_0x0ae7('0x2')]('UpdateMailQueueReport',{'body':_0x21317a,'options':{'where':{'uniqueid':_0x3a3384},'order':[['id',_0x0ae7('0x5')]],'limit':0x1},'log':_0x0ae7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 8883854..c2bc325 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 _0xad52=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x2dc805,_0x4b1abd){var _0x52616b=function(_0x4496bd){while(--_0x4496bd){_0x2dc805['push'](_0x2dc805['shift']());}};_0x52616b(++_0x4b1abd);}(_0xad52,0x112));var _0x2ad5=function(_0x3d9740,_0x32dd79){_0x3d9740=_0x3d9740-0x0;var _0x58b687=_0xad52[_0x3d9740];return _0x58b687;};'use strict';var client=require(_0x2ad5('0x0'));exports[_0x2ad5('0x1')]=function(_0x512606,_0x1502ff){return client[_0x2ad5('0x2')](_0x2ad5('0x3'),{'body':_0x1502ff,'options':{'where':{'id':_0x512606}},'log':_0x2ad5('0x4')});};exports[_0x2ad5('0x5')]=function(_0x4c821d,_0x36afad){return client[_0x2ad5('0x2')](_0x2ad5('0x6'),{'body':_0x36afad,'options':{'where':{'id':_0x4c821d}},'log':_0x2ad5('0x7')});}; \ No newline at end of file +var _0x08e7=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x5183d8,_0x13f121){var _0x3e8511=function(_0x574f10){while(--_0x574f10){_0x5183d8['push'](_0x5183d8['shift']());}};_0x3e8511(++_0x13f121);}(_0x08e7,0x9d));var _0x708e=function(_0x473277,_0x2b8712){_0x473277=_0x473277-0x0;var _0xb8b5dc=_0x08e7[_0x473277];return _0xb8b5dc;};'use strict';var client=require(_0x708e('0x0'));exports[_0x708e('0x1')]=function(_0x25f3f0,_0x2b2c1f){return client[_0x708e('0x2')](_0x708e('0x3'),{'body':_0x2b2c1f,'options':{'where':{'id':_0x25f3f0}},'log':_0x708e('0x4')});};exports[_0x708e('0x5')]=function(_0xf91c7a,_0x496c20){return client[_0x708e('0x2')](_0x708e('0x6'),{'body':_0x496c20,'options':{'where':{'id':_0xf91c7a}},'log':_0x708e('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 82f02da..6358af6 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x4dcac4,_0x10e48a){var _0x2a238d=function(_0x25c6fc){while(--_0x25c6fc){_0x4dcac4['push'](_0x4dcac4['shift']());}};_0x2a238d(++_0x10e48a);}(_0x70e0,0x17b));var _0x070e=function(_0x672da9,_0x240f56){_0x672da9=_0x672da9-0x0;var _0x5ea88e=_0x70e0[_0x672da9];return _0x5ea88e;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file +var _0x153f=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x153f,0x15b));var _0xf153=function(_0x5ee1b4,_0x3b51e1){_0x5ee1b4=_0x5ee1b4-0x0;var _0x9bde06=_0x153f[_0x5ee1b4];return _0x9bde06;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return client[_0xf153('0x2')](_0xf153('0x3'),{'body':_0xde7eae,'log':_0xf153('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f602e35..aa01c05 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 _0xc91b=['online','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','User','Agents'];(function(_0x53199f,_0x1dac3a){var _0x1f9609=function(_0x452065){while(--_0x452065){_0x53199f['push'](_0x53199f['shift']());}};_0x1f9609(++_0x1dac3a);}(_0xc91b,0x159));var _0xbc91=function(_0x5a8969,_0x3ce5a3){_0x5a8969=_0x5a8969-0x0;var _0xc136b5=_0xc91b[_0x5a8969];return _0xc136b5;};'use strict';var client=require(_0xbc91('0x0'));exports[_0xbc91('0x1')]=function(){return function(){return client['Request'](_0xbc91('0x2'),{'options':{'raw':![],'attributes':['id',_0xbc91('0x3'),_0xbc91('0x4'),'strategy'],'include':[{'model':_0xbc91('0x5'),'as':_0xbc91('0x6'),'attributes':['id',_0xbc91('0x3'),_0xbc91('0x7'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x35dc=['name','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','Agents'];(function(_0x524dd6,_0x4e5969){var _0x29c3a5=function(_0x5bd0db){while(--_0x5bd0db){_0x524dd6['push'](_0x524dd6['shift']());}};_0x29c3a5(++_0x4e5969);}(_0x35dc,0x160));var _0xc35d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x35dc[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xc35d('0x0')]=function(){return function(){return client[_0xc35d('0x1')](_0xc35d('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xc35d('0x3')],'include':[{'model':'User','as':_0xc35d('0x4'),'attributes':['id',_0xc35d('0x5'),'online',_0xc35d('0x6')]}]},'log':_0xc35d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 58e4a7e..ec932af 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 _0x5daf=['DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x1c4714,_0x227f9e){var _0x330769=function(_0xcd61de){while(--_0xcd61de){_0x1c4714['push'](_0x1c4714['shift']());}};_0x330769(++_0x227f9e);}(_0x5daf,0x19f));var _0xf5da=function(_0x104221,_0x4f159e){_0x104221=_0x104221-0x0;var _0xab1dad=_0x5daf[_0x104221];return _0xab1dad;};'use strict';var client=require(_0xf5da('0x0'));exports[_0xf5da('0x1')]=function(_0x160237){return client[_0xf5da('0x2')](_0xf5da('0x3'),{'body':_0x160237,'log':'CreateOpenchannelQueueReport'});};exports[_0xf5da('0x4')]=function(_0x69a4e1,_0x566fe6){return client[_0xf5da('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x566fe6,'options':{'where':{'uniqueid':_0x69a4e1},'order':[['id',_0xf5da('0x5')]],'limit':0x1},'log':_0xf5da('0x6')});}; \ No newline at end of file +var _0x6bee=['update','Request','UpdateOpenchannelQueueReport','../client'];(function(_0x28b930,_0x19b05f){var _0x112256=function(_0x3b3f61){while(--_0x3b3f61){_0x28b930['push'](_0x28b930['shift']());}};_0x112256(++_0x19b05f);}(_0x6bee,0x167));var _0xe6be=function(_0x56555d,_0x1629ca){_0x56555d=_0x56555d-0x0;var _0x25d1f7=_0x6bee[_0x56555d];return _0x25d1f7;};'use strict';var client=require(_0xe6be('0x0'));exports['create']=function(_0x2f4763){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x2f4763,'log':'CreateOpenchannelQueueReport'});};exports[_0xe6be('0x1')]=function(_0x53740b,_0x1fa741){return client[_0xe6be('0x2')](_0xe6be('0x3'),{'body':_0x1fa741,'options':{'where':{'uniqueid':_0x53740b},'order':[['id','DESC']],'limit':0x1},'log':_0xe6be('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b61b9bd..3e77618 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 _0x86ea=['addTags','addTagsToSmsInteraction','../client','UpdateSmsInteraction'];(function(_0xbae9f1,_0x58c958){var _0x1e35f8=function(_0x47a417){while(--_0x47a417){_0xbae9f1['push'](_0xbae9f1['shift']());}};_0x1e35f8(++_0x58c958);}(_0x86ea,0x86));var _0xa86e=function(_0x4037a5,_0x5ac68d){_0x4037a5=_0x4037a5-0x0;var _0x525c2d=_0x86ea[_0x4037a5];return _0x525c2d;};'use strict';var client=require(_0xa86e('0x0'));exports['update']=function(_0x4ad0e4,_0x7b0b4e){return client['Request'](_0xa86e('0x1'),{'body':_0x7b0b4e,'options':{'where':{'id':_0x4ad0e4}},'log':'updateSmsInteraction'});};exports[_0xa86e('0x2')]=function(_0x302e5b,_0x2f400c){return client['Request']('AddTagsToSmsInteraction',{'body':_0x2f400c,'options':{'where':{'id':_0x302e5b}},'log':_0xa86e('0x3')});}; \ No newline at end of file +var _0xb722=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','addTags'];(function(_0x2f0c93,_0x22f5c7){var _0x38c9f2=function(_0x49b4bf){while(--_0x49b4bf){_0x2f0c93['push'](_0x2f0c93['shift']());}};_0x38c9f2(++_0x22f5c7);}(_0xb722,0xb0));var _0x2b72=function(_0x25c076,_0xceb256){_0x25c076=_0x25c076-0x0;var _0xdbf536=_0xb722[_0x25c076];return _0xdbf536;};'use strict';var client=require(_0x2b72('0x0'));exports[_0x2b72('0x1')]=function(_0x3a3700,_0x38b235){return client['Request'](_0x2b72('0x2'),{'body':_0x38b235,'options':{'where':{'id':_0x3a3700}},'log':'updateSmsInteraction'});};exports[_0x2b72('0x3')]=function(_0x699b1b,_0x89c377){return client['Request'](_0x2b72('0x4'),{'body':_0x89c377,'options':{'where':{'id':_0x699b1b}},'log':_0x2b72('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3424f40..d848cc4 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 _0x4e8e=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x301b16,_0x1d3fa3){var _0x4569e0=function(_0x39a2e8){while(--_0x39a2e8){_0x301b16['push'](_0x301b16['shift']());}};_0x4569e0(++_0x1d3fa3);}(_0x4e8e,0x95));var _0xe4e8=function(_0x949a7,_0x50a353){_0x949a7=_0x949a7-0x0;var _0x280aef=_0x4e8e[_0x949a7];return _0x280aef;};'use strict';var client=require(_0xe4e8('0x0'));exports[_0xe4e8('0x1')]=function(_0x5d597f){return client['Request'](_0xe4e8('0x2'),{'body':_0x5d597f,'log':_0xe4e8('0x3')});}; \ No newline at end of file +var _0x520c=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x475473,_0x3a362e){var _0x414e5f=function(_0x2ab4ef){while(--_0x2ab4ef){_0x475473['push'](_0x475473['shift']());}};_0x414e5f(++_0x3a362e);}(_0x520c,0x12b));var _0xc520=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x520c[_0x3740fe];return _0x55492b;};'use strict';var client=require(_0xc520('0x0'));exports[_0xc520('0x1')]=function(_0x52187b){return client[_0xc520('0x2')](_0xc520('0x3'),{'body':_0x52187b,'log':_0xc520('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index dc08eed..d4b2d68 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 _0xd86a=['name','online','smsPause','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x37bc2a,_0x11ead1){var _0x7b52d8=function(_0x385fa1){while(--_0x385fa1){_0x37bc2a['push'](_0x37bc2a['shift']());}};_0x7b52d8(++_0x11ead1);}(_0xd86a,0xf3));var _0xad86=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0xd86a[_0x51ab83];return _0x14b6de;};'use strict';var client=require(_0xad86('0x0'));exports[_0xad86('0x1')]=function(){return function(){return client[_0xad86('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0xad86('0x3'),_0xad86('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xad86('0x5'),_0xad86('0x6'),_0xad86('0x7')]}]},'log':_0xad86('0x1')});};}; \ No newline at end of file +var _0x6500=['getSmsQueues','Request','GetSmsQueue','timeout','strategy','User','Agents','name','smsPause'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x6500,0x13b));var _0x0650=function(_0xb3aeef,_0x68385a){_0xb3aeef=_0xb3aeef-0x0;var _0x5cf32f=_0x6500[_0xb3aeef];return _0x5cf32f;};'use strict';var client=require('../client');exports[_0x0650('0x0')]=function(){return function(){return client[_0x0650('0x1')](_0x0650('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0650('0x3'),_0x0650('0x4')],'include':[{'model':_0x0650('0x5'),'as':_0x0650('0x6'),'attributes':['id',_0x0650('0x7'),'online',_0x0650('0x8')]}]},'log':_0x0650('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 016ca6c..4b8f3ec 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 _0x6da1=['create','Request','CreateSmsQueueReport','UpdateSmsQueueReport','DESC'];(function(_0x46b0ba,_0x5a767c){var _0x2e53e0=function(_0x124fb2){while(--_0x124fb2){_0x46b0ba['push'](_0x46b0ba['shift']());}};_0x2e53e0(++_0x5a767c);}(_0x6da1,0x1b8));var _0x16da=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x6da1[_0x10b48a];return _0x2c4533;};'use strict';var client=require('../client');exports[_0x16da('0x0')]=function(_0x527a2f){return client[_0x16da('0x1')](_0x16da('0x2'),{'body':_0x527a2f,'log':_0x16da('0x2')});};exports['update']=function(_0xaf731c,_0x2a27dc){return client['Request'](_0x16da('0x3'),{'body':_0x2a27dc,'options':{'where':{'uniqueid':_0xaf731c},'order':[['id',_0x16da('0x4')]],'limit':0x1},'log':_0x16da('0x3')});}; \ No newline at end of file +var _0xe62d=['update','UpdateSmsQueueReport','create','Request','CreateSmsQueueReport'];(function(_0x457f47,_0x22dc6c){var _0x43e1ca=function(_0x5be873){while(--_0x5be873){_0x457f47['push'](_0x457f47['shift']());}};_0x43e1ca(++_0x22dc6c);}(_0xe62d,0xb6));var _0xde62=function(_0x32a548,_0x2cbe5a){_0x32a548=_0x32a548-0x0;var _0x2a7d54=_0xe62d[_0x32a548];return _0x2a7d54;};'use strict';var client=require('../client');exports[_0xde62('0x0')]=function(_0x50891b){return client[_0xde62('0x1')](_0xde62('0x2'),{'body':_0x50891b,'log':_0xde62('0x2')});};exports[_0xde62('0x3')]=function(_0x5db76c,_0x2134c5){return client['Request'](_0xde62('0x4'),{'body':_0x2134c5,'options':{'where':{'uniqueid':_0x5db76c},'order':[['id','DESC']],'limit':0x1},'log':_0xde62('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ee440da..a7f9eca 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 _0xb596=['chatCapacity','mailCapacity','faxCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','mailPause','faxPause','smsPause'];(function(_0x5321ed,_0x26506f){var _0x3d75d3=function(_0x3c9c20){while(--_0x3c9c20){_0x5321ed['push'](_0x5321ed['shift']());}};_0x3d75d3(++_0x26506f);}(_0xb596,0x1cf));var _0x6b59=function(_0x3e63cb,_0x425af8){_0x3e63cb=_0x3e63cb-0x0;var _0x14c8a4=_0xb596[_0x3e63cb];return _0x14c8a4;};'use strict';var client=require(_0x6b59('0x0'));exports[_0x6b59('0x1')]=function(){return function(){return client[_0x6b59('0x2')](_0x6b59('0x3'),{'options':{'raw':!![],'where':{'role':_0x6b59('0x4')},'attributes':['id',_0x6b59('0x5'),_0x6b59('0x6'),_0x6b59('0x7'),_0x6b59('0x8'),_0x6b59('0x9'),'chatPause',_0x6b59('0xa'),_0x6b59('0xb'),_0x6b59('0xc'),'openchannelPause',_0x6b59('0xd'),_0x6b59('0xe'),_0x6b59('0xf'),'smsCapacity',_0x6b59('0x10')]},'log':_0x6b59('0x1')});};}; \ No newline at end of file +var _0x0fbf=['agent','name','online','lastPauseAt','voicePause','mailPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','getAgents','Request','GetUser'];(function(_0x449e84,_0x505ae7){var _0x72d311=function(_0x56e67f){while(--_0x56e67f){_0x449e84['push'](_0x449e84['shift']());}};_0x72d311(++_0x505ae7);}(_0x0fbf,0x116));var _0xf0fb=function(_0x2d56a8,_0x11656c){_0x2d56a8=_0x2d56a8-0x0;var _0x384465=_0x0fbf[_0x2d56a8];return _0x384465;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0xf0fb('0x0')](_0xf0fb('0x1'),{'options':{'raw':!![],'where':{'role':_0xf0fb('0x2')},'attributes':['id',_0xf0fb('0x3'),_0xf0fb('0x4'),'pauseType',_0xf0fb('0x5'),_0xf0fb('0x6'),'chatPause',_0xf0fb('0x7'),'faxPause',_0xf0fb('0x8'),_0xf0fb('0x9'),_0xf0fb('0xa'),_0xf0fb('0xb'),_0xf0fb('0xc'),'smsCapacity','openchannelCapacity']},'log':_0xf0fb('0xd')});};}; \ 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 c5aaf99..148dad0 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 _0x3a76=['length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','atimeout','rules','end','close','next','agent','log','[%s][QUEUE]\x20%s','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','name','toLowerCase','consequence'];(function(_0x4f353f,_0x3dcba1){var _0xeb0e1f=function(_0x21fb55){while(--_0x21fb55){_0x4f353f['push'](_0x4f353f['shift']());}};_0xeb0e1f(++_0x3dcba1);}(_0x3a76,0x1b5));var _0x63a7=function(_0x23b55c,_0x2fd9b2){_0x23b55c=_0x23b55c-0x0;var _0x763181=_0x3a76[_0x23b55c];return _0x763181;};'use strict';var schema=require(_0x63a7('0x0'));var _=require(_0x63a7('0x1'));var util=require(_0x63a7('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x63a7('0x3'))(_0x63a7('0x4'));var strategy=require(_0x63a7('0x5'));var queue=schema({'name':{'type':_0x63a7('0x6'),'required':!![],'message':_0x63a7('0x7')},'timeout':{'type':_0x63a7('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x1ad5fa,_0x5dd90a,_0x8d7aa3){return logger['info'](util[_0x63a7('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1ad5fa,_0x5dd90a[_0x63a7('0xa')],_0x8d7aa3));}function handleFindAgent(_0x39e340){return function(_0x8c0888){return _0x8c0888[_0x63a7('0xa')][_0x63a7('0xb')]()===_0x39e340[_0x63a7('0xb')]();};}exports[_0x63a7('0xc')]=function(_0x29dba6,_0x5d09be,_0x5129ff,_0x5698ee){return function(_0x21eaf5){try{var _0x25e39b={'name':_0x5d09be[0x0],'timeout':_0x5d09be[0x1]};var _0x2bba10=queue[_0x63a7('0x0')](_0x25e39b,{'typecast':!![]});if(_0x2bba10[_0x63a7('0xd')]){logger[_0x63a7('0xe')](_0x63a7('0xf'),_0x29dba6,_['map'](_0x2bba10,_0x63a7('0x10'))[_0x63a7('0x11')](',\x20'));_0x21eaf5[_0x63a7('0x12')]();}else{var _0x2cbe6d=_[_0x63a7('0x13')](_0x5129ff[_0x63a7('0x14')],handleFindAgent(_0x25e39b[_0x63a7('0xa')]));if(_0x2cbe6d){var _0x5664be=(_0x25e39b[_0x63a7('0x15')]||0xa)*0x3e8;var _0x5b7399,_0x8c5cfb;var _0x5db4d3=seqqueue['createQueue'](_0x5664be);_0x5db4d3['id']=_0x29dba6;_0x5db4d3[_0x63a7('0x16')]=_0x5664be;_0x5db4d3['channel']=_0x5698ee['channel'];writeLog(_0x29dba6,_0x2cbe6d,util[_0x63a7('0x9')]('START:%s',_0x5664be));_0x5129ff[_0x63a7('0x17')][_0x29dba6]['on'](_0x63a7('0x18'),function(){_0x5db4d3[_0x63a7('0x19')]();clearTimeout(_0x8c5cfb);_0x8c5cfb=undefined;if(_0x5129ff[_0x63a7('0x17')][_0x29dba6]){delete _0x5129ff['rules'][_0x29dba6];}logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x29dba6);_0x21eaf5[_0x63a7('0x12')]();});_0x8c5cfb=setTimeout(function(){clearTimeout(_0x8c5cfb);_0x5db4d3['close']();logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x29dba6);_0x21eaf5[_0x63a7('0x1a')]();},_0x5664be);strategy[_0x63a7('0x1b')](_0x5db4d3,_0x2cbe6d,_0x5129ff,_0x5698ee);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x29dba6,_0x25e39b[_0x63a7('0xa')]);_0x21eaf5['stop']();}}}catch(_0x3be7ff){console[_0x63a7('0x1c')](_0x3be7ff);logger[_0x63a7('0xe')](_0x63a7('0x1d'),_0x29dba6,_0x3be7ff['stack']);_0x21eaf5[_0x63a7('0x12')]();}};}; \ No newline at end of file +var _0x6fc4=['[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','message','join','find','timeout','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop'];(function(_0x3ea1aa,_0x50263e){var _0x2d74a0=function(_0x4d66dd){while(--_0x4d66dd){_0x3ea1aa['push'](_0x3ea1aa['shift']());}};_0x2d74a0(++_0x50263e);}(_0x6fc4,0x14b));var _0x46fc=function(_0x1d7218,_0x34cc1a){_0x1d7218=_0x1d7218-0x0;var _0x253cd7=_0x6fc4[_0x1d7218];return _0x253cd7;};'use strict';var schema=require('validate');var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x46fc('0x2'))(_0x46fc('0x3'));var strategy=require(_0x46fc('0x4'));var queue=schema({'name':{'type':_0x46fc('0x5'),'required':!![],'message':_0x46fc('0x6')},'timeout':{'type':_0x46fc('0x7'),'message':_0x46fc('0x8')}});function writeLog(_0x1256a3,_0x3bbbba,_0x27feed){return logger[_0x46fc('0x9')](util[_0x46fc('0xa')](_0x46fc('0xb'),_0x1256a3,_0x3bbbba[_0x46fc('0xc')],_0x27feed));}function handleFindAgent(_0x454311){return function(_0x14cd62){return _0x14cd62[_0x46fc('0xc')][_0x46fc('0xd')]()===_0x454311[_0x46fc('0xd')]();};}exports[_0x46fc('0xe')]=function(_0x1f0509,_0x410666,_0x4d3b17,_0x24835c){return function(_0x1f2491){try{var _0x36813b={'name':_0x410666[0x0],'timeout':_0x410666[0x1]};var _0x3107ab=queue[_0x46fc('0xf')](_0x36813b,{'typecast':!![]});if(_0x3107ab[_0x46fc('0x10')]){logger['error'](_0x46fc('0x11'),_0x1f0509,_['map'](_0x3107ab,_0x46fc('0x12'))[_0x46fc('0x13')](',\x20'));_0x1f2491['stop']();}else{var _0x1fc893=_[_0x46fc('0x14')](_0x4d3b17['agents'],handleFindAgent(_0x36813b[_0x46fc('0xc')]));if(_0x1fc893){var _0x6c76a5=(_0x36813b[_0x46fc('0x15')]||0xa)*0x3e8;var _0x124455,_0xbc8942;var _0x338da1=seqqueue[_0x46fc('0x16')](_0x6c76a5);_0x338da1['id']=_0x1f0509;_0x338da1[_0x46fc('0x17')]=_0x6c76a5;_0x338da1['channel']=_0x24835c[_0x46fc('0x18')];writeLog(_0x1f0509,_0x1fc893,util[_0x46fc('0xa')](_0x46fc('0x19'),_0x6c76a5));_0x4d3b17['rules'][_0x1f0509]['on'](_0x46fc('0x1a'),function(){_0x338da1['close']();clearTimeout(_0xbc8942);_0xbc8942=undefined;if(_0x4d3b17['rules'][_0x1f0509]){delete _0x4d3b17['rules'][_0x1f0509];}logger[_0x46fc('0x9')](_0x46fc('0x1b'),_0x1f0509);_0x1f2491[_0x46fc('0x1c')]();});_0xbc8942=setTimeout(function(){clearTimeout(_0xbc8942);_0x338da1['close']();logger[_0x46fc('0x9')](_0x46fc('0x1d'),_0x1f0509);_0x1f2491[_0x46fc('0x1e')]();},_0x6c76a5);strategy[_0x46fc('0x1f')](_0x338da1,_0x1fc893,_0x4d3b17,_0x24835c);}else{logger[_0x46fc('0x20')](_0x46fc('0x21'),_0x1f0509,_0x36813b['name']);_0x1f2491[_0x46fc('0x1c')]();}}}catch(_0x46dda0){console['log'](_0x46dda0);logger[_0x46fc('0x20')](_0x46fc('0x22'),_0x1f0509,_0x46dda0[_0x46fc('0x23')]);_0x1f2491['stop']();}};}; \ 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 49e02e5..6ca2251 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 _0x12e7=['consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','AccountId','account','upperFirst','InteractionId','created','getMustacheRender','Message','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','create','dialogState','Failed','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x12e7,0x9a));var _0x712e=function(_0xa8606,_0x4c6f10){_0xa8606=_0xa8606-0x0;var _0x88600e=_0x12e7[_0xa8606];return _0x88600e;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x712e('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x712e('0x1'));var rpc={'chatMessage':require(_0x712e('0x2')),'openchannelMessage':require(_0x712e('0x3')),'mailMessage':require(_0x712e('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x712e('0x5'))};exports[_0x712e('0x6')]=function(_0x1a186b,_0x187c84){return function(_0x55ff76){try{if(!_[_0x712e('0x7')](this[_0x712e('0x8')]['UserId'])){logger[_0x712e('0x9')](_0x712e('0xa'),_0x1a186b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x55ff76[_0x712e('0xb')]();}var _0x3e42bf={'ContactId':this['contact']['id'],'sentAt':moment()[_0x712e('0xc')](_0x712e('0xd')),'direction':'out'};var _0x2c5e51=this[_0x712e('0xe')];if(_0x2c5e51===_0x712e('0xf')){_0x3e42bf['ChatWebsiteId']=this['account']['id'];}else{_0x3e42bf[_['upperFirst'](_0x2c5e51)+_0x712e('0x10')]=this[_0x712e('0x11')]['id'];}_0x3e42bf[_[_0x712e('0x12')](_0x2c5e51)+_0x712e('0x13')]=this[_0x712e('0x8')]['id'];if(this[_0x712e('0x8')][_0x712e('0x14')]){var _0x1c52af=_0x187c84[0x4];if(!_['isEmpty'](_0x1c52af)){_0x3e42bf['body']=utils[_0x712e('0x15')](_0x1c52af,this);return rpc[_0x2c5e51+_0x712e('0x16')]['create'](_0x3e42bf)[_0x712e('0x17')](function(_0x74e9fe){logger[_0x712e('0x9')](_0x712e('0xa'),_0x1a186b,_0x3e42bf[_0x712e('0x18')]);})[_0x712e('0x19')](function(_0x4371e8){logger[_0x712e('0x1a')](_0x712e('0xa'),_0x1a186b,JSON[_0x712e('0x1b')](_0x4371e8));})[_0x712e('0x1c')](function(){logger['info'](_0x712e('0x1d'),_0x1a186b);_0x55ff76[_0x712e('0x1e')]();});}else{logger[_0x712e('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1a186b);_0x55ff76[_0x712e('0x1e')]();}}else{var _0x1160b7=this;var _0x33e70b=new AWS[(_0x712e('0x1f'))]({'accessKeyId':_0x187c84[0x0],'secretAccessKey':_0x187c84[0x1],'region':_0x187c84[0x2]});var _0x5a9241={'botAlias':_0x712e('0x20'),'botName':_0x187c84[0x3],'inputText':this[_0x712e('0x21')][_0x712e('0x18')],'userId':this[_0x712e('0x8')]['id'][_0x712e('0x22')]()};_0x33e70b[_0x712e('0x23')](_0x5a9241,function(_0x1d2d43,_0x246d37){if(_0x1d2d43){logger[_0x712e('0x1a')](_0x712e('0xa'),_0x1a186b,_0x1d2d43[_0x712e('0x21')]);_0x55ff76[_0x712e('0xb')]();}else if(_0x246d37&&_0x246d37[_0x712e('0x21')]){_0x1160b7[_0x712e('0x18')][_0x712e('0x24')]=_0x246d37;_0x3e42bf[_0x712e('0x18')]=_0x246d37[_0x712e('0x21')];return rpc[_0x2c5e51+'Message'][_0x712e('0x25')](_0x3e42bf)[_0x712e('0x17')](function(_0x54d9ee){logger[_0x712e('0x9')](_0x712e('0xa'),_0x1a186b,_0x3e42bf[_0x712e('0x18')]);if(_0x246d37[_0x712e('0x26')]==_0x712e('0x27')){_0x55ff76['next']();}else{_0x55ff76[_0x712e('0x1e')]();}})[_0x712e('0x19')](function(_0x371b99){logger[_0x712e('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x1a186b,JSON['stringify'](_0x371b99));_0x55ff76[_0x712e('0xb')]();});}else{_0x55ff76[_0x712e('0xb')]();}});}}catch(_0x107fa0){logger['error'](_0x712e('0xa'),_0x1a186b,JSON['stringify'](_0x107fa0));_0x55ff76[_0x712e('0x1e')]();}};}; \ No newline at end of file +var _0x7115=['[%s][AMAZONLEX]\x20%s','contact','out','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','getMustacheRender','Message','then','body','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','next','amazonlex','create','error','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/smsMessage','isNil','interaction','UserId','info'];(function(_0xaa715b,_0x2981df){var _0x568a0b=function(_0x42004b){while(--_0x42004b){_0xaa715b['push'](_0xaa715b['shift']());}};_0x568a0b(++_0x2981df);}(_0x7115,0x6b));var _0x5711=function(_0xbb1c05,_0x3cf238){_0xbb1c05=_0xbb1c05-0x0;var _0x509840=_0x7115[_0xbb1c05];return _0x509840;};'use strict';var _=require(_0x5711('0x0'));var moment=require(_0x5711('0x1'));var AWS=require('aws-sdk');var utils=require(_0x5711('0x2'));var logger=require(_0x5711('0x3'))(_0x5711('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5711('0x5')),'faxMessage':require('../../rpc/faxMessage')};exports['consequence']=function(_0x1e9b73,_0x1d723d){return function(_0x5bb92f){try{if(!_[_0x5711('0x6')](this[_0x5711('0x7')][_0x5711('0x8')])){logger[_0x5711('0x9')](_0x5711('0xa'),_0x1e9b73,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5bb92f['next']();}var _0x533c80={'ContactId':this[_0x5711('0xb')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5711('0xc')};var _0x3a1ac1=this[_0x5711('0xd')];if(_0x3a1ac1===_0x5711('0xe')){_0x533c80[_0x5711('0xf')]=this[_0x5711('0x10')]['id'];}else{_0x533c80[_['upperFirst'](_0x3a1ac1)+_0x5711('0x11')]=this[_0x5711('0x10')]['id'];}_0x533c80[_[_0x5711('0x12')](_0x3a1ac1)+_0x5711('0x13')]=this['interaction']['id'];if(this[_0x5711('0x7')][_0x5711('0x14')]){var _0x2c7c79=_0x1d723d[0x4];if(!_['isEmpty'](_0x2c7c79)){_0x533c80['body']=utils[_0x5711('0x15')](_0x2c7c79,this);return rpc[_0x3a1ac1+_0x5711('0x16')]['create'](_0x533c80)[_0x5711('0x17')](function(_0x503adb){logger[_0x5711('0x9')](_0x5711('0xa'),_0x1e9b73,_0x533c80[_0x5711('0x18')]);})[_0x5711('0x19')](function(_0x46dc19){logger['error'](_0x5711('0xa'),_0x1e9b73,JSON[_0x5711('0x1a')](_0x46dc19));})[_0x5711('0x1b')](function(){logger[_0x5711('0x9')](_0x5711('0x1c'),_0x1e9b73);_0x5bb92f[_0x5711('0x1d')]();});}else{logger[_0x5711('0x9')](_0x5711('0x1e'),_0x1e9b73);_0x5bb92f[_0x5711('0x1d')]();}}else{var _0x806065=this;var _0x2e52f9=new AWS['LexRuntime']({'accessKeyId':_0x1d723d[0x0],'secretAccessKey':_0x1d723d[0x1],'region':_0x1d723d[0x2]});var _0x3ed6c9={'botAlias':_0x5711('0x1f'),'botName':_0x1d723d[0x3],'inputText':this[_0x5711('0x20')][_0x5711('0x18')],'userId':this[_0x5711('0x7')]['id'][_0x5711('0x21')]()};_0x2e52f9[_0x5711('0x22')](_0x3ed6c9,function(_0x4abfdc,_0x2630e7){if(_0x4abfdc){logger['error'](_0x5711('0xa'),_0x1e9b73,_0x4abfdc['message']);_0x5bb92f[_0x5711('0x23')]();}else if(_0x2630e7&&_0x2630e7['message']){_0x806065[_0x5711('0x18')][_0x5711('0x24')]=_0x2630e7;_0x533c80[_0x5711('0x18')]=_0x2630e7['message'];return rpc[_0x3a1ac1+'Message'][_0x5711('0x25')](_0x533c80)[_0x5711('0x17')](function(_0x4e18e9){logger[_0x5711('0x9')](_0x5711('0xa'),_0x1e9b73,_0x533c80['body']);if(_0x2630e7['dialogState']=='Failed'){_0x5bb92f[_0x5711('0x23')]();}else{_0x5bb92f[_0x5711('0x1d')]();}})[_0x5711('0x19')](function(_0x37c11c){logger[_0x5711('0x26')](_0x5711('0xa'),_0x1e9b73,JSON['stringify'](_0x37c11c));_0x5bb92f[_0x5711('0x23')]();});}else{_0x5bb92f[_0x5711('0x23')]();}});}}catch(_0x3ef3f7){logger[_0x5711('0x26')](_0x5711('0xa'),_0x1e9b73,JSON['stringify'](_0x3ef3f7));_0x5bb92f[_0x5711('0x1d')]();}};}; \ 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 e6fe6d0..c06f9c0 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 _0xa9e0=['messageId','html','replace','body',''+_[_0x0a9e('0x29')](_0xbd1168[_0x0a9e('0x2a')],_0x0a9e('0x2b'),_0x0a9e('0x2c'))+'';return mailRpc[_0x0a9e('0x2d')](_0x20f109,_0xbd1168)[_0x0a9e('0x2e')](function(_0x1843b2){logger[_0x0a9e('0x2f')](_0x0a9e('0x30'),_0x57b080);_0xbd1168[_0x0a9e('0x27')]=_0x1843b2[_0x0a9e('0x10')][_0x0a9e('0x27')];return rpc[_0x3ab53f+_0x0a9e('0x1d')]['create'](_0xbd1168);})[_0x0a9e('0x2e')](function(_0x5d1e0e){logger[_0x0a9e('0x2f')](_0x0a9e('0xb'),_0x57b080,JSON[_0x0a9e('0x31')](_0x5d1e0e));})[_0x0a9e('0x32')](function(_0x25ce3a){logger['error'](_0x0a9e('0x33'),_0x57b080,JSON[_0x0a9e('0x31')](_0x25ce3a));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}else{return rpc[this[_0x0a9e('0xe')]+_0x0a9e('0x1d')][_0x0a9e('0x35')](_0xbd1168)[_0x0a9e('0x2e')](function(_0x5583a4){logger[_0x0a9e('0x2f')]('[%s][AUTOREPLY]\x20%s',_0x57b080,_0xbd1168[_0x0a9e('0x2a')]);})[_0x0a9e('0x32')](function(_0x2b7e7f){logger[_0x0a9e('0x36')]('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x2b7e7f));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}}}catch(_0x15de0e){logger['error']('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x15de0e));_0x441e3a['stop']();}};}; \ No newline at end of file +var _0xcb91=['consequence','interaction','created','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','Re:','Re:\x20','account','upperFirst','AccountId','mail','Smtp','service','port','secure','authentication','auth','user','pass','inReplyTo','messageId','','body','','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../mailRpc'];(function(_0x47e3f8,_0x517bcd){var _0x4742d5=function(_0x2a4f20){while(--_0x2a4f20){_0x47e3f8['push'](_0x47e3f8['shift']());}};_0x4742d5(++_0x517bcd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xcb91[_0x587ba2];return _0x50ec73;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x1cb9('0x0'));var logger=require(_0x1cb9('0x1'))(_0x1cb9('0x2'));var rpc={'chatMessage':require(_0x1cb9('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1cb9('0x4')),'smsMessage':require(_0x1cb9('0x5')),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x1cb9('0x6'));exports[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return function(_0x3f7deb){try{if(_0x226b69[0x0]==='1'&&(_['isNil'](this[_0x1cb9('0x8')][_0x1cb9('0x9')])||!this['interaction'][_0x1cb9('0x9')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x53ffbd,_0x1cb9('0xa'));return _0x3f7deb[_0x1cb9('0xb')]();}var _0x74ce19=this[_0x1cb9('0xc')];var _0x2fc627={'body':utils['getMustacheRender'](_0x226b69[0x1],this),'ContactId':this[_0x1cb9('0xd')]['id'],'sentAt':moment()[_0x1cb9('0xe')](_0x1cb9('0xf')),'direction':_0x1cb9('0x10')};if(this[_0x1cb9('0x11')]){_0x2fc627['to']=this['message']['from']||'';_0x2fc627['cc']=this['message']['cc']||'';_0x2fc627[_0x1cb9('0x12')]=this[_0x1cb9('0x11')]['to']||'';_0x2fc627[_0x1cb9('0x13')]=this[_0x1cb9('0x11')]['phone']||'';_0x2fc627[_0x1cb9('0x14')]=!![];if(this[_0x1cb9('0x11')][_0x1cb9('0x15')]){_0x2fc627[_0x1cb9('0x15')]='';_0x2fc627[_0x1cb9('0x15')]+=_['startsWith'](this['message'][_0x1cb9('0x15')],_0x1cb9('0x16'))?'':_0x1cb9('0x17');_0x2fc627[_0x1cb9('0x15')]+=this[_0x1cb9('0x11')][_0x1cb9('0x15')];}}if(this[_0x1cb9('0xc')]==='chat'){_0x2fc627['ChatWebsiteId']=this[_0x1cb9('0x18')]['id'];}else{_0x2fc627[_[_0x1cb9('0x19')](this[_0x1cb9('0xc')])+_0x1cb9('0x1a')]=this[_0x1cb9('0x18')]['id'];}_0x2fc627[_[_0x1cb9('0x19')](this[_0x1cb9('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x1cb9('0xc')]+'Message']){if(this[_0x1cb9('0xc')]===_0x1cb9('0x1b')){var _0x523b26={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x1cb9('0x1c')][_0x1cb9('0x1d')]){_0x523b26[_0x1cb9('0x1d')]=this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x1d')];}else{_0x523b26['host']=this['account'][_0x1cb9('0x1c')]['host'];_0x523b26[_0x1cb9('0x1e')]=this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x1e')];_0x523b26[_0x1cb9('0x1f')]=this['account'][_0x1cb9('0x1c')][_0x1cb9('0x1f')];}if(this['account'][_0x1cb9('0x1c')][_0x1cb9('0x20')]){_0x523b26[_0x1cb9('0x21')]={'user':this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x22')],'pass':this[_0x1cb9('0x18')][_0x1cb9('0x1c')][_0x1cb9('0x23')]};}_0x2fc627[_0x1cb9('0x24')]=this['message'][_0x1cb9('0x25')];_0x2fc627['html']=_0x1cb9('0x26')+_['replace'](_0x2fc627[_0x1cb9('0x27')],_0x1cb9('0x28'),_0x1cb9('0x29'))+_0x1cb9('0x2a');return mailRpc['sendMailMessage'](_0x523b26,_0x2fc627)[_0x1cb9('0x2b')](function(_0x4eba82){logger[_0x1cb9('0x2c')](_0x1cb9('0x2d'),_0x53ffbd);_0x2fc627[_0x1cb9('0x25')]=_0x4eba82['message'][_0x1cb9('0x25')];return rpc[_0x74ce19+'Message'][_0x1cb9('0x2e')](_0x2fc627);})['then'](function(_0x2164e3){logger[_0x1cb9('0x2c')](_0x1cb9('0x2f'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x2164e3));})['catch'](function(_0x2114a4){logger[_0x1cb9('0x31')](_0x1cb9('0x32'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x2114a4));})[_0x1cb9('0x33')](function(){_0x3f7deb[_0x1cb9('0xb')]();});}else{return rpc[this[_0x1cb9('0xc')]+_0x1cb9('0x34')][_0x1cb9('0x2e')](_0x2fc627)[_0x1cb9('0x2b')](function(_0x294eec){logger[_0x1cb9('0x2c')](_0x1cb9('0x2f'),_0x53ffbd,_0x2fc627['body']);})['catch'](function(_0x299ff8){logger[_0x1cb9('0x31')](_0x1cb9('0x2f'),_0x53ffbd,JSON[_0x1cb9('0x30')](_0x299ff8));})[_0x1cb9('0x33')](function(){_0x3f7deb[_0x1cb9('0xb')]();});}}}catch(_0x35f5e8){logger[_0x1cb9('0x31')]('[%s][AUTOREPLY]\x20%s',_0x53ffbd,JSON[_0x1cb9('0x30')](_0x35f5e8));_0x3f7deb[_0x1cb9('0x35')]();}};}; \ 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 d5af54d..5e42165 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 _0x902b=['channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','system'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x902b,0x6a));var _0xb902=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x902b[_0x525c7b];return _0x27b33e;};'use strict';var moment=require(_0xb902('0x0'));var logger=require('../../../../config/logger')(_0xb902('0x1'));var rpc={'chatInteraction':require(_0xb902('0x2')),'openchannelInteraction':require(_0xb902('0x3')),'smsInteraction':require(_0xb902('0x4')),'mailInteraction':require(_0xb902('0x5')),'faxInteraction':require(_0xb902('0x6'))};exports['consequence']=function(_0x1af7b5,_0x49e5af,_0x98a793,_0x5d38bb){return function(_0x157e14){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x1af7b5,_0x49e5af[0x0]);var _0x5b0b74={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xb902('0x7'),'disposition':_0x49e5af[0x0]};if(rpc[_0x5d38bb[_0xb902('0x8')]+'Interaction']){rpc[_0x5d38bb['channel']+_0xb902('0x9')][_0xb902('0xa')](_0x5d38bb[_0xb902('0xb')]['id'],_0x5b0b74)[_0xb902('0xc')](function(_0x35110c){logger[_0xb902('0xd')](_0xb902('0xe'),_0x1af7b5,_0x5d38bb[_0xb902('0xb')]['id']);})['catch'](function(_0x34c8a4){logger[_0xb902('0xf')](_0xb902('0x10'),_0x1af7b5,JSON[_0xb902('0x11')](_0x34c8a4));})['finally'](function(){_0x157e14['stop']();});}}catch(_0xe413ef){logger[_0xb902('0xf')]('[%s][CLOSE]\x20%s',_0x1af7b5,JSON[_0xb902('0x11')](_0xe413ef));_0x157e14[_0xb902('0x12')]();}};}; \ No newline at end of file +var _0xe890=['finally','stop','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x2f6c1e,_0x1e1647){var _0xa2983e=function(_0x3d7e8e){while(--_0x3d7e8e){_0x2f6c1e['push'](_0x2f6c1e['shift']());}};_0xa2983e(++_0x1e1647);}(_0xe890,0x1a6));var _0x0e89=function(_0x2a8cab,_0x12867e){_0x2a8cab=_0x2a8cab-0x0;var _0x11fe4a=_0xe890[_0x2a8cab];return _0x11fe4a;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x0e89('0x0'));var rpc={'chatInteraction':require(_0x0e89('0x1')),'openchannelInteraction':require(_0x0e89('0x2')),'smsInteraction':require(_0x0e89('0x3')),'mailInteraction':require(_0x0e89('0x4')),'faxInteraction':require(_0x0e89('0x5'))};exports[_0x0e89('0x6')]=function(_0xe3f350,_0x36f6f0,_0x361901,_0x563a51){return function(_0x58f553){try{logger[_0x0e89('0x7')](_0x0e89('0x8'),_0xe3f350,_0x36f6f0[0x0]);var _0x50f325={'closed':0x1,'closedAt':moment()[_0x0e89('0x9')](_0x0e89('0xa')),'closeReason':'system','disposition':_0x36f6f0[0x0]};if(rpc[_0x563a51[_0x0e89('0xb')]+_0x0e89('0xc')]){rpc[_0x563a51[_0x0e89('0xb')]+_0x0e89('0xc')][_0x0e89('0xd')](_0x563a51[_0x0e89('0xe')]['id'],_0x50f325)[_0x0e89('0xf')](function(_0x45ef1b){logger[_0x0e89('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xe3f350,_0x563a51['interaction']['id']);})['catch'](function(_0x4bea36){logger[_0x0e89('0x10')](_0x0e89('0x11'),_0xe3f350,JSON[_0x0e89('0x12')](_0x4bea36));})[_0x0e89('0x13')](function(){_0x58f553['stop']();});}}catch(_0x53014b){logger['error'](_0x0e89('0x11'),_0xe3f350,JSON[_0x0e89('0x12')](_0x53014b));_0x58f553[_0x0e89('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 80e901e..b787ee4 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 _0xa680=['format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','upperFirst','created','isEmpty','body','getMustacheRender','Message','catch','error','[%s][DIALOGFLOW]\x20%s','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','create','then','metadata','endConversation','stringify','next','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact'];(function(_0x1e90eb,_0x476eb3){var _0x26b8a2=function(_0x72ec1b){while(--_0x72ec1b){_0x1e90eb['push'](_0x1e90eb['shift']());}};_0x26b8a2(++_0x476eb3);}(_0xa680,0xc9));var _0x0a68=function(_0x2e0e3e,_0x54d5a3){_0x2e0e3e=_0x2e0e3e-0x0;var _0x5eaa34=_0xa680[_0x2e0e3e];return _0x5eaa34;};'use strict';var _=require('lodash');var moment=require(_0x0a68('0x0'));var apiai=require('apiai-promise');var md5=require(_0x0a68('0x1'));var utils=require('./utils');var logger=require(_0x0a68('0x2'))(_0x0a68('0x3'));var rpc={'chatMessage':require(_0x0a68('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0a68('0x5')),'smsMessage':require(_0x0a68('0x6')),'faxMessage':require(_0x0a68('0x7'))};exports[_0x0a68('0x8')]=function(_0x133d3b,_0x4d525e){return function(_0x46c685){try{if(!_['isNil'](this[_0x0a68('0x9')][_0x0a68('0xa')])){logger[_0x0a68('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x133d3b,_0x0a68('0xc'));return _0x46c685['next']();}var _0x4d840d={'ContactId':this[_0x0a68('0xd')]['id'],'sentAt':moment()[_0x0a68('0xe')](_0x0a68('0xf')),'direction':_0x0a68('0x10')};var _0x293c47=this['channel'];if(_0x293c47===_0x0a68('0x11')){_0x4d840d[_0x0a68('0x12')]=this['account']['id'];}else{_0x4d840d[_['upperFirst'](_0x293c47)+'AccountId']=this['account']['id'];}_0x4d840d[_[_0x0a68('0x13')](_0x293c47)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x0a68('0x14')]){var _0x51a048=_0x4d525e[0x2];if(!_[_0x0a68('0x15')](_0x51a048)){_0x4d840d[_0x0a68('0x16')]=utils[_0x0a68('0x17')](_0x51a048,this);return rpc[_0x293c47+_0x0a68('0x18')]['create'](_0x4d840d)['then'](function(_0xe3e660){logger[_0x0a68('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x133d3b,_0x4d840d['body']);})[_0x0a68('0x19')](function(_0x3245c1){logger[_0x0a68('0x1a')](_0x0a68('0x1b'),_0x133d3b,JSON['stringify'](_0x3245c1));})[_0x0a68('0x1c')](function(){logger[_0x0a68('0xb')](_0x0a68('0x1d'),_0x133d3b);_0x46c685['stop']();});}else{logger[_0x0a68('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x133d3b);_0x46c685[_0x0a68('0x1e')]();}}else{var _0x54061d=this;var _0x203508=apiai(_0x4d525e[0x0],{'language':_0x4d525e[0x1]||'en'});return _0x203508[_0x0a68('0x1f')](this[_0x0a68('0x20')][_0x0a68('0x16')],{'sessionId':md5(this[_0x0a68('0x9')]['id'])})['then'](function(_0x4d7754){_0x54061d[_0x0a68('0x16')][_0x0a68('0x21')]=_0x4d7754;_0x4d840d['body']=_0x4d7754[_0x0a68('0x22')][_0x0a68('0x23')][_0x0a68('0x24')];return rpc[_0x293c47+_0x0a68('0x18')][_0x0a68('0x25')](_0x4d840d)[_0x0a68('0x26')](function(_0x4e6b65){logger[_0x0a68('0xb')](_0x0a68('0x1b'),_0x133d3b,_0x4d840d[_0x0a68('0x16')]);if(_0x4d7754[_0x0a68('0x22')][_0x0a68('0x27')][_0x0a68('0x28')]){_0x46c685['next']();}else{_0x46c685[_0x0a68('0x1e')]();}})[_0x0a68('0x19')](function(_0x2e7eb0){logger[_0x0a68('0x1a')](_0x0a68('0x1b'),_0x133d3b,JSON[_0x0a68('0x29')](_0x2e7eb0));_0x46c685['next']();});})[_0x0a68('0x19')](function(_0xb3edf0){logger[_0x0a68('0x1a')]('[%s][DIALOGFLOW]\x20%s',_0x133d3b,_0xb3edf0[_0x0a68('0x20')]);_0x46c685[_0x0a68('0x2a')]();});}}catch(_0x44bcd3){logger['error'](_0x0a68('0x1b'),_0x133d3b,JSON[_0x0a68('0x29')](_0x44bcd3));_0x46c685[_0x0a68('0x1e')]();}};}; \ No newline at end of file +var _0x3d44=['textRequest','message','dialogflow','result','fulfillment','speech','Message','create','metadata','endConversation','catch','moment','apiai-promise','md5','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','then','error','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x8720df,_0x3f41ea){var _0x44b435=function(_0x4a5625){while(--_0x4a5625){_0x8720df['push'](_0x8720df['shift']());}};_0x44b435(++_0x3f41ea);}(_0x3d44,0x18b));var _0x43d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3d44[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0x43d4('0x0'));var apiai=require(_0x43d4('0x1'));var md5=require(_0x43d4('0x2'));var utils=require(_0x43d4('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x43d4('0x4')),'openchannelMessage':require(_0x43d4('0x5')),'mailMessage':require(_0x43d4('0x6')),'smsMessage':require(_0x43d4('0x7')),'faxMessage':require('../../rpc/faxMessage')};exports[_0x43d4('0x8')]=function(_0x535a90,_0xb1cfa2){return function(_0x30d856){try{if(!_[_0x43d4('0x9')](this['interaction'][_0x43d4('0xa')])){logger['info'](_0x43d4('0xb'),_0x535a90,_0x43d4('0xc'));return _0x30d856[_0x43d4('0xd')]();}var _0x3b81ba={'ContactId':this[_0x43d4('0xe')]['id'],'sentAt':moment()[_0x43d4('0xf')](_0x43d4('0x10')),'direction':_0x43d4('0x11')};var _0x5d4210=this[_0x43d4('0x12')];if(_0x5d4210===_0x43d4('0x13')){_0x3b81ba[_0x43d4('0x14')]=this[_0x43d4('0x15')]['id'];}else{_0x3b81ba[_[_0x43d4('0x16')](_0x5d4210)+_0x43d4('0x17')]=this[_0x43d4('0x15')]['id'];}_0x3b81ba[_[_0x43d4('0x16')](_0x5d4210)+_0x43d4('0x18')]=this['interaction']['id'];if(this[_0x43d4('0x19')][_0x43d4('0x1a')]){var _0x124e4f=_0xb1cfa2[0x2];if(!_[_0x43d4('0x1b')](_0x124e4f)){_0x3b81ba[_0x43d4('0x1c')]=utils[_0x43d4('0x1d')](_0x124e4f,this);return rpc[_0x5d4210+'Message']['create'](_0x3b81ba)[_0x43d4('0x1e')](function(_0x500e3f){logger['info'](_0x43d4('0xb'),_0x535a90,_0x3b81ba[_0x43d4('0x1c')]);})['catch'](function(_0x472a26){logger[_0x43d4('0x1f')](_0x43d4('0xb'),_0x535a90,JSON[_0x43d4('0x20')](_0x472a26));})[_0x43d4('0x21')](function(){logger[_0x43d4('0x22')](_0x43d4('0x23'),_0x535a90);_0x30d856[_0x43d4('0x24')]();});}else{logger[_0x43d4('0x22')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x535a90);_0x30d856[_0x43d4('0x24')]();}}else{var _0x460b53=this;var _0xe5842e=apiai(_0xb1cfa2[0x0],{'language':_0xb1cfa2[0x1]||'en'});return _0xe5842e[_0x43d4('0x25')](this[_0x43d4('0x26')][_0x43d4('0x1c')],{'sessionId':md5(this[_0x43d4('0x19')]['id'])})[_0x43d4('0x1e')](function(_0xd49a7b){_0x460b53[_0x43d4('0x1c')][_0x43d4('0x27')]=_0xd49a7b;_0x3b81ba[_0x43d4('0x1c')]=_0xd49a7b[_0x43d4('0x28')][_0x43d4('0x29')][_0x43d4('0x2a')];return rpc[_0x5d4210+_0x43d4('0x2b')][_0x43d4('0x2c')](_0x3b81ba)[_0x43d4('0x1e')](function(_0x1c6fe2){logger[_0x43d4('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x535a90,_0x3b81ba[_0x43d4('0x1c')]);if(_0xd49a7b[_0x43d4('0x28')][_0x43d4('0x2d')][_0x43d4('0x2e')]){_0x30d856['next']();}else{_0x30d856['stop']();}})[_0x43d4('0x2f')](function(_0x16b2ce){logger[_0x43d4('0x1f')](_0x43d4('0xb'),_0x535a90,JSON['stringify'](_0x16b2ce));_0x30d856['next']();});})[_0x43d4('0x2f')](function(_0x360c6c){logger[_0x43d4('0x1f')](_0x43d4('0xb'),_0x535a90,_0x360c6c['message']);_0x30d856[_0x43d4('0xd')]();});}}catch(_0x5daf97){logger[_0x43d4('0x1f')](_0x43d4('0xb'),_0x535a90,JSON[_0x43d4('0x20')](_0x5daf97));_0x30d856['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 75473e2..0bff556 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 _0xd941=['priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','stop','condition'];(function(_0x3d5b8d,_0x5b88d9){var _0x230baf=function(_0x14c510){while(--_0x14c510){_0x3d5b8d['push'](_0x3d5b8d['shift']());}};_0x230baf(++_0x5b88d9);}(_0xd941,0x1ae));var _0x1d94=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xd941[_0x30d87a];return _0x48f64b;};'use strict';var schema=require(_0x1d94('0x0'));var _=require(_0x1d94('0x1'));var htmlToText=require(_0x1d94('0x2'));var utils=require(_0x1d94('0x3'));var logger=require('../../../../config/logger')(_0x1d94('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x1d94('0x5')},'priorityTrue':{'type':_0x1d94('0x6'),'message':_0x1d94('0x7')},'priorityFalse':{'type':_0x1d94('0x6'),'message':_0x1d94('0x8')}});exports[_0x1d94('0x9')]=function(_0x3e553e,_0xe08ff0){return function(_0x56ce67){try{var _0xe577a2={'condition':htmlToText['fromString'](utils[_0x1d94('0xa')](_0xe08ff0[0x0],this),{'wordwrap':![]})[_0x1d94('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xe08ff0[0x1],'priorityFalse':_0xe08ff0[0x2]};var _0x231ed8=gotoif['validate'](_0xe577a2,{'typecast':!![]});if(_0x231ed8['length']){logger[_0x1d94('0xc')](_0x1d94('0xd'),_0x3e553e,_[_0x1d94('0xe')](_0x231ed8,_0x1d94('0xf'))['join'](',\x20'));_0x56ce67[_0x1d94('0x10')]();}else{try{var _0x3d7659=eval('('+_0xe577a2[_0x1d94('0x11')]+')');var _0x15ed8d=_0x3d7659?_0xe577a2[_0x1d94('0x12')]:_0xe577a2[_0x1d94('0x13')];logger['info'](_0x1d94('0x14'),_0x3e553e,_0xe577a2[_0x1d94('0x11')],_0x3d7659,_0x15ed8d||_0x1d94('0x15'));if(_0x15ed8d){var _0xeb3079=_[_0x1d94('0x16')](_0x56ce67[_0x1d94('0x17')](),{'p':_0x15ed8d});if(_0xeb3079>=0x0){logger[_0x1d94('0x18')](_0x1d94('0x19'),_0x3e553e,_0x15ed8d||_0x1d94('0x15'),_0xeb3079);_0x56ce67[_0x1d94('0x15')](_0xeb3079);}else{logger[_0x1d94('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3e553e,_0x15ed8d||'next');_0x56ce67[_0x1d94('0x10')]();}}else{_0x56ce67['next']();}}catch(_0x32e378){logger[_0x1d94('0xc')](_0x1d94('0x1a'),_0x3e553e,_0x32e378['message']);_0x56ce67[_0x1d94('0x10')]();}}}catch(_0x8e6c17){logger['error'](_0x1d94('0xd'),_0x3e553e,JSON[_0x1d94('0x1b')](_0x8e6c17));_0x56ce67['stop']();}};}; \ No newline at end of file +var _0xd0ed=['number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','error','map','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd0ed,0x122));var _0xdd0e=function(_0x1c1f55,_0x57697f){_0x1c1f55=_0x1c1f55-0x0;var _0x507e09=_0xd0ed[_0x1c1f55];return _0x507e09;};'use strict';var schema=require(_0xdd0e('0x0'));var _=require('lodash');var htmlToText=require(_0xdd0e('0x1'));var utils=require(_0xdd0e('0x2'));var logger=require(_0xdd0e('0x3'))(_0xdd0e('0x4'));var gotoif=schema({'condition':{'type':_0xdd0e('0x5'),'required':!![],'message':_0xdd0e('0x6')},'priorityTrue':{'type':_0xdd0e('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xdd0e('0x7'),'message':_0xdd0e('0x8')}});exports[_0xdd0e('0x9')]=function(_0x540254,_0x2af4c1){return function(_0x57057f){try{var _0x13af8a={'condition':htmlToText['fromString'](utils[_0xdd0e('0xa')](_0x2af4c1[0x0],this),{'wordwrap':![]})[_0xdd0e('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2af4c1[0x1],'priorityFalse':_0x2af4c1[0x2]};var _0x3422cb=gotoif[_0xdd0e('0x0')](_0x13af8a,{'typecast':!![]});if(_0x3422cb['length']){logger[_0xdd0e('0xc')]('[%s][GOTOIF]\x20%s',_0x540254,_[_0xdd0e('0xd')](_0x3422cb,_0xdd0e('0xe'))['join'](',\x20'));_0x57057f[_0xdd0e('0xf')]();}else{try{var _0x44261a=eval('('+_0x13af8a[_0xdd0e('0x10')]+')');var _0x3f6018=_0x44261a?_0x13af8a[_0xdd0e('0x11')]:_0x13af8a[_0xdd0e('0x12')];logger[_0xdd0e('0x13')](_0xdd0e('0x14'),_0x540254,_0x13af8a[_0xdd0e('0x10')],_0x44261a,_0x3f6018||_0xdd0e('0x15'));if(_0x3f6018){var _0x5728a9=_[_0xdd0e('0x16')](_0x57057f['rules'](),{'p':_0x3f6018});if(_0x5728a9>=0x0){logger[_0xdd0e('0x13')](_0xdd0e('0x17'),_0x540254,_0x3f6018||'next',_0x5728a9);_0x57057f['next'](_0x5728a9);}else{logger[_0xdd0e('0x13')](_0xdd0e('0x18'),_0x540254,_0x3f6018||_0xdd0e('0x15'));_0x57057f[_0xdd0e('0xf')]();}}else{_0x57057f['next']();}}catch(_0x3d2cfc){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x540254,_0x3d2cfc[_0xdd0e('0xe')]);_0x57057f[_0xdd0e('0xf')]();}}}catch(_0xb34815){logger[_0xdd0e('0xc')](_0xdd0e('0x19'),_0x540254,JSON[_0xdd0e('0x1a')](_0xb34815));_0x57057f[_0xdd0e('0xf')]();}};}; \ 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 68faa8e..a6a82c2 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 _0xdae4=['length','error','[%s][GOTOP]\x20%s','map','message','join','stop','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x223199,_0x2d429f){var _0x5cfb8d=function(_0x4679e9){while(--_0x4679e9){_0x223199['push'](_0x223199['shift']());}};_0x5cfb8d(++_0x2d429f);}(_0xdae4,0x165));var _0x4dae=function(_0x2f0e60,_0x1496ae){_0x2f0e60=_0x2f0e60-0x0;var _0x168472=_0xdae4[_0x2f0e60];return _0x168472;};'use strict';var schema=require('validate');var _=require(_0x4dae('0x0'));var logger=require(_0x4dae('0x1'))('routing');var gotop=schema({'priority':{'type':_0x4dae('0x2'),'required':!![],'message':_0x4dae('0x3')}});exports['consequence']=function(_0x3c15f2,_0x297cde){return function(_0x586100){try{var _0xd19e5={'priority':_0x297cde[0x0]};var _0x2e3731=gotop['validate'](_0xd19e5,{'typecast':!![]});if(_0x2e3731[_0x4dae('0x4')]){logger[_0x4dae('0x5')](_0x4dae('0x6'),_0x3c15f2,_[_0x4dae('0x7')](_0x2e3731,_0x4dae('0x8'))[_0x4dae('0x9')](',\x20'));_0x586100[_0x4dae('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x3c15f2,_0xd19e5['priority']);if(_0xd19e5[_0x4dae('0xb')]){var _0x19dd8f=_[_0x4dae('0xc')](_0x586100[_0x4dae('0xd')](),{'p':_0xd19e5[_0x4dae('0xb')]});if(_0x19dd8f>=0x0){logger['info'](_0x4dae('0xe'),_0x3c15f2,_0xd19e5[_0x4dae('0xb')]||_0x4dae('0xf'),_0x19dd8f);_0x586100['next'](_0x19dd8f);}else{logger[_0x4dae('0x10')](_0x4dae('0x11'),_0x3c15f2,_0xd19e5[_0x4dae('0xb')]||_0x4dae('0xf'));_0x586100[_0x4dae('0xa')]();}}else{_0x586100[_0x4dae('0xf')]();}}}catch(_0x56c98c){logger['error'](_0x4dae('0x6'),_0x3c15f2,JSON[_0x4dae('0x12')](_0x56c98c));_0x586100['stop']();}};}; \ No newline at end of file +var _0xfdbb=['next','stop','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x2ccb1d,_0x3c9ce8){var _0x1c43ce=function(_0x47a6e6){while(--_0x47a6e6){_0x2ccb1d['push'](_0x2ccb1d['shift']());}};_0x1c43ce(++_0x3c9ce8);}(_0xfdbb,0xb7));var _0xbfdb=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xfdbb[_0x52e0ee];return _0x32534c;};'use strict';var schema=require(_0xbfdb('0x0'));var _=require(_0xbfdb('0x1'));var logger=require(_0xbfdb('0x2'))(_0xbfdb('0x3'));var gotop=schema({'priority':{'type':_0xbfdb('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xbfdb('0x5')]=function(_0x36f5bd,_0xb35232){return function(_0x45f7d0){try{var _0x248a38={'priority':_0xb35232[0x0]};var _0x2ec55a=gotop['validate'](_0x248a38,{'typecast':!![]});if(_0x2ec55a[_0xbfdb('0x6')]){logger[_0xbfdb('0x7')](_0xbfdb('0x8'),_0x36f5bd,_[_0xbfdb('0x9')](_0x2ec55a,_0xbfdb('0xa'))[_0xbfdb('0xb')](',\x20'));_0x45f7d0['stop']();}else{logger['info'](_0xbfdb('0xc'),_0x36f5bd,_0x248a38['priority']);if(_0x248a38[_0xbfdb('0xd')]){var _0x4ef860=_[_0xbfdb('0xe')](_0x45f7d0['rules'](),{'p':_0x248a38['priority']});if(_0x4ef860>=0x0){logger[_0xbfdb('0xf')](_0xbfdb('0x10'),_0x36f5bd,_0x248a38[_0xbfdb('0xd')]||_0xbfdb('0x11'),_0x4ef860);_0x45f7d0[_0xbfdb('0x11')](_0x4ef860);}else{logger[_0xbfdb('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x36f5bd,_0x248a38[_0xbfdb('0xd')]||_0xbfdb('0x11'));_0x45f7d0[_0xbfdb('0x12')]();}}else{_0x45f7d0[_0xbfdb('0x11')]();}}}catch(_0x49b326){logger[_0xbfdb('0x7')](_0xbfdb('0x8'),_0x36f5bd,JSON[_0xbfdb('0x13')](_0x49b326));_0x45f7d0[_0xbfdb('0x12')]();}};}; \ 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 abd6124..1a37586 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 _0x0165=['[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','channel','chat','account','upperFirst','InteractionId','Message','then','info'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x0165,0x193));var _0x5016=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0165[_0x432682];return _0x463d05;};'use strict';var _=require(_0x5016('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5016('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5016('0x2')),'mailMessage':require(_0x5016('0x3')),'smsMessage':require(_0x5016('0x4')),'faxMessage':require(_0x5016('0x5'))};exports[_0x5016('0x6')]=function(_0x461326,_0x1cfd9a){return function(_0x41d9b3){try{var _0x36f215={'body':utils['getMustacheRender'](_0x1cfd9a[0x0],this),'ContactId':this['contact']['id']};if(this[_0x5016('0x7')]===_0x5016('0x8')){_0x36f215['ChatWebsiteId']=this[_0x5016('0x9')]['id'];}else{_0x36f215[_['upperFirst'](this[_0x5016('0x7')])+'AccountId']=this[_0x5016('0x9')]['id'];}_0x36f215[_[_0x5016('0xa')](this[_0x5016('0x7')])+_0x5016('0xb')]=this['interaction']['id'];if(rpc[this[_0x5016('0x7')]+_0x5016('0xc')]){return rpc[this[_0x5016('0x7')]+_0x5016('0xc')]['create'](_0x36f215)[_0x5016('0xd')](function(_0x54e219){logger[_0x5016('0xe')](_0x5016('0xf'),_0x461326,_0x36f215[_0x5016('0x10')]);_0x41d9b3[_0x5016('0x11')]();})[_0x5016('0x12')](function(_0x4c231f){logger[_0x5016('0x13')](_0x5016('0xf'),_0x461326,JSON[_0x5016('0x14')](_0x4c231f));_0x41d9b3[_0x5016('0x15')]();});}}catch(_0xbd91ef){logger['error'](_0x5016('0xf'),_0x461326,JSON[_0x5016('0x14')](_0xbd91ef));_0x41d9b3[_0x5016('0x15')]();}};}; \ No newline at end of file +var _0xd145=['../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd145,0x1b9));var _0x5d14=function(_0x58f29f,_0x44e25e){_0x58f29f=_0x58f29f-0x0;var _0x301a8e=_0xd145[_0x58f29f];return _0x301a8e;};'use strict';var _=require(_0x5d14('0x0'));var utils=require('./utils');var logger=require(_0x5d14('0x1'))(_0x5d14('0x2'));var rpc={'chatMessage':require(_0x5d14('0x3')),'openchannelMessage':require(_0x5d14('0x4')),'mailMessage':require(_0x5d14('0x5')),'smsMessage':require(_0x5d14('0x6')),'faxMessage':require(_0x5d14('0x7'))};exports[_0x5d14('0x8')]=function(_0x18ecb6,_0x13faae){return function(_0x3c59f3){try{var _0x1bca81={'body':utils[_0x5d14('0x9')](_0x13faae[0x0],this),'ContactId':this[_0x5d14('0xa')]['id']};if(this[_0x5d14('0xb')]===_0x5d14('0xc')){_0x1bca81[_0x5d14('0xd')]=this[_0x5d14('0xe')]['id'];}else{_0x1bca81[_[_0x5d14('0xf')](this[_0x5d14('0xb')])+_0x5d14('0x10')]=this[_0x5d14('0xe')]['id'];}_0x1bca81[_['upperFirst'](this['channel'])+_0x5d14('0x11')]=this['interaction']['id'];if(rpc[this[_0x5d14('0xb')]+_0x5d14('0x12')]){return rpc[this[_0x5d14('0xb')]+'Message'][_0x5d14('0x13')](_0x1bca81)[_0x5d14('0x14')](function(_0x3ed1e8){logger[_0x5d14('0x15')](_0x5d14('0x16'),_0x18ecb6,_0x1bca81[_0x5d14('0x17')]);_0x3c59f3['next']();})[_0x5d14('0x18')](function(_0x15c210){logger[_0x5d14('0x19')](_0x5d14('0x16'),_0x18ecb6,JSON[_0x5d14('0x1a')](_0x15c210));_0x3c59f3[_0x5d14('0x1b')]();});}}catch(_0x29386f){logger['error'](_0x5d14('0x16'),_0x18ecb6,JSON[_0x5d14('0x1a')](_0x29386f));_0x3c59f3[_0x5d14('0x1b')]();}};}; \ 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 f342e22..b16e75d 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 _0x2b1c=['stringify','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x3a9c3b,_0x485e75){var _0xf5b659=function(_0x2b4a8e){while(--_0x2b4a8e){_0x3a9c3b['push'](_0x3a9c3b['shift']());}};_0xf5b659(++_0x485e75);}(_0x2b1c,0xc5));var _0xc2b1=function(_0x5d992e,_0x139659){_0x5d992e=_0x5d992e-0x0;var _0x1b3ac6=_0x2b1c[_0x5d992e];return _0x1b3ac6;};'use strict';var utils=require(_0xc2b1('0x0'));var logger=require(_0xc2b1('0x1'))('routing');exports[_0xc2b1('0x2')]=function(_0x5adb0e,_0x3b551b){return function(_0x5de75a){try{logger[_0xc2b1('0x3')](_0xc2b1('0x4'),_0x5adb0e,utils[_0xc2b1('0x5')](_0x3b551b[0x0],this));_0x5de75a['next']();}catch(_0x14e23b){logger['error'](_0xc2b1('0x4'),_0x5adb0e,JSON[_0xc2b1('0x6')](_0x14e23b));_0x5de75a['stop']();}};}; \ No newline at end of file +var _0x49bb=['getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','consequence','info'];(function(_0x302439,_0x13211e){var _0x3572e4=function(_0x1668b8){while(--_0x1668b8){_0x302439['push'](_0x302439['shift']());}};_0x3572e4(++_0x13211e);}(_0x49bb,0xce));var _0xb49b=function(_0xaf5884,_0x1681f6){_0xaf5884=_0xaf5884-0x0;var _0x26581a=_0x49bb[_0xaf5884];return _0x26581a;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports[_0xb49b('0x0')]=function(_0x29fa9a,_0x2881e1){return function(_0x15a282){try{logger[_0xb49b('0x1')]('[%s][NOOP]\x20%s',_0x29fa9a,utils[_0xb49b('0x2')](_0x2881e1[0x0],this));_0x15a282[_0xb49b('0x3')]();}catch(_0x58f2cb){logger[_0xb49b('0x4')](_0xb49b('0x5'),_0x29fa9a,JSON[_0xb49b('0x6')](_0x58f2cb));_0x15a282[_0xb49b('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index cf4c424..53a4743 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 _0x5a61=['beepall','stop','log','stack','validate','lodash','util','ioredis','../../../../config/environment','routing','defaults','redis','localhost','socket.io-emitter','account','queue','from','joinAt','queue_id','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','waiting','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','catch','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','createQueue','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20ROUTING\x20END','strategy','rrmemory'];(function(_0x399424,_0x1e30d3){var _0x173125=function(_0x332a4f){while(--_0x332a4f){_0x399424['push'](_0x399424['shift']());}};_0x173125(++_0x1e30d3);}(_0x5a61,0x128));var _0x15a6=function(_0x439c28,_0x274bad){_0x439c28=_0x439c28-0x0;var _0x4d23dd=_0x5a61[_0x439c28];return _0x4d23dd;};'use strict';var schema=require(_0x15a6('0x0'));var _=require(_0x15a6('0x1'));var util=require(_0x15a6('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x15a6('0x3'));var config=require(_0x15a6('0x4'));var logger=require('../../../../config/logger')(_0x15a6('0x5'));var strategy=require('./strategy');config['redis']=_[_0x15a6('0x6')](config[_0x15a6('0x7')],{'host':_0x15a6('0x8'),'port':0x18eb});var io=require(_0x15a6('0x9'))(new Redis(config[_0x15a6('0x7')]));var attributes=['id','queue_id',_0x15a6('0xa'),_0x15a6('0xb'),_0x15a6('0xc'),_0x15a6('0xd')];function emit(_0x753e4,_0x19e628,_0x34d7ca){io['to'](_0x753e4)['emit'](_0x19e628,_0x34d7ca);}function emitChannelQueueInteraction(_0x3ac346,_0x26b345,_0x5de521,_0x872f29,_0x4dc329,_0x5a4b29,_0x3a9f29,_0x3b471e){_0x5de521[_0x15a6('0xe')]=_0x3b471e;_0x5de521[_0x15a6('0xb')]=_0x26b345;_0x5de521[_0x15a6('0xa')]=_0x872f29;_0x5de521['id']=_0x4dc329;if(_0x5a4b29){_0x3a9f29[util[_0x15a6('0xf')](_0x15a6('0x10'),_0x3ac346)][_0x4dc329]=_[_0x15a6('0x11')](_0x5de521,attributes);}else{delete _0x3a9f29[util['format'](_0x15a6('0x10'),_0x3ac346)][_0x4dc329];}emit(util[_0x15a6('0xf')](_0x15a6('0x12'),_0x3ac346,_0x26b345),util['format']('%s_queue_waiting_interaction:%s',_0x3ac346,_0x5a4b29?'save':'remove'),_[_0x15a6('0x11')](_0x5de521,attributes));}var rpc={'openchannelQueueReport':require(_0x15a6('0x13')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x15a6('0x14')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x15a6('0x15'))};var queue=schema({'name':{'type':_0x15a6('0x16'),'required':!![],'message':_0x15a6('0x17')},'timeout':{'type':_0x15a6('0x18'),'message':_0x15a6('0x19')}});function startRouting(_0x4395cc,_0x390047,_0x856ea4,_0x27e142){if(_0x4395cc&&_0x390047&&_0x856ea4){_0x390047['waiting']+=0x1;var _0x412e80={'uniqueid':_0x4395cc,'from':_0x856ea4[_0x15a6('0x1a')]?_0x856ea4[_0x15a6('0x1a')]['from']:'','joinAt':moment()[_0x15a6('0xf')](_0x15a6('0x1b')),'ContactId':_0x856ea4[_0x15a6('0x1c')]?_0x856ea4[_0x15a6('0x1c')]['id']:null,'ListId':_0x856ea4[_0x15a6('0x1d')]?_0x856ea4[_0x15a6('0x1d')]['id']:null};_0x412e80[_[_0x15a6('0x1e')](_0x856ea4[_0x15a6('0x1f')])+_0x15a6('0x20')]=_0x390047['id']||null;_0x412e80[_[_0x15a6('0x1e')](_0x856ea4[_0x15a6('0x1f')])+_0x15a6('0x21')]=_0x856ea4['interaction']?_0x856ea4['interaction']['id']:null;_0x412e80[_[_0x15a6('0x1e')](_0x856ea4['channel'])+_0x15a6('0x22')]=_0x856ea4[_0x15a6('0x23')]?_0x856ea4['message']['id']:null;_0x412e80[_[_0x15a6('0x1e')](_0x856ea4[_0x15a6('0x1f')])+(_0x856ea4[_0x15a6('0x1f')]!=='chat'?_0x15a6('0x24'):_0x15a6('0x25'))]=_0x856ea4[_0x15a6('0xa')]?_0x856ea4[_0x15a6('0xa')]['id']:null;logger['info'](util[_0x15a6('0xf')](_0x15a6('0x26'),_0x4395cc,_0x390047[_0x15a6('0x27')]));emitChannelQueueInteraction(_0x856ea4[_0x15a6('0x1f')],_0x390047['name'],_0x412e80,_0x856ea4['account'][_0x15a6('0x27')],_0x856ea4[_0x15a6('0x23')]['id'],!![],_0x27e142,_0x390047['id']);if(rpc[_0x856ea4[_0x15a6('0x1f')]+_0x15a6('0x28')]){return rpc[_0x856ea4[_0x15a6('0x1f')]+_0x15a6('0x28')][_0x15a6('0x29')](_0x412e80)['catch'](function(_0x5a51b4){logger[_0x15a6('0x2a')](_0x15a6('0x2b'));});}}}function stopRouting(_0x42929e,_0x6c927c,_0x119166,_0x525792){if(_0x42929e&&_0x6c927c){_0x6c927c[_0x15a6('0x2c')]-=0x1;var _0x2aa0d1={'leaveAt':moment()[_0x15a6('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x15a6('0x1b')),'reason':_0x15a6('0x2d')};logger[_0x15a6('0x2e')](util['format'](_0x15a6('0x2f'),_0x42929e,_0x6c927c[_0x15a6('0x27')]));emitChannelQueueInteraction(_0x119166[_0x15a6('0x1f')],_0x6c927c['name'],_0x119166[_0x15a6('0x1a')],_0x119166[_0x15a6('0xa')][_0x15a6('0x27')],_0x119166[_0x15a6('0x23')]['id'],![],_0x525792,_0x6c927c['id']);if(rpc[_0x119166[_0x15a6('0x1f')]+_0x15a6('0x28')]){return rpc[_0x119166[_0x15a6('0x1f')]+'QueueReport'][_0x15a6('0x30')](_0x42929e,_0x2aa0d1)['catch'](function(_0x1812da){logger[_0x15a6('0x2a')](_0x15a6('0x31'));});}}}function endRouting(_0x57d76c,_0x68866c,_0x604374,_0x2d579b){if(_0x57d76c&&_0x68866c){_0x68866c[_0x15a6('0x2c')]-=0x1;var _0xc635f3={'leaveAt':moment()['format'](_0x15a6('0x1b')),'exitAt':moment()[_0x15a6('0xf')](_0x15a6('0x1b')),'reason':_0x15a6('0x32')};logger['info'](util[_0x15a6('0xf')]('[%s][END:QUEUE][NAME:%s]',_0x57d76c,_0x68866c[_0x15a6('0x27')]));emitChannelQueueInteraction(_0x604374[_0x15a6('0x1f')],_0x68866c[_0x15a6('0x27')],_0x604374[_0x15a6('0x1a')],_0x604374[_0x15a6('0xa')]['name'],_0x604374['message']['id'],![],_0x2d579b);if(rpc[_0x604374[_0x15a6('0x1f')]+_0x15a6('0x28')]){return rpc[_0x604374[_0x15a6('0x1f')]+_0x15a6('0x28')]['update'](_0x57d76c,_0xc635f3)[_0x15a6('0x33')](function(_0x56cd37){logger[_0x15a6('0x2a')](_0x15a6('0x31'));});}}}function handleFindQueue(_0x180d3c){return function(_0xefd300){return _0xefd300['name'][_0x15a6('0x34')]()===_0x180d3c[_0x15a6('0x34')]();};}exports[_0x15a6('0x35')]=function(_0x4e4c9c,_0x2560a9,_0x2d5c71,_0x19df13){return function(_0x2278bc){try{var _0x1989a4={'name':_0x2560a9[0x0],'timeout':_0x2560a9[0x1]};var _0x29e786=queue[_0x15a6('0x0')](_0x1989a4,{'typecast':!![]});if(_0x29e786[_0x15a6('0x36')]){logger[_0x15a6('0x2a')](_0x15a6('0x37'),_0x4e4c9c,_[_0x15a6('0x38')](_0x29e786,_0x15a6('0x23'))[_0x15a6('0x39')](',\x20'));_0x2278bc['stop']();}else{var _0x25a280=_[_0x15a6('0x3a')](_0x2d5c71[_0x19df13['channel']+'Queues'],handleFindQueue(_0x1989a4[_0x15a6('0x27')]));if(_0x25a280){startRouting(_0x4e4c9c,_0x25a280,_0x19df13,_0x2d5c71);var _0x83f7c=(_0x25a280['timeout']||0xa)*0x3e8;var _0x4c28d1=(_0x1989a4[_0x15a6('0x32')]||0x14)*0x3e8;var _0x10581e,_0x42976a;if(_0x83f7c>_0x4c28d1){_0x4c28d1=_0x83f7c;}var _0x41745e=seqqueue[_0x15a6('0x3b')](_0x83f7c);_0x41745e['id']=_0x4e4c9c;_0x41745e[_0x15a6('0x3c')]=_0x83f7c;_0x41745e[_0x15a6('0x3d')]=_0x4c28d1;_0x41745e[_0x15a6('0x1f')]=_0x19df13[_0x15a6('0x1f')];_0x2d5c71[_0x15a6('0x3e')][_0x4e4c9c]['on'](_0x15a6('0x3f'),function(){stopRouting(_0x4e4c9c,_0x25a280,_0x19df13,_0x2d5c71);_0x41745e[_0x15a6('0x40')](!![]);clearTimeout(_0x10581e);_0x10581e=undefined;if(_0x2d5c71[_0x15a6('0x3e')][_0x4e4c9c]){delete _0x2d5c71[_0x15a6('0x3e')][_0x4e4c9c];}logger[_0x15a6('0x2e')](_0x15a6('0x41'),_0x4e4c9c);_0x2278bc['stop']();});_0x10581e=setTimeout(function(){endRouting(_0x4e4c9c,_0x25a280,_0x19df13,_0x2d5c71);clearTimeout(_0x10581e);_0x41745e['close'](!![]);logger[_0x15a6('0x2e')](_0x15a6('0x42'),_0x4e4c9c);_0x2278bc['next']();},_0x4c28d1);switch(_0x25a280[_0x15a6('0x43')]){case _0x15a6('0x44'):strategy[_0x15a6('0x44')](_0x41745e,_0x25a280,_0x2d5c71,_0x19df13);break;default:strategy[_0x15a6('0x45')](_0x41745e,_0x25a280,_0x2d5c71,_0x19df13);}}else{logger[_0x15a6('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4e4c9c,_0x1989a4[_0x15a6('0x27')]);_0x2278bc[_0x15a6('0x46')]();}}}catch(_0x104ae9){console[_0x15a6('0x47')](_0x104ae9);logger[_0x15a6('0x2a')](_0x15a6('0x37'),_0x4e4c9c,_0x104ae9[_0x15a6('0x48')]);_0x2278bc['stop']();}};}; \ No newline at end of file +var _0xf743=['redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','waiting','accepted','update\x20queue\x20report','timeout','error','toLowerCase','consequence','length','map','join','stop','find','Queues','createQueue','qtimeout','end','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20ROUTING\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy'];(function(_0x2f714d,_0x36207b){var _0x5d22b1=function(_0x3f4a43){while(--_0x3f4a43){_0x2f714d['push'](_0x2f714d['shift']());}};_0x5d22b1(++_0x36207b);}(_0xf743,0xdf));var _0x3f74=function(_0x2ebedb,_0x4f0e89){_0x2ebedb=_0x2ebedb-0x0;var _0x1a1930=_0xf743[_0x2ebedb];return _0x1a1930;};'use strict';var schema=require(_0x3f74('0x0'));var _=require(_0x3f74('0x1'));var util=require(_0x3f74('0x2'));var seqqueue=require(_0x3f74('0x3'));var moment=require(_0x3f74('0x4'));var Redis=require(_0x3f74('0x5'));var config=require(_0x3f74('0x6'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x3f74('0x7'));config[_0x3f74('0x8')]=_[_0x3f74('0x9')](config['redis'],{'host':_0x3f74('0xa'),'port':0x18eb});var io=require(_0x3f74('0xb'))(new Redis(config['redis']));var attributes=['id',_0x3f74('0xc'),_0x3f74('0xd'),_0x3f74('0xe'),'from',_0x3f74('0xf')];function emit(_0x39b1ba,_0xf9249b,_0x4b4382){io['to'](_0x39b1ba)['emit'](_0xf9249b,_0x4b4382);}function emitChannelQueueInteraction(_0x3b995c,_0x463a11,_0x3a6026,_0x5acf4d,_0x547c30,_0x1085ce,_0x4571c9,_0x7c11b8){_0x3a6026[_0x3f74('0xc')]=_0x7c11b8;_0x3a6026[_0x3f74('0xe')]=_0x463a11;_0x3a6026[_0x3f74('0xd')]=_0x5acf4d;_0x3a6026['id']=_0x547c30;if(_0x1085ce){_0x4571c9[util[_0x3f74('0x10')](_0x3f74('0x11'),_0x3b995c)][_0x547c30]=_[_0x3f74('0x12')](_0x3a6026,attributes);}else{delete _0x4571c9[util[_0x3f74('0x10')](_0x3f74('0x11'),_0x3b995c)][_0x547c30];}emit(util[_0x3f74('0x10')](_0x3f74('0x13'),_0x3b995c,_0x463a11),util[_0x3f74('0x10')](_0x3f74('0x14'),_0x3b995c,_0x1085ce?_0x3f74('0x15'):_0x3f74('0x16')),_[_0x3f74('0x12')](_0x3a6026,attributes));}var rpc={'openchannelQueueReport':require(_0x3f74('0x17')),'mailQueueReport':require(_0x3f74('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x3f74('0x19')),'faxQueueReport':require(_0x3f74('0x1a'))};var queue=schema({'name':{'type':_0x3f74('0x1b'),'required':!![],'message':_0x3f74('0x1c')},'timeout':{'type':_0x3f74('0x1d'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x2693db,_0x267883,_0x4116a2,_0x29a302){if(_0x2693db&&_0x267883&&_0x4116a2){_0x267883['waiting']+=0x1;var _0x15a9cf={'uniqueid':_0x2693db,'from':_0x4116a2[_0x3f74('0x1e')]?_0x4116a2[_0x3f74('0x1e')][_0x3f74('0x1f')]:'','joinAt':moment()[_0x3f74('0x10')](_0x3f74('0x20')),'ContactId':_0x4116a2[_0x3f74('0x21')]?_0x4116a2[_0x3f74('0x21')]['id']:null,'ListId':_0x4116a2['list']?_0x4116a2[_0x3f74('0x22')]['id']:null};_0x15a9cf[_[_0x3f74('0x23')](_0x4116a2[_0x3f74('0x24')])+_0x3f74('0x25')]=_0x267883['id']||null;_0x15a9cf[_['upperFirst'](_0x4116a2[_0x3f74('0x24')])+_0x3f74('0x26')]=_0x4116a2[_0x3f74('0x27')]?_0x4116a2[_0x3f74('0x27')]['id']:null;_0x15a9cf[_[_0x3f74('0x23')](_0x4116a2[_0x3f74('0x24')])+'MessageId']=_0x4116a2[_0x3f74('0x28')]?_0x4116a2[_0x3f74('0x28')]['id']:null;_0x15a9cf[_[_0x3f74('0x23')](_0x4116a2[_0x3f74('0x24')])+(_0x4116a2[_0x3f74('0x24')]!==_0x3f74('0x29')?_0x3f74('0x2a'):_0x3f74('0x2b'))]=_0x4116a2['account']?_0x4116a2['account']['id']:null;logger[_0x3f74('0x2c')](util['format'](_0x3f74('0x2d'),_0x2693db,_0x267883[_0x3f74('0x2e')]));emitChannelQueueInteraction(_0x4116a2[_0x3f74('0x24')],_0x267883['name'],_0x15a9cf,_0x4116a2['account'][_0x3f74('0x2e')],_0x4116a2[_0x3f74('0x28')]['id'],!![],_0x29a302,_0x267883['id']);if(rpc[_0x4116a2[_0x3f74('0x24')]+'QueueReport']){return rpc[_0x4116a2['channel']+_0x3f74('0x2f')][_0x3f74('0x30')](_0x15a9cf)[_0x3f74('0x31')](function(_0x4d4500){logger['error'](_0x3f74('0x32'));});}}}function stopRouting(_0x15c63a,_0x1f1801,_0x3b0ed2,_0x20f844){if(_0x15c63a&&_0x1f1801){_0x1f1801[_0x3f74('0x33')]-=0x1;var _0x10a72a={'leaveAt':moment()[_0x3f74('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x3f74('0x10')](_0x3f74('0x20')),'reason':_0x3f74('0x34')};logger[_0x3f74('0x2c')](util[_0x3f74('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0x15c63a,_0x1f1801[_0x3f74('0x2e')]));emitChannelQueueInteraction(_0x3b0ed2[_0x3f74('0x24')],_0x1f1801[_0x3f74('0x2e')],_0x3b0ed2['body'],_0x3b0ed2[_0x3f74('0xd')][_0x3f74('0x2e')],_0x3b0ed2[_0x3f74('0x28')]['id'],![],_0x20f844,_0x1f1801['id']);if(rpc[_0x3b0ed2[_0x3f74('0x24')]+'QueueReport']){return rpc[_0x3b0ed2[_0x3f74('0x24')]+_0x3f74('0x2f')]['update'](_0x15c63a,_0x10a72a)[_0x3f74('0x31')](function(_0x1cb15f){logger['error'](_0x3f74('0x35'));});}}}function endRouting(_0x3503f1,_0x9ecf66,_0x111cd7,_0x27b153){if(_0x3503f1&&_0x9ecf66){_0x9ecf66[_0x3f74('0x33')]-=0x1;var _0x2cd035={'leaveAt':moment()[_0x3f74('0x10')](_0x3f74('0x20')),'exitAt':moment()[_0x3f74('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x3f74('0x36')};logger[_0x3f74('0x2c')](util[_0x3f74('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x3503f1,_0x9ecf66['name']));emitChannelQueueInteraction(_0x111cd7[_0x3f74('0x24')],_0x9ecf66[_0x3f74('0x2e')],_0x111cd7['body'],_0x111cd7[_0x3f74('0xd')]['name'],_0x111cd7[_0x3f74('0x28')]['id'],![],_0x27b153);if(rpc[_0x111cd7[_0x3f74('0x24')]+_0x3f74('0x2f')]){return rpc[_0x111cd7[_0x3f74('0x24')]+_0x3f74('0x2f')]['update'](_0x3503f1,_0x2cd035)[_0x3f74('0x31')](function(_0x4be91f){logger[_0x3f74('0x37')](_0x3f74('0x35'));});}}}function handleFindQueue(_0x251063){return function(_0x17fcd1){return _0x17fcd1['name'][_0x3f74('0x38')]()===_0x251063[_0x3f74('0x38')]();};}exports[_0x3f74('0x39')]=function(_0x3b7e52,_0x48d439,_0x7b85a0,_0x1fba96){return function(_0xe85890){try{var _0x367fc1={'name':_0x48d439[0x0],'timeout':_0x48d439[0x1]};var _0x33a708=queue[_0x3f74('0x0')](_0x367fc1,{'typecast':!![]});if(_0x33a708[_0x3f74('0x3a')]){logger[_0x3f74('0x37')]('[%s][QUEUE]\x20%s',_0x3b7e52,_[_0x3f74('0x3b')](_0x33a708,_0x3f74('0x28'))[_0x3f74('0x3c')](',\x20'));_0xe85890[_0x3f74('0x3d')]();}else{var _0x3e706a=_[_0x3f74('0x3e')](_0x7b85a0[_0x1fba96[_0x3f74('0x24')]+_0x3f74('0x3f')],handleFindQueue(_0x367fc1[_0x3f74('0x2e')]));if(_0x3e706a){startRouting(_0x3b7e52,_0x3e706a,_0x1fba96,_0x7b85a0);var _0x432efa=(_0x3e706a['timeout']||0xa)*0x3e8;var _0x4846a6=(_0x367fc1[_0x3f74('0x36')]||0x14)*0x3e8;var _0xc4e7aa,_0x3c1966;if(_0x432efa>_0x4846a6){_0x4846a6=_0x432efa;}var _0x11f7f3=seqqueue[_0x3f74('0x40')](_0x432efa);_0x11f7f3['id']=_0x3b7e52;_0x11f7f3['atimeout']=_0x432efa;_0x11f7f3[_0x3f74('0x41')]=_0x4846a6;_0x11f7f3[_0x3f74('0x24')]=_0x1fba96[_0x3f74('0x24')];_0x7b85a0['rules'][_0x3b7e52]['on'](_0x3f74('0x42'),function(){stopRouting(_0x3b7e52,_0x3e706a,_0x1fba96,_0x7b85a0);_0x11f7f3['close'](!![]);clearTimeout(_0xc4e7aa);_0xc4e7aa=undefined;if(_0x7b85a0['rules'][_0x3b7e52]){delete _0x7b85a0[_0x3f74('0x43')][_0x3b7e52];}logger[_0x3f74('0x2c')](_0x3f74('0x44'),_0x3b7e52);_0xe85890[_0x3f74('0x3d')]();});_0xc4e7aa=setTimeout(function(){endRouting(_0x3b7e52,_0x3e706a,_0x1fba96,_0x7b85a0);clearTimeout(_0xc4e7aa);_0x11f7f3[_0x3f74('0x45')](!![]);logger['info'](_0x3f74('0x46'),_0x3b7e52);_0xe85890['next']();},_0x4846a6);switch(_0x3e706a[_0x3f74('0x47')]){case _0x3f74('0x48'):strategy['rrmemory'](_0x11f7f3,_0x3e706a,_0x7b85a0,_0x1fba96);break;default:strategy['beepall'](_0x11f7f3,_0x3e706a,_0x7b85a0,_0x1fba96);}}else{logger[_0x3f74('0x37')](_0x3f74('0x49'),_0x3b7e52,_0x367fc1[_0x3f74('0x2e')]);_0xe85890['stop']();}}}catch(_0xe7d7fc){console[_0x3f74('0x4a')](_0xe7d7fc);logger[_0x3f74('0x37')](_0x3f74('0x4b'),_0x3b7e52,_0xe7d7fc[_0x3f74('0x4c')]);_0xe85890[_0x3f74('0x3d')]();}};}; \ 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 5af1154..49d759b 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 _0xb81a=['handleRun','bind','handleTimeout','timeout','squeue','drained','prototype','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','writeLog','STOP','TIMEOUT','exports','uuid','routing','notificationId','agent','realtime','push'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb81a,0x186));var _0xab81=function(_0x21652b,_0xa0c158){_0x21652b=_0x21652b-0x0;var _0x2a4ae0=_0xb81a[_0x21652b];return _0x2a4ae0;};'use strict';var _=require('lodash');var uuid=require(_0xab81('0x0'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xab81('0x1'));var Agent=function(_0x26227c,_0x56739b,_0x55aa55,_0x15b413){this[_0xab81('0x2')]=uuid['v4']();this['squeue']=_0x26227c;this[_0xab81('0x3')]=_0x56739b;this[_0xab81('0x4')]=_0x55aa55;this['routing']=_0x15b413;this['squeue'][_0xab81('0x5')](this[_0xab81('0x6')][_0xab81('0x7')](this),this[_0xab81('0x8')][_0xab81('0x7')](this));this['squeue']['on'](_0xab81('0x9'),this[_0xab81('0x8')]['bind'](this));this[_0xab81('0xa')]['on'](_0xab81('0xb'),this['handleDrained']['bind'](this));};Agent[_0xab81('0xc')][_0xab81('0x5')]=function(){this[_0xab81('0xa')][_0xab81('0x5')](this['handleRun'][_0xab81('0x7')](this),this[_0xab81('0x8')]['bind'](this));};Agent[_0xab81('0xc')][_0xab81('0xd')]=function(){this[_0xab81('0x8')](!![]);};Agent['prototype'][_0xab81('0x6')]=function(_0x362926){logger['info'](_0xab81('0xe'),this['squeue']['id'],this[_0xab81('0x3')]['id']);if(_[_0xab81('0xf')](this[_0xab81('0x4')]['agents'][this['agent']['id']])){logger[_0xab81('0x10')](_0xab81('0x11'),this['squeue']['id'],this[_0xab81('0x3')]['id']);setTimeout(this[_0xab81('0x5')][_0xab81('0x7')](this),0x3e8);}else{if(this[_0xab81('0x1')][_0xab81('0x12')]||util[_0xab81('0x13')](this['squeue']['id'],this[_0xab81('0x4')][_0xab81('0x14')][this[_0xab81('0x3')]['id']],this[_0xab81('0xa')][_0xab81('0x15')],![])){this[_0xab81('0x4')][_0xab81('0x14')][this[_0xab81('0x3')]['id']][_0xab81('0x16')]=!![];this['realtime'][_0xab81('0x14')][this[_0xab81('0x3')]['id']][_0xab81('0x17')]=undefined;util[_0xab81('0x18')](this['notificationId'],this['squeue']['id'],this[_0xab81('0x4')][_0xab81('0x14')][this[_0xab81('0x3')]['id']],null,this[_0xab81('0x1')]);util['writeLog'](this[_0xab81('0xa')]['id'],this[_0xab81('0x4')][_0xab81('0x14')][this[_0xab81('0x3')]['id']],_0xab81('0x19')+(this[_0xab81('0x1')][_0xab81('0x12')]?_0xab81('0x1a'):''));}else{logger[_0xab81('0x10')](_0xab81('0x1b'),this[_0xab81('0xa')]['id'],this['agent']['id']);setTimeout(this[_0xab81('0x5')][_0xab81('0x7')](this),0x3e8);}}};Agent[_0xab81('0xc')][_0xab81('0x8')]=function(_0x4843a8){if(_[_0xab81('0xf')](this['realtime']['agents'][this[_0xab81('0x3')]['id']])){return logger['info'](_0xab81('0x11'),this[_0xab81('0xa')]['id'],this['agent']['id']);}else{logger[_0xab81('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xab81('0x3')]['id']);util[_0xab81('0x1c')](this['notificationId'],this['squeue']['id'],this[_0xab81('0x4')][_0xab81('0x14')][this[_0xab81('0x3')]['id']],null,this[_0xab81('0x1')]);this['realtime'][_0xab81('0x14')][this[_0xab81('0x3')]['id']][_0xab81('0x16')]=![];this[_0xab81('0x4')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xab81('0x1d')](this['squeue']['id'],this[_0xab81('0x4')]['agents'][this[_0xab81('0x3')]['id']],_0x4843a8?_0xab81('0x1e'):_0xab81('0x1f'));}if(!_0x4843a8){setTimeout(this[_0xab81('0x5')]['bind'](this),0x3e8);}};function agent(_0x51ee00,_0x2b8632,_0x1a8ba6,_0x3955f1){return new Agent(_0x51ee00,_0x2b8632,_0x1a8ba6,_0x3955f1);}module[_0xab81('0x20')]=agent; \ No newline at end of file +var _0xe936=['routing','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','busy','busyQueue','notificationId','writeLog','RINGING','forcedOwnership',':FORCED','exports','lodash','uuid','./util','squeue','realtime'];(function(_0x4026a9,_0x5eba5b){var _0x113a9c=function(_0x3dfdff){while(--_0x3dfdff){_0x4026a9['push'](_0x4026a9['shift']());}};_0x113a9c(++_0x5eba5b);}(_0xe936,0x157));var _0x6e93=function(_0x22cbcb,_0x413899){_0x22cbcb=_0x22cbcb-0x0;var _0x484301=_0xe936[_0x22cbcb];return _0x484301;};'use strict';var _=require(_0x6e93('0x0'));var uuid=require(_0x6e93('0x1'));var util=require(_0x6e93('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x135340,_0x55f540,_0x155efa,_0x1e1f5a){this['notificationId']=uuid['v4']();this[_0x6e93('0x3')]=_0x135340;this['agent']=_0x55f540;this[_0x6e93('0x4')]=_0x155efa;this[_0x6e93('0x5')]=_0x1e1f5a;this[_0x6e93('0x3')][_0x6e93('0x6')](this[_0x6e93('0x7')][_0x6e93('0x8')](this),this[_0x6e93('0x9')][_0x6e93('0x8')](this));this[_0x6e93('0x3')]['on'](_0x6e93('0xa'),this['handleTimeout'][_0x6e93('0x8')](this));this[_0x6e93('0x3')]['on'](_0x6e93('0xb'),this['handleDrained'][_0x6e93('0x8')](this));};Agent[_0x6e93('0xc')]['push']=function(){this['squeue']['push'](this['handleRun'][_0x6e93('0x8')](this),this[_0x6e93('0x9')]['bind'](this));};Agent[_0x6e93('0xc')][_0x6e93('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x6e93('0xc')][_0x6e93('0x7')]=function(_0x2322c5){logger[_0x6e93('0xe')](_0x6e93('0xf'),this[_0x6e93('0x3')]['id'],this[_0x6e93('0x10')]['id']);if(_[_0x6e93('0x11')](this[_0x6e93('0x4')]['agents'][this[_0x6e93('0x10')]['id']])){logger['info'](_0x6e93('0x12'),this[_0x6e93('0x3')]['id'],this['agent']['id']);setTimeout(this[_0x6e93('0x6')][_0x6e93('0x8')](this),0x3e8);}else{if(this[_0x6e93('0x5')]['forcedOwnership']||util['isAgentAvailable'](this[_0x6e93('0x3')]['id'],this['realtime'][_0x6e93('0x13')][this[_0x6e93('0x10')]['id']],this[_0x6e93('0x3')][_0x6e93('0x14')],![])){this[_0x6e93('0x4')]['agents'][this[_0x6e93('0x10')]['id']][_0x6e93('0x15')]=!![];this[_0x6e93('0x4')][_0x6e93('0x13')][this[_0x6e93('0x10')]['id']][_0x6e93('0x16')]=undefined;util['showNotification'](this[_0x6e93('0x17')],this[_0x6e93('0x3')]['id'],this[_0x6e93('0x4')][_0x6e93('0x13')][this[_0x6e93('0x10')]['id']],null,this[_0x6e93('0x5')]);util[_0x6e93('0x18')](this[_0x6e93('0x3')]['id'],this['realtime']['agents'][this[_0x6e93('0x10')]['id']],_0x6e93('0x19')+(this[_0x6e93('0x5')][_0x6e93('0x1a')]?_0x6e93('0x1b'):''));}else{logger[_0x6e93('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x6e93('0x3')]['id'],this[_0x6e93('0x10')]['id']);setTimeout(this['push'][_0x6e93('0x8')](this),0x3e8);}}};Agent[_0x6e93('0xc')][_0x6e93('0x9')]=function(_0x348d60){if(_[_0x6e93('0x11')](this[_0x6e93('0x4')]['agents'][this[_0x6e93('0x10')]['id']])){return logger['info'](_0x6e93('0x12'),this[_0x6e93('0x3')]['id'],this['agent']['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x6e93('0x3')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0x6e93('0x3')]['id'],this[_0x6e93('0x4')][_0x6e93('0x13')][this[_0x6e93('0x10')]['id']],null,this[_0x6e93('0x5')]);this[_0x6e93('0x4')]['agents'][this['agent']['id']]['busy']=![];this[_0x6e93('0x4')][_0x6e93('0x13')][this[_0x6e93('0x10')]['id']]['busyQueue']=undefined;util[_0x6e93('0x18')](this[_0x6e93('0x3')]['id'],this[_0x6e93('0x4')]['agents'][this['agent']['id']],_0x348d60?'STOP':'TIMEOUT');}if(!_0x348d60){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x3a10e5,_0x287955,_0x361884,_0x4c6411){return new Agent(_0x3a10e5,_0x287955,_0x361884,_0x4c6411);}module[_0x6e93('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 7cc4448..ef96463 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 _0x31ad=['queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','RINGING','busy','busyQueue','showNotification','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','lodash','notificationId','squeue','realtime','bind','handleTimeout','drained','handleDrained','prototype','push','handleRun','isNil'];(function(_0x5b2175,_0x386e36){var _0x324e1a=function(_0x43d124){while(--_0x43d124){_0x5b2175['push'](_0x5b2175['shift']());}};_0x324e1a(++_0x386e36);}(_0x31ad,0x138));var _0xd31a=function(_0x56b3df,_0x4af22c){_0x56b3df=_0x56b3df-0x0;var _0x5d660a=_0x31ad[_0x56b3df];return _0x5d660a;};'use strict';var _=require(_0xd31a('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x15b151,_0x2d4e54,_0x1d26a0,_0x13f247){this[_0xd31a('0x1')]=uuid['v4']();this[_0xd31a('0x2')]=_0x15b151;this['queue']=_0x2d4e54;this[_0xd31a('0x3')]=_0x1d26a0;this['routing']=_0x13f247;this[_0xd31a('0x2')]['push'](this['handleRun'][_0xd31a('0x4')](this),this['handleTimeout']['bind'](this));this[_0xd31a('0x2')]['on']('timeout',this[_0xd31a('0x5')][_0xd31a('0x4')](this));this[_0xd31a('0x2')]['on'](_0xd31a('0x6'),this[_0xd31a('0x7')][_0xd31a('0x4')](this));};Beepall[_0xd31a('0x8')]['push']=function(){this[_0xd31a('0x2')][_0xd31a('0x9')](this[_0xd31a('0xa')][_0xd31a('0x4')](this),this[_0xd31a('0x5')][_0xd31a('0x4')](this));};Beepall[_0xd31a('0x8')][_0xd31a('0x7')]=function(_0x29f4e1){this[_0xd31a('0x5')](!![]);};Beepall[_0xd31a('0x8')][_0xd31a('0xa')]=function(_0x1e7a77){var _0x32cff8=!![];if(!_[_0xd31a('0xb')](this[_0xd31a('0xc')])&&!_[_0xd31a('0xb')](this['queue'][_0xd31a('0xd')])&&this[_0xd31a('0xc')][_0xd31a('0xd')][_0xd31a('0xe')]>0x0){for(var _0x4ad993=0x0,_0x54f82a;_0x4ad9930x0){for(var _0x9b8874=0x0,_0x381182;_0x9b88740x0&&_0x2cd10b[_0x44e36d+_0x2819('0x28')]>=_0x2cd10b[_0x44e36d+_0x2819('0x27')]){writeLog(_0x6b289,_0x2cd10b,_0x44e36d[_0x2819('0x29')]()+_0x2819('0x2a'));return![];}}return!![];};exports['showNotification']=function(_0x2d4182,_0x52b706,_0x6ab982,_0x37cd96,_0x5a6c84){return sendNotification(!![],_0x2d4182,_0x52b706,_0x6ab982,_0x37cd96,_0x5a6c84);};exports['hideNotification']=function(_0xc051cb,_0x54bb97,_0x492841,_0x5f1f14,_0x5f0c31){return sendNotification(![],_0xc051cb,_0x54bb97,_0x492841,_0x5f1f14,_0x5f0c31);};exports[_0x2819('0x2b')]=writeLog; \ No newline at end of file +var _0xc8de=['user:%s','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','emit','format'];(function(_0x12f35e,_0x3e8775){var _0x392533=function(_0x504e75){while(--_0x504e75){_0x12f35e['push'](_0x12f35e['shift']());}};_0x392533(++_0x3e8775);}(_0xc8de,0x167));var _0xec8d=function(_0x656071,_0x1cb124){_0x656071=_0x656071-0x0;var _0x11afdb=_0xc8de[_0x656071];return _0x11afdb;};'use strict';var _=require('lodash');var util=require(_0xec8d('0x0'));var utils=require(_0xec8d('0x1'));var Mustache=require('mustache');var Redis=require('ioredis');var config=require(_0xec8d('0x2'));var logger=require(_0xec8d('0x3'))(_0xec8d('0x4'));config[_0xec8d('0x5')]=_[_0xec8d('0x6')](config[_0xec8d('0x5')],{'host':_0xec8d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xec8d('0x5')]));function emit(_0x55e36c,_0x11308b,_0x596921){io['to'](_0x55e36c)[_0xec8d('0x8')](_0x11308b,_0x596921);}function sendNotification(_0x597c70,_0x37ec77,_0x53b6dd,_0x2e028d,_0x1824d6,_0x1898be){io['to'](util[_0xec8d('0x9')](_0xec8d('0xa'),_0x2e028d[_0xec8d('0xb')]))[_0xec8d('0x8')](_0xec8d('0xc'),_0x2e028d);var _0x3d9bb4=_0x1898be||{};var _0x204876=_0x53b6dd['split']('.');var _0x7f7829={'uniqueid':_0x37ec77,'channel':_0x204876[0x0],'id':_0x204876[0x1],'title':_0x204876[0x0]+_0xec8d('0xd'),'interactionId':_0x204876[0x2],'queue':_0x1824d6?_0x1824d6[_0xec8d('0xb')]:null,'sound':_0x3d9bb4[_0xec8d('0xe')][_0xec8d('0xf')],'shake':_0x3d9bb4[_0xec8d('0xe')][_0xec8d('0x10')]};try{if(!_0x3d9bb4[_0xec8d('0x11')]){_0x3d9bb4[_0xec8d('0x11')]={};}if(_0x1824d6){_0x3d9bb4[_0xec8d('0x11')][_0xec8d('0x12')]=_0x1824d6;}else if(_0x3d9bb4[_0xec8d('0x11')]['queue']){delete _0x3d9bb4[_0xec8d('0x11')][_0xec8d('0x12')];}_0x7f7829[_0xec8d('0x13')]=utils[_0xec8d('0x14')](_0x3d9bb4['account'][_0xec8d('0x15')],_0x3d9bb4);}catch(_0x4b050b){_0x7f7829['msg']=_0xec8d('0x16');logger[_0xec8d('0x17')](util['format'](_0xec8d('0x18'),_0x37ec77,_0x4b050b[_0xec8d('0x19')]));}io['to'](util[_0xec8d('0x9')](_0xec8d('0xa'),_0x2e028d['name']))['emit'](util[_0xec8d('0x9')]('notification:%s',_0x597c70?_0xec8d('0x1a'):_0xec8d('0x1b')),_0x7f7829);}function writeLog(_0x83ee70,_0x571c4f,_0x52e5c7){return logger['info'](util['format'](_0xec8d('0x1c'),_0x83ee70,_0x571c4f[_0xec8d('0xb')],_0x52e5c7));}exports['isAgentAvailable']=function(_0x21a35b,_0x16d696,_0x252d96,_0x5b6f89){if(_0x16d696[_0xec8d('0x1d')]){writeLog(_0x21a35b,_0x16d696,_0xec8d('0x1e'));return![];}if(!_0x16d696['online']){writeLog(_0x21a35b,_0x16d696,_0xec8d('0x1f'));return![];}if(_0x16d696[_0x252d96+_0xec8d('0x20')]){writeLog(_0x21a35b,_0x16d696,_0xec8d('0x21'));return![];}if(_0x5b6f89&&_0x16d696[_0xec8d('0x22')](_0x252d96+_0xec8d('0x23'))&&_0x16d696[_0xec8d('0x22')](_0x252d96+'CurrentCapacity')){if(_0x16d696[_0x252d96+_0xec8d('0x23')]>0x0&&_0x16d696[_0x252d96+_0xec8d('0x24')]>=_0x16d696[_0x252d96+'Capacity']){writeLog(_0x21a35b,_0x16d696,_0x252d96[_0xec8d('0x25')]()+_0xec8d('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x2791b2,_0x33433c,_0x2723b7,_0x16b791,_0x5ea99d){return sendNotification(!![],_0x2791b2,_0x33433c,_0x2723b7,_0x16b791,_0x5ea99d);};exports[_0xec8d('0x27')]=function(_0x2da751,_0x5de0ec,_0x5946ec,_0x41e264,_0x5f347f){return sendNotification(![],_0x2da751,_0x5de0ec,_0x5946ec,_0x41e264,_0x5f347f);};exports[_0xec8d('0x28')]=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 a23546d..d077e90 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 _0x419a=['isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x419a,0xfa));var _0xa419=function(_0x68108d,_0x3bc0d1){_0x68108d=_0x68108d-0x0;var _0x32fafe=_0x419a[_0x68108d];return _0x32fafe;};'use strict';var schema=require(_0xa419('0x0'));var sh=require(_0xa419('0x1'));var _=require(_0xa419('0x2'));var utils=require(_0xa419('0x3'));var logger=require(_0xa419('0x4'))(_0xa419('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa419('0x6')]=function(_0x3dcfa6,_0x4ff88d){return function(_0x4e5434){try{var _0x4ac267={'command':_0x4ff88d[0x0]};var _0x5292e8=system[_0xa419('0x0')](_0x4ac267,{'typecast':!![]});if(_0x5292e8['length']){logger[_0xa419('0x7')](_0xa419('0x8'),_0x3dcfa6,_[_0xa419('0x9')](_0x5292e8,_0xa419('0xa'))[_0xa419('0xb')](',\x20'));logger[_0xa419('0xc')](_0xa419('0xd'),_0x3dcfa6);_0x4e5434['next']();}else{var _0x195213=this;var _0x9d8103=utils[_0xa419('0xe')](_0x4ff88d[0x0],this);logger[_0xa419('0xc')](_0xa419('0xf'),_0x3dcfa6,_0x9d8103);sh[_0xa419('0x10')](_[_0xa419('0x11')](_0x9d8103),function(_0x5b63b4,_0x3d18dc){logger[_0xa419('0xc')](_0xa419('0x12'),_0x3dcfa6,_0x5b63b4);if(_0x5b63b4==0x0){var _0x1b0673=_0x3d18dc[_0xa419('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xa419('0x14')](_0x4ff88d[0x1])||_[_0xa419('0x15')](_0x4ff88d[0x1])){logger[_0xa419('0xc')](_0xa419('0x16'),_0x3dcfa6);_0x195213[_0xa419('0x17')][_0x4ff88d[0x1]]=_0x1b0673;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3dcfa6,_0x4ff88d[0x1],_0x1b0673);_0x195213[_0xa419('0x17')][_0x4ff88d[0x1]]=_0x1b0673;}}_0x4e5434[_0xa419('0x18')]();});}}catch(_0x96e119){logger[_0xa419('0x7')](_0xa419('0x8'),_0x3dcfa6,_[_0xa419('0x19')](_0x96e119)?JSON[_0xa419('0x1a')](_0x96e119):_0x96e119);logger[_0xa419('0xc')](_0xa419('0xd'),_0x3dcfa6);_0x4e5434[_0xa419('0x18')]();}};}; \ No newline at end of file +var _0x8e08=['message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','next','stringify','validate','shelljs','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s'];(function(_0x48577e,_0x2f1da5){var _0x3f0308=function(_0xbb1851){while(--_0xbb1851){_0x48577e['push'](_0x48577e['shift']());}};_0x3f0308(++_0x2f1da5);}(_0x8e08,0x18e));var _0x88e0=function(_0x47dd3e,_0x478610){_0x47dd3e=_0x47dd3e-0x0;var _0x3ea695=_0x8e08[_0x47dd3e];return _0x3ea695;};'use strict';var schema=require(_0x88e0('0x0'));var sh=require(_0x88e0('0x1'));var _=require('lodash');var utils=require(_0x88e0('0x2'));var logger=require(_0x88e0('0x3'))('routing');var system=schema({'command':{'type':_0x88e0('0x4'),'required':!![],'message':_0x88e0('0x5')}});exports[_0x88e0('0x6')]=function(_0x2d3ac8,_0x5019fc){return function(_0x68f303){try{var _0x36d321={'command':_0x5019fc[0x0]};var _0x13fb79=system['validate'](_0x36d321,{'typecast':!![]});if(_0x13fb79[_0x88e0('0x7')]){logger[_0x88e0('0x8')](_0x88e0('0x9'),_0x2d3ac8,_['map'](_0x13fb79,_0x88e0('0xa'))[_0x88e0('0xb')](',\x20'));logger[_0x88e0('0xc')](_0x88e0('0xd'),_0x2d3ac8);_0x68f303['next']();}else{var _0x42b6e8=this;var _0x19c6e3=utils[_0x88e0('0xe')](_0x5019fc[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x2d3ac8,_0x19c6e3);sh[_0x88e0('0xf')](_[_0x88e0('0x10')](_0x19c6e3),function(_0x5a4356,_0x5140b6){logger[_0x88e0('0xc')](_0x88e0('0x11'),_0x2d3ac8,_0x5a4356);if(_0x5a4356==0x0){var _0x508d86=_0x5140b6[_0x88e0('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x88e0('0x13')](_0x5019fc[0x1])||_['isEmpty'](_0x5019fc[0x1])){logger[_0x88e0('0xc')](_0x88e0('0x14'),_0x2d3ac8);_0x42b6e8[_0x88e0('0x15')][_0x5019fc[0x1]]=_0x508d86;}else{logger[_0x88e0('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2d3ac8,_0x5019fc[0x1],_0x508d86);_0x42b6e8[_0x88e0('0x15')][_0x5019fc[0x1]]=_0x508d86;}}_0x68f303[_0x88e0('0x16')]();});}}catch(_0x15c414){logger['error'](_0x88e0('0x9'),_0x2d3ac8,_['isObject'](_0x15c414)?JSON[_0x88e0('0x17')](_0x15c414):_0x15c414);logger[_0x88e0('0xc')](_0x88e0('0xd'),_0x2d3ac8);_0x68f303[_0x88e0('0x16')]();}};}; \ 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 fa89622..8ee04ca 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 _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0xebbc39,_0x427a35){var _0x5892df=function(_0xdbc14a){while(--_0xdbc14a){_0xebbc39['push'](_0xebbc39['shift']());}};_0x5892df(++_0x427a35);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ No newline at end of file +var _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 69c9323..7172377 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 _0xfa68=['message','account','interaction','list','mustache','lodash','exports','render','merge','contact'];(function(_0x373a67,_0x1eb273){var _0x2ad656=function(_0xc91702){while(--_0xc91702){_0x373a67['push'](_0x373a67['shift']());}};_0x2ad656(++_0x1eb273);}(_0xfa68,0x86));var _0x8fa6=function(_0x4a7787,_0x277adf){_0x4a7787=_0x4a7787-0x0;var _0x2baa34=_0xfa68[_0x4a7787];return _0x2baa34;};'use strict';var Mustache=require(_0x8fa6('0x0'));var _=require(_0x8fa6('0x1'));module[_0x8fa6('0x2')]={'getMustacheRender':function(_0x4d2bf8,_0x16029c){return Mustache[_0x8fa6('0x3')](_0x4d2bf8,_[_0x8fa6('0x4')](_0x16029c['body'],{'contact':_0x16029c[_0x8fa6('0x5')],'message':_0x16029c[_0x8fa6('0x6')],'account':_0x16029c[_0x8fa6('0x7')],'interaction':_0x16029c[_0x8fa6('0x8')],'list':_0x16029c[_0x8fa6('0x9')]}))||'';}}; \ No newline at end of file +var _0x195e=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x320054,_0x38a1f1){var _0x47465b=function(_0x5b646){while(--_0x5b646){_0x320054['push'](_0x320054['shift']());}};_0x47465b(++_0x38a1f1);}(_0x195e,0xfb));var _0xe195=function(_0x25602d,_0x3341b9){_0x25602d=_0x25602d-0x0;var _0x24bac8=_0x195e[_0x25602d];return _0x24bac8;};'use strict';var Mustache=require(_0xe195('0x0'));var _=require(_0xe195('0x1'));module[_0xe195('0x2')]={'getMustacheRender':function(_0x1cf8e2,_0x40fe4d){return Mustache[_0xe195('0x3')](_0x1cf8e2,_[_0xe195('0x4')](_0x40fe4d[_0xe195('0x5')],{'contact':_0x40fe4d[_0xe195('0x6')],'message':_0x40fe4d[_0xe195('0x7')],'account':_0x40fe4d[_0xe195('0x8')],'interaction':_0x40fe4d[_0xe195('0x9')],'list':_0x40fe4d[_0xe195('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 5d6addd..53f6fbf 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 _0x2429=['.js','toLowerCase','autoreply','appdata','push','amazonlex','slice','message','tag','TagId','split','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','emit','end','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','waiting','openchannelQueues','name','smsQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','interaction','isArray','applications','length','existsSync','join','app'];(function(_0x28ae0a,_0x5baa23){var _0x5102b2=function(_0x1ad4be){while(--_0x1ad4be){_0x28ae0a['push'](_0x28ae0a['shift']());}};_0x5102b2(++_0x5baa23);}(_0x2429,0x9c));var _0x9242=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x2429[_0xd67723];return _0x53b62b;};'use strict';var _=require('lodash');var util=require(_0x9242('0x0'));var path=require(_0x9242('0x1'));var fs=require('fs');var jayson=require(_0x9242('0x2'));var BPromise=require(_0x9242('0x3'));var uuid=require(_0x9242('0x4'));var config=require(_0x9242('0x5'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x9242('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9242('0x7')),'faxQueueReport':require(_0x9242('0x8'))};var RuleEngine=require(_0x9242('0x9'));function getId(_0xe8088e,_0x549611,_0x12ab67){return util['format'](_0x9242('0xa'),_0xe8088e,_0x549611||0x0,_0x12ab67||0x0);}function getIntervals(_0x41d6e4,_0x35b6c1){var _0xfdbade=[];if(!_[_0x9242('0xb')](_0x35b6c1[_0x9242('0xc')])&&!_[_0x9242('0xb')](_0x41d6e4[_0x35b6c1[_0x9242('0xc')]])&&!_[_0x9242('0xb')](_0x41d6e4[_0x35b6c1[_0x9242('0xc')]][_0x9242('0xd')])){_0xfdbade=_[_0x9242('0xe')](_0x41d6e4[_0x35b6c1[_0x9242('0xc')]][_0x9242('0xd')],_0x9242('0xf'));}else if(!_[_0x9242('0xb')](_0x35b6c1[_0x9242('0xf')])){_0xfdbade=[_0x35b6c1[_0x9242('0xf')]];}return _0xfdbade;}exports[_0x9242('0x10')]=function(_0xcb816d){_0xcb816d[_0x9242('0x11')]={};return new BPromise(function(_0x2d2520,_0x484fb5){var _0x3d8058={'Start':function(_0x4b3cb5){var _0x598353=this;return new Promise(function(_0x2bb62b,_0x283b6f){if(_0x4b3cb5){try{var _0x667ad2=[];var _0x2f501e=getId(_0x4b3cb5[_0x9242('0x12')],_0x4b3cb5['message']?_0x4b3cb5['message']['id']:0x0,_0x4b3cb5[_0x9242('0x13')]?_0x4b3cb5[_0x9242('0x13')]['id']:0x0);if(_0x4b3cb5['applications']&&_[_0x9242('0x14')](_0x4b3cb5['applications'])&&_0x4b3cb5[_0x9242('0x15')][_0x9242('0x16')]){for(var _0x4dea78=0x0;_0x4dea78<_0x4b3cb5[_0x9242('0x15')][_0x9242('0x16')];_0x4dea78+=0x1){var _0x230551=_0x4b3cb5[_0x9242('0x15')][_0x4dea78];if(fs[_0x9242('0x17')](path[_0x9242('0x18')](__dirname,'applications',_0x230551[_0x9242('0x19')]+_0x9242('0x1a')))){var _0xcee82f=[];switch(_0x230551['app'][_0x9242('0x1b')]()){case _0x9242('0x1c'):var _0x5bd581=_0x230551[_0x9242('0x1d')]['split'](',');_0xcee82f[_0x9242('0x1e')](_0x5bd581[0x0]);_0xcee82f['push'](_0x5bd581['slice'](0x1,_0x5bd581['length'])[_0x9242('0x18')](','));break;case'dialogflow':var _0x5bd581=_0x230551[_0x9242('0x1d')]['split'](',');_0xcee82f[_0x9242('0x1e')](_0x5bd581[0x0]);_0xcee82f[_0x9242('0x1e')](_0x5bd581[0x1]);_0xcee82f[_0x9242('0x1e')](_0x5bd581['slice'](0x2,_0x5bd581['length'])[_0x9242('0x18')](','));break;case _0x9242('0x1f'):var _0x5bd581=_0x230551[_0x9242('0x1d')]['split'](',');_0xcee82f[_0x9242('0x1e')](_0x5bd581[0x0]);_0xcee82f[_0x9242('0x1e')](_0x5bd581[0x1]);_0xcee82f['push'](_0x5bd581[0x2]);_0xcee82f[_0x9242('0x1e')](_0x5bd581[0x3]);_0xcee82f[_0x9242('0x1e')](_0x5bd581[_0x9242('0x20')](0x4,_0x5bd581[_0x9242('0x16')])[_0x9242('0x18')](','));break;case _0x9242('0x21'):_0xcee82f['push'](_0x230551['appdata']);break;case _0x9242('0x22'):_0xcee82f['push'](_0x230551[_0x9242('0x23')]);_0xcee82f['push'](_0x230551[_0x9242('0x1d')]);break;default:_0xcee82f=_[_0x9242('0xb')](_0x230551[_0x9242('0x1d')])?[]:_0x230551[_0x9242('0x1d')][_0x9242('0x24')](',');}var _0x520b99={'id':util['format']('%s:%s:%s',_0x2f501e,_0x230551['id'],_0x230551[_0x9242('0x19')]),'condition':require(_0x9242('0x25'))[_0x9242('0x26')](_0x2f501e,getIntervals(_0xcb816d[_0x9242('0x27')],_0x230551),_0xcb816d),'consequence':require(_0x9242('0x28')+_0x230551[_0x9242('0x19')])['consequence'](_0x2f501e,_0xcee82f,_0xcb816d,_0x4b3cb5),'p':_0x230551[_0x9242('0x29')]||0x0};logger[_0x9242('0x2a')](_0x9242('0x2b'),_0x520b99['id'],_0x9242('0x2c'),getIntervals(_0xcb816d['intervals'],_0x230551)['join'](_0x9242('0x2d')));_0x667ad2[_0x9242('0x1e')](_0x520b99);}else{logger[_0x9242('0x2e')](_0x9242('0x2f'),path[_0x9242('0x18')](__dirname,_0x9242('0x15'),_0x230551[_0x9242('0x19')]+_0x9242('0x1a')));}}_0xcb816d[_0x9242('0x11')][_0x2f501e]=new RuleEngine(_0x667ad2);_0xcb816d[_0x9242('0x11')][_0x2f501e][_0x9242('0x30')](_0x4b3cb5,function(_0x23df29){logger[_0x9242('0x2a')]('Applications\x20executed',JSON[_0x9242('0x31')](_0x23df29['matchPath']));if(_0xcb816d['rules'][_0x2f501e]){_0xcb816d['rules'][_0x2f501e][_0x9242('0x32')](_0x9242('0x33'));}});return _0x2bb62b({'code':0xc8,'message':_0x4b3cb5});}else{logger['info'](_0x9242('0x34'));return _0x2bb62b({'code':0xc8,'message':_0x4b3cb5});}}catch(_0x466edd){logger[_0x9242('0x2e')](_0x466edd[_0x9242('0x35')]);return _0x283b6f(_0x598353[_0x9242('0x2e')](0x1f4,_0x466edd));}}return _0x283b6f(_0x9242('0x36'));});},'AcceptMessage':function(_0x52a6a6){var _0x32c700=this;return new Promise(function(_0x3ddcab,_0x41f1a9){if(_0x52a6a6[_0x9242('0x21')]&&_0x52a6a6['message']['id']){try{var _0x961d67=getId(_0x52a6a6['channel'],_0x52a6a6[_0x9242('0x21')]?_0x52a6a6[_0x9242('0x21')]['id']:0x0,_0x52a6a6['interaction']?_0x52a6a6[_0x9242('0x13')]['id']:0x0);if(_0xcb816d[_0x9242('0x11')][_0x961d67]){_0xcb816d[_0x9242('0x11')][_0x961d67][_0x9242('0x32')](_0x9242('0x33'));if(rpc[_0x52a6a6['channel']+_0x9242('0x37')]){rpc[_0x52a6a6[_0x9242('0x12')]+_0x9242('0x37')][_0x9242('0x38')](_0x961d67,{'UserId':_0x52a6a6[_0x9242('0x21')][_0x9242('0x39')]})[_0x9242('0x3a')](function(_0x225058){logger['error'](_0x9242('0x3b'));});}}return _0x3ddcab({'code':0xc8,'message':_0x52a6a6});}catch(_0x500ecf){logger[_0x9242('0x2e')](_0x500ecf[_0x9242('0x35')]);return _0x41f1a9(_0x32c700[_0x9242('0x2e')](0x1f4,_0x500ecf));}}logger[_0x9242('0x2e')](_0x9242('0x3c'));return _0x41f1a9(_0x32c700[_0x9242('0x2e')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x4597aa){var _0x298696=this;return new Promise(function(_0x462b73,_0x3727af){if(_0x4597aa[_0x9242('0x3d')]&&_0x4597aa[_0x9242('0x3d')]['id']){try{if(_0xcb816d[_0x9242('0x3e')][_0x4597aa[_0x9242('0x3d')]['id']]){_0xcb816d[_0x9242('0x3e')][_0x4597aa[_0x9242('0x3d')]['id']][_0x9242('0x3f')]=![];_0xcb816d[_0x9242('0x3e')][_0x4597aa[_0x9242('0x3d')]['id']][_0x9242('0x40')]=undefined;}return _0x462b73({'code':0xc8,'message':_0x4597aa});}catch(_0x48acb7){logger['error'](_0x48acb7[_0x9242('0x35')]);return _0x3727af(_0x298696['error'](0x1f4,_0x48acb7));}}logger[_0x9242('0x2e')]('message\x20is\x20empty');return _0x3727af(_0x298696['error'](0x1f4,_0x9242('0x3c')));});},'AbandonInteraction':function(_0x2a5b8a){var _0x176caa=this;return new Promise(function(_0x4a2b4c,_0x5d5829){if(_0x2a5b8a['channel']&&_0x2a5b8a[_0x9242('0x13')]&&_0x2a5b8a[_0x9242('0x13')]['id']){try{var _0x136959=getId(_0x2a5b8a[_0x9242('0x12')],_0x2a5b8a[_0x9242('0x21')]?_0x2a5b8a['message']['id']:0x0,_0x2a5b8a[_0x9242('0x13')]?_0x2a5b8a[_0x9242('0x13')]['id']:0x0);if(_0xcb816d[_0x9242('0x11')][_0x136959]){_0xcb816d[_0x9242('0x11')][_0x136959][_0x9242('0x32')]('end');}return _0x4a2b4c({'code':0xc8,'message':_0x2a5b8a});}catch(_0x238ed1){logger['error'](_0x238ed1[_0x9242('0x35')]);return _0x5d5829(_0x176caa[_0x9242('0x2e')](0x1f4,_0x238ed1));}}logger['error'](_0x9242('0x3c'));return _0x5d5829(_0x176caa[_0x9242('0x2e')](0x1f4,_0x9242('0x3c')));});},'AgentCapacity':function(_0x3868c8){var _0x47423a=this;return new Promise(function(_0x11d0a5,_0x53c63e){if(_0xcb816d[_0x9242('0x3e')][_0x9242('0x41')](_0x3868c8['id'])){for(var _0x18113d in _0x3868c8['capacity']){if(_0x3868c8[_0x9242('0x42')][_0x9242('0x41')](_0x18113d)){if(_0xcb816d[_0x9242('0x3e')][_0x3868c8['id']][_0x9242('0x41')](_0x18113d+'CurrentCapacity')){_0xcb816d[_0x9242('0x3e')][_0x3868c8['id']][_0x18113d+_0x9242('0x43')]=parseInt(_0x3868c8['capacity'][_0x18113d],0xa);}}}_0xcb816d[_0x9242('0x3e')][_0x3868c8['id']][_0x9242('0x44')]();return _0x11d0a5({'code':0xc8,'message':_0xcb816d[_0x9242('0x3e')][_0x3868c8['id']]});}else{return _0x53c63e(_0x47423a[_0x9242('0x2e')](0x1f4,_0x9242('0x45')));}});},'Agents':function(_0x4de0ec){return new Promise(function(_0x215a9e,_0x48d4d7){var _0x3147c9=_[_0x9242('0x46')](_0xcb816d['agents']);_0x215a9e({'count':_0x3147c9[_0x9242('0x16')],'rows':_0x3147c9});});},'ChatQueues':function(_0x3856db){return new Promise(function(_0x22188b,_0xa64ccf){var _0x29e4f4=[];for(var _0x4266ea in _0xcb816d[_0x9242('0x47')]){if(_0xcb816d[_0x9242('0x47')][_0x9242('0x41')](_0x4266ea)){var _0xa4784e=_0xcb816d[_0x9242('0x47')][_0x4266ea];var _0x101256={'id':_0xa4784e['id'],'available':_0xa4784e[_0x9242('0x48')],'loggedIn':_0xa4784e[_0x9242('0x49')],'name':_0xa4784e['name'],'paused':_0xa4784e[_0x9242('0x4a')],'waiting':_0xa4784e['waiting']};_0x29e4f4[_0x9242('0x1e')](_0x101256);}}_0x22188b({'count':_0x29e4f4[_0x9242('0x16')],'rows':_0x29e4f4});});},'MailQueues':function(_0x5337e5){return new Promise(function(_0x19b76c,_0x377280){var _0x5dc99a=[];for(var _0x57da81 in _0xcb816d[_0x9242('0x4b')]){if(_0xcb816d[_0x9242('0x4b')][_0x9242('0x41')](_0x57da81)){var _0x348fb4=_0xcb816d[_0x9242('0x4b')][_0x57da81];var _0x5c2a18={'id':_0x348fb4['id'],'available':_0x348fb4[_0x9242('0x48')],'loggedIn':_0x348fb4[_0x9242('0x49')],'name':_0x348fb4['name'],'paused':_0x348fb4[_0x9242('0x4a')],'waiting':_0x348fb4[_0x9242('0x4c')]};_0x5dc99a[_0x9242('0x1e')](_0x5c2a18);}}_0x19b76c({'count':_0x5dc99a[_0x9242('0x16')],'rows':_0x5dc99a});});},'OpenchannelQueues':function(_0x2d230c){return new Promise(function(_0x3e23fe,_0x5de05b){var _0x4951b9=[];for(var _0x2abbab in _0xcb816d[_0x9242('0x4d')]){if(_0xcb816d['openchannelQueues'][_0x9242('0x41')](_0x2abbab)){var _0xc2b59f=_0xcb816d[_0x9242('0x4d')][_0x2abbab];var _0x34063a={'id':_0xc2b59f['id'],'available':_0xc2b59f['available'],'loggedIn':_0xc2b59f['loggedIn'],'name':_0xc2b59f[_0x9242('0x4e')],'paused':_0xc2b59f['paused'],'waiting':_0xc2b59f[_0x9242('0x4c')]};_0x4951b9[_0x9242('0x1e')](_0x34063a);}}_0x3e23fe({'count':_0x4951b9[_0x9242('0x16')],'rows':_0x4951b9});});},'SmsQueues':function(_0x4224b7){return new Promise(function(_0x1e9a5c,_0x425ad7){var _0x424fd6=[];for(var _0x2c1be0 in _0xcb816d[_0x9242('0x4f')]){if(_0xcb816d[_0x9242('0x4f')][_0x9242('0x41')](_0x2c1be0)){var _0x1066d4=_0xcb816d[_0x9242('0x4f')][_0x2c1be0];var _0x1a5ce9={'id':_0x1066d4['id'],'available':_0x1066d4[_0x9242('0x48')],'loggedIn':_0x1066d4[_0x9242('0x49')],'name':_0x1066d4['name'],'paused':_0x1066d4[_0x9242('0x4a')],'waiting':_0x1066d4[_0x9242('0x4c')]};_0x424fd6[_0x9242('0x1e')](_0x1a5ce9);}}_0x1e9a5c({'count':_0x424fd6[_0x9242('0x16')],'rows':_0x424fd6});});},'FaxQueues':function(_0x124bdd){return new Promise(function(_0x1455b0,_0x3544ab){var _0x17d279=[];for(var _0x3a72e2 in _0xcb816d[_0x9242('0x50')]){if(_0xcb816d[_0x9242('0x50')]['hasOwnProperty'](_0x3a72e2)){var _0x22cda9=_0xcb816d[_0x9242('0x50')][_0x3a72e2];var _0x2e802b={'id':_0x22cda9['id'],'available':_0x22cda9[_0x9242('0x48')],'loggedIn':_0x22cda9['loggedIn'],'name':_0x22cda9['name'],'paused':_0x22cda9['paused'],'waiting':_0x22cda9['waiting']};_0x17d279['push'](_0x2e802b);}}_0x1455b0({'count':_0x17d279[_0x9242('0x16')],'rows':_0x17d279});});},'ChatQueuesWaitingInteractions':function(_0x9566df){return new Promise(function(_0x16b1d0,_0x352aa8){var _0xf7ab86=_[_0x9242('0x46')](_0xcb816d[_0x9242('0x51')]);_0x16b1d0({'count':_0xf7ab86[_0x9242('0x16')],'rows':_0xf7ab86});});},'MailQueuesWaitingInteractions':function(_0xb676c8){return new Promise(function(_0x2e7553,_0x1f1fdd){var _0x8355f0=_[_0x9242('0x46')](_0xcb816d['mailQueuesWaitingInteractions']);_0x2e7553({'count':_0x8355f0[_0x9242('0x16')],'rows':_0x8355f0});});},'OpenchannelQueuesWaitingInteractions':function(_0x53c2c3){return new Promise(function(_0xb5a79e,_0x86daae){var _0xfaa585=_[_0x9242('0x46')](_0xcb816d[_0x9242('0x52')]);_0xb5a79e({'count':_0xfaa585[_0x9242('0x16')],'rows':_0xfaa585});});},'SmsQueuesWaitingInteractions':function(_0x49c06d){return new Promise(function(_0x57156c,_0x3d9b11){var _0x2ad7d7=_[_0x9242('0x46')](_0xcb816d[_0x9242('0x53')]);_0x57156c({'count':_0x2ad7d7[_0x9242('0x16')],'rows':_0x2ad7d7});});},'FaxQueuesWaitingInteractions':function(_0x522b58){return new Promise(function(_0x3f3eee,_0xa5eed){var _0x5ee968=_[_0x9242('0x46')](_0xcb816d[_0x9242('0x54')]);_0x3f3eee({'count':_0x5ee968[_0x9242('0x16')],'rows':_0x5ee968});});}};var _0x50b627=jayson[_0x9242('0x55')](_0x3d8058)[_0x9242('0x56')]();_0x50b627['on'](_0x9242('0x2e'),function(_0x316fbe){logger[_0x9242('0x2e')](JSON[_0x9242('0x31')](_0x316fbe));return _0x484fb5(_0x316fbe);});_0x50b627['listen'](0x232c,_0x9242('0x57'),function(){console[_0x9242('0x58')](_0x9242('0x59'),0x232c);return _0x2d2520(_0x9242('0x5a')+0x232c);});});}; \ No newline at end of file +var _0x9f00=['waiting','openchannelQueues','smsQueues','loggedIn','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','format','isNil','IntervalId','Intervals','interval','channel','message','interaction','applications','isArray','length','join','app','.js','autoreply','appdata','push','slice','dialogflow','split','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','\x20|\x20','error','rules','execute','Applications\x20executed','stringify','matchPath','emit','end','stack','routing\x20is\x20empty','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','mailQueues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f00,0x68));var _0x09f0=function(_0x16d911,_0x4026a1){_0x16d911=_0x16d911-0x0;var _0x1e9d6e=_0x9f00[_0x16d911];return _0x1e9d6e;};'use strict';var _=require('lodash');var util=require(_0x09f0('0x0'));var path=require(_0x09f0('0x1'));var fs=require('fs');var jayson=require(_0x09f0('0x2'));var BPromise=require(_0x09f0('0x3'));var uuid=require(_0x09f0('0x4'));var config=require(_0x09f0('0x5'));var logger=require(_0x09f0('0x6'))(_0x09f0('0x7'));var rpc={'openchannelQueueReport':require(_0x09f0('0x8'))};var rpc={'openchannelQueueReport':require(_0x09f0('0x8')),'mailQueueReport':require(_0x09f0('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x09f0('0xa')),'faxQueueReport':require('../rpc/faxQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x50a35f,_0x451f70,_0x4df148){return util[_0x09f0('0xb')]('%s.%s.%s',_0x50a35f,_0x451f70||0x0,_0x4df148||0x0);}function getIntervals(_0xcf93e2,_0x46b0a7){var _0x2f534a=[];if(!_[_0x09f0('0xc')](_0x46b0a7[_0x09f0('0xd')])&&!_[_0x09f0('0xc')](_0xcf93e2[_0x46b0a7[_0x09f0('0xd')]])&&!_['isNil'](_0xcf93e2[_0x46b0a7['IntervalId']][_0x09f0('0xe')])){_0x2f534a=_['map'](_0xcf93e2[_0x46b0a7[_0x09f0('0xd')]][_0x09f0('0xe')],_0x09f0('0xf'));}else if(!_[_0x09f0('0xc')](_0x46b0a7[_0x09f0('0xf')])){_0x2f534a=[_0x46b0a7['interval']];}return _0x2f534a;}exports['listen']=function(_0x9ddcab){_0x9ddcab['rules']={};return new BPromise(function(_0x90bd04,_0x4045cd){var _0x38165e={'Start':function(_0x5d7721){var _0x3b299a=this;return new Promise(function(_0x585186,_0x5e727f){if(_0x5d7721){try{var _0x3ba786=[];var _0x11a6d8=getId(_0x5d7721[_0x09f0('0x10')],_0x5d7721['message']?_0x5d7721[_0x09f0('0x11')]['id']:0x0,_0x5d7721[_0x09f0('0x12')]?_0x5d7721[_0x09f0('0x12')]['id']:0x0);if(_0x5d7721[_0x09f0('0x13')]&&_[_0x09f0('0x14')](_0x5d7721[_0x09f0('0x13')])&&_0x5d7721[_0x09f0('0x13')][_0x09f0('0x15')]){for(var _0x14616b=0x0;_0x14616b<_0x5d7721[_0x09f0('0x13')][_0x09f0('0x15')];_0x14616b+=0x1){var _0x2efe61=_0x5d7721['applications'][_0x14616b];if(fs['existsSync'](path[_0x09f0('0x16')](__dirname,_0x09f0('0x13'),_0x2efe61[_0x09f0('0x17')]+_0x09f0('0x18')))){var _0x5822e1=[];switch(_0x2efe61[_0x09f0('0x17')]['toLowerCase']()){case _0x09f0('0x19'):var _0x49de5e=_0x2efe61[_0x09f0('0x1a')]['split'](',');_0x5822e1[_0x09f0('0x1b')](_0x49de5e[0x0]);_0x5822e1[_0x09f0('0x1b')](_0x49de5e[_0x09f0('0x1c')](0x1,_0x49de5e[_0x09f0('0x15')])[_0x09f0('0x16')](','));break;case _0x09f0('0x1d'):var _0x49de5e=_0x2efe61[_0x09f0('0x1a')][_0x09f0('0x1e')](',');_0x5822e1[_0x09f0('0x1b')](_0x49de5e[0x0]);_0x5822e1[_0x09f0('0x1b')](_0x49de5e[0x1]);_0x5822e1[_0x09f0('0x1b')](_0x49de5e[_0x09f0('0x1c')](0x2,_0x49de5e[_0x09f0('0x15')])[_0x09f0('0x16')](','));break;case'amazonlex':var _0x49de5e=_0x2efe61[_0x09f0('0x1a')][_0x09f0('0x1e')](',');_0x5822e1['push'](_0x49de5e[0x0]);_0x5822e1[_0x09f0('0x1b')](_0x49de5e[0x1]);_0x5822e1[_0x09f0('0x1b')](_0x49de5e[0x2]);_0x5822e1[_0x09f0('0x1b')](_0x49de5e[0x3]);_0x5822e1[_0x09f0('0x1b')](_0x49de5e[_0x09f0('0x1c')](0x4,_0x49de5e['length'])[_0x09f0('0x16')](','));break;case _0x09f0('0x11'):_0x5822e1['push'](_0x2efe61['appdata']);break;case _0x09f0('0x1f'):_0x5822e1[_0x09f0('0x1b')](_0x2efe61[_0x09f0('0x20')]);_0x5822e1[_0x09f0('0x1b')](_0x2efe61[_0x09f0('0x1a')]);break;default:_0x5822e1=_[_0x09f0('0xc')](_0x2efe61[_0x09f0('0x1a')])?[]:_0x2efe61[_0x09f0('0x1a')][_0x09f0('0x1e')](',');}var _0x682bc9={'id':util['format'](_0x09f0('0x21'),_0x11a6d8,_0x2efe61['id'],_0x2efe61[_0x09f0('0x17')]),'condition':require(_0x09f0('0x22'))[_0x09f0('0x23')](_0x11a6d8,getIntervals(_0x9ddcab[_0x09f0('0x24')],_0x2efe61),_0x9ddcab),'consequence':require(_0x09f0('0x25')+_0x2efe61[_0x09f0('0x17')])[_0x09f0('0x26')](_0x11a6d8,_0x5822e1,_0x9ddcab,_0x5d7721),'p':_0x2efe61['priority']||0x0};logger[_0x09f0('0x27')](_0x09f0('0x28'),_0x682bc9['id'],'on\x20interval',getIntervals(_0x9ddcab[_0x09f0('0x24')],_0x2efe61)['join'](_0x09f0('0x29')));_0x3ba786[_0x09f0('0x1b')](_0x682bc9);}else{logger[_0x09f0('0x2a')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x09f0('0x16')](__dirname,'applications',_0x2efe61[_0x09f0('0x17')]+'.js'));}}_0x9ddcab['rules'][_0x11a6d8]=new RuleEngine(_0x3ba786);_0x9ddcab[_0x09f0('0x2b')][_0x11a6d8][_0x09f0('0x2c')](_0x5d7721,function(_0x45c2e3){logger[_0x09f0('0x27')](_0x09f0('0x2d'),JSON[_0x09f0('0x2e')](_0x45c2e3[_0x09f0('0x2f')]));if(_0x9ddcab[_0x09f0('0x2b')][_0x11a6d8]){_0x9ddcab[_0x09f0('0x2b')][_0x11a6d8][_0x09f0('0x30')](_0x09f0('0x31'));}});return _0x585186({'code':0xc8,'message':_0x5d7721});}else{logger[_0x09f0('0x27')]('No\x20applications\x20to\x20execute');return _0x585186({'code':0xc8,'message':_0x5d7721});}}catch(_0x3382ca){logger['error'](_0x3382ca[_0x09f0('0x32')]);return _0x5e727f(_0x3b299a[_0x09f0('0x2a')](0x1f4,_0x3382ca));}}return _0x5e727f(_0x09f0('0x33'));});},'AcceptMessage':function(_0x197146){var _0x467c50=this;return new Promise(function(_0x295484,_0x2ab838){if(_0x197146['message']&&_0x197146['message']['id']){try{var _0x303b2f=getId(_0x197146[_0x09f0('0x10')],_0x197146[_0x09f0('0x11')]?_0x197146[_0x09f0('0x11')]['id']:0x0,_0x197146[_0x09f0('0x12')]?_0x197146['interaction']['id']:0x0);if(_0x9ddcab[_0x09f0('0x2b')][_0x303b2f]){_0x9ddcab[_0x09f0('0x2b')][_0x303b2f][_0x09f0('0x30')]('end');if(rpc[_0x197146['channel']+_0x09f0('0x34')]){rpc[_0x197146[_0x09f0('0x10')]+_0x09f0('0x34')]['update'](_0x303b2f,{'UserId':_0x197146[_0x09f0('0x11')][_0x09f0('0x35')]})[_0x09f0('0x36')](function(_0x5992ff){logger[_0x09f0('0x2a')](_0x09f0('0x37'));});}}return _0x295484({'code':0xc8,'message':_0x197146});}catch(_0x256881){logger[_0x09f0('0x2a')](_0x256881['stack']);return _0x2ab838(_0x467c50[_0x09f0('0x2a')](0x1f4,_0x256881));}}logger[_0x09f0('0x2a')]('message\x20is\x20empty');return _0x2ab838(_0x467c50[_0x09f0('0x2a')](0x1f4,_0x09f0('0x38')));});},'RejectMessage':function(_0x5e64ed){var _0x25e14c=this;return new Promise(function(_0x4eb7b1,_0x27e837){if(_0x5e64ed[_0x09f0('0x39')]&&_0x5e64ed[_0x09f0('0x39')]['id']){try{if(_0x9ddcab[_0x09f0('0x3a')][_0x5e64ed[_0x09f0('0x39')]['id']]){_0x9ddcab[_0x09f0('0x3a')][_0x5e64ed[_0x09f0('0x39')]['id']]['busy']=![];_0x9ddcab[_0x09f0('0x3a')][_0x5e64ed[_0x09f0('0x39')]['id']]['busyQueue']=undefined;}return _0x4eb7b1({'code':0xc8,'message':_0x5e64ed});}catch(_0x41ac6d){logger[_0x09f0('0x2a')](_0x41ac6d['stack']);return _0x27e837(_0x25e14c['error'](0x1f4,_0x41ac6d));}}logger[_0x09f0('0x2a')](_0x09f0('0x38'));return _0x27e837(_0x25e14c[_0x09f0('0x2a')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x474849){var _0x3bafda=this;return new Promise(function(_0x3567f4,_0x1daa74){if(_0x474849[_0x09f0('0x10')]&&_0x474849[_0x09f0('0x12')]&&_0x474849[_0x09f0('0x12')]['id']){try{var _0x26e622=getId(_0x474849['channel'],_0x474849[_0x09f0('0x11')]?_0x474849[_0x09f0('0x11')]['id']:0x0,_0x474849[_0x09f0('0x12')]?_0x474849[_0x09f0('0x12')]['id']:0x0);if(_0x9ddcab[_0x09f0('0x2b')][_0x26e622]){_0x9ddcab[_0x09f0('0x2b')][_0x26e622]['emit'](_0x09f0('0x31'));}return _0x3567f4({'code':0xc8,'message':_0x474849});}catch(_0x515b4f){logger[_0x09f0('0x2a')](_0x515b4f['stack']);return _0x1daa74(_0x3bafda[_0x09f0('0x2a')](0x1f4,_0x515b4f));}}logger[_0x09f0('0x2a')](_0x09f0('0x38'));return _0x1daa74(_0x3bafda[_0x09f0('0x2a')](0x1f4,_0x09f0('0x38')));});},'AgentCapacity':function(_0x2e1b79){var _0x482656=this;return new Promise(function(_0x4aa3e6,_0x4dd4c5){if(_0x9ddcab[_0x09f0('0x3a')][_0x09f0('0x3b')](_0x2e1b79['id'])){for(var _0x2bb856 in _0x2e1b79['capacity']){if(_0x2e1b79[_0x09f0('0x3c')][_0x09f0('0x3b')](_0x2bb856)){if(_0x9ddcab[_0x09f0('0x3a')][_0x2e1b79['id']][_0x09f0('0x3b')](_0x2bb856+'CurrentCapacity')){_0x9ddcab[_0x09f0('0x3a')][_0x2e1b79['id']][_0x2bb856+_0x09f0('0x3d')]=parseInt(_0x2e1b79[_0x09f0('0x3c')][_0x2bb856],0xa);}}}_0x9ddcab[_0x09f0('0x3a')][_0x2e1b79['id']][_0x09f0('0x3e')]();return _0x4aa3e6({'code':0xc8,'message':_0x9ddcab[_0x09f0('0x3a')][_0x2e1b79['id']]});}else{return _0x4dd4c5(_0x482656[_0x09f0('0x2a')](0x1f4,_0x09f0('0x3f')));}});},'Agents':function(_0x4c72a0){return new Promise(function(_0x4dddcd,_0x1726b2){var _0x39ae32=_[_0x09f0('0x40')](_0x9ddcab[_0x09f0('0x3a')]);_0x4dddcd({'count':_0x39ae32[_0x09f0('0x15')],'rows':_0x39ae32});});},'ChatQueues':function(_0x277f8c){return new Promise(function(_0x4a195c,_0x490058){var _0x37f4c7=[];for(var _0x5a4c25 in _0x9ddcab[_0x09f0('0x41')]){if(_0x9ddcab['chatQueues'][_0x09f0('0x3b')](_0x5a4c25)){var _0x42020a=_0x9ddcab[_0x09f0('0x41')][_0x5a4c25];var _0x244f01={'id':_0x42020a['id'],'available':_0x42020a[_0x09f0('0x42')],'loggedIn':_0x42020a['loggedIn'],'name':_0x42020a[_0x09f0('0x43')],'paused':_0x42020a[_0x09f0('0x44')],'waiting':_0x42020a['waiting']};_0x37f4c7[_0x09f0('0x1b')](_0x244f01);}}_0x4a195c({'count':_0x37f4c7[_0x09f0('0x15')],'rows':_0x37f4c7});});},'MailQueues':function(_0x2d61a4){return new Promise(function(_0x2d0e56,_0x27e969){var _0x554bbe=[];for(var _0x1a35b1 in _0x9ddcab[_0x09f0('0x45')]){if(_0x9ddcab['mailQueues'][_0x09f0('0x3b')](_0x1a35b1)){var _0x1a4961=_0x9ddcab['mailQueues'][_0x1a35b1];var _0x374499={'id':_0x1a4961['id'],'available':_0x1a4961[_0x09f0('0x42')],'loggedIn':_0x1a4961['loggedIn'],'name':_0x1a4961[_0x09f0('0x43')],'paused':_0x1a4961[_0x09f0('0x44')],'waiting':_0x1a4961[_0x09f0('0x46')]};_0x554bbe[_0x09f0('0x1b')](_0x374499);}}_0x2d0e56({'count':_0x554bbe[_0x09f0('0x15')],'rows':_0x554bbe});});},'OpenchannelQueues':function(_0x2f3dc2){return new Promise(function(_0x20c2be,_0x51babc){var _0x5f2b2a=[];for(var _0x2ac1fe in _0x9ddcab[_0x09f0('0x47')]){if(_0x9ddcab[_0x09f0('0x47')]['hasOwnProperty'](_0x2ac1fe)){var _0x35eccf=_0x9ddcab[_0x09f0('0x47')][_0x2ac1fe];var _0x16845d={'id':_0x35eccf['id'],'available':_0x35eccf[_0x09f0('0x42')],'loggedIn':_0x35eccf['loggedIn'],'name':_0x35eccf[_0x09f0('0x43')],'paused':_0x35eccf[_0x09f0('0x44')],'waiting':_0x35eccf[_0x09f0('0x46')]};_0x5f2b2a['push'](_0x16845d);}}_0x20c2be({'count':_0x5f2b2a['length'],'rows':_0x5f2b2a});});},'SmsQueues':function(_0x4c0880){return new Promise(function(_0xcba448,_0x56ff10){var _0x2a1843=[];for(var _0x435b07 in _0x9ddcab[_0x09f0('0x48')]){if(_0x9ddcab[_0x09f0('0x48')][_0x09f0('0x3b')](_0x435b07)){var _0xfdfb01=_0x9ddcab[_0x09f0('0x48')][_0x435b07];var _0x5112f5={'id':_0xfdfb01['id'],'available':_0xfdfb01['available'],'loggedIn':_0xfdfb01[_0x09f0('0x49')],'name':_0xfdfb01['name'],'paused':_0xfdfb01[_0x09f0('0x44')],'waiting':_0xfdfb01['waiting']};_0x2a1843[_0x09f0('0x1b')](_0x5112f5);}}_0xcba448({'count':_0x2a1843[_0x09f0('0x15')],'rows':_0x2a1843});});},'FaxQueues':function(_0x7037e6){return new Promise(function(_0x4ee348,_0x4adf88){var _0x3a29cc=[];for(var _0x9beb0b in _0x9ddcab[_0x09f0('0x4a')]){if(_0x9ddcab[_0x09f0('0x4a')]['hasOwnProperty'](_0x9beb0b)){var _0x5c654a=_0x9ddcab[_0x09f0('0x4a')][_0x9beb0b];var _0x3db169={'id':_0x5c654a['id'],'available':_0x5c654a['available'],'loggedIn':_0x5c654a[_0x09f0('0x49')],'name':_0x5c654a[_0x09f0('0x43')],'paused':_0x5c654a['paused'],'waiting':_0x5c654a['waiting']};_0x3a29cc[_0x09f0('0x1b')](_0x3db169);}}_0x4ee348({'count':_0x3a29cc[_0x09f0('0x15')],'rows':_0x3a29cc});});},'ChatQueuesWaitingInteractions':function(_0x441c69){return new Promise(function(_0x3897df,_0x58cf9d){var _0x3c9445=_[_0x09f0('0x40')](_0x9ddcab[_0x09f0('0x4b')]);_0x3897df({'count':_0x3c9445[_0x09f0('0x15')],'rows':_0x3c9445});});},'MailQueuesWaitingInteractions':function(_0xbc106f){return new Promise(function(_0x2c0590,_0x2dd6e9){var _0x3f59e0=_[_0x09f0('0x40')](_0x9ddcab[_0x09f0('0x4c')]);_0x2c0590({'count':_0x3f59e0[_0x09f0('0x15')],'rows':_0x3f59e0});});},'OpenchannelQueuesWaitingInteractions':function(_0x1aab8a){return new Promise(function(_0x3d48d4,_0x3a12cd){var _0x44317b=_[_0x09f0('0x40')](_0x9ddcab[_0x09f0('0x4d')]);_0x3d48d4({'count':_0x44317b[_0x09f0('0x15')],'rows':_0x44317b});});},'SmsQueuesWaitingInteractions':function(_0x484f59){return new Promise(function(_0x4eef83,_0xdd9237){var _0x1144c3=_['values'](_0x9ddcab[_0x09f0('0x4e')]);_0x4eef83({'count':_0x1144c3[_0x09f0('0x15')],'rows':_0x1144c3});});},'FaxQueuesWaitingInteractions':function(_0x4d5eb5){return new Promise(function(_0x2794f8,_0x26bc9a){var _0x1d8a7b=_['values'](_0x9ddcab[_0x09f0('0x4f')]);_0x2794f8({'count':_0x1d8a7b[_0x09f0('0x15')],'rows':_0x1d8a7b});});}};var _0x5c3a1d=jayson[_0x09f0('0x50')](_0x38165e)[_0x09f0('0x51')]();_0x5c3a1d['on'](_0x09f0('0x2a'),function(_0x3e1393){logger['error'](JSON[_0x09f0('0x2e')](_0x3e1393));return _0x4045cd(_0x3e1393);});_0x5c3a1d[_0x09f0('0x52')](0x232c,_0x09f0('0x53'),function(){console[_0x09f0('0x54')](_0x09f0('0x55'),0x232c);return _0x90bd04(_0x09f0('0x56')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 42fe457..b1c27cd 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 _0xe773=['when','log','util','bluebird','jayson/promise','../../../config/logger','routing','request','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20'];(function(_0x47fc2c,_0x23407a){var _0x4801af=function(_0x2f7761){while(--_0x2f7761){_0x47fc2c['push'](_0x47fc2c['shift']());}};_0x4801af(++_0x23407a);}(_0xe773,0x1d6));var _0x3e77=function(_0x52ee29,_0x5b733d){_0x52ee29=_0x52ee29-0x0;var _0x1cf05e=_0xe773[_0x52ee29];return _0x1cf05e;};'use strict';var util=require(_0x3e77('0x0'));var BPromise=require(_0x3e77('0x1'));var jayson=require(_0x3e77('0x2'));var _=require('lodash');var logger=require(_0x3e77('0x3'))(_0x3e77('0x4'));var client=jayson['client']['http']({'port':0x232a});function request(_0x21c312,_0x3ff303){return new BPromise(function(_0x4d6197,_0x50b8c8){return client[_0x3e77('0x5')](_0x21c312,_0x3ff303)[_0x3e77('0x6')](function(_0xb429fc){if(_0xb429fc[_0x3e77('0x7')]){return _0x50b8c8(_0xb429fc[_0x3e77('0x7')][_0x3e77('0x8')]);}else{return _0x4d6197(_0xb429fc[_0x3e77('0x9')]);}})[_0x3e77('0xa')](function(_0x21123e){return _0x50b8c8(_0x21123e);});});}exports['condition']=function(_0x534132,_0x4b32c8,_0x2480e5){return function(_0x43d8f1){if(_0x2480e5[_0x3e77('0xb')]&&!_0x2480e5[_0x3e77('0xb')][_0x534132]){logger[_0x3e77('0xc')](_0x3e77('0xd'),_0x534132);return _0x43d8f1[_0x3e77('0xe')]();}var _0x47ea51=[];for(var _0x2b0e64=0x0;_0x2b0e64<_0x4b32c8[_0x3e77('0xf')];_0x2b0e64+=0x1){_0x47ea51['push'](request(_0x3e77('0x10'),{'command':util['format'](_0x3e77('0x11'),_0x4b32c8[_0x2b0e64])})[_0x3e77('0x6')](function(_0x225bf2){return _0x225bf2&&_0x225bf2[_0x3e77('0x8')]&&_0x225bf2[_0x3e77('0x8')][_0x3e77('0x12')]('true')>=0x0?!![]:![];})[_0x3e77('0xa')](function(_0x26df53){logger[_0x3e77('0x7')](_0x3e77('0x13'),_0x534132,_0x4b32c8[_0x2b0e64]);}));}BPromise['all'](_0x47ea51)[_0x3e77('0x6')](function(_0x5e5b48){var _0xb6f59b=_[_0x3e77('0x14')](_0x5e5b48);logger[_0x3e77('0xc')](_0x3e77('0x15'),_0x534132,_0x4b32c8[_0x3e77('0x16')](_0x3e77('0x17')),_0xb6f59b);_0x43d8f1[_0x3e77('0x18')](_0xb6f59b);})[_0x3e77('0xa')](function(_0x49a2bf){console[_0x3e77('0x19')](_0x49a2bf);logger[_0x3e77('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x534132,_0x4b32c8[_0x3e77('0x16')](_0x3e77('0x17')),_0x49a2bf['stack']);_0x43d8f1['stop']();});};}; \ No newline at end of file +var _0x475c=['some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','error','message','catch','condition','rules','info','stop','length','push','Command','format','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all'];(function(_0x4ff09b,_0x2d09dd){var _0x1852d2=function(_0x1c5706){while(--_0x1c5706){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x1852d2(++_0x2d09dd);}(_0x475c,0xa7));var _0xc475=function(_0x38e1aa,_0x4cdc5b){_0x38e1aa=_0x38e1aa-0x0;var _0x15fee6=_0x475c[_0x38e1aa];return _0x15fee6;};'use strict';var util=require(_0xc475('0x0'));var BPromise=require(_0xc475('0x1'));var jayson=require(_0xc475('0x2'));var _=require(_0xc475('0x3'));var logger=require(_0xc475('0x4'))('routing');var client=jayson[_0xc475('0x5')][_0xc475('0x6')]({'port':0x232a});function request(_0x35b684,_0x541e1a){return new BPromise(function(_0x4ade8c,_0x44f553){return client[_0xc475('0x7')](_0x35b684,_0x541e1a)['then'](function(_0x220a76){if(_0x220a76[_0xc475('0x8')]){return _0x44f553(_0x220a76[_0xc475('0x8')][_0xc475('0x9')]);}else{return _0x4ade8c(_0x220a76['result']);}})[_0xc475('0xa')](function(_0x3d7f52){return _0x44f553(_0x3d7f52);});});}exports[_0xc475('0xb')]=function(_0x2858b1,_0x44ee47,_0x4eca02){return function(_0x46386a){if(_0x4eca02[_0xc475('0xc')]&&!_0x4eca02[_0xc475('0xc')][_0x2858b1]){logger[_0xc475('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2858b1);return _0x46386a[_0xc475('0xe')]();}var _0x173911=[];for(var _0x1bca77=0x0;_0x1bca77<_0x44ee47[_0xc475('0xf')];_0x1bca77+=0x1){_0x173911[_0xc475('0x10')](request(_0xc475('0x11'),{'command':util[_0xc475('0x12')](_0xc475('0x13'),_0x44ee47[_0x1bca77])})[_0xc475('0x14')](function(_0x39aabb){return _0x39aabb&&_0x39aabb[_0xc475('0x9')]&&_0x39aabb[_0xc475('0x9')][_0xc475('0x15')](_0xc475('0x16'))>=0x0?!![]:![];})[_0xc475('0xa')](function(_0x4f54c6){logger[_0xc475('0x8')](_0xc475('0x17'),_0x2858b1,_0x44ee47[_0x1bca77]);}));}BPromise[_0xc475('0x18')](_0x173911)[_0xc475('0x14')](function(_0x1c09d1){var _0x234eb9=_[_0xc475('0x19')](_0x1c09d1);logger[_0xc475('0xd')](_0xc475('0x1a'),_0x2858b1,_0x44ee47[_0xc475('0x1b')]('\x20|\x20'),_0x234eb9);_0x46386a[_0xc475('0x1c')](_0x234eb9);})[_0xc475('0xa')](function(_0x7b2ea6){console[_0xc475('0x1d')](_0x7b2ea6);logger[_0xc475('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x2858b1,_0x44ee47[_0xc475('0x1b')](_0xc475('0x1e')),_0x7b2ea6[_0xc475('0x1f')]);_0x46386a[_0xc475('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d1cd5e5..2c92496 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 _0x589e=['connectedlinename','error','agentringnoanswer','isNil','agentringnoanswerAt','rejected','reason','talktime','stack','queuecallerabandon','uniqueid','now','abandoned','holdtime','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','diffTime','complete','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','agentcalledAt','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','agentcompleteAt','agent','lodash','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid'];(function(_0x118621,_0x197b5c){var _0x527611=function(_0xcbfe12){while(--_0xcbfe12){_0x118621['push'](_0x118621['shift']());}};_0x527611(++_0x197b5c);}(_0x589e,0x127));var _0xe589=function(_0x599ae1,_0x4f497f){_0x599ae1=_0x599ae1-0x0;var _0x59cfac=_0x589e[_0x599ae1];return _0x59cfac;};'use strict';var _=require(_0xe589('0x0'));var util=require('util');var utils=require(_0xe589('0x1'));var agents={};var transfers={};function writeDB(_0x40b12c,_0x3c75b8){utils['info'](util[_0xe589('0x2')](_0xe589('0x3'),_0x40b12c['uniqueid'],_0x40b12c['channel'],_0x40b12c[_0xe589('0x4')],_0x40b12c[_0xe589('0x5')],_0x40b12c[_0xe589('0x6')],_0x40b12c[_0xe589('0x7')],_0x40b12c[_0xe589('0x8')],_0x40b12c[_0xe589('0x9')]));if(_0x40b12c[_0xe589('0x4')]){utils[_0xe589('0xa')](_0x40b12c[_0xe589('0x4')])['then'](function(_0x49e745){if(_0x49e745){_0x40b12c[_0xe589('0xb')]=_0x49e745[_0xe589('0xb')];_0x40b12c['agentacw']=_0x40b12c[_0xe589('0xc')]?_0x49e745[_0xe589('0xd')]:![];_0x40b12c[_0xe589('0xe')]=_0x40b12c[_0xe589('0xf')]?_0x49e745[_0xe589('0x10')]:0x0;}utils[_0xe589('0x11')](_0xe589('0x12'),_0x40b12c);});}else{utils[_0xe589('0x11')](_0xe589('0x12'),_0x40b12c);}if(_0x3c75b8){delete transfers[_0x40b12c['uniqueid']];}else{delete agents[_0x40b12c['destuniqueid']];}}exports['agentcalled']=function(_0xb5e54d){try{agents[_0xb5e54d[_0xe589('0x13')]]=_0xb5e54d;agents[_0xb5e54d['destuniqueid']]['agentcalledAt']=utils['now']();agents[_0xb5e54d[_0xe589('0x13')]][_0xe589('0x9')]='called';agents[_0xb5e54d[_0xe589('0x13')]][_0xe589('0x8')]=null;agents[_0xb5e54d[_0xe589('0x13')]][_0xe589('0x14')]=null;}catch(_0x90021){utils[_0xe589('0x15')](_0x90021['stack']);}};exports[_0xe589('0x16')]=function(_0x29a6e0){try{if(!_[_0xe589('0x17')](agents[_0x29a6e0[_0xe589('0x13')]])){agents[_0x29a6e0[_0xe589('0x13')]][_0xe589('0x16')]=!![];agents[_0x29a6e0[_0xe589('0x13')]][_0xe589('0x18')]=utils['now']();agents[_0x29a6e0[_0xe589('0x13')]][_0xe589('0x9')]=_0xe589('0x19');agents[_0x29a6e0['destuniqueid']][_0xe589('0x1a')]=_0xe589('0x19');agents[_0x29a6e0[_0xe589('0x13')]]['holdtime']=_0x29a6e0['ringtime']?parseInt(_0x29a6e0['ringtime'])/0x3e8:0x0;agents[_0x29a6e0['destuniqueid']][_0xe589('0x1b')]=0x0;writeDB(agents[_0x29a6e0['destuniqueid']]);}}catch(_0x2f5880){utils[_0xe589('0x15')](_0x2f5880[_0xe589('0x1c')]);}};exports[_0xe589('0x1d')]=function(_0x44949d){try{_['forIn'](agents,function(_0x1baf3d,_0x27121e){if(_0x1baf3d[_0xe589('0x1e')]==_0x44949d[_0xe589('0x1e')]){_0x1baf3d[_0xe589('0x16')]=!![];_0x1baf3d[_0xe589('0x18')]=utils[_0xe589('0x1f')]();_0x1baf3d[_0xe589('0x9')]=_0xe589('0x20');_0x1baf3d['reason']=_0xe589('0x20');_0x1baf3d[_0xe589('0x21')]=_0x44949d[_0xe589('0x21')];_0x1baf3d[_0xe589('0x1b')]=0x0;writeDB(_0x1baf3d);}});}catch(_0xadfe8a){utils[_0xe589('0x15')](_0xadfe8a[_0xe589('0x1c')]);}};exports[_0xe589('0x22')]=function(_0x3eea55){try{if(agents[_0x3eea55['destuniqueid']]){agents[_0x3eea55['destuniqueid']][_0xe589('0x23')]=utils[_0xe589('0x1f')]();agents[_0x3eea55[_0xe589('0x13')]]['connectedlinenum']=_0x3eea55[_0xe589('0x8')];agents[_0x3eea55['destuniqueid']]['connectedlinename']=_0x3eea55['connectedlinename'];agents[_0x3eea55['destuniqueid']][_0xe589('0x21')]=_0x3eea55['ringtime'];agents[_0x3eea55[_0xe589('0x13')]][_0xe589('0x9')]=_0xe589('0x24');_['forIn'](agents,function(_0x49dae7,_0x47cefd){if(_0x49dae7[_0xe589('0x13')]!=_0x3eea55[_0xe589('0x13')]&&_0x49dae7['uniqueid']==_0x3eea55[_0xe589('0x1e')]){_0x49dae7[_0xe589('0x1b')]=0x0;_0x49dae7[_0xe589('0x21')]=_0x3eea55['ringtime'];_0x49dae7['agentringnoanswer']=!![];_0x49dae7[_0xe589('0x18')]=utils[_0xe589('0x1f')]();_0x49dae7[_0xe589('0x9')]=_0xe589('0x25');_0x49dae7[_0xe589('0x1a')]=_0xe589('0x25');_0x49dae7[_0xe589('0x26')]=_0x3eea55['destuniqueid'];_0x49dae7[_0xe589('0x27')]=_0x3eea55['membername'];writeDB(_0x49dae7);}});}}catch(_0x298ffb){utils[_0xe589('0x15')](_0x298ffb[_0xe589('0x1c')]);}};exports[_0xe589('0xc')]=function(_0x278961){try{if(!_[_0xe589('0x17')](agents[_0x278961[_0xe589('0x13')]])){agents[_0x278961[_0xe589('0x13')]]['agentcomplete']=!![];agents[_0x278961[_0xe589('0x13')]]['agentcompleteAt']=utils[_0xe589('0x1f')]();agents[_0x278961[_0xe589('0x13')]][_0xe589('0x1b')]=utils[_0xe589('0x28')](agents[_0x278961['destuniqueid']]['agentcompleteAt'],agents[_0x278961['destuniqueid']][_0xe589('0x23')]);agents[_0x278961[_0xe589('0x13')]][_0xe589('0x1a')]=_0x278961[_0xe589('0x1a')];agents[_0x278961[_0xe589('0x13')]][_0xe589('0x9')]=_0xe589('0x29');writeDB(agents[_0x278961[_0xe589('0x13')]]);}}catch(_0x583f0f){utils[_0xe589('0x15')](_0x583f0f[_0xe589('0x1c')]);}};exports['blindtransfer']=function(_0x2c2c61){try{if(!_[_0xe589('0x17')](agents[_0x2c2c61['transfereruniqueid']])){agents[_0x2c2c61[_0xe589('0x2a')]][_0xe589('0x2b')]=!![];agents[_0x2c2c61['transfereruniqueid']][_0xe589('0x2c')]=_0xe589('0x2d');agents[_0x2c2c61['transfereruniqueid']][_0xe589('0x2e')]=_0x2c2c61[_0xe589('0x2f')];agents[_0x2c2c61['transfereruniqueid']][_0xe589('0x30')]=agents[_0x2c2c61[_0xe589('0x2a')]][_0xe589('0x1e')];}}catch(_0x2f6f39){utils['error'](_0x2f6f39[_0xe589('0x1c')]);}};exports[_0xe589('0x31')]=function(_0x390bbd){try{if(_0x390bbd[_0xe589('0x32')]==_0x390bbd['origtransfererlinkedid']){if(!_['isNil'](agents[_0x390bbd[_0xe589('0x33')]])){agents[_0x390bbd[_0xe589('0x33')]][_0xe589('0x2b')]=!![];agents[_0x390bbd[_0xe589('0x33')]][_0xe589('0x2c')]=_0xe589('0x34');agents[_0x390bbd[_0xe589('0x33')]][_0xe589('0x2e')]=_0x390bbd['origtransfererexten'];agents[_0x390bbd[_0xe589('0x33')]][_0xe589('0x30')]=_0x390bbd[_0xe589('0x32')];}if(_0x390bbd[_0xe589('0x35')]&&agents[_0x390bbd[_0xe589('0x35')]]){agents[_0x390bbd['transfereeuniqueid']][_0xe589('0x36')]=0x1;transfers[_0x390bbd['transfereeuniqueid']]=_['clone'](agents[_0x390bbd['transfereeuniqueid']]);transfers[_0x390bbd['transfereeuniqueid']][_0xe589('0x7')]=agents[_0x390bbd[_0xe589('0x33')]][_0xe589('0x7')];transfers[_0x390bbd[_0xe589('0x35')]]['calleridname']=agents[_0x390bbd['secondtransfereruniqueid']]['calleridname'];transfers[_0x390bbd[_0xe589('0x35')]][_0xe589('0x37')]=utils[_0xe589('0x1f')]();transfers[_0x390bbd[_0xe589('0x35')]][_0xe589('0x23')]=utils[_0xe589('0x1f')]();transfers[_0x390bbd['transfereeuniqueid']][_0xe589('0x21')]=0x0;transfers[_0x390bbd[_0xe589('0x35')]][_0xe589('0x36')]=0x2;}}else if(_0x390bbd[_0xe589('0x33')]==_0x390bbd['secondtransfererlinkedid']){if(!_[_0xe589('0x17')](agents[_0x390bbd[_0xe589('0x32')]])){agents[_0x390bbd['origtransfereruniqueid']][_0xe589('0x2b')]=!![];agents[_0x390bbd[_0xe589('0x32')]][_0xe589('0x2c')]=_0xe589('0x34');agents[_0x390bbd['origtransfereruniqueid']][_0xe589('0x2e')]=_0x390bbd[_0xe589('0x38')];agents[_0x390bbd[_0xe589('0x32')]]['transferuniqueid']=_0x390bbd[_0xe589('0x33')];}if(_0x390bbd[_0xe589('0x39')]&&agents[_0x390bbd[_0xe589('0x39')]]){agents[_0x390bbd['transfertargetuniqueid']][_0xe589('0x36')]=0x1;transfers[_0x390bbd['transfertargetuniqueid']]=_[_0xe589('0x3a')](agents[_0x390bbd[_0xe589('0x39')]]);transfers[_0x390bbd['transfertargetuniqueid']][_0xe589('0x7')]=agents[_0x390bbd[_0xe589('0x32')]][_0xe589('0x7')];transfers[_0x390bbd[_0xe589('0x39')]]['calleridname']=agents[_0x390bbd[_0xe589('0x32')]][_0xe589('0x3b')];transfers[_0x390bbd[_0xe589('0x39')]][_0xe589('0x37')]=utils[_0xe589('0x1f')]();transfers[_0x390bbd[_0xe589('0x39')]][_0xe589('0x23')]=utils[_0xe589('0x1f')]();transfers[_0x390bbd[_0xe589('0x39')]][_0xe589('0x21')]=0x0;transfers[_0x390bbd[_0xe589('0x39')]][_0xe589('0x36')]=0x2;}}}catch(_0x29c0b8){utils['error'](_0x29c0b8[_0xe589('0x1c')]);}};exports[_0xe589('0x3c')]=function(_0x5c70b1){try{if(transfers[_0x5c70b1['uniqueid']]){transfers[_0x5c70b1[_0xe589('0x1e')]][_0xe589('0xc')]=!![];transfers[_0x5c70b1[_0xe589('0x1e')]]['agentcompleteAt']=utils[_0xe589('0x1f')]();transfers[_0x5c70b1[_0xe589('0x1e')]]['talktime']=utils[_0xe589('0x28')](transfers[_0x5c70b1['uniqueid']][_0xe589('0x3d')],transfers[_0x5c70b1[_0xe589('0x1e')]][_0xe589('0x23')]);transfers[_0x5c70b1[_0xe589('0x1e')]][_0xe589('0x1a')]=_0xe589('0x3e');transfers[_0x5c70b1[_0xe589('0x1e')]]['lastevent']='complete';writeDB(transfers[_0x5c70b1[_0xe589('0x1e')]],!![]);}if(agents[_0x5c70b1['uniqueid']]&&agents[_0x5c70b1[_0xe589('0x1e')]][_0xe589('0x23')]){agents[_0x5c70b1['uniqueid']][_0xe589('0xc')]=!![];agents[_0x5c70b1[_0xe589('0x1e')]]['agentcompleteAt']=utils[_0xe589('0x1f')]();agents[_0x5c70b1[_0xe589('0x1e')]][_0xe589('0x1b')]=utils[_0xe589('0x28')](agents[_0x5c70b1[_0xe589('0x1e')]][_0xe589('0x3d')],agents[_0x5c70b1['uniqueid']][_0xe589('0x23')]);agents[_0x5c70b1[_0xe589('0x1e')]]['reason']=agents[_0x5c70b1[_0xe589('0x1e')]]['transfer']?_0xe589('0x2b'):_0xe589('0x3e');agents[_0x5c70b1[_0xe589('0x1e')]]['lastevent']=_0xe589('0x29');writeDB(agents[_0x5c70b1['uniqueid']]);}}catch(_0x3ec34b){utils['error'](_0x3ec34b[_0xe589('0x1c')]);}}; \ No newline at end of file +var _0xb98f=['attendedtransfer','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','origtransfereruniqueid','transfertype','secondtransfererexten','transfertargetuniqueid','diffTime','agent','lodash','util','./utils','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','agentringnoanswer','isNil','agentringnoanswerAt','lastevent','rejected','reason','holdtime','ringtime','talktime','stack','queuecallerabandon','abandoned','agentconnect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','agentconnectAt','complete','transfereruniqueid','transfer','blind'];(function(_0x44deb5,_0x41db49){var _0x5cd78f=function(_0x126c10){while(--_0x126c10){_0x44deb5['push'](_0x44deb5['shift']());}};_0x5cd78f(++_0x41db49);}(_0xb98f,0xce));var _0xfb98=function(_0x128759,_0x59a4da){_0x128759=_0x128759-0x0;var _0x4f9b39=_0xb98f[_0x128759];return _0x4f9b39;};'use strict';var _=require(_0xfb98('0x0'));var util=require(_0xfb98('0x1'));var utils=require(_0xfb98('0x2'));var agents={};var transfers={};function writeDB(_0x3d2395,_0x14e29f){utils['info'](util['format']('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x3d2395[_0xfb98('0x3')],_0x3d2395[_0xfb98('0x4')],_0x3d2395[_0xfb98('0x5')],_0x3d2395[_0xfb98('0x6')],_0x3d2395['interface'],_0x3d2395[_0xfb98('0x7')],_0x3d2395[_0xfb98('0x8')],_0x3d2395['lastevent']));if(_0x3d2395[_0xfb98('0x5')]){utils['getVoiceQueueByName'](_0x3d2395['queue'])['then'](function(_0x5de4a8){if(_0x5de4a8){_0x3d2395['type']=_0x5de4a8[_0xfb98('0x9')];_0x3d2395[_0xfb98('0xa')]=_0x3d2395['agentcomplete']?_0x5de4a8['acw']:![];_0x3d2395[_0xfb98('0xb')]=_0x3d2395['agentacw']?_0x5de4a8[_0xfb98('0xc')]:0x0;}utils[_0xfb98('0xd')](_0xfb98('0xe'),_0x3d2395);});}else{utils[_0xfb98('0xd')](_0xfb98('0xe'),_0x3d2395);}if(_0x14e29f){delete transfers[_0x3d2395[_0xfb98('0x3')]];}else{delete agents[_0x3d2395[_0xfb98('0xf')]];}}exports[_0xfb98('0x10')]=function(_0xcde9ef){try{agents[_0xcde9ef[_0xfb98('0xf')]]=_0xcde9ef;agents[_0xcde9ef[_0xfb98('0xf')]][_0xfb98('0x11')]=utils[_0xfb98('0x12')]();agents[_0xcde9ef[_0xfb98('0xf')]]['lastevent']=_0xfb98('0x13');agents[_0xcde9ef['destuniqueid']][_0xfb98('0x8')]=null;agents[_0xcde9ef[_0xfb98('0xf')]][_0xfb98('0x14')]=null;}catch(_0x471299){utils[_0xfb98('0x15')](_0x471299['stack']);}};exports[_0xfb98('0x16')]=function(_0x174e4d){try{if(!_[_0xfb98('0x17')](agents[_0x174e4d[_0xfb98('0xf')]])){agents[_0x174e4d[_0xfb98('0xf')]][_0xfb98('0x16')]=!![];agents[_0x174e4d[_0xfb98('0xf')]][_0xfb98('0x18')]=utils[_0xfb98('0x12')]();agents[_0x174e4d[_0xfb98('0xf')]][_0xfb98('0x19')]=_0xfb98('0x1a');agents[_0x174e4d[_0xfb98('0xf')]][_0xfb98('0x1b')]=_0xfb98('0x1a');agents[_0x174e4d[_0xfb98('0xf')]][_0xfb98('0x1c')]=_0x174e4d['ringtime']?parseInt(_0x174e4d[_0xfb98('0x1d')])/0x3e8:0x0;agents[_0x174e4d[_0xfb98('0xf')]][_0xfb98('0x1e')]=0x0;writeDB(agents[_0x174e4d[_0xfb98('0xf')]]);}}catch(_0x4c3f10){utils[_0xfb98('0x15')](_0x4c3f10[_0xfb98('0x1f')]);}};exports[_0xfb98('0x20')]=function(_0x5078aa){try{_['forIn'](agents,function(_0x433fce,_0x269576){if(_0x433fce['uniqueid']==_0x5078aa[_0xfb98('0x3')]){_0x433fce['agentringnoanswer']=!![];_0x433fce[_0xfb98('0x18')]=utils[_0xfb98('0x12')]();_0x433fce['lastevent']='abandoned';_0x433fce[_0xfb98('0x1b')]=_0xfb98('0x21');_0x433fce['holdtime']=_0x5078aa[_0xfb98('0x1c')];_0x433fce['talktime']=0x0;writeDB(_0x433fce);}});}catch(_0x16b961){utils[_0xfb98('0x15')](_0x16b961[_0xfb98('0x1f')]);}};exports[_0xfb98('0x22')]=function(_0x5d53d6){try{if(agents[_0x5d53d6[_0xfb98('0xf')]]){agents[_0x5d53d6[_0xfb98('0xf')]]['agentconnectAt']=utils[_0xfb98('0x12')]();agents[_0x5d53d6['destuniqueid']]['connectedlinenum']=_0x5d53d6['connectedlinenum'];agents[_0x5d53d6['destuniqueid']]['connectedlinename']=_0x5d53d6[_0xfb98('0x14')];agents[_0x5d53d6[_0xfb98('0xf')]][_0xfb98('0x1c')]=_0x5d53d6['ringtime'];agents[_0x5d53d6[_0xfb98('0xf')]][_0xfb98('0x19')]='connect';_[_0xfb98('0x23')](agents,function(_0x302338,_0x279b38){if(_0x302338[_0xfb98('0xf')]!=_0x5d53d6['destuniqueid']&&_0x302338[_0xfb98('0x3')]==_0x5d53d6[_0xfb98('0x3')]){_0x302338[_0xfb98('0x1e')]=0x0;_0x302338['holdtime']=_0x5d53d6['ringtime'];_0x302338[_0xfb98('0x16')]=!![];_0x302338['agentringnoanswerAt']=utils[_0xfb98('0x12')]();_0x302338[_0xfb98('0x19')]=_0xfb98('0x24');_0x302338[_0xfb98('0x1b')]=_0xfb98('0x24');_0x302338[_0xfb98('0x25')]=_0x5d53d6[_0xfb98('0xf')];_0x302338[_0xfb98('0x26')]=_0x5d53d6[_0xfb98('0x6')];writeDB(_0x302338);}});}}catch(_0x34fbe6){utils[_0xfb98('0x15')](_0x34fbe6[_0xfb98('0x1f')]);}};exports[_0xfb98('0x27')]=function(_0x480e62){try{if(!_[_0xfb98('0x17')](agents[_0x480e62[_0xfb98('0xf')]])){agents[_0x480e62[_0xfb98('0xf')]][_0xfb98('0x27')]=!![];agents[_0x480e62[_0xfb98('0xf')]][_0xfb98('0x28')]=utils['now']();agents[_0x480e62['destuniqueid']][_0xfb98('0x1e')]=utils['diffTime'](agents[_0x480e62['destuniqueid']]['agentcompleteAt'],agents[_0x480e62['destuniqueid']][_0xfb98('0x29')]);agents[_0x480e62[_0xfb98('0xf')]]['reason']=_0x480e62[_0xfb98('0x1b')];agents[_0x480e62[_0xfb98('0xf')]][_0xfb98('0x19')]=_0xfb98('0x2a');writeDB(agents[_0x480e62['destuniqueid']]);}}catch(_0x26cf67){utils[_0xfb98('0x15')](_0x26cf67[_0xfb98('0x1f')]);}};exports['blindtransfer']=function(_0x388027){try{if(!_[_0xfb98('0x17')](agents[_0x388027[_0xfb98('0x2b')]])){agents[_0x388027[_0xfb98('0x2b')]][_0xfb98('0x2c')]=!![];agents[_0x388027['transfereruniqueid']]['transfertype']=_0xfb98('0x2d');agents[_0x388027['transfereruniqueid']]['transferexten']=_0x388027['extension'];agents[_0x388027['transfereruniqueid']]['transferuniqueid']=agents[_0x388027['transfereruniqueid']][_0xfb98('0x3')];}}catch(_0x31694a){utils[_0xfb98('0x15')](_0x31694a[_0xfb98('0x1f')]);}};exports[_0xfb98('0x2e')]=function(_0x17339b){try{if(_0x17339b['origtransfereruniqueid']==_0x17339b[_0xfb98('0x2f')]){if(!_[_0xfb98('0x17')](agents[_0x17339b[_0xfb98('0x30')]])){agents[_0x17339b['secondtransfereruniqueid']][_0xfb98('0x2c')]=!![];agents[_0x17339b[_0xfb98('0x30')]]['transfertype']=_0xfb98('0x31');agents[_0x17339b['secondtransfereruniqueid']][_0xfb98('0x32')]=_0x17339b['origtransfererexten'];agents[_0x17339b[_0xfb98('0x30')]][_0xfb98('0x33')]=_0x17339b['origtransfereruniqueid'];}if(_0x17339b[_0xfb98('0x34')]&&agents[_0x17339b[_0xfb98('0x34')]]){agents[_0x17339b[_0xfb98('0x34')]]['agententerreason']=0x1;transfers[_0x17339b[_0xfb98('0x34')]]=_[_0xfb98('0x35')](agents[_0x17339b[_0xfb98('0x34')]]);transfers[_0x17339b[_0xfb98('0x34')]][_0xfb98('0x7')]=agents[_0x17339b['secondtransfereruniqueid']][_0xfb98('0x7')];transfers[_0x17339b['transfereeuniqueid']][_0xfb98('0x36')]=agents[_0x17339b['secondtransfereruniqueid']][_0xfb98('0x36')];transfers[_0x17339b[_0xfb98('0x34')]][_0xfb98('0x11')]=utils[_0xfb98('0x12')]();transfers[_0x17339b[_0xfb98('0x34')]][_0xfb98('0x29')]=utils[_0xfb98('0x12')]();transfers[_0x17339b[_0xfb98('0x34')]][_0xfb98('0x1c')]=0x0;transfers[_0x17339b[_0xfb98('0x34')]][_0xfb98('0x37')]=0x2;}}else if(_0x17339b[_0xfb98('0x30')]==_0x17339b[_0xfb98('0x38')]){if(!_[_0xfb98('0x17')](agents[_0x17339b[_0xfb98('0x39')]])){agents[_0x17339b[_0xfb98('0x39')]][_0xfb98('0x2c')]=!![];agents[_0x17339b[_0xfb98('0x39')]][_0xfb98('0x3a')]=_0xfb98('0x31');agents[_0x17339b[_0xfb98('0x39')]][_0xfb98('0x32')]=_0x17339b[_0xfb98('0x3b')];agents[_0x17339b[_0xfb98('0x39')]][_0xfb98('0x33')]=_0x17339b[_0xfb98('0x30')];}if(_0x17339b['transfertargetuniqueid']&&agents[_0x17339b['transfertargetuniqueid']]){agents[_0x17339b[_0xfb98('0x3c')]]['agententerreason']=0x1;transfers[_0x17339b[_0xfb98('0x3c')]]=_[_0xfb98('0x35')](agents[_0x17339b[_0xfb98('0x3c')]]);transfers[_0x17339b['transfertargetuniqueid']][_0xfb98('0x7')]=agents[_0x17339b[_0xfb98('0x39')]][_0xfb98('0x7')];transfers[_0x17339b[_0xfb98('0x3c')]][_0xfb98('0x36')]=agents[_0x17339b[_0xfb98('0x39')]][_0xfb98('0x36')];transfers[_0x17339b[_0xfb98('0x3c')]]['agentcalledAt']=utils[_0xfb98('0x12')]();transfers[_0x17339b['transfertargetuniqueid']][_0xfb98('0x29')]=utils[_0xfb98('0x12')]();transfers[_0x17339b[_0xfb98('0x3c')]][_0xfb98('0x1c')]=0x0;transfers[_0x17339b['transfertargetuniqueid']][_0xfb98('0x37')]=0x2;}}}catch(_0x35fc75){utils[_0xfb98('0x15')](_0x35fc75[_0xfb98('0x1f')]);}};exports['hangup']=function(_0x2a2f1d){try{if(transfers[_0x2a2f1d[_0xfb98('0x3')]]){transfers[_0x2a2f1d['uniqueid']][_0xfb98('0x27')]=!![];transfers[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x28')]=utils[_0xfb98('0x12')]();transfers[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x1e')]=utils[_0xfb98('0x3d')](transfers[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x28')],transfers[_0x2a2f1d['uniqueid']][_0xfb98('0x29')]);transfers[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x1b')]=_0xfb98('0x3e');transfers[_0x2a2f1d['uniqueid']][_0xfb98('0x19')]=_0xfb98('0x2a');writeDB(transfers[_0x2a2f1d[_0xfb98('0x3')]],!![]);}if(agents[_0x2a2f1d['uniqueid']]&&agents[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x29')]){agents[_0x2a2f1d['uniqueid']][_0xfb98('0x27')]=!![];agents[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x28')]=utils[_0xfb98('0x12')]();agents[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x1e')]=utils[_0xfb98('0x3d')](agents[_0x2a2f1d[_0xfb98('0x3')]]['agentcompleteAt'],agents[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x29')]);agents[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x1b')]=agents[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x2c')]?_0xfb98('0x2c'):_0xfb98('0x3e');agents[_0x2a2f1d[_0xfb98('0x3')]][_0xfb98('0x19')]='complete';writeDB(agents[_0x2a2f1d['uniqueid']]);}}catch(_0x4b8694){utils[_0xfb98('0x15')](_0x4b8694['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index be06ca2..6519224 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 _0x5a8a=['toNumber','hangup','callerid','calleridname','calleridnum','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable','xmd-originatecalleridnum','value','destination','\x22\x20<','xmd-callerid','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','set','startsWith','appdata','toLowerCase','split','substring','lastIndexOf','noop','application','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','source','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','linkedid','exten','context','now','error','stack','newstate','isNil','systemanswertime','channelstate','transfer','destinationchannel','answertime','disposition'];(function(_0x157111,_0x3a9771){var _0x5b00c4=function(_0x1b15e4){while(--_0x1b15e4){_0x157111['push'](_0x157111['shift']());}};_0x5b00c4(++_0x3a9771);}(_0x5a8a,0x7c));var _0xa5a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5a8a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xa5a8('0x0'));var utils=require('./utils');var dispositions=[_0xa5a8('0x1'),_0xa5a8('0x2'),_0xa5a8('0x2'),_0xa5a8('0x1'),_0xa5a8('0x1'),'NO\x20ANSWER',_0xa5a8('0x3'),_0xa5a8('0x4'),_0xa5a8('0x2'),_0xa5a8('0x2'),_0xa5a8('0x2')];var channels={};function writeDB(_0x26da13){utils[_0xa5a8('0x5')](util[_0xa5a8('0x6')](_0xa5a8('0x7'),_0x26da13['uniqueid'],_0x26da13[_0xa5a8('0x8')],_0x26da13[_0xa5a8('0x9')],_0x26da13[_0xa5a8('0xa')],_0x26da13[_0xa5a8('0xb')],_0x26da13['destination'],_0x26da13['callerid'],_0x26da13['disposition']));if(_0x26da13[_0xa5a8('0xa')]){utils['getUserByInternal'](_0x26da13[_0xa5a8('0xa')])[_0xa5a8('0xc')](function(_0x637961){if(_0x637961){_0x26da13[_0xa5a8('0xd')]=_0x637961['id'];}utils['request']('CreateVoiceCallReport',_0x26da13);});}else{utils[_0xa5a8('0xe')](_0xa5a8('0xf'),_0x26da13);}if(channels[_0x26da13[_0xa5a8('0x10')]]){delete channels[_0x26da13[_0xa5a8('0x10')]];}}exports[_0xa5a8('0x11')]=function(_0x3a357f){try{if(_0x3a357f[_0xa5a8('0x10')]==_0x3a357f[_0xa5a8('0x12')]&&_0x3a357f[_0xa5a8('0x8')]!='OutgoingSpoolFailed'){channels[_0x3a357f[_0xa5a8('0x10')]]={'uniqueid':_0x3a357f[_0xa5a8('0x10')],'accountcode':_0x3a357f['accountcode'],'source':_0x3a357f['calleridnum'],'destination':_0x3a357f[_0xa5a8('0x13')],'destinationcontext':_0x3a357f[_0xa5a8('0x14')],'channel':_0x3a357f[_0xa5a8('0x8')],'starttime':utils[_0xa5a8('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa5a8('0x1'),'amaflags':'DOCUMENTATION'};}}catch(_0x444ea5){utils[_0xa5a8('0x16')](_0x444ea5[_0xa5a8('0x17')]);}};exports[_0xa5a8('0x18')]=function(_0x2cb0b6){try{if(!_[_0xa5a8('0x19')](channels[_0x2cb0b6[_0xa5a8('0x10')]])&&_0x2cb0b6['channelstate']==0x6){if(_[_0xa5a8('0x19')](channels[_0x2cb0b6['uniqueid']]['systemanswertime'])){channels[_0x2cb0b6[_0xa5a8('0x10')]][_0xa5a8('0x1a')]=utils[_0xa5a8('0x15')]();}}else if(!_[_0xa5a8('0x19')](channels[_0x2cb0b6[_0xa5a8('0x12')]])&&_0x2cb0b6[_0xa5a8('0x1b')]==0x6&&_0x2cb0b6[_0xa5a8('0x14')]!=_0xa5a8('0x1c')){channels[_0x2cb0b6[_0xa5a8('0x12')]][_0xa5a8('0xa')]=_0x2cb0b6[_0xa5a8('0xa')];channels[_0x2cb0b6[_0xa5a8('0x12')]][_0xa5a8('0x1d')]=_0x2cb0b6[_0xa5a8('0x8')];if(_[_0xa5a8('0x19')](channels[_0x2cb0b6[_0xa5a8('0x12')]]['answertime'])){channels[_0x2cb0b6['linkedid']][_0xa5a8('0x1e')]=utils[_0xa5a8('0x15')]();}channels[_0x2cb0b6['linkedid']][_0xa5a8('0x1f')]=dispositions[_[_0xa5a8('0x20')](_0x2cb0b6[_0xa5a8('0x1b')])]||'ANSWERED';}}catch(_0x220884){utils['error'](_0x220884['stack']);}};exports[_0xa5a8('0x21')]=function(_0x58b14f){try{if(!_[_0xa5a8('0x19')](channels[_0x58b14f['uniqueid']])){if(_[_0xa5a8('0x19')](channels[_0x58b14f[_0xa5a8('0x10')]][_0xa5a8('0x22')])){channels[_0x58b14f[_0xa5a8('0x10')]][_0xa5a8('0x22')]=_0x58b14f[_0xa5a8('0x23')]+'\x20<'+_0x58b14f[_0xa5a8('0x24')]+'>';}channels[_0x58b14f['uniqueid']]['endtime']=utils[_0xa5a8('0x15')]();channels[_0x58b14f['uniqueid']][_0xa5a8('0x25')]=utils[_0xa5a8('0x26')](channels[_0x58b14f[_0xa5a8('0x10')]][_0xa5a8('0x27')],channels[_0x58b14f[_0xa5a8('0x10')]][_0xa5a8('0x28')]);channels[_0x58b14f[_0xa5a8('0x10')]][_0xa5a8('0x29')]=channels[_0x58b14f['uniqueid']][_0xa5a8('0x1e')]?utils[_0xa5a8('0x26')](channels[_0x58b14f[_0xa5a8('0x10')]][_0xa5a8('0x27')],channels[_0x58b14f[_0xa5a8('0x10')]][_0xa5a8('0x1e')]):0x0;writeDB(channels[_0x58b14f[_0xa5a8('0x10')]]);}}catch(_0x145e45){utils[_0xa5a8('0x16')](_0x145e45[_0xa5a8('0x17')]);}};exports[_0xa5a8('0x2a')]=function(_0x46e937){try{if(!_['isNil'](channels[_0x46e937[_0xa5a8('0x2b')]])){if(channels[_0x46e937['localtwolinkedid']][_0xa5a8('0x8')]==_0x46e937[_0xa5a8('0x2c')]){channels[_0x46e937[_0xa5a8('0x2b')]][_0xa5a8('0x1d')]=_0x46e937[_0xa5a8('0x2d')];channels[_0x46e937['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x46e937[_0xa5a8('0x2b')]][_0xa5a8('0x8')]=_0x46e937['transfertargetchannel']){channels[_0x46e937[_0xa5a8('0x2b')]][_0xa5a8('0x1d')]=_0x46e937['origtransfererchannel'];channels[_0x46e937[_0xa5a8('0x2b')]][_0xa5a8('0x2e')]=_0xa5a8('0x2f');}}}catch(_0x382652){utils[_0xa5a8('0x16')](_0x382652[_0xa5a8('0x17')]);}};exports[_0xa5a8('0x30')]=function(_0x3cf823){try{if(!_[_0xa5a8('0x19')](channels[_0x3cf823[_0xa5a8('0x10')]])){channels[_0x3cf823[_0xa5a8('0x10')]][_0xa5a8('0x31')]=utils['now']();}}catch(_0x18776b){utils['error'](_0x18776b[_0xa5a8('0x17')]);}};exports[_0xa5a8('0x32')]=function(_0x530969){try{if(!_[_0xa5a8('0x19')](channels[_0x530969['uniqueid']])){if(!_[_0xa5a8('0x19')](channels[_0x530969['uniqueid']][_0xa5a8('0x31')])){channels[_0x530969['uniqueid']]['mohtime']+=utils[_0xa5a8('0x26')](utils['now'](),channels[_0x530969['uniqueid']]['musiconholdstartAt']);delete channels[_0x530969[_0xa5a8('0x10')]][_0xa5a8('0x31')];}}}catch(_0x4db0f9){utils[_0xa5a8('0x16')](_0x4db0f9[_0xa5a8('0x17')]);}};exports[_0xa5a8('0x33')]=function(_0x112801){try{if(!_['isNil'](channels[_0x112801[_0xa5a8('0x10')]])){if(!_[_0xa5a8('0x19')](_0x112801[_0xa5a8('0x34')][_0xa5a8('0x35')])){channels[_0x112801[_0xa5a8('0x10')]][_0xa5a8('0xb')]=_0x112801[_0xa5a8('0x36')];}if(!_[_0xa5a8('0x19')](_0x112801[_0xa5a8('0x34')]['xmd-phone'])){channels[_0x112801['uniqueid']][_0xa5a8('0x37')]=_0x112801[_0xa5a8('0x36')];channels[_0x112801['uniqueid']]['callerid']='\x22'+_0x112801[_0xa5a8('0x36')]+_0xa5a8('0x38')+_0x112801[_0xa5a8('0x36')]+'>';}if(!_[_0xa5a8('0x19')](_0x112801[_0xa5a8('0x34')]['xmd-callerid-preview'])||!_[_0xa5a8('0x19')](_0x112801['variable'][_0xa5a8('0x39')])){channels[_0x112801[_0xa5a8('0x10')]][_0xa5a8('0x22')]=_0x112801[_0xa5a8('0x36')];}if(!_[_0xa5a8('0x19')](_0x112801[_0xa5a8('0x34')]['xmd-queue'])||!_[_0xa5a8('0x19')](_0x112801[_0xa5a8('0x34')][_0xa5a8('0x3a')])){channels[_0x112801[_0xa5a8('0x10')]][_0xa5a8('0x3b')]=_0xa5a8('0x3c');channels[_0x112801[_0xa5a8('0x10')]][_0xa5a8('0x3d')]=_0x112801['value'];channels[_0x112801[_0xa5a8('0x10')]]['queue']=!![];}if(!_['isNil'](_0x112801[_0xa5a8('0x34')][_0xa5a8('0x3e')])){channels[_0x112801[_0xa5a8('0x10')]][_0xa5a8('0x3f')]=_0x112801[_0xa5a8('0x36')];}if(!_[_0xa5a8('0x19')](_0x112801['variable'][_0xa5a8('0x40')])){channels[_0x112801[_0xa5a8('0x10')]]['type']=_0x112801[_0xa5a8('0x36')];}if(!_[_0xa5a8('0x19')](_0x112801[_0xa5a8('0x34')][_0xa5a8('0x41')])){channels[_0x112801['uniqueid']][_0xa5a8('0x42')]=_0x112801[_0xa5a8('0x36')];}if(!_[_0xa5a8('0x19')](_0x112801[_0xa5a8('0x34')][_0xa5a8('0x43')])){channels[_0x112801[_0xa5a8('0x10')]][_0xa5a8('0x43')]=_0x112801[_0xa5a8('0x36')];}}}catch(_0x5afe44){utils['error'](_0x5afe44[_0xa5a8('0x17')]);}};exports[_0xa5a8('0x44')]=function(_0x3eb4c2){try{if(!_[_0xa5a8('0x19')](channels[_0x3eb4c2[_0xa5a8('0x10')]])){if(_0x3eb4c2['application']['toLowerCase']()==_0xa5a8('0x45')&&_[_0xa5a8('0x46')](_0x3eb4c2[_0xa5a8('0x47')][_0xa5a8('0x48')](),'cdr')){var _0x53243c=_0x3eb4c2[_0xa5a8('0x47')][_0xa5a8('0x49')]('=');var _0x76fad9=_0x53243c[0x0][_0xa5a8('0x4a')](_0x53243c[0x0][_0xa5a8('0x4b')]('(')+0x1,_0x53243c[0x0]['lastIndexOf'](')'));var _0x129b7=_0x53243c[0x1];channels[_0x3eb4c2['uniqueid']][_0x76fad9]=_0x129b7;}if(!_['includes']([_0xa5a8('0x21'),_0xa5a8('0x4c'),'execif',_0xa5a8('0x45'),'gotoif'],_0x3eb4c2[_0xa5a8('0x4d')]['toLowerCase']())){channels[_0x3eb4c2[_0xa5a8('0x10')]][_0xa5a8('0x3b')]=_0x3eb4c2[_0xa5a8('0x4d')];channels[_0x3eb4c2['uniqueid']]['lastdata']=_0x3eb4c2['appdata'];}}}catch(_0x3f2d15){utils['error'](_0x3f2d15[_0xa5a8('0x17')]);}}; \ No newline at end of file +var _0x69ab=['xmd-phone','value','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','ContactId','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','startsWith','appdata','cdr','split','lastIndexOf','noop','execif','set','gotoif','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','uniqueid','type','accountcode','destination','callerid','disposition','then','UserId','request','CreateVoiceCallReport','linkedid','OutgoingSpoolFailed','exten','context','channel','DOCUMENTATION','error','newstate','channelstate','isNil','systemanswertime','now','transfer','destinationchannel','answertime','toNumber','stack','hangup','calleridname','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','musiconholdstartAt','mohtime','varset','variable','xmd-originatecalleridnum','source'];(function(_0x17ff50,_0x52e1ab){var _0x5d6cda=function(_0x209c22){while(--_0x209c22){_0x17ff50['push'](_0x17ff50['shift']());}};_0x5d6cda(++_0x52e1ab);}(_0x69ab,0x19a));var _0xb69a=function(_0x13455a,_0x222b7e){_0x13455a=_0x13455a-0x0;var _0x328261=_0x69ab[_0x13455a];return _0x328261;};'use strict';var _=require('lodash');var util=require(_0xb69a('0x0'));var utils=require(_0xb69a('0x1'));var dispositions=[_0xb69a('0x2'),_0xb69a('0x3'),'FAILED',_0xb69a('0x2'),'NO\x20ANSWER',_0xb69a('0x2'),_0xb69a('0x4'),'BUSY','FAILED','FAILED',_0xb69a('0x3')];var channels={};function writeDB(_0x424de3){utils[_0xb69a('0x5')](util[_0xb69a('0x6')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x424de3[_0xb69a('0x7')],_0x424de3['channel'],_0x424de3[_0xb69a('0x8')],_0x424de3[_0xb69a('0x9')],_0x424de3['source'],_0x424de3[_0xb69a('0xa')],_0x424de3[_0xb69a('0xb')],_0x424de3[_0xb69a('0xc')]));if(_0x424de3[_0xb69a('0x9')]){utils['getUserByInternal'](_0x424de3[_0xb69a('0x9')])[_0xb69a('0xd')](function(_0x483d2f){if(_0x483d2f){_0x424de3[_0xb69a('0xe')]=_0x483d2f['id'];}utils[_0xb69a('0xf')](_0xb69a('0x10'),_0x424de3);});}else{utils['request'](_0xb69a('0x10'),_0x424de3);}if(channels[_0x424de3[_0xb69a('0x7')]]){delete channels[_0x424de3[_0xb69a('0x7')]];}}exports['newchannel']=function(_0x4eca77){try{if(_0x4eca77[_0xb69a('0x7')]==_0x4eca77[_0xb69a('0x11')]&&_0x4eca77['channel']!=_0xb69a('0x12')){channels[_0x4eca77[_0xb69a('0x7')]]={'uniqueid':_0x4eca77['uniqueid'],'accountcode':_0x4eca77['accountcode'],'source':_0x4eca77['calleridnum'],'destination':_0x4eca77[_0xb69a('0x13')],'destinationcontext':_0x4eca77[_0xb69a('0x14')],'channel':_0x4eca77[_0xb69a('0x15')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xb69a('0x16')};}}catch(_0x523a71){utils[_0xb69a('0x17')](_0x523a71['stack']);}};exports[_0xb69a('0x18')]=function(_0x4277d3){try{if(!_['isNil'](channels[_0x4277d3['uniqueid']])&&_0x4277d3[_0xb69a('0x19')]==0x6){if(_[_0xb69a('0x1a')](channels[_0x4277d3[_0xb69a('0x7')]][_0xb69a('0x1b')])){channels[_0x4277d3[_0xb69a('0x7')]][_0xb69a('0x1b')]=utils[_0xb69a('0x1c')]();}}else if(!_[_0xb69a('0x1a')](channels[_0x4277d3['linkedid']])&&_0x4277d3[_0xb69a('0x19')]==0x6&&_0x4277d3[_0xb69a('0x14')]!=_0xb69a('0x1d')){channels[_0x4277d3[_0xb69a('0x11')]][_0xb69a('0x9')]=_0x4277d3[_0xb69a('0x9')];channels[_0x4277d3['linkedid']][_0xb69a('0x1e')]=_0x4277d3[_0xb69a('0x15')];if(_[_0xb69a('0x1a')](channels[_0x4277d3[_0xb69a('0x11')]]['answertime'])){channels[_0x4277d3[_0xb69a('0x11')]][_0xb69a('0x1f')]=utils[_0xb69a('0x1c')]();}channels[_0x4277d3[_0xb69a('0x11')]]['disposition']=dispositions[_[_0xb69a('0x20')](_0x4277d3[_0xb69a('0x19')])]||_0xb69a('0x4');}}catch(_0x3c5cbf){utils[_0xb69a('0x17')](_0x3c5cbf[_0xb69a('0x21')]);}};exports[_0xb69a('0x22')]=function(_0x2db825){try{if(!_['isNil'](channels[_0x2db825[_0xb69a('0x7')]])){if(_[_0xb69a('0x1a')](channels[_0x2db825[_0xb69a('0x7')]][_0xb69a('0xb')])){channels[_0x2db825[_0xb69a('0x7')]][_0xb69a('0xb')]=_0x2db825[_0xb69a('0x23')]+'\x20<'+_0x2db825['calleridnum']+'>';}channels[_0x2db825['uniqueid']][_0xb69a('0x24')]=utils[_0xb69a('0x1c')]();channels[_0x2db825[_0xb69a('0x7')]]['duration']=utils[_0xb69a('0x25')](channels[_0x2db825['uniqueid']][_0xb69a('0x24')],channels[_0x2db825['uniqueid']][_0xb69a('0x26')]);channels[_0x2db825[_0xb69a('0x7')]][_0xb69a('0x27')]=channels[_0x2db825[_0xb69a('0x7')]][_0xb69a('0x1f')]?utils[_0xb69a('0x25')](channels[_0x2db825[_0xb69a('0x7')]][_0xb69a('0x24')],channels[_0x2db825[_0xb69a('0x7')]]['answertime']):0x0;writeDB(channels[_0x2db825['uniqueid']]);}}catch(_0x41bc9c){utils[_0xb69a('0x17')](_0x41bc9c[_0xb69a('0x21')]);}};exports[_0xb69a('0x28')]=function(_0x448fb6){try{if(!_[_0xb69a('0x1a')](channels[_0x448fb6[_0xb69a('0x29')]])){if(channels[_0x448fb6[_0xb69a('0x29')]][_0xb69a('0x15')]==_0x448fb6[_0xb69a('0x2a')]){channels[_0x448fb6[_0xb69a('0x29')]][_0xb69a('0x1e')]=_0x448fb6['secondtransfererchannel'];channels[_0x448fb6[_0xb69a('0x29')]][_0xb69a('0x2b')]=_0xb69a('0x2c');}else if(channels[_0x448fb6[_0xb69a('0x29')]][_0xb69a('0x15')]=_0x448fb6[_0xb69a('0x2d')]){channels[_0x448fb6[_0xb69a('0x29')]][_0xb69a('0x1e')]=_0x448fb6['origtransfererchannel'];channels[_0x448fb6[_0xb69a('0x29')]][_0xb69a('0x2b')]=_0xb69a('0x2c');}}}catch(_0x1edb6e){utils[_0xb69a('0x17')](_0x1edb6e['stack']);}};exports['musiconholdstart']=function(_0x46c1af){try{if(!_[_0xb69a('0x1a')](channels[_0x46c1af[_0xb69a('0x7')]])){channels[_0x46c1af['uniqueid']]['musiconholdstartAt']=utils['now']();}}catch(_0x182baa){utils[_0xb69a('0x17')](_0x182baa[_0xb69a('0x21')]);}};exports['musiconholdstop']=function(_0x4e7c3c){try{if(!_['isNil'](channels[_0x4e7c3c['uniqueid']])){if(!_[_0xb69a('0x1a')](channels[_0x4e7c3c[_0xb69a('0x7')]][_0xb69a('0x2e')])){channels[_0x4e7c3c['uniqueid']][_0xb69a('0x2f')]+=utils[_0xb69a('0x25')](utils[_0xb69a('0x1c')](),channels[_0x4e7c3c[_0xb69a('0x7')]][_0xb69a('0x2e')]);delete channels[_0x4e7c3c['uniqueid']]['musiconholdstartAt'];}}}catch(_0x1799bd){utils[_0xb69a('0x17')](_0x1799bd['stack']);}};exports[_0xb69a('0x30')]=function(_0x599222){try{if(!_[_0xb69a('0x1a')](channels[_0x599222['uniqueid']])){if(!_['isNil'](_0x599222[_0xb69a('0x31')][_0xb69a('0x32')])){channels[_0x599222['uniqueid']][_0xb69a('0x33')]=_0x599222['value'];}if(!_[_0xb69a('0x1a')](_0x599222[_0xb69a('0x31')][_0xb69a('0x34')])){channels[_0x599222['uniqueid']][_0xb69a('0xa')]=_0x599222[_0xb69a('0x35')];channels[_0x599222['uniqueid']][_0xb69a('0xb')]='\x22'+_0x599222[_0xb69a('0x35')]+_0xb69a('0x36')+_0x599222[_0xb69a('0x35')]+'>';}if(!_[_0xb69a('0x1a')](_0x599222[_0xb69a('0x31')][_0xb69a('0x37')])||!_[_0xb69a('0x1a')](_0x599222[_0xb69a('0x31')]['xmd-callerid'])){channels[_0x599222[_0xb69a('0x7')]][_0xb69a('0xb')]=_0x599222[_0xb69a('0x35')];}if(!_['isNil'](_0x599222[_0xb69a('0x31')][_0xb69a('0x38')])||!_[_0xb69a('0x1a')](_0x599222[_0xb69a('0x31')][_0xb69a('0x39')])){channels[_0x599222['uniqueid']][_0xb69a('0x3a')]='Queue';channels[_0x599222['uniqueid']][_0xb69a('0x3b')]=_0x599222[_0xb69a('0x35')];channels[_0x599222[_0xb69a('0x7')]][_0xb69a('0x3c')]=!![];}if(!_['isNil'](_0x599222[_0xb69a('0x31')]['xmd-contactid'])){channels[_0x599222[_0xb69a('0x7')]][_0xb69a('0x3d')]=_0x599222[_0xb69a('0x35')];}if(!_[_0xb69a('0x1a')](_0x599222[_0xb69a('0x31')]['xmd-cdrtype'])){channels[_0x599222['uniqueid']]['type']=_0x599222[_0xb69a('0x35')];}if(!_[_0xb69a('0x1a')](_0x599222['variable'][_0xb69a('0x3e')])){channels[_0x599222[_0xb69a('0x7')]][_0xb69a('0x3f')]=_0x599222['value'];}if(!_[_0xb69a('0x1a')](_0x599222[_0xb69a('0x31')][_0xb69a('0x40')])){channels[_0x599222[_0xb69a('0x7')]][_0xb69a('0x40')]=_0x599222[_0xb69a('0x35')];}}}catch(_0xb7f3a5){utils[_0xb69a('0x17')](_0xb7f3a5[_0xb69a('0x21')]);}};exports[_0xb69a('0x41')]=function(_0x2cc573){try{if(!_[_0xb69a('0x1a')](channels[_0x2cc573['uniqueid']])){if(_0x2cc573[_0xb69a('0x42')][_0xb69a('0x43')]()=='set'&&_[_0xb69a('0x44')](_0x2cc573[_0xb69a('0x45')][_0xb69a('0x43')](),_0xb69a('0x46'))){var _0x2597db=_0x2cc573[_0xb69a('0x45')][_0xb69a('0x47')]('=');var _0x99696c=_0x2597db[0x0]['substring'](_0x2597db[0x0][_0xb69a('0x48')]('(')+0x1,_0x2597db[0x0][_0xb69a('0x48')](')'));var _0x26f683=_0x2597db[0x1];channels[_0x2cc573[_0xb69a('0x7')]][_0x99696c]=_0x26f683;}if(!_['includes']([_0xb69a('0x22'),_0xb69a('0x49'),_0xb69a('0x4a'),_0xb69a('0x4b'),_0xb69a('0x4c')],_0x2cc573[_0xb69a('0x42')][_0xb69a('0x43')]())){channels[_0x2cc573[_0xb69a('0x7')]][_0xb69a('0x3a')]=_0x2cc573[_0xb69a('0x42')];channels[_0x2cc573['uniqueid']]['lastdata']=_0x2cc573[_0xb69a('0x45')];}}}catch(_0x1f3177){utils['error'](_0x1f3177['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d5cfb24..8fb46da 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 _0x6f47=['managerevent','lodash','connect','CONNECTED','info','fullybooted','FULLYBOOTED','error','close'];(function(_0x4a0242,_0x492868){var _0x21f9bf=function(_0x2781f7){while(--_0x2781f7){_0x4a0242['push'](_0x4a0242['shift']());}};_0x21f9bf(++_0x492868);}(_0x6f47,0xc7));var _0x76f4=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x6f47[_0x5d4607];return _0x5e4a86;};'use strict';var utils=require('./utils');var _=require(_0x76f4('0x0'));exports[_0x76f4('0x1')]=function(){utils['info'](_0x76f4('0x2'));};exports['shutdown']=function(){utils[_0x76f4('0x3')]('SHUTDOWN');};exports[_0x76f4('0x4')]=function(){utils[_0x76f4('0x3')](_0x76f4('0x5'));};exports[_0x76f4('0x6')]=function(_0x5754ca){utils[_0x76f4('0x6')](_0x5754ca);};exports[_0x76f4('0x7')]=function(){utils[_0x76f4('0x3')]('CLOSE');};exports[_0x76f4('0x8')]=function(_0x25656d){}; \ No newline at end of file +var _0xaa3f=['shutdown','SHUTDOWN','fullybooted','error','close','CLOSE','managerevent','./utils','lodash','connect','info','CONNECTED'];(function(_0x5959ae,_0x10edb5){var _0x4943fc=function(_0x180b5a){while(--_0x180b5a){_0x5959ae['push'](_0x5959ae['shift']());}};_0x4943fc(++_0x10edb5);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5bcb82,_0x21c46c){_0x5bcb82=_0x5bcb82-0x0;var _0x1c27be=_0xaa3f[_0x5bcb82];return _0x1c27be;};'use strict';var utils=require(_0xfaa3('0x0'));var _=require(_0xfaa3('0x1'));exports[_0xfaa3('0x2')]=function(){utils[_0xfaa3('0x3')](_0xfaa3('0x4'));};exports[_0xfaa3('0x5')]=function(){utils[_0xfaa3('0x3')](_0xfaa3('0x6'));};exports[_0xfaa3('0x7')]=function(){utils['info']('FULLYBOOTED');};exports[_0xfaa3('0x8')]=function(_0x4bac92){utils[_0xfaa3('0x8')](_0x4bac92);};exports[_0xfaa3('0x9')]=function(){utils[_0xfaa3('0x3')](_0xfaa3('0xa'));};exports[_0xfaa3('0xb')]=function(_0x2e422d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 7184393..ef52714 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 _0xaa61=['complete','diffTime','endtime','billableseconds','lodash','util','./utils','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','toLowerCase','set','cdr(routeid)','appdata','split','error','stack','varset','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','isNil','ANSWER','answertime','connect'];(function(_0x130491,_0x4ceb74){var _0x1e77ba=function(_0x53c334){while(--_0x53c334){_0x130491['push'](_0x130491['shift']());}};_0x1e77ba(++_0x4ceb74);}(_0xaa61,0x1cc));var _0x1aa6=function(_0x3043e2,_0x2fa9ac){_0x3043e2=_0x3043e2-0x0;var _0x108d92=_0xaa61[_0x3043e2];return _0x108d92;};'use strict';var _=require(_0x1aa6('0x0'));var util=require(_0x1aa6('0x1'));var utils=require(_0x1aa6('0x2'));var dials={};function writeDB(_0x141e8f){utils['info'](util[_0x1aa6('0x3')](_0x1aa6('0x4'),_0x141e8f[_0x1aa6('0x5')],_0x141e8f[_0x1aa6('0x6')],_0x141e8f[_0x1aa6('0x7')],_0x141e8f[_0x1aa6('0x8')],_0x141e8f[_0x1aa6('0x9')],_0x141e8f[_0x1aa6('0xa')]));utils[_0x1aa6('0xb')](_0x1aa6('0xc'),_0x141e8f);delete dials[_0x141e8f[_0x1aa6('0x5')]];}exports[_0x1aa6('0xd')]=function(_0x400ba4){try{if(_0x400ba4['application'][_0x1aa6('0xe')]()==_0x1aa6('0xf')&&_['startsWith'](_0x400ba4['appdata'][_0x1aa6('0xe')](),_0x1aa6('0x10'))){var _0x1c2169=_0x400ba4[_0x1aa6('0x11')][_0x1aa6('0x12')]('=');dials[_0x400ba4[_0x1aa6('0x5')]]={'routeId':_0x1c2169[0x1]};}}catch(_0x290abd){utils[_0x1aa6('0x13')](_0x290abd[_0x1aa6('0x14')]);}};exports[_0x1aa6('0x15')]=function(_0x1654fe){try{if(!_['isNil'](_0x1654fe[_0x1aa6('0x16')][_0x1aa6('0x17')])){dials[_0x1654fe[_0x1aa6('0x5')]]={'routeId':_0x1654fe[_0x1aa6('0x18')]};}}catch(_0x42d023){utils[_0x1aa6('0x13')](_0x42d023['stack']);}};exports[_0x1aa6('0x19')]=function(_0x3d9793){try{if(!_['isNil'](dials[_0x3d9793[_0x1aa6('0x5')]])){dials[_0x3d9793[_0x1aa6('0x5')]]=_[_0x1aa6('0x1a')](dials[_0x3d9793[_0x1aa6('0x5')]],_0x3d9793);dials[_0x3d9793[_0x1aa6('0x5')]][_0x1aa6('0x1b')]=utils[_0x1aa6('0x1c')]();dials[_0x3d9793['uniqueid']][_0x1aa6('0x1d')]='called';}}catch(_0x26d4cb){utils['error'](_0x26d4cb[_0x1aa6('0x14')]);}};exports['dialend']=function(_0x3de9f8){try{if(!_[_0x1aa6('0x1e')](dials[_0x3de9f8['uniqueid']])){dials[_0x3de9f8[_0x1aa6('0x5')]]['dialstatus']=_0x3de9f8['dialstatus'];if(_0x3de9f8[_0x1aa6('0xa')]==_0x1aa6('0x1f')){dials[_0x3de9f8[_0x1aa6('0x5')]]=_[_0x1aa6('0x1a')](dials[_0x3de9f8['uniqueid']],_0x3de9f8);dials[_0x3de9f8['uniqueid']][_0x1aa6('0x20')]=utils['now']();dials[_0x3de9f8[_0x1aa6('0x5')]][_0x1aa6('0x1d')]=_0x1aa6('0x21');}}}catch(_0x32d3ce){utils['error'](_0x32d3ce[_0x1aa6('0x14')]);}};exports['hangup']=function(_0x382b7e){try{if(!_[_0x1aa6('0x1e')](dials[_0x382b7e[_0x1aa6('0x5')]])){dials[_0x382b7e[_0x1aa6('0x5')]]=_['assign'](dials[_0x382b7e[_0x1aa6('0x5')]],{'endtime':utils['now'](),'lastevent':_0x1aa6('0x22')});dials[_0x382b7e['uniqueid']]['duration']=utils['diffTime'](dials[_0x382b7e[_0x1aa6('0x5')]]['endtime'],dials[_0x382b7e[_0x1aa6('0x5')]]['starttime']);dials[_0x382b7e['uniqueid']]['holdtime']=utils[_0x1aa6('0x23')](dials[_0x382b7e[_0x1aa6('0x5')]][_0x1aa6('0x20')]||dials[_0x382b7e[_0x1aa6('0x5')]][_0x1aa6('0x24')],dials[_0x382b7e['uniqueid']][_0x1aa6('0x1b')]);dials[_0x382b7e[_0x1aa6('0x5')]][_0x1aa6('0x25')]=dials[_0x382b7e[_0x1aa6('0x5')]]['answertime']?utils[_0x1aa6('0x23')](dials[_0x382b7e['uniqueid']][_0x1aa6('0x24')],dials[_0x382b7e['uniqueid']][_0x1aa6('0x20')]):0x0;writeDB(dials[_0x382b7e[_0x1aa6('0x5')]]);}}catch(_0x44c65a){utils[_0x1aa6('0x13')](_0x44c65a['stack']);}}; \ No newline at end of file +var _0xbe5d=['holdtime','diffTime','billableseconds','lodash','util','info','format','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','uniqueid','stack','varset','variable','outboundrouteid','value','error','dialbegin','assign','now','lastevent','dialend','isNil','answertime','connect','hangup','endtime','starttime'];(function(_0x148169,_0x563a50){var _0x4518dc=function(_0xde988f){while(--_0xde988f){_0x148169['push'](_0x148169['shift']());}};_0x4518dc(++_0x563a50);}(_0xbe5d,0x1b0));var _0xdbe5=function(_0x159f62,_0x31c2c8){_0x159f62=_0x159f62-0x0;var _0x155ac4=_0xbe5d[_0x159f62];return _0x155ac4;};'use strict';var _=require(_0xdbe5('0x0'));var util=require(_0xdbe5('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x44878e){utils[_0xdbe5('0x2')](util[_0xdbe5('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x44878e['uniqueid'],_0x44878e[_0xdbe5('0x4')],_0x44878e[_0xdbe5('0x5')],_0x44878e['calleridnum'],_0x44878e[_0xdbe5('0x6')],_0x44878e[_0xdbe5('0x7')]));utils[_0xdbe5('0x8')](_0xdbe5('0x9'),_0x44878e);delete dials[_0x44878e['uniqueid']];}exports[_0xdbe5('0xa')]=function(_0x1b7a19){try{if(_0x1b7a19[_0xdbe5('0xb')][_0xdbe5('0xc')]()==_0xdbe5('0xd')&&_[_0xdbe5('0xe')](_0x1b7a19[_0xdbe5('0xf')][_0xdbe5('0xc')](),_0xdbe5('0x10'))){var _0x310337=_0x1b7a19[_0xdbe5('0xf')][_0xdbe5('0x11')]('=');dials[_0x1b7a19[_0xdbe5('0x12')]]={'routeId':_0x310337[0x1]};}}catch(_0x3fa4bf){utils['error'](_0x3fa4bf[_0xdbe5('0x13')]);}};exports[_0xdbe5('0x14')]=function(_0x14ae5f){try{if(!_['isNil'](_0x14ae5f[_0xdbe5('0x15')][_0xdbe5('0x16')])){dials[_0x14ae5f[_0xdbe5('0x12')]]={'routeId':_0x14ae5f[_0xdbe5('0x17')]};}}catch(_0x56f7d4){utils[_0xdbe5('0x18')](_0x56f7d4[_0xdbe5('0x13')]);}};exports[_0xdbe5('0x19')]=function(_0x581410){try{if(!_['isNil'](dials[_0x581410[_0xdbe5('0x12')]])){dials[_0x581410[_0xdbe5('0x12')]]=_[_0xdbe5('0x1a')](dials[_0x581410[_0xdbe5('0x12')]],_0x581410);dials[_0x581410[_0xdbe5('0x12')]]['starttime']=utils[_0xdbe5('0x1b')]();dials[_0x581410['uniqueid']][_0xdbe5('0x1c')]='called';}}catch(_0x1eb0c2){utils[_0xdbe5('0x18')](_0x1eb0c2['stack']);}};exports[_0xdbe5('0x1d')]=function(_0x751f68){try{if(!_[_0xdbe5('0x1e')](dials[_0x751f68[_0xdbe5('0x12')]])){dials[_0x751f68[_0xdbe5('0x12')]][_0xdbe5('0x7')]=_0x751f68[_0xdbe5('0x7')];if(_0x751f68[_0xdbe5('0x7')]=='ANSWER'){dials[_0x751f68[_0xdbe5('0x12')]]=_[_0xdbe5('0x1a')](dials[_0x751f68['uniqueid']],_0x751f68);dials[_0x751f68[_0xdbe5('0x12')]][_0xdbe5('0x1f')]=utils['now']();dials[_0x751f68[_0xdbe5('0x12')]][_0xdbe5('0x1c')]=_0xdbe5('0x20');}}}catch(_0x127cc8){utils['error'](_0x127cc8[_0xdbe5('0x13')]);}};exports[_0xdbe5('0x21')]=function(_0x9746b6){try{if(!_[_0xdbe5('0x1e')](dials[_0x9746b6['uniqueid']])){dials[_0x9746b6[_0xdbe5('0x12')]]=_['assign'](dials[_0x9746b6[_0xdbe5('0x12')]],{'endtime':utils[_0xdbe5('0x1b')](),'lastevent':'complete'});dials[_0x9746b6[_0xdbe5('0x12')]]['duration']=utils['diffTime'](dials[_0x9746b6[_0xdbe5('0x12')]][_0xdbe5('0x22')],dials[_0x9746b6[_0xdbe5('0x12')]][_0xdbe5('0x23')]);dials[_0x9746b6[_0xdbe5('0x12')]][_0xdbe5('0x24')]=utils[_0xdbe5('0x25')](dials[_0x9746b6[_0xdbe5('0x12')]][_0xdbe5('0x1f')]||dials[_0x9746b6[_0xdbe5('0x12')]]['endtime'],dials[_0x9746b6['uniqueid']][_0xdbe5('0x23')]);dials[_0x9746b6['uniqueid']][_0xdbe5('0x26')]=dials[_0x9746b6[_0xdbe5('0x12')]][_0xdbe5('0x1f')]?utils['diffTime'](dials[_0x9746b6['uniqueid']]['endtime'],dials[_0x9746b6[_0xdbe5('0x12')]]['answertime']):0x0;writeDB(dials[_0x9746b6['uniqueid']]);}}catch(_0x38d02d){utils[_0xdbe5('0x18')](_0x38d02d[_0xdbe5('0x13')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 584d66e..8040c89 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 _0x590a=['musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','asterisk','port','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x590a,0x186));var _0xa590=function(_0x2a4360,_0x38b082){_0x2a4360=_0x2a4360-0x0;var _0xe0bbec=_0x590a[_0x2a4360];return _0xe0bbec;};var AsteriskManager=require(_0xa590('0x0'));var config=require('../../config/environment');var utils=require(_0xa590('0x1'));var ami=new AsteriskManager(config[_0xa590('0x2')][_0xa590('0x3')],config['asterisk']['ip'],config['asterisk'][_0xa590('0x4')],config[_0xa590('0x2')]['password'],!![]);ami[_0xa590('0x5')]();if(config[_0xa590('0x6')]&&config[_0xa590('0x6')][_0xa590('0x7')]){utils[_0xa590('0x8')](_0xa590('0x9'));}else{var agents=require(_0xa590('0xa'));var calls=require(_0xa590('0xb'));var queues=require(_0xa590('0xc'));var recordings=require('./recordings.controller');var members=require(_0xa590('0xd'));var dials=require(_0xa590('0xe'));var transfers=require(_0xa590('0xf'));var core=require(_0xa590('0x10'));ami['on'](_0xa590('0x11'),core[_0xa590('0x11')]);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core[_0xa590('0x12')]);ami['on'](_0xa590('0x13'),core[_0xa590('0x13')]);ami['on'](_0xa590('0x14'),core[_0xa590('0x14')]);ami['on'](_0xa590('0x15'),core[_0xa590('0x15')]);ami['on'](_0xa590('0x16'),function(_0x239d1a){try{members['devicestatechange'](_0x239d1a);}catch(_0x1fa72d){utils[_0xa590('0x13')](_0x1fa72d);}});ami['on'](_0xa590('0x17'),function(_0x309ed2){try{agents[_0xa590('0x17')](_0x309ed2);}catch(_0x592223){utils[_0xa590('0x13')](_0x592223);}});ami['on'](_0xa590('0x18'),function(_0x4084b1){try{agents['agentringnoanswer'](_0x4084b1);}catch(_0x3d2533){utils[_0xa590('0x13')](_0x3d2533);}});ami['on']('agentconnect',function(_0xad98c8){try{agents[_0xa590('0x19')](_0xad98c8);queues[_0xa590('0x19')](_0xad98c8);}catch(_0x1375f0){utils[_0xa590('0x13')](_0x1375f0);}});ami['on'](_0xa590('0x1a'),function(_0x1e2201){try{agents[_0xa590('0x1a')](_0x1e2201);queues[_0xa590('0x1a')](_0x1e2201);members[_0xa590('0x1a')](_0x1e2201);}catch(_0x47b4f8){utils['error'](_0x47b4f8);}});ami['on'](_0xa590('0x1b'),function(_0x38769d){try{agents['queuecallerabandon'](_0x38769d);queues[_0xa590('0x1b')](_0x38769d);}catch(_0x2bb6b8){utils['error'](_0x2bb6b8);}});ami['on'](_0xa590('0x1c'),function(_0x186187){try{queues[_0xa590('0x1c')](_0x186187);recordings[_0xa590('0x1c')](_0x186187);}catch(_0x1ee4a4){utils[_0xa590('0x13')](_0x1ee4a4);}});ami['on'](_0xa590('0x1d'),function(_0x543a3d){try{queues[_0xa590('0x1d')](_0x543a3d);}catch(_0x3939c4){utils[_0xa590('0x13')](_0x3939c4);}});ami['on']('musiconholdstart',function(_0x991623){try{queues[_0xa590('0x1e')](_0x991623);calls['musiconholdstart'](_0x991623);}catch(_0x50b8f2){utils[_0xa590('0x13')](_0x50b8f2);}});ami['on']('musiconholdstop',function(_0x16829b){try{queues['musiconholdstop'](_0x16829b);calls[_0xa590('0x1f')](_0x16829b);}catch(_0x1ed7db){utils[_0xa590('0x13')](_0x1ed7db);}});ami['on']('newstate',function(_0x18686d){try{calls[_0xa590('0x20')](_0x18686d);recordings[_0xa590('0x20')](_0x18686d);}catch(_0x24a524){utils[_0xa590('0x13')](_0x24a524);}});ami['on']('hangup',function(_0x304d40){try{calls[_0xa590('0x21')](_0x304d40);recordings[_0xa590('0x21')](_0x304d40);dials[_0xa590('0x21')](_0x304d40);agents[_0xa590('0x21')](_0x304d40);queues[_0xa590('0x21')](_0x304d40);}catch(_0x1c2c2b){utils['error'](_0x1c2c2b);}});ami['on'](_0xa590('0x22'),function(_0x13ec32){try{members[_0xa590('0x22')](_0x13ec32);}catch(_0x362ec5){utils[_0xa590('0x13')](_0x362ec5);}});ami['on'](_0xa590('0x23'),function(_0x4f21f7){try{queues[_0xa590('0x23')](_0x4f21f7);agents[_0xa590('0x23')](_0x4f21f7);transfers[_0xa590('0x23')](_0x4f21f7);}catch(_0x3a12b0){utils[_0xa590('0x13')](_0x3a12b0);}});ami['on']('attendedtransfer',function(_0xd8af6a){try{queues[_0xa590('0x24')](_0xd8af6a);transfers[_0xa590('0x24')](_0xd8af6a);agents[_0xa590('0x24')](_0xd8af6a);calls['attendedtransfer'](_0xd8af6a);}catch(_0x35f4af){utils['error'](_0x35f4af);}});ami['on'](_0xa590('0x25'),function(_0x52259f){try{queues[_0xa590('0x25')](_0x52259f);recordings[_0xa590('0x25')](_0x52259f);calls['varset'](_0x52259f);dials['varset'](_0x52259f);}catch(_0x4ec958){utils['error'](_0x4ec958);}});ami['on'](_0xa590('0x26'),function(_0x4b949e){try{calls[_0xa590('0x26')](_0x4b949e);recordings[_0xa590('0x26')](_0x4b949e);dials[_0xa590('0x26')](_0x4b949e);}catch(_0x4340ac){utils['error'](_0x4340ac);}});ami['on'](_0xa590('0x27'),function(_0x3a5aa4){try{calls[_0xa590('0x27')](_0x3a5aa4);recordings[_0xa590('0x27')](_0x3a5aa4);}catch(_0x1c6964){utils[_0xa590('0x13')](_0x1c6964);}});ami['on']('dialbegin',function(_0x5da9f8){try{dials[_0xa590('0x28')](_0x5da9f8);}catch(_0x514d22){utils['error'](_0x514d22);}});ami['on']('dialend',function(_0x3548ba){try{dials[_0xa590('0x29')](_0x3548ba);}catch(_0x480921){utils['error'](_0x480921);}});} \ No newline at end of file +var _0x9ae4=['queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete'];(function(_0x2f3f98,_0xd43341){var _0x161ea2=function(_0xcae9ce){while(--_0xcae9ce){_0x2f3f98['push'](_0x2f3f98['shift']());}};_0x161ea2(++_0xd43341);}(_0x9ae4,0xb7));var _0x49ae=function(_0x119b4a,_0x553699){_0x119b4a=_0x119b4a-0x0;var _0x423f95=_0x9ae4[_0x119b4a];return _0x423f95;};var AsteriskManager=require(_0x49ae('0x0'));var config=require('../../config/environment');var utils=require(_0x49ae('0x1'));var ami=new AsteriskManager(config[_0x49ae('0x2')][_0x49ae('0x3')],config['asterisk']['ip'],config[_0x49ae('0x2')][_0x49ae('0x4')],config[_0x49ae('0x2')][_0x49ae('0x5')],!![]);ami[_0x49ae('0x6')]();if(config[_0x49ae('0x7')]&&config[_0x49ae('0x7')][_0x49ae('0x8')]){utils[_0x49ae('0x9')](_0x49ae('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x49ae('0xb'));var recordings=require(_0x49ae('0xc'));var members=require(_0x49ae('0xd'));var dials=require('./dials.controller');var transfers=require(_0x49ae('0xe'));var core=require(_0x49ae('0xf'));ami['on'](_0x49ae('0x10'),core[_0x49ae('0x10')]);ami['on']('shutdown',core[_0x49ae('0x11')]);ami['on'](_0x49ae('0x12'),core[_0x49ae('0x12')]);ami['on'](_0x49ae('0x13'),core[_0x49ae('0x13')]);ami['on']('close',core[_0x49ae('0x14')]);ami['on'](_0x49ae('0x15'),core[_0x49ae('0x15')]);ami['on'](_0x49ae('0x16'),function(_0x1ae55f){try{members[_0x49ae('0x16')](_0x1ae55f);}catch(_0x16b5ed){utils[_0x49ae('0x13')](_0x16b5ed);}});ami['on'](_0x49ae('0x17'),function(_0x3e1758){try{agents[_0x49ae('0x17')](_0x3e1758);}catch(_0x187990){utils[_0x49ae('0x13')](_0x187990);}});ami['on'](_0x49ae('0x18'),function(_0x5a035b){try{agents[_0x49ae('0x18')](_0x5a035b);}catch(_0x138e36){utils[_0x49ae('0x13')](_0x138e36);}});ami['on'](_0x49ae('0x19'),function(_0x17a0b0){try{agents[_0x49ae('0x19')](_0x17a0b0);queues[_0x49ae('0x19')](_0x17a0b0);}catch(_0x371e70){utils[_0x49ae('0x13')](_0x371e70);}});ami['on']('agentcomplete',function(_0x116430){try{agents['agentcomplete'](_0x116430);queues[_0x49ae('0x1a')](_0x116430);members['agentcomplete'](_0x116430);}catch(_0x58f7cf){utils[_0x49ae('0x13')](_0x58f7cf);}});ami['on'](_0x49ae('0x1b'),function(_0xea2e6){try{agents[_0x49ae('0x1b')](_0xea2e6);queues[_0x49ae('0x1b')](_0xea2e6);}catch(_0x3e1c1c){utils[_0x49ae('0x13')](_0x3e1c1c);}});ami['on'](_0x49ae('0x1c'),function(_0x4c57e5){try{queues[_0x49ae('0x1c')](_0x4c57e5);recordings[_0x49ae('0x1c')](_0x4c57e5);}catch(_0x53802e){utils[_0x49ae('0x13')](_0x53802e);}});ami['on'](_0x49ae('0x1d'),function(_0x12f639){try{queues[_0x49ae('0x1d')](_0x12f639);}catch(_0x36de67){utils['error'](_0x36de67);}});ami['on'](_0x49ae('0x1e'),function(_0x27c5da){try{queues[_0x49ae('0x1e')](_0x27c5da);calls[_0x49ae('0x1e')](_0x27c5da);}catch(_0x43aaf3){utils[_0x49ae('0x13')](_0x43aaf3);}});ami['on']('musiconholdstop',function(_0x3bb8f0){try{queues[_0x49ae('0x1f')](_0x3bb8f0);calls[_0x49ae('0x1f')](_0x3bb8f0);}catch(_0x589a3f){utils[_0x49ae('0x13')](_0x589a3f);}});ami['on'](_0x49ae('0x20'),function(_0x555f6f){try{calls['newstate'](_0x555f6f);recordings['newstate'](_0x555f6f);}catch(_0x5ec581){utils[_0x49ae('0x13')](_0x5ec581);}});ami['on'](_0x49ae('0x21'),function(_0x48fc32){try{calls[_0x49ae('0x21')](_0x48fc32);recordings[_0x49ae('0x21')](_0x48fc32);dials[_0x49ae('0x21')](_0x48fc32);agents[_0x49ae('0x21')](_0x48fc32);queues[_0x49ae('0x21')](_0x48fc32);}catch(_0x5014f8){utils[_0x49ae('0x13')](_0x5014f8);}});ami['on'](_0x49ae('0x22'),function(_0x104f4e){try{members[_0x49ae('0x22')](_0x104f4e);}catch(_0x4798de){utils['error'](_0x4798de);}});ami['on'](_0x49ae('0x23'),function(_0x2679ca){try{queues[_0x49ae('0x23')](_0x2679ca);agents['blindtransfer'](_0x2679ca);transfers[_0x49ae('0x23')](_0x2679ca);}catch(_0x48d746){utils['error'](_0x48d746);}});ami['on'](_0x49ae('0x24'),function(_0x539dc2){try{queues[_0x49ae('0x24')](_0x539dc2);transfers[_0x49ae('0x24')](_0x539dc2);agents[_0x49ae('0x24')](_0x539dc2);calls['attendedtransfer'](_0x539dc2);}catch(_0x1be929){utils[_0x49ae('0x13')](_0x1be929);}});ami['on'](_0x49ae('0x25'),function(_0x264dd1){try{queues[_0x49ae('0x25')](_0x264dd1);recordings[_0x49ae('0x25')](_0x264dd1);calls[_0x49ae('0x25')](_0x264dd1);dials[_0x49ae('0x25')](_0x264dd1);}catch(_0x16e7f2){utils[_0x49ae('0x13')](_0x16e7f2);}});ami['on'](_0x49ae('0x26'),function(_0x759ce){try{calls['newexten'](_0x759ce);recordings[_0x49ae('0x26')](_0x759ce);dials[_0x49ae('0x26')](_0x759ce);}catch(_0x2411ec){utils[_0x49ae('0x13')](_0x2411ec);}});ami['on'](_0x49ae('0x27'),function(_0x1bf94f){try{calls[_0x49ae('0x27')](_0x1bf94f);recordings['newchannel'](_0x1bf94f);}catch(_0x28ee1a){utils[_0x49ae('0x13')](_0x28ee1a);}});ami['on'](_0x49ae('0x28'),function(_0xd20b1){try{dials[_0x49ae('0x28')](_0xd20b1);}catch(_0x769a28){utils['error'](_0x769a28);}});ami['on'](_0x49ae('0x29'),function(_0x1c70fd){try{dials[_0x49ae('0x29')](_0x1c70fd);}catch(_0x456ea4){utils[_0x49ae('0x13')](_0x456ea4);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8a97736..67a6415 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 _0xf1f9=['voice','now','isNil','exitAt','duration','enterAt','agentcomplete','assign','cdr','channel','data1','data3','destination','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','info','uniqueid','data2','membername','type','interface','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','some','startsWith','devicestatechange','state','BUSY','device'];(function(_0x5a1392,_0x2aed9b){var _0x1dcd94=function(_0x4f7d89){while(--_0x4f7d89){_0x5a1392['push'](_0x5a1392['shift']());}};_0x1dcd94(++_0x2aed9b);}(_0xf1f9,0x177));var _0x9f1f=function(_0x17a5b1,_0x14ec86){_0x17a5b1=_0x17a5b1-0x0;var _0x3a0e28=_0xf1f9[_0x17a5b1];return _0x3a0e28;};'use strict';var _=require(_0x9f1f('0x0'));var util=require(_0x9f1f('0x1'));var utils=require(_0x9f1f('0x2'));var members={};var exclude=[_0x9f1f('0x3'),_0x9f1f('0x4')];function writeDB(_0x98a038){utils[_0x9f1f('0x5')](util['format']('MEMBER|%s|%s|%s|%s|%s|%s',_0x98a038[_0x9f1f('0x6')],_0x98a038['interface'],_0x98a038['channel'],_0x98a038[_0x9f1f('0x7')],_0x98a038[_0x9f1f('0x8')],_0x98a038[_0x9f1f('0x9')]));if(_0x98a038[_0x9f1f('0xa')]){utils[_0x9f1f('0xb')](_0x98a038['interface'])[_0x9f1f('0xc')](function(_0x2a4357){if(_0x2a4357){_0x98a038[_0x9f1f('0x8')]=_0x2a4357[_0x9f1f('0xd')];_0x98a038['internal']=_0x2a4357[_0x9f1f('0xe')];utils['request'](_0x9f1f('0xf'),_0x98a038);}else{utils[_0x9f1f('0x10')](_0x98a038[_0x9f1f('0xa')][_0x9f1f('0x11')]('/')[0x1])[_0x9f1f('0xc')](function(_0x2fccd2){if(_0x2fccd2){_0x98a038['membername']=_0x2fccd2['name'];_0x98a038[_0x9f1f('0xe')]=_0x2fccd2[_0x9f1f('0xe')];utils[_0x9f1f('0x12')]('CreateMemberReport',_0x98a038);}});}})['catch'](function(_0x19b735){utils['error'](_0x19b735);});}delete members[_0x98a038['interface']];}function startsWith(_0x24a470,_0x2c4a67){return _[_0x9f1f('0x13')](_0x24a470,function(_0x1daa1f){return _[_0x9f1f('0x14')](_0x2c4a67,_0x1daa1f);});}exports[_0x9f1f('0x15')]=function(_0x4ccd33){switch(_0x4ccd33[_0x9f1f('0x16')]){case'INUSE':case _0x9f1f('0x17'):if(!startsWith(exclude,_0x4ccd33[_0x9f1f('0x18')])){members[_0x4ccd33[_0x9f1f('0x18')]]={'channel':_0x9f1f('0x19'),'interface':_0x4ccd33[_0x9f1f('0x18')],'type':'TALKING','enterAt':utils[_0x9f1f('0x1a')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x9f1f('0x1b')](members[_0x4ccd33[_0x9f1f('0x18')]])){members[_0x4ccd33['device']][_0x9f1f('0x1c')]=utils['now']();members[_0x4ccd33['device']][_0x9f1f('0x1d')]=utils['diffTime'](members[_0x4ccd33['device']][_0x9f1f('0x1c')],members[_0x4ccd33[_0x9f1f('0x18')]][_0x9f1f('0x1e')]);if(members[_0x4ccd33[_0x9f1f('0x18')]]['uniqueid']){writeDB(members[_0x4ccd33['device']]);}}default:break;}};exports[_0x9f1f('0x1f')]=function(_0x264018){if(!_[_0x9f1f('0x1b')](members[_0x264018['interface']])){members[_0x264018['interface']]=_[_0x9f1f('0x20')](members[_0x264018[_0x9f1f('0xa')]],{'data4':_0x264018['queue'],'uniqueid':_0x264018['uniqueid']});}};exports[_0x9f1f('0x21')]=function(_0x39cd73){if(_0x39cd73[_0x9f1f('0x22')]){var _0xf889f8=_0x39cd73[_0x9f1f('0x22')][_0x9f1f('0x11')]('-')[0x0];if(!_[_0x9f1f('0x1b')](members[_0xf889f8])){members[_0xf889f8]=_['assign'](members[_0xf889f8],{'data1':members[_0xf889f8][_0x9f1f('0x23')]||_0x39cd73[_0x9f1f('0x9')],'data2':members[_0xf889f8]['data2']||_0x39cd73['source'],'data3':members[_0xf889f8][_0x9f1f('0x24')]||_0x39cd73[_0x9f1f('0x25')],'uniqueid':members[_0xf889f8][_0x9f1f('0x6')]||_0x39cd73[_0x9f1f('0x6')]});if(members[_0xf889f8][_0x9f1f('0x1c')]){writeDB(members[_0xf889f8]);}}}if(_0x39cd73[_0x9f1f('0x26')]){var _0x5d8caf=_0x39cd73[_0x9f1f('0x26')][_0x9f1f('0x11')]('-')[0x0];if(!_['isNil'](members[_0x5d8caf])){members[_0x5d8caf]=_[_0x9f1f('0x20')](members[_0x5d8caf],{'data1':members[_0x5d8caf][_0x9f1f('0x23')]||_0x39cd73[_0x9f1f('0x9')],'data2':members[_0x5d8caf]['data2']||_0x39cd73[_0x9f1f('0x27')],'data3':members[_0x5d8caf][_0x9f1f('0x24')]||_0x39cd73['destination'],'uniqueid':members[_0x5d8caf][_0x9f1f('0x6')]||_0x39cd73[_0x9f1f('0x6')]});if(members[_0x5d8caf][_0x9f1f('0x1c')]){writeDB(members[_0x5d8caf]);}}}}; \ No newline at end of file +var _0x6565=['assign','queue','data1','data2','source','destination','destinationchannel','split','data3','lodash','util','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','then','catch','error','some','startsWith','devicestatechange','state','INUSE','device','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','uniqueid','agentcomplete'];(function(_0x5bb67c,_0x1da4bb){var _0x24c1f6=function(_0x1bd7d1){while(--_0x1bd7d1){_0x5bb67c['push'](_0x5bb67c['shift']());}};_0x24c1f6(++_0x1da4bb);}(_0x6565,0x93));var _0x5656=function(_0x3e806a,_0xa4b9fa){_0x3e806a=_0x3e806a-0x0;var _0x477105=_0x6565[_0x3e806a];return _0x477105;};'use strict';var _=require(_0x5656('0x0'));var util=require(_0x5656('0x1'));var utils=require('./utils');var members={};var exclude=[_0x5656('0x2'),_0x5656('0x3')];function writeDB(_0x2e0785){utils[_0x5656('0x4')](util[_0x5656('0x5')](_0x5656('0x6'),_0x2e0785['uniqueid'],_0x2e0785[_0x5656('0x7')],_0x2e0785[_0x5656('0x8')],_0x2e0785['data2'],_0x2e0785[_0x5656('0x9')],_0x2e0785[_0x5656('0xa')]));if(_0x2e0785[_0x5656('0x7')]){utils[_0x5656('0xb')](_0x2e0785[_0x5656('0x7')])['then'](function(_0xa4924e){if(_0xa4924e){_0x2e0785['membername']=_0xa4924e[_0x5656('0xc')];_0x2e0785['internal']=_0xa4924e[_0x5656('0xd')];utils[_0x5656('0xe')](_0x5656('0xf'),_0x2e0785);}else{utils[_0x5656('0x10')](_0x2e0785['interface']['split']('/')[0x1])[_0x5656('0x11')](function(_0x25317c){if(_0x25317c){_0x2e0785['membername']=_0x25317c[_0x5656('0xc')];_0x2e0785['internal']=_0x25317c[_0x5656('0xd')];utils[_0x5656('0xe')](_0x5656('0xf'),_0x2e0785);}});}})[_0x5656('0x12')](function(_0x39527e){utils[_0x5656('0x13')](_0x39527e);});}delete members[_0x2e0785[_0x5656('0x7')]];}function startsWith(_0x193180,_0x34cf6a){return _[_0x5656('0x14')](_0x193180,function(_0x33c4dd){return _[_0x5656('0x15')](_0x34cf6a,_0x33c4dd);});}exports[_0x5656('0x16')]=function(_0x37c893){switch(_0x37c893[_0x5656('0x17')]){case _0x5656('0x18'):case'BUSY':if(!startsWith(exclude,_0x37c893[_0x5656('0x19')])){members[_0x37c893[_0x5656('0x19')]]={'channel':_0x5656('0x1a'),'interface':_0x37c893[_0x5656('0x19')],'type':_0x5656('0x1b'),'enterAt':utils[_0x5656('0x1c')](),'role':'agent'};}break;case _0x5656('0x1d'):if(!_[_0x5656('0x1e')](members[_0x37c893[_0x5656('0x19')]])){members[_0x37c893['device']][_0x5656('0x1f')]=utils[_0x5656('0x1c')]();members[_0x37c893['device']][_0x5656('0x20')]=utils[_0x5656('0x21')](members[_0x37c893[_0x5656('0x19')]][_0x5656('0x1f')],members[_0x37c893[_0x5656('0x19')]][_0x5656('0x22')]);if(members[_0x37c893[_0x5656('0x19')]][_0x5656('0x23')]){writeDB(members[_0x37c893[_0x5656('0x19')]]);}}default:break;}};exports[_0x5656('0x24')]=function(_0x14debf){if(!_[_0x5656('0x1e')](members[_0x14debf[_0x5656('0x7')]])){members[_0x14debf[_0x5656('0x7')]]=_[_0x5656('0x25')](members[_0x14debf['interface']],{'data4':_0x14debf[_0x5656('0x26')],'uniqueid':_0x14debf[_0x5656('0x23')]});}};exports['cdr']=function(_0x38ecf5){if(_0x38ecf5['channel']){var _0x2b0895=_0x38ecf5['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x2b0895])){members[_0x2b0895]=_[_0x5656('0x25')](members[_0x2b0895],{'data1':members[_0x2b0895][_0x5656('0x27')]||_0x38ecf5[_0x5656('0xa')],'data2':members[_0x2b0895][_0x5656('0x28')]||_0x38ecf5[_0x5656('0x29')],'data3':members[_0x2b0895]['data3']||_0x38ecf5[_0x5656('0x2a')],'uniqueid':members[_0x2b0895][_0x5656('0x23')]||_0x38ecf5[_0x5656('0x23')]});if(members[_0x2b0895][_0x5656('0x1f')]){writeDB(members[_0x2b0895]);}}}if(_0x38ecf5[_0x5656('0x2b')]){var _0x1fc049=_0x38ecf5[_0x5656('0x2b')][_0x5656('0x2c')]('-')[0x0];if(!_['isNil'](members[_0x1fc049])){members[_0x1fc049]=_[_0x5656('0x25')](members[_0x1fc049],{'data1':members[_0x1fc049]['data1']||_0x38ecf5[_0x5656('0xa')],'data2':members[_0x1fc049][_0x5656('0x28')]||_0x38ecf5[_0x5656('0x29')],'data3':members[_0x1fc049][_0x5656('0x2d')]||_0x38ecf5[_0x5656('0x2a')],'uniqueid':members[_0x1fc049][_0x5656('0x23')]||_0x38ecf5[_0x5656('0x23')]});if(members[_0x1fc049][_0x5656('0x1f')]){writeDB(members[_0x1fc049]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 5a29322..9d018f2 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 _0xd88b=['agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','secondtransfereruniqueid','transfertype','secondtransfererexten','transfertargetlinkedid','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','lodash','util','./utils','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','calleridnum','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','varset','variable','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','ABANDONED','queuecallerleave','holdtime','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','lastAssignedTo'];(function(_0x88f742,_0x4e3963){var _0x21c669=function(_0x482c1e){while(--_0x482c1e){_0x88f742['push'](_0x88f742['shift']());}};_0x21c669(++_0x4e3963);}(_0xd88b,0x104));var _0xbd88=function(_0x23c331,_0x20e49d){_0x23c331=_0x23c331-0x0;var _0x208c6f=_0xd88b[_0x23c331];return _0x208c6f;};'use strict';var _=require(_0xbd88('0x0'));var util=require(_0xbd88('0x1'));var utils=require(_0xbd88('0x2'));var queues={};function writeDB(_0x4670e2){utils['info'](util['format'](_0xbd88('0x3'),_0x4670e2[_0xbd88('0x4')],_0x4670e2[_0xbd88('0x5')],_0x4670e2[_0xbd88('0x6')],_0x4670e2['lastAssignedTo'],_0x4670e2[_0xbd88('0x7')],_0x4670e2['accountcode'],_0x4670e2['queuecallerexitreason']));if(_0x4670e2[_0xbd88('0x6')]){utils['getVoiceQueueByName'](_0x4670e2[_0xbd88('0x6')])['then'](function(_0x317031){if(_0x317031){_0x4670e2[_0xbd88('0x8')]=_0x317031[_0xbd88('0x8')];}utils[_0xbd88('0x9')](_0xbd88('0xa'),_0x4670e2);});}else{utils[_0xbd88('0x9')](_0xbd88('0xa'),_0x4670e2);}if(_0x4670e2[_0xbd88('0xb')]){delete queues[_0x4670e2[_0xbd88('0xb')]];}else{delete queues[_0x4670e2[_0xbd88('0x4')]];}}exports[_0xbd88('0xc')]=function(_0x406fd7){queues[_0x406fd7[_0xbd88('0x4')]]=_[_0xbd88('0xd')](_0x406fd7,{'originalposition':_0x406fd7['position'],'queuecallerjoinAt':utils[_0xbd88('0xe')](),'mohtime':0x0});};exports['hangup']=function(_0x5b3ec8){if(!_[_0xbd88('0xf')](queues[_0x5b3ec8[_0xbd88('0x4')]])){if(queues[_0x5b3ec8[_0xbd88('0x4')]][_0xbd88('0x10')]){if(!queues[_0x5b3ec8[_0xbd88('0x4')]][_0xbd88('0x11')]&&!queues[_0x5b3ec8[_0xbd88('0x4')]][_0xbd88('0x12')]){queues[_0x5b3ec8[_0xbd88('0x4')]]['queuecallercomplete']=!![];queues[_0x5b3ec8[_0xbd88('0x4')]][_0xbd88('0x13')]=utils[_0xbd88('0xe')]();queues[_0x5b3ec8[_0xbd88('0x4')]][_0xbd88('0x14')]=_0xbd88('0x15');}writeDB(queues[_0x5b3ec8[_0xbd88('0x4')]]);}else{if(queues[_0x5b3ec8[_0xbd88('0x4')]][_0xbd88('0xb')]){queues[queues[_0x5b3ec8[_0xbd88('0x4')]][_0xbd88('0xb')]]=queues[_0x5b3ec8[_0xbd88('0x4')]];queues[queues[_0x5b3ec8[_0xbd88('0x4')]][_0xbd88('0xb')]]['queuecallerenterreason']=0x2;delete queues[_0x5b3ec8[_0xbd88('0x4')]];}}}};exports[_0xbd88('0x16')]=function(_0x380d27){if(!_['isNil'](_0x380d27[_0xbd88('0x17')]['queuestatus'])){if(!_[_0xbd88('0xf')](queues[_0x380d27[_0xbd88('0x4')]])){queues[_0x380d27[_0xbd88('0x4')]][_0xbd88('0x11')]=![];queues[_0x380d27[_0xbd88('0x4')]][_0xbd88('0x18')]=null;queues[_0x380d27['uniqueid']][_0xbd88('0x12')]=!![];queues[_0x380d27['uniqueid']][_0xbd88('0x19')]=utils[_0xbd88('0xe')]();queues[_0x380d27[_0xbd88('0x4')]][_0xbd88('0x14')]=_0x380d27['value'][_0xbd88('0x1a')]();writeDB(queues[_0x380d27['uniqueid']]);}}else if(!_['isNil'](_0x380d27[_0xbd88('0x17')][_0xbd88('0x1b')])){if(!_['isNil'](queues[_0x380d27['uniqueid']])&&!queues[_0x380d27[_0xbd88('0x4')]][_0xbd88('0x11')]){queues[_0x380d27[_0xbd88('0x4')]][_0xbd88('0x11')]=![];queues[_0x380d27[_0xbd88('0x4')]]['queuecallerabandonAt']=null;queues[_0x380d27[_0xbd88('0x4')]]['queuecallerexit']=!![];queues[_0x380d27[_0xbd88('0x4')]][_0xbd88('0x19')]=utils[_0xbd88('0xe')]();queues[_0x380d27[_0xbd88('0x4')]]['queuecallerexitreason']='EXITWITHKEY';}}};exports[_0xbd88('0x11')]=function(_0x2bab18){if(!_['isNil'](queues[_0x2bab18['uniqueid']])){queues[_0x2bab18[_0xbd88('0x4')]]['queuecallerexit']=![];queues[_0x2bab18[_0xbd88('0x4')]][_0xbd88('0x19')]=null;queues[_0x2bab18['uniqueid']]['queuecallerabandon']=!![];queues[_0x2bab18[_0xbd88('0x4')]][_0xbd88('0x18')]=utils[_0xbd88('0xe')]();queues[_0x2bab18[_0xbd88('0x4')]][_0xbd88('0x14')]=_0xbd88('0x1c');}};exports[_0xbd88('0x1d')]=function(_0x25e0af){if(!_[_0xbd88('0xf')](queues[_0x25e0af['uniqueid']])){queues[_0x25e0af[_0xbd88('0x4')]][_0xbd88('0x1d')]=!![];queues[_0x25e0af[_0xbd88('0x4')]]['queuecallerleaveAt']=utils['now']();queues[_0x25e0af[_0xbd88('0x4')]][_0xbd88('0x1e')]=utils['diffTime'](queues[_0x25e0af['uniqueid']][_0xbd88('0x10')],queues[_0x25e0af[_0xbd88('0x4')]]['queuecallerjoinAt']);queues[_0x25e0af[_0xbd88('0x4')]]['position']=_0x25e0af[_0xbd88('0x1f')];queues[_0x25e0af['uniqueid']][_0xbd88('0x20')]=_0x25e0af[_0xbd88('0x20')];queues[_0x25e0af[_0xbd88('0x4')]]['connectedlinenum']=_0x25e0af[_0xbd88('0x21')];queues[_0x25e0af[_0xbd88('0x4')]][_0xbd88('0x22')]=_0x25e0af['connectedlinename'];}};exports[_0xbd88('0x23')]=function(_0x368d0f){if(!_[_0xbd88('0xf')](queues[_0x368d0f[_0xbd88('0x4')]])){queues[_0x368d0f['uniqueid']][_0xbd88('0x11')]=![];queues[_0x368d0f[_0xbd88('0x4')]][_0xbd88('0x11')]=![];queues[_0x368d0f[_0xbd88('0x4')]][_0xbd88('0x18')]=null;queues[_0x368d0f[_0xbd88('0x4')]]['queuecallerexit']=![];queues[_0x368d0f['uniqueid']][_0xbd88('0x19')]=null;queues[_0x368d0f[_0xbd88('0x4')]][_0xbd88('0x24')]=!![];queues[_0x368d0f[_0xbd88('0x4')]][_0xbd88('0x25')]=_0x368d0f[_0xbd88('0x26')];queues[_0x368d0f['uniqueid']][_0xbd88('0x27')]=_0x368d0f['membername'];}};exports[_0xbd88('0x28')]=function(_0x3c42d9){if(!_['isNil'](queues[_0x3c42d9[_0xbd88('0x4')]])){if(queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x10')]){queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x11')]=![];queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x11')]=![];queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x18')]=null;queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x12')]=![];queues[_0x3c42d9[_0xbd88('0x4')]]['queuecallerexitAt']=null;queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x24')]=!![];queues[_0x3c42d9[_0xbd88('0x4')]]['lastAssignedTo']=_0x3c42d9['membername'];queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x29')]=!![];queues[_0x3c42d9[_0xbd88('0x4')]]['queuecallercompleteAt']=utils[_0xbd88('0xe')]();if(_0x3c42d9[_0xbd88('0x2a')]==_0xbd88('0x2b')){if(!queues[_0x3c42d9['uniqueid']][_0xbd88('0x2b')]){queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x14')]=_0xbd88('0x2c');}}else{queues[_0x3c42d9[_0xbd88('0x4')]][_0xbd88('0x14')]=_0xbd88('0x2d')+_0x3c42d9[_0xbd88('0x2a')]['toUpperCase']();}writeDB(queues[_0x3c42d9[_0xbd88('0x4')]]);}}};exports['blindtransfer']=function(_0x569a1b){if(!_['isNil'](queues[_0x569a1b['transfereeuniqueid']])){queues[_0x569a1b[_0xbd88('0x2e')]][_0xbd88('0x2b')]=!![];queues[_0x569a1b[_0xbd88('0x2e')]]['transfertype']=_0xbd88('0x2f');queues[_0x569a1b[_0xbd88('0x2e')]][_0xbd88('0x30')]=_0x569a1b['extension'];queues[_0x569a1b[_0xbd88('0x2e')]][_0xbd88('0x31')]=_0x569a1b[_0xbd88('0x2e')];queues[_0x569a1b[_0xbd88('0x2e')]][_0xbd88('0x14')]=_0xbd88('0x32');}};exports[_0xbd88('0x33')]=function(_0x38ffc9){try{if(_0x38ffc9[_0xbd88('0x34')]==_0x38ffc9['origtransfererlinkedid']){if(!_['isNil'](queues[_0x38ffc9['secondtransfererlinkedid']])){queues[_0x38ffc9['secondtransfererlinkedid']]['transfer']=!![];queues[_0x38ffc9[_0xbd88('0x35')]]['transfertype']=_0xbd88('0x36');queues[_0x38ffc9[_0xbd88('0x35')]][_0xbd88('0x30')]=_0x38ffc9[_0xbd88('0x37')];queues[_0x38ffc9[_0xbd88('0x35')]][_0xbd88('0x31')]=_0x38ffc9[_0xbd88('0x34')];queues[_0x38ffc9[_0xbd88('0x35')]][_0xbd88('0x14')]=_0xbd88('0x38');}if(!_[_0xbd88('0xf')](queues[_0x38ffc9[_0xbd88('0x39')]])){if(_0x38ffc9[_0xbd88('0x3a')]&&queues[_0x38ffc9['transfereelinkedid']]){queues[_0x38ffc9[_0xbd88('0x3a')]][_0xbd88('0x3b')]=0x1;queues[_0x38ffc9['transfereeuniqueid']]=_[_0xbd88('0x3c')](queues[_0x38ffc9[_0xbd88('0x3a')]]);queues[_0x38ffc9[_0xbd88('0x2e')]][_0xbd88('0xb')]=_0x38ffc9[_0xbd88('0x3d')];queues[_0x38ffc9[_0xbd88('0x2e')]][_0xbd88('0x3b')]=0x2;queues[_0x38ffc9[_0xbd88('0x2e')]]['calleridnum']=queues[_0x38ffc9[_0xbd88('0x35')]][_0xbd88('0x7')];queues[_0x38ffc9['transfereeuniqueid']][_0xbd88('0x3e')]=queues[_0x38ffc9['secondtransfererlinkedid']]['calleridname'];queues[_0x38ffc9[_0xbd88('0x2e')]][_0xbd88('0x3f')]=utils[_0xbd88('0xe')]();queues[_0x38ffc9[_0xbd88('0x2e')]][_0xbd88('0x10')]=utils[_0xbd88('0xe')]();queues[_0x38ffc9['transfereeuniqueid']][_0xbd88('0x1e')]=0x0;queues[_0x38ffc9[_0xbd88('0x2e')]][_0xbd88('0x40')]=0x0;}else{queues[_0x38ffc9[_0xbd88('0x39')]][_0xbd88('0xb')]=_0x38ffc9[_0xbd88('0x35')];}}}else if(_0x38ffc9[_0xbd88('0x41')]==_0x38ffc9['secondtransfererlinkedid']){if(!_[_0xbd88('0xf')](queues[_0x38ffc9[_0xbd88('0x39')]])){queues[_0x38ffc9[_0xbd88('0x39')]][_0xbd88('0x2b')]=!![];queues[_0x38ffc9[_0xbd88('0x39')]][_0xbd88('0x42')]=_0xbd88('0x36');queues[_0x38ffc9['origtransfererlinkedid']][_0xbd88('0x30')]=_0x38ffc9[_0xbd88('0x43')];queues[_0x38ffc9['origtransfererlinkedid']][_0xbd88('0x31')]=_0x38ffc9['secondtransfereruniqueid'];queues[_0x38ffc9['origtransfererlinkedid']][_0xbd88('0x14')]='ATTENDEDTRANSFER';}if(!_[_0xbd88('0xf')](queues[_0x38ffc9[_0xbd88('0x35')]])){if(_0x38ffc9[_0xbd88('0x44')]&&queues[_0x38ffc9[_0xbd88('0x44')]]){queues[_0x38ffc9[_0xbd88('0x44')]]['queuecallerenterreason']=0x1;queues[_0x38ffc9['transfertargetuniqueid']]=_['clone'](queues[_0x38ffc9[_0xbd88('0x44')]]);queues[_0x38ffc9[_0xbd88('0x3d')]][_0xbd88('0xb')]=_0x38ffc9[_0xbd88('0x3d')];queues[_0x38ffc9['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x38ffc9[_0xbd88('0x3d')]]['calleridnum']=queues[_0x38ffc9[_0xbd88('0x39')]][_0xbd88('0x7')];queues[_0x38ffc9[_0xbd88('0x3d')]][_0xbd88('0x3e')]=queues[_0x38ffc9['origtransfererlinkedid']]['calleridname'];queues[_0x38ffc9[_0xbd88('0x3d')]][_0xbd88('0x3f')]=utils['now']();queues[_0x38ffc9[_0xbd88('0x3d')]][_0xbd88('0x10')]=utils[_0xbd88('0xe')]();queues[_0x38ffc9[_0xbd88('0x3d')]]['holdtime']=0x0;queues[_0x38ffc9[_0xbd88('0x3d')]][_0xbd88('0x40')]=0x0;}else{queues[_0x38ffc9[_0xbd88('0x35')]][_0xbd88('0xb')]=_0x38ffc9[_0xbd88('0x39')];}}}}catch(_0x33f627){utils[_0xbd88('0x45')](_0x33f627[_0xbd88('0x46')]);}};exports[_0xbd88('0x47')]=function(_0x3a0676){if(!_['isNil'](queues[_0x3a0676[_0xbd88('0x4')]])){queues[_0x3a0676[_0xbd88('0x4')]][_0xbd88('0x48')]=utils['now']();}};exports[_0xbd88('0x49')]=function(_0x35e995){if(!_[_0xbd88('0xf')](queues[_0x35e995['uniqueid']])){if(!_[_0xbd88('0xf')](queues[_0x35e995[_0xbd88('0x4')]][_0xbd88('0x48')])){queues[_0x35e995[_0xbd88('0x4')]][_0xbd88('0x40')]+=utils[_0xbd88('0x4a')](utils[_0xbd88('0xe')](),queues[_0x35e995[_0xbd88('0x4')]][_0xbd88('0x48')]);delete queues[_0x35e995['uniqueid']][_0xbd88('0x48')];}}}; \ No newline at end of file +var _0x4422=['COMPLETEDBY','transfereeuniqueid','BLIND','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','calleridname','queuecallerjoinAt','mohtime','secondtransfereruniqueid','transfertype','transferexten','secondtransfererexten','clone','transfertargetlinkedid','transfertargetuniqueid','error','musiconholdstart','musiconholdstop','diffTime','musiconholdstartAt','lodash','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','queuestatus','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','queuecallerleave','holdtime','count','connectedlinenum','connectedlinename','assigned','membername','agentcomplete','reason','transfer'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0x4422,0xab));var _0x2442=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4422[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2442('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x1aabbd){utils['info'](util[_0x2442('0x1')](_0x2442('0x2'),_0x1aabbd['uniqueid'],_0x1aabbd['channel'],_0x1aabbd[_0x2442('0x3')],_0x1aabbd[_0x2442('0x4')],_0x1aabbd[_0x2442('0x5')],_0x1aabbd[_0x2442('0x6')],_0x1aabbd['queuecallerexitreason']));if(_0x1aabbd[_0x2442('0x3')]){utils[_0x2442('0x7')](_0x1aabbd[_0x2442('0x3')])[_0x2442('0x8')](function(_0x460ce4){if(_0x460ce4){_0x1aabbd[_0x2442('0x9')]=_0x460ce4['type'];}utils[_0x2442('0xa')](_0x2442('0xb'),_0x1aabbd);});}else{utils[_0x2442('0xa')](_0x2442('0xb'),_0x1aabbd);}if(_0x1aabbd[_0x2442('0xc')]){delete queues[_0x1aabbd[_0x2442('0xc')]];}else{delete queues[_0x1aabbd[_0x2442('0xd')]];}}exports[_0x2442('0xe')]=function(_0x49153c){queues[_0x49153c[_0x2442('0xd')]]=_[_0x2442('0xf')](_0x49153c,{'originalposition':_0x49153c[_0x2442('0x10')],'queuecallerjoinAt':utils[_0x2442('0x11')](),'mohtime':0x0});};exports[_0x2442('0x12')]=function(_0x2a37ff){if(!_[_0x2442('0x13')](queues[_0x2a37ff['uniqueid']])){if(queues[_0x2a37ff[_0x2442('0xd')]][_0x2442('0x14')]){if(!queues[_0x2a37ff[_0x2442('0xd')]][_0x2442('0x15')]&&!queues[_0x2a37ff['uniqueid']][_0x2442('0x16')]){queues[_0x2a37ff[_0x2442('0xd')]]['queuecallercomplete']=!![];queues[_0x2a37ff[_0x2442('0xd')]][_0x2442('0x17')]=utils['now']();queues[_0x2a37ff[_0x2442('0xd')]][_0x2442('0x18')]=_0x2442('0x19');}writeDB(queues[_0x2a37ff[_0x2442('0xd')]]);}else{if(queues[_0x2a37ff[_0x2442('0xd')]]['transfereduniqueid']){queues[queues[_0x2a37ff[_0x2442('0xd')]][_0x2442('0xc')]]=queues[_0x2a37ff[_0x2442('0xd')]];queues[queues[_0x2a37ff['uniqueid']][_0x2442('0xc')]][_0x2442('0x1a')]=0x2;delete queues[_0x2a37ff[_0x2442('0xd')]];}}}};exports['varset']=function(_0x10aaea){if(!_['isNil'](_0x10aaea['variable'][_0x2442('0x1b')])){if(!_[_0x2442('0x13')](queues[_0x10aaea[_0x2442('0xd')]])){queues[_0x10aaea[_0x2442('0xd')]][_0x2442('0x15')]=![];queues[_0x10aaea[_0x2442('0xd')]][_0x2442('0x1c')]=null;queues[_0x10aaea[_0x2442('0xd')]][_0x2442('0x16')]=!![];queues[_0x10aaea[_0x2442('0xd')]][_0x2442('0x1d')]=utils[_0x2442('0x11')]();queues[_0x10aaea[_0x2442('0xd')]][_0x2442('0x18')]=_0x10aaea['value'][_0x2442('0x1e')]();writeDB(queues[_0x10aaea['uniqueid']]);}}else if(!_[_0x2442('0x13')](_0x10aaea['variable'][_0x2442('0x1f')])){if(!_[_0x2442('0x13')](queues[_0x10aaea[_0x2442('0xd')]])&&!queues[_0x10aaea[_0x2442('0xd')]]['queuecallerabandon']){queues[_0x10aaea[_0x2442('0xd')]][_0x2442('0x15')]=![];queues[_0x10aaea[_0x2442('0xd')]][_0x2442('0x1c')]=null;queues[_0x10aaea['uniqueid']][_0x2442('0x16')]=!![];queues[_0x10aaea['uniqueid']][_0x2442('0x1d')]=utils[_0x2442('0x11')]();queues[_0x10aaea[_0x2442('0xd')]][_0x2442('0x18')]='EXITWITHKEY';}}};exports[_0x2442('0x15')]=function(_0x13c8a8){if(!_['isNil'](queues[_0x13c8a8[_0x2442('0xd')]])){queues[_0x13c8a8[_0x2442('0xd')]][_0x2442('0x16')]=![];queues[_0x13c8a8[_0x2442('0xd')]][_0x2442('0x1d')]=null;queues[_0x13c8a8['uniqueid']]['queuecallerabandon']=!![];queues[_0x13c8a8[_0x2442('0xd')]][_0x2442('0x1c')]=utils[_0x2442('0x11')]();queues[_0x13c8a8[_0x2442('0xd')]][_0x2442('0x18')]='ABANDONED';}};exports[_0x2442('0x20')]=function(_0x56d88b){if(!_[_0x2442('0x13')](queues[_0x56d88b[_0x2442('0xd')]])){queues[_0x56d88b['uniqueid']][_0x2442('0x20')]=!![];queues[_0x56d88b['uniqueid']][_0x2442('0x14')]=utils[_0x2442('0x11')]();queues[_0x56d88b['uniqueid']][_0x2442('0x21')]=utils['diffTime'](queues[_0x56d88b[_0x2442('0xd')]][_0x2442('0x14')],queues[_0x56d88b[_0x2442('0xd')]]['queuecallerjoinAt']);queues[_0x56d88b[_0x2442('0xd')]][_0x2442('0x10')]=_0x56d88b[_0x2442('0x10')];queues[_0x56d88b[_0x2442('0xd')]][_0x2442('0x22')]=_0x56d88b['count'];queues[_0x56d88b[_0x2442('0xd')]][_0x2442('0x23')]=_0x56d88b[_0x2442('0x23')];queues[_0x56d88b['uniqueid']][_0x2442('0x24')]=_0x56d88b['connectedlinename'];}};exports['agentconnect']=function(_0x242359){if(!_[_0x2442('0x13')](queues[_0x242359['uniqueid']])){queues[_0x242359[_0x2442('0xd')]][_0x2442('0x15')]=![];queues[_0x242359[_0x2442('0xd')]]['queuecallerabandon']=![];queues[_0x242359[_0x2442('0xd')]][_0x2442('0x1c')]=null;queues[_0x242359[_0x2442('0xd')]][_0x2442('0x16')]=![];queues[_0x242359[_0x2442('0xd')]][_0x2442('0x1d')]=null;queues[_0x242359['uniqueid']][_0x2442('0x25')]=!![];queues[_0x242359[_0x2442('0xd')]][_0x2442('0x6')]=_0x242359['destaccountcode'];queues[_0x242359[_0x2442('0xd')]][_0x2442('0x4')]=_0x242359[_0x2442('0x26')];}};exports[_0x2442('0x27')]=function(_0x49b8e9){if(!_[_0x2442('0x13')](queues[_0x49b8e9[_0x2442('0xd')]])){if(queues[_0x49b8e9[_0x2442('0xd')]][_0x2442('0x14')]){queues[_0x49b8e9[_0x2442('0xd')]][_0x2442('0x15')]=![];queues[_0x49b8e9[_0x2442('0xd')]]['queuecallerabandon']=![];queues[_0x49b8e9[_0x2442('0xd')]]['queuecallerabandonAt']=null;queues[_0x49b8e9[_0x2442('0xd')]]['queuecallerexit']=![];queues[_0x49b8e9['uniqueid']][_0x2442('0x1d')]=null;queues[_0x49b8e9['uniqueid']][_0x2442('0x25')]=!![];queues[_0x49b8e9['uniqueid']]['lastAssignedTo']=_0x49b8e9[_0x2442('0x26')];queues[_0x49b8e9[_0x2442('0xd')]]['queuecallercomplete']=!![];queues[_0x49b8e9[_0x2442('0xd')]]['queuecallercompleteAt']=utils[_0x2442('0x11')]();if(_0x49b8e9[_0x2442('0x28')]==_0x2442('0x29')){if(!queues[_0x49b8e9[_0x2442('0xd')]][_0x2442('0x29')]){queues[_0x49b8e9['uniqueid']][_0x2442('0x18')]='TRANSFER';}}else{queues[_0x49b8e9[_0x2442('0xd')]]['queuecallerexitreason']=_0x2442('0x2a')+_0x49b8e9['reason'][_0x2442('0x1e')]();}writeDB(queues[_0x49b8e9[_0x2442('0xd')]]);}}};exports['blindtransfer']=function(_0x1f3b5e){if(!_[_0x2442('0x13')](queues[_0x1f3b5e[_0x2442('0x2b')]])){queues[_0x1f3b5e[_0x2442('0x2b')]][_0x2442('0x29')]=!![];queues[_0x1f3b5e['transfereeuniqueid']]['transfertype']=_0x2442('0x2c');queues[_0x1f3b5e[_0x2442('0x2b')]]['transferexten']=_0x1f3b5e[_0x2442('0x2d')];queues[_0x1f3b5e[_0x2442('0x2b')]][_0x2442('0x2e')]=_0x1f3b5e[_0x2442('0x2b')];queues[_0x1f3b5e['transfereeuniqueid']][_0x2442('0x18')]=_0x2442('0x2f');}};exports[_0x2442('0x30')]=function(_0x2a9fa4){try{if(_0x2a9fa4[_0x2442('0x31')]==_0x2a9fa4[_0x2442('0x32')]){if(!_[_0x2442('0x13')](queues[_0x2a9fa4[_0x2442('0x33')]])){queues[_0x2a9fa4[_0x2442('0x33')]]['transfer']=!![];queues[_0x2a9fa4['secondtransfererlinkedid']]['transfertype']=_0x2442('0x34');queues[_0x2a9fa4[_0x2442('0x33')]]['transferexten']=_0x2a9fa4[_0x2442('0x35')];queues[_0x2a9fa4[_0x2442('0x33')]]['transferuniqueid']=_0x2a9fa4[_0x2442('0x31')];queues[_0x2a9fa4[_0x2442('0x33')]]['queuecallerexitreason']=_0x2442('0x36');}if(!_['isNil'](queues[_0x2a9fa4[_0x2442('0x32')]])){if(_0x2a9fa4[_0x2442('0x37')]&&queues[_0x2a9fa4[_0x2442('0x37')]]){queues[_0x2a9fa4[_0x2442('0x37')]][_0x2442('0x1a')]=0x1;queues[_0x2a9fa4[_0x2442('0x2b')]]=_['clone'](queues[_0x2a9fa4[_0x2442('0x37')]]);queues[_0x2a9fa4['transfereeuniqueid']][_0x2442('0xc')]=_0x2a9fa4['transfertargetuniqueid'];queues[_0x2a9fa4[_0x2442('0x2b')]][_0x2442('0x1a')]=0x2;queues[_0x2a9fa4['transfereeuniqueid']][_0x2442('0x5')]=queues[_0x2a9fa4[_0x2442('0x33')]][_0x2442('0x5')];queues[_0x2a9fa4['transfereeuniqueid']][_0x2442('0x38')]=queues[_0x2a9fa4[_0x2442('0x33')]]['calleridname'];queues[_0x2a9fa4['transfereeuniqueid']][_0x2442('0x39')]=utils[_0x2442('0x11')]();queues[_0x2a9fa4['transfereeuniqueid']][_0x2442('0x14')]=utils[_0x2442('0x11')]();queues[_0x2a9fa4[_0x2442('0x2b')]][_0x2442('0x21')]=0x0;queues[_0x2a9fa4['transfereeuniqueid']][_0x2442('0x3a')]=0x0;}else{queues[_0x2a9fa4['origtransfererlinkedid']]['transfereduniqueid']=_0x2a9fa4[_0x2442('0x33')];}}}else if(_0x2a9fa4[_0x2442('0x3b')]==_0x2a9fa4['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x2a9fa4['origtransfererlinkedid']])){queues[_0x2a9fa4[_0x2442('0x32')]]['transfer']=!![];queues[_0x2a9fa4['origtransfererlinkedid']][_0x2442('0x3c')]='ATTENDED';queues[_0x2a9fa4[_0x2442('0x32')]][_0x2442('0x3d')]=_0x2a9fa4[_0x2442('0x3e')];queues[_0x2a9fa4['origtransfererlinkedid']][_0x2442('0x2e')]=_0x2a9fa4[_0x2442('0x3b')];queues[_0x2a9fa4[_0x2442('0x32')]][_0x2442('0x18')]=_0x2442('0x36');}if(!_['isNil'](queues[_0x2a9fa4[_0x2442('0x33')]])){if(_0x2a9fa4['transfertargetlinkedid']&&queues[_0x2a9fa4['transfertargetlinkedid']]){queues[_0x2a9fa4['transfertargetlinkedid']][_0x2442('0x1a')]=0x1;queues[_0x2a9fa4['transfertargetuniqueid']]=_[_0x2442('0x3f')](queues[_0x2a9fa4[_0x2442('0x40')]]);queues[_0x2a9fa4[_0x2442('0x41')]][_0x2442('0xc')]=_0x2a9fa4[_0x2442('0x41')];queues[_0x2a9fa4[_0x2442('0x41')]][_0x2442('0x1a')]=0x2;queues[_0x2a9fa4[_0x2442('0x41')]]['calleridnum']=queues[_0x2a9fa4[_0x2442('0x32')]][_0x2442('0x5')];queues[_0x2a9fa4[_0x2442('0x41')]][_0x2442('0x38')]=queues[_0x2a9fa4[_0x2442('0x32')]][_0x2442('0x38')];queues[_0x2a9fa4[_0x2442('0x41')]][_0x2442('0x39')]=utils['now']();queues[_0x2a9fa4['transfertargetuniqueid']][_0x2442('0x14')]=utils['now']();queues[_0x2a9fa4[_0x2442('0x41')]][_0x2442('0x21')]=0x0;queues[_0x2a9fa4[_0x2442('0x41')]][_0x2442('0x3a')]=0x0;}else{queues[_0x2a9fa4[_0x2442('0x33')]][_0x2442('0xc')]=_0x2a9fa4[_0x2442('0x32')];}}}}catch(_0x43364d){utils[_0x2442('0x42')](_0x43364d['stack']);}};exports[_0x2442('0x43')]=function(_0x4bbcb3){if(!_[_0x2442('0x13')](queues[_0x4bbcb3[_0x2442('0xd')]])){queues[_0x4bbcb3['uniqueid']]['musiconholdstartAt']=utils[_0x2442('0x11')]();}};exports[_0x2442('0x44')]=function(_0x4e1c10){if(!_[_0x2442('0x13')](queues[_0x4e1c10[_0x2442('0xd')]])){if(!_[_0x2442('0x13')](queues[_0x4e1c10[_0x2442('0xd')]]['musiconholdstartAt'])){queues[_0x4e1c10[_0x2442('0xd')]][_0x2442('0x3a')]+=utils[_0x2442('0x45')](utils[_0x2442('0x11')](),queues[_0x4e1c10[_0x2442('0xd')]][_0x2442('0x46')]);delete queues[_0x4e1c10['uniqueid']]['musiconholdstartAt'];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index caf123b..995ebf1 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x34e8,0x12c));var _0x834e=function(_0x350304,_0xd46478){_0x350304=_0x350304-0x0;var _0x3ad90f=_0x34e8[_0x350304];return _0x3ad90f;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file +var _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x34e8,0x12c));var _0x834e=function(_0x27dc74,_0x1387ae){_0x27dc74=_0x27dc74-0x0;var _0x12340b=_0x34e8[_0x27dc74];return _0x12340b;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index dee7ef0..9b8fb89 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 _0x8bdf=['origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','assign','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','lodash','util','./utils','info','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','error','stack','attendedtransfer'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8bdf[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf8bd('0x0'));var util=require(_0xf8bd('0x1'));var utils=require(_0xf8bd('0x2'));function writeDB(_0x46b662){utils[_0xf8bd('0x3')](util['format'](_0xf8bd('0x4'),_0x46b662[_0xf8bd('0x5')]));utils[_0xf8bd('0x6')](_0xf8bd('0x7'),_0x46b662);}exports[_0xf8bd('0x8')]=function(_0x261e01){try{_0x261e01['type']='blind';writeDB(_0x261e01);}catch(_0x504c82){utils[_0xf8bd('0x9')](_0x504c82[_0xf8bd('0xa')]);}};exports[_0xf8bd('0xb')]=function(_0x424831){try{_0x424831=_['assign'](_0x424831,{'transfererchannel':_0x424831[_0xf8bd('0xc')],'transferercalleridnum':_0x424831[_0xf8bd('0xd')],'transferercalleridname':_0x424831['origtransferercalleridname'],'transfererconnectedlinenum':_0x424831[_0xf8bd('0xe')],'transfererconnectedlinename':_0x424831[_0xf8bd('0xf')],'transfereraccountcode':_0x424831['origtransfereraccountcode'],'transferercontext':_0x424831[_0xf8bd('0x10')],'transfererexten':_0x424831[_0xf8bd('0x11')],'transfererlinkedid':_0x424831[_0xf8bd('0x12')],'context':_0x424831[_0xf8bd('0x13')],'extension':_0x424831['origtransfererexten'],'type':_0xf8bd('0x14')});if(_[_0xf8bd('0x15')](_0x424831['transfereechannel'])){_0x424831=_[_0xf8bd('0x16')](_0x424831,{'transfereechannel':_0x424831['transfertargetchannel'],'transfereecalleridnum':_0x424831[_0xf8bd('0x17')],'transfereecalleridname':_0x424831[_0xf8bd('0x18')],'transfereeconnectedlinenum':_0x424831[_0xf8bd('0x19')],'transfereeconnectedlinename':_0x424831[_0xf8bd('0x1a')],'transfereeaccountcode':_0x424831[_0xf8bd('0x1b')],'transfereecontext':_0x424831[_0xf8bd('0x1c')],'transfereeexten':_0x424831['transfertargetexten'],'transfereelinkedid':_0x424831['transfertargetlinkedid']});}writeDB(_0x424831);}catch(_0x49478a){utils[_0xf8bd('0x9')](_0x49478a[_0xf8bd('0xa')]);}}; \ No newline at end of file +var _0x5c12=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','stack','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x5c12,0x188));var _0x25c1=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x5c12[_0x4b7e4d];return _0x38d6af;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var utils=require(_0x25c1('0x1'));function writeDB(_0x549b0f){utils[_0x25c1('0x2')](util[_0x25c1('0x3')](_0x25c1('0x4'),_0x549b0f[_0x25c1('0x5')]));utils[_0x25c1('0x6')](_0x25c1('0x7'),_0x549b0f);}exports[_0x25c1('0x8')]=function(_0x5d1516){try{_0x5d1516[_0x25c1('0x5')]=_0x25c1('0x9');writeDB(_0x5d1516);}catch(_0x382922){utils['error'](_0x382922['stack']);}};exports[_0x25c1('0xa')]=function(_0x3b69ba){try{_0x3b69ba=_[_0x25c1('0xb')](_0x3b69ba,{'transfererchannel':_0x3b69ba[_0x25c1('0xc')],'transferercalleridnum':_0x3b69ba[_0x25c1('0xd')],'transferercalleridname':_0x3b69ba['origtransferercalleridname'],'transfererconnectedlinenum':_0x3b69ba[_0x25c1('0xe')],'transfererconnectedlinename':_0x3b69ba[_0x25c1('0xf')],'transfereraccountcode':_0x3b69ba[_0x25c1('0x10')],'transferercontext':_0x3b69ba[_0x25c1('0x11')],'transfererexten':_0x3b69ba[_0x25c1('0x12')],'transfererlinkedid':_0x3b69ba['origtransfererlinkedid'],'context':_0x3b69ba[_0x25c1('0x13')],'extension':_0x3b69ba[_0x25c1('0x14')],'type':'attended'});if(_[_0x25c1('0x15')](_0x3b69ba[_0x25c1('0x16')])){_0x3b69ba=_[_0x25c1('0xb')](_0x3b69ba,{'transfereechannel':_0x3b69ba[_0x25c1('0x17')],'transfereecalleridnum':_0x3b69ba['transfertargetcalleridnum'],'transfereecalleridname':_0x3b69ba['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3b69ba['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3b69ba['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3b69ba[_0x25c1('0x18')],'transfereecontext':_0x3b69ba[_0x25c1('0x19')],'transfereeexten':_0x3b69ba[_0x25c1('0x1a')],'transfereelinkedid':_0x3b69ba[_0x25c1('0x1b')]});}writeDB(_0x3b69ba);}catch(_0x17a032){utils['error'](_0x17a032[_0x25c1('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a515106..c15a99d 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 _0xaa77=['info','debug','stringify','error','stack','request','then','catch','internal','name','interface','GETUSER|','length','FOUND','NOTFOUND','result','getUserByInternal','getUserByName','getVoiceQueueByName','GetVoiceQueue','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','xdr'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0xaa77,0x96));var _0x7aa7=function(_0x43defa,_0x210517){_0x43defa=_0x43defa-0x0;var _0x71f3dc=_0xaa77[_0x43defa];return _0x71f3dc;};'use strict';var jayson=require(_0x7aa7('0x0'));var moment=require(_0x7aa7('0x1'));var BPromise=require('bluebird');var client=jayson[_0x7aa7('0x2')][_0x7aa7('0x3')]({'port':0x2329});var logger=require(_0x7aa7('0x4'))(_0x7aa7('0x5'));exports[_0x7aa7('0x6')]=function(_0x5d2e52){logger[_0x7aa7('0x6')](_0x5d2e52);};exports[_0x7aa7('0x7')]=function(_0x3826d1){logger[_0x7aa7('0x7')](JSON[_0x7aa7('0x8')](_0x3826d1));};exports['error']=function(_0x71505d){logger[_0x7aa7('0x9')](_0x71505d[_0x7aa7('0xa')]);};exports[_0x7aa7('0xb')]=function(_0x1b94d0,_0x50c64b){return client[_0x7aa7('0xb')](_0x1b94d0,{'body':_0x50c64b})[_0x7aa7('0xc')](function(_0x5c1910){logger['debug'](JSON['stringify'](_0x5c1910));})[_0x7aa7('0xd')](function(_0x15db37){logger['error'](_0x15db37['stack']);});};function getUser(_0x28e637){return client[_0x7aa7('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x7aa7('0xe'),_0x7aa7('0xf'),_0x7aa7('0x10')],'where':_0x28e637,'limit':0x1}})[_0x7aa7('0xc')](function(_0x343fea){logger[_0x7aa7('0x6')](_0x7aa7('0x11')+JSON[_0x7aa7('0x8')](_0x28e637)+'|'+(_0x343fea['result'][_0x7aa7('0x12')]?_0x7aa7('0x13'):_0x7aa7('0x14')));return _0x343fea[_0x7aa7('0x15')][_0x7aa7('0x12')]?_0x343fea[_0x7aa7('0x15')][0x0]:null;});}exports[_0x7aa7('0x16')]=function(_0x1ec115){return new BPromise(function(_0x5e2406,_0x42ef68){if(_0x1ec115){return getUser({'internal':_0x1ec115})[_0x7aa7('0xc')](function(_0x49dd72){return _0x5e2406(_0x49dd72);})[_0x7aa7('0xd')](function(_0x1119cf){logger['error'](_0x1119cf[_0x7aa7('0xa')]);return _0x5e2406(null);});}else{return _0x5e2406(null);}});};exports['getUserByInterface']=function(_0x42bff8){return new BPromise(function(_0x529a5d,_0x24e52d){if(_0x42bff8){return getUser({'interface':_0x42bff8})['then'](function(_0x20953d){return _0x529a5d(_0x20953d);})['catch'](function(_0x1e1f92){logger[_0x7aa7('0x9')](_0x1e1f92[_0x7aa7('0xa')]);return _0x529a5d(null);});}else{return _0x529a5d(null);}});};exports[_0x7aa7('0x17')]=function(_0x5cdfde){return new BPromise(function(_0xbb6616,_0x5167b9){if(_0x5cdfde){return getUser({'name':_0x5cdfde})[_0x7aa7('0xc')](function(_0x4c1843){return _0xbb6616(_0x4c1843);})['catch'](function(_0x2c180d){logger[_0x7aa7('0x9')](_0x2c180d[_0x7aa7('0xa')]);return _0xbb6616(null);});}else{return _0xbb6616(null);}});};exports[_0x7aa7('0x18')]=function(_0x438ce4){return new BPromise(function(_0x37b060,_0x5c1f0a){if(_0x438ce4){return client[_0x7aa7('0xb')](_0x7aa7('0x19'),{'options':{'raw':!![],'attributes':['id',_0x7aa7('0xf'),'type','acw',_0x7aa7('0x1a')],'where':{'name':_0x438ce4},'limit':0x1}})[_0x7aa7('0xc')](function(_0x1aa75c){logger['info'](_0x7aa7('0x1b')+_0x438ce4+'|'+(_0x1aa75c[_0x7aa7('0x15')]['length']?_0x7aa7('0x13'):_0x7aa7('0x14')));return _0x37b060(_0x1aa75c[_0x7aa7('0x15')][_0x7aa7('0x12')]?_0x1aa75c[_0x7aa7('0x15')][0x0]:null);})[_0x7aa7('0xd')](function(_0x320527){logger[_0x7aa7('0x9')](_0x320527[_0x7aa7('0xa')]);return _0x37b060(null);});}else{return _0x37b060(null);}});};exports[_0x7aa7('0x1c')]=function(_0x992348,_0x286a6c){return moment(_0x992348)[_0x7aa7('0x1d')](_0x286a6c,_0x7aa7('0x1e'))['format'](_0x7aa7('0x1f'));};exports[_0x7aa7('0x20')]=function(_0x1efd04,_0x5318be){return moment(_0x1efd04)[_0x7aa7('0x21')](_0x5318be,_0x7aa7('0x1e'))[_0x7aa7('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7aa7('0x23')]=function(_0x598124,_0x177411){return moment(_0x598124)[_0x7aa7('0x24')](moment(_0x177411),_0x7aa7('0x1e'));};exports['sumTime']=function(_0x509ed6,_0x49b4ac){return parseInt(_0x509ed6,0xa)+parseInt(_0x49b4ac,0xa);};exports['now']=function(){return moment()[_0x7aa7('0x22')](_0x7aa7('0x1f'));};exports[_0x7aa7('0x25')]=function(_0x1274a2,_0x3d43a2){if(_0x3d43a2){return moment(_0x1274a2)[_0x7aa7('0x25')](_0x3d43a2);}else{return!![];}};exports[_0x7aa7('0x26')]=function(_0x55bedd,_0x39719d){if(_0x39719d){return moment(_0x55bedd)[_0x7aa7('0x26')](_0x39719d);}else if(_0x55bedd){return!![];}else{return![];}}; \ No newline at end of file +var _0xd17c=['error','stack','request','then','catch','GetUser','name','GETUSER|','result','FOUND','NOTFOUND','length','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','addTime','format','YYYY-MM-DD\x20HH:mm:ss','seconds','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','client','http','xdr','info','debug','stringify'];(function(_0x2adacb,_0x1bdfa0){var _0x28b3b1=function(_0x574373){while(--_0x574373){_0x2adacb['push'](_0x2adacb['shift']());}};_0x28b3b1(++_0x1bdfa0);}(_0xd17c,0x120));var _0xcd17=function(_0x3cc4ff,_0x361ae2){_0x3cc4ff=_0x3cc4ff-0x0;var _0x2abae2=_0xd17c[_0x3cc4ff];return _0x2abae2;};'use strict';var jayson=require(_0xcd17('0x0'));var moment=require(_0xcd17('0x1'));var BPromise=require('bluebird');var client=jayson[_0xcd17('0x2')][_0xcd17('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0xcd17('0x4'));exports['info']=function(_0x290a99){logger[_0xcd17('0x5')](_0x290a99);};exports[_0xcd17('0x6')]=function(_0xd73506){logger[_0xcd17('0x6')](JSON[_0xcd17('0x7')](_0xd73506));};exports[_0xcd17('0x8')]=function(_0xb0fce2){logger['error'](_0xb0fce2[_0xcd17('0x9')]);};exports[_0xcd17('0xa')]=function(_0x32d9d0,_0x85dddf){return client[_0xcd17('0xa')](_0x32d9d0,{'body':_0x85dddf})[_0xcd17('0xb')](function(_0x432c5d){logger[_0xcd17('0x6')](JSON[_0xcd17('0x7')](_0x432c5d));})[_0xcd17('0xc')](function(_0x51993d){logger['error'](_0x51993d['stack']);});};function getUser(_0x5db483){return client['request'](_0xcd17('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0xcd17('0xe'),'interface'],'where':_0x5db483,'limit':0x1}})[_0xcd17('0xb')](function(_0x191117){logger[_0xcd17('0x5')](_0xcd17('0xf')+JSON['stringify'](_0x5db483)+'|'+(_0x191117[_0xcd17('0x10')]['length']?_0xcd17('0x11'):_0xcd17('0x12')));return _0x191117[_0xcd17('0x10')][_0xcd17('0x13')]?_0x191117['result'][0x0]:null;});}exports[_0xcd17('0x14')]=function(_0x28e871){return new BPromise(function(_0x50a299,_0x107f1b){if(_0x28e871){return getUser({'internal':_0x28e871})[_0xcd17('0xb')](function(_0x58632b){return _0x50a299(_0x58632b);})[_0xcd17('0xc')](function(_0x42fe01){logger[_0xcd17('0x8')](_0x42fe01[_0xcd17('0x9')]);return _0x50a299(null);});}else{return _0x50a299(null);}});};exports[_0xcd17('0x15')]=function(_0x1512da){return new BPromise(function(_0x22c431,_0x50fc58){if(_0x1512da){return getUser({'interface':_0x1512da})[_0xcd17('0xb')](function(_0x2a9028){return _0x22c431(_0x2a9028);})[_0xcd17('0xc')](function(_0x2fa641){logger[_0xcd17('0x8')](_0x2fa641[_0xcd17('0x9')]);return _0x22c431(null);});}else{return _0x22c431(null);}});};exports[_0xcd17('0x16')]=function(_0x162245){return new BPromise(function(_0x54766e,_0x7ab55c){if(_0x162245){return getUser({'name':_0x162245})[_0xcd17('0xb')](function(_0x4f4f9b){return _0x54766e(_0x4f4f9b);})[_0xcd17('0xc')](function(_0x391571){logger[_0xcd17('0x8')](_0x391571[_0xcd17('0x9')]);return _0x54766e(null);});}else{return _0x54766e(null);}});};exports[_0xcd17('0x17')]=function(_0x18343d){return new BPromise(function(_0x89aab9,_0x4998b8){if(_0x18343d){return client[_0xcd17('0xa')](_0xcd17('0x18'),{'options':{'raw':!![],'attributes':['id',_0xcd17('0xe'),_0xcd17('0x19'),_0xcd17('0x1a'),'acwTimeout'],'where':{'name':_0x18343d},'limit':0x1}})[_0xcd17('0xb')](function(_0x2cfa0e){logger['info'](_0xcd17('0x1b')+_0x18343d+'|'+(_0x2cfa0e[_0xcd17('0x10')][_0xcd17('0x13')]?_0xcd17('0x11'):_0xcd17('0x12')));return _0x89aab9(_0x2cfa0e['result'][_0xcd17('0x13')]?_0x2cfa0e[_0xcd17('0x10')][0x0]:null);})[_0xcd17('0xc')](function(_0x5a64af){logger['error'](_0x5a64af[_0xcd17('0x9')]);return _0x89aab9(null);});}else{return _0x89aab9(null);}});};exports[_0xcd17('0x1c')]=function(_0x1291c1,_0x4c2e21){return moment(_0x1291c1)['add'](_0x4c2e21,'seconds')[_0xcd17('0x1d')](_0xcd17('0x1e'));};exports['subtractTime']=function(_0x40464f,_0x34575a){return moment(_0x40464f)['subtract'](_0x34575a,_0xcd17('0x1f'))[_0xcd17('0x1d')](_0xcd17('0x1e'));};exports[_0xcd17('0x20')]=function(_0x38674d,_0x1edc31){return moment(_0x38674d)['diff'](moment(_0x1edc31),_0xcd17('0x1f'));};exports[_0xcd17('0x21')]=function(_0x5efe78,_0x3e2d69){return parseInt(_0x5efe78,0xa)+parseInt(_0x3e2d69,0xa);};exports[_0xcd17('0x22')]=function(){return moment()[_0xcd17('0x1d')](_0xcd17('0x1e'));};exports[_0xcd17('0x23')]=function(_0x328e87,_0xc55d08){if(_0xc55d08){return moment(_0x328e87)['isAfter'](_0xc55d08);}else{return!![];}};exports[_0xcd17('0x24')]=function(_0x2d87af,_0xffcdf3){if(_0xffcdf3){return moment(_0x2d87af)[_0xcd17('0x24')](_0xffcdf3);}else if(_0x2d87af){return!![];}else{return![];}}; \ No newline at end of file